Currency formating with pattern specified

Hi,
I am trying to format value with Currency,in which I am successful.
Now I want to apply some specific pattern over a number and then
it should give me Currency formated value.
For e.g.
My value is "5000.25"
I apply patter formating over it like #,##,#.00
I convert it into currency so I should see in (US Locale)
$5,00,0.25
In below code I can achive either of them If I comment
"applyLocalizedPattern" method.
import java.text.DecimalFormat;
import java.util.Locale;
import java.text.*;
import java.util.*;
import sun.text.resources.LocaleData;
public class CurrencyFormat
     public static void main(String args[])
          NumberFormat useFormat = NumberFormat.getCurrencyInstance(Locale.US);
          DecimalFormat dc = (DecimalFormat) useFormat;
          DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
          double amount = 5000.25;
          symbols.setCurrencySymbol("*");
          dc.applyLocalizedPattern("#,#,#,#.00");
          dc.setDecimalFormatSymbols(symbols);
          System.out.println(useFormat.format(amount));
}

if you define a custom format that doesn't include any currency sign like "#,#,#,#.00", the currency sign is not added... to make it use the currency sign as per the docs "\u00a4 #,#,#,#.00"dc.applyLocalizedPattern("\u00a4#,#,#,#.00");

Similar Messages

  • The problem about inputDate with pattern specified for 24h time.

    Hi all,
    i want to use pattern specified for 24h time for inputDate,
    format mask like:yyyy-MM-dd HH:mm:ss
    at runtime,the inputDate value is :2011/09/27 22:05:59 ,
    but the value is 10:05:59 in Calendar Dialog.
    then click OK button,the inputDate value becomes :2011/09/27 10:05:59.
    This is normal?
    thanks in advance.

    Hi,
    Did you try as follow,
    using <af:convertDateTime>
    <af:inputDate >
              <af:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>
    </af:inputDate>See
    http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_convertDateTime.html
    http://blogs.oracle.com/Didier/entry/how_to_specify_a_second_date_p

  • Help needed to display character vaiable in currency format

    Hi Friends
    In a SAP Script I am passing a currency field to the subroutine as an i/p parameter and since it gets converted to character format in subroutine because of 'itcsy' , ihave deleted the trailing zeroes and decimal points from the field and performed calculations on the field, now i need to pass this char field back to SAP script but i need to display that field in currency format with commas and decimal points in the script...how do i do that???
    Thanks
    Vishal.

    Hi Vishal,
    When you pass the currency amount into the perform, no need to remove the trailing zeros and the decimal point.
    Only thing you need to remove is the comma seperator as it gives a runtime error during calculation.
    To convert it back to the format with comma, write the below command:
    WRITE v_Item_total currency '2' to v_item_char.
    CONDENSE v_item_char.
    Here v_item_total is a number which is converted to comma seperated number and passed to char variable.
    This char variable is then passed to the SCRIPT.
    regards,
    Gaurav.

  • Currency format in Spreadsheet tables uses period's instead of comma's

    Xcelsius 2008 SP3.  I have inserted a spreadsheet table into my model, the columns are formatted in a currency format with $ and the thousand's separator that is displaying in the table is a period instead of a comma.  Has anybody else seen this problem?

    Hi,
    yes, I`ve had the same behavior. As a workaround, you have to change the format of the cells.
    Go into the properties of the cells:
    -> Right mouse click
    -> format cells
    -> category
    -> number
    -> change something, e.g. the number of decimal places to show
    Then you will have to map the component again to the same cells under "Display Data".
    And now, the currency information will be shown correctly.
    Regards
    Victor

  • Currency format combined with if else issue

    Hi all,
    Basically, I need to get the value from if else statement, then use currency format to format the currency according to their currency code.
    the following is my if else statement to show the A.PAY_PROMISE_AMT or A.PROMISE_AMT
    <?xdofx:if A.PAY_PROMISE_AMT <> 0 then
    A.PAY_PROMISE_AMT
    else
    A.PROMISE_AMT
    end if?>
    <?format-currency:value_*[this value I want to use is the value from the above if else statement];*currencycode; ‘false’?>
    could anyone help me to combine those two statement to get the result I want?
    Thanks in advance

    >
    I tried your solution, but I got some error.
    >
    some?
    try change
    <>to
    !=in my sample
    what if you try IF without xdofx?
    what will be result?
    say
    <?if:A.PAY_PROMISE_AMT!=0?> <?xdoxslt:set_variable($_XDOCTX, 'LVar', A.PAY_PROMISE_AMT)?> <?end if?>
    <?if:A.PAY_PROMISE_AMT=0?> <?xdoxslt:set_variable($_XDOCTX, 'LVar', A.PROMISE_AMT)?> <?end if?>
    <?format-currency: xdoxslt:get_variable($_XDOCTX, 'LVar');CURRENCY;'true'?>plz see
    Working with xdofx:if and xdoxslt variable error

  • BInput Data mismatch with currency format

    i am working with fs10 transaction
    I want to sum up the balance amount with respect to all
    companycode and post SUM to the bseg table using Batch input.
    i defined sum variable as below and coded.
    data : sum like glt0-hsl01.  (currency format)
    After all SUM operation.
    I have done like this to diplay SUM in report first(to check SUM output)
    SUM = SUM * 100.
    write : sum decimals 0.
    >>>>Now in report output i get value '17,222-'
    if u see in  fs10 screen we are getting same value.
    but when i try to post in Batch input.
    i have done like this below.(before posting i have checked
    for negative value )
    if sum < 0.
    sum = sum *100.
    compute sum = abs( sum )
    now...
    perform open_group................
    perform bdc_field using 'bseg-wrbtr'  (currency format)
                                    sum.
    when i execute this BI i get error in Amount(Sum)value
    display screen. (saying something differs in length )
    how to match the field.
    ambichan.

    Hello,
    Go to the Domain of the Field BSEG-WRBTR, which is WERT7. There you see the Output length as 16. So you decalre a local variable in BDC which is of CHAR16 in length to hold the value of WRBTR.
    Hope this helps you.
    Regds, Murugesh AS

  • Currency Format in Crystal Report Version 10.5 (Free With Visual Studio)

    Hi ,
    We are using free version of crystal report that comes with VS2008.
    We are in the need to display the amount in the following format and we are not able to do so. Here is what we need to achieve
    10000000---- Need to display as 1,00,00,000 
    1000000---- Need to display as 10,00,000
    100000  -
    Need to display as 100,000
    10000    -
    Need to display as 10,000
    Please let us know what currency format we can use or what is the other technique to resolve this issue.

    you should be able to format as a number with thousand delimiters. right click Format - > number tab
    if not display as text
    @amount
    totext(youramountfield, 0,",")
    Ian

  • Problem with currency format setting

    hello experts,
    i have one currency filed FDES-WRSHB = 25706515.32.
    i want this field to be converted into currency format which user have selected.
    for ex if user setting for currency in SU01 is 1,23,456.89 then this currency should be converted to 25,706,515.32.
    or if default setting is 1.23.456,78 then it should be converted to 25.706.515,32.
    please tell me how to achieve this... any FM available?
    or tell me how to read these user default setting so i can explicitly convert currency format.
    -Shweta
    Edited by: shweta chavan on Feb 6, 2009 7:19 AM

    Hi Shweta,
    I had the same issue,we dont need to do anything,the display will come automatically in the User format(specified in SU01/SU3).We dont need to use any FM or any coding.
    If u chanegd any settings in SU01/SU3 u need to re-login to see the changes,for example the setting were like 1.23.456,78 and u changed to 1,23,456.89 then it will not reflected immediately.U need to log-off and log-in again to see the changes.
    Hope this helps.
    Thanks & Regards,
    Rock.

  • Information required for all currency formats settings.

    I need information in Web Dynpro Java for currency format.
    currently I have following fields in application:-
    1.Wrbtr Amount in document currency
    2.Waers Currency Key
    In local dictionary I could see Amount type as simple type in external representation I could see #,###.00## format.
    This format has a problem with Yen currency that if ECC shows 1000.00 then Portal shows only 100.00.
    Please let me know how dictionary works about pair of keys an values of above fields.
    Please let me know solution of this problem.
    Higher points will be rewarded for immediate solution and appericated also.

    Hallo Laxmikant,
    to correctly format BigDecimal price values depending on a given currency YOU MUST apply structure binding:
    - define a dictionary structure with a currency field AND an amount field and relate the amount field to the currency field.
    - bind a context node to this structure so that the context attributes are created from the sturcture fields.
    In this way the Java Dictionary Runtime will correctly format the decimal places for the amount depending on the given currency key (see ISO 4217). For the Jordanian Dollar JOD three decimal places are rendered, for the Japan Yen (JPY) zero.
    Look at this [Table Tutorial|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/webdynpro/wd%20java/wdjava%20tutorials%207.0/web%20dynpro%20sample%20applications%20and%20tutorials.htm#46] which applies the sctructure binding and currency-formatting technique.
    With your formatting pattern approach on simple type level you cannot adapt the formatting pattern for different currencies.
    In NW CE 7.1 you can use the new CCTS-datatype Amount.
    Regards, Bertram

  • Currency format for locale de_CH

    Hello,
    One of my customers has told me that
    "Here in Switzerland, currency amounts with 0 cents are written with a long dash, 4.-- instead of 4.00."
    It seems that Java doesn't know it. If I'm using the de_CH locale, I will always get 4.00. How can I achieve this with Java besides replacing .00 with .--? Could this be a bug?
    Here's a small test. The result is
    SFr. 1'234.00
    but the right result should be
    SFr. 1'234.--
    private static void test() {
         Locale locale = new Locale("de", "CH");
         NumberFormat format = DecimalFormat.getCurrencyInstance(locale);
         Currency currency = Currency.getInstance("CHF");
         format.setCurrency(currency);
         BigDecimal amount = new BigDecimal("1234.0");
         String value = format.format(amount.doubleValue());
         System.out.println(value);
    }Thank you for your time,
    Nicu

    Thank you all for taking the time to answer.
    I did a quick check on a large Swiss company page (the Swiss Post) and here's what they say:
    "Withdraw cash at the post office counter free of charge up to CHF 4'000.- per withdrawal."
    They use the same convention. A dash instead of zero. Here's the link: http://www.postfinance.ch/pf/content/en/seg/priv/pay/card/pcd.na_priv.html.
    Here's another link that explains the same thing: http://elearning-uk.myswitzerland.com/index.php?SN=pv5qudaru57ilcsdvbftcm7cs1&ac=user_seminar_view&cid=60&pid=255.
    Unfortunately, I don't know how I could specify such a format in Java. The only solution I came up with was to replace zeros with a dash if the locale is de_CH. But that's not quite elegant.

  • Currency format in LAC

    Hi,
    We are working with LAC, and we have an issue.
    When we create an auction in SRM the currency format for the start price and the others is 1,234,567.89 (this is correct for us), but when we execute the applet (LAC) the format change 1.234.567,89
    The user in SRM has the correct format 1,234,567.89 then, Why in the applet the format is different????
    How can we change the format????
    We are working with EP then, we execute the transaction  bbp_auction since a Portal iview. Our single sign On between LAC and Portal was configurated, then we guess, we need to change the currency or number format in the Portal User, Is that correct?????
    What user do we need to change (currency format)????   SRM user????  Portal user???? LAC user????
    Thanks

    Hi Claudia,
    Check the following note :
    Note 666849 - Running LAC in non-US locales
    This may help you.
    Thanks,
    Pradeep.

  • Logical column currency format properties at rpd level?

    I need to show the currency amount with dollar symbol for a logical column and that should happen at rpd level.
    Is there anyway we could do that ?
    thank you

    Hi User.
    You can have logical column name as 'Amount in $' or 'Amount in Dollar'
    this is the best practice..
    Then if you want value to be suffixed by $ , you can go for data formatting in column properties.....
    this is commonly used....
    mark if Correct/helps .
    fiaz

  • Send email in html format with pdf attachment

    I am trying to send an email out of SAP using an abap program in the html format with a pdf attachment. I am using the function module -SO_DOCUMENT_SEND_API1. I noticed that when i specify the body type of the message as 'RAW' I get to see the pdf attachments however when i switch it to 'HTM' I loose the attachment in the email generated. Can anyone please help me in solving this problem. Thanks!

      ld_email                 = p_email. "All email IDs
      ld_mtitle                 = 'Bank Statement'.
      ld_format                = 'PDF'. "Attachment Format
      ld_attdescription      = 'Statement'.
      ld_attfilename          = p_filename. "Name of file
      ld_sender_address      = p_sender_address. "Sender mail address
      ld_sender_address_type = p_sender_addres_type. "INT - Internet
    * Fill the document data.
      w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle . "Description
      w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle. "Description
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'HTM'. " THis is for BODY of mail RAW'.
      APPEND t_packing_list.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    * Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    * Populate zerror return code
      ld_error = sy-subrc.

  • SELECT with pattern CP '50*' is not working on material numbers MATNR

    Hello,
    I have a specific matchcode for searching on material numbers with a function module as selection method.
    In this function module, the SELECT clause is built dynamically as bellow.
          SELECT (temp3)
            INTO CORRESPONDING FIELDS OF TABLE result_tab  UP TO CALLCONTROL-MAXRECORDS ROWS
             FROM (temp)
             WHERE (temp2) .
    In the "temp2" variable, I use RANGES for the selection simply built with values of SELECT-OPTIONS coming from the search help selection screen.
    I am facing the following problem :
    When a search is executed on material number with the following pattern '50*' --> nothing is found !
    When I run a search on '50575' --> the material number is found !
    I expect it is a problem of convertion routines (external to internal format) but I am not able to fix a solution...
    We are in SAP_BASIS 700.

    I think it can be done.
    I have -    
    CONCATENATE  'Z+_'   '00+' INTO  r_ranges-low .
        r_ranges-sign = 'I'.
        r_ranges-option = 'CP'.
        APPEND r_ranges.
        SELECT  ar_object FROM toasp
          INTO CORRESPONDING FIELDS OF table lt_toasp
           WHERE ar_object IN r_ranges.
    And it returns all values with pattern 'Z_00'.
    (Z1_001, Z1_002 etc.)
    If the pattern '50*' is not working, you could try using '50+++'.
    Regards,
    MaryM

  • Why the currency format in numbers is very limited into few countries???  I think this is a must have in next update of numbers ..

    I was doing a spread sheet for a business proposal to my colleague in Philippines, was very disappointed to know that the currency format in Numbers for Mac is very limited to few countries only...

    As Badunit suggests, in Numbers 2.3 you can turn on the preference that shows the full currency list.
    Put a value in a cell and then choose Philippine Peso.  Save the document.  Open the document in Numbers 3.0 (if that is what you are working with) and you will still have access to that currency.
    You might go to Numbers > Provide Numbers Feedback to let Apple know you need the option to use more currencies in Numbers 3.
    SG

Maybe you are looking for