<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: ABAP Calling last calling program in the stack in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13872873#M4884847</link>
    <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/710015"&gt;@ulrich_mhrke&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Hi, sorry for the late reply, I am not hesitating to share the code as only this much code is available. I will try more to add as below:&lt;BR /&gt;Screen 400 flow logic:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;PROCESS BEFORE OUTPUT.
  MODULE status_0400.

PROCESS AFTER INPUT.
  MODULE user_command_0400.


PROCESS ON VALUE-REQUEST.
  "  FIELD SOLDTONEW MODULE SOLDTO_F4.
  " FIELD SHIPTONEW MODULE SHIPTO_F4.
  "  FIELD CURRENCYNEW MODULE CURRENCYNEW_F4.
  " FIELD MATNONEW MODULE MATNONEW_F4.
  " FIELD stprs MODULE unitc0st_f4.&lt;/LI-CODE&gt;&lt;P&gt;Below is user-command module for screen 400:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;MODULE user_command_0400 INPUT.

  SELECT SINGLE bezei INTO @DATA(wa_bezei) FROM tinct WHERE inco1 = @inco1 AND spras EQ @sy-langu.
  IF sy-subrc EQ 0.
    inco2 = wa_bezei.
  ENDIF.

  SELECT SINGLE name1 FROM kna1 INTO @DATA(name1) WHERE kunnr = @soldtonew.
  IF sy-subrc EQ 0.
    soldto = name1.
  ENDIF.
  CLEAR name1.
  SELECT SINGLE name1 FROM kna1 INTO @name1 WHERE kunnr = @shiptonew.
  IF sy-subrc EQ 0.
    shipto = name1.
    CLEAR name1.
  ENDIF.
  SELECT SINGLE maktg FROM makt INTO @DATA(maktg_v) WHERE matnr = @matnonew.
  IF sy-subrc EQ 0.
    maktg = maktg_v.
    CLEAR maktg_v.
  ENDIF.

  unit = unit.

  "SELECT SINGLE vkorg, vtweg, spart FROM knvv INTO @DATA(wa_knvv) WHERE kunnr = @soldtonew.
  "IF sy-subrc EQ 0.
  " vkorg = wa_knvv-vkorg.
  "vtweg = wa_knvv-vtweg.
  "spart = wa_knvv-spart.
  "CLEAR wa_knvv.
  "ENDIF.

*  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
*    EXPORTING
*      input  = matnonew
*    IMPORTING
*      output = matnonew.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = soldtonew
    IMPORTING
      output = soldtonew.

  REFRESH: t_a005[], lt_konp[].

  SELECT * FROM a005 INTO TABLE t_a005 WHERE kappl =  'V' AND kschl =  'ZPR1' AND vkorg = vkorg AND vtweg = vtweg AND kunnr = soldtonew AND matnr = matnonew  AND datbi &amp;gt;= sy-datum.
  IF sy-subrc = 0.
    SELECT knumh kopos kschl kbetr konwa kpein kmein krech loevm_ko mwsk1 kznep stfkz kzbzg
      FROM konp APPENDING TABLE lt_konp
      FOR ALL ENTRIES IN t_a005 WHERE
      knumh = t_a005-knumh AND
      kschl = t_a005-kschl.
    IF sy-subrc = 0.
      LOOP AT lt_konp INTO ls_konp.
        unit = ls_konp-kbetr.
        EXIT.
      ENDLOOP.
    ENDIF.
  ELSE.

    DATA matnonew_1 TYPE mara-matnr.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = matnonew
      IMPORTING
        output = matnonew_1.


    SELECT * FROM a005 INTO TABLE t_a005 WHERE kappl =  'V' AND kschl =  'ZPR1' AND vkorg = vkorg AND vtweg = vtweg AND kunnr = soldtonew AND matnr = matnonew_1  AND datbi &amp;gt;= sy-datum.
    IF sy-subrc = 0.
      SELECT knumh kopos kschl kbetr konwa kpein kmein krech loevm_ko mwsk1 kznep stfkz kzbzg
    FROM konp APPENDING TABLE lt_konp
    FOR ALL ENTRIES IN t_a005 WHERE
    knumh = t_a005-knumh AND
    kschl = t_a005-kschl.
      IF sy-subrc = 0.
        LOOP AT lt_konp INTO ls_konp.
          unit = ls_konp-kbetr.
          EXIT.
        ENDLOOP.
      ENDIF.
    ENDIF.
  ENDIF.


  CASE sy-ucomm.
    WHEN 'FNEXIT'.
      PERFORM exit_screen_400.
    WHEN 'FNADD'.
      add_btn_clicked_400 = 1.
      save_btn_clicked_400 = 0.
      change_btn_clicked_400 = 0.
      delete_btn_clicked_400 = 0.
      PERFORM add_item_400.
    WHEN 'FNCHANGE'.
      add_btn_clicked_400 = 0.
      change_btn_clicked_400 = 1.
      delete_btn_clicked_400 = 0.
      save_btn_clicked_400 = 0.
      PERFORM change_item_400.
    WHEN 'FNSAVE'.
      save_btn_clicked_400 = 1.
      add_btn_clicked_400 = 0.
      change_btn_clicked_400 = 0.
      delete_btn_clicked_400 = 0.
      PERFORM save_orders_so.
    WHEN 'FNACCEPT'.
      PERFORM accept_item_changes_400.
    WHEN 'FNDELETE'.
      save_btn_clicked_400 = 0.
      add_btn_clicked_400 = 0.
      change_btn_clicked_400 = 0.
      delete_btn_clicked_400 = 1.
      PERFORM delete_item_400.
    WHEN 'FNCALC'.
      PERFORM calculate_sub_total.
    WHEN 'FNVERIFY'.
      "test run
      wa_testrun = 'X'.
      PERFORM prepare_bapi_data.
    WHEN 'FNPOST'.
      "test run
      CLEAR wa_testrun.
      PERFORM prepare_bapi_data.
    WHEN 'NEWMAT'.
      "test run
      SET PARAMETER ID 'OPTION' FIELD 'MAT'.
      CALL TRANSACTION 'ZUPLOADRPA'.
    WHEN 'NEWCUST'.
      SET PARAMETER ID 'OPTION' FIELD 'CUST'.
      CALL TRANSACTION 'ZUPLOADRPA' AND SKIP FIRST SCREEN.
      "SUBMIT ZUPLOADRPA VIA SELECTION-SCREEN AND RETURN.
  ENDCASE.
ENDMODULE.&lt;/LI-CODE&gt;&lt;P&gt;When NEWMAT is being clicked (which is button on screen 400) the transaction ZUPLOADRPA is called. The program and transaction names are same.&lt;/P&gt;&lt;P&gt;Now at ZUPLOADRPA below is the selection screen.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERS : cust     RADIOBUTTON GROUP g1 DEFAULT 'X'  USER-COMMAND cmd  MODIF ID upd,
             vend     RADIOBUTTON GROUP g1 MODIF ID up1,
             mat      RADIOBUTTON GROUP g1 MODIF ID upm,
             raw      RADIOBUTTON GROUP g1 MODIF ID up1,
             halb     RADIOBUTTON GROUP g1 MODIF ID up1,

             bom      RADIOBUTTON GROUP g1  MODIF ID bom,
             altbom   RADIOBUTTON GROUP g1 MODIF ID bpd,
             exbom    RADIOBUTTON GROUP g1 MODIF ID bpd,
             moda     TYPE ctu_params-dismode OBLIGATORY DEFAULT 'A' MODIF ID bpd,

             routing  RADIOBUTTON GROUP g1 MODIF ID rot,
             altrot   RADIOBUTTON GROUP g1 MODIF ID rpd,
             exrot    RADIOBUTTON GROUP g1 MODIF ID rpd,


             hibe     RADIOBUTTON GROUP g1 MODIF ID up1,
             hawa     RADIOBUTTON GROUP g1 MODIF ID up1,
             vcust    RADIOBUTTON GROUP g1 MODIF ID up1,
             nlag     RADIOBUTTON GROUP g1 MODIF ID up1,
             rawext   RADIOBUTTON GROUP g1 MODIF ID up1,
             fertdesc TYPE zfertdesc MODIF ID upm.
*PARAMETERS : mod1 TYPE ctu_params-dismode DEFAULT 'A' OBLIGATORY  MODIF ID upd.
SELECTION-SCREEN END OF BLOCK b1.


AT SELECTION-SCREEN ON EXIT-COMMAND.

  "LEAVE to SCREEN 100.&lt;/LI-CODE&gt;&lt;P&gt;The selection screen execution will display ALV grid as below:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt; CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_buffer_active          = space
        i_callback_program       = sy-repid
        i_callback_pf_status_set = 'SET_PF_STATUS'
        i_callback_user_command  = 'CUST_USER_COMMAND'
        it_fieldcat              = t_field[]
        is_layout                = gd_layout
        i_save                   = 'A'
        i_default                = 'X'
      TABLES
        t_outtab                 = it_cust
      EXCEPTIONS
        program_error            = 1
        OTHERS                   = 2.
  &lt;/LI-CODE&gt;&lt;P&gt;And at ALV grid user command module below is the code for back button PF1:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;  ELSEIF ( ( sy-ucomm = 'PF1' ) OR ( sy-ucomm = 'PF2' ) OR ( sy-ucomm = 'PF3' ) ).
    LEAVE TO CURRENT TRANSACTION.
  ENDIF.&lt;/LI-CODE&gt;&lt;P&gt;From here, back is pressed and the screen flow comes back to selection screen again.&lt;/P&gt;&lt;P&gt;But, after selection screen, and pressing back button at selection screen it is ending the transaction and not going back to the calling screen i.e. 400 PBO. Below is the 400 screen PBO:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;ODULE status_0400 OUTPUT.
  SET PF-STATUS 'ZSCRPF_400'.
  SET TITLEBAR 'ZSCRT_400'.

  GET PARAMETER ID 'FILENAME' FIELD filename.

  PERFORM set_layout_list.
  IF initial_load = 'N'.
    PERFORM recalculate_overall_total.
  ENDIF.

  IF change_btn_clicked_400 EQ 0 AND add_btn_clicked_400 EQ 0
      AND delete_btn_clicked_400 EQ 0.
    IF initial_load EQ 'Y'.
      CLEAR: chkapplyall, chkdiscall, custmat, maktg,matnonew,qtynew, stprs, txtmsgs, sgstnew, cgstnew, igstnew, deldatenew, unit, basicamt, totalnew,kbetrnew, itemnobot, zzprdat,zzmfg_cdate ,zzrepeat, werks, lgort.
      initial_load = 'N'.
      PERFORM set_initial_values_of_header.
      PERFORM set_initial_values_of_items.
      PERFORM set_list_values.
    ENDIF.
    "PERFORM CLEAR_ITEM_VALUES.
  ENDIF.

  IF add_btn_clicked_400 EQ 1.
    "  PERFORM CLEAR_VALUES.
  ENDIF.

  IF save_btn_clicked_400 EQ 1.
    " PERFORM set_initial_values_400.
  ENDIF.

  IF change_btn_clicked_400 EQ 1.
    " PERFORM SET_VALUES_CHANGED_CLICKED.
  ENDIF.


  IF cust_items IS INITIAL.

    CREATE OBJECT cust_items
      EXPORTING
        container_name = 'CUST_ITEMS'.


    CREATE OBJECT grid_list
      EXPORTING
        i_parent = cust_items.


    CALL METHOD grid_list-&amp;gt;set_table_for_first_display
      EXPORTING
*       i_buffer_active               =
*       i_bypassing_buffer            =
*       i_consistency_check           =
*       i_structure_name              =
*       is_variant                    =
*       i_save                        =
*       i_default                     = 'x'
        is_layout                     = is_layout_list
*       is_print                      =
*       it_special_groups             =
*       it_toolbar_excluding          =
*       it_hyperlink                  =
*       it_alv_graphics               =
*       it_except_qinfo               =
*       ir_salv_adapter               =
      CHANGING
        it_outtab                     = it_ybapi_item_rpa[]
        it_fieldcatalog               = it_fldcat_list[]
*       it_sort                       =
*       it_filter                     =
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    CALL METHOD grid_list-&amp;gt;refresh_table_display.

  ELSE.
    CALL METHOD grid_list-&amp;gt;refresh_table_display.
  ENDIF.
ENDMODULE.&lt;/LI-CODE&gt;&lt;P&gt;Your help is appreciated in this.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;PD&lt;/P&gt;</description>
    <pubDate>Sat, 21 Sep 2024 04:49:30 GMT</pubDate>
    <dc:creator>saurabh_shukla4</dc:creator>
    <dc:date>2024-09-21T04:49:30Z</dc:date>
    <item>
      <title>ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaq-p/13859546</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp; I have a program (dialog program - scr 400) screen and button on the screen. It's calling another program (+ transaction) having selection screen and after execution ALV grid displayed. After performing work it should back to original calling screen having dialog program screen (400).&lt;/P&gt;&lt;P&gt;ZPROGRAM1 (Screen 400) -&amp;gt; Call Transaction - ZPROGRAM2 (+selection screen) -&amp;gt; ALV screen and then back with same sequence.&lt;/P&gt;&lt;P&gt;We have tried with, AT SELECTION SCREEN EXIT-COMMAND and leave 0 or set screen 0 but somehow it is not working. CALL SCREEN will not work since it back button is in another program which is called.&lt;/P&gt;&lt;P&gt;How to call previous screens which are in call stack.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;PD&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 03:34:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaq-p/13859546</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-10T03:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13859652#M4882632</link>
      <description>What is your issue? Leaving the ALV screen and go back to the selection screen? Leaving the selection screen? Then post the relevant code. No need to mix your question with Web Dynpro and CALL TRANSACTION.</description>
      <pubDate>Mon, 09 Sep 2024 12:50:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13859652#M4882632</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-09-09T12:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13860191#M4882726</link>
      <description>&lt;P&gt;Sorry for the wrong tag.&lt;/P&gt;&lt;P&gt;I want to leave selection screen and go back to the calling program screen (dialog programming). At present it is exiting the program.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 03:33:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13860191#M4882726</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-10T03:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13860367#M4882772</link>
      <description>Normally the calling program continues after "call transaction". Maybe you have some additional code there which stops the program. Let us know your code around this call.</description>
      <pubDate>Tue, 10 Sep 2024 06:58:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13860367#M4882772</guid>
      <dc:creator>ulrich_mhrke</dc:creator>
      <dc:date>2024-09-10T06:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13861569#M4882920</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/710015"&gt;@ulrich_mhrke&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our code in ZPROG1 (having total 4 screens 100-&amp;gt;200-&amp;gt;300-&amp;gt;400) from calling dialog programming module (at Screen no.400) on button click sy-ucomm case:&lt;/P&gt;&lt;P&gt;PAI module:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;CALL TRANSACTION 'ZTRANS'  "AND SKIP FIRST SCREEN. "same is the program name ZTRANS&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In ZTRANS program, there is selection screen and after executing selection screen thee is ALV display. This is working fine. After back from ALV, it is again coming back to Selection screen of ZTRANS. After this if we back to ZTRANS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;AT SELECTION-SCREEN.
CASE sscrfields-ucomm.
WHEN 'PF01'.  "back or exit button FCODE
  SET SCREEN 0.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is exiting from ZTRANS program (transaction) totally and not coming back to original calling screen of ZPROG1 (400).&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we use, leave to screen 400, it will not find screen since both are different programs. If we do call transaction ZPROG1 then it is calling transaction 100 screen no which is starting. But, we want to come back to 400 (screen).&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;&lt;P&gt;PD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 01:02:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13861569#M4882920</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-11T01:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13861900#M4882990</link>
      <description>Please send the whole flow logic of screen 400 of program ZPROG1 and the whole PAI module where you call transaction ZTRANS.</description>
      <pubDate>Wed, 11 Sep 2024 07:36:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13861900#M4882990</guid>
      <dc:creator>ulrich_mhrke</dc:creator>
      <dc:date>2024-09-11T07:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13861903#M4882991</link>
      <description>Look at the Attributes of screen 400 of program ZPROG1. Maybe the "Next Screen" is set to 0 (empty in change mode).</description>
      <pubDate>Wed, 11 Sep 2024 07:39:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13861903#M4882991</guid>
      <dc:creator>ulrich_mhrke</dc:creator>
      <dc:date>2024-09-11T07:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13862223#M4883036</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/710015"&gt;@ulrich_mhrke&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code of PAI of ZPROG1 (Screen 400)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;MODULE user_command_0400 INPUT.
 CASE sy-ucomm.
    WHEN 'NEWMAT'.
      "test run
      SET PARAMETER ID 'OPTION' FIELD 'MAT'.
      CALL TRANSACTION 'ZTRANS'.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is calling selection screen of ZTRANS transaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERS : cust  RADIOBUTTON GROUP g1 DEFAULT 'X'  USER-COMMAND cmd  MODIF ID upd,&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and some more parameters at selection screen.&lt;BR /&gt;Once selection screen is executed it is calling ALV grid using&amp;nbsp;REUSE_ALV_GRID_DISPLAY function. Once grid is displayed and back is pressed then it again comes back to selection screen of ZTRANS. From here, if we press back, then it exits the transaction and not going back to screen 400 of ZPROG1.&lt;BR /&gt;We have tried to use&amp;nbsp;&lt;!--  StartFragment   --&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;AT&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;SELECTION-SCREEN&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;ON&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;EXIT&lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;COMMAND&lt;SPAN class=""&gt;. Also under ZTRANS program and in that we tried to use SET SCREEN 0 or CALL TRANSACTION (of 400 screen) but it's not going back to screen 400.&lt;BR /&gt;&lt;BR /&gt;About your second question, attribute of screen 400 (next screen) is set to 400 and it is not empty.&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 10:28:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13862223#M4883036</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-11T10:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13862229#M4883038</link>
      <description>Please don't post an answer for comments, additional details. Answer is reserved to propose a solution. Instead, use Replies &amp;gt; Comment (on the question or on a proposed answer).</description>
      <pubDate>Wed, 11 Sep 2024 10:35:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13862229#M4883038</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-09-11T10:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13862272#M4883054</link>
      <description>Please send the WHOLE flow logic of screen 400 of program ZPROG1 and the WHOLE PAI module where you call transaction ZTRANS. You will find the flow logic at screen definition. It should start with "PROCESS BEFORE OUTPUT". The code of the module starts with "MODULE ... INPUT." and ends with "ENDMODULE."</description>
      <pubDate>Wed, 11 Sep 2024 11:10:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13862272#M4883054</guid>
      <dc:creator>ulrich_mhrke</dc:creator>
      <dc:date>2024-09-11T11:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13863075#M4883171</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/710015"&gt;@ulrich_mhrke&lt;/a&gt;&lt;/P&gt;&lt;P&gt;This is screen flow logic:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;PROCESS BEFORE OUTPUT.
  MODULE status_0400.

PROCESS AFTER INPUT.
  MODULE user_command_0400.


PROCESS ON VALUE-REQUEST.&lt;/LI-CODE&gt;&lt;P&gt;And for Module user_command_400.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt; CASE sy-ucomm.
    WHEN 'NEWMAT'.
      "test run
      SET PARAMETER ID 'OPTION' FIELD 'MAT'.
      CALL TRANSACTION 'ZTRANS'.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;NEWMAT is function key declared for the button on screen 400.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2024 03:18:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13863075#M4883171</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-12T03:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13864550#M4883427</link>
      <description>For some reason you don't want to give us the whole code of module user_command_400. Maybe you can add an info message direct after the call screen (message 'Some text.' type 'I'.). Do you see this message after returning from the called transaction?</description>
      <pubDate>Fri, 13 Sep 2024 05:00:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13864550#M4883427</guid>
      <dc:creator>ulrich_mhrke</dc:creator>
      <dc:date>2024-09-13T05:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13864874#M4883479</link>
      <description>&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/416099"&gt;@saurabh_shukla4&lt;/a&gt; A simple way to discuss efficiently is to create a small test program to reproduce the issue and post it (of course, sharing via a Git repository is the best way when it concerns non-ABAP objects like Dynpro, these objects can be uploaded/downloaded in an instant via abapGit).</description>
      <pubDate>Fri, 13 Sep 2024 08:10:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13864874#M4883479</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-09-13T08:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13866268#M4883719</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/710015"&gt;@ulrich_mhrke&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Please find screenshots of the development:&lt;/P&gt;&lt;P&gt;Screen 400: PAI&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img1_400.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/166663iB7779AE522E5707E/image-dimensions/492x263?v=v2" alt="img1_400.png" title="img1_400.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;PAI User-command:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="400_attribute.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/166664iCCE0D9335E6048A2/image-dimensions/560x312?v=v2" alt="400_attribute.png" title="400_attribute.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Screen 400 Attribute&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="400_pai.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/166666i5A7B1D5FA3302336/image-dimensions/411x139?v=v2" alt="400_pai.png" title="400_pai.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Call Transaction (ZUPLOADRPA) - previously ZTRANS now name has changed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="selection_screen.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/166667iE8C5926C5AC4D0CB/image-dimensions/537x439?v=v2" alt="selection_screen.png" title="selection_screen.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Called transaction selection screen attribute.&lt;/P&gt;&lt;P&gt;As mentioned, the selection screen of another program&amp;nbsp;ZUPLOADRPA (old name - ZTRANS) is getting called successfully and also ALV grid further. Back from ALV grid is also working to selection screen. But after selection screen the program is not returning to 400 transaction screen&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 02:02:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13866268#M4883719</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-16T02:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13866393#M4883746</link>
      <description>Why I asked for the whole code of the module?: Also in your picture we can not see if there is some more code between "ENDCASE." and "ENDMODULE."</description>
      <pubDate>Mon, 16 Sep 2024 05:35:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13866393#M4883746</guid>
      <dc:creator>ulrich_mhrke</dc:creator>
      <dc:date>2024-09-16T05:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13872873#M4884847</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/710015"&gt;@ulrich_mhrke&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Hi, sorry for the late reply, I am not hesitating to share the code as only this much code is available. I will try more to add as below:&lt;BR /&gt;Screen 400 flow logic:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;PROCESS BEFORE OUTPUT.
  MODULE status_0400.

PROCESS AFTER INPUT.
  MODULE user_command_0400.


PROCESS ON VALUE-REQUEST.
  "  FIELD SOLDTONEW MODULE SOLDTO_F4.
  " FIELD SHIPTONEW MODULE SHIPTO_F4.
  "  FIELD CURRENCYNEW MODULE CURRENCYNEW_F4.
  " FIELD MATNONEW MODULE MATNONEW_F4.
  " FIELD stprs MODULE unitc0st_f4.&lt;/LI-CODE&gt;&lt;P&gt;Below is user-command module for screen 400:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;MODULE user_command_0400 INPUT.

  SELECT SINGLE bezei INTO @DATA(wa_bezei) FROM tinct WHERE inco1 = @inco1 AND spras EQ @sy-langu.
  IF sy-subrc EQ 0.
    inco2 = wa_bezei.
  ENDIF.

  SELECT SINGLE name1 FROM kna1 INTO @DATA(name1) WHERE kunnr = @soldtonew.
  IF sy-subrc EQ 0.
    soldto = name1.
  ENDIF.
  CLEAR name1.
  SELECT SINGLE name1 FROM kna1 INTO @name1 WHERE kunnr = @shiptonew.
  IF sy-subrc EQ 0.
    shipto = name1.
    CLEAR name1.
  ENDIF.
  SELECT SINGLE maktg FROM makt INTO @DATA(maktg_v) WHERE matnr = @matnonew.
  IF sy-subrc EQ 0.
    maktg = maktg_v.
    CLEAR maktg_v.
  ENDIF.

  unit = unit.

  "SELECT SINGLE vkorg, vtweg, spart FROM knvv INTO @DATA(wa_knvv) WHERE kunnr = @soldtonew.
  "IF sy-subrc EQ 0.
  " vkorg = wa_knvv-vkorg.
  "vtweg = wa_knvv-vtweg.
  "spart = wa_knvv-spart.
  "CLEAR wa_knvv.
  "ENDIF.

*  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
*    EXPORTING
*      input  = matnonew
*    IMPORTING
*      output = matnonew.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = soldtonew
    IMPORTING
      output = soldtonew.

  REFRESH: t_a005[], lt_konp[].

  SELECT * FROM a005 INTO TABLE t_a005 WHERE kappl =  'V' AND kschl =  'ZPR1' AND vkorg = vkorg AND vtweg = vtweg AND kunnr = soldtonew AND matnr = matnonew  AND datbi &amp;gt;= sy-datum.
  IF sy-subrc = 0.
    SELECT knumh kopos kschl kbetr konwa kpein kmein krech loevm_ko mwsk1 kznep stfkz kzbzg
      FROM konp APPENDING TABLE lt_konp
      FOR ALL ENTRIES IN t_a005 WHERE
      knumh = t_a005-knumh AND
      kschl = t_a005-kschl.
    IF sy-subrc = 0.
      LOOP AT lt_konp INTO ls_konp.
        unit = ls_konp-kbetr.
        EXIT.
      ENDLOOP.
    ENDIF.
  ELSE.

    DATA matnonew_1 TYPE mara-matnr.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input  = matnonew
      IMPORTING
        output = matnonew_1.


    SELECT * FROM a005 INTO TABLE t_a005 WHERE kappl =  'V' AND kschl =  'ZPR1' AND vkorg = vkorg AND vtweg = vtweg AND kunnr = soldtonew AND matnr = matnonew_1  AND datbi &amp;gt;= sy-datum.
    IF sy-subrc = 0.
      SELECT knumh kopos kschl kbetr konwa kpein kmein krech loevm_ko mwsk1 kznep stfkz kzbzg
    FROM konp APPENDING TABLE lt_konp
    FOR ALL ENTRIES IN t_a005 WHERE
    knumh = t_a005-knumh AND
    kschl = t_a005-kschl.
      IF sy-subrc = 0.
        LOOP AT lt_konp INTO ls_konp.
          unit = ls_konp-kbetr.
          EXIT.
        ENDLOOP.
      ENDIF.
    ENDIF.
  ENDIF.


  CASE sy-ucomm.
    WHEN 'FNEXIT'.
      PERFORM exit_screen_400.
    WHEN 'FNADD'.
      add_btn_clicked_400 = 1.
      save_btn_clicked_400 = 0.
      change_btn_clicked_400 = 0.
      delete_btn_clicked_400 = 0.
      PERFORM add_item_400.
    WHEN 'FNCHANGE'.
      add_btn_clicked_400 = 0.
      change_btn_clicked_400 = 1.
      delete_btn_clicked_400 = 0.
      save_btn_clicked_400 = 0.
      PERFORM change_item_400.
    WHEN 'FNSAVE'.
      save_btn_clicked_400 = 1.
      add_btn_clicked_400 = 0.
      change_btn_clicked_400 = 0.
      delete_btn_clicked_400 = 0.
      PERFORM save_orders_so.
    WHEN 'FNACCEPT'.
      PERFORM accept_item_changes_400.
    WHEN 'FNDELETE'.
      save_btn_clicked_400 = 0.
      add_btn_clicked_400 = 0.
      change_btn_clicked_400 = 0.
      delete_btn_clicked_400 = 1.
      PERFORM delete_item_400.
    WHEN 'FNCALC'.
      PERFORM calculate_sub_total.
    WHEN 'FNVERIFY'.
      "test run
      wa_testrun = 'X'.
      PERFORM prepare_bapi_data.
    WHEN 'FNPOST'.
      "test run
      CLEAR wa_testrun.
      PERFORM prepare_bapi_data.
    WHEN 'NEWMAT'.
      "test run
      SET PARAMETER ID 'OPTION' FIELD 'MAT'.
      CALL TRANSACTION 'ZUPLOADRPA'.
    WHEN 'NEWCUST'.
      SET PARAMETER ID 'OPTION' FIELD 'CUST'.
      CALL TRANSACTION 'ZUPLOADRPA' AND SKIP FIRST SCREEN.
      "SUBMIT ZUPLOADRPA VIA SELECTION-SCREEN AND RETURN.
  ENDCASE.
ENDMODULE.&lt;/LI-CODE&gt;&lt;P&gt;When NEWMAT is being clicked (which is button on screen 400) the transaction ZUPLOADRPA is called. The program and transaction names are same.&lt;/P&gt;&lt;P&gt;Now at ZUPLOADRPA below is the selection screen.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERS : cust     RADIOBUTTON GROUP g1 DEFAULT 'X'  USER-COMMAND cmd  MODIF ID upd,
             vend     RADIOBUTTON GROUP g1 MODIF ID up1,
             mat      RADIOBUTTON GROUP g1 MODIF ID upm,
             raw      RADIOBUTTON GROUP g1 MODIF ID up1,
             halb     RADIOBUTTON GROUP g1 MODIF ID up1,

             bom      RADIOBUTTON GROUP g1  MODIF ID bom,
             altbom   RADIOBUTTON GROUP g1 MODIF ID bpd,
             exbom    RADIOBUTTON GROUP g1 MODIF ID bpd,
             moda     TYPE ctu_params-dismode OBLIGATORY DEFAULT 'A' MODIF ID bpd,

             routing  RADIOBUTTON GROUP g1 MODIF ID rot,
             altrot   RADIOBUTTON GROUP g1 MODIF ID rpd,
             exrot    RADIOBUTTON GROUP g1 MODIF ID rpd,


             hibe     RADIOBUTTON GROUP g1 MODIF ID up1,
             hawa     RADIOBUTTON GROUP g1 MODIF ID up1,
             vcust    RADIOBUTTON GROUP g1 MODIF ID up1,
             nlag     RADIOBUTTON GROUP g1 MODIF ID up1,
             rawext   RADIOBUTTON GROUP g1 MODIF ID up1,
             fertdesc TYPE zfertdesc MODIF ID upm.
*PARAMETERS : mod1 TYPE ctu_params-dismode DEFAULT 'A' OBLIGATORY  MODIF ID upd.
SELECTION-SCREEN END OF BLOCK b1.


AT SELECTION-SCREEN ON EXIT-COMMAND.

  "LEAVE to SCREEN 100.&lt;/LI-CODE&gt;&lt;P&gt;The selection screen execution will display ALV grid as below:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt; CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_buffer_active          = space
        i_callback_program       = sy-repid
        i_callback_pf_status_set = 'SET_PF_STATUS'
        i_callback_user_command  = 'CUST_USER_COMMAND'
        it_fieldcat              = t_field[]
        is_layout                = gd_layout
        i_save                   = 'A'
        i_default                = 'X'
      TABLES
        t_outtab                 = it_cust
      EXCEPTIONS
        program_error            = 1
        OTHERS                   = 2.
  &lt;/LI-CODE&gt;&lt;P&gt;And at ALV grid user command module below is the code for back button PF1:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;  ELSEIF ( ( sy-ucomm = 'PF1' ) OR ( sy-ucomm = 'PF2' ) OR ( sy-ucomm = 'PF3' ) ).
    LEAVE TO CURRENT TRANSACTION.
  ENDIF.&lt;/LI-CODE&gt;&lt;P&gt;From here, back is pressed and the screen flow comes back to selection screen again.&lt;/P&gt;&lt;P&gt;But, after selection screen, and pressing back button at selection screen it is ending the transaction and not going back to the calling screen i.e. 400 PBO. Below is the 400 screen PBO:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;ODULE status_0400 OUTPUT.
  SET PF-STATUS 'ZSCRPF_400'.
  SET TITLEBAR 'ZSCRT_400'.

  GET PARAMETER ID 'FILENAME' FIELD filename.

  PERFORM set_layout_list.
  IF initial_load = 'N'.
    PERFORM recalculate_overall_total.
  ENDIF.

  IF change_btn_clicked_400 EQ 0 AND add_btn_clicked_400 EQ 0
      AND delete_btn_clicked_400 EQ 0.
    IF initial_load EQ 'Y'.
      CLEAR: chkapplyall, chkdiscall, custmat, maktg,matnonew,qtynew, stprs, txtmsgs, sgstnew, cgstnew, igstnew, deldatenew, unit, basicamt, totalnew,kbetrnew, itemnobot, zzprdat,zzmfg_cdate ,zzrepeat, werks, lgort.
      initial_load = 'N'.
      PERFORM set_initial_values_of_header.
      PERFORM set_initial_values_of_items.
      PERFORM set_list_values.
    ENDIF.
    "PERFORM CLEAR_ITEM_VALUES.
  ENDIF.

  IF add_btn_clicked_400 EQ 1.
    "  PERFORM CLEAR_VALUES.
  ENDIF.

  IF save_btn_clicked_400 EQ 1.
    " PERFORM set_initial_values_400.
  ENDIF.

  IF change_btn_clicked_400 EQ 1.
    " PERFORM SET_VALUES_CHANGED_CLICKED.
  ENDIF.


  IF cust_items IS INITIAL.

    CREATE OBJECT cust_items
      EXPORTING
        container_name = 'CUST_ITEMS'.


    CREATE OBJECT grid_list
      EXPORTING
        i_parent = cust_items.


    CALL METHOD grid_list-&amp;gt;set_table_for_first_display
      EXPORTING
*       i_buffer_active               =
*       i_bypassing_buffer            =
*       i_consistency_check           =
*       i_structure_name              =
*       is_variant                    =
*       i_save                        =
*       i_default                     = 'x'
        is_layout                     = is_layout_list
*       is_print                      =
*       it_special_groups             =
*       it_toolbar_excluding          =
*       it_hyperlink                  =
*       it_alv_graphics               =
*       it_except_qinfo               =
*       ir_salv_adapter               =
      CHANGING
        it_outtab                     = it_ybapi_item_rpa[]
        it_fieldcatalog               = it_fldcat_list[]
*       it_sort                       =
*       it_filter                     =
      EXCEPTIONS
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        OTHERS                        = 4.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    CALL METHOD grid_list-&amp;gt;refresh_table_display.

  ELSE.
    CALL METHOD grid_list-&amp;gt;refresh_table_display.
  ENDIF.
ENDMODULE.&lt;/LI-CODE&gt;&lt;P&gt;Your help is appreciated in this.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;PD&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 04:49:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13872873#M4884847</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-21T04:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13872950#M4884852</link>
      <description>&lt;P&gt;Your issue is because you leave ZPROGRAM2 (which you call using Call Transaction) by using LEAVE TO CURRENT TRANSACTION. You don't return to ZPROGRAM1. It happens like if you had started only ZPROGRAM2 without using ZPROGRAM1.&lt;/P&gt;&lt;P&gt;So, in short, this is what happens after you call ZPROGRAM1 from the SAP menu (via a transaction code):&lt;/P&gt;&lt;P&gt;ZPROGRAM1&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;ZPROGRAM1 (Screen 400)&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;In PAI, a normal button does Call Transaction (which calls ZPROGRAM2). A breakpoint is defined after Call Transaction, you don't stop at it when leaving ZPROGRAM2 and your question is why?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;ZPROGRAM2&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Selection screen. You press the standard Execute.&lt;/LI&gt;&lt;LI&gt;In START-OF-SELECTION (or&amp;nbsp;AT SELECTION-SCREEN?) there is a CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' which displays a screen with ALV.&lt;/LI&gt;&lt;LI&gt;You press Back in the ALV Grid screen, it calls the subroutine defined for the USER_COMMAND event of the ALV Grid, you execute LEAVE TO CURRENT TRANSACTION, which makes you go back to the selection screen.&lt;/LI&gt;&lt;LI&gt;NB: there is no stop at the breakpoint after&amp;nbsp;REUSE_ALV_GRID_DISPLAY.&amp;nbsp;LEAVE TO CURRENT TRANSACTION restarts the program ZPROGRAM2.&lt;/LI&gt;&lt;LI&gt;You then press back in the selection screen, and you go back to the SAP menu instead of ZPROGRAM1.&lt;/LI&gt;&lt;LI&gt;Why?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The ABAP documentation of &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapleave_to_transaction.htm" target="_self"&gt;LEAVE TO CURRENT TRANSACTION&lt;/A&gt; says:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;If CURRENT TRANSACTION is specified, the current transaction is called using the transaction code&amp;nbsp;that was used to call the transaction using CALL TRANSACTION [...] When the transaction is called, the ABAP program associated with the transaction code is loaded in a new internal session. &lt;STRONG&gt;All previous internal sessions are deleted from the stack.&lt;/STRONG&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If you read the chapter about internal sessions, you can see that there's a new internal session each time there is a Call Transaction or Submit And Return, so it means&amp;nbsp;that both programs ZPROGRAM1 and ZPROGRAM2 are terminated, and then the transaction of ZPROGRAM2 is restarted.&lt;/P&gt;&lt;P&gt;Solution: instead of LEAVE TO CURRENT TRANSACTION, you have a parameter RS_SELFIELD in the subroutine of the ALV event USER_COMMAND, which you can change, it contains several possible actions like EXIT to exit the screen and go back to after REUSE_ALV_GRID_DISPLAY instead of restarting the whole program.&lt;/P&gt;&lt;P&gt;Your current code:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;FORM user_command
      USING
        R_UCOMM     LIKE SY-UCOMM
        RS_SELFIELD TYPE SLIS_SELFIELD.
  CASE r_ucomm.
    WHEN 'EXIT'.
      LEAVE TO CURRENT TRANSACTION. " &amp;lt;====== Very bad idea
  ENDCASE.
ENDFORM.&lt;/LI-CODE&gt;&lt;P&gt;Instead of LEAVE TO CURRENT TRANSACTION, just do:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;  CASE r_ucomm.
    WHEN 'EXIT'.
      rs_selfield-exit = 'X'. " or use = abap_true
  ENDCASE.&lt;/LI-CODE&gt;&lt;P&gt;You will see that you stop at the breakpoint after CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.&lt;/P&gt;&lt;P&gt;PS: to better understand what was happening, you can see the effect of LEAVE TO CURRENT TRANSACTION on the call stack by activating the debug option "cross roll area stack". You will see in the call stack the numbers of the internal sessions, that the first time ZPROGRAM2 is at the level 2 (and ZPROGRAM1 is at the level 1), and after LEAVE TO CURRENT TRANSACTION you only see ZPROGRAM2 at the level 1. ZPROGRAM1 has vanished.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 07:32:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13872950#M4884852</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-09-21T07:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13873908#M4884992</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/145194"&gt;@Sandra_Rossi&lt;/a&gt;&amp;nbsp;I tried this change. However, Getting back from ALV to Selection is not a problem. From Selection screen of (ZSOUPLOAD) program to back to calling program is main issue. From selection screen (ZSOUPLOAD -1000 screen no) back to calling program (screen 400) is not working.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 08:45:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13873908#M4884992</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-23T08:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13873997#M4885009</link>
      <description>You didn't understand. You have to fix the code when leaving the ALV (LEAVE TO CURRENT TRANSACTION), to solve the problem when you're leaving the selection screen. Please try the code and debug as I explained, you will understand.</description>
      <pubDate>Mon, 23 Sep 2024 09:35:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13873997#M4885009</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2024-09-23T09:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Calling last calling program in the stack</title>
      <link>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13874381#M4885053</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/710015"&gt;@ulrich_mhrke&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Yes you are right. I did check that and I have to add some code to come back to calling screen 400. Can you provide some tips/ help to go back to the screen? I have sequences of screens where output of the screen is based on selection of previous screen. So, It's challenging to jump directly on the screen. I do not want user to traverse again through screens 100, 200, 300 and again 400. I directly want user to land at screen 400 where he left off before.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 13:57:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abap-calling-last-calling-program-in-the-stack/qaa-p/13874381#M4885053</guid>
      <dc:creator>saurabh_shukla4</dc:creator>
      <dc:date>2024-09-23T13:57:47Z</dc:date>
    </item>
  </channel>
</rss>

