Download Smartform as PDF in background to App. Server

Hi experts,
we would like to create in background a smartform and convert its OTF stream to PDF. The challenge is now to
download the PDF file to the App. Server or to the BDS.
Our problem is, that the PDF data content doesn't fit to any known methods or function modules for downloading.
Short example what we have so far:
*create form
CALL FUNCTION l_function_module_name
         EXPORTING
              control_parameters = ls_output_control
              output_options     = ls_output_options
              user_settings      = ' '
         IMPORTING
              job_output_info    = ls_output_info
         TABLES
              form_data          = lt_sf_table
         EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 4
              OTHERS             = 5.
*convert to PDF
CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
            format                = 'PDF'
       IMPORTING
            bin_filesize          = l_filesize
       TABLES
            otf                   = ls_output_info-otfdata
            lines                 = lt_pdf_lines
       EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
Problem: lt_pdf_lines does not have the right format e.g. using download to BDS:
CL_BDS_DOCUMENT_SET=>CREATE_WITH_TABLE requires a linetype RAW 1022
I am sure anybody of you has already downloaded a PDF in background to the BDS or application server and could give me a hint.
Please note, we are in backgroung and GUI_DOWNLOAD will not help.
Regards
Tom

Please go through this link , hope you will get some useful stuff from this.
http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450
*& Form f9100_save_to_pdf
text
-->P_WS_FORMNAME text
FORM f9100_save_to_pdf using value(ws_formname).
data: i_lines TYPE tline OCCURS 0 WITH HEADER LINE.
data: ws_bin_size type i,
ws_filename type string.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = ws_bin_size
TABLES
otf = i_otf
lines = i_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc <> 0.
flg_exit = 'X'.
MESSAGE i050 WITH 'Error converting to PDF format'.
EXIT.
ENDIF.
Get the download path
PERFORM get_download_path CHANGING ws_filename.
if flg_exit = 'X'.
EXIT.
endif.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = ws_bin_size
filename = ws_filename
filetype = 'BIN'
TABLES
data_tab = i_lines
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 i050 WITH 'Error while File download'.
flg_exit = 'X'.
EXIT.
ELSE.
MESSAGE i050 WITH 'File downloaded successfully '.
flg_exit = 'X'.
EXIT.
ENDIF.
Regards,
Prakash.

