How to set error message inside the loop...module pool

Dear all,
     Am creating Table Control without wizard. In that i am looping the values, that is, Once if i entered 5 digit values means, 12345-08... the values should be stored in z-table like this 12345,12346,12347,12348 . That is 5-8 it as to update in z table. for this i createdloop at itab and inside that i written a code to count the value and all. and also its clearly updating the value in ztable too. now i want to know, if once again i entered the same value means, like 12345-08.. it as to show error messge.I dont know how to set the condition with error message inside the single loop .... Its all comes under module pool program.
Thanks,
Santhosh.R

If i understood your doubt, here goes the answer.
LOOP AT itab INTO wa_itab.  " This is your loop
  l_tabix = sy-tabix. "l_tabix receives the line of the loop
  READ TABLE itab WITH KEY itab = wa_itab.  "itab is the same tab of your loop
  IF sy-subrc EQ 0 AND l_tabix NE sy-tabix.    "Here the sy tabix have the value of the read table.
*     Here you do your error treatment.
  ENDIF.
ENDLOOP.
Explanation: When you are looping your internal table, you use a READ TABLE to see the already recorded registers. If the read table finds one register (sy-subrc EQ 0) and the this register is not the one of the current line (l_tabix NE sy-tabix). It means you have a duplicated register.
Maybe there is someway easier to do this, but this is what i thought now.
I hope this was your doubt hehe.
Thales Schmidt

