cancel
Showing results for 
Search instead for 
Did you mean: 

File to IDOC scenario : Error with mapping due to Context handling

Former Member
0 Kudos

Hi Experts.

I have a file to IDOC scenario which need your advice.

Source File structure as follows:

Control_Header <1:1>

Invoice_Header <1:unbounded)

Invoice_Line <1:unbounded)

Trailer <1:1>

Payload as follows capture from SXMB_MONI

- <Control_Header>

<Key>999</Key>

<TransactionID>RCTV</TransactionID>

</Control_Header>

- <Invoice_Header>

<Key>000</Key>

<BusinessUnit>HDB05</BusinessUnit>

<InvoiceNo>64471</InvoiceNo>

</Invoice_Header>

- <Invoice_Line>

<Key>001</Key>

<UnitPrice>7.00000</UnitPrice>

<Quantity>1.0000</Quantity>

<GSTAmount>0.49</GSTAmount>

<GSTRate>0.07</GSTRate>

</Invoice_Line>

- <Invoice_Line>

<Key>001</Key>

<UnitPrice>8.00000</UnitPrice>

<Quantity>1.0000</Quantity>

<GSTAmount>0.56</GSTAmount>

<GSTRate>0.07</GSTRate>

</Invoice_Line>

- <Invoice_Header>

<Key>000</Key>

<BusinessUnit>HDB21</BusinessUnit>

<InvoiceNo>6Y0575</InvoiceNo>

</Invoice_Header>

- <Invoice_Line>

<Key>001</Key>

<UnitPrice>49.50000</UnitPrice>

<Quantity>1.0000</Quantity>

<GSTAmount>3.47</GSTAmount>

<GSTRate>0.07</GSTRate>

</Invoice_Line>

- <Trailer>

<Key>TRL</Key>

<TransactionID>RCTV</TransactionID>

<TotalFeedLine>96</TotalFeedLine>

<HashTotalValue>212.00</HashTotalValue>

</Trailer>

</ns:MT_EINVOICE>

Mapping as follow:

IDOC

<Control_Header> -> <Control_Header>

<Invoice_Header> --> <Header_Invoice>

<Invoice_Line> ---> removeContext --> <Line_Invoice> this is the child node of <Header_Invoice>

<Trailer> -


> <Trailer>

The result of the using the above Payload get the following result which not wht I seek

<Control_Header>

<Header_Invoice>

<Line_Invoice>

<Line_Invoice>

<Line_Invoice> *** This belong to the Invoice_Line of the second <Header_Invoice> at the payload

<Header_Invoice>

<Line_Invoice> *** THis segment is empty

<Trailer>

I required the Line_Invoice to belong to the child of the second <Header_Invoice>, I have tried using

removecontext with splitVaue and collaspeContext but to no avail.

May I know what is my mistake on the mapping of the Invoice_Line to Line_Invoice>

Rgds

FNG

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Will you able to advise why at the receiver end I am receiving

IDOC Structure at receiver end

Control_Header>

<Invoice_header>

<Invoice_line>

<Invoice_line>

<Invoice_Iine> *** This belong to the Invoice_Line of the second <Header_Invoice> at the payload

<Invoice_header>

<Invoice_line> *** THis segment is empty

<Trailer>

I am puzzled why the third <Invoice_Line> that belong to the 2nd Header_Invoice from the paylond has gone to the 1set of the Invoice_header at the receiver end IDOC(WE02)

while the <Invoice_Line> refer from above is empty

srikanth_srinivasan3
Active Participant
0 Kudos

Could you provide me a screen of your map rule?

Also, did the output that reached R/3 system match with that of the one in SXMB_MONI payload?

-

Srikanth Srinivasan

Former Member
0 Kudos

> I am puzzled why the third <Invoice_Line> that belong to the 2nd Header_Invoice from the paylond has gone to the 1set of the Invoice_header at the receiver end IDOC(WE02)

> while the <Invoice_Line> refer from above is empty

Hi,

This happens because at your source side all headers and line items are coming in the same context. there is no context change. But in your reciever side you are adding each line item under the context of header item. So on using remove context what you basically doing at the source end is bringing all the line items under the context of MT and when this is mapped to Line item at source then all the Line items are coming collectively under the single context again.

