Application Development 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: 

Heeader in OOPS alv

Former Member
0 Kudos
751

Hi All,

kindly help me how to have a header for in the oops ALV.

I have two ALV ouput in the Screen(achieve by creating separate container for each of them)

and now i need to have header for the same

kindly let me know do i need to creAt a container for the header too>

I am new to oops concept so please help me with same code on this.

also when i am calling the event handler i am getting an error as method is unknown or is protect or private.

many thanks,

Anuj.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
115

Hi

Every ALV has an own headert and it will be shown in the same container of the alv

I suppose you're calling a not defined method

Max

13 REPLIES 13

Former Member
0 Kudos
116

Hi

Every ALV has an own headert and it will be shown in the same container of the alv

I suppose you're calling a not defined method

Max

0 Kudos
115

Hi Max,

This mean i dont have to create a separate container for Header.

for event print top of page i am using a event handler in the following way.

for the following i am getting error

Short text

With 'SET HANDLER ... FOR src', 'src' cannot be 'NULL'.

difination:

CLASS lcl_event_receiver DEFINITION .

PUBLIC SECTION.

METHODS:

print_top_of_page FOR EVENT print_top_of_page OF

cl_gui_alv_grid.

ENDCLASS.

class implementation

CLASS lcl_event_receiver IMPLEMENTATION.

method print_top_of_page.

DATA: t_header TYPE slis_t_listheader,

wa_header TYPE slis_listheader,

l_date LIKE sy-datum.

l_date = sy-datum - 1.

wa_header-typ = 'S'.

wa_header-key = ' Report : '.

wa_header-info = 'Summary'. "todays date

APPEND wa_header TO t_header.

CLEAR: wa_header.

wa_header-typ = 'S'.

wa_header-key = 'Date : '.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = t_header.

  • i_logo = 'Z_LOGO'.

ENDMETHOD. "print_top_of_page

ENDCLASS.

0 Kudos
115

Hi

have u created an instance for local class lcl_event_receiver?

DATA: MY_EVENT TYPE REF TO lcl_event_receiver.

CREATE OBJECT MY_EVENT.

SET HANDLER MY_EVENT->print_top_of_page FOR G_GRID.

but I think the right event is TOP_OF_PAGE, print_top_of_page is triggered in the print

Max

Edited by: max bianchi on Nov 2, 2010 8:58 AM

0 Kudos
115

Hi

Thanks for the quick response:

yes i have declared the event_receiver type ref to lcl_event_receiver.

and change to top_of_page is also done.

But dump :With 'SET HANDLER ... FOR src', 'src' cannot be 'NULL'. is coming do not know why?

Kindly also let me know how to pass the header contaiin to the TOP page ?

,many thanks

Anuj.

0 Kudos
115

Hi

Try to see the demo program BCALV_GRID_01

U need to create the instance for the ALV grid before:

CREATE OBJECT G_GRID.

CREATE OBJECT MY_EVENT.

SET HANDLER MY_EVENT->print_top_of_page FOR G_GRID.

mAX

Edited by: max bianchi on Nov 2, 2010 9:26 AM

0 Kudos
115

Hi Max

yes i did that..

thanks for the program name. for top of page

Kindly let me know how i can build the TOP of page and also this will be display in all ways ?

like we have limitation tha at time header of ALV oops gets displayed only in print preview.

many thanks,

Anuj

0 Kudos
115

Hi

See the demo report BCALV_TEST_GRID_EVENTS: here u can find out how the main events for grid work

Max

0 Kudos
115

Hi

thanks for your reply.

I have check all the information and now there is no error except that at the TOP of page nothing is coming.

In the method top pd page for now i have use only

WRITE : 'TESt '.

but the same is not getting popullate at the TOP of page.

there is no error no warrning still i am not geting the proper result.

Kindly help.

*****

CLASS lcl_event_receiver DEFINITION .

PUBLIC SECTION.

METHODS:

top_of_page FOR EVENT top_of_page OF

cl_gui_alv_grid

importing e_dyndoc_id.

ENDCLASS.

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD top_of_page.

WRITE : 'test'.

ENDMETHOD. "print_top_of_page

ENDCLASS.

0 Kudos
115

In this event you have importing param e_dyndoc_id which is a reference to a [Dynamic Document|http://help.sap.com/saphelp_nw70/helpdata/EN/10/246858055711d4a7410000e83dd863/frameset.htm]. This is a special area which you can use to add your content but only with methods available for Dyn.Document. Simple write will not work there.

Refer following blog, you will understand the idea and shall see how to properly display data there.

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

BTW: Once issue resolved close the thread as well as all your outstanding or unaswered previous questions. Those only dump the forum.

Regards

Marcin

0 Kudos
115

Hi

Marcin is right

Problably it can be easier if u insert your "Header" in area at the top of your dynpro

Max

0 Kudos
115

Hi Marcin,

thanks for the reply but can you let me know how to do the same as i am very new to oops programing.

one more thing will i be able to download this header along with the records to the excel sheet.

<removed by moderator>

Many thanks,

Anuj.

Edited by: Anuj112143 on Nov 3, 2010 2:27 AM

Edited by: Thomas Zloch on Nov 3, 2010 10:02 AM

0 Kudos
115

HI Max,

for the report BCALV_TEST_GRID_EVENTS i am not getting the top of page display.

could you please help me on this. I have run this report but there is no top of page display.

Moreover in the top of page form i see a write statement.

We can not use write statement then how this write statement will trigger

Anuj

0 Kudos
115

thanks for the reply but can you let me know how to do the same as i am very new to oops programing.

The blog you have the link to has all necessary coding for this. Simply copy paste the code and do an analisys. It should be too difficult.

one more thing will i be able to download this header along with the records to the excel sheet.

waiting for your reply.

I am affraid not.

Regards

Marcin