cancel
Showing results for 
Search instead for 
Did you mean: 

IDoc Split with out BPM using SplitByValue at the LineItem Level

Former Member
0 Kudos

I have an Invoice idoc contains line item and identifier changes into groups, let's say A & B

Using Message Mapping, Will i be able to Split into 2 IDOCs and combine A into one IDOC and B into Another IDOC and send it across to ECC with out using BPM?

Btw the header is commom for both the IDOCs

Source

<Header>

<headertext>headername</headertext>

<lineItem>

<item1>A</item1>

<item2>B</item2>

<item3>A</item3>

<item3>B</item4>

</item>

</lineitem>

</header>

Target

IDOC 1

<Header>

<headertext>headername</headertext>

<lineItem>

<item1>A</item1>

<item2>A</item2>

</item>

</lineitem>

</header>

IDOC 2

<Header>

<headertext>headername</headertext>

<lineItem>

<item1>B</item1>

<item2>B</item2>

</item>

</lineitem>

</header>

Any inputs are appreciated

Accepted Solutions (0)

Answers (3)

Answers (3)

Shabarish_Nair
Active Contributor
0 Kudos

you are doing a 1:N mapping.

you can avoid BPM only if you are creating N IDoc of the same type. If you have to create IDocs of multiple types then you will have to use BPM.

Former Member
0 Kudos

It is of same type IDOC, just creating one more with different action indicator by grouping into one for each

Shabarish_Nair
Active Contributor
0 Kudos

>

> It is of same type IDOC, just creating one more with different action indicator by grouping into one for each

in that case;

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2044216150DB1241023316731498339...

use the above trick along with the logic proposed by sarvesh in your mapping

Former Member
0 Kudos

Like i mentioned above, the split is complete. As i am getting only one message with Number of Line items, the split suppose to happen at the Mapping level. I added external definition to accommodate multiple idocs as well.

Based on ActionIndiator at the lineitem, i have to create 2 or more idocs, please look at the source payload.

former_member200962
Active Contributor
0 Kudos
Will i be able to Split into 2 IDOCs

Yes if both the IDOCs are the same....you will have to perform [IDOC Bundling|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2762] [original link is broken] [original link is broken] [original link is broken]; apart from the mapping logic given by Sarvesh.

Regards,

Abhishek.

Former Member
0 Kudos

I actually gave wrong information on the source structure, I am trying to execute scenario with the given examples, meanwhile any help is appreciated

<Header>

<Date>20100112</Date>

<Amount>10</Amount>

<No>20</No>

</Header>

<InvoiceItem>

<Line1>10</Line1>

<Line2>10</Line2>

<Amount>10</Amount>

<ActionIndicator>I</ActionIndicator>

</InvoiceItem>

<InvoiceItem>

<Line1>20</Line1>

<Line2>20</Line2>

<Amount>20</Amount>

<ActionIndicator>C</ActionIndicator>

</InvoiceItem>

<InvoiceItem>

<Line1>30</Line1>

<Line2>30</Line2>

<Amount>30</Amount>

<ActionIndicator>I</ActionIndicator>

</InvoiceItem>

<InvoiceItem>

<Line1>40</Line1>

<Line2>40</Line2>

<Amount>40</Amount>

<ActionIndicator>C</ActionIndicator>

</InvoiceItem>

Target 1

<Header>

<Date>20100112</Date>

<Amount>10</Amount>

<tNo>20</No>

<ActionIndicator>I</ActionIndicator>

</Header>

<InvoiceItem>

<Line1>10</Line1>

<Line2>10</Line2>

<Amount>10</Amount>

</InvoiceItem>

<InvoiceItem>

<Line1>30</Line1>

<Line2>30</Line2>

<Amount>30</Amount>

</InvoiceItem>

Target 2

<Header>

<Date>20100112</Date>

<Amount>10</Amount>

<tNo>20</No>

<ActionIndicator>I</ActionIndicator>

</Header>

<InvoiceItem>

<Line1>20</Line1>

<Line2>20</Line2>

<Amount>20</Amount>

</InvoiceItem>

<InvoiceItem>

<Line1>40</Line1>

<Line2>40</Line2>

<Amount>40</Amount>

</InvoiceItem>

I know the part of Splitting IDOC, which was executing correctly, with the external data type changes. Please advice

Former Member
0 Kudos

Hi,

As per my understanding you do your mapping like this...

item --->RemoveContext-->Sort-->SplitByValue(on value change)--->CollapseContext--->IDOC

So by doing above mapping it will generate N number of IDOCS for different items. e.g. in your case ite will generate 2 IDOCs.

item --->RemoveContext-->Sort-->SplitByValue(on value change)--->LineItem

above mapping should generate 2 lineItems in first IDOC & 2 in second IDOC.

item --->RemoveContext-->Sort-->SplitByValue(each value)---> Item

above mapping will map A,A in first IDOC item1 & item2. Simlarly B,B in second IDOC.

For Header you do the mapping like this...

Source headertext--->CopyValue(0)--->Target headertext.

Regards,

Sarvesh

Former Member
0 Kudos

Sarvesh Singh

I am sure your approach is right way of doing it. I am able to split into 2 idocs at present. I have to do sort inorder to achieve the split.

Item > sort > Split by Value (Value Change) > IDOC

But still have other values to be mapped with exact context with out changes.

Former Member
0 Kudos

> But still have other values to be mapped with exact context with out changes.

Then simply don't use the SORT function while doing mapping at item level.

item1 ->SplitByValue(each value)-> Item1 (if items already have a context change then no need of SplitByValue or set it the context accordingly.)

item2 ->SplitByValue(each value)-> Item2

item3 ->SplitByValue(each value)-> Item3 and so on...

All values must go automatically into corresponding IDOCs.

Regards,

Sarvesh

Former Member
0 Kudos

Action Indiccator > RemoveContext >

SortByKey > SplitByValue (Each Value) > Item

Itemtext > RemoveContext >

The above example helped me getting values and splitting idocs into 2 based on Action Indicator

At the root level, i used the following

ActionIndicator > sort > splitbyvalue (Value Chnage) > Field

Thanks for your help