cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to enhance Machine Learning for C4C v1

mracantonius1
Explorer
659

Hi - we have a new requirement where the ML for Service should only work for specific Ticket Type and Channel. I know we have Enhancement Spot for ML but not sure where to start.

Thanks!

Marc

Accepted Solutions (1)

Accepted Solutions (1)

mracantonius1
Explorer
0 Likes

I found the answer and just sharing here:

Enhancement Option: MachineLearningObjectPredictionWrite

Overview

NameMachineLearningObjectPredictionWrite
Namespacehttp://sap.com/xi/AP/CRM/MachineLearning
DescriptionIndicator for ML Prediction
TypeMultiple Use
Deployment UnitCustomerRelationshipManagement

Public Solution Model

Release StatusReleased

Operation: IS_PREDICTION_REQUIRED

Check if ML prediction needs to be performed

Parameter Type Data Type Name Data Type Namespace

InputPredictionInputhttp://sap.com/xi/AP/CRM/MachineLearning
OutputPredictionEntrieshttp://sap.com/xi/AP/CRM/MachineLearning

Restrictions

The enhancement is only called during the save of Service Request when SAP standard logic is determining the case/need of Prediction.

Standard Business Process

In the SAP system, Ticket Classification (prediction) is performed for all Service Request if the Ticket Classification is configured.

Use

Attention: With this enhancement you can control if ticket classification is performed on Service Requests .Hence you need to exercise restraint while implementing,testing this enhancement!

Example

When a Service Request is saved , the system predicts the service category levels.

With this enhancement, you can influence system's decision and decide if there needs to be a prediction.

Parameters

Input Parameters

-ObjectTypeCode ( Cardinality 0..1)
-MachineLearningScenarioCode ( Cardinality 0..1)
-ID ( Cardinality 0..*)

Via MachineLearningScenarioCode you can identify the type of Machine Learning Scenario, for example whether it is Ticket Classification (001)

Output Parameters

BadiPredictionEntries( Cardinality 0..*)
PredictionEnabledEntry
-ID (Service Request ID)
-PREDICT ( Indicator if Prediction needs to be performed)

This means, in case you want the system to perform the Prediction you need to set the PREDICT field to true . The SAP standard logic does not fill the structure while invoking the enhancement. Also add every ticket ID supplied in the Input parameter to Output Parameter

Note : Whenever the enhancement is implemented populate the predict field for each ticket supplied. Do not have a empty implementation.

Attention:

You are not allowed to add new Service Requests to output .

Activities

Test

After the implementation of the enhancement option you can test it by saving a Service Request, you will see there is no prediction of Service Category Levels.

Example

The following example disables the prediction on tickets without Priority Code Immediate

import AP.CRM.MachineLearning;
import AP.CRM.Global;
var resultInstance : PredictionEntries.PredictionEntries;
var ServiceReq : collectionof ServiceRequest.UUID;

var result : PredictionEntries;
foreach( var ticketInstance in InputData.Object){
	ServiceReq.Add(ticketInstance);
	var instances = ServiceRequest.Retrieve(ServiceReq);
	foreach(var instance in instances){
		resultInstance.ID.content = ticketInstance.content;
		if(instance.ServiceTerms.ServicePriorityCode == "1"){
			resultInstance.Predict = true;
		}
		result.PredictionEntries.Add(resultInstance);
	}
	
}
return result;

More Information

For more information about the use case, see the SDK documentation under Getting Started > PSM. In the SDK, you can access the documentation from the Help menu.

Answers (1)

Answers (1)

edwin678
Newcomer
0 Likes

Hello,

You're on the right track thinking about Enhancement Spots! You'll need to leverage the appropriate Enhancement Spot within the Service ML framework to filter and control the ML processing based on Ticket Type and Channel. Here's a breakdown of how to approach this, along with guidance on where to start:

Understanding the Service ML Framework

Before diving into the Enhancement Spot, it's crucial to understand the general flow of the Service ML:

Ticket Creation/Update: A service ticket is created or updated.
ML Trigger: The system determines if ML should be triggered (based on configuration).
Data Extraction: Relevant data from the ticket is extracted (e.g., subject, description, category).
ML Processing: The ML model analyzes the data and provides predictions (e.g., category, priority, processor).
Result Application: The predictions are applied to the ticket.
Identifying the Right Enhancement Spot

The most likely Enhancement Spot to use for your requirement is one that executes before the actual ML processing. This allows you to check the Ticket Type and Channel and then decide whether to proceed with ML or bypass it.

Look for Enhancement Spots that are related to:

ML Triggering: Spots that control whether or not the ML is even executed.
Data Preprocessing: Spots that allow you to modify or filter the data before it is sent to the ML model.
ML Execution: Spots that allow you to bypass the ML execution.
Implementation Steps

Locate the Enhancement Spot:
Use transaction SE18 (Business Add-Ins) to search for Enhancement Spots related to Service ML.
Look for descriptions that mention "ML," "prediction," "classification," or similar terms.
Debugging the Service ML processing can help you pinpoint the exact Enhancement Spot.
Search SAP help documentation for the specific service ML you are using.
Create an Enhancement Implementation:
In SE18, create a new Enhancement Implementation.
Within the implementation, create a new BAdI implementation.
Implement the Logic:
In the BAdI method, add the following logic:
Retrieve Ticket Data: Get the Ticket Type and Channel from the ticket data.
Check Conditions: Evaluate if the Ticket Type and Channel match your criteria.
Control ML Execution:
If the conditions are met, allow the ML processing to continue.
If the conditions are not met, set a flag or modify a parameter to prevent the ML from executing.
Testing:   HMH Smart Square
Thoroughly test your implementation with various Ticket Types and Channels to ensure it works as expected.
Debug the code to ensure the correct values are being read and conditions are being evaluated correctly.

mracantonius1
Explorer
0 Likes
Thanks for your reply Edwin but this one is for C4C and we don't have access on SE18. As per SDK, we only have MachineLearningInputDataPreProcessing, MachineLearningObjectPredictionWrite, and MachineLearningDataSelectionQueryWrite.