Skip to Content
0
Former Member
Apr 10, 2008 at 11:08 AM

header not displaying in alv report

13 Views

Hi,

I wrote a simple alv program . Header is not displaying on the output. I need the header to be "SALES LIST" . i have attached the program which i have written. Can ayone tell what's the mistake i have done.

Thanks,

REPORT ZALV_TEST.

TYPE-POOLS: SLIS.

TABLES: VBAK.

DATA: BEGIN OF I_VBAK OCCURS 0,

VBELN LIKE VBAK-VBELN,

ERDAT LIKE VBAK-ERDAT,

ERZET LIKE VBAK-ERZET,

ERNAM LIKE VBAK-ERNAM,

END OF I_VBAK.

DATA: FCAT TYPE SLIS_T_FIELDCAT_ALV,

HL1 TYPE SLIS_FIELDCAT_ALV,

EVENT TYPE SLIS_T_EVENT,

HL2 LIKE LINE OF EVENT,

LISTHEADER TYPE SLIS_T_LISTHEADER,

HL3 TYPE SLIS_LISTHEADER.

SELECT VBELN ERDAT ERZET ERNAM FROM VBAK INTO TABLE I_VBAK UP TO 15 ROWS.

PERFORM PREPARE_FIELDCATALOG.

PERFORM DISPLAY_HEADING.

PERFORM EVENT_BUILD.

PERFORM DISPLAY_LIST.

&----


*& Form PREPARE_FIELDCATALOG

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM PREPARE_FIELDCATALOG .

CLEAR HL1.

HL1-FIELDNAME = 'VBELN'.

HL1-TABNAME = 'I_VBAK'.

HL1-SELTEXT_M = 'SALES NO'.

APPEND HL1 TO FCAT.

CLEAR HL1.

CLEAR HL1.

HL1-FIELDNAME = 'ERDAT'.

HL1-TABNAME = 'I_VBAK'.

HL1-SELTEXT_M = 'DATE'.

APPEND HL1 TO FCAT.

CLEAR HL1.

CLEAR HL1.

HL1-FIELDNAME = 'ERZET'.

HL1-TABNAME = 'I_VBAK'.

HL1-SELTEXT_M = 'TIME'.

APPEND HL1 TO FCAT.

CLEAR HL1.

CLEAR HL1.

HL1-FIELDNAME = 'ERNAM'.

HL1-TABNAME = 'I_VBAK'.

HL1-SELTEXT_M = 'NAME'.

APPEND HL1 TO FCAT.

CLEAR HL1.

ENDFORM. " PREPARE_FIELDCATALOG

&----


*& Form DISPLAY_LIST

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_LIST .

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'SY-REPID'

I_STRUCTURE_NAME = 'i_vbak'

IT_FIELDCAT = FCAT

IT_EVENTS = EVENT

TABLES

T_OUTTAB = i_vbak

.

ENDFORM. " DISPLAY_LIST

&----


*& Form EVENT_BUILD

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM EVENT_BUILD .

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = EVENT

.

READ TABLE EVENT WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO HL2.

IF SY-SUBRC = 0.

HL2-FORM = 'TOPOFPAGE'.

modify event from hl2 index sy-tabix.

  • APPEND HL2 TO EVENT.

ENDIF.

ENDFORM. " EVENT_BUILD

FORM TOPOFPAGE.

*PERFORM DISPLAY_HEADING.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = LISTHEADER

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

ENDFORM.

&----


*& Form DISPLAY_HEADING

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM DISPLAY_HEADING .

CLEAR HL3.

HL3-TYP = 'H'.

HL3-INFO = 'SALES LIST'.

APPEND HL3 TO LISTHEADER.

CLEAR HL3.

ENDFORM. " DISPLAY_HEADING

Thanks,

Rose.