SAPCRM销售订单集成创建

一、概述

越来越多的公司在数字化转型项目中不仅只上线SAP系统,而是将各模块外围系统同步上线,因此对于业务顾问来说,不只要写增强&报表的FS,还要提供外围系统集成的接口规范,以及集成方案,本文分享一下在某项目中的接口规范以及源码。

1.集成方案

本次项目中,由于客户要求价格必须由财务严格把控,因此通过CRM调用BAPI获取财务在SAP系统中维护的价格主数据的方式。
集成方式大致有:
1、CRM创建订单,设置利润率计算公式,并计算利润率,根据不同利润率触发OA审批,并设置分级审批。
2、财务统计发布建议售价,在建议售价基础上打折,根据折扣和业务员折扣权限触发审批,并设置分级审批。

本项目中采用的集成形式为,销售人员在CRM系统中创建销售订单,并将订单数据同步至SAP,SAP调用BAPI模拟创建销售订单,在内表中获取定价过程中的价格主数据,并将其作为基准价返回CRM,销售根据基准价填写给客户的实际售价,CRM系统计算实际售价与基准价的差额,并设置差额审批流程,触发OA审批。审批后返回审批状态,若为审批通过,CRM系统自动触发与SAP的接口,将销售订单数据同步至SAP,SAP创建销售凭证,并返回凭证编号。流程图如下:
系统数据流图

2. 接口规范

接口规范即为SAP系统的字段名、类型以及用途
接口规范表头
接口规范表体
接口规范返回消息

3.接口函数

FUNCTION Z_SD_SO_CREATE.
*“----------------------------------------------------------------------
"“本地接口:
*” EXPORTING
*” LV(ET_RETURN) TYPE ZSDT_SO_RETURN
*" TABLES
*" IT_SOHEAD STRUCTURE ZSDS_SOHEAD_INTF OPTIONAL
*" IT_SOITEM STRUCTURE ZSDS_SOITEM_INTF OPTIONAL
*"----------------------------------------------------------------------
DATA:LS_HEADER TYPE BAPISDHD1,
LS_HEADERX TYPE BAPISDHD1X,
LS_LOGIC_SWITCH TYPE BAPISDLS,
LT_ITEM TYPE TABLE OF BAPISDITM,
LS_ITEM TYPE BAPISDITM,
LT_ITEMX TYPE TABLE OF BAPISDITMX,
LS_ITEMX TYPE BAPISDITMX,
LT_PARTS TYPE TABLE OF BAPIPARNR,
LS_PARTS TYPE BAPIPARNR,
LT_SCH TYPE TABLE OF BAPISCHDL,
LS_SCH TYPE BAPISCHDL,
LT_SCHX TYPE TABLE OF BAPISCHDLX,
LS_SCHX TYPE BAPISCHDLX,
LT_COND TYPE TABLE OF BAPICOND,
LS_COND TYPE BAPICOND,
LT_CONDX TYPE TABLE OF BAPICONDX,
LS_CONDX TYPE BAPICONDX,
LT_TEXT_TMP TYPE TABLE OF BAPISDTEXT,
LT_TEXT TYPE TABLE OF BAPISDTEXT,
LS_TEXT TYPE BAPISDTEXT,
LS_BAPE_VBAK TYPE BAPE_VBAK,
LS_BAPE_VBAKX TYPE BAPE_VBAKX,
LS_BAPE_VBAP TYPE BAPE_VBAP,
LS_BAPE_VBAPX TYPE BAPE_VBAPX,
LT_EXTENSIONIN TYPE TABLE OF BAPIPAREX,
LS_EXTENSIONIN TYPE BAPIPAREX,
LT_RETURN TYPE TABLE OF BAPIRET2,
LS_RETURN TYPE BAPIRET2,
LS_RETURN_INTF TYPE ZSDS_SO_RETURN.

DATA:LV_SO TYPE VBAK-VBELN, "销售订单号
LV_POSNR_INI TYPE VBAP-POSNR. "行号(空值 仅作参数 不赋值)

DATA: LT_KOMV TYPE STANDARD TABLE OF KOMV,
LS_KOMV TYPE KOMV.

CONSTANTS: CNS_MEMORY_ID TYPE CHAR20 VALUE ‘SALEORDER_MAINTAIN’,
CNS_BAPE_VBAK TYPE CHAR20 VALUE ‘BAPE_VBAK’,
CNS_BAPE_VBAP TYPE CHAR20 VALUE ‘BAPE_VBAP’,
CNS_BAPE_VBAKX TYPE CHAR20 VALUE ‘BAPE_VBAKX’,
CNS_BAPE_VBAPX TYPE CHAR20 VALUE ‘BAPE_VBAPX’.

CONSTANTS:CNS_HEAD_TDOBJECT TYPE TDOBJECT VALUE ‘VBBK’,
CNS_ITEM_TDOBJECT TYPE TDOBJECT VALUE ‘VBBP’,
CNS_TDID_01 TYPE TDID VALUE ‘0001’,
CNS_TDID_02 TYPE TDID VALUE ‘0002’,

        CNS_AUART_ZOR4    TYPE VBAK-AUART VALUE 'ZOR4', "配件CNS_AUART_ZOR5    TYPE VBAK-AUART VALUE 'ZOR5', "免费CNS_AUART_ZOR6    TYPE VBAK-AUART VALUE 'ZOR6', "服务CNS_AUART_ZOR7    TYPE VBAK-AUART VALUE 'ZOR7', "废料CNS_AUART_ZOR8    TYPE VBAK-AUART VALUE 'ZOR8', "有偿
  •        cns_auart_zor9    TYPE vbak-auart VALUE 'ZOR9'. "无偿CNS_KSCHL_ZR02    TYPE KSCHA VALUE 'ZR02',"手工条件类型CNS_KSCHL_ZR01    TYPE KSCHA VALUE 'ZR01',"条件类型CNS_KSCHL_ZK01    TYPE KSCHA VALUE 'ZK01'."条件类型
    

    LOOP AT IT_SOHEAD INTO DATA(LS_SOHEAD).
    CLEAR:LT_ITEM,LT_ITEMX,LT_SCH,LT_SCHX,LT_COND,LT_CONDX,LT_PARTS,LT_TEXT,LT_RETURN,LT_EXTENSIONIN,LS_EXTENSIONIN.
    "so head
    CLEAR:LS_HEADER,LS_HEADERX,LV_SO,LS_LOGIC_SWITCH.

    IF LS_SOHEAD-VBELN IS NOT INITIAL.
    PERFORM FRM_EXIT_ALPHA_INPUT USING LS_SOHEAD-VBELN CHANGING LS_SOHEAD-VBELN.
    ENDIF.
    LS_HEADER-DOC_TYPE = LS_SOHEAD-AUART. "销售凭证类型
    LS_HEADER-SALES_ORG = LS_SOHEAD-VKORG. "销售组织
    LS_HEADER-DISTR_CHAN = LS_SOHEAD-VTWEG. "分销渠道
    LS_HEADER-DIVISION = LS_SOHEAD-SPART. "产品组
    LS_HEADER-PURCH_NO_C = LS_SOHEAD-BSTKD. "客户参考
    LS_HEADER-REQ_DATE_H = LS_SOHEAD-KETDAT. "请求交货日期
    LS_HEADER-PMNTTRMS = LS_SOHEAD-ZTERM. "付款条款
    LS_HEADER-INCOTERMS1 = LS_SOHEAD-INCO1. "国际贸易条款
    LS_HEADER-INCOTERMS2 = LS_SOHEAD-INCO2_L. "国际贸易条款位置
    LS_HEADER-DOC_DATE = LS_SOHEAD-AUDAT. "凭证日期
    LS_HEADER-CURRENCY = LS_SOHEAD-WAERK. "凭证货币
    LS_HEADER-EXCHG_RATE = LS_SOHEAD-KURSK. "汇率
    IF LS_SOHEAD-BSTDK NE ‘’.
    LS_HEADER-PURCH_DATE = LS_SOHEAD-BSTDK. "客户参考日期
    LS_HEADERX-PURCH_DATE = ABAP_TRUE.
    ENDIF.

    IF LS_SOHEAD-AUART = CNS_AUART_ZOR5 OR LS_SOHEAD-AUART = CNS_AUART_ZOR8.
    LS_HEADER-ORD_REASON = LS_SOHEAD-AUGRU.
    ENDIF.
    LS_HEADER-CUST_GRP1 = LS_SOHEAD-KVGR1.
    LS_HEADER-CUST_GRP2 = LS_SOHEAD-KVGR2.
    LS_HEADER-CUST_GRP3 = LS_SOHEAD-KVGR3.
    LS_HEADER-VERSION = LS_SOHEAD-VSNMR_V. "跟单员
    LS_HEADER-PO_METHOD = LS_SOHEAD-BSARK. "采购订单类型

    LS_HEADERX-UPDATEFLAG = ZIF_BC_CONSTANTS=>GC_I."‘I’.
    LS_HEADERX-DOC_TYPE = ABAP_TRUE.
    LS_HEADERX-SALES_ORG = ABAP_TRUE.
    LS_HEADERX-DISTR_CHAN = ABAP_TRUE.
    LS_HEADERX-DIVISION = ABAP_TRUE.
    LS_HEADERX-PURCH_NO_C = ABAP_TRUE.
    LS_HEADERX-REQ_DATE_H = ABAP_TRUE.
    LS_HEADERX-PMNTTRMS = ABAP_TRUE.
    LS_HEADERX-INCOTERMS1 = ABAP_TRUE.
    LS_HEADERX-INCOTERMS2 = ABAP_TRUE.
    LS_HEADERX-DOC_DATE = ABAP_TRUE.
    LS_HEADERX-CURRENCY = ABAP_TRUE.
    LS_HEADERX-EXCHG_RATE = ABAP_TRUE.

    IF LS_SOHEAD-AUART = CNS_AUART_ZOR5 OR LS_SOHEAD-AUART = CNS_AUART_ZOR8.
    LS_HEADERX-ORD_REASON = ABAP_TRUE.
    ENDIF.
    LS_HEADERX-CUST_GRP1 = ABAP_TRUE.
    LS_HEADERX-CUST_GRP2 = ABAP_TRUE.
    LS_HEADERX-CUST_GRP3 = ABAP_TRUE.
    LS_HEADERX-VERSION = ABAP_TRUE. "版本
    LS_HEADERX-PO_METHOD = ABAP_TRUE. "采购订单类型

    LOOP AT IT_SOITEM INTO DATA(LS_SOITEM) WHERE BUSID = LS_SOHEAD-BUSID.
    "so item
    CLEAR:LS_ITEM,LS_ITEMX.
    LS_ITEM-ITM_NUMBER = LS_SOITEM-POSNR."lv_count.
    PERFORM FRM_EXIT_MATN1_INPUT USING LS_SOITEM-MATNR CHANGING LS_SOITEM-MATNR.
    LS_ITEM-MATERIAL = LS_SOITEM-MATNR. "物料
    LS_ITEM-PLANT = LS_SOITEM-WERKS. "工厂
    LS_ITEM-SHORT_TEXT = LS_SOITEM-ARKTX. "项目描述
    LS_ITEM-ITEM_CATEG = LS_SOITEM-PSTYV. "项目类别
    LS_ITEM-TARGET_QTY = LS_SOITEM-KWMENG. "数量
    PERFORM FRM_MAT_MEINS_INPUT USING LS_SOITEM-VRKME CHANGING LS_SOITEM-VRKME.
    LS_ITEM-TARGET_QU = LS_SOITEM-VRKME. "单位
    LS_ITEM-PO_ITM_NO = LS_SOITEM-POSEX. "规格
    LS_ITEM-REF_1 = LS_SOITEM-IHREZ. "客户参考(单位)
    APPEND LS_ITEM TO LT_ITEM.

    LS_ITEMX-ITM_NUMBER = LS_SOITEM-POSNR."lv_count.
    LS_ITEMX-UPDATEFLAG = ZIF_BC_CONSTANTS=>GC_I."'I'.
    LS_ITEMX-MATERIAL   = ABAP_TRUE.
    LS_ITEMX-PLANT      = ABAP_TRUE.
    LS_ITEMX-SHORT_TEXT = ABAP_TRUE.
    LS_ITEMX-ITEM_CATEG = ABAP_TRUE.
    LS_ITEMX-TARGET_QTY = ABAP_TRUE.
    LS_ITEMX-TARGET_QU  = ABAP_TRUE.
    LS_ITEMX-PO_ITM_NO  = ABAP_TRUE.
    LS_ITEMX-REF_1      = ABAP_TRUE.
    APPEND LS_ITEMX TO LT_ITEMX."schedule line
    CLEAR:LS_SCH,LS_SCHX.
    LS_SCH-ITM_NUMBER = LS_SOITEM-POSNR."lv_count.
    LS_SCH-SCHED_LINE = 1.
    LS_SCH-REQ_DATE   = LS_SOITEM-ETDAT.
    LS_SCH-REQ_QTY    = LS_SOITEM-KWMENG.
    LS_SCH-SCHED_TYPE = LS_SOITEM-ETTYP.    "计划行类别
    APPEND LS_SCH TO LT_SCH.LS_SCHX-ITM_NUMBER = LS_SOITEM-POSNR."lv_count.
    LS_SCHX-UPDATEFLAG = ZIF_BC_CONSTANTS=>GC_I."'I'.
    LS_SCHX-SCHED_LINE = 1.
    LS_SCHX-REQ_DATE   = ABAP_TRUE.
    LS_SCHX-REQ_QTY    = ABAP_TRUE.
    LS_SCHX-SCHED_TYPE = ABAP_TRUE.
    APPEND LS_SCHX TO LT_SCHX.
    

**定价 配件-ZOR4 服务类–ZOR6 废料–ZOR7 有偿–ZOR8 ——价格手工输入
-----moidfy by amy 20230423 配件类改为价格自动带出 begin---------
IF
" ls_sohead-auart = cns_auart_zor4 OR
LS_SOHEAD-AUART = CNS_AUART_ZOR6 OR
LS_SOHEAD-AUART = CNS_AUART_ZOR7 OR
LS_SOHEAD-AUART = CNS_AUART_ZOR8.
"ZR02条件类型为手工输入
"Condition line
CLEAR:LS_COND,LS_CONDX.
LS_COND-ITM_NUMBER = LS_SOITEM-POSNR.“lv_count.
LS_COND-COND_TYPE = CNS_KSCHL_ZR02.”'ZR02.
LS_COND-COND_VALUE = LS_SOITEM-KBETR. "单价
LS_COND-COND_UNIT = LS_SOITEM-VRKME .
LS_COND-COND_P_UNT = LS_SOITEM-PEINH .
LS_COND-CURRENCY = LS_SOHEAD-WAERK. "销售凭证货币
APPEND LS_COND TO LT_COND.

    LS_CONDX-ITM_NUMBER = LS_SOITEM-POSNR."lv_count.LS_CONDX-COND_TYPE  = CNS_KSCHL_ZR02."'ZR02LS_CONDX-COND_VALUE = ABAP_TRUE. "单价(条件金额)LS_CONDX-COND_UNIT  = ABAP_TRUE .LS_CONDX-COND_P_UNT = ABAP_TRUE .LS_CONDX-CURRENCY   = ABAP_TRUE.   "销售凭证货币APPEND LS_CONDX TO LT_CONDX.

