Validation currency field

I want to create a validation. The field should be checked in max. two decimal places,not null, > 0 and in numeric.
I tried this:
if v('P42_BESTAND') is not null
and v('P42_BESTAND') > 0 then
return true;
else
return false;
end if;
exception --'when others then return false;'doesn't work?
when others then
if sqlcode = -1722 --invalid_number
then return false;
end if;
It works, but I think that it is not the best way, and the problem of the decimal places is not solved.
Who can help? Thanks in advance.

Jorg,
I'd do it this way:
begin
if nvl(to_number(:P42_BESTAND),0) > 0 then
return TRUE;
else
return FALSE;
end if;
exception
when others then
return FALSE;
end;
Joel

Similar Messages

  • Currency field validation

    Hi All,
    For SRM-MDM catalog workflow, I want to write a currency field validation to find out the catalog item data records where difference between the original price and the new price for the same catalog item data is greater than 1%.
    So as a precursor to the final validation expression, I wrote a very primitive validation expression like:
    IF((Contract Price.Amount - [Original].Contract Price.Amount)>1,FALSE,TRUE)
    And I was expecting that this should return a FALSE boolean value whenever difference is greater than 1. But surprisingly, irrespective of the difference in the amount, it always returns a TRUE value.
    I am wondering whether it is a problem with the validation expression or is it a bug? I am working on SAP MDM 5.5 SP04 Patch 02 (5.5.63.71).
    Any suggestions would be appreciated.
    Thanks,
    Satyen

    Hi Nisha,
    Thank you for your reply.
    As I had mentioned in my previous post, irrespective of whether, amount value is incremented or decremented, it always returns FALSE.
    Syntactically and logically, your validation expression is correct but still it always return an error message (a FALSE value).
    What do you reckon, is it a bug in the MDM software?
    Regards,
    Satyen

  • 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

  • Currency fields on Adobe Interactive Form

    Hello,
    I have placed a currency field on the Adobe Interactive Form.
    Local has been set to 'Viewer's System Locale'.
    But if I try to put any amount in this field, the following error message is displayed:
    "Distance Between Separators for Thousands Must Be 3."
    I tried with following amounts:
    10000
    10000.54
    10
    1
    Note that my default decimal point is '.'.
    Regards
    Sagar

    Sagar,
    Goto Object Palette --> Value Tab --> Check if you set any Validation Pattern for the currency field.
    If you don't want, remove the validation.
    Chintan

  • Currency Field?

    Hi there,
    Does LiveCycle Designer not have a currency field as a field type?  It has numeric and it has text, but no currency?  Do I really have to manually tell this expensive program how to accept currency values such as the oh so uncommon US dollar sign? 
    I set my field type as "Numeric" and in "Validation Pattern" I listed the following for the "Validation" and "Edit" patterns:
    zero{0}|num{zzzzzzzzzzzz9}|num{z,zzz,zzz,zz9}|num{zzzz9.zzz}|num{z,zzz,zz9.zzz}|num{zzzz9. 999}|num{z,zzz,zz9.999}|num{$z,zz9.99}
    I listed the following for the "Display" pattern:
    zero{0}|num{$z,zz9.99}|num{$zz,zz9.99}|num{$zzz,zz9.99}
    When I test the field, it does not allow me to enter the dollar sign ($) in the field.  For example, if I enter "$123" into the field then exit the field the data then disappears. I can enter "123" and it converts it to $123.00 when I exit the field, which is what I want.  However, our users need to also be able to enter the US dollar sign and not have their data disappear if they do. 
    Please help.
    Thank you.

    You can allow characters other than numbers in numeric fields when you use quotes.
    Here an example for an edit pattern:
    null{}|zero{9.88}|num{'$'zz9.88}|num{zz9.88'$'}|num{'$ 'zz9.88}|num{zz9.88}|num{}
    It allows $123, $ 123, 123.45, 123.45$ and 123.45 $
    The decimal places are optional if you use the 8 pattern after the dot.
    And here is the display pattern.
    null{9.99 $}|zero{9.99 $}|num{zz9.99 $}

  • Calculations with Currency fields

    Hi Experts,
    Could you kindly throw some light on how Currency fields are processed in the Dictionary? How does the system calculate the local currency?
    For example, let us consider table BSAK,  I see the fields WAERS(Curr key), DMBRT (Amount in local currency) and WRBTR (Amount in document currency).
    How do I calculate the total Amount for a given values of
    LIFNR, BUKRS,GJAHR, MONAT and SHKZG = 'S' ?
    Do I just add all the DMBTR values?
    What would be the local currency be?
    Kindly advice.

    Hi Vimal,
    The fields DMBRT and WRBTR hold the amount whereas the field WAERS specifies the currency key of these fields . That is whether they are in Indian Currency ( IND ) or is it US Dollars ( USD ) etc... The Table to hold the currency keys is TCURC. You can find this table as a value table in the domain of the field WAERS.
    So if you have to calculate the currencies you have to check with their currency keys if the currency key is same then you Add the prices.
    Try to write this code in ABAP Editor :
    *"Table Declarations...................................................
    TABLES :
      sflight.                             " Flight
    *"Select Screen Elements...............................................
    SELECT-OPTIONS :
      s_carrid FOR sflight-carrid.         " Carrier ID
    *"Data Declarations....................................................
    * Work Variables                                                      *
    DATA :
      w_gross    TYPE p DECIMALS 2,        " Holds Gross Value
      w_net      TYPE p DECIMALS 2,        " Holds Net Value
      w_curr     LIKE sflight-currency.    " Holds Currency
    * Internal table to hold Flight data                                  *
    DATA :
      t_sflight LIKE
       STANDARD TABLE
             OF sflight.
    *                       TOP-OF-PAGE EVENT                             *
    TOP-OF-PAGE.
      PERFORM top_of_page.
    *                    AT SELECTION-SCREEN EVENT                        *
    AT SELECTION-SCREEN.
      PERFORM at_selection_screen.
    *                    START-OF-SELECTION EVENT                         *
    START-OF-SELECTION.
      PERFORM fetch_sflight_data.
      PERFORM display_sflight_data.
    *&      Form  top_of_page
    * This Subroutine Performs the Event Top-Of-Page
    *  There are no interface parameters to be passed to this subroutine.  *
    FORM top_of_page .
      WRITE :/45 text-001.
      ULINE.
    ENDFORM.                               " FORM TOP_OF_PAGE
    *&      Form  AT_SELECTION_SCREEN                                      *
    * This Subroutine Performs the Required Input Validations              *
    *  There are no interface parameters to be passed to this subroutine.  *
    FORM at_selection_screen .
      SELECT carrid                        " Carrier ID
        FROM sflight
        INTO TABLE t_sflight
       WHERE carrid = s_carrid-low.
      IF sy-subrc NE 0
      AND s_carrid-low NE space.
        MESSAGE e184(bc_global) WITH text-007.
      ENDIF.                               " IF SY-SUBRC NE 0
      SELECT carrid                        " Carrier ID
        FROM sflight
        INTO TABLE t_sflight
       WHERE carrid = s_carrid-high.
      IF sy-subrc NE 0
      AND s_carrid-high NE space.
        MESSAGE e184(bc_global) WITH text-008.
      ENDIF.                               " IF SY-SUBRC NE 0
    ENDFORM.                               " AT_SELECTION_SCREEN
    *&      Form  FETCH_SFLIGHT_DATA                                       *
    * This Subroutine Fetches Data from the Database table Sflight         *
    *  There are no interface parameters to be passed to this subroutine.  *
    FORM fetch_sflight_data .
      SELECT carrid                        " Carrier ID
             connid                        " Connection ID
             fldate                        " Flight Date
             price                         " Price
             currency                      " Currency
             seatsmax                      " Seats Maximum
             seatsocc                      " Seats Occupied
        FROM sflight
        INTO CORRESPONDING FIELDS OF
       TABLE t_sflight
       WHERE carrid IN s_carrid.
    ENDFORM.                               " FORM FETCH_SFLIGHT_DATA
    *&      Form  display_sflight_data
    * This Subroutine Displays Data from the Database table Sflight        *
    *  There are no interface parameters to be passed to this subroutine.  *
    FORM display_sflight_data .
      LOOP AT t_sflight INTO sflight.
        AT FIRST.
          FORMAT COLOR 1.
          WRITE :  /5  'Carrier ID'(002),
                  140  space,
                  /25  'Flight Date'(003),
                  140  space,
                  /44  'Seats'(004),
                   65  'Seats'(004),
                  140  space,
                  /44 '(Maximum)'(005),
                   65 '(Occupied)'(006),
                  140   space.
          ULINE.
        ENDAT.
    *" AT NEW CONNID
        AT NEW connid.
          FORMAT COLOR 6 INTENSIFIED OFF.
          WRITE :/  sflight-carrid   UNDER text-002,
                 10   sflight-connid.
        ENDAT.                             " AT NEW CONNID
        FORMAT COLOR 5 INTENSIFIED OFF.
        WRITE :/  sflight-fldate   UNDER text-003,
                  sflight-seatsmax UNDER text-005,
                  sflight-seatsocc UNDER text-006,
               90 sflight-currency,
              110 space.
        w_gross = w_gross + sflight-price * sflight-seatsocc.
        w_curr = sflight-currency.
    *" AT END OF CONNID
        AT END OF connid.
          FORMAT COLOR 3 INTENSIFIED OFF.
          WRITE :/ 'Total Bookings so far '(009),
                 40 w_gross,
                 60 w_curr.
          w_net = w_net + w_gross.
        ENDAT.                             " AT END OF CONNID
    *" AT END OF CARRID
        AT END OF carrid.
          SKIP 2.
          FORMAT COLOR 3 INTENSIFIED ON.
          WRITE :/ 'Total Bookings so far for '(013),
                   sflight-carrid,
                   w_net,
                   w_curr.
          ULINE.
          CLEAR w_gross.
          CLEAR w_net.
        ENDAT.                             " AT END OF CARRID
      ENDLOOP.                             " LOOP AT T_SFLIGHT...
    ENDFORM.                               " FORM DISPLAY_SFLIGHT_DATA
    This is to sum the prices of a flight according to currency key
    Regards,
    Swapna.

  • Currency field in alv report

    hi
    i have to display the currency field o/p with diff. currencies according to countries.how can i do that.

    Hi,
    see example program ERGP2070. It is doing something similar to your requirement.
    It is declaring currency as a separate field 'WRG'. and for amount field, setting CFIELDNAME field as 'WRG' and DO_SUM = 'X'.
    try this.
    Regards,
    Satish

  • Summary report treats a currency fields as text

    In the summary report I have three charts with the currency field. The two charts show 'average' and 'total' but the other chart shows 'percentage' of responses - in other words the report treats that field not as a number but as text. The filed is designated as a currency in the desing view. Why is it treated as text?

    Hi,
    The percentage of responses is a reference for the responses of that field.  If you don't want it to show, you can disable it.
    Hope this help,
    Perry

  • ROUND OFF IN CURRENCY FIELD

    Hi,
    In my report I am displaying the currency field NETWR in ALV Report.
    Now, the requirement is as such-
    For eg- If the value of NETWR field is 57,441.50 then I want to round it off to display only 57(assuming that all values in thousands) i.e 57,441.50 would be considered as 57,000 only.
    I think there is some functional module to solve this problem.
    Can somebody help me regarding the same,points will be rewarded.

    Hi friend
    Try this.
    Check this sample:
    DATA: WA_INPUT TYPE P DECIMALS 8,
    WA_OUTPUT TYPE P DECIMALS 2.
    WA_INPUT = '5678.65800341'.
    CALL FUNCTION 'ROUND'
    EXPORTING
    INPUT = WA_INPUT
    IMPORTING
    OUTPUT = WA_OUTPUT
    EXCEPTIONS
    INPUT_INVALID = 1
    OVERFLOW = 2
    TYPE_INVALID = 3
    OTHERS = 4.
    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: WA_OUTPUT.
    OR this,
    DATA: I TYPE I,
    P TYPE P DECIMALS 2 Value '3.5'.
    I = P.
    Reward if helpfull.

  • Currency Field in Smart Form

    Hi,
    How to Display Currency Field in SmartForm  and how to declare

    You can display a field in GLOBAL data of TYPE I (v_menge).
    then in the related window of that Quantity field create PROGRAM LINES and in that write a small code such that
    MOVE ITAB-MENGE to v_menge.
    Now display this field v_menge in the smartform
    Regards
    Anbu B

  • Currency field in service PR

    hi
    currency field in service PR for item category D and B is greyed out, it cant be changed according  to sap note
    do u have any workaround or any other alternative how this can be chnaged?

    Hi,
    I hope I have understood your question correctly!!
    You can maintain Service or Limit in item details there you have the option of maintaining price.
    Please for your reference go thru this document: http://www.sap123.com/a/52/
    Hope you find these useful.
    Reetesh

  • Stock account currency field in MB5L report

    Hi!
    can any one tell me in MB5L report for field materials currency and stock account currency, from system will pick up the values?
    I think materials currency field will pick up from GL accounts?
    But stock account currency, from where it will pick up value?
    regs,
    ramesh b

    Hi!
    both are not GL account balances.
    I have studied the report and understood.
    the material currency field: just it will take total stock avialable * std price/MAV price ( it will be equal to value in material master, MB5B, MB51 )
    the stock account currency field: it will take GL account balance via valuation class ( OBYC setting BSX)
    Here for example if you select only one material in MB5L report , it won't show the GL balance pertaining to that material, it will simply show the total GL balances that means system won't check material number existed in line items ( BSEG table).
    any way thanks for your inputs.
    regs,
    ramesh b

  • Dynamic displaying of decimal points for currency field in ALV

    Hi,
            In ALV output there is a currency field and displaying data of different countries. It should display decimal point according to the country's currency. But at a time it can display data of different countries.

    Hi Dilip,
    I think your question is about currencies with different number of digits after decimal point. If you have the currency field in the ALV row, you have to give it's name as currency reference for the value field in the field catalog.
    After creating the field catalog, call a form and do something like this (change fielnames accordingly).
    <pre>
    *&      Form  alv_fieldcat_enhance
          Individual Enrichment of field catalog
    FORM alv_fieldcat_enhance
      CHANGING pt_alv_fieldcat TYPE slis_t_fieldcat_alv.
      FIELD-SYMBOLS:
        <alv_fieldcat> TYPE slis_fieldcat_alv.
      LOOP AT pt_alv_fieldcat ASSIGNING <alv_fieldcat>.
        IF <alv_fieldcat>-fieldname(5) = 'KBETR' OR
           <alv_fieldcat>-fieldname(5) = 'SKBTR' OR
           <alv_fieldcat>-fieldname(5) = 'DMBTR'.
    Company code currency
          <alv_fieldcat>-cfieldname = 'BWAER'.
    Document Currency for conditions, net value and taxes
        ELSEIF  <alv_fieldcat>-fieldname(5) = 'KWERT' OR
                <alv_fieldcat>-fieldname    = 'NETWR' OR
                <alv_fieldcat>-fieldname    = 'NPAX_MWST_AMNT'.
    Document Currency
          <alv_fieldcat>-cfieldname = 'WAERK'.
        ENDIF." <alv_fieldcat>-fieldname(5) = 'KBETR' or
      ENDLOOP." at pt_alv_fieldcat assigning <fieldcat_alv>.
    ENDFORM.                    " alv_fieldcat_enhance
    </pre>
    Regards,
    Clemens

  • To calculate average for a currency field in alv

    Hi,
    I have a requirement in which i need to find the average of a currency field in alv. For the particular field, i'm passing the value of DO_SUM = 'C' in thr field catalog(as suggested in many threads); but I'm not able to calculate the average. it still shows me summation when i click on summation button.
    What could be the possible error??? Is there any other method we can do the same??
    Thanks in Advance.
    Jaspreet

    Hi
    U can try this way.
    *& Report  Z_DEMO_JG
    *& Display average in ALV report
    REPORT  z_demo_jg LINE-SIZE 80 LINE-COUNT 50
                                         NO STANDARD PAGE HEADING.
    TABLES: sflight.
    TYPE-POOLS: slis.
    * Data declaration
    DATA: i_flight TYPE STANDARD TABLE OF sflight,
          i_catalog TYPE slis_t_fieldcat_alv,
          w_flight TYPE sflight,
          w_catalog TYPE slis_fieldcat_alv.
    DATA: v_repid TYPE syrepid.
    * Selection screen
    SELECT-OPTIONS: s_carrid FOR sflight-carrid.
    START-OF-SELECTION.
    * Fetch data from sflight table
      SELECT *
       FROM sflight
      INTO TABLE i_flight
      WHERE carrid IN s_carrid.
      CHECK sy-subrc = 0.
      v_repid = sy-repid.
    * Build field catalog for ALV report
      PERFORM build_catalog.
    * Display ALV report
      PERFORM display_report.
    *&      Form  build_catalog
    *       Build field catalog for ALV report
    *       None
    FORM build_catalog .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = v_repid
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = i_catalog
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc = 0.
    *   For average populate 'C' as value in
    *   field DO_SUM
        w_catalog-do_sum = 'C'. " C = Average
    *   Modify record with new value
        MODIFY i_catalog FROM w_catalog TRANSPORTING
        do_sum WHERE fieldname = 'PRICE'.
      ENDIF.
    ENDFORM.                    " build_catalog
    *&      Form  display_report
    *       Display ALV report
    *       None
    FORM display_report .
      IF i_catalog[] IS NOT INITIAL.
    *   Call ALV grid
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = v_repid
            it_fieldcat        = i_catalog
          TABLES
            t_outtab           = i_flight
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc = 0.
        ENDIF.
      ENDIF.
    ENDFORM.                    " display_report
    Edited by: meetjoe on Sep 15, 2009 7:17 PM

  • How can we sort up currency field in alv grid??

    Hi GUrus,
    Can any one suggest me how to sort the currency field in alv grid...Please help me out of this issue..
    Thanks in advance!!!
    regards,
    Kranthi.

    hii,
    SAP provides a set of ALV (ABAP List Viewer) & function modules, which can be used to enhance the readability and functionality of any report output.
    ALV is a flexible tool used for displaying lists.The tool provides common list functions & can be enhanced by self-defined options.
    so u will get the option for sorting in your alv report.
    Thanks

Maybe you are looking for

  • Can't access photos after upgrade to iPhoto 11

    I upgraded OSX to 10.8.2 and iPhoto from 9 to 11. Using Library Manager, I opened the first "old" iPhoto library and followed the screen instructions to upgrade it for iPhoto 11. A message came up stating that there were some errors in the library, s

  • Hey,, I have a problem with my I'd I can' remember my security question

    I need your feedback ASAP please

  • Table for checking System Status in a Service Order

    Hi, In which table can I find System Status (like REL - Released) of a Service Order ? Thanks. Raj

  • Web Publisher

    I am new to this. I am in the process of setting up a new website for our company. Our network provider has asked me to Put up the trial pages using web publisher. I have the document saved in both Microsoft Publisher 2003 and Word 2003 I have downlo

  • Stop iMatch From Uploading WAV Files ?

    I'm in the process of recording all my old LPs, and part of this process is the conversion from WAV to MP3 by iTunes.  (I'm using SoundForge 4 for the recording, it's old and doesn't recognise Mp3). The problem is that as soon as I add the WAV files