Q: create New Sales Order using BAPI: BAPI_SALESORDER_CREATEFROMDAT2, but get the error message:Unpermitted combination of business object BUS2032 and sales doc. category H.
A:This is a shortcoming of this BAPI. If you look into the coding you will see that it call SD_SALESORDER_CREATE with restriction to business object 'BUS2032'.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
...
BUSINESS_OBJECT = 'BUS2032'
...
Now if you look into SD_SALESORDER_CREATE you will find the following routine call where the function module checks the valid combination of business object and sales document type (DOC_TYPE):
*
if business_object ne space.
perform i_check_type tables return
using sales_header_in
business_object.
endif.
*
if not return is initial.
exit.
endif.
In the routine you will find the function module that makes the check:
...
* 3. determine the businessobject *
CALL FUNCTION 'SD_OBJECT_TYPE_DETERMINE'
EXPORTING
I_DOCUMENT_TYPE = TVAK-VBTYP
IMPORTING
E_BUSINESS_OBJECT = US_OBJTYPE
EXCEPTIONS
OTHERS = 1.
IF US_OBJTYPE NE BUSINESS_OBJECT.
PERFORM ERROR_PROCESSING TABLES US_RETURN
USING 'E'
'V1'
'761'
BUSINESS_OBJECT
TVAK-VBTYP
SPACE
SPACE.
ENDIF.
ENDFORM.
If you call this function module with I_DOCUMENT_TYPE = 'H' it will return 'BUS2102' as allowed business object.
To overcome the problem with BAPI_SALESORDER_CREATEFROMDAT2 simply call the (RFC-enabled) function module <b>SD_SALESORDER_CREATE directly.</b>. Leave the IMPORTING parameter BUSINESS_OBJECT empty since it it optional.
Unpermitted combination of business object BUS2032 and sales doc. category H
猜你喜欢
转载自wabaper.iteye.com/blog/1775694
今日推荐
周排行