‎2007 May 03 8:52 AM
i am sending a file to AL11, i need to validate file path which is in selection screen parameter
can u suggest any possabilities
Regards
Rassheed
‎2007 May 03 9:02 AM
Threre are some Function Modules which work on application server directory, try something like
* Read directories of an application server
CALL FUNCTION 'RZL_READ_DIR'
EXPORTING
name = directory
nrlines = 1
TABLES
file_tbl = file_table
EXCEPTIONS
argument_error = 1
not_found = 2
send_error = 3
OTHERS = 4.Which return the list of files in such a directory. Look also at Function Group SAL3
Regards
‎2007 May 03 8:59 AM
Try adding the old open dataset to your AT-SELECTION-SCREEN event
Open dataset p_file for output in TEXT MODE.
IF SY-SUBRC <> 0.
MESSAGE E000...
ENDIF.
‎2007 May 03 8:59 AM
Hi rasheed,
Try this Instead of using AL11,
CG3Y To Save a file From Application server to Presentation server directly.
CG3Z To Save a file From Presentation server to Application server directly.
Thanks.
‎2007 May 03 9:02 AM
Threre are some Function Modules which work on application server directory, try something like
* Read directories of an application server
CALL FUNCTION 'RZL_READ_DIR'
EXPORTING
name = directory
nrlines = 1
TABLES
file_tbl = file_table
EXCEPTIONS
argument_error = 1
not_found = 2
send_error = 3
OTHERS = 4.Which return the list of files in such a directory. Look also at Function Group SAL3
Regards
‎2007 May 03 9:05 AM
Hi ,
At u r selection screen if u r using FM : F4_FILENAME , then it will automatically opens the bwowser, then u dont have to worry abt file validation.
if u r sending file to AS, using opendataset......... then if file doesnt exists in the AS then it will automatically create it and if file already exists in AS then it will replace that one.
Reward points if useful..
Regards
Nilesh
‎2007 May 03 9:15 AM
Hi
You could simply try opening it. If sy-subrc <> 0, then you know that the path/filename is not found.
parameters:
p_filename ....
at selection-screen.
OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
if sy-subrc = 8.
message 'file not found' type i.
endif.
and also
Check this code:
DATA: dl_file TYPE ibipparms-path. " File name
CONSTANTS: c_dir TYPE rlgrap-filename.
* F4 filename for Application server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = c_dir
filemask = ' '
IMPORTING
serverfile = dl_file
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Error while getting the file name'(006).
EXIT.
ELSE.
p_file = dl_file.
ENDIF.
please check this FM DX_FILE_EXISTENCE_CHECK.
To validate the path
Just check these links
Regards Rk
Message was edited by:
Rk Pasupuleti