主页 > CDN > > 正文

腾讯云_罗斯文数据库_企业级

来源:胜利云 发布时间:2022-06-10 11:30 标签:数据库腾讯企业级罗斯文斯文
浏览:

腾讯云_罗斯文数据库_企业级

Hi All,

This document covers about Function Import in OData along with an overview of Eclispe OData Modeler tool. Function import is a feature in OData that is similar to an RFC call. Function import will be having import and output parameters separate rather than using the same structure for import and export in other CRUD operations in OData

.

Usually function imports are used when the similar functionality cannot be achieved by CRUD operations. Function imports can be invoked as GET or POST HTTP methods.

The following are the steps involved in creating a Function Import. In this tutorial, instead of importing a DDIC structure. I will be creating the OData Model from a Eclipse OData Modeler.

Here the scenario is to  create an OData to fetch the Flight Booking Details from the SBook table.

i) First create a blank UI5 project to add the OData Model into it

ii)Now create a new OData Development project and select OData Model

iii)Select Blank OData model and the folder should be pointing towards the black SAP UI5 project you have created before.

iv)In the OData editor, you can create Entity Types, Navigation, Associations etc via the GUI editor.

iv)Drag and drop the Entity Type into the editor, Right click the Entity Type and select Add Property and add new fields(Select simple).

vi)You can directly edit the properties of each field in the properties tab as shown below

vii)Add all the necessary fields for the Entity Type.

viii)Now right click on the project and click on export, select OData Model under OData Development.

ix)Select OData V2 SAP Specific from the drop down list

i)Create a new project and Import OData Model into Gateway Service Builder

ii)Browse to the exported OData Model file

iii)Choose the fields required for your Entity Type

iv)Entity type is being created

v)Create the corresponding Entity Set

vi)Here specify the features that you want for your entity sets by checking the checkboxes

vii)Now right click on the Function Import and click create

viii)Give the name for your Function Import

ix)Select the cardinality as 1:n and then mention the HTTP Method as GET ,select your Entity Set as return entity set and the Entity Type as the same Entity Type you created before.

What is happening here is that you have to specify the return parameters for the function import, and we are using the entity set we created in this project as a return table parameter, which will be having all the booking details that is fetched from the backend Sbook table.

x)Now we need to create import parameters for your import function.(This will be the fields that you will be passing to the OData to get the table in return from the function import as the result, just like how you will be calling an RFC).

Click on new and create the two fields that we want as input parameters for the function import. In this case it will be carr_id and conn_id specify the EDM core Type and Data element.

xi)Now click on the red generate button on the upper left side of the screen and system will now create all Data Provider and Model Provider classes .

xii)Since ours is a custom method, we have to Go to Method /IWBEP/IF_MGW_APPL_SRV_RUNTIME

xiii)Redefine the method (EXECUTE_ACTION)  /IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION

In this method

1) Parameter iv_action_name  will contain the custom function name that you will be requesting through OData URL.

2) Parameter it_parameter    will be having the key fields that you will be sending to the OData as input(ie conn_id and carr_id)

Code Sample

DATA:   ls_parameter  TYPE /iwbep/s_mgw_name_value_pair,

ls_entity     TYPE zcl_zfm_import_mpc=>ts_flight_booking_history,lt_entityset  TYPE zcl_zfm_import_mpc=>tt_flight_booking_history,lv_task_id    TYPE ztask_cnt,lv_carr_id    TYPE S_CARR_ID,lv_conn_id    TYPE S_CONN_ID.

IF iv_action_name = ‘Flt_Bk_Hst’.IF it_parameter IS NOT INITIAL.*** Read Function import parameter valueREAD TABLE it_parameter INTO ls_parameter WITH KEY name = ‘carr_id’.lv_carr_id = ls_parameter–value.READ TABLE it_parameter INTO ls_parameter WITH KEY name = ‘conn_id’.lv_conn_id = ls_parameter–value.

SELECT  * FROM sbook INTO CORRESPONDING FIELDS OFTABLE lt_entityset  WHERE CARRID  = lv_carr_idAND   CONNID  = lv_conn_id.                                                                "Your logic to fetch your data goes here

copy_data_to_ref( EXPORTING is_data = lt_entityset        "This is used to set the data back to the Odata response

CHANGING cr_data = er_data ).

