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: 

title in ALV OO

Former Member
0 Kudos

Hi Experts!!

How can I put a Title in the ALV OO?

I view this method SET_TITLE_TEXT (Sets Title Text) , but is protected.

I tried with event TOP_OF_PAGE, but nothig too.

form TOP_OF_PAGE using DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.

"this is more clear.....check it

"first add text, then pass it to comentry write fm

DATA : DL_TEXT(255) TYPE C. "Text

  • Populating header to top-of-page

BREAK iromon.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'Título'

SAP_STYLE = CL_DD_AREA=>HEADING.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

endform. " TOP_OF_PAGE

Anyone can help me? please

Thanks

12 REPLIES 12

Former Member
0 Kudos

Try using the below sample code:

data : dl_text(255) type c.
document->add_gap(
     width      = 1
                    ).

  document->add_text(
    EXPORTING
      text          = ABC Software Lab Inc.'
      sap_fontsize  = 'Large'
      sap_color     = cl_dd_area=>list_key_int
         ).
 CALL METHOD document->new_line.

 document->add_gap(
     width      = 4
                    ).

 document->add_text(
    EXPORTING
      text          = 'Report:  ZXYZ'
      sap_fontsize  = 'Medium'
         ).
 CALL METHOD document->new_line.

 document->add_gap(
     width      = 4
                    ).

 document->add_text(
    EXPORTING
      text          = 'Date:'
      sap_fontsize  = 'Medium'
         ).
CONCATENATE sy-datum+4(2) ' / ' sy-datum+6(2) ' / ' sy-datum(4)
into dl_text separated by cl_abap_char_utilities=>horizontal_tab.

call method document->add_text
    exporting
      text         = dl_text

.

0 Kudos

My problem is that it not pass for the event TOP_OF_PAGE and the ALV has not title.

I have this: SET HANDLER go_event->handle_top_of_page FOR o_grid_fase.

0 Kudos
My problem is that it not pass for the event TOP_OF_PAGE and the ALV has not title

.

Could you please be a more specific to it.What is the issue in my sample code.?

0 Kudos

Sorry for my English....

I have this:

  • Define

handle_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID

IMPORTING E_DYNDOC_ID.

  • Implementation

METHOD handle_TOP_OF_PAGE.

PERFORM TOP_OF_PAGE USING E_DYNDOC_ID.

ENDMETHOD. "handle_top_of_page

  • FORM

form TOP_OF_PAGE using DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.

"this is more clear.....check it

"first add text, then pass it to comentry write fm

DATA : DL_TEXT(255) TYPE C. "Text

  • Populating header to top-of-page

BREAK iromon.

CALL METHOD DG_DYNDOC_ID->ADD_TEXT

EXPORTING

TEXT = 'Título'

SAP_STYLE = CL_DD_AREA=>HEADING.

  • Add new-line

CALL METHOD DG_DYNDOC_ID->NEW_LINE.

endform. " TOP_OF_PAGE

SET HANDLER go_event->handle_top_of_page FOR o_grid_fase.

Never entry in the perform TOP_OF_PAGE

0 Kudos

Sorry. My English is not very good.

What I want is that when I display the ALV in dynro, show me a title, a header.

PRINT_TOP_OF_PAGE understand that the event is for when printed by the printer right?

I'm trying to use the event TOP_OF_PAGE, but do not know when that event occurs. Never fall into the routine I have for that event.

All I want is to show a title in the ALV screen.

I hope to explain better

0 Kudos

I find the solutión: wa_layout-GRID_TITLE = TITLE.

Thaks

0 Kudos
What I want is that when I display the ALV in dynro, show me a title, a header

Using the sample code provided above you can get a title and header.

PRINT_TOP_OF_PAGE understand that the event is for when printed by the printer right

Right...

I'm trying to use the event TOP_OF_PAGE, but do not know when that event occurs

In the OO ALV I don't expect that there will be a top-of-page. The ALV is displayed in a container. Outside the container you can create your own 'top-of-page', you can display there anything you want. Or you can create a 'bottom-of-page', or a 'side-of-page', as long as you create it outside of the container.

Refer the Link:

[Top-of-Page in OOALV|;

Let us know the solution how you achieved it. If resolved?

Close the thread. Have a good day.

0 Kudos

Please let us know the solution and close the thread if your issue is solved.

Thanks,

M Mishra

Former Member
0 Kudos

Hi Ivan,

You can use the event PRINT_TOP_OF_PAGE.

that will be present in the Print option.

here is the extra code you need to put.

definition:

METHODS:

print_top_of_page

FOR EVENT print_top_of_page OF cl_gui_alv_grid.

implementation.

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. "print_top_of_page

SET HANDLER event_receiver->print_top_of_page FOR g_grid1.

in this print_top_of_page implementation, you need to add the same content which you are adding in the top_of_page using write statements.

this will work only when you press PRINT/LIST OUtput option

Regards,

Md Ziauddin.

0 Kudos

I'm not need print my ALV , I only want view a title ( header) of ALV in the dynpro....:(

0 Kudos

So you want to print only the header in ALV not to display the ALV...Am i right ?Sorry but i find it difficult to understand.

Former Member
0 Kudos

Thaks