Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Use Case: All goods and invoice receipts are collected on GR/IR accounts. If amounts and prices match, they are automatically cleared by the system. However, not all items can be cleared automatically, for various reasons:

  • Invoice or goods receipt is missing
  • Amounts do not match
  • Purchase order item was created with an outdated price list
  • Delivery costs were posted on the wrong GR/IR account

The GR/IR account reconciliation process is an exception-handling process for all purchase order items with differences between goods receipts and invoice receipts. This is a highly manual process that delays the period-end closing.

 Business Benefits:

  • Increase the GR/IR matching rate
  • Lower manual efforts
  • Increase efficiency of end users
  • Accelerate the period-end closing

Service Type: This is a Machine Learning service which means machine is expecting training data. It does not mean that you need to create data, since the S/4HANA system is expected to have  historical records of reconciled GR/IR accounts, and specifically manual assignments of purchase order items.

What is the outcome? The proposal service with machine learning automatically proposes next steps for items that could not be matched, based on the status and situation of a purchase order item. For intelligent GR/IR accounts reconciliation, proposals are made for PriorityStatusRoot CauseProcessor, and Processing Department.

Configuration Steps:

Environment: S/4HANA 2023 FPS01 and BTP

Frontend : Fiori App Reconcile GR/IR Accounts.

Prerequisite: It is expected you have a sub-account in SAP BTP and have entitlements and quotas for subaccounts (refer to help doc if you need more info)

Provided you have the above the following steps are specific for the AI configuration:

  1. Create Service Instance and Keys

In BTP-->Under Services-->Open Service Marketplace --> Choose Data Attribute Recommendation tile

shonalikellogg02_0-1712194435817.png

 Create a new service instance by choosing Create

shonalikellogg02_2-1712194478666.png

Select the plan Intelligent Accounting, fill in the desired instance name and choose Create (since this is an internal system – I have “free” plan, please don’t expect the same at your end)

shonalikellogg02_3-1712194489970.png

Select Next to create Service Key

Sample Code

{

"url":"",

"uaa": {

"clientid":"",

"clientsecret": "",

"url": ""

}

}

shonalikellogg02_4-1712194500225.png

Review and click create

shonalikellogg02_5-1712195083399.png

A json file will be created, please note the below for the next steps:

Host Name

url

OAuth 2.0 Endpoint

uaa.url

OAuth 2.0 Token Endpoint

uaa.url + “oauth/token”

Username

uaa.clientid

Password

uaa.clientsecret

2. Create RFC Destination

In SAP S/4HANA system run transaction SM59 and create a connection of type G (HTTP Connection to External Server).

For example:

  • For DESTINATION_PROPOSALS, use path prefix /

shonalikellogg02_6-1712195271326.png

Ensure you do a connection test post saving the RFC, this will tell you if the host URL you entered is correct or not. I used the uaa URL

Run transaction OA2C_CONFIG and create the oauth client for the profile FIS_GRIR_ML, which consists of the client ID, client secret and URL specified in the step1 (JSON file)

shonalikellogg02_7-1712195328749.png

In the Access Settings section of the client, select the following values:

Setting

Value

Client Authentication

Basic

Resource Access Authentication

Header Field

Selected Grant Type

Client Credentials

shonalikellogg02_8-1712195410397.png

Run transaction S4ML_GRIR_SETUP, and specify the RFC destination DESTINATION_PROPOSALS that you created before (the program throws an error since it expect Health RFC as well, specify same RFC for both)

Activate the Save checkbox to save the configurations for use

shonalikellogg02_9-1712195435197.png

3. Setup jobs 

This is the last step, there are 3 jobs to be scheduled:

Training job

Call up transaction SM36 or choose System  Services  Jobs  Define Job.

When choosing the job wizard for scheduling the training job, you enter a job name and choose Continue.

Choose ABAP program step and enter FIS_GRIR_ML_DAR_TRAIN as ABAP program name and choose Continue.

To set the running schedule according to your requirement, choose one of the start conditions for the job definition.

See Job log- if there is no data for training, the log will show 0 data selected. In order for machine to learn, there need to be some data set in the system

 

Inference Job

Call up transaction SM36 or choose System  Services  Jobs  Define Job.

When choosing the job wizard for scheduling the training job, you enter a job name and choose Continue.

Choose ABAP program step and enter FIS_GRIR_ML_DAR_INFERE as ABAP program name and choose Continue.

To set the running schedule according to your requirement, choose one of the start conditions for the job definition.

Monitor Job

all up transaction SM36 or choose System  Services  Jobs  Define Job.

When choosing the job wizard for scheduling the training job, you enter a job name and choose Continue.

Choose ABAP program step and enter FINS_ML_DAR_MONI as ABAP program name and choose Continue. (The guide has misspelled the job as FIS_ML_DAR_MONI -> please take note)

To set the running schedule according to your requirement, choose one of the start conditions for the job definition.

     You might want to set the frequency for running this job to every 10 minutes

shonalikellogg02_10-1712195444695.png

Output:

shonalikellogg02_1-1712194460423.png

Once the model is trained, in the FIORI app you should be able to see proposals made for PriorityStatusRoot CauseProcessor, and Processing Department. If there is no data these fields will remain empty on the app.

Let us know how you go at your end by adding your views under comments. 

 

 

1 Comment