cancel
Showing results for 
Search instead for 
Did you mean: 

How to split big XML files with Header and Trailer node using shell script/Java in SAP PI

0 Kudos


Hi,


Currently I am working on File (XML file) to Proxy scenario. We are sending big XML files with Header node and Trailer node (which contains Trailer count) to the R3 system. Due to large no. of records tables are getting locked in the R3 system while updating. I need to split the XML file with correct Trailer count, so that I can send small files with say 100 records to the R3 system that too at an interval of few seconds. Please let me know whether it's possible or not. If yes, how to proceed further to do this.

For example:

Original File

<Header></Header>

<Record></Record>

<Record></Record>

<Record></Record>

<Record></Record>

<Record></Record>

<Trailer>

<RecordCount>5</RecordCount>

</Trailer>

Output File

File 1

<Header></Header>

<Record></Record>

<Record></Record>

<Trailer>

<RecordCount>2</RecordCount>

</Trailer>

After few seconds second files should be created.

File 2

<Header></Header>

<Record></Record>

<Record></Record>

<Trailer>

<RecordCount>2</RecordCount>

</Trailer>

After few seconds third files should be created and so on.

File 3

<Header></Header>

<Record></Record>

<Trailer>

<RecordCount>1</RecordCount>

</Trailer>

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Vaibhav,

Please check the below link.

Multi-Mapping using Java Mapping - Process Integration - SCN Wiki

But instead of java mapping , I will suggest to use 1:N mapping with out ccBPM . It will be easy to understand .

Regards,

0 Kudos


Dear Rudra,

Thanks for the quick response.

But in this case the issue is, getting the correct record count in the Trailer. Another issue is we will have same number of Header node and Trailer node as of Record node under each row.

for example: I am getting this structure after transformation

<Row>

<Header></Header>

<Header></Header>

<Record></Record>

<Record></Record>

<Trailer></Trailer>

<Trailer></Trailer>

</Row>

Actually it should be

<Row>

<Header></Header>

<Record></Record>

<Record></Record>

<Trailer>

<RecordCount>2</RecordCount>

</Trailer>

<Row>

Actually it should be only 1 Header and 1 Trailer for each row. Also Record count in the trailer is causing an issue.

0 Kudos

Hi,

Issue is resolved now with 1..n multi-mapping with the UDF to split the file and got the trailer count by checking the number of record created in each row.

I am closing this thread now.

Thanks for your support.

ABHISHEK_MISHRA
Explorer
0 Kudos

Can you please explain how you are splitting or filter the count of multiple records.

Answers (0)