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.
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:
- Slice the list into pieces, one for each receiver
- Print the sub-listings to the SAP spool, and keep track of the spool numbers
- Convert the spools to PDF
- Use function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send this PDF as an attachment (I followed Sending E-Mail from ABAP – Version 46D and Lower – API Interface)
… 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 selection screen: I populate Special G/L indicator = “A”
- This is the list:
- 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.