Reputation: 11
I'm using PyRFC to make a RFC call to my client's SAP function module. I've verified that the connection is established and I can call most of the functions with correct outputs, but there is a function module with an import parameter and a table entry which also requires input.
I've attempted combining the import and table parameters into one dictionary and also tried including them in the call separately but I keep getting a RFC_INVALID_PARAMETER error that claims the table parameter keys are not found on the system. I'm suspecting that my program thinks the table parameter values are a part of the import parameters. How can I correctly include both import parameters and table parameters in the function call? Below are the screenshots of the function module on SAP and a snippet of my code structure.
import_param = {
'PARAM1':'ABC',
'PARAM2':'DEF'
}
table_param = {
'TAB_PARAM':'ABC',
'TAB_PARAM2':'DEF'
}
conn = Connection(user='USER', passwd='PASSWORD', group='GROUP', ashost='HOST', sysnr='SYS_NR',client='CLIENT_NR')
result = conn.call('FUNCTION_NAME', **import_param, **table_param)
Upvotes: 1
Views: 1989
Reputation: 10621
You just specify table parameters like this
def func():
import pyrfc
from pyrfc import Connection
conn=pyrfc.Connection(user='', passwd='', ashost='', etc.)
order_header = {u'struct_field1':'100',u'struct_field2':'40',u'struct_field3':'US01'}
item_line = {u'table_field1':'200',u'table_field2':'50',u'table_field3':'US02'}
result=con.call("BAPI_SALESORDER_CREATEFROMDAT2", ORDER_HEADER_IN=order_header,
...
ORDER_ITEMS_IN=[item_line])
print(result['RETURN'])
So table parameters need to be lists, not a dictionary.
Upvotes: 0