‎2006 Feb 20 10:22 AM
Hi all,
I'm trying to modify the field charg on the materials in a process order, I've tried the function CLOI_CHANGES_UPL_45 to modify other fields for an order, but the field CHARG is not supported, anyone knows how I can modify it?
‎2006 Feb 20 10:29 AM
Hi,
you can try with this BAPI..
<b>BAPI_ALM_ORDER_MAINTAIN</b>
Regards
vijay
‎2006 Feb 20 11:03 AM
Thanks Vijay,
I'm trying this BAPI filling the table it_methods with the method SAVE and filling the table it_component and it_component and returns me the message type S "BAPI control has finished" but there is no change into the order.
Do you have any example of how to use this function?
Thanks a lot,
‎2006 Feb 20 11:15 AM
Hi Xavier,
USE BAPI_TRANSACTION_COMMIT after the BAPI Call.
Regards
vijay
if sy-subrc = 0.
Call function 'BAPI_TRANSACTION_COMMIT'.
...
endif.regards
vijay
‎2006 Feb 20 11:33 AM
I have done it, but I can't see the changes, maybe I'm not filling correctly the table it_methods because I only fill the field method with value 'SAVE' and I don't fill the other fields. Do you know if I have to fill them and how?
‎2006 Feb 20 11:43 AM
hi Xavier,
can you show the parameters what are you passing...
Regards
Vijay
‎2006 Feb 20 11:59 AM
This is what I've tried:
data: it_methods type table of BAPI_ALM_ORDER_METHOD with header line.
data: it_comp type table of BAPI_ALM_ORDER_COMPONENT with header line,
it_comp_up type table of BAPI_ALM_ORDER_COMPONENT_UP with header line,
it_return type table of bapiret2,
it_header type table of BAPI_ALM_ORDER_HEADERS_I with header line.
it_methods-OBJECTTYPE = 'COMPONENT'.
it_methods-method = 'CHANGE'.
append it_methods.
it_comp-RESERV_NO = '1148'.
it_comp-RES_ITEM = '1'.
it_comp-material = '000000000000000004'.
it_comp-plant = '0101'.
it_comp-stge_loc = '0102'.
it_comp-batch = '20050719'.
append it_comp.
it_comp_up-batch = 'X'.
append it_comp_up.
refresh it_return.
it_header-orderid = '1000185'.
it_header-ORDER_TYPE = 'Z010'.
append it_header.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = it_methods[]
IT_HEADER = it_header
IT_HEADER_UP =
IT_HEADER_SRV =
IT_HEADER_SRV_UP =
IT_USERSTATUS =
IT_PARTNER =
IT_PARTNER_UP =
IT_OPERATION =
IT_OPERATION_UP =
IT_RELATION =
IT_RELATION_UP =
IT_COMPONENT = it_comp[]
IT_COMPONENT_UP = it_comp_up[]
IT_TEXT =
IT_TEXT_LINES =
EXTENSION_IN =
RETURN = it_return[]
ET_NUMBERS =
.
Thanks for your time
‎2006 Feb 20 12:17 PM
Hi Xavier,
you missed <b>IT_HEADER_UP</b>.
pass this also with update flag info..
Regards
vijay
‎2006 Feb 20 12:43 PM
Now I have this error: "Error during processing of BAPI methods" and I don't know how to solve it, I've filled the table as follow:
it_methods-refnumber = '000001'.
it_methods-OBJECTTYPE = 'COMPONENT'.
it_methods-method = 'CHANGE'.
it_methods-objectkey = '000001000185'.
append it_methods.
clear it_methods.
*it_methods-refnumber = '000002'.
it_methods-method = 'SAVE'.
append it_methods.
it_comp-RESERV_NO = '1148'.
it_comp-RES_ITEM = '1'.
it_comp-material = '000000000000000004'.
it_comp-plant = '0101'.
it_comp-stge_loc = '0102'.
it_comp-batch = '20050719'.
append it_comp.
it_comp_up-batch = 'X'.
append it_comp_up.
refresh it_return.
it_header-orderid = '1000185'.
it_header-ORDER_TYPE = 'Z010'.
append it_header.
it_header_up-orderid = '000001000185'.
it_header_up-mrp_relevant = 'X'.
append it_header_up.
‎2006 Feb 20 12:52 PM
Hi,
here you are passing two methods, one is change and other is save. it can't be handled two at a time , i suppose..
check it once FM documentation.
Regards
vijay
‎2006 Feb 20 3:52 PM
Thank you Vijay, the problem was i forgot the operation in the component table.
‎2006 Feb 20 4:05 PM
Good,
Now are you able to make changes to the order.
Regards
vijay
‎2009 Mar 05 3:05 PM
Hi Vijay,
I've got the same problem from my function Module.
Could you please help me because I'm quite new to user exits.
I've got 2 messages stored in return table 'T_RET' ( TYPE BAPIRET2 ) which are as follows
1. E IWO_BAPI 123 Error reading the standard sequence from the document tables
2. E IWO_BAPI2 113 Error during processing of BAPI methods
Source code:
FUNCTION zpm_iw32_pm99_pm0_change_comp.
*"----
""Local Interface:
*" IMPORTING
*" REFERENCE(AUFNR) TYPE AUFK-AUFNR
*" TABLES
*" COMP_TAB
*" OPER_TAB
*"----
----
Data declarations
----
Internal tables
DATA: t_meth TYPE TABLE OF bapi_alm_order_method,
t_oper TYPE TABLE OF bapi_alm_order_operation,
t_comp TYPE TABLE OF bapi_alm_order_component,
t_comp_up TYPE TABLE OF bapi_alm_order_component_up,
t_ret TYPE TABLE OF bapiret2.
Work areas
DATA: wa_header TYPE caufvdb,
wa_meth TYPE bapi_alm_order_method,
wa_op TYPE afvgb,
wa_oper TYPE bapi_alm_order_operation,
wa_comp TYPE resbb,
wa_comp1 TYPE bapi_alm_order_component,
wa_comp_up TYPE bapi_alm_order_component_up,
wa_in TYPE bapi_alm_order_component_e,
flag TYPE c.
----
Implementations
----
DO 100 TIMES.
CALL FUNCTION 'CO_ZF_ORDER_LOCK'
EXPORTING
aufnr = aufnr
client = sy-mandt
EXCEPTIONS
order_already_locked = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
If order locked, unlock and continue.
IF sy-subrc = 0.
CALL FUNCTION 'CO_ZF_ORDER_DELOCK'
EXPORTING
aufnr = aufnr.
flag = 'X'.
EXIT.
ELSE.
Wait 1 second and check one more time if the reservation is now
unlocked
WAIT UP TO 1 SECONDS.
ENDIF.
ENDIF.
ENDDO.
----
Change MRP-relevance of identified components
----
IF flag = 'X'.
CLEAR: wa_comp, wa_in, flag, t_meth, t_ret,
wa_meth, wa_comp1, t_comp, t_comp_up.
Fill Method Internal table
wa_meth-method = 'SAVE'.
APPEND wa_meth TO t_meth.
LOOP AT comp_tab INTO wa_comp.
MOVE: wa_comp-vornr TO wa_in-activity,
wa_comp-rspos TO wa_in-res_item,
wa_comp-rsnum TO wa_in-reserv_no,
wa_comp-posnr TO wa_in-item_number.
Voor alle componenten
wa_meth-refnumber = sy-tabix.
wa_meth-objecttype = 'COMPONENT'.
wa_meth-method = 'CHANGE'.
wa_meth-objectkey(12) = aufnr. " ES_HEADER-orderID (order no.)
wa_meth-objectkey+12(4) = wa_in-activity. " ET_COMPONENT-activity (operation no.)
wa_meth-objectkey+16(4) = '0000'. " ET_COMPONENT-ITEM (suboperation no.)
APPEND wa_meth TO t_meth.
Component Internal table
wa_comp1-reserv_no = wa_in-reserv_no. " ET_COMPONENT-RESERV_NO
wa_comp1-res_item = wa_in-res_item. " ET_COMPONENT-RES_item
wa_comp1-activity = wa_in-activity. " ET_COMPONENT-activity
wa_comp1-item_number = wa_in-item_number. " ET_COMPONENT-ITEM_NR
wa_comp1-mrp_relevant = '3'. " Immediately
APPEND wa_comp1 TO t_comp.
ENDLOOP.
Component Update Internal table
wa_comp_up-requirement_quantity = 'X'.
wa_comp_up-mrp_relevant = 'X'.
APPEND wa_comp_up TO t_comp_up.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = t_meth
it_component = t_comp
it_component_up = t_comp_up
return = t_ret.
BREAK smartsol.
IF sy-subrc = 0 AND t_ret is INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
ENDIF.
ENDFUNCTION.