Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Archive file on application server

former_member182337
Participant
0 Likes
1,421

Hi,

I am working on inbound idoc to read file from application server and post to SAP. After reading the file, how can we archive the file on the application server?I am using IDOC_INBOUND_FROM_FILE to move file data to SAP. I am not sure how to archive the file after the idoc is posted?

Thanks,

Prem

Hi,

I am working on inbound idoc to read file from application server and post to SAP. After reading the file, how can we archive the file on the application server?I am using IDOC_INBOUND_FROM_FILE to move file data to SAP. I am not sure how to archive the file after the idoc is posted?

Thanks,

Prem

4 REPLIES 4
Read only

Former Member
0 Likes
834

Check the below code to move the file from Source path to Target path in the application server.


    CALL FUNCTION 'ARCHIVFILE_SERVER_TO_SERVER'
      EXPORTING
        SOURCEPATH = LV_SOURCEPATH
        TARGETPATH = LV_TARGETPATH
      EXCEPTIONS
        ERROR_FILE = 1
        OTHERS     = 2.
    IF SY-SUBRC EQ 0.
      DELETE DATASET LV_SOURCEPATH.
    ENDIF.

Read only

0 Likes
834

Thanks Suman but i am not using any custom code for this. I use the FM idoc_inbound_from_file to convert it into idoc and then use the standrd FM to post it into application. Do you say that i need to map it to a custom code so that i can incporporate this FM of yours?

Thanls,

Prem

Read only

0 Likes
834

Hi,

If you want to archive the files and put it to App. Layer. Try to explore the following:

1. Get the file path via FM: FILE_GET_NAME_USING_PATH

2. Then get all the the files via FM: SUBST_GET_FILE_LIST

3. Move/copy the files to the path via FM: SXPG_CALL_SYSTEM

Read only

0 Likes
834

Thanks Jaime.