Skip to Content

SAP PI, How to split one XML File into multiple Files? (Beginner Approch)

Hi,
I'm new in SAP PI and I can't perform this exercise:
Assume that you are in a class room and there are 10 students in it. The instructor then asks each student to prepare his/her the following personal details and save them in an XML file. The instructor then asks you all to prepare one single file with the personal details of each student in separate segments.
Write a scenario which will read this file and produces 10 target files where each file should correspond to the personal data of each employee. The target files should be named as cv_<emp_ID>_<timestamp>.

The structure of one XML Student File:

<?xml version="1.0" encoding="UTF-8"?>

http://sapdemo2.com">

<Gender>Man</Gender>

fake@email.com

<Mobile>9999999999</Mobile>

<Name>Richard</Name>

<StudentID>1</StudentID>

</ns0:MT_Student>


How can I do that??
Thanks a lot!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 13 at 09:43 AM

    Hi Dario!

    I guess, Multimapping and Variable substitution for file name along with "Add Time Stamp" construction mode in receiver file channel will fulfill your requirement.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 13 at 10:14 AM

    Hi Dario,

    In HCI there is a step called splitter that can split your message depending on how you configure the scenario. Please check the an other community question with the similar question of yours and the official documentation of the splitter step: https://answers.sap.com/questions/451390/split-message-based-on-attribute-in-hci.html

    https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/83e2022f9c014bebab63cb933e625610.html?q=splitter

    Regards,
    Balazs Barna

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 13 at 09:56 AM

    Hi Evgeniy and thanks for your response,
    Could are you more specific about MultiMapping? I'm totally new on this area!

    Add comment
    10|10000 characters needed characters exceeded