Action - Display smartform in PDF format

Hi All,
I have a requirement whereby on triggering of a print form action in crmd_order, the smartform should be displayed in PDF format and from there, user should be able to choose whether to save or to print the form. How can this be done?
Thanks!
Cady

Hi,
Here's the solutions.
1 .Show the PDF as pop-up upon trigger, very much the same how PDF attachment always pops up in the internet explorer. But this pops up in GUI.
Call the smartform FM with the GETOTF checked,
control_parameters-GETOTF = 'X'.
control_parameter-no_dialog = 'X'.
control_parameter-langu = <ur language>.
output_options-tddest = 'LOCL'.
output_option-tdimmed = 'X'.
output_option-tddelete = 'X'.
i_otf = job_output_info-OTFDATA.
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
  EXPORTING
    i_otf                          = i_otf
EXCEPTIONS
   CONVERT_OTF_TO_PDF_ERROR     
   CNTL_ERROR                   
   OTHERS                        
2. Triggering action in ICWC and PDF pops up in new window.
Call function 'SSF_GET_DEVICE_TYPE'
    EXPORTING
      i_language             = sy-langu
    IMPORTING
      e_devtype              = devtype
    EXCEPTIONS
      no_language              
      language_not_installed
      no_devtype_found       
      system_error             
      others                       
control_parameters-langu = sy-langu.
    control_parameters-no_dialog = 'X'.
    control_parameters-getotf       = 'X'.
CALL FUNCTION '<your_form_FM>'
  EXPORTING
   CONTROL_PARAMETERS      = control_parameters
   OUTPUT_OPTIONS                 = output_options
IMPORTING
   JOB_OUTPUT_INFO                = output_data
  TABLES
   orderadm_h       = <your tables>
  EXCEPTIONS
   FORMATTING_ERROR      
   INTERNAL_ERROR            
   SEND_ERROR                  
   USER_CANCELED            
   OTHERS                           
call function 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
    IMPORTING
      bin_filesize          = l_pdf_len
      bin_file                = l_pdf_xstring
    TABLES
      OTF                    = OUTPUT_DATA-OTFDATA
      LINES                 = LT_LINES
    EXCEPTIONS
      err_max_linewidth       
      err_format                  
      err_conv_not_possible 
      err_bad_otf                 
      others                        
CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE  EXPORTING add_c_msg = 1.
    l_pdf_len = xstrlen( l_pdf_xstring ).
    cached_response->set_data( data   = l_pdf_xstring
                        length = l_pdf_len ).
cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                       value = 'application/pdf' ).
    cached_response->set_status( code = 200 reason = 'OK' ).
    cached_response->server_cache_expire_rel( expires_rel = 180 ).
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        ev_guid_32 = guid.
    CONCATENATE runtime->application_url '/' guid '.pdf' INTO display_url.
    cl_http_server=>server_cache_upload( url      = display_url
                                         response = cached_response ).
                                         url = display_url.
RETURN.
Declare display_url as an attribute in the implementation class as well as page attribute.
Push the display_url value to page attribute using the SET_MODELS method in the implementation class.
Clear display_url in DO_INIT_CONTEXT so that PDF only pops up when action is triggered.
Put this piece of code in the page htm.
I can't seem to be able to put the code here. It's a java script.
  IF display_url IS NOT INITIAL.
* I can't show the script here for i kept getting error when i tried putting the java script here.
  ENDIF.
3. To trigger a print action and send PDF attachment in background, a spool will still be created. 
Call the smartform FM as usual.
  lt_spoolid[] = es_job_output_info-spoolids[].
  READ TABLE lt_spoolid INTO lw_spoolid INDEX 1.
  CHECK lw_spoolid IS NOT INITIAL.
  CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid                = lw_spoolid
      no_dialog                  = 'X'
    IMPORTING
      pdf_bytecount            = lw_bytecount
    TABLES
      pdf                             = lt_lines
    EXCEPTIONS
      err_no_otf_spooljob      
      err_no_spooljob            
      err_no_permission        
      err_conv_not_possible   
      err_bad_dstdevice         
      user_cancelled             
      err_spoolerror               
      err_temseerror              
      err_btcjob_open_failed  
      err_btcjob_submit_failed
      err_btcjob_close_failed  
      OTHERS                      
  IF sy-subrc NE 0.
*/    Set to incorrectly processed.
    CALL METHOD cl_log_ppf=>add_message
      EXPORTING
        ip_problemclass = '2'
        ip_handle       = ip_application_log.
  ENDIF.
  CHECK sy-subrc = 0.
* Convert PDF from 132 to 255, combine everything into a single string.
  LOOP AT lt_lines INTO lw_lines.
* Individually replace the space with a '~'.
    TRANSLATE lw_lines USING ' ~'.
    CONCATENATE lw_buffer lw_lines INTO lw_buffer.
  ENDLOOP.
