Skip to Content

Broadcasting reports via mail with PDF-attachment


So after waiting my application for a while, I could manage to join the SDN community as a blogger. It took me hundreds of hours to solve those odd psychological quizes (didn’t you?), having a blood test done (thank God I’m quite healthy) and proving I can walk upside-down with an SAP FI manual on my feet… Well, first of all, thanks very much for watching my first weblog. It’s always nice having something to contribute to the Community:-).


I once had a request for development, and was this one: every time an advance payment is posted, special G/L indicator (BSIK-UMSKZ) is of course populated. My users wanted to keep track of what advance payments exist as open items in SAP, and then print a list which could be distributed/broadcasted to the people who requested these postings. So first of all, the information on what SAP-user requested an advance payment should be kept in a field, let’s say Reference key BSIK-XREF3.

The procedure

OK, now I have an ALV-list with some postings and the users who I want to broadcast the list to. The main goal is:

… and that’s it! Important! Field BSEG-XREF3 is filled with SAP user codes, and I retrieve the e-mail from the SAP User Maintenance (tables USR21 and ADRP). You may of course use another fields rather than this one (but remember to change slightly the ABAP code!)

The whole code

I’m working with SAP R/3 release 4.6C. Please pay special attention to these routines:

  • send_mail, which prepares all the data like print parameters, generates the spool request and converts it to PDF
  • build_mail, which builds the mail text and calls function module SO_NEW_DOCUMENT_ATT_SEND_API1

The result

  1. The selection screen: I populate Special G/L indicator = “A”
  2. This is the list:
  3. And this is the final mail:

OK, I hope you enjoyed this. I’ll use this functionality to several other types of reports, with the goal of broadcasting.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.