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

validations

Mohamed_Mukhtar
Active Contributor
0 Likes
1,025

hi ,

A very good day to you all abapers..

These are my selection-screen parameters

*PARAMETERS : p_upload TYPE rlgrap-filename,  "upload file*
                                   *p_dnload TYPE rlgrap-filename,  " download error file*

my requirement is , i have to download error records in a .XLS format..

But Selection-screen should accept only .XLS format..

other than .XLS , it should throw error message

At selection-screen on p_dnload.
if <.xls format>
 
else..
error message
endif.

Can u provide some inputs

With Regards

Always Learner

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,008

  data: lv_len       type i.

  lv_len = strlen( p_dnload ).
  lv_len = lv_len -4.
  if p_dnload+lv_len EQ '.XLS'.

  else.

  endif.
7 REPLIES 7
Read only

Former Member
0 Likes
1,009

  data: lv_len       type i.

  lv_len = strlen( p_dnload ).
  lv_len = lv_len -4.
  if p_dnload+lv_len EQ '.XLS'.

  else.

  endif.
Read only

Former Member
0 Likes
1,008

do this way...

at selection-screen on p_dnload.

data: l_len type i,

l_len1 type i.

l_len = strlen( p_dnload ).

l_len1 = l_len - 4.

if l_len+l_len1(4) = '.xls'.

do nothing.

else.

give error message.

endif.

Read only

Former Member
0 Likes
1,008

This will definitely help you....

AT SELECTION-SCREEN.

PERFORM f_file_validation.

FORM f_file_validation .

DATA: BEGIN OF t_filename OCCURS 2,

part TYPE dart1_lfile,

END OF t_filename.

DATA count TYPE i.

SPLIT p_dload AT '.' INTO TABLE t_filename.

DESCRIBE TABLE t_filename LINES count.

READ TABLE t_filename INDEX count.

IF t_filename-part <> 'XLS' .

MESSAGE e001(zmsg).

ENDIF.

ENDFORM. " F_FILE_VALIDATION

Read only

Former Member
0 Likes
1,008

Hi,

Try like this,

PARAMETERS: p_upload TYPE rlgrap-filename,

p_dnload TYPE rlgrap-filename.

DATA: w_ext(4) TYPE c,

w_len TYPE i,

w_pos type i.

AT SELECTION-SCREEN On p_dnload.

w_len = strlen( p_dnload ).

w_pos = w_len - 4.

w_ext = p_dnload+w_pos(4).

IF w_ext <> '.xls'.

MESSAGE 'Give .xls file' TYPE 'E'.

ENDIF.

START-OF-SELECTION.

Best Regards.

Read only

Firoz_Ashraf
Contributor
0 Likes
1,008

Hi !

Try the following:


DATA: v_filelen TYPE i, v_remain type i.
PARAMETERS: p_dnload TYPE rlgrap.

AT SELECTION-SCREEN ON p_dnload.
  v_filelen = STRLEN( p_dnload ).
  v_remain = v_filelen - 4.
  IF p_dnload+v_remain(4) = '.XLS' or p_dnload+v_remain(4) = '.xls'.
    MESSAGE e001(zatg) WITH 'Please enter the Excel file only'.
  ENDIF.

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
1,008

Thank u guys...

issue resolved

Read only

Former Member
0 Likes
1,008

Hi

Try this...

PARAMETERS : p_load TYPE rlgrap-filename. "upload file*

  • p_dnload TYPE rlgrap-filename, " download error file

data: l1 type string,

l2(3) type c.

At selection-screen on p_dnload.

split p_dnload at '.' into l1 l2.

if l2 ne 'XLS'.

message e001 with 'error msg'.

endif.