How to include a Header in Hierarchy List (ALV)?
Hi Gurus,
If we need to include any header in ALV Grid, then we generate an event and pass that header to TOP_OF_PAGE event. We do have I_CALLBACK_TOP_OF_PAGE parameter for the REUSE_ALV_GRID_DISPLAY function module.
But how do I generate a Header for a Hierarchy List? I do not find any parameter for TOP_OF_PAGE event. Please help with inputs.
Regards,
Kiran
Hi Kiran,
The following codes are very useful to you...
If any problem let me know...
REPORT zxxxxxxxxxxxxxx LINE-SIZE 220
LINE-COUNT 50(5).
*& DATA DECLARATION *
TABLES: MARA, "GENERAL MASTER DATA
MARC, "PLANT DATA FOR MATERIAL
MARD, "STORAGE LOCATION DATA FOR MATERIAL
MBEW, "MATERIAL VALUATION
MVKE, "SALES DATA FOR MATERIAL
MAKT, "MATERIAL DESCRIPTION
EKKO, "PURCHASING DOCUMENT HEADER
EKPO, "PURCHASING DOCUMENT ITEM
VBAK, "SALES DOCUMENT HEADER DATA
VBAP. "SALES DOCUMENT ITEM DATA
TYPE-POOLS : SLIS.
DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
V_LAYOUT TYPE SLIS_LAYOUT_ALV,
BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR, "MATERIAL NUMBER
MBRSH LIKE MARA-MBRSH, "INDUSTRY SECTOR
MEINS LIKE MARA-MEINS, "BASE UNIT OF MEASURE
MATKL LIKE MARA-MATKL, "MATERIAL GROUP
END OF I_MARA,
BEGIN OF I_MARC OCCURS 0,
MATNR LIKE MARC-MATNR, "MATERIAL NUMBER
WERKS LIKE MARC-WERKS, "PLANT
LVORM LIKE MARC-LVORM, "FLAG MATERIAL FOR DELETION AT PLANT
"LEVEL
DISPO LIKE MARC-DISPO, "MRP CONTROLLER
END OF I_MARC,
BEGIN OF I_MAKT OCCURS 0,
MATNR LIKE MAKT-MATNR, "MATERIAL NUMBER
MAKTX LIKE MAKT-MAKTX, "MATERIAL DESCRIPTION
SPRAS LIKE MAKT-SPRAS, "LANGUAGE KEY
END OF I_MAKT,
BEGIN OF I_MVKE OCCURS 0,
MATNR LIKE MVKE-MATNR, "MATERIAL NUMBER
VKORG LIKE MVKE-VKORG, "SALES ORGANIZATION
VTWEG LIKE MVKE-VTWEG, "DISTRIBUTION CHANNEL
END OF I_MVKE,
BEGIN OF I_MARD OCCURS 0,
MATNR LIKE MARD-MATNR, "MATERIAL NUMBER
LGORT LIKE MARD-LGORT, "STORAGE LOCATION
LABST LIKE MARD-LABST, "VALUATED STOCK WITH UNRESTRICTED USE
END OF I_MARD,
BEGIN OF I_EKPO OCCURS 0,
EBELN LIKE EKPO-EBELN, "PURCHASING DOCUMENT NUMBER
EBELP LIKE EKPO-EBELP, "ITEM NUMBER OF PURCHASING DOCUMENT
MATNR LIKE EKPO-MATNR, "MATERIAL NUMBER
END OF I_EKPO,
BEGIN OF I_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
END OF I_VBAP,
BEGIN OF I_OUT OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
LVORM LIKE MARC-LVORM,
DISPO LIKE MARC-DISPO,
MBRSH LIKE MARA-MBRSH,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
VKORG LIKE MVKE-VKORG,
VTWEG LIKE MVKE-VTWEG,
SPRAS LIKE MAKT-SPRAS,
MAKTX LIKE MAKT-MAKTX,
LGORT LIKE MARD-LGORT,
LABST LIKE MARD-LABST,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
VBELN LIKE VBAP-VBELN,
POSNR LIKE VBAP-POSNR,
END OF I_OUT,
BEGIN OF I_HEADING OCCURS 0,
TEXT1(20),
TEXT2(20),
TEXT3(20),
TEXT4(20),
TEXT5(20),
TEXT6(20),
TEXT7(20),
TEXT8(20),
TEXT9(20),
TEXT10(20),
TEXT11(40),
TEXT12(20),
TEXT13(20),
TEXT14(20),
TEXT15(20),
TEXT16(20),
TEXT17(20),
END OF I_HEADING.
*& S E L E C T I O N - S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
S_DISPO FOR MARC-DISPO,
S_EBELN FOR EKPO-EBELN .
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
PARAMETERS : RB1 RADIOBUTTON GROUP G1,
RB2 RADIOBUTTON GROUP G1,
RB3 RADIOBUTTON GROUP G1.
SELECTION-SCREEN END OF BLOCK B2.
*& S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
SELECT MATNR WERKS LVORM DISPO FROM MARC
INTO CORRESPONDING FIELDS OF TABLE I_MARC
WHERE MATNR IN S_MATNR
AND DISPO IN S_DISPO
AND WERKS = P_WERKS.
IF I_MARC[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
EXIT.
ENDIF.
PERFORM PURCHASEDATA_VALIDATION.
PERFORM SALESDATA_VALIDATION.
SELECT MATNR LGORT LABST FROM MARD INTO TABLE I_MARD
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND WERKS EQ P_WERKS
AND LGORT IN S_LGORT.
IF I_MARD[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
EXIT.
ENDIF.
SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
IF I_MVKE[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
EXIT.
ENDIF.
LOOP AT I_MARC.
MOVE-CORRESPONDING I_MARC TO I_OUT.
CLEAR MARC.
SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
INTO CORRESPONDING FIELDS OF MARA
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MARA-MBRSH TO I_OUT-MBRSH,
MARA-MEINS TO I_OUT-MEINS,
MARA-MATKL TO I_OUT-MATKL.
ELSE.
CONTINUE.
ENDIF.
SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
INTO CORRESPONDING FIELDS OF MAKT
WHERE MATNR = I_OUT-MATNR.
IF SY-SUBRC = 0.
MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
MAKT-SPRAS TO I_OUT-SPRAS.
ELSE.
CONTINUE.
ENDIF.
LOOP AT I_EKPO WHERE MATNR = I_MARC-MATNR.
MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
I_EKPO-EBELP TO I_OUT-EBELP.
ENDLOOP.
LOOP AT I_VBAP WHERE MATNR = I_MARC-MATNR.
MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
I_VBAP-POSNR TO I_OUT-POSNR.
ENDLOOP.
LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
MOVE: I_MARD-LABST TO I_OUT-LABST,
I_MARD-LGORT TO I_OUT-LGORT.
ENDLOOP.
LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
I_MVKE-VTWEG TO I_OUT-VTWEG.
APPEND I_OUT.
ENDLOOP.
CLEAR I_OUT.
ENDLOOP.
PERFORM OPTIONS.
FORM OPTIONS *
FORM OPTIONS.
IF RB2 = 'X'.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ELSE.
IF RB1 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
ELSE.
IF RB3 = 'X'.
PERFORM HEADINGS.
PERFORM DLOAD.
PERFORM FIELDCAT.
PERFORM OUTPUT.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "OPTIONS
FORM HEADINGS *
FORM HEADINGS.
I_HEADING-TEXT1 = 'MATNR'.
I_HEADING-TEXT2 = 'WERKS'.
I_HEADING-TEXT3 = 'LVORM'.
I_HEADING-TEXT4 = 'DISPO'.
I_HEADING-TEXT5 = 'MBRSH'.
I_HEADING-TEXT6 = 'MEINS'.
I_HEADING-TEXT7 = 'MATKL'.
I_HEADING-TEXT8 = 'VKORG'.
I_HEADING-TEXT9 = 'VTWEG'.
I_HEADING-TEXT10 = 'SPRAS'.
I_HEADING-TEXT11 = 'MAKTX'.
I_HEADING-TEXT12 = 'LGORT'.
I_HEADING-TEXT13 = 'LABST'.
I_HEADING-TEXT14 = 'EBELN'.
I_HEADING-TEXT15 = 'EBELP'.
I_HEADING-TEXT16 = 'VBELN'.
I_HEADING-TEXT17 = 'POSNR'.
APPEND I_HEADING.
ENDFORM. "HEADINGS
FORM DLOAD *
FORM DLOAD.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_HEADING
EXCEPTIONS
FILE_WRITE_ERROR = 1.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\MATSTK.XLS'
FILETYPE = 'DAT'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = I_OUT.
ENDFORM. "DLOAD
FORM FIELDCAT *
FORM FIELDCAT.
V_FIELDCAT-COL_POS = '1'.
V_FIELDCAT-FIELDNAME = 'MATNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '2'.
V_FIELDCAT-FIELDNAME = 'WERKS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '3'.
V_FIELDCAT-FIELDNAME = 'LVORM'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '4'.
V_FIELDCAT-FIELDNAME = 'DISPO'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
V_FIELDCAT-REF_TABNAME = 'MARC'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '5'.
V_FIELDCAT-FIELDNAME = 'MBRSH'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '6'.
V_FIELDCAT-FIELDNAME = 'MEINS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '7'.
V_FIELDCAT-FIELDNAME = 'MATKL'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
V_FIELDCAT-REF_TABNAME = 'MARA'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '8'.
V_FIELDCAT-FIELDNAME = 'VKORG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '9'.
V_FIELDCAT-FIELDNAME = 'VTWEG'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
V_FIELDCAT-REF_TABNAME = 'MVKE'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '10'.
V_FIELDCAT-FIELDNAME = 'SPRAS'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '11'.
V_FIELDCAT-FIELDNAME = 'MAKTX'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
V_FIELDCAT-REF_TABNAME = 'MAKT'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '12'.
V_FIELDCAT-FIELDNAME = 'LGORT'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
V_FIELDCAT-OUTPUTLEN = 10.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '13'.
V_FIELDCAT-FIELDNAME = 'LABST'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-SELTEXT_M = 'STOCK'.
V_FIELDCAT-OUTPUTLEN = 15.
V_FIELDCAT-REF_FIELDNAME = 'LABST'.
V_FIELDCAT-REF_TABNAME = 'MARD'.
V_FIELDCAT-DO_SUM = 'X'.
V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
V_FIELDCAT-HOTSPOT = 'X'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '14'.
V_FIELDCAT-FIELDNAME = 'EBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '15'.
V_FIELDCAT-FIELDNAME = 'EBELP'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
V_FIELDCAT-REF_TABNAME = 'EKPO'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '16'.
V_FIELDCAT-FIELDNAME = 'VBELN'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-HOTSPOT = 'X'.
V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
V_FIELDCAT-COL_POS = '17'.
V_FIELDCAT-FIELDNAME = 'POSNR'.
V_FIELDCAT-TABNAME = 'I_OUT'.
V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
V_FIELDCAT-REF_TABNAME = 'VBAP'.
APPEND V_FIELDCAT TO VT_FIELDCAT1.
CLEAR V_FIELDCAT.
ENDFORM. "FIELDCAT
FORM OUTPUT *
FORM OUTPUT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE'
I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
IS_LAYOUT = V_LAYOUT
IT_FIELDCAT = VT_FIELDCAT1
TABLES
T_OUTTAB = I_OUT.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. "OUTPUT
FORM TOP-OF-PAGE *
FORM TOP-OF-PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER.
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'REPORT FOR : '.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'MATERIAL DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
WA_HEADER-TYP = 'S'.
WA_HEADER-INFO = 'SALES ORDER DETAILS'.
APPEND WA_HEADER TO T_HEADER.
CLEAR WA_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
I_LOGO = 'GEAR'
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM. "TOP-OF-PAGE
*& FORM DISPLAYDETAILS *
FORM DISPLAYDETAILS USING UCOMM LIKE SY-UCOMM
SELFIELD TYPE SLIS_SELFIELD.
IF SELFIELD-FIELDNAME = 'EBELN'.
IF UCOMM = '&IC1'.
READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
PERFORM PORECDNG.
CLEAR BDCDATA[].
ENDIF.
ELSE.
IF SELFIELD-FIELDNAME = 'MATNR'.
IF UCOMM = '&IC1'.
READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
PERFORM MMRECDNG.
CLEAR BDCDATA[].
ENDIF.
ELSE.
IF SELFIELD-FIELDNAME = 'VBELN'.
IF UCOMM = '&IC1'.
READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
PERFORM SALESRECDNG.
CLEAR BDCDATA[].
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. "DISPLAYDETAILS
FORM PORECDNG *
FORM PORECDNG.
perform bdc_dynpro using 'SAPMM06E' '0105'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-BSTNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RM06E-BSTNR'
I_OUT-EBELN.
perform bdc_dynpro using 'SAPMM06E' '0120'.
perform bdc_field using 'BDC_CURSOR'
'RM06E-BSTPO(01)'.
perform bdc_field using 'BDC_OKCODE'
'=AH'.
perform bdc_field using 'RM06E-EBELP'
I_OUT-EBELP.
perform bdc_field using 'RM06E-TCSELFLAG(01)'
'X'.
perform bdc_transaction using 'ME23'.
ENDFORM. "PORECDNG
FORM MMRECDNG *
FORM MMRECDNG.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RMMG1-MATNR'
I_OUT-MATNR.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_FIELD USING 'MSICHTAUSW-KZSEL(01)'
'X'.
PERFORM BDC_TRANSACTION USING 'MM03'.
ENDFORM. "MMRECDNG
FORM SALESRECDNG *
FORM SALESRECDNG.
PERFORM BDC_DYNPRO USING 'SAPMV45A' '0102'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'VBAK-VBELN'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'VBAK-VBELN'
I_OUT-VBELN.
PERFORM BDC_TRANSACTION USING 'VA03'.
ENDFORM. "SALESRECDNG
FORM BDC_TRANSACTION *
FORM BDC_TRANSACTION USING TCODE.
CALL TRANSACTION TCODE USING BDCDATA MODE 'E'.
ENDFORM. "BDC_TRANSACTION
FORM BDC_DYNPRO *
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM. "BDC_DYNPRO
INSERT FIELD *
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM. "BDC_FIELD
*& FORM PURCHASEDATA_VALIDATION *
FORM PURCHASEDATA_VALIDATION.
SELECT EBELN EBELP MATNR
FROM EKPO
INTO TABLE I_EKPO
FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR
AND EBELN IN S_EBELN
AND WERKS EQ P_WERKS.
IF I_EKPO[] IS INITIAL.
WRITE:/ 'NO MATCHING DATA IS SELECTED FROM TABLE EKPO'.
EXIT.
ENDIF.
DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
T_EKPO[] = I_EKPO[].
REFRESH I_EKPO.
FREE I_EKPO.
LOOP AT T_EKPO.
SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
WHERE EBELN = T_EKPO-EBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_EKPO TO I_EKPO.
APPEND I_EKPO.
CLEAR I_EKPO.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_EKPO.
ENDFORM. "PURCHASEDATA_VALIDATION
*& FORM SALESDATA_VALIDATION *
FORM SALESDATA_VALIDATION.
SELECT VBELN POSNR MATNR
FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE
I_VBAP FOR ALL ENTRIES IN I_MARC
WHERE MATNR = I_MARC-MATNR.
DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
T_VBAP[] = I_VBAP[].
REFRESH I_VBAP.
FREE I_VBAP.
LOOP AT T_VBAP.
SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
WHERE VBELN = T_VBAP-VBELN.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T_VBAP TO I_VBAP.
APPEND I_VBAP.
CLEAR I_VBAP.
ELSE.
CONTINUE.
ENDIF.
ENDLOOP.
SORT I_VBAP.
ENDFORM. "SALESDATA_VALIDATION
..........................FOr Hierarchy List...................
REPORT Zxxxxxxxxxx NO STANDARD PAGE HEADING.
**********DECLARING TABLES********************************************
TYPE-POOLS: slis.
TABLES: EKKO, "PO HEADER
EKPO. "PO ITEM
**********DECLARING DATA**********************************************
DATA: ET_EKKO TYPE EKKO OCCURS 0 WITH HEADER LINE,
ET_EKPO TYPE EKPO OCCURS 0 WITH HEADER LINE,
ET_SORT TYPE SLIS_T_SORTINFO_ALV WITH HEADER LINE,
ET_LAYOUT TYPE SLIS_LAYOUT_ALV,
ET_KEYINFO TYPE SLIS_KEYINFO_ALV,
ET_REPID LIKE SY-REPID.
DATA: ET_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA: ET_EVENTS TYPE SLIS_T_EVENT.
**********SELECTION CRITERIA****************************************
SELECTION-SCREEN BEGIN OF BLOCK RAD1 WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS: S_EBELN FOR ET_EKPO-EBELN OBLIGATORY.
SELECTION-SCREEN END OF BLOCK RAD1.
INITIALIZATION.
ET_KEYINFO-HEADER01 = 'EBELN'.
ET_KEYINFO-ITEM01 = 'EBELN'.
ET_SORT-FIELDNAME = 'EBELN'.
ET_SORT-TABNAME = '2'.
ET_SORT-SPOS = 1.
ET_SORT-UP = 'X'.
ET_SORT-SUBTOT = 'X'.
APPEND ET_SORT.
ET_SORT-FIELDNAME = 'EBELP'.
ET_SORT-TABNAME = '2'.
ET_SORT-SPOS = 1.
APPEND ET_SORT.
ET_FIELDCAT-FIELDNAME = 'NETWR'.
ET_FIELDCAT-TABNAME = '2'.
ET_FIELDCAT-OUTPUTLEN = 8.
ET_FIELDCAT-DO_SUM = 'X'.
ET_FIELDCAT-HOTSPOT = 'X'.
APPEND ET_FIELDCAT.
START-OF-SELECTION.
SELECT EBELN BUKRS AEDAT ERNAM FROM EKKO INTO CORRESPONDING
FIELDS OF TABLE ET_EKKO
WHERE EBELN IN S_EBELN.
SELECT * FROM EKPO INTO CORRESPONDING FIELDS
OF TABLE ET_EKPO FOR ALL ENTRIES IN
ET_EKKO WHERE EBELN = ET_EKKO-EBELN.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME_HEADER = 'EKKO'
I_STRUCTURE_NAME_ITEM = 'EKPO'
IS_KEYINFO = ET_KEYINFO " The structure contains the
" header and item table
" field names which links the
" the two tables(shared key)
IS_LAYOUT = ET_LAYOUT
IT_FIELDCAT = ET_FIELDCAT[]
I_TABNAME_HEADER = '1' " Name of the internal table in the
" program containing the output data
" of the highest hierarchy level
I_TABNAME_ITEM = '2' " Name of the internal table in the
" program containing the output data
" of the highest hierarchy level
IT_EVENTS = ET_EVENTS[]
IT_SORT = ET_SORT[]
TABLES
T_OUTTAB_HEADER = ET_EKKO " Header table with data to be
" output
T_OUTTAB_ITEM = ET_EKPO. " Name of the internal table in
" the program containing the
" output data of the lowest
"hierarchy level.
Regards,,
Satya Kumar..
Similar Messages
-
Download Hierarchial List ALV to excel
Hi all,
Please provide me the solution on using download button in Hierarchial List ALV to download to excel.The output of excel need to be exacted as the output of ALV (All header and items details).
Please suggest the solution and sample code ASAP.
Thanks and Regards.Hello,
Find the code where method set_table_for_first_display of tree object (CL_GUI_ALV_TREE) used in your program,
and learn table of tree from there :
CALL METHOD g_tree->set_table_for_first_display
EXPORTING
i_structure_name = g_structname
is_hierarchy_header = g_hierarchy_header
CHANGING
it_fieldcatalog = g_fieldcat
it_outtab = it_result . "<-- this table contains hierarchical data
And than download this table using class CL_GUI_FRONTEND_SERVICES
and methods FILE_SAVE_DIALOG and GUI_DOWNLOAD or function GUI_DOWNLOAD
you can find too many of examples in forum. -
How to include Restricted Batches in MMBE list?
Dear Gurus,
My MMBE list excludes Restricted Batches from displaying. However, I need it. How to grab it back to my list? Any ABAP job required?
Thanks a lot.
JasonThe screen layout of MMBE can be customized in IMG > MM > IM > reporting > stock list
-
How to give column heading for detailed list
hi,
we can get column-heading of basic list by text-element provided.
but what are ways of giving column heading in detailed list ?HI,
Based on the SY-LSIND value, you can have a different heading.
top-of-page at line-selection.
case sy-lsind.
when 1.
write:/ 'Heading for first list'.
when 2.
write:/ 'Heading for second list'.
when 3.
write:/ 'Heading for third list'.
endcase.
please see the link below it might help you
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba2eb35c111d1829f0000e829fbfe/content.htm
*******please reward points if the information is helpful to you************* -
How to Include "all" header info when you Reply and ReplyAll
Using Mail 3.5, when I Reply or ReplyAll I need to have "all" header info included automatically (From, To, CC, Subject, Date) which does occur when Forwarding but not when Replying to one or all. A REAL issue in the corporate world. Is there any way to accomplish this???
Thanks,Did you ever get a reply to this question or did you manage to solve the issue in any way or shape? I am experiencing the same so eager to hear a solution.
Thanks! -
How to include a Header in the Open Script
Hi
I have a header called "X-Forwarded For", and i want it to be used in the script, i have tried the following statements to do so:
1) http.headers(http.header("X-Forwarded-For", "12.1.1.1",Header.HeaderAction.Modify));
2) http.headers(http.header("X-Forwarded-For", "12.1.1.1",Header.HeaderAction.Add));
But none of the ways worked for me. Can you please help me out to deal with this problem?
Thanks & Regards
- FahimPerhaps I was not clear in my previous reply. You must send the header with the first navigation, and then it will be sent with all future navigations. Your cannot call http.headers() directly unless you save the return of the headers, and then pass the returned headers to the first navigation. After that first navigation, you will not need to send the new header in any subsequent navigations assuming the proper HeaderAction.
http.get(1, "http://testserver2",
http.querystring(http.param("QueryString1", "QueryValue1")),
http.headers(http.header("X-Forwarded-For", "12.1.1.1", Header.HeaderAction.SetIfNotSet)),
false, "ASCII", "ASCII");The 12.x OpenScript users guide explains the http.get and http.post in full detail in sections "6.6.2 Adding HTTP Get Navigation", and "6.6.3 Adding HTTP Post Navigation", which includes setting http.headers() -
How to configure multicolumn header in sharepoint list?
I am having a sharepoint list. I want to group the columns.
For a clear understanding of my requirement, please see the image below:
Is this possible in sharepoint list? I am using version 2010.
Thanks, Saravanan PRSHi Saravanan,
Open your list in SharePoint Designer 2010, try to add a data form web part the list view(insert->empty data source->add your list), select the header cell, click table tab in list
view tools, click split cells to more rows or columns. Please have a check.
Best Regards.
Kelly Chen
TechNet Community Support -
Creating Header and Footer in ALV
hi,
can anyone please tell how will you create Header and Footer in ALv and Classical Report.Hi,
In classical report use events 'top-of-page' for header and 'end-of-page' for footer.
in ALV
follow this link
http://www.sap-img.com/abap/test-alv-display-with-header-footer.htm
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/header-footer-display-in-alv-grid-for-layout-description-344391
Regards and Best wishes. -
How to include header files with different extensions
Hi,
When i include a header file with extension .ch (myincludefile.ch), the compiler gives error messages but when i change the extension to .h, the problem disappears.
Can anyone help me getting rid of this problem?
For example, for the line below, I get a warning such as, "attempt to redefine MY_CONST without #undef". Remember when i change the extension to .h, the problem disappears.
#define MY_CONST 500 /* Constant */
Thank you very muchI don't see how the name of the file could cause or prevent error messages, except when template declarations are involved. So let's assume for now that the file has a template declaration.
The Templates chapter of the C++ Users Guide explains about including or separating template declarations and their definitions.
If you have only a template declaration in a file and the compiler needs the definition, it will look for another file with the same base name and include it automatically. For example, if you have files foo.h and foo.cc, and foo.h has a template declaration, the compiler will include foo.cc automatically, even if you didn't intend for that to happen. You can wind up with multiple delcaration errors that way.
When looking for a file containing template definitions, the compile will not include a .h file, so as not to create recursive inclusion. If changing the file name to .h causes your problem to disappear, it seems like an unwanted automatic inclusion is the problem.
You can try two things to find out:
1. Compile with the -H option. The compiler will output an indented list of all included files. See if you are getting a file you didn't intend, or the same file twice.
2. Compile with option -template=no%extdef. It disables the automatic search for template definitions.
If you find an unintended included file this way, you will probably have to change the names or organizaiton of some of the files. Our implementation of the C++ standard library depends on NOT using the -template=no%extdef option, which might mean you can't use that option. -
How to include in table of contents the list of figures and list of tables?
How to include in table of content the "Table of contents", "List of figures" and "List of tables"? All are generated with function Table of contents, but they will not appear in generated table of contents even if they have proper style of headings - Heading 1, as other chapter.
I get this in generated Table of contentes of my dissertaion thesis:
Table of contents
Preface
Table of contents <- missing
List of tables <- missing
List of figures <- missing
Introduction
Main
Conclusion
Is it ok, that generated lists are not included in table of contents?You've just confused me.
My understanding of how this is set up is that either:
This is a book, and there is a master TOC that includes all book documents and a document-specific TOC in each component file, or
This is a single file and there is one master TOC that includes all sections and a section-specific TOC that includes only the individual section.
In the first case, I think you would want two TOC styles set up, one that includes the chapter heads (if I understood how you said this worked) for the for the master, and you would include all docs in the book when you generate it, and a second style for the individual chapters, with the subheadings you want to include.
In the second case, it would be similar, but instead of only one style to cover the section TOCS, I think you would need to create a unique set of pargraph styles for the headings in each section (they can all be the same format, based one section, just with unique names), and then make a TOC style for each section that includes only the styles from that section.
OK, wait a sec. I just reread what you said: "Another thing: when the numbers are "linked" and updating well, they display indide a little box. Not a text box, but a kind of little frame around the numbers. That frame makes it imposible to delete just one number: when the TOC says that Section 6.1 is in page 135, for example, you cannot delete just the 5, it deletes, not just the 3 numbers, but also the doted tab."
I think these are NOT normal TOCs created by using Layout > TOC (but you could replace them with ones that are, if you set up your styles properly and the text you want to include is appearing on the pages). Those little boxes you mention sound like cross-references, which should update automatically without any intervention at all. Unfortunately, cross-refs can be flakey, especially if they point to another document. I'd open the cross-refs panel and see if you need to recreate a bunch of links. -
How to include old invoices in the invoice list
How to Include old billing documents in the invoice list.
TO be more clear:-
I created 20 invoices in the monthof JAN
I maintained the factory calender in the payer master in the month of Feb 1st and created 10 more invoices in this month.
So the system is considering only the invocies which were generated after I maintained the factory calender (Only feb invoices).
Is there any process to include the previous invoicies (Jan invoices) also to get include in the invoice list.
Help me in this regards.
Regards,
Mallesh.It is not possible.
Regards,
Rajesh Banka -
How to include a license header in fxml file?
How to include a license header in fxml file?
I tried xml block comments <!-- mylicense here -->
but it wasn't accepted by screen builder.
Also I wondered, even if it had been accepted, would screen builder have saved the header back - or deleted it?All XML documents should begin with an XML declaration.
If you have your fxml file starting with the following lines :
<?xml version="1.0" encoding="UTF-8"?>
<!-- mylicense here -->
.. it will be loaded in Scene Builder, and saved back as is. -
How to include WS-Security Header in the WSDL
hi
how to include WS-Security Header which have username and password as
i had seen the below link it deals with just hello world which is not using any Services(DBAdapter) is it possible to use DBAdapter as the steps present in the below link how to include WS-Security Header which have username and password
http://blogs.oracle.com/reynolds/2005/09/invoking_bpel_from_an_html_for.htmlAs Amir suggested, you may provide in the URL but I wouldn't suggest it though. You don't want to hard code the user ID and password within in the WSDL because it is a bad practice especially the user ID and password may be different in different systems and every time you change the password, you have to regenarate your WSDL.
May be you thought through this but just in case if you didn't
KK -
Hello,
The business process is to login and logout using Web HTTP/HTML protocol in LR 11.52; while I am trying to login to the website and after several attempts keep getting error-500. One of the suggestion was to copy the X_IDXSessionID to each request. Also applied correlation but keep getting the authentication error in the session.
My concern:How to include X-IDSSessionID in every header and copy the AuthToken from the previous response into the current request header?
I got the X-IDXSessionID and X-Allscripts-AuthToken from the snapshot response and request tab. Thanks.are you looping of this input with a for each?
/yourdata/details[1] should return always the first detail element.
or before the for each do an assing of this first detail element to "generic_details_var"
and use this var in every looping iteration (in an assign or as input for xquery) -
How to include field in document header
Dear All,
Any one please give me some input on how to include a field in document header of f-02 .
Thanks,
Srini.Hi,
You will have to modify the screen via SE51 (program SAPMF05A, screen 100). Ask to your ABAP team to help you, though such a modification should be carefully considered.
By the way, is it a user-defined field or field that should be there and is just missing? If the last is true, it could be a bug and solved by relevant OSS correction.
Regards,
Eli
Maybe you are looking for
-
In Note 1064273, there is new option in characteristcs properties Advance Tab: refresh variable with two options: refresh dynamically" / "refresh as designed. I tested how come it is just opposite meaning? Refresh as designed is to recalculate variab
-
I'm getting an error message from Firefox that says, "Something is trying to trick Firefox into accepting an insecure update. Please contact your network provider and seek help." Do you know what is going on here--what this problem could be? (I do ha
-
Finder ALWAYS has to recalculate Applications file sizes - WHY?
I must be missing something simple here. Every time I open the Applications folder the Finder seems to take 2-3 minutes to re-calculate the file size of every app. I don't usually care because they don't usually change. Any ideas on how I can stop th
-
Tension control in labview using PCI 7354 Motion Control Board
I want to make a program for web tension control of roll to roll system in labview using PCI 7354 Motion Control Board. Is there any interface program that can convert my controller output in a format to be directly used as the input of PCI 7354 (Mot
-
L2 and L3 Routed Link between 2 COREs
Hi What is the difference between L2 (Dot1q) and L3 Routed Link between 2 COREs in term of Functionality thanks