Displaying a Smartform as PDF in WDA

Dear All,
I am trying to display a smartform as PDf in the web dynpro application. I am getting the below error while trying to display the smartform.
Note
The following error text was processed in the system DE5 : Function module does not exist
The error occurred on the application server MTW02SDEC01_DE5_00 and in the work process 0 .
The termination type was: ERROR_MESSAGE_STATE
The ABAP call stack was:
Function: FUNCTION_IMPORT_INTERFACE of program SAPLSUNI
Method: DATASOURCE_2_FM_PARAMS of program CL_WD_ADOBE_SERVICES==========CP
Method: CREATE_PDF_DDIC of program CL_WD_ADOBE_SERVICES==========CP
Method: CREATE_PDF of program CL_WD_ADOBE_SERVICES==========CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LADOBE==================CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LADOBE==================CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP
Please let me know does any services needs to be activated in SICF or any other problem?
Thanks,
Mugundhan

Hi Thomas,
Pleasure in receving the reply from you. I had created a node called pdf_data of cardinality 1..1, under which i had created a attribute called SOURCE of type XSTRING. i had used the below code to display the  smart form.
DATA:  node_pdf_data TYPE REF TO if_wd_context_node,
         fm_name       TYPE  rs38l_fnam,
         outop         TYPE ssfcompop,
         cparam        TYPE ssfctrlop,
         tab_otf_data  TYPE ssfcrescl,
         tab_otf_final TYPE TABLE OF itcoo,
         bin_filesize  TYPE i,
         bin_file      TYPE xstring,
         pdf_tab       TYPE TABLE OF tline.
  " Get function module name for smart form
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZMG_SF_TEST'
    IMPORTING
      fm_name            = fm_name
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.
  " Get Report Format With Data From Smart Form
  outop-tdprinter   = 'LP01'.
  outop-tddest      = 'LP01'.
  cparam-no_dialog  = 'X' .
  cparam-preview    = 'X'.
  cparam-getotf     = 'X'.
  CALL FUNCTION fm_name
    EXPORTING
      control_parameters = cparam
      output_options     = outop
      user_settings      = space
    IMPORTING
      job_output_info    = tab_otf_data
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.
  " Get all data of Smartform
  tab_otf_final[] = tab_otf_data-otfdata[].
  " Convert OTF data into PDF data
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = bin_filesize
      bin_file              = bin_file
    TABLES
      otf                   = tab_otf_final
      lines                 = pdf_tab
    EXCEPTIONS
      err_max_linewidth     = 1
      err_format            = 2
      err_conv_not_possible = 3
      err_bad_otf           = 4
      OTHERS                = 5.
  " Set PDF Data to context attribute
  node_pdf_data = wd_context->get_child_node( name = 'PDF_DATA' ).
  CALL METHOD node_pdf_data->set_attribute
    EXPORTING
      value = bin_file
      name  = 'SOURCE'.
  DATA lo_window_manager TYPE REF TO if_wd_window_manager.
  DATA lo_api_component  TYPE REF TO if_wd_component.
  DATA lo_window         TYPE REF TO if_wd_window.
  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).
  lo_window         = lo_window_manager->create_window(
                     window_name            = 'W_PDF'
*                    title                  =
*                    close_in_any_case      = abap_true
                     message_display_mode   = if_wd_window=>co_msg_display_mode_selected
*                    close_button           = abap_true
                     button_kind            = if_wd_window=>co_buttons_ok
                     message_type           = if_wd_window=>co_msg_type_none
                     default_button         = if_wd_window=>co_button_ok
  lo_window->open( ).
The above code works fine.  Finally in the bin_file i am getting the raw data. After that i am getting the below error.
The following error text was processed in the system DE5 : Function module does not exist
The error occurred on the application server MTW02SDEC01_DE5_00 and in the work process 0 .
The termination type was: ERROR_MESSAGE_STATE
The ABAP call stack was:
Function: FUNCTION_IMPORT_INTERFACE of program SAPLSUNI
Method: DATASOURCE_2_FM_PARAMS of program CL_WD_ADOBE_SERVICES==========CP
Method: CREATE_PDF_DDIC of program CL_WD_ADOBE_SERVICES==========CP
Method: CREATE_PDF of program CL_WD_ADOBE_SERVICES==========CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LADOBE==================CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LADOBE==================CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L8STANDARD==============CP
Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/L7STANDARD==============CP

Similar Messages

  • 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

  • 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

  • Smartform as PDF On Button Click

    Hello Everyone,
    I need to display a smartform as PDF on click of a button.
    I have done the conversion using CONVERT_OTF. And then,
    CREATE OBJECT cached_response
    EXPORTING add_c_msg = 1.
    *Start display PDF
          cached_response->set_header_field( name  = 'content-type'
                                      value = 'application/pdf' ).
    some Browsers have caching problems when loading PDF format
          cached_response->set_header_field(
                             name  = 'cache-control'
                             value = 'max-age=0' ).
    start PDF viewer either in the Browser or as a separate window
           cached_response->set_header_field(
                               name  = 'content-disposition'
                               value = 'attachment; filename=form.pdf' ).
    finally display PDF format in Browser
          l_pdf_len = xstrlen( l_pdf_xstring ).
         cached_response->set_data( data   = l_pdf_xstring
                              length = l_pdf_len ).
    DATA: OBJ1 TYPE REF TO CL_BSP_NAVIGATION,
                lr_runtime type ref to cl_bsp_runtime.
    CREATE OBJECT OBJ1
      EXPORTING
        RUNTIME = lr_runtime.
    call method OBJ1->RESPONSE_COMPLETE .
    Is this correct, did I miss anything?
    I get a blank screen when I click on the button.
    I know this was asked many times , checked those posts but no help.
    Looking forward to your input.
    Regards,
    Mohit Joshi

    Mohit,
    did you check the smartform itself?
    is it complete executed?
    can you test it via the FM?
    most of the times when the url shows an empty page is that or the SMARTFORM is not executed correctly or the pdf is not opened automatically.
    KR,
    Micha
    have a look at my coding:
         CALL FUNCTION 'SCMS_FTEXT_TO_BINARY'
           EXPORTING
             input_length    = ls_len
             append_to_table = 'X'
           IMPORTING
             output_length   = ls_len
           TABLES
             ftext_tab       = lt_objcont
             binary_tab      = lt_contents
           EXCEPTIONS
             failed          = 1
             OTHERS          = 2.
         lv_file_size = ls_len.
         lv_contenttype = 'text/plain'.                         "#EC NOTEXT
       ELSE.
         lv_file_size = xwa_len.
         lv_contenttype = 'application/pdf'.                    "#EC NOTEXT
         CONCATENATE ls_guid_str '.pdf' INTO lv_filename.
         lv_file_name = lv_filename.
         server->response->append_data(
                             data   = xwa
                             length = xwa_len ).
         CLEAR lt_contents. REFRESH lt_contents.
       ENDIF.
       CONCATENATE 'inline; filename=' lv_filename
         INTO lv_contentdisposition.
       CALL METHOD server->response->set_header_field
         EXPORTING
           name  = 'content-disposition'
           value = lv_contentdisposition.
       CALL METHOD server->response->set_header_field
         EXPORTING
           name  = 'content-type'
           value = lv_contenttype.
       CALL METHOD server->response->set_header_field
         EXPORTING
           name  = 'content-filename'
           value = lv_filename.
      Content Tabelle (Byte Arrays) rausschreiben
       lv_chunksize = 1022.
       LOOP AT lt_contents INTO ls_contents.
         MOVE ls_contents-line TO xwa.
         xwa_len = lv_file_size - ( lv_chunksize * ( sy-tabix - 1 ) ).
         IF xwa_len >= lv_chunksize.
           xwa_len = lv_chunksize.
         ENDIF.
         server->response->append_data( data   = xwa
                             length = xwa_len ).
       ENDLOOP.
      Response beenden
       server->response->delete_header_field(
                 name = 'Cache-Control' ).                      "#EC NOTEXT
       server->response->delete_header_field(
                 name = 'Expires' ).                            "#EC NOTEXT
    Edited by: Micha Van Nijen on May 3, 2011 12:39 PM

  • Smartform as PDF in Web Dynpro for ABAP

    Hello Experts,
    I have developed one Web Dynpro application in which i am trying to show PDF converting from smart from on button click.
    I am seeing blank screen when i try to display PDF? But when i check i debugging data passed successfully to context element.
    PDF source property mapped to review context element.
    I used below code to show PDF in view method:
    call function 'SSF_FUNCTION_MODULE_NAME'
    call function lv_fm_name
    call function 'SSFCOMP_PDF_PREVIEW'
    call function 'CONVERT_OTF'
    elem_pdf->set_attribute(
       exporting
             name = `SOURCE`
              value = data ).
    Thanks
    Rajesh Yadla

    Looks quite alright, but since you only have provided a few function modules, there is 'no' way of telling what is going wrong. I can however give you a link and compare your coding with the one from the tutorial:
    [How to display a smartform as PDF in WD4A|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785]

  • About Smartform as PDF

    hi, all
      I want to display the smartforms as pdf in web dynpro abap, bu there are error at runtime.
    Source code:
    method DISPLAYFORM .
      data : l_x(1) value 'X'.
      data: lv_text type char3,
      lv_syucomm type char1,
      ls_pdf type xstring,
      lv_fm_name type rs38l_fnam,
      lv_control_parameters type ssfctrlop,
      lv_output_options type ssfcompop,
      lv_ssf_output type ssfcrescl,
      lt_otfdata type TSFOTF.
      data:
      node_input1 type ref to if_wd_context_node,
      elem_input1 type ref to if_wd_context_element,
      stru_input1 type ig_CONTROLLER_FORM=>element_pdf.
    navigate from <CONTEXT> to <INPUT1> via lead selection
      node_input1 = wd_context->get_child_node( name = 'PDF' ).
    get element via lead selection
      elem_input1 = node_input1->get_element( ).
    get all declared attributes
      elem_input1->get_static_attributes( importing static_attributes = stru_input1 ).
      call function 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZFORM_TEST'
        IMPORTING
          fm_name            = lv_fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          others             = 3.
      if sy-subrc <> 0.
    Error MESSAGE
      endif.
    Set relevant control parameters
      lv_control_parameters-getotf = l_x.
      lv_control_parameters-no_dialog = l_x.
      lv_control_parameters-preview = space.
    Set relevant output options
      lv_output_options-tdnewid = l_x.
      lv_output_options-tddelete = space.
      DATA: ls_book TYPE PPFTBOOK.
      call function lv_fm_name
        EXPORTING
          control_parameters = lv_control_parameters
          output_options     = lv_output_options
          user_settings      = space
        IMPORTING
          job_output_info    = lv_ssf_output
        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.
      refresh lt_otfdata.
      lt_otfdata[] = lv_ssf_output-otfdata[].
      call function 'SSFCOMP_PDF_PREVIEW'
        EXPORTING
          i_otf                    = lt_otfdata[]
        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.
    convert otf to pdf
      call function 'CONVERT_OTF'
        EXPORTING
          format                = 'PDF'
        IMPORTING
          bin_filesize          = pdf_size
          bin_file              = pdf_data
        TABLES
          otf                   = lt_otfdata[]
          lines                 = l_dummy
        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.
      data:
      node_pdf type ref to if_wd_context_node,
      elem_pdf type ref to if_wd_context_element,
      stru_pdf type if_CONTROLLER_FORM=>element_pdf ,
      item_source like stru_pdf-source.
    navigate from <CONTEXT> to <PDF> via lead selection
      node_pdf = wd_context->get_child_node( name = 'PDF' ).
    get element via lead selection
      elem_pdf = node_pdf->get_element( ).
    set single attribute
      elem_pdf->set_attribute(
      exporting
      name = 'SOURCE'
      value = pdf_data ).
    endmethod.
    error:
      Runtime Errors         UNCAUGHT_EXCEPTION
    Exception              CX_WD_GENERAL
    Date and Time          2007.07.30 17:24:55
    What happened?
         The exception 'CX_WD_GENERAL' was raised, but it was not caught anywhere along
         the call hierarchy.
         Since exceptions represent error situations and this error was not
         adequately responded to, the running ABAP program
          'CX_WD_GENERAL=================CP' has to be
         terminated.
    Error analysis
         An exception occurred which is explained in detail below.
         The exception, which is assigned to class 'CX_WD_GENERAL', was not caught and
         therefore caused a runtime error.
         The reason for the exception is:
         WebDynpro Exception: Die URL  enthält möglicherweise bösartiges Script
    How to correct the error
        You may able to find an interim solution to the problem
        in the SAP note system. If you have access to the note system yourself,
        please use the following search criteria:
        "CX_WD_GENERAL=================CP" "UNCAUGHT_EXCEPTION"
        If you cannot solve the problem yourself, please send the
        following documents to SAP:
        1. A hard copy print describing the problem.
           To obtain this, select the "Print" function on the current screen.
        2. A suitable hardcopy prinout of the system log.
           To obtain this, call the system log with Transaction SM21
           and select the "Print" function to print out the relevant
           part.
        3. If the programs are your own programs or modified SAP programs,
           supply the source code.
           To do this, you can either use the "PRINT" command in the editor or
           print the programs using the report RSINCL00.
        4. Details regarding the conditions under which the error occurred
           or which actions and input led to the error.
    Message was edited by:
            pei li

    Hello Pei,
    Have you made all the required settings to get the so called "print scenario/pdf display" working in Adobe integration of Web Dynpro ABAP. You can find more information in the online help.
    Best regards,
    Thomas

  • 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.

  • 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

  • In PDF display of smartform in polish langauge - copyright character prob

    hi gurus!
    In PDF display of smartform in polish langauge - copyright character is not displaying properly.its showing # for copyright character. but It displays in english language.
    please need ur help.
    thanks
    SG

    Please note - the duplicate post in General has been deleted  Please only post a question in one forum.
    Thank-you

  • 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.

  • Converting Smartforms to PDF and displaying Smartforms on print preview

    Hi,
    How to convert smartforms to pdf?
    How to attach this pdf to email?
    How to attach this pdf to the email and at the same time can print preview the smartforms?
    Thanks.

    Hi Navi,
    Code Snippet for Simple Mail
    *& Report  ZZ_TEST                                                     *
    REPORT  zz_test                                 .
    INCLUDE zz_test_top.
    INCLUDE zz_test01.
          FORM entry                                                    *
    -->  RETURN_CODE                                                   *
    -->  US_SCREEN                                                     *
    FORM entry USING return_code us_screen.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing USING us_screen.
      CASE retcode.
        WHEN 0.
          return_code = 0.
        WHEN 3.
          return_code = 3.
        WHEN OTHERS.
          return_code = 1.
      ENDCASE.
    ENDFORM.                    "entry
    *&  Include           ZZ_TEST_TOP                                      *
      TABLES : nast,
               tnapr.
    TYPES : BEGIN OF t_SOUDNAMEI1.
            INCLUDE STRUCTURE SOUDNAMEI1.
    TYPES : END OF t_SOUDNAMEI1.
    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,
      i_lips LIKE lips OCCURS 0 WITH HEADER LINE,
      i_SOUDNAMEI1 TYPE STANDARD TABLE OF t_SOUDNAMEI1.
    Work Area declarations
      DATA:w_objhead TYPE soli_tab,
      wa_control_parameters TYPE ssfctrlop,
      wa_output_options 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
      wa_SOUDNAMEI1 TYPE t_SOUDNAMEI1,
    Variables declarations
      w_form_name TYPE rs38l_fnam,
      w_len_in LIKE sood-objlen,
      w_len_out LIKE sood-objlen,
      w_len_outn TYPE i,
      w_lines_txt TYPE i,
      w_lines_bin TYPE i,
      retcode      TYPE sy-subrc,
      xscreen      TYPE c,
      w_spld TYPE usr01-spld,
      w_receiver TYPE SOXNA-FULLNAME,
      w_OBJ_RECORD TYPE OBJ_RECORD,
      w_user type sy-uname,
      w_email TYPE ad_smtpadr.
    Constants Declaration
      CONSTANTS : c_x TYPE c VALUE 'X',
                  c_atrate(1) TYPE c VALUE '@'.
    *&  Include           ZZ_TEST01                                        *
          FORM PROCESSING                                               *
    FORM processing USING proc_screen.
      SELECT * FROM lips
        INTO TABLE i_lips
        WHERE vbeln = nast-objky.
    Call Function module to Getfunction Module name Generated by Smartform
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = tnapr-sform
        IMPORTING
          fm_name            = w_form_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        retcode = sy-subrc.
      ENDIF.
      CLEAR : wa_control_parameters,
              wa_output_options.
      CASE nast-nacha.
        WHEN '1'.
          wa_control_parameters-device    = 'PRINTER'.
        WHEN '7'.
          DATA: l_email TYPE ad_smtpadr.
          wa_output_options-tdnoprev = c_x.
          wa_control_parameters-getotf  = c_x.
    To get the default output device maintained in the
    User profile
         SELECT SINGLE spld FROM usr01
          INTO w_spld
          WHERE bname EQ nast-usnam.
          IF sy-subrc EQ 0.
            MOVE w_spld TO  wa_output_options-tddest   .
          ENDIF.
          wa_output_options-tdnoprev = c_x.
          wa_control_parameters-getotf  = c_x.
    To get the email address maintained for the particular output
          CALL FUNCTION 'NAST_GET_MESSAGE_OBJECT_RECV'
            EXPORTING
              pi_objkey             = nast-tdname
            IMPORTING
              pe_addr               = w_receiver
            CHANGING
              pc_objhandle          = w_obj_record
            EXCEPTIONS
              maildata_not_readable = 1
              OTHERS                = 2.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          IF w_receiver NA c_atrate.
    To retrieve the E-Mail Id in case we get the User name from NAST
            CLEAR wa_soudnamei1.
            REFRESH i_soudnamei1.
            MOVE w_receiver TO wa_soudnamei1-fullname.
    To get the user name
            CALL FUNCTION 'SO_NAME_CONVERT_API1'
              EXPORTING
                name            = wa_soudnamei1
              TABLES
                names           = i_soudnamei1
              EXCEPTIONS
                user_not_exist  = 1
                parameter_error = 2
                x_error         = 3
                OTHERS          = 4.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            CLEAR wa_soudnamei1.
            READ TABLE i_soudnamei1 INTO wa_soudnamei1 INDEX 1.
            MOVE wa_soudnamei1-sapname TO w_user.
    To get the e-mail Id maintained in the user profile
            CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'
              EXPORTING
                i_user              = w_user
              IMPORTING
                e_email_address     = l_email
              EXCEPTIONS
                mail_address        = 1
                determination_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.
            MOVE l_email TO w_receiver.
          ENDIF.
          MOVE  w_receiver TO w_email.
      ENDCASE.
      wa_control_parameters-no_dialog = c_x.
      wa_control_parameters-langu     = nast-spras .
      wa_output_options-tdteleland    = nast-tland.
      wa_output_options-tdtelenum     = nast-telfx .
      wa_output_options-tdsenddate    = nast-erdat .
      wa_output_options-tdsendtime    = nast-eruhr .
      wa_output_options-tddataset     = nast-dsnam .
      wa_output_options-tdsuffix1     = nast-dsuf1 .
      wa_output_options-tdsuffix2     = nast-dsuf2 .
      wa_output_options-tdimmed       = nast-dimme .
      wa_output_options-tddelete      = nast-delet .
      wa_output_options-tdautority    = nast-tdautority.
      wa_output_options-tdcovtitle    = nast-tdcovtitle .
      wa_output_options-tdcover       = nast-tdocover .
      wa_output_options-tdreceiver    = nast-tdreceiver.
      wa_output_options-tddivision    = nast-tddivision.
      wa_output_options-tdcopies      = nast-anzal .
      wa_output_options-tdnewid       = c_x.
      wa_output_options-tdarmod       = nast-tdarmod.
      wa_output_options-tdnoarmch     = c_x.
      CALL FUNCTION w_form_name
        EXPORTING
         archive_index      = toa_dara
         archive_parameters = arc_params
          control_parameters = wa_control_parameters
          output_options     = wa_output_options
          user_settings      = ' '
        IMPORTING
          job_output_info    = w_return
        TABLES
          it_lips            = i_lips
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      IF nast-nacha EQ 7 AND sy-subrc EQ 0.
        i_otf[] = w_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = w_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 w_lines_bin.
    Document information.
        w_doc_chng-obj_name = 'Smartform'.
        w_doc_chng-expiry_dat = sy-datum + 10.
        CONCATENATE 'Delivery' 'Note'
        INTO w_doc_chng-obj_descr.
    *w_doc_chng-obj_descr = 'Smart form output'.
        w_doc_chng-sensitivty = 'F'. "Functional object
        w_doc_chng-doc_size = w_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 = w_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 = w_lines_bin.
        i_objpack-doc_type = 'PDF'.
        i_objpack-obj_name = 'Smartform'.
        CONCATENATE 'Delivery' 'Note' '.pdf'
        INTO i_objpack-obj_descr.
        i_objpack-doc_size = w_lines_bin * 255.
        APPEND i_objpack.
    Document information.
        CLEAR i_reclist.
    e-mail receivers.
        i_reclist-receiver = w_email.
        i_reclist-express = 'X'.
        i_reclist-rec_type = 'U'. "Internet address
        APPEND i_reclist.
    sending mail.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = w_doc_chng
            put_in_outbox              = 'X'
          TABLES
            packing_list               = i_objpack
            object_header              = w_objhead
            contents_bin               = i_objbin
       contents_txt               = i_objtxt
            receivers                  = i_reclist
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDFORM.                    "processing
    OTF to PDF
    ========================================================================
    Program1
    *& REPORT  zpmm_print1
    REPORT  zpmm_print1.
    DATA : gw_ssfcrescl TYPE ssfcrescl.
    DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
          gt_tline TYPE STANDARD TABLE OF tline,
          gv_len LIKE sood-objlen,
          gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
          gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
    DATA  fm_name TYPE rs38l_fnam.
    gw_ssfctrlop-getotf = 'X'.
    gw_ssfctrlop-no_dialog = 'X'.
    gw_ssfcompop-tdnoprev = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = 'ZPMM_1'
      IMPORTING
        fm_name            = fm_name
      EXCEPTIONS
        no_form            = 1
        no_function_module = 2
        OTHERS             = 3.
    IF sy-subrc <> 0.
    <error handling>
    ENDIF.
    CALL FUNCTION fm_name
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       control_parameters         = gw_ssfctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       output_options             = gw_ssfcompop
       user_settings              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = gw_ssfcrescl
      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.
    gt_otf[] = gw_ssfcrescl-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = gv_len
      TABLES
        otf                   = gt_otf
        lines                 = gt_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.
    DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        bin_filesize     = gv_len
        filename         = gv_filename
        filetype         = 'BIN'
        filetype_no_show = 'X'
      IMPORTING
        act_filename     = gv_filename
        filesize         = gv_len
       cancel           = ''
      TABLES
        data_tab         = gt_tline.
    Program 2
    *& REPORT  zpmm_print2
    REPORT  zpmm_print2.
    DATA : gw_ssfcrescl TYPE ssfcrescl.
    DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
          gt_tline TYPE STANDARD TABLE OF tline,
          gv_len LIKE sood-objlen,
          gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
          gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
    DATA  fm_name TYPE rs38l_fnam.
    gw_ssfctrlop-getotf = 'X'.
    gw_ssfctrlop-no_dialog = 'X'.
    gw_ssfcompop-tdnoprev = 'X'.
    CALL FUNCTION '/1BCDWB/SF00000041'
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       control_parameters         = gw_ssfctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       output_options             = gw_ssfcompop
       user_settings              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = gw_ssfcrescl
      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.
    gt_otf[] = gw_ssfcrescl-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = gv_len
      TABLES
        otf                   = gt_otf
        lines                 = gt_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.
    DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        bin_filesize     = gv_len
        filename         = gv_filename
        filetype         = 'BIN'
        filetype_no_show = 'X'
      IMPORTING
        act_filename     = gv_filename
        filesize         = gv_len
       cancel           = ''
      TABLES
        data_tab         = gt_tline.
    =========================================================================
    Cheers
    Mohinder Singh Chauhan

  • Barcodes are not getting Displayed in Smartforms.

    HI
    In Previous Month barcode was getting displayed in smartforms  print Preview. And PDF form is generated successfully. I am not using standard form this is custom.
    In Previous month, Service pack SAPKA70023 ABA Support Package 23 & 22 for 7.00 were applied, After that Barcode is not getting displayed for current month. I identified that Barcode Name is not mentioned in smartstyles.
    Ther is no transport Request Moved from last one year.
    Can any one suggest me there will be any impact on barcodes after service packs
    Thanks
    Ravi

    Hello,
    have created some new users and done with the leave request, it comes to backend inbox, but not
    visible in portal. Re-configured UWL, but still the task not coming( leave request). For other users it is > coming?
    Where have you created these users? Many times it is not enough to create new users in a backend system. You will have to create them in the data source which is used by the UME of your portal or to map this data source with the system where you have created your new users
    You can see what data source your portal is using by going to
    Portal --> System Administration --> System Configuration --> UME Configuration --> Data Source
    If this Data Source doesn´t contain your new users, then UWL wouldn´t be able to show their items.
    Here you can check if your user is contained in the data source:
    Portal --> User Administration --> choose the right data source --> put in the username --> search
    Please check if your users are correctly created.
    Regards,
    Iris

  • 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

  • How to display the smartform of a purchase order from EBP (its) into a BSP

    Hello,
    I'm trying to make a bsp which lists the purchase orders (PO) for a user, that is not a problem.
    But I would like to open the smartform of a PO like in EBP (SRM) into my BSP.
    In EBP with the ITS i use this function :
    BBP_OUTPUT_PO_PREVIEW_SMART
    I give in input of this function the GUID (number) of my PO and the name of smartform to use with.
    I would like to reproduce this functionality in a BSP like on the ITS.
    Can someone help me ?
    Thanks a lot !
    Francois

    Indeed with the example of the bsp sf_webform_04 i can display my smartform !
    I have two choices : HTML or PDF.
    You only have to choose OTF for PDF or XSF for HTML !
    Thanks a lot !
    Francois
    Message was edited by: Francois Lavoissiere

  • 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

Maybe you are looking for

  • Bal field "Profit Center" in line item 001 not filled at the time of F-53

    We are in ECC6 I have posted a vendor document.  The entry is shown as under.      GL                           CC     PC     Segment Dr     Expense GL-1     RV01     RGV1     Hyderabad Dr     Expense GL-2     RV02     RGV2     Mumbai Cr     Vednor a

  • Sheduling Agreement for import

    Hi, Here i want to configure sheduling agreement for import vendors.I follow the steps ME31L - ME38 - MIGO .Is there necessity of inforecord or source list in this Scenario.And pricing condition as per pricing procedure is not picked up while making

  • Fallo en la actualización photoshop CC 2014

    Hola, me he bajado desde el Creative Cloud el photoshop 2014 (hasta ayer el photoshop que tenía funcionaba perfectamente), pero inmediatamente que este se abre, se cierra solo. Tengo Windows 8 64Bits He visto que el mismo problema sale en ese hilo: P

  • Higher quality mp3?

    Is there anyway to get a higher quality mp3 than 128 when buying from the ITunes Music Store? I've set my software to convert at 190, but it doesn't do it on things i buy? reply to [email protected] Thanx

  • Playlist Shuffle When Burning

    When burning Playlists to disc, the songs are being shuffled, reordered by iTunes.  If there is a way around this problem please let me know.  I'm running 64-bit Vista.