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.
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.
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"
Choose the new Web Dynpro element type as File_Download FileDownload as seen below.
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.
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.
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.