Function Imports这个我理解的是函数输入查询,也就是你传入参数,然后ECC用传用的参数查询出一个内表返回给ODATA,
ODATA学习(SAP Press – OData and SAP NetWeaver Gateway)第6.5.6章节,第298页
Function imports or actions are supposed to be used whenever a function
needs to be executed on a business object that doesn’t fit into the
default CRUD-Q operations. One example is the release of a sales order
that might influence a number of properties and in addition also trigger
some backend functionality (e.g., start a workflow). Function imports
are defined on the service level, so a function isn’t executed on a dedicated
collection or entry.
我的设想是,当用户输入销售员时(Zsaleman在销售单的抬头H表中)时,取出所有销售人员的销售单号,并关联到销售明细,最终取出销售员所有的销售部明细数据。
一、创建一个Function Imports名字为:FM_SALEMAN_ZTSALE_I的Function Imports,增加Function Import Parameters名字为:Saleuser.
二、重定义ODATA对像的DPC_EXT类(ZCL_ZSALE_DPC_EXT)的/IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION方法,在此方法中,IV_ACTION_NAME为传的Function Imports名字(FM_SALEMAN_ZTSALE_I),IT_PARAMETER存放调用时传的传RANGES。
折腾了好一会,打开地址http://bwnep:8917/sap/opu/odata/sap/ZSALE_SRV/FM_SALEMAN_ZTSALE_I?Saleuser=’GAOG’地址,后报错,并且发现,DEBUG断点没有进入到/IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION方法中,所以可能是重写此方法是不对的。,
没解决,没办法,只能先放一放,以后想办法测试
<Error_Resolution>
<SAP_Transaction>
Run transaction /IWFND/ERROR_LOG on SAP NW Gateway hub system and search for entries with the timestamp above for more details
</SAP_Transaction>
<SAP_Note>
See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)
</SAP_Note>
</Error_Resolution>