Creating Custom Fields and Business Logic for Accruals Management

This blog is about the extensibility of Accruals Management. If you are using Accruals Management for calculating, checking, and posting accruals, it is possible that you are not satisfied with the existing fields of an accrual object, or want to view the fields in specific apps, because every company has its unique business requirements. You may want to add more custom fields, or even create your own company-specific fields. Field extensibility, as we call it, refers to the capability to add customer-specific fields (custom fields) to the business context of an application.

The good news is that as of SAP S/4HANA 2022, we have enhanced the Accrual Engine by providing a BAdI for field mapping between tables so that you can add custom fields to an accrual object, no matter whether the fields are existing ones or are created from scratch. In this way, this extension feature can be applied to all accrual applications, including purchase order accruals, service entry sheet accruals, and manual accruals. Custom fields are filled in the process to release the data to Financial Accounting postings. For an overview of information about the accrual applications that are currently supported and the key steps of extensibility, please see the table below:

Words Before Example:

This blog provides an example that simulates a business scenario from the creation of a custom field for an accrual object to displaying it in apps. The steps in the example are applicable for both S/4HANA and S/4HANA Cloud, except for the additional step which is specifically for manual accruals to be registered in the Accrual Subobject Parameters table. For SAP S/4HANA, the example illustrates how to create a self-defined field for accrual posting using the Custom Fields and Custom Logic apps, though all the steps can be done in the back end via transaction codes SE11 and SE19.

Example:

You create a new field for Reason Code for an accrual object. As a result, this field is displayed in the Manage Journal Entry app after the system posts the accrual object. To do this, please follow these general steps:

  1. Create the custom field with the Coding Block business context.
    a. In the Custom Fields app, create a field for Reason Code. Provide the following example values for required details:
    * Business Context: Accounting: Coding Block (FINS_CODING_BLOCK)
    * Label: Reason Code
    * Identifier: YY1_reasoncode
    * Tooltip: Reason code
    * Type: Code List
    * Length: 3
    b. Enter the list values for the field, for example: 101 and 102
    c. Choose the UIs and Reports tab, enable the usage for the Manage Journal Entries app.
    d. Publish the custom field.
  2. Create the custom field with the Accrual Engine business context.
    a. In the Custom Fields app, create a field for Reason Code. Provide the following example values for required details:
    *Business Context: Accrual Engine (FINS_ACE)
    * Label: Reason Code
    * Identifier: YY1_reasoncode
    * Tooltip: Reason code
    * Type: Code List
    * Length: 3
    b. Enter the list values for the field, for example: 101 and 102
    Note: Make sure the list values of fields with different business contexts are exactly the same.
    c. Publish the custom field.
    During the process of creating the custom fields, you will notice that they have the same value for label and type, but with different business context and identifier ID.
  3. Implement BAdI Map Fields of Coding Block to Accrual (BADI_ACE_DOC_FIELDS_MAPPING) to map the two fields you’ve created.
    a. In the Custom Logic app, choose Create.
    b. In the New Enhancement Implementation dialogue box, provide the following values:
    * Business Context: Accrual Engine
    * BAdI Description: ACE Document fields mapping
    * Implementation Description: <Map fields from coding block to accrual engine>
    c. On the Available Fields tab, enter the code that includes your field and the corresponding business context. See the sample code:

    d. 
    Publish the custom logic.
  4. Implement BAdI Modify Journal Entry to enable the field values.
    Note: For S/4HANA Cloud, use BADI_ACE_DOCUMENT_SCHEMA_CLD. For S/4HANA, use BADI_ACE_DOCUMENT_SCHEMA_CUST.
    a. In the Custom Logic app, choose Create.
    b. In the New Enhancement Implementation dialogue box, provide the following values:
    * Business Context: Accrual Engine
    * BAdI Description: Modify Journal Entry Line Items
    * Implementation Description: <Map fields from coding block to accrual engine>
    c. On the Available Fields tab, enter the code that includes your field. See the sample code:

    d. Publish the custom logic.
  5. Validate the custom field in the Manage Journal Entry app.
    a. Schedule a posting job for the accrual object in the Schedule Accruals Jobs app.
    b. View the Reason Code field on the line item page of a journal entry.

For manual accruals (application ACAC), before you post accruals, it is recommended to also Implement BAdI BADI_ACE_DOCUMENT_SCHEMA_CUST, which can identify the parameters for accrual object categories. Please perform the following step on the back end after you finish the steps above.

  1. Run transaction code ACEIMG.
  2. Create an accrual object category in customizing activity Define Accrual Object Categories.
  3. Create an entry and assign a parameter for the category in customizing activity Assign Parameters to Accrual Object Categories.
  4. Run transaction code ACACTREE 02 and enter the new category for accrual object.
    If you don’t have an accrual object, create one using transaction ACACTREE01.
  5. On the Parameters tab, click Enter Parameters.
    Note: The parameter values display automatically.
  6. Save your changes to the accrual object.
    Note: Now you can see the accrual object in the Accrual Subobject Parameters table (ACESOBJ_PARAM) by running transaction code SE16N. This enables your custom fields for manual accruals to be displayed in the Manage Journal Entry app.

For more information about how to extend SAP Fiori app, please see: