Multiple Invoices in One Document
We are getting an invoice file from a vendor which can have multiple invoices. Each invoice has one header and 1 to many line items.
It's coming in as an XML file and going out through a custom RFC that does some preprocessing and then runs it through BAPI_INCOMINGINVOICE_CREATE.
The ABAP programmer who was working on this one discovered we couldn't use a "deep" structure in an RFC.
So, while the incoming XML structure looks something like this:
Invoice (1 to many): Header (1), Line Item (1 to many)
The RFC has a structure with a table of Headers and a table of Line Items each using the vendor invoice number to tie them together.
I thought as the records came through the mapping I could just take the invoice number off the header and put it on each subordinate line item, so that the RFC would have it's key, but it doesn't seem to work. The mapping only produces one invoice, no matter how many are in the file.
I'm not sure I've described this very well. But what the basic question is: Is it possible to process multiple invoices in one document? And if so, what am I missing in how to set that up?
Does something need to change in the set up of the XML file? Does something need to change in the set up of the RFC?
I know I could probably do it by asking the vendor to put the PO number on the line items, and then just changing the XML structure to match the RFC structure, but it seems like there should be another way to do it.
Any help would be much appreciated.
Claus Wallacher replied
the item in question should be the one under IT_INCOMING_INVOICE_LINE_ITEM.
In this case you need to map
<IncomingInvLineItem> --> item (the one under IT_INCOMING_INVOICE_LINE_ITEM)
Then set the context to the highest level possible (should be MT_FIAP_EInvoice). That should take care of it.
PS: I will be on vacation for 8 days, so I hope your problem is solved, otherwise I won't be able to help you until a week from now.
Message was edited by: Claus Wallacher