Abstract:

                  As we are aware, we can print the text in different colors as required in smartforms. It is easy to print the text in colors using the color feature in smart styles. Imagine there is a form, which is developed using SAP scripts and is been used for a quite long time. And now if there is a requirement to print some text in the form to print in a particular color, the only option available is to migrate to smartforms.

It would be of great help if this can be achieved with a little effort using the SAP scripts itself. Unfortunately there is no direct way provided by SAP as in smartforms to do the same, which gave me an opportunity to find out a way to do the same using SAP scripts.

This document explains how to print text in different colors in SAP scripts, what are all the different steps to be followed to achieve this.

Prerequisites:

  • Basic Knowledge in SAP scripts
  • Basic Knowledge in Smartforms

1.    Color Printing in Smartforms:Before going to the actual topic, we will see how to do this in smartforms. The color printing in smartforms is an easy & direct way provided by SAP to print the text in different colors.The option to choose the color is available in Smart Style as shown below.
Screen 1: Choose color in Smart StyleChoose_color.png

1.1. Steps to be followed:

    1. Create a format in the Smart Style by choosing a color in which the text to be printed.
    2. Use this format for the text in the Smartform to print that text in that particular color.
    3. Create different formats if the text to be printed in different colors and apply that particular format to the corresponding text to print the text in that color.

2.    Color Printing in SAP Scripts:

2.1. Work around done to achieve this functionality:

As we are aware, there is no such option provided by SAP in scripts to print the text in different colors. So some work around is done to achieve this functionality.

              

    1. Create a driver program to call the SAP Script (OPEN_FORM, WRITE_FORM and CLOSE_FORM) in order to get the OTF data.
    2. In the OTF data internal table, if the command is ‘ST’, it means the text. Before this line, insert a new line in the OTF internal table with the command ‘CT’ and for command parameters we need to give the font color (00800000 for yellow and FFFF0000 for green above).
    3. Call the FM ‘PRINT_OTF’.

2.2. Advantages:

    • The cost & effort that has to be incurred to migrate the SAP scripts to smartforms can be eliminated.
    • The coding effort will be minimal.

2.3. Testing Results:

The form can be printed in color as shown below.


Screen 2: Output of the Form

                        Result.png

Best Regards,

Sireesha Ch

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

    1. Volker Wegert

      @Mattew: Taking into consideration that this post only deals with the two outdated printing technologies, the only thing that comes to mind is “I see colored people”…

      (0) 

Leave a Reply