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 for operation change in production order?

Former Member
0 Kudos
2,418

Hi there,

I want to change operation data in a production order and I can only find this BAPI:

BAPI_ALM_ORDER_MAINTAIN

Can this BAPI also be used for changing an production order? Because in the documentation of the BAPI this function isn't really mentioned...

Can you give me some hints or the name of another BAPI doing this task?

Kind regards

Max

1 ACCEPTED SOLUTION

Former Member
191

you can use this bapi , there is no other bapi's for Operation data

2 REPLIES 2

Former Member
192

you can use this bapi , there is no other bapi's for Operation data

0 Kudos
191

yep it can be used for that, the documentation for this bapi is ( very unusual for bapis I know ) available

call the bapi in se37. goto -> documentation

I don't have an example for changing orders and operations but I use it to copy serviceorders (only difference between serviceorder and production order is that you can enter a customer at serviceorders)

which are quite extensive with lot of operations and components and functional locations

here my example for creation. for change I believe you also have to fill the UP structures accordingly to what you want to update

kind regards

arthur

gs_meth-refnumber  = 1.
  gs_meth-objecttype = 'HEADER'.
  gs_meth-method     = 'CREATE'.
  gs_meth-objectkey  = c_init_ordid .
  append gs_meth to gt_meth.
  move-corresponding gs_meth to gs_ext.

  gs_meth-refnumber  = 1 .
  gs_meth-objecttype = 'PARTNER'.
  gs_meth-method     = 'CREATE'.
  gs_meth-objectkey  = c_init_ordid.
  append gs_meth to gt_meth.

  h_refnumber = 1.
  loop at gt_operations_i into gs_operations_i.
    concatenate c_init_ordid gs_operations_i-activity into gv_so_operation.
    gs_meth-refnumber  = h_refnumber.
    gs_meth-objecttype = 'OPERATION'.
    gs_meth-method     = 'CREATE'.
    gs_meth-objectkey  = gv_so_operation.
    append gs_meth to gt_meth.
    add 1 to h_refnumber.

  endloop.

  clear h_refnumber.
  loop at gt_components_i into gs_components_i.
    add 1 to h_refnumber.
    gs_meth-refnumber  = h_refnumber.
    gs_meth-objecttype = 'COMPONENT'.
    gs_meth-method     = 'CREATE'.
    concatenate c_init_ordid
                gs_components_i-activity
                gs_components_i-item_number
    into gs_meth-objectkey.
    append gs_meth to gt_meth.


  endloop.

  clear h_refnumber.
  loop at gt_texts into gs_texts.
    add 1 to h_refnumber.
    concatenate c_init_ordid gs_texts-activity into gv_so_operation.
    gs_meth-refnumber  = h_refnumber.
    gs_meth-objecttype = 'TEXT'.
    gs_meth-method     = 'CREATE'.
    gs_meth-objectkey  = gv_so_operation.
    append gs_meth to gt_meth.

  endloop.
* gebruikte objecten cq functieplaatsen
  clear h_refnumber.
  loop at gt_objectlist_i into gs_objectlist_i.
    add 1 to h_refnumber.
    gs_meth-refnumber  = h_refnumber.
    gs_meth-objecttype = 'OBJECTLIST'.
    gs_meth-method     = 'CREATE'.
    gs_meth-objectkey  = c_init_ordid.
    append gs_meth to gt_meth.
  endloop.

  clear h_refnumber.

if p_objrel = 'X' and gt_relation_i is not initial.
* koppeling functieplaats met operatie
* kunnen geen meervoudige koppelingen gemaakt worden in BAPI
* dus hier 1 koppeling maken en na BAPI de rest aanleggen

  read table gt_relation_i into gs_relation_i index 1.
  add 1 to h_refnumber.
  gs_meth-refnumber  = h_refnumber.
  gs_meth-objecttype = 'OLISTRELATION'.
  gs_meth-method     = 'CREATE'.
  gs_meth-objectkey  = c_init_ordid.
  append gs_meth to gt_meth.
endif.

  gs_meth-refnumber  = c_init_ordid.
  gs_meth-objecttype = space.
  gs_meth-method     = 'SAVE'.
  gs_meth-objectkey  = c_init_ordid.
  append gs_meth to gt_meth.


* BAPI-call
  refresh: gt_ret, gt_numbers.
  clear:   gt_ret, gt_numbers.


  call function 'BAPI_ALM_ORDER_MAINTAIN'
    destination 'NONE'                       " --> Zie note 770626 !
    tables
      it_methods             = gt_meth
      it_header              = gt_header_i
*       IT_HEADER_UP           =
*       IT_HEADER_SRV          =
*       IT_HEADER_SRV_UP       =
*       IT_USERSTATUS          =
      it_partner             = gt_partner_i
*       IT_PARTNER_UP          =
      it_operation           = gt_operations_i
*       IT_OPERATION_UP        =
*       IT_RELATION            =
*       IT_RELATION_UP         =
      it_component           = gt_components_i
*       IT_COMPONENT_UP        =
      it_objectlist           = gt_objectlist_i
      it_olist_relation       = gt_relation_i
      it_text                = gt_texts
      it_text_lines          = gt_text_lines
      extension_in           = gt_ext
      return                 = gt_ret
      et_numbers             = gt_numbers.


  call function 'BAPI_TRANSACTION_COMMIT'
    destination 'NONE'
    exporting
      wait          = 'X'
*         IMPORTING
*           RETURN        =
            .


*   Zie note 770626 ...
  call function 'RFC_CONNECTION_CLOSE'
    exporting
      destination                = 'NONE'
*       TASKNAME                   =
    exceptions
      destination_not_open       = 1
      others                     = 2
            .

Edited by: A. de Smidt on Feb 26, 2009 5:20 PM