Problem in attaching XLS file to decision step

Hi All,
I have a requirement where i have to add a attachment to workflow while triggering the workflow itself and attach that to user decisition step, i have searched the forum for the same and i got some piece of code which i mention here.
include <CNTN01>.
DATA: attach TYPE swc_object.
DATA:it_objhex TYPE solix_tab.
DATA:container TYPE SWCONT OCCURS 0 WITH HEADER LINE,
      SIMPLE_CONTAINER TYPE STANDARD TABLE OF SWR_CONT
                                   WITH HEADER LINE.
DATA :ml TYPE STANDARD TABLE OF  swr_messag ,
      ms TYPE STANDARD TABLE OF  swr_mstruc ,
  rc LIKE  sy-subrc,
  wi LIKE  swr_struct-workitemid.
swc_container l_cont.
DATA folder_id TYPE sofdk.
DATA lt_objcont TYPE STANDARD TABLE OF soli.
DATA ls_objcont TYPE soli.
DATA l_obj_data TYPE sood1.
DATA l_obj_id TYPE soodk.
DATA document_id TYPE sofmk.
DATA lt_objhead TYPE STANDARD TABLE OF soli.
data wa_soli type soli.
data wa_solix type solix.
data lt_solix type STANDARD TABLE OF solix .
FIELD-SYMBOLS: <ptr_text> type soli,
<ptr_x> type any,
<ptr_hex> type solix.
define hex_to_cont.
&1 Table of structure SOLIX
&2 Table of structure SOLI
refresh &2.
loop at &1 into wa_solix.
clear wa_soli.
assign wa_soli to <ptr_hex> casting.
move wa_solix to <ptr_hex>.
append wa_soli to &2.
endloop.
end-of-definition.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETER f_n TYPE string.
SELECTION-SCREEN END OF BLOCK b1.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region = 'B'
IMPORTING
folder_id = folder_id
EXCEPTIONS
OTHERS = 1.
*get the XLS file into a table
CALL FUNCTION 'GUI_UPLOAD'
   EXPORTING
     filename                      = f_n
    FILETYPE                      = 'BIN'
   tables
     data_tab                      = lt_solix
IF sy-subrc <> 0.
ENDIF.
l_obj_data-objnam = 'SOFM'.
l_obj_data-objdes = 'test'.
l_obj_data-file_ext = 'PDF'.
hex_to_cont lt_solix LT_OBJCONT.
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
folder_id = folder_id
object_type = 'EXT' "'RAW'
object_hd_change = l_obj_data
IMPORTING
object_id = l_obj_id
TABLES
objhead = lt_objhead
objcont = LT_OBJCONT
EXCEPTIONS
active_user_not_exist = 35
folder_not_exist = 6
object_type_not_exist = 17
owner_not_exist = 22
parameter_error = 23
OTHERS = 1000.
COMMIT WORK.
Data: tb_key(100).
IF sy-subrc = 0.
document_id-foltp = folder_id-foltp.
document_id-folyr = folder_id-folyr.
document_id-folno = folder_id-folno.
document_id-doctp = l_obj_id-objtp.
document_id-docyr = l_obj_id-objyr.
document_id-docno = l_obj_id-objno.
ELSE.
ENDIF.
Concatenate folder_id-foltp folder_id-folyr folder_id-folno
into tb_key.
swc_create_object attach 'SOFM' tb_key.
SWC_SET_ELEMENT CONTAINER 'SOFM' attach.
LOOP AT CONTAINER.
    MOVE-CORRESPONDING CONTAINER TO SIMPLE_CONTAINER.
    APPEND SIMPLE_CONTAINER.
    CLEAR CONTAINER.
ENDLOOP.
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
    EXPORTING
      task                      = 'WS95000377'
   IMPORTING
     return_code               = rc
     workitem_id               = wi
   TABLES
     input_container           = SIMPLE_CONTAINER
     message_lines             = ml
     message_struct            = ms
but my problem is i am getting error in triggering workflow it says"1. The container passed has errors
2.Object type and current value missing for element 'SOFM'"
Please guide me on this..
Thanks,
Kishore

Hi All,
I have a requirement where i have to add a attachment to workflow while triggering the workflow itself and attach that to user decisition step, i have searched the forum for the same and i got some piece of code which i mention here.
include <CNTN01>.
DATA: attach TYPE swc_object.
DATA:it_objhex TYPE solix_tab.
DATA:container TYPE SWCONT OCCURS 0 WITH HEADER LINE,
      SIMPLE_CONTAINER TYPE STANDARD TABLE OF SWR_CONT
                                   WITH HEADER LINE.
