Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Frequently Asked Questions

What possibilities does SAP offer to generate PDF files?

  • SAP proposes the PDF1 device type (see Note 323736 - Restrictions with "PDF print" through spooler) (also known as the "PDF converter") which you can use to convert an OTF or list document, in archiving and mail sending
  • When you print a SAPscript or a Smart Form, you may choose to get the generated document in OTF and then programmatically convert the OTF into PDF binary (then you do whatever you want with this binary, like download as a file, send it as attachment to an email, etc.)
  • From Smart Form preview screen, the user may convert it into PDF by entering PDF! in the okcode field.
  • You may convert an ABAP list into a PDF binary by calling a function module
  • Since NetWeaver 2004 (release 6.40), SAP proposes a technology named "SAP Interactive Forms by Adobe" (often referred as Interactive Forms, or Adobe Forms, or PDF Forms) which allows to generate PDF natively without any intermediate media

What are PDF-based print forms?

  • SAP uses this name to refer to Interactive Forms which have the flag Interactive switched off, i.e. it is not possible to fill in data in these types of PDF files, while it is possible in interactive PDF files (using Adobe Acrobat Reader software).

What means IFbA?

  • IFbA is the abbreviation of SAP Interactive Forms by Adobe. Note: IFbA abbreviation is not used by SAP, but by the SDN community.

How to display a PDF in SAPGUI for Windows?

  • Define a custom control in a dynpro, and use CL_GUI_HTML_VIEWER class with mime type "application/pdf"
  • See for example the second part of wiki "Read any OTF Data in Adobe Reader"
  • Note: CL_GUI_PDFVIEWER class should not be used as indicated by SAP in its description.

How to display a PDF in a web dynpro for ABAP?

  • See this wiki for creating the web dynpro step-by-step, it displays a PDF file previously and manually loaded into the MIME repository (not part of the wiki, use SE80 to load any PDF)
  • See this wiki for creating an interactive form and a web dynpro step-by-step

How to convert SAPscript output into PDF binary?

  • Note: here PDF binary means that the PDF is stored in a variable in memory (handled using XSTRING variable for example), not a file. To transform the PDF binary into a file, see question below.
  • The SAPscript must generate an OTF output and then you convert the OTF into PDF format. There are 2 possibilities :
    • Without generating any spool :
      • when calling OPEN_FORM function module, export parameter OPTIONS-TDGETOTF = 'X', and when calling CLOSE_FORM function module, use returned parameter OTFDATA
      • call CONVERT_OTF function module to convert the OTF to PDF. Returned parameters are BIN_FILE (the PDF binary) and BIN_FILESIZE (the length of the PDF binary). See below how to save a PDF binary to a file.
    • If an OTF spool has been generated, you may convert it using CONVERT_OTFSPOOLJOB_2_PDF function module. Returned parameters are PDF table (the PDF binary) and PDF_BYTECOUNT (the length of the PDF binary).
  • See for example this wiki

How to convert Smart Form output into PDF binary?

  • As for SAPscripts, you may generate a Smart Form in OTF format, so it's the same principle as above, with this minor difference to get OTF data without generating any spool : in the function module which opens the Smart Form output stream (either SSF_OPEN or the Smart Form generated FM), export parameter CONTROL_PARAMETERS-GETOTF = 'X', and in the function module which closes the Smart Form output stream (either SSF_CLOSE or the Smart Form generated FM), returned parameter is JOB_OUTPUT_INFO-OTFDATA.
  • See for example this wiki

How to convert an ABAP List spool into PDF binary?

  • Call CONVERT_ABAPSPOOLJOB_2_PDF function module. Returned parameters are PDF table (the PDF binary) and PDF_BYTECOUNT (the length of the PDF binary).
  • See for example this wiki.

How to save a PDF binary into PDF file?

  • A PDF binary has to be saved as any other binary: If the file is to be saved on the frontend, it can only be done in dialog interactive mode (it is impossible to connect to the frontend from background execution), use either GUI_DOWNLOAD function module or method GUI_DOWNLOAD from class CL_GUI_FRONTEND_SERVICES. If the file is to be saved on the server, use OPEN DATASET, TRANSFER and CLOSE DATASET ABAP statements.
  • As for any other binary, be careful to save the exact number of bytes that the binary contains (use the "binary length" returned by CONVERT_OTF or CONVERT_OTFSPOOLJOB_2_PDF), otherwise you might have problems when opening the PDF.
  • See for example the last part of this wiki

How to attach a PDF file to an email programmatically?

  • The PDF must be handled as any other binary attachment (you may use Business Communication Service (BCS) class (CL_BCS), or use the old function module SO_NEW_DOCUMENT_ATT_SEND_API1, but this last is rather complex to implement).

What is a PDF spool request?

  • Up to NW2004, there were only 3 types of spool requests : ABAP list, SAPscript RDI, OTF (SAPscript and Smart Forms)).
  • With IFbA, SAP couldn't store these forms as spool requests in any of the 2 last formats, and has decided to create a new type.
  • Spool requests of type PDF have a new feature called "part list" which allows a spool request to contain several IFbA : each PDF spool request contains 1 or more parts, each part contains exactly one IFbA. It is then possible to print only some parts of the spool request (but it is not possible to print some pages of one part). This feature is used to mimic the possibility of merging automatically several SAPscripts or Smart Forms.
  • No labels


  1. Guest

    is it possible to read pdf file in abap?

    If yes thenplease provide me some sample code.



  2. Former Member

    Thanks for providing this great page.  I came looking for "How to read a PDF file off the server and attach it as an email".  I was trying to use a function SCMS_UPLOAD but I found the following to be the proper way to read in a .PDF file. There is only the need to read the file in one line. There are so many resources for attaching data to an email, I won't include that.
    l_filename type localfile,
    l_xstring type xstring,
    lt_solix type solix_tab.

    OPEN DATASET l_filename for input in binary mode.
    "error handling
    READ DATASET l_filename INTO l_xstring.
    CLOSE DATASET l_filename.
    buffer = l_xstring
    binary_tab = lt_solix