* Replace '~' by space.
  TRANSLATE lw_buffer USING '~ '.
  DO.
*   Putting in the first 255 chars into the variable.
    lw_record = lw_buffer.
*   Append 255 chars as a record.
    APPEND lw_record TO lt_record.
    SHIFT lw_buffer LEFT BY 255 PLACES.
    IF lw_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.
* Object with PDF.
  lt_objbin = lt_record.
  DESCRIBE TABLE lt_objbin LINES lw_lines_bin.
* Object with main text for the mail.
  lw_objtxt = <your text>
  append lw_objtxt to lt_objtxt.
  DESCRIBE TABLE lt_objtxt LINES lw_lines_txt.
* Document information.
  lw_doc_chng-obj_name    = 'Smartform'.
  lw_doc_chng-expiry_dat  = sy-datum + 20.
  lw_doc_chng-obj_descr   = <your text>.
  lw_doc_chng-sensitivty  = 'F' 
  lw_doc_chng-doc_size    = lw_lines_txt * 255.
* Pack to main body as RAW
* Obj to be transported not in binary form
  CLEAR lw_objpack-transf_bin.
* Start line of object header in transport packet.
  lw_objpack-head_start = 1.
* Number of lines and object header in object packet.
  lw_objpack-head_num = 0.
* Start line of object contents in an object packet.
  lw_objpack-body_start = 1.
* Number of lines of the object contents in an object packet.
  lw_objpack-body_num = lw_lines_txt.
* Code for document class.
  lw_objpack-doc_type = 'RAW'.
  APPEND lw_objpack TO lt_objpack.
* Packing as PDF.
  lw_objpack-transf_bin = lc_x.
  lw_objpack-head_start = 1.
  lw_objpack-head_num   = 0.
  lw_objpack-body_start = 1.
  lw_objpack-body_num   = lw_lines_bin.
  lw_objpack-doc_type   = 'PDF'.
  lw_objpack-obj_name   = <your text>.
  CONCATENATE '<your text>' '.pdf' INTO lw_objpack-obj_descr.
  lw_objpack-doc_size   = lw_lines_bin * 255.
  APPEND lw_objpack TO lt_objpack.
* Document information.
  CLEAR lw_reclist.
* Email receivers.
  lw_reclist-receiver = <email address>
  lw_reclist-express  = 'X'.
  lw_reclist-rec_type = 'U'. "Internet address.
  lw_reclist-com_type ='INT'.
  APPEND lw_reclist TO lt_reclist.
* Send mail.
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = lw_doc_chng
    TABLES
      packing_list                 = lt_objpack
      object_header              = lw_objhead
      contents_txt                = lt_objtxt
      contents_bin               = lt_objbin
      receivers                     = lt_reclist
    EXCEPTIONS
      too_many_receivers            
      document_not_sent            
      document_type_not_exist   
      operation_no_authorization 
      parameter_error                 
      x_error                             
      enqueue_error                   
      OTHERS                          
  IF sy-subrc = 0.
    COMMIT WORK.
  ELSE.
*/    Set to incorrectly processed.
    CALL METHOD cl_log_ppf=>add_message
      EXPORTING
        ip_problemclass = lc_2
        ip_handle       = ip_application_log.
  ENDIF.
4. Trigger action and send PDF attacment as mail. No Spool.
control_parameters-GETOTF = 'X'.
control_parameter-no_dialog = 'X'.
control_parameter-langu = <ur language>.
output_options-tddest = 'LOCL'.
output_option-tdimmed = 'X'.
output_option-tddelete = 'X'.
  CALL FUNCTION 'your smartform FM
    EXPORTING
      control_parameters = lw_ctrl_params
      output_options     = lw_output_options
      user_settings      = space              "Has to be set to SPACE so it will get parameters from lw_output_options.
      et_orderadm_h    
      et_orderadm_i     
      et_cancel          
      et_appointment    
      et_partner        
      es_but000         
    IMPORTING
      job_output_info    = lw_output  "OTF format
    EXCEPTIONS
      formatting_error  
      internal_error    
      send_error        
      user_canceled     
      OTHERS            
* Get the OTF data.
  lt_otf = lw_output-otfdata[].
* Convert OTF format to PDF.
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = lw_bin_filesize
    TABLES
      otf                     = lt_otf
      lines                  = lt_lines
    EXCEPTIONS
      err_max_linewidth       
      err_format                  
      err_conv_not_possible 
      err_bad_otf                 
      OTHERS                    
The rest will the similiar to no.3, * Convert PDF from 132 to 255, combine everything into a single string. onwards.
Cheers,
ck.

