cancel
Showing results for 
Search instead for 
Did you mean: 

XML to IDOC interface - XML creates multiple IDOCs depending on record type

former_member84399
Participant
0 Kudos

Dear all,

We are about to embark to a PI implementation.

It will be a file to idoc interface. An encrypted xml file will be collected via HTTPS from a remote third party server.

The file will be first decrypted in PI. Then, the xml file, which will contain many different records, say 20 records on average, will be read and 20 idocs of type FIDCCP02 will be posted to our ERP 2004 system.

One of the challenges of this implementation is the creation of the multiple idocs from the single xml file.

Could you suggest what would be the best/simplest way to have this implemented? The xml contains various records

of record types 1 to 9. For example, every record type from 1 to 9 creates a different accounting document in Accounts Payable, Accounts Receivable or General Ledger in ERP 2004.

It would have been much easier for us to collect numerous files in the third party server each converting to one idoc

but this is not an option, unfortunately.

We are using PI 7.0 and ERP2004, both with the latest support packs.

Many thanks

Andreas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In your case, you can use multi-mapping:

  • The first mapping program is to execute decryption

  • the second mapping program is to generate multiple IDOCs, Based what you mentioned, just one type of IDOC is generated. Not clear what you mentioned:

every record type from 1 to 9 creates a different accounting document in Accounts Payable, Accounts Receivable or General Ledger in ERP 2004.

Does this mean differeny types IDOCs need to be generated based on record types?

Regards

Liang

former_member84399
Participant
0 Kudos

Thank you all for your answers so far, I have allocated some points.

The IDOC type does not change: the IDOC being created is always a FIDCCP02 type IDOC. What changes every time is the posting

key in the IDOC, which posts the IDOC in Accounts Payable, Accounts Receivable or General Ledger.

More specifically in field "Action" in the XML, on "structure" Grants:

I will try to explain better with an example: I put the two "Grants" between dotted lines to

make it more readable but you guys might be all too familiar with reading XML:

Here is a sample XML that I will be using :

<?xml version="1.0" standalone="yes" ?>

- <OfficeToSAP xmlns="http://www.mycompany.com/OfficeToSAPSchemav1_1.xsd">

- <OfficePayments DateDataExtracted="20091203">

<FileHeader RecordType="0" FileName="Payment20091203.gpg" CreationDate="20091203" />

- <Grants>

........................................................................

- <Grant>

<GrantHeader RecordType="1" Action="AR4" Origin="LSE" />

- <Documents>

- <Document>

<DocumentHeader RecordType="4" CompanyCode="10" Vendor_Customer="2002" BankAcc="" DocRef="OFF391932" DocAmount="1000000" Tax="00000000000" DocHeaderTxt="Office332" DocDate="20091203" PostingDate="20091203" BaselineDueDate="20091221" Method="A" Reason="Company Contribution" PaymentTerms="AR00" />

- <LineItems>

<LineItem RecordType="5" GLAccount="500" CostCentre="" InternalOrder="" ProfitCentre="20" TradingPartner="0001" Amount="1000000" VatCode="XX" Sign="+" Description="TEST" LongText="Test please ignore" />

<LineItem RecordType="5" GLAccount="501" CostCentre="" InternalOrder="" ProfitCentre="20" TradingPartner="178" Amount="2500" VatCode="A7" Sign="-" Description="Test2,2002,Office932" LongText="TEST2" />

</LineItems>

</Document>

</Documents>

<GrantTrailer RecordType="9" Action="AR4" Origin="LSE" />

</Grant>

..............................................................................

- <Grant>

<GrantHeader RecordType="1" Action="AP1" Originator="PPE" />

- <Documents>

- <Document>

<DocumentHeader RecordType="4" CompanyCode="1000" Vendor_Customer="266" BankAcc="" DocRef="Office592" DocAmount="2000000" Tax="00000000000" DocHeaderText="Office592" DocDate="20091203" PostingDate="20101203" BaselineDueDate="20091221" Method="D" Reason="Company Entitlement" PaymentTerms="PT00" />

- <LineItems>

<LineItem RecordType="5" GLAccount="419" CostCentre="" InternalOrder="1062" ProfitCentre="" TradingPartner="752" Amount="100000" VatCode="V7" Sign="-" Description="test3" LongText="Test3" />

</LineItems>

</Document>

</Documents>

<GrantTrailer RecordType="9" Action="AP1" Originator="PPE" />

</Grant>

..................................................................................

</Grants>

<FileTrailer RecordType="E" NumberOfRecords="5" EndOfFileIndicator="EOF" />

</OfficePayments>

</OfficeToSAP>

In the example above:

Record type 0 is the beginning of the file and record type E is the end of the file

The first Grant represents an Action "AR4" which creates an Accounts Receivable Invoice IDOC with that posting key

and one document (record type 4 - Invoice Header) that contain two line items (record type 5 - Accounting data)

The second Grant represents an Action "AP1" which creates an Accounts Payable Invoice IDOC with that posting key and one

document (record type 4 - Invoice Header) that contain one line item (record type 5 - Accounting data)

My question is what are my options so that XI scans this XML file and depending on the action type and record type

creates these two idocs. I would have to implement some loop to read this file from beginning to end but I am not sure

what is the way to do this as I am only familiar with simple mapping of an XML file to an IDOC. Any suggestions that could direct me to the right documentation or different ways to

do it will be very much appreciated.

Many thanks

Andreas

baskar_gopalakrishnan2
Active Contributor
0 Kudos

To check Record and action, use constant and Text function equals. Followed by use boolean function if or if else to map it to the target side.

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

we can handle multiple idocs in two ways,

-> By using block step and send multiple IDOCs from our BPM.

->By changing the occurance of the idoc and importing it in external defenition.

Thanks and Regards,

Naveen.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>>One of the challenges of this implementation is the creation of the multiple idocs from the single xml file.Could you suggest what would be the best/simplest way to have this implemented?

Since you need one file to mulitple idocs and each idoc represent individual record which comes in the input file. Follow this link

/people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change

Change the idoc node occurence as 1 to unbounded externally and import it inside the pi and use it.