*****************************************************************
* System : TDG ERP项目 * Module : MM
* Program ID : ZFO_DATA_DOWNLOAD
* Program : SAP采购订单数据与MES接口下载文件 ZFO_DATA 表。
* Author : (TDG) Kean.liu
* Date : 2011/02/17
* Description : SAP采购订单数据与MES接口下载文件 tcode:ZFODD
*****************************************************************
* Modified Recorder :
* Date C#NO Author Content
* ----------- ------- ------------------ ----------------------
* 2011/02/17 (TDG) Kean.liu Create
************************************************************************REPORT zfo_data_download.
TABLES: mara,ekko,ekpo,mseg,mkpf,lfa1,ZFO_DATA,CDHDR.
TYPE-POOLS: slis.*----------------------------------------------------------------------*
* Define TYPES
*----------------------------------------------------------------------*
TYPES:BEGIN OF typ_ekko,
LOEKZ TYPE ekpo-LOEKZ, " 标记
matnr TYPE ekpo-matnr, " 部件编号
BISMT TYPE mara-BMATN, "old number
ebeln TYPE ekko-ebeln ," 采购订单号
BEDAT TYPE ekko-BEDAT ," 订单签发日期
lifnr TYPE ekko-lifnr ," 供应商代码
waers TYPE ekko-waers ," 结算币种
EKGRP TYPE ekko-EKGRP ," 采购人
ebelp TYPE ekpo-ebelp ," 订单行号
ematn TYPE ekpo-ematn ," 部件编号
menge TYPE ekpo-menge ," 订货数量
meins TYPE ekpo-meins ," 计量单位
netpr TYPE ekpo-netpr ," 采购成本单价
name1 TYPE lfa1-name1, " supply name
END OF typ_ekko.DATA:BEGIN OF t_title OCCURS 0 ,
title(20) TYPE c,
END OF t_title.TYPES: BEGIN OF typ_mara,
matnr TYPE mara-matnr, " 部件编号 wrkst TYPE mara-wrkst ," 客户部件编号
mfrpn TYPE mara-mfrpn ," 制造商物料代码
BISMT TYPE mara-BISMT, "部件内部编码
MFRNR TYPE mara-MFRNR, "制造商代码
NAME1 TYPE LFA1-NAME1, "manufactrul name
LAND1 TYPE lfa1-LAND1, "Contry
END OF typ_mara.TYPES: BEGIN OF typ_mseg,
ebeln TYPE mseg-ebeln , " 采购订单号
ebelp TYPE mseg-ebelp , " 订单行号
mblnr TYPE mseg-mblnr, "物料凭证编号
zeile TYPE mseg-zeile,
mjahr TYPE mseg-mjahr,
bwart TYPE mseg-bwart,
menge TYPE mseg-menge ," 已收数量
END OF typ_mseg.TYPES:begin of typ_CDHDR,
OBJECTID TYPE ekko-ebeln,"OBJECT VALUES
end of typ_CDHDR.TYPES:begin of typ_DRUNR,
DRUNR(4) TYPE C, "OBJECT VALUES
end of typ_DRUNR.TYPES: BEGIN OF typ_DATA,
MANDT TYPE ZFO_DATA-MANDT,
EBELN TYPE ZFO_DATA-EBELN, "purchasing id
EBELP TYPE ZFO_DATA-EBELP, "purchasing number
LOEKZ TYPE ZFO_DATA-LOEKZ, "flag
AEDAT TYPE ZFO_DATA-AEDAT, "date
CPUTM TYPE ZFO_DATA-CPUTM, " time
DRUNR TYPE ZFO_DATA-DRUNR, " times
END OF typ_DATA.TYPES: BEGIN OF typ_display,
LOEKZ TYPE ekpo-LOEKZ, " 标记
ebeln TYPE ekko-ebeln, " 采购订单号
ebelp TYPE ekpo-ebelp, " 订单行号
BEDAT TYPE ekko-BEDAT, " 订单签发日期
matnr TYPE mara-matnr, " SAP 部件编号
BISMT TYPE mara-BISMT, " old number
* wrkst TYPE mara-wrkst, " 客户部件编号
mfrpn TYPE mara-mfrpn, " 制造商部件编号
lifnr TYPE ekko-lifnr, " 供应商代码
mfrnr TYPE mara-mfrnr, " 制造商代码
LAND1 TYPE lfa1-LAND1, " 原产国代码
menge(13) TYPE C, " 订货数量
menge02(13) TYPE C, " 已收数量
street(20) TYPE c, " 送货地点
meins TYPE ekpo-meins, " 计量单位
waers TYPE ekko-waers, " 结算币种
netpr(11) TYPE C, " 采购成本单价
eindt TYPE eket-eindt, " 计划供货日期
EKGRP TYPE ekko-EKGRP, " 采购人
name1 TYPE lfa1-name1, " supply name
name2 TYPE lfa1-name1, " 制造商名称
END OF typ_display.*----------------------------------------------------------------------*
* Define GLOBAL DATA
*----------------------------------------------------------------------*
DATA: gth_ekko TYPE typ_ekko,
gtd_ekko TYPE TABLE OF typ_ekko,
gtd_ekko_CDHDR TYPE TABLE OF typ_ekko,
gtd_ekko_CF TYPE typ_ekko,
gtd_CDHDR TYPE TABLE OF typ_CDHDR,
gtd_CDHDR_DRUNR TYPE TABLE OF typ_DRUNR,
gth_CDHDR_DRUNR TYPE typ_DRUNR,
gth_mara TYPE typ_mara,
gtd_mara TYPE TABLE OF typ_mara,
gth_mseg TYPE typ_mseg,
gtd_mseg TYPE TABLE OF typ_mseg,
gth_data type typ_data.data:C_DRUNR(2) type C.
DATA: gtd_display TYPE TABLE OF typ_display,
gth_display TYPE typ_display.DATA: gtd_fieldcat TYPE slis_t_fieldcat_alv,
gth_fieldcat TYPE slis_fieldcat_alv.DATA: gth_layout TYPE slis_layout_alv.
DATA: dname TYPE string.
*----------------------------------------------------------------------*
* SCREEN DEFINE
*----------------------------------------------------------------------*
*PARAMETERS: p_ebeln LIKE ekko-ebeln , "采购订单号
* p_aedat LIKE ekko-aedat. "订单签发日期,
SELECTION-SCREEN BEGIN OF BLOCK conn WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_ebeln FOR ekko-ebeln , "采购订单号
s_aedat FOR ekko-aedat NO INTERVALS OBLIGATORY , "订单签发日期,
s_times FOR ZFO_DATA-CPUTM. "时间区域
SELECTION-SCREEN END OF BLOCK conn.SELECTION-SCREEN BEGIN OF BLOCK conn2 WITH FRAME TITLE text-002.
PARAMETERS : p1 RADIOBUTTON GROUP rg,
p2 RADIOBUTTON GROUP rg,
p3 RADIOBUTTON GROUP rg.
SELECTION-SCREEN END OF BLOCK conn2.SELECTION-SCREEN SKIP 1.
PARAMETERS : remotenm LIKE rlgrap-filename OBLIGATORY,"服务器地址
localnm LIKE rlgrap-filename OBLIGATORY. "本地地址*----------------------------------------------------------------------*
* AT SELECTION-SCREEN
*----------------------------------------------------------------------*INITIALIZATION.
remotenm = '/usr/sap/tmp/export-data/'.
localnm = 'D:/SAPDOWN/'.
p3 = 'X'.*----------------------------------------------------------------------*
* START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM check_authority.
PERFORM sub_get_data.
PERFORM download_data.FORM check_authority.
***查找当日的最大次数
select DRUNR
INTO CORRESPONDING FIELDS OF TABLE gtd_CDHDR_DRUNR
from ZFO_DATA
where AEDAT = SY-DATUM and LOEKZ = 'R' .
sort gtd_CDHDR_DRUNR by DRUNR descending. READ TABLE gtd_CDHDR_DRUNR index 1
INTO gth_CDHDR_DRUNR. IF sy-subrc = 0.
C_DRUNR = gth_CDHDR_DRUNR-DRUNR + 1 .
else .
C_DRUNR = 1.
ENDIF.
*append 0 before object
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = C_DRUNR
importing
output = C_DRUNR. IF p1 = 'X'."如果是下载到服务器,取数前进行服务器地址的合法性检查
* IF s_cpudt-high = '00000000'.
CONCATENATE remotenm 'CPO_CCCCC_' sy-DATUM C_DRUNR '.txt' INTO dname. OPEN DATASET dname FOR OUTPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE '服务器地址非法' TYPE 'E'.
ELSE.
CLOSE DATASET dname.
ENDIF.
ENDIF.IF p2 = 'X'."如果是下载到本机
* IF s_cpudt-high = '00000000'.
CONCATENATE localnm 'CPO_CCCCC_' sy-DATUM C_DRUNR '.txt' INTO dname.ENDIF.
ENDFORM. "CHECK_authority
FORM SUB_IN_DATA_LOG. "INSERT INTO TABLE ZFO_DATA. insert log
gth_data-MANDT = SY-MANDT.
gth_data-EBELN = SY-UNAME. "USER name
gth_data-EBELP = C_DRUNR. "Run times gth_data-AEDAT = SY-DATUM. "date
gth_data-CPUTM = SY-UZEIT. "time
gth_data-DRUNR = C_DRUNR. "Run times
INSERT ZFO_DATA from gth_data.
IF sy-subrc <> 0.
update ZFO_DATA from gth_data. "数据存在,标志为删除的记录。 ENDIF.
clear gth_data.
ENDFORM.FORM download_data.
IF p1 = 'X'."如果是下载到服务器,
gth_data-LOEKZ = 'R'. "flag of run times
PERFORM SUB_IN_DATA_LOG.
DATA NUM TYPE string.
OPEN DATASET dname FOR OUTPUT IN TEXT MODE encoding DEFAULT.
LOOP AT gtd_display INTO gth_display .
CONCATENATE gth_display-LOEKZ
gth_display-ebeln
gth_display-ebelp
gth_display-BEDAT
gth_display-matnr " SAP 部件编号
gth_display-BISMT " old number
* gth_display-wrkst " 客户部件编号
gth_display-mfrpn " 制造商部件编号
gth_display-lifnr " 供应商代码
gth_display-mfrnr " 制造商代码
gth_display-LAND1 " 原产国代码
gth_display-menge " 订货数量
gth_display-menge02 " 已收数量
gth_display-street " 送货地点
gth_display-meins " 计量单位
gth_display-waers " 结算币种
gth_display-netpr " 采购成本单价
gth_display-eindt " 计划供货日期
gth_display-EKGRP " 采购人
gth_display-name1 " supply name
gth_display-name2 " 制造商名称
INTO NUM SEPARATED BY '|' RESPECTING BLANKS.
CONCATENATE NUM '|' INTO NUM .
TRANSFER NUM TO dname.
ENDLOOP.
CLOSE DATASET dname. "close file
endif.
IF p2 = 'X'. "如果是下载到本地,
gth_data-LOEKZ = 'T'. "flag of run times
PERFORM SUB_IN_DATA_LOG.
TYPES:begin of typ_NUM,
NUM TYPE string, "OBJECT VALUES
end of typ_NUM.
DATA: gth_NUM TYPE typ_NUM,
gtd_NUM TYPE TABLE OF typ_NUM.
LOOP AT gtd_display INTO gth_display .
CONCATENATE gth_display-LOEKZ
gth_display-ebeln
gth_display-ebelp
gth_display-BEDAT
gth_display-matnr " SAP 部件编号
gth_display-BISMT " old number
* gth_display-wrkst " 客户部件编号
gth_display-mfrpn " 制造商部件编号
gth_display-lifnr " 供应商代码
gth_display-mfrnr " 制造商代码
gth_display-LAND1 " 原产国代码
gth_display-menge " 订货数量
gth_display-menge02 " 已收数量
gth_display-street " 送货地点
gth_display-meins " 计量单位
gth_display-waers " 结算币种
gth_display-netpr " 采购成本单价
gth_display-eindt " 计划供货日期
gth_display-EKGRP " 采购Group
gth_display-name1 " supply name
gth_display-name2 " 制造商名称
INTO gth_NUM-NUM SEPARATED BY '|' RESPECTING BLANKS.
CONCATENATE gth_NUM-NUM '|' INTO gth_NUM-NUM .
APPEND gth_NUM TO gtd_NUM.
endloop. CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = dname "file name
TABLES
DATA_TAB = gtd_NUM "inner table
EXCEPTIONS
FILE_WRITE_ERROR = 1
FILE_NOT_FOUND = 2.
endif.IF p3 = 'X'.
PERFORM sub_display.
ENDIF.
ENDFORM. "download_data
*&---------------------------------------------------------------------*
*& FORM SUB_GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*FORM sub_get_data.
*** 查找修改的凭证号
select
CDHDR~OBJECTID
FROM CDHDR JOIN ekko ON CDHDR~OBJECTID = ekko~ebeln
INTO table gtd_CDHDR
where UDATE in s_aedat and UTIME in s_times
and CHANGE_IND = 'U'.
*** 查找修改采购的凭证号
*** 查找数量变更的凭证号 MKPF-BUDAT MKPF- MBLNR MSEG-MBLNR mseg~ebeln EBELP
IF gtd_ekko_CDHDR IS INITIAL .
select
MSEG~ebeln
FROM MKPF JOIN MSEG ON MKPF~MBLNR = MSEG~MBLNR
into table gtd_CDHDR
where MKPF~BUDAT in s_aedat.
else.
select
MSEG~ebeln
FROM MKPF JOIN MSEG ON MKPF~MBLNR = MSEG~MBLNR
APPENDING table gtd_CDHDR
where MKPF~BUDAT in s_aedat. endif.
IF gtd_CDHDR IS not INITIAL .
SELECT
ekko~ebeln " 采购订单号
ekko~BEDAT " 订单签发日期
ekko~lifnr " 供应商代码
ekko~waers " 结算币种
ekko~EKGRP " 采购人
ekpo~ebelp " 订单行号
ekpo~matnr " 部件编号
ekpo~ematn " 下单号
ekpo~menge " 订货数量
ekpo~meins " 计量单位
ekpo~netpr " 采购成本单价 lfa1-name1
lfa1~name1 "supply name
ekpo~LOEKZ "flag
mara~BISMT
FROM ekpo JOIN ekko ON ekko~ebeln = ekpo~ebeln JOIN lfa1 ON ekko~lifnr = lfa1~lifnr left join mara on ekpo~matnr = mara~matnr
INTO CORRESPONDING FIELDS OF TABLE gtd_ekko_CDHDR
FOR ALL ENTRIES IN gtd_CDHDR
WHERE ekpo~ebeln = gtd_CDHDR-OBJECTID " 采购订单号
and BSART in ('ZNB1','ZNB2','ZNB6','ZNB7','ZNB8','ZNB9') "凭证类型 and EKORG = '2110'. "采购组织
endif.
*** 根据选择界面筛选采购凭证信息
SELECT
ekko~ebeln " 采购订单号
ekko~BEDAT " 订单签发日期
ekko~lifnr " 供应商代码
ekko~waers " 结算币种
ekko~EKGRP " 采购人
ekpo~ebelp " 订单行号
ekpo~matnr " 部件编号
ekpo~ematn " 下单号
ekpo~menge " 订货数量
ekpo~meins " 计量单位
ekpo~netpr " 采购成本单价 lfa1-name1
lfa1~name1 "supply name
ekpo~LOEKZ "flag
mara~BISMT
FROM ekpo JOIN ekko ON ekko~ebeln = ekpo~ebeln JOIN lfa1 ON ekko~lifnr = lfa1~lifnr left join mara on ekpo~matnr = mara~matnr
INTO CORRESPONDING FIELDS OF TABLE gtd_ekko
WHERE ekko~ebeln IN s_ebeln " 采购订单号
AND ekko~BEDAT IN s_aedat
and BSART in ('ZNB1','ZNB2','ZNB6','ZNB7','ZNB8','ZNB9')
and EKORG = '2110' . " 订单签发日期 gth_ekko-LOEKZ = 'D'. "更改 flag :D。
MODIFY gtd_ekko FROM gth_ekko
TRANSPORTING LOEKZ WHERE LOEKZ = 'L'.IF gtd_ekko_CDHDR IS INITIAL and gtd_ekko IS INITIAL.
MESSAGE 'There is no data found! Pls check your selection screen.' TYPE 'I'.
STOP.
ENDIF. LOOP AT gtd_ekko_CDHDR INTO gth_ekko.
if gth_ekko-LOEKZ = 'L'.
gth_ekko-LOEKZ = 'D'.
ELSE .
gth_ekko-LOEKZ = 'U'.
endif.***删除经过修改,新生成的重复采购单
READ TABLE gtd_ekko INTO gtd_ekko_CF WITH KEY ebeln = gth_ekko-ebeln ebelp = gth_ekko-ebelp.
IF sy-subrc = 0.
* DELETE gtd_ekko FROM 3 TO 38 WHERE COL2 > 20.
DELETE gtd_ekko WHERE ebeln = gth_ekko-ebeln and ebelp = gth_ekko-ebelp.
ENDIF.
APPEND gth_ekko TO gtd_ekko.
endloop.
*** 部件号 客户部件编号 制造商部件代码 原产国代码 old code 制造商代码 NAME1 TYPE LFA1-NAME1, "manufactrul name LAND1 TYPE lfa1-LAND1, "Contry
* SELECT matnr mfrnr mfrpn
SELECT MARA~MATNR mara~wrkst mara~mfrpn mara~BISMT mara~MFRNR LFA1~NAME1 LFA1~LAND1
INTO CORRESPONDING FIELDS OF TABLE gtd_mara
FROM MARA left JOIN LFA1 ON MARA~MFRNR = LFA1~LIFNR
FOR ALL ENTRIES IN gtd_ekko
WHERE MARA~MATNR = gtd_ekko-ematn.*** 101 入库物料凭证信息
SELECT mseg~ebeln
mseg~ebelp
mseg~mblnr
mseg~zeile
mseg~mjahr
mseg~bwart
mseg~menge
FROM mseg
INTO CORRESPONDING FIELDS OF TABLE gtd_mseg
FOR ALL ENTRIES IN gtd_ekko
WHERE mseg~ebeln = gtd_ekko-ebeln
AND mseg~ebelp = gtd_ekko-ebelp
AND bwart = '101'.
PERFORM sub_process.ENDFORM. "SUB_GET_DATA
FORM sub_InData.
ENDFORM.
*&---------------------------------------------------------------------*
*& FORM SUB_PROCESS.
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*FORM sub_process.
DATA: lwk_date1 TYPE d,
lwk_date2 TYPE d.
DATA: lwk_qty LIKE mseg-menge. LOOP AT gtd_ekko INTO gth_ekko.
if gth_ekko-LOEKZ = ''.
gth_ekko-LOEKZ = 'A'. "flag new 。
endif.** insert into table
gth_data-MANDT = SY-MANDT.
gth_data-EBELN = gth_ekko-EBELN.
gth_data-EBELP = gth_ekko-EBELP.
gth_data-LOEKZ = gth_ekko-LOEKZ.
gth_data-AEDAT = SY-DATUM.
gth_data-CPUTM = SY-UZEIT.
gth_data-DRUNR = C_DRUNR.CLEAR gth_CDHDR_DRUNR.
SELECT DRUNR FROM ZFO_DATA INTO gth_CDHDR_DRUNR WHERE EBELN = gth_ekko-EBELN AND EBELP = gth_ekko-EBELP AND LOEKZ = gth_ekko-LOEKZ .
ENDSELECT.
IF sy-subrc = 0. "have one more data if gth_data-LOEKZ = 'U' . "OR gth_data-LOEKZ = 'D'
if P1 = 'X'.
update ZFO_DATA from gth_data. "删除,更改的,确实要下载到服务器的,更改数据记录。
endif.
else.
gth_ekko-LOEKZ = 'C'. "数据存在,标志为C
endif. ENDIF.
IF P1 = 'X'.
INSERT ZFO_DATA from gth_data. "can insert if something is new
ENDIF.* IF sy-subrc <> 0.
*
* ENDIF. MOVE-CORRESPONDING gth_ekko TO gth_display.
*** 部件号 制造商部件编号 制造商名称 旧物料号 制造商代码 原产国代码 READ TABLE gtd_mara INTO gth_mara WITH KEY matnr = gth_ekko-ematn.
IF sy-subrc = 0.
* gth_display-wrkst = gth_mara-wrkst.
gth_display-mfrpn = gth_mara-mfrpn.
gth_display-name2 = gth_mara-name1. gth_display-MFRNR = gth_mara-MFRNR. "Manufacturer code
gth_display-LAND1 = gth_mara-LAND1. "country ENDIF.
***统计已入库数量
LOOP AT gtd_mseg INTO gth_mseg WHERE ebeln = gth_ekko-ebeln AND ebelp = gth_ekko-ebelp .
SELECT SINGLE * FROM mseg WHERE smbln = gth_mseg-mblnr AND sjahr = gth_mseg-mjahr AND smblp = gth_mseg-zeile AND bwart = '102'.
IF sy-subrc <> 0.
lwk_qty = lwk_qty + gth_mseg-menge.
ENDIF.
ENDLOOP.
gth_display-menge02 = lwk_qty .
CLEAR: lwk_qty.
*** 未交货数量
* gth_display-menge03 = gth_display-menge - gth_display-menge02 .
*** 确认交货时间
SELECT SINGLE eindt INTO gth_display-eindt
FROM eket
WHERE ebeln = gth_ekko-ebeln AND ebelp = gth_ekko-ebelp.
gth_display-street = '浙江省嘉兴市亚太路1号'. APPEND gth_display TO gtd_display.
ENDLOOP.
ENDFORM. "SUB_PROCESS.
*&---------------------------------------------------------------------*
*& FORM SUB_DISPLAY.
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*.FORM sub_display.
*** FIELD CATEGORY
PERFORM sub_fieldcat.
*** LAYOUT SETTING
gth_layout-colwidth_optimize = 'X'.*** CALL FUNCTION
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZFI021'
i_default = 'X'
i_save = 'X'
* I_CALLBACK_PF_STATUS_SET = 'STATUS_SET'
* I_CALLBACK_USER_COMMAND = 'SUB_USERCOMMAND'
it_fieldcat = gtd_fieldcat
is_layout = gth_layout
TABLES
t_outtab = gtd_display
EXCEPTIONS
program_error = 1
other = 2.ENDFORM. "SUB_DISPLAY
*&---------------------------------------------------------------------*
*& FORM SUB_FIELDCAT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*FORM sub_fieldcat.
gth_fieldcat-fieldname = 'LOEKZ' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '标志'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'EBELN' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '采购订单号'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat.
gth_fieldcat-fieldname = 'EBELP' .
gth_fieldcat-tabname = 'GTD_DISPLAY'.
gth_fieldcat-seltext_m = '订单行号'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'BEDAT' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '订单签发日期'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'MATNR' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '部件编号'.
gth_fieldcat-ref_fieldname = 'MATNR'.
gth_fieldcat-ref_tabname = 'MARA'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'BISMT' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '客户部件编号'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat.
gth_fieldcat-fieldname = 'MFRPN'.
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '制造商部件编号'.
gth_fieldcat-ref_fieldname = 'IDNLF'.
gth_fieldcat-ref_tabname = 'MARA'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat.
gth_fieldcat-fieldname = 'LIFNR' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '供应商代码'.
GTH_FIELDCAT-REF_FIELDNAME = 'LIFNR'.
GTH_FIELDCAT-REF_TABNAME = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'EINDT' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '计划供货日期'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'WAERS' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '结算币种'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'EKGRP' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '采购组'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'MENGE' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '订货数量'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'MEINS' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '计量单位'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'NETPR' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '采购成本单价'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'NAME1' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '供应商名称'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'MFRNR' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '制造商代码'.
gth_fieldcat-ref_fieldname = 'MFRNR'.
gth_fieldcat-ref_tabname = 'MARA'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'NAME2' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '制造商名称'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'LAND1' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '原产国代码'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'MENGE02' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '已收数量'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat. gth_fieldcat-fieldname = 'STREET' .
gth_fieldcat-tabname = 'GTD_DISPLAY' .
gth_fieldcat-seltext_m = '送货地点'.
* gth_fieldcat-ref_fieldname = 'EBELN'.
* gth_fieldcat-ref_tabname = 'EKKO'.
APPEND gth_fieldcat TO gtd_fieldcat.
CLEAR gth_fieldcat.ENDFORM . "SUB_FIELDCAT