*&---------------------------------------------------------------------*
*& Report YTST_FF_011
*&
*&---------------------------------------------------------------------*
*& DEMO_ALVGRID_EDIT.
*&
*&---------------------------------------------------------------------*
REPORT YTST_FF_011.
TABLES:EKKO.
TYPE-POOLS: SLIS. "ALV Declarations
*Data Declaration
*----------------
TYPES:BEGIN OF T_EKKO,
EBELN TYPE EKPO-EBELN,
EBELP TYPE EKPO-EBELP,
STATU TYPE EKPO-STATU,
AEDAT TYPE EKPO-AEDAT,
MATNR TYPE EKPO-MATNR,
MENGE TYPE EKPO-MENGE,
MEINS TYPE EKPO-MEINS,
NETPR TYPE EKPO-NETPR,
PEINH TYPE EKPO-PEINH,
FIELD_STYLE TYPE LVC_T_STYL, "FOR DISABLE
END OF T_EKKO.
DATA: IT_EKKO TYPE STANDARD TABLE OF T_EKKO INITIAL SIZE 0,
WA_EKKO TYPE T_EKKO.
*ALV data declarations
DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
DATA: IT_FIELDCAT TYPE LVC_T_FCAT, "slis_t_fieldcat_alv WITH HEADER LINE,
WA_FIELDCAT TYPE LVC_S_FCAT,
GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV,
GD_LAYOUT TYPE LVC_S_LAYO, "slis_layout_alv,
GD_REPID LIKE SY-REPID.
************************************************************************
*Start-of-selection.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM SET_SPECIFIC_FIELD_ATTRIBUTES.
PERFORM BUILD_FIELDCATALOG.
PERFORM BUILD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDCATALOG
*&---------------------------------------------------------------------*
* Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
FORM BUILD_FIELDCATALOG.
WA_FIELDCAT-FIELDNAME = 'EBELN'.
WA_FIELDCAT-SCRTEXT_M = 'Purchase Order'.
WA_FIELDCAT-COL_POS = 0.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-EMPHASIZE = 'X'.
WA_FIELDCAT-KEY = 'X'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'EBELP'.
WA_FIELDCAT-SCRTEXT_M = 'PO Item'.
WA_FIELDCAT-COL_POS = 1.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'STATU'.
WA_FIELDCAT-SCRTEXT_M = 'Status'.
WA_FIELDCAT-COL_POS = 2.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'AEDAT'.
WA_FIELDCAT-SCRTEXT_M = 'Item change date'.
WA_FIELDCAT-COL_POS = 3.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-SCRTEXT_M = 'Material Number'.
WA_FIELDCAT-COL_POS = 4.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MENGE'.
WA_FIELDCAT-SCRTEXT_M = 'PO quantity'.
WA_FIELDCAT-COL_POS = 5.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-SCRTEXT_M = 'Order Unit'.
WA_FIELDCAT-COL_POS = 6.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME
转载于:https://www.cnblogs.com/rainysblog/p/3573239.html