Similar Messages

  • In R/3 display smartform as pdf in a custom container

    Hello,
    I want to display smartform as pdf in a custom contianer . I was able to find all the right code from sdn.
    but my problem is that when executed my sap gui is closed without any error.
    I am unable to understand what is going wrong.
      CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
        IN_PLACE = 'X' ).  does not show the pdf.
    Can any one help me to find out if we need to do some setting for MIME type application/pdf. Because I tried to display a bar chart in the custom container of MIME type text/html , and this is working fine.
    Is any setting missing in our R/3 because of which the code is not getting executed.
    below code is the exact copy from a post in sdn:
    report ztest_pdf.
    DATA: LT_PDF TYPE TABLE OF TLINE,
          LS_PDF LIKE LINE OF LT_PDF,
          LV_URL TYPE CHAR255,
          PDF_FSIZE TYPE  I,
          LV_CONTENT  TYPE XSTRING,
          LT_DATA TYPE STANDARD TABLE OF X255.
    DATA : L_JOB_OUTPUT_INFO TYPE SSFCRESCL.
    DATA : LS_CONTROL_PARAM  TYPE SSFCTRLOP.
    DATA : G_HTML_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           G_HTML_CONTROL   TYPE REF TO CL_GUI_HTML_VIEWER.
    *      pdf_control type ref to cl_gui_pdfviewer.
    DATA : P_VBELN TYPE  VBELN_VL.
    DATA : i_html TYPE w3htmltabtype.
    ",       g_url  TYPE w3url
    FIELD-SYMBOLS <FS_X> TYPE X.
    INITIALIZATION.
    LS_CONTROL_PARAM-GETOTF = 'X'.
    LS_CONTROL_PARAM-NO_DIALOG = 'X'.
    START-OF-SELECTION.
      CALL FUNCTION '/1BCDWB/SF00000298'
    EXPORTING
    *    ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
         CONTROL_PARAMETERS         = LS_CONTROL_PARAM
    *     P_VBELN                    = P_VBELN
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
    *   OUTPUT_OPTIONS             =
    *   USER_SETTINGS              = 'X'
    IMPORTING
    *      DOCUMENT_OUTPUT_INFO  = L_DOCUMENT_OUTPUT_INFO
           JOB_OUTPUT_INFO       = L_JOB_OUTPUT_INFO
    *      JOB_OUTPUT_OPTIONS    = L_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.
    data pdfxstring type xstring.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE
          bin_file              = pdfxstring
        TABLES
          OTF                   = L_JOB_OUTPUT_INFO-OTFDATA
          LINES                 = LT_PDF
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      CALL SCREEN 100.
    module STATUS_0100 output.
    *  SET PF-STATUS 'xxxxxxxx'.
    *  SET TITLEBAR 'xxx'.
      CREATE OBJECT G_HTML_CONTAINER
        EXPORTING
          CONTAINER_NAME = 'PDF'.
    CREATE OBJECT G_HTML_CONTROL
        EXPORTING
          PARENT = G_HTML_CONTAINER.
    * Convert xstring to binary table to pass to the LOAD_DATA method
      CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = pdfxstring"LV_CONTENT
        TABLES
          BINARY_TAB = LT_DATA.
    * PERFORM bar_chart .
    * Load the HTML
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         = 'application' "'text' " 'application'
           SUBTYPE      = 'pdf' "'html'  "'pdf'
         IMPORTING
           ASSIGNED_URL         = lv_URL
         CHANGING
           DATA_TABLE           =  LT_DATA "i_html "LT_DATA
         EXCEPTIONS
           DP_INVALID_PARAMETER = 1
           DP_ERROR_GENERAL     = 2
           CNTL_ERROR           = 3
           OTHERS               = 4 ).
    * Show it
      CALL METHOD G_HTML_CONTROL->SHOW_URL( URL = LV_URL
        IN_PLACE = 'X' ).
    Thanks,
    Jaya.
    Edited by: kishan P on Jun 9, 2011 1:40 PM

    Hello Sandra,
    Thanks for your reply, but eventhen it fails to load the pdf. Is ADS required to be installed for this?
    Can I just pass the pdf_fsize imported from  CONVERT_OTF which is of type i.
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE    
    bin_file              = pdfxstring
        TABLES
          OTF                   = L_JOB_OUTPUT_INFO-OTFDATA
          LINES                 = LT_PDF
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.
      CALL METHOD G_HTML_CONTROL->LOAD_DATA(
         EXPORTING
           TYPE         = 'application' "'text' " 'application'
           SUBTYPE      = 'pdf' "'html'  "'pdf'
           size           = PDF_FSIZE
         IMPORTING
           ASSIGNED_URL         = lv_URL
         CHANGING
           DATA_TABLE           =  LT_DATA "i_html "LT_DATA
         EXCEPTIONS
           DP_INVALID_PARAMETER = 1
           DP_ERROR_GENERAL     = 2
           CNTL_ERROR           = 3
           OTHERS               = 4 ).
    Thanks,
    Jaya.

  • How to send output of smartform in pdf format as an attachment to email

    how to send output of smartform in pdf format as an attachment to email
    search before posting further and follow Forum rules
    Edited by: Vijay Babu Dudla on Jan 15, 2009 4:50 AM

    Did u check on sdn?
    i dont think so or else there are many posts on this topic and good wikis too.
    look at one of these code tutorial wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/mail%2bsend%2bthrough%2boutput%2bcontrols
    So next time do use the search functionality.
    кu03B1ятu03B9к
    Edited by: kartik tarla on Jan 15, 2009 12:33 PM

  • Generating Smartform in PDF Format through SRM portal link

    Hi All,
    Please can one tell me generating Smartform in PDF format while we click on Output-format while displaying Purchase order.
    Is there any configuration needed or is there any process to generate smartform in SRM portal link.
    Thanks,
    Sri Lakshmi

    Hi Pradeep,
    Thanks for your reply.
    I dont want any BADI or Method.
    I want to know, when we display or create  Purchase Order through SRM link- there is an option Output format where the details of PO will be generated through Smartform in PDF format.
    I want to know the procedure how that PDF format is generating.
    Regards,
    Sri Lakshmi

  • Convert Smartform in PDF format and send to SAP Workplace

    Hi to all.
    I need help of somebody expert in SMARTFORM's.
    I need to convert a smartform into PDF format and to send as attachement for SAP workplace
    of the user.
    I developed the next code.
    IT is to function and to send the mail for SAP workplace, but it happens that smartform
    contains images (logos) and tables, when the user tries to open the file pdf in inbox gives
    to error - "An unrecognized token ' q0 ' was found".
    I tried to call a smartform only with text and functioned well.
    Somebody can help me?
    My code:
    Begin ***********************************************
    REPORT zteste_nsa_send_pdf_sap_office.
    DATA: t_print LIKE zeps_fm04 OCCURS 0 WITH HEADER LINE,
          v_size TYPE i.
    DATA: ls_bil_invoice TYPE lbbil_invoice.
    TABLES: nast.
    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.
    START-OF-SELECTION.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZFPS_FICHA_VALORIZACAO'
        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'
          is_bil_invoice     = ls_bil_invoice
          is_nast            = nast
          is_repeat          = 'X'
        IMPORTING
          job_output_info    = w_return
        TABLES
          t_list             = t_print
        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
          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 EQ 0.
      ENDIF.
    Convert PDF from 132 to 255.
      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.
    SEND MAIL
      REFRESH:  i_reclist,
                i_objtxt,
                i_objbin,
                i_objpack.
      CLEAR wa_objhead.
    Object with PDF.
      i_objbin[] = i_record[].
    Object with main text of the mail.
      i_objtxt = 'Fichas de Valorização e Esquemas Tipo'.
      APPEND i_objtxt.
    Document information.
      wa_doc_chng-obj_name   = 'SMART'.
      wa_doc_chng-expiry_dat = sy-datum + 10.
      wa_doc_chng-obj_descr  = 'Ficha de Valorização'.
      wa_doc_chng-sensitivty = 'F'. "Functional object
      wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
    Pack to main body as RAW.
    Obj. to be transported not in binary form
      DESCRIBE TABLE i_objtxt LINES v_lines_txt.
      READ TABLE i_objtxt INDEX v_lines_txt.
      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.
    Packing as PDF.
    Obj. to be transported in binary form
      DESCRIBE TABLE i_objbin LINES v_lines_bin.
      READ TABLE i_objbin INDEX v_lines_bin.
      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   = 'SMART'.
      CONCATENATE 'Ficha_Valorizacao' '.pdf' INTO i_objpack-obj_descr.
      i_objpack-doc_size = ( v_lines_bin - 1 ) * 255 + STRLEN( i_objbin ).
      APPEND i_objpack.
    e-mail receivers.
      CLEAR i_reclist.
      i_reclist-receiver = sy-uname.
      i_reclist-rec_type = 'B'.
      i_reclist-express  = 'X'.
      APPEND i_reclist.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = ' '
        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 EQ 0.
      ENDIF.
    End  *************************************************
    Thanks very much to all and Happy New year...
    Nelson

    Please check this link...
    [http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/27/67443cc0063415e10000000a11405a/content.htm]
    -Muktar

  • Problem in displaying smartform as pdf in portal

    Hi all,
    We  created a smartform and we are displaying as a pdf in portal.Everything is fine and pdf  is coming.But there is arabic data in the form .
    Some of the arabic data is coming perfectly.
    But some data is coming in Japanese or chinese and some data is coming like
    F,D'! 9(/'D1-EF (F 5'D- 'D3JA 叉â
    Department 'D%/'1) 'D9'E) DDEH'1/ 'D(41J).
    Please let me know what could be the problem.
    Thanks and Regards,
    Rajesh

    hi Rajesh.....
    Could you explain me how 2 display SMARTFORM as PDF in portal..... please.....
    I have the requirement as follows.....
    By pressing a button the smartform must be generated.....
    SO what must be the RFC o/p from ABAP.... I am ABAPER basically
    and what the portal guys must do.....
    pleaseeee

  • Smartform In PDF Format

    Hi All,
    Can anyone send me the sample code for attaching a SmartForm in PDF Format.
    Thanks in advance.
    Ulhas

    hi,
    check this
    http://www.****************/Tutorials/Smartforms/OTF2PDF.htm

  • VF01- invoice smartform in PDF format to be sent thro' mail

    Hello Gurus,
    We have a requirement from our client that we need to trigger a mail of invoice smartform in PDF format on saving in VF01.
    Can any body suggest the steps in NACE and also output..
    Regards

    As per your post, I understood that,
    After saving Invoice , automatically Invoice has to send in PDF format to the respective email id maintained in CMR-Payer master
    if yes, this involves ABAP & BASIS ,
    ABAP- Program & FOrm routine has to created & assigned in respective output type & type-PDF (Check in NACE- Output type)
    for this, you need to maintain the Condition record- VV31 - with medium as "Mail" -
    or else,
    you can do this manually also, in VF31- you can give a print  & save in PDF format- you can send it - but its complete manual process.

  • How to display smartform as PDF in web dynpro java

    Hi,
    Where can I find sample program to display smartform as PDF in web dynpro java.
    Thanks.
    Regards,
    Henry

    1. Create a smart form in the R/3 side
    2. Now create a function module with the corresponding export parameter:
    3. Make sure that the function module is marked remote enabled. 
    4. In NWDS  create an Adaptive RFC model which points to the FM created in R/3 under the webdynpro application
    5. Now create an application and view inside it to display the PDF and Insert a frame inside the view
    6. Create a  value node and an attribute say url of type string inside that node and bind it to the source
    7. In the doInit() method place the following code
    >    ZTest_Pdf_1_Input input = new ZTest_Pdf_Input();
    >    wdContext.nodeZTest_Pdf_Input().bind(input);      
    >    try {                       
    >            wdContext.currentZTest_Pdf_InputElement().modelObject().execute();
    >            }
    >  catch (Exception e) {
    >                        e.printStackTrace();
    >            }          
    >  wdContext.currentInternalElement().setUrl(convert(wdContext.currentOutputElement().getBin_File()));       
    Inside that view create a method to convert the string to url so that it can be passed as a string to the setUrl method of the currentContextElement() , say convet(byte[] doc_content) which return a string.
    Inside that methos write the following code,
    >         String url = "";
    >           WDWebResourceType webResType = WDWebResourceType.PDF;
    >            IWDWebResource webResource = WDWebResource.getWebResource(doc_content, webResType);
    >            try {
    >                        url = webResource.getURL();
    >            }
    >  catch (Exception e) {
    >                        e.printStackTrace();
    >            }          
    >            return url;
    Hope It will be helpful
    Regards,
    Sam Charles J.

  • Hi, I have converted different smartforms to pdf format.How to combine pdf?

    Hi All,
    I have converted different smartforms to pdf format. How to combine all the pdf's into single pdf.
    I need all the smartforms to be in single pdf.
    Please help me in this regard.
    Thanks in advance.

    Hi Keshu,
    Individual pdf should be sent to individual user.
    And at last all the pdfs of the smartform should be combined into one.
    And admin have the provision to download it .
    I mean the requirement is
    For example.
    For the month of september i will generate Pay Slip to each employee. And each pdf will be send to corresponding employee.
    And finally all the pay slips of all the employees will be combined into single PDF and admin will download it and keep it for reference.
    So as of now. I have generated individual pdfs and mailed it accordingly.
    But how to combine it into one PDF is my question.
    Please help me in this regard.
    Thanks in advance.

  • Smartforms as PDF format

    HI Experts,
                    How do I dispaly my smartforms in PDF format. How do I get Spool ID. where all the changes I have to made. plz describe properly.
    Thanks. Alot.
    Khan

    Hi
    You will get the Spool ID in the Fun module itself (in SE38 program)
    in the output paramters <b> DOCUMENT_OUTPUT_INFO =</b>  or
    <b>JOB_OUTPUT_INFO =</b>  take that
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function FM_NAME
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    <b>* DOCUMENT_OUTPUT_INFO =</b>
    <b>JOB_OUTPUT_INFO =</b>
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    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.
    and pass that spool ID to the fun module
    call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
           exporting
                src_spoolid   = spoolid
                no_dialog     = 'X'
           importing
                pdf_bytecount = pdf_fsize
           tables
                pdf           = pdf_table
           exceptions
                others        = 0.
    Now PDF data is in PDF_TABLE
    so download it using GUI_DOWNLOAD and send it to your mail ID
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Trigger print action in ICWC, then display Smartform in PDF

    Hi All,
    We have the 'Print' action configured in CRM 5.0.
    Upon triggering the 'Print' action in ICWC, I'd like the smartform be displayed in a new window in PDF format – allowing user to print/save the PDF.
    Any idea how can this be done? Thanks

    Hi,
    Have a look at this <a href="/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp
    Regards,
    Patrick.

  • Displaying a smartform in pdf format using webdynpro

    Hi,
    I have created a smartform using t.code smartforms. I have created a function module within which i used the function mocule convert_otf which will convert the smartform into binary format. Now how do i proceed in displaying the form using web dynpro.
    Plz give me your suggestions.
    Thanks in advance.

    CALL FUNCTION LV_FUNC_MOD_NAME
        EXPORTING
          CONTROL_PARAMETERS = LS_SSFCTRLOP
          OUTPUT_OPTIONS     = LS_OUTPUT_OPTIONS
          USER_SETTINGS      = ' '
          RRNUM              = IM_RRNUM
        IMPORTING
          JOB_OUTPUT_INFO    = LT_RETURN
        EXCEPTIONS
          FORMATTING_ERROR   = 1
          INTERNAL_ERROR     = 2
          SEND_ERROR         = 3
          USER_CANCELED      = 4
          OTHERS             = 5.
      IF SY-SUBRC <> 0.
      ENDIF.
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        FORMAT                = 'PDF'
        MAX_LINEWIDTH         = 132
      IMPORTING
        BIN_FILESIZE          = LV_LENGTH
        BIN_FILE              = LV_XSTRING
      TABLES
        OTF                   = LT_RETURN-OTFDATA
        LINES                 = LT_TLINE
      EXCEPTIONS
        ERR_MAX_LINEWIDTH     = 1
        ERR_FORMAT            = 2
        ERR_CONV_NOT_POSSIBLE = 3
        ERR_BAD_OTF           = 4
        OTHERS                = 5.
    IF SY-SUBRC <> 0.
    ENDIF.
    LV_FUNC_MOD_NAME is your smartform function module name.
    LV_XSTRING contains the stream of the pdf , send this to the browser using the following code.
        LV_FILENAME = 'RebateRequest.pdf'.
        LV_CTYPE = 'pdf'.
        CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE(
                  EXPORTING I_FILENAME = LV_FILENAME
                            I_CONTENT  = LV_XSTRING
                            I_MIME_TYPE = LV_CTYPE
                            I_INPLACE = ABAP_TRUE
                            I_IN_NEW_WINDOW = ABAP_TRUE ).
    Abhi

  • SMARTFORM TO PDF FORMAT

    Hi All,
    I have a requirement to get a print preview of the smartform in the pdf format and have the option to either print it or save it.
    meaning - the adobe application must automatically open and in it, there must be a window to display the smartform in the PDF format.
    the code i have so far is as below
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
           EXPORTING
                FORMNAME           = W_FORM_NAME
           IMPORTING
                FM_NAME            = W_FMODULE
           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.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    gst_output_options-tddest = 'FRNT_End_Print'. "Frontend printer
    gst_output_options-tdnewid = sy-prnew.
    gst_output_options-tdimmed = 'X'.
    gst_output_options-tddelete = sy-prrel.
    clear gst_control_parameters.
    gst_control_parameters-no_dialog = 'X'.
    gst_control_parameters-getotf = 'X'.
    gst_control_parameters-preview = 'X'. "Deactivate preview!
    *Call the original function module.
    call function w_fmodule
    exporting
    control_parameters = gst_control_parameters
    output_options = gst_output_options
    importing
    job_output_info = gt_job_output_info
    job_output_options = gt_output_options
    tables
    tbl_amt = final_tab
    exceptions
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4.
    if sy-subrc ne 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
      T_OTF[] = gt_job_output_info-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 ne 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    The adobe application is launched but the window inside does not hold anything.
    i get a pop-up inside the adobe window with the message " FILE DOES NOT BEGIN WITH '%PDF-' ".
    Any suggestions are greatly appreciated.
    hoping to hear from you all.
    thank you.
    Sandeep

    Hi Sandeep,
              Plz try with this code this code is working properly.
    DATA: form_name TYPE rs38l_fnam.
    DATA: wa_ctrlop TYPE ssfctrlop,
    wa_outopt TYPE ssfcompop.
    DATA: t_otfdata TYPE ssfcrescl,
    t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i.
    DATA: w_bin_filesize TYPE i.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZSM_PDF_1'
    * 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-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'
    mydate = F_DATE
    IMPORTING
    * DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otfdata
    * JOB_OUTPUT_OPTIONS =
    TABLES
         ITAB = ITAB
    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 = ' '
    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
    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 'WS_DOWNLOAD'
    EXPORTING
    bin_filesize = w_bin_filesize
    * CODEPAGE = ' '
    filename = 'C:\Users\KO58\Desktop\test1.pdf'
    filetype = 'BIN'
    * MODE = ' '
    * WK1_N_FORMAT = ' '
    * WK1_N_SIZE = ' '
    * WK1_T_FORMAT = ' '
    * WK1_T_SIZE = ' '
    * COL_SELECT = ' '
    * COL_SELECTMASK = ' '
    * NO_AUTH_CHECK = ' '
    IMPORTING
    filelength = w_filesize
    TABLES
    data_tab = t_pdf_tab
    * FIELDNAMES =
    EXCEPTIONS
    file_open_error = 1
    file_write_error = 2
    invalid_filesize = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10
    IF sy-subrc <> 0.
    MESSAGE i003(z00) WITH 'File not downloaded succesfully'.
    ELSE.
    MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '
    'under D drive'.
    ENDIF.
    If usefull plz give rewards.
    Cheers
    Anirudh

  • Display Smartform in PDF.

    Hi All,
    I have gone through the forum threads to convert a smartform into a pdf document. All of them say to use function module CONVERT_OTF. This function module converts the output of the smartform which is in OTF into the PDF format and we can download the information which opens up with Adobe Reader.
    The question is whether we can display the output of the smartform in Adobe at runtime within the SAP GUI because if it is in the portal then we can set the attribute in SAP Connect, to display the output of SAP Script and Smartforms in PDF.
    I tried this code
    REPORT  ZACOSTA_FETCH_DATA_COPY.
    DATA : IT_ZACOSTA TYPE  ZACOSTA_TAB_DET.
    DATA : V_FORM_NAME TYPE TDSFNAME VALUE 'ZACOSTA_FORMS_COPY1',
           V_FUNC_NAME TYPE RS38L_FNAM.
    DATA:   LS_CONTROL_PARAMETERS TYPE SSFCTRLOP,
            LS_OUTPUT_OPTIONS     TYPE SSFCOMPOP,
            LS_JOB_OUTPUT_INFO    TYPE SSFCRESCL,
            LT_LINES              TYPE TABLE OF TLINE,
            L_DEVTYPE             TYPE RSPOPTYPE,
            L_SAM_HAWKINS         TYPE INT4,
            L_DOC TYPE DOCS OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT VBAKVBELN VBAKVKORG VBAK~VTWEG
             VBAKSPART VBAKKUNNR VBAP~POSNR
             VBAPMATNR VBAPARKTX VBAP~NETWR
             VEDAVBEGDAT VEDAVENDDAT
             INTO CORRESPONDING FIELDS OF TABLE IT_ZACOSTA
             FROM VBAK INNER JOIN VBAP
             ON VBAKVBELN = VBAPVBELN
             INNER JOIN VEDA
             ON VEDAVBELN = VBAPVBELN
             WHERE VBAK~VBELN  = '0040000264'. "Where Clause to be removed
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = V_FORM_NAME
           VARIANT                  = ' '
           DIRECT_CALL              = ' '
          IMPORTING
            FM_NAME                  = V_FUNC_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.
    Set language
      LS_CONTROL_PARAMETERS-LANGU  = SY-LANGU.
    Set control parameters to get the output format (OTF) from Smart Forms
      LS_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
      LS_CONTROL_PARAMETERS-GETOTF    = 'X'.
      LS_OUTPUT_OPTIONS-TDNOPREV = 'X'.
      CALL FUNCTION V_FUNC_NAME
        EXPORTING
          OUTPUT_OPTIONS     = LS_OUTPUT_OPTIONS
          CONTROL_PARAMETERS = LS_CONTROL_PARAMETERS
          USER_SETTINGS      = SPACE
          IT_ZACOSTA         = IT_ZACOSTA
        IMPORTING
          JOB_OUTPUT_INFO    = LS_JOB_OUTPUT_INFO.
      CALL FUNCTION 'CONVERT_OTF'
           EXPORTING
             FORMAT                      = 'PDF'
            MAX_LINEWIDTH               = 132
           ARCHIVE_INDEX               = ' '
           COPYNUMBER                  = 0
           IMPORTING
             BIN_FILESIZE                = L_SAM_HAWKINS
            bin_file                    = p_data       " binary file
           TABLES
             OTF                  = LS_JOB_OUTPUT_INFO-OTFDATA
             LINES                       = LT_LINES
           EXCEPTIONS
             ERR_MAX_LINEWIDTH           = 1
             ERR_FORMAT                  = 2
             ERR_CONV_NOT_POSSIBLE       = 3
             ERR_BAD_OTF                 = 4
             OTHERS                      = 5
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'C:\Test.pdf'
       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'
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = LT_LINES
      FIELDNAMES                      =
    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.
    The reson why I had to download is because this does not show the PDF at runtime. Am I missing some parameter here or is there some kind of configuration required to display the smartform in PDF at runtime within the SAP GUI.
    Any hints on this would be greatly appreciated.
    Best Regards,
    Sudhi

    Hi,
    Here is the sample code.This code will download the smartforms as PDF.Kindly reward points by clicking the star on the left of reply,if it helps.
    REPORT zswar.
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETER: p_date LIKE sy-datum.
    PARAMETER: p_rea TYPE char255.
    SELECTION-SCREEN: END OF BLOCK b1.
    DATA: ws_ucomm LIKE sy-ucomm.
    INITIALIZATION.
    SET PF-STATUS 'STANDARD' OF PROGRAM 'ZSWAR'.
    AT SELECTION-SCREEN.
    ws_ucomm = sy-ucomm.
    CASE ws_ucomm.
    WHEN '&PDF'.
    PERFORM f1000_download_form.
    EXIT.
    WHEN '&BACK'.
    SET SCREEN 0.
    EXIT.
    WHEN '&EXIT'.
    SET SCREEN 0.
    EXIT.
    WHEN '&canc'.
    SET SCREEN 0.
    LEAVE TO SCREEN 0.
    ENDCASE.
    *& Form F1000_DOWNLOAD_FORM
    text
    --> p1 text
    <-- p2 text
    FORM f1000_download_form.
    DATA: form_name TYPE rs38l_fnam.
    DATA: wa_ctrlop TYPE ssfctrlop,
    wa_outopt TYPE ssfcompop.
    DATA: t_otfdata TYPE ssfcrescl,
    t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    Tutorial on SMART FORMS
    © 2005 SAP AG 7
    DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i.
    DATA: w_bin_filesize TYPE i.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZSMARTFORM_SWAR'
    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-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'
    mydate = p_date
    reason = p_rea
    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'
    Tutorial on SMART FORMS
    © 2005 SAP AG 8
    max_linewidth = 132
    ARCHIVE_INDEX = ' '
    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
    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 'WS_DOWNLOAD'
    EXPORTING
    bin_filesize = w_bin_filesize
    CODEPAGE = ' '
    filename = 'd:     est.PDF'
    filetype = 'BIN'
    MODE = ' '
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    COL_SELECT = ' '
    COL_SELECTMASK = ' '
    NO_AUTH_CHECK = ' '
    IMPORTING
    filelength = w_filesize
    TABLES
    data_tab = t_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    file_open_error = 1
    file_write_error = 2
    invalid_filesize = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    OTHERS = 10
    IF sy-subrc <> 0.
    MESSAGE i003(z00) WITH 'File not downloaded succesfully'.
    ELSE.
    MESSAGE i003(z00) WITH 'File Test.pdf downloaded succesfully '
    'under D drive'.
    ENDIF.
    ENDFORM. " F1000_DOWNLOAD_FORM

