Application Development 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: 

Cancel Button of TEXT_CONVERT_XLS_TO_SAP

Former Member
0 Kudos

Hi,

How do I detect when cancel button is clicked in FM TEXT_CONVERT_XLS_TO_SAP?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

you can't check Cancel button in this FM.

you will be having an open dialod call, right? there you can..

try the below code for open dialod :

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = l_str

default_extension = '*.xls'

file_filter = 'Excel (.xls)|.xls|'

CHANGING

file_table = i_filetab

rc = w_rc

user_action = w_user_act

EXCEPTIONS

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF w_user_act EQ cl_gui_frontend_services=>action_ok.

READ TABLE i_filetab INTO wa_filetab INDEX 1.

IF sy-subrc EQ 0.

po_ufil = wa_filetab-filename.

ENDIF.

ENDIF.

ENDIF.

Thanks,

Renjith.

2 REPLIES 2

Former Member
0 Kudos

Hi,

you can't check Cancel button in this FM.

you will be having an open dialod call, right? there you can..

try the below code for open dialod :

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = l_str

default_extension = '*.xls'

file_filter = 'Excel (.xls)|.xls|'

CHANGING

file_table = i_filetab

rc = w_rc

user_action = w_user_act

EXCEPTIONS

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF w_user_act EQ cl_gui_frontend_services=>action_ok.

READ TABLE i_filetab INTO wa_filetab INDEX 1.

IF sy-subrc EQ 0.

po_ufil = wa_filetab-filename.

ENDIF.

ENDIF.

ENDIF.

Thanks,

Renjith.

0 Kudos

hi Renjith,

Thank you so much, yeah, I have looked at the wrong FM. It works now with the sample code you gave.