Quantcast
Channel: SCN : Unanswered Discussions - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 6719

UDF doubt

$
0
0

Hi Team,

 

We are using below UDF for one mapping.

 

If we pass value "(UT 30582046 30582047)" or UT(30582046 30582047) , its failing due to reason "Shipping instruction text is not formatted well, it should starts either with (UT or UT( and then enclosed with the linkded orders". why??

 

can you help me what we are doing with below UDF.

 

String returnValue = refDescr;
boolean valid = false;

// Pass only the Header order into RF~UT segment for both header and the linked orders


if( (refDescr.indexOf("UT") != -1) && (refDescr != "") ) {
   if( (refDescr.startsWith("(UT") || refDescr.startsWith("UT(")) &&  (refDescr.indexOf(',') != -1 )){

       returnValue = refDescr.substring(3, refDescr.length()).replaceAll("\\(", "").replaceAll("\\)", "").trim();
       List<String> linkDeliv      = Arrays.asList(returnValue.split(","));

         if(linkDeliv.size() > 0){
             for(int i = 0; i < linkDeliv.size(); i++){
             if(headDeliv.equals(linkDeliv.get(i).toString().trim())){
                  returnValue = linkDeliv.get(0).toString().trim();
              valid = true;
                   break;
                  }
             }
          }
       }
  }
  else
// If the shipping instruction is blank or doesn't contain "UT", retrun the respective order into the UT segment
      {
      returnValue = headDeliv;
      valid = true;
      }

if(!valid) 
   throw new RuntimeException("Shipping instruction text is not formatted well, it should starts either with (UT or UT( and then enclosed with the linkded orders");

return returnValue;


Viewing all articles
Browse latest Browse all 6719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>