How To Upload File To SAP Application Server | Program To Upload File In Al11 In SAP ABAP | Open Dataset And Close Dataset In SAP ABAP

Hey Friends, So in this article we’ll learn about How To Upload File To Sap Application Server using ABAP and see the Program To Upload File In Al11 In Sap Abap | And see about AL11 Transaction code which is use to view the directories in application server and how to see file in application server Open Dataset And Close Dataset In Sap Abap | al11 tcode in sap

Program To Upload File In Al11 In SAP ABAP

How To Upload File To SAP Application Server

Sometimes we need to upload our file to application server for further processing. For example we need to upload file in application server, after that application server process the file for any operation like vendor upload, material upload, customer upload, GL upload etc. so in this blog we will learn How To Upload File To SAP Application Server

How To Upload File To SAP Application Server

STEPS TO WRITE ABAP PROGRAm TO Program To Upload File In Al11 In SAP ABAP

You can use following steps to upload file to application server in SAP.

  1. Declare an internal table.
  2. Use OPEN DATASET ABAP statement to open file in Application server to upload file.
  3. Use your own logic or write your logic to read data from internal table and add in your file which you want to upload.
  4. Use CLOSE DATASET ABAP statement to close the Application Server file.

EXAMPLE PROGRAM upload csv file to application server in sap

Here is the example program which uses OPEN DATASET, Logic to read data and add in file and CLOSE DATASET statements  to upload the file.

upload csv file to application server in sap
upload csv file to application server in sap
FORM FILE_TRANSFTER_APPSERVER .

 BEGIN OF T_FILE,
         TEXT(1000) TYPE C,
       END OF T_FILE.

DATA: IT_FILE TYPE TABLE OF T_FILE,
      WA_FILE TYPE          T_FILE.

DATA: TEMPFILE      TYPE C LENGTH 200,
      FILEPATH(500),
      FILENAME      TYPE C LENGTH 200.
  DATA : LC_DATE TYPE DATUM.
  DATA : QTY TYPE STRING.

  FILEPATH = 'E:\usr\sap\VK11_COND\'.
  LC_DATE = SY-DATUM .
  CONCATENATE 'WHSTOCK' LC_DATE '.CSV' INTO FILENAME.
  CONCATENATE FILEPATH FILENAME INTO TEMPFILE.
  CONCATENATE 'Site_Code' 'Site_Name' 'Stock_Location' 'Barcode' 'Icode' 'Qty' INTO WA_FILE SEPARATED BY ','.

  OPEN DATASET TEMPFILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
  TRANSFER WA_FILE TO TEMPFILE.
  CLEAR WA_FILE.
  LOOP AT IT_FINAL INTO WA_FINAL.
    QTY = WA_FINAL-LABST.
    CONCATENATE WA_FINAL-WERKS WA_FINAL-NAME WA_FINAL-LGORT WA_FINAL-EAN WA_FINAL-MATNR QTY INTO WA_FILE SEPARATED BY ','.
    TRANSFER WA_FILE TO TEMPFILE.
    CLEAR: WA_FINAL, WA_FILE, QTY.
  ENDLOOP.

  CLOSE DATASET TEMPFILE.

  IF SY-SUBRC = 0.
    MESSAGE 'Data uploaded succefully.' TYPE 'I'.

  ENDIF.



ENDFORM.

What is AL11 TCode in SAP

AL11 TCode in SAP : find all the directory in SAP Application Server.

AL11 TCode in SAP is used to display all the SAP Directories in Application Server. We can access the different file that have been defined. By using AL11 transaction code we can view file, see files under the directory.

What is AL11 TCode in SAP

To See the file you nee to double click on a directory you will be able to see all the files in the directory. By using the directory parameters in the program we can call a file from the OS level in SAPGUI on the user system.

What is AL11 TCode in SAP

SUMMARYUPLOAD FILE TO APPLICATION SERVER IN SAP

So far in this article we learned about how to upload file to application server in SAP using ABAP and see the program how to upload file to application server. And see about AL11 Transaction code which is use to view the directories in application server and how to see file in application server now we will see the short note/ FAQ

You May Also Like:

FAQ- UPLOAD FILE TO APPLICATION SERVER IN SAP

What is the Difference Between FILE and AL11?

FILE Transaction code is used to define Logical File and to map Logical File with Physical File Path while AL11 is used to view files and file directories on the Application server.

What is Open Dataset in SAP?

Open Dataset keyword is used to open a file in application server to read and write in file.

What is Close Dataset in SAP?

Like Open Dataset keyword used to open a file in application sever to perform action likewise Close Dataset keyword used to close the file in destination after completion of process.

For the next blog please connect with us and follow us on twitter.com/einfonett

1 thought on “How To Upload File To SAP Application Server | Program To Upload File In Al11 In SAP ABAP | Open Dataset And Close Dataset In SAP ABAP”

Leave a Comment

%d bloggers like this: