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: 

Change components and Routing of production order

Former Member
0 Kudos

Hi, experts, I have such requirement that change quantity of a component or add a component, add a operation into current routing.

I have look up answer, but can not find the right one.

BAPI_PRODORD_CHANGE only can change header data.

BAPI_ALM_ORDER_MAINTAIN seems can not change production orders, it is for service orders.

CO_XT_ORDER_CHANGE will assign a new routing number and a new bom number.

Could somebody give me some FM and BAPI for reference? Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

BAPI_ALM_ORDER_MAINTAIN : Can be used to change production orders also, i have used it.

Thanks & Regards,

Navneeth K.

16 REPLIES 16

Former Member
0 Kudos

Hi,

BAPI_ALM_ORDER_MAINTAIN : Can be used to change production orders also, i have used it.

Thanks & Regards,

Navneeth K.

0 Kudos

Hi, could you show me the source code, thanks.

0 Kudos

I will paste the source code give me some time.

0 Kudos

Hi, guy, do you forget?

0 Kudos

Hey Rick,

Even I'm stucked up with the same issue. Do let me know if you have found any solution. I'm trying out with the FM BAPI_ALM_ORDER_MAINTAIN to alter the components data. But being popped out with error messages.

Regards,

Naresh.

0 Kudos

I have no solution until now, I get error message 'Order type cannot be used for maintenance orders', I think production orders can not be processed by this BAPI, maybe we need to find another way to change component/routing of production order, for example BDC, but it has poor performance. Anyway, if i found any solution except BDC, i will show it.

0 Kudos

Rick,

we can process the Production Orders with the function module. I tested it and it seems to be working fine.

But, I'm unable to change the 'Requirement Quantity' of the components data. Though the FM is returning a Success message saying the Order has been saved but the quantity is not changing.

I'm debugging the FM now to see wats exactly happening.

You try it with other test cases.

Cheers!!!

Naresh

0 Kudos

Hi Rick,

Sorry for the delayed response, check this link :

http://www.sapfans.com/forums/viewtopic.php?f=13&t=182938

I have already worked on changing the component, component quantity and all using the bapi. Trying to put you the perfect code soon.

Mean time you can check the above link, it is for service orders but same will apply for the production orders also just be careful when you are giving the "Objectkey", to know how to put objectkey check the bapi documenation, its given in the best way.

Thanks & Regards,

Navneeth K.

0 Kudos

Hi Rick,

Have you found the solution ?

Thanks & Regards,

Navneeth K.

0 Kudos

Rick,

The function module works out. Call Bapi_transaction_commit immediately after calling the FM BAPI_ALM_ORDER_MAINTAIN.

Navneet, Thanks for your inputs. I have another query regarding this. Do we need to call the FM twice in order to change Muliple components data? Coz, when I try to change Two Components data of a Production Order, only the First component's data is being changed but the second one remains the same.

let me know your comments

Cheers!!!

Naresh

0 Kudos

Not yet, I still get the message ''Order type cannot be used for maintenance orders' despite I follow others' source code.

0 Kudos

Hi, Naresh, could you show your source code to me? Thanks in advance. I get error message, so i think it is no matter with Bapi_transaction_commit.

0 Kudos

Hi Rick,

Follow the below sample steps for changing component quantity:

DATA:
    l_methods TYPE bapi_alm_order_method,
    it_boperations TYPE STANDARD TABLE OF  bapi_alm_order_operation_e WITH HEADER LINE,
    it_components TYPE STANDARD TABLE OF bapi_alm_order_component_e WITH HEADER LINE,
    it_components1 TYPE STANDARD TABLE OF bapi_alm_order_component WITH HEADER LINE.

1. Call BAPI :BAPI_ALM_ORDER_GET_DETAIL , it will give existing order component details.

CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'
    EXPORTING
      number        = <production order number>
    TABLES
      et_operations = it_boperations
      et_components = it_components
      return        = it_bapiret2.

2. Move it_components to components table compatibel to BAPI "BAPI_ALM_ORDER_MAINTAIN".

LOOP AT it_components.
 MOVE-CORRESPONDING it_components TO it_components1.
_*"Note here while moving change the component quantity"*_
 APPEND it_components1.
 CLEAR it_components1.
 ENDLOOP.

3. Build the methods table for change production order :

it_methods-refnumber = v_refnumber.
            it_methods-objecttype = 'COMPONENT'.
            it_methods-method = 'CHANGE'.
            it_methods-objectkey = v_objectkey.
            APPEND it_methods.

"Note v_refnumber has 1 to 1 relation ship with the components table, if you want to change First component in it_components1 then you have to enter value '1' here for v_refnumber.

it_methods-method = 'SAVE'.
        APPEND it_methods.

4 . Call

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
          TABLES
            it_methods   = it_methods
            it_component = it_components1
            return       = it_bapiret2.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

0 Kudos

Naresh, we need not call the BAPI twice you can append all componments in the same table and make sure you populate methods table perfectly, it has a one to one relationship with the compoents and operation table

0 Kudos

Navneeth,

In the example given, if my requirement is to change the 1st and the last component in the table i_components1 then what should be the reference number v_ref ? and do I need to fillin the methods twice?

Naresh!!

Former Member
0 Kudos

HI,all, thanks for all of your replies, the bapi only can change the orders with order category = '30', but not '10.