Skip to Content
0
Former Member
Sep 07, 2007 at 07:48 PM

BAPI_ALM_ORDER_MAINTAIN - Requisition not created on Nonstock component

390 Views

I am using the code below to try and create 2 nonstock components on an existing order 7201081 - which should create a purchase requisition. The 2 nonstock components are created on the order however the purchase requisition is not created.

I feel the Purchase requisition is not created due to the mrp_relevant flag in the bapi. The bapi's component table says that a value '3' for mrp_relevant should set the purchase requisition to 'Immediately' however it is not doing so - the nonstock component when passed a '3' is always set to 'From Release'.

Has anyone had this issue or know of a solution ? Has anyone been able to use this bapi to create a purchase requisition on a nonstock item ?

Thanks, Michelle

=======SOURCE CODE EXAMPLE ===========================

REPORT zbapi .

DATA t_meth TYPE TABLE OF bapi_alm_order_method.

DATA t_comp TYPE TABLE OF bapi_alm_order_component.

**Internal table for BAPI Return code

DATA t_ret TYPE TABLE OF bapiret2.

***WORK AREA DECLARATIONS

**Work Area for Hedaer

DATA:wa_header TYPE caufvdb,

wa_meth TYPE bapi_alm_order_method,

wa_op TYPE afvgb,

wa_comp TYPE resbb,

wa_comp1 TYPE bapi_alm_order_component,

wa_comp_up TYPE bapi_alm_order_component_up,

wa_oper TYPE bapi_alm_order_operation.

PARAMETERS:TEST.

****Fill Method Internal table

wa_meth-refnumber = '0000001'.

wa_meth-objecttype = 'COMPONENT'.

wa_meth-method = 'CREATE'.

wa_meth-objectkey(12) = '000007201081'.

wa_meth-objectkey+12(4) = '0100'.

APPEND wa_meth TO t_meth.

clear: wa_meth.

wa_meth-refnumber = '0000001'.

wa_meth-objecttype = 'COMPONENT'.

wa_meth-method = 'CREATE'.

wa_meth-objectkey(12) = '000007201081'.

wa_meth-objectkey+12(4) = '0100'.

APPEND wa_meth TO t_meth.

CLEAR wa_meth.

wa_meth-method = 'SAVE'.

APPEND wa_meth TO t_meth.

**Component Internal table

clear: wa_comp1.

wa_comp1-plant = 'PDEL'.

wa_comp1-item_Cat = 'N'.

wa_comp1-item_number = '1100'.

wa_comp1-activity = '0100'.

wa_comp1-price = '1.50'.

wa_comp1-price_unit = '1'.

wa_comp1-preq_name = 'ReqUser'.

wa_comp1-matl_desc = 'Test material 1'.

wa_comp1-requirement_quantity = '235.00'.

wa_comp1-requirement_quantity_unit = 'FT'.

wa_comp1-mrp_relevant = '3'.

APPEND wa_comp1 TO t_comp.

clear: wa_comp1.

wa_comp1-plant = 'PDEL'.

wa_comp1-item_Cat = 'N'.

wa_comp1-item_number = '1100'.

wa_comp1-activity = '0100'.

wa_comp1-price = '2.50'.

wa_comp1-price_unit = '1'.

wa_comp1-preq_name = 'ReqUser'.

wa_comp1-matl_desc = 'Test material 2'.

wa_comp1-requirement_quantity = '100.00'.

wa_comp1-requirement_quantity_unit = 'EA'.

wa_comp1-mrp_relevant = '3'.

APPEND wa_comp1 TO t_comp.

**Call Bapi

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

it_methods = t_meth

it_component = t_comp

return = t_ret.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.