Smartforms - Email

Hi Experts,
Plz tell me how to send (email) the output of a purchase order when i save it in ME21n or me22n like ALE.

hi
chk this
Re: How to email Smartforms
hope this helps
regards
Aakash Banga

Similar Messages

  • Send Smartform Email via Action Profile

    Hello,
    We have an Action Profile with a few actisn athat a workign perfectly.  I have added a new action to send  smartform via email when the the transaction is saved.
    The Action profile is set upfor object type BUS2000115(Quotation) with the context class of CL_DOC_CONTEXT_CRM_ORDER.
    I have set up the Smartform Email action processing as follows:
    Permitted processign type fo Action - Smartform Email
    Mail Settings:
    Form Name                       YC3_SF_CRM_COMM_QUOTATION_V7
    Processing Class              CL_CRM_BP_UM_PROCESSING_PPF
    Processing Method           UM_EXEC_SMART_FORM
    Archive Mode                    Mail only
    there is no schedule or start condition as it is not required.
    When I Save the Quotation nothing is getting triggered.  If in the Quotation I Preview output and select 'Email Quotation; I get the message 'Smartform Error'.  Is there a way to debug the message further ?  I'm assuming this is the SAP standard method of achieving Smartform email as Pdf attachment, are some steps that I have missed ?
    Regards
    Chan

    The Processing class and Processing Method seem to be incorrect.
    Use the below;
    Processing Class  : CL_DOC_PROCESSING_CRM_ORDER
    Processing Method: CRM_ORDER_EXEC_SMART_FORM
    You can always refer to standard action profile for Quotations to see what SAP has delivered.

  • Email Links In Smartforms emailed as a PDF

    All,
    I have written a program that creates a smartform as a PDF attachment which gets sent as an email. Part of the content contains URL's for the recipient to click and navigate to an page on our erecruitment system. The problem is that the url is over a line long and does not look very user friendly.
    What i would like to do is have the words "click here" appear as a link so when the user clicks on it, it will take them to the correct url. My question is how do I make those words appear with the correct URL behind it?
    thanks
    Shippy

    Hi,
    this can be achieved by using a replacement function module. This module writes the url and the link text which shall appear in the document in a global buffer. If you then write the link text in the smartform (directly or from a variable) and mark this as link the smartform processing automatically puts the ur behind the link.
    In the output_options parameter of the smartfor there is a field urlcall this field has to be filled. As function module you can use HR_RCF_SF_URL_CALLBACK. As function module to set the link texts / url pairs to the context use HR_RCF_SF_URL_PREPARE_CALLBACK.
    Best regards
    Roman

  • Variable subject for SmartForms email

    Hi All,
    At my clients SAP system (ECC 5.0), we are using SmartForms for the output of documents.
    In this case I am talking about invoices.
    Customzing is setup to use standard SAP program RLB_INVOICE and an invoice smartform which is copy of SAP invoice, but then adjusted for my clients needs. This works perfect for quite some time now.
    Since recently email was setup so these invoices can be mailed directly to the customers, but we face the problem that when invoices are sent via email, the subject is always the same.
    This makes sence because it is set in the output type (mail title and texts), But we would like to make this a variable text, e.g. Invoice_1234567890 (where 1234567890 is the SAP invoice number)
    Has anyone experience in doing this?
    - Is there a way to insert a variable in the subject of the email?
    - Which veriables can be chosen?
    - Is there a user-exit to overrule the Standard SAP behaviour (I could not find it)
    Of couse a Z program can be created to convert the OTF to PDF and sent your own created email, but I would really like to keep using the standard SAP program.
    Thanks very much.
    Kind regards,
    Dave Verkoelen

    I think OUTPUT_OPTIONS-TDCOVTITLE generate a subject in the Email.
    I have tried to update that field using field symbols in the Smartform but, I was not successful.
    * Modifying in Smartform Main program
    field-symbols: <fs> type SSFCOMPOP.
    assign ('(SAPLSTXBC)SSFPO') to <fs>.
    <fs>-TDCOVTITLE = 'test Title from Smartform'.
    * Modifying in FM's parameter
    field-symbols: <fs1> type SSFCOMPOP.
    assign ('(/1BCDWB/SAPLSF00000166)OUTPUT_OPTIONS') to <fs1>.
    <fs1>-TDCOVTITLE = 'test Title from Smartform'.
    So, I think you need to copy the RLB_INVOICE to Z and than change the title.
    Regards,
    Naimesh Patel

  • Smartforms emailed as PDF but can't be opened

    Hello all,
    Several of our SAP users will do a 'Print Preview' of a document to their screen. We are using Smartforms for this. Then they will click on the 'Send e-mail' button and send the document to their email address. It comes to their email as a PDF attachment. Some users, but not all, cannot open the PDF attachment. They get the following error:
    'Can't create file: 'filename'.pdf. Right-click the folder you want to create the file in, and then click Properties on the shortcut menu to check your permissions on the folder.'
    This does not happen to everyone. Also, when they can't open the PDF file, they can forward it to someone else who can open the file and that person will open it, save it with a different name and then email it back to the person who originally couldn't open it. Now they can open the PDF file.
    Any ideas on where to start looking for the source of the problem, SAP, Adobe, PC settings, etc?
    Thanks,
    Rick

    hi,
    Please Double check your Cording ,
    REPORT zemail_gm.
    *********Variable Declarations *****************************
    DATA: gv_form_name TYPE rs38l_fnam, " Used to store the function module generated by Smartform
    gv_bin_filesize TYPE i, " Store the file size
    gv_pos TYPE i,
    gv_len TYPE i,
    gv_tab_lines TYPE i.
    ********Constants *******************************************
    Data : gc_text(11) type c value 'Form Output',
    gc_tst(3) type c value 'TST',
    gc_testing(7) type c value 'Testing'.
    *********Work Area Declarations *****************************
    DATA: gs_docdata TYPE sodocchgi1, " Data of an object which can be changed
    gs_ctrlop TYPE ssfctrlop, " Smart Forms: Control structure
    gs_outopt TYPE ssfcompop, " SAP Smart Forms: Smart Composer (transfer) options
    gs_otfdata TYPE ssfcrescl, " Smart Forms: Return value at end of form printing
    gs_reclist TYPE somlreci1, " SAPoffice: Structure of the API Recipient List
    gs_pdf_tab TYPE tline, " Workarea for SAP Script Text Lines
    gs_objbin TYPE solisti1, " SAPoffice: Single List with Column Length 255
    gs_objpack TYPE sopcklsti1. " SAPoffice: Description of Imported Object Components
    *********Internal tables Declarations *****************************
    DATA: gt_reclist TYPE TABLE OF somlreci1, " SAPoffice: Structure of the API Recipient List
    gt_pdf_tab TYPE TABLE OF tline, " SAPscript: Text Lines
    gt_otf TYPE TABLE OF itcoo, " OTF Structure
    gt_objbin TYPE TABLE OF solisti1, " SAPoffice: Single List with Column Length 255
    gt_objpack TYPE TABLE OF sopcklsti1. " SAPoffice: Description of Imported Object Components
    CLEAR : gv_form_name,
    gs_ctrlop,
    gs_outopt,
    gs_otfdata,
    gv_bin_filesize,
    gv_pos,
    gv_len,
    gv_tab_lines.
    START-OF-SELECTION.
    u2022     Generate Function Module name
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZPDF_G'
    IMPORTING
    fm_name = gv_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.
    u2022     Assigning values to Form Control Structure and Form Composer
    gs_ctrlop-getotf = 'X'.
    gs_ctrlop-no_dialog = 'X'.
    gs_outopt-tdnoprev = 'X'.
    u2022     Getting the OTFDATA
    CALL FUNCTION gv_form_name
    EXPORTING
    control_parameters = gs_ctrlop
    output_options = gs_outopt
    user_settings = 'X'
    IMPORTING
    job_output_info = gs_otfdata
    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.
    u2022     Assigning the OTFDATA to OTF Structure table
    CLEAR gt_otf.
    gt_otf] = gs_otfdata-otfdata[.
    u2022     Convert the OTF DATA to SAP Script Text lines
    CLEAR gt_pdf_tab.
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    max_linewidth = 132
    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.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    u2022     Assigning the Description of the object sent in the mail
    CLEAR gs_docdata.
    gs_docdata-obj_name = gc_tst.
    gs_docdata-obj_descr = gc_testing.
    u2022     Assigning the email id to Structure of the API Recipient List table
    CLEAR : gt_reclist, gs_reclist.
    gs_reclist-receiver = 'mail id of recipent'.
    gs_reclist-rec_type = 'U'.
    APPEND gs_reclist TO gt_reclist.
    u2022     Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
    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.
    u2022     Filling the details in SAPoffice: Description of Imported Object Components table
    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-doc_size = ( gv_tab_lines - 1 ) * 255 + STRLEN( gs_objbin ).
    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.
    u2022     Sending the Form Output in the PDF format to email
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = gs_docdata
    put_in_outbox = 'X'
    commit_work = 'X'
    TABLES
    packing_list = gt_objpack
    contents_bin = gt_objbin
    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.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    WRITE 'Sent Successfully'.
    ENDIF.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    END-OF-SELECTION.

  • How to add body text to smartform email?

    Hi,
    In release 620, how can you add text to the mail message that is generated from e-mailing a smartform.  I need to add a small message to the body of the message in addition to the attachment.
    i.e. Please find attached your invoice. [attachement.pdf]
    Thanks,
    Guy

    I don't know SmartForm so there may be another way to do it but the following approach was fine for Sapscript.
    Basically have a look at the SAP sample programs bcs_example_* where * = 1 thru 5. I think bcs_example_5 is the one to focus on. This creates a simple email and then adds an attachemnt to it. In your case you want the attachment to be your SmartForm's output.
    For the SapScript I was able to call the form from abap, receive the output into a table whose contents I could then attach to the email.
    The attachment code needs to be changed to set type to OTF:
    i_attachment_type = 'OTF'
    I'll speak in SAPscript and hope there are equivalent terms in SmartForm. I created the following abap form to run the SAPscript and get it's output into a table:
         Form  GET_OTF_CODE
    FORM  get_otf_code
    USING us_work       TYPE zsd_fet_signup_confirm
    CHANGING ch_otf_out TYPE solix_tab.
      DATA: BEGIN OF otf OCCURS 0.
              INCLUDE STRUCTURE itcoo .
      DATA: END OF otf.
      DATA: itcpo LIKE itcpo.
      DATA: itcpp LIKE itcpp.
      CLEAR itcpo.
      itcpo-tdgetotf = 'X'.
    Start writing OTF code
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          form     = 'ZSD_FET_COVERFAX'
          language = sy-langu
          OPTIONS  = itcpo
          dialog   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      CALL FUNCTION 'START_FORM'
        EXCEPTIONS
          error_message = 01
          OTHERS        = 02.
      CASE us_work-recipient_type.
        WHEN c_agent_recipient.
          w_recipient_name = us_work-agent.
        WHEN c_asm_recipient.
          w_recipient_name = us_work-asm.
        WHEN OTHERS.
          w_recipient_name = 'IPL Agent/ASM'.
      ENDCASE.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          window        = 'MAIN'
          element       = 'HEADER'
        EXCEPTIONS
          error_message = 01
          OTHERS        = 02.
      CALL FUNCTION 'WRITE_FORM'
        EXPORTING
          window        = 'MAIN'
          element       = 'TEXT'
        EXCEPTIONS
          error_message = 01
          OTHERS        = 02.
    Close up Form and get OTF code
      CALL FUNCTION 'END_FORM'
        EXCEPTIONS
          error_message = 01
          OTHERS        = 02.
      MOVE-CORRESPONDING itcpo TO itcpp.
      CALL FUNCTION 'CLOSE_FORM'
        IMPORTING
          RESULT  = itcpp
        TABLES
          otfdata = otf
        EXCEPTIONS
          OTHERS  = 1.
    Move OTF code to output structure
      REFRESH ch_otf_out.
      LOOP AT otf.
        APPEND otf TO ch_otf_out.
      ENDLOOP.
    ENDFORM.                    "GET_OTF_CODE

  • Smartform email

    Hello Gurus,
    My requirement is to send an invoice smartform as pdf attachment thru email to customer. I'm able to do it successfully using output determination and SCOT setting for smartform as 'pdf'. But in Production system, the SCOT setting is 'TXT' for smartform and due to some dependencies, BASIS not supposed to change the 'TXT' to 'PDF'. How can I achieve this without changing the SCOT setting? I know we can do it using an ABAP program but I don't want to go with it now. Please let me know how can I achieve it? will there be any user specific settings in scot?
    Thanks,
    Raju.

    Hi Raju,
    the SCOT setting is 'TXT' for smartform and due to some dependencies, BASIS not supposed to change the 'TXT' to 'PDF'.
    This setting makes no effect. I have changed settings in my PC in testing client, but Still even after changing to TXT, I get same same PDF in mail. (I have used CL_BCS)
    Try it yourself in testing client.
    Thanks,
    Anil

  • Reg SMARTFORM emailing n fax options?

    hi friends
    i have to run my smartform in background mode and there is a requirement to fax and emailing
    the output. how to make my form run in background , email n fax ?
    thanks & regards
    thirupai
    Edited by: rafi md on Dec 20, 2008 1:32 PM

    HI
    you may use the FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF' to convert the fom
    into PDF.
    But first to get the printed form from the spool, use FUNCTION
    'RSPO_FIND_SPOOL_REQUESTS'.
    Then you may send it to your PC, email, fax, etc by reading the record in
    the lines of table IT_PDF_OUTPUT.
    Note: You may also use program RSTXPDFT4 as a reference to get code
    examples which uses different functions to perform the creation of PDFand
    download the form to the PC,etc.
    An example:
    CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
    EXPORTING
    RQOWNER = SY-UNAME
    TABLES
    SPOOLREQUESTS = SPOOL_REQUESTS.
    READ TABLE SPOOL_REQUESTS INDEX 1.
    GD_SPOOL_NR = SPOOL_REQUESTS-RQIDENT.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    SRC_SPOOLID = GD_SPOOL_NR
    NO_DIALOG = C_NO
    IMPORTING
    PDF_BYTECOUNT = GD_BYTECOUNT
    PDF_SPOOLID = PDFSPOOLID
    BTC_JOBNAME = JOBNAME
    BTC_JOBCOUNT = JOBCOUNT
    TABLES
    PDF = IT_PDF_OUTPUT
    EXCEPTIONS
    ERR_NO_OTF_SPOOLJOB = 1
    ERR_NO_SPOOLJOB = 2
    ERR_NO_PERMISSION = 3
    ERR_CONV_NOT_POSSIBLE = 4
    ERR_BAD_DSTDEVICE = 5
    USER_CANCELLED = 6
    ERR_SPOOLERROR = 7
    ERR_TEMSEERROR = 8
    ERR_BTCJOB_OPEN_FAILED = 9
    ERR_BTCJOB_SUBMIT_FAILED = 10
    ERR_BTCJOB_CLOSE_FAILED = 11.
    CHECK SY-SUBRC = 0.
    Hope this will help send you in the right direction
    Regards
    Alok

  • Modify BPF Smartform Email Template

    Hello
    We are trying to copy/modify an email template used with BPFs via SMARTFORMS.
    The Smartform Body that we are trying to modify is based on UJB_SF_EMAIL_TMPL_11 .  This is the email send to notify Owner "To Perform".
    In this email, the owner is based on the Driver Dimension.  When the Owner receives this email, the only the Context "Description" is used.  We would like for the email to have "ID" and "Description" in the email body.
    The parameter used in the email is Context: I_RGN_CTX_STR
    I_RGN_CTX_STR is capable of reading "ID".  We tested what would happen when we deleted a context description, and the email then uses ID.
    Has anyone had success in modifying the SMARTFORM to "ID" and "Description"?
    We are using BPC NW 10, SP12.
    Thanks!

    Hello
    We are trying to copy/modify an email template used with BPFs via SMARTFORMS.
    The Smartform Body that we are trying to modify is based on UJB_SF_EMAIL_TMPL_11 .  This is the email send to notify Owner "To Perform".
    In this email, the owner is based on the Driver Dimension.  When the Owner receives this email, the only the Context "Description" is used.  We would like for the email to have "ID" and "Description" in the email body.
    The parameter used in the email is Context: I_RGN_CTX_STR
    I_RGN_CTX_STR is capable of reading "ID".  We tested what would happen when we deleted a context description, and the email then uses ID.
    Has anyone had success in modifying the SMARTFORM to "ID" and "Description"?
    We are using BPC NW 10, SP12.
    Thanks!

  • Smartform ---- email/fax

    Hi All,
       We have developed smartform  from scratch in PDF. It will trigger from vt02n,The requirement is this generated PDF file should be send thru via email/fax.I want to know the code for this please send me the code and share some ideas.

    <b>1. PDF & Mail</b>
    You need to get the spool of smartform output and convert it to PDF using an FM & then send it as email.
    Please refer following link for a sample program :
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    <b>2. Fax</b>
    Use FM 'PRINT_TEXT' for FAX.
    Pass parameters as follows :-
    Exporting
    DEVICE = 'TELEFAX'  " For printing call the same FM again & Pass printer name
    DIALOG = 'X'  " To get the option of Print Preview along with the fax number on dialog box
    HEADER = POPT
    Importing
    RESULT = PRES " of type ITCPP
    Tables
    LINE = ITAB_DATA.
    POPT is structure of type ITCPO.
    Populate following values in POPT :
    POPT-TDNEWID = 'X'
    POPT-TDIMMED = 'X'
    POPT-TDLIFETIME = 8 "To keep 8 days in spool
    POPT-TDTELENUM = <Fax Number> " Without country code
    POPT-TELELAND = <Country> " Country code
    Best regards,
    Prashant Patil

  • Debugging Smartform Email

    I am trying to find the FM which sends sales document as email instead of print - and where it derives the email address of the recipient. Any help is appreciated!
    Thanks,
    Mark.

    HI Rakesh,
    I am already using std SAP program and smartform for sales order but someone has questioned if email address to which document is being sent is populating correctly since we see many failures on SOST screen. I still am unable to locate where in the output process does the email address get populated and need to see it happen.
    Thanks!
    Mark.

  • Error opening pdf in email

    I am trying to email a smartform as pdf. But getting the error that File cannot be opened as it is damaged and cannot be repaired.
    I am getting the otf data from Smartform FM. Then convert it to pdf. And then sending it through SO_NEW_DOCUMENT_ATT_SEND_API1. Attached is my code. I don't know what I am doing wrong. I first tried to send it directly through smartform email parameters. It didn't work. I also tried other functions for OTF to PDF conversions. But always getting the same error . I've also checked SCOT for SMTP node setup. The o/p format for smartforms is PDF.
    Has anybody ever succeeded in getting the good pdf from smart form in the email ? Any idea what I am doing wrong ?
    V_FORMNAME = 'ZSD_DAILY_SHEET_DB'.
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = v_formname
    importing
    fm_name = fm_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 fm_name
      EXPORTING
       CONTROL_PARAMETERS         = w_ctrlop
       OUTPUT_OPTIONS             = w_compop
       USER_SETTINGS              = 'X'
       VTITLE                     = SY-TITLE
       VDATE                      = P_DATE
       VDATE2                     = SY-DATUM
    IMPORTING
       JOB_OUTPUT_INFO            = w_return
      TABLES
        I_DAILY                    = it_daily
        I_MONTHLY                  = it_monthly
        I_YEARLY                   = it_yearly
    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.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    * Convert PDF from 132 to 255.
    LOOP AT i_tline.
    * Replacing space by ~
    TRANSLATE i_tline USING ' ~'.
    CONCATENATE w_buffer i_tline INTO w_buffer.
    ENDLOOP.
    * Replacing ~ by space
    TRANSLATE w_buffer USING '~ '.
    DO.
    i_record = w_buffer.
    * Appending 255 characters as a record
    APPEND i_record.
    SHIFT w_buffer LEFT BY 255 PLACES.
    IF w_buffer IS INITIAL.
    EXIT.
    ENDIF.
    ENDDO.
    Refresh: i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    clear w_objhead.
    * Object with PDF.
    i_objbin[] = i_record[].
    DESCRIBE TABLE i_objbin LINES v_lines_bin.
    * Object with main text of the mail.
    i_objtxt = 'Find attached the Daily Dashboard Sheet.'.
    APPEND i_objtxt.
    i_objtxt = 'Regards,'.
    APPEND i_objtxt.
    i_objtxt = 'Dummy.
    APPEND i_objtxt.
    DESCRIBE TABLE i_objtxt LINES v_lines_txt.
    * Document information.
    w_doc_chng-obj_name = 'Smartform'.
    w_doc_chng-expiry_dat = sy-datum + 10.
    w_doc_chng-obj_descr = 'Smart form output'.
    w_doc_chng-sensitivty = 'F'. "Functional object
    w_doc_chng-doc_size = v_lines_txt * 255.
    * Pack to main body as RAW.
    * Obj. to be transported not in binary form
    CLEAR i_objpack-transf_bin.
    * Start line of object header in transport packet
    i_objpack-head_start = 1.
    * Number of lines of an object header in object packet
    i_objpack-head_num = 0.
    * Start line of object contents in an object packet
    i_objpack-body_start = 1.
    * Number of lines of the object contents in an object packet
    i_objpack-body_num = v_lines_txt.
    * Code for document class
    i_objpack-doc_type = 'RAW'.
    APPEND i_objpack.
    * Packing as PDF.
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'Smartform'.
    i_objpack-obj_descr = 'Dashboard Sheet'.
    i_objpack-doc_size = v_lines_bin * 255.
    APPEND i_objpack.
    * Document information.
    CLEAR i_reclist.
    * e-mail receivers.
    i_reclist-receiver = p_mail.
    i_reclist-express = 'X'.
    i_reclist-rec_type = 'U'. "Internet address
    APPEND i_reclist.
    * Sending mail.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = w_doc_chng
    put_in_outbox = 'X'
    TABLES
    packing_list = i_objpack
    object_header = w_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.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Edited by: Arbaab Rahim on Sep 15, 2008 2:41 PM

    Rahim,
    in the FM, SO_NEW_DOCUMENT_ATT_SEND_API1 give COMMIT_WORK = 'X'.
    The following code works for me. Try this.
    *                      START-OF-SELECTION EVENT                       *
    START-OF-SELECTION.
    *" Read the HFA records into internal table............................
      SELECT *
        FROM zhfa
        INTO TABLE t_zhfa
       WHERE zz_vin6 IN s_vin6.
      IF sy-subrc NE 0.
        MESSAGE text-002 TYPE 'W'.
      ENDIF.                               " IF SY-SUBRC NE 0
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname                 = 'YH1145_HFA1'
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
       IMPORTING
         fm_name                  = w_name
       EXCEPTIONS
         no_form                  = 1
         no_function_module       = 2.
        w_control-getotf = 'X'.
        w_control-no_dialog = 'X'.
        w_output-tdnoprev = 'X'.
        LOOP AT t_zhfa INTO fs_zhfa.
          CALL FUNCTION '/1BCDWB/SF00000457'
            EXPORTING
    *   ARCHIVE_INDEX              = ARCHIVE_INDEX
    *   ARCHIVE_INDEX_TAB          = ARCHIVE_INDEX_TAB
    *   ARCHIVE_PARAMETERS         = ARCHIVE_PARAMETERS
             control_parameters         = w_control
    *   MAIL_APPL_OBJ              = MAIL_APPL_OBJ
    *   MAIL_RECIPIENT             = MAIL_RECIPIENT
    *   MAIL_SENDER                = MAIL_SENDER
             output_options             = w_output
             user_settings              = 'X'
              fs_zhfa                    = fs_zhfa
           IMPORTING
    *   DOCUMENT_OUTPUT_INFO       = DOCUMENT_OUTPUT_INFO
             job_output_info            = w_return
    *   JOB_OUTPUT_OPTIONS         = JOB_OUTPUT_OPTIONS
           EXCEPTIONS
             formatting_error           = 1
             internal_error             = 2
             send_error                 = 3
             user_canceled              = 4.
    *" w_return-otfdata holds the smartform OTF data.................
        append lines of w_return-otfdata to t_otf.
        ENDLOOP.
    *" t_otf is the OTF data.........................................
    *" t_line is the PDF data.......................................
        CALL FUNCTION 'CONVERT_OTF'
         EXPORTING
           format                      = 'PDF'
           max_linewidth               = 132
    *   ARCHIVE_INDEX               = ' '
    *   COPYNUMBER                  = 0
    *   ASCII_BIDI_VIS2LOG          = ' '
    *   PDF_DELETE_OTFTAB           = ' '
         IMPORTING
           bin_filesize                = w_filesize
    *   BIN_FILE                    = BIN_FILE
          TABLES
            otf                         = t_otf
            lines                       = t_line
         EXCEPTIONS
           err_max_linewidth           = 1
           err_format                  = 2
           err_conv_not_possible       = 3
           err_bad_otf                 = 4.
        LOOP AT t_line.
          CONCATENATE w_string t_line INTO w_string.
        ENDLOOP.
    *" convert the 132 line character to 255 character ..................
        DO.
          t_attach = w_string.
          APPEND t_attach.
          SHIFT w_string LEFT BY 255 PLACES.
          IF w_string IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
        t_objbin[] = t_attach[].
    *" body of the mail..................................................
        CLEAR t_message. REFRESH t_message.
        t_message = 'This is a mail from SAP ECC6'.
        APPEND t_message.
        t_message = 'Thanks and Regards'.
        APPEND t_message.
        t_message = 'Indu'.
        APPEND t_message.
        DESCRIBE TABLE t_message LINES w_msg.
        w_docdata-obj_name = 'SAPRPT'.
        w_docdata-expiry_dat = sy-datum + 10.
        w_docdata-obj_descr = 'Smartform mail from Indu'.
        w_docdata-sensitivty = 'F'.
        w_docdata-doc_size = w_msg * 255.
        w_docdata-obj_langu = sy-langu .
    *" type of the mail send: packing_list.........................
        CLEAR t_packing_list. REFRESH t_packing_list.
        t_packing_list-transf_bin = space.
        t_packing_list-head_start = 1.
        t_packing_list-head_num = 0.
        t_packing_list-body_start = 1.
        t_packing_list-body_num = w_msg.
        t_packing_list-doc_type = 'RAW'.
        APPEND t_packing_list.
        t_packing_list-transf_bin = 'X'.
        DESCRIBE TABLE t_objbin LINES w_objbin.
    *" doc_size = (lines in pdf table) * 255......................
        t_packing_list-doc_size = w_objbin * 255.
        t_packing_list-body_num = w_objbin.
        t_packing_list-doc_type = 'PDF'.
        t_packing_list-obj_name = 'smart'.
        t_packing_list-obj_descr = 'test'.
        APPEND t_packing_list.
        CLEAR t_receivers.
        t_receivers-receiver = '<email id>'.
        t_receivers-rec_type = 'U'.
        APPEND t_receivers.
        CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
          EXPORTING
            document_data                    = w_docdata
           put_in_outbox                    = 'X'
           sender_address                   = sender
    *   SENDER_ADDRESS_TYPE              = 'B'
           commit_work                      = 'X'
    * IMPORTING
    *   SENT_TO_ALL                      = SENT_TO_ALL
    *   NEW_OBJECT_ID                    = NEW_OBJECT_ID
    *   SENDER_ID                        = SENDER_ID
          TABLES
            packing_list                     = t_packing_list
    *   OBJECT_HEADER                    = OBJECT_HEADER
           contents_bin                     = t_objbin
           contents_txt                     = t_message
    *   CONTENTS_HEX                     = CONTENTS_HEX
    *   OBJECT_PARA                      = OBJECT_PARA
    *   OBJECT_PARB                      = OBJECT_PARB
            receivers                        = t_receivers
         EXCEPTIONS
           too_many_receivers               = 1
           document_not_sent                = 2
           document_type_not_exist          = 3
           operation_no_authorization       = 4
           parameter_error                  = 5
           x_error                          = 6
           enqueue_error                    = 7.
        IF sy-subrc NE 0.
          WRITE:/ 'Error When Sending the File', sy-subrc.
        ELSE.
          WRITE:/ 'Mail sent'.
        ENDIF.
        SUBMIT rsconn01 USING SELECTION-SET 'INT' AND RETURN.
        CALL FUNCTION 'SO_DEQUEUE_UPDATE_LOCKS'.
      ELSEIF p_fax EQ 'X'.

  • SMARTFORMS documents

    Appreciate if someone can email me Config or 'How to' doc for SmartForms
    [email protected]

    Hai
    http://sap-img.com/smartforms/sap-smart-forms.htm.
    try this link..
    manu

  • How to determine output based on the content of purchase order

    Hi Gurus,
    I've a typical requirement at my present project. With vendor X we have punchout catalogs. while creation of shopping cart, we are not allowing the user to mix catalog items and non catalog items into the same shopping cart. Once the shopping cart all shopping carts are automatically coverted into PO.
    Now the challenge we are facing is, if the PO is created based on items from catalog, we want to send such PO via XML interface to the vendor. If the PO is created based of items which are free-form, we want to send such PO via Smartform email attachment.
    As this condition can only be determined at runtime, I'm finding a challenge to configure this. In both PO cases, vendor is same but the content of the PO is different. One contains all items that are catalog based and other contains items which are non catalog.
    Can someone help me find solution for this issue.
    Regards,
    Sam K

    Change Forms for Document Output
    You can use the Business Add-In BBP_OUTPUT_CHANGE_SF to override the Smart Forms that are defined in the activity Define Actions for Document Output.
    This BAdI serves as an alternative to the IMG activity Condition-Dependent Document Output.
    Note that no Smart Forms are used for output via XML.
    Standard settings
    The following parameters are available in the method CHANGE_FORMS. Depending on the input parameters, you can define other Smart Forms to output the document type.
    Importing
    IV_GUID
    Globally Unique Identifier of the document.
    IV_MEDIUM
    Output medium found for this document according to Define Actions for Document Output (print: PRN, fax: FAX, e-mail: MAI, XML: MET).
    IS_PARTNER
    Business partner to whom the document is sent.
    IV_OBJECT_TYPE
    Business transaction type.
    Changing
    CV_SMARTFORM
    Smart Form used to output the document.
    E-mail output
    Smart Form with which the document is added to the e-mail in the form of a PDF attachment.
    Note:
    Note that the BAdI with this parameter overrides the parameter form name (technical name of the Smart Form BBP_PO for example) irrespective of the defined determination technology (SRM: Purchase Order Output Determination, for example).
    CV_SMARTFORM_MAIL
    Smart Form used to define content and layout of the e-mail text in the case of e-mail output.
    CV_SUBJECT_MAIL
    Smart Form that determines the text in the (short description of the e-mail content).
    As an alternative to this BAdI, you can control document output via determination technology.
    For more information, see Condition-Dependent Document Output.
    EXPLORE THIS badi

  • SO_OBJECT_MIME_GET

    Hi,
    When i try to send a smartform email from SOST i recieve the following error
    SO_OBJECT_MIME_GET Exception 2 and the mail is not sent.
    What the error means?
    Does anyone have any solution to this problem?
    Thanks

    Hi,
    Check whether SAPconnect service is active in transaction SICF.
    and also OSS Note 439948, The solution is to modify the SXNODES table
    Regards
    Sudheer

Maybe you are looking for

  • Any one help me with dual screen?

    I am trying to get my LCD monitor work, which is plugged in VGA. However, when i using "xrandr --output VGA --auto" to set it up, i get this failure "xrandr: cannot find crtc for output VGA" i am using intel graphic card, and the result of "xrandr -q

  • V Cast Media Manager is buggy

    I don't know if it's the software or my Droid X, but I struggled forever to just get the pics/songs/docs ON the Droid (kept unmounting the sdcard, evidently). I reformatted it and got all the stuff back on it. Now I'm trying to upload to V Cast and m

  • Mysterious skn name in project setup - what file is being referenced?

    I have a strange situation where the Project Set-up pod shows that I am using a skin with Name A, yet when I use Windows Explorer to browse the project files, there is no skin with Name A anywhere in the vicinity. Another oddity is that the Project S

  • Import RFC/IDOC error

    Hi all, I am following "How to...push data in to BW from XI." In the 5th step in the document it is given Choose "Import RFC/IDOC" in the context menu of "Imported Objects" and enter your user data to logon to the BW system. Select the function modul

  • The Add Column option isnt working.

    The Add Column option isnt working - It just does nothing when I click it. I can go into the code and forcably place a column, but I'd sure like that button to work. Anyone know what's up?