1

I would like to use the BAPI BAPI_ALM_ORDER_MAINTAIN() in order to create a work order and assign an existing notification to it. The following does not work:

ls_methods-refnumber = 1.
ls_methods-objecttype = 'HEADER'.
ls_methods-method = 'CREATE'.
ls_methods-objectkey = '%00000000001'.
APPEND ls_methods TO lt_methods.

ls_methods-refnumber = 1.
ls_methods-method = 'SAVE'.
ls_methods-objecttype = ''.
ls_methods-objectkey = '%00000000001'.
APPEND ls_methods TO lt_methods.

ls_methods-refnumber = 1.
ls_methods-objecttype = 'OBJECTLIST'.
ls_methods-method = 'CREATE'.
ls_methods-objectkey = '%00000000001'.
APPEND ls_methods TO lt_methods.

ls_header-order_type = 'PMA1'.
ls_header-notif_no = '000000001387'.
APPEND ls_header TO lt_header.

ls_header_up-orderid = 'X'.
ls_header_up-notif_no = 'X' .
APPEND ls_header_up TO lt_header_up.

ls_object_list-notif_no = '000000001387'.
APPEND ls_object_list TO lt_object_list.

ls_object_list_up-processing_ind = 'X'.
APPEND ls_object_list_up TO lt_object_list_up.


CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
  TABLES
    it_methods       = lt_methods
    it_header        = lt_header
    it_header_up     = lt_header_up
    it_objectlist    = lt_object_list
    it_objectlist_up = lt_object_list_up
    return           = lt_return.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

lt_return contains:

 - IW          004   Enter a plant
 - IGRAPH      803   Enter work center
 - IWO_BAPI2   113   Error  during processing of BAPI methods

After entering a plant and a work center, lt_return contains:

 - Order %00000000001 cannot be saved, since no operation is maintained
 - Error  during processing of BAPI methods

Rather than entering all this information, I only want to create a work order with order type and assign an existing notification to it. Is this possible? If yes can someone please provide a code snippet? I don't want to pass a plant, work center, etc.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
paolo
  • 97
  • 3
  • 10

0 Answers0