cancel
Showing results for 
Search instead for 
Did you mean: 

3 ALV on a single screen.

Former Member
0 Kudos

Hi,

I need to display 3 alv on a single screen.

There is a FM called 'REUSE_ALV_BLOCK_LIST_APPEND' which can do it but in the documentation its advised not to use it,since it has still not been released.

Is there some other way to display 3 alvs on a screen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hai chitrantan,

check out whether this satisfies your condition.

EXAMPLE:

DEFINE m_fieldcat.

ls_fieldcat-fieldname = &1.

ls_fieldcat-ref_tabname = &2.

append ls_fieldcat to lt_fieldcat.

END-OF-DEFINITION.

DEFINE m_sort.

ls_sort-fieldname = &1.

ls_sort-up = 'X'.

append ls_sort to lt_sort.

END-OF-DEFINITION.

TYPE-POOLS: slis. " ALV Global types

SELECTION-SCREEN :

SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max. "#EC NEEDED

PARAMETERS p_max(2) TYPE n DEFAULT '02' OBLIGATORY.

SELECTION-SCREEN END OF LINE.

DATA:

gs_layout TYPE slis_layout_alv,

  • 1st Table

BEGIN OF gt_kna1 OCCURS 0, " Data displayed

kunnr LIKE kna1-kunnr, " Customer number

ernam LIKE kna1-ernam, " Name of Person who Created

erdat LIKE kna1-erdat, " Creation date

name1 LIKE kna1-name1, " Name 1

END OF gt_kna1,

  • 2nd Table

BEGIN OF gt_mara OCCURS 0,

ernam LIKE mara-ernam, " Name of Person who Created

matnr LIKE mara-matnr, " Material number

ersda LIKE mara-ersda, " Creation date

brgew LIKE mara-brgew, " Gross weight

END OF gt_mara,

  • 3rd Table

BEGIN OF gt_vbak OCCURS 0,

vkorg LIKE vbak-vkorg, " Sales organization

kunnr LIKE vbak-kunnr, " Sold-to party

vbeln LIKE vbak-vbeln, " Sales document

netwr LIKE vbak-netwr, " Net Value of the Sales Order

waerk LIKE vbak-waerk, " SD document currency

END OF gt_vbak.

----


INITIALIZATION.

v_1 = 'Maximum of records to read'.

----


START-OF-SELECTION.

  • Read data

SELECT * FROM kna1

UP TO p_max ROWS

INTO CORRESPONDING FIELDS OF TABLE gt_kna1.

SELECT * FROM mara

UP TO p_max ROWS

INTO CORRESPONDING FIELDS OF TABLE gt_mara.

SELECT * FROM vbak

UP TO p_max ROWS

INTO CORRESPONDING FIELDS OF TABLE gt_vbak.

PERFORM f_display_data.

----


  • FORM USER_COMMAND *

----


FORM user_command USING i_ucomm LIKE sy-ucomm

is_selfield TYPE slis_selfield. "#EC CALLED

CASE i_ucomm.

WHEN '&IC1'. " Pick

CASE is_selfield-sel_tab_field(7).

WHEN 'GT_MARA'.

WHEN 'GT_KNA1'.

WHEN 'GT_VBAK'.

READ TABLE gt_vbak INDEX is_selfield-tabindex.

IF sy-subrc EQ 0.

SET PARAMETER ID 'AUN' FIELD gt_vbak-vbeln.

CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDCASE.

ENDFORM. " USER_COMMAND

----


  • Form f_display_data

----


FORM f_display_data.

DATA :

ls_fieldcat TYPE slis_fieldcat_alv,

lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog

ls_sort TYPE slis_sortinfo_alv,

lt_sort TYPE slis_t_sortinfo_alv, " Sort table

lt_events TYPE slis_t_event,

ls_event TYPE slis_alv_event.

gs_layout-group_change_edit = 'X'.

gs_layout-colwidth_optimize = 'X'.

gs_layout-zebra = 'X'.

gs_layout-detail_popup = 'X'.

gs_layout-get_selinfos = 'X'.

  • Build field catalog and sort table

m_fieldcat 'KUNNR' 'KNA1'.

m_fieldcat 'ERNAM' 'KNA1'.

m_fieldcat 'ERDAT' 'KNA1'.

m_fieldcat 'NAME1' 'KNA1'.

m_sort 'KUNNR'.

  • Build Event Table

MOVE 'TOP_OF_PAGE' TO ls_event-name.

MOVE 'TOP_OF_PAGE' TO ls_event-form.

APPEND ls_event TO lt_events.

MOVE 'END_OF_LIST' TO ls_event-name.

MOVE 'END_OF_LIST' TO ls_event-form.

APPEND ls_event TO lt_events.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND'

it_fieldcat = lt_fieldcat

is_layout = gs_layout

it_events = lt_events

it_sort = lt_sort

TABLES

t_outtab = gt_kna1.

ENDFORM. " F_DISPLAY_DATA

----


  • FORM top_of_page *

----


FORM top_of_page. "#EC CALLED

ULINE.

