cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicating Subtree - used to duplicate segment of the IDOC

Former Member
0 Kudos

Hi,

We're currently doing a file to idoc. We need to duplicate E1MBXYI. This is because for every material in the file, two E1MBXYI segments will be created. One segment will hold Duty Paid details, the other Duty Suspended details. So if there are 2 materials in the file, 4 E1MBXYI should be created. The structure should be as follows:

E1MBXYI - 50746 (material) this contains Duty Suspended data

E1MBXYI - 50746 (material) this contains Duty Paid data

E1MBXYI - 50747 (material) this contains Duty Suspended data

E1MBXYI - 50747 (material) this contains Duty Paid data

Below is the structure of the source file:

RECORD

LINE_ITEM

MATNR

DP

DP Amount

DS

DS Amount

Receiver Structure

IDOC

EDI_DC

E1MBXY1

matnr

ZWSTWK

dp or ds

Since we need to generate two E1MBXY1 segments, we duplicate E1MBXYI, thus this is now the structure in our mapping.

IDOC

EDI_DC

E1MBXY1

matnr

ZWSTWK

dp

E1MBXY1

matnr

ZWSTWK

ds

But the problem is the output we're getting is this:

E1MBXYI - 50746 (material) this contains Duty Suspended data

E1MBXYI - 50747 (material) this contains Duty Suspended data

E1MBXYI - 50746 (material) this contains Duty Paid data

E1MBXYI - 50747 (material) this contains Duty Paid data

Since we're using removecontexts, splitbyvalue, collapsecontexts functions to every E1MBXYI.

The first E1MBXYI splits all materials first. After this, then the second (duplicate) E1MBXYI do the same. In this case, the same materials are not subsequent or are not next to each other. Is there other way to map the fields to the segments and generate this output? Kindly advise. Thanks!

E1MBXYI - 50746 (material) this contains Duty Suspended data

E1MBXYI - 50746 (material) this contains Duty Paid data

E1MBXYI - 50747 (material) this contains Duty Suspended data

E1MBXYI - 50747 (material) this contains Duty Paid data

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mariel !

I'm not sure if you really need to duplicate the E1MBXYI segments in the target structure. Just use the DP and DS source fields to create a E1MBXYI segment using an advanced UDF function.

The idea is: that udf should receive 2 queues, the DP and the DS queues, merge them in a new queue (string array) taking one item of the DP queue and one of the DS queue, and so on...the resulting queue should be assigned to the E1MBXYI segment node..

If the input queues of values of DP and DS, have, say 8 values each, then the output of this udf will be a 16 value array, that mapped to the E1MBXYI segment will generate 16 E1MBXYI segments on target.

You will need to use this UDF to map DP and DS to E1MBXYI, then DP amount and DS amount to E1MBXYI."Amount" field.

Regards,

Matias.

ps: please award points if helpful