Hi All,
Introduction
This blog helps you to display PDF using Xstring data from a report.
Procedure:
Step1:
Goto Transaction SE38.
Enter the name of the program and click on the Create button as shown below.
The below screen will appear and give the program name and type as executable.
Click on the Save button.
Step2:
Create a screen as shown below.
Double click on-screen number.
A popup is displayed as shown below.
Click on Yes.
The below screen will appear and give a short description and click on the Save button.
Now click on Flow logic.
The below screen will appear and click on the layout button.
Create a custom control as shown below.
Now custom control is created.
Double click on the control and give the name of the control.
Step3:
Get Xstring data from database table or from 'CONVERT_OTF' FM.
Here we are displaying the Xstring that is stored in database table.
Goto screen 100 and create PBO & PAI Modules as shown below.
Double click on PBO module & the popup is displayed.
Click on the Yes button.
Select the main program or create a new include. Here we are using the main program and click on continue.
In the same way, create a PAI module.
Double click on the PAI module and the popup will be displayed.
Click on the Yes button.
Select the main program or create a new include. Here we are using the same main program and click on continue.
In the PBO module, implement the required logic.
Step4:
Create a reference class to the standard class of custom containers and HTML viewer and create objects in the PBO module of the program.
PDF is the name of the custom control.
Step5:
Call the function module 'SCMS_XSTRING_TO_BINARY' as shown below in the PBO module.
Click on the pattern button.
Give the name of the function module and click on the continue button.
Now pass the Xstring data to the function module.
Now call the method load data from HTML viewer as shown below.
Click on the pattern.
Select ABAP Objects Patterns and click on continue as shown below.
Give the name of the HTML viewer and click on the continue button.
Pass the binary table data as shown below.
Now call the method to display the data.
Click on the pattern button as shown below.
Select the ABAP Objects Patterns and click on the continue button as shown below.
Give the name of the class and method and click on the continue button as shown below.
Pass the URL to SHOW_URL method as shown below.
Step6:
Refresh the Container.
The container should be refreshed so that it will not display the previous PDF data.
This logic should be implemented in PAI module.
Click on Patterns as shown below.
Select the ABAP Objects Patterns and click on the continue button.
Give the name of the class and method and click on the continue button as shown below.
The output is as below.
Conclusion:
Using this method we can display any Xstring data in PDF in an ABAP Report.
Thank you.