cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence Number in XI Mapping

Former Member
0 Kudos

Hi All,

I have scenario where a sequence number when mapping is done. Consider the example:

In the source message I have one header and 10 line items in the message. The line item in the target message has a field called sequence number. When i map the source message to the target message each of the target line items hould have a sequence number in the order 1, 2, 3..10.

How can this be done? Is there a feature in XI which lets us have a global variable which can be incremented for each line item or a java class which can generate new sequence number for each line item or something.

I'm using message mapping. Java mapping is not used.

Could you please help me?

Thanks,

Sandeep

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

yes, there is a global variable concept in XI which u can use for your Sequence Number concept.

If you are on SP14 and above, just take a lookat this blog and the GLOBAL Variables Section

/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14

Regards,

bhavesh

Answers (4)

Answers (4)

Former Member

Sandeep

There is a function "Counter". You select this and specify your starting value and incremental value. In your scenario you add one more field to your structure in lineitems and add this counter to that field. So the starting value you give as '0' and increment it by '1'.

---Satish

Former Member
0 Kudos

Hi Sandeep.

try with this

/******UDF*******/

for(int i = 1 ; i<=a.length; i++)

result.addValue(i+"");

Create queue mapping...assume "a" is String array.

Cheers!

Samarjit

udo_martens
Active Contributor
0 Kudos

Hi Sandeep,

use Message Mapping function <i>index()</i>. Or X-Path funktion <i>position</i>, if you want to use XSLT.

Regards,

Udo

STALANKI
Active Contributor
0 Kudos

You can definetly do using global container or container in message mapping.you can check this out as one of the mapping pattern...

Former Member
0 Kudos

Hello Sravya,

Could you please let me know a blog or link which talks about global container or container concept?

Thanks,

Sandeep

Former Member
0 Kudos

Hi Sandeep,

You can achieve this by Standard 'Index' function in group STATISTICS

Regards

Vijaya

Former Member
0 Kudos

Hi Sandeep,

u can follow these steps to generate a sequence no using global container.

-> define a global variable by clicking the JAVA_SECTION_TOOLTIP icon on the design tab of source message type of ur message mapping.

enter the following in the GlobalVariables Section

Integer counter =0;

-> define a user defined function (<b>SeqGen</b> let's say)

write the following code in it.

Integer seq = 0;

GlobalContainer globalContainer = container.getGlobalContainer();

a = globalContainer.getParameter("counter");

seq = globalContainer.getParameter("counter");

seq = seq + 1;

globalContainer.setParameter("counter",seq);

return a;

now use this user defined function (SeqGen)in all ur mappings to the sequence no of ur line items.

Hope this helps.

Anil