DATA :ml TYPE STANDARD TABLE OF  swr_messag ,
      ms TYPE STANDARD TABLE OF  swr_mstruc ,
  rc LIKE  sy-subrc,
  wi LIKE  swr_struct-workitemid.
swc_container l_cont.
DATA folder_id TYPE sofdk.
DATA lt_objcont TYPE STANDARD TABLE OF soli.
DATA ls_objcont TYPE soli.
DATA l_obj_data TYPE sood1.
DATA l_obj_id TYPE soodk.
DATA document_id TYPE sofmk.
DATA lt_objhead TYPE STANDARD TABLE OF soli.
data wa_soli type soli.
data wa_solix type solix.
data lt_solix type STANDARD TABLE OF solix .
FIELD-SYMBOLS: <ptr_text> type soli,
<ptr_x> type any,
<ptr_hex> type solix.
define hex_to_cont.
&1 Table of structure SOLIX
&2 Table of structure SOLI
refresh &2.
loop at &1 into wa_solix.
clear wa_soli.
assign wa_soli to <ptr_hex> casting.
move wa_solix to <ptr_hex>.
append wa_soli to &2.
endloop.
end-of-definition.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETER f_n TYPE string.
SELECTION-SCREEN END OF BLOCK b1.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region = 'B'
IMPORTING
folder_id = folder_id
EXCEPTIONS
OTHERS = 1.
*get the XLS file into a table
CALL FUNCTION 'GUI_UPLOAD'
   EXPORTING
     filename                      = f_n
    FILETYPE                      = 'BIN'
   tables
     data_tab                      = lt_solix
IF sy-subrc <> 0.
ENDIF.
l_obj_data-objnam = 'SOFM'.
l_obj_data-objdes = 'test'.
l_obj_data-file_ext = 'PDF'.
hex_to_cont lt_solix LT_OBJCONT.
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
folder_id = folder_id
object_type = 'EXT' "'RAW'
object_hd_change = l_obj_data
IMPORTING
object_id = l_obj_id
TABLES
objhead = lt_objhead
objcont = LT_OBJCONT
EXCEPTIONS
active_user_not_exist = 35
folder_not_exist = 6
object_type_not_exist = 17
owner_not_exist = 22
parameter_error = 23
OTHERS = 1000.
COMMIT WORK.
Data: tb_key(100).
IF sy-subrc = 0.
document_id-foltp = folder_id-foltp.
document_id-folyr = folder_id-folyr.
document_id-folno = folder_id-folno.
document_id-doctp = l_obj_id-objtp.
document_id-docyr = l_obj_id-objyr.
document_id-docno = l_obj_id-objno.
ELSE.
ENDIF.
Concatenate folder_id-foltp folder_id-folyr folder_id-folno
into tb_key.
swc_create_object attach 'SOFM' tb_key.
SWC_SET_ELEMENT CONTAINER 'SOFM' attach.
LOOP AT CONTAINER.
    MOVE-CORRESPONDING CONTAINER TO SIMPLE_CONTAINER.
    APPEND SIMPLE_CONTAINER.
    CLEAR CONTAINER.
ENDLOOP.
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
    EXPORTING
      task                      = 'WS95000377'
   IMPORTING
     return_code               = rc
     workitem_id               = wi
   TABLES
     input_container           = SIMPLE_CONTAINER
     message_lines             = ml
     message_struct            = ms
but my problem is i am getting error in triggering workflow it says"1. The container passed has errors
2.Object type and current value missing for element 'SOFM'"
Please guide me on this..
Thanks,
Kishore

