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

Send Report result (List)

Former Member
0 Likes
1,007

Hi all

i surch for an Fuba (call funktion) to send the Result of a report (nomal list) to an SAP User.

Any idear??

Chris

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
929

1). Export the list to memory

2). Import the list from mempry

3). Do a COmpress of the data

4). Send an email as an attachment using the normal FM.

Take a look at the following links which will explain how to do the above steps.

http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html

http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp

http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm

Hi all

i surch for an Fuba (call funktion) to send the Result of a report (nomal list) to an SAP User.

Any idear??

Chris

7 REPLIES 7
Read only

Former Member
0 Likes
930

1). Export the list to memory

2). Import the list from mempry

3). Do a COmpress of the data

4). Send an email as an attachment using the normal FM.

Take a look at the following links which will explain how to do the above steps.

http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html

http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp

http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm

Read only

Former Member
0 Likes
929
Read only

Former Member
0 Likes
929

Hi,

If the results are in a internal table and you want to mail it to a user:

http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm

Let us know how you want to send the result..

Regards,

Anjali

Read only

Former Member
0 Likes
929

I think i must tell some more.

There is a report who create a result list (nomale List).

This list should be send to an SAP User (internal Message).

I surch for an FUBA to do this

Read only

0 Likes
929

Hi,

Use Function module <b>SO_OBJECT_SEND</b> or

<b>SO_NEW_DOCUMENT_ATT_SEND_API1

SO_NEW_DOCUMENT_ATT_SEND_MAPI

SO_NEW_DOCUMENT_SEND_API1 </b>

Regards

vijay

Read only

0 Likes
929

Hi Christian,

Please check the link

<a href="http://http://www.sapdevelopment.co.uk/reporting/email/email_sapmail.htm">http://http://www.sapdevelopment.co.uk/reporting/email/email_sapmail.htm</a>

Hope this will solve ur problem.

If it does ,,Please reward points and close the thread.If any query revert back.

Thanks,

Mayank

Read only

Former Member
0 Likes
929

hii

export the result to an exccel file and send it to the user..otherwise

REPORT z_email_abap_report.

----


  • E-mail an Abap report *

----


DATA : w_name TYPE sos04-l_adr_name.

SELECT-OPTIONS :

  • Recipient address

s_name FOR w_name DEFAULT sy-uname NO INTERVALS.

----


START-OF-SELECTION.

  • E-mail Abap report

PERFORM f_send_mail.

----


  • Form f_send_mail

----


FORM f_send_mail.

  • Data Declaration

DATA:

l_datum(10),

ls_docdata TYPE sodocchgi1,

lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,

lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,

lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,

lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,

lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,

lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,

l_tab_lines TYPE i,

l_att_type LIKE soodk-objtp.

WRITE sy-datum TO l_datum.

  • List of Users According to Logon Date and Password Change

  • NOTE: Create ALI/OTF Document in Spool

SUBMIT rsusr200 WITH valid = 'X'

WITH notvalid = space

WITH unlocked = 'X'

WITH locked = space

EXPORTING LIST TO MEMORY AND RETURN.

  • Read list from memory into table

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = lt_listobject

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • Error in function module &1

MESSAGE ID '61' TYPE 'E' NUMBER '731'

WITH 'LIST_FROM_MEMORY'.

ENDIF.

  • Because listobject is of size RAW(1000)

  • and objbin is of size CHAR(255) we make this table copy

CALL FUNCTION 'TABLE_COMPRESS'

TABLES

in = lt_listobject

out = lt_objbin

EXCEPTIONS

compress_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • Error in function module &1

MESSAGE ID '61' TYPE 'E' NUMBER '731'

WITH 'TABLE_COMPRESS'.

ENDIF.

  • NOTE: Creation of attachment is finished yet.

  • For your report, the attachment should be placed into table

  • objtxt for plain text or

  • objbin for binary content.

  • Now create the message and send the document.

  • Create Message Body

  • Title and Description

ls_docdata-obj_name = 'USERS_LIST'.

CONCATENATE 'List of Users' sy-sysid '-' l_datum "#EC *

INTO ls_docdata-obj_descr SEPARATED BY space.

  • Main Text

lt_objtxt = 'List of Users According to Logon Date' &

' and Password Change'. "#EC *

APPEND lt_objtxt.

  • Write Packing List (Main)

DESCRIBE TABLE lt_objtxt LINES l_tab_lines.

READ TABLE lt_objtxt INDEX l_tab_lines.

ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).

CLEAR lt_objpack-transf_bin.

lt_objpack-head_start = 1.

lt_objpack-head_num = 0.

lt_objpack-body_start = 1.

lt_objpack-body_num = l_tab_lines.

lt_objpack-doc_type = 'RAW'.

APPEND lt_objpack.

  • Create Message Attachment

  • Write Packing List (Attachment)

l_att_type = 'ALI'.

DESCRIBE TABLE lt_objbin LINES l_tab_lines.

READ TABLE lt_objbin INDEX l_tab_lines.

lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).

lt_objpack-transf_bin = 'X'.

lt_objpack-head_start = 1.

lt_objpack-head_num = 0.

lt_objpack-body_start = 1.

lt_objpack-body_num = l_tab_lines.

lt_objpack-doc_type = l_att_type.

lt_objpack-obj_name = 'ATTACHMENT'.

lt_objpack-obj_descr = 'List_of_Users'. "#EC *

APPEND lt_objpack.

  • Create receiver list

LOOP AT s_name.

lt_reclist-receiver = s_name-low.

lt_reclist-rec_type = 'B'.

APPEND lt_reclist.

ENDLOOP.

  • Send Message

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = ls_docdata

put_in_outbox = ''

TABLES

packing_list = lt_objpack

object_header = lt_objhead

contents_bin = lt_objbin

contents_txt = lt_objtxt

receivers = lt_reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

document_type_not_exist = 3

operation_no_authorization = 4

parameter_error = 5

x_error = 6

enqueue_error = 7

OTHERS = 8.

IF sy-subrc = 0.

  • Document sent

MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.

ELSE.

  • Document <&> could not be sent

MESSAGE ID 'SO' TYPE 'S' NUMBER '023'

WITH ls_docdata-obj_name.

ENDIF.

ENDFORM. " F_SEND_MAIL

                                  • END OF PROGRAM Z_EMAIL_ABAP_REPORT ******************

Regards

Naresh