2010 Jul 13 8:43 AM
I have a requirement in which i wish to output the file always in excel format.
i have made a selection screen field with search help,if the user deletes the default path given in this text box,replaces it with any free text and puts no extension or any extension other than excel,i want function that will ask him to either enter .xls extension or use search help or press f4.
how can i achieve this.this iwish to do error handling to avoid the file getting generated with faulty file.
please reply.
I have a requirement in which i wish to output the file always in excel format.
i have made a selection screen field with search help,if the user deletes the default path given in this text box,replaces it with any free text and puts no extension or any extension other than excel,i want function that will ask him to either enter .xls extension or use search help or press f4.
how can i achieve this.this iwish to do error handling to avoid the file getting generated with faulty file.
please reply.
2010 Jul 13 9:01 AM
Hi,
Checkout below sample code.
DATA: l_length TYPE i.
CONSTANTS: lc_xls(3) TYPE c VALUE 'xls'.
l_length = STRLEN( po_file ).
l_length = l_length - 3.
IF l_length GT 3.
TRANSLATE po_file+l_length(3) TO LOWER CASE.
CHECK po_file+l_length(3) NE lc_xls.
MESSAGE e001 WITH text-m07.
ELSE.
MESSAGE e001 WITH text-m07.
ENDIF.
Thanks,
Vinod.
2010 Jul 13 10:38 AM
Hi,
Data : lv_file type string.
checking the filetype the user has entenred.
find : '.xls' in p_file.
if sy-subrc ne 0 .
split at '.' into another variable.
concatenate that with '.xls' into lv_file.
else.
do nothing.
endif.
With Regards,
Sumodh.P