SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




CRM Companies List
Web Based CRM Software


Display Adobe Form in SAP Web Dynpro

To display Adobe Form in an SAP Web Dynpro component, the steps for an ABAP developer is the focus of this Web Dynpro tutorial. Web Dynpro programmer can use InteractiveForm layout element on a Web Dynpro component View to display Adobe Forms document. ABAP developer should set pdfSource property of the InteractiveForm element in WDDOMODIFYVIEW method of the related View.

In the following section of this SAP Web Dynpro tutorial, I will show how to store Adobe Form pdf data in Web Dynpro component context with ABAP codes and bind Adobe Form pdf context to InteractiveForm element pdfSource property.

If you do not prefer to display Adobe Form output embedded in a Web Dynpro popup screen, you can use the alternative method illustrated in Web Dynpro tutorial Display and Download Adobe Form as PDF File in SAP Web Dynpro

I assume the ABAP programmer create Adobe Forms using SAP transaction code SFP and the Adobe Form is ready. I will not also describe the steps to create a Web Dynpro component. I skip these two steps.

First create the required context to store Adobe Forms output pdf source data. As you can see in below screenshot, in Context tab of the Web Dynpro View I create a node named PDF. Then I added attribute ADOBE_FORM under PDF node. The Adobe_Form attribute has type XSTRING

Web Dynpro context for Adobe Form

Now on the Web Dynpro View, switch to Layout node. Under RootUIElementContainer, add a new InteractiveForm element.

Now, we need to bind PDF binary data to InteractiveForm element pdfSource property. Click on Binding column next to pdfSource attribute. Choose the ~.PDF.ADOBE_FORM context attribute as the data source of the Adobe Form element on Web Dynpro View layout.

display Adobe Form PDF in SAP Web Dynpro layout

In WDDOMODIFYVIEW method ABAP code block, we can create ABAP codes to get required parameter values for the Adobe Forms document. Query and store those parameter values on context node and context attribute values. I'll not illustrate these since all Adobe Forms outputs will require different input parameters.

If you want to display Adobe Form in pop up screen like I did in this case, control the first time of the View. Otherwise, when you click OK, or CANCEL, etc buttons on the pop up screen ABAP codes will run unnecessarily.
Within WDDOMODIFYVIEW method, be sure that you execute Adobe Forms code for the view is loaded for the first time. Use the following ABAP CHECK statement to control condition FIRST_TIME if it is equal to 'X' or ABAP_TRUE value.

* execute following code if view is loading for the first time
* check FIRST_TIME = 'X'.
check FIRST_TIME = ABAP_TRUE.

If you are displaying Adobe Forms output on a Web Dynpro view other than pop up screens, ommit the above control.

Here are the summarized main steps verbally in below ABAP codes:
1) Open spool job,
2) Get Adobe Form function module name,
3) Call Adobe Form function module,
4) Store PDF binary data in Context,
5) Close spool job

*** DATA Definitions
* Adobe Forms function module name
data LV_ADOBEFORM_FM_NAME type RS38L_FNAM.

* return parameter values from Adobe Forms function module
* including binary PDF data
types TY_FPFORMOUTPUT type FPFORMOUTPUT.
data WA_FPFORMOUTPUT type TY_FPFORMOUTPUT.

* Form Processing Output Parameter
types TY_OUTPUTPARAMS type SFPOUTPUTPARAMS.
data WA_OUTPUTPARAMS type TY_OUTPUTPARAMS.

WA_OUTPUTPARAMS-DEVICE = 'PRINTER'.
WA_OUTPUTPARAMS-DEST = 'LOCL'.
WA_OUTPUTPARAMS-NODIALOG = 'X'.
WA_OUTPUTPARAMS-PREVIEW = 'X'.
WA_OUTPUTPARAMS-GETPDF = 'X'.

* open spool job
call function 'FP_JOB_OPEN'
 changing
  IE_OUTPUTPARAMS = WA_OUTPUTPARAMS
 exceptions
  CANCEL = 1
  USAGE_ERROR = 2
  SYSTEM_ERROR = 3
  INTERNAL_ERROR = 4
  others = 5.

