Validating Swedish Currency

Hello,
The problem I have is that I'm unable to validate Swedish Currency from input field.
Knowing that the correct Swedish currency format is (1 234,45) which is equivalent to (1,234.45) in USD.
Assume the following;
String S = "1 234,56";
java.text.NumberFormat currency = java.text.NumberFormat.getCurrencyInstance(new java.util.Locale("sv", "SE" ) );
String S1= (String)currency.format( 1234.56 );
the issue here when I do
System.out.println(S1.compareTo(S));
I always get (128)which means both Strings are not equal, while I'm expecting (0) as indication that both strings are equal.
When I print S , and S1, both shows the correct format of "1 234,56"
Can someone explain why these Strings (S,S1)are not equal, and what is the best way to validate Swedish currency?

When I run this class:
import java.text.NumberFormat;
import java.util.Locale;
public class CurrencyLocaleTester
    public static void main(String [] args)
        String swedish          = "1 234,56";
        String americanAsStr    = "1234.56";
        NumberFormat formatter  = NumberFormat.getCurrencyInstance(new Locale("sv", "SE"));
        double american         = new Double(americanAsStr).doubleValue();
        String formatted        = formatter.format(american);
        System.out.println("swedish  : " + swedish);
        System.out.println("american : " + american);
        System.out.println("formatted: " + formatted);
        System.out.println("compareTo: " + formatted.compareTo(swedish));
}I get this result:
C:\Edu\Java\Forum>java CurrencyLocaleTester
swedish  : 1 234,56
american : 1234.56
formatted: 1�234,56 kr
compareTo: 128I suspect that the difference is in that character between "1" and "2" in the formatted String. Also note the "kr" at the end.
Check your assumptions.
%

