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: 

REUSE_ALV_COMMENTARY_WRITE not writing the the the hearder Lines in ECC 6.0

Former Member
0 Kudos

Hi Experts,

I am using 'REUSE_ALV_COMMENTARY_WRITE' to write top of paGe in ALV display.

But it only display blank space in the header.

Any suggestions?

here is the code:

FORM top_of_page. "#EC CALLED

CLEAR : wa_commentary,

it_commentary,

it_commentary[].

MOVE sy-datum TO lv_date.

WRITE lv_date USING EDIT MASK '__.__.____' TO lv_date1.

CONCATENATE text-006 text-010 lv_date1 INTO lv_header_info SEPARATED BY space.

MOVE co_h TO wa_commentary-typ.

MOVE lv_header_info TO wa_commentary-info.

APPEND wa_commentary TO it_commentary.

SHIFT so_matnr-high LEFT DELETING LEADING '0'.

SHIFT so_matnr-low LEFT DELETING LEADING '0'.

IF so_matnr-high NE space.

CONCATENATE text-011 text-010 so_matnr-low text-016 so_matnr-high INTO lv_header_info SEPARATED BY space.

ELSE.

CONCATENATE text-011 text-010 so_matnr-low INTO lv_header_info SEPARATED BY space.

ENDIF.

MOVE co_s TO wa_commentary-typ.

MOVE lv_header_info TO wa_commentary-info.

APPEND wa_commentary TO it_commentary.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = it_commentary.

ENDFORM. "top_of_page

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

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = lv_repid

it_fieldcat = it_fieldcat

i_callback_top_of_page = 'TOP_OF_PAGE'

TABLES

t_outtab = it_sapnodiff

EXCEPTIONS

program_error = 1

OTHERS = 2.

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

Regards

Saroj

5 REPLIES 5

Jelena
Active Contributor
0 Kudos

Your code is missing data declarations and is, I think, a bit more complex than necessary (also you didn't use the code tags), but here is a fragment that works:

FORM alv_top_of_page.

*ALV Header declarations
  DATA: t_header TYPE slis_t_listheader,
        wa_header TYPE slis_listheader.

  wa_header-typ  = 'S'.
  wa_header-key = 'Project: '.
  APPEND wa_header TO t_header.
  wa_header-key = 'Title: '.
  wa_header-info = wa_alv_report-wbs_desc.
  APPEND wa_header TO t_header.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = t_header.

ENDFORM.                    "ALV_TOP_OF_PAGE

Run your code through debugger and make sure that it enters the subroutine and that the data is actually there.

Former Member
0 Kudos

Hi,

It does not work. I have tried all options.

It's happening even to standrad reports where there two function modul;es are used.

REUSE_ALV_COMMENTARY_WRITE

REUSE_ALV_GRID_DISPLAY

Regards

Saroj

Former Member
0 Kudos

Hi,

This should work. Please try

Thanks!

Sandeep

TYPE-POOLS: SLIS.
DATA      : TBL_FCAT TYPE SLIS_FIELDCAT_ALV OCCURS 0 WITH HEADER LINE,
            TBL_SORTFIELDS TYPE SLIS_T_SORTINFO_ALV,
            G_LAYOUT TYPE SLIS_LAYOUT_ALV.

DATA: FLD_CAT TYPE SLIS_FIELDCAT_ALV.
DATA: T_EVENTS TYPE SLIS_T_EVENT.
  
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM     = SY-REPID
            I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
            IS_LAYOUT              = G_LAYOUT
            IT_FIELDCAT            = TBL_FCAT[]
       TABLES
            T_OUTTAB               = TABLE_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.

FORM BUILD_EVENT .

  DATA: WA_EVENTS LIKE LINE OF T_EVENTS.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       IMPORTING
            ET_EVENTS       = T_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.
  ELSE.
    READ TABLE T_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                                                  INTO WA_EVENTS.
    IF SY-SUBRC = 0.
      WA_EVENTS-FORM = 'TOP_OF_PAGE'.
      MODIFY T_EVENTS FROM WA_EVENTS INDEX SY-TABIX TRANSPORTING FORM.
    ENDIF.
  ENDIF.

ENDFORM.                    " build_event


FORM TOP_OF_PAGE.

  DATA: IT_COMMENTARY TYPE SLIS_T_LISTHEADER,
        WA_IT_COMMENTARY TYPE SLIS_T_LISTHEADER WITH HEADER LINE.
  DATA : L_BDATE(10) TYPE C,
  L_EDATE(10) TYPE C.

  WA_IT_COMMENTARY-INFO = SY-TITLE.

  WA_IT_COMMENTARY-TYP = 'H'.
  APPEND WA_IT_COMMENTARY TO IT_COMMENTARY.

  CLEAR: L_BDATE, EDATE.

  WRITE SY-DATUM TO L_BDATE MM/DD/YYYY.
  WRITE SY-UZEIT TO L_EDATE USING EDIT MASK '__:__:__'.
  CONDENSE L_EDATE.

  CONCATENATE 'System Date/System time'(026) L_BDATE '/' L_EDATE INTO
  WA_IT_COMMENTARY-INFO SEPARATED BY SPACE.

  WA_IT_COMMENTARY-TYP = 'S'.
  APPEND WA_IT_COMMENTARY TO IT_COMMENTARY.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
       EXPORTING
            IT_LIST_COMMENTARY = IT_COMMENTARY. 

Edited by: sandeep reddy on Jun 4, 2010 1:06 AM

Former Member
0 Kudos

Hi ,

Your code seems correct ,

what you can do is , just put a debugger inside your Top_of_page perform and see whether soem value is getting populated in table it_commentary.

Regards,

Uma

Former Member
0 Kudos

may be useful for u.....check it

http://www.sapnet.ru/viewtopic.php?p=3011