What is the best field type for currency calculations?

Hiya,
I am doing a load of currency calculations e.g. here's one line of it
The 'Total' fields I am using for doing/totalling my calculations has been defined as a local variable that reference an amount field setup in the data dictionary as:
So in my program I am using these 2 decimal field.
Of course I now realize this is a problem, as lots of rounding occurs and my values are way out when you deal with amounts in the millions.
Does anyone know what type of variable they think is best for doing currency calculations?
And could you provide a simple example?
Many thanks!

Hello Robert,
I guess you can go ahead with ATFLV, incase if you want to display as a currency, you can use the function module  KKEK_CONVERT_FLOAT_TO_CURR.
DATA: c_lv_float TYPE ATFLV VALUE '4.4500000000000000E+02',
      c_lv_curr TYPE WAERS VALUE 'EUR',
      c_lv_currval TYPE NETWR_AP.
CALL FUNCTION 'KKEK_CONVERT_FLOAT_TO_CURR'
  EXPORTING
    float_imp          = c_lv_float
    curr_imp            = c_lv_curr
IMPORTING
  CURR_FIELD_EXP      = c_lv_currval
EXCEPTIONS
  OVERFLOW            = 1
  OTHERS              = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ c_lv_currval.
Output: 445,00
Regards,
TP

Similar Messages

  • What is the best data type for wallet application?

    Hi Friends..
    I want to know what is the best data type for wallet application..
    Assume that, i want to the Total of money saved digitally in Applet Wallet..
    And then if there's any transaction the Total of money which saved digitally in Applet Wallet would be Subtracted or Added depends on how much money that spent or saved..
    Which one is the best implementation of these scenarios :
    1. I save the User ID and Total of money in the Java Card, and then if there's any transactions, it would be added or subtracted directly and then saved again in the Java Card
    2. Or.. I save the User ID in the Java Card whereas Total of money in the Database, and then if there's any transactions, the ID would be read from the Card, and then select the Database based on that ID, and then Add or Subtract the money depends on how much money spent in the Transaction
    Please help me regarding this
    Thanks in advance

    Hi,
    Personally I would choose to store the total amount stored on the card. You could use two shorts (short[] perhaps) to store an integer (add more shorts to increase precision) and simply handle overflow your self. You could even look into using a third party library (or class) that treats a byte array as a big integer etc. There were some posts recently on floating point arithmetic that could be helpful for you since you will probably want to use decimals and JC does not natively support floats.
    Cheers,
    Shane

  • WHat is the best index type for non uniqueness / Varchar columns in SQL 2008 R2

    Hello All Greetings,
    Please help me here with my doubt,
    in my table i have two columns about a million rows, it has about 20 columns in it, three columns with name as Period, Gender so most of the time these two columns use in where clause,
    Gender  will contain Either M or F , Period contains YYYY-Month (2013-December, 2013-August) etc so i would like to add a Index to these two columns so that in will increase the performance, so please let me know what type of indexes i need to add to
    these columns in the table,
    please note that only one time we will add data to the table which will take only 2 minutes but we query the table every day
    so my question what is the best index type that i need to create on columns with non uniqueness values in the column.,
    Thank you In Advance,
    Milan

    There is nothing whatever wrong with creating an index on a VARCHAR column, or set of columns.
    Regarding the performance of VARCHAR/INT, as with everything in a RDBMS, it depends on what you are doing. What you may be thinking of is the fact that clustering a table on a VARCHAR key is (in SQL Server) marginally less efficient than clustering on a monotonically
    increasing numerical key, and can introduce fragmentation.
    Or you may be thinking of what you have heard about writing JOINs on VARCHAR columns - it is true, it is a little less efficient than a JOIN on numeric type, but it is only a little less efficient, nothing that would lead you to never join on varchar cols.
    None of this does not mean that you should not create indexes on VARCHAR columns. A needed index on a VARCHAR column will boost query performance, often by orders of magnitude. If you need an index on a VARCHAR, create it. It makes no sense to try to find an
    integer column to create the index on - the engine will never use it.
    Check this reference: http://stackoverflow.com/questions/14041481/is-it-good-to-create-a-nonclustered-index-on-a-column-of-type-varchar
    Mark ANSWER if this reply resolves your query, If helpful then VOTE HELPFUL
    INSQLSERVER.COM
    Mohammad Nizamuddin

  • What is the best font size for text when making a book in iBooks Author? My present font is Baskerville at 20 pt.

    What is the best font size for text when making a book in iBooks Author? My present font is Baskerville at 20 pt.

    For what audience? What reading level? Which Flesch-Kincaid index? What type of content? How much white space? What language(s)?

  • What is the best charging cable for the iPad Air (that is not made by Apple)? I need a long cable (over 6ft or more). I also need the cable to be of high quality and the cord part of the cable to be made of strong material.

    What is the best charging cable for the iPad Air (that is not made by Apple)? I need a long cable (over 6ft or more). I also need the cable to be of high quality and the cord part of the cable to be made of strong material. Apple does not make one this long. Is there a cable out there that is sturdy like this and is safe to use?

    yes, but I'm trying to use my iPad to type notes (using pages) and I have the smart case which I use as a stand. I need a cable long enough to fit through the back of my desk and the charging brick for the iPad won't fit behind the desk. I have to put it on the floor and then the apple cables aren't long enough to reach.

  • What is the best antivirus software for a Macbook Pro...I recently received a message from Google that someone made an attempt to hack into my mail account so I needed to change my PW and verify myself as the user.  The message suggested that I run a scan

    What is the best antivirus software for a Macbook Pro...I recently received a message from Google that someone made an attempt to hack into my mail account and I needed to change my PW and verify myself as the user.  The message suggested that I run a virus scan to check for sny malware or other types of viruses.  I do not have any software for this and up until now have not had a problem....any help is appreciated.  I would like a simple but effective solution!

    It's worth noting that if your Gmail has been hacked, it would likely have nothing to do with your MacBook.  Hacking web based email is fairly common and it doesn't require any access to your machine whatsoever.  In the same way that you can simply go to the Gmail webpage through any browser, any hacker can use the same method.  It doesn't mean your machine has been compromised in any way (and it has likely not been).  I have never received an email from Google of this nature.  I have received notifications when someone has attempted to create an account with my name in which they basically say that there is no action required if you're the rightful owner.

  • What is the best data type to store XML string

    Hello all,
    If we want to store a XML string in oracle database table for some other program use what is the best data type that we can use in the table to store this XML string..
    Is it VARCHAR? or can we use BLOB type
    Anybody to help please
    Message was edited by:
    user483578

    If your XML data will not be larger than 4000 characters then use VARCHAR2 else CLOB. I don't see a need to use BLOB (unless your XML data contains binary information).

  • What are the best AirPlay speakers for Apple devices?

    What are the best AirPlay speakers for Apple devices? I would like to get some good speakers to be used with my iPod, iPhone and iPad. Ideally, they should be able to play using AirPlay and be quite powerful, but with a good design if possible.
    I am particularly interested in the Fidelio range of speakers by Philips.
    Thank you for your help in advance.

    Best is going to be a matter of opinion.  What environment are the speakers going to be used in? How large is the room? What type of music are you going to play? What features/functions would you like in the speakers? What price range are you looking for?  All of these are going to effect which speakers will best fit your needs.

  • What's the best protective shield for my 3GS?

    Hi Everyone,
    Sorry to bother, but I just got a new iPhone 3GS and I'm wondering what's the best protector to put on the phone. I understand the 3GS has a new type of "coating" on the screen so I don't want to do any damage to it. I also heard the 3GS has these proximity sensors so I don't want to get a case that will interfere with that. Anyhow, I wanted to get an Invisible Shield, a full body one, but wanted to make sure I don't do damage to the phone. I've read the forums and it seems there is no definitive answer on whether or not the Invisible Shield is the best one. Any iPhone experts know what's the best protective shield for the 3GS? And will the Invisible Shield do any damage to the screen or coating on the new 3GS? I talked to a person at Apple and they didn't think it would do any damage, but to be honest, she didn't sound as knowledgeable as I would like. I'm sorry for being paranoid. Can you guys chime in?
    Thanks!

    The reason for no definite answer is that it matters what YOU are looking for in a case or protective screen cover...
    To answer your shield question...the shield product itself will not damage the phone and that coating is not to prevent scratches...it's to help prevent fingerprints...since you plan to put a screen cover on then that coating doesn't really matter...HOWEVER, the way that the shield can harm the phone is IF it's not properly installed by YOU...since the design of that product calls for a liquid solution agent to be used to adhere the cover to the case of the phone, others have gone overboard with that liquid and then ended up with water damaged phones due to the faulty install...If you install properly then it's not an issue
    Personally I used a full shield cover on a previous phone and hated it...so again it's all up to your taste...
    What I currently have now is the simple Apple sold Anti-Glare screen cover you can buy two to a pack for 15.00 at Apple store...I have used since first Gen iPhone and loved it...
    I have a Case-Mate leather hard plastic case but am not thrilled with it since the edges are raised around the edges of the screen and sometimes prevent me from hitting a button right up against the screen edge...so I don't use it much...
    Other covers made by Case-Mate like the Barely There cover don't have that problem...so you really need to shop around and see what case you like and what you dislike...
    Cases specifically sold to be compatible with 3GS will not interfere with either the proximity or any other sensor on the phone face...

  • What is the Best Safari Version for OS 10.9.5 Maverick on a MacBookPro, 2.4Ghz, 8 GB Mem.?

    What is the best Safari Version for OS 19.9.5 Maverick on a MacBook Pro. 2.4 Ghz, with 8 gb memory?

    The best version for Mavericks, in fact the only version, is an integral part of OS X. In other words you already have it.
    Its version number is 7.1.5.
    Keep OS X up to date: Update OS X and App Store apps on your Mac - Apple Support

  • I am a new mac user and I switch to mac due to the graphics that it brings. I do website in pc and I heard iweb is the best.NOW i heard that iweb will be discontinue. so what is the best application there for website using MAC OSX lion?

    I am a new mac user and I switch to mac due to the graphics that it brings. I do website in pc and I heard iweb is the best.NOW i heard that iweb will be discontinue. so what is the best application there for website using MAC OSX lion?

    It is now confirmed  that iWeb, and iDVD, has been discontinued by Apple. This is evidenced by the fact that new Macs are shipping with iLife 11 installed but without iWeb and iDVD.
    On June 30, 2012 MobileMe will be shutdown. However, iWeb will still continue to work but without the following:
    Features No Longer Available Once MobileMe is Discontinued:
    ◼ Password protection
    ◼ Blog and photo comments
    ◼ Blog search
    ◼ Hit counter
    ◼ MobileMe Gallery
    All of these features can be replaced with 3rd party options.
    I found that if I published my site to a folder on my hard drive and then uploaded with a 3rd party FTP client subscriptions to slideshows and the RSS feed were broken.  If I published directly from iWeb to the FPT server those two features continued to work correctly.
    There's another problem and that's with iWeb's popup slideshows.  Once the MMe servers are no longer online the popup slideshow buttons will not display their images.
    Click to view full size
    However, Roddy McKay and I have figured out a way to modify existing sites with those slideshows and iWeb itself so that those images will display as expected once MobileMe servers are gone.  How to is described in this tutorial: #26 - How to Modify iWeb So Popup Slideshows Will Work After MobileMe is Discontinued.
    It now appears that the iLife suite of applications offered on disc is now a discontinued product and the remaining supported iApps will only be available thru the App Store from now on. However, the iLife 11 boxed version that is still available at the online Apple Store (Store button at the top of the page) and those still on the shelves of retailers will include iWeb and iDVD. Those two apps were listed in small, gray text on the iLife 11 box that I bought.
    Personally, if I didn't already have a copy I would purchase one to have it for reinstallation purposes if ever needed.
    This might be of some interest to you at this time: Life After MobileMe.
    OT

  • HT1338 What is the best online storage for photos. Specifically one that allows the original image quality to be downloaded should your hard storage goes belly up

    What is the best online storage for photos. Specifically one that allows the original image quality to be downloaded should your hard storage goes belly up

    I'd put them on an external hard drive(s) and burn them to a DVD as well (at least 2 - 3 copies on different drives/media); I prefer having control and a local solution instead of relying on a server and the possibility of someone (who shouldn't be)  downloading my work.

  • HT4664 What is the best graphics card for FCPX?

    In the nonstop anti-FCPX propaganda is an article of interest — posted 7/9/12 — comparing the benchmarks of FCPX and PP6.
    http://www.streamingmedia.com/Producer/Articles/ReadArticle.aspx?ArticleID=83582 &PageNum=1
    The system used was a 2 x 2.93 GHz Quad-Core Mac Pro from early 2009 running MacOS X version 10.7.4 with 12 GB of RAM and an NVIDIA Quadro FX 4800 graphics card with 1.5 GB of onboard RAM.
    In most cases PP6 outperformed FCPX with this configuration. However, in the comments Ben Balser pointed out that FCP X's A/VFoundation engine wasn't ideal on the NVIDA card:
    "Quadro is actually not the best card for FCP X's A/VFoundation engine, but great for CS6's Mercury engine, so the test is amazingly flawed right there. Try both on a 5780 card and watch things drastically change. I've done that test myself. Exporting to Compressor uses a MUCH more sophisticated encoding engine meant for higher level, professional transcoding, not simple outputs, which are faster using Export Media…"
    Apple lists this card on its support page: http://support.apple.com/kb/HT4664
    So,
    What is the best graphics card for FCPX?

    Ben,
    Thanks for chiming in on that article. It would be good to have a benchmark comparison with the two systems each with a preferred card.
    I'm hoping to see some other comparisons on this thread. Also, some links to other articles about best practices and configurations.

  • What is the best Compressor setting for best quality video playback on an iBook g4?

    I know the iBook and G4's in general are very outdated today, but I need to ask anyways. I have some video projects in 720p and 1080p in which I have down converted to 480p and also exported to MPEG-2 for DVD (personal wedding videos and videos made for my clients using Final Cut Studio). Anything encoded at most resolutions using h264 won't play on my iBook. Even 480p.
    I have about 20 hours of mixed video content that I need it in a format that is suitable for an iPhone 4 and an iBook 12" with a 1.2GHz G4, 1.25GB RAM and I added a 250 WD 5400 IDE hard disk (running 10.5.8 and 10.4.11 for Classic Mode). I know the iBook doesn't seem like the best tool for modern video playback, but I need to figure out which setting will play best with iPhone 4 and iBook so I don't need to make 2 local copies of each video for each device.
    The iBook plays best with the original DVD output MPEG-2 file and playing back in QT Pro or VLC... but I already have 180 GB's of MPEG-2 files now and my little HD is almost full. I don't have enough room to convert all the iPhone 4 counterparts. If I use Compressor 3.5.3, what is the optimal setting for iBook and iPhone .m4v or .mp4 files that can play on both devices? So far 720x400-480 widescreen videos @ 29fps works great on my iPhone, Apple TV 2, and other computers but seems to murder my poor iBook if encoded with high profile (and still choppy on simple profiles). 640x480 (adding black matte bars to my videos) plays fine in MPEG-2 but drops frames or goes to black screen if I convert it to mp4 (and looks bad on the iPhone 4 because of the matte). But if I convert on any of the simple profiles, it looks terrible on my iPhone 4 and a blocky on the iBook.
    This is the problem leading me to having 2 copies of each video and eating my hard disk space. What is the best video setting for both playback on the iBook and iPhone 4? Can the iBook playback H264 at all in decent resolutionsat all? I don't really want to have a 480p .m4v collection for the iPhone 4 and a MPEG-2 RAW collection just to play the same videos on the iBook.
    Any suggestions are greatly appreciated! Thanks!

    Update: The iBook can play any 480p video and higher if I encode them with DivX and in AVI format. But of course this is not compatible with my iPhone 4. At least I can shrink my library now and get away from the full MPEG-2s. I don't get why I can't use Apple's h264 though. There has to be a setting I am missing. The sample Apple h264 videos from the days of Tiger worked flawlessly on my iBook when it was new so the CPU must be capable of decoding it. I really can't understand this.
    Also, since I made my videos in English for my family, I had to create soft subtitles for my wife's Chinese family, and I can't get players like QT with perian or MPlayerX to sync them properly to an AVI encoded with DivX, they only sync well with the iPhone 4 m4v/mp4 formatted files I made. This is a real pickle.
    So now I may need three or four copies of each video, LOL. I need to hardcode the subtitles if I want to use AVI to playback on older machines, and keep the mp4 file for the iDevices too, while keeping higher quality h264 videos for my American relatives...
    If h264 is compatible with my iBook, what is the proper encoding settings? Must I dramatically lower the settings or frame rate? I can settle on 2 copies of each video that way. One iBook/G4/eMac compatible video that syncs correctly with my srt soft subs, and another version that works well with my iPhone 4 and iPad.
    All in all, I will end up with more than 3 or 4 version of each video. On my late G5 dual core I have the full 720-1080p uncompressed master files. On my i5 iMac I have the h264 compressed versions for distribution, and lower versions for my iDevices. Now I need to keep either full MPEG-2 files for the iBook to play, or convert to older formats like DivX AVI for our family's legacy machines. I am running out of hard disk space quick now, LOL.
    Is there an easier way?

  • What are the best plug ins for iMovie 11 running on Lion?

    What are the best plug ins for Imovie 11 or Imovie HD running  Lion? Especially transitions & effects for still pictures.
    Thank you

    Hi
    For iMovie'08 to 11 - There are no Plug-ins - not supported at all
    iMovie HD (in reality HD5) - doesn't work under Mac OS X.7 - at all
    iMovie HD6 - can take Plug-ins and run under Mac OS X.7 - BUT some of the Plug-ins doesn't work under X.7
    old list on - Plug-ins - Only relevant to  iMovie HD6 (May be they are too old)
    Stupendous software
    www.stupendous-software.com
    GeeThree   
    www.geethree.com
    cf/x.
    www.imovieplugins.com
    Apple
    www.apple.com/downloads/macosx/video/ezediapluginsforimovievol1.html
    www.imovieplugins.com/fxhome.html 
    fxStabilizer - for iMovie - Google it
    Yours Bengt W

Maybe you are looking for