Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How can I avoid dumps

Former Member
0 Likes
6,401

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.

16 REPLIES 16
Read only

Former Member
0 Likes
4,113

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...

Read only

0 Likes
4,113

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.

Read only

former_member194669
Active Contributor
0 Likes
4,113

You can try this way


CALL FUNCTION 'JOB_OPEN'
....
....
SUBMIT YOUR PROG1

CALL FUNCTION 'JOB_CLOSE'

Read only

Former Member
0 Likes
4,113

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

Read only

0 Likes
4,113

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

Read only

0 Likes
4,113

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

Read only

0 Likes
4,113

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!

Read only

0 Likes
4,113

Naidu...

Check solution proved by ars....i think is correct. your shoud handle the exeption in the submited program instead of the submiter.

Bye

Read only

0 Likes
4,113

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

Read only

0 Likes
4,113

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

Read only

former_member194669
Active Contributor
0 Likes
4,113

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.

Read only

Former Member
0 Likes
4,113

Any help please

Read only

Sandra_Rossi
Active Contributor
0 Likes
4,113

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.

Read only

0 Likes
4,113

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]

Read only

0 Likes
4,113

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

Read only

0 Likes
4,113

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.