-
Notifications
You must be signed in to change notification settings - Fork 170
Structure of FM parameters is cached #40
Copy link
Copy link
Closed
Description
Hello.
I've got functional module ZHHDEMO_STRUCT_MOD with EX_ZHHT_COL2 param.
FUNCTION ZHHDEMO_STRUCT_MOD.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" EXPORTING
*" VALUE(EX_ZHHT_COL2) TYPE ZHHTT_COL2
*"----------------------------------------------------------------------
DATA: ls_col2 TYPE zhhs_col2.
ls_col2-COL1 = 'col1_1'.
ls_col2-COL2 = 'col2_1'.
APPEND ls_col2 TO EX_ZHHT_COL2.
ls_col2-COL1 = 'col1_2'.
ls_col2-COL2 = 'col2_2'.
APPEND ls_col2 TO EX_ZHHT_COL2.
ENDFUNCTION.
And I've got python script that performs the following sequence of actions:
- Prints structure of EX_ZHHT_COL2 parameter;
- Prints function result ZHHDEMO_STRUCT_MOD;
- Gives me the time to modify structure of EX_ZHHT_COL2 parameter;
- Prints structure of EX_ZHHT_COL2 param again. This is proof that the structure has been changed;
- Prints function result ZHHDEMO_STRUCT_MOD which exactly the same as pt 2.
import pyrfc
connection_info = {
# some connection data here
}
function_name = u'ZHHDEMO_STRUCT_MOD'
table_name = u'ZHHTT_COL2'
def get_structure():
with pyrfc.Connection(**connection_info) as con:
interface_response = con.call(
'RFC_GET_FUNCTION_INTERFACE',
**{'FUNCNAME': function_name}
)
assert any(p[u'TABNAME'] == table_name for p in interface_response[u'PARAMS'])
structure_response = con.call(
'RFC_GET_STRUCTURE_DEFINITION',
**{'TABNAME': table_name}
)
fields = structure_response[u'FIELDS']
return [f[u'FIELDNAME'] for f in fields]
def function_call():
with pyrfc.Connection(**connection_info) as con:
return con.call(function_name)
if __name__ == '__main__':
print('STRUCTURE 1', get_structure())
print('RESULT 1', function_call())
raw_input('Structure changed now. Press Enter to continue...')
print('STRUCTURE 2', get_structure())
print('RESULT 2', function_call())I change the structure as follows:

Python script gives me output:
('STRUCTURE 1', [u'ZHHS_COL2', u'COL1', u'COL2'])
('RESULT 1', {u'EX_ZHHT_COL2': [{u'COL2': u'col2_1', u'COL1': u'col1_1'}, {u'COL2': u'col2_2', u'COL1': u'col1_2'}]})
Structure changed now. Press Enter to continue...
('STRUCTURE 2', [u'ZHHS_COL2', u'COL1', u'COL2', u'COL3'])
('RESULT 2', {u'EX_ZHHT_COL2': [{u'COL2': u'col2_1', u'COL1': u'col1_1'}, {u'COL2': u'col2_2', u'COL1': u'col1_2'}]})
The next launch gives me the right output:
('STRUCTURE 1', [u'ZHHS_COL2', u'COL1', u'COL2', u'COL3'])
('RESULT 1', {u'EX_ZHHT_COL2': [{u'COL2': u'col2_1', u'COL3': u'', u'COL1': u'col1_1'}, {u'COL2': u'col2_2', u'COL3': u'', u'COL1': u'col1_2'}]})
Structure changed now. Press Enter to continue...
('STRUCTURE 2', [u'ZHHS_COL2', u'COL1', u'COL2', u'COL3'])
('RESULT 2', {u'EX_ZHHT_COL2': [{u'COL2': u'col2_1', u'COL3': u'', u'COL1': u'col1_1'}, {u'COL2': u'col2_2', u'COL3': u'', u'COL1': u'col1_2'}]})
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