* get function module name of the Adobe Forms
call function 'FP_FUNCTION_MODULE_NAME'
 exporting
  I_NAME = '/KODYAZ/SAMPLE_PROFORMA_FORM' " Adobe Form name
 importing
  E_FUNCNAME = LV_ADOBEFORM_FM_NAME.

* execute Adobe Forms function module and return PDF data
call function LV_ADOBEFORM_FM_NAME
 exporting
  PROFORMA_H = LV_PROFORMA_H
 importing
  /1BCDWB/FORMOUTPUT = WA_FPFORMOUTPUT.

*** Store PDF data in Context
**********************************************************************
data LO_ND_PDF type ref to IF_WD_CONTEXT_NODE.

data LO_EL_PDF type ref to IF_WD_CONTEXT_ELEMENT.
data LS_PDF type WD_THIS->ELEMENT_PDF.
data LV_ADOBE_FORM type WD_THIS->ELEMENT_PDF-ADOBE_FORM.

* navigate from <CONTEXT> to <PDF> via lead selection
LO_ND_PDF = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_PDF ).

* @TODO handle non existant child
* IF lo_nd_pdf IS INITIAL.
* ENDIF.

* get element via lead selection
LO_EL_PDF = LO_ND_PDF->GET_ELEMENT( ).

* @TODO handle not set lead selection
if LO_EL_PDF is initial.
endif.

* @TODO fill attribute
* Set context attribute value from Adobe Form function module return parameter
* which includes with PDF binary data
LV_ADOBE_FORM = WA_FPFORMOUTPUT-PDF.

* set single attribute
LO_EL_PDF->SET_ATTRIBUTE(
 NAME = 'ADOBE_FORM'
 VALUE = LV_ADOBE_FORM ).
**********************************************************************

* close spool job
call function 'FP_JOB_CLOSE'
 exceptions
  USAGE_ERROR = 1
  SYSTEM_ERROR = 2
  INTERNAL_ERROR = 3
  others = 4.

This SAP Web Dynpro tutorial is showing how to display Adobe Forms output on a Web Dynpro popup screen. I hope this tutorial to be useful for ABAP developers on their Web Dynpro components where they consume and display Adobe Forms outputs.






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table






Related Articles and Tutorials(http://www.kodyaz.com/sap-abap/display-adobe-form-in-sap-web-dynpro.aspx)
Display Adobe Form in SAP Web Dynpro
Web Dynpro Text Translation using Assistance Class
Translate Web Dynpro Header Title displayed on Web Browser
Remove Caption for Text Field on Adobe Form Layout
Free Adobe LiveCycle Designer Download
Traffic Lights in SAP Web Dynpro ALV Table
Display Data on Web DynPro Table Element
How to Clear SAP Adobe Form Cache
How to Clear Web Dynpro Cache
Set Page Title in Web Dynpro Application
Trigger ALV Events in Web Dynpro Component
SAP Web Dynpro ALV Tutorial
Add Value Help to Web Dynpro Select Options
SAP Web Dynpro Service Cannot be Reached Error
Add Button to ALV Table Header on SAP Web Dynpro
Add Web Dynpro Applications to SAP Favorites Menu
Set Font and Paragraph Properties in Adobe Form Builder
How to Change Adobe Form Page Orientation Portrait or Landscape
Adobe Form Interface Reference Field for Currency and Quantity
Set Visibility of Table Row on Adobe Form Dynamically by Script Code
Adobe Forms Table Header is Missing After Second Page
Component Usage ALV Does Not Have an Active Component
Convert Units in Adobe Form Layout Ruler and Length Measurements
Create Search Help in ABAP for Web Dynpro Component
Create Transaction Code for Web Dynpro Application
Display and Download Adobe Form as PDF File in SAP Web Dynpro
Find Web Dynpro Class Name to Search in ABAP Code
Web DynPro Tutorial - How to create Web Dynpro Application (Web Dynpro Component)
Test Web Dynpro ABAP Component by Creating Web Dynpro Application
Remove ALV Buttons on SAP Web Dynpro Component
Read Checkbox Value in Web Dynpro Editable ALV
SAP Web Dynpro File Upload using GOS cl_fitv_gos Class
Web Dynpro Component Service Syntax Error in Program /1BCWDY/O3EC1AX6A3OVKK9L5FXO==CP
Web DynPro Tutorial - Display Spool Requests using Web DynPro Table


Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems