on 10-08-2007 9:18 AM
Hello all,
How to create a Partner to the order using BAPI_ALM_ORDER_MAINTAIN ?
I am able to create header , operation , component and relationships.
Can any one help me on how to create partner using for a order using BAPI_ALM_ORDER_MAINTAIN .
It is very urgent .
I am trying for this from last 2 days.
Thanks and Regards ,
Prem .
Hi Prem,
take a look at the below example.
data:
it_methods type bapi_alm_order_method occurs 0 with header line,
it_header type bapi_alm_order_headers_i occurs 0 with header line,
it_header_up type bapi_alm_order_headers_up occurs 0 with header line,
it_header_srv type bapi_alm_order_srvdat_e occurs 0 with header line,
it_header_srv_up type bapi_alm_order_srvdat_up occurs 0 with header line,
it_userstatus type bapi_alm_order_usrstat occurs 0 with header line,
it_partner type bapi_alm_order_partn_mul occurs 0 with header line,
it_partner_up type bapi_alm_order_partn_mul_up occurs 0 with header line,
it_operation type bapi_alm_order_operation occurs 0 with header line,
it_operation_up type bapi_alm_order_operation_up occurs 0 with header line,
it_relation type bapi_alm_order_relation occurs 0 with header line,
it_relation_up type bapi_alm_order_relation_up occurs 0 with header line,
it_component type bapi_alm_order_component occurs 0 with header line,
it_component_up type bapi_alm_order_component_up occurs 0 with header line,
it_text type bapi_alm_text occurs 0 with header line,
it_text_lines type bapi_alm_text_lines occurs 0 with header line,
extension_in type bapiparex occurs 0 with header line,
return type bapiret2 occurs 0 with header line,
et_numbers type bapi_alm_numbers occurs 0 with header line.
*-- General Mapping
clear it_methods.
it_methods-refnumber = '000001'.
it_methods-objecttype = 'HEADER'.
it_methods-method = 'CREATE'.
it_methods-objectkey = '%00000000001'.
append it_methods. clear it_methods.
it_methods-refnumber = '000001'.
it_methods-objecttype = ''.
it_methods-method = 'SAVE'.
it_methods-objectkey = '%00000000001'.
append it_methods. clear it_methods.
*-- Header Mapping
clear it_header.
it_header-orderid = '%00000000001'.
it_header-order_type = 'AB01'.
it_header-planplant = '1003'.
it_header-mn_wk_ctr = '8700722'. "'ISP-TECH'.
it_header-pmacttype = 'Y10'. "'Y28'.
it_header-serialno = '3007762'. "'BVW75-8001'.
it_header-material = 'VPLES3'.
it_header-maintroom = 'SOMEROOM'.
it_header-processing_group = '11'.
it_header-salesorg = '1000'.
it_header-distr_chan = '10'.
it_header-division = '10'.
it_header-equipment = '000000000010000012'.
append it_header. clear it_header.
clear it_header_srv.
*IT_HEADER_SRV-BILLING_FORM = '02'.
it_header_srv-dli_profile = 'YSPSTM3'.
it_header_srv-material = 'DEPOT_LABOR'. "'SUPPORTNET_FIELD'.
it_header_srv-quantity = 1.
it_header_srv-salesorg = '1000'.
it_header_srv-distr_chan = '10'.
it_header_srv-division = '10'.
append it_header_srv. clear it_header_srv.
*-- Partner Information
it_methods-refnumber = '000001'.
it_methods-objecttype = 'PARTNER'.
it_methods-method = 'CREATE'.
it_methods-objectkey = '%00000000001'.
append it_methods. clear it_methods.
clear it_partner.
it_partner-orderid = '%00000000001'.
it_partner-partn_role = 'AG'. "'AG'.
it_partner-partner = '1001061'. "'C6130'.
append it_partner. clear it_partner.
*IT_PARTNER-ORDERID = '%00000000001'.
*IT_PARTNER-PARTN_ROLE = 'WE'.
*IT_PARTNER-PARTNER = '3500000'.
*APPEND IT_PARTNER. CLEAR IT_PARTNER.
*IT_PARTNER-ORDERID = '%00000000001'.
*IT_PARTNER-PARTN_ROLE = 'VW'.
*IT_PARTNER-PARTNER = '88899'.
*APPEND IT_PARTNER. CLEAR IT_PARTNER.
**-- Operation Mapping
*
it_methods-refnumber = '000001'. " Operation-1
it_methods-objecttype = 'OPERATION'.
it_methods-method = 'CREATE'.
it_methods-objectkey = '%000000000010010'.
append it_methods. clear it_methods.
clear it_operation.
it_operation-activity = '0010'.
it_operation-control_key = 'PM01'.
it_operation-acttype = 'FIELD'.
it_operation-work_activity = '5.0'.
it_operation-un_work = 'H'.
it_operation-duration_normal = '5.0'.
it_operation-duration_normal_unit = 'H'.
*IT_OPERATION-STANDARD_TEXT_KEY = 'UP314'. "no val maintained
it_operation-calc_key = '0'.
append it_operation. clear it_operation.
it_methods-refnumber = '000002'. " Operation-2
it_methods-objecttype = 'OPERATION'.
it_methods-method = 'CREATE'.
it_methods-objectkey = '%000000000010020'.
append it_methods. clear it_methods.
clear it_operation.
it_operation-activity = '0020'.
it_operation-control_key = 'PM01'.
it_operation-acttype = 'ACCOMN'.
it_operation-work_activity = '5.0'.
it_operation-un_work = 'H'.
it_operation-duration_normal = '5.0'.
it_operation-duration_normal_unit = 'H'.
*IT_OPERATION-STANDARD_TEXT_KEY = 'UP314'. "no val maintained
it_operation-calc_key = '0'. " 0,3 Working
append it_operation. clear it_operation.
*-- Component Mapping
it_methods-refnumber = '000001'. " Component - 1
it_methods-objecttype = 'COMPONENT'.
it_methods-method = 'CREATE'.
it_methods-objectkey = '%000000000010010'.
append it_methods. clear it_methods.
clear it_component.
it_component-material = 'AAA'.
it_component-plant = '1003'.
it_component-item_cat = 'L'.
it_component-item_number = ''.
it_component-activity = '0010'.
it_component-unload_pt = 'XXX'.
it_component-requirement_quantity = 7.
it_component-requirement_quantity_unit = 'EA'.
it_component-requirement_quantity_unit_iso = 'EA'.
it_component-stge_loc = '0000'.
append it_component. clear it_component.
it_methods-refnumber = '000002'. " Component - 2
it_methods-objecttype = 'COMPONENT'.
it_methods-method = 'CREATE'.
it_methods-objectkey = '%000000000010020'.
append it_methods. clear it_methods.
clear it_component.
it_component-material = 'AAA'.
it_component-plant = '1003'.
it_component-item_cat = 'L'.
it_component-item_number = ''.
it_component-activity = '0010'.
it_component-unload_pt = 'XXX'.
it_component-requirement_quantity = 4.
it_component-requirement_quantity_unit = 'EA'.
it_component-requirement_quantity_unit_iso = 'EA'.
it_component-stge_loc = '0000'.
append it_component. clear it_component.
*IT_METHODS-REFNUMBER = '000001'.
*IT_METHODS-OBJECTTYPE = ''.
*IT_METHODS-METHOD = 'SAVE'.
*IT_METHODS-OBJECTKEY = '%00000000001'.
*APPEND IT_METHODS. CLEAR IT_METHODS.
*-
refresh return.
call function 'BAPI_ALM_ORDER_MAINTAIN'
tables
it_methods = it_methods
it_header = it_header
it_header_up = it_header_up
it_header_srv = it_header_srv
it_header_srv_up = it_header_srv_up
it_userstatus = it_userstatus
it_partner = it_partner
it_partner_up = it_partner_up
it_operation = it_operation
it_operation_up = it_operation_up
it_relation = it_relation
it_relation_up = it_relation_up
it_component = it_component
it_component_up = it_component_up
it_text = it_text
it_text_lines = it_text_lines
extension_in = extension_in
return = return
et_numbers = et_numbers.
loop at return.
write:/ return-type,
return-id,
return-number,
return-message.
endloop.
skip.
loop at et_numbers.
write: et_numbers-aufnr_in,
et_numbers-aufnr_new.
endloop.
call function 'BAPI_TRANSACTION_COMMIT'.
*
The above example prog is for creating order. the same you modify in methods table use 'CHANGE' & 'SAVE' methods and put ref. as your service order.If the order is existing and you need to add it_header-orderid = 'ACTUALORDERNO'.to the above shown program and delete all other header fields this will definitly work.
Basically you may not able to create just items alone w/o header details.
if it helpful reward points are appreciated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.