Skip to Content
0
Former Member
Jul 22, 2008 at 04:33 AM

Execute (F8) taking place upon pressing 'Enter' key

1946 Views

Hi,

I have developed two custom screens in separate programs. The second screen has been assigned a transaction code and is called from the first screen upon user command. Input in screen 1 is in the form of an IO field that takes two-character codes. The appropriate transaction is called depending on the value of the code input by the user.

Before the second program is called (using call transaction statement), inputs are error checked using input checking modules. Pressing the enter key does not cause the second program to be called, which is as it should be. Only upon execution (F8) is the second program called. Once the second program has been called and exited (using leave program statement) it goes back to the first program (screen). This is alright. The issue is that now when the enter key is pressed, the transaction for the second program is called again. I don't want this to happen. This should happen only upon execute, not from pressing Enter. If I input a different value in the input field at this point then press enter it doesn't execute, which is ok. The issue I have described occurs only in the case of calling a transaction, exiting the second screen which is called (which takes you back to the first screen) and pressing Enter.

My code:

TABLES: ZSH_PROCS.

  • Global data declarations.

DATA: OK_CODE LIKE SY-UCOMM,

PROC_INFO LIKE ZSH_PROCS,

PROC_INPUT TYPE ZSH_DE_PN.

  • Screen fields - Used in screen: '9500'.

DATA: TBX_PROCESS TYPE ZSH_DE_PN,

LBL_PROC_STXT TYPE ZSH_DE_PD.

  • Modules

MODULE INIT_9500 OUTPUT.

SET PF-STATUS 'ZSH_GUIS_MAIN'.

SET TITLEBAR 'ZSH_TITL_MAIN'.

ENDMODULE.

MODULE EXIT_9500 INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN 'BACK' OR 'EXIT' OR 'CANCEL' OR 'BTNEXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE.

MODULE PROC_CHECK_9500 INPUT.

PROC_INPUT = TBX_PROCESS.

TRANSLATE PROC_INPUT TO UPPER CASE.

SELECT SINGLE * FROM ZSH_PROCS INTO CORRESPONDING FIELDS OF

PROC_INFO WHERE PRNAM EQ

PROC_INPUT.

IF SY-SUBRC NE 0.

CLEAR: TBX_PROCESS,

LBL_PROC_STXT.

MESSAGE E008(ZSH_MSGC).

ELSE.

LBL_PROC_STXT = PROC_INFO-PDESC.

ENDIF.

ENDMODULE.

MODULE USER_COMMAND_9500 INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN 'EXECUTE'.

CALL TRANSACTION PROC_INFO-TCODE.

ENDCASE.

Screen flow logic:

PROCESS BEFORE OUTPUT.

MODULE INIT_9500.

PROCESS AFTER INPUT.

MODULE EXIT_9500 AT EXIT-COMMAND.

CHAIN.

FIELD: TBX_PROCESS,

LBL_PROC_STXT.

MODULE PROC_CHECK_9500.

ENDCHAIN.

MODULE USER_COMMAND_9500.

Tha above code is for the first program (screen). Help is greatly appreciated. Thanks.

Regards

Edited by: Khan Awkhan on Jul 22, 2008 6:34 AM