Академический Документы
Профессиональный Документы
Культура Документы
Hi All,
In above mentioned blog you'll find all structures,tables,entities,entity sets,association and all basic
operations(CRUD), Once you done with basic operations, When the requirement is as follows.. you can
continue with this blog
In some cases, business entity instances may logically belong together and need to be handled or processed together
in the same logical unit of work. For example, on a sales order, an update of two or more related item entries could
be required and must be processed together in a single request (all or none).
SAP Net Weaver Gateway can be used to process such scenarios with its capability to execute multiple operations
in a single request.
Starting with SP 04, SAP Net Weaver Gateway provides the capability for client applications to batch multiple
operations into a single HTTP request, allowing for a series of retrieve operations and/or modifying operations to be
executed using one request.
O Data Batch requests allow the grouping of multiple operations into a single HTTP request payload. The
components of a batch request, how the request is handled, and the components of the batch response have some
significant differences from components and processing of a normal, single-operation OData request.
Batch Requests are submitted as a single HTTP POST request to the batch endpoint of a service.
1. Go to transaction SEGW.
2. Expand Project(which we created in above mentioned blog) -> Run time Artifacts.
6. Redefine methods.
a. /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_BEGIN.
b. /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_END.
Steps:
---------------------------------------------------------------------------------------------------------
Batch Read :
Steps:-
1. Check HTTP Method as POST.
2. Request URI -> Append /$batch at the end of the service name.
------------/sap/ZEMPLOYEE_INFO_SRV/$batch
4. Enter Content-Type as
multipart/mixed; boundary=batch
1. --batch
2. Content-Type: application/http
3. Content-Transfer-Encoding: binary
4.
5. GET EmpDetailsSet('76')?$format=xml HTTP/1.1
6.
7.
8. --batch
9. Content-Type: application/http
10. Content-Transfer-Encoding: binary
11.
12. GET EmpDetailsSet('77')?$format=xml HTTP/1.1
13.
14.
15. --batch—
7. Click Execute.
You’ll get two records in HTTP Response body.
---------------------------------------------------------------------------------------------------------
Batch Create :
Steps :-
1. --batch
2. Content-Type: multipart/mixed; boundary=changeset
3.
4.
5. --changeset
6. Content-Type: application/http
7. Content-Transfer-Encoding: binary
8.
9.
10. POST EmpDetailsSet HTTP/1.1
11. Content-Type: application/atom+xml
12. Content-Length: 588
13.
14.
15. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
16. <atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
17. xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
18. xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
19. <atom:content type="application/xml">
20. <m:properties>
21. <d:DETAILS m:type="ZEMPLOYEE_INFO_SRV.Details">
22. <d:Street1>Pai Layout</d:Street1>
23. <d:Street2>Bangalore</d:Street2>
24. <d:City>BANGALORE</d:City>
25. <d:Country>INDIA</d:Country>
26. </d:DETAILS>
27. <d:EMP_ID>76</d:EMP_ID>
28. <d:NAME>ARSHAD SHAIKH CREATE</d:NAME>
29. <d:ADDRESS>BANGALORE</d:ADDRESS>
30. <d:SALARY>100000000</d:SALARY>
31. </m:properties>
32. </atom:content>
33. </atom:entry>
34.
35.
36. --changeset
37. Content-Type: application/http
38. Content-Transfer-Encoding: binary
39.
40.
41. POST EmpDetailsSet HTTP/1.1
42. Content-Type: application/atom+xml
43. Content-Length: 588
44.
45.
46. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
47. <atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
48. xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
49. xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
50. <atom:content type="application/xml">
51. <m:properties>
52. <d:DETAILS m:type="ZEMPLOYEE_INFO_SRV.Details">
53. <d:Street1>Pai Layout</d:Street1>
54. <d:Street2>KR Puram</d:Street2>
55. <d:City>BANGALORE</d:City>
56. <d:Country>INDIA</d:Country>
57. </d:DETAILS>
58. <d:EMP_ID>77</d:EMP_ID>
59. <d:NAME>LK SONI CREATE</d:NAME>
60. <d:ADDRESS>BANGALORE</d:ADDRESS>
61. <d:SALARY>100000000</d:SALARY>
62. </m:properties>
63. </atom:content>
64. </atom:entry>
65.
66.
67.
68. --changeset--
69. --batch—
6. Click Execute.
---------------------------------------------------------------------------------------------------------
Batch Update :
Steps:-
Follow steps 1- 4 of Batch Read.
1. --batch
2. Content-Type: multipart/mixed; boundary=changeset
3.
4.
5. --changeset
6. Content-Type: application/http
7. Content-Transfer-Encoding: binary
8.
9.
10. PUT EmpDetailsSet('76') HTTP/1.1
11. Content-Type: application/atom+xml
12. Content-Length: 588
13.
14.
15. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
16. <atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
17. xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
18. xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
19. <atom:content type="application/xml">
20. <m:properties>
21. <d:DETAILS m:type="ZEMPLOYEE_INFO_SRV.Details">
22. <d:Street1>Pai Layout</d:Street1>
23. <d:Street2>Bangalore</d:Street2>
24. <d:City>BANGALORE</d:City>
25. <d:Country>INDIA</d:Country>
26. </d:DETAILS>
27. <d:EMP_ID>76</d:EMP_ID>
28. <d:NAME>ARSHAD SHAIKH UPDATE</d:NAME>
29. <d:ADDRESS>BANGALORE</d:ADDRESS>
30. <d:SALARY>100000000</d:SALARY>
31. </m:properties>
32. </atom:content>
33. </atom:entry>
34.
35.
36. --changeset
37. Content-Type: application/http
38. Content-Transfer-Encoding: binary
39.
40.
41. PUT EmpDetailsSet('77') HTTP/1.1
42. Content-Type: application/atom+xml
43. Content-Length: 588
44.
45.
46. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
47. <atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
48. xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
49. xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
50. <atom:content type="application/xml">
51. <m:properties>
52. <d:DETAILS m:type="ZEMPLOYEE_INFO_SRV.Details">
53. <d:Street1>Pai Layout</d:Street1>
54. <d:Street2>KR Puram</d:Street2>
55. <d:City>BANGALORE</d:City>
56. <d:Country>INDIA</d:Country>
57. </d:DETAILS>
58. <d:EMP_ID>77</d:EMP_ID>
59. <d:NAME>LK SONI UPDATE</d:NAME>
60. <d:ADDRESS>BANGALORE</d:ADDRESS>
61. <d:SALARY>100000000</d:SALARY>
62. </m:properties>
63. </atom:content>
64. </atom:entry>
65.
66.
67.
68. --changeset--
69. --batch—
6. Click Execute.
Your No of records maintained in above request body will be updated.
---------------------------------------------------------------------------------------------------------
Batch Delete :
Steps:-
1. --batch
2. Content-Type: multipart/mixed; boundary=changeset
3.
4. --changeset
5. Content-Type: application/http
6. Content-Transfer-Encoding: binary
7.
8. DELETE EmpDetailsSet('76') HTTP/1.1
9.
10.
11. --changeset
12. Content-Type: application/http
13. Content-Transfer-Encoding: binary
14.
15. DELETE EmpDetailsSet('77') HTTP/1.1
16.
17.
18. --changeset--
19. --batch—
6. Click Execute.