Rettkomv overwrite xkomv-kwert
Hi guys,
I implemented a condition value routine where I want to change the kwert of a condition.
read table xkomv ASSIGNING <fs> with key mandt = sy-mandt
kposn = xkomv-kposn
kschl = lv_kschl.
IF sy-subrc = 0.
* do some calculations
lv_division = ls_xkomv-kbetr * 100 / lv_kwert2 * 100.
xkwert = lv_division / 100.
xkomv-kbetr = xkwert.
IF ls_xkomv-kwert <> 0.
lv_division = ls_xkomv-kwert * 100 / lv_kwert2 * 100.
xkwert = lv_division / 100.
<fs>-kwert = xkwert.
ENDIF.
At the end of the routine there is the correct value in the internal table xkomv.
But after that, in SAP standard code the line of the internal table will be overwritten.
Form: XKOMV_BEWERTEN
* execute condition value formula not changing xkomv
* will normally be processed in xkomv_kwert_ermitteln
IF xkomv-kofrm NE 0 AND wertformel EQ space AND komp-kposn NE 0.
rettkomv = xkomv.
xkwert = xkomv-kwert.
frm_kondi_wert-nr = xkomv-kofrm.
PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND.
xkomv = rettkomv. "<--- here the value will be overwritten
ENDIF.
I found some other threads with this topic but can't find a solution for this.
Would be nice, if someone has an idea.
Regards,
Basti
HI Basti,
Write/Copy your code at end of XKOMV_BEWERTEN form using implicit Enhacement,
Regards,
Noufal P
Similar Messages
-
How to get xkomv-kwert (condition value) from a pricing condition ZZP1
Hi experts,
I have a pricing condition zcust that I need to modify in the sales order. The calculation of ZCUST is dependent on the condition value in another price condition ZZP1. The price for ZZP1 is a fixed amount of $6 which is split among line items in the order. In sapmv45A, when the code hits userexit_save_document_prepare, the value of xkomv-kwert (condition value) exist. In other user-exits in sapm45A, I was unable to find xkomv-kwert. My question is: How can I find the value of xkomv-kwert as i don't know how ZZP1 is calculated ?? There is no routine attached to ZZP1.
THE ZCUST has a routine 993 which is similar to 3. Here in program saplv61A, i was trying to get xkomv-kwert for ZZP1 but unable to get any data. Can anyone suggest where i can get the data (xkomv-kwert) for ZZP1 in saplv61a ?
I looked at userexit_xkomv_bewerten_end in saplv61a but it does not help.
XKomv-kbetr always has data. If i have ZZP1 data, then i can modify ZCUST.
Many thanks.
JoyceHi Jelena,
In VOFM, it is Formula/Condition Base Value for routine 993. In Pricing Procedure, it falls in column "Base Type" for 993.
Let's see if i can simplify this: In a sales order with 2 line items:
prices Amt Condition Value (USD)
Line 10 ZS1 sell price 2.30 1150
ZPP1 charge 6.36 3.40 (note the distribution **)
ZL1 3 3
ZR1 % 1.000% 11.50
ZR2 0.01 5
Suggested price = 2.35 1172.90
ZCUST 2.34 1170
total price 2.34 1170
Note: The ZCUST price is wrong. It is missing the ZPP1 charge which is 3.40. Zcust should be 1170 + 3.40 = 1173.40
Line 20 ZS1 sell price 25 1000
ZPP1 charge 6.36 2.96 (note the distribution **)
ZL1 3 3
ZR1 % 1.000% 10
ZR2 0.01 0.6
Suggested price = 25.41 1016.56
ZCUST 25.34 1013.60 (should be 1013.60 + 2.96)
Total price 25.34 1013.60
You can see the ZCUST is calculated incorrectly. The routine calculate zcust as $1170 and $1013.60 for each item which did not include the distribution amount of ZPP1 ($3.40 and $2.96).
When i debug the routine, the xkomv-kwert is zero. I am trying to get $3.40 and $2.96 so i can add to to zcust in the routine.
Am trying to determine in saplv61A at which include that i can see #3.40 and $2.96 for both line items in xkomv-kwert.
Then maybe i can modify the routine or saplv61A so it shows the correct zcust price after entering the 2 line items in the sales order create (VA01) ? Can you pls suggest ?
If i make the changes in USEREXIT_SAVE_DOCUMENT_PREPARE, then user cannot see the correct zcust until the order is saved. This would be too late to know the zcust price ahead of time.
Pls view in the Edit mode... i see my texts have been compressed.
Many thanks
Joyce
Edited by: Joyce Chan on Jul 9, 2009 10:24 PM
Edited by: Joyce Chan on Jul 9, 2009 10:25 PM -
Losing values in XKOMV structure
Dear All,
Please help it's very urgent.
I have created a routine in VOFM under formulas-Condition Value. After populating value XKOMV-KBETR the value is replaced by the standard structure RETTKOMV.
Because of this my calculated value for KBETR is replacing with RETTKOMV-KBETR value.
This is happening after comming out of the routine.
Please do needful it's very urgent.
Thanks
HreddyHi,
I think the formula is not configured in the pricing procedure..That is the reason why it is getting replaced..
Check this code in the include LV61AA43..The flag wertformel will be set if the routine is configured..
IF xkomv-kofrm NE 0.
<b>wertformel = 'X'.</b>
xkwert = xkomv-kwert.
frm_kondi_wert-nr = xkomv-kofrm.
PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND.
xkomv-kwert = xkwert.
ENDIF.
If the flag is set the if condition that you mentioned will fail and it will not overwrite..
if xkomv-kofrm ne 0 and <b>wertformel eq space</b> and komp-kposn ne 0.
rettkomv = xkomv.
xkwert = xkomv-kwert.
frm_kondi_wert-nr = xkomv-kofrm.
perform (frm_kondi_wert) in program saplv61a if found.
xkomv = rettkomv.
endif.
Check in my previous reply for the formula in the pricing procedure..
Thanks,
Naren
Message was edited by: Narendran Muthukumaran -
XKOMV values are not geting changed with Customized Routine
Hi,
I have created a custom routine for pricing and the routine is executed. I am passing the value for field XKOMV-KWERT but it's not reflected.
code
FIELD-SYMBOLS <fs_xkomv> TYPE KOMV_INDEX.
READ TABLE xkomv ASSIGNING <fs_xkomv> with key kschl = 'VPRS'.
if sy-subrc = 0.
<fs_xkomv>-KWERT = wa_bseg-DMBE2.
<fs_xkomv>-kkurs = v_final.
endif.
After this the values in table XKOMV is changed but it's not reflected in the screen.
Can anyone suggest what could be the problem and how to proceed with this
Regards,
NarayanHi Narayan,
For this requirement you can use the include RV61AFZB (which is nothing but User exit). I was too having the same requirement, which has been fulfilled by this exit.
My code is as below:
IF sy-tcode = 'MRIS'.
IF komk-mwskz = 'ET'.
TYPES: BEGIN OF gty_equz4,
equnr TYPE equnr,
datbi TYPE datbi,
iloan TYPE iloan,
kund1 TYPE kund1,
zzvctx TYPE zzdevctx,
proid TYPE ps_psp_pnr,
txjcd LIKE kna1-txjcd,
END OF gty_equz4.
DATA: git_equz4 TYPE STANDARD TABLE OF gty_equz4.
DATA: gwa_equz4 TYPE gty_equz4.
DATA: total_vct LIKE equz-zzvctx.
DATA: total_tax LIKE xkomv-kwert.
LOOP AT xkomv. " where kposn = 10. "hardcode for right now
CASE xkomv-kschl.
WHEN 'XP1I'. total_tax = total_tax + xkomv-kwert.
WHEN 'XP2I'. total_tax = total_tax + xkomv-kwert.
WHEN 'XP3I'. total_tax = total_tax + xkomv-kwert.
WHEN 'XP4I'. total_tax = total_tax + xkomv-kwert.
WHEN 'XP5I'. total_tax = total_tax + xkomv-kwert.
WHEN 'XP6I'. total_tax = total_tax + xkomv-kwert.
ENDCASE.
ENDLOOP.
***Import the table git_equz4
IMPORT git_equz4 FROM MEMORY ID 'Z_VENDOR_CHARGED_TAX_AMNT'.
LOOP AT git_equz4 INTO gwa_equz4 WHERE txjcd = txjcd.
total_vct = total_vct + gwa_equz4-zzvctx.
ENDLOOP.
LOOP AT xkomv.
CASE xkomv-kschl.
WHEN 'XP1I'. xkomv-kwert = total_vct. MODIFY xkomv.
WHEN 'XP2I'. xkomv-kwert = 0. MODIFY xkomv.
WHEN 'XP3I'. xkomv-kwert = 0. MODIFY xkomv.
WHEN 'XP4I'. xkomv-kwert = 0. MODIFY xkomv.
WHEN 'XP5I'. xkomv-kwert = 0. MODIFY xkomv.
WHEN 'XP6I'. xkomv-kwert = 0. MODIFY xkomv.
ENDCASE.
ENDLOOP.
ENDIF.
ENDIF.
This may solve your issue.
Regards,
Santosh -
Addition of Condition type in XKOMV programmatically - Sales Order creation
Hi,
I need to add a condition type ( a record with whole data like Amount etc,.) in XKOMV programmatically during a Sales order creation, so that the new condition type gets automatically saved along with other data in VA01. Please suggest the better way of doing this - through Userexits or Form routines.
Thanks in Advance,
Sirisha.
Edited by: hema Namuduri on Oct 20, 2011 5:12 PM
Edited by: hema Namuduri on Oct 20, 2011 5:13 PMHi E_Hinojosa / madhurao123,
I added the below code in FORM userexit_xkomv_bewerten_end ( of Include: RV61AFZB ) which will get triggered in 'Pricing' Function Module.
FORM USEREXIT_XKOMV_BEWERTEN_END *
FORM userexit_xkomv_bewerten_end.
DATA: l_amt1 TYPE vbak-netwr,
v_waerk TYPE waerk.
l_amt1 = '56000'. " Let's say..
READ TABLE xkomv WITH KEY kschl = 'ZF02 '.
IF sy-subrc <> 0.
xkomv-stunr = '012 '.
xkomv-kschl = 'ZF02 '.
xkomv-krech = 'B '.
xkomv-kwert = l_amt1.
xkomv-kbetr = l_amt1.
xkomv-ksteu = 'C'.
Select single waerk into v_waerk from vbak where vbeln = komp-vgbel.
IF v_waerk <> space.
xkomv-waers = v_waerk.
ENDIF.
xkomv-zaehk = 99.
CLEAR: xkomv-kntyp,
xkomv-kstat,
xkomv-kolnr,
xkomv-knumh,
xkomv-kopos,
xkomv-kinak.
xkomv-kherk = 'C'.
xkomv-kvsl1 = 'ERL '.
xkomv-drukz = 'X'.
xkomv-kaend_loe = 'X'.
xkomv-updkz = 'I'.
APPEND xkomv. CLEAR xkomv.
DELETE xkomv WHERE kschl = 'ZH00 ' OR kschl = 'ZF00 '.
komp-netwr = l_amt1.
ENDIF.
ENDFORM. "USEREXIT_XKOMV_BEWERTEN_END
Above is the main logic I am using, apart from other Export, Import statements etc,.The above code is getting triggered during every screen transition.
It is automatically adding condition type 'ZF02' with all values during the creation of sales orders for some contracts, but not for other contracts. I am trying to trace what is the difference in both scenarios.
Please suggest.
Regards,
Sirisha N. -
I am updating the xkomv table in a user exit using the code at the bottom of this message. The xkomv table appears to be updated correctly and works when there is only 1 line item on my order. However, when there are 2 line items or more then the pricing conditions are added but the "Condition value" is not populated. I can scroll through the line items and then F3 out of the order and get a popup asking if I want to save changes. I respond yes (although I did not change anything in the order I just scrolled through the line items while looking at the conditions tab using the black arrow at top left of screen). When I pull the order back up the "Condition value" is populated.
i need the "condition value" to be populated by the code and work properly. I am a new ABAPer and would appreciate any advice about adding pricing conditions to xkomv.
Code
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'KF00'.
IF sy-subrc = 0.
found KF00 condition for line item so update rate
xkomv-kwert = lrate.
wa_komv-kwert = lrate / rcnt.
wa_komv-kbetr = lrate / rcnt.
MODIFY xkomv FROM wa_komv INDEX sy-tabix.
ELSE.
no KF00 condition so create it
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'PR00'.
IF sy-subrc = 0.
xkomv-kposn = xvbap-posnr.
PERFORM get_confition_types TABLES xkomv
USING 'KF00'.
xkomv-kwert = lrate.
xkomv-kbetr = lrate / rcnt.
APPEND xkomv.
READ TABLE xkomv INTO wa_komv
WITH KEY kposn = wa_vbap-posnr kschl = 'KF00'.
wa_komv-kwert = lrate / rcnt.
wa_komv-kbetr = lrate / rcnt.
MODIFY xkomv FROM wa_komv INDEX sy-tabix.
ELSE.
append xkomv.
ENDIF.
ENDIF.
End of codejust changing the values in user exit might not work always... specially when you are making changes to condition based value and condition value.. there is lots of logic involved, to determine and make sure values are correct.
if you want to change the value then try to write code in pricing routines, which are attached to your condition types... pricing routines can be seen in Tr. VOFM, its the functional team which have to guide to create a P routine.
there is a lot of other validations which take place on re-pricing and on any change done in SO of Inv. -
Restrict Pricing updates in Sales Order
Hi All,
I have created a pricing conditon formula to get the price for the real time contract price from a third party Contract management system through a RFC call, and assigned the formula to a condition type.
In this formula, if there was an error i am exporting the error message to a memory and importing the value from that memory to set a billing block in the user exit SAVE_PREPARE_DOCUMENT (MV45AFZZ).
The problem i am facing is that the formula is getting called many times uncessarily for eg. when you click pricing etc
and not necessarily updates the price all times. Actually the price is not updated when called from the following routine and is basically because of the following code.
Form: xkomv_bewerten.
IF xkomv-kofrm NE 0 AND wertformel EQ space AND komp-kposn NE 0.* rettkomv = xkomv*.
xkwert = xkomv-kwert. frm_kondi_wert-nr = xkomv-kofrm. PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND. xkomv = rettkomv.
ENDIF.
During Change Sales Order, because of this even a billing block is set before, it is getting cleared without updating the price.
Can somone help me with this?
Thanks.
MartinHi,
Do one thing you could ask your functional consultant to restrict pricing update into IMG Guide. There is pricing where SD consultant restrict the Pricing Updates. If they have problem then let me i will tell you how and where you can do the pricing restriction.
Regds,
Rakesh
Edited by: Rakesh Kumar on Aug 8, 2009 1:35 PM -
Restrict Formula Calls in Sales Order Pricing
Hi All,
I have created a pricing conditon formula to get the price for the real time contract price from a third party Contract management system through a RFC call, and assigned the formula to a condition type.
In this formula, if there was an error i am exporting the error message to a memory and importing the value from that memory to set a billing block in the user exit SAVE_PREPARE_DOCUMENT (MV45AFZZ).
The problem i am facing is that the formula is getting called many times uncessarily for eg. when you click pricing etc
and not necessarily updates the price all times. Actually the price is not updated when called from the following routine and is basically because of the following code.
Form: xkomv_bewerten.
IF xkomv-kofrm NE 0 AND wertformel EQ space AND komp-kposn NE 0.* rettkomv = xkomv*.
xkwert = xkomv-kwert. frm_kondi_wert-nr = xkomv-kofrm. PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND. xkomv = rettkomv.
ENDIF.
During Change Sales Order, because of this even a billing block is set before, it is getting cleared without updating the price.
Can somone help me with this?
Thanks.
MartinI coded this logic in a 906 pricing routine... and I did not have any problem bcoz of multiple hits... SAP is taking care of when to update values as per the calculations I am doing here....
if I remember right SAPLV61A is the main program which will be included with all sorts of code related to routines..
* Call the RFC wrapper in a new task
CALL FUNCTION 'ZTEST'
STARTING NEW TASK taskname
DESTINATION 'NONE'
PERFORMING ret ON END OF TASK
EXPORTING
comm_head_i = wa_komk_i
comm_item_i = wa_komp_i
EXCEPTIONS
communication_failure = 1
system_failure = 2
resource_failure = 3.
IF sy-subrc EQ 0.
WAIT UP TO 1 SECONDS.
ENDIF.
* Get the values from the RFC shared memory export
CONCATENATE 'ZTESTVPRS' sy-uname INTO memid1.
IMPORT lt_komp = comm_item_e
FROM SHARED BUFFER indx(st) ID memid1.
wa_komp_o = comm_item_e.
IF sy-subrc EQ 0.
DELETE FROM SHARED BUFFER indx(st) ID memid1.
ENDIF.
* Get the Header level from RFC shared memory
CONCATENATE 'ZTESTVPRS_H' sy-uname INTO memid2.
IMPORT lt_komk = comm_head_e
FROM SHARED BUFFER indx(st) ID memid2.
wa_komk_o = comm_head_e.
IF sy-subrc EQ 0.
DELETE FROM SHARED BUFFER indx(st) ID memid2.
ENDIF. -
VA01 user exit to manually insert condition record for sales order
Hello Experts,
I have a req. to find a user exit through which I can insert a new condition record for a sales order everytime a sales order is created.
Whenever a sales order is created I should check whether condition types X and Y are being generated for the particular sales order.If yes I have to insert a new condition record with type Z for that sales order after some calculations.
Does anybody have an idea which user exit should be used so that my new condition comes up in the CONDITIONS tab for the sales order item.
Thanks in anticipation.
VipulHi,
What I suggest is suppose you want condition type say 'XXX' to appear with some calculated value only when condition type 'X' & 'Y' are present, then let the consultant define that condition type in pricing procedure, with 'Manual Entry not allowd flag on, so that nobody can overwrite the value calculated by your routine in condition type 'XXX' & let him 'attach; a routine say 901 to it. Now via VOFM in routine 901 you can put your logic. In routine 901 you can loop at xkomv & check if both condition types viz. 'X' & 'Y' are present. IF yes then calculate the value of condition type 'XXX' as per the logic required & pass it on to SAP by xkomv-kwert = w_amount, where w_amount is the value calculated by you as per the logic required.
I hope this helps,
Regards
Raju Chitale -
Change "multidimensional condition"
Hello Guys,
i hope anybody can help me.
I have following problem.
Program SAPLV61A
Include LV61AA55
* execute condition value formula not changing xkomv
* will normally be processed in xkomv_kwert_ermitteln
IF xkomv-kofrm NE 0 AND wertformel EQ space AND komp-kposn NE 0.
rettkomv = xkomv.
xkwert = xkomv-kwert.
frm_kondi_wert-nr = xkomv-kofrm.
PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND.
xkomv = rettkomv.
ENDIF.
I will change u201Crettkomvu201D in this subroutine.
But I can not do an u201CDirty assignu201D because it is a local variable.
Is it somehow possible, to change the local variable of SAPLV61A in the subroutine?
That is a formel of VOFM to change the value for a multidimensional condition.
In the default, I can not change it without creating double conditions. ( SAP Note: 1073779 Point 5)
Kind regards
FlorianHi Florian,
It is not possible to change the local variable values by the method suggested by Gaurav Sharan, you can only change global variables of the associated main program.
Now,
I will change u201Crettkomvu201D in this subroutine.
But I can not do an u201CDirty assignu201D because it is a local variable.
I didn't quite get what you mean by the above, anyways looking at the code,
IF xkomv-kofrm NE 0 AND wertformel EQ space AND komp-kposn NE 0.
rettkomv = xkomv.
xkwert = xkomv-kwert.
frm_kondi_wert-nr = xkomv-kofrm.
PERFORM (frm_kondi_wert) IN PROGRAM saplv61a IF FOUND.
xkomv = rettkomv.
ENDIF.
i guess you want to change RETTKOMV so that the changes are carried over to XKOMV is that right?
If your intention is to update XKOMV based on some custom logic, then you can use the below userexit for the same,
RV61AFZB - userexit_xkomv_bewerten_end it gets called at the end of the sub routine - xkomv_bewerten in LV61AA55.
Is it somehow possible, to change the local variable of SAPLV61A in the subroutine?
Not unless you do a core mod or implement an explicit enhancement(ECC 6.0).
Regards,
Chen -
Hi guys,
I am new with all this IPC stuff and I was wondering if you could help me with some questions.
I need to implement the following code:
if XKOMV-KSCHL != ZPCO
get the value from condition VPRS
else
value from condition XKOMV-KWERT
my questions are:
1. What method-object can I use to point condition ZPCO for my item to get its value??
2. Is there any standard to ge the value from VPRS?
Your help is highly appreciated as I do not see the exit of this problem!!
Thanks
AliciaHi Alicia
If you have access to the IPC directory on the files system, there is great API documentation available.
For the XKOMV structure, you can use the following java interface to access the various fields.
\ipc\doc\spe\apidocs\com\sap\spe\pricing\transactiondata\application\IPricingConditionUserExit.html
I think you use the method getConditionTypeName() to pull the XKOMV-KSCHL.
And you can use getConditionValue() to pull the XKOMV-KWERT as well as VPRS
Finally, to set the value when you are finished, you will simply do a "return <your value/variable>;"
Hope this helps!
Regards,
Ajay S Gupta -
Overflow during the arithmetical operation (type P) in program "SAPLV61A
hi,
I am getting this error in VA01(sales order)
Runtime error Compute_bcd_overflow
Except Cx_sy_arithmetic_overflow.
Overflow during the arithmetical operation (type P) in program "SAPLV61A
Error in particular line is.
1388 ADD xkomv-kwert TO komp-mwsbp.
Please give me the solution with detail decsription.How to solve with step by step.Hi,
Instead of directly assigning the value to xkomv-kbetr. Store the value in a temporary variable of type p length 13 decimals 2 . Multiply by 10^n to get the correct result.
Then assign the temp value to xkomv-kbetr.
Sample Code
DATA : lv_temp TYPE P length 13 decimals 2.
lv_temp = ( xkwert * 10^n ) / komp-mgame.
Then assign lv_temp to xkomv-kbetr.
To get proper value, you have to multiply or divide by 10^n .
Regards,
DPM -
User exit to update the incompletion log in sales order for pricing error
Hi experts,
I have to check the some mandotory pricing conditions in sales order, if that conditions are not exist in sales order then i need to show the information message as well as i need to update it in incompletion log of sales order. (incopletion log we can see on menu bar 'EDIT' or ctrl+F8 on main screen of VA01). So that user can save the sales order but it will be in incomplete status.
I have completed it upto showing the information message using user exit 'MV45AFZZ', but after this i don't know how to update it in incompletion log of sales order for pricing. I tried to update in tables VBUK-UVPRS, but i am not getting the desired result.
Please anyone can tell me how to update it. In which user exit i can update the incompletion log.
Thanks and Regards,
Vicky.Hi Vinod,
I am sending you my code please check it,
if TKOMK-SPART = 10.
if XKOMV is not INITIAL.
clear v_JEXP.
READ TABLE XKOMV with key kschl = 'JEXP'.
if sy-subrc = 0.
check XKOMV-kwert = 0.
message i003(ZT) with 'Value should not be 0 for conditioin type JEXP'.
v_JEXP = 'X'.
else.
message i003(ZT) with 'Maintain the mandatory Conditioin type JEXP'.
v_JEXP = 'X'.
endif.
if v_JEXP = 'X'.
XVBUV-MANDT = sy-mandt.
XVBUV-POSNR = '000010'.
XVBUV-TBNAM = 'VBAP'.
XVBUV-FDNAM = 'PRSOK'.
XVBUV-FEHGR = 20.
XVBUV-STATG = '06'.
XVBUV-FCODE = 'PKON'.
XVBUV-SORTF = 9999.
XVBUV-LFDNR = 0000.
XVBUV-UPDKZ = 'I'.
append XVBUV.
endif.
endif.
endif.
Please suggest something to solve this.
Thanks and Regards,
Vicky. -
Cost Price for Returns order adopting cost from preceding billing doc
Hi Forum Experts,
Our Returns Order (SO) currently obtains cost price (VPRS) based on material moving average price.
However, what we really need is to copy the cost price from the preceding Billing Document.
I've explored using VOFM and created a routine under (Formulas --> Condition Value) as per below.
I found that while the debugger steps through this code, the value of the cost gets copied from the preceding document.
However, immediately after the code finishes execution, the value gets resetted back to the material moving average price again.
What can I do do let the system keep the copied cost price from the preceding document instead?
FORM FRM_KONDI_WERT_998.
DATA: lv_kbetr TYPE kbetr,
ls_vbfa TYPE vbfa,
lv_knumv TYPE knumv.
IF SY-TCODE = 'VA01' OR SY-TCODE = 'VA02' OR
SY-TCODE = 'VA21' OR SY-TCODE = 'VA22'.
IF xkomv-kschl EQ 'VPRS'.
Get billing doc and position
SELECT SINGLE vbelv posnv
INTO corresponding fields of ls_vbfa
FROM vbfa
WHERE vbeln EQ komp-aubel "returns order number
AND posnn EQ komp-aupos "returns order item
AND vbtyp_n EQ 'H' "returns order
AND vbtyp_v EQ 'M'. "invoice
IF sy-subrc EQ 0.
Get billing doc conditions key
SELECT SINGLE knumv
INTO lv_knumv
FROM vbrk
WHERE vbeln EQ ls_vbfa-vbelv.
IF sy-subrc EQ 0.
Get moving average price from billing doc conditions
SELECT SINGLE kbetr
INTO lv_kbetr
FROM konv
WHERE knumv EQ lv_knumv
AND kposn EQ ls_vbfa-posnv
AND kschl EQ 'VPRS'.
IF sy-subrc EQ 0.
Recalculate condition values
xkomv-kbetr = lv_kbetr.
xkomv-kwert = lv_kbetr.
xkwert = xkomv-kwert.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM.
Regards,
EdricHi,
If you bring the Freight condition after PBXX and include in the net value, your problem will be solved. so it will be 120 in MIGO, MIRO, Dellivery and VPRS in billing.
We have the same situation and its working fine for us.
Thanks
Krishna. -
Hi,
For specifyic condition types, i need the condition values to be displayed always in 'INR', i have created a formula routine for this and assigned to my pricing procedure .
structures i am changing are XKOMV and KOMK.
using 'CONVERT_TO_LOCAL_CURRENCY' i am converting the amount
( xkomv-kwert ) into indian currency value and for currency key
i have passed 'INR' to komk-waerk field
here i am facing 2 problems, after coming out of my include xkomv-kwert is getting overridden by old value in some other include, hence i am getting the same old value on the screen and currecny key is getting dislayed as 'INR' for all the records not just only for my condition type.
Can you pls correct me if what is done by me is wrong
Regards,
SowjanyaAn amount in local currency is calculated from a specified foreign currency amount. For this, you may either specify the translation rate manually (Parameter RATE) or have the system determine it from table TCURR on the basis of the rate type, date and currency key. Because the ratios for the units of the currencies involved in the translation are significant for this translation, table TCURF is always read by the program, and there must be a valid entry there for the data specified. IF exchange rate fixing is defined for the exchange rate type TYPE_OF_RATE or an alternative exchange rate is defined for the currency pair, this information is transferred to the calling program.
When table TCURR is read, the foreign currency key is always taken as the first part of the key and the local currency as the second part.
or you can also do the manual conversion by taking the exchange rate from table TCURR for the particular date and multiply this exchage rate to foreign amount then to get the amount in local currency.
hope this will work.
Maybe you are looking for
-
How to create a Idoc after a salesorder is created.(Different approaches.)
Dear Experts, First of all I would like to thank SDN as continuously helping me to deliver better and faster. My requirement is to generate a Custom idoc whenever a SalesOrder is created. with net value more then 1,00,000. Can u please help me by
-
Bug in FF Adbobe Reader Plugin?
Hi, i use a web application which pulls pdf reports from a server by http-post requests, so parameters are transmitted in the requests-body. As a viewer i do use Acrobat Reader Plugin, most recent release with FF 3.0.3 on Windows XP pro. So due of t
-
Calling a servlet from another servlet?
Hi I would like to know that how can I call one Servlet from another Servlet. I have tried getServlet() method of ServletContext but it has been deprecated. I want to call a specific method of the other Servlet, is there any other way? Thanks
-
Dear Gurus, am trying to change the mov avg price from 192.83 to 200...while doing this in mr21 am getthng error as " Valuation BM11 NOT MAINTAINED FOR MATERIAL 40000001"....kindly suggest me how to solve this issue...Thank you..
-
I had problems with my Dual 1.8 GHz PowerPC G5 running 10.3.9, so I had to reinstall the system software. I tried to reinstall CS2 and after unistalling and deleting every adobe program on the computer, the install fails. I am able to go through th