-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathChangeset_Process
More file actions
94 lines (78 loc) · 3.44 KB
/
Copy pathChangeset_Process
File metadata and controls
94 lines (78 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
METHOD /iwbep/if_mgw_appl_srv_runtime~changeset_process.
DATA: ls_changeset_request TYPE /iwbep/if_mgw_appl_types=>ty_s_changeset_request,
ls_changeset_response TYPE /iwbep/if_mgw_appl_types=>ty_s_changeset_response,
lo_request_context_d TYPE REF TO /iwbep/if_mgw_req_entity_d,
lo_request_context_merge TYPE REF TO /iwbep/if_mgw_req_entity_p,
lt_components TYPE /iwbep/if_mgw_appl_types=>ty_t_components,
ls_component TYPE /iwbep/if_mgw_appl_types=>ty_s_component,
lt_group_request TYPE /iwbep/if_mgw_appl_types=>ty_t_changeset_request,
lv_entity_name TYPE /iwbep/mgw_tech_name,
lo_request_context TYPE REF TO /iwbep/if_mgw_req_entity_c,
lt_keys TYPE /iwbep/t_mgw_tech_pairs,
ls_key TYPE /iwbep/s_mgw_tech_pair.
* List of operations
LOOP AT it_changeset_request INTO ls_changeset_request.
" Operation Number in current changeset
ls_changeset_response-operation_no = ls_changeset_request-operation_no.
"Read Entity Name
lo_request_context ?= ls_changeset_request-request_context.
lv_entity_name = lo_request_context->get_entity_type_name( ).
CASE lv_entity_name.
WHEN 'EntityOne'.
IF ls_changeset_request-operation_type = 'CD' "Create Deep
OR ls_changeset_request-operation_type = 'CE' "Create
OR ls_changeset_request-operation_type = 'PE' "MERGE
"Read changeset data (for POST/PUT)
ls_changeset_request-entry_provider->read_entry_data( IMPORTING es_data = ls_requirement ).
ENDIF.
"Read keys for (DELETE/PUT)
IF ls_changeset_request-operation_type = 'DE' "Delete Items.
OR ls_changeset_request-operation_type = 'PE'. "MERGE
lo_request_context_d ?= ls_changeset_request-request_context.
lt_keys = lo_request_context_d->get_keys( ).
READ TABLE lt_keys INTO ls_key WITH KEY name = 'ORDERNUMBER'.
IF sy-subrc EQ 0.
"ls_operation-ordernumber = ls_key-value.
ENDIF.
ENDIF.
IF ls_changeset_request-operation_type = 'PE' "MERGE
"Read Components for MERGE
lo_request_context_merge ?= ls_changeset_request-request_context.
lt_components = lo_request_context_merge->get_components( ).
READ TABLE lt_components WITH KEY property = 'DRAFT' TRANSPORTING NO FIELDS.
IF sy-subrc EQ 0.
"Field was updated. Do the needful.
ENDIF.
ENDIF.
"CD Create Deep Entity
"CE Create Entity
"CM Create Steram
"DE Delete Entity
"DM Delete Stream
"EA Execute Action
"XE Expand Entity
"XS Expand Entity Set
"GE Get Entity
"GS Get Entity Set
"GD Get Entity Set Delta
"GM Get Steram
"PE Patch Entity
"UE Update Entity
"UM Update Stream
"HB Changeset Begin
"HE Changeset End
"HP Changeset Process
"IC Get Is Conditional Implemented
" Set response data
copy_data_to_ref(
EXPORTING
is_data = ls_requirement
CHANGING
cr_data = ls_changeset_response-entity_data ).
INSERT ls_changeset_response INTO TABLE ct_changeset_response.
"Collect data here to be used after ENDLOOP.
CLEAR: ls_changeset_response.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDMETHOD.