CHECKING for currency format

Hi,
       i am checking the currency format amount.the rule is Right justify amount decimal point and 2 decimal places. Not to use commas or the $ sign.
for the above condition the code is:
data:val type string.
val = '123456789.00'.
  if val co '.0123456789'.
    shift val right deleting TRAILING space.
  else.
    if val cs ',' or val = '$'.
      replace ',' with space into val.
      replace '$' with space into val.
    endif.
  endif.
but iam getting '$' and ','. mark in o/p.
how can we check this condition.help me out from this issue.
Thanks
Message was edited by:
        skk

Try this.
[code]parameters : val(30)  type c.
data : final(30) type c,
       cnt type i,
       v type c,
       n type i.
cnt = strlen( val ).
do cnt times.
move val+n(1) to v.
if v ca '.0123456789'.              "Bring in the values
move v to final+n(1).
*elseif v = ',' or v = '$'.             "<---no need of this
*continue.                              "<----no need
endif.
n = n + 1.
enddo.
condense final no-gaps.
write:/ final .[/code]
regards,
vijay

Similar Messages

  • Check for Currency Data Type

    Hello All,
    In my Dynamic Internal Table I've certain fields.
    Now I want to check whether those fields are of type Currency or Quantity .
    How to do this ?
    Using Describe Field  syntax I'm getting as TYPE C for both CURRRENCY as well as CHARACTER.
    Any clues ?
    Regards,
    Deepu.K

    Hello Vikram,
    Thanks for ur reply !
    But when I pass my Internal table data Name to ur said FM I'm not getting any data.
    So I tried with one more FM :
    * Get the Layout Fields Content
      call function 'LVC_VARIANT_SELECT'
        exporting
          i_dialog            = ' '
          i_user_specific     = 'A'
          it_default_fieldcat = gt_fcat
        importing
          et_fieldcat         = gt_fcat
        tables
          it_data             = gt_final
        changing
          cs_variant          = ls_variant
        exceptions
          wrong_input         = 1
          fc_not_complete     = 2
          not_found           = 3
          program_error       = 4
          data_missing        = 5
          others              = 6.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    By using the above FM i got my required content.
    In the FIeldcatalog I have all the DATATYPES, INTTYPEs, Decimals etc. and so by reading the values from the field catalog I coud resolve my isssue.
    Regards,
    Deepu.K

  • 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

  • Any tables for  each vendor/customer to check foreign currency balance?

    Hi all,
    Does SAP provide any tables to check foreign currency balance for each vendor/customer?
    I have searched some websites, have not found any good solutions yet?
    Regards
    Tony
    Moderator: Please, search SDN

    Hi ,
    please use the report  tcode S_ALR_87012172 . Kindly award points if the answer was helpful.
    Regards
    Anirban

  • Output Format for Currency

    Hi There,
    I have set defaults as '1,000.00' for currency output in the own data but in the output of report it is showing like '1.000,00'.
    PS: there is no formating statement in the program as well.
    Any advice friends, how can I make it in required format.
    Regards,
    Shabbar

    HI ali ,
    yeah u can do thi sin scripts ..
    take a look at this ..
    Country-Dependent Formatting: SET COUNTRY The formatting for certain field types depends on the country settings. These field types include, for example, date fields and number fields that include either a decimal point or the ‘thousands’ separator character. The formatting options defined in the user master record are usually the ones used here. To choose a formatting option other than the one specified in the user master record, use the SET COUNTRY control command. The country-dependent formatting options are stored in the T005X table. Syntax: /: SET COUNTRY country_key You can enter the country key either as a literal value enclosed in quotes or as a symbol.
    /: SET COUNTRY 'CAN' /: SET COUNTRY &country_key& Use a blank country name to revert to the setting found in the user master record: /: SET COUNTRY ' ' This SAPscript command actually calls the corresponding ABAP command internally. This guarantees the effect of the SAPscript command to be identical with that of the ABAP command
    regards,
    VIjay
    Message was edited by:
            vijay k

  • Change currency format for my Locale

    The default currency format for my locale (es-AR) formats negative currencies like this:
    ($1.232,23)
    I'd like to change it to
    $-1.232,23
    Any ideas on where to start? Where is that format option stored? In windows the currency format is the latter, and I can change it, but Java uses its own... (right?)
    Thanks for your help.

    Thanks, I found the javadoc that sais that.
    If you need to customize the format object, do something like this:
    NumberFormat f = NumberFormat.getInstance(loc);
    if (f instanceof DecimalFormat) {
         ((DecimalFormat) f).setDecimalSeparatorAlwaysShown(true);
    I think it would be nice to be able to customize a Locale information... to avoid the above code and have a more general solution.
    Thanks anyway, if you think of anything else, let me know.
    Bye.

  • Currency format and Right Align not working for messagetext in HGrid

    Hi
    We are dynamically enabling MessageTextinput inside HGrid region, it is Number type and when we set readonly to True it become left align, and currency format also not working, I tried the below various options but nothing is working.
    Option : 1
    OAMessageTextInputBean attribute = (OAMessageTextInputBean)webBean.findChildRecursive("Attribute"+i);
    attribute.setCurrencyCode("USD");
    Option :2
    OAWebBean amountDueBean2 = webBean.findChildRecursive("Attribute"+i);
    oracle.cabo.ui.validate.Formatter formatter2 = new OADecimalValidater("#,##0.00;(#,##0.00)","#,##0.00;(#,##0.00)");
    amountDueBean2.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, formatter2);
    etc options we tried
    amountDueBean2.setAttributeValue(CURRENCY_CODE,formatter2);
    amountDueBean2.setAttributeValue(OAWebBeanConstants.CURRENCY_CODE,"USD" );
    Please help on this issue.
    We are using Jdeveloper 10.1.3.3.0.3
    TiA
    Babu

    Anatoli,
    Hello!
    I don't know if my situation is the same as yours, but after a lot of head-scratching, forum searching and template rebuilding, I finally figured out my problem.
    I had one column that no matter what I did kept appearing in Excel as text. I'd format it to Number in Excel and nothing. When trying to sum the column, Excel would not recognize any of the values as numbers. I even did the reformatting on the XML Word template to number, and the currency format that Adam mentions. Still no go. The $ and ',' appeared, but column still formatted as string.
    I just finally noticed Adam's mention of the 2 extra spaces at the end of the numbers and sure enough mine was doing the same thing. Take out the 2 spaces and voila! Number!
    Every time I redid my template in Word (07 and 03), I used the wizard. (Add-ins>Insert>Table>Wizard) walked through the steps, not really changing anything. Then I would preview and the spaces would be there. The column that I was having problems with was the last column of the table, which would get the text 'end G_ASSIGNED_CC' inserted in after the field name - separated by 2 spaces. Once I took out these two spaces, so the column now shows 'COSTend G_ASSIGNED_CC', it worked fine in Excel - all numbers.
    Hope that helps someone out there as I was having a heck of a time finding anything (solutions anyway) on this.
    Thanks,
    Janel

  • 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.

  • Budget check for purchase order

    Hi everyone!
    We have NO problems with budget check for the SC. But when we create a PO and exceeds the budget no message are displayed. The only thing that happens is that the PO gets status "error in process". But if we change the PO (still exceeding budget) we receive a correct message. Is this a program error?
    Sincerely
    Anders

    Hi
    Temporarily deactivate budget check: SRM: using Badi
    BBP_BUDGET_CHECK, AVC Backend customizing.
    Did you do budget check while creating sc? what did it says?
    Refere this old notes.
    Note 740933 - Incorrct purchasing budget for currencies w/o decimal
    places
    Note 747143 - User purchasing budget in pop-up incorrectly formatted
    regards
    Muthu
    Edited by: Muthuraman Govindasamy on Nov 5, 2008 3:08 PM

  • 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

  • Formatting Variable into Currency Format INSIDE script

    Hello, 
    I was wondering if someone could give me insight on why I'm running into some problems.
    So, in my script, I'm trying to display my [decimal]$Variable into currency format ( $x.xx ) 
    By looking around online, I found two different ways;
    "{0:C2}" -f $Variable will create the appropriate output in my open shell
    $Variable.ToString("c") will also work in my shell. 
    Now my only problem is that despite numerous attempts and quadrouple checking that I typed it into the ISE properly, I can't for the life of me get it to display properly in my script. 
    I even just tried saving the output into a variable before I put it into my write-host line.
    Does anyone know what the problem is? 
    Thanks, Phil

    $TaxPayable.ToString("c") | Set-Variable -Name $TaxInCurrency 
    $TotalCost.ToString("c") | Set-Variable -Name $TotalCostInCurrency
    ##########################Display the $TaxPayable and $TotalCost to the user###################################
      Write-Host "The Tax for the Book is $TaxInCurrency, making the total cost $TotalCostInCurrency"
    This is my latest attempt to make it work. Sorry about the initial lack of information
     

  • Budget check for a Training Event

    Hi,
    My client has departmentwise budgets for Training. They want a budget check when the Training Event is being creating in SAP. If the training costs exceed the remaining training budget of the department, the system should not allow it. How to achieve this?
    Please help.
    Regards,
    Sasi.

    Hi
    Temporarily deactivate budget check: SRM: using Badi
    BBP_BUDGET_CHECK, AVC Backend customizing.
    Did you do budget check while creating sc? what did it says?
    Refere this old notes.
    Note 740933 - Incorrct purchasing budget for currencies w/o decimal
    places
    Note 747143 - User purchasing budget in pop-up incorrectly formatted
    regards
    Muthu
    Edited by: Muthuraman Govindasamy on Nov 5, 2008 3:08 PM

  • Error Message for currency (0Currency) during activation of DSO

    Hi guys,
    data which is transfered from datasource to dso contains an value " * " for currency which is unknown for some key figures.
    During the activation of the data in DSO an error is appearing: No SID for value " * " of characteristic 0Currency found.
    Is there some solution for that error available?
    I checked the values for currency which are stored in 0Currency master data. There is one value for empty currency.
    I thought one solution is to remove the " * " currency in ERP, then the currency will not have the " * " value and no error would appear in BW.
    The other is to create a new InfoObject for currency and add the value " * " in master data. Then with the assignment of the new currency InfoObject also an error should not appear.
    Any ideas about that?
    Thank you in advance for answering!

    prashanthk wrote:
    > have you tried the below
    >
    > you may need to upload the currency 'master data'
    > Normally this is done via transfer global setting from r/3,
    > rsa1 - source system - r/3 right click 'transfer global setting',mark currency, unit converstion, etc and 'execute'
    >
    >
    > Have you checked for the values in TCUR table.
    > if values are not maintained in the TCUR and if you want to manually maintain the vlaues follow the below steps
    >
    > To manually enter the INR currency, go to SPRO -> SAP reference IMG -> General settings -> Currencies -> Check currency codes and click on new entries. You currency should follow the standard ISO format.
    >
    > NOTE:Please do this activity only if transferring the global settings from source system did not fix the issue
    I think this has nothing to do with TCURR because there is the currency conversion maintained. And for SPRO i don´t have authorization and I think that an currency with * would not make sense to enter it via SPRO as a currency code.

  • How do I check for null date entires using custom JScript on a SharePoint NewForm.aspx?

    Hi,
    I have the below JScript:
    /*Function to convert the US Date format to UK date format */
    function parseDate(input) {
    var parts = input.split('/');
    // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
    return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
    /*Function to check if end date is before the start date */
    function checkDates(){
    var sd = parseDate($("input[title='From']").val());
    var ed = parseDate($("input[title='Until']").val());
    if(sd > ed) {
    alert("Please check From and Until Date");
    $("input[value$='Save']").attr('disabled', true); //hide save button
    else
    $("input[value$='Save']").attr('disabled', false); //show save button
    The above works fine for checking sd > ed but I can't seem to check for null's, I have attempted the below which doesn't work:
    /*Function to convert the US Date format to UK date format */
    function parseDate(input) {
    var parts = input.split('/');
    // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
    return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
    /*Function to check if end date is before the start date */
    function checkDates(){
    var sd = parseDate($("input[title='From']").val());
    var ed = parseDate($("input[title='Until']").val());
    if( (sd > ed) || (sd == null) || (ed == Null) ) {
    alert("Please check From and Until Date");
    $("input[value$='Save']").attr('disabled', true); //hide save button
    else
    $("input[value$='Save']").attr('disabled', false); //show save button
    Any help appreciated.

    Hi aspnet-scotland,
    Please post ASP.NET related questions in
    ASP.NET forums where you could receive better responses.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Checking for null value in arraylist

    Hi
    i have an excel file which i i am reading into an arraylist row by row but not necesarrily that all columns in the row mite be filled. So how do i check for null values in the array list.
    try
                        int cellCount = 0;
                        int emptyRow = 0;
                        HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
                        HSSFSheet sheet = workbook.getSheetAt(0);
                        Iterator rows = sheet.rowIterator(); 
                        myRow = new ArrayList();
                        int r = 1;
                             while (rows.hasNext())
                                  System.out.println("Row # " + r);
                                  HSSFRow row = (HSSFRow) rows.next();
                                  Iterator cells = row.cellIterator();          
                                  cellCount = 0;
                                  boolean isValid = false;
                                  while (cells.hasNext())
                                       HSSFCell cell = (HSSFCell) cells.next();
                                       switch (cell.getCellType())
                                            case HSSFCell.CELL_TYPE_NUMERIC:
                                                 double num = cell.getNumericCellValue();     
                                                 DecimalFormat pattern = new DecimalFormat("###,###,###,###");     
                                                 NumberFormat testNumberFormat = NumberFormat.getNumberInstance();
                                                 String mob = testNumberFormat.format(num);               
                                                 Number n = null;
                                                 try
                                                      n = pattern.parse(mob);
                                                 catch ( ParseException e )
                                                      e.printStackTrace();
                                                 System.out.println(n);
                                                 myRow.add(n);                                             
                                                 //myRow.add(String.valueOf(cell.getNumericCellValue()).trim());
                                                 //System.out.println("numeric: " +cell.getNumericCellValue());
                                                 break;
                                            case HSSFCell.CELL_TYPE_STRING:
                                                 myRow.add(cell.getStringCellValue().trim());
                                                 System.out.println("string: " + cell.getStringCellValue().trim());
                                                 break;
                                            case HSSFCell.CELL_TYPE_BLANK:
                                                 myRow.add(" ");
                                                 System.out.println("add empty:");
                                                 break;
                                       } // end switch
                                       cellCount++;
                                  } // end while                    
                                  r++;
                             }// end while
                   } myRow is the arrayList i am adding the cells of the excel file to. I have checked for blank spaces in my coding so please help with how to check for the black spaces that has been added to my arraylist.
    I have tried checking by looping through the ArrayList and then checking for null values like this
    if(myRow.get(i)!=null)
      // do something
    // i have tried this also
    if(myRow.get(i)!="")
    //do something
    }Edited by: nb123 on Feb 3, 2008 11:23 PM

    From your post I see you are using a 3rd party package to access the Excel SpreadSheets, you will have to look in your API for you 3rd party package and see if there is a method that will identify a blank row, if there is and it does not work, then you have to take that problem up with them. I know this is a pain, but it is the price we pay for 3rd party object use.
    In the mean time, you can make a workaround by checking every column in your row and seeing if it is null, or perhaps even better: check and see if the trimmed value of each cell has a lenth of 0.

Maybe you are looking for