sap 博客有写

odata batch 处理前,先看一张图

In this blog post,we are going to see how to send a Odata Batch Request to the SAP Cloud for Customer system using POSTMAN Tool.

Answers to expect from this post?

  1. How to use batch request in the POSTMAN Tool
  2. What all are the Pre-requisites needs to be done before making a batch call.
  3. What is the format we need to follow in a batch Payload.
  4. What all are the header details needs to be maintained.

Lets get started:

Step 1 :

Login to the Postman Tool using your credentials.

In the Authorization Tab, Enter your credentials as below:

Step 2 :

The Next step is to fetch the CSRF Token.

CSRF Token is necessary in order to update or create the records in the C4C System.

For a GET Call, you don’t need a CSRF Token.

In order to get the CSRF Token,Go to the Header Tab.

Enter ‘x-csrf-token’ in the key and ‘Fetch’ in the Value as below:

After this, you have to make a get call to the C4C System.
Choose the action as GET and enter the URL to make the GET call to C4C System.

URL :

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection(‘YYYYYYYYYYY’)

XXXXXX – Tenant ID
YYYYYYYYYYYYY – Object id of a particular record in the Service Request Collection.

Note: You can use any collection to get the CSRF Token.

Once the GET Call is made, Go to the Headers Tab and Copy the x-csrf-token.

Now, navigate to the Top Header Tab and Paste the CSRF Token as below:

We have completed the Pre-requisite to post a record in the system.

Step 3 :

Now, we are going to create 3 Service Requests in the system in a single batch call.

Choose the Action as POST and enter the URL as below:

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/$batch

In case of batch call, you don’t need to mention the Collection name as you will mention the collection name in the Payload.

Go the Tab Body and Choose raw.

Copy paste the below Sample Payload.

This Payload will create three Service Requests in the System. We are passing only the Name field to create a record in the system, as it is the only mandatory field to create a Service Request.

Sample Payload for creating three records in the Batch Call :

--batch
Content-Type: multipart/mixed; boundary=changeset--changeset
Content-Type: application/http
Content-Transfer-Encoding: binaryPOST ServiceRequestCollection HTTP/1.1
Content-Type: application/json
Content-ID: 2
Content-Length: 10000{
"Name":"Testing 1"
}--changeset
Content-Type: application/http
Content-Transfer-Encoding: binaryPOST ServiceRequestCollection HTTP/1.1
Content-Type: application/json
Content-ID: 2
Content-Length: 10000{
"Name":"Testing 2"
}--changeset
Content-Type: application/http
Content-Transfer-Encoding: binaryPOST ServiceRequestCollection HTTP/1.1
Content-Type: application/json
Content-ID: 2
Content-Length: 10000{
"Name":"Testing 3"
}--changeset--
--batch--

It is important to maintain the content type in the Header, for the system to recognize the Payload.

Once you add the Payload and the Headers, Click “SEND’ to send the request to the C4C System.

The request is successful, only when you receive a response back as below:

Conclusion:

If you get any error or if you are not getting any response back, check the below points :

  1. The Payload is Space Sensitive, it is mandatory to maintain the proper spacings.
  2. You are opening the Payload with –batch and it should be closed with –batch—
  3. The Changeset needs to be used only if you are changing the data in the database using POST, PATCH, PUT.
  4. Changeset is not required to fetch a data from the database.

hana odata batch相关推荐

  1. SAP OData $batch processing

    例として.1回の呼び出しで100個の新しい商品を作成したい場合.最も簡単な方法は.$ batch要求を使用して100個のPOST呼び出しすべてを単一のサービス呼び出しにまとめることです. URIの末尾 ...

  2. SAP OData batch request的并行处理实现原理

    Created by Jerry Wang, last modified on Oct 30, 2015 用下面这个方法检查全局设置: 检查batch 并行处理是否已经被disable: 默认情况下, ...

  3. SAP Odata batch操作,只支持multipart_mixed类型的content-type

    题目所说的这个限制在SAP OData gateway的源代码里看得非常清楚: WHEN /IWCOR/if_DS_uri=>gc_uri_type_9.CASE lv_http_method. ...

  4. OData BATCH 使用方法

    第一章 Fiori关联OData之批量处理 前言 二.使用步骤 1.在OData中重新定义 2.重定义代码 前言 在实际Fiori项目中批量更新的场景也会偶尔出现,批量查询,批量更新,批量删除 一.批 ...

  5. first OData Batch operation when Sales Pipeline is launched

    Created by Wang, Jerry, last modified on Sep 24, 2015

  6. How is an SAP OData Batch request handled in the backend

    Created by Wang, Jerry, last modified on Jan 20, 2015 要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  7. SAP OData Batch request processing in backend

    Created by Wang, Jerry, last modified on Jul 09, 2015 要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  8. 【HANA系列】SAP HANA XS使用Odata标志全解析

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[HANA系列]SAP HANA XS使用Oda ...

  9. SAP OData编程指南

    OData(Open Data Protocol)协议是一个开放的工业标准,用于定义RESTFul API的设计和使用.我的文章标题前加上SAP的前缀,只是为了表明这篇文章介绍的是Jerry在SAP项 ...

最新文章

  1. ffmpeg api的应用——提取视频图片
  2. 如何使CPU占用率为50%
  3. NLP之TFTS读入数据:TF之TFTS读入时间序列数据的几种方法
  4. ATO,MTO和ETO
  5. 一个 Task 不够,又来一个 ValueTask ,真的学懵了!
  6. [css] 举例说明伪类:focus-within的用法
  7. 行为设计模式 - 责任链设计模式
  8. 发送邮件 (Send Email)
  9. 特征工程(三):特征缩放,从词袋到 TF-IDF
  10. 凸优化第六章逼近与拟合 6.4 鲁棒逼近
  11. python 执行shell_python执行shell命令四法
  12. python绘制等高线图
  13. java修改mtu值_windows XP系统怎么通过 CMD 系统修改 MTU 值?
  14. Go语言中开启和退出协程
  15. 网站响应速度慢,这些原因不可不知?
  16. latex表格水平垂直居中
  17. Html5新特性归纳
  18. java计时器StopWatch
  19. C语言经典算法100例(一)
  20. Chrome使用独立显卡开启WebGPU

热门文章

  1. Tailwind Border
  2. excel如何合并多个表格文件
  3. 2022Java后端开发面试题总结(社招+春招+秋招)
  4. 如何实现登录互踢 即如何实现当用户登录之后 如果在其他地方再次登录 则这边的用户自动退出系统...
  5. Arduino uno 折腾笔记-uno 变 键盘
  6. 微信小程序电影购票+后台管理系统
  7. 年内涨幅超500%,现代牙科蹭了谁的“热度”?
  8. 服务器计费系统,《仙境传说》两服务器计费系统升级
  9. 修改伪造Flash版本号
  10. win10系统笔记本电脑修改注册表设置自动锁屏时间的方法