-----moidfy by amy 20230423 配件类改为价格自动带出 end---------
ELSE.
"ZK01为折扣价
IF LS_SOHEAD-AUART <> CNS_AUART_ZOR5.
"Condition line
CLEAR:LS_COND,LS_CONDX.
LS_COND-ITM_NUMBER = LS_SOITEM-POSNR.“lv_count.
LS_COND-COND_TYPE = CNS_KSCHL_ZK01.”'ZK01.

  •      LS_COND-COND_VALUE = 1."LS_SOITEM-KBETR. "单价
    
  •      LS_COND-COND_UNIT  = 'ST' .
    
  •      LS_COND-COND_P_UNT = 100 .LS_COND-CONDVALUE  = LS_SOITEM-KBETR. "LS_COND-CURRENCY   = LS_SOHEAD-WAERK.   "销售凭证货币LS_COND-CURRENCY_2 = LS_SOHEAD-WAERK.   "销售凭证货币APPEND LS_COND TO LT_COND.LS_CONDX-ITM_NUMBER = LS_SOITEM-POSNR."lv_count.LS_CONDX-UPDATEFLAG = ZIF_BC_CONSTANTS=>GC_I .LS_CONDX-COND_TYPE  = CNS_KSCHL_ZK01."'ZK01'.
    
  •      LS_CONDX-COND_VALUE = ABAP_TRUE. "单价(条件金额)
    
  •      LS_CONDX-COND_UNIT   = ABAP_TRUE.
    
  •      LS_CONDX-COND_P_UNT  = ABAP_TRUE.LS_CONDX-CURRENCY   = ABAP_TRUE.   "销售凭证货币APPEND LS_CONDX TO LT_CONDX.ENDIF.
    ENDIF."item text
    "--备注
    CLEAR:LT_TEXT_TMP.
    PERFORM FRM_MAINTAIN_TEXT USING LS_SOHEAD-VBELN LS_SOITEM-POSNR CNS_TDID_01 LS_SOITEM-ZTEXT_I CHANGING LT_TEXT_TMP.
    APPEND LINES OF LT_TEXT_TMP TO LT_TEXT."行项目增强:
    CLEAR: LS_BAPE_VBAP,LS_BAPE_VBAPX.
    LS_BAPE_VBAP-POSNR    = LS_SOITEM-POSNR.
    LS_BAPE_VBAPX-POSNR   = LS_SOITEM-POSNR.
    LS_BAPE_VBAP-ZZSEPCT  = LS_SOITEM-ZZSEPCT.
    LS_BAPE_VBAPX-ZZSEPCT = ABAP_TRUE.
    MOVE CNS_BAPE_VBAP TO LS_EXTENSIONIN-STRUCTURE.
    ##ENH_OK   MOVE LS_BAPE_VBAP TO LS_EXTENSIONIN-VALUEPART1.
    APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN.
    CLEAR LS_EXTENSIONIN.MOVE CNS_BAPE_VBAPX TO LS_EXTENSIONIN-STRUCTURE.
    ##ENH_OK   MOVE LS_BAPE_VBAPX TO LS_EXTENSIONIN-VALUEPART1.
    APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN.
    

    ENDLOOP.

    "head text
    "–海关文件备注
    CLEAR:LT_TEXT_TMP.
    PERFORM FRM_MAINTAIN_TEXT USING LS_SOHEAD-VBELN LV_POSNR_INI CNS_TDID_01 LS_SOHEAD-ZTEXT_H1 CHANGING LT_TEXT_TMP.
    APPEND LINES OF LT_TEXT_TMP TO LT_TEXT.

    "–生产备注
    CLEAR:LT_TEXT_TMP.
    PERFORM FRM_MAINTAIN_TEXT USING LS_SOHEAD-VBELN LV_POSNR_INI CNS_TDID_02 LS_SOHEAD-ZTEXT_H2 CHANGING LT_TEXT_TMP.
    APPEND LINES OF LT_TEXT_TMP TO LT_TEXT.

    “partners
    CLEAR:LS_PARTS.
    LS_PARTS-PARTN_ROLE = CNS_ROLE_SELL.”‘AG’.
    LS_PARTS-PARTN_NUMB = LS_SOHEAD-ZROLE_SELL. "售达方
    PERFORM FRM_EXIT_ALPHA_INPUT USING LS_PARTS-PARTN_NUMB CHANGING LS_PARTS-PARTN_NUMB.
    APPEND LS_PARTS TO LT_PARTS.

    CLEAR:LS_PARTS.
    LS_PARTS-PARTN_ROLE = CNS_ROLE_RECEV."‘RE’.
    LS_PARTS-PARTN_NUMB = LS_SOHEAD-ZROLE_RECEV. "收票方
    PERFORM FRM_EXIT_ALPHA_INPUT USING LS_PARTS-PARTN_NUMB CHANGING LS_PARTS-PARTN_NUMB.
    APPEND LS_PARTS TO LT_PARTS.

    CLEAR:LS_PARTS.
    LS_PARTS-PARTN_ROLE = CNS_ROLE_PAY."‘RG’.
    LS_PARTS-PARTN_NUMB = LS_SOHEAD-ZROLE_PAY. "付款方
    PERFORM FRM_EXIT_ALPHA_INPUT USING LS_PARTS-PARTN_NUMB CHANGING LS_PARTS-PARTN_NUMB.
    APPEND LS_PARTS TO LT_PARTS.

    CLEAR:LS_PARTS.
    LS_PARTS-PARTN_ROLE = CNS_ROLE_DELIV."‘WE’.
    LS_PARTS-PARTN_NUMB = LS_SOHEAD-ZROLE_DELIV. "送达方
    PERFORM FRM_EXIT_ALPHA_INPUT USING LS_PARTS-PARTN_NUMB CHANGING LS_PARTS-PARTN_NUMB.
    APPEND LS_PARTS TO LT_PARTS.

**抬头增强字段写入
"Fill item level self-defined fields

  • extension BAPE_VBAP
    

    CLEAR: LS_BAPE_VBAK,LS_BAPE_VBAKX.
    LS_BAPE_VBAK-ZZBRAN1 = LS_SOHEAD-ZZBRAN1.
    LS_BAPE_VBAK-ZZBRAN2 = LS_SOHEAD-ZZBRAN2.
    LS_BAPE_VBAK-ZZBRAN3 = LS_SOHEAD-ZZBRAN3.
    LS_BAPE_VBAK-ZZDJHH = LS_SOHEAD-ZZDJHH.
    LS_BAPE_VBAK-ZZSFKKP = LS_SOHEAD-ZZSFKKP.
    LS_BAPE_VBAK-ZZISDELV = ‘0’."SO创建 是否发货字段给默认0

    MOVE CNS_BAPE_VBAK TO LS_EXTENSIONIN-STRUCTURE.
    CALL METHOD CL_ABAP_CONTAINER_UTILITIES=>FILL_CONTAINER_C
    EXPORTING
    IM_VALUE = LS_BAPE_VBAK
    IMPORTING
    EX_CONTAINER = LS_EXTENSIONIN+30.
    APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN.
    CLEAR LS_EXTENSIONIN.

    LS_BAPE_VBAKX-ZZBRAN1 = ABAP_TRUE.
    LS_BAPE_VBAKX-ZZBRAN2 = ABAP_TRUE.
    LS_BAPE_VBAKX-ZZBRAN3 = ABAP_TRUE.
    LS_BAPE_VBAKX-ZZDJHH = ABAP_TRUE .
    LS_BAPE_VBAKX-ZZSFKKP = ABAP_TRUE .
    LS_BAPE_VBAKX-ZZISDELV = ABAP_TRUE.

    MOVE CNS_BAPE_VBAKX TO LS_EXTENSIONIN-STRUCTURE.
    ##ENH_OK MOVE LS_BAPE_VBAKX TO LS_EXTENSIONIN-VALUEPART1.
    APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN.
    CLEAR LS_EXTENSIONIN.

    LS_LOGIC_SWITCH-PRICING = ZIF_BC_CONSTANTS=>GC_C .

    IF LS_SOHEAD-AUART = ‘ZRE1’ OR LS_SOHEAD-AUART = ‘ZRE2’
    OR LS_SOHEAD-AUART = ‘ZRE3’ OR LS_SOHEAD-AUART = ‘ZRE4’ OR LS_SOHEAD-AUART = ‘ZRE5’
    OR LS_SOHEAD-AUART = ‘ZRE6’ OR LS_SOHEAD-AUART = ‘ZRE7’ OR LS_SOHEAD-AUART = ‘ZCR1’.

    CALL FUNCTION ‘BAPI_CUSTOMERRETURN_CREATE’
    EXPORTING
    SALESDOCUMENTIN = LS_SOHEAD-VBELN
    RETURN_HEADER_IN = LS_HEADER
    RETURN_HEADER_INX = LS_HEADERX
    LOGIC_SWITCH = LS_LOGIC_SWITCH
    TESTRUN = LS_SOHEAD-TESTRUN
    IMPORTING
    SALESDOCUMENT = LV_SO
    TABLES
    RETURN = LT_RETURN
    RETURN_ITEMS_IN = LT_ITEM
    RETURN_ITEMS_INX = LT_ITEMX
    RETURN_PARTNERS = LT_PARTS
    RETURN_SCHEDULES_IN = LT_SCH
    RETURN_SCHEDULES_INX = LT_SCHX
    RETURN_CONDITIONS_IN = LT_COND
    EXTENSIONIN = LT_EXTENSIONIN
    RETURN_TEXT = LT_TEXT.

    ELSE.

    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
    EXPORTINGSALESDOCUMENTIN      = LS_SOHEAD-VBELNORDER_HEADER_IN      = LS_HEADERORDER_HEADER_INX     = LS_HEADERXLOGIC_SWITCH         = LS_LOGIC_SWITCHTESTRUN              = LS_SOHEAD-TESTRUN
    IMPORTINGSALESDOCUMENT        = LV_SO
    TABLESRETURN               = LT_RETURNORDER_ITEMS_IN       = LT_ITEMORDER_ITEMS_INX      = LT_ITEMXORDER_PARTNERS       = LT_PARTSORDER_SCHEDULES_IN   = LT_SCHORDER_SCHEDULES_INX  = LT_SCHXORDER_CONDITIONS_IN  = LT_CONDORDER_CONDITIONS_INX = LT_CONDXORDER_TEXT           = LT_TEXTEXTENSIONIN          = LT_EXTENSIONIN.
    

    ENDIF.

    CLEAR: LS_RETURN_INTF-MSGTXT .
    LOOP AT LT_RETURN ASSIGNING FIELD-SYMBOL(<LFS_RETURN>) WHERE TYPE CA ZIF_BC_CONSTANTS=>GC_AEX .
    CONCATENATE LS_RETURN_INTF-MSGTXT <LFS_RETURN>-MESSAGE INTO LS_RETURN_INTF-MSGTXT SEPARATED BY ZIF_BC_CONSTANTS=>GC_SEPARATOR .
    ENDLOOP.

    IF SY-SUBRC = 0 OR LS_SOHEAD-TESTRUN = ABAP_TRUE.
    CALL FUNCTION ‘BAPI_TRANSACTION_ROLLBACK’.

    LS_RETURN_INTF-BUSID  = LS_SOHEAD-BUSID.
    IF LS_RETURN_INTF-MSGTXT IS NOT INITIAL .LS_RETURN_INTF-STATUS = ZIF_BC_CONSTANTS=>GC_E .
    ELSE.LS_RETURN_INTF-STATUS = ZIF_BC_CONSTANTS=>GC_S .LS_RETURN_INTF-MSGTXT = TEXT-004 .
    ENDIF.CLEAR: LT_KOMV[] .
    IMPORT XKOMV = LT_KOMV FROM MEMORY ID CNS_MEMORY_ID .
    DELETE FROM MEMORY ID CNS_MEMORY_ID .LOOP AT LT_KOMV INTO LS_KOMV .APPEND INITIAL LINE TO LS_RETURN_INTF-PRICE ASSIGNING FIELD-SYMBOL(<LFS_PRICE>) .<LFS_PRICE>-POSNR = LS_KOMV-KPOSN.<LFS_PRICE>-KSCHL = LS_KOMV-KSCHL.<LFS_PRICE>-KBETR = LS_KOMV-KBETR .<LFS_PRICE>-WAERS = LS_KOMV-WAERS.<LFS_PRICE>-KPEIN = LS_KOMV-KPEIN.<LFS_PRICE>-KMEIN = LS_KOMV-KMEIN.PERFORM FRM_MAT_MEINS_OUTPUT USING <LFS_PRICE>-KMEIN CHANGING <LFS_PRICE>-KMEIN .
    ENDLOOP.
    APPEND LS_RETURN_INTF TO ET_RETURN.
    

    ELSE. "SO创建成功

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGWAIT = ZIF_BC_CONSTANTS=>GC_X. "'X'.LS_RETURN_INTF-BUSID  = LS_SOHEAD-BUSID.
    LS_RETURN_INTF-VBELN  = LV_SO.
    LS_RETURN_INTF-STATUS = ZIF_BC_CONSTANTS=>GC_S.
    LS_RETURN_INTF-MSGTXT = TEXT-001.
    APPEND LS_RETURN_INTF TO ET_RETURN.
    

    ENDIF.

    ENDLOOP.

