Skip to Content
author's profile photo Former Member
Former Member

Send Email Attaching the Report generated in Program.

Hi All,

I am generating a report in list format with write statements.

My requirement is to send an email attaching this report as an attachment.

I wanted to know how to get the listobject of the report generated by my program from the memory. Can anyone guide me with this ?

It will be appreciable , If any one can give me more information on sending mails attaching the reports generated by the program.

Thanks in advance,

Mayank

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 11:40 AM

    Hi,

    You can use the following part of code,

    submit ztest exporting list to memory and return.

    • and read list from memory into table

    call function 'LIST_FROM_MEMORY'

    tables

    listobject = listobject

    exceptions

    others = 1.

    if sy-subrc <> 0.

    message id '61' type 'E' number '731'

    with 'LIST_FROM_MEMORY'.

    endif.

    First submit the report output to the memory and then read it in the table.

    Now compress the output in the table

    call function 'TABLE_COMPRESS'

    tables

    in = listobject

    out = objbin

    exceptions

    others = 1.

    if sy-subrc <> 0.

    message id '61' type 'E' number '731'

    with 'TABLE_COMPRESS'.

    endif.

    Now you can use the following FM to send the data as an attachment to any user.

    SO_NEW_DOCUMENT_ATT_SEND_API1

    Hopw this will solve ur problem

    Amit

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Mayank,

      Here is an example code for you.

      REPORT  zramki_submit_self                      .
      
      PARAMETERS:
       p_date LIKE sy-datum DEFAULT sy-datum,
       p_submit NO-DISPLAY.
      
      IF p_submit IS INITIAL.
        SUBMIT (sy-repid) WITH p_date   = p_date
                          WITH p_submit = 'X'
                     EXPORTING LIST TO MEMORY AND RETURN.
      <b>*** Process the list here and send the mail</b> 
      ELSE.
      <b>*** Generate the report here.</b>
        do 5 times.  
          WRITE: /1 sy-index, sy-datum.
        enddo.
        EXIT.
      ENDIF.

      Cheers,

      Ramki Maley.

      Please reward points if the answer is helpful.

      For info on awarding points click on this link: https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm

  • Posted on Sep 28, 2005 at 09:51 AM

    Hi,

    try:

    1) read report sy-repid into objbin

    2)

    fm SO_DOCUMENT_SEND_API1
    ... 
           TABLES
              DATA_TAB = objbin.

    Andreas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 09:52 AM
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

    will help you

    Kind regards

    Matthias Kabel

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 10:07 AM

    hi,

    try this function module

    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    EXPORTING

    document_data = document_data

    put_in_outbox = c_x

    TABLES

    packing_list = packing_list

    object_header = object_header

    contents_txt = t_idisp2

    receivers = receivers

    EXCEPTIONS

    too_many_receivers = 1

    document_not_sent = 2

    operation_no_authorization = 4

    OTHERS = 99.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I think the problem is not clear.

      My problem is to get the listobject name which got generated after the program run.I want to attach this list report to the email. I have seen a code from one of the link.

      Here it is.

      • 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.

      <b>* 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.</b>

      • 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.

      Here the report is sumitted with the option of exporting the list in to the memory which is later read using 'LIST_FROM_MEMORY'.

      But here i need the same report's output to be captured and want to read the list generated from memory into table.

      How can i get the listobject of the list generated by the report in the same report program itself ??

      Please let me know.

      Mayank

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 11:23 AM

    Hi,

    I found that you need the contents of the nternal table

    iusr02.I would suggest you to copy the program into a

    custom program and modify it to export the internal

    table <b>iusr02</b> this to Memory.

    Then from the program where you are calling this

    program import the internal table this from memory.

    Then you can mail this internal table from SAP.

    Please reward points if you find this explanation

    useful.

    Regards,

    Siva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 03:59 PM

    Hi Har,

    below links might help you.

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

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

    reward points for helpfull answers and close the thread if your question is solved.

    regards,

    venu.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.