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: 

send alv in pdf via email

former_member647278
Participant
0 Kudos

how do i send the output of an ALV via email?

I'm using the SO_NEW_DOCUMENT_SEND_API1 function

how do I extract all the alv and put it in the pdf file and attach it in the email to send?

I have seen the fm SO_ATTACHMENT_INSERT_API1 but how do I insert the output of the alv?

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor

Nowadays there are classes to

  • Extract ALVs to XML/XLSX before converting/pasting them into a pdf (cl_salv_bs_runtime_info, cl_salv_ex_util, cl_salv_bs_tt_util)
  • Send a mail with attachment (cl_bcs, cl_document_bcs)

There are already many samples on this, perform some search or explain where you are stuck.

5 REPLIES 5

FredericGirod
Active Contributor

0 Kudos

can't you in pdf?

RichHeilman
Developer Advocate
Developer Advocate

I was actually successful in doing this a long time ago in a 46c system. I'm sure there is probably a better way these days. But what I did was...

1) Assuming your ALV output is contained in a report program, use SUBMIT statement with extension TO SAP-SPOOL. This will produce the ALV in a list display as a spool.

2) Issue a submit statement for program RSPOLST2 with extension EXPORTING LIST TO MEMORY which will read the spool and put it into memory

3) Call function LIST_FROM_MEMORY which actually brings you the output into an internal table

4) Call function WWW_HTML_FROM_LISTOBJECT which converts the list object into HTML

5) you can then use the HTML and attach when you call the SO_NEW_DOCUMENT_SEND_API1 function.

Again, not pretty, my example is really old, but it worked. But there has to be a better way 15 years later.

Cheers,

Rich Heilman

0 Kudos

can't you in pdf?

raymond_giuseppi
Active Contributor

Nowadays there are classes to

  • Extract ALVs to XML/XLSX before converting/pasting them into a pdf (cl_salv_bs_runtime_info, cl_salv_ex_util, cl_salv_bs_tt_util)
  • Send a mail with attachment (cl_bcs, cl_document_bcs)

There are already many samples on this, perform some search or explain where you are stuck.