Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Reference to predefined objects of the framework

xxxx

All references in dynamic parameter are case-insensitive, except of string literals. It means that $ctx‑reference_no works the same as $CTX‑REFERENCE_NO. But $tsk‑$property('VIN') is not the same as $tsk‑$property('Vin') although internal implementation of the corresponding function (like built-in function property for Task instance) can ignore case for input parameters.

Attribute nesting

You can access nested attributes of the variable. Variable must be flat structure - accessing internal table lines is not supported. Sub-attributes must be separated by hyphen '-'. Any level of nesting is supported.

Examples:

  • task_priority-high – refers to component high of predefined, global constant task_priority.

  • cl_global_class-header-field – refers to field field of structure header, which is static attribute of global class cl_global_class.

  • $source-ms_detail-customer-name1 – gets ms_detail attribute of the source business object, then accesses component customer of the ms_detail attribute and finally reads field name1 of customer component; both ms_detail and customer must be structure-type components.

Calculations

Dynamic parameter supports simple calculation: addition. You can define value as combination (summary) of more than one component. Each component must be valid value in terms of dynamic parameter. Components must be separated by '+' sign.

Depending on the resulting type of the components, the calculation can be concatenation (for character-like components) or addition (for numbers, dates, etc).

Examples:

  • sy-datum + 2 results in date equal to two days after today,

'PFCG_ROLE_A_' + t001w-werks + '_ABC' is translated into string 'PFCG_ROLE_A_0001_ABC' (assuming t001w-werks is globally accessible and equal to '0001').

Function callings

Dynamic parameters support not only access to static variables but allow also function execution. Functions in terms of dynamic parameter can be provided in following ways:

  • Predefined (built-in) Communication Framework function,

  • Customer-defined function (including any compatible method of the global class),

  • Function defined by source object implementation.

Function execution can be defined in dynamic parameter using special syntax. It looks similar to simple variable access, but in contrast to it, functions can support input parameters. Parameters can be provided to function by putting them as comma-separated list in parentheses ‘()’. If function does not require any parameter, or you don’t want to pass any parameter and they are not obligatory, the parentheses can be omitted. Parameter values are passed to the function by their sequence. You can skip parameter only if it is not obligatory and there is no other parameter that must be provided after it. Each parameter must be valid value in terms of dynamic parameter. It means that parameter can be specified as constant, reference to variable or even another function call.

New functions can be implemented in two ways:

  • As class method,

  • As source object function (via source-object provider implementation).

Any class method is function-compatible when following conditions are met:

  • It is accessible in the context of the execution. This is always true for public static method of the global class.

  • It has zero or more importing parameters.

  • It has exactly one returning parameter.

Customer can define his own functions by implementing compatible methods in global classes in customer namespace or use any compatible method in already existing class.

Such functions can be called using following syntax:

$func|$fnc|$f-<class_name>-<method_name>[(parameter1, parameter2, …)]

Examples:

  • $fnc-zcl_utils-get_user_name(sy-uname)

o   Calls method get_user_name of class zcl_utils, providing current username as first input parameter.

It is also possible to define functions that refers directly to source object during task/notification processing. In this case, function call is passed to the source object via source object provider implementation (refer to BAdI for source object provider). This way customers can add new functions to standard/already existing source objects or define functions for own source object implementation. During function execution, system passes function name together with parameter values into method /DBE/IF_CF_ENH_SRCOB_PROVIDER~GET_ATTRIBUTE of BAdI /DBE/CF_SRCOB_PROVIDER. Internal logic of this method is fully responsible for providing correct result for the call, based on input parameters.

Functions of this type can be called using following syntax:

$source|$src|$s-$<function_name>[(parameter1, parameter2, …)]

Examples:

  • $src-$partner_name('WE', true)

o   Call function partner_name of current source object providing ‘WE’ as input parameter.

o   Technically method GET_ATTRIBUTE of BAdI /DBE/CF_SRCOB_PROVIDER is called in this case with following input:

  • IS_SOURCE_ID > contains identification of the current source business object,

  • IV_ATTRIB > is set to value ‘$partner_name’,

  • IT_PARAMS > contains value ‘WE’ in first line and value ‘X’ (internal representation of ABAP true value) in second line.

The BAdI implementation must then provide valid value as result of the call.

List of delivered attributes, function, DDP operators

Predefined attributes

...

Examples:

  • true – equivalent for ‘X’

  • ms_trigger_data-task_action – ID of the Task Action in case processing was triggered by action

  • notif_priority-high – constant for high notification priority high (‘3’).

Predefined functions

...

Examples:

  • $fnc-count($task-@attachment) – returns number of task attachments; refer to task instance special attribute @attachment for details

  • $fnc-username($src-header_detail-ernam) – returns name of the source object creator (assuming source object provides creator username in field ERNAM of HEADER_DETAIL attribute

  • $f-days_since($src-header_detail-erdat) – returns number of days since the source document creation.

Source objects

...

Examples:Source business object in the scope of task instance or notification. In this case you can access any attribute supported by the object provider (refer to BAdI for source object provider and check list of objects delivered by the framework).

Usage syntax:

Code Block
$source|$src|$s-<attribute>[-<subattribute1>[-<subattribute2>…]]

Communication task instance. Here you can access any attribute available from task instance header detail structure. Additionally, there are some special attributes supported (refer to the description of task special attributes).

Usage syntax:

Code Block
$task|$tsk|$t-<attribute>[-<subattribute1>[-<subattribute2>…]]

Current trigger context. You can access value of any context field by parameter name. The result can be single value or a list (in case of parameter with multiple values).

Usage syntax:

Code Block
$context|$ctx|$c-<field_name>

All of the above objects (source business object, task instance, context) beside simple attribute access, support also function calls. It includes build-in functions (provided by the standard Communication Framework engine implementation) and customer defined functions, provided by dedicated BAdI implementations. For details on function definition please refer to function calling chapter.

Usage syntax:

Code Block
$task|$tsk|$t-$<function_name>[(<param1>, <param2>, ...)][-<subattribute1>[-<subattribute2>…]]

$source|$src|$s-$<function_name>[(<param1>, <param2>, ...)][-<subattribute1>[-<subattribute2>…]]

$context|$ctx|$c-$get|$cnt[(<param1>, <param2>, ...)][-<subattribute1>[-<subattribute2>…]]

Examples:

  • $src-ms_vbak_com-vbeln – in case of VSS Order as source object, this gets field ‘vbeln’ of attribute ‘ms_vbak_com’ of VSS Order instance; check attribute nesting chapter below for more details; list of all available attributes can be found in documentation.

  • $tsk-duedate – gets attribute ‘duedate’ of communication task instance; for list of all available attributes of task instance, please refer to documentation.

  • $tsk-$property('VEHICLE_NO') – calls built-in function ‘PROPERTY’ of the task instance, passing ‘VEHICLE_NO’ as function parameter$

  • ctx-reference_no – gets value of parameter ‘REFERENCE_NO’ from current trigger context.

  • $ctx-@attachment – gets value of parameter ‘@ATTACHMENT’ from current trigger context; if there was more than one context params with the same name, the result of this dynamic parameter will be list of strings, containing all values found.

  • $ctx-$cnt('JOBNR') – gets number of occurrences of field with name ‘JOBNR’ in the context.

Function call

Communication Framework supports framework-predefined built-in functions and customer-defined functions as well. Function in general is a part of logic, that is executed on demand and should return single result value based on input parameters.

Function can take zero, one or more importing parameters. Each parameter can be any type. Function must return one single returning value. Returning value can be any type. Parameters to functions can be provided in parentheses, comma separated. Parameters are referenced by their order (so parameter name plays no role from function call perspective).

Refer to chapter function calling for more details.

Function can be provided as:

  • Global function (framework-predefined or customer defined),

  • Source object function (framework-predefined or customer defined),

  • Task instance function.

Global predefined functions are provided by Communication Framework. You can check the list of all available functions in documentation. Such functions are called using syntax:

Code Block
$function|$fnc|$f-<function_name>[(<param1>, <param2>, ...)]

Global customer-defined function indicates each compatible, publicly available class method. Compatible means, that interface of the method must conform to function requirement. Publicly available means public static method. This way any public static method of global class, with compatible interface, can be used as function in Communication Framework dynamic parameter. It can be SAP-delivered or customer-defined class. Functions of this type are called using following syntax:

Code Block
$function|$fnc|$f-<class_name>-<method_name>[(<param1>, <param2>, ...)]

Source object functions are functions offered by source object provider implementation. Customer can define his own function both in predefined source object and in customer-defined objects by implementing corresponding source object provider BAdI. Source object functions are called using following syntax:

Code Block
$source|$src|$s-$<function_name>[(<param1>, <param2>, ...)]

Task instance functions are functions offered by Communication Task instance implementation. List of all available functions can be found in documentation. Such functions are called using following syntax:

Code Block
$task|$tsk|$t-$<function_name>[(<param1>, <param2>, ...)]

Context functions are functions offered by Communication Task context. List of all available functions can be found in documentation. Such functions are called using following syntax:

Code Block
$context|$ctx|$c-$<function_name>[(<param1>, <param2>, ...)]

Examples:

  • $fnc-username(sy-uname) – calls built-in global function ‘USERNAME’, providing sy-uname as input parameter.

  • $fnc-zcl_util-read_text('HEADER', 'Z001', $src-detail-vbeln) – calls static method ‘READ_TEXT’ of global class ‘ZCL_UTIL’, providing 3 parameters.

  • $src-$get_field_job('000001', 'DESCR1') – calls built-in function ‘GET_FIELD_JOB’ of VSS Order source object provider, passing 2 parameters.

  • $task-$actor_key('RES') – calls built-in task function ‘ACTOR_KEY’ with one parameter.

  • $ctx-$get($src-zzname) – calls built-in context function ‘GET’ with parameter read from source object field ZZNAME.

Dynamic date

Communication Framework provides Dynamic Date Processor (DDP), that can be used to dynamically create date value. To use DDP, you must declare specific DDP operator together with parameters (optional). As result, single date value (of internal type DATS) is generated. List of all available DDP operators can be found in documentation.

Dynamic date utilizes function call denotation for definition and parameter passing. It can be defined using following syntax:

Code Block
$date|$d-<operator>[(<param1>, <param2>)]

Examples:

  • $date-month_end(6) – gets end of June of the current year.

  • $d-week_begin – gets begin of the current week.

Case sensitivity

All references in dynamic parameter are case-insensitive, except of string literals. It means that $ctx‑reference_no works the same as $CTX‑REFERENCE_NO. But $tsk‑$property('VIN') is not the same as $tsk‑$property('Vin') although internal implementation of the corresponding function (like built-in function property for Task instance) can ignore case for input parameters.

Error handling

If dynamic parameter refers to non-existing attribute, non-existing context parameter or not existing or invalid function, it simply returns no value. No error is raised in this case and task/notification processing is not aborted. It depends on the usage, whether no value gives reasonable result or not.

Attribute nesting

You can access nested attributes of the variable. Variable must be flat structure - accessing internal table lines is not supported. Sub-attributes must be separated by hyphen '-'. Any level of nesting is supported.

Examples:

  • task_priority-high – refers to component high of predefined, global constant task_priority.

  • cl_global_class-header-field – refers to field field of structure header, which is static attribute of global class cl_global_class.

  • $source-detail-customer-name1 – gets detail attribute of the source business object, then accesses component customer of the detail attribute and finally reads field name1 of customer component; both detail and customer must be structure-type components.

Calculations

Dynamic parameter supports simple calculation: addition/concatenation. You can define value as combination (summary) of more than one component. Each component must be valid value in terms of dynamic parameter. Components must be separated by '+' sign.

Depending on the resulting type of the components, the calculation can be concatenation (for character-like components) or addition (for numbers, dates, etc).

Examples:

  • sy-datum + 2 results in date equal to two days after today,

  • 'PFCG_ROLE_A_' + $src-detail-plant + '_ABC' assuming $src-detail-plant contains value ‘0001’, the result is decoded into string 'PFCG_ROLE_A_0001_ABC'.

Function calls

Dynamic parameters support not only access to static variables but allow also function execution. Functions in terms of dynamic parameter can be provided in following ways:

  • Predefined (built-in) Communication Framework function,

  • Customer-defined function (including any compatible method of the global class),

  • Function defined by source object implementation.

Functions are specified in dynamic parameter using special syntax. It looks similar to simple variable access but supports additionally input parameters. Parameters can be provided to function by putting them as comma-separated list in parentheses ‘()’. If function does not require any parameter, or you don’t want to pass any parameter as they are optional, the parentheses can be omitted. Parameter values are passed to the function by their sequence. You can skip parameter only if it is not obligatory and there is no other parameter that must be provided after it. Each parameter must be valid value in terms of dynamic parameter. It means that parameter can be specified as constant, reference to variable or even another function call.

New functions can be implemented in two ways:

  • As class method,

  • As source object function (via source-object provider implementation).

  • As task instance function (via CMF Task BAdI implementation).

Any class method is function-compatible when following conditions are met:

  • It is accessible in the context of the execution. This is always true for public static method of the global class.

  • It has zero or more importing parameters.

  • It has exactly one returning parameter.

o   In general, type of the return parameter is not restricted, but it should be the type that can be used as dynamic parameter value. It includes any primitive type, structure type or table type.

Usage syntax:

Code Block
$func|$fnc|$f-<class_name>-<method_name>[(param1, param2, …)][-<subattribute1>[-<subattribute2>…]]

Examples:

  • $fnc-zcl_utils-get_user_name(sy-uname)

o   Calls method get_user_name of class zcl_utils, providing current username as first input parameter.

It is also possible for customers to define functions that work as built-in functions in source object or Task instance. In that case, function call is passed to the source object via source object provider implementation (refer to BAdI for source object provider) or Task instance (refer to BAdI for CMF Task processing). With that approach, customers can add new functions to standard/already existing source objects or define functions for own source object implementation. During function execution, system passes function name together with parameter values into corresponding method of the BAdI implementation:

  • For business source object

o   BAdI:  /DBE/CF_SRCOB_PROVIDER

o   Method: /DBE/IF_CF_ENH_SRCOB_PROVIDER~GET_ATTRIBUTE

  • For Task instance

o   BAdI: /DBE/CF_TASK

o  Method: /DBE/IF_CF_ENH_TASK~GET_FIELD

Internal logic of the method is fully responsible for providing correct result for the call, based on input parameters.

Usage syntax:

Code Block
$source|$src|$s-$<function_name>[(param1, param2, …)][-<subattribute1>[-<subattribute2>…]]

$task|$tsk|$t-$<function_name>[(param1, param2, …)][-<subattribute1>[-<subattribute2>…]]

Examples:

  • $src-$partner_name('WE', true)

o   Call function partner_name of current source object providing ‘WE’ and true as input parameter.

o   Technically method GET_ATTRIBUTE of BAdI /DBE/CF_SRCOB_PROVIDER is called in this case with following input:

IS_SOURCE_ID -> contains identification of the current source business object,

IV_ATTRIB -> is set to value ‘$partner_name’,

IT_PARAMS -> contains value ‘WE’ in first line and value ‘X’ (internal representation of ABAP true value) in second line.

The BAdI implementation must then provide valid value as result of the call.

Predefined attributes, functions, DDP operators

Global attributes

TRIGGER

  • Information about current event/action trigger

  • Type: /DBE/CF_STR_ITRIGGER_DATA (DDIC structure)

TRUE

  • Constant value abap_true (‘X’)

  • Type: ABAP_BOOL

FALSE

  • Constant value abap_false (‘ ‘)

  • Type: ABAP_BOOL

UNDEFINED

  • Constant value abap_undefined (‘-‘)

  • Type: ABAP_BOOL

INITIAL

  • Initial value (empty string)

  • Type: String

DATE

  • Constants for date

  • Type: DATS

  • Components

o   MIN (equal to 00-00-0000)

o   MAX (equal to 31-12-9999)

TIME

  • Constants for time

  • Type: TIMS

  • Components:

o   MIN (equal to 00:00:00)

o   MAX (equal to 23:59:59)

NOTIF_PRIORITY

  • Constants for notification priority

  • Type: CHAR(1)

  • Components:

o   NOT_SPECIFIED

o   LOW

o   MEDIUM

o   HIGH

o   CRITICAL

TASK_PRIORITY

  • Constants for Task priority

  • Type: CHAR(1)

  • Components:

o   NOT_SPECIFIED

o   LOW

o   MEDIUM

o   HIGH

o   CRITICAL

Examples:

  • true – equivalent for ‘X’

  • trigger-event_id– ID of the Communication Framework event currently processing

  • trigger-task_action – ID of the Task Action in case processing was triggered by action

  • notif_priority-high – constant for high notification priority high (‘3’).

Predefined functions

COUNT

  • Returns number of lines for table-type variable and 1 on case of any other not empty variable.

  • Parameters:

o   Variable [any]

  • Result:

o   Number

LENGTH

  • Returns text length for character-like variable and 0 for any other variable.

  • Parameters:

o   Variable [any]

  • Result:

o   Number

USERNAME

  • Returns long name of the SAP user provided as input parameter

  • Parameters:

o   SAP user ID [character-like]

  • Result:

o   String

CUSTOMER_NAME

  • Returns customer name for customer number. GDPR conditions are considered.

  • Parameters:

o   Customer number [KUNNR]

  • Result:

o   String

DAYS_SINCE

  • Calculates number of days that passed from specific date. If provided date is from the future, result is negative.

  • Parameters:

o   Date [DATS]

  • Result:

o   Number

WRITE

  • Returns output presentation of variable passed as input parameter.

  • Parameters:

o   Variable [any]

  • Result:

o   String

FORMAT

  • Formats text based on template and up to 9 parameters. Template variable must be defined as: &n, where n is variable number.

  • Parameters:

o   Template [character-like]

o   Variable 1 [any, optional]

o   Variable 2 [any, optional]

o   Variable 3 [any, optional]

o   Variable 4 [any, optional]

o   Variable 5 [any, optional]

o   Variable 6 [any, optional]

o   Variable 7 [any, optional]

o   Variable 8 [any, optional]

o   Variable 9 [any, optional]

  • Result:

o   String

 Examples:

  • $fnc-count($task-@attachment) – returns number of task attachments; refer to task instance special attribute @attachment for details

  • $fnc-username($src-header_detail-ernam) – returns name of the source object creator (assuming source object provides creator username in field ERNAM of HEADER_DETAIL attribute

  • $f-days_since($src-header_detail-erdat) – returns number of days since the source document creation.

Source objects

VSS Order

Object ID

  • Class: BO

  • Type: BUS2400

Attributes

HEADER

  • Access to MS_VBAK_COM attribute of the VSS Order instance

  • Data type: DDIC structure /DBE/VBAK_COM

HEADER_DB

  • Access to MS_VBAK_DB attribute of the VSS Order instance

  • Data type: DDIC structure /DBE/VBAK_COM

DIALOG_CONTROL

  • Access to MS_DIALOG_CONTROL of the VSS Order instance

  • Data type: DDIC structure /DBE/OE_DIALOG_CONTROL

Built-in functions

GET_JOB

  • Access to the Job data

  • Parameters:

o   Job number [character-like | number]

  • Result type: DDIC structure /DBE/JOB_COM

GET_JOB_FIELD

  • Access to the single Job field value

  • Parameters:

o   Job number [character-like | number]

o   Field name [character-like]

Result type: any

GET_ITEM

  • Access to the Item data

  • Parameters:

o   Item number [character-like | number]

  • Result type: DDIC structure /DBE/VBAP_COM

GET_ITEM_FIELD

  • Access to the single Item field value

  • Parameters:

o   Item number [character-like | number]

o   Field name [character-like]

  • Result type: any

GET_DPR

  • Access to the DPR document data

  • Parameters:

o   DPR document number [character-like (BELNR_D)]

  • Result type: DDIC structure /DBE/ORD_DPR_LIST

GET_PARTNER_INFO

  • Get data for the partner of the given role. If there are more than one partner for the role, only first one is selected.

  • Parameters:

o   Partner function [CHAR 2 (PARVW)]

optional, default: ‘AG’

  • Result type: DDIC structure /DBE/ORD_PARTNER_S

GET_PARTNER_NAME

  • Get name of the partner in given role. If there are more than one partner for the role, only first one is selected. Takes GDPR rules into account.

  • Parameters:

o   Partner function [CHAR 2 (PARVW)]

optional, default: ‘AG’

o   Use manual address data [boolean]

Optional, default: false

  • Result type: string

 Examples:

  • $src-ms_vbak_com-vbeln – for VSS Order as source object: return VSS Order number (field VBELN of attribute MS_VBAK_COM).

  • $src-$get_field_job($ctx-/dbe/jobnr, 'DESCR1') – for VSS Order as source object: return value of field DESCR1 of Job with number provided by context parameter /DBE/JOBNR.

  • $src-$get_item($ctx-/dbe/posnr)-zmeng – for VSS Order as source object: return value of the field ZMENG (quantity) for order item number equal to context field /DBE/POSNR.

  • $src-$get_partner_name('AG', true) – for VSS Order as source object: returns Sold-To-Party name; when manual address has been entered in the order, it takes name from order document, not customer master data.

Task instance

...

Examples:

  • $task-xreatm_ext – returns ‘X’ (ABAP ‘true’) when expected reaction time has exceeded

  • $task-$actor_key('RES') – returns recipient key for the ‘Responsible’ actor role

  • $task-@text – returns content of the last comment

  • $task-@text-description-created_at – returns time of the task description update

  • $task-@property-vin – returns value of the ‘VIN’ task property

  • $task-@attachment-image/* – returns ID of all image attachments (result is a list of attachment ID)master data.

SRS Order

Object ID

  • Class: BO

  • Type: /DBME/WORD

Attributes

Any field from DDIC structure /DBME/WMA_STR_ORDH_DATA.

VSS Vehicle
Object ID
  • Class: BO

  • Type: /DBE/VEHI

Attributes

Any field from DDIC structure VLCVEHICLE.

 

DPF Transaction
Object ID
  • Class: OT

  • Type: /DBE/DP_TRANSACTION

Attributes

Any field from DDIC structure /DBE/DP_STR_PYMNT_TR_DETAIL.

xxxx

Dynamic Date Processor operators

...