Error Handling in Forms

Dear all,
we are using oracle developer suite 10g r2 with oracle database 10g r2 against windows server 2003.
Error handling is a very big issue.
i try to do the following, just correct me, or make the trigger more efficient.
i face unexpected messages, like a message two time displayed, sometime important message never displayed.
i just set the :system.message_level =20 in the when-new-form-instance trigger.
and create on-error trigger like below
declare
errcode number:=error_code;dbmserrcode number;dbmserrtext varchar2(200);
formtxt varchar2(200);
errtype varchar2(3);
begin
--------- user defined database exceptions errors raised by --RAISE_APPLICATION_ERROR
IF DBMS_ERROR_CODE in (-20738,.......) then
raise form_trigger_failure;
end if;
if error_code=50017 then
message('duration must be between 0 and 23');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif
error_code=40202 then
clear_message;
message('please provide the required fields.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif error_code=50022 then
clear_message;
message('time must be in the correct format.');message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
if error_code in (40509,40508) then
dbmserrcode:=dbms_error_code; dbmserrtext:=dbms_error_text;
if dbmserrcode=-1438 then
clear_message;
message('your number is too large.try again.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif dbmserrcode=-1400 then
clear_message;
message('your forgot to provide a value.try again.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif dbmserrcode=-2291 then
clear_message;
message('header is not found for this insertion.');message(' ',no_acknowledge);
raise form_trigger_fialure;
elsif dbmserrcode=-1 then
clear_message;
message('record already exists');message(' ',no_acknowledge);
raise form_trigger_fialure;
else
clear_message;
message(error_code||' : '||error_text);message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
else
clear_message;
message(error_code||' : '||error_text);message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
exception
when others then
if dbms_error_code=-20738 then
clear_message;
message('Error: absent or later record errror from the database trigger.);
raise form_trigger_failure;
elsif .....
esle
clear_message;
message(error_code||' : '||error_text);message(' ',no_acknowledge);
raise form_trigger_fialure;
end if;
end;any suggession?
Regards

i must come with a plsql code which handle every error and suppress unnecessary messages.Good luck with that. No matter how well thought out or planned, you're not going to be able to take all scenarios into account. The design of an exception handler takes time to address all possible scenarios you want handled and even then, you're not likely to handle every situation in the beginning.
could we implement the oracle ebusiness error handling procedures here in our application?if yes, then where could we find that procedure?>
I've dug through that code and it is not a thorough as you think it is. It handles specific situations and then defaults the rest. It is a good model for your own exception handler, however. That is what I used it for. :) I don't recall which library it is in, but I'll look around and if I find it, I'll post it.
I agree with Andreas's comment...
Simply remove your ON-ERROR-trigger, then you have a default. That's nothing better or worse than what apex has.I'm not too familiar with Apex; I've worked with it, but it's been a little while. Even with Apex, you're going to have to develop a customized Exception Handler so more intuitive or application specific messages are displayed in response to an exception.
As to Andreas's comment...
For your own error-handling... The "simplest" way in my eyes is create your own error-table where you have appropiate columns for the error-code and the error-type (FRM,ORA,Whatever), then in your ON-ERROR-trigger read the appropiate record from that table and show the error. You could also have a flag in your table which decides what to do with a specific error (Show as Message, Show as Alert, Don't show at all) and react accordingly.This is exactly what we implemented in our application. We created a set of tables that contain all of the Oracle Runtime errors and their attributes (Error Type, Severity Level, etc). Then we wrote a standard On-Error trigger that is subclassed to all of our forms that calls a Library "On_Error" package. This package evaluates the exception raised, compares it to the database entry for the error and then displays an appropriate message depending on the Severity Level, Error Type (ORA or FRM) and Message Type (Informational, Error, Caution) and we display the message in either the Status Bar, Note Alert, Caution Alert or Stop Alert or it is supressed. If an error is not found in the table, then it is displayed in a Stop Alert as an "Unhandled Exception." The second table I mentioned contains all of the messages used by our application and is cross referenced with the table that contains the Oracle messages. By simply assigned one of our messages to an Oracle message - our package will display our message instead of the default Oracle Message. Yes, this took sometime to build and test and once implemented, we spent another couple of months perfecting it, but now it is pretty solid and we haven't had to modify it in over a year.
While this level of complexity may be overkill for your application, it does offer the greatest flexibility in the long-run. Also, if your application must support multiple languages, having all of your messages in a table make internationalization extremely easy. :)
The point of all this, is that no matter which system you use (Forms, Apex, or Java) you will still need to invest some time into designing an Excpeiton Handling method for your application and then implement it accross the application. This is not something you can develop in a short period of time and it will not be perfect in the beginning. However, in the long-run, you will be happy you spent the time up-front to build a flexible and robust Exception Handling system.
Craig...

Similar Messages

  • Error-handling in form routines to be called from maintenance  view

    hello,
    i have created a table maint. dialog. Under 'enviroment->modification->events' you can create form-routines for your own coding.
    I have the maint.event '01 - Before saving the data in the database'. Here i do some checks if entered values in some fields are okay or not etc.....
    When the users enters 'wrong' data i do a "message e000 with 'text' " So i got a error-message and the user is not able to save the data before changing it.
    BUT: i get the right error-message in the status-line, but i got an EMPTY screen, all the fields disapear. I have to go back with enter or the red cancel button. But then i 'fall back' to the selection screen of the maint. view. Thats not very user-friendly.
    Any ideas ?

    hi,
    think you have place your module not correct:
    try that: (without event)
    PROCESS AFTER INPUT.
      LOOP AT EXTRACT.
        FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
        CHAIN.
          FIELD Y789.
          FIELD Y012.
          MODULE LISTE_UPDATE_LISTE.
        ENDCHAIN.
    *begin of insertation
        CHAIN.
          FIELD Y123.
          FIELD Y456.
          module check_field  ON CHAIN-input.
        ENDCHAIN.
    *end of insertation
      ENDLOOP.
    Andreas

  • Order Entry Interface table error handling through Form after Orderimport

    Hi Gurus,
    We are on Oracle Apps 11.0.3.
    I'm just curious to know that is there any form available to correct error records in SO_HEADERS_INTERFACE, SO_LINES_INTERFACE, SO_LINE_DETAILS_INTERFACE, SO_PRICE_ADJUSTMENTS_INTERFACE, SO_SALES_CREDITS_INTERFACE, SO_SERVICE_DETAILS_INTERFACE, SO_LINE_ATTRIBUTES_INTERFACE, SO_HEADER_ATTRIBUTES_INTERFACE tables after running orderimport.
    Most thread says that set REQUEST_ID, ERROR_FLAG and INTERFACE_STATUS columns to NULL in each interface tables. Is there any oracle standard form available to accomplish this in Oracle Apps 11.0.3 or 11i?
    Thanks
    -Manish

    Hi Srinu,
    it looks like you got the error message Schedule line &1 &2 is missing in table YVBEP while deleting the sales order.
    It seems, that there are no SAP notes regarding this issue. Do you have this issue with all orders or with a single order?
    If only a single order causes this issue, maybe something was wrong during an update.
    If you get this error for many orders, then custom code (modification, enhancement, user exit in MV45AFZZ, ...) may be the reason for it.
    If you have no custom code in module pool SAPMV45A, then contact SAP for this issue.
    Regards,
    Klaus

  • General Error handling

    I've managed to get myself confused with error handling in Forms 6i.
    If I have a trigger that does a 'commit-form' like this
    commit_form;
    IF NOT form_success THEN
    RAISE form_trigger_failure;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN;
    END;
    and the commit_form fails due to a mandatory field being missing (or similar) then what happens first?
    Does my ON-ERROR trigger fire?
    Does the form_success check fail and raise form_trigger failure?
    Does my exception block get used?
    Or does more than 1 happen??
    I could - of course - find the answer to this through debug but I'm looking for a more generic answer if possible.
    Thanks - Sean.

    What happens first?  The forms validation process runs and informs user that the field is required.
    Does On-Error fire?  Yes, if you have one in your form.
    Does the form_success check fail and raise form_trigger failure?  Yes -- but ONLY if your On-error raises Form_trigger_failure.  If it does not, you have lots of problems.
    Does my exception block get used?  Yes.  Raising Form_trigger_failure causes control to pass to the exception handler.  But I never use an exception handler except when I code SQL commands.
    Now...  After commit_form, you should also check Form_Status.  Read the help topic on the Form_Success built-in.
    My standard C00_Commit program unit does this:
      COMMIT_FORM;
      IF :SYSTEM.FORM_STATUS <> 'QUERY'
      OR NOT FORM_SUCCESS THEN
        RAISE FORM_TRIGGER_FAILURE;
      END IF;
    END;

  • Error handling in Portal standard forms

    I have a customer who needs to validate input on a Form Based on a Table (standard component). They have tried code, as shown below, as a PLSQL handler on a Save button. This example can obviously be solved with JavaScript validation on the client, but they have similar requirements for validation on DB level.
    If procedure call 1) in the if statement is used, nothing happens. If procedure call 2) is used, it is executed in a new page as a standard error Oracle Portal error message.
    declare
    v_sender VARCHAR2(1000);
    v_sender_id NUMBER;
    begin
    v_sender := p_session.get_value_as_VARCHAR2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_SENDER');
    v_sender_id := p_session.get_value_as_NUMBER(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_SENDER_ID');
    insert into hd (number, text) values (hd_seq.nextval,
    'step 3 v_sender = ' || v_sender ||
    ' v_sender_id = ' || v_sender_id);
    if v_sender_id >= 100 then
    1) Custom error handling, does not display:
    show_error('Error message');
    2) Error handling is displayed, but as a standard error:
    raise_application_error(-20000, 'SenderID must be smaller than 100.');
    else
    doInsert;
    end if;
    end;
    The customer has two questions:
    Why does the custom procedure in 1) "show_error" not execute, and if it does, why does it not display? show_error works and the if statement is entered.
    Is it possible to take control of Portals error handling on standard components (forms etc.), to show custom error messages with the style used on the component/page instead of the standard Error: ORA- ....etc. as Portal displays it?
    Customer needs reply asap. Please reply directly. Any help will be much appreciated!
    Kind regards
    Jakob Lund

    Jacob,
    Try following:
    declare
    v_sender VARCHAR2(1000);
    v_sender_id NUMBER;
    begin
    v_sender := p_session.get_value_as_VARCHAR2(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_SENDER');
    v_sender_id := p_session.get_value_as_NUMBER(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_SENDER_ID');
    insert into hd (number, text) values (hd_seq.nextval,
    'step 3 v_sender = ' || v_sender ||
    ' v_sender_id = ' || v_sender_id);
    if v_sender_id >= 100 then
    p_session.set_value(
    p_block_name => "_block",
    p_attribute_name => '_STATUS',
    p_value => 'Sender ID must be less than 100!');
    -- return to your form with status message set
    -- and all fields filled with recent values
    return;
    end if;
    end;
    -- This point is reached only if validation is OK
    doInsert;
    Regards,
    Henn

  • Error handling in master detail form

    Hi Guys,
    Apex 4.2.1
    I use the custum error handling of apex to customize the errror message.
    I add a row in the detail form with a dupicate key which is handled by the error function
    after submiiting the master record the error message is correct displayed but the row which generates the error is gone from the details.
    How to keep the record in the details visible?
    Thanks

    Hello 942793 -- Do you have a name / nickname? -- We still don't know how to address you,
    Say, could you tell us -- because sometimes different versions have different capabilities:
    Full APEX version number,
    Full database version number,
    APEX web browser architecture (EPG, OHS, or APEX listener)
    Browser(s) and version(s) used,
    Operating System with version number and architecture (32/64 bit),
    [If you mentioned these before we don't have access to that info in this thread.]
    Also, are you using ARP (Automatic Row Processing) for this Master-Detail or have you programmed your own updates?
    Did you use an APEX wizard to create the Master-Detail or have you written you own code for the Master-Detail?
    To the problem:  In short, APEX is ensuring update consistency by preventing an update of a record/row that has changed since the code retrieved it.  So, one needs to figure out where/why it changed and what to do about it.
    ?  Is this Master-Detail part of you application fairly simple?  Could you put just that part out on apex.oracle.com for folks to look at?  That can speed resolution of these, sometimes difficult, update problems.
    Regards,
    Howard

  • Xml forms - Error handling HTTP request

    Hello,
    We have installed portal 6.0
    I've made some forms with the xml form builder, imported them into IViews (KM navigation IView) and assigned the IViews to a role
    The Iview shows the RenderListItem form
    Every Iview (RenderListItem form) has a "new item" button
    Every record of the iview has a edit-delete action
    When I press the "new item" button or the edit button (or save button) I get the following error:
    Error handling HTTP request. Check the log file for more information.
    java.lang.RuntimeException: Context is unavailable!
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMConnection.(DMSRMConnection.java:83)
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMR3FunctionCalls.getGenericValueList(DMSRMR3FunctionCalls.java:6532)
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMR3FunctionCalls.getLaboratoryList(DMSRMR3FunctionCalls.java:6360)
         at com.sap.pct.plm.dmsrmconnectorforkm.DMSRMLaboratoryValueProvider.getAllowedValues(DMSRMLaboratoryValueProvider.java:79)
         at com.sapportals.wcm.service.propertyconfig.config.MetaName.getAllowedValues(MetaName.java:781)
         at com.sapportals.wcm.service.propertyconfig.config.MetaName.allowedValueIterator(MetaName.java:472)
         at com.sapportals.wcm.service.xmlforms.ResourceProperties.appendAllowedValues(ResourceProperties.java:713)
         at com.sapportals.wcm.service.xmlforms.ResourceProperties.mergeProperty(ResourceProperties.java:682)
         at com.sapportals.wcm.service.xmlforms.ResourceProperties.mergePropertiesIntoDom(ResourceProperties.java:611)
         at com.sapportals.wcm.service.xmlforms.transformation.HtmlGenerator.getHtmlStream(HtmlGenerator.java:116)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.render(Transformation.java:391)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.render(Transformation.java:336)
         at com.sapportals.wcm.service.xmlforms.transformation.Transformation.render(Transformation.java:188)
         at com.sapportals.wcm.app.xmlforms.EditServlet.doGetAction(EditServlet.java:165)
         at com.sapportals.wcm.app.xmlforms.XFBaseServlet.doGet(XFBaseServlet.java:241)
         at com.sapportals.wcm.app.xmlforms.XFBaseServlet.doPost(XFBaseServlet.java:261)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sapportals.wcm.app.xmlforms.XFBaseServlet.service(XFBaseServlet.java:134)
         at com.sapportals.wcm.portal.proxy.PCProxyServlet.service(PCProxyServlet.java:331)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sapportals.portal.prt.core.broker.ServletComponentItem$ServletWrapperComponent.doContent(ServletComponentItem.java:110)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
         at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
         at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:545)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    This error doesn't always appear, there are times that the portal works correct and when I can add items, edit them and save my changes
    Does anyone have an idea where the error comes from? In what direction I have to search? How I can solve this problem?
    Thanks in advance, points will be distributed for helpfull answers

    Hi,
    I didn't place a save button on the RenderListItem but on the Edit form so this couldn't be the issue...
    I solved the error I got when I wanted to save my form
    The edit and delete buttons also work correct...
    I only get the error mentioned above when I press the "new form" button, I created that button with the CreateXMLForms action group that I added in my Collection Grid renderer settings (option collection command group)
    Then I changed my form availibility (System administration ->system configuration ->KM->CM->form based publishing->form availibility->folder settings)
    I created the following folder settings:
    foldername//priority//path//forms to exclude//forms to include
    library//10 //documents/testlibrary//Smarties, QnA,SAP_APP_News//library
    News //10 //documents/News//smarties, library, QnA// SAP_APP_News
    QnA //10 //documents/testQuestionAnswer// SAP_APP_News, smarties, library //QnA
    Smarties //10 /documents/testSmarties
    Did I do something wrong here? What can cause this error? In what direction should I search?

  • Error Handling in Oracpe form 9.4.0

    Hi,
    Have you got good documentaion about error handling in Oracle form 9.0.4? If yes, Could you let me know?
    Many thanks
    Michael

    Michael,
    Although, link I'm listing here is for Forms 4.5, the concepts of Error Handling still apply as Forms Error Handling has not changed significantly.
    [Oracle Forms Developer and Forms Server Documentation|http://www.oracle.com/technology/documentation/forms.html]
    Select the "A32506_2      PDF           Forms 4.5 Advanced Techniques" option.
    You can also try the [Oracle9iDS Forms Developer Reference Guide|http://www.oracle.com/technology/documentation/forms/902docs/9iRefGuide.zip] from the [Link to Oracle Forms 10g (10.1.2), Oracle Forms 10g (9.0.4), and Oracle9i Forms (9.0.2) Documentation|http://www.oracle.com/technology/documentation/9i_forms.html]. This is a .zip file which contains the "Forms 9i Reference Guide" pdf file.
    Hope this helps.
    Craig...

  • Error Handling on procedure based forms

    Hi all,
    I have seen examples of error handling on table based forms like
    the following:
    begin
    doInsert;
    exception
    when others then
    --redirect to some error page
    I have tried the same with a procedure based form by wrapping
    the doSubmit procedure, but when the procedure returns an
    exception, it doesn't execute my exception handling code.
    Any ideas on why this is happening or at least how I can catch
    these exceptions with my own exception handler?
    Thanks,
    Curt

    Chetan, Antonio,
    I opened a TAR on this issue with Oravle and they got the same
    results. Thay suggested a work around of creating an error table
    that gets written to and then dispaly and new page to retrieve
    the error from the table.
    What I ended up doing is creating a dummy procedure that does
    nothing (NULL). The form based on the dummy procedure allows me
    to get the values I need from the user.
    The procedure always returns succesful since it doesn't do
    anything. So in the form success code area I call the real
    procedure, check the return value, and now I can redirect back
    to the orignal form on error, or direct to another paqe on
    success.
    Not the most elegant solution, but it is working for now.
    Curt

  • How to catch/read mal-formed xml at Error Handler.

    I have added Error Handler at starting node of Message Flow in a Proxy Service and its(Proxy Service) listenning to a JMS queue.
    So when i am putting a mal-formed XML into the JMS queue, getting "Failure while unmarshalling message: Failed to parse XML text" error at ALSB server log.
    But i am not able to capture the mal-formed xml inside Error Handler node.
    Can any one help me how to capture input mal-formed xml in Message Folw.
    Thanks in Advance.
    Regards.
    Deba

    Re: How to catch malformed xml using error handling mechanism in from a proxy? Had a solution for similar issue. It appears that in-case of malformed XML, $body will not be populated with faulty xml snippet. One way out of this solution is, design your service as Text service and create another service isXML as explained in my above reply.
    Thanks
    Manoj

  • Handle Oracle Error from Oracle Forms

    Actually I have a form with all types of validation and Id will be auto-generated by forms.
    Now if any oracle error occures after pre-insert, auto-generated number will generate but record is not saving.
    I want to handle this oracle error in my form and nullify the auto-generated ID forcefully.
    Edited by: Sudipto Nag on Sep 16, 2008 12:07 PM

    The way we handle database error generally is this:
    You should in any case have a NOT NULL constraint on the database column. In the ON-ERROR trigger, we then check for the dbms_error_code value to see, what error message the database returned, after checking for Forms returning the general trigger exception 40735. For example, to trap a NOT NULL constraint voilation, you would do something like this.
    if error_code= 40735 then --Forms error code = "Trigger raised unhandled exception".         
      if dbms_error_code in (-1400, -1407) then --mandatory not null column missing     
        --do something, like alerting the user
      elsif dbms_error_code in (&lt;other DBMS error codes goes here&gt;) then
        --do something else
      end if;
    end if;I believe this is what you are looking for. Hope it helps.
    Regards,
    Jacob

  • How to perform Error Handling in this Bdc Code

    Hi,
    I had created this BDC for the tcode MB1B and i want to know how to perform the ERROR HANDLING in it ..
    Plzz provide me guidelines for doing it . here's d code:-
    report ZBDC_MB1B
           no standard page heading line-size 255.
    include bdcrecx1.
    data: begin of record OCCURS 0,
          WERKS_001(004),     "Plant
          MATNR_002(018),     "ItemId
          ERFMG_003(013),     "Quantity in Unit of Entry
          ERFME_004(003),     "Unit of Entry
          LGORT_005(004),     "Storage Location
          CHARG_006(010),     "BatchId
          KDAUF_007(010),     "Sales Order Number
          KDPOS_008(006),     "Item Number in Sales Order
          end of record.
    PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME.
      initialization.
      CTUMODE = 'A'.
      CUPDATE = 'A'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILNAM.
      CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
         MASK                   = ',. '
         MODE                   = 'O'
         IMPORTING
         FILENAME                 = P_FILNAM
       EXCEPTIONS
         INV_WINSYS             = 1
         NO_BATCH               = 2
         SELECTION_CANCEL       = 3
         SELECTION_ERROR        = 4
         OTHERS                 = 5
      IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    start-of-selection.
    CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
         FILENAME                      = P_FILNAM
         FILETYPE                      = 'DAT'
        TABLES
          DATA_TAB                     = RECORD
       EXCEPTIONS
         CONVERSION_ERROR              = 1
         FILE_OPEN_ERROR               = 2
         FILE_READ_ERROR               = 3
         INVALID_TYPE                  = 4
         NO_BATCH                      = 5
         UNKNOWN_ERROR                 = 6
         INVALID_TABLE_WIDTH           = 7
         GUI_REFUSE_FILETRANSFER       = 8
         CUSTOMER_ERROR                = 9
         NO_AUTHORITY                  = 10
         OTHERS                        = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT RECORD.
      BEGIN OF SCREEN 1
    perform bdc_dynpro      using 'SAPMM07M' '0400'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM07M-SOBKZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *perform bdc_field       using 'MKPF-BLDAT'
                                 '22.12.2008'.
    *perform bdc_field       using 'MKPF-BUDAT'
                                 '22.12.2008'.
    perform bdc_field       using 'RM07M-BWARTWA'
                                  '411'.
    perform bdc_field       using 'RM07M-SOBKZ'
                                  'E'.
    perform bdc_field       using 'RM07M-WERKS'
                                  RECORD-WERKS_001.             "Plant
    perform bdc_field       using 'XFULL'
                                  'X'.
    perform bdc_field       using 'RM07M-WVERS2'
                                  'X'.
      BEGIN OF SCREEN 2
    perform bdc_dynpro      using 'SAPMM07M' '0421'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSEG-CHARG(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MSEG-MATNR(01)'
                                  RECORD-MATNR_002.             "ITEMID
    perform bdc_field       using 'MSEG-ERFMG(01)'
                                  RECORD-ERFMG_003.             "QTY.
    perform bdc_field       using 'MSEG-ERFME(01)'
                                  RECORD-ERFME_004.             "UOM
    perform bdc_field       using 'MSEG-LGORT(01)'
                                  RECORD-LGORT_005.             "ST.LOC
    perform bdc_field       using 'MSEG-CHARG(01)'
                                  RECORD-CHARG_006.             "BATCHID
    perform bdc_field       using 'MSEGK-MAT_KDAUF'
                                  RECORD-KDAUF_007.             "S.O.
    perform bdc_field       using 'MSEGK-MAT_KDPOS'
                                  RECORD-KDPOS_008.             "S.O.LINE ITEM
    perform bdc_field       using 'DKACB-FMORE'
                                  'X'.
      BEGIN OF SCREEN 3
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'DKACB-FMORE'
                                  'X'.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_dynpro      using 'SAPMM07M' '0421'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSEG-ERFMG(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'DKACB-FMORE'
                                  'X'.
      BEGIN OF SCREEN 4
    perform bdc_dynpro      using   'SAPLKACB' '0002'.
    perform bdc_field       using      'BDC_OKCODE'
                                                '=ENTE'.
    perform bdc_transaction using 'MB1B'.
    ENDLOOP.

    hi,
    check this code in bold letters.
    INCLUDE BDCRECX1.
    TABLES : MARC.
    TYPES : BEGIN OF TY_UPLOAD,
            MATNR TYPE MARA-MATNR,
            WERKS TYPE MARC-WERKS,
            STEUC TYPE MARC-STEUC,
            END OF TY_UPLOAD.
    TYPES : BEGIN OF TY_MARC,
            MATNR TYPE MARA-MATNR,
            WERKS TYPE MARC-WERKS,
            END OF TY_MARC.
    TYPES : BEGIN OF TY_MTART,
            MATNR TYPE MARA-MATNR,
            MTART TYPE MARA-MTART,
            END OF TY_MTART.
    DATA : T_MARC TYPE STANDARD TABLE OF TY_MARC,
         : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD,
         : T_BASIC TYPE STANDARD TABLE OF TY_UPLOAD,
         : T_SALES TYPE STANDARD TABLE OF TY_UPLOAD,
         : T_ERROR TYPE STANDARD TABLE OF TY_UPLOAD.
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
           IT_BDCDATA_VIEW LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
           IT_DATA(3200) OCCURS 0 WITH HEADER LINE,
           IT_FIELD(3200) OCCURS 0 WITH HEADER LINE,
           IT_BDCMSG TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA GI_MSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : CHAR1(500),
          CHAR2(500),
          CHAR3 TYPE STRING,
          V_SELECTION TYPE STRING.  " For View Selection
    DATA : W_MARC TYPE TY_MARC,
           WA_UPLOAD TYPE TY_UPLOAD,
           WA_BASIC TYPE TY_UPLOAD,
           WA_SALES TYPE TY_UPLOAD,
           WA_ERROR TYPE TY_UPLOAD,
           WA_MTART TYPE TY_MTART.
    DATA : VAR TYPE N,
           VAR1 TYPE STRING.
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.   "SELECTION SCREEN
    PARAMETERS: P_FNAM LIKE RLGRAP-FILENAME.
    PARAMETERS: P_BAS LIKE RLGRAP-FILENAME.
    PARAMETERS: P_SAL LIKE RLGRAP-FILENAME.
    PARAMETERS: P_ERR LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN : END OF BLOCK B1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAM.
      PERFORM SEARCH USING P_FNAM.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BAS.
      PERFORM SEARCH USING P_BAS.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SAL.
      PERFORM SEARCH USING P_SAL.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_ERR.
      PERFORM SEARCH USING P_ERR.
    *&      Form  SEARCH
          text
         -->PFNAME     text
    FORM SEARCH USING PFNAME.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          STATIC    = 'X'
        CHANGING
          FILE_NAME = PFNAME.
    ENDFORM.                    "SEARCH
    START-OF-SELECTION.
      PERFORM UPLOAD_PROCESS USING P_FNAM.
      PERFORM OPEN_GROUP.
      PERFORM PROCESS.
      PERFORM CLOSE_GROUP.
      IF NOT T_BASIC[] IS INITIAL.
        PERFORM DOWNLOAD TABLES T_BASIC[] USING P_BAS .
      ENDIF.
      IF NOT T_SALES[] IS INITIAL.
        PERFORM DOWNLOAD TABLES T_SALES[] USING P_SAL .
      ENDIF.
      IF NOT T_ERROR[] IS INITIAL.
        PERFORM DOWNLOAD TABLES T_ERROR[] USING P_ERR.
      ENDIF.
    *&      Form  PROCESS
          text
    FORM PROCESS.
      LOOP AT T_UPLOAD INTO WA_UPLOAD.
        PERFORM CONV_ROUTINE  USING WA_UPLOAD-MATNR
                            CHANGING WA_UPLOAD-MATNR.
        SELECT COUNT(*) FROM MARA WHERE MATNR = WA_UPLOAD-MATNR.
        IF SY-SUBRC NE 0.
          MOVE-CORRESPONDING  WA_UPLOAD TO WA_BASIC.
          APPEND WA_BASIC TO T_BASIC.
          CLEAR WA_BASIC.
          CONTINUE.
        ENDIF.
        SELECT COUNT(*) FROM MARC WHERE MATNR = WA_UPLOAD-MATNR
                                        AND WERKS = WA_UPLOAD-WERKS
                                        AND PSTAT LIKE '%V%'.
        IF SY-SUBRC NE 0.
          MOVE-CORRESPONDING  WA_UPLOAD TO WA_SALES.
          APPEND WA_SALES TO T_SALES.
          CLEAR WA_SALES.
          CONTINUE.
        ENDIF.
        CLEAR : WA_MTART.
        SELECT SINGLE MATNR MTART FROM MARA INTO WA_MTART WHERE MATNR = WA_UPLOAD-MATNR.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0060'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RMMG1-MATNR'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=AUSW'.
        PERFORM BDC_FIELD       USING 'RMMG1-MATNR'
                                      WA_UPLOAD-MATNR.
        CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW'     " Function module
        EXPORTING
          MATERIAL                  = WA_UPLOAD-MATNR  " Material number
          MATERIALART               = WA_MTART-MTART          " Material Type
          SELECTION                 = 'V'              "
          TCODE                     = 'MM02'           " Tcode where view's are called.
        TABLES
          BTCI_D0070                = IT_BDCDATA_VIEW
        EXCEPTIONS
          MATERIAL_NOT_FOUND        = 1
          MATERIAL_NUMBER_MISSING   = 2
          MATERIAL_TYPE_MISSING     = 3
          MATERIAL_TYPE_NOT_FOUND   = 4
          NO_ACTIVE_DYNPRO_SELECTED = 5
          NO_AUTHORITY              = 6
          OTHERS                    = 7.
        READ TABLE IT_BDCDATA_VIEW WITH KEY FVAL  = 'X'.
        IF SY-SUBRC = 0.
          V_SELECTION = IT_BDCDATA_VIEW-FNAM.
        ELSE.
          CONTINUE.
        ENDIF.
        VAR = IT_BDCDATA_VIEW-FNAM+17(2).
        VAR = VAR + 3.
        CONCATENATE 'MSICHTAUSW-KZSEL(' '0' VAR ')' INTO VAR1.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0070'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'MSICHTAUSW-DYTXT(06)'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=ENTR'.
        PERFORM BDC_FIELD       USING VAR1
                                       'X'.
        CLEAR VAR.
        CLEAR VAR1.
       PERFORM BDC_FIELD       USING 'MSICHTAUSW-KZSEL(06)'
                                     'X'.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0080'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RMMG1-VKORG'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=ENTR'.
        PERFORM BDC_FIELD       USING 'RMMG1-WERKS'
                                      WA_UPLOAD-WERKS.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4004'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=BU'.
       PERFORM BDC_FIELD       USING 'MAKT-MAKTX'
                                     'MTI_ESE_HALB_01'.
        PERFORM BDC_FIELD       USING 'MARC-STEUC'
                                      WA_UPLOAD-STEUC.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'MARC-HERKR'.
        PERFORM BDC_FIELD       USING 'MARC-HERKL'
                                      'IN'.
        PERFORM BDC_FIELD       USING 'MARC-HERKR'
                                      'MAH'.
        PERFORM BDC_TRANSACTION USING 'MM02'.
    move the error record into seperate internal table nad down load it ****
        IF MESSTAB-MSGTYP = 'E'.
          MOVE-CORRESPONDING WA_UPLOAD TO WA_ERROR.
          APPEND WA_ERROR TO T_ERROR.
          CLEAR WA_ERROR.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "PROCESS
    *&      Form  UPLOAD_PROCESS
          text
         -->PFNAME     text
    FORM UPLOAD_PROCESS USING PFNAME.
      DATA : PFNAME1 TYPE STRING.
      PFNAME1 = PFNAME.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME            = PFNAME1
          FILETYPE            = 'ASC'
          HAS_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB            = T_UPLOAD[].
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    "UPLOAD_PROCESS
    *&      Form  CONV_ROUTINE
          text
         -->P_INPUT    text
         -->P_OUTPUT   text
    FORM CONV_ROUTINE   USING    P_INPUT
                     CHANGING P_OUTPUT.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = P_INPUT
        IMPORTING
          OUTPUT = P_OUTPUT.
    ENDFORM.                    "CONV_ROUTINE
    *&      Form  DOWNLOAD
          text
         -->GI_FINAL   text
         -->PFNAME     text
    FORM DOWNLOAD TABLES
                  GI_FINAL
                         USING  PFNAME .
      DATA : FNAME TYPE STRING.
      FNAME = PFNAME.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                        = FNAME
          FILETYPE                        = 'DAT'
         WRITE_FIELD_SEPARATOR           = 'x'
            HEADER                          = '00'
          IMPORTING
            FILELENGTH                      =
        TABLES
          DATA_TAB                        =  GI_FINAL[]
          FIELDNAMES                      = GI_FIELDNAMES[]
      IF SY-SUBRC = 0.
        MESSAGE 'FILE DOWNLOADED SUCCESSFULLY' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " DOWNLOAD
    Regards
    Siva Prasad

  • Error Handling in Jdeveloper?

    I set a servlet as the ErrorHandler for the Application by modifying the web.xml file with th following code:
    <error-page>
    <error_code>404</error_code>
    <location>/Srv_ErrorHandler</location>
    </error-page>
    and it worked.
    then I deleted all the code and every thing related to that in other servlets, and set a jsp file as my Error Handler, using isErrorPage="true" in <%@page %>
    and other proper changes, but it didn,t worked.
    every time the error arises the server goes after the former servlet as the ErrorHandler (the path of the servlet appear in the addree bar?).
    It seems that some changes have been applied on some variables in the application scope that won't be removed automatically?
    Thank you for you answer my friend.
    Best Regards,
    Pourang

    Are you making sure to point the pages to your error page?

  • Error handling in overridden methods in AbstractPageBean

    Hi,
    I'm writing a small app in JSF. One of the pages populates a bunch of text fields from an XML file whose name is passed into the app as an initialization parameter. The purpose of the page is to allow editing of the fields.
    It seemed that the prerender() method was the right place to initialize the fields in the form. I have an application-scoped bean trying to open the XML file. I don't want the app to barf on initialization if the file doesn't exist, because the application contains the logic to create the file. So it just sets the appropriate forward target ("file does not exist" page, or maybe XML parse error) and lets the pages that use those bean properties decide when and if they need to display the initialization error page.
    I would like to throw an exception from the prerender() method in my page, and have the error handling specified in web.xml. The problem, of course, is that I can't throw my own exception from prerender().
    So, have I got the wrong place to initialize my form, or do I have to throw a javax.faces.FacesException, or have I got this whole error-handling thing wrong?
    Any advice would be gratefully received.
    Many thanks.
    Regards,
    Mike
    public void prerender(){
            // Get ApplicationBean1 to forward the request if we fail to
            // initialize properly.
            ApplicationBean1 ab1 = getApplicationBean1();
            HttpServletRequest req = (HttpServletRequest) this.getFacesContext().
                    getExternalContext().
                    getRequest();
            HttpServletResponse res = (HttpServletResponse) this.getFacesContext().
                    getExternalContext().
                    getResponse();
            if(!ab1.isInitialized()){
                //The initialization code for ApplicationBean1() sets the
                //target when it detects an error and then forwards the
                //request to that target upon invocation of the forwardRequest
                //method
                ab1.forwardRequest(req,res);
            // These are the input components
            tfClonebase.setValue(ab1.getClonebase());
            tfDhcpdconf.setValue(ab1.getDhcpdconf());
            tfNamedrev.setValue(ab1.getNamedrev());
            tfNamedzone.setValue(ab1.getNamedzone());
            tfPxelinux.setValue(ab1.getPxelinux());
            tfXmldir.setValue(ab1.getXmlDir());
        }

    Well, I'm certainly no expert, but prerender() is called, as you might expect, just before rendering takes place (but only if the page will actually be rendered). This means it won't be called for a page that handled a postback but then navigated to a different page. Good place to handle initializations that happen before rendering.
    So my thinking was that I could initialize stuff before there's anything in the response, making it easier to bail out if something goes bad.
    But I really can't work out the right way to bail out: I can't throw my own exception because the prerender() is overridden from AbstractPageBean. So I suppose I could create a MikesBadInitException e and throw it inside a new javax.faces.FacesException(e). But I'd like to specify an error-page in my web.xml for MikesBadInitException, and don't want to handle all javax.faces.FacesExceptions, if you get my drift.

  • Error Handling in WebUtil CLIENT_OLE2.get_obj_property

    Hello,
    we have a problem with the error handling in WebUtil's CLIENT_OLE2.get_obj_property function. The WebUtil version is 1.0.2 and the problem can be reproduced on the 9iAS, 9iDS and 10gAS as well.
    Problem description:
    The get_obj_property function does not throw a PL/SQL exception when it is given an invalid object as first argument (i.e. an object handle to an application that has intermittently been closed by the user). Instead, the function returns a NULL value and the control flow of our application code continues as if the function had succeeded. So the problem is that the get_obj_property function neither throws an exception nor can the failure be caught by calling WEBUTIL_CORE.IsError as this returns that no error occurred.
    Example:
    PACKAGE BODY word IS
    OBJ_HND CLIENT_OLE2.OBJ_TYPE := NULL;
    mydocs CLIENT_ole2.obj_type;
    -- Start Word97
    PROCEDURE wordopen is                         
    BEGIN
    obj_hnd := null;
    obj_hnd := CLIENT_OLE2.create_obj ('Word.Application');
    CLIENT_OLE2.Set_property(obj_hnd,'Visible',1);
    END;
    PROCEDURE test is
    BEGIN
    IF obj_hnd IS NULL THEN
    wordopen;
    END IF;
    BEGIN
    mydocs := CLIENT_OLE2.get_obj_property(obj_hnd,'Documents');
    EXCEPTION WHEN OTHERS THEN
    -- Word has probably been closed by the user
    -- so just start it again and retry...
    wordopen;
    mydocs := CLIENT_OLE2.get_obj_property(obj_hnd,'Documents');
    END;
    END;
    END;
    If the procedure test is called once then the Word application is started and the procedure performs some work. The procedure could be called several times on the same Word instance but fails in case the user closes the Word application because the procedure does not get an exception or error from WebUtil's get_obj_property function. Only a JACOB Java exception is logged in the Java console of the user's computer - the PL/SQL code has no way of knowing that an error has occurred.
    Possible solution / patch for webutil.pll:
    The webutil.pll can be patched to throw an exception if it is given an invalid object handle. In webutil.pll version 1.0.2 in get_object_property, line 1205, just add the condition "(v_javaHandle IS NULL) or " at the beginning of the if-statement in that line so that an OLE_ERROR will be raised if v_javaHandle is NULL:
    if (v_javaHandle IS NULL) or (v_javaHandle = 0) or (v_javaHandle='') or (v_javaHandle=-1) then     
    raise OLE_ERROR;      
    end if;     
    Can you confirm the error and re-release a patched webutil.pll at a later time?
    Regards,
    Andreas Leidner
    infoteam GmbH Berlin

    Hi
    It is mentioned in webutil doc that, you must regenerate webutil.pll before using it; otherwise you’ll encounter error ORA-06508 when running a form with the attached library.
    Hope this helps...
    Regards,
    Amatu Allah

Maybe you are looking for

  • DEBUG - how can I put a "break-point" when a variable have a certain value

    Hi I need help... Do you know some kind os instruction or tools to see and stop in debug a program when a variable have a specified value ? For example: At debug I want that a program "stop" when likp-vbeln = 70000123000. Now for do this, I change th

  • Physical Memory failure (DUMP)

    I use SIS 648FX Chipset Based 648F NEO Series using Pentium 4 HT 2.8 GHz processor i already use Kingston 512 MB DDR 400 MHz PC3200 DIMM 3-3-3 for 3 months already. Yesterday I bought  1 more of Kingston 512 MB DDR 400 MHz PC3200 DIMM 3-3-3 to upgrad

  • How to use bind variables in JSP applications ?

    Hi, How will i use bind variables in jsp applicaions ? Any links that give a clear understanding ? TIA, jj

  • Problem while creating partner link using https URL

    Hi, To create the partnerlink using https URL, I had done the following: -Imported the self signed certificate into the OraBPELPM_\jdk\jre\lib\security\cacert -Added following entries in OraBPELPM_1\integration\jdev\jdev\bin\jdev.conf AddVMOption -Dj

  • Finding my iMac shut down or rebooted for no reason at all?!?!?

    I recently transferred my iMac G5 to an iMac Intel. Since doing so, I have found my new iMac Intel in the mornings completely shut down or as if it had been restarted (user account selection screen). This morning, I sat down at the computer and moved