Application Development and Automation 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: 
Read only

BAPI_ALM_ORDER_MAINTAIN

Former Member
0 Likes
717

Hi Experts,

I am trying to use BAPI_ALM_ORDER_MAINTAIN to create Partner data in a service order.

It is giving error, "Order type T001 is not an investment order" Please let me know where I am going wrong.

Please find the core code as below.

wa_method-refnumber = '000001'.

wa_method-objecttype = 'HEADER'.

wa_method-method = 'CHANGE'.

wa_method-objectkey = '000076700030'.

APPEND wa_method TO gi_method.

CLEAR : wa_method.

wa_method-refnumber = '000001'.

wa_method-objecttype = 'PARTNER'.

wa_method-method = 'CREATE'.

wa_method-objectkey = '000076700030'.

APPEND wa_method TO gi_method.

CLEAR : wa_method.

wa_method-refnumber = '000001'.

wa_method-method = 'SAVE '.

wa_method-objectkey = '000076700030'.

APPEND wa_method TO gi_method.

CLEAR : wa_method.

The tables gi_header, gi_header, gi_partner and gi_partner_up are filled with required values.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

it_methods = gi_method

IT_HEADER = gi_header

IT_PARTNER = gi_partner

IT_PARTNER_UP = gi_partner_up

return = gi_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' is also used.

Thanks & regards,

Vishnu Priya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
665

Hi,

For the GI_METHOD internal table make use of this code.

wa_method-refnumber = '000001'.

wa_method-objecttype = 'PARTNER'.

wa_method-method = 'CREATE'.

wa_method-objectkey = '000076700030'. * Note: make sure the objectkey is correct

APPEND wa_method TO gi_method.

CLEAR : wa_method.

wa_method-method = 'SAVE '.

APPEND wa_method TO gi_method.

Rest of the part OK.

Hope you updated the internal table GI_PARTNER and GI_PARTNER_UP properly

Regards,

Smart

Hi,

For the GI_METHOD internal table make use of this code.

wa_method-refnumber = '000001'.

wa_method-objecttype = 'PARTNER'.

wa_method-method = 'CREATE'.

wa_method-objectkey = '000076700030'. * Note: make sure the objectkey is correct

APPEND wa_method TO gi_method.

CLEAR : wa_method.

wa_method-method = 'SAVE '.

APPEND wa_method TO gi_method.

Rest of the part OK.

Hope you updated the internal table GI_PARTNER and GI_PARTNER_UP properly

Regards,

Smart

4 REPLIES 4
Read only

Former Member
0 Likes
665

hi

use this code hope it will help u

DATA t_meth TYPE TABLE OF bapi_alm_order_method.

**Internal table for Operation (BAPI)

DATA t_oper TYPE TABLE OF bapi_alm_order_operation.

DATA t_comp TYPE TABLE OF bapi_alm_order_component.

**Internal Table for Opertaions UP (BAPI)

DATA t_comp_up TYPE TABLE OF bapi_alm_order_component_up.

**Internal table for BAPI Return code

DATA t_ret TYPE TABLE OF bapiret2.

***WORK AREA DECLARATIONS

**Work Area for Hedaer

DATA:wa_header TYPE caufvdb,

wa_meth TYPE bapi_alm_order_method,

wa_op TYPE afvgb,

wa_comp TYPE resbb,

wa_comp1 TYPE bapi_alm_order_component,

wa_comp_up TYPE bapi_alm_order_component_up,

wa_oper TYPE bapi_alm_order_operation.

PARAMETERS:TEST.

****Fill Method Internal table

CLEAR wa_meth.

wa_meth-method = 'SAVE'.

APPEND wa_meth TO t_meth.

wa_meth-refnumber = sy-tabix.

wa_meth-objecttype = 'COMPONENT'.

wa_meth-method = 'CHANGE'.

wa_meth-objectkey(12) = '000004000104'.

wa_meth-objectkey+12(4) = '0010'.

wa_meth-objectkey+16(4) = '0010'.

APPEND wa_meth TO t_meth.

**Component Internal table

wa_comp1-reserv_no = '0000001072'.

wa_comp1-res_item = '0001'.

wa_comp1-activity = '0010'.

wa_comp1-item_number = '0010'.

wa_comp1-special_stock = 'B'.

wa_comp1-requirement_quantity = '15'.

wa_comp1-stge_loc = '0001'.

wa_comp1-backflush = 'X'.

APPEND wa_comp1 TO t_comp.

**Component Update Internal table

wa_comp_up-special_stock = 'X'.

wa_comp_up-backflush = 'X'.

wa_comp_up-requirement_quantity = 'X'.

wa_comp_up-stge_loc = 'X'.

APPEND wa_comp_up TO t_comp_up.

**Call Bapi

BREAK-POINT.

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

it_methods = t_meth

it_component = t_comp

it_component_up = t_comp_up

return = t_ret.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

Read only

Former Member
0 Likes
666

Hi,

For the GI_METHOD internal table make use of this code.

wa_method-refnumber = '000001'.

wa_method-objecttype = 'PARTNER'.

wa_method-method = 'CREATE'.

wa_method-objectkey = '000076700030'. * Note: make sure the objectkey is correct

APPEND wa_method TO gi_method.

CLEAR : wa_method.

wa_method-method = 'SAVE '.

APPEND wa_method TO gi_method.

Rest of the part OK.

Hope you updated the internal table GI_PARTNER and GI_PARTNER_UP properly

Regards,

Smart

Read only

0 Likes
665

Hi,

I tried to pass 'X' to some investment data in the header. hence the error. solved it.

Thanks for all the replies.

Thanks & Regards,

Vishnu Priya

Read only

Former Member
0 Likes
665

.