Expand +



Flagging Records, (inserting Pictures when certain conditions are met) in SAP Queries

by Danielle Larocca, Senior Vice President of Human Capital Management, EPI-USE Labs

December 22, 2011

Danielle Larocca

When creating reports with SAP Query there may be occasions where you want to highlight or flag certain records for attention, real-world HR examples include:

  • Listing all associates and their salaries and flagging those that are over the maximum (or under the minimum) for their pay grade
  • Listing all associates and flagging those who are out on a leave
  • Listing all associates and their performance scores, flagging those who scored less than “meets Expectations”
  • Identify associates who are under (or over) a specified age (such as 18) to assist you in determining which associates are eligible for particular benefit programs or which require review
  • Identifying rehires who were previously terminated with a bad termination code

To do this we simply use calculated or local fields within your SAP Query.  I blogged on how to create a calculated field – check it out “Creating calculated fields in your report (How to Eliminate Duplicate Line Reporting in Query Tools)” here on SAPINSIDER. 

To insert a picture, only w hen certain conditions are met please follow the steps below.   This will insert a flag for associates born earlier than 1989 as shown in picture.


  1. Navigate to the Select Field screen (#2) of SAP Query
  2. Add a short name for the Year of Birth field from infotype 0002 and give it a short name (YBIRTH)
  3. Follow menu path Edit > Local field > Create and a dialog box will appear
  4. Give your new local calculated field a short name, field description, and heading
  5. Define the attributes of your new field by selecting icon
  6. Select the Complex calculation button
  7. In the Condition line, specify the expected value. You first list the short name you gave to the reference field (in the first step) followed by an operator and then followed by the value in single quotation marks.

Condition:  YBIRTH >  ‘1989’

8.  In the Formula line, specify what value you want to output. In this case you want to output a icon, so you select the icon button to select the picture you want. The Formula line is then updated with the name of that icon (A flag in this example is called ICON_DEFECT)

9. Basically, you are saying that if the year of birth is greater than 1989, output a red flag for that record

10. To check your logic, select the Check icon

11.  If no errors in your logic are found, select the green check mark icon to return to the Field definition dialog box

12. Select the green check mark icon to return to the Select Field (#2) screen

13. On the Basic List Line Structure screen (#5) be sure to add your new calculated field so that the field is included in your report output

14. Press F8 to execute your report to see your flagged records!  :)

Danielle Larocca, SpinifexIT

Connect with me on Linked In at

spinifex IT is the creator of Easy Reporter, the only SAP certified solution that runs live inside SAP for real time HR and Payroll reporting. Check it out for yourself online at or contact me for a live WebEx demonstration.


An email has been sent to:

More from SAPinsider


Please log in to post a comment.

Rinky Karthik

9/25/2013 8:59:57 PM

Hi Danielle,

Awesome article ! This surely will make the user community happy.