2023 Apr 19 11:42 AM
We have created a module pool program with 4 buttons. 2 out of 4 buttons when clicking on the button will navigate to custom tcodes and it is working fine, but when I click the back button from the custom tcodes it does not return to the 1st screen of the module pool, instead I have to click twice to come back to the first screen.
CASE SY-UCOMM.
WHEN 'EXIT' OR 'BAC' OR 'CANCEL' OR 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'CLE'.
CLEAR: wa_str-ebeln, wa_str-ebelp.
WHEN 'REP'.
CALL TRANSACTION 'ZMAT_DE'.
WHEN 'UPD'.
CALL TRANSACTION 'ZMAT_UPLOAD'.
WHEN 'SUB'.
SELECT SINGLE ebeln
ebelp FROM ekpo INTO it_str2 WHERE ebeln = wa_str-ebeln AND ebelp = wa_str-ebelp.
any help is appreciated.
2023 Apr 19 2:41 PM
When you leave the Z-transaction, Abap will continue with the code following the CALL TRANSACTION (like for a CALL SCREEN) so in your case the flow continue after the ENDCASE, by default you don't change screen in the caller program.
As sandra.rossi wrote, try to debug your program.
2023 Apr 19 2:16 PM
Please, do a debug and tell us where the code goes after clicking. Thanks.
2023 Apr 19 2:38 PM
Is the same happening with standard code also?
replace standard tcode with custom tcode and see.
if standard tcode is working fine, that means in custom tcode, see what written in standard tcode vs custom tcode for back button and replace accordingly.
2023 Apr 19 2:41 PM
When you leave the Z-transaction, Abap will continue with the code following the CALL TRANSACTION (like for a CALL SCREEN) so in your case the flow continue after the ENDCASE, by default you don't change screen in the caller program.
As sandra.rossi wrote, try to debug your program.
2023 Apr 19 6:45 PM
Please try by adding a LEAVE TO SCREEN 0 after the CALL TRANSACTION. Best can be analyzed by debugging.