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

Data from Python into Structured Operator

beavis
Explorer
0 Likes
1,714

Greetings Everyone,

We try to load data from AWS (S3) into BW4HANA. We need to apply some logic in transformations and therefore require a python operator and then using the SAP Application Producer to write the entries directly into an adso on BW4HANA.

This is all working 100% when using any INT value, the moment a STRING value is used a data type mismatch error occur on the sap application producer.

Apologies for the lengthy details.

______________________________________________________________________

Sample Pipeline

Custom table created, to be able to map the fields in the structured operators.
A dynamic table option was tried, however as these tables are only “created” at runtime, the fields are not available for mapping for example in the Data Transform operator

Data Transform

SAP Application Producer

Python Script

counter=0

def gen():
    
    global counter
    tbl = []
    
    tbl = [[counter+i,str(counter+i*1000000011)] for i in range(1,11)]  
    
    table = api.Table(tbl, "com.tbw.battery_part")
    
    api.outputs.myDynamicPort.publish(table)
    
    counter += 10
    
    return 5

api.add_timer(gen)

Python Output Port

aDSO on BW4HANA

Error Message when executing

STEPS THAT are WORKING with only INT values

  • Changed the PART_NUMBER on the custom table “com.tbw.battery_part” to type INT32.
  • Updated the Data Transform to reflect the change from STRING to INT32
  • Updated the aDSO for PART_NUMBER to also an INT4.
  • Remapped the SAP Application Producer and ensure the fields mapped are all now of type INT.
  • Ran the pipeline and the entries was stored correctly in the adso.
  • Both the Part Number Length and Part Number columns are of type INT4 on the adso and all working 100%.

Data written into adso

Have anyone came across this, or have suggestions to try?

Thanks

View Entire Topic
beavis
Explorer
0 Likes

Thanks for the suggestion James, I have tried to create the entry but do not see the option as in your example.
I do not see the the "Scalar Type: Select / Create

Is this version related perhaps or maybe I do not have the required access.

jimgiffin
Product and Topic Expert
Product and Topic Expert
0 Likes

Rudi -

Can you try to add the scalar type in the lower right panel of your graph then add it to the table definition?

See screenshot, it is located below the configuration panel on your source graph.

Once you define the scalar, you should be able to select it in your dropdown for Scalar Type ID in your version (I assume it is an on-premise version of DI)