WRITE : sy-uname, sy-title(56) CENTERED, sy-datum.

ULINE.

ENDFORM. " TOP_OF_PAGE

----


  • FORM End_of_list *

----


FORM end_of_list. "#EC CALLED

DATA :

ls_fieldcat TYPE slis_fieldcat_alv,

lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog

ls_sort TYPE slis_sortinfo_alv,

lt_sort TYPE slis_t_sortinfo_alv, " Sort table

lt_events TYPE slis_t_event,

ls_event TYPE slis_alv_event.

  • Build field catalog and sort table

m_fieldcat 'MATNR' 'MARA'.

m_fieldcat 'ERNAM' 'MARA'.

m_fieldcat 'ERSDA' 'MARA'.

m_fieldcat 'BRGEW' 'MARA'.

m_sort 'MATNR'.

  • Build Event Table

MOVE 'END_OF_LIST' TO ls_event-name.

MOVE 'END_OF_LIST_2' TO ls_event-form.

APPEND ls_event TO lt_events.

gs_layout-list_append = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

it_fieldcat = lt_fieldcat

is_layout = gs_layout

it_sort = lt_sort

it_events = lt_events

TABLES

t_outtab = gt_mara.

ENDFORM. " END_OF_LIST

----


  • FORM End_of_list_2 *

----


FORM end_of_list_2. "#EC CALLED

DATA :

ls_fieldcat TYPE slis_fieldcat_alv,

lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog

ls_sort TYPE slis_sortinfo_alv,

lt_sort TYPE slis_t_sortinfo_alv, " Sort table

lt_events TYPE slis_t_event,

ls_event TYPE slis_alv_event.

  • Build field catalog and sort table

m_fieldcat 'VBELN' 'VBAK'.

m_fieldcat 'VKORG' 'VBAK'.

m_fieldcat 'KUNNR' 'VBAK'.

m_fieldcat 'NETWR' 'VBAK'.

m_fieldcat 'WAERK' 'VBAK'.

m_sort 'VBELN'.

  • Build Event Table

MOVE 'TOP_OF_PAGE' TO ls_event-name.

MOVE 'TOP_OF_PAGE' TO ls_event-form.

APPEND ls_event TO lt_events.

gs_layout-list_append = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = sy-cprog

it_fieldcat = lt_fieldcat

is_layout = gs_layout

it_sort = lt_sort

it_events = lt_events

TABLES

t_outtab = gt_vbak.

ENDFORM.

HOPE THIS IS HELPFUL.

regards,

praba.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Chirantan,

There is a solution of doing this in split custom container.

you just have to define three custom controls on a screen.

here are a few lines of code for the same.


** assuming we have 3 custom controls on the screen

data : gref_docking_container TYPE REF TO cl_gui_custom_container,
g_alv1 TYPE REF TO cl_gui_alv_grid,
g_alv2 TYPE REF TO cl_gui_alv_grid,
g_alv3 TYPE REF TO cl_gui_alv_grid.

  create object gref_docking_container
       exporting
         container_name = 'CCAREA_ALV1'.

  create object g_alv1
     exporting i_parent = GREF_DOCKING_CONTAINER.

  create object gref_docking_container
       exporting
         container_name = 'CCAREA_ALV2'.

  create object g_alv2
     exporting i_parent = GREF_DOCKING_CONTAINER.

  create object gref_docking_container
       exporting
         container_name = 'CCAREA_ALV3'.

  create object g_alv3
     exporting i_parent = GREF_DOCKING_CONTAINER.

** code to fill the output internal table

  call method g_alv1->set_table_for_first_display
          exporting i_structure_name = 'STRUCTURE_DESIRED'
                    is_layout        = gs_layout
          changing  it_outtab        = gt_outtab[].

  call method g_alv2->set_table_for_first_display
          exporting i_structure_name = 'STRUCTURE_DESIRED'
                    is_layout        = gs_layout
          changing  it_outtab        = gt_outtab[].

  call method g_alv3->set_table_for_first_display
          exporting i_structure_name = 'STRUCTURE_DESIRED'
                    is_layout        = gs_layout
          changing  it_outtab        = gt_outtab[].


this will work out to be 3 ALV GRIDS.

thanks and regards,

Kinshuk Saxena

PS: reward points if you find this useful

Former Member
0 Kudos

Hi,

Did you try TABSTRIP ALV?

Here u can access the alvs on the various tabs.

Regards,

Anjali

Former Member
0 Kudos

hai,

The above example displays 3 alv's on a single screen perfectly.

Hope you got ur problem solved.

regards,

praba.

former_member188685
Active Contributor
0 Kudos

Hi,

you can use BLOCK list.

for this you need three FM's.

REUSE_ALV_BLOCK_LIST_INIT "initilaization

REUSE_ALV_BLOCK_LIST_APPEND "append need to call 3 times since 3 lists.

REUSE_ALV_BLOCK_LIST_DISPLAY "Display

Regards

Vjay

Former Member
0 Kudos

ya u can just use the block alv or split container

for that purpose..

for example just go through transaction DWDM