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

doubt in alv classes program

Former Member
0 Likes
348

plz check the following code using class. i want to display the output. i have declared an instance called pav1. im getting short dump. wht i have to give in 'i_parent = ' int his case.

DATA:PAV1 TYPE REF TO CL_GUI_ALV_GRID.

tables:mara.

data:begin of itab occurs 0,

matnr like mara-matnr,

mtart like mara-mtart,

matkl like mara-matkl,

end of itab.

PARAMETERS: s_matnr LIKE mara-matnr.

  • INTIALIZATION EVENT

initialization.

MOVE '38' TO S_MATNR.

*move '38' to s_matnr-low.

*append s_matnr.

*move '679' to s_matnr-high.

*append s_matnr.

*AT SELECTION SCREEN EVENT.

at selection-screen.

IF S_MATNR NE '38'.

MESSAGE i000.

ENDIF.

*START OF SELECTION EVENT

start-of-selection.

select matnr mtart matkl from mara into corresponding fields of table

itab where matnr = s_matnr.

IF SY-SUBRC NE 0.

WRITE:/ 'SORRY'.

ENDIF.

*TOP OF PAGE EVENT

top-of-page.

write:/ 'TOP OF PAGE'.

*END OF SELECTION EVENT

END-OF-SELECTION.

WRITE:/'SELECTION ENDED.'.

create object pav1 exporting i_parent = mara.

CALL METHOD PAV1->set_table_for_first_display

EXPORTING

  • I_BUFFER_ACTIVE =

  • I_BYPASSING_BUFFER =

  • I_CONSISTENCY_CHECK =

I_STRUCTURE_NAME = 'mara'

  • IS_VARIANT =

  • I_SAVE =

  • I_DEFAULT = 'X'

  • IS_LAYOUT =

  • IS_PRINT =

  • IT_SPECIAL_GROUPS =

  • IT_TOOLBAR_EXCLUDING =

  • IT_HYPERLINK =

  • IT_ALV_GRAPHICS =

  • IT_EXCEPT_QINFO =

CHANGING

it_outtab = itab[].

  • IT_FIELDCATALOG =

  • IT_SORT =

  • IT_FILTER =

  • EXCEPTIONS

  • INVALID_PARAMETER_COMBINATION = 1

  • PROGRAM_ERROR = 2

  • TOO_MANY_LINES = 3

  • others = 4

IF sy-subrc ne 0.

write:/ 'sorry u didnt call the method correctly'.

ENDIF.

2 REPLIES 2
Read only

Former Member
0 Likes
318

You have to create a object for custom container for the class cl_gui_custom_container.Then you have to give the i_parent for the ALV class object as <custom container object>

create object <custom container>

create object <alv grid>

importing i_parent = <custom container>.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
318

Hi,

You should use custom container or docking container to hold the grid.

You need to create objects for the same.

Check standard demo programs bc_alv.You will understand better.