-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_set_data_to_tab
78 lines (64 loc) · 2.08 KB
/
get_set_data_to_tab
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
METHOD get_data.
TRY.
DATA(lr_axt_api) = cl_axt_tables_api=>create_api_instance( iv_table_id = 'ZTD_NAME4SEARCH' ).
DATA: lt_record_id TYPE TABLE OF axt_record_id.
lr_axt_api->get_list(
EXPORTING
iv_parent_id = iv_partner_guid
IMPORTING
et_record_id = lt_record_id
).
DATA(lv_record_id) = lt_record_id[ 1 ].
lr_axt_api->get_detail(
EXPORTING
iv_record_id = lv_record_id
IMPORTING
es_attr = rs_attr
).
CATCH cx_root.
ENDTRY.
ENDMETHOD.
METHOD set_data.
TRY.
DATA(lr_axt_api) = cl_axt_tables_api=>create_api_instance( iv_table_id = 'ZTD_NAME4SEARCH' ).
TRY.
CALL METHOD lr_axt_api->initialize
* EXPORTING
* it_object_id =
* iv_cascade = ABAP_TRUE
.
CATCH cx_axt_runtime.
ENDTRY.
CALL METHOD lr_axt_api->buffer_subscribe_for_refresh.
DATA: lt_record_id TYPE TABLE OF axt_record_id.
lr_axt_api->get_list(
EXPORTING
iv_parent_id = iv_partner_guid
IMPORTING
et_record_id = lt_record_id
).
DATA(lv_record_id) = VALUE #( lt_record_id[ 1 ] OPTIONAL ).
IF lv_record_id IS NOT INITIAL.
DATA ls_attr_x TYPE ztd_name4search_x.
lr_axt_api->change(
EXPORTING
iv_record_id = lv_record_id
is_data = is_attr
it_changed_fields = get_changed_fields( ls_attr_x )
).
ELSE.
lr_axt_api->create(
EXPORTING
iv_object_id = iv_partner_guid
iv_parent_id = iv_partner_guid
iv_record_id = cl_system_uuid=>create_uuid_x16_static( )
is_data = is_attr
iv_restrictive_mode = abap_true
).
ENDIF.
IF iv_save = abap_true.
lr_axt_api->save( ).
ENDIF.
CATCH cx_root.
ENDTRY.
ENDMETHOD.