‎2010 Jan 17 3:46 AM
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.
‎2010 Jan 17 3:17 PM
Hi,
use MESSAGE TYPE 'E' or 'A' instead of STOP statement.
Regards,
Adrian
‎2010 Jan 17 7:54 AM
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
‎2010 Jan 17 5:14 PM
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
‎2010 Jan 17 3:17 PM
Hi,
use MESSAGE TYPE 'E' or 'A' instead of STOP statement.
Regards,
Adrian
‎2010 Jan 17 5:33 PM
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
‎2010 Jan 17 4:46 PM
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.
‎2010 Jan 17 5:26 PM
Keshav,
Since I am using the STOP statement, the job is completed as "Finished" and not "Cancelled".
Thanks,
Raj.