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: 

gui_upload and cancel-button ??

0 Kudos

hi friends,

i do use the ->file_open_dialog functionality and i want to have the following:

whenever the user clicks on "cancel" in the dialog, the open_file dialog should be closed.

Upto now it causes my transaction to go infinity!

call method cl_gui_frontend_services=>file_open_dialog

CHANGING

file_table = i_file

rc = i.

what is wrong with this ?

thank you for your help,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Try this:

DATA: T_FILE_IN TYPE FILETABLE,
        W_FILE_IN TYPE FILE_TABLE,
        RC        TYPE I.

  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    CHANGING
      FILE_TABLE              = T_FILE_IN
      RC                      = RC
    EXCEPTIONS
      FILE_OPEN_DIALOG_FAILED = 1
      CNTL_ERROR              = 2
      ERROR_NO_GUI            = 3
      OTHERS                  = 4.
  IF SY-SUBRC = 0.
    CHECK RC = 1.
    READ TABLE T_FILE_IN INTO W_FILE_IN INDEX 1.
    MOVE W_FILE_IN TO P_FILE.
  ENDIF.

Max

3 REPLIES 3

Former Member
0 Kudos

Hi

Try this:

DATA: T_FILE_IN TYPE FILETABLE,
        W_FILE_IN TYPE FILE_TABLE,
        RC        TYPE I.

  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    CHANGING
      FILE_TABLE              = T_FILE_IN
      RC                      = RC
    EXCEPTIONS
      FILE_OPEN_DIALOG_FAILED = 1
      CNTL_ERROR              = 2
      ERROR_NO_GUI            = 3
      OTHERS                  = 4.
  IF SY-SUBRC = 0.
    CHECK RC = 1.
    READ TABLE T_FILE_IN INTO W_FILE_IN INDEX 1.
    MOVE W_FILE_IN TO P_FILE.
  ENDIF.

Max

former_member194669
Active Contributor
0 Kudos

Have your SAPGui updated with latest patch level? For testing this execute your program in some other system that have latest patch

Former Member
0 Kudos

Hi Friend,

Make Use of parameter USER_ACTION.

when the user presses the cancel button ,the corresponding variable and CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL will have the value 9.

So proceed further , only when the value of the variable ne CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

DEFAULT_FILENAME = W_P_DEF_FILE1

CHANGING

file_table = I_FILE_TABLE1

rc = W_RC1

USER_ACTION = w_usr_act1

  • FILE_ENCODING =

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5

IF sy-subrc = 0

AND w_usr_act1

ne CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.

Hope it helps.

Regards,

Charumathi.B