Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
Delete Data from Success factor using SAP Cloud Integration

 

This blog describes the steps to be used to deal with delete data from SFSF using SAP Cloud Platfrom Integration(Cloud Integration) . In SAP Cloud Platform Integration we generally use SuccessFactors adapter to communicate with SFSF where Insert, Select, Update, Upsert options are available but no delete option is there to delete the data from OData application.



To deal with delete case in Cloud Integration we can use OData type adapter which will delete data from specified MDF (If the MDF supports delete function) from SFSF. To check if the specified MDF (Entity) supports delete operation follow as describes below as well as which are the primary key fields required for delete query.

There are two ways to check that, below are those.

  1. Through SFSF Application:


By checking the OData API Data Dictionary against the specified Entity



At the top right side it will show the supported operations and in below the Business Keys will be shown which are the primary key and mandatory to send in delete query and the attribute Nullable states the fields which can be deleted.

  1. Through EDMX:


Choose Adapter type as OData and transport and message protocol as bellows in Cloud Integration.



Now go to the Adapter specific and select Model from the Resource Path in the Processing Details and provide the necessary details such as Address, Username(username@companyid) and password and press next button.



Now type and search the Entity name and check if Delete operation is available against the Entity and the key fields will be shown in blue selected checkbox.



Here if next button is being clicked then it will show the detailed filter configure conditions for the key fields. Where you can select the key fields as well as the filtering condition based on Operator, Input Type value and condition supported by the specified Entity only



Operator fields value would be ‘=’or’>’or’<’, means the key fields value can be checked as equals or less than or greater than. This operator value is totally depends on SFSF, how the entity is restricted and being deleted based on value.

In my scenario I got the equal operator only, in that case for multiple records deletion we have to manually set the groovy script and the Integration flow (using Splitter) to handle more than one record.

Input Type can be set as Text which is used for manual entry like “externalcode=’62’” where business scenario demands deletion case against a particular record.

Property and Header are the variables type which can be set as dynamically through groovy where entry format will be like “externalcode=’${property.A}’ or ‘${header.A}’.

A is a variable which you can declare dynamically and pass the value of xml data like through groovy script as bellows.

 

import com.sap.gateway.ip.core.customdev.util.Message;

import com.sap.it.api.mapping.MappingContext;

import java.lang.Object;

import java.text.ParsePosition;

 

def Message processData(Message message) {

def properties = message.getProperties();

def messageLog = messageLogFactory.getMessageLog(message);

def body = message.getBody(java.lang.String) as String;

def parsedXml = new XmlSlurper().parseText(body);

def a = parsedXml.RootNode.ChildNode ;

message.setProperty("A",a);

return message;

}

 

 

Query to be created in format:

Select the adapter as OData and go to Adapter Details and provide Address with /odata/v2 and Credential Name deployed with Basis Authentication in tenant and in the resource path put the Entity name and query in a merged format and put Custom Query Options field as blank.

The Resource path and the query format will be as bellows.

EntityName(Primarykey1=datetime’${property.A}’,Primarykey2=datetime’${property.B}’,Primarykey3=’${property.C}’)

In the above query I am assuming there are 3 key fields available to filter and first two key fields are belongs with DateTime fields.

 

Example:

cust_AttendanceRegularizationdetails(externalCode=datetime'${property.EffCode}',cust_AttendanceRegularization_effectiveStartDate=datetime'${property.StartDate}',cust_AttendanceRegularization_externalCode='${property.EXCode}')



 

In my scenario our objective is to delete the detail attendance data when a new master attendance data is created in SFSF. In our scenario while creating a new master data based on the effective start date, previous months details are also getting copied and pushed into the new master data (By default in SFSF it is creating). To get rid of that scenario we are checking the attendance records created in the current master effective start date and selecting (By Select query) all details which are old than the current effective start date’s month and splitting each records in Cloud Platform Integration through General Splitter and deleting them from the same master attendance table based on the effective start date.

 



 

Result in SFSF:

 



 

General Error Handling:

  1. Issue: Bad Request 400: Entity need a key value in DELETE operation


Root Cause: This issue comes as the delete query is pushing to SFSF has not been recognized and cannot perform delete operation as the entity’s primary key value is being sent is either blank or multiple values are being sent.

Solution: To get rid of that issue use Content Modifier and Script combination in Cloud Integration to print the values passing to the query in Groovy Script if dynamic values are being passed or extracted from a payload by using messageLog.setStringProperty.

 

Also, I would suggest to create the URL first with constant value before make it dynamic and put it into browser with arranging the URL with server details and check if the query is showing exact value or not from that.

Note: The query is being checked by URL in web browser will not delete the exact data from database. If the query is correct then it will show you the details of data exist in the Entity.

 

  1. Issue:uri.UriSyntaxException - Sequential processing failed, Wrong literal format for literal


Root Cause: The issue itself is saying that the issue belongs to the URL while creating that.

Solution: To get rid of that issue, create the URL first with constant value before make it dynamic and put it into browser with arranging the URL with server details and check if the query is showing exact value or not from that.

 
Labels in this area