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: 

help needed

Former Member
0 Kudos
146

Hi experts,

how to put data in logical and physical file.

i need physical file and logical file names in selection- screen and i need check box for these two files. and when i select this check box the data should upload into these file.

please guide me how to write code.

Thanks,

venkat

5 REPLIES 5

Former Member
0 Kudos
105

logical file path is nothing but a IDENTIFIER/STRING/NAME = the name by which we refer to that file.

(in our programs)

2. The physical location of that file,

may change from server to server,

or from time to time.(hence, we do not use hardcoded physical path,in our programs,

but instead use this MAPPING of logical path,to the physical path)

Former Member
0 Kudos
105

Hi Venkat,

You can use the FM 'GUI_DOWNLOAD' to download file.

Hope this helps!

Regards,

Saurabh

Former Member
0 Kudos
105

Hi,

The Logical path is the platform independent path of a file while the physical path is the actual(platform specific) path on the server where the file resides.

The mapping of the logical path to physical path is maintained via trx. FILE . You can see this updated in table PATH.

Maintain this mapping in trx. FILE.

In the code, read teh logical path from the sel. screen , go to table PATH and get the physical path an dthen read the data file from there.

Hope this helps.

Regards,

Roopali

0 Kudos
105

Hi Roopali,

PLZ SEND SOME SAMPLE CODE.

Thanks,

venkat

0 Kudos
105

Hi Venkat,

Sample code as below:

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS:

p_lfname LIKE path-pathintern " Logical file path

DEFAULT 'ZLOGICAL PATH_SD',

p_pfname LIKE path-pathextern " File name

DEFAULT 'test.txt'.

SELECTION-SCREEN: END OF BLOCK b1.

  • Get the physical file path

SELECT SINGLE pathextern INTO l_path FROM path

WHERE pathintern = p_lfname

AND filesys = 'UNIX'.

  • Add the filename to the file path

REPLACE '<FILENAME>' WITH p_pfname INTO l_path.

****************************************************************

In trx. FILE, the mapping has been maintained like this:

Logical path: ZLOGICAL PATH_SD

Physical path: /usr/sap/test/<FILENAME>

Hence after the Select: l_path will have '/usr/sap/test/<FILENAME>'

while after the Replace l_path will be '/usr/sap/test/test.txt'.

Hope this helps.

Regards,

Roopali