Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_ALM_ORDER_MAINTAIN - Requisition not created on Nonstock component

Former Member
0 Kudos

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'.

4 REPLIES 4

Former Member
0 Kudos

Michelle,

There are three settings for the mrp relevant flag.

1) Never - Never create PR

2) Immediately - Creates PR as soon as order is created

3) On release. - creates on order release

I think setting the flag to 2 should help.

Thanks and Regards,

Srihari

0 Kudos

On BAPI_ALM_ORDER_MAINTAIN - when I look at table IT_COMPONENT (which is like BAPI_ALM_ORDER_COMPONENT) and I then look at MRP_RELEVANT field's data element of AUDISP_PLUS - it points to domain 'AUDISP' which has values:

1) Never

2) From Release

3) Immediately

This is the reason I've been passing value '3'.

I did try just a few minutes ago with mrp_relevant of '2' along with '1' and neither one of them create a purchase requisition for the nonstock component.

Michelle

0 Kudos

Sorry about that.

But are u able to create the components on the order ? If yes, Can you check if a PR is created on the standard transaction itself (IW32, just to ensure that there is no configuration restricting the creation of PR).

0 Kudos

Yes - the BAPI does create the non-stock components on the order - however the flag is set to 'From Release' instead of 'Immediately' and the purchase requisition is not created.

Yes - a Purchase requisition is created in the standard transaction IW32 for the non-stock components, and the flag is always set to 'Immediately'.

Yes - I also checked the configuration (path specified below) and for the order type/Plant the flag is set to 'Immediately'.

Configuration Path:

Plant Maintenance -> Maintenance and Service Processing -> Maintenance

and Service Orders -> Functions and Settings for Order Types ->

Define Change Docs, Collective Purc. Req. Indicator, Operation No.

Interval

Michelle