BAPI业务创建采购订单

合集下载

ABAP创建销售订单BAPI示例

ABAP创建销售订单BAPI示例

ABAP创建销售订单BAPI⽰例ABAP中创建销售订单1.BAPI1. BAPI_SALESORDER_CREATEFROMDAT22. BAPI_CUSTOMERRETURN_CREATE3. SD_SALESDOCUMENT_CREATE2.BAPIBAPI_SALESORDER_CREATEFROMDAT2 业务对象限制为BUS2032BAPI_CUSTOMERRETURN_CREATE 业务对象限制为BUS2102SD_SALESDOCUMENT_CREATE 未限制业务对象类型BUS2030 客户询价单BUS2031 客户报价BUS2032 销售订单BUS2034 合同BUS2094 贷项订单BUS2096 借项订单BUS2102 退货订单BUS2103 后续免费送货订单BAPI_SALESORDER_CREATEFROMDAT2和BAPI_CUSTOMERRETURN_CREATE都在内部调⽤SD_SALESDOCUMENT_CREATE 对于不同订单类型(Z001,Z002…),配置了的SD凭证类型;可在TVAK表中VBTYP字段查看业务对象和SD凭证类型有绑定关系;⽐如Z008 Z009凭证,SD凭证类型为H(退货)所以需要使⽤业务对象类型BUS2102的BAPI;或者使⽤SD_SALESDOCUMENT_CREATE并设置参数BUSINESS_OBJECT = ‘BUS2102’3.4.5.此⽅法save_text切割的字符串结尾为空格时;会造成空格丢失,需要⾃⾏写逻辑处理处理逻辑:缩短切割长度(例如:120);然后判断前⼀⾏是否末尾为空格,如果空则将空格写⼊本⾏开头FUNCTION ZSD_IF0012.*"----------------------------------------------------------------------*"*"本地接⼝:*" IMPORTING*" VALUE(I_HEAD) TYPE ZSDS_CRM_IF007*" EXPORTING*" VALUE(RESULTCODE) TYPE CHAR1*" VALUE(RESULTMSG) TYPE BAPI_MSG*" VALUE(O_VBELN) TYPE VBELN*" TABLES*" T_ITEM STRUCTURE ZSDS_CRM_IF008*"----------------------------------------------------------------------DATA:WA_ORDER_HEADER_IN LIKE BAPISDHD1, "抬头WA_ORDER_HEADER_INX LIKE BAPISDHD1X, "抬头控制WA_LOGIC_SWITCH LIKE BAPISDLS, "内部控制参数GV_SALESDOCUMENT_EX LIKE BAPIVBELN-VBELN, "返回SO凭证号WA_ORDER_ITEMS_IN LIKE BAPISDITM, "⾏项⽬ORDER_ITEMS_IN LIKE TABLE OF BAPISDITM, "⾏项⽬WA_ORDER_ITEMS_INX LIKE BAPISDITMX, "⾏项⽬控制ORDER_ITEMS_INX LIKE TABLE OF BAPISDITMX, "⾏项⽬控制WA_ORDER_PARTNERS LIKE BAPIPARNR, "业务伙伴ORDER_PARTNERS LIKE TABLE OF BAPIPARNR, "业务伙伴WA_ORDER_SCHEDULES_IN LIKE BAPISCHDL, "计划⾏ORDER_SCHEDULES_IN LIKE TABLE OF BAPISCHDL, "计划⾏WA_ORDER_SCHEDULES_INX LIKE BAPISCHDLX, "计划⾏控制ORDER_SCHEDULES_INX LIKE TABLE OF BAPISCHDLX, "计划⾏控制WA_ORDER_CONDITIONS_IN LIKE BAPICOND, "定价条件ORDER_CONDITIONS_IN LIKE TABLE OF BAPICOND, "定价条件WA_ORDER_CONDITIONS_INX LIKE BAPICONDX, "定价条件控制ORDER_CONDITIONS_INX LIKE TABLE OF BAPICONDX, "定价条件控制WA_ORDER_TEXT LIKE BAPISDTEXT, "⽂本ORDER_TEXT LIKE TABLE OF BAPISDTEXT, "⽂本WA_EXTENSIONIN TYPE BAPIPAREX,ORDER_EXTENSIONIN TYPE TABLE OF BAPIPAREX,WA_RETURN LIKE BAPIRET2, "BAPI返回RETURN LIKE TABLE OF BAPIRET2. "BAPI返回DATA: WA_BAPE_VBAP TYPE BAPE_VBAP,WA_BAPE_VBAPX TYPE BAPE_VBAPX,WA_BAPE_VBAK TYPE BAPE_VBAK,WA_BAPE_VBAKX TYPE BAPE_VBAKX.DATA: WA_ITEM TYPE ZSDS_CRM_IF008,GS_LOGS TYPE ZALL_LOGS. "⽇志DATA: GT_DATA TYPE TABLE OF ZSDT_CRM_IF012, "业务数据WA_DATA TYPE ZSDT_CRM_IF012.DATA: GV_STRING TYPE STRING,GT_STRING TYPE TABLE OF CHAR_132,WA_STRING TYPE CHAR_132,GV_LENGTH TYPE I.SELECT *FROM ZMPPZB AS AFOR ALL ENTRIES IN @T_ITEMWHERE ZMPXX = @T_ITEM-ZMPXXINTO TABLE @DATA(GT_ZMPPZB).* 获取⽇志表流⽔号CALL FUNCTION 'NUMBER_RANGE_ENQUEUE'EXPORTINGOBJECT = 'ZLOG001'EXCEPTIONSFOREIGN_LOCK = 1OBJECT_NOT_FOUND = 2SYSTEM_FAILURE = 3OTHERS = 4.IF SY-SUBRC EQ 0.* Implement suitable error handling hereCALL FUNCTION 'NUMBER_GET_NEXT'EXPORTINGNR_RANGE_NR = '01'OBJECT = 'ZLOG001'IMPORTINGNUMBER = GS_LOGS-SEQNR* QUANTITY =* RETURNCODE =EXCEPTIONSINTERVAL_NOT_FOUND = 1NUMBER_RANGE_NOT_INTERN = 2OBJECT_NOT_FOUND = 3QUANTITY_IS_0 = 4QUANTITY_IS_NOT_1 = 5INTERVAL_OVERFLOW = 6BUFFER_OVERFLOW = 7OTHERS = 8.IF SY-SUBRC <> 0.* Implement suitable error handling hereENDIF.CALL FUNCTION 'NUMBER_RANGE_DEQUEUE'EXPORTINGOBJECT = 'ZLOG001'EXCEPTIONSOBJECT_NOT_FOUND = 1OTHERS = 2.IF SY-SUBRC <> 0.* Implement suitable error handling hereENDIF.ELSE.RAISE NUM_RANGE_ERROR .ENDIF.IF I_HEAD-SESSION_ID IS INITIAL.RESULTCODE = 'E'.RESULTMSG = |[SESSION_ID]不允许为空|.O_VBELN = ''.RETURN.ENDIF."Head extenntionSELECT SINGLE *FROM ZTXTGG AS AWHERE ZXTGG = @I_HEAD-ZXTGGINTO @DATA(WA_ZTXTGG).IF SY-SUBRC = 0.CLEAR WA_EXTENSIONIN.WA_BAPE_VBAK-ZXTGG = I_HEAD-ZXTGG.MOVE 'BAPE_VBAK' TO WA_EXTENSIONIN-STRUCTURE.CALL METHOD CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_CEXPORTINGIM_VALUE = WA_BAPE_VBAKIMPORTINGEX_CONTAINER = WA_EXTENSIONIN-VALUEPART1.APPEND WA_EXTENSIONIN TO ORDER_EXTENSIONIN.CLEAR WA_EXTENSIONIN.WA_BAPE_VBAKX-ZXTGG = ABAP_TRUE.MOVE 'BAPE_VBAKX' TO WA_EXTENSIONIN-STRUCTURE.MOVE WA_BAPE_VBAPX TO WA_EXTENSIONIN-VALUEPART1.APPEND WA_EXTENSIONIN TO ORDER_EXTENSIONIN.ELSE.RESULTCODE = 'E'.RESULTMSG = '箱贴规格未维护,请联系SD顾问'.O_VBELN = ''.RETURN.ENDIF."SO Header TextCLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = I_HEAD-ZTEXTP. "整单包装要求CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.* WA_ORDER_TEXT-doc_number = ''. "凭证号 = ⽂本名,创建时为空WA_ORDER_TEXT-ITM_NUMBER = SPACE. "space = 000000 代表抬头⽂本 WA_ORDER_TEXT-TEXT_ID = 'Z001'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = I_HEAD-ZTEXTD. "整单送货地址CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = SPACE. "space = 000000 代表抬头⽂本WA_ORDER_TEXT-TEXT_ID = 'Z002'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = I_HEAD-ZTEXTI. "整单开票要求CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = SPACE. "space = 000000 代表抬头⽂本WA_ORDER_TEXT-TEXT_ID = 'Z003'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = I_HEAD-ZTEXTO. "其他->整单参数特性CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = SPACE. "space = 000000 代表抬头⽂本WA_ORDER_TEXT-TEXT_ID = 'Z004'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP."SO HeaderCLEAR: WA_ORDER_HEADER_IN,WA_ORDER_HEADER_INX.WA_ORDER_HEADER_IN-DOC_TYPE = I_HEAD-AUART. "销售凭证类型WA_ORDER_HEADER_IN-CREATED_BY = I_HEAD-ERNAM. "创建⼈WA_ORDER_HEADER_IN-SALES_ORG = I_HEAD-VKORG. "销售组织WA_ORDER_HEADER_IN-SALES_GRP = I_HEAD-VKGRP. "销售组WA_ORDER_HEADER_IN-DISTR_CHAN = I_HEAD-VTWEG. "分销渠道WA_ORDER_HEADER_IN-DIVISION = I_HEAD-SPART. "产品组WA_ORDER_HEADER_IN-REQ_DATE_H = I_HEAD-VDATU. "请求交货⽇期WA_ORDER_HEADER_IN-DOC_DATE = SY-DATUM. "凭证时间WA_ORDER_HEADER_IN-ORD_REASON = I_HEAD-AUGRU. "订单原因WA_ORDER_HEADER_IN-CURRENCY = I_HEAD-WAERK. "销售和分销凭证货币WA_ORDER_HEADER_IN-PMNTTRMS = I_HEAD-ZTERM. "付款条件代码WA_ORDER_HEADER_IN-INCOTERMS1 = I_HEAD-INCO1. "国际贸易条款(第 1 部分)WA_ORDER_HEADER_IN-H_CURR = I_HEAD-WAERS. "货币码WA_ORDER_HEADER_INX-DOC_TYPE = ABAP_TRUE..WA_ORDER_HEADER_INX-SALES_ORG = ABAP_TRUE.WA_ORDER_HEADER_INX-DISTR_CHAN = ABAP_TRUE.WA_ORDER_HEADER_INX-DIVISION = ABAP_TRUE.WA_ORDER_HEADER_INX-REQ_DATE_H = ABAP_TRUE.WA_ORDER_HEADER_INX-DOC_DATE = ABAP_TRUE.WA_ORDER_HEADER_INX-ORD_REASON = ABAP_TRUE.WA_ORDER_HEADER_INX-CURRENCY = ABAP_TRUE.WA_ORDER_HEADER_INX-PMNTTRMS = ABAP_TRUE.WA_ORDER_HEADER_INX-INCOTERMS1 = ABAP_TRUE.WA_ORDER_HEADER_INX-H_CURR = ABAP_TRUE.WA_ORDER_HEADER_INX-H_CURR = ABAP_TRUE."SO PartnerI_HEAD-ZKUNNRSP = |{ I_HEAD-ZKUNNRSP ALPHA = IN }|.I_HEAD-ZKUNNRSH = |{ I_HEAD-ZKUNNRSH ALPHA = IN }|.SELECT KUNNR,ANRED,NAME1,LAND1,PSTLZ,ORT01,STRASFROM KNA1WHERE KUNNR = @I_HEAD-ZKUNNRSP* ,@I_HEAD-ZKUNNRSHINTO TABLE @DATA(LT_PARTNERS).CLEAR WA_ORDER_PARTNERS.READ TABLE LT_PARTNERS INTO DATA(WA_PARTNERS) WITH KEY KUNNR = I_HEAD-ZKUNNRSP. IF SY-SUBRC = 0.WA_ORDER_PARTNERS-PARTN_ROLE = 'AG'. "售达⽅WA_ORDER_PARTNERS-PARTN_NUMB = I_HEAD-ZKUNNRSP. "售达⽅代码WA_ORDER_PARTNERS-TITLE = WA_PARTNERS-ANRED. "抬头->公司WA_ORDER_PARTNERS-NAME = WA_PARTNERS-NAME1. "名称1WA_ORDER_PARTNERS-COUNTRY = WA_PARTNERS-LAND1. "国家代码WA_ORDER_PARTNERS-POSTL_CODE = WA_PARTNERS-PSTLZ. "邮政编码WA_ORDER_PARTNERS-CITY = WA_PARTNERS-ORT01. "城市WA_ORDER_PARTNERS-STREET = WA_PARTNERS-STRAS. "街道APPEND WA_ORDER_PARTNERS TO ORDER_PARTNERS.ELSE.RESULTCODE = 'E'.RESULTMSG = '售达⽅不存在'.O_VBELN = ''.RETURN.ENDIF.CLEAR: WA_ORDER_PARTNERS,WA_PARTNERS.READ TABLE LT_PARTNERS INTO WA_PARTNERS WITH KEY KUNNR = I_HEAD-ZKUNNRSH. IF SY-SUBRC = 0.WA_ORDER_PARTNERS-PARTN_ROLE = 'WE'. "送达⽅WA_ORDER_PARTNERS-PARTN_NUMB = I_HEAD-ZKUNNRSH. "送达⽅代码WA_ORDER_PARTNERS-TITLE = WA_PARTNERS-ANRED. "抬头->公司WA_ORDER_PARTNERS-NAME = WA_PARTNERS-NAME1. "名称1WA_ORDER_PARTNERS-COUNTRY = WA_PARTNERS-LAND1. "国家代码WA_ORDER_PARTNERS-POSTL_CODE = WA_PARTNERS-PSTLZ. "邮政编码WA_ORDER_PARTNERS-CITY = WA_PARTNERS-ORT01. "城市WA_ORDER_PARTNERS-STREET = WA_PARTNERS-STRAS. "街道APPEND WA_ORDER_PARTNERS TO ORDER_PARTNERS.ELSE.RESULTCODE = 'E'.RESULTMSG = '送达⽅不存在'.O_VBELN = ''.RETURN.ENDIF."SO Condition HeaderCLEAR: WA_ORDER_CONDITIONS_IN,WA_ORDER_CONDITIONS_INX.WA_ORDER_CONDITIONS_IN-ITM_NUMBER = SPACE. "⾏项⽬ space = 抬头WA_ORDER_CONDITIONS_IN-COND_TYPE = 'ZF01'. "运费WA_ORDER_CONDITIONS_IN-CURRENCY = I_HEAD-WAERS. "货币码/%WA_ORDER_CONDITIONS_IN-COND_VALUE = I_HEAD-ZYSJG. "运费价格WA_ORDER_CONDITIONS_INX-ITM_NUMBER = SPACE.WA_ORDER_CONDITIONS_INX-COND_TYPE = 'ZF01'.WA_ORDER_CONDITIONS_INX-CURRENCY = ABAP_TRUE.WA_ORDER_CONDITIONS_INX-COND_VALUE = ABAP_TRUE.APPEND WA_ORDER_CONDITIONS_IN TO ORDER_CONDITIONS_IN.APPEND WA_ORDER_CONDITIONS_INX TO ORDER_CONDITIONS_INX.CLEAR: WA_ORDER_CONDITIONS_IN,WA_ORDER_CONDITIONS_INX.WA_ORDER_CONDITIONS_IN-ITM_NUMBER = SPACE. "⾏项⽬ space = 抬头WA_ORDER_CONDITIONS_IN-COND_TYPE = 'ZF02'. "保险费WA_ORDER_CONDITIONS_IN-CURRENCY = I_HEAD-WAERS. "货币码WA_ORDER_CONDITIONS_IN-COND_VALUE = I_HEAD-ZBXJG. "保险价格WA_ORDER_CONDITIONS_INX-ITM_NUMBER = SPACE.WA_ORDER_CONDITIONS_INX-COND_TYPE = 'ZF02'.WA_ORDER_CONDITIONS_INX-CURRENCY = ABAP_TRUE.WA_ORDER_CONDITIONS_INX-COND_VALUE = ABAP_TRUE.APPEND WA_ORDER_CONDITIONS_IN TO ORDER_CONDITIONS_IN.APPEND WA_ORDER_CONDITIONS_INX TO ORDER_CONDITIONS_INX."SO ITEMLOOP AT T_ITEM INTO WA_ITEM.IF WA_ITEM-POSNR IS INITIAL.RESULTCODE = 'E'.RESULTMSG = |[LINE:{ SY-TABIX }]⾏项⽬号不允许为空|.O_VBELN = ''.RETURN.ENDIF."Item extenntionREAD TABLE GT_ZMPPZB INTO DATA(WA_ZMPPZB) WITH KEY ZMPXX = WA_ITEM-ZMPXX. IF SY-SUBRC = 0.CLEAR WA_EXTENSIONIN.WA_BAPE_VBAP-POSNR = WA_ITEM-POSNR.WA_BAPE_VBAP-ZMPXX = WA_ZMPPZB-ZMPXX.WA_BAPE_VBAP-ZMPGG = WA_ZMPPZB-ZMPGG.WA_BAPE_VBAP-ZMPDX = WA_ZMPPZB-ZMPDX.WA_BAPE_VBAP-ZMPBM = WA_ZMPPZB-ZMPBM.MOVE 'BAPE_VBAP' TO WA_EXTENSIONIN-STRUCTURE.CALL METHOD CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_CEXPORTINGIM_VALUE = WA_BAPE_VBAPIMPORTINGEX_CONTAINER = WA_EXTENSIONIN-VALUEPART1.APPEND WA_EXTENSIONIN TO ORDER_EXTENSIONIN.CLEAR WA_EXTENSIONIN.WA_BAPE_VBAPX-POSNR = WA_ITEM-POSNR.WA_BAPE_VBAPX-ZMPXX = ABAP_TRUE.WA_BAPE_VBAPX-ZMPGG = ABAP_TRUE.WA_BAPE_VBAPX-ZMPDX = ABAP_TRUE.WA_BAPE_VBAPX-ZMPBM = ABAP_TRUE.MOVE 'BAPE_VBAPX' TO WA_EXTENSIONIN-STRUCTURE.MOVE WA_BAPE_VBAPX TO WA_EXTENSIONIN-VALUEPART1.APPEND WA_EXTENSIONIN TO ORDER_EXTENSIONIN.ELSE.RESULTCODE = 'E'.RESULTMSG = '铭牌选项未维护,请联系SD顾问'.O_VBELN = ''.RETURN.ENDIF."保存业务数据WA_DATA-SEQNR = GS_LOGS-SEQNR.WA_DATA-ZINDEX = WA_ITEM-POSNR.MOVE-CORRESPONDING I_HEAD TO WA_DATA.MOVE-CORRESPONDING WA_ITEM TO WA_DATA.WA_DATA-ZDATE = SY-DATUM.WA_DATA-ZTIME = SY-UZEIT.WA_DATA-ZUSER = SY-UNAME.APPEND WA_DATA TO GT_DATA.CLEAR WA_DATA.WA_ITEM-MATNR = |{ WA_ITEM-MATNR ALPHA = IN }|.WA_ORDER_ITEMS_IN-ITM_NUMBER = WA_ITEM-POSNR. "⾏项⽬WA_ORDER_ITEMS_IN-MATERIAL = WA_ITEM-MATNR. "物料编号WA_ORDER_ITEMS_IN-TARGET_QTY = WA_ITEM-DZMENG. "⽬标数量(采⽤销售单位)WA_ORDER_ITEMS_IN-TARGET_QU = WA_ITEM-VRKME. "数量单位WA_ORDER_ITEMS_IN-SALES_UNIT = WA_ITEM-VRKME. "销售单位WA_ORDER_ITEMS_IN-INCOTERMS2L = I_HEAD-INCO2. "国际贸易条款位置 1WA_ORDER_ITEMS_IN-PLANT = '1100'. "⼯⼚* WA_ORDER_ITEMS_IN-STORE_LOC = WA_ITEM-LGORT. "库存地* WA_ORDER_ITEMS_IN-BATCH = WA_ITEM-CHARG. "批次WA_ORDER_ITEMS_INX-ITM_NUMBER = ABAP_TRUE.WA_ORDER_ITEMS_INX-MATERIAL = ABAP_TRUE.WA_ORDER_ITEMS_INX-TARGET_QTY = ABAP_TRUE.WA_ORDER_ITEMS_INX-TARGET_QU = ABAP_TRUE.WA_ORDER_ITEMS_INX-SALES_UNIT = ABAP_TRUE.WA_ORDER_ITEMS_INX-INCOTERMS2L = ABAP_TRUE.WA_ORDER_ITEMS_INX-PLANT = ABAP_TRUE.APPEND WA_ORDER_ITEMS_IN TO ORDER_ITEMS_IN.APPEND WA_ORDER_ITEMS_INX TO ORDER_ITEMS_INX."SCHEDULE LineCLEAR WA_ORDER_SCHEDULES_IN.WA_ORDER_SCHEDULES_IN-ITM_NUMBER = WA_ITEM-POSNR. "⾏项⽬WA_ORDER_SCHEDULES_IN-REQ_QTY = WA_ITEM-DZMENG. "数量APPEND WA_ORDER_SCHEDULES_IN TO ORDER_SCHEDULES_IN.CLEAR WA_ORDER_SCHEDULES_INX.WA_ORDER_SCHEDULES_INX-ITM_NUMBER = ABAP_TRUE.WA_ORDER_SCHEDULES_INX-REQ_QTY = ABAP_TRUE.APPEND WA_ORDER_SCHEDULES_INX TO ORDER_SCHEDULES_INX."SO Condition ItemCLEAR: WA_ORDER_CONDITIONS_IN,WA_ORDER_CONDITIONS_INX.WA_ORDER_CONDITIONS_IN-ITM_NUMBER = WA_ITEM-POSNR. "⾏项⽬WA_ORDER_CONDITIONS_IN-COND_TYPE = 'ZR01'. "含税价格WA_ORDER_CONDITIONS_IN-CURRENCY = I_HEAD-WAERK. "货币码WA_ORDER_CONDITIONS_IN-COND_VALUE = WA_ITEM-KBETR. "含税单价* WA_ORDER_CONDITIONS_IN-cond_unit = ''. "条件单位* WA_ORDER_CONDITIONS_IN-cond_p_unt = ''. "条件定价单位WA_ORDER_CONDITIONS_INX-ITM_NUMBER = WA_ITEM-POSNR.WA_ORDER_CONDITIONS_INX-COND_TYPE = 'ZR01'.WA_ORDER_CONDITIONS_INX-CURRENCY = ABAP_TRUE.WA_ORDER_CONDITIONS_INX-COND_VALUE = ABAP_TRUE.APPEND WA_ORDER_CONDITIONS_IN TO ORDER_CONDITIONS_IN.APPEND WA_ORDER_CONDITIONS_INX TO ORDER_CONDITIONS_INX.CLEAR: WA_ORDER_CONDITIONS_IN,WA_ORDER_CONDITIONS_INX.WA_ORDER_CONDITIONS_IN-ITM_NUMBER = WA_ITEM-POSNR. "⾏项⽬WA_ORDER_CONDITIONS_IN-COND_TYPE = 'ZK07'. "折扣WA_ORDER_CONDITIONS_IN-CURRENCY = ''. "货币码/% space = %WA_ORDER_CONDITIONS_IN-COND_VALUE = WA_ITEM-ZPERCNT."折扣⽐例 WA_ORDER_CONDITIONS_INX-ITM_NUMBER = WA_ITEM-POSNR.WA_ORDER_CONDITIONS_INX-COND_TYPE = 'ZK07'.WA_ORDER_CONDITIONS_INX-CURRENCY = ABAP_TRUE.WA_ORDER_CONDITIONS_INX-COND_VALUE = ABAP_TRUE.APPEND WA_ORDER_CONDITIONS_IN TO ORDER_CONDITIONS_IN.APPEND WA_ORDER_CONDITIONS_INX TO ORDER_CONDITIONS_INX.CLEAR: WA_ORDER_CONDITIONS_IN,WA_ORDER_CONDITIONS_INX.WA_ORDER_CONDITIONS_IN-ITM_NUMBER = WA_ITEM-POSNR. "⾏项⽬WA_ORDER_CONDITIONS_IN-COND_TYPE = 'ZDPG'. "价格体系WA_ORDER_CONDITIONS_IN-CURRENCY = ''. "货币码/% space = %WA_ORDER_CONDITIONS_IN-COND_VALUE = WA_ITEM-ZZDPG. "客户折扣⽐例 WA_ORDER_CONDITIONS_INX-ITM_NUMBER = WA_ITEM-POSNR.WA_ORDER_CONDITIONS_INX-COND_TYPE = 'ZDPG'.WA_ORDER_CONDITIONS_INX-CURRENCY = ABAP_TRUE.WA_ORDER_CONDITIONS_INX-COND_VALUE = ABAP_TRUE.APPEND WA_ORDER_CONDITIONS_IN TO ORDER_CONDITIONS_IN.APPEND WA_ORDER_CONDITIONS_INX TO ORDER_CONDITIONS_INX."SO Item TextCLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = WA_ITEM-ZTEXTBD. "物料基本描述CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = WA_ITEM-POSNR. "⽂本⾏项⽬WA_ORDER_TEXT-TEXT_ID = 'GRUN'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = WA_ITEM-ZTEXTAB. "⾏参数特性要求CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = WA_ITEM-POSNR. "⽂本⾏项⽬WA_ORDER_TEXT-TEXT_ID = 'Z001'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = WA_ITEM-ZTEXTAD. "⾏送货地址CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = WA_ITEM-POSNR. "⽂本⾏项⽬ WA_ORDER_TEXT-TEXT_ID = 'Z002'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = WA_ITEM-ZTEXTW. "受托加⼯备注CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = WA_ITEM-POSNR. "⽂本⾏项⽬ WA_ORDER_TEXT-TEXT_ID = 'Z003'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR: WA_ORDER_TEXT,GV_LENGTH,GT_STRING,WA_STRING.LV_STRING = WA_ITEM-ZTEXTX. "⾏维修信息备注CALL FUNCTION 'SCMS_STRING_TO_FTEXT'EXPORTINGTEXT = LV_STRINGIMPORTINGLENGTH = LV_LENGTHTABLESFTEXT_TAB = LT_STRING. "132长度切割⼀次LOOP AT LT_STRING INTO WA_STRING.CLEAR WA_ORDER_TEXT.WA_ORDER_TEXT-ITM_NUMBER = WA_ITEM-POSNR. "⽂本⾏项⽬ WA_ORDER_TEXT-TEXT_ID = 'Z007'. "⽂本IDWA_ORDER_TEXT-LANGU = 1. "语⾔代码1->中⽂WA_ORDER_TEXT-LANGU_ISO = 'ZH'. "语⾔ISO代码->zhIF SY-TABIX = 1.WA_ORDER_TEXT-FORMAT_COL = '*'. "标记列ELSE.WA_ORDER_TEXT-FORMAT_COL = '/'.ENDIF.WA_ORDER_TEXT-TEXT_LINE = WA_STRING.APPEND WA_ORDER_TEXT TO ORDER_TEXT.ENDLOOP.CLEAR WA_ITEM.ENDLOOP.CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'EXPORTINGaSALES_HEADER_IN = WA_ORDER_HEADER_INSALES_HEADER_INX = WA_ORDER_HEADER_INXCONVERT_PARVW_AUART = ABAP_ONLOGIC_SWITCH = WA_LOGIC_SWITCHIMPORTINGSALESDOCUMENT_EX = GV_SALESDOCUMENT_EXTABLESRETURN = RETURNSALES_ITEMS_IN = ORDER_ITEMS_INSALES_ITEMS_INX = ORDER_ITEMS_INXSALES_SCHEDULES_IN = ORDER_SCHEDULES_INSALES_SCHEDULES_INX = ORDER_SCHEDULES_INXSALES_CONDITIONS_IN = ORDER_CONDITIONS_INSALES_CONDITIONS_INX = ORDER_CONDITIONS_INXEXTENSIONIN = ORDER_EXTENSIONINSALES_PARTNERS = ORDER_PARTNERSSALES_TEXT = ORDER_TEXT.IF SY-SUBRC = 0 AND GV_SALESDOCUMENT_EX IS NOT INITIAL.RESULTCODE = 'S'.RESULTMSG = '销售订单创建成功'.O_VBELN = GV_SALESDOCUMENT_EX.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGWAIT = 'X'.ELSE.SELECT SINGLE *FROM @RETURN AS AWHERE TYPE = 'E'INTO @WA_RETURN.RESULTCODE = 'E'.RESULTMSG = |[MESSAGE NO.{ WA_RETURN-ID }{ WA_RETURN-NUMBER }]{ WA_RETURN-MESSAGE }|. O_VBELN = GV_SALESDOCUMENT_EX.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.ENDIF.* 添加⽇志表记录GS_LOGS-SEQNR = GS_LOGS-SEQNR.GS_LOGS-ZIFNAME = 'ZSD_IF0012'.GS_LOGS-ZSYSTEM = 'CRM/SAP'.* 1代表调⽤其他系统接⼝,2代表被其他系统调⽤GS_LOGS-ZCALL = '2'.GS_LOGS-ZTYPE = RESULTCODE.GS_LOGS-ZMSG = RESULTMSG.GS_LOGS-ZDATE = SY-DATUM.GS_LOGS-ZTIME = SY-UZEIT.GS_LOGS-ZUSER = SY-UNAME.GS_LOGS-ZVALUE1 = 'CRM->SAP 销售订单创建接⼝'.GS_LOGS-ZVALUE2 = O_VBELN. " 销售订单号* 对应业务数据表GS_LOGS-ZTBNAME = 'ZSDT_CRM_IF012'.MODIFY ZALL_LOGS FROM GS_LOGS.MODIFY ZSDT_CRM_IF012 FROM TABLE GT_DATA.ENDFUNCTION.。

创建订单操作手册

创建订单操作手册

采购订单信息点击“订单管理”,点击“订单执行”,点击“新建采购订单”,打开<新建采购订单>页面。

1.填写信息,其中红色字为必填项。

其中订单类型为”采购订单”的订单需关联框架合同.2.查询库存。

若选择的采购类别为:设备类,则需要进行库存查询.为了保证库存物资的利用,通过LIS系统库存查询确认某物资是否有库存,可通过本功能窗口进行查询。

3.全部填写操作完毕,点击【保存】按钮,保存采购订单。

保存完毕,该页面下面出现添加采购订单产品信息的功能。

可以进行采购产品的添加。

注意:1)无关联的采购订单必须要上传需求函文件。

需求函文件即需求部门通过OA提交的请购申请文件,作为订单下达的依据,供审批人查看,不发送至供应商。

2)需发布给供应商的其他订单附加信息可通过附件形式上传,但合同清单不得以附件形式发送。

3)"采购订单信息"保存之后,"采购订单产品信息"才可以操作。

新建采购订单界面字段字填入规则1.1.1.1.1采购订单产品信息1.保存了订单表头之后,将会在下方位置出现集采产品/自采产品的产品清单列表、项目费用信息列表。

采购订单总金额=产品金额+费用金额。

2.添加产品信息。

1)添加:自采产品:点击【添加】按钮,打开<供应商产品选择对话框>页面。

选择供应商产品,点击【确认】按钮。

2)查看/编辑:选中已添加的产品,点击【查看/编辑】按钮,打开<产品信息>页面。

填写必填项,点击【保存并关闭】按钮,保存信息并关闭页面。

✓自采产品信息中可填写订购数量和单价,也可以在添加产品界面直接填写。

添加自采产品界面输入单价后,金额合计根据公式自动计算显示。

公式为金额合计=订购数量*单价。

3)导入/导出:点击【导出】按钮,导出产品数据。

点击【导入】按钮,导入产品数据。

点击【导出模版】按钮,下载对应的采购订单行的导入导出模板文件。

模板下载界面4)可批量设置属性:勾选多个记录,点击【批量设置属性】按钮,可以批量设置属性。

