cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

using selection screen tabbed block how to bind SALV, OOAOV,ALV ??

0 Likes
835

I Want to Bind ALV to Tabbed block. any suggestion might Help me.

it is not showing in tabbed block, instead it shows in different screen if you click any other tabbed block and come back again.

I am working on an SAP ABAP report that uses a tabbed selection-screen block to display different datasets (e.g., Purchase Orders, Inbound Deliveries, Payment Details, etc.). However, when I use CL_SALV_TABLE to display an ALV report inside a tab, it opens in a new screen instead of displaying within the tabbed block.

Here is the simplified structure of my code:

  • I define selection-screen tabs with subscreens (100–112).

  • When a tab is selected, it should display an ALV report within the same tab.

  • Currently, my ALV grid opens in a new full screen, which is not the expected behavior.

I have tried:

  • Using CL_SALV_TABLE but it does not display inside the tab.

  • Creating a subscreen but struggling to integrate ALV within it.

How can I display the ALV output inside the tabbed block (not a separate screen) using CL_SALV_TABLE or CL_GUI_ALV_GRID?

Any guidance, corrections, or best practices would be greatly appreciated!

DATA: lv_lifnr   TYPE lfa1-lifnr,
      lt_po_data TYPE TABLE OF ekko,
      lt_po_item TYPE TABLE OF ekpo,
      lt_inbound TYPE TABLE OF mseg,
      lt_payment TYPE TABLE OF bseg.

DATA: lo_salv TYPE REF TO cl_salv_table.

SELECT-OPTIONS: so_vndr FOR lv_lifnr.

SELECTION-SCREEN BEGIN OF TABBED BLOCK tabs FOR 18 LINES.

  SELECTION-SCREEN: TAB (20) tab1 USER-COMMAND fc1 DEFAULT SCREEN 100,
  TAB (20) tab2 USER-COMMAND fc2 DEFAULT SCREEN 101,
  TAB (20) tab3 USER-COMMAND fc3 DEFAULT SCREEN 102,
  TAB (20) tab4 USER-COMMAND fc4 DEFAULT SCREEN 103,
  TAB (20) tab5 USER-COMMAND fc5 DEFAULT SCREEN 104,
  TAB (20) tab6 USER-COMMAND fc6 DEFAULT SCREEN 105,
  TAB (20) tab7 USER-COMMAND fc7 DEFAULT SCREEN 106,
  TAB (20) tab8 USER-COMMAND fc8 DEFAULT SCREEN 107,
  TAB (20) tab9 USER-COMMAND fc9 DEFAULT SCREEN 108,
  TAB (20) tab10 USER-COMMAND fc10 DEFAULT SCREEN 109,
  TAB (20) tab11 USER-COMMAND fc11 DEFAULT SCREEN 110,
  TAB (20) tab12 USER-COMMAND fc12 DEFAULT SCREEN 111,
  TAB (20) tab13 USER-COMMAND fc13 DEFAULT SCREEN 112.

SELECTION-SCREEN END OF BLOCK tabs.

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 101 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 101.

SELECTION-SCREEN BEGIN OF SCREEN 102 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 102.

SELECTION-SCREEN BEGIN OF SCREEN 103 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 103.

SELECTION-SCREEN BEGIN OF SCREEN 104 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 104.

SELECTION-SCREEN BEGIN OF SCREEN 105 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 105.

SELECTION-SCREEN BEGIN OF SCREEN 106 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 106.

SELECTION-SCREEN BEGIN OF SCREEN 107 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 107.

SELECTION-SCREEN BEGIN OF SCREEN 108 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 108.

SELECTION-SCREEN BEGIN OF SCREEN 109 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 109.

SELECTION-SCREEN BEGIN OF SCREEN 110 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 110.

SELECTION-SCREEN BEGIN OF SCREEN 111 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 111.

SELECTION-SCREEN BEGIN OF SCREEN 112 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 112.

INITIALIZATION.

  tab1 = 'Purchase Orders'.
  tab2 = 'Inbound Delivery'.
  tab3 = 'Payment Details'.
  tab4 = 'Vendor Master'.
  tab5 = 'Goods Receipt'.
  tab6 = 'Invoice Receipt'.
  tab7 = 'Open PO Items'.
  tab8 = 'Closed PO Items'.
  tab9 = 'PO History'.
  tab10 = 'Invoice List'.
  tab11 = 'Payment Status'.
  tab12 = 'Goods Movement'.
  tab13 = 'Supplier Evaluation'.

* Sample code to populate internal tables (would be based on logic)

*  Event handling for tab selection (user command)

AT SELECTION-SCREEN.

*AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'FC1'.  " Tab 1 - Purchase Order Details
      PERFORM display_po_data.
    WHEN 'FC2'.  " Tab 2 - Inbound Delivery
      " Add logic for Inbound Delivery
    WHEN 'FC3'.  " Tab 3 - Payment Details
      " Add logic for Payment Details
  ENDCASE.

FORM display_po_data.
*   Get Purchase Orders based on selected vendor(s)
  SELECT * FROM ekko
    INTO TABLE lt_po_data
  UP TO 30 ROWS.
  TRY.
* Create and display the salv grid
      cl_salv_table=>factory(
        IMPORTING
          r_salv_table = lo_salv
        CHANGING
          t_table      = lt_po_data ).

* Set the subscreen area for Tab 1 (Purchase Orders)
* lo_salv->get_functions( )->set_screen( 100 ).  " Set the screen for Tab 1

      lo_salv->display( ).

    CATCH cx_salv_msg INTO DATA(lx_msg).
      WRITE: / 'Error displaying Purchase Orders: ', lx_msg->get_text( ).
  ENDTRY.
ENDFORM.

 

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Likes

You would not be able to achieve this using normal selection screen "sub screen". You would need to create a module pool programming with main and sub screens created through screen painter of the program. On the newly created sub screen, you need to insert custom control. Then you can fill the custom control using ALV grid through container. You can make those sub screens as your tab strips. Check out the below link which has more specific details. Demo Program BCALV_GRID_DEMO.  

Creating an ALV Grid Control 

0 Likes
Thank you for your valuable time , I know we can Achieve Tabstrip using MPP. but the question Remains how can we achieve using Selection Tabbed Block.
ulrich_mhrke
Participant
0 Likes

Delete following code

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

SELECTION-SCREEN END OF SCREEN 100.

Create the subscreen 100 with screen painter. First only add a textfield. If this works add a custom control to the subscreen 100. Fill the custom control with your alv in process before output of screen 100.

ulrich_mhrke
Participant
0 Likes

You need to define your subscreen using the screen painter (no selection screen subscreen).

For the definition of the subscreen and creation of alv at this screen look at example program SALV_DEMO_TABLE_SIMPLE with screen 100 (attention: this is not defined as subscreen, but you need a subscreen).