Workflow email PDF attachment

All,
I'm using the following code in a zprogram/FM that will be called in a method to create an attachment to the workflow and then send the attachment through mail. But this is not working.
1) I trigger the wf thru idoc posting - works fine
2) The image is read successfully in the xstring format
3) When the background step is called that in turn calls this FM and supplies the WID of the wf (not the task), no image gets attached. But if i supply the wid of the wf directly and execute this FM in foreground, it attaches. in the background it gives this error "unable to attach the document"
4) in the next mailing step, I've bound the attachments container element  = mail step's container element. The mail also doesnt come with the attachments.
Please help.
Thanks,
Sam
Edited by: Rock on Jul 21, 2009 1:26 AM

REPORT  ysam_im_test_wf.
INCLUDE <cntn01>.
TYPE-POOLS: swlc.
INCLUDE <symbol>.
DATA :
lv_header TYPE swr_att_header,
lv_objsofm TYPE swotobjid-objtype,
lv_objtkey TYPE swotobjid-objkey.
* ls_fitment TYPE r_fitment_mstr,
DATA : lv_xstring TYPE xstring,
att_id TYPE swr_att_id,
lv_return TYPE sy-subrc.
DATA : bo_sofm TYPE swc_object .
DATA:  l_docwrapper1 TYPE xstring,
       l_existence(1) TYPE c.
DATA: t_message_lines TYPE swr_messag OCCURS 0 WITH HEADER LINE.
PARAMETERS: p_wid TYPE swr_struct-workitemid.
START-OF-SELECTION .
  CALL FUNCTION 'ZGEN_IMAGE_DATA_GET'
    EXPORTING
      i_zuonr              = '100028'
    IMPORTING
      l_docwrapper1        = l_docwrapper1
      existence            = l_existence
    EXCEPTIONS
      service_call_error   = 1
      file_download_error  = 2
      browser_invoke_error = 3
      OTHERS               = 4.
  lv_xstring = l_docwrapper1.
  IF lv_xstring IS NOT INITIAL.
    UPDATE tvarv SET low = 'XSTRING'
    WHERE name = 'ZSAMTEST1'.
    lv_header-file_type = 'B'.
    lv_header-file_name = 'Invoice Attachment'.
    lv_header-file_extension = 'PDF'.
    lv_header-language = 'EN'.
    CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
      EXPORTING
        workitem_id    = p_wid
        att_header     = lv_header
        att_bin        = lv_xstring
      IMPORTING
        return_code    = lv_return
        att_id         = att_id
      TABLES
        message_lines  = t_message_lines.
    IF lv_return = 0.
      lv_objtkey = att_id-doc_id.
      lv_objsofm = 'SOFM'.
      swc_create_object bo_sofm lv_objsofm lv_objtkey.
    ENDIF. " IF lv_return = 0
  ELSE.
    att_id = 0.
    lv_objtkey = att_id-doc_id.
    swc_create_object bo_sofm lv_objsofm lv_objtkey.
  ENDIF.