ENDIF.

xiv) Save the above code and activate it.The go to the Net weaver gateway client to test the OData.

Use  /sap/opu/odata/sap/ZFM_IMPORT_SRV/$metadata (use the $metadata URI to see the custom function import name in the response body)

xv) /sap/opu/odata/sap/ZFM_IMPORT_SRV/Flt_Bk_Hst?carr_id=’AA’&conn_id=’19’

Now use the above URL format to access the function import and the input parameters which is separated by ‘&’.

xvii)You can see the output of the OData with corresponding Booking Details against the Keys.

xviii)Output in browser

Regards,

Bince Mathew

Good work Bince .

Sree

Nice Mathew,

Great Document, that covers 2 tools end to end

Keep going, Bince Mathew

Its useful.. thanks for sharing it!!!

Hi Bince,

How about when there are multiple inputs.i.e internal table.

Hi Bince,

do you know a way in order to export Odata from SEGW into Eclipse ?

thanks

Filippo

Hi Filippo,

what you can do  is to register your service, then invoke the $metadata document in a browser and download the xml source to a file.

This file can then be imported in Eclipse, while creating a new OData Model, you have the choice it create from "OData Metadata File".

Or you can use File -> Import -> OData Model

Alternatively, you can do the same directly from the "OData Service URL"

Cheers,

Carlos

Hi,

Good work Bince ....

,云端服务器,大数据处理平台,物联网智库,企业管理应用,云服务器租用价格
发表评论
验证码: 点击我更换图片

注:网友评论仅供其表达个人看法,并不代表本站立场。

热门文章

  • 谷歌云_mysql中间件_免费领
    谷歌云_mysql中间件_免费领

    谷歌云_mysql中间件_免费领

    现在工作场所正在发生重大变化。我们协作、计划项目和管理工作量的方式正在改变,如果企业没有做好准备,它们将很快被抛在后面。准确地理解是什么...

  • 域名交易_阿里云翼_企业级
    域名交易_阿里云翼_企业级

    域名交易_阿里云翼_企业级

    通常认为搅动器是一个漏水的桶。你有多少顾客?你损失了多少?你留了多少钱,漏了多少钱?让我们把顾客流失看作是导致医生就诊的原因,比如偏头痛...

  • 金山云_华为云台_怎么申请
    <strong>金山云_华为云台_怎么申请</strong>

    金山云_华为云台_怎么申请

    在我们发布通知(以前是Engage)后的四个月里,我们在后端做了大量的改进。大多数更新在UI中不可见。相反,我们的客户可能已经注意到他们发送的电子...

  • 云主机_深圳企业网站设计_评分榜
    <strong>云主机_深圳企业网站设计_评分榜</strong>

    云主机_深圳企业网站设计_评分榜

    更新:有本文的更新版本。阅读"RPA如何转换数据迁移"(2019年出版)。 在本文中,数据迁移被定义为将数据从旧的遗留系统移动到新的替换系统。通常,...

  • 域名备案_已备案未注册的域名_最新活动
    <strong>域名备案_已备案未注册的域名_最新活动</strong>

    域名备案_已备案未注册的域名_最新活动

    今天是Skype推出十年来的日子,Skype是一款免费的互联网通话应用,用户已超过3亿。Skype是一家来自爱沙尼亚的初创公司,来自点对点文件共享应用Kazaa的开...

云储存

更多 >
  • <strong>京东云_华为云空间满了怎么删除_折扣</strong>
    京东云_华为云空间满了怎么删除_折扣

    嗨, 非常感谢分享这个。。在配置ARM时,这是最基本和最关键的安全需求之一,我仍然知道一些项目,其中这仍然是一个"过程级"的理解,而不是一个技术...

  • <strong>企业网站_免费的数据库软件_0元</strong>
    企业网站_免费的数据库软件_0元

    听到公司管理层担心他们的预测并不少见。"我们的预测数字不准确",这可能是管理层会议上最常见的说法。它甚至成为许多业务问题的唯一原因。不用说...

云储存云存储_主dns服务器_免费领
云储存CDN_史上最强腹黑夫妻百度云_12月免费
云储存香港带宽_腾讯企业邮箱后缀是什么_怎么
云储存谷歌云_外贸网站建设案例_哪家好
云储存天翼云_mysql空间数据库_年度促销