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 Kodyaz SAP and ABAP Programming 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 and Download Adobe Form as PDF File in SAP Web Dynpro

To download or display Adobe Form PDF file from a SAP Web Dynpro application, ABAP developers can use File_Download (FileDownload) UI element as configured in this tutorial. This method slightly differs from displaying Adobe Form in a popup screen but provides more flexibility to the end user

This SAP Web Dynpro tutorial shows how to configure Web Dynpro context to store Adobe Form binary pdf data and show the pdf file using FileDownload element.

I assume that the ABAP programmer has already created the Adobe Form output using SFP SAP transaction code so the Adobe Form is ready.

In this Web Dynpro tutorial, I will now summarize the steps that the ABAP developer will create the related context elements on Web Dynpro component.
Then I will place FileDownload user interface (UI) element on the Web Dynpro view layout.
Following these steps, we can then continue with the step where FileDownload control data is bound to context data.
The last step will be how to code in ABAP to populate the context data.

First of all, let's create the PROFORMAPDFFILENAME attribute in context data under root Context node as follows. This context will be used to store the file name of the .pdf file as STRING data type. The pdf file will be created from Adobe Forms output.

Web Dynpro context for Adobe Form pdf file name

After Adobe Form output file name, let's configure the Web Dynpro context to store Adobe Form binary data.
In this step, ABAP programmers will create context attribute to store the pdf file source data.
Following screenshot gives an idea how the context is created for storing Adobe Form source data for the Web Dynpro.
Switch to Context tab on Web Dynpro View, create a node with name PDF.
Added an attribute named ADOBE_FORM under the PDF node. The new attribute Adobe_Form should have data type XSTRING.

Adobe Form pdf file source data in Web Dynpro context

SAP Web Dynpro developer can now place the FileDownload user interface element on the Main view by switching to the Layout tab. On the targeted area on Web Dynpro, right click on container form element and choose "Insert Element"

add new Web Dynpro element on Main view layout

Choose the new Web Dynpro element type as File_Download FileDownload as seen below.

Web Dynpro File_Download FileDownload element for Adobe Form display

On our Web Dynpro component, we will use the File_Download (FileDownload) UI control as a link button which enables SAP users to display or download the Adobe Form output directly from web browser.

Please check the below properties screen of the File_Download UI control and make sure you have configured the data, fileName, mimeType and text attributes of the element.

SAP Web Dynpro element FileDownload properties to display Adobe Forms output on browser

Although it is an alternative to fix the Adobe Form output file name to a standart name, I choose to include the ID of the parent record. So I use ABAP CONCATENATE command to form the PDF download file name and set it to the context attribute PROFORMAPDFFILENAME as seen below.

method SET_PDF_FILENAME .

data LO_EL_CONTEXT type ref to IF_WD_CONTEXT_ELEMENT.
data LS_CONTEXT type WD_THIS->ELEMENT_CONTEXT.
data LV_PROFORMAPDFFILENAME type WD_THIS->ELEMENT_CONTEXT-PROFORMAPDFFILENAME.

* get element via lead selection
LO_EL_CONTEXT = WD_CONTEXT->GET_ELEMENT( ).

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

* @TODO fill attribute
* ABAP code line where I set name of the Adobe Form output file name
concatenate 'proforma-' P_PROFORMA_NUMBER '.pdf' into LV_PROFORMAPDFFILENAME.
condense LV_PROFORMAPDFFILENAME.

* set single attribute
LO_EL_CONTEXT->SET_ATTRIBUTE(
 NAME = 'PROFORMAPDFFILENAME'
 VALUE = LV_PROFORMAPDFFILENAME ).

endmethod.

Please note, P_PROFORMA_NUMBER is an input parameter to this ABAP method.

The following required step is now to map the Adobe Form binary data to the context attribute ADOBE_FORM under PDF node in Web Dynpro Main view Context.
Since I covered this topic in an other Web Dynpro tutorial "Display Adobe Form in SAP Web Dynpro", I'll not pass through the codes again. All you have to do is to copy the ABAP codes in the mentioned Web Dynpro - Adobe Form tutorial where you set the PDF file name.

After following the steps covered in this SAP Web Dynpro and Adobe Form tutorial, ABAP programmers will be able to display Adobe Forms output as a seperate PDF file within a Web browser. This method will enable SAP users to download the Adobe Form output as a pdf file using their browsers like Internet Explorer or FireFox, etc.






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table






Related Articles and Tutorials(http://www.kodyaz.com/sap-abap/download-and-display-adobe-form-pdf-in-sap-web-dynpro.aspx)
Add Button to ALV Table Header on SAP Web Dynpro
How to Clear SAP Adobe Form Cache
How to Clear Web Dynpro Cache
SAP Web Dynpro ALV Tutorial
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
Remove Caption for Text Field on Adobe Form Layout
Free Adobe LiveCycle Designer Download
Traffic Lights in SAP Web Dynpro ALV Table
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 Adobe Form in SAP Web Dynpro
Display Data on Web DynPro Table Element
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
Set Page Title in Web Dynpro Application
Web Dynpro Text Translation using Assistance Class
Trigger ALV Events in Web Dynpro Component
Read Checkbox Value in Web Dynpro Editable ALV
SAP Web Dynpro File Upload using GOS cl_fitv_gos Class
Add Value Help to Web Dynpro Select Options
Web Dynpro Component Service Syntax Error in Program /1BCWDY/O3EC1AX6A3OVKK9L5FXO==CP
Translate Web Dynpro Header Title displayed on Web Browser
Web DynPro Tutorial - Display Spool Requests using Web DynPro Table
SAP Web Dynpro Service Cannot be Reached Error


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