UI5-技术篇-Expand与Deep 服务测试
2024-08-27 05:06:51
1.SEGW创建服务
2.创建Data Model
2.1Entity Types
ZRICO_USR 设置主键、排序字段、过滤字段
ZRICO_USRITM设置主键
2.2Associations
创建associations,设置主要实体 ZRICO_USR ,依赖实体ZRICO_USRITM,两者对应关系N:M
0:0...1 记录可有可无,最多一条记录
1:1必须存在一条记录
M:0..n记录可有可无,可有n条记录
N:1...n至少存在一条记录,可有n条记录
主表与从表字段关联关系,如上图。
2.3Navigation Properties
3.Service Implementation
4.Runtime Artifacts
5.类方法重写
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY
method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY.
**try.
*CALL METHOD SUPER->/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY
* EXPORTING
** iv_entity_name =
** iv_entity_set_name =
** iv_source_name =
* IO_DATA_PROVIDER =
** it_key_tab =
** it_navigation_path =
* IO_EXPAND =
** io_tech_request_context =
** importing
** er_deep_entity =
* .
** catch /iwbep/cx_mgw_busi_exception .
** catch /iwbep/cx_mgw_tech_exception .
**endtry.
data:
begin of wa_deep_entity ,
mandt type zrico_usr-mandt,
usrid type zrico_usr-usrid,
usrname type zrico_usr-usrname,
usraddr type zrico_usr-usraddr,
headertoitem type standard table of zrico_usritm with default key.
data:end of wa_deep_entity . data:
ls_deep_entity like wa_deep_entity,
ls_header type zrico_usr.
data:
lt_deep_entity like table of wa_deep_entity,
lt_items type table of zrico_usritm. field-symbols:
<fs_item> like line of lt_items. "Get data from front-end
io_data_provider->read_entry_data(
importing
es_data = ls_deep_entity ). "Process data received
"Data-action here****************
loop at ls_deep_entity-headertoitem assigning <fs_item>.
<fs_item>-usrte = ''.
endloop.
"Data-action here**************** "Returned processed data back to front-end
copy_data_to_ref( exporting is_data = ls_deep_entity changing cr_data = er_deep_entity ). clear ls_deep_entity.
endmethod.
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET
method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET.
**try.
*CALL METHOD SUPER->/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET
** exporting
** iv_entity_name =
** iv_entity_set_name =
** iv_source_name =
** it_filter_select_options =
** it_order =
** is_paging =
** it_navigation_path =
** it_key_tab =
** iv_filter_string =
** iv_search_string =
** io_expand =
** io_tech_request_context =
** importing
** er_entityset =
** et_expanded_clauses =
** et_expanded_tech_clauses =
** es_response_context =
* .
** catch /iwbep/cx_mgw_busi_exception .
** catch /iwbep/cx_mgw_tech_exception .
**endtry.
data:
begin of wa_deep_entity ,
mandt type zrico_usr-mandt,
usrid type zrico_usr-usrid,
usrname type zrico_usr-usrname,
usraddr type zrico_usr-usraddr,
headertoitem type standard table of zrico_usritm with default key.
data:end of wa_deep_entity . data:
rt_usrid type range of zrico_usr-usrid.
data:
lt_deep_stru like table of wa_deep_entity.
data:
ls_usr type zcl_zrico_deep_usr_mpc_ext=>ts_zrico_usr,
ls_usritm type zcl_zrico_deep_usr_mpc_ext=>ts_zrico_usritm,
ls_filter type /iwbep/s_mgw_select_option,
ls_option type /iwbep/s_cod_select_option,
ls_deep_stru like wa_deep_entity,
ls_expand like line of et_expanded_tech_clauses,
ls_range like line of rt_usrid.
data:
lv_usrid type zrico_usr-usrid. "过滤条件
loop at it_filter_select_options into ls_filter.
loop at ls_filter-select_options into ls_option.
translate ls_filter-property to upper case.
case ls_filter-property.
when 'USRID'.
lv_usrid = ls_option-low.
when others.
endcase.
endloop.
endloop. if lv_usrid is not initial.
ls_range-sign = 'I'.
ls_range-option = 'EQ'.
ls_range-low = lv_usrid.
append ls_range to rt_usrid.
endif. select *
into corresponding fields of ls_deep_stru
from zrico_usr
where usrid in rt_usrid.
if sy-subrc = .
select *
into corresponding fields of table ls_deep_stru-headertoitem
from zrico_usritm
where usrid = ls_deep_stru-usrid. append ls_deep_stru to lt_deep_stru.
clear:ls_deep_stru.
endif.
endselect. ls_expand = 'HEADERTOITEM'.
append ls_expand to et_expanded_tech_clauses. if iv_entity_set_name = 'ZRICO_USRSet'
and io_expand->compare_to_tech_names( 'HEADERTOITEM') EQ io_expand->gcs_compare_result-match_equals . clear:er_entityset. copy_data_to_ref(
exporting
is_data = lt_deep_stru
changing
cr_data = er_entityset ). endif.
endmethod.
6.服务注册
7.Postman服务测试
7.1GET_EXPANDED_ENTITYSET测试
7.2CREATE_DEEP_ENTITY测试
获取上一步GET到的TOKEN
BODY赋值,如上图。
最新文章
- svn的使用(转载)
- redis教程(整理中)
- Centos7 安装配置Mysql
- C/C++入门基础---指针(2)
- [Android Tips] 1. Getting StatusBar Height
- baseDao 使用spring3+hibernate3方式
- ZOJ 3329-One Person Game(概率dp,迭代处理环)
- C#学习笔记(七):智能编译器
- 【转】10分钟搭建NDK的Android开发环境
- CSS 命名规则
- Django学习(四) Django提供的后台管理系统以及如何定义URL路由
- vmware 10 注冊码
- web中国的数据分析过程
- python 作用域
- 使用Ajax出现302 Moved Temporarily
- eclipse 配置打开工作空间
- Winfrom控件使用
- InstallShield卸载状态
- JSP之使用useBean、setProperty、getProperty指令
- jQuery学习- 层叠选择器
热门文章
- Python3基础 交换两个变量的值
- rs-enumerate-devices data
- Spring cloud微服务安全实战-6-3JWT改造之网关和服务改造
- 【PHP】 解决array_filter会过滤0 false的问题
- oraagent.bin High Memory Usage as Dependent Listener was Removed/Renamed
- Delphi 中使用计算出的字段
- 模仿系统C键功能菜单
- 关于mathtype6.9在office2010中出现The MathType can not be found的问题
- java后端通过request对象获取请求的ip地址工具类
- synchrnized 和lock的区别