Adding tabstrips and listboxes to report selection screens

Within selection screens, tabstrips and listboxes may be displayed without the need of knowing or using the screen painter. This may be done using a few ABAP statements. In this recipe, we will see how tabstrips and listboxes may be added to selection screens. We will create a program that will contain a tabstrip containing two tabs, each containing a listbox representing country names. By default, we will have USA displayed on the first tab and Canada on the second.

How to do it...

For creating tabstrips and listboxes, follow the following steps:

  1. We create two Text Symbols, 001 and 002, that are to be used in the subsequent steps.
    How to do it...
  2. First, we define a selection screen 100 as the subscreen. Within the subscreen we define a block that contains a listbox. On the subscreen, we will create a listbox for country that will, by default, show US (USA) as the country. The subscreen will be shown in the first tab of the tabstrip that we will be defined in a later step.
    How to do it...
  3. Similarly, we define another subscreen 101, within which we create another parameter input displayed as a listbox having length 20. The default value we have for this listbox is CA, that is Canada. The user command code, COU2, is defined for this listbox.
    How to do it...
  4. Finally, the tabstrip (tabbed block containing two tabs) is defined. The two tabs are assigned to the subscreens 100 and 101 defined earlier.
    How to do it...
  5. For the two tabs, the system creates character fields with the same names, that is, tab1 and tab2. Within the initialization event, the tab1 and tab2 fields are assigned the texts, Tab1 and Tab2, using the text-001 and text-002 text symbols defined earlier.
    How to do it...

How it works...

The coding creates a tabstrip having two tabs with the text Tab1 and Tab2 respectively. Each tab page is assigned a subscreen that contains a listbox having country as the input field. When the user clicks on a particular tab title, the elements in that subscreen become active and are displayed. The COUNTRY field is defined using the GBLND field of the PA0002 table. We specified US as the default value for the listbox on the first tab. The text for US, that is United States, is displayed in the first tab.

How it works...

For the second tab, the country Canada is displayed by default. The user may choose the country of his coice.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.131.10