*&---------------------------------------------------------------------*
*& Report ZSD066
*&
*&---------------------------------------------------------------------*
*& 附件 https://files.cnblogs.com/files/twttafku/%E6%89%B9%E9%87%8F%E5%88%9B%E5%BB%BA%E9%94%80%E5%94%AE%E8%AE%A2%E5%8D%95..rar
*&批量创建销售订单EXCEL上传方式
*&---------------------------------------------------------------------*
REPORT ZSDA66.
DATA: BEGIN OF S_EXT ,
EXT01 TYPE ZISPN,
EXT02 TYPE ZKAPN,
EXT03 TYPE ZPROD,
EXT04 TYPE CHAR100,
EXT05 TYPE CHAR100,
EXT06 TYPE CHAR100,
EXT07 TYPE CHAR100,
EXT08 TYPE CHAR100,
EXT09 TYPE CHAR100,
EXT10 TYPE CHAR100,
EXT11 TYPE CHAR100,
EXT12 TYPE CHAR100,
EXT13 TYPE CHAR100,
EXT14 TYPE ZADRS,
EXT15 TYPE ZCPSN,
EXT16 TYPE ZCTEL,
EXT17 TYPE ZSTOR,
EXT18 TYPE ZCREF,
S_PROC_IND TYPE SDABW,
END OF S_EXT.
DATA: G_DATAFILE TYPE STRING, "Local ASCII Text File
G_RTNCODE TYPE I,
W_ACCEPTED TYPE I,
ROWS TYPE I,
G_CURRENTROW TYPE I.
DATA: ITAB LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
*定义EXCEL数据保存内表
DATA: BEGIN OF TY_ITAB, "定义储存EXCEL数据的内表
AUART LIKE VBAK-AUART, "订单类型
VKORG LIKE VBAK-VKORG, "销售组织
VTWEG LIKE VBAK-VTWEG, "分销渠道
BSTDK_E LIKE VBKD-BSTDK_E, "需求发货日期
BSTKD_E LIKE VBKD-BSTKD_E, "项目IS编号
KUNNR LIKE VBAK-KUNNR, "售达方
KUNNR2 LIKE VBAK-KUNNR, "送达方
BSTKD LIKE VBKD-BSTKD, "采购订单编码
AUGRU LIKE VBAK-AUGRU, "采购订单原因
VDATU LIKE VBAK-VDATU, "请求交货日期
IHREZ_E TYPE TEXT12, "首次订单评审交期
*VDATU(8) type c,
ADR(255) TYPE C,
ADR1(255) TYPE C,
SHORT_TEXT(40) TYPE C, "行项目文本
POSNR LIKE VBAP-POSNR, "行项目
MATNR LIKE VBAP-MATNR, "物料编码
KWMENG LIKE VBAP-KWMENG, "订单数量
NETWR LIKE VBAP-NETWR, "特殊单价
WERKS LIKE VBAP-WERKS, "工厂
VSBED LIKE VBAK-VSBED, "装运点
LGORT LIKE VBAP-LGORT, "库存地点
DUN_DATE TYPE MAHDT, "最后联系日期
ZZACT TYPE VBAK-ZZACT, "活动
ITEM_CATEG TYPE PSTYV, " 项目类
P3_KUNNR TYPE KUNNR,
REF_DOC TYPE VGBEL,
REF_DOC_IT TYPE VGPOS,
REF_DOC_CA TYPE VBTYP_V,
PS_PSP_PNR TYPE PS_PSP_PNR,
WBS_ELEM TYPE PS_POSID,
*----------------- 201804 BEGIN ADD--------------------------*
PURCH_NO_C LIKE BAPISDITM-PURCH_NO_C, "售达方采购订单编号
*----------------- 201804 END ADD----------------------------*
* ADD BY LH 增加收货人信息
PER_ADDR TYPE STRING, "add by LH 收货人地址
PER_NAME TYPE STRING, "收货人
PER_TELE TYPE STRING. "收货人电话(区号-电话号/手机号)
INCLUDE STRUCTURE S_EXT.
DATA END OF TY_ITAB.
DATA: BEGIN OF I_HEADER, "定义订单抬头
VSBED LIKE VBAK-VSBED, "装运条件
AUART LIKE VBAK-AUART, "订单类型
VKORG LIKE VBAK-VKORG, "销售组织
VTWEG LIKE VBAK-VTWEG, "分销渠道