cancel
Showing results for 
Search instead for 
Did you mean: 

message split

former_member194741
Participant
0 Kudos

Hi all,

i have 3 fields in source

sender

receiver

msg------- it contains vendor no and PO.NO , its a text msg

in my target, i have 4 fields

sender

receiver

vendor

po no

my reqt, i have to split the text msg in to two and to map, i had tried substring, but it doesnt worked.

I need solution for this.

Thanks in adavance,

dhanush

Accepted Solutions (0)

Answers (2)

Answers (2)

venkatagiri_gongadi
Participant
0 Kudos

Hi,

if your 3rd input is fixed length value then you can substring that.

what is the max length of your field and length of lifnr and PO NO?

Regards,

Girii

Former Member
0 Kudos

Hi karthick,

As per my understanding In you source field msg has to spilt in two part and mapped to vendor , po no .

Just also describe that how will you differentiated between vendor no  PO no . There should be any length or any key point so that you can differentiate between then and can split by using UDF .

thanks and regards,

Anup Banerjee

former_member194741
Participant
0 Kudos

hI ANUP,

       I will get SMS and got stored in DB, IN DB 3 fields r there. sender,receiver, and msg.

in msg- its a text msg contains lifnr=1000271, PO.NO:1000000725 .

the above is a text msg and like one sentence it will be.

so i want to take the both values and to map with bapi inputs, which is sender,rec,po, vendor.

This is my reqt. Can u tell any alternatives for this.

Thanks,

dhansuh

Former Member
0 Kudos

Is your pattern of msg is fixed as lifnr=1000271, PO.NO:1000000725 . that  lifnr and PO.NO is separated by comma and it will always come as lifnr= and PO.NO:

??

thanks and regards,

Anup Banerjee

Former Member
0 Kudos

Hi ,

write a small udf  to full fill this.

1)Split the message based on delimiter.

String[] seperated = inputString.split(",");


2)Replace lifnr= and PO.NO: with empty and trim the values before passing as o/p.

First try to write code for above udf .If you could not able to write ;let me know i will write a small piece of code for you.

Regards

Venkat

former_member194741
Participant
0 Kudos

Hi,

Great, Currently i am having only test msg values , so i am not aware of pattern of that, but its a SMS only, sent from a mobile.

case 1; it has fixed pattern

case 2 : pattern will changes

so can u guide for both cases, sorry currently i am not aware of that.

Regards,

dhanush

former_member194741
Participant
0 Kudos

Hi,

Thanks, UDF i am new to that, so let me try my best, but it will be great, u can help me in that.

  regards,

Dhanush

gagandeep_batra
Active Contributor
0 Kudos

Hi Karthick,

if your text message is fixed length then you can go for message mapping only:

and in test i got following values:

Regards

Gagan

Former Member
0 Kudos

Hi ,

Here is the code.

for(int i=0;i<inputString.length;i++) //use for loop for mutliplte msg other wise just comment it

{

String[] s = inputString[0].split(",");

vendor.addValue(s[0].replaceAll("lifnr=",""));

PONO.addValue(s[1].replaceAll("PO.NO:",""));

}

use trim b/w udf and o/p fields

Regards

Venkat

Former Member
0 Kudos

Hi,

split in a UDF like this:

UDF Code:

String[] splitarray = msg[0].split(",");

result.addValue(splitarray[0].replaceAll("[^0-9]", ""));

result.addValue(splitarray[1].replaceAll("[^0-9]", ""));

msg is your input type.

regards,

Robin

Former Member
0 Kudos

Hi,

Look for indexOf function ...which retrieves the position and from there you can fetch the needed data...

No need to go for UDF...

HTH
Rajesh

former_member194741
Participant
0 Kudos

Hi,

i was trying with ur code, but cant able to get. can u explain end to end how to use UDF fn, i had created 1 udf, trim also i found.

but still complicated.

Regards,

dhanush

former_member194741
Participant
0 Kudos

Hi,

i was trying with ur code, but cant able to get. can u explain end to end how to use UDF fn, i had created 1 udf, in msg i want to give as vendor and PO,

but still complicated. Can u explain me in brief.

Regards,

dhanush