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: 

Deleting user status for PM workorder

0 Kudos
294

We are trying to delete user status for a PM workorder using BAPI i.e 'BAPI_ALM_ORDER_MAINTAIN'. The code for calling the BAPI is as below:

DATA: lt_methods TYPE TABLE OF bapi_alm_order_method.
DATA: ls_methods LIKE LINE OF lt_methods.
DATA: lt_return TYPE TABLE OF bapiret2.
DATA: lv_workorder TYPE aufnr.
DATA: lt_userstatus TYPE TABLE OF BAPI_ALM_ORDER_USRSTAT.
DATA: ls_userstatus LIKE LINE OF lt_userstatus.

ls_userstatus-change_event = '02'.
ls_userstatus-langu = 'EN'.
ls_userstatus-langu_iso = 'EN'.
ls_userstatus-user_st_text = 'CAFE'.
ls_userstatus-inactive = 'X'.

APPEND ls_userstatus to lt_userstatus.

ls_methods-method = 'SAVE'.
ls_methods-objectkey = '000004003075'.
ls_methods-objecttype = ''.
ls_methods-refnumber = '000001'.
APPEND ls_methods TO lt_methods.
CLEAR ls_methods.

ls_methods-method = 'DELETE'.
ls_methods-objectkey = '000004003075'.
ls_methods-objecttype = 'USERSTATUS'.
ls_methods-refnumber = '000001'.
APPEND ls_methods TO lt_methods.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
* EXPORTING
* IV_MMSRV_EXTERNAL_MAINTENACE =
TABLES
it_methods = lt_methods
it_userstatus = lt_userstatus
return = lt_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

In the return message we are getting an error. Attached the screenshot of the error message.

1 REPLY 1

p244500
Active Contributor
0 Kudos
86

Hi,

Just check this link its not answer, but you may get idea.