BAPI_SALESORDER_CREATEFROMDAT2创建退货订单时,会出现以下错误:不允许业务对象 BUS2032
和销售凭证类别 H 的组合。
解决办法:
采用/原BAPI的内嵌BAPI:
SD_SALESDOCUMENT_CREATE来创建即可以。
* CASE GT_TVAK-VBTYP.
* WHEN ‘C‘.
* CALL FUNCTION ‘BAPI_SALESORDER_CREATEFROMDAT2‘
* EXPORTING
* ORDER_HEADER_IN = WA_HEADER
* TESTRUN = L_TEST
* IMPORTING
* SALESDOCUMENT = L_VBELN
* TABLES
* RETURN = L_RETURN
* ORDER_ITEMS_IN = LT_ITEM
* ORDER_PARTNERS = LT_PART
* ORDER_SCHEDULES_IN = LT_SCH
* ORDER_CONDITIONS_IN = LT_COND
* ORDER_CONDITIONS_INX = LT_CONDX
* ORDER_TEXT = LT_TEXT
* EXTENSIONIN = LT_EX.
*
* WHEN ‘H‘.
* CALL FUNCTION ‘BAPI_CUSTOMERRETURN_CREATE‘
* EXPORTING
* RETURN_HEADER_IN = WA_HEADER
* TESTRUN = L_TEST
* IMPORTING
* SALESDOCUMENT = L_VBELN
* TABLES
* RETURN = L_RETURN
* RETURN_ITEMS_IN = LT_ITEM
* RETURN_PARTNERS = LT_PART
* RETURN_SCHEDULES_IN = LT_SCH
* RETURN_TEXT = LT_TEXT
* RETURN_CONDITIONS_IN = LT_COND
* EXTENSIONIN = LT_EX.
* ENDCASE.