Skip to Content
-1

How i can go back to the correct screen

Hello All,

I have a transaction that uses several screens, these screens contains a button to exit , when you press it , it just returns to the previous screen, I tried to implement a solution to return to the initial screen, but the problem is that the initial transaction can be one of two (ZTEST1 or ZTEST2), how to distinguish cases using a single button?
WHEN 'EXIT'

Call transaction 'ZTEST1'
OR

Call transaction 'ZTEST2'
I am looking for a place where SAP stores the calling transaction, so that I call it.
ZTEST1 -> ZMytransaction -> screen 1 -> screen 2 -> .. -> screnn N
ZTEST2 -> ZMytransaction -> screen 1 -> screen 2 -> .. -> screnn N

when i exit from N screen, how can i know where to come back? ZTEST1 OR ZTEST2?

NB: I already thought to put two different buttons for the two transactions but it is not optimal

Thanks in advance ,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Mar 05 at 12:45 PM

    If every PAI user command module look like

    WHEN 'NEXTSCREEN'.
      CALL SCREEN nnnn.
      LEAVE TO SCREEN 0.
    WHEN 'BACK'. " Not on initial dynpro of transaction
      LEAVE TO SCREEN 0.

    or even

    WHEN 'NEXTSCREEN'.
      LEAVE TO SCREEN nnnn.
    WHEN 'BACK'. " Not on initial dynpro of transaction
     LEAVE TO SCREEN 0.

    Your problem should be solved. (sequence of LEAVE SCREEN til initial one)

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 05 at 10:57 AM

    Maybe check variable SY-TCODE for current transaction?

    IF sy-tcode = 'ZTEST1'.
    CALL SCREEN....
    ELSEIF sy-tcode = 'ZTEST2'.
    CALL SCREEN...
    ENDIF.

    Add comment
    10|10000 characters needed characters exceeded

    • it returns to the previous screen not the initial one
      for example ,

      ZTEST2 -> ZMytransaction -> screen 1 -> screen 2 -> .. -> screnn N

      if you use LEAVE TO SCREEN 0 in screen 2 , it returns to screen 1

  • Mar 06 at 12:35 PM

    If SET PARAMETERs weren't passed to called transaction, many many developpers and SAP would get into trouble, check your code.

    Add comment
    10|10000 characters needed characters exceeded