‎2006 Mar 23 3:49 AM
Hi all,
I am using a parameter to get a file name(file path) inorder to upload a file from a legacy system.
my query is how to validate the file type ie it should upload only .txt file type only . if u give other than this file type it should through a error message.
can any one suggest me a good coding.
PARAMETERS : P_FILE TYPE RLGRAP-FILENAME.
regards
paul
‎2006 Mar 23 3:56 AM
hi paul,
you can do something like this..
PARAMETERS : P_FILE TYPE RLGRAP-FILENAME.
DATA LEN TYPE I.
DESCRIBE FIELD P_FILE LENGTH LEN.
LEN = LEN - 3.
IF P_FILE+LEN(3) NE 'txt'.
message e000(zmsg) with 'enter only text files'.
endif.regards
satesh
‎2006 Mar 23 3:52 AM
try this...
translate p_file to uppercase.
if not p_file cs '.TXT'.
* error message
endif.
Regards,
Suresh Datti
‎2006 Mar 23 3:56 AM
PARAMETERS : P_FILE TYPE RLGRAP-FILENAME.
AT SELECTION-SCREEN.
IF p_file CP '.txt'.
*Allow to proceed
ELSE.
*Stop processing
ENDIF.
Regards,
Wenceslaus.
‎2006 Mar 23 3:56 AM
hi paul,
you can do something like this..
PARAMETERS : P_FILE TYPE RLGRAP-FILENAME.
DATA LEN TYPE I.
DESCRIBE FIELD P_FILE LENGTH LEN.
LEN = LEN - 3.
IF P_FILE+LEN(3) NE 'txt'.
message e000(zmsg) with 'enter only text files'.
endif.regards
satesh