Similar Messages

  • Problem in attach a file during mail

    I am facing problem while attaching a file during mailing

    What file ?
    If its some Office document (word / excel) .. first open the document and then (...)-->share and select your mail client ..

  • Problem in attaching a file

    hello
    I have a problem in attaching a file from client site
    Actually i am building a website and i want that client attach any file in login form and that must be attach in my database. I am using a database MsAccess.
    Please help me
    I am waiting for ur reply
    Ashish

    actually i want that when a user open my website register form then he must attached their resume in it
    so i want to know how can i make a field of attaching.
    please reply
    I am waiting for your reply

  • Problem reading attached PDF files

    <!--[if gte mso 9]><xml>
    </xml><![endif]--><!--[if gte mso 9]><xml>
    Normal
    0
    false
    false
    false
    MicrosoftInternetExplorer4
    </xml><![endif]--><!--[if gte mso 9]><xml>
    </xml><![endif]--><!--[if !mso]>
    <object
         classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui>
    </object>
    <style>
    st1\:*{behavior:url(#ieooui) }
    </style>
    <![endif]-->
    <!--[if gte mso 10]>
    <style>
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";
    mso-ansi-language:#0400;
    mso-fareast-language:#0400;
    mso-bidi-language:#0400;}
    </style>
    <![endif]-->
    Hello.
    At my work, we use JavaMail (version 1.4.1) in server
    programs, processing mails with attached files from customers. Mostly it is
    TIFF images, but it can also be PDF
    files, and the attached files are extracted and saved for further processing.
    Sometimes, we have a problem, reading attached PDF
    files. The files get saved, but is of size 0 bytes. If I forward it, however,
    using an Outlook client, the forwarded item can be read by our JavaMail program, and files saved OK.
    I have tried to forward it using JavaMail, but I cannot
    compose the mail parts, that fails, however - of the same reasons: I cannot
    read the them in:-)
    It looks like it's when the mail is send from a Mac.
    Anyway, the part to read is of content type "APPLICATION/APPLEFILE" whereas when it's forwarded, it's content
    type is "APPLICATION/OCTET-STREAM"
    The way, I read the part, is to check if the part is an
    instance of an InputStream, and then saving into a byte array, like this:
    h5. Object
    obj = part.getContent();
    if (obj instanceof
    InputStream) {
    InputStream
    inStream = part.getInputStream();
    byte[]
    buffer = new byte[BUFFER_SIZE];
    int
    bytesRead;
    BufferedOutputStream
    outBufStream = new BufferedOutputStream(new FileOutputStream(attFileName));
    while
    ((bytesRead = inStream.read(buffer)) != -1)
    outBufStream.write(buffer,
    0, bytesRead);
    inStream.close();
    h5. outBufStream.close();
    Problem
    is that .read() method always returns -1 when content type Is APPLICATION/APPLEFILE,
    so a file of 0 bytes are created.
    Interesting is perhaps, that debugging shows me that the
    part instance of the InputStream actually is a
    com.sun.mail.util.BASE64DecoderStream when it fails, and a
    com.sun.mail.util.QPDecoderStream
    when it works OK.
    So I have this idea, that I's a certain type of decoder
    stream we're missing? We use Java 1.6.0 update 10 and JavaMail 1.4.1. and since
    we use java 1.6 we use the JAF framework from that one, I guess?
    Hope you guys can help?
    Thanks in advance, Per Jensen
    [email protected]

    We have two (MS Exchange) servers (from trace log):
    Microsoft Exchange IMAP4rev1-server version 5.5.2650.23
    Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.7226.0
    - the first one is the one, we're using here, but I have tried on the other, newer version too, and it didn't help either.
    But I've found out a couple of interesting things:
    1: Debugging shows me, that the part instance of the InputStream actually is a com.sun.mail.util.BASE64DecoderStream when it fails, and if I forward the mail via Outlook as described earlier, and it can be read OK, the part is a com.sun.mail.util.QPDecoderStream instance.
    2: I can save the WHOLE message to a file, using message.getInputStream(), and when I opens the file I can find the individual attachments - as well as the bodytext, if any - as they are separated with the disposition, mimetype and filename fields, showed as plain text. And the attachments are showed as blocks of characters; I guess it's the ascii character representation of the bytes. Here's a snippet, note the first two sentences. They seemes to be added, somehow, when I dump the message to file(?):
    <START OF DUMPED FILE>
    This message is in MIME format. Since your mail reader does not understand
    this format, some or all of this message may not be legible.
    ------_=_NextPart_000_01C9A8A2.19479FE4
    Content-Type: text/plain;
         charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    (The body text here)
    ------_=_NextPart_000_01C9A8A2.19479FE4
    Content-Type: application/applefile;
         name="first_attachment.pdf"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
         filename="first_attachment.pdf"
    AAUWAAACAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAASgAAABAAAAAJAAAAWgAAACAAAAADAAAA
    egAAABAAAAABAAAAigAAI6IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAA1NzE2NSBCTkhhdWcucGRmJVBERi0xLjMKJbe+raoKMSAwIG9iago8PAovVHlwZSAv
    Q2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9L
    aWRzIFsgNCAwIFIgXQovQ291bnQgMQo+PgplbmRvYmoKMyAwIG9iago8PAovUHJvZHVjZXIgKEhh
    ...(and so on)
    DMgMDAwMDAgbg0KMDAwMDAwNTM1NSAwMDAwMCBuDQowMDAwMDA2NTA5IDAwMDAwIG4NCjAwMDAw
    MDc2NjUgMDAwMDAgbg0KdHJhaWxlcgo8PAovUm9vdCAxIDAgUgovSW5mbyAzIDAgUgovU2l6ZSAx
    MQo+PgpzdGFydHhyZWYKODgyNAolJUVPRgo=
    ------_=_NextPart_000_01C9A8A2.19479FE4
    Content-Type: application/applefile;
         name="second_attachment.pdf"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
         filename="second_attachment.pdf"
    AAUWAAACAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAASgAAABAAAAAJAAAAWgAAACAAAAADAAAA
    egAAABAAAAABAAAAigAAI9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAA1NzE4MSBCTkhhdWcucGRmJVBERi0xLjMKJbe+raoKMSAwIG9iago8PAovVHlwZSAv
    Q2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9L
    ...(and so on)
    <END OF DUMPED FILE>I understand that it's base64 encoded and must be decoded, and I have tried to copy/paste the blocks separately, run them through the com.sun.mail.util.BASE64DecoderStream, and saving them as PDF files, which works fine(!).
    As the solution seems to be painfull: Parse the mail to find where the attachments starts and stops and saving them as files, I hope you guys can send me on the right track?
    PS: The trace log when dumping the file shows everything OK, I think. Here's a bit of the log at the end of dumping the message:
    (...)MTUgMDAwMDAgbg0KMDAwMDAwNTg2NyAwMDAwMCBuDQowMDAwMDA3MDIxIDAwMDAwIG4NCjAwMDAw
    MDgxNzcgMDAwMDAgbg0KdHJhaWxlcgo8PAovUm9vdCAxIDAgUgovSW5mbyAzIDAgUgovU2l6ZSAx
    MQo+PgpzdGFydHhyZWYKOTMzNgolJUVPRgo=
    ------_=_NextPart_000_01C9A8A2.19479FE4--
    A10 OK FETCH fuldført.
    A11 FETCH 1 (BODY[TEXT]<40336.16384>)
    * 1 FETCH (BODY[TEXT]<40336> {0}
    20/03-09 15:18:21,445 3 Done, writing bytes to ByteArrayOutputStream. Size: 40336 bytes (..common.mail.MailUtil.dumpMessageToFile.dumpMessageToFile)
    20/03-09 15:18:21,445 3 Done, writing ByteArrayOutputStream to file. (..common.mail.MailUtil.dumpMessageToFile.dumpMessageToFile)
    A11 OK FETCH fuldført.

  • How do  I add an attachment (xls file in my case) to the pdf

    Hello,
    I need to add a excel file as attachment in the generated PDF form.
    Someone could tell me if this is possible and how to do it?
    Thanks for the help

    Hi,
    I did little research and found that we can attach any attachment to Interactive form.
    1.Get the XLS attachment(You can add File Upload UI Element(Say XLS) to your Application  and Bind  data,filename and mime Type  Properties)   with this , user can choose the XLS file to be attached from Desk top.
    2. In the Interactive UI Element,bind the property "pdfsource" (Say PDF_SOURCE), this will  contains the PDF in xstring format.
    3. Add a button (Say Attach XLS) on the application and add an Action Method.(Say ADD)
    4.in the Action Method(ADD) of the Button, follow the Steps.
        1. Get the File(XLS File) Uploaded,Mimi Type  from File Uploade UI Element(Say lv_xls_data,lv_mimetype,lv_file_name)
         2. get the pdf source( PDF_SOURCE) from Interactive form.(Say lv_pdf_source)
         use the Following Code
    DATA: l_fp           TYPE REF TO if_fp,
            l_pdfobj       TYPE REF TO if_fp_pdf_object,
            l_pdf          TYPE xstring,
            l_att          TYPE xstring,
            l_fpex         TYPE REF TO cx_fp_runtime,
            l_type         TYPE string,
            l_errmsg       TYPE string,
            l_short        TYPE sdba_actid,
            l_ext          TYPE sdba_funct,
            l_filename     TYPE skwf_filnm,
            l_mimetype     TYPE skwf_mime,
            l_attachment   TYPE sfpattachments,
            l_attachments  TYPE tfpattachments,
            l_len          TYPE i,
            l_tab          TYPE tsfixml,
            p_dest         TYPE rfcdest .
      MOVE cl_fp=>get_ads_connection( ) TO p_dest.
      l_mimetype   = lv_mimetype.
    * Get FP reference.
      l_fp = cl_fp=>get_reference( ).
      TRY.
    *     Create PDF Object.
          l_pdfobj = l_fp->create_pdf_object( connection = p_dest ).
    *     Set document.
          l_pdfobj->set_document( pdfdata = lv_pdf_source ).
           l_attachment-FILENAME = lv_file_name."Name of the Attached File.
          l_attachment-mimetype    = lv_mimetype.
          l_attachment-description = 'XLS_Attachment'.   
         l_attachment-data        = lv_xls_data."XLS File to Be attached .
          INSERT l_attachment INTO TABLE l_attachments.
          l_pdfobj->set_attachments( attachments = l_attachments ).
    *     Execute, call ADS.
          l_pdfobj->execute( ).
    *     Get result.
          l_pdfobj->get_document( IMPORTING pdfdata = l_pdf ).
        CATCH cx_fp_runtime_internal INTO l_fpex.           "#EC NO_HANDLER
        CATCH cx_fp_runtime_system INTO l_fpex.             "#EC NO_HANDLER
        CATCH cx_fp_runtime_usage INTO l_fpex.              "#EC NO_HANDLER
      ENDTRY.
    Finally "l_pdf" contains the PDF with Attached XLS and you can send this as PDF Document.
    Thanks.
    Uma

  • Problem opening a "xls" file

    Good day
    I'm having a difficulty opening a .xls file using a Ms Exel 2003.
    It prompt a box saying:
    The file you are trying to open, 'AA.xls' is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source
    before opening the file. Do you wan to open the file now?
    If i click Yes. Another pop up will show:
    The information you were working on might be lost. Ms. Office excel can try to recover it for you and i checked on the " recover my work and restart Ms.office excel"
    A blank Ms.Excel will be shown.
    The size of the file shown on the icon are still there but nothing contain in it.
    Pls. help.

    Hi,
    According to this error, this .xls file may be damaged. The following steps might help recover your file:
    1. Click the File menu
    2. Click Open
    3. Locate the file, but do not click the Open button.  Instead, click the drop-down arrow next to the Open button.
    4. Click "Open and Repair"
    5. In the dialog that pops up, choose "Repair".  If that does not work, try the "Extract Data".
    6. Let us know if this works.  If not, we will see what else we can come up with for you.
    Regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Problem downloading .doc, .xls file using servlet

    i have a servlet which downloads the files to client(browser). It works file for .txt file but .doc, .xls files are opend but they contain garbage.
    plz letr me know if u know problem!!!!!
    -amit

    Probably because you output them using the Writer you got from getWriter instead of using the OutputStream you can get from getOutputStream.

  • UTL_SMTP mail with attachment( Problem in attaching zip file)

    Hi All,
    I used the below code for sending email with attachment. but when i try to add the message body its not working in the sense its not attaching my file. when i commented that line its attaching the file.
    commented lines:
    -- utl_smtp.write_data(mail_conn,UTL_TCP.CRLF ||'Body' ||':'|| text || UTL_TCP.CRLF);
      --utl_smtp.write_data(mail_conn,UTL_TCP.CRLF||text || UTL_TCP.CRLF );How to resolve this issue???
    Complete procedure.
    create or replace
    procedure sssl_send_mail (
          p_sender varchar2,
          p_recipient varchar2,
          p_cc varchar2,
          p_subject varchar2,
          p_filename varchar2,
          text varchar2) is    
        --c utl_smtp.connection;
        v_raw raw(57);
        v_length integer := 0;
        v_buffer_size integer := 57;
        v_offset integer := 1;
        mailhost    VARCHAR2(64) := 'xxxxxxxxxx';
        port constant number(2):=25;
        timeout number :=180;
        mail_conn  utl_smtp.connection;  
    p_blob Blob;
    temp_os_file bfile;
    ex number; 
    begin 
       DBMS_LOB.CREATETEMPORARY(p_blob,true);
       temp_os_file := BFILENAME ('xxxxxxxx',p_filename);
       ex := dbms_lob.fileexists(temp_os_file);
          if ex = 1 then
             dbms_lob.fileopen(temp_os_file, dbms_lob.file_readonly);
             dbms_lob.loadfromfile(p_blob,temp_os_file, dbms_lob.getlength(temp_os_file));
             dbms_lob.fileclose(temp_os_file);
           end if;
       mail_conn := utl_smtp.open_connection(mailhost, port,timeout);
       utl_smtp.helo(mail_conn, mailhost);
       utl_smtp.mail(mail_conn, p_sender);
       utl_smtp.rcpt(mail_conn, p_recipient);
       utl_smtp.rcpt(mail_conn, p_cc);
       utl_smtp.open_data(mail_conn);
      utl_smtp.write_data(mail_conn,'From'||':'|| p_sender || UTL_TCP.CRLF);
      utl_smtp.write_data(mail_conn,'To'||':'|| p_recipient || UTL_TCP.CRLF);
      utl_smtp.write_data(mail_conn,'CC'||':'|| p_cc || UTL_TCP.CRLF);
      utl_smtp.write_data(mail_conn,'Subject' ||':'|| p_subject || UTL_TCP.CRLF);
    -- utl_smtp.write_data(mail_conn,UTL_TCP.CRLF ||'Body' ||':'|| text || UTL_TCP.CRLF);
      --utl_smtp.write_data(mail_conn,UTL_TCP.CRLF||text || UTL_TCP.CRLF );
        utl_smtp.write_data( mail_conn, 'Content-Disposition: attachment; filename="' || p_filename || '"' || utl_tcp.crlf);
        utl_smtp.write_data( mail_conn, 'Content-Transfer-Encoding: base64' || utl_tcp.crlf );
        utl_smtp.write_data( mail_conn, utl_tcp.crlf );
        v_length := dbms_lob.getlength(p_blob);    
        <<while_loop>>
        while v_offset < v_length loop
          dbms_lob.read( p_blob, v_buffer_size, v_offset, v_raw );
          utl_smtp.write_raw_data( mail_conn, utl_encode.base64_encode(v_raw) );
          utl_smtp.write_data( mail_conn, utl_tcp.crlf );
          v_offset := v_offset + v_buffer_size;
        end loop while_loop;
        utl_smtp.write_data( mail_conn, utl_tcp.crlf );
        utl_smtp.close_data(mail_conn);
        utl_smtp.quit(mail_conn);
      exception
        when utl_smtp.transient_error or utl_smtp.permanent_error then
          utl_smtp.quit(mail_conn);
          raise;
        when others then
        raise;
      end;Please help me out to resolve this issue.
    Thanks in advance.
    Cheers ,
    Shan.
    Edited by: Shan on 13 Jan, 2011 1:08 PM
    Edited by: Shan on 14 Jan, 2011 3:22 PM

    Hi,
    Some Problems i am facing with this procedure. when i try to add CC in this procedure. Its sending the mail for recipent , But the CC person not getting the mail. How to resolve this??
    create or replace
    PROCEDURE sssl_send_mail( p_sender varchar2,
          p_recipient varchar2,
          p_cc varchar2,
          p_subject varchar2,
          p_filename varchar2,
          text varchar2) is 
        /*LOB operation related varriables */
       v_src_loc  BFILE;
       l_buffer   RAW(200);
       l_amount   BINARY_INTEGER := 200;
       l_pos      INTEGER := 1;
       l_blob     BLOB := EMPTY_BLOB;
       l_blob_len INTEGER;
       v_amount   INTEGER;
        /*UTL_SMTP related varriavles. */
        v_connection_handle  UTL_SMTP.CONNECTION;
        v_from_email_address VARCHAR2(200);
        v_to_email_address   VARCHAR2(200) ;
        v_smtp_host          VARCHAR2(10) ;
        v_subject            VARCHAR2(500) ;
        l_message            VARCHAR2(3000);
        /* This send_header procedure is written in the documentation */
        PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
        BEGIN
        --dbms_output.put_line('entering into procedure');
        --dbms_output.put_line(pi_name || ': ' || pi_header);
          UTL_SMTP.WRITE_DATA(v_connection_handle,
                              pi_name || ': ' || pi_header || UTL_TCP.CRLF);
        END;
      BEGIN
       v_src_loc             := BFILENAME('BROKERREPORTS',p_filename);
       v_from_email_address  := p_sender;
       v_to_email_address    := p_recipient;
       v_smtp_host           := 'sbssld1'; --My mail server, replace it with yours.
       v_subject             := p_subject;
       l_message      := 'test';
        /*Preparing the LOB from file for attachment. */
        DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
        DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
        v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
        DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
        l_blob_len := DBMS_LOB.getlength(l_blob);
    /*UTL_SMTP related coding. */
        v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
        UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
        UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
        UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
        UTL_SMTP.OPEN_DATA(v_connection_handle);
        send_header('From', v_from_email_address || '<'||'>');
        send_header('TO', v_to_email_address || '<'||'>');
        send_header('CC', p_cc        || '<'||'>');
        send_header('Subject', v_subject);
        --MIME header.
       UTL_SMTP.WRITE_DATA(v_connection_handle,
                          'MIME-Version: 1.0' || UTL_TCP.CRLF);
       UTL_SMTP.WRITE_DATA(v_connection_handle,
                            'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            ' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
                            UTL_TCP.CRLF);
       UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
        -- Mail Body
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            'Content-Type: text/plain;' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            ' charset=US-ASCII' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
        -- Mail Attachment
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            '--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                           'Content-Type: application/octet-stream' ||
                            UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            ' filename="' || p_filename || '"' || --My filename
                            UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
      /* Writing the BLOL in chunks */
        WHILE l_pos < l_blob_len LOOP
          DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
          UTL_SMTP.write_raw_data(v_connection_handle,
                                  UTL_ENCODE.BASE64_ENCODE(l_buffer));
          UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
          l_buffer := NULL;
          l_pos    := l_pos + l_amount;
        END LOOP;
        UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
        -- Close Email
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            '--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                            UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
        UTL_SMTP.CLOSE_DATA(v_connection_handle);
        UTL_SMTP.QUIT(v_connection_handle);
        DBMS_LOB.FREETEMPORARY(l_blob);
        DBMS_LOB.FILECLOSE(v_src_loc);
      EXCEPTION
        WHEN OTHERS THEN
          UTL_SMTP.QUIT(v_connection_handle);
          DBMS_LOB.FREETEMPORARY(l_blob);
          DBMS_LOB.FILECLOSE(v_src_loc);
         sssl_internal_error_track(sqlcode,sqlerrm,'SSSL_SEND_MAIL',NULL);
      END;Thanks in Advance.
    Cheers,
    Shan.
    Edited by: Shan on 13 Jan, 2011 12:33 PM
    Edited by: Shan on 13 Jan, 2011 1:05 PM

  • Attach xls file with more than  255 chars

    Hi all,
    I'm trying to send an .xls file as attachement whose row contains more than 255 chars with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
    When preparing the attached table, I tried to separate the tables like this:
    loop at itab.
      concatenate itab-col_1 itab-col_2 itab-col_3 into it_attach
        separted by cl_abap_char_utilities=>horizontal_tab.
      append it_attach.
      concatenate itab-col_4 itab-col_5 itab-col_6 into it_attach
        separted by cl_abap_char_utilities=>horizontal_tab.
      append it_attach.
      concatenate IT_ATTACH cl_abap_char_utilities=>newline into it_attach.
      append it_attach.
    endloop.
    I am able to send this xls as attachment, but when open it in excel/notepad,
    it is so strange that there are so many spaces before the contents itab-col_4 which is unexpected.
    It is expected that the file is tab-delimited with continuous column 1-6.
    Any things went wrong?
    Many Thanks!

    Thanks.
    I tried the first method to convert the byte to string, but a short dumps is resulted,
    DATA: con_tab TYPE x,
               sep TYPE string.
    con_tab = '09'.
    CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
                EXPORTING
                  in_xstring = con_tab
                IMPORTING
                  out_string = sep.
    so I use back my original method to concatenate the columns as suggested, i.e.
    concatenate itab-col_1 tab itab-col_2 tab itab-col_3 tab into it_attach
    append it_attach.
    concatenate itab-col_4 tab itab-col_5 tab itab-col_6 into it_attach.
    append it_attach.
    concatenate it_attach cl_abap_char_utilities=>newline into it_attach.
    append it_attach.
    but the outcome is still the same, i.e. ...many leading space before itab-col_4
    any more ideas? Many Thanks

  • Problem with GUI_DOWNLOAD XLS File

    Hi Experts,
    I have used GUI_DOWNLOAD function to download my internal tables in .xls file in local system.  I have used 'ASC' as file type.
    File has been successfully created as .xls. But when you open that file in our local system and update some entries and try to save it, but it has not saving and its giving error. I am not able to update/change that file.
    Is there any other FM which I will use to download a .xls file perfectly...
    Regards,
    Ramesh.

    USe Function Like this:
    data : if_intern type  kcde_cells occurs 0 with header line.
    For calling File
    call function 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          program_name = syst-repid
        CHANGING
          file_name    = p_file1.
    For Excel data upload
    call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename    = p_filename
          i_begin_col = vf_start_col
          i_begin_row = p_brow2
          i_end_col   = vf_end_col
          i_end_row   = p_erow2
        TABLES
          intern      = if_intern.
    if if_intern[] is initial.
        p_text = 'No Data Uploaded'.
    endif.
    Edited by: shelly Malik on Aug 18, 2009 12:34 PM

  • Attachment in WORKFLOW user decision step

    Hi all,
    My requirement is to display a link in user decision step.
    When link is clicked, control should navigate to MM02 transaction.
    Also in following user decision step i need to provide link for smart form in user decision.
    Can anybody please guide in detail .
    Thanks.
    Edited by: Sanjay_lnt on Sep 26, 2010 1:14 PM
    Edited by: Sanjay_lnt on Sep 26, 2010 1:15 PM

    Closed.

  • Problem opening attached pdf file

    Hi everybody,
    I'm trying to open a pdf file attached in a mail, but when i try to open it adobe acrobat gives me this error.
    Adobe Reader could not open <doc1.pdf> because it is either not a supported file type or the file has been damaged (for eg:it was sent as an email attachment and wasn't correctly decoded.)
    I've read many posts related to this problem but i haven't found the solution yet.
    Can anyone help me?
    Thanx!!

    Hi Dieter,
    Here is the code,
    doc_chng-obj_name = 'Nomina'.
    doc_chng-obj_descr = 'Nomina de empleado'.
    objtxt = '<html><body>Reserve price : <b>$250000</b>'.
    APPEND objtxt.
    objtxt = 'A reproduction of the painting to be auctioned'.
    APPEND objtxt.
    objtxt = 'is enclosed as an attachment.</body></html>'.
    APPEND objtxt.
    DESCRIBE TABLE objtxt LINES tab_lines.
    READ TABLE objtxt INDEX tab_lines.
    doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
    Creating the entry for the compressed document
    CLEAR objpack-transf_bin.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'PDF'.
    APPEND objpack.
    Crecion de attachments
    (Assume the data in OBJBIN are given in PDF format)
    DESCRIBE TABLE data_tab LINES tab_lines.
    objhead = 'nomina.pdf'. APPEND objhead.
    Creating the entry for the compressed attachment
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 1.
    objpack-body_start = 1.
    objpack-body_num   = tab_lines.
    objpack-doc_type   = 'PDF'.
    objpack-obj_name   = 'ATTACHMENT'.
    objpack-obj_descr = 'Nomina Empleado'.
    objpack-doc_size   = tab_lines * 255.
    APPEND objpack.
    Entering names in the distribution list
    reclist-receiver = 'kkkkkkkkk'.
    reclist-rec_type = 'U'.
    append reclist.
    Sending the document
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = objbin
        contents_txt               = objtxt
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        operation_no_authorization = 4
        OTHERS                     = 99.

  • Problem with attached zip file

    I received an email with a zip file attached, but whenever I try to open it I get the message "Unable to unarchive "filename.zip: into "Desktop." (Error 1 - Operation not permitted)"
    Can anyone help?

    Download Stuffit Expander which can open just about anything you throw at it. You can obtain this "free" utility from Versiontracker and Macupdate.

  • I was configured my mail id in ipad whether i have  open the mail the mail attachment like XLS files does not open and i have already download the payable Application Excell After that also it doesnot opening.either i have open then i cant save

    i am tryng to open the Attached xls file in the mail but i cant save that file in to a specified location also thats my problem please sugest a solution for that

    Having the same problem. Click mail, it bounces, a quick flash, then nothing. Also as a side note, Entourage as of this morning will no longer send mail to either of my work accounts, that is why I was trying mail. Also tried several other mail programs and the same result, can receive mails, but not send.
    Have reset the router, cable modem, checked that I have the latest MS and Apple software loaded and it is all good. Very strange.
    Ron

  • Adding of RAW-attachement in decision step ?

    hi,
    i have an decision step in an workflow.
    there it is possible (as SAP Standard) to attach a attachement.
    but the only thing a user should do there is to enter an RAW document, just a text
    for the next user.
    BUT: when i push the 'attachement' button in the decision step i get
    a very user-unfriendly popup 'between'. there the user must enter
    a text BEFORE he can enter the text in the editor.
    is it possible to avoid that windows between and get DIRECTLY into
    the note-editor ???????
    reg, Martin

    Hi,
    Assign "Description as your default attribute in your BO basic data...
    this will work...
    Regards
    Gautam

Maybe you are looking for

  • I cant believe the treatment im getting!

    It seems that fairness in merchandise sales is a thing of the past. That overchargeing and bait and switch is just pure common place anymore. I was at the Best Buy in Bristol Va. picking out a few things for a cumputer system that I was putting toget

  • Excise values from taxinn to pricing procedure

    we are using taxinn.  We are getting values of all ed related condition types in tax-tabview of PO, from condition recordds. We have created similar condition types in pricing procedure also.  These condition types in pricing procedure are without ac

  • INTO clause expected in SELECT statement

    Hi all, I have this pl sql code that errors out:an INTO clause is expected in this SELECT statement. Code Declare prev_col1 FLOAT(10) := 0; temp3 temp2%rowtype; Begin select * from select col1, col2, col3, lag(col1,1,0) over(order by rownum) prev_col

  • Condition with mulitple Expressions

    I have the following file structure of an ORDERS05 Idoc and I need to setup conditions in the Receiver Determination to find the correct Interface Determination and Receiver Agreement. sample File: - <E1EDK14 SEGMENT="1">   <QUALF>006</QUALF>   <ORGI

  • Problem about opening iPhoto

    When i open iPhoto 5 for the first time the program searches for photos, even if there aren't photos on my library. I've tryed to update iPhoto to the latest buid 5.0.4(263) but the problem still remain. I have the suspect that the problem is in the