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 create different spool request in a session and write in them

Former Member
0 Kudos

Hi everybody,

I have a problem and I don't know how to solve, may be someone knows how to do it. I am writing a program that must send emails with an attachment to different people. As the information to send is different, same table but with different info, I am trying to create an spool request, write there the table and after that create a pdf and just attached to the email.

This must be done in background. The problem I have is that I can not write anything in the spool. This is the coding I am using. the spoolrequests are created but nothing is in there. What I have to write in the spool is a table with a format. Does anybody know how can I write in the spool?

CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST'

EXPORTING

dest = 'LOCL'

IMPORTING

handle = handle

spoolid = l_rqid

rc = rc

errmessage = errmsg.

PERFORM f_write_list TABLES it_zzcashm_s.

CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST'

EXPORTING

handle = handle

IMPORTING

rc = rc

errmessage = errmsg

EXCEPTIONS

handle_not_valid = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Thanks in advance,

Alejandro

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos

Hi Alejandro,

Inorder to create a spool request, simply create a simple ALV program ( i.e. a program which displays output in ALV grid or classical report program ).

Now schedule the program as a background job. The program will retrieve the data & generate a spool with ALV list output.

Use FM 'RSPO_RETURN_ABAP_SPOOLJOB' to get the spool output into an internal table & convert the same in PDF using FM 'CONVERT_ABAPSPOOLJOB_2_PDF'.

Pls do a search on SCN with keyword "Send spool to PDF as email" & you will get a sample program.

Best regards,

Prashant

4 REPLIES 4

former_member223537
Active Contributor
0 Kudos

Hi Alejandro,

Inorder to create a spool request, simply create a simple ALV program ( i.e. a program which displays output in ALV grid or classical report program ).

Now schedule the program as a background job. The program will retrieve the data & generate a spool with ALV list output.

Use FM 'RSPO_RETURN_ABAP_SPOOLJOB' to get the spool output into an internal table & convert the same in PDF using FM 'CONVERT_ABAPSPOOLJOB_2_PDF'.

Pls do a search on SCN with keyword "Send spool to PDF as email" & you will get a sample program.

Best regards,

Prashant

0 Kudos

Hi Prashant,

the problem I have is not to create the pdf after the spool, the problem is that I have to create different spool requests in the same program, and I should be able to write the info I want o send by email.

I have different receivers that must receive different information in the tables. So what I am doing is creating and spool request, writing and closing this spool request. But the problem is that I am writing is not going to that spool request, so when I create the pdf is empty because the spool request is empty.

The problem is how to create different spool requests in the same session with different information in every of them.

Thanks very much

0 Kudos

Hi Prashant,

sorry, you were right it works fine.

Thanks very much

0 Kudos

Hi,

I have a rquirement for which i need your help.I have created a alv report and kept one push button .when i click on that button it has to generate spool for that alv output(i don't want to schedule the program backgroud) and convert it into pdf file ,down load to local disk .can u please send the appropriate code, I am new to abap.

thanks in advance,

padmaja