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

OO ALV DIsplay

Former Member
0 Likes
467

Hi experts,

Is there any way to display top of page in OO alv.

dont want to use print_top_of_page.

Regards,

Bindu.

Hi experts,

Is there any way to display top of page in OO alv.

dont want to use print_top_of_page.

Regards,

Bindu.

2 REPLIES 2
Read only

Former Member
0 Likes
447

Hi,

In OOPS world u have to use Event handler for class "cl_gui_alv_grid" and event name is "print_top_of_page".

Reward if useful!

Read only

Former Member
0 Likes
447

Check this code.

REPORT ZNA_CLASS_ALV.

TABLES: KNA1.

DATA: IT_KNA1 TYPE STANDARD TABLE OF KNA1 INITIAL SIZE 0.

DATA: WA_KNA1 LIKE LINE OF IT_KNA1.

DATA: OK_CODE TYPE SY-UCOMM.

DATA: CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

DATA: ALV_DISP TYPE REF TO CL_GUI_ALV_GRID.

INITIALIZATION.

SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: KUNNR FOR KNA1-KUNNR.

SELECTION-SCREEN: END OF BLOCK B1.

START-OF-SELECTION.

SELECT * FROM KNA1

INTO TABLE IT_KNA1

WHERE

KUNNR IN KUNNR.

IF SY-SUBRC = 0.

SORT IT_KNA1 BY KUNNR.

ENDIF.

CALL SCREEN '1001'.

&----


*& Module STATUS_1001 OUTPUT

&----


  • text

----


MODULE STATUS_1001 OUTPUT.

SET PF-STATUS 'STATUS_1001'.

IF CONT IS INITIAL.

CREATE OBJECT CONT

EXPORTING

CONTAINER_NAME = 'CONTAINER1'.

ENDIF.

CREATE OBJECT ALV_DISP

EXPORTING

I_PARENT = CONT.

CALL METHOD ALV_DISP->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

I_STRUCTURE_NAME = 'KNA1'

CHANGING

IT_OUTTAB = IT_KNA1

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.

CALL METHOD ALV_DISP->REFRESH_TABLE_DISPLAY

EXCEPTIONS

FINISHED = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDMODULE. " STATUS_1001 OUTPUT

&----


*& Module USER_COMMAND_1001 INPUT

&----


  • text

----


MODULE USER_COMMAND_1001 INPUT.

CASE OK_CODE.

WHEN 'BACK'.

CALL SELECTION-SCREEN '1000'.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT

Same as alv.

Rewards points if it is useful.