ENDFUNCTION.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/164602.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【FastCAE源码阅读5】使用VTK实现鼠标拾取对象并高亮

鼠标拾取对象是很多软件的基本功能。FastCAE的拾取比较简单&#xff0c;是通过VTK实现的。 对几何而言&#xff0c;拾取类型切换在工具栏上&#xff0c;单击后再来单击视图区对象进行拾取&#xff0c;拾取后的对象会高亮显示。效果如下图&#xff1a; 一、拾取对象 拾取对象…

京东数据分析:2023年9月京东打印机行业品牌销售排行榜

鲸参谋监测的京东平台9月份打印机市场销售数据已出炉&#xff01; 鲸参谋数据显示&#xff0c;今年9月&#xff0c;京东平台打印机的销量为60万&#xff0c;环比增长约32%&#xff0c;同比下滑约25%&#xff1b;销售额为5亿&#xff0c;环比增长约35%&#xff0c;同比下滑约29%…

Spark 基础知识点

Spark 基础 本文来自 B站 黑马程序员 - Spark教程 &#xff1a;原地址 什么是Spark 什么是Spark 1.1 定义&#xff1a;Apache Spark是用于大规模数据&#xff08;large-scala data&#xff09;处理的统一&#xff08;unified&#xff09;分析引擎 Spark最早源于一篇论文 Re…

MySQL第八讲·如何进行数学计算、字符串处理和条件判断?

你好&#xff0c;我是安然无虞。 文章目录 如何进行数学计算、字符串处理和条件判断&#xff1f;数学函数字符串函数条件判断函数总结 如何进行数学计算、字符串处理和条件判断&#xff1f; MySQL 提供了很多功能强大&#xff0c;而且使用起来非常方便的函数&#xff0c;包括…

「掌握创意,释放想象」——Photoshop 2023,你的无限可能!

Adobe Photoshop 2023(PS2023) 来了,全世界数以百万计的设计师、摄影师和艺术家使用 Photoshop 将不可能变为可能。从海报到包装&#xff0c;从基本的横幅到漂亮的网站&#xff0c;从令人难忘的徽标到引人注目的图标&#xff0c;Photoshop 2023让创意世界不断前进。借助直观的工…

C语言编写一个程序采集招聘信息

因为在这里无法详细解释每行代码和步骤。但是&#xff0c;我可以给大家一个使用Python和requests库编写的简单爬虫程序的例子&#xff0c;它可以从网站上获取招聘信息。你可以根据这个例子&#xff0c;将其改写为使用C语言编写的爬虫程序。 import requests# 指定爬虫IP信息 pr…

visual studio Python 配置QGIS(qgis)教程

