Show TOC Start of Content Area

Object documentation Macros  Locate the document in its SAP Library structure

Definition

A series of commands and procedures that are carried out in response to a single command or keystroke, or identified by a single name.

Use

You use macros to configure UI patterns in CAF Core to calculate field values based on physical field properties in the Logical Data Source tab pages of the Flex Tree and History Log components. In these applications, you use macros to define field variants.

Structure

CAF Core uses the following predefined set of macro functions:

     @switch

This macro evaluates the contents of the mapped physical field and compares it with the logical field name until it makes a match. The result is the value contained in the logical field. The macro @switch returns value, default_value if there is no corresponding logical field. The macro returns the value nullif a default value is not specified.

Example

@switch(@level(), “Category“, false, true)

     @format

This macro evaluates the aspect field and calls the java.Text.MessageFormat format. The macro @format combines the macro function with the logical field and array of arguments as parameters. The result is new formatting of a field aspect.

Example

@format(

“CreatedAt:\n {0}\nCreated By:\n {1}\nDescription:\n {2}“,

[createdAt],

[createdBy],

[description]

)

     @level

This macro returns the name of the level you are currently evaluating in the application.

     @component_mime

This macro returns the absolute web resource URL of the component’s mime. It takes the development component (DC) name, component name, and relative path as parameters.

Example

@component_mime(

“sap.com/caf~UI~ptn~historylog”,

“com.sap.caf.ui.pt.historylog.components.log.HistoryLog”,

“buttons/buttons-preview.gif”

)

     @app_mime

The macro returns the absolute web resource URL of the application’s mime. It takes the DC name, application name, and relative path as parameters.

     @dc_mime

The macro returns the absolute web resource URL of the development component’s mime. It takes the DC name and relative path as parameters.

     @sap_mime

This macro returns the absolute web resource URL to the standard image.

Example

@sap_mime(“s_b_disp.gif“)

     @substring

This macro returns substring expressions similar to the java.text.String substring function.

Example

@substring([FullName], 0, 50)

End of Content Area