01-22-2008 6:50 AM
hi,
How menu painter works with ALV REPORTS based on object oriented concept.
what we need to pass when we call CALL METHOD obj_alv->set_table_for_first_display, is there any parameter is required to pass with this call method.
Please send me any existing reports or help me on the above requierment.
Its very urgent.
thanks
01-22-2008 6:59 AM
Hi
when you are writing a program by useing content screens then at that time you can define a menu painter for that and write some function keys like BACK etc..
see thsi program you can understand very easily
as what do u want that is explained here very easily
go in debugging you can understand very easily
here in this program i had created screen 100 etc..
REPORT ZLCL_ALV_INVOICE .
TABLES: VBRK.
DATA: ITAB LIKE VBRP OCCURS 1 WITH HEADER LINE.
DATA: O_CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
O_GRID TYPE REF TO CL_GUI_ALV_GRID.
START-OF-SELECTION.
SET SCREEN 100.
&----
*& Form GET_DATA
&----
text
----
FORM GET_DATA .
SELECT *
FROM VBRP
INTO TABLE ITAB
WHERE VBELN = VBRK-VBELN.
ENDFORM. " GET_DATA
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
IF O_CONT IS INITIAL.
CREATE OBJECT O_CONT
EXPORTING
CONTAINER_NAME = 'INV_CONT' "Screen custom control name
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in custom container'.
EXIT.
ENDIF.
CREATE OBJECT O_GRID
EXPORTING
I_PARENT = O_CONT "Custom container class object
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in alv grid linking'.
EXIT.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Module SHOW_ALV_GRID INPUT
&----
text
----
MODULE SHOW_ALV_GRID INPUT.
PERFORM GET_DATA.
CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'VBRP'
CHANGING
IT_OUTTAB = ITAB[]
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE I000(Z00) WITH 'Error in showing alv grid'.
EXIT.
ENDIF.
ENDMODULE. " SHOW_ALV_GRID INPUT