Skip to main content

Rounding off of Amount fields in SAP

I remember, when I learnt COBOL, our instructor used to give us problems to solve. One of the problems often repeated in all programming classes was to write the code for rounding off numbers, without using built in functions. In SAP it is a bit tricky, as SAP stores amout fields as currency types. These fields are stored internally with 2 decimals, irrespective of the currency used. It can be easily done using write statement if you want to round the amount field in the report. How to do it if you want to round it store it as a currency amount field itself. This is a problem in SAP query reports. In my case the user wanted to amount fields to appear rounded to nearest integer. SAP has some built-in-functions like ceil, floor but they can not be used as it is, due to the fact that the amount is stored internally with 2 decimals. Most of the currencies are with 2 decimals and it is still not a problem. This can be easily achieved by the following operation. A constant need to be defined with value 0.5. rounding is achieved by amount = floor( amount + constant ). How can this be done for currencies with other than 2 decimals. For example, Bahraini Dinar, Omani Riyal, Japanese Yen. The concept is same, but with an additional conversion. There is a BAPI function module to convert currency fields to external and vice the versa. Using these FMs convert the amount to first external format. Apply the formula as mentioned above and again using the BAPI FM convert it back to internal format.

Comments

Anonymous said…
Hello there people, I just signed up on this wonderful community forum and desired to say hey there! Have a excellent day!
Anonymous said…
Genial brief and this mail helped me alot in my college assignement. Thanks you on your information.

Popular posts from this blog

Vendor Consignment Business Process

Wikipedia offers a very simple definition for consignment . It is a process of placing a thing in the hand of another, but retaining the ownership until the goods are sold or used. In SAP consignment business process can be implemented very easily using the following steps. Activate Consignment inforecords using tcode OMEV. This activates the consignment prices to be picked up using the consignment info records. configure a special procurement type using IMG->Production->MRP->Master Data->Define special procurement type. In OBYC configure the consignment payables account (transaction KON). Assign the special procurement type created in step 2 to all the materials that are to use the consignment process. This is done in the MRP2 view of the material master maintenance transaction Create Consignment info record using tcode ME11. Select info category as consignment. Create general data, Purchase Org data and conditions. Conditions allow you to create time dependent prices. Cre...

Unlimited overdelivery tolerance flag is reset!

Haaaaa. I am back after after a looooooong break. I have decided to keep posting more regularly now :-). This one is what we usually face after the stacks. I like to call it PSM (Post Stack Misbehaviour). Sap Note 1580025 in Stack 10 caused a problem where by, any change to Purchase Order item (delivery date, schedule qty, Purchase order qty, price etc.), resets the unlimited over delivery tolerance flag. Usually the unlimited over delivery tolerance flag is defaulted from Inforec. This might create nasty issues for the business, where business might be expecting the GR to go through smoothly, it will end up in error.The probelm is solved by applying note 1644491.