How to send mail attachment excel sheet correctly

Hi,
I  am working one program and there the out put should be sent in mail attachment in excel sheet. I have used one Function module SO_DOCUMENT_SEND_API1. I am able to send the output data mail attachment excel sheet. But one problem I am facing that last two lines in excel sheet are shifting one tab right. It should come from from first column itself.
How to correct this program any one can answer it with some code if possible.
Waiting for quick response.
Best Regards,
BDP

Hi,
I  am working one program and there the out put should be sent in mail attachment in excel sheet. I have used one Function module SO_DOCUMENT_SEND_API1. I am able to send the output data mail attachment excel sheet. But one problem I am facing that last two lines in excel sheet are shifting one tab right. It should come from from first column itself.
How to correct this program any one can answer it with some code if possible.
Waiting for quick response.
Best Regards,
BDP

Similar Messages

  • How to send mail attachment

    Hi,
    I want to send email along with attachment. I have tried to install UTL_MAIL packages but dont have its backage body script i.e. %ORACLE_HOME%/RDBMS/ADMIN/PRVTMAIL.SQL file.
    Please help me to guide installation of this package or tell me is there any alternate way.
    Thanks
    Usman Rana
    mail the file at [email protected]

    Hello
    Sending email attachment from oracle I have no idea but you can do that from UNIX.
    a) using MUTT a third party utility on unix will allow attachments in emails.
    b) check the below mentioned script.
    SUBJECT="Send mail from Unix with file attachments"
    TO=junk\@testing.com
    SPOOLFILE=/export/home/oracle/sqlplus.txt
    echo "Produce listing from SQL*Plus..."
    sqlplus -s sri/sri >$SPOOLFILE <<-EOF
    set echo off feed off veri off pages 0 head off
    select * from tab;
    EOF
    # echo "Convert file to DOS mode..."
    # unix2dos $SPOOLFILE $SPOOLFILE 2>/dev/null
    echo "Send the E-mail message..."
    /usr/bin/mailx -s "${SUBJECT}" ${TO} <<-EOF
    Hi,
    This sample E-mail message demonstrates how one can attach
    files when sending messages with the Unix mailx utility.
    First attachment: SQL*Plus spool file
    ~< ! uuencode $SPOOLFILE `basename $SPOOLFILE`
    Second attachment: mailx.ksh (this script)
    ~< ! uuencode mailx.ksh mailx.txt
    Third attachment: /etc/passwd file
    ~< ! uuencode /etc/passwd passwords
    Best regards
    ~.
    EOF
    echo "Done!"
    c) Third option is creating a procedure in oracle which allows you to send emails but with no attachments.
    /* Sending email from oracle database */
    create or replace procedure send_mail
    ( sender      in varchar2,
    recipient in varchar2,
    subject      in varchar2,
    message      in varchar2 ) is
    mailhost varchar2(30) := '192.168.1.100';
    chlr varchar2(2) := chr(13) || chr(10);
    mail_conn utl_smtp.connection;
    mesg varchar2(4000);
    begin
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    mesg:= 'date: ' || to_char( sysdate, 'dd-mon-yyyy hh24:mi:ss' )||chlr||
    'from: <'||sender||'>' || chlr ||
    'subject: '||subject || chlr ||
    'to: '||recipient || chlr ||
    'tablespace report - rpt '|| chlr || message;
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender);
    utl_smtp.rcpt(mail_conn, recipient);
    utl_smtp.data(mail_conn, mesg);
    utl_smtp.quit(mail_conn);
    exception
         when others then
         raise_application_error(-20002,'unable to send the mail.'||sqlerrm);
    end;
    Hope this helps
    -Sri

  • How to Convert Report into Excel Sheet when Sending Mail.

    Dear Friends,
    i want to send mail to HOD of Product with an Excel Sheet .
    i want to send Pending Issue details to HOD in Excel Sheet attachment .
    here i have pending issue report now i need to send it in Excel Sheet attachment .
    i have table where i have manage Product ID and HOD OF PRODUCT.
    CREATE TABLE  "MAP_USER_PRODUCT_DTL"
       (     "ID" NUMBER NOT NULL ENABLE,
         "PRODUCT_ID"NUMBER,
         "USER_ID" VARCHAR2(5) NOT NULL ENABLE,
         "HOD_PROD" VARCHAR2(100)========================================Value is Y OR N IF HOD then Y else N
         CONSTRAINT "MAP_USER_PRODUCT_DTL_PK" PRIMARY KEY ("ID") ENABLE
    /i have one more table where all complete issue detail insert.
    CREATE TABLE  "CRM_ISSUE_PROBLEM"
       (     "ID" NUMBER,
         "SUBJECT" VARCHAR2(255) NOT NULL ENABLE,
         "CLIENT_ID" NUMBER,
         "ASSIGNED_TO_ID" VARCHAR2(100),
         "ASSIGNED_ON" DATE,
         "DESCRIPTION" VARCHAR2(4000),
         "PRODUCT_ID" NUMBER NOT NULL ENABLE,
         "STATUS_ID" NUMBER NOT NULL ENABLE,
          CONSTRAINT "CRM_ISSUE_PROBLEM_PK" PRIMARY KEY ("ID") ENABLE
    Here STATUS_ID is Like Pending ISsue,Open Issue and Close Issue .i want to send mail to HOD with Pending Issue Report convert into Excel Sheet and send to HOD?
    How can i do this.
    Thanks
    Edited by: Vedant on Oct 12, 2011 12:36 AM
    Edited by: Vedant on Oct 12, 2011 2:22 AM

    Hello Vedant,
    Would it suffice if you send a CSV file?
    If yes, then see following code.. run the code under APEX > Home > SQL Workshop > SQL Commands
    DECLARE
            ln_id NUMBER;
            lc_clob CLOB;
         lb_blob BLOB;
         li_in PLS_INTEGER := 1;
         li_out PLS_INTEGER := 1;
         li_lang PLS_INTEGER := 0;
         li_warning PLS_INTEGER := 0;
         lv_mail_rcpts VARCHAR2(2000) := '[email protected]';
         lv_mail_from VARCHAR2(100) := '[email protected]';     
           lv_clmn_separator VARCHAR2(1) := ',';
    BEGIN
         -- Build file content as CLOB
      -- Replace with your query
         FOR i IN (select object_id A, object_name B, object_type C, status D, temporary E, generated F, secondary G,namespace H from user_objects where rownum < 10)               
         LOOP
        IF lc_clob IS NULL THEN
          lc_clob := i.A||lv_clmn_separator||i.B||lv_clmn_separator||i.C||lv_clmn_separator||i.D||lv_clmn_separator||i.E||lv_clmn_separator||i.F||lv_clmn_separator||i.G||lv_clmn_separator||i.H;
        ELSE
          lc_clob := lc_clob||CHR(10)||i.A||lv_clmn_separator||i.B||lv_clmn_separator||i.C||lv_clmn_separator||i.D||lv_clmn_separator||i.E||lv_clmn_separator||i.F||lv_clmn_separator||i.G||lv_clmn_separator||i.H;
        END IF;
         END LOOP; 
         -- Convert CLOB to BLOB
         DBMS_LOB.CREATETEMPORARY(lb_blob,TRUE);
         DBMS_LOB.convertToBlob(lb_blob,lc_clob,DBMS_LOB.LOBMAXSIZE,li_in,li_out,DBMS_LOB.DEFAULT_CSID,li_lang,li_warning);
         -- Send mail
         ln_id:= APEX_MAIL.SEND(
           p_to        => lv_mail_rcpts,
                 p_from      => lv_mail_from,
                 p_subj      => 'Subject Goes here',
                 p_body      => 'Body goes here'
           -- add CSV file as attachment
         APEX_MAIL.ADD_ATTACHMENT
           p_mail_id   => ln_id,
           p_attachment => lb_blob,
           p_filename   => 'filename.csv',
           p_mime_type  => 'application/csv'
      -- push mail queue
      APEX_MAIL.PUSH_QUEUE;
         -- empty temporary space
         DBMS_LOB.FREETEMPORARY ( lob_loc =>  lb_blob);       
         COMMIT;
    END;Regards,
    Hari

  • Problem in Sending mail with attachment (Excel sheet)

    Hi
    Iam using this FM   SO_NEW_DOCUMENT_ATT_SEND_API1  for sending mail with an attachment (excel sheet).
    the application is running fine , mail is going to other system .   but the excel sheet attachment contain only few rows  not all.
    and the body of the mail is not displaying . 
    Can any one help me. Thanks in advance.

    Hi,
    you can use cl_bcs classes for the same. I am using below code for same thng
      CONSTANTS:c_tab  TYPE c VALUE cl_bcs_convert=>gc_tab.
      CONSTANTS:c_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf.
      DATA o_send_request   TYPE REF TO cl_bcs.
      DATA o_document       TYPE REF TO cl_document_bcs.
      DATA o_recipient      TYPE REF TO if_recipient_bcs.
      DATA o_bcs_exception  TYPE REF TO cx_bcs.
      TRY.
        o_document = cl_document_bcs=>create_document(
          i_type    = 'RAW'
          i_text    = is_mail_text
          i_subject = text-005 ).
      ENDTRY.
    *create file header
    CONCATENATE
                    text-h00 c_tab text-h01 c_tab text-h02 c_tab text-h03 c_tab text-h04 c_tab
                    text-h52 c_tab text-h05 c_tab text-h06 c_tab text-h07 c_tab text-h08 c_tab text-h09 c_tab
                   c_crlf INTO w_data_string.
    Loop at itab which contains data to be send as attachment
    concatenate field1 field2 field3 c_crlf into your_string separated by  c_tab
    conatenate final string your_string into final_string.
    endloop.
    *Convert data into suitable excel format
      TRY.
          CALL METHOD cl_bcs_convert=>string_to_solix
            EXPORTING
              iv_string   = w_data_string
              iv_codepage = '4103'
              iv_add_bom  = 'X'
            IMPORTING
              et_solix    = w_binary_content.
        CATCH cx_bcs INTO o_bcs_exception.
          IF o_bcs_exception IS NOT INITIAL.
            w_exec_txt = o_bcs_exception->get_text( ).
            MESSAGE w_exec_txt TYPE 'S'.
          ENDIF.
      ENDTRY.
        add the spread sheet as attachment to document object
      CONCATENATE text-006 sy-datum INTO w_attach_name SEPARATED BY space.
      o_document->add_attachment(
        i_attachment_type    = 'xls'
        i_attachment_subject = w_attach_name
        i_att_content_hex    = w_binary_content ).
    *create persistent send request
      o_send_request = cl_bcs=>create_persistent( ).
        add document object to send request
      o_send_request->set_document( o_document ).
        create recipient object for external mail id
      w_mlrec = iw_recipent.
      TRY.
          o_recipient = cl_distributionlist_bcs=>getu_persistent(
              i_dliname = w_mlrec
              i_private = space ).
        CATCH cx_bcs INTO o_bcs_exception.
          IF o_bcs_exception IS NOT INITIAL.
            w_exec_txt = o_bcs_exception->get_text( ).
            MESSAGE w_exec_txt TYPE 'S'.
          ENDIF.
      ENDTRY.
        add recipient object to send request
      o_send_request->add_recipient( o_recipient ).
        ---------- send document ---------------------------------------
      w_sent_to_all = o_send_request->send( i_with_error_screen = 'X' ).
      IF w_sent_to_all EQ abap_true.
        COMMIT WORK.
      ENDIF.

  • Sending mail with excel attachment-improper format

    Dear experts,
    I am sending a mail to outlook with an excel attachment. The mail is sent with attachment and the data, but all in one cell.
    I am using SO_NEW_DOCUMENT_ATT_SEND_API1. What parameters do i need to manipulate to have data in different columns of excel? I am using "packing_list" table of FM. But dont know the exact parameters to be passed. Can anyone help with the same please?
    Best regards and thanks!
    Sumit Nene.

    Hello Sumit,
    I am using same function module to send mail with excel attachment.
    Below I am attaching my own code for your reference.
    Data which u want to add in excel file is maintain in IT_OBJBIN i.e. document information.
    CLEAR :IMESSAGE,IT_OBJBIN,IT_OBJPACK,IT_RECLIST.
    REFRESH: IMESSAGE[ ] , IT_OBJBIN[ ]  , IT_OBJPACK[ ] ,  IT_RECLIST[ ].
    " populate the text for body of the mail
    CLEAR WA_IMESSAGE.
    CONCATENATE    'Board : ' P_BOARD ':' 'Please find  the excel attached for the list of Material whose routing is created'   INTO WA_IMESSAGE-LINE.
      APPEND WA_IMESSAGE TO IMESSAGE.
    "document information
      W_DOC_CHNG-OBJ_NAME = 'Excel'.
      IF NOT P_BOARD IS INITIAL.
        CONCATENATE    'Board : ' P_BOARD ':' 'List Of Routing Materials' INTO  W_DOC_CHNG-OBJ_DESCR.
      ELSE.
        CONCATENATE     'List Of' ' Routing Materials' INTO  W_DOC_CHNG-OBJ_DESCR.
      ENDIF.
      W_DOC_CHNG-SENSITIVTY = 'F'.  " ->Functional object
      " displaying  material , plant in the excel
      CONCATENATE 'BOARD NO : ' P_BOARD INTO WA_OBJBIN.
      APPEND WA_OBJBIN TO IT_OBJBIN.
      CONCATENATE 'MATERIAL' 'PLANT' 'DESCRIPTION' INTO WA_OBJBIN SEPARATED BY C_TAB.
      CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
      APPEND WA_OBJBIN TO IT_OBJBIN.
      CLEAR : WA_OBJBIN.
      LOOP AT IT_DOWNLOAD INTO WA_DOWNLOAD. "It_orders is the internal table to be transferred to excel
        CONCATENATE WA_DOWNLOAD-MATNR WA_DOWNLOAD-WERKS WA_DOWNLOAD-DESC INTO WA_OBJBIN SEPARATED BY C_TAB.
        CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
        APPEND WA_OBJBIN TO IT_OBJBIN.
      ENDLOOP.
      DESCRIBE TABLE IT_OBJBIN LINES V_LINES_BIN.   " no of lines for excel data
      " pack the data as RAW
      CLEAR WA_IT_OBJPACK-TRANSF_BIN.                     "Obj. to be transported not in binary form
      WA_IT_OBJPACK-HEAD_START = 1.                   "Start line of object header in transport packet
      WA_IT_OBJPACK-HEAD_NUM = 0.                     "Number of lines of an object header in object packet
      WA_IT_OBJPACK-BODY_START = 1.                   "Start line of object contents in an object packet
      WA_IT_OBJPACK-BODY_NUM = MESSAGE_LINES.         "Number of lines of the mail body
      WA_IT_OBJPACK-DOC_TYPE = 'RAW'.
      APPEND WA_IT_OBJPACK TO IT_OBJPACK.
      " pack the data as excel
      WA_IT_OBJPACK-TRANSF_BIN = 'X'.
      WA_IT_OBJPACK-HEAD_START = 1.
      WA_IT_OBJPACK-HEAD_NUM = 1.
      WA_IT_OBJPACK-BODY_START = 1.
      WA_IT_OBJPACK-BODY_NUM = V_LINES_BIN.         "no of lines of it_orders to give no of unprocessed orders
      WA_IT_OBJPACK-DOC_TYPE = 'XLS'.   " ->  excel fomat
      WA_IT_OBJPACK-OBJ_NAME = 'EXCEL ATTACHMENT'.
      " attachment name
      IF NOT P_BOARD IS INITIAL.
        CONCATENATE P_BOARD '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
      ELSE.
        CONCATENATE 'LIST' '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
      ENDIF.
      WA_IT_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
      APPEND WA_IT_OBJPACK TO IT_OBJPACK.
      " creating email id
      DATA: STR1 TYPE STRING,
          STR2 TYPE STRING,
          STR3 TYPE STRING,
          ITAB TYPE TABLE OF STRING.
      DATA : WA_I LIKE LINE OF ITAB.
      SPLIT P_EMAIL AT ',' INTO: TABLE ITAB.
    e-mail receivers.
      CLEAR WA_IT_RECLIST.
      LOOP AT ITAB INTO WA_I.
        WA_IT_RECLIST-RECEIVER = WA_I.
      WA_IT_RECLIST-RECEIVER = V_MAILADDR.
        WA_IT_RECLIST-EXPRESS =  'X'.
        WA_IT_RECLIST-REC_TYPE = 'U'. "->  Internet address
        APPEND WA_IT_RECLIST TO IT_RECLIST.
        CLEAR WA_IT_RECLIST.
      ENDLOOP.
      " sending mail
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA                    = W_DOC_CHNG
         PUT_IN_OUTBOX                    = 'X'
         COMMIT_WORK                      = 'X'
       IMPORTING
         SENT_TO_ALL                      =
         NEW_OBJECT_ID                    =
        TABLES
          PACKING_LIST                     = IT_OBJPACK
         OBJECT_HEADER                    =
         CONTENTS_BIN                      = IT_OBJBIN
         CONTENTS_TXT                      = IMESSAGE
         CONTENTS_HEX                     =
         OBJECT_PARA                      =
         OBJECT_PARB                      =
          RECEIVERS                        = IT_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
      COMMIT WORK.
      IF SY-SUBRC = 0.
        MESSAGE I001 WITH 'Routing is Created for Board' P_BOARD 'and Mail send on e-mail id :' P_EMAIL.
      ENDIF.

  • How to send an attachment thru mail in SAP?

    Hi all,
    I have an file which has been sent by the customer. The file type may vary each & every week (sometimes XLS, sometimes CSV & sometimes notepad). This file has to be sent to another person thru mail as an attachment.
    Is it possible to send thru the fun mod 'SO_SEND_NEW_*'.
    If so how to send as attachment. If not thru this fun mod, how to send?
    Thanks,
    Vijay.

    I am enclosing the sample code to trigger an email, The logic for this is in comments, check this I am shure yuor problem will be solved.
    *& Report ZGBL_SLA_PER
    REPORT zgbl_sla_per NO STANDARD PAGE HEADING LINE-COUNT 26(3) MESSAGE-ID
    zmsg2.
    DECLARATION OF DB TABLES
    TABLES: zncrfid, zrule_id.
    DECLARATION OF INTERNAL TABLES
    DATA: BEGIN OF ncrf OCCURS 0,
    zncrf_id(15) TYPE c,
    zncrf_l4_name(60) TYPE c,
    z9gl_sla_flag(1) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    zdate_changed(8) TYPE n,
    ztime_changed(6) TYPE n,
    END OF ncrf.
    *DATA: NCRF LIKE ZNCRFID OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF it_ruleid OCCURS 0,
    zrule_id(10) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    END OF it_ruleid.
    *data: wa like ncrf occurs 0 with header line.
    DATA: BEGIN OF itab OCCURS 0,
    zncrf_id(15) TYPE c,
    zncrf_l4_name(60) TYPE c,
    z9gl_sla_flag(1) TYPE c,
    zowners(30) TYPE c,
    zowners_value(30) TYPE c,
    zdate_changed(8) TYPE n,
    ztime_changed(6) TYPE n,
    END OF itab.
    data: file(10) type c,
    dates type date.
    EMAIL DECLARATION
    *CONSTANTS: c_subject LIKE sodocchgi1-obj_descr VALUE 'Subject',
    *c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
    *DATA: g_time TYPE char8,
    *g_email(40) TYPE c,
    *g_sent_all(1) TYPE c,
    *g_doc_data LIKE sodocchgi1,
    *g_error TYPE sy-subrc.
    *DATA: i_message LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    *i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    *i_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
    *DATA: BEGIN OF mailid OCCURS 0,
    zemail_id TYPE zrule_id-zemail_id,
    END OF mailid.
    *data: mailid like zrule_id occurs 0 with header line.
    UPLOADING FLAT FILE TO INTERNAL TABLE NCRF
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'C:\VAMSY\file.txt'
    filetype = 'ASC'
    has_field_separator = 'X'
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    CHECK_BOM = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = ncrf[]
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE = 5
    NO_AUTHORITY = 6
    UNKNOWN_ERROR = 7
    BAD_DATA_FORMAT = 8
    HEADER_NOT_ALLOWED = 9
    SEPARATOR_NOT_ALLOWED = 10
    HEADER_TOO_LONG = 11
    UNKNOWN_DP_ERROR = 12
    ACCESS_DENIED = 13
    DP_OUT_OF_MEMORY = 14
    DISK_FULL = 15
    DP_TIMEOUT = 16
    OTHERS = 17
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
    IF sy-subrc EQ 0.
    Checking internal table ncrf is empty then
    *delete records from TABLE ZNCRF_ID ******************************
    IF ncrf[] IS INITIAL.
    MESSAGE i003(ZMSG2).
    ELSE.
    DELETE FROM zncrfid.
    ENDIF.
    *****Values are read from rule table and checking owner and owner_value
    *from zrule_id table and inserted into ZNCRFID **************
    SELECT * FROM zrule_id INTO CORRESPONDING FIELDS OF TABLE it_ruleid
    WHERE zrule_id IN ('OWNER1', 'OWNER2').
    append IT_RULEID.
    LOOP AT ncrf WHERE z9gl_sla_flag EQ 'Y'.
    READ TABLE it_ruleid WITH KEY zowners = ncrf-zowners
    zowners_value = ncrf-zowners_value.
    IF ncrf-zowners = it_ruleid-zowners AND ncrf-zowners_value =
    it_ruleid-zowners_value AND ncrf-z9gl_sla_flag ='Y'.
    itab-zncrf_id = ncrf-zncrf_id.
    itab-zncrf_l4_name = ncrf-zncrf_l4_name.
    itab-z9gl_sla_flag = ncrf-z9gl_sla_flag.
    itab-zdate_changed = sy-datum.
    itab-ztime_changed = sy-uzeit.
    itab-zowners = it_ruleid-zowners.
    itab-zowners_value = it_ruleid-zowners_value.
    APPEND itab.
    ENDIF.
    ENDLOOP.
    modify database table zncrfid FROM ITAB
    LOOP AT itab.
    WRITE:/ itab-zncrf_id, itab-zncrf_l4_name, itab-z9gl_sla_flag,
    itab-zowners, itab-zowners_value, itab-zdate_changed,
    itab-ztime_changed.
    zncrfid-zncrf_id = itab-zncrf_id.
    zncrfid-zncrf_l4_name = itab-zncrf_l4_name.
    zncrfid-z9gl_sla_flag = itab-z9gl_sla_flag.
    zncrfid-zowners = itab-zowners.
    zncrfid-zowners_value = itab-zowners_value.
    zncrfid-zdate_changed = itab-zdate_changed.
    zncrfid-ztime_changed = itab-ztime_changed.
    INSERT INTO zncrfid VALUES zncrfid.
    ENDLOOP.
    ENDIF.
    ENDIF.
    *CALL FUNCTION 'DATE_TO_DAY'
    EXPORTING
    DATE = sy-datum
    IMPORTING
    WEEKDAY = file.
    **CHECKING FOR THE FIRST MONDAY OF THE MONTH.
    dates = sy-datum.
    shift dates by 6 places left.
    if file CO 'monday' and dates < 7 and dates >= 1.
    else.
    message e004(zmsg2).
    endif.
    EMAIL SEND TO OWNERS LIST
    **Fill the mail body in i_message.
    get email id's from database into internal table et_mailid
    Fill the document data.
    *g_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
    *g_doc_data-obj_langu = sy-langu.
    *g_doc_data-obj_name = 'SAPRPT'.
    *g_doc_data-obj_descr = c_subject .
    *g_doc_data-sensitivty = 'F'.
    Describe the body of the message
    Information about structure of data tables
    *CLEAR i_packing_list.
    *REFRESH i_packing_list.
    *i_packing_list-transf_bin = space.
    *i_packing_list-head_start = 1.
    *i_packing_list-head_num = 0.
    *i_packing_list-body_start = 1.
    *DESCRIBE TABLE i_message LINES i_packing_list-body_num.
    *i_packing_list-doc_type = 'RAW'.
    *APPEND i_packing_list.
    Add the recipients email address
    *LOOP AT mailid.
    *CLEAR i_receivers.
    *i_receivers-receiver = mailid-zemail_id.
    *i_receivers-rec_type = 'U'.
    *i_receivers-com_type = 'INT'.
    *i_receivers-notif_del = 'X'.
    *i_receivers-notif_ndel = 'X'.
    *APPEND i_receivers.
    *ENDLOOP.
    Call the FM to post the message to SAPMAIL
    *CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    *EXPORTING
    *document_data = g_doc_data
    *put_in_outbox = 'X'
    *commit_work = 'X'
    *IMPORTING
    *sent_to_all = g_sent_all
    *TABLES
    *packing_list = i_packing_list
    *contents_txt = i_message
    *receivers = i_receivers
    *EXCEPTIONS
    *too_many_receivers = 1
    *document_not_sent = 2
    *document_type_not_exist = 3
    *operation_no_authorization = 4
    *parameter_error = 5
    *x_error = 6
    *enqueue_error = 7
    *OTHERS = 8.
    Store function module return code
    *g_error = sy-subrc.
    Get i_receivers return code
    *LOOP AT i_receivers.
    *ENDLOOP.
    **Instructs mail send program for SAPCONNECT to send email(rsconn01)
    *WAIT UP TO 2 SECONDS.
    *IF g_error EQ 0.
    *SUBMIT zgbl_sla_per WITH mode = 'INT'
    *WITH output = 'X'
    *AND RETURN.
    REWARD IF FOUND USEFULL,
    Cheers,

  • How to send mail with attachment

    Hi,
    How to send mail with word document as attachment in oracle pl/sql.
    kindly help me .
    thank you
    regards
    P Prakash

    create or replace procedure pdf_mail(
        p_sender     varchar2, -- sender, example: 'Me <[email protected]>'
        p_recipients varchar2, -- recipients, example: 'Someone <[email protected]>'
        p_subject    varchar2, -- subject
    p_text   varchar2, -- text
    p_filename  varchar2, -- name of pdf file
    p_blob   blob     -- pdf file
    ) is
      conn      utl_smtp.connection;
      i number;
      len number;
    BEGIN
      conn := demo_mail.begin_mail(
        sender     => p_sender,
        recipients => p_recipients,
        subject    => p_subject,
        mime_type  => demo_mail.MULTIPART_MIME_TYPE);
      demo_mail.begin_attachment(
        conn         => conn,
        mime_type    => 'application/pdf',
        inline       => TRUE,
        filename     => p_filename,
        transfer_enc => 'base64');
        -- split the Base64 encoded attachment into multiple lines
       i   := 1;
       len := DBMS_LOB.getLength(p_blob);
       WHILE (i < len) LOOP
          IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
             UTL_SMTP.Write_Raw_Data (conn
                                    , UTL_ENCODE.Base64_Encode(
                                            DBMS_LOB.Substr(p_blob, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
          ELSE
             UTL_SMTP.Write_Raw_Data (conn
                                    , UTL_ENCODE.Base64_Encode(
                                            DBMS_LOB.Substr(p_blob, (len - i)+1,  i)));
          END IF;
          UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
          i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
       END LOOP;
      demo_mail.end_attachment(conn => conn);
      demo_mail.attach_text(
        conn      => conn,
        data      => p_text,
        mime_type => 'text/html');
      demo_mail.end_mail( conn => conn );
    END;
    ref:
    http://www.plpdf.com/23-1725.html
    Edited by: Mahanam on Jan 9, 2011 10:32 PM

  • Mail:send mail:attachment. Is there a simplest way to send a file as an email attachment ? or more correct ?

    <satellite:form  method="post" id="contact-form" enctype="multipart/form-data">
         <input type="file" name="adjunto" />
    </satellite:form>
    FTValList ftListaFichero = new FTValList(1);
    ftListaFichero.setValBLOB(ics.GetVar("adjunto_file"), ics.GetBin("adjunto"));
      <mail:send
           to="<%=to_emailaddress %>"
           from="<%=from_emailaddress%>"
           subject="Subject"
           body="<%=body %>" >
        <mail:attachment value='<%=ftListaFichero.getVal(ics.GetVar("adjunto_file"))%>'/>
      </mail:send>
    http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/mail-attachment.html
    http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/mail-send.html
    Regards,

    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

  • How to Send mail in oracle 10g

    I am new in oracle developer.....we are using oracle 10g developer...how to send mail through oracle 10g on a button click.pease help me.
    Thanks in advance

    This question have been asked many times on this forum, see if you get help from following:
    https://forums.oracle.com/message/5395438#5395438
    Search results: https://forums.oracle.com/thread/search.jspa?peopleEnabled=true&userID=&containerType=&container=&q=form+email
    Check this out as well:
    http://nzchaudhry.wordpress.com/2013/05/31/send-report-via-email-attachment-in-oracle-forms-10g/
    You can find init.ora or initSID.ora file under $ORACLE_HOME/dbs on linux and on Windows under $ORACLE_HOME/database. Otherwise you can create it using "create pfile from spfile" command
    Aneel

  • How to send mail to distribution list ?

    Hi Everybody,
    Pls let me know how to send mail to distributed list???
    Thanks & Regards,
    raju<b></b>

    Hi ,
      Use Function Module 'SO_NEW_DOCUMENT_SEND_API1'.
      U need to pass Distribution list to Receiver and 'C' to receiver type refer the below code for clarification.
    Determine the Distribution List.
            gv_rec_list-receiver = gv_distribution.
            gv_rec_list-rec_type = 'C'.
            APPEND gv_rec_list.
    Check if Distribution List is deleted.
            SELECT SINGLE objnam
                     FROM soid
                     INTO lc_objnam
                     WHERE objnam = gv_rec_list AND
                           dlitp  = lc_dli.
            IF sy-subrc = 0.
              CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
                EXPORTING
                  document_data              = gv_doc_data
                  document_type              = 'RAW'
                  put_in_outbox              = 'X'
                TABLES
                  object_content             = gv_obj_cont
                  receivers                  = gv_rec_list
                EXCEPTIONS
                  too_many_receivers         = 1
                  document_not_sent          = 2
                  document_type_not_exist    = 3
                  operation_no_authorization = 4.
              CASE sy-subrc.
                WHEN '1'.
                 message i001(as) with 'TOO MANY RECEIVERS'.
                  EXIT.
                WHEN '2'.
                 message i001(as) with 'DOCUMENT NOT SENT'.
                  EXIT.
                WHEN '3'.
                 message i001(as) with 'DOCUMENT TYPE DOES NOT EXIST'.
                  EXIT.
                WHEN '4'.
                 message i001(as) with 'OPERATION NO AUTHORIZATION'.
                  EXIT.
              ENDCASE.
              Hope this might have helped you.
    Thanks,
    Prashanth

  • How can send mails using hotmail/rediffmail domain name?

    I have used the below code to send a mail using javamail API?Even when I am sending my application does not have notified any of error/exceptions,But the message is not reached to I have given receipient's address in the to field.
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class Sendmail1 extends HttpServlet {
    private String smtpHost;
    // Initialize the servlet with the hostname of the SMTP server
    // we'll be using the send the messages
    public void init(ServletConfig config)
    throws ServletException {
    super.init(config);
    smtpHost = config.getInitParameter("smtpHost");
    //smtpHost = "sbm5501";
    smtpHost = "www.rediffmail.com";
    public void doGet(HttpServletRequest request,HttpServletResponse response)
    throws ServletException, java.io.IOException {
    String from = request.getParameter("from");
    String to "[email protected]";
    String cc = "[email protected]";
    String bcc ="[email protected]";
    String smtp ="www.rediffmail.com";
    String subject = "hai";
    String text = "Hai how r u";
    PrintWriter writer = response.getWriter();
    if (subject == null)
    subject = "Null";
    if (text == null)
    text = "No message";
    String status;
    try {
    // Create the JavaMail session
    java.util.Properties properties = System.getProperties();
    if (smtp == null)
    smtp = "www.rediffmail.com";
    properties.put("mail.smtp.host", smtp);
    Session session = Session.getInstance(properties, null);
    //to connect
    //Transport transport =session.getTransport("smtp");
    //transport.connect(smtpHost,user,password);
    // Construct the message
    MimeMessage message = new MimeMessage(session);
    // Set the from address
    Address fromAddress = new InternetAddress(from);
    message.setFrom(fromAddress);
    // Parse and set the recipient addresses
    Address[] toAddresses = InternetAddress.parse(to);
    message.setRecipients(Message.RecipientType.TO,toAddresses);
    Address[] ccAddresses = InternetAddress.parse(cc);
    message.setRecipients(Message.RecipientType.CC,ccAddresses);
    Address[] bccAddresses = InternetAddress.parse(to);
    message.setRecipients(Message.RecipientType.BCC,bccAddresses);
    // Set the subject and text
    message.setSubject(subject);
    message.setText(text);
    Transport.send(message);
    //status = "<h1>Congratulations,</h1><h2>Your message was sent.</h2>";
    } catch (AddressException e)
    status = "There was an error parsing the addresses. " + e;
    } catch (SendFailedException e)
    status = "<h1>Sorry,</h1><h2>There was an error sending the message.</h2>" + e;
    } catch (MessagingException e)
    status = "There was an unexpected error. " + e;
    // Output a status message
    response.setContentType("text/html");
    writer.println("<title>sendForm</title><body bgcolor= ><b><h3><font color=green><CENTER>CALIBERINFO.COM</CENTER></h3>Your message was sent to recepient(s).<br><font color=red>"+"\n"+to);
    writer.println("<br><br><a href=e:/mail/javamail/mail.html>back to compose</a>");
    writer.close();
    Please any one help me out from this probs.
    Awaiting for yours reply,
    or give me a reply to: [email protected]
    Regards,
    @maheshkumar.k

    Hi,
    how can send mails using hotmail/rediffmail domain name?In your java application,you specified www.rediffmail.com as your
    smtp server.But that is the address of that website.Try will a smtp
    server instead.For a list of free smtp servers,please visit http://www.thebestfree.net/free/freesmtp.htm
    Hope this helps.
    Good Luck.
    Gayam.Srinivasa Reddy
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support/

  • How to upload datas in excel sheet through BDC

    Hi,
        I know how to upload datas in Text format  through BDC...Suppose even when datas are in .xls format,I saved that file as Text(tab delimited) format...then file become text format and it can be easily uploaded....
        So, I want to know How to upload datas in excel sheet through BDC

    hi,
    try this Example, hope useful to u, assign me point.
    report ZMSV1_BDC_CALL
           no standard page heading line-size 255.
    *include bdcrecx1.
    *parameters: dataset(132) lower case.
       DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
      If it is nessesary to change the data section use the rules:
      1.) Each definition of a field exists of two lines
      2.) The first line shows exactly the comment
          '* data element: ' followed with the data element
          which describes the field.
          If you don't have a data element use the
          comment without a data element name
      3.) The second line shows the fieldname of the
          structure, the fieldname must consist of
          a fieldname and optional the character '_' and
          three numbers and the field length in brackets
      4.) Each field must be type C.
    Generated data section with specific formatting - DO NOT CHANGE  ***
    data: begin of record,
    data element: BUKRS
            BUKRS_001(004),
    data element: KTOKK
            KTOKK_002(004),
    data element: NAME1_GP
            NAME1_003(035),
    data element: SORTL
            SORTL_004(010),
    data element: ORT01_GP
            ORT01_005(035),
    data element: LAND1_GP
            LAND1_006(003),
    data element: SPRAS
            SPRAS_007(002),
    data element: BANKS
            BANKS_01_008(003),
    data element: BANKK
            BANKL_01_009(015),
    data element: BANKN
            BANKN_01_010(018),
          end of record.
    End generated data section ***
    data: itab like record occurs 0 .
    data: it_bdc type bdcdata occurs 0 with header line.
    data: it_msg type bdcmsgcoll occurs 0 with header line.
    parameter p_file type rlgrap-filename default 'c:\vendor.txt' obligatory
    start-of-selection.
    perform open_dataset using p_file.
    perform open_group.
    *perform close_group.
    *perform close_dataset using dataset.
    *&      Form  open_dataset
          text
         -->P_P_FILE  text
    form open_dataset  using    p_p_file.
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
      CODEPAGE                      = ' '
      FILENAME                      = p_file
      FILETYPE                      = 'DAT'
      HEADLEN                       = ' '
      LINE_EXIT                     = ' '
      TRUNCLEN                      = ' '
      USER_FORM                     = ' '
      USER_PROG                     = ' '
      DAT_D_FORMAT                  = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        data_tab                      = itab
    EXCEPTIONS
      CONVERSION_ERROR              = 1
      FILE_OPEN_ERROR               = 2
      FILE_READ_ERROR               = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.                    " open_dataset
    *&      Form  open_group
          text
    -->  p1        text
    <--  p2        text
    form open_group .
    loop at itab into record.
    perform bdc_dynpro      using 'SAPMF02K' '0105'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RF02K-KTOKK'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'RF02K-BUKRS'
                                  record-BUKRS_001.
    perform bdc_field       using 'RF02K-KTOKK'
                                  record-KTOKK_002.
    perform bdc_dynpro      using 'SAPMF02K' '0110'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-ORT01'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'LFA1-NAME1'
                                  record-NAME1_003.
    perform bdc_field       using 'LFA1-SORTL'
                                  record-SORTL_004.
    perform bdc_field       using 'LFA1-ORT01'
                                  record-ORT01_005.
    perform bdc_field       using 'LFA1-LAND1'
                                  record-LAND1_006.
    perform bdc_field       using 'LFA1-SPRAS'
                                  record-SPRAS_007.
    perform bdc_dynpro      using 'SAPMF02K' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFA1-KUNNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFBK-KOINH(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_field       using 'LFBK-BANKS(01)'
                                  record-BANKS_01_008.
    perform bdc_field       using 'LFBK-BANKL(01)'
                                  record-BANKL_01_009.
    perform bdc_field       using 'LFBK-BANKN(01)'
                                  record-BANKN_01_010.
    perform bdc_dynpro      using 'SAPMF02K' '0130'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFBK-BANKS(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTR'.
    perform bdc_dynpro      using 'SAPMF02K' '0210'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFB1-AKONT'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0215'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFB1-ZTERM'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPMF02K' '0220'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'LFB5-MAHNA'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    call transaction 'FK01' using it_bdc mode 'A' update 'S'
                                 messages into it_msg.
      write:/ sy-subrc.
        perform message_formatwrite.
    refresh it_bdc.
    clear it_bdc.
    endloop.
    endform.                    " open_group
    *&      Form  message_formatwrite
          text
    -->  p1        text
    <--  p2        text
    form message_formatwrite .
    data:l_msg(10).
    loop at it_msg.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
       ID              = SY-MSGID
       LANG            = sy-langu
       NO              = SY-MSGNO
       V1              = SY-MSGV1
       V2              = SY-MSGV2
       V3              = SY-MSGV3
       V4              = SY-MSGV4
    IMPORTING
       MSG             = l_msg
    EXCEPTIONS
       NOT_FOUND       = 1
       OTHERS          = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endloop.
    endform.                    " message_formatwrite
    *&      Form  bdc_dynpro
          text
         -->P_0112   text
         -->P_0113   text
    form bdc_dynpro  using    value(p_0112)
                              value(p_0113).
    it_bdc-program = p_0112.
      it_bdc-dynpro = p_0113.
      it_bdc-dynbegin = 'X'.
      append it_bdc.
      clear it_bdc.
    endform.                    " bdc_dynpro
    *&      Form  bdc_field
          text
         -->P_0117   text
         -->P_0118   text
    form bdc_field  using    value(p_0117)
                             value(p_0118).
    it_bdc-fnam = p_0117.
      it_bdc-fval = p_0118.
      append it_bdc.
      clear it_bdc.
    endform.                    " bdc_field
    Regards
    fareedas

  • How to Send Multiple Attachment by SOAP Adapter

    Hi,
    How to send multiple attachment by SOAP Adapter.
    I am able to send single attachment but at the time of sending multiple attachment i am not able to see in SXMB_moni.
    Regards,
    Anurag

    On the communication channel, please check the 'Do Not Use SOAP envelope' option. Also, please, add the "nosoap" attribute to the SOAP adapter caller. Check the note below for more information
    #856597 FAQ: XI 3.0 / PI 7.0 / PI 7.1 SOAP Adapter
    > "How does the nosoap mode work for the SOAP sender adapter?"

  • How to send an attachment with adobe form

    Hi
    in my application i have two process intiator and approval process both are adobe interactive forms,according to my scenarion i need to send an attachment(pdf or word document....)in intiatior to approval process,can pleasse tell me how to send the attachment.
    Thanks
    Raju
    Edited by: raju on Oct 7, 2008 6:39 AM

    hi!
    chk these links .
    Re: Sending Adobe Interactive Forms via Email
    Re: Saving and sending Adobe Form pdf from WebDynpro
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/176882c3-0401-0010-9fbc-d9fa1f713a73
    thanks
    vishal

  • How to send mail in html format in jsp???

    Hello everybody,
    I have two jsp pages.In one page I have the heading like Date,Transaction.I am retriving data from my second jsp page.And I hae included the second jsp page to my first jsp page.How to send mail this content in html format.
    Thanks
    Srikant

    MimeMessage m = new MimeMessage(session);
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setContent(content, "text/html");this if u need to send a mail content as html

Maybe you are looking for

  • Significant problem saving files in Photoshop CS2

    I am running Photoshop CS2, with Windows Vista Home Edition. My problem is a new one, as Ive been running the program the exact same way since I bought it several years ago. Two weeks ago I bought an Intuos 3 tablet, and installed the software that c

  • Two firewall questions...

    I went into my firewall to configure it for the World of Warcraft downloader (although it didn't appear that I needed to after the fact). Two questions... By default, is "Network Time" the only box that should be clicked? Is there any negative to ope

  • Default seeting for Exchange rate fixed in PO ..?

    Hi All Can anybody give some inputs , how to make exchange rate fixed tick mark in Import PO as default setting . Any configuration part is there to do this settings in MM-IMG. Thanks sap-mm

  • Where do I find (Library/Receipts)?

    Where do I find (Library/Receipts)?

  • BW Web Service J2EE Engine

    Hello, Please can anyone tell me, 1. if the J2EE Engine must be installed to send XML data to BW using the HTTP port provided under the WAS soap service? I am new working with XML data for BW and we do not have the engine installed. I have followed t