Validation of a quantity Field gives a run time dump

I have an upload file which provide me with a quantity input field which i needs to validate for non characters and special characters.
I have used a code which does a validation for the character or special character entry in the field but i am not able to check for '.' in the entry.
the problem is if the user by mistake enters two decimal point which should only be one; the program goes for a dump.
the below given code is what i have used for validation of the quantity field.
  IF NOT wa_final-actual_quan IS INITIAL.
    MOVE wa_final-actual_quan TO l_fld_quantity.
    TRANSLATE l_fld_quantity TO UPPER CASE.
    IF l_fld_quantity CA sy-abcde OR
                      l_fld_quantity CA '!~@#$%^&*"?><`|}{[]()+-='.
     *giving an error message
      v_flag1 = c_x.
    ELSE.
      CLEAR: l_fld_quantity1,l_fld_quantity2.
      SPLIT l_fld_quantity AT '.' INTO
                                  l_fld_quantity1 l_fld_quantity2.
      CONDENSE l_fld_quantity1.
      l_len = strlen( l_fld_quantity1 ) .
      IF l_len LE 10.
        IF NOT l_fld_quantity2 IS INITIAL.
          l_len1 = strlen( l_fld_quantity2 ).
          IF l_len1 LT 2.
          CONCATENATE l_fld_quantity2 '0' INTO l_fld_quantity2.
          ENDIF.
          CONCATENATE l_fld_quantity1 '.'  l_fld_quantity2(2)
                                      INTO l_fld_quantity3.
          CONDENSE l_fld_quantity3.
        ELSE.
          CONCATENATE l_fld_quantity1 '.' '00'
                                      INTO l_fld_quantity3.
        ENDIF.
        wa_zphyin-acqty = l_fld_quantity3.
the requirement is that if the user enters the input for quantity it should only accept one decimal place in the field and if by mistake he enters 2 decimal points it should give an error stating :- invalid input for quantity.
experts please guide as to how i can overcome the problem.
helpfull amswers will be rewarded.

Use try..catch..endtry block to handle the error.
REPORT  Z_TEST2.
data: l_num type p decimals 2.
parameter: p_value type char10.
start-of-selection.
try.
l_num = p_value.
catch cx_root.
write: 'Not numeric'.
exit.
endtry.
write: 'Numeric'.
Regards,
Joy

Similar Messages

  • Getting exporting to excel gives a run time error.

    Hi,
    I am getting exporting to excel gives a run time error.
    <outbind://127/cid:656371011@08092010-11C9>
    while exporting a query to excel from bw
    Regards
    Karan

    Not sure why this thread bubbled up, but for more recent advice on this topic see Troubleshooting issues with iTunes for Windows updates.
    tt2

  • How to check data type of the field symbol at run time

    Hi,
    My code is as following:
          LOOP AT <fs> ASSIGNING <wa_covp_ext>.
            ASSIGN COMPONENT 86 OF STRUCTURE <wa_covp_ext> TO <f_zzname>.
            IF sy-subrc = 0.
              ASSIGN COMPONENT 158 OF STRUCTURE <wa_covp_ext> TO <f_pernr>.
              IF sy-subrc = 0.
                  SELECT SINGLE sname INTO <f_zzname> FROM pa0001
                                WHERE pernr = <f_pernr>
                                AND endda GE sy-datum
                                AND begda LE sy-datum.
             ENDIF.
          ENDIF.
        ENDLOOP.
    This query is giving dump when <f_zzname> is type P length 8 and decimals 2, because it tries to put PA0001-sname into it which is type C length 30. So I want to check the type of <f_zzname> before the select statement. If it is character 30, then I will write the select statement else not.
    How to check data type of the field symbol at run time? If it's not possible, then can somebody suggest a workaround? Thanks.

    check this ...
    write describe statement  ...
    field-symbols : <f_zzname> .
    data : sname like pa0001-sname,
           typ(10).
    assign sname to  <f_zzname>.
    describe  field <f_zzname> type typ.
    write : typ. <-- typ contains character type in this case ..
    U can check if typ is of character(C) if so .. write the select statement ...

  • How to make a text field required at run time when the user clicks the checkbox ?

    I got a form where , there are several checkboxes and text fields associated with that checkboxes.If the use clicks on the check box then the associated
    text fields should become required.I have tried the change event and the click event for the checkboxes.It gives error in the onChnage event and I got some weird results in the on click event .Sometimes if the user click the check box , then for the 1st time the field doesnt become required , then the user onclicks the check box and when the user clicks the checkbox for the second time the field becomes required,but if i deselects the highlighted field option and selects it again the field becomes required even if the user onchecks it I am totally confused !!! Adding to it i have also written the wrong code still i achieved the desired result ?? How it can be possible . I am writing the codes below , please help me as i am working under a deadline from the client.
    onChange event :
    var newVal = this.boundItem(xfa.event.newText);
    if(newVal == 0)
        xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.Purchasecost3_1" ).validate.nullTest = "disabled";
      else
         xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.Purchasecost3_1" ).validate.nullTest = "error";
    For the onClick event :
    var a = xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row2.CostItemRecovere d_OnlyEnergyCharges").rawValue;
    //app.alert(a);
    if(a == 0)
        xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").validate.nullTest = "error";
      if(a == 1)
          xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").validate.nullTest = "disabled";
       Please help someone !!!

    I used the onchange event and wrote the code for it. I got the result . But there is a problem.All these fields are in a table and it's a dynamic table where you can add rows dynamically at the run time .I have other change event for some fields in this table .All are working fine when i add the row.But for this check box the required fields are not validated as required at the run time . I am here giving the code , Please help me .
    form1.Subform0.Subform1.Subform9.Subform10.Table48.Row2.CostItemRecovered_OnlyEnergyCharge s::change - (JavaScript, client)
    if(this.rawValue == "1")
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L2_1").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L1_2").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L2_2").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L1_3").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L2_3").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L1_4").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L2_4").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L1_5").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L2_5").mandatory= "error";
    else
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").mandator = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L2_1").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L1_2").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L2_2").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L1_3").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L2_3").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L1_4").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L2_4").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L1_5").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L2_5").mandatory = "disabled";

  • Make Input field readonly at run time.

    Hi,
    I have a input field on a view , i want to make it <b>readonly</b> during run time depending on some value.
    plz help. reward point is sure.

    Hello Manoj
    You can also make the input field readOnly dynamically during run time. For this you need to write a simple code in wdDoModifyView of your view controller. Code is as follows
    IWDInputField inputField = (IWDInputField)view.getElement("<id of inputfield>");
    if(<reqd condition>)
    inputField.setEnabled(false);
    else
    inputField.setEnabled(false);
    Try this, if things donot get much complicated on doing this. I hope it helps u and makes thing simple.
    Regards
    Kapil

  • How to verify input field value at run time

    Hi all,
    I have a input text field (username) on my jsf page and while entring username i have to verify that input provided by me is correct or not.
    For example-
    I started entering Test in username and error message occurs at the same time after validating from db.
    Can any body provide me the code snippet for the same.
    Thanks much,

    Hi,
    If I understood you correctly, you can set autosubmit="true" on af:inputText, and bind valueChangeListener to the method in backing bean where you can check whatever you need to check. That way, when inputText looses focus (or you press enter), the value will be submited to the server, where you can validate it.
    Pedja

  • Structure field names at run time.

    Hi Experts ,
    i am not sure whether this is right question or not. i have on structure say X with fields name and age. is there any way to represent this field with the help of another variable at runtime.
    ex : Can i represent X-name as X-i where 'I' is s a string and will hold 'NAME' as a value.
    can this be achievable. kindly give reply.
    Thanks in advance.

    types:begin of ty_x,
          name type c,
          end of ty_x.
    data:wa type ty_x.
    data:v type string.
    field-symbols:<fs> type any.
    data:field(4) type c.
    start-of-selection.
    field = 'NAME'.
    concatenate 'WA-' field into v.
    assign (v) to <fs>.
    <fs> = 'A'.
    write wa-name.

  • How to change field text at  run time in alv

    Hi all,
    Following are the columns need to displayed in an alv. year shd be the year which was entered in the selection screen.
    if the year entered was between 2001 and 2003 then the o/p(for year)  shd be as follows
    Division/Name     Position     Management Level     year 2001     Year 2002      Year 2003
    How can i achieve this. i have tried as follows:
      data : lv_yr1(4),
           lv_yr2(4),
           lv_yr3(4).
      clear: lv_yr1,
             lv_yr2,
             lv_yr3.
      lv_yr1 = s_date-low(4).
      lv_yr2 = s_date-high(4) - 1.
      lv_yr3 = s_date-high(4).
      perform fill_fieldcats using:
      'PERNR'         'GT_FINAL' '1'  'Employee No.'            ' '       ' ',
      'RTEXT1'        'GT_FINAL' '5'  'Year'  lv_yr1                ' ',
    form fill_fieldcats using %fname
                              %tabname
                              %col_pos
                              %text_l
                              %text_m
                              %emphasize.
      gs_fieldcat-fieldname  = %fname.
      gs_fieldcat-tabname    = %tabname.
      gs_fieldcat-col_pos    = %col_pos.
      gs_fieldcat-seltext_l  = %text_l.
      gs_fieldcat-seltext_s  = %text_m.
      gs_fieldcat-emphasize  = %emphasize.
      append gs_fieldcat to gt_fieldcat.
      clear gs_fieldcat.
    but the o/p i'm getting is only year. where shd i pass the value of year in the fieldcatalog?

    Hi all,
    My self resolved the issue.

  • Why given error give at run time

    org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/jsp/jstl/core) cannot be resolved in either web.xml or the jar files deployed with this application
         at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:105)
         at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430)
         at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
         at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:159)
         at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
         at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
         at org.apache.jasper.compiler.Parser.parseElements(Parser.java:795)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
         at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
         at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
         at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:227)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)

    configure the web.xml with <taglib>
    <uri>http://java.sun.com/jsp/jstl/core</uri>

  • UPS for 2 dell r710s and some switches. What gives longest run time?

    Hello all, I hope this section also counts for battery backup? I have been looking at tons of different options for UPS, and of course there are the watts, VA ratings, and amount of batteries you actually have connected, but what is the best to shoot for?We have one eaton 9130 with an extra battery pack on it, but most everything is plugged in to it and its at nearly full load as is. We also have 2 dell R710's that I have each individually one larger individual UPS's, but they are only the bigger desktop model ones.I am trying to get a decent runtime setup to put the 2 r710's on, and probably half the switches (6 of them total, HP procurve's 1 48, 3 24's, and 1 16port L3, and a sonicwall tz215)I was looking at the cyberpower systems backups, and they have 3kw ones with extra battery options.Can anyone make a recommendation on what...
    This topic first appeared in the Spiceworks Community

    Hello all, I hope this section also counts for battery backup? I have been looking at tons of different options for UPS, and of course there are the watts, VA ratings, and amount of batteries you actually have connected, but what is the best to shoot for?We have one eaton 9130 with an extra battery pack on it, but most everything is plugged in to it and its at nearly full load as is. We also have 2 dell R710's that I have each individually one larger individual UPS's, but they are only the bigger desktop model ones.I am trying to get a decent runtime setup to put the 2 r710's on, and probably half the switches (6 of them total, HP procurve's 1 48, 3 24's, and 1 16port L3, and a sonicwall tz215)I was looking at the cyberpower systems backups, and they have 3kw ones with extra battery options.Can anyone make a recommendation on what...
    This topic first appeared in the Spiceworks Community

  • Set value Field in run time

    hello guys!!!
    it's called the process where
    on my screen I have two fields
    Field 1: enabled for editing
    Field 2: disabled for editing
    when i fill the value in a field 1 I want to play the same value for the field 2 in run time. that´s possible?What can I study?

    So, you want the user to be allowed to enter a value in field 1, then after tabbing out to the next field, display that same value in a non-editable field underneath?
    You can definitely implement this using Partial Page Rendering (PPR).
    Go to your help section within JDeveloper. Type in "Partial Page Rendering Exercise". A tutorial will pop up showing you how to implement this sort of thing.

  • Run time error on RF device

    Hi All,
    We are using a Z function on RF  device  we get a run time error.While packing a material for delivery we key in material no & hit enter to poulate the desc. of material and then enter quantity and continue.After keying in material when we hit enter it gives a run time error but if we press OK it continue..but on SAP GUI we dont see this problem. What could be solution for this isssue..
    Also after this when we do a post goods issue it takes long time for processing and doesnot return sucess messege but if we check in SAP PGI is done sucessfully..
    We are using Telnet
    Thanks,
    Anand K

    Hi Suresh,
    I checked the database connectivity.. and I am getting the communication back. So there is no problem with RFC connectivity.
    I dont know if it helps, I am getting another problem and as u mentioned abt the planning version, may be it helps...
    Actually the model is active...but when I go to the product view in IPP, I am getting the error "Invalid planning version"
    Regards,
    aarvey

  • MSS PORTAL -  RUN TIME ERROR WHEN EXECUTING A WORK ITEM IN UWL

    Hi all,
    I've a requirement wherein I need to have a custom screen in place of 'standard user decision' task in the UWL of MSS portal. I've developed a custom screen with Approve and Reject buttons and it works fine if I execute the work item from SAP inbox whereas in portal (UWL), it gives a run time error stating,
    Portal Runtime Error
    An exception occurred while processing your request
    Exception id: 10:56_12/05/08_0020_509163550.
    I'm sure that this error is due to missing configuration between the dynpro and the Portal. All inputs in this regard will be of great help and will be valuable to me.
    Thanks in advance,
    Bharathi.

    Hi
    Looking at the error message I feel like there is something wrong in the task object and object method. You are using a class in the task make sure that class has the IF_WORKFLOW. Mak sure the task is enabled with synchronous task method check box.
    Regards
    Pavan

  • Explanation of run time error & its process of elimination

    what is the following runtime errors .When does it occur & how can we eliminates these-
    1. SYSTEM_NO_SHM_MEMORY
    2. RAISE_EXCEPTION
    3. UNCAUGHT_EXCEPTION
    With Regards
    Amit Singh

    Hi Amit,
    I am not sure about the run time error SYSTEM_NO_SHM_MEMORY, however the other two I know a little about.
    RAISE_EXCEPTION can be the cause of the run time dump UNCAUGHT_EXCEPTION. In ABAP program, you might have a function module or method which raises an exception using the command RAISE <exception>. Now if in your calling application you do not "handle" the exception, then the dump UNCAUGHT_EXCEPTION occurs.
    The solution to this is to always handle the SY-SUBRC after a function module call and also using the TRY - CATCH <exception> - ENTRY for catching and handling exceptions in classes in your program.
    Please use F1 on CATCH/TRY command for more on this.
    A dump shows you the reason for the dump in quite a bit of detail in "Error Analysis" section and also gives a solution.
    Check ST22.
    Regards,
    Aditya

  • QUANTITY field Validation

    Hi,
    I have a field lw_bfquant , once the user enters a value for quantity on the screen, I want to check that this field is not zero, not negative and doesnot have decimals .what code should I write for this?
    <REMOVED BY MODERATOR>
    Thanks.
    Deepti.
    Edited by: Alvaro Tejada Galindo on Feb 11, 2008 4:50 PM

    Try this:
    REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
    PARAMETERS bfquant TYPE erfmg.
    DATA: rem(5) TYPE p DECIMALS 3.
    * No need to check for negative - not allowed in ERFMG
    IF NOT bfquant > 0.
      MESSAGE e001 WITH 'Quantity must be greater than 0'.
    ENDIF.
    rem = bfquant MOD '1'.
    IF rem <> 0.
      MESSAGE e001 WITH 'No decimals allowed'.
    ENDIF.
    I think all the other solutions only work for character fields. You can only enter numerics into quantity fields, so you don't have to check that..
    Rob
    Edited by: Rob Burbank on Feb 11, 2008 4:33 PM

Maybe you are looking for

  • Length error occurred in IMPORT statement.

    Hi All,            while exexuting a program i got dump saying that Length error occurred in IMPORT statement. through ST22 i came to know that both import and export structres are not same. Import structure is longer than the export structure.      

  • About re-installing Snow Leopard...

    If I were to to a clean re-install of Snow Leopard (to solve an issue) and then using Time Machine to restore from a backup, would that defeat the point of me doing a clean install in the first place?

  • Currency outline is not updated

    Hi, I deployed new multicurrency application with all shared dimensions. In EPMA I can see that all the outlines have been loaded without errors or warnings. But when I try to create data form only local currency and default currency available. Edite

  • I cannot reinstall I tunes?

    When I tried to upgrade Itunes i got a message that some file was missing and to reinstall but now I cannot reinstall?

  • Import Dialog: Copy as DNG - how to make it a default

    In the LR3 import dialog box is there a way to change the default to "Copy as DNG" instead of "Copy" I always like to convert to DNG on import. It would save me time if I did not have to click on "Copy to DNG". Thanks, Henry