cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PO7.4 : renaming CSV based upon field from Input

Former Member
0 Kudos

Hi Experts,

We have a scenario in which we are getting many xml files from a source JMS system (the job on sender system will run only once a day) with a Flag as indicator (night load), if this flag is "Y" we have to collect these messages and create a CSV file in a target SFTP folder and keep on appending the incoming xml files to the CSV.

Then we have another flag, say EndOfFile(EoF), which when is set to "Y",  we have to stop appending the xml files to CSV and rename the CSV file to some pre-defined value. Later this CSV will be picked by the target script for further processing. Renaming is being done as the target script will keep on polling the sftp location for that name, thus avoiding picking up of the file being written by SAP PO.

We have tried using Dynamic Configuration for checking value of flag EoF to Y, and set ASMA in receiver SFTP channel. However when the flag is not set, the Dynamic Config is not triggered and the ASMA gives error. We tried putting two conditions in Dynamic Configuration like, if EoF is "N" use "try.csv" and when its "Y" use "final.csv". When files with EoF "N" come it creates a CSV "try.csv", but when we get flag as Y it creates second csv file and does not overwrite the older csv file.

Also, variable substitution cannot be used as its value will be picked at the very beginning (also this flag is in source payload)when file is getting created and not after this flag is set. We are trying to avoid using scripts here, any idea how this can be done ?

Also, I thought of using a dummy ICO and SFTP-SAP PO-SFTP scenario and sender SFTP will check for "Last Modified" check in sender SFTP and will rename the file and push it again in same folder, but cannot locate this option in sender channel. I am on NW7.31 EXT 11 SP06 (SFTP ADAPTER 1.0).

Thanks,

Rajesh Shinde

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Experts,

Any recommendations for the issue ? Kindly guide me.

Thanks,

Rajesh

binod8
Active Participant
0 Kudos

Hi Rajesh,

You may take the below approach to resolve this in PI:

-------------------------------------------------------------------------

1> When you receive a file first time on a given day. Create file with <<final file name>><<DDMMYYYY>>.csv

2> Keep appending the file on SFTP server everytime you receive file with flag N.

3> When you receive flag as Y then append the file with the XML data and add last line as EOF=Y

Change for target script:

------------------------------------

1> Your target script should read the file  <<final file name>><<DDMMYYYY>>.csv and should go to the last line of the file to check if it contains EOF=Y.

2> If the last line of the file is EOF=Y then target script should process it and remove the file from the location. Note. the script job should ingore the last line that is just for script indicator.

3> If the last line of the file is NOT EOF=Y then the script should ignore the file and do nothing and should check again on next scheduled time.

This is my thought

Thanks& Regards,

Binod