REPORT ZMMR1115.
TYPE-POOLS: SLIS.
TABLES:MAKT,
T001W.
DATA: G_GRID TYPE LVC_S_GLAY,
G_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
G_LAYOUT TYPE SLIS_LAYOUT_ALV,
LG_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
TYPES:BEGIN OF LT_INTABLE,
MAKTX TYPE MAKT-MAKTX,
NAME1 TYPE T001W-NAME1.
TYPES: END OF LT_INTABLE.
TYPES: BEGIN OF LT_MAKT,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX.
TYPES: END OF LT_MAKT.
TYPES: BEGIN OF LT_T001W,
WERKS TYPE T001W-WERKS,
NAME1 TYPE T001W-NAME1.
TYPES: END OF LT_T001W.
DATA: GT_INTABLE TYPE STANDARD TABLE OF LT_INTABLE,
GW_INTABLE TYPE LT_INTABLE,
GT_MAKT TYPE STANDARD TABLE OF LT_MAKT,
GW_MAKT TYPE LT_MAKT,
GT_T001W TYPE STANDARD TABLE OF LT_T001W,
GW_T001W TYPE LT_T001W.
SELECTION-SCREEN BEGIN OF BLOCK BLK1.
SELECT-OPTIONS: S_MATNR FOR MAKT-MATNR,"物料
S_WERKS FOR T001W-WERKS,"工厂
S_LIFNR FOR T001W-LIFNR.
SELECTION-SCREEN END OF BLOCK BLK1.
INITIALIZATION .
AT SELECTION-SCREEN.
START-OF-SELECTION.
PERFORM: LT_MAKT,
LT_MATNR,
LT_WERKS,
LT_LIFNR.
END-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form lt_makt
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM LT_MAKT.
SELECT MATNR
WERKS
LIFNR
INTO CORRESPONDING FIELDS OF TABLE GT_INTABLE
FROM EORD
WHERE MATNR IN S_MATNR
AND WERKS IN S_WERKS
AND LIFNR IN S_LIFNR.
ENDFORM. "lt_makt
*&---------------------------------------------------------------------*
*& Form lt_matnr
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM LT_MATNR.
G_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
G_LAYOUT-ZEBRA = 'X'.
ENDFORM. "lt_matnr
*&---------------------------------------------------------------------*
*& Form lt_werks
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM LT_WERKS.
PERFORM MATNR_MATNR USING ' MATNR ' '' '' ' 物料编码 ' 1 .
PERFORM MATNR_MATNR USING ' MAKTX ' '' '' ' 物料描述 ' 3 .
PERFORM MATNR_MATNR USING ' WERKS ' '' '' ' 工厂 ' 5 .
PERFORM MATNR_MATNR USING ' NAME1 ' '' '' ' 工厂描述 ' 7 .
PERFORM MATNR_MATNR USING ' VDATU ' '' '' ' 有效起始日 ' 9 .
PERFORM MATNR_MATNR USING ' BDATU ' '' '' ' 有效至 ' 11 .
PERFORM MATNR_MATNR USING ' LIFNR ' '' '' ' 供应商编码 ' 13 .
PERFORM MATNR_MATNR USING ' NAME ' '' '' ' 供应商 ' 15 .
PERFORM MATNR_MATNR USING ' EKORG ' '' '' ' 采购组织 ' 17 .
PERFORM MATNR_MATNR USING ' EKOTX ' '' '' ' 采购组织描述 ' 19 .
ENDFORM. "lt_werks
*&---------------------------------------------------------------------*
*& Form matnr_matnr
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->FIELDNAME text
* -->REF_FIELDNAME text
* -->REF_TABNAME text
* -->FIELDTEXT text
* -->COL_POS text
*----------------------------------------------------------------------*
FORM MATNR_MATNR USING FIELDNAME REF_FIELDNAME REF_TABNAME FIELDTEXT COL_POS .
G_FIELDCAT-REF_TABNAME = REF_TABNAME .
G_FIELDCAT-FIELDNAME = REF_FIELDNAME .
G_FIELDCAT-FIELDNAME = FIELDNAME.
G_FIELDCAT-SELTEXT_S = FIELDTEXT.
G_FIELDCAT-SELTEXT_L = FIELDTEXT.
G_FIELDCAT-SELTEXT_M = FIELDTEXT.
G_FIELDCAT-REPTEXT_DDIC = FIELDTEXT.
G_FIELDCAT-COL_POS = COL_POS.
G_FIELDCAT-NO_ZERO = 'X'.
APPEND G_FIELDCAT TO LG_FIELDCAT.
CLEAR G_FIELDCAT.
ENDFORM. "matnr_matnr
*&---------------------------------------------------------------------*
*& Form lt_lifnr
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM LT_LIFNR.
G_GRID = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_GRID_SETTINGS = G_GRID
IS_LAYOUT = G_LAYOUT
IT_FIELDCAT = LG_FIELDCAT
I_SAVE = 'X'
TABLES
T_OUTTAB = GT_INTABLE.
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. "lt_lifnr