Skip to Content
avatar image
Former Member

Sequence Number in XI Mapping

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    May 10, 2006 at 08:41 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • May 10, 2006 at 08:42 AM

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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

  • May 10, 2006 at 08:54 AM

    Hi Sandeep,

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

    Regards,

    Udo

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 10, 2006 at 12:14 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 16, 2007 at 07:03 AM

    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

    Add comment
    10|10000 characters needed characters exceeded