Skip to Content
avatar image
Former Member

How do I display two different structured ALV Grids on one screen?

Thank-You.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 20, 2008 at 02:04 PM

    Hi Tom,

    For this you can use BLOCK List, for Block list refer the program BALVBT01

    You can also do that using Class CL_GUI_ALV_GRID.

    For class refer the sample BCALV_TEST_GRID_DRAG_DROP

    here you can see the Grid side by side. if you want, you can place them up and down also.

    Hope this will help.

    Regards,

    Nitin.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 20, 2008 at 02:05 PM

    It depends on the way u wanna display and use it.

    for simple 2 alv grids, u need 2 use OO ABAP.its nothing difficult.

    all that u need to do is..create 2 containers and nae them left and right for ur easy understanding and follow the regular procedure of creating an alv... like creating object and passing data for the method first display.

    Thanks

    Kiran

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2008 at 02:01 PM

    it is not possible with ALV Grid function, it is possible only with OOALV(CL_GUI_ALV_GRID) or CL_SALV_TABLE(Object model).

    search in SDN with Two ALV Grids.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2008 at 02:03 PM

    Hi,

    The best way is to use splitter container and display different ALVs on each of the containers.

    Regards,

    Sandeep

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 20, 2008 at 02:19 PM

    Hi Tom,

    You can display Two ALV grid on one screen by using OOALV.

    Thanks,

    Chidanand

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 27, 2008 at 11:52 AM

    try this code.....

    create a screen with two containers ok.......

    REPORT zvg_test_04.

    TYPES: BEGIN OF ty_cust,

    kunnr LIKE kna1-kunnr,

    name1 LIKE kna1-name1,

    ort01 LIKE kna1-ort01,

    END OF ty_cust,

    BEGIN OF ty_vbrk ,

    vbeln LIKE vbrk-vbeln,

    kunag LIKE vbrk-kunag,

    fkdat LIKE vbrk-fkdat,

    END OF ty_vbrk.

    DATA: gv_container TYPE REF TO cl_gui_custom_container,

    gv_alvgrid TYPE REF TO cl_gui_alv_grid,

    gv_struct_name TYPE dd02l-tabname,

    gv_variant TYPE disvariant.

    DATA: wa_layout TYPE lvc_s_layo,

    wa_fcatlg TYPE lvc_s_fcat,

    it_fcatlg TYPE lvc_t_fcat,

    it_cust TYPE TABLE OF ty_cust,

    it_vbrk TYPE TABLE OF ty_vbrk.

    START-OF-SELECTION.

    SELECT kunnr name1 ort01

    FROM kna1

    INTO TABLE it_cust

    UP TO 10 ROWS.

    SELECT vbeln kunag fkdat

    FROM vbrk

    INTO TABLE it_vbrk

    UP TO 10 ROWS.

    CALL SCREEN 100.

    &----


    *& Module STATUS_0100 OUTPUT

    &----


    • text

    ----


    MODULE status_0100 OUTPUT.

    SET PF-STATUS 'PF_STATUS'.

    --- First ALV ---

    *--- Creating Container

    IF gv_container IS INITIAL.

    PERFORM create_container USING 'CONTAINER01'.

    *--- Creating ALV grid

    PERFORM create_alvgrid.

    *--- Creating Field catalog manually

    PERFORM create_fieldcat USING:

    '1' 'KUNNR' 'IT_CUST' 'This is Customer Code' 'Cust No',

    '2' 'NAME1' 'IT_CUST' 'This is Customer Name' 'Customer Name',

    '3' 'ORT01' 'IT_CUST' 'This is Customer City' ' C i t y '.

    *--- Displaying the final output

    PERFORM display_tab TABLES it_cust.

    REFRESH it_fcatlg.

    --- Second ALV ---

    *--- Creating Container

    • IF gv_container IS INITIAL.

    PERFORM create_container USING 'CONTAINER02'.

    *--- Creating ALV grid

    PERFORM create_alvgrid.

    *--- Creating Field catalog manually

    PERFORM create_fieldcat USING:

    '1' 'VBELN' 'IT_VBRK' 'This is Billing Document' 'Bill Doc',

    '2' 'KUNAG' 'IT_VBRK' 'This is Sold-to party' 'Sold-to-Party',

    '3' 'FKDAT' 'IT_VBRK' 'This is Billing Date' 'Date '.

    *--- Displaying the final output

    PERFORM display_tab TABLES it_vbrk.

    ENDIF.

    *--- For Creating Field catalog Automatically

    • CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    ENDMODULE. " STATUS_0100 OUTPUT

    &----


    *& Module USER_COMMAND_0100 INPUT

    &----


    • text

    ----


    MODULE user_command_0100 INPUT.

    CASE sy-ucomm.

    WHEN 'BACK'.

    CALL METHOD cl_gui_cfw=>flush.

    LEAVE TO SCREEN 0.

    WHEN 'EXIT'.

    PERFORM exit.

    ENDCASE.

    ENDMODULE. " USER_COMMAND_0100 INPUT

    &----


    *& Form EXIT

    &----


    • text

    ----


    FORM exit .

    CALL METHOD gv_container->free.

    CALL METHOD cl_gui_cfw=>flush.

    LEAVE PROGRAM.

    ENDFORM. " EXIT

    &----


    *& Form CREATE_CONTAINER

    &----


    • text

    ----


    • -->P_TEXT text

    ----


    FORM create_container USING p_text.

    CREATE OBJECT gv_container

    EXPORTING

    container_name = p_text

    EXCEPTIONS

    cntl_error = 1

    cntl_system_error = 2

    create_error = 3

    lifetime_error = 4

    lifetime_dynpro_dynpro_link = 5

    OTHERS = 6.

    IF sy-subrc IS NOT INITIAL.

    MESSAGE text-003 TYPE 'S' DISPLAY LIKE 'E'.

    LEAVE TO LIST-PROCESSING.

    ENDIF.

    ENDFORM. " CREATE_CONTAINER

    &----


    *& Form CREATE_ALVGRID

    &----


    • text

    ----


    FORM create_alvgrid .

    CREATE OBJECT gv_alvgrid

    EXPORTING

    i_parent = gv_container

    EXCEPTIONS

    error_cntl_create = 1

    error_cntl_init = 2

    error_cntl_link = 3

    error_dp_create = 4

    OTHERS = 5.

    IF sy-subrc IS NOT INITIAL.

    MESSAGE text-005 TYPE 'S' DISPLAY LIKE 'E'.

    LEAVE TO LIST-PROCESSING.

    ENDIF.

    ENDFORM. " CREATE_ALVGRID

    &----


    *& Form DISPLAY_TAB

    &----


    • text

    ----


    • -->P_TAB text

    ----


    FORM display_tab TABLES p_tab.

    gv_variant-report = sy-repid.

    CALL METHOD gv_alvgrid->set_table_for_first_display

    EXPORTING

    is_variant = gv_variant

    i_save = 'A'

    CHANGING

    it_outtab = p_tab[]

    it_fieldcatalog = it_fcatlg

    EXCEPTIONS

    invalid_parameter_combination = 1

    program_error = 2

    too_many_lines = 3

    OTHERS = 4.

    IF sy-subrc IS NOT INITIAL.

    MESSAGE text-e05 TYPE 'S' DISPLAY LIKE 'E'.

    LEAVE TO LIST-PROCESSING.

    ENDIF. "Insert correct name for <...>.

    ENDFORM. " DISPLAY_TAB

    &----


    *& Form create_fieldcat

    &----


    • text

    ----


    • -->COL_POS text

    • -->FIELDNAME text

    • -->TABNAME text

    • -->TOOLTIP text

    • -->REPTEXT text

    ----


    FORM create_fieldcat USING col_pos

    fieldname

    tabname

    tooltip

    reptext.

    wa_fcatlg-col_pos = col_pos.

    wa_fcatlg-fieldname = fieldname.

    wa_fcatlg-tabname = tabname.

    wa_fcatlg-tooltip = tooltip.

    wa_fcatlg-reptext = reptext.

    APPEND wa_fcatlg TO it_fcatlg.

    CLEAR wa_fcatlg.

    ENDFORM. "create_fieldcat

    Add comment
    10|10000 characters needed characters exceeded