Below steps describe how to update subcontracting fields while creating purchase requisitions using bapi BAPI_PR_CREATE.
Bapi BAPI_PR_CREATE is used to create purchase requisition.But this bapi is not having any parameter to update subcontracting type. Here
we can pass values of subcontracting fields through extension table.
Pass AD_SUBCON_EBAN to extension table structure and move subcontracting type to value part.
* Default subcontracting type to 1
CLEAR LS_EXT_IN.
LS_EXT_IN-STRUCTURE = CL_ADSUB_CONSTANTS=>EXTIN_PR_STRUC.
CONCATENATE ‘00010’ ‘1’ INTOLS_EXT_IN-VALUEPART1.
APPEND LS_EXT_IN TO LT_EXT_IN.
Pass AD_SUBCON_EBANX to extension table structure and move X for subcontracting type to value part.
CLEAR LS_EXT_IN.
LS_EXT_IN-STRUCTURE = CL_ADSUB_CONSTANTS=>EXTIN_PR_STRUCX.
CONCATENATE ‘00010’ ‘X’ INTOLS_EXT_IN-VALUEPART1.
APPEND LS_EXT_IN TO LT_EXT_IN.
Note that structure AD_SUBCON_EBAN and AD_SUBCON_EBANX does not exist in data dictionary.