https://raw.githubusercontent.com/ajmaradiaga/feeds/main/scmt/topics/Python-qa.xmlSAP Community - Python2026-02-07T12:11:41.240732+00:00python-feedgenPython Q&A in SAP Communityhttps://community.sap.com/t5/technology-q-a/using-python-is-there-any-reference-github-repo-to-develop-a-multitenant/qaq-p/13774991using Python - Is there any reference GitHub repo to Develop a multitenant Software as a Service app2024-07-29T07:32:31.473000+02:00Sabarinathan_mhttps://community.sap.com/t5/user/viewprofilepage/user-id/176565<P>Hi All,</P><P>We are planning to create a multitenant SaaS app using Python. By referring to the example, we have built a solution for a single tenant—a Python micro-service app to consume foundation models through the Generative AI Hub (<A href="https://github.com/SAP-samples/btp-generative-ai-hub-use-cases/tree/main/01-social-media-citizen-reporting-genai-hub/python_app" target="_new" rel="noreferrer nofollow noopener">https://github.com/SAP-samples/btp-generative-ai-hub-use-cases/tree/main/01-social-media-citizen-reporting-genai-hub/python_app</A>). This solution works fine within the same tenant.</P><P>Now, we need to make the Python application a multitenant SaaS application. Is there any GitHub reference or documentation available for this purpose?</P><P>I have checked the SAP Discovery Center, but the multitenant applications are mainly for CAP, and I couldn't find any references for Python applications.</P><P>Any suggestions or guidance would be greatly appreciated.</P><P>Thank you,<BR />Sabari </P>2024-07-29T07:32:31.473000+02:00https://community.sap.com/t5/technology-q-a/post-requests-being-converted-to-get-in-sap-btp-cloud-foundry-environment/qaq-p/13851383POST Requests Being Converted to GET in SAP BTP Cloud Foundry Environment2024-09-02T12:31:42.433000+02:00KeerthiG16https://community.sap.com/t5/user/viewprofilepage/user-id/165154<P>Hi all,</P><P>I hope this message finds you well.</P><P>I am currently facing an issue with my application backend, which I have developed using the Python Django framework. The application consists of several APIs that have been thoroughly tested and work perfectly fine when run locally. The APIs correctly handle different request types (e.g., POST, GET, PUT, etc.) without any issues.</P><P>However, after deploying the application to the Cloud Foundry environment on SAP BTP, I’ve encountered a strange issue where all incoming requests are being interpreted as GET requests, regardless of the original request method. This problem surfaced suddenly, despite the application working as expected after the initial deployment.</P><P><STRONG>What I’ve Tried:</STRONG></P><UL><LI>I’ve thoroughly reviewed my application code, including all route configurations, middleware, and view logic, to ensure there are no issues that could cause this behavior.</LI><LI>I’ve also checked for any anomalies in the request and response logs while running the application locally versus in Cloud Foundry.</LI><LI>Additionally, I verified that there are no URL malformations or issues with the way requests are being sent to the backend.</LI></UL><P>Despite these efforts, the problem persists only when the application is deployed on Cloud Foundry. I’m reaching out to see if anyone in the community has experienced a similar issue or can provide insights into what might be causing Cloud Foundry to interpret all requests as GET requests.</P><P>Any guidance or suggestions for further troubleshooting steps would be greatly appreciated.</P><P>Thank you in advance for your support!</P><P>Best regards,<BR />Keerthi</P>2024-09-02T12:31:42.433000+02:00https://community.sap.com/t5/technology-q-a/how-to-use-xsuaa-in-fastapi-python-app/qaq-p/13866386How to use XSUAA in FastAPI Python app2024-09-16T07:21:48.484000+02:00mohan-sharmahttps://community.sap.com/t5/user/viewprofilepage/user-id/638274<P>Hi there, </P><P>I have a fastapi app with 2 routes, one for rendering an html page and one for serving a request. I am using Jinja2 for templating.</P><P>Example of one of the route:</P><pre class="lia-code-sample language-java"><code><a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1699569">@router</a>.get("/", response_class=HTMLResponse)
async def read_root(request: Request):
return templates.TemplateResponse("index.html", {"request": request})</code></pre><P>My manifest.yaml for deploying it to cloud foundry:</P><pre class="lia-code-sample language-yaml"><code>---
applications:
- name: fastapi-app
disk_quota: 2048M
memory: 256M
path: ./
routes:
- route: fastapi-app.cfapps.eu10.hana.ondemand.com
buildpacks:
- python_buildpack
command: uvicorn com.crack.snap.make.app:app --host 0.0.0.0 --port $PORT
services:
- app-xsuaa
- app-logging-service
logging:
level: error
env:
PYTHONUNBUFFERED: true
xsuaa_connectivity_instance_name: "app-xsuaa"
xsuaa_destination_instance_name: "app-xsuaa"</code></pre><P>How do I protect these fastapi routes directly using XSUAA, without having to create one more webapp then use app-router and then forwarding the request to fastapi app?</P><P>Also I <SPAN>want the fastapi to use the sub-account's default authentication which we do by using redirect-url of xs-security.json</SPAN></P><pre class="lia-code-sample language-json"><code>{
"xsappname": "fastapi-app",
"tenant-mode": "dedicated",
"scopes": [{
"name": "$XSAPPNAME.fastapi_scope"
}],
"role-templates": [{
"name": "FastAPIRoleTemplate",
"default-role-name": "FastAPIRole",
"description": "Role template for app users",
"scope-references": ["$XSAPPNAME.fastapi_scope"]
}
],
"oauth2-configuration": {
"redirect-uris": [
"https://*.cfapps.eu10.hana.ondemand.com/**"
]
}
}</code></pre><P>Any help on achieving this will be really appreciated, we can also have a blog post on the same topic</P><P><a href="https://community.sap.com/t5/c-khhcw49343/SAP+BTP%25252C+Cloud+Foundry+runtime+and+environment/pd-p/73555000100800000287" class="lia-product-mention" data-product="443-1">SAP BTP, Cloud Foundry runtime and environment</a> <a href="https://community.sap.com/t5/c-khhcw49343/Python/pd-p/f220d74d-56e2-487e-8e6c-a8cb3def2378" class="lia-product-mention" data-product="126-1">Python</a> <a href="https://community.sap.com/t5/c-khhcw49343/SAP+BTP+Security/pd-p/842ea649-eeef-464c-b80c-a64b03e40158" class="lia-product-mention" data-product="99-1">SAP BTP Security</a> </P>2024-09-16T07:21:48.484000+02:00https://community.sap.com/t5/technology-q-a/consuming-on-prem-odata-service-though-destination-in-python-script-and/qaq-p/13876153Consuming on-prem OData service though Destination in python script and deploy it to CF in BTP.2024-09-24T16:39:58.235000+02:00s_satyamsettihttps://community.sap.com/t5/user/viewprofilepage/user-id/864713<P>Hello SAP Community,</P><P>I have developed a python script in Business Application Studio in SAP BTP and in that I am trying to consume an on premise OData service through destination.<BR />If am giving my backend Host & port URL I am able to consume the data directly, but it would not work if I deploy it as my service is not exposed outside.<BR />Can you please help me how to call the OData service through destination in Python Script similar to how we call in SAP UI5 applications.</P><P>Thanks & Regards,</P>2024-09-24T16:39:58.235000+02:00https://community.sap.com/t5/technology-q-a/how-to-automate-datasphere-cli-using-python/qaq-p/13883327How to Automate Datasphere CLI using python2024-09-30T18:43:35.761000+02:00sekhar_khttps://community.sap.com/t5/user/viewprofilepage/user-id/1396839<P>Hi All,</P><P>I have a requirement to automate the Datasphere CLI using python.</P><P>Example: As per the below blog via CLI it's manual activity.</P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/use-crud-opreations-with-sap-datasphere-command-line-interface/ba-p/13682690" target="_blank">https://community.sap.com/t5/technology-blogs-by-sap/use-crud-opreations-with-sap-datasphere-command-line-interface/ba-p/13682690</A></P><P>Suppose there is scenario, we have 50 replication flows, i want to update some content in JSON file. Manual Activity takes more time. So by using Python we are able to do it but authentication is blocking for manual intervention. While automate each command it is asking some token code. <STRONG>To streamline this process, please suggest some steps to bypassing the authentication step through automation using Python.</STRONG></P><P> </P>2024-09-30T18:43:35.761000+02:00https://community.sap.com/t5/technology-q-a/incorrect-path-when-activating-an-environment/qaq-p/13890483Incorrect path when activating an environment2024-10-07T10:16:18.574000+02:00PH4https://community.sap.com/t5/user/viewprofilepage/user-id/125682<P>Hello experts,<BR />I am currently working through this very interesting blog post. However, when installing Python or activating the environment, I encounter the following error ‘The system cannot find the specified path’.</P><P>I would be very happy to receive help from the experts here.</P><P>Many thanks<BR />Patric</P><P> </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PH4_0-1728288581966.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/176173iDBC843C98D5ACB06/image-size/medium?v=v2&px=400" role="button" title="PH4_0-1728288581966.png" alt="PH4_0-1728288581966.png" /></span></P><P> </P>2024-10-07T10:16:18.574000+02:00https://community.sap.com/t5/technology-q-a/python-call-a-store-procedure/qaq-p/13976526Python call a store procedure2025-01-04T18:04:30.274000+01:00mjocasiohttps://community.sap.com/t5/user/viewprofilepage/user-id/42999<P>I have statement to call a store procedure using python.... The store procedure executes an insert statement .</P><P>but the call seems not to do anything.....</P><P>def execute_proc(self, sql_statement):<BR />"""<BR />Execute a Store Procedure.<BR />"""<BR />try:<BR />cursor = self.connection.cursor()<BR />cursor.execute("SET SCHEMA HISTDBA")<BR />cursor.callproc(sql_statement)<BR />self.connection.commit()<BR />cursor.close()<BR />print(f"Executed SQL: {sql_statement}")<BR />except Exception as err:</P><P>This the code i used to call store procedure. I am able to call the procedure from studio. I also add it the select permission to the account used to execute the python code.<BR />print(f"Error executing SQL: {err}")<BR />raise</P>2025-01-04T18:04:30.274000+01:00https://community.sap.com/t5/technology-q-a/sci-kit-learn-library-in-sap-datasphere-data-flow/qaq-p/13993449Sci-Kit learn library in SAP Datasphere Data Flow2025-01-22T16:41:14.270000+01:00Moritz_Fhttps://community.sap.com/t5/user/viewprofilepage/user-id/1437176<P>Hi everyone,</P><P>I tried to add Python code into a Sap Datasphere Data Flow utilizing the sci-kit learn library. However I always get errors. Does anyone know if the library is available in the Dataflow Script Console or what alteratives I would have here?</P><P>Many thanks,</P><P>Moritz</P>2025-01-22T16:41:14.270000+01:00https://community.sap.com/t5/technology-q-a/access-event-log-case-attributes-via-api-to-perform-ml-based-predictions/qaq-p/14027178Access event log, case attributes via API to perform ML based predictions2025-02-25T15:05:56.437000+01:00ShubhamGuptaGenpacthttps://community.sap.com/t5/user/viewprofilepage/user-id/1821316<P>Hi Team, </P><P>I am looking for options to access Business objects, event log created within Process Intelligence. I would require to access this data to perform ML based predictions or employ other AI based applications. </P><P>The idea is to perform all these computations in external notebook and push this data back to Process Intelligence so that we can show predictions or any other applications.</P><P>Has anyone worked on this kind of setup, how to access data from Process Intelligence and push it back to the model. Any kind of API provided or Python based setup available, please advise.</P><P><a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1522801">@Process</a> Intelligence <a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1862993">@Pa_Vi</a> Signavio</P><P> </P>2025-02-25T15:05:56.437000+01:00https://community.sap.com/t5/technology-q-a/quot-error-connecting-to-sap-gui-2147221020-invalid-syntax-none-none-quot/qaq-p/14063919"Error connecting to SAP GUI: (-2147221020, 'Invalid syntax', None, None)"2025-04-02T10:42:01.074000+02:00davemac93https://community.sap.com/t5/user/viewprofilepage/user-id/2044321<P class="">Hello,</P><P class="">I have a problem with the following error:</P><P class=""><STRONG>"Error connecting to SAP GUI: (-2147221020, 'Invalid syntax', None, None)"</STRONG></P><P class="">This issue occurs when I convert my script into an .exe file using PyInstaller. The error appears only on devices other than the one where the script was originally built.</P><P class="">The problem is connected with function <STRONG>connect_to_sap()</STRONG></P><P class="">SAP scripting is enabled, and another script I created works correctly without any issues.</P><P class="">What could be causing this problem?</P><P class="">Please let me know if you need more details.</P><P class=""> </P><pre class="lia-code-sample language-abap"><code>import time
import win32com.client # Biblioteka do interakcji z SAP GUI przez COM
import pandas as pd # Importuje Pandas do pracy z danymi w Excelu
from datetime import datetime, timedelta # Importuje datetime i timedelta do pracy z datami
import pyperclip
import openpyxl
import os
import psutil
import time
import re
import subprocess
import msal
import requests
import os
from win32com.client import CDispatch
system_name = "P01 One ERP Production System"
def run_sap_logon():
"""
Function starts the SAP Logon application.
"""
sap_logon_path = r"C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe" # Path to SAP Logon application
try:
subprocess.Popen([sap_logon_path]) # Starts the SAP Logon application
print("<span class="lia-unicode-emoji" title=":white_heavy_check_mark:">✅</span> SAP Logon application started.")
time.sleep(5) # Wait for 5 seconds to allow SAP Logon to initialize
except Exception as e:
print(f"Error starting SAP Logon: {e}")
def connect_to_sap(system_name):
"""
Function connects to an open SAP GUI session and returns the session object,
selecting the appropriate system based on the name.
"""
try:
# Get the SAP GUI object
SapGuiAuto = win32com.client.GetObject("SAPGUI")
application = SapGuiAuto.GetScriptingEngine # Get the SAP scripting engine
if application is None:
print("SAP GUI scripting engine not found!")
return None
time.sleep(2)
# Check if there are any open connections
if len(application.Connections) > 0:
print(f"Found {len(application.Connections)} open connections.")
for connection in application.Connections:
conn_description = connection.Description # Get the connection description (no parentheses)
print(f"Connection description: {conn_description}") # Debugging output
if conn_description == system_name: # Check if we have the correct connection
print(f"Found connection to {system_name}")
session = connection.Children(0) # Retrieve the first session
print("Session successfully connected.")
return session
else:
print(f"No connection to {system_name} found. Trying to open it.")
# Open the specified SAP connection if it was not found already
connection = application.OpenConnection(system_name, True)
print(f"<span class="lia-unicode-emoji" title=":white_heavy_check_mark:">✅</span> Opened connection to {system_name}")
else:
print("<span class="lia-unicode-emoji" title=":white_heavy_check_mark:">✅</span> No open connections found. Attempting to open the system connection.")
connection = application.OpenConnection(system_name, True)
print(f"<span class="lia-unicode-emoji" title=":white_heavy_check_mark:">✅</span> Opened connection to {system_name}")
# Retrieve the first session
session = connection.Children(0) # Get the first child session
print("<span class="lia-unicode-emoji" title=":white_heavy_check_mark:">✅</span> Session successfully connected.")
return session
except Exception as e:
print(f"Error connecting to SAP GUI: {e}")
return None</code></pre><P> </P><P> </P><P> </P>2025-04-02T10:42:01.074000+02:00https://community.sap.com/t5/technology-q-a/sap-datasphere-cli-amp-python-exporting-modeling-objects-to-csv-files-for/qaq-p/14087055SAP Datasphere CLI & Python: Exporting Modeling Objects to CSV Files for Each Artifact2025-04-26T08:02:52.747000+02:00vikasparmar88https://community.sap.com/t5/user/viewprofilepage/user-id/1528256<H1 id="toc-hId-1382837983" id="toc-hId-1580240293">Introduction</H1><P>In this blog post, we'll explore how to use Python alongside SAP Datasphere CLI to extract modeling objects and export them to CSV files. The script allows users to handle artifacts such as remote tables, views, replication flows, and more, for each space in SAP Datasphere.<BR />This solution is particularly useful for automating repetitive tasks and ensuring structured data handling across different modeling objects</P><P><FONT size="5" color="#000000"><STRONG>Prerequisites</STRONG></FONT></P><P>Steps to install SAP Datasphere CLI: </P><P><A href="https://help.sap.com/docs/SAP_DATASPHERE/d0ecd6f297ac40249072a44df0549c1a/f7d5eddf20a34a1aa48d8e2c68a44e28.html/" target="_blank" rel="noopener noreferrer">https://help.sap.com/docs/SAP_DATASPHERE/d0ecd6f297ac40249072a44df0549c1a/f7d5eddf20a34a1aa48d8e2c68a44e28.html/</A> </P><P><A href="https://community.sap.com/t5/technology-blogs-by-sap/sap-datasphere-external-access-overview-apis-cli-and-sql/bc-p/14086942#M180986/" target="_blank">https://community.sap.com/t5/technology-blogs-by-sap/sap-datasphere-external-access-overview-apis-cli-and-sql/bc-p/14086942#M180986/</A> </P><P><FONT size="5" color="#000000"><STRONG>Step-by-Step Process</STRONG></FONT></P><P><STRONG>Step 1: Prepare Login.Json file</STRONG></P><P>Create OAuth Client with Purpose as Interactive Usage and Redirect URL as <A href="http://localhost:8080/" target="_blank" rel="noopener nofollow noreferrer"><EM>http://localhost:8080</EM></A></P><P>Get the value of all below fields from the OAuth Client and prepare the Login.json file.</P><pre class="lia-code-sample language-json"><code>{
"client_id": "",
"client_secret": "",
"authorization_url": "",
"token_url": "",
"access_token": "",
"refresh_token": ""
}</code></pre><P> <STRONG>Step 2: Create Model_Object.py file with below code</STRONG></P><P><STRONG>dsp host</STRONG> : give URL of Datasphere Tenant.</P><P><STRONG>secrets_file</STRONG> : Give Path of Login.json file.</P><pre class="lia-code-sample language-abap"><code>import subprocess
import pandas as pd
import sys
def manage_Modeling_Object(Modeling_Object):
# Step 1: Login to Datasphere using host and secrets file
dsp_host = '<URL of Datasphere>'
secrets_file = '<path>/Login.json'
command = f'datasphere login --host {dsp_host} --secrets-file {secrets_file}'
subprocess.run(command, shell=True) # Execute the login command
# Step 2: Retrieve a list of all spaces in JSON format
command = ['datasphere', 'spaces', 'list', '--json']
result_spaces = subprocess.run(command, capture_output=True, shell=True, text=True) # Run the command and capture output
# Step 3: Parse the list of spaces from the command's output
spaces = result_spaces.stdout.splitlines() # Split output into individual lines
ModelingObject_data = [] # Initialize a list to store Modeling Object data
# Step 4: Check if the Modeling Object is 'spaces'
if Modeling_Object == 'spaces':
for space in spaces:
if space == "[" or space == "]":
continue # Skip brackets in the JSON output
space_id = space.strip() # Extract space ID
# Add space details to the data list
ModelingObject_data.append({
'Space ID': space_id.replace('"', '').replace(',', ''),
'Technical Name': space_id.replace('"', '').replace(',', ''),
'TYPE': Modeling_Object[:-1].upper() # Set the TYPE as uppercase version of the input Modeling Object name
})
# Step 5: Process Modeling Objects for each space
else:
for space in spaces:
if space == "[" or space == "]":
continue # Skip brackets in the JSON output
space_id = space.strip() # Extract space ID
# Step 6: Retrieve Modeling Objects for the current space
command = ['datasphere', 'objects', Modeling_Object, 'list', '--space', space_id.replace('"', '').replace(',', '')]
result_ModelingObject = subprocess.run(command, capture_output=True, shell=True, text=True) # Run the command
# Step 7: Parse the Modeling Object data from the output
ModelingObject_info = result_ModelingObject.stdout.splitlines() # Split output into individual lines
print("Checking "+Modeling_Object.upper()+" for space : "+space_id.replace('"', '').replace(',', '')) # Log the space being checked
# Step 8: Process each Modeling Object
if len(ModelingObject_info) > 1:
for flow in ModelingObject_info:
if '{' in flow or '}' in flow or '[' in flow or ']' in flow:
continue # Skip brackets or braces in the output
cleaned_flow = flow.replace('"technicalName":', '').replace('"', '').strip() # Clean up the output
# Step 9: Add Modeling Object details to the data list
ModelingObject_data.append({
'Space ID': space_id.replace('"', '').replace(',', ''),
'Technical Name': cleaned_flow,
'TYPE': Modeling_Object[:-1].upper() # Set the TYPE as uppercase version of the input Modeling Object name
})
# Step 10: Write the collected data into a CSV file
if ModelingObject_data:
df = pd.DataFrame(ModelingObject_data) # Create a DataFrame from the data list
df.to_csv(Modeling_Object.upper()+'.csv', index=False) # Save the DataFrame to a CSV file without the index
print("Space vise all "+Modeling_Object.upper()+" have been written to "+Modeling_Object.upper()+".csv.") # Log success message
else:
print("No Modeling Objects found.") # Log message if no data was collected
print('------------------------------------------------------------------------------------------------------------------------------------') # Separator for readability
if __name__ == "__main__":
# Check if an argument is provided via the command line
if len(sys.argv) > 1:
# Pass the first argument to the method
manage_Modeling_Object(sys.argv[1])
else:
print("Please provide a Modeling Object name as an argument.") # Log error message if no argument is provided
# Execute for predefined Modeling Objects
manage_Modeling_Object('remote-tables')
manage_Modeling_Object('local-tables')
manage_Modeling_Object('views')
manage_Modeling_Object('intelligent-lookups')
manage_Modeling_Object('data-flows')
manage_Modeling_Object('replication-flows')
manage_Modeling_Object('transformation-flows')
manage_Modeling_Object('task-chains')
manage_Modeling_Object('analytic-models')
manage_Modeling_Object('data-access-controls')</code></pre><P><STRONG>Step 3: Open command prompt and execute the Model_Objects.py file</STRONG></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vikasparmar88_0-1745646785952.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/255123i23E96AEF92C443CA/image-size/medium?v=v2&px=400" role="button" title="vikasparmar88_0-1745646785952.png" alt="vikasparmar88_0-1745646785952.png" /></span></P><P>Once the program execution is done it will generate CSV files for all the Datasphere artifactes mention in python code</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vikasparmar88_1-1745646877909.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/255124i2D0343903B2ECFC7/image-size/medium?v=v2&px=400" role="button" title="vikasparmar88_1-1745646877909.png" alt="vikasparmar88_1-1745646877909.png" /></span></P><P>each CSV file will have 3 columns : </P><P>1) Space ID : Name of the space</P><P>2) Technical Name : Exact Technical Name of Object </P><P>3) Type : Type of Object ( i.e view, local-table, remote-table, replication flw etc)</P><P> </P><H1 id="toc-hId-1382837983" id="toc-hId-1383726788">Conclusion</H1><P>This script demonstrates how Python and SAP Datasphere CLI can collaborate to streamline artifact management and export data systematically. By following the steps provided, users can extend or adapt the code to suit their requirements.</P>2025-04-26T08:02:52.747000+02:00https://community.sap.com/t5/technology-q-a/python-for-loop-does-nt-work-fine/qaq-p/14091716Python FOR loop does'nt work fine2025-05-02T09:57:16.549000+02:00Ricobyehttps://community.sap.com/t5/user/viewprofilepage/user-id/2101125<DIV>Hi Experts</DIV><DIV>I'm facing an issue when I try to use the FOR Loop in my datasphere data flow script. My goal is to fill a table with hierarchies links of father-childrens from KNVH. I use a dataphrame with 9000 rows.</DIV><DIV><DIV>For the test, a filter on the father <SPAN>0001010970 is done. As you can see, we have 8 childrens</SPAN></DIV><DIV> </DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="client pere.png" style="width: 486px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/257000iBB83C8912E7D7C86/image-size/large?v=v2&px=999" role="button" title="client pere.png" alt="client pere.png" /></span></SPAN></DIV><DIV> </DIV><DIV><SPAN>The first step was to be sure that the FOR Loop runs fine and it is.</SPAN></DIV><DIV> </DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (14).png" style="width: 764px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/257001i4778E045B9136557/image-size/large?v=v2&px=999" role="button" title="image (14).png" alt="image (14).png" /></span></SPAN></DIV><DIV> </DIV><DIV> </DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (15).png" style="width: 945px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/257004i4B7A726A0D1786A7/image-size/large?v=v2&px=999" role="button" title="image (15).png" alt="image (15).png" /></span></SPAN></DIV><DIV><DIV>For each row, the link is done.</DIV><DIV> </DIV><DIV>But the goal is to iterate through a table of parents and find all the childrens. When we move on to the normal code, we notice that some lines are not being processed...</DIV></DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (16).png" style="width: 638px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/257003i28448CB77772999A/image-size/large?v=v2&px=999" role="button" title="image (16).png" alt="image (16).png" /></span></SPAN></DIV><DIV> </DIV><DIV><SPAN><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (17).png" style="width: 945px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/257002i43D2DB4266DA16B7/image-size/large?v=v2&px=999" role="button" title="image (17).png" alt="image (17).png" /></span></SPAN></DIV><DIV><DIV>As you can see some lines are not processed... They don't even go through the FOR loop. I don't know why they are ignored...</DIV><DIV>I've turned the code around in circles without success. I've used different instructions without success.</DIV><DIV> </DIV><DIV>Do you have any Ideas please? Need your help</DIV><DIV> </DIV><DIV>Best regards</DIV></DIV><DIV> </DIV></DIV>2025-05-02T09:57:16.549000+02:00https://community.sap.com/t5/technology-q-a/how-to-reference-another-local-table-file-in-a-transformation-flow-object/qaq-p/14098795How to reference another local table(file) in a transformation flow (Object Store) SAP Datasphere?2025-05-12T09:46:25.252000+02:00padehttps://community.sap.com/t5/user/viewprofilepage/user-id/1776149<P>Hello SAP Community,</P><P class="">I'm currently setting up a transformation flow in an <STRONG>Object Store</STRONG> space in SAP Datasphere. In this flow, I want to <STRONG>add a column to a local table(file)</STRONG> <STRONG>by referencing data from another local table (file)</STRONG>. To achieve more flexibility, I attempted to use a Python script.</P><P class="">However, I couldn't find a way to access the second table from within the script without running into errors.</P><P class="">Has anyone found a way to reference or join another local table(file) within a Python transformation in an Object Store space?</P><P><STRONG>What I tried:</STRONG></P><P class=""><STRONG>1. Adding a second parameter</STRONG> to the transform() function (e.g., transform(data, second_table)). <SPAN>This resulted in an exception because Datasphere only passes one argument (data) to the function, and does not support multiple input parameters.</SPAN></P><P class=""><STRONG>2. Referencing the second table directly in the script</STRONG> (without declaring it as a parameter). This led to an exception because the external table is not defined in the script’s scope.</P><P class="">I’d appreciate any ideas, workarounds, or best practices on how to achieve this in SAP Datasphere using Python transformations.</P><P class="">Thank you very much in advance and best regards,<BR />Patrick</P>2025-05-12T09:46:25.252000+02:00https://community.sap.com/t5/technology-q-a/is-there-a-way-to-automatically-run-the-query-in-sap-dsp-via-python/qaq-p/14105795Is there a way to automatically run the query in SAP DSP via python?2025-05-19T17:46:08.965000+02:00aleksandrskerauts72https://community.sap.com/t5/user/viewprofilepage/user-id/791318<P>Is there a way to automatically run the query in SAP DSP via python and create an export file on users machine</P><P> </P><P>Thanks </P>2025-05-19T17:46:08.965000+02:00https://community.sap.com/t5/technology-q-a/python-code-error-in-dataflow/qaq-p/14116190Python code error in dataflow2025-06-01T14:12:07.367000+02:00Edulahttps://community.sap.com/t5/user/viewprofilepage/user-id/826824<P>Hi,</P><P>I'm very new to python, I hvae a data set with 13 column , once of the called 'gender'. I want to filter the data and result moved to Target table.</P><P>However I'm getting below error message called "<SPAN>'method' object is not subscriptable"</SPAN></P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Edula_0-1748779691290.png" style="width: 400px;"><img src="https://community.sap.com/t5/image/serverpage/image-id/268261iFC37B5ACEF83829D/image-size/medium?v=v2&px=400" role="button" title="Edula_0-1748779691290.png" alt="Edula_0-1748779691290.png" /></span></P><P>Please my code below, unfortunatly we can't debug the code in datasphere</P><P>def transform(data):<BR />specific_name = ['Male']<BR />df = data['gender'].isin[('specific_name')]<BR />#data[NV]<BR />return df</P><P>Any input would be greatly appreciated</P><P>Kind regards</P><P>Hari </P>2025-06-01T14:12:07.367000+02:00https://community.sap.com/t5/technology-q-a/how-to-deploy-a-mcp-server-on-cloud-foundry-with-non-public-access/qaq-p/14199347How to deploy a mcp server on cloud foundry with non public access2025-08-29T13:03:22.911000+02:00marcus_schifferhttps://community.sap.com/t5/user/viewprofilepage/user-id/195686<P>Hi,</P><P>we try to deploy a mcp server with python FASTMCP on cloud foundry for use in an agentic ai setting. It works well in the default settings with a public route.</P><P>However, we would like to secure the access to the mcp server and remove it from the public access. We understand that the apps.internal option is not available in SAP BTP. Trying to route the <A href="https://mcp-server.ourdomain.com" target="_blank" rel="noopener nofollow noreferrer">https://mcp-server.ourdomain.com</A> through an approuter did not work either since we always get unauthorized ( get token from destinations clientid / pw as well as xsuaa service clientid /pw did not work with the </P><DIV><DIV><SPAN>client </SPAN><SPAN>=</SPAN><SPAN> MultiServerMCPClient(</SPAN></DIV><DIV><SPAN> { </SPAN><SPAN> </SPAN><SPAN>"simplemcp"</SPAN><SPAN>: {</SPAN></DIV><DIV><SPAN> </SPAN><SPAN>"url"</SPAN><SPAN>: </SPAN><SPAN>"https:/approuterurl"</SPAN><SPAN>, </SPAN></DIV><DIV><SPAN> </SPAN><SPAN>"transport"</SPAN><SPAN>: </SPAN><SPAN>"streamable_http"</SPAN><SPAN>,</SPAN></DIV><DIV><SPAN> </SPAN><SPAN>"headers"</SPAN><SPAN>: {</SPAN></DIV><DIV><SPAN> </SPAN><SPAN> </SPAN><SPAN>"Authorization"</SPAN><SPAN>: </SPAN><SPAN>f</SPAN><SPAN>"Bearer </SPAN><SPAN>{</SPAN><SPAN>access_token</SPAN><SPAN>}</SPAN><SPAN>"</SPAN><SPAN>},</SPAN><SPAN> </SPAN><SPAN> </SPAN></DIV><DIV><SPAN> }</SPAN></DIV><DIV><SPAN> }</SPAN></DIV><DIV><SPAN>)</SPAN></DIV><DIV><SPAN>Is there any trick to get this done ? Help is very much appreciated.</SPAN></DIV><DIV><SPAN>Regards</SPAN></DIV><DIV><SPAN>Marcsu</SPAN></DIV></DIV>2025-08-29T13:03:22.911000+02:00https://community.sap.com/t5/technology-q-a/sybase-ase-15-7-compatibility/qaq-p/14219812Sybase ASE 15.7 compatibility2025-09-17T11:12:05.353000+02:00yash_kulkarni31https://community.sap.com/t5/user/viewprofilepage/user-id/2254997<P><a href="https://community.sap.com/t5/c-khhcw49343/Python/pd-p/f220d74d-56e2-487e-8e6c-a8cb3def2378" class="lia-product-mention" data-product="126-1">Python</a> <BR />Is the Sybase 15.7 compatible with python 3.12??</P>2025-09-17T11:12:05.353000+02:00https://community.sap.com/t5/crm-and-cx-q-a/can-you-automate-crystal-reports-that-take-a-parameter-with-python/qaq-p/14244343Can you automate Crystal Reports that take a parameter with Python?2025-10-15T08:42:17.197000+02:00Dean_Rooneyhttps://community.sap.com/t5/user/viewprofilepage/user-id/2259943<P>We have Crystal Reports 2020 and would like to be able to automate one that takes a parameter. Ideally to be done using Python where we can pass a list of References and generate a PDF for each one.<BR />We don't have someone proficient in C# in the business.</P><P>What are our options? Can we use Python to automate the version we have or do we require another?<BR />Are there any tools, SAP or third party, that would work for this?</P><P>Any other options to automate it?</P>2025-10-15T08:42:17.197000+02:00https://community.sap.com/t5/technology-q-a/how-to-test-python-xsuaa-locally/qaq-p/14273309How to test python xsuaa locally?2025-11-20T07:47:30.824000+01:00RonnyZhttps://community.sap.com/t5/user/viewprofilepage/user-id/846367<P>I created my first python app with ui5 frontend. But how can I test xsuaa security locally in vscode? Any option to define basic or mocked authentication? See the example how I do that normally in nodejs CAP application, but python has no package.json. Thank you in advance!</P><pre class="lia-code-sample language-json"><code>"cds": {
"requires": {
"[production]": {
"auth": "xsuaa"
},
"[development]": {
"auth": {
"kind": "basic",
"users": {
"myuser": {
"password": "mypass",
"roles": ["TEST_ROLE"]
}
}
}
}
}
}</code></pre>2025-11-20T07:47:30.824000+01:00https://community.sap.com/t5/technology-q-a/error-in-odata-call-made-with-self-sign-certificate/qaq-p/14303664Error in OData call made with self sign certificate2026-01-08T13:11:19.751000+01:00siddharthshaligram45https://community.sap.com/t5/user/viewprofilepage/user-id/1299830<P>Hello All,</P><P>We want to establish a connection between a Python and SAP through OData call. For this, we are using a self signed X.509 certificate which we generated using OpenSSL. </P><P>when we make a Odata call [which is based on a BW query], we are getting a <STRONG>404 error</STRONG> with description : <EM>Please select a valid URL. If it is a valid URL, check whether service /sap/opu/odata/sap/<service_name>/$metadata is active in transaction SICF. </EM></P><P>we have set the odata Logon detail to SSL Certificate.</P><P>could you tell where we could be going wrong and how we can fix it?</P><P><a href="https://community.sap.com/t5/c-khhcw49343/OData/pd-p/551580658536717501828021060147962" class="lia-product-mention" data-product="323-1">OData</a> <a href="https://community.sap.com/t5/c-khhcw49343/SAP+BW%25252F4HANA/pd-p/73554900100800000681" class="lia-product-mention" data-product="466-1">SAP BW/4HANA</a> <a href="https://community.sap.com/t5/c-khhcw49343/Python/pd-p/f220d74d-56e2-487e-8e6c-a8cb3def2378" class="lia-product-mention" data-product="126-1">Python</a> </P>2026-01-08T13:11:19.751000+01:00