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: 

SUBMIT report and Send spool to e-mail

Former Member
0 Kudos

Hello guys,

first I know there are lots of threads about this but I did not found the right explanation for it.

My problem is the following: I call cost center report RKAEP000 with SUBMIT in my z-report. Now I want that a spool gets generated and the spool should be send to destination 'MAIL' with the filled e-mail.

The z-report should not be started manually, but with a periodic batch job every month. So I tried to add the SUBMIT TO SAP-SPOOL [...] extension which leads to creating a spool. But unfortunately the parameters for the spool (e.g. not printing alv statitics) which I defined in the batch job look like they get overwritten by the default values of SUBMIT TO SAP-SPOOL extension. I tried with function GET_PRINT_PARAMETERS but not all parameters are available there (as said alv statistics).

So is it possible, and if yes how, to create a spool with SUBMIT and use the parametes of a batch job when "printing" the spool? And if no, how can I do it otherwise?

Regards

Michael

5 REPLIES 5

former_member809980
Participant
0 Kudos

Hi.

You can define/schedule the job in SM36.

Here you also have the provision to select the 'Spool list recipients'.

AND  ALTERNATIVE IS >>>

Once you submit the z-report .

Get the spool and job details for the same.

Then convert spool to pdf and send as a mail. Steps are below.

1. Call ABAP_SPOOL_2_PDF

2. Call SO_NEW_DOCUMET_SEND_API1

REFER THE FOLLOWING LINKS

code example

http://scn.sap.com/thread/3210557

code example for submit

http://www.sapdev.co.uk/reporting/rep_submit.htm

thanks!!

0 Kudos

Ok thanks for the hint with the recipient list. That's nice and works.

I also know the alternative with creating a PDF. But unfortunately that does not help for my problem.

The sending of the PDF works, but my problem ist that the original output report (e.g. RKAEP000) is called by SUBMIT. And if I only do SUBMIT and create a job with SM36 no spool will be created. When I add TO SAP-SPOOL in the SUBMIT, a spool will be created, but it looks like that the parameter that I defined in SM36 (e.g. no ALV statistic, etc.) get overwritten by the implicit defined spool parameters of SUBMIT.

Regards
Michael

Former Member
0 Kudos

Is it possible to use the parameters of SM36 defined job when doing a SUBMIT?

Regards
Michael

0 Kudos

Hi,

in the driver program , call the following FMs:

  CALL FUNCTION 'JOB_OPEN'

  CALL FUNCTION 'JOB_SUBMIT'

  CALL FUNCTION 'JOB_CLOSE'

To create/ set a dynamic variant for JOB_SUBMIT,

use FM   'RS_CHANGE_CREATED_VARIANT' or 'RS_CREATE_VARIANT'

Hope it solves your problem.

thanks!!

MariaJoãoRocha
Contributor
0 Kudos

Hi, Example with submit rfdopo10 to spool through abap program:

data: wa_pdf_xstring type xstring,

         lt_partidas type standard table of tline,

         it_pdf_partidas_kunnr type solix_tab.

**   submit rfdopo10   with dd_kunnr in so_kunnr                  

                                   with dd_bukrs = pa_bukrs                   

                                   with dd_stida = pa_data                   

                                   with pa_stida = pa_data                   

                                   to sap-spool                   

                                    without spool dynpro                   

                                        immediately ' '                   

                                   and return.   

select single max( rqident ) into l_spool     

from tsp01   

where rq2name like 'RFDOPO10%'   

and  rqowner = sy-uname.   

call function 'CONVERT_ABAPSPOOLJOB_2_PDF'     

exporting         src_spoolid  = l_spool       

                         no_background = 'X'     

tables         pdf          = lt_partidas.   

loop at lt_partidas into l_partidas.     

assign l_partidas to casting.     

concatenate wa_pdf_xstring into wa_pdf_xstring in byte mode.   

endloop.   

call function 'SCMS_XSTRING_TO_BINARY'     

exporting         buffer    = wa_pdf_xstring     

tables         binary_tab = it_pdf_partidas_kunnr. 

endif.

*mail***

* Email Body   wo_document = cl_document_bcs=>create_document(                                 i_type = 'HTM'                                 i_text = it_message_body                                 i_subject = ' ' ).

* Add attachment   

try.         

call method wo_document->add_attachment           

exporting               i_attachment_type    = 'PDF'             

                              i_attachment_subject = 'Lista de partidas individuais Clientes'             

                              i_att_content_hex    = it_pdf_partidas_kunnr.       

catch cx_document_bcs into wx_document_bcs.     

endtry. .....

Regards, Maria João Rocha