How  to send text file as an attachment to exteral mail

hi ,
Can any one tell me how to send an internal table as a textfile attachment  to the external mail.
regards
kishore

hi,
i am assuming txt fie attachment means you want notepad attachment
recently i struggled on this and i achieved success by doing as below
remember to keep packlist as RAW type like below:
t_packing_list-doc_type = 'RAW'.
do like this
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
    EXPORTING
      ip_solitab        = t_attachment[]
   IMPORTING
     EP_SOLIXTAB       = xtext[].
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data                    = w_doc_data
     PUT_IN_OUTBOX                    = 'X'
    COMMIT_WORK                      = 'X'
    tables
      packing_list                     = t_packing_list
    OBJECT_HEADER                    =
    CONTENTS_BIN                     = objbin
     CONTENTS_TXT                     = it_message
     CONTENTS_HEX                     = xtext
    OBJECT_PARA                      =
    OBJECT_PARB                      =
      receivers                        = t_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

Similar Messages

  • How to send a file as an attachment using mailx

    Hi
    Can any one tel me how to send a file as an attachment using mailx command in shell script.
    Thanks,
    Suman.

    Wrong forum where to ask such questions.
    Check this one link:
    http://www.unix.com/shell-programming-scripting/18370-sending-email-text-attachment-using-mailx.html?t=18370#post70254

  • Adapter Module Error-Sending excel file as an attachment of the mail

    Hi ,
    My scenario is as follows
    1)I am sending an excel file as an attachment of the mail.I need to read that excel attachment as a payload.
    So mail adapter is used in sender side.
      To configure this, have used standard PayloadSwapBean  module with proper module key.
      Next to convert excel to XML another custom adapter module is being used.
    Both this adapter module , I configured into the CC of sender mail adapter.
    The order in which adapter modules are being used in the sender CC are as follows
    1)localejbs/AF_Modules/PayloadSwapBean
    2)localejbs/MDPExcelToXMLConversion
    3)sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    MDPExcelToXMLConversion-Custom adapter module written to convert excel to xml.
    I am getting the following error
    exception caught during processing mail message [4899]com.sap.aii.af.lib.mp.module.ModuleException
    And also,
    no messages in coming MONI of PI.
    Pls suggest what to do.
    Thanks
    Ayan

    Shabarish,
    Will the ordering in which the adapter modules(In this case there are two-PayloadSwapBean & MDPExcelToXML) are appearing into Module tab of sender adapter matter?
    Firstly, what is happenning
    1)If I take out the custom  adapter module MDPExcelToXML and put only PayloadSwapBean  then it is successfully converting mail attachment into the main Payload i.e PayloadSwapBean   module is working.
    2)Nextly, my local code( i.e java code without including standard Module specific method like ejbActivate(),ejbPassivate(),process()  etc etc.)) for MDPExcelToXML is successfuly converting the excel file into the XML file.Then I am making the local code into adapter module specific code and deploying that.
    A few question arises here,
    Do I need to do any specific configurations here in PI for this particular things.Maybe both the adapter module is clashing with each other.
    And also using tracing and logging into my custom adapter module code.Getting the following error,
    java.io.IOException: Unable to read entire header; 116 bytes read; expected 512 bytes#
    Thanks
    Ayan

  • How to send text file as an email attachment havin more than 255 characters

    My requirement is to generate a text file and to send this text file as E-mail attachment. I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send the E-mail. but here the limitation is the number of characters per line must not be more than 255 characters whereas in my case it is exceeding 1000 characters per line. could anyone please suggest me what should i do now ? Each field in the text file has to be tab delimited.

    Simplest might well be to use javamail API instead of the two tags that Sites provides, e.g. see email - Sending mail attachment using Java - Stack Overflow for a full example.
    Phil

  • Send text file as an attachment

    Hi All,
    We have a requirement wherein we need to send the contents of an
    internal table in a text pipe delimited file as an attachment in to an
    external mail id.
    The problem is that the total record length of the internal table is
    around 450 char while the structure SOLI accepts only 255 char.
    This causes the record to be split into 2 lines.
    Is it possible to send the entire 450 char in one line? If yes, how can
    this be done?
    Thanks,
    fractal

    I think u shd use this FM for line width change:-
    CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
       EXPORTING
         LINE_WIDTH_SRC                    = 134 "ur source width
         LINE_WIDTH_DST                    = 255
        TRANSFER_BIN                      = ' '
        TABLES
          CONTENT_IN                        = GT_PDF  "ur itab name
          CONTENT_OUT                       = LT_ATT
      EXCEPTIONS
        ERR_LINE_WIDTH_SRC_TOO_LONG       = 1
        ERR_LINE_WIDTH_DST_TOO_LONG       = 2
        ERR_CONV_FAILED                   = 3
        OTHERS                            = 4

  • How to send csv file as an attachment

    Hi,
    I am able to create a csv file in this directory as "test.scv" using utl_file and some select statements.
    Now I need to send this csv file as an attachment in email.
    we have smtp installed on our server.
    Please help me on this .
    Thanks
    Kind Regards

    The first link takes in a filename (this would be the csv file you have already created) so nothing should be hard coded; it's just the parameters you pass in.
    Doing a little more research (from the asktom article I posted previously) links to this [http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] which the real gold is at [http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt]:
    with examples how to use it at [http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/mailexample_sql.txt].
    To get the attachments working from a PL/sql application you will require one of the packages or a large amount of code.
    here's the coded example for attaching files from the packages listed in maildemo_sql.txt from Oracle's website
    REM Send an email with 2 attachments.
    DECLARE
      conn      utl_smtp.connection;
      req       utl_http.req; 
      resp      utl_http.resp;
      data      RAW(200);
    BEGIN
      conn := demo_mail.begin_mail(
        sender     => 'Me <[email protected]>',
        recipients => 'Someone <[email protected]>',
        subject    => 'Attachment Test',
        mime_type  => demo_mail.MULTIPART_MIME_TYPE);
      demo_mail.attach_text(
        conn      => conn,
        data      => '<h1>Hi! This is a test.</h1>',
        mime_type => 'text/html');
      demo_mail.begin_attachment(
        conn         => conn,
        mime_type    => 'image/gif',
        inline       => TRUE,
        filename     => 'image.gif',
        transfer_enc => 'base64');
      -- In writing Base-64 encoded text following the MIME format below,
      -- the MIME format requires that a long piece of data must be splitted
      -- into multiple lines and each line of encoded data cannot exceed
      -- 80 characters, including the new-line characters. Also, when
      -- splitting the original data into pieces, the length of each chunk
      -- of data before encoding must be a multiple of 3, except for the
      -- last chunk. The constant demo_mail.MAX_BASE64_LINE_WIDTH
      -- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
      -- of data before encoding.
      req := utl_http.begin_request('http://www.some-company.com/image.gif');
      resp := utl_http.get_response(req);
      BEGIN
        LOOP
          utl_http.read_raw(resp, data, demo_mail.MAX_BASE64_LINE_WIDTH);
          demo_mail.write_raw(
            conn    => conn,
            message => utl_encode.base64_encode(data));
        END LOOP;
      EXCEPTION
        WHEN utl_http.end_of_body THEN
          utl_http.end_response(resp);
      END;
      demo_mail.end_attachment( conn => conn );
      demo_mail.attach_text(
        conn      => conn,
        data      => '<h1>This is a HTML report.</h1>',
        mime_type => 'text/html',
        inline    => FALSE,
        filename  => 'report.htm',
        last      => TRUE);
      demo_mail.end_mail( conn => conn );
    END;
    /Edited by: tanging on Dec 18, 2009 10:58 AM

  • How to send PDF file as an attachment in email?

    Hi Folks,
    I have successfully configured SMTP and by now I can successfully send normal text messages along with .TXT files. However, when I am trying to send an email along with .pdf file as an attachment, I am getting the mail in my inbox, but I cannot open the .pdf file! I am getting the following Acrobat error:
    Acrobat could not open 'abc.pdf' because it is either not a supported file type or because the file has been corrupted
    Can any help me in solving this problem?
    Thanks in advance
    Regards,
    Faisal

    Hi Vajha,
    Thanks alot for your kind reply. I also express my apologies for responding to your reply lately.
    I beleive all the links you have sent me are talking about ABAP coding. what I am interested in is,
    is there any configuration that I am missing in SCOT (Basis side)?
    Since I am not an ABAPER, so I carry out these activities.
    Can anyone please answer the following queries of mine:
    1. Can't we send any PDF attachment in a mail from R/3?
    2. Do we have to do it through coding only?
    3. In scot we have option "All formats except fllw". But it does not work for me. Any inputs?
    Thanks in advance.
    Regards,
    Faisal

  • SENDING TEXT FILE AS AN ATTACHMENT

    Hi,
    I want to send an email as a TEXT file attachment.
    Thanks
    Vikranth Khimavath

    hi,
    Use the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail with an attachment. Here is the sample code.
    FUNCTION Z_SEND_MAIL.
    ""Local interface:
    *" IMPORTING
    *" VALUE(MESSAGE) TYPE STRING OPTIONAL
    *" VALUE(RECEIVER_MAIL) TYPE STRING OPTIONAL
    *" VALUE(TO) TYPE STRING OPTIONAL
    data for send function
    DATA doc_data TYPE sodocchgi1.
    DATA object_id TYPE soodk.
    DATA objcont TYPE TABLE OF soli INITIAL SIZE 10.
    DATA wa_objcont LIKE LINE OF objcont.
    DATA receiver TYPE TABLE OF somlreci1 INITIAL SIZE 1.
    DATA wa_receiver LIKE LINE OF receiver.
    move message
    TO doc_data-obj_descr .
    This is the subject for your mail.
    WRITE 'Sub:test Mail' TO doc_data-obj_descr.
    This is the body of your mail.
    concatenate ' Hi ' to into wa_objcont-line separated by space.
    append wa_objcont to objcont.
    wa_objcont-line = message.
    append wa_objcont to objcont.
    Specify receipent id.
    MOVE: RECEIVER_MAIL TO wa_receiver-receiver,
    'X' TO wa_receiver-express,
    'U' TO wa_receiver-rec_type.
    APPEND wa_receiver TO receiver.
    Finally call the function module.
    CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
    EXPORTING
    document_data = doc_data
    put_in_outbox = 'X' "Save Document in Outbox
    COMMIT_WORK = 'X'
    IMPORTING
    new_object_id = object_id
    TABLES
    object_content = objcont
    receivers = receiver
    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.
    SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
    ENDFUNCTION.
    REPORT RSCONN01 MESSAGE-ID XS NO STANDARD PAGE HEADING.
    INCLUDE <SYMBOL>. " 11.11.96
    TYPE-POOLS: SX.
    TYPE-POOLS: KKBLO.
    PARAMETERS: MODE(3) TYPE C DEFAULT '*',
    OUTPUT TYPE C DEFAULT ' '. "B20K072036 new parameter
    selection-screen skip.
    parameters maxjobs type sx_maxjobs default 1.
    parameters rfcgroup type bdfields-rfcgr.
    selection-screen skip.
    parameters maxpsize type sx_maxpsize default 1000.
    parameters minpsize type sx_minpsize default 20.
    parameters maxsel type sx_maxqrows default 20000.
    parameters timepo type sx_timepo default 2.
    parameters timeout type sx_arfctimeout default 100.
    parameters commit type sx_commit default 1.
    data address_types type sx_addrtab.
    data job_params type sxjobs.
    data jobdata type sxjobdata.
    --- initialization -
    initialization.
    get default parameters
    call function 'SX_JOBDATA_GET'
    changing
    jobdata = jobdata.
    give defaults to parameters
    maxjobs = jobdata-maxjobs.
    maxpsize = jobdata-maxpsize.
    minpsize = jobdata-minpsize.
    maxsel = jobdata-maxsel.
    timepo = jobdata-timepo.
    timeout = jobdata-arfc_timeout.
    commit = jobdata-commit_after.
    --- start-of-selection -
    start-of-selection.
    perform addr_type_to_table using mode
    changing address_types.
    job_params-maxjobs = maxjobs.
    job_params-rfcgroup = rfcgroup.
    job_params-maxpsize = maxpsize.
    job_params-minpsize = minpsize.
    job_params-maxsel = maxsel.
    job_params-timepo = timepo.
    job_params-arfc_timeout = timeout.
    job_params-commit_after = commit.
    call function 'SX_OBJECTS_SEND'
    exporting
    address_types = address_types
    output = output
    job_params = job_params
    exceptions
    others = 1.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    exit.
    TABLES: SXADDRTYPE.
    DATA: selection type SX_ADDRTAB,
    NR_SO_OBJECTS TYPE I,
    OBJ_CAT TYPE SX_OBJ_CAT OCCURS 20 WITH HEADER LINE.
    if sy-batch = 'X'.
    message I078 with 'RSCONN01' SY-HOST SY-MANDT.
    endif.
    *fill selection table
    refresh selection.
    if mode = '*'.
    clear mode.
    endif.
    IF NOT ( MODE IS INITIAL ).
    SELECT SINGLE * FROM SXADDRTYPE WHERE ADDR_TYPE EQ MODE.
    IF SY-SUBRC NE 0.
    IF OUTPUT EQ 'X'.
    WRITE: MODE, TEXT-001, TEXT-002.
    ENDIF.
    EXIT.
    ENDIF.
    IF SXADDRTYPE-METHOD NE 'SAPCONNECT'.
    IF OUTPUT EQ 'X'.
    WRITE: MODE, TEXT-003, TEXT-004, TEXT-005.
    ENDIF.
    EXIT.
    ENDIF.
    append sxaddrtype-addr_type to selection.
    ELSE.
    select * from sxaddrtype
    where method = 'SAPCONNECT'
    and extern = sx_true.
    case sxaddrtype-addr_type.
    when 'INT' or 'FAX' or 'PAG' or
    'PRT' or 'RML' or 'X40'.
    append sxaddrtype-addr_type to selection.
    endcase.
    endselect.
    ENDIF.
    CALL FUNCTION 'SX_OBJECTS_SEND'
    EXPORTING
    ADDRESS_TYPES = SELECTION
    IMPORTING
    NR_SO_OBJECTS = NR_SO_OBJECTS
    TABLES
    OBJ_CAT = OBJ_CAT
    EXCEPTIONS
    INTERNAL_ERROR = 1
    OTHERS = 2.
    IF SY-SUBRC NE 0.
    IF OUTPUT EQ 'X'.
    Always write out this error message:
    WRITE: TEXT-006, SY-SUBRC.
    ENDIF.
    EXIT.
    ENDIF.
    IF NR_SO_OBJECTS = 0.
    IF OUTPUT EQ 'X'.
    WRITE: TEXT-007.
    ENDIF.
    EXIT.
    ENDIF.
    IF OUTPUT EQ 'X'.
    PERFORM DISPLAY_OBJECT_CATALOGUE.
    ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR MODE.
    PERFORM F_SHOW_ADDR_TYPES CHANGING MODE.
    AT SELECTION-SCREEN ON HELP-REQUEST FOR OUTPUT.
    PERFORM F_HELP_OUTPUT.
    *& Form addr_type_to_table
    text
    form addr_type_to_table using address_type type sx_addrtyp
    changing address_types type sx_addrtab.
    data adrtp_wa type sxaddrtype.
    data adrtp type sx_addrtyp.
    if address_type <> '*'.
    adrtp = address_type.
    endif.
    if not adrtp is initial.
    select single * from sxaddrtype into adrtp_wa
    where addr_type = adrtp.
    if sy-subrc <> 0.
    message i009 with adrtp.
    exit.
    endif.
    if adrtp_wa-method ne 'SAPCONNECT'.
    message i027 with adrtp.
    exit.
    endif.
    append adrtp_wa-addr_type to address_types.
    else.
    select * from sxaddrtype into adrtp_wa
    where method = 'SAPCONNECT'
    and extern = sx_true.
    case adrtp_wa-addr_type.
    when 'INT' or 'FAX' or 'PAG' or
    'PRT' or 'RML' or 'X40'.
    append adrtp_wa-addr_type to address_types.
    endcase.
    endselect.
    endif.
    endform. " addr_type_to_table
    *& Form DISPLAY_OBJECT_CATALOGUE
    Anzeige der Liste der zum Versenden selektierten Objekte
    --> p1 text
    <-- p2 text
    FORM DISPLAY_OBJECT_CATALOGUE.
    DATA: FIELD_LST TYPE KKBLO_T_FIELDCAT.
    DATA: FIELD_CAT TYPE KKBLO_FIELDCAT.
    DATA: IS_LAYOUT TYPE KKBLO_LAYOUT.
    IS_LAYOUT-NO_ZEBRA = 'X'.
    FIELD_CAT-REF_TABNAME = 'SXOBJCAT'.
    FIELD_CAT-NO_SUM = 'X'.
    FIELD_CAT-JUST = 'L'.
    FIELD_CAT-OUTPUTLEN = 3.
    FIELD_CAT-REPTEXT = 'Trc'.
    FIELD_CAT-FIELDNAME = 'DISPL_TRC'.
    FIELD_CAT-HOTSPOT = 'X'.
    FIELD_CAT-SYMBOL = 'X'.
    APPEND FIELD_CAT TO FIELD_LST.
    FIELD_CAT-SYMBOL = ' '.
    FIELD_CAT-OUTPUTLEN = 0.
    FIELD_CAT-HOTSPOT = ' '.
    FIELD_CAT-REPTEXT = ' '.
    CLEAR: FIELD_CAT-NO_ZERO, FIELD_CAT-KEY .
    FIELD_CAT-FIELDNAME = 'ID'. APPEND FIELD_CAT TO FIELD_LST.
    FIELD_CAT-FIELDNAME = 'TITLE'. APPEND FIELD_CAT TO FIELD_LST.
    FIELD_CAT-FIELDNAME = 'TYPE'. APPEND FIELD_CAT TO FIELD_LST.
    FIELD_CAT-FIELDNAME = 'NR_RECIP'. APPEND FIELD_CAT TO FIELD_LST.
    LOOP AT FIELD_LST INTO FIELD_CAT.
    FIELD_CAT-COL_POS = SY-TABIX.
    MODIFY FIELD_LST FROM FIELD_CAT.
    ENDLOOP.
    LOOP AT OBJ_CAT.
    OBJ_CAT-DISPL_TRC = SYM_PENCIL.
    MODIFY OBJ_CAT.
    ENDLOOP.
    CALL FUNCTION 'K_KKB_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = 'RSCONN01'
    I_CALLBACK_USER_COMMAND = 'CB_OL_UCOMM'
    I_CALLBACK_TOP_OF_PAGE = 'CB_OL_TOP'
    I_CALLBACK_PF_STATUS_SET = 'CB_OL_PFSTATUS'
    I_TABNAME = 'OBJ_CAT'
    IS_LAYOUT = IS_LAYOUT
    IT_FIELDCAT = FIELD_LST
    TABLES
    T_OUTTAB = OBJ_CAT
    EXCEPTIONS
    OTHERS = 1.
    ENDFORM. " DISPLAY_OBJECT_CATALOGUE
    *& Form CB_OL_PFSTATUS
    Callback Funktion (wird aus Listtool heraus gerufen) *
    --> p1 text
    <-- p2 text
    FORM CB_OL_PFSTATUS
    USING EXTAB TYPE KKBLO_T_EXTAB.
    SET PF-STATUS 'CATALOG' EXCLUDING EXTAB.
    SET TITLEBAR 'CAT'.
    ENDFORM. " CB_OL_PFSTATUS
    *& Form CB_OL_TOP
    Callback Funktion (wird aus Listtool heraus gerufen) *
    --> p1 text
    <-- p2 text
    FORM CB_OL_TOP.
    ENDFORM. " CB_OL_TOP
    *& Form CB_OL_UCOMM
    text *
    --> p1 text
    <-- p2 text
    FORM CB_OL_UCOMM
    USING UCOMM LIKE SY-UCOMM
    SELFIELD TYPE KKBLO_SELFIELD.
    DATA: NUMC5(5) TYPE N.
    NUMC5 = SELFIELD-TABINDEX.
    CASE UCOMM.
    WHEN 'PIC1'.
    CASE SELFIELD-SEL_TAB_FIELD.
    WHEN 'OBJ_CAT-DISPL_TRC' OR 'OBJ_CAT-TITLE' OR 'OBJ_CAT-ID'.
    READ TABLE OBJ_CAT INDEX SELFIELD-TABINDEX.
    IF SY-SUBRC NE 0.
    MESSAGE E042.
    ENDIF.
    SUBMIT RSWTTR01
    WITH P_TYPE = 'D'
    WITH P_UNAME = SPACE
    WITH P_OBJ = OBJ_CAT-ID AND RETURN.
    WHEN OTHERS.
    MESSAGE I041 WITH NUMC5 SELFIELD-SEL_TAB_FIELD UCOMM.
    ENDCASE.
    WHEN OTHERS.
    MESSAGE I041 WITH NUMC5 SELFIELD-SEL_TAB_FIELD UCOMM.
    ENDCASE.
    ENDFORM. " CB_OL_UCOMM
    *& Form F_SHOW_ADDR_TYPES
    text
    <--P_MODE text *
    FORM F_SHOW_ADDR_TYPES CHANGING A_TYPE.
    DATA: HELP_INFO LIKE HELP_INFO
    , sel_value like help_info-fldvalue
    , CUCOL LIKE SY-CUCOL
    , CUROW LIKE SY-CUROW
    , value like help_info-fldvalue value 'SE38'
    , IND LIKE SY-INDEX
    , C_SY_SUBRC(3) TYPE C
    DATA: BEGIN OF FIELDS OCCURS 5.
    INCLUDE STRUCTURE HELP_VALUE.
    DATA: END OF FIELDS.
    DATA: BEGIN OF LIST_OF_FIELDS OCCURS 5,
    NAME(21) TYPE C.
    DATA: END OF LIST_OF_FIELDS.
    DATA: BEGIN OF FULL_LIST OCCURS 5,
    ADDRESS_TYPE LIKE SXADDRTYPE-ADDR_TYPE,
    END OF FULL_LIST.
    REFRESH FIELDS.
    REFRESH LIST_OF_FIELDS.
    REFRESH FULL_LIST.
    HELP_INFO-TABNAME = 'SXADDRTYPE'.
    HELP_INFO-FIELDNAME = 'ADDR_TYPE'.
    SELECT * FROM SXADDRTYPE.
    IF SXADDRTYPE-METHOD NE 'SAPCONNECT'
    OR SXADDRTYPE-EXTERN NE SX_TRUE.
    CONTINUE.
    ENDIF.
    MOVE SXADDRTYPE-ADDR_TYPE TO FULL_LIST-ADDRESS_TYPE.
    APPEND FULL_LIST.
    ENDSELECT.
    MOVE '*' TO FULL_LIST-ADDRESS_TYPE.
    APPEND FULL_LIST.
    LIST_OF_FIELDS-NAME = 'SXADDRTYPE-ADDR_TYPE'.
    APPEND LIST_OF_FIELDS.
    CALL FUNCTION 'TRANSFER_NAMES_TO_FIELDS'
    EXPORTING
    SELECTFIELD = HELP_INFO-FIELDNAME
    TABLES
    FIELDS = FIELDS
    NAMELIST = LIST_OF_FIELDS
    EXCEPTIONS
    WRONG_FORMAT_GIVEN = 1
    OTHERS = 2.
    CALL FUNCTION 'HELP_VALUES_GET_WITH_VALUE'
    EXPORTING
    DISPLAY = ' '
    FIELDNAME = HELP_INFO-FIELDNAME
    TABNAME = HELP_INFO-TABNAME
    GIVEN_VALUE = HELP_INFO-FLDVALUE
    TITEL = TEXT-002
    IMPORTING
    SELECT_VALUE = HELP_INFO-FLDVALUE
    SELECT_INDEX = IND
    TABLES
    FIELDS = FIELDS
    VALUETAB = FULL_LIST
    EXCEPTIONS
    FIELD_NOT_IN_DDIC = 1
    MORE_THEN_ONE_SELECTFIELD = 2
    NO_SELECTFIELD = 3
    OTHERS = 4.
    C_SY_SUBRC = SY-SUBRC.
    CASE SY-SUBRC.
    WHEN '0'.
    READ TABLE FULL_LIST INTO A_TYPE INDEX IND.
    WHEN OTHERS.
    MESSAGE E022 WITH C_SY_SUBRC.
    ENDCASE.
    ENDFORM. " F_SHOW_ADDR_TYPES
    *& Form F_HELP_OUTPUT
    text
    --> p1 text
    <-- p2 text
    FORM F_HELP_OUTPUT.
    DATA: CANCELLED TYPE C,
    C_SY_SUBRC(8) TYPE C.
    CALL FUNCTION 'POPUP_DISPLAY_TEXT'
    EXPORTING
    LANGUAGE = SY-LANGU
    POPUP_TITLE = 'SAPconnect'
    TEXT_OBJECT = 'RSCONN01_F1_OUTPUT_40B'
    IMPORTING
    CANCELLED = CANCELLED
    EXCEPTIONS
    TEXT_NOT_FOUND = 1
    OTHERS = 2.
    C_SY_SUBRC = SY-SUBRC.
    IF SY-SUBRC NE 0.
    MESSAGE E035 WITH C_SY_SUBRC. leads to dump !
    ENDIF.
    ENDFORM. " F_HELP_OUTPUT
    Regards,
    Richa

  • 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

  • How to send original filename as the attachment name through mail adapter?

    Hi,
    I have a File to Mail scenario where the file is picked up from a folder in R/3 system and is sent as an attachment through mail. The requirement is to send the file unconverted and with the same file name.
    When tried without creating any ESR objects, it was sending the file with the name Untitled.xml.
    Since the filename has to be picked dynamically, I am not able to configure it through module parameters also (where we can set it through Content_Disposition)
    I tried configuring it as mentioned in the following link: [http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=138084630]
    But still it is going as Untitled.xml with the whole mail package as the content of the attachment.
    Any pointers to solve this issue will be of great help.
    Thanks
    Justin

    there is no standard way so you will  have to write module beans.
    in other way:
    XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping - XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
    Dynamic name in the mail attachment - pseudo "variable substitution" :
    XI: Dynamic name in the mail attachment - pseudo "variable substitution"
    Dynamic attachment name in receiver mail adapter

  • 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

  • How to send .CSV file via email in Oracle10g/11g PL/SQL

    Hi Guys,
    Can any one let me know or suggest me how to send .csv file via email attachment using Oracle PL/SQL.
    Thanks in advance!
    Regards,
    LRK

    A FAQ. Use UTL_MAIL (if attachment is 32KB less). Else use UTL_SMTP. Search this forum. Search using google.

  • How to attach a text file as an attachment to email message?

    Hello Everybody,
    I have a .csv file, in which details about emp-id, emp-name, e-expenses for Reimbursement and email address are stored.
    My application reads this .csv file, and sends a mail to each employee with his id, salary details in text format. (by changing content type to "text/plain") The code is working fine. But,
    My problem is:
    The message is sent as message body to the end user.
    The end user / the person who receives this mail will not be a technical person. So,
    1) If he trys to take a print out of this e-mail, He get only half of it.(as no. of colums will be more than paper size).
    2) I am finding alignment problem. IF employee name is too big, other columns will shift to right and data will not be exactly under column header. (it is going in zig zag way)
    So, I thought sending text file with all the details as an attachment might do well.
    But, I don't know how to attach a text file to email-message body.
    code
    try
                   {               String s1="";
                                  File f1 = new File(the path);
                                  FileInputStream fstream = new FileInputStream(f1); //new
                                  BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
                                  int count=0;
                                  while((s1=br.readLine())!=null )
                                                 count++;
                                                 //out.println("within while loop "+count);
                                                 StringTokenizer st = new StringTokenizer(s1,",");
                                                 if ((st.hasMoreTokens())&&(count>1))
                                            String a=st.nextToken().trim();
                                                 String b=st.nextToken();
                                                 String c=st.nextToken();
                                                 String d=st.nextToken();
                                                 String e=st.nextToken();
                                                 String f=st.nextToken();
                                                 String g=st.nextToken();
                                                 String h=st.nextToken();
                                                 String i=st.nextToken();
                                                 String j=st.nextToken();
                                                 String k=st.nextToken();
                                                 String l=st.nextToken();
                                                 String m=st.nextToken();
                                                 String n=st.nextToken();
                                                 String o=st.nextToken();
                                                 String p=st.nextToken();
                                                 String q=st.nextToken();
                                                 String mail=st.nextToken();
                                                 String s=st.nextToken();
                                                 //out.println("b="+b+"c="+c+"d="+d+"e="+e+"f="+f+"mail="+mail);
                                                 %>
    <%
                                            String to =mail;
                                                 String from =request.getParameter("fromadd");                                        
                                                 String subject ="Statement of Expenses";
                                                 String smtp ="mail.xxxxxxxxxx.com";
                                                 String message="";                                        
                                                 message=message.concat("EMP ID");
                                                 message=message.concat("     ");
                                                 message=message.concat("Name");
                                                 message=message.concat("          ");
                                                 message=message.concat("Dept No.");
                                                 message=message.concat("     ");
                                                 message=message.concat("Acc No.");
                                                 message=message.concat("     ");
                                                 message=message.concat("*****************************************************************************************");     
                                                 message=message.concat(a);
                                                 message=message.concat("     ");
                                                 message=message.concat(b);
                                                 message=message.concat("          ");
                                                 message=message.concat(c);
                                                 message=message.concat("     ");
                                                 message=message.concat(d);
                                                 Properties props = System.getProperties();
                                                 // Puts the SMTP server name to properties object
                                                 props.put("mail.smtp.host", smtp);
                                                 // Get the default Session using Properties Object
                                                 Session session1 = Session.getDefaultInstance(props, null);
                                                 // Create a New message
                                                 MimeMessage msg = new MimeMessage(session1);
                                                 // Set the From address
                                                 msg.setFrom(new InternetAddress(from));
                                                 // Setting the "To recipients" addresses
                                            msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
                                            /* // Setting the "cc recipients" addresses
                                            msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc, false));
                                            // Setting the "Bcc recipients" addresses
                                            msg.setRecipients(Message.RecipientType.BCC,InternetAddress.parse(bcc, false)); */
                                            // Sets the Subject
                                            msg.setSubject(subject);
                                            // set the meaasge in HTML format
                                            msg.setContent(message,"text/plain");
                                            // Set the Date: header
                                            msg.setSentDate(new java.util.Date());
                                            // Send the message
                                            Transport.send(msg);
                                            // Display Success message
                                            result =result.concat("<tr><td>"+b+"</td>"+"<td>"+to+"</td></tr>");
                                                      }//end of if of hasmore element
                                       }// end of while loop
                        out.println(result);                    
    }catch(Exception e)
                        // If here, then error in sending Mail. Display Error message.
                        result="Unable to send your message";
                        out.println("e="+e);
    Any help will be appreciated.
    Thanks and regards.
    Ashvini

    <html>
    <p>
    MimeBodyPart mbp1 = new MimeBodyPart();
    mbp1.setText("Your Messages");
    MimeBodyPart mbp2 = new MimeBodyPart();
    FileDataSource fds = new FileDataSource("Your Attachments");
    mbp2.setDataHandler(new DataHandler(fds));
    mbp2.setFileName(fds.getName());
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    mp.addBodyPart(mbp2);
    msg.setContent(mp);
    msg.saveChanges();
    msg.writeTo(System.out);
    msg.setSubject(subject);
    Transport.send(msg);
    </p>
    <B><U>See you can add above code in your program and see the magic</U></B>
    Bye
    regards--
    Ashish
    </html>

  • How to send image file through mail without   any attachment

    Plz tell  me how to send image file through mail without any attachment  ( i mean not converting  that image into pdf or any format )  i want to send that text or image  through mail .

    Hi Sandeep,
    I think you can setup the type of email in Shared office Settings in transaction S016.
    There is an option called <Preset document classes>
    You choose this pushbutton to branch to the maintenance screen for the document classes that are directly displayed to users in the Business Workplace for selection when they use the Create function. The name under which the documents are displayed can also be maintained.
    http://help.sap.com/saphelp_nw70/helpdata/en/6c/69c30f418d11d1896e0000e8322d00/content.htm
    Haven't tried it though.
    Regards,
    Siddhesh

  • How to send word file as attachment in an email

    Hi All,
               I have a scenario where the a word document is sent using a file adapter and mail adapter puts it as an attachment and sends it to designated email group.
    Now the issue is the attachment that I am getting is text file, but i want it to be a word format file.
    Pls advice..
    Xier

    Hi,
    Just  give this a shot.
    In the file adapter.
    Set  Additional File(s) .
    and follow this document how to send additional file, rules and naming conventions and  parameters.
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/b4a6490a08cd41a8c91759c3d2f401/content.htm
    Itz simple.
    <b>Cheers,
    *RAJ*</b>
    I

Maybe you are looking for

  • Sapscript printing problem

    I made a graph window in a sapscript form.When i print it i have the following problem : I can't see the "MAIN WINDOW" only. I mean that i can see all the other elements EXCEPT the main window . Please help me .....

  • WARNING: Premiere CS6 won't load past "Loading ExporterQuickTimeHost" after QT 7.7.3 update

    Just what the subject line says, Premiere CS6 won't load up past the splash screen and "Loading ExporterQuickTimeHost" after I updated to QT 7.7.3 (Win7).  No other updates done, my CS6 is up to date.  I reverted back to 7.6 and problem went away.  J

  • Control Sun Studio 12 log files

    Hi everybody. I'm new using the Sun Studio IDE. I'm not a developer, i'm a system administrator. What I would like to know is how to control the size of the Sun Studio log file. For example, I have some users with the following files: ~/.sunstudio/12

  • Every time I log on it tells me I must update firefox even though I have updated already.

    Although I have updated to the current Mozilla Firefox and also the current Thunderbird download, EACH time I log onto Mozilla, I get a notification for a Firefox Software updater. I am not the only one getting this. My husband is too. This is extrem

  • IPad settings menu for mails crash

    When in settings I want to change my mail accounts the screen freezes. I've tried a restore settings, but it doesn't help. I have iCloud and Gmail accounts. The issue is with the Gmailaccounts. What to do?