02-02-2008 4:27 AM
I WANT DISPLAY SOME DATA IN HEADER USING GRID ALV?
IM WORKED IN PM MODULE I HAVE DISPLAY SOME DATA FROM ILOA,ITOB,QALS FIELDS TAKEN FROM THESE TABLE AND DISPLAY IN HEADER PLZ SEND URGENT
02-02-2008 4:29 AM
Hi,
See this link.
[http://www.sapdev.co.uk/reporting/alv/alvgrid_rephead.htm]
Cheers,
Will.
02-02-2008 4:42 AM
Hi,
I jope the following example wil help you to display the data in header of alv grid.
DISPLAY HEADER IN ALV GRID.
TABLES VBAK.
TYPE-POOLS SLIS.
Data Declaration
TYPES: BEGIN OF T_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
VKGRP TYPE VBAK-VKGRP,
END OF T_VBAK.
DATA IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0.
ALV Data Declaration
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FLDCAT TYPE SLIS_FIELDCAT_ALV,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BLD_FLDCAT.
PERFORM BLD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
Build Field Catalog for ALV Report
FORM BLD_FLDCAT.
W_FLDCAT-FIELDNAME = 'VBELN'.
W_FLDCAT-SELTEXT_M = 'Sales Document'.
W_FLDCAT-COL_POS = 0.
*W_FLDCAT-EMPHASIZE = 'C411'.
W_FLDCAT-OUTPUTLEN = 20.
W_FLDCAT-KEY = 'X'.
W_FLDCAT-ICON = 'X'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'ERDAT'.
W_FLDCAT-SELTEXT_L = 'Record Date created'.
W_FLDCAT-COL_POS = 1.
W_FLDCAT-KEY = 'X'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'ERNAM'.
W_FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'AUDAT'.
W_FLDCAT-SELTEXT_M = 'Document Date'.
W_FLDCAT-COL_POS = 3.
W_FLDCAT-EMPHASIZE = 'C110'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'VBTYP'.
W_FLDCAT-SELTEXT_L = 'SD Document category'.
W_FLDCAT-COL_POS = 4.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'NETWR'.
W_FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
W_FLDCAT-COL_POS = 5.
W_FLDCAT-OUTPUTLEN = 60.
W_FLDCAT-DO_SUM = 'X'.
W_FLDCAT-DATATYPE = 'CURR'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'VKORG'.
W_FLDCAT-SELTEXT_L = 'Sales Organization'.
W_FLDCAT-COL_POS = 6.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'VKGRP'.
W_FLDCAT-SELTEXT_M = 'Sales Group'.
W_FLDCAT-COL_POS = 7.
W_FLDCAT-EMPHASIZE = 'C801'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
ENDFORM.
Build Layout for ALV Grid Report
FORM BLD_LAYOUT.
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
*GD_LAYOUT-NO_SCROLLING = 'X'.
GD_LAYOUT-BOX_FIELDNAME = 'VBELN'.
ENDFORM.
Display report using ALV grid
FORM DISPLAY_ALV_REPORT.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
IS_LAYOUT = GD_LAYOUT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
IT_FIELDCAT = FLDCAT[]
I_SAVE = 'X'
TABLES
T_OUTTAB = IT_VBAK
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.
ENDFORM.
Retrieve data from VBAK table and populate itab IT_VBAK
FORM DATA_RETRIEVAL.
SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
UP TO 50 ROWS
FROM VBAK
INTO TABLE IT_VBAK.
ENDFORM.
FORM TOP_OF_PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER.
W_HEADER-TYP = 'H'.
W_HEADER-INFO = 'WELCOME HEADER LIST'.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'REPORT:'.
W_HEADER-INFO = SY-REPID.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'DATE:'.
CONCATENATE SY-DATUM4(2) ' / ' SY-DATUM6(2) ' / ' SY-DATUM(4) INTO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR W_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'Page No:'.
W_HEADER-INFO = SY-PAGNO.
APPEND W_HEADER TO T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM.
IF U NEDD ANY FURTHER INFORMATION THEN I WILL PROVIDE.
REWARD POINTS,IF IT IS HELPFUL,
THANKS,
CHANDU.