Use ABAP code to create a utility that allows you to download standard or custom SAP Smart Styles. With it, you’ll be able to download all SAP Smart Styles or a selection that you have defined, eliminating a normally laborious process.
Key Concept
SAP Smart Styles are used for formatting of printing documents that companies normally send outside of the company. These include sales orders, purchase orders, delivery notes, invoices, and quotations. SAP Smart Styles normally contain different types of information such as font size, color, family, and other attributes such as bold, italic, underline, text margin from the left, right, top and bottom, line spacing, indentation, and barcode information.
As an ABAP programmer, you have times when you want to download your work — whether it’s programs, custom SAP Smart Styles, applications, enhancements, or tables — to a different local system or external media. You might need to take it to another machine or another project that could benefit from the work you’ve developed.
Let’s take SAP Smart Styles as an example. Say you have 150 SAP Smart Styles that you wanted to move to another machine. The usual process involves downloading each SAP Smart Style individually, resulting in a repetitive, time-consuming process. I’ve developed a utility with ABAP code that allows you to download all custom or standard SAP Smart Styles in one effort. There is no third-party tool involved; it is completely based on the SAP system. To run it, you should have some basic knowledge of ABAP. I’ll start by showing you what the process to download SAP Smart Style usually requires, and then I’ll show you the code involved in my process.
The Usual Process
The typical way to download SAP Smart Styles directly is by using transaction SMARTSTYLES. Use transaction SMARTSTYLES and press Enter to see the main Smart Styles screen (Figure 1).

Figure 1
Main screen of SAP Smart Styles
Enter the name of the SAP Smart Style you want to download (e.g., ZABAP_STYLE1) (Figure 2). Follow menu path Utilities > Download Style to bring up the screen in Figure 3.

Figure 2
Enter the SAP Smart Style name

Figure 3
Download the SAP Smart Style
Press Enter or click the green check mark icon and the screen in Figure 4 appears. Choose the location to save the SAP Smart Style and click the Save button.

Figure 4
Save the SAP Smart Style
You would then need to repeat all these steps for every resulting SAP Smart Style. Now let’s look at the utility I’ve developed to simplify this process.
Utility to Download SAP Smart Styles
By using this utility, you can download all your custom and standard SAP Smart Styles, or you can download any single SAP Smart Style by entering its name in the selection screen.
Now I’ll show you the code for the utility. Figure 5 shows table ssfscreens, which is being used in the selection screen parameter name.

Figure 5
The tables of the utility
Figure 6 contains the code to use for the selection screen.

Figure 6
Code for the selection screen
Now let’s look at the code for the data definitions and declarations that you need for downloading the SAP Smart Style. Figure 7 shows the code for variables, internal tables, and types. You should include it right after the code in Figure 6.

Figure 7
Code for data declarations and definitions
Now you need to code the data selection of the SAP Smart Style you want to download. Figure 8 shows the code that retrieves all the SAP Smart Styles you want to download from table stxsadm. Then it shows you how to read the active SAP Smart Style information, after that read the SAP Smart Style header information and variants information. After that, download each SAP Smart Style in XML format using the subroutine xml_download_style. This code should come directly after the code in Figure 7.

Figure 8
Code for data selection
Then you need to code the path selection for where to save your SAP Smart Styles. Figure 9 shows code for a dialog box that appears when you press F4 in the first parameter of the selection screen. It asks you for the path details for where you want to save your SAP Smart Styles. Once you have selected your path, all your SAP Smart Styles are saved there. The function for displaying this dialog box is GUI_FILE_SAVE_DIALOG. The code in Figure 9 should appear directly after the code in Figure 8.

Figure 9
Code for the path to save your SAP Smart Styles
Now you need to define where you are going to download your SAP Smart Styles. The system makes an XML file of the SAP Smart Style. Figure 10 shows the code to convert your SAP Smart Style to XML format and make the XML file, which you can then download and save to the path that you defined. The code in Figure 10 should come right after the code in Figure 9.

Figure 10
Code for the XML file
After creating your program and entering the code in Figures 5 through 10, save your program, activate it, and make a transaction code of it. Alternatively, you can run the utility via transactions SE38 or SA38. You can download the entire code at the bottom of this article.
Now let’s look at the utility you’ve created. In this utility, there are only two parameters that you use: File Path, where you want to save your SAP Smart Styles, and Smart Style, which is the name of the SAP Smart Style that you want to download. If you wanted to download all your custom SAP Smart Styles, enter Z* and Y* (because all custom SAP Smart Styles start with a Z or Y). Figures 11 and 12 show the selection screen of this utility. Figure 11 is the main selection screen and Figure 12 shows how you can enter multiple SAP Smart Style names in the selection screen. After you’ve filled in these selections, click the execute icon or press F8 to bring up the screen in Figure 13 with the selection criteria you have selected in the Figure 11.

Figure 11
Selection screen of the utility

Figure 12
Dialog box for entering multiple SAP Smart Styles

Figure 13
Main selection screen for downloading SAP Smart Styles
Click the execute icon or press F8 and all custom SAP Smart Styles are downloaded into the path specified in the File Path field. Similarly, you can download all your standard SAP Smart Styles into the path by either entering the complete SAP Smart Style name or by entering letters that are common to multiple styles (e.g., sds*).
Exceptions
There are two notable exceptions to this utility. Note that these limitations apply with the standard transaction SMARTSTYLES as well.
- You can’t download any custom font used in the SAP Smart Style
- You can’t download any custom bar code used in the SAP Smart Style
Qazi Wasif Ali
Qazi Wasif Ali is an SAP ABAP certified consultant at Descon Engineering Limited in Pakistan. He has more than six years of SAP ABAP experience. He has a degree in computer science and has worked in industries such as packaging, beverages, and chemicals. Previously, he worked at Siemens Pakistan and Abacus Consulting. Qazi has also participated in support projects.
You may contact the author at qaziwasifali786@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.