2009 Jul 15 8:26 PM
Hi Experts,
I have prog1 and prog2. in these two reports in prog1 intentionally I'm creating dump. and in prog2 i'm calling prog1 by using submit statement. Now i should not get dump. I should avoid dump. for this i got some hints like i can use " try catch endtry " block. can anybody tell me how can i use this block in my prog2. my code for prog1 is below. please help me out from this.
Prog1 code is like this.
data : l_var type i.
move '1234567896547676376437636737736373' to l_var.
write : l_var.
Hi Experts,
I have prog1 and prog2. in these two reports in prog1 intentionally I'm creating dump. and in prog2 i'm calling prog1 by using submit statement. Now i should not get dump. I should avoid dump. for this i got some hints like i can use " try catch endtry " block. can anybody tell me how can i use this block in my prog2. my code for prog1 is below. please help me out from this.
Prog1 code is like this.
data : l_var type i.
move '1234567896547676376437636737736373' to l_var.
write : l_var.
2009 Jul 15 8:51 PM
Hello,
On the program you want to catch the dump....
1) Run the program an get the exeption name. You will get it on your dump report
2) on the program...
try.
"your code
catch your_Exeption.
endtry.
thats all...
2009 Jul 15 8:57 PM
same as Gabriel, + use CATCH cx_root. (top-level exception class). Nethertheless, some exceptions can NEVER be catched (as explained by SAP), so don't try to catch everything, you would lose your time.
2009 Jul 15 8:58 PM
You can try this way
CALL FUNCTION 'JOB_OPEN'
....
....
SUBMIT YOUR PROG1
CALL FUNCTION 'JOB_CLOSE'
a®
2009 Jul 15 9:02 PM
Hi
Thanks for the prompt response. Here this my code but still i'm getting dump. please have a look at it and correct me if i'm wrong some where.
DATA: w_var TYPE i,
text TYPE string,
oref TYPE REF TO cx_root.
TRY.
submit zsasi_prog1.
CATCH CX_SY_CONVERSION_OVERFLOW into oref.
text = oref->get_text( ).
CATCH cx_root INTO oref.
text = oref->get_text( ).
ENDTRY.
WRITE / text.
Thanks
G.s.naidu
2009 Jul 15 9:05 PM
Hello...
Is it the rigth exception?....I dont see errors on your code....I think you should hadle anyways the dump on the submited report if possible...
Bye
2009 Jul 15 9:11 PM
Hi Gabriel,
Yes still i'm getting dump with this same code. what might be the problem please tell me. my prog1 code is also specified in this thread. please let me know the solution for this.
In dump report that is only i have seen as exception. if that is not correct please guide me how can i find the exception.
Thanks
G.s.naidu
Edited by: G.S. NAIDU on Jul 15, 2009 10:12 PM
2009 Jul 15 9:24 PM
it wouldn't be surprising that exceptions CANNOT be handled on SUBMIT (as for CALL TRANSACTION, etc.), as it runs in its own internal session!
2009 Jul 15 10:08 PM
Naidu...
Check solution proved by ars....i think is correct. your shoud handle the exeption in the submited program instead of the submiter.
Bye
2009 Jul 16 7:44 AM
Hi,
My requirement is I need to handle the dump from submitter program only. I'm wondering this is handling dump with out submit statement, but when I use submit statement its giving dump. below you can see the code for two cases. please tell me how to handle it with submit statement.
with out submit statement:
DATA: w_var TYPE i,
text TYPE string,
oref TYPE REF TO cx_root.
TRY.
* submit ZSASI_PROG4.
w_var = 10 / 0.
CATCH CX_SY_ZERODIVIDE into oref. "cx_sy_arithmetic_error INTO oref.
text = oref->get_text( ).
CATCH cx_root INTO oref.
text = oref->get_text( ).
ENDTRY.
WRITE / text.
with submit statement :
DATA: w_var TYPE i,
text TYPE string,
oref TYPE REF TO cx_root.
TRY.
submit ZSASI_PROG4.
* w_var = 10 / 0.
CATCH CX_SY_ZERODIVIDE into oref. "cx_sy_arithmetic_error INTO oref.
text = oref->get_text( ).
CATCH cx_root INTO oref.
text = oref->get_text( ).
ENDTRY.
WRITE / text.
prog4 code is "
DATA: w_var TYPE i.
w_var = 10 / 0.
write : w_var.
Please help me in this regard
Thanks
G.s.naidu
2009 Jul 16 8:52 AM
It is sure that it won't work if you use "SUBMIT ZSASI_PROG4" without "AND RETURN", because it means that the calling program is immediately ended and replaced by ZSASI_PROG4
2009 Jul 15 9:27 PM
Or Try this way
report prog2
no standard page heading line-size 255.
data: subrc like sy-subrc.
submit prog1.
import subrc from memory id 'PROG2'.
if subrc is not initial.
write: /'Error in PROG1'.
else.
write: /'No error '.
endif.
In PROG1
report prog1 .
data : subrc like sy-subrc.
data : l_var type i.
catch system-exceptions arithmetic_errors = 4.
move '1234567896547676376437636737736373' to l_var.
endcatch.
if sy-subrc = 4.
subrc = 4.
export subrc to memory id 'PROG2'.
endif.
a®
2009 Jul 16 8:19 AM
2009 Jul 16 9:08 AM
I didn't find a reference in the official documentation but I am pretty sure of what I said above : an uncatched exception in a internal session always raise a dump, it can't work another way. Please search forum, it should be said somewhere.
2009 Jul 16 9:49 AM
Llinks to sap library, to see how exceptions can be handled :
[System Response After a Class-Based Exception|http://help.sap.com/abapdocu/en/ABENEXCEPTIONS_SYSTEM_RESPONSE.htm]
[non class-based exceptions|http://sandraros.free.fr/abapdoc.php?url=ABAPRAISE_EXCEPTION.htm]
2009 Jul 16 10:30 AM
Hi Sandra,
My main requirement is in my original report I have to handle hundreds of reports with submit statement. In loop I'm submitting report names and saving each loop iteration results in a database. So here some of the reports are giving dump, and at that instant submitter report is terminating due to submitted report's dump. But I was trying to continue the submitter report and in results table I want to show these exceptions as a result for dump reports.
This is my main requirement. Please help me how can achieve this.
Thank you so much for the responses by you.
Regards
G.s.naidu
2009 Jul 16 12:11 PM
hmmm, it looks like a job scheduler... Can't you use an existing job scheduler instead? It will handle job failures, etc. Otherwise, (but I don't advise doing that), build your own job scheduler (it will cost a little bit!) : it will submit programs by SUBMIT ... VIA JOB ... It should store ID of the running job somewhere, and run every 5 minutes to scan whether it is over or not... I don't have any other idea.