cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign notification to work order through BAPI?

PaoloS
Advisor
Advisor
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

amy_king
Active Contributor
0 Kudos

Hi Paolo,

Update field ls_header_up-notif_no should be set to 'X' to indicate the notification number should be updated. In your code above, you have set this field to the notification number itself, and since that field is 1-character in length, its value is actually set to '1'.

Cheers,

Amy

PaoloS
Advisor
Advisor
0 Kudos

You are absolutely right, I already changed that but changes still take no effect. No error is thrown either 😞

amy_king
Active Contributor
0 Kudos

Hi Paolo,

At this point it may be helpful for Basis to run a trace. Maybe there is some silent error that isn't being reported through the BAPI. If that doesn't turn up anything, it may be worth opening an incident with SAP since it seems like the behavior doesn't match the BAPI's documentation.

Cheers,

Amy

PaoloS
Advisor
Advisor

Hi Amy,

Pls see the answer I posted. I used the object list now and got it up and running. Probably using the header was just wrong... happy that it works now.

Kind regards, Paolo