Txt attachment

Where does txt attachment go when downloaded..  I have downloaded 3 and can not find them?

It is usually saved to a "download" folder. You can access the downloads through the "downloads app" or a "my files app" or a third party file explorer application from the Play Store.

Similar Messages

  • HAving issues in sending txt attachment in abap email pgm

    Hi,
        I need to send an email from my Abap program with a txt attachment in the flowing format:
    We are glad to see these results
    Kindly forward the details                                        Number
    Vendor details:123
    However, this is not getting formatted properly and the txt file is getting unnessacary spaces. I am working in ECC 6 and is Unicode complaint.
    I am not able to format this in the txt attachment.
    I am providing the sample code as below.Please kindly help me.Thanks!
    Creation of the document to be sent File Name
      maildata-obj_name = 'Payee extraction data'. "EC NOTEXT
    Mail Subject
      maildata-obj_descr = 'Payee Positive pay'. "EC NOTEXT
    Mail Contents
      loop at lt_file into l_file.
        mailtxt-line = l_file.
      xtex1-line = l_file.
      append xtex1.
        append mailtxt.
      endloop.
      clear:    mailpack, mailbin, mailhead.
      refresh:  mailpack, mailbin, mailhead.
      describe table mailtxt lines tab_lines.
      read table mailtxt index tab_lines.
      maildata-doc_size = ( tab_lines - 1 ) * 255 + strlen( mailtxt ).
    Creation of the entry for the compressed document
      clear mailpack-transf_bin.
      mailpack-head_start = 1.
      mailpack-head_num = 0.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
      mailpack-doc_type = 'RAW'.
      append mailpack.
      mailhead = 'PayeePositivepay.txt'.
      append mailhead.
    Mail Contents
      loop at lt_file into l_file.
        mailbin-line = l_file.
        append mailbin.
      endloop.
    break-point.
      describe table mailbin lines tab_lines.
      mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 1.
      mailpack-body_start = 1.
      mailpack-body_num = tab_lines.
      mailpack-doc_type = 'txt'.
      mailpack-obj_name = 'payee'.
      mailpack-obj_descr = 'Subject'. "EC NOTEXT
      mailpack-doc_size = tab_lines * 140.
      append mailpack.
    Get the neccessary email ids from the table
      SELECT * FROM ZFI_EMAILIDS INTO table I_ZFI_EMAILIDS.
      LOOP AT I_ZFI_emailids.
        mailrec-receiver = i_zfi_emailids-zemailid .
        mailrec-rec_type  = 'U'.
        mailrec-com_type = 'INT'.
        mailrec-notif_del = 'X'.
        mailrec-notif_ndel = 'X'.
        mailrec-express = 'X'.
        append mailrec.
      endloop.
    Sending the document
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = maildata
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = mailpack
          object_header              = mailhead
          contents_bin               = mailbin[]
          contents_txt               = mailtxt
         CONTENTS_HEX               = xtex
          receivers                  = mailrec
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          others                     = 99.
    endform.                    "send_email

    Hi,
    You need to use attribute CL_ABAP_CHAR_UTILITIES=> NEWLINE or CR to use format the mail contents.

  • Content coming as .txt attachment along with email but not in email body

    Hi,
    I have a proxy to email scenario. The requirement is to generate an excel sheet and keep it as an attachment and send it to user through email.
    I am able to get the excel sheet as an attachment in email but the content of email is also coming as attachment which I do not want.
    Problem area :
    ============================================
    The Content should come in Email body but it is coming as .txt attachment in email. The email body is blank.
    Can someone help as how I can get the content in email body.?
    /Regds
    Azahar

    Hi Azahar,
       May you can find the solution in the "
    Adapter-Specific Message Attributes
    Configuring the Receiver Mail Adapter (SAP Library - Partner Connectivity Kit)

  • E-mail body getting converted to .txt attachment

    Hello All,
    Below is the description of the issue: -
    1) Smartform is sent as .pdf attachment in the mail along with some text in the email body, using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    2) Initially, the entire process was working fine.
    3) However recently, there is a problem while sending the email. Whenever we are sending the email, the text in the email body is automatically converted into .txt attachment rather than being sent in email body.
    4) There are no code changes which are done, have verified that.
    5) I copy pasted the same code, in another system and the email is sent correctly with email body.
    So wanted to know the following  :-
    1) So is the conversion of email to .txt file due to some script running on the server / is this due to some configuration.
    2) If it is due to some configuration, then where is this configuration maintiained ?
    3) Anything which can be done on the ABAP side to control this ?
    Regards,
    Rinkesh Doshi

    Hello All,
    I have identified the root cause of this problem.
    The issue is due to the configuration maintained in transaction SODIS, which is the transaction to add disclosures to the outgoing emails.
    If the standard disclosure is activated over here, the original email body is sent as text attachment and the standard disclosure is added in the email body. If we deactivate this disclosure functionality, the process works perfectly fine.
    (This logic is included inside the class CL_SEND_REQUEST_BCS, method ADD_DISCLOSURE_TO_MIME).
    So is this standard functionality error ? I could not find SAP notes which are relevant in above context.
    Regards,
    Rinkesh Doshi

  • Fm to mail .txt attachment

    Hi.
       I need a FM to mail .txt attachment .Pls let me know with code.
    Kind regards,
    sami.

    Hi
    Refer This link
    Urgent - Sending mail with .txt attachment
    Ranga

  • TS3276 TXT attachment puzzle

    My local health centre sends me regular dosage instructions for medication I have to take.  They send an email with a .txt attachment.
    I can view this easily if I open the mail on my iPad.  I can view it if I access my ISP's webmail interface.  But if I open it through MacMail - IMAP connection (my preferred email channel) the attachment is unreadable.  The .txt file opens but presents a gobbledygook of alpha and numeric characters.
    Is it something in my settings I've missed?  Have been puzzling for weeks without being able to find an answer...

    Screenshots
    This is the email on my ipad...
    and this is what the attachment looks like when I click and open it (have edited out some personal info)
    The same email in Mac Mail (OSX 10.10.1) =
    And the attachment looks like this when opened (txt editor or word or anything...)
    Any ideas welcomed

  • Mail is sending the body of my email as a .txt attachment

    I have a serious problem when I send out an ordinary email, with no attachment. The first line appears as it should.."Dear whoever", and after that the email is blank. This makes me look rather stupid, but if the recipient checks the .txt attachment, they understand my message because the body of text has been punted into an attachment for some reason. I've had this feedback from several people. I use multiple email accounts in mail and I've had the same feedback for different accounts on separate domains. The message appears correct in my sent items, so I have absolutely no way of know that this has happened until the recipient tells me. It seems to be intermittent or not happening in every case.
    I would be so pleased if anyone could help me out with this one?

    Greetings,
    Mail doesn't create .txt files from email messages; it sends exactly what you type. If some of your recipients are claiming they receive .txt files, that would most likely be due to their email client, which no doubt is running Windoze. Only they can solve that problem. If the message is okay in your Sent mailbox, that's exactly what you sent, so the problem is on their end.

  • Problems with txt attachment in the mail

    Hi,
    I noticed a big problem for the mail in mac os x. Every time I received my txt format data file in attachment with email, it automatically displayed at the end of my email in the Mail instead of remaining as a txt attachment file ready for download. How can I set it to stay as an attachment instead of being forced to show up as plain text in the end of my received email? Thanks.

    Hi,
    I noticed a big problem for the mail in mac os x. Every time I received my txt format data file in attachment with email, it automatically displayed at the end of my email in the Mail instead of remaining as a txt attachment file ready for download. How can I set it to stay as an attachment instead of being forced to show up as plain text in the end of my received email? Thanks.

  • How to send a mail as .txt attachment ,As data is seperated by pipeline

    Hi ,
    I got a requirement to send a mail in .txt format (Using OOPS) and the data inside the mail is seperated by '|'  Pls help me in this regard.
    i have written a mail to send the mail in .xls it is working fine for me in .xls but i dont know how to write the same for txt where data should be seperated by '|'.
    Regards
    sas
    Ps:  i am attaching my code. and please specify where i need to modify to achieve the same. and any perfromance enhacements are also welcome.
    *& Report  ZGBTEST02
    REPORT  YSAS_MAIL2.
    *Changes done by sas
    *PARAMETERS: P_MAIL TYPE AD_SMTPADR OBLIGATORY, " G C by sas
    *P_MAIL1 TYPE AD_SMTPADR OBLIGATORY." G by sas
    tables: adr6.
    SELECT-OPTIONS:p_eaddr FOR adr6-SMTP_ADDR NO INTERVALS .
    *end of changes by sas
    DATA: I_GLT0 TYPE STANDARD TABLE OF GLT0.
    DATA: I_MARA  TYPE STANDARD TABLE OF MARA.  " MARA Entries
    *      I_MARC  TYPE STANDARD TABLE OF MARC.  " MARC Entries
    DATA: L_TEXT  TYPE CHAR255.  " Text
    DATA: L_LINES TYPE I,
          L_SIZE  TYPE SOOD-OBJLEN.
    " Size of Attachment
    * Mail related
    DATA: I_CONTENT         TYPE   SOLI_TAB, " Mail content
          I_ATTACH          TYPE   SOLI_TAB, " Attachment
          I_ATTACH1         TYPE   SOLIX_TAB. " Attachment
    DATA: L_SEND_REQUEST    TYPE REF TO    CL_BCS,
                                                " E-Mail Send Request
          L_DOCUMENT        TYPE REF TO    CL_DOCUMENT_BCS,
                                                " E-Mail Attachment
          L_RECIPIENT       TYPE REF TO    IF_RECIPIENT_BCS,
                                                " Distribution List
          L_SENDER          TYPE REF TO    IF_SENDER_BCS,
                                                " Address of Sender
          L_UNAME           TYPE           SALRTDRCPT,
                                                " Sender Name(SY-UNAME)
          L_BCS_EXCEPTION   TYPE REF TO    CX_DOCUMENT_BCS,
                                                " BCS Exception
          L_ADDR_EXCEPTION  TYPE REF TO    CX_ADDRESS_BCS,
                                                " Address Exception
          L_SEND_EXCEPTION  TYPE REF TO    CX_SEND_REQ_BCS.
    " E-Mail sending Exception
    *Constants------------------------------------------------------------*
    CONSTANTS: C_TAB(1) TYPE C VALUE
               CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
                                         " Tab Character
               C_CR(1)  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF,
                                         " Line Feed for End-Of_line
               C_EXT    TYPE SOODK-OBJTP VALUE 'XLS'. " XLS Extension
    START-OF-SELECTION.
      SELECT * FROM MARA INTO TABLE I_MARA UP TO 20 ROWS.
      IF SYST-SUBRC EQ 0.
    *    SELECT * FROM MARC INTO TABLE I_MARC FOR ALL ENTRIES IN I_MARA WHERE MATNR = I_MARA-MATNR.
      ENDIF.
    *select * from glt0 into table i_glt0.
    * Preparing body of the Mail
      MOVE 'SAP Material Master Records' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      CLEAR L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE 'Thanks,' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE 'SAP MM' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
    * Creates persistent send request
      TRY.
          L_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
    * Creating Document
          L_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                                        I_TYPE  = 'RAW'
                                        I_TEXT  = I_CONTENT[]
                                        I_SUBJECT = 'SAS MASTER Records' ).
    * Preparing contents of attachment with Change Log
          PERFORM PREPARE_ATTACHMENT.
          DESCRIBE TABLE I_MARA LINES L_LINES.
    * Size to multiplied by 2 for UNICODE enabled systems
          L_SIZE = L_LINES * 2 * 255.
    * Adding Attachment
          CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
            EXPORTING
              I_ATTACHMENT_TYPE    = C_EXT
              I_ATTACHMENT_SIZE    = L_SIZE
              I_ATTACHMENT_SUBJECT = 'MARA Details'
    *          i_att_content_hex    = i_attach[].
              I_ATT_CONTENT_TEXT   = I_ATTACH[].
    *      DESCRIBE TABLE I_MARC LINES L_LINES.
    * Size to multiplied by 2 for UNICODE enabled systems
    *      L_SIZE = L_LINES * 2 * 255.
    ** Adding Attachment
    *      CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
    *        EXPORTING
    *          I_ATTACHMENT_TYPE    = C_EXT
    *          I_ATTACHMENT_SIZE    = L_SIZE
    *          I_ATTACHMENT_SUBJECT = 'MARC Details'
    *          I_ATT_CONTENT_HEX    = I_ATTACH1[].
    **          i_att_content_text   = i_attach1[].
    * Add document to send request
          CALL METHOD L_SEND_REQUEST->SET_DOCUMENT( L_DOCUMENT ).
          DATA:LR_SENDER TYPE REF TO IF_SENDER_BCS,
               LR_SEND TYPE REF TO CL_BCS.
    * Preparing the sender object
    *      LR_SENDER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( sy-uname ).
           DATA: L1_UNAME TYPE SY-UNAME.
           L1_UNAME = SY-UNAME.
           LR_SENDER = CL_SAPUSER_BCS=>CREATE( L1_UNAME ).
    * Setting the sender
          CALL METHOD L_SEND_REQUEST->SET_SENDER
            EXPORTING
              I_SENDER = LR_SENDER.
    * E-Mail
       LOOP AT P_EADDR.
          TRANSLATE P_EADDR-LOW TO LOWER CASE.
          L_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_EADDR-LOW ).
          CALL METHOD L_SEND_REQUEST->ADD_RECIPIENT
            EXPORTING
              I_RECIPIENT  = L_RECIPIENT
              I_EXPRESS    = 'U'
              I_COPY       = ' '
              I_BLIND_COPY = ' '
              I_NO_FORWARD = ' '.
           IF SY-subrc EQ 0.
              WRITE:/'** SUCCESS:  Email Sent to', p_eaddr-LOW COLOR COL_NORMAL.
            ELSE.
              WRITE:/'** ERROR: Failed to send Email to',p_eaddr-LOW COLOR COL_NEGATIVE .
            ENDIF.
          ENDLOOP.
    *Trigger E-Mail immediately
          L_SEND_REQUEST->SET_SEND_IMMEDIATELY( ' ' ).
          CALL METHOD L_SEND_REQUEST->SEND( ).
          COMMIT WORK.
        CATCH CX_DOCUMENT_BCS INTO L_BCS_EXCEPTION.
        CATCH CX_SEND_REQ_BCS INTO L_SEND_EXCEPTION.
        CATCH CX_ADDRESS_BCS  INTO L_ADDR_EXCEPTION.
      ENDTRY.
    *&      Form  PREPARE_ATTACHMENT
    FORM PREPARE_ATTACHMENT .
      FIELD-SYMBOLS: <LFS_TABLE>,    " Internal table structure
                     <LFS_CON>.      " Field Content
      DATA: L_TEXT TYPE CHAR1024.     " Text content for mail attachment
      DATA: L_CON TYPE STRING. "(50) TYPE c.        " Field Content in character format
      DATA: L_STR TYPE STRING,
            L_STR1 TYPE STRING.
      DATA: LS_SOLIX TYPE SOLIX.
    * Columns to be tab delimeted
      LOOP AT I_MARA ASSIGNING <LFS_TABLE>.
        DO.
          ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LFS_TABLE>
                 TO <LFS_CON>.
          IF SY-SUBRC NE 0.
            CONCATENATE C_CR L_TEXT INTO L_TEXT.
    *        CONCATENATE l_str c_cr l_text INTO l_str.
    *        ls_solix-line = l_text.
    *        APPEND ls_solix TO i_attach.
            APPEND L_TEXT TO I_ATTACH.
            EXIT.
          ELSE.
            CLEAR: L_CON.
            MOVE <LFS_CON> TO L_CON.
            CONDENSE L_CON.
            IF SY-INDEX = 1.
              CLEAR: L_TEXT.
              MOVE L_CON TO L_TEXT.
            ELSE.
              CONCATENATE L_TEXT L_CON INTO L_TEXT
                 SEPARATED BY C_TAB.
            ENDIF.
          ENDIF.
        ENDDO.
      ENDLOOP.
    ** Columns to be tab delimeted
    *  LOOP AT I_MARC ASSIGNING <LFS_TABLE>.
    *    DO.
    *      ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LFS_TABLE>
    *             TO <LFS_CON>.
    *      IF SY-SUBRC NE 0.
    *        CONCATENATE C_CR L_TEXT INTO L_TEXT.
    **        CONCATENATE l_str c_cr l_text INTO l_str1.
    *        LS_SOLIX-LINE = L_TEXT.
    *        APPEND LS_SOLIX TO I_ATTACH1.
    *        EXIT.
    *      ELSE.
    *        CLEAR: L_CON.
    *        MOVE <LFS_CON> TO L_CON.
    *        CONDENSE L_CON.
    *        IF SY-INDEX = 1.
    *          CLEAR: L_TEXT.
    *          MOVE L_CON TO L_TEXT.
    *        ELSE.
    *          CONCATENATE L_TEXT L_CON INTO L_TEXT
    *             SEPARATED BY C_TAB.
    *        ENDIF.
    *      ENDIF.
    *    ENDDO.
    *  ENDLOOP.
    *  i_attach1[] = i_attach[].
    ENDFORM.                    " PREPARE_ATTACHMENT

    Hi Sas,
    I have copied the code and executed and it is working fine. I'm getting the text attachement in the email.
    * Adding Attachment
          CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
            EXPORTING
              I_ATTACHMENT_TYPE    = 'TXT'          "  C_EXT   My change
              I_ATTACHMENT_SIZE    = L_SIZE
              I_ATTACHMENT_SUBJECT = 'MARA Details'
    *          i_att_content_hex    = i_attach[].
              I_ATT_CONTENT_TEXT   = I_ATTACH[].
    CONCATENATE i_mara-MATNR
                             i_mara-ERSDA
                             i_mara-ERNAM
                             i_mara-LAEDA
                   INTO   L_TEXT
                 SEPARATED BY '|'.

  • How to send a mail as .txt attachment ?

    Hi all,
    I got a requirement to write code for sending mail in oops.
    i have written code for .xls which is working fine. But requirement is to send the mail in the format of txt.
    i just only chnge the .xls to .txt where i can see the output properly in sap but problem is that i am unable to get the proper alignment. when i execute the report and see the output in sost i can see the attachment.i am downloading the attachment there only(Our server is not configured to get the mails directly) .So when i open the saved text file on my pc the output is appearing as follows...
    pernr nachn vorna
            0001 L0001 F0001
                0002 L0002 F0002
                   0003 L0003 F0003
                         0004 L0004 F0004...
    Where it should come in straight line as follows in my o/p code..
    pernr nachn vorna
    0001 L0001 F0001
    0002 L0002 F0002
    0003 L0003 F0003
    0004 L0004 F0004...
    i am puttin g my code ..please correct me where i am wrong .....waiting for your valuabel inputs..
    *& Report  ZGBTEST02
    REPORT  YSAS_MAIL2.
    *Changes done by sas
    *PARAMETERS: P_MAIL TYPE AD_SMTPADR OBLIGATORY, " G C by sas
    *P_MAIL1 TYPE AD_SMTPADR OBLIGATORY." G by sas
    TABLES: ADR6.
    SELECT-OPTIONS:P_EADDR FOR ADR6-SMTP_ADDR NO INTERVALS .
    *end of changes by sas
    DATA: I_GLT0 TYPE STANDARD TABLE OF GLT0.
    *DATA: I_pernr  TYPE STANDARD TABLE OF pa0002.  " MARA Entries
    DATA: BEGIN OF I_PERNR OCCURS 1 ,
    PERNR TYPE PA0002-PERNR,
    NACHN TYPE PA0002-NACHN,
    VORNA TYPE PA0002-VORNA,
    END OF I_PERNR..
    *      I_MARC  TYPE STANDARD TABLE OF MARC.  " MARC Entries
    DATA: L_TEXT  TYPE CHAR255.  " Text
    DATA: L_LINES TYPE I,
          L_SIZE  TYPE SOOD-OBJLEN.
    " Size of Attachment
    * Mail related
    DATA: I_CONTENT         TYPE   SOLI_TAB, " Mail content
          I_ATTACH          TYPE   SOLI_TAB, " Attachment
          I_ATTACH1         TYPE   SOLIX_TAB. " Attachment
    DATA: L_SEND_REQUEST    TYPE REF TO    CL_BCS,
                                                " E-Mail Send Request
          L_DOCUMENT        TYPE REF TO    CL_DOCUMENT_BCS,
                                                " E-Mail Attachment
          L_RECIPIENT       TYPE REF TO    IF_RECIPIENT_BCS,
                                                " Distribution List
          L_SENDER          TYPE REF TO    IF_SENDER_BCS,
                                                " Address of Sender
          L_UNAME           TYPE           SALRTDRCPT,
                                                " Sender Name(SY-UNAME)
          L_BCS_EXCEPTION   TYPE REF TO    CX_DOCUMENT_BCS,
                                                " BCS Exception
          L_ADDR_EXCEPTION  TYPE REF TO    CX_ADDRESS_BCS,
                                                " Address Exception
          L_SEND_EXCEPTION  TYPE REF TO    CX_SEND_REQ_BCS.
    " E-Mail sending Exception
    *Constants------------------------------------------------------------*
    CONSTANTS: C_TAB(1) TYPE C VALUE
               CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
                                         " Tab Character
               C_CR(1)  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF,
                                         " Line Feed for End-Of_line
               C_EXT    TYPE SOODK-OBJTP VALUE 'TXT'. " XLS Extension
    START-OF-SELECTION.
      SELECT PERNR NACHN VORNA  FROM PA0002 INTO CORRESPONDING FIELDS OF TABLE I_PERNR UP TO 20 ROWS.
    *select * from glt0 into table i_glt0.
    * Preparing body of the Mail
    *  MOVE 'SAP Material Master Records' TO L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
    *  CLEAR L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
    *  MOVE 'Thanks,' TO L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
    *  MOVE 'SAP MM' TO L_TEXT.
    *  APPEND L_TEXT TO I_CONTENT.
      MOVE '<BR>Attached is your HRIS report(s) generated from the Firm''s' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE ' Human Resources  Information System (SAP).' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE '<BR>  ' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
      MOVE '<BR>This is an automated report.' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
    *        MOVE '<BR>  ' TO l_text.
    *        APPEND l_text TO i_content.
      MOVE '<BR>  ' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
    *        MOVE '<BR>Please do not reply to this email' TO l_text.
    *        APPEND l_text TO i_content.
    *        MOVE '<BR>  ' TO l_text.
    *        APPEND l_text TO i_content.
      MOVE '<BR>Thank you.' TO L_TEXT.
      APPEND L_TEXT TO I_CONTENT.
    * Creates persistent send request
      TRY.
          L_SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
    * Creating Document
          L_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
                                        I_TYPE  = 'RAW'
                                        I_TEXT  = I_CONTENT[]
                                        I_SUBJECT = 'Automated HRIS (SAP) Report' ).
    DATA: W_PERNR LIKE I_PERNR.
    * Preparing contents of attachment with Change Log
          PERFORM PREPARE_ATTACHMENT.
          DATA: compressed like solisti1 occurs 10 with header line.
    DATA: decompressed like solisti1 occurs 10 with header line.
          CALL FUNCTION 'TABLE_COMPRESS'
    *   IMPORTING
    *     COMPRESSED_SIZE       =
                        TABLES
    *      in                    = eerec
                          in                    = i_attach
                          out                   = compressed.
          CALL FUNCTION 'TABLE_DECOMPRESS'
            TABLES
              in  = compressed
              out = decompressed.
          DESCRIBE TABLE decompressed LINES L_LINES.
    * Size to multiplied by 2 for UNICODE enabled systems
          L_SIZE = L_LINES * 2 * 255.
    * Adding Attachment
          CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
            EXPORTING
              I_ATTACHMENT_TYPE    = C_EXT
              I_ATTACHMENT_SIZE    = L_SIZE
              I_ATTACHMENT_SUBJECT = 'Hr Details'
    *          i_att_content_hex    = i_attach[].
              I_ATT_CONTENT_TEXT   = decompressed[].
    *      DESCRIBE TABLE I_MARC LINES L_LINES.
    * Size to multiplied by 2 for UNICODE enabled systems
    *      L_SIZE = L_LINES * 2 * 255.
    ** Adding Attachment
    *      CALL METHOD L_DOCUMENT->ADD_ATTACHMENT
    *        EXPORTING
    *          I_ATTACHMENT_TYPE    = C_EXT
    *          I_ATTACHMENT_SIZE    = L_SIZE
    *          I_ATTACHMENT_SUBJECT = 'MARC Details'
    *          I_ATT_CONTENT_HEX    = I_ATTACH1[].
    **          i_att_content_text   = i_attach1[].
    * Add document to send request
          CALL METHOD L_SEND_REQUEST->SET_DOCUMENT( L_DOCUMENT ).
          DATA:LR_SENDER TYPE REF TO IF_SENDER_BCS,
               LR_SEND TYPE REF TO CL_BCS.
    * Preparing the sender object
    *      LR_SENDER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( sy-uname ).
          DATA: L1_UNAME TYPE SY-UNAME.
          L1_UNAME = SY-UNAME.
          LR_SENDER = CL_SAPUSER_BCS=>CREATE( L1_UNAME ).
    * Setting the sender
          CALL METHOD L_SEND_REQUEST->SET_SENDER
            EXPORTING
              I_SENDER = LR_SENDER.
    * E-Mail
          LOOP AT P_EADDR.
            TRANSLATE P_EADDR-LOW TO LOWER CASE.
            L_RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_EADDR-LOW ).
            CALL METHOD L_SEND_REQUEST->ADD_RECIPIENT
              EXPORTING
                I_RECIPIENT  = L_RECIPIENT
                I_EXPRESS    = 'U'
                I_COPY       = ' '
                I_BLIND_COPY = ' '
                I_NO_FORWARD = ' '.
            IF SY-SUBRC EQ 0.
              WRITE:/'** SUCCESS:  Email Sent to', P_EADDR-LOW COLOR COL_NORMAL.
            ELSE.
              WRITE:/'** ERROR: Failed to send Email to',P_EADDR-LOW COLOR COL_NEGATIVE .
            ENDIF.
          ENDLOOP.
    *Trigger E-Mail immediately
          L_SEND_REQUEST->SET_SEND_IMMEDIATELY( ' ' ).
          CALL METHOD L_SEND_REQUEST->SEND( ).
          COMMIT WORK.
        CATCH CX_DOCUMENT_BCS INTO L_BCS_EXCEPTION.
        CATCH CX_SEND_REQ_BCS INTO L_SEND_EXCEPTION.
        CATCH CX_ADDRESS_BCS  INTO L_ADDR_EXCEPTION.
      ENDTRY.
    *&      Form  PREPARE_ATTACHMENT
    FORM PREPARE_ATTACHMENT .
      FIELD-SYMBOLS: <LFS_TABLE>,    " Internal table structure
                     <LFS_CON>.      " Field Content
      DATA: L_TEXT TYPE CHAR1024.     " Text content for mail attachment
      DATA: L_CON TYPE STRING. "(50) TYPE c.        " Field Content in character format
      DATA: L_STR TYPE STRING,
            L_STR1 TYPE STRING.
    *data: w_pernr type TABLE OF I_PERNR.
      DATA: LS_SOLIX TYPE SOLIX.
    *  CONCATENATE 'PERNR' 'FIRST NAME' 'Last Name' C_CR INTO L_TEXT SEPARATED BY '|'.
    *  append l_text to i_attach.
    *  clear l_text.
    * Columns to be tab delimeted
      LOOP AT I_PERNR ASSIGNING <LFS_TABLE>.
        DO.
          ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LFS_TABLE>
                 TO <LFS_CON>.
          IF SY-SUBRC NE 0.
            CONCATENATE C_CR L_TEXT INTO L_TEXT.
    *        CONCATENATE l_str c_cr l_text INTO l_str.
    *        ls_solix-line = l_text.
    *        APPEND ls_solix TO i_attach.
            APPEND L_TEXT TO I_ATTACH.
            EXIT.
          ELSE.
            CLEAR: L_CON.
            MOVE <LFS_CON> TO L_CON.
            CONDENSE L_CON.
            IF SY-INDEX = 1.
              CLEAR: L_TEXT.
              MOVE L_CON TO L_TEXT.
            ELSE.
              CONCATENATE L_TEXT L_CON INTO L_TEXT
                 SEPARATED BY C_TAB.
            ENDIF.
          ENDIF.
        ENDDO.
      ENDLOOP.
    *  i_attach1[] = i_attach[].
    ENDFORM.                    " PREPARE_ATTACHMENT
    Please if any one having 6.0 version please upload it and see..
    Regards
    Sas

    Hi ,
    Did you downloaded from  SOST  using the display icon and inside that 4th tab for attachment ....
    and see?
    Regards
    sas
    pS: THE FIRST page is not allowing the spaces in sdn...
    i am getting o/p as
    pernr vochn norna
    .........0001 f0001 l0001
    .................0002 F0002 L0002
    .......................0003 F0003 L0003.....
    Please remove dots and understand that is the o/p i am getting in my presenation file
    i just expecting the o/p as told earlier..
    Regards
    sas

  • Urgent - Sending mail with .txt attachment

    Hi
    I am having all the required data to be sent as attachment (.txt) in an internal table.  How do I attach this data to the mail by using the FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Regards,
    Vijay

    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
    <b>
    Then include that report in the following report and copy the same code and paste it there </b>
    *& 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

  • Text alignment issue in File(TXT) attachement as an Email

    Hi Friends,
    I have searched many threads for sending the internal table data in a TXT (notepad file)file as an attachement,but i could find the answer or that could not solve my problem.
    Internal table data.
    name:XYZ
    Age : 21,
    Place:Hyd,
    Country:US.
    While sending the in file attachemnt,I do not see as I expcted.It comes as below.
    Second record starts below first record,but after the last latter of the first record with a blank line before it,in the same way third and fouth and so on.
    a g e : X Y Z
                a g e  : 2 1
                           P l a c e  : H Y D
                                           C o u n t r y .
    below as my code.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
       EXPORTING
      LINE_WIDTH_SRC                    =
          line_width_dst                    = '255'
      TRANSFER_BIN                      = ' '
        TABLES
          content_in                        = itw_msg
          content_out                       = t_msg
       EXCEPTIONS
         err_line_width_src_too_long       = 1
         err_line_width_dst_too_long       = 2
         err_conv_failed                   = 3
         OTHERS                            = 4
      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:wa_document_data   TYPE sodocchgi1.
      DATA:it_pdf             TYPE TABLE OF solisti1,
             it_body_msg        TYPE STANDARD TABLE OF solisti1,
             it_packing_list    TYPE TABLE OF sopcklsti1,
             it_receivers       TYPE TABLE OF somlreci1,
             wa_body_msg        TYPE solisti1,
             wa_packing_list    TYPE sopcklsti1,
             wa_receivers       TYPE somlreci1,
             wa_attachment      TYPE solisti1,
             wa_pdf             TYPE solisti1,
             gv_tab_lines       TYPE i,
             gv_sent_to_all     TYPE sonv-flag,
             t_pdfdata          TYPE TABLE OF tline,
             pdf_data           TYPE xstring,
                wa_msg_text        TYPE string.
      wa_document_data-obj_name = 'MAIL_TO_HEAD'.
      wa_document_data-obj_descr = 'Email Subject'.
      wa_document_data-obj_langu = sy-langu.
      DESCRIBE TABLE itw_msg LINES wa_packing_list-body_num.
      wa_document_data-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( wa_attachment ).
      wa_packing_list-head_start = 1.
      wa_packing_list-head_num = 0.
      wa_packing_list-body_start = 1.
      wa_packing_list-body_num = gv_tab_lines.
      wa_packing_list-doc_type = 'ASC'.
      APPEND wa_packing_list TO it_packing_list.
      CLEAR wa_packing_list.
    WRITE PACKING LIST FOR ATTACHMENT
      wa_packing_list-transf_bin = 'X'.
      wa_packing_list-head_start = 1.
      wa_packing_list-head_num = 1.
      wa_packing_list-body_start = 1.
      DESCRIBE TABLE t_msg LINES wa_packing_list-body_num.
      wa_packing_list-doc_type = 'TXT'.
      wa_packing_list-obj_name = 'TEST_FILE'.
      wa_packing_list-obj_descr = 'TEST_FILE'.
      wa_packing_list-doc_size = wa_packing_list-body_num * 255.
      APPEND wa_packing_list TO it_packing_list.
      CLEAR wa_packing_list.
    *Receiver List table population.
    data:contents_txt type SOLISTI1.
    Call the Function Module to send the message to External and SAP Inbox
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_document_data
          put_in_outbox              = 'X'
          commit_work                = 'X'
        IMPORTING
          sent_to_all                = gv_sent_to_all
        TABLES
          packing_list               = it_packing_list
          contents_txt               = t_msg "it_body_msg
         contents_bin               =
          receivers                  = it_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.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Do I need concatenate the internal table data with something,some value like 'ODA' etc.Please help me.
    I am working on the issue for last two days,but could not solve.
    Regards,
    Xavier.P
    Edited by: Xavier on Dec 22, 2011 5:02 AM
    Edited by: Xavier on Dec 22, 2011 5:05 AM

    Hi,
    pass like below
    wa_packing_list-trans_bin =  space .               <----
    wa_packing_list-head_start = 1.
    wa_packing_list-head_num = 0.
    wa_packing_list-body_start = 1.
    wa_packing_list-body_num = gv_tab_lines.
    wa_packing_list-doc_type = 'RAW'.                     <----
    Regards,
    Ravi

  • Content in .txt attachment

    Hello Everyone,
    I need to send some internal table data to the user decision as an attachment in TEXT format(.TXT). The attachment should consist of header, body (itab data in tab format) and a footer.
    Presently i am able to send the mail with attachment, but the data in the notepad is not coming in a correct format.The data has been messed up and randomly distributed....Could any one suggest me how to convert internal table data to text file format..
    Can anybody refer me some sample examples of it...
    Thanks in advance,
    Sangeeta

    Report ZFILE_APPSERVER is used to upload the file & to trigger the workflow. BO "ZFS1" is the customized business.
    Method "attachdoc" is created for attachment to workitem.
    REPORT  ZFILE_APPSERVER.
    *INCLUDE <CNTAIN>.
    INCLUDE <CNTN01>.
    DATA: BEGIN OF l_filedata OCCURS 0,
            text(200) TYPE c,
          END OF l_filedata.
    DATA: BEGIN OF l_readdata OCCURS 0,
            text(200)    TYPE c,
          END OF l_readdata.
    DATA: L_READDATA1 TYPE ZFILE_DATA1 with header line.
    DATA: BEGIN OF l_read_bin OCCURS 0,
            buffer type xstring,
          END OF l_read_bin.
    DATA: LENG TYPE I,
          ZVAR1 TYPE I VALUE 0.
    DATA:  v_filepath     type rlgrap-filename VALUE '/usr/iffsap/data/test/workflow/new.txt'.
    DATA myref    TYPE REF TO CX_SY_FILE_OPEN_MODE.
    DATA err_text TYPE string.
    DATA: OBJECT TYPE swc_object,
          OBJKEY TYPE SWR_STRUCT-OBJECT_KEY,
          IT_AGENTS TYPE SWHACTOR OCCURS 0,
          GV_INITIATOR LIKE SWWWIHEAD-WI_CREATOR.
    SWC_CONTAINER CONTAINER.             "Declaration
    SWC_CREATE_CONTAINER CONTAINER.      "Initialization
    SWC_CREATE_OBJECT OBJECT 'ZFBS1' 'ZUNAME'.
    DATA: BEGIN OF CONTAINER OCCURS 0.
         INCLUDE STRUCTURE SWCONT.
    DATA: END OF CONTAINER.
    SELECT-OPTIONS / PARAMETERS                                          *
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file  LIKE rlgrap-filename
                        DEFAULT 'd:\data'.
    SELECTION-SCREEN END OF BLOCK blk1.
    AT SELECTION-SCREEN                                                  *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        CHANGING
          file_name = p_file.
    START-OF-SELECTION.
    Perform file_upload.
    try.
    OPEN DATASET V_FILEPATH FOR output IN TEXT MODE ENCODING DEFAULT.
    CATCH cx_sy_file_open_mode INTO myref.
          err_text = myref->get_text( ).
    ENDTRY.
    if sy-subrc = 0.
    Loop at l_filedata.
    TRANSFER L_FILEDATA TO V_FILEPATH.
    endloop.
    endif.
    CLOSE DATASET V_FILEPATH.
    if sy-subrc = 0.
    write: 'File uploaded successfully'.
    endif.
    OPEN DATASET V_FILEPATH FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    *OPEN DATASET V_FILEPATH FOR INPUT IN BINARY MODE.
    DO.
    READ DATASET V_FILEPATH INTO l_readdata LENGTH LENG.
      append l_readdata.
    ZVAR1 = ZVAR1 + LENG.
    WRITE: ZVAR1.
    IF SY-SUBRC <> 0.
    EXIT.
    ENDIF.
    ENDDO.
    CLOSE DATASET V_FILEPATH.
    IF SY-SUBRC = 0 AND NOT L_READDATA[] IS INITIAL.
    SWC_SET_TABLE CONTAINER 'L_READDATA' L_READDATA.
    SWC_SET_ELEMENT CONTAINER 'ZVAR1' ZVAR1.
    SWC_SET_ELEMENT CONTAINER 'ZFBS1' OBJECT.
    GV_INITIATOR = SY-UNAME.
    CALL FUNCTION 'SWW_WI_START_SIMPLE'
      EXPORTING
       CREATOR                             = GV_INITIATOR
      PRIORITY                           = SWFCO_NO_PRIO
        TASK                               = 'WS90600147'
       CALLED_IN_BACKGROUND                = 'X'
      DEADLINE_DATA                      = ' '
      NO_DEADLINE_PARAMETERS             = ' '
    IMPORTING
      WI_ID                              =
      WI_HEADER                          =
      RETURN                             =
      WI_RESULT                          =
      SWF_RETURN                         =
      TABLES
        AGENTS                             = IT_AGENTS
      DEADLINE_AGENTS                    =
      DESIRED_END_AGENTS                 =
      LATEST_START_AGENTS                =
      EXCLUDED_AGENTS                    =
      NOTIFICATION_AGENTS                =
      SECONDARY_METHODS                  =
       WI_CONTAINER                        = CONTAINER.
    CHANGING
      WI_CONTAINER_HANDLE                =
    EXCEPTIONS
      ID_NOT_CREATED                     = 1
      READ_FAILED                        = 2
      IMMEDIATE_START_NOT_POSSIBLE       = 3
      EXECUTION_FAILED                   = 4
      INVALID_STATUS                     = 5
      OTHERS                             = 6
    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.
    ENDIF.
    FORM file_upload .
      DATA: l_filename TYPE string.
      l_filename := p_file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = l_filename
         has_field_separator     = ' '
         has_field_separator     = 'X'  "file is TAB delimited
        TABLES
          data_tab                = l_filedata.
       EXCEPTIONS
    ENDFORM.                    " file_upload
    BEGIN_METHOD ATTACHDOC CHANGING CONTAINER.
    DATA: L_READDATA TYPE ZFILE_DATA1 with header line,
          ZSWR_ATT_ID LIKE SWR_ATT_ID,
          ZSWR_ATT_HEADER TYPE SWR_ATT_HEADER,
          WORKITEMID LIKE SWR_STRUCT-WORKITEMID,
          ZXSTRING TYPE XSTRING,
          ZSTRING TYPE STRING,
          ZVAR1 TYPE I,
          ZLEN TYPE I,
          SOFM TYPE SWC_OBJECT.
    SWC_GET_TABLE CONTAINER 'L_READDATA' L_READDATA[].
    SWC_GET_ELEMENT CONTAINER 'WORKITEMID' WORKITEMID.
    SWC_GET_ELEMENT CONTAINER 'ZVAR1' ZVAR1.
    CALL FUNCTION 'SCMS_BINARY_TO_STRING'
      EXPORTING
        INPUT_LENGTH        = 9000
        FIRST_LINE          = 0
        LAST_LINE           = 6
      MIMETYPE            = ' '
      ENCODING            =
      IMPORTING
        TEXT_BUFFER         = ZSTRING
      OUTPUT_LENGTH       =
      TABLES
        BINARY_TAB          = l_readdata
    EXCEPTIONS
      FAILED              = 1
      OTHERS              = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBE
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3
    ENDIF.
    TO FILL THE HEARDER CONTENTS
    ZSWR_ATT_HEADER-FILE_TYPE = 'T'.
    ZSWR_ATT_HEADER-FILE_NAME = 'ACCRUAL'.
    ZSWR_ATT_HEADER-FILE_EXTENSION = 'EXC'.
    ZSWR_ATT_HEADER-LANGUAGE = 'EN'.
    CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
      EXPORTING
        WORKITEM_ID          = WORKITEMID
        ATT_HEADER           = ZSWR_ATT_HEADER
       ATT_TXT              = ZSTRING
      ATT_BIN              = ZXSTRING
      DOCUMENT_OWNER       = SY-UNAME
      LANGUAGE             = SY-LANGU
      DO_COMMIT            = 'X'
      IMPORTING
      RETURN_CODE          =
        ATT_ID               = ZSWR_ATT_ID
    TABLES
      MESSAGE_LINES        =
      MESSAGE_STRUCT       =
    SWC_SET_ELEMENT CONTAINER 'ZSWR_ATT_ID' ZSWR_ATT_ID.
    SWC_SET_ELEMENT CONTAINER 'SOFM' ZSWR_ATT_ID-DOC_ID.
    END_METHOD.
    Thanks & Regards,
    Sangeeta
    Edited by: sangeeta tahiliani on Dec 1, 2009 1:27 PM

  • TXT attachment alignment error

    Hi,
    creating an attachment in .txt format..
    used CONCATENATE con_cret it_attach into it_attach.
            CONDENSE it_attach.
            APPEND it_attach.
    to append the data to internal table...
    If i Checkin SBWP---output is good but not in mail attachment...
    in attachment file every other line is coming after 255 characters
    aaaa...........................bb
    cc............................dd
    if i see in word wrap
    aaaa
             bb
                    cc
                             dd
    Needed output is as below:
    aaaa
    bbb
    ccc
    ddd
    Does my delimiter have any error?

    Hi guys,
    I got the solution with the following statement
    CONCATENATE  it_attach con_cret into it_attach.

  • .txt attachment hidden in Email

    iphone is on IOS 7.1.2 and some .txt file attachments seem to get hidden in the emails. The same email viewed in outlook on a pc shows the .txt without issue.
    Is this an IOS bug or why is the phone hiding the attachment? It seems to think the file is a system file or something like that doesn't make any sense.
    Any help would be awesome thanks.

    Hi all.
    I have a user (company secretary) who keeps trying to send emails with large attachments 30mb+ and then moans when they can't be delivered due to size restrictions. 
    I keep explaining to him about the size of the attachments and either split them into smaller files and send in separate emails or add them to a dropbox and email the link. He does neither and expects me to sort out the issue at silly o'clock in the early hours every time. Just because he doesn't sleep he thinks no one else should either!
    Anyway enough about my rant  - what is the maximum size that you allow for send and receive in email. Maybe we could all join forces and try to set a unofficial standard!
    This topic first appeared in the Spiceworks Community

Maybe you are looking for