0
votes

I would like to assign a notification to a work order. The following does not work:

* Fill method structure
  ls_methods-refnumber = 1.
  ls_methods-method = 'SAVE'.
  APPEND ls_methods TO lt_methods.

  ls_methods-refnumber = 1.
  ls_methods-objecttype = 'OBJECTLIST'.
  ls_methods-method = 'CHANGE'.
  ls_methods-objectkey = '000480000020'.
  APPEND ls_methods TO lt_methods.

  ls_methods-refnumber = 1.
  ls_methods-objecttype = 'HEADER'.
  ls_methods-method = 'CHANGE'.
  ls_methods-objectkey = '000480000020'.
  APPEND ls_methods TO lt_methods.

  * Fill header structure
  ls_header-orderid = '000480000020'.
  ls_header-notif_no = '100000356980'.
  APPEND ls_header TO lt_header.

  * Fill header up structure
  ls_header_up-orderid = '000480000020'.
  ls_header_up-notif_no = '100000356980' .
  APPEND ls_header_up TO lt_header_up.

  * Fill object list structure
  ls_object_list-notif_no = '100000356980'.
  APPEND ls_object_list TO lt_object_list.

  * Fill object list up structure
  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 .

For OBJECTLIST I would actually need something like an 'ADD' method. Any ideas are appreciated.

1
What does it throw you in lt_return? - Suncatcher
"Notification 100000356980 is not in the object list" and "Error during processing of BAPI methods". This is clear to me and the reason why I wrote I need something like an 'ADD' method. If I remove the change method for the objectlist completely lt_return contains "Order 480000020 saved with notification 15" and "BAPI control was ended". Msg15 is the first entry in the object list, but actually two messages are already assigned and I want to add a third one. Although there is no error msg now, the third message is still not assigned. Also no clue if I need to use the header or objectlist. - paolo
Any news? I appreciate any ideas :-) - paolo

1 Answers

0
votes

The following works for me:

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

* Fill method structure
ls_methods-refnumber = 1.
ls_methods-method = 'SAVE'.
ls_methods-objecttype = ''.
ls_methods-objectkey = '000480000020'.
APPEND ls_methods TO lt_methods.


* Fill object list structure
ls_object_list-notif_no = '100000356980'.
APPEND ls_object_list TO lt_object_list.

* Fill object list up structure
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_objectlist    = lt_object_list
    it_objectlist_up = lt_object_list_up
    return           = lt_return.