Similar Messages

  • You must specify a valid, enabled currency. Invoice Currency is invalid

    You must specify a valid, enabled currency. Invoice Currency is invalid
    Hi.
    Error: You must specify a valid, enabled currency. Invoice Currency is invalid
    Error While creating the New supplier and creating new site for the existing supplier.
    I went through the metalink document ID 1324182.1 . I have checked my functional currency INR is enabled in the GL -> currencies -> define.
    and the error is still coming..
    Plz Advice a solution
    Thanks&Regards
    Surendra Reddy

    Hi PS, Thanks for the quick reply.
    I am a newbie to this procurement.
    I will explain my problem clearly.
    I have used INR in my ledger.
    and i have successfully created two suppliers( say supp1 and supp2) with two sites each.
    and now i am trying to create a Standard Purchase Order. Initiall it is showing the currency in PO is INR and when i entered
    the supplier name and site then currency is changing to UAH.(i dont know why it is changing).
    thats the reason why , i try to update the invoice currency and payment currency in the supplier creation page Keypayment setup tab.
    and this is showing the error: You must specify a valid, enabled currency. Invoice Currency is invalid.
    and when i am try to create a new supp, then also it is showing the same error.
    and finally i disabled the UAH currency also.
    Thanks&Regards
    Surendra Reddy.

  • Validation on currency

    hiii
    i have a field of 18char where i input a currency value.
    This field is used to be put in a field of currency 9 and 2DP.  if ever a user put more that is expected a dump of overflow will occur .  i was thinking of checking the STRLEN to be not more than 12.
    If there another way of doing so instead of STRLEN check.
    Edited by: Matt on Jan 20, 2009 10:06 AM - don't use "hi" in the subject!

    Hi,
    Instead of using STRLEN, you can directly use OFFSET to move only 11 character to the decimal value.
    REPORT  ztest_ram.
    DATA: l_char TYPE CHAR18,
          l_dec(9) TYPE p DECIMALS 2.
    l_char = '1234567890123456'.
    l_dec = l_char+0(11).
    WRITE: 'DECIMAL VALUE', l_dec.
    Best Regards,
    Ram.

  • Intersection validation report currency

    Does anyone know how to /where to change the currency symbol that appears on the intersection validatuion report? Currently showing the pound symbol. I want to change it to show no symbol?

    Hello,
    The Bitish Pound sign was not 'written' into the software. It is based on the currency/browser settings.
    It has been suggested to have all currency symbols removed from the report during the validate fish.
    I would contact support to see where the progress of this is.
    Thank you,

  • Validated the currency field in WEB

    Dear all,
    I have a develop a new WEB SRM screen, but I'm not managing to validate the Currency field when the user puts letters.
    The field is of type CURR and when the user hits "enter" it puts all letters in CAP but doesn't sends any error message.
    Anyone had this problem?
    Thank you in advanced,
    Vasco Pires

    Hi Masa,
    The screen works corretly when we run it on SAP Gui, the field has the type CURR, but when we executed on web, with a its web interface:
    <input type="text" name="ZDADOS_FACT-PRC_NOVO[`j`]"  value="`ZDADOS_FACT-PRC_NOVO[j].value`"
              maxlength="17" size="10">
    But when the users inputs the price, the system doesn't send the error box with the error message.
    Thank you for your support,
    Vasco

  • Norwegian Currency Validation using NumberFormat

    Hi,
    I have to validate a value which will be in a Norwegian Currency.
    So, I use the NumberFormat class like this:
    String noValue = "300,50";
    NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("no", "NO"));
    After this one, I have to convert noValue from String to Double whether it contains only numbers. So, I give like this:
    double american = new Double(noValue).doubleValue();
    But it is throwing NumberFormatException.
    Can anyone help me how to validate Norwegian/Swedish currencies.
    Thanks & Regards,
    Bh

    hi,
    This is my code chunk:
    String noValue = "300,50";
    NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("no", "NO"));
    System.out.println("noValue " + noValue);
    String formatted = formatter.format(noValue);
    double value = new Double(formatted).doubleValue();
    And this println prints:
    noValue 300,50
    After that it throws the IllegalArgumentException in formatter.format.
    Whereas, I tried like this also:
    String noValue = "300,50";
    NumberFormat formatter = NumberFormat.getCurrencyInstance(new Locale("no", "NO"));
    System.out.println("noValue " + noValue);
    double number1 = formatter.parse(noValue).doubleValue();
    But this is giving parse exception..Please help me..
    Thanks
    Bh.

  • Currency Conversion Error in Report

    Hello Forum,
    I got an error while executing a report, where
    the demo Key Figure NET VAL IN STST CUR(0D_NETVAL_S) IS restricted to the Characteristic value Current Version of the demo object Version(0D_VERSION).
    The field is showing no values and the error message is
    'NO VALID SOURCE CURRENCY IS SPECIFIED FOR CURRENCY TRANSLATION
    0HRFIXCUR'
    Could you please help me with step by step solution to resolve this issue?
    Thank you,
    raj

    hELLO Parvahi,
    Did you check OB08 in backend if maintained properly? also check validity...
    also on the SRM side is below report run using SA38?
    Update exchange rate tables in component system :BBP_GET_EXRATE       
    Hope that helps                    
    Arshad
    Edited by: arshad ahmed on Feb 9, 2010 12:06 PM

  • Would like the currency in the vendor master to always default to USD.

    Would like the currency in the vendor master to always default to USD.

    Hi,
    Currency not available in the vendor master level.
    How you want to make default it, if it is not available.
    If you want to post particular vendor only with the USD currency, then go for Validation as currency check in header and vendor check in line item and this works only at company code level (that means, only for one company code, if you need it to other then seperate validation you have to write and activate).
    VVR

  • Currency conversion error by changing the currency

    Hi all,
    i am facing a problem by refreshing the query with  another currency. f.e. i am calling the report in Euro and then i say refresh variables and change the currency in USD. So i get the same values and the currency conversion dont work.
    I get the following alert message after i change the currency and run the report.
    Diagnosis
    You attempted to convert a currency. The system cannot find a valid currency into which to convert the value.
    System Response
    The OLAP processor cannot convert the currency. The drilldown is not changed.
    Procedure
    Specify a valid target currency.
    Procedure for System Administration
    This message can only appear for Web templates in which currency conversion is set manually (using the SAP BW URL). If this message appears following a currency conversion dialog box, an SAP error has occurred; report this error using OSS.
    Can someone help me before i open a OSS error. Thanks.

    Hi,
    did you check the setting  in BI for source system ?
    Else just try it
    RSA1 - goto source system
    Expand SAP
    Context Menu of Source System
    There are
    Global Settings
    Transfer Exchange Rate
    Hope it will help you ...
    BVR

  • Error in CXD1 (EC-CS) during Validation Check

    Dear Team,
    While checking the Validation for Currency Translation Method QXCR in SAP, I am getting the below error message:
    80: Item 0000510001 and item 0000900000 are not the same type
    Message no. GZ218
    Diagnosis
    The item set contains both balance sheet and income statement items.
    It should however contain either balance sheet OR income statement items.
    System response
    Error message
    Procedure
    Please correct the item set.
    ==============================================================================================
    Further, under QXCR method entries, in sequence 80, under Maintain Sets I want to remove item 900000. When I go to change Set maintenance, the system gives me the below error for Set Name: 0-40R
    Objects with leading zero may not be changed
    Message no. GU302
    Diagnosis
    You have tried to change an object whose name starts with a zero.  This is not possible because these objects are reserved for SAP (for instance, examples used in training courses).
    System response
    The changes have not been made.
    Procedure
    Make the changes to a copy of the object or create a new object.
    Please assist on this...
    Thanks in Advance !!!

    Thanks Dan,
    I went to CXSC Tcode and given the existing FS item 0-40R and chosen the change option, wherein I am getting the error as below:
    Objects with leading zero may not be changed
    Message no. GU302
    Diagnosis
    You have tried to change an object whose name starts with a zero. This is not possible because these objects are reserved for SAP (for instance, examples used in training courses).
    System response
    The changes have not been made.
    Procedure
    Make the changes to a copy of the object or create a new object.

  • Need example of Currency

    Dear friends ,
    In Web Dynpro ABAP there is standard example provided for Curreny .If you know name of example please let me know .
    Secondly Please give me inputs regarding validation of currency and in Web Dynpro ABAP do we have some direct mean for curreny validation .
    Cheers
    Parry

    Problem solved

  • Error while creating a new site for a supplier associated with an Employee

    Hi
    We create suppliers for all the employee when we get daily HR feed and create a default site OFFICE for all of them,
    Now when from the front end we try creating a new supplier site HOME.
    It gives an error
    Address and Site Creation - Unable to create address and sites because of the following error when trying to create the site in operating unit [WorldPay US OU]: [oracle.apps.fnd.framework.OAException: Address and Site Creation - Unable to create address and sites because of the following error when trying to create the site in operating unit [WorldPay US OU]: [ MATCH_OPTION is invalid Match option is invalid Invalid Payee context values. Org parameters exist only with party site and supplier site.]. Either resolve this issue and try again or deselect the operating unit with the error and continue. Note: any new address requires at least one site in order to be created.]. Either resolve this issue and try again or deselect the operating unit with the error and continue. Note: any new address requires at least one site in order to be created.
    could someone please help me with this
    Thanks
    Edited by: user592830 on Mar 21, 2012 10:27 AM

    Please see these docs.
    R12: Unable To Create A New Supplier Site. ORA-1403 Error Arises In AP_VENDOR_PUB_PKG After Patch:8889211 [ID 1053597.1]
    R12: Unable to Create Non-Employee Supplier Sites after Creating Employee Suppliers due to error Supplier Site Code is Invalid [ID 1266374.1]
    Cannot Create Supplier Site (Address) [ID 1069032.1]
    ORA-01403 When Assigning Operating Unit during Supplier Address and Site Creation [ID 1070431.1
    Unable To Create Ap Supplier Site [ID 1095616.1]
    Creating Supplier Address Gets "ACCTS_PAY_CCID Is Invalid" [ID 763636.1]
    Supplier Site Creation Error, Immediately After Creation Of Employee As Supplier [ID 1215016.1]
    R12 Supplier Site Creation Error: You must specify a valid, enabled currency. Invoice Currency is invalid [ID 1324182.1]
    When Adding a Site, Get Error Message: This Site name already exists for this supplier. Re-enter. Supplier Site Info Is Duplicate [ID 1324498.1]
    Address And Site Creation Terms_date_basis Is Invalid Terms Data Basis Is Invalid [ID 1359979.1]
    Thanks,
    Hussein

  • 10.3: finally possible to get unsolicited notification in a server?

    Hi all,
    after reading about the new stuff in 10.3 I can't help wonder whether the new tpappthrinit() function will be an enabler for finally getting the possibility to get unsolicited notifications to a Tuxedo server. Could anyone please shed some light on this?
    Best regards,
    /Per

    I don't even need to put it in a thread, I could find use for it in a single-threaded server as well (and it would be far more useable for old code).
    The use case is basically to be able to subscribe to events. If you have several instances of a server subscribing to an event with service delivery won't help - you can't predict which of the servers will get the event delivery service call. If you need a way to reach every server instance exactly once for an event, unsolicited notification would seem like a good choice. (Imagine an event such as "ChangeDebugLogLevel".)
    I guess unsolicited notification is IPC messages to the client's reply queue. Would it be possible to send them to a server's request queue? The dispatcher would look at the message and dispatch the tpsetunsol():ed function, instead of a service function - would it be doable?
    Just my €0.02 (we actually don't use the euro currency in Sweden, but the Swedish currency is even less-than-worthless these days... :-) )
    /Per

  • Modify SIL_GLBalanceFact to populate Balance_Global1_Amt column.

    Hello Everyone,
    Any help on the following scenario Will be much appreciated!
    -->We have data coming in from 2 Peoplesoft instances(one with USD currency values and other with CAD currency values)
    -->Currently we are extracting these values and loading them as local amounts in the Balance_loc_Amt column in W_GL_BALANCE_F table in the datawarehouse without any conversions.
    -->Now we have a flat file which has the Currency conversion rate to SEK(Swedish Currency)
    1st task:
    -->Populate the SEK currency rate to W_EXCH_RATE_G table manually.
    2nd task:
    -->Modify the Informatica mapping such that the records coming from USD and CAD are converted to SEK using the flatfile as source and W_EXCH_RATE_G table and get populated in Balance_Global1_Amt column in W_GL_BALANCE_F table.
    Thanks for the help in advance!
    -Nikki.

    Hi Nikki,
    The BI Applications have currency conversion features built in; I would explore them in the first instance.
    Up to three global currencies are supported; these are setup using DAC parameters:-
    $$GLOBAL1_CURR_CODE
    $$GLOBAL2_CURR_CODE
    $$GLOBAL3_CURR_CODE
    $$GLOBAL1_RATE_TYPE
    $$GLOBAL2_RATE_TYPE
    $$GLOBAL3_RATE_TYPE
    The ETL populates these for each datasource into the Warehouse table W_GLOBAL_CURR_G (using mapping SIL_GlobalCurrencyGeneral_Update).
    The rate type parameters tell the ETL where to source exchange rates from in your source system. If you want to source rates from a different data source (e.g. a flatfile) then you will have to customise mappings to load W_EXCH_RATE_G accordingly (see the mappings SIL_ExchangeRateGeneral and the corresponding SDE mapping(s) for your data source e.g. PeopleSoft).
    If you look at the SIL mapping for the W_GL_BALANCE_F table (SIL_GLBalanceFact) you will see a Mapplet called MPLT_CURCY_CONVERSION_RATES1 which gets the three global exchange rates for a given DATASOURCE_NUM_ID, TENANT_ID, EXCH_DT and DOC_CURR_CODE. This mapplet references W_GLOBAL_CURR_G to get the rate types. A latter Expression transformation called Exp_W_GL_BALANCE_F_Update_Flag then multiplies the retrieved rates by the local amounts to get the global amounts.
    So, the custom mapping that loads the exchange rate table should load rates (between local and global currencies) with all the necessary dates for conversion, the correct datasource_num_id and tenant_id. The rate type should then be defined in the DAC parameter(s).
    Please see the following section of the configuration guide:-
    http://docs.oracle.com/cd/E20490_01/bia.7963/e19039/anyimp_oracle_apps.htm#BABJJJHF
    Please mark if helpful / answered,
    Andy.

  • Localization with both language and country

    I have following problem: we have a large software that is already multilangual. We are using both resourcebundles directly and jstl:s <fmt:message /> tags at jsp pages. Everything is working quite well.
    However, we are now moving to other countries and we want to keep all the languages available to all countries. For example we want to have
    in finland:
    finnish language, finnish currency and dateformats
    swedish language, finnish currency ..
    english language, finnish currency ..
    and in sweden:
    swedish language, swedish currency and dateformats
    english language, swedish currency ..
    Is this even possible with jstl? Do we have to create duplicate ResourceBundles like
    Messages_fi_fi
    Messages_en_fi
    and to swedish version
    Messages_se_se
    Messages_en_se
    This will mean quite huge amount of duplicate information when there will be more and more languages..
    I would really appreciate if anyone has comments about this.

    .. there is no edit so I can't edit the message above but I know it's most cerainly possible by duplicating resourcebundle properties, I'm looking for better way to do this..

Maybe you are looking for

  • Download Reports in CSV or pdf format

    Hi to all, i'm trying to download a report in CSV format that implicate the list of more than 400.000 users and their resource assigned. As i know, Sun IDM before generating this file is going to execute a task that return the list of this 400.000 us

  • Return vendor sales area issue

    Hi all, I am creating return vendor master in Xk01 in purchase data view i am seleting a return vendor tab, its take me customer default data screen wher i am giving customer account group XXXX and shipping condition as 01  and i save the vendor mast

  • Huge price variance in Material Ledger

    Dear Gurus, In our case the standard cost of one Finished goods is released with the price of Rs.10 but later on the cost of one of the Raw material is changed to Rs.1200.  Without releasing the standard cost (as it cannot be released for more than o

  • ABAB Proxy "BI to XI Integration"

    Hi All I am doing BI to XI integration. I have created ABAB Proxy for INBOUND, but in class i am getting error at the time i am checking the syntax --- syntax error " class ZPUSH_MI_INBOUND, Method ZPUSHII_MI_INBOUND                      Type "ZPUSH_

  • Changing data types in database

    Hi, We are using Oracle 10g database. We changed the data type from DateTime to DateTimestamp. There are a whole bunch of joins defined in Discoverer's EUL. is there a work around this as all the reports written is not working because of this change?