Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
ennowulff
Active Contributor
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.

Linguistic information


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_:

  • ICON_OKAY

  • ICON_CANCEL

  • ICON_LED_RED

  • etc


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.

Quickinfo/ Tooltip


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

HINT:

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?


No.

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.


Linguistic insertion


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

    • others



  • 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.

Best practice


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.

    • is_printing_allowed

    • is_saving_allowed




Fun with icons


If you want to see what icons can be used for, take a look at Bubble-la-Bap.

 

~Enno
8 Comments