how to create a file in application server with abap programing

36,243

Solution 1

I used CG3Z transaction and with this transaction I was able to copy a file in the application server directory.

Solution 2

To upload the file to the application server, there are three steps to be followed. To open the file use the below statement:

Step1: OPEN DATASET file name FOR INPUT IN TEXT MODE ENCODING DEFAULT.

To write into the application server use.

Step2: TRANSFER name TO file name.

Dont forget to close the file once it is transferred.

Step3: CLOSE DATASET file name.

Plese mark with correct answer, if it helps! :)

Share:
36,243
reza
Author by

reza

Updated on November 27, 2022

Comments

  • reza
    reza over 1 year

    I have a file in my D: drive of my computer and I want to copy this file to an SAP application server so that I am able to see my file with transaction AL11. I know that I can create a file with AL11 but I want do this in ABAP.

    Of course in my search I find this code but I cannot solve my problem with it.

    data: unixcom like   rlgrap-filename. 
    data: begin of tabl occurs 500,
    
        line(400),
    
      end of tabl.
    
    dir = 
    
    unixcom = 'mkdir mydir'. "command to create dir
    
    "to execute the unix command
    call 'SYSTEM' id 'COMMAND' field unixcom
                  id 'TAB'     field tabl[].
    
    • Jagger
      Jagger over 9 years
      Use function module ARCHIVFILE_CLIENT_TO_SERVER
  • Jagger
    Jagger over 9 years
    Why write any code at all when one could run simply the function module ARCHIVFILE_CLIENT_TO_SERVER in SE37?
  • Jagger
    Jagger over 9 years
    Note that this transaction is only available in an ERP system.
  • maillard
    maillard over 9 years
    @Jagger That would be a better solution for this particular question, indeed. But I did not know about this function module (thanks to you, now i do :-) ). Why don't you post that as an answer? I also think that the code in this answer still is useful.