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

Regardig dialog programming

Former Member
0 Likes
495

my question is : In dialog programming when we click on any push button the PAI will be triggered . But i need a EXIT button on the screen .And when I clicked at first time there canot be any action . But for the second click it should exit .

what is the solution for this

3 REPLIES 3
Read only

Former Member
0 Likes
462

Hello,

Check this sample.


REPORT ZV_SDN_DIALOG .
DATA: FLAG.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  IF SY-UCOMM = 'GOTO'.
    CALL SCREEN 200.
  ELSEIF SY-UCOMM = 'EXIT'.
    IF FLAG IS INITIAL.
      FLAG = 'X'.
    ELSE.
      LEAVE PROGRAM.
    ENDIF.
  ENDIF.

ENDMODULE.                 " USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0200  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0200 INPUT.
  IF SY-UCOMM = 'EXIT'.
*    CALL SCREEN 200.
    LEAVE TO SCREEN 100.
  ENDIF.
ENDMODULE.                 " USER_COMMAND_0200  INPUT

Regards,

VAsanth

Read only

Former Member
0 Likes
462

Hi

U need to use a variable to store when the EXIT button is pushed for the next time.

PROCESS PAI.
  MODULE USER_COMMAND.

MODULE USER_COMMAND.

  CASE OK_CODE.
    WHEN 'EXIT'.
       EXIT_COUNTER = EXIT_COUNTER + 1.
       
       IF EXIT_COUNTER > 1.
          <DO SOMETHING>.
       ENDIF.

Max

Read only

Former Member
0 Likes
462

In PAI, in user_command module write,

if ok_code = 'exit'.

Flag = flag + 1.

if flag > 1.

leave program (or) Leave to screen 'xxxx'.

endif.

endif.

Note: Initially, flag flag should be 0.