Sending Multiple Abap List by email

Dear All,
I am using SO_NEW_DOCUMENT_ATT_SEND_API1 func module to send abap list via email.
  Program logic is like this .
with in a loop of purchase group(PG) For each value a report is submitted for list is send to receiver.
submit ZMM_PREQ_SEND3  WITH EKGRP = itab-EKGRP
exporting list to memory and return.
and then using LIST_FROM_MEMORY function to read from memory.
This code is working fine for single entry but for more than one PG only last generated abap list is received.
How i can sent multiple lists.
Thanks
Shantanu

Hi,
Check out this code .
Pls reward if useful.
REPORT ZSD_YJTEST1 .
DATA: ST1 TYPE STRING VALUE 'YATIN'.
DATA: CR(2) TYPE X VALUE '0D0A'.
DATA: ST2 TYPE STRING VALUE 'JOSHI'.
DATA IT_LIST TYPE STANDARD TABLE OF ABAPLIST WITH HEADER LINE.
  SUBMIT ZAA_TABW_LISTE EXPORTING LIST TO MEMORY AND RETURN.
  CALL FUNCTION 'LIST_FROM_MEMORY'
       TABLES
            LISTOBJECT = IT_LIST
     EXCEPTIONS
          NOT_FOUND  = 1
          OTHERS     = 2
DATA: LT_ASCI TYPE STANDARD TABLE OF SOLISTI1 WITH HEADER LINE.
CALL FUNCTION 'LIST_TO_ASCI'
   EXPORTING
        LIST_INDEX         = -1
     TABLES
          LISTASCI           = LT_ASCI
          LISTOBJECT         = IT_LIST
     EXCEPTIONS
          EMPTY_LIST         = 1
          LIST_INDEX_INVALID = 2
          OTHERS             = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT LT_ASCI.
   IF SY-TABIX > 1 .
   CONCATENATE CR LT_ASCI-LINE INTO LT_ASCI-LINE.
   MODIFY LT_ASCI.
   ENDIF.
ENDLOOP.
DATA LISTTAB_OUT    LIKE SOLISTI1       OCCURS 0 WITH HEADER LINE.
   CALL FUNCTION 'TABLE_COMPRESS'
      IMPORTING
           COMPRESSED_SIZE =
        TABLES
             IN              = IT_LIST
             OUT             = LISTTAB_OUT
      EXCEPTIONS
           COMPRESS_ERROR  = 1
           OTHERS          = 2
   IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
   ENDIF.
  DATA: DOC_DATA LIKE SODOCCHGI1,
        DOC_INFO LIKE SOFOLENTI1.
  DOC_DATA-OBJ_LANGU = SYST-LANGU.
  DOC_DATA-OBJ_NAME = 'Report-Liste'(001).
  MOVE 'EEEE' TO DOC_DATA-OBJ_DESCR.
  DATA: P_DTP TYPE SOODK-OBJTP .
  P_DTP = 'RAW'.
  CALL FUNCTION 'SO_DOCUMENT_INSERT_API1'
       EXPORTING
            FOLDER_ID                  = 'FOL18          4 '
            DOCUMENT_DATA              = DOC_DATA
            DOCUMENT_TYPE              = P_DTP
       IMPORTING
            DOCUMENT_INFO              =  DOC_INFO
       TABLES
          OBJECT_HEADER              =
            OBJECT_CONTENT             = LT_ASCI
           contents_hex               =
          OBJECT_PARA                =
          OBJECT_PARB                =
     EXCEPTIONS
          FOLDER_NOT_EXIST           = 1
          DOCUMENT_TYPE_NOT_EXIST    = 2
          OPERATION_NO_AUTHORIZATION = 3
          PARAMETER_ERROR            = 4
          X_ERROR                    = 5
          ENQUEUE_ERROR              = 6
          OTHERS                     = 7
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
DATA: LS_ATT LIKE SOATTCHGI1.
DATA: LT_AHD TYPE STANDARD TABLE OF SOLISTI1 WITH HEADER LINE.
LS_ATT-OBJ_NAME = 'MYTEST'.
LS_ATT-OBJ_DESCR = 'URTEST'.
LS_ATT-OBJ_LANGU = 'DE'.
       LS_ATT-ATT_SIZE = DOC_INFO-DOC_SIZE.
