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: 

SAP SCRIPT to Internal Table

Former Member
0 Kudos

Hello all,

Through Report program a offical letter is displayed mentioning the amount payed till now and the due amount with due date

in SAP SCRIPT.

Now i want this SAP SCRIPT to be sent to some officials to their Outlook...

How to get the SAP SCRIPT output contents with header into my internal table???

So as to trigger the mail.

Waiting for your replies.

- Jagan

1 ACCEPTED SOLUTION

Rocky1
Active Participant
0 Kudos

Hi,

If you want to create PDF of script and send it through mail, Use the following functions.

To convert script to PDF

CALL FUNCTION 'CONVERT_OTF'

To ask user to save pdf

CALL METHOD cl_gui_frontend_services=>file_save_dialog

then u can go for email attachment.

Hope this will help you.

Thanks & Regards

Rocky

8 REPLIES 8

former_member673464
Active Contributor
0 Kudos

hi,

You can directly use the spool request and send it as an attachment . You need not to bother about font, it will consider automatically.

regards,

Veeresh

Former Member
0 Kudos

Hi,

Correct me if i am wrong.

I think you want to send output of sap-script through mail.

you can covert sap-script spool to pdf and send PDF as an attachment to mail.

Regards,

Dhan

0 Kudos

Hello all,

Thanks for your replies...

But i am new to this concept of mail triggering and creating a spool...

Could you please let me know..

What procedure should i follow for this??

means.. is there a function module which is going to perform all of these steps, what you have said?

or is there any configurations to be made for this??

or is there any standard coding available to refer????

0 Kudos

Hi,

Please check this demo program:

BCS_EXAMPLE_6

Thanks & Regards

Rocky

0 Kudos

Hi,

convert your spool request to PDF and

send it

This function will convert the Script into pdf.

call function 'CONVERT_ABAPSPOOLJOB_2_PDF'

exporting

src_spoolid = mi_rqident

no_dialog = c_no

dst_device = c_device

importing

pdf_bytecount = gd_bytecount

tables

pdf = it_pdf_output

exceptions

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

others = 12.

check sy-subrc = 0.

  • Transfer the 132-long strings to 255-long strings

loop at it_pdf_output.

translate it_pdf_output using ' ~'.

concatenate gd_buffer it_pdf_output into gd_buffer.

endloop.

translate gd_buffer using '~ '.

do.

it_mess_att = gd_buffer.

append it_mess_att.

shift gd_buffer left by 255 places.

if gd_buffer is initial.

exit.

endif.

enddo.

then call FM after populating attachment data

call function 'SO_DOCUMENT_SEND_API1'

exporting

document_data = w_doc_data

put_in_outbox = 'X'

sender_address = ld_sender_address" Give the sender address

sender_address_type = ld_sender_address_type

commit_work = 'X'

importing

sent_to_all = w_sent_all

tables

packing_list = t_packing_list

contents_bin = t_attachment

contents_txt = it_message

receivers = t_receivers

exceptions

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

hope this will help you.

Thanks and regards,

Tanmaya Gupta

Rocky1
Active Participant
0 Kudos

Hi,

If you want to create PDF of script and send it through mail, Use the following functions.

To convert script to PDF

CALL FUNCTION 'CONVERT_OTF'

To ask user to save pdf

CALL METHOD cl_gui_frontend_services=>file_save_dialog

then u can go for email attachment.

Hope this will help you.

Thanks & Regards

Rocky

Former Member
0 Kudos

Hi,

Go through these links below:

http://www.sapdev.co.uk/reporting/rep_spooltopdf.htm

Hope it helps

Regards

Mansi

Former Member
0 Kudos

Hello all,

Thanks for helping me...

Awarded points...