2006 Sep 25 8:14 AM
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
2006 Sep 25 8:19 AM
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)
2006 Sep 25 8:26 AM
Hi Venkat,
You can use the FM 'GUI_DOWNLOAD' to download file.
Hope this helps!
Regards,
Saurabh
2006 Sep 25 8:26 AM
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
2006 Sep 25 8:34 AM
2006 Sep 25 8:37 AM
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