ABAP code for Date Rule

Problem: you want to execute a function module for the Date Rule calculation.

Solution: To do so you need to put name of the called FM in the Date Rule’s XML definition. The XML should look as shown below.

< ?xml version="1.0"?>
<SAPTimeRule>
  <ABAPTimeRule function="Z_EXAMPLE_DATE_RULE"/>
</SAPTimeRule>
< ?xml version="1.0"?>
<SAPTimeRule>
  <ABAPTimeRule function="Z_EXAMPLE_DATE_RULE"/>
</SAPTimeRule>

The Date Rule FM should have an interface as presented below.

FUNCTION z_example_date_rule.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(CONTEXT) TYPE REF TO  IF_TIMECONTEXT
*"     REFERENCE(TIMEMESSAGE) TYPE REF TO  CL_TIMEMESSAGE
*"  EXPORTING
*"     REFERENCE(ERROR) TYPE  XFLAG
*"----------------------------------------------------------------------
ENDFUNCTION.
FUNCTION z_example_date_rule.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(CONTEXT) TYPE REF TO  IF_TIMECONTEXT
*"     REFERENCE(TIMEMESSAGE) TYPE REF TO  CL_TIMEMESSAGE
*"  EXPORTING
*"     REFERENCE(ERROR) TYPE  XFLAG
*"----------------------------------------------------------------------
ENDFUNCTION.

For an example see the Date Rule: 000000000002 and FM: CRM_DATES_ORDERPLANNED_TR.

Komentowanie jest zakończone.