‎2007 Jul 12 9:15 PM
HI,
I am uploading the data for open AR line items through a file in the applicaiton server.
can any one give me some idea how to validate whether that file is existing or not...?
please its bit urgent
If anyone can give me some code, that would be really helpful for me
SRI
‎2007 Jul 12 9:18 PM
All you need to do is evaluate SY-SUBRC after the OPEN statement, if it is not 0, then it either does not exist or you don't have permission to open it, I think 4 is that it does not exist, and 8, means that you don't have permission. Anyway, simply check the value of SY-SUBRC after the OPEN DATASET statement.
Regards,
Rich Heilman
‎2007 Jul 12 9:42 PM
Rich ,
Just i want to do the validation in at selection screen output even so that the mentioned file is existing or not
does it make any sense... then how to do that
‎2007 Jul 12 9:20 PM
Hi,
Open the file using the OPEN DATASET syntax..If the return code is not successful..then the file does not exits.
OPEN DATASET '/tmp/test.txt' FOR INPUT.
IF SY-SUBRC <> 0.
MESSAGE 'Error in opening file or file does not exists'.
ENDIF.
Thanks
Naren
‎2007 Jul 12 9:49 PM
Hi,
Please try something like this.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_apath.
* Open the Browse Dialog Box on the Application Server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
IMPORTING
serverfile = p_apath
EXCEPTIONS
canceled_by_user = 1
others = 2.
IF sy-subrc <> 0.
... " Error Message
ENDIF.
Regards,
Ferry Lianto