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 using classes

Former Member
0 Likes
884

Hi Group,

Can somebody send me the material or guide to implement alv grid using OOPS.

Thanks in advance.

Regards

Prabhas

9 REPLIES 9
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
848

Do you want information about using CL_GUI_ALV_GRID? Or the new ALV OBject Model?

Regards,

RIch Heilman

Read only

RichHeilman
Developer Advocate
Developer Advocate
Read only

Former Member
0 Likes
848
Read only

0 Likes
848

If you want to know more about the class CL_GUI_ALV_GRID, here is another help link.

http://help.sap.com/saphelp_nw2004s/helpdata/en/bf/3bd1369f2d280ee10000009b38f889/frameset.htm

Regards,

Rich HEilman

Read only

Former Member
0 Likes
848

Hi group,

This is really difficult to understand .. can somebody give me a sample code to implement an alv grid using OOPS.

Thanks in advance.

Read only

0 Likes
848

Look to the SAP provided programs: BCALV_GRID*

Read only

0 Likes
848

Also try this:

1) create a Z prog and then create a screen 0100 for that prog.

2) place a Custom Control on the screen and name the Custom Control as CUSTOM_GRID_CONTAINER

3) Exit screen painte and Paste in this code into the editor

data: i_vbak type table of vbak.

data: grid1 type ref to cl_gui_alv_grid,

field_catalog type lvc_t_fcat,

grid1_container type ref to cl_gui_custom_container.

data: lt_fieldcat type LVC_T_FCAT.

data: wa_fieldcat type LVC_s_FCAT.

start-of-selection.

select * from vbak into table i_vbak

where erdat > '20041201'

and erdat < '20071216'.

  • Instantiate the grid container.

create object grid1_container

exporting

container_name = 'CUSTOM_GRID_CONTAINER'.

  • Instantiate the grid itself within the container.

create object grid1

exporting

i_parent = grid1_container

i_appl_events = 'X'.

data: p_tb_exclude type ui_functions.

DATA: layout TYPE lvc_s_layo.

layout-edit = 'X'.

layout-NO_ROWMARK = ' '.

layout-zebra = 'X'.

layout-sel_mode = 'C'.

APPEND CL_GUI_ALV_GRID=>MC_FC_DESELECT_ALL

TO p_tb_exclude.

APPEND CL_GUI_ALV_GRID=>MC_FC_SELECT_ALL

TO p_tb_exclude.

CALL METHOD grid1->set_table_for_first_display

EXPORTING i_structure_name = 'VBAK'

is_layout = layout

IT_TOOLBAR_EXCLUDING = p_tb_exclude

CHANGING "it_fieldcatalog = gt_fieldcat

it_outtab = i_vbak[].

call screen '0100'.

*

*&----


*

*& Module STATUS_0100 OUTPUT

*&----


*

  • text

*----


*

MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'E100'.

SET TITLEBAR '100'.

ENDMODULE. " STATUS_0100 OUTPUT

*&----


*

*& Module USER_COMMAND_0100 INPUT

*&----


*

  • text

*----


*

MODULE USER_COMMAND_0100 INPUT.

case sy-ucomm.

when 'EXIT' or 'BACK' or 'CANCEL'.

leave program.

endcase.

ENDMODULE. " USER_COMMAND_0100 INPUT

Read only

Former Member
0 Likes
848