Skip to Content
0
Jul 03, 2007 at 02:52 PM

hi blocked alv report headers

21 Views

hi to all,

can any one help me regarding im doing one report from scratch and its output is blocked alv i.e. blocked alv report. and finally i got output but one thing headers are not displayed here . how can i do modification so that headers are displayed.

iam giving the code below.

REPORT ZMB51_1 .

----


  • TABLES *

----


TABLES: resb,eban,mkpf,mseg,makt,ekpo.

SELECTION-SCREEN BEGIN OF BLOCK select WITH FRAME TITLE text-010.

PARAMETERS:p_ibis LIKE MKPF-XBLNR.

SELECTION-SCREEN END OF BLOCK select. " Marcin Folek 20060724

  • Types Declaration

TYPE-POOLS: SLIS.

TYPES: BEGIN OF t_mkpf,

mblnr TYPE mblnr,

mjahr TYPE mjahr,

budat TYPE budat,

usnam TYPE usnam,

xblnr TYPE xblnr,

cputm TYPE cputm,

END OF t_mkpf.

TYPES: BEGIN OF t_mseg,

mblnr TYPE mblnr,

mjahr TYPE mjahr,

zeile TYPE mblpo,

matnr TYPE matnr,

dmbtr TYPE dmbtr,

END OF t_mseg.

TYPES: BEGIN OF t_resb,

rsnum TYPE rsnum,

matnr TYPE matnr,

lgort TYPE lgort_d,

bdter TYPE bdter,

bdmng TYPE bdmng,

banfn TYPE banfn,

aufnr TYPE aufnr,

pspel TYPE ps_posnr,

vornr TYPE vornr,

END OF t_resb.

TYPES: BEGIN OF t_makt,

matnr TYPE matnr,

spras TYPE spras,

maktx TYPE maktx,

END OF t_makt.

TYPES: BEGIN OF t_eban,

banfn TYPE matnr,

bnfpo TYPE spras,

matnr TYPE matnr,

frgdt TYPE frgdt,

lfdat TYPE eindt,

bedat TYPE bedat,

END OF t_eban.

TYPES: BEGIN OF t_ekpo,

ebeln TYPE ebeln,

ebelp TYPE ebelp,

matnr TYPE matnr,

txz01 TYPE txz01,

wepos TYPE wepos,

END OF t_ekpo.

TYPES: BEGIN OF t_res1,

rsnum TYPE rsnum,

matnr TYPE matnr,

maktx TYPE maktx,

xblnr TYPE xblnr,

aufnr TYPE aufnr,

vornr TYPE vornr,

pspel TYPE ps_posnr,

dmbtr TYPE dmbtr,

bdmng TYPE bdmng,

lgort TYPE lgort_d,

mblnr TYPE mblnr,

budat TYPE budat,

bdter TYPE bdter,

cputm TYPE cputm,

usnam TYPE usnam,

END OF t_res1.

TYPES: BEGIN OF t_res2,

xblnr TYPE xblnr,

banfn TYPE banfn,

txz01 TYPE txz01,

frgdt TYPE frgdt,

ebeln TYPE ebeln,

bedat TYPE bedat,

lfdat TYPE eindt,

wepos TYPE wepos,

dmbtr TYPE dmbtr,

bdmng TYPE bdmng,

END OF t_res2.

  • Structure Declaration

DATA: wa_mkpf TYPE t_mkpf,

wa_mseg TYPE t_mseg,

wa_makt TYPE t_makt,

wa_resb TYPE t_resb,

wa_eban TYPE t_eban,

wa_ekpo TYPE t_ekpo,

wa_res1 TYPE t_res1,

wa_res2 TYPE t_res2.

  • Internal table Declaration

DATA: it_mkpf TYPE TABLE OF t_mkpf INITIAL SIZE 0,

it_mseg TYPE TABLE OF t_mseg INITIAL SIZE 0,

it_makt TYPE TABLE OF t_makt INITIAL SIZE 0,

it_resb TYPE TABLE OF t_resb INITIAL SIZE 0,

it_eban TYPE TABLE OF t_eban INITIAL SIZE 0,

it_ekpo TYPE TABLE OF t_ekpo INITIAL SIZE 0,

it_res1 TYPE TABLE OF t_res1 INITIAL SIZE 0,

it_res2 TYPE TABLE OF t_res2 INITIAL SIZE 0.

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

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

DATA:HEAD TYPE slis_t_listheader WITH HEADER LINE.

DATA: I_fieldcat TYPE slis_t_fieldcat_alv,

*C-- Internal table to store field catalog1 for ALV display

i_fieldcat1 TYPE slis_t_fieldcat_alv,

*C-- Internal table to store events for ALV.

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

i_eve TYPE slis_t_event,

i_eve1 TYPE slis_t_event,

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

i_event TYPE slis_t_event with header line,

