cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a new segment in IDoc for multiple occurance of Control Num

Former Member
0 Kudos

Hi Experts,

In my scenario, i need to generate a new segment in IDoc(Target Structure) based on Control Number Field in the Source Structure.

The segment need to be created for multiple occurance of the Control Number.

Ex:

Control Number - 100 appears 5 times in Source Structure.This control Number is mapped to one of the Field in the Segment of IDoc.

Now my requirement is to generate the Segment 5 times with respective to this Control Number.

please help me out to resolve this issue.

Thanks,

Kish.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Kish

Make use of standard message mapping function useOneAsMany.

This will solve your problem.

Good Luck

Vijendra

Former Member
0 Kudos

Hi,

At the target structure you can right click and say dublicate structure and create it 5 time and mapped the control no to that 5 structure.

This is what you wanted.

Thanks,

Chirag Gohil

Former Member
0 Kudos

Gohil,

The occurance of Control Number is not static. It may occur 5 or n times depend on the data coming from the Third party.

It should generate Segment dynamically based on the control number.

My Requirement is:

For One Row i will have 'n' duplicate records of control number.

My Source Structure:

+ <Source_DT>

++ <ROW>

+++ <Control_Num>100</Control_Num>

+++ <UOM>1223</UOM>

++</ROW>

++ <ROW>

+++ <Control_Num>100</Control_Num>

+++ <UOM>12244</UOM>

++</ROW>

++ <ROW>

+++ <Control_Num>100</Control_Num>

+++ <UOM>12255</UOM>

++</ROW>

++ <ROW>

+++ <Control_Num>101</Control_Num>

+++ <UOM>133</UOM>

++</ROW>

+</Source_DT>

The data coming from Source will be in the above format.

Control Number appears 4 times. 3 times with duplicate data.

For Control Number 100 it should generate one IDoc and for Cntrol Number 101 it should generate another IDoc.

The duplicate Control Number 100 that occurs 3 times need to map to the first IDoc segments.

So Segments in First Idoc need to be repeated 3 times respective to the Control Number.

Please provide me the solution.

Former Member
0 Kudos

HI,

What I understood is:

IF you have a control record no 100 three times you should generate one IDOC for all three.....

The duplicate Control Number 100 that occurs 3 times need to map to the first IDoc segments

Can you please tell me which target field it is mapped to, what is the occurance of that.

Thnx

Chirag

Former Member
0 Kudos

Hi,

The Target Field DELIV_NUMB in the Segment E1BPOBDLVITEMCON is mapped to Control_Number. The occurance of segment is 0...9999999.

Thanks,

Kish.

Former Member
0 Kudos

mappin of <b>IDoc</b> note

Control_Num(context to root) -> SplitByValue[value change]-----> IDoc

<b>Segment mapping</b>

Control_Num(context to root) -> SplitByValue[each value]-----> Segment

Former Member
0 Kudos

HI,

First of all what I have understood is correct which is replied by me please confirm that.

If your occurance of target node is unbounded then what is the problem in mapping the control no to DELIV_NUMB and Segment E1BPOBDLVITEMCON.

As many times ur control no repeats that many times ur target stuc repeats.

Please explain me with one example so that i can understand properly.

Thanx

Chirag

Former Member
0 Kudos

Gohil,

My requirement is:

I would be generating One Idoc for One Control Number.

For One Control Number i would be having n rows of data.

The data in each row should be mapped to respective segment in the IDoc.

Suppose for Control Number 100:

I would be having 5 rows of data.

These 5 rows of data need to be mapped to same IDoc.

So the Segments in the IDoc need to be repeated 5 times.

When the Control number changes the data should be moved to another idoc.

Please provide some light on this.

Thanks,

Kish.

Former Member
0 Kudos

Hi Krish

I think you will have to implement UDF in your mapping.

Create an Hash Map object with following structure: Key --> Control_Num, Value --> (ArrayList)Segments.

