Smart forms PDF

Hi experts,
Iam trying to get the smartform into PDF.Iam working on VF02>billing doc>Issue output to...
Instead of going to spool request & RSTXPDFT4 program, i want to generate PDF in the output Message type itself.
So iam trying to modify SAP standard program RLB_INVOICE. Here iam confused that where to insert PDF function module and where have to make changes....to get report into PDF form??
Any suggestions pls...
thanks
kaki

Hi
Insert a code like this after calling the smartforms:
CALL FUNCTION <SMARTFORM>
EXPORTING
IMPORTING
job_output_info = job_output_info
TABLES
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc = 0.
Convert to pdf forms
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = filesize
TABLES
otf = job_output_info-otfdata
doctab_archive = doctab_archive
lines = t_pdf
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 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.
download file
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = filesize
filename = filename
filetype = 'BIN'
CHANGING
data_tab = t_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
Open file
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
commandline = filename
program = 'AcroRd32.exe'
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
gui_refuse_execute = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endif.
You can also insert a module to opena dialog to choose the filename.
Max

Similar Messages

  • Smart form -- PDF -- Application layer(AL11)

    Hi All,
    I have a question . I have developed a smart form. As per the requirement I have converted the Smart form to PDF.
    Now my next job is to upload this to AL11.
    Can  any one help me in doing so ?
    Thanks In Advance,,
    James.

    Hi
    When the smartform output is available as PDF file on presentation server move it to Application Server (AL11) using the Transactions <b>CG3Y or CG3Z</b>
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Smart Form PDF layout issue

    I developed a from in smart form to send it as PDF attachment in email. It worked fine but I have a issue.
    When I send PDF it send in the way the the layout was designed but if some user sends it the fields are printed zigzag. Alignment is getting messed up. I have page layout defined in the smartfom. I am not printing the form so no printer is involved in development.
    How to handle the issue?
    Thanks,
    AP

    hello mate,
    i suggest to  2  things
    1.  the layout you see even though u r not printing it is dependent on the device type like ....LOCL ..etc
    2. the user settings have an effect
    Edited by: Tcode on Apr 9, 2008 11:44 PM

  • Display Smart form (PDF) in SAP UI5 Error

    Hello everyone,
    I was following the blog Display Smartform (PDF) in SAPUI5 by @Chandarshekhar .
    I am getting nothing displayed in the pdf. Just the logo is displayed. I really don't know what the problem is . Any help would be appreciated.

    Hi..
    Try this PDF URL.... u might get useful things...
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    Web Dynpro Java
    yours GS

  • Smart forms convert to pdf binary data

    Dear All,
    I'm working on smart forms integrations with .net and  I need to send the smart forms PDF binary data though custom rfc .
    For that i'm  converting smart forms otf  data  to pdf in and pass this data  through rfc but this idata is is not wokring on .net guys when they are converting this on pdf..
    so is there any need of decoded smart forms otf data before passing through or i'm missing some basic step?
    Please guide me?
    Rg
    Anuj

    hi,
    Have a look on this wiki:
    [http://wiki.sdn.sap.com/wiki/display/Snippets/SmartformoutputtoPDFformat]
    And maybe this one could also interest you:
    [|http://wiki.sdn.sap.com/wiki/display/Snippets/SmartformtoMailasPDF+attachment]
    regards
    mickael

  • Smart forms tutorials

    hi all
    can any one give me some tutorials for the smartform
    i want only examples not the theoratical concepts
    plz give some complex smartform examples
    thanx

    hi,
    Smartforms
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    Smart Form PDF Link
    http://help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
    http://sap.ionelburlacu.ro/sap0/sapsf001.htm
    http://help.sap.com/saphelp_erp2004/helpdata/en/a9/de6838abce021ae10000009b38f842/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/a5/de6838abce021ae10000009b38f842/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/16/a369b1800e4bdda978ee0fe3b7bd2c/content.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/a5/de6838abce021ae10000009b38f842/content.htm
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-img.com/smartforms/smart-001.htm
    regards,

  • Email PDF smart form Support Desk

    Hi SDN,
    I'm working on support desk - solution manager, and i need to send the solution of the support message by email to the final user.
    There is an standard action (SLF1 -SMSD_SERVICE_ORDER_DNO_OUTPUT)  that sends the solution in pdf format by email, but we couldn't set the receivers online.
    So, I'm using an "z" action that executes an smart form, and i would like to send the smart form in pdf format by the internet.
    I'd like to use fm SO_DYNP_OBJECT_SEND, because the user must fill the receivers on-line
    So far i have de OTF, and i know that i can make a conversion to pdf format, but i've the following problem
    - the pdf in attach is empty, it may be because of the format, or may be i'm not using correctly this function.
    Thanks in advance,
    Maria João Rocha
          call function 'CONVERT_OTF'
            exporting
               format                = 'PDF'
            importing
              bin_filesize          = w_pdf_size
            tables
              otf                   = es_job_output_info-otfdata[]
              lines                 = t_pdf[]
            exceptions
              err_max_linewidth     = 1
              err_format            = 2
              err_conv_not_possible = 3
              err_bad_otf           = 4
              others                = 5.
    * header
          wa_head-objnam = 'EMAIL'.
          wa_head-objdes = ls_output_options-tdtitle.
          wa_head-objnam = ls_output_options-tdtitle.
          wa_head-objla = sy-langu.
          wa_head-objsns = 'O'.
          wa_head-file_ext = 'TXT'.
          append wa_head to t_head.
          wa_packing_list-transf_bin = 'X'.
          wa_packing_list-head_start = 1.
          wa_packing_list-head_num = 0.
          wa_packing_list-body_start = 1.
          wa_packing_list-objtp = 'RAW'.
    *      wa_packing_list-objtp = 'EXT'.
          wa_packing_list-objdes = ls_output_options-tdtitle.
          wa_packing_list-objla = sy-langu.
          wa_packing_list-objlen = w_pdf_size.
          wa_packing_list-file_ext = 'PDF'.
          append wa_packing_list to t_packing_list.
    *---------- enviar o mail
          call function 'SO_DYNP_OBJECT_SEND'
            exporting
    *            object_hd_change           = ls_output_options-tdtitle
              object_type                = 'RAW'
    *            originator_type            = 'B'
    *            originator                 = sy-uname
    outbox_flag      = 'S'
            tables
    *            objcont                    = t_text
    *            receivers                  = t_receivers
              packing_list               = t_packing_list
              att_cont                   = t_cont
              att_head                   = t_head
            exceptions
              active_user_not_exist      = 1
              communication_failure      = 2
              component_not_available    = 3
              folder_not_exist           = 4
              folder_no_authorization    = 5
              forwarder_not_exist        = 6
              note_not_exist             = 7
              object_not_exist           = 8
              object_not_sent            = 9
              object_no_authorization    = 10
              object_type_not_exist      = 11
              operation_no_authorization = 12
              owner_not_exist            = 13
              parameter_error            = 14
              substitute_not_active      = 15
              substitute_not_defined     = 16
              system_failure             = 17
              too_much_receivers         = 18
              user_not_exist             = 19
              x_error                    = 20
              others                     = 21.
        endif.

    Thanks for your reply.
    I'm working on it, and I’ve seen the SCOT documentation, so I've change my strategy.
    Right now I'm using some of the methods of the BOR.
    I think I've to code because I want a popup to introduce the list of the receivers and the mail body, and of course I want to attach a smart form on pdf format.
    But I can’t send the mail because of the error: Erro interno: SO_OBJECT_MIME_GET Exceção: 2
    Can you help me on this? What I’m doing wrong? What document class I need to use on the “AttachmentType”?
    Thanks in advance.
    Best regards,
    Maria João Rocha
    FUNCTION Z_MAIL_DIALOGO.
    *"*"Interface local:
    *"  IMPORTING
    *"     REFERENCE(TITULO) TYPE  SOOD1-OBJDES OPTIONAL
    *"     REFERENCE(FILE_SIZE) TYPE  SOOD1-OBJLEN OPTIONAL
    *"  TABLES
    *"      OTF TYPE  TSFOTF OPTIONAL
    *"      PDF STRUCTURE  TLINE OPTIONAL
    *"      CONTEXT TYPE  SOLI_TAB OPTIONAL
    * Makros für Zugriff aufs BOR
    include <cntn01>.
    *parameters: dialog like sonv-flag.
    data: dialog like sonv-flag.
    * Datendeklaration
    data: message type swc_object.
    data: recipient type swc_object.
    data: recip_tab type swc_object occurs 1 with header line.
    data: objkey like swotobjid-objkey.
    data: content like soli-line occurs 0 with header line.
    data: title(80).
    data: persnumber like adcp-persnumber.
    data: sent_to_all like sonv-flag,
          object_list like sosndinf occurs 1 with header line.
    data: t_otf type standard table of ITCOO.
    data: itab like soli occurs 0.
    * Deklaration eines Containers
    swc_container container.
    * Message-Objekt anlegen
    * * Neues Message-Objekt generieren
    swc_create_object message 'Message' space.
    swc_clear_container container.
    if dialog = space.
    * * Create w/o dialog
      concatenate 'Mensagem Support Desk' sy-datum sy-uzeit into title
               separated by '/'.
      swc_set_element container 'DOCUMENTTITLE' title.
      swc_set_element container 'DOCUMENTNAME' 'Support Desk'.
    *  swc_set_element container 'DOCUMENTTYPE' 'INT'.
    *  swc_set_element container 'DOCUMENTTYPE' 'SCR'.
      swc_set_element container 'DOCUMENTTYPE' 'OTF'.
      swc_set_element container 'NO_DIALOG' 'X'.
    else.
    * * Create with dialog
      swc_set_element container 'NO_DIALOG' ' '.
    endif.
    swc_call_method message 'Create' container.
    perform error_handling(rssobcitest11).
    * Create attachment (RAW document from internal table)
    SWC_CLEAR_CONTAINER CONTAINER.
    *att_bor_obj-objtype = 'MESSAGE'.
    *swc_set_element container 'ATTACHMENT' pdf.
    *swc_set_element container 'ATTACHMENT' otf.
    swc_set_element container 'ATTACHMENT' context.
    swc_set_element container 'ATTACHMENTTITLE' 'Anexo'.
    swc_set_element container 'AttachmentType' 'OTF'.
    *swc_set_element container 'DocumentSize' 0.
    swc_set_element container 'DocumentSize' file_size.
    *swc_set_table container 'DocumentContent' itab.
    SWC_CALL_METHOD MESSAGE 'Attach' CONTAINER.
    PERFORM ERROR_HANDLING(RSSOBCITEST11).
    *SWC_CLEAR_CONTAINER CONTAINER.
    *SWC_SET_ELEMENT CONTAINER 'EditorSettings' 'D'.
    *SWC_SET_ELEMENT CONTAINER 'STARTING_AT_X' '5'.
    *SWC_SET_ELEMENT CONTAINER 'STARTING_AT_Y' '5'.
    *SWC_SET_ELEMENT CONTAINER 'EnableApplObjAttachments' 'X'.
    *SWC_CALL_METHOD MESSAGE 'EditRecipientList' CONTAINER.
    *PERFORM ERROR_HANDLING(RSSOBCITEST11).
    * Einen Empfänger (interner Benutzer) automatisch hinzufügen
    * Recipient-Objekt anlegen
    swc_clear_container container.
    swc_create_object recipient 'Recipient' space.
    swc_set_element container 'AddressString' sy-uname.
    swc_set_element container 'TypeId' 'B'.
    swc_call_method recipient 'CreateAddress' container.
    perform error_handling(rssobcitest11).
    * Kopie des Recipient-Objekts anfügen
    swc_clear_container container.
    swc_set_element container 'NewRecipient' recipient.
    swc_call_method message 'AddCopyOfRecipient' container.
    perform error_handling(rssobcitest11).
    * Outbox-Flag setzen
    swc_clear_container container.
    swc_set_element container 'OutboxFlag' 'X'.
    swc_call_method message 'SetOutboxFlag' container.
    perform error_handling(rssobcitest11).
    * Empfängerliste editieren
    swc_clear_container container.
    swc_call_method message 'EditRecipientList' container.
    perform error_handling(rssobcitest11).
    swc_get_table container 'RecipientsInfo' object_list.
    if sy-subrc = 8.
    * Kopiertes Message-Objekt versenden
      swc_clear_container container.
      swc_call_method message 'Submit' container.
      perform error_handling(rssobcitest11).
      swc_get_table container 'RecipientsInfo' object_list.
    endif.
    swc_get_element container 'SentToAll' sent_to_all.
    * Kopiertes Message-Objekt sichern
    swc_clear_container container.
    swc_call_method message 'Save' container.
    perform error_handling(rssobcitest11).
    * Protokollausgabe:
    * Key des Message-Objekts ermitteln
    *SWC_GET_OBJECT_KEY MESSAGE OBJKEY.
    *WRITE: / 'Key des Messageobjekts', OBJKEY.
    * Protokollausgabe:
    perform write_recipient_info(rssobcitest11) tables object_list
                                                using  sent_to_all.
    * Freigeben der Referenzen
    * MESSAGE-Objekt
    swc_free_object message.
    * RECIPIENT-Objekt
    swc_free_object recipient.
    commit work.
    ENDFUNCTION.

  • To convert Smart Form output to PDF format and send it via email.

    Hi Friends,
    Could any one please tell me, how to convert the Smart Forms output to PDF format and send it via email to customer. If any one have the code, kindly mail me to [email protected]
    Thanks & Regards,
    John

    Refer the links -
    how to convert smartform into pdf and send through mail
    Smartform as PDF attachment to a mail.
    smartform pdf and mail
    smartform to pdf to mail
    Regrads,
    Amit
    Reward all helpful replies.

  • Error in opening the PDF file created from the smart form output.

    Hi All,
    i have a simple smart form which takes 3 values like customer no, name and no of times customer called and gives an out like
    Customer 0001000000 with name Ravi called 5 times today.
    I have to send this output to mail as an attachment.
    for this i am coding as below.
    ******Call the SSF Function module
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = Form name
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = lv_fmname
    EXCEPTIONS
    no_form = 1
    no_function_module = 2
    OTHERS = 3
    lv_partner_number = '0001000000'.
    lv_name_org1 = 'Ravi'.
    lv_z_no_calls_day = '5'.
    lw_ctrlop-getotf = 'X'.
    lw_ctrlop-no_dialog = 'X'.
    lw_compop-tdnoprev = 'X'.
    lw_compop-tddest = 'LP01'.
    *******Call the Form Function module and get the OTF of form output
    CALL FUNCTION lv_fmname
    EXPORTING
    name_org1 = lv_name_org1
    partner_number = lv_partner_number
    z_no_calls_day = lv_z_no_calls_day
    control_parameters = lw_ctrlop
    output_options = lw_compop
    user_settings = ' '
    IMPORTING
    job_output_info = w_return
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5.
    i_otf] = w_return-otfdata[.
    *********Now here if i look in to the OTF data i got in debug it has the data i aniticipated along with some other data.
    the output is in the format
    TDPRINTCOM(2) TDPRINTPAR(70)
    ST XXXX.. customer 0001000000 with
    name.....
    i have my data in the above format spread in three lines of the output otf table where XXXX... is some number.
    ***********To convert to PDF Format
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    max_linewidth = 132
    IMPORTING
    bin_filesize = lv_len_in
    BIN_FILE =
    TABLES
    otf = i_otf
    lines = i_tline
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    err_bad_otf = 4
    OTHERS = 5
    *********For testing purpose i created a file on the desktop with the the data in i_tline. it created PDF file but when i tried to open it it's giving an error.
    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 = 'Smart Form'.
    wa_doc_chng-obj_descr = 'Frequent Caller Alert_Day'.
    wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
    *********Creating the Entry for the document
    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.
    i_objbin] = i_tline[.
    DESCRIBE TABLE i_objbin LINES v_lines_bin.
    READ TABLE i_objbin INDEX v_lines_bin.
    i_objhead = 'Frequentcaller list_Day.pdf'.
    APPEND i_objhead.
    ************Creating the entry for the attachment.
    CLEAR : i_objpack.
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 1.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'ATTACHMENT'.
    i_objpack-obj_descr = 'FCA'.
    i_objpack-doc_size = v_lines_bin * 255 .
    APPEND i_objpack.
    CLEAR i_reclist.
    i_reclist-receiver = 'mail id'.
    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 = i_objhead
    contents_bin = i_objbin
    contents_txt = i_objtxt
    receivers = i_reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    operation_no_authorization = 4
    OTHERS = 99.
    This is all i am doing.
    It is sending a mail with the attachment but we are not able to open the attachment. it's giving an error like file is damaged and couldn't be repaired.
    I serched in the forum but i couldn't get the answer.
    I suspect there is a problem in getting the OTF data..
    Please help me in resolving this issue....
    Thanks in advance.
    RK

    Check the sample , and see where you made the mistake.
    REPORT ZPDF_MAIl.
    DATA:
      w_fm_name      TYPE rs38l_fnam,
      w_bin_filesize TYPE i,
      w_filesize     TYPE i,
      w_lines_txt    TYPE i,
      w_lines_bin    TYPE i.
    DATA:
      wa_ctrlop   TYPE ssfctrlop,
      wa_outopt   TYPE ssfcompop,
      wa_objhead  TYPE soli_tab,
      wa_buffer   TYPE string,
      wa_doc_chng TYPE sodocchgi1.
    DATA:
      BEGIN OF t_mail_ids OCCURS 0,
        mailid TYPE ad_smtpadr,
      END OF t_mail_ids,
      t_otfdata TYPE ssfcrescl,
      t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
      t_pdf_tab TYPE tline OCCURS 0 WITH HEADER LINE,
      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_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      t_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = 'Z195_TEST'
      IMPORTING
        fm_name            = w_fm_name
      EXCEPTIONS
        no_form            = 1
        no_function_module = 2
        OTHERS             = 3.
    IF sy-subrc EQ 0.
    ENDIF.                               " IF sy-subrc EQ 0.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION w_fm_name
      EXPORTING
        control_parameters = wa_ctrlop
        output_options     = wa_outopt
        user_settings      = 'X'
      IMPORTING
        job_output_info    = t_otfdata
      EXCEPTIONS
        formatting_error   = 1
        internal_error     = 2
        send_error         = 3
        user_canceled      = 4
        OTHERS             = 5.
    IF sy-subrc EQ 0.
    ENDIF.                               " IF sy-subrc EQ 0.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = w_bin_filesize
      TABLES
        otf                   = t_otf
        lines                 = t_pdf_tab
      EXCEPTIONS
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        err_bad_otf           = 4
        OTHERS                = 5.
    IF sy-subrc EQ 0.
    ENDIF.                               " IF sy-subrc EQ 0.
    LOOP AT t_pdf_tab.
      TRANSLATE t_pdf_tab USING '~'.
      CONCATENATE wa_buffer t_pdf_tab 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.
    t_objtxt = ' To Change the COR, Use the Transaction ZCOR_CHANGE'.
    APPEND t_objtxt.
    t_objtxt = ' Check the Attached PDF file for COR'.
    APPEND t_objtxt.
    DESCRIBE TABLE t_objtxt LINES w_lines_txt.
    READ TABLE t_objtxt INDEX w_lines_txt.
    READ TABLE t_objtxt INDEX w_lines_txt.
    wa_doc_chng-obj_name = 'COR Display'.
    wa_doc_chng-expiry_dat = sy-datum + 10.
    CONCATENATE 'COR' "w_cornr
                '-' "w_stat_descr w_action_desc
           INTO wa_doc_chng-obj_descr SEPARATED BY space.
    wa_doc_chng-sensitivty = 'F'.
    wa_doc_chng-doc_size =  w_lines_txt  * 255.
    CLEAR t_objpack-transf_bin.
    t_objpack-head_start = 1.
    t_objpack-head_num = 0.
    t_objpack-body_start = 1.
    t_objpack-body_num = w_lines_txt.
    t_objpack-doc_type = 'RAW'.
    APPEND t_objpack.
    t_objpack-transf_bin = 'X'.
    t_objpack-head_start = 1.
    t_objpack-head_start = 1.
    t_objpack-head_num = 0.
    t_objpack-body_start = 1.
    DESCRIBE TABLE t_objbin LINES w_lines_bin.
    READ TABLE t_objbin INDEX w_lines_bin.
    t_objpack-doc_size = w_lines_bin * 255 .
    t_objpack-body_num = w_lines_bin.
    t_objpack-doc_type = 'PDF'.
    t_objpack-obj_name = 'COR'.
    t_objpack-obj_descr = 'COR Test'.
    * concatenate 'COR' w_cornr into t_objpack-obj_descr
    *                           separated by space.
    APPEND t_objpack.
    *LOOP AT t_mail_ids.
      CLEAR t_reclist.
      t_reclist-receiver = 'INTENATEMAIL'.
      t_reclist-rec_type = 'U'.
      APPEND t_reclist.
    *ENDLOOP.
    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 EQ 0.
    ENDIF.

  • Smart Form Download in PDF

    Hello All ,
                   I have created one smart form and provided option to download the same in PDF. My Problem is that is  downloaded in PDF but at the same time my end user want to see the print preview and take the print from there itself also.
    I am using the following code can some one suggest me the what need to do the change after both option will work at  the same time.
    Please Note I have also made the use of property
    SSFCOMPOP-TDNOPREV
    But after this also issue not resolve. Some one Please suggest me the how to resolve the issue.
    DATA :
          WA_FMNM        TYPE  TDSFNAME,      " Smart Forms: Form Name
          WA_CNTL        TYPE  SSFCTRLOP,     " FOR PDF PRINT
          WA_POP         TYPE  SSFCOMPOP,     " printer name
          T_OTF_FROM_FM  TYPE  SSFCRESCL,
          T_PDF_TAB      LIKE  TLINE OCCURS 0 WITH HEADER LINE,
          T_OTF          TYPE  SSFCRESCL-OTFDATA,
          W_BIN_FILESIZE TYPE  I, " BINARY FILE SIZE
          W_FILE_NAME    TYPE  STRING,
          WA_FNMD        TYPE  RS38L_FNAM.    " Name of Function Module
    DATA:
          W_FORM_NAME    TYPE TDSFNAME,
          W_FMODULE      TYPE RS38L_FNAM,
          W_CPARAM       TYPE SSFCTRLOP,
          W_OUTOPTIONS   TYPE SSFCOMPOP,
          W_FILE_PATH    TYPE STRING,
          W_FULL_PATH    TYPE STRING.
    SMART FORM FUNCTION MODULE
    WA_FMNM  =  TEXT-113.
    W_FORM_NAME  =  TEXT-113.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = WA_FMNM
       IMPORTING
          FM_NAME                  = WA_FNMD
       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.
    END FORM
    WA_CNTL-GETOTF     =  'X'.
    WA_CNTL-NO_DIALOG  =  'X'.
    WA_CNTL-PREVIEW    =  SPACE .
    WA_POP-TDDEST      = 'LP01'.
    CALL FUNCTION WA_FNMD
    EXPORTING
        CONTROL_PARAMETERS         =  WA_CNTL
       OUTPUT_OPTIONS             = WA_POP
        V_APPLN_OB                 = V_APPLN_OB
        V_KUNNR_OB                 = V_KUNNR_OB
        V_EBELN                    = V_EBELN
        V_CAT_NAME                 = V_CAT_NAME
        V_VAR_NAME                 = V_VAR_NAME
    IMPORTING
      JOB_OUTPUT_INFO              = T_OTF_FROM_FM
      TABLES
        T_ZCNC18                   =  T_ZCNC18
    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_OTF_FROM_FM-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
    IMPORTING
       BIN_FILESIZE                 = W_BIN_FILESIZE
      TABLES
        OTF                         = T_OTF
        LINES                       = T_PDF_TAB
    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.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
    EXPORTING
        PROMPT_ON_OVERWRITE = 'X'
    CHANGING
        FILENAME    = W_FILE_NAME
        PATH        = W_FILE_PATH
        FULLPATH    = W_FULL_PATH
    EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        NOT_SUPPORTED_BY_GUI = 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.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE  = W_BIN_FILESIZE
      FILENAME      = W_FULL_PATH
      FILETYPE      = 'BIN'
      APPEND        = ' '
      WRITE_FIELD_SEPARATOR = ''
      HEADER                = '00'
      TRUNC_TRAILING_BLANKS = ''
      WRITE_LF              = 'X'
      COL_SELECT            = ''
      COL_SELECT_MASK       = ''
      DAT_MODE              = ''
      CONFIRM_OVERWRITE     = ''
      NO_AUTH_CHECK         = ''
      CODEPAGE              = ''
      IGNORE_CERR           = ABAP_TRUE
      REPLACEMENT           = '#'
      WRITE_BOM             = ''
      TRUNC_TRAILING_BLANKS_EOL = 'X'
    TABLES
      DATA_TAB              = T_PDF_TAB
    EXCEPTIONS
      FILE_WRITE_ERROR        = 1
      NO_BATCH                = 2
      GUI_REFUSE_FILETRANSFER = 3
      INVALID_TYPE            = 4
      NO_AUTHORITY            = 5
      UNKNOWN_ERROR           = 6
      HEADER_NOT_ALLOWED      = 7
      SEPARATOR_NOT_ALLOWED   = 8
      FILESIZE_NOT_ALLOWED    = 9
      HEADER_TOO_LONG         = 10
      DP_ERROR_CREATE         = 11
      DP_ERROR_SEND           = 12
      DP_ERROR_WRITE          = 13
      UNKNOWN_DP_ERROR        = 14
      ACCESS_DENIED = 15
      DP_OUT_OF_MEMORY = 16
      DISK_FULL = 17
      DP_TIMEOUT = 18
      FILE_NOT_FOUND = 19
      DATAPROVIDER_EXCEPTION = 20
      CONTROL_FLUSH_ERROR = 21
      OTHERS = 22   .
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards
    Swati Namdev

    Hi Swati,
    Pls refer the below code:
    TABLES: ekko.
    DATA: int_itab TYPE TABLE OF ekko WITH HEADER LINE.
    DATA: wf_name TYPE rs38l_fnam.
    DATA: wf_so1.
    *For PDf Conversions
    DATA: int_tab_otf_data TYPE ssfcrescl,
          int_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
          int_tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE,
          file_size TYPE i,
          bin_filesize TYPE i,
          file_name TYPE string,
          file_path TYPE string,
          full_path TYPE string,
          cparam TYPE ssfctrlop,
          outop TYPE ssfcompop.
    **Preview not allowed.
    outop-tddest = 'LP01'.
    cparam-no_dialog = 'X'.
    cparam-preview = ' '.
    cparam-getotf = 'X'.
    GET PARAMETER ID 'EBLEN' FIELD wf_so1.
    SELECT mandt ebeln bukrs bsart ernam ekorg bedat FROM ekko INTO TABLE
    int_itab WHERE ebeln = wf_so1.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = 'Z_SMARTFORM_FINAL2'
      IMPORTING
        fm_name            = wf_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.
    CALL FUNCTION wf_name
      EXPORTING
        control_parameters = cparam
        output_options     = outop
        user_settings      = space
      IMPORTING
        job_output_info    = int_tab_otf_data
      TABLES
        int_itab           = int_itab.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    int_tab_otf_final[] = int_tab_otf_data-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format        = 'PDF'
        max_linewidth = 132
      IMPORTING
        bin_filesize  = bin_filesize
      TABLES
        otf           = int_tab_otf_final
        lines         = int_pdf_tab.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
      CHANGING
        filename = file_name
        path     = file_path
        fullpath = full_path.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        bin_filesize = bin_filesize
        filename     = full_path
        filetype     = 'BIN'
      IMPORTING
        filelength   = file_size
      TABLES
        data_tab     = int_pdf_tab.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Ramneet Ahuja

  • Error in calling/converting smart form from ECC to pdf in portal.

    Hi,
    We have a requirement in our project where we have to show IT form in portal exactly in the way payslip are shown in ESS
    Screen, that is in the pdf form in ess portal screen.
    For this my HR abap consultant has made one customize smart form which is being called from a RFC FM.
    After the FM lf_fm_name gets executed , the OTF data is being captured and then converted in to PDF.
    After that the PDF is then converted into XSTRING format which is then supplied to the portal side through export parameter
    of the RFC.
    Now when we debugged the RFC, the conversion is taking place perfectly fine in to XSTRING.This is wat we assume.
    Portal Side: I have used Iframe ui ELEMENT in my webdynpro java and its property source I have binded with a value attribute
    of type string and I am executing above customize RFC given to me by my HR abap consultant and after executing that RFC with
    userID and payroll year as its import parameter I am taking export parameter of that RFC with name pdf_string of type XSTRING
    of that RFC into my webdynpro java value attribute which i binded to source property of Iframe.
    Now when we see the output in portal , first of all pdf is not getting generated and its showing the error message:
    file does not begin with '%pdf-' and secondly errored Adobe form getting opened outside Iframe window its not coming within
    Iframe window like what payslip comes inside Iframe UI element.
    I want to know what mistake we are doing in our ABAP coding or portal coding.
    Please help.

    Hi Satyam,
    You can use the existing SAP GRT framework for developing the app.
    Its easy and provides more features.
    See this wiki:
    http://wiki.sdn.sap.com/wiki/display/WDJava/HowtodevelopcustomWebDynproESSapplicationsusingGenericReportingTool%28GRT%29
    Regards
    Yugandhar Reddy

  • Creation of Smart Forms for PDF

    Hi All,
    I am new to SFP. So, please tell me how to create Smart Forms for PDF.
    I already have an SAP standard form of Customer Invoice in this format (SFP) and I need to change the layout and add some additional fields in it as well.
    Please guide me through the process. Earliest reponse will be highly appreciated.
    Regards,
    Shabbar

    Hi,
    I take that you meant PDF Forms in SAP.
    Refer the following help links.
    http://help.sap.com/saphelp_nw04s/helpdata/en/dc/f1783fe3263042e10000000a114084/content.htm
    This PDF link (Has got many Pdf files)
    https://www.sdn.sap.com/irj/sdn/interactiveforms?rid=/webcontent/uuid/d1088b7e-0c01-0010-c78e-984c0537e3ec [original link is broken]
    Also check this Tech-ed 06 session at Amsterdam.
    http://www.sapteched.com/emea/edu_sessions/session.htm?sid=317
    Check this download from SDN.
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/2dd3dbcd-0401-0010-55b8-b10808ff688e
    Is this you are looking for?
    Feel free to revert back.
    --Ragu

  • Display SMART form as PDF in WD ABAP

    Hi ,
    To display smart form as PDF  , I am following  the SDN article :
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785?quicklink=index&overridelayout=true
    In my component  , I have created the view VIEW_PDF, for this . I have created Adobe interactive UI element, and bind the property source to the attribute (XSTRING) where I will  get PDF (after OTF conversion).
    First of all I am using the FM SSF_FUNCTION_MODULE_NAME and usingf the import parameter fm_name .
    Then using this FM
    CALL FUNCTION lv_fm_name
      EXPORTING
       OUTPUT_OPTIONS             = lwa_output_options
        GW_VENREQDAT               = lwa_venreqdat
        GW_REQHEADER               = lwa_venreqhdr
    IMPORTING
       JOB_OUTPUT_INFO            = lv_ssf_output.
    from smart form ZVM_SFM_SUMMARY,I want to get  the data in OTF format using the importing parameter JOB_OUTPUT_INFO of the above FM.
    But I am not able to retrieve the data .Please direct me , where am I missing?
    For converting it to PDF , I am using the FM CONVERT_OTF .
    regards,
    amit

    You may continue like this there after...
    call function w_fmodule
        exporting
          control_parameters = w_cparam
          output_options     = w_outoptions   ":lv_output_options
          user_settings      = ' '
        importing
          job_output_info    = t_otf_from_fm
        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_otf_from_fm-otfdata[].
      call function 'SSFCOMP_PDF_PREVIEW'
        exporting
          i_otf                    = t_otf
        exceptions
          convert_otf_to_pdf_error = 1
          cntl_error               = 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.
      data: l_dummy type standard table of tline,
      pdf_data type xstring,
      pdf_size type i.
      clear: pdf_data, pdf_size.
      call function 'CONVERT_OTF'
        exporting
          format                = 'PDF'
    *      max_linewidth         = 132
        importing
          bin_filesize          = pdf_size
          bin_file              = pdf_data
        tables
          otf                   = t_otf[]
          lines                 = l_dummy
         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.
      data lv_source like ls_pdf-source.
    * navigate from <CONTEXT> to <PDF> via lead selection
      lo_nd_pdf = wd_context->get_child_node( name = wd_this->wdctx_pdf ).
    * get element via lead selection
      lo_el_pdf = lo_nd_pdf->get_element(  ).
    * get single attribute
      lo_el_pdf->set_attribute(
        exporting
          name =  `SOURCE`
          value = pdf_data ).
    Regards
    Gopi

  • Problem in converting smart form into PDF

    HI Experts,
                      I am using a Function Module CONVERT_OTF for converting smart form into pdf file for send it to with attachment.
    But i got a error when i am using that FM.
    Runtime Errors         CONVT_NO_NUMBER
    unable to interpret *292 as a no.
    Is that because my file size too large about 13 pages of PDF?
    and when i run it for other smart forms which have 2 or 3 pages of PDF, its working perfectly.
    can anyone tell what is problem with that FM?
    Thanks
    Shakun

    Hi,
    I had the similar issue and after analysis I have that this is the issue by not passing the IMPORTING parameter of the Function Module "BIN_FILESIZE". Please try to pass some variable to this paramter and then this will be completely rectified.
    DATA ; v_filesize     TYPE i.
    *--Convert OTF data to PDF data
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
          max_linewidth         = 132
        IMPORTING
          bin_filesize          = v_filesize
        TABLES
          otf                   = it_otfdata
          lines                 = it_pdfdata
        EXCEPTIONS
          err_max_linewidth     = 1
          err_format            = 2
          err_conv_not_possible = 3
          err_bad_otf           = 4
          OTHERS                = 5.
    Please verify whether this reolves the problem for you.
    Regards,
    SRinivas

  • Convertion of Smart form to pdf and sending mail to vendor for PO

    Hello all,
    I have modified a standard PO Smartform and running it through ME23N.
    In this i have to convert it to a pdf file and then send it through mail to the vendor.
    I have found out FMs'CONVERT_OTF'and
    'SO_NEW_DOCUMENT_ATT_SEND_API1'
    to convert it and send mail. But can u tell me how to go about using it.
    As i am using a standard program do i have to copy this prog to zprog and then call the fm out there. I am not sure.
    Thanks
    Salil

    Hi,
    Here is the sample code.If you find this as useful,kindly reward points by clicking the star on the left of reply.
    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
          w_objhead TYPE soli_tab,
          w_ctrlop TYPE ssfctrlop,
          w_compop TYPE ssfcompop,
          w_return TYPE ssfcrescl,
          w_doc_chng typE sodocchgi1,
          w_data TYPE sodocchgi1,
          w_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           = 'ZZZ_TEST2'
         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.
      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 output of the smart form.'.
    APPEND i_objtxt.
    i_objtxt = 'Regards,'.
    APPEND i_objtxt.
    i_objtxt = 'J.Jayanthi'.
    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 = 1.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'Smartform'.
    CONCATENATE 'Smartform_output' '.pdf'
    INTO i_objpack-obj_descr.
    i_objpack-doc_size = v_lines_bin * 255.
    APPEND i_objpack.
    Document information.
    CLEAR i_reclist.
    e-mail receivers.
    i_reclist-receiver = '[email protected]'.
    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_hex               = 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.

Maybe you are looking for

  • I bought windows when I needed the Mac version, who can help me?

    I accidentally bought the wrong for the wrong system - how can I get is exchanged?

  • PeopleSoft HRMS Installation (MS SQL Server 2005)

    Hello there, I am trying to install HRMS with database MS SQL Server 2005. I am running into few issues when i am trying to do PeopleSoft database installation through Database configuration wizard. The following is the error message : ERROR: Setup f

  • Command line to push exe files

    I want to push microsoft updates and exe files using SCCM 2012 R2  What is the command line please do guide me wusa.exe "Windows6.1-KB2729094-v2-x86.msu" /q /norestart wusa.exe  "NET Framework 4.0.exe"  /q /norestart or "Windows6.1-KB2729094-v2-x86.m

  • Console logs - All Messages v Console Messages

    Hi, In Utilities/Console, what is the difference between the Console Messages log and the All Messages log? Thanks, b.

  • Class Arc

    Hi, I'm using java graphics, and I'm wondering if there is a way to use arcs similar to the way rectangles and other shapes can be used. That is, for rectangles you can do this: Rectangle myRect = new Rectangle(0,0,50,50); instead of g.drawRect(0,0,5