Aug 26, 2015

How to Create a File in Application Server with Abap Programing

Question:
I have a file in my 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.


Answer:
If you want to do this using ABAP you could create a small report that uses the function module GUI_UPLOAD to get the file from your local disk into an internal table and then write it to the application server with something like this:
lv_filename = '\\path\to\al11\directory\file.txt'.

OPEN DATASET lv_filename  FOR OUTPUT IN TEXT MODE ENCODING UTF-8.

LOOP AT lt_contents INTO lv_line.
  TRANSFER lv_line TO lv_filename.
ENDLOOP.

CLOSE DATASET lv_filename.


Ref: http://stackoverflow.com/questions/27104531/how-to-create-a-file-in-application-server-with-abap-programing

No comments :