2009 Mar 06 4:38 AM
hi folks,
i am stuck in one doubt i have a piece of code which i execute for creating a po in sap where the quantity is 50 and price is 800 after gettin into sap its getting stored as
price PerOP U Matl GrouP
80,000.00 100 EA 007 3
where as in need to get it stored as 800.0000 with four digits after decimals can u guide wat changes i need to do....
LOOP AT po_items.
CLEAR: before_decimal, after_decimal, len_after_decimal, power.
only check when price field is not empty
IF NOT ( po_items-net_price IS INITIAL and po_items-item_cat = 'D').
MOVE po_items-net_price TO price.
split the netpr into before decimal and after decimal
SPLIT price AT delimiter INTO before_decimal
after_decimal.
len_after_decimal = STRLEN( after_decimal ).
adjust netpr, peinh field only if netpr field has
more than decimal allowed found
IF len_after_decimal > decimal_allowed AND decimal_allowed > 0.
power = len_after_decimal - decimal_allowed.
po_items-price_unit = 10 ** power.
po_items-net_price = po_items-net_price * po_items-price_unit.
MODIFY po_items.
ENDIF.
ENDIF.
MOVE-CORRESPONDING po_items TO l_poitems.
APPEND l_poitems.
ENDLOOP.
Thanks,
2009 Mar 06 4:42 AM
check the value of NETPR before passing to FM and check if NETPR accepts 4 decimals or not. I guess the value is getting multiplied by 100 and giving the result.
hi,
In EKpo ,NETPR is of type Curr decimals 2.
So,it will store the value with only decimals in the screen field of Po
2009 Mar 06 4:42 AM
check the value of NETPR before passing to FM and check if NETPR accepts 4 decimals or not. I guess the value is getting multiplied by 100 and giving the result.
2009 Mar 06 4:47 AM
hi,
In EKpo ,NETPR is of type Curr decimals 2.
So,it will store the value with only decimals in the screen field of Po
2009 Mar 06 4:50 AM
wat should i do to make it store as 4 digits after decimal any hard code ....
2009 Mar 06 8:50 AM
Hi,
If u want that field to store with 4 decimals in your program, then
take packed variable with decimals 4 and move netpr to this.
data w_p type p decimals 4.
w_p = netpr.
2009 Mar 06 4:50 AM
Hi
Code
power = len_after_decimal - decimal_allowed.
po_items-price_unit = 10 ** power.
is having problem. It multiplies your vaue with 10 power.
Regards
Aditya
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |