Why an Icon is not a status…
Often and quite regularly I stumble upon developments where an SAP icon is used as a status.
The most ugly version of it looks like this:
IF header-status = '@01@' object-status = '@10@'. ENDIF.
There are many reasons to firstly not use the internal identification and secondly not use an Icon as equivalent to a status at all.
A status is a status is a status. The plural of “status” is “statuses”. But only in english! In German the plural for equal written singular form “Status” is “Status” (with a long “u”)! It sounds weird but that’s what Duden says.
What is a status?
A status is a flag that indicates the current condition of an object. The most common statuses are the the states of a sales document and the four-character states of production orders.
Sales order status
- A – Not yet processed
- B – Partially processed
- C – Completely processed
- space – not relevant
There are many status fields for different aspects like delivery status, invoiced status and so on.
The header statuses are often “total statuses” to represent the overall status for the items. If all items have been invoiced except for one then the overall invoicing status is “B”.
Technical explanatory note
The sales document statuses are stored in tables VBUK (Header statuses) and VBUP (item statuses). Since S4/HANA they have been moved to the specific document tables (VBAK + VBAP, LIKP + LIPS, VBRK + VBRP).
Production order status
The four-character language dependend status are like
- APPR – Approved
- DELD – Deleted
- PRT – Printed
Technical explanatory note
Each four-character status is represented by a five-digit status number. Internal status start with “I” and external defined status defined by customers have an “E” at the beginning.
Internal statuses are stored in TJ02 + TJ02T.
External statuses are stored in TJ30 + TJ30T
The statuses for an object are stored in tables JEST and JSTO.
Use function module STATUS_READ to get all statuses to an object.
Use function module STATUS_CHANGE_INTERN to change internal statuses. Use STATUS_CHANGE_EXTERN for external statuses.
What is an icon?
An icon is a simple representation of a real world object or condition. An SAP icon can be placed in the beginning of a dynpro field. There can be only one icon in one field. SAP has a set of about 1230 icons. An icon must be defined in table ICON and must be supported by the SAPGUI. Each icon has a name and can be addressed by a unique SAP name beginning with ICON_:
An Icon can easily be recognized by its starting and ending character “@”. In between there is a combination of two digits, like @1A@ A field that holds an icon must be at least four characters long.
When displaying an icon, you can also define an icon text that will be shown right from the icon. Very useful are tooltips. A tooltip is a max. 40 character long informational text that will be shown when moving with the cursor over the icon (MouseOver).
You can define the delay time after when the tooltip is shown in your SAPGUI in section Interaction Design – Notifications:
I always set it to “immediate” to instantly have the additional information.
Use function module ICON_CREATE to define an icon with additional text and tooltip.
The result will look like the following:
@0V\QPress this button to proceed@ Go on
As you cann clearly see: in this case four characters is not enough. To define an icon field that is capable of holding the icon, text and tooltip you should use the data element ICON_TEXT
You should create your own class ZICON and wrap the function module into method CREATE. Add TEXT and INFO as optional parameters and you can easily create icons:
myicon = zicon=>create( name = icon_okay info = 'press to continue' ).
Which is much more elegant and better to read than calling the function module. Additionally it eliminates the flaw if you forget to set the parameter “ADD_STDINF” to SPACE what will cause in some weird “information” in your application that does not fit to the context.
What icons do exist?
You can easily get an overview about the existing icons when executing report RSTXICON. In the result list you can see the icon itself, its name and the id. Feel free to use the search functionality CTRL + F which is available in any SAP list.
Icons are not scalable… 🙁 If you have a high definition screen (4K, Ultra-HD) and use windows scale-up, you will see artefacts_
Ca I define my own icons?
Grouping and usage
SAP has grouped and categorized their icons. These groups are not specified anywhere but they may be the cause if in a F4-value-Help for an icon, some icons are missing because SAP finds some icons not adequate to be shown somewhere.
The groups, classes and further characteristics can be seen in transaction ICON. There are columns that indicate if an icon should be used for a push button or as function key.
A short overview about how to use icons can be found in the SAP Status Guidlines.
1000+ icons on Abapcadabra.com
Some time ago I found a hidden gem on abapcadabra.com: 1000+ Icons report.
Wim Maasdam took some effort and grouped the SAP icons by usage.
There are two german words for icon. One – and I think most common – is “Ikone”. But this also is the picture of saints or a person you admire. the second – and IMHO more precise term – is “Piktogramm”. But I do not know anyone who uses this term. So also in german language the english noun “icon” is commonly used. The german word “Symbol” might also be used but this is a more universal term and not that computer specific.
Why an icon is not a status
Okay. Time to come to the point I started this post with: Why you should not equate a status with an icon.
First: A status is an internal reference of an objects state. This status of course can be visualized. Common visualizations are colors and icons. So if you want to display a certain icon because of a specific status, do it! But please leave the status itself and use a separate field that holds the iconic representation of this status.
Reasons for not using an icon as status:
- if the representation of a status changes you will have to change many usages.
- If the icon for a specific status is used at another part of your code, you will get confused.
- If you use additional information (text + tooltip) then the query can be faulty and is at least not very elegant.
- Queries are more meaningful if you ask for a specific status (is completed, is failed etc) instead of an icon name (ICON_TRANSPORTATION, ICON_CANCEL, …)
- Queries will get more and more complex the more statuses “evolve” and therefor less readable.
Status is not status
When using icons for your status representation be aware that there might be some circumstances where you will have to consider if this really is a status in the origin meaning or if it is an additional aspect of the outside view.
For example: you use LED icons to indicate whether an object is completed or not, what means that it can be processed (not completed) or not (complete).
After some testing you recognize that an object can be locked by another process or because of some errors when executed. So you put ICON_LOCKED in your “status” field if the object is locked. In this example the additional flag “locked” might be okay, because only incomplete objects can be locked. But what if there are several statuses for an object, like
- ready for processing
- processing failed
- no authorization
- database error
- processing ended with warnings – see protocol
In this case – if an object is locked – all the visualisation is reduced to “locked”. That might not help the user, because he/ she wants to select all “no authorisation” errors – whether they are locked or not.
You see, “locked” is not really a status. Or, yes, it is a status of course, but an additional one.
In my opinion, the best practice for using statuses in an application is the following:
- Be sure that you have a discrete status field with defined statuses.
- Define constants for these statuses
- define an output structure with a field for the status icon (data element ICON_TEXT)
- the column width should be adapted by default layout what must be defined at first use
- build a helper class which returns the following for a status
- the description
- the icon
- additional information (used for tooltip)
- the icon representation (fm ICON_CREATE): icon + text + info
- grap the opportunity to inform the user with a tooltip about what the status means.
- if there are any functional dependencies on a status (operations that are not allowed depending on a certain status), then also create a representation in your helper class. This makes your code clear and good to read. It shows the intention and not only IF queries for some statuses.
Fun with icons
If you want to see what icons can be used for, take a look at Bubble-la-Bap.
Very nice blog. However, I never thought we would have to talk about it 🙂
Thanks for this generic blog post, it was missing!
I used to display the icons via the program SHOWICON, which is the one indicated in the official ABAP documentation. See also the terms in the glossary: icon and status icon (in dynpros, use type ICONS-L2 for defining normal icons, and type ICONS-L4 for wide icons like horizontal traffic lights).
In CRM, instead of JEST, JSTO, there are the tables CRM_JEST, CRM_JSTO, function module CRM_STATUS_UDPATE, etc.
NB: to my French colleagues: the French translation of "Status" is "Statut" (in France, lots of people are obsessed with the exact spellings) There's also the same issue with the French word "Icône" concerning saints, the French word "pictogramme" can be used instead but is very rare.
Thanks for your additions, Sandra!
Yes, SHOWICON also works very good!
There are also reports SHOWSYMB and RSTXSYMB to show SAP symbols which also can be used in lists and ALV grids (demo report BCALV_TEST_GRID; last column).
Interesting that french people also have this status problem... 😉
A very nice blog post indeed.
And as pictures are worth a 1000 words, this one seems fitting:
Nice post Enno Wulff , you will be surprised to see how much scalable and better the icons in Fiori/ui5 are. (Not ABAP related, but some useful info)
Even in the fiori guidelines, icon is just an optional property in the status. But on the other hand, color makes it more contextual.
Again using color's when there is no meaning to it is also a bad thing
Thanks for your additional information, Mahesh!
I would have been indeed very disappointed, if fiori icons were not prepared for higher resolution! 😉
Nice blog! With unexpected side of deep dive into Linguistics. 🙂
I ran into some challenges you're describing: in one program, I thought it would be very neat to have a traffic light icon as visual representation of the item's state in an ALV report. But, of course, as soon as I showed it to the users, they came up with 2 different "statuses" that completely broke my red/yellow/green universe.
My personal icon pet peeve is when some developers get too excited about all the icons available and start using some stuff completely not in the SAP intended context and meaning. An ABAP screen is not the place to showcase one's individuality.
Thanks for sharing!
Thanks for your comment and personal experiences, Jelena!
The common meaning of icons should be respected because otherwise it's just confusing.
Today I read a release note to the SAPGUI 7.60 and therefor tried out again belize theme. Before I instantly switched back to Blue Chrystal theme because everything was different. In the release note SAP said that they added this "featue" to an option: Move main menu to "more" button. So I tried it again. It looks really nice. But working is harder than before because all the well-known icons are now (mostly) colorless and smaller than before.
If something like this happens than an "icon mess" is even more messy...
Comparison of old Blue Chrystal Theme (grey, top) and the Belize Theme (blue, bottom)