08-25-2015 9:37 AM
Hello Everyone,
here is the issue i am having
the above screen is from invoice --item condition detail .
I am writing a routine in VOFM to change the condition value .
what is want is condition value = condition base value * amount = 211.28 * 3 = 633.84
This is the code i am using
FORM FRM_KONDI_WERT_900.
IF XKOMV-KAPPL = 'V'.
IF XKOMV-KRECH = 'C'.
xKOMV-kwert = xkomv-kbetr * komp-mgame / 1000.
ELSE.
ENDIF.
ENDIF.
ENDFORM.
when i debugg xkomv-kwert has the value 633.84 but in the invoice screen it prints 633.83 only .
please help to figure out why it is happening so .
Thank you so much .
pooja
08-25-2015 9:51 AM
This is because of decimal place assignment. Your currency field displays 211.28 because on your screen this has 2 decimal places, but in reality this field has more decimal places therefore the value might actually be 211.2780, in which case when you multiply this by 3 you get 633.8340, which in turn equals 633.83 when you display only the first 2 decimal places.
08-25-2015 9:59 AM
Hi Pooja,
It may be the problem due to Fixed point Arithmetic. The main program for the routine SAPLV61A does not have fixed point arithmetic ticked.
So what you should do is create a custom FM and put all your code inside that FM and call that FM instead of directly writing the code inside the routine and make sure your Function group does have "Fixed point Arithmetic" ticked in the main program and use Go To - > Attributes.
R
08-25-2015 10:44 AM
Hello Rudra ,
I am not getting the FM concept . Can u help me with an example .
Pooja
08-25-2015 11:04 AM
Hi,
1. Create one FM importing KOMP and CHANGING XKOMV.
2. Set "Fixed point arithmetic" checked in the attributes main program of your Function group.
3. Put all the logic inside the FM.
4. Call the FM inside your routine passing KOMP and XKOMV.
R
08-25-2015 12:56 PM
08-25-2015 1:38 PM
Hello Rudra ,
i searched SCN and got some clues .here it is
in my condition routine I want to change xkomv-kbetr.
After my code, there is standard SAP code which overwrite my xkomv value.
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.
the answer is
Use Implicit enhancement at the end of subroutine/FM whichever applicable & overwrite back to your desired value.
Pooja
08-25-2015 1:45 PM
Hi again,
I know this code. But for me you don't have to do any coding in implicit enhancement. That is the idea of using condition calculation routine.
But if it solves your issue go ahead. I am sorry I cannot suggest this technique.
R
08-25-2015 10:03 AM
Hi,
Try to first Multiply the value and then divide in a separate executable statement as below.
XKWERT = xkomv-kbetr * komp-mgame.XKWERT = XKWERT / 1000.Hope this helps.08-25-2015 10:43 AM
Thank u rahul. i tried but did not work . same value only comes . any other input
08-25-2015 10:30 AM
Hi pooja,
If you see the characteristic of mgame field, it's QUAN with 13/3.
In decimal it will contains 3 decimal value. while rounding, may be final value would be 633.836/7/8/9, that's the reason 633.84 is coming.
Try to calculate the value manually and check the final result.
try to use kbetr data type for mgame field and then do the all calculation.
logic would be
check XKOMV-KAPPL = 'V'.
check XKOMV-KRECH = 'C'.
xKOMV-kwert = komp-mgame.
xKOMV-kwert = xkomv-kbetr * komp-mgame / 1000.
regards,
Praveer.
08-25-2015 10:42 AM
Hello Praveen ,
This is what i get while debugging
But on the main invoice condition item detail screen
my question is why in debugging the value is 1721.43 and the value on screen is 1721.44
i want the value 1721.43 on screen as well
thank you so much