Skip to Content
0
Mar 06, 2009 at 04:38 AM

decimals changed!!!

31 Views

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,