*C-- Internal table to store events for ALV.

i_event1 TYPE slis_t_event with header line,

*C-- Internal table to store layout for ALV.

i_alvly TYPE slis_layout_alv,

*C-- Internal table to store events for ALV.

i_alvly1 TYPE slis_layout_alv,

wa_fieldcat TYPE slis_fieldcat_alv,

wa_fieldcat1 TYPE slis_fieldcat_alv,

wa_event TYPE slis_alv_event,

wa_event1 TYPE slis_alv_event,

v_list_top_of_page TYPE slis_t_listheader,

This_program like sy-repid.

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

START-OF-SELECTION.

i_event1-NAME = 'TOP_OF_PAGE'.

i_event1-FORM = 'TOP_OF_PAGE1'.

APPEND i_event1.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = i_event[]

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.

READ TABLE i_event WITH KEY NAME = 'TOP_OF_PAGE'.

i_event-FORM = 'TOP_OF_PAGE'.

MODIFY i_event TRANSPORTING FORM WHERE NAME = 'TOP_OF_PAGE'.

SELECT mblnr

mjahr

budat

usnam

xblnr

cputm

FROM mkpf

INTO TABLE it_mkpf

WHERE xblnr EQ p_ibis.

CHECK sy-subrc EQ 0.

SELECT mblnr

mjahr

zeile

matnr

dmbtr

FROM mseg

INTO TABLE it_mseg

FOR ALL ENTRIES IN it_mkpf

WHERE mblnr EQ it_mkpf-mblnr

AND mjahr EQ it_mkpf-mjahr.

CHECK sy-subrc EQ 0.

SELECT rsnum

matnr

lgort

bdter

bdmng

banfn

aufnr

pspel

vornr

FROM RESB

INTO TABLE it_resb

FOR ALL ENTRIES IN it_mseg

WHERE matnr EQ it_mseg-matnr.

SELECT matnr

spras

maktx

FROM makt

INTO TABLE it_makt

FOR ALL ENTRIES IN it_mseg

WHERE matnr EQ it_mseg-matnr

AND spras EQ sy-langu.

SELECT banfn

bnfpo

matnr

frgdt

lfdat

bedat

FROM eban

INTO TABLE it_eban

FOR ALL ENTRIES IN it_mseg

WHERE matnr EQ it_mseg-matnr.

SELECT ebeln

ebelp

matnr

txz01

wepos

FROM ekpo

INTO TABLE it_ekpo

FOR ALL ENTRIES IN it_mseg

WHERE matnr EQ it_mseg-matnr.

SORT:

it_mseg BY matnr,

it_makt BY matnr,

it_resb BY matnr,

it_eban BY matnr,

it_ekpo BY matnr.

LOOP AT it_mkpf INTO wa_mkpf.

wa_res1-mblnr = wa_mkpf-mblnr.

wa_res1-xblnr = wa_mkpf-xblnr.

wa_res1-budat = wa_mkpf-budat.

wa_res1-cputm = wa_mkpf-cputm.

wa_res1-usnam = wa_mkpf-usnam.

wa_res2-xblnr = wa_mkpf-xblnr.

READ TABLE it_mseg INTO wa_mseg

WITH KEY mblnr = wa_mkpf-mblnr

BINARY SEARCH.

IF sy-subrc EQ 0.

wa_res1-dmbtr = wa_mseg-dmbtr.

wa_res2-dmbtr = wa_mseg-dmbtr.

ENDIF.

READ TABLE it_resb INTO wa_resb

WITH KEY matnr = wa_mseg-matnr

BINARY SEARCH.

IF sy-subrc EQ 0.

wa_res1-rsnum = wa_resb-rsnum.

wa_res1-aufnr = wa_resb-aufnr.

wa_res1-vornr = wa_resb-vornr.

wa_res1-pspel = wa_resb-pspel.

wa_res1-bdmng = wa_resb-bdmng.

wa_res1-lgort = wa_resb-lgort.

wa_res1-bdter = wa_resb-bdter.

wa_res2-bdmng = wa_resb-bdmng.

ENDIF.

READ TABLE it_makt INTO wa_makt

WITH KEY matnr = wa_mseg-matnr

BINARY SEARCH.

IF sy-subrc EQ 0.

wa_res1-matnr = wa_makt-matnr.

wa_res1-maktx = wa_makt-maktx.

ENDIF.

READ TABLE it_eban INTO wa_eban

WITH KEY matnr = wa_mseg-matnr

BINARY SEARCH.

IF sy-subrc EQ 0.

wa_res2-banfn = wa_eban-banfn.

wa_res2-frgdt = wa_eban-frgdt.

wa_res2-bedat = wa_eban-bedat.

wa_res2-lfdat = wa_eban-lfdat.

ENDIF.

READ TABLE it_ekpo INTO wa_ekpo

WITH KEY matnr = wa_mseg-matnr

BINARY SEARCH.

IF sy-subrc EQ 0.

wa_res2-ebeln = wa_ekpo-ebeln.

wa_res2-txz01 = wa_ekpo-txz01.

wa_res2-wepos = wa_ekpo-wepos.

ENDIF.

APPEND: wa_res1 TO it_res1,

wa_res2 TO it_res2.

CLEAR: wa_res1, wa_res2.

ENDLOOP.

  • FILLING THE FIELD CATALOG

wa_fieldcat-fieldname = 'RSNUM'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'RESERV_NO'.

wa_fieldcat-outputlen = '14'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'MATNR'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'MATERIAL'.

wa_fieldcat-outputlen = '18'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'MAKTX'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'MATERIAL DESCRIPTION'.

wa_fieldcat-outputlen = '25'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'XBLNR'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'IBIS#(Document header text)'.

wa_fieldcat-outputlen = '27'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'AUFNR'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'NETWORK'.

wa_fieldcat-outputlen = '20'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'VORNR'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'OpAc'.

wa_fieldcat-outputlen = '08'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'PSPEL'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'WBS ELEMENT'.

wa_fieldcat-outputlen = '12'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'DMBTR'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'AMOUNT $'.

wa_fieldcat-outputlen = '18'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'BDMNG'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'QUANTITY'.

wa_fieldcat-outputlen = '18'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'LGORT'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'SLOC'.

wa_fieldcat-outputlen = '08'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'MBLNR'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'MATERIAL DOC.'.

wa_fieldcat-outputlen = '15'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'BUDAT'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'PSTG Date'.

wa_fieldcat-outputlen = '12'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'BDTER'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'RESERV.REQUIREMENTS DATE'.

wa_fieldcat-outputlen = '25'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'CPUTM'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'TIME'.

wa_fieldcat-outputlen = '15'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

wa_fieldcat-fieldname = 'USNAM'.

wa_fieldcat-ref_tabname = 'IT_RES1'.

wa_fieldcat-seltext_l = 'USER'.

wa_fieldcat-outputlen = '15'.

APPEND wa_fieldcat TO i_fieldcat.

CLEAR wa_fieldcat.

  • second result starts

wa_fieldcat1-fieldname = 'BANFN'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'REQUISITION'.

wa_fieldcat1-outputlen = '15'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'FRGDT'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'REQUISITION DATE CREATED'.

wa_fieldcat1-outputlen = '25'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'TXZ01'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'DESCRIPTION'.

wa_fieldcat1-outputlen = '15'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'XBLNR'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'IBIS(Unknown Field)'.

wa_fieldcat1-outputlen = '20'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'EBELN'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'PO NUMBER'.

wa_fieldcat1-outputlen = '15'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'BEDAT'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'PO CREATED DATE'.

wa_fieldcat1-outputlen = '16'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'WEPOS'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'PO GOODS RECEIPT(X- Yes)'.

wa_fieldcat1-outputlen = '25'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'DMBTR'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'AMOUNT $'.

wa_fieldcat1-outputlen = '18'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'BDMNG'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'QTY'.

wa_fieldcat1-outputlen = '15'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

wa_fieldcat1-fieldname = 'LFDAT'.

wa_fieldcat1-ref_tabname = 'IT_RES2'.

wa_fieldcat1-seltext_l = 'DELIVERY DATE'.

wa_fieldcat1-outputlen = '15'.

APPEND wa_fieldcat1 TO i_fieldcat1.

CLEAR wa_fieldcat1.

This_program = sy-repid.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

i_callback_program = This_program.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = I_ALVLY

it_fieldcat = I_FIELDCAT

i_tabname = 'IT_RES1'

it_events = I_EVE

  • IT_SORT =

  • I_TEXT = ' '

tables

t_outtab = IT_RES1

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • MAXIMUM_OF_APPENDS_REACHED = 2

  • OTHERS = 3 .

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

is_layout = I_ALVLY1

it_fieldcat = I_FIELDCAT1

i_tabname = 'IT_RES2'

it_events = I_EVE1

  • IT_SORT =

  • I_TEXT = ' '

tables

t_outtab = IT_RES2

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • MAXIMUM_OF_APPENDS_REACHED = 2

  • OTHERS = 3 .

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

  • EXPORTING

  • I_INTERFACE_CHECK = ' '

  • IS_PRINT =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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

REFRESH HEAD.

HEAD-TYP = 'H'.

HEAD-INFO = 'Material Document/ Reservation IBIS Report (Standard)'.

APPEND HEAD.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = HEAD[].

ENDFORM.

FORM TOP_OF_PAGE1.

REFRESH HEAD.

HEAD-TYP = 'H'.

HEAD-INFO = 'PO/Requisition IBIS Report (Non-Standard)'.

APPEND HEAD.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = HEAD[].

ENDFORM.

Thanks & Regards,

Basha.