Handling ABAP Exceptions in a Block
Hi,
If a background task calls an ABAP Class Method and that method throws a defined exception of type CX_BO_ERROR, I would expect to see a possible outcome for that exception that would allow me to handle the exception for the specific task. If I activate that outcome then an exception handling path will be displayed on the graphical representation which is taken if the exception is then raised by the method. If the outcome is disabled then the workitem goes to error.
If I want to catch these exceptions (for multiple tasks) in an enclosing block in order to handle them in a single, standard way, how do I achieve that? It does not seem possible to simply define the exception type in the enclosing block and then activate it in order to then be able to automatically catch any exceptions of a particular type that have their outcomes disabled in their individual tasks. It would appear that I have to activate the outcomes for each task and then raise it during with a Process Control item on the exception handling path of the task. This seems to defeat the object of having exception handling at the Block level. Is my understanding correct or am I doing something wrong?
Also, is it possible to capture the class exception object from the method call and store it in the Task Container (in order to get text & longtext details)?
Thankyou for both of your responses.
I understand that an individual ABAP Object or BOR method (call during an Activity) can raise an exception which can be handled as a separate outcome of that activity. However, if there are multiple Activity steps in the workfow that can all throw similar exceptions and I want to react to all of those exceptions in a uniform way, it seems excessive to have to handle each exception individually for each Activity in order to do the same thing (e.g. I may just want to send a standard email to someone or trigger another workflow event).
I may have misunderstood things but I thought that the purpose of the Block step was to be used as a kind of TRY..CATCH mechanism that will allow exceptions to thrown to the Block by enclosed Activities without the need for enabling outcomes at the Activity level. I thought it would be possible for the exception type to be defined in the Block properties so that all exceptions of that type could be handled at a higher level by a single Block outcome (regardless of which enclosed Activity threw it). If this is the case then I do not see the point in having to define individual outcomes for each activity within the Block.
That said, I cannot seem to get it to work without enabling the outcome for each activity and using a Process Control step to raise the exception to the Block (which seems to defeat the object because I have, in fact, just handled the exception!). The reason for my original posting is to verify whether or not what I am trying to do is possible and to find out what I doing wrong with regards to Block configuration.
Kind Regards
Simon.
Similar Messages
-
- java handling ABAP Exception
Hi folks,
I am developing a webdynpro java programm that communicate with R/3 through a RFC.
In an especif condition the ABAP program raises an "NO_DATA_FOUND" exception.
Unfortunatelly I can't catch this exception raised by ABAP.
Do you may help me?
Best wishes,
Nelson DuarteHi Nelson,
You will get the error "NO_DATA_FOUND" in the back end when there are no records and you will get "INVALID_DATA" when you pass an invalid input.
BAPIRET2 structure return the error/warning/success messages if there are in the in the backend. If they are returning any messages for the above errors then you can print those messages by accessing the BAPIRET2 structure.
You can print different error/warning/success using the return structure (if they are returning any)with the following code.
IWDMessageManager msgmgr = wdComponentAPI.getMessageManager();
String msgtype = new String();
try{
// If the RFc is returning any error messages the display those messages
if(wdContext.currentReturn_outElement().getMessage()!=null){
for(int i=0; i<wdContext.node<Return_out()>.size();i++)
msgtype = wdContext.nodeReturn_out().getElementAt(i).getAttributeValue("Type").toString();
if(msgtype.equals("W"))
msgmgr.reportWarning(wdContext.currentReturn_outElement().getMessage());
else if(msgtype.equals("E"))
msgmgr.reportException(wdContext.currentReturn_outElement().getMessage(),true);
else
msgmgr.reportSuccess(wdContext.currentReturn_outElement().getMessage());
}catch(Exception e){
Or
int size = wdContext.node<Return_out()>.size();
if(size ==0){
//here you can print your own message
Thanks n Regards,
Jhansi Miryala -
Is there a way to handle system exception ERROR_MESSAGE?
Hi,
I have a program executed in background, which produces a bunch of consecutive documents for a set of Bulk Shipments -> TD Loading and TD Delivery Confirmation. To create those documents I use function modules 'OIGI_LOADING_CREATE' and 'OIGI_DEL_CONF_CREATE' - both from Industry-Solution Oil-and_Gas (IS-Oil).
In some cases these FM-s produces error messages (E-type) which cancel execution of the program and broke my flow-logic.
Below are few messages recorded in a job log for my task:
18.08.2005 15:56:41 Job started
18.08.2005 15:56:41 Step 001 started (program /PTRL/TAS_POSTPONDED_SYNC, variant , user name IMUTAFCHIEV)
18.08.2005 15:56:58 Shipment 180753 saved
18.08.2005 15:57:06 The plant data of the material 177 is locked by the user BMINKOV
18.08.2005 15:57:06 The plant data of the material 177 is locked by the user BMINKOV
18.08.2005 15:57:06 The plant data of the material 177 is locked by the user BMINKOV
18.08.2005 15:57:06 Job cancelled after system exception ERROR_MESSAGE
Both function modules are not designed to handle any exceptions, and in owr environment (4.6c) there is no documented system exception 'ERROR_MESSAGE' which to be handled in CATCH-ENDCATCH block.
Is there a way to handle this exception and to track the list of error messages produced by some FM into an internal table, log, whatever, as it is done in the log of the background job. I need to find a way write these messages in my log-tables and to proceed further with my flow-logic.
FYI: my program executes an RFC call to a remote system and retrieve a list of documents which need to be synchronized with R/3. I loose information, if the R/3 broke my flow-logic.
Any help would be highly appresiated.
Many thanks in advance.
Ivaylo MutafchievSven,
I made few programs where we used business scenario:
IS-Oil Shipment => IS-Oil Loading Confirmation => IS-Oil Delivery Confirmation.
All of them are based on Function Module call:
1. OIGI_LOADING_CREATE and
2. OIGI_DEL_CONF_CREATE.
To load shipment I call 1st FM in a way:
CALL FUNCTION 'OIGI_LOADING_CREATE' DESTINATION 'NONE'
EXPORTING
I_SUBRC = 9 "save and commit
I_SHNUMBER = shNumber
I_VEHICLE = vehicle
I_LDPLT = plant
I_LDDATE = loadDate
I_LDTIME = loadTime
I_LDCDAT = loadDate
I_VEH_NR = veh_nr
TABLES
T_OIGISVMQ = quantity_items
T_OIGISVMQ2 = hpm_append
T_OIGISIQ = doc_quan_items
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE p_error
SYSTEM_FAILURE = 2 MESSAGE p_error.
To confirm shipment (status 4) I call the same FM with:
CALL FUNCTION 'OIGI_LOADING_CREATE' DESTINATION 'NONE'
EXPORTING
I_SUBRC = 39 "confirm & commit 2nd step
I_SHNUMBER = shNumber
I_VEHICLE = vehicle
I_LDPLT = werks
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE sh_error
SYSTEM_FAILURE = 2 MESSAGE sh_error.
And finaly to finish process (status = 6) I call 2nd FM in a way:
CALL FUNCTION 'OIGI_DEL_CONF_CREATE' DESTINATION 'NONE'
EXPORTING
I_SUBRC = 19 "save, confirm and commit
I_SHNUMBER = shNumber
I_RAPID_CONFIRM = 'X'
I_DDCDAT = loadDate
I_DLDATE = loadDate
I_DLTIME = loadTime
EXCEPTIONS
COMMUNICATION_FAILURE = 1 MESSAGE p_error
SYSTEM_FAILURE = 2 MESSAGE p_error.
FYI: It tooks me some time to 'investigate' and find correct use of these function modules. And I worked VERY CLOSE with our SD consultant.
For details (what the export parameters and tables consist of) and sample code, please contact me at:
ivaylo dot mutafchiev at vbs dot bg
I would be glad to share my knowlege.
Regards,
Ivaylo -
How to handle an Exception in GP through webdunpro
Hi,
How to handle exception in WebDynpro GP callable objects.
I created exception parameter in getdescription() method like
IGPExceptionInfo processExc1 = technicalDescription.addProcessException("USER_NOT_FOUND");
processExc1.setNameKey("USER_KEY");
processExc1.setDescriptionKey("USER_DESCRIPTION_KEY");
processExc1.setFatal(true);
In my Process I have 2 levels, In block level i am able to see the above created exception using exception tab.
I have created an action with same callable object mapped, this action is mapped to exception handler & selected an repeat option from dropdown.
If any exception occurs in execute method(like UMException) how to call an handler from coding. I tried this code to call a handler
String localizedMessage =textAccessor.getText("USER_NOT_FOUND");
wdThis.wdFireEventTechnicalException(new GPTechnicalCallableObjectException(logger,localizedMessage,e));
this is not working...
Can any one please bring me an Solution.
Thanks in advance.
Regards
ThenMalarHi Shikhil
Thanks for your reply
Please have a look below for exceptions which i am getting in GP and let me know how to handle these exceptions.
1) "Activity could not be read"
2) "Action has been stopped"
3) error while processing the item can not be displayed
if you give any idea/clue how to handle these exceptions then it would be great help to me
Thanks
Sunil -
Handling an exception in a superclass...
Hi,
Why not have a method at the superclass level, called ExecSQL(), that
internally does the following:
begin
self.OnExecSQL();
exception
when e:Whatever do
end;
In that way all your code in the hierarchy that is in OnExecSQL() is within
the exception block.
Tim Sawyer
PanCredit
Leeds, UK.
From: Gabriel Akos <[email protected]>
Reply-To: Gabriel Akos <[email protected]>
To: [email protected], [email protected]
Subject: Handling an exception in a superclass...
Date: Mon, 17 May 1999 17:26:06 +0200
Hi!
I have the following problem:
1. I have a class, name SQLManager
2. I have a method, ExecSQL
3. In method ExecSQL I do some SQL, occasionally it's loosing the
connection to the DB, gets an
exception, reasoncode 201 (If my memory is correct)
4. I have some subclasses of SQLManager, which override ExecSQL, and do
some SQL stuff in it.
Question: Is it possible to handle the specific exception in the
superclass, and do the reconnect?
And probably let the subclass execute the ExecSQL again?
Or has anybody better ideas of organizing these things?
TIA, best regards,
Akos Gabriel
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Hi,
Yes you can : it is an architectural problem.
You must divide the work into 2 methods : one on the generic level and one
on the concrete level.
The generic level will manage the cinematic : it could be ExecSql. In the
ExecSql method you can call a DoExecSql method which can be overridden by
the developers and contain the sql statement. Then, the ExecSql method can
manage the reconnect using DBSession.Reconnect before the call of the
DoExecSql if the DBSession.IsConnected = FALSE. You can also manage a While
with a limited number of retries if you catch the exception from the
DoExecSql method.
Just be aware that when you will reconnect to the database, you will loose
the statements you could have cached with your DBSession.
Hope this helps,
Daniel Nguyen
Freelance Forte Consultant
Url : http://perso.club-internet.fr/dnguyen/
Gabriel Akos a écrit:
Hi!
I have the following problem:
1. I have a class, name SQLManager
2. I have a method, ExecSQL
3. In method ExecSQL I do some SQL, occasionally it's loosing the
connection to the DB, gets an
exception, reasoncode 201 (If my memory is correct)
4. I have some subclasses of SQLManager, which override ExecSQL, and do
some SQL stuff in it.
Question: Is it possible to handle the specific exception in the
superclass, and do the reconnect?
And probably let the subclass execute the ExecSQL again?
Or has anybody better ideas of organizing these things?
TIA, best regards,
Akos Gabriel
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
The following ABAP Exception occurred: LINKLISTKEY_INVALID
The following ABAP Exception occurred: LINKLISTKEY_INVALID:
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClassExecutable.execute(DynamicRFCModelClassExecutable.java:98)
at com.sap.xss.ser.xssconfview.fc.FcLinks.onInit(FcLinks.java:256)
at com.sap.xss.ser.xssconfview.fc.wdp.InternalFcLinks.onInit(InternalFcLinks.java:238)
at com.sap.xss.ser.xssconfview.fc.FcLinksInterface.onInit(FcLinksInterface.java:115)
at com.sap.xss.ser.xssconfview.fc.wdp.InternalFcLinksInterface.onInit(InternalFcLinksInterface.java:193)
at com.sap.xss.ser.xssconfview.fc.wdp.InternalFcLinksInterface$External.onInit(InternalFcLinksInterface.java:257)
at com.sap.pcuigp.xssfpm.wd.FPMComponent$FPM.attachComponentToUsage(FPMComponent.java:922)
at com.sap.pcuigp.xssfpm.wd.FPMComponent$FPM.attachComponentToUsage(FPMComponent.java:891)
at com.sap.pcuigp.xssfpm.wd.FPMComponent$FPMProxy.attachComponentToUsage(FPMComponent.java:1084)
at com.sap.xss.ser.xssconfview.vc.VcLinks.onInit(VcLinks.java:198)
at com.sap.xss.ser.xssconfview.vc.wdp.InternalVcLinks.onInit(InternalVcLinks.java:222)
at com.sap.xss.ser.xssconfview.vc.VcLinksInterface.onInit(VcLinksInterface.java:162)
at com.sap.xss.ser.xssconfview.vc.wdp.InternalVcLinksInterface.onInit(InternalVcLinksInterface.java:144)
at com.sap.xss.ser.xssconfview.vc.wdp.InternalVcLinksInterface$External.onInit(InternalVcLinksInterface.java:220)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doProcessEvent(FPMComponent.java:564)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.doEventLoop(FPMComponent.java:438)
at com.sap.pcuigp.xssfpm.wd.FPMComponent.access$600(FPMComponent.java:78)
at com.sap.pcuigp.xssfpm.wd.FPMComponent$FPM.raiseSaveEvent(FPMComponent.java:953)
at com.sap.pcuigp.xssfpm.wd.FPMComponent$FPMProxy.raiseSaveEvent(FPMComponent.java:1116)
at com.sap.xss.per.vc.reviewnavi.VcPersInfoReviewNavi.next(VcPersInfoReviewNavi.java:227)
at com.sap.xss.per.vc.reviewnavi.wdp.InternalVcPersInfoReviewNavi.next(InternalVcPersInfoReviewNavi.java:175)
at com.sap.xss.per.vc.reviewnavi.ReviewNaviView.onActionNext(ReviewNaviView.java:153)
at com.sap.xss.per.vc.reviewnavi.wdp.InternalReviewNaviView.wdInvokeEventHandler(InternalReviewNaviView.java:173)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:420)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:132)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingPortal(ClientSession.java:733)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:668)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.clientserver.session.core.ApplicationHandle.doProcessing(ApplicationHandle.java:73)
at com.sap.tc.webdynpro.portal.pb.impl.AbstractApplicationProxy.sendDataAndProcessActionInternal(AbstractApplicationProxy.java:860)
at com.sap.tc.webdynpro.portal.pb.impl.localwd.LocalApplicationProxy.sendDataAndProcessAction(LocalApplicationProxy.java:77)
at com.sap.portal.pb.PageBuilder.updateApplications(PageBuilder.java:1299)
at com.sap.portal.pb.PageBuilder.SendDataAndProcessAction(PageBuilder.java:326)
at com.sap.portal.pb.PageBuilder$1.doPhase(PageBuilder.java:868)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processPhaseListener(WindowPhaseModel.java:755)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doPortalDispatch(WindowPhaseModel.java:717)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:136)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
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(AccessController.java:219)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
Caused by: com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFC_Fault_Exception: Fault name: LINKLISTKEY_INVALID, fault text: LINKLISTKEY_INVALID
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1303)
at com.sap.aii.proxy.framework.core.JcoMarshaler.unmarshalException(JcoMarshaler.java:429)
at com.sap.aii.proxy.framework.core.JcoProxy.send(JcoProxy.java:78)
at com.sap.aii.proxy.framework.core.AbstractProxy$JcoProxyHelper.send(AbstractProxy.java:173)
at com.sap.aii.proxy.framework.core.AbstractProxy.send$(AbstractProxy.java:141)
at com.sap.xss.ser.xssconfview.model.CSLinksModel.hrxss_Ser_Getconfscrlinks(CSLinksModel.java:152)
at com.sap.xss.ser.xssconfview.model.Hrxss_Ser_Getconfscrlinks_Input.doExecute(Hrxss_Ser_Getconfscrlinks_Input.java:137)
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClassExecutable.execute(DynamicRFCModelClassExecutable.java:92)
... 67 more
Can nay one suggest anything on this?To solve this problem, make sure the LINKLISTKEY property defined in the Web Dynpro Application properties exists in table T7XSSSERLNK.
1. To view the link list key in the Web Dynpro app, in NWDS expand the Applications tree and then double click on your application. Click on the "Application Properties" tab, then look at the value for the "sap.xss.linkListKey".
2. Ensure that value exists in the backend under transactions SPRO --> Personnel Management --> ESS --> General Settings --> Homepage for Self-Services -->Services --> Define Links on Confirmation Page
Regards,
Tom -
Exception inside a block [BPM]
I have send step and exception branch inside block.
But my exception handler is always triggered independently of sucess/error of my send step.
Could anybody explain How do exception branch work?
Where do I find good BPM documentation? I can't find the full documentation with answer on my question.
Blogs are good but they are not enough
help.sap.com is't enough too.Hi,
don't read everything:)
just take a look at the <b>Example</b> section:
http://help.sap.com/saphelp_nw04/helpdata/en/33/4a773f12f14a18e10000000a114084/content.htm
with this example I'm sure you'll understand
Regards,
michal -
Handle timeout exception in rfc call
Dear SAP Experts,
I have been searching for a while and could not find a satisfactory answer to my problem.
I use SAP - CRM and call other SAP and non-SAP systems via RFC.
I need to handle all exceptions, otherwise WEB UI displays a full page exception details, which is unacceptable on a production system.
I have the following piece of code:
CALL FUNCTION FUNCTION_NAME DESTINATION DEST
EXPORTING
S_IMPORT = INPUT_DATA
IMPORTING
S_EXPORT = OUTPUT_DATA
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE err_msg " catch system failure
COMMUNICATION_FAILURE = 2 MESSAGE err_msg " catch communication errors
OTHERS = 99. " catch everything else
It handles most of exceptions, however, it cannot process timeouts. Is there a way to handle timeout in ABAP RFC call? Is timeout exception uncatchable? If so is there a way around?
Can you please suggest some solution as I am running out of ideas.
Regards,
DominikI have found a solution. To approach this I use asynchronous function call.
TRY.
CALL FUNCTION ZZ_TEST_TIMEOUT' DESTINATION lv_dest STARTING NEW TASK 'TIMEOUT_TASK'
CALLING me->callback ON END OF TASK
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE err_msg " catch system failure
COMMUNICATION_FAILURE = 2 MESSAGE err_msg " catch communication errors
OTHERS = 99. " catch everything else
WAIT UNTIL READY EQ 'X' UP TO 55 SECONDS.
IF READY NE 'X'.
RAISE EXCEPTION TYPE CX_TIMEOUT.
ELSE.
WRITE / 'success'.
ENDIF.
CATCH CX_ROOT INTO OREF.
WRITE / 'TIMEOUT EXCEPTION'.
ENDTRY.
callback sets variable READY to abap_true when data is received.
The trick is to use UP TO 55 SECONDS. after wait, which is shorter than the server timeout. This terminates function call and gives opportunity to code your own timeout behavior. -
How to handle JCO Exceptions at JCO (RFC) function call
Hello Forum,
I am implementing an JCO Server scenario.
I use dynamic repositories like Example7.java from the JCO documentation.
Example7 throws an JCO.AbapException if anything went wrong, e.g. the function is not implemented.
How to react on this AbapException?
The examples in SAP Help documentation only catch
SYSTEM_FAILURE and COMMUNICATION_FAILURE.
All other RFC modules I have seen which declare the function modules to be used by dynamic JCO repositories (like Example7.java) do not define any other Exception parameters.
But these two are only thrown and caught when something with communication went completely wrong, e.g. RFC not found.
But when RFC can be reached and the JCO Server is executing the Java method, an AbapException could be thrown on error. How to react on this?
In my implementation based on the examples I always get a ABAP dump. The dump says:
Exception named without message text. Why that name?
How to handle this type of exception in order to avoid the dump?
Can anyone post an example please?
Thanks,
Carsten
Edited by: Carsten Schön on Apr 15, 2008 4:22 PM
Edited by: Carsten Schön on Apr 15, 2008 4:24 PMHi Micky,
thanks for your quick response.
If so, to throw JCO.AbapException on JCO Server side is not correct?
What I do is throwing the JCO.AbapException (like in the JCO Example 7).
At the RFC call in APAB I handle both exceptions SYSTEM_FAILURE and COMMUNICATION_FAILURE like
CALL FUNCTION 'MY_JCO_FUNCTION_MODULE'
DESTINATION JCO_DEST
<...>
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE RFC_MESS
COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
This works as far something with RFC is wrong, e.g. Server can not find the function or Server not reachable.
But the AbapException thrown by the JCO Server (Java) is not handled that way. Why?
Sorry if this is the wrong forum but I tried posting in Netweaver integration and got no answer for 1 week and because it's ABAP related I thought the topic suites here.
Carsten
Edited by: Carsten Schön on Apr 15, 2008 5:10 PM -
Hi!
Pls tell me a sample code in core abap exception handling
ie using raise etc...
one more thing
we can use this try endtry catch endcatch etc without using oops concept in abap.
will it works
looking for your reply.Hi,
Exceptions are situations that occur while an ABAP program is being executed, in which normal continuation of the program does not make any sense.
Exceptions can be raised either implicitly in the ABAP runtime environment or explicitly in the ABAP program.
For example, division by zero leads to an exception in the ABAP runtime environment. It is possible to determine this situation through a query in the ABAP program and to trigger an exception there.
See the demo program DEMO_HANDLE_EXCEPTIONS in se38.
*--EXAMPLE FOR RUNTIME ERROR--
*DATA : VALUE1 TYPE I.
*VALUE1 = 1 / 0. "----
>>>>>> IT MAKES RUN TIME ERROR.
*WRITE : VALUE1.
*--EXAMPLE FOR HOW TO CATCH THE ARITHMETIC ERROR AT THE RUN TIME USING SUBRC--
*DATA : VALUE1 TYPE I.
*CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.
*VALUE1 = 1 / 0.
*WRITE : VALUE1.
*ENDCATCH.
*IF SY-SUBRC = 1.
*WRITE : ' IT MAKES ERROR'.
*ELSE.
*WRITE : VALUE1.
*ENDIF.
in abap program we handle exceptions based on value returned by the system variable SY-SUBRC.
if SY-SUBRC = 0.
means execution completed sucessfull.
if SY-SUBRC = 1........n.
means execution compleated not sucessfully.
if sy-sbrc = 0.
write:/ 'execution sucessfull.
**here write logic as per u r requirement
else sy-subrc = '1'
message
elseif sy-subrc eq '2'
message
elseif sy-subrc eq '3'
message
elseif sy-subrc eq '4'
message
endif
Messages are defined in SE91..
These messages are of 5 types..
<b>A Termination Message</b>
The message appears in a dialog box, and the program terminates. When the user has confirmed the message, control returns to the next-highest area menu.
<b>E Error Message</b>
Depending on the program context, an error dialog appears or the program terminates.
<b>I (Information)</b>
The message appears in a dialog box. Once the user has confirmed the message, the program continues immediately after the MESSAGE statement.
<b>S (Status Message)</b>
The program continues normally after the MESSAGE statement, and the message is displayed in the status bar of the next screen.
<b>W (Warning)</b>
Depending on the program context, an error dialog appears or the program terminates.
<b>X (Exit)</b>
No message is displayed, and the program terminates with a short dump. Program terminations with a short dump normally only occur when a runtime error occurs. Message type X allows you to force a program termination. The short dump contains the message ID.
Pls read the following links:
http://help.sap.com/saphelp_nw04/helpdata/en/fb/35c62bc12711d4b2e80050dadfb92b/content.htm
Regards,
Padmam. -
How to handle XScript Exceptions ?? HELP !!
hey buddies !!!
I am getting the following exception in the browser for some jsp that is using XSCript.
"Caught exception when evaluating expression "MIDC PHASE II DOMBIVALI {E}" with available binding contexts [actionForm, pageFlow, globalApp, request, session, appication, pageContext, bundle, container, url, pageInput]. Root cause: com.bea.wlw.netui.script.xscript.IllegalContextStateException: The context "E" could not be found. "
Its okay that i am gettign this exception but i want to to know how to handle this exception. I tried using a try catch block but it didnot catch the exception and it still showed on the screen. I want to know how to handle this exception in the jsp ...
Please help me ...thanks a lot !!!
NikhiolNikhil--
Can you paste in the tag (with the attributes) that is throwing the expression?
Are you trying to data bind to "{E}"? If so, that's not a supported NetUI data binding context
and the exception is legit. There isn't really a way to "handle" it -- it's more of a runtime error
that occurs during regular development. When the application is deployed, such exceptions shouldn't
occur.
<g>
Eddie
Nikhil Gonsalves wrote:
hey buddies !!!
I am getting the following exception in the browser for some jsp that is using XSCript.
"Caught exception when evaluating expression "MIDC PHASE II DOMBIVALI {E}" with available binding contexts [actionForm, pageFlow, globalApp, request, session, appication, pageContext, bundle, container, url, pageInput]. Root cause: com.bea.wlw.netui.script.xscript.IllegalContextStateException: The context "E" could not be found. "
Its okay that i am gettign this exception but i want to to know how to handle this exception. I tried using a try catch block but it didnot catch the exception and it still showed on the screen. I want to know how to handle this exception in the jsp ...
Please help me ...thanks a lot !!!
Nikhiol -
Need a way to disable "Exception" button for "Block Pop-up windows" in Tools-> Options -> Content tab. I want to be able to do this for Locking Down Firefox preferences.
== User Agent ==
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)That button doesn't have a pref associated with it, so you can't disable that button with a pref on the about:config page or a lockPref call.
That only leaves the choice to remove that button with code in userChrome.css
<pre><nowiki>#popupPolicyButton {display:none!important;}</nowiki></pre>
See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files -
How to handle the Exception when RegisterEventProcessorAsync
In our Cloud Service project, we have 2 instances for work role (deploy to Azure), the work role is consume events from the EventHub using EventProcessorHost).
When we want to register EventProcessor to consume data (see below):
await eventProcessorHost.RegisterEventProcessorAsync<eventProcessor>();
Sometimes we will got the Exception:
Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (412) There is
currently a lease on the blob and no lease ID was specified in the request.. ---> System.Net.WebException: The remote server returned an error: (412)
There is currently a lease on the blob and no lease ID was specified in the request..
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase`1 cmd, Exception ex)
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpWebResponse resp, T retVal, StorageCommandBase`1 cmd, Exception ex)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlobSharedImpl.<DeleteBlobImpl>b__1b(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Util.StorageAsyncResult`1.End()
at Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.EndDeleteIfExists(IAsyncResult asyncResult)
at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass1`1.<CreateCallback>b__0(IAsyncResult ar)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.ServiceBus.Messaging.BlobLeaseManager.<DeleteAllAsync>d__2a.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceBus.Messaging.EventProcessorHost.<InitializeAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceBus.Messaging.EventProcessorHost.<StartAsync>d__e.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at awaiteventProcessorHost.RegisterEventProcessorAsync<eventProcessor>();
If we got the Exception, we won’t got messages any more.
From the Call Stack, we found it was cause by delete the Blob. So we wonder that, when we call
RegisterEventProcessorAsync,
the hub will delete the blob and renew one in Storage?
If we delete the blob for the EventHub manually and then run our server again. It worked as usual.
But we can do it like this way manually, so is there any way to handle the exception in code to make the EventProcessorHost worked?
Thanks so much!If we use different blob container name for different EventProcessorHost, is it a workaround for the issue?
var
eventProcessorHost = new
EventProcessorHost(
hostName,
hubName,
consumerGroupName,
serviceBusConnectionString,
storageConnectionString,
leaseContainerName); -
How to handle the exception in GP(Exception : Activity could not be read)
Hi all
we are getting the GP exceptions as 1) "Activity could not be read" 2) "Action has been stopped"
3) error while processing the item can not be displayed
Please let me know how to handle these exceptions in GP .
currently i got some documents in SDN on GP exceptions but those are related to manual exceptions for example if you enterd wrong data in the inputfield then we can handle those exceptions then it will allow to enter the new value but the exceptions which i mentioned above are new it seems
can you please let me know how to handle or solve those 3 exceptions
Thanks
binduHi Shikhil
Thanks for your reply
Please have a look below for exceptions which i am getting in GP and let me know how to handle these exceptions.
1) "Activity could not be read"
2) "Action has been stopped"
3) error while processing the item can not be displayed
if you give any idea/clue how to handle these exceptions then it would be great help to me
Thanks
Sunil -
How to handle multiple exception types in JSF 2?
I'm trying to handle multiple exception types in JSF2, including a default error page for any unexpected exception types. The problems I'm having are:
1) ViewExpiredException is handled only when no generic exception handler is specified
2) "Regular" exceptions like NullPointerException are never handled
My managed bean:
@Named
@SessionScoped
public class MyController implements Serializable {
/* A method that does nothing */
public void doNothing() {
//do nothing
/* Generate a null pointer exception on purpose */
public void generateNpe() throws NullPointerException {
Object x = null;
x.toString();
My test page to generate the exception:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Test page</title>
</h:head>
<h:body>
<h:form>
<h:commandButton id="button1" value="do nothing" action="#{myController.doNothing}" />
<h:commandButton id="button2" value="generate NPE" action="#{myController.generateNpe}" />
</h:form>
</h:body>
</html>
My web.xml:
<!-- Redirect all NPEs to this page; this never works! -->
<error-page>
<exception-type>java.lang.NullPointerException</exception-type>
<location>/error/error003.jsf</location>
</error-page>
<!-- Redirect all VEEs to this page; this works fine if the next section is excluded -->
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/error/error002.jsf</location>
</error-page>
<!-- This grabs everything, even with the previous sections defined. If I exclude this error-page section, VEE works fine but NPE still does not get redirected -->
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error/error001.jsf</location>
</error-page>My questions are as follows:
1) How can we handle "regular" java exceptions like NPE?
2) How can we define a catch-all for unexpected exception types, while still respecting specific exception handlers for VEE, etc?
Thanks,
BenjaminIs your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
Cheers,
Peter.
Maybe you are looking for
-
Cannot edit a field that is "Standard Report Column" when new row added
Hi everyone, I have created a master-detail form from the wizard and within the detail report region source I have used apex_item.xxx API example; select C1, C2, CASE when C2 ='N' then apex_item.select_list_from_query(3, C3,'select a1 d, a2 r from ta
-
How would I export a list of songs on an iPod to a text file?
I found one of my old iPod shuffles that's synced to an old PC that is long gone... I'm looking for a way to export what's currently on the iPod Shuffle as a text file or something so I can remember that "phase" in my life in the form of a playlist.
-
Require Only SSL/TLS Connections
I would like to require that only SSL/TLS connections be allowed to my server. This is not to be confused with wanting SSL client authentication. I had initially thought I could do this with ACI using the authmethod="ssl", however after looking at th
-
Oracle+apache+php in windows environment
Hi all, i have a great problem with a new web application written in Php 5 under Apache 2.2.4. using Oracle instant client 10g The database (10.2.0.2) characterset is WE8MSWIN1252 same for the client. When i insert/update a rows from php with àèìòù c
-
Hi All, Can any one explain how to do budgeting cost centre group wise? Thanks in advance, Manisha