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: 

Calling a Smartform and attaching it to an email

Former Member
0 Kudos

Hi,

I have two programs. Program 1 is an ABAP program which creates a PDF from the output using SUBMIT TO SAP-SPOOL then CONVERT_ABAPSPOOLJOB_TO_PDF. It then attaches the PDF to an email and sends the mail. Program 2 produces a Smartform. When sending the email from program 1 I would like to call program 2 and automatically attach the smartform to my email before sending it.

I have tried using SUBMIT_TO_SAP-SPOOL but this fails because there is no spool output - even when I print the smartform.

I think I may be able to do it by using SUBMIT and EXPORT LIST TO MEMORY, bringing back the list using LIST_FROM_MEMORY and maybe using the returned list to create the smartform internally in program 1.

I haven't yet tried this because it seems a long winded way of going about things and I thought I would ask and see if anyone had achieved this in a less contrived way. Any suggestions?

1 ACCEPTED SOLUTION

former_member212002
Active Contributor
0 Kudos

Hello,

- Call the second program using SUBMIT ZPROGRAM WITH -

                                                                                WITH - AND RETURN.

- Inside the second program "EXPORT TO MEMORY", the OTF data of the smartform

- Import the same in program 1, convert it a format of requirement.

- Attach the OTF to mail.

Cheers!

Abhinab

2 REPLIES 2

former_member212002
Active Contributor
0 Kudos

Hello,

- Call the second program using SUBMIT ZPROGRAM WITH -

                                                                                WITH - AND RETURN.

- Inside the second program "EXPORT TO MEMORY", the OTF data of the smartform

- Import the same in program 1, convert it a format of requirement.

- Attach the OTF to mail.

Cheers!

Abhinab

0 Kudos

Thanks Abhinab, this works well.

Just to flesh it out a bit for future reference.

Use  SUBMIT TO SAP-SPOOL WITHOUT SPOOL DYNPRO AND RETURN.

In the called program, when calling the smartform fm, set control_parameters-getotf = 'X'. This returns the otf data to job_output_info-otfdata. Export this to memory.

Back in the calling program. Import the otfdata from memory. Use function 'CONVERT_OTF' or CONVERT_OTF_2_PDF to convert teh smartform otf to PDF format.

Attach the PDF to email in the ususal way.