Application Development and Automation 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: 
Read only

SAP Process Email with pdf attachments

Former Member
0 Likes
2,274

Folks,

Background:

__________

  • Scheduled processes that run daily sends out emails to our users within SAP. It's also converts the spool to a .pdf file and attaches it in the email. Users can view this pdf (this is essentially a report). It's been working great!!

  • Last month we upgraded our servers to a new hardware and migrated our system to our new hardware. Everything is working great.

  • Past 2 weeks, this .pdf file is failing to open. It's sporadic though. It opens fine for 2 days but for the next few days it does not open.

We are still getting emails with the attachment, but it does not open.

It's opens ADOBE but this is the message we are getting:

"There was an error opening this document. This file cannot be opened because it has no pages".

Please note, the process completed successfully and spool does exists with several pages.

When we tried it to run it in foreground, it ran and we were able to open the .pdf.

Experts, any thought? Do y'all think anything is basis setting that may need some tweak?

Thanks.

Raj

Folks,

Background:

__________

  • Scheduled processes that run daily sends out emails to our users within SAP. It's also converts the spool to a .pdf file and attaches it in the email. Users can view this pdf (this is essentially a report). It's been working great!!

  • Last month we upgraded our servers to a new hardware and migrated our system to our new hardware. Everything is working great.

  • Past 2 weeks, this .pdf file is failing to open. It's sporadic though. It opens fine for 2 days but for the next few days it does not open.

We are still getting emails with the attachment, but it does not open.

It's opens ADOBE but this is the message we are getting:

"There was an error opening this document. This file cannot be opened because it has no pages".

Please note, the process completed successfully and spool does exists with several pages.

When we tried it to run it in foreground, it ran and we were able to open the .pdf.

Experts, any thought? Do y'all think anything is basis setting that may need some tweak?

Thanks.

Raj

8 REPLIES 8
Read only

Former Member
0 Likes
1,733

Hi,

check this..

go to SU01>and defaults>Spool control-->see whether delete output is checked --if it is checked uncheck this...

Prabhudas

Read only

0 Likes
1,733

For my userid and our users user id, this is always "unchecked".

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,733

I can't understand how it's possible that the Adobe Reader software has a different behavior on the same binary, on 2 different days!

Are you sure it's really the same binary? (don't you have a url in the email instead of the full binary)

Is it SAP internal email system (business workplace), or external emails (smtp/mime)?

With which software do you open the PDF? (did you change of software recently too?) By the way, was it unicode conversion, just to know?

What you may also check is that the PDF length in bytes is exactly the same as returned by the spool conversion to pdf : sometimes, it may trigger errors.

Read only

0 Likes
1,733

Thanks for your response to my question.

The email does not go to SAP workplace. It's to external emails (like outlook) and few to outside our work. It has always worked before.

PDF is opened through the good old adobe acrobat reader. Nothing was changed in the software. It's the same version we have been using.

It's not Unicode conversion. It's simply hardware change. We are still running the same 4.6C.

I understand the pdf conversion length. But what's strange is it works sporadically. The day it didn't work, if run in foreground, it works fine.

It's a real mystery.

Raj

Read only

0 Likes
1,733

mystery for me too 😄

The tracks I would investigate : disk damage (corrupted files), different print parameters in dialog versus background which would generate a different OTF spool (only few differences that would make the difference while converted into PDF). Maybe you can compare OTF spools (one generated in background which leads to bad PDF, and one generated in dialog which leads to good PDF) character by character, to be sure.

Read only

0 Likes
1,733

Since it is 4.6C I guess you are using file system to store Spool files (I know that in NetWeaver it can also be done in Database TemSe: http://help.sap.com/saphelp_nw04/helpdata/en/31/19c73b24062b48e10000000a11402f/frameset.htm)

If storing spools on disk, you could check for consistency problems, i.e if you are filling up disk occasionally.

Another thing that could affect you output process sporadically is if you for example schedule a report like RSPO1043 for spool consistency check (which probably could run very long or very short depending on number of spools etc every night). In that case if your output batch for generating the PDFs conflict with a report like this that locks the spool table, you could get into occasional problems depending on whether those batch runs coincide. So check what other batch jobs runs that might affect your process.

Regards,

Christian

Read only

Former Member
0 Likes
1,733

We have figured the problem here. First of all, thanks to everyone's vailable suggestions. I did try each and everyone of your suggestion.

This is what happened:

  • PDF through email was working great.

  • We had a hardware upgrade

  • The process was producing 2 spools with a time lag. In the old hardware it was not a problem due to time lag.

  • New hardware much faster. This was resulting in both the spools getting created at the same time.

  • Hence one day the right spool was getting picked up, and on another day the wrong spool was getting picked up resulting in a wrong pdf which could not be opened.

  • We added extra logic to identify the right spool. This has fixed our problem.

Raj

Read only

0 Likes
1,733

Rajesh,

i am facing the same problem even in foreground. I keep running the transaction and at one point the pdf fails to open. All other times it is successful. We also recently upgraded our systems.

Can you please advise the logic you wrote to read the correct spool request?

Here is what we wrote. Please let me know if this doesn't work.

SELECT * FROM tsp01 INTO TABLE tab_tsp01

WHERE rqfinal IN ('.', 'C') "closed spool

AND rqclient = sy-mandt

AND rqowner = sy-uname

AND rqtitle = var_tdcovtitle "report/variant/email.addr

ORDER BY rqcretime DESCENDING.

IF sy-subrc <> 0.

ENDIF.

READ TABLE tab_tsp01 INDEX 1 INTO wa_tsp01.

tsp01 = wa_tsp01.