visual studio Python 配置QGIS&#xff08;qgis&#xff09;教程 这个教程全网独一份啊&#xff0c;博主是自己摸索出来的。 visual studio Python 配置QGIS&#xff08;qgis&#xff09;环境一共分为两部&#xff1a; 第一步安装QGIS&#xff1a; 下载链接如下 https://www…

apachesolr启动带调试

这里solr.cmd报错&#xff0c;报错原因是java版本问题&#xff0c;后面发现这是因为多个java版本导致读取java_home失败&#xff0c; 那么我们修改solr.cmd中的JAVA_HOME为SOLR_JAVA_HOME IF DEFINED SOLR_JAVA_HOME set "JAVA_HOME%SOLR_JAVA_HOME%"环境变量将SOLR…

thinkphp的路径参数(RESTFul风格),把参数写在路径里

thinkphp官方文档 https://www.kancloud.cn/manual/thinkphp5_1/353969 有一个Blog控制器&#xff0c;里面的read方法是固定的&#xff0c;不能该 route.php里添加如下代码&#xff0c;访问 blog对应的就是 android/blog Route::resource(blog,android/blog);然后访问路径

flutter笔记:骨架化加载器

flutter笔记 骨架化加载器 - 文章信息 - Author: Jack Lee (jcLee95) Visit me at: https://jclee95.blog.csdn.netEmail: 291148484163.com. Shenzhen ChinaAddress of this article:https://blog.csdn.net/qq_28550263/article/details/134224135 【介绍】&#xff1a;本文介…

云南省各民族非遗巡演活动走进北京,奏响非遗传承乐章

云南&#xff0c;一个拥有丰富民族文化的边陲省份&#xff0c;各族人民在这片土地上创造了独具特色的民间艺术和非物质文化遗产。近日&#xff0c;以“边疆民族心向党 同心共圆中国梦”为主题的 2023 年云南省各民族非遗巡演活动走进北京专场顺利闭幕。来自西双版纳州、大理州、…

ZZ038 物联网应用与服务赛题第I套

2023年全国职业院校技能大赛 中职组 物联网应用与服务 任 务 书 &#xff08;I卷&#xff09; 赛位号&#xff1a;______________ 竞赛须知 一、注意事项 1.检查硬件设备、电脑设备是否正常。检查竞赛所需的各项设备、软件和竞赛材料等; 2.竞赛任务中所使用的各类软件工…