Skip to Content
0
Former Member
Dec 19, 2006 at 07:16 AM

how to mention subheadings in alv report

15 Views

hi all,

iam sending my report below.

here line items are coming but header is not coming anybody can tell me what shall i do .

report zmahi3.

TYPE-POOLS: SLIS.

DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,

L_LAYOUT type slis_layout_alv,

  • x_events type slis_alv_event,

it_events type slis_t_event with header line. "SLIS_T_EVENT.

DATA: BEGIN OF ITAB OCCURS 0,

VBELN LIKE VBAK-VBELN,

POSNR LIKE VBAP-POSNR,

MALE type i,

female type i,

  • PLANE(10),

  • ACTUAL(10),

  • PLANE1(10),

  • ACTUAL1(10),

END OF ITAB.

*

SELECT VBELN

POSNR

FROM VBAP

UP TO 20 ROWS

INTO TABLE ITAB.

X_FIELDCAT-FIELDNAME = 'VBELN'.

X_FIELDCAT-SELTEXT_L = text-020."'Planned cost'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 1.

X_FIELDCAT-OUTPUTLEN = 10 .

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'POSNR'.

X_FIELDCAT-SELTEXT_L = text-053."'Actual cost '.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 2."1.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'MALE'.

X_FIELDCAT-SELTEXT_L = 'MALE'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 3.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

X_FIELDCAT-FIELDNAME = 'FEMALE'.

X_FIELDCAT-SELTEXT_L = TEXT-T01."'FEMALE'.

X_FIELDCAT-TABNAME = 'ITAB'.

X_FIELDCAT-COL_POS = 3.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

it_events-NAME = SLIS_EV_TOP_OF_PAGE.

it_events-FORM = 'TOP_OF_PAGE'.

APPEND iT_EVENTS.

CLEAR it_events .

L_LAYOUT-NO_COLHEAD = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IS_LAYOUT = L_LAYOUT

IT_FIELDCAT = IT_FIELDCAT

it_events = it_events[]

TABLES

T_OUTTAB = ITAB

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

*-To display the headers for main list

FORMAT COLOR COL_HEADING.

WRITE: / SY-ULINE(143).

WRITE: / SY-VLINE,

(8) 'LAST YEAR' ,

  • SY-VLINE,

(10) ' ' ,

SY-VLINE,

  • (19) 'CURRENT YEAR'(020) centered,

(19) 'CURRENT YEAR'(020),

sy-vline.

WRITE: / SY-VLINE,

(8) 'PLANE'(053) ,

SY-VLINE,

(8) 'ACTUAL'(054) ,

SY-VLINE,

(8) 'MALE'(056) ,

sy-vline,

(9) 'FEMALE'(057) ,

sy-vline.

FORMAT COLOR OFF.

**

ENDFORM.

thanks,

maheedhar.t