如何在网关服务中使用ENQUEUEGETSTAT功能模块,此fm返回3参数(ENTRIES_TOTAL,ENTRIES_PEAK,ENTRIES_ACTUAL)
我可以在Gateway中映射表但无法弄清楚这一点。如何将这些参数收集到内部表中然后导出?
答案 0 :(得分:1)
它看起来像function import
用例。
首先,您必须为返回数据定义ABAP结构,如下所示
AssertionError: Expected 'transform_file' to be called once. Called 0 times.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 890, in _find_spec
AttributeError: 'AssertionRewritingHook' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\anaconda\lib\site-packages\py\_path\common.py", line 29, in fspath
return path_type.__fspath__(path)
AttributeError: type object 'MagicMock' has no attribute '__fspath__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\anaconda\lib\site-packages\py\_path\local.py", line 152, in __init__
path = fspath(path)
File "c:\anaconda\lib\site-packages\py\_path\common.py", line 42, in fspath
+ path_type.__name__)
TypeError: expected str, bytes or os.PathLike object, not MagicMock
... etc etc
在您的SEGW项目中,创建映射到此结构的实体类型@EndUserText.label : 'ENQUEUEGETSTAT'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
define structure zza_enqueuegetstat {
entries_total : abap.int4;
entries_peak : abap.int4;
entries_actual : abap.int4;
}
。
然后,创建一个函数import ENQUEUEGETSTAT
。
转到DPC_EXT类并重新定义方法ENQUEUEGETSTAT
。
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION
保存并激活所有内容。然后,您应该能够访问您的函数import method /iwbep/if_mgw_appl_srv_runtime~execute_action.
data ls_enqueuegetstat type zza_enqueuegetstat.
if iv_action_name = 'ENQUEUEGETSTAT'.
call function 'ENQUEUEGETSTAT'
importing
entries_total = ls_enqueuegetstat-entries_actual
entries_peak = ls_enqueuegetstat-entries_peak
entries_actual = ls_enqueuegetstat-entries_total.
copy_data_to_ref(
exporting
is_data = ls_enqueuegetstat
changing
cr_data = er_data
).
endif.
endmethod.
/sap/opu/odata/sap/**YOUR_SERVICE**/ENQUEUEGETSTAT?$format=json
希望它有所帮助。