cancel
Showing results for 
Search instead for 
Did you mean: 

MSG SPLIT USING UDF

former_member194741
Participant
0 Kudos

Hi All,

I requires one simple udf, i have 1 field called msg contains the below format.The delimiter is comma.But the value has no fixed format

msg - 0001221324,2000000010.

it may be like this 1221324,2000000010 also.

Can anyone suggest udf for this, i want to split this msg and map to 2 fields to vendor no and PO NO.

from starting from beginning, can anyone explain the flow to create the udf.

PFA file for my mapping.

Thanks,

dhanush

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member184789
Active Contributor
0 Kudos

Hi,

Creat a UDF with two inputs, var1 & var 2. As you have 2 fields separated by comma, for getting 0001221324 from 0001221324,2000000010 give constant 0 as second input & the source field as first input. Similarly for getting 2000000010 from 0001221324,2000000010, give constant 1 as second input and the source as first input.

String[] result = var1.split(",");

      int length = 0;

     if(result != null) {

      length = result.length;

      }

      if(var2 < length){

      return result[var2];}

     else {

      return "";

     }

the splitted strings will be passed as per the no.given in the input. Suppose a string is adarsh,dhingra,kolkata; based on int input 0, adarsh will be passed;1 will give dhingra & 2 will give kolkata.

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>I requires one simple udf, i have 1 field called msg contains the below format.


if it's that simple why ask for it on the forum and not just do it ?

idea:

String string = "0001221324,2000000010.";

String[] parts = string.split("-");

String part1 = parts[0]; // 0001221324

String part2 = parts[1]; // 2000000010.

Regards,

Michal Krawczyk

former_member194741
Participant
0 Kudos

Hi Michael,

I need a help from u, We got 1 reqt which is same as of blog posted previously.

http://scn.sap.com/people/michal.krawczyk2/blog/2010/01/22/pixi-how-to-get-an-xml-file-from-a-web-pa....

I had referred ur blog, but still i need some clarification from ur side.I want to take the Exchange rate from a website and to update the SAP system.

Using wget and file adapter, u had explained, It would be great if u explain in brief.

I had taken only the RSS feeds xml file from a website.

Regards,

Dhanush