Similar Messages

  • How to give error message for the screen element text field when wrong i/p

    How to give error message for the screen element text field when wrong i/p
    when wrong input given
    eg. 
    I have a text box with SBOOK-CARRID
    so when user give wrong entry in text box i.e LG
    then I should give some error stating that the the input is invalid or not available ,
    now it showing the error of standard messages,
    i want manual message to be displayed when error comes.
    Thank you,
    Regards,
    Jagrut Bharatkumar Shukla

    Hi all,
    Thank you for your valuable reply,
    but the thing is that its a screen field,
    i.e text box not a selection screen
    i created in screen layout
    with name sbook-carrid
    now i want to get error message display if wrong i/p is given
    thank you.
    Regards,
    Jagrut bharatkumar Shukla,

  • How do we trap exception inside the function module?

    How do we trap exception inside the function module?

    Use ABAP Help - CATCH, RAISE for starters. Or take a look at an existing function module, for example.

  • How to catch error message inside a variable?

    Hi,
    I'm trying to catch the error message inside a variable using this this command below:-
    <%=odiRef.getPrevStepLog("MESSAGE")%>
    Could you please tell me what is the right approach to capture the error message inside a variable.
    Thanks
    Anindya

    Hi Bhabani,
    I have done this and select an oracle schema.But the variables only captures the (null).Please look into this.You must have one step prior to this refresh variable. Then only it can get the status as given below.
    Returns the one-letter code indicating the status with which the previous step terminated. The state R (Running) is never returned.
    D: Done (success)
    E: Error
    Q: Queued
    W: Waiting
    M: Warning
    If you want the complete error details then you will face issues in case of multi line message. For this best option would be jython variable.Could please provide me some idea how to use this jython variable.I will update you on this soon
    Thanks
    Anindya

  • How to avoid data selection inside the loop?

    Hello Experts,
    I am working on one performance item and I have already applied some changes to the original version.
    Now, If I compare my new program with old program, I have good improvement in performance. I am checking if I can do anything on statements that are top on the below list. I think 40% for Modify statement is acceptable after my research (Below run is updating around 20M records which is real time volume for this application).
    As we can see 34% of run time to going for one SELECT query on custom table. Take a look at below high level flow of my program to understand above select query.
    1. Select data from ZABC
    2. Select data from Variant Table (Var1, Var2, Var3 etc.., 12 in real time)
    3. Loop Variant Table
    4. Select data from X, Y, Z table for Var<n>.
    5. Populate final internal table from ZABC, X, Y and Z table
    6. Modify ZTABLE with Final Internal table data
    7. End Loop on Variant Table
    As described in the flow of the program, ZABC table data is common for all the variants and need not to fetch multiple times. Hence I am doing it only once in my program. Below is that select query:
    select rrcty ryear rbukrs racct rcntr sum( amt1) as amt1  "Like I have 32 amount fields in original query
               from zabc
                into table i_zabc
                where ryear in r_year    " Two records in ranges with I and EQ
                and rvers = '001'
                and rrcty in r_rrcty        "Three records in ranges with I and EQ
                and rldnr = 'DT'
                group by rrcty ryear rbukrs racct rcntr
                order by rrcty ryear rbukrs racct rcntr.
    ZABC table is again having huge volume of data and we are fetching millions of records with above query. That is primary reason to take long time. May be that is okay as I am already using Indexes of this table. But, I am not comfortable with it as it can reach max. memory point and through run time error. Fetch Cursor is one reliable option that I can see here, but with that, I should move ZABC selection inside the variant loop which can cause fetching ZABC data 12 times (Let me know If I am missing anything here).
    Now, third statement in my trace results, with 10% of overall time is this:
    loop at i_abc assigning <fs_abc>. 
    loop at i_table assigning <fs_table> where low <= <fs_abc>-racct and high >= <fs_abc>-racct. 
    endloop. 
    endloop. 
    6 million executions with this complex WHERE condition is causing this statement to get 3rd position in trace results. I tried below two options which are, I think, taking even more time - (I am still monitoring these options)
    1) Removed WHERE condition on LOW, HIGH and applied filter inside the loop.
    2) Removed WHERE condition on HIGH only and applied filter inside the loop.
    Any suggestions on how to proceed with ZABC selection and I_TABLE loop.
    Let me know if you have any questions on above compose.

    Since I looked at this case before, let me try some quick suggestions:
    Is table ZABC related to table X, Y and/or Z and can the selection be limited by applying those 12 selection variants?
    If yes, try a join select involving these tables that could make your step 1 obsolete and replace steps 4 and 5.
    This might also get rid of the "loop inside loop" problem. Generally, make sure that the inner table is declared as a sorted table with a key that consists of the fields as used in the WHERE-condition of the inner loop. Use secondary keys for internal tables if your ABAP release permits and the task at hand warrants it.
    Finally, look at PACKAGE SIZE option for the (join) select to reduce memory consumption.
    Thomas

  • How to display error message on the screen

    I am new to WD world and need all possible steps to resolve the following issue.
    I need to display the error message on the screen if any required field is empty when user click on SAVE button.
    I have set the attribute GO_MESSAGE_MANAGER and check the both box for  PUBLIC and REFTO and set the associated type IF_WD_MESSAGE_MANAGER under COMPONENTCONTROLLER.
    Under the method of COMPONENTCONTROLLER set the value WD_THIS-GV_NAV_FORBIDDEN = IV_NAV_FORBIDDEN. Which is type IMPORTING of associated type WDY_BOOLEAN.
    GV_NAV_FORBIDDEN has been set to attribute WDY_BOOLEAN in the COMPONENTCONTROLLER.
    Under the ACTION (on SAVE button) of my default view (VW_DEFAULT) I am doing the following.
    IF lv_f_name IS INITIAL
        CALL FUNCTION 'BALW_BAPIRETURN_GET2'
          EXPORTING
            type   = 'E'
            cl     = 'HRRCF0002'
            number = '020'
          IMPORTING
            return = ls_return.
        lv_message = ls_return-message.
    NEED TO PUT CODE TO PASS IT ON
    ENDIF.

    The thing I can not figure out is the input parameter of this call. My CONTEXT has a node1->node2->node3->f_name.
    CALL METHOD lo_message_manager->report_attribute_error_message
      EXPORTING
        message_text              = lv_message
        element                   = HOW WIILL YOU FIND THE VALUE OF THIS
        attribute_name            =
       params                    =
       msg_user_data             =
       is_permanent              = ABAP_FALSE
       scope_permanent_msg       = CO_MSG_SCOPE_CTXT_ELEMENT
       msg_index                 =
       cancel_navigation         =
       is_validation_independent = ABAP_FALSE     .
    wd_comp_controller->set_navigation_forbidden( iv_nav_forbidden = abap_true ).

  • How to add an error message in the application module?

    Hi,
    I have some code running in the application module. I want to display error messages in the messages section of the screen if an error happens in my code.
    How could I achieve this?
    I am using JDeveloper 10G
    Thanks

    Muhammed,
    Have you tried throwing a JboException in your AM code?
    John

  • CcBPM, how to capture error message in the exception branch ?

    Hi,
    Can I capture error message in the exception branch ? how to do that ?
    because i want to raise the alert including with the error message ?
    Cheers
    Fernand

    Hello Fernand,
    I hope at the end of this you may get some knowledge on Alerts.
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step XI:Alerts step-by-step. (fundamental Basic)
    /people/sap.user72/blog/2005/11/24/xi-configuring-ccms-monitoring-for-xi-part-i CCMS Monitoring for XI. (CCMS monitoring for XI is enough later
    we configure to Adapter Engine).
    /people/aravindh.prasanna/blog/2005/12/23/configuring-scenario-specific-e-mail-alerts-in-xi-ccms-part--1 Configuring scenario specific E-mail alerts in XI-CCMS: Part-1
    (This is Important)
    /people/aravindh.prasanna/blog/2005/12/24/configuring-scenario-specific-e-mail-alerts-in-xi-ccms-part-2 Configuring scenario specific E-mail alerts in XI-CCMS: Part-2
    /people/aravindh.prasanna/blog/2006/02/20/configuring-scenario-specific-e-mail-alerts-in-xi-ccms-part-3 Configuring scenario specific E-mail alerts in XI-CCMS: Part 3
    /people/federico.babelis2/blog/2006/05/03/solution-manager-cen-and-alerting-configuration-guide-for-dummies Solution Manager CEN and Alerting configuration (Advanced)
    Please reward points if it is useful...
    Thanks,
    Satya Kumar

  • How to set error message for 541 Movement type

    Dear gurus,
                I want to know that is it possible to set error message through any configuration? My requirement is that when we create issue document using m.t 541 it will not allow me to process that document without releasing PO document.so for that i want to set error message.
    <removed by moderator>
    Message was edited by: Jürgen L

    Hi,
       The subcontracting goods issue can be done even without PO reference. If your organization is strictly following the goods issue against PO only and you want to restrict the goods issue if the PO is not released, then you may check the below option. Please note that the below option is available in standard only from EHP 4 or above.
    1. Refer the KBA: 1915825 - Transfer Posting reference to a Purchase Order in MIGO and activate the PO reference option in MIGO - Transfer posting.
    2. Restrict the use of 541 movement in MB1B - Go to OMJJ and enter movement type as 541. Now go to "allowed transactions" folder and remove MB1B. Now the user cant use 541 in MB1B.
    3. Maintain the field - Purchase order as mandatory field for the movement type 541 in OMJJ.
    4. Train the users to use MIGO - Transfer Posting - Purchase order option for goods issue with 541 movement.
    5. If the PO is not released, system wont allow to use the PO in MIGO - Transfer Postings.
    6. If the user is selecting Transfer Posting - Other, system wont check the PO and hence it will allow to post the goods issue even if PO is not released. You may take organizational measures to restrict the usage or you may check for authorization concept - Refer the note: 773003 - MIGO: No authorization object for action/reference document
       If you are below EHP 4, there is no standard functionality available for the requirement as of my knowledge. If so, you may go for development to restrict the same.
    Regards,
    AKPT

  • How to capture error message from standard function module

    Dear friends
    when i  execute standard function module in finance , i am getting error message , pls check the below screen shot,
    how to capture the below error message so that i have display in my webdynpro component
    Thanks
    Vijaya

    Hello Vijaya,
    Incase of BAPI's they have a return table parameter T_RETURN. Just read that return table to get the error message.
    Incase of normal function modules, there will be exceptions raised for the message used inside the function module. Just read the sy-subrc after the FM and based on the sy-subrc value find the respective exception raised.
    May be you can try like this, whenever the message is raised it will be stored in the system variable.
    CALL FM.
    check for the system variables.
    sy-msgid = Message ID of the latest message raised.
    sy-msgno = message number of the latest message raised.
    sy-msgty = message type of the latest message raised.
    sy-msgv1 = variable1 of the latest message raised.
    sy-msgv2 = variable2 of the latest message raised.
    sy-msgv3 = variable3 of the latest message raised.
    sy-msgv4 = variable4 of the latest message raised.
    Regards,
    TP

  • How to get error message on the same jsp

    Hi guys,
    I have a login.jsp page and I want an error message to be printed "login failed" in the same jsp page when the user enters the wrong credentials.
    Any ideas on how to do that is highly appreciated.
    Thanx in advance.sri

    If you use struts it would have been a lot easier and better than only JSP.
    In struts :
    Add this line in ur JSP page
    <html:errors/>
    In ur Action servlet ex: LoginAction.java add thsi code extract in the appropriate position ...
    ActionErrors errors = new ActionErrors();
    errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.user.wrong"));
    if (!errors.isEmpty())
    saveErrors(request, errors);
    But in JSP do something like this:-
    If authentication fails then post to the same JSP and put this code in the reqd position...
    <%
    String postFlag=request.getParameter("postFlag");
    if(postFlag.equals("FAILED"))
    %>
    LOGIN FAILED
    <%
    %>
    So for JSp simply set the request parameter  (postFlag)  to SUCCESSFUL/FAILED  from your servlet.

  • Error message in the loop statement

    Hi Experts:
                    In my ABAP program,
                    In the loop of internal table,when match some condition,the system give error message, or go on.
                    Now,if the internal table has ten records,  three records match some condition,the others need
                           process going on.
                    But in my program,if finds error record,giving error message,can't process other records.
                    I want it can not only show error message,but also process other records.
                    Pls give me some advice,tks!

    Hi,
    Message type E is error type and it will terminate your program.
    So either we can declare the message type E as information message or status or we can add a varaible flag which can be set on error.
    So that it would not terminate the program.
    Example :
    Loop at inttable1.
    if condition for error
    flag = 'X'.
    continue.
    endif.
    endloop.
    Outside the loop.
    if flag = 'X'.
    message in other internal table with details.
    endif
    Hope this helps.
    Thanks,

  • MB21Reservation - How to set Error Message?

    Dear Experts,
    For a material say 123456, in the material master Purchasingset OB (Obsolete identified Blocked).
    1. Then when i do reservation through plant manitenance order, the system issue us the error message(its correct)
    2.But when we do MB21-create reservation using 201 movement type, the system allows to create reservation for Material 123456, but it should not allow - it has to issue Error Message
    so how to set in SPRO to issue Error message for this scenario and how to stop creating the reservation for OB set Material in MMR.
    Its urgent, please help me to solve this
    Regards
    Saravanan S
    Edited by: Subramania Saravanan on Jul 20, 2008 9:10 AM
    Edited by: Subramania Saravanan on Jul 20, 2008 9:55 AM

    Hi Friends.
    The solution is...go to SPRO-Logistic general-Material Master-setting for keyfields- Define Material Statusthen double click on OB(Obsolete Block Indicator), then you can see for various process..then assign B(error message) for Inventory management.
    After settings is done, try to do set OB in purchasing view in MMR for a material, and try to do reservation for the material..system states the Error Message.
    Thanks
    Saravanan
    Edited by: Subramania Saravanan on Jul 20, 2008 1:09 PM

  • How to get error message from the BPEL process

    Hi,
    We have some BPEL processes running in BPEL PM 10g. If any of these BPEL process fails, we would like to get the error message caused this process to fail.
    Please let me know where does the BPEL proccess holds (table/file) these details. or is it possible to get the error message programatically.
    Thanks

    You can go through below link that can help
    http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28981/faults.htm#sthref1186
    http://bpelknowledge.blogspot.com/2010/07/error-conditions-that-cannot-be-handled.html
    http://blog.whitehorses.nl/2009/11/03/error-handling-in-soa-suite-11g/
    Hope it helps!!
    Thanks
    AJ

  • How to set/add message to the FacesMessage?

    My code looks as follow:
    <h:commandButton id="submit" value="Submit" action="#{myBean.doSearch}"/>
    <h:messages layout="table" showDetail="true"/>
    What I want is: I will do some check in the doSearch(). If something wrong, I will add message to the FacesMessage so it will be printed out by <h:messages.../>
    How shold I do in the doSearch()?

    Isn't this what you want in your doSearch()(???):
    FacesContext facesContext = FacesContext.getCurrentInstance();  
    FacesMessage facesMessage = new FacesMessage(errorMsg);
    facesContext.addMessage("nameOfForm", facesMessage);/Birna