So like your example there will be 2 keys in your HashMap object where first key value has a ArrayList with three segments and second key with an ArrayList with one segment.

I hope this helped

Vijendra

Former Member
0 Kudos

Hi,

As the Std IDOC root node strucutre occurance is 0-1 so you need to first change the occurance of root node to 0-unbounded and import that strucutre to external definition.

Once you have done this now map the control number to IDOC root node and mapp all the values of control no to the respective IDOC elements.

Whenever the control no value changes it will create a new IDOC.

I assume that you will have data in the following format:

Control no: 100-acts as root node and under that there are child element which mapps to the IDOC elements.

If you wanted to clear still then please provide me the XML strucutre of the source.

Thnx

Chirag Gohil

Former Member
0 Kudos

Hi,

Here is the XML Structure of my Source:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:GoodsReceipt_MT xmlns:ns0="urn:WOL-com:XI:data:HJ:10">

<row>

<CONTROL_NUMBER>111</CONTROL_NUMBER>

<LINE_NUMBER>1111</LINE_NUMBER>

<CONTROL_NUMBER_2/>

<OUTSIDE_ID/>

<WH_ID>111111</WH_ID>

<LOCATION_ID/>

<HU_ID>11111</HU_ID>

<NUM_ITEMS/>

<ITEM_NUMBER>111111</ITEM_NUMBER>

<CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>

<LOT_NUMBER>11111</LOT_NUMBER>

<UOM>11111</UOM>

</row>

<row>

<CONTROL_NUMBER>111</CONTROL_NUMBER>

<LINE_NUMBER>12222</LINE_NUMBER>

<CONTROL_NUMBER_2/>

<OUTSIDE_ID/>

<WH_ID>12222</WH_ID>

<LOCATION_ID/>

<HU_ID>1222</HU_ID>

<NUM_ITEMS/>

<ITEM_NUMBER>112222</ITEM_NUMBER>

<TRAN_QTY>112222</TRAN_QTY>

<CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>

<LOT_NUMBER>12222</LOT_NUMBER>

<UOM>1122222</UOM>

</row>

<row>

<CONTROL_NUMBER>222</CONTROL_NUMBER>

<LINE_NUMBER>2222</LINE_NUMBER>

<CONTROL_NUMBER_2/>

<OUTSIDE_ID/>

<WH_ID>22222</WH_ID>

<LOCATION_ID/>

<HU_ID>222222</HU_ID>

<NUM_ITEMS/>

<ITEM_NUMBER>2222222</ITEM_NUMBER>

<TRAN_QTY>22222222</TRAN_QTY>

<LOCATION_ID_2>33333333</LOCATION_ID_2>

<CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>

<LOT_NUMBER>22222</LOT_NUMBER>

<UOM>22222</UOM>

</row>

<row>

<CONTROL_NUMBER>333</CONTROL_NUMBER>

<LINE_NUMBER>3333</LINE_NUMBER>

<CONTROL_NUMBER_2/>

<OUTSIDE_ID/>

<WH_ID>33333</WH_ID>

<LOCATION_ID/>

<HU_ID>33333</HU_ID>

<NUM_ITEMS/>

<ITEM_NUMBER>333333</ITEM_NUMBER>

<TRAN_QTY>33333333</TRAN_QTY>

<CONTROL_NUMBER_3>LR</CONTROL_NUMBER_3>

<LOT_NUMBER>33333</LOT_NUMBER>

<UOM>333333</UOM>

</row>

</ns0:GoodsReceipt_MT>

Now Control_Number 111 occurs 2 times, 222 & 333 occurs 1 time.

Now one IDoc for 111,222 & 333 should be generated.

But Control_number 111 appears 2 times.

Now the data in the 2 rows should be passed to Single IDoc by repeating the segments inside the IDoc.

As u said i changed the Occurance of IDoc to 0...unbound and imported as External Definition. I have done upto Generating IDoc for each unique Control_Number.

I stuck up at repeating the Segments in the IDoc.

So please help me out.

Thanks,

Kish.