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

Header information for drill down report

Former Member
0 Likes
497

I am using REUSE_ALV_COMMENTARY_WRITE to write header information to my ALV report.

In my ALV, i am creating a drill down report based on field selection.

The same header is getting repeated in the secondary report too.

Is there any way i can create a new header for this secondary report...

Points will be awarded ..

Thanks in advance

I am using REUSE_ALV_COMMENTARY_WRITE to write header information to my ALV report.

In my ALV, i am creating a drill down report based on field selection.

The same header is getting repeated in the secondary report too.

Is there any way i can create a new header for this secondary report...

Points will be awarded ..

Thanks in advance

2 REPLIES 2
Read only

Former Member
0 Likes
466

Hi narendra,

You can check the field sy-lsind and based on the same change the content of the header information.

Reward points if useful.

Regards,

Atish

Read only

Former Member
0 Likes
466

See the example program and do compare

TYPE-POOLS: SLIS.

DATA: BEGIN OF GT_OUTTAB OCCURS 0.

INCLUDE STRUCTURE SFLIGHT.

DATA: END OF GT_OUTTAB,

GS_LAYOUT TYPE SLIS_LAYOUT_ALV,

G_EXIT_CAUSED_BY_CALLER,

GS_EXIT_CAUSED_BY_USER TYPE SLIS_EXIT_BY_USER,

G_REPID LIKE SY-REPID.

*"Callback

DATA:

GT_EVENTS TYPE SLIS_T_EVENT,

GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,

G_STATUS_SET TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',

G_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',

G_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',

G_TOP_OF_LIST TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',

G_END_OF_LIST TYPE SLIS_FORMNAME VALUE 'END_OF_LIST'.

*"Variants

DATA: GS_VARIANT LIKE DISVARIANT,

G_SAVE.

INITIALIZATION.

G_REPID = SY-REPID.

PERFORM LAYOUT_INIT USING GS_LAYOUT.

PERFORM EVENTTAB_BUILD USING GT_EVENTS[].

GS_VARIANT-REPORT = G_REPID.

G_SAVE = 'A'.

START-OF-SELECTION.

*"Data Selection

PERFORM SELECT_DATA TABLES GT_OUTTAB.

END-OF-SELECTION.

*"List Header for Top-Of-Page

PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].

*"Display List

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

  • I_BACKGROUND_ID = 'ALV_BACKGROUND'

i_buffer_active = 'X'

I_CALLBACK_PROGRAM = G_REPID

I_STRUCTURE_NAME = 'SFLIGHT'

IS_LAYOUT = GS_LAYOUT

I_SAVE = G_SAVE

IS_VARIANT = GS_VARIANT

IT_EVENTS = GT_EVENTS[]

  • I_SCREEN_START_COLUMN = 0 "Use coordinates for

  • I_SCREEN_START_LINE = 0 "display as dialog box

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

IMPORTING

E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER

ES_EXIT_CAUSED_BY_USER = GS_EXIT_CAUSED_BY_USER

TABLES

T_OUTTAB = GT_OUTTAB

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF SY-SUBRC = 0.

IF G_EXIT_CAUSED_BY_CALLER = 'X'.

*" Forced Exit by calling program

*" <do_something>.

ELSE.

*" User left list via F3, F12 or F15

IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'. "F3

*" <do_something>.

ELSE.

IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'. "F15

*" <do_something>.

ELSE.

IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12

*" <do_something>.

ELSE.

*" should not occur!

*" <do_Abnormal_End>.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ELSE.

*"Fatal error callin ALV

  • MESSAGE AXXX(XY) WITH ...

ENDIF.

*"Form routines

"

FORM SELECT_DATA TABLES RT_OUTTAB LIKE GT_OUTTAB[].

*"- Selection of data to be displayed

SELECT * FROM SFLIGHT INTO CORRESPONDING FIELDS

OF TABLE RT_OUTTAB

UP TO 00030 ROWS.

ENDFORM.

FORM LAYOUT_INIT USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.

*"Build layout for list display

RS_LAYOUT-DETAIL_POPUP = 'X'.

ENDFORM.

FORM EVENTTAB_BUILD USING RT_EVENTS TYPE SLIS_T_EVENT.

*"Registration of events to happen during list display

DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

*

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = RT_EVENTS.

READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE

INTO LS_EVENT.

IF SY-SUBRC = 0.

MOVE G_TOP_OF_PAGE TO LS_EVENT-FORM.

APPEND LS_EVENT TO RT_EVENTS.

ENDIF.

ENDFORM.

"

FORM TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

I_LOGO = 'ENJOYSAP_LOGO'

IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.

ENDFORM.

"

FORM COMMENT_BUILD USING LT_TOP_OF_PAGE TYPE

SLIS_T_LISTHEADER.

DATA: LS_LINE TYPE SLIS_LISTHEADER.

*

  • LIST HEADING LINE: TYPE H

CLEAR LS_LINE.

LS_LINE-TYP = 'H'.

  • LS_LINE-KEY: NOT USED FOR THIS TYPE

LS_LINE-INFO = TEXT-100.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

  • STATUS LINE: TYPE S

CLEAR LS_LINE.

LS_LINE-TYP = 'S'.

LS_LINE-KEY = TEXT-101.

LS_LINE-INFO = TEXT-102.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

LS_LINE-KEY = TEXT-103.

LS_LINE-INFO = TEXT-104.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

  • ACTION LINE: TYPE A

CLEAR LS_LINE.

LS_LINE-TYP = 'A'.

  • LS_LINE-KEY: NOT USED FOR THIS TYPE

LS_LINE-INFO = TEXT-105.

APPEND LS_LINE TO LT_TOP_OF_PAGE.

ENDFORM.