DATA: LS_AINF TYPE SOATTINFI1.
CALL FUNCTION 'SO_ATTACHMENT_INSERT_API1'
     EXPORTING
          DOCUMENT_ID                = DOC_INFO-DOC_ID
          ATTACHMENT_DATA            = LS_ATT
          ATTACHMENT_TYPE            = 'TXT'
    IMPORTING
         ATTACHMENT_INFO            = LS_AINF
     TABLES
          ATTACHMENT_HEADER          = LT_AHD
          ATTACHMENT_CONTENT         = LT_ASCI
        contents_hex               = listtab_out
    EXCEPTIONS
         DOCUMENT_NOT_EXIST         = 1
         ATTACHMENT_TYPE_NOT_EXIST  = 2
         OPERATION_NO_AUTHORIZATION = 3
         PARAMETER_ERROR            = 4
         X_ERROR                    = 5
         ENQUEUE_ERROR              = 6
         OTHERS                     = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LS_ATT-OBJ_NAME = '2MYTEST'.
LS_ATT-OBJ_DESCR = '2URTEST'.
LS_ATT-OBJ_LANGU = 'DE'.
       LS_ATT-ATT_SIZE = DOC_INFO-DOC_SIZE.
CALL FUNCTION 'SO_ATTACHMENT_INSERT_API1'
     EXPORTING
          DOCUMENT_ID                = DOC_INFO-DOC_ID
          ATTACHMENT_DATA            = LS_ATT
          ATTACHMENT_TYPE            = 'TXT'
    IMPORTING
         ATTACHMENT_INFO            = LS_AINF
     TABLES
          ATTACHMENT_HEADER          = LT_AHD
          ATTACHMENT_CONTENT         = LT_ASCI
        contents_hex               = listtab_out
    EXCEPTIONS
         DOCUMENT_NOT_EXIST         = 1
         ATTACHMENT_TYPE_NOT_EXIST  = 2
         OPERATION_NO_AUTHORIZATION = 3
         PARAMETER_ERROR            = 4
         X_ERROR                    = 5
         ENQUEUE_ERROR              = 6
         OTHERS                     = 7
DATA: REC TYPE STANDARD TABLE OF SOOS1 WITH HEADER LINE.
REC-RECEXTNAM = '[email protected]'.
REC-RECESC = 'E'.
REC-SNDART = 'INT'.
REC-MAILSTATUS = 'E'.
REC-SNDPRI = '1'.
APPEND REC.
DATA: FLAG TYPE C .
FLAG  = '1'.
IF FLAG = '1'.
  CALL FUNCTION 'SO_OBJECT_SEND'
       EXPORTING
          EXTERN_ADDRESS             = ' '
            FOLDER_ID                  = 'FOL18          4 '
          FORWARDER                  = ' '
          OBJECT_FL_CHANGE           = ' '
          OBJECT_HD_CHANGE           = ' '
            OBJECT_ID                  = DOC_INFO-OBJECT_ID
           OBJECT_TYPE                = 'ALI'
          OUTBOX_FLAG                = ' '
          OWNER                      = ' '
          STORE_FLAG                 = ' '
          DELETE_FLAG                = ' '
            SENDER                     = SY-UNAME
          CHECK_SEND_AUTHORITY       = ' '
          CHECK_ALREADY_SENT         = ' '
          GIVE_OBJECT_BACK           =
          ORIGINATOR                 = ' '
          ORIGINATOR_TYPE            = 'J'
          LINK_FOLDER_ID             = ' '
     IMPORTING
          OBJECT_ID_NEW              =
          SENT_TO_ALL                =
          ALL_BINDING_DONE           =
          OFFICE_OBJECT_KEY          =
          ORIGINATOR_ID              =
       TABLES
          OBJCONT                    =
          OBJHEAD                    =
          OBJPARA                    =
          OBJPARB                    =
            RECEIVERS                  = REC
          PACKING_LIST               =
          ATT_CONT                   =
          ATT_HEAD                   =
          NOTE_TEXT                  =
          LINK_LIST                  =
          APPLICATION_OBJECT         =
     EXCEPTIONS
          ACTIVE_USER_NOT_EXIST      = 1
          COMMUNICATION_FAILURE      = 2
          COMPONENT_NOT_AVAILABLE    = 3
          FOLDER_NOT_EXIST           = 4
          FOLDER_NO_AUTHORIZATION    = 5
          FORWARDER_NOT_EXIST        = 6
          NOTE_NOT_EXIST             = 7
          OBJECT_NOT_EXIST           = 8
          OBJECT_NOT_SENT            = 9
          OBJECT_NO_AUTHORIZATION    = 10
          OBJECT_TYPE_NOT_EXIST      = 11
          OPERATION_NO_AUTHORIZATION = 12
          OWNER_NOT_EXIST            = 13
          PARAMETER_ERROR            = 14
          SUBSTITUTE_NOT_ACTIVE      = 15
          SUBSTITUTE_NOT_DEFINED     = 16
          SYSTEM_FAILURE             = 17
          TOO_MUCH_RECEIVERS         = 18
          USER_NOT_EXIST             = 19
          X_ERROR                    = 20
          OTHERS                     = 21
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDIF.
WRITE DOC_INFO-DOC_ID.

