Urgent: Mailing text files

I have currently written a stored procedure which calculates
bills and saves them in a separate text file for each
user/customer. I want to automatically mail them to each user.
Their email address will be stored in the database. Can any one
help me in generating automatic mails thru stored procedures....
null

Unfortunately .. there is no direct way through PL/SQL
One work around if you have a Unix server.
I guess you have used PL/SQL File I/O UTL_FILE package to create
the file.
You will need to script something on the server..
Eg. First line of every file .. send in the email id
[email protected]
line1
line2..
Write a script which reads the first line and gets the email
and then using unix mail command it will work.
Adil Sameer (guest) wrote:
: I have currently written a stored procedure which calculates
: bills and saves them in a separate text file for each
: user/customer. I want to automatically mail them to each user.
: Their email address will be stored in the database. Can any
one
: help me in generating automatic mails thru stored
procedures....
null

Similar Messages

  • Problen when Sending the text file as attachment to the external mail

    HI,
    I am sending the text file as an attachment to a aexternal mai. mailing is going with text file attachment, but text file is empty. No information in the file is going, only empty text file is going. I am sending the code  iam using. Please suggest, if I need to change any passing parameters orany other other solution.
    tables: knb1,kna1,adr6,ITEMSET,bsid,TSP01.
               INTERNAL TABLES
    DATA: BEGIN OF it_kna1 occurs 0,
            KUNNR LIKE KNA1-KUNNR,
            ADRNR LIKE KNA1-ADRNR,
          END OF it_kna1.
    DATA: BEGIN OF it_email occurs 0,
            ADDRNUMBER LIKE ADR6-ADDRNUMBER,
            SMTP_ADDR LIKE ADR6-SMTP_ADDR,
          END OF it_email.
    DATA: BEGIN OF it_bsid occurs 0,
           KUNNR LIKE BSID-KUNNR,
           BUKRS LIKE BSID-BUKRS,
         END OF it_bsid.
    DATA: BEGIN OF it_final occurs 0,
            KUNNR LIKE KNA1-KUNNR,
            ADRNR LIKE ADR6-ADDRNUMBER,
            EMAIL LIKE ADR6-SMTP_ADDR,
          END OF it_final.
    DATA: BEGIN OF BUFFER OCCURS 10000,
              TEXT(255) TYPE C,
            END OF BUFFER.
    data:xtext type solix_tab." occurs 0 with header line."line.
    data:xi_pdf type soli_tab.
    DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2  WITH HEADER LINE,
          OBJHEAD LIKE SOLISTI1   OCCURS 1  WITH HEADER LINE,
          OBJBIN  LIKE SOLISTI1   OCCURS 0  WITH HEADER LINE,
          OBJTXT  LIKE SOLISTI1   OCCURS 10 WITH HEADER LINE,
          RECLIST LIKE SOMLRECI1  OCCURS 5  WITH HEADER LINE,
          DOC_CHNG  LIKE SODOCCHGI1,
         PARAMS   LIKE PRI_PARAMS,
         ARPARAMS LIKE ARC_PARAMS,
         DAYS(1)  TYPE N VALUE 8,
         COUNT(3) TYPE N VALUE 1,
         VALID    TYPE C,
         RECEIVER(30),
         STR(256).
    data:  spoolid    type tsp01-rqident,
           pdf_table like tline occurs 0 with header line,
           v_bytecount type i,
           itab_pdf like tline occurs 10 with header line,
          xi_pdf  like tline occurs 0 with header line,
          xi_pdf  like buffer occurs 0 with header line,
           xi_pdf_1 like xi_pdf,
           v_length(2) type p,
           html  like solisti1   occurs 0  with header line,
           xi_temp      like bapiqcmime occurs 0 with header line,
           xi_mime(255) type c occurs 0 with header line.
              VARIABLES
    data: g_email type adr6-smtp_addr,
          TAB_LINES LIKE SY-TABIX,
          G_FLAG(1) TYPE C.
         g_norm(1) TYPE C,
         g_shbv(1) TYPE C,
         g_merk(1) TYPE C,
         g_park(1) TYPE C,
         g_apar(1) TYPE C.
    data: l_lines     type i,
          line1       type i,
          l_temp(500) type c,
          l_offset    type p,
          l_lineslen(2) type p,
          l_mimelen(2)  type p,
          v_spono like tsp01-rqident,
          l_tabix       like sy-tabix.
    *****VIA SELECTION-SCREEN
    ENDFORM.                    " SEND_TO_SPOOL
    *&      Form  GET_SPOOL_ID
    *&      Form  CONVERT_SPOOL_TO_PDF
    *&      Form  SEND_MAIL
    FORM SEND_MAIL .
      data:l_lin  like sy-tabix,
            l_lint like sy-tabix,
            it_list like abaplist occurs 0,
            l_newline(2) type x value '0D0A'.
    *--Data for the status output after sending
      data: user_address like sousradri1 occurs 1 with header line,
            sent_to_all like sonv-flag.
      clear: reclist, reclist[],
             objtxt , objtxt[],
             objpack, objpack[],
             objbin , objbin[],
             doc_chng.
    *--move list to office table objbin
    *--Start of Changes to support PDF attachments - UB20030116
    loop at html.
       objbin-line = html-line.
       append objbin.
       clear objbin.
    endloop.
    loop at xi_pdf.
       objbin-line = xi_pdf-text.
       append objbin.
       clear objbin.
    endloop.
    *--We may write additional text to the main document
    *--For faxing this will be the cover page. Like sending from SAPoffice
    *--the layout set Office-Telefax will be used.
      objtxt-line = 'NOTE : Please Consider the below Headers'.
      append objtxt.
      clear objtxt.
      objtxt-line = 'Assignment -->  Purchase order number '.
      append objtxt.
      clear objtxt.
      objtxt-line = 'Document  -->   Invoice No '.
      append objtxt.
      clear objtxt.
      objtxt-line = 'Amount In DC --> Amount Due '.
      append objtxt.
      clear objtxt.
      objtxt-line = '                                            '.
      append objtxt.
      clear objtxt.
      objtxt-line = '                                            '.
      append objtxt.
      clear objtxt.
      objtxt-line = 'Please find attached statement for this week'.
      append objtxt.
      clear objtxt.
      objtxt-line = '                                            '.
      append objtxt.
      clear objtxt.
      objtxt-line = 'This is an AUTO GENERATED MAIL'.
      concatenate objtxt-line 'Please Do not reply to this mail' into
      objtxt-line separated by ' '.
      append objtxt.
      clear objtxt.
      describe table objtxt lines tab_lines.
      read table objtxt index tab_lines.
    *--Create the document which is to be sent
    doc_chng-obj_name  = 'List'.
      doc_chng-obj_name = 'SAPRPT'.
    doc_chng-obj_descr = 'Customer statement for the week'.
      concatenate 'Customer statement for '
                  sy-datum into
                  doc_chng-obj_descr
                  separated by ' '.
      doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
    *--Fill the fields of the packing_list for the main document:
    *--It is a text document
      clear objpack-transf_bin.
    *--The document needs no header (head_num = 0)
      objpack-head_start = 1.
      objpack-head_num = 0.
    *--but it has a body
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
    *--of type RAW
      objpack-doc_type = 'RAW'.
      append objpack.
    *--Create the attachment (the list itself)
      describe table objbin lines tab_lines.
    *--Fill the fields of the packing_list for the attachment:
    *--It is binary document
    objpack-transf_bin = 'X'.
    *--we need no header
      objpack-head_start = 1.
      objpack-head_num = 0.
    *--but a body
      objpack-body_start = 1.
      objpack-body_num = tab_lines.
    *--of type G_DOC_TYPE
    objpack-doc_type = 'PDF'. "commented on 12/13/2007
      objpack-doc_type = 'TXT'. "commented on 12/13/2007
      objpack-obj_name = 'Attachment'.
    objpack-obj_descr = 'Customer Statement'.
      concatenate 'Customer Statement' sy-datum into objpack-obj_descr.
      objpack-doc_size = tab_lines * 255.
      append objpack.
      reclist-receiver = g_email.
      reclist-rec_type = 'U'.
    reclist-com_type = 'FAX'.
      append reclist.
      data:xi type soli.
    xi-line = 'haisdgsfsdf'.
    append xi to xi_pdf.
    xi-line = 'haisdfdsfd'.
    append xi to xi_pdf.
    xi-line = 'haisfgsdfsd'.
    append xi to xi_pdf.
    xi-line = 'haisdfsgfsdgg'.
    append xi to xi_pdf.
    *xi_pdf-text = 'hai'.
    *append xi_pdf.
    *xi_pdf-text = 'hai'.
    *append xi_pdf.
    *xi_pdf-text = 'hai'.
    *append xi_pdf.
    *xi_pdf-text = 'hai'.
    *append xi_pdf.
    CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
        EXPORTING
          ip_solitab        = xi_pdf[]
       IMPORTING
         EP_SOLIXTAB       = xtext[].
    **--Send the document by calling the SAPoffice API1 module for sending
    **--documents with attachments
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc_chng
          PUT_IN_OUTBOX              = 'X'
         COMMIT_WORK                = 'X'
        IMPORTING
          sent_to_all                = sent_to_all
        TABLES
          packing_list               = objpack
          object_header              = objhead
         contents_bin               = objbin
          contents_txt               = objtxt
          contents_hex               = xtext
          receivers                  = reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          others                     = 99.

    HI,
    There are lots of bugs.
    Please refer this sample program to fix it.
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    Best regards,
    Prashant

  • How can I add random mail signatures from a text file?

    I'm trying to add a different quote to every email that I write... is there a program or way for Mail to pluck and append a quote at random from a external file of quotes?  (I'm not talking about the standard "Random" feature built into Mail.)
    There must be one out there, but I can't find it.  I'm using Snow Leopard and Mail 4.5

    Hello,
    Here is a running start on getting specific lines in the case lines starting with ComboBox. I took your data and placed it into a text file named TextFile1.txt in the bin\debug folder. Code below was done in
    a console app.
    using System;
    using System.IO;
    using System.Linq;
    namespace ConsoleApplication1
    internal class Program
    private static void Main(string[] args)
    var result =
    from T in File.ReadAllLines(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TextFile1.txt"))
    .Select((line, index) => new { Line = line, Index = index })
    .Where((s) => s.Line.StartsWith("ComboBox"))
    select T
    ).ToList();
    if (result.Count > 0)
    foreach (var item in result)
    Console.WriteLine("Line: {0} Data: {1}", item.Index, item.Line);
    Console.ReadLine();
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my webpage under my profile but do not reply to forum questions.

  • Problem to send text file to mail from ALV report

    Hi Friends,
    I have a problem in my ALV report with text file.  As per the requirment, when we execute the program then text attachment should go to the particual email.
    When i am using file type as XLS i am getting attachment with all 4 recoreds( input for 4 records) in mail. But all 4 records are coming in SAME ROW. It should come 4 records in 4 rows. when I use file type as TXT and separated by pipe symble in code, it is showing only one recored for same above input.
    When i use file type as XLS and click the attachment in email, it will triggire one popul with three options like SAVE, OPEN, CANCEL.
    But when i click on text file attachment, it is directly showing ony one recored.
    Please correct me on this.
    my code is
    PERFORM send_file_as_email_attachment
                                   tables i_message
                                          i_attach
                                    using v_email
                                          'User last log on details'
                                          'XLS'
                                          'User log on list'
                                 changing v_error
                                          v_reciever.
    FORM send_file_as_email_attachment tables pi_message
                                              pi_attach
                                        using p_email
                                              p_mtitle
                                              p_format
                                              p_filename
                                              p_attdescription
                                              p_sender_address
                                              p_sender_addres_type
                                     changing p_error
                                              p_reciever.
      DATA: l_error    TYPE sy-subrc,
              l_reciever TYPE sy-subrc,
              l_mtitle LIKE sodocchgi1-obj_descr,
              l_email LIKE  somlreci1-receiver,
              l_format TYPE  so_obj_tp ,
              l_attdescription TYPE  so_obj_nam ,
              l_attfilename TYPE  so_obj_des ,
              l_sender_address LIKE  soextreci1-receiver,
              l_sender_address_type LIKE  soextreci1-adr_typ,
              l_receiver LIKE  sy-subrc.
      l_email   = p_email.
      l_mtitle = p_mtitle.
      l_format              = p_format.
      l_attdescription      = p_attdescription.
      l_attfilename         = p_filename.
      l_sender_address      = p_sender_address.
      l_sender_address_type = p_sender_addres_type.
    Fill the document data.
      v_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      v_doc_data-obj_langu = sy-langu.
      v_doc_data-obj_name  = 'SAPRPT'.
      v_doc_data-obj_descr = l_mtitle .
      v_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR v_doc_data.
      READ TABLE i_attach INDEX v_cnt.
      v_doc_data-doc_size =
         ( v_cnt - 1 ) * 255 + STRLEN( i_attach ).
      v_doc_data-obj_langu  = sy-langu.
      v_doc_data-obj_name   = 'SAPRPT'.
      v_doc_data-obj_descr  = l_mtitle.
      v_doc_data-sensitivty = 'F'.
      CLEAR i_attachment.
      REFRESH i_attachment.
      i_attachment[] = pi_attach[].
    Describe the body of the message
      CLEAR i_packing_list.
      REFRESH i_packing_list.
      i_packing_list-transf_bin = space.
      i_packing_list-head_start = 1.
      i_packing_list-head_num = 0.
      i_packing_list-body_start = 1.
      DESCRIBE TABLE i_message LINES i_packing_list-body_num.
      i_packing_list-doc_type = 'RAW'.
      APPEND i_packing_list.
    Create attachment notification
      i_packing_list-transf_bin = 'X'.
      i_packing_list-head_start = 1.
      i_packing_list-head_num   = 1.
      i_packing_list-body_start = 1.
      DESCRIBE TABLE i_attachment LINES i_packing_list-body_num.
      i_packing_list-doc_type   =  l_format.
      i_packing_list-obj_descr  =  l_attdescription.
      i_packing_list-obj_name   =  l_attfilename.
      i_packing_list-doc_size   =  i_packing_list-body_num * 255.
      APPEND i_packing_list.
    Add the recipients email address
      CLEAR i_receivers.
      REFRESH i_receivers.
      i_receivers-receiver = l_email.
      i_receivers-rec_type = 'U'.
      i_receivers-com_type = 'INT'.
      i_receivers-notif_del = 'X'.
      i_receivers-notif_ndel = 'X'.
      APPEND i_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = v_doc_data
                put_in_outbox              = 'X'
                sender_address             = l_sender_address
                sender_address_type        = l_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = v_sent_all
           TABLES
                packing_list               = i_packing_list
                contents_bin               = i_attachment[]
                contents_txt               = i_message
                receivers                  = i_receivers
           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.
    Populate zerror return code
      l_error = sy-subrc.

    Hi,
    declare the following constant in u r program and concatenate at the end of each and every record in your internal table.
    CONSTANTS : LV_CRLF TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
    for eg.
    if u internal table has values like
    row1
    row2
    row3
    concatenate the 1st record lv_crlf into first record.
    conactenate second record lv_crlf into second record.
    concatenate third record lv_crlf into third record.
    now attach  the internal table to the FM which u use for sending email. Each and every row will come in new line. The LV_CRLF will hold nothing but a line feed character (#).
    Hope it will solve u r problem
    Regards,
    Rose.

  • How to send a text file attachment through mail in ECC 6.0

    Hi Friends,
    As per the requirement, I need to send a ALV report result as text file attachment to user in ECC 6.0 . I know how to do in 4.6C version. But the same code is not working here in ECC 6.0.
    Generally to get the data in new row in the text file we use below code in 4.6c.
    data: c_value type x value ' 0D '.
    concatenate c_value itab-line into itab-line.
    By using above code, we get each row of the itab in a new line in text file.
    Same code is not working in ECC6.0 as it is not supporting  to concatenate bytes with characters. Getting the error like " field c_value should be diclared as type C or I or N or T or P"
    Even I have used function module NLS_STRING_CONVERT_TO_SYS to convert hexa to char. It is converting the value' 0D' to ' # '. But it is not working.
    Could you please suggest me that how can get each row of itab as a new line in text file in ECC 6.0.
    Itab value:
    abcdefdfldjfñlkdsjfñldsjfdsñljñla
    fdsljfñldskjfldsñkjfñldsjfñldsajñld
    vcxusfcxusfcusafcxusafcusafcdsauc
    Actual result currently coming in text file:
    abcdefdfldjfñlkdsjfñldsjfdsñljñlafdsljfñldskjfldsñkjfñldsjfñldsajñldvcxusfcxusfcusafcxusafcusafcdsauc
    Expected result in text file:
    abcdefdfldjfñlkdsjfñldsjfdsñljñla
    fdsljfñldskjfldsñkjfñldsjfñldsajñld
    vcxusfcxusfcusafcxusafcusafcdsauc
    Please do the needful.
    Thanks
    Kumar

    hi,
    Try this function Module
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1 '
    *example code
    ******* Create Message Body Title and Description****************
      i_objtxt = 'test with pdf-Attachment!'.
      append i_objtxt.
      describe table i_objtxt lines v_lines_txt.
      read table i_objtxt index v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    **** Main Text*****************************
      clear i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      append i_objpack.
    **** Attachment (pdf-Attachment)*************
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 1.
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smartform'.
      concatenate i_objpack-obj_name i_objpack-doc_type into
    i_objpack-obj_descr separated by '.'.
    *  I_OBJPACK-OBJ_DESCR = 'test'.
      i_objpack-doc_size =  v_lines_bin * 255 .
      append i_objpack.
    * Länge des Attachment ermitteln
      clear i_reclist.
      i_reclist-receiver = 'email address'.
      i_reclist-rec_type = 'U'.
      i_reclist-express = 'X'.
      data: tab_lines like sy-tabix.
      describe table i_objbin lines tab_lines.
      append i_reclist.
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        exporting
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = 'X'
        tables
          packing_list               = i_objpack
          object_header              = wa_objhead
          contents_bin               = i_objbin
          contents_txt               = i_objtxt
          receivers                  = i_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.
        write:/ 'Error When Sending the File', sy-subrc.
      else.
        write:/ 'Mail sent'.
      endif.

  • How to process a text file (mail attachment) using the sender mail adapter?

    Hi guys,
    Is it possible to process mail attachments using the sender mail adapter? Let's say I have a structured text file (attachment) which needs to be mapped and sent to target system.
    Post please any thoughts or experience.
    Thanks,
    Olian

    Hi Olian,
    Have a look at these helpful links -
    1. http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9e6c7911-0d01-0010-1aa3-8e1bb1551f05&overridelayout=true
    2. http://www.riyaz.net/blog/xipi-configuring-the-sender-mail-adapter/
    3. http://help.sap.com/saphelp_nw70/helpdata/en/23/c093409c663228e10000000a1550b0/content.htm
    Regards,
    Sunil Chandra

  • Text file as an attachment in reciever mail adapter

    Hi Experts,
    I want to pick the text file using sender file adapter using file content converion, same file i need to send an attachment in reciever mail adapter.
    Can anybody help me how can i do this.
    Kind Regards,
    Praveen.
    Edited by: Praveen Kumar on Mar 10, 2010 9:08 AM

    Hi,
    >>>I want to pick the text file using sender file adapter using file content converion, same file i need to send an attachment in reciever mail adapter.
    use payload swap bean to put the attachment in place of the message payload - do the content conversion using
    content conversion adapter module, then do the same in the reverted order at the receiver
    there are dozenz of blogs showing how to use the two adapter modules I mentioned so just do a little search in blog section
    Regards,
    Michal Krawczyk

  • Default page size settings in TEXT FILES SAVED FROM MAIL

    I regularly save emails as rtf files (either with or without attachments) and sometimes return to print them with TextEdit.
    I'm in Ireland, where our standard paper size is as most European countries, i.e. A4.
    My 'Default Paper Size in Page Setup' is set in the Print & Fax pane in *System Preferences* as A4.
    If I select 'Page Setup...' in Mail to print direct from the Application, it defaults as you'd expect to A4.
    If I make a fresh text file with TextEdit, it also defaults to A4.
    But if I 'Save As...' from Mail and then open the resulting file in TextEdit (or Word, for example) I find it has been saved with a US Letter Page Setup. Can I change this setting? If so, where?

    I think I see where the confusion is.
    I'm not talking about file attachments (the 'Save Attachments...' function in the File menu). What I'm talking about is the saving of the email as an rtf file (the 'Save As...' function). When you select 'Save As...' there's a further pull-down menu for format that allows you to save it as one of 3 options: Rich Text Format, Plain Text OR Raw Message Source. I want to save it as Rich Text which preserves fonts, bold type etc.
    Mail clearly can create such files (I have several GB of saved emails that says so!) - what I want to figure out is if there's a way to control the way it sets the page size in those files as it does so.

  • Sending text files as attachments in mails

    Hi Experts,
    I want to send some content in a text file as an attachment in the mail. Can anybody provide me the sample code for this.
    points guaranteed.
    thanks
    sanakr

    HI
    Check this one
    first create a Include report with the following coding
    *&  Include           ZPA1_INCLFOR_MAIL                                *
    * Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    * FORM
    FORM ml_customize USING objname objdesc.
    *----------- Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    *--------- Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    *--------- Fetch List From Memory
    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.
    CALL FUNCTION 'TABLE_COMPRESS'
    * IMPORTING
    * COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    * Header Data
    * Already Done Thru FM
    * Main Text
    * Already Done Thru FM
    * Packing Info For Text Data
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    * Packing Info Attachment
    att_type = whatatt_type..
    DESCRIBE TABLE objbin LINES tab_lines.
    READ TABLE objbin INDEX tab_lines.
    objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    * Receiver List
    * Already done thru fm
    ENDFORM. "ml_prepare
    * FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    * IMPORTING
    * SENT_TO_ALL =
    * NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    * CONTENTS_HEX = objhex
    * OBJECT_PARA =
    * object_parb =
    receivers = 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.
    MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
    WITH docdata-obj_name.
    ENDIF.
    ENDFORM. "ml_customize
    * FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    *-------------- Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    *------------- Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    * FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    *-------- Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    *------------ Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    Then include that report in the following report and copy the same code and paste it there
    *& Report  ZPA_TEMP147                                                 *
    REPORT  ZPA_TEMP147                             .
    INCLUDE zpa1_inclfor_mail.
    * DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    * SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    * AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    * START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    * FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    * CHECK_DOS_FORMAT =
    IMPORTING
    * DRIVE =
    EXTENSION = extension
    NAME = name
    * NAME_WITH_EXT =
    * PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    Regards
    Pavan

  • Mail Adapter: How to send data as a simple text file attachment?

    Hi All
    I have a proxy to file scenario, where i write data to a text file.
    Now, i need to have a second receiver. I have to send an email, with the above file as an attachment, to this receiver.
    How can i do this?
    How can i send the data as a text file attachment to the receiver?
    Many Thanks
    Chandra

    Hi,
    To send the message to the second receiver you need to have:
    1) Necessary mail message format (can download from service marketplace)
    2) Receiver mail communication channel.
    3) Create the necessary Configuration Objects .... Receiver Determination, Interface Determination, Receiver Agreement.
    3) You can do a XSLT mapping (if required)....if no complex logic is needed then you can do a simple Message mapping.
    4) In the receiver CC make sure that you check the Adapter Specific Message Attribute checkbox.
    For more info you can refer my answer in this thread:
    Re: xml in mail
    Also refer the blog:
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    Regards,
    Abhishek.

  • Convert XML to text file and sending the same via Mail receiver adapter

    Dear All,
    I have a requirement like....
    I am getting a XML file as a result of mapping and it needs to be converted to a TEXT file and
    the converted file needs to be sent to a mail address in text format.
    Any body has idea how to achieve this?
    Thanks in advance for your help.
    Regards
    Hari

    >
    HP CReddy wrote:
    > Dear All,
    >
    > I have a requirement like....
    >
    > I am getting a XML file as a result of mapping and it needs to be converted to a TEXT file and
    > the converted file needs to be sent to a mail address in text format.
    >
    > Any body has idea how to achieve this?
    >
    > Thanks in advance for your help.
    >
    > Regards
    > Hari
    use the StructXML2Plain or XML2Plain from the standard MessageTransformBean
    Add the module to you Mail adapter before the mail adapters standard module itself
    Ref: http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm

  • Sending Text File through Mail Adapter

    Hi Group,
    I need to send my Target as Mail attachment in the Text File?Can any body Suggest

    Hi swabap,
         You need to use PayloadSwapBean module in the Mail receiver adapter. This module will send the payload as an attchment to the mail server.
    Check the following link
    <a href="/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure:///people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    Regards,
    Akshay

  • Reading Text File from selection Screen and populating table (Urgent)

    Hi All,
    I have some requirment like i in my report i have to initial my Input feild from text file is it good to populate a internal table or range.
    I have three feild in a excel file that entry can more then 500
    data example
    Matnr Date             Day
    A1     10.07.2007    12
    B1     10.07.2007    10
    A1     19.07.2007    15
    C1     20.08.2007    30
    E1     11.09.2007    12
    This report for Price Protection claim.
    even u can help me out with proper table plz this is urgent.

    Hi..
    <b>parameters:</b>
      p_file(50) type c.
    <b>data:</b>
      begin of itab occurs 0,
         matnr type vbak-matnr,
         date type sy-datum,
         day(2) type n,
      end of itab.
    <b>at selection-screen on value-request for p_fname.</b>
      perform get_path.
    <b>start-of-selection.</b>
    <b>CALL FUNCTION 'GUI_UPLOAD'</b>
      <b>EXPORTING
        FILENAME                      =  p_fname
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'</b>
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
    <b>  TABLES
        DATA_TAB                      = itab</b>
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    This Sub routine is used to get the file name
    *There are no interface parameters passed to this subroutine.
    FORM get_path .
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME            =  P_FNAME
      DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
       FILENAME                =  P_FNAME
      RC                     =
    EXCEPTIONS
       INV_WINSYS             = 1
       NO_BATCH               = 2
       SELECTION_CANCEL       = 3
       SELECTION_ERROR        = 4
       OTHERS                 = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " get_path
    data:

  • I purchased a very expensive package, to convert files to PDF form. when it converted some of the text needs to be adjusted how do i fix this? When i e-mailed the file to myself i was unable to read the file??????

    Question?? my name is Cecelia. I purchased your product and so far I am very unsatisfied with it. I need to fix or add to a converted PDF and I am unable to do so. I e-mailed this form to my self and it states no file avail.. is this what other will see too??????

    First, when you e-mail a PDF you have to be sure the e-mail package you use encodes the PDF as binary file, not all do automatically. If the PDF is sent as an ASCII (text) file, then it will be corrupted. That is likely what happened. The alternative is to zip the PDF and send the zip file.
    Fix ups are generally done in the application you used. The PDF should be a duplicate of what you see in your APP. If you are using WORD, be sure the selected printer in WORD is the Adobe PDF printer during your editing. WORD and many other word processors reflow documents based on the attached printer. It is not clear what your problem is, but that might be the issue.
    As for forms, are you actually creating an electronic form or is this something that looks form for someone to print and fill in. If you want an electronic form, then you need to use the Form Tools in the tools menu. You can let Acrobat try to guess the form fields that are needed, then go back and edit the form fields. Of course, you may not have actually meant a form as such, but the layout of your document that is messed up. If it is the layout, then attaching the Adobe PDF printer during the editing of your document should solve that issue. You should also consider using the Press or Print job settings to embed all fonts.

  • Receiver mail with text file attached without line feeds

    Hi, friends
    I have a text file  to mail scenario, where file must be attached to receiver mail.
    Receiver CC mail is protocol XIPAYLOAD and use mail package and keep attachment.
    In tab module, i have:
    Module name --> SAP XI Sample/ConvertCRLFfromToLF
    Module configuration --> mode LFtoCRLF
    The plain text file is attached to mail but there are no line feeds after the plain text lines.
    Thanks, in advance

    Stefan,
    This is not a Java mapping, it's an ABAP mapping.
    I've tryed also to insert this characters, but without success.
    In my abap class i have:
      data: l_newline type c value cl_abap_char_utilities=>newline.
      data: l_linefeed type c value cl_abap_char_utilities=>CR_LF.
      clear wa_string.
      incode = idocument->get_elements_by_tag_name( 'linea' ).
      length = incode->GET_LENGTH( ).
      do length times.
        outcode = incode->get_item( index = d_lines ).
        wa_linea = outcode->get_value( ).
        if wa_string is initial.
          wa_string = wa_linea.
        else.
          concatenate wa_string l_newline  l_linefeed crlf wa_linea into wa_string.
        endif.
        add 1 to d_lines.
      enddo.
      l_element_dummy  = l_document->create_simple_element(
                    name = 'Content'
                    VALUE = wa_string
                    parent = l_element_root  ).
    so...it's similar to your suggestion..
    Any other input, please?
    Regards,
    Carme.

Maybe you are looking for