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: 

ALV Grid Top-of_page

Former Member
0 Kudos

Hi Experts,

alv grid display. I want top-of-page. In the top of page . i want heading, time , date, customer no, customer name,

Like i want the heading in the center and time & date at the right corner and customer number and customer name at the left bottom.

example

heading : Customer Details Date : time:

customer number

customer name

Thanks Some of the experts have give me the sample . but i really coudnt undestand..(points will be given once this issue complets.)

gs_comment-typ = 'S'.

gs_comment-key = text-053.

gs_comment-info = p_year.

in this what should be given in list headers... and where to give the text-03... and how to poistion the field at any cornet of the top-of-page.

please help me out..

Thanks ,

sunita.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
9 REPLIES 9

Former Member
0 Kudos

Former Member
0 Kudos

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'F00007_USER_COMMAND'

i_callback_html_top_of_page = 'HTML_TOP_OF_PAGE'

it_fieldcat = g_t_fieldcat[]

it_events = gt_events[]

i_save = 'A'

TABLES

t_outtab = g_t_final_report[]

EXCEPTIONS

program_error = 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.

Use this form for top-of-page:

&----


*& Form html_top_of_page

&----


  • To Display the Top-of-page on the ALV

----


  • -->DOCUMENT text

----


FORM html_top_of_page USING document TYPE REF TO cl_dd_document.

DATA: text TYPE sdydo_text_element.

DATA: l_count(1).

DATA: text1 TYPE sdydo_text_element VALUE ', '.

CALL METHOD document->add_gap

EXPORTING

width = 500.

text = 'ABC report'.

CALL METHOD document->add_text

EXPORTING

text = text

sap_emphasis = 'Strong'.

CALL METHOD document->new_line.

CALL METHOD document->new_line.

text = 'Customer details'.

CALL METHOD document->add_text

EXPORTING

text = text

sap_emphasis = 'Strong'.

CALL METHOD document->add_gap

EXPORTING

width = 6.

WRITE s_period-low TO text MM/DD/YYYY.

CALL METHOD document->add_text

EXPORTING

text = 'Customer Name'

sap_style = 'KEY'.

CALL METHOD document->add_gap

EXPORTING

width = 20.

text = text-025.

CALL METHOD document->add_text

EXPORTING

text = 'Customer Number'

sap_emphasis = 'Strong'.

CALL METHOD document->add_gap

EXPORTING

width = 6.

WRITE s_period-high TO text MM/DD/YYYY.

"

"

"

"

CALL METHOD document->new_line.

ENDFORM. "html_top_of_page

reward if useful

regards,

Mansi.

0 Kudos

Hi manasi,

Thnx for the reply . But as am new to abap. i dont wanna like to use methords.

i want in alv-grid using commentry write.

Thnx

Sunita.

0 Kudos

Hi,

if you are using this FM you cann't achive your req. exactly.

Try to concatenate the space in your text whereever you want.

For example,

CONCATENATE ' Customer Details' ' Date:' sy-datum INTO str RESPECTING BLANKS.

ls_line-typ = 'S'.

ls_line-key = text-050.

ls_line-info = str. "text-010.

APPEND ls_line TO e04_lt_top_of_page.

hope it will helpful for you.

Reward if found helpful.

Regards,

SB

Former Member
0 Kudos

hi,

You cannot print it on the right side.

Whatever you give in top of page will appear just above the ALV.

For text-053. Kep the cursor in betn. text-053 and Double click . You will get a pop-up asking whether u want to create.

Click Yes and it will take you to text elements. Give the description for element 053, save and activate.

Regards,

Subramanian

Former Member
0 Kudos

Hi sunitha,

step 1: Display the top -of-page in ALV,declare the internal table & structure SLIS_T_EVENT, SLIS_ALV_EVENT.

step 2:Declared the title of the ALV page .

example:

DATA: I_TITLE_VBAK TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.

DATA: I_TITLE_VBAP TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.

step 3:Event poulated the top of pae.

example.

FORM POPULATE_EVENT.

READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.

IF SY-SUBRC EQ 0.

WA_EVENT-FORM = 'TOP_OF_PAGE'.

MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM

WHERE NAME = WA_EVENT-FORM.

ENDIF.

ENDFORM.

step 4: call function module pass the data.

example:

FORM EVENT_CALL.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = V_EVENTS

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

ENDFORM. "EVENT_CALL

Above steps all are compleds You can easly trigger the top of page. remaining Time and Date thes are part of the events,You search the slis_t_event.

Thanks,

SReddy.

Former Member
0 Kudos

Hi,

Use 'TOP_OF_PAGE_HTML', then only it will work, otherwise it will not work, given below speciman code.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = g_repid

i_callback_html_top_of_page = 'TOP_OF_PAGE_HTML'

i_callback_user_command = 'USER_COMMAND'

it_fieldcat = i_fldcat[]

it_sort = i_sort

TABLES

t_outtab = i_analytot[]

EXCEPTIONS

program_error = 1

OTHERS = 2.

FORM top_of_page_html USING cl_dd TYPE REF TO cl_dd_document.

DATA :

v_width TYPE i,

v_width1 TYPE i,

v_width2 TYPE i,

v_width3 TYPE i,

v_width4 TYPE i,

v_text TYPE sdydo_text_element,

v_text2 TYPE sdydo_text_element,

v_text3 TYPE sdydo_text_element,

v_text4 TYPE sdydo_text_element,

v_text5 TYPE sdydo_text_element,

v_text6 TYPE sdydo_text_element,

v_text7 TYPE sdydo_text_element.

*

v_width = c_60.

CONCATENATE 'User Name' sy-uname INTO v_text " User Name:

SEPARATED BY space.

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text

sap_emphasis = text-061.

*

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width.

*

v_text2 = text-062. "Report Description

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text2

sap_emphasis = text-062.

*

v_width1 = 65.

CONCATENATE text-063 sy-repid INTO v_text3 "Program name

SEPARATED BY space.

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width1.

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text3

sap_emphasis = text-060.

*****2nd line in header

v_text4 = text-064. "Date

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text4

sap_emphasis = text-064.

*

CONCATENATE sy-datum+6(2) '.'

sy-datum+4(2) '.'

sy-datum+0(4) INTO v_text4.

*

CONCATENATE ':' v_text4 INTO v_text4

SEPARATED BY space.

v_width2 = c_11.

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width2.

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text4

sap_emphasis = text-063.

*

v_text5 = text-065. "Time

v_width2 = c_191.

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width2.

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text5

sap_emphasis = text-060.

*

CONCATENATE

sy-uzeit+0(2) ':'

sy-uzeit+2(2) ':'

sy-uzeit+4(2) INTO v_text5.

CONCATENATE ':' v_text5 INTO v_text5

SEPARATED BY space.

*

v_width2 = c_4.

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width2.

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text5

sap_emphasis = text-060.

*****3rd line header

v_width3 = c_45.

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width3.

v_width4 = c_40.

CONCATENATE 'System ID' ':' sy-sysid INTO v_text6 "System ID:

SEPARATED BY space.

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text6

sap_emphasis = text-017.

*

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width4.

*****server name

v_text7 = 'Server'. "Server

v_width4 = c_164.

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width4.

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text7

sap_emphasis = text-017.

*

CONCATENATE ':' sy-host INTO v_text7

SEPARATED BY space.

v_width4 = c_2.

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width4.

*

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text7

sap_emphasis = text-017.

*

ENDFORM. "TOP_OF_PAGE_HTML

CALL METHOD cl_dd->add_text

EXPORTING

text = v_text

sap_emphasis = text-061.

*

CALL METHOD cl_dd->add_gap

EXPORTING

width = v_width.

endform.

regards

Rams

Edited by: ramesh on Jun 27, 2008 6:59 AM

0 Kudos

Hi Ramesh,

Thanks For your reply. Actually i never worked on methords. Can You please guide me this..

like i want header .. Vendor Open Item. (center)

time right side corner. date right side corner and i need 5 fields..like Company Name, Open item Key date,Company Code,Vendor number, vendor name...

so how to pass these values... please help me throught this....

Thanks In advance..

Suinta.

0 Kudos

use the blog

/people/community.user/blog/2007/05/07/alignment-of-data-in-top-of-page-in-alv-grid

it is very simple..