Smart form print preview in PDF format

Hi ABAP Experts,
I have 2 requirements
1) I want to print preview of a smartform in pdf format
2) I also want to attach a local pdf file to the smartform which is displaying in the pdf print preview format
or to rephrase:
I want a pdf attached to a smartform which i want to open in the pdf print preview format.
Regards,
Niloufer

Use following function modules:
Please see the below code to download a PDF file on to your computer.
PERFORM F_CONVERT_OTF.
FORM F_CONVERT_OTF .
PERFORM F_CALL_SMARTFORM. " Call the smartform to get data in I_OTF_FINAL
**appending the otf data into the final table & save the pdf file.
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      FORMAT                = C_PDF_U      "Value is 'PDF'
    IMPORTING
      BIN_FILESIZE          = L_BIN_FILESIZE         "L_BIN_FILESIZE TYPE I,
    TABLES
      OTF                   = I_OTF_FINAL
      LINES                 = I_PDF_TAB    "It is of type TLINE
    EXCEPTIONS
      ERR_MAX_LINEWIDTH     = 1
      ERR_FORMAT            = 2
      ERR_CONV_NOT_POSSIBLE = 3
      ERR_BAD_OTF           = 4
      OTHERS                = 5.
* Check if the file is already existing.
  CALL FUNCTION 'TMP_GUI_GET_FILE_EXIST'
    EXPORTING
      FNAME                = L_FILE1   " Path where file is saved
   IMPORTING
     EXIST                = L_RESULT
*   ISDIR                =
*   FILESIZE             =
   EXCEPTIONS
     FILEINFO_ERROR       = 1
     OTHERS               = 2
PERFORM F_GUI_DOWNLOAD USING L_FILE.
ENDFORM.
FORM F_GUI_DOWNLOAD  USING P_FILE TYPE STRING.
CONSTANTS: C_BIN(10)       TYPE C VALUE 'BIN'.
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME                = P_FILE     "same as L_FILE
      FILETYPE                = C_BIN
      CONFIRM_OVERWRITE       = C_X   "value 'X'
    TABLES
      DATA_TAB                = I_PDF_TAB
    EXCEPTIONS
      FILE_WRITE_ERROR        = 1
      NO_BATCH                = 2
      GUI_REFUSE_FILETRANSFER = 3
      INVALID_TYPE            = 4
      NO_AUTHORITY            = 5
      UNKNOWN_ERROR           = 6
      HEADER_NOT_ALLOWED      = 7
      SEPARATOR_NOT_ALLOWED   = 8
      FILESIZE_NOT_ALLOWED    = 9
      HEADER_TOO_LONG         = 10
      DP_ERROR_CREATE         = 11
      DP_ERROR_SEND           = 12
      DP_ERROR_WRITE          = 13
      UNKNOWN_DP_ERROR        = 14
      ACCESS_DENIED           = 15
      DP_OUT_OF_MEMORY        = 16
      DISK_FULL               = 17
      DP_TIMEOUT              = 18
      FILE_NOT_FOUND          = 19
      DATAPROVIDER_EXCEPTION  = 20
      CONTROL_FLUSH_ERROR     = 21
      OTHERS                  = 22.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
<removed by moderator>
Edited by: vishalmurgai58 on Mar 6, 2012 1:43 PM
Edited by: Thomas Zloch on Mar 6, 2012 - please do not ask for ...

