cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping help

Former Member
0 Kudos

Hi Every one,

I have a mapping requirement where i have to take only the first seven chars (on left side)in the field.

For example if the value of the target field is 123456789. the mapping result should be only 1234567. can any one please help me how to achive this.

Regards

Swetha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Swetha,

Have you tried using the 'Substring' standard function in your graphical mapping?

http://help.sap.com/saphelp_nw04s/Helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

There should be lots of examples of this on SCN.

Regrds, Trevor

Former Member
0 Kudos

Hi Trevor,

I have tried substring,

for example my requirement is:

My source field is S5079826-1-USP1 i want only S507982

for this i use substring 0,6 but it is trowing below error.

Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 6] in class com.sap.aii.mappingtool.flib7.TextFunctions method substring[, 0, 6, com.sap.aii.mappingtool.tf7.rt.Context@7aa16d08]

Please can anyone help me out of this.

Regards

iaki_vila
Active Contributor
0 Kudos

Hi Swetha,

If your tag doesn't exist or the length is less than 7 positions, the function substring  fails. Try this:

(I used country tag as source and target field for this example)

Regards.

Former Member
0 Kudos

Hi Swetha,

Verify your source field actually has that value and add a check in your mapping to prevent the error, if for example the source doesn't have any value.

This happens when you are trying to take more characters that what is in the source. Also, you should 0,7 for your result.

Regards, Trevor

Answers (0)