cancel
Showing results for 
Search instead for 
Did you mean: 

How to Send a Value from source to Target as 3 split value

Former Member
0 Kudos

Hi Expert,

I need a help.

My requirement is I have  a filed name "Comments" in source  system and this comment filed i needs to pass to the target in 3 fields.The comment value will be separated in 3 fields like 1)Details 1, 2)Details 2,and 3) Details,as a 40 character. so how can i get this output Kindly help me.Thanks in advanced.

\

Accepted Solutions (1)

Accepted Solutions (1)

Muniyappan
Active Contributor
0 Kudos

Hi wasim,

are you telling that comments total length will be 120. you have to split into three part with length 40. if this is constant you can use substring function.

use standard function when length is constant. i.e it should always come with 120 length.


if length is dynamic you can use udf.

Former Member
0 Kudos

Hi Muniyappan

Yes i want to do this whatever you mention.

Kindly explain me how to do.

Thank you

Muniyappan
Active Contributor
0 Kudos

i am giving you steps for fixed lengths,i.e input will always come with 120 char length.

input value = 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

Former Member
0 Kudos

Hi Muniyappan,

Thank You so much.

I will follow your logic and complete the mapping.

Thanks and Regards

Wasim Rana

Harish
Active Contributor
0 Kudos

Hi Wasim,

you can use the below UDF.

Input parameter

input - input string

number - how many no of char (in your case it is 40)

pos - which position you want (1 for first 40, 2 for 2nd..)

int num = Integer.parseInt(number);

  int posi = Integer.parseInt(pos);

String res = "";

if(input.length()>num*posi)

  {

  res = (input.substring(num*(posi-1), num*posi));

  }

  else

  if (input.length()>num*(posi-1))

  {

  res = (input.substring(num*(posi-1)));

  }

return res;

regards,

Harish

Former Member
0 Kudos

Hi Wasim,

Validate the field if the length is greater than 40 (or 80 or 120) before Sub string, other wise it will error out mapping step. You can either use standard function if then or else or use the UDF provided by Harish.

Regards,

Pranav

Former Member
0 Kudos

Hi Muniyappan,


Its working fine  but every time needs to put 120 char,then only got output.

Now problem is suppose my input length is 90 char,then 40 char will go to 1st filed,then 40 filed will go to 2nd filed and reaming char will go to 3rd field.

So can you tell me how to overcome this issue.


Thanks and regards

Wasim Rana

Harish
Active Contributor
0 Kudos

Hi Wasim,

you can try the UDF which i given in above reply.

regards,

Harish

Former Member
0 Kudos

Hi Harish

Thank you for your support.But I am unable to use this UDF,Kindly give me some more explanation with screen shot.

Regards

Wasim Rana

Muniyappan
Active Contributor
0 Kudos

you have to use UDF. that is why i asked the question in my first reply.

Former Member
0 Kudos

Hi Harish

I am unable to use your UDF function.

Kindly help me.

Regards

Wasim

Harish
Active Contributor
0 Kudos

Hi Wasim,

Please refer the below screenshot

regards,

Harish

Former Member
0 Kudos

Hi Harish,

Thank you so much Harish for your kind help.

Now its working fine.

I am really very thankful to you,

and thanks to all of you.

Reagrds

Wasim Rana

Harish
Active Contributor
0 Kudos

Hi Wasim,

Good to know that your problem is resolved. Can you please close the discussion? Please refer the below blog for reference

regards,

Harish

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi wasim,

Please find the below links might be help you.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/90dcc6f4-0829-2d10-b0b2-c892473f1...

Regards,

Rajendar K