Similar Messages

  • Smart forms Print preview problem

    Hi
    Experts,
    I am working in CRM2007. I am creating number of different type Smart forms for our client requirement. All Smart Forms working fine in WEB GUI. In Web GUI there have two buttons; one is print buttons and another one is Print Preview buttons.  When we press print buttons it is directly go to printer for printing service order or service invoice or sales order or sales invoice whatever user is selected. Means working fine print buttons. And in case when we press print preview button it is open selected forms in PDF format; it is also work fine in our desire. But problem is here PDF format front size; which is very small. And after looking the PDF format if we select for print out of this PDF form; the print out orientation is Landscape and front size is very small. Now my question to all of experts u2026u2026u2026.How I change PDF front size and orientation? u2026u2026u2026u2026u2026u2026any type of BSP Enhancement or functional setting is required? Please Experts help meu2026u2026u2026u2026u2026u2026u2026u2026..
    Regards
    Tarapada  D.

    please CRM Experts give me some answer!!!!!!!!!!!!!!!

  • Issue Regarding Chinese characters In Smart Form Print preview..

    Hi All,
    I am working on a smart form development for chinese users. The requirement is the user will login using English & when the delivery will be issued for output, a check will be done on the country of user. If that comes as china then the international version (C) maintained for that customer will come as output.
    Now the problem is even if I login using EN or ZH the below issue I am facing always.
    In the database I can view the details in chinese properly by logging in as ZH. During debugging also i checked the data from table ADRC & MAKT is coming in chinese properly. But when i gave the values to be output in SmartForm, it is showing the characters like how it will look if I login using EN & view the table contents.
    When i view the data by changing character set as Simplified Chinese then in table i can see chinese texts properly. But when the same data goes to print preview it shows the chinese characters like as it would appear when character set is Unicode or West European..
    Please help..
    Thanks in advance.
    Edited by: malayanayak123 on Jun 1, 2011 5:48 AM

    Dear,
    print preview and physical printout are two different things.
    PrintPreview:
    The data stream will be sent to the frontend and rendered with windows-fonts etc (for backend prints a simulation).
    Printout:
    Frontend: You need a printer, that maps the character, you have to use SAPWIN or SAPWINCF when using cascading fonts. The rendering will be done in the windows spooler.
    Backend: Your printer needs also a mapping (look like something with UTF8). Also the printer needs the fonts installed because the rendering will be done in the printer!
    If you use the pdf-printer in SAP, you need to upload all necessary fonts (TTF) for the pdf-composer. Also you need a unicode pdf printer for that.
    Regards,
    Christian

  • Smart Forms Print Preview

    Hi All,
          I have applied some patches to my sytem, and now when I do a print preview it shows ##### where ever there is russian and if it is english it diplays properly.
    Thanks
    Vikas

    Hi Vicky,
    Looks like Unicode issue. there are coule of OSS notes on this . Please check.
    Check SDN form on this you can found couple of posts.
    Lanka

  • Problem in Smart Forms Print Preview.

    Hi ABAP experts,
             I am facing the flg problem:
    when i run ME23N transaction and click on print preview
    -> the logo is not displayed, and
    -> the values are displayed randomly.
    but when i take the printout,the output is displayed in a perfect way.
    I am not able understand what the exact problem is!!!!
    can anybody please help me out and this is repeated in many cases. when contacted  BASIS people they are saying thet its a problem from abap-side only!!!!

    Hi,
    Have you tried both (Print preview & Printout) using the same printer ?
    If yes, please try to create a spool & chk whether it is comming properly.
    Reason, may be some server memory issue, it can respond like this for the print preview.
    Regards,
    Selva K.

  • Smart form PRINT PREVIEW working on one box but not on other box

    Hi Guys,
    I have one program which works on DV1 box but is not working on DV2 box. It is NOT giving short dump. In this program there is PRINT PREVIEW button. This print preview button is work in DV1 but not in DV2. DV1 & DV2 are ECC 6 and we installed SAP service pack.
    I will really appreciate if somebody can give me some direction.
    Thanks,
    mini

    Program is save in both the boxes. DV2 has SAP service pack, but DV1 not. I think this problem is related to FONTS not being supported by service pack.
    How can I fix this?
    Thanks,
    mini

  • Pusrchase order having 3 line item But print preview in PDF shows blank.

    Hi All,
    Purchase order has 3 line items. While taking print preview in PDF format 1st page shows 1 line item and 2nd page is blank.
    I am not understanding the issue why other two line items are not getting displayed.?
    Please provide me with the solution.
    Thanks
    Forum

    Yes,there is a issue in print preview itself , if there is a issue in Print Prview that means page is gets skipped on next page ,therefore 2nd page automatically gets blank ,debug the same with abapor ,if this problem gets resolved then automatically system will convert the document in PDF as per print preview.
    Regards,
    Sandesh Sawant

  • Regarding Smart Form Printing, Print Preview issues

    Hi,
    I have couple of issues regarding Smart Form Printing, Print Preview.
    In my program i am passing below parameters to smart form function module:
    t_control-device = c_printer.
    t_control-no_dialog = space.
    t_control-preview = space.
    t_control-no_dialog = c_x.
    t_output-tddest = g_spld.
    t_output-tdimmed = c_x. " Print Immediately
    t_output-tddelete = space. " Don't Release spool after output
    g_user_settings = c_x.
    Issue#1: Though i have set preview paramter to space, after executing program it is prompting for Preview Screen, There again i have to give printer name though i am passing printer name as above and i need to hit on print preview button to set Layout output.
    Here how can i go directly to layout output without preview screen.
    Issue#2: In some cases we need to Print the layout set output after executing program immediately without prompting for preview screen and then Layout set output should also be shown after printing the output.
    How can i solve these issues!
    Thanks in advance.
    Thanks,
    Deep.

    Hi,
    In the SAP menu screen goto <b>System->User Profile->Own data</b>
    There in the defaults tab, for the output device give the value you had maintained for <b>g_spld.</b> This will not prompt you a dialog screen, and if you want to print immediately select the checkbox as well. Then try to execute the smartform. Hope this solves ur issue.
    Tushar

  • Print script in pdf format

    Hi all,
    I have a script and i need to print it in pdf format ,right now its printing in orginal or normal .Please let me know what i should do in order to print it in pdf form, i don't want to save it somewhere and then print it,i need to print it directly rather than saving it.
    Any help would be greatly appreciated
    Thanks
    deepthi

    hi,
    can anyone check the code and tell me what iam missing
    I don't want to save the pdf file i want to print it or see it under print preview.
    WAITING FOR REPLIES
    DATA: PDFTAB TYPE TABLE OF TLINE WITH HEADER LINE,
    DATATAB TYPE TABLE OF ITCOO WITH HEADER LINE.
    DATA: BINFILESIZE TYPE I,
    FILE_NAME TYPE STRING,
    FILE_PATH TYPE STRING,
    FULL_PATH TYPE STRING.
    data: begin of itcpp.
            include structure itcpo.
    data: end of itcpp.
    itcpp-tdcopies = 1.
    itcpp-tdimmed  = 'X'.
    itcpp-tddelete = 'X'.
    itcpp-tdnewid  = ' '.
    ITCPP-tddest = 'LP01'.
    ITCPP-tdgetotf = 'X'.
    itcpp-tdpreview = 'X'.
    Call function 'OPEN_FORM'
          exporting
            device                            = 'PRINTER'
            dialog                            = 'X'
           form                              = 'ZZ_PICK_LIST '
            form                              = space
            language                          = sy-langu
            options                           = itcpp.
    call function 'START_FORM'
             exporting
             ARCHIVE_INDEX          =
               form                   = 'ZTEST'
             LANGUAGE               = ' '
             STARTPAGE              = ' '
             PROGRAM                = ' '
             MAIL_APPL_OBJECT       =
           IMPORTING
             LANGUAGE               =
           EXCEPTIONS
             FORM                   = 1
             FORMAT                 = 2
             UNENDED                = 3
             UNOPENED               = 4
             UNUSED                 = 5
             SPOOL_ERROR            = 6
             OTHERS                 = 7
    LOOP AT ITAB.
    call function 'WRITE_FORM'
            exporting
            element                        = 'HEAD'
            function                       = 'SET'
            window                         = 'MAIN'
    ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'
       IMPORTING
         RESULT                         = itcpp
         RDI_RESULT                     =
       TABLES
          OTFDATA                        = DATATAB[]
        EXCEPTIONS
          UNOPENED                       = 1
          BAD_PAGEFORMAT_FOR_PRINT       = 2
          SEND_ERROR                     = 3
          SPOOL_ERROR                    = 4
          OTHERS                         = 5
       IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
    CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
          FORMAT                      = 'PDF'
          MAX_LINEWIDTH               = 132
         ARCHIVE_INDEX               = ' '
        IMPORTING
          BIN_FILESIZE                = BINFILESIZE
         TABLES
           OTF                         = DATATAB[]
           LINES                       = PDFTAB[]
        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.
    *ENDIF.

  • Mac with Lion OX, in print preview with PDF, only page 1 comes correctly, the rest misses some portion rest not

    I have iMac desktop with Lion OS. I am using Firefox 6 web browser. Previously with Snowleopard OS I did not have any problems with printing, With Lion OS print commands have changed and when I click preview in PDF format for printing a web page, only page 1 of the document shows correctly. In second page, the text does not show all of the document and few lines at the boundary is missing and the font is different from page 1. I tried using Google Chrome browser and this does not have this problem. If I do not find a solution I may be forced to move to Google Chrome. I will really appreciate a response. Thanks.

    Why not reconstruct the pages in InDesign they way you want the double pages to appear. There may even be an imposition script available that will do the trick. You could then output to pdf all the pages you want the full spread on. Leave the original to create the pages you wanted left as is.
    You can ask in the ID forum about an imposition script. I know there was one with CS4, there may have been one with CS3.

  • How To Generate And Print Reports In PDF Format From EBS With The UTF8 Char

    Hi,
    I want to know How To Generate And Print Reports In PDF Format From EBS With The UTF8 Character Set in R12.0.4.
    Regards

    Refer to Note: 239196.1 - PASTA 3.0 Release Information
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=239196.1
    Or, you can use XML Publisher.
    Note: 551591.1 - Need Latest XML Publisher / BI Publisher Patches For R12
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=551591.1

  • Chinese char issue in smartform preview as pdf format

    Hi chinese guy!!
    please help me with chinese char in smartform preview as pdf format
    i created smartform with chinese char and then when executing this smartform by t-code smartforms, it show as simplified chinese char, but when getting JOB_OUTPUT_INFO in order to convert OTF as pdf format, although smartforms performed as pdf format, only chinese char were broken. smartform with english or korean language does not have any issue, only chinese issue now.
    i got into r/3 as logon ZH by SAP GUI english version  and i used adobe acrobat reader chinese simplifed version. r/3 version is ecc60 unicode system***
    please help me,, any chinese guy there?
    1.  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    2.    CONTORL_PARAMETERS-NO_DIALOG = 'X'.
           CONTORL_PARAMETERS-GETOTF = 'X'.
           OUTPUT_OPTIONS-TDNOPREV = 'X'.
           CLEAR JOB_OUTPUT_INFO.
    3.    
    CALL FUNCTION FUNCTION
        EXPORTING
          CONTROL_PARAMETERS = CONTORL_PARAMETERS
          OUTPUT_OPTIONS     = OUTPUT_OPTIONS
        IMPORTING
          JOB_OUTPUT_INFO    = JOB_OUTPUT_INFO
        TABLES
          ITEM               = ITEM
        EXCEPTIONS
          FORMATTING_ERROR   = 1
          INTERNAL_ERROR     = 2
          SEND_ERROR         = 3
          USER_CANCELED      = 4.
      OTF_TAB[] = JOB_OUTPUT_INFO-OTFDATA[].
      CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          FORMAT                = 'PDF'
        IMPORTING
          BIN_FILESIZE          = PDF_FSIZE
        TABLES
          OTF                   = OTF_TAB
          LINES                 = PDF_TABLE
        EXCEPTIONS
          ERR_MAX_LINEWIDTH     = 1
          ERR_FORMAT            = 2
          ERR_CONV_NOT_POSSIBLE = 3
          OTHERS                = 4.

    hi,
    please see the notes 999712.
    thanks

  • SAP Vendor Master Communication Details for SMART FORM Printing.

    Hi
    Could you please advice Functional module to extract SAP Vendor Master Communication Details for SMART FORM Printing.
    Thanks in Advance.
    Regards
    Ravi

    Hi Ravi,
    I don't know about a function module, but the vendor master table LFA1 has a field ADRNR pointing to the general address table with the fields for e.g. language and to the tables ADR2 for phone numbers, ADR3 for fax numbers and ADR6 for e-mail addresses.
    BR
    Raf

  • Communication Details Vendor Master SMART FORM Printing.

    Hi
    Could you please advice Functional module to extract SAP Vendor Master Communication Details for SMART FORM Printing.
    Thanks in Advance.
    Regards
    Ravi

    Hi,
    class VMD_EI_API_EXTRACT with method GET_DATA could make it.
    There are also some eSOA services that could make it fine. See services starting with Supplier*.
    Otherwise, this is more complicated.
    BR
    Alain

  • Regarding Smart Form Printing

    related to smart form printing :
    I have to print the data using template , but i dont want to fix the line in template ,
    i want to take the data in template , and how much data is accessed that much space
    must be occupied on the page, i dont want to fix the area in template
    Hope you have got me.
    Edited by: rihano7 mansoori on Jul 13, 2011 2:48 PM
    Edited by: rihano7 mansoori on Jul 13, 2011 2:49 PM
    Moderator message: please choose more descriptive subject lines for your posts.
    Edited by: Thomas Zloch on Jul 13, 2011 3:53 PM

    Hi,
    Do you intend to say , that template cell size should vary depending on your data.
    I doubt that is possible.
    You should look for a workaround.
    Why dont you be more specific in your exact requirment, so that an alternate soln can be found.

Maybe you are looking for