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: 
Read only

Validation

Former Member
0 Likes
490

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
471

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

3 REPLIES 3
Read only

suresh_datti
Active Contributor
0 Likes
471

try this...


translate p_file to uppercase.
if not p_file cs '.TXT'.
* error message
endif.

Regards,

Suresh Datti

Read only

Former Member
0 Likes
471

PARAMETERS : P_FILE TYPE RLGRAP-FILENAME.

AT SELECTION-SCREEN.

IF p_file CP '.txt'.

*Allow to proceed

ELSE.

*Stop processing

ENDIF.

Regards,

Wenceslaus.

Read only

Former Member
0 Likes
472

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