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: 

ABAP spool to email not working properly !!

Former Member
0 Kudos

Dear All,

My requirement is to email the spool generated at each step to a particular distribution list.

There are 6 steps in my SAP job (SM37) as shown below.

step1 : report1

step2 : email spool1 (this is a custom program that reads the spool id from previous step)

step3 : report2

step4 : email spool2 (same custom program used in step2)

step5 : report3

step6 : email spool3 (same custom program used in step2)

Now when I run the above job, only the email is being sent in step6 (that carries spool of step5 as an attachment). The other two email spool jobs at step 2 and 4 are not sending any emails. Kindly give your inputs on what might be the problem?

Kind Regards,

Hema Sundar.

6 REPLIES 6

FredericGirod
Active Contributor
0 Kudos

Former Member
0 Kudos

HI,

Can you please share your code once? Might be it is reading only last spool id information only i think.

Thanks,

Ashok

Former Member
0 Kudos

If I run each job individually ie., report1 and email spool1 (or) report2 and email spool2, the spool is being emailed properly. Only when I put all 3 reports in a single job as shown above, only spool is sent in email in last step. Please advise.

0 Kudos

Hi,

As you read the spool id from reports, store it in a variables for 1,2,3 and then final step send email based on variables having spool id....

K.S.

raymond_giuseppi
Active Contributor
0 Kudos

Could you post most significant part of your sender report

  • How does it identify previous generated spool (GET_JOB_RUNTIME_INFO, table TBTCP or TBTC_SPOOLID ?)
  • How does it send mail.

Regards,

Raymond

0 Kudos

Hi Raymond, Thanks for your interest shown. below is the code logic which I am using.

To get spool id :

------------------------

CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
        IMPORTING
             eventid                 = l_eventid
             eventparm               = l_eventparm
             external_program_active = l_external_program_active
             jobcount                = l_jobcount
             jobname                 = l_jobname
             stepcount               = l_stepcount
        EXCEPTIONS
             no_runtime_info         = 1
             OTHERS                  = 2.

CHECK sy-subrc EQ 0.


CHECK NOT ( l_jobname IS INITIAL ).
CHECK NOT ( l_jobcount IS INITIAL ).

   SELECT * FROM  tbtcp
                  INTO TABLE it_tbtcp
                  WHERE      jobname     = l_jobname
                  AND        jobcount    = l_jobcount
                  AND        stepcount   = l_stepcount
                  AND        listident   <> '0000000000'
                  ORDER BY   jobname
                             jobcount
                             stepcount.

   READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
   IF sy-subrc = 0.
     g_spoolid = wa_tbtcp-listident.

   ENDIF.


Then I am performing below steps to email the spool.

PERFORM get_std_message.

PERFORM get_recipients.


I think the problem is while reading the spool id itself. Pls give your valuable inputs.


Thanks,

Hema.