Skip to Content

Introduction:-

In some cases when we upload a file on application server we need to get the logical file path name dynamically since we deal with different systems i.e. Development, Quality and production system and the server path is different in all the systems. So to get the file path dynamically we need to obtain the logical file path name by reading the physical path name which is nothing but directory parameter.

So to achieve this I have documented the code below that will help in understanding how to upload the file on application server by getting the file path dynamically reading the physical path.

Steps to create abap program to upload the file on application sever:-

So here in this example we are reading the data from an existing Z-table and writing it to the application server using the physical path name.

Go to SE38:- Give a name to the program such as Z_FILE_UPLOAD and click on “create” button.

image 1.jpg

A following pop up comes, provide all the details as per the requirement.

image 2.jpg

So the first part is data declaration and selection screen to read the specific data from the Z-table.

image 3.jpg

image 4.jpg

Then we will be reading the data from the Z-table into a internal table using the select statement in start-of-selection.

image 5.jpg

Now declaring 2 sub-routines:

1. To define the file path – PERFORM define_path

2. To upload the file – PERFORM upload_file

image 6.jpg

Lets see the definition of both the routines.

image 7.jpg

image 8.jpg

So below the logical name of the physical path DIR_SAPUSERS is read. So dynamically we can get the file path name for any systems by just reading the physical path.

image 9.jpg

Below is the file that upload to the application server.

image 10.jpg

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply