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

REUSE_ALV_COMMENTARY_WRITE

Former Member
0 Likes
1,978

The function 'REUSE_ALV_COMMENTARY_WRITE' is not getting executed in my program and i dont know whats the problem so anyone kindly suggest another method which can substitute 'REUSE_ALV_COMMENTARY_WRITE' and which takes the same parameters as 'REUSE_ALV_COMMENTARY_WRITE' which can display logo and header info.

The function 'REUSE_ALV_COMMENTARY_WRITE' is not getting executed in my program and i dont know whats the problem so anyone kindly suggest another method which can substitute 'REUSE_ALV_COMMENTARY_WRITE' and which takes the same parameters as 'REUSE_ALV_COMMENTARY_WRITE' which can display logo and header info.

12 REPLIES 12
Read only

Former Member
0 Likes
1,733

Do you have a TOP of PAGE event, where you are calling this function?

regards,

Ravi

Read only

0 Likes
1,733

Yeh ravi i do have top of page event and even then the mthod is not getting executed suggest some solution.

Read only

0 Likes
1,733

Hi,

Check this sample code.

DATA: i_events TYPE slis_t_event.

DATA: i_header TYPE slis_t_listheader.

PERFORM f3000_build_header CHANGING i_header.

PERFORM f4000_events_init CHANGING i_events.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = report_id

is_layout = i_layout

it_fieldcat = i_fieldcat

i_save = 'A'

<b> it_events = i_events</b>

TABLES

t_outtab = i_data

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.

FORM f3000_build_header USING i_header TYPE slis_t_listheader.

DATA: gs_line TYPE slis_listheader.

CLEAR gs_line.

gs_line-typ = 'H'.

gs_line-info = 'This is line of type HEADER'.

APPEND gs_line TO i_header.

CLEAR gs_line.

gs_line-typ = 'S'.

gs_line-key = 'STATUS 1'.

gs_line-info = 'This is line of type STATUS'.

APPEND gs_line TO i_header.

gs_line-key = 'STATUS 2'.

gs_line-info = 'This is also line of type STATUS'.

APPEND gs_line TO i_header.

CLEAR gs_line.

gs_line-typ = 'A'.

gs_line-info = 'This is line of type ACTION'.

APPEND gs_line TO i_header.

ENDFORM. " f3000_build_header

&----


*& Form f4000_events_init

&----


FORM f4000_events_init CHANGING i_events TYPE slis_t_event.

<b>DATA: line_event TYPE slis_alv_event.

CLEAR line_event.

line_event-name = 'TOP_OF_PAGE'.

line_event-form = 'F4100_TOP_OF_PAGE'.

APPEND line_event TO i_events.</b>

ENDFORM. " f3000_events_init

----


  • FORM F4100_TOP_OF_PAGE *

----


FORM f4100_top_of_page.

<b>CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = i_header.</b>

ENDFORM.

Read only

Former Member
0 Likes
1,733

&----


*& Form sub_event_call

&----


  • text

----


  • -->P_V_EVENTS_REPL text

----


FORM sub_event_call USING p_v_events.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = p_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. " sub_event_call

*&----


*& Form POPULATE_EVENT

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


FORM populate_event.

CLEAR wa_event.

IF rb_crt = 'X'.

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

&----


*& Form TOP_OF_PAGE

&----


  • text

----


----


FORM 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.

    • Title

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'.

ENDFORM. "TOP_OF_PAGE

Pass the v_events table to it_events of REUSE_ALV_GRID_DISPLAY

Read only

former_member508729
Active Participant
0 Likes
1,733

Hi Ravi,

if you are using reuse_alv_list_display to display your data then you cant display graphics on the top of a list.

you have to use reuse_alv_grid_display Fm and in that you have to pass form name 'Top_of_page' but before that you have to capture the event top_of_page using FM reuse_alv_events_get.

then you have to define form top_of_page --endform in which you have to populate the parameters and call FM REUSE_ALV_COMMENTARY_WRITE.

Hope this will help you.

regards

Ashutosh

PS: reward points if helpful.

Read only

Former Member
0 Likes
1,733

I have debugged the code the pointer is moving upto call method reuse_alv_commentary_write in the form top_of_page .... endform but the methd is not getting executed , the pointer is skipping the lines after the call method reuse_alv_commentary_write and i am not able to print the logo and header info.

Read only

0 Likes
1,733

Hi Ravi,

Would it be ok if you post your code here?

Read only

0 Likes
1,733

sorry cris i cannot post my code.

Read only

Former Member
0 Likes
1,733

Hi!

Use a Similar code Snippet. It works!

FORM GET_EVENTS .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = I_EVENTS

EXCEPTIONS

LIST_TYPE_WRONG = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

ENDIF.

*--Calling the User Defined sub-routines for ALV Events

IF NOT I_EVENTS[] IS INITIAL.

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

WA_EVENT-FORM = 'HEADER'.

MODIFY I_EVENTS FROM WA_EVENT INDEX SY-TABIX.

ENDIF.

ENDFORM. " GET_EVENTS

&----


*& Form HEADER

&----


  • Displaying Header-Text and Logo on Grid

----


FORM HEADER.

CLEAR I_COMMENT[].

WA_COMMENT-TYP = 'H'.

WA_COMMENT-INFO = 'Some Header Text'.

APPEND WA_COMMENT TO I_COMMENT.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = I_COMMENT

I_LOGO = 'LOGO NAME'.

  • I_END_OF_LIST_GRID = 'X'.

ENDFORM. "

The PERFORM GET_EVENTS has to be called in the program (maybe in END-OF-SELECTION).

Also I_EVENTS has to be passed to REUSE_ALV_GRID_DISPLAY func.module.

Message was edited by:

kiret B

Read only

Former Member
0 Likes
1,733

Hi

Plz try a code similar to the one give below :

type-pools : slis .

****NO END-OF-SELECTION HERE AS WE DON'T USE WRITE STATMNTS IN ALV***

tables : mara , mard , makt .

data : begin of itab occurs 0 ,

f1 type <specify type> ,

f2 type <specify type> ,

fn type <specify type>,

end of itab .

****************fieldcatalog*********************

data:anytab type slis_t_fieldcat_alv with header line.

**************pgm name**********************

data:anypgnm type sy-repid.

**************events*************************

data : events type slis_t_event.

****************start of selection ***************

start-of-selection.

perform build_itab. "Populate itab with data

perform build_fieldcat. " Build fieldcatalog

perform display. " call reuse_alv_grid_display FM

perform my_events. " call events FM

top-of-page.

perform top_page. " for displaying header data

************************

Subroutines

************************

form top_page.

data : t_header type slis_t_listheader,

wa_header type slis_listheader,

t_line like wa_header-info,

ld_lines type i,

ld_linesc(10) type c.

wa_header-typ = 'H'. " H is 4 big heading.

wa_header-info = '<header info to b displayed>'.

append wa_header to t_header.

clear wa_header.

*Date

wa_header-typ = 'S'. "S is 4 small stmnts.

wa_header-key = 'Date: '.

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

sy-datum+4(2) '.'

sy-datum(4) into wa_header-info. "todayz date.

append wa_header to t_header.

clear: wa_header.

wa_header-typ = 'S'.

wa_header-key = ' Field: '.

wa_header-info = <pass name of field f1>.

append wa_header to t_header.

clear wa_header.

wa_header-typ = 'S'.

wa_header-key = 'Field2: '.

wa_header-info = <Pass name of field f2> .

append wa_header to t_header.

clear wa_header.

call function 'REUSE_ALV_COMMENTARY_WRITE'

exporting

it_list_commentary = t_header .

  • I_LOGO =

  • I_END_OF_LIST_GRID =

.

endform. " TOP_PAGE

form my_events.

data: ls_event type slis_alv_event.

call function 'REUSE_ALV_EVENTS_GET'

exporting

i_list_type = 0

importing

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

Plz try it ....or work on similar lines

Read only

Former Member
0 Likes
1,733

resolved

Read only

0 Likes
1,733

hello ravi,

i m also facing same problem. i m unable to find the program mistake. it was worked my previous program manullay populated the field catlog. but present program used ALV_Field_catalog_merge. i really unable to small mistake. if you could provide the solution. that will be gr8

Regards

Arayn