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

always the excel format output

Former Member
0 Likes
493

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.

2 REPLIES 2
Read only

vinod_vemuru2
Active Contributor
0 Likes
464

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.

Read only

Former Member
0 Likes
464

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