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: 

Two Alv's in a screen

Former Member
0 Kudos

Hi all,

I wanted to display 2 ALV Grids in a screen.

I have used a custom screen with custom control in the screen and the container object ,the logic ,similar to the progrm 'BCALV_GRID_DEMO'

But now when i pass the Structure name and the internal table name i get a type incompatible error .

i hve declared the internal table as

DATA: BEGIN OF i_v OCCURS 0,

:

:

:

:

END OF i_values.

and given Structure name as 'I_VALUES' and i_ table would be i_values.

Pls help me with this with ideas.

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

Hi,

even you declare the table as occurs 0, that doesn't matter.

but pass this way , it will solve your problem..

**Calling the Method for ALV output
  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      <b>IT_OUTTAB            = ITAB[]</b>.

instead of i_values pass I_values[]

it will solve your problem.

regards

vijay

6 REPLIES 6

Former Member
0 Kudos

in ALV GRID dispay, use internal tables without header lines.

former_member188685
Active Contributor
0 Kudos

Hi,

Did you check this example <b>BCALV_TEST_GRID_DRAG_DROP</b>.

this is exactly similar to your requirement.

and for more details check this thread..

regards

vijay

Former Member
0 Kudos

Hi,

You can display two ALV in a screen by implementing TAB-strip ALV:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap-co... code sample for tab strip in alv.pdf

Best Regars,

Anjali

Former Member
0 Kudos

hi Stock,

check this sample code to for the display of multiple ALVs on the samepage...

START-OF-SELECTION.

**----


    • Begin of process logic

**----


CALL SCREEN '0100'.

END-OF-SELECTION.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

SET PF-STATUS 'STATUS01'.

SET TITLEBAR 'SALESTTL'.

*----


  • A L V G R I D

*----


IF o_grid_container IS INITIAL.

CREATE OBJECT o_grid_container

EXPORTING

container_name = 'CCONTAINER1'.

CREATE OBJECT o_grid

EXPORTING

i_appl_events = 'X'

i_parent = o_grid_container.

*----


<b>* FOR first A L V G R I D</b>

*----


PERFORM set_grid_field_catalog

CHANGING i_grid_fcat.

PERFORM modify_grid_fcat_predisplay

CHANGING i_grid_fcat.

PERFORM set_grid_layout_set

CHANGING struct_grid_lset.

PERFORM sort_outtable CHANGING i_sort_fcat.

  • PERFORM populate_grid_data TABLES i_grid_outs i_grid_outs_pro.

SORT i_grid_outs BY year month.

CALL METHOD o_grid->set_table_for_first_display

EXPORTING

i_bypassing_buffer = space

is_variant = ws_f_grid_disvar

i_save = ws_c_grid_save

is_layout = struct_grid_lset

CHANGING

it_outtab = i_grid_outs[]

it_fieldcatalog = i_grid_fcat[]

it_sort = i_sort_fcat. " Period

ENDIF.

IF o_grid1_container IS INITIAL.

CREATE OBJECT o_grid1_container

EXPORTING

container_name = 'CCONTAINER2'.

CREATE OBJECT o_grid1

EXPORTING

i_appl_events = 'X'

i_parent = o_grid1_container.

  • -----------------------------------------------------

*<b> FOR SECOND ALV GRID</b>

  • -----------------------------------------------------

PERFORM set_grid1_field_catalog

CHANGING i_grid1_fcat.

PERFORM modify_grid1_fcat_predisplay

CHANGING i_grid1_fcat.

PERFORM set_grid1_layout_set

CHANGING struct_grid1_lset.

PERFORM sort_outtable1 CHANGING i_sort_fcat1.

  • PERFORM populate_grid1_data TABLES i_grid1_outs i_grid1_outs_pro.

SORT i_grid1_outs BY year month.

CALL METHOD o_grid1->set_table_for_first_display

EXPORTING

i_bypassing_buffer = space

is_variant = ws_f_grid_disvar

i_save = ws_c_grid_save

is_layout = struct_grid1_lset

CHANGING

it_outtab = i_grid1_outs[]

it_fieldcatalog = i_grid1_fcat[]

it_sort = i_sort_fcat1. " Period

ENDIF.

IF o_grid2_container IS INITIAL.

CREATE OBJECT o_grid2_container

EXPORTING

container_name = 'CCONTAINER3'.

CREATE OBJECT o_grid2

EXPORTING

i_appl_events = 'X'

i_parent = o_grid2_container.

********************************

FOR THIRD ALV GRID

*----


........

.....

CALL METHOD o_grid2->set_table_for_first_display

EXPORTING

i_bypassing_buffer = space

is_variant = ws_f_grid_disvar

i_save = ws_c_grid_save

is_layout = struct_grid2_lset

CHANGING

it_outtab = i_grid2_outs[]

it_fieldcatalog = i_grid2_fcat[]

it_sort = i_sort_fcat2. " Period

ENDIF.

regards

satesh

former_member188685
Active Contributor
0 Kudos

Hi,

even you declare the table as occurs 0, that doesn't matter.

but pass this way , it will solve your problem..

**Calling the Method for ALV output
  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      <b>IT_OUTTAB            = ITAB[]</b>.

instead of i_values pass I_values[]

it will solve your problem.

regards

vijay

Former Member
0 Kudos

Thanks guyz.

Problem solved.Good Learning.

Regards.

Stock