Skip to Content
0

Split input string to chunk of characters and assign it to target idoc line item

Mar 05 at 12:12 PM

114

avatar image

Hello Experts,

My requirement is like this.

Input field is having values more than 135 characters and we want to split this value to multiple segments of IDOC SEGMENT. This is like First 13 characters to segment one ,secon d 13 to segment 2 and so on.

I tried with solit by value(each value but it did not work. Can someone please help me on this?

Really appreciate help.

Thanks in advance,

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

14 Answers

BRM Fresher Mar 06 at 06:02 PM
0

Hello Experts,

Any help on this please?

Thanks in advance

Share
10 |10000 characters needed characters left characters exceeded
BRM Fresher Mar 06 at 06:29 PM
0

Hello Experts,

Any help on this please ?

Thanks in advance

Share
10 |10000 characters needed characters left characters exceeded
Mark Dihiansan Mar 07 at 07:50 AM
0

Hi,

I do not have PI at the moment, but you can replace System.out.println with result.AddValue;

Hope this helps,

Mark


test.png (26.3 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thamks Mark and Evgeniy for your valueable replies. Let me try.

0
BRM Fresher Mar 05 at 03:00 PM
0

Hello Experts,

Any help on this please?

Thanks in advance

Share
10 |10000 characters needed characters left characters exceeded
BRM Fresher Mar 05 at 06:09 PM
0

I tried the code in this discussion but its giving the error.

Can you please help me correct the code in this discussion?

https://archive.sap.com/discussions/thread/3160240

Thanks in advance

Share
10 |10000 characters needed characters left characters exceeded
BRM Fresher Mar 05 at 06:29 PM
0

I corrected the UDF like this but it did not work

int size = 13; for (int i = 0; i < input.length(); i += size){ int end = i + size > input.length(); input.length() = i + size; result.addValue(input.substring(i, end)); }

Can someone please help on this?

Thanks in advance

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Mar 07 at 01:54 PM
0

Hi BRM Fresher!

It looks like you use single value UDF to produce result list.

As far as I remember, if you want to return a list of values, you should switch to all values of context or all values of queue and process input array instead of single value.

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
BRM Fresher Mar 07 at 06:25 PM
0

Hello Mark,

Do I select it as Argument or parameter? Also should it have any Result/Output parameter ?

Thanks in advance

Share
10 |10000 characters needed characters left characters exceeded
BRM Fresher Mar 07 at 06:51 PM
0

Hi Mark,

I created it this way but it did not work. Did I use the code correctly or there is any error in using it? Can you please advise where it went wrong?

Thanks in advance


image1.png (5.9 kB)
image2.png (10.2 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Try this one:

Test

Regards,

Mark

code.png (16.8 kB)
test.png (32.1 kB)
0
BRM Fresher Mar 08 at 04:45 AM
0

Tried with this code

Getting this error

Can you please tell me where it went wrong?

Thanks in advance


image-3.png (7.6 kB)
image-4.png (8.2 kB)
image-5.png (3.1 kB)
Share
10 |10000 characters needed characters left characters exceeded