Maybe you are looking for

  • CONVERTING  PR TO PO( PL GIVE HIGH PRIORITY)

    <b></b><b></b> HI, CONVERTING FROM PO TO PR(NO ASSIGNMENT OF SOURCE OF SUPPLY IN THE PR). WHICH ONE IS THE STD TCODE ME59N/ME57/ME56 ?,OTHERWISE CAN WE GO FOR DOCUMENT OVERVIEW IN PO AND SELECT THE MY PR IS THEERE ANY SETTING ,AFTER CONVERTION THE PR

  • Default font for mail messages?

    Is it possible to set up a default font for outgoing mail messages, such as Helvetica 12 point bold in dark blue, without having to click on font and color every time I compose an e-mail? Imac G-5   Mac OS X (10.4.3)   Imac G-5   Mac OS X (10.4.3)  

  • Arabic Text in TextInput in Flash Builder 4.5.1

    Hello, I am currently developing a mobile application that is supposed to work on both Android and iOS devices. I am supposed to display arabic text and also to take arabic text input from the user. While I was trying to display simple output and inp

  • Problems with Images in Firefox

    The problem is difficult to describe. As i wrote in my other posts, i wrote an HTTP (streaming) chatserver with NIO. In Firefox i'm having problems to display images in the messages view. If i post more than one picture to the chat, not all pictures

  • FCP hangs on launch and then won't force quit

    I am having trouble launching FCP. it will hang about at the point that it is llooking for the deck. I try to force quit and it hangs up there too. I did manage to get it to come up once but I noticed in thhe capture settings that the Apple Firewire