Similar Messages

  • In my Mac Mail Version 4.5, I am not received email pdf attachement. It is shown in some html like form in message content. Please help

    In my Mac Mail Version 4.5, I am not received email pdf attachement. It is shown in some html like form in message content. Please help

    Erdygirl please be aware you are posting to a public forum.  I have removed your personal information from your previous post.
    Please check your account at http://www.adobe.com/ to locate your serial number.  You can find more information on how to locate your serial number at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.

  • Email PDF attachements

    email PDF attachements that are open in ibooks will not close , and cant return to mail box in box

    This has happened to other users too. There seems to no solution to prevent it from happening. You can restore you iPad to service by either resetting your iPad:
    Press and hold both the Sleep/Wake button and the
    Home button for at least ten seconds, until the Apple logo appears.
    Or for some people turning of and then back on the specific Mail account in Setting does the trick.

  • Email PDF attachment not opening error

    Hi All,
    I am sending the PDF attachment through email when i get the mail and opening the attachment the PDF says "A drawing error occurred'. Can any one tell me how to solve this problem.
    i am doing otf to pdf conversion and the populate all the field related to the email.
    Is there any specific solution for this error.
    Regards,
    Lakshmikanth

    Hi All,
    I am sending the PDF attachment through email when i get the mail and opening the attachment the PDF says "A drawing error occurred'. Can any one tell me how to solve this problem.
    i am doing otf to pdf conversion and the populate all the field related to the email.
    Is there any specific solution for this error.
    Regards,
    Lakshmikanth

  • Dunning letter (email) PDF attachment or body of email

    Hi experts,
    What is the industry practice for dunning letters when sent via email? Attach them as a pdf to the email, or add all the content of the dunning letter to the body of the email to make it easier for the customer to receive the message?
    Thanks,
    Mario

    Hi Mario,
    It all depends on the functionality that and payment option that are provided.
    If the dunning letters contains and payment/remittance slip(through which customer can make payment in bank, outlet or post office) than the letter should go as PDF attached to mail with body saying that its the reminder for payment being missed,
    But if the payment option is not like as described above than you can send the the letter in html body mail.
    Regards

  • Can no longer open email PDF attachment in iBooks

    Just discovered can no longer open on iPad mini any email attachment PDF file in iBooks.  Cannot tap attachment and select open in iBooks. PDF attachment opens itself automatically on the body of the email. Is this a PDF problem or iPad problem or iBooks problem.

    It's not a problem with either app. Just hold down on the open PDF to bring up the "open in" window. If hold down on the open PDF and select "Quick Look" , that will give you the full screen file and you will see the share icon in the upper right corner.

  • External Email (PDF Attachment) while PO is created or Changed

    Hi All,
    I have a requirement as below.
    1. When a PO is created / changed then saved, the PO Form is to be sent to the respective vendor through External Email along with the PO Form printout generated.
    2. The PO Form is to be attached in the Email (PDF Document).
    Please write to me if you have a suitable solution for this requirement.
    I have created the PO Form in SAPScript. Is it possible to develop the above requirement in SmarForm? Please suggest me.
    Thanks in Advance,
    Kannan.

    Since you are using SAPScript I thought this solution would be simpler. We are also using SAPScript and email all document types when necessary.
    1. As suggested before: create an output type as an email type (Same as mornal output just the value 8 for transmission medium).
    2. For ease of maintainance I copied the associated printing program to a new program and link this new program to the output type as normal.
    3. In your print program make the following changes.
    (a) include code below just before your open form. You can read the email address from whereever you have them. In this example they are read from a custom z* table ZEMAIL_TEMP . Sometimes we read them from customer master, vendor master etc.
    (b) make sure you have the folowing export parameter in your "START_FORM" Function module
         MAIL_RECIPIENT = RECIPIENT_OBJ
    4. Make sure your conversion rules are set properly. Transaction code SCOT Setting-->Conversion Rules
    SAPScript text is an OTF type. We are converting our forms to PDF so we have the following entry:
    Format = OTF     
    Format to = PDF
    Ranking = 1        
    Function Module = SX_OBJECT_CONVERT_OTF_PDF</b>
    5. The are other bells and whistles (like changing the email header) that I can happily share once/if you are happy with your solution.
    Hope I am not missing any vital info.
    Good Luck

  • Want to create program which will trigger workflow with PDF attachement

    Hi Expert,
    I m new for work flow.
    I want to create abap program  which  trigger work flow with PDF attachment.
    Thanks in advanced.
    Regards,
    Laxman Sankhla.

    HI i have written code as per below.
    Now if i m running programe i m getting error  "Unable to create work item container
    (CL_SWF_RUN_WIM_FLOW->_IMPORT_CONTAINER) "
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER                = FP_FORMOUTPUT-PDF
        APPEND_TO_TABLE       = ' '
       IMPORTING
          OUTPUT_LENGTH         = ZVAR1
        TABLES
          BINARY_TAB            = IT_SOLIX_TAB.
      IF SY-SUBRC = 0 AND NOT IT_SOLIX_TAB[] IS INITIAL .
        SWC_SET_TABLE   CONTAINER 'IT_SOLIX_TAB'  IT_SOLIX_TAB.
        SWC_SET_ELEMENT CONTAINER 'ZVAR1' ZVAR1.
        SWC_SET_ELEMENT CONTAINER  'YBUS2012' OBJ.
        GV_INITIATOR = SY-UNAME.
        CALL FUNCTION 'SWW_WI_START_SIMPLE'
          EXPORTING
           CREATOR                            = GV_INITIATOR
          PRIORITY                           = SWFCO_NO_PRIO
            TASK                               = 'WS99900241'
           CALLED_IN_BACKGROUND               = 'X'
          TABLES
            AGENTS                             = IT_AGENTS
            WI_CONTAINER                       = CONTAINER.
        COMMIT WORK.
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Thanks in advanced
    Laxman Sankhla.

  • Emailing PDF attachment. Context is lost...

    Hi Folks
    In a previous post a asked about how to attach and send a dynamic PDF form.
    In the following code I determine the Form Name, get the FORMOUTPUT and add it to an email attachment.
    My problem now is that when I look in transaction SOST the attachment doesn't display any of the dynamic info supplied from the context.
    Could someone please help to tell me how I need to include this.
    <br>
    Thanks
    <br>
    * First get name of the generated function module<br>
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'<br>
      EXPORTING<br>
        i_name     ='ZSFPFLS_EX_WDA_CON'<br>
      IMPORTING<br>
        e_funcname = fm_name.<br>
    <br>
    * Set output parameters and open spool job<br>
    fp_outputparams-nodialog = 'X'. " suppress printer dialog popup<br>
    fp_outputparams-getpdf = 'X'. " launch print preview<br>
    fp_outputparams-PDFCHANGESRESTRICTED = 'N'. "Form can be filled out and signed and you can also create comments<br>
    <br>
    CALL FUNCTION 'FP_JOB_OPEN'<br>
      CHANGING<br>
        ie_outputparams = fp_outputparams<br>
      EXCEPTIONS<br>
        cancel          = 1<br>
        usage_error     = 2<br>
        system_error    = 3<br>
        internal_error  = 4<br>
        OTHERS          = 5.<br>
    <br>
    * Set form language and country (->form locale)<br>
    *fp_docparams-fillable = 'X'. "Only set this if the form must be interactive<br>
    fp_docparams-dynamic = 'X'.  "Only set this if the form must be interactive and dynamic<br>
    <br>
    * Now call the generated function module<br>
    CALL FUNCTION fm_name<br>
      EXPORTING<br>
        /1bcdwb/docparams       = fp_docparams<br>
        /1bcdwb/docxml          = fp_docxml<br>
      IMPORTING<br>
        /1bcdwb/formoutput      = fp_formoutput<br>
      EXCEPTIONS<br>
        usage_error             = 1<br>
        system_error            = 2<br>
        internal_error          = 3<br>
        OTHERS                  = 4.<br>
    <br>
    * Close spool job<br>
    CALL FUNCTION 'FP_JOB_CLOSE'<br>
      EXCEPTIONS<br>
        usage_error    = 1<br>
        system_error   = 2<br>
        internal_error = 3<br>
        OTHERS         = 4.<br>
    <br>
    * Now you have the PDF form in xstring format inside the field fp_formoutput-pdf<br>
    <br>
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'<br>
      EXPORTING<br>
        buffer = fp_formoutput-pdf<br>
      TABLES<br>
        binary_tab = itab.<br>
    <br>
    TRY.<br>
    *  " create email objects<br>
      l_o_send_request = cl_bcs=>create_persistent( ).<br>
    <br>
    <br>
    *  " sender<br>
      l_o_sender = cl_cam_address_bcs=>create_internet_address( REPLY_ADDRESS ).<br>
      l_o_send_request->set_sender( i_sender = l_o_sender ).<br>
    <br>
    <br>
    *  " recipient TO<br>
      l_o_recipient = cl_cam_address_bcs=>create_internet_address( ADDRESS).<br>
      l_o_send_request->add_recipient(<br>
      i_recipient = l_o_recipient<br>
      ).<br>
    <br>
    *  " create documents<br>
      l_o_document = cl_document_bcs=>create_document(<br>
      i_type = 'RAW' " RAW document format<br>
      i_text = l_it_contents<br>
      i_subject = SUBJECT<br>
      ).<br>
    *  l_o_send_request->set_document( l_o_document ).<br>
    <br>
    *  " add attachment<br>
      l_o_document->add_attachment( EXPORTING i_attachment_type = 'PDF'<br>
                                              i_attachment_subject = SUBJECT<br>
                                              i_att_content_hex = itab ).<br>
      l_o_send_request->set_document( l_o_document ).<br>
    <br>
    *  " send email<br>
      l_v_ret = l_o_send_request->send( ).<br>
    <br>
    CATCH cx_bcs INTO bcs_exception.<br>
    * exceptions, do something<br>
    ENDTRY.<br>
    <br>
    * never forget this one<br>
    COMMIT WORK.
    <br>

    /1BCDWB/DOCPARAMS and /1BCDWB/DOCXML are both generated by default when I create a form from within SE80 in a Web Dynpro View. The Interface gets generated automatically when linking the form to my context on the Web Dynpro View.
    fp_docparams-... gets filled:
    fp_docparams-langu = 'E'.
    fp_docparams-country = 'ZA'.
    fp_docxml is of type xstring and is now being filled by the PDFSource binary in my context. (Although this isn't yet producing results)
    I still don't see where I can add more parameters to the Interface in Tx SFP. I am in Change Mode, but find no option to add Parameters.
    If I do manage to add more parameters, how will I link these in my Form because I can't see the Parameters when in the Layout view of the form in Tx SFP..
    Thanks again. Do you have any other suggestions?

  • How do I change my default settings when opening an email PDF attachment?  I want it to "open" not "save as".  I did the Adobe chat but the steps he gave me for my Adobe Reader XI didn't match up with the options on my screen.

    It used to "open" but somehow must have flipped over to "save as"

    Hi Susan,
    Welcome to forums.
    As you mentioned that you received an email from Adobe. That is a auto generated email by the systems, so you don't need to worry about it, If you download the product today, according to system it starts from today however pratically, trial starts after you installed and first launch it. So please ignore that email
    You can install the FM in your desktop and laptop and activate it on both the machines however cannot use it at the same time as per User License Agreement. As Harpeet mentioned the email for support team, you can post your question on forums or to that email.
    Hope this answers your query.
    Thanks
    Priyank

  • Pdf attachment through workflow

    Hi SDNers,
    I need to attach a PDF to send mail in my workflow. Workflow triggers whenever PO changed or release at ME22N or ME21N.
    Which PO has been changed, data PO details need to display in PDF.
    For this I created a smarform by passing PO number. I created attribute for emailaddress, in this i written code. But, when executed manually it is going. but I changed or release from ME22N or ME21N just a body mail is going butwithout attachment.Please suggest me. Here is the code which I have written in the attribute.
    FORM SELECT_TABLE_ADR6 USING SUBRC LIKE SY-SUBRC.
      TYPES: BEGIN OF ty_ekko,
             ebeln TYPE ebeln,
             lifnr TYPE lifnr,
             END OF ty_ekko,
             BEGIN OF ty_lfa1,
             lifnr TYPE lifnr,
             adrnr TYPE adrnr,
             END OF ty_lfa1.
      DATA: it_ekko TYPE STANDARD TABLE OF ty_ekko INITIAL SIZE 0,
            it_lfa1 TYPE STANDARD TABLE OF ty_lfa1 INITIAL SIZE 0,
            wa_ekko TYPE ty_ekko,
            wa_lfa1 TYPE ty_lfa1.
    DATA: gv_form_name TYPE rs38l_fnam,
          gv_bin_filesize TYPE i,
          gv_pos TYPE i,
          gv_len TYPE i,
          gv_tab_lines TYPE i.
    DATA: gc_text(11) TYPE c VALUE 'Form Output',
          gc_tst(3) TYPE c VALUE 'TST',
          gc_testing(20) TYPE c VALUE 'PURCHASE ORDER'.
    DATA: gs_docdata TYPE sodocchgi1,
          gs_ctrlop TYPE ssfctrlop,
          gs_outopt TYPE ssfcompop,
          gs_otfdata TYPE ssfcrescl,
          gs_reclist TYPE somlreci1,
          gs_copy type somlreci1,
          gs_pdf_tab TYPE tline,
          gs_objbin TYPE solisti1,
          GS_OBJTXT TYPE SOLISTI1,
          gs_objpack TYPE sopcklsti1.
    DATA: gt_reclist TYPE TABLE OF somlreci1,
          gt_copy type table of somlreci1,
          gt_pdf_tab TYPE TABLE OF tline,
          gt_otf TYPE TABLE OF itcoo,
          gt_objbin TYPE TABLE OF solisti1,
          GT_OBJTXT  TYPE TABLE OF SOLISTI1,
          gt_objpack TYPE TABLE OF sopcklsti1.
    DATA: G_SMTP_ADDR type AD_SMTPADR.
    DATA: p_plist(40) type C,
          gc_c type  C,
          gc_u type C.
    CLEAR : gv_form_name,
            gs_ctrlop,
            gs_outopt,
            gs_otfdata,
            gv_bin_filesize,
            gv_pos,
            gv_len,
            gv_tab_lines.
      IF OBJECT-_ADR6-CLIENT IS INITIAL
      AND OBJECT-_ADR6-ADDRNUMBER IS INITIAL
      AND OBJECT-_ADR6-PERSNUMBER IS INITIAL
      AND OBJECT-_ADR6-DATE_FROM IS INITIAL
      AND OBJECT-_ADR6-CONSNUMBER IS INITIAL.
        SELECT ebeln lifnr FROM ekko INTO TABLE it_ekko
        WHERE ebeln = object-key-purchaseorder.
        SELECT lifnr adrnr FROM lfa1 INTO TABLE it_lfa1
        FOR ALL ENTRIES IN it_ekko WHERE lifnr = it_ekko-lifnr.
        READ TABLE it_lfa1 INTO wa_lfa1 INDEX 1.
        SELECT SINGLE * FROM ADR6 CLIENT SPECIFIED
            WHERE CLIENT = SY-MANDT
            AND ADDRNUMBER = WA_LFA1-ADRNR.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZMMF_PUR_DOMESTIC001'
        IMPORTING
          fm_name            = gv_form_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      gs_ctrlop-getotf = 'X'.
      gs_ctrlop-device = 'PRINTER'.
      gs_ctrlop-LANGU   = SY-LANGU.
       gs_ctrlop-no_dialog = 'X'.
       gs_outopt-tddest = 'LP01'.
       gs_outOPT-TDIMMED = 'X'.
       gs_OUTOPT-TDRECEIVER = SY-UNAME.
       gs_OUTOPT-TDNOPREV = 'X'.
    CALL FUNCTION gv_form_name
         EXPORTING
           control_parameters = gs_ctrlop
           output_options     = gs_outopt
         user_settings      = us_screen
          user_settings      = ent_retco
         customer           = customer
         bookings           = bookings
         connections        = connections
           i_ebeln            = object-key-purchaseorder
         IMPORTING
           job_output_info    = gs_otfdata
         EXCEPTIONS
           formatting_error   = 1
           internal_error     = 2
           send_error         = 3
           user_canceled      = 4.
    CLEAR gt_otf.
      gt_otf[] = gs_otfdata-otfdata[].
    Convert the OTF DATA to SAP Script Text lines
      CLEAR gt_pdf_tab.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 200
        IMPORTING
          bin_filesize          = gv_bin_filesize
        TABLES
          otf                   = gt_otf
          lines                 = gt_pdf_tab
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          OTHERS                = 4.
    Data : Order(50) type c,
           sep(10) type c value ' / '.
      CLEAR gs_docdata.
      gs_docdata-obj_name = gc_tst.
        CONCATENATE gc_testing sep 'test mail' into order.
      gs_docdata-obj_descr = order.
      CLEAR : gt_reclist, gs_reclist.
      REFRESH: GT_RECLIST, GT_OBJPACK, GT_OBJBIN.
      clear:  gt_copy, gs_copy.
    IF internal mail id
      gs_reclist-receiver = ADR6-SMTP_ADDR.
      GS_RECLIST-REC_TYPE = 'U'.
      APPEND gs_reclist TO gt_reclist.
    APPEND gs_copy to gt_copy.
    CLEAR : gs_objbin, gs_pdf_tab.
      LOOP AT gt_pdf_tab INTO gs_pdf_tab.
        gv_pos = 255 - gv_len.
        IF gv_pos > 134. "length of pdf_table
          gv_pos = 134.
        ENDIF.
        gs_objbin+gv_len = gs_pdf_tab(gv_pos).
        gv_len = gv_len + gv_pos.
        IF gv_len = 255. "length of out (contents_bin)
          APPEND gs_objbin TO gt_objbin.
          CLEAR: gs_objbin, gv_len.
          IF gv_pos < 134.
            gs_objbin = gs_pdf_tab+gv_pos.
            gv_len = 134 - gv_pos.
          ENDIF.
        ENDIF.
      ENDLOOP.
    IF gv_len > 0.
        APPEND gs_objbin TO gt_objbin.
      ENDIF.
    Filling the details in SAPoffice: Description of Imported
      DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
      CLEAR gs_objbin.
      READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
      IF sy-subrc = 0.
        gs_objpack-transf_bin = 'X'.
        gs_objpack-head_start = 1.
        gs_objpack-head_num = 0.
        gs_objpack-body_start = 1.
        gs_objpack-body_num = gv_tab_lines.
        gs_objpack-doc_type = 'PDF'.
        gs_objpack-obj_name = 'ATTACHMENT'.
        gs_objpack-obj_descr = 'test'.
        APPEND gs_objpack TO gt_objpack.
      ENDIF.
    IF p_plist IS NOT INITIAL.
    gs_reclist-receiver = p_plist.
    gs_reclist-rec_type = gc_c.
    APPEND gs_reclist TO gt_reclist.
    CLEAR gs_reclist.
    ENDIF.
    Populating the reciever list
    gs_reclist-receiver = p_plist.
    gs_reclist-rec_type = gc_c.
    APPEND gs_reclist TO gt_reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA                    = gs_docdata
       PUT_IN_OUTBOX                    = 'X'
       COMMIT_WORK                      = 'X'
    IMPORTING
      SENT_TO_ALL                      =
      NEW_OBJECT_ID                    =
      TABLES
        PACKING_LIST                     = gt_objpack
      OBJECT_HEADER                    =
       CONTENTS_BIN                     = gt_objbin
      CONTENTS_TXT                     =
      CONTENTS_HEX                     =
      OBJECT_PARA                      =
      OBJECT_PARB                      =
        RECEIVERS                        = gt_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.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    and return.
    ENDIF.

    Hi-
    You need to convert the smartform's OTF data to PDF and then create a SOFM instance. Now bind this SOFM instance to workflow container 'ATTACH_OBJECTS' in your email step and your smartform will be showed as a PDF attachment
    Vinoth

  • Sapscript as PDF-Attachment in Workflow

    Hi Experts,
    I am trying to create a new workflow for releasing purchase orders.
    If the workitem passes all the controlling steps of the management, it should be sent automatically as PDF via email to our vendor.
    The problem is, how to get the PDF as an attachment? We are using SAPscript for our PO formular  (and of course the PDF-Attachment should look like the printed version).
    I was already looking in the internet for a solution, but it is really hard to find some answers for this problem.
    Many thanks for your help,
    Christoph

    Hi all,
    many thanks for your help.
    The workflow should run in this way. The purchaser creates an order --> supervisor gets a SAP Mail (workflow user decision step) to accept it --> the supervisor of the supervisor then gets a SAP mail to accept it --> PDF is sent to the vendor (only if everybody signed this PO before).
    I will try following now: I will create a new workflow task to execute a method (for getting the PO as a PDF attachment) and a new workflow container item to store the attachment.
    As next WF step I will use the standard send mail step.
    Are I am right with this soulution (nothing programmed yet, still not so sure how to do it - but hope to find a solution to manage this).
    Many thanks for your help again.
    Chris

  • I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I am not aware of a way except for photos that allows you to select multiple files in an email. I even checked settings in the Adobe Reader app, and it does not show that ability.

  • Want to Send smartform as pdf attachment with a Email to some mail id

    Hi ,
    I want to send a smartform as a PDF attachment with a mail to a mail id. And I can send a mail with the PDF attachment.
    But I am not able to open the PDF. It is throwing some error (Adobe reader could not open u2018fileu2019 because it is either not a supported file type or because the file has been damaged (for example , it was sent as an email attachment and was not correctly decoded)).
    By debugging I come to know that the file which is generating is in some encoding format.
    Please help me regard this. This is very urgent.
    here is the code,
    Main Program :
    REPORT Ztest_report.
    *--Top Include for Global Data Declarations.
    INCLUDE ztest_report_top.
    *--Form Include for Form Routines.
    INCLUDE ztest_report_form.
    START-OF-SELECTION.
    START-OF-SELECTION.
    *--Display data
      Perform display_data.
    END-OF-SELECTION.
    Top declaration :
    Internal table
    DATA :  i_otfdata TYPE tsfotf,          " Smart Forms: Table OTF
            i_tline TYPE TABLE OF tline WITH HEADER LINE,
            i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
            i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
            i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
            i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
            i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
            w_mailaddr TYPE ppfdmailad,
            w_mailtype TYPE so_escape,
            w_mailrecipient TYPE swotobjid,
            w_control TYPE ssfctrlop,
            w_compop TYPE ssfcompop,
            w_return TYPE ssfcrescl,
            wa_doc_chng TYPE sodocchgi1,
            w_data TYPE sodocchgi1,
            wa_buffer TYPE string, "To convert from 132 to 255
            wa_objhead TYPE soli_tab,
    Variables declarations
            v_form_name TYPE rs38l_fnam,
            v_len_in LIKE sood-objlen,
            v_len_out LIKE sood-objlen,
            v_len_outn TYPE i,
            v_lines_txt TYPE i,
            v_lines_bin TYPE i.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-009.
    PARAMETER:      p_bukrs TYPE bukrs OBLIGATORY,            "Company Code
                    p_belnr TYPE belnr_d OBLIGATORY,          "Document No
                    p_gjahr TYPE gjahr OBLIGATORY,            "document type
                    p_mailid(50) TYPE c OBLIGATORY.
    "Mail Id
    SELECTION-SCREEN END OF BLOCK blk1.
    Form Logic :
    FORM display_data.
    *Local Variable declaration
      DATA: lc_fm TYPE rs38l_fnam,       "local variable to store the
            l_i_document_output_info TYPE ssfcrespd,
            l_i_struc_job_output_info TYPE ssfcrescl,
            l_i_struc_job_output_options TYPE ssfcrescl,
            i_lines TYPE TABLE OF tline WITH HEADER LINE,
            lv_job_output_info      TYPE ssfcrescl,
            lv_document_output_info TYPE ssfcrespd,
            lv_job_output_options   TYPE ssfcresop,
            lv_bin_filesize         LIKE sood-objlen.
    Determine the smartform name
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                formname           = 'ZTEST_SMARTFORM'
           IMPORTING
                fm_name            = lc_fm
           EXCEPTIONS
                no_form            = 1
                no_function_module = 2
                OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      w_control-getotf = 'X'.
      w_control-no_dialog = 'X'.
      w_control-preview = space.
    w_control-device = 'MAIL'.
    Call the smartform and pass the selection screen parameter
      CALL FUNCTION lc_fm
           EXPORTING
                control_parameters = w_control
                output_options     = w_compop
                user_settings      = 'X'
                t_bukrs            = p_bukrs
                t_belnr            = p_belnr
                t_gjahr            = p_gjahr
           IMPORTING
                job_output_info    = l_i_struc_job_output_info
           EXCEPTIONS
                formatting_error   = 1
                internal_error     = 2
                send_error         = 3
                user_canceled      = 4
                OTHERS             = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Moving the Smart Forms: Table OTF into an internal table
      i_otfdata[] = l_i_struc_job_output_info-otfdata[].
    CONVERT TO OTF TO PDF.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
           IMPORTING
                bin_filesize          = lv_bin_filesize
           TABLES
                otf                   = i_otfdata
                lines                 = i_lines
           EXCEPTIONS
                err_max_linewidth     = 1
                err_format            = 2
                err_conv_not_possible = 3
                err_bad_otf           = 4
                OTHERS                = 5.
    IF sy-batch EQ l_c_no.
    To directly view the print-preview in PDF format
      CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
           EXPORTING
                i_otf                    = i_otfdata
           EXCEPTIONS
                convert_otf_to_pdf_error = 1
                cntl_error               = 2
                OTHERS                   = 3.
    For Sending the PDF file to a Mail ID.
    LOOP AT i_lines.
       TRANSLATE i_lines USING '~'.
       CONCATENATE wa_buffer i_lines INTO wa_buffer.
    ENDLOOP.
    TRANSLATE wa_buffer USING '~'.
    DO.
       i_record = wa_buffer.
       APPEND i_record.
       SHIFT wa_buffer LEFT BY 255 PLACES.
       IF wa_buffer IS INITIAL.
         EXIT.
       ENDIF.
    ENDDO.
      DATA: BEGIN OF zlines OCCURS 0,
      tline TYPE char255,
      END OF zlines.
    *Change the PDF format from 132 to 255.
      CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
           EXPORTING
                transfer_bin                = 'X'
           TABLES
                content_in                  = i_lines
                content_out                 = zlines
           EXCEPTIONS
                err_line_width_src_too_long = 1
                err_line_width_dst_too_long = 2
                err_conv_failed             = 3
                OTHERS                      = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
        WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Attachment
      REFRESH: i_reclist,
      i_objtxt,
      i_objbin,
      i_objpack.
      CLEAR wa_objhead.
      i_objbin[] = zlines[].
    Create Message Body Title and Description
      i_objtxt = 'test with pdf-Attachment!'.
      APPEND i_objtxt.
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      wa_doc_chng-obj_name = 'smartform'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr = 'smartform'.
      wa_doc_chng-sensitivty = 'F'.
      wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
      i_objpack-body_num = v_lines_txt.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
    Attachment (pdf-Attachment)
      i_objpack-transf_bin = 'X'.
      i_objpack-head_start = 1.
      i_objpack-head_num = 1.
      i_objpack-body_start = 2.
    I_OBJPACK-DOC_TYPE = 'RAW'.
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      i_objpack-doc_size = v_lines_bin * 255 .
      i_objpack-body_num = v_lines_bin.
      i_objpack-doc_type = 'PDF'.
      i_objpack-obj_name = 'smart'.
      i_objpack-obj_descr = 'test'.
      APPEND i_objpack.
      CLEAR i_reclist.
      i_reclist-receiver = p_mailid.
      i_reclist-rec_type = 'U'.
      APPEND i_reclist.
    Send new document with attachments via RFC
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data              = wa_doc_chng
                put_in_outbox              = 'X'
                commit_work                = 'X'
           TABLES
                packing_list               = i_objpack
                object_header              = wa_objhead
                contents_bin               = i_objbin
                contents_txt               = i_objtxt
                receivers                  = i_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.
        WRITE:/ 'Error When Sending the File', sy-subrc.
      ELSE.
        WRITE:/ 'Mail sent'.
      ENDIF.
    ENDFORM.                    " display_data

    hi,
    i wrote a programm.for me it is working.i think it will help for u.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = form_name
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'mail id'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = WA_DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_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.
      WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
      WRITE:/ 'Mail sent'.
    ENDIF.
    please reward me if helpful.

  • Email Invoices to customer as a PDF attachment

    Hi,
    I have a requirement as follows:-
    SAP will get multiple invoice numbers from an external system. I need to send all the invoices(for a given customer) in one pdf and email it to the customer  as an attachment.
    Please provide your expert and detailed advice.
    Thanks,
    Ani

    Hi Ani,
    Go through this u definetly got ur solution.
    Here is the code to send the Smartform to mail as PDF attachment.
    *& Report ZTEST_NREDDY_PDF_MAIL
    REPORT ZTEST_NREDDY_PDF_MAIL.
    Internal Table declarations
    DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
    I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
    I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
    I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
    I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    WA_OBJHEAD TYPE SOLI_TAB,
    W_CTRLOP TYPE SSFCTRLOP,
    W_COMPOP TYPE SSFCOMPOP,
    W_RETURN TYPE SSFCRESCL,
    WA_DOC_CHNG TYPE SODOCCHGI1,
    W_DATA TYPE SODOCCHGI1,
    WA_BUFFER TYPE STRING, "To convert from 132 to 255
    Variables declarations
    V_FORM_NAME TYPE RS38L_FNAM,
    V_LEN_IN LIKE SOOD-OBJLEN,
    V_LEN_OUT LIKE SOOD-OBJLEN,
    V_LEN_OUTN TYPE I,
    V_LINES_TXT TYPE I,
    V_LINES_BIN TYPE I.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    FORMNAME = 'ZTEST'
    IMPORTING
    FM_NAME = V_FORM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    W_CTRLOP-GETOTF = 'X'.
    W_CTRLOP-NO_DIALOG = 'X'.
    W_COMPOP-TDNOPREV = 'X'.
    CALL FUNCTION V_FORM_NAME
    EXPORTING
    CONTROL_PARAMETERS = W_CTRLOP
    OUTPUT_OPTIONS = W_COMPOP
    USER_SETTINGS = 'X'
    IMPORTING
    JOB_OUTPUT_INFO = W_RETURN
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I_OTF[] = W_RETURN-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    IMPORTING
    BIN_FILESIZE = V_LEN_IN
    TABLES
    OTF = I_OTF
    LINES = I_TLINE
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    OTHERS = 4.
    IF SY-SUBRC <> 0.
    ENDIF.
    LOOP AT I_TLINE.
    TRANSLATE I_TLINE USING '~'.
    CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
    I_RECORD = WA_BUFFER.
    APPEND I_RECORD.
    SHIFT WA_BUFFER LEFT BY 255 PLACES.
    IF WA_BUFFER IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Attachment
    REFRESH: I_RECLIST,
    I_OBJTXT,
    I_OBJBIN,
    I_OBJPACK.
    CLEAR WA_OBJHEAD.
    I_OBJBIN[] = I_RECORD[].
    Create Message Body Title and Description
    I_OBJTXT = 'test with pdf-Attachment!'.
    APPEND I_OBJTXT.
    DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
    READ TABLE I_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR I_OBJPACK-TRANSF_BIN.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    I_OBJPACK-BODY_NUM = V_LINES_TXT.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND I_OBJPACK.
    Attachment (pdf-Attachment)
    I_OBJPACK-TRANSF_BIN = 'X'.
    I_OBJPACK-HEAD_START = 1.
    I_OBJPACK-HEAD_NUM = 0.
    I_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
    READ TABLE I_OBJBIN INDEX V_LINES_BIN.
    I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    I_OBJPACK-BODY_NUM = V_LINES_BIN.
    I_OBJPACK-DOC_TYPE = 'PDF'.
    I_OBJPACK-OBJ_NAME = 'smart'.
    I_OBJPACK-OBJ_DESCR = 'test'.
    APPEND I_OBJPACK.
    CLEAR I_RECLIST.
    I_RECLIST-RECEIVER = '[email protected]'.
    I_RECLIST-REC_TYPE = 'U'.
    APPEND I_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    COMMIT_WORK = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_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.
    WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
    WRITE:/ 'Mail sent'.
    ENDIF.
    If you want to send some text as Body of the Mail then follow this once
    when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
    1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
    2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
    I_OBJPACK-TRANSF_BIN = ' '.
    I_OBJPACK-HEAD_START = 000000000000001.
    I_OBJPACK-HEAD_NUM = 000000000000001.
    I_OBJPACK-BODY_START = 000000000000002
    I_OBJPACK-BODY_NUM = 000000000000010.
    I_OBJPACK-DOC_TYPE = 'RAW'.
    append I_OBJPACK-.
    by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    DOCUMENT_DATA = WA_DOC_CHNG
    PUT_IN_OUTBOX = 'X'
    TABLES
    PACKING_LIST = I_OBJPACK
    OBJECT_HEADER = WA_OBJHEAD
    CONTENTS_BIN = I_OBJBIN
    CONTENTS_TXT = I_OBJTXT
    RECEIVERS = I_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.
    Reward points if helpful.
    Thanks
    Naveen khan

Maybe you are looking for

  • Getting Price from KONV table for Purchase Order

    Hi All, I have to use the KONV table to get the Net Price for the Purchase Order Line Item. I am confused over the field KONV-KBETR because for Currency 'JPY' it shown a wrong figure. This is how I read the KONV table; SELECT SINGLE KBETR   INTO ITAB

  • SQL Server synonym used in two ways, local table and Oracle table via ODBC, fails on ODBC

    I am implementing a Web Site at our institution that was written for another institution that was all SQL Server.The Web Site has included as a feature the use of synonyms which have a dual use. Normally they point to a different machine, different d

  • Prblem with iSCSI on Win Server 2012R2 with HyperV role

    Hi all, I have some problems with iSCSI on Win server. The problem is the following. When I restart server it cannot find the path with VMs configuration and VMs can't start. After few minutes all problems are gone and HyperV can find everything but

  • Remove fields from MSS (60.1.2) iViews

    Hi, I have one issue related to removing fields from standard iViews in MSS 60.1.2. Could this be handled by object and data provider customizing in R3 or do I have to develop an new iView? /Regards Patrick

  • Consuming Exigo Webservices

    I am working with a company named Exigo. They have posted their webservices API publicly at http://api.exigo.com/3.0/ since you need proper  credentials (which I have, of course) in order to actually use it. If you go there, let's say to the GetCusto