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

SET_TABLE_FOR_FIRST_DISPLAY

Former Member
0 Likes
2,982

How to display some thing at top of page while displaying some data using SET_TABLE_FOR_FIRST_DISPLAY.

I see its getting display when I go to the LIST display. But the requirement is to show at the very first grid display.

Could some one pls help me? Thanks.

8 REPLIES 8
Read only

Former Member
0 Likes
1,663

Add a HTML Header to the top of the grid.

Read only

Former Member
0 Likes
1,663

you can define top_of_page event

CLASS-METHODS:

m002_handle_top_of_page

FOR EVENT print_top_of_page OF cl_gui_alv_grid.

Read only

Former Member
0 Likes
1,663

HI

good

YOU CAN USE TOP-OF-PAGE EVENT.

REPORT demo_list_page_heading NO STANDARD PAGE HEADING.

TOP-OF-PAGE.

WRITE: sy-title, 40 'Page', sy-pagno.

ULINE.

WRITE: / 'SAP AG', 29 'Walldorf, ',sy-datum,

/ 'Neurottstr. 16', / '69190 Walldorf/Baden'.

ULINE.

START-OF-SELECTION.

DO 5 TIMES.

WRITE / sy-index.

ENDDO.

thanks

mrutyun

Read only

Former Member
0 Likes
1,663

Hi,

Declare something like this:

DATA: w_grid TYPE REF TO cl_gui_alv_grid.

DATA: w_custom_container

TYPE REF TO cl_gui_custom_container.

CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

  • Top of Page

CLASS-METHODS:

handle_top_of_page

FOR EVENT print_top_of_page OF cl_gui_alv_grid,

ENDCLASS.

CLASS lcl_event_receiver IMPLEMENTATION.

  • Handle top of page

METHOD handle_top_of_page.

write:/ 'Report Name:', sy-repid,

'Date :', sy-datum,

'Time:', sy-uzeit,

'User:', sy-uname.

ENDMETHOD.

  • If you are using a custom container

CREATE OBJECT w_grid EXPORTING i_parent =

w_custom_container.

  • Create Event Receiver

CREATE OBJECT event_receiver.

  • Handle events

SET HANDLER event_receiver->handle_top_of_page

FOR w_grid.

Then use the

CALL METHOD wcl_grid->set_table_for_first_display

Regards

Subbu

Read only

Former Member
0 Likes
1,663

I am exactly doing the same thing and using the top of page event to write.

The concern is that it is not being displyed on the screen at top.

Here is the code I am using:

Def:

HANDLE_END_OF_PAGE

FOR EVENT PRINT_END_OF_PAGE OF CL_GUI_ALV_GRID,

Imp:

METHOD HANDLE_TOP_OF_PAGE.

WRITE: / 'Event: PRINT_TOP_OF_PAGE'.

And the link with the grid:

SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR GRID1.

Grid1 is the ALV Gid.

Read only

Former Member
0 Likes
1,663

Hi,

Check my Blog on Alv Top_of_page using Cl_gui_alv_grid class.

/people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid

get back if you have any doubts.

Regards

vijay

Read only

0 Likes
1,663

Vijay....Thank you very much.

One question only....when ever u print from the GRID container....does the top of page is also printed on every page? Thanks

Read only

0 Likes
1,663

Hi,

it is only for Display purpose, it will not be printed . and in that case you have to use some other event.

you can use PRINT_TOP_OF_PAGE event for that purpose.

    METHODS:
    prit_top_of_page
        FOR EVENT print_top_of_page OF cl_gui_alv_grid,

 METHOD print_top_of_page.
    ADD 1 TO pagenum.

    WRITE: / 'Trans. Code     : ' , sy-tcode ,
           / 'Run Date        : ' , sy-datum ,
           / 'User Name       : ' , sy-uname ,
           / 'Page Number     : ' , pagenum  .
    ULINE .
  ENDMETHOD.                           "handle_top_of_page

 CREATE OBJECT event_receiver.
   SET HANDLER event_receiver->print_top_of_page FOR g_grid.

the print_top_f_page will trigger only when print is done. you can use this for your purpose.

Regards

vijay

Message was edited by: Vijay Babu Dudla