Skip to Content
avatar image
Former Member

Advanced Node functions help

Hi,

I have file to Idoc scenario, where my input file structure like below and need to create Idoc segments in SAP.

Input Structure:

Record (1--Unbounded)

Header (1-1)

Item_Details (1- Unbounded)

Item_1 (1--1)

abc

def

Item_2 (1--1)

abc

def

Item_3 (1--1)

abc

def

Now..I need to generate an Idoc segment "Z1ABCD", as many as child Item segments(Item_1,Item_2,Item_3) occurs in my input structure. Lets say, if my input structure have 2 Item_Details, then I need to generate 6 "Z1ABCD" segments in Idoc. I'm able generate these segments..my code generating all the Item_1 segments then Item_2 segments like that...But I'm expecting a "Z1ABCD" segment at Item_details node level...like Item1,2,3 and then Item1,2,3....Please help me out!

Note: My mapping looks like this;

Item_1 ->remove context >Split by value(each) ->CollapseContext ->Z1ABCD

Item_2 ->remove context >Split by value(each) ->CollapseContext ->Z1ABCD

Item_3 ->remove context >Split by value(each) ->CollapseContext ->Z1ABCD

-Esha

Edited by: esha nadh on Mar 9, 2011 5:20 AM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 09, 2011 at 07:06 AM

    Hello,

    You can try using this mapping:

    Item_1 --> removeContext --> concat: : --> concat: : --> UDF --> Z1ABCD
    Item_2 --> removeContext --> /             /
    Item_3 --> removeContext ---------------> /
    

    UDF is of context type

    arguments: input

    code is

    for(int a=0;a<input.length;a++){
    String [] temp = input.split(":");
     for(int b=0;b<temp.length;b++){
      result.addValue(temp<b>);
     }
    }
    

    The reason for using a UDF is that there is no way to group the items 1, 2 and 3 values. Therefore, you concat them and use a splitter so that they get outputted in 1,2,3,1,2,3 order.

    Hope this helps,

    Mark

    Edited by: Mark Dihiansan on Mar 9, 2011 8:11 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Mark Dihiansan

      the occurrence of Z1ABCD is 0-unbounded. My only concern is mapping of Item2 and Item3 info.

      if I have only one Z1ABCD then I can only map it to one node from input structure...for testing I just used the Item1 info map with one Z1ABCD and sent Item1 and Item2 info (2 Item details ) from input structure...I can see 4 "Z1ABCD" segments....two "Z1ABCD" segments are filled with Item1 info and other 2 "Z1ABCD" segments are blank.

      -esha

  • avatar image
    Former Member
    Mar 09, 2011 at 05:04 AM

    any help would be appreciate.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 09, 2011 at 07:22 AM

    Hi Esha,

    Try this way...

    keep the 3 copies of 'Z1ABCD' at the target side (using duplicate subtree) and map item_1 ,item_2 & item_3, to the corresponding copies of 'Z1ABCD' .

    Keep the context as it is , dont remove them.

    Thanks,

    Jyoti

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      the parent of "Z1ABCD" segment is an IDoc segment..which is connected to Record node in Input structure. I'm using Idoc tunneling concept here..which creates for N no.of records it will create N no.of Idocs.

      -Esha