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

Error out the ABAP program execution

Former Member
0 Likes
2,672

I have an ABAP program which transfers data from a file to a database table thru function module in packages of 50,000 records.

Upon the successful completion of this ABAP program, I start dependent processes.

Sometimes the function module does not transfer the data and returns the exception back to the ABAP program - which is an expected scenario. Currently when ever an exception is received in the function module, I stop the ABAP program with a STOP statement.

The ABAP program stops, which meets my first objective. But what happens is, if you look at the job log --> it is Completed in terms of program execution and the dependent processes automatically start - which is not meeting my second objective.

My second objective is to force the ABAP program to error out in such a way that .........

1) The program execution is stopped

2) If I look at the job log it should not be Completed (I am looking for something like Cancelled so that the dependent process do not get started automatically)

Is it possible to error out the ABAP program execution by raising an exception or something, so that when i look at the job log - it shows Cancelled and not Completed?

Let me know if you have any questions.

Thanks,

RK.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,573

Hi,

use MESSAGE TYPE 'E' or 'A' instead of STOP statement.

Regards,

Adrian

6 REPLIES 6
Read only

faisalatsap
Active Contributor
0 Likes
1,573

Hi, RK

Check the Value of SY-SUBRC before the execution of the dependent process, if it is 0 (Zero) mean no exception than continue execution of dependent process and if SY-SUBRC value is other than 0 Zero mean there is some exception than not execute the dependent process.

Hope you will get some idea to solve out your problem,

Please Reply if your scenario is else one.

Regards,

Faisal

Read only

0 Likes
1,573

Hi Faisal,

Thanks for your response.

I am using the abap program as a part of my process chain in SAP BI. So whenever sy-subrc = 0, currently I am using a stop statement. The job logs says Completed and it starts the dependent steps in my process chain --> which is not meeting my objective.

RK.

Edited by: RK on Jan 17, 2010 6:24 PM

Edited by: RK on Jan 17, 2010 7:46 PM

Read only

Former Member
0 Likes
1,574

Hi,

use MESSAGE TYPE 'E' or 'A' instead of STOP statement.

Regards,

Adrian

Read only

0 Likes
1,573

Adrian,

Thanks - This is exactly what I was looking for, it works.

For some reason Messages skipped my mind and I was looking at raising Exceptions

Solution:

if sy-subrc NE 0.

message id 'abc' type 'E' number 000.

endif.

Thanks,

RK.

Edited by: RK on Jan 17, 2010 7:47 PM

Edited by: RK on Jan 17, 2010 7:50 PM

Edited by: RK on Jan 17, 2010 7:52 PM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,573

If you schedule it in background, then it shows the status as cnacelled automatically, completed when everything gets over.

So you can schedule the job and then read the job status.

Read only

0 Likes
1,573

Keshav,

Since I am using the STOP statement, the job is completed as "Finished" and not "Cancelled".

Thanks,

Raj.