Similar Messages

  • How can I send multiple photos in an email?

    How can I send multiple photos in an email?

    In Photos, when looking at your pictures, click the Action arrow first (upper right), before selecting any pictures.  Then you can tap select the pictures you want to send then click "Share" in the upper left.  From there you can Email.
    If you click and open one picture first, the Action button will only allow you to share that one picture.
    (Yeah, took me a while to figure this out. )
    ivan

  • How to send multiple customer statements by email using RFKORD11 program.

    Hi All,
    How to send multiple customer statements by email using RFKORD11 program. Is it possible?
    As of now we copied the stanadard program and sending the customer statements by email, one by one.
    if i execute the z program it will show the customer statement and send mail option.
    if i click send mail it will send that customer statement to the corresponding customer.
    then again i need to click back, it will show next customer statement and click on send mail.
    Pl guide me, if any one worked on this program.
    thanks in advance.
    Regards,
    Mahesh

    Try execute the program in the background to see if that helps.

  • How to send multiple customer statements by email using RFKORD11

    Hi All,
    How to send multiple customer statements by email using RFKORD11 program.
    As of now we copied the stanadard program and sending the customer statements by email, one by one.
    if  i execute the z program it will show the customer statement and send mail option.
    if i click send mail it will send that customer statement to the corresponding customer.
    then again i need to click back, it will show next customer statement and click on send mail.
    Pl guide me, if any one worked on this program.
    Regards,
    Mahesh

    Hi .
    You first need to copy that program to Z and make the changes in it. Can you convert sapscript to smartform?
    then you can write a logic to send mail in the loop.
    to send the pdf file
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/mailsendthroughoutputcontrols
    Regards,
    Madhuri
    Edited by: madhuri sonawane on Jun 10, 2009 4:20 PM

  • How to send multiple attachemnt with a Email

    Hello experts,
    I have problem with sending multiple attachement with a Email .
    I have used program BCS_EXAMPLE_5. it is not for multiple attachment.
    Please help me.
    Thank you.

    Hello,
    u can make use of these Function Modules.
    SO_DOCUMENT_SEND_API1
    SO_NEW_DOCUMENT_SEND_API1
    'CONVERT_OTFSPOOLJOB_2_PDF'
    the program which u gave using the method classes
    Thank u,
    santhosh
    Edited by: santhosh kumar on Dec 2, 2008 2:15 PM

  • How To Send Multiple Spool Lists  from a Single Step in SM37

    We have converted all of our output reports to ALV and now instead of one big spool that contains all the reports generated in a single step we now have multiple spools.  We run the program as a Batch Job in SM37 and have created an entry in the SPOOL LIST RECIPIENT for the job.  The problem is that it only sends one of our lists.  Is there a way to make it send all of the ists?

    You need to write areport program with fm 'RSPO_RETURN_ABAP_SPOOLJOB'  and collect all spools and send it and make this as precedent job after your ALV spool jobs

  • Import group members those are inactive more than 30 days to a csv file and then send the updated list by email

    Hello,
    I am very new to powershell and I have been looking for a solution where I can list all the inactive members more than 30 days from  particular groups in AD, export the updated list to a csv file and send the file by email . . Can someone help me on
    this?
    thanks

    Hi,
    Take a look at Get-ADGroupMember, Get-ADUser, Export-Csv, and Send-MailMessage:
    http://ss64.com/ps/get-adgroupmember.html
    http://ss64.com/ps/get-aduser.html
    http://ss64.com/ps/export-csv.html
    http://ss64.com/ps/send-mailmessage.html
    Let us know if you have any specific questions.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Sending multiple sheets excel in email.

    Hi,
    I have a requirement to send a multiple sheet ecxel files as an attachment in an email.
    Basically, there are two  internal tables and data of each internal table  to send in seperate worksheet of same excel fie.
    Suppose we have data in tab1.
    aa     11
    bb     22
    cc     33
    and in tab2
    aaa    111
    bbb    222
    ccc    333
    So in the mail, there should a single excel  with two sheets containing the data of tab1 & tab2 respectively
    Anyone has worked or have any idea about the solution, please share.
    Thanks,
    Mandeep

    For single sheet excels you can also use
        call function 'TEXT_CONVERT_XLS_TO_SAP'
          exporting
            i_tab_raw_data       = wa_raw
            i_filename           = p_filename
          tables
            i_tab_converted_data = i_etab[]
          exceptions
            conversion_failed    = 1
            others               = 2.

  • Multiple contact list for emailing -using Outlook f

    Good afternoon,
    I have a user that has set up a seperate contact group/list in her outlook 2003. She wants to be able to emal her secondary contact group from her blackberry while she is on the road. The question is can this be done?
    Quick glance break down: Outlook 2003
     -Contacts
      +Global list
      +Friends
    On blackberry -Send email  -starts typing letters-auto populates but from global   ---- {user wishes to send friend and email } [ friends email address in not in the global list only in the friends contact list]

    My address book groups in the Address Book on my Mac are synced and available on my iPhone, but addressing an email or an SMS to an address book group or distribution list is not supported - at the present time anyway.

  • How do I send multiple pics in an email?

    When i choose to send a pic with email or send an email and want to attach a pic, it seems like the only way I can send a pic with email is if I go into camera roll and click a pic, how do I attach pics once I'm in the email app?

    When composing an email, press the home button to leave the message and the Mail app and select the Photos app. Select the icon at the top right and select the photos you want to copy. Select Copy.
    Return to the email and select on the area in the message body where you want to paste the photo or photos and select Paste when prompted.

  • Sending multiple sms to my email

    I have at least a hundred texts that I would like to send to my email.  Is there a way that I can send them to my email without having to forward them one at a time?

    Directelt this cannot be done from the BlackBerry handheld. However, you can use ABC Amber Converter application. This application can read BlackBerry Backup data and and convert them to any desirable format. After that you can send them to you email ID.
    tanzim                                                                                  
    If your query is resolved then please click on “Accept as Solution”
    Click on the LIKE on the bottom right if the post deserves credit

  • Export ABAP List to Excel and send it as email attachment

    Hi,
    I have a program that sends email to employees, using SAP Office, this email sends an attachment in html (an abap lisp exported to html). To create this attachment I use LIST_FROM_MEMORY to recover data and then WWW_HTML_FROM_LISTOBJECT to create the html file.
    Then the email is sent using SO_NEW_DOCUMENT_ATT_SEND_API1 and it works fine. But now I need to send this ABAP List as an Excel instead of sending as a HTML file.
    How can I do this? Is this possible?
    Thanks in advance
    Best regards
    P.S: I've tried to recover information from ABAP List as an ASCII file (using LIST_TO_ASCII instead of WWW_HTML_FROM_LISTOBJECT) and then sending the file as an XLS instead of HTM (this is determined in PACKING_LIST parameter of SO_NEW_DOCUMENT_ATT_SEND_API1), but when I open the excel file, all information is stored in the first cell, so you cannot perform any operation on it.

    Hi,
    Please refer to the link below :
    http://www.sapdev.co.uk/reporting/rep_spooltopdf.htm
    or
    http://www.sapdev.co.uk/reporting/email/attach_xls.htm
    Thanks,
    Sriram Ponna.

  • Problem while sending Abap list to mail in the background

    Hi all,
    I am sending abap list to email in the background.
    My code as folllows:
    DATA: so_ali LIKE solisti1 OCCURS 100 WITH HEADER LINE.
      DATA: listobject LIKE abaplist OCCURS 0 WITH HEADER LINE.
      DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
      DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
      DATA: doc_chng LIKE sodocchgi1.
      DATA: tab_lines LIKE sy-tabix.
      DATA: lt_user TYPE soud3 OCCURS 0 WITH HEADER LINE.
    *Start of modification Tix 14411 for transport request D82K929044
      DATA: it_user like SODLIENTI1 occurs 0 with header line.
    *End of modification for Tix 14411 for transport request D82K929044
    CLEAR: listobject, so_ali, objpack, objhead, objtxt, reclist, doc_chng.
      REFRESH :
         listobject, so_ali, objpack, objhead, objtxt, reclist.
    creation of the document to be sent
      doc_chng-obj_name = 'BOFAREPORT'.
      WRITE sy-datum TO doc_chng-obj_descr.
      CONCATENATE 'Bank Activity Report for :'(025)
              company_itab_tr-company_code '-' doc_chng-obj_descr INTO
              doc_chng-obj_descr.                               "AN052799
      objtxt = 'This is the bank activity report received for'(026).
      APPEND objtxt.
      CONCATENATE company_itab_tr-company_code '-'
                  company_itab_tr-company_name '-'
                  company_itab_tr-company_city INTO
                  objtxt.
      APPEND objtxt.
      WRITE sy-datum TO objtxt.
      CONCATENATE 'Date Received : '(027) objtxt INTO objtxt.
      APPEND objtxt.
      WRITE sy-uzeit TO objtxt.
      CONCATENATE 'Time Received : '(028) objtxt INTO objtxt.
      APPEND objtxt.
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
      doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    Creation of the entry for the compressed document
      CLEAR objpack-transf_bin.
      objpack-head_start = 1.
      objpack-head_num = 0.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'RAW'.
      APPEND objpack.
    Creation of the document attachment
      CALL FUNCTION 'SAVE_LIST'
        EXPORTING
          list_index         = '0'
        TABLES
          listobject         = listobject
        EXCEPTIONS
          list_index_invalid = 1
          OTHERS             = 2.
      CALL FUNCTION 'TABLE_COMPRESS'       "Schneller Tabellencopy
           TABLES
                in         = listobject
                out        = so_ali.
      DESCRIBE TABLE so_ali LINES tab_lines. "objbin
      objhead = 'BOFA-REPORT'. APPEND objhead.
    Creation of the entry for the compressed attachment
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num = 1.
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
      objpack-doc_type = 'ALI'.
      objpack-obj_name = 'BOFAREPORT'.
      objpack-obj_descr = 'Bank Activity Report'.
      objpack-doc_size = tab_lines * 255.
      APPEND objpack.
    Completing the recipient list
      SELECT * FROM zwfi_yefap_paypr WHERE
                           bukrs = company_itab_tr-company_code.
        IF NOT  ( zwfi_yefap_paypr-list1 IS INITIAL ).
          clear it_user[].
          CALL FUNCTION 'SO_DLI_READ_API1'
           EXPORTING
             DLI_NAME                         = zwfi_yefap_paypr-list1
          DLI_ID                           = ' '
             SHARED_DLI                       = 'X'
        IMPORTING
          DLI_DATA                         =
           TABLES
             DLI_ENTRIES                      = it_user
           EXCEPTIONS
             DLI_NOT_EXIST                    = 1
             OPERATION_NO_AUTHORIZATION       = 2
             PARAMETER_ERROR                  = 3
             X_ERROR                          = 4
             OTHERS                           = 5
          IF SY-SUBRC = 0.
            loop at it_user.
              if it_user-member_typ = 'A'.
                reclist-receiver = it_user-member_adr.
                reclist-rec_type = 'U'.
                reclist-com_type = 'INT'.
                reclist-notif_del = 'X'.
                reclist-notif_ndel = 'X'.
                append reclist.
              elseif it_user-member_typ = ''.
                reclist-receiver = it_user-member_nam.
                reclist-rec_type = 'B'.
                reclist-express = 'X'.
                append reclist.
              Endif.
            endloop.
          ENDIF.
        ENDIF.
        IF NOT ( zwfi_yefap_paypr-list2 IS INITIAL ).
          clear it_user[].
          CALL FUNCTION 'SO_DLI_READ_API1'
           EXPORTING
             DLI_NAME                         = zwfi_yefap_paypr-list2
          DLI_ID                           = ' '
             SHARED_DLI                       = 'X'
        IMPORTING
          DLI_DATA                         =
           TABLES
             DLI_ENTRIES                      = it_user
           EXCEPTIONS
             DLI_NOT_EXIST                    = 1
             OPERATION_NO_AUTHORIZATION       = 2
             PARAMETER_ERROR                  = 3
             X_ERROR                          = 4
             OTHERS                           = 5
          IF SY-SUBRC = 0.
            loop at it_user.
              if it_user-member_typ = 'A'.
                reclist-receiver = it_user-member_adr.
                reclist-rec_type = 'U'.
                reclist-com_type = 'INT'.
                reclist-notif_del = 'X'.
                reclist-notif_ndel = 'X'.
                append reclist.
              elseif it_user-member_typ = ''.
                reclist-receiver = it_user-member_nam.
                reclist-rec_type = 'B'.
                reclist-express = 'X'.
                append reclist.
              Endif.
            endloop.
          ENDIF.
        endif.
      ENDSELECT.
      CLEAR error_text.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc_chng
          put_in_outbox              = 'X'
          COMMIT_WORK                = 'X'
       TABLES
          packing_list               = objpack
          object_header              = objhead
          contents_bin               = so_ali  "objbin
          contents_txt               = objtxt
          receivers                  = reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      CASE sy-subrc.
        WHEN 0.
          write: / 'Result of the send process:'.
          LOOP AT reclist.
            write: / reclist-receiver(48), ':'.
            IF reclist-retrn_code <> 0.
              write 'The document was sent'.
            else.
              CONCATENATE 'The document could not be sent to : '(029)
                         reclist-receiver(48) INTO error_text.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          error_text = text-030.
        WHEN 2.
          error_text = 'Document could not be sent to any recipient'(031).
        WHEN 4.
          error_text = 'No send authorization'(032).
        WHEN OTHERS.
          error_text = 'Error occurred while sending'(033).
      ENDCASE.
      IF NOT ( error_text IS INITIAL ).
        CONCATENATE 'Mail send Error : '(034) error_text INTO error_text.
       PERFORM WRITE_LOG(YEFAP_APERAK) USING ERROR_TEXT.
        PERFORM write_log(zwfi_yefap_bank_report) USING error_text.
      ENDIF.
      CALL FUNCTION 'LIST_FREE_MEMORY'
        TABLES
          listobject = listobject
        EXCEPTIONS
          OTHERS     = 1.
    When I excute the same program in the foreground, Attachment in the mail is showing all the pages of the report output.
    But when I excute the same program in the background only last page is shown in the mail attachemnt.
    I think the problem is with the function module SAVE_LIST function module.
    I replaced the SAVE_LIST function module with  LIST_TO_MEMORY and LIST_FROM_MEMORY function modules.
    It is also giving the same result.
    In the foreground excution email attachemnt showing all the pages and in the background excution only last page is shown in the attachemnt.
    I want all the pages dispalyed in the background mode excution in the email attachment.
    How to slove this issue.
    Thanks in advance.
    Raja

    I have seen this problem before.   Please have a look at this example program.  This works very well when ran in background as well as foreground
    * This program works in the background,
    report zrich_0003 .
    data: maildata like sodocchgi1.
    data: mailtxt like solisti1 occurs 10 with header line.
    data: mailrec like somlrec90 occurs 0 with header line.
    data: list type table of abaplist with header line.
    data: ascilines(1024) type c occurs 0 with header line.
    data: htmllines type table of w3html with header line.
    parameters: p_check.
    start-of-selection.
      submit zrich_0004 exporting list to memory and return.
      call function 'LIST_FROM_MEMORY'
           tables
                listobject = list
           exceptions
                not_found  = 1
                others     = 2.
      call function 'LIST_TO_ASCI'
           tables
                listobject         = list
                listasci           = ascilines
           exceptions
                empty_list         = 1
                list_index_invalid = 2
                others             = 3.
      call function 'WWW_HTML_FROM_LISTOBJECT'
           tables
                html       = htmllines
                listobject = list.
      clear: maildata, mailtxt, mailrec.
      refresh: mailtxt, mailrec.
      maildata-obj_name = 'TEST'.
      maildata-obj_descr = 'Test Subject'.
      loop at htmllines.
        mailtxt = htmllines.
        append mailtxt.
      endloop.
      mailrec-receiver = '[email protected]'.
      mailrec-rec_type = 'U'.
      append mailrec.
      call function 'SO_NEW_DOCUMENT_SEND_API1'
           exporting
                document_data              = maildata
                document_type              = 'HTM'
                put_in_outbox              = 'X'
           tables
                object_header              = mailtxt
                object_content             = mailtxt
                receivers                  = mailrec
           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.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
      commit work.
      wait up to 2 seconds.
      submit rsconn01 with mode = 'INT'
                   with output = 'X'
                              and return.
    Regards,
    Rich Heilman

  • Problem while sending Abap list to mail

    Hi All,
    I am sending an abap list to mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1.
    Report output is going to mail id but only last page is showing.
    The flow i followed in the code is as follows:
    First I used Function module SAVE_LIST
    Next I used Function module TABLE_COMPRESS
    And finally i used function module SO_NEW_DOCUMENT_ATT_SEND_API1
    Report output is going to mail id but last page is showingup.
    I want all the pages to show in the email.
    How it can be solved?
    Thanks in Advance,
    Raja

    Raja,
    Please provide your code that builds the ABAP List and the code that builds the mail package.

  • Sending E-Mail with ABAP List as Attachment with custom Extension

    Hello everyone.
    I have the following problem:
    I want to send a ABAP list as an attachment to an external e-mail address with a <b>custom file extension</b>.
    Everything works fine, exept the thing with the file extension.
    I am using FB 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
    When I choose 'ALI' as Packing_List-Doc_Type everything works fine, but the attached file has the extension 'txt'.
    When I choose e.g. 'lbl' as Doc_Type, the extension is correct, but the file contains invalid data.
    Packinglist code:
    <i>AttType = 'ALI'.
    Describe Table ObjBin Lines TabLines.
    Read Table ObjBin Index TabLines.
    ObjPack-Doc_Size = ( TabLines - 1 ) * 255 + strlen( ObjBin ).
    ObjPack-Transf_Bin = 'X'.
    ObjPack-Head_Start = 1.
    ObjPack-Head_Num = 1. "0.
    ObjPack-Body_Start = 1.
    ObjPack-Body_Num = TabLines.
    ObjPack-Doc_Type = AttType.
    ObjPack-Obj_Name = 'ATTACHMENT'.
    ObjPack-Obj_Descr = cFileName.
    Append ObjPack.</i>
    function call:
    <i>Call Function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                Document_Data              = DocData
                Put_in_Outbox              = 'X'
           TABLES
                Packing_List               = ObjPack
                Object_Header              = ObjHeader
                Contents_Bin               = ObjBin
                Contents_Txt               = ObjTxt
                Receivers                  = RecList
           EXCEPTIONS
                Too_Many_Recievers         = 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.</i>
    Thanks for your help,
    Arndt

    Hi,
    look here:
    Re: How to email an attachment with more than 255 characters?
    Andreas

Maybe you are looking for