2006 Nov 16 9:37 PM
Hello All,
I am using BAPI_PO_CHANGE to change the netprice. But it is not changing. I have tried out everything which i found in the other posts for the same subject, but still I am not able to change to netprice.
I am able to change the PO limits, but by using MS_SERVICE_SAVE. This gets updated fine...but the netprice dosn't.
Can anybody help me on this.
I am on R/3 Release 4.6C
Regards,
Sridhar Karra.
Hi,
Try to change the condition records that derives the net price of the line item...
There must be some condition type that will derive the net price..
Thanks,
Naren
2006 Nov 16 9:40 PM
are you executing BAPI_TRANSACTION_COMMIT after BAPI_PO_CHANGE?
Rob
2006 Nov 16 9:43 PM
Yes... I am doing that. After calling MS_SERVICE_SAVE and BAPI_PO_CHANGE...I am calling commit work. It updates the service table but not the netprice.
Regards,
Sridhar K.
2006 Nov 16 10:28 PM
Have you checked the contents of BAPIRETURN?
Habe you looked at OSS note 197958?
Rob
2006 Nov 16 9:50 PM
Hi,
Check this code for PO update..
PARAMETERS: p_ebeln LIKE ekko-ebeln.
DATA: t_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: t_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
t_poitem-po_item = '00010'.
t_poitem-net_price = '17.00'.
APPEND t_poitem.
t_poitemx-po_item = '00010'.
t_poitemx-net_price = 'X'.
t_poitemx-po_itemx = 'X'.
APPEND t_poitemx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = p_ebeln
TABLES
return = t_return
poitem = t_poitem
poitemx = t_poitemx.
COMMIT WORK.
Thanks,
Naren
2006 Nov 16 10:19 PM
Hello Naren,
I have done this in my code...and I have tried your's too. but it still dosen't work.
My netprice is 77,0000. I tried putting 111111, but no it dosen't change.
Item category in purchasing document = I
Do i need to apply some SAP note for this to happen?
Does it depend upon the item category in anyway?
Would appreciate more replies on this.
Regards,
Sridhar Karra.
2006 Nov 16 10:22 PM
Hi,
The code I gave is working fine in my system..Could you please post your code that updates the PO.
Thanks,
Naren
2006 Nov 16 10:35 PM
Hello Naren,
I have found out this note 561507. And the changes in this note are not present in my system.
This is the SAP code currently in my system. this changes the netprice back to 77000$, no matter I have changed it...
FORM set_srv_values USING ls_header TYPE mepoheader
ls_item TYPE mepoitem
ls_ekpo TYPE mepoitem
ls_schedule TYPE meposchedule
im_aktyp TYPE t160-trtyp
im_po TYPE REF TO cl_po_header_handle_mm
.
DATA: ls_ekko_act TYPE mepoheader.
get data from header if activity is change (VER)
IF im_aktyp EQ ver.
CALL METHOD im_po->get_data
IMPORTING
ex_data = ls_ekko_act.
ENDIF.
CLEAR comsrv.
IF ls_item-pstyp EQ item_limit.
comsrv-no_srv = mmpur_yes.
ENDIF.
move header data to comsrv
MOVE-CORRESPONDING ls_ekko_act TO comsrv.
comsrv-frgkl = ls_ekko_act-frgke.
move item data to comsrv
MOVE-CORRESPONDING ls_item TO comsrv.
company code
IF ls_item-bukrs IS INITIAL.
comsrv-bukrs = ls_ekpo-bukrs.
ELSE.
comsrv-bukrs = ls_item-bukrs.
ENDIF.
currency (because of move-corresponding overwritings)
comsrv-waers = ls_ekko_act-waers.
IF comsrv-bukrs NE space AND comsrv-bukrs NE t001-bukrs.
PERFORM bukrs IN PROGRAM sapfmmex USING comsrv-bukrs
CHANGING t001.
ENDIF.
comsrv-hwaer = t001-waers.
short text
comsrv-ktext1 = ls_item-txz01.
valuation
<b> IF NOT ls_ekpo-packno IS INITIAL.
IF ls_ekpo-brtwr NE 0.
comsrv-netpr = ls_ekpo-brtwr.
ELSE.
comsrv-netpr = ls_ekpo-netpr.
ENDIF.
ENDIF.</b>
ERS flag
comsrv-ers = ls_item-xersy.
move delivery date
comsrv-bzdat = ls_schedule-eindt.
ENDFORM. " set_srv_values
*************************************************************************
In the sap code this part is being commented.....
FORM set_srv_values TABLES lt_item STRUCTURE mepoitem
lt_schedule STRUCTURE meposchedule
USING ls_header TYPE mepoheader.
data: ls_ekko like ekko.
Daten aus ekko nachlesen
SELECT SINGLE * FROM EKKO INTO LS_EKKO
WHERE EBELN = ls_header-EBELN.
CLEAR comsrv.
IF lt_item-pstyp EQ '1'.
comsrv-no_srv = 'X'.
ENDIF.
comsrv-kdatb = ls_ekko-kdatb.
comsrv-kdate = ls_ekko-kdate.
comsrv-lifnr = ls_ekko-lifnr.
comsrv-ekorg = ls_ekko-ekorg.
comsrv-kufix = ls_ekko-kufix.
comsrv-frgkl = ls_ekko-frgke.
comsrv-pstyp = lt_item-pstyp.
comsrv-bsart = ls_ekko-bsart.
if lt_item-bukrs is initial.
comsrv-bukrs = ekpo-bukrs.
else.
comsrv-bukrs = lt_item-bukrs.
endif.
comsrv-spras = ls_ekko-spras.
comsrv-bedat = ls_ekko-bedat.
comsrv-bzdat = lt_schedule-eindt.
comsrv-ebeln = ls_ekko-ebeln.
comsrv-ebelp = lt_item-ebelp.
comsrv-bstyp = ls_ekko-bstyp.
comsrv-prdat = lt_item-prdat.
comsrv-ktext1 = lt_item-txz01.
comsrv-meins = lt_item-meins.
comsrv-hwaer = t001-waers.
comsrv-waers = ls_ekko-waers.
comsrv-wkurs = ls_ekko-wkurs.
<b>*If NOT lt_item-PACKNO is initial. "491220
IF lt_item-brtwr NE 0 AND ls_ekko-stako EQ space.
comsrv-netpr = lt_item-brtwr.
ELSE.
comsrv-netpr = lt_item-netpr.
ENDIF.
*ENDIF.</b> "491220
comsrv-matkl = lt_item-matkl.
comsrv-werks = lt_item-werks.
comsrv-knttp = lt_item-knttp.
comsrv-kzvbr = lt_item-kzvbr.
comsrv-loekz = lt_item-loekz.
comsrv-elikz = lt_item-elikz.
comsrv-mwskz = lt_item-mwskz.
comsrv-txjcd = lt_item-txjcd.
comsrv-fipos = lt_item-fipos.
comsrv-fistl = lt_item-fistl.
comsrv-geber = lt_item-geber.
comsrv-xoblr = lt_item-xoblr.
comsrv-statu = lt_item-statu.
comsrv-packno = lt_item-packno.
comsrv-navnw = lt_item-navnw.
comsrv-webre = lt_item-webre.
comsrv-lebre = lt_item-lebre.
comsrv-ers = lt_item-xersy.
COMSRV-EK_STATU = ls_ekko-STATU.
ENDFORM. " set_srv_values
The above code is in the include...L2012F41
I will get in touch will my basis guy and let u all know wht is the output.
Regards,
Sridhar Karra.
2006 Nov 21 9:40 PM
Hello Naren,
Can i know the support package and SAP R/3 version you are using for which the code u gave me is working.
I am using SAP R/3 46c and support package: SAPKA46C52
Regards,
Sridhar Karra.
2006 Nov 21 9:44 PM
2006 Nov 21 10:43 PM
hey naren,
thx for the reply. can you let me know which support pack is tht.
So tht it will help me in backtracking in the SAP code changes.
Regards,
Sridhar Karra.
2006 Nov 21 10:48 PM
Hi,
Mine is 45. SAPKA46C45..
Also I don't think support pack will be an issue...
Please paste your code that updates the PO...
Thanks,
Naren
2006 Nov 21 10:52 PM
It could be possible that the reason why it is having the default net price, is that there may be a purchase info record for that vendor/material which has the net price associated with it, it could be forcing this price and not allowing you to change it. A quick test could be to try to change the PO using ME22N, does it allow you to change the net price there and save?
Regards,
Rich Heilman
2006 Nov 21 10:55 PM
Here is code,
MOVE p_t_po_items-po_item TO p_t_poitem-po_item.
<b>Here I am changing the netprice</b>
Calculate the new netprice based on the commitment value
PERFORM calculate_new_netpr
USING p_recieved_data
t_esuh-commitment
CHANGING t_poitem-net_price.
Append the po items.
APPEND t_poitem.
Mark X in fields that you want to change
Change the Net price for the item in Q!
t_poitemx-po_item = t_po_items-po_item.
t_poitemx-po_itemx = 'X'.
t_poitemx-net_price = 'X'.
APPEND t_poitemx.
CLEAR t_poitemx.
Change the PO header bapi field
v_poheader-po_number = p_recieved_data-ebeln.
v_poheaderx-po_number = 'X'.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = gv_ebeln
poheader = v_poheader
poheaderx = v_poheaderx
TABLES
return = t_return_tab
poitem = t_poitem
poitemx = t_poitemx
polimit = t_polimit.
Regards,
Sridhar Karra
2006 Nov 21 10:57 PM
2006 Nov 21 11:02 PM
2006 Nov 21 11:04 PM
Hello Rich,
it is this statement
MOVE p_t_po_items-po_item TO p_t_poitem-po_item.
this was in the routine.....i just moved it out.....
Regards,
Sridhar K.
2006 Nov 21 11:10 PM
Hello Rich,
Can you tell me how to mark it as Q? I did try to edit my original post.
Regards,
Sridhar K.
2006 Nov 21 11:11 PM
2006 Nov 21 11:12 PM
2006 Nov 21 11:54 PM
Ok, I got it working in my system, it appears that you must give the currency in the header in order for the net price to change. See below.
report zrich_0001.
data: return type table of bapiret2 with header line,
poheader type bapimepoheader,
poheaderx type bapimepoheaderx,
poitem type table of bapimepoitem with header line,
poitemx type table of bapimepoitemx with header line.
parameters: p_ebeln type ekpo-ebeln,
p_ebelp type ekpo-ebelp,
p_netwr type ekpo-netwr.
start-of-selection.
poheader-po_number = p_ebeln.
poheader-currency = 'USD'. "<= Right here
poitem-po_item = p_ebelp.
poitem-net_price = p_netwr.
append poitem.
poitemx-po_item = p_ebelp.
poitemx-po_itemx = 'X'.
poitemx-net_price = 'X'.
append poitemx.
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = p_ebeln
poheader = poheader
poheaderx = poheaderx
tables
return = return
poitem = poitem
poitemx = poitemx.
commit work.
loop at return.
write:/ return.
endloop.
Regards,
Rich Heilman
2006 Nov 22 12:10 AM
Instead of hardcoding the currency key, you can get it from EKKO. This would be better.
report zrich_0001.
data: return type table of bapiret2 with header line,
poheader type bapimepoheader,
poheaderx type bapimepoheaderx,
poitem type table of bapimepoitem with header line,
poitemx type table of bapimepoitemx with header line.
parameters: p_ebeln type ekpo-ebeln,
p_ebelp type ekpo-ebelp,
p_netwr type ekpo-netwr.
start-of-selection.
poheader-po_number = p_ebeln.
select single WAERS into poheader-currency
from ekko
where ebeln = p_ebeln.
poitem-po_item = p_ebelp.
poitem-net_price = p_netwr.
append poitem.
poitemx-po_item = p_ebelp.
poitemx-po_itemx = 'X'.
poitemx-net_price = 'X'.
append poitemx.
call function 'BAPI_PO_CHANGE'
exporting
purchaseorder = p_ebeln
poheader = poheader
poheaderx = poheaderx
tables
return = return
poitem = poitem
poitemx = poitemx.
commit work.
loop at return.
write:/ return.
endloop.
Regards,
Rich Heilman
2006 Nov 22 4:13 PM
hello rich,
I tried ur code too which u posted after this reply...it dosen't work. My netprice like u said cannot be edited in ME22N trx. The netprice is determined earlier itself. I will have to ask the functional person the make the fied of netprice as editable. If the field could not be made editable is there someother way to do it.
Regards,
Sridhar K.
2007 Jan 18 11:43 AM
Hi Sridhar,
put the statement t_poitem-po_item = t_po_items-po_item. above APPEND t_poitem. and try it once
Regards,
Srikanth T
2007 Aug 17 12:46 PM
I tried updating a custom price condition for the PO line item, using the above code. It does not seem to work. Any thoughts ?
thanks
2006 Nov 22 4:17 PM
Hi,
Try to change the condition records that derives the net price of the line item...
There must be some condition type that will derive the net price..
Thanks,
Naren
2006 Nov 22 4:25 PM
Hi,
Check this code..
PARAMETERS: p_ebeln LIKE ekko-ebeln.
DATA: t_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: t_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: t_cond LIKE bapimepocond OCCURS 0 WITH HEADER LINE.
DATA: t_condx LIKE bapimepocondx OCCURS 0 WITH HEADER LINE.
t_poitem-po_item = '00010'.
t_poitem-net_price = '17.00'.
APPEND t_poitem.
t_poitemx-po_item = '00010'.
t_poitemx-net_price = 'X'.
t_poitemx-po_itemx = 'X'.
APPEND t_poitemx.
t_cond-itm_number = '00010'.
t_cond-cond_type = '<b>P000</b>'.
t_cond-cond_value = '17.00'.
t_cond-currency = 'USD'.
t_cond-change_id = 'U'.
APPEND t_cond.
t_condx-itm_number = '00010'.
t_condx-itm_numberx = 'X'.
t_condx-cond_type = 'X'.
t_condx-cond_value = 'X'.
t_condx-currency = 'X'.
t_cond-change_id = 'X'.
APPEND t_condx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = p_ebeln
TABLES
return = t_return
poitem = t_poitem
poitemx = t_poitemx
pocond = t_cond
pocondx = t_condx.
COMMIT WORK.
The above code works fine for me...
Thanks,
Naren
2006 Nov 22 4:53 PM
Hello Naren,
Thx man u made my day. I was able to change the netprice.
Also one more thing, I am trying to change the POLIMTS, that is the Overalllimit and the Expected value of the services at the item level. But in the documentation for POLIMITS it says that you cannot change the PO limits.
I tried to edit my original post to mark this as Q, but whenever I try to edit it, I don't have the option to Mark this thread as Q..
Regards,
Sridhar K.
2015 Feb 06 12:27 AM
Hi Naren,
I am looking for changing net price value.I tried all which is there in this site but i am not able to get it.
I am passing condition type as 'PBXX' but in result no change but in condition table output 12 other conditions type are getting displayed which is there in purchase order of me22n.
Regards,
Sandhya
2006 Nov 22 4:57 PM
Hi,
Please follow the instructions as mentioned by Rich..
<b>There should be a checkbox on your original post which says "Mark this post as a question". Check that box.
Regards,
Rich Heilman</b>
Thanks,
Naren
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |