BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Follow BOB on Twitter! 
Follow BOB on Twitter! (Opens a new window)  

General Notice: Upcoming Events: SAP TechEd: Sep 28.

Werner please help us - Real time job Exception Handling


 
Search this topic... | Search DI: Realtime and NRDM... | Search Box
Register or Login to Post    Forum Index -> Data Integrator -> DI: Realtime and NRDM  Previous TopicPrint TopicNext Topic
Author Message
samatha.mallarapu
Forum Member
Forum Member



Joined: 16 Jun 2009

Posts: 21



PostPosted: Wed Apr 18, 2012 7:09 am 
Post subject: Werner please help us - Real time job Exception Handling

Hi all,

we have a real time job which process IDOCs from SAP.
We are able to process everything fine.
We have got issue in exception handling. Not able to use try/Catch block inside a real time job. if i use try catch before Rt_ptocess and Rt_End then it is giving application error.
If i put try block after Rt_Begin and before my DF then i am getting error

[Real-time Job:RTJOB_R2P_Price_Book_INFREC]
Try1439 can't be the first step in real-time processing block. Must have XML or IDoc request. (BODI-1111233)
error.

i have only one DF with simple mapping .. as it will always insert the data into Target table.

Now i want to catch all the exceptions and i want to e-mail the status Succsee/Fail to the user.
i have searched so many posts. but couldnt find any solution.

Please help me in this.

Regards,
Samatha
Back to top
ritesh_kumar
Forum Member
Forum Member



Joined: 04 Dec 2007

Posts: 2



PostPosted: Sat Apr 28, 2012 12:09 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

Hi All,

We need to catch error in real time job and send mail notification to different groups according to the error. In batch jobs we have implemented it but getting error while trying to implement in real time jobs.

Please help us out.

Thanks in advance
Back to top
Werner Daehn
Forum Devotee
Forum Devotee



Joined: 17 Dec 2004

speaker.gif*6
Posts: 10590
Location: Germany


flag
PostPosted: Mon Apr 30, 2012 6:07 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

That's a tough one.

First, keep in mind a realtime job is one that runs forever. So actually, anything you put behind the dataflow will never execute!
Second, we have to decide what kind of error we want to capture, one that lets the dataflow continue or one where the dataflow will die.

For the first part, the solution is simple, inside the query you add your smtp_mailto() function somewhere.

But if the dataflow dies because it is an unrecoverable error I wonder what will happen. I would try adding a script right behind the dataflow where you do your emailing (for a test I would simply print() a message into the trace log). I expect you are right, without a try/catch the dataflow will die and terminate the job right away before running the script. But I am not 100% sure because of these realtime brackets. Possible we execute everything behind the bracket in such a case. If we do, we need to check what does happen when you shutdown the realtime service correctly.

Sorry, I have no answer for you just things to try. At the end you might end up with parsing the error log files constantly.

_________________
Werner Daehn
Product Manager Data Services
SAP AG
“The opinions expressed in this post are my own views and not those of SAP.”

PLEASE SUPPORT THIS: Run one ATL job and tell us the benchmark result. Details to be found here.
Back to top
manoj_d
Forum Addict
Forum Addict



Joined: 01 Jan 2009

Posts: 2944



PostPosted: Mon Apr 30, 2012 11:41 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

if you are not doing muchin RT DF and not interested in the response, then you can actaully take in the input message in RT DF and save to Disk and invoke a batch job that reads the XML file and processes it, you can put you error handling logic in this batch job

return the job execution status (job started successfully or failed etc to the caller) and let the batch job do the processing

you can use the exported command to start the batch job without wait, or use webservices to do that

in short use RT job only as event to start the batch job which will actually do the processing

if you are interested in the output then it gets complicated since the RTDF has to wait for the job to complete, and will require some erro handlnig well
Back to top
ritesh_kumar
Forum Member
Forum Member



Joined: 04 Dec 2007

Posts: 2



PostPosted: Tue May 01, 2012 1:51 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

Thanks Werner and Manoj for your precious suggestion.
Actually in RT DF we are taking IDOC Message as a source and inserting and updating different target tables. Whole processing( Reading from IDOC and target table population) is done in this DF only.

If we use RT DF to populate input message and save it in to disk and use it in another batch job then it would be combination of RT and batch job. We will be able to catch error in batch job but if any error occurs while processing IDOC message in RT DF then how can we catch it.

Manoj can we follow bellow approach in same RT job instead of using batch job.

The first dataflow (call it RT DF1) following RT_Process_Begins reads the IDOC message, unnest it and writes the data to a STG table. DF2 reads the STG table, processes the data and populate target database tables. Place a Try object between RT DF1 and DF2. Place the Catch object after DF2. The source messages are outside of the Try/Catch block.

In above approach also we can’t catch error if happened in RT DF. We can say that we can’t catch error in RT DF.

Regards,
Ritesh Kumar
Back to top
samatha.mallarapu
Forum Member
Forum Member



Joined: 16 Jun 2009

Posts: 21



PostPosted: Fri Jul 06, 2012 4:44 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

Hi,

We got the solution for this. We need to use a script in between TRY and RT_Begin and RT_Process_End and Catch. Then it is working fine. Attached the screen shot as well.
Back to top
schaphi
Senior Member
Senior Member



Joined: 04 Jun 2012

Posts: 41
Location: Munich


flag
PostPosted: Fri Feb 15, 2013 4:14 am 
Post subject: Re: Real time job Exception Handling

Hi,

i have the same problem: Try-Catch is not working in RealTime Jobs.
I created a small test-job which raise an unique constraint exception from oracle.

When running the job in normal mode (or published and called via soapUI), the catch block is not performed (tested via outputs and print() in a script) BUT the output-xml is written.
When running in debug mode, the catch block IS performed.

When publishing the job and call it, we have the following behaviour:
1st WS-call returns correct response.
2nd (and following) WS-call(s) returning "Web Services is unable to process the request to call real-time service 'Test_SPX' using Access Server 'ouraccessserver:usedport'. Error: Server sent back error: Communication Error. See real time job log for details."

The solution with try-catch outside the brackets don't work for me (always getting an "ApplicationError").

With the first call, this Webservice get killed.
So I can NEVER be sure if my Webservices are up and running (ok...i can create a batchjob parsing the log files of this webservice but this is not a solution).

Why this is a bug:
1. catch just don't work
2. I can kill a WebService with one soap-Request (talking about "Denial of Service")
3. You don't see all later requests in log at all as RT-job is dead and does no logging at all anymore.
With this behavior, it's almost impossible to provide a high-availability (24/7) webservice

Best solution (from my perspective): RealTime-Job Brackets working like try-catch so even if there's an exception raised by one request, the job just restarts and the following ones are performed correctly.
This would also reflect the idea of webservices as they are "stateless" from a technical point of view.

Feel free to contact me, we can also discuss this topic directly.

@manoj: can you please check this if it's already posted as Bug (and this is a major one!) as service.sap.com is unavailable at the moment.
If not, I will do so.

@all: anyone maybe has an idea or some similar problems?

Thanks in advance and Best Regards
Back to top
manoj_d
Forum Addict
Forum Addict



Joined: 01 Jan 2009

Posts: 2944



PostPosted: Mon Feb 18, 2013 12:22 pm 
Post subject: Re: Real time job Exception Handling

I will have to try this out, in any case if try-catch is not supported in a RT Job then I would expct an validation error during Designer time stopping user from adding a try-catch block instead of crashing at run time

if a RT job fails, a new one will be started and if you have multiple instances the other requests will be re-directed to it till the new service instance starts

let me know the case#
Back to top
schaphi
Senior Member
Senior Member



Joined: 04 Jun 2012

Posts: 41
Location: Munich


flag
PostPosted: Tue Feb 19, 2013 2:32 am 
Post subject: Re: Real time job Exception Handling

Hi manoj,

it's possible to add a try-catch block in a RT-Job and it's working in Debug-Mode.
I have to run my RT-Jobs just in a single instance as the sequence of processing is important.
When this RT-Job dies because of an exception, the second and all further calls will get an "Webserver not available...".
Attached an archive with everything you need to retry this on your own.

I also created a SAP-Ticket for this: 162693-2013.

Thanks in advance and Best Regards
Back to top
Werner Daehn
Forum Devotee
Forum Devotee



Joined: 17 Dec 2004

speaker.gif*6
Posts: 10590
Location: Germany


flag
PostPosted: Wed Feb 20, 2013 4:33 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

Can we start one level higher? You have a Realtime Service in DS, it does not have any try/catch. What is the behavior and what should it be?

A try/catch in a RT Job is similar to asking having a try/catch within a row of a dataflow. You can't do that but there are other means of dealing with row errors.

_________________
Werner Daehn
Product Manager Data Services
SAP AG
“The opinions expressed in this post are my own views and not those of SAP.”

PLEASE SUPPORT THIS: Run one ATL job and tell us the benchmark result. Details to be found here.
Back to top
schaphi
Senior Member
Senior Member



Joined: 04 Jun 2012

Posts: 41
Location: Munich


flag
PostPosted: Wed Feb 20, 2013 7:26 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

Hello Werner,

in a RealTime-Job, there's no difference if you're using a try-catch or not (at least for the provided test-job):
The first call returns the XML response, the second and all following requests failing.
After some time (around 2-3 minutes - didn't checked it in detail) the webservice restarts automatically and new requests will work again (until next exception is thrown).

Feel free to contact me directly if you think about a more direct discussion about it (contact details in SAP-Call 162693-2013).

Thanks in advance.
Back to top
Werner Daehn
Forum Devotee
Forum Devotee



Joined: 17 Dec 2004

speaker.gif*6
Posts: 10590
Location: Germany


flag
PostPosted: Thu Feb 21, 2013 2:53 pm 
Post subject: Re: Werner please help us - Real time job Exception Handling

As said, forget about try/catch. What is it what you want, what is it what you get. Then we talk about how to implement that, if possible.
_________________
Werner Daehn
Product Manager Data Services
SAP AG
“The opinions expressed in this post are my own views and not those of SAP.”

PLEASE SUPPORT THIS: Run one ATL job and tell us the benchmark result. Details to be found here.
Back to top
schaphi
Senior Member
Senior Member



Joined: 04 Jun 2012

Posts: 41
Location: Munich


flag
PostPosted: Fri Feb 22, 2013 3:14 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

Good Morning Werner,

I will have a call today with Manoj about this topic; let's see what we can figure out.
What I (and I think a lot of other developer too) would like to have as feature:

"Never"-Dieing Jobs

    I know "never" is almost not possible. But at least to have all the exceptions which are thrown while running a Webservice-Request have to result in a proper finishing of the job.
    Maybe easiest way would be to send a soap exception as result in this case?
    This would prevent the job from restarting/being not available.


Exception-Handling

    When exceptions are thrown, there's normally a technical cause for it: a source or target is not available, some bad implementation, ....
    In all cases an Admin should check them.
    So how to get know there was an exception:
    1. By customer as he claims why his request failed -> "Monitoring by Customer" is not a solution, just a proof you're interpreting "service" in a wrong way icon_wink.gif
    2. Writing a BatchJob or some other Task to check the logfiles of the RealTime-Services.
    Well...that's an option but not really a good one as logfiles are increasing so with each run we have to check more data.
    And when SAP changes log format with some upgrade, we would have to enhance this too.


So one idea covering both things (and one more):
Enhance the possibilities of the "RealTime-brackets".
In the "begin"-bracket, offer an option to change the logic of implementation of "job_run_id()" so it will not return the id of the running process (as it's the same for all webservice-requests) but returning an ID unique for each request.
Maybe also just provide a second function doing exactly the same (so usage in BatchJob would result in returning same value for both functions).
In the "end-"bracket, as "fast solution", add the possibility to set up a list of e-mail addresses which will get an email when some exception is thrown.
As "best solution", usage of scripts and dataflows (like in actual catch) for implementing our own handling would be nice.
And if there would be an exception again, just send back a soap exception message in response.

Maybe also thinking about an option in Job-Settings, if a soap exception or some predefined xml (matching the response xsd and not only using fixed static values but maybe also adding the possibility to use values based on functions (e.g. job_name() or the one mentioned above) or variables)) should be returned in case of exception.

Thanks in advance and Best Regards
Back to top
MEASGARA
Forum Member
Forum Member



Joined: 12 Sep 2017

Posts: 1



PostPosted: Tue Sep 12, 2017 8:22 am 
Post subject: Re: Werner please help us - Real time job Exception Handling

I have a real-time job for that I need to send a mail if the job got failed , I have used Try catch blocks in the Job and I was successful in sending the mail on failure. But the client interface for the real-time service got failed on job completion and I need to start it manually after each failure. Could you please help me on this, So that I can avoid failing of client interface.
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> Data Integrator -> DI: Realtime and NRDM  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0146 seconds using 17 queries. (SQL 0.0033 Parse 0.0003 Other 0.0110)
CCBot/2.0 (http://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo