Application Development 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: 

How to stop a Job when data not found

Former Member
0 Kudos

Hello Experts,

I have a Report which collect some data and send them via Email. Now the email will be sent whatever the data has been found or not.

Could you give me a tipp how to stop the job on the stage after sybrc != 0 when the data hasn't been found?

START-OF-SELECTION.

   SELECT vbeln fkart

     INTO CORRESPONDING FIELDS OF TABLE ta_rechnung

     FROM vbrk

     WHERE fkdat IN s_fkdat.

   IF sy-subrc <> 0.

   ENDIF.

Simple error message doesn't work

BR

Denis

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos
  1. Exit
  2. Leave program
  3. Message type E with a meaning full message.
6 REPLIES 6

rainer_hbenthal
Active Contributor
0 Kudos

message type e.

former_member156446
Active Contributor
0 Kudos
  1. Exit
  2. Leave program
  3. Message type E with a meaning full message.

Private_Member_7726
Active Contributor
0 Kudos

Hi,

What do you mean by "stop the job on the stage" and if it's normal SM36 job how do you want it "stopped" - so the status of job is "Canceled" and and execution stopped? Message of type 'E' error does normally do that and one has to investigate what is not "normal" in your case.

cheers

Janis

Former Member
0 Kudos

Hi Denis - Use Leave List-Processing.

if sy-subrc ne 0.      

MESSAGE 'No data found' TYPE 'I'.
      LEAVE LIST-PROCESSING.

endif.

Cheers!!

Raju Shrestha

former_member220028
Active Contributor
0 Kudos

Hi,

is it possible that you just dont want an email when no data found, so your inbox wont get spammed? That would have nothing to do with stopping the job. Sounds like you should just change the programm logic on the "send eMail"-part... and leave the job as it is. Because once the job is stopped, you will have to think about how to start it again.

regards

Stefan Seeburger

raymond_giuseppi
Active Contributor
0 Kudos

How did you send the mail

  • in the same program, is it a standard program ?
  • in another step of the job
  • thru spool list recipient in job header

Regards,

Raymond