cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_ALM_ORDER_MAINTAIN - Delete component

fajarnrm
Explorer
0 Likes
1,735

Hello Everyone,

i try to create RFC delete maintenance order using BAPI_ALM_ORDER_MAINTENANCE, but i got error "Operation number does not exist (check entry)". what is missing from my code?

my code:

FUNCTION ZFM_CHANGE_ORDER.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(NO_ORDER) TYPE AUFNR OPTIONAL
*" VALUE(NO_ITEM) TYPE RSPOS OPTIONAL
*" VALUE(NO_MATERIAL) TYPE MATNR OPTIONAL
*" TABLES
*" GT_ADD_COMPONENTS STRUCTURE ZST_COMPONENTS_CO OPTIONAL
*" GT_EDIT_COMPONENTS STRUCTURE ZST_COMPONENTS_CO OPTIONAL
*"----------------------------------------------------------------------
DATA: it_methods TYPE STANDARD TABLE OF bapi_alm_order_method,
it_header TYPE STANDARD TABLE OF bapi_alm_order_headers_i WITH HEADER LINE,
wa_header LIKE LINE OF it_header,
it_header_up TYPE STANDARD TABLE OF bapi_alm_order_headers_up,
wa_header_up LIKE LINE OF it_header_up,
wa_methods LIKE LINE OF it_methods,
et_numbers TYPE STANDARD TABLE OF bapi_alm_numbers,
wa_numbers LIKE LINE OF et_numbers,
return TYPE STANDARD TABLE OF bapiret2,
it_operation type bapi_alm_order_operation occurs 0 with header line,
it_component type bapi_alm_order_component occurs 0 with header line,
wa_component LIKE LINE OF it_component,
wa_return LIKE LINE OF return.

CLEAR wa_methods.
wa_methods-refnumber = '000001'.
wa_methods-objecttype = 'COMPONENT'.
wa_methods-method = 'DELETE'.
CONCATENATE NO_ORDER NO_ITEM INTO wa_methods-objectkey.
APPEND wa_methods TO it_methods.

CLEAR wa_methods.
wa_methods-refnumber = '000001'.
wa_methods-objecttype = ''.
wa_methods-method = 'SAVE'.
CONCATENATE NO_ORDER NO_ITEM INTO wa_methods-objectkey.
APPEND wa_methods TO it_methods.

it_component-res_item = '0010'.
APPEND it_component.

it_operation-ACTIVITY = '0010'.
APPEND it_operation.

it_header-orderid = no_order.
APPEND it_header.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = it_methods
it_operation = it_operation
it_component = it_component
it_header = it_header
return = return
et_numbers = et_numbers.

ENDFUNCTION.

The suggestions or answers you gave really helped me 🙂

Accepted Solutions (1)

Accepted Solutions (1)

fajarnrm
Explorer

i found solution for this issue, if you have some issue about change/delete/add operations or components with bapi_alm_order_maintain, contact me in this forum 🙂

Balakrishna8
Discoverer
0 Likes
Hi .May i know how you did this

Answers (1)

Answers (1)

RaymondGiuseppi
Active Contributor

Execute a small test with SE37 on BAPI_ALM_ORDER_GET_DETAIL to check actual values of Operation Number returned by the BAPI.

fajarnrm
Explorer
0 Likes

thanks for answer, is helpful for found solution 🙂