[BAPI]使用BAPI_GOODSMVT_CREATE创建委外订单(subcontrac。。。

[BAPI]使用BAPI_GOODSMVT_CREATE创建委外订单(subcontrac。。。

[BAPI]使⽤BAPI_GOODSMVT_CREATE创建委外订单(subcontrac。

下⾯介绍⼀下使⽤bapi BAPI_GOODSMVT_CREATE为委外订单创建物料移动凭证。

例⼦代码:*&---------------------------------------------------------------------**& Report YTEST_SUBCONTRACT_MIGO*&---------------------------------------------------------------------**&*&---------------------------------------------------------------------*REPORT ytest_subcontract_migo.DATA:lt_return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,l_doc TYPE mseg-mblnr,l_year TYPE mseg-mjahr,lt_item TYPE STANDARD TABLE OF bapi2017_gm_item_create WITH HEADER LINE,lwa_header TYPE bapi2017_gm_head_01,lwa_code TYPE bapi2017_gm_code.DATA:l_line_id TYPE mseg-line_id VALUE '000000',l_parent_id TYPE mseg-parent_id VALUE '000000',l_line_depth TYPE mseg-line_depth VALUE '00'.lwa_code-gm_code = '01' . "MB01lwa_header-pstng_date = sy-datum. "凭证中的过帐⽇期lwa_header-doc_date = sy-datum. "凭证中的凭证⽇期lwa_header-pr_uname = sy-uname. "⽤户名lwa_header-ref_doc_no = '123456'. "参考订单lwa_header-header_txt = 'Header text'. "抬头⽂本* 物料lt_item-material = '000000410000000043'.* ⼯⼚lt_item-plant = '1286'.* 批次号lt_item-batch = '1808031000'.* 移动类型lt_item-move_type = '101'.* 库存地点lt_item-stge_loc = '1103'.* 基本单位数量lt_item-entry_qnt = 57040.* 输⼊单位lt_item-entry_uom = 'KG'.* 订单单位数量lt_item-po_pr_qnt = 57040.* 订单价格单位(采购)lt_item-orderpr_un = 'KG'.* 采购订单号lt_item-po_number = 4400000011.* 采购凭证的项⽬编号lt_item-po_item = '00010'.lt_item-mvt_ind = 'B'.* 凭证⾏的唯⼀标识l_line_id = l_line_id + 1.l_parent_id = l_line_id.lt_item-line_id = l_line_id.APPEND lt_item.CLEAR:lt_item.lt_item-move_type = '543'.* 物料编号lt_item-material = '000000410000000044'.* ⼯⼚lt_item-plant = '1286'.lt_item-spec_stock = 'O'.* 批次号lt_item-batch = '0000000004'.* 数量lt_item-entry_qnt = 3600.* 基本计量单位lt_item-entry_uom = 'KG'.* 上⼀⾏的识别码lt_item-parent_id = l_parent_id.* 凭证⾏的唯⼀标识l_line_id = l_line_id + 1.lt_item-line_id = l_line_id.* 凭证中⾏层次结构级别l_line_depth = '01'.lt_item-line_depth = l_line_depth.APPEND lt_item.CALL FUNCTION'BAPI_GOODSMVT_CREATE'EXPORTINGgoodsmvt_header = lwa_headergoodsmvt_code = lwa_code* TESTRUN = ' '* GOODSMVT_REF_EWM =* GOODSMVT_PRINT_CTRL =IMPORTING* GOODSMVT_HEADRET =materialdocument = l_docmatdocumentyear = l_yearTABLESgoodsmvt_item = lt_itemreturn = lt_return.LOOP AT lt_return WHERE type CA 'AEX'.EXIT.ENDLOOP.IF sy-subrc = 0.CALL FUNCTION'BAPI_TRANSACTION_ROLLBACK'.WRITE:'Failed'.ELSE.CALL FUNCTION'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.WRITE:'物料凭证号:', l_doc.ENDIF.代码不复杂,需要注意的是字段line_id,parent_id,line_depth要填写正确,line_id是⽤来唯⼀标识⾏项⽬的,委外⾏要正确制定上层⾏项⽬ID,也就是把上层⾏项⽬的line_ID填到委外⾏的parent_ID字段中,line_depth也要按层次填⼊01...如果⾏项⽬字段填写不正确有时会出现M7 387错误。

bapi创建销售订单

bapi创建销售订单
tp_message STRUCTURE zifsret01
USING up_head LIKE zrmxsds000
CHANGING cp_eind TYPE c.
wa_partner-name = up_head-name1_we.
wa_partner-country = 'CN'.
ENDIF.
APPEND wa_partner TO lt_partner.
*Items
REFRESH: lt_item,lt_cond,lt_schdl.
lt_itemx TYPE STANDARD TABLE OF bapisditmx,
lt_schdl TYPE STANDARD TABLE OF bapischdl,
lt_schdlx TYPE STANDARD TABLE OF bapischdlx,
IF up_head-name1_rg IS NOT INITIAL. "一次性客户
wa_partner-name = up_head-name1_rg.
wa_partner-country
APPEND wa_partner TO lt_partner.
wa_condx TYPE bapicondx,
wa_schdl TYPE bapischdl, "交付计划
wa_schdlx TYPE bapischdlx,
wa_return TYPE bapiret2,
DATA: ls_item LIKE zrmxsds001,
ls_cond LIKE zrmxsds002,
ls_msg LIKE zifsret01.

SAP物料订单创建、下达、报工、收货与投料(ABAP代码)

SAP物料订单创建、下达、报工、收货与投料(ABAP代码)

SAP物料订单创建、下达、报工、收货与投料(ABAP代码)对主体订单下的某一类物料通过MRP控制者的判断,可以对此类物料进行自动创建生产订单,自动下达,报工、收货,最后对主体订单投料。

1、新增加一个MRP控制者:泵送钢管类物料的MRP控制者必须设置为168.2、根据输入条件读取主体订单(剔除CLSD、TECO、DLT)的OBOM清单,挑取MRP控制者为钢管(168)胶管(170)(泵送钢管订单、泵送胶管订单)下达钢管、胶管的生产订单(订单类型为PP51)。

3、程序在下达钢管、胶管的生产订单时候,要判断物料的MRP 类型是否是ND,若是ND的话,程序报错,则提示需要将该物料改为PD。

计划员手动修正MRP参数。

4、下达生产订单时,按物料编码将数量汇总下达钢管、胶管订单,基本完成日期取当天。

5、订单下达后(REL状态)模拟CO15报完工。

6、订单报完工后模拟MB31收货(移动类型为101,库存地点取MRP2视图生产仓储地)。

7、入库后模拟MB1A(移动类型为261,库存地点取MRP2视图的生产仓储地)对预留投料到对应的主体生产订单。

8、可选择部分MRP控制者未168的物料下生产订单9、在下了生产订单后,如果OBOM中增加了物料的数量,则对差异数量下单REPORT ZR_MM_GLDDCL.TABLES: AFKO,RESB,MARC,MAKT,ZGLDDCL.DATA: BEGIN OF GT_RESB OCCURS 0,AUFNR LIKE RESB-AUFNR,WERKS LIKE RESB-WERKS,RSPOS LIKE RESB-RSPOS,MATNR LIKE RESB-MATNR,MEINS LIKE RESB-MEINS,BDMNG LIKE RESB-BDMNG,ENMNG LIKE RESB-ENMNG,END OF GT_RESB.DATA: BEGIN OF ITAB_SHOW OCCURS 0, CHKID(1),WERKS LIKE RESB-WERKS,MATNR LIKE RESB-MATNR,MAKTX LIKE MAKT-MAKTX, '物料描述MEINS LIKE RESB-MEINS, '基本单位XLOEK LIKE RESB-XLOEK, '删除标识BDMNG LIKE RESB-BDMNG, '需求数量ENMNG LIKE RESB-ENMNG, '提取数量RGEKZ LIKE RESB-RGEKZ, '反冲DISPO LIKE MARC-DISPO, 'MRP控制者DISMM LIKE MARC-DISMM, 'MRP类型LGPRO LIKE MARC-LGPRO, '生产仓储地SCDDH LIKE RESB-AUFNR, '生成的生产订单号YCXX1(100), 'PD,ND异常判断YCXX2(100), '订单创建YCXX3(100), '下达YCXX4(100), '报工YCXX5(100), '收货END OF ITAB_SHOW.DATA: BEGIN OF GT_DDTL OCCURS 0, AUFNR LIKE RESB-AUFNR,WERKS LIKE RESB-WERKS,RSPOS LIKE RESB-RSPOS,MATNR LIKE RESB-MATNR,MEINS LIKE RESB-MEINS,BDMNG LIKE RESB-BDMNG,ENMNG LIKE RESB-ENMNG,LGPRO LIKE MARC-LGPRO,YCXX1(100),END OF GT_DDTL.DATA: BEGIN OF GT_AFKO OCCURS 0,RSNUM LIKE RESB-RSNUM,AUFNR LIKE AFKO-AUFNR,END OF GT_AFKO.DATA: BEGIN OF GT_MARC OCCURS 0,MATNR LIKE MARC-MATNR,DISPO LIKE MARC-DISPO,DISMM LIKE MARC-DISMM,LGPRO LIKE MARC-LGPRO,WERKS LIKE MARC-WERKS,END OF GT_MARC.DATA: BEGIN OF GT_MAKT OCCURS 0,MATNR LIKE MAKT-MATNR,MAKTX LIKE MAKT-MAKTX,END OF GT_MAKT.DATA: BEGIN OF BDCDATA OCCURS 0.INCLUDE STRUCTURE BDCDATA.DATA: END OF BDCDATA.DATA: BDCMESS LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.DATA: BDC_MODE(1).DATA: P_MODE LIKE CTU_PARAMS-DISMODE VALUE 'N'.DATA: IN_ZGLDDCL LIKE ZGLDDCL OCCURS 0 WITH HEADER LINE.DATA: GT_ZGLDDCL LIKE ZGLDDCL OCCURS 0 WITH HEADER LINE.DATA: TL_ZGLDDCL LIKE ZGLDDCL OCCURS 0 WITH HEADER LINE.DATA: FLAG_SUCCESS(1).RANGES: R_RSNUM FOR RESB-RSNUM.RANGES: R_MATNR FOR RESB-MATNR.*&--------------------------------------------------------------------**& 屏幕显示*&--------------------------------------------------------------------*SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.PARAMETERS: P_WERKS LIKE RESB-WERKS OBLIGATORY DEFAULT '1802','工厂P_DISPO LIKE MARC-DISPO DEFAULT '168'. 'MRP控制者SELECT-OPTIONS: S_AUFNR FOR AFKO-AUFNR.'生产订单SELECTION-SCREEN: END OF BLOCK B1.*&--------------------------------------------------------------------**& 程序执行*&--------------------------------------------------------------------*START-OF-SELECTION.PERFORM AUTHORITY_CHECK.PERFORM INPUT_CHECK.PERFORM GET_DATA.PERFORM SHOW.*&---------------------------------------------------------------------**& Form GET_DATA*&---------------------------------------------------------------------*FORM GET_DATA .DATA:LV_OBJNR TYPE AUFK-OBJNR,LV_LINE TYPE BSVX-STTXT,LV_LOEKZ TYPE AUFK-LOEKZ,LV_FLAG TYPE CHAR1.* 剔除订单状态为 CLSD、TECO、DLT、CRTD OBOM清单CLEAR: GT_AFKO,GT_AFKO[].SELECT RSNUM AUFNR INTO TABLE GT_AFKOFROM AFKOWHERE AUFNR IN S_AUFNR.IF GT_AFKO[] IS INITIAL.MESSAGE '该订单预留不存在!' TYPE 'S'.STOP.ENDIF.LOOP AT GT_AFKO.* 订单的对象号SELECT SINGLE OBJNR INTO LV_OBJNRFROM AUFKWHERE AUFNR = GT_AFKO-AUFNRAND LOEKZ = ''.IF LV_OBJNR IS NOT INITIAL.* 取得订单的订单状态CALL FUNCTION 'STATUS_TEXT_EDIT'EXPORTINGOBJNR = LV_OBJNRSPRAS = SY-LANGUIMPORTINGLINE = LV_LINEEXCEPTIONSOBJECT_NOT_FOUND = 1OTHERS = 2.IF LV_LINE CS 'TECO' OR LV_LINE CS 'CLSD' ORLV_LINE CS 'DLT' OR LV_LINE CS 'CRTD'.DELETE GT_AFKO.ENDIF.ENDIF.ENDLOOP.IF GT_AFKO[] IS INITIAL.MESSAGE '该订单预留不存在!' TYPE 'S'.STOP.ELSE.LOOP AT GT_AFKO.R_RSNUM-SIGN = 'I'.R_RSNUM-OPTION = 'EQ'.R_RSNUM-LOW = GT_AFKO-RSNUM.APPEND R_RSNUM.CLEAR R_RSNUM.ENDLOOP.ENDIF.SELECT AUFNR WERKS RSNUM RSPOS MATNR MEINS BDMNG ENMNG INTOCORRESPONDING FIELDS OF TABLE GT_RESBFROM RESBWHERE RSNUM IN R_RSNUMAND XLOEK <> 'X' '删除的AND DUMPS <> 'X' '虚拟件AND DBSKZ <> 'E' '父子订单物料,排除AND BDMNG <> '0'.LOOP AT GT_RESB.MOVE-CORRESPONDING GT_RESB TO ITAB_SHOW.COLLECT ITAB_SHOW.ENDLOOP.* 判断物料是否为钢管或胶管IF ITAB_SHOW[] IS NOT INITIAL.SELECT MATNR DISPO DISMM LGPRO WERKS INTO TABLE GT_MARCFROM MARCFOR ALL ENTRIES IN ITAB_SHOWWHERE MATNR = ITAB_SHOW-MATNRAND WERKS = ITAB_SHOW-WERKS.ENDIF.SORT GT_MARC BY MATNR.LOOP AT ITAB_SHOW.READ TABLE GT_MARC WITH KEY MATNR = ITAB_SHOW-MATNR BINARY SEARCH.IF SY-SUBRC = 0.ITAB_SHOW-DISPO = GT_MARC-DISPO.ITAB_SHOW-DISMM = GT_MARC-DISMM.ITAB_SHOW-LGPRO = GT_MARC-LGPRO.IF GT_MARC-DISMM = 'ND'.ITAB_SHOW-YCXX1 = 'MRP类型为ND,请手动修正MRP参数。

bapi 批量创建po的案例

bapi 批量创建po的案例

bapi批量创建PO一、概述在SAP系统中,使用BAPI(Business Application Programming Interface)批量创建采购订单(PO)是一项常见的操作。

BAPI是一种已定义好的函数模块,可以被外部系统调用,实现SAP系统数据的批量处理。

在企业日常运营中,需要大量的采购订单时,使用BAPI批量创建PO可以提高工作效率,减少手工操作的时间和错误率。

下面将以一个实际案例为例,介绍如何使用BAPI批量创建PO。

二、案例分析某公司在进行年度采购计划时,需要针对上千个物料编码创建对应的采购订单。

为了提高工作效率,决定使用BAPI进行批量创建PO操作。

在这个案例中,我们将以SAP系统中的BAPI_PO_CREATE1函数模块为例,详细介绍如何使用BAPI批量创建PO。

三、操作步骤1. 准备工作在进行批量创建PO之前,首先需要对数据进行准备。

这包括准备好需要采购的物料编码、采购数量、交货日期等相关信息,通常可以从公司的ERP系统中导出相关数据并存储为Excel或CSV格式。

2. 调用BAPI_PO_CREATE1在SAP系统中,可以通过SE37事务码来查找并调用函数模块。

在此案例中,我们将通过SE37找到BAPI_PO_CREATE1函数模块,并进行调用。

在调用BAPI时,需要将准备好的采购订单数据作为输入参数传递给BAPI_PO_CREATE1函数。

3. 处理返回结果调用BAPI_PO_CREATE1后,系统将返回相应的执行结果。

需要对返回的结果进行处理,检查是否有创建失败的采购订单,以及失败的原因。

在处理返回结果时,可以将成功创建的PO信息反馈给相关部门或人员,同时对失败的情况进行错误处理和重试操作。

四、注意事项在使用BAPI批量创建PO时,需要注意以下几个方面:1. 数据准备的准确性和完整性在进行批量创建PO之前,务必对数据进行准确性和完整性的检查,确保数据的准备工作没有遗漏和错误。

BAPI_GOODSMVT_CREATE(调拨收货发货入库退货)

BAPI_GOODSMVT_CREATE(调拨收货发货入库退货)

BAPI_GOODSMVT_CREATE(调拨收货发货⼊库退货)code-gm_code取值:01 MB01 按采购订单的货物移动02 MB31 按⽣产订单的货物移动03 MB1A 货物提取(⼯单退料04 MB1B 转移过帐05 MB1C 其他收货06 MB11 货物移动07 MB04 "物料供应"消耗的事后调整itab-mvt_ind = 'B'. "移动标识 ⽆参考的货物移动(空)B 按采购订单的货物移动F 有关⽣产单的货物移动L 有关交货通知的货物移动K 看板需求的货物移动(WM-仅限内部)O "提供物料"消耗的后续调整W ⽐例的后续调整/产品单位物料下⾯代码都已封装为 RFC调拨单(货物移动)FUNCTION zfunction.*"----------------------------------------------------------------------*"*"Local interface:*" EXPORTING*" VALUE(RSTYPE) TYPE XFELD*" VALUE(RSMESG) TYPE STRING*" VALUE(O_MBLNR) TYPE MBLNR*" TABLES*" ZMES_TORDER_REQ_I STRUCTURE ZMES_TORDER_REQ_I*"----------------------------------------------------------------------*输⼊表数据:ZMES_TORDER_REQ_I(表结构)* PSTNG_DATE type BUDAT 凭证中的过帐⽇期* MATERIAL MATNR 物料号* PLANT WERKS_D CHAR ⼯⼚* MOVE_PLANT UMWRK 收货/发货⼯⼚* STGE_LOC LGORT_D 库存地点* MOVE_STLOC UMLGO 收货/发货库存地点* ENTRY_QNT ERFMG 以输⼊单位计的数量* BATCH CHARG_D 批号*"----------------------------------------------------------------------DATA:goodsmvt_header LIKE bapi2017_gm_head_01,itab TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE,return LIKE TABLE OF bapiret2 WITH HEADER LINE,mat_doc LIKE bapi2017_gm_head_ret-mat_doc,req_i TYPE zmes_torder_req_i.CLEAR:goodsmvt_header.goodsmvt_header-doc_date = sy-datum. "凭证中的凭证⽇期goodsmvt_header-pr_uname = sy-datum. "⽤户名LOOP AT zmes_torder_req_i INTO req_i.MOVE-CORRESPONDING req_i TO itab.goodsmvt_header-pstng_date = req_i-pstng_date. "凭证中的过帐⽇期IF req_i-plant = req_i-move_plant.itab-move_type = '311'. "移动类型(库储存地点<->库存地点)ELSE.* itab-move_type = '301'. "移动类型(⼯⼚<->⼯⼚)ENDIF.APPEND itab.CLEAR itab.ENDLOOP.CALL FUNCTION'BAPI_GOODSMVT_CREATE'EXPORTINGgoodsmvt_header = goodsmvt_headergoodsmvt_code = '04'IMPORTINGmaterialdocument = mat_docTABLESgoodsmvt_item = itabreturn = return.READ TABLE return WITH KEY type = 'E'.IF sy-subrc = 0.rstype = 'E'.LOOP AT return WHERE type = 'E' .CONCATENATE rsmesg return-message ','INTO rsmesg.ENDLOOP.CALL FUNCTION'BAPI_TRANSACTION_ROLLBACK' . ELSE.CALL FUNCTION'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.rstype = 'S'.o_mblnr = mat_doc.ENDIF.ENDFUNCTION.⼯单发料function zfunction.*"----------------------------------------------------------------------*"*"Local interface:*" EXPORTING*" VALUE(RSTYPE) TYPE XFELD*" VALUE(RSMESG) TYPE STRING*" VALUE(O_MBLNR) TYPE MBLNR*" TABLES*" ZMES_ORD_REQ_I STRUCTURE ZMES_ORD_REQ_I *"----------------------------------------------------------------------*输⼊表:ZMES_ORD_REQ_I(表结构)* PLANT WERKS_D ⼯⼚* ORDERID AUFNR 订单号* MATERIAL MATNR 物料号* ENTRY_QNT ERFMG 以输⼊单位计的数量* STGE_LOC LGORT_D 库存地点*"----------------------------------------------------------------------data:goodsmvt_header like bapi2017_gm_head_01,itab type table of bapi2017_gm_item_create with header line, return like table of bapiret2 with header line,mat_doc like bapi2017_gm_head_ret-mat_doc,req_i type zmes_ord_req_i.clear:goodsmvt_header.goodsmvt_header-doc_date = sy-datum. "凭证中的凭证⽇期goodsmvt_header-pstng_date = sy-datum. "凭证中的过帐⽇期 goodsmvt_header-pr_uname = sy-datum. "⽤户名loop at zmes_ord_req_i into req_i.move-CORRESPONDING req_i to itab.itab-move_type = '261'. "移动类型(库存管理)append itab.clear itab.endloop.call function'BAPI_GOODSMVT_CREATE'exportinggoodsmvt_header = goodsmvt_headergoodsmvt_code = '03'importingmaterialdocument = mat_doctablesgoodsmvt_item = itabreturn = return.read table return with key type = 'E'.if sy-subrc = 0.rstype = 'E'.loop at return where type = 'E' .concatenate rsmesg return-message ',' into rsmesg.endloop.call function'BAPI_TRANSACTION_ROLLBACK' .else.call function'BAPI_TRANSACTION_COMMIT'exportingwait = 'X'.rstype = 'S'.o_mblnr = mat_doc.endif.endfunction.⼯单退料function zfunction.*"----------------------------------------------------------------------*"*"Local interface:*" EXPORTING*" VALUE(RSTYPE) TYPE XFELD*" VALUE(RSMESG) TYPE STRING*" VALUE(O_MBLNR) TYPE MBLNR*" TABLES*" ZMES_RT_ORDER_I STRUCTURE ZMES_RT_ORDER_I *"----------------------------------------------------------------------*输⼊表:ZMES_RT_ORDER_I(表结构)* PLANT WERKS_D ⼯⼚* ORDERID AUFNR 订单号* MATERIAL MATNR 物料号* RESERV_NO RSNUM 预留/相关需求的编号* RES_ITEM RSPOS 预留/相关需求的项⽬编号* ENTRY_QNT ERFMG 以输⼊单位计的数量* MOVE_REAS MB_GRBEW 移动原因* STGE_LOC LGORT_D 库存地点* BATCH CHARG_D 批号*"----------------------------------------------------------------------data:goodsmvt_header like bapi2017_gm_head_01,itab type table of bapi2017_gm_item_create with header line, return like table of bapiret2 with header line,mat_doc like bapi2017_gm_head_ret-mat_doc,order_i type zmes_rt_order_i.clear:goodsmvt_header.goodsmvt_header-doc_date = sy-datum. "凭证中的凭证⽇期goodsmvt_header-pstng_date = sy-datum. "凭证中的过帐⽇期 goodsmvt_header-pr_uname = sy-datum. "⽤户名loop at zmes_rt_order_i into order_i.move-corresponding order_i to itab.itab-move_type = '262'. "移动类型(库存管理)append itab.clear itab.endloop.call function'BAPI_GOODSMVT_CREATE'exportinggoodsmvt_header = goodsmvt_headergoodsmvt_code = '03'importingmaterialdocument = mat_doctablesgoodsmvt_item = itabreturn = return.read table return with key type = 'E'.if sy-subrc = 0.rstype = 'E'.loop at return where type = 'E' .concatenate rsmesg return-message ',' into rsmesg.endloop.call function'BAPI_TRANSACTION_ROLLBACK' .else.call function'BAPI_TRANSACTION_COMMIT'exportingwait = 'X'.rstype = 'S'.o_mblnr = mat_doc.endif.endfunction.⼯单⼊库FUNCTION zfunction.FUNCTION zmes_order_in.*"----------------------------------------------------------------------*"*"Local interface:*" EXPORTING*" VALUE(RSTYPE) TYPE XFELD*" VALUE(RSMESG) TYPE STRING*" VALUE(O_MBLNR) TYPE MBLNR*" TABLES*" ZMES_ORDER_IN_I STRUCTURE ZMES_ORDER_IN_I *"----------------------------------------------------------------------*输⼊表:ZMES_ORDER_IN_I(表结构)* PLANT WERKS_D ⼯⼚* ORDERID AUFNR 订单号* ENTRY_QNT ERFMG 以输⼊单位计的数量* STGE_LOC LGORT_D 库存地点* BATCH CHARG_D 批号*"----------------------------------------------------------------------DATA:header LIKE bapi2017_gm_head_01,code LIKE bapi2017_gm_code,itab TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE, return LIKE TABLE OF bapiret2 WITH HEADER LINE,mat_doc LIKE bapi2017_gm_head_ret-mat_doc,goodsmvt_serialnumber TYPE TABLE OF bapi2017_gm_serialnumber, order_in TYPE zmes_order_in_i.CLEAR:header,code.header-doc_date = sy-datum. "凭证中的凭证⽇期header-pstng_date = sy-datum. "凭证中的过帐⽇期header-pr_uname = sy-datum. "⽤户名code-gm_code = '01'.LOOP AT zmes_order_in_i INTO order_in.MOVE-CORRESPONDING order_in TO itab.itab-move_type = '101'. "移动类型itab-mvt_ind = 'F'. "移动标识APPEND itab.CLEAR itab.ENDLOOP.CALL FUNCTION'BAPI_GOODSMVT_CREATE'EXPORTINGgoodsmvt_header = headergoodsmvt_code = codeIMPORTINGmaterialdocument = mat_docTABLESgoodsmvt_item = itabgoodsmvt_serialnumber = goodsmvt_serialnumberreturn = return.READ TABLE return WITH KEY type = 'E'.IF sy-subrc = 0.rstype = 'E'.LOOP AT return WHERE type = 'E' .CONCATENATE rsmesg return-message ','INTO rsmesg.ENDLOOP.CALL FUNCTION'BAPI_TRANSACTION_ROLLBACK' .ELSE.CALL FUNCTION'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.rstype = 'S'.o_mblnr = mat_doc.ENDIF.ENDFUNCTION.ENDFUNCTION.PO退货FUNCTION zfunction.*"----------------------------------------------------------------------*"*"Local interface:*" EXPORTING*" VALUE(RSTYPE) TYPE XFELD*" VALUE(RSMESG) TYPE STRING*" VALUE(O_MBLNR) TYPE MBLNR*" TABLES*" ZMES_PO_STOCK_I STRUCTURE ZMES_PO_STOCK_I*"----------------------------------------------------------------------*输⼊表:ZMES_PO_STOCK_I(表结构)* MOVE_TYPE BWART 移动类型(库存管理)* PO_NUMBER BSTNR 采购订单编号* PO_ITEM EBELP 采购凭证的项⽬编号* PLANT WERKS_D ⼯⼚* MATERIAL MATNR 物料号* ENTRY_QNT ERFMG 以输⼊单位计的数量* STGE_LOC LGORT_D 库存地点* MOVE_REAS MB_GRBEW 移动原因* REF_DOC MBLNR 物料凭证编号* REF_DOC_IT LFPOS 参考凭证项⽬*"----------------------------------------------------------------------DATA:header LIKE bapi2017_gm_head_01,itab TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE, return LIKE TABLE OF bapiret2 WITH HEADER LINE,mat_doc LIKE bapi2017_gm_head_ret-mat_doc,stock_i TYPE zmes_po_stock_i.CLEAR:header.header-doc_date = sy-datum. "凭证中的凭证⽇期header-pstng_date = sy-datum. "凭证中的过帐⽇期header-pr_uname = sy-datum. "⽤户名LOOP AT zmes_po_stock_i INTO stock_i.MOVE-CORRESPONDING stock_i TO itab.itab-mvt_ind = 'B'. "移动标识CASE stock_i-move_type.WHEN '102'.itab-move_reas = ''. "移动原因WHEN '122'.WHEN '161'.itab-move_type = '101'. "移动类型itab-ref_doc = ''. "物料凭证itab-ref_doc_it = ''. "物料凭证项⽬itab-move_reas = ''. "移动原因ENDCASE.APPEND itab.CLEAR itab.ENDLOOP.CALL FUNCTION'BAPI_GOODSMVT_CREATE'EXPORTINGgoodsmvt_header = headergoodsmvt_code = '01'"MB01 按采购订单的货物移动IMPORTINGmaterialdocument = mat_docTABLESgoodsmvt_item = itabreturn = return.READ TABLE return WITH KEY type = 'E'.IF sy-subrc = 0.rstype = 'E'.LOOP AT return WHERE type = 'E' .CONCATENATE rsmesg return-message ','INTO rsmesg.ENDLOOP.CALL FUNCTION'BAPI_TRANSACTION_ROLLBACK' .ELSE.CALL FUNCTION'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.rstype = 'S'.o_mblnr = mat_doc.ENDIF.ENDFUNCTION.收货FUNCTION zfunction.*"----------------------------------------------------------------------*"*"Local interface:*" EXPORTING*" VALUE(RSTYPE) TYPE XFELD*" VALUE(RSMESG) TYPE STRING*" VALUE(O_MBLNR) TYPE MBLNR*" TABLES*" ZMES_PO_IN STRUCTURE ZMES_PO_IN*"----------------------------------------------------------------------*输⼊表:ZMES_PO_IN(表结构)* REF_DOC_NO XBLNR 参考凭证编号* PLANT WERKS_D ⼯⼚* PO_NUMBER EBELN 采购凭证号* PO_ITEM EBELP 采购凭证的项⽬编号* ETENS EETEN 交货计划⾏计数器* MATERIAL MATNR 物料号* STGE_LOC LGORT_D 库存地点* ENTRY_QNT ERFMG 以输⼊单位计的数量* VENDOR ELIFN 供应商帐户号* BATCH CHARG_D 批号*"----------------------------------------------------------------------DATA:header LIKE bapi2017_gm_head_01,code LIKE bapi2017_gm_code,itab TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE, return LIKE TABLE OF bapiret2 WITH HEADER LINE,mat_doc LIKE bapi2017_gm_head_ret-mat_doc,po_in TYPE zmes_po_in.CLEAR:header,code.header-doc_date = sy-datum. "凭证中的凭证⽇期header-pstng_date = sy-datum. "凭证中的过帐⽇期header-pr_uname = sy-datum. "⽤户名header-ref_doc_no = zmes_po_in-ref_doc_no. "外向交货单code-gm_code = '01'. "为 BAPI 货物移动分配事务代码 4500090063LOOP AT zmes_po_in INTO po_in.MOVE-CORRESPONDING po_in TO itab.itab-move_type = '101'. "移动类型itab-mvt_ind = 'B'. "移动标识APPEND itab.CLEAR itab.ENDLOOP.CALL FUNCTION'BAPI_GOODSMVT_CREATE'EXPORTINGgoodsmvt_header = headergoodsmvt_code = codeIMPORTINGmaterialdocument = mat_docTABLESgoodsmvt_item = itabreturn = return.READ TABLE return WITH KEY type = 'E'.IF sy-subrc = 0.rstype = 'E'.LOOP AT return WHERE type = 'E' .CONCATENATE rsmesg return-message ','INTO rsmesg.ENDLOOP.CALL FUNCTION'BAPI_TRANSACTION_ROLLBACK' .ELSE.CALL FUNCTION'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.rstype = 'S'.o_mblnr = mat_doc.ENDIF.ENDFUNCTION.IQC⼊库FUNCTION zfunction.*"----------------------------------------------------------------------*"*"Local interface:*" EXPORTING*" VALUE(RSTYPE) TYPE XFELD*" VALUE(RSMESG) TYPE STRING*" VALUE(O_MBLNR) TYPE MBLNR*" TABLES*" ZMES_PO_IQC_I STRUCTURE ZMES_PO_IQC_I*"----------------------------------------------------------------------*输⼊表:ZMES_PO_IQC_I(表结构)* PLANT WERKS_D ⼯⼚* MATERIAL MATNR 物料号* ENTRY_QNT ERFMG 以输⼊单位计的数量* STGE_LOC LGORT_D 库存地点* BATCH CHARG_D 批号*"----------------------------------------------------------------------DATA:header LIKE bapi2017_gm_head_01,itab TYPE TABLE OF bapi2017_gm_item_create WITH HEADER LINE,return LIKE TABLE OF bapiret2 WITH HEADER LINE,mat_doc LIKE bapi2017_gm_head_ret-mat_doc,goodsmvt_serialnumber TYPE TABLE OF bapi2017_gm_serialnumber,iqc_in TYPE zmes_po_iqc_i.CLEAR:header.header-doc_date = sy-datum. "凭证中的凭证⽇期header-pstng_date = sy-datum. "凭证中的过帐⽇期header-pr_uname = sy-datum. "⽤户名LOOP AT zmes_po_iqc_i INTO iqc_in.MOVE-CORRESPONDING iqc_in TO itab.itab-move_type = '321'. "移动类型APPEND itab.CLEAR itab.ENDLOOP.CALL FUNCTION'BAPI_GOODSMVT_CREATE'EXPORTINGgoodsmvt_header = headergoodsmvt_code = '04'"为BAPI货物移动分配事务代码(MB1B 转移过帐) IMPORTINGmaterialdocument = mat_docTABLESgoodsmvt_item = itabgoodsmvt_serialnumber = goodsmvt_serialnumberreturn = return.READ TABLE return WITH KEY type = 'E'.IF sy-subrc = 0.rstype = 'E'.LOOP AT return WHERE type = 'E' .CONCATENATE rsmesg return-message ','INTO rsmesg. ENDLOOP.CALL FUNCTION'BAPI_TRANSACTION_ROLLBACK' . ELSE.CALL FUNCTION'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.rstype = 'S'.o_mblnr = mat_doc.ENDIF.ENDFUNCTION.。

(采购管理)采购订单操作

(采购管理)采购订单操作

最新卓越管理方案您可自由编辑采购订单流程1、目的:处理采购业务2、适用范围:所有采购业务的处理3、文件内容概述:⑴维护信息记录⑵根据第三方销售产生的采购申请创建采购定单、或者无参考创建采购订单⑶对采购定单收货⑷对采购定单做发票校验⑸创建固定资产的采购订单⑹打印采购订单4、流程操作步骤:(举例:公司代码1713、物料:60001、供应商1700)⑴维护信息记录操作见文档“维护信息记录主数据”采购信息记录被创建:5300000001⑵创建采购订单(有两种方式创建采购定单)系统路径后勤—商品管理—采购—采购订单—创建—已知供应商/供应地点事务码ME21N单击“”选择变式按钮,选择“采购申请”,进入下一屏幕:栏目名称描述R/O/N 用户动作或结果注意事项地点O商品O采购申请号O 10000089 如果输入采购申请号,则其他字段不需要维护采购组织O采购组O将鼠标放置采购申请号10000089上方,按住左键不放将申请单号拖到“标准采购订单”左侧的方框内,进入下一界面:特别说明:●如果此采购申请单没有分配供应商,则需要输入“供应商”、“采购组织”●若采购的物料直接核算到费用中,则字段“A”输入:K成本中心●如果行项目的产品属于供应商赠送的,则在字段“免费”前打勾●“PO数量”可以根据实际采购的数量修改●如果这张采购申请单是手工创建或者运行MRP之后产生的,则允许一帐采购申请转换成多帐采购订单;如果采购申请单是第三方销售产生的,则一张采购申请单只能用于参考创建一次采购订单,不能多次创建,所以更改采购数量一定要谨慎。

保存,系统提示:系统路径后勤—商品管理—采购—采购订单—创建—已知供应商/供应地点事务码ME21N抬头只能选择“标准采购定单”行项目项目细节①供应商:1700②维护“抬头”参数:“机构数据”视图:栏目名称描述R/O/N 用户动作或结果注意事项采购组织R 1000采购组R 713公司代码R 1713栏目名称描述R/O/N 用户动作或结果注意事项A 帐户设置分类O 如果物料直接核算到费用中,则输入K(成本中心)物料物料号R 60001PO数量采购数量R 1000OUN 单位0 根据实际情况更改工厂R 1713交货日期O 根据实际情况更改免费O 如果行项目的产品属于供应商赠送的,则在字段“免费”前打勾④项目细节参数:可以根据实际情况更改单价等如果没有维护信息记录,则需要维护“条件”视图:栏目名称描述R/O/N 用户动作或结果注意事项类型价格类型PBXX(总价格)PBXX或PB00(总价格)价格物料单价 5 供应商发票为增值税发票则输入“无税单价”;普通发票则输入“总价”保存,系统提示:⑶对采购订单收货:有两种收货的方式:A.收货保存之后从财务的角度分析物料增加了库存,即反映到物料库存的质检状态或非限制状态B.收货保存之后从财务的角度分析物料没有增加库存,只是反映到GR冻结库存,待物料检验合格之后再下达冻结库存,增加物料的实际库存以下根据两种收货方式分别讲解:方式A:收货保存之后从财务的角度分析物料增加了库存,即反映到物料库系统路径后勤—商品管理—库存管理—货物移动—货物移动(MIGO)事务码MIGO“采购订单”字段输入:4500000101“移动类型”:101(按采购定单收货到库存)(移动类型102:冲销101)回车,屏幕如下:栏目名称描述R/O/N 用户动作或结果注意事项OK 确定数据是否无误R 选中不选中表示不对此行项目收货UOE的量实际收货数量R 10批次O 8899 如果物料进行了批量管理,则必须输入批次;没有进行批量管理的物料不要维护批次库存类型库存状态O 一般选择“非限制使用”或“质量检验”状态生产日期O 2003.07.01 如果物料进行批次管理,则必须输入生产日期,否则不需维护保存时提示,产生了物料凭证和财务凭证。

采购信息记录批导bapi

采购信息记录批导bapi

采购信息记录批导bapi可以批导创建及修改信息记录的主数据。

⽽且可以对条件中的时间段及其数量等级中的⾦额进⾏批导及修改。

可以根据⾃⼰的实际需求进⾏修改。

这就很棒,就很nice!!!*********************代码功能**************************************(1) 批量创建信息记录*(2) 批量修改信息记录及创建信息记录的有效期间和数量等级**********************************************************************REPORT zmmr_me11_12 NO STANDARD PAGE HEADING.TYPE-POOLS:truxs,icon.TABLES:eina,sscrfields.DATA:BEGIN OF it_fname OCCURS0,name TYPE char255,END OF it_fname.DATA:bdcdata LIKE bdcdata OCCURS0WITH HEADER LINE. "⽤来存储屏幕字段参数值,传递录屏参数DATA:messtab LIKE bdcmsgcoll OCCURS0WITH HEADER LINE. "记录执⾏BDC过程中产⽣的消息DATA:result_mesg TYPE TABLE OF string WITH HEADER LINE. "结果信息DATA: ti_bapicondct LIKE STANDARD TABLE OF bapicondct WITH HEADER LINE ,ti_bapicondhd LIKE STANDARD TABLE OF bapicondhd WITH HEADER LINE ,ti_bapicondit LIKE STANDARD TABLE OF bapicondit WITH HEADER LINE ,ti_bapicondqs LIKE STANDARD TABLE OF bapicondqs WITH HEADER LINE ,ti_bapicondvs LIKE STANDARD TABLE OF bapicondvs WITH HEADER LINE,bapiret2 LIKE STANDARD TABLE OF bapiret2 WITH HEADER LINE,to_bapiknumhs LIKE STANDARD TABLE OF bapiknumhs WITH HEADER LINE,to_mem_initial LIKE STANDARD TABLE OF cnd_mem_initial WITH HEADER LINE,ls_a017 TYPE a017.DATA text2 TYPE text1_007s. "附加税值名DATA p TYPE i.TYPES:BEGIN OF ty_tab1,flag TYPE c, "记录标识wx TYPE c, "是否外协eina_mahn1 TYPE mahn1, "CLXeina_urztp TYPE urztp, "价格执⾏⽅式eina_urzzt TYPE urzzt, "编号eine_norbm TYPE norbm, "标准数量eine_mwskz TYPE mwskz, "税代码eine_netpr TYPE iprei, "净价、含税价eine_peinh TYPE epein, "价格单位eine_waers TYPE waers, "净价货币eine_angnr TYPE angnr, "报价/⽬标价* rm06i_ltex1 TYPE ltext, "记录信息⽂本rv13a_datab TYPE kodatab, "有效时间从rv13a_datbi TYPE kodatbi, "有效时间到* konp_konwa TYPE konwa, "PB00⽐率单位(货币或百分数)konp_kschl2 TYPE kscha, "条件类型2konm_kbetr2 TYPE konp-kbetr, "条件⾦额2konp_konwa2 TYPE konwa, "ZVA1⽐率单位(货币或百分数)eina_lifnr TYPE elifn, "供应商eina_matnr TYPE matnr, "材料eine_ekorg TYPE ekorg, "采购组织eine_werks TYPE ewerk, "⼯⼚konm_kstbm TYPE kstbm, "条件等级数量konm_kbetr TYPE konp-kbetr, "条件⾦额END OF ty_tab1.DATA:gt_tab1 TYPE TABLE OF ty_tab1,wa_tab1 TYPE ty_tab1.DATA:gt_tab2 TYPE TABLE OF ty_tab1,wa_tab2 TYPE ty_tab1,temp_tab TYPE TABLE OF ty_tab1 WITH HEADER LINE.TYPES:BEGIN OF numb_levels,flag TYPE c, "记录标识eina_lifnr TYPE elifn, "供应商eina_matnr TYPE matnr, "材料eine_ekorg TYPE ekorg, "采购组织eine_werks TYPE ewerk, "⼯⼚konm_kstbm TYPE kstbm, "条件等级数量konm_kbetr TYPE kbetr, "条件⾦额rv13a_datab TYPE kodatab, "有效时间从rv13a_datbi TYPE kodatbi, "有效时间到END OF numb_levels.DATA:gt_nl TYPE TABLE OF numb_levels,wa_nl TYPE numb_levels,gt_nl2 TYPE TABLE OF numb_levels,wa_nl2 TYPE numb_levels.DATA: aplfzc(3) TYPE c, "计划交货天数normbc(16) TYPE c , "标准数量netprcx(14) TYPE c, "净价 GYPnetprc TYPE iprei, "净价peinhc(5) TYPE c, "条件定价单位lv_bprme TYPE bprme. "条件单位SELECTION-SCREEN BEGIN OF BLOCK blk_001 WITH FRAME TITLE text-001 . PARAMETERS:p_file LIKE rlgrap-filename.SELECTION-SCREEN END OF BLOCK blk_001.SELECTION-SCREEN FUNCTION KEY 1. "应⽤⼯具栏增加按钮INITIALIZATION.WRITE icon_change_text AS ICON TO sscrfields-functxt_01+0(4).sscrfields-functxt_01+4(*) = '下载模板'."分配字符位置AT SELECTION-SCREEN.PERFORM dl_template. "模板下载AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file .PERFORM open.START-OF-SELECTION.PERFORM upload_file1.PERFORM process_file.IF NOT gt_tab1 IS INITIAL.PERFORM create_me11.ENDIF.IF NOT gt_tab2 IS INITIAL.PERFORM update_me12.ENDIF.END-OF-SELECTION.PERFORM result_message. "显⽰执⾏结果*&---------------------------------------------------------------------**& Form PROCESS_FILE1*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM process_file.LOOP AT gt_tab1 INTO wa_tab1 WHERE flag = 'X'.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = wa_tab1-eina_matnrIMPORTINGoutput = wa_tab1-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = wa_tab1-eina_lifnrIMPORTINGoutput = wa_tab1-eina_lifnr.SELECT SINGLE eina~infnr INTO eina-infnr FROM eina INNER JOIN eine ON eina~infnr = eine~infnr WHERE eina~matnr = wa_tab1-eina_matnr AND eina~lifnr = wa_tab1-eina_lifnrAND eine~werks = wa_tab1-eine_werks AND eine~ekorg = wa_tab1-eine_ekorg. "判断该数据是否已近创建IF sy-subrc <> 0.MOVE-CORRESPONDING wa_tab1 TO wa_nl.APPEND wa_nl TO gt_nl.ELSE.MOVE-CORRESPONDING wa_tab1 TO wa_nl2.APPEND wa_nl2 TO gt_nl2.ENDIF.ENDLOOP.MOVE gt_tab1 TO temp_tab[].CLEAR:gt_tab1[],gt_tab1.LOOP AT gt_nl INTO wa_nl.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = wa_nl-eina_matnrIMPORTINGoutput = wa_nl-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = wa_nl-eina_lifnrIMPORTINGoutput = wa_nl-eina_lifnr.LOOP AT temp_tab WHERE eina_matnr = wa_nl-eina_matnr AND eina_lifnr = wa_nl-eina_lifnrAND eine_werks = wa_nl-eine_werks AND eine_ekorg = wa_nl-eine_ekorg.MOVE-CORRESPONDING temp_tab TO wa_tab1.APPEND wa_tab1 TO gt_tab1.ENDLOOP.ENDLOOP.LOOP AT gt_nl2 INTO wa_nl2.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = wa_nl2-eina_matnrIMPORTINGoutput = wa_nl2-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = wa_nl2-eina_lifnrIMPORTINGoutput = wa_nl2-eina_lifnr.LOOP AT temp_tab WHERE eina_matnr = wa_nl2-eina_matnr AND eina_lifnr = wa_nl2-eina_lifnrAND eine_werks = wa_nl2-eine_werks AND eine_ekorg = wa_nl2-eine_ekorg.MOVE-CORRESPONDING temp_tab TO wa_tab2.APPEND wa_tab2 TO gt_tab2.ENDLOOP.ENDLOOP.CLEAR:temp_tab[],temp_tab.ENDFORM. " PROCESS_FILE1*&---------------------------------------------------------------------**& Form create_me11*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*FORM create_me11.LOOP AT gt_tab1 INTO wa_tab1 WHERE flag = 'X'.CLEAR: aplfzc,normbc,netprc,netprcx,peinhc.aplfzc = wa_tab1-eina_mahn1.normbc = wa_tab1-eine_norbm.netprc = wa_tab1-eine_netpr. "净价peinhc = wa_tab1-eine_peinh.CONDENSE aplfzc NO-GAPS.CONDENSE normbc NO-GAPS.CONDENSE netprcx NO-GAPS. "GYPCONDENSE peinhc NO-GAPS.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = wa_tab1-eina_matnrIMPORTINGoutput = wa_tab1-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = wa_tab1-eina_lifnrIMPORTINGoutput = wa_tab1-eina_lifnr.SELECT SINGLE waers FROM lfm1 INTO wa_tab1-eine_waers WHERE lifnr = wa_tab1-eina_lifnr AND ekorg = wa_tab1-eine_ekorg.IF wa_tab1-eine_waers = 'USD'.wa_tab1-eine_mwskz = 'J0'.ELSEIF wa_tab1-eine_waers = 'CNY'.wa_tab1-eine_mwskz = 'J6'.ENDIF.SELECT SINGLE t007s~text1 INTO text2 FROM t007s WHERE t007s~mwskz = wa_tab1-eine_mwskz AND t007s~spras = sy-langu AND t007s~kalsm = 'TAXCN'. "附加税值名IF text2+1(1) = '%'.p = text2+0(1).ELSE.p = text2+0(2).ENDIF.netprc = netprc / ( 1 + ( p / 100 ) ). "增值税netprcx = netprc.* netprc = netprc * ( 1 + ( p / 100 ) ). "增值税 GYPCONDENSE netprcx NO-GAPS. "gypCLEAR: bdcdata,bdcdata[] .PERFORM bdc_dynpro USING'SAPMM06I''0100'.PERFORM bdc_field USING'BDC_CURSOR''EINE-WERKS'.PERFORM bdc_field USING'BDC_OKCODE''/00'.PERFORM bdc_field USING'EINA-LIFNR' wa_tab1-eina_lifnr."供应商PERFORM bdc_field USING'EINA-MATNR' wa_tab1-eina_matnr. "材料PERFORM bdc_field USING'EINE-EKORG' wa_tab1-eine_ekorg. "采购组织PERFORM bdc_field USING'EINE-WERKS' wa_tab1-eine_werks. "⼯⼚IF wa_tab1-wx = 'X'.PERFORM bdc_field USING'RM06I-LOHNB''X'.ELSE.PERFORM bdc_field USING'RM06I-NORMB''X'.ENDIF.PERFORM bdc_dynpro USING'SAPMM06I''0101'.PERFORM bdc_field USING'BDC_CURSOR''EINA-URZZT'.PERFORM bdc_field USING'BDC_OKCODE''/00'.PERFORM bdc_field USING'EINA-MAHN1' aplfzc. "CLXPERFORM bdc_field USING'EINA-URZTP' wa_tab1-eina_urztp. "价格执⾏⽅式PERFORM bdc_field USING'EINA-URZZT' wa_tab1-eina_urzzt. "编号PERFORM bdc_dynpro USING'SAPMM06I''0102'.PERFORM bdc_field USING'BDC_CURSOR''EINE-MWSKZ'.PERFORM bdc_field USING'BDC_OKCODE''=KO'. "/00PERFORM bdc_field USING'EINE-NORBM' normbc. "标准数量PERFORM bdc_field USING'EINE-MWSKZ' wa_tab1-eine_mwskz. "税代码PERFORM bdc_field USING'EINE-NETPR' netprcx. "净价PERFORM bdc_field USING'EINE-WAERS' wa_tab1-eine_waers. "净价货币PERFORM bdc_dynpro USING'SAPMV13A''0201'.PERFORM bdc_field USING'BDC_CURSOR''RV13A-DATBI'.PERFORM bdc_field USING'BDC_OKCODE''=BACK'.PERFORM bdc_field USING'RV13A-DATAB' wa_tab1-rv13a_datab. "开始时间PERFORM bdc_field USING'RV13A-DATBI' wa_tab1-rv13a_datbi. "结束时间PERFORM bdc_field USING'KONP-KPEIN(01)' peinhc. "单位PERFORM bdc_dynpro USING'SAPMM06I''0102'.PERFORM bdc_field USING'BDC_CURSOR''EINE-APLFZ'.PERFORM bdc_field USING'BDC_OKCODE''/00'. "/00PERFORM bdc_field USING'EINE-NORBM' normbc. "标准数量PERFORM bdc_field USING'EINE-MWSKZ' wa_tab1-eine_mwskz. "税代码PERFORM bdc_field USING'EINE-NETPR' netprcx. "净价PERFORM bdc_dynpro USING'SAPMM06I''0105'.PERFORM bdc_field USING'BDC_CURSOR''EINE-ANGNR'.PERFORM bdc_field USING'BDC_OKCODE''/00'.PERFORM bdc_field USING'EINE-ANGNR' wa_tab1-eine_angnr. "报价PERFORM bdc_dynpro USING'SAPMM06I''0103'.PERFORM bdc_field USING'BDC_CURSOR''RM06I-LTEX1(01)'.PERFORM bdc_field USING'BDC_OKCODE''=BU'.* PERFORM bdc_field USING 'RM06I-LTEX1(01)' wa_tab1-rm06i_ltex1. "记录信息CALL TRANSACTION'ME11'USING bdcdata MODE 'A'UPDATE'S' MESSAGES INTO messtab. READ TABLE messtab WITH KEY msgtyp = 'E'.IF sy-subrc = 0.LOOP AT messtab WHERE msgtyp = 'E'.CALL FUNCTION'MESSAGE_TEXT_BUILD'"消息编号及变量使⽤函数转换为消息内容输出EXPORTINGmsgid = messtab-msgidmsgnr = messtab-msgnrmsgv1 = messtab-msgv1msgv2 = messtab-msgv2msgv3 = messtab-msgv3msgv4 = messtab-msgv4IMPORTINGmessage_text_output = result_mesg.ENDLOOP.CONCATENATE'物料' wa_tab1-eina_matnr ':' result_mesg INTO result_mesg.APPEND result_mesg.CLEAR result_mesg.ELSE.PERFORM condition USING wa_tab1.ENDIF.ENDLOOP.ENDFORM. "create_me11*&---------------------------------------------------------------------**& Form CONDITION*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->P_wa_tab1 text*----------------------------------------------------------------------*FORM condition USING value(lt_tab) TYPE ty_tab1.DATA num TYPE n LENGTH 4. "数量等级⾏号CLEAR:ti_bapicondct[],ti_bapicondct,ti_bapicondhd[],ti_bapicondhd,ti_bapicondit[],ti_bapicondit,ti_bapicondqs[],ti_bapicondqs,lv_bprme. DATA esokzc TYPE c.IF lt_tab-wx = 'X'.esokzc = '3'.ELSE.esokzc = '0'.ENDIF.SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_a017FROM a017 WHERE kschl = 'PB00'"条件类型 "kappl = 'M' "应⽤:M采购AND lifnr = lt_tab-eina_lifnr "供应商帐户号AND matnr = lt_tab-eina_matnr "物料AND ekorg = lt_tab-eine_ekorg "采购组织AND werks = lt_tab-eine_werks "⼯⼚AND esokz = esokzc. "采购信息记录分类-(0:标准 3:分包合同)CLEAR esokzc.SELECT SINGLE kmein INTO lv_bprme FROM konp WHERE knumh = ls_a017-knumh. "konp:条件(项⽬) kmein:条件单位ti_bapicondct-operation = '004' . "004修改 _009创建ti_bapicondct-cond_usage = 'A'. "条件表⽤途:定价ti_bapicondct-table_no = '017' . "条件表ti_bapicondct-applicatio = 'M' .ti_bapicondct-cond_type = 'PB00' .ti_bapicondct-valid_to = lt_tab-rv13a_datbi. "条件记录有效截⽌⽇期ti_bapicondct-valid_from = lt_tab-rv13a_datab. "条件记录有效起始⽇ti_bapicondct-cond_no = ls_a017-knumh . "条件记录号APPEND ti_bapicondct .CLEAR ti_bapicondct .*KONH的BAPI结构----条件( 抬头 )ti_bapicondhd-operation = '004' .ti_bapicondhd-cond_no = ls_a017-knumh . "条件记录号ti_bapicondhd-created_by = sy-uname. "创建对象的⼈员名称ti_bapicondhd-creat_date = sy-datum. "记录的创建⽇期ti_bapicondhd-cond_usage = 'A' .ti_bapicondhd-table_no = ' 017' .ti_bapicondhd-applicatio = 'M' .ti_bapicondhd-cond_type = ' PB00' .ti_bapicondhd-valid_from = lt_tab-rv13a_datbi.ti_bapicondhd-valid_to = lt_tab-rv13a_datab.APPEND ti_bapicondhd.CLEAR ti_bapicondhd.*KONP的BAPI结构ti_bapicondit-operation = '004' .ti_bapicondit-cond_no = ls_a017-knumh.ti_bapicondit-cond_count = '01' . "条件的序列号ti_bapicondit-applicatio = 'M' .ti_bapicondit-cond_type = 'PB00' .ti_bapicondit-scaletype = 'A' .ti_bapicondit-scalebasin = 'C' . "等级基值指⽰符,数量规模ti_bapicondit-scale_qty = 1 . "条件等级数量ti_bapicondit-calctypcon = 'C' . "条件计算类型--- C:数量 A:百分⽐ti_bapicondit-cond_value = lt_tab-eine_netpr. "BAPIs 的货币⾦额(带有 9 个⼩数位)-净价ti_bapicondit-condcurr = lt_tab-eine_waers. "⽐率单位(货币或百分数):CNYti_bapicondit-cond_p_unt = peinhc. "条件定价单位(单位=1)ti_bapicondit-cond_unit = lv_bprme. "条件单位(EA)ti_bapicondit-condcurren = lt_tab-eine_waers.ti_bapicondit-unitmeasur = lv_bprme. "条件等级计量单位APPEND ti_bapicondit.CLEAR ti_bapicondit.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = lt_tab-eina_lifnrIMPORTINGoutput = lt_tab-eina_lifnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = lt_tab-eina_matnrIMPORTINGoutput = lt_tab-eina_matnr.*PB00--->设置等级数量CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = lt_tab-eina_matnrIMPORTINGoutput = lt_tab-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = lt_tab-eina_lifnrIMPORTINGoutput = lt_tab-eina_lifnr.LOOP AT gt_tab1 INTO wa_tab1 WHERE konm_kbetr > 0AND eina_lifnr = lt_tab-eina_lifnr AND eina_matnr = lt_tab-eina_matnr AND eine_ekorg = lt_tab-eine_ekorg AND eine_werks = lt_tab-eine_werks. "数量等级⾦额>0num = num + 1.ti_bapicondqs-operation = '004' .ti_bapicondqs-cond_no = ls_a017-knumh.ti_bapicondqs-cond_count = '01' .ti_bapicondqs-line_no = num.ti_bapicondqs-scale_qty = wa_tab1-konm_kstbm. "条件等级数量ti_bapicondqs-cond_unit = lv_bprme. "条件单位ti_bapicondqs-currency = wa_tab1-konm_kbetr. "BAPIs 的货币⾦额(带有 9 个⼩数位)ti_bapicondqs-condcurr = lt_tab-eine_waers. "⽐率单位(货币或百分数)APPEND ti_bapicondqs .CLEAR ti_bapicondqs .ENDLOOP.CLEAR num.IF lt_tab-eine_waers = 'CNY'.*如果货币单位为CNY,添加ZVA1类型ti_bapicondit-operation = '004' .ti_bapicondit-cond_no = ls_a017-knumh.ti_bapicondit-cond_count = '02'. "条件的序列号ti_bapicondit-applicatio = 'M'.ti_bapicondit-cond_type = 'ZVA1'. "类型2:ZVA1ti_bapicondit-scaletype = 'A'. "A基础等级ti_bapicondit-scalebasin = 'C' . "等级基值指⽰符,数量规模ti_bapicondit-scale_qty = '2'. "条件等级数量ti_bapicondit-calctypcon = 'A' . "条件计算类型--- C:数量 A:百分⽐IF lt_tab-konm_kbetr2 <> 0OR lt_tab-konm_kbetr2 <> ''.ti_bapicondit-cond_value = lt_tab-konm_kbetr2. "BAPIs 的货币⾦额(带有 9 个⼩数位)-(-5%)konm_kbetr2 ENDIF.ti_bapicondit-condcurr = lt_tab-konp_konwa2. "⽐率单位(货币或百分数):CNYti_bapicondit-cond_unit = lt_tab-konp_konwa2. "条件单位ti_bapicondit-cond_unit = lv_bprme.ti_bapicondit-unitmeasur = lv_bprme. "条件等级计量单位APPEND ti_bapicondit.CLEAR ti_bapicondit.*ZVA1--->设置等级数量LOOP AT gt_tab1 INTO wa_tab1 WHERE konm_kbetr > 0AND eina_lifnr = lt_tab-eina_lifnr AND eina_matnr = lt_tab-eina_matnr AND eine_ekorg = lt_tab-eine_ekorg AND eine_werks = lt_tab-eine_werks. "数量等级⾦额>0num = num + 1.ti_bapicondqs-operation = '004' .ti_bapicondqs-cond_no = ls_a017-knumh.ti_bapicondqs-cond_count = '02' .ti_bapicondqs-line_no = num.ti_bapicondqs-scale_qty = wa_tab1-konm_kstbm. "条件等级数量ti_bapicondqs-cond_unit = lv_bprme. "条件单位ti_bapicondqs-currency = wa_tab1-konm_kbetr. "BAPIs 的货币⾦额(带有 9 个⼩数位)ti_bapicondqs-condcurr = lt_tab-konp_konwa2. "⽐率单位(货币或百分数)APPEND ti_bapicondqs .CLEAR ti_bapicondqs .ENDLOOP.CLEAR num.ENDIF.CALL FUNCTION'BAPI_PRICES_CONDITIONS'TABLESti_bapicondct = ti_bapicondctti_bapicondhd = ti_bapicondhdti_bapicondit = ti_bapiconditti_bapicondqs = ti_bapicondqsti_bapicondvs = ti_bapicondvsto_bapiret2 = bapiret2to_bapiknumhs = to_bapiknumhsto_mem_initial = to_mem_initialEXCEPTIONSupdate_error = 1OTHERS = 2.IF sy-subrc = 0.DATA gv_infnr TYPE infnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = lt_tab-eina_lifnrIMPORTINGoutput = lt_tab-eina_lifnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = lt_tab-eina_matnrIMPORTINGoutput = lt_tab-eina_matnr.SELECT SINGLE infnr INTO gv_infnr FROM eina WHERE matnr = lt_tab-eina_matnr AND lifnr = lt_tab-eina_lifnr. CONCATENATE gv_infnr '信息记录已创建!'INTO result_mesg.APPEND result_mesg.CLEAR result_mesg.ELSE.CALL FUNCTION'BAPI_TRANSACTION_ROLLBACK'.CONCATENATE lt_tab-eina_matnr '操作错误!'INTO result_mesg.APPEND result_mesg.CLEAR:gv_infnr,result_mesg.ENDIF.ENDFORM. " CONDITION*&---------------------------------------------------------------------**& Form UPDATE_ME12*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM update_me12.LOOP AT gt_tab2 INTO wa_tab2 WHERE flag = 'X'.CLEAR: aplfzc,normbc,netprc,netprcx,peinhc.peinhc = wa_tab2-eine_peinh.CONDENSE peinhc NO-GAPS.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = wa_tab2-eina_matnrIMPORTINGoutput = wa_tab2-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = wa_tab2-eina_lifnrIMPORTINGoutput = wa_tab2-eina_lifnr.netprc = wa_tab2-eine_netpr.netprcx = netprc.CONDENSE netprcx NO-GAPS. "GYPCLEAR bdcdata[].PERFORM bdc_dynpro USING'SAPMM06I''0100'.PERFORM bdc_field USING'BDC_CURSOR''EINE-WERKS'.PERFORM bdc_field USING'BDC_OKCODE''/00'.PERFORM bdc_field USING'EINA-LIFNR' wa_tab2-eina_lifnr.PERFORM bdc_field USING'EINA-MATNR' wa_tab2-eina_matnr.PERFORM bdc_field USING'EINE-EKORG' wa_tab2-eine_ekorg.PERFORM bdc_field USING'EINE-WERKS' wa_tab2-eine_werks.IF wa_tab2-wx = 'X'.PERFORM bdc_field USING'RM06I-LOHNB''X'.ELSE.PERFORM bdc_field USING'RM06I-NORMB''X'.ENDIF.PERFORM bdc_dynpro USING'SAPMM06I''0101'.PERFORM bdc_field USING'BDC_CURSOR''EINA-URZTP'.PERFORM bdc_field USING'BDC_OKCODE''/00'.PERFORM bdc_field USING'EINA-URZTP'''.PERFORM bdc_field USING'EINA-URZTP' wa_tab2-eina_urztp.PERFORM bdc_dynpro USING'SAPMM06I''0102'.PERFORM bdc_field USING'BDC_CURSOR''EINE-MWSKZ'.PERFORM bdc_field USING'BDC_OKCODE''/00'.PERFORM bdc_field USING'EINE-MWSKZ' wa_tab2-eine_mwskz.PERFORM bdc_dynpro USING'SAPMM06I''0105'.PERFORM bdc_field USING'BDC_CURSOR''EINE-ANGNR'.PERFORM bdc_field USING'BDC_OKCODE''=KO'.PERFORM bdc_field USING'EINE-ANGNR' wa_tab2-eine_angnr.PERFORM bdc_dynpro USING'SAPLV14A''0102'.PERFORM bdc_field USING'BDC_CURSOR''VAKE-DATAB(01)'.PERFORM bdc_field USING'BDC_OKCODE''=NEWD'.PERFORM bdc_dynpro USING'SAPMV13A''0201'.PERFORM bdc_field USING'BDC_CURSOR''KONP-KBETR(01)'.PERFORM bdc_field USING'BDC_OKCODE''=SICH'.PERFORM bdc_field USING'RV13A-DATAB' wa_tab2-rv13a_datab.PERFORM bdc_field USING'RV13A-DATBI' wa_tab2-rv13a_datbi.PERFORM bdc_field USING'KONP-KBETR(01)' netprcx.CALL TRANSACTION'ME12'USING bdcdataMODE 'N'UPDATE'S'MESSAGES INTO messtab.READ TABLE messtab WITH KEY msgtyp = 'E'.IF sy-subrc = 0.LOOP AT messtab WHERE msgtyp = 'E'.CALL FUNCTION'MESSAGE_TEXT_BUILD'"消息编号及变量使⽤函数转换为消息内容输出EXPORTINGmsgid = messtab-msgidmsgnr = messtab-msgnrmsgv1 = messtab-msgv1msgv2 = messtab-msgv2msgv3 = messtab-msgv3msgv4 = messtab-msgv4IMPORTINGmessage_text_output = result_mesg.ENDLOOP.CONCATENATE'物料' wa_tab2-eina_matnr ':' result_mesg INTO result_mesg.APPEND result_mesg.CLEAR result_mesg.ELSE.PERFORM condition2 USING wa_tab2. "更新数量等级ENDIF.ENDLOOP.ENDFORM. "UPDATE_ME12*&---------------------------------------------------------------------**& Form condition2*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->LT_TAB text*----------------------------------------------------------------------*FORM condition2 USING value(lt_tab) TYPE ty_tab1.DATA num TYPE n LENGTH 4. "数量等级⾏号CLEAR:ti_bapicondct[],ti_bapicondct,ti_bapicondhd[],ti_bapicondhd,ti_bapicondit[],ti_bapicondit,ti_bapicondqs[],ti_bapicondqs,lv_bprme,num. DATA esokzc TYPE c.IF lt_tab-wx = 'X'.esokzc = '3'.ELSE.esokzc = '0'.ENDIF.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = lt_tab-eina_matnrIMPORTINGoutput = lt_tab-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = lt_tab-eina_lifnrIMPORTINGoutput = lt_tab-eina_lifnr.SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_a017FROM a017 WHERE kschl = 'PB00'"条件类型AND lifnr = lt_tab-eina_lifnr "供应商帐户号AND matnr = lt_tab-eina_matnr "物料AND ekorg = lt_tab-eine_ekorg "采购组织AND werks = lt_tab-eine_werks "⼯⼚AND datab = lt_tab-rv13a_datab "起始时间AND datbi = lt_tab-rv13a_datbi "截⽌时间AND esokz = esokzc. "采购信息记录分类-(0:标准 3:分包合同)CLEAR esokzc.SELECT SINGLE kmein INTO lv_bprme FROM konp WHERE knumh = ls_a017-knumh. "konp:条件(项⽬) kmein: ti_bapicondct-operation = '004' . "004修改 _009创建ti_bapicondct-cond_usage = 'A'. "条件表⽤途:定价ti_bapicondct-table_no = '017' . "条件表ti_bapicondct-applicatio = 'M' .ti_bapicondct-cond_type = 'PB00' .ti_bapicondct-valid_from = lt_tab-rv13a_datab. "条件记录有效起始⽇ti_bapicondct-valid_to = lt_tab-rv13a_datbi. "条件记录有效截⽌⽇期ti_bapicondct-cond_no = ls_a017-knumh . "条件记录号APPEND ti_bapicondct .CLEAR ti_bapicondct .*KONH的BAPI结构----条件( 抬头 )ti_bapicondhd-operation = '004' .ti_bapicondhd-cond_no = ls_a017-knumh . "条件记录号ti_bapicondhd-created_by = sy-uname. "创建对象的⼈员名称ti_bapicondhd-creat_date = sy-datum. "记录的创建⽇期ti_bapicondhd-cond_usage = 'A' .ti_bapicondhd-table_no = ' 017' .ti_bapicondhd-applicatio = 'M' .ti_bapicondhd-cond_type = ' PB00' .ti_bapicondhd-valid_from = lt_tab-rv13a_datab.ti_bapicondhd-valid_to = lt_tab-rv13a_datbi.APPEND ti_bapicondhd .CLEAR ti_bapicondhd .*KONP的BAPI结构ti_bapicondit-operation = '004' .ti_bapicondit-cond_no = ls_a017-knumh.ti_bapicondit-cond_count = '01' . "条件的序列号ti_bapicondit-applicatio = 'M' .ti_bapicondit-cond_type = 'PB00' .ti_bapicondit-scaletype = 'A' .ti_bapicondit-scalebasin = 'C' . "等级基值指⽰符,数量规模ti_bapicondit-scale_qty = 1 . "条件等级数量ti_bapicondit-calctypcon = 'C' . "条件计算类型--- C:数量 A:百分⽐ti_bapicondit-cond_value = netprcx. "BAPIs 的货币⾦额(带有 9 个⼩数位)-净价ti_bapicondit-condcurr = lt_tab-eine_waers. "⽐率单位(货币或百分数):CNYti_bapicondit-cond_p_unt = peinhc. "条件定价单位(单位=1)ti_bapicondit-cond_unit = lv_bprme. "条件单位ti_bapicondit-condcurren = lt_tab-eine_waers.ti_bapicondit-unitmeasur = lv_bprme. "条件等级计量单位APPEND ti_bapicondit.CLEAR ti_bapicondit.*PB00--->设置等级数量CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = lt_tab-eina_matnrIMPORTINGoutput = lt_tab-eina_matnr.CALL FUNCTION'CONVERSION_EXIT_ALPHA_OUTPUT'EXPORTINGinput = lt_tab-eina_lifnrIMPORTINGoutput = lt_tab-eina_lifnr.LOOP AT gt_tab2 INTO wa_tab2 WHERE konm_kbetr > 0AND eina_lifnr = lt_tab-eina_lifnr AND eina_matnr = lt_tab-eina_matnr AND eine_ekorg = lt_tab-eine_ekorg AND eine_werks = lt_tab-eine_werks. "数量等级⾦额>0num = num + 1.ti_bapicondqs-operation = '004' .ti_bapicondqs-cond_no = ls_a017-knumh.ti_bapicondqs-cond_count = '01' .ti_bapicondqs-line_no = num.ti_bapicondqs-scale_qty = wa_tab2-konm_kstbm. "条件等级数量ti_bapicondqs-cond_unit = lv_bprme. "条件单位ti_bapicondqs-currency = wa_tab2-konm_kbetr. "BAPIs 的货币⾦额(带有 9 个⼩数位)ti_bapicondqs-condcurr = lt_tab-eine_waers. "⽐率单位(货币或百分数)APPEND ti_bapicondqs .CLEAR ti_bapicondqs .ENDLOOP.CLEAR num.IF lt_tab-eine_waers = 'CNY'.*如果货币单位为CNY,添加ZVA1类型ti_bapicondit-operation = '004' .ti_bapicondit-cond_no = ls_a017-knumh.ti_bapicondit-cond_count = '02'. "条件的序列号ti_bapicondit-applicatio = 'M'.ti_bapicondit-cond_type = lt_tab-konp_kschl2. "进项税扣除ZVA1ti_bapicondit-scaletype = 'A'. "A基础等级ti_bapicondit-scalebasin = 'C' . "等级基值指⽰符,数量规模ti_bapicondit-scale_qty = '2'. "条件等级数量ti_bapicondit-calctypcon = 'A' . "条件计算类型--- C:数量 A:百分⽐IF lt_tab-konm_kbetr2 <> 0OR lt_tab-konm_kbetr2 <> ''.ti_bapicondit-cond_value = lt_tab-konm_kbetr2. "BAPIs 的货币⾦额(带有 9 个⼩数位)-(-5%)konm_kbetr2 ENDIF.ti_bapicondit-condcurr = lt_tab-konp_konwa2. "⽐率单位(货币或百分数):CNYti_bapicondit-cond_unit = lt_tab-konp_konwa2. "条件单位ti_bapicondit-cond_unit = lv_bprme.ti_bapicondit-unitmeasur = lv_bprme. "条件等级计量单位APPEND ti_bapicondit.CLEAR ti_bapicondit.*ZVA1--->设置等级数量LOOP AT gt_tab2 INTO wa_tab2 WHERE konm_kbetr > 0AND eina_lifnr = lt_tab-eina_lifnr AND eina_matnr = lt_tab-eina_matnr AND eine_ekorg = lt_tab-eine_ekorg AND eine_werks = lt_tab-eine_werks. "数量等级⾦额>0num = num + 1.ti_bapicondqs-operation = '004' .ti_bapicondqs-cond_no = ls_a017-knumh.ti_bapicondqs-cond_count = '02' .ti_bapicondqs-line_no = num.ti_bapicondqs-scale_qty = wa_tab2-konm_kstbm. "条件等级数量ti_bapicondqs-cond_unit = lv_bprme. "条件单位ti_bapicondqs-currency = wa_tab2-konm_kbetr. "BAPIs 的货币⾦额(带有 9 个⼩数位)ti_bapicondqs-condcurr = lt_tab-konp_konwa2. "⽐率单位(货币或百分数)APPEND ti_bapicondqs .CLEAR ti_bapicondqs .ENDLOOP.CLEAR num.ENDIF.CALL FUNCTION'BAPI_PRICES_CONDITIONS'TABLESti_bapicondct = ti_bapicondctti_bapicondhd = ti_bapicondhdti_bapicondit = ti_bapiconditti_bapicondqs = ti_bapicondqsti_bapicondvs = ti_bapicondvsto_bapiret2 = bapiret2to_bapiknumhs = to_bapiknumhsto_mem_initial = to_mem_initialEXCEPTIONSupdate_error = 1OTHERS = 2.IF sy-subrc = 0.CALL FUNCTION'MESSAGE_TEXT_BUILD'"消息编号及变量使⽤函数转换为消息内容输出EXPORTINGmsgid = messtab-msgidmsgnr = messtab-msgnrmsgv1 = messtab-msgv1msgv2 = messtab-msgv2msgv3 = messtab-msgv3msgv4 = messtab-msgv4。

SAP 常用BAPI

SAP 常用BAPI

订单BAPI_SALESORDER_CREATEFROMDAT2 创建销售订单BAPISDORDER_GETDETAILEDLIST 销售订单明细BAPI_SALESORDER_GETLIST 销售订单列表BAPI_SALESORDER_CHANGE 修改销售订单交货单BAPI_OUTB_DELIVERY_READ_SLS 根据销售订单创建交货单,得到交货单创建初始页面所需的数据BAPI_OUTB_DELIVERY_GETDETAIL 根据交货单号读取单据的详细内容BAPI_OUTB_DELIVERY_CREATE_SLS 根据销售订单创建交货单BAPI_OUTB_DELIVERY_CHANGE 根据交货单号修改、删除单据的详细内容采购订单BAPI_PO_CREATEREF_PR 根据采购申请创建采购订单,得到采购订单创建初始页面所需的数据BAPI_READ_GOODS_RECEIPT 根据采购订单创建收货,得到货物接收初始页面所需的数据BAPI_PO_RELEASE 审批采购订单BAPI_PO_RESET_RELEASE 取消审批采购订单BAPI_PO_CHANGE 修改采购订单BAPI_PO_CREATE1 创建采购订单BAPI_PO_GETDETAIL1 采购订单明细BAPI_PO_GET_LIST 采购订单列表BAPI_PO_GETITEMS 采购订单明细列表报价单BAPI_QUOTATION_GETDETAILBOS 报价单明细BAPI_CUSTOMERQUOTATION_CHANGE 修改销售订单BAPI_QUOTATION_CREATEFROMDATA2 创建报价单功能描述事务码BAPI函数名称检验批修改建议批QA02 暂未找到查看检验批明细QA03 BAPI_INSPLOT_GETDETAIL检验结果记录检验点结果QE11 BAPI_INSPPOINT_CREATEFROMDATA修改检验点结果QE12 BAPI_INSPPOINT_CHANGE显示检验点结果明细QE13 BAPI_INSPPOINT_GETREQUIREMENTS缺陷检验记录缺陷QF01 QFFE_FAILURE_RECORDING修改缺陷QF02 暂未找到显示缺陷QF03 暂未找到使用决策记录使用决策QA11 BAPI_INSPLOT_SETUSAGEDECISION修改使用决策QA12 暂未找到显示使用决策QA13 暂未找到质量结果通知单创建质量通知单QM01 BAPI_QNOTIFICAT_CREATE修改质量通知单QM02 BAPI_QUALNOT_MODIFY_DATA显示质量通知单明细QM03 BAPI_QUALNOT_GETDETAIL检验批清单检验批清单列表QA32 BAPI_INSPLOT_GETLIST 选择检验批。

功能说明_超市化采购_创建采购订单并同步ECP_20120320_V1.1-副本

功能说明_超市化采购_创建采购订单并同步ECP_20120320_V1.1-副本

第一部分:需求信息程序类型接口程序使用单位程序编号ZMM04R0002程序名称生成采购订单并同步采购订单信息到ECP 事务代码业务流程业务子流程系统版本ECC6 模块MM业务负责人冯炳黎功能设计者程序开发者/ 程序员第二部分:设计维护记录请求提出者时间修改原因审批人冯炳黎20120320 创建功能设计冯炳黎20120321 增加创建采购订单后校验价格是否正确。

第三部分:用户签字关键用户签名姓名:……………………………………日期:……../……../……..顾问签名姓名:……………………………………日期:……../……../……..顾问组长签名姓名:……………………………………日期:……../……../……..业务组长(河北电力)签名姓名:……………………………………日期:……../……../……..第四部分:业务需求需求用途(描述编写程序的用途或目的)生成采购订单并同步采购订单信息给ECP总体要求(报表/程序执行的功能描述)手工创建采购订单。

对于超市化采购的采购申请,在ERP中所有行项目(除删除行项目)审批通过,并收到ECP 接收“ERP采购申请审批信息”所有“成功”的返回值后,根据需要生成采购订单,并通过接口将采购订单信息上传至电子商务平台。

程序使用者系统自动执行使用频度(日、月、季度或年)后台处理/在线处理打印机类型(激光/ 喷墨/ 针式)纸张大小/方向使用语言开发优先度注释第五部分:功能设计5.1权限要求(对于某些个别字段须要进行权限控制,如公司代码等)5.2功能界面选择屏幕:屏幕字段中文描述选择类型屏幕字段名称参考字段名称缺省值必要输入检查条件单一区间复选框选择是否圆点工厂√EBAN-WERKS √√采购申请号√√请购单号√凭证类型√EBAN-BSART √创建状态√√未创建、已创建未创建√上传状态√√未上传、已上传未上传√5.3所需数据表及字段描述1 新建表:超市化采购-采购订单上传历史记录ZMM26T_CSCG_DDLS字段名是否主键字段描述字段类型字段长度EBELN KEY 采购订单CHAR 15 EBELP KEY 项目NUMC 5 BANFN 采购申请CHAR 10 BNFPO 请求项目NUMC 5 ZQGDH 请购单号(ECP)CHAR 25 ZGGDHXM 请购单行项目(ECP)CHAR 5ZHSJG 含税价格EKPO-BRTWRCURR 15/2ZSMTEST 税码描述,值取字段MWSKZ的描述TEXT1(默认值取J1-17%进项税,中国)CHAR 50BEDAT 凭证日期DATS 8ZFKTJ 付款条件描述,值取字段ZTERM的描述TEXT1(默认值取0001)CHAR 50CZIX 操作类型,1 - 创建CHAR 1POZSCDAT 上传日期CHAR ZSCTIM 上传时间CHARZSCZT 上传状态(O:成功,N:失败)CHAR展示字段:字段名字段描述表备注ZQGDH 请购单号(ECP)EBANZGGDHXM 请购单行项目(ECP)EBANEBELN 采购订单号EBANEBELP 行项目号EBANZSCZT 上传状态ZMM26T_CSCG_DDLSBSART 凭证类型EBANBANFN 采购申请EBANBNFPO 请求项目EBANMATNR 物料EBANWERKS 工厂EBANLGORT 库存地点EBANMENGE 数量EBANPREIS 评价价格EBANKNTTP 项目类别EBANTXZ01 物料描述EBANPUR_MODE 采购方式EBANLFDAT 交货日期EBANBADAT 创建日期请购单表AFNAM 实际申请人请购单表LIFNR国网供应商请购单表LIFNR-SX 供应商取采购申请中的期望供应商EBAN-lifnrName1 系统供应商名称取 Lfa1-name1 SAKTO 总帐科目请购单表KOSTL 成本中心请购单表ANLN1 资产请购单表PS_PSP_PNR WBS元素请购单表CSID 标识请购单表CSDW 超市物料单位请购单表CSSL 超市物料数量请购单表ERNAM 创建者请购单表BANPR 审批状态EBANEKGRP 采购组EBAN 采购申请取AUFNR 订单号请购单表EKORG 采购组织EBANBUKRS 公司代码EBANZSHRID 收货人ID 请购单表Zterm付款条件5.4相关的取数及处理逻辑(可用表格或文字叙述)实现功能:1取数逻辑:查询内容: EBAN相关信息,详见展示字段查询条件A:选择屏幕条件 and EBAN-LOEKZ = "" and and EBAN-ZQGDH <>”” and EBAN- ZGGDHXM<>”” and EBAN-CSID <> “”过滤掉整个采购申请未审批完成的,(即:采购申请的行项目处理状态都为05(除了删除的行)的为审批完成,其他则为未审批完成) EBAN-BANPR <> 05只要这个申请中有一行申请不为05 则过滤掉该申请查询:"未创建"逻辑如下:在查询条件A增加 EBAN-EBELN = "" and EBAN-EBELp = "" and EKPO-loekz = ""查询:"已创建"逻辑如下:在查询条件A增加 EBAN-EBELN <> "" and EBAN-EBELp <> "" and EKPO-loekz = ""查询:"未上传"逻辑如下:在查询条件A增加 ZMM26T_CSCG_DDLS-ZSCZT = N 或者ZMM26T_CSCG_DDLS 中不存在。

SAP各模块BAPI

SAP各模块BAPI

SAP各模块BAPIFICO模块:FB01 创建会计凭证:BAPI_ACC_DOCUMENT_POST检查会计凭证:BAPI_ACC_DOCUMENT_CHECKFB02 修改会计凭证:FI_ITEMS_MASS_CHANGEFB08 过账冲销会计凭证:BAPI_ACC_DOCUMENT_REV_POST会计:冲销凭证: BAPI_ACC_ACT_POSTINGS_REVERSE会计: 过帐票据凭证冲销: BAPI_ACC_BILLING_REV_POST会计:核算冲销: BAPI_ACC_DOCUMENT_REV_CHECKFS00 创建总账科目:GL_ACCT_MASTER_SAVEAS01 创建固定资产:BAPI_FIXEDASSET_CREATE1,BAPI_FIXEDASSET_CREATE AS02 更改固定资产转移:BAPI_FIXEDASSET_CHANGE固定资产报废:BAPI_ASSET_RETIREMENT_POSTKO88 实际结算:K_SETTLEMENT_GROUP_PROCESSF-44 读取已清算科目行项目:BAPI_AR_ACC_GETBALANCEDITEMS "客户BAPI_AP_ACC_GETBALANCEDITEMS "供应商读取未清科目行项目:BAPI_AR_ACC_GETOPENITEMS "客户BAPI_AP_ACC_GETOPENITEMS "供应商创建结算凭证(例子1:https:///stone0823/article/details/97930626例子2:Z_FI_WS_CREATE_UMBUCHNG例子3:Z_HCX_F44):POSTING_INTERFACE_START "BDC开始POSTING_INTERFACE_CLEARING "处理BDC开始POSTING_INTERFACE_END "BDC结束FBRA核算冲销重置已结清项目(F-44):J_1B_FBRA_POSTING_AUFRUFENSD模块:创建退货订单:BAPI_CUSTOMERRETURN_CREATEVA01 创建贷项订单:SD_SALESDOCUMENT_CREATEVA01 创建销售订单:BAPI_SALESORDER_CREATEFROMDAT2VA02 修改销售订单:BAPI_SALESORDER_CHANGEVA02 查看销售订单状态:STATUS_READ VB+销售订单+000000VA02 修改销售订单状态:I_CHANGE_STATUS 或者STATUS_CHANGE_EXTERN/表:TJ30VA02 判断销售订单状态:STATUS_CHECKVA02 禁用状态按钮:STATUS_TEXT_EDIT "也可直接用于查询,TJ30T对应描述VA11 创建询价单:BAPI_INQUIRY_CREATEFROMDATA2VA21 创建报价单:BAPI_QUOTATION_CREATEFROMDATA2(不知道为啥用不了)/SD_SALESDOCUMENT_CREATE(可用)VKM1 释放信贷:SD_ORDER_CREDIT_RELEASEVA41 创建销售合同:BAPI_CONTRACT_CREATEVF01 创建销售开票凭证:BAPI_BILLINGDOC_CREATEMULTIPLE出具发票:RV_INVOICE_DOCUMENT_ADDVF02 (小旗子)释放到会计核算:BDCVF11 冲销销售开票凭证:BAPI_BILLINGDOC_CANCEL1VK11 创建条件记录:BAPI_PRICES_CONDITIONSVL01N创建交货单:BAPI_OUTB_DELIVERY_CREATE_SLS、BAPI_DELIVERYPROCESSING_EXECVL02N交货单过账发货:BAPI_OUTB_DELIVERY_CONFIRM_DEC、WS_DELIVERY_UPDATEVL02N修改交货单:BAPI_OUTB_DELIVERY_CHANGEMM模块:ME11 创建采购咨询记录:1、ME_DIRECT_INPUT_INFORECORD2、ME_POST_INFORECORD3、ME_UPDATE_INFORECORD_CONDME12 修改采购咨询记录:ME_INFORECORD_MAINTAINME21N 创建采购订单:BAPI_PO_CREATE1ME22N 修改采购订单:BAPI_PO_CHANGESELECT SINGLE frgc1 frgc2 INTO ( l_frgc1,l_frgc2 ) FROM t16fsWHERE frggr = 'R2' AND frgsx = '01'.ME55 采购订单审批:BAPI_PO_RELEASE采购订单取消审批:BAPI_PO_RESET_RELEASEME23N 显示采购订单:BAPI_PO_GETDETAIL1 采购订单明细BAPI_PO_GET_LIST 采购订单列表BAPI_PO_GETITEMS 采购订单明细列表ME51N 创建采购申请:BAPI_PR_CREATE(批导)BAPI_REQUISITION_CREATEME52N 修改采购申请:BAPI_PR_CHANGE(批导)BAPI_REQUISITION_CHANGEME53N 获取明细:BAPI_REQUISITION_GETDETAILSELECT SINGLE frgc1 frgc2 INTO ( l_frgc1,l_frgc2 ) FROM t16fsWHERE frggr = 'M1' AND frgsx = '01'.采购申请审批:BAPI_REQUISITION_RELEASE_GEN采购申请行项目审批:BAPI_REQUISITION_RELEASE采购申请取消审批:BAPI_REQUISITION_RESET_REL_GEN"已创建采购订单的不允许取消(ZMMR026有例子:BAPI_REQUISITION_RESET_RELGEN)采购申请行项目取消审批:BAPI_REQUISITION_RESET_RELEASE导入顺序:基本视图->采购视图->MRP视图->销售视图->会计成本视图->库存地点视图查询物料:MATERIAL_READMM01 创建物料:BAPI_MATERIAL_SAVEDATA扩充MRP区域:MD_MRP_LEVEL_CREATE_DATA修改MRP区域:MD_MRP_LEVEL_CHANGE_DATA扩充生产版本:CS_BOM_CREATE_PRODVER_ENTRIES更改物料单价:BAPI_MATVAL_PRICE_CHANGE分类视图的创建:BAPI_OBJCL_CREATE分类视图得到详细信息:BAPI_OBJCL_GETCLASSES物料视图的扩充:BAPI_MATERIAL_SAVEREPLICAMB21 创建预留单:BAPI_RESERVATION_CREATE1MB22 更改预留单:BAPI_RESERVATION_CHANGEMB24 删除预留单:BAPI_RESERVATION_DELETEMIR7 采购发票预制:BAPI_INCOMINGINVOICE_PARKPP模块:CO11 生成报工:BAPI_PRODORDCONF_CREATE_TTCO01 创建生产订单:BAPI_PRODORD_CREATE生成订单状态:STATUS_READ 状态表:TJ02、TJ02T 参数文件表:TJ20、TJ20T OR+00生产订单修改生产订单状态用BDC方法:功能->限制处理->。

ABAP创建销售订单BAPI

ABAP创建销售订单BAPI

ABAP创建销售订单BAPI创建销售订单BAPI的区别:创建销售订单有三个BAPI:BAPI_SALESORDER_CREATEFROMDAT2BAPI_CUSTOMERRETURN_CREATESD_SALESDOCUMENT_CREATEBAPI_SALESORDER_CREATEFROMDAT2和BAPI_CUSTOMERRETURN_CREATE 都调⽤了SD_SALESDOCUMENT_CREATE这个FM,区别在于调⽤的时候业务类型是写死的,BAPI_SALESORDER_CREATEFROMDAT2限制了业务对象为BUS2032,不能⽤来创建退货凭证;退货类型的业务对象是BUS2012,BAPI_CUSTOMERRETURN_CREATE⽤来创建退货凭证。

是否退货类型凭证可以在TVAK表中VBTYP字段判断,每种凭证类型对应的都有凭证类别,类别为H的就为退货凭证以SD_SALESDOCUMENT_CREATE 为⽰例:DATA: lv_sales_header_in LIKE bapisdhd1,lv_sales_header_inx LIKE bapisdhd1x,lv_logic_switch TYPE bapisdls,lv_salesdocument_ex LIKE bapivbeln-vbeln,lt_sales_items_in LIKE TABLE OF bapisditm WITH HEADER LINE,lt_sales_items_inx LIKE TABLE OF bapisditmx WITH HEADER LINE,lt_sales_schedules_in LIKE TABLE OF bapischdl WITH HEADER LINE,lt_sales_schedules_inx LIKE TABLE OF bapischdlx WITH HEADER LINE,lt_sales_conditions_in LIKE TABLE OF bapicond WITH HEADER LINE,lt_sales_conditions_inx LIKE TABLE OF bapicondx WITH HEADER LINE,lt_sales_text LIKE TABLE OF bapisdtext WITH HEADER LINE,lt_sales_partners_in LIKE TABLE OF bapiparnr WITH HEADER LINE,lt_partner_add LIKE TABLE OF bapiaddr1 WITH HEADER LINE,lt_return LIKE TABLE OF bapiret2 WITH HEADER LINE.DATA: l_answer TYPE c,lv_kwmeng TYPE kwmeng,lv_cond_value TYPE bapikbetr1,lv_cond_value1 TYPE bapikbetr1,lv_sched_line TYPE etenr VALUE '0001',lv_itm_num TYPE posnr_va VALUE '000010'.CLEAR: lt_sales_items_in, lt_sales_items_inx,lt_sales_schedules_in, lt_sales_schedules_inx,lt_sales_conditions_in,lt_sales_conditions_inx,lt_sales_partners_in,lt_return ,lt_alv1,lt_alv1.DATA:xt_ztsd03 TYPE TABLE OF ztsd0003 .READ TABLE gt_alv1 ASSIGNING FIELD-SYMBOL(<xs_alv1>) WITH KEY box = 'X'.IF sy-subrc <> 0 . "Begin of document1MESSAGE e002(zsd01) .ELSE.LOOP AT gt_alv1 ASSIGNING FIELD-SYMBOL(<gs_alv1>) WHERE box = 'X'.CALL FUNCTION'SAPGUI_PROGRESS_INDICATOR'EXPORTING* percentage = lv_percentage "执⾏程序的百分⽐text = '订单正在确认中......'. "提⽰⽂本IF <gs_alv1>-vbeln IS INITIAL .******** sales order headerlv_sales_header_in-doc_type = 'ZOR1'. " 销售凭证类型 ”固定lv_sales_header_in-sales_org = <gs_alv1>-vkorg. " 销售机构lv_sales_header_in-distr_chan = <gs_alv1>-vtweg. " 分销渠道lv_sales_header_in-division = <gs_alv1>-spart. " 产品组lv_sales_header_inx-doc_type = abap_true.lv_sales_header_inx-sales_org = abap_true.lv_sales_header_inx-distr_chan = abap_true.lv_sales_header_inx-division = abap_true.******** Header textsCLEAR: lt_sales_text[].APPEND INITIAL LINE TO lt_sales_text ASSIGNING FIELD-SYMBOL(<ls_sales_text>).<ls_sales_text>-itm_number = space.<ls_sales_text>-text_id = '0002'.<ls_sales_text>-langu = sy-langu.<ls_sales_text>-format_col = '*'.<ls_sales_text>-text_line = <gs_alv1>-remark.lv_itm_num = '0010'.LOOP AT gt_itab ASSIGNING FIELD-SYMBOL(<ls_itab2>) WHERE order_no = <gs_alv1>-order_no. <ls_itab2>-kunnr = |{ <ls_itab2>-kunnr ALPHA = IN }| .******** PARTNERSELECT SINGLE name1,pstlz,adrnr,ort01FROM kna1 WHERE kunnr = @<ls_itab2>-kunnrINTO ( @DATA(lv_name) ,@DATA(lv_code),@DATA(lv_adrnr),@DATA(lv_city) ).lt_sales_partners_in-partn_role = 'WE'.lt_sales_partners_in-partn_numb = <ls_itab2>-kunnr."送达⽅lt_sales_partners_in-title = '公司'."称谓lt_sales_partners_in-name = lv_name."名称1lt_sales_partners_in-country = 'CN' ."国家代码lt_sales_partners_in-postl_code = lv_code ."邮政编码lt_sales_partners_in-city = lv_city ."城市lt_sales_partners_in-street = <ls_itab2>-con_address ."地址lt_sales_partners_in-district = <ls_itab2>-consignee && ';' && <ls_itab2>-con_phone ."⼿机号APPEND lt_sales_partners_in.CLEAR lt_sales_partners_in.lt_sales_partners_in-partn_role = 'AG'.lt_sales_partners_in-partn_numb = <ls_itab2>-kunnr." 售达⽅APPEND lt_sales_partners_in.CLEAR lt_sales_partners_in.******** PARTNERADDRESSES* lt_partner_add-addr_no = lv_adrnr .* lt_partner_add-street = <ls_itab2>-con_phone .* APPEND lt_partner_add.* CLEAR lt_partner_add.******** sales order itemlt_sales_items_in-purch_no_s = <ls_itab2>-order_no."加前导零CALL FUNCTION'CONVERSION_EXIT_MATN1_INPUT'EXPORTINGinput = <ls_itab2>-matnrIMPORTINGoutput = <ls_itab2>-matnr.lt_sales_items_in-material = <ls_itab2>-matnr. " 物料lt_sales_items_in-plant = <ls_itab2>-vkorg. " ⼯⼚lt_sales_items_in-batch = <ls_itab2>-charg. " 库存地点lt_sales_items_inx-purch_no_s = abap_true.lt_sales_items_inx-material = abap_true.lt_sales_items_inx-plant = abap_true.lt_sales_items_inx-batch = abap_true. " 批次号******** sales order itemlt_sales_items_in-itm_number = lv_itm_num.lt_sales_items_inx-itm_number = lv_itm_num.*APPEND: lt_sales_items_in, lt_sales_items_inx.CLEAR: lt_sales_items_in, lt_sales_items_inx.******** sales Schedule Linelt_sales_schedules_in-itm_number = lv_itm_num.lt_sales_schedules_in-sched_line = lv_sched_line. " L_TABIX.lt_sales_schedules_in-req_date = <gs_alv1>-edatu. " 计划⾏⽇期lt_sales_schedules_in-req_qty = <ls_itab2>-menge. " 以销售单位计的订单数量lt_sales_schedules_inx-itm_number = lv_itm_num.lt_sales_schedules_inx-sched_line = lv_sched_line.lt_sales_schedules_inx-req_date = abap_true.lt_sales_schedules_inx-req_qty = abap_true.APPEND: lt_sales_schedules_in, lt_sales_schedules_inx.CLEAR: lt_sales_schedules_in, lt_sales_schedules_inx.******** 复制不变定价因素且重定税款lv_logic_switch-pricing = 'G'.*lt_sales_conditions_in-itm_number = lv_itm_num.lt_sales_conditions_in-cond_type = 'Z002'. " 条件类型定价条件lt_sales_conditions_in-cond_value = <ls_itab2>-reb_amount. " 价格定价⽐率lt_sales_conditions_in-currency = 'CNY'. " 货币码*lt_sales_conditions_inx-itm_number = lv_itm_num.lt_sales_conditions_inx-cond_type = 'Z002'.lt_sales_conditions_inx-currency = abap_true.lt_sales_conditions_inx-cond_value = abap_true.APPEND: lt_sales_conditions_in,lt_sales_conditions_inx.CLEAR: lt_sales_conditions_in,lt_sales_conditions_inx,lv_cond_value.lt_sales_conditions_in-itm_number = lv_itm_num.lt_sales_conditions_in-cond_type = 'Z003'. " 条件类型定价条件lt_sales_conditions_in-cond_value = <ls_itab2>-exe_amount . " 价格定价⽐率lt_sales_conditions_in-currency = 'CNY'. " 货币码*lt_sales_conditions_inx-itm_number = lv_itm_num.lt_sales_conditions_inx-cond_type = 'Z003'.lt_sales_conditions_inx-currency = abap_true.lt_sales_conditions_inx-cond_value = abap_true.*APPEND: lt_sales_conditions_in,lt_sales_conditions_inx.CLEAR: lt_sales_conditions_in,lt_sales_conditions_inx,lv_cond_value.lv_itm_num = lv_itm_num + 10 .ENDLOOP.******** CALL BAPI 'SD_SALESDOCUMENT_CREATE'CLEAR:lv_salesdocument_ex,lt_return,lt_return[].CALL FUNCTION'SD_SALESDOCUMENT_CREATE'EXPORTING* salesdocument = <ls_itab2>-vbelnsales_header_in = lv_sales_header_insales_header_inx = lv_sales_header_inxconvert_parvw_auart = abap_onlogic_switch = lv_logic_switchIMPORTINGsalesdocument_ex = lv_salesdocument_exTABLESreturn = lt_returnsales_items_in = lt_sales_items_insales_items_inx = lt_sales_items_inxsales_schedules_in = lt_sales_schedules_insales_schedules_inx = lt_sales_schedules_inxsales_conditions_in = lt_sales_conditions_insales_conditions_inx = lt_sales_conditions_inxsales_partners = lt_sales_partners_inpartneraddresses = lt_partner_addsales_text = lt_sales_text[].IF sy-subrc EQ0AND lv_salesdocument_ex IS NOT INITIAL.<gs_alv1>-zicon = icon_green_light.<gs_alv1>-mseg = lv_salesdocument_ex .<gs_alv1>-vbeln = lv_salesdocument_ex .PERFORM frm_return_dms TABLES lt_alv1 lt_outUSING'Confirmed' .READ TABLE lt_out ASSIGNING FIELD-SYMBOL(<ls_out1>) INDEX 1.IF sy-subrc = 0.IF <ls_out1>-rtnval = '1'.COMMIT WORK.MOVE-CORRESPONDING gt_itab[] TO xt_ztsd03 .DELETE xt_ztsd03 WHERE order_no NE <gs_alv1>-order_no .MODIFY ztsd0003 FROM TABLE xt_ztsd03 .UPDATE ztsd0003 SET vbeln = lv_salesdocument_ex WHERE order_no = <gs_alv1>-order_no .ELSE.ROLLBACK WORK.<gs_alv1>-zicon = icon_red_light.<gs_alv1>-mseg = <ls_out1>-rtnmsg .ENDIF.ENDIF.ELSE.LOOP AT lt_return WHERE type = 'E'.* MESSAGE e000(zsd01) WITH lt_return-message.<gs_alv1>-zicon = icon_red_light.<gs_alv1>-mseg = lt_return-message .EXIT.ENDLOOP.ROLLBACK WORK.ENDIF.CLEAR:lv_sales_header_in,lv_sales_header_inx,lv_logic_switch,lt_sales_items_in[],lt_sales_items_inx[],lt_sales_schedules_in[],lt_sales_schedules_inx[],lt_sales_conditions_in[], lt_sales_conditions_inx,lt_sales_partners_in[],lt_sales_text[].ELSE.<gs_alv1>-zicon = icon_yellow_light.<gs_alv1>-mseg = '⽆法重复确认!'.ENDIF.ENDLOOP.ENDIF.具体需要输⼊什么参数可以根据BAPI的表格结构去添加。

创建销售订单BAPI一些心得

创建销售订单BAPI一些心得

创建销售订单BAPI⼀些⼼得1.创建销售订单使⽤的BAPIBAPI_SALESORDER_CREATEFROMDAT2但是 BUSINESS OBJECT限制为 BUS2032使⽤FM:DATA LV_OBJTYPE TYPE OJ_NAME .LS_HEADER-SD_DOC_CAT为销售订单类型,即类型为:VBAK-VBTYPCALL FUNCTION 'SD_OBJECT_TYPE_DETERMINE'EXPORTINGI_DOCUMENT_TYPE = LS_HEADER-SD_DOC_CATIMPORTINGE_BUSINESS_OBJECT = LV_OBJTYPEEXCEPTIONSOTHERS = 1.如果LV_OBJTYPE = BUS2032则可以使⽤BAPI_SALESORDER_CREATEFROMDAT2如果其他的业务对象则使⽤FM: SD_SALESDOCUMENT_CREATE创建销售订单2.关于销售订单的增强使⽤参数 EXTENSIONIN举个例⼦,例如VBKD的数据 VBKD- TRATY VBKD- TRMTYP⼤家应该可以看出来VBKD 数据中, 虽然分为vbeln posnr 但是⼀般只会使⽤vbeln字段,posnr 为空,此时,VBKD 数据⼀般都可以在bapi参数ORDER_HEADER_IN 找到,但是VBKD- TRATY 却在bapi 中没有.所以我们需要做增强.⾸先我们要确认使⽤ BAPE_VBAK 和BAPE_VBAKX两个结构LS_BAPIPAREX-STRUCTURE = 'BAPE_VBAK'.LS_BAPE_VBAK-TRATY = LS_BAPISDHD1_VBKD-TRATY.LS_BAPE_VBAK-VSART = LS_BAPISDHD1_VBKD-VSART.LS_BAPE_VBAK-TRMTYP = LS_BAPISDHD1_VBKD-TRMTYP.LS_BAPE_VBAK-SDABW = LS_BAPISDHD1_VBKD-SDABW.LS_BAPIPAREX-VALUEPART1 = LS_BAPE_VBAK.APPEND LS_BAPIPAREX TO ET_BAPIPAREX.LS_BAPIPAREX-STRUCTURE = 'BAPE_VBAKX'.LS_BAPE_VBAKX-TRATY = CNS_X.LS_BAPE_VBAKX-VSART = CNS_X.LS_BAPE_VBAKX-TRMTYP = CNS_X.LS_BAPE_VBAKX-SDABW = CNS_X.LS_BAPIPAREX-VALUEPART1 = LS_BAPE_VBAKX.其次:VBAKKOZ 需要增加TRATY . VBAKKOZX 也添加相应的控制字段TRATY type BAPIUPDATE然后请注意,ORDER_HEADER_INX-UPDATEFLAG = SPACE . !! 这点很重要.详细逻辑请找:SE38:FV45KFAK_VBAK_FUELLEN_VBAKKOM。

SAP BAPI 生产工单创建及修改

SAP BAPI 生产工单创建及修改

SAP标准工单创建bapi: BAPI_PRODORD_CREATE但是使用此bapi 有如下缺点:1.后台另起线程更新数据库,即使BAPI_TRANSACTION_COMMIT(加上wait参数也无法保证当前时点已更新到数据库)即,当需要工单创建后,后续操作时,此bapi无法满足需要(比如创建工单之后,调用下达function自动下达)2.此BAPI 输入参数很有限.当需要额外参数时,就无法满足需求(比如创建样件,试制工单不限制收货数量),创建工单时,外部输入组件信息也无法满足.-----------------------------------------------------------------------------示例: 通过接口创建工单(并传入工单组件信息).*当创建工单的同时,可以使用如下方式:不提交数据库CALL FUNCTION 'COXT_BAPI_ORDER_CREATE'EXPORTINGIS_HEADER = LS_ORDERDATAI_ORDER_CATEGORY = '10'* IV_RESET = 'X'IV_ORDER_POST = ' 'IV_COMMIT = ' 'IMPORTINGES_RETURN = LS_RETURNE_ORDER_NUMBER = LV_ORDER_NUMBERE_ORDER_TYPE = LV_ORDER_TYPE*提交数据库且会等待直到工单完成*****************************************************CO_ZV_ORDER_POST是个比较有趣的function , 提交之前,会读取(SAPLCOBH)AFPO_BT等数据,即,可以使用fs修改抬头或者组件数据.比如需要在创建订单时,设置无限制收货(可添加如下代码).ASSIGN ('(SAPLCOBH)AFPO_BT[]') TO <FT_AFPO_BT>.LOOP AT <FT_AFPO_BT> ASSIGNING <FS_AFPO_BT>.<FS_AFPO_BT>-UEBTK = 'X'.ENDLOOP.设置组件反冲可使用如下代码:ASSIGN ('(SAPLCOBC)RESB_BT[]') TO <FT_RESB_BT>.LOOP AT <FT_RESB_BT> ASSIGNING <FS_RESB_BT>.<FS_RESB_BT>-RGEKZ = 'X'.ENDLOOP.*当然,也可以在CO_ZV_ORDER_POST函数中增强去实现以上功能.**************************************************CALL FUNCTION 'CO_ZV_ORDER_POST'EXPORTINGCOMMIT_FLAG = SPACEEXT_FLG = 'X'TRANS_TYP = 'H'NO_GUI_MESSAGE = 'X'NO_DIALOG = 'X'IMPORTINGfirst_aufnr = LV_ORDER_NUMBER** TABLES** CAUFVD_NUM_EXP = ET_ORD_KEY_MAPEXCEPTIONSNO_CHANGE = 1UPDATE_REJECT = 2BUDGET_REJECT = 3OTHERS = 4.IF SY-SUBRC = 0.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGWAIT = 'X'.endif.*删除原工单组件信息.可使用:BAPI_NETWORK_COMP_REMOVE 或者:CO_XT_COMPONENTS_DELETE*新增工单组件可使用:CO_XT_COMPONENT_ADDCALL FUNCTION 'CO_XT_COMPONENT_ADD'EXPORTINGIS_ORDER_KEY = LV_ORDER_NUMBERI_MATERIAL = LV_MATERIALIS_REQU_QUAN = LS_REQU_QUANI_OPERATION = LV_OPERATIONI_SEQUENCE = LV_SEQUENCEIS_STORAGE_LOCATION = LS_STORAGE_LOCATIONIS_STORAGE_LOCATIONX = LS_STORAGE_LOCATIONX I_BATCH = LV_BATCHI_BATCHX = LV_BATCHXI_POSTP = LV_POSTPI_POSNO = LV_POSITIONNOIMPORTINGES_BAPIRETURN = LS_RETURNE_ERROR_OCCURRED = LV_ERROR.ASSIGN ('(SAPLCOBC)RESB_BT[]') TO <FT_RESB_BT>.LOOP AT <FT_RESB_BT> ASSIGNING <FS_RESB_BT>.LV_NUMC = SY-TABIX * 10.<FS_RESB_BT>-POSNR = LV_NUMC.<FS_RESB_BT>-RGEKZ = ''."设置反冲标识CLEAR LV_NUMC.ENDLOOP.CALL FUNCTION 'CO_ZV_ORDER_POST'EXPORTINGCOMMIT_FLAG = SPACEEXT_FLG = 'X'TRANS_TYP = 'V'NO_DIALOG = 'X'commit work and wait.。

abap me59n bapi函数

abap me59n bapi函数

ABAP ME59N BAPI函数是针对采购订单和采购申请中的未清项的处理函数。

采购订单中未清项是指尚未生成凭证或尚未校准的项。

通过使用ME59N BAPI函数,可以有效地处理未清项,对采购订单进行合理的处理。

本文将详细介绍ABAP ME59N BAPI函数的相关内容,包括其功能、使用方法、常见问题及解决方案等。

希望能够通过本文的介绍,帮助读者更加深入地了解和掌握ABAP ME59N BAPI函数的相关知识。

一、ABAP ME59N BAPI函数的功能ABAP ME59N BAPI函数主要用于处理采购订单和采购申请中的未清项。

其主要功能包括:1. 生成凭证:对于已经完成的采购订单或者采购申请,可以使用ME59N BAPI函数生成相应的凭证,方便后续的财务处理。

2. 校准项:对于未能及时校准的项,可以使用ME59N BAPI函数进行校准,确保采购订单的准确性和完整性。

3. 自动处理:ME59N BAPI函数可以实现对未清项的自动处理,提高工作效率并减少手工操作的繁琐性。

二、ABAP ME59N BAPI函数的使用方法使用ABAP ME59N BAPI函数的方法如下所示:1. 调用BAPI函数:在ABAP程序中,通过调用BAPI函数的方式来使用ME59N BAPI函数。

具体调用方法可参考相关的开发文档或者示例代码。

2. 传入参数:在调用ME59N BAPI函数时,需要传入相关的参数,包括采购订单号、采购申请号等信息,以便函数能够准确地处理相应的未清项。

3. 处理结果:ME59N BAPI函数处理完成后,会返回相应的处理结果,包括成功或者失败等信息。

根据返回的结果,可以进一步处理相应的业务逻辑。

三、ABAP ME59N BAPI函数的常见问题及解决方案在实际使用ABAP ME59N BAPI函数时,可能会遇到一些常见的问题,以下是一些可能的问题及相应的解决方案:1. 参数传递错误:在调用ME59N BAPI函数时,可能会因为参数传递错误而导致处理失败。

使用BAPI_PO_CREATE1批量创建采购订单(1)

使用BAPI_PO_CREATE1批量创建采购订单(1)

使用BAPI_PO_CREATE1批量创建采购订单(1)使用BAPI_PO_CREATE1批量创建采购订单*&---------------------------------------------------------------------**& Report ZMM_UPLOAD_PO*&*&---------------------------------------------------------------------**&*&*&---------------------------------------------------------------------*REPORT zmm_upload_po.DATA:BEGIN OF gt_data OCCURS 0,bsart TYPE string,"采购凭证类型lifnr TYPE string,"供应商帐户号ekorg TYPE string,"采购组织ekgrp TYPE string,"采购组bukrs TYPE string,"公司代码ihrez TYPE string,"您的参考ebelp TYPE string,"采购凭证的项目编号knttp TYPE string,"科目分配类别txz01 TYPE string,"短文本menge TYPE string,"采购订单数量meins TYPE string,"采购订单的计量单位eeind TYPE string,"交货日期Wnetpr TYPE string,"净价waers TYPE string,"货币 Wmatkl TYPE string,"物料组werks TYPE string,"工厂bednr TYPE string,"需求跟踪号afnam TYPE string,"需求者/请求者姓名mwskz TYPE string,"销售税代码sakto TYPE string,"总帐科目kostl TYPE string,"成本中心anln1 TYPE string,"资产aufnr TYPE string,"订单str1 TYPE string,"行项目文本-来自采购申请项目详细清单str2 TYPE string,"行项目文本-规格型号str3 TYPE string,"行项目文本-RFQ Referencebstae TYPE string,"确认控制END OF gt_data.DATA: BEGIN OF gt_out OCCURS 0,text(255),END OF gt_out.DATA: poheader LIKE TABLE OF bapimepoheader WITH HEADER LINE , poheaderx LIKE TABLE OF bapimepoheaderx WITH HEADER LINE, return LIKE TABLE OF bapiret2 WITH HEADER LINE,poitem LIKE TABLE OF bapimepoitem WITH HEADER LINE,poitemx LIKE TABLE OF bapimepoitemx WITH HEADER LINE, poschedule LIKE TABLE OF bapimeposchedule WITH HEADER LINE, poschedulex LIKE TABLE OF bapimeposchedulx WITH HEADER LINE, poaccount LIKE TABLE OF bapimepoaccount WITH HEADER LINE, poaccountx LIKE TABLE OF bapimepoaccountx WITH HEADER LINE, pocond LIKE TABLE OF bapimepocond WITH HEADER LINE,pocondx LIKE TABLE OF bapimepocondx WITH HEADER LINE, potextitem LIKE TABLE OF bapimepotext WITH HEADER LINE. DATA: epo LIKE bapimepoheader-po_number.DATA: l_return LIKE return.DATA: lv_message(255).CONSTANTS: con VALUE 'X'.DATA: pp_file TYPE string.DATA: lifnr TYPE elifn.DATA: netpr TYPE bprei.DATA: bstae TYPE bstae.PARAMETERS:p_file(128) .AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.PERFORM get_file.START-OF-SELECTION.PERFORM get_data.PERFORM create_po.PERFORM write_out.*&---------------------------------------------------------------------**& Form GET_FILE*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM get_file .CALL FUNCTION 'WS_FILENAME_GET'EXPORTINGdef_filename = p_filemask = ',*.txt,*.TXT.'mode = 'O'title = 'File Name'IMPORTINGfilename = p_fileEXCEPTIONSinv_winsys = 1no_batch = 2selection_cancel = 3selection_error = 4OTHERS = 5.pp_file = p_file.ENDFORM. " GET_FILE*&---------------------------------------------------------------------**& Form GET_DATA*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM get_data .CALL FUNCTION 'GUI_UPLOAD'EXPORTINGfilename = pp_filefiletype = 'ASC'has_field_separator = 'X'* HEADER_LENGTH = 0read_by_line = 'X'* DAT_MODE = ' '* CODEPAGE = ' '* IGNORE_CERR = ABAP_TRUE* REPLACEMENT = '#'* CHECK_BOM = ' '* VIRUS_SCAN_PROFILE =* NO_AUTH_CHECK = ' '* IMPORTING* FILELENGTH =* HEADER =TABLESdata_tab = gt_dataEXCEPTIONSfile_open_error = 1file_read_error = 2no_batch = 3gui_refuse_filetransfer = 4invalid_type = 5no_authority = 6unknown_error = 7bad_data_format = 8header_not_allowed = 9separator_not_allowed = 10header_too_long = 11unknown_dp_error = 12access_denied = 13dp_out_of_memory = 14disk_full = 15dp_timeout = 16OTHERS = 17.IF sy-subrc <> 0.CASE sy-subrc.WHEN 1.MESSAGE 'FILE_OPEN_ERROR ' TYPE 'E'.WHEN 2.MESSAGE 'FILE_READ_ERROR ' TYPE 'E'.WHEN 3.MESSAGE 'NO_BATCH' TYPE 'E'.WHEN 4.MESSAGE 'GUI_REFUSE_FILETRANSFER ' TYPE 'E'. WHEN 5.MESSAGE 'INVALID_TYPE ' TYPE 'E'.WHEN 6.MESSAGE ' NO_AUTHORITY' TYPE 'E'.WHEN 7.MESSAGE 'UNKNOWN_ERROR' TYPE 'E'.WHEN 8.MESSAGE 'BAD_DATA_FORMAT ' TYPE 'E'.WHEN 9.MESSAGE 'HEADER_NOT_ALLOWED' TYPE 'E'.WHEN 10.MESSAGE 'SEPARATOR_NOT_ALLOWED' TYPE 'E'.WHEN 11.MESSAGE 'HEADER_TOO_LONG ' TYPE 'E'.WHEN 12.MESSAGE 'UNKNOWN_DP_ERROR' TYPE 'E'.WHEN 13.MESSAGE ' ACCESS_DENIED ' TYPE 'E'.WHEN 14.MESSAGE 'DP_OUT_OF_MEMORY ' TYPE 'E'.WHEN 15.MESSAGE 'DISK_FULL ' TYPE 'E'.WHEN 16.MESSAGE 'DP_TIMEOUT' TYPE 'E'.WHEN 17.MESSAGE ' OTHERS ' TYPE 'E'.WHEN OTHERS.ENDCASE.* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF.ENDFORM. " GET_DATA*&---------------------------------------------------------------------**& Form CREATE_PO*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM create_po .LOOP AT gt_data.AT NEW ihrez.CLEAR lifnr.lifnr = gt_data-lifnr.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'EXPORTINGinput = lifnrIMPORTINGoutput = lifnr.poheader-doc_type = gt_data-bsart.poheader-vendor = lifnr.poheader-purch_org = gt_data-ekorg.poheader-pur_group = gt_data-ekgrp.poheader-comp_code = gt_data-bukrs.poheader-ref_1 = gt_data-ihrez.poheader-doc_date = sy-datum.poheader-langu = sy-langu.poheader-currency = gt_data-waers."货币poheaderx-doc_type = con.poheaderx-vendor = con.poheaderx-purch_org = con.poheaderx-pur_group = con.poheaderx-comp_code = con.poheaderx-ref_1 = con.poheaderx-doc_date = con.poheaderx-langu = con.poheaderx-currency = con."货币ENDAT.CLEAR netpr.netpr = gt_data-netpr.CLEAR bstae.bstae = gt_data-bstae.CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTINGinput = bstaeIMPORTINGoutput = bstae.poitem-po_item = gt_data-ebelp. "采购凭证的项目编号poitem-acctasscat = gt_data-knttp."科目分配类别poitem-short_text = gt_data-txz01."短文本poitem-quantity = gt_data-menge."采购订单数量poitem-po_unit = gt_data-meins ."采购订单的计量单位poitem-net_price = netpr."净价poitem-matl_group = gt_data-matkl."物料组poitem-plant = gt_data-werks. "工厂poitem-trackingno = gt_data-bednr."需求跟踪号poitem-preq_name = gt_data-afnam."需求者/请求者姓名poitem-tax_code = gt_data-mwskz."销售税代码poitem-conf_ctrl = bstae."确认控制代码APPEND poitem.CLEAR poitem.poitemx-po_item = gt_data-ebelp. "采购凭证的项目编号poitemx-acctasscat = con ."科目分配类别poitemx-short_text = con."短文本poitemx-quantity = con."采购订单数量poitemx-po_unit = con ."采购订单的计量单位poitemx-net_price = con."净价poitemx-matl_group = con."物料组poitemx-plant = con."工厂poitemx-trackingno = con."需求跟踪号poitemx-preq_name = con."需求者/请求者姓名poitemx-tax_code = con."销售税代码poitemx-conf_ctrl = con."确认控制代码poitemx-ret_item = con."退货项目APPEND poitemx.CLEAR poitemx.poschedule-po_item = gt_data-ebelp. "采购凭证的项目编号poschedule-sched_line = gt_data-ebelp. "采购凭证的项目编号poschedule-del_datcat_ext = 'D'."交货日期的类别poschedule-delivery_date = gt_data-eeind."交货日期poschedule-quantity = gt_data-menge."采购订单数量APPEND poschedule.CLEAR poschedule.poschedulex-po_item = gt_data-ebelp. "采购凭证的项目编号poschedulex-sched_line = gt_data-ebelp. "采购凭证的项目编号poschedulex-del_datcat_ext = con."交货日期的类别poschedulex-delivery_date = con."交货日期poschedulex-quantity = con."采购订单数量APPEND poschedulex.CLEAR poschedulex.poaccount-po_item = gt_data-ebelp. "采购凭证的项目编号poaccount-gl_account = gt_data-sakto."总帐科目poaccount-costcenter = gt_data-kostl."成本中心poaccount-asset_no = gt_data-anln1."主资产号poaccount-orderid = gt_data-aufnr."订单号poaccount-co_area = 'BELL'."成本控制APPEND poaccount.CLEAR poaccount.poaccountx-po_item = gt_data-ebelp. "采购凭证的项目编号poaccountx-gl_account = con."总帐科目poaccountx-costcenter = con."成本中心poaccountx-asset_no = con."主资产号poaccountx-orderid = con."订单号poaccountx-co_area = con."成本控制APPEND poaccountx.CLEAR poaccountx.potextitem-po_item = gt_data-ebelp. "采购凭证的项目编号potextitem-text_id = 'F03'."来自采购申请项目详细清单potextitem-text_line = gt_data-str1."行项目文本-来自采购申请项目详细清单APPEND potextitem.CLEAR potextitem.potextitem-po_item = gt_data-ebelp. "采购凭证的项目编号potextitem-text_id = 'F04'." 规格/型号potextitem-text_line = gt_data-str2."行项目文本-规格型号APPEND potextitem.CLEAR potextitem.potextitem-po_item = gt_data-ebelp. "采购凭证的项目编号potextitem-text_id = 'F09'." RFQ Referencepotextitem-text_line = gt_data-str3."行项目文本- RFQ Reference APPEND potextitem.CLEAR potextitem.AT END OF ihrez.CALL FUNCTION 'BAPI_PO_CREATE1'EXPORTINGpoheader = poheaderpoheaderx = poheaderx* POADDRVENDOR =* TESTRUN =* MEMORY_UNCOMPLETE =* MEMORY_COMPLETE =* POEXPIMPHEADER =* POEXPIMPHEADERX =* VERSIONS =* NO_MESSAGING =* NO_MESSAGE_REQ =* NO_AUTHORITY =* NO_PRICE_FROM_PO =IMPORTINGexppurchaseorder = epo* EXPHEADER =* EXPPOEXPIMPHEADER =TABLESreturn = returnpoitem = poitempoitemx = poitemx* POADDRDELIVERY =poschedule = poscheduleposchedulex = poschedulexpoaccount = poaccount* POACCOUNTPROFITSEGMENT =poaccountx = poaccountx* POCONDHEADER =* POCONDHEADERX =* POCOND =* POCONDX =* POLIMITS =* POCONTRACTLIMITS =* POSERVICES =* POSRVACCESSVALUES =* POSERVICESTEXT =* EXTENSIONIN =* EXTENSIONOUT =* POEXPIMPITEM =* POEXPIMPITEMX =* POTEXTHEADER =potextitem = potextitem* ALLVERSIONS =* POPARTNER =* POCOMPONENTS =* POCOMPONENTSX =* POSHIPPING =* POSHIPPINGX =* POSHIPPINGEXP =.LOOP AT return WHERE type = 'E' OR type = 'A'. ENDLOOP.IF sy-subrc = 0.CLEAR: lv_message.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. LOOP AT return INTO l_return WHERE type = 'E' . CONCATENATE lv_message l_return-message ';'INTO lv_message.ENDLOOP.CONCATENATE gt_data-ihrez lv_message INTO gt_out-text.APPEND gt_out.CLEAR gt_out.ELSE.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.CONCATENATE epo '创建成功' INTO gt_out-text.APPEND gt_out.CLEAR gt_out.ENDIF.REFRESH: poitem,poitemx,poschedule,poschedulex,poaccount,poaccountx,potextitem ,poheader,poheaderx,return.CLEAR: poitem,poitemx,poschedule,poschedulex,poaccount,poaccountx,potextitem ,poheader,poheaderx,return.ENDAT.ENDLOOP.ENDFORM. " CREATE_PO*&---------------------------------------------------------------------**& Form WRITE_OUT*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM write_out .LOOP AT gt_out.WRITE: / gt_out-text.ENDLOOP.ENDFORM.。

SAP BAPI 生产工单创建及修改

SAP BAPI 生产工单创建及修改

SAP标准工单创建bapi: BAPI_PRODORD_CREATE但是使用此bapi 有如下缺点:1.后台另起线程更新数据库,即使BAPI_TRANSACTION_COMMIT(加上wait参数也无法保证当前时点已更新到数据库)即,当需要工单创建后,后续操作时,此bapi无法满足需要(比如创建工单之后,调用下达function自动下达)2.此BAPI 输入参数很有限.当需要额外参数时,就无法满足需求(比如创建样件,试制工单不限制收货数量),创建工单时,外部输入组件信息也无法满足.-----------------------------------------------------------------------------示例: 通过接口创建工单(并传入工单组件信息).*当创建工单的同时,可以使用如下方式:不提交数据库CALL FUNCTION 'COXT_BAPI_ORDER_CREATE'EXPORTINGIS_HEADER = LS_ORDERDATAI_ORDER_CATEGORY = '10'* IV_RESET = 'X'IV_ORDER_POST = ' 'IV_COMMIT = ' 'IMPORTINGES_RETURN = LS_RETURNE_ORDER_NUMBER = LV_ORDER_NUMBERE_ORDER_TYPE = LV_ORDER_TYPE*提交数据库且会等待直到工单完成*****************************************************CO_ZV_ORDER_POST是个比较有趣的function , 提交之前,会读取(SAPLCOBH)AFPO_BT等数据,即,可以使用fs修改抬头或者组件数据.比如需要在创建订单时,设置无限制收货(可添加如下代码).ASSIGN ('(SAPLCOBH)AFPO_BT[]') TO <FT_AFPO_BT>.LOOP AT <FT_AFPO_BT> ASSIGNING <FS_AFPO_BT>.<FS_AFPO_BT>-UEBTK = 'X'.ENDLOOP.设置组件反冲可使用如下代码:ASSIGN ('(SAPLCOBC)RESB_BT[]') TO <FT_RESB_BT>.LOOP AT <FT_RESB_BT> ASSIGNING <FS_RESB_BT>.<FS_RESB_BT>-RGEKZ = 'X'.ENDLOOP.*当然,也可以在CO_ZV_ORDER_POST函数中增强去实现以上功能.**************************************************CALL FUNCTION 'CO_ZV_ORDER_POST'EXPORTINGCOMMIT_FLAG = SPACEEXT_FLG = 'X'TRANS_TYP = 'H'NO_GUI_MESSAGE = 'X'NO_DIALOG = 'X'IMPORTINGfirst_aufnr = LV_ORDER_NUMBER** TABLES** CAUFVD_NUM_EXP = ET_ORD_KEY_MAPEXCEPTIONSNO_CHANGE = 1UPDATE_REJECT = 2BUDGET_REJECT = 3OTHERS = 4.IF SY-SUBRC = 0.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGWAIT = 'X'.endif.*删除原工单组件信息.可使用:BAPI_NETWORK_COMP_REMOVE 或者:CO_XT_COMPONENTS_DELETE*新增工单组件可使用:CO_XT_COMPONENT_ADDCALL FUNCTION 'CO_XT_COMPONENT_ADD'EXPORTINGIS_ORDER_KEY = LV_ORDER_NUMBERI_MATERIAL = LV_MATERIALIS_REQU_QUAN = LS_REQU_QUANI_OPERATION = LV_OPERATIONI_SEQUENCE = LV_SEQUENCEIS_STORAGE_LOCATION = LS_STORAGE_LOCATIONIS_STORAGE_LOCATIONX = LS_STORAGE_LOCATIONX I_BATCH = LV_BATCHI_BATCHX = LV_BATCHXI_POSTP = LV_POSTPI_POSNO = LV_POSITIONNOIMPORTINGES_BAPIRETURN = LS_RETURNE_ERROR_OCCURRED = LV_ERROR.ASSIGN ('(SAPLCOBC)RESB_BT[]') TO <FT_RESB_BT>.LOOP AT <FT_RESB_BT> ASSIGNING <FS_RESB_BT>.LV_NUMC = SY-TABIX * 10.<FS_RESB_BT>-POSNR = LV_NUMC.<FS_RESB_BT>-RGEKZ = ''."设置反冲标识CLEAR LV_NUMC.ENDLOOP.CALL FUNCTION 'CO_ZV_ORDER_POST'EXPORTINGCOMMIT_FLAG = SPACEEXT_FLG = 'X'TRANS_TYP = 'V'NO_DIALOG = 'X'commit work and wait.。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档