Similar Messages

  • Downloading Smartform in PDF

    While downloading smartform into PDF the character formatting such as "BOLD, UNERLINE,ITALIC" are not reflecting in the PDF document.
    The following function modules are used for downloading:
    1)'CONVERT_OTF'
    2)'GUI_DOWNLOAD'
    The printer used is 'LOCL' (Local Windows Printer).

    hi friend,
    plz Check if the smartstyle for the  respective smartform is transported or not.
    Regards,
    K.S.Kannan

  • Emdedding a pdf file generated on app server in a peoplesoft page

    All,
    I have a requirement to embed a pdf file on the app server in a peoplesoft page.
    I am planning to do a push the file to the webserver using put attachment and then add a reference to the image in an html area on the page.
    However, I need to position the pdf document when the page is displayed as the html area is smaller than the pdf document such that the middle part of the document is shown to the user. This is required so that the user does not have to sroll to that position.
    Is there a way to do this ?

    What is the PeopleTools version and application version you are using.
    Jayaprakash Tedla

  • Download smartform to pdf

    in script it is possible to download in pdf format without new spool
    request.is it possible in smartforms if possible please help..

    Go through the link given below :
    SMARTFORM to PDF File format
    Smartform to PDF format

  • Downloading smartform as pdf (protecting)

    Hi,
       I have downloaded smartform contents into a pdf file.
    Is there any way to protect the document like setting a password for the document.
    That is,i have downloaded that pdf.while opening it must want to ask a password before opening.Is it possible via SAP.
    Anybody plz help me

    Hi Ramya
    Refer this link
    Re: Smartform in pdf format.
    Thanks,
    Syf

  • Printing Word documents to PDF from Office Web Apps Server 2013 yields inaccessible PDF files

    I have Office Web Apps Server 2013 SP1 with March 2015 CU applied. The version shows up as "15.0.4569.1506" using Todd Klindt's
    method. When anonymous users view the Word documents online through the Office Web Apps, they have an option to print them to PDF. The PDF file that gets generated as a result isn't accessible
    (i.e. it isn't WCAG-compliant). using Adobe Acrobat Pro to check it I can see that it is missing tags, for example. The source Word document was made fully accessible from the point of view of Microsoft Office accessibility tools.
    When viewing the same document in Word Online in Office 365, I get an extra option  "Download as PDF". The PDF document produced is accessible. If I save a Word 2013 document as a PDF from within the Word editor, it also generates accessible
    PDF.
    I was wondering if the reason for the accessibility problem that I have misconfigured my on-premises Office Web Apps,  or perhaps the accessibility compliance isn't built in yet. If the latter is true, I was wondering if someone could indicate whether
    or not this is on the list of upcoming CUs.
    thanks in advance. 

    Just check my WAC install, no this is likely an Office online only feature, at least at this point in time.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Apex 3.2.1. Reports - PDF printing using Oracle App Server 10.1.2.3

    The documentation I can find re. Apache FOP references App Server 10.1.3.2, can I configure on 10.1.2.3 - Is there any docs on how?

    Did you solve this problem? I'm curious, as I am in the same situation.
    regards.

  • Problem in downloading smartform as pdf file...

    Hi SDNs.,
    while downloading the invoice layout as .PDF file.. i am getting following error...
    <b>OTF end command // missing in OTF data</b>
    and the file is downloading as empty size... ( xyz.pdf with 0kb )
    It is working fine in sandbox... i am getting this error in production...
    what could be the probelm? when this type of error occurs?

    hi raghu.,
    CALL FUNCTION LF_FM_NAME
            EXPORTING
              ARCHIVE_INDEX      = TOA_DARA
              ARCHIVE_PARAMETERS = ARC_PARAMS
              CONTROL_PARAMETERS = W_CTRLOP
              MAIL_RECIPIENT     = LS_RECIPIENT
              MAIL_SENDER        = LS_SENDER
              OUTPUT_OPTIONS     = LS_COMPOSER_PARAM
              USER_SETTINGS      = 'X'
              IS_BIL_INVOICE     = LS_BIL_INVOICE
              IS_NAST            = NAST
              IS_REPEAT          = REPEAT
              OUT_TYPE           = V_OUTPUT
              TEMP_LST           = TEMP_LST
              TEMP_CST           = TEMP_CST
              TEMP_TELF1         = TEMP_TELF1
              TEMP_TELFX         = TEMP_TELFX
              TEMP_NAME1         = TEMP_NAME1
              TEMP_STRAS         = TEMP_STRAS
              TEMP_ADRNR         = TEMP_ADRNR
              TMP_VAT            = TMP_LST
              TMP_CST            = TMP_CST
              TEMP_WERKS         = TEMP_WERKS
              VAT_DATE           = VAT_DATE
              CST_DATE           = CST_DATE
              VAT                = VAT
              I_ADDRESS          = I_ADDRESS
              FLAG_HDR           = FLAG_HDR
              I_ADDR             = I_ADDR
              TMP_CST_DATE       = TMP_CST_DATE                 " mod-004
              TMP_LST_DATE       = TMP_LST_DATE                 " mod-004
            IMPORTING
              JOB_OUTPUT_INFO    = W_RETURN
            TABLES
              IT_KONV            = TEMP_KONV
              IT_VBRP            = IT_VBRP_FORM
            EXCEPTIONS
              FORMATTING_ERROR   = 1
              INTERNAL_ERROR     = 2
              SEND_ERROR         = 3
              USER_CANCELED      = 4
              OTHERS             = 5.
          IF SY-SUBRC <> 0.
      error handling
            CF_RETCODE = SY-SUBRC.
            PERFORM PROTOCOL_UPDATE.
    get SmartForm protocoll and store it in the NAST protocoll
            PERFORM ADD_SMFRM_PROT.
          ENDIF.
        ENDDO.
        LS_COMPOSER_PARAM-TDCOPIES = NAST_ANZAL.
        IF NOT NAST_TDARMOD IS INITIAL.
          NAST-TDARMOD = NAST_TDARMOD.
          CLEAR NAST_TDARMOD.
        ENDIF.
      ENDIF.
    ************************add for pdf**********************************
      I_OTF[] = W_RETURN-OTFDATA[].
      DATA : ITAB2 LIKE DOCS OCCURS 0,
              SIZE TYPE I.
      BIL_NUM = LS_BIL_INVOICE-HD_GEN-BIL_NUMBER.
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
       EXPORTING
         USE_OTF_MC_CMD               = 'X'
      ARCHIVE_INDEX                =
       IMPORTING
         BIN_FILESIZE                  = SIZE
        TABLES
          OTF                          = I_OTF
          DOCTAB_ARCHIVE               = ITAB2
          LINES                        = I_TLINE
       EXCEPTIONS
         ERR_CONV_NOT_POSSIBLE        = 1
         ERR_OTF_MC_NOENDMARKER       = 2
         OTHERS                       = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ****************download************************
      CONCATENATE 'C:\' BIL_NUM '.PDF' INTO FILENAME.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          FILENAME                        = FILENAME
          FILETYPE                        = 'BIN'
    IMPORTING
      FILELENGTH                      =
        TABLES
          DATA_TAB                        = I_TLINE
      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.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      IF SY-SUBRC = 0.
      message  i000.
      ENDIF.
    is this enough????
    Thanking you..,

  • Download smartform as PDF, suppress Print/Preview dialog

    Hi Experts,
    Facing some issues in downloading PDF converted from Smartform.
    In the program I am trying directly download a smartform converted into PDF format and save it in local system.
    When ever I am trying to execute the program it shows up the Print/Preview dialog before showing the Save As dialog.
    I have passed control_parameters-getotf = 'X' to the smartform runtime FM, which ideally should have suppressed the Print/Preview dialog and return the otfdata.
    Here the entire code is...
    Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
    The program other wise works absolutly fine .
    Please advise.
    Thanks
    Jahan
    Edited by: Rob Burbank on Apr 8, 2010 11:10 AM

    Helloo Guyz...
    I am exactly trying the same, but the Print Dialog is still coming ...
    See here is my code ..
    cont_param-getotf = 'X'.
    cont_param-no_dialog = 'X'.
    cont_param-preview = 'X' .
      CALL FUNCTION fm_name
        EXPORTING
          control_parameters = cont_param
        IMPORTING
          job_output_info  = otfdata
        TABLES
          s_bukrs             = s_bukrs[]
          s_gjahr              = s_gjahr[]
          s_rebzg             = s_rebzg[]
          s_kunnr             = s_kunnr[]
        EXCEPTIONS
          formatting_error  = 1
          internal_error      = 2
          send_error          = 3
          user_canceled    = 4
          OTHERS              = 5.
    even after this ..during execution the the Print Dialog is coming..
    I have no idea what esle I am missing..
    Thanks

  • ALV out put to be downloaded in Background to apps server

    Hello All,
    I want to download ALV output to APPL Server in TAB delimited format.
    I am able to get the internal table values usinf open record set and transfering.
    But the real issue is they are having diffrent layouts and according to layout i need to down the file.
    Is it possible ? if please suggest.
    Rgds,
    O

    Hi,
    I have an old code that I have wrote to transform ALV in HTML in background to send the result by email. Maybe that could help you (don't be rude, it's one of my first ALV program ).
    The comments are in french, but, you could understand.
    I hope that could help you
    Rgd
    Frédéric
    * Complete.
      call function 'LVC_FIELDCATALOG_MERGE'
           exporting
                i_structure_name   = 'ZGRE000_S2'
                i_bypassing_buffer = ' '
                i_buffer_active    = ' '
           changing
                ct_fieldcat      = itab_fieldcatalog.
      call function 'LVC_FIELDCAT_COMPLETE'
        EXPORTING
    *     I_COMPLETE             =
          IS_LAYOUT              = v_es_layout
          I_REFRESH_BUFFER       = ''
          I_BUFFER_ACTIVE        = ''
    *   IMPORTING
    *     E_EDIT                 =
        changing
          ct_fieldcat            = itab_fieldcatalog.
      call function 'LVC_SORT_COMPLETE'
        exporting
          it_fieldcat       = itab_fieldcatalog
        changing
          ct_sort           = itab_mt_sort.
      call function 'ALV_DATA_EXPORT'
        exporting
          i_report                = ''
          IT_FIELDCAT             = itab_fieldcatalog
        tables
          it_data                 = itab_zgre000_s2.
    * Recherche de la variante d'affichage.
      move : sy-repid to struct_variant-report ,
             sy-uname to struct_variant-username ,
             '2'      to struct_variant-handle.
      if p_vgrid ne space.
        move p_vgrid to struct_variant-variant.
      endif.
    * Ne pas demander d'explication, merci :)
      get reference of itab_zgre000_s2 into mt_outtab.
    * Créé l'objet variant.
      create object m_cl_variant
             exporting
               it_outtab             = mt_outtab
               it_fieldcatalog       = itab_fieldcatalog
               it_sort               = itab_mt_sort
               it_filter             = itab_mt_filter
               is_variant            = struct_variant
               is_layout             = v_es_layout
               i_variant_save        = v_e_var_save
               i_variant_default     = v_e_var_def.
      move : 'A' to v_e_var_save ,
             'X' to v_e_var_def .
      call method m_cl_variant->set_values
           exporting it_outtab             = mt_outtab
                     it_fieldcatalog       = itab_fieldcatalog
                     it_sort               = itab_mt_sort
                     it_filter             = itab_mt_filter
                     is_variant            = struct_variant
                     is_layout             = v_es_layout
                     i_variant_save        = v_e_var_save
                     i_variant_default     = v_e_var_def.
       loop at itab_fieldcatalog into tmp_fieldcatalog
            where tabname ne space.
         exit.
       endloop.
    * Recherche de la variante.
      call method m_cl_variant->load_variant
           exporting i_tabname          = tmp_fieldcatalog-tabname
                     i_bypassing_buffer = 'X'
                    i_dialog           = space.
      create data  mt_ct00 like itab_zgre000_s2.
      create data  mt_ct01 like itab_zgre000_s2.
      create data  mt_ct02 like itab_zgre000_s2.
      create data  mt_ct03 like itab_zgre000_s2.
      create data  mt_ct04 like itab_zgre000_s2.
      create data  mt_ct05 like itab_zgre000_s2.
      create data  mt_ct06 like itab_zgre000_s2.
      create data  mt_ct07 like itab_zgre000_s2.
      create data  mt_ct08 like itab_zgre000_s2.
      create data  mt_ct09 like itab_zgre000_s2.
      assign mt_ct00->* to <lt_ct00>.
      assign mt_ct01->* to <lt_ct01>.
      assign mt_ct02->* to <lt_ct02>.
      assign mt_ct03->* to <lt_ct03>.
      assign mt_ct04->* to <lt_ct04>.
      assign mt_ct05->* to <lt_ct05>.
      assign mt_ct06->* to <lt_ct06>.
      assign mt_ct07->* to <lt_ct07>.
      assign mt_ct08->* to <lt_ct08>.
      assign mt_ct09->* to <lt_ct09>.
    * Recherche des valeurs à partir de la variante sélectionnée.
      call method m_cl_variant->get_values
           importing es_variant     = struct_variant
             et_fieldcatalog        = itab_fieldcatalog
             et_sort                = itab_mt_sort
             et_filter              = itab_mt_filter
             es_layout              = v_es_layout
             et_grouplevels_filter  = mt_grouplevels_filter
             e_variant_save         = v_e_var_save
             e_variant_default      = v_e_var_def.
      call function 'LVC_SORT_APPLY'
        exporting
          it_sort         = itab_mt_sort
    *     I_AS_TEXT       = 'X'
    *     I_STABLE        = 'X'
        tables
          ct_data         = itab_zgre000_s2.
      call function 'LVC_TRANSFER_TO_KKBLO'
        exporting
          it_sort_lvc                     = itab_mt_sort
          it_grouplevels_lvc              = mt_grouplevels_filter
        importing
          et_sort_kkblo                   = itab_lt_sort
          et_grouplevels_kkblo            = itab_lt_grouplevels
        exceptions
          it_data_missing                 = 1
          it_fieldcat_lvc_missing         = 2
          others                          = 3.
      call function 'ALV_GROUPLEVELS_GET'
        exporting
          i_subtotals_only          = 'X'
          it_sort                   = itab_lt_sort
          i_subtract_counter        = 'X'
        importing
          et_groups                 = itab_lt_grouplevels
        tables
          t_outtab                  = itab_zgre000_s2.
      call function 'LVC_TRANSFER_FROM_KKBLO'
        exporting
          it_grouplevels_kkblo            = itab_lt_grouplevels
        importing
          et_grouplevels_lvc              = mt_grouplevels_filter
        exceptions
          it_data_missing                 = 1
          others                          = 2.
    * Recupération des totaux.
      call function 'LVC_TOTALS_GET'
        exporting
          it_sort                  = itab_mt_sort
          is_layout                = v_es_layout
          it_filter_index          = itab_mt_filter_i
        tables
          it_data                  = itab_zgre000_s2
          et_collect00             = <lt_ct00>
          et_collect01             = <lt_ct01>
          et_collect02             = <lt_ct02>
          et_collect03             = <lt_ct03>
          et_collect04             = <lt_ct04>
          et_collect05             = <lt_ct05>
          et_collect06             = <lt_ct06>
          et_collect07             = <lt_ct07>
          et_collect08             = <lt_ct08>
          et_collect09             = <lt_ct09>
        changing
          cs_total_options         = ms_total_options
    *      ct_fieldcat              = mt_fieldcatalog
          ct_fieldcat              = itab_fieldcatalog
          ct_grouplevels           = mt_grouplevels_filter
          c_calculate_totals       = m_calculate_totals
          c_sumlevel               = m_sumlevel .
    * Converti dans un language comprehensible par SAP.
      call function 'LVC_TABLE_FOR_DISPLAY'
        exporting
          it_fieldcat                    = itab_fieldcatalog
          it_sort                        = itab_mt_sort
          it_filter                      = itab_mt_filter
          is_total_options               = ms_total_options
          is_layout                      = v_es_layout
        importing
          et_lvc_data                    = itab_mt_data
          et_lvc_info                    = itab_mt_info
        tables
          it_data                        = itab_zgre000_s2
          it_collect00                   = <lt_ct00>
          it_collect01                   = <lt_ct01>
          it_collect02                   = <lt_ct02>
          it_collect03                   = <lt_ct03>
          it_collect04                   = <lt_ct04>
          it_collect05                   = <lt_ct05>
          it_collect06                   = <lt_ct06>
          it_collect07                   = <lt_ct07>
          it_collect08                   = <lt_ct08>
          it_collect09                   = <lt_ct09>
        changing
          ct_grouplevels                 = mt_grouplevels_filter
        exceptions
          fieldcat_not_complete          = 1
          others                         = 2.
      if sy-subrc ne space.
        write : /1 'Probleme de convertion.'.
        stop.
      endif.
    * Convertie en HTML.
      call function 'LVC_ALV_CONVERT_TO_HTML'
        exporting
          it_data                       = itab_mt_data
          it_info                       = itab_mt_info
          i_file_dialog                 = ' '
        importing
          et_html                       = itab_html.

  • Download PDF file from APP server!

    Hi!
    Has anyone tried uplaoding and downloding a PDF table from app server as I tried from a normal method by Open dataset, Transfer but it wont work.
    Please provide any inputs.
    Thanks.

    Hi park,
    1. Using open data set, transfer , close etc,
       also it will work.
       ( it will download / upload any kind of file from app server)
    2. Just make sure the
       FULL PATHNAME and the FILENAME
       are mentioned in EXACT CASE
      (small/CAPITAL).
    3. U can check thru transaction AL11, to see the file and path.
    regards,
    amit m.

  • Problem in converting smartform to PDF

    Hi Experts,
    I am facing the issue while converting the smartform to pdf form with the help of FM convert_otf_2_pdf .
    Problem is that
    CH3OH4OD7     3 , 4 and 7 are the subscipts in SMARTFORM like in a chemical formula ,but after conveting to PDF # is replacing the subscripts like CH#OH#OD# .
    Kindly help in this issue.
    Thanks
    Sachin
    Edited by: Rob Burbank on Feb 6, 2012 10:13 AM

    Try this example it will be help full
    REPORT  YSAMPLE5.
    DATA:
    w_form_name TYPE tdsfname VALUE 'YSAMPLE2',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    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
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
                                                        " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    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_otf_from_fm-otfdata[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    IMPORTING
    BIN_FILESIZE = W_bin_filesize
    BIN_FILE =
    TABLES
    otf = T_OTF
    lines = T_pdf_tab
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    ERR_BAD_OTF = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    tables
    data_tab = T_pdf_tab
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Converting Smartform into pdf in encrypted format

    Hi All,
    I have a requirement to download smartform into pdf format. I have done this,but this pdf is editable with pdf editor tool.
    is there any way to encrypt pdf data and downloading it? I find some FM's in forum but those are used to encrypt and decrypt the passwords etc....
    Thanks in advance..
    Anji

    Hi
    SMART form to PDF
    https://wiki.sdn.sap.com/wiki/display/Snippets/ConvertSmartformtoPDFformat
    smartform to MAIL
    https://wiki.sdn.sap.com/wiki/display/Snippets/SmartformtoMailasPDF+attachment

  • Smartform as PDF attachment

    Hi Friends,
    I have created a Smartform for PO driver program its working fine but my requirement is i want to mail this SF as PDF attachment and they have given me Partner function as "MP'
    for mail Partner and "MA" ,medium 7 ( Simple mail).  Can any one suggest me ,
    its urgent.
    Regards,
    DVNS

    hi,
    REPORT ztest.
    Variable declarations
    DATA:
    w_form_name TYPE tdsfname VALUE 'ZTEST',
    w_fmodule TYPE rs38l_fnam,
    w_cparam TYPE ssfctrlop,
    w_outoptions TYPE ssfcompop,
    W_bin_filesize TYPE i, " Binary File Size
    w_FILE_NAME type string,
    w_File_path type string,
    w_FULL_PATH type string.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    t_otf_from_fm TYPE ssfcrescl,
    Internal table to hold the data from the FM CONVERT_OTF
    T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = w_form_name
    VARIANT = ' '
    DIRECT_CALL = ' '
    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
    format of the output
    w_cparam-no_dialog = 'X'.
    w_cparam-preview = space. " Suppressing the dialog box
    " for print preview
    w_cparam-getotf = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    w_outoptions-tddest = 'LP01'.
    CALL FUNCTION w_fmodule
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = w_cparam
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    output_options = w_outoptions
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    job_output_info = t_otf_from_fm
    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_otf_from_fm-otfdata[.
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    FORMAT = 'PDF'
    MAX_LINEWIDTH = 132
    ARCHIVE_INDEX = ' '
    COPYNUMBER = 0
    ASCII_BIDI_VIS2LOG = ' '
    PDF_DELETE_OTFTAB = ' '
    IMPORTING
    BIN_FILESIZE = W_bin_filesize
    BIN_FILE =
    TABLES
    otf = T_OTF
    lines = T_pdf_tab
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    ERR_BAD_OTF = 4
    OTHERS = 5
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    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.

  • Smartform in PDF - Font Issue

    Hi All,
    I created a smartform and got the PDF output of the same
    using the function module FOPC_REPORT_SHOW_PDF.
    I created a smartstyle using Arial Font (REgular, Size 12)
    and I have used this smartstyle in the smartform.
    When I displayed the smartform in OTF format I am able to see the exact font maintained in the smartstyle. But when the smartform is converted to PDF; the PDF o/p always displays the default font which is Courier/12.
    Can anyone help me in resolving the issue.
    <u>Additional Info</u>
    I got the device type (PDF1) using the function module SSF_GET_DEVICE_TYPE and used the device type in the smartform display. When checked in Se73 this device type supports the Arial Font; but this font in SE73 is marked by a yellow line.
    Regards,
    Mathi

    Hi,
    You can try this as alternative.
    SmartForms Output to PDF
    There is a way to download smartform in PDF format.
    Please do the following:
    1. Print the smartform to the spool.
    2. Note the spool number.
    3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the
    noted spool number.
    feel free to revert back.
    --Ragu

Maybe you are looking for