Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Display Different Font Sizes And Styles In A Simple ABAP Report

$
0
0

Purpose:

 

The purpose of this document is to show how to display an ABAP report with different font sizes and font styles.

 

 

Prerequisites:

 

Concept of ABAP objects and Controls

 

Scenario

 

It is required to display Material details, with Material in bold, Material type in a bigger font, Industry sector in color and Material Group in normal text. Field headings will appear in a different font style and size.

 

Build Solution

 

To meet the above requirements, different document classes and their relevant methods are used. An instance of the class CL_DD_DOCUMENT is used to create a dynamic document to hold the total document to be displayed, i.e., the heading “Material Details” and the tabular data including the field headings. The value for each field is placed in an instance of the class CL_DD_AREA. So in our case four different instances of CL_DD_AREA is used to represent the four fields. Now all the columns are placed within an instance of CL_DD_TABLE_ELEMENT, which itself is placed within the dynamic document instance created previously.

Class

Methods used

CL_DD_DOCUMENT

ADD_TEXT

NEW_LINE

UNDERLINE

ADD_TABLE

MERGE_DOCUMENT

DISPLAY_DOCUMENT

CL_DD_AREA

ADD_TEXT

CL_DD_TABLE_ELEMENT

ADD_COLUMN

SET_ROW_STYLE

NEW_ROW

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step1. Declare reference variables for document, table in document, and each column of the table.

 

Step2. Normal data selection to display in the report.

 

Step3. Create a custom screen 9100. Drag and drop a custom control into it and name it “CONTAINER9100”.

 

Step4. Call the screen 9100 in the ABAP program after data retrieval

 

Do the following steps in the PBO of the screen 9100:

 

Step5. Give Heading to the List to be displayed.

Instantiate Document object and call method ADD_TEXT to add the heading.

 

Step6. Insert table into document.

 

Step7. Add each column to the table.

 

Step8. Now to add different styles, fonts, colors to the different fields the method ADD_TEXT of class CL_DD_AREA is used, passing the required parameters.

 

 

To  display in different font sizes, the parameter sap_fontsize is to be passed ( Possible values: cl_dd_area=>small, cl_dd_area=>medium, cl_dd_area=>large ) alongwith the parameter text. For example,

 

CALL METHOD column1->add_text
EXPORTING text = text
sap_fontsize = cl_dd_area=>medium

To display text in different color, the parameter sap_color is to be used. The value can be any constant of class cl_dd_area with the description "SAP Color...".

For example,

 

 

To display text in Bold / italics the parameter sap_emphasis is to be used. Possible values are cl_dd_area=>strong for Bold text and cl_dd_area=>emphasisfor Italic text.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>