Skip to Content
Product Information
Author's profile photo Heike Claus

[FPM TEAM] Relative Dates in SEARCH, LIST ATS and TREE UIBBs

You are an application developer who would like to develop an application with a list of all employees. When you present your application to the users, you are then asked to provide a list, for example, of all employees who were hired in a specific year, or in the last 3 months.

You have no idea how to create a dynamic filter in your list or how to define a corresponding search.

The solution is the interface IF_FPM_TOKEN_PROVIDER.

This Interface can be used within the SEARCH, LIST ATS and TREE UIBBs.

If you want to use a particular timeframe, the token is the solution. For any field in your application in which you want to use these tokens, you must add a reference of a class which implements the interface IF_FPM_TOKEN_PROVIDER in method GET_DEFINITION to the attribute REL_DATE_TOKEN_PROVIDER in table ET_FIELD_DESCRIPTION.

Let me explain the two methods of the interface in more detail:

  • Method GET_TOKENS
    • In this method you define special tokens (e.g. today, yesterday, last 3 months) for a specific field/component of your UIBB. Each token will have a name (that will be used in the method RESOLVE_TOKEN) and a text.
  • Method RESOLVE_TOKENS
    • This method is called when you run the application. As input, it receives the token defined in GET_TOKENS and resolves the token value. You can now resolve the token e.g. last your with the than actual last year.

Examples

Below are some real examples that are delivered by SAP.

Example: Search

This application has a search and a result list. In the search fields you have the flight date. Additionally, in the calendar on top of the F4 Help, you have the items that were defined in the token provider class.

Search%20Application

Search Application

 

 

Web Dynpro Application

FPM_TEST_SEARCH_OVP

 

Configuration

FPM_TEST_SEARCH_E_SBOOK_AC

 

Feeder Class

CL_FPM_TEST_SEARCH_E_SBOOK

 

Class CL_FPM_DATE_DEFAULT_TOKEN_PROV implements the relative dates for this SEARCH UIBB example.

Inside the feeder class, in the method IF_FPM_GUIBB_SEARCH~GET_DEFINTION, you find the class CL_FPM_TEST_SEARCH_E_DATE_PROV for the field FLDATE that is attached to field TOKEN.

Inside this class, the tokens are defined and resolved at runtime (at FLUSH), and when executing the search with event FPM_EXECUTE_SEARCH.

The method GET_DATA of the feeder class gets the correct date in the table ct_fpm_search_criteria for the field FLDATE.

Example: LIST ATS

In this example you have a list of employees. When you open the settings dialog box, you can filter, for example, for the entry date. Here you find the tokens above the calendar in a dropdown listbox.

Local class CL_FPM_AUNIT_LIST_REL_DATE  of feeder class CL_FPM_AUNIT_LIST_REL_DATE  implements the relative dates token for this LIST ATS example.

List%20Application

List Application

Web Dynpro Application

FPM_AUNIT_LIST_REL_DATE

 

Configuration

FPM_AUNIT_LIST_REL_DATE_AC

 

Feeder Class

CL_FPM_AUNIT_LIST_REL_DATE

 

The relative dates can be found at runtime in the for the fields Entry Date and Leaving Date.

Example: TREE

In this example you have a hierarchical list of employees. When you open the settings dialog, you can filter, for example, for the entry date. Here you find the tokens above the calendar in a dropdown listbox.

Tree%20Application

Tree Application

Web Dynpro Application

FPM_TEST_TREE

 

Configuration

FPM_TEST_TREE_REL_DATE_AC

 

Feeder Class

CL_FPM_TEST_TREE_RELATIVE_DATE

 

Class CL_FPM_TEST_TREE_RELATIVE_DATE implements the relative dates token for the TREE UIBB example. In this case, it is the feeder class itself

The relative dates can be found at runtime in the Filter and Conditional Formatting for the fields Entry Date and Leaving Date.

 

Hopefully, you now understand the behavior of the tokens in the LIST ATS, TREE and Search UIBBs, and are able to create your own applications using this feature.

 

 

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Julia Bender
      Julia Bender

      Thanks, Heike! I just needed exactly this information 😉

      All the best, Julia