Translate

Thursday, 7 June 2012

Custom Container in ABAP Reports


data: BEGIN OF ty_mara,
matnr like mara-matnr,
ersda like mara-ersda,
ernam like mara-ernam,
end of ty_mara.

data: i_mara like STANDARD TABLE OF ty_mara,
wa_mara like line of i_mara.

data: o_cust type ref to cl_gui_custom_container,
o_grid type ref to cl_gui_alv_grid.

START-OF-SELECTION.
call screen 100.

*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
leave to SCREEN 0.
"WHEN .

"WHEN OTHERS.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MENU'.
* SET TITLEBAR 'xxx'.
create OBJECT o_cust
EXPORTING
CONTAINER_NAME = 'CUST_CONT'.
create object o_grid
EXPORTING
I_PARENT = o_cust.

perform getdata.
perform displaydata.

ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Form getdata
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM getdata . select matnr ersda ernam from mara into table i_mara. ENDFORM. " getdata *&---------------------------------------------------------------------* *& Form displaydata *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text
* <-- p2 text *----------------------------------------------------------------------* FORM displaydata . "LOOP AT i_mara into wa_mara. CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'zmymara'
* 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 =
* IR_SALV_ADAPTER =
CHANGING
IT_OUTTAB = i_mara[]
* IT_FIELDCATALOG =
* IT_SORT =
* IT_FILTER =
* EXCEPTIONS
* INVALID_PARAMETER_COMBINATION = 1
* PROGRAM_ERROR = 2
* TOO_MANY_LINES = 3
* others = 4
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

"ENDLOOP.
ENDFORM. " displaydata

No comments: