‎2006 Oct 16 4:39 AM
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.
‎2006 Oct 16 4:46 AM
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>.
‎2006 Oct 16 4:47 AM
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.