Maybe you are looking for

  • KB15N_No adjustment account found for cost element Message no. K5112

    When I am trying to post Manual Cost Allocation through TC KB15N with the following input data I am getting the following error message and the same could not be posted.  Kindly advise. Screen Variant used: 01 SAP Cost Center Input Type: List Entry I

  • In which table to find parked, cleared and open invoices?

    in FI how to know which table stores parked , open and cleared invoices? if through FBL1N, what is the way ? thanks

  • 2 different subnets on single vlan

    I have this setup. 2 3750G switches stacked. I have 2 servers with IP 10.10.10.1/30 and 10.10.10.2/30 connected into port g1/0/1 and g1/0/2 respectivily on switch1 both in vlan 100 I have another 2 servers with IP 10.10.20.1/30 and 10.10.20.2/30 conn

  • Special characters don't print from PDF

    I have a PDF file that looks correct when it is viewed but when it is printed from Adobe reader, the following characters do not print:  ÇÃçãõé Has anyone experienced this issue?  Does anyone know how to resolve it? I am using Adobe Reader version 10

  • How to get photos from my new camera to my computer

    I am missing a step somewhere please help. New canon powershot elph 135.  I can't get the photos from the camera to go to the computer.  What am I missing?  I have downloaded several things but ??? And support isn't open on weekends.