Created
July 27, 2021 07:27
-
-
Save larshp/c6a0345c49d4bffbe46d3c2c7812a41b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLASS zcl_bcat_api_ecatt DEFINITION | |
PUBLIC | |
FINAL | |
CREATE PUBLIC . | |
PUBLIC SECTION. | |
CLASS-METHODS create_script . | |
CLASS-METHODS delete_container . | |
CLASS-METHODS delete_script . | |
CLASS-METHODS read_script . | |
CLASS-METHODS create_container . | |
PROTECTED SECTION. | |
PRIVATE SECTION. | |
ENDCLASS. | |
CLASS ZCL_BCAT_API_ECATT IMPLEMENTATION. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Public Method ZCL_BCAT_API_ECATT=>CREATE_CONTAINER | |
* +-------------------------------------------------------------------------------------------------+ | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD create_container. | |
DATA lo_tdc TYPE REF TO cl_apl_ecatt_tdc_api. | |
TRY. | |
cl_apl_ecatt_tdc_api=>create_tdc( | |
EXPORTING | |
i_name = 'ZBLUE01' | |
i_write_access = abap_true | |
IMPORTING | |
e_tdc_ref = lo_tdc ). | |
lo_tdc->set_selected_tdc_attributes( VALUE #( | |
( fname = 'OBJ_VER-TWB_TITLE' value = 'hello world' ) | |
( fname = 'OBJ_DOC-SEARCH_1' value = 'BLUE_CAT' ) ) ). | |
lo_tdc->commit_changes( ). | |
CATCH cx_ecatt_tdc_access INTO DATA(lx_error). | |
MESSAGE lx_error TYPE 'E'. | |
ENDTRY. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Public Method ZCL_BCAT_API_ECATT=>CREATE_SCRIPT | |
* +-------------------------------------------------------------------------------------------------+ | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD create_script. | |
DATA(ls_object) = VALUE etapi_obj( | |
type = cl_apl_ecatt_const=>obj_type_test_script | |
name = 'ZBLUE01' ). | |
TRY. | |
cl_apl_ecatt_api_fc=>get_instance( | |
EXPORTING | |
is_object_id = ls_object | |
IMPORTING | |
ep_ecatt_script_if = DATA(li_api) ). | |
li_api->create_object( | |
it_attr = VALUE #( | |
( fname = 'OBJ_GNDT-TWB_TITLE' value = 'hello world 1' ) | |
( fname = 'OBJ_DOC-SEARCH_1' value = 'BLUE_CAT' ) ) ). | |
CATCH cx_ecatt_api INTO DATA(lx_error). | |
MESSAGE lx_error TYPE 'E'. | |
ENDTRY. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Public Method ZCL_BCAT_API_ECATT=>DELETE_CONTAINER | |
* +-------------------------------------------------------------------------------------------------+ | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD delete_container. | |
TRY. | |
cl_apl_ecatt_tdc_api=>delete_tdc( i_name = 'ZBLUE01' ). | |
CATCH cx_ecatt_tdc_access INTO DATA(lx_error). | |
MESSAGE lx_error TYPE 'E'. | |
ENDTRY. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Public Method ZCL_BCAT_API_ECATT=>DELETE_SCRIPT | |
* +-------------------------------------------------------------------------------------------------+ | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD delete_script. | |
DATA(ls_object) = VALUE etapi_obj( | |
type = cl_apl_ecatt_const=>obj_type_test_script | |
name = 'ZBLUE01' ). | |
TRY. | |
cl_apl_ecatt_api_fc=>get_instance( | |
EXPORTING | |
is_object_id = ls_object | |
IMPORTING | |
ep_ecatt_script_if = DATA(li_api) ). | |
li_api->delete_object( ls_object ). | |
CATCH cx_ecatt_api INTO DATA(lx_error). | |
MESSAGE lx_error TYPE 'E'. | |
ENDTRY. | |
ENDMETHOD. | |
* <SIGNATURE>---------------------------------------------------------------------------------------+ | |
* | Static Public Method ZCL_BCAT_API_ECATT=>READ_SCRIPT | |
* +-------------------------------------------------------------------------------------------------+ | |
* +--------------------------------------------------------------------------------------</SIGNATURE> | |
METHOD read_script. | |
DATA(ls_object) = VALUE etapi_obj( | |
type = cl_apl_ecatt_const=>obj_type_test_script | |
name = 'ZBLUE01' ). | |
TRY. | |
cl_apl_ecatt_api_fc=>get_instance( | |
EXPORTING | |
is_object_id = ls_object | |
IMPORTING | |
ep_ecatt_script_if = DATA(li_api) ). | |
li_api->load_object( ). | |
li_api->get_object_attributes( | |
IMPORTING | |
et_attr_desc = DATA(lt_attr) ). | |
BREAK-POINT. | |
CATCH cx_ecatt_api INTO DATA(lx_error). | |
MESSAGE lx_error TYPE 'E'. | |
ENDTRY. | |
ENDMETHOD. | |
ENDCLASS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment