‎2008 Aug 27 11:02 AM
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
‎2008 Aug 27 11:05 AM
data: lv_len type i.
lv_len = strlen( p_dnload ).
lv_len = lv_len -4.
if p_dnload+lv_len EQ '.XLS'.
else.
endif.
‎2008 Aug 27 11:05 AM
data: lv_len type i.
lv_len = strlen( p_dnload ).
lv_len = lv_len -4.
if p_dnload+lv_len EQ '.XLS'.
else.
endif.
‎2008 Aug 27 11:06 AM
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.
‎2008 Aug 27 11:06 AM
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
‎2008 Aug 27 11:15 AM
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.
‎2008 Aug 27 11:19 AM
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.
‎2008 Aug 27 11:21 AM
‎2008 Aug 27 11:28 AM
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.