Application Development and Automation 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: 
Read only

ALV GRID

Former Member
0 Likes
712

Hi,

How to display two girds in the final out put

one with po header details and another separate grid with item details how to do that?

SIRI

8 REPLIES 8
Read only

Former Member
0 Likes
689

Hi,

You can use the OO ALV to create two grids..

You can check the program BCALV_GRID_01 for a simple ALV Grid..

You have to create another container in the screen and add the other ALV Grid..

Thanks,

Naren

Read only

0 Likes
689

hi Naren,

Is it not possible to develop with normal alv grids rather than OO ALV

Read only

0 Likes
689

No you can only do it with OO ALV.

Since you require different screen area for different ALV and screen cannot be divided in normal programming routines.

Regards,

Amit

Read only

Former Member
0 Likes
689

Hi,

I believe it is not possible to do it using the FMs.

Thanks,

Naren

Read only

0 Likes
689

But

For each and every po number these grids should be displayed continuously like

po number range 400015-400017

In the out put screen I should get, for each n every po number two girds one with header details and one with item details. So for each n every po number these two grids should be displayed continuously... can u guide me how to do it

Thanks alot for your anticipation....

SIRI

Read only

Former Member
0 Likes
689

Hi Sri,

Try this code:

EPORT Y730_ALV5 .

*ALV BLOCK LIST

type-pools : slis.

tables : vbak, ekko.

select-options : s_vkorg for vbak-vkorg,

s_ekorg for ekko-ekorg.

data : begin of it_vbak occurs 0,

vbeln like vbak-vbeln,

erdat like vbak-erdat,

ernam like vbak-ernam,

netwr like vbak-netwr,

end of it_vbak,

begin of it_ekko occurs 0,

ebeln like ekko-ebeln,

aedat like ekko-aedat,

ernam like ekko-ernam,

end of it_ekko.

data : it_fieldcat type slis_t_fieldcat_Alv,

wa_fieldcat type slis_fieldcat_Alv,

repid type sy-repid,

it_layout type SLIS_LAYOUT_ALV,

it_events type SLIS_T_EVENT.

initialization.

move sy-repid to repid.

start-of-selection.

select vbeln erdat ernam netwr from vbak

into table it_vbak

where vkorg in s_vkorg.

select ebeln aedat ernam from ekko

into table it_ekko

where ekorg in s_ekorg.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

I_CALLBACK_PROGRAM = repid.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = repid

I_INTERNAL_TABNAME = 'IT_VBAK'

I_INCLNAME = repid

CHANGING

CT_FIELDCAT = it_fieldcat.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = it_layout

IT_FIELDCAT = it_fieldcat

I_TABNAME = 'IT_VBAK'

IT_EVENTS = it_events

TABLES

T_OUTTAB = it_vbak.

clear it_fieldcat.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = repid

I_INTERNAL_TABNAME = 'IT_EKKO'

I_INCLNAME = repid

CHANGING

CT_FIELDCAT = it_fieldcat.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = it_layout

IT_FIELDCAT = it_fieldcat

I_TABNAME = 'IT_EKKO'

IT_EVENTS = it_events

TABLES

T_OUTTAB = it_ekko.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.

***********

Let me know if you need any more clarifications.

BR

Rakesh

Read only

abdul_hakim
Active Contributor
0 Likes
689

Hi

You can only do it using ALV Grid OO approach and You cannot use FM approach for this requirement..Please Check the sample programs starting with BCALV_GRID* for the same..

Cheers,

Hakim

Read only

Former Member
0 Likes
689

Hello,

Check the code below.It has 2 alv grids on the same screen and a local class is used to handle the double click event in the first alv grid.When you double click on a row in the first ALV Grid,another ALV appears below with the detailed items.Name the two containers in your screen layout as <b>CONTAINER1</b> and <b>CONTAINER2</b>.

I have used tables <b>SPFLI for first grid</b> and <b>SFLIGHT for second grid</b>.You can use the tables depending on your requirements.

REPORT ZSAMPLE.

DATA:

<b>*first container and grid</b>

cont1 type ref to cl_gui_custom_container,

alv1 type ref to cl_gui_alv_grid,

<b>*second container and grid</b>

cont2 type ref to cl_gui_custom_container,

alv2 type ref to cl_gui_alv_grid,

<b>*table displayed in first grid</b>

itab_spfli type table of spfli,

wa_spfli like line of itab_spfli,

<b>*table displayed in second grid</b>

itab_sflight type table of sflight,

wa_sflight like line of itab_sflight,

ok_code type sy-ucomm.

<b>*local class for handling the double click event of first grid</b>

----


  • CLASS lcl_eh DEFINITION

----


  • ........ *

----


class lcl_eh definition.

Public section.

Methods:DOUBLE_CLICK FOR EVENT DOUBLE_CLICK of cl_gui_alv_grid

importing E_ROW E_COLUMN ES_ROW_NO .

endclass.

<b>DATA: lo_obj TYPE REF TO lcl_eh.</b>

----


  • CLASS lcl_eh IMPLEMENTATION

----


  • ........ *

----


class lcl_eh implementation.

Method double_click.

read table itab_spfli into wa_spfli INDEX e_row-index.

select * from sflight into table itab_sflight where carrid =

wa_spfli-carrid.

<b>*create second container and grid</b>

CREATE OBJECT CONT2

EXPORTING

CONTAINER_NAME = 'CONTAINER2'.

CREATE OBJECT ALV2

EXPORTING

I_PARENT = cont2.

CALL METHOD ALV2->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SFLIGHT'

CHANGING

IT_OUTTAB = itab_sflight.

endmethod.

endclass.

<b>*selection-screen parameter</b>

PARAMETERS : carrid type spfli-carrid.

AT SELECTION-SCREEN.

SELECT * from spfli into table itab_spfli where carrid = carrid.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI'.

  • SET TITLEBAR 'xxx'.

<b>*create first container and grid</b>

CREATE OBJECT CONT1

EXPORTING

CONTAINER_NAME = 'CONTAINER1'.

CREATE OBJECT ALV1

EXPORTING

I_PARENT = cont1.

<b>*set handler to handle the double click event</b>

<b>create object lo_obj.

set handler lo_obj->double_click for alv1.</b>

CALL METHOD ALV1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'SPFLI'

CHANGING

IT_OUTTAB = itab_spfli.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

case ok_code.

when 'BACK'.

leave to screen 0.

when 'EXIT'.

leave program.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT

Regards,

Beejal

<b>**reward if this helps</b>