cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem

Former Member
0 Kudos

How can I split a String field in order to generate registers on a Target SAP table?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ruben,

Within the mapping you can use the standart Text function such as substring or you can write a UDF. Can you send an example of what you are trying to achieve?

regards,

HM

Answers (7)

Answers (7)

Former Member
0 Kudos

I have the java code to split the source string (that I don`t know length before hand) my problem is how to do the mapping in order to generate a register on the target structure for each string generated by the spliting java function?

Help!

henrique_pinto
Active Contributor
0 Kudos

Use 132 bytes sized buffer in an UDF of context type. Parse your input string with that buffer and for each 132 bytes, generate a new entry in your ResultList. After your UDF, use a SplitByValue standard function.

Make sure your target field is unbounded.

Regards,

Henrique.

Former Member
0 Kudos

Hi Ruben,

Just go through the given link:

http://www.sapgenie.com/netweaver/xi/mapping1.htm

hopefully it answers your question.

Regards

Neetu

Former Member
0 Kudos

Ruben,

You can have a Global Variable where you can store the string value and then for each target element where you want to split the string use the global variable value which will have your string and you can split it according to the length of the target element.

Hope this helps.

Former Member
0 Kudos

I have the java code to split the source string (that I don`t know length before hand) my problem is how to do the mapping in order to generate a register on the target structure for each string generated by the spliting java function?

Former Member
0 Kudos

I don`t know before hand the length of the source String.

Former Member
0 Kudos

Hey

this is how a substring function work

substring

public String substring(int beginIndex,

int endIndex)Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.

Examples:

"hamburger".substring(4, 😎 returns "urge"

"smiles".substring(1, 5) returns "mile"

so in ur case

wrote a small udf fuunction with the source string as input which will be taken as 'a'.

so write a function with

int len;

String s1;

String s2;

String s3;

len=a.length();

if(length>310)

{

s1="a".substring(0,132);

s2="a".substring(133,264);

s3="a".substring(265,76);

}

return s1;

return s2;

return s3;

cheers

jithesh

Former Member
0 Kudos

In the source message I have a String field (along other fields) with length n but on the target message I have a SAP table with a char field of 132 characters (along other field), I need to split the source string in order to generate registers on the SAP table of 132 characters, example:

Source String: 340 characters

Target Table: 3 registers, 2 of 132 characters and 1 of 76 characters

Former Member
0 Kudos

Hi Ruben,

What u can do is map the source string to the registers with a Text Function 'SUBSTRING' in between.

In each of the substring functions u can mention

Start From: 0 Count: 132

Start From: 132 Count: 132

Start From: 264 Count: 132

Start From: 396 Count: 132

and so on.

Regards

Neetu

udo_martens
Active Contributor
0 Kudos

Hi Ruben,

which requiredment do you have? Which mapping do you want to use? Where/How do you want to split the string?

Regards,

Udo

Former Member
0 Kudos

Hi Ruben,

A standard text function should suffice right? Use Substring, to split your value in graphical mapping

cheers,

Prashanth

P.S Please mark helpful answers