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: 

Back button issue in module pool program.

pritam_baboo
Participant
0 Kudos

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.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor

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.

  • If you want to leave the calling screen too, add a LEAVE TO SCREEN 0 after the CALL TRANSACTION (ot set 0 in the next screen attribute of the dynpro definition)

As sandra.rossi wrote, try to debug your program.

4 REPLIES 4

Sandra_Rossi
Active Contributor

Please, do a debug and tell us where the code goes after clicking. Thanks.

0 Kudos

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.

raymond_giuseppi
Active Contributor

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.

  • If you want to leave the calling screen too, add a LEAVE TO SCREEN 0 after the CALL TRANSACTION (ot set 0 in the next screen attribute of the dynpro definition)

As sandra.rossi wrote, try to debug your program.

Harish_Vatsa
Active Contributor

Please try by adding a LEAVE TO SCREEN 0 after the CALL TRANSACTION. Best can be analyzed by debugging.