If you are here, you may already know the issue, but for the rest:
The problem: The current out-of-the-box way of connecting to Saleforce with DataServices won’t work after Salesforce retires its REST API v21, in the summer of '25.
Regarding the end of Salesforce compatibility SAP is citing legal restrictions in the related SAP Note:
3004914 - SAP Data Services and Salesforce.com compatibility
Cause:
The Adapter for SFDC as a part of the Data Services using is indeed on SFDC API version 21 only. Due to
the legal restrictions, SAP applications do not connect to SFDC directly or provide direct interface into
SFDC systems. Thus SAP Data Services cannot connect directly to SFDC as well. The supported version
21 is prior to the restrictions and thus it is being provided in an ‘as is’ state and no further enhancements
will be provided.
SAP proposes two possible solutions:
In this post I describe a solution which is free* and is within BODS. If you have other data sources besides Salesforce and have a large invesment in BODS; you may prefer to stick with it. With the below solution you can do it without additional cost.
The key building blocks will be:
user defined transform + python + simple-salesforce + Salesfroce Bulk API 2.0 (+ CSV)
User defined transform (UDT)
In a nutshell, User Defined Transform is the way to extend your BODS out-of-the-box capabilities with whatever you want. Well… as long as it fits into 255 varchar columns. This is quite a limitation in 2024, so the work-around we will apply is to dump our Salesforce resultset into a local CSV. It is less elegant, but it works with longer fields as well.
Simple-salesforce
Simple-salesforce is a Python library for... you guessed it, Salesforce. You may use the Salesforce API directly, but I found this library quite simple useful. The latest version supports Bulk API 2.0 as well. To be able to use it within BODS, we would need to import it to our environment as follows:
Adding simple_salesforce to local python:
Add to the Environment variables:
Download and install pip
Documentation: https://pip.pypa.io/en/stable/installation/#get-pip-py
1. Download the script from https://bootstrap.pypa.io/get-pip.py
2. Command prompt: python get-pip.py
Install simple_salesforce:
python -m pip install --target="E:\SAP BusinessObjects\Data Services\DataQuality\python\Lib\site-packages" simple_salesforce
Python code of the User Defined Transform
from simple_salesforce import Salesforce, SalesforceLogin, SFType
# set salesforce connection details
username = 'aaa' # !!!
password = 'bbb' # !!!
security_token = 'ccc' # !!!
domain = 'xxx' # !!!
sf_version = '59.0'
# login and get session
session_id, instance = SalesforceLogin(username=username,
password=password, security_token=security_token, sf_version=sf_version, domain=domain)
sf = Salesforce(instance=instance, session_id=session_id)
queryName = record.GetField(u'i_queryName')
querySOQL = record.GetField(u'i_querySOQL')
# execute query
results = sf.bulk2.Account.query(
query=querySOQL, max_records=None, column_delimiter='PIPE', line_ending='CRLF'
)
# write results to local drive as CSV -- !!!customize to your local folder!!!
for i, data in enumerate(results):
with open(f"F:/FileDatasource/results/{queryName}-part-{i}.csv", "w", encoding="utf-8") as bos:
bos.write(data)
o_result = queryName + ' loaded successfully'
record.SetField(u'o_result', o_result)
del queryName
del querySOQL
del o_result
A few notes regarding the above code:
Attached you can find the export of the User Defined Transform.
Summary
With the above UDT you can easily build dataflows to extract data from Salesforce:
*If you find the above solution useful please leave a comment with your country / city. I would like to create a map with pins - hopefully - around the globe.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 27 | |
| 24 | |
| 20 | |
| 19 | |
| 13 | |
| 13 | |
| 12 | |
| 12 | |
| 11 | |
| 10 |