cancel
Showing results for 
Search instead for 
Did you mean: 

Archive file after successful processing in SPROXY

former_member217029
Participant
0 Kudos

Hello,

My requirement is File->PI->Proxy. I have to archive the source file after successful of proxy call only.

I know that if we select archive option in file adapter it will not wait/check till proxy process in SAP.

I am looking for best solutions available to achieve this.Please let me know if you need any further details.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

sunil_singh13
Active Contributor
0 Kudos

Bhavana,

Assuming you are using NFS (not FTP) protocol of File Adapter

- Once you process the File, rename file (you may append _Processed to it) using OS command in File Adapter using mv command

- Once Proxy Process is complete, Have a Table in ECC updated with unique identifier.

- When you start processing next file, Perform RFC/bapi Lookup (From Message Mapping) on table updated by Proxy in previous Step and archive the file through UDF/Java

This way you need not to have two different interface and have central table with all processing info.

Thanks,

Sunil

former_member217029
Participant
0 Kudos

Hello Sunil,

Thanks for your inputs. I have couple of questions

1) When you say Have a Table in ECC updated with unique identifier, it could be file name here?

2) Based on what input parameter RFC look up can pull back the unique identifier(Ex:file name) from table as response ? So that it can be input to UDF to archive the file.

I feel maintaining a additional table in ECC would make little lengthy process but we can propose it if it works

Thanks

Answers (3)

Answers (3)

former_member217029
Participant
0 Kudos

Hi All - Thanks for your valuable inputs. This requirement is changed and will post a separate thread

former_member217029
Participant
0 Kudos

I have an idea that running in my mind but not sure how this works. Please let me know your thoughts.

Split the whole process into 2 interfaces.

Interface 1: File->PI->Proxy

1. Pick up the file(Ex: file1.xml) from FTP location using file adapter and set to "read only" once read it. So that file exists on FTP and will not be read next time(Requirement is - file should be archived only after successful proxy execution, till then it should exists on FTP).

2. Send source file name(file1.xml) in one of the proxy field. Once after successful execution of proxy in ECC, call Interface 2 which is going to be Proxy->PI->File

Interface 2 : Proxy->PI->File

1. Call interface 2 and send file name(file1.xml) as payload to PI which was received from interface 1.

2. Pass this file name(file1.xml) dynamically to OS commands after message processing to copy file1.xml from source folder to Archive folder and delete.

Questions: I would like to know your inputs/comments on Interface 2, point #2

i) Is it possible to pass file name dynamically to OS commands? If yes, using ASMA or variable substitution?

ii)  May i request a sample code to execute OS script to copy and delete the file please?

Thanks

former_member186851
Active Contributor
0 Kudos

Hello Bhavana,

Another simple way would be to write the file from the proxy code only.

ABAPer can write a simple piece of code to write the file in the directory once the proxy runs successfully.

former_member182412
Active Contributor
0 Kudos

Hi Raghu,

I think you misunderstand her requirement, She wants to archive the file in FTP server not in ECC server, ABAPer can write the file in ECC server not in FTP server.

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Hi Praveen,

Okay ..got it

But I guess ABAPers can make FTP calls as well right?

nikhil_bose
Active Contributor
0 Kudos

Hi Bhavana,

OS commands accepts variables as below. pass file name and directory to ECC and after proxy completes execution on the second call from ECC, pass file name and directory set through dynamic configuration and make it available to OS command.


Place holders in the OS command are:

%f (file name)

%F (absolute file name including path)


Regards,

Nikhil

nitindeshpande
Active Contributor
0 Kudos

Hi Bhavana,

My solution for this would be to use a synchronous proxy.

For the outbound communication coming from ABAP, you can use the same XSD of the source file sent from and in the receiver channel you can provide the archive directory to drop the file and also in the same channel you can provide the OS command to delete the old file.

This ensures that proxy has been executed successfully and also your file can be deleted.


And also you can use ASMA with "*" in Filename column of your sender channel and receiver channel. Hence this ensures the filename to remain same.

Regards,

Nitin

former_member217029
Participant
0 Kudos

Hello Nikhil,

Thanks for the reply. I will use Dynamic configuration option to pass file name to OS command script.

May i ask you sample syntax for OS commands to do below

- how/where to mention dynamic file name to OS script

- How to tell the script to copy/archive the file (dynamic file name )and delete it ?

former_member182412
Active Contributor
0 Kudos

Hi Bhavana,

You can do this in two ways.

  • When you pick up the file delete the file from source directory and send the message to ERP via inbound proxy, after successful processing in proxy inbound method you can call outbound proxy which sends the same message back to PI using separate asynchronous interface and map the message back to file and create the file in archive directory.
  • Same as above pick up the file and delete the file from source directory and send the data to ERP via inbound synchronous proxy, after successful processing send the response back to PI and the response message map it back to file and write the file in archive directory, this is async to sync bridge via modules in receiver adapter, check below blog for more details.

      

Regards,

Praveen.

former_member217029
Participant
0 Kudos

Hello Praveen,

Thanks for your inputs.

The Idea is good but i should not delete the file from FTP until proxy call is success.