Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Document output from SAP has long been the domain of SAPScript and later SmartForms. Which still prove good performance. However PDF-based forms is the future for form output in SAP solutions, and given the improved usability of Live Cycle Designer compared to SmartForms, there are reasons SAP customers now are looking more and more at form output via the PDF-based print forms.

[Francois Gendebien | /people/francois.gendebien/blog] discusses this and explains the technology very well in his blog: SmartForms vs. PDF-based print forms in SAP solutions: pros and cons , were he also addresses the performance of the Adobe Document Service (ADS) which is central in the PDF-based solutions. 

Although a lot has been done to address performance in ADS e.g. (reducing call overhead via form bundling) there still exist limitations of the technology, e.g. as stated in the note for Release Restrictions SAP NW07 – Adobe Document Services (894389 ) – the limitation of “size of a single document for printing” being one of them.

A topic not much discussed on SDN, but nevertheless important is the possibillity to use an external output management system (OMS) to process the PDF-based forms via the certifiable SAP NetWeaver Application Server - XML Output for PDF-Based Forms (BC-XFP) interface. This blog describes how to set up XFP interface and output the Sample Form FP_TEST_03  to a 3000 page PDF (on a vanilla dual-core PC with 2GB of RAM, doubling the max recommended single-document size in ADS) using StreamServe .

The steps to implement XFP output of PDF based forms the is described below.

Set up XFP device and PDF device in SPAD

If the device is named XFP it is automatically selected by the Spool system for XFP enabled forms.

!https://weblogs.sdn.sap.com/weblogs/images/251975656/xfp_device.png|height=125|alt=XFP Device Set-up|width=498|src=https://weblogs.sdn.sap.com/weblogs/images/251975656/xfp_device.png|border=0!

The XFP device is in this set up for printing via External Output Management System as Host Spool Access Method (StreamServe in this case).

!https://weblogs.sdn.sap.com/weblogs/images/251975656/xfp_device_xom.png|height=128|alt=XOM spool method|width=416|src=https://weblogs.sdn.sap.com/weblogs/images/251975656/xfp_device_xom.png|border=0!

Note that you also would neet to set up another device with a device type supported by the Adobe Document Service (e.g PDF1 device – called ZPDF1_XOM_MM in the code sample below) which will be the target of the output in the print program. However when XFP output is enabled vi the call to FP_JOB_OPEN, the output will be redirected to the XFP device instead. 

Reviewing the form FP_TEST_03

Just to get a view of the layout… Open form FP_TEST_03 in SAP transaction SFP (Form Builder).

!https://weblogs.sdn.sap.com/weblogs/images/251975656/SFP_fp_test_03.jpg|height=450|alt=SFP transaction|width=625|src=https://weblogs.sdn.sap.com/weblogs/images/251975656/SFP_fp_test_03.jpg|border=0!

Testing to retrieve the XDP design template via HTTP This is generic for any form by just replacing the form name in the URL. A trick that will be used in to dynamically retrieve any design template, is that user name and password can be passed in the URL to circumvent a Basic Authentication popup dialog that otherwise would appear. The URL with auth. information attached is displayed below (just replace

Note: From a technical perspective it is also possible to extract the template files to disk and reuse them from a generic disk location. For example writing a small ABAP program that uses Function Module FP_READ_XDP and saves the data to a file with suffix ".xdp".

+Writing a print program +

Just as for SmartForms and SAPScript a print program is used to feed the designed form with data for output. For PDF-based print forms the XFP output is enabled via parameter FP_OUTPUTPARAMS-XFP = 'X' passed in the runtime call to function module FP_JOB_OPEN.

!https://weblogs.sdn.sap.com/weblogs/images/251975656/SE38_print_prog1.png|height=205|alt=SE38 create print program|width=332|src=https://weblogs.sdn.sap.com/weblogs/images/251975656/SE38_print_prog1.png|border=0!

 

&----

*& Report  ZPDF_XFP_PRINT_TEST2
*&
&----

*&
*& Testing XFP output via device = XFP and External Output Management
*& system.
&----


REPORT  ZPDF_XFP_PRINT_TEST2.


DATA: CUSTOMER          TYPE SCUSTOM,
      li_sum            TYPE p,
      li_cnt            TYPE i,
      BOOKINGS          TYPE TY_BOOKINGS,
      S_BOOKING         LIKE LINE OF BOOKINGS,
      CONNECTIONS       TYPE TY_CONNECTIONS,
      S_CONNECTIONS     LIKE LINE OF CONNECTIONS,
      SUMS              TYPE TY_BOOKINGS,
      S_SUMS            LIKE LINE OF SUMS,
      FM_NAME           TYPE RS38L_FNAM,
      FP_NAME           TYPE FPNAME,
      FP_DOCPARAMS      TYPE SFPDOCPARAMS,
      FP_OUTPUTPARAMS   TYPE SFPOUTPUTPARAMS.
  • Loop count, just producting a lot of data
li_cnt = 80000.


DATA: t1 TYPE TIMS, t2 TYPE TIMS, diff TYPE i.


*
  • Enable XFP output of the Form
*


FP_OUTPUTPARAMS-XFP = 'X'.
  • FP_OUTPUTPARAMS-XFPTYPE = '' XML With Context Evaluation


  • Selected dynamically if blank (i.e device with name XFP)
FP_OUTPUTPARAMS-NODIALOG = 'X'.
FP_OUTPUTPARAMS-REQIMM = 'X'.
FP_OUTPUTPARAMS-REQNEW = 'X'.
  • Device destination
FP_OUTPUTPARAMS-DEST = 'ZPDF1_XOM_MM'.


DO li_cnt TIMES.


*
  • GETTING THE DATA
*
  CUSTOMER-ID = '00002345'.
  CUSTOMER-NAME = 'Homer Simpson'.
  CUSTOMER-STREET = 'Moes'.
  CUSTOMER-POSTCODE = '11111'.


  S_BOOKING-CARRID = 'A11'.
  S_BOOKING-CONNID = '0001'.
  S_BOOKING-FLDATE = '20080805'.
  S_BOOKING-BOOKID = '00000001'.
  S_BOOKING-CUSTOMID = '12345678'.
  S_BOOKING-CUSTTYPE = 'B'.
  S_BOOKING-INVOICE = 'X'.
  S_BOOKING-CLASS = 'F'.
  S_BOOKING-FORCURAM = '123.21'.
  S_BOOKING-FORCURKEY = 'SEK'.
  S_BOOKING-LOCCURAM = '123.21'.
  S_BOOKING-LOCCURKEY = 'SEK'.
  S_BOOKING-ORDER_DATE = '20080801'.
  S_BOOKING-COUNTER = '1'.
  S_BOOKING-AGENCYNUM = '1'.
  S_BOOKING-PASSNAME = 'Homer Simpson'.
  S_BOOKING-PASSBIRTH = '610708'.


  li_sum = li_sum + S_BOOKING-FORCURAM.


  APPEND S_BOOKING TO BOOKINGS.


ENDDO.


S_SUMS-FORCURAM = li_sum.
S_SUMS-FORCURKEY = 'SEK'.
S_SUMS-LOCCURAM = li_sum.
S_SUMS-LOCCURKEY = 'SEK'.


APPEND S_SUMS TO SUMS.


S_CONNECTIONS-CARRID = 'A11'.
S_CONNECTIONS-CONNID = '0001'.
S_CONNECTIONS-CITYFROM = 'US'.
S_CONNECTIONS-COUNTRYTO = 'SE'.


APPEND S_CONNECTIONS TO CONNECTIONS.


S_CONNECTIONS-CARRID = 'A12'.
S_CONNECTIONS-CONNID = '0003'.
S_CONNECTIONS-COUNTRYFR = 'SE'.
S_CONNECTIONS-COUNTRYTO = 'US'.


APPEND S_CONNECTIONS TO CONNECTIONS.


*
  • PRINT
*


  • Sets the output parameters and opens the spool job


CALL FUNCTION 'FP_JOB_OPEN'
  CHANGING
    IE_OUTPUTPARAMS = FP_OUTPUTPARAMS
  EXCEPTIONS
    CANCEL          = 1
    USAGE_ERROR     = 2
    SYSTEM_ERROR    = 3
    INTERNAL_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.


  • Get the name of the generated function module
FP_NAME = 'FP_TEST_03'.


CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
  EXPORTING
    I_NAME     = FP_NAME
  IMPORTING
    E_FUNCNAME = FM_NAME.


IF SY-SUBRC <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.


  • Language and country setting (here US as an example)


fp_docparams-langu   = 'E'.
fp_docparams-country = 'US'.


  • Call the generated function module


CALL FUNCTION FM_NAME
  EXPORTING
    /1BCDWB/DOCPARAMS        = FP_DOCPARAMS
    CUSTOMER                 = CUSTOMER
    BOOKINGS                 = BOOKINGS
    CONNECTIONS              = CONNECTIONS
    T_SUMS                   = SUMS
  EXCEPTIONS
    USAGE_ERROR              = 1
    SYSTEM_ERROR             = 2
    INTERNAL_ERROR           = 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.


  • Close the spool job


CALL FUNCTION 'FP_JOB_CLOSE'
  EXCEPTIONS
    USAGE_ERROR          = 1
    SYSTEM_ERROR         = 2
    INTERNAL_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.


StreamServe configuration

By setting up a generic message in StreamServe with an “Adobe Live Cycle Designer ES” process, any PDF-based print form  from SAP can be processed and rendered as designed in SAP Form Builder (SFP) / Live Cycle Designer. Those of you who don’t know StreamServe technicalities can just skim the rest of this section...

The configuration of a generic StreamServe message to handle any PDF-based print form needs to include:

  • An “Adobe Live Cycle Designer ES” process.
  • Definition of a SOM Expression to point to the http url to the LiveCycle Design Template defined in SAP (according to above) - this expression is used to dynamically select the correct template from SAP on runtime. The actual form name is provided in the XFP input xml and can be referenced using SOM expression $record.parent.header.general.FORM (assuming “data” is set as record trigger according to screenshot below).
  • Optional mapping of XFP header records (in the process configuration) to streamserve variables – to enabling routing different documents to different locations, based e.g on SAP device provided.

Just some screenshots from the StreamServe DesignCenter:

A generic StreamServe message for handling XFP data and Live Cycle design templates from SAP.

Set Record trigger to “data” in the process.

+ </p><p>*Done!* </p><p style="margin: 0in 0in 10pt" class="MsoNormal">Executing the print program now outputs the ~3000 page PDF from SAP via StreamServe, re-using the layout defined in Form Builder / Live Cycle Designer in SAP: </p>!https://weblogs.sdn.sap.com/weblogs/images/251975656/large_pdf_sample.png|height=365|alt=Large PDF screenshot|width=498|src=https://weblogs.sdn.sap.com/weblogs/images/251975656/large_pdf_sample.png|border=0! <p style="margin: 0in 0in 10pt" class="MsoNormal"> </p><p style="margin: 0in 0in 10pt" class="MsoNormal">+ </p>
3 Comments