2016 Aug 18 10:57 AM
Hi,
I am unable to insert a Condition type 'ZGLC' at item level using : BAPI_PO_CHNAGE FM.
Find the below code :
***************************************
DATA : it_cond TYPE STANDARD TABLE OF bapimepocond,
it_condx TYPE STANDARD TABLE OF bapimepocondx,
it_return TYPE STANDARD TABLE OF bapiret2,
IT_CONDH TYPE STANDARD TABLE OF BAPIMEPOCONDHEADER,
IT_CONDHX TYPE STANDARD TABLE OF BAPIMEPOCONDHEADERX,
WA_CONH TYPE BAPIMEPOCONDHEADER,
WA_CONHX TYPE BAPIMEPOCONDHEADERX,
wa_cond TYPE bapimepocond,
wa_condx TYPE bapimepocondx.
*HEADER COND
WA_CONH-COND_TYPE = 'ZGLC'.
WA_CONH-COND_VALUE = '6.0'.
WA_CONH-CURRENCY = 'USD'.
WA_CONH-CHANGE_ID = 'I'.
APPEND WA_CONH TO IT_CONDH.
CLAER WA_CONH.
WA_CONHX-COND_TYPE = 'X'.
WA_CONHX-COND_VALUE = 'X'.
WA_CONHX-CURRENCY = 'X'.
WA_CONHX-CHANGE_ID = 'X'.
APPEND WA_CONHX TO IT_CONDHX.
CLEAR WA_CONHX.
***ITEM COND
*wa_cond-condition_no = '460000080'.
wa_cond-itm_number = '000010'.
wa_cond-cond_type = 'ZGLC'.
wa_cond-cond_value = '6.0'.
wa_cond-currency = 'USD'.
wa_cond-change_id = 'I'.
APPEND wa_cond TO it_cond.
CLEAR wa_cond .
wa_condx-itm_number = '000010'.
wa_condx-cond_type = 'X'.
wa_condx-cond_value = 'X'.
wa_condx-currency = 'X'.
wa_condx-change_id = 'X'.
APPEND wa_condx TO it_condx.
CLEAR wa_condX.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = '0460000080'
TABLES
return = it_return
POCONDHEADER = IT_CONDH
POCONDHEADERX = IT_CONDHX
pocond = it_cond
pocondx = it_condx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
.
2016 Aug 18 11:03 AM
And what is the outcome of your operation? Do you get any errors in IT_RETURN? If so please share them with us.
If you do not get any errors please check if your condition ZGLC has any requirements assigned to it. If so check if they are fulfilled (debugging suggested).
2016 Aug 18 11:11 AM
Hi ,
I am unable to insert manually 'ZGLC' to the transaction me22n .
i think problem with test data. Could you please confirm the parameters what i have passed is right or not? Still need to pass anymore parameters ?
Once the test data come from functional consultant i will update you the status.
Regards,
Chaitanya
2016 Aug 18 11:42 AM
If you can't add that condition with ME22N pricing configuration must be maintained. Most probably if you execute your code right now you should get similar error as the one displayed in ME22N while inserting ZGLC condition.
At first sight your code seems correct but you are never sure unless you test it
2016 Aug 18 12:19 PM
In the code :
Should i need to pass the item no as :
wa_cond-itm_number = '000010'. or wa_cond-itm_number = '000001'.
Regards,
Chaitanya
2016 Aug 18 12:22 PM
My requirement is to update at item level for all PO corresponding to SO condition records data.
Here i doubt about should i need to fill header constion records. Currently i am filling header condition records also in the bapi_po_change FM.
2016 Aug 18 12:30 PM
Field ITM_NUMBER should have number of corresponding item from PO document - I do not know what number range you use for PO items hence can't answer directly to your question.
Based on your code I can only say that you try to update PO with additional pricing condition ZGLC.
If you want to update PO conditions based on SO conditions you should first read conditions that you are interested in from SO and then try to pass it to PO conditions referring to corresponding PO items.
I can't tell you if you should or should not take also header conditions as this is up to business requirements that I'm not aware of
2016 Aug 18 12:50 PM
i am fetching sales conditions and passing it FM, but "wa_cond-itm_number" is condition number
not a item number. As i checked in FM documentation. it was as "00001".
Thanks for your response.
Regards,
Chaitanya