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 in Dialog Programme

Former Member
0 Likes
477

hi i want to show a alv grid in my screen in dialog programe how can i do that....

abhishek

hi i want to show a alv grid in my screen in dialog programe how can i do that....

abhishek

2 REPLIES 2
Read only

Former Member
0 Likes
453

THIS MAY BE HELP U LOT....

REPORT z_vj_testalvdialog.

CLASS lcl_event DEFINITION DEFERRED.

DATA : tempflight TYPE TABLE OF sflight,

tempbook TYPE TABLE OF sbook,

gs_lo TYPE lvc_s_layo,

g_ctrl TYPE scrfname VALUE 'GRID',

grid1 TYPE REF TO cl_gui_alv_grid,

custom_container TYPE REF TO cl_gui_custom_container,

grid2 TYPE REF TO cl_gui_alv_grid,

dialog_container TYPE REF TO cl_gui_dialogbox_container,

ok_code LIKE sy-ucomm,

save_code LIKE sy-ucomm,

eve_receive TYPE REF TO lcl_event.

SET SCREEN 0100.

----


  • CLASS lcl_event_Receiver DEFINITION

----


  • ........ *

----


CLASS lcl_event DEFINITION.

PUBLIC SECTION.

METHODS :

handle_double_click FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column,

handle_close FOR EVENT close OF cl_gui_dialogbox_container

IMPORTING sender.

PRIVATE SECTION.

DATA : dialog_status TYPE c.

ENDCLASS.

----


  • CLASS lcl_event_receiver IMPLEMENTATION

----


  • ........ *

----


CLASS lcl_event IMPLEMENTATION.

METHOD handle_double_click.

DATA : locflight LIKE LINE OF tempflight.

READ TABLE tempflight INDEX e_row INTO locflight.

break-point 1.

SELECT * from sbook INTO table tempbook

WHERE

carrid = locflight-carrid

AND connid = locflight-connid

AND fldate = locflight-fldate.

IF dialog_status IS INITIAL.

dialog_status = 'X'.

CREATE OBJECT dialog_container

EXPORTING

top = 140

left = 130

caption = 'DIALOG CONTROL BY DOUBLE CLICK'

width = 500

height = 500.

CREATE OBJECT grid2

EXPORTING

i_parent = dialog_container.

SET HANDLER eve_receive->handle_close FOR dialog_container.

CALL METHOD grid2->set_table_for_first_display

EXPORTING

i_structure_name = 'SBOOK'

  • is_layout = gs_lo

CHANGING it_outtab = tempbook.

ELSE.

CALL METHOD dialog_container->set_visible

EXPORTING visible = 'X'.

CALL METHOD grid2->refresh_table_display.

ENDIF.

ENDMETHOD.

METHOD handle_close.

CALL METHOD sender->set_visible

EXPORTING visible = space.

ENDMETHOD.

ENDCLASS.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module STATUS_0100 output.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

select * from sflight into table tempflight.

create object custom_container

exporting

container_name = g_ctrl.

create object grid1

exporting

i_parent = custom_container.

call method grid1->set_table_for_first_display

exporting

i_structure_name = 'SFLIGHT'

changing

it_outtab = tempflight.

create object eve_receive.

set handler eve_receive->handle_double_click for grid1.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module USER_COMMAND_0100 input.

data : click like sy-ucomm.

click = sy-ucomm.

if click = 'EXIT'.

leave program.

endif.

endmodule. " USER_COMMAND_0100 INPUT

Read only

Vinod_Chandran
Active Contributor
0 Likes
453

Hi,

You have to follow the oops method for this. Please refer the following for more info.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an easy reference for alv grid control.pdf

Cheers

Vinod