In my opinion this type of mapping is not possible with graphichal mapping. You need to use DOM parsing in JAVA mapping to get the reciever structure.

Regards,

Rahul Grover

Former Member
0 Kudos

Hi Rahul

Thanks for your advice.

Is it possible to design and sender structure similar to the receiver side. That mean

Sender structure

Control

Header_invoice

Line_invoice (subnode of Header_invoice)

Trailer

If yes, how can it be done, because I am following the sample from

/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file which shows all structure in the same context.

I have tried redesign the data type for the source, to move Line_invoice be the child of Header_invoice but without sucess.

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

There should be something that could correlate the Invoice_Header/Key and Invoice_Line/Key. In your example, both are the same for the first and data set. If the sample looks like the one below, it is possible to sort things by correlating the Invoice_Header key and Invoice_Line key


<Invoice_Header>
  <Key>000<Key>
</Invoice_Header>
<Invoice_Line>
  <Key>000<Key>
</Invoice_Line>
<Invoice_Line>
  <Key>000<Key>
</Invoice_Line>
<Invoice_Header>
  <Key>001<Key>
</Invoice_Header>
<Invoice_Line>
  <Key>001<Key>
</Invoice_Line>

An example mapping could look like this


For Header
Invoice_Header --> Header_Invoice

For Line
/InvoiceLine/Key --> removeContext --> splitByValue:valueChanged --> Invoice_Line

The subfields of the invoice line would also follow a similar logic, you just need to use formatByExample --> splitByValue:eachValue so that the context levels are the same.

Hope this helps,

Mark

srikanth_srinivasan3
Active Participant
0 Kudos

From your description, I am quite unclear why you wanted to make use of node fucntions when source & target nodes represent themselves in the same level of hierarcy. Could you try to just map it as it is wihtout any ndoe function & see the result?

-

Srikanth Srinivasan

Former Member
0 Kudos

Hi Srikanth,

The hierachy between sender and receiver is not the same.

for the sender, all four structure are on the same level

Control

Header_invoice

Line_invoice

Trailer

for receiver, Invoice_line is the child of Invoice_Header

Control

Invoice_Header

-


Invoice_Line

Trailer

srikanth_srinivasan3
Active Participant
0 Kudos

If thats the case, your sample input structure confused me this way:

Header_Invoice occuring between Line_Invoice.

Either all Header_Invoices must occur together or the specification must be clear.

Now, is there a relating factor (element) between the Header_Invoice & Line_Invoice?

Because, in the example provided by you, even the 'KEY' doesnt match.

-

Srikanth Srinivasan

Former Member
0 Kudos

Basically the Header_Invoice appear 2nd time as the second record set.

e.g Header_invoice 1st set of record

Line_invoice

Line_invoice

Header_invoice 2nd set of reord

Line_invoice

All these happened between the Control Struture and the trailer.

It is the similar to the following blog

/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file

srikanth_srinivasan3
Active Participant
0 Kudos

Quick question:

Will the key in Header_invoice & Line_invoice be same?

Just with the order, I am unsure how you could populate the relative segments sets in output.

Though, the XML might contain the Line_Invoice seperated by Header_Invoice, at the execution level, they (Line_Invoice's) would be combined & would have a continuous index value.

-

Srikanth Srinivasan

Former Member
0 Kudos

Key value for Header_invoice and Line_invoice is dfference.

000 for Header_invoice and 001 for Line_invoice

Former Member
0 Kudos

Hi,

Is your sender file stucture a flat structure or tree structure ? i mean is Invoice_line is a subnode of invoice_header, or these two nodes are at same level as that of the header and trailer. Also plz tell the structure levels at reciever end.

Regards,

Rahul Grover

former_member207622
Contributor
0 Kudos

Keep the context of Invoice_line at top level level and use only split by value remove" removecontext"

Also keep the context of header _invoice at topmost level

Try if this works

regards

Ninad

Former Member
0 Kudos

Hi Rahul,

The Invoice_Line is at the same level as Invoice_header.

As for the receiver side,the Line_Invoice is the subnode of Header_Invoice.