cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger Mail with PDF from report in background

Former Member
0 Kudos

Dear All,

I have a requirement to send a mail to the Managers in PDF format, with the details of the employees Clock-in and Clock-out, daily at 9am(a kind background job).

Basically, I have a ALV report showing the Empno, Emp Name, Clock-in and Clock-out, deviation by time.

Empno    Emp Name   Clockin Time       Clockout Time    Deviation Time

10           ABC              8:00am                    5:00pm           0:00

My Requirement:

Everyday in the morning 9am, details of all the employees should be converted into PDF and send to the respective Managers (Sales Managers, HR Manager, IT Manager).

Does it requires a workflows with 1step, with some event triggering or anyother way to solve this issue.

Please let me know the best way to solve the issue.

Regards,

Asustainer

Accepted Solutions (1)

Accepted Solutions (1)

hafizul_mollah2
Participant
0 Kudos

Hi,

Yeah we can achieve this requirement by creating one normal ABAP report.

In our project we have done exactly the same thing.We are checking the SY-BATCH is not initial,if yes that means the report is being run in background and here we are calling the custom method(which we have developed) by providing the internal table data which contains all the required data,column names etc. and it will send the email to the email ID provided with an PDF attachment,on clicking on the attachment the PDF file will be opened with the desired data.

I have created one document which contains all the required screenshots and code to develop the method which will send the email with the .PDF attachment and also one sample program using this method.

I have tried to attach the .doc document here itself but it is not allowed.Please send me one blank email to hafizul.ju@gmail.com and I will send u the document.

Please try to develop the same as instructed in the document and u can contact me if u need any further help on this.

Thanks

Hafizul,IBM

Former Member
0 Kudos

Hi Hafizul,

Thanks!!!

Could you pls share your documents at my email id : asustainer@gmail.com.

Regards,

Asustainer

Former Member
0 Kudos

Thanks you very much its perfect.

hafizul_mollah2
Participant
0 Kudos

Hi All,

As I was receiving a lot of email requests for this document, I have created one blog for this which describes all the steps and codes which are there in the MS word document.

You can get all of them in the blog and now no need to send me email and wait for the reply.

This is the link :

http://scn.sap.com/community/abap/blog/2014/05/09/sending-email-with-pdf-attachment

Thanks & Regards,

Hafizul

Answers (3)

Answers (3)

Former Member
0 Kudos

Dear All,

Just a quick note: should you wish to share your email address publicly, please do so in your SCN profile directly instead of individual discussions.

Thanks for your understanding,

Mariana

Former Member
0 Kudos

Thanks Mariana...Noted.

hafizul_mollah2
Participant
0 Kudos

Hi Mariana,

Thank you for informing this,will try to follow the same in future!!!

Thanks

Hafizul,IBM

Former Member
0 Kudos

Yes, updating your profiles with contact details would be best. Including information about your Company and position should you wish to share it on SCN.

Former Member
0 Kudos

Hello,

You can write report to the spool and use FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to get the pdf output and send it using Module 'SO_DOCUMENT_SEND_API1' as  attachment.

If you have the report in a smart form output , you can get the otfdata and use FM
'CONVERT_OTF_2_PDF' to convert it in to pdf format and sent as a attachment ..
You can schedule this report daily in background .. 

SAP workflows are not intended for such requirements . If you
have a real process need to be automated, you can choose workflows..

Sarath

Former Member
0 Kudos

Hi Sarath,

I tried to keep my report as background job and scheduled it and simultaneously kept a break point in my report, but the problem is when background job processed it did not stop at my break point.

Above job i kept using variants, atleast if would have stopped at  my break point i would have written gone with the function modules as mentioned by you, as i already you those function module in my previous projects.

But from background perspective, i am unable to achieve it.

Once background job executed it generating a spool in background, control is not flowing in the report to catch.

Regards,

Asustainer

anjan_paul
Active Contributor
0 Kudos

Hi,

No it don't require any workflow.  Create report, run it as a background job dalily.