Warning Message only if 1 to 3 fields do not equal 100%

I have 3 potential fields that will be completed.  If Field1 (Primary Beneficiary) is 100%, then the user will leave Fields 2 and 3 empty.  If Fields 1 and 2 equal 100%, then Field 3 will be empty.  Otherwise they will have values in Fields 1, 2, and 3.  Regardless, they should not be able to continue completing the rest of the form until the sum of these three fields equal 100%.  Therefore I did modify the form as follows, but two issues: it throws the error message up even when first entering a value in Field 1.  This script need NOT run until all 3 fields have been tabbed through, or they click on the next section of the form to continue completing.  The "Total 100" (name of this particular field) is in the Tab Order to appear after "Beneficiary 3 Benefit Percent" field.  And secondly, it still permits the user to continue rather than returning to Field1 even if the total does not equal 100%.  Your assistance is greatly appreciated!  PS:  How do I mark that the post was either helpful or correct?
Rita
event.value = ''; // clear field
// get the values of Beneficiary Benefit fields 1, 2 and 3 as string
var sField1 = this.getField("Beneficiary 1 Benefit Percent").value.toString();
var sField2 = this.getField("Beneficiary 2 Benefit Percent").value.toString();
var sField3 = this.getField("Beneficiary 3 Benefit Percent").value.toString();
// adjust for a field being 100 and others null
if (sField1 == 100 & sField2 == '' & sField3 == '') sField2 = "0" , sField3 = "0";
if (sField2 == 100 & sField1 == '' & sField3 == '') sField3 = "0" , sField1 = "0";
// do only if Beneficiary Benefit fields 1, 2 and 3 are not null
if(sField1 != '' & sField2 != '' & sField3 != '') {
event.value = Number(sField1) + Number(sField2)+ Number(sField3);
if (event.value != 100) app.alert("The sum of Benefit percent must equal 100.", 1, 0);
this.getField("field 1").setFocus();

Two problems just from a first glance at this line:
if (sField1 == 100 & sField2 == '' & sField3 == '') sField2 = "0" , sField3 = "0";
1. You're comparing a string to a number
2. You're separating commands with a comma and not placing {} around the block of commands.
It needs to be something like this:
if (sField1 == "100" & sField2 == "" & sField3 == "") {sField2 = "0"; sField3 = "0";}
There are probably more errors, but start by fixing those.
Also, you should probably post which error message you're getting.

Similar Messages

  • Error Message -MA640 we want this to be a warning message only

    Dear SAP Guru,
    We are using MC75 to transfer demand to MD62, however we got this error messase MA640:No data maintained for material & plant & in transfer period. we wanted this to became a warning message only. Please advise on how to do it. I would greatly appreciate your prompt reply.
    Thank you so much.
    JMTafalla

    Hi,
    Try to use T-code SE91 - Error management.
    Enter the message number
    But standard messages can only be converted by access key and with the help of ABAPer
    Regards
    Amit Parkhi

  • How to compare two currency form fields and display a message if the fields do not equal?

    My form has 2 fields named Total_1 and Total_2. If one of the fields does not equal the other, a hidden field will display a message in red on the form alerting the user. Otherwise, the message does not display. Looks like a validation script but I would greatly appreciate help in getting it started. Any ideas?
    Thanks, Charlie
    charlie6067

    Since the field values that you want to compare are the results of calculations, you should not normally compare their string values, but rather their numeric values when rounded appropriately (and perhaps then converted to a string). For example, if you have two values that display as 3.14, one could be 3.1400000001 and the other could be 3.13999999999991234. When you get the field values as strings and compare them, they won't be equal though they appear to be. Even some values that are numerically identical won't be equal when compared as strings ("0.0" != "0.00") So the code could be changed to:
    // Get the two field values, rounded to two decimals
    var v1 = util.printf("%.2f", getField("Total_1").value);
    var v2 = util.printf("%.2f", getField("Total_2").value);
    // Hide/Show the error message
    event.value = (v1 === v2 || (+v1 === 0 && +v2 === 0)) ? "" : "Error message here.";

  • Warning message when starting trial of After Effects: "Could not rename the file...in workspaces.

    I am trying to download the trial version of After Effects, and it goes through the whole download process fine. But as soon as I try to launch the application, I receive the message "After Effects warning: Could not rename the file '/Users/Rebekah/Library/Preferences/Adobe/After Effects/11.0/Workspaces.35974.1407352380644801.xml' to 'workspaces.xml'.
    What is causing this and what should I do? I've already tried uninstalling the trial and reinstalling it.
    Thanks!

    Having a similar problem as I try to use After Effects CC for the first time. "After Effects warning: Could not rename the file '/Users/timmyd/Library/Preferences/Adobe/After Effects/12.1/Workspaces.583.1407351854988961.xml' to 'Workspaces.xml'.
    When I navigate to the 12.1 folder, I see ModifiedWorkspaces and OriginalUserWorkspaces folders but no "/Workspaces.583.1407351854988961.xml".
    Then I attempted to open a project in AE CS6 (haven't use AE at all in months), I get a simliar message as the project is loading.  "After Effect error: Can't overwrite file"/Users/timmyd/Library/Preferences/Adobe After Effects 11.0-x63 Prefs". ( 3 :: 3 )
    When I click okay the project closes.

  • Warning message in ALV report

    Hi Experts,
    In ALV report i am getting warning like
    " Field string LS_HEADER is not referenced statically"
    Actually i declared this field as "DATA: ls_header TYPE slis_listheader.".
    How to correct this warning message.
    Thanks in advance.
    Thanks,
    Madhu.

    Dear Madhu,
    You are not using LS_HEADER statically that you have defined in the program. You will get a warning message since you have defined a field that you have not referenced statically.
    Are you using this field dynamically? You can delete/comment the code if you are not using it statically and dynamically.
    Moved the thread ABAP forum. Post your queries in relevant forums to get efficient answers.
    Regards,
    Naveen

  • Warning message in 'Writeback Report'

    Hi,
    I have to enable writeback on a report and to prompt a warning message to user before submitting the changes.
    I am fine with enabling the writeback on the report and update the changes through writeback XML.
    But, I am not sure of this 'Warning Message' in a separate window as prompt to confirm the changes made by user before submitting.
    Can somebody please help me if you have implemented this?
    Thanks,
    Viswanath

    Dear Madhu,
    You are not using LS_HEADER statically that you have defined in the program. You will get a warning message since you have defined a field that you have not referenced statically.
    Are you using this field dynamically? You can delete/comment the code if you are not using it statically and dynamically.
    Moved the thread ABAP forum. Post your queries in relevant forums to get efficient answers.
    Regards,
    Naveen

  • Warning message while working with LDB PNP

    Hi experts,
    I am writing the following code....and it is working fine.
    TABLES : PERNR.
    INFOTYPES : 0006.
    GET PERNR.
    RP_PROVIDE_FROM_LAST P0006 '1' PN-BEGDA PN-ENDDA.
    IF PNP-SW-FOUND EQ '1'.
      WRITE : P0006-PERNR,
              p0006-ort01,
              p0006-ort02.
    ENDIF.
    But during syntax check (Ctrl+F2) it is giving me the following Warning message.
    Include DBPNPCOM     68     @09\QWarning@
    In Unicode programs, the "-" character cannot appear in names, as it does here in the name "PNP-SW-FOUND".
    Plz help to get that message removed.
    Rewards gauranteed..........................

    HI Akashdeep,
    This is a part of the PNP LDB and can never be removed as its in the Standard code of SAP LDB... As its a warning message only, ignore this...

  • Is it possible to create warning messages in BPs?

    Hi all,
    We're currently using Unifier version 9.13.6.
    What I would like to do, unlike a validation rule, is to create a Warning Message based on a pull down field and a chosen Work Flow Action.
    For example, if the Work Order Status Pull Down is chosen as "Complete" and the Work Flow Action is chosen as "Sent For Review", the BP would advance to the next Work Flow Step.
    If the Work Order Status Pulldown is chosen as 'In Progress' and the Work Flow Action is chosen as "Update", the BP record would be updated.
    But if the Work Order Status Pulldown is chosen as "Complete" and the Work Flow Action is chosen as "Update", I want a warning message to pop up to warn the user that "Compete" has been chosen as the Work Order Status, but ultimately allow them to Update the BP.
    Unlike a Validation Rule, which would prevent them from updating the record.
    Any assistance would be appreciated.
    Cheers,

    Not to my knowledge.  I have come across similar situations where after the user has entered a certain combination of data that I would like to provide a warning about additional info the user may/should provide, but which may not be necessary in all cases (hence validation would not work), particularly when the issue is on a detail form.  The formula functions don't handle this level of logic.
    This could be an enhancement, but now we’re entering the realm of scripting the system.

  • Warning message after generating RMM Customizing Group

    Hi experts!<br>
    <br>
    I want to generate a customizing group in transaction sdoe_rmm01 in order to prepare the receiver generation. The generation process aborts with the following warning message: "201-Err:Metainfo FM MMW_RMM_METH_META_REG_SERVICE", Message no. RMM034.<br>
    Although it is only a warning message, the group is not getting generated. When I want to generate existing customizing groups, the same behaviour can be observed.<br><br>
    I have looked for more details regarding the warning message and it is number, but I was not successful. Has anybody an idea what the problem is?<br>
    <br>
    Thanks in advance and best regards,<br>
    <br>
    Christoph

    There can be only two possibilities:
    1. You did something wrong which you need to correct
    2. The DOE encountered a programmatic error while generating.
    No matter what the problem is, any sort of error/warning that stops generation should (atleast briefly) explain what the problem is. This one is not. So my opinion is: Raise an OSS message.
    Moreover, the fact that it is referring to a 'metainfo' sounds more like a programmatic error.
    Also: Search SAP Notes referring to a similiar message. Maybe its already fixed.
    Cheers!

  • Warning messages in schema "log".

    Hello all.
    I am creating a payroll function, in order to do some additional validations, and issue some messages, in the schema "log".
    When i want to issue an error message, that stops any kind of furter processing, everything is working fine.
    However, when i try to issue a warning message (yellow color), nothing happens (the message is not issued, in the schema "log").
    Does anyone know what i am doing wrong?
    To issue the error message, i wrote the folowing code:
      if sy-subrc <> 0.
    Mensagem de erro no "log"
        CONCATENATE 'Colaborador' pernr-pernr ',não criado como Fornecedor!'
        INTO wa_PtEXT-TEXT1 SEPARATED BY SPACE.
        wa_PTEXT-TLEVEL = '00'.
        wa_PTEXT-TLENGTH1 = STRLEN( PTEXT-TEXT1 ).
        wa_pTEXT-TINTENSIV1 = 1.
        wa_PTEXT-EMPTY_LINES = 0.
        wa_ptext-message = 'X'.
        APPEND wa_ptext to P_TEXT.
        PERFORM fill_msgtab TABLES p_text
                                   ptext
                            USING  space     "pernr dependent
                                   aper_numb
                                   p_mess_pos
                                   'E'       "error
                                   'A'
                                   error     "T100 Pointer
                                   l_exp.
    To issue the warning message, i wrote the following code, that is not working:
    Mensagem de Sucesso no "log"
            message id wa_mess_tab-msgid type wa_mess_tab-msgtyp number wa_mess_tab-msgnr
            with wa_mess_tab-msgv1 wa_mess_tab-msgv2  wa_mess_tab-msgv3  wa_mess_tab-msgv4
            INTO wa_PtEXT-TEXT1.
            wa_PTEXT-TLEVEL = '00'.
            wa_PTEXT-TLENGTH1 = STRLEN( PTEXT-TEXT1 ).
            wa_pTEXT-TINTENSIV1 = 1.
            wa_PTEXT-EMPTY_LINES = 0.
            wa_ptext-message = 'X'.
            APPEND wa_ptext to P_TEXT.
            PERFORM fill_msgtab TABLES p_text
                                       ptext
                                USING  space     "pernr dependent
                                       aper_numb
                                       p_mess_pos
                                       'W'       "error
                                       'M'
                                       error     "T100 Pointer
                                       l_exp.
    Thanks in advance.
    Sincerely,
    Hugo Ferreira

    Rimpa, could you exemplify the usage of this function module?

  • Warning messages in mapping deployment window

    Hi all,
    After deploying a mapping I got several warning messages but have no clues as to what and where they are referring to. Example of a warning message that I got:
    ORA-06550: line 32250, column 11:
    PL/SQL: SQL Statement ignored
    Do anyone of you know where the line 32250 and column 11 is exactly referring to? I need to see the code in order to know wat's the error. Do I refer to the script in the Script tab? But it seems to refer to nowhere if that is the case...

    Sutirtha Roy wrote:
    Hi ,
    The line numbers in the error messages are usually offset from the start of the package body, but the generated code listing has the package spec and body. So for example you got this one:
    LINE 671 ,COLUMN 12:
    PL/SQL: ORA-00942: table or view does not exist
    So you want to find package body line 671. So inside the generated code viewer, find the text "CREATE OR REPLACE PACKAGE BODY". Note the line number where that occurs, then add it to 671, that should be your actual line number.
    Thanks,
    SutirthaThanks Sutirtha,
    I finally made sense of where the warning messages were referring to. But I could not understand why some of these messages were produced. The scenario is like this.
    I added a unique key constraint on the attribute suppcode in the supplierwh table, and for all instances of this supplierwh table in my mapping where the loading type is "Update", I set the loading properties for both "match column when updating" and "match column when deleting" to No. Validation has got no errors but upon deployment warning messages were produced. Half of these warning messages were of this type:
    Warning
    ORA-06550: line 2449, column 41:
    PL/SQL: ORA-00936: missing expression
    Upon checking where these similar type of warning messages were referring to, all of them were pointing to codes something like below:
    "MERGE_SUBQUERY"
    ON (
    *"T_SUPPLIERWH_T1UPDATE"."SUPPCODE" = AND*
    "T_SUPPLIERWH_T1UPDATE"."SUPPKEY" = "MERGE_SUBQUERY"."SUPPKEY_1"
    I believe the error codes are the ones in bold because there is nothing after the = sign. But I do not understand why this is so. Can anyone help?
    Edit: I think I found the reason to this. Is it because of the "match by constraint" attribute? What does this attribute do when set to "All constraints"?
    Edited by: user8915380 on 29-Apr-2010 01:38

  • I the Dragon Dictate Plugin Safe to install? A warning message came up

    I recently received a message from Dragon Dictate (Nuance) asking me to install a new plugin. When I went to do so a warning message came up saying that the plugin was not fully compliant with standards and that it might allow outsiders to access my personal data. All comments are  welcome.
    Thanks.
    Roy

    Assuming you are using that program, should probably contact its developer to determine the reason for the message.
    Without knowing the source or the content of the warning message, all others can do is guess. A screenshot would be helpful.

  • Warning message from nowhere.

    After months of editing in Adobe Camera Raw with no problems, I go to edit this morning and this lovely warning message greets me. 
    Camera Raw editing is not enabled.   then this below...
    Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature.
    What does this mean???

    I've been having the same problem, but I don't have any trials installed -- all I've ever had on this machine is a registered version of Creative Cloud. But I DO have an issue where CC keeps signing me out.
    So, for anyone else with the same problem who DOESN'T have any trials installed, what worked for me was to shutdown and repair permissions -- even though I hadn't installed anything new, either.
    *shrug*

  • I receive some messages only on imessage but not on my iPhone. How can I change settings that I receive ALL messages on my iPhone? Thanks for all advice!

    Please help. Why do I receive some messages only in imessage (mac book pro) and not on my iphone? How can I change it, so that I receive ALL messages on the iphone? Thanks for any advice

    My messaging app on my OS X Mavericks is disconnected from my iPhone number. It now sends messages via my email. How do I switch it back?

  • Any Ideas - warning message

    Does anyone have an idea, my 3G iPhone has suddenly started showing a warning message when switched on saying 'This accessory is not made to work with iPhone' and suggest switching to plane mode. Any ideas?

    Thats the standard message when you use a non "Works with iPhone" accessory. Nothing to worry about. It can also be caused by debris in the dock connector.

Maybe you are looking for