Skip to Content
0
Jun 14, 2022 at 09:20 AM

Data from Python into Structured Operator

236 Views

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
image.png

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

image.png

Data Transform

image.png

SAP Application Producer

image.png

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

image.png

aDSO on BW4HANA

image.png

Error Message when executing

image.png

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

image.png

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

Thanks

Attachments

image.png (34.8 kB)
image.png (65.4 kB)
image.png (141.0 kB)
image.png (105.0 kB)
image.png (65.1 kB)
image.png (84.5 kB)
image.png (156.0 kB)
image.png (45.3 kB)