Problem in sending an email attachment

Hi,
I have to send an email with attachment. I am trying it by using method 'add_attachment' of class cl_document_bcs.
I have data in a internal table of type char. i am passing my intrenal table to this parameter  i_att_content_text   in the method.
In the attachment all the data is coming but in a single row. Do i need to convert the text data in my internal table to the type of i_att_content_text parameter. if so wat is the method i have to use to do the conversion. like soli_to_solix,txt_to_soli etc.
thanks,
Regards,
Ram

Hi,
Use this.
if you have xstring type data then
<SOLIX TYPE INTERNAL TABLE> = cl_document_bcs=>xstring_to_solix( <YOUR XSTRING> ).
if you have string type data or char..
(<SOLI TYPE INTERNAL TABLE>) = cl_document_bcs=>STRING_TO_SOLI(< YOUR STRING >)
Hope this helps.
Regards,
-Sandeep
Edited by: sandeep2719 on Dec 2, 2011 5:08 PM

Similar Messages

  • Problem when send an email with mail client!

    Hi!
    My mail server have MTA front end and Message Store back end with version:
    ./imsimta version
    Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009)
    libimta.so 7u2-7.02 64bit (built 02:28:03, Apr 16 2009)
    Using /opt/sun/comms/messaging64/config/imta.cnf (compiled)
    SunOS SMSG 5.10 Generic_139556-08 i86pc i386 i86pcMy users and I are having problem following: Send an email very slow, mail client is connected to front end but mail is not delivered, after that, I stop and resend this email several times then it is can delivered. While the mail was not send, i can telnet to front end with port 25. My users and I are using Thunderbird and Microsoft Outlook. What is problem on my mail server ?
    I see time on MTA front end and Message Store are not synchronized, maybe this could be the problem?
    Thanks!

    NguyenPhuc wrote:
    Are you using any kind of MTA spam filter plugin?I removed plugin spam filter, now on MTA server don't have plugin spam or virus !Are you saying you did have a spam filter plugin enabled (if so which one(s)) and you have just disabled it?
    Are you receiving an excessive number of emails?No, total of number messages in my mailbox is about 1000 emails.I meant is the MTA receiving a large number of emails -- i.e. do you see a lot of emails coming in (mail.log_current)?
    Also try the following and see where the delay in accepting emails occurs:
    telnet <mta> 25
    mail from: [email protected]
    rcpt to: [email protected]
    data
    Subject: test email
    To: [email protected]
    From: [email protected]
    body
    .e.g.
    -bash-3.00# telnet server 25
    Trying 10.15.10.33...
    Connected to server.aus.sun.com.
    Escape character is '^]'.
    220 server.aus.sun.com -- Server ESMTP (Sun Java(tm) System Messaging Server 7u3-16.01 64bit (built Apr  6 2010))
    mail from: [email protected]
    250-2.5.0 No HELO/EHLO seen; continuing anyway, [10.15.10.33].
    250 2.5.0 Address Ok.
    rcpt to: [email protected]
    250 2.1.5 [email protected] OK.
    data
    354 Enter mail, end with a single ".".
    To: [email protected]
    From: [email protected]
    body
    250 2.5.0 Ok, envelope id [email protected]
    quit
    221 2.3.0 Bye received. Goodbye.
    Connection to server.aus.sun.com closed by foreign host.Regards,
    Shane.

  • Error 829 in SOST tcode while sending an email attachment ??

    Hi..
    I am using the function module "SO_NEW_DOCUMENT_ATT_SEND_API1" to send an email attachment.
    The program is getting executed successfully but when i see in SOST transaction, i am getting an error message.
    Error number is 829 and it says " Internal error: SO_OBJECT_MIME_GET Exception: 2 "...
    How do i resolve this error   ....??

    Hi,
    Please check this links will help you.
    Error in SOST transaction for Mail Triggered from SAP
    Re: need help in implementing a note

  • HAVE A PROBLEM WHEN SENDING AN EMAIL IT STATES IT DOES NOT ALLOW RELAYING

    HAVE A PROBLEM WHEN SENDING AN EMAIL IT STATES IT DOES NOT ALLOW RELAYING

    You have either entered the wrong SMTP server info or they have blocked the sending of e-mails from outside their network. That message indicates that you are not permitted to send through that server from the network you are using to connect.
    Contact them again. There is no magic that will allow you to bypass this.

  • Problem by  Sending an Email with attached Adobe Interactive Form (Code)

    Thanks. I have written Programm, but it does not work as i want it to do. I will send an Email with attached Adobe Interactive Firm to [email protected]. I tried it with "*lo_recipient = cl_sapuser_bcs=>create( sy-uname )" at the marked(bold, fat) position. It worked but the Email was send to my SAP-Account, but i want to send to [email protected], so I tried this (see at code in bold, fat):
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    But it doens`t send the email.
    Can anybody help me please???
    Kevin
    Here my Code:
    Report FP_EXAMPLE_01
    Printing of documents using PDF based forms
    REPORT z_example_02.
    Data declaration
    DATA: carr_id TYPE sbook-carrid,
    customer TYPE scustom,
    bookings TYPE ty_bookings,
    connections TYPE ty_connections,
    fm_name TYPE rs38l_fnam,
    fp_docparams TYPE sfpdocparams,
    fp_outputparams TYPE sfpoutputparams,
    error_string TYPE string,
    l_booking TYPE sbook,
    t_sums TYPE TABLE OF sbook,
    l_sums LIKE LINE OF t_sums,
    fp_formoutput TYPE fpformoutput.
    PARAMETER: p_custid TYPE scustom-id DEFAULT 38.
    SELECT-OPTIONS: s_carrid FOR carr_id DEFAULT 'AA' TO 'ZZ'.
    PARAMETER: p_form TYPE tdsfname DEFAULT 'FP_EXAMPLE_01'.
    PARAMETER: language TYPE sfpdocparams-langu DEFAULT 'E'.
    PARAMETER: country TYPE sfpdocparams-country DEFAULT 'US'.
    Get data from the following tables: scustom(Flight customer)
    sbook (Single flight reservation)
    spfli (Flight plan)
    SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.
    CHECK sy-subrc = 0.
    SELECT * FROM sbook INTO TABLE bookings
    WHERE customid = p_custid
    AND carrid IN s_carrid
    ORDER BY PRIMARY KEY.
    SELECT * FROM spfli INTO TABLE connections
    FOR ALL ENTRIES IN bookings
    WHERE carrid = bookings-carrid
    AND connid = bookings-connid
    ORDER BY PRIMARY KEY.
    Print data:
    First get name of the generated function module
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
    EXPORTING
    i_name = p_form
    IMPORTING
    e_funcname = fm_name.
    IF sy-subrc <> 0.
    MESSAGE e001(fp_example).
    ENDIF.
    Set output parameters and open spool job
    fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
    fp_outputparams-getpdf = 'X'. " launch print preview
    CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
    ie_outputparams = fp_outputparams
    EXCEPTIONS
    cancel = 1
    usage_error = 2
    system_error = 3
    internal_error = 4
    OTHERS = 5.
    Set form language and country (->form locale)
    fp_docparams-langu = language.
    fp_docparams-country = country.
    *fp_docparams-fillable = 'X'.
    *fp_docparams-langu = 'E'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    *fp_docparams-country = 'GB'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    currency key dependant summing
    LOOP AT bookings INTO l_booking.
    l_sums-forcuram = l_booking-forcuram.
    l_sums-forcurkey = l_booking-forcurkey.
    COLLECT l_sums INTO t_sums.
    ENDLOOP.
    Now call the generated function module
    CALL FUNCTION fm_name
    EXPORTING
    /1bcdwb/docparams = fp_docparams
    customer = customer
    bookings = bookings
    connections = connections
    t_sums = t_sums
    IMPORTING
    /1bcdwb/formoutput = fp_formoutput
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
    IMPORTING
    e_adserrstr = error_string.
    IF NOT error_string IS INITIAL.
    we received a detailed error description
    WRITE:/ error_string.
    EXIT.
    ELSE.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    Close spool job
    CALL FUNCTION 'FP_JOB_CLOSE'
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *********************Send the form*******************
    *********************to the Customer*****************
    *********************via Email***********************
    *IF i_down = abap_true.
    DATA: filename TYPE string,
    path TYPE string,
    fullpath TYPE string,
    default_extension TYPE string VALUE 'PDF'.
    Data:
    lt_att_content_hex TYPE solix_tab.
    *DATA: data_tab TYPE TABLE OF x255.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
    buffer = fp_formoutput-pdf
    TABLES
    binary_tab = lt_att_content_hex.
    CLASS cl_bcs DEFINITION LOAD.
    DATA:
    lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
    lo_send_request = cl_bcs=>create_persistent( ).
    DATA:
    lt_message_body TYPE bcsy_text VALUE IS INITIAL.
    DATA: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
    APPEND 'Dear Vendor,' TO lt_message_body.
    APPEND ' ' TO lt_message_body.
    APPEND 'Please fill the attached form and send it back to us.'
    TO lt_message_body.
    APPEND ' ' TO lt_message_body.
    APPEND 'Thank You,' TO lt_message_body.
    lo_document = cl_document_bcs=>create_document(
    i_type = 'RAW'
    i_text = lt_message_body
    i_subject = 'Vendor Payment Form' ).
    DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
    TRY.
    lo_document->add_attachment(
    EXPORTING
    i_attachment_type = 'PDF'
    i_attachment_subject = 'Vendor Payment Form'
    i_att_content_hex = lt_att_content_hex ).
    CATCH cx_document_bcs INTO lx_document_bcs.
    ENDTRY.
    lo_send_request->set_document( lo_document ).
    DATA:
    lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
    lo_send TYPE adr6-smtp_addr VALUE '[email protected]'. "Absender SENDER
    lo_sender = cl_cam_address_bcs=>create_internet_address( lo_send ).
    Set sender
    lo_send_request->set_sender(
    EXPORTING
    i_sender = lo_sender ).
    Create recipient
    DATA:
    lo_recipient type ref to if_recipient_bcs value is initial.
    Data:
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    *lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
    Set recipient
    lo_send_request->add_recipient(
    EXPORTING
    i_recipient = lo_recipient
    i_express = 'X' ).
    *lo_send_request->add_recipient(
    *EXPORTING
    *i_recipient = lo_recipient
    *i_express = 'X' ).
    Send email
    DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
    lo_send_request->send(
    EXPORTING
    i_with_error_screen = 'X'
    RECEIVING
    result = lv_sent_to_all ).
    COMMIT WORK.
    MESSAGE 'The payment form has been emailed to the Vendor' TYPE 'I'.

    Hi Kevin,
    Please try this code to send your mail, i wrote it and works well in many system.
    Take care if in your profile you got an e-mail adress define .
    Take care also of trnasaction SCOT customizing, are you able to send mail to e-mail adress ?
    Let me know if it's works.
    Best regards.
    <i>**----
    CLASS-DEFINITIONS
    DATA: send_request       TYPE REF TO cl_bcs.
    DATA: document           TYPE REF TO cl_document_bcs.
    DATA: sender             TYPE REF TO cl_sapuser_bcs.
    DATA: recipient          TYPE REF TO if_recipient_bcs.
    INTERNAL TABLES
    DATA: l_mailtext TYPE soli_tab.
    DATA: iaddsmtp   TYPE TABLE OF bapiadsmtp.
    DATA: ireturn    TYPE TABLE OF bapiret2.
    VARIABLES
    DATA: mail_line  LIKE LINE OF l_mailtext.
    DATA: bapiadsmtp         TYPE bapiadsmtp.
    DATA: subject    TYPE so_obj_des.
    DATA : att_subject TYPE so_obj_des.
    DATA : w_except TYPE REF TO cx_root .
    CONSTANTS : c_defmail TYPE ad_smtpadr VALUE
                     '[email protected]' .
    FIELD-SYMBOLS : <smtp> TYPE bapiadsmtp.
    *Convert the pdf given by function module into Binary .
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer     = output-pdf "PDF file from function module
      TABLES
        binary_tab = hexa.
    *Set subject of the mail
    subject = 'Exemple de PDF interactif'.
    Set text of the mail
    mail_line = 'Merci de remplir le formulaire et nous le retourner'.
    APPEND mail_line TO l_mailtext .
    Set the name of the attached document
    att_subject = 'Template du PDF'.
    TRY.
    Create persistent send request
        send_request = cl_bcs=>create_persistent( ).
    Get sender object
        sender = cl_sapuser_bcs=>create( sy-uname ).
    Add sender
        CALL METHOD send_request->set_sender
          EXPORTING
            i_sender = sender.
    Read the E-Mail address for the user
        CALL FUNCTION 'BAPI_USER_GET_DETAIL'
          EXPORTING
            username = sy-uname
          TABLES
            return   = ireturn
            addsmtp  = iaddsmtp.
        LOOP AT iaddsmtp ASSIGNING <smtp> WHERE std_no = 'X'.
          CLEAR bapiadsmtp.
          MOVE <smtp> TO bapiadsmtp.
        ENDLOOP.
        CASE bapiadsmtp-e_mail.
          WHEN space.
    No adress main for user, so send it to the default mail adress
            recipient =
         cl_cam_address_bcs=>create_internet_address( c_defmail ).
          WHEN OTHERS.
            recipient =
         cl_cam_address_bcs=>create_internet_address( bapiadsmtp-e_mail ).
        ENDCASE.
    Add recipient with its respective attributes to send request
        CALL METHOD send_request->add_recipient
          EXPORTING
            i_recipient  = recipient
            i_express    = 'X'
            i_copy       = space
            i_blind_copy = space
            i_no_forward = space.
    Set that you don't need a Return Status E-mail
        CALL METHOD send_request->set_status_attributes
          EXPORTING
            i_requested_status = 'E'
            i_status_mail      = 'E'.
    set send immediately flag
        send_request->set_send_immediately( 'X' ).
    *Build Document
        document = cl_document_bcs=>create_document(
                            i_type    = 'RAW'
                            i_text    = l_mailtext
                            i_subject = subject ).
        add attachment to document
        CALL METHOD document->add_attachment
          EXPORTING
            i_attachment_type    = 'PDF'
            i_attachment_subject = att_subject
            i_att_content_hex    = hexa.
    Add document to send request
        CALL METHOD send_request->set_document( document ).
    Send document
        CALL METHOD send_request->send( ).
        COMMIT WORK.
      CATCH cx_send_req_bcs INTO w_except.
      CATCH cx_address_bcs INTO w_except.
      CATCH cx_document_bcs INTO w_except.
    ENDTRY.</i>

  • .pdf is missing when send as email attachment (Outlook) from Adobe Reader 11.0.06

    The PDF is streamed from our webserver application to an IFRAME in Internet Explorer 9.
    The headers Content-type (application/pdf), Content-disposition (random-unique-filename.pdf), Content-length are all set.
    Acrobat Reader plugin opens up inside the IFRAME and presents the PDF without problems.
    When our users try "Send file as email attachment" Outlook 2010 opens up and the file is attached - without the file extension.
    The name of the attachment is the same name as the Java Servlet that delivered the streamed file.
    If we save the streamed PDF to disc, open it in Acrobat and do the same maneuver - the file extension is added to the attached file name in Outlook.
    Message was edited by: Solson

    We have the same problem !
    Tested this today with adobe reader 9.5.x , file is attached as  "filename.do.pdf"
    If we use adobe reader 11.0.x file is attached as "filename.do"
    If you use save file as , it does get the "pdf" extension automatically
    Solution appreciated !

  • Send pdf email attachment

    Hi,
    I m running the custom concurrent program through pl-sql code and sending the output of the same conc program on to the email id of vendor.
    When i was tryng to send the output in text file it was allowing me to send the text message as well as attachment.
    But with the same code I want to send the pdf output.
    so earlier I was using the UTL_MAIL.send_attach_varchar2 .
    And for pdf attachment I am using the UTL_MAIL.send_attach_raw.
    So custom program is generating the output but
    while sending an email, it is not attaching the output into the email.
    What could be the problem.
    Please help as I needed it urgently.
    revert me if anyone has any query.
    Thanks,
    Bluetooth_25

    No it's not generating the .pdf file.
    It's only generating the .out file.
    so is that the possibility that it is not attaching the pdf in email.
    Here is my code:
    /*Variable declaration*/
    fhandle UTL_FILE.file_type;
    flen NUMBER;
    bsize NUMBER;
    ex BOOLEAN;
    vtextout RAW (32767);
    UTL_FILE.fgetattr ('EMAIL_OUTPUT','o'||v_request_id ||'.out',ex,flen,bsize);
    fhandle := UTL_FILE.fopen('EMAIL_OUTPUT','o'||v_request_id ||'.out', 'r');
    LOOP
    BEGIN
    UTL_FILE.get_raw (fhandle,vtextout,flen);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    EXIT;
    END;
    END LOOP;
    UTL_FILE.fCLOSE(fhandle);
    FOR email_rec in c2_vendor_email_add(po_rec.po_header_id)
    LOOP
    UTL_MAIL.send_attach_raw
    sender => '[email protected]',
    recipients => email_rec.email_address,
    subject => 'Testmail',
    MESSAGE => 'This is test mail',
    attachment => vtextout,
    att_mime_type =>'application/pdf',
    att_filename =>'o'||v_request_id ||'.out'
    and i have one more question how to send an email to multiple recipients using utl_mail.send_attach_raw

  • Problems with send receive Email ( Adobe Interactive)

    I have heard the E-Learning(Send, Receive, and Process Interactive Forms via Email in SAP NetWeaver Application Server ABAP (RIG session 4A)
    ) about this topic on this webpage but i still have to many problems. Can somebody give me a source code, that i know how this works. Or is there a source code anywhere in the sap?
    I hope anybody can help me, Thanks!

    Thanks. I have written Programm, but it does not work as i want it to do. I will send an Email with attached Adobe Interactive Firm to [email protected]. I tried it with "*lo_recipient = cl_sapuser_bcs=>create( sy-uname )" at the marked(bold, fat) position. It worked but the Email was send to my SAP-Account, but i want to send to [email protected], so I tried this (see at code in bold, fat):
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'.   " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    But it doens`t send the email.
    Can anybody help me please???
    Kevin
    Here my Code:
          Report FP_EXAMPLE_01
          Printing of documents using PDF based forms
    REPORT z_example_02.
    Data declaration
    DATA: carr_id TYPE sbook-carrid,
          customer          TYPE scustom,
          bookings          TYPE ty_bookings,
          connections       TYPE ty_connections,
          fm_name           TYPE rs38l_fnam,
          fp_docparams      TYPE sfpdocparams,
          fp_outputparams   TYPE sfpoutputparams,
          error_string      TYPE string,
          l_booking         TYPE sbook,
          t_sums            TYPE TABLE OF sbook,
          l_sums            LIKE LINE OF t_sums,
          fp_formoutput     TYPE fpformoutput.
    PARAMETER:      p_custid TYPE scustom-id DEFAULT 38.
    SELECT-OPTIONS: s_carrid FOR carr_id     DEFAULT 'AA' TO 'ZZ'.
    PARAMETER:      p_form   TYPE tdsfname   DEFAULT 'FP_EXAMPLE_01'.
    PARAMETER:      language    TYPE sfpdocparams-langu   DEFAULT 'E'.
    PARAMETER:      country  TYPE sfpdocparams-country DEFAULT 'US'.
    Get data from the following tables: scustom(Flight customer)
                                        sbook  (Single flight reservation)
                                        spfli  (Flight plan)
    SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.
    CHECK sy-subrc = 0.
    SELECT * FROM sbook INTO TABLE bookings
             WHERE customid = p_custid
             AND   carrid   IN s_carrid
             ORDER BY PRIMARY KEY.
    SELECT * FROM spfli INTO TABLE connections
             FOR ALL ENTRIES IN bookings
             WHERE carrid = bookings-carrid
             AND   connid = bookings-connid
             ORDER BY PRIMARY KEY.
    Print data:
    First get name of the generated function module
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
      EXPORTING
        i_name     = p_form
      IMPORTING
        e_funcname = fm_name.
    IF sy-subrc <> 0.
      MESSAGE e001(fp_example).
    ENDIF.
    Set output parameters and open spool job
    fp_outputparams-nodialog = 'X'.    " suppress printer dialog popup
    fp_outputparams-getpdf  = 'X'.    " launch print preview
    CALL FUNCTION 'FP_JOB_OPEN'
      CHANGING
        ie_outputparams = fp_outputparams
      EXCEPTIONS
        cancel          = 1
        usage_error     = 2
        system_error    = 3
        internal_error  = 4
        OTHERS          = 5.
    Set form language and country (->form locale)
    fp_docparams-langu   = language.
    fp_docparams-country = country.
    *fp_docparams-fillable = 'X'.
    *fp_docparams-langu   = 'E'.  "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    *fp_docparams-country = 'GB'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
    currency key dependant summing
    LOOP AT bookings INTO l_booking.
      l_sums-forcuram  = l_booking-forcuram.
      l_sums-forcurkey = l_booking-forcurkey.
      COLLECT l_sums INTO t_sums.
    ENDLOOP.
    Now call the generated function module
    CALL FUNCTION fm_name
      EXPORTING
        /1bcdwb/docparams  = fp_docparams
        customer           = customer
        bookings           = bookings
        connections        = connections
        t_sums             = t_sums
      IMPORTING
        /1bcdwb/formoutput = fp_formoutput
      EXCEPTIONS
        usage_error        = 1
        system_error       = 2
        internal_error     = 3
        OTHERS             = 4.
    IF sy-subrc <> 0.
      CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
        IMPORTING
          e_adserrstr = error_string.
      IF NOT error_string IS INITIAL.
        we received a detailed error description
        WRITE:/ error_string.
        EXIT.
      ELSE.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDIF.
    Close spool job
    CALL FUNCTION 'FP_JOB_CLOSE'
      EXCEPTIONS
        usage_error    = 1
        system_error   = 2
        internal_error = 3
        OTHERS         = 4.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *********************Send the form*******************
    *********************to the Customer*****************
    *********************via Email***********************
    *IF i_down = abap_true.
    DATA: filename TYPE string,
            path TYPE string,
            fullpath TYPE string,
            default_extension TYPE string VALUE 'PDF'.
    Data:
    lt_att_content_hex TYPE solix_tab.
    *DATA: data_tab TYPE TABLE OF x255.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer     = fp_formoutput-pdf
      TABLES
        binary_tab = lt_att_content_hex.
    CLASS cl_bcs DEFINITION LOAD.
    DATA:
    lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
    lo_send_request = cl_bcs=>create_persistent( ).
    DATA:
    lt_message_body TYPE bcsy_text VALUE IS INITIAL.
    DATA: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
    APPEND 'Dear Vendor,' TO lt_message_body.
    APPEND ' ' TO lt_message_body.
    APPEND 'Please fill the attached form and send it back to us.'
    TO lt_message_body.
    APPEND ' ' TO lt_message_body.
    APPEND 'Thank You,' TO lt_message_body.
    lo_document = cl_document_bcs=>create_document(
    i_type = 'RAW'
    i_text = lt_message_body
    i_subject = 'Vendor Payment Form' ).
    DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
    TRY.
        lo_document->add_attachment(
        EXPORTING
        i_attachment_type = 'PDF'
        i_attachment_subject = 'Vendor Payment Form'
        i_att_content_hex = lt_att_content_hex ).
    CATCH cx_document_bcs INTO lx_document_bcs.
    ENDTRY.
    lo_send_request->set_document( lo_document ).
    DATA:
    lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
    lo_send TYPE adr6-smtp_addr VALUE '[email protected]'.   "Absender SENDER
    lo_sender = cl_cam_address_bcs=>create_internet_address( lo_send ).
    Set sender
    lo_send_request->set_sender(
    EXPORTING
    i_sender = lo_sender ).
    Create recipient
    DATA:
    lo_recipient type ref to if_recipient_bcs value is initial.
    Data:
    lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
    lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
    *lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
    Set recipient
    lo_send_request->add_recipient(
    EXPORTING
    i_recipient = lo_recipient
    i_express = 'X' ).
    *lo_send_request->add_recipient(
    *EXPORTING
    *i_recipient = lo_recipient
    *i_express = 'X' ).
    Send email
    DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
    lo_send_request->send(
    EXPORTING
    i_with_error_screen = 'X'
    RECEIVING
    result = lv_sent_to_all ).
    COMMIT WORK.
    MESSAGE 'The payment form has been emailed to the Vendor' TYPE 'I'.

  • Sending as email attachment from Word 2013 gets stuck in Outbox

    I am using Office 2013 and use the send document as attachment option within Word to email documents. The documents that I email are from a shared exchange mailbox. Whenever I do this the emails get through to the receiver but are stuck in my personal outbox
    rather than sending and heading to the shared sent box.
    This only occurs when I use this option from Word, eg: I can send Excel attachments from within Excel and it goes to the shared Sent box.
    I am also able to successfully send emails from with Outlook via the shared account.
    I am unable to find any settings in Word that affect this behavior, any ideas?

    Hi,
    Please run Word in Safe Mode to test if it's 3rd-party add-ins related:
    Press Win + R and type “word.exe /safe” in the blank box, then press Enter.
    If there’s no problem in Safe Mode, disable the suspicious add-ins to verify which add-ins caused this issue.
    We can also refer to the link below, to learn more and check the possible settings that may affect this behavior:
    http://www.msoutlook.info/question/278
    Regards.
    Melon Chen
    TechNet Community Support
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Convert spool to PDF and send as email attachment

    When i try to convert SAP spool to PDF and send it as email attachment,  size of PDF document becomes large as compared to size of the PDF cocument i download using the same spool.
    I am using following FMs.
    CONVERT_ABAPSPOOLJOB_2_PDF to convert spool to PDF
    and
    SO_NEW_DOCUMENT_ATT_SEND_API1 to send email with attchment.
    some times size of attchment exceeds 2MB and email results in error in SAP connect (SOST).
    Any idea on how to compress the PDF attchment??
    Thanks

    Hi Venkat,
    Can you plesae assist me.
    I have a requirement to convert spool to pdf
    send an email to users
    issue is that attachement is big cant go through
    I have used compress, but when I open the pdf file error that file was not correclty decoded
    please assist, anyone

  • Sending an email attachment for xls file

    Hi all,
    I am executing the reports in background, i am getting spool after executing. Just i need to convert the spool to xls format and email through attachment and mail to the user.The xls file should not be saved on local system.
    I need your help.
    Regards
    Vinay.

    see this link
    to send xls as attachment.
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm

  • Block List ALV Output Send As Email Attachment

    Hi,  All The ABAP Gurus,
    I have made a block ALV Report. I want that this output should be converted into .xls with HTML format and this should be send in email as attachment. This all will be made in a background job which will be scheduled daily.
    How can I achieve this? I know that the output of classical report can be attached as pdf in email.But I want in Block ALV.
    Thanks in Advance.
    Regards,
    Bharti Jain
    Edited by: Bharti Jain on Jun 28, 2011 10:20 AM

    Hi
    Not 100 percent sure what you want to do here.  I am confused by the .xls in html format.   If you want the output in html you can submit the program and export the list to memory,  Then retrieve the list and convert it to html.  i have done this with the program 1sdbf12l/rv14akzy . see code below.  This converts the output to html, you are left with a binary itab and size at the end of the routine and this can be attached to an email.
    Submit Program and export the list to Memory
    SUBMIT /1sdbf12l/rv14akzy USING SELECTION-SCREEN '1000'
      WITH SELECTION-TABLE lt_params_new EXPORTING LIST TO MEMORY AND RETURN.
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = lt_list
        EXCEPTIONS
          not_found  = 1
          OTHERS     = 2.
    Convert the List to html
      IF sy-subrc = 0.
        DATA: it_html TYPE TABLE OF bapihtml WITH HEADER LINE,
              it_html_out TYPE TABLE OF bapihtml WITH HEADER LINE,
              lt_html TYPE TABLE OF bapihtml WITH HEADER LINE,
              lv_html LIKE LINE OF it_html,
              lv_html_out TYPE string.
        DATA: lv_html_tab_wide(50000) TYPE c.
        DATA: lineno TYPE i, length TYPE i, size TYPE i.
        DATA: gui_codepage(4) TYPE n,        " added for message 500824
              is_unicode TYPE rststype-sel_ok.
        DATA: convert_output TYPE xstring,
              convert_buffer TYPE xstring.
        CALL FUNCTION 'LIST_FREE_MEMORY'
          TABLES
            listobject = lt_list.
        CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
             EXPORTING
                  REPORT_NAME   =
                  template_name = 'WEBREPORTING_REPORT'
             TABLES
                  html          =  it_html
                  listobject    =  lt_list.
        DESCRIBE TABLE it_html LINES lineno .
        DESCRIBE FIELD it_html LENGTH length IN BYTE MODE.
        size = length * lineno.
        CALL 'CUR_LCL' ID 'GUICP'  FIELD gui_codepage.
        CALL FUNCTION 'SCP_GET_CODEPAGE_PROPERTIES'
          EXPORTING
            codepage         = gui_codepage
          IMPORTING
            can_unicode      = is_unicode
          EXCEPTIONS
            codepage_unknown = 1.
        IF sy-subrc <> 0.
          CLEAR gui_codepage.
        ENDIF.
        IF is_unicode EQ 'X'.         "in case of unicode, always use utf-8
          gui_codepage = '4110'.
        ENDIF.
        CLEAR: convert_output, convert_buffer.
        LOOP AT it_html INTO lv_html.
          REPLACE ALL OCCURRENCES OF c_bg_def IN lv_html WITH c_bg_white.
          CALL FUNCTION 'SCP_TRANSLATE_CHARS'
            EXPORTING
              inbuff           = lv_html
              outcode          = gui_codepage
              csubst           = 'X'
              substc_space     = 'X'
            IMPORTING
              outbuff          = convert_output
            EXCEPTIONS
              invalid_codepage = 1
              internal_error   = 2
              cannot_convert   = 3
              fields_bad_type  = 4
              OTHERS           = 5.
          IF sy-subrc <> 0.
           message i020 raising download_error.
          ENDIF.
          CONCATENATE convert_buffer convert_output INTO convert_buffer IN
          BYTE MODE.
          CONCATENATE lv_html_out lv_html INTO lv_html_out.
        ENDLOOP.
        ev_html_string = lv_html_out.
        i = 0.
        DESCRIBE FIELD html_tab_converted LENGTH tablength IN BYTE MODE.
        WHILE i < XSTRLEN( convert_buffer ).
          dummy = XSTRLEN( convert_buffer ) - i.
          IF tablength > dummy.
            html_tab_converted-line = convert_buffer+i(dummy).
          ELSE.
            html_tab_converted-line = convert_buffer+i(tablength).
          ENDIF.
          i = i + tablength.
          APPEND html_tab_converted.
        ENDWHILE.
        et_bin[] = html_tab_converted[].
        ev_bin_size = size.

  • Problem with pdf as email attachment

    Hi All,
    when i am opening the pdf file(email attachment), getting the error  "file type not support or content conversion....."
    the peice of code is as followed...
    IF p_email = 'X'.
        CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
          EXPORTING
            rqident = mi_rqident   (spool number)
          TABLES
            buffer  = l_contents.  
        IF l_contents IS NOT INITIAL.
          CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
            EXPORTING
              ip_solitab  = l_contents
            IMPORTING
              ep_solixtab = contents_hex.
    Create the send request
          TRY.
              l_send_request = cl_bcs=>create_persistent( ).
    Create the main document
              l_doc = cl_document_bcs=>create_document(
                     i_type = 'RAW'
                     i_text = l_text
                     i_subject = p_sub ).
    Add attachment to document
              l_doc->add_attachment( i_attachment_type = 'PDF'
                                     i_attachment_subject = p_doc
                                  i_att_content_text = contents_text ).
                                   i_att_content_hex = contents_hex ).
    Add document to send request
              l_send_request->set_document( l_doc ).
    Add recipients to send request
              l_recipient = cl_cam_address_bcs=>create_internet_address(
                           p_email1-low ).
              l_send_request->add_recipient( i_recipient = l_recipient ).
    Send email
              l_sent_all = l_send_request->send( ).
    and other way also i tried, please let me know the solution.
    thanks in advance

    try this code ..
    For mailing(converting data to char 255)
        IF ch2 EQ 'X'.
          DATA sub TYPE string.
          CALL FUNCTION 'QCE1_CONVERT'
            TABLES
              t_source_tab         = i_tline
              t_target_tab         = so_ali[]
            EXCEPTIONS
              convert_not_possible = 1
              OTHERS               = 2.
    Mail Contents
          refresh objtxt[].
          objtxt = space.
          APPEND objtxt.
          objtxt = 'Dear Sir/Madam,'.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
          CLEAR : sub.
          CONCATENATE 'Sub: Dispatch Details - Invoice Number :' invno '.' INTO sub SEPARATED BY space.
          objtxt = sub.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
          objtxt = 'We have dispatched the subject consignment from our factory, and'.
          APPEND objtxt.
          objtxt = 'enclose the Invoice(pdf file) for your kind reference.'.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
          objtxt = 'Note: Please cover insurance on all risks in case INCO TERMS as "EXW, FCA, FOB, CFR"'.
          APPEND objtxt.
          objtxt = 'in the subject consignment.'.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
          objtxt = 'For Delivery Management - International,'.
          APPEND objtxt.
          objtxt = 'Pricol Limited,'.
          APPEND objtxt.
          objtxt = 'Coimbatore. India.'.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
    Determining the Email Ids of Mail Receivers
          PERFORM fetch_mailids.
          objtxt = 'Copy to :'.
          APPEND objtxt.
          LOOP AT reclist.
            objtxt = reclist-receiver.
            APPEND objtxt.
          ENDLOOP.
          objtxt = space.
          APPEND objtxt.
          objtxt = '<This is system generated message>.'.
          APPEND objtxt.
          objtxt = space.
          APPEND objtxt.
    Mail Body of message over.
          DESCRIBE TABLE objtxt[] LINES v_lines_txt.
          CONCATENATE 'Inv.' invno INTO sub SEPARATED BY space.
          doc_chng-obj_name = sub.
          doc_chng-expiry_dat = sy-datum + 10.
    Mail Subject
          refresh objpack[].
          CONCATENATE 'Pricol Dispatch - Invoice' invno '- Reg.' INTO sub SEPARATED BY space.
          doc_chng-obj_descr = sub.
          doc_chng-sensitivty = 'F'.
          doc_chng-doc_size = v_lines_txt * 255.
          objpack-transf_bin = ' '.
          objpack-head_start = 1.
          objpack-head_num = 0.
          objpack-body_start = 1.
          objpack-body_num = v_lines_txt.
          objpack-doc_type = 'RAW'.
          APPEND objpack.
    *PDF Attachment
          DESCRIBE TABLE so_ali[] LINES lineno.
          objpack-transf_bin = 'X'.
          objpack-head_start = 1.
          objpack-head_num = 1.
          objpack-body_start = 1.
          objpack-doc_size = lineno * 255 .
          objpack-body_num = lineno.
          objpack-doc_type = 'PDF'.
          objpack-obj_name = 'INVOICE'.
          objpack-obj_descr = 'Invoice'.
          objpack-obj_langu = 'E'.
          APPEND objpack.
          CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
          document_data = doc_chng
          put_in_outbox = 'X'
          commit_work = 'X'
          TABLES
          packing_list = objpack
          contents_txt = objtxt[]
          contents_bin = so_ali[]
    *contents_hex = so_ali[]
          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.
            PERFORM mail.
            MESSAGE 'Mail sent successfully' TYPE 'S'.
    *SUBMIT RSCONN01 WITH MODE = MODE.
          ENDIF.
        ENDIF.
      ENDLOOP.

  • Problem in sending  mail with attachment

    Hi All,
    I am using the function module <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b> to send mail with attachment.
    the program executes properly and shows a message <b>'Document Sent'</b>. But neither the sent mail appears in <b>'SOST'</b> nor I get it on the specified email id.
    Below is my code:
    <b>***</b> As attachment I am sending resume whose contents are stored in table 'ZResume' corresponding to personnel no.(pernr) and serial No.(srno).
    <b>START OF PROGRAM</b>----
    REPORT  ZPTEST_SEND_MAIL_ATTATCHMENT.
    DATA : w_name TYPE sos04-l_adr_name.
    DATA: RESUME TYPE table of XSTRING with header line.
    START-OF-SELECTION.
    <b>* Data Declaration</b>
      DATA:
        l_datum(10),
        ls_docdata    TYPE sodocchgi1,
        lt_objpack    TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
        lt_objhead    TYPE TABLE OF solisti1   WITH HEADER LINE,
        lt_objtxt     TYPE TABLE OF solisti1   WITH HEADER LINE,
        lt_objbin     TYPE TABLE OF solisti1   WITH HEADER LINE,
        lt_reclist    TYPE TABLE OF somlreci1  WITH HEADER LINE,
        lt_listobject TYPE TABLE OF abaplist   WITH HEADER LINE,
        l_tab_lines TYPE i,
        l_att_type  LIKE soodk-objtp.
      WRITE sy-datum TO l_datum.
      SELECT SINGLE RESUME FROM ZRESUME INTO RESUME
          WHERE PERNR EQ '00001182'
          AND SRNO EQ '1'.
    APPEND RESUME.
    <b>* Because RESUME may be  of size RAW(1000)
    and objbin is of size CHAR(255) we make this table copy</b>
    CALL FUNCTION 'TABLE_COMPRESS'
        TABLES
          in             = resume
          out            = lt_objbin
        EXCEPTIONS
          compress_error = 1
          OTHERS         = 2.
      IF sy-subrc <> 0.
      Error in function module &1
        MESSAGE ID '61' TYPE 'E' NUMBER '731'
           WITH 'TABLE_COMPRESS'.
      ENDIF.
    <b>* Create the message and send the document.
    Create Message Body</b>
    <b>* Title and Description</b>
      ls_docdata-obj_name = 'Resume'.
      ls_docdata-obj_descr = 'Resume'.
    <b>* Main Text</b>
      lt_objtxt = 'Resume of the candidate' .
      APPEND lt_objtxt.
    <b>* Write Packing List (Main)</b>
      DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
      READ TABLE lt_objtxt INDEX l_tab_lines.
      ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
      CLEAR lt_objpack-transf_bin.
      lt_objpack-head_start = 1.
      lt_objpack-head_num = 0.
      lt_objpack-body_start = 1.
      lt_objpack-body_num = l_tab_lines.
      lt_objpack-doc_type = 'RAW'.
      APPEND lt_objpack.
    <b>* Create Message Attachment
    Write Packing List (Attachment)</b>
      l_att_type = 'ALI'.
      DESCRIBE TABLE lt_objbin LINES l_tab_lines.
      READ TABLE lt_objbin INDEX l_tab_lines.
      lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).
      lt_objpack-transf_bin = 'X'.
      lt_objpack-head_start = 1.
      lt_objpack-head_num = 0.
      lt_objpack-body_start = 1.
      lt_objpack-body_num = l_tab_lines.
      lt_objpack-doc_type = l_att_type.
      lt_objpack-obj_name = 'ATTACHMENT'.
      lt_objpack-obj_descr = 'Resume'.                  
      APPEND lt_objpack.
    <b>* Create receiver list</b>
        lt_reclist-receiver = '[email protected]'.
        lt_reclist-rec_type = 'U'.
        APPEND lt_reclist.
    <b>* Send Message</b>
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = ls_docdata
          put_in_outbox              = ''
        TABLES
          packing_list               = lt_objpack
          object_header              = lt_objhead
          contents_bin               = lt_objbin
          contents_txt               = lt_objtxt
          receivers                  = lt_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.
      Document sent
        MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.
      ELSE.
      Document <&> could not be sent
        MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
           WITH ls_docdata-obj_name.
      ENDIF.
    <b>END OF PROGRAM</b>----
    Can anybody tell me where I am making mistake?
    Thanks in advance,
    Pragya

    Hi Pragya,
    Refer the code below. It's working fine and try to match up the things from your program.
    REPORT ZSAMPL_001 .
    INCLUDE ZINCLUDE_01.
    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
    ***INCLUDE ZINCLUDE_01 .
    10.08.2005 Amit M - Created
    Include For Mail (First Req F16)
    Modification Log
    Data
    tables crmrfcpar.
    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.
    data v_rfcdest LIKE crmrfcpar-rfcdest.
    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
    FORM
    FORM ml_saveforbp USING jobname jobcount.
    Data
    *data : yhead like yhrt_bp_head.
    *DATA : ydocdata LIKE yhrt_bp_docdata,
    *yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
    *yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
    *DATA : seqnr TYPE i.
    Head
    *yhead-jobname = jobname.
    *yhead-jobcount = jobcount..
    *MODIFY yhrt_bp_head FROM yhead.
    Doc Data
    *ydocdata-jobname = jobname.
    *ydocdata-jobcount = jobcount.
    *MOVE-CORRESPONDING docdata TO ydocdata.
    *MODIFY yhrt_bp_docdata FROM ydocdata.
    Objtxt
    *seqnr = 0.
    *LOOP AT objtxt.
    *seqnr = seqnr + 1.
    *yobjtxt-jobname = jobname.
    *yobjtxt-jobcount = jobcount.
    *yobjtxt-seqnr = seqnr.
    *MOVE-CORRESPONDING objtxt TO yobjtxt.
    *MODIFY yhrt_bp_objtxt FROM yobjtxt.
    *ENDLOOP.
    RecList
    *seqnr = 0.
    *LOOP AT reclist.
    *seqnr = seqnr + 1.
    *yreclist-jobname = jobname.
    *yreclist-jobcount = jobcount.
    *yreclist-seqnr = seqnr.
    *MOVE-CORRESPONDING reclist TO yreclist.
    *MODIFY yhrt_bp_reclist FROM yreclist.
    *ENDLOOP.
    ENDFORM. "ml_saveforbp
    FORM
    FORM ml_fetchfrombp USING jobname jobcount.
    *CLEAR docdata.
    *REFRESH objtxt.
    *REFRESH reclist.
    *SELECT SINGLE * FROM yhrt_bp_docdata
    *INTO corresponding fields of docdata
    *WHERE jobname = jobname
    *AND jobcount = jobcount.
    *SELECT * FROM yhrt_bp_objtxt
    *INTO corresponding fields of TABLE objtxt
    *WHERE jobname = jobname
    *AND jobcount = jobcount
    *ORDER BY seqnr.
    *SELECT * FROM yhrt_bp_reclist
    *INTO corresponding fields of TABLE reclist
    *WHERE jobname = jobname
    *AND jobcount = jobcount
    *ORDER BY seqnr.
    ENDFORM. "ml_fetchfrombp
    <b>Please reward points if it helps.</b>
    Regards,
    Amit Mishra

  • Problem while sending excel as attachment

    Hi,
    I am trying to send excel as attachment through an email.
    I am using the fm: SO_DOCUMENT_SEND_API1
    In english, I am able to get the data properly. However, when I try to send the same in Chinese, I am getting junk characters in excel file.
    Could you please help me out to solve my issue.
    I am clueless, why only for chinese, I am getting the issue.
    Thanks,
    Sandeep

    Hi Rushi,
    In this FM, I am unable to find the parameter for code page. Could you please help me how exactly I can use this code page?
    Thanks,
    Sandeep

Maybe you are looking for

  • My browser suddenly always opens on the page it was on when it was shut down last and uses tabs even though I have them turned off. I have tried reinstalling.

    I have my browser set to open on comcast.net webpage and to never use tabs. I have been using firefox for years and am very familiar with it. Suddenly it has started opening on the last page it was on when shut down, and has started using tabs. When

  • Error 42408 with Itunes 10.4?

    Has anyone else received Error 42408 with Itunes 10.4.8?  If so, is there an easy, straightforward way to fix it?  All the answers I have found online so far sound very confusing.  I cannot connect to the store, or synch my Ipod Touch.  I noticed it

  • Apple Mail and Aol Imap not getting along

    I'm not a computer genius so I'm having a really hard time figuring this out and I hope someone out there can help me. I have the most current version of Leopard on my Macbook. I've always used my AOL Imap account on this computer and it's always wor

  • Can't pick a song to go on IPhone

    When I try to sync a sone (it could be any song) on my playlist it automaticly sync ALL of the playlist. What should I do? I know I have to mark the ones I want to sync(I have done this), I don't know how to put all the songs I want into it's own fol

  • Adobe DPS Android custom viewer using Angular

    Hi I have recently developed a custom viewer app for the ipad using the excellent articles and code examples that Derek Lu provided. This app used backbone as the MVP framework and communicated with Adobe DPS to retrieve folios and information using