Display Xstring as PDF in Report. SAP ABAP. 📄📄📄

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.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

The below screen will appear and give the program name and type as executable.
Click on the Save button.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep
ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Step2:
Create a screen as shown below.
Double click on-screen number.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

A popup is displayed as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Click on Yes.
The below screen will appear and give a short description and click on the Save button.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Now click on Flow logic.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

The below screen will appear and click on the layout button.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Create a custom control as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Now custom control is created.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Double click on the control and give the name of the control.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

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.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Select the main program or create a new include. Here we are using the main program and click on continue.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

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.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Select the main program or create a new include. Here we are using the same main program and click on continue.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

In the PBO module, implement the required logic.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

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.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep
ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

PDF is the name of the custom control.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Step5:
Call the function module ‘SCMS_XSTRING_TO_BINARY’ as shown below in the PBO module.
Click on the pattern button.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Give the name of the function module and click on the continue button.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Now pass the Xstring data to the function module.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Now call the method load data from HTML viewer as shown below.
Click on the pattern.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Select ABAP Objects Patterns and click on continue as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Give the name of the HTML viewer and click on the continue button.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Pass the binary table data as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Now call the method to display the data.
Click on the pattern button as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Select the ABAP Objects Patterns and click on the continue button as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Give the name of the class and method and click on the continue button as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Pass the URL to SHOW_URL method as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

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.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Select the ABAP Objects Patterns and click on the continue button.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

Give the name of the class and method and click on the continue button as shown below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep
ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

The output is as below.

ABAP Development, SAP ABAP Tutorial and Materials, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam, SAP ABAP Prep

More info: https://setevalapinsap.com

Regards.

Etiquetas:, , ,