Skip to Content

File processing

Hi Folks,

I have a requirement where i need to merge two files at the sender side and create one and send to receiver.


Could you please let me know the best way to handle this in PI..its File adapters on both the sides.

please advise.

thx

smith

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Mar 10, 2017 at 12:07 AM

    Hi Smith,

    As you need to send xml file to Receiver, I think File construction mode "Append" would not be much helpful (if you could transform both the files into xml through separate interfaces before merging). xml declaration at the top level will create problem. Like the solution described in :

    Merge multiple input files into one output file

    Now you have option for ccBPM (as you are in PI 7.1) or File lookup.

    ccBPM -Demonstration of ccBPM Scenario: SAP PI 7.1 : It would involve lot of effort and need to be aware of any Performance issue, but may be best possible solution.

    File Lokup -File LookUP using UDF and Graphical Variable : It will involve custom coding and not recommended. So you need to consider File size and connection.

    As you have one file which is "Static" and Type "CSV", you can consider below approach but this is for Lookup purpose:

    Making CSV File Lookup Possible In SAP XI !!!

    There is no straight forward solution, so you need to explore different options.

    Regards,

    Nabendu.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 10, 2017 at 09:19 AM

    Any other valuable suggestions please

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 10, 2017 at 12:49 PM

    Hi Smith,

    You have to follow complex path to achieve this -

    1) Develop one custom module which you will use in the 2nd sender communication channel to convert your excel file to xml. Basically, a module to read excel file. There are numerous good blogs. You can refer any one.

    2) In 1st CC use FCC to convert your CSV file to XML.

    2) Develop one ccBPM/NWDSBPM scenario as per your server. This will be a simple file merge scenario which will merge this 2 files following one correlation and push the same in the receiver CC.

    Thanks and Regards,

    Apu Das

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 10, 2017 at 01:50 PM

    Hi Smith!

    You could use a little bit 'tricky' approach.

    1. Put template CSV file in source folder.

    2. In sender adapter parameters enable Additional files parameters and set:

    namePart = ".xls"=".csv" (or any other extension you use for your csv file)

    optional = NO

    3. Create simple script (using bash, for example) to copy your template csv to file with the name equal to your source xls and "csv" extension.

    #!/bin/bash
    src="${1}"<br>name=$(echo $src | cut -f 1 -d '.')
    targetname=$name'.csv'
    cp /your/source/path/to/template/template.csv $targetname

    4. Enable "Run OS command before message processing" option with your script execution command:

    /full/path/to/your/script/location/your_script.sh %F

    where %F will be substituted by adapter with actual source file name including path.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded