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: 

keeping active tab on selection-screen after end of program

Former Member

Hi all,

We have a program which uses tabs on the selection

screen:

selection-screen begin of tabbed block tabb1 for 18

lines.

SELECTION-SCREEN TAB (31) tabs1 USER-COMMAND ucomm1

                     DEFAULT SCREEN 110.

SELECTION-SCREEN TAB (31) tabs4 USER-COMMAND ucomm4

                     DEFAULT SCREEN 140.

SELECTION-SCREEN TAB (31) tabs2 USER-COMMAND ucomm2

                     DEFAULT SCREEN 120.

SELECTION-SCREEN TAB (31) tabs3 USER-COMMAND ucomm3

                     DEFAULT SCREEN 130.

selection-screen end of block tabb1.

the active tab is determined as follows:

AT SELECTION-SCREEN.

  CASE Sy-UCOMM.

    WHEN 'UCOMM1'.

      tabb1-prog = sy-repid.

      tabb1-dynnr = 110.

      tabb1-activetab = 'UCOMM1'.

    WHEN 'UCOMM2'.

      tabb1-prog = sy-repid.

      tabb1-dynnr = 120.

      tabb1-activetab = 'UCOMM2'.

    WHEN 'UCOMM3'.

      tabb1-prog = sy-repid.

      tabb1-dynnr = 130.

      tabb1-activetab = 'UCOMM3'.

    WHEN 'UCOMM4'.

      tabb1-prog = sy-repid.

      tabb1-dynnr = 140.

      tabb1-activetab = 'UCOMM4'.

  ENDCASE.

The problem is: the user starts the program. The

program shows the first tab, tabs1, on the selection

screen in the tabbed block. The user clicks on tab

tabs2. The tab becomes active and the user fills in

some selection parameters and starts the program. After

execution of program the user presses the 'Back' button

and comes again on the selection screen. But at that

moment the previous program execution is finished and

the program has 'forgotten' which tab was chosen in the

previous run and it shows again the first tab,

so tabs1. The user would like to see tab tabs2 at that

moment and not tabs1. But since the report was in fact

finished and started again, all internal variables were

refreshed and the information on the acitve tab is

nowhere to be found...

Any idea how to make the program 'remember' the

previous active tab?

thanks in advance,

ioana

3 REPLIES 3

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

All you really need to do is export your selected subscreen and active tab to memory ID on Start-of-selection.  You can then do an import from memory in your initialization to read it back in. The following is a simplified example:

REPORT  yes_tab_sel .

TABLES: mara,

        t001w.

SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 18

LINES.

SELECTION-SCREEN TAB (31) tabs1 USER-COMMAND ucomm1

                     DEFAULT SCREEN 110.

SELECTION-SCREEN TAB (31) tabs2 USER-COMMAND ucomm2

                     DEFAULT SCREEN 120.

SELECTION-SCREEN END OF BLOCK tabb1.

SELECTION-SCREEN BEGIN OF SCREEN 110 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK bk1 WITH FRAME TITLE text-029.

SELECT-OPTIONS:

   s_matnr FOR mara-matnr MATCHCODE OBJECT mat1.

SELECTION-SCREEN END OF BLOCK bk1.

SELECTION-SCREEN END OF SCREEN 110.

SELECTION-SCREEN BEGIN OF SCREEN 120 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF BLOCK bk2 WITH FRAME TITLE text-029.

SELECT-OPTIONS:

   s_werks FOR t001w-werks.

SELECTION-SCREEN END OF BLOCK bk2.

SELECTION-SCREEN END OF SCREEN 120.

AT SELECTION-SCREEN.

  CASE sy-ucomm.

    WHEN 'UCOMM1'.

      tabb1-prog = sy-repid.

      tabb1-dynnr = 110.

      tabb1-activetab = 'UCOMM1'.

    WHEN 'UCOMM2'.

      tabb1-prog = sy-repid.

      tabb1-dynnr = 120.

      tabb1-activetab = 'UCOMM2'.

  ENDCASE.

INITIALIZATION.

  IMPORT tabb1-dynnr FROM MEMORY ID 'TabStripScreen' .

  IMPORT tabb1-activetab FROM MEMORY ID 'TabStripActive'.

START-OF-SELECTION.

  EXPORT tabb1-dynnr TO MEMORY ID 'TabStripScreen'.

  EXPORT tabb1-activetab TO MEMORY ID 'TabStripActive'.

  WRITE: / 'test'.

0 Kudos

The answer was some time ago, but the answer still helps...Thanks!

0 Kudos

Thank you for the answer.