hexsha
stringlengths
40
40
size
int64
16
758k
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
6
146
max_stars_repo_name
stringlengths
8
73
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
2
max_stars_count
int64
1
17.3k
max_stars_repo_stars_event_min_datetime
stringclasses
530 values
max_stars_repo_stars_event_max_datetime
stringclasses
529 values
max_issues_repo_path
stringlengths
6
146
max_issues_repo_name
stringlengths
8
73
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
2
max_issues_count
int64
1
3.24k
max_issues_repo_issues_event_min_datetime
stringclasses
350 values
max_issues_repo_issues_event_max_datetime
stringclasses
350 values
max_forks_repo_path
stringlengths
6
146
max_forks_repo_name
stringlengths
8
73
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
2
max_forks_count
int64
1
4.6k
max_forks_repo_forks_event_min_datetime
stringclasses
388 values
max_forks_repo_forks_event_max_datetime
stringclasses
388 values
content
stringlengths
16
758k
avg_line_length
float64
4.13
40.4k
max_line_length
int64
9
40.4k
alphanum_fraction
float64
0.04
0.97
c80a8f34584a28b1aeab1a377a2dc8a4676b1182
10,278
abap
ABAP
src/objects/zcl_abapgit_object_iarp.clas.abap
D047539/abapGit
cbaf3711b4c41e8376144ad7bd848e6a3d3722bb
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/objects/zcl_abapgit_object_iarp.clas.abap
larshp/abapGit
143f7d4d3b938bdbb418fef5f94665ba1f150fb6
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/objects/zcl_abapgit_object_iarp.clas.abap
D047539/abapGit
cbaf3711b4c41e8376144ad7bd848e6a3d3722bb
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
CLASS zcl_abapgit_object_iarp DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. METHODS: constructor IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item iv_language TYPE spras. PROTECTED SECTION. PRIVATE SECTION. DATA: ms_name TYPE w3resokey. METHODS: read EXPORTING es_attributes TYPE w3resoattr et_parameters TYPE w3resopara_tabletype RAISING zcx_abapgit_exception, save IMPORTING is_attributes TYPE w3resoattr it_parameters TYPE w3resopara_tabletype RAISING zcx_abapgit_exception, w3_api_load RETURNING VALUE(ri_resource) TYPE REF TO if_w3_api_resource RAISING zcx_abapgit_exception, w3_api_get_attributes IMPORTING ii_resource TYPE REF TO if_w3_api_resource RETURNING VALUE(rs_attributes) TYPE w3resoattr RAISING zcx_abapgit_exception, w3_api_get_parameters IMPORTING ii_resource TYPE REF TO if_w3_api_resource RETURNING VALUE(rt_parameters) TYPE w3resopara_tabletype RAISING zcx_abapgit_exception, w3_api_create_new IMPORTING is_attributes TYPE w3resoattr RETURNING VALUE(ri_resource) TYPE REF TO if_w3_api_resource RAISING zcx_abapgit_exception, w3_api_set_attributes IMPORTING ii_resource TYPE REF TO if_w3_api_resource is_attributes TYPE w3resoattr RAISING zcx_abapgit_exception, w3_api_set_parameters IMPORTING ii_resource TYPE REF TO if_w3_api_resource it_parameters TYPE w3resopara_tabletype RAISING zcx_abapgit_exception, w3_api_save IMPORTING ii_resource TYPE REF TO if_w3_api_resource RAISING zcx_abapgit_exception, w3_api_set_changeable IMPORTING ii_resource TYPE REF TO if_w3_api_resource iv_changeable TYPE abap_bool DEFAULT abap_true RAISING zcx_abapgit_exception, w3_api_delete IMPORTING ii_resource TYPE REF TO if_w3_api_resource RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_object_iarp IMPLEMENTATION. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). ms_name = ms_item-obj_name. ENDMETHOD. METHOD read. DATA: li_resource TYPE REF TO if_w3_api_resource. li_resource = w3_api_load( ). es_attributes = w3_api_get_attributes( li_resource ). CLEAR: es_attributes-chname, es_attributes-tdate, es_attributes-ttime, es_attributes-devclass. et_parameters = w3_api_get_parameters( li_resource ). ENDMETHOD. METHOD save. DATA: li_resource TYPE REF TO if_w3_api_resource. li_resource = w3_api_create_new( is_attributes ). w3_api_set_attributes( ii_resource = li_resource is_attributes = is_attributes ). w3_api_set_parameters( ii_resource = li_resource it_parameters = it_parameters ). w3_api_save( li_resource ). " Release locks w3_api_set_changeable( ii_resource = li_resource iv_changeable = abap_false ). ENDMETHOD. METHOD w3_api_create_new. cl_w3_api_resource=>if_w3_api_resource~create_new( EXPORTING p_resource_data = is_attributes IMPORTING p_resource = ri_resource EXCEPTIONS object_already_existing = 1 object_just_created = 2 not_authorized = 3 undefined_name = 4 author_not_existing = 5 action_cancelled = 6 error_occured = 7 OTHERS = 8 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_resource~create_new. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_delete. ii_resource->if_w3_api_object~delete( EXCEPTIONS object_not_empty = 1 object_not_changeable = 2 object_invalid = 3 error_occured = 4 OTHERS = 5 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_object~delete. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_get_attributes. ii_resource->get_attributes( IMPORTING p_attributes = rs_attributes EXCEPTIONS object_invalid = 1 resource_deleted = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_resource~get_attributes. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_get_parameters. ii_resource->get_parameters( IMPORTING p_parameters = rt_parameters EXCEPTIONS object_invalid = 1 resource_deleted = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_resource~get_parameters. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_load. cl_w3_api_resource=>if_w3_api_resource~load( EXPORTING p_resource_name = ms_name IMPORTING p_resource = ri_resource EXCEPTIONS object_not_existing = 1 permission_failure = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from w3api_resource~load. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_save. ii_resource->if_w3_api_object~save( EXCEPTIONS object_invalid = 1 object_not_changeable = 2 action_cancelled = 3 permission_failure = 4 not_changed = 5 data_invalid = 6 error_occured = 7 OTHERS = 8 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_object~save. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_set_attributes. ii_resource->set_attributes( EXPORTING p_attributes = is_attributes EXCEPTIONS object_not_changeable = 1 object_deleted = 2 object_invalid = 3 author_not_existing = 4 authorize_failure = 5 error_occured = 6 OTHERS = 7 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_resource~set_attributes. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_set_changeable. ii_resource->if_w3_api_object~set_changeable( EXPORTING p_changeable = iv_changeable EXCEPTIONS action_cancelled = 1 object_locked_by_other_user = 2 permission_failure = 3 object_already_changeable = 4 object_already_unlocked = 5 object_just_created = 6 object_deleted = 7 object_modified = 8 object_not_existing = 9 object_invalid = 10 error_occured = 11 OTHERS = 12 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_object~set_changeable. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_set_parameters. ii_resource->set_parameters( EXPORTING p_parameters = it_parameters EXCEPTIONS object_not_changeable = 1 object_deleted = 2 object_invalid = 3 authorize_failure = 4 invalid_parameter = 5 error_occured = 6 OTHERS = 7 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |error from if_w3_api_resource~set_parameters. Subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. " todo ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: li_resource TYPE REF TO if_w3_api_resource. li_resource = w3_api_load( ). w3_api_set_changeable( li_resource ). w3_api_delete( li_resource ). w3_api_save( li_resource ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: ls_attr TYPE w3resoattr, lt_parameters TYPE w3resopara_tabletype. io_xml->read( EXPORTING iv_name = 'ATTR' CHANGING cg_data = ls_attr ). io_xml->read( EXPORTING iv_name = 'PARAMETERS' CHANGING cg_data = lt_parameters ). ls_attr-devclass = iv_package. save( is_attributes = ls_attr it_parameters = lt_parameters ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lx_error TYPE REF TO zcx_abapgit_exception. TRY. w3_api_load( ). rv_bool = abap_true. CATCH zcx_abapgit_exception INTO lx_error. rv_bool = abap_false. ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. " Covered by ZCL_ABAPGIT_OBJECTS=>JUMP ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_attr TYPE w3resoattr, lt_parameters TYPE w3resopara_tabletype. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. read( IMPORTING es_attributes = ls_attr et_parameters = lt_parameters ). io_xml->add( iv_name = 'ATTR' ig_data = ls_attr ). io_xml->add( iv_name = 'PARAMETERS' ig_data = lt_parameters ). ENDMETHOD. ENDCLASS.
25.440594
105
0.631932
c80aef3ecc26509a0f4bbe9c9f5f214ce34f2ff5
5,933
abap
ABAP
src/zcl_code_dojo_new_features.clas.abap
abap-code-dojo/new_abap_features
32a4cdc42101116604f3bc4846ba6961d74dbde7
[ "Apache-2.0" ]
1
2022-01-19T18:10:20.000Z
2022-01-19T18:10:20.000Z
src/zcl_code_dojo_new_features.clas.abap
abap-code-dojo/new_abap_features
32a4cdc42101116604f3bc4846ba6961d74dbde7
[ "Apache-2.0" ]
null
null
null
src/zcl_code_dojo_new_features.clas.abap
abap-code-dojo/new_abap_features
32a4cdc42101116604f3bc4846ba6961d74dbde7
[ "Apache-2.0" ]
null
null
null
CLASS zcl_code_dojo_new_features DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. TYPES: BEGIN OF _generic_range_str, sign TYPE c LENGTH 1, option TYPE c LENGTH 2, low TYPE c LENGTH 50, high TYPE c LENGTH 50, END OF _generic_range_str, _generic_range_tab TYPE STANDARD TABLE OF _generic_range_str WITH DEFAULT KEY. TYPES: BEGIN OF ts_demodata, name_first TYPE string, name_last TYPE string, city TYPE string, END OF ts_demodata . TYPES: tt_demodata TYPE STANDARD TABLE OF ts_demodata WITH DEFAULT KEY . TYPES: BEGIN OF _number, i TYPE i, END OF _number . TYPES: _numbers TYPE SORTED TABLE OF _number WITH UNIQUE KEY i . TYPES: BEGIN OF _city_count, city TYPE string, count TYPE i, END OF _city_count . TYPES: _cities_count TYPE STANDARD TABLE OF _city_count WITH DEFAULT KEY . TYPES: BEGIN OF _material_price, matnr TYPE matnr, mtart TYPE string, price TYPE p LENGTH 8 DECIMALS 2, END OF _material_price . TYPES: _material_prices TYPE STANDARD TABLE OF _material_price WITH DEFAULT KEY . TYPES: BEGIN OF _material_price_sum, mtart TYPE string, count TYPE i, price TYPE p LENGTH 8 DECIMALS 2, END OF _material_price_sum . TYPES: _material_prices_sum TYPE STANDARD TABLE OF _material_price_sum WITH DEFAULT KEY . METHODS fill_demo_data . METHODS fill_demo_data_numbers RETURNING VALUE(numbers) TYPE _numbers . METHODS fill_demo_data_materials RETURNING VALUE(prices) TYPE _material_prices . METHODS get_cities RETURNING VALUE(cities) TYPE string_table . METHODS get_cities_count_loop RETURNING VALUE(result) TYPE _cities_count . METHODS get_cities_count_for RETURNING VALUE(result) TYPE _cities_count . METHODS get_material_prices RETURNING VALUE(result) TYPE _material_prices_sum . PROTECTED SECTION. private section. data DEMO type TT_DEMODATA . data NUMBERS type _NUMBERS . data MATERIAL_PRICES type _MATERIAL_PRICES . methods FILL_DEMO_DATA_ADDRESSES returning value(ADDRESSDATA) type TT_DEMODATA . methods FILL_RANGES_TABLE_CITY returning value(RANGE_TAB) type _GENERIC_RANGE_TAB . methods FILL_RANGES_TABLE_NAME returning value(RANGE_TAB) type _GENERIC_RANGE_TAB . methods FILL_RANGES_TABLE_HEADER returning value(RANGE_TAB) type _GENERIC_RANGE_TAB . ENDCLASS. CLASS ZCL_CODE_DOJO_NEW_FEATURES IMPLEMENTATION. METHOD fill_demo_data. demo = fill_demo_data_addresses( ). numbers = fill_demo_data_numbers( ). material_prices = fill_demo_data_materials( ). ENDMETHOD. METHOD fill_demo_data_addresses. addressdata = VALUE #( ( name_first = 'Ivonne' name_last = 'Kattafelt' city = 'Berlin' ) ( name_first = 'Lena' name_last = 'Odertal' city = 'Berlin' ) ( name_first = 'Michael' name_last = 'Dschäksn' city = 'Berlin' ) ( name_first = 'John' name_last = 'Johnson' city = 'Hannover' ) ( name_first = 'Enno' name_last = 'Bungee' city = 'Hamburg' ) ). ENDMETHOD. METHOD fill_demo_data_materials. prices = VALUE #( ( matnr = 'PF12345AA' mtart = 'HOLZ' price = '1.11' ) ( matnr = 'PF12345AB' mtart = 'HOLZ' price = '2.22' ) ( matnr = 'PF12345AC' mtart = 'HOLZ' price = '3.33' ) ( matnr = 'GE99999KK' mtart = 'METALL' price = '4.44' ) ( matnr = 'GE99999OO' mtart = 'METALL' price = '5.55' ) ). ENDMETHOD. METHOD fill_demo_data_numbers. numbers = VALUE #( FOR i = 1 WHILE i < 10 ( i = i ) ). ENDMETHOD. METHOD fill_ranges_table_city. range_tab = VALUE #( FOR city IN get_cities( ) ( sign = 'I' option = 'EQ' low = city ) ). ENDMETHOD. METHOD fill_ranges_table_header. range_tab = VALUE #( sign = 'I' option = 'EQ' ( low = 'ONE' ) ( low = 'TWO' ) ( low = 'THREE' ) ). ENDMETHOD. METHOD FILL_RANGES_TABLE_NAME. range_tab = VALUE #( FOR line IN demo ( sign = 'I' option = 'EQ' low = line-name_last ) ). ENDMETHOD. METHOD get_cities. LOOP AT demo INTO DATA(address) GROUP BY address-city INTO DATA(city). APPEND city TO cities. ENDLOOP. ENDMETHOD. METHOD get_cities_count_for. "w/o hungarian notation result = VALUE #( FOR GROUPS city_group OF address IN demo GROUP BY ( city = address-city count = GROUP SIZE ) ( city_group ) ). "with hungarian notation * rt_result = VALUE #( FOR GROUPS ls_city_group OF ls_address IN mt_demo * GROUP BY ( city = ls_address-city * count = GROUP SIZE ) * ( ls_city_group ) ). ENDMETHOD. METHOD get_cities_count_loop. LOOP AT demo INTO DATA(address) GROUP BY ( city = address-city count = GROUP SIZE ) INTO DATA(city_group). * APPEND value #( city = city-city count = city-count ) TO result. APPEND city_group TO result. ENDLOOP. ENDMETHOD. METHOD get_material_prices. result = VALUE #( FOR GROUPS grp OF material IN material_prices GROUP BY ( mtart = material-mtart count = GROUP SIZE ) ( mtart = grp-mtart count = grp-count price = REDUCE #( INIT sum = '0.00' FOR i IN material_prices WHERE ( mtart = grp-mtart ) NEXT sum = sum + i-price ) ) ). ENDMETHOD. ENDCLASS.
27.467593
94
0.60509
c8111a21a205a797c479607b9e3c57480541aa90
3,196
abap
ABAP
src/zif_otlp_model_trace.intf.abap
heliconialabs/abap-opentelemetry
8f43fcefdb8ba73cc00c5a26698097920a517c67
[ "MIT" ]
null
null
null
src/zif_otlp_model_trace.intf.abap
heliconialabs/abap-opentelemetry
8f43fcefdb8ba73cc00c5a26698097920a517c67
[ "MIT" ]
null
null
null
src/zif_otlp_model_trace.intf.abap
heliconialabs/abap-opentelemetry
8f43fcefdb8ba73cc00c5a26698097920a517c67
[ "MIT" ]
null
null
null
INTERFACE zif_otlp_model_trace PUBLIC . * MIT License, Copyright (c) 2022 Heliconia Labs * https://github.com/heliconialabs/abap-opentelemetry * this file corresponds to * https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto TYPES: * message Event { BEGIN OF ty_event, time_unix_nano TYPE int8, name TYPE string, attributes TYPE STANDARD TABLE OF zif_otlp_model_common=>ty_key_value WITH EMPTY KEY, dropped_attributes_count TYPE i, END OF ty_event . TYPES: * message Link { BEGIN OF ty_link, trace_id TYPE xstring, span_id TYPE xstring, trace_state TYPE string, attributes TYPE STANDARD TABLE OF zif_otlp_model_common=>ty_key_value WITH EMPTY KEY, dropped_attributes_count TYPE i, END OF ty_link . * enum StatusCode { TYPES ty_status_code TYPE i . TYPES: * message Status { BEGIN OF ty_status, message TYPE string, code TYPE ty_status_code, END OF ty_status . * enum SpanKind { TYPES ty_span_kind TYPE i . TYPES: * message Span { BEGIN OF ty_span, trace_id TYPE xstring, span_id TYPE xstring, trace_state TYPE string, parent_span_id TYPE xstring, name TYPE string, kind TYPE ty_span_kind, start_time_unix_nano TYPE int8, end_time_unix_nano TYPE int8, attributes TYPE STANDARD TABLE OF zif_otlp_model_common=>ty_key_value WITH EMPTY KEY, dropped_attributes_count TYPE i, events TYPE STANDARD TABLE OF ty_event WITH EMPTY KEY, dropped_events_count TYPE i, links TYPE STANDARD TABLE OF ty_link WITH EMPTY KEY, dropped_links_count TYPE i, status TYPE ty_status, END OF ty_span . TYPES: * message ScopeSpans { BEGIN OF ty_scope_spans, scope TYPE zif_otlp_model_common=>ty_instrumentation_scope, spans TYPE STANDARD TABLE OF ty_span WITH EMPTY KEY, schema_url TYPE string, END OF ty_scope_spans . TYPES: * message ResourceSpans { BEGIN OF ty_resource_span, resource TYPE zif_otlp_model_resource=>ty_resource, scope_spans TYPE STANDARD TABLE OF ty_scope_spans WITH EMPTY KEY, schema_url TYPE string, END OF ty_resource_span . TYPES: * special, top level ty_resource_spans TYPE STANDARD TABLE OF ty_resource_span WITH EMPTY KEY . CONSTANTS: BEGIN OF gc_status_code, unset TYPE ty_status_code VALUE 0, ok TYPE ty_status_code VALUE 1, error TYPE ty_status_code VALUE 2, END OF gc_status_code . CONSTANTS: BEGIN OF gc_span_kind, unspecified TYPE ty_span_kind VALUE 0, internal TYPE ty_span_kind VALUE 1, server TYPE ty_span_kind VALUE 2, client TYPE ty_span_kind VALUE 3, producer TYPE ty_span_kind VALUE 4, consumer TYPE ty_span_kind VALUE 5, END OF gc_span_kind . ENDINTERFACE.
35.511111
106
0.646433
c81235c02fb6c0e4a772b5c819149abfc5c73286
4,134
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ee_dl_hdr_gr.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
3
2021-07-08T07:16:53.000Z
2021-10-18T07:56:18.000Z
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ee_dl_hdr_gr.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ee_dl_hdr_gr.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
FUNCTION zgtt_mia_ee_dl_hdr_gr. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM *" REFERENCE(I_EVENT_TYPE) TYPE /SAPTRX/EVTYPES *" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER *" REFERENCE(I_EVENT_TYPE_CNTL_TABS) TYPE TRXAS_EVENTTYPE_TABS *" REFERENCE(I_EVENTS) TYPE TRXAS_EVT_CTABS *" TABLES *" CT_TRACKINGHEADER STRUCTURE /SAPTRX/BAPI_EVM_HEADER *" CT_TRACKLOCATION STRUCTURE /SAPTRX/BAPI_EVM_LOCATIONID *" OPTIONAL *" CT_TRACKADDRESS STRUCTURE /SAPTRX/BAPI_EVM_ADDRESS OPTIONAL *" CT_TRACKLOCATIONDESCR STRUCTURE /SAPTRX/BAPI_EVM_LOCDESCR *" OPTIONAL *" CT_TRACKLOCADDITIONALID STRUCTURE /SAPTRX/BAPI_EVM_LOCADDID *" OPTIONAL *" CT_TRACKPARTNERID STRUCTURE /SAPTRX/BAPI_EVM_PARTNERID *" OPTIONAL *" CT_TRACKPARTNERADDID STRUCTURE /SAPTRX/BAPI_EVM_PARTNERADDID *" OPTIONAL *" CT_TRACKESTIMDEADLINE STRUCTURE /SAPTRX/BAPI_EVM_ESTIMDEADL *" OPTIONAL *" CT_TRACKCONFIRMSTATUS STRUCTURE /SAPTRX/BAPI_EVM_CONFSTAT *" OPTIONAL *" CT_TRACKNEXTEVENT STRUCTURE /SAPTRX/BAPI_EVM_NEXTEVENT *" OPTIONAL *" CT_TRACKNEXTEVDEADLINES STRUCTURE /SAPTRX/BAPI_EVM_NEXTEVDEADL *" OPTIONAL *" CT_TRACKREFERENCES STRUCTURE /SAPTRX/BAPI_EVM_REFERENCE *" OPTIONAL *" CT_TRACKMEASURESULTS STRUCTURE /SAPTRX/BAPI_EVM_MEASRESULT *" OPTIONAL *" CT_TRACKSTATUSATTRIB STRUCTURE /SAPTRX/BAPI_EVM_STATUSATTR *" OPTIONAL *" CT_TRACKPARAMETERS STRUCTURE /SAPTRX/BAPI_EVM_PARAMETERS *" OPTIONAL *" CT_TRACKFILEHEADER STRUCTURE /SAPTRX/BAPI_EVM_FILEHEADER *" OPTIONAL *" CT_TRACKFILEREF STRUCTURE /SAPTRX/BAPI_EVM_FILEREF OPTIONAL *" CT_TRACKFILEBIN STRUCTURE /SAPTRX/BAPI_EVM_FILEBIN OPTIONAL *" CT_TRACKFILECHAR STRUCTURE /SAPTRX/BAPI_EVM_FILECHAR OPTIONAL *" CT_TRACKTEXTHEADER STRUCTURE /SAPTRX/BAPI_EVM_TEXTHEADER *" OPTIONAL *" CT_TRACKTEXTLINES STRUCTURE /SAPTRX/BAPI_EVM_TEXTLINES *" OPTIONAL *" CT_TRACKEEMODIFY STRUCTURE /SAPTRX/BAPI_EVM_EE_MODIFY OPTIONAL *" CT_EXTENSIONIN STRUCTURE BAPIPAREX OPTIONAL *" CT_EXTENSIONOUT STRUCTURE BAPIPAREX OPTIONAL *" CT_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL *" CHANGING *" REFERENCE(C_EVENTID_MAP) TYPE TRXAS_EVTID_EVTCNT_MAP *" EXCEPTIONS *" PARAMETER_ERROR *" EVENT_DATA_ERROR *" STOP_PROCESSING *"---------------------------------------------------------------------- DATA: lo_udm_message TYPE REF TO cx_udm_message, ls_bapiret TYPE bapiret2. TRY. zcl_gtt_mia_ae_performer=>get_event_data( EXPORTING is_definition = VALUE #( maintab = zif_gtt_mia_app_constants=>cs_tabledef-md_material_header ) io_ae_factory = NEW zcl_gtt_mia_ae_factory_dlh_gr( ) iv_appsys = i_appsys is_event_type = i_event_type it_all_appl_tables = i_all_appl_tables it_event_type_cntl_tabs = i_event_type_cntl_tabs it_events = i_events CHANGING ct_eventid_map = c_eventid_map[] ct_trackingheader = ct_trackingheader[] ct_tracklocation = ct_tracklocation[] ct_trackreferences = ct_trackreferences[] ct_trackparameters = ct_trackparameters[] ). CATCH cx_udm_message INTO lo_udm_message. zcl_gtt_mia_tools=>get_errors_log( EXPORTING io_umd_message = lo_udm_message iv_appsys = i_appsys IMPORTING es_bapiret = ls_bapiret ). " add error message APPEND ls_bapiret TO ct_logtable. " throw corresponding exception CASE lo_udm_message->textid. WHEN zif_gtt_mia_ef_constants=>cs_errors-stop_processing. RAISE stop_processing. WHEN zif_gtt_mia_ef_constants=>cs_errors-table_determination. RAISE event_data_error. ENDCASE. ENDTRY. ENDFUNCTION.
36.584071
116
0.668602
c812cfc7b2d1099a6db731e4eb4a2e5e7add6ce4
227
abap
ABAP
src/unmanaged/#dmo#bp_booking_u28.clas.abap
SAP-Cloud-Platform/flight28
35f184474aa1fb65d95f0c4d259dd1b64c051906
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u28.clas.abap
SAP-Cloud-Platform/flight28
35f184474aa1fb65d95f0c4d259dd1b64c051906
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u28.clas.abap
SAP-Cloud-Platform/flight28
35f184474aa1fb65d95f0c4d259dd1b64c051906
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/bp_booking_u28 DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF /dmo/i_travel_u28 . PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /dmo/bp_booking_u28 IMPLEMENTATION. ENDCLASS.
14.1875
41
0.76652
c81453dae230ac329d1c8e3d0d349c7a62fe174b
10,243
abap
ABAP
src/zabapgit_file_status.prog.abap
christian102094/abapGit
b8df5f1e80c3f944f745bdfae61d37931e037e09
[ "MIT" ]
null
null
null
src/zabapgit_file_status.prog.abap
christian102094/abapGit
b8df5f1e80c3f944f745bdfae61d37931e037e09
[ "MIT" ]
null
null
null
src/zabapgit_file_status.prog.abap
christian102094/abapGit
b8df5f1e80c3f944f745bdfae61d37931e037e09
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Include ZABAPGIT_FILE_STATUS *&---------------------------------------------------------------------* *----------------------------------------------------------------------* * CLASS lcl_file_status DEFINITION *----------------------------------------------------------------------* CLASS ltcl_file_status DEFINITION DEFERRED. CLASS lcl_file_status DEFINITION FINAL FRIENDS ltcl_file_status. PUBLIC SECTION. CLASS-METHODS status IMPORTING io_repo TYPE REF TO lcl_repo io_log TYPE REF TO lcl_log OPTIONAL RETURNING VALUE(rt_results) TYPE ty_results_tt RAISING lcx_exception. PRIVATE SECTION. CLASS-METHODS calculate_status IMPORTING iv_devclass TYPE devclass it_local TYPE ty_files_item_tt it_remote TYPE ty_files_tt it_cur_state TYPE ty_file_signatures_tt RETURNING VALUE(rt_results) TYPE ty_results_tt. CLASS-METHODS: build_existing IMPORTING is_local TYPE ty_file_item is_remote TYPE ty_file it_state TYPE ty_file_signatures_ts RETURNING VALUE(rs_result) TYPE ty_result, build_new_local IMPORTING is_local TYPE ty_file_item RETURNING VALUE(rs_result) TYPE ty_result, build_new_remote IMPORTING iv_devclass TYPE devclass is_remote TYPE ty_file it_items TYPE ty_items_ts it_state TYPE ty_file_signatures_ts RETURNING VALUE(rs_result) TYPE ty_result, identify_object IMPORTING iv_filename TYPE string EXPORTING es_item TYPE ty_item ev_is_xml TYPE abap_bool. ENDCLASS. "lcl_file_status DEFINITION *----------------------------------------------------------------------* * CLASS lcl_file_status IMPLEMENTATION *----------------------------------------------------------------------* CLASS lcl_file_status IMPLEMENTATION. METHOD status. DATA: lv_index LIKE sy-tabix, lo_dot_abapgit TYPE REF TO lcl_dot_abapgit. FIELD-SYMBOLS <ls_result> LIKE LINE OF rt_results. rt_results = calculate_status( iv_devclass = io_repo->get_package( ) it_local = io_repo->get_files_local( io_log = io_log ) it_remote = io_repo->get_files_remote( ) it_cur_state = io_repo->get_local_checksums_per_file( ) ). lo_dot_abapgit = io_repo->get_dot_abapgit( ). " Remove ignored files, fix .abapgit LOOP AT rt_results ASSIGNING <ls_result>. lv_index = sy-tabix. IF lo_dot_abapgit->is_ignored( iv_path = <ls_result>-path iv_filename = <ls_result>-filename ) = abap_true. DELETE rt_results INDEX lv_index. ENDIF. ENDLOOP. lcl_sap_package=>check( io_log = io_log it_results = rt_results iv_start = lo_dot_abapgit->get_starting_folder( ) iv_top = io_repo->get_package( ) ). ENDMETHOD. "status METHOD calculate_status. DATA: lt_remote LIKE it_remote, lt_items TYPE ty_items_tt, ls_item LIKE LINE OF lt_items, lv_is_xml TYPE abap_bool, lt_items_idx TYPE ty_items_ts, lt_state_idx TYPE ty_file_signatures_ts. " Sorted by path+filename FIELD-SYMBOLS: <ls_remote> LIKE LINE OF it_remote, <ls_result> LIKE LINE OF rt_results, <ls_local> LIKE LINE OF it_local. lt_state_idx = it_cur_state. " Force sort it lt_remote = it_remote. SORT lt_remote BY path filename. " Process local files and new local files LOOP AT it_local ASSIGNING <ls_local>. APPEND INITIAL LINE TO rt_results ASSIGNING <ls_result>. IF <ls_local>-item IS NOT INITIAL. APPEND <ls_local>-item TO lt_items. " Collect for item index ENDIF. READ TABLE lt_remote ASSIGNING <ls_remote> WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename BINARY SEARCH. IF sy-subrc = 0. " Exist local and remote <ls_result> = build_existing( is_local = <ls_local> is_remote = <ls_remote> it_state = lt_state_idx ). ASSERT <ls_remote>-sha1 IS NOT INITIAL. CLEAR <ls_remote>-sha1. " Mark as processed ELSE. " Only L exists <ls_result> = build_new_local( is_local = <ls_local> ). ENDIF. ENDLOOP. " Complete item index for unmarked remote files LOOP AT lt_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL. identify_object( EXPORTING iv_filename = <ls_remote>-filename IMPORTING es_item = ls_item ev_is_xml = lv_is_xml ). CHECK lv_is_xml = abap_true. " Skip all but obj definitions ls_item-devclass = lcl_tadir=>get_object_package( iv_object = ls_item-obj_type iv_obj_name = ls_item-obj_name ). APPEND ls_item TO lt_items. ENDLOOP. SORT lt_items. " Default key - type, name, pkg DELETE ADJACENT DUPLICATES FROM lt_items. lt_items_idx = lt_items. " Self protection + UNIQUE records assertion " Process new remote files (marked above with empty SHA1) LOOP AT lt_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL. APPEND INITIAL LINE TO rt_results ASSIGNING <ls_result>. <ls_result> = build_new_remote( iv_devclass = iv_devclass is_remote = <ls_remote> it_items = lt_items_idx it_state = lt_state_idx ). ENDLOOP. SORT rt_results BY obj_type ASCENDING obj_name ASCENDING filename ASCENDING. ENDMETHOD. "calculate_status. METHOD identify_object. DATA: lv_name TYPE tadir-obj_name, lv_type TYPE string, lv_ext TYPE string. " Guess object type and name SPLIT to_upper( iv_filename ) AT '.' INTO lv_name lv_type lv_ext. " Handle namespaces REPLACE ALL OCCURRENCES OF '#' IN lv_name WITH '/'. CLEAR es_item. es_item-obj_type = lv_type. es_item-obj_name = lv_name. ev_is_xml = boolc( lv_ext = 'XML' AND strlen( lv_type ) = 4 ). ENDMETHOD. "identify_object. METHOD build_existing. DATA: ls_file_sig LIKE LINE OF it_state. " Item rs_result-obj_type = is_local-item-obj_type. rs_result-obj_name = is_local-item-obj_name. rs_result-package = is_local-item-devclass. " File rs_result-path = is_local-file-path. rs_result-filename = is_local-file-filename. " Match against current state READ TABLE it_state INTO ls_file_sig WITH KEY path = is_local-file-path filename = is_local-file-filename BINARY SEARCH. IF sy-subrc = 0. IF ls_file_sig-sha1 <> is_local-file-sha1. rs_result-lstate = gc_state-modified. ENDIF. IF ls_file_sig-sha1 <> is_remote-sha1. rs_result-rstate = gc_state-modified. ENDIF. rs_result-match = boolc( rs_result-lstate IS INITIAL AND rs_result-rstate IS INITIAL ). ELSE. " This is a strange situation. As both local and remote exist " the state should also be present. Maybe this is a first run of the code. " In this case just compare hashes directly and mark both changed " the user will presumably decide what to do after checking the actual diff rs_result-match = boolc( is_local-file-sha1 = is_remote-sha1 ). IF rs_result-match = abap_false. rs_result-lstate = gc_state-modified. rs_result-rstate = gc_state-modified. ENDIF. ENDIF. ENDMETHOD. "build_existing METHOD build_new_local. " Item rs_result-obj_type = is_local-item-obj_type. rs_result-obj_name = is_local-item-obj_name. rs_result-package = is_local-item-devclass. " File rs_result-path = is_local-file-path. rs_result-filename = is_local-file-filename. " Match rs_result-match = abap_false. rs_result-lstate = gc_state-added. ENDMETHOD. "build_new_local METHOD build_new_remote. DATA: ls_item LIKE LINE OF it_items, ls_file_sig LIKE LINE OF it_state. " Common and default part rs_result-path = is_remote-path. rs_result-filename = is_remote-filename. rs_result-match = abap_false. rs_result-rstate = gc_state-added. identify_object( EXPORTING iv_filename = is_remote-filename IMPORTING es_item = ls_item ). " Check if in item index + get package READ TABLE it_items INTO ls_item WITH KEY obj_type = ls_item-obj_type obj_name = ls_item-obj_name BINARY SEARCH. IF sy-subrc = 0. " Completely new (xml, abap) and new file in an existing object rs_result-obj_type = ls_item-obj_type. rs_result-obj_name = ls_item-obj_name. rs_result-package = ls_item-devclass. READ TABLE it_state INTO ls_file_sig WITH KEY path = is_remote-path filename = is_remote-filename BINARY SEARCH. " Existing file but from another package " was not added during local file proc as was not in tadir for repo package IF sy-subrc = 0. IF ls_file_sig-sha1 = is_remote-sha1. rs_result-match = abap_true. CLEAR rs_result-rstate. ELSE. rs_result-rstate = gc_state-modified. ENDIF. " Item is in state and in cache but with no package - it was deleted " OR devclass is the same as repo package (see #532) IF ls_item-devclass IS INITIAL OR ls_item-devclass = iv_devclass. rs_result-match = abap_false. rs_result-lstate = gc_state-deleted. ENDIF. ENDIF. ELSE. " Completely unknown file, probably non-abapgit ASSERT 1 = 1. " No action, just follow defaults ENDIF. ENDMETHOD. "build_new_remote ENDCLASS. "lcl_file_status IMPLEMENTATION
34.143333
81
0.614371
c81481f517c21bf30d65eba530a60aa5b31256ce
10,871
abap
ABAP
src/ui/zcl_abapgit_gui_page_codi_base.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_codi_base.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_codi_base.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_codi_base DEFINITION PUBLIC ABSTRACT INHERITING FROM zcl_abapgit_gui_page. PUBLIC SECTION. METHODS: zif_abapgit_gui_event_handler~on_event REDEFINITION. PROTECTED SECTION. CONSTANTS: BEGIN OF c_actions, rerun TYPE string VALUE 'rerun' ##NO_TEXT, sort_1 TYPE string VALUE 'sort_1' ##NO_TEXT, sort_2 TYPE string VALUE 'sort_2' ##NO_TEXT, sort_3 TYPE string VALUE 'sort_3' ##NO_TEXT, stage TYPE string VALUE 'stage' ##NO_TEXT, commit TYPE string VALUE 'commit' ##NO_TEXT, END OF c_actions . DATA mo_repo TYPE REF TO zcl_abapgit_repo . DATA mt_result TYPE scit_alvlist . METHODS render_variant IMPORTING !iv_variant TYPE sci_chkv RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_result IMPORTING !ii_html TYPE REF TO zif_abapgit_html !it_result TYPE scit_alvlist . METHODS render_result_line IMPORTING !ii_html TYPE REF TO zif_abapgit_html !is_result TYPE scir_alvlist . METHODS build_nav_link IMPORTING !is_result TYPE scir_alvlist RETURNING VALUE(rv_link) TYPE string . METHODS jump IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !is_sub_item TYPE zif_abapgit_definitions=>ty_item !iv_line_number TYPE i RAISING zcx_abapgit_exception . METHODS build_base_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . PRIVATE SECTION. CONSTANTS c_object_separator TYPE c LENGTH 1 VALUE '|'. CONSTANTS c_ci_sig TYPE string VALUE 'cinav:'. ENDCLASS. CLASS zcl_abapgit_gui_page_codi_base IMPLEMENTATION. METHOD build_base_menu. DATA: lo_sort_menu TYPE REF TO zcl_abapgit_html_toolbar. CREATE OBJECT lo_sort_menu. lo_sort_menu->add( iv_txt = 'By Object, Check, Sub-object' iv_act = c_actions-sort_1 )->add( iv_txt = 'By Object, Sub-object, Line' iv_act = c_actions-sort_2 )->add( iv_txt = 'By Check, Object, Sub-object' iv_act = c_actions-sort_3 ). CREATE OBJECT ro_menu. ro_menu->add( iv_txt = 'Sort' io_sub = lo_sort_menu ). ro_menu->add( iv_txt = 'Re-Run' iv_act = c_actions-rerun iv_cur = abap_false ). ENDMETHOD. METHOD build_nav_link. rv_link = |{ c_ci_sig }| && |{ is_result-objtype }{ is_result-objname }| && |{ c_object_separator }{ is_result-sobjtype }{ is_result-sobjname }| && |{ c_object_separator }{ is_result-line }|. ENDMETHOD. METHOD jump. DATA: lo_test TYPE REF TO cl_ci_test_root, ls_info TYPE scir_rest, lo_result TYPE REF TO cl_ci_result_root, lv_adt_jump_enabled TYPE abap_bool, lv_line_number TYPE i, ls_item TYPE zif_abapgit_definitions=>ty_item, ls_sub_item TYPE zif_abapgit_definitions=>ty_item. FIELD-SYMBOLS: <ls_result> TYPE scir_alvlist. IF is_sub_item IS NOT INITIAL. READ TABLE mt_result WITH KEY objtype = is_item-obj_type objname = is_item-obj_name sobjtype = is_sub_item-obj_type sobjname = is_sub_item-obj_name line = iv_line_number ASSIGNING <ls_result>. ELSE. READ TABLE mt_result WITH KEY objtype = is_item-obj_type objname = is_item-obj_name line = iv_line_number ASSIGNING <ls_result>. ENDIF. ASSERT <ls_result> IS ASSIGNED. ls_item-obj_name = <ls_result>-objname. ls_item-obj_type = <ls_result>-objtype. ls_sub_item-obj_name = <ls_result>-sobjname. ls_sub_item-obj_type = <ls_result>-sobjtype. " see SCI_LCL_DYNP_530 / HANDLE_DOUBLE_CLICK lv_adt_jump_enabled = zcl_abapgit_persist_factory=>get_settings( )->read( )->get_adt_jump_enabled( ). TRY. IF lv_adt_jump_enabled = abap_true. lv_line_number = <ls_result>-line. zcl_abapgit_objects_super=>jump_adt( iv_obj_name = ls_item-obj_name iv_obj_type = ls_item-obj_type iv_sub_obj_name = ls_sub_item-obj_name iv_sub_obj_type = ls_sub_item-obj_type iv_line_number = lv_line_number ). RETURN. ENDIF. CATCH zcx_abapgit_exception. ENDTRY. TRY. CALL METHOD ('CL_CI_TESTS')=>('GET_TEST_REF') EXPORTING p_test = <ls_result>-test RECEIVING p_result = lo_test. CATCH cx_root. zcx_abapgit_exception=>raise( |Jump to object not supported in your NW release| ). ENDTRY. lo_result = lo_test->get_result_node( <ls_result>-kind ). MOVE-CORRESPONDING <ls_result> TO ls_info. lo_result->set_info( ls_info ). lo_result->if_ci_test~navigate( ). ENDMETHOD. METHOD render_result. CONSTANTS: lc_limit TYPE i VALUE 500. FIELD-SYMBOLS: <ls_result> TYPE scir_alvlist. ii_html->add( '<div class="ci-result">' ). LOOP AT it_result ASSIGNING <ls_result> TO lc_limit. render_result_line( ii_html = ii_html is_result = <ls_result> ). ENDLOOP. ii_html->add( '</div>' ). IF lines( it_result ) > lc_limit. ii_html->add( '<div class="dummydiv warning">' ). ii_html->add( ii_html->icon( 'exclamation-triangle' ) ). ii_html->add( |Only first { lc_limit } findings shown in list!| ). ii_html->add( '</div>' ). ENDIF. ENDMETHOD. METHOD render_result_line. DATA: lv_class TYPE string, lv_obj_txt TYPE string, lv_msg TYPE string, lv_line TYPE i, ls_mtdkey TYPE seocpdkey. CASE is_result-kind. WHEN 'E'. lv_class = 'ci-error'. WHEN 'W'. lv_class = 'ci-warning'. WHEN OTHERS. lv_class = 'ci-info'. ENDCASE. lv_msg = escape( val = is_result-text format = cl_abap_format=>e_html_attr ). IF is_result-sobjname IS INITIAL OR ( is_result-sobjname = is_result-objname AND is_result-sobjtype = is_result-sobjtype ). lv_obj_txt = |{ is_result-objtype } { is_result-objname }|. ELSEIF is_result-objtype = 'CLAS' OR ( is_result-objtype = 'PROG' AND NOT is_result-sobjname+30(*) IS INITIAL ). TRY. CASE is_result-sobjname+30(*). WHEN 'CCDEF'. lv_obj_txt = |CLAS { is_result-objname } : Local Definitions|. WHEN 'CCIMP'. lv_obj_txt = |CLAS { is_result-objname } : Local Implementations|. WHEN 'CCMAC'. lv_obj_txt = |CLAS { is_result-objname } : Macros|. WHEN 'CCAU'. lv_obj_txt = |CLAS { is_result-objname } : Test Classes|. WHEN 'CU'. lv_obj_txt = |CLAS { is_result-objname } : Public Section|. WHEN 'CO'. lv_obj_txt = |CLAS { is_result-objname } : Protected Section|. WHEN 'CI'. lv_obj_txt = |CLAS { is_result-objname } : Private Section|. WHEN OTHERS. cl_oo_classname_service=>get_method_by_include( EXPORTING incname = is_result-sobjname RECEIVING mtdkey = ls_mtdkey EXCEPTIONS class_not_existing = 1 method_not_existing = 2 OTHERS = 3 ). IF sy-subrc = 0. lv_obj_txt = |CLAS { ls_mtdkey-clsname }->{ ls_mtdkey-cpdname }|. ELSE. lv_obj_txt = |{ is_result-objtype } { is_result-sobjname }|. ENDIF. ENDCASE. CATCH cx_root. lv_obj_txt = ''. "use default below ENDTRY. ENDIF. IF lv_obj_txt IS INITIAL. lv_obj_txt = |{ is_result-objtype } { is_result-objname } &gt; { is_result-sobjtype } { is_result-sobjname }|. ENDIF. lv_line = is_result-line. " convert from numc to integer lv_obj_txt = |{ lv_obj_txt } [ @{ lv_line } ]|. ii_html->add( |<li class="{ lv_class }">| ). ii_html->add_a( iv_txt = lv_obj_txt iv_act = build_nav_link( is_result ) iv_typ = zif_abapgit_html=>c_action_type-sapevent ). ii_html->add( |<span>{ lv_msg }</span>| ). ii_html->add( '</li>' ). ENDMETHOD. METHOD render_variant. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div class="ci-head">' ). ri_html->add( |Code inspector check variant: <span class="ci-variant">{ iv_variant }</span>| ). ri_html->add( `</div>` ). ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA: ls_item TYPE zif_abapgit_definitions=>ty_item, ls_sub_item TYPE zif_abapgit_definitions=>ty_item, lv_temp TYPE string, lv_main_object TYPE string, lv_sub_object TYPE string, lv_line_number_s TYPE string, lv_line_number TYPE i. lv_temp = replace( val = ii_event->mv_action regex = |^{ c_ci_sig }| with = `` ). IF lv_temp <> ii_event->mv_action. " CI navigation request detected SPLIT lv_temp AT c_object_separator INTO lv_main_object lv_sub_object lv_line_number_s. ls_item-obj_type = lv_main_object(4). ls_item-obj_name = lv_main_object+4(*). IF lv_sub_object IS NOT INITIAL. ls_sub_item-obj_type = lv_sub_object(4). ls_sub_item-obj_name = lv_sub_object+4(*). ENDIF. lv_line_number = lv_line_number_s. jump( is_item = ls_item is_sub_item = ls_sub_item iv_line_number = lv_line_number ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDIF. CASE ii_event->mv_action. WHEN c_actions-sort_1. SORT mt_result BY objtype objname test code sobjtype sobjname line col. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-sort_2. SORT mt_result BY objtype objname sobjtype sobjname line col test code. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-sort_3. SORT mt_result BY test code objtype objname sobjtype sobjname line col. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDCASE. ENDMETHOD. ENDCLASS.
32.25816
116
0.598473
c816d582a270640342f46aeeacb0feb96649d655
105,228
abap
ABAP
src/legacy/#dmo#cl_flight_data_generat_12.clas.locals_imp.abap
SAP-Cloud-Platform/flight12
f0d19f392ae2ec16cf86d07a41d28c37e7d5ef4c
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#cl_flight_data_generat_12.clas.locals_imp.abap
SAP-Cloud-Platform/flight12
f0d19f392ae2ec16cf86d07a41d28c37e7d5ef4c
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#cl_flight_data_generat_12.clas.locals_imp.abap
SAP-Cloud-Platform/flight12
f0d19f392ae2ec16cf86d07a41d28c37e7d5ef4c
[ "BSD-Source-Code" ]
null
null
null
INTERFACE lif_data_generator. CLASS-METHODS: create IMPORTING out TYPE REF TO if_oo_adt_classrun_out OPTIONAL. ENDINTERFACE. CLASS lcl_agency_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: tt_agency TYPE STANDARD TABLE OF /dmo/agency12 WITH KEY agency_id. CLASS-METHODS: get_data RETURNING VALUE(rt_data) TYPE tt_agency. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS lcl_agency_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF. DELETE FROM /dmo/agency12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. DATA(lt_data) = get_data( ). IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF. INSERT /dmo/agency12 FROM TABLE @lt_data. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. rt_data = VALUE tt_agency( ( agency_id = '070001' name = 'Sunshine Travel' street = '134 West Street ' postal_code = '54323 ' city = 'Rochester ' country_code = 'US ' phone_number = '+1 901-632-5620 ' web_address = 'http://www.sunshine-travel.sap ' email_address = '[email protected] ' ) ( agency_id = '070002' name = 'Fly High' street = 'Berliner Allee 11 ' postal_code = '40880 ' city = 'Duesseldorf ' country_code = 'DE ' phone_number = '+49 2102 69555 ' web_address = 'http://www.flyhigh.sap ' email_address = '[email protected] ' ) ( agency_id = '070003' name = 'Happy Hopping' street = 'Calvinstr. 36 ' postal_code = '13467 ' city = 'Berlin ' country_code = 'DE ' phone_number = '+49 30-8853-0 ' web_address = 'http://www.haphop.sap ' email_address = '[email protected] ' ) ( agency_id = '070004' name = 'Pink Panther' street = 'Auf der Schanz 54 ' postal_code = '65936 ' city = 'Frankfurt ' country_code = 'DE ' phone_number = '+49 69-467653-0 ' web_address = 'http://www.pinkpanther.sap' email_address = '[email protected] ' ) ( agency_id = '070005' name = 'Your Choice' street = 'Gustav-Jung-Str. 425 ' postal_code = '90455' city = 'Nuernberg' country_code = 'DE' phone_number = '+49 9256-4548-0' web_address = 'http://www.yc.sap' email_address = '[email protected]' ) ( agency_id = '070006' name = 'Bella Italia' street = 'Via Marconi 123' postal_code = '00139' city = 'Roma' country_code = 'IT' phone_number = '+39 6 893546721' web_address = 'http://www.tours.it/Adventure/' email_address = '[email protected]/Adventure/' ) ( agency_id = '070007' name = 'Hot Socks Travel' street = '224 Balnagask Rd ' postal_code = '8053 ' city = 'Sydney' country_code = 'AU ' phone_number = '+61 2 2004 5000 ' web_address = 'http://www.hst.co.au' email_address = '[email protected]' ) ( agency_id = '070008' name = 'Burns Nuclear' street = '14 Science Park Drive' postal_code = '118228' city = 'Singapore' country_code = 'SG' phone_number = '+65 777-5566' web_address = 'http://www.burns-burns-burns.sg' email_address = '[email protected]' ) ( agency_id = '070009' name = 'Honauer Reisen GmbH' street = 'Baumgarten 8' postal_code = '4212' city = 'Neumarkt' country_code = 'AT' phone_number = '+43 7941 8903' web_address = 'http://www.honauer.at' email_address = '[email protected]' ) ( agency_id = '070010' name = 'Travel from Walldorf' street = 'Altonaer Str. 24 ' postal_code = '10557 ' city = 'Berlin ' country_code = 'DE ' phone_number = '+49 30-622860 ' web_address = 'http://www.travel-from-walldorf' email_address = 'info@travel-from-walldorf' ) ( agency_id = '070011' name = 'Voyager Enterprises' street = 'Gustavslundsvaegen 151' postal_code = '70563 ' city = 'Stockholm ' country_code = 'SE ' phone_number = '+46 8/ 587 70000' web_address = 'http://www.starfleet.ufp' email_address = '[email protected]' ) ( agency_id = '070012' name = 'Ben McCloskey Ltd.' street = '74 Court Oak Rd' postal_code = 'B17 9TN' city = 'Birmingham' country_code = 'GB' phone_number = '+44 121 365-2251 ' web_address = 'http://www.ben-mcCloskey.co.uk' email_address = '[email protected]' ) ( agency_id = '070013' name = 'Pillepalle Trips' street = 'Gorki Park 4 ' postal_code = '8008 ' city = 'Zuerich ' country_code = 'CH ' phone_number = '+41 1 345-5321 ' web_address = 'http://www.pi-pa-tri.sap' email_address = '[email protected]' ) ( agency_id = '070014' name = 'Kangeroos' street = 'Lancaster drive 435 ' postal_code = '20001 ' city = 'London ' country_code = 'GB ' phone_number = '+44 171-2937638 ' web_address = 'http://www.hopp.sap ' email_address = '[email protected] ' ) ( agency_id = '070015' name = 'Bavarian Castle' street = 'Pilnizerstr. 241 ' postal_code = '01069 ' city = 'Dresden ' country_code = 'DE ' phone_number = '+49 98-32832732 ' web_address = 'http://www.neu.schwanstein.sap ' email_address = '[email protected] ' ) ( agency_id = '070016' name = 'Ali''s Bazar' street = '45, Mac Arthur Boulevard ' postal_code = '19113 ' city = 'Boston ' country_code = 'US ' phone_number = '+1 508-692-5200 ' web_address = 'http://www.ali.sap ' email_address = '[email protected] ' ) ( agency_id = '070017' name = 'Super Agency' street = '50 Cranworth St' postal_code = 'G12 8AG' city = 'Glasgow' country_code = 'GB' phone_number = '+44 141 711-5643' web_address = 'http://www.super.sap' email_address = '[email protected]' ) ( agency_id = '070018' name = 'Wang Chong' street = 'Gagarine Park ' postal_code = '150021 ' city = 'Moscow ' country_code = 'RU ' phone_number = '+7 3287-213321 ' web_address = 'http://www.wang.chong.sap' email_address = '[email protected]' ) ( agency_id = '070019' name = 'Around the World' street = 'An der Breiten Wiese 122 ' postal_code = '30625 ' city = 'Hannover ' country_code = 'DE ' phone_number = '+49 511-347589-0 ' web_address = 'http://www.atw.sap' email_address = '[email protected]' ) ( agency_id = '070020' name = 'No Return' street = 'Wahnheider Str. 57 ' postal_code = '51105 ' city = 'Koeln ' country_code = 'DE ' phone_number = '+49 221-5689-100 ' web_address = 'http://www.bye-bye.sap ' email_address = '[email protected] ' ) ( agency_id = '070021' name = 'Special Agency Peru' street = 'Triberger Str. 42 ' postal_code = '70569 ' city = 'Stuttgart ' country_code = 'DE ' phone_number = '+49 711-7100 ' web_address = 'http://www.sap.com ' email_address = '[email protected] ' ) ( agency_id = '070022' name = 'Caribian Dreams' street = 'Deichstrasse 45 ' postal_code = '26721 ' city = 'Emden ' country_code = 'DE ' phone_number = '+49 2670-8560-0 ' web_address = 'http://www.cuba-libre.sap ' email_address = '[email protected] ' ) ( agency_id = '070023' name = 'Asia By Plane' street = '6-9 Iidabashi 7-chome' postal_code = '102-0072' city = 'Tokyo ' country_code = 'JP' phone_number = '+81 3-3239-3501 ' web_address = 'http://www.asia-by-plane.co.jp' email_address = '[email protected]' ) ( agency_id = '070024' name = 'Everywhere' street = 'Regensburger Platz 23 ' postal_code = '81679 ' city = 'Muenchen ' country_code = 'DE ' phone_number = '+49 89-2499239 ' web_address = 'http://www.everywhere.sap' email_address = '[email protected]' ) ( agency_id = '070025' name = 'Happy Holiday' street = 'Rastenburger Str. 12' postal_code = '28779 ' city = 'Bremen ' country_code = 'DE ' phone_number = '+49 3266-288817 ' web_address = 'http://www.haphol.sap' email_address = '[email protected]' ) ( agency_id = '070026' name = 'No Name' street = 'Schwalbenweg 43 ' postal_code = '52078 ' city = 'Aachen ' country_code = 'DE ' phone_number = '+49 241-77729 ' web_address = 'http://www.nn.sap' email_address = '[email protected]' ) ( agency_id = '070027' name = 'Fly Low' street = 'Chemnitzer Str. 42 ' postal_code = '01187 ' city = 'Dresden ' country_code = 'DE ' phone_number = '+49 351-5423-00 ' web_address = 'http://www.fly-low.sap' email_address = '[email protected]' ) ( agency_id = '070028' name = 'Aussie Travel' street = 'Queens Road ' postal_code = 'M8 7RYP ' city = 'Manchester ' country_code = 'GB ' phone_number = '+44 161 2052000 ' web_address = 'http://www.down-under.sap' email_address = '[email protected]' ) ( agency_id = '070029' name = 'Up ''n'' Away' street = 'Nackenbergerstr. 92 ' postal_code = '30625 ' city = 'Hannover ' country_code = 'DE ' phone_number = '+49 511 403266-0 ' web_address = 'http://www.una.sap ' email_address = '[email protected] ' ) ( agency_id = '070030' name = 'Trans World Travel' street = '100 Industrial Drive ' postal_code = '60804 ' city = 'Chicago ' country_code = 'US ' phone_number = '+1 708-454-8723 ' web_address = 'http://www.twt.sap ' email_address = '[email protected] ' ) ( agency_id = '070031' name = 'Bright Side of Life' street = '340 State Street ' postal_code = '30432 ' city = 'San Francisco ' country_code = 'US ' phone_number = '+1 415-454-9877 ' web_address = 'http://www.ruebennase.sap ' email_address = '[email protected] ' ) ( agency_id = '070032' name = 'Sunny, Sunny, Sunny' street = '1300 State Street ' postal_code = '19003 ' city = 'Philadelphia ' country_code = 'US ' phone_number = '+1 215-090-7659 ' web_address = 'http://www.s3.sap ' email_address = '[email protected] ' ) ( agency_id = '070033' name = 'Fly & Smile' street = 'Zeppelinstr. 17 ' postal_code = '60318 ' city = 'Frankfurt ' country_code = 'DE ' phone_number = '+49 69-99-0 ' web_address = 'http://www.fly-and-smile.sap ' email_address = '[email protected] ' ) ( agency_id = '070034' name = 'Supercheap' street = '1400, Washington Circle ' postal_code = '30439 ' city = 'Los Angeles ' country_code = 'US ' phone_number = '+1 251-369-2510 ' web_address = 'http://www.supercheap.sap ' email_address = '[email protected] ' ) ( agency_id = '070035' name = 'Hitchhiker' street = '21 Rue de Moselle ' postal_code = '92132 ' city = 'Issy-les-Moulineaux ' country_code = 'FR ' phone_number = '+33 1-405-555-888 ' web_address = 'http://www.42.sap ' email_address = '[email protected] ' ) ( agency_id = '070036' name = 'Fly Now, Pay Later' street = '100 Madison ' postal_code = '11012 ' city = 'New York ' country_code = 'US ' phone_number = '+1 512 343-8543 ' web_address = 'http://www.fn-pl.sap ' email_address = '[email protected] ' ) ( agency_id = '070037' name = 'Real Weird Vacation' street = '949 5th Street ' postal_code = 'V6T 1Z4' city = 'Vancouver' country_code = 'CA ' phone_number = '+1 604 827-8024' web_address = 'http://www.reweva.sap ' email_address = '[email protected] ' ) ( agency_id = '070038' name = 'Cap Travels Ltd.' street = '10 Mandela St' postal_code = '2128' city = 'Johannesburg' country_code = 'ZA' phone_number = '+27 11 886-8981' web_address = 'http://www.cap-travels.co.za' email_address = '[email protected]' ) ( agency_id = '070039' name = 'Rainy, Stormy, Cloudy' street = 'Lindenstr. 462 ' postal_code = '70563 ' city = 'Stuttgart ' country_code = 'DE ' phone_number = '+49 711-7992-00 ' web_address = 'http://www.windy.sap/rsc/ ' email_address = '[email protected]/rsc/ ' ) ( agency_id = '070040' name = 'Women only' street = 'Kirchstr. 53 ' postal_code = '55124 ' city = 'Mainz ' country_code = 'DE ' phone_number = '+49 6131-543-00 ' web_address = 'http://www.women-only.sap ' email_address = '[email protected] ' ) ( agency_id = '070041' name = 'Maxitrip' street = 'Flugfeld 17' postal_code = '65128' city = 'Wiesbaden' country_code = 'DE' phone_number = '+49 611-55 66 77' web_address = 'http://www.maxitrip.sap' email_address = '[email protected]' ) ( agency_id = '070042' name = 'The Ultimate Answer' street = 'Manchester Rd 20 ' postal_code = 'AB1 1SA ' city = 'Avon ' country_code = 'GB ' phone_number = '+44 934-66799 ' web_address = 'http://www.thulan.sap ' email_address = '[email protected] ' ) ( agency_id = '070043' name = 'Intertravel' street = 'Michigan Ave ' postal_code = '60154 ' city = 'Chicago ' country_code = 'US ' phone_number = '+1 788 798-6555 ' web_address = 'http://www.intertravel.sap ' email_address = '[email protected] ' ) ( agency_id = '070044' name = 'Ultimate Goal' street = '300 Peach tree street Sou' postal_code = '01069 ' city = 'Atlanta ' country_code = 'US ' phone_number = '+1 874-654-6686' web_address = 'http://www.ultimate-goal.sap ' email_address = '[email protected] ' ) ( agency_id = '070045' name = 'Submit and Return' street = '20890 East Central Ave ' postal_code = '30987 ' city = 'Palo Alto ' country_code = 'US ' phone_number = '+1 652 645-5236 ' web_address = 'http://www.sar.sap ' email_address = '[email protected] ' ) ( agency_id = '070046' name = 'Hendrik''s' street = '1200 Industrial Drive ' postal_code = '60153 ' city = 'Chicago ' country_code = 'US ' phone_number = '+1 08-924-9884 ' web_address = 'http://www.essen.sap/150596 ' email_address = '[email protected]/150596 ' ) ( agency_id = '070047' name = 'All British Air Planes' street = '224 Tomato Lane ' postal_code = '08965 ' city = 'Vineland ' country_code = 'US ' phone_number = '+44 609-896-Moore ' web_address = 'http://www.abap.sap ' email_address = '[email protected] ' ) ( agency_id = '070048' name = 'Rocky Horror Tours' street = '789 Santa Monica Blvd. ' postal_code = '08934 ' city = 'Santa Monica ' country_code = 'US ' phone_number = '+1 64351-6455-654 ' web_address = 'http://www.frank.furter.sap ' email_address = '[email protected] ' ) ( agency_id = '070049' name = 'Miles and More' street = '777 Arlington Blvd. ' postal_code = '46515 ' city = 'Elkhart ' country_code = 'US ' phone_number = '+1 646 867-6888 ' web_address = 'http://www.mam.sap' email_address = '[email protected]' ) ( agency_id = '070050' name = 'Not Only By Bike' street = 'Saalburgstr. 765 ' postal_code = '60385 ' city = 'Frankfurt ' country_code = 'DE ' phone_number = '+49 69 465789-0' web_address = 'http://www.nobb.sap' email_address = '[email protected]' ) ). ENDMETHOD. ENDCLASS. CLASS lcl_airport_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: tt_airport TYPE STANDARD TABLE OF /dmo/airport12 WITH KEY airport_id. CLASS-METHODS: get_data RETURNING VALUE(rt_data) TYPE lcl_airport_data_generator=>tt_airport. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS lcl_airport_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF. DELETE FROM /dmo/airport12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. DATA(lt_data) = get_data( ). IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF. INSERT /dmo/airport12 FROM TABLE @lt_data. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. rt_data = VALUE tt_airport( " Europe ( airport_id = 'FRA' name = 'Frankfurt Airport' city = 'Frankfurt/Main' country = 'DE' ) ( airport_id = 'HAM' name = 'Hamburg Airport' city = 'Hamburg' country = 'DE' ) ( airport_id = 'MUC' name = 'Munich Airport' city = 'Munich' country = 'DE' ) ( airport_id = 'SXF' name = 'Berlin Schönefeld Airport' city = 'Berlin' country = 'DE' ) ( airport_id = 'THF' name = 'Berlin Tempelhof Airport' city = 'Berlin' country = 'DE' ) ( airport_id = 'TXL' name = 'Berlin Tegel Airport' city = 'Berlin' country = 'DE' ) ( airport_id = 'CDG' name = 'Charles de Gaulle Airport' city = 'Paris' country = 'FR' ) ( airport_id = 'ORY' name = 'Orly Airport' city = 'Paris' country = 'FR' ) ( airport_id = 'VIE' name = 'Vienna International Airport' city = 'Vienna' country = 'AT' ) ( airport_id = 'ZRH' name = 'Zürich Airport' city = 'Zurich' country = 'CH' ) ( airport_id = 'RTM' name = 'Rotterdam The Hague Airport' city = 'Rotterdam' country = 'NL' ) ( airport_id = 'FCO' name = 'Leonardo da Vinci–Fiumicino Airport' city = 'Rome' country = 'IT' ) ( airport_id = 'VCE' name = 'Venice Marco Polo Airport' city = 'Venice' country = 'IT' ) ( airport_id = 'LCY' name = 'London City Airport' city = 'London' country = 'UK' ) ( airport_id = 'LGW' name = 'Gatwick Airport' city = 'London' country = 'UK' ) ( airport_id = 'LHR' name = 'Heathrow Airport' city = 'London' country = 'UK' ) ( airport_id = 'MAD' name = 'Adolfo Suárez Madrid–Barajas Airport' city = 'Madrid' country = 'ES' ) ( airport_id = 'VKO' name = 'Vnukovo International Airport' city = 'Moscow' country = 'RU' ) ( airport_id = 'SVO' name = 'Sheremetyevo International Airport' city = 'Moscow' country = 'RU' ) " America ( airport_id = 'JFK' name = 'John F. Kennedy International Airport' city = 'New York City, New York' country = 'US' ) ( airport_id = 'BNA' name = 'Nashville International Airport' city = 'Nashville, Tennessee' country = 'US' ) ( airport_id = 'BOS' name = 'Logan International Airport' city = 'Boston, Massachusetts' country = 'US' ) ( airport_id = 'ELP' name = 'El Paso International Airport' city = 'El Paso, Texas' country = 'US' ) ( airport_id = 'DEN' name = 'Denver International Airport' city = 'Denver, Colorado' country = 'US' ) ( airport_id = 'HOU' name = 'William P. Hobby Airport' city = 'Houston, Texas' country = 'US' ) ( airport_id = 'LAS' name = 'McCarran International Airport' city = 'Las Vegas, Nevada' country = 'US' ) ( airport_id = 'LAX' name = 'Los Angeles International Airport' city = 'Los Angeles, California' country = 'US' ) ( airport_id = 'MCI' name = 'Kansas City International Airport' city = 'Kansas City, Missouri' country = 'US' ) ( airport_id = 'MIA' name = 'Miami International Airport' city = 'Miami, Florida' country = 'US' ) ( airport_id = 'SFO' name = 'San Francisco International Airport' city = 'San Francisco, California' country = 'US' ) ( airport_id = 'EWR' name = 'Newark Liberty International Airport' city = 'Newark, New Jersey' country = 'US' ) ( airport_id = 'YOW' name = 'Ottawa Macdonald–Cartier Int. Airport' city = 'Ottawa, Ontario' country = 'CA' ) ( airport_id = 'ACA' name = 'General Juan N. Álvarez Int. Airport' city = 'Acapulco, Guerrero' country = 'MX' ) ( airport_id = 'GIG' name = 'Rio de Janeiro–Galeão Int. Airport' city = 'Rio de Janeiro' country = 'BR' ) ( airport_id = 'HAV' name = 'José Martí International Airport' city = 'Havana' country = 'CU' ) " Australia ( airport_id = 'ASP' name = 'Alice Springs Airport' city = 'Alice Springs, Northern Territory' country = 'AU' ) " Africa ( airport_id = 'ACE' name = 'Lanzarote Airport' city = 'Lanzarote, Canary Islands' country = 'ES' ) ( airport_id = 'HRE' name = 'Harare International Airport' city = 'Harare' country = 'ZW' ) ( airport_id = 'GCJ' name = 'Grand Central Airport' city = 'Johannesburg' country = 'SA' ) " Asia ( airport_id = 'NRT' name = 'Narita International Airport' city = 'Tokyo, Honshu' country = 'JP' ) ( airport_id = 'ITM' name = 'Osaka International Airport' city = 'Osaka, Honshu' country = 'JP' ) ( airport_id = 'KIX' name = 'Kansai International Airport' city = 'Osaka, Honshu' country = 'JP' ) ( airport_id = 'HIJ' name = 'Hiroshima Airport' city = 'Hiroshima, Honshu' country = 'JP' ) ( airport_id = 'SIN' name = 'Singapore Changi Airport' city = 'Singapore' country = 'SG' ) ( airport_id = 'KUL' name = 'Kuala Lumpur International Airport' city = 'Kuala Lumpur' country = 'MY' ) ( airport_id = 'HKG' name = 'Hong Kong International Airport' city = 'Hongkong' country = 'CN' ) ( airport_id = 'BKK' name = 'Suvarnabhumi Airport' city = 'Bangkok' country = 'TH' ) ). ENDMETHOD. ENDCLASS. CLASS lcl_carrier_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: tt_carrier TYPE STANDARD TABLE OF /dmo/carrier12 WITH KEY carrier_id. CLASS-METHODS: get_data RETURNING VALUE(rt_data) TYPE tt_carrier. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS lcl_carrier_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF. DELETE FROM /dmo/carrier12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. DATA(lt_data) = get_data( ). IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF. INSERT /dmo/carrier12 FROM TABLE @lt_data. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. rt_data = VALUE tt_carrier( ( carrier_id = 'AA' name = 'American Airlines Inc.' currency_code = 'USD' ) ( carrier_id = 'AC' name = 'Air Canada' currency_code = 'CAD' ) ( carrier_id = 'AF' name = 'Air France' currency_code = 'EUR' ) ( carrier_id = 'AZ' name = 'Alitalia Societa Aerea Italiana S.p.A.' currency_code = 'EUR' ) ( carrier_id = 'BA' name = 'British Airways p.l.c.' currency_code = 'GBP' ) ( carrier_id = 'FJ' name = 'Air Pacific Limited t/a Fiji Airway' currency_code = 'USD' ) ( carrier_id = 'CO' name = 'Cobaltair Ltd. dba Cobalt' currency_code = 'USD' ) ( carrier_id = 'DL' name = 'Delta Air Lines, Inc.' currency_code = 'USD' ) ( carrier_id = 'LH' name = 'Deutsche Lufthansa AG' currency_code = 'EUR' ) ( carrier_id = 'NG' name = 'AL-Naser Wings' currency_code = 'EUR' ) ( carrier_id = 'JL' name = 'Japan Airlines Co., Ltd.' currency_code = 'JPY' ) ( carrier_id = 'QF' name = 'Qantas Airways Ltd.' currency_code = 'AUD' ) ( carrier_id = 'SA' name = 'South African Airways' currency_code = 'ZAR' ) ( carrier_id = 'SQ' name = 'Singapore Airlines Limited' currency_code = 'SGD' ) ( carrier_id = 'SR' name = 'Sundair GmbH' currency_code = 'CHF' ) ( carrier_id = 'UA' name = 'United Airlines, Inc.' currency_code = 'USD' ) ). ENDMETHOD. ENDCLASS. CLASS lcl_connection_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: tt_connection TYPE STANDARD TABLE OF /dmo/connecti_12 WITH KEY carrier_id connection_id. TYPES: "! Structure for additional information for generation. <br/> "! <em>weekday</em> '1' means Monday, '7' is Sunday BEGIN OF ty_connection_additional_info. INCLUDE TYPE /dmo/connecti_12. TYPES: weekday TYPE i, END OF ty_connection_additional_info. TYPES: tt_connection_additional_info TYPE STANDARD TABLE OF ty_connection_additional_info WITH KEY connection_id. CLASS-METHODS: get_data "provide data public RETURNING VALUE(rt_data) TYPE tt_connection_additional_info. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS lcl_connection_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF. DELETE FROM /dmo/connecti_12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. DATA(lt_data) = get_data( ). DATA(lt_data_db) = CORRESPONDING tt_connection( lt_data ). IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF. INSERT /dmo/connecti_12 FROM TABLE @lt_data. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. rt_data = VALUE tt_connection_additional_info( ( carrier_id = 'SQ' connection_id = '0001' airport_from_id = 'SFO' airport_to_id = 'SIN' departure_time = '011500' arrival_time = '115000' distance = 13523 distance_unit = 'KM' weekday = 3 ) "1-7 ( carrier_id = 'SQ' connection_id = '0002' airport_from_id = 'SIN' airport_to_id = 'SFO' departure_time = '063000' arrival_time = '091500' distance = 13523 distance_unit = 'KM' weekday = 4 ) "1-7 ( carrier_id = 'SQ' connection_id = '0011' airport_from_id = 'NRT' airport_to_id = 'SIN' departure_time = '145500' arrival_time = '205000' distance = 5363 distance_unit = 'KM' weekday = 4 ) "1-7 ( carrier_id = 'SQ' connection_id = '0012' airport_from_id = 'SIN' airport_to_id = 'NRT' departure_time = '095300' arrival_time = '175400' distance = 5363 distance_unit = 'KM' weekday = 6 ) "1-7 ( carrier_id = 'UA' connection_id = '0058' airport_from_id = 'SFO' airport_to_id = 'FRA' departure_time = '134500' arrival_time = '095500' distance = 9608 distance_unit = 'KM' weekday = 1 ) "1-7 ( carrier_id = 'UA' connection_id = '0059' airport_from_id = 'FRA' airport_to_id = 'SFO' departure_time = '135500' arrival_time = '163000' distance = 9608 distance_unit = 'KM' weekday = 2 ) "1-7 ( carrier_id = 'UA' connection_id = '1537' airport_from_id = 'EWR' airport_to_id = 'MIA' departure_time = '215600' arrival_time = '004700' distance = 1752 distance_unit = 'KM' weekday = 5 ) "1-7 ( carrier_id = 'AA' connection_id = '0322' airport_from_id = 'MIA' airport_to_id = 'EWR' departure_time = '201700' arrival_time = '231900' distance = 1752 distance_unit = 'KM' weekday = 7 ) "1-7 ( carrier_id = 'AA' connection_id = '0017' airport_from_id = 'MIA' airport_to_id = 'HAV' departure_time = '071900' arrival_time = '080300' distance = 520 distance_unit = 'KM' weekday = 3 ) "1-7 ( carrier_id = 'AA' connection_id = '2678' airport_from_id = 'HAV' airport_to_id = 'MIA' departure_time = '061500' arrival_time = '103000' distance = 520 distance_unit = 'KM' weekday = 6 ) "1-7 ( carrier_id = 'AA' connection_id = '0015' airport_from_id = 'JFK' airport_to_id = 'SFO' departure_time = '071300' arrival_time = '100400' distance = 4156 distance_unit = 'KM' weekday = 5 ) "1-7 ( carrier_id = 'AA' connection_id = '0018' airport_from_id = 'SFO' airport_to_id = 'JFK' departure_time = '064000' arrival_time = '150600' distance = 4156 distance_unit = 'KM' weekday = 4 ) "1-7 ( carrier_id = 'LH' connection_id = '0400' airport_from_id = 'FRA' airport_to_id = 'JFK' departure_time = '101000' arrival_time = '113400' distance = 6162 distance_unit = 'KM' weekday = 6 ) "1-7 ( carrier_id = 'LH' connection_id = '0401' airport_from_id = 'JFK' airport_to_id = 'FRA' departure_time = '183000' arrival_time = '074500' distance = 6162 distance_unit = 'KM' weekday = 5 ) "1-7 ( carrier_id = 'LH' connection_id = '0402' airport_from_id = 'FRA' airport_to_id = 'EWR' departure_time = '133000' arrival_time = '153500' distance = 6217 distance_unit = 'KM' weekday = 1 ) "1-7 ( carrier_id = 'LH' connection_id = '0403' airport_from_id = 'EWR' airport_to_id = 'FRA' departure_time = '180900' arrival_time = '073000' distance = 6217 distance_unit = 'KM' weekday = 1 ) "1-7 ( carrier_id = 'JL' connection_id = '0407' airport_from_id = 'NRT' airport_to_id = 'FRA' departure_time = '132300' arrival_time = '155600' distance = 9379 distance_unit = 'KM' weekday = 5 ) "1-7 ( carrier_id = 'JL' connection_id = '0408' airport_from_id = 'FRA' airport_to_id = 'NRT' departure_time = '202500' arrival_time = '154000' distance = 9379 distance_unit = 'KM' weekday = 6 ) "1-7 ( carrier_id = 'AZ' connection_id = '0788' airport_from_id = 'VCE' airport_to_id = 'NRT' departure_time = '132500' arrival_time = '101300' distance = 9595 distance_unit = 'KM' weekday = 6 ) ( carrier_id = 'AZ' connection_id = '0789' airport_from_id = 'NRT' airport_to_id = 'VCE' departure_time = '142600' arrival_time = '213100' distance = 9595 distance_unit = 'KM' weekday = 5 ) ). ENDMETHOD. ENDCLASS. CLASS lcl_flight_data_generator DEFINITION DEFERRED. CLASS /dmo/cl_flight_data_generat_12 DEFINITION LOCAL FRIENDS lcl_flight_data_generator. CLASS lcl_flight_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: tt_flights TYPE STANDARD TABLE OF /dmo/flight12 WITH KEY carrier_id connection_id flight_date WITH NON-UNIQUE SORTED KEY key_sorted_seats COMPONENTS seats_occupied WITH NON-UNIQUE SORTED KEY key_sorted_date COMPONENTS connection_id flight_date. CLASS-METHODS: get_data RETURNING VALUE(rt_data) TYPE tt_flights. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_plane_type, id TYPE /dmo/plane_type_id12, seats_max TYPE /dmo/plane_seats_max12, long_distance TYPE abap_bool, index TYPE int1, END OF ty_plane_type, BEGIN OF ty_flight_info, id TYPE /dmo/plane_type_id12, long_distance TYPE abap_bool, seats_max TYPE /dmo/plane_seats_max12, seats_occupied TYPE /dmo/plane_seats_occupied12, price TYPE /dmo/flight_price12, END OF ty_flight_info, BEGIN OF ty_connection_recurrency, id TYPE /dmo/connection_id12, recurrency TYPE STANDARD TABLE OF /dmo/flight_date12 WITH EMPTY KEY, END OF ty_connection_recurrency. TYPES: tt_plane_type TYPE STANDARD TABLE OF ty_plane_type WITH KEY id, tt_connection_recurrency TYPE STANDARD TABLE OF ty_connection_recurrency WITH KEY id. CONSTANTS: cv_random_offset TYPE i VALUE 25, cv_random_percent TYPE i VALUE 70. CLASS-DATA: gt_connections TYPE lcl_connection_data_generator=>tt_connection, gt_carrier TYPE lcl_carrier_data_generator=>tt_carrier, gt_plane_types TYPE tt_plane_type, go_random_int_distance_long TYPE REF TO cl_abap_random_int, go_random_int_distance_short TYPE REF TO cl_abap_random_int, gv_plane_distance_long TYPE i, gv_plane_distance_short TYPE i, gt_connection_recurrency TYPE lcl_flight_data_generator=>tt_connection_recurrency, gt_flights TYPE lcl_flight_data_generator=>tt_flights, go_random_seats TYPE REF TO cl_abap_random_int. CLASS-METHODS: build_dependent_content, get_flight_info IMPORTING iv_connection_id TYPE /dmo/connection_id12 RETURNING VALUE(rs_plane_info) TYPE ty_flight_info, build_plane_types RETURNING VALUE(rt_data) TYPE lcl_flight_data_generator=>tt_plane_type, build_connection_recurrency RETURNING VALUE(rt_data) TYPE lcl_flight_data_generator=>tt_connection_recurrency, calc_next_monday IMPORTING iv_date TYPE d RETURNING VALUE(rv_date) TYPE d. ENDCLASS. CLASS lcl_flight_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF. DELETE FROM /dmo/flight12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Dependent Content.' ). ENDIF. build_dependent_content( ). IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. get_data( ). IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF. INSERT /dmo/flight12 FROM TABLE @gt_flights. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. DATA: lt_flights TYPE tt_flights, ls_flight TYPE lcl_flight_data_generator=>ty_flight_info. IF gt_flights IS NOT INITIAL. rt_data = gt_flights. EXIT. ENDIF. LOOP AT gt_connections INTO DATA(ls_connection). LOOP AT gt_connection_recurrency[ id = ls_connection-connection_id ]-recurrency INTO DATA(lv_flight_date). ls_flight = get_flight_info( ls_connection-connection_id ). APPEND VALUE /dmo/flight12( carrier_id = ls_connection-carrier_id connection_id = ls_connection-connection_id flight_date = lv_flight_date price = ls_flight-price currency_code = VALUE /dmo/flight12-currency_code( gt_carrier[ carrier_id = ls_connection-carrier_id ]-currency_code DEFAULT 'EUR' ) plane_type_id = ls_flight-id seats_max = ls_flight-seats_max seats_occupied = ls_flight-seats_occupied ) TO gt_flights. ENDLOOP. rt_data = gt_flights. ENDLOOP. ENDMETHOD. METHOD build_dependent_content. gt_connections = CORRESPONDING #( lcl_connection_data_generator=>get_data( ) ). gt_carrier = lcl_carrier_data_generator=>get_data( ). gt_plane_types = build_plane_types( ). go_random_seats = cl_abap_random_int=>create( min = cv_random_percent - cv_random_offset max = cv_random_percent + cv_random_offset ). gt_connection_recurrency = build_connection_recurrency( ). ENDMETHOD. METHOD get_flight_info. DATA: lv_count TYPE i, lo_random TYPE REF TO cl_abap_random_int. DATA(lt_connections) = lcl_connection_data_generator=>get_data( ). DATA(lv_is_long_distance) = COND abap_bool( WHEN lt_connections[ connection_id = iv_connection_id ]-distance > 3000 THEN abap_true ELSE abap_false ). IF lv_is_long_distance = abap_true. IF gv_plane_distance_long IS INITIAL. SELECT COUNT(*) FROM @gt_plane_types AS planes WHERE long_distance = @lv_is_long_distance INTO @gv_plane_distance_long. ENDIF. lv_count = gv_plane_distance_long. IF go_random_int_distance_long IS NOT BOUND. go_random_int_distance_long = cl_abap_random_int=>create( seed = 1337 min = 1 max = gv_plane_distance_long ). ENDIF. lo_random = go_random_int_distance_long. ELSE. IF gv_plane_distance_short IS INITIAL. SELECT COUNT(*) FROM @gt_plane_types AS planes WHERE long_distance = @lv_is_long_distance INTO @gv_plane_distance_short. ENDIF. lv_count = gv_plane_distance_short. IF go_random_int_distance_short IS NOT BOUND. go_random_int_distance_short = cl_abap_random_int=>create( seed = 1337 min = 1 max = gv_plane_distance_short ). ENDIF. lo_random = go_random_int_distance_short. ENDIF. DATA(ls_plane_type) = gt_plane_types[ long_distance = lv_is_long_distance index = lo_random->get_next( ) ]. DATA(lv_seats_occupied_percent) = go_random_seats->get_next( ). rs_plane_info = VALUE ty_flight_info( id = ls_plane_type-id long_distance = ls_plane_type-long_distance seats_max = ls_plane_type-seats_max seats_occupied = ls_plane_type-seats_max * lv_seats_occupied_percent DIV 100 price = /dmo/cl_flight_data_generat_12=>calculate_flight_price( iv_seats_occupied_percent = lv_seats_occupied_percent iv_flight_distance = lt_connections[ connection_id = iv_connection_id ]-distance ) ). ENDMETHOD. METHOD build_plane_types. rt_data = VALUE tt_plane_type( ( id = 'A320-200' seats_max = 130 long_distance = ' ' index = 1 ) ( id = 'A321-200' seats_max = 150 long_distance = ' ' index = 2 ) ( id = '737-800' seats_max = 140 long_distance = ' ' index = 3 ) ( id = 'A319-100' seats_max = 120 long_distance = ' ' index = 4 ) ( id = '747-400' seats_max = 385 long_distance = 'X' index = 1 ) ( id = '767-200' seats_max = 260 long_distance = 'X' index = 2 ) ( id = 'A340-600' seats_max = 330 long_distance = 'X' index = 3 ) ( id = 'A380-800' seats_max = 475 long_distance = 'X' index = 4 ) ). ENDMETHOD. METHOD build_connection_recurrency. CONSTANTS: cv_days_between_test TYPE i VALUE 300, cv_days_between_8weeks TYPE i VALUE 56, cv_days_between_4weeks TYPE i VALUE 28, cv_days_between_2weeks TYPE i VALUE 14, cv_days_between_1weeks TYPE i VALUE 7. DATA: flight_date_max TYPE d, flight_date_min TYPE d. DATA(lv_days_between) = cv_days_between_test. GET TIME STAMP FIELD DATA(current_timestamp). DATA(tmp) = CONV string( current_timestamp ). DATA lv_datum TYPE d. lv_datum = tmp(8). " flight_date_max is a Monday 8 months in the future flight_date_max = calc_next_monday( CONV /dmo/flight_date12( lv_datum + 217 ) ). " flight_date_min is a Monday 5 months in the past flight_date_min = calc_next_monday( CONV /dmo/flight_date12( lv_datum - 148 ) ). LOOP AT lcl_connection_data_generator=>get_data( ) INTO DATA(ls_connection). APPEND VALUE ty_connection_recurrency( id = ls_connection-connection_id recurrency = VALUE ty_connection_recurrency-recurrency( FOR flightdate = flight_date_max + ls_connection-weekday - 1 THEN flightdate - lv_days_between UNTIL flightdate < flight_date_min + ls_connection-weekday - 1 ( CONV /dmo/flight_date12( flightdate ) ) ) ) TO rt_data. ENDLOOP. ENDMETHOD. METHOD calc_next_monday. * 01.01.1900 was a Saturday. DATA(lv_weekday) = iv_date MOD 7. * Therefore 0 is a Saturday, 1 for Sunday, etc.. and will be mapped to 1 for Monday, 2 for Tuesday, etc.. IF lv_weekday > 1. lv_weekday = lv_weekday - 1. ELSE. lv_weekday = lv_weekday + 6. ENDIF. rv_date = iv_date - lv_weekday + 8. ENDMETHOD. ENDCLASS. CLASS lcl_customer_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: BEGIN OF ty_last_name, last_name TYPE /dmo/last_name12, END OF ty_last_name. TYPES: tt_customer TYPE STANDARD TABLE OF /dmo/customer12 WITH KEY customer_id, tt_last_name TYPE STANDARD TABLE OF ty_last_name WITH KEY last_name. CLASS-METHODS: get_data RETURNING VALUE(rt_data) TYPE tt_customer, build_last_names RETURNING VALUE(rt_data) TYPE tt_last_name. PROTECTED SECTION. PRIVATE SECTION. TYPES: " Names BEGIN OF ty_first_name, first_name TYPE /dmo/first_name12, gender TYPE c LENGTH 1, END OF ty_first_name, BEGIN OF ty_name, first_name TYPE /dmo/first_name12, last_name TYPE /dmo/last_name12, title TYPE /dmo/title12, END OF ty_name, " Addresses BEGIN OF ty_city, country TYPE land1, postal_code TYPE /dmo/postal_code12, city TYPE /dmo/city12, END OF ty_city, tt_street_per_country TYPE STANDARD TABLE OF /dmo/street12 WITH EMPTY KEY, BEGIN OF ty_street, country TYPE land1, streets TYPE tt_street_per_country, END OF ty_street, BEGIN OF ty_address, country TYPE land1, postal_code TYPE /dmo/postal_code12, city TYPE /dmo/city12, street TYPE /dmo/street12, phone_number TYPE /dmo/phone_number12, email_address TYPE /dmo/email_address12, END OF ty_address. TYPES: " Names tt_first_name TYPE STANDARD TABLE OF ty_first_name WITH KEY first_name, tt_name TYPE STANDARD TABLE OF ty_name WITH KEY first_name last_name, " Addresses tt_city TYPE STANDARD TABLE OF ty_city WITH KEY country city, tt_street TYPE STANDARD TABLE OF ty_street WITH KEY country, tt_address TYPE STANDARD TABLE OF ty_address WITH KEY country city street. CONSTANTS cv_email_host TYPE string VALUE `flight.example` ##NO_TEXT. CONSTANTS cv_phone_number_seperator TYPE string VALUE `-` ##NO_TEXT. CONSTANTS cv_phone_number_min TYPE int8 VALUE 1234567890. CONSTANTS cv_phone_number_max TYPE int8 VALUE 9999999999. CLASS-DATA gt_data TYPE lcl_customer_data_generator=>tt_customer. CLASS-METHODS: " Names generate_names RETURNING VALUE(rt_data) TYPE tt_name, build_first_names RETURNING VALUE(rt_data) TYPE tt_first_name, " Adresses generate_addresses RETURNING VALUE(rt_data) TYPE tt_address, build_city RETURNING VALUE(rt_data) TYPE tt_city, build_street RETURNING VALUE(rt_data) TYPE tt_street. ENDCLASS. CLASS lcl_customer_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF. DELETE FROM /dmo/customer12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. DATA(lt_data) = get_data( ). IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF. INSERT /dmo/customer12 FROM TABLE @lt_data. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD build_first_names. rt_data = VALUE tt_first_name( ( first_name = 'Simon' gender = 'M') ( first_name = 'Harish' gender = 'M') ( first_name = 'Volker' gender = 'M') ( first_name = 'Jasmin' gender = 'F') ( first_name = 'Felix' gender = 'M') ( first_name = 'Kristina' gender = 'F') ( first_name = 'Thilo' gender = 'M') ( first_name = 'Andrej' gender = 'M') ( first_name = 'Anna' gender = 'F') ( first_name = 'Johannes' gender = 'M') ( first_name = 'Johann' gender = 'M') ( first_name = 'Christoph' gender = 'M') ( first_name = 'Andreas' gender = 'M') ( first_name = 'Stephen' gender = 'M') ( first_name = 'Mathilde' gender = 'F') ( first_name = 'August' gender = 'M') ( first_name = 'Illya' gender = 'M') ( first_name = 'Georg' gender = 'M') ( first_name = 'Gisela' gender = 'F') ( first_name = 'Christa' gender = 'F') ( first_name = 'Holm' gender = 'M') ( first_name = 'Irmtraut' gender = 'F') ( first_name = 'Ludwig' gender = 'M') ( first_name = 'Laura' gender = 'F') ( first_name = 'Kurt' gender = 'M') ( first_name = 'Guenther' gender = 'M') ( first_name = 'Horst' gender = 'M') ( first_name = 'Matthias' gender = 'M') ( first_name = 'Amelie' gender = 'F') ( first_name = 'Walter' gender = 'M') ( first_name = 'Sophie' gender = 'F') ( first_name = 'Claire' gender = 'F') ( first_name = 'Chantal' gender = 'F') ( first_name = 'Jean' gender = 'M') ( first_name = 'Cindy' gender = 'F') ( first_name = 'Pierre' gender = 'M') ( first_name = 'Irene' gender = 'F') ( first_name = 'Adam' gender = 'M') ( first_name = 'Fabio' gender = 'M') ( first_name = 'Lothar' gender = 'M') ( first_name = 'Annemarie' gender = 'F') ( first_name = 'Ida' gender = 'F') ( first_name = 'Roland' gender = 'M') ( first_name = 'Achim' gender = 'M') ( first_name = 'Allen' gender = 'M') ( first_name = 'Lee' gender = 'M') ( first_name = 'Guillermo' gender = 'M') ( first_name = 'Florian' gender = 'M') ( first_name = 'Ulla' gender = 'F') ( first_name = 'Juan' gender = 'M') ( first_name = 'Marta' gender = 'F') ( first_name = 'Salvador' gender = 'M') ( first_name = 'Christine' gender = 'F') ( first_name = 'Dominik' gender = 'M') ( first_name = 'Astrid' gender = 'F') ( first_name = 'Ruth' gender = 'F') ( first_name = 'Theresia' gender = 'F') ( first_name = 'Thomas' gender = 'M') ( first_name = 'Friedrich' gender = 'M') ( first_name = 'Anneliese' gender = 'F') ( first_name = 'Peter' gender = 'M') ( first_name = 'Anne-Marie' gender = 'F') ( first_name = 'James' gender = 'M') ( first_name = 'Jean-Luc' gender = 'M') ( first_name = 'Benjamin' gender = 'M') ( first_name = 'Hendrik' gender = 'M') ( first_name = 'Uli' gender = 'F') ( first_name = 'Siegfried' gender = 'M') ( first_name = 'Max' gender = 'M') ). ENDMETHOD. METHOD build_last_names. rt_data = VALUE tt_last_name( ( last_name = 'Buchholm') ( last_name = 'Vrsic') ( last_name = 'Jeremias') ( last_name = 'Gutenberg') ( last_name = 'Fischmann') ( last_name = 'Columbo') ( last_name = 'Neubasler') ( last_name = 'Martin') ( last_name = 'Detemple') ( last_name = 'Barth') ( last_name = 'Benz') ( last_name = 'Hansmann') ( last_name = 'Koslowski') ( last_name = 'Wohl') ( last_name = 'Koller') ( last_name = 'Hoffen') ( last_name = 'Dumbach') ( last_name = 'Goelke') ( last_name = 'Waldmann') ( last_name = 'Mechler') ( last_name = 'Buehler') ( last_name = 'Heller') ( last_name = 'Simonen') ( last_name = 'Henry') ( last_name = 'Marshall') ( last_name = 'Legrand') ( last_name = 'Jacqmain') ( last_name = 'D´Oultrement') ( last_name = 'Hunter') ( last_name = 'Delon') ( last_name = 'Kreiss') ( last_name = 'Trensch') ( last_name = 'Cesari') ( last_name = 'Matthaeus') ( last_name = 'Babilon') ( last_name = 'Zimmermann') ( last_name = 'Kramer') ( last_name = 'Illner') ( last_name = 'Pratt') ( last_name = 'Gahl') ( last_name = 'Benjamin') ( last_name = 'Miguel') ( last_name = 'Weiss') ( last_name = 'Sessler') ( last_name = 'Montero') ( last_name = 'Domenech') ( last_name = 'Moyano') ( last_name = 'Sommer') ( last_name = 'Schneider') ( last_name = 'Eichbaum') ( last_name = 'Gueldenpfennig') ( last_name = 'Sudhoff') ( last_name = 'Lautenbach') ( last_name = 'Ryan') ( last_name = 'Prinz') ( last_name = 'Deichgraeber') ( last_name = 'Pan') ( last_name = 'Lindwurm') ( last_name = 'Kirk') ( last_name = 'Picard') ( last_name = 'Sisko') ( last_name = 'Madeira') ( last_name = 'Meier') ( last_name = 'Rahn') ( last_name = 'Leisert') ( last_name = 'Müller') ( last_name = 'Mustermann') ( last_name = 'Becker') ( last_name = 'Fischer') ). ENDMETHOD. METHOD get_data. IF gt_data IS NOT INITIAL. rt_data = gt_data. EXIT. ENDIF. DATA(lt_names) = generate_names( ). DATA(lt_addresses) = generate_addresses( ). DATA(lo_random_phone_number) = cl_abap_random_int8=>create( min = cv_phone_number_min max = cv_phone_number_max ). DATA(lo_random_city) = cl_abap_random_int=>create( min = 1 max = lines( lt_addresses ) ). DATA(lo_random_street_number) = cl_abap_random_int=>create( min = 1 max = 100 ). gt_data = VALUE tt_customer( FOR i = 1 THEN i + 1 WHILE i <= lines( lt_names ) LET j = lo_random_city->get_next( ) IN ( customer_id = i first_name = lt_names[ i ]-first_name last_name = lt_names[ i ]-last_name title = lt_names[ i ]-title street = lt_addresses[ j ]-street && ` ` && lo_random_street_number->get_next( ) postal_code = lt_addresses[ j ]-postal_code city = lt_addresses[ j ]-city country_code = lt_addresses[ j ]-country phone_number = '+' && COND string( WHEN lt_addresses[ j ]-country = 'AT' THEN '43' WHEN lt_addresses[ j ]-country = 'BE' THEN '32' WHEN lt_addresses[ j ]-country = 'CH' THEN '41' WHEN lt_addresses[ j ]-country = 'DE' THEN '49' WHEN lt_addresses[ j ]-country = 'ES' THEN '34' WHEN lt_addresses[ j ]-country = 'FR' THEN '33' WHEN lt_addresses[ j ]-country = 'IT' THEN '39' WHEN lt_addresses[ j ]-country = 'SI' THEN '386' WHEN lt_addresses[ j ]-country = 'US' THEN '1' ELSE '89' ) && cv_phone_number_seperator && |{ replace( val = lo_random_phone_number->get_next( ) off = 3 len = 1 with = cv_phone_number_seperator ) }| email_address = to_lower( lt_names[ i ]-first_name && `.` && lt_names[ i ]-last_name && `@` && cv_email_host && `.` && lt_addresses[ j ]-country ) ) ). rt_data = gt_data. ENDMETHOD. METHOD generate_names. DATA: lo_random_counter TYPE REF TO cl_abap_random_int, lo_random_first_name TYPE REF TO cl_abap_random_int, lo_random_title TYPE REF TO cl_abap_random_int, ls_first_name TYPE lcl_customer_data_generator=>ty_first_name. DATA(lt_first_names) = build_first_names( ). lo_random_counter = cl_abap_random_int=>create( min = 5 max = 15 ). lo_random_first_name = cl_abap_random_int=>create( min = 1 max = lines( lt_first_names ) ). LOOP AT build_last_names( ) INTO DATA(ls_last_name). DO lo_random_counter->get_next( ) TIMES. ls_first_name = lt_first_names[ lo_random_first_name->get_next( ) ]. APPEND VALUE ty_name( first_name = ls_first_name-first_name last_name = ls_last_name-last_name title = COND /dmo/title12( WHEN ls_first_name-gender = 'M' THEN 'Mr.' WHEN ls_first_name-gender = 'F' THEN 'Mrs.' ELSE 'Martian' ) ) TO rt_data. ENDDO. ENDLOOP. ENDMETHOD. METHOD build_city. rt_data = VALUE tt_city( ( country = 'DE' postal_code = '23496' city = 'Dielheim') ( country = 'SI' postal_code = '1000' city = 'Ljubljana') ( country = 'DE' postal_code = '86343' city = 'Koenigsbrunn') ( country = 'DE' postal_code = '55128' city = 'Mainz') ( country = 'DE' postal_code = '11111' city = 'Berlin') ( country = 'US' postal_code = '17844' city = 'Washington') ( country = 'AT' postal_code = '4020' city = 'Linz') ( country = 'DE' postal_code = '68723' city = 'Schwetzingen') ( country = 'DE' postal_code = '68789' city = 'St. Leon-Rot') ( country = 'DE' postal_code = '66464' city = 'Homburg') ( country = 'DE' postal_code = '69231' city = 'Rauenberg') ( country = 'DE' postal_code = '69190' city = 'Walldorf') ( country = 'DE' postal_code = '58332' city = 'Schwelm') ( country = 'DE' postal_code = '64342' city = 'Seeheim-Jugenheim') ( country = 'DE' postal_code = '69121' city = 'Heidelberg') ( country = 'DE' postal_code = '63150' city = 'Heusenstamm') ( country = 'DE' postal_code = '64283' city = 'Darmstadt') ( country = 'DE' postal_code = '69207' city = 'Kurt') ( country = 'DE' postal_code = '79104' city = 'Freiburg') ( country = 'DE' postal_code = '79312' city = 'Emmendingen') ( country = 'DE' postal_code = '68753' city = 'Amelie') ( country = 'DE' postal_code = '68163' city = 'Mannheim') ( country = 'DE' postal_code = '67105' city = 'Schifferstadt') ( country = 'DE' postal_code = '68163' city = 'Mannheim-Lindenhof') ( country = 'FR' postal_code = '78140' city = 'Vélizy') ( country = 'CH' postal_code = '1211' city = 'Genève') ( country = 'BE' postal_code = 'B - 1030' city = 'Bruxelles') ( country = 'US' postal_code = '76018' city = 'Arlington') ( country = 'FR' postal_code = '06130' city = 'Grasse') ( country = 'DE' postal_code = '27299' city = 'Langwedel') ( country = 'DE' postal_code = '69483' city = 'Wald-Michelbach') ( country = 'IT' postal_code = '00195' city = 'Roma') ( country = 'DE' postal_code = '81375' city = 'Muenchen') ( country = 'DE' postal_code = '67663' city = 'Kaiserslautern') ( country = 'DE' postal_code = '66386' city = 'St. Ingbert') ( country = 'DE' postal_code = '79761' city = 'Waldshut') ( country = 'DE' postal_code = '76137' city = 'Karlsruhe') ( country = 'US' postal_code = '07666' city = 'Teaneck') ( country = 'US' postal_code = '17758' city = 'N. Massapequa') ( country = 'US' postal_code = '09765' city = 'Boulder') ( country = 'ES' postal_code = '28020' city = 'Madrid') ( country = 'DE' postal_code = '69180' city = 'Wiesloch') ( country = 'ES' postal_code = '08014' city = 'Barcelona') ( country = 'ES' postal_code = '41006' city = 'Sevilla') ( country = 'DE' postal_code = '75305' city = 'Neuenburg') ( country = 'DE' postal_code = '41466' city = 'Neuss') ( country = 'DE' postal_code = '71116' city = 'Gaertringen') ( country = 'US' postal_code = '60657' city = 'Chicago') ( country = 'DE' postal_code = '63263' city = 'Neu-Isenburg') ( country = 'DE' postal_code = '23056' city = 'Buxtehude') ( country = 'DE' postal_code = '16233' city = 'Potsdam') ( country = 'DE' postal_code = '90419' city = 'Nuernberg') ( country = 'US' postal_code = '22334' city = 'San Francisco') ( country = 'FR' postal_code = '75839' city = 'Paris') ( country = 'US' postal_code = '63728' city = 'New Orleans') ( country = 'DE' postal_code = '75757' city = 'Elsenz') ( country = 'DE' postal_code = '70111' city = 'Reutlingen') ( country = 'DE' postal_code = '15344' city = 'Strausberg') ). ENDMETHOD. METHOD generate_addresses. TYPES: BEGIN OF ty_random_street, country TYPE land1, random TYPE REF TO cl_abap_random_int, END OF ty_random_street, tt_random_street TYPE STANDARD TABLE OF ty_random_street WITH KEY country. DATA: lo_random_counter TYPE REF TO cl_abap_random_int, lo_random_city TYPE REF TO cl_abap_random_int, lt_random_street TYPE tt_random_street, lo_phone_number TYPE REF TO cl_abap_random_int. DATA(lt_street) = build_street( ). lo_random_counter = cl_abap_random_int=>create( min = 5 max = 15 ). lo_phone_number = cl_abap_random_int=>create( min = 1 max = 100 ). LOOP AT lt_street INTO DATA(ls_street). APPEND VALUE ty_random_street( country = ls_street-country random = cl_abap_random_int=>create( min = 1 max = lines( ls_street-streets ) ) ) TO lt_random_street. ENDLOOP. LOOP AT build_city( ) INTO DATA(ls_city). DO lo_random_counter->get_next( ) TIMES. APPEND VALUE ty_address( country = ls_city-country postal_code = ls_city-postal_code city = ls_city-city street = |{ lt_street[ country = ls_city-country ]-streets[ lt_random_street[ country = ls_city-country ]-random->get_next( ) ] }| ) TO rt_data. ENDDO. ENDLOOP. ENDMETHOD. METHOD build_street. rt_data = VALUE tt_street( ( country = 'AT' streets = VALUE tt_street_per_country( ( 'Hasnerstrasse' ) ) ) ( country = 'BE' streets = VALUE tt_street_per_country( ( 'rue Voltaire' ) ) ) ( country = 'CH' streets = VALUE tt_street_per_country( ( 'rue de Moillebeau' ) ) ) ( country = 'DE' streets = VALUE tt_street_per_country( ( 'Akazienweg' ) ( 'Albert-Schweitzer-Str.' ) ( 'Alte Reichsstr.' ) ( 'Am Deich' ) ( 'Arionweg' ) ( 'Arndtstrasse' ) ( 'Auf dem Huegel' ) ( 'Ausfallstr.' ) ( 'Ausserhalb' ) ( 'Carl-Metz Strasse' ) ( 'Caspar-David-Friedrich-Str.' ) ( 'Dudweilerstr.' ) ( 'Elzstrasse' ) ( 'Emil-Heckel-Str.' ) ( 'Erlengrund' ) ( 'Franz-Marc-Str.' ) ( 'Friedensallee' ) ( 'Froschstr.' ) ( 'Gartenstr.' ) ( 'Gemeindestr.' ) ( 'Goeckinghofstr.' ) ( 'Gruenlingweg' ) ( 'Hauptstr.' ) ( 'Heidelberger Str.' ) ( 'Im Warmet' ) ( 'Jacobistrasse' ) ( 'Karl-Marx-Allee' ) ( 'Karl-Schwaner-Str.' ) ( 'Leichhof' ) ( 'Lerchenstr.' ) ( 'Marktplatz' ) ( 'Max-Planck-Str.' ) ( 'Meerfeldstr.' ) ( 'Melissenstr.' ) ( 'Muehltalstr.' ) ( 'Mutterstadter Str.' ) ( 'N7,' ) ( 'Rankestr.' ) ( 'Raupelsweg' ) ( 'Schillerstr.' ) ( 'Stauboernchenstrasse' ) ( 'Stiftsbogen' ) ( 'Waldmann' ) ( 'Wilhelminentr.' ) ( 'Zwischergasse' ) ) ) ( country = 'ES' streets = VALUE tt_street_per_country( ( 'Camelias' ) ( 'Fuenlabrada' ) ( 'Piedad' ) ( 'Pza. Pablo Ruiz Picasso' ) ) ) ( country = 'FR' streets = VALUE tt_street_per_country( ( 'Rue Balzac' ) ( 'route de Pégomas' ) ( 'rue Nieuport' ) ) ) ( country = 'IT' streets = VALUE tt_street_per_country( ( 'Via Giulio Cesare' ) ) ) ( country = 'SI' streets = VALUE tt_street_per_country( ( 'Poklukarjeva' ) ) ) ( country = 'US' streets = VALUE tt_street_per_country( ( '17th St.' ) ( 'Federal Avenue' ) ( 'Golden Gate Drive' ) ( 'Lake Shore Drive' ) ( 'Oak Street' ) ( 'Sagamore St.' ) ( 'Voodoo Avenue' ) ( 'Windstone Drive' ) ) ) ). ENDMETHOD. ENDCLASS. CLASS lcl_supplement_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: tt_supplement TYPE STANDARD TABLE OF /dmo/suppleme_12 WITH KEY supplement_id, tt_supplement_text TYPE STANDARD TABLE OF /dmo/suppl_te_12 WITH KEY supplement_id. " Merged types TYPES BEGIN OF ty_supplement_complete. INCLUDE TYPE /dmo/suppleme_12. TYPES language_code TYPE spras. TYPES description TYPE /dmo/description12. TYPES END OF ty_supplement_complete. TYPES tt_supplement_complete TYPE STANDARD TABLE OF ty_supplement_complete WITH KEY supplement_id. CLASS-METHODS: get_data RETURNING VALUE(rt_data) TYPE tt_supplement_complete. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS lcl_supplement_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF. DELETE FROM /dmo/suppleme_12. "#EC CI_NOWHERE DELETE FROM /dmo/suppl_te_12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. DATA(lt_data) = get_data( ). IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF. INSERT /dmo/suppleme_12 FROM TABLE @( CORRESPONDING tt_supplement( lt_data ) ). INSERT /dmo/suppl_te_12 FROM TABLE @( CORRESPONDING tt_supplement_text( lt_data ) ). IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. " BV = beverage " ML = meal " LU = luggage " EX = extra rt_data = VALUE tt_supplement_complete( ( supplement_id = 'BV-0001' price = '2.30' currency_code = 'EUR' language_code = 'E' description = 'Hot Chocolate' ) ( supplement_id = 'BV-0002' price = '7.50' currency_code = 'EUR' language_code = 'E' description = 'Alcohol free Champagne' ) ( supplement_id = 'BV-0003' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Cola' ) ( supplement_id = 'BV-0004' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Orange Limonade' ) ( supplement_id = 'BV-0005' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Apple Juice' ) ( supplement_id = 'BV-0006' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Pear Juice' ) ( supplement_id = 'BV-0007' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Mango Juice' ) ( supplement_id = 'BV-0008' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Lemon Limonade' ) ( supplement_id = 'BV-0009' price = '4.50' currency_code = 'EUR' language_code = 'E' description = 'Tomato Juice' ) ( supplement_id = 'ML-0001' price = '3.00' currency_code = 'EUR' language_code = 'E' description = 'Black Forest Cake' ) ( supplement_id = 'ML-0002' price = '2.00' currency_code = 'EUR' language_code = 'E' description = 'Chocolate Cake' ) ( supplement_id = 'ML-0003' price = '1.50' currency_code = 'EUR' language_code = 'E' description = 'Apple Pie' ) ( supplement_id = 'ML-0004' price = '1.50' currency_code = 'EUR' language_code = 'E' description = 'Pear Pie' ) ( supplement_id = 'ML-0005' price = '8.00' currency_code = 'EUR' language_code = 'E' description = 'Nice Salad') ( supplement_id = 'ML-0006' price = '9.00' currency_code = 'EUR' language_code = 'E' description = 'Paris Salad') ( supplement_id = 'ML-0007' price = '12.00' currency_code = 'EUR' language_code = 'E' description = 'Hamburg Salad with Eggs' ) ( supplement_id = 'ML-0008' price = '25.00' currency_code = 'EUR' language_code = 'E' description = 'Quail with French Salad and Black Forest Cake') ( supplement_id = 'ML-0009' price = '13.00' currency_code = 'EUR' language_code = 'E' description = 'Duck on Lettuce' ) ( supplement_id = 'ML-0010' price = '5.00' currency_code = 'EUR' language_code = 'E' description = 'Carpaccio') ( supplement_id = 'ML-0011' price = '7.00' currency_code = 'EUR' language_code = 'E' description = 'Seasonal Salad') ( supplement_id = 'ML-0012' price = '16.00' currency_code = 'EUR' language_code = 'E' description = 'Hamburg Salad with Fresh Shrimps') ( supplement_id = 'ML-0013' price = '17.00' currency_code = 'EUR' language_code = 'E' description = 'Quail') ( supplement_id = 'ML-0014' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Wiener Schnitzel') ( supplement_id = 'ML-0015' price = '13.00' currency_code = 'EUR' language_code = 'E' description = 'Pork Schnitzel') ( supplement_id = 'ML-0016' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Schnitzel with Pepper Sauce') ( supplement_id = 'ML-0017' price = '11.00' currency_code = 'EUR' language_code = 'E' description = 'Chicken and French Fries') ( supplement_id = 'ML-0018' price = '12.00' currency_code = 'EUR' language_code = 'E' description = 'Turkey Steak') ( supplement_id = 'ML-0019' price = '15.00' currency_code = 'EUR' language_code = 'E' description = 'Bavarian Duck') ( supplement_id = 'ML-0020' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Knuckle of Pork') ( supplement_id = 'ML-0021' price = '22.00' currency_code = 'EUR' language_code = 'E' description = 'Fillet of Beef') ( supplement_id = 'ML-0022' price = '21.00' currency_code = 'EUR' language_code = 'E' description = 'Trout Au Bleu') ( supplement_id = 'ML-0023' price = '20.00' currency_code = 'EUR' language_code = 'E' description = 'Trout Meuniere') ( supplement_id = 'ML-0024' price = '17.00' currency_code = 'EUR' language_code = 'E' description = 'Monkfish') ( supplement_id = 'ML-0025' price = '12.00' currency_code = 'EUR' language_code = 'E' description = 'Sole') ( supplement_id = 'ML-0026' price = '6.00' currency_code = 'EUR' language_code = 'E' description = 'Mini Fried Sole') ( supplement_id = 'ML-0027' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Salmon in a Bearnaise Sauce') ( supplement_id = 'ML-0028' price = '15.00' currency_code = 'EUR' language_code = 'E' description = 'Salmon Lasagne') ( supplement_id = 'ML-0029' price = '3.00' currency_code = 'EUR' language_code = 'E' description = 'Chocolate Ice Cream') ( supplement_id = 'ML-0030' price = '2.50' currency_code = 'EUR' language_code = 'E' description = 'Vanilla Ice Cream') ( supplement_id = 'ML-0031' price = '4.50' currency_code = 'EUR' language_code = 'E' description = 'Vanilla Ice Cream with Hot Cherries') ( supplement_id = 'ML-0032' price = '4.50' currency_code = 'EUR' language_code = 'E' description = 'Vanilla Ice Cream with Hot Raspberries') ( supplement_id = 'ML-0033' price = '4.00' currency_code = 'EUR' language_code = 'E' description = 'Apple Strudel') ( supplement_id = 'ML-0034' price = '4.00' currency_code = 'EUR' language_code = 'E' description = 'Raspberry Sorbet') ( supplement_id = 'ML-0035' price = '4.00' currency_code = 'EUR' language_code = 'E' description = 'Strawberry Sorbet') ( supplement_id = 'LU-0001' price = '40.00' currency_code = 'EUR' language_code = 'E' description = 'Extra baggage 5 kgs') ( supplement_id = 'LU-0002' price = '15.00' currency_code = 'EUR' language_code = 'E' description = 'Luggage transfer from airport to hotel') ( supplement_id = 'LU-0003' price = '75.00' currency_code = 'EUR' language_code = 'E' description = 'Luggage pickup from home and return ' ) ( supplement_id = 'LU-0004' price = '80.00' currency_code = 'EUR' language_code = 'E' description = 'Bulky goods like sports equipment' ) ) . ENDMETHOD. ENDCLASS. CLASS lcl_travel_data_generator DEFINITION DEFERRED. CLASS /dmo/cl_flight_data_generat_12 DEFINITION LOCAL FRIENDS lcl_travel_data_generator. CLASS lcl_travel_data_generator DEFINITION CREATE PRIVATE. PUBLIC SECTION. INTERFACES: lif_data_generator. TYPES: tt_travel TYPE STANDARD TABLE OF /dmo/travel12 WITH KEY travel_id, tt_bookings TYPE STANDARD TABLE OF /dmo/booking12 WITH KEY travel_id booking_id, tt_booking_supplements TYPE STANDARD TABLE OF /dmo/book_sup_12 WITH KEY travel_id booking_id booking_supplement_id. " Build nested tables TYPES BEGIN OF ty_booking_complete. INCLUDE TYPE /dmo/booking12. TYPES booking_supplements TYPE tt_booking_supplements. TYPES END OF ty_booking_complete. TYPES tt_booking_complete TYPE STANDARD TABLE OF ty_booking_complete WITH KEY travel_id booking_id. TYPES BEGIN OF ty_travel_complete. INCLUDE TYPE /dmo/travel12. TYPES bookings TYPE tt_booking_complete. TYPES END OF ty_travel_complete. "! <em>Travel</em> structure <br/> "! <em>Bookings</em> table <br/> "! --> <em>Booking</em> structure <br/> "! --> <em>Booking Supplement</em> table <br/> "! -----> <em>Booking Supplement</em> structure TYPES tt_travel_complete TYPE STANDARD TABLE OF ty_travel_complete WITH KEY travel_id. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_countryname, country TYPE i_countrytext-country, countryname TYPE i_countrytext-countryname, END OF ty_countryname. CONSTANTS: cv_travel_group_amount_max TYPE i VALUE 3, cv_trip_length_center TYPE i VALUE 3, cv_trip_length_offset TYPE i VALUE 2, cv_booking_date_min TYPE i VALUE 0, cv_booking_date_max TYPE i VALUE 20, cv_travel_create_dat_befor_min TYPE i VALUE 0, cv_travel_create_dat_befor_max TYPE i VALUE 40, cv_travel_change_date_min TYPE i VALUE 0, cv_travel_change_date_max TYPE i VALUE 10, cv_booking_supplement_amount TYPE i VALUE 5, cv_booking_days_before TYPE i VALUE 15. CLASS-DATA: go_random_seats TYPE REF TO cl_abap_random_int, gt_flights_seats_decrease TYPE lcl_flight_data_generator=>tt_flights, go_ran_travel_group_amount TYPE REF TO cl_abap_random_int, go_ran_trip_length TYPE REF TO cl_abap_random_int, go_ran_customer TYPE REF TO cl_abap_random_int, gt_agency TYPE lcl_agency_data_generator=>tt_agency, gt_customer TYPE lcl_customer_data_generator=>tt_customer, gt_flights_final TYPE lcl_flight_data_generator=>tt_flights, go_ran_booking_date TYPE REF TO cl_abap_random_int, go_ran_agency TYPE REF TO cl_abap_random_int, gt_connections TYPE lcl_connection_data_generator=>tt_connection_additional_info, go_ran_booking_supplement_id TYPE REF TO cl_abap_random_int, go_ran_booking_supplement_amnt TYPE REF TO cl_abap_random_int, gt_supplements TYPE lcl_supplement_data_generator=>tt_supplement_complete, go_ran_travel_description TYPE REF TO cl_abap_random_int, go_ran_travel_create_dat_befor TYPE REF TO cl_abap_random_int, go_ran_travel_change_date TYPE REF TO cl_abap_random_int, go_ran_hour TYPE REF TO cl_abap_random_int, go_ran_min_sec TYPE REF TO cl_abap_random_int, gt_airports TYPE lcl_airport_data_generator=>tt_airport, gt_countryname TYPE STANDARD TABLE OF ty_countryname WITH KEY country, go_ran_status_description TYPE REF TO cl_abap_random_int, gt_last_names TYPE lcl_customer_data_generator=>tt_last_name, go_ran_last_name TYPE REF TO cl_abap_random_int, go_ran_customer_travel TYPE REF TO cl_abap_random_int, mv_datum TYPE d. CLASS-METHODS: get_data RETURNING VALUE(rt_data) TYPE tt_travel_complete, build_booking IMPORTING iv_travel_id TYPE /dmo/booking12-travel_id RETURNING VALUE(rt_bookings) TYPE tt_booking_complete, build_dependend_content, find_next_fitting_flight IMPORTING iv_seats_required TYPE i is_flight_previous TYPE /dmo/flight12 OPTIONAL RETURNING VALUE(rs_flight) TYPE /dmo/flight12, generate_booking_supplements IMPORTING iv_travel_id TYPE /dmo/booking12-travel_id iv_booking_id TYPE /dmo/booking12-booking_id RETURNING VALUE(rt_data) TYPE tt_booking_supplements, generate_description IMPORTING it_bookings TYPE lcl_travel_data_generator=>tt_booking_complete RETURNING VALUE(rv_description) TYPE /dmo/travel12-description, generate_random_time RETURNING VALUE(r_result) TYPE i, calculate_booking_fee IMPORTING it_bookings TYPE lcl_travel_data_generator=>tt_booking_complete RETURNING VALUE(rv_booking_fee) TYPE /dmo/travel12-booking_fee, generate_travel_customer_id IMPORTING it_bookings TYPE lcl_travel_data_generator=>tt_booking_complete RETURNING VALUE(rv_customer_id) TYPE /dmo/travel12-customer_id, set_today, calc_days_before_book_or_today IMPORTING iv_booking_date TYPE lcl_travel_data_generator=>ty_booking_complete-booking_date RETURNING VALUE(rv_travel_create_date_dats) TYPE d RAISING cx_parameter_invalid_range cx_parameter_invalid_type . ENDCLASS. CLASS lcl_travel_data_generator IMPLEMENTATION. METHOD lif_data_generator~create. DATA: lt_travels TYPE tt_travel, lt_bookings TYPE tt_bookings, lt_booking_supplements TYPE tt_booking_supplements. IF out IS BOUND. out->write( '--> Delete Travel Content.' ). ENDIF. DELETE FROM /dmo/travel12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Delete Booking Content.' ). ENDIF. DELETE FROM /dmo/booking12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Delete Booking Supplement Content.' ). ENDIF. DELETE FROM /dmo/book_sup_12. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF. DATA(lt_data) = get_data( ). IF out IS BOUND. out->write( '--> Convert Content to Table Format' ). ENDIF. LOOP AT lt_data INTO DATA(ls_travel). APPEND CORRESPONDING /dmo/travel12( ls_travel ) TO lt_travels. LOOP AT ls_travel-bookings INTO DATA(ls_booking). APPEND CORRESPONDING /dmo/booking12( ls_booking ) TO lt_bookings. APPEND LINES OF ls_booking-booking_supplements TO lt_booking_supplements. ENDLOOP. ENDLOOP. IF out IS BOUND. out->write( '--> Insert Travel Content' ). ENDIF. INSERT /dmo/travel12 FROM TABLE @lt_travels. IF out IS BOUND. out->write( '--> Insert Booking Content' ). ENDIF. INSERT /dmo/booking12 FROM TABLE @lt_bookings. IF out IS BOUND. out->write( '--> Insert Booking Supplement Content' ). ENDIF. INSERT /dmo/book_sup_12 FROM TABLE @lt_booking_supplements. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. DATA: lv_travel_id TYPE /dmo/booking12-travel_id. build_dependend_content( ). set_today( ). lv_travel_id = 1. DATA(lt_bookings) = build_booking( lv_travel_id ). WHILE lt_bookings IS NOT INITIAL. DATA(lv_travel_create_date_dats) = calc_days_before_book_or_today( lt_bookings[ 1 ]-booking_date ). DATA(lv_booking_fee) = calculate_booking_fee( lt_bookings ). DATA(lastchanged_date) = lv_travel_create_date_dats. lastchanged_date = lastchanged_date + go_ran_travel_change_date->get_next( ). DATA(lastchangedat_stamp) = CONV timestampl( ( CONV string( lastchanged_date ) * 1000000 ) ). lastchangedat_stamp = lastchangedat_stamp + generate_random_time( ). APPEND VALUE ty_travel_complete( travel_id = lv_travel_id agency_id = gt_agency[ go_ran_agency->get_next( ) ]-agency_id customer_id = generate_travel_customer_id( lt_bookings ) begin_date = lt_bookings[ 1 ]-flight_date end_date = lt_bookings[ lines( lt_bookings ) ]-flight_date booking_fee = lv_booking_fee total_price = lv_booking_fee + REDUCE /dmo/travel12-total_price( INIT sum = 0 FOR booking IN lt_bookings NEXT sum = sum + booking-flight_price + REDUCE /dmo/flight_price12( INIT sum_supplement = 0 FOR booking_supplement IN booking-booking_supplements NEXT sum_supplement = sum_supplement + booking_supplement-price ) ) currency_code = lt_bookings[ 1 ]-currency_code description = generate_description( lt_bookings ) status = SWITCH /dmo/travel12-status( go_ran_status_description->get_next( ) WHEN 1 OR 2 THEN /dmo/if_flight_legacy12=>travel_status-new WHEN 3 THEN /dmo/if_flight_legacy12=>travel_status-booked WHEN 4 THEN /dmo/if_flight_legacy12=>travel_status-planned ) createdby = gt_last_names[ go_ran_last_name->get_next( ) ]-last_name createdat = CONV timestampl( CONV string( lv_travel_create_date_dats ) * 1000000 + generate_random_time( ) ) lastchangedby = gt_last_names[ go_ran_last_name->get_next( ) ]-last_name lastchangedat = lastchangedat_stamp bookings = lt_bookings ) TO rt_data. lv_travel_id = lv_travel_id + 1. lt_bookings = build_booking( lv_travel_id ). ENDWHILE. ENDMETHOD. METHOD calc_days_before_book_or_today. cl_abap_tstmp=>td_add( EXPORTING date = COND d( WHEN mv_datum > iv_booking_date THEN iv_booking_date ELSE mv_datum ) time = CONV t( 0 ) secs = -86400 * cv_booking_days_before IMPORTING res_date = rv_travel_create_date_dats ). ENDMETHOD. METHOD set_today. GET TIME STAMP FIELD DATA(current_timestamp). DATA(tmp) = CONV string( current_timestamp ). mv_datum = tmp(8). mv_datum = mv_datum - 1. ENDMETHOD. METHOD generate_random_time. r_result = go_ran_hour->get_next( ) * 10000 + go_ran_min_sec->get_next( ) * 100 + go_ran_min_sec->get_next( ). ENDMETHOD. METHOD build_dependend_content. go_ran_hour = cl_abap_random_int=>create( min = 0 max = 23 ). go_ran_min_sec = cl_abap_random_int=>create( min = 0 max = 59 ). gt_agency = lcl_agency_data_generator=>get_data( ). go_ran_agency = cl_abap_random_int=>create( min = 1 max = lines( gt_agency ) ). gt_customer = lcl_customer_data_generator=>get_data( ). go_ran_customer = cl_abap_random_int=>create( min = 1 max = lines( gt_customer ) ). gt_last_names = lcl_customer_data_generator=>build_last_names( ). go_ran_last_name = cl_abap_random_int=>create( min = 1 max = lines( gt_last_names ) ). go_ran_customer_travel = cl_abap_random_int=>create( min = 1 max = 4 ). gt_connections = lcl_connection_data_generator=>get_data( ). gt_airports = lcl_airport_data_generator=>get_data( ). SELECT FROM i_countrytext FIELDS country, countryname WHERE language = 'E' INTO TABLE @gt_countryname. gt_flights_final = lcl_flight_data_generator=>get_data( ). SORT gt_flights_final BY flight_date ASCENDING. gt_flights_seats_decrease = lcl_flight_data_generator=>get_data( ). SORT gt_flights_seats_decrease BY flight_date ASCENDING. go_ran_travel_group_amount = cl_abap_random_int=>create( min = 1 max = cv_travel_group_amount_max ). go_ran_trip_length = cl_abap_random_int=>create( min = cv_trip_length_center - cv_trip_length_offset max = cv_trip_length_center + cv_trip_length_offset ). go_ran_booking_date = cl_abap_random_int=>create( min = cv_booking_date_min max = cv_booking_date_max ). go_ran_travel_create_dat_befor = cl_abap_random_int=>create( min = cv_booking_date_min max = cv_booking_date_max ). go_ran_travel_change_date = cl_abap_random_int=>create( min = cv_booking_date_min max = cv_booking_date_max ). gt_supplements = lcl_supplement_data_generator=>get_data( ). go_ran_booking_supplement_id = cl_abap_random_int=>create( min = 1 max = lines( lcl_supplement_data_generator=>get_data( ) ) ). go_ran_booking_supplement_amnt = cl_abap_random_int=>create( min = 0 max = cv_booking_supplement_amount ). go_ran_status_description = cl_abap_random_int=>create( min = 1 max = 4 ). go_ran_travel_description = cl_abap_random_int=>create( min = 0 max = 9 ). ENDMETHOD. METHOD build_booking. TYPES: tt_customer_id TYPE TABLE OF /dmo/customer12-customer_id WITH EMPTY KEY. DATA: lv_booking_id TYPE /dmo/booking12-booking_id, lt_customer_id TYPE tt_customer_id, lv_customer_amount TYPE i. DATA(lv_trip_length) = go_ran_trip_length->get_next( ). lt_customer_id = VALUE tt_customer_id( FOR i = 1 THEN i + 1 WHILE i <= go_ran_travel_group_amount->get_next( ) LET j = go_ran_customer->get_next( ) IN ( gt_customer[ j ]-customer_id ) ). lt_customer_id = CORRESPONDING tt_customer_id( lt_customer_id DISCARDING DUPLICATES ). lv_customer_amount = lines( lt_customer_id ). lv_booking_id = 0. DATA(ls_flight) = find_next_fitting_flight( iv_seats_required = lv_customer_amount ). CHECK ls_flight IS NOT INITIAL. DO lv_trip_length TIMES. READ TABLE gt_flights_seats_decrease WITH KEY key_sorted_date COMPONENTS carrier_id = ls_flight-carrier_id connection_id = ls_flight-connection_id flight_date = ls_flight-flight_date ASSIGNING FIELD-SYMBOL(<flight>). DATA(lv_booking_date) = CONV /dmo/booking12-booking_date( <flight>-flight_date - go_ran_booking_date->get_next( ) ). DATA(lv_price) = /dmo/cl_flight_data_generat_12=>calculate_flight_price( iv_flight_distance = gt_connections[ carrier_id = <flight>-carrier_id connection_id = <flight>-connection_id ]-distance iv_seats_occupied_percent = ( gt_flights_final[ KEY primary_key ##PRIMKEY[KEY_SORTED_DATE] carrier_id = <flight>-carrier_id connection_id = <flight>-connection_id flight_date = <flight>-flight_date ]-seats_occupied - <flight>-seats_occupied ) * 100 DIV <flight>-seats_max ). <flight>-seats_occupied = <flight>-seats_occupied - lv_customer_amount. APPEND LINES OF VALUE tt_booking_complete( FOR i = 1 THEN i + 1 WHILE i <= lines( lt_customer_id ) ( travel_id = iv_travel_id booking_id = lv_booking_id + i booking_date = lv_booking_date customer_id = lt_customer_id[ i ] carrier_id = <flight>-carrier_id connection_id = <flight>-connection_id flight_date = <flight>-flight_date flight_price = lv_price currency_code = <flight>-currency_code booking_supplements = generate_booking_supplements( iv_travel_id = iv_travel_id iv_booking_id = CONV /dmo/booking12-booking_id( lv_booking_id + i ) ) ) ) TO rt_bookings. lv_booking_id = lv_booking_id + lines( lt_customer_id ). ls_flight = find_next_fitting_flight( iv_seats_required = lv_customer_amount is_flight_previous = <flight> ). IF ls_flight IS INITIAL. EXIT. ENDIF. ENDDO. ENDMETHOD. METHOD find_next_fitting_flight. DATA(lt_flights_filtered) = FILTER lcl_flight_data_generator=>tt_flights( gt_flights_seats_decrease USING KEY key_sorted_seats WHERE seats_occupied >= iv_seats_required ). CHECK lt_flights_filtered IS NOT INITIAL. IF is_flight_previous IS SUPPLIED. DATA(lv_connection_id_new) = VALUE /dmo/connecti_12-connection_id( gt_connections[ airport_from_id = gt_connections[ connection_id = is_flight_previous-connection_id ]-airport_to_id ]-connection_id OPTIONAL ). CHECK lv_connection_id_new IS NOT INITIAL. DATA(lt_flights_filtered2) = FILTER lcl_flight_data_generator=>tt_flights( lt_flights_filtered USING KEY key_sorted_date WHERE connection_id = lv_connection_id_new AND flight_date >= is_flight_previous-flight_date ). CHECK lt_flights_filtered2 IS NOT INITIAL. rs_flight = lt_flights_filtered2[ 1 ]. ELSE. rs_flight = lt_flights_filtered[ 1 ]. ENDIF. ENDMETHOD. METHOD generate_booking_supplements. rt_data = VALUE tt_booking_supplements( FOR i = 1 THEN i + 1 WHILE i <= go_ran_booking_supplement_amnt->get_next( ) LET j = go_ran_booking_supplement_id->get_next( ) IN ( travel_id = iv_travel_id booking_id = iv_booking_id booking_supplement_id = i supplement_id = gt_supplements[ j ]-supplement_id price = gt_supplements[ j ]-price currency_code = gt_supplements[ j ]-currency_code ) ). ENDMETHOD. METHOD generate_description. TYPES: tt_customers TYPE SORTED TABLE OF /dmo/customer12 WITH UNIQUE KEY customer_id. rv_description = SWITCH /dmo/travel12-description( go_ran_travel_description->get_next( ) WHEN 1 THEN `Business Trip for ` && REDUCE /dmo/travel12-description( LET travelers = CORRESPONDING tt_customers( it_bookings DISCARDING DUPLICATES MAPPING customer_id = customer_id ) IN INIT s = `` i = 1 FOR traveler IN travelers NEXT s = s && gt_customer[ customer_id = traveler-customer_id ]-first_name && COND /dmo/travel12-description( WHEN i < lines( it_bookings ) THEN `, ` ) i = i + 1 ) WHEN 2 THEN `Vacation for ` && REDUCE /dmo/travel12-description( LET travelers2 = CORRESPONDING tt_customers( it_bookings DISCARDING DUPLICATES MAPPING customer_id = customer_id ) IN INIT s = `` i = 1 FOR traveler IN travelers2 NEXT s = s && gt_customer[ customer_id = traveler-customer_id ]-first_name && COND /dmo/travel12-description( WHEN i < lines( it_bookings ) THEN `, ` ) i = i + 1 ) WHEN 3 THEN `Business Trip to ` && gt_countryname[ country = gt_airports[ airport_id = gt_connections[ carrier_id = it_bookings[ 1 ]-carrier_id connection_id = it_bookings[ 1 ]-connection_id ]-airport_to_id ]-country ]-countryname WHEN 4 THEN `Vacation to ` && gt_countryname[ country = gt_airports[ airport_id = gt_connections[ carrier_id = it_bookings[ 1 ]-carrier_id connection_id = it_bookings[ 1 ]-connection_id ]-airport_to_id ]-country ]-countryname WHEN 5 THEN `Sightseeing in ` && gt_airports[ airport_id = gt_connections[ carrier_id = it_bookings[ 1 ]-carrier_id connection_id = it_bookings[ 1 ]-connection_id ]-airport_to_id ]-city WHEN 6 THEN `Visiting ` && gt_customer[ go_ran_customer->get_next( ) ]-first_name WHEN 7 THEN `Business Trip` ELSE `Vacation` ). ENDMETHOD. METHOD calculate_booking_fee. rv_booking_fee = 10 * lines( it_bookings ). ENDMETHOD. METHOD generate_travel_customer_id. rv_customer_id = COND /dmo/travel12-customer_id( WHEN go_ran_customer_travel->get_next( ) = 1 THEN gt_customer[ go_ran_customer->get_next( ) ]-customer_id ELSE it_bookings[ 1 ]-customer_id ). ENDMETHOD. ENDCLASS.
50.396552
213
0.522646
c8182efc8733ae6c408418127509f89cc5f4e0a6
2,019
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ote_dl_hdr_rel.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ote_dl_hdr_rel.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ote_dl_hdr_rel.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
FUNCTION zgtt_mia_ote_dl_hdr_rel. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM *" REFERENCE(I_APP_OBJ_TYPES) TYPE /SAPTRX/AOTYPES *" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER *" REFERENCE(I_APPTYPE_TAB) TYPE TRXAS_APPTYPE_TABS_WA *" REFERENCE(I_APP_OBJECT) TYPE TRXAS_APPOBJ_CTAB_WA *" EXPORTING *" VALUE(E_RESULT) LIKE SY-BINPT *" TABLES *" C_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL *" EXCEPTIONS *" PARAMETER_ERROR *" RELEVANCE_DETERM_ERROR *" STOP_PROCESSING *"---------------------------------------------------------------------- DATA: lt_app_objects TYPE trxas_appobj_ctabs, lo_udm_message TYPE REF TO cx_udm_message, ls_bapiret TYPE bapiret2. lt_app_objects = VALUE #( ( i_app_object ) ). TRY. e_result = zcl_gtt_mia_ef_performer=>check_relevance( is_definition = VALUE #( maintab = zif_gtt_mia_app_constants=>cs_tabledef-dl_header_new ) io_bo_factory = NEW zcl_gtt_mia_tp_factory_dlh( ) iv_appsys = i_appsys is_app_obj_types = i_app_obj_types it_all_appl_tables = i_all_appl_tables it_app_objects = lt_app_objects ). CATCH cx_udm_message INTO lo_udm_message. zcl_gtt_mia_tools=>get_errors_log( EXPORTING io_umd_message = lo_udm_message iv_appsys = i_appsys IMPORTING es_bapiret = ls_bapiret ). " add error message APPEND ls_bapiret TO c_logtable. " throw corresponding exception CASE lo_udm_message->textid. WHEN zif_gtt_mia_ef_constants=>cs_errors-stop_processing. RAISE stop_processing. WHEN zif_gtt_mia_ef_constants=>cs_errors-table_determination. RAISE parameter_error. ENDCASE. ENDTRY. ENDFUNCTION.
37.388889
117
0.610203
c819723e24f055fd68926d2e9741cdab7a20f573
686
abap
ABAP
src/zcl_io_backend_x_writer.clas.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
src/zcl_io_backend_x_writer.clas.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
src/zcl_io_backend_x_writer.clas.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en">Back-end file byte writer</p> "! CLASS zcl_io_backend_x_writer DEFINITION PUBLIC INHERITING FROM zcl_io_file_x_writer CREATE PUBLIC GLOBAL FRIENDS zcl_io_x_writer . PUBLIC SECTION. INTERFACES zif_io_backend_writer . METHODS constructor IMPORTING !file TYPE REF TO zcl_io_backend RAISING zcx_io_parameter_invalid . PROTECTED SECTION. PRIVATE SECTION. METHODS write_internal importing data type xstring. ENDCLASS. CLASS zcl_io_backend_x_writer IMPLEMENTATION. METHOD constructor. super->constructor( ). ENDMETHOD. METHOD write_internal. ENDMETHOD. ENDCLASS.
14.595745
76
0.737609
c821c7ef506d871f5dd68fd8fece975f8aeddd20
3,867
abap
ABAP
src/git_platform/zcl_abapgit_pr_enum_github.clas.abap
PeregrinTooc/abapGit
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
[ "MIT" ]
1
2020-11-12T17:34:15.000Z
2020-11-12T17:34:15.000Z
src/git_platform/zcl_abapgit_pr_enum_github.clas.abap
PeregrinTooc/abapGit
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
[ "MIT" ]
1
2017-10-27T09:32:58.000Z
2017-10-27T09:32:58.000Z
src/git_platform/zcl_abapgit_pr_enum_github.clas.abap
PeregrinTooc/abapGit
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
[ "MIT" ]
1
2021-07-09T02:07:11.000Z
2021-07-09T02:07:11.000Z
CLASS zcl_abapgit_pr_enum_github DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_pr_enum_provider . METHODS constructor IMPORTING !iv_user_and_repo TYPE string !ii_http_agent TYPE REF TO zif_abapgit_http_agent RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_info, repo_json TYPE REF TO zif_abapgit_ajson_reader, pulls TYPE zif_abapgit_pr_enum_provider=>ty_pull_requests, END OF ty_info. DATA mi_http_agent TYPE REF TO zif_abapgit_http_agent. DATA mv_repo_url TYPE string. METHODS fetch_repo_by_url IMPORTING iv_repo_url TYPE string RETURNING VALUE(rs_info) TYPE ty_info RAISING zcx_abapgit_exception. METHODS convert_list IMPORTING ii_json TYPE REF TO zif_abapgit_ajson_reader RETURNING VALUE(rt_pulls) TYPE zif_abapgit_pr_enum_provider=>ty_pull_requests. METHODS clean_url IMPORTING iv_url TYPE string RETURNING VALUE(rv_url) TYPE string. ENDCLASS. CLASS ZCL_ABAPGIT_PR_ENUM_GITHUB IMPLEMENTATION. METHOD clean_url. rv_url = replace( val = iv_url regex = '\{.*\}$' with = '' ). ENDMETHOD. METHOD constructor. mv_repo_url = |https://api.github.com/repos/{ iv_user_and_repo }|. mi_http_agent = ii_http_agent. mi_http_agent->global_headers( )->set( iv_key = 'Accept' iv_val = 'application/vnd.github.v3+json' ). IF zcl_abapgit_login_manager=>get( mv_repo_url ) IS NOT INITIAL. mi_http_agent->global_headers( )->set( iv_key = 'Authorization' iv_val = zcl_abapgit_login_manager=>get( mv_repo_url ) ). ENDIF. ENDMETHOD. METHOD convert_list. DATA lt_items TYPE string_table. DATA lv_i TYPE string. FIELD-SYMBOLS <ls_p> LIKE LINE OF rt_pulls. lt_items = ii_json->members( '/' ). LOOP AT lt_items INTO lv_i. APPEND INITIAL LINE TO rt_pulls ASSIGNING <ls_p>. <ls_p>-base_url = ii_json->get( |/{ lv_i }/base/repo/clone_url| ). <ls_p>-number = ii_json->get( |/{ lv_i }/number| ). <ls_p>-title = ii_json->get( |/{ lv_i }/title| ). <ls_p>-user = ii_json->get( |/{ lv_i }/user/login| ). <ls_p>-head_url = ii_json->get( |/{ lv_i }/head/repo/clone_url| ). <ls_p>-head_branch = ii_json->get( |/{ lv_i }/head/ref| ). <ls_p>-created_at = ii_json->get( |/{ lv_i }/created_at| ). ENDLOOP. ENDMETHOD. METHOD fetch_repo_by_url. DATA li_pulls_json TYPE REF TO zif_abapgit_ajson_reader. DATA lv_pull_url TYPE string. DATA li_response TYPE REF TO zif_abapgit_http_response. li_response = mi_http_agent->request( iv_repo_url ). rs_info-repo_json = li_response->json( ). li_response->headers( ). " for debug lv_pull_url = clean_url( rs_info-repo_json->get( '/pulls_url' ) ). li_pulls_json = mi_http_agent->request( lv_pull_url )->json( ). rs_info-pulls = convert_list( li_pulls_json ). ENDMETHOD. METHOD zif_abapgit_pr_enum_provider~list_pull_requests. DATA lv_upstream_url TYPE string. DATA ls_repo_info TYPE ty_info. FIELD-SYMBOLS <ls_p> LIKE LINE OF ls_repo_info-pulls. ls_repo_info = fetch_repo_by_url( mv_repo_url ). APPEND LINES OF ls_repo_info-pulls TO rt_pulls. IF ls_repo_info-repo_json->get_boolean( '/fork' ) = abap_true. lv_upstream_url = ls_repo_info-repo_json->get( '/source/url' ). " parent ? ls_repo_info = fetch_repo_by_url( lv_upstream_url ). LOOP AT ls_repo_info-pulls ASSIGNING <ls_p>. <ls_p>-is_for_upstream = abap_true. APPEND <ls_p> TO rt_pulls. ENDLOOP. ENDIF. ENDMETHOD. ENDCLASS.
27.820144
80
0.659685
c8230a7f037652c08f0672fb7665f36f854a6d33
896
abap
ABAP
kapitel_08/zbook_cd.fugr.saplzbook_cd.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
12
2018-06-22T10:55:06.000Z
2022-03-22T12:10:48.000Z
kapitel_08/zbook_cd.fugr.saplzbook_cd.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
5
2018-06-25T11:45:26.000Z
2019-09-04T19:41:55.000Z
kapitel_08/zbook_cd.fugr.saplzbook_cd.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
7
2018-07-02T14:20:28.000Z
2022-03-25T19:33:33.000Z
******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE LZBOOK_CDTOP. " Global Data INCLUDE LZBOOK_CDUXX. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LZBOOK_CDF... " Subroutines * INCLUDE LZBOOK_CDO... " PBO-Modules * INCLUDE LZBOOK_CDI... " PAI-Modules * INCLUDE LZBOOK_CDE... " Events * INCLUDE LZBOOK_CDP... " Local class implement. * INCLUDE LZBOOK_CDT99. " ABAP Unit tests
56
69
0.329241
c82451573ed7c5e603f77115e9f4a968a424a58d
50,938
abap
ABAP
src/zcl_ibmc_service.clas.abap
watson-developer-cloud/abap-sdk-nwas
cdf28b2ab4ae6ff326a8caa051323595aa44b05c
[ "Apache-2.0" ]
18
2019-10-09T03:11:14.000Z
2022-02-11T18:03:20.000Z
src/zcl_ibmc_service.clas.abap
watson-developer-cloud/abap-sdk-nwas
cdf28b2ab4ae6ff326a8caa051323595aa44b05c
[ "Apache-2.0" ]
6
2019-10-07T23:41:22.000Z
2020-09-17T07:39:37.000Z
src/zcl_ibmc_service.clas.abap
watson-developer-cloud/abap-sdk-nwas
cdf28b2ab4ae6ff326a8caa051323595aa44b05c
[ "Apache-2.0" ]
11
2019-10-07T17:21:15.000Z
2021-12-14T10:09:26.000Z
* Copyright 2019,2020 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. class ZCL_IBMC_SERVICE definition public inheriting from ZCL_IBMC_SERVICE_ARCH create public . public section. types DATA_REFERENCE type ref to DATA . types: FIELDNAME(30) type c . types BOOLEAN type ZIF_IBMC_SERVICE_ARCH~BOOLEAN . types CHAR type ZIF_IBMC_SERVICE_ARCH~CHAR . types DATE type STRING . types TIME type STRING . types INTEGER type I . types SHORT type INT2 . types LONG type INT8 . types FLOAT type F . types DOUBLE type F . types NUMBER type F . types FILE type XSTRING . types BINARY type XSTRING . types JSONOBJECT type ref to DATA . types MAP type ref to DATA . types: "! <p class="shorttext synchronized" lang="en">DateTime type, format 2018-10-23T15:18:18.914xxxZ</p> DATETIME(27) type c . types TT_STRING type ZIF_IBMC_SERVICE_ARCH~TT_STRING . types: TT_BOOLEAN type standard table of ZIF_IBMC_SERVICE_ARCH~BOOLEAN with non-unique default key . types: TT_CHAR type standard table of ZIF_IBMC_SERVICE_ARCH~CHAR with non-unique default key . types: TT_INTEGER type standard table of INTEGER with non-unique default key . types: TT_SHORT type standard table of SHORT with non-unique default key . types: TT_LONG type standard table of LONG with non-unique default key . types: TT_FLOAT type standard table of FLOAT with non-unique default key . types: TT_DOUBLE type standard table of DOUBLE with non-unique default key . types: TT_NUMBER type standard table of NUMBER with non-unique default key . types: TT_FILE type standard table of FILE with non-unique default key . types: begin of TS_MAP_FILE, KEY type STRING, DATA type FILE, end of TS_MAP_FILE . types: TT_MAP_FILE type standard table of TS_MAP_FILE with non-unique default key . types: begin of TS_FILE_WITH_METADATA, FILENAME type string, CONTENT_TYPE type string, DATA type xstring, end of TS_FILE_WITH_METADATA . types: TT_FILE_WITH_METADATA type standard table of TS_FILE_WITH_METADATA with non-unique default key . types TS_FORM_PART type ZIF_IBMC_SERVICE_ARCH~TS_FORM_PART . types TT_FORM_PART type ZIF_IBMC_SERVICE_ARCH~TT_FORM_PART . constants C_BOOLEAN_FALSE type BOOLEAN value SPACE ##NO_TEXT. constants C_BOOLEAN_TRUE type BOOLEAN value 'X' ##NO_TEXT. constants C_TRIBOOL_FALSE type BOOLEAN value '-' ##NO_TEXT. constants C_DEFAULT type STRING value 'DEFAULT' ##NO_TEXT. constants C_SUBRC_UNKNOWN type SY-SUBRC value 999999 ##NO_TEXT. constants C_MSGID type SY-MSGID value 'ZIBMC' ##NO_TEXT. constants C_I_ZERO type I value -2147481648 ##NO_TEXT. constants C_I8_ZERO type INT8 value -9223372036854775608 ##NO_TEXT. constants C_F_ZERO type F value '-2147481.648' ##NO_TEXT. constants C_BLANK type STRING value '&#§§#&__%$X' ##NO_TEXT. constants: begin of C_DATATYPE, string type char value 'g', struct type char value 'v', end of C_DATATYPE . data P_REQUEST_PROP_DEFAULT type TS_REQUEST_PROP . data P_DEBUG_MODE type CHAR value SPACE ##NO_TEXT. data P_VERSION type STRING . "! <p class="shorttext synchronized" lang="en">Raises an exception.</p> "! "! @parameter I_MSGNO | Message number. "! @parameter I_MSGV1 | Substitution for 1st placeholder in message. "! @parameter I_MSGV2 | Substitution for 2nd placeholder in message. "! @parameter I_MSGV3 | Substitution for 3rd placeholder in message. "! @parameter I_MSGV4 | Substitution for 4th placeholder in message. "! @parameter I_TEXT | Message text; specify if message number is not specified. "! @parameter I_SUBRC | Return code being returned. "! @parameter I_PREVIOUS | Exception that has been captured before. "! @parameter I_HTTP_STATUS | HTTP status code if exception is triggered by HTTP error "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised. "! class-methods RAISE_EXCEPTION importing !I_MSGNO type SY-MSGNO optional !I_MSGV1 type STRING optional !I_MSGV2 type STRING optional !I_MSGV3 type STRING optional !I_MSGV4 type STRING optional !I_TEXT type STRING optional !I_SUBRC type SY-SUBRC default C_SUBRC_UNKNOWN !I_PREVIOUS type ref to CX_ROOT optional !I_HTTP_STATUS type TS_HTTP_STATUS optional raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Returns field type and length of a given parameter.</p> "! "! @parameter I_FIELD | Field of type that is supposed to be determined. "! @parameter E_TECHNICAL_TYPE | Technical type (= base type) of I_FIELD. "! @parameter E_RELATIVE_TYPE | Relative type (= data type) of I_FIELD. "! @parameter E_LENGTH | Length of type of I_FIELD. "! class-methods GET_FIELD_TYPE importing !I_FIELD type ANY exporting !E_TECHNICAL_TYPE type ZIF_IBMC_SERVICE_ARCH~CHAR !E_RELATIVE_TYPE type STRING !E_LENGTH type I . "! <p class="shorttext synchronized" lang="en">Returns component names of a given structure.</p> "! "! @parameter I_STRUCTURE | Structure with components. "! @parameter E_COMPONENTS | Internal table of component names. "! class-methods GET_COMPONENTS importing !I_STRUCTURE type ANY exporting value(E_COMPONENTS) type ZIF_IBMC_SERVICE_ARCH~TT_STRING . "! <p class="shorttext synchronized" lang="en">Parses a JSON string into an ABAP structure.</p> "! "! @parameter I_JSON | JSON string. "! @parameter I_DICTIONARY | Dictionary for mapping of identifier names. "! @parameter C_ABAP | ABAP structure to be filled "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! class-methods PARSE_JSON importing !I_JSON type STRING !I_DICTIONARY type ANY optional changing value(C_ABAP) type ANY raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> "! methods GET_REQUEST_PROP importing !I_AUTH_METHOD type STRING default C_DEFAULT returning value(E_REQUEST_PROP) type TS_REQUEST_PROP . "! <p class="shorttext synchronized" lang="en">Returns data type of a given parameter.</p> "! "! @parameter I_FIELD | Field of type that is supposed to be determined. "! @parameter E_DATATYPE | Technical type (= base type) of I_FIELD. "! class-methods GET_DATATYPE importing !I_FIELD type ANY returning value(E_DATATYPE) type ZIF_IBMC_SERVICE_ARCH~CHAR . "! <p class="shorttext synchronized" lang="en">Unescape unicode codepoints to characters in a string</p>, "! e.g. '\u0041 b \u0063' -&gt; 'A b c' "! "! @parameter I_IN | String with unicode codepoints. "! @parameter E_OUT | Unescaped string. "! class-methods UNESCAPE_UNICODE importing !I_IN type STRING returning value(E_OUT) type STRING . "! <p class="shorttext synchronized" lang="en">Returns the file extension for a mime type</p>, "! e.g. 'text/plain' -&gt; 'txt' "! "! @parameter I_MIME_TYPE | MIME type. "! @parameter E_EXTENSION | File extension (without leading dot). "! class-methods GET_FILE_EXTENSION importing value(I_MIME_TYPE) type STRING returning value(E_EXTENSION) type STRING . "! <p class="shorttext synchronized" lang="en">Moves a referenced data structure to an ABAP structure.</p> "! "! @parameter I_DATA_REFERENCE | Reference to data object. "! @parameter E_ABAP | ABAP structure to be filled. "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! class-methods MOVE_DATA_REFERENCE_TO_ABAP importing !I_DATA_REFERENCE type DATA_REFERENCE exporting value(E_ABAP) type ANY raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> "! class-methods ADD_QUERY_PARAMETER importing !I_PARAMETER type STRING !I_VALUE type STRING !I_IS_BOOLEAN type BOOLEAN default C_BOOLEAN_FALSE changing !C_URL type TS_URL . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> "! class-methods ADD_HEADER_PARAMETER importing !I_PARAMETER type STRING !I_VALUE type STRING !I_IS_BOOLEAN type BOOLEAN default C_BOOLEAN_FALSE changing !C_HEADERS type ZIF_IBMC_SERVICE_ARCH~TS_REQUEST_PROP-HEADERS . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> "! class-methods GET_FULL_URL importing !I_URL type TS_URL returning value(E_URL) type STRING . "! <p class="shorttext synchronized" lang="en">Returns the service name.</p> "! "! @parameter E_APPNAME | Name of the service. "! methods GET_APPNAME returning value(E_APPNAME) type STRING . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> "! class-methods NORMALIZE_URL changing !C_URL type TS_URL . "! <p class="shorttext synchronized" lang="en">Extracts a JSON string from an ABAP structure.</p> "! "! @parameter I_NAME | Name of component to be extracted. "! @parameter I_VALUE | ABAP structure to be converted to JSON string. "! @parameter I_DICTIONARY | Dictionary to be used for mapping ABAP identifiers to JSON keys. "! @parameter I_REQUIRED_FIELDS | "! Dictionary of required fields.<br/> "! If a field is required, an initial value appears as initial value in JSON structure. "! Otherwise it is omitted in JSON string. "! @parameter I_LOWER_CASE | If set to C_BOOLEAN_TRUE all keys in JSON string will be lower case. "! @parameter E_JSON | JSON string. "! class-methods ABAP_TO_JSON importing !I_NAME type STRING optional !I_VALUE type ANY !I_DICTIONARY type ANY optional !I_REQUIRED_FIELDS type ANY optional !I_LOWER_CASE type BOOLEAN default C_BOOLEAN_TRUE returning value(E_JSON) type STRING . "! <p class="shorttext synchronized" lang="en">Throws an exception, if HTTP response indicates an error.</p> "! "! @parameter I_RESPONSE | HTTP response to be checked. "! @parameter I_URL | URL that the request has been sent to. "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! methods CHECK_HTTP_RESPONSE importing !I_RESPONSE type TO_REST_RESPONSE optional !I_URL type TS_URL optional raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Class constructor.</p> "! "! @parameter I_URL | URL of the service. "! @parameter I_HOST | Host of the service. I_URL and I_HOST can be used synonymously. "! @parameter I_PROXY_HOST | Proxy server, not applicable on SAP Cloud Platform. "! @parameter I_PROXY_PORT | Proxy server port, not applicable on SAP Cloud Platform. "! @parameter I_USERNAME | User name to authenticate on service. "! @parameter I_PASSWORD | User password to authenticate on service. "! @parameter I_APIKEY | API key password to authenticate on service. "! @parameter I_ACCESS_TOKEN | Access token to authenticate on service. "! @parameter I_SSL_ID | ID of PSE, not applicable on SAP Cloud Platform. "! @parameter I_DEBUG_MODE | not used. "! methods CONSTRUCTOR importing !I_URL type STRING optional !I_HOST type STRING optional !I_PROXY_HOST type STRING optional !I_PROXY_PORT type STRING optional !I_USERNAME type STRING optional !I_PASSWORD type STRING optional !I_APIKEY type STRING optional !I_ACCESS_TOKEN type TS_ACCESS_TOKEN optional !I_SSL_ID type ZIF_IBMC_SERVICE_ARCH~TY_SSL_ID optional !I_DEBUG_MODE type CHAR default SPACE . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> "! methods GET_REST_CLIENT importing !I_REQUEST_PROP type TS_REQUEST_PROP returning value(E_CLIENT) type TS_CLIENT raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> "! methods GET_ACCESS_TOKEN importing !I_REQUEST_PROP type TS_REQUEST_PROP optional returning value(E_ACCESS_TOKEN) type TS_ACCESS_TOKEN raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Sends a HTTP DELETE request.</p> "! "! @parameter I_REQUEST_PROP | Request properties. "! @parameter E_RESPONSE | Response returned by service. "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! methods HTTP_DELETE importing !I_REQUEST_PROP type TS_REQUEST_PROP returning value(E_RESPONSE) type TO_REST_RESPONSE raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Sets an access token explicitly.</p> "! "! @parameter I_ACCESS_TOKEN | Access token. "! methods SET_ACCESS_TOKEN importing !I_ACCESS_TOKEN type TS_ACCESS_TOKEN . "! <p class="shorttext synchronized" lang="en">Sends a HTTP GET request.</p> "! "! @parameter I_REQUEST_PROP | Request properties. "! @parameter E_RESPONSE | Response returned by service. "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! methods HTTP_GET importing !I_REQUEST_PROP type TS_REQUEST_PROP returning value(E_RESPONSE) type TO_REST_RESPONSE raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Sends a HTTP POST request.</p> "! "! @parameter I_REQUEST_PROP | Request properties. "! @parameter E_RESPONSE | Response returned by service. "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! methods HTTP_POST importing !I_REQUEST_PROP type TS_REQUEST_PROP returning value(E_RESPONSE) type TO_REST_RESPONSE raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Sends a HTTP POST request with multipart body.</p> "! "! @parameter I_REQUEST_PROP | Request properties. "! @parameter IT_FORM_PART | Internal table of form parts in request body. "! @parameter E_RESPONSE | Response returned by service. "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! methods HTTP_POST_MULTIPART importing !I_REQUEST_PROP type TS_REQUEST_PROP !IT_FORM_PART type TT_FORM_PART returning value(E_RESPONSE) type TO_REST_RESPONSE raising ZCX_IBMC_SERVICE_EXCEPTION . "! <p class="shorttext synchronized" lang="en">Sends a HTTP PUT request.</p> "! "! @parameter I_REQUEST_PROP | Request properties. "! @parameter E_RESPONSE | Response returned by service. "! @raising ZCX_IBMC_SERVICE_EXCEPTION | Exception being raised in case of an error. "! methods HTTP_PUT importing !I_REQUEST_PROP type TS_REQUEST_PROP returning value(E_RESPONSE) type TO_REST_RESPONSE raising ZCX_IBMC_SERVICE_EXCEPTION . protected section. "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> methods ADJUST_REQUEST_PROP changing !C_REQUEST_PROP type TS_REQUEST_PROP . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> class-methods MERGE_STRUCTURE importing !I_ALTERNATIVE type ANY changing !C_BASE type ANY . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> methods SET_DEFAULT_QUERY_PARAMETERS changing !C_URL type TS_URL . "! <p class="shorttext synchronized" lang="en">Method for internal use.</p> methods SET_URI_AND_AUTHORIZATION importing !I_CLIENT type TS_CLIENT !I_REQUEST_PROP type TS_REQUEST_PROP returning value(E_URI) type STRING raising ZCX_IBMC_SERVICE_EXCEPTION . private section. ENDCLASS. CLASS ZCL_IBMC_SERVICE IMPLEMENTATION. method abap_to_json. data: lv_json type string, lv_json_comp type string, lv_json_num(24) type c, lv_sep(1) type c, lv_name type string, lv_name_uc type string, lv_type type char, lt_compname type tt_string, lv_name_in_dict type boolean, lv_relative_type type string, lv_pattern type string, lv_str type string. field-symbols: <i_value> type any, <ls_compname> type string, <l_value> type any, <l_i_value> type i, <l_i8_value> type int8, <l_f_value> type f, <lt_value> type any table, <lv_name> type string, <lv_required> type string. get_field_type( exporting i_field = i_value importing e_technical_type = lv_type e_relative_type = lv_relative_type ). if lv_type eq zif_ibmc_service_arch~c_datatype-dataref or lv_type eq zif_ibmc_service_arch~c_datatype-objectref. if i_value is initial. return. endif. assign i_value->* to <i_value>. get_field_type( exporting i_field = <i_value> importing e_technical_type = lv_type e_relative_type = lv_relative_type ). else. assign i_value to <i_value>. endif. if lv_type ne zif_ibmc_service_arch~c_datatype-struct and lv_type ne zif_ibmc_service_arch~c_datatype-struct_deep and lv_type ne zif_ibmc_service_arch~c_datatype-itab. " simple type if lv_type eq 'C' or lv_type eq 'N' or lv_type eq 'g'. lv_str = <i_value>. if lv_str eq c_blank. " parameter is blank, not initial (i.e. null) lv_str = ''. else. replace all occurrences of '"' in lv_str with '\"'. replace all occurrences of cl_abap_char_utilities=>cr_lf in lv_str with '\n'. replace all occurrences of cl_abap_char_utilities=>newline in lv_str with '\n'. endif. " quote value unless it is a boolean if lv_relative_type eq 'BOOLEAN'. if lv_str eq c_boolean_true. lv_json = `true`. elseif lv_str eq c_boolean_false. lv_json = `false`. else. lv_json = lv_str. endif. else. lv_json = `"` && lv_str && `"`. endif. else. do 1 times. " to allow exit command " special handling for optional parameters explicitly set to initial if lv_type eq 'I'. assign <i_value> to <l_i_value>. if <l_i_value> = c_i_zero. lv_json_num = '0'. exit. endif. elseif lv_type eq '8'. assign <i_value> to <l_i8_value>. if <l_i8_value> = c_i8_zero. lv_json_num = '0'. exit. endif. elseif lv_type eq 'F'. assign <i_value> to <l_f_value>. if <l_f_value> = c_f_zero. lv_json_num = '0'. exit. endif. endif. lv_json_num = conv #( <i_value> ). condense lv_json_num no-gaps. enddo. lv_json = lv_json_num. endif. elseif lv_type eq zif_ibmc_service_arch~c_datatype-struct or lv_type eq zif_ibmc_service_arch~c_datatype-struct_deep. " structure get_components( exporting i_structure = <i_value> importing e_components = lt_compname ). clear lv_sep. lv_json = lv_json && `{`. loop at lt_compname assigning <ls_compname>. assign component <ls_compname> of structure <i_value> to <l_value>. if sy-subrc <> 0. continue. endif. " do not add property if not required and corresponding abap field is initial if <l_value> is initial and not i_required_fields is initial. assign component lv_relative_type of structure i_required_fields to <lv_required>. if sy-subrc <> 0. continue. endif. lv_pattern = `*|` && <ls_compname> && `|*`. if not <lv_required> cp lv_pattern. continue. endif. endif. lv_name = <ls_compname>. " check if key name exists in abap names dictionary lv_name_in_dict = c_boolean_false. try. assign component lv_name of structure i_dictionary to <lv_name>. if sy-subrc = 0. lv_name = <lv_name>. lv_name_in_dict = c_boolean_true. endif. catch cx_sy_assign_cast_illegal_cast cx_sy_assign_cast_unknown_type cx_sy_assign_out_of_range. endtry. if lv_name_in_dict eq c_boolean_false and i_lower_case eq c_boolean_true. " convert name to lower case translate lv_name to lower case. endif. " add property (recursively) lv_json_comp = abap_to_json( i_name = lv_name i_value = <l_value> i_lower_case = i_lower_case i_dictionary = i_dictionary i_required_fields = i_required_fields ). lv_json = lv_json && lv_sep && lv_json_comp. lv_sep = ','. endloop. lv_json = lv_json && `}`. elseif lv_type eq zif_ibmc_service_arch~c_datatype-itab. " internal table lv_json = lv_json && `[`. clear lv_sep. assign <i_value> to <lt_value>. loop at <lt_value> assigning <l_value>. lv_json_comp = abap_to_json( i_value = <l_value> i_lower_case = i_lower_case i_dictionary = i_dictionary i_required_fields = i_required_fields ). lv_json = lv_json && lv_sep && lv_json_comp. lv_sep = ','. endloop. lv_json = lv_json && `]`. endif. if not i_name is initial. lv_name_in_dict = c_boolean_false. lv_name = i_name. if not i_dictionary is initial. assign component i_name of structure i_dictionary to <lv_name>. if sy-subrc = 0. lv_name = <lv_name>. lv_name_in_dict = c_boolean_true. endif. endif. if lv_name_in_dict eq c_boolean_false and i_lower_case eq c_boolean_true. " convert name to lower case translate lv_name to lower case. endif. e_json = `"` && lv_name && `": ` && lv_json. else. e_json = lv_json. endif. endmethod. method add_header_parameter. data: ls_header type line of zif_ibmc_service_arch~ts_request_prop-headers, lv_value type string. if i_is_boolean eq c_boolean_true. if i_value eq c_boolean_true. lv_value = 'true'. else. lv_value = 'false'. endif. else. lv_value = i_value. endif. condense lv_value. " remove trailing spaces ls_header-name = i_parameter. ls_header-value = lv_value. append ls_header to c_headers. endmethod. method add_query_parameter. data: lv_param type string. if i_is_boolean eq c_boolean_true. if i_value eq c_boolean_true. lv_param = 'true'. else. lv_param = 'false'. endif. else. lv_param = i_value. endif. condense lv_param. " remove trailing spaces lv_param = i_parameter && `=` && lv_param. if c_url-querystring is initial. c_url-querystring = lv_param. else. c_url-querystring = c_url-querystring && `&` && lv_param. endif. endmethod. method adjust_request_prop. data: ls_request_prop_openapi type ts_request_prop. merge_structure( exporting i_alternative = p_request_prop_default changing c_base = c_request_prop ). " Separate protocol, host and path in url normalize_url( changing c_url = c_request_prop-url ). " Set defaults for some unspecified properties if c_request_prop-url-protocol is initial. c_request_prop-url-protocol = 'http' ##NO_TEXT. endif. if c_request_prop-auth_headername is initial. c_request_prop-auth_headername = 'Authorization' ##NO_TEXT. endif. " Allow basic authentication with apikey if c_request_prop-auth_basic eq c_boolean_true. if c_request_prop-username is initial and c_request_prop-password is initial and not c_request_prop-apikey is initial. c_request_prop-username = 'apikey' ##NO_TEXT. c_request_prop-password = c_request_prop-apikey. endif. endif. " Correct authentication location if ( c_request_prop-auth_basic ne c_boolean_false or c_request_prop-auth_oauth ne c_boolean_false or c_request_prop-auth_apikey ne c_boolean_false ) and not ( c_request_prop-auth_header eq c_boolean_true or c_request_prop-auth_query eq c_boolean_true or c_request_prop-auth_body eq c_boolean_true ). c_request_prop-auth_header = c_boolean_true. endif. endmethod. method check_http_response. data: lv_http_status type ts_http_status, lv_full_url type string, ls_url type ts_url, lv_strlen type i, lv_code type string, lo_service_exception type ref to zcx_ibmc_service_exception. lv_http_status = get_http_status( i_rest_response = i_response ). lv_code = lv_http_status-code. shift lv_code left deleting leading space. if lv_code ne '200' and " ok lv_code ne '201' and " ok with response lv_code ne '202' and " Accepted (asynchronous function call) lv_code ne '204'. " Deleted ls_url = i_url. merge_structure( exporting i_alternative = p_request_prop_default-url changing c_base = ls_url ). lv_full_url = get_full_url( ls_url ). try. raise_exception( i_msgno = '003' " HTTP Status: &1 (&2) i_msgv1 = lv_code i_msgv2 = lv_http_status-reason i_msgv3 = lv_full_url i_http_status = lv_http_status ). catch zcx_ibmc_service_exception into lo_service_exception. lo_service_exception->p_msg_json = lv_http_status-json. endtry. raise exception lo_service_exception. endif. endmethod. method constructor. data: lv_host type string. super->constructor( ). " use i_url and i_host synonymously if not i_url is initial. lv_host = i_url. else. lv_host = i_host. endif. p_request_prop_default-url-host = lv_host. p_request_prop_default-username = i_username. p_request_prop_default-password = i_password. p_request_prop_default-apikey = i_apikey. p_request_prop_default-access_token = i_access_token. p_debug_mode = i_debug_mode. normalize_url( changing c_url = p_request_prop_default-url ). if not i_proxy_host is supplied. get_default_proxy( exporting i_url = p_request_prop_default-url importing e_proxy_host = p_request_prop_default-proxy_host e_proxy_port = p_request_prop_default-proxy_port ). else. p_request_prop_default-proxy_host = i_proxy_host. if not i_proxy_port is initial. p_request_prop_default-proxy_port = i_proxy_port. else. p_request_prop_default-proxy_port = '8080'. endif. endif. endmethod. method get_access_token. e_access_token = p_request_prop_default-access_token. endmethod. method get_appname. endmethod. method get_components. data: lo_abap_struc type ref to cl_abap_structdescr, lt_comp type cl_abap_structdescr=>component_table. field-symbols: <ls_comp> type line of cl_abap_structdescr=>component_table. lo_abap_struc ?= cl_abap_structdescr=>describe_by_data( i_structure ). lt_comp = lo_abap_struc->get_components( ). clear e_components[]. loop at lt_comp assigning <ls_comp>. append <ls_comp>-name to e_components. endloop. endmethod. method get_datatype. get_field_type( exporting i_field = i_field importing e_technical_type = e_datatype ). endmethod. method get_field_type. data: lo_abap_type type ref to cl_abap_typedescr, lo_typedescr type ref to cl_abap_typedescr. call method cl_abap_typedescr=>describe_by_data exporting p_data = i_field receiving p_descr_ref = lo_typedescr. e_technical_type = lo_typedescr->type_kind. if e_relative_type is requested. if e_technical_type eq zif_ibmc_service_arch~c_datatype-objectref. data lo_refdescr type ref to cl_abap_refdescr. lo_refdescr ?= cl_abap_typedescr=>describe_by_data( i_field ). lo_abap_type ?= lo_refdescr->get_referenced_type( ). else. lo_abap_type = cl_abap_typedescr=>describe_by_data( i_field ). endif. e_relative_type = lo_abap_type->get_relative_name( ). endif. if e_length is requested. if e_technical_type eq zif_ibmc_service_arch~c_datatype-c or e_technical_type eq zif_ibmc_service_arch~c_datatype-n. e_length = lo_typedescr->length. else. e_length = 0. endif. endif. endmethod. method get_file_extension. data: lv_mime_type type string, lv_ext type string, lv_len type i. translate i_mime_type to lower case. case i_mime_type. when 'text/plain'. e_extension = 'txt'. when 'image/jpeg'. e_extension = 'jpg'. when 'application/octet-stream'. e_extension = 'bin'. when others. e_extension = 'dat'. find regex '([^/]*)$' in i_mime_type submatches lv_ext. if sy-subrc = 0. lv_len = strlen( lv_ext ). if lv_len >= 2 and lv_len <= 4. e_extension = lv_ext. endif. endif. endcase. endmethod. method get_full_url. data: lv_url type string. if not i_url-host cp 'http*'. if i_url-protocol is initial. lv_url = 'http://'. else. lv_url = i_url-protocol && `://`. endif. endif. lv_url = lv_url && i_url-host && i_url-path_base && i_url-path. if not i_url-querystring is initial. lv_url = lv_url && `?` && i_url-querystring. endif. e_url = lv_url. endmethod. method get_request_prop. e_request_prop-url-protocol = 'http'. e_request_prop-auth_headername = ''. e_request_prop-auth_basic = c_boolean_false. e_request_prop-auth_oauth = c_boolean_false. e_request_prop-auth_apikey = c_boolean_false. e_request_prop-auth_query = c_boolean_false. e_request_prop-auth_header = c_boolean_false. endmethod. method get_rest_client. data: ls_header type ts_header, ls_request_prop type ts_request_prop, lv_url type string. ls_request_prop = i_request_prop. adjust_request_prop( changing c_request_prop = ls_request_prop ). " create http client instance lv_url = ls_request_prop-url-protocol && `://` && ls_request_prop-url-host. create_client_by_url( exporting i_url = lv_url i_request_prop = ls_request_prop importing e_client = e_client ). " set URI and authorization lv_url = set_uri_and_authorization( i_client = e_client i_request_prop = ls_request_prop ). " set request uri set_request_uri( i_client = e_client i_uri = lv_url ). " set 'Content-Type' header if not i_request_prop-header_content_type is initial. set_request_header( i_client = e_client i_name = zif_ibmc_service_arch~c_header_content_type i_value = ls_request_prop-header_content_type ). endif. " set 'Accept' header if not i_request_prop-header_accept is initial. set_request_header( i_client = e_client i_name = zif_ibmc_service_arch~c_header_accept i_value = ls_request_prop-header_accept ). endif. " set additional headers if not ls_request_prop-headers is initial. loop at ls_request_prop-headers into ls_header. set_request_header( i_client = e_client i_name = ls_header-name i_value = ls_header-value ). endloop. endif. endmethod. method http_delete. data: lo_client type ts_client. " create REST client lo_client = get_rest_client( i_request_prop = i_request_prop ). " execute DELETE request e_response = execute( i_client = lo_client i_method = zif_ibmc_service_arch~c_method_delete ). " check response check_http_response( i_response = e_response i_url = i_request_prop-url ). endmethod. method http_get. data: lo_client type ts_client. " create REST client lo_client = get_rest_client( i_request_prop = i_request_prop ). " execute GET request e_response = execute( i_client = lo_client i_method = zif_ibmc_service_arch~c_method_get ). " check response check_http_response( i_response = e_response i_url = i_request_prop-url ). endmethod. method http_post. data: lo_client type ts_client. " create REST client lo_client = get_rest_client( i_request_prop = i_request_prop ). " set request body if not i_request_prop-body is initial. set_request_body_cdata( i_client = lo_client i_data = i_request_prop-body ). endif. if not i_request_prop-body_bin is initial. set_request_body_xdata( i_client = lo_client i_data = i_request_prop-body_bin ). endif. " error: querystring of a POST request is not sent to server if the request body is empty " workaround: set an empty json object for request body if i_request_prop-body is initial and i_request_prop-body_bin is initial. set_request_body_cdata( i_client = lo_client i_data = `{}` ). set_request_header( i_client = lo_client i_name = zif_ibmc_service_arch~c_header_content_type i_value = zif_ibmc_service_arch~c_mediatype-appl_json ). endif. " execute POST request e_response = execute( i_client = lo_client i_method = zif_ibmc_service_arch~c_method_post ). " check response check_http_response( i_response = e_response i_url = i_request_prop-url ). endmethod. method HTTP_POST_MULTIPART. data: lo_client type ts_client. " create REST client lo_client = get_rest_client( i_request_prop = i_request_prop ). " set request body (multipart) add_form_part( i_client = lo_client it_form_part = it_form_part ). " execute POST request e_response = execute( i_client = lo_client i_method = zif_ibmc_service_arch~c_method_post ). " check response check_http_response( i_response = e_response i_url = i_request_prop-url ). endmethod. method http_put. data: lo_client type ts_client. " create REST client lo_client = get_rest_client( i_request_prop = i_request_prop ). " set request body if not i_request_prop-body is initial. set_request_body_cdata( i_client = lo_client i_data = i_request_prop-body ). endif. if not i_request_prop-body_bin is initial. set_request_body_xdata( i_client = lo_client i_data = i_request_prop-body_bin ). endif. " execute PUT request e_response = execute( i_client = lo_client i_method = zif_ibmc_service_arch~c_method_put ). " check response check_http_response( i_response = e_response i_url = i_request_prop-url ). endmethod. method merge_structure. data: lv_type type char, lt_compname type tt_string. field-symbols: <lv_comp_base> type any, <lv_comp_alt> type any, <lv_tab_base> type standard table, <lv_tab_alt> type standard table, <lv_compname> type string. get_components( exporting i_structure = c_base importing e_components = lt_compname ). loop at lt_compname assigning <lv_compname>. assign component <lv_compname> of structure c_base to <lv_comp_base>. check sy-subrc = 0. get_field_type( exporting i_field = <lv_comp_base> importing e_technical_type = lv_type ). if lv_type eq zif_ibmc_service_arch~c_datatype-struct or lv_type eq zif_ibmc_service_arch~c_datatype-struct_deep. assign component <lv_compname> of structure i_alternative to <lv_comp_alt>. check sy-subrc = 0. merge_structure( exporting i_alternative = <lv_comp_alt> changing c_base = <lv_comp_base> ). else. if <lv_comp_base> is initial. if lv_type eq zif_ibmc_service_arch~c_datatype-itab. assign component <lv_compname> of structure c_base to <lv_tab_base>. check sy-subrc = 0. assign component <lv_compname> of structure i_alternative to <lv_tab_alt>. check sy-subrc = 0. if not <lv_tab_alt> is initial. append lines of <lv_tab_alt> to <lv_tab_base>. endif. else. assign component <lv_compname> of structure i_alternative to <lv_comp_alt>. check sy-subrc = 0. <lv_comp_base> = <lv_comp_alt>. endif. endif. endif. endloop. endmethod. method move_data_reference_to_abap. data: lt_compname type tt_string, lv_compname type string, lv_index type i, lv_rowno type i, begin of ls_stack, name type string, ref type ref to data, struct type ref to data, type type char, end of ls_stack, ls_stack_new like ls_stack, lt_stack like standard table of ls_stack, lr_ref type ref to data. field-symbols: <ls_dataref> type data, <lt_table> type standard table, <lt_comp> type standard table, <lv_comp> type any, <lv_subcomp> type any, <lv_tabrow> type any, <lv_comprow> type any, <lv_ref> type ref to data, <lv_struct> type any. clear ls_stack-name. ls_stack-ref = i_data_reference. ls_stack-struct = ref #( e_abap ). get_field_type( exporting i_field = e_abap importing e_technical_type = ls_stack-type ). append ls_stack to lt_stack. do. lv_index = lines( lt_stack ). if lv_index <= 0. exit. endif. read table lt_stack into ls_stack index lv_index. if ls_stack-type eq 'u' or ls_stack-type eq 'v'. " structure assign ls_stack-struct->* to <lv_struct>. assign ls_stack-ref->* to <ls_dataref>. get_components( exporting i_structure = <lv_struct> importing e_components = lt_compname ). loop at lt_compname into lv_compname. assign component lv_compname of structure <lv_struct> to <lv_comp>. ls_stack_new-name = lv_compname. ls_stack_new-struct = ref #( <lv_comp> ). assign component lv_compname of structure <ls_dataref> to <lv_ref>. if sy-subrc = 0. ls_stack_new-ref = <lv_ref>. get_field_type( exporting i_field = <lv_comp> importing e_technical_type = ls_stack_new-type ). append ls_stack_new to lt_stack. endif. endloop. else. if ls_stack-type eq 'h'. " internal table assign ls_stack-struct->* to <lt_comp>. assign ls_stack-ref->* to <lt_table>. loop at <lt_table> assigning <lv_tabrow>. ls_stack_new-ref = <lv_tabrow>. create data ls_stack_new-struct like line of <lt_comp>. assign ls_stack_new-struct->* to <lv_comprow>. append <lv_comprow> to <lt_comp>. " append copies data lv_rowno = lines( <lt_comp> ). read table <lt_comp> assigning <lv_comprow> index lv_rowno. " -> re-read row for reference ls_stack_new-struct = ref #( <lv_comprow> ). get_field_type( exporting i_field = <lv_comprow> importing e_technical_type = ls_stack_new-type ). clear ls_stack_new-name. append ls_stack_new to lt_stack. endloop. else. assign ls_stack-struct->* to <lv_comp>. if ls_stack-type eq 'l' or ls_stack-type eq 'r'. " reference <lv_comp> = ls_stack-ref. else. " simple type assign ls_stack-ref->* to <ls_dataref>. <lv_comp> = <ls_dataref>. endif. endif. endif. delete lt_stack index lv_index. enddo. endmethod. method normalize_url. check not c_url is initial. data(lv_protocol) = c_url-protocol. if not lv_protocol is initial and lv_protocol np '*://'. lv_protocol = lv_protocol && '://'. endif. data(lv_host) = c_url-host. if c_url-host cp 'http:*' or c_url-host cp 'https:*'. clear lv_protocol. endif. shift lv_host right deleting trailing '/'. if not c_url-path_base is initial. shift c_url-path_base left deleting leading '/'. lv_host = lv_host && '/' && c_url-path_base. shift lv_host right deleting trailing '/'. endif. shift lv_host left deleting leading space. data(lv_path) = c_url-path. if not lv_path is initial. if lv_path np '/*'. lv_path = '/' && lv_path. endif. endif. data(lv_url_full) = lv_protocol && lv_host && lv_path. shift lv_url_full right deleting trailing '/'. shift lv_url_full left deleting leading space. clear: c_url-protocol, c_url-host, c_url-path_base, c_url-path. " do not clear other components find regex '^(http.?:\/\/)?([^\/]*)(.*)$' in lv_url_full submatches c_url-protocol c_url-host c_url-path. shift c_url-protocol right deleting trailing '/'. shift c_url-protocol right deleting trailing ':'. shift c_url-protocol left deleting leading space. " split path into base_path and path if not lv_host is initial. find lv_host in lv_url_full match offset data(lv_offset) match length data(lv_length). if sy-subrc = 0. data(lv_strlen_url) = strlen( lv_url_full ). data(lv_strlen_path) = strlen( c_url-path ). data(lv_splitpoint) = lv_strlen_path - ( lv_strlen_url - lv_offset - lv_length ). c_url-path_base = c_url-path+0(lv_splitpoint). c_url-path = c_url-path+lv_splitpoint. endif. endif. return. endmethod. method PARSE_JSON. data: lv_json type string, lt_dictionary type zif_ibmc_service_arch~tt_string, lv_dictionary type string, lv_orgname type string, lv_abapname type string, lv_regex type string, lo_json type ref to /ui2/cl_json, lv_msg type string, lr_exception type ref to cx_sy_move_cast_error. field-symbols: <lv_orgname> type string. if not i_json is initial. lv_json = i_json. if i_dictionary is supplied. get_components( exporting i_structure = i_dictionary importing e_components = lt_dictionary ). loop at lt_dictionary into lv_dictionary. assign component lv_dictionary of structure i_dictionary to <lv_orgname>. lv_orgname = <lv_orgname>. translate lv_orgname to upper case. if lv_dictionary ne lv_orgname. lv_regex = `"` && <lv_orgname> && `"\s*:`. lv_abapname = `"` && lv_dictionary && `":`. replace all occurrences of regex lv_regex in lv_json with lv_abapname. endif. endloop. endif. " copy code to execute /ui2/cl_json=>deserialize( exporting json = lv_json changing data = c_abap ) and catch exception create object lo_json. try. lo_json->deserialize_int( exporting json = lv_json changing data = c_abap ). catch cx_sy_move_cast_error into lr_exception. zcl_ibmc_service=>raise_exception( exporting i_msgno = 20 ). endtry. endif. endmethod. method raise_exception. data: ls_msg like if_t100_message=>t100key, lv_charval(11) type c, lo_service_exception type ref to zcx_ibmc_service_exception. ls_msg-msgid = c_msgid. if not i_msgno is initial. ls_msg-msgno = i_msgno. ls_msg-attr1 = i_msgv1. ls_msg-attr2 = i_msgv2. ls_msg-attr3 = i_msgv3. ls_msg-attr4 = i_msgv4. else. if not i_text is initial. if i_subrc <> c_subrc_unknown. lv_charval = conv #( i_subrc ). ls_msg-attr2 = lv_charval. ls_msg-msgno = '001'. " &1: return code &2 else. ls_msg-msgno = '000'. " &1 endif. ls_msg-attr1 = i_text. else. ls_msg-msgno = '002'. " An exception has occurred, reason code &1. lv_charval = conv #( i_subrc ). ls_msg-attr1 = lv_charval. endif. endif. if ls_msg-attr4 is initial and not i_http_status-json is initial. data: begin of ls_error, error type string, description type string, end of ls_error. parse_json( exporting i_json = i_http_status-json changing c_abap = ls_error ). if not ls_error-error is initial. ls_msg-attr4 = unescape_unicode( ls_error-error ). elseif not ls_error-description is initial. ls_msg-attr4 = unescape_unicode( ls_error-description ). else. ls_msg-attr4 = unescape_unicode( i_http_status-json ). endif. endif. raise exception type zcx_ibmc_service_exception message id c_msgid type 'E' number ls_msg-msgno with ls_msg-attr1 ls_msg-attr2 ls_msg-attr3 ls_msg-attr4. endmethod. method set_access_token. p_request_prop_default-access_token = i_access_token. if p_request_prop_default-access_token-token_type is initial. p_request_prop_default-access_token-token_type = 'Bearer'. endif. if p_request_prop_default-access_token-expires_ts = 0. p_request_prop_default-access_token-expires_ts = '99991231235959' ##LITERAL. " avoid token being refreshed by sdk endif. endmethod. method set_default_query_parameters. if not p_version is initial. add_query_parameter( exporting i_parameter = `version` i_value = p_version changing c_url = c_url ). endif. endmethod. method set_uri_and_authorization. data: ls_url type ts_url, lv_url type string. ls_url = i_request_prop-url. " OAuth authorization if i_request_prop-auth_oauth eq c_boolean_true. " = not ( c_boolean_false or c_tribool_false ) data: ls_access_token type ts_access_token, lv_full_token type string. ls_access_token = get_access_token( i_request_prop = i_request_prop ). if not ls_access_token-token_type is initial. concatenate ls_access_token-token_type ls_access_token-access_token into lv_full_token separated by space. else. lv_full_token = ls_access_token-access_token. endif. if i_request_prop-auth_header eq c_boolean_true. set_request_header( i_client = i_client i_name = i_request_prop-auth_headername i_value = lv_full_token ). endif. " Basic authentication elseif i_request_prop-auth_basic eq c_boolean_true or i_request_prop-auth_apikey eq c_boolean_true. data: lv_username type string, lv_password type string. if i_request_prop-auth_apikey eq c_boolean_true. lv_username = 'apikey' ##NO_TEXT. lv_password = i_request_prop-apikey. else. lv_username = i_request_prop-username. lv_password = i_request_prop-password. endif. if i_request_prop-auth_header eq c_boolean_true. set_authentication_basic( i_client = i_client i_username = lv_username i_password = lv_password ). elseif i_request_prop-auth_query eq c_boolean_true. if i_request_prop-auth_apikey eq c_boolean_true. add_query_parameter( exporting i_parameter = 'apiKey' ##NO_TEXT i_value = lv_password changing c_url = ls_url ). else. add_query_parameter( exporting i_parameter = 'username' ##NO_TEXT i_value = lv_username changing c_url = ls_url ). add_query_parameter( exporting i_parameter = 'password' ##NO_TEXT i_value = lv_password changing c_url = ls_url ). endif. elseif i_request_prop-auth_body eq c_boolean_true. data: lv_body type string. if i_request_prop-auth_apikey eq c_boolean_true. lv_body = `{ "userid": "apikey", "password": "` && i_request_prop-apikey && `" }` ##NO_TEXT. else. lv_body = `{ "userid": "` && i_request_prop-username && `", "password": "` && i_request_prop-password && `" }` ##NO_TEXT. endif. set_request_body_cdata( i_client = i_client i_data = lv_body ). set_request_header( i_client = i_client i_name = zif_ibmc_service_arch~c_header_content_type i_value = zif_ibmc_service_arch~c_mediatype-appl_json ). endif. endif. e_uri = get_full_url( ls_url ). endmethod. method unescape_unicode. data: lv_match type string, lv_cp_str type string, lv_cp_hex(4) type x, lv_ucchar(1) type c. field-symbols: <lv_c> like lv_ucchar. e_out = i_in. do. find regex '(\\u[A-Fa-f0-9]{4})' in e_out ignoring case submatches lv_match ##NO_TEXT. if sy-subrc <> 0. exit. endif. lv_cp_str = lv_match+2. translate lv_cp_str to upper case. lv_cp_hex = lv_cp_str. assign lv_cp_hex to <lv_c> CASTING. lv_ucchar = <lv_c>. replace all occurrences of lv_match in e_out with lv_ucchar. enddo. endmethod. ENDCLASS.
31.91604
171
0.661432
c82588d805a678860a8376c4f1ccc1fbc8a2ba56
27,328
abap
ABAP
lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt.fugr.lzsst_gttd30.abap
DanHaer/logistics-business-network-gtt-samples
739978ac389da6f3530b26cd6402a3892f4b605a
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt.fugr.lzsst_gttd30.abap
DanHaer/logistics-business-network-gtt-samples
739978ac389da6f3530b26cd6402a3892f4b605a
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt.fugr.lzsst_gttd30.abap
DanHaer/logistics-business-network-gtt-samples
739978ac389da6f3530b26cd6402a3892f4b605a
[ "Apache-2.0" ]
null
null
null
*&---------------------------------------------------------------------* *& Local class definition - Actual Events Fillers *&---------------------------------------------------------------------* ********************************************************************** *** Planned Events of Freight Order **************************** ********************************************************************** CLASS lcl_pe_filler_fo_header DEFINITION. PUBLIC SECTION. INTERFACES lif_pe_filler. METHODS constructor IMPORTING io_ef_parameters TYPE REF TO lif_ef_parameters io_bo_reader TYPE REF TO lif_bo_reader. PRIVATE SECTION. DATA: mo_ef_parameters TYPE REF TO lif_ef_parameters, mo_bo_reader TYPE REF TO lif_bo_reader, mv_milestonecnt(4) TYPE n. METHODS load_start IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. METHODS load_end IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. METHODS coupling IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. METHODS decoupling IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. METHODS unload_start IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. METHODS unload_end IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. METHODS shp_arrival IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. METHODS shp_departure IMPORTING iv_tor_id TYPE /scmtms/tor_id it_stop TYPE /scmtms/t_em_bo_tor_stop it_loc_addr TYPE /scmtms/t_em_bo_loc_addr it_stop_points TYPE lif_ef_types=>tt_stop_points is_app_objects TYPE trxas_appobj_ctab_wa CHANGING ct_expeventdata TYPE lif_ef_types=>tt_expeventdata RAISING cx_udm_message. ENDCLASS. CLASS lcl_pe_filler_fo_header IMPLEMENTATION. METHOD load_start. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr, lv_seq_num TYPE /scmtms/seq_num. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-outbound AND <ls_stop>-aggr_assgn_start_l IS NOT INITIAL AND <ls_stop>-aggr_assgn_end_l IS NOT INITIAL. lv_seq_num = COND #( WHEN sy-tabix > 1 THEN <ls_stop>-seq_num - 1 ELSE <ls_stop>-seq_num ). READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = lv_seq_num. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_l TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_l TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_load_start evt_exp_datetime = |{ lv_conv_date }{ lv_conv_time }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name ) TO ct_expeventdata. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD load_end. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr, lv_seq_num TYPE /scmtms/seq_num. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-outbound AND <ls_stop>-aggr_assgn_start_l IS NOT INITIAL AND <ls_stop>-aggr_assgn_end_l IS NOT INITIAL. lv_seq_num = COND #( WHEN sy-tabix > 1 THEN <ls_stop>-seq_num - 1 ELSE <ls_stop>-seq_num ). READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = lv_seq_num. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_end_l TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-aggr_assgn_end_l TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_load_end evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name itemident = <ls_stop>-node_id ) TO ct_expeventdata. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD coupling. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr, lv_seq_num TYPE /scmtms/seq_num. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-outbound AND <ls_stop>-aggr_assgn_start_c IS NOT INITIAL AND <ls_stop>-aggr_assgn_end_c IS NOT INITIAL. lv_seq_num = COND #( WHEN sy-tabix > 1 THEN <ls_stop>-seq_num - 1 ELSE <ls_stop>-seq_num ). READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = lv_seq_num. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_end_c TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-aggr_assgn_end_c TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. IF <ls_stop>-aggr_assgn_start_c IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_c TIME ZONE lv_tz INTO DATE DATA(lv_conv_date1) TIME DATA(lv_conv_time1). ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_coupling evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }| evt_er_exp_dtime = |0{ lv_conv_date1 }{ lv_conv_time1 }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name ) TO ct_expeventdata. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD decoupling. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-inbound AND <ls_stop>-aggr_assgn_start_c IS NOT INITIAL AND <ls_stop>-aggr_assgn_end_c IS NOT INITIAL. READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = <ls_stop>-seq_num. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_end_c TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-aggr_assgn_end_c TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. IF <ls_stop>-aggr_assgn_start_c IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_c TIME ZONE lv_tz INTO DATE DATA(lv_conv_date1) TIME DATA(lv_conv_time1). ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_decoupling evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }| evt_er_exp_dtime = |0{ lv_conv_date1 }{ lv_conv_time1 }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name ) TO ct_expeventdata. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD unload_start. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-inbound AND <ls_stop>-aggr_assgn_start_l IS NOT INITIAL AND <ls_stop>-aggr_assgn_end_l IS NOT INITIAL. READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = <ls_stop>-seq_num. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_l TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_l TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_unload_start evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name ) TO ct_expeventdata. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD unload_end. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-inbound AND <ls_stop>-aggr_assgn_start_l IS NOT INITIAL AND <ls_stop>-aggr_assgn_end_l IS NOT INITIAL. READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = <ls_stop>-seq_num. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_l TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-aggr_assgn_start_l TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_unload_end evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name ) TO ct_expeventdata. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD shp_arrival. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-inbound AND <ls_stop>-plan_trans_time IS NOT INITIAL. READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = <ls_stop>-seq_num. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-plan_trans_time TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-plan_trans_time TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_shp_arrival evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name ) TO ct_expeventdata. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD shp_departure. DATA: ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr, lv_seq_num TYPE /scmtms/seq_num. LOOP AT it_stop USING KEY parent_seqnum ASSIGNING FIELD-SYMBOL(<ls_stop>). IF <ls_stop>-stop_cat = /scmtms/if_common_c=>c_stop_category-outbound. IF <ls_stop>-plan_trans_time IS NOT INITIAL. lv_seq_num = COND #( WHEN sy-tabix > 1 THEN <ls_stop>-seq_num - 1 ELSE <ls_stop>-seq_num ). READ TABLE it_stop_points REFERENCE INTO DATA(ls_stop_points) WITH KEY log_locid = <ls_stop>-log_locid seq_num = lv_seq_num. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. READ TABLE it_loc_addr REFERENCE INTO ls_loc_addr WITH KEY parent_node_id = <ls_stop>-log_loc_uuid BINARY SEARCH. IF sy-subrc IS INITIAL. IF ls_loc_addr->time_zone_code IS NOT INITIAL. CONVERT TIME STAMP <ls_stop>-plan_trans_time TIME ZONE ls_loc_addr->time_zone_code INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). DATA(lv_tz) = ls_loc_addr->time_zone_code. ELSE. CONVERT TIME STAMP <ls_stop>-plan_trans_time TIME ZONE sy-zonlo INTO DATE lv_conv_date TIME lv_conv_time. lv_tz = sy-zonlo. ENDIF. mv_milestonecnt += 1. APPEND VALUE #( appsys = mo_ef_parameters->get_appsys( ) appobjtype = mo_ef_parameters->get_app_obj_types( )-aotype language = sy-langu appobjid = is_app_objects-appobjid milestone = lif_sst_constants=>cs_milestone-fo_shp_departure evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }| evt_exp_tzone = lv_tz locid1 = <ls_stop>-log_locid locid2 = ls_stop_points->stop_id loctype = lif_sst_constants=>cs_location_type-logistic country = ls_loc_addr->country_code city = ls_loc_addr->city_name ) TO ct_expeventdata. ENDIF. ENDIF. ENDIF. ENDLOOP. ENDMETHOD. METHOD constructor. mo_ef_parameters = io_ef_parameters. mo_bo_reader = io_bo_reader. mv_milestonecnt = 0. ENDMETHOD. METHOD lif_pe_filler~check_relevance. rv_result = abap_false. ENDMETHOD. METHOD lif_pe_filler~get_planed_events. DATA: lv_tor_id TYPE /scmtms/tor_id, lv_tor_cat TYPE /scmtms/tor_category, lt_stop TYPE /scmtms/t_em_bo_tor_stop, lr_stop TYPE REF TO data, lr_loc_addr TYPE REF TO data, ls_loc_addr TYPE REF TO /scmtms/s_em_bo_loc_addr. FIELD-SYMBOLS: <lt_stop> TYPE /scmtms/t_em_bo_tor_stop, <lt_loc_addr> TYPE /scmtms/t_em_bo_loc_addr. lv_tor_id = lcl_tools=>get_field_of_structure( ir_struct_data = is_app_objects-maintabref iv_field_name = 'TOR_ID' ). SHIFT lv_tor_id LEFT DELETING LEADING '0'. lv_tor_cat = lcl_tools=>get_field_of_structure( ir_struct_data = is_app_objects-maintabref iv_field_name = 'TOR_CAT' ). DATA(lv_tor_node_id) = lcl_tools=>get_field_of_structure( ir_struct_data = is_app_objects-maintabref iv_field_name = 'NODE_ID' ). /scmtms/cl_tor_helper_stop=>get_stop_sequence( EXPORTING it_root_key = VALUE #( ( key = lv_tor_node_id ) ) iv_before_image = abap_false IMPORTING et_stop_seq_d = DATA(lt_stop_seq) ). MOVE-CORRESPONDING lt_stop_seq[ root_key = lv_tor_node_id ]-stop_seq TO lt_stop. ASSIGN lt_stop TO <lt_stop>. lr_loc_addr = mo_ef_parameters->get_appl_table( iv_tabledef = lif_sst_constants=>cs_tabledef-fo_stop_addr ). ASSIGN lr_loc_addr->* TO <lt_loc_addr>. IF sy-subrc <> 0. RETURN. ENDIF. lcl_tools=>get_stop_points( EXPORTING iv_root_id = lv_tor_id it_stop = lt_stop IMPORTING et_stop_points = DATA(lt_stop_points) ). load_start( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). load_end( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). unload_start( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). unload_end( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). shp_arrival( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). shp_departure( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). IF lv_tor_cat <> /scmtms/if_tor_const=>sc_tor_category-booking. coupling( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). decoupling( EXPORTING iv_tor_id = lv_tor_id it_stop = lt_stop it_loc_addr = <lt_loc_addr> it_stop_points = lt_stop_points is_app_objects = is_app_objects CHANGING ct_expeventdata = ct_expeventdata ). ENDIF. ENDMETHOD. ENDCLASS.
38.818182
106
0.589908
c8261e0d9e4755696beb1ac4e896a92a4a534c72
6,922
abap
ABAP
src/ui/zcl_abapgit_gui_page_codi_base.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
1
2019-05-27T18:50:14.000Z
2019-05-27T18:50:14.000Z
src/ui/zcl_abapgit_gui_page_codi_base.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_codi_base.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_codi_base DEFINITION PUBLIC ABSTRACT INHERITING FROM zcl_abapgit_gui_page. PUBLIC SECTION. METHODS: zif_abapgit_gui_event_handler~on_event REDEFINITION. PROTECTED SECTION. DATA mo_repo TYPE REF TO zcl_abapgit_repo . DATA mt_result TYPE scit_alvlist . METHODS render_result IMPORTING !io_html TYPE REF TO zcl_abapgit_html !it_result TYPE scit_alvlist . METHODS render_result_line IMPORTING !io_html TYPE REF TO zcl_abapgit_html !is_result TYPE scir_alvlist . METHODS build_nav_link IMPORTING !is_result TYPE scir_alvlist RETURNING VALUE(rv_link) TYPE string. METHODS jump IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !is_sub_item TYPE zif_abapgit_definitions=>ty_item !iv_line_number TYPE i RAISING zcx_abapgit_exception . PRIVATE SECTION. CONSTANTS c_object_separator TYPE char1 VALUE '|'. CONSTANTS c_ci_sig TYPE string VALUE 'cinav:'. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_CODI_BASE IMPLEMENTATION. METHOD build_nav_link. rv_link = |{ c_ci_sig }| && |{ is_result-objtype }{ is_result-objname }| && |{ c_object_separator }{ is_result-sobjtype }{ is_result-sobjname }| && |{ c_object_separator }{ is_result-line }|. ENDMETHOD. METHOD jump. DATA: lo_test TYPE REF TO cl_ci_test_root, ls_info TYPE scir_rest, lo_result TYPE REF TO cl_ci_result_root, lv_adt_jump_enabled TYPE abap_bool, lv_line_number TYPE i, ls_item TYPE zif_abapgit_definitions=>ty_item, ls_sub_item TYPE zif_abapgit_definitions=>ty_item. FIELD-SYMBOLS: <ls_result> TYPE scir_alvlist. IF is_sub_item IS NOT INITIAL. READ TABLE mt_result WITH KEY objtype = is_item-obj_type objname = is_item-obj_name sobjtype = is_sub_item-obj_type sobjname = is_sub_item-obj_name line = iv_line_number ASSIGNING <ls_result>. ELSE. READ TABLE mt_result WITH KEY objtype = is_item-obj_type objname = is_item-obj_name line = iv_line_number ASSIGNING <ls_result>. ENDIF. ASSERT <ls_result> IS ASSIGNED. ls_item-obj_name = <ls_result>-objname. ls_item-obj_type = <ls_result>-objtype. ls_sub_item-obj_name = <ls_result>-sobjname. ls_sub_item-obj_type = <ls_result>-sobjtype. " see SCI_LCL_DYNP_530 / HANDLE_DOUBLE_CLICK lv_adt_jump_enabled = zcl_abapgit_persist_settings=>get_instance( )->read( )->get_adt_jump_enabled( ). TRY. IF lv_adt_jump_enabled = abap_true. lv_line_number = <ls_result>-line. zcl_abapgit_objects_super=>jump_adt( iv_obj_name = ls_item-obj_name iv_obj_type = ls_item-obj_type iv_sub_obj_name = ls_sub_item-obj_name iv_sub_obj_type = ls_sub_item-obj_type iv_line_number = lv_line_number ). RETURN. ENDIF. CATCH zcx_abapgit_exception. ENDTRY. TRY. CALL METHOD ('CL_CI_TESTS')=>('GET_TEST_REF') EXPORTING p_test = <ls_result>-test RECEIVING p_result = lo_test. CATCH cx_root. zcx_abapgit_exception=>raise( |Jump to object not supported in your NW release| ). ENDTRY. lo_result = lo_test->get_result_node( <ls_result>-kind ). MOVE-CORRESPONDING <ls_result> TO ls_info. lo_result->set_info( ls_info ). lo_result->if_ci_test~navigate( ). ENDMETHOD. METHOD render_result. CONSTANTS: lc_limit TYPE i VALUE 500. FIELD-SYMBOLS: <ls_result> TYPE scir_alvlist. io_html->add( '<div class="ci-result">' ). LOOP AT it_result ASSIGNING <ls_result> TO lc_limit. render_result_line( io_html = io_html is_result = <ls_result> ). ENDLOOP. io_html->add( '</div>' ). IF lines( it_result ) > lc_limit. io_html->add( '<div class="dummydiv warning">' ). io_html->add( zcl_abapgit_html=>icon( 'exclamation-triangle' ) ). io_html->add( |Only first { lc_limit } findings shown in list!| ). io_html->add( '</div>' ). ENDIF. ENDMETHOD. METHOD render_result_line. DATA: lv_class TYPE string, lv_obj_txt TYPE string, lv_msg TYPE string. CASE is_result-kind. WHEN 'E'. lv_class = 'ci-error'. WHEN 'W'. lv_class = 'ci-warning'. WHEN OTHERS. lv_class = 'ci-info'. ENDCASE. lv_msg = escape( val = is_result-text format = cl_abap_format=>e_html_attr ). IF is_result-sobjname IS INITIAL OR ( is_result-sobjname = is_result-objname AND is_result-sobjtype = is_result-sobjtype ). lv_obj_txt = |{ is_result-objtype } { is_result-objname }|. ELSE. lv_obj_txt = |{ is_result-objtype } { is_result-objname } &gt; { is_result-sobjtype } { is_result-sobjname }|. ENDIF. lv_obj_txt = |{ lv_obj_txt } [ @{ zcl_abapgit_convert=>alpha_output( is_result-line ) } ]|. io_html->add( |<li class="{ lv_class }">| ). io_html->add_a( iv_txt = lv_obj_txt iv_act = build_nav_link( is_result ) iv_typ = zif_abapgit_html=>c_action_type-sapevent ). io_html->add( |<span>{ lv_msg }</span>| ). io_html->add( '</li>' ). ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA: ls_item TYPE zif_abapgit_definitions=>ty_item, ls_sub_item TYPE zif_abapgit_definitions=>ty_item, lv_temp TYPE string, lv_main_object TYPE string, lv_sub_object TYPE string, lv_line_number_s TYPE string, lv_line_number TYPE i. lv_temp = iv_action. SHIFT lv_temp LEFT DELETING LEADING c_ci_sig. IF lv_temp <> iv_action. " CI navigation request detected SPLIT lv_temp AT c_object_separator INTO lv_main_object lv_sub_object lv_line_number_s. ls_item-obj_type = lv_main_object(4). ls_item-obj_name = lv_main_object+4(*). IF lv_sub_object IS NOT INITIAL. ls_sub_item-obj_type = lv_sub_object(4). ls_sub_item-obj_name = lv_sub_object+4(*). ENDIF. lv_line_number = lv_line_number_s. jump( is_item = ls_item is_sub_item = ls_sub_item iv_line_number = lv_line_number ). ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDIF. ENDMETHOD. ENDCLASS.
31.040359
116
0.614996
c82b507d0ed538ec70770beee8ac48de45bcb489
124,563
abap
ABAP
src/zcl_abap_behv_test_trans_bufr5.clas.abap
shubhamWaghmare-sap/BO_TDF_V2
ed0f75c9ec899b4507f12cbab019b1c4d8b2bc8a
[ "MIT" ]
null
null
null
src/zcl_abap_behv_test_trans_bufr5.clas.abap
shubhamWaghmare-sap/BO_TDF_V2
ed0f75c9ec899b4507f12cbab019b1c4d8b2bc8a
[ "MIT" ]
null
null
null
src/zcl_abap_behv_test_trans_bufr5.clas.abap
shubhamWaghmare-sap/BO_TDF_V2
ed0f75c9ec899b4507f12cbab019b1c4d8b2bc8a
[ "MIT" ]
null
null
null
class zcl_abap_behv_test_trans_bufr5 definition public final create private. public section. interfaces zif_abap_behv_test_trans_bufr5. class-methods: "! <p class="shorttext synchronized" lang="en">Get the transactional buffer instance</p> get_instance returning value(double_transactional_buffer) type ref to zif_abap_behv_test_trans_bufr5. protected section. private section. "Structure to hold bdef load attributes types: begin of ty_modify_response_config, operation type abp_behv_op_modify, mapped type ref to data, reported type ref to data, failed type ref to data, end of ty_modify_response_config. types: begin of ty_read_response_config, operation type if_abap_behv=>t_char01, result type ref to data, reported type ref to data, failed type ref to data, end of ty_read_response_config. types: begin of t_bdef_load, head type cl_abap_behv_load=>t_head, entities type cl_abap_behv_load=>tt_entity, features type cl_abap_behv_load=>tt_feature, actions type cl_abap_behv_load=>tt_action, relations type cl_abap_behv_load=>tt_relat, associations type cl_abap_behv_load=>tt_assoc, end of t_bdef_load . types: begin of ty_double_transactional_buffer, entity_root type abp_root_entity_name, entity_name type abp_entity_name, entity_alias type abp_entity_name, entity_instances type ref to data, reported type ref to data, failed type ref to data, modify_response_config type standard table of ty_modify_response_config with non-unique default key, read_response_config type standard table of ty_read_response_config with non-unique default key, end of ty_double_transactional_buffer. class-data: "! <p class="shorttext synchronized" lang="en">Transactional buffer double singleton instance</p> double_transactional_buffer type ref to zif_abap_behv_test_trans_bufr5. data: "! <p class="shorttext synchronized" lang="en">Transactional buffer double</p> dbl_transactional_buffer_table type standard table of ty_double_transactional_buffer with key entity_name. " TODO : should we have a sorted table on entity name for binary search, or provide hashing to improve the search constants: begin of ty_op_category, modify type if_abap_behv=>t_char01 value 'm', read type if_abap_behv=>t_char01 value 'r', end of ty_op_category. constants: c_message_class type symsgid value 'ZBO_MOCKING_MESSAGE'. methods: check_instance_equal importing instance_1 type any instance_2 type any entity_fields type ddfields returning value(equal) type abap_bool, check_instance_exists importing instance_to_check type any entity_instances type any table entity_fields type ddfields returning value(exists) type abap_bool, get_entity_fields importing entity_name type abp_entity_name returning value(entity_fields) type ddfields, deep_clone importing data_to_be_cloned type any exporting reference_to_cloned_data type ref to data, format_res_as_per_cntrl_flds importing control_fields type any entity_fields type ddfields changing entity_instance type any, fill_read_reported_and_failed importing i_entity_fields type ddfields alias_name type abp_entity_name message_number type symsgno retrieval type abp_behv_retrievals changing c_failed type data c_reported type data cs_retrieval_instance type any, fill_modify_reported_n_failed importing i_entity_fields type ddfields alias_name type abp_entity_name message_number type symsgno change type abp_behv_changes changing c_failed type data c_reported type data cs_change_instance type any, fill_modify_mapped importing i_entity_fields type ddfields alias_name type abp_entity_name message_number type symsgno change type abp_behv_changes changing c_mapped type data cs_change_instance type any, _create importing change type abp_behv_changes bdef_load type t_bdef_load changing failed type data mapped type data reported type data, _delete importing change type abp_behv_changes bdef_load type t_bdef_load changing failed type data mapped type data reported type data, cascade_delete importing instance type any associations type cl_abap_behv_load=>tt_assoc entity type abp_entity_name, _update importing change type abp_behv_changes bdef_load type t_bdef_load changing failed type data mapped type data reported type data, _create_by_assoc importing change type abp_behv_changes bdef_load type t_bdef_load changing failed type data mapped type data reported type data, _read importing retrieval type abp_behv_retrievals bdef_load type t_bdef_load changing failed type data reported type data, _read_by_assoc importing retrieval type abp_behv_retrievals bdef_load type t_bdef_load changing failed type data reported type data, find_reported_if_configured importing entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_reported type data returning value(result) type abap_bool, find_reported_config_for_read importing entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_reported type data returning value(result) type abap_bool, find_reported_config_for_rba importing parent_entity type cl_abap_behv_load=>t_entity entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_reported type data returning value(result) type abap_bool, find_failed_if_configured importing entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_failed type data returning value(result) type abap_bool, find_failed_config_for_read importing entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_failed type data returning value(result) type abap_bool, find_failed_config_for_rba importing parent_entity type cl_abap_behv_load=>t_entity entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_failed type data returning value(result) type abap_bool, find_result_config_for_read importing entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_result type standard table returning value(result) type abap_bool, find_result_config_for_rba importing parent_entity type cl_abap_behv_load=>t_entity entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_result type standard table returning value(result) type abap_bool, find_mapped_if_configured importing entity type cl_abap_behv_load=>t_entity instance_to_check type any operation type if_abap_behv=>t_char01 changing buffer_4_entity type ty_double_transactional_buffer c_mapped type data returning value(result) type abap_bool . methods : configure_mapped importing entity type cl_abap_behv_load=>t_entity operation type if_abap_behv=>t_char01 mapped type data. methods : configure_reported importing entity type cl_abap_behv_load=>t_entity operation type if_abap_behv=>t_char01 reported type data. methods : configure_failed_for_modify importing entity type cl_abap_behv_load=>t_entity operation type if_abap_behv=>t_char01 failed type data. methods : configure_result_for_read importing entity type cl_abap_behv_load=>t_entity operation type if_abap_behv=>t_char01 result type standard table. methods : configure_reported_for_read importing entity type cl_abap_behv_load=>t_entity operation type if_abap_behv=>t_char01 reported type data. methods : configure_failed_for_read importing entity type cl_abap_behv_load=>t_entity operation type if_abap_behv=>t_char01 failed type data. methods : configure_failed importing entity type cl_abap_behv_load=>t_entity operation_category type if_abap_behv=>t_char01 operation type if_abap_behv=>t_char01 failed type data. methods : get_entity_alias importing entity type cl_abap_behv_load=>t_entity returning value(alias) type string. endclass. class zcl_abap_behv_test_trans_bufr5 implementation. method get_instance. if zcl_abap_behv_test_trans_bufr5=>double_transactional_buffer is initial. zcl_abap_behv_test_trans_bufr5=>double_transactional_buffer = new zcl_abap_behv_test_trans_bufr5( ). endif. double_transactional_buffer = zcl_abap_behv_test_trans_bufr5=>double_transactional_buffer. endmethod. method zif_abap_behv_test_trans_bufr5~read. data bdef_load type t_bdef_load. field-symbols <fs_retrieval> type abp_behv_retrievals. cl_abap_behv_load=>get_load( exporting entity = root_name all = abap_true importing head = bdef_load-head entities = bdef_load-entities features = bdef_load-features actions = bdef_load-actions relations = bdef_load-relations associations = bdef_load-associations ). loop at retrievals assigning <fs_retrieval>. case <fs_retrieval>-op. when if_abap_behv=>op-r-read. _read( exporting retrieval = <fs_retrieval> bdef_load = bdef_load changing failed = failed reported = reported ). when if_abap_behv=>op-r-read_ba. _read_by_assoc( exporting retrieval = <fs_retrieval> bdef_load = bdef_load changing failed = failed reported = reported ). endcase. endloop. endmethod. method zif_abap_behv_test_trans_bufr5~modify. " steps " loop through each entity in the changes " check whether a buffer entry is present in the transactional buffer or not for the entity " if buffer entry is not present, first create a new buffer entry for the entity " If operation is CREATE " loop through instances of entity to be created from the change " for each instance to create, check whether the buffer entry for the entity already has an entry with same keys " if entry is already present fill the failed and reported structure " if instance is not present add the instance to the buffer entry and fill the mapped structure " if operation is UPDATE " check whether the buffer contains an entry with the same primary keys, if present update the instance and fill mapped " if not available, fill failed and reported " if operation is DELETE " check whether the buffer contains an entry with the same primary keys, if present delete the instance " if not available, fill failed and reported data bdef_load type t_bdef_load. cl_abap_behv_load=>get_load( exporting entity = root_name all = abap_true importing head = bdef_load-head entities = bdef_load-entities features = bdef_load-features actions = bdef_load-actions relations = bdef_load-relations associations = bdef_load-associations ). loop at changes assigning field-symbol(<fs_change>). case <fs_change>-op. when if_abap_behv=>op-m-create. _create( exporting change = <fs_change> bdef_load = bdef_load changing failed = failed mapped = mapped reported = reported ). when if_abap_behv=>op-m-update. _update( exporting change = <fs_change> bdef_load = bdef_load changing failed = failed mapped = mapped reported = reported ). when if_abap_behv=>op-m-delete. _delete( exporting change = <fs_change> bdef_load = bdef_load changing failed = failed mapped = mapped reported = reported ). when if_abap_behv=>op-m-create_ba. _create_by_assoc( exporting change = <fs_change> bdef_load = bdef_load changing failed = failed mapped = mapped reported = reported ). endcase. endloop. endmethod. method check_instance_equal. data entity_field type dfies. field-symbols <instance_1_field> type any. field-symbols <instance_2_field> type any. loop at entity_fields into entity_field where keyflag = abap_true. assign component entity_field-fieldname of structure instance_1 to <instance_1_field>. assign component entity_field-fieldname of structure instance_2 to <instance_2_field>. if <instance_1_field> <> <instance_2_field>. " entity does not match equal = abap_false. return. endif. endloop. equal = abap_true. return. endmethod. method check_instance_exists. field-symbols <entity_instance> type any. loop at entity_instances assigning <entity_instance>. data(equal) = check_instance_equal( instance_1 = instance_to_check instance_2 = <entity_instance> entity_fields = entity_fields ). if equal = abap_true. exists = abap_true. return. endif. endloop. exists = abap_false. endmethod. method get_entity_fields. data struct_descr type ref to cl_abap_structdescr. struct_descr ?= cl_abap_typedescr=>describe_by_name( entity_name ). entity_fields = struct_descr->get_ddic_field_list( ). endmethod. method deep_clone. field-symbols <fs_clone> type any. create data reference_to_cloned_data like data_to_be_cloned. assign reference_to_cloned_data->* to <fs_clone>. <fs_clone> = data_to_be_cloned. endmethod. method format_res_as_per_cntrl_flds. data entity_field type dfies. field-symbols <fs_control_field_value> type any. field-symbols <fs_data_to_be_removed> type any. loop at entity_fields into entity_field where fieldname <> '.NODE1' and keyflag = abap_false. assign component entity_field-fieldname of structure control_fields to <fs_control_field_value>. if <fs_control_field_value> = if_abap_behv=>mk-off. " clear data assign component entity_field-fieldname of structure entity_instance to <fs_data_to_be_removed>. clear <fs_data_to_be_removed>. endif. endloop. endmethod. method fill_read_reported_and_failed. field-symbols <fs_entry_failed_table> type standard table. field-symbols <fs_entry_reported_table> type standard table. assign component alias_name of structure c_failed to <fs_entry_failed_table>. data entry_failed type ref to data. create data entry_failed like line of <fs_entry_failed_table>. assign entry_failed->* to field-symbol(<fs_entry_failed>). "Assign key fields loop at i_entity_fields into data(entity_field) where keyflag = abap_true. assign component entity_field-fieldname of structure cs_retrieval_instance to field-symbol(<fs_val_1>). assign component entity_field-fieldname of structure <fs_entry_failed> to field-symbol(<fs_val_2>). <fs_val_2> = <fs_val_1>. endloop. "Assign fail reason assign component cl_abap_behv=>co_techfield_name-fail of structure <fs_entry_failed> to field-symbol(<fail>). assign component 'CAUSE' of structure <fail> to field-symbol(<fail_reason>). <fail_reason> = if_abap_behv=>cause-not_found. "Assign Association if read by association operation. if retrieval-op eq if_abap_behv=>op-r-read_ba. assign component cl_abap_behv=>co_techfield_name-assoc of structure <fs_entry_failed> to field-symbol(<assoc>). assign component retrieval-sub_name of structure <assoc> to field-symbol(<assoc_subname>). <assoc_subname> = '01'. endif. append <fs_entry_failed> to <fs_entry_failed_table>. "Fill reported assign component alias_name of structure c_reported to <fs_entry_reported_table>. data entry_reported type ref to data. create data entry_reported like line of <fs_entry_reported_table>. assign entry_reported->* to field-symbol(<fs_entry_reported>). "Assign key fields loop at i_entity_fields into entity_field where keyflag = abap_true. assign component entity_field-fieldname of structure cs_retrieval_instance to <fs_val_1>. assign component entity_field-fieldname of structure <fs_entry_reported> to <fs_val_2>. <fs_val_2> = <fs_val_1>. endloop. "Assign exception message instance data(lo_message) = new lcl_exception_handler( )->new_message( id = c_message_class number = message_number severity = if_abap_behv_message=>severity-error ). field-symbols:<fs_message_obj> type ref to if_abap_behv_message. field-symbols:<fs_message_obj2> type ref to if_abap_behv_message. assign component cl_abap_behv=>co_techfield_name-msg of structure <fs_entry_reported> to <fs_message_obj2>. assign lo_message to <fs_message_obj>. <fs_message_obj2> = <fs_message_obj>. append <fs_entry_reported> to <fs_entry_reported_table>. endmethod. method fill_modify_reported_n_failed. field-symbols <fs_entry_failed_table> type standard table. field-symbols <fs_entry_reported_table> type standard table. assign component alias_name of structure c_failed to <fs_entry_failed_table>. data entry_failed type ref to data. create data entry_failed like line of <fs_entry_failed_table>. assign entry_failed->* to field-symbol(<fs_entry_failed>). "Assign key fields loop at i_entity_fields into data(entity_field) where keyflag = abap_true. assign component entity_field-fieldname of structure cs_change_instance to field-symbol(<fs_val_1>). assign component entity_field-fieldname of structure <fs_entry_failed> to field-symbol(<fs_val_2>). <fs_val_2> = <fs_val_1>. endloop. "Assign fail reason assign component cl_abap_behv=>co_techfield_name-fail of structure <fs_entry_failed> to field-symbol(<fail>). assign component 'CAUSE' of structure <fail> to field-symbol(<fail_reason>). " Make operation specific additions to failed case change-op. when if_abap_behv=>op-m-create. <fail_reason> = if_abap_behv=>cause-unspecific. assign component cl_abap_behv=>co_techfield_name-create of structure <fs_entry_failed> to field-symbol(<create>). <create> = '01'. when if_abap_behv=>op-m-create_ba. <fail_reason> = if_abap_behv=>cause-unspecific. assign component cl_abap_behv=>co_techfield_name-create of structure <fs_entry_failed> to <create>. <create> = '01'. when if_abap_behv=>op-m-update. <fail_reason> = if_abap_behv=>cause-not_found. assign component cl_abap_behv=>co_techfield_name-update of structure <fs_entry_failed> to field-symbol(<update>). <update> = '01'. when if_abap_behv=>op-m-delete. <fail_reason> = if_abap_behv=>cause-not_found. assign component cl_abap_behv=>co_techfield_name-delete of structure <fs_entry_failed> to field-symbol(<delete>). <delete> = '01'. endcase. append <fs_entry_failed> to <fs_entry_failed_table>. "Fill reported assign component alias_name of structure c_reported to <fs_entry_reported_table>. data entry_reported type ref to data. create data entry_reported like line of <fs_entry_reported_table>. assign entry_reported->* to field-symbol(<fs_entry_reported>). "Assign key fields loop at i_entity_fields into entity_field where keyflag = abap_true. assign component entity_field-fieldname of structure cs_change_instance to <fs_val_1>. assign component entity_field-fieldname of structure <fs_entry_reported> to <fs_val_2>. <fs_val_2> = <fs_val_1>. endloop. "Assign exception message instance data(lo_message) = new lcl_exception_handler( )->new_message( id = c_message_class number = message_number severity = if_abap_behv_message=>severity-error ). field-symbols:<fs_message_obj> type ref to if_abap_behv_message. field-symbols:<fs_message_obj2> type ref to if_abap_behv_message. assign component cl_abap_behv=>co_techfield_name-msg of structure <fs_entry_reported> to <fs_message_obj2>. assign lo_message to <fs_message_obj>. <fs_message_obj2> = <fs_message_obj>. append <fs_entry_reported> to <fs_entry_reported_table>. endmethod. method fill_modify_mapped. field-symbols <fs_entry_mapped_table> type standard table. assign component alias_name of structure c_mapped to <fs_entry_mapped_table>. data entry_mapped type ref to data. create data entry_mapped like line of <fs_entry_mapped_table>. assign entry_mapped->* to field-symbol(<fs_entry_mapped>). move-corresponding cs_change_instance to <fs_entry_mapped>. "Assign key fields loop at i_entity_fields into data(entity_field) where keyflag = abap_true. assign component entity_field-fieldname of structure cs_change_instance to field-symbol(<fs_val_1>). assign component entity_field-fieldname of structure <fs_entry_mapped> to field-symbol(<fs_val_2>). <fs_val_2> = <fs_val_1>. endloop. append <fs_entry_mapped> to <fs_entry_mapped_table>. endmethod. method cascade_delete. data buffer_4_assoc_entity type ty_double_transactional_buffer. data buffer_4_entity type ty_double_transactional_buffer. data entity_buffer_instance type ref to data. data(entity_fields) = get_entity_fields( entity ). read table associations into data(association) with key source_entity = entity. if sy-subrc eq 0. data(associated_entity) = association-target_entity. endif. if associated_entity is not initial. if line_exists( dbl_transactional_buffer_table[ entity_name = associated_entity ] ). buffer_4_assoc_entity = dbl_transactional_buffer_table[ entity_name = associated_entity ]. endif. if buffer_4_assoc_entity is not initial. field-symbols <assoc_entity_buff_instances> type standard table. assign buffer_4_assoc_entity-entity_instances->* to <assoc_entity_buff_instances>. if <assoc_entity_buff_instances> is assigned. loop at <assoc_entity_buff_instances> assigning field-symbol(<assoc_entity_buffer_instance>). "check if the instance is associated with the input entity instance data(equal) = check_instance_equal( exporting instance_1 = <assoc_entity_buffer_instance> instance_2 = instance entity_fields = entity_fields " here we are passing the entity fields of parent entity and not associated entity because " the read happens only based on the key value of parent and not associated entity ). if equal eq abap_true. cascade_delete( associations = associations entity = associated_entity instance = <assoc_entity_buffer_instance> ). endif. endloop. endif. endif. endif. "delete the instance if line_exists( dbl_transactional_buffer_table[ entity_name = entity ] ). buffer_4_entity = dbl_transactional_buffer_table[ entity_name = entity ]. if buffer_4_entity is not initial. field-symbols <instances_4_entity_in_buffer> type standard table. assign buffer_4_entity-entity_instances->* to <instances_4_entity_in_buffer>. " TODO: Check if an assignment check is required. loop at <instances_4_entity_in_buffer> assigning field-symbol(<instance>). "look for a matching instance to be deleted equal = check_instance_equal( exporting instance_1 = <instance> instance_2 = instance entity_fields = entity_fields ). if equal eq abap_true. delete <instances_4_entity_in_buffer>. exit. endif. endloop. endif. endif. endmethod. method _create_by_assoc. data buffer_4_entity type ty_double_transactional_buffer. data entity_buffer_instance type ref to data. data struct_descr_4_entity type ref to cl_abap_structdescr. data entity_fields type ddfields. field-symbols <instances_4_entity_in_buffer> type standard table. field-symbols <input_entity_instances> type standard table. field-symbols <input_entity_instance> type any. field-symbols <entity_buffer_instance> type any. if line_exists( dbl_transactional_buffer_table[ entity_name = change-entity_name ] ). buffer_4_entity = dbl_transactional_buffer_table[ entity_name = change-entity_name ]. endif. if buffer_4_entity is initial. " no buffer entry present for the entity buffer_4_entity-entity_name = change-entity_name. buffer_4_entity-entity_instances = cl_abap_behvdescr=>create_data( p_name = change-entity_name p_op = if_abap_behv=>op-r-read "TODO : Should it be modify/read? p_kind = if_abap_behv=>typekind-result ). append buffer_4_entity to dbl_transactional_buffer_table. endif. struct_descr_4_entity ?= cl_abap_typedescr=>describe_by_name( change-entity_name ). entity_fields = struct_descr_4_entity->get_ddic_field_list( ). data(entity_details) = bdef_load-entities[ name = change-entity_name ]. data(alias) = entity_details-alias. alias = to_upper( alias ). if alias is not initial. buffer_4_entity-entity_alias = alias. else. buffer_4_entity-entity_alias = change-entity_name. endif. "Won't be filled in all the use cases. assign buffer_4_entity-entity_instances->* to <instances_4_entity_in_buffer>. assign change-instances->* to <input_entity_instances>. loop at <input_entity_instances> assigning <input_entity_instance>. "check whether the entity instance is already present in the buffer data(instance_exists_in_buffer) = check_instance_exists( exporting instance_to_check = <input_entity_instance> entity_instances = <instances_4_entity_in_buffer> entity_fields = entity_fields ). data buffer_4_assoc_entity type ty_double_transactional_buffer. data struct_descr_assoc_entity type ref to cl_abap_structdescr. data entity_fields_of_assoc_entity type ddfields. field-symbols <input_assoc_entity_instances> type standard table. field-symbols <input_assoc_entity_instance> type any. data(association) = bdef_load-associations[ source_entity = change-entity_name ]. data(associated_entity) = association-target_entity. struct_descr_assoc_entity ?= cl_abap_typedescr=>describe_by_name( associated_entity ). entity_fields_of_assoc_entity = struct_descr_assoc_entity->get_ddic_field_list( ). assign component cl_abap_behv=>co_techfield_name-target of structure <input_entity_instance> to <input_assoc_entity_instances>. loop at <input_assoc_entity_instances> assigning <input_assoc_entity_instance>. move-corresponding <input_entity_instance> to <input_assoc_entity_instance>. " make sure the foreign key values are filled in the associated entity instance loop at bdef_load-relations[ source_entity = associated_entity ]-foreignkeys into data(key). assign component key-local_name of structure <input_entity_instance> to field-symbol(<fs_val_1>). assign component key-local_name of structure <input_assoc_entity_instance> to field-symbol(<fs_val_2>). <fs_val_2> = <fs_val_1>. endloop. " Check if buffer entry exists for the associated entity if line_exists( dbl_transactional_buffer_table[ entity_name = associated_entity ] ). buffer_4_assoc_entity = dbl_transactional_buffer_table[ entity_name = associated_entity ]. endif. if buffer_4_assoc_entity is initial. " no buffer entry present for the associated entity buffer_4_assoc_entity-entity_name = associated_entity. buffer_4_assoc_entity-entity_instances = cl_abap_behvdescr=>create_data( p_name = associated_entity p_op = if_abap_behv=>op-r-read p_kind = if_abap_behv=>typekind-result ). append buffer_4_assoc_entity to dbl_transactional_buffer_table. endif. " evaluate the alias name for associated entity data(assoc_entity_details) = bdef_load-entities[ name = associated_entity ]. data(assoc_entity_alias) = assoc_entity_details-alias. assoc_entity_alias = to_upper( assoc_entity_alias ). if assoc_entity_alias is not initial. buffer_4_assoc_entity-entity_alias = assoc_entity_alias. else. assoc_entity_alias = associated_entity. buffer_4_assoc_entity-entity_alias = associated_entity. endif. "Won't be filled in all the use cases. " if the parent entity instance itself doesn't exist " fill mapped and reported. No further processing required if instance_exists_in_buffer = abap_false. " fill failed and reported fill_modify_reported_n_failed( exporting i_entity_fields = entity_fields_of_assoc_entity alias_name = assoc_entity_alias message_number = 001 change = change changing c_failed = failed c_reported = reported cs_change_instance = <input_assoc_entity_instance> ). continue. endif. field-symbols <assoc_entity_buff_instances> type standard table. assign buffer_4_assoc_entity-entity_instances->* to <assoc_entity_buff_instances>. "check whether the associated entity instance is already present in the buffer data(assoc_instance_exists_in_buff) = check_instance_exists( exporting instance_to_check = <input_assoc_entity_instance> entity_instances = <assoc_entity_buff_instances> entity_fields = entity_fields_of_assoc_entity ). if assoc_instance_exists_in_buff = abap_true. data(failed_configured) = find_failed_if_configured( exporting entity = assoc_entity_details instance_to_check = <input_assoc_entity_instance> operation = if_abap_behv=>op-m-create_ba changing buffer_4_entity = buffer_4_assoc_entity c_failed = failed ). data(reported_configured) = find_reported_if_configured( exporting entity = assoc_entity_details instance_to_check = <input_assoc_entity_instance> operation = if_abap_behv=>op-m-create_ba changing buffer_4_entity = buffer_4_assoc_entity c_reported = reported ). data(mapped_configured) = find_mapped_if_configured( exporting entity = assoc_entity_details instance_to_check = <input_assoc_entity_instance> operation = if_abap_behv=>op-m-create_ba changing buffer_4_entity = buffer_4_assoc_entity c_mapped = mapped ). " fill failed and reported if reported_configured eq abap_false and mapped_configured eq abap_false and failed_configured eq abap_false. " fill failed and reported fill_modify_reported_n_failed( exporting i_entity_fields = entity_fields_of_assoc_entity alias_name = assoc_entity_alias message_number = 001 change = change changing c_failed = failed c_reported = reported cs_change_instance = <input_assoc_entity_instance> ). endif. else. data assoc_entity_buffer_instance type ref to data. field-symbols <assoc_entity_buffer_instance> type any. create data assoc_entity_buffer_instance like line of <assoc_entity_buff_instances>. assign assoc_entity_buffer_instance->* to <assoc_entity_buffer_instance>. <assoc_entity_buffer_instance> = corresponding #( <input_assoc_entity_instance> ). append <assoc_entity_buffer_instance> to <assoc_entity_buff_instances>. " Fill mapped table fill_modify_mapped( exporting alias_name = assoc_entity_alias i_entity_fields = entity_fields_of_assoc_entity message_number = '001' change = change changing c_mapped = mapped cs_change_instance = <assoc_entity_buffer_instance> ). endif. endloop. endloop. endmethod. method _create. data buffer_4_entity type ty_double_transactional_buffer. data entity_buffer_instance type ref to data. data struct_descr_4_entity type ref to cl_abap_structdescr. data entity_fields type ddfields. field-symbols <instances_4_entity_in_buffer> type standard table. field-symbols <input_entity_instances> type standard table. field-symbols <input_entity_instance> type any. field-symbols <entity_buffer_instance> type any. if line_exists( dbl_transactional_buffer_table[ entity_name = change-entity_name ] ). buffer_4_entity = dbl_transactional_buffer_table[ entity_name = change-entity_name ]. endif. if buffer_4_entity is initial. " no buffer entry present for the entity buffer_4_entity-entity_name = change-entity_name. buffer_4_entity-entity_instances = cl_abap_behvdescr=>create_data( p_name = change-entity_name p_op = if_abap_behv=>op-r-read "TODO : Should it be modify/read? p_kind = if_abap_behv=>typekind-result ). append buffer_4_entity to dbl_transactional_buffer_table. endif. struct_descr_4_entity ?= cl_abap_typedescr=>describe_by_name( change-entity_name ). entity_fields = struct_descr_4_entity->get_ddic_field_list( ). data(entity_details) = bdef_load-entities[ name = change-entity_name ]. data(alias) = entity_details-alias. alias = to_upper( alias ). if alias is not initial. buffer_4_entity-entity_alias = alias. else. buffer_4_entity-entity_alias = change-entity_name. endif. "Won't be filled in all the use cases. assign buffer_4_entity-entity_instances->* to <instances_4_entity_in_buffer>. assign change-instances->* to <input_entity_instances>. loop at <input_entity_instances> assigning <input_entity_instance>. "check whether the entity instance is already present in the buffer data(instance_exists_in_buffer) = check_instance_exists( exporting instance_to_check = <input_entity_instance> entity_instances = <instances_4_entity_in_buffer> entity_fields = entity_fields ). if instance_exists_in_buffer = abap_true. data(failed_configured) = find_failed_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-create changing buffer_4_entity = buffer_4_entity c_failed = failed ). data(reported_configured) = find_reported_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-create changing buffer_4_entity = buffer_4_entity c_reported = reported ). data(mapped_configured) = find_mapped_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-create changing buffer_4_entity = buffer_4_entity c_mapped = mapped ). " fill failed and reported if reported_configured eq abap_false and mapped_configured eq abap_false and failed_configured eq abap_false. fill_modify_reported_n_failed( exporting i_entity_fields = entity_fields alias_name = alias message_number = 001 change = change changing c_failed = failed c_reported = reported cs_change_instance = <input_entity_instance> ). endif. else. " Create instance create data entity_buffer_instance like line of <instances_4_entity_in_buffer>. assign entity_buffer_instance->* to <entity_buffer_instance>. <entity_buffer_instance> = corresponding #( <input_entity_instance> ). append <entity_buffer_instance> to <instances_4_entity_in_buffer>. " Fill mapped table fill_modify_mapped( exporting alias_name = alias i_entity_fields = entity_fields message_number = '001' change = change changing c_mapped = mapped cs_change_instance = <input_entity_instance> ). endif. endloop. endmethod. method _delete. data buffer_4_entity type ty_double_transactional_buffer. data entity_buffer_instance type ref to data. data struct_descr_4_entity type ref to cl_abap_structdescr. data entity_fields type ddfields. field-symbols <instances_4_entity_in_buffer> type standard table. field-symbols <input_entity_instances> type standard table. field-symbols <input_entity_instance> type any. field-symbols <entity_buffer_instance> type any. if line_exists( dbl_transactional_buffer_table[ entity_name = change-entity_name ] ). buffer_4_entity = dbl_transactional_buffer_table[ entity_name = change-entity_name ]. endif. if buffer_4_entity is initial. " no buffer entry present for the entity buffer_4_entity-entity_name = change-entity_name. buffer_4_entity-entity_instances = cl_abap_behvdescr=>create_data( p_name = change-entity_name p_op = if_abap_behv=>op-r-read "TODO : Should it be modify/read? p_kind = if_abap_behv=>typekind-result ). append buffer_4_entity to dbl_transactional_buffer_table. endif. struct_descr_4_entity ?= cl_abap_typedescr=>describe_by_name( change-entity_name ). entity_fields = struct_descr_4_entity->get_ddic_field_list( ). data(entity_details) = bdef_load-entities[ name = change-entity_name ]. data(alias) = entity_details-alias. alias = to_upper( alias ). if alias is not initial. buffer_4_entity-entity_alias = alias. else. buffer_4_entity-entity_alias = change-entity_name. endif. "Won't be filled in all the use cases. assign buffer_4_entity-entity_instances->* to <instances_4_entity_in_buffer>. assign change-instances->* to <input_entity_instances>. loop at <input_entity_instances> assigning <input_entity_instance>. "check whether the entity instance is already present in the buffer data(instance_exists_in_buffer) = check_instance_exists( exporting instance_to_check = <input_entity_instance> entity_instances = <instances_4_entity_in_buffer> entity_fields = entity_fields ). if instance_exists_in_buffer = abap_false. " fill failed and reported fill_modify_reported_n_failed( exporting i_entity_fields = entity_fields alias_name = alias message_number = 001 change = change changing c_failed = failed c_reported = reported cs_change_instance = <input_entity_instance> ). else. data(failed_configured) = find_failed_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-delete changing buffer_4_entity = buffer_4_entity c_failed = failed ). data(reported_configured) = find_reported_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-delete changing buffer_4_entity = buffer_4_entity c_reported = reported ). data(mapped_configured) = find_mapped_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-delete changing buffer_4_entity = buffer_4_entity c_mapped = mapped ). if reported_configured eq abap_false and mapped_configured eq abap_false and failed_configured eq abap_false. "delete the instance, along with all the associated instances cascade_delete( associations = bdef_load-associations entity = change-entity_name instance = <input_entity_instance> ). endif. "no mapped in this case. endif. endloop. endmethod. method _update. data buffer_4_entity type ty_double_transactional_buffer. data entity_buffer_instance type ref to data. data struct_descr_4_entity type ref to cl_abap_structdescr. data entity_fields type ddfields. field-symbols <instances_4_entity_in_buffer> type standard table. field-symbols <input_entity_instances> type standard table. field-symbols <input_entity_instance> type any. field-symbols <entity_buffer_instance> type any. if line_exists( dbl_transactional_buffer_table[ entity_name = change-entity_name ] ). buffer_4_entity = dbl_transactional_buffer_table[ entity_name = change-entity_name ]. endif. if buffer_4_entity is initial. " no buffer entry present for the entity buffer_4_entity-entity_name = change-entity_name. buffer_4_entity-entity_instances = cl_abap_behvdescr=>create_data( p_name = change-entity_name p_op = if_abap_behv=>op-r-read "TODO : Should it be modify/read? p_kind = if_abap_behv=>typekind-result ). append buffer_4_entity to dbl_transactional_buffer_table. endif. struct_descr_4_entity ?= cl_abap_typedescr=>describe_by_name( change-entity_name ). entity_fields = struct_descr_4_entity->get_ddic_field_list( ). data(entity_details) = bdef_load-entities[ name = change-entity_name ]. data(alias) = entity_details-alias. alias = to_upper( alias ). if alias is not initial. buffer_4_entity-entity_alias = alias. else. buffer_4_entity-entity_alias = change-entity_name. endif. "Won't be filled in all the use cases. assign buffer_4_entity-entity_instances->* to <instances_4_entity_in_buffer>. assign change-instances->* to <input_entity_instances>. loop at <input_entity_instances> assigning <input_entity_instance>. "check whether the entity instance is already present in the buffer data(instance_exists_in_buffer) = check_instance_exists( exporting instance_to_check = <input_entity_instance> entity_instances = <instances_4_entity_in_buffer> entity_fields = entity_fields ). if instance_exists_in_buffer = abap_false. " fill failed and reported fill_modify_reported_n_failed( exporting i_entity_fields = entity_fields alias_name = alias message_number = 001 change = change changing c_failed = failed c_reported = reported cs_change_instance = <input_entity_instance> ). else. data(failed_configured) = find_failed_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-update changing buffer_4_entity = buffer_4_entity c_failed = failed ). data(reported_configured) = find_reported_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-update changing buffer_4_entity = buffer_4_entity c_reported = reported ). data(mapped_configured) = find_mapped_if_configured( exporting entity = entity_details instance_to_check = <input_entity_instance> operation = if_abap_behv=>op-m-update changing buffer_4_entity = buffer_4_entity c_mapped = mapped ). " update the instance if reported_configured eq abap_false and mapped_configured eq abap_false and failed_configured eq abap_false. create data entity_buffer_instance like line of <instances_4_entity_in_buffer>. assign entity_buffer_instance->* to <entity_buffer_instance>. <entity_buffer_instance> = corresponding #( <input_entity_instance> ). modify table <instances_4_entity_in_buffer> from <entity_buffer_instance> . " fill mapped fill_modify_mapped( exporting alias_name = alias i_entity_fields = entity_fields message_number = '001' change = change changing c_mapped = mapped cs_change_instance = <input_entity_instance> ). endif. endif. endloop. endmethod. method _read. data entity_fields type ddfields. data buffer_entry_for_entity type ty_double_transactional_buffer. data entity_buffer_instance_copy type ref to data. field-symbols <fs_retrieval_instances> type standard table. field-symbols <fs_retrieval_instance> type any. field-symbols <fs_control_fields> type any. field-symbols <entity_buffer_instances> type standard table. field-symbols <entity_buffer_instance> type any. field-symbols <entity_buffer_instance_copy> type any. field-symbols <fs_result> type standard table. " retrieve the buffer entry for the entity if line_exists( dbl_transactional_buffer_table[ entity_name = retrieval-entity_name ] ). buffer_entry_for_entity = dbl_transactional_buffer_table[ entity_name = retrieval-entity_name ]. loop at bdef_load-entities into data(entity) where name = retrieval-entity_name. buffer_entry_for_entity-entity_alias = entity-alias. exit. endloop. endif. " retrieve fields of the entity entity_fields = get_entity_fields( retrieval-entity_name ). " get the reference to the entity instances requested assign retrieval-instances->* to <fs_retrieval_instances>. " get the reference to the output result assign retrieval-results->* to <fs_result>. " get the reference to the entity instances in buffer assign buffer_entry_for_entity-entity_instances->* to <entity_buffer_instances>. " TODO: Fill failed structure when the entry does not exist in the transactional buffer if buffer_entry_for_entity is initial. "TODO: Throw exception that entity doesn't exist. data(entity_details) = retrieval-entity_name. loop at bdef_load-entities into entity where name = retrieval-entity_name. buffer_entry_for_entity-entity_alias = entity-alias. exit. endloop. data(alias) = buffer_entry_for_entity-entity_alias. alias = to_upper( alias ). loop at <fs_retrieval_instances> assigning <fs_retrieval_instance>. fill_read_reported_and_failed( exporting i_entity_fields = entity_fields alias_name = alias message_number = 001 retrieval = retrieval changing c_failed = failed c_reported = reported cs_retrieval_instance = <fs_retrieval_instance> ). endloop. exit. endif. " TODO: Probably we can get rid of key fields calculation from the structure. Because the retrieval instance entry already " has all the key fields. So probably loop through the components and filter out the key fields. *---- read the buffer entries corresponding to the entries in the retrieval table loop at <fs_retrieval_instances> assigning <fs_retrieval_instance>. " check whether the retrieval entry is present in the buffer loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <fs_retrieval_instance> entity_fields = entity_fields ). if equal = abap_true. data(failed_configured) = find_failed_config_for_read( exporting entity = entity instance_to_check = <fs_retrieval_instance> operation = if_abap_behv=>op-r-read changing buffer_4_entity = buffer_entry_for_entity c_failed = failed ). data(reported_configured) = find_reported_config_for_read( exporting entity = entity instance_to_check = <fs_retrieval_instance> operation = if_abap_behv=>op-r-read changing buffer_4_entity = buffer_entry_for_entity c_reported = reported ). data(result_configured) = find_result_config_for_read( exporting entity = entity instance_to_check = <fs_retrieval_instance> operation = if_abap_behv=>op-r-read changing buffer_4_entity = buffer_entry_for_entity c_result = <fs_result> ). if reported_configured eq abap_false and failed_configured eq abap_false and result_configured eq abap_false. " create a copy of buffer instance entry deep_clone( exporting data_to_be_cloned = <entity_buffer_instance> importing reference_to_cloned_data = entity_buffer_instance_copy ). assign entity_buffer_instance_copy->* to <entity_buffer_instance_copy>. " format data as per the control structures provided assign component '%control' of structure <fs_retrieval_instance> to <fs_control_fields>. format_res_as_per_cntrl_flds( exporting control_fields = <fs_control_fields> entity_fields = entity_fields changing entity_instance = <entity_buffer_instance_copy> ). append <entity_buffer_instance_copy> to <fs_result>. exit. endif. endif. endloop. "Instance doesn't exist in buffer if equal eq abap_false. entity_details = retrieval-entity_name. alias = buffer_entry_for_entity-entity_alias. alias = to_upper( alias ). fill_read_reported_and_failed( exporting i_entity_fields = entity_fields alias_name = alias message_number = 001 retrieval = retrieval changing c_failed = failed c_reported = reported cs_retrieval_instance = <fs_retrieval_instance> ). endif. endloop. endmethod. method _read_by_assoc. data entity_fields type ddfields. data buffer_entry_for_entity type ty_double_transactional_buffer. data entity_buffer_instance_copy type ref to data. field-symbols <fs_retrieval_instances> type standard table. field-symbols <fs_retrieval_instance> type any. field-symbols <fs_control_fields> type any. field-symbols <entity_buffer_instances> type standard table. field-symbols <entity_buffer_instance> type any. field-symbols <entity_buffer_instance_copy> type any. field-symbols <fs_result> type standard table. " retrieve the buffer entry for the entity if line_exists( dbl_transactional_buffer_table[ entity_name = retrieval-entity_name ] ). buffer_entry_for_entity = dbl_transactional_buffer_table[ entity_name = retrieval-entity_name ]. loop at bdef_load-entities into data(entity) where name = retrieval-entity_name. buffer_entry_for_entity-entity_alias = entity-alias. exit. endloop. endif. " retrieve fields of the entity entity_fields = get_entity_fields( retrieval-entity_name ). " get the reference to the entity instances requested assign retrieval-instances->* to <fs_retrieval_instances>. " get the reference to the output result assign retrieval-results->* to <fs_result>. " get the reference to the entity instances in buffer assign buffer_entry_for_entity-entity_instances->* to <entity_buffer_instances>. " TODO: Fill failed structure when the entry does not exist in the transactional buffer if buffer_entry_for_entity is initial. "TODO: Throw exception that entity doesn't exist. data(entity_details) = retrieval-entity_name. loop at bdef_load-entities into entity where name = retrieval-entity_name. buffer_entry_for_entity-entity_alias = entity-alias. exit. endloop. data(alias) = buffer_entry_for_entity-entity_alias. alias = to_upper( alias ). loop at <fs_retrieval_instances> assigning <fs_retrieval_instance>. fill_read_reported_and_failed( exporting i_entity_fields = entity_fields alias_name = alias message_number = 001 retrieval = retrieval changing c_failed = failed c_reported = reported cs_retrieval_instance = <fs_retrieval_instance> ). endloop. exit. endif. " TODO: Probably we can get rid of key fields calculation from the structure. Because the retrieval instance entry already " has all the key fields. So probably loop through the components and filter out the key fields. *---- read the associated entity buffer entries corresponding to the entries in the retrieval table data(association) = bdef_load-associations[ name = retrieval-sub_name ]. data(associated_entity) = association-target_entity. data buffer_entry_for_assoc_entity type ty_double_transactional_buffer. " retrieve fields of the associated entity data(assoc_entity_fields) = get_entity_fields( associated_entity ). loop at <fs_retrieval_instances> assigning <fs_retrieval_instance>. " check whether the retrieval entry is present in the buffer loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(parent_equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <fs_retrieval_instance> entity_fields = entity_fields ). if parent_equal = abap_true. " retrieve the buffer entry for the associated entity if line_exists( dbl_transactional_buffer_table[ entity_name = associated_entity ] ). buffer_entry_for_assoc_entity = dbl_transactional_buffer_table[ entity_name = associated_entity ]. loop at bdef_load-entities into entity where name = associated_entity. buffer_entry_for_assoc_entity-entity_alias = entity-alias. exit. endloop. endif. field-symbols <assoc_entity_buff_instances> type standard table. assign buffer_entry_for_assoc_entity-entity_instances->* to <assoc_entity_buff_instances>. " check whether the retrieval entry is present in the buffer if <assoc_entity_buff_instances> is assigned. loop at <assoc_entity_buff_instances> assigning field-symbol(<assoc_entity_buffer_instance>). data(equal) = check_instance_equal( exporting instance_1 = <assoc_entity_buffer_instance> instance_2 = <fs_retrieval_instance> entity_fields = entity_fields " here we are passing the entity fields of parent entity and not associated entity because " the read happens only based on the key value of parent and not associated entity ). if equal = abap_true. data(failed_configured) = find_failed_config_for_rba( exporting parent_entity = bdef_load-entities[ name = association-source_entity ] entity = entity instance_to_check = <fs_retrieval_instance> operation = if_abap_behv=>op-r-read_ba changing buffer_4_entity = buffer_entry_for_assoc_entity c_failed = failed ). data(reported_configured) = find_reported_config_for_rba( exporting parent_entity = bdef_load-entities[ name = association-source_entity ] entity = entity instance_to_check = <fs_retrieval_instance> operation = if_abap_behv=>op-r-read_ba changing buffer_4_entity = buffer_entry_for_assoc_entity c_reported = reported ). data(result_configured) = find_result_config_for_rba( exporting parent_entity = bdef_load-entities[ name = association-source_entity ] entity = entity instance_to_check = <fs_retrieval_instance> operation = if_abap_behv=>op-r-read_ba changing buffer_4_entity = buffer_entry_for_assoc_entity c_result = <fs_result> ). if reported_configured eq abap_false and failed_configured eq abap_false and result_configured eq abap_false. " create a copy of buffer instance entry deep_clone( exporting data_to_be_cloned = <assoc_entity_buffer_instance> importing reference_to_cloned_data = entity_buffer_instance_copy ). assign entity_buffer_instance_copy->* to <entity_buffer_instance_copy>. " format data as per the control structures provided assign component '%control' of structure <fs_retrieval_instance> to <fs_control_fields>. format_res_as_per_cntrl_flds( exporting control_fields = <fs_control_fields> entity_fields = assoc_entity_fields changing entity_instance = <entity_buffer_instance_copy> ). append <entity_buffer_instance_copy> to <fs_result>. endif. endif. endloop. endif. continue. endif. endloop. " If the parent entity itself does not exist if parent_equal eq abap_false. " fill failed and reported alias = buffer_entry_for_entity-entity_alias. alias = to_upper( alias ). fill_read_reported_and_failed( exporting i_entity_fields = entity_fields alias_name = alias message_number = 001 retrieval = retrieval changing c_failed = failed c_reported = reported cs_retrieval_instance = <fs_retrieval_instance> ). endif. endloop. endmethod. method zif_abap_behv_test_trans_bufr5~config_response_4_modify. data bdef_load type t_bdef_load. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer, <entity_buffer_instances> type standard table, <entity_buffer_instance> type any, <entity_reported> type standard table. cl_abap_behv_load=>get_load( exporting entity = root_name all = abap_true importing head = bdef_load-head entities = bdef_load-entities features = bdef_load-features actions = bdef_load-actions relations = bdef_load-relations associations = bdef_load-associations ). loop at bdef_load-entities into data(entity). if mapped is not initial. configure_mapped( entity = entity mapped = mapped operation = operation ). endif. if reported is not initial. configure_reported( entity = entity reported = reported operation = operation ). endif. if failed is not initial. configure_failed_for_modify( entity = entity failed = failed operation = operation ). endif. endloop. endmethod. method zif_abap_behv_test_trans_bufr5~config_response_4_read. data bdef_load type t_bdef_load. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer, <entity_buffer_instances> type standard table, <entity_buffer_instance> type any, <entity_reported> type standard table. cl_abap_behv_load=>get_load( exporting entity = root_name all = abap_true importing head = bdef_load-head entities = bdef_load-entities features = bdef_load-features actions = bdef_load-actions relations = bdef_load-relations associations = bdef_load-associations ). loop at bdef_load-entities into data(entity). if result is not initial. configure_result_for_read( entity = entity result = result operation = operation ). endif. if reported is not initial. configure_reported_for_read( entity = entity reported = reported operation = operation ). endif. if failed is not initial. configure_failed_for_read( entity = entity failed = failed operation = operation ). endif. endloop. endmethod. method get_entity_alias. if entity-alias is initial. alias = to_upper( entity-name ). else. alias = to_upper( entity-alias ). endif. endmethod. method configure_mapped. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer. field-symbols: <entity_mapped> type standard table. field-symbols: <entity_reported_instances> type standard table. field-symbols: <mapped_entity_to_be_filled> type standard table. field-symbols: <entity_buffer_instances> type standard table. field-symbols: <entity_buffer_instance> type any. data(alias) = get_entity_alias( entity = entity ). assign component alias of structure mapped to <entity_mapped>. if <entity_mapped> is assigned and <entity_mapped> is not initial. loop at <entity_mapped> assigning field-symbol(<entity_mapped_instance>). if line_exists( dbl_transactional_buffer_table[ entity_name = entity-name ] ). assign dbl_transactional_buffer_table[ entity_name = entity-name ] to <buffer_4_entity>. assign <buffer_4_entity>-entity_instances->* to <entity_buffer_instances>. data(entity_fields) = get_entity_fields( entity-name ). loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <entity_mapped_instance> entity_fields = entity_fields ). if equal = abap_true. read table <buffer_4_entity>-modify_response_config with key operation = operation assigning field-symbol(<response_config>). if <response_config> is not assigned . "create an entry for the modify response config data mapped_config_for_op type ty_modify_response_config. create data mapped_config_for_op-mapped like mapped. mapped_config_for_op-operation = operation. assign mapped_config_for_op-mapped->* to field-symbol(<mapped_to_be_filled>). assign component alias of structure <mapped_to_be_filled> to <mapped_entity_to_be_filled>. append <entity_mapped_instance> to <mapped_entity_to_be_filled>. append mapped_config_for_op to <buffer_4_entity>-modify_response_config. else. "check if failed is configured for the operation and instance if <response_config>-failed is not initial. data dummy_failed like <response_config>-failed. data(failed_already_configured) = find_failed_if_configured( exporting entity = entity instance_to_check = <entity_mapped_instance> operation = operation changing buffer_4_entity = <buffer_4_entity> c_failed = dummy_failed ). if failed_already_configured eq abap_true. "TODO: Exception reported is already configured. Configuring mapped for the same instance is undefined. EXIT. endif. endif. "check if reported is configured for the operation and instance if <response_config>-reported is not initial. assign <response_config>-reported->* to field-symbol(<entity_reported>). assign component alias of structure <entity_reported> to <entity_reported_instances>. loop at <entity_reported_instances> assigning field-symbol(<entity_reported_instance>). data(reported_already_configured) = check_instance_equal( exporting instance_1 = <entity_reported_instance> instance_2 = <entity_mapped_instance> entity_fields = entity_fields ). if reported_already_configured eq abap_true. "TODO: Exception reported is already configured. Configuring mapped for the same instance is undefined. EXIT. endif. endloop. if reported_already_configured eq abap_true. "TODO: Exception reported is already configured. Configuring mapped for the same instance is undefined. EXIT. endif. "At this point it is clear that reported is not configured for the instance. if <response_config>-mapped is initial. create data <response_config>-mapped like mapped. assign <response_config>-mapped->* to <mapped_to_be_filled>. assign component alias of structure <mapped_to_be_filled> to <mapped_entity_to_be_filled>. append <entity_mapped_instance> to <mapped_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-mapped->* to <mapped_to_be_filled>. assign component alias of structure <mapped_to_be_filled> to <mapped_entity_to_be_filled>. append <entity_mapped_instance> to <mapped_entity_to_be_filled>. endif. else. "At this point it is clear that reported is not configured for the instance. if <response_config>-mapped is initial. create data <response_config>-mapped like mapped. assign <response_config>-mapped->* to <mapped_to_be_filled>. assign component alias of structure <mapped_to_be_filled> to <mapped_entity_to_be_filled>. append <entity_mapped_instance> to <mapped_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-mapped->* to <mapped_to_be_filled>. assign component alias of structure <mapped_to_be_filled> to <mapped_entity_to_be_filled>. append <entity_mapped_instance> to <mapped_entity_to_be_filled>. endif. endif. endif. else. "TODO: Throw exception with a reason that "no buffer entry exists for the entity instance" " Record the instance for which the response is to be configured. endif. endloop. else. "TODO: Throw exception with a reason that "no buffer exists for the entity" " Record the instance for which the response is to be configured. endif. endloop. endif. endmethod. method configure_reported. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer. field-symbols: <entity_mapped_instances> type standard table. field-symbols: <entity_reported> type standard table. field-symbols: <reported_entity_to_be_filled> type standard table. field-symbols: <entity_buffer_instances> type standard table. field-symbols: <entity_buffer_instance> type any. data(alias) = get_entity_alias( entity = entity ). assign component alias of structure reported to <entity_reported>. if <entity_reported> is assigned and <entity_reported> is not initial. loop at <entity_reported> assigning field-symbol(<entity_reported_instance>). if line_exists( dbl_transactional_buffer_table[ entity_name = entity-name ] ). assign dbl_transactional_buffer_table[ entity_name = entity-name ] to <buffer_4_entity>. assign <buffer_4_entity>-entity_instances->* to <entity_buffer_instances>. data(entity_fields) = get_entity_fields( entity-name ). loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <entity_reported_instance> entity_fields = entity_fields ). if equal = abap_true. read table <buffer_4_entity>-modify_response_config with key operation = operation assigning field-symbol(<response_config>). if <response_config> is not assigned . "create an entry for the modify response config data reported_config_for_op type ty_modify_response_config. create data reported_config_for_op-reported like reported. reported_config_for_op-operation = operation. assign reported_config_for_op-reported->* to field-symbol(<reported_to_be_filled>). assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. append reported_config_for_op to <buffer_4_entity>-modify_response_config. else. "check if mapped is configured for the operation and instance if <response_config>-mapped is not initial. assign <response_config>-mapped->* to field-symbol(<entity_mapped>). assign component alias of structure <entity_mapped> to <entity_mapped_instances>. loop at <entity_mapped_instances> assigning field-symbol(<entity_mapped_instance>). data(mapped_already_configured) = check_instance_equal( exporting instance_1 = <entity_mapped_instance> instance_2 = <entity_reported_instance> entity_fields = entity_fields ). if mapped_already_configured eq abap_true. "TODO: Exception mapped is already configured. Configuring reported for the same instance is undefined. EXIT. endif. endloop. if mapped_already_configured eq abap_true. "TODO: Exception mapped is already configured. Configuring reported for the same instance is undefined. EXIT. endif. "At this point it is clear that mapped is not configured for the instance. if <response_config>-reported is initial. create data <response_config>-reported like reported. assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. endif. else. "At this point it is clear that mapped is not configured for the instance. if <response_config>-reported is initial. create data <response_config>-reported like reported. assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. endif. endif. endif. else. "TODO: Throw exception with a reason that "no buffer entry exists for the entity instance" " Record the instance for which the response is to be configured. endif. endloop. else. "TODO: Throw exception with a reason that "no buffer exists for the entity" " Record the instance for which the response is to be configured. endif. endloop. endif. endmethod. method configure_failed_for_modify. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer. field-symbols: <entity_mapped_instances> type standard table. field-symbols: <entity_failed> type standard table. field-symbols: <failed_entity_to_be_filled> type standard table. field-symbols: <entity_buffer_instances> type standard table. field-symbols: <entity_buffer_instance> type any. data(alias) = get_entity_alias( entity = entity ). assign component alias of structure failed to <entity_failed>. if <entity_failed> is assigned and <entity_failed> is not initial. loop at <entity_failed> assigning field-symbol(<entity_failed_instance>). if line_exists( dbl_transactional_buffer_table[ entity_name = entity-name ] ). assign dbl_transactional_buffer_table[ entity_name = entity-name ] to <buffer_4_entity>. assign <buffer_4_entity>-entity_instances->* to <entity_buffer_instances>. data(entity_fields) = get_entity_fields( entity-name ). loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <entity_failed_instance> entity_fields = entity_fields ). if equal = abap_true. read table <buffer_4_entity>-modify_response_config with key operation = operation assigning field-symbol(<response_config>). if <response_config> is not assigned. "create an entry for the modify response config data failed_config_for_op type ty_modify_response_config. create data failed_config_for_op-failed like failed. failed_config_for_op-operation = operation. assign failed_config_for_op-failed->* to field-symbol(<failed_to_be_filled>). assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. append failed_config_for_op to <buffer_4_entity>-modify_response_config. else. "check if mapped is configured for the operation and instance if <response_config>-mapped is not initial. assign <response_config>-mapped->* to field-symbol(<entity_mapped>). assign component alias of structure <entity_mapped> to <entity_mapped_instances>. loop at <entity_mapped_instances> assigning field-symbol(<entity_mapped_instance>). data(mapped_already_configured) = check_instance_equal( exporting instance_1 = <entity_mapped_instance> instance_2 = <entity_failed_instance> entity_fields = entity_fields ). if mapped_already_configured eq abap_true. "TODO: Exception mapped is already configured. Configuring failed for the same instance is undefined. EXIT. endif. endloop. if mapped_already_configured eq abap_true. "TODO: Exception mapped is already configured. Configuring failed for the same instance is undefined. EXIT. endif. "At this point it is clear that mapped is not configured for the instance. if <response_config>-failed is initial. create data <response_config>-failed like failed. assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. endif. else. "At this point it is clear that mapped is not configured for the instance. if <response_config>-failed is initial. create data <response_config>-failed like failed. assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. endif. endif. endif. else. "TODO: Throw exception with a reason that "no buffer entry exists for the entity instance" " Record the instance for which the response is to be configured. endif. endloop. else. "TODO: Throw exception with a reason that "no buffer exists for the entity" " Record the instance for which the response is to be configured. endif. endloop. endif. endmethod. method configure_result_for_read. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer. field-symbols: <entity_result> type standard table. field-symbols: <result_entity_to_be_filled> type standard table. field-symbols: <entity_buffer_instances> type standard table. field-symbols: <entity_buffer_instance> type any. field-symbols: <reported_for_entity> type standard table. data(alias) = get_entity_alias( entity = entity ). if result is not initial. loop at result assigning field-symbol(<entity_result_instance>). if line_exists( dbl_transactional_buffer_table[ entity_name = entity-name ] ). assign dbl_transactional_buffer_table[ entity_name = entity-name ] to <buffer_4_entity>. assign <buffer_4_entity>-entity_instances->* to <entity_buffer_instances>. data(entity_fields) = get_entity_fields( entity-name ). loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <entity_result_instance> entity_fields = entity_fields ). if equal = abap_true. read table <buffer_4_entity>-read_response_config with key operation = operation assigning field-symbol(<response_config>). if <response_config> is not assigned . "create an entry for the read response config data result_config_for_op type ty_read_response_config. create data result_config_for_op-result like result. result_config_for_op-operation = operation. assign result_config_for_op-result->* to <result_entity_to_be_filled>. append <entity_result_instance> to <result_entity_to_be_filled>. append result_config_for_op to <buffer_4_entity>-read_response_config. else. "check if failed is configured for the operation and instance if <response_config>-failed is not initial. data dummy_failed like <response_config>-failed. data(failed_already_configured) = find_failed_config_for_read( exporting entity = entity instance_to_check = <entity_result_instance> operation = operation changing buffer_4_entity = <buffer_4_entity> c_failed = dummy_failed ). if failed_already_configured eq abap_true. "TODO: Exception failed is already configured. Configuring result for the same instance is undefined. EXIT. endif. endif. "check if reported is configured for the operation and instance if <response_config>-reported is not initial. data dummy_reported like <response_config>-reported. data(reported_already_configured) = find_reported_config_for_read( exporting entity = entity instance_to_check = <entity_result_instance> operation = operation changing buffer_4_entity = <buffer_4_entity> c_reported = dummy_reported ). if reported_already_configured eq abap_true. "TODO: Exception reported is already configured. Configuring result for the same instance is undefined. EXIT. endif. endif. "At this point it is clear that reported or failed is not configured. if <response_config>-result is not initial. assign <response_config>-result->* to <result_entity_to_be_filled>. append <entity_result_instance> to <result_entity_to_be_filled>. else. create data <response_config>-result like result. <response_config>-operation = operation. assign <response_config>-result->* to <result_entity_to_be_filled>. append <entity_result_instance> to <result_entity_to_be_filled>. endif. endif. else. "TODO: Throw exception with a reason that "no buffer entry exists for the entity instance" " Record the instance for which the response is to be configured. endif. endloop. else. "TODO: Throw exception with a reason that "no buffer exists for the entity" " Record the instance for which the response is to be configured. endif. endloop. endif. endmethod. method configure_reported_for_read. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer. field-symbols: <entity_reported> type standard table. field-symbols: <reported_entity_to_be_filled> type standard table. field-symbols: <entity_buffer_instances> type standard table. field-symbols: <entity_buffer_instance> type any. field-symbols: <result_for_entity> type standard table. data(alias) = get_entity_alias( entity = entity ). assign component alias of structure reported to <entity_reported>. if <entity_reported> is assigned and <entity_reported> is not initial. loop at <entity_reported> assigning field-symbol(<entity_reported_instance>). if line_exists( dbl_transactional_buffer_table[ entity_name = entity-name ] ). assign dbl_transactional_buffer_table[ entity_name = entity-name ] to <buffer_4_entity>. assign <buffer_4_entity>-entity_instances->* to <entity_buffer_instances>. data(entity_fields) = get_entity_fields( entity-name ). loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <entity_reported_instance> entity_fields = entity_fields ). if equal = abap_true. read table <buffer_4_entity>-read_response_config with key operation = operation assigning field-symbol(<response_config>). if <response_config> is not assigned. "create an entry for the read response config data reported_config_for_op type ty_read_response_config. create data reported_config_for_op-reported like reported. reported_config_for_op-operation = operation. assign reported_config_for_op-reported->* to field-symbol(<reported_to_be_filled>). assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. append reported_config_for_op to <buffer_4_entity>-read_response_config. else. "check if result is configured for the operation and instance if <response_config>-result is not initial. assign <response_config>-result->* to <result_for_entity>. loop at <result_for_entity> assigning field-symbol(<entity_result_instance>). data(result_already_configured) = check_instance_equal( exporting instance_1 = <entity_result_instance> instance_2 = <entity_reported_instance> entity_fields = entity_fields ). if result_already_configured eq abap_true. "TODO: Exception result is already configured. Configuring reported for the same instance is undefined. EXIT. endif. endloop. if result_already_configured eq abap_true. "TODO: Exception result is already configured. Configuring reported for the same instance is undefined. EXIT. endif. "At this point it is clear that result is not configured for the instance. if <response_config>-reported is initial. create data <response_config>-reported like reported. assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. endif. else. "At this point it is clear that result is not configured for the instance. if <response_config>-reported is initial. create data <response_config>-reported like reported. assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-reported->* to <reported_to_be_filled>. assign component alias of structure <reported_to_be_filled> to <reported_entity_to_be_filled>. append <entity_reported_instance> to <reported_entity_to_be_filled>. endif. endif. endif. else. "TODO: Throw exception with a reason that "no buffer entry exists for the entity instance" " Record the instance for which the response is to be configured. endif. endloop. else. "TODO: Throw exception with a reason that "no buffer exists for the entity" " Record the instance for which the response is to be configured. endif. endloop. endif. endmethod. method configure_failed_for_read. field-symbols: <buffer_4_entity> type ty_double_transactional_buffer. field-symbols: <entity_failed> type standard table. field-symbols: <failed_entity_to_be_filled> type standard table. field-symbols: <entity_buffer_instances> type standard table. field-symbols: <entity_buffer_instance> type any. field-symbols: <result_for_entity> type standard table. data(alias) = get_entity_alias( entity = entity ). assign component alias of structure failed to <entity_failed>. if <entity_failed> is assigned and <entity_failed> is not initial. loop at <entity_failed> assigning field-symbol(<entity_failed_instance>). if line_exists( dbl_transactional_buffer_table[ entity_name = entity-name ] ). assign dbl_transactional_buffer_table[ entity_name = entity-name ] to <buffer_4_entity>. assign <buffer_4_entity>-entity_instances->* to <entity_buffer_instances>. data(entity_fields) = get_entity_fields( entity-name ). loop at <entity_buffer_instances> assigning <entity_buffer_instance>. data(equal) = check_instance_equal( exporting instance_1 = <entity_buffer_instance> instance_2 = <entity_failed_instance> entity_fields = entity_fields ). if equal = abap_true. read table <buffer_4_entity>-read_response_config with key operation = operation assigning field-symbol(<response_config>). if <response_config> is not assigned. "create an entry for the read response config data failed_config_for_op type ty_read_response_config. create data failed_config_for_op-failed like failed. failed_config_for_op-operation = operation. assign failed_config_for_op-failed->* to field-symbol(<failed_to_be_filled>). assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. append failed_config_for_op to <buffer_4_entity>-read_response_config. else. "check if result is configured for the operation and instance if <response_config>-result is not initial. assign <response_config>-result->* to <result_for_entity>. loop at <result_for_entity> assigning field-symbol(<entity_result_instance>). data(result_already_configured) = check_instance_equal( exporting instance_1 = <entity_result_instance> instance_2 = <entity_failed_instance> entity_fields = entity_fields ). if result_already_configured eq abap_true. "TODO: Exception result is already configured. Configuring failed for the same instance is undefined. EXIT. endif. endloop. if result_already_configured eq abap_true. "TODO: Exception result is already configured. Configuring failed for the same instance is undefined. EXIT. endif. "At this point it is clear that result is not configured for the instance. if <response_config>-failed is initial. create data <response_config>-failed like failed. assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. endif. else. "At this point it is clear that result is not configured for the instance. if <response_config>-failed is initial. create data <response_config>-failed like failed. assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. else. "TODO: Handle duplicate entries assign <response_config>-failed->* to <failed_to_be_filled>. assign component alias of structure <failed_to_be_filled> to <failed_entity_to_be_filled>. append <entity_failed_instance> to <failed_entity_to_be_filled>. endif. endif. endif. else. "TODO: Throw exception with a reason that "no buffer entry exists for the entity instance" " Record the instance for which the response is to be configured. endif. endloop. else. "TODO: Throw exception with a reason that "no buffer exists for the entity" " Record the instance for which the response is to be configured. endif. endloop. endif. endmethod. method find_reported_if_configured. field-symbols: <configured_entity_reported> type standard table. field-symbols: <existing_buff_reported> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-modify_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-reported is not initial. assign response_config-reported->* to field-symbol(<configured_reported>). assign component alias of structure <configured_reported> to <configured_entity_reported>. endif. if <configured_entity_reported> is assigned and <configured_entity_reported> is not initial. loop at <configured_entity_reported> assigning field-symbol(<configured_reported_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_reported_instance> entity_fields = entity_fields ). if equal = abap_true. field-symbols <fs_entry_reported_table> type standard table. assign component alias of structure c_reported to <fs_entry_reported_table>. append <configured_reported_instance> to <fs_entry_reported_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_failed_if_configured. field-symbols: <configured_entity_failed> type standard table. field-symbols: <existing_buff_failed> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-modify_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-failed is not initial. assign response_config-failed->* to field-symbol(<configured_failed>). assign component alias of structure <configured_failed> to <configured_entity_failed>. endif. if <configured_entity_failed> is assigned and <configured_entity_failed> is not initial. loop at <configured_entity_failed> assigning field-symbol(<configured_failed_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_failed_instance> entity_fields = entity_fields ). if equal = abap_true. field-symbols <fs_entry_failed_table> type standard table. assign component alias of structure c_failed to <fs_entry_failed_table>. append <configured_failed_instance> to <fs_entry_failed_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_mapped_if_configured. field-symbols: <configured_entity_mapped> type standard table. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-modify_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-mapped is not initial. assign response_config-mapped->* to field-symbol(<configured_mapped>). assign component alias of structure <configured_mapped> to <configured_entity_mapped>. endif. if <configured_entity_mapped> is assigned and <configured_entity_mapped> is not initial. loop at <configured_entity_mapped> assigning field-symbol(<configured_mapped_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_mapped_instance> entity_fields = entity_fields ). if equal = abap_true. field-symbols <fs_entry_mapped_table> type standard table. assign component alias of structure c_mapped to <fs_entry_mapped_table>. append <configured_mapped_instance> to <fs_entry_mapped_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_reported_config_for_read. field-symbols: <configured_entity_reported> type standard table. field-symbols: <existing_buff_reported> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-read_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-reported is not initial. assign response_config-reported->* to field-symbol(<configured_reported>). assign component alias of structure <configured_reported> to <configured_entity_reported>. endif. if <configured_entity_reported> is assigned and <configured_entity_reported> is not initial. loop at <configured_entity_reported> assigning field-symbol(<configured_reported_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_reported_instance> entity_fields = entity_fields ). if equal = abap_true. field-symbols <fs_entry_reported_table> type standard table. assign component alias of structure c_reported to <fs_entry_reported_table>. append <configured_reported_instance> to <fs_entry_reported_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_reported_config_for_rba. field-symbols: <configured_entity_reported> type standard table. field-symbols: <existing_buff_reported> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-read_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-reported is not initial. assign response_config-reported->* to field-symbol(<configured_reported>). assign component alias of structure <configured_reported> to <configured_entity_reported>. endif. if <configured_entity_reported> is assigned and <configured_entity_reported> is not initial. loop at <configured_entity_reported> assigning field-symbol(<configured_reported_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_reported_instance> entity_fields = get_entity_fields( parent_entity-name ) ). if equal = abap_true. field-symbols <fs_entry_reported_table> type standard table. assign component alias of structure c_reported to <fs_entry_reported_table>. append <configured_reported_instance> to <fs_entry_reported_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_failed_config_for_read. field-symbols: <configured_entity_failed> type standard table. field-symbols: <existing_buff_failed> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-read_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-failed is not initial. assign response_config-failed->* to field-symbol(<configured_failed>). assign component alias of structure <configured_failed> to <configured_entity_failed>. endif. if <configured_entity_failed> is assigned and <configured_entity_failed> is not initial. loop at <configured_entity_failed> assigning field-symbol(<configured_failed_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_failed_instance> entity_fields = entity_fields ). if equal = abap_true. field-symbols <fs_entry_failed_table> type standard table. assign component alias of structure c_failed to <fs_entry_failed_table>. append <configured_failed_instance> to <fs_entry_failed_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_failed_config_for_rba. field-symbols: <configured_entity_failed> type standard table. field-symbols: <existing_buff_failed> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-read_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-failed is not initial. assign response_config-failed->* to field-symbol(<configured_failed>). assign component alias of structure <configured_failed> to <configured_entity_failed>. endif. if <configured_entity_failed> is assigned and <configured_entity_failed> is not initial. loop at <configured_entity_failed> assigning field-symbol(<configured_failed_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_failed_instance> entity_fields = get_entity_fields( parent_entity-name ) ). if equal = abap_true. field-symbols <fs_entry_failed_table> type standard table. assign component alias of structure c_failed to <fs_entry_failed_table>. append <configured_failed_instance> to <fs_entry_failed_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_result_config_for_read. field-symbols: <configured_entity_result> type standard table. field-symbols: <existing_buff_result> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-read_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-result is not initial. assign response_config-result->* to <configured_entity_result>. endif. if <configured_entity_result> is assigned and <configured_entity_result> is not initial. loop at <configured_entity_result> assigning field-symbol(<configured_result_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_result_instance> entity_fields = entity_fields ). if equal = abap_true. " format data as per the control structures provided assign component '%control' of structure instance_to_check to field-symbol(<fs_control_fields>). format_res_as_per_cntrl_flds( exporting control_fields = <fs_control_fields> entity_fields = entity_fields changing entity_instance = <configured_result_instance> ). append <configured_result_instance> to c_result. * field-symbols <fs_entry_result_table> type standard table. * assign c_result to <fs_entry_result_table>. * append <configured_entity_result> to <fs_entry_result_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method find_result_config_for_rba. field-symbols: <configured_entity_result> type standard table. field-symbols: <existing_buff_result> type any. data(alias) = get_entity_alias( entity = entity ). alias = to_upper( alias ). data(entity_fields) = get_entity_fields( entity-name ). result = abap_false. read table buffer_4_entity-read_response_config with key operation = operation into data(response_config). if response_config is not initial and response_config-result is not initial. assign response_config-result->* to <configured_entity_result>. endif. if <configured_entity_result> is assigned and <configured_entity_result> is not initial. loop at <configured_entity_result> assigning field-symbol(<configured_result_instance>). data(equal) = check_instance_equal( exporting instance_1 = instance_to_check instance_2 = <configured_result_instance> entity_fields = get_entity_fields( parent_entity-name ) ). if equal = abap_true. " format data as per the control structures provided assign component '%control' of structure instance_to_check to field-symbol(<fs_control_fields>). format_res_as_per_cntrl_flds( exporting control_fields = <fs_control_fields> entity_fields = entity_fields changing entity_instance = <configured_result_instance> ). append <configured_result_instance> to c_result. * field-symbols <fs_entry_result_table> type standard table. * assign c_result to <fs_entry_result_table>. * append <configured_entity_result> to <fs_entry_result_table>. result = abap_true. exit. endif. endloop. endif. endmethod. method zif_abap_behv_test_trans_bufr5~clear_buffer. clear dbl_transactional_buffer_table. endmethod. method configure_failed. " refactoring attempt for configure failed for modify and read. endmethod. endclass.
44.439172
229
0.608094
c82e99217250e0a1e39832839af0224848a7dc67
11,708
abap
ABAP
src/legacy/#dmo#if_flight_legacy16.intf.abap
SAP-Cloud-Platform/flight16
dae08b592cf288780e1f746baf184d2bed4b0b9f
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#if_flight_legacy16.intf.abap
SAP-Cloud-Platform/flight16
dae08b592cf288780e1f746baf184d2bed4b0b9f
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#if_flight_legacy16.intf.abap
SAP-Cloud-Platform/flight16
dae08b592cf288780e1f746baf184d2bed4b0b9f
[ "BSD-Source-Code" ]
null
null
null
"! <strong>Interface for Flight Legacy Coding</strong><br/> "! Every used structure or table type needed in the API Function Modules "! will be defined here. INTERFACE /dmo/if_flight_legacy16 PUBLIC. *********************** * Version information * *********************** CONSTANTS co_version_major TYPE int2 VALUE 2. CONSTANTS co_version_minor TYPE int2 VALUE 0. " Please do NOT delete old comments " Version x.x Date xx.xx.xxxx Description ... " 0.9 25.07.2018 More or less ready! " 0.91 02.08.2018 Derivations and checks for price / currency " Documentation " 0.92 03.08.2018 Commented out locking " 0.93 09.08.2018 Data Generator Bug Fix; Description searchable short string " 0.94 24.08.2018 Minor corrections " 0.95 07.09.2018 Derivation of Total Price, minor corrections " 0.96 17.09.2018 Performance DELETE " 0.961 18.09.2018 Removed += " 0.962 18.09.2018 Removed ABAPDoc from FuBa, Switched Function Group to Unicode " 1.00 27.09.2018 No real change, only release " 1.01 28.09.2018 Minor text adjustments " 1.02 22.10.2018 Data generator adjustment " Unit Test moved from function group into separate ABAP class " 2.00 05.03.2019 Added ReadOnly and Unmanaged Content " Added AMDP class with Currency Conversion " (Re-)Added ABAPDoc to FuBa ****************************** * Database table table types * ****************************** "! Table type of the table /DMO/TRAVEL16 TYPES tt_travel TYPE SORTED TABLE OF /dmo/travel16 WITH UNIQUE KEY travel_id. "! Table type of the table /DMO/BOOKING16 TYPES tt_booking TYPE SORTED TABLE OF /dmo/booking16 WITH UNIQUE KEY travel_id booking_id. "! Table type of the table /DMO/BOOK_SUP_16 TYPES tt_booking_supplement TYPE SORTED TABLE OF /dmo/book_sup_16 WITH UNIQUE KEY travel_id booking_id booking_supplement_id. "! Table type of the table /DMO/FLIGHT16 TYPES tt_flight TYPE STANDARD TABLE OF /dmo/flight16 WITH KEY client carrier_id connection_id flight_date. ****************** * Key structures * ****************** "! Key structure of Travel TYPES BEGIN OF ts_travel_key. TYPES travel_id TYPE /dmo/travel_id16. TYPES END OF ts_travel_key. "! Table type that contains only the keys of Travel TYPES tt_travel_key TYPE SORTED TABLE OF ts_travel_key WITH UNIQUE KEY travel_id. "! Key structure of Booking TYPES BEGIN OF ts_booking_key. INCLUDE TYPE ts_travel_key. TYPES booking_id TYPE /dmo/booking_id16. TYPES END OF ts_booking_key. "! Table type that contains only the keys of Booking TYPES tt_booking_key TYPE SORTED TABLE OF ts_booking_key WITH UNIQUE KEY travel_id booking_id. "! Key structure of Booking Supplements TYPES BEGIN OF ts_booking_supplement_key. INCLUDE TYPE ts_booking_key. TYPES booking_supplement_id TYPE /dmo/booking_supplement_id16. TYPES END OF ts_booking_supplement_key. "! Table type that contains only the keys of Booking Supplements TYPES tt_booking_supplement_key TYPE SORTED TABLE OF ts_booking_supplement_key WITH UNIQUE KEY travel_id booking_id booking_supplement_id. *********************************************************************************************************************************** * Flag structures for data components * * IMPORTANT: When you add or remove fields from /DMO/TRAVEL16, /DMO/BOOKING16, /DMO/BOOK_SUP_16 you need to change the following types * *********************************************************************************************************************************** TYPES: "! <strong>Flag structure for Travel data. </strong><br/> "! Each component identifies if the corresponding data has been changed. "! Where <em>abap_true</em> represents a change. BEGIN OF ts_travel_intx, agency_id TYPE abap_bool, customer_id TYPE abap_bool, begin_date TYPE abap_bool, end_date TYPE abap_bool, booking_fee TYPE abap_bool, total_price TYPE abap_bool, currency_code TYPE abap_bool, description TYPE abap_bool, status TYPE abap_bool, END OF ts_travel_intx. TYPES: "! <strong>Flag structure for Booking data. </strong><br/> "! Each component identifies if the corresponding data has been changed. "! Where <em>abap_true</em> represents a change. BEGIN OF ts_booking_intx, booking_date TYPE abap_bool, customer_id TYPE abap_bool, carrier_id TYPE abap_bool, connection_id TYPE abap_bool, flight_date TYPE abap_bool, flight_price TYPE abap_bool, currency_code TYPE abap_bool, END OF ts_booking_intx. TYPES: "! <strong>Flag structure for Booking Supplement data. </strong><br/> "! Each component identifies if the corresponding data has been changed. "! Where <em>abap_true</em> represents a change. BEGIN OF ts_booking_supplement_intx, supplement_id TYPE abap_bool, price TYPE abap_bool, currency_code TYPE abap_bool, END OF ts_booking_supplement_intx. ********************************************************************** * Internal ********************************************************************** " Internally we use the full X-structures: With complete key and action code TYPES BEGIN OF ts_travelx. INCLUDE TYPE ts_travel_key. TYPES action_code TYPE /dmo/action_code16. INCLUDE TYPE ts_travel_intx. TYPES END OF ts_travelx. TYPES: tt_travelx TYPE SORTED TABLE OF ts_travelx WITH UNIQUE KEY travel_id. TYPES BEGIN OF ts_bookingx. INCLUDE TYPE ts_booking_key. TYPES action_code TYPE /dmo/action_code16. INCLUDE TYPE ts_booking_intx. TYPES END OF ts_bookingx. TYPES: tt_bookingx TYPE SORTED TABLE OF ts_bookingx WITH UNIQUE KEY travel_id booking_id. TYPES BEGIN OF ts_booking_supplementx. INCLUDE TYPE ts_booking_supplement_key. TYPES action_code TYPE /dmo/action_code16. INCLUDE TYPE ts_booking_supplement_intx. TYPES END OF ts_booking_supplementx. TYPES: tt_booking_supplementx TYPE SORTED TABLE OF ts_booking_supplementx WITH UNIQUE KEY travel_id booking_id booking_supplement_id. ********* * ENUMs * ********* TYPES: "! Action codes for CUD Operations "! <ul> "! <li><em>create</em> = create a node</li> "! <li><em>update</em> = update a node</li> "! <li><em>delete</em> = delete a node</li> "! </ul> BEGIN OF ENUM action_code_enum STRUCTURE action_code BASE TYPE /dmo/action_code16, initial VALUE IS INITIAL, create VALUE 'C', update VALUE 'U', delete VALUE 'D', END OF ENUM action_code_enum STRUCTURE action_code. TYPES: "! Travel Stati "! <ul> "! <li><em>New</em> = New Travel</li> "! <li><em>Planned</em> = Planned Travel</li> "! <li><em>Booked</em> = Booked Travel</li> "! <li><em>Cancelled</em> = Cancelled Travel</li> "! </ul> BEGIN OF ENUM travel_status_enum STRUCTURE travel_status BASE TYPE /dmo/travel_status16, initial VALUE IS INITIAL, new VALUE 'N', planned VALUE 'P', booked VALUE 'B', cancelled VALUE 'X', END OF ENUM travel_status_enum STRUCTURE travel_status. ************************ * Importing structures * ************************ "! INcoming structure of the node Travel. It contains key and data fields.<br/> "! The caller of the BAPI like function modules shall not provide the administrative fields. TYPES BEGIN OF ts_travel_in. INCLUDE TYPE ts_travel_key. INCLUDE TYPE /dmo/travel16_data. TYPES END OF ts_travel_in. "! INcoming structure of the node Booking. It contains the booking key and data fields.<br/> "! The BAPI like function modules always refer to a single travel. "! Therefore the Travel ID is not required in the subnode tables. TYPES BEGIN OF ts_booking_in. TYPES booking_id TYPE /dmo/booking_id16. INCLUDE TYPE /dmo/booking16_data. TYPES END OF ts_booking_in. "! INcoming table type of the node Booking. It contains the booking key and data fields. TYPES tt_booking_in TYPE SORTED TABLE OF ts_booking_in WITH UNIQUE KEY booking_id. "! INcoming structure of the node Booking Supplement. It contains the booking key, booking supplement key and data fields.<br/> "! The BAPI like function modules always refer to a single travel. "! Therefore the Travel ID is not required in the subnode tables but the booking key is required as it refers to it corresponding super node. TYPES BEGIN OF ts_booking_supplement_in. TYPES booking_id TYPE /dmo/booking_id16. TYPES booking_supplement_id TYPE /dmo/booking_supplement_id16. INCLUDE TYPE /dmo/book_sup_16_data. TYPES END OF ts_booking_supplement_in. "! INcoming table type of the node Booking Supplement. It contains the booking key, booking supplement key and data fields. TYPES tt_booking_supplement_in TYPE SORTED TABLE OF ts_booking_supplement_in WITH UNIQUE KEY booking_id booking_supplement_id. "! INcoming flag structure of the node Travel. It contains key and the bit flag to the corresponding fields.<br/> "! The caller of the BAPI like function modules shall not provide the administrative fields. "! Furthermore the action Code is not required for the root (because it is already determined by the function module name). TYPES BEGIN OF ts_travel_inx. INCLUDE TYPE ts_travel_key. INCLUDE TYPE ts_travel_intx. TYPES END OF ts_travel_inx. "! INcoming flag structure of the node Booking. It contains key and the bit flag to the corresponding fields.<br/> "! The BAPI like function modules always refer to a single travel. "! Therefore the Travel ID is not required in the subnode tables. TYPES BEGIN OF ts_booking_inx. TYPES booking_id TYPE /dmo/booking_id16. TYPES action_code TYPE /dmo/action_code16. INCLUDE TYPE ts_booking_intx. TYPES END OF ts_booking_inx. "! INcoming flag table type of the node Booking. It contains key and the bit flag to the corresponding fields. TYPES tt_booking_inx TYPE SORTED TABLE OF ts_booking_inx WITH UNIQUE KEY booking_id. "! INcoming flag structure of the node Booking Supplement. It contains key and the bit flag to the corresponding fields.<br/> "! The BAPI like function modules always refer to a single travel. "! Therefore the Travel ID is not required in the subnode tables. TYPES BEGIN OF ts_booking_supplement_inx. TYPES booking_id TYPE /dmo/booking_id16. TYPES booking_supplement_id TYPE /dmo/booking_supplement_id16. TYPES action_code TYPE /dmo/action_code16. INCLUDE TYPE ts_booking_supplement_intx. TYPES END OF ts_booking_supplement_inx. "! INcoming flag table type of the node Booking Supplement. It contains key and the bit flag to the corresponding fields. TYPES tt_booking_supplement_inx TYPE SORTED TABLE OF ts_booking_supplement_inx WITH UNIQUE KEY booking_id booking_supplement_id. ***************** * Message table * ***************** "! Table of messages TYPES tt_message TYPE STANDARD TABLE OF symsg. "! Table of messages like T100. <br/> "! We have only error messages. "! Currently we do not communicate Warnings or Success Messages. "! Internally we use a table of exceptions. TYPES tt_if_t100_message TYPE STANDARD TABLE OF REF TO if_t100_message WITH EMPTY KEY. ENDINTERFACE.
44.348485
143
0.67629
c82fd9b8d5ecab2e512142fc3d15f511ca20ef01
964
abap
ABAP
src/zcl_alog_adt_logger.clas.locals_def.abap
pcf0/abap-log
f3e5d269b52f05fe03fe152c5f8e88f8bf3b1080
[ "MIT" ]
27
2017-05-04T20:16:58.000Z
2022-02-11T17:56:17.000Z
src/zcl_alog_adt_logger.clas.locals_def.abap
pcf0/abap-log
f3e5d269b52f05fe03fe152c5f8e88f8bf3b1080
[ "MIT" ]
13
2017-04-23T15:35:10.000Z
2019-09-03T17:10:04.000Z
src/zcl_alog_adt_logger.clas.locals_def.abap
pcf0/abap-log
f3e5d269b52f05fe03fe152c5f8e88f8bf3b1080
[ "MIT" ]
14
2017-11-20T10:53:29.000Z
2022-02-17T13:45:58.000Z
"! Internal adapter class for <em>IF_OO_ADT_INTRNL_CLASSRUN</em> CLASS lcl_adapter DEFINITION. PUBLIC SECTION. METHODS: constructor IMPORTING io_out TYPE REF TO object RAISING zcx_alog_argument_null zcx_alog_illegal_argument, write IMPORTING ig_data TYPE any iv_name TYPE string OPTIONAL, write_data IMPORTING ig_value TYPE data iv_name TYPE string OPTIONAL, write_text IMPORTING iv_text TYPE clike, line, begin_section IMPORTING iv_title TYPE clike OPTIONAL. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: gc_out_intfname TYPE abap_intfname VALUE 'IF_OO_ADT_INTRNL_CLASSRUN'. CLASS-METHODS: get_full_method_name IMPORTING iv_method TYPE abap_methname RETURNING VALUE(rv_full_methname) TYPE abap_methname. DATA: mo_out TYPE REF TO object. ENDCLASS.
38.56
80
0.6639
c83249f5c1b88e4facd6579e4a14a4782e493c38
7,799
abap
ABAP
src/managed/#dmo#bp_booking_m.clas.locals_imp.abap
dev-beert-io/sap_demo
7c6b1ef1e961fa9652ca3f65b139f4536a1d74cf
[ "BSD-Source-Code" ]
null
null
null
src/managed/#dmo#bp_booking_m.clas.locals_imp.abap
dev-beert-io/sap_demo
7c6b1ef1e961fa9652ca3f65b139f4536a1d74cf
[ "BSD-Source-Code" ]
null
null
null
src/managed/#dmo#bp_booking_m.clas.locals_imp.abap
dev-beert-io/sap_demo
7c6b1ef1e961fa9652ca3f65b139f4536a1d74cf
[ "BSD-Source-Code" ]
null
null
null
CLASS lhc_travel DEFINITION INHERITING FROM cl_abap_behavior_handler. PRIVATE SECTION. METHODS calculate_total_flight_price FOR DETERMINATION booking~calculateTotalFlightPrice IMPORTING keys FOR booking. METHODS validate_booking_status FOR VALIDATION booking~validateStatus IMPORTING keys FOR booking. METHODS get_features FOR FEATURES IMPORTING keys REQUEST requested_features FOR booking RESULT result. METHODS create_booking_supplement FOR MODIFY IMPORTING keys FOR ACTION booking~createBookingSupplement RESULT result. * METHODS check_authority_for_booking FOR AUTHORIZATION IMPORTING it_booking_key REQUEST is_request FOR booking RESULT result. ENDCLASS. CLASS lhc_travel IMPLEMENTATION. ******************************************************************************** * * Calculates total flight price * ******************************************************************************** METHOD calculate_total_flight_price. IF keys IS NOT INITIAL. /dmo/cl_travel_auxiliary_m=>calculate_price( it_travel_id = VALUE #( FOR GROUPS <booking> OF booking_key IN keys GROUP BY booking_key-travel_id WITHOUT MEMBERS ( <booking> ) ) ). ENDIF. ENDMETHOD. ********************************************************************** * * Validates booking status when saving booking data * ********************************************************************** METHOD validate_booking_status. READ ENTITY /DMO/I_Travel_M\\booking FROM VALUE #( FOR <root_key> IN keys ( %key = <root_key> %control = VALUE #( booking_status = if_abap_behv=>mk-on ) ) ) RESULT DATA(lt_booking_result). LOOP AT lt_booking_result INTO DATA(ls_booking_result). CASE ls_booking_result-booking_status. WHEN 'N'. " New WHEN 'X'. " Canceled WHEN 'B'. " Booked WHEN OTHERS. APPEND VALUE #( %key = ls_booking_result-%key ) TO failed. APPEND VALUE #( %key = ls_booking_result-%key %msg = new_message( id = /dmo/cx_flight_legacy=>status_is_not_valid-msgid number = /dmo/cx_flight_legacy=>status_is_not_valid-msgno v1 = ls_booking_result-booking_status severity = if_abap_behv_message=>severity-error ) %element-booking_status = if_abap_behv=>mk-on ) TO reported. ENDCASE. ENDLOOP. ENDMETHOD. ******************************************************************************** * * Triggers feature control for booking data * ******************************************************************************** METHOD get_features. READ ENTITY /dmo/i_booking_m FROM VALUE #( FOR keyval IN keys ( %key = keyval-%key %control-booking_id = if_abap_behv=>mk-on %control-booking_date = if_abap_behv=>mk-on %control-customer_id = if_abap_behv=>mk-on ) ) RESULT DATA(lt_booking_result). result = VALUE #( FOR ls_travel IN lt_booking_result ( %key = ls_travel-%key %field-booking_id = if_abap_behv=>fc-f-read_only %field-booking_date = if_abap_behv=>fc-f-read_only %field-customer_id = if_abap_behv=>fc-f-read_only "%features-%delete = if_abap_behv=>fc-o-disabled " Workaround for missing determinations OnDelete ) ). ENDMETHOD. ******************************************************************************** * * Workaround * ******************************************************************************** METHOD create_booking_supplement. DATA: lv_next_booksuppl_id TYPE /dmo/booking_supplement_id. LOOP AT keys INTO DATA(ls_cba). READ ENTITY /DMO/I_Booking_M BY \_BookSupplement FROM VALUE #( ( travel_id = ls_cba-travel_id booking_id = ls_cba-booking_id %control = VALUE #( travel_id = if_abap_behv=>mk-on booking_id = if_abap_behv=>mk-on ) ) ) RESULT DATA(lt_read_result) FAILED DATA(ls_read_failed) REPORTED DATA(ls_read_reported). IF lt_read_result IS INITIAL. lv_next_booksuppl_id = '01'. ELSE. SORT lt_read_result BY booking_supplement_id DESCENDING. lv_next_booksuppl_id = lt_read_result[ 1 ]-booking_supplement_id + 1. ENDIF. "MODIFY ENTITY /DMO/I_Booking_M MODIFY ENTITIES OF /dmo/i_travel_m IN LOCAL MODE ENTITY booking CREATE BY \_BookSupplement FROM VALUE #( ( travel_id = ls_cba-travel_id booking_id = ls_cba-booking_id %target = VALUE #( ( travel_id = ls_cba-travel_id "full key is required booking_id = ls_cba-booking_id "full key is required booking_supplement_id = lv_next_booksuppl_id supplement_id = 'ML-0012' price = '17.00' currency_code = 'EUR' %control-travel_id = if_abap_behv=>mk-on %control-booking_id = if_abap_behv=>mk-on %control-booking_supplement_id = if_abap_behv=>mk-on %control-supplement_id = if_abap_behv=>mk-on %control-price = if_abap_behv=>mk-on %control-currency_code = if_abap_behv=>mk-on ) ) ) ) FAILED DATA(ls_failed) MAPPED DATA(ls_mapped) REPORTED DATA(ls_reported). APPEND LINES OF ls_failed-booksuppl TO failed-booksuppl. APPEND LINES OF ls_reported-booksuppl TO reported-booksuppl. APPEND VALUE #( travel_id = ls_cba-travel_id booking_id = ls_cba-booking_id %param-travel_id = ls_cba-travel_id %param-booking_id = ls_cba-booking_id ) TO result. ENDLOOP. ENDMETHOD. * METHOD check_authority_for_booking. * * LOOP AT it_booking_key INTO DATA(ls_booking_key). * * result = VALUE #( ( travel_id = ls_booking_key-travel_id * booking_id = ls_booking_key-booking_id * %action-createBookingSupplement = if_abap_behv=>auth-unauthorized * ) ). * * ENDLOOP. * * ENDMETHOD. ENDCLASS.
46.147929
151
0.464547
c83698d9e4e7aebb2a6e974f6c0500b883ea0629
4,257
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ee_dl_item_pa.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
3
2021-07-08T07:16:53.000Z
2021-10-18T07:56:18.000Z
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ee_dl_item_pa.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ee_dl_item_pa.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
FUNCTION zgtt_mia_ee_dl_item_pa. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM *" REFERENCE(I_EVENT_TYPE) TYPE /SAPTRX/EVTYPES *" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER *" REFERENCE(I_EVENT_TYPE_CNTL_TABS) TYPE TRXAS_EVENTTYPE_TABS *" REFERENCE(I_EVENTS) TYPE TRXAS_EVT_CTABS *" TABLES *" CT_TRACKINGHEADER STRUCTURE /SAPTRX/BAPI_EVM_HEADER *" CT_TRACKLOCATION STRUCTURE /SAPTRX/BAPI_EVM_LOCATIONID *" OPTIONAL *" CT_TRACKADDRESS STRUCTURE /SAPTRX/BAPI_EVM_ADDRESS OPTIONAL *" CT_TRACKLOCATIONDESCR STRUCTURE /SAPTRX/BAPI_EVM_LOCDESCR *" OPTIONAL *" CT_TRACKLOCADDITIONALID STRUCTURE /SAPTRX/BAPI_EVM_LOCADDID *" OPTIONAL *" CT_TRACKPARTNERID STRUCTURE /SAPTRX/BAPI_EVM_PARTNERID *" OPTIONAL *" CT_TRACKPARTNERADDID STRUCTURE /SAPTRX/BAPI_EVM_PARTNERADDID *" OPTIONAL *" CT_TRACKESTIMDEADLINE STRUCTURE /SAPTRX/BAPI_EVM_ESTIMDEADL *" OPTIONAL *" CT_TRACKCONFIRMSTATUS STRUCTURE /SAPTRX/BAPI_EVM_CONFSTAT *" OPTIONAL *" CT_TRACKNEXTEVENT STRUCTURE /SAPTRX/BAPI_EVM_NEXTEVENT *" OPTIONAL *" CT_TRACKNEXTEVDEADLINES STRUCTURE /SAPTRX/BAPI_EVM_NEXTEVDEADL *" OPTIONAL *" CT_TRACKREFERENCES STRUCTURE /SAPTRX/BAPI_EVM_REFERENCE *" OPTIONAL *" CT_TRACKMEASURESULTS STRUCTURE /SAPTRX/BAPI_EVM_MEASRESULT *" OPTIONAL *" CT_TRACKSTATUSATTRIB STRUCTURE /SAPTRX/BAPI_EVM_STATUSATTR *" OPTIONAL *" CT_TRACKPARAMETERS STRUCTURE /SAPTRX/BAPI_EVM_PARAMETERS *" OPTIONAL *" CT_TRACKFILEHEADER STRUCTURE /SAPTRX/BAPI_EVM_FILEHEADER *" OPTIONAL *" CT_TRACKFILEREF STRUCTURE /SAPTRX/BAPI_EVM_FILEREF OPTIONAL *" CT_TRACKFILEBIN STRUCTURE /SAPTRX/BAPI_EVM_FILEBIN OPTIONAL *" CT_TRACKFILECHAR STRUCTURE /SAPTRX/BAPI_EVM_FILECHAR OPTIONAL *" CT_TRACKTEXTHEADER STRUCTURE /SAPTRX/BAPI_EVM_TEXTHEADER *" OPTIONAL *" CT_TRACKTEXTLINES STRUCTURE /SAPTRX/BAPI_EVM_TEXTLINES *" OPTIONAL *" CT_TRACKEEMODIFY STRUCTURE /SAPTRX/BAPI_EVM_EE_MODIFY OPTIONAL *" CT_EXTENSIONIN STRUCTURE BAPIPAREX OPTIONAL *" CT_EXTENSIONOUT STRUCTURE BAPIPAREX OPTIONAL *" CT_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL *" CHANGING *" REFERENCE(C_EVENTID_MAP) TYPE TRXAS_EVTID_EVTCNT_MAP *" EXCEPTIONS *" PARAMETER_ERROR *" EVENT_DATA_ERROR *" STOP_PROCESSING *"---------------------------------------------------------------------- DATA: lo_udm_message TYPE REF TO cx_udm_message, ls_bapiret TYPE bapiret2. TRY. zcl_gtt_mia_ae_performer=>get_event_data( EXPORTING is_definition = VALUE #( maintab = zif_gtt_mia_app_constants=>cs_tabledef-dl_item_new mastertab = zif_gtt_mia_app_constants=>cs_tabledef-dl_header_new ) io_ae_factory = NEW zcl_gtt_mia_ae_factory_dli_pa( ) iv_appsys = i_appsys is_event_type = i_event_type it_all_appl_tables = i_all_appl_tables it_event_type_cntl_tabs = i_event_type_cntl_tabs it_events = i_events CHANGING ct_eventid_map = c_eventid_map[] ct_trackingheader = ct_trackingheader[] ct_tracklocation = ct_tracklocation[] ct_trackreferences = ct_trackreferences[] ct_trackparameters = ct_trackparameters[] ). CATCH cx_udm_message INTO lo_udm_message. zcl_gtt_mia_tools=>get_errors_log( EXPORTING io_umd_message = lo_udm_message iv_appsys = i_appsys IMPORTING es_bapiret = ls_bapiret ). " add error message APPEND ls_bapiret TO ct_logtable. " throw corresponding exception CASE lo_udm_message->textid. WHEN zif_gtt_mia_ef_constants=>cs_errors-stop_processing. RAISE stop_processing. WHEN zif_gtt_mia_ef_constants=>cs_errors-table_determination. RAISE event_data_error. ENDCASE. ENDTRY. ENDFUNCTION.
40.932692
102
0.661499
c83a6d79a64f16d8f84671eb09ff2d27bffafc67
4,802
abap
ABAP
src/objects/zcl_abapgit_object_scvi.clas.abap
IvxLars/abapGit
bcdeebb3ad1432034b5ad1ea40683470956b8e07
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/objects/zcl_abapgit_object_scvi.clas.abap
IvxLars/abapGit
bcdeebb3ad1432034b5ad1ea40683470956b8e07
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/objects/zcl_abapgit_object_scvi.clas.abap
IvxLars/abapGit
bcdeebb3ad1432034b5ad1ea40683470956b8e07
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
CLASS zcl_abapgit_object_scvi DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_screen_variant, shdsvci TYPE shdsvci, shdsvtxci TYPE STANDARD TABLE OF shdsvtxci WITH DEFAULT KEY, shdsvfvci TYPE STANDARD TABLE OF shdsvfvci WITH DEFAULT KEY, shdguixt TYPE STANDARD TABLE OF shdguixt WITH DEFAULT KEY, shdgxtcode TYPE STANDARD TABLE OF shdgxtcode WITH DEFAULT KEY, END OF ty_screen_variant . ENDCLASS. CLASS zcl_abapgit_object_scvi IMPLEMENTATION. METHOD zif_abapgit_object~changed_by. DATA: lv_screen_variant TYPE scvariant. lv_screen_variant = ms_item-obj_name. SELECT SINGLE chuser FROM shdsvci INTO rv_user WHERE scvariant = lv_screen_variant. IF sy-subrc <> 0 OR rv_user IS INITIAL. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lv_screen_variant TYPE scvariant. lv_screen_variant = ms_item-obj_name. CALL FUNCTION 'RS_HDSYS_DELETE_SC_VARIANT' EXPORTING scvariant = lv_screen_variant EXCEPTIONS variant_enqueued = 1 no_correction = 2 scvariant_used = 3 OTHERS = 4. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: ls_screen_variant TYPE ty_screen_variant. DATA: lv_text TYPE natxt. io_xml->read( EXPORTING iv_name = 'SCVI' CHANGING cg_data = ls_screen_variant ). CALL FUNCTION 'ENQUEUE_ESSCVARCIU' EXPORTING scvariant = ls_screen_variant-shdsvci-scvariant EXCEPTIONS OTHERS = 01. IF sy-subrc <> 0. MESSAGE e413(ms) WITH ls_screen_variant-shdsvci-scvariant INTO lv_text. zcx_abapgit_exception=>raise_t100( ). ENDIF. corr_insert( iv_package = iv_package ). * Populate user details ls_screen_variant-shdsvci-crdate = sy-datum. ls_screen_variant-shdsvci-cruser = sy-uname. ls_screen_variant-shdsvci-chdate = sy-datum. ls_screen_variant-shdsvci-chuser = sy-uname. MODIFY shdsvci FROM ls_screen_variant-shdsvci. MODIFY shdsvtxci FROM TABLE ls_screen_variant-shdsvtxci[]. MODIFY shdsvfvci FROM TABLE ls_screen_variant-shdsvfvci[]. MODIFY shdguixt FROM TABLE ls_screen_variant-shdguixt[]. MODIFY shdgxtcode FROM TABLE ls_screen_variant-shdgxtcode[]. CALL FUNCTION 'DEQUEUE_ESSCVARCIU' EXPORTING scvariant = ls_screen_variant-shdsvci-scvariant. ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_screen_variant TYPE scvariant. lv_screen_variant = ms_item-obj_name. CALL FUNCTION 'RS_HDSYS_READ_SC_VARIANT_DB' EXPORTING scvariant = lv_screen_variant EXCEPTIONS no_variant = 1 OTHERS = 2. rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_screen_variant TYPE ty_screen_variant. ls_screen_variant-shdsvci-scvariant = ms_item-obj_name. CALL FUNCTION 'RS_HDSYS_READ_SC_VARIANT_DB' EXPORTING scvariant = ls_screen_variant-shdsvci-scvariant IMPORTING header_scvariant = ls_screen_variant-shdsvci TABLES values_scvariant = ls_screen_variant-shdsvfvci[] guixt_scripts = ls_screen_variant-shdguixt[] EXCEPTIONS no_variant = 1 OTHERS = 2. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. * Clear all user details CLEAR: ls_screen_variant-shdsvci-crdate, ls_screen_variant-shdsvci-cruser, ls_screen_variant-shdsvci-chdate, ls_screen_variant-shdsvci-chuser. SELECT * FROM shdsvtxci INTO TABLE ls_screen_variant-shdsvtxci[] WHERE scvariant = ls_screen_variant-shdsvci-scvariant. SELECT * FROM shdgxtcode INTO TABLE ls_screen_variant-shdgxtcode[] WHERE scvariant = ls_screen_variant-shdsvci-scvariant. io_xml->add( iv_name = 'SCVI' ig_data = ls_screen_variant ). ENDMETHOD. ENDCLASS.
23.539216
77
0.697834
c83c652ae0bfac29ea2f2f39c235f24d74c3781c
284,306
abap
ABAP
src/legacy/#dmo#cl_flight_legacy29.clas.testclasses.abap
SAP-Cloud-Platform/flight29
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#cl_flight_legacy29.clas.testclasses.abap
SAP-Cloud-Platform/flight29
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#cl_flight_legacy29.clas.testclasses.abap
SAP-Cloud-Platform/flight29
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
[ "BSD-Source-Code" ]
null
null
null
CLASS ltcl_lock_travel DEFINITION DEFERRED. CLASS /dmo/cl_flight_legacy29 DEFINITION LOCAL FRIENDS ltcl_lock_travel. CLASS ltcl_lock_travel DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. METHODS: got_lock FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_lock_travel IMPLEMENTATION. METHOD got_lock ##NEEDED. ENDMETHOD. ENDCLASS. CLASS ltc_travel DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PROTECTED SECTION. CONSTANTS mc_use_sql_doubles TYPE abap_bool VALUE abap_false. CONSTANTS mc_msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_29'. * SQL doubles currently not available in cloud environment * CLASS-DATA mr_test_environment TYPE REF TO if_osql_test_environment. CLASS-DATA gr_cut TYPE REF TO /dmo/cl_flight_legacy29. CLASS-DATA gv_agency_id_1 TYPE /dmo/agency_id29. CLASS-DATA gv_agency_id_2 TYPE /dmo/agency_id29. CLASS-DATA gv_agency_id_unknown TYPE /dmo/agency_id29. CLASS-DATA gv_customer_id_1 TYPE /dmo/customer_id29. CLASS-DATA gv_customer_id_2 TYPE /dmo/customer_id29. CLASS-DATA gv_customer_id_unknown TYPE /dmo/customer_id29. METHODS _create_travel IMPORTING is_travel TYPE /dmo/if_flight_legacy29=>ts_travel_in iv_save TYPE abap_bool DEFAULT abap_true RETURNING VALUE(rs_travel) TYPE /dmo/travel29. METHODS _delete_existing_travel IMPORTING iv_travel_id TYPE /dmo/travel_id29. PRIVATE SECTION. DATA mv_travel_count TYPE i. DATA mv_booking_count TYPE i. DATA mv_booking_supplement_count TYPE i. CLASS-METHODS class_setup. METHODS setup. METHODS teardown. CLASS-METHODS class_teardown. "! Create and check a single travel METHODS create FOR TESTING RAISING cx_static_check. "! Try to create a travel with an unknown agency -> ERROR METHODS c_agency_unknown FOR TESTING RAISING cx_static_check. "! Try to create a travel with an unknown customer -> ERROR METHODS c_customer_unknown FOR TESTING RAISING cx_static_check. "! Create 2 travels in the same LUW METHODS create_mutiple_calls FOR TESTING RAISING cx_static_check. "! Create a single travel METHODS create_single FOR TESTING RAISING cx_static_check. "! Delete a single travel METHODS delete_single FOR TESTING RAISING cx_static_check. "! Update a single travel METHODS update_single FOR TESTING RAISING cx_static_check. "! Try to delete a single travel with unknown Travel ID -> ERROR METHODS d_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Try to update a single travel with unknown Travel ID -> ERROR METHODS u_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Delete multiple travels METHODS delete_multiple FOR TESTING RAISING cx_static_check. "! Update multiple travels METHODS update_multiple FOR TESTING RAISING cx_static_check. "! Update a single travel twice in the same LUW METHODS update_twice FOR TESTING RAISING cx_static_check. "! Update, delete a single travel in the same LUW METHODS update_delete_single FOR TESTING RAISING cx_static_check. "! Try to update a single travel with an unknown agency -> ERROR METHODS u_agency_unknown FOR TESTING RAISING cx_static_check. "! Try to update a single travel with an unknown customer -> ERROR METHODS u_customer_unknown FOR TESTING RAISING cx_static_check. "! Try to delete a single travel with an initial Travel ID -> ERROR METHODS d_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to update a single travel with an initial Travel ID -> ERROR METHODS u_travel_id_initial FOR TESTING RAISING cx_static_check. "! Call action to set booking status METHODS act_set_status_to_booked FOR TESTING RAISING cx_static_check. "! Try to create a travel with faulty dates -> Error METHODS c_dates_invalid FOR TESTING RAISING cx_static_check. "! Try to update a travel with faulty dates -> Error METHODS u_dates_invalid FOR TESTING RAISING cx_static_check. "! Reset buffer METHODS initialize FOR TESTING RAISING cx_static_check. "! Create, update a single travel in the same LUW METHODS create_update_in_one_luw FOR TESTING RAISING cx_static_check. "! Create, delete a single travel in the same LUW METHODS create_delete_in_one_luw FOR TESTING RAISING cx_static_check. "! Update, delete a single travel in the same LUW METHODS update_delete_in_one_luw FOR TESTING RAISING cx_static_check. "! Try to delete, update a single travel in the same LUW -> ERROR METHODS delete_update_in_one_luw FOR TESTING RAISING cx_static_check. "! Delete, delete a single travel in the same LUW -> Error METHODS delete_delete_in_one_luw FOR TESTING RAISING cx_static_check. "! Try to update a travel with no control structure -> ERROR METHODS u_no_control FOR TESTING RAISING cx_static_check. "! Try to change the travel status to an invalid value -> ERROR METHODS u_status_invalid FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS /dmo/cl_flight_legacy29 DEFINITION LOCAL FRIENDS ltc_travel. CLASS ltc_travel IMPLEMENTATION. METHOD class_setup. IF mc_use_sql_doubles = abap_true ##BOOL_OK. * mr_test_environment = cl_osql_test_environment=>create( i_dependency_list = VALUE #( ( '/DMO/TRAVEL29' ) ( '/DMO/BOOKING29' ) ( '/DMO/BOOK_SUP_29' ) * ( '/DMO/AGENCY29' ) ( '/DMO/CUSTOMER29' ) ( '/DMO/FLIGHT29' ) ( '/DMO/SUPPLEME_29' ) ) ). * mr_test_environment->clear_doubles( ). * gv_agency_id_1 = '42'. * gv_agency_id_2 = '43'. * DATA lt_agency TYPE STANDARD TABLE OF /dmo/agency29. * lt_agency = VALUE #( ( agency_id = gv_agency_id_1 ) ( agency_id = gv_agency_id_2 ) ). * mr_test_environment->insert_test_data( lt_agency ). * * gv_customer_id_1 = '42'. * gv_customer_id_2 = '43'. * DATA lt_customer TYPE STANDARD TABLE OF /dmo/customer29. * lt_customer = VALUE #( ( customer_id = gv_customer_id_1 ) ( customer_id = gv_customer_id_2 ) ). * mr_test_environment->insert_test_data( lt_customer ). * * gv_agency_id_unknown = '99'. * gv_customer_id_unknown = '99'. ELSE. DATA lt_agency_id TYPE SORTED TABLE OF /dmo/agency_id29 WITH UNIQUE KEY table_line. SELECT DISTINCT agency_id FROM /dmo/agency29 ORDER BY agency_id DESCENDING INTO TABLE @lt_agency_id . DATA lt_customer_id TYPE SORTED TABLE OF /dmo/customer_id29 WITH UNIQUE KEY table_line. SELECT DISTINCT customer_id FROM /dmo/customer29 ORDER BY customer_id DESCENDING INTO TABLE @lt_customer_id . " Select 2 known agency IDs IF lines( lt_agency_id ) < 2. cl_abap_unit_assert=>abort( msg = 'No agency data!' ). ENDIF. gv_agency_id_1 = lt_agency_id[ 1 ]. gv_agency_id_2 = lt_agency_id[ 2 ]. cl_abap_unit_assert=>assert_differs( act = gv_agency_id_1 exp = gv_agency_id_2 )." To be totally sure " Select 2 known customer IDs IF lines( lt_customer_id ) < 2. cl_abap_unit_assert=>abort( msg = 'No customer data!' ). ENDIF. gv_customer_id_1 = lt_customer_id[ 1 ]. gv_customer_id_2 = lt_customer_id[ 2 ]. cl_abap_unit_assert=>assert_differs( act = gv_customer_id_1 exp = gv_customer_id_2 )." To be totally sure " Determine an unknown agency ID gv_agency_id_unknown = lt_agency_id[ 1 ]. DO. gv_agency_id_unknown = gv_agency_id_unknown + 1. READ TABLE lt_agency_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = gv_agency_id_unknown. IF sy-subrc <> 0. EXIT. ENDIF. ENDDO. " Determine an unknown customer ID gv_customer_id_unknown = lt_customer_id[ 1 ]. DO. gv_customer_id_unknown = gv_customer_id_unknown + 1. READ TABLE lt_customer_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = gv_customer_id_unknown. IF sy-subrc <> 0. EXIT. ENDIF. ENDDO. ENDIF. gr_cut = NEW #( ). ENDMETHOD. METHOD setup. SELECT COUNT( * ) FROM /dmo/travel29 INTO @mv_travel_count. SELECT COUNT( * ) FROM /dmo/booking29 INTO @mv_booking_count. SELECT COUNT( * ) FROM /dmo/book_sup_29 INTO @mv_booking_supplement_count. ENDMETHOD. METHOD teardown. " Ensure proper cleanup of each individual test method SELECT COUNT( * ) FROM /dmo/travel29 INTO @DATA(lv_travel_count). cl_abap_unit_assert=>assert_equals( act = lv_travel_count exp = mv_travel_count ). SELECT COUNT( * ) FROM /dmo/booking29 INTO @DATA(lv_booking_count). cl_abap_unit_assert=>assert_equals( act = lv_booking_count exp = mv_booking_count ). SELECT COUNT( * ) FROM /dmo/book_sup_29 INTO @DATA(lv_booking_supplement_count). cl_abap_unit_assert=>assert_equals( act = lv_booking_supplement_count exp = mv_booking_supplement_count ). ENDMETHOD. METHOD class_teardown. IF mc_use_sql_doubles = abap_true ##BOOL_OK ##NEEDED. * mr_test_environment->destroy( ). ENDIF. ENDMETHOD. METHOD create. SELECT COUNT( * ) FROM /dmo/travel29 INTO @DATA(lv_count1). DATA lv_start TYPE timestampl. GET TIME STAMP FIELD lv_start. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' ) IMPORTING es_travel = DATA(ls_travel_new) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel_new-travel_id ). gr_cut->save( ). DATA lv_end TYPE timestampl. GET TIME STAMP FIELD lv_end. SELECT COUNT( * ) FROM /dmo/travel29 INTO @DATA(lv_count2). cl_abap_unit_assert=>assert_equals( msg = 'create should add a travel' exp = 1 act = lv_count2 - lv_count1 ). SELECT * FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO TABLE @DATA(lt_travel). cl_abap_unit_assert=>assert_equals( msg = 'cannot read created travel' exp = 1 act = lines( lt_travel ) ). DATA(ls_travel) = lt_travel[ 1 ]. cl_abap_unit_assert=>assert_equals( msg = 'createdby' exp = ls_travel-createdby act = sy-uname ). cl_abap_unit_assert=>assert_number_between( msg = 'createdat' number = ls_travel-createdat lower = lv_start upper = lv_end ). cl_abap_unit_assert=>assert_equals( msg = 'status' act = ls_travel-status exp = CONV /dmo/travel_status29( /dmo/if_flight_legacy29=>travel_status-new ) ). _delete_existing_travel( ls_travel_new-travel_id ). ENDMETHOD. METHOD create_mutiple_calls. DATA lv_start TYPE timestampl. GET TIME STAMP FIELD lv_start. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' ) IMPORTING es_travel = DATA(ls_travel_1) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel_1-travel_id ). gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' ) IMPORTING es_travel = DATA(ls_travel_2) et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel_2-travel_id ). cl_abap_unit_assert=>assert_false( xsdbool( ls_travel_1-travel_id = ls_travel_2-travel_id ) ). gr_cut->save( ). DATA lv_end TYPE timestampl. GET TIME STAMP FIELD lv_end. SELECT * FROM /dmo/travel29 WHERE travel_id = @ls_travel_1-travel_id OR travel_id = @ls_travel_2-travel_id INTO TABLE @DATA(lt_travel) ##SELECT_FAE_WITH_LOB[DESCRIPTION]. cl_abap_unit_assert=>assert_equals( msg = 'cannot read created travel' exp = 2 act = lines( lt_travel ) ). DATA(ls_travel) = lt_travel[ 1 ]. cl_abap_unit_assert=>assert_equals( msg = 'createdby' exp = ls_travel-createdby act = sy-uname ). cl_abap_unit_assert=>assert_number_between( msg = 'createdat' number = ls_travel-createdat lower = lv_start upper = lv_end ). cl_abap_unit_assert=>assert_equals( msg = 'status' act = ls_travel-status exp = CONV /dmo/travel_status29( /dmo/if_flight_legacy29=>travel_status-new ) ). _delete_existing_travel( ls_travel_1-travel_id ). _delete_existing_travel( ls_travel_2-travel_id ). ENDMETHOD. METHOD c_agency_unknown. SELECT COUNT( * ) FROM /dmo/travel29 INTO @DATA(lv_count1). gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_unknown customer_id = gv_customer_id_2 ) IMPORTING es_travel = DATA(ls_travel) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( ls_travel-travel_id ). gr_cut->save( ). SELECT COUNT( * ) FROM /dmo/travel29 INTO @DATA(lv_count2). cl_abap_unit_assert=>assert_equals( msg = 'should not create bad travel' exp = lv_count1 act = lv_count2 ). DATA lv_msg_found TYPE abap_bool. LOOP AT lt_messages INTO DATA(lr_message) ##INTO_OK. IF lr_message->t100key = /dmo/cx_flight_legacy29=>agency_unkown. lv_msg_found = abap_true. ENDIF. ENDLOOP. cl_abap_unit_assert=>assert_equals( msg = 'missing error' exp = abap_true act = lv_msg_found ). ENDMETHOD. METHOD c_customer_unknown. SELECT COUNT( * ) FROM /dmo/travel29 INTO @DATA(lv_count1). gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_unknown ) IMPORTING es_travel = DATA(ls_travel) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( ls_travel-travel_id ). gr_cut->save( ). SELECT COUNT( * ) FROM /dmo/travel29 INTO @DATA(lv_count2). cl_abap_unit_assert=>assert_equals( msg = 'should not create bad travel' exp = lv_count1 act = lv_count2 ). DATA lv_msg_found TYPE abap_bool. LOOP AT lt_messages INTO DATA(lr_message) ##INTO_OK. IF lr_message->t100key = /dmo/cx_flight_legacy29=>customer_unkown. lv_msg_found = abap_true. ENDIF. ENDLOOP. cl_abap_unit_assert=>assert_equals( msg = 'missing error' exp = abap_true act = lv_msg_found ). ENDMETHOD. METHOD create_single. DATA lv_timestampl TYPE timestampl. GET TIME STAMP FIELD lv_timestampl. SELECT MAX( travel_id ) FROM /dmo/travel29 INTO @DATA(lv_travel_id_max). DATA lv_travel_id_1 TYPE /dmo/travel_id29. DATA lv_travel_id_2 TYPE /dmo/travel_id29. lv_travel_id_1 = lv_travel_id_max + 1. IF lv_travel_id_1 IS INITIAL. cl_abap_unit_assert=>abort( msg = 'Travel ID overflow!' ). ENDIF. lv_travel_id_2 = lv_travel_id_max + 2. IF lv_travel_id_2 IS INITIAL. cl_abap_unit_assert=>abort( msg = 'Travel ID overflow!' ). ENDIF. " Create a travel cl_abap_unit_assert=>assert_equals( act = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' status = /dmo/if_flight_legacy29=>travel_status-booked ) )-travel_id exp = lv_travel_id_1 ). " Create a second travel cl_abap_unit_assert=>assert_equals( act = _create_travel( VALUE #( agency_id = gv_agency_id_2 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' status = /dmo/if_flight_legacy29=>travel_status-booked ) )-travel_id exp = lv_travel_id_2 ). " Select and check the second travel DATA ls_travel_sel TYPE /dmo/travel29. SELECT SINGLE * FROM /dmo/travel29 WHERE travel_id = @lv_travel_id_2 INTO @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-agency_id exp = gv_agency_id_2 ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-customer_id exp = gv_customer_id_1 ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-status exp = CONV /dmo/travel_status29( /dmo/if_flight_legacy29=>travel_status-new ) )." Provided status overridden by determination cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-createdby exp = sy-uname ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-lastchangedby exp = sy-uname ). cl_abap_unit_assert=>assert_true( xsdbool( ls_travel_sel-createdat = ls_travel_sel-lastchangedat ) ). DATA(lv_diff) = CONV i( cl_abap_tstmp=>subtract( tstmp1 = ls_travel_sel-createdat tstmp2 = lv_timestampl ) ). cl_abap_unit_assert=>assert_true( xsdbool( 0 <= lv_diff AND lv_diff <= 1 ) ). _delete_existing_travel( lv_travel_id_1 ). _delete_existing_travel( lv_travel_id_2 ). ENDMETHOD. METHOD delete_single. DATA lv_db_exists TYPE abap_bool. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Description' ) ). cl_abap_unit_assert=>assert_equals( act = ls_travel_new-description exp = 'My_Description' ). SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO @DATA(lv_description). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new-description ). _delete_existing_travel( ls_travel_new-travel_id ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @ls_travel_new-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD update_single. DATA lv_timestampl TYPE timestampl. GET TIME STAMP FIELD lv_timestampl. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text' ) ). DATA ls_travel_sel TYPE /dmo/travel29. SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = ls_travel_new-description ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new-travel_id agency_id = gv_agency_id_unknown description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = ls_travel_new-travel_id description = abap_true ) IMPORTING es_travel = DATA(ls_travel_updated) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = ls_travel_updated-travel_id exp = ls_travel_new-travel_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_updated-description exp = 'My_New_Text' ). gr_cut->save( ). CLEAR ls_travel_sel. SELECT SINGLE * FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-agency_id exp = ls_travel_new-agency_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-customer_id exp = ls_travel_new-customer_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = 'My_New_Text' ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-lastchangedby exp = sy-uname ). cl_abap_unit_assert=>assert_differs( act = ls_travel_sel-createdat exp = ls_travel_sel-lastchangedat ). DATA(lv_diff) = cl_abap_tstmp=>subtract( tstmp1 = ls_travel_sel-lastchangedat tstmp2 = lv_timestampl ). cl_abap_unit_assert=>assert_true( xsdbool( 0 < lv_diff AND lv_diff < 1 ) ). _delete_existing_travel( ls_travel_new-travel_id ). ENDMETHOD. METHOD d_travel_id_unknown. DATA(ls_travel_deleted) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' ) ). _delete_existing_travel( ls_travel_deleted-travel_id ). gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel_deleted-travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel_deleted-travel_id ). ENDMETHOD. METHOD u_travel_id_unknown. DATA(ls_travel_deleted) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Old_Text' ) ). _delete_existing_travel( ls_travel_deleted-travel_id ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_deleted-travel_id description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = ls_travel_deleted-travel_id description = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel_deleted-travel_id ). ENDMETHOD. METHOD delete_multiple. DATA lv_db_exists TYPE abap_bool. DATA(ls_travel_new_1) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text_1' ) ). cl_abap_unit_assert=>assert_equals( act = ls_travel_new_1-description exp = 'My_Text_1' ). DATA(ls_travel_new_2) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text_2' ) ). DATA(ls_travel_new_3) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text_3' ) ). " Delete - only in buffer gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel_new_1-travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel_new_2-travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel_new_3-travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). DATA lv_description TYPE /dmo/description29. SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_1-travel_id INTO @lv_description. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new_1-description ). SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_2-travel_id INTO @lv_description. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new_2-description ). SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_3-travel_id INTO @lv_description. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new_3-description ). " Now persist the buffer gr_cut->save( ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id IN ( @ls_travel_new_1-travel_id, @ls_travel_new_2-travel_id, @ls_travel_new_3-travel_id ) INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD update_multiple. DATA(ls_travel_new_1) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text_1' ) ). DATA(ls_travel_new_2) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text_2' ) ). DATA(ls_travel_new_3) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text_3' ) ). DATA lv_description TYPE /dmo/description29. SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_1-travel_id INTO @lv_description. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new_1-description ). SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_2-travel_id INTO @lv_description. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new_2-description ). SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_3-travel_id INTO @lv_description. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new_3-description ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new_1-travel_id agency_id = gv_agency_id_unknown description = 'My_New_Text_1' ) is_travelx = VALUE #( travel_id = ls_travel_new_1-travel_id description = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new_2-travel_id agency_id = gv_agency_id_unknown description = 'My_New_Text_2' ) is_travelx = VALUE #( travel_id = ls_travel_new_2-travel_id description = abap_true ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new_3-travel_id agency_id = gv_agency_id_2 description = 'My_New_Text_3' ) is_travelx = VALUE #( travel_id = ls_travel_new_3-travel_id agency_id = abap_true ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). DATA ls_travel_sel TYPE /dmo/travel29. CLEAR ls_travel_sel. SELECT SINGLE agency_id, customer_id, description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_1-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-agency_id exp = ls_travel_new_1-agency_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-customer_id exp = ls_travel_new_1-customer_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = 'My_New_Text_1' ). CLEAR ls_travel_sel. SELECT SINGLE agency_id, customer_id, description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_2-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-agency_id exp = ls_travel_new_2-agency_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-customer_id exp = ls_travel_new_2-customer_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = 'My_New_Text_2' ). CLEAR ls_travel_sel. SELECT SINGLE agency_id, customer_id, description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new_3-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-agency_id exp = gv_agency_id_2 ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-customer_id exp = ls_travel_new_3-customer_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = 'My_Text_3' ). _delete_existing_travel( ls_travel_new_1-travel_id ). _delete_existing_travel( ls_travel_new_2-travel_id ). _delete_existing_travel( ls_travel_new_3-travel_id ). ENDMETHOD. METHOD update_twice. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text' ) ). DATA ls_travel_sel TYPE /dmo/travel29. SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = ls_travel_new-description ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new-travel_id agency_id = gv_agency_id_unknown description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = ls_travel_new-travel_id description = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new-travel_id agency_id = gv_agency_id_2 description = 'WHATEVER' ) is_travelx = VALUE #( travel_id = ls_travel_new-travel_id agency_id = abap_true ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR ls_travel_sel. SELECT SINGLE agency_id, customer_id, description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-agency_id exp = gv_agency_id_2 ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-customer_id exp = ls_travel_new-customer_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = 'My_New_Text' ). _delete_existing_travel( ls_travel_new-travel_id ). ENDMETHOD. METHOD update_delete_single. DATA lv_db_exists TYPE abap_bool. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Text' ) ). SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO @DATA(lv_description). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = ls_travel_new-description ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new-travel_id agency_id = gv_agency_id_unknown description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = ls_travel_new-travel_id description = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel_new-travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @ls_travel_new-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD u_agency_unknown. DATA(ls_travel) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id agency_id = gv_agency_id_unknown ) is_travelx = VALUE #( travel_id = ls_travel-travel_id agency_id = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>agency_unkown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_AGENCY_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_agency_id exp = gv_agency_id_unknown ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD u_customer_unknown. DATA(ls_travel) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id customer_id = gv_customer_id_unknown ) is_travelx = VALUE #( travel_id = ls_travel-travel_id customer_id = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>customer_unkown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CUSTOMER_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_customer_id exp = gv_customer_id_unknown ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD d_travel_id_initial. gr_cut->delete_travel( EXPORTING iv_travel_id = '0' IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD u_travel_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( ) is_travelx = VALUE #( ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD act_set_status_to_booked. DATA lv_timestampl TYPE timestampl. GET TIME STAMP FIELD lv_timestampl. " Case A: Known travel ID DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' ) ). DATA ls_travel_sel TYPE /dmo/travel29. SELECT SINGLE status FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-status exp = CONV /dmo/travel_status29( /dmo/if_flight_legacy29=>travel_status-new ) ). gr_cut->set_status_to_booked( EXPORTING iv_travel_id = ls_travel_new-travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR ls_travel_sel. SELECT SINGLE status, createdat, lastchangedby, lastchangedat FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-status exp = CONV /dmo/travel_status29( /dmo/if_flight_legacy29=>travel_status-booked ) ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-lastchangedby exp = sy-uname ). cl_abap_unit_assert=>assert_differs( act = ls_travel_sel-createdat exp = ls_travel_sel-lastchangedat ). DATA(lv_diff) = cl_abap_tstmp=>subtract( tstmp1 = ls_travel_sel-lastchangedat tstmp2 = lv_timestampl ). cl_abap_unit_assert=>assert_true( xsdbool( 0 < lv_diff AND lv_diff < 1 ) ). " Case B: Initial travel ID gr_cut->set_status_to_booked( EXPORTING iv_travel_id = '0' IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). " Case C: Unknown travel ID gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel_new-travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). " -- Deletion only in buffer gr_cut->set_status_to_booked( EXPORTING iv_travel_id = ls_travel_new-travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel_new-travel_id ). gr_cut->save( ). " -- Deletion send to DB gr_cut->set_status_to_booked( EXPORTING iv_travel_id = ls_travel_new-travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel_new-travel_id ). ENDMETHOD. METHOD c_dates_invalid. " Try with initial begin date gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 end_date = '20190101' ) IMPORTING es_travel = DATA(ls_travel) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>no_begin_date-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). " Try with initial end date gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' ) IMPORTING es_travel = ls_travel et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>no_end_date-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). " Try to have begin date after end date gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190201' end_date = '20190101' ) IMPORTING es_travel = ls_travel et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>end_date_before_begin_date-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_BEGIN_DATE' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_END_DATE' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_begin_date exp = '20190201' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_end_date exp = '20190101' ). ENDMETHOD. METHOD u_dates_invalid. DATA(ls_travel) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) ). " Try to clear begin date gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id ) is_travelx = VALUE #( travel_id = ls_travel-travel_id begin_date = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>no_begin_date-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel-travel_id ). " Try to clear end date gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id ) is_travelx = VALUE #( travel_id = ls_travel-travel_id end_date = abap_true ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>no_end_date-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel-travel_id ). " Try to have begin date after end date gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id end_date = '20181201' ) is_travelx = VALUE #( travel_id = ls_travel-travel_id end_date = abap_true ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>end_date_before_begin_date-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_BEGIN_DATE' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_END_DATE' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_begin_date exp = ls_travel-begin_date ). cl_abap_unit_assert=>assert_equals( act = lx->mv_end_date exp = '20181201' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel-travel_id ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD initialize. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Old_Text' ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel_new-travel_id description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = ls_travel_new-travel_id description = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->initialize( ). gr_cut->save( ). SELECT SINGLE description FROM /dmo/travel29 WHERE travel_id = @ls_travel_new-travel_id INTO @DATA(lv_description). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = 'My_Old_Text' ). _delete_existing_travel( ls_travel_new-travel_id ). ENDMETHOD. METHOD create_update_in_one_luw. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Old_Text' ) IMPORTING es_travel = DATA(ls_travel) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id agency_id = gv_agency_id_2 description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = ls_travel-travel_id description = abap_true ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). SELECT SINGLE agency_id, description FROM /dmo/travel29 WHERE travel_id = @ls_travel-travel_id INTO ( @DATA(lv_agency_id), @DATA(lv_description) ). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_agency_id exp = gv_agency_id_1 ). cl_abap_unit_assert=>assert_equals( act = lv_description exp = 'My_New_Text' ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD create_delete_in_one_luw. DATA lv_db_exits TYPE abap_bool. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Old_Text' ) IMPORTING es_travel = DATA(ls_travel) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel-travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR lv_db_exits. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exits. cl_abap_unit_assert=>assert_false( lv_db_exits ). ENDMETHOD. METHOD update_delete_in_one_luw. DATA lv_db_exits TYPE abap_bool. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Old_Text' ) ). DATA(lv_travel_id) = ls_travel_new-travel_id. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = lv_travel_id agency_id = gv_agency_id_2 description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = lv_travel_id description = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->delete_travel( EXPORTING iv_travel_id = lv_travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR lv_db_exits. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @lv_travel_id INTO @lv_db_exits. cl_abap_unit_assert=>assert_false( lv_db_exits ). ENDMETHOD. METHOD delete_update_in_one_luw. DATA lv_db_exits TYPE abap_bool. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Old_Text' ) ). DATA(lv_travel_id) = ls_travel_new-travel_id. gr_cut->delete_travel( EXPORTING iv_travel_id = lv_travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = lv_travel_id agency_id = gv_agency_id_2 description = 'My_New_Text' ) is_travelx = VALUE #( travel_id = lv_travel_id description = abap_true ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = lv_travel_id ). gr_cut->save( ). CLEAR lv_db_exits. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @lv_travel_id INTO @lv_db_exits. cl_abap_unit_assert=>assert_false( lv_db_exits ). ENDMETHOD. METHOD delete_delete_in_one_luw. DATA lv_db_exits TYPE abap_bool. DATA(ls_travel_new) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_2 begin_date = '20190101' end_date = '20190201' description = 'My_Old_Text' ) ). DATA(lv_travel_id) = ls_travel_new-travel_id. gr_cut->delete_travel( EXPORTING iv_travel_id = lv_travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->delete_travel( EXPORTING iv_travel_id = lv_travel_id IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = lv_travel_id ). gr_cut->save( ). CLEAR lv_db_exits. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @lv_travel_id INTO @lv_db_exits. cl_abap_unit_assert=>assert_false( lv_db_exits ). ENDMETHOD. METHOD u_no_control. DATA(ls_travel) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) ). " No control data at all gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id ) is_travelx = VALUE #( ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_control-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel-travel_id ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD u_status_invalid. CONSTANTS lc_status_invalid TYPE /dmo/travel_status29 VALUE 'Z'. DATA(ls_travel) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) ). " No control data at all gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id status = lc_status_invalid ) is_travelx = VALUE #( travel_id = ls_travel-travel_id status = abap_true ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_status_invalid-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_STATUS' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_status exp = lc_status_invalid ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD _create_travel. CLEAR rs_travel. gr_cut->create_travel( EXPORTING is_travel = is_travel IMPORTING es_travel = rs_travel et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( rs_travel-travel_id ). IF iv_save = abap_true. gr_cut->save( ). ENDIF. ENDMETHOD. METHOD _delete_existing_travel. gr_cut->delete_travel( EXPORTING iv_travel_id = iv_travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). ENDMETHOD. ENDCLASS. CLASS ltc_booking DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS INHERITING FROM ltc_travel. PROTECTED SECTION. TYPES: BEGIN OF ts_flight, carrier_id TYPE /dmo/carrier_id29, connection_id TYPE /dmo/connection_id29, flight_date TYPE /dmo/flight_date29, price TYPE /dmo/flight_price29, currency_code TYPE /dmo/currency_code29, END OF ts_flight. CLASS-DATA gs_flight_1 TYPE ts_flight. CLASS-DATA gs_flight_2 TYPE ts_flight. CLASS-DATA gv_carrier_id_unknown TYPE /dmo/carrier_id29. CLASS-DATA gv_currency_code_unknown TYPE /dmo/currency_code29. CLASS-DATA gv_booking_date TYPE /dmo/booking_date29. DATA mv_travel_id TYPE /dmo/travel_id29. DATA mv_travel_id_unknown TYPE /dmo/travel_id29. METHODS _create_booking IMPORTING iv_travel_id TYPE /dmo/travel_id29 is_booking TYPE /dmo/if_flight_legacy29=>ts_booking_in iv_save TYPE abap_bool DEFAULT abap_true RETURNING VALUE(rs_booking) TYPE /dmo/booking29. METHODS _delete_existing_booking IMPORTING iv_travel_id TYPE /dmo/travel_id29 iv_booking_id TYPE /dmo/booking_id29. PRIVATE SECTION. CLASS-METHODS class_setup. METHODS setup. METHODS teardown. "! Create, Update, Delete a single booking in 3 different LUWs METHODS c_u_d_single FOR TESTING RAISING cx_static_check. "! Create, Update a single booking in the same LUW, delete it in a second LUW METHODS cu_d_single FOR TESTING RAISING cx_static_check. "! Create, Update, Delete a single booking in the same LUW METHODS cud_single FOR TESTING RAISING cx_static_check. "! Create, (Update, Update), Delete a single booking in 3 different LUWs METHODS c_uu_d_single FOR TESTING RAISING cx_static_check. "! Try to create a booking with an unknown Travel ID -> ERROR METHODS c_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Try to create a booking with an initial Travel ID -> ERROR METHODS c_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to update a booking with an unknown Travel ID -> ERROR METHODS u_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking with an initial Travel ID -> ERROR METHODS u_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to delete a booking with an unknown Travel ID -> ERROR METHODS d_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Try to delete a booking with an initial Travel ID -> ERROR METHODS d_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to update a booking with an unknown Booking ID -> ERROR METHODS u_booking_id_unknown FOR TESTING RAISING cx_static_check. "! Try to delete a booking with an unknown Booking ID -> ERROR METHODS d_booking_id_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking with an initial Booking ID -> ERROR METHODS u_booking_id_initial FOR TESTING RAISING cx_static_check. "! Try to delete a booking with an initial Booking ID -> ERROR METHODS d_booking_id_initial FOR TESTING RAISING cx_static_check. "! Create, update, delete a single travel with bookings in 3 different LUWs METHODS c_u_d_travel_w_bookings FOR TESTING RAISING cx_static_check. "! Try to create a booking with an unknown customer -> ERROR METHODS c_customer_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking with an unknown customer -> ERROR METHODS u_customer_unknown FOR TESTING RAISING cx_static_check. "! Try to create a booking with a booking date in the past -> ERROR METHODS c_booking_date_past FOR TESTING RAISING cx_static_check. "! Try to clear booking date -> ERROR METHODS u_booking_date_initial FOR TESTING RAISING cx_static_check. "! Try to create a booking with invalid flight data -> ERROR METHODS c_flight_invalid FOR TESTING RAISING cx_static_check. "! Try to update a booking with different flight data -> ERROR METHODS u_flight FOR TESTING RAISING cx_static_check. "! Try to delete, update a single booking in the same LUW -> ERROR METHODS du_single FOR TESTING RAISING cx_static_check. "! Try to delete, delete a single booking in the same LUW -> NO Error METHODS dd_single FOR TESTING RAISING cx_static_check. "! Create booking, delete father travel in same LUW -> NO Error, Booking ignored METHODS c_booking_d_travel_1_luw FOR TESTING RAISING cx_static_check. "! Try to delete father travel, create booking in same LUW -> ERROR METHODS d_travel_c_booking_1_luw FOR TESTING RAISING cx_static_check. "! Try to create a booking with an initial Booking ID -> ERROR METHODS c_booking_id_initial FOR TESTING RAISING cx_static_check. "! Try to create a booking with a known combination Travel ID, Booking ID -> ERROR METHODS c_booking_id_exists FOR TESTING RAISING cx_static_check. "! Check that price and currency are derived / not derived METHODS c_price_currency FOR TESTING RAISING cx_static_check. "! Try to update price only or currency only -> ERROR METHODS u_price_currency FOR TESTING RAISING cx_static_check. "! Try to create a booking with an unknown currency code -> ERROR METHODS c_currency_code_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking with an unknown currency code -> ERROR METHODS u_currency_code_unknown FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS /dmo/cl_flight_legacy29 DEFINITION LOCAL FRIENDS ltc_booking. CLASS ltc_booking IMPLEMENTATION. METHOD class_setup. IF mc_use_sql_doubles = abap_true ##BOOL_OK. * gs_flight_1 = VALUE #( carrier_id = 'AB' connection_id = '0001' flight_date = '20190306' price = '10818.00' currency_code = 'SGD' ) ##LITERAL. * gs_flight_2 = value #( carrier_id = 'CD' connection_id = '0002' flight_date = '20180510' price = '5950.00' currency_code = 'SGD' ) ##LITERAL. * * DATA lt_flight TYPE STANDARD TABLE OF /dmo/flight29. * lt_flight = VALUE #( ( carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date price = gs_flight_1-price currency_code = gs_flight_1-currency_code ) * ( carrier_id = gs_flight_2-carrier_id connection_id = gs_flight_2-connection_id flight_date = gs_flight_2-flight_date price = gs_flight_2-price currency_code = gs_flight_2-currency_code ) ). * mr_test_environment->insert_test_data( lt_flight ). * * gv_currency_code_unknown = 'XYZ'. ELSE. " Select 2 different Flight Dates with their prices SELECT SINGLE carrier_id, connection_id, flight_date, price, currency_code FROM /dmo/flight29 INTO CORRESPONDING FIELDS OF @gs_flight_1 ##WARN_OK. IF sy-subrc <> 0. cl_abap_unit_assert=>abort( |No flight data!| ). ENDIF. SELECT SINGLE carrier_id, connection_id, flight_date, price, currency_code FROM /dmo/flight29 WHERE carrier_id <> @gs_flight_1-carrier_id AND connection_id <> @gs_flight_1-connection_id INTO CORRESPONDING FIELDS OF @gs_flight_2 ##WARN_OK. IF sy-subrc <> 0. cl_abap_unit_assert=>abort( |No flight data!| ). ENDIF. " Determine an unknown Carrier ID gv_carrier_id_unknown = 'XX'. SELECT SINGLE carrier_id FROM /dmo/carrier29 WHERE carrier_id = @gv_carrier_id_unknown INTO @DATA(lv_dummy_carrier_id). IF sy-subrc = 0. cl_abap_unit_assert=>abort( |Carrier ID { gv_carrier_id_unknown } should not be known!| ). ENDIF. " Invalid currency code gv_currency_code_unknown = 'XYZ'. " We should use TCURC, but this is not released for "ABAP for SAP Cloud Platform" SELECT SINGLE currency FROM i_currency WHERE currency = @gv_currency_code_unknown INTO @DATA(lv_dummy_currency_code). IF sy-subrc = 0. cl_abap_unit_assert=>abort( |Currency { gv_currency_code_unknown } should not be known!| ). ENDIF. ENDIF. " Use Current date as Booking date gv_booking_date = cl_abap_context_info=>get_system_date( ). ENDMETHOD. METHOD setup. mv_travel_id = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) )-travel_id. mv_travel_id_unknown = mv_travel_id. DO. mv_travel_id_unknown = mv_travel_id_unknown + 1. SELECT SINGLE travel_id FROM /dmo/travel29 WHERE travel_id = @mv_travel_id_unknown INTO @DATA(lv_dummy_travel_id). IF sy-subrc <> 0. EXIT. ENDIF. ENDDO. ENDMETHOD. METHOD teardown. _delete_existing_travel( mv_travel_id ). ENDMETHOD. METHOD c_u_d_single. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ). cl_abap_unit_assert=>assert_equals( act = ls_booking-customer_id exp = gv_customer_id_1 ). cl_abap_unit_assert=>assert_equals( act = ls_booking-carrier_id exp = gs_flight_1-carrier_id ). cl_abap_unit_assert=>assert_equals( act = ls_booking-connection_id exp = gs_flight_1-connection_id ). SELECT SINGLE * FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @DATA(ls_booking_sel). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-customer_id exp = ls_booking-customer_id ). DATA(lv_booking_date) = gv_booking_date + 15. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id booking_date = lv_booking_date ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR ls_booking_sel. SELECT SINGLE * FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-carrier_id exp = ls_booking-carrier_id ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-booking_date exp = lv_booking_date ). _delete_existing_booking( iv_travel_id = mv_travel_id iv_booking_id = ls_booking-booking_id ). SELECT SINGLE * FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( exp = 4 ). ENDMETHOD. METHOD cu_d_single. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). cl_abap_unit_assert=>assert_equals( act = ls_booking-customer_id exp = gv_customer_id_1 ). cl_abap_unit_assert=>assert_equals( act = ls_booking-carrier_id exp = gs_flight_1-carrier_id ). cl_abap_unit_assert=>assert_equals( act = ls_booking-connection_id exp = gs_flight_1-connection_id ). DATA(lv_booking_date) = gv_booking_date + 15. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id booking_date = lv_booking_date ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). SELECT SINGLE * FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @DATA(ls_booking_sel). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-carrier_id exp = ls_booking-carrier_id ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-booking_date exp = lv_booking_date ). _delete_existing_booking( iv_travel_id = mv_travel_id iv_booking_id = ls_booking-booking_id ). SELECT SINGLE * FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( exp = 4 ). ENDMETHOD. METHOD cud_single. DATA lv_db_exists TYPE abap_bool. SELECT SINGLE lastchangedat FROM /dmo/travel29 WHERE travel_id = @mv_travel_id INTO @DATA(lv_lastchangedat_1). DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). DATA lv_booking_date TYPE /dmo/booking_date29. lv_booking_date = gv_booking_date + 15. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id booking_date = lv_booking_date ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_booking = DATA(lt_booking_updated) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_updated ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = lt_booking_updated[ 1 ]-travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lt_booking_updated[ 1 ]-booking_id exp = ls_booking-booking_id ). cl_abap_unit_assert=>assert_equals( act = lt_booking_updated[ 1 ]-booking_date exp = lv_booking_date ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). " Check that the administrative fields of the root node have been updated SELECT SINGLE lastchangedby, lastchangedat FROM /dmo/travel29 WHERE travel_id = @mv_travel_id INTO ( @DATA(lv_lastchangedby), @DATA(lv_lastchangedat_2) ). cl_abap_unit_assert=>assert_equals( act = lv_lastchangedby exp = sy-uname ). cl_abap_unit_assert=>assert_true( xsdbool( lv_lastchangedat_2 > lv_lastchangedat_1 ) ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_uu_d_single. DATA lv_db_exists TYPE abap_bool. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ). SELECT SINGLE customer_id FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @DATA(lv_customer_id). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_customer_id exp = ls_booking-customer_id ). DATA(lv_booking_date) = gv_booking_date + 15. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id booking_date = lv_booking_date ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id customer_id = gv_customer_id_2 ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update customer_id = abap_true ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). DATA ls_booking_sel TYPE /dmo/booking29. SELECT SINGLE booking_date, customer_id FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO CORRESPONDING FIELDS OF @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-booking_date exp = lv_booking_date ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-customer_id exp = gv_customer_id_2 ). _delete_existing_booking( iv_travel_id = mv_travel_id iv_booking_id = ls_booking-booking_id ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_travel_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id_unknown ) is_travelx = VALUE #( travel_id = mv_travel_id_unknown ) it_booking = VALUE #( ( booking_id = '10' booking_date = '20180701' customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id_unknown ). ENDMETHOD. METHOD c_travel_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( ) is_travelx = VALUE #( ) it_booking = VALUE #( ( booking_id = '10' booking_date = '20180701' customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD u_travel_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id_unknown ) is_travelx = VALUE #( travel_id = mv_travel_id_unknown ) it_booking = VALUE #( ( booking_id = '2' booking_date = '20180715' ) ) it_bookingx = VALUE #( ( booking_id = '2' action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id_unknown ). ENDMETHOD. METHOD u_travel_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( ) is_travelx = VALUE #( ) it_booking = VALUE #( ( booking_id = '2' booking_date = '20180715' ) ) it_bookingx = VALUE #( ( booking_id = '2' action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD d_travel_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id_unknown ) is_travelx = VALUE #( travel_id = mv_travel_id_unknown ) it_booking = VALUE #( ( booking_id = '1' ) ) it_bookingx = VALUE #( ( booking_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id_unknown ). ENDMETHOD. METHOD d_travel_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( ) is_travelx = VALUE #( ) it_booking = VALUE #( ( booking_id = '1' ) ) it_bookingx = VALUE #( ( booking_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD u_booking_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = '20180715' ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = '10' ). ENDMETHOD. METHOD d_booking_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = '10' ). ENDMETHOD. METHOD u_booking_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '0' booking_date = '20180715' ) ) it_bookingx = VALUE #( ( booking_id = '0' action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). ENDMETHOD. METHOD d_booking_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '0' ) ) it_bookingx = VALUE #( ( booking_id = '0' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). ENDMETHOD. METHOD c_u_d_travel_w_bookings. DATA lv_db_exists TYPE abap_bool. " 1. LUW: Create a travel with 2 bookings (the second travel is only for testing) DATA(ls_travel_1) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). DATA(ls_travel_2) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). cl_abap_unit_assert=>assert_not_initial( ls_travel_1-travel_id ). cl_abap_unit_assert=>assert_not_initial( ls_travel_2-travel_id ). DATA(ls_booking_1) = _create_booking( iv_travel_id = ls_travel_1-travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). DATA(ls_booking_2) = _create_booking( iv_travel_id = ls_travel_1-travel_id is_booking = VALUE #( booking_id = '20' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). gr_cut->save( ). SELECT COUNT( * ) FROM /dmo/booking29 WHERE travel_id = @ls_travel_1-travel_id INTO @DATA(lv_count). cl_abap_unit_assert=>assert_equals( act = lv_count exp = 2 ). " 2. LUW: Update the first booking gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_1-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_1-travel_id ) it_booking = VALUE #( ( booking_id = ls_booking_1-booking_id customer_id = gv_customer_id_2 ) ) it_bookingx = VALUE #( ( booking_id = ls_booking_1-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update customer_id = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). SELECT SINGLE customer_id FROM /dmo/booking29 WHERE travel_id = @ls_booking_1-travel_id AND booking_id = @ls_booking_1-booking_id INTO @DATA(lv_customer_id). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_customer_id exp = gv_customer_id_2 ). SELECT SINGLE customer_id FROM /dmo/booking29 WHERE travel_id = @ls_booking_2-travel_id AND booking_id = @ls_booking_2-booking_id INTO @lv_customer_id. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_customer_id exp = gv_customer_id_1 ). " 3. LUW: Delete the first booking - check that the second booking is still there _delete_existing_booking( iv_travel_id = ls_booking_1-travel_id iv_booking_id = ls_booking_1-booking_id ). SELECT travel_id, booking_id FROM /dmo/booking29 WHERE travel_id = @ls_travel_1-travel_id INTO TABLE @DATA(lt_booking_key). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_key ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = lt_booking_key[ 1 ]-booking_id exp = ls_booking_2-booking_id ). " 4. LUW: Delete the travel - check that the second booking has also been deleted _delete_existing_travel( ls_travel_1-travel_id ). _delete_existing_travel( ls_travel_2-travel_id ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @ls_travel_1-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_customer_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_unknown carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>customer_unkown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CUSTOMER_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_customer_id exp = gv_customer_id_unknown ). ENDMETHOD. METHOD u_customer_unknown. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id customer_id = gv_customer_id_unknown ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update customer_id = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>customer_unkown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CUSTOMER_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_customer_id exp = gv_customer_id_unknown ). gr_cut->save( ). SELECT SINGLE customer_id FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @DATA(lv_customer_id). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_customer_id exp = ls_booking-customer_id ). _delete_existing_booking( iv_travel_id = mv_travel_id iv_booking_id = ls_booking-booking_id ). ENDMETHOD. METHOD c_booking_date_past. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = '20180101' customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_booking_date_invalid-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_DATE' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = '10' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_date exp = '20180101' ). ENDMETHOD. METHOD u_booking_date_initial. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update booking_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_booking_date_invalid-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_DATE' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking-booking_id ). cl_abap_unit_assert=>assert_initial( lx->mv_booking_date ). gr_cut->save( ). SELECT SINGLE booking_date FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @DATA(lv_booking_date). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_booking_date exp = gv_booking_date ). _delete_existing_booking( iv_travel_id = mv_travel_id iv_booking_id = ls_booking-booking_id ). ENDMETHOD. METHOD c_flight_invalid. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gv_carrier_id_unknown connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>flight_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CARRIER_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_CONNECTION_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_FLIGHT_DATE' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_carrier_id exp = gv_carrier_id_unknown ). cl_abap_unit_assert=>assert_equals( act = lx->mv_connection_id exp = gs_flight_1-connection_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_flight_date exp = gs_flight_1-flight_date ). ENDMETHOD. METHOD u_flight. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id flight_date = gs_flight_2-flight_date ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update flight_date = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_flight_u-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = '10' ). gr_cut->save( ). SELECT SINGLE flight_date FROM /dmo/booking29 WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @DATA(lv_flight_date). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_flight_date exp = gs_flight_1-flight_date ). _delete_existing_booking( iv_travel_id = mv_travel_id iv_booking_id = ls_booking-booking_id ). ENDMETHOD. METHOD du_single. DATA lv_db_exists TYPE abap_bool. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id customer_id = gv_customer_id_2 ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update customer_id = abap_true ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking-booking_id ). gr_cut->save( ). SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD dd_single. DATA lv_db_exists TYPE abap_bool. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @ls_booking-booking_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_booking_d_travel_1_luw. DATA lv_db_exists TYPE abap_bool. " 1. LUW: Create travel DATA(ls_travel) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_true( lv_db_exists ). " 2. LUW: Create booking for the new travel, delete the new travel _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel-travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). "Check that travel and booking are gone CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD d_travel_c_booking_1_luw. DATA lv_db_exists TYPE abap_bool. " 1. LUW: Create travel DATA(ls_travel) = _create_travel( VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_true( lv_db_exists ). " 2. LUW: Delete the new travel, create booking for the same travel gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel-travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id ) is_travelx = VALUE #( travel_id = ls_travel-travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel-travel_id ). gr_cut->save( ). "Check that travel and booking are gone CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/travel29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_booking_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '0' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ) it_bookingx = VALUE #( ( booking_id = '0' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). ENDMETHOD. METHOD c_booking_id_exists. _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). " Try to create a booking that is already in the buffer gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_exists-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = '10' ). gr_cut->save( ). " Try to create a booking that is already in the database CLEAR lt_messages. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = lt_booking et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_exists-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = '10' ). ENDMETHOD. METHOD c_price_currency. " Do not provide price and currency DATA(ls_booking_1) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). " Provide price and currency CONSTANTS lc_diff TYPE p VALUE '99.99'. DATA lv_flight_price TYPE /dmo/flight_price29. DATA lv_currency_code TYPE /dmo/currency_code29. lv_flight_price = gs_flight_1-price + lc_diff. lv_currency_code = SWITCH #( gs_flight_1-currency_code WHEN 'EUR' THEN 'USD' ELSE 'EUR' ). DATA(ls_booking_2) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '20' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date flight_price = lv_flight_price currency_code = lv_currency_code ) iv_save = abap_true ). DATA ls_booking_sel TYPE /dmo/booking29. SELECT SINGLE flight_price, currency_code FROM /dmo/booking29 WHERE travel_id = @ls_booking_1-travel_id AND booking_id = @ls_booking_1-booking_id INTO CORRESPONDING FIELDS OF @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-flight_price exp = gs_flight_1-price ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-currency_code exp = gs_flight_1-currency_code ). CLEAR ls_booking_sel. SELECT SINGLE flight_price, currency_code FROM /dmo/booking29 WHERE travel_id = @ls_booking_1-travel_id AND booking_id = @ls_booking_2-booking_id INTO CORRESPONDING FIELDS OF @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-flight_price exp = lv_flight_price ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-currency_code exp = lv_currency_code ). ENDMETHOD. METHOD u_price_currency. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date flight_price = '999.99' currency_code = 'EUR' ) iv_save = abap_false ). " Try to change the flight price only gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking-travel_id ) is_travelx = VALUE #( travel_id = ls_booking-travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id flight_price = '888.88' ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update flight_price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_price_currency_u-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_booking-travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking-booking_id ). " Try to change the currency code only CLEAR lt_messages. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking-travel_id ) is_travelx = VALUE #( travel_id = ls_booking-travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id currency_code = 'XXX' ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update currency_code = abap_true ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_price_currency_u-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_booking-travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking-booking_id ). ENDMETHOD. METHOD c_currency_code_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date flight_price = '999.99' currency_code = gv_currency_code_unknown ) ) it_bookingx = VALUE #( ( booking_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>currency_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CURRENCY_CODE' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_currency_code exp = gv_currency_code_unknown ). ENDMETHOD. METHOD u_currency_code_unknown. DATA(ls_booking) = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date flight_price = '999.99' currency_code = 'EUR' ) iv_save = abap_false ). " Try to change the flight price only gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking-travel_id ) is_travelx = VALUE #( travel_id = ls_booking-travel_id ) it_booking = VALUE #( ( booking_id = ls_booking-booking_id flight_price = '999.99' currency_code = gv_currency_code_unknown ) ) it_bookingx = VALUE #( ( booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-update flight_price = abap_true currency_code = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>currency_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CURRENCY_CODE' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_currency_code exp = gv_currency_code_unknown ). ENDMETHOD. METHOD _create_booking. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = iv_travel_id ) is_travelx = VALUE #( travel_id = iv_travel_id ) it_booking = VALUE #( ( is_booking ) ) it_bookingx = VALUE #( ( booking_id = is_booking-booking_id action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking = DATA(lt_booking) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking ) exp = 1 ). rs_booking = lt_booking[ 1 ]. cl_abap_unit_assert=>assert_equals( act = rs_booking-travel_id exp = iv_travel_id ). cl_abap_unit_assert=>assert_equals( act = rs_booking-booking_id exp = is_booking-booking_id ). IF iv_save = abap_true. gr_cut->save( ). ENDIF. ENDMETHOD. METHOD _delete_existing_booking. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = iv_travel_id ) is_travelx = VALUE #( travel_id = iv_travel_id ) it_booking = VALUE #( ( booking_id = iv_booking_id ) ) it_bookingx = VALUE #( ( booking_id = iv_booking_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). ENDMETHOD. ENDCLASS. CLASS ltc_booking_supplement DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS INHERITING FROM ltc_booking. PRIVATE SECTION. TYPES: BEGIN OF ts_supplement, supplement_id TYPE /dmo/supplement_id29, price TYPE /dmo/supplement_price29, currency_code TYPE /dmo/currency_code29, END OF ts_supplement. CLASS-DATA gs_supplement_1 TYPE ts_supplement. CLASS-DATA gs_supplement_2 TYPE ts_supplement. CLASS-DATA gv_supplement_id_unknown TYPE /dmo/supplement_id29. DATA mv_booking_id TYPE /dmo/booking_id29. DATA mv_booking_id_unknown TYPE /dmo/booking_id29. CLASS-METHODS class_setup. METHODS setup. "! Complicated test involving all 3 levels METHODS c_u_d_multiple FOR TESTING RAISING cx_static_check. "! Try to create a booking supplement with an unknown Travel ID -> ERROR METHODS c_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Try to create a booking supplement with an initial Travel ID -> ERROR METHODS c_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to update a booking supplement with an unknown Travel ID -> ERROR METHODS u_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking supplement with an initial Travel ID -> ERROR METHODS u_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to delete a booking supplement with an unknown Travel ID -> ERROR METHODS d_travel_id_unknown FOR TESTING RAISING cx_static_check. "! Try to delete a booking supplement with an initial Travel ID -> ERROR METHODS d_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to create a booking supplement with an unknown Booking ID -> ERROR METHODS c_booking_id_unknown FOR TESTING RAISING cx_static_check. "! Try to create a booking supplement with an initial Travel ID -> ERROR METHODS c_booking_id_initial FOR TESTING RAISING cx_static_check. "! Try to update a booking supplement with an unknown Booking ID -> ERROR METHODS u_booking_id_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking supplement with an initial Booking ID -> ERROR METHODS u_booking_id_initial FOR TESTING RAISING cx_static_check. "! Try to delete a booking supplement with an unknown Booking ID -> ERROR METHODS d_booking_id_unknown FOR TESTING RAISING cx_static_check. "! Try to delete a booking supplement with an initial Booking ID -> ERROR METHODS d_booking_id_initial FOR TESTING RAISING cx_static_check. "! Try to update a booking supplement with an unknown Booking Supplement ID -> ERROR METHODS u_booking_suppl_id_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking supplement with an initial Booking Supplement ID -> ERROR METHODS u_booking_suppl_id_initial FOR TESTING RAISING cx_static_check. "! Try to delete a booking supplement with an unknown Booking Supplement ID -> ERROR METHODS d_booking_suppl_id_unknown FOR TESTING RAISING cx_static_check. "! Try to delete a booking supplement with an initial Booking Supplement ID -> ERROR METHODS d_booking_suppl_id_initial FOR TESTING RAISING cx_static_check. "! Create booking supplement, delete father booking in same LUW -> NO Error, booking supplement ignored METHODS c_bsuppl_d_booking_1_luw FOR TESTING RAISING cx_static_check. "! Create booking supplement, delete father travel in same LUW -> NO Error, booking supplement ignored METHODS c_bsuppl_d_travel_1_luw FOR TESTING RAISING cx_static_check. "! Try to delete father travel, create booking supplement in same LUW -> ERROR METHODS d_travel_c_bsuppl_1_luw FOR TESTING RAISING cx_static_check. "! Try to delete father booking, create booking supplement in same LUW -> ERROR METHODS d_booking_c_bsuppl_1_luw FOR TESTING RAISING cx_static_check. "! Try to delete, update a single booking in the same LUW -> ERROR METHODS du_single FOR TESTING RAISING cx_static_check. "! Try to delete, delete a single booking in the same LUW -> NO Error METHODS dd_single FOR TESTING RAISING cx_static_check. "! Try to create a Booking Supplement with an unknown supplement ID -> ERROR METHODS c_supplement_unknown FOR TESTING RAISING cx_static_check. "! Try to create a Booking Supplement with an initial Booking Supplement ID -> ERROR METHODS c_booking_suppl_id_initial FOR TESTING RAISING cx_static_check. "! Try to create a Booking Supplement with a known combination of Travel ID, Booking ID, Booking Supplement ID -> ERROR METHODS c_booking_suppl_id_exists FOR TESTING RAISING cx_static_check. "! Do a deep insert involving all 3 levels METHODS c_deep_insert FOR TESTING RAISING cx_static_check. "! Try to do a deep insert with a faulty booking supplement -> ERROR (nothing is created) METHODS c_deep_insert_suppl_unknown FOR TESTING RAISING cx_static_check. "! Do a complicated update in a single call METHODS u_single_travel_multiple FOR TESTING RAISING cx_static_check. METHODS read_db FOR TESTING RAISING cx_static_check. METHODS read_buffer FOR TESTING RAISING cx_static_check. METHODS read_travel_id_initial FOR TESTING RAISING cx_static_check. "! Try to change the supplement ID -> ERROR METHODS u_supplement_id FOR TESTING RAISING cx_static_check. "! Check that price and currency are derived / not derived METHODS c_price_currency FOR TESTING RAISING cx_static_check. "! Try to update price only or currency only -> ERROR METHODS u_price_currency FOR TESTING RAISING cx_static_check. "! Try to create a booking supplement with an unknown currency code -> ERROR METHODS c_currency_code_unknown FOR TESTING RAISING cx_static_check. "! Try to update a booking supplement with an unknown currency code -> ERROR METHODS u_currency_code_unknown FOR TESTING RAISING cx_static_check. METHODS _create_booking_suppl IMPORTING iv_travel_id TYPE /dmo/travel_id29 is_booking_supplement TYPE /dmo/if_flight_legacy29=>ts_booking_supplement_in iv_save TYPE abap_bool DEFAULT abap_true RETURNING VALUE(rs_booking_supplement) TYPE /dmo/book_sup_29. ENDCLASS. CLASS /dmo/cl_flight_legacy29 DEFINITION LOCAL FRIENDS ltc_booking_supplement. CLASS ltc_booking_supplement IMPLEMENTATION. METHOD class_setup. IF mc_use_sql_doubles = abap_true ##BOOL_OK. * gs_supplement_1 = VALUE #( supplement_id = 'BV-0001' price = '2.30' currency_code = 'EUR' ) ##LITERAL. * gs_supplement_2 = VALUE #( supplement_id = 'BV-0002' price = '7.50' currency_code = 'EUR' ) ##LITERAL. * * DATA lt_supplement TYPE STANDARD TABLE OF /dmo/suppleme_29. * lt_supplement = VALUE #( ( supplement_id = gs_supplement_1-supplement_id price = gs_supplement_1-price currency_code = gs_supplement_1-currency_code ) * ( supplement_id = gs_supplement_2-supplement_id price = gs_supplement_2-price currency_code = gs_supplement_2-currency_code ) ). * mr_test_environment->insert_test_data( lt_supplement ). * * gv_supplement_id_unknown = 'XX-999'. ELSE. " Select any valid combination of Supplement ID, Price, Currency Code SELECT SINGLE supplement_id, price, currency_code FROM /dmo/suppleme_29 INTO ( @gs_supplement_1-supplement_id, @gs_supplement_1-price, @gs_supplement_1-currency_code ) ##WARN_OK. IF sy-subrc <> 0. cl_abap_unit_assert=>abort( 'No supplement data!' ). ENDIF. " Select a different valid combination of Supplement ID, Price, Currency Code SELECT SINGLE supplement_id, price, currency_code FROM /dmo/suppleme_29 WHERE supplement_id <> @gs_supplement_1-supplement_id INTO ( @gs_supplement_2-supplement_id, @gs_supplement_2-price, @gs_supplement_2-currency_code ) ##WARN_OK. IF sy-subrc <> 0. cl_abap_unit_assert=>abort( 'No supplement data!' ). ENDIF. cl_abap_unit_assert=>assert_differs( act = gs_supplement_1-supplement_id exp = gs_supplement_2-supplement_id ). " Determine an unknown Supplement ID gv_supplement_id_unknown = 'XX-999'. SELECT SINGLE supplement_id FROM /dmo/suppleme_29 WHERE supplement_id = @gv_supplement_id_unknown INTO @DATA(lv_dummy_supplement_id). IF sy-subrc = 0. cl_abap_unit_assert=>abort( |Supplement ID { gv_supplement_id_unknown } should not be known!| ). ENDIF. ENDIF. ENDMETHOD. METHOD setup. mv_booking_id = _create_booking( iv_travel_id = mv_travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) )-booking_id. mv_booking_id_unknown = '20'. ENDMETHOD. METHOD c_u_d_multiple. DATA lv_db_exists TYPE abap_bool. " 1. LUW: " Create a travel DATA(ls_travel) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). " Create 2 bookings for the new travel DATA(ls_booking_1) = _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '20' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). DATA(ls_booking_2) = _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '21' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). " Create a single booking supplement for the first booking _create_booking_suppl( iv_travel_id = ls_booking_1-travel_id is_booking_supplement = VALUE #( booking_id = ls_booking_1-booking_id booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) iv_save = abap_false ). " Create 2 booking supplements for the second booking DATA(ls_book_suppl_2_1) = _create_booking_suppl( iv_travel_id = ls_booking_2-travel_id is_booking_supplement = VALUE #( booking_id = ls_booking_2-booking_id booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id price = '20.0' currency_code = 'EUR' ) iv_save = abap_false ). DATA(ls_book_suppl_2_2) = _create_booking_suppl( iv_travel_id = ls_booking_2-travel_id is_booking_supplement = VALUE #( booking_id = ls_booking_2-booking_id booking_supplement_id = '20' supplement_id = gs_supplement_1-supplement_id price = '30.0' currency_code = 'EUR' ) iv_save = abap_false ). gr_cut->save( ). SELECT COUNT( * ) FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id INTO @DATA(lv_count). cl_abap_unit_assert=>assert_equals( act = lv_count exp = 3 ). DATA ls_book_suppl_sel TYPE /dmo/book_sup_29. SELECT SINGLE price, currency_code FROM /dmo/book_sup_29 WHERE travel_id = @ls_book_suppl_2_1-travel_id AND booking_id = @ls_book_suppl_2_1-booking_id AND booking_supplement_id = @ls_book_suppl_2_1-booking_supplement_id INTO CORRESPONDING FIELDS OF @ls_book_suppl_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-price exp = '20.0' ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-currency_code exp = 'EUR' ). " 2. Update the first booking supplement of the second booking gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_book_suppl_2_1-travel_id ) is_travelx = VALUE #( travel_id = ls_book_suppl_2_1-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_book_suppl_2_1-booking_id booking_supplement_id = ls_book_suppl_2_1-booking_supplement_id price = '21.0' currency_code = 'USD' ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_book_suppl_2_1-booking_id booking_supplement_id = ls_book_suppl_2_1-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true currency_code = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). " Check that record already in update buffer is properly updated gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_book_suppl_2_1-travel_id ) is_travelx = VALUE #( travel_id = ls_book_suppl_2_1-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_book_suppl_2_1-booking_id booking_supplement_id = ls_book_suppl_2_1-booking_supplement_id price = '22.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_book_suppl_2_1-booking_id booking_supplement_id = ls_book_suppl_2_1-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true currency_code = abap_true ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_supplement ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = lt_booking_supplement[ 1 ]-travel_id exp = ls_book_suppl_2_1-travel_id ). cl_abap_unit_assert=>assert_equals( act = lt_booking_supplement[ 1 ]-booking_id exp = ls_book_suppl_2_1-booking_id ). cl_abap_unit_assert=>assert_equals( act = lt_booking_supplement[ 1 ]-booking_supplement_id exp = ls_book_suppl_2_1-booking_supplement_id ). cl_abap_unit_assert=>assert_equals( act = lt_booking_supplement[ 1 ]-price exp = '22.0' ). cl_abap_unit_assert=>assert_equals( act = lt_booking_supplement[ 1 ]-currency_code exp = 'EUR' ). gr_cut->save( ). SELECT SINGLE price, currency_code FROM /dmo/book_sup_29 WHERE travel_id = @ls_book_suppl_2_1-travel_id AND booking_id = @ls_book_suppl_2_1-booking_id AND booking_supplement_id = @ls_book_suppl_2_1-booking_supplement_id INTO CORRESPONDING FIELDS OF @ls_book_suppl_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-price exp = '22.0' ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-currency_code exp = 'EUR' ). SELECT SINGLE price, currency_code FROM /dmo/book_sup_29 WHERE travel_id = @ls_book_suppl_2_2-travel_id AND booking_id = @ls_book_suppl_2_2-booking_id AND booking_supplement_id = @ls_book_suppl_2_2-booking_supplement_id INTO CORRESPONDING FIELDS OF @ls_book_suppl_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-price exp = '30.0' ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-currency_code exp = 'EUR' ). " 3. Delete the first booking - check that the booking supplement has also been deleted _delete_existing_booking( iv_travel_id = ls_booking_1-travel_id iv_booking_id = ls_booking_1-booking_id ). SELECT COUNT( * ) FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id INTO @lv_count. cl_abap_unit_assert=>assert_equals( act = lv_count exp = 2 ). SELECT COUNT( * ) FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @ls_booking_2-booking_id INTO @lv_count. cl_abap_unit_assert=>assert_equals( act = lv_count exp = 2 ). " 4. LUW: Delete the second booking supplement of the second booking - here check also travel admin field SELECT SINGLE lastchangedat FROM /dmo/travel29 WHERE travel_id = @ls_travel-travel_id INTO @DATA(lv_lastchangedat_1). cl_abap_unit_assert=>assert_subrc( ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_book_suppl_2_2-travel_id AND booking_id = @ls_book_suppl_2_2-booking_id AND booking_supplement_id = @ls_book_suppl_2_2-booking_supplement_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_true( lv_db_exists ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_book_suppl_2_2-travel_id ) is_travelx = VALUE #( travel_id = ls_book_suppl_2_2-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_book_suppl_2_2-booking_id booking_supplement_id = ls_book_suppl_2_2-booking_supplement_id ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_book_suppl_2_2-booking_id booking_supplement_id = ls_book_suppl_2_2-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_book_suppl_2_2-travel_id AND booking_id = @ls_book_suppl_2_2-booking_id AND booking_supplement_id = @ls_book_suppl_2_2-booking_supplement_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). SELECT SINGLE lastchangedat FROM /dmo/travel29 WHERE travel_id = @ls_travel-travel_id INTO @DATA(lv_lastchangedat_2). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_true( xsdbool( lv_lastchangedat_2 > lv_lastchangedat_1 ) ). SELECT COUNT( * ) FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @ls_booking_2-booking_id INTO @lv_count. cl_abap_unit_assert=>assert_equals( act = lv_count exp = 1 ). " 5. LUW: Delete the travel - check that all booking (supplements) have also been deleted _delete_existing_travel( ls_travel-travel_id ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/booking29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_travel_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id_unknown ) is_travelx = VALUE #( travel_id = mv_travel_id_unknown ) it_booking_supplement = VALUE #( ( booking_id = '1' booking_supplement_id = '1' price = '10.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = '1' booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id_unknown ). ENDMETHOD. METHOD c_travel_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( ) is_travelx = VALUE #( ) it_booking_supplement = VALUE #( ( booking_id = '1' booking_supplement_id = '1' price = '10.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = '1' booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD u_travel_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id_unknown ) is_travelx = VALUE #( travel_id = mv_travel_id_unknown ) it_booking_supplement = VALUE #( ( booking_id = '2' price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = '2' action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id_unknown ). ENDMETHOD. METHOD u_travel_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( ) is_travelx = VALUE #( ) it_booking_supplement = VALUE #( ( booking_id = '2' booking_supplement_id = '1' price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = '2' booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD d_travel_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id_unknown ) is_travelx = VALUE #( travel_id = mv_travel_id_unknown ) it_booking_supplement = VALUE #( ( booking_id = '1' booking_supplement_id = '1' ) ) it_booking_supplementx = VALUE #( ( booking_id = '1' booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id_unknown ). ENDMETHOD. METHOD d_travel_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( ) is_travelx = VALUE #( ) it_booking_supplement = VALUE #( ( booking_id = '1' booking_supplement_id = '1' ) ) it_booking_supplementx = VALUE #( ( booking_id = '1' booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD c_booking_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id_unknown booking_supplement_id = '1' price = '10.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id_unknown booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id_unknown ). ENDMETHOD. METHOD c_booking_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_supplement_id = '1' ) ) it_booking_supplementx = VALUE #( ( booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). ENDMETHOD. METHOD u_booking_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id_unknown booking_supplement_id = '1' price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id_unknown booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id_unknown ). ENDMETHOD. METHOD u_booking_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_supplement_id = '1' price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). ENDMETHOD. METHOD d_booking_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id_unknown booking_supplement_id = '1' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id_unknown booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id_unknown ). ENDMETHOD. METHOD d_booking_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_supplement_id = '1' ) ) it_booking_supplementx = VALUE #( ( booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). ENDMETHOD. METHOD u_booking_suppl_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '10' price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = '10' ). ENDMETHOD. METHOD u_booking_suppl_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). ENDMETHOD. METHOD d_booking_suppl_id_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '10' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = '10' ). ENDMETHOD. METHOD d_booking_suppl_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). ENDMETHOD. METHOD c_bsuppl_d_booking_1_luw. DATA lv_db_exists TYPE abap_bool. " 1. LUW: Create: Travel - Booking DATA(ls_travel) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). DATA(ls_booking) = _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_true ). " 2. LUW: Create Booking Supplement, Delete father Booking DATA(ls_booking_supplement) = _create_booking_suppl( iv_travel_id = ls_booking-travel_id is_booking_supplement = VALUE #( booking_id = ls_booking-booking_id booking_supplement_id = '11' supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) iv_save = abap_false ). _delete_existing_booking( iv_travel_id = ls_booking-travel_id iv_booking_id = ls_booking-booking_id ). " Check that the Booking Supplement was not created CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_booking_supplement-travel_id AND booking_id = @ls_booking_supplement-booking_id AND booking_supplement_id = @ls_booking_supplement-booking_supplement_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD c_bsuppl_d_travel_1_luw. DATA lv_db_exists TYPE abap_bool. " 1. LUW: Create: Travel - Booking DATA(ls_travel) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). DATA(ls_booking) = _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '11' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_true ). " 2. LUW: Create Booking Supplement, Delete father Travel DATA(ls_booking_supplement) = _create_booking_suppl( iv_travel_id = ls_booking-travel_id is_booking_supplement = VALUE #( booking_id = ls_booking-booking_id booking_supplement_id = '11' supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) iv_save = abap_false ). _delete_existing_travel( ls_travel-travel_id ). " Check that the Booking Supplement was not created CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_booking_supplement-travel_id AND booking_id = @ls_booking_supplement-booking_id AND booking_supplement_id = @ls_booking_supplement-booking_supplement_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD d_travel_c_bsuppl_1_luw. " 1. LUW: Create: Travel - Booking DATA(ls_travel) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). DATA(ls_booking) = _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '10' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_true ). " 2. LUW: Delete Travel, try to create Booking Supplement gr_cut->delete_travel( EXPORTING iv_travel_id = ls_travel-travel_id IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking-travel_id ) is_travelx = VALUE #( travel_id = ls_booking-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking-booking_id booking_supplement_id = '1' price = '10.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking-booking_id booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel-travel_id ). gr_cut->save( ). ENDMETHOD. METHOD d_booking_c_bsuppl_1_luw. " Delete Booking, try to create Booking Supplement gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking = VALUE #( ( booking_id = mv_booking_id ) ) it_bookingx = VALUE #( ( booking_id = mv_booking_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '1' price = '10.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). ENDMETHOD. METHOD du_single. DATA lv_db_exists TYPE abap_bool. DATA(ls_booking_supplement) = _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = '22' supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) iv_save = abap_true ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement-travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement-booking_id exp = mv_booking_id ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement-booking_supplement_id exp = '22' ). " Check existence of Booking Supplement CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @mv_booking_id AND booking_supplement_id = '22' INTO @lv_db_exists. cl_abap_unit_assert=>assert_true( lv_db_exists ). " Delete, Update Booking Supplement in the same LUW gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_supplement-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_supplement-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_supplement-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_supplement-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_booking_supplement-travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking_supplement-booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = ls_booking_supplement-booking_supplement_id ). gr_cut->save( ). " Check that the Booking Supplement no longer exists CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_booking_supplement-travel_id AND booking_id = @ls_booking_supplement-booking_id AND booking_supplement_id = @ls_booking_supplement-booking_supplement_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD dd_single. CONSTANTS lc_booking_supplement_id TYPE /dmo/booking_supplement_id29 VALUE '34'. DATA lv_db_exists TYPE abap_bool. _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = lc_booking_supplement_id supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) iv_save = abap_true ). " Check existence of Booking Supplement CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @mv_booking_id AND booking_supplement_id = @lc_booking_supplement_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_true( lv_db_exists ). " Delete Booking Supplement twice in the same LUW gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = lc_booking_supplement_id ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = lc_booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = lc_booking_supplement_id ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = lc_booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->save( ). " Check that the Booking Supplement no longer exists CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @mv_booking_id AND booking_supplement_id = @lc_booking_supplement_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_supplement_unknown. DATA lv_db_exists TYPE abap_bool. " Try to create 2 Booking Supplements, one of them is faulty gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '1' supplement_id = gv_supplement_id_unknown price = '10.0' currency_code = 'EUR' ) ( booking_id = mv_booking_id booking_supplement_id = '2' supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '1' action_code = /dmo/if_flight_legacy29=>action_code-create ) ( booking_id = mv_booking_id booking_supplement_id = '2' supplement_id = gs_supplement_1-supplement_id action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>supplement_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_supplement_id exp = gv_supplement_id_unknown ). gr_cut->save( ). " Check that no Booking Supplement has been created CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @mv_travel_id AND booking_id = @mv_booking_id INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). ENDMETHOD. METHOD c_booking_suppl_id_initial. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '0' supplement_id = gs_supplement_1-supplement_id price = gs_supplement_1-price currency_code = gs_supplement_1-currency_code ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '0' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_no_key-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). ENDMETHOD. METHOD c_booking_suppl_id_exists. _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = '20' supplement_id = gs_supplement_1-supplement_id price = gs_supplement_1-price currency_code = gs_supplement_1-currency_code ) iv_save = abap_false ). " Try to create a booking supplement that is already in the buffer gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '20' supplement_id = gs_supplement_1-supplement_id price = gs_supplement_1-price currency_code = gs_supplement_1-currency_code ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '20' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_exists-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = '20' ). gr_cut->save( ). " Try to create a booking supplement that is already in the database CLEAR lt_messages. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '20' supplement_id = gs_supplement_1-supplement_id price = gs_supplement_1-price currency_code = gs_supplement_1-currency_code ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '20' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = lt_booking_supplement et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_exists-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = mv_travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = mv_booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = '20' ). ENDMETHOD. METHOD c_deep_insert. CONSTANTS lc_booking_id_1 TYPE /dmo/booking_id29 VALUE '20'. CONSTANTS lc_booking_id_2 TYPE /dmo/booking_id29 VALUE '21'. CONSTANTS lc_booking_supplement_id_1_1 TYPE /dmo/booking_supplement_id29 VALUE '10'. CONSTANTS lc_booking_supplement_id_2_1 TYPE /dmo/booking_supplement_id29 VALUE '10'. CONSTANTS lc_booking_supplement_id_2_2 TYPE /dmo/booking_supplement_id29 VALUE '20'. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' description = 'My_Deep_Insert' total_price = '999.99' "Derivated, so ignored booking_fee = '10.00' currency_code = 'EUR' ) it_booking = VALUE #( ( booking_id = lc_booking_id_1 booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date flight_price = '100.00' currency_code = 'EUR' ) ( booking_id = lc_booking_id_2 booking_date = gv_booking_date customer_id = gv_customer_id_2 carrier_id = gs_flight_2-carrier_id connection_id = gs_flight_2-connection_id flight_date = gs_flight_2-flight_date flight_price = '200.00' currency_code = 'EUR' ) ) it_booking_supplement = VALUE #( ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) ( booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_1 supplement_id = gs_supplement_1-supplement_id price = '20.0' currency_code = 'EUR' ) ( booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_2 supplement_id = gs_supplement_1-supplement_id price = '30.0' currency_code = 'USD' ) ) IMPORTING es_travel = DATA(ls_travel) et_booking = DATA(lt_booking) et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking ) exp = 2 ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_supplement ) exp = 3 ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_1 ] ) ) ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_2 ] ) ) ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_supplement[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 ] ) ) ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_supplement[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_1 ] ) ) ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_supplement[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_2 ] ) ) ). gr_cut->save( ). " Check travel DATA(lv_exchange_rate_date) = cl_abap_context_info=>get_system_date( ). /dmo/cl_flight_amdp29=>convert_currency( EXPORTING iv_amount = '30.00' iv_currency_code_source = 'USD' iv_currency_code_target = 'EUR' iv_exchange_rate_date = lv_exchange_rate_date IMPORTING ev_amount = data(lv_30_usd_as_eur) ). cl_abap_unit_assert=>assert_not_initial( lv_30_usd_as_eur ). DATA ls_travel_sel TYPE /dmo/travel29. SELECT SINGLE agency_id, customer_id, total_price, currency_code, description FROM /dmo/travel29 WHERE travel_id = @ls_travel-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-agency_id exp = gv_agency_id_1 ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-customer_id exp = gv_customer_id_1 ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-total_price exp = '10.00' + '100.00' + '200.00' + '10.00' + '20.00' + lv_30_usd_as_eur ) ##LITERAL. cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-currency_code exp = 'EUR' ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = 'My_Deep_Insert' ). " Check booking count, Check one of the bookings SELECT COUNT( * ) FROM /dmo/booking29 WHERE travel_id = @ls_travel-travel_id INTO @DATA(lv_count). cl_abap_unit_assert=>assert_equals( act = lv_count exp = 2 ). DATA ls_booking_sel TYPE /dmo/booking29. SELECT SINGLE customer_id, flight_date FROM /dmo/booking29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_2 INTO CORRESPONDING FIELDS OF @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-customer_id exp = gv_customer_id_2 ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-flight_date exp = gs_flight_2-flight_date ). " Check booking supplement count, Check one of the booking supplements lv_count = 0. SELECT COUNT( * ) FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id INTO @lv_count. cl_abap_unit_assert=>assert_equals( act = lv_count exp = 3 ). DATA ls_book_suppl_sel TYPE /dmo/book_sup_29. SELECT SINGLE price, currency_code FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_2 AND booking_supplement_id = @lc_booking_supplement_id_2_1 INTO CORRESPONDING FIELDS OF @ls_book_suppl_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-price exp = '20.0' ). cl_abap_unit_assert=>assert_equals( act = ls_book_suppl_sel-currency_code exp = 'EUR' ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD c_deep_insert_suppl_unknown. " Prepare travel in buffer without save DATA(ls_travel) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). " Now try to put a second travel with a faulty booking supplement into the buffer CONSTANTS lc_booking_id_1 TYPE /dmo/booking_id29 VALUE '20'. CONSTANTS lc_booking_id_2 TYPE /dmo/booking_id29 VALUE '21'. CONSTANTS lc_booking_supplement_id_2_1 TYPE /dmo/booking_supplement_id29 VALUE '10'. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' description = 'My_Deep_Insert_Fail' ) it_booking = VALUE #( ( booking_id = lc_booking_id_1 booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ( booking_id = lc_booking_id_2 booking_date = gv_booking_date customer_id = gv_customer_id_2 carrier_id = gs_flight_2-carrier_id connection_id = gs_flight_2-connection_id flight_date = gs_flight_2-flight_date ) ) it_booking_supplement = VALUE #( ( booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_1 supplement_id = gv_supplement_id_unknown " <<< Unknown Supplement ID price = '20.0' currency_code = 'EUR' ) ) IMPORTING es_travel = DATA(ls_travel_fail) et_booking = DATA(lt_booking) et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( ls_travel_fail-travel_id ). cl_abap_unit_assert=>assert_initial( lt_booking ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>supplement_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_supplement_id exp = gv_supplement_id_unknown ). gr_cut->save( ). " Delete the first travel, this would fail when first travel had not been created _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD u_single_travel_multiple. DATA lv_db_exists TYPE abap_bool. " Create and persis a travel with 1 booking and 3 booking supplements CONSTANTS lc_booking_id_1 TYPE /dmo/booking_id29 VALUE '20'. CONSTANTS lc_booking_supplement_id_1_1 TYPE /dmo/booking_supplement_id29 VALUE '10'. CONSTANTS lc_booking_supplement_id_1_2 TYPE /dmo/booking_supplement_id29 VALUE '20'. CONSTANTS lc_booking_supplement_id_1_3 TYPE /dmo/booking_supplement_id29 VALUE '30'. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' description = 'My_Deep_Insert_1' ) it_booking = VALUE #( ( booking_id = lc_booking_id_1 booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date flight_price = '100.00' currency_code = 'EUR' ) ) it_booking_supplement = VALUE #( ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_2 supplement_id = gs_supplement_1-supplement_id price = '20.0' currency_code = 'EUR' ) ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_3 supplement_id = gs_supplement_1-supplement_id price = '30.0' currency_code = 'EUR' ) ) IMPORTING es_travel = DATA(ls_travel) et_booking = DATA(lt_booking) et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_supplement ) exp = 3 ). DATA(ls_booking_supplement_1_1) = lt_booking_supplement[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 ]. gr_cut->save( ). CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_1 AND booking_supplement_id = @lc_booking_supplement_id_1_2 INTO @lv_db_exists. cl_abap_unit_assert=>assert_true( lv_db_exists ). " Now do (and save) a complicated update: " -- Change a travel attribute " -- Change a booking attribute " -- Change a booking supplement attribute " -- Create a new booking " -- Delete a Booking Supplement " -- Create a Booking Supplement for an existing Booking " -- Create a new Booking Supplement for the new Booking CONSTANTS lc_booking_id_2 TYPE /dmo/booking_id29 VALUE '10'. CONSTANTS lc_booking_supplement_id_2_1 TYPE /dmo/booking_supplement_id29 VALUE '10'. CONSTANTS lc_booking_supplement_id_1_4 TYPE /dmo/booking_supplement_id29 VALUE '40'. CONSTANTS lc_diff TYPE /dmo/supplement_price29 VALUE '123.00'. DATA(lv_new_price) = ls_booking_supplement_1_1-price + lc_diff. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id description = 'My_Deep_Insert_2' ) is_travelx = VALUE #( travel_id = ls_travel-travel_id description = abap_true ) it_booking = VALUE #( ( booking_id = lc_booking_id_1 customer_id = gv_customer_id_2 ) ( booking_id = lc_booking_id_2 booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_2-carrier_id connection_id = gs_flight_2-connection_id flight_date = gs_flight_2-flight_date flight_price = '200.00' currency_code = 'EUR' ) ) it_bookingx = VALUE #( ( booking_id = lc_booking_id_1 action_code = /dmo/if_flight_legacy29=>action_code-update customer_id = abap_true ) ( booking_id = lc_booking_id_2 action_code = /dmo/if_flight_legacy29=>action_code-create ) ) it_booking_supplement = VALUE #( ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 price = lv_new_price currency_code = 'EUR' ) ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_2 ) ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_4 supplement_id = gs_supplement_2-supplement_id price = '40.0' currency_code = 'EUR' ) ( booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_1 supplement_id = gs_supplement_2-supplement_id price = '50.0' currency_code = 'EUR' ) ) it_booking_supplementx = VALUE #( ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true currency_code = 'EUR' ) ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_2 action_code = /dmo/if_flight_legacy29=>action_code-delete ) ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_4 action_code = /dmo/if_flight_legacy29=>action_code-create ) ( booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_1 action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING es_travel = DATA(ls_travel_aft_update) et_booking = DATA(lt_booking_aft_update) et_booking_supplement = DATA(lt_booking_suppl_aft_update) et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = ls_travel_aft_update-travel_id exp = ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_aft_update ) exp = 2 ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_aft_update[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_1 ] ) ) ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_aft_update[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_2 ] ) ) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_suppl_aft_update ) exp = 3 ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_suppl_aft_update[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 ] ) ) ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_suppl_aft_update[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_4 ] ) ) ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_suppl_aft_update[ travel_id = ls_travel-travel_id booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_1 ] ) ) ). gr_cut->save( ). " Check Travel DATA ls_travel_sel TYPE /dmo/travel29. SELECT SINGLE total_price, currency_code, description FROM /dmo/travel29 WHERE travel_id = @ls_travel-travel_id INTO CORRESPONDING FIELDS OF @ls_travel_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-total_price exp = '100.00' + '200.00' + lv_new_price + '30.00' + '40.00' + '50.00' ) ##LITERAL. cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-currency_code exp = 'EUR' ). cl_abap_unit_assert=>assert_equals( act = ls_travel_sel-description exp = 'My_Deep_Insert_2' ). " Check Booking(s) " -- Updated Booking DATA ls_booking_sel TYPE /dmo/booking29. SELECT SINGLE booking_date, customer_id FROM /dmo/booking29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_1 INTO CORRESPONDING FIELDS OF @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-booking_date exp = gv_booking_date ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-customer_id exp = gv_customer_id_2 ). " -- New Booking CLEAR ls_booking_sel. SELECT SINGLE customer_id, flight_date FROM /dmo/booking29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_2 INTO CORRESPONDING FIELDS OF @ls_booking_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-customer_id exp = gv_customer_id_1 ). cl_abap_unit_assert=>assert_equals( act = ls_booking_sel-flight_date exp = gs_flight_2-flight_date ). " Check Booking Supplement(s) " -- Updated Booking Supplement DATA ls_booking_supplement_sel TYPE /dmo/book_sup_29. SELECT SINGLE supplement_id, price FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_1 AND booking_supplement_id = @lc_booking_supplement_id_1_1 INTO CORRESPONDING FIELDS OF @ls_booking_supplement_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-supplement_id exp = gs_supplement_1-supplement_id ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-price exp = lv_new_price ). " -- Deleted Booking Supplement CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_1 AND booking_supplement_id = @lc_booking_supplement_id_1_2 INTO @lv_db_exists. cl_abap_unit_assert=>assert_false( lv_db_exists ). " -- Unchanged Booking Supplement CLEAR lv_db_exists. SELECT SINGLE FROM /dmo/book_sup_29 FIELDS @abap_true WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_1 AND booking_supplement_id = @lc_booking_supplement_id_1_3 INTO @lv_db_exists. cl_abap_unit_assert=>assert_true( lv_db_exists ). " -- Created Booking Supplement for the existing Booking CLEAR ls_booking_supplement_sel. SELECT SINGLE supplement_id FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_1 AND booking_supplement_id = @lc_booking_supplement_id_1_4 INTO CORRESPONDING FIELDS OF @ls_booking_supplement_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-supplement_id exp = gs_supplement_2-supplement_id ). " -- Created Booking Supplement for the new Booking CLEAR ls_booking_supplement_sel. SELECT SINGLE supplement_id FROM /dmo/book_sup_29 WHERE travel_id = @ls_travel-travel_id AND booking_id = @lc_booking_id_2 AND booking_supplement_id = @lc_booking_supplement_id_2_1 INTO CORRESPONDING FIELDS OF @ls_booking_supplement_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-supplement_id exp = gs_supplement_2-supplement_id ). _delete_existing_travel( ls_travel-travel_id ). ENDMETHOD. METHOD read_db. DATA(ls_travel) = _create_travel( is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' ) iv_save = abap_false ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). " Create 2 bookings for the new travel _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '20' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). _create_booking( iv_travel_id = ls_travel-travel_id is_booking = VALUE #( booking_id = '21' booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) iv_save = abap_false ). " Create a single booking supplement for the first booking _create_booking_suppl( iv_travel_id = ls_travel-travel_id is_booking_supplement = VALUE #( booking_id = '20' booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) iv_save = abap_false ). " Create 2 booking supplements for the second booking _create_booking_suppl( iv_travel_id = ls_travel-travel_id is_booking_supplement = VALUE #( booking_id = '21' booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id price = '20.0' currency_code = 'EUR' ) iv_save = abap_false ). _create_booking_suppl( iv_travel_id = ls_travel-travel_id is_booking_supplement = VALUE #( booking_id = '21' booking_supplement_id = '20' supplement_id = gs_supplement_2-supplement_id price = '30.0' currency_code = 'EUR' ) iv_save = abap_true )." <<< Finally write to DB gr_cut->get_travel( EXPORTING iv_travel_id = ls_travel-travel_id iv_include_buffer = abap_true IMPORTING es_travel = DATA(ls_travel_read) et_booking = DATA(lt_booking_read) et_booking_supplement = DATA(lt_booking_supplement_read) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = ls_travel_read-travel_id exp = ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_read-agency_id exp = ls_travel-agency_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_read ) exp = 2 ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_supplement_read ) exp = 3 ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_supplement_read[ travel_id = ls_travel-travel_id booking_id = '21' booking_supplement_id = '20' ] ) ) ). cl_abap_unit_assert=>assert_equals( act = lt_booking_supplement_read[ travel_id = ls_travel-travel_id booking_id = '21' booking_supplement_id = '20' ]-supplement_id exp = gs_supplement_2-supplement_id ). _delete_existing_travel( ls_travel-travel_id ). gr_cut->get_travel( EXPORTING iv_travel_id = ls_travel-travel_id iv_include_buffer = abap_true IMPORTING es_travel = ls_travel_read et_booking = lt_booking_read et_booking_supplement = lt_booking_supplement_read et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( ls_travel_read ). cl_abap_unit_assert=>assert_initial( lt_booking_read ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement_read ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_travel-travel_id ). ENDMETHOD. METHOD read_buffer. CONSTANTS lc_booking_id_1 TYPE /dmo/booking_id29 VALUE '20'. CONSTANTS lc_booking_id_2 TYPE /dmo/booking_id29 VALUE '21'. CONSTANTS lc_booking_supplement_id_1_1 TYPE /dmo/booking_supplement_id29 VALUE '10'. CONSTANTS lc_booking_supplement_id_2_1 TYPE /dmo/booking_supplement_id29 VALUE '10'. CONSTANTS lc_booking_supplement_id_2_2 TYPE /dmo/booking_supplement_id29 VALUE '20'. gr_cut->create_travel( EXPORTING is_travel = VALUE #( agency_id = gv_agency_id_1 customer_id = gv_customer_id_1 begin_date = '20190101' end_date = '20190201' description = 'My_Deep_Insert' ) it_booking = VALUE #( ( booking_id = lc_booking_id_1 booking_date = gv_booking_date customer_id = gv_customer_id_1 carrier_id = gs_flight_1-carrier_id connection_id = gs_flight_1-connection_id flight_date = gs_flight_1-flight_date ) ( booking_id = lc_booking_id_2 booking_date = gv_booking_date customer_id = gv_customer_id_2 carrier_id = gs_flight_2-carrier_id connection_id = gs_flight_2-connection_id flight_date = gs_flight_2-flight_date ) ) it_booking_supplement = VALUE #( ( booking_id = lc_booking_id_1 booking_supplement_id = lc_booking_supplement_id_1_1 supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) ( booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_1 supplement_id = gs_supplement_1-supplement_id price = '20.0' currency_code = 'EUR' ) ( booking_id = lc_booking_id_2 booking_supplement_id = lc_booking_supplement_id_2_2 supplement_id = gs_supplement_2-supplement_id price = '30.0' currency_code = 'EUR' ) ) IMPORTING es_travel = DATA(ls_travel) et_booking = DATA(lt_booking) et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_not_initial( ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking ) exp = 2 ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_supplement ) exp = 3 ). " Now delete the first booking from the buffer gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_travel-travel_id ) is_travelx = VALUE #( travel_id = ls_travel-travel_id ) it_booking = VALUE #( ( booking_id = lc_booking_id_1 ) ) it_bookingx = VALUE #( ( booking_id = lc_booking_id_1 action_code = /dmo/if_flight_legacy29=>action_code-delete ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). gr_cut->get_travel( EXPORTING iv_travel_id = ls_travel-travel_id iv_include_buffer = abap_true IMPORTING es_travel = DATA(ls_travel_read) et_booking = DATA(lt_booking_read) et_booking_supplement = DATA(lt_booking_supplement_read) et_messages = lt_messages ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = ls_travel_read-travel_id exp = ls_travel-travel_id ). cl_abap_unit_assert=>assert_equals( act = ls_travel_read-agency_id exp = ls_travel-agency_id ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_read ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_supplement_read ) exp = 2 ). cl_abap_unit_assert=>assert_true( xsdbool( line_exists( lt_booking_supplement_read[ travel_id = ls_travel-travel_id booking_id = '21' booking_supplement_id = '20' ] ) ) ). cl_abap_unit_assert=>assert_equals( act = lt_booking_supplement_read[ travel_id = ls_travel-travel_id booking_id = '21' booking_supplement_id = '20' ]-supplement_id exp = gs_supplement_2-supplement_id ). gr_cut->initialize( ). ENDMETHOD. METHOD read_travel_id_initial. gr_cut->get_travel( EXPORTING iv_travel_id = '0' iv_include_buffer = abap_true IMPORTING es_travel = DATA(ls_travel_read) et_booking = DATA(lt_booking_read) et_booking_supplement = DATA(lt_booking_supplement_read) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( ls_travel_read ). cl_abap_unit_assert=>assert_initial( lt_booking_read ). cl_abap_unit_assert=>assert_initial( lt_booking_supplement_read ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>travel_no_key-msgno ). ENDMETHOD. METHOD u_supplement_id. DATA(ls_booking_supplement) = _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id price = '10.0' currency_code = 'EUR' ) iv_save = abap_true ). " Pretend to change the supplement ID (provide the same value) gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_supplement-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_supplement-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id supplement_id = gs_supplement_1-supplement_id ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update supplement_id = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). " Try to update the Booking Supplement with an unknown supplement ID gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_supplement-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_supplement-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id supplement_id = gs_supplement_2-supplement_id price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update supplement_id = abap_true price = abap_true ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_suppl_id_u-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_booking_supplement-travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking_supplement-booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = ls_booking_supplement-booking_supplement_id ). gr_cut->save( ). " Check that nothing has changed SELECT SINGLE supplement_id, price FROM /dmo/book_sup_29 WHERE travel_id = @ls_booking_supplement-travel_id AND booking_id = @ls_booking_supplement-booking_id AND booking_supplement_id = @ls_booking_supplement-booking_supplement_id INTO ( @DATA(lv_supplement_id), @DATA(lv_price) ). cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = lv_supplement_id exp = gs_supplement_1-supplement_id ). cl_abap_unit_assert=>assert_equals( act = lv_price exp = '10' ). ENDMETHOD. METHOD c_price_currency. " Do not provide price and currency _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id ) iv_save = abap_false ). " Provide price and currency CONSTANTS lc_diff TYPE /dmo/supplement_price29 VALUE '9.99'. DATA lv_price TYPE /dmo/supplement_price29. DATA lv_currency_code TYPE /dmo/currency_code29. lv_price = gs_supplement_1-price + lc_diff. lv_currency_code = SWITCH #( gs_supplement_1-currency_code WHEN 'USD' THEN 'EUR' ELSE 'USD' ). _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = '20' supplement_id = gs_supplement_1-supplement_id price = lv_price currency_code = lv_currency_code ) iv_save = abap_true ). DATA ls_booking_supplement_sel TYPE /dmo/book_sup_29. SELECT SINGLE price, currency_code FROM /dmo/book_sup_29 WHERE travel_id = @mv_travel_id AND booking_id = @mv_booking_id AND booking_supplement_id = '10' INTO CORRESPONDING FIELDS OF @ls_booking_supplement_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-price exp = gs_supplement_1-price ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-currency_code exp = gs_supplement_1-currency_code ). CLEAR ls_booking_supplement_sel. SELECT SINGLE price, currency_code FROM /dmo/book_sup_29 WHERE travel_id = @mv_travel_id AND booking_id = @mv_booking_id AND booking_supplement_id = '20' INTO CORRESPONDING FIELDS OF @ls_booking_supplement_sel. cl_abap_unit_assert=>assert_subrc( ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-price exp = lv_price ). cl_abap_unit_assert=>assert_equals( act = ls_booking_supplement_sel-currency_code exp = lv_currency_code ). ENDMETHOD. METHOD u_price_currency. DATA(ls_booking_supplement) = _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id ) iv_save = abap_true ). " Try to change only the price gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_supplement-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_supplement-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id price = '11.0' ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_pri_curr_u-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_booking_supplement-travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking_supplement-booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = ls_booking_supplement-booking_supplement_id ). " Try to change only the currency CLEAR lt_messages. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_supplement-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_supplement-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id currency_code = 'XXX' ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update currency_code = abap_true ) ) IMPORTING et_messages = lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>booking_supplement_pri_curr_u-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_TRAVEL_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr2 exp = 'MV_BOOKING_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr3 exp = 'MV_BOOKING_SUPPLEMENT_ID' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_travel_id exp = ls_booking_supplement-travel_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_id exp = ls_booking_supplement-booking_id ). cl_abap_unit_assert=>assert_equals( act = lx->mv_booking_supplement_id exp = ls_booking_supplement-booking_supplement_id ). ENDMETHOD. METHOD c_currency_code_unknown. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = mv_travel_id ) is_travelx = VALUE #( travel_id = mv_travel_id ) it_booking_supplement = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id price = '9.99' currency_code = gv_currency_code_unknown ) ) it_booking_supplementx = VALUE #( ( booking_id = mv_booking_id booking_supplement_id = '10' action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>currency_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CURRENCY_CODE' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_currency_code exp = gv_currency_code_unknown ). ENDMETHOD. METHOD u_currency_code_unknown. DATA(ls_booking_supplement) = _create_booking_suppl( iv_travel_id = mv_travel_id is_booking_supplement = VALUE #( booking_id = mv_booking_id booking_supplement_id = '10' supplement_id = gs_supplement_1-supplement_id ) iv_save = abap_true ). gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = ls_booking_supplement-travel_id ) is_travelx = VALUE #( travel_id = ls_booking_supplement-travel_id ) it_booking_supplement = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id price = '9.99' currency_code = gv_currency_code_unknown ) ) it_booking_supplementx = VALUE #( ( booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-update price = abap_true currency_code = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_equals( act = lines( lt_messages ) exp = 1 ). cl_abap_unit_assert=>assert_true( xsdbool( lt_messages[ 1 ] IS INSTANCE OF /dmo/cx_flight_legacy29 ) ). DATA lx TYPE REF TO /dmo/cx_flight_legacy29. lx ?= lt_messages[ 1 ]. cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgid exp = mc_msgid ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-msgno exp = /dmo/cx_flight_legacy29=>currency_unknown-msgno ). cl_abap_unit_assert=>assert_equals( act = lx->if_t100_message~t100key-attr1 exp = 'MV_CURRENCY_CODE' ). cl_abap_unit_assert=>assert_equals( act = lx->mv_currency_code exp = gv_currency_code_unknown ). ENDMETHOD. METHOD _create_booking_suppl. gr_cut->update_travel( EXPORTING is_travel = VALUE #( travel_id = iv_travel_id ) is_travelx = VALUE #( travel_id = iv_travel_id ) it_booking_supplement = VALUE #( ( is_booking_supplement ) ) it_booking_supplementx = VALUE #( ( booking_id = is_booking_supplement-booking_id booking_supplement_id = is_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy29=>action_code-create ) ) IMPORTING et_booking_supplement = DATA(lt_booking_supplement) et_messages = DATA(lt_messages) ). cl_abap_unit_assert=>assert_initial( lt_messages ). cl_abap_unit_assert=>assert_equals( act = lines( lt_booking_supplement ) exp = 1 ). rs_booking_supplement = lt_booking_supplement[ 1 ]. cl_abap_unit_assert=>assert_equals( act = rs_booking_supplement-travel_id exp = iv_travel_id ). cl_abap_unit_assert=>assert_equals( act = rs_booking_supplement-booking_id exp = is_booking_supplement-booking_id ). cl_abap_unit_assert=>assert_equals( act = rs_booking_supplement-booking_supplement_id exp = is_booking_supplement-booking_supplement_id ). IF iv_save = abap_true. gr_cut->save( ). ENDIF. ENDMETHOD. ENDCLASS.
70.372772
222
0.597863
c83db3961a27717945d7948a562a6944f740a543
279
abap
ABAP
src/zcl_app_html.clas.testclasses.abap
dreitagebart/abap-app-framework
376cf5156cb947c2fac947fc8779d2da0e1199c4
[ "MIT" ]
null
null
null
src/zcl_app_html.clas.testclasses.abap
dreitagebart/abap-app-framework
376cf5156cb947c2fac947fc8779d2da0e1199c4
[ "MIT" ]
null
null
null
src/zcl_app_html.clas.testclasses.abap
dreitagebart/abap-app-framework
376cf5156cb947c2fac947fc8779d2da0e1199c4
[ "MIT" ]
null
null
null
CLASS ltcl_does_it_work DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. METHODS: first_test FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_does_it_work IMPLEMENTATION. METHOD first_test. ENDMETHOD. ENDCLASS.
15.5
53
0.777778
c83e812a61630ecc1f1174a2cfd22c71c9d48618
43,702
abap
ABAP
src/ui/zcl_abapgit_gui_page_view_repo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_view_repo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_view_repo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_view_repo DEFINITION PUBLIC FINAL INHERITING FROM zcl_abapgit_gui_page CREATE PUBLIC. PUBLIC SECTION. CONSTANTS: BEGIN OF c_actions, repo_list TYPE string VALUE 'abapgit_home' ##NO_TEXT, change_dir TYPE string VALUE 'change_dir' ##NO_TEXT, toggle_hide_files TYPE string VALUE 'toggle_hide_files' ##NO_TEXT, toggle_folders TYPE string VALUE 'toggle_folders' ##NO_TEXT, toggle_changes TYPE string VALUE 'toggle_changes' ##NO_TEXT, toggle_order_by TYPE string VALUE 'toggle_order_by' ##NO_TEXT, toggle_diff_first TYPE string VALUE 'toggle_diff_first ' ##NO_TEXT, display_more TYPE string VALUE 'display_more' ##NO_TEXT, END OF c_actions. INTERFACES: zif_abapgit_gui_hotkeys. METHODS constructor IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION. PROTECTED SECTION. METHODS render_content REDEFINITION. PRIVATE SECTION. DATA mt_col_spec TYPE zif_abapgit_definitions=>tty_col_spec. DATA: mo_repo TYPE REF TO zcl_abapgit_repo, mv_cur_dir TYPE string, mv_hide_files TYPE abap_bool, mv_max_lines TYPE i, mv_max_setting TYPE i, mv_show_folders TYPE abap_bool, mv_changes_only TYPE abap_bool, mv_show_order_by TYPE abap_bool, mv_order_by TYPE string, mv_order_descending TYPE abap_bool, mv_diff_first TYPE abap_bool, mv_key TYPE zif_abapgit_persistence=>ty_value, mv_are_changes_recorded_in_tr TYPE abap_bool. METHODS: render_head_line IMPORTING iv_lstate TYPE char1 iv_rstate TYPE char1 RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception, build_head_menu IMPORTING iv_lstate TYPE char1 iv_rstate TYPE char1 RETURNING VALUE(ro_toolbar) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception, build_grid_menu RETURNING VALUE(ro_toolbar) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception, render_item IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item iv_render_transports TYPE abap_bool RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception, render_item_files IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html, render_item_command IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html, get_item_class IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_html) TYPE string, get_item_icon IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_html) TYPE string, render_item_lock_column IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_html) TYPE string, render_empty_package RETURNING VALUE(rv_html) TYPE string, render_parent_dir RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception. METHODS: build_obj_jump_link IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_html) TYPE string, build_dir_jump_link IMPORTING iv_path TYPE string RETURNING VALUE(rv_html) TYPE string, build_inactive_object_code IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_inactive_html_code) TYPE string, open_in_master_language RAISING zcx_abapgit_exception, render_order_by RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, apply_order_by CHANGING ct_repo_items TYPE zif_abapgit_definitions=>tt_repo_items, build_branch_dropdown IMPORTING iv_wp_opt LIKE zif_abapgit_html=>c_html_opt-crossout RETURNING VALUE(ro_branch_dropdown) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception, build_tag_dropdown IMPORTING iv_wp_opt LIKE zif_abapgit_html=>c_html_opt-crossout RETURNING VALUE(ro_tag_dropdown) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception, build_advanced_dropdown IMPORTING iv_wp_opt LIKE zif_abapgit_html=>c_html_opt-crossout iv_lstate TYPE char1 iv_rstate TYPE char1 RETURNING VALUE(ro_advanced_dropdown) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception, build_main_toolbar IMPORTING iv_pull_opt LIKE zif_abapgit_html=>c_html_opt-crossout iv_lstate TYPE char1 iv_rstate TYPE char1 io_tb_branch TYPE REF TO zcl_abapgit_html_toolbar io_tb_tag TYPE REF TO zcl_abapgit_html_toolbar io_tb_advanced TYPE REF TO zcl_abapgit_html_toolbar RETURNING VALUE(ro_toolbar) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception. METHODS _add_col IMPORTING iv_str TYPE string. METHODS build_main_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION. METHOD apply_order_by. DATA: lt_sort TYPE abap_sortorder_tab, ls_sort LIKE LINE OF lt_sort, lt_non_code_and_metadata_items LIKE ct_repo_items, lt_code_items LIKE ct_repo_items, lt_diff_items LIKE ct_repo_items. FIELD-SYMBOLS: <ls_repo_item> TYPE zif_abapgit_definitions=>ty_repo_item. IF mv_order_by IS INITIAL. RETURN. ENDIF. " we want to preserve non-code and metadata files at the top, " so we isolate them and and sort only the code artifacts LOOP AT ct_repo_items ASSIGNING <ls_repo_item>. IF <ls_repo_item>-obj_type IS INITIAL AND <ls_repo_item>-is_dir = abap_false. INSERT <ls_repo_item> INTO TABLE lt_non_code_and_metadata_items. ELSE. INSERT <ls_repo_item> INTO TABLE lt_code_items. ENDIF. ENDLOOP. IF mv_diff_first = abap_true. " fix diffs on the top, right after non-code and metadata LOOP AT lt_code_items ASSIGNING <ls_repo_item> WHERE changes > 0. INSERT <ls_repo_item> INTO TABLE lt_diff_items. ENDLOOP. DELETE lt_code_items WHERE changes > 0. ENDIF. CLEAR: ct_repo_items. ls_sort-name = mv_order_by. ls_sort-descending = mv_order_descending. ls_sort-astext = abap_true. INSERT ls_sort INTO TABLE lt_sort. SORT lt_code_items BY (lt_sort). SORT lt_diff_items BY (lt_sort). INSERT LINES OF lt_non_code_and_metadata_items INTO TABLE ct_repo_items. INSERT LINES OF lt_diff_items INTO TABLE ct_repo_items. INSERT LINES OF lt_code_items INTO TABLE ct_repo_items. ENDMETHOD. METHOD build_advanced_dropdown. DATA: lv_crossout LIKE zif_abapgit_html=>c_html_opt-crossout. CREATE OBJECT ro_advanced_dropdown. IF iv_rstate IS NOT INITIAL OR iv_lstate IS NOT INITIAL. " In case of asyncronicities ro_advanced_dropdown->add( iv_txt = 'Reset Local (Force Pull)' iv_act = |{ zif_abapgit_definitions=>c_action-git_reset }?{ mv_key }| iv_opt = iv_wp_opt ). ENDIF. IF mo_repo->is_offline( ) = abap_false. " Online ? ro_advanced_dropdown->add( iv_txt = 'Background Mode' iv_act = |{ zif_abapgit_definitions=>c_action-go_background }?{ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Change Remote' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remote_change }?{ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Make Off-line' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remote_detach }?{ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Force Stage' iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }?{ mv_key }| ). CLEAR lv_crossout. IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-transport_to_branch ) = abap_false. lv_crossout = zif_abapgit_html=>c_html_opt-crossout. ENDIF. ro_advanced_dropdown->add( iv_txt = 'Transport to Branch' iv_act = |{ zif_abapgit_definitions=>c_action-repo_transport_to_branch }?{ mv_key }| iv_opt = lv_crossout ). ELSE. ro_advanced_dropdown->add( iv_txt = 'Make On-line' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remote_attach }?{ mv_key }| ). ENDIF. IF mv_are_changes_recorded_in_tr = abap_true. ro_advanced_dropdown->add( iv_txt = 'Add all objects to transport request' iv_act = |{ zif_abapgit_definitions=>c_action-repo_add_all_obj_to_trans_req }?{ mv_key }| ). ENDIF. ro_advanced_dropdown->add( iv_txt = 'Syntax Check' iv_act = |{ zif_abapgit_definitions=>c_action-repo_syntax_check }?{ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Run Code Inspector' iv_act = |{ zif_abapgit_definitions=>c_action-repo_code_inspector }?{ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Repository Settings' iv_act = |{ zif_abapgit_definitions=>c_action-repo_settings }?{ mv_key }| ). CLEAR lv_crossout. IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-update_local_checksum ) = abap_false. lv_crossout = zif_abapgit_html=>c_html_opt-crossout. ENDIF. ro_advanced_dropdown->add( iv_txt = 'Update Local Checksums' iv_act = |{ zif_abapgit_definitions=>c_action-repo_refresh_checksums }?{ mv_key }| iv_opt = lv_crossout ). IF mo_repo->get_dot_abapgit( )->get_master_language( ) <> sy-langu. ro_advanced_dropdown->add( iv_txt = 'Open in Master Language' iv_act = |{ zif_abapgit_definitions=>c_action-repo_open_in_master_lang }?{ mv_key }| ). ENDIF. ro_advanced_dropdown->add( iv_txt = 'Remove' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }?{ mv_key }| ). CLEAR lv_crossout. IF mo_repo->get_local_settings( )-write_protected = abap_true OR zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-uninstall ) = abap_false. lv_crossout = zif_abapgit_html=>c_html_opt-crossout. ENDIF. ro_advanced_dropdown->add( iv_txt = 'Uninstall' iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }?{ mv_key }| iv_opt = lv_crossout ). ENDMETHOD. METHOD build_branch_dropdown. CREATE OBJECT ro_branch_dropdown. IF mo_repo->is_offline( ) = abap_true. RETURN. ENDIF. ro_branch_dropdown->add( iv_txt = 'Overview' iv_act = |{ zif_abapgit_definitions=>c_action-go_branch_overview }?{ mv_key }| ). ro_branch_dropdown->add( iv_txt = 'Switch' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_switch }?{ mv_key }| iv_opt = iv_wp_opt ). ro_branch_dropdown->add( iv_txt = 'Create' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_create }?{ mv_key }| ). ro_branch_dropdown->add( iv_txt = 'Delete' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_delete }?{ mv_key }| ). ENDMETHOD. METHOD build_dir_jump_link. DATA: lv_path TYPE string, lv_encode TYPE string. lv_path = iv_path. REPLACE FIRST OCCURRENCE OF mv_cur_dir IN lv_path WITH ''. lv_encode = zcl_abapgit_html_action_utils=>dir_encode( lv_path ). rv_html = zcl_abapgit_html=>a( iv_txt = lv_path iv_act = |{ c_actions-change_dir }?{ lv_encode }| ). ENDMETHOD. METHOD build_grid_menu. CREATE OBJECT ro_toolbar. IF mo_repo->has_remote_source( ) = abap_true. ro_toolbar->add( iv_txt = 'Show Files' iv_chk = boolc( NOT mv_hide_files = abap_true ) iv_act = c_actions-toggle_hide_files ). ro_toolbar->add( iv_txt = 'Show Changes Only' iv_chk = mv_changes_only iv_act = c_actions-toggle_changes ). ENDIF. ro_toolbar->add( iv_txt = 'Show Folders' iv_chk = mv_show_folders iv_act = c_actions-toggle_folders ). ro_toolbar->add( iv_txt = 'Show Order By' iv_chk = mv_show_order_by iv_act = c_actions-toggle_order_by ). ENDMETHOD. METHOD build_head_menu. DATA: lo_tb_advanced TYPE REF TO zcl_abapgit_html_toolbar, lo_tb_branch TYPE REF TO zcl_abapgit_html_toolbar, lo_tb_tag TYPE REF TO zcl_abapgit_html_toolbar, lv_wp_opt LIKE zif_abapgit_html=>c_html_opt-crossout, lv_pull_opt LIKE zif_abapgit_html=>c_html_opt-crossout. IF mo_repo->get_local_settings( )-write_protected = abap_true. lv_wp_opt = zif_abapgit_html=>c_html_opt-crossout. lv_pull_opt = zif_abapgit_html=>c_html_opt-crossout. ELSE. lv_pull_opt = zif_abapgit_html=>c_html_opt-strong. ENDIF. lo_tb_branch = build_branch_dropdown( lv_wp_opt ). lo_tb_tag = build_tag_dropdown( lv_wp_opt ). lo_tb_advanced = build_advanced_dropdown( iv_wp_opt = lv_wp_opt iv_rstate = iv_rstate iv_lstate = iv_lstate ). ro_toolbar = build_main_toolbar( iv_pull_opt = lv_pull_opt iv_rstate = iv_rstate iv_lstate = iv_lstate io_tb_branch = lo_tb_branch io_tb_tag = lo_tb_tag io_tb_advanced = lo_tb_advanced ). ENDMETHOD. METHOD build_inactive_object_code. IF is_item-inactive = abap_true. rv_inactive_html_code = zcl_abapgit_html=>icon( iv_name = 'bolt/orange' iv_hint = 'Object or object part is inactive' iv_class = 'inactive' ). ENDIF. ENDMETHOD. METHOD build_main_menu. CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-main'. ro_menu->add( iv_txt = zcl_abapgit_gui_buttons=>repo_list( ) iv_act = zif_abapgit_definitions=>c_action-abapgit_home )->add( iv_txt = zcl_abapgit_gui_buttons=>advanced( ) io_sub = zcl_abapgit_gui_chunk_lib=>advanced_submenu( ) )->add( iv_txt = zcl_abapgit_gui_buttons=>help( ) io_sub = zcl_abapgit_gui_chunk_lib=>help_submenu( ) ). ENDMETHOD. METHOD build_main_toolbar. DATA: li_log TYPE REF TO zif_abapgit_log. CREATE OBJECT ro_toolbar EXPORTING iv_id = 'toolbar-repo'. IF mo_repo->is_offline( ) = abap_false. IF iv_rstate IS NOT INITIAL. " Something new at remote ro_toolbar->add( iv_txt = 'Pull' iv_act = |{ zif_abapgit_definitions=>c_action-git_pull }?{ mv_key }| iv_opt = iv_pull_opt ). ENDIF. IF iv_lstate IS NOT INITIAL. " Something new at local ro_toolbar->add( iv_txt = 'Stage' iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }?{ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ENDIF. IF iv_rstate IS NOT INITIAL OR iv_lstate IS NOT INITIAL. " Any changes ro_toolbar->add( iv_txt = 'Diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ENDIF. li_log = mo_repo->get_log( ). IF li_log IS BOUND AND li_log->count( ) > 0. ro_toolbar->add( iv_txt = 'Log' iv_act = |{ zif_abapgit_definitions=>c_action-repo_log }?{ mv_key }| ). ENDIF. ro_toolbar->add( iv_txt = 'Branch' io_sub = io_tb_branch ) ##NO_TEXT. ro_toolbar->add( iv_txt = 'Tag' io_sub = io_tb_tag ) ##NO_TEXT. ELSE. IF mo_repo->has_remote_source( ) = abap_true AND iv_rstate IS NOT INITIAL. ro_toolbar->add( iv_txt = 'Pull <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-git_pull }?{ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ENDIF. ro_toolbar->add( iv_txt = 'Import <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-zip_import }?{ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Export <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-zip_export }?{ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). li_log = mo_repo->get_log( ). IF li_log IS BOUND AND li_log->count( ) > 0. ro_toolbar->add( iv_txt = 'Log' iv_act = |{ zif_abapgit_definitions=>c_action-repo_log }?{ mv_key }| ). ENDIF. ENDIF. ro_toolbar->add( iv_txt = 'Advanced' io_sub = io_tb_advanced ) ##NO_TEXT. ro_toolbar->add( iv_txt = 'Refresh' iv_act = |{ zif_abapgit_definitions=>c_action-repo_refresh }?{ mv_key }| ). ro_toolbar->add( iv_txt = zcl_abapgit_html=>icon( iv_name = 'cog/grey70' ) io_sub = build_grid_menu( ) ). ENDMETHOD. METHOD build_obj_jump_link. DATA: lv_encode TYPE string. lv_encode = zcl_abapgit_html_action_utils=>jump_encode( iv_obj_type = is_item-obj_type iv_obj_name = is_item-obj_name ). rv_html = zcl_abapgit_html=>a( iv_txt = |{ is_item-obj_name }| iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). ENDMETHOD. METHOD build_tag_dropdown. CREATE OBJECT ro_tag_dropdown. IF mo_repo->is_offline( ) = abap_true. RETURN. ENDIF. ro_tag_dropdown->add( iv_txt = 'Overview' iv_act = |{ zif_abapgit_definitions=>c_action-go_tag_overview }?{ mv_key }| ). ro_tag_dropdown->add( iv_txt = 'Switch' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_switch }?{ mv_key }| iv_opt = iv_wp_opt ). ro_tag_dropdown->add( iv_txt = 'Create' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_create }?{ mv_key }| ). ro_tag_dropdown->add( iv_txt = 'Delete' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_delete }?{ mv_key }| ). ENDMETHOD. METHOD constructor. DATA: lo_settings TYPE REF TO zcl_abapgit_settings, lv_package TYPE devclass. super->constructor( ). mv_key = iv_key. mo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). mv_cur_dir = '/'. " Root mv_hide_files = zcl_abapgit_persistence_user=>get_instance( )->get_hide_files( ). mv_changes_only = zcl_abapgit_persistence_user=>get_instance( )->get_changes_only( ). mv_show_order_by = zcl_abapgit_persistence_user=>get_instance( )->get_show_order_by( ). mv_diff_first = abap_true. ms_control-page_title = 'Repository'. ms_control-page_menu = build_main_menu( ). " Read global settings to get max # of objects to be listed lo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ). mv_max_lines = lo_settings->get_max_lines( ). mv_max_setting = mv_max_lines. lv_package = mo_repo->get_package( ). mv_are_changes_recorded_in_tr = zcl_abapgit_factory=>get_sap_package( lv_package )->are_changes_recorded_in_tr_req( ). ENDMETHOD. METHOD get_item_class. DATA lt_class TYPE TABLE OF string. IF is_item-is_dir = abap_true. APPEND 'folder' TO lt_class. ELSEIF is_item-changes > 0. APPEND 'modified' TO lt_class. ELSEIF is_item-obj_name IS INITIAL. APPEND 'unsupported' TO lt_class. ENDIF. IF lines( lt_class ) > 0. rv_html = | class="{ concat_lines_of( table = lt_class sep = ` ` ) }"|. ENDIF. ENDMETHOD. METHOD get_item_icon. CASE is_item-obj_type. WHEN 'PROG' OR 'CLAS' OR 'FUGR' OR 'INTF' OR 'TYPE'. rv_html = zcl_abapgit_html=>icon( 'file-code/darkgrey' ). WHEN 'W3MI' OR 'W3HT' OR 'SFPF'. rv_html = zcl_abapgit_html=>icon( 'file-image/darkgrey' ). WHEN 'DEVC'. rv_html = zcl_abapgit_html=>icon( 'box/darkgrey' ). WHEN ''. rv_html = space. " no icon WHEN OTHERS. rv_html = zcl_abapgit_html=>icon( 'file-alt/darkgrey' ). ENDCASE. IF is_item-is_dir = abap_true. rv_html = zcl_abapgit_html=>icon( 'folder/darkgrey' ). ENDIF. ENDMETHOD. METHOD open_in_master_language. CONSTANTS: lc_abapgit_tcode TYPE tcode VALUE `ZABAPGIT` ##NO_TEXT. DATA: lv_master_language TYPE spras, lt_spagpa TYPE STANDARD TABLE OF rfc_spagpa, ls_spagpa LIKE LINE OF lt_spagpa, ls_item TYPE zif_abapgit_definitions=>ty_item, lv_subrc TYPE syst-subrc, lv_save_sy_langu TYPE sy-langu. " https://blogs.sap.com/2017/01/13/logon-language-sy-langu-and-rfc/ lv_master_language = mo_repo->get_dot_abapgit( )->get_master_language( ). IF lv_master_language = sy-langu. zcx_abapgit_exception=>raise( |Repo already opened in master language| ). ENDIF. ls_item-obj_name = lc_abapgit_tcode. ls_item-obj_type = |TRAN|. IF zcl_abapgit_objects=>exists( ls_item ) = abap_false. zcx_abapgit_exception=>raise( |Please install the abapGit repository| ). ENDIF. lv_save_sy_langu = sy-langu. SET LOCALE LANGUAGE lv_master_language. ls_spagpa-parid = zif_abapgit_definitions=>c_spagpa_param_repo_key. ls_spagpa-parval = mo_repo->get_key( ). INSERT ls_spagpa INTO TABLE lt_spagpa. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' DESTINATION 'NONE' STARTING NEW TASK 'ABAPGIT' EXPORTING tcode = lc_abapgit_tcode TABLES spagpa_tab = lt_spagpa EXCEPTIONS call_transaction_denied = 1 tcode_invalid = 2 communication_failure = 3 system_failure = 4 OTHERS = 5. lv_subrc = sy-subrc. SET LOCALE LANGUAGE lv_save_sy_langu. IF lv_subrc <> 0. zcx_abapgit_exception=>raise( |Error from ABAP4_CALL_TRANSACTION. Subrc = { lv_subrc }| ). ENDIF. MESSAGE 'Repository opened in a new window' TYPE 'S'. ENDMETHOD. METHOD render_content. DATA: lt_repo_items TYPE zif_abapgit_definitions=>tt_repo_items, lo_browser TYPE REF TO zcl_abapgit_repo_content_list, lx_error TYPE REF TO zcx_abapgit_exception, lv_lstate TYPE char1, lv_rstate TYPE char1, lv_max TYPE abap_bool, lv_max_str TYPE string, lv_add_str TYPE string, li_log TYPE REF TO zif_abapgit_log, lv_render_transports TYPE abap_bool, lv_msg TYPE string, lo_news TYPE REF TO zcl_abapgit_news. FIELD-SYMBOLS <ls_item> LIKE LINE OF lt_repo_items. gui_services( )->get_hotkeys_ctl( )->register_hotkeys( me ). gui_services( )->register_event_handler( me ). register_deferred_script( zcl_abapgit_gui_chunk_lib=>render_repo_palette( zif_abapgit_definitions=>c_action-go_repo ) ). " Reinit, for the case of type change mo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( mo_repo->get_key( ) ). " Check if repo is still valid and reset if necessary to consistent state TRY. mo_repo->validate( ). CATCH zcx_abapgit_exception INTO lx_error. lv_msg = lx_error->get_text( ) && '. Fallback to master branch.'. MESSAGE lv_msg TYPE 'S'. mo_repo->reset( ). ENDTRY. lo_news = zcl_abapgit_news=>create( mo_repo ). CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( |<div class="repo" id="repo{ mv_key }">| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( io_repo = mo_repo io_news = lo_news iv_interactive_branch = abap_true ) ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_news( io_news = lo_news ) ). TRY. lv_render_transports = zcl_abapgit_factory=>get_cts_api( )->is_chrec_possible_for_package( mo_repo->get_package( ) ). CREATE OBJECT lo_browser EXPORTING io_repo = mo_repo. lt_repo_items = lo_browser->list( iv_path = mv_cur_dir iv_by_folders = mv_show_folders iv_changes_only = mv_changes_only ). IF mv_show_order_by = abap_true. apply_order_by( CHANGING ct_repo_items = lt_repo_items ). ENDIF. LOOP AT lt_repo_items ASSIGNING <ls_item>. zcl_abapgit_state=>reduce( EXPORTING iv_cur = <ls_item>-lstate CHANGING cv_prev = lv_lstate ). zcl_abapgit_state=>reduce( EXPORTING iv_cur = <ls_item>-rstate CHANGING cv_prev = lv_rstate ). ENDLOOP. ri_html->add( render_head_line( iv_lstate = lv_lstate iv_rstate = lv_rstate ) ). li_log = lo_browser->get_log( ). IF mo_repo->is_offline( ) = abap_false AND li_log->count( ) > 0. ri_html->add( '<div class="log">' ). ri_html->add( zcl_abapgit_log_viewer=>to_html( li_log ) ). " shows eg. list of unsupported objects ri_html->add( '</div>' ). ENDIF. ri_html->add( '<div class="repo_container">' ). " Offline match banner IF mo_repo->is_offline( ) = abap_true AND mo_repo->has_remote_source( ) = abap_true AND lv_lstate IS INITIAL AND lv_rstate IS INITIAL. ri_html->add( |<div class="panel success repo_banner">| && |ZIP source is attached and completely <b>matches</b> to the local state| && |</div>| ). ENDIF. " Repo content table ri_html->add( '<table class="repo_tab">' ). IF zcl_abapgit_path=>is_root( mv_cur_dir ) = abap_false. ri_html->add( render_parent_dir( ) ). ENDIF. IF mv_show_order_by = abap_true. ri_html->add( render_order_by( ) ). ENDIF. IF lines( lt_repo_items ) = 0. ri_html->add( render_empty_package( ) ). ELSE. LOOP AT lt_repo_items ASSIGNING <ls_item>. IF mv_max_lines > 0 AND sy-tabix > mv_max_lines. lv_max = abap_true. EXIT. " current loop ENDIF. ri_html->add( render_item( is_item = <ls_item> iv_render_transports = lv_render_transports ) ). ENDLOOP. ENDIF. ri_html->add( '</table>' ). IF lv_max = abap_true. ri_html->add( '<div class = "dummydiv">' ). IF mv_max_lines = 1. lv_max_str = '1 object'. ELSE. lv_max_str = |first { mv_max_lines } objects|. ENDIF. lv_add_str = |+{ mv_max_setting }|. ri_html->add( |Only { lv_max_str } shown in list. Display { zcl_abapgit_html=>a( iv_txt = lv_add_str iv_act = c_actions-display_more ) } more. (Set in Advanced > { zcl_abapgit_html=>a( iv_txt = 'Settings' iv_act = zif_abapgit_definitions=>c_action-go_settings ) } )| ). ri_html->add( '</div>' ). ENDIF. ri_html->add( '</div>' ). ri_html->add( '</div>' ). CATCH zcx_abapgit_exception INTO lx_error. ri_html->add( render_head_line( iv_lstate = lv_lstate iv_rstate = lv_rstate ) ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_error( iv_extra_style = 'repo_banner' ix_error = lx_error ) ). ENDTRY. ENDMETHOD. METHOD render_empty_package. DATA: lv_text TYPE string. IF mv_changes_only = abap_true. lv_text = |No changes|. ELSE. lv_text = |Empty package|. ENDIF. rv_html = |<tr class="unsupported"><td class="paddings">| && | <center>{ lv_text }</center>| && |</td></tr>|. ENDMETHOD. METHOD render_head_line. DATA lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar. CREATE OBJECT ri_html TYPE zcl_abapgit_html. lo_toolbar = build_head_menu( iv_lstate = iv_lstate iv_rstate = iv_rstate ). ri_html->add( '<div class="paddings">' ). ri_html->add( '<table class="w100"><tr>' ). IF mv_show_folders = abap_true. ri_html->add( |<td class="current_dir">{ mv_cur_dir }</td>| ). ENDIF. ri_html->add( '<td class="right">' ). ri_html->add( lo_toolbar->render( iv_right = abap_true ) ). ri_html->add( '</td>' ). ri_html->add( '</tr></table>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_item. DATA: lv_link TYPE string, lv_colspan TYPE i. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF iv_render_transports = abap_false. lv_colspan = 2. ELSE. lv_colspan = 3. ENDIF. ri_html->add( |<tr{ get_item_class( is_item ) }>| ). IF is_item-obj_name IS INITIAL AND is_item-is_dir = abap_false. ri_html->add( |<td colspan="{ lv_colspan }"></td>| && '<td class="object">' && '<i class="grey">non-code and meta files</i>' && '</td>' ). ELSE. ri_html->add( |<td class="icon">{ get_item_icon( is_item ) }</td>| ). IF iv_render_transports = abap_true. ri_html->add( render_item_lock_column( is_item ) ). ENDIF. IF is_item-is_dir = abap_true. " Subdir lv_link = build_dir_jump_link( is_item-path ). ri_html->add( |<td class="dir" colspan="2">{ lv_link }</td>| ). ELSE. lv_link = build_obj_jump_link( is_item ). ri_html->add( |<td class="type">{ is_item-obj_type }</td>| ). ri_html->add( |<td class="object">{ lv_link } { build_inactive_object_code( is_item ) }</td>| ). ENDIF. ENDIF. " Files ri_html->add( '<td class="files">' ). ri_html->add( render_item_files( is_item ) ). ri_html->add( '</td>' ). " Command IF mo_repo->has_remote_source( ) = abap_true. ri_html->add( '<td class="cmd">' ). ri_html->add( render_item_command( is_item ) ). ri_html->add( '</td>' ). ENDIF. ri_html->add( '</tr>' ). ENDMETHOD. METHOD render_item_command. DATA: lv_difflink TYPE string, ls_file LIKE LINE OF is_item-files. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF is_item-is_dir = abap_true. " Directory ri_html->add( '<div>' ). ri_html->add( |<span class="grey">{ is_item-changes } changes</span>| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_item-lstate iv_rstate = is_item-rstate ) ). ri_html->add( '</div>' ). ELSEIF is_item-changes > 0. IF mv_hide_files = abap_true AND is_item-obj_name IS NOT INITIAL. lv_difflink = zcl_abapgit_html_action_utils=>obj_encode( iv_key = mo_repo->get_key( ) ig_object = is_item ). ri_html->add( '<div>' ). ri_html->add_a( iv_txt = |diff ({ is_item-changes })| iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?{ lv_difflink }| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_item-lstate iv_rstate = is_item-rstate ) ). ri_html->add( '</div>' ). ELSE. LOOP AT is_item-files INTO ls_file. ri_html->add( '<div>' ). IF ls_file-is_changed = abap_true. lv_difflink = zcl_abapgit_html_action_utils=>file_encode( iv_key = mo_repo->get_key( ) ig_file = ls_file ). ri_html->add_a( iv_txt = 'diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?{ lv_difflink }| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = ls_file-lstate iv_rstate = ls_file-rstate ) ). ELSE. ri_html->add( '&nbsp;' ). ENDIF. ri_html->add( '</div>' ). ENDLOOP. ENDIF. ENDIF. ENDMETHOD. METHOD render_item_files. DATA: ls_file LIKE LINE OF is_item-files. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF mv_hide_files = abap_true AND is_item-obj_type IS NOT INITIAL. RETURN. ENDIF. LOOP AT is_item-files INTO ls_file. ri_html->add( |<div>{ ls_file-path && ls_file-filename }</div>| ). ENDLOOP. ENDMETHOD. METHOD render_item_lock_column. DATA: li_cts_api TYPE REF TO zif_abapgit_cts_api, lv_transport TYPE trkorr, lv_transport_string TYPE string, lv_icon_html TYPE string. li_cts_api = zcl_abapgit_factory=>get_cts_api( ). TRY. IF is_item-obj_type IS INITIAL OR is_item-obj_name IS INITIAL OR li_cts_api->is_object_type_lockable( is_item-obj_type ) = abap_false OR li_cts_api->is_object_locked_in_transport( iv_object_type = is_item-obj_type iv_object_name = is_item-obj_name ) = abap_false. rv_html = |<td class="icon"></td>|. ELSE. lv_transport = li_cts_api->get_current_transport_for_obj( iv_object_type = is_item-obj_type iv_object_name = is_item-obj_name iv_resolve_task_to_request = abap_false ). lv_transport_string = lv_transport. lv_icon_html = zcl_abapgit_html=>a( iv_txt = zcl_abapgit_html=>icon( iv_name = 'briefcase/darkgrey' iv_hint = lv_transport_string ) iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?| && lv_transport ). rv_html = |<td class="icon">| && |{ lv_icon_html }| && |</td>|. ENDIF. CATCH zcx_abapgit_exception. ASSERT 1 = 2. ENDTRY. ENDMETHOD. METHOD render_order_by. DATA: lv_icon TYPE string, lv_html TYPE string. CREATE OBJECT ro_html. CLEAR mt_col_spec. _add_col( '' ). " all empty IF mv_are_changes_recorded_in_tr = abap_true. _add_col( '' ). " all empty ENDIF. " technical name /display name /css class /add timezone /title _add_col( 'OBJ_TYPE /Type' ). _add_col( 'OBJ_NAME /Name' ). _add_col( 'PATH /Path' ). ro_html->add( |<thead>| ). ro_html->add( |<tr>| ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_order_by_header_cells( it_col_spec = mt_col_spec iv_order_by = mv_order_by iv_order_descending = mv_order_descending ) ). IF mv_diff_first = abap_true. lv_icon = 'check/blue'. ELSE. lv_icon = 'check/grey'. ENDIF. lv_html = |<th class="cmd">| && zcl_abapgit_html=>icon( lv_icon ) && zcl_abapgit_html=>a( iv_txt = |Diffs First| iv_act = c_actions-toggle_diff_first ) && |</th>|. ro_html->add( lv_html ). ro_html->add( '</tr>' ). ro_html->add( '</thead>' ). ENDMETHOD. METHOD render_parent_dir. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<tr class="folder">' ). ri_html->add( |<td class="icon">{ zcl_abapgit_html=>icon( 'folder' ) }</td>| ). ri_html->add( |<td class="object" colspan="4">{ build_dir_jump_link( '..' ) }</td>| ). IF mo_repo->has_remote_source( ) = abap_true. ri_html->add( |<td colspan="1"></td>| ). " Dummy for online ENDIF. ri_html->add( '</tr>' ). ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA: lv_path TYPE string. CASE iv_action. WHEN zif_abapgit_definitions=>c_action-go_repo. " Switch to another repo CREATE OBJECT ei_page TYPE zcl_abapgit_gui_page_view_repo EXPORTING iv_key = |{ iv_getdata }|. ev_state = zcl_abapgit_gui=>c_event_state-new_page_replacing. WHEN c_actions-toggle_hide_files. " Toggle file diplay mv_hide_files = zcl_abapgit_persistence_user=>get_instance( )->toggle_hide_files( ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-change_dir. " Change dir lv_path = zcl_abapgit_html_action_utils=>dir_decode( iv_getdata ). mv_cur_dir = zcl_abapgit_path=>change_dir( iv_cur_dir = mv_cur_dir iv_cd = lv_path ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-toggle_folders. " Toggle folder view mv_show_folders = boolc( mv_show_folders <> abap_true ). mv_cur_dir = '/'. " Root ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-toggle_changes. " Toggle changes only view mv_changes_only = zcl_abapgit_persistence_user=>get_instance( )->toggle_changes_only( ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-toggle_order_by. mv_show_order_by = zcl_abapgit_persistence_user=>get_instance( )->toggle_show_order_by( ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-toggle_diff_first. mv_diff_first = boolc( mv_diff_first = abap_false ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-display_more. " Increase MAX lines limit mv_max_lines = mv_max_lines + mv_max_setting. ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-change_order_by. mv_order_by = zcl_abapgit_gui_chunk_lib=>parse_change_order_by( iv_getdata ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-direction. mv_order_descending = zcl_abapgit_gui_chunk_lib=>parse_direction( iv_getdata ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_open_in_master_lang. open_in_master_language( ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN OTHERS. super->zif_abapgit_gui_event_handler~on_event( EXPORTING iv_action = iv_action iv_getdata = iv_getdata it_postdata = it_postdata IMPORTING ei_page = ei_page ev_state = ev_state ). ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_hotkeys~get_hotkey_actions. DATA: ls_hotkey_action LIKE LINE OF rt_hotkey_actions. ls_hotkey_action-ui_component = 'Repo'. ls_hotkey_action-description = |Stage changes|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_stage. ls_hotkey_action-hotkey = |s|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Switch branch|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_branch_switch. ls_hotkey_action-hotkey = |b|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Installed repo list|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-abapgit_home. ls_hotkey_action-hotkey = |o|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Refresh repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_refresh. ls_hotkey_action-hotkey = |r|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Pull|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_pull. ls_hotkey_action-hotkey = |p|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Diff|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_diff. ls_hotkey_action-hotkey = |d|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Uninstall repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_purge. ls_hotkey_action-hotkey = |u|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Run code inspector|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_code_inspector. ls_hotkey_action-hotkey = |i|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Show log|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_log. ls_hotkey_action-hotkey = |l|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ENDMETHOD. METHOD _add_col. FIELD-SYMBOLS <ls_col> LIKE LINE OF mt_col_spec. APPEND INITIAL LINE TO mt_col_spec ASSIGNING <ls_col>. SPLIT iv_str AT '/' INTO <ls_col>-tech_name <ls_col>-display_name <ls_col>-css_class <ls_col>-add_tz <ls_col>-title. CONDENSE <ls_col>-tech_name. CONDENSE <ls_col>-display_name. CONDENSE <ls_col>-css_class. CONDENSE <ls_col>-add_tz. CONDENSE <ls_col>-title. ENDMETHOD. ENDCLASS.
36.786195
120
0.618965
c8438bf59ffccddc59a675c1e0240425720306ba
7,466
abap
ABAP
zcl_max_line_length_pp.clas.testclasses.abap
AlexandreHT/abap_debugger_data_view_extension
b09171a766e13393c6e9d123b1d0af31ac0438c2
[ "Apache-2.0" ]
22
2017-12-17T20:31:38.000Z
2022-02-11T17:59:30.000Z
zcl_max_line_length_pp.clas.testclasses.abap
AlexandreHT/abap_debugger_data_view_extension
b09171a766e13393c6e9d123b1d0af31ac0438c2
[ "Apache-2.0" ]
16
2017-12-18T20:49:06.000Z
2021-10-04T09:28:52.000Z
zcl_max_line_length_pp.clas.testclasses.abap
AlexandreHT/abap_debugger_data_view_extension
b09171a766e13393c6e9d123b1d0af31ac0438c2
[ "Apache-2.0" ]
13
2017-12-18T20:22:44.000Z
2022-01-10T22:31:00.000Z
*"* use this source file for your ABAP unit test classes CLASS ltcl_pretty_printer_should DEFINITION DEFERRED. CLASS zcl_max_line_length_pp DEFINITION LOCAL FRIENDS ltcl_pretty_printer_should. CLASS ltcl_pretty_printer_should DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA cut TYPE REF TO zcl_max_line_length_pp. METHODS: setup, "! test escaped apostrophes in the beginning, middle and end of string. escape_apostrophes FOR TESTING RAISING cx_static_check, indent_and_add_line_breaks FOR TESTING RAISING cx_static_check, "! ABAP Editor does not support more than 255 lines. "! Issue: https://github.com/objective-partner/abap_debugger_data_view_extension/issues/9 break_line_if_length_less_20 FOR TESTING RAISING cx_static_check, max_line_length_less_128 FOR TESTING RAISING cx_static_check, "!calls to pretty printer should be idempotent clear_last_result FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_pretty_printer_should IMPLEMENTATION. METHOD setup. "as we are here in a private unit test class so we don't need to use the factory or injector for instantiating cut = NEW #( indent_size = 2 max_line_length = 128 ). ENDMETHOD. METHOD escape_apostrophes. "GIVEN cut = NEW #( indent_size = 2 max_line_length = 128 ). DATA(input) = |D = VALUE #( COL_1 = 'It''s easy (isn''t it?)' COL_2 = 'keep on doin''' COL_3 = '''ne Weile' COL_4 = '''' )|. DATA(expected) = |D = VALUE #(\r COL_1 = 'It''s easy (isn''t it?)'\r COL_2 = 'keep on doin'''\r COL_3 = '''ne Weile'\r COL_4 = ''''\r)|. "WHEN DATA(formatted_string) = cut->format( input ). "THEN cl_abap_unit_assert=>assert_equals( EXPORTING act = formatted_string exp = expected msg = |Apostrophes or brackets were not handled correctly.| ). ENDMETHOD. METHOD indent_and_add_line_breaks. "GIVEN cut = NEW #( indent_size = 2 max_line_length = 128 ). DATA(input) = |D = VALUE #( COL1 = '1' COL2 = VALUE #( COL1 = '1' COL2 = '2' ) COL3 = '3' COL4 = VALUE #( COL1 = '1' COL2 = '2' ) )|. DATA(expected) = |D = VALUE #(\r COL1 = '1'\r COL2 = VALUE #(\r COL1 = '1'\r COL2 = '2'\r )\r COL3 = '3'\r COL4 = VALUE #(\r COL1 = '1'\r COL2 = '2'\r )\r)|. "D = VALUE #( " COL1 = '1' " COL2 = VALUE #( " COL1 = '1' " COL2 = '2' " ) " COL3 = '3' " COL4 = VALUE #( " COL1 = '1' " COL2 = '2' " ) "). "WHEN DATA(formatted_string) = cut->format( input ). "THEN cl_abap_unit_assert=>assert_equals( EXPORTING act = formatted_string exp = expected msg = |Indent or line breaks were not added correctly| ). ENDMETHOD. METHOD break_line_if_length_less_20. "GIVEN cut = NEW #( indent_size = 2 max_line_length = 20 ). DATA(input) = |D = VALUE #( C1 = 'A123456789B123456789C123456789D123456789E123456789' )|. DATA(expected) = |D = VALUE #(\r C1 = 'A123456789' &&\r 'B123456789C1234' &&\r '56789D123456789' &&\r 'E123456789'\r)|. "WHEN DATA(formatted_string) = cut->format( input ). "THEN cl_abap_unit_assert=>assert_equals( EXPORTING act = formatted_string exp = expected msg = |Values exceeding maximum line length are not handled correctly.| ). ENDMETHOD. METHOD max_line_length_less_128. DATA lines_actual TYPE TABLE OF string. DATA lines_expected TYPE TABLE OF string. "GIVEN cut = NEW #( indent_size = 2 max_line_length = 128 ). DATA(input) = |EDIDD = VALUE #( ( SEGNAM = 'E1EDK01' SDATA = 'EUREUR1.00000 0021 DE12345678901 DE12345678901 INVO1234561234| && | 2.000 2.000 ABCDE 1112223344 | && | ABCDEDFGHIJKLMNOPQRSTUVWXYZ AND STILL SOME MORE CHARACTERS - THERE WILL BE NO END | && | - MAYBE THERE IS AN END IN SIGHT' ) ).|. DATA(expected) = |EDIDD = VALUE #(\r| && | (\r SEGNAM = 'E1EDK01'\r| && | SDATA = 'EUREUR1.00000 0021 DE12345678901 DE12345678901 INVO1234561234 ' &&\r| && | ' 2.000 2.000 ABCDE 1112223344 ' &&\r| && | 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ AND STILL SOME MORE CHARACTERS - THERE WILL BE NO END ' &&\r| && | ' - MAYBE THERE IS AN END IN SIGHT'\r| && | )\r)|. lines_expected = VALUE #( ( |EDIDD = VALUE #(| ) ( | (| ) ( | SEGNAM = 'E1EDK01'| ) ( | SDATA = 'EUREUR1.00000 0021 DE12345678901 DE12345678901 INVO1234561234 ' &&| ) ( | ' 2.000 2.000 ABCDE 1112223344 ' &&| ) ( | 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ AND STILL SOME MORE CHARACTERS - THERE WILL BE NO END ' &&| ) ( | ' - MAYBE THERE IS AN END IN SIGHT'| ) ( | )| ) ( |)| ) ). "EDIDD = VALUE #( " ( " SEGNAM = 'E1EDK01' " SDATA = 'EUREUR1.00000 0021 DE12345678901 DE12345678901 INVO1234561234 ' && " ' 2.000 2.000 ABCDE 1112223344 ' && " 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ AND STILL SOME MORE CHARACTERS - THERE WILL BE NO END ' && " ' - MAYBE THERE IS AN END IN SIGHT' " ) ") "WHEN DATA(formated_string) = cut->format( input ). SPLIT formated_string AT zcl_max_line_length_pp=>c_newline INTO TABLE lines_actual. DATA(max_length) = 0. LOOP AT lines_actual INTO DATA(line). DATA(length) = strlen( line ). max_length = COND i( WHEN length >= max_length THEN length ELSE max_length ). ENDLOOP. "THEN cl_abap_unit_assert=>assert_number_between( lower = 2 upper = 128 number = max_length ). cl_abap_unit_assert=>assert_equals( act = lines_actual exp = lines_expected ). cl_abap_unit_assert=>assert_equals( act = formated_string exp = expected ). ENDMETHOD. METHOD clear_last_result. "GIVEN cut = NEW #( indent_size = 2 max_line_length = 20 ). DATA(input) = |D = VALUE #( C1 = 'A123456789B123456789C123456789D123456789E123456789' )|. DATA(expected) = |D = VALUE #(\r C1 = 'A123456789' &&\r 'B123456789C1234' &&\r '56789D123456789' &&\r 'E123456789'\r)|. "WHEN DATA(formatted_string) = cut->format( input ). "we need to call it twice here, to see if output is still the right one formatted_string = cut->format( input ). "THEN cl_abap_unit_assert=>assert_equals( EXPORTING act = formatted_string exp = expected msg = |Values exceeding maximum line length are not handled correctly.| ). ENDMETHOD. ENDCLASS.
42.420455
179
0.54996
c84a6ad804dc12ca42a29521d485a8883eb0739c
518
abap
ABAP
src/runtime/zcl_wasm_local.clas.abap
larshp/abap-wasm
6837323d08d9cb1476b6b1611ccbb0bf637f812f
[ "MIT" ]
11
2020-01-02T14:28:48.000Z
2021-12-10T11:18:13.000Z
src/runtime/zcl_wasm_local.clas.abap
larshp/abap-wasm
6837323d08d9cb1476b6b1611ccbb0bf637f812f
[ "MIT" ]
12
2019-12-27T11:03:01.000Z
2021-07-15T13:45:47.000Z
src/runtime/zcl_wasm_local.clas.abap
larshp/abap-wasm
6837323d08d9cb1476b6b1611ccbb0bf637f812f
[ "MIT" ]
null
null
null
CLASS zcl_wasm_local DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS get IMPORTING !io_memory TYPE REF TO zcl_wasm_memory !iv_index TYPE i . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_WASM_LOCAL IMPLEMENTATION. METHOD get. * https://webassembly.github.io/spec/core/exec/instructions.html#xref-syntax-instructions-syntax-instr-variable-mathsf-local-get-x io_memory->stack_push( io_memory->local_get( iv_index ) ). ENDMETHOD. ENDCLASS.
18.5
130
0.733591
c84d81159f68b632e561d2cdefcfdd140afae04c
287
abap
ABAP
zcl_abapdi_test_class1.clas.abap
hapejot/abapDI
caadb56e527dc6810e21f4a8e99b73d695ccb580
[ "MIT" ]
1
2018-12-04T15:17:49.000Z
2018-12-04T15:17:49.000Z
zcl_abapdi_test_class1.clas.abap
hapejot/abapDI
caadb56e527dc6810e21f4a8e99b73d695ccb580
[ "MIT" ]
2
2018-04-24T20:07:25.000Z
2018-04-28T09:39:09.000Z
zcl_abapdi_test_class1.clas.abap
hapejot/abapDI
caadb56e527dc6810e21f4a8e99b73d695ccb580
[ "MIT" ]
null
null
null
CLASS zcl_abapdi_test_class1 DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapdi_test. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_abapdi_test_class1 IMPLEMENTATION. METHOD zif_abapdi_test~initialize. ENDMETHOD. ENDCLASS.
13.666667
44
0.783972
c84d88c0fdeaa4cc25a65a2e8a9a57c0e7362218
443
abap
ABAP
src/zcl_rle.clas.abap
pokrakam/exercism-abap-local
d32413055706fff79d9c47015fd403d6422e0159
[ "MIT" ]
null
null
null
src/zcl_rle.clas.abap
pokrakam/exercism-abap-local
d32413055706fff79d9c47015fd403d6422e0159
[ "MIT" ]
null
null
null
src/zcl_rle.clas.abap
pokrakam/exercism-abap-local
d32413055706fff79d9c47015fd403d6422e0159
[ "MIT" ]
null
null
null
class zcl_rle definition public. public section. methods encode importing input type string returning value(result) type string. methods decode importing input type string returning value(result) type string. endclass. class zcl_rle implementation. method encode. "Add solution here endmethod. method decode. "Add solution here endmethod. endclass.
14.766667
55
0.65237
c84e91dedf3bc8e07f353ce90f83b1d169a82135
3,625
abap
ABAP
src/sources/zcl_abak_source_so10.clas.testclasses.abap
Sdfraga/abaK
04ec4a436429ec7f8145bbfad93adc41733929b1
[ "MIT" ]
38
2018-12-13T09:03:30.000Z
2022-02-11T17:57:33.000Z
src/sources/zcl_abak_source_so10.clas.testclasses.abap
Sdfraga/abaK
04ec4a436429ec7f8145bbfad93adc41733929b1
[ "MIT" ]
59
2018-12-13T09:20:02.000Z
2019-12-10T09:40:25.000Z
src/sources/zcl_abak_source_so10.clas.testclasses.abap
Sdfraga/abaK
04ec4a436429ec7f8145bbfad93adc41733929b1
[ "MIT" ]
14
2018-12-15T18:17:07.000Z
2019-04-23T08:32:56.000Z
*"* use this source file for your ABAP unit test classes CLASS lcl_unittest DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. CONSTANTS gc_name TYPE tdobname VALUE 'ABAK_UTEST_XML'. DATA: f_cut TYPE REF TO zcl_abak_source_so10. METHODS: setup RAISING zcx_abak. METHODS: invalid_text FOR TESTING. METHODS: missing_params FOR TESTING. METHODS: read_xml FOR TESTING RAISING zcx_abak. METHODS: get_type FOR TESTING RAISING zcx_abak. ENDCLASS. "lcl_Unittest CLASS lcl_unittest IMPLEMENTATION. METHOD setup. DATA: s_header TYPE thead, t_line TYPE tline_tab, s_line LIKE LINE OF t_line. s_header-tdobject = 'TEXT'. s_header-tdid = 'ST'. s_header-tdname = gc_name. s_header-tdspras = 'EN'. s_header-tdtitle = 'ABAK unit tests XML (title is ignored)'. s_line-tdline = |<abak name="ABAK SO10 XML Unit tests">|. INSERT s_line INTO TABLE t_line. s_line-tdline = |<k ricef="GLOBAL" fieldname="BUKRS" value="1234"/>|. INSERT s_line INTO TABLE t_line. s_line-tdline = |</abak>|. INSERT s_line INTO TABLE t_line. CALL FUNCTION 'SAVE_TEXT' EXPORTING header = s_header TABLES lines = t_line EXCEPTIONS id = 1 language = 2 name = 3 object = 4 OTHERS = 5. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_abak. ENDIF. ENDMETHOD. METHOD invalid_text. TRY. CREATE OBJECT f_cut EXPORTING i_name = 'INVALID' i_id = 'ST' i_spras = sy-langu. f_cut->zif_abak_source~get( ). cl_abap_unit_assert=>fail( msg = 'Invalid text should have raised exception' ). CATCH zcx_abak. RETURN. ENDTRY. ENDMETHOD. METHOD missing_params. TRY. CREATE OBJECT f_cut EXPORTING i_name = space i_id = 'ST' i_spras = sy-langu. f_cut->zif_abak_source~get( ). cl_abap_unit_assert=>fail( msg = 'Missing name should have raised exception' ). CATCH zcx_abak. RETURN. ENDTRY. TRY. CREATE OBJECT f_cut EXPORTING i_name = gc_name i_id = space i_spras = sy-langu. f_cut->zif_abak_source~get( ). cl_abap_unit_assert=>fail( msg = 'Missing id should have raised exception' ). CATCH zcx_abak. RETURN. ENDTRY. TRY. CREATE OBJECT f_cut EXPORTING i_name = gc_name i_id = 'ST' i_spras = space. f_cut->zif_abak_source~get( ). cl_abap_unit_assert=>fail( msg = 'Missing language should have raised exception' ). CATCH zcx_abak. RETURN. ENDTRY. ENDMETHOD. METHOD read_xml. DATA: str TYPE string. CREATE OBJECT f_cut EXPORTING i_name = gc_name i_id = 'ST' i_spras = sy-langu. str = f_cut->zif_abak_source~get( ). cl_abap_unit_assert=>assert_equals( exp = |<abak name="ABAK SO10 XML Unit tests">\n<k ricef="GLOBAL" fieldname="BUKRS" value="1234"/>\n</abak>| act = str ). ENDMETHOD. METHOD get_type. CREATE OBJECT f_cut EXPORTING i_name = gc_name i_id = 'ST' i_spras = sy-langu. cl_abap_unit_assert=>assert_equals( exp = zif_abak_consts=>source_type-standard_text act = f_cut->zif_abak_source~get_type( ) ). ENDMETHOD. ENDCLASS. "lcl_Unittest
26.851852
147
0.591724
c8505e643bfe0b9ad27c5f313cce78984c192810
1,682
abap
ABAP
src/objects/zcl_abapgit_object_sppf.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_sppf.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_sppf.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_sppf DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . PROTECTED SECTION. PRIVATE SECTION. METHODS get_generic RETURNING VALUE(ro_generic) TYPE REF TO zcl_abapgit_objects_generic RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_SPPF IMPLEMENTATION. METHOD get_generic. CREATE OBJECT ro_generic EXPORTING is_item = ms_item iv_language = mv_language. ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = zcl_abapgit_objects_super=>c_user_unknown. ENDMETHOD. METHOD zif_abapgit_object~delete. get_generic( )->delete( ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. get_generic( )->deserialize( iv_package = iv_package io_xml = io_xml ). ENDMETHOD. METHOD zif_abapgit_object~exists. rv_bool = get_generic( )->exists( ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-delete_tadir = abap_true. ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. ENDMETHOD. METHOD zif_abapgit_object~serialize. get_generic( )->serialize( io_xml ). ENDMETHOD. ENDCLASS.
16.82
65
0.721165
c855f6d8eed72572b3887fc9220eb72235385980
2,081
abap
ABAP
src/zcl_abap_graph_attr.clas.abap
marcellourbani/abapgraph
3de65fff2fee1afd13feb1cde090420a6acafcf6
[ "MIT" ]
8
2018-11-23T15:02:51.000Z
2022-03-18T09:44:22.000Z
src/zcl_abap_graph_attr.clas.abap
marcellourbani/abapgraph
3de65fff2fee1afd13feb1cde090420a6acafcf6
[ "MIT" ]
2
2019-08-13T17:25:55.000Z
2020-09-17T07:14:01.000Z
src/zcl_abap_graph_attr.clas.abap
marcellourbani/abapgraph
3de65fff2fee1afd13feb1cde090420a6acafcf6
[ "MIT" ]
3
2020-09-15T12:51:00.000Z
2021-07-09T02:07:16.000Z
class zcl_abap_graph_attr definition public final create private . public section. types: begin of ty_attribute, name type string, value type string, end of ty_attribute, tt_attribute type hashed table of ty_attribute with unique key name. "a full list of available attributes is at https://graphviz.gitlab.io/_pages/doc/info/attrs.html constants: atype_label type string value 'label', atype_shape type string value 'shape', atype_rankdir type string value 'rankdir', atype_color type string value 'color', rankdir_horizontal type string value 'LR', rankdir_vertical type string value 'TB'. class-methods create importing forhtml type abap_bool optional returning value(r_result) type ref to zcl_abap_graph_attr. methods: set importing value(name) type string value(value) type string, setraw importing name type string value type string, render returning value(attrstring) type string. private section. data: attributes type tt_attribute, forhtml type abap_bool. endclass. class zcl_abap_graph_attr implementation. method create. create object r_result. r_result->forhtml = forhtml. endmethod. method set. value = zcl_abap_graph_utilities=>quoteifneeded( value ). setraw( name = name value = value ). endmethod. method render. field-symbols: <attr> like line of attributes. agdefinitions. loop at attributes assigning <attr>. agexpand '{attrstring} {<attr>-name} = {<attr>-value}' attrstring. endloop. if attrstring <> '' and forhtml = abap_false. agexpand '[{attrstring}]' attrstring. endif. endmethod. method setraw. data: attr type ty_attribute. delete table attributes with table key name = name. if value <> ''. attr-name = name. attr-value = value . insert attr into table attributes. endif. endmethod. endclass.
28.902778
100
0.656896
c856cbb240766aa94d519f235f824c4c6a3d1e8e
22,750
abap
ABAP
src/zcl_abapgit_repo.clas.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
1
2021-01-21T15:34:26.000Z
2021-01-21T15:34:26.000Z
src/zcl_abapgit_repo.clas.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
1
2020-01-05T16:45:32.000Z
2020-01-05T16:45:32.000Z
src/zcl_abapgit_repo.clas.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_repo DEFINITION PUBLIC ABSTRACT CREATE PUBLIC . PUBLIC SECTION. METHODS bind_listener IMPORTING !ii_listener TYPE REF TO zif_abapgit_repo_listener . METHODS deserialize_checks RETURNING VALUE(rs_checks) TYPE zif_abapgit_definitions=>ty_deserialize_checks RAISING zcx_abapgit_exception . METHODS delete_checks RETURNING VALUE(rs_checks) TYPE zif_abapgit_definitions=>ty_delete_checks RAISING zcx_abapgit_exception . METHODS constructor IMPORTING !is_data TYPE zif_abapgit_persistence=>ty_repo . METHODS get_key RETURNING VALUE(rv_key) TYPE zif_abapgit_persistence=>ty_value . METHODS get_name RETURNING VALUE(rv_name) TYPE string RAISING zcx_abapgit_exception . METHODS get_files_local IMPORTING !ii_log TYPE REF TO zif_abapgit_log OPTIONAL !it_filter TYPE zif_abapgit_definitions=>ty_tadir_tt OPTIONAL RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_item_tt RAISING zcx_abapgit_exception . METHODS get_local_checksums_per_file RETURNING VALUE(rt_checksums) TYPE zif_abapgit_definitions=>ty_file_signatures_tt . METHODS get_files_remote RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt RAISING zcx_abapgit_exception . METHODS get_package RETURNING VALUE(rv_package) TYPE zif_abapgit_persistence=>ty_repo-package . METHODS get_dot_abapgit RETURNING VALUE(ro_dot_abapgit) TYPE REF TO zcl_abapgit_dot_abapgit . METHODS set_dot_abapgit IMPORTING !io_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit RAISING zcx_abapgit_exception . METHODS deserialize IMPORTING !is_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks !ii_log TYPE REF TO zif_abapgit_log RAISING zcx_abapgit_exception . METHODS refresh IMPORTING !iv_drop_cache TYPE abap_bool DEFAULT abap_false RAISING zcx_abapgit_exception . METHODS update_local_checksums IMPORTING !it_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt RAISING zcx_abapgit_exception . METHODS rebuild_local_checksums RAISING zcx_abapgit_exception . METHODS find_remote_dot_abapgit RETURNING VALUE(ro_dot) TYPE REF TO zcl_abapgit_dot_abapgit RAISING zcx_abapgit_exception . METHODS is_offline RETURNING VALUE(rv_offline) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS set_files_remote IMPORTING !it_files TYPE zif_abapgit_definitions=>ty_files_tt . METHODS get_local_settings RETURNING VALUE(rs_settings) TYPE zif_abapgit_persistence=>ty_repo-local_settings . METHODS set_local_settings IMPORTING !is_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings RAISING zcx_abapgit_exception . METHODS has_remote_source ABSTRACT RETURNING VALUE(rv_yes) TYPE abap_bool . METHODS status IMPORTING !ii_log TYPE REF TO zif_abapgit_log OPTIONAL RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception . METHODS switch_repo_type IMPORTING !iv_offline TYPE abap_bool RAISING zcx_abapgit_exception . METHODS create_new_log IMPORTING !iv_title TYPE string OPTIONAL RETURNING VALUE(ri_log) TYPE REF TO zif_abapgit_log . METHODS get_log RETURNING VALUE(ri_log) TYPE REF TO zif_abapgit_log . METHODS reset_log . PROTECTED SECTION. DATA mt_local TYPE zif_abapgit_definitions=>ty_files_item_tt . DATA mt_remote TYPE zif_abapgit_definitions=>ty_files_tt . DATA mv_request_local_refresh TYPE abap_bool . DATA ms_data TYPE zif_abapgit_persistence=>ty_repo . DATA mv_request_remote_refresh TYPE abap_bool . DATA mt_status TYPE zif_abapgit_definitions=>ty_results_tt . DATA mi_log TYPE REF TO zif_abapgit_log . METHODS set IMPORTING !it_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt OPTIONAL !iv_url TYPE zif_abapgit_persistence=>ty_repo-url OPTIONAL !iv_branch_name TYPE zif_abapgit_persistence=>ty_repo-branch_name OPTIONAL !iv_head_branch TYPE zif_abapgit_persistence=>ty_repo-head_branch OPTIONAL !iv_offline TYPE zif_abapgit_persistence=>ty_repo-offline OPTIONAL !is_dot_abapgit TYPE zif_abapgit_persistence=>ty_repo-dot_abapgit OPTIONAL !is_local_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings OPTIONAL !iv_deserialized_at TYPE zif_abapgit_persistence=>ty_repo-deserialized_at OPTIONAL !iv_deserialized_by TYPE zif_abapgit_persistence=>ty_repo-deserialized_by OPTIONAL RAISING zcx_abapgit_exception . METHODS reset_status . METHODS reset_remote . PRIVATE SECTION. DATA mi_listener TYPE REF TO zif_abapgit_repo_listener . METHODS get_local_checksums RETURNING VALUE(rt_checksums) TYPE zif_abapgit_persistence=>ty_local_checksum_tt . METHODS notify_listener IMPORTING !is_change_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask RAISING zcx_abapgit_exception . METHODS apply_filter IMPORTING !it_filter TYPE zif_abapgit_definitions=>ty_tadir_tt CHANGING !ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt . METHODS build_dotabapgit_file RETURNING VALUE(rs_file) TYPE zif_abapgit_definitions=>ty_file RAISING zcx_abapgit_exception . METHODS build_apack_manifest_file RETURNING VALUE(rs_file) TYPE zif_abapgit_definitions=>ty_file RAISING zcx_abapgit_exception . METHODS update_last_deserialize RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_REPO IMPLEMENTATION. METHOD apply_filter. DATA: lt_filter TYPE SORTED TABLE OF zif_abapgit_definitions=>ty_tadir WITH NON-UNIQUE KEY object obj_name, lv_index TYPE i. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF ct_tadir. IF lines( it_filter ) = 0. RETURN. ENDIF. lt_filter = it_filter. * this is another loop at TADIR, but typically the filter is blank LOOP AT ct_tadir ASSIGNING <ls_tadir>. lv_index = sy-tabix. READ TABLE lt_filter TRANSPORTING NO FIELDS WITH KEY object = <ls_tadir>-object obj_name = <ls_tadir>-obj_name BINARY SEARCH. IF sy-subrc <> 0. DELETE ct_tadir INDEX lv_index. ENDIF. ENDLOOP. ENDMETHOD. METHOD bind_listener. mi_listener = ii_listener. ENDMETHOD. METHOD build_apack_manifest_file. DATA: lo_manifest_reader TYPE REF TO zcl_abapgit_apack_reader, ls_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor, lo_manifest_writer TYPE REF TO zcl_abapgit_apack_writer. lo_manifest_reader = zcl_abapgit_apack_reader=>create_instance( ms_data-package ). IF lo_manifest_reader->has_manifest( ) = abap_true. ls_descriptor = lo_manifest_reader->get_manifest_descriptor( ). lo_manifest_writer = zcl_abapgit_apack_writer=>create_instance( ls_descriptor ). rs_file-path = zif_abapgit_definitions=>c_root_dir. rs_file-filename = zif_abapgit_apack_definitions=>c_dot_apack_manifest. rs_file-data = zcl_abapgit_convert=>string_to_xstring_utf8( lo_manifest_writer->serialize( ) ). rs_file-sha1 = zcl_abapgit_hash=>sha1( iv_type = zif_abapgit_definitions=>c_type-blob iv_data = rs_file-data ). ENDIF. ENDMETHOD. METHOD build_dotabapgit_file. rs_file-path = zif_abapgit_definitions=>c_root_dir. rs_file-filename = zif_abapgit_definitions=>c_dot_abapgit. rs_file-data = get_dot_abapgit( )->serialize( ). rs_file-sha1 = zcl_abapgit_hash=>sha1( iv_type = zif_abapgit_definitions=>c_type-blob iv_data = rs_file-data ). ENDMETHOD. METHOD constructor. ASSERT NOT is_data-key IS INITIAL. ms_data = is_data. mv_request_remote_refresh = abap_true. ENDMETHOD. METHOD create_new_log. CREATE OBJECT mi_log TYPE zcl_abapgit_log. mi_log->set_title( iv_title ). ri_log = mi_log. ENDMETHOD. METHOD delete_checks. DATA: li_package TYPE REF TO zif_abapgit_sap_package. li_package = zcl_abapgit_factory=>get_sap_package( get_package( ) ). rs_checks-transport-required = li_package->are_changes_recorded_in_tr_req( ). ENDMETHOD. METHOD deserialize. DATA: lt_updated_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt, lx_error TYPE REF TO zcx_abapgit_exception. deserialize_checks( ). IF is_checks-requirements-met = 'N' AND is_checks-requirements-decision IS INITIAL. zcx_abapgit_exception=>raise( 'Requirements not met and undecided' ). ENDIF. IF is_checks-transport-required = abap_true AND is_checks-transport-transport IS INITIAL. zcx_abapgit_exception=>raise( |No transport request was supplied| ). ENDIF. TRY. lt_updated_files = zcl_abapgit_objects=>deserialize( io_repo = me is_checks = is_checks ii_log = ii_log ). CATCH zcx_abapgit_exception INTO lx_error. * ensure to reset default transport request task zcl_abapgit_default_transport=>get_instance( )->reset( ). RAISE EXCEPTION lx_error. ENDTRY. APPEND get_dot_abapgit( )->get_signature( ) TO lt_updated_files. CLEAR: mt_local. update_local_checksums( lt_updated_files ). update_last_deserialize( ). reset_status( ). COMMIT WORK AND WAIT. ENDMETHOD. METHOD deserialize_checks. DATA: lt_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt, lv_master_language TYPE spras, lv_logon_language TYPE spras. find_remote_dot_abapgit( ). lv_master_language = get_dot_abapgit( )->get_master_language( ). lv_logon_language = sy-langu. IF get_local_settings( )-write_protected = abap_true. zcx_abapgit_exception=>raise( 'Cannot deserialize. Local code is write-protected by repo config' ). ELSEIF lv_master_language <> lv_logon_language. zcx_abapgit_exception=>raise( |Current login language | && |'{ zcl_abapgit_convert=>conversion_exit_isola_output( lv_logon_language ) }'| && | does not match master language | && |'{ zcl_abapgit_convert=>conversion_exit_isola_output( lv_master_language ) }'.| && | Run 'Advanced' > 'Open in master language'| ). ENDIF. rs_checks = zcl_abapgit_objects=>deserialize_checks( me ). lt_requirements = get_dot_abapgit( )->get_data( )-requirements. rs_checks-requirements-met = zcl_abapgit_requirement_helper=>is_requirements_met( lt_requirements ). ENDMETHOD. METHOD find_remote_dot_abapgit. FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote. get_files_remote( ). READ TABLE mt_remote ASSIGNING <ls_remote> WITH KEY path = zif_abapgit_definitions=>c_root_dir filename = zif_abapgit_definitions=>c_dot_abapgit. IF sy-subrc = 0. ro_dot = zcl_abapgit_dot_abapgit=>deserialize( <ls_remote>-data ). set_dot_abapgit( ro_dot ). ENDIF. ENDMETHOD. METHOD get_dot_abapgit. CREATE OBJECT ro_dot_abapgit EXPORTING is_data = ms_data-dot_abapgit. ENDMETHOD. METHOD get_files_local. DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, lo_serialize TYPE REF TO zcl_abapgit_serialize, lt_found LIKE rt_files, lv_force TYPE abap_bool, ls_apack_file TYPE zif_abapgit_definitions=>ty_file. FIELD-SYMBOLS: <ls_return> LIKE LINE OF rt_files. " Serialization happened before and no refresh request IF lines( mt_local ) > 0 AND mv_request_local_refresh = abap_false. rt_files = mt_local. RETURN. ENDIF. APPEND INITIAL LINE TO rt_files ASSIGNING <ls_return>. <ls_return>-file = build_dotabapgit_file( ). ls_apack_file = build_apack_manifest_file( ). IF ls_apack_file IS NOT INITIAL. APPEND INITIAL LINE TO rt_files ASSIGNING <ls_return>. <ls_return>-file = ls_apack_file. ENDIF. lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( iv_package = get_package( ) iv_ignore_subpackages = get_local_settings( )-ignore_subpackages iv_only_local_objects = get_local_settings( )-only_local_objects io_dot = get_dot_abapgit( ) ii_log = ii_log ). apply_filter( EXPORTING it_filter = it_filter CHANGING ct_tadir = lt_tadir ). CREATE OBJECT lo_serialize EXPORTING iv_serialize_master_lang_only = ms_data-local_settings-serialize_master_lang_only. * if there are less than 10 objects run in single thread * this helps a lot when debugging, plus performance gain * with low number of objects does not matter much lv_force = boolc( lines( lt_tadir ) < 10 ). lt_found = lo_serialize->serialize( it_tadir = lt_tadir iv_language = get_dot_abapgit( )->get_master_language( ) ii_log = ii_log iv_force_sequential = lv_force ). APPEND LINES OF lt_found TO rt_files. mt_local = rt_files. mv_request_local_refresh = abap_false. " Fulfill refresh ENDMETHOD. METHOD get_files_remote. rt_files = mt_remote. ENDMETHOD. METHOD get_key. rv_key = ms_data-key. ENDMETHOD. METHOD get_local_checksums. rt_checksums = ms_data-local_checksums. ENDMETHOD. METHOD get_local_checksums_per_file. FIELD-SYMBOLS <ls_object> LIKE LINE OF ms_data-local_checksums. LOOP AT ms_data-local_checksums ASSIGNING <ls_object>. APPEND LINES OF <ls_object>-files TO rt_checksums. ENDLOOP. ENDMETHOD. METHOD get_local_settings. rs_settings = ms_data-local_settings. ENDMETHOD. METHOD get_log. ri_log = mi_log. ENDMETHOD. METHOD get_name. rv_name = ms_data-local_settings-display_name. ENDMETHOD. METHOD get_package. rv_package = ms_data-package. ENDMETHOD. METHOD is_offline. rv_offline = ms_data-offline. ENDMETHOD. METHOD notify_listener. DATA ls_meta_slug TYPE zif_abapgit_persistence=>ty_repo_xml. IF mi_listener IS BOUND. MOVE-CORRESPONDING ms_data TO ls_meta_slug. mi_listener->on_meta_change( iv_key = ms_data-key is_meta = ls_meta_slug is_change_mask = is_change_mask ). ENDIF. ENDMETHOD. METHOD rebuild_local_checksums. DATA: lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, ls_last_item TYPE zif_abapgit_definitions=>ty_item, lt_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt. FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums, <ls_file_sig> LIKE LINE OF <ls_checksum>-files, <ls_local> LIKE LINE OF lt_local. lt_local = get_files_local( ). DELETE lt_local " Remove non-code related files except .abapgit WHERE item IS INITIAL AND NOT ( file-path = zif_abapgit_definitions=>c_root_dir AND file-filename = zif_abapgit_definitions=>c_dot_abapgit ). SORT lt_local BY item. LOOP AT lt_local ASSIGNING <ls_local>. IF ls_last_item <> <ls_local>-item OR sy-tabix = 1. " First or New item reached ? APPEND INITIAL LINE TO lt_checksums ASSIGNING <ls_checksum>. <ls_checksum>-item = <ls_local>-item. ls_last_item = <ls_local>-item. ENDIF. APPEND INITIAL LINE TO <ls_checksum>-files ASSIGNING <ls_file_sig>. MOVE-CORRESPONDING <ls_local>-file TO <ls_file_sig>. ENDLOOP. set( it_checksums = lt_checksums ). reset_status( ). ENDMETHOD. METHOD refresh. mv_request_local_refresh = abap_true. reset_remote( ). CLEAR mi_log. IF iv_drop_cache = abap_true. CLEAR: mt_local. ENDIF. ENDMETHOD. METHOD reset_log. CLEAR mi_log. ENDMETHOD. METHOD reset_remote. CLEAR mt_remote. mv_request_remote_refresh = abap_true. reset_status( ). ENDMETHOD. METHOD reset_status. CLEAR mt_status. ENDMETHOD. METHOD set. * TODO: refactor DATA: ls_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask. ASSERT it_checksums IS SUPPLIED OR iv_url IS SUPPLIED OR iv_branch_name IS SUPPLIED OR iv_head_branch IS SUPPLIED OR iv_offline IS SUPPLIED OR is_dot_abapgit IS SUPPLIED OR is_local_settings IS SUPPLIED OR iv_deserialized_by IS SUPPLIED OR iv_deserialized_at IS SUPPLIED. IF it_checksums IS SUPPLIED. ms_data-local_checksums = it_checksums. ls_mask-local_checksums = abap_true. ENDIF. IF iv_url IS SUPPLIED. ms_data-url = iv_url. ls_mask-url = abap_true. ENDIF. IF iv_branch_name IS SUPPLIED. ms_data-branch_name = iv_branch_name. ls_mask-branch_name = abap_true. ENDIF. IF iv_head_branch IS SUPPLIED. ms_data-head_branch = iv_head_branch. ls_mask-head_branch = abap_true. ENDIF. IF iv_offline IS SUPPLIED. ms_data-offline = iv_offline. ls_mask-offline = abap_true. ENDIF. IF is_dot_abapgit IS SUPPLIED. ms_data-dot_abapgit = is_dot_abapgit. ls_mask-dot_abapgit = abap_true. ENDIF. IF is_local_settings IS SUPPLIED. ms_data-local_settings = is_local_settings. ls_mask-local_settings = abap_true. ENDIF. IF iv_deserialized_at IS SUPPLIED OR iv_deserialized_by IS SUPPLIED. ms_data-deserialized_at = iv_deserialized_at. ms_data-deserialized_by = iv_deserialized_by. ls_mask-deserialized_at = abap_true. ls_mask-deserialized_by = abap_true. ENDIF. notify_listener( ls_mask ). ENDMETHOD. METHOD set_dot_abapgit. set( is_dot_abapgit = io_dot_abapgit->get_data( ) ). ENDMETHOD. METHOD set_files_remote. mt_remote = it_files. mv_request_remote_refresh = abap_false. ENDMETHOD. METHOD set_local_settings. set( is_local_settings = is_settings ). ENDMETHOD. METHOD status. IF lines( mt_status ) = 0. mt_status = zcl_abapgit_file_status=>status( io_repo = me ii_log = ii_log ). ENDIF. rt_results = mt_status. ENDMETHOD. METHOD switch_repo_type. IF iv_offline = ms_data-offline. zcx_abapgit_exception=>raise( |Cannot switch_repo_type, offline already = "{ ms_data-offline }"| ). ENDIF. IF iv_offline = abap_true. " On-line -> OFFline set( iv_url = zcl_abapgit_url=>name( ms_data-url ) iv_branch_name = '' iv_head_branch = '' iv_offline = abap_true ). ELSE. " OFFline -> On-line set( iv_offline = abap_false ). ENDIF. ENDMETHOD. METHOD update_last_deserialize. DATA: lv_deserialized_at TYPE zif_abapgit_persistence=>ty_repo-deserialized_at, lv_deserialized_by TYPE zif_abapgit_persistence=>ty_repo-deserialized_by. GET TIME STAMP FIELD lv_deserialized_at. lv_deserialized_by = sy-uname. set( iv_deserialized_at = lv_deserialized_at iv_deserialized_by = lv_deserialized_by ). ENDMETHOD. METHOD update_local_checksums. " ASSUMTION: SHA1 in param is actual and correct. " Push fills it from local files before pushing, deserialize from remote " If this is not true that there is an error somewhere but not here DATA: lt_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt, lt_files_idx TYPE zif_abapgit_definitions=>ty_file_signatures_tt, lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, lv_chks_row TYPE i, lv_file_row TYPE i. FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums, <ls_file> LIKE LINE OF <ls_checksum>-files, <ls_local> LIKE LINE OF lt_local, <ls_new_state> LIKE LINE OF it_files. lt_checksums = get_local_checksums( ). lt_files_idx = it_files. SORT lt_files_idx BY path filename. " Sort for binary search " Loop through current chacksum state, update sha1 for common files LOOP AT lt_checksums ASSIGNING <ls_checksum>. lv_chks_row = sy-tabix. LOOP AT <ls_checksum>-files ASSIGNING <ls_file>. lv_file_row = sy-tabix. READ TABLE lt_files_idx ASSIGNING <ls_new_state> WITH KEY path = <ls_file>-path filename = <ls_file>-filename BINARY SEARCH. CHECK sy-subrc = 0. " Missing in param table, skip IF <ls_new_state>-sha1 IS INITIAL. " Empty input sha1 is a deletion marker DELETE <ls_checksum>-files INDEX lv_file_row. ELSE. <ls_file>-sha1 = <ls_new_state>-sha1. " Update sha1 CLEAR <ls_new_state>-sha1. " Mark as processed ENDIF. ENDLOOP. IF lines( <ls_checksum>-files ) = 0. " Remove empty objects DELETE lt_checksums INDEX lv_chks_row. ENDIF. ENDLOOP. DELETE lt_files_idx WHERE sha1 IS INITIAL. " Remove processed IF lines( lt_files_idx ) > 0. lt_local = get_files_local( ). SORT lt_local BY file-path file-filename. " Sort for binary search ENDIF. " Add new files - not deleted and not marked as processed above LOOP AT lt_files_idx ASSIGNING <ls_new_state>. READ TABLE lt_local ASSIGNING <ls_local> WITH KEY file-path = <ls_new_state>-path file-filename = <ls_new_state>-filename BINARY SEARCH. IF sy-subrc <> 0. * if the deserialization fails, the local file might not be there CONTINUE. ENDIF. READ TABLE lt_checksums ASSIGNING <ls_checksum> " TODO Optimize WITH KEY item = <ls_local>-item. IF sy-subrc > 0. APPEND INITIAL LINE TO lt_checksums ASSIGNING <ls_checksum>. <ls_checksum>-item = <ls_local>-item. ENDIF. APPEND <ls_new_state> TO <ls_checksum>-files. ENDLOOP. SORT lt_checksums BY item. set( it_checksums = lt_checksums ). ENDMETHOD. ENDCLASS.
29.166667
116
0.68967
c8570a50b01a1e48e854db3788d0508efb6463dd
326
abap
ABAP
kapitel_04/mzbook_demo_dyn_grid2o02.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
12
2018-06-22T10:55:06.000Z
2022-03-22T12:10:48.000Z
kapitel_04/mzbook_demo_dyn_grid2o02.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
5
2018-06-25T11:45:26.000Z
2019-09-04T19:41:55.000Z
kapitel_04/mzbook_demo_dyn_grid2o02.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
7
2018-07-02T14:20:28.000Z
2022-03-25T19:33:33.000Z
*&---------------------------------------------------------------------* *& Module STATUS_0500 OUTPUT *&---------------------------------------------------------------------* MODULE status_0500 OUTPUT. SET PF-STATUS '0500'. SET TITLEBAR '0500'. CLEAR sy-ucomm. ENDMODULE. " STATUS_0500 OUTPUT
27.166667
72
0.349693
c858c07dac7b7117d4a38b94535f285f709b780c
152
abap
ABAP
src/zabap_test_0017.prog.abap
larshp/ABAPTestSuite
afbcbaa387da13f5d9685b5cdc4d32dcda0461ed
[ "MIT" ]
null
null
null
src/zabap_test_0017.prog.abap
larshp/ABAPTestSuite
afbcbaa387da13f5d9685b5cdc4d32dcda0461ed
[ "MIT" ]
null
null
null
src/zabap_test_0017.prog.abap
larshp/ABAPTestSuite
afbcbaa387da13f5d9685b5cdc4d32dcda0461ed
[ "MIT" ]
1
2018-04-19T09:34:45.000Z
2018-04-19T09:34:45.000Z
REPORT zabap_test_0017 NO STANDARD PAGE HEADING. DATA: gv_c TYPE c. IF gv_c <> ''. WRITE 'filled' ##NO_TEXT. ELSE. WRITE 'else' ##NO_TEXT. ENDIF.
15.2
48
0.684211
c85ebb0e33ef4b16fbed869a3c82f7af8ba2ef63
464
abap
ABAP
src/zcl_zpt_c_project.clas.abap
duoergui/abap_project_tracking
8516bc2b23410fac3549e302685bdb1e197e1efe
[ "MIT" ]
null
null
null
src/zcl_zpt_c_project.clas.abap
duoergui/abap_project_tracking
8516bc2b23410fac3549e302685bdb1e197e1efe
[ "MIT" ]
null
null
null
src/zcl_zpt_c_project.clas.abap
duoergui/abap_project_tracking
8516bc2b23410fac3549e302685bdb1e197e1efe
[ "MIT" ]
null
null
null
class ZCL_ZPT_C_PROJECT definition public inheriting from CL_SADL_GTK_EXPOSURE_MPC final create public . public section. protected section. methods GET_PATHS redefinition . methods GET_TIMESTAMP redefinition . private section. ENDCLASS. CLASS ZCL_ZPT_C_PROJECT IMPLEMENTATION. method GET_PATHS. et_paths = VALUE #( ( |CDS~ZPT_C_PROJECT| ) ). endmethod. method GET_TIMESTAMP. RV_TIMESTAMP = 20200927033351. endmethod. ENDCLASS.
14.060606
42
0.765086
c861ae6934e925c7e61aa7bf3a883263d14879a3
1,271
abap
ABAP
src/zpush_tbl.fugr.saplzpush_tbl.abap
irodrigob/ABAP_Notificaciones_Push
2246f480f85c3eaef15801e042f78ffa2067bba2
[ "MIT" ]
null
null
null
src/zpush_tbl.fugr.saplzpush_tbl.abap
irodrigob/ABAP_Notificaciones_Push
2246f480f85c3eaef15801e042f78ffa2067bba2
[ "MIT" ]
null
null
null
src/zpush_tbl.fugr.saplzpush_tbl.abap
irodrigob/ABAP_Notificaciones_Push
2246f480f85c3eaef15801e042f78ffa2067bba2
[ "MIT" ]
null
null
null
* regenerated at 10.06.2021 09:06:33 ******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE LZPUSH_TBLTOP. " Global Declarations INCLUDE LZPUSH_TBLUXX. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LZPUSH_TBLF... " Subroutines * INCLUDE LZPUSH_TBLO... " PBO-Modules * INCLUDE LZPUSH_TBLI... " PAI-Modules * INCLUDE LZPUSH_TBLE... " Events * INCLUDE LZPUSH_TBLP... " Local class implement. * INCLUDE LZPUSH_TBLT99. " ABAP Unit tests INCLUDE LZPUSH_TBLF00 . " subprograms INCLUDE LZPUSH_TBLI00 . " PAI modules INCLUDE LSVIMFXX . " subprograms INCLUDE LSVIMOXX . " PBO modules INCLUDE LSVIMIXX . " PAI modules
57.772727
69
0.373721
c869f0b03e55c1139462a882c48443881301ce0d
455
abap
ABAP
src/zhanife_oo_alv.prog.abap
hotbasan/oo-alv-hanife
791ce4e02285906df7790706816ce0cf404b060a
[ "MIT" ]
null
null
null
src/zhanife_oo_alv.prog.abap
hotbasan/oo-alv-hanife
791ce4e02285906df7790706816ce0cf404b060a
[ "MIT" ]
null
null
null
src/zhanife_oo_alv.prog.abap
hotbasan/oo-alv-hanife
791ce4e02285906df7790706816ce0cf404b060a
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Report ZHANIFE_OO_ALV *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ZHANIFE_OO_ALV. INCLUDE ZHANIFE_OO_TOP. INCLUDE ZHANIFE_OO_C01. INCLUDE ZHANIFE_OO_F01. INCLUDE ZHANIFE_OO_I01. INCLUDE ZHANIFE_OO_O01. START-OF-SELECTION. PERFORM GET_DATA. CALL SCREEN '0100'.
25.277778
72
0.417582
c86e84c242c507084333a30964e57ea6fee0cee8
537
abap
ABAP
packages/rfc-client-soap-xml/test/call.abap
mbtools/transpiler
59c44e14a90068147cc827aa76d60d9848a5e6fc
[ "MIT" ]
1
2020-02-28T17:30:29.000Z
2020-02-28T17:30:29.000Z
packages/rfc-client-soap-xml/test/call.abap
mbtools/transpiler
59c44e14a90068147cc827aa76d60d9848a5e6fc
[ "MIT" ]
7
2020-02-28T12:27:47.000Z
2020-03-01T14:33:16.000Z
packages/rfc-client-soap-xml/test/call.abap
abaplint/transpiler_poc
23d0c241f01f4f3143c2eb97b39d0413fa27f69f
[ "MIT" ]
null
null
null
DATA: BEGIN OF ls_sysinfo, system TYPE c LENGTH 3, mand TYPE n LENGTH 3, aspra TYPE c LENGTH 1, sname TYPE c LENGTH 12, cattok TYPE c LENGTH 1, saprl TYPE c LENGTH 4, host TYPE c LENGTH 8, opsys TYPE c LENGTH 10, dbsys TYPE c LENGTH 10, datex TYPE c LENGTH 8, dcpfm TYPE c LENGTH 1, msname2 TYPE c LENGTH 40, END OF ls_sysinfo. CALL FUNCTION 'CAT_PING' DESTINATION 'NONE' IMPORTING sysinfo = ls_sysinfo.
26.85
33
0.571695
c87127ea25cb3726b8fbff55600fcbd6615a1ac8
756
abap
ABAP
src/zaoc_day9_p1.prog.abap
hendrik77/Advent_of_Code_2019
8481810341f7ec7150d44b0514ecf40c6e8b1774
[ "Apache-2.0" ]
4
2019-12-07T07:22:52.000Z
2020-03-31T05:35:38.000Z
src/zaoc_day9_p1.prog.abap
hendrik77/Advent_of_Code_2019
8481810341f7ec7150d44b0514ecf40c6e8b1774
[ "Apache-2.0" ]
null
null
null
src/zaoc_day9_p1.prog.abap
hendrik77/Advent_of_Code_2019
8481810341f7ec7150d44b0514ecf40c6e8b1774
[ "Apache-2.0" ]
null
null
null
*&---------------------------------------------------------------------* *& Report zaoc_day5 *&---------------------------------------------------------------------* *& https://adventofcode.com/2019/day/5 *&---------------------------------------------------------------------* REPORT zaoc_day9_p1. START-OF-SELECTION. DATA(filename) = 'C:\Users\h.neumann\Devel\Advent of Code\2019\day9_input_p1.txt'. DATA(programs) = VALUE string_table( ). cl_gui_frontend_services=>gui_upload( EXPORTING filename = CONV #( filename ) filetype = 'ASC' CHANGING data_tab = programs ). DATA(intcode) = NEW zintcode( ). intcode->load( programs[ 1 ] ). intcode->run( ).
42
84
0.421958
c873809f1125792f61b3da27acd8f804c5a3c36a
1,429
abap
ABAP
src/#usi#exception_text_getter/#usi#if_exception_text_getter.intf.abap
SchwarzIT/sap-usi-exception
d2cbc7dd29410c5f5ddf23ba059e312250f30085
[ "Apache-2.0" ]
1
2022-01-27T08:12:09.000Z
2022-01-27T08:12:09.000Z
src/#usi#exception_text_getter/#usi#if_exception_text_getter.intf.abap
SchwarzIT/sap-usi-exception
d2cbc7dd29410c5f5ddf23ba059e312250f30085
[ "Apache-2.0" ]
null
null
null
src/#usi#exception_text_getter/#usi#if_exception_text_getter.intf.abap
SchwarzIT/sap-usi-exception
d2cbc7dd29410c5f5ddf23ba059e312250f30085
[ "Apache-2.0" ]
null
null
null
interface /USI/IF_EXCEPTION_TEXT_GETTER public . types: ty_bapiret1_tab TYPE STANDARD TABLE OF bapiret1 WITH NON-UNIQUE DEFAULT KEY . types: ty_bapiret2_tab TYPE STANDARD TABLE OF bapiret2 WITH NON-UNIQUE DEFAULT KEY . types: ty_powl_msg_sty_tab TYPE STANDARD TABLE OF powl_msg_sty WITH NON-UNIQUE DEFAULT KEY . types: ty_string_tab TYPE STANDARD TABLE OF string WITH NON-UNIQUE DEFAULT KEY . types: ty_symsg_tab TYPE STANDARD TABLE OF symsg WITH NON-UNIQUE DEFAULT KEY . methods GET_TEXTS_AS_BAPIRET1 returning value(R_RESULT) type TY_BAPIRET1_TAB . methods GET_TEXTS_AS_BAPIRET2 returning value(R_RESULT) type TY_BAPIRET2_TAB . methods GET_TEXTS_AS_POWL_MSG_STY returning value(R_RESULT) type TY_POWL_MSG_STY_TAB . methods GET_TEXTS_AS_STRING returning value(R_RESULT) type TY_STRING_TAB . methods GET_TEXTS_AS_SYMSG returning value(R_RESULT) type TY_SYMSG_TAB . methods GET_TEXT_AS_BAPIRET1 returning value(R_RESULT) type BAPIRET1 . methods GET_TEXT_AS_BAPIRET2 returning value(R_RESULT) type BAPIRET2 . methods GET_TEXT_AS_POWL_MSG_STY returning value(R_RESULT) type POWL_MSG_STY . methods GET_TEXT_AS_STRING returning value(R_RESULT) type STRING . methods GET_TEXT_AS_SYMSG returning value(R_RESULT) type SYMSG . endinterface.
30.404255
89
0.73338
c87627067e374dfbd036114a94dd6748994a1b54
1,326
abap
ABAP
src/zmke_cl_interface_example.clas.abap
Keller-Michael/interface_example
ccee04da83aeeb8d26857bbafe7fb6246b2e286c
[ "MIT" ]
2
2022-02-08T16:42:34.000Z
2022-02-09T09:15:34.000Z
src/zmke_cl_interface_example.clas.abap
Keller-Michael/interface_example
ccee04da83aeeb8d26857bbafe7fb6246b2e286c
[ "MIT" ]
null
null
null
src/zmke_cl_interface_example.clas.abap
Keller-Michael/interface_example
ccee04da83aeeb8d26857bbafe7fb6246b2e286c
[ "MIT" ]
null
null
null
CLASS zmke_cl_interface_example DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. INTERFACES if_oo_adt_classrun. PROTECTED SECTION. PRIVATE SECTION. METHODS test_no_personality_control IMPORTING out TYPE REF TO if_oo_adt_classrun_out. METHODS test_with_personality_control IMPORTING out TYPE REF TO if_oo_adt_classrun_out. ENDCLASS. CLASS zmke_cl_interface_example IMPLEMENTATION. METHOD if_oo_adt_classrun~main. test_no_personality_control( out ). test_with_personality_control( out ). ENDMETHOD. METHOD test_no_personality_control. DATA henry_jekyll TYPE REF TO zmke_if_henry_jekyll. DATA edward_hyde TYPE REF TO zmke_if_edward_hyde. henry_jekyll = zmke_cl_henry_jekyll=>get_instance( ). henry_jekyll->do_kind_things( ). edward_hyde = henry_jekyll->switch_personality( ). edward_hyde->do_malicious_things( ). IF henry_jekyll = edward_hyde. out->write( 'Dr. Henry Jekyll and Mr. Edward Hyde are the same person.' ). ENDIF. ENDMETHOD. METHOD test_with_personality_control. DATA henry_jekyll TYPE REF TO zmke_cl_henry_jekyll. henry_jekyll ?= zmke_cl_henry_jekyll=>get_instance( ). henry_jekyll->zmke_if_edward_hyde~do_malicious_things( ). henry_jekyll->zmke_if_henry_jekyll~do_kind_things( ). ENDMETHOD. ENDCLASS.
27.625
91
0.777526
c876f157908aed8eb57abd735fe785383fdbd654
2,408
abap
ABAP
src/checks/zcl_aoc_super_root.clas.abap
se38/abapOpenChecks
947b8d9a09f068ef3af70ea9d4388872d1ab69a7
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_super_root.clas.abap
se38/abapOpenChecks
947b8d9a09f068ef3af70ea9d4388872d1ab69a7
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_super_root.clas.abap
se38/abapOpenChecks
947b8d9a09f068ef3af70ea9d4388872d1ab69a7
[ "MIT" ]
1
2019-08-08T12:13:30.000Z
2019-08-08T12:13:30.000Z
CLASS zcl_aoc_super_root DEFINITION PUBLIC INHERITING FROM cl_ci_test_root ABSTRACT CREATE PUBLIC . PUBLIC SECTION. TYPE-POOLS zzaoc . METHODS constructor . METHODS get_attributes REDEFINITION . METHODS if_ci_test~display_documentation REDEFINITION . METHODS if_ci_test~query_attributes REDEFINITION . METHODS put_attributes REDEFINITION . PROTECTED SECTION. DATA mv_errty TYPE sci_errty . METHODS set_kind . PRIVATE SECTION. ENDCLASS. CLASS ZCL_AOC_SUPER_ROOT IMPLEMENTATION. METHOD constructor. super->constructor( ). "get description of check class SELECT SINGLE descript FROM seoclasstx INTO description WHERE clsname = myname AND langu = sy-langu. IF sy-subrc <> 0. SELECT SINGLE descript FROM seoclasstx INTO description WHERE clsname = myname. "#EC CI_NOORDER "#EC CI_SUBRC ENDIF. category = 'ZCL_AOC_CATEGORY'. ENDMETHOD. METHOD get_attributes. EXPORT mv_errty = mv_errty TO DATA BUFFER p_attributes. ENDMETHOD. METHOD if_ci_test~display_documentation. DATA: lv_url TYPE string VALUE 'http://docs.abapopenchecks.org/checks/' ##NO_TEXT, lv_len TYPE i. lv_len = strlen( myname ) - 2. CONCATENATE lv_url myname+lv_len(2) INTO lv_url. cl_gui_frontend_services=>execute( EXPORTING document = lv_url EXCEPTIONS cntl_error = 1 error_no_gui = 2 bad_parameter = 3 file_not_found = 4 path_not_found = 5 file_extension_unknown = 6 error_execute_failed = 7 synchronous_failed = 8 not_supported_by_gui = 9 OTHERS = 10 ). "#EC CI_SUBRC ENDMETHOD. METHOD if_ci_test~query_attributes. zzaoc_top. zzaoc_fill_att mv_errty 'Error Type' ''. "#EC NOTEXT zzaoc_popup. ENDMETHOD. METHOD put_attributes. IMPORT mv_errty = mv_errty FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED ASSERT sy-subrc = 0. set_kind( ). ENDMETHOD. METHOD set_kind. FIELD-SYMBOLS: <ls_message> LIKE LINE OF scimessages. LOOP AT scimessages ASSIGNING <ls_message>. <ls_message>-kind = mv_errty. ENDLOOP. ENDMETHOD. ENDCLASS.
20.581197
86
0.634551
c8779c616b0ea05b1c3fae14243b19886b54adfd
2,522
abap
ABAP
src/zcl_excel_columns.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
39
2021-12-11T18:27:15.000Z
2022-03-31T14:03:53.000Z
src/zcl_excel_columns.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
115
2021-12-11T08:29:00.000Z
2022-03-30T17:39:42.000Z
src/zcl_excel_columns.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
17
2021-12-12T13:48:59.000Z
2022-03-24T12:28:26.000Z
CLASS zcl_excel_columns DEFINITION PUBLIC FINAL CREATE PUBLIC . *"* public components of class ZCL_EXCEL_COLUMNS *"* do not include other source files here!!! PUBLIC SECTION. METHODS add IMPORTING !io_column TYPE REF TO zcl_excel_column . METHODS clear . METHODS constructor . METHODS get IMPORTING !ip_index TYPE i RETURNING VALUE(eo_column) TYPE REF TO zcl_excel_column . METHODS get_iterator RETURNING VALUE(eo_iterator) TYPE REF TO zcl_excel_collection_iterator . METHODS is_empty RETURNING VALUE(is_empty) TYPE flag . METHODS remove IMPORTING !io_column TYPE REF TO zcl_excel_column . METHODS size RETURNING VALUE(ep_size) TYPE i . *"* protected components of class ZABAP_EXCEL_WORKSHEETS *"* do not include other source files here!!! PROTECTED SECTION. *"* private components of class ZABAP_EXCEL_RANGES *"* do not include other source files here!!! PRIVATE SECTION. TYPES: BEGIN OF mty_s_hashed_column, column_index TYPE int4, column TYPE REF TO zcl_excel_column, END OF mty_s_hashed_column , mty_ts_hashed_column TYPE HASHED TABLE OF mty_s_hashed_column WITH UNIQUE KEY column_index. DATA columns TYPE REF TO zcl_excel_collection . DATA columns_hashed TYPE mty_ts_hashed_column . ENDCLASS. CLASS zcl_excel_columns IMPLEMENTATION. METHOD add. DATA: ls_hashed_column TYPE mty_s_hashed_column. ls_hashed_column-column_index = io_column->get_column_index( ). ls_hashed_column-column = io_column. INSERT ls_hashed_column INTO TABLE columns_hashed . columns->add( io_column ). ENDMETHOD. METHOD clear. CLEAR columns_hashed. columns->clear( ). ENDMETHOD. METHOD constructor. CREATE OBJECT columns. ENDMETHOD. METHOD get. FIELD-SYMBOLS: <ls_hashed_column> TYPE mty_s_hashed_column. READ TABLE columns_hashed WITH KEY column_index = ip_index ASSIGNING <ls_hashed_column>. IF sy-subrc = 0. eo_column = <ls_hashed_column>-column. ENDIF. ENDMETHOD. METHOD get_iterator. eo_iterator ?= columns->get_iterator( ). ENDMETHOD. METHOD is_empty. is_empty = columns->is_empty( ). ENDMETHOD. METHOD remove. DELETE TABLE columns_hashed WITH TABLE KEY column_index = io_column->get_column_index( ) . columns->remove( io_column ). ENDMETHOD. METHOD size. ep_size = columns->size( ). ENDMETHOD. ENDCLASS.
23.351852
97
0.705789
c879f0f495b0912dc864239f9a3ab0b61d6645a4
546
abap
ABAP
src/ycl_advent2020_day22.clas.abap
g-back/abap-advent-2020
95e6015efc25f75c867ceadbac34fabc924c2928
[ "MIT" ]
3
2020-12-06T21:10:23.000Z
2020-12-18T15:46:34.000Z
src/ycl_advent2020_day22.clas.abap
g-back/abap-advent-2020
95e6015efc25f75c867ceadbac34fabc924c2928
[ "MIT" ]
null
null
null
src/ycl_advent2020_day22.clas.abap
g-back/abap-advent-2020
95e6015efc25f75c867ceadbac34fabc924c2928
[ "MIT" ]
null
null
null
CLASS ycl_advent2020_day22 DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. METHODS solve_part_one IMPORTING input TYPE string_table RETURNING VALUE(result) TYPE int8. METHODS solve_part_two IMPORTING input TYPE string_table RETURNING VALUE(result) TYPE int8. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ycl_advent2020_day22 IMPLEMENTATION. METHOD solve_part_one. ENDMETHOD. METHOD solve_part_two. ENDMETHOD. ENDCLASS.
14.368421
42
0.681319
c87a9568a8566636fdf91389e6fe922c963f7b49
1,608
abap
ABAP
src/ztest_benchmark.prog.abap
sbcgua/benchmarks
bf8827665f2caca6d3d5f0d741b558c310f302e5
[ "MIT" ]
null
null
null
src/ztest_benchmark.prog.abap
sbcgua/benchmarks
bf8827665f2caca6d3d5f0d741b558c310f302e5
[ "MIT" ]
null
null
null
src/ztest_benchmark.prog.abap
sbcgua/benchmarks
bf8827665f2caca6d3d5f0d741b558c310f302e5
[ "MIT" ]
null
null
null
class lcl_benchmark definition final. public section. methods constructor importing io_object type ref to object iv_method type string iv_times type i. methods run. methods print. private section. data mo_object type ref to object. data mv_method type string. data mv_times type i. data mv_diff type p decimals 6. endclass. class lcl_benchmark implementation. method constructor. mo_object = io_object. mv_method = to_upper( iv_method ). mv_times = iv_times. endmethod. method run. data: lv_sta_time type timestampl, lv_end_time type timestampl. get time stamp field lv_sta_time. do mv_times times. call method mo_object->(mv_method). enddo. get time stamp field lv_end_time. mv_diff = lv_end_time - lv_sta_time. endmethod. method print. write: /(30) mv_method, 'results', mv_diff exponent 0. uline. endmethod. endclass. ********************************************************************** * RUNNER ********************************************************************** class lcl_runner_base definition. public section. methods run importing iv_method type string. data mv_num_rounds type i. endclass. class lcl_runner_base implementation. method run. data lo_benchmark type ref to lcl_benchmark. create object lo_benchmark exporting io_object = me iv_method = iv_method iv_times = mv_num_rounds. lo_benchmark->run( ). lo_benchmark->print( ). endmethod. endclass.
20.1
70
0.616294
c87cdcc6e71d0a9f3c89af2b9499e7598572cf6f
2,990
abap
ABAP
src/checks/y_check_profile_message.clas.abap
pokrakam/code-pal-for-abap
65c008f75d4d2453c6994c57dc03741862c1d510
[ "Apache-2.0" ]
202
2020-05-05T13:41:12.000Z
2022-03-26T15:18:13.000Z
src/checks/y_check_profile_message.clas.abap
pokrakam/code-pal-for-abap
65c008f75d4d2453c6994c57dc03741862c1d510
[ "Apache-2.0" ]
322
2020-05-05T19:14:35.000Z
2022-03-22T14:48:44.000Z
src/checks/y_check_profile_message.clas.abap
lucasborin/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
59
2020-05-05T18:59:19.000Z
2022-03-20T11:24:48.000Z
CLASS y_check_profile_message DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUBLIC. PUBLIC SECTION. METHODS constructor. PROTECTED SECTION. METHODS execute_check REDEFINITION. METHODS inspect_tokens REDEFINITION. METHODS inform REDEFINITION. PRIVATE SECTION. CLASS-DATA ran TYPE abap_bool. METHODS get_profiles RETURNING VALUE(result) TYPE y_if_profile_manager=>profile_assignments. METHODS list_profiles IMPORTING profiles TYPE y_if_profile_manager=>profile_assignments RETURNING VALUE(result) TYPE string. ENDCLASS. CLASS y_check_profile_message IMPLEMENTATION. METHOD constructor. super->constructor( ). has_documentation = abap_false. settings-disable_on_testcode_selection = abap_true. settings-disable_on_prodcode_selection = abap_true. settings-disable_threshold_selection = abap_true. settings-threshold = 0. settings-apply_on_test_code = abap_true. settings-apply_on_productive_code = abap_true. settings-ignore_pseudo_comments = abap_true. set_check_message( '&1 Profile(s) in use: &2.' ). ENDMETHOD. METHOD execute_check. CHECK ran = abap_false. CHECK has_attributes = abap_false. DATA(check_configuration) = detect_check_configuration( VALUE #( level = 1 ) ). IF check_configuration IS INITIAL. RETURN. ENDIF. DATA(profiles) = get_profiles( ). raise_error( statement_level = 1 statement_index = 1 statement_from = 1 error_priority = check_configuration-prio parameter_01 = |{ lines( profiles ) }| parameter_02 = |{ list_profiles( profiles ) }| ). ran = abap_true. ENDMETHOD. METHOD inspect_tokens. RETURN. ENDMETHOD. METHOD inform. super->inform( p_sub_obj_type = 'TRAN' p_sub_obj_name = 'Y_CODE_PAL_PROFILE' p_position = '' p_line = '' p_column = '' p_errcnt = p_errcnt p_kind = p_kind p_test = p_test p_code = p_code p_suppress = p_suppress p_param_1 = p_param_1 p_param_2 = p_param_2 p_param_3 = p_param_3 p_param_4 = p_param_4 p_inclspec = p_inclspec p_detail = p_detail p_checksum_1 = p_checksum_1 p_comments = p_comments ). ENDMETHOD. METHOD get_profiles. TRY. result = y_profile_manager=>create( )->select_profiles( sy-uname ). CATCH ycx_entry_not_found. RETURN. ENDTRY. ENDMETHOD. METHOD list_profiles. LOOP AT profiles ASSIGNING FIELD-SYMBOL(<profile>). result = COND #( WHEN result IS INITIAL THEN <profile>-profile ELSE |{ result }, { <profile>-profile }| ). ENDLOOP. ENDMETHOD. ENDCLASS.
28.47619
96
0.626087
c882212a006b1c4dfe86f485454cbc1e9a75704e
4,951
abap
ABAP
clean_code_main/clean_code_checks/y_check_empty_if_branches.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_checks/y_check_empty_if_branches.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_checks/y_check_empty_if_branches.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
CLASS ltd_clean_code_manager DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: y_if_clean_code_manager. ENDCLASS. CLASS ltd_clean_code_manager IMPLEMENTATION. METHOD y_if_clean_code_manager~read_check_customizing. result = VALUE #( ( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'E' threshold = 0 ) ( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'W' threshold = 0 ) ). ENDMETHOD. METHOD y_if_clean_code_manager~calculate_obj_creation_date. result = '19000101'. ENDMETHOD. ENDCLASS. CLASS ltd_ref_scan_manager DEFINITION FOR TESTING INHERITING FROM y_scan_manager_double. PUBLIC SECTION. METHODS: set_data_for_ok, set_data_for_error, set_check_pseudo_comment_ok. ENDCLASS. CLASS ltd_ref_scan_manager IMPLEMENTATION. METHOD set_data_for_ok. convert_code( VALUE #( ( 'REPORT ut_test.' ) ( 'START-OF-SELECTION.' ) ( 'DATA val TYPE abap_bool.' ) ( 'IF val = val.' ) ( ' IF val = val.' ) ( ' val = abap_true.' ) ( ' ELSEIF val = val.' ) ( ' val = abap_true.' ) ( ' ELSE.' ) ( ' val = abap_true.' ) ( ' ENDIF.' ) ( ' val = abap_true.' ) ( 'ELSEIF val = val.' ) ( ' val = abap_true.' ) ( 'ELSE.' ) ( ' val = abap_true.' ) ( 'ENDIF.' ) ( 'IF val = val.' ) ( ' IF val = val.' ) ( ' val = abap_true.' ) ( ' ENDIF.' ) ( 'val = abap_true.' ) ( 'ENDIF.' ) ( 'IF val = val.' ) ( '* comment' ) ( ' val = abap_true.' ) ( 'ENDIF.' ) ) ). ENDMETHOD. METHOD set_data_for_error. convert_code( VALUE #( ( 'REPORT ut_test.' ) ( 'START-OF-SELECTION.' ) ( 'DATA val TYPE abap_bool.' ) ( 'IF val = val.' ) ( ' IF val = val. " comment' ) ( ' ELSEIF val = val.' ) ( ' ELSE.' ) ( ' ENDIF.' ) ( 'ELSEIF val = val.' ) ( 'ELSE.' ) ( '* comment' ) ( 'ENDIF.' ) ( 'IF val = val.' ) ( ' IF val = val.' ) ( ' ENDIF.' ) ( 'ENDIF.' ) ) ). ENDMETHOD. METHOD set_check_pseudo_comment_ok. convert_code( VALUE #( ( 'REPORT ut_test.' ) ( 'START-OF-SELECTION.' ) ( 'DATA val TYPE abap_bool.' ) ( 'IF val = val.' ) ( ' IF val = val. "#EC EMPTY_IF_BRANCH' ) ( ' ELSEIF val = val. "#EC EMPTY_IF_BRANCH' ) ( ' ELSE. "#EC EMPTY_IF_BRANCH' ) ( ' ENDIF.' ) ( 'ELSEIF val = val. "#EC EMPTY_IF_BRANCH' ) ( 'ELSE. "#EC EMPTY_IF_BRANCH' ) ( '* comment' ) ( 'ENDIF.' ) ( 'IF val = val.' ) ( ' IF val = val. "#EC EMPTY_IF_BRANCH' ) ( ' ENDIF.' ) ( 'ENDIF.' ) ) ). ENDMETHOD. ENDCLASS. CLASS ltd_clean_code_exemption_no DEFINITION FOR TESTING INHERITING FROM y_exemption_handler. PUBLIC SECTION. METHODS: is_object_exempted REDEFINITION. ENDCLASS. CLASS ltd_clean_code_exemption_no IMPLEMENTATION. METHOD is_object_exempted. RETURN. ENDMETHOD. ENDCLASS. CLASS local_test_class DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. DATA: cut TYPE REF TO y_check_empty_if_branches, ref_scan_manager_double TYPE REF TO ltd_ref_scan_manager. METHODS: setup, assert_errors IMPORTING err_cnt TYPE i, assert_pseudo_comments IMPORTING pc_cnt TYPE i, is_bound FOR TESTING, check_ok FOR TESTING, check_error FOR TESTING, check_pseudo_comment_ok FOR TESTING. ENDCLASS. CLASS y_check_empty_if_branches DEFINITION LOCAL FRIENDS local_test_class. CLASS local_test_class IMPLEMENTATION. METHOD setup. cut = NEW y_check_empty_if_branches( ). ref_scan_manager_double = NEW ltd_ref_scan_manager( ). cut->ref_scan_manager ?= ref_scan_manager_double. cut->clean_code_manager = NEW ltd_clean_code_manager( ). cut->clean_code_exemption_handler = NEW ltd_clean_code_exemption_no( ). cut->attributes_maintained = abap_true. ENDMETHOD. METHOD is_bound. cl_abap_unit_assert=>assert_bound( EXPORTING act = cut ). ENDMETHOD. METHOD check_ok. ref_scan_manager_double->set_data_for_ok( ). cut->run( ). assert_errors( 0 ). assert_pseudo_comments( 0 ). ENDMETHOD. METHOD check_error. ref_scan_manager_double->set_data_for_error( ). cut->run( ). assert_errors( 6 ). assert_pseudo_comments( 0 ). ENDMETHOD. METHOD check_pseudo_comment_ok. ref_scan_manager_double->set_check_pseudo_comment_ok( ). cut->run( ). assert_errors( 0 ). assert_pseudo_comments( 6 ). ENDMETHOD. METHOD assert_errors. cl_abap_unit_assert=>assert_equals( EXPORTING act = cut->statistics->get_number_errors( ) exp = err_cnt ). ENDMETHOD. METHOD assert_pseudo_comments. cl_abap_unit_assert=>assert_equals( EXPORTING act = cut->statistics->get_number_pseudo_comments( ) exp = pc_cnt ). ENDMETHOD. ENDCLASS.
24.755
120
0.628964
c8872987b2310377c68b7173e3fd2cde66ee0ba7
7,932
abap
ABAP
src/profiles/y_alv_tree_control.clas.abap
AlexandreHT/code-pal-for-abap
e181ce468b32d4d37fb6c8d56062ab894d17df2a
[ "Apache-2.0" ]
1
2020-06-24T21:57:18.000Z
2020-06-24T21:57:18.000Z
src/profiles/y_alv_tree_control.clas.abap
AlexandreHT/code-pal-for-abap
e181ce468b32d4d37fb6c8d56062ab894d17df2a
[ "Apache-2.0" ]
null
null
null
src/profiles/y_alv_tree_control.clas.abap
AlexandreHT/code-pal-for-abap
e181ce468b32d4d37fb6c8d56062ab894d17df2a
[ "Apache-2.0" ]
null
null
null
CLASS y_alv_tree_control DEFINITION PUBLIC CREATE PUBLIC. PUBLIC SECTION. INTERFACES y_if_alv_tree_control . CLASS-METHODS create IMPORTING alv_header_text TYPE slis_entry dynpro_nr TYPE sydynnr sy_repid TYPE syrepid docking_side TYPE i DEFAULT cl_gui_docking_container=>align_at_left ratio TYPE i type_name TYPE string sort_table TYPE lvc_t_sort events TYPE REF TO y_if_alv_events event_mode TYPE i DEFAULT y_if_alv_events=>mode_double_click RETURNING VALUE(result) TYPE REF TO y_if_alv_tree_control RAISING cx_sy_create_data_error cx_failed. METHODS constructor IMPORTING type_name TYPE string sort_table TYPE lvc_t_sort events TYPE REF TO y_if_alv_events alv_tree TYPE REF TO cl_gui_alv_tree_simple alv_header TYPE slis_t_listheader RAISING cx_sy_create_data_error cx_failed. PROTECTED SECTION. METHODS set_all_fields_invisible. METHODS autosize_all_fields. METHODS call_fieldcatalog_merge IMPORTING structure_name TYPE tabname. METHODS get_excluded_toolbars RETURNING VALUE(result) TYPE ui_functions. PRIVATE SECTION. DATA list TYPE REF TO y_if_list. DATA alv_header TYPE slis_t_listheader. DATA sort TYPE lvc_t_sort. DATA fieldcats TYPE lvc_t_fcat. DATA alv_tree TYPE REF TO cl_gui_alv_tree_simple. ENDCLASS. CLASS Y_ALV_TREE_CONTROL IMPLEMENTATION. METHOD autosize_all_fields. DATA filler TYPE i VALUE 7. LOOP AT fieldcats ASSIGNING FIELD-SYMBOL(<line>). IF <line>-dd_outlen GE strlen( <line>-coltext ). <line>-outputlen = <line>-dd_outlen + filler. ELSE. <line>-outputlen = strlen( <line>-coltext ) + filler. ENDIF. ENDLOOP. UNASSIGN <line>. ENDMETHOD. METHOD call_fieldcatalog_merge. CALL FUNCTION 'LVC_FIELDCATALOG_MERGE' EXPORTING i_structure_name = structure_name CHANGING ct_fieldcat = fieldcats. ENDMETHOD. METHOD create. DATA(docking_container) = NEW cl_gui_docking_container( repid = sy_repid dynnr = dynpro_nr side = docking_side ratio = ratio ). DATA(alv_tree) = NEW cl_gui_alv_tree_simple( i_parent = docking_container i_item_selection = abap_false i_no_html_header = abap_true ). alv_tree->get_toolbar_object( IMPORTING er_toolbar = DATA(alv_toolbar) ). events->register_handler_to_alv_tree( alv_tree ). events->register_handler_to_toolbar( alv_toolbar ). alv_tree->set_registered_events( events->get_events( event_mode ) ). DATA(alv_header) = VALUE slis_t_listheader( ( typ = 'H' info = alv_header_text ) ). result = NEW y_alv_tree_control( type_name = type_name sort_table = sort_table events = events alv_tree = alv_tree alv_header = alv_header ). ENDMETHOD. METHOD constructor. list = NEW y_list( type_name ). me->alv_tree = alv_tree. me->alv_header = alv_header. sort = sort_table. call_fieldcatalog_merge( CONV #( type_name ) ). set_all_fields_invisible( ). ENDMETHOD. METHOD get_excluded_toolbars. APPEND cl_gui_alv_tree_simple=>mc_fc_calculate TO result. APPEND cl_gui_alv_tree_simple=>mc_fc_print_back TO result. APPEND cl_gui_alv_tree_simple=>mc_fc_current_variant TO result. APPEND cl_gui_alv_tree_simple=>mc_fc_change_hierarchy TO result. ENDMETHOD. METHOD set_all_fields_invisible. LOOP AT fieldcats ASSIGNING FIELD-SYMBOL(<line>). <line>-no_out = abap_true. ENDLOOP. UNASSIGN <line>. ENDMETHOD. METHOD y_if_alv_tree_control~get_selected_index. DATA index_table TYPE lvc_t_indx. CHECK y_if_alv_tree_control~list_control( )->get_line_at( 1 ) IS NOT INITIAL. IF sy-subrc EQ 0. alv_tree->get_selected_nodes( CHANGING ct_index_outtab = index_table ). TRY. result = index_table[ 1 ]. CATCH cx_sy_itab_line_not_found. RAISE EXCEPTION TYPE ycx_entry_not_found. ENDTRY. ENDIF. ENDMETHOD. METHOD y_if_alv_tree_control~set_selected_index. CHECK y_if_alv_tree_control~list_control( )->get_line_at( 1 ) IS NOT INITIAL. DATA index_table TYPE lvc_t_indx. APPEND index TO index_table. alv_tree->set_selected_nodes( EXPORTING it_index_outtab = index_table EXCEPTIONS cntl_system_error = 1 dp_error = 2 failed = 3 error_in_node_key_table = 4 OTHERS = 5 ). ENDMETHOD. METHOD y_if_alv_tree_control~get_selected_line. result = list->get_line_at( y_if_alv_tree_control~get_selected_index( ) ). ENDMETHOD. METHOD y_if_alv_tree_control~init_display. DATA(table) = y_if_alv_tree_control~list_control( )->get_table( ). ASSIGN table->* TO FIELD-SYMBOL(<table>). autosize_all_fields( ). alv_tree->set_table_for_first_display( EXPORTING it_list_commentary = alv_header it_toolbar_excluding = get_excluded_toolbars( ) CHANGING it_sort = sort it_outtab = <table> it_fieldcatalog = fieldcats ). cl_gui_cfw=>flush( ). UNASSIGN <table>. alv_tree->expand_tree( 1 ). ENDMETHOD. METHOD y_if_alv_tree_control~list_control. result = list. ENDMETHOD. METHOD y_if_alv_tree_control~refresh_display. alv_tree->refresh_table_display( it_sort = sort ). alv_tree->expand_tree( 1 ). ENDMETHOD. METHOD y_if_alv_tree_control~set_field_header_text. LOOP AT fieldcats ASSIGNING FIELD-SYMBOL(<line>) WHERE fieldname EQ to_upper( fieldname ). <line>-coltext = header_text. ENDLOOP. UNASSIGN <line>. ENDMETHOD. METHOD y_if_alv_tree_control~set_field_visibility. LOOP AT fieldcats ASSIGNING FIELD-SYMBOL(<line>) WHERE fieldname EQ to_upper( fieldname ). <line>-no_out = xsdbool( is_visible EQ abap_false ). ENDLOOP. UNASSIGN <line>. ENDMETHOD. METHOD y_if_alv_tree_control~toolbar_control. alv_tree->get_toolbar_object( IMPORTING er_toolbar = result EXCEPTIONS OTHERS = 4 ). IF sy-subrc NE 0. RAISE EXCEPTION TYPE cx_failed. ENDIF. ENDMETHOD. METHOD y_if_alv_tree_control~to_focus. cl_gui_control=>set_focus( alv_tree ). ENDMETHOD. METHOD y_if_alv_tree_control~activate_toolbar. LOOP AT y_if_alv_tree_control~toolbar_control( )->m_table_button ASSIGNING FIELD-SYMBOL(<button>). y_if_alv_tree_control~toolbar_control( )->set_button_state( EXPORTING enabled = abap_true fcode = <button>-function EXCEPTIONS OTHERS = 4 ). IF sy-subrc NE 0. RAISE EXCEPTION TYPE cx_failed. ENDIF. ENDLOOP. ENDMETHOD. METHOD y_if_alv_tree_control~deactivate_toolbar. LOOP AT y_if_alv_tree_control~toolbar_control( )->m_table_button ASSIGNING FIELD-SYMBOL(<button>). y_if_alv_tree_control~toolbar_control( )->set_button_state( EXPORTING enabled = abap_false fcode = <button>-function EXCEPTIONS OTHERS = 4 ). IF sy-subrc NE 0. RAISE EXCEPTION TYPE cx_failed. ENDIF. ENDLOOP. ENDMETHOD. ENDCLASS.
31.728
104
0.639309
c88735047f57b90ac7604a2de682e760bb992756
1,745
abap
ABAP
src/zcl_abapgit_transport_mass.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
null
null
null
src/zcl_abapgit_transport_mass.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
null
null
null
src/zcl_abapgit_transport_mass.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_transport_mass DEFINITION PUBLIC INHERITING FROM zcl_abapgit_transport FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS run . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPGIT_TRANSPORT_MASS IMPLEMENTATION. METHOD run. DATA: lt_trkorr TYPE trwbo_request_headers, lo_transport_zipper TYPE REF TO lcl_transport_zipper, lo_except TYPE REF TO cx_root, lv_folder TYPE string, lv_text TYPE string. TRY. lt_trkorr = lcl_gui=>select_tr_requests( ). IF lt_trkorr[] IS NOT INITIAL. lv_folder = lcl_gui=>f4_folder( ). IF lv_folder IS INITIAL. * Empty folder zcx_abapgit_exception=>raise( 'Empty destination folder' ). ENDIF. * Instantiate transport zipper object that will also create the timestamped output folder CREATE OBJECT lo_transport_zipper TYPE lcl_transport_zipper EXPORTING iv_folder = lv_folder. * Generate the local zip files from the given list of transport requests lo_transport_zipper->generate_files( it_trkorr = lt_trkorr iv_logic = zcl_abapgit_ui_factory=>get_popups( )->popup_folder_logic( ) ). * Open output folder if user asked it lcl_gui=>open_folder_frontend( lo_transport_zipper->gv_full_folder ). ELSE. * No data found for the provided selection criterias zcx_abapgit_exception=>raise( 'No transport requests selected' ). ENDIF. CATCH zcx_abapgit_exception INTO lo_except. lv_text = lo_except->get_text( ). MESSAGE lv_text TYPE 'S' DISPLAY LIKE 'E'. ENDTRY. ENDMETHOD. ENDCLASS.
25.289855
89
0.671633
c88774cab42255563315c870e14e8f65a09a65af
1,489
abap
ABAP
src/utils/zcl_abapgit_time.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/utils/zcl_abapgit_time.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/utils/zcl_abapgit_time.clas.abap
wangdongcheng/abapGit
7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
CLASS zcl_abapgit_time DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. TYPES: ty_unixtime TYPE c LENGTH 16 . CLASS-METHODS get_unix RETURNING VALUE(rv_time) TYPE ty_unixtime RAISING zcx_abapgit_exception . CLASS-METHODS get_utc IMPORTING !iv_unix TYPE ty_unixtime EXPORTING !ev_date TYPE sy-datum !ev_time TYPE sy-uzeit . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPGIT_TIME IMPLEMENTATION. METHOD get_unix. * returns seconds since unix epoch, including timezone indicator CONSTANTS lc_epoch TYPE timestamp VALUE '19700101000000'. DATA lv_time TYPE timestamp. DATA lv_seconds TYPE i. GET TIME STAMP FIELD lv_time. lv_seconds = cl_abap_tstmp=>subtract( tstmp1 = lv_time tstmp2 = lc_epoch ). rv_time = lv_seconds. CONDENSE rv_time. rv_time+11 = '+000000'. ENDMETHOD. METHOD get_utc. CONSTANTS lc_epoch TYPE d VALUE '19700101'. DATA: lv_i TYPE i, lv_utcdiff TYPE t, lv_utcsign TYPE c LENGTH 1. lv_i = iv_unix(10). lv_utcsign = iv_unix+11. lv_utcdiff = iv_unix+12. " GMT + time-zone CASE lv_utcsign. WHEN '+'. lv_i = lv_i + lv_utcdiff. WHEN '-'. lv_i = lv_i - lv_utcdiff. ENDCASE. ev_time = lv_i MOD 86400. lv_i = lv_i - ev_time. lv_i = lv_i / 86400. ev_date = lv_i + lc_epoch. ENDMETHOD. ENDCLASS.
18.848101
64
0.640698
c888e3fa3aaaba7e71afbf37d7a6fd14765115a5
5,653
abap
ABAP
src/ui/zif_abapgit_popups.intf.abap
RedWolf112/abapGit
4420de02971a3a61f3c526c2778a9ff669d21a0a
[ "MIT" ]
null
null
null
src/ui/zif_abapgit_popups.intf.abap
RedWolf112/abapGit
4420de02971a3a61f3c526c2778a9ff669d21a0a
[ "MIT" ]
null
null
null
src/ui/zif_abapgit_popups.intf.abap
RedWolf112/abapGit
4420de02971a3a61f3c526c2778a9ff669d21a0a
[ "MIT" ]
null
null
null
INTERFACE zif_abapgit_popups PUBLIC . TYPES: BEGIN OF ty_popup, " TODO remove, use zif_abapgit_services_repo=>ty_repo_params instead url TYPE string, package TYPE devclass, branch_name TYPE string, display_name TYPE string, folder_logic TYPE string, ign_subpkg TYPE abap_bool, master_lang_only TYPE abap_bool, cancel TYPE abap_bool, END OF ty_popup . CONSTANTS c_new_branch_label TYPE string VALUE '+ create new ...' ##NO_TEXT. METHODS popup_search_help IMPORTING !iv_tab_field TYPE string RETURNING VALUE(rv_value) TYPE ddshretval-fieldval RAISING zcx_abapgit_exception . METHODS popup_package_export EXPORTING !ev_package TYPE devclass !ev_folder_logic TYPE string !ev_serialize_master_lang_only TYPE abap_bool RAISING zcx_abapgit_exception . METHODS popup_folder_logic RETURNING VALUE(rv_folder_logic) TYPE string RAISING zcx_abapgit_exception . METHODS popup_object RETURNING VALUE(rs_tadir) TYPE zif_abapgit_definitions=>ty_tadir RAISING zcx_abapgit_exception . METHODS create_branch_popup EXPORTING !ev_name TYPE string !ev_cancel TYPE abap_bool RAISING zcx_abapgit_exception . METHODS repo_new_offline RETURNING VALUE(rs_popup) TYPE ty_popup RAISING zcx_abapgit_exception . METHODS branch_list_popup IMPORTING !iv_url TYPE string !iv_default_branch TYPE string OPTIONAL !iv_show_new_option TYPE abap_bool OPTIONAL !iv_hide_branch TYPE zif_abapgit_persistence=>ty_repo-branch_name OPTIONAL !iv_hide_head TYPE abap_bool OPTIONAL RETURNING VALUE(rs_branch) TYPE zif_abapgit_definitions=>ty_git_branch RAISING zcx_abapgit_exception . METHODS repo_popup IMPORTING !iv_url TYPE string !iv_package TYPE devclass OPTIONAL !iv_branch TYPE string DEFAULT 'refs/heads/master' !iv_freeze_package TYPE abap_bool OPTIONAL !iv_freeze_url TYPE abap_bool OPTIONAL !iv_title TYPE clike DEFAULT 'New Online Project' !iv_display_name TYPE string OPTIONAL RETURNING VALUE(rs_popup) TYPE ty_popup RAISING zcx_abapgit_exception ##NO_TEXT. METHODS popup_to_confirm IMPORTING !iv_titlebar TYPE clike !iv_text_question TYPE clike !iv_text_button_1 TYPE clike DEFAULT 'Yes' !iv_icon_button_1 TYPE icon-name DEFAULT space !iv_text_button_2 TYPE clike DEFAULT 'No' !iv_icon_button_2 TYPE icon-name DEFAULT space !iv_default_button TYPE char1 DEFAULT '1' !iv_display_cancel_button TYPE char1 DEFAULT abap_true RETURNING VALUE(rv_answer) TYPE char1 RAISING zcx_abapgit_exception . METHODS popup_to_inform IMPORTING !iv_titlebar TYPE clike !iv_text_message TYPE clike RAISING zcx_abapgit_exception . METHODS popup_to_create_package EXPORTING !es_package_data TYPE scompkdtln !ev_create TYPE abap_bool RAISING zcx_abapgit_exception . METHODS popup_to_create_transp_branch IMPORTING !it_transport_headers TYPE trwbo_request_headers RETURNING VALUE(rs_transport_branch) TYPE zif_abapgit_definitions=>ty_transport_to_branch RAISING zcx_abapgit_exception. METHODS popup_to_select_transports RETURNING VALUE(rt_trkorr) TYPE trwbo_request_headers . METHODS popup_to_select_from_list IMPORTING !it_list TYPE STANDARD TABLE !iv_title TYPE lvc_title DEFAULT space !iv_header_text TYPE csequence DEFAULT space !iv_start_column TYPE i DEFAULT 2 !iv_end_column TYPE i DEFAULT 65 !iv_start_line TYPE i DEFAULT 8 !iv_end_line TYPE i DEFAULT 20 !iv_striped_pattern TYPE abap_bool DEFAULT abap_false !iv_optimize_col_width TYPE abap_bool DEFAULT abap_true !iv_selection_mode TYPE salv_de_constant DEFAULT if_salv_c_selection_mode=>multiple !iv_select_column_text TYPE csequence DEFAULT space !it_columns_to_display TYPE zif_abapgit_definitions=>ty_alv_column_tt EXPORTING VALUE(et_list) TYPE STANDARD TABLE RAISING zcx_abapgit_exception . METHODS branch_popup_callback IMPORTING !iv_code TYPE clike CHANGING !ct_fields TYPE zif_abapgit_definitions=>ty_sval_tt !cs_error TYPE svale !cv_show_popup TYPE char01 RAISING zcx_abapgit_exception . METHODS package_popup_callback IMPORTING !iv_code TYPE clike CHANGING !ct_fields TYPE zif_abapgit_definitions=>ty_sval_tt !cs_error TYPE svale !cv_show_popup TYPE char01 RAISING zcx_abapgit_exception . METHODS popup_transport_request IMPORTING !is_transport_type TYPE zif_abapgit_definitions=>ty_transport_type RETURNING VALUE(rv_transport) TYPE trkorr RAISING zcx_abapgit_exception. METHODS popup_proxy_bypass IMPORTING !it_proxy_bypass TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url RETURNING VALUE(rt_proxy_bypass) TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url RAISING zcx_abapgit_exception. ENDINTERFACE.
34.260606
93
0.682116
c88b2908a0002a651d06b1ad211f62812f6e05f4
225
abap
ABAP
src/unmanaged/#dmo#bp_travel_u11.clas.abap
SAP-Cloud-Platform/flight11
8b5d70046bc3f7619f2d33cc90b3a53b0809cc54
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_travel_u11.clas.abap
SAP-Cloud-Platform/flight11
8b5d70046bc3f7619f2d33cc90b3a53b0809cc54
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_travel_u11.clas.abap
SAP-Cloud-Platform/flight11
8b5d70046bc3f7619f2d33cc90b3a53b0809cc54
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/bp_travel_u11 DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF /dmo/i_travel_u11 . PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /dmo/bp_travel_u11 IMPLEMENTATION. ENDCLASS.
14.0625
40
0.764444
c88be71b0bc09255e260a1b15ea0423fef688c81
3,306
abap
ABAP
src/zdemo_excel41.prog.abap
AndreaBorgia-Abo/demos
2f89e63babc3590ea44773873b7b78db549f4c7b
[ "MIT" ]
251
2019-02-23T03:36:38.000Z
2021-12-10T21:39:23.000Z
src/zdemo_excel41.prog.abap
AndreaBorgia-Abo/demos
2f89e63babc3590ea44773873b7b78db549f4c7b
[ "MIT" ]
278
2019-02-17T10:42:59.000Z
2021-12-10T20:24:56.000Z
src/zdemo_excel41.prog.abap
AndreaBorgia-Abo/demos
2f89e63babc3590ea44773873b7b78db549f4c7b
[ "MIT" ]
130
2019-02-20T13:25:30.000Z
2021-12-09T03:20:31.000Z
REPORT zdemo_excel41. CONSTANTS: gc_save_file_name TYPE string VALUE 'ABAP2XLSX Inheritance.xlsx'. *--------------------------------------------------------------------* * Demo inheritance ZCL_EXCEL1 * Variation of ZCL_EXCEL that creates numerous sheets *--------------------------------------------------------------------* CLASS lcl_my_zcl_excel1 DEFINITION INHERITING FROM zcl_excel. PUBLIC SECTION. METHODS: constructor IMPORTING iv_sheetcount TYPE i DEFAULT 5 RAISING zcx_excel. ENDCLASS. CLASS lcl_my_zcl_excel1 IMPLEMENTATION. METHOD constructor. DATA: lv_sheets_to_create TYPE i. super->constructor( ). lv_sheets_to_create = iv_sheetcount - 1. " one gets created by standard class DO lv_sheets_to_create TIMES. TRY. me->add_new_worksheet( ). CATCH zcx_excel. ENDTRY. ENDDO. me->set_active_sheet_index( 1 ). ENDMETHOD. ENDCLASS. *--------------------------------------------------------------------* * Demo inheritance ZCL_EXCEL_WORKSHEET * Variation of ZCL_EXCEL_WORKSHEET ( and ZCL_EXCEL that calls the new type of worksheet ) * that sets a fixed title *--------------------------------------------------------------------* CLASS lcl_my_zcl_excel2 DEFINITION INHERITING FROM zcl_excel. PUBLIC SECTION. METHODS: constructor RAISING zcx_excel. ENDCLASS. CLASS lcl_my_zcl_excel_worksheet DEFINITION INHERITING FROM zcl_excel_worksheet. PUBLIC SECTION. METHODS: constructor IMPORTING ip_excel TYPE REF TO zcl_excel ip_title TYPE zexcel_sheet_title OPTIONAL " Will be ignored - keep parameter for demonstration purpose RAISING zcx_excel. ENDCLASS. CLASS lcl_my_zcl_excel2 IMPLEMENTATION. METHOD constructor. DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet. super->constructor( ). * To use own worksheet we have to remove the standard worksheet lo_worksheet = get_active_worksheet( ). me->worksheets->remove( lo_worksheet ). * and replace it with own version CREATE OBJECT lo_worksheet TYPE lcl_my_zcl_excel_worksheet EXPORTING ip_excel = me ip_title = 'This title will be ignored'. me->worksheets->add( lo_worksheet ). ENDMETHOD. ENDCLASS. CLASS lcl_my_zcl_excel_worksheet IMPLEMENTATION. METHOD constructor. super->constructor( ip_excel = ip_excel ip_title = 'Inherited Worksheet' ). ENDMETHOD. ENDCLASS. DATA: go_excel1 TYPE REF TO lcl_my_zcl_excel1. DATA: go_excel2 TYPE REF TO lcl_my_zcl_excel2. SELECTION-SCREEN BEGIN OF BLOCK bli WITH FRAME TITLE TEXT-bli. PARAMETERS: rbi_1 RADIOBUTTON GROUP rbi DEFAULT 'X' , " Simple inheritance rbi_2 RADIOBUTTON GROUP rbi. SELECTION-SCREEN END OF BLOCK bli. INCLUDE zdemo_excel_outputopt_incl. END-OF-SELECTION. CASE 'X'. WHEN rbi_1. " Simple inheritance of zcl_excel, object created directly CREATE OBJECT go_excel1 EXPORTING iv_sheetcount = 5. lcl_output=>output( go_excel1 ). WHEN rbi_2. " Inheritance of zcl_excel_worksheet, inheritance of zcl_excel needed to allow this CREATE OBJECT go_excel2. lcl_output=>output( go_excel2 ). ENDCASE.
32.097087
138
0.649425
c88eefe04d3a84aefae08b1fa4d4dc560abddc22
1,134
abap
ABAP
src/zcl_adv_base64_check.clas.abap
hhelibeb/abap-data-validator
f40fc35c4167730cee200f27dadec76964ea3203
[ "MIT" ]
24
2020-01-06T15:05:12.000Z
2022-02-11T17:58:35.000Z
src/zcl_adv_base64_check.clas.abap
hhelibeb/abap-data-validation
f40fc35c4167730cee200f27dadec76964ea3203
[ "MIT" ]
9
2020-01-04T22:36:05.000Z
2020-11-12T09:25:53.000Z
src/zcl_adv_base64_check.clas.abap
hhelibeb/abap-data-validation
f40fc35c4167730cee200f27dadec76964ea3203
[ "MIT" ]
10
2020-01-04T13:52:28.000Z
2022-03-26T08:06:19.000Z
CLASS zcl_adv_base64_check DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES: zif_adv_check. ALIASES: is_valid FOR zif_adv_check~is_valid. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ADV_BASE64_CHECK IMPLEMENTATION. METHOD zif_adv_check~is_valid. DATA(string_base64) = CONV string( data ). IF string_base64 IS INITIAL. valid = abap_true. RETURN. ENDIF. DATA: bindata TYPE xstring. CALL FUNCTION 'SSFC_BASE64_DECODE' EXPORTING b64data = string_base64 b_check = 'X' IMPORTING bindata = bindata EXCEPTIONS ssf_krn_error = 1 ssf_krn_noop = 2 ssf_krn_nomemory = 3 ssf_krn_opinv = 4 ssf_krn_input_data_error = 5 ssf_krn_invalid_par = 6 ssf_krn_invalid_parlen = 7 OTHERS = 8. IF sy-subrc <> 0. RETURN. ENDIF. IF bindata IS INITIAL. RETURN. ENDIF. valid = abap_true. ENDMETHOD. ENDCLASS.
20.25
49
0.575838
c88f2efce9f23ed0b9b3977b72b43f0d8aa71715
4,034
abap
ABAP
src/zcl_gui_static.clas.abap
ivangurin/abapGeneric
c5aa9180ccc043eb099a3de9f7c845c0855c9068
[ "MIT" ]
null
null
null
src/zcl_gui_static.clas.abap
ivangurin/abapGeneric
c5aa9180ccc043eb099a3de9f7c845c0855c9068
[ "MIT" ]
null
null
null
src/zcl_gui_static.clas.abap
ivangurin/abapGeneric
c5aa9180ccc043eb099a3de9f7c845c0855c9068
[ "MIT" ]
1
2020-01-10T10:35:47.000Z
2020-01-10T10:35:47.000Z
class ZCL_GUI_STATIC definition public final create public . *"* public components of class ZCL_GUI_STATIC *"* do not include other source files here!!! *"* protected components of class ZCL_GUI_STATIC *"* do not include other source files here!!! public section. class-methods OPEN_URL importing !I_URL type STRING raising ZCX_GENERIC . class-methods GET_URL importing !I_TRANS type SIMPLE !I_ACTION type SIMPLE optional !IT_PARAMS type TIHTTPNVP optional returning value(E_URL) type STRING . class-methods POPUP_TO_CONFIRM importing !I_TITLE type SIMPLE optional !I_TEXT type SIMPLE optional returning value(E_ANSWER) type ABAP_BOOL raising ZCX_GENERIC . class-methods PROGRESS_INDICATOR importing !I_STEP type I !I_STEPS type I !I_EVERY type I default 1 !I_TEXT type STRING optional . class-methods SHOW_CLASS_METHOD importing !I_CLASS type SIMPLE !I_METHOD type SIMPLE raising ZCX_GENERIC . protected section. *"* private components of class ZCL_GUI_STATIC *"* do not include other source files here!!! private section. ENDCLASS. CLASS ZCL_GUI_STATIC IMPLEMENTATION. method get_url. data l_trans type sy-tcode. l_trans = i_trans. cl_its_runtime=>get_url( exporting in_transaction = l_trans importing out_abs_url = e_url ). data ls_param like line of it_params. loop at it_params into ls_param. data l_param type string. concatenate ls_param-name '=' ls_param-value into l_param. data l_params type string. if l_params is initial. l_params = l_param. else. concatenate l_params l_param into l_params separated by ';'. endif. endloop. if l_params is not initial. concatenate e_url l_params into e_url separated by space. endif. if i_action is not initial. concatenate e_url '&~okcode=' i_action into e_url. endif. endmethod. method open_url. type-pools ole2. data lr_explorer type ole2_object. create object lr_explorer 'InternetExplorer.Application'. "#EC NOTEXT set property of lr_explorer 'Visible' = 1. "#EC NOTEXT call method of lr_explorer 'Navigate2' "#EC NOTEXT exporting #1 = i_url. endmethod. method popup_to_confirm. call function 'POPUP_TO_CONFIRM' exporting titlebar = i_title text_question = i_text display_cancel_button = abap_false importing answer = e_answer exceptions text_not_found = 1 others = 2. if sy-subrc ne 0. zcx_generic=>raise( ). endif. case e_answer. when '1'. e_answer = abap_true. when '2'. e_answer = abap_false. endcase. endmethod. method progress_indicator. data l type i. l = i_step mod i_every. if l ne 0. return. endif. data l_percentage type f. l_percentage = i_step / i_steps * 100. if i_text is supplied. data l_text type string. l_text = i_text. else. data l_step(16). write i_step to l_step left-justified. data l_steps(16). write i_steps to l_steps left-justified. concatenate l_step 'from' l_steps into l_text separated by space. endif. call function 'SAPGUI_PROGRESS_INDICATOR' exporting percentage = l_percentage text = l_text. endmethod. method show_class_method. check i_class is not initial. check i_method is not initial. call function 'RS_TOOL_ACCESS' exporting operation = 'SHOW' object_name = i_method object_type = 'OM' enclosing_object = i_class with_objectlist = 'X' exceptions not_executed = 1 invalid_object_type = 2 others = 3. endmethod. ENDCLASS.
22.287293
73
0.636589
c890eee45e9e733bac5e520839a96ea6bdda0a9f
4,096
abap
ABAP
src/ui/core/zcl_abapgit_gui_event.clas.testclasses.abap
PeregrinTooc/abapGit
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
[ "MIT" ]
1
2020-11-12T17:34:15.000Z
2020-11-12T17:34:15.000Z
src/ui/core/zcl_abapgit_gui_event.clas.testclasses.abap
JustACasual/abapGit
6b36f43052bb6a4a53dcc7e655eb8845153b0476
[ "MIT" ]
null
null
null
src/ui/core/zcl_abapgit_gui_event.clas.testclasses.abap
JustACasual/abapGit
6b36f43052bb6a4a53dcc7e655eb8845153b0476
[ "MIT" ]
null
null
null
CLASS ltcl_event DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PRIVATE SECTION. METHODS query_wrong_data FOR TESTING RAISING zcx_abapgit_exception. METHODS form_wrong_data FOR TESTING RAISING zcx_abapgit_exception. METHODS query FOR TESTING RAISING zcx_abapgit_exception. METHODS form_data FOR TESTING RAISING zcx_abapgit_exception. METHODS immutability FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_event IMPLEMENTATION. METHOD query_wrong_data. DATA li_cut TYPE REF TO zif_abapgit_gui_event. DATA lo_map TYPE REF TO zcl_abapgit_string_map. CREATE OBJECT li_cut TYPE zcl_abapgit_gui_event EXPORTING iv_action = 'XXX' iv_getdata = 'not_a_param'. lo_map = li_cut->query( ). cl_abap_unit_assert=>assert_equals( act = lo_map->size( ) exp = 0 ). ENDMETHOD. METHOD form_wrong_data. DATA li_cut TYPE REF TO zif_abapgit_gui_event. DATA lo_map TYPE REF TO zcl_abapgit_string_map. CREATE OBJECT li_cut TYPE zcl_abapgit_gui_event EXPORTING iv_action = 'XXX'. lo_map = li_cut->form_data( ). cl_abap_unit_assert=>assert_equals( act = lo_map->size( ) exp = 0 ). ENDMETHOD. METHOD query. DATA li_cut TYPE REF TO zif_abapgit_gui_event. DATA lo_map TYPE REF TO zcl_abapgit_string_map. CREATE OBJECT li_cut TYPE zcl_abapgit_gui_event EXPORTING iv_action = 'XXX' iv_getdata = 'a=b&b=c'. " Cross check just in case cl_abap_unit_assert=>assert_equals( act = li_cut->form_data( )->size( ) exp = 0 ). lo_map = li_cut->query( ). cl_abap_unit_assert=>assert_equals( act = lo_map->size( ) exp = 2 ). cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'a' ) exp = 'b' ). cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'b' ) exp = 'c' ). " Case insensitivity cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'A' ) exp = 'b' ). cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'B' ) exp = 'c' ). ENDMETHOD. METHOD form_data. DATA li_cut TYPE REF TO zif_abapgit_gui_event. DATA lo_map TYPE REF TO zcl_abapgit_string_map. DATA lt_postdata TYPE cnht_post_data_tab. APPEND 'a=b&b=c' TO lt_postdata. CREATE OBJECT li_cut TYPE zcl_abapgit_gui_event EXPORTING iv_action = 'XXX' it_postdata = lt_postdata. " Cross check just in case cl_abap_unit_assert=>assert_equals( act = li_cut->query( )->size( ) exp = 0 ). lo_map = li_cut->form_data( ). cl_abap_unit_assert=>assert_equals( act = lo_map->size( ) exp = 2 ). cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'a' ) exp = 'b' ). cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'b' ) exp = 'c' ). " Case insensitivity cl_abap_unit_assert=>assert_equals( act = lo_map->size( ) exp = 2 ). cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'A' ) exp = 'b' ). cl_abap_unit_assert=>assert_equals( act = lo_map->get( 'B' ) exp = 'c' ). ENDMETHOD. METHOD immutability. DATA li_cut TYPE REF TO zif_abapgit_gui_event. DATA lo_x TYPE REF TO zcx_abapgit_exception. CREATE OBJECT li_cut TYPE zcl_abapgit_gui_event EXPORTING iv_getdata = 'a=b&b=c' iv_action = 'XXX'. TRY. li_cut->form_data( )->set( iv_key = 'x' iv_val = 'y' ). cl_abap_unit_assert=>fail( ). CATCH zcx_abapgit_exception INTO lo_x. cl_abap_unit_assert=>assert_char_cp( act = lo_x->get_text( ) exp = '*immutable*' ). ENDTRY. TRY. li_cut->query( )->set( iv_key = 'x' iv_val = 'y' ). cl_abap_unit_assert=>fail( ). CATCH zcx_abapgit_exception INTO lo_x. cl_abap_unit_assert=>assert_char_cp( act = lo_x->get_text( ) exp = '*immutable*' ). ENDTRY. ENDMETHOD. ENDCLASS.
24.674699
71
0.636475
c894d2f74205fb95845ded586d19ac062116b691
242
abap
ABAP
src/ecatt/cl_apl_ecatt_config_upload.clas.abap
himanshush13/ABAPLint-DEPS
b35a7483b5d22deace1021ee3b723673e7eda310
[ "MIT" ]
2
2020-04-19T14:38:41.000Z
2020-10-03T07:50:28.000Z
src/ecatt/cl_apl_ecatt_config_upload.clas.abap
himanshush13/ABAPLint-DEPS
b35a7483b5d22deace1021ee3b723673e7eda310
[ "MIT" ]
38
2019-08-13T17:30:13.000Z
2022-03-08T12:54:56.000Z
src/ecatt/cl_apl_ecatt_config_upload.clas.abap
himanshush13/ABAPLint-DEPS
b35a7483b5d22deace1021ee3b723673e7eda310
[ "MIT" ]
15
2019-11-19T13:45:29.000Z
2022-03-08T11:18:00.000Z
CLASS cl_apl_ecatt_config_upload DEFINITION PUBLIC INHERITING FROM cl_apl_ecatt_upload CREATE PUBLIC ABSTRACT. PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS cl_apl_ecatt_config_upload IMPLEMENTATION. ENDCLASS.
20.166667
110
0.842975
c89ad15e12eb4298e131f9024c3ec92141bab5d6
333
abap
ABAP
src/legacy/#dmo#flight_travel_api26.fugr.#dmo#flight_travel_save26.abap
SAP-Cloud-Platform/flight26
beb756cc2c66d406a9b52f3f077bf2d36e26a451
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api26.fugr.#dmo#flight_travel_save26.abap
SAP-Cloud-Platform/flight26
beb756cc2c66d406a9b52f3f077bf2d36e26a451
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api26.fugr.#dmo#flight_travel_save26.abap
SAP-Cloud-Platform/flight26
beb756cc2c66d406a9b52f3f077bf2d36e26a451
[ "BSD-Source-Code" ]
null
null
null
"! API for Saving the Transactional Buffer of the Travel API "! FUNCTION /DMO/FLIGHT_TRAVEL_SAVE26. *"---------------------------------------------------------------------- *"*"Local Interface: *"---------------------------------------------------------------------- /dmo/cl_flight_legacy26=>get_instance( )->save( ). ENDFUNCTION.
37
72
0.423423
c89d02a9ceae5440ad221a69abc6c3a184a5a708
5,567
abap
ABAP
src/objects/zcl_abapgit_object_jobd.clas.abap
ravishankarojha/abapGit
4bc4b63e0fcf5389457db5a36de643fe75977c2a
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_jobd.clas.abap
ravishankarojha/abapGit
4bc4b63e0fcf5389457db5a36de643fe75977c2a
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_jobd.clas.abap
ravishankarojha/abapGit
4bc4b63e0fcf5389457db5a36de643fe75977c2a
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_jobd DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. PROTECTED SECTION. PRIVATE SECTION. TYPES: ty_jd_name TYPE c LENGTH 32. ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_JOBD IMPLEMENTATION. METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lo_job_definition TYPE REF TO object, lv_name TYPE c LENGTH 32. lv_name = ms_item-obj_name. TRY. CREATE OBJECT lo_job_definition TYPE ('CL_JR_JOB_DEFINITION') EXPORTING im_jd_name = lv_name. CALL METHOD lo_job_definition->('DELETE_JD'). CATCH cx_root. zcx_abapgit_exception=>raise( |Error deleting JOBD| ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lr_job_definition TYPE REF TO data, lo_job_definition TYPE REF TO object, lv_name TYPE ty_jd_name. FIELD-SYMBOLS: <lg_job_definition> TYPE any, <lg_field> TYPE any. lv_name = ms_item-obj_name. TRY. CREATE DATA lr_job_definition TYPE ('CL_JR_JOB_DEFINITION=>TY_JOB_DEFINITION'). ASSIGN lr_job_definition->* TO <lg_job_definition>. ASSERT sy-subrc = 0. io_xml->read( EXPORTING iv_name = 'JOBD' CHANGING cg_data = <lg_job_definition> ). CREATE OBJECT lo_job_definition TYPE ('CL_JR_JOB_DEFINITION') EXPORTING im_jd_name = lv_name. ASSIGN COMPONENT 'JDPACKAGE' OF STRUCTURE <lg_job_definition> TO <lg_field>. <lg_field> = iv_package. CALL METHOD lo_job_definition->('CREATE_JD') EXPORTING im_jd_attributes = <lg_job_definition>. CATCH cx_root. zcx_abapgit_exception=>raise( |Error deserializing JOBD| ). ENDTRY. zcl_abapgit_objects_activation=>add_item( ms_item ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_name TYPE ty_jd_name. lv_name = ms_item-obj_name. TRY. CALL METHOD ('CL_JR_JD_MANAGER')=>('CHECK_JD_EXISTENCE') EXPORTING im_jd_name = lv_name IMPORTING ex_is_existing = rv_bool. CATCH cx_root. zcx_abapgit_exception=>raise( |JOBD not supported| ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. DATA: ls_meta TYPE zif_abapgit_definitions=>ty_metadata. ls_meta = get_metadata( ). IF ls_meta-late_deser = abap_true. APPEND zif_abapgit_object=>gc_step_id-late TO rt_steps. ELSEIF ls_meta-ddic = abap_true. APPEND zif_abapgit_object=>gc_step_id-ddic TO rt_steps. ELSE. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-delete_tadir = abap_true. ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. DATA: lv_obj_name TYPE e071-obj_name. lv_obj_name = ms_item-obj_name. CALL FUNCTION 'TR_OBJECT_JUMP_TO_TOOL' EXPORTING iv_pgmid = 'R3TR' iv_object = ms_item-obj_type iv_obj_name = lv_obj_name iv_action = 'SHOW' EXCEPTIONS jump_not_possible = 1 OTHERS = 2. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Error from TR_OBJECT_JUMP_TO_TOOL, JOBD| ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lr_job_definition TYPE REF TO data, lo_job_definition TYPE REF TO object, lv_name TYPE ty_jd_name. FIELD-SYMBOLS: <lg_job_definition> TYPE any, <lg_field> TYPE any. lv_name = ms_item-obj_name. TRY. CREATE DATA lr_job_definition TYPE ('CL_JR_JOB_DEFINITION=>TY_JOB_DEFINITION'). ASSIGN lr_job_definition->* TO <lg_job_definition>. ASSERT sy-subrc = 0. CREATE OBJECT lo_job_definition TYPE ('CL_JR_JOB_DEFINITION') EXPORTING im_jd_name = lv_name. CALL METHOD lo_job_definition->('GET_JD_ATTRIBUTES') IMPORTING ex_jd_attributes = <lg_job_definition>. ASSIGN COMPONENT 'JDPACKAGE' OF STRUCTURE <lg_job_definition> TO <lg_field>. CLEAR <lg_field>. ASSIGN COMPONENT 'BTCJOB_USER' OF STRUCTURE <lg_job_definition> TO <lg_field>. CLEAR <lg_field>. ASSIGN COMPONENT 'OWNER' OF STRUCTURE <lg_job_definition> TO <lg_field>. CLEAR <lg_field>. ASSIGN COMPONENT 'CREATED_DATE' OF STRUCTURE <lg_job_definition> TO <lg_field>. CLEAR <lg_field>. ASSIGN COMPONENT 'CREATED_TIME' OF STRUCTURE <lg_job_definition> TO <lg_field>. CLEAR <lg_field>. ASSIGN COMPONENT 'CHANGED_DATE' OF STRUCTURE <lg_job_definition> TO <lg_field>. CLEAR <lg_field>. ASSIGN COMPONENT 'CHANGED_TIME' OF STRUCTURE <lg_job_definition> TO <lg_field>. CLEAR <lg_field>. io_xml->add( iv_name = 'JOBD' ig_data = <lg_job_definition> ). CATCH cx_root. zcx_abapgit_exception=>raise( |Error serializing JOBD| ). ENDTRY. ENDMETHOD. ENDCLASS.
24.416667
96
0.656907
c89e4c136ac17a755def0571ff3061d36ceb6000
7,244
abap
ABAP
src/zcl_abapgit_folder_logic.clas.testclasses.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
src/zcl_abapgit_folder_logic.clas.testclasses.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
src/zcl_abapgit_folder_logic.clas.testclasses.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
CLASS ltcl_folder_logic_helper DEFINITION FOR TESTING FINAL. PUBLIC SECTION. CLASS-METHODS: test IMPORTING iv_starting TYPE string iv_top TYPE devclass iv_logic TYPE string iv_package TYPE devclass iv_path TYPE string RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_folder_logic_helper IMPLEMENTATION. METHOD test. DATA: lv_path TYPE string, lv_package TYPE devclass, lo_dot TYPE REF TO zcl_abapgit_dot_abapgit. lo_dot = zcl_abapgit_dot_abapgit=>build_default( ). lo_dot->set_starting_folder( iv_starting ). lo_dot->set_folder_logic( iv_logic ). lv_package = zcl_abapgit_folder_logic=>path_to_package( iv_top = iv_top io_dot = lo_dot iv_path = iv_path ). lv_path = zcl_abapgit_folder_logic=>package_to_path( iv_top = iv_top io_dot = lo_dot iv_package = iv_package ). cl_abap_unit_assert=>assert_equals( act = lv_package exp = iv_package ). cl_abap_unit_assert=>assert_equals( act = lv_path exp = iv_path ). ENDMETHOD. ENDCLASS. CLASS ltcl_folder_logic DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PUBLIC SECTION. INTERFACES: zif_abapgit_sap_package. PRIVATE SECTION. CONSTANTS: c_top TYPE devclass VALUE '$TOP', c_src TYPE string VALUE '/src/'. METHODS: setup, teardown, prefix1 FOR TESTING RAISING zcx_abapgit_exception, prefix2 FOR TESTING RAISING zcx_abapgit_exception, prefix_error1 FOR TESTING RAISING zcx_abapgit_exception, full1 FOR TESTING RAISING zcx_abapgit_exception, full2 FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. "ltcl_convert DEFINITION CLASS ltcl_folder_logic IMPLEMENTATION. METHOD zif_abapgit_sap_package~list_subpackages. RETURN. ENDMETHOD. METHOD zif_abapgit_sap_package~list_superpackages. RETURN. ENDMETHOD. METHOD zif_abapgit_sap_package~read_parent. rv_parentcl = '$TOP'. ENDMETHOD. METHOD zif_abapgit_sap_package~create_child. RETURN. ENDMETHOD. METHOD zif_abapgit_sap_package~exists. rv_bool = abap_true. ENDMETHOD. METHOD setup. FIELD-SYMBOLS: <ls_inject> LIKE LINE OF zcl_abapgit_sap_package=>gt_injected. CLEAR zcl_abapgit_sap_package=>gt_injected. APPEND INITIAL LINE TO zcl_abapgit_sap_package=>gt_injected ASSIGNING <ls_inject>. <ls_inject>-package = '$TOP'. <ls_inject>-object = me. APPEND INITIAL LINE TO zcl_abapgit_sap_package=>gt_injected ASSIGNING <ls_inject>. <ls_inject>-package = '$TOP_FOO'. <ls_inject>-object = me. APPEND INITIAL LINE TO zcl_abapgit_sap_package=>gt_injected ASSIGNING <ls_inject>. <ls_inject>-package = '$FOOBAR'. <ls_inject>-object = me. ENDMETHOD. METHOD teardown. CLEAR zcl_abapgit_sap_package=>gt_injected. ENDMETHOD. METHOD prefix1. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-prefix iv_package = c_top iv_path = c_src ). ENDMETHOD. METHOD prefix2. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-prefix iv_package = '$TOP_FOO' iv_path = '/src/foo/' ). ENDMETHOD. METHOD prefix_error1. * PREFIX mode, top package is $TOP, so all subpackages should be named $TOP_something TRY. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-prefix iv_package = '$FOOBAR' iv_path = '/src/' ). cl_abap_unit_assert=>fail( 'Error expected' ). CATCH zcx_abapgit_exception ##NO_HANDLER. ENDTRY. ENDMETHOD. METHOD full1. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-full iv_package = c_top iv_path = c_src ). ENDMETHOD. METHOD full2. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-full iv_package = '$TOP_FOO' iv_path = '/src/top_foo/' ). ENDMETHOD. ENDCLASS. CLASS ltcl_folder_logic_namespaces DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PUBLIC SECTION. INTERFACES: zif_abapgit_sap_package. PRIVATE SECTION. CONSTANTS: c_top TYPE devclass VALUE '/TEST/TOOLS', c_src TYPE string VALUE '/src/'. METHODS: setup, teardown, prefix1 FOR TESTING RAISING zcx_abapgit_exception, prefix2 FOR TESTING RAISING zcx_abapgit_exception, full1 FOR TESTING RAISING zcx_abapgit_exception, full2 FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. "ltcl_convert DEFINITION CLASS ltcl_folder_logic_namespaces IMPLEMENTATION. METHOD zif_abapgit_sap_package~list_subpackages. RETURN. ENDMETHOD. METHOD zif_abapgit_sap_package~list_superpackages. RETURN. ENDMETHOD. METHOD zif_abapgit_sap_package~read_parent. rv_parentcl = c_top. ENDMETHOD. METHOD zif_abapgit_sap_package~create_child. RETURN. ENDMETHOD. METHOD zif_abapgit_sap_package~exists. rv_bool = abap_true. ENDMETHOD. METHOD setup. FIELD-SYMBOLS: <ls_inject> LIKE LINE OF zcl_abapgit_sap_package=>gt_injected. CLEAR zcl_abapgit_sap_package=>gt_injected. APPEND INITIAL LINE TO zcl_abapgit_sap_package=>gt_injected ASSIGNING <ls_inject>. <ls_inject>-package = '/TEST/TOOLS'. <ls_inject>-object = me. APPEND INITIAL LINE TO zcl_abapgit_sap_package=>gt_injected ASSIGNING <ls_inject>. <ls_inject>-package = '/TEST/T1'. <ls_inject>-object = me. APPEND INITIAL LINE TO zcl_abapgit_sap_package=>gt_injected ASSIGNING <ls_inject>. <ls_inject>-package = '/TEST/TOOLS_T1'. <ls_inject>-object = me. ENDMETHOD. METHOD teardown. CLEAR zcl_abapgit_sap_package=>gt_injected. ENDMETHOD. METHOD prefix1. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-prefix iv_package = c_top iv_path = c_src ). ENDMETHOD. METHOD prefix2. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-prefix iv_package = '/TEST/TOOLS_T1' iv_path = '/src/t1/' ). ENDMETHOD. METHOD full1. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-full iv_package = c_top iv_path = c_src ). ENDMETHOD. METHOD full2. ltcl_folder_logic_helper=>test( iv_starting = c_src iv_top = c_top iv_logic = zif_abapgit_dot_abapgit=>c_folder_logic-full iv_package = '/TEST/T1' iv_path = '/src/#test#t1/' ). ENDMETHOD. ENDCLASS.
27.233083
99
0.686637
c89ee7e4b2d9d1e9b21f1ecb5a1ebdaf164e8a17
17,665
abap
ABAP
src/objects/zcl_abapgit_object_devc.clas.abap
hardyp/abapGit
a1dd9fd5ebfd062b342c43046e66dcc1f52753f2
[ "MIT" ]
1
2020-01-31T16:40:50.000Z
2020-01-31T16:40:50.000Z
src/objects/zcl_abapgit_object_devc.clas.abap
hardyp/abapGit
a1dd9fd5ebfd062b342c43046e66dcc1f52753f2
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_devc.clas.abap
hardyp/abapGit
a1dd9fd5ebfd062b342c43046e66dcc1f52753f2
[ "MIT" ]
1
2020-01-31T16:23:43.000Z
2020-01-31T16:23:43.000Z
CLASS zcl_abapgit_object_devc DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES: zif_abapgit_object. ALIASES: mo_files FOR zif_abapgit_object~mo_files. METHODS: constructor IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item iv_language TYPE spras. PROTECTED SECTION. PRIVATE SECTION. METHODS: get_package RETURNING VALUE(ri_package) TYPE REF TO if_package RAISING zcx_abapgit_exception, update_pinf_usages IMPORTING ii_package TYPE REF TO if_package it_usage_data TYPE scomppdata RAISING zcx_abapgit_exception, set_lock IMPORTING ii_package TYPE REF TO if_package iv_lock TYPE abap_bool RAISING zcx_abapgit_exception. DATA: mv_local_devclass TYPE devclass. ENDCLASS. CLASS zcl_abapgit_object_devc IMPLEMENTATION. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). mv_local_devclass = is_item-devclass. ENDMETHOD. METHOD get_package. IF me->zif_abapgit_object~exists( ) = abap_true. cl_package_factory=>load_package( EXPORTING i_package_name = mv_local_devclass i_force_reload = abap_true IMPORTING e_package = ri_package EXCEPTIONS object_not_existing = 1 unexpected_error = 2 intern_err = 3 no_access = 4 object_locked_and_modified = 5 OTHERS = 6 ). IF sy-subrc = 1. RETURN. ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDIF. ENDMETHOD. METHOD set_lock. DATA: lv_changeable TYPE abap_bool. ii_package->get_changeable( IMPORTING e_changeable = lv_changeable ). IF lv_changeable <> iv_lock. ii_package->set_changeable( EXPORTING i_changeable = iv_lock EXCEPTIONS object_locked_by_other_user = 1 permission_failure = 2 object_already_changeable = 3 object_already_unlocked = 4 object_just_created = 5 object_deleted = 6 object_modified = 7 object_not_existing = 8 object_invalid = 9 unexpected_error = 10 OTHERS = 11 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDIF. ii_package->set_permissions_changeable( EXPORTING i_changeable = iv_lock * downport, does not exist in 7.30. Let's see if we can get along without it * i_suppress_dialog = abap_true EXCEPTIONS object_already_changeable = 1 object_already_unlocked = 2 object_locked_by_other_user = 3 object_modified = 4 object_just_created = 5 object_deleted = 6 permission_failure = 7 object_invalid = 8 unexpected_error = 9 OTHERS = 10 ). IF ( sy-subrc = 1 AND iv_lock = abap_true ) OR ( sy-subrc = 2 AND iv_lock = abap_false ). " There's no getter to find out beforehand... ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD update_pinf_usages. DATA: lt_current_permissions TYPE tpak_permission_to_use_list, li_usage TYPE REF TO if_package_permission_to_use, ls_data_sign TYPE scomppsign, ls_add_permission_data TYPE pkgpermdat, lt_handled TYPE SORTED TABLE OF i WITH UNIQUE KEY table_line. FIELD-SYMBOLS: <ls_usage_data> LIKE LINE OF it_usage_data. " Get the current permissions ii_package->get_permissions_to_use( IMPORTING e_permissions = lt_current_permissions EXCEPTIONS object_invalid = 1 unexpected_error = 2 OTHERS = 3 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ls_data_sign-err_sever = abap_true. " New permissions LOOP AT it_usage_data ASSIGNING <ls_usage_data>. READ TABLE lt_current_permissions WITH KEY table_line->package_interface_name = <ls_usage_data>-intf_name INTO li_usage. IF sy-subrc = 0 AND li_usage IS BOUND. INSERT sy-tabix INTO TABLE lt_handled. " Permission already exists, update attributes li_usage->set_all_attributes( EXPORTING i_permission_data = <ls_usage_data> i_data_sign = ls_data_sign EXCEPTIONS object_not_changeable = 1 object_invalid = 2 intern_err = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ELSE. " Permission does not exist yet, add it MOVE-CORRESPONDING <ls_usage_data> TO ls_add_permission_data. ii_package->add_permission_to_use( EXPORTING i_pkg_permission_data = ls_add_permission_data EXCEPTIONS object_not_changeable = 1 object_access_error = 2 object_already_existing = 3 object_invalid = 4 unexpected_error = 5 OTHERS = 6 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDIF. FREE li_usage. ENDLOOP. " Delete missing usages LOOP AT lt_current_permissions INTO li_usage. READ TABLE lt_handled WITH TABLE KEY table_line = sy-tabix TRANSPORTING NO FIELDS. IF sy-subrc = 0. CONTINUE. ENDIF. li_usage->delete( EXCEPTIONS object_not_changeable = 1 object_invalid = 2 * deletion_not_allowed = 3 downport, does not exist in 7.30 intern_err = 4 OTHERS = 5 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = get_package( )->changed_by. ENDMETHOD. METHOD zif_abapgit_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null. ENDMETHOD. METHOD zif_abapgit_object~delete. " Package deletion is a bit tricky. A package can only be deleted if there are no objects " contained in it. This includes subpackages, so first the leaf packages need to be deleted. " Unfortunately deleted objects that are still contained in an unreleased transport request " also count towards the contained objects counter. " -> Package deletion is currently not supported by abapGit RETURN. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: li_package TYPE REF TO if_package, ls_package_data TYPE scompkdtln, ls_data_sign TYPE scompksign, lt_usage_data TYPE scomppdata, ls_save_sign TYPE paksavsign. FIELD-SYMBOLS: <ls_usage_data> TYPE scomppdtln. mv_local_devclass = iv_package. io_xml->read( EXPORTING iv_name = 'DEVC' CHANGING cg_data = ls_package_data ). li_package = get_package( ). " Swap out repository package name with the local installation package name ls_package_data-devclass = mv_local_devclass. ls_package_data-pdevclass = li_package->transport_layer. " Parent package is not changed. Assume the folder logic already created the package and set " the hierarchy before. CLEAR ls_package_data-parentcl. ls_data_sign-ctext = abap_true. * ls_data_sign-korrflag = abap_true. ls_data_sign-as4user = abap_true. ls_data_sign-pdevclass = abap_true. * ls_data_sign-dlvunit = abap_true. ls_data_sign-comp_posid = abap_true. ls_data_sign-component = abap_true. * ls_data_sign-parentcl = abap_true. " No parent package change here ls_data_sign-perminher = abap_true. ls_data_sign-intfprefx = abap_true. ls_data_sign-packtype = abap_true. ls_data_sign-restricted = abap_true. ls_data_sign-mainpack = abap_true. ls_data_sign-srv_check = abap_true. ls_data_sign-cli_check = abap_true. ls_data_sign-ext_alias = abap_true. ls_data_sign-project_guid = abap_true. ls_data_sign-project_id = abap_true. ls_data_sign-project_passdown = abap_true. IF ls_package_data-ctext IS INITIAL. ls_package_data-ctext = mv_local_devclass. ENDIF. IF ls_package_data-dlvunit IS INITIAL. ls_package_data-dlvunit = 'HOME'. ENDIF. ls_package_data-as4user = cl_abap_syst=>get_user_name( ). IF li_package IS BOUND. " Package already exists, change it set_lock( ii_package = li_package iv_lock = abap_true ). li_package->set_all_attributes( EXPORTING i_package_data = ls_package_data i_data_sign = ls_data_sign EXCEPTIONS object_not_changeable = 1 object_deleted = 2 object_invalid = 3 short_text_missing = 4 author_not_existing = 5 local_package = 6 software_component_invalid = 7 layer_invalid = 8 korrflag_invalid = 9 component_not_existing = 10 component_missing = 11 authorize_failure = 12 prefix_in_use = 13 unexpected_error = 14 intern_err = 15 * wrong_mainpack_value = 16 downport, does not exist in 7.30 * superpackage_invalid = 17 downport, does not exist in 7.30 OTHERS = 18 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. * " If the application component was cleared SET_ALL_ATTRIBUTES doesn't change it * IF ls_package_data-component IS INITIAL AND li_package->application_component IS NOT INITIAL. * * ENDIF. ELSE. " Package does not exist yet, create it " This shouldn't really happen, because the folder logic initially creates the packages. cl_package_factory=>create_new_package( IMPORTING e_package = li_package CHANGING c_package_data = ls_package_data EXCEPTIONS object_already_existing = 1 object_just_created = 2 not_authorized = 3 wrong_name_prefix = 4 undefined_name = 5 reserved_local_name = 6 invalid_package_name = 7 short_text_missing = 8 software_component_invalid = 9 layer_invalid = 10 author_not_existing = 11 component_not_existing = 12 component_missing = 13 prefix_in_use = 14 unexpected_error = 15 intern_err = 16 no_access = 17 * invalid_translation_depth = 18 downport, does not exist in 7.30 * wrong_mainpack_value = 19 downport, does not exist in 7.30 * superpackage_invalid = 20 downport, does not exist in 7.30 * error_in_cts_checks = 21 downport, does not exist in 7.31 OTHERS = 22 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDIF. " Load package interface usages TRY. io_xml->read( EXPORTING iv_name = 'PERMISSION' CHANGING cg_data = lt_usage_data ). CATCH zcx_abapgit_exception ##NO_HANDLER. " No permissions saved ENDTRY. LOOP AT lt_usage_data ASSIGNING <ls_usage_data>. <ls_usage_data>-client_pak = mv_local_devclass. ENDLOOP. update_pinf_usages( ii_package = li_package it_usage_data = lt_usage_data ). ls_save_sign-pack = ls_save_sign-permis = ls_save_sign-elems = ls_save_sign-interf = abap_true. li_package->save_generic( EXPORTING i_save_sign = ls_save_sign EXCEPTIONS cancelled_in_corr = 1 permission_failure = 2 object_not_changeable = 3 object_invalid = 4 OTHERS = 5 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. set_lock( ii_package = li_package iv_lock = abap_false ). ENDMETHOD. METHOD zif_abapgit_object~exists. " Check remote package if deserialize has not been called before this IF mv_local_devclass IS INITIAL. rv_bool = abap_false. ELSE. cl_package_helper=>check_package_existence( EXPORTING i_package_name = mv_local_devclass IMPORTING e_package_exists = rv_bool EXCEPTIONS intern_err = 1 OTHERS = 2 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. METHOD zif_abapgit_object~jump. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = ms_item-obj_name object_type = 'DEVC' in_new_window = abap_true EXCEPTIONS not_executed = 1 invalid_object_type = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_package_data TYPE scompkdtln, li_package TYPE REF TO if_package, lt_intf_usages TYPE tpak_permission_to_use_list, lt_usage_data TYPE scomppdata, ls_usage_data TYPE scomppdtln, li_usage TYPE REF TO if_package_permission_to_use. FIELD-SYMBOLS: <lg_field> TYPE any. li_package = get_package( ). IF li_package IS NOT BOUND. zcx_abapgit_exception=>raise( |Could not find package to serialize.| ). ENDIF. li_package->get_all_attributes( IMPORTING e_package_data = ls_package_data EXCEPTIONS object_invalid = 1 package_deleted = 2 intern_err = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. CLEAR: ls_package_data-devclass, ls_package_data-parentcl. " Clear administrative data to prevent diffs CLEAR: ls_package_data-created_by, ls_package_data-created_on, ls_package_data-changed_by, ls_package_data-changed_on, ls_package_data-as4user. " Clear text descriptions that might be localized CLEAR: ls_package_data-comp_text, ls_package_data-dlvu_text, ls_package_data-layer_text. ASSIGN COMPONENT 'TRANSLATION_DEPTH_TEXT' OF STRUCTURE ls_package_data TO <lg_field>. IF sy-subrc = 0. CLEAR: <lg_field>. ENDIF. ASSIGN COMPONENT 'TRANSLATION_GRAPH_DEPTH_TEXT' OF STRUCTURE ls_package_data TO <lg_field>. IF sy-subrc = 0. CLEAR: <lg_field>. ENDIF. " Clear things related to local installation package CLEAR: ls_package_data-namespace, ls_package_data-dlvunit, ls_package_data-pdevclass. " Not usable on customer systems ASSIGN COMPONENT 'TRANSLATION_DEPTH' OF STRUCTURE ls_package_data TO <lg_field>. IF sy-subrc = 0. CLEAR: <lg_field>. ENDIF. ASSIGN COMPONENT 'TRANSLATION_GRAPH_DEPTH' OF STRUCTURE ls_package_data TO <lg_field>. IF sy-subrc = 0. CLEAR: <lg_field>. ENDIF. CLEAR: ls_package_data-korrflag. io_xml->add( iv_name = 'DEVC' ig_data = ls_package_data ). " Save package interface usages li_package->get_permissions_to_use( IMPORTING e_permissions = lt_intf_usages EXCEPTIONS object_invalid = 1 unexpected_error = 2 OTHERS = 3 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. LOOP AT lt_intf_usages INTO li_usage. li_usage->get_all_attributes( IMPORTING e_permission_data = ls_usage_data EXCEPTIONS object_invalid = 1 intern_err = 2 OTHERS = 3 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. CLEAR: ls_usage_data-pack_name, ls_usage_data-client_pak. APPEND ls_usage_data TO lt_usage_data. ENDLOOP. IF lt_usage_data IS NOT INITIAL. io_xml->add( iv_name = 'PERMISSION' ig_data = lt_usage_data ). ENDIF. ENDMETHOD. ENDCLASS.
32.235401
100
0.600396
c8a1ffeee1d86c9377b9ae9395f22c7fe7bef8f8
19,023
abap
ABAP
src/ui/zcl_abapgit_services_repo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_services_repo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_services_repo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_services_repo DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS new_online IMPORTING !is_repo_params TYPE zif_abapgit_services_repo=>ty_repo_params RETURNING VALUE(ro_repo) TYPE REF TO zcl_abapgit_repo_online RAISING zcx_abapgit_exception. CLASS-METHODS refresh IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . CLASS-METHODS remove IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception. CLASS-METHODS purge IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception. CLASS-METHODS new_offline RAISING zcx_abapgit_exception. CLASS-METHODS remote_attach IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception. CLASS-METHODS remote_detach IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception. CLASS-METHODS remote_change IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception. CLASS-METHODS refresh_local_checksums IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception. CLASS-METHODS toggle_favorite IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . CLASS-METHODS transport_to_branch IMPORTING !iv_repository_key TYPE zif_abapgit_persistence=>ty_value RAISING zcx_abapgit_exception. CLASS-METHODS gui_deserialize IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. CLASS-METHODS popup_overwrite CHANGING !ct_overwrite TYPE zif_abapgit_definitions=>ty_overwrite_tt RAISING zcx_abapgit_exception. CLASS-METHODS popup_package_overwrite CHANGING !ct_overwrite TYPE zif_abapgit_definitions=>ty_overwrite_tt RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_SERVICES_REPO IMPLEMENTATION. METHOD gui_deserialize. DATA: ls_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks, lt_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt, lt_dependencies TYPE zif_abapgit_apack_definitions=>tt_dependencies. * find troublesome objects ls_checks = io_repo->deserialize_checks( ). * and let the user decide what to do TRY. popup_overwrite( CHANGING ct_overwrite = ls_checks-overwrite ). popup_package_overwrite( CHANGING ct_overwrite = ls_checks-warning_package ). IF ls_checks-requirements-met = zif_abapgit_definitions=>gc_no. lt_requirements = io_repo->get_dot_abapgit( )->get_data( )-requirements. zcl_abapgit_requirement_helper=>requirements_popup( lt_requirements ). ls_checks-requirements-decision = zif_abapgit_definitions=>gc_yes. ENDIF. IF ls_checks-dependencies-met = zif_abapgit_definitions=>gc_no. lt_dependencies = io_repo->get_dot_apack( )->get_manifest_descriptor( )-dependencies. zcl_abapgit_apack_helper=>dependencies_popup( lt_dependencies ). ENDIF. IF ls_checks-transport-required = abap_true. ls_checks-transport-transport = zcl_abapgit_ui_factory=>get_popups( )->popup_transport_request( is_transport_type = ls_checks-transport-type ). ENDIF. CATCH zcx_abapgit_cancel. RETURN. ENDTRY. * and pass decisions to deserialize io_repo->deserialize( is_checks = ls_checks ii_log = io_repo->create_new_log( 'Pull Log' ) ). ENDMETHOD. METHOD new_offline. DATA: ls_popup TYPE zif_abapgit_popups=>ty_popup, lo_repo TYPE REF TO zcl_abapgit_repo, lo_repo_offline TYPE REF TO zcl_abapgit_repo_offline, li_repo_srv TYPE REF TO zif_abapgit_repo_srv, lv_reason TYPE string. ls_popup = zcl_abapgit_ui_factory=>get_popups( )->repo_new_offline( ). IF ls_popup-cancel = abap_true. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. " make sure package is not already in use for a different repository " 702: chaining calls with exp&imp parameters causes syntax error li_repo_srv = zcl_abapgit_repo_srv=>get_instance( ). li_repo_srv->get_repo_from_package( EXPORTING iv_package = ls_popup-package IMPORTING eo_repo = lo_repo ev_reason = lv_reason ). IF lo_repo IS BOUND. MESSAGE lv_reason TYPE 'S'. ELSE. " create new repo and add to favorites lo_repo_offline = zcl_abapgit_repo_srv=>get_instance( )->new_offline( iv_url = ls_popup-url iv_package = ls_popup-package iv_folder_logic = ls_popup-folder_logic iv_master_lang_only = ls_popup-master_lang_only ). lo_repo_offline->rebuild_local_checksums( ). lo_repo ?= lo_repo_offline. toggle_favorite( lo_repo->get_key( ) ). ENDIF. " Set default repo for user zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lo_repo->get_key( ) ). COMMIT WORK AND WAIT. ENDMETHOD. METHOD new_online. DATA: lo_repo TYPE REF TO zcl_abapgit_repo, li_repo_srv TYPE REF TO zif_abapgit_repo_srv, lv_reason TYPE string. " make sure package is not already in use for a different repository " 702: chaining calls with exp&imp parameters causes syntax error li_repo_srv = zcl_abapgit_repo_srv=>get_instance( ). li_repo_srv->get_repo_from_package( EXPORTING iv_package = is_repo_params-package iv_ign_subpkg = is_repo_params-ignore_subpackages IMPORTING eo_repo = lo_repo ev_reason = lv_reason ). IF lo_repo IS BOUND. zcx_abapgit_exception=>raise( lv_reason ). ENDIF. ro_repo = zcl_abapgit_repo_srv=>get_instance( )->new_online( iv_url = is_repo_params-url iv_branch_name = is_repo_params-branch_name iv_package = is_repo_params-package iv_display_name = is_repo_params-display_name iv_folder_logic = is_repo_params-folder_logic iv_ign_subpkg = is_repo_params-ignore_subpackages iv_master_lang_only = is_repo_params-master_lang_only ). toggle_favorite( ro_repo->get_key( ) ). " Set default repo for user zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( ro_repo->get_key( ) ). COMMIT WORK. ENDMETHOD. METHOD popup_overwrite. DATA: lt_columns TYPE zif_abapgit_definitions=>ty_alv_column_tt, lt_selected LIKE ct_overwrite, li_popups TYPE REF TO zif_abapgit_popups. FIELD-SYMBOLS: <ls_overwrite> LIKE LINE OF ct_overwrite, <ls_column> TYPE zif_abapgit_definitions=>ty_alv_column. IF lines( ct_overwrite ) = 0. RETURN. ENDIF. APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>. <ls_column>-name = 'OBJ_TYPE'. APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>. <ls_column>-name = 'OBJ_NAME'. li_popups = zcl_abapgit_ui_factory=>get_popups( ). li_popups->popup_to_select_from_list( EXPORTING it_list = ct_overwrite iv_header_text = |The following objects have been modified (or deleted) locally.| && | Select the objects which should be overwritten (or recreated).| iv_select_column_text = 'Overwrite?' it_columns_to_display = lt_columns IMPORTING et_list = lt_selected ). LOOP AT ct_overwrite ASSIGNING <ls_overwrite>. READ TABLE lt_selected WITH TABLE KEY object_type_and_name COMPONENTS obj_type = <ls_overwrite>-obj_type obj_name = <ls_overwrite>-obj_name TRANSPORTING NO FIELDS. IF sy-subrc = 0. <ls_overwrite>-decision = 'Y'. ELSE. <ls_overwrite>-decision = 'N'. ENDIF. ENDLOOP. ENDMETHOD. METHOD popup_package_overwrite. DATA: lt_columns TYPE zif_abapgit_definitions=>ty_alv_column_tt, lt_selected LIKE ct_overwrite, li_popups TYPE REF TO zif_abapgit_popups. FIELD-SYMBOLS: <ls_overwrite> LIKE LINE OF ct_overwrite, <ls_column> TYPE zif_abapgit_definitions=>ty_alv_column. IF lines( ct_overwrite ) = 0. RETURN. ENDIF. APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>. <ls_column>-name = 'OBJ_TYPE'. APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>. <ls_column>-name = 'OBJ_NAME'. APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>. <ls_column>-name = 'DEVCLASS'. li_popups = zcl_abapgit_ui_factory=>get_popups( ). li_popups->popup_to_select_from_list( EXPORTING it_list = ct_overwrite iv_header_text = |The following objects have been created in other packages.| && | Select the objects which should be overwritten.| iv_select_column_text = |Overwrite?| it_columns_to_display = lt_columns IMPORTING et_list = lt_selected ). LOOP AT ct_overwrite ASSIGNING <ls_overwrite>. READ TABLE lt_selected WITH TABLE KEY object_type_and_name COMPONENTS obj_type = <ls_overwrite>-obj_type obj_name = <ls_overwrite>-obj_name TRANSPORTING NO FIELDS. IF sy-subrc = 0. <ls_overwrite>-decision = 'Y'. ELSE. <ls_overwrite>-decision = 'N'. ENDIF. ENDLOOP. ENDMETHOD. METHOD purge. DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, lv_answer TYPE c LENGTH 1, lo_repo TYPE REF TO zcl_abapgit_repo, lv_package TYPE devclass, lv_question TYPE c LENGTH 100, ls_checks TYPE zif_abapgit_definitions=>ty_delete_checks. lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). lv_package = lo_repo->get_package( ). lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( lv_package ). IF lines( lt_tadir ) > 0. lv_question = |This will DELETE all objects in package { lv_package } ({ lines( lt_tadir ) } objects) from the system|. "#EC NOTEXT lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm( iv_titlebar = 'Uninstall' iv_text_question = lv_question iv_text_button_1 = 'Delete' iv_icon_button_1 = 'ICON_DELETE' iv_text_button_2 = 'Cancel' iv_icon_button_2 = 'ICON_CANCEL' iv_default_button = '2' iv_display_cancel_button = abap_false ). "#EC NOTEXT IF lv_answer = '2'. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. ENDIF. ls_checks = lo_repo->delete_checks( ). IF ls_checks-transport-required = abap_true. ls_checks-transport-transport = zcl_abapgit_ui_factory=>get_popups( )->popup_transport_request( ls_checks-transport-type ). ENDIF. zcl_abapgit_repo_srv=>get_instance( )->purge( io_repo = lo_repo is_checks = ls_checks ). COMMIT WORK. ENDMETHOD. METHOD refresh. zcl_abapgit_repo_srv=>get_instance( )->get( iv_key )->refresh( ). ENDMETHOD. METHOD refresh_local_checksums. DATA: lv_answer TYPE c, lv_question TYPE string, lo_repo TYPE REF TO zcl_abapgit_repo. IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-update_local_checksum ) = abap_false. zcx_abapgit_exception=>raise( 'Not authorized' ). ENDIF. lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). lv_question = 'This will rebuild and overwrite local repo checksums.'. IF lo_repo->is_offline( ) = abap_false. lv_question = lv_question && ' The logic: if local and remote file differs then:' && ' if remote branch is ahead then assume changes are remote,' && ' else (branches are equal) assume changes are local.' && ' This will lead to incorrect state for files changed on both sides.' && ' Please make sure you don''t have ones like that.'. ENDIF. lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm( iv_titlebar = 'Warning' iv_text_question = lv_question iv_text_button_1 = 'OK' iv_icon_button_1 = 'ICON_DELETE' iv_text_button_2 = 'Cancel' iv_icon_button_2 = 'ICON_CANCEL' iv_default_button = '2' iv_display_cancel_button = abap_false ). "#EC NOTEXT IF lv_answer = '2'. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. lo_repo->rebuild_local_checksums( ). COMMIT WORK AND WAIT. ENDMETHOD. METHOD remote_attach. DATA: ls_popup TYPE zif_abapgit_popups=>ty_popup, ls_loc TYPE zif_abapgit_persistence=>ty_repo-local_settings, lo_repo TYPE REF TO zcl_abapgit_repo_online. ls_loc = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key )->get_local_settings( ). ls_popup = zcl_abapgit_ui_factory=>get_popups( )->repo_popup( iv_title = 'Attach repo to remote ...' iv_url = '' iv_display_name = ls_loc-display_name iv_package = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key )->get_package( ) iv_freeze_package = abap_true ). IF ls_popup-cancel = abap_true. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. zcl_abapgit_repo_srv=>get_instance( )->get( iv_key )->switch_repo_type( iv_offline = abap_false ). lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). lo_repo->set_url( ls_popup-url ). lo_repo->set_branch_name( ls_popup-branch_name ). ls_loc = lo_repo->get_local_settings( ). " Just in case ... if switch affects LS state ls_loc-display_name = ls_popup-display_name. lo_repo->set_local_settings( ls_loc ). COMMIT WORK. ENDMETHOD. METHOD remote_change. DATA: ls_popup TYPE zif_abapgit_popups=>ty_popup, ls_loc TYPE zif_abapgit_persistence=>ty_repo-local_settings, lo_repo TYPE REF TO zcl_abapgit_repo_online. lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). ls_loc = lo_repo->get_local_settings( ). ls_popup = zcl_abapgit_ui_factory=>get_popups( )->repo_popup( iv_title = 'Change repo remote ...' iv_url = lo_repo->get_url( ) iv_package = lo_repo->get_package( ) iv_display_name = ls_loc-display_name iv_freeze_package = abap_true ). IF ls_popup-cancel = abap_true. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). lo_repo->set_url( ls_popup-url ). lo_repo->set_branch_name( ls_popup-branch_name ). ls_loc-display_name = ls_popup-display_name. lo_repo->set_local_settings( ls_loc ). COMMIT WORK. ENDMETHOD. METHOD remote_detach. DATA: lv_answer TYPE c LENGTH 1. lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm( iv_titlebar = 'Make repository OFF-line' iv_text_question = 'This will detach the repo from remote and make it OFF-line' iv_text_button_1 = 'Make OFF-line' iv_icon_button_1 = 'ICON_WF_UNLINK' iv_text_button_2 = 'Cancel' iv_icon_button_2 = 'ICON_CANCEL' iv_default_button = '2' iv_display_cancel_button = abap_false ). "#EC NOTEXT IF lv_answer = '2'. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. zcl_abapgit_repo_srv=>get_instance( )->get( iv_key )->switch_repo_type( iv_offline = abap_true ). COMMIT WORK. ENDMETHOD. METHOD remove. DATA: lv_answer TYPE c LENGTH 1, lo_repo TYPE REF TO zcl_abapgit_repo, lv_package TYPE devclass, lv_question TYPE c LENGTH 200. lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). lv_package = lo_repo->get_package( ). lv_question = |This will remove the repository reference to the package { lv_package }. All objects will safely remain in the system.|. lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm( iv_titlebar = 'Remove' iv_text_question = lv_question iv_text_button_1 = 'Remove' iv_icon_button_1 = 'ICON_WF_UNLINK' iv_text_button_2 = 'Cancel' iv_icon_button_2 = 'ICON_CANCEL' iv_default_button = '2' iv_display_cancel_button = abap_false ). "#EC NOTEXT IF lv_answer = '2'. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. zcl_abapgit_repo_srv=>get_instance( )->delete( lo_repo ). COMMIT WORK. ENDMETHOD. METHOD toggle_favorite. zcl_abapgit_persistence_user=>get_instance( )->toggle_favorite( iv_key ). ENDMETHOD. METHOD transport_to_branch. DATA: lo_repository TYPE REF TO zcl_abapgit_repo_online, lo_transport_to_branch TYPE REF TO zcl_abapgit_transport_2_branch, lt_transport_headers TYPE trwbo_request_headers, lt_transport_objects TYPE zif_abapgit_definitions=>ty_tadir_tt, ls_transport_to_branch TYPE zif_abapgit_definitions=>ty_transport_to_branch. IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-transport_to_branch ) = abap_false. zcx_abapgit_exception=>raise( 'Not authorized' ). ENDIF. lo_repository ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_repository_key ). lt_transport_headers = zcl_abapgit_ui_factory=>get_popups( )->popup_to_select_transports( ). lt_transport_objects = zcl_abapgit_transport=>to_tadir( lt_transport_headers ). IF lt_transport_objects IS INITIAL. zcx_abapgit_exception=>raise( 'Canceled or List of objects is empty ' ). ENDIF. ls_transport_to_branch = zcl_abapgit_ui_factory=>get_popups( )->popup_to_create_transp_branch( lt_transport_headers ). CREATE OBJECT lo_transport_to_branch. lo_transport_to_branch->create( io_repository = lo_repository is_transport_to_branch = ls_transport_to_branch it_transport_objects = lt_transport_objects ). ENDMETHOD. ENDCLASS.
33.026042
109
0.666088
c8a2ef1f08b3b750e9a0f8c19ad2fb9d951a64d0
27,776
abap
ABAP
src/repo/zcl_abapgit_repo.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
src/repo/zcl_abapgit_repo.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
15
2021-12-01T05:03:57.000Z
2022-03-01T05:04:02.000Z
src/repo/zcl_abapgit_repo.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_repo DEFINITION PUBLIC ABSTRACT CREATE PUBLIC . PUBLIC SECTION. DATA ms_data TYPE zif_abapgit_persistence=>ty_repo READ-ONLY. METHODS bind_listener IMPORTING !ii_listener TYPE REF TO zif_abapgit_repo_listener . METHODS deserialize_checks RETURNING VALUE(rs_checks) TYPE zif_abapgit_definitions=>ty_deserialize_checks RAISING zcx_abapgit_exception . METHODS delete_checks RETURNING VALUE(rs_checks) TYPE zif_abapgit_definitions=>ty_delete_checks RAISING zcx_abapgit_exception . METHODS constructor IMPORTING !is_data TYPE zif_abapgit_persistence=>ty_repo . METHODS get_key RETURNING VALUE(rv_key) TYPE zif_abapgit_persistence=>ty_value . METHODS get_name RETURNING VALUE(rv_name) TYPE string RAISING zcx_abapgit_exception . METHODS get_files_local IMPORTING !ii_log TYPE REF TO zif_abapgit_log OPTIONAL RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_item_tt RAISING zcx_abapgit_exception . METHODS get_local_checksums_per_file RETURNING VALUE(rt_checksums) TYPE zif_abapgit_definitions=>ty_file_signatures_tt . METHODS get_files_remote RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt RAISING zcx_abapgit_exception . METHODS get_package RETURNING VALUE(rv_package) TYPE zif_abapgit_persistence=>ty_repo-package . METHODS get_dot_abapgit RETURNING VALUE(ro_dot_abapgit) TYPE REF TO zcl_abapgit_dot_abapgit . METHODS set_dot_abapgit IMPORTING !io_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit RAISING zcx_abapgit_exception . METHODS get_dot_apack RETURNING VALUE(ro_dot_apack) TYPE REF TO zcl_abapgit_apack_reader . METHODS get_data_config RETURNING VALUE(ri_config) TYPE REF TO zif_abapgit_data_config RAISING zcx_abapgit_exception . METHODS deserialize IMPORTING !is_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks !ii_log TYPE REF TO zif_abapgit_log RAISING zcx_abapgit_exception . METHODS refresh IMPORTING !iv_drop_cache TYPE abap_bool DEFAULT abap_false !iv_drop_log TYPE abap_bool DEFAULT abap_true PREFERRED PARAMETER iv_drop_cache RAISING zcx_abapgit_exception . METHODS update_local_checksums IMPORTING !it_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt RAISING zcx_abapgit_exception . METHODS rebuild_local_checksums RAISING zcx_abapgit_exception . METHODS find_remote_dot_abapgit RETURNING VALUE(ro_dot) TYPE REF TO zcl_abapgit_dot_abapgit RAISING zcx_abapgit_exception . METHODS is_offline RETURNING VALUE(rv_offline) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS set_files_remote IMPORTING !it_files TYPE zif_abapgit_definitions=>ty_files_tt . METHODS get_local_settings RETURNING VALUE(rs_settings) TYPE zif_abapgit_persistence=>ty_repo-local_settings . METHODS set_local_settings IMPORTING !is_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings RAISING zcx_abapgit_exception . METHODS has_remote_source ABSTRACT RETURNING VALUE(rv_yes) TYPE abap_bool . METHODS status IMPORTING !ii_log TYPE REF TO zif_abapgit_log OPTIONAL RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception . METHODS switch_repo_type IMPORTING !iv_offline TYPE abap_bool RAISING zcx_abapgit_exception . METHODS create_new_log IMPORTING !iv_title TYPE string OPTIONAL RETURNING VALUE(ri_log) TYPE REF TO zif_abapgit_log . METHODS get_log RETURNING VALUE(ri_log) TYPE REF TO zif_abapgit_log . METHODS refresh_local_object IMPORTING !iv_obj_type TYPE tadir-object !iv_obj_name TYPE tadir-obj_name RAISING zcx_abapgit_exception . METHODS refresh_local_objects RAISING zcx_abapgit_exception . METHODS reset_status . METHODS get_unsupported_objects_local RETURNING VALUE(rt_objects) TYPE zif_abapgit_definitions=>ty_items_tt RAISING zcx_abapgit_exception . PROTECTED SECTION. DATA mt_local TYPE zif_abapgit_definitions=>ty_files_item_tt . DATA mt_remote TYPE zif_abapgit_definitions=>ty_files_tt . DATA mv_request_local_refresh TYPE abap_bool . DATA mv_request_remote_refresh TYPE abap_bool . DATA mt_status TYPE zif_abapgit_definitions=>ty_results_tt . DATA mi_log TYPE REF TO zif_abapgit_log . DATA mi_listener TYPE REF TO zif_abapgit_repo_listener . DATA mo_apack_reader TYPE REF TO zcl_abapgit_apack_reader . DATA mi_data_config TYPE REF TO zif_abapgit_data_config . METHODS find_remote_dot_apack RETURNING VALUE(ro_dot) TYPE REF TO zcl_abapgit_apack_reader RAISING zcx_abapgit_exception . METHODS set_dot_apack IMPORTING !io_dot_apack TYPE REF TO zcl_abapgit_apack_reader RAISING zcx_abapgit_exception . METHODS set IMPORTING !it_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt OPTIONAL !iv_url TYPE zif_abapgit_persistence=>ty_repo-url OPTIONAL !iv_branch_name TYPE zif_abapgit_persistence=>ty_repo-branch_name OPTIONAL !iv_selected_commit TYPE zif_abapgit_persistence=>ty_repo-selected_commit OPTIONAL !iv_head_branch TYPE zif_abapgit_persistence=>ty_repo-head_branch OPTIONAL !iv_offline TYPE zif_abapgit_persistence=>ty_repo-offline OPTIONAL !is_dot_abapgit TYPE zif_abapgit_persistence=>ty_repo-dot_abapgit OPTIONAL !is_local_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings OPTIONAL !iv_deserialized_at TYPE zif_abapgit_persistence=>ty_repo-deserialized_at OPTIONAL !iv_deserialized_by TYPE zif_abapgit_persistence=>ty_repo-deserialized_by OPTIONAL !iv_switched_origin TYPE zif_abapgit_persistence=>ty_repo-switched_origin OPTIONAL RAISING zcx_abapgit_exception . METHODS reset_remote . PRIVATE SECTION. METHODS get_local_checksums RETURNING VALUE(rt_checksums) TYPE zif_abapgit_persistence=>ty_local_checksum_tt . METHODS notify_listener IMPORTING !is_change_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask RAISING zcx_abapgit_exception . METHODS update_last_deserialize RAISING zcx_abapgit_exception . METHODS check_for_restart . METHODS check_write_protect RAISING zcx_abapgit_exception . METHODS check_language RAISING zcx_abapgit_exception . METHODS remove_non_code_related_files CHANGING !ct_local_files TYPE zif_abapgit_definitions=>ty_files_item_tt . METHODS compare_with_remote_checksum IMPORTING !it_remote_files TYPE zif_abapgit_definitions=>ty_files_tt !is_local_file TYPE zif_abapgit_definitions=>ty_file_item-file CHANGING !cs_checksum TYPE zif_abapgit_persistence=>ty_local_checksum . ENDCLASS. CLASS zcl_abapgit_repo IMPLEMENTATION. METHOD bind_listener. mi_listener = ii_listener. ENDMETHOD. METHOD check_for_restart. CONSTANTS: lc_abapgit_prog TYPE progname VALUE `ZABAPGIT`. " If abapGit was used to update itself, then restart to avoid LOAD_PROGRAM_&_MISMATCH dumps " because abapGit code was changed at runtime IF zcl_abapgit_ui_factory=>get_gui_functions( )->gui_is_available( ) = abap_true AND zcl_abapgit_url=>is_abapgit_repo( ms_data-url ) = abap_true AND sy-batch = abap_false AND sy-cprog = lc_abapgit_prog. IF zcl_abapgit_persist_factory=>get_settings( )->read( )->get_show_default_repo( ) = abap_false. MESSAGE 'abapGit was updated and will restart itself' TYPE 'I'. ENDIF. SUBMIT (sy-cprog). ENDIF. ENDMETHOD. METHOD check_language. DATA lv_main_language TYPE spras. " assumes find_remote_dot_abapgit has been called before lv_main_language = get_dot_abapgit( )->get_main_language( ). IF lv_main_language <> sy-langu. zcx_abapgit_exception=>raise( |Current login language | && |'{ zcl_abapgit_convert=>conversion_exit_isola_output( sy-langu ) }'| && | does not match main language | && |'{ zcl_abapgit_convert=>conversion_exit_isola_output( lv_main_language ) }'.| && | Select 'Advanced' > 'Open in Main Language'| ). ENDIF. ENDMETHOD. METHOD check_write_protect. IF get_local_settings( )-write_protected = abap_true. zcx_abapgit_exception=>raise( 'Cannot deserialize. Local code is write-protected by repo config' ). ENDIF. ENDMETHOD. METHOD compare_with_remote_checksum. FIELD-SYMBOLS: <ls_remote_file> LIKE LINE OF it_remote_files, <ls_file_sig> LIKE LINE OF cs_checksum-files. READ TABLE it_remote_files ASSIGNING <ls_remote_file> WITH KEY path = is_local_file-path filename = is_local_file-filename BINARY SEARCH. IF sy-subrc <> 0. " Ignore new local ones RETURN. ENDIF. APPEND INITIAL LINE TO cs_checksum-files ASSIGNING <ls_file_sig>. MOVE-CORRESPONDING is_local_file TO <ls_file_sig>. " If hashes are equal -> local sha1 is OK " Else if R-branch is ahead -> assume changes were remote, state - local sha1 " Else (branches equal) -> assume changes were local, state - remote sha1 IF is_local_file-sha1 <> <ls_remote_file>-sha1. <ls_file_sig>-sha1 = <ls_remote_file>-sha1. ENDIF. ENDMETHOD. METHOD constructor. ASSERT NOT is_data-key IS INITIAL. ms_data = is_data. mv_request_remote_refresh = abap_true. ENDMETHOD. METHOD create_new_log. CREATE OBJECT mi_log TYPE zcl_abapgit_log. mi_log->set_title( iv_title ). ri_log = mi_log. ENDMETHOD. METHOD delete_checks. DATA: li_package TYPE REF TO zif_abapgit_sap_package. li_package = zcl_abapgit_factory=>get_sap_package( get_package( ) ). rs_checks-transport-required = li_package->are_changes_recorded_in_tr_req( ). ENDMETHOD. METHOD deserialize. DATA: lt_updated_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt, lt_result TYPE zif_abapgit_data_deserializer=>ty_results, lx_error TYPE REF TO zcx_abapgit_exception. find_remote_dot_abapgit( ). find_remote_dot_apack( ). check_write_protect( ). check_language( ). IF is_checks-requirements-met = zif_abapgit_definitions=>c_no AND is_checks-requirements-decision IS INITIAL. zcx_abapgit_exception=>raise( 'Requirements not met and undecided' ). ENDIF. IF is_checks-dependencies-met = zif_abapgit_definitions=>c_no. zcx_abapgit_exception=>raise( 'APACK dependencies not met' ). ENDIF. IF is_checks-transport-required = abap_true AND is_checks-transport-transport IS INITIAL. zcx_abapgit_exception=>raise( |No transport request was supplied| ). ENDIF. " Deserialize objects TRY. lt_updated_files = zcl_abapgit_objects=>deserialize( io_repo = me is_checks = is_checks ii_log = ii_log ). CATCH zcx_abapgit_exception INTO lx_error. * ensure to reset default transport request task zcl_abapgit_default_transport=>get_instance( )->reset( ). RAISE EXCEPTION lx_error. ENDTRY. APPEND get_dot_abapgit( )->get_signature( ) TO lt_updated_files. update_local_checksums( lt_updated_files ). " Deserialize data (no save to database, just test for now) lt_result = zcl_abapgit_data_factory=>get_deserializer( )->deserialize( ii_config = get_data_config( ) it_files = get_files_remote( ) ). CLEAR: mt_local. update_last_deserialize( ). reset_status( ). COMMIT WORK AND WAIT. check_for_restart( ). ENDMETHOD. METHOD deserialize_checks. DATA: lt_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt, lt_dependencies TYPE zif_abapgit_apack_definitions=>ty_dependencies. find_remote_dot_abapgit( ). find_remote_dot_apack( ). check_write_protect( ). check_language( ). rs_checks = zcl_abapgit_objects=>deserialize_checks( me ). lt_requirements = get_dot_abapgit( )->get_data( )-requirements. rs_checks-requirements-met = zcl_abapgit_requirement_helper=>is_requirements_met( lt_requirements ). lt_dependencies = get_dot_apack( )->get_manifest_descriptor( )-dependencies. rs_checks-dependencies-met = zcl_abapgit_apack_helper=>are_dependencies_met( lt_dependencies ). ENDMETHOD. METHOD find_remote_dot_abapgit. FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote. get_files_remote( ). READ TABLE mt_remote ASSIGNING <ls_remote> WITH KEY path = zif_abapgit_definitions=>c_root_dir filename = zif_abapgit_definitions=>c_dot_abapgit. IF sy-subrc = 0. ro_dot = zcl_abapgit_dot_abapgit=>deserialize( <ls_remote>-data ). set_dot_abapgit( ro_dot ). COMMIT WORK AND WAIT. " to release lock ENDIF. ENDMETHOD. METHOD find_remote_dot_apack. FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote. get_files_remote( ). READ TABLE mt_remote ASSIGNING <ls_remote> WITH KEY path = zif_abapgit_definitions=>c_root_dir filename = zif_abapgit_apack_definitions=>c_dot_apack_manifest. IF sy-subrc = 0. ro_dot = zcl_abapgit_apack_reader=>deserialize( iv_package_name = ms_data-package iv_xstr = <ls_remote>-data ). set_dot_apack( ro_dot ). ENDIF. ENDMETHOD. METHOD get_data_config. FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote. IF mi_data_config IS BOUND. ri_config = mi_data_config. RETURN. ENDIF. get_files_remote( ). CREATE OBJECT ri_config TYPE zcl_abapgit_data_config. mi_data_config = ri_config. READ TABLE mt_remote ASSIGNING <ls_remote> WITH KEY path = zif_abapgit_data_config=>c_default_path. IF sy-subrc = 0. ri_config->from_json( mt_remote ). ENDIF. ENDMETHOD. METHOD get_dot_abapgit. CREATE OBJECT ro_dot_abapgit EXPORTING is_data = ms_data-dot_abapgit. ENDMETHOD. METHOD get_dot_apack. IF mo_apack_reader IS NOT BOUND. mo_apack_reader = zcl_abapgit_apack_reader=>create_instance( ms_data-package ). ENDIF. ro_dot_apack = mo_apack_reader. ENDMETHOD. METHOD get_files_local. DATA lo_serialize TYPE REF TO zcl_abapgit_serialize. " Serialization happened before and no refresh request IF lines( mt_local ) > 0 AND mv_request_local_refresh = abap_false. rt_files = mt_local. RETURN. ENDIF. CREATE OBJECT lo_serialize EXPORTING io_dot_abapgit = get_dot_abapgit( ) is_local_settings = get_local_settings( ). rt_files = lo_serialize->files_local( iv_package = get_package( ) ii_data_config = get_data_config( ) ii_log = ii_log ). mt_local = rt_files. mv_request_local_refresh = abap_false. " Fulfill refresh ENDMETHOD. METHOD get_files_remote. rt_files = mt_remote. ENDMETHOD. METHOD get_key. rv_key = ms_data-key. ENDMETHOD. METHOD get_local_checksums. rt_checksums = ms_data-local_checksums. ENDMETHOD. METHOD get_local_checksums_per_file. FIELD-SYMBOLS <ls_object> LIKE LINE OF ms_data-local_checksums. LOOP AT ms_data-local_checksums ASSIGNING <ls_object>. APPEND LINES OF <ls_object>-files TO rt_checksums. ENDLOOP. ENDMETHOD. METHOD get_local_settings. rs_settings = ms_data-local_settings. ENDMETHOD. METHOD get_log. ri_log = mi_log. ENDMETHOD. METHOD get_name. rv_name = ms_data-local_settings-display_name. ENDMETHOD. METHOD get_package. rv_package = ms_data-package. ENDMETHOD. METHOD get_unsupported_objects_local. DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, lt_supported_types TYPE zcl_abapgit_objects=>ty_types_tt. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF lt_tadir, <ls_object> LIKE LINE OF rt_objects. lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( iv_package = ms_data-package iv_ignore_subpackages = ms_data-local_settings-ignore_subpackages iv_only_local_objects = ms_data-local_settings-only_local_objects io_dot = get_dot_abapgit( ) ). lt_supported_types = zcl_abapgit_objects=>supported_list( ). LOOP AT lt_tadir ASSIGNING <ls_tadir>. READ TABLE lt_supported_types WITH KEY table_line = <ls_tadir>-object TRANSPORTING NO FIELDS. IF sy-subrc <> 0. APPEND INITIAL LINE TO rt_objects ASSIGNING <ls_object>. MOVE-CORRESPONDING <ls_tadir> TO <ls_object>. <ls_object>-obj_type = <ls_tadir>-object. ENDIF. ENDLOOP. ENDMETHOD. METHOD is_offline. rv_offline = ms_data-offline. ENDMETHOD. METHOD notify_listener. DATA ls_meta_slug TYPE zif_abapgit_persistence=>ty_repo_xml. IF mi_listener IS BOUND. MOVE-CORRESPONDING ms_data TO ls_meta_slug. mi_listener->on_meta_change( iv_key = ms_data-key is_meta = ls_meta_slug is_change_mask = is_change_mask ). ENDIF. ENDMETHOD. METHOD rebuild_local_checksums. DATA: lt_remote TYPE zif_abapgit_definitions=>ty_files_tt, lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, ls_last_item TYPE zif_abapgit_definitions=>ty_item, lt_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt. FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums, <ls_local> LIKE LINE OF lt_local. lt_local = get_files_local( ). remove_non_code_related_files( CHANGING ct_local_files = lt_local ). lt_remote = get_files_remote( ). SORT lt_remote BY path filename. LOOP AT lt_local ASSIGNING <ls_local>. IF ls_last_item <> <ls_local>-item OR sy-tabix = 1. " First or New item reached ? APPEND INITIAL LINE TO lt_checksums ASSIGNING <ls_checksum>. <ls_checksum>-item = <ls_local>-item. ls_last_item = <ls_local>-item. ENDIF. compare_with_remote_checksum( EXPORTING it_remote_files = lt_remote is_local_file = <ls_local>-file CHANGING cs_checksum = <ls_checksum> ). ENDLOOP. set( it_checksums = lt_checksums ). reset_status( ). ENDMETHOD. METHOD refresh. mv_request_local_refresh = abap_true. reset_remote( ). IF iv_drop_log = abap_true. CLEAR mi_log. ENDIF. IF iv_drop_cache = abap_true. CLEAR mt_local. ENDIF. ENDMETHOD. METHOD refresh_local_object. DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir, lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, lt_new_local_files TYPE zif_abapgit_definitions=>ty_files_item_tt, lo_serialize TYPE REF TO zcl_abapgit_serialize. lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( iv_package = ms_data-package io_dot = get_dot_abapgit( ) ). DELETE mt_local WHERE item-obj_type = iv_obj_type AND item-obj_name = iv_obj_name. READ TABLE lt_tadir INTO ls_tadir WITH KEY object = iv_obj_type obj_name = iv_obj_name. IF sy-subrc <> 0 OR ls_tadir-delflag = abap_true. " object doesn't exist anymore, nothing todo here RETURN. ENDIF. CLEAR lt_tadir. INSERT ls_tadir INTO TABLE lt_tadir. CREATE OBJECT lo_serialize. lt_new_local_files = lo_serialize->serialize( lt_tadir ). INSERT LINES OF lt_new_local_files INTO TABLE mt_local. ENDMETHOD. METHOD refresh_local_objects. mv_request_local_refresh = abap_true. get_files_local( ). ENDMETHOD. METHOD remove_non_code_related_files. DELETE ct_local_files WHERE item IS INITIAL AND NOT ( file-path = zif_abapgit_definitions=>c_root_dir AND file-filename = zif_abapgit_definitions=>c_dot_abapgit ). SORT ct_local_files BY item. ENDMETHOD. METHOD reset_remote. CLEAR mt_remote. mv_request_remote_refresh = abap_true. reset_status( ). ENDMETHOD. METHOD reset_status. CLEAR mt_status. ENDMETHOD. METHOD set. * TODO: refactor, maybe use zcl_abapgit_string_map ? DATA: ls_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask. ASSERT it_checksums IS SUPPLIED OR iv_url IS SUPPLIED OR iv_branch_name IS SUPPLIED OR iv_selected_commit IS SUPPLIED OR iv_head_branch IS SUPPLIED OR iv_offline IS SUPPLIED OR is_dot_abapgit IS SUPPLIED OR is_local_settings IS SUPPLIED OR iv_deserialized_by IS SUPPLIED OR iv_deserialized_at IS SUPPLIED OR iv_switched_origin IS SUPPLIED. IF it_checksums IS SUPPLIED. ms_data-local_checksums = it_checksums. ls_mask-local_checksums = abap_true. ENDIF. IF iv_url IS SUPPLIED. ms_data-url = iv_url. ls_mask-url = abap_true. ENDIF. IF iv_branch_name IS SUPPLIED. ms_data-branch_name = iv_branch_name. ls_mask-branch_name = abap_true. ENDIF. IF iv_selected_commit IS SUPPLIED. ms_data-selected_commit = iv_selected_commit. ls_mask-selected_commit = abap_true. ENDIF. IF iv_head_branch IS SUPPLIED. ms_data-head_branch = iv_head_branch. ls_mask-head_branch = abap_true. ENDIF. IF iv_offline IS SUPPLIED. ms_data-offline = iv_offline. ls_mask-offline = abap_true. ENDIF. IF is_dot_abapgit IS SUPPLIED. ms_data-dot_abapgit = is_dot_abapgit. ls_mask-dot_abapgit = abap_true. ENDIF. IF is_local_settings IS SUPPLIED. ms_data-local_settings = is_local_settings. ls_mask-local_settings = abap_true. ENDIF. IF iv_deserialized_at IS SUPPLIED OR iv_deserialized_by IS SUPPLIED. ms_data-deserialized_at = iv_deserialized_at. ms_data-deserialized_by = iv_deserialized_by. ls_mask-deserialized_at = abap_true. ls_mask-deserialized_by = abap_true. ENDIF. IF iv_switched_origin IS SUPPLIED. ms_data-switched_origin = iv_switched_origin. ls_mask-switched_origin = abap_true. ENDIF. notify_listener( ls_mask ). ENDMETHOD. METHOD set_dot_abapgit. set( is_dot_abapgit = io_dot_abapgit->get_data( ) ). ENDMETHOD. METHOD set_dot_apack. get_dot_apack( ). mo_apack_reader->set_manifest_descriptor( io_dot_apack->get_manifest_descriptor( ) ). ENDMETHOD. METHOD set_files_remote. mt_remote = it_files. mv_request_remote_refresh = abap_false. ENDMETHOD. METHOD set_local_settings. set( is_local_settings = is_settings ). ENDMETHOD. METHOD status. IF lines( mt_status ) = 0. mt_status = zcl_abapgit_file_status=>status( io_repo = me ii_log = ii_log ). ENDIF. rt_results = mt_status. ENDMETHOD. METHOD switch_repo_type. IF iv_offline = ms_data-offline. zcx_abapgit_exception=>raise( |Cannot switch_repo_type, offline already = "{ ms_data-offline }"| ). ENDIF. IF iv_offline = abap_true. " On-line -> OFFline set( iv_url = zcl_abapgit_url=>name( ms_data-url ) iv_branch_name = '' iv_selected_commit = '' iv_head_branch = '' iv_offline = abap_true ). ELSE. " OFFline -> On-line set( iv_offline = abap_false ). ENDIF. ENDMETHOD. METHOD update_last_deserialize. DATA: lv_deserialized_at TYPE zif_abapgit_persistence=>ty_repo-deserialized_at, lv_deserialized_by TYPE zif_abapgit_persistence=>ty_repo-deserialized_by. GET TIME STAMP FIELD lv_deserialized_at. lv_deserialized_by = sy-uname. set( iv_deserialized_at = lv_deserialized_at iv_deserialized_by = lv_deserialized_by ). ENDMETHOD. METHOD update_local_checksums. " ASSUMTION: SHA1 in param is actual and correct. " Push fills it from local files before pushing, deserialize from remote " If this is not true that there is an error somewhere but not here DATA: lt_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt, lt_files_idx TYPE zif_abapgit_definitions=>ty_file_signatures_tt, lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, lv_chks_row TYPE i, lv_file_row TYPE i. FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums, <ls_file> LIKE LINE OF <ls_checksum>-files, <ls_local> LIKE LINE OF lt_local, <ls_new_state> LIKE LINE OF it_files. lt_checksums = get_local_checksums( ). lt_files_idx = it_files. SORT lt_files_idx BY path filename. " Sort for binary search " Loop through current chacksum state, update sha1 for common files LOOP AT lt_checksums ASSIGNING <ls_checksum>. lv_chks_row = sy-tabix. LOOP AT <ls_checksum>-files ASSIGNING <ls_file>. lv_file_row = sy-tabix. READ TABLE lt_files_idx ASSIGNING <ls_new_state> WITH KEY path = <ls_file>-path filename = <ls_file>-filename BINARY SEARCH. CHECK sy-subrc = 0. " Missing in param table, skip IF <ls_new_state>-sha1 IS INITIAL. " Empty input sha1 is a deletion marker DELETE <ls_checksum>-files INDEX lv_file_row. ELSE. <ls_file>-sha1 = <ls_new_state>-sha1. " Update sha1 CLEAR <ls_new_state>-sha1. " Mark as processed ENDIF. ENDLOOP. IF lines( <ls_checksum>-files ) = 0. " Remove empty objects DELETE lt_checksums INDEX lv_chks_row. ENDIF. ENDLOOP. DELETE lt_files_idx WHERE sha1 IS INITIAL. " Remove processed IF lines( lt_files_idx ) > 0. lt_local = get_files_local( ). SORT lt_local BY file-path file-filename. " Sort for binary search ENDIF. " Add new files - not deleted and not marked as processed above LOOP AT lt_files_idx ASSIGNING <ls_new_state>. READ TABLE lt_local ASSIGNING <ls_local> WITH KEY file-path = <ls_new_state>-path file-filename = <ls_new_state>-filename BINARY SEARCH. IF sy-subrc <> 0. * if the deserialization fails, the local file might not be there CONTINUE. ENDIF. READ TABLE lt_checksums ASSIGNING <ls_checksum> " TODO Optimize WITH KEY item = <ls_local>-item. IF sy-subrc > 0. APPEND INITIAL LINE TO lt_checksums ASSIGNING <ls_checksum>. <ls_checksum>-item = <ls_local>-item. ENDIF. APPEND <ls_new_state> TO <ls_checksum>-files. ENDLOOP. SORT lt_checksums BY item. set( it_checksums = lt_checksums ). ENDMETHOD. ENDCLASS.
29.054393
114
0.691028
c8a3c5fe153d02c9d1c9025acf1241bb81a7f180
9,588
abap
ABAP
src/unmanaged/#dmo#cl_travel_auxiliary25.clas.abap
SAP-Cloud-Platform/flight25
f27adcaa4e14ff4e2cf8d737dec7a23b1789821e
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#cl_travel_auxiliary25.clas.abap
SAP-Cloud-Platform/flight25
f27adcaa4e14ff4e2cf8d737dec7a23b1789821e
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#cl_travel_auxiliary25.clas.abap
SAP-Cloud-Platform/flight25
f27adcaa4e14ff4e2cf8d737dec7a23b1789821e
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/cl_travel_auxiliary25 DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. * Type definition for import parameters -------------------------- TYPES tt_travel_create TYPE TABLE FOR CREATE /dmo/i_travel_u25. TYPES tt_travel_update TYPE TABLE FOR UPDATE /dmo/i_travel_u25. TYPES tt_travel_delete TYPE TABLE FOR DELETE /dmo/i_travel_u25. TYPES tt_travel_failed TYPE TABLE FOR FAILED /dmo/i_travel_u25. TYPES tt_travel_mapped TYPE TABLE FOR MAPPED /dmo/i_travel_u25. TYPES tt_travel_reported TYPE TABLE FOR REPORTED /dmo/i_travel_u25. TYPES tt_booking_create TYPE TABLE FOR CREATE /dmo/i_booking_u25. TYPES tt_booking_update TYPE TABLE FOR UPDATE /dmo/i_booking_u25. TYPES tt_booking_delete TYPE TABLE FOR DELETE /dmo/i_booking_u25. TYPES tt_booking_failed TYPE TABLE FOR FAILED /dmo/i_booking_u25. TYPES tt_booking_mapped TYPE TABLE FOR MAPPED /dmo/i_booking_u25. TYPES tt_booking_reported TYPE TABLE FOR REPORTED /dmo/i_booking_u25. TYPES tt_bookingsupplement_failed TYPE TABLE FOR FAILED /dmo/i_bookingsupplement_u25. TYPES tt_bookingsupplement_mapped TYPE TABLE FOR MAPPED /dmo/i_bookingsupplement_u25. TYPES tt_bookingsupplement_reported TYPE TABLE FOR REPORTED /dmo/i_bookingsupplement_u25. CLASS-METHODS map_travel_cds_to_db IMPORTING is_i_travel_u TYPE /dmo/i_travel_u25 RETURNING VALUE(rs_travel) TYPE /dmo/if_flight_legacy25=>ts_travel_in. CLASS-METHODS map_travel_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id25 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy25=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_travel_reported. CLASS-METHODS map_booking_cds_to_db IMPORTING is_i_booking TYPE /dmo/i_booking_u25 RETURNING VALUE(rs_booking) TYPE /dmo/if_flight_legacy25=>ts_booking_in. CLASS-METHODS map_booking_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id25 OPTIONAL iv_booking_id TYPE /dmo/booking_id25 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy25=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_booking_reported. CLASS-METHODS map_bookingsupplemnt_cds_to_db IMPORTING is_i_bookingsupplement TYPE /dmo/i_bookingsupplement_u25 RETURNING VALUE(rs_bookingsupplement) TYPE /dmo/if_flight_legacy25=>ts_booking_supplement_in. CLASS-METHODS map_bookingsupplemnt_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id25 OPTIONAL iv_booking_id TYPE /dmo/booking_id25 OPTIONAL iv_bookingsupplement_id TYPE /dmo/booking_supplement_id25 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy25=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_bookingsupplement_reported. PROTECTED SECTION. PRIVATE SECTION. CLASS-METHODS new_message IMPORTING id TYPE symsgid number TYPE symsgno severity TYPE if_abap_behv_message=>t_severity v1 TYPE simple OPTIONAL v2 TYPE simple OPTIONAL v3 TYPE simple OPTIONAL v4 TYPE simple OPTIONAL RETURNING VALUE(obj) TYPE REF TO if_abap_behv_message . ENDCLASS. CLASS /dmo/cl_travel_auxiliary25 IMPLEMENTATION. METHOD map_travel_cds_to_db. rs_travel = CORRESPONDING #( is_i_travel_u MAPPING travel_id = travelid agency_id = agencyid customer_id = customerid begin_date = begindate end_date = enddate booking_fee = bookingfee total_price = totalprice currency_code = currencycode description = memo status = status ). ENDMETHOD. METHOD map_travel_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-%msg = lo. ENDMETHOD. METHOD map_booking_cds_to_db. rs_booking = CORRESPONDING #( is_i_booking MAPPING booking_id = bookingid booking_date = bookingdate customer_id = customerid carrier_id = airlineid connection_id = connectionid flight_date = flightdate flight_price = flightprice currency_code = currencycode ). ENDMETHOD. METHOD map_booking_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-bookingid = iv_booking_id. rs_report-%msg = lo. ENDMETHOD. METHOD map_bookingsupplemnt_cds_to_db. rs_bookingsupplement = CORRESPONDING #( is_i_bookingsupplement MAPPING booking_id = bookingid booking_supplement_id = bookingsupplementid supplement_id = supplementid price = price currency_code = currencycode ). ENDMETHOD. METHOD map_bookingsupplemnt_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-bookingid = iv_booking_id. rs_report-bookingSupplementid = iv_bookingsupplement_id. rs_report-%msg = lo. ENDMETHOD. METHOD new_message. obj = NEW lcl_abap_behv_msg( textid = VALUE #( msgid = id msgno = number attr1 = COND #( WHEN v1 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV1' ) attr2 = COND #( WHEN v2 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV2' ) attr3 = COND #( WHEN v3 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV3' ) attr4 = COND #( WHEN v4 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV4' ) ) msgty = SWITCH #( severity WHEN if_abap_behv_message=>severity-error THEN 'E' WHEN if_abap_behv_message=>severity-warning THEN 'W' WHEN if_abap_behv_message=>severity-information THEN 'I' WHEN if_abap_behv_message=>severity-success THEN 'S' ) msgv1 = |{ v1 }| msgv2 = |{ v2 }| msgv3 = |{ v3 }| msgv4 = |{ v4 }| ). obj->m_severity = severity. ENDMETHOD. ENDCLASS.
47.231527
121
0.492386
c8a8562db972f1d497a9fbcd2b56b89c2df7b67f
2,487
abap
ABAP
src/foundation/y_exemption_handler.clas.abap
steve192/code-pal-for-abap
5f701f5239036cbb724756a86e805fdbae377ab7
[ "Apache-2.0" ]
202
2020-05-05T13:41:12.000Z
2022-03-26T15:18:13.000Z
src/foundation/y_exemption_handler.clas.abap
steve192/code-pal-for-abap
5f701f5239036cbb724756a86e805fdbae377ab7
[ "Apache-2.0" ]
322
2020-05-05T19:14:35.000Z
2022-03-22T14:48:44.000Z
src/foundation/y_exemption_handler.clas.abap
lucasborin/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
59
2020-05-05T18:59:19.000Z
2022-03-20T11:24:48.000Z
CLASS y_exemption_handler DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. INTERFACES y_if_exemption. PRIVATE SECTION. TYPES: BEGIN OF ty_buffer, object_type TYPE trobjtype, object_name TYPE trobj_name, is_exempted TYPE abap_bool, END OF ty_buffer. TYPES: tty_buffer TYPE TABLE OF ty_buffer WITH KEY object_type object_name. CONSTANTS max_entries TYPE i VALUE 100. CLASS-DATA buffer TYPE tty_buffer. CLASS-METHODS get_from_buffer IMPORTING object_type TYPE trobjtype object_name TYPE sobj_name RETURNING VALUE(result) TYPE abap_bool RAISING cx_sy_itab_line_not_found. CLASS-METHODS try_new_exemption IMPORTING object_type TYPE trobjtype object_name TYPE sobj_name RETURNING VALUE(result) TYPE abap_bool. ENDCLASS. CLASS y_exemption_handler IMPLEMENTATION. METHOD y_if_exemption~is_object_exempted. TRY. result = get_from_buffer( object_type = object_type object_name = object_name ). CATCH cx_sy_itab_line_not_found. result = try_new_exemption( object_type = object_type object_name = object_name ). ENDTRY. ENDMETHOD. METHOD get_from_buffer. DATA(entry) = buffer[ object_type = object_type object_name = object_name ]. result = entry-is_exempted. ENDMETHOD. METHOD try_new_exemption. IF lines( buffer ) > max_entries. DELETE buffer FROM 1 TO max_entries / 2. ENDIF. result = y_exemption_general=>is_object_exempted( object_type = object_type object_name = object_name ). IF result = abap_false. result = COND #( WHEN object_type = 'PROG' THEN y_exemption_of_program=>is_exempted( object_name ) WHEN object_type = 'CLAS' THEN y_exemption_of_class=>is_exempted( object_name ) WHEN object_type = 'FUGR' THEN y_exemption_of_function_group=>is_exempted( object_name ) ). ENDIF. APPEND VALUE #( object_type = object_type object_name = object_name is_exempted = result ) TO buffer. ENDMETHOD. ENDCLASS.
33.608108
114
0.597507
c8a873b99fed1904d3b405d2de3760b503c8d894
9,588
abap
ABAP
src/unmanaged/#dmo#cl_travel_auxiliary14.clas.abap
SAP-Cloud-Platform/flight14
4a89f087f6906c61683be65938dc48265ac70344
[ "BSD-Source-Code" ]
2
2020-08-31T12:56:04.000Z
2021-04-12T07:36:40.000Z
src/unmanaged/#dmo#cl_travel_auxiliary14.clas.abap
SAP-Cloud-Platform/flight14
4a89f087f6906c61683be65938dc48265ac70344
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#cl_travel_auxiliary14.clas.abap
SAP-Cloud-Platform/flight14
4a89f087f6906c61683be65938dc48265ac70344
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/cl_travel_auxiliary14 DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. * Type definition for import parameters -------------------------- TYPES tt_travel_create TYPE TABLE FOR CREATE /dmo/i_travel_u14. TYPES tt_travel_update TYPE TABLE FOR UPDATE /dmo/i_travel_u14. TYPES tt_travel_delete TYPE TABLE FOR DELETE /dmo/i_travel_u14. TYPES tt_travel_failed TYPE TABLE FOR FAILED /dmo/i_travel_u14. TYPES tt_travel_mapped TYPE TABLE FOR MAPPED /dmo/i_travel_u14. TYPES tt_travel_reported TYPE TABLE FOR REPORTED /dmo/i_travel_u14. TYPES tt_booking_create TYPE TABLE FOR CREATE /dmo/i_booking_u14. TYPES tt_booking_update TYPE TABLE FOR UPDATE /dmo/i_booking_u14. TYPES tt_booking_delete TYPE TABLE FOR DELETE /dmo/i_booking_u14. TYPES tt_booking_failed TYPE TABLE FOR FAILED /dmo/i_booking_u14. TYPES tt_booking_mapped TYPE TABLE FOR MAPPED /dmo/i_booking_u14. TYPES tt_booking_reported TYPE TABLE FOR REPORTED /dmo/i_booking_u14. TYPES tt_bookingsupplement_failed TYPE TABLE FOR FAILED /dmo/i_bookingsupplement_u14. TYPES tt_bookingsupplement_mapped TYPE TABLE FOR MAPPED /dmo/i_bookingsupplement_u14. TYPES tt_bookingsupplement_reported TYPE TABLE FOR REPORTED /dmo/i_bookingsupplement_u14. CLASS-METHODS map_travel_cds_to_db IMPORTING is_i_travel_u TYPE /dmo/i_travel_u14 RETURNING VALUE(rs_travel) TYPE /dmo/if_flight_legacy14=>ts_travel_in. CLASS-METHODS map_travel_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id14 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy14=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_travel_reported. CLASS-METHODS map_booking_cds_to_db IMPORTING is_i_booking TYPE /dmo/i_booking_u14 RETURNING VALUE(rs_booking) TYPE /dmo/if_flight_legacy14=>ts_booking_in. CLASS-METHODS map_booking_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id14 OPTIONAL iv_booking_id TYPE /dmo/booking_id14 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy14=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_booking_reported. CLASS-METHODS map_bookingsupplemnt_cds_to_db IMPORTING is_i_bookingsupplement TYPE /dmo/i_bookingsupplement_u14 RETURNING VALUE(rs_bookingsupplement) TYPE /dmo/if_flight_legacy14=>ts_booking_supplement_in. CLASS-METHODS map_bookingsupplemnt_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id14 OPTIONAL iv_booking_id TYPE /dmo/booking_id14 OPTIONAL iv_bookingsupplement_id TYPE /dmo/booking_supplement_id14 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy14=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_bookingsupplement_reported. PROTECTED SECTION. PRIVATE SECTION. CLASS-METHODS new_message IMPORTING id TYPE symsgid number TYPE symsgno severity TYPE if_abap_behv_message=>t_severity v1 TYPE simple OPTIONAL v2 TYPE simple OPTIONAL v3 TYPE simple OPTIONAL v4 TYPE simple OPTIONAL RETURNING VALUE(obj) TYPE REF TO if_abap_behv_message . ENDCLASS. CLASS /dmo/cl_travel_auxiliary14 IMPLEMENTATION. METHOD map_travel_cds_to_db. rs_travel = CORRESPONDING #( is_i_travel_u MAPPING travel_id = travelid agency_id = agencyid customer_id = customerid begin_date = begindate end_date = enddate booking_fee = bookingfee total_price = totalprice currency_code = currencycode description = memo status = status ). ENDMETHOD. METHOD map_travel_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-%msg = lo. ENDMETHOD. METHOD map_booking_cds_to_db. rs_booking = CORRESPONDING #( is_i_booking MAPPING booking_id = bookingid booking_date = bookingdate customer_id = customerid carrier_id = airlineid connection_id = connectionid flight_date = flightdate flight_price = flightprice currency_code = currencycode ). ENDMETHOD. METHOD map_booking_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-bookingid = iv_booking_id. rs_report-%msg = lo. ENDMETHOD. METHOD map_bookingsupplemnt_cds_to_db. rs_bookingsupplement = CORRESPONDING #( is_i_bookingsupplement MAPPING booking_id = bookingid booking_supplement_id = bookingsupplementid supplement_id = supplementid price = price currency_code = currencycode ). ENDMETHOD. METHOD map_bookingsupplemnt_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-bookingid = iv_booking_id. rs_report-bookingSupplementid = iv_bookingsupplement_id. rs_report-%msg = lo. ENDMETHOD. METHOD new_message. obj = NEW lcl_abap_behv_msg( textid = VALUE #( msgid = id msgno = number attr1 = COND #( WHEN v1 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV1' ) attr2 = COND #( WHEN v2 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV2' ) attr3 = COND #( WHEN v3 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV3' ) attr4 = COND #( WHEN v4 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV4' ) ) msgty = SWITCH #( severity WHEN if_abap_behv_message=>severity-error THEN 'E' WHEN if_abap_behv_message=>severity-warning THEN 'W' WHEN if_abap_behv_message=>severity-information THEN 'I' WHEN if_abap_behv_message=>severity-success THEN 'S' ) msgv1 = |{ v1 }| msgv2 = |{ v2 }| msgv3 = |{ v3 }| msgv4 = |{ v4 }| ). obj->m_severity = severity. ENDMETHOD. ENDCLASS.
47.231527
121
0.492386
c8aac3897067f18e4f1aba0dc179114b6f9631fe
20,966
abap
ABAP
src/objects/zcl_abapgit_object_udmo.clas.abap
mkaesemann/abapG
467d8d367ceab1fc8acfdb4e96490e59fe3387b8
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_udmo.clas.abap
mkaesemann/abapG
467d8d367ceab1fc8acfdb4e96490e59fe3387b8
[ "MIT" ]
1
2017-10-27T09:32:58.000Z
2017-10-27T09:32:58.000Z
src/objects/zcl_abapgit_object_udmo.clas.abap
mkaesemann/abapGit
467d8d367ceab1fc8acfdb4e96490e59fe3387b8
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_udmo DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . METHODS constructor IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_language TYPE spras . PROTECTED SECTION. METHODS corr_insert REDEFINITION . PRIVATE SECTION. TYPES: " You are reminded that the text serialisation / de-serialisation methods depend upon a common type. " To make the dependency explicit, there is one common definition. BEGIN OF ty_udmo_text_type. TYPES sprache TYPE dm40t-sprache. TYPES dmoid TYPE dm40t-dmoid. TYPES langbez TYPE dm40t-langbez. TYPES as4local TYPE dm40t-as4local. TYPES END OF ty_udmo_text_type . DATA mv_data_model TYPE uddmodl . DATA mv_text_object TYPE doku_obj . DATA mv_lxe_text_name TYPE lxeobjname . DATA mv_activation_state TYPE as4local . DATA ms_object_type TYPE rsdeo . CONSTANTS c_transport_object_class TYPE trobjtype VALUE 'SUDM' ##NO_TEXT. CONSTANTS c_lxe_text_type TYPE lxeobjtype VALUE 'IM' ##NO_TEXT. CONSTANTS c_correction_object_type TYPE rsdeo-objtype VALUE 'UDMO' ##NO_TEXT. CONSTANTS c_active_state TYPE as4local VALUE 'A' ##NO_TEXT. METHODS is_name_permitted RAISING zcx_abapgit_exception . METHODS update_tree . METHODS serialize_short_texts IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_short_texts IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_long_texts IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_long_texts IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_entities IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_entities IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS access_modify RETURNING VALUE(rv_result) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS access_free RETURNING VALUE(rv_result) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS deserialize_model IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_model IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_output RAISING zcx_abapgit_exception . ENDCLASS. CLASS zcl_abapgit_object_udmo IMPLEMENTATION. METHOD access_free. " Release the lock on the object. CALL FUNCTION 'RS_ACCESS_PERMISSION' EXPORTING mode = 'FREE' object = ms_object_type object_class = c_transport_object_class EXCEPTIONS canceled_in_corr = 1 enqueued_by_user = 2 enqueue_system_failure = 3 illegal_parameter_values = 4 locked_by_author = 5 no_modify_permission = 6 no_show_permission = 7 permission_failure = 8 request_language_denied = 9 OTHERS = 10. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ELSE. rv_result = abap_true. ENDIF. ENDMETHOD. METHOD access_modify. * You are reminded that mode modify is the same as insert, with one important difference: * Mode INSERT is intended for newly created objects, for which a TADIR entry does not yet * exist. In that case, the system shows a pop-up for the entry of the package, which isn't * desirable when the SAPGUI is not available. * In the context of abapGit, the package is known. CALL FUNCTION 'RS_ACCESS_PERMISSION' EXPORTING authority_check = abap_true global_lock = abap_true mode = 'MODIFY' object = ms_object_type object_class = c_transport_object_class EXCEPTIONS canceled_in_corr = 1 enqueued_by_user = 2 enqueue_system_failure = 3 illegal_parameter_values = 4 locked_by_author = 5 no_modify_permission = 6 no_show_permission = 7 permission_failure = 8 request_language_denied = 9 OTHERS = 10. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ELSE. rv_result = abap_true. ENDIF. ENDMETHOD. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). " Conversion to Data model mv_data_model = is_item-obj_name. " Default activation state is active mv_activation_state = c_active_state. " Derive the data model's text object mv_text_object = 'UDMD' && is_item-obj_name. " And set the text object to active mv_text_object+30(1) = mv_activation_state. mv_lxe_text_name = mv_text_object. " Correction and Transport System object ms_object_type-objtype = c_correction_object_type. ms_object_type-objname = is_item-obj_name. ENDMETHOD. METHOD corr_insert. " You are reminded that SUDM - Data Model has no part objects e.g. no LIMU " Therefore global lock is always appropriate " You are reminded that the master language (in TADIR) is taken from MV_LANGUAGE. CALL FUNCTION 'RS_CORR_INSERT' EXPORTING object = ms_object_type object_class = c_transport_object_class devclass = iv_package master_language = mv_language mode = 'INSERT' global_lock = abap_true suppress_dialog = abap_true EXCEPTIONS cancelled = 1 permission_failure = 2 unknown_objectclass = 3 OTHERS = 4. IF sy-subrc = 1. zcx_abapgit_exception=>raise( 'Cancelled' ). ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from RS_CORR_INSERT' ). ENDIF. ENDMETHOD. METHOD deserialize_entities. DATA lt_udmo_entities TYPE STANDARD TABLE OF dm41s WITH DEFAULT KEY. DATA ls_udmo_entity LIKE LINE OF lt_udmo_entities. io_xml->read( EXPORTING iv_name = 'UDMO_ENTITIES' CHANGING cg_data = lt_udmo_entities ). LOOP AT lt_udmo_entities INTO ls_udmo_entity. CALL FUNCTION 'SDU_DMO_ENT_PUT' EXPORTING object = ls_udmo_entity EXCEPTIONS ret_code = 0 OTHERS = 0. ENDLOOP. ENDMETHOD. METHOD deserialize_long_texts. DATA BEGIN OF ls_udmo_long_text. DATA language TYPE dm40t-sprache. DATA header TYPE thead. DATA content TYPE xstring. DATA END OF ls_udmo_long_text. DATA lt_udmo_long_texts LIKE STANDARD TABLE OF ls_udmo_long_text. DATA ls_header TYPE thead. io_xml->read( EXPORTING iv_name = 'UDMO_LONG_TEXTS' CHANGING cg_data = lt_udmo_long_texts ). LOOP AT lt_udmo_long_texts INTO ls_udmo_long_text. ls_udmo_long_text-header-tdfuser = sy-uname. ls_udmo_long_text-header-tdfdate = sy-datum. ls_udmo_long_text-header-tdftime = sy-uzeit. " You are reminded that the target system may already have some texts in " existence. So we determine the highest existent version. CLEAR ls_header-tdversion. SELECT MAX( dokversion ) INTO ls_header-tdversion FROM dokhl WHERE id = c_lxe_text_type AND object = mv_text_object AND langu = ls_udmo_long_text-language. " Increment the version ls_header-tdversion = ls_header-tdversion + 1. ls_udmo_long_text-header-tdversion = ls_header-tdversion. " This function module takes care of the variation in text processing between various objects. CALL FUNCTION 'LXE_OBJ_DOKU_PUT_XSTRING' EXPORTING slang = mv_language tlang = ls_udmo_long_text-language objtype = c_lxe_text_type objname = mv_lxe_text_name header = ls_udmo_long_text-header content = ls_udmo_long_text-content. ENDLOOP. ENDMETHOD. METHOD deserialize_model. DATA ls_dm40l TYPE dm40l. io_xml->read( EXPORTING iv_name = 'DM40L' CHANGING cg_data = ls_dm40l ). " See SDU_MODEL_PUT GET TIME. ls_dm40l-flg_frame = abap_true. ls_dm40l-fstdate = sy-datum. ls_dm40l-fsttime = sy-uzeit. ls_dm40l-fstuser = sy-uname. ls_dm40l-lstdate = sy-datum. ls_dm40l-lsttime = sy-uzeit. ls_dm40l-lstuser = sy-uname. MODIFY dm40l FROM ls_dm40l. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SDU_MODEL_PUT' ). ENDIF. ENDMETHOD. METHOD deserialize_short_texts. DATA lt_udmo_texts TYPE STANDARD TABLE OF ty_udmo_text_type WITH DEFAULT KEY. DATA ls_udmo_text TYPE ty_udmo_text_type. DATA ls_dm40t TYPE dm40t. " Deserialize the XML io_xml->read( EXPORTING iv_name = 'UDMO_TEXTS' CHANGING cg_data = lt_udmo_texts ). " For every text provided LOOP AT lt_udmo_texts INTO ls_udmo_text. " Does the text already exist? This is the same logic as used " in the FM SDU_MODEL_PUT SELECT SINGLE * FROM dm40t INTO ls_dm40t WHERE sprache = ls_udmo_text-sprache AND dmoid = ls_udmo_text-dmoid AND as4local = mv_activation_state. IF sy-subrc = 0. " There is already an active description for this language " but the provided description differs IF ls_dm40t-langbez <> ls_udmo_text-langbez. ls_dm40t-langbez = ls_udmo_text-langbez. ls_dm40t-lstdate = sy-datum. ls_dm40t-lsttime = sy-uzeit. ls_dm40t-lstuser = sy-uname. MODIFY dm40t FROM ls_dm40t. ENDIF. ELSE. " There is no EXISTING active description in this language ls_dm40t-as4local = ls_udmo_text-as4local. ls_dm40t-dmoid = ls_udmo_text-dmoid. ls_dm40t-langbez = ls_udmo_text-langbez. ls_dm40t-lstdate = sy-datum. ls_dm40t-lsttime = sy-uzeit. ls_dm40t-lstuser = sy-uname. ls_dm40t-sprache = ls_udmo_text-sprache. INSERT dm40t FROM ls_dm40t. ENDIF. ENDLOOP. ENDMETHOD. METHOD is_name_permitted. " It is unlikely that a serialised data model will have a name that is not permitted. However " there may be reservations in TRESE which could prohibit the data model name. " So to be safe, we check. Tx SD11 does this check. CALL FUNCTION 'SDU_SAA_CHECK' EXPORTING obj_name = ms_object_type-objname obj_type = ms_object_type-objtype EXCEPTIONS wrong_type = 01. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD serialize_entities. DATA lt_udmo_entities TYPE STANDARD TABLE OF dm41s WITH DEFAULT KEY. FIELD-SYMBOLS <ls_udmo_entity> TYPE dm41s. SELECT * FROM dm41s INTO TABLE lt_udmo_entities WHERE dmoid = mv_data_model AND as4local = mv_activation_state. LOOP AT lt_udmo_entities ASSIGNING <ls_udmo_entity>. " You are reminded that administrative information, such as last changed by user, date, time is not serialised. CLEAR <ls_udmo_entity>-lstuser. CLEAR <ls_udmo_entity>-lstdate. CLEAR <ls_udmo_entity>-lsttime. CLEAR <ls_udmo_entity>-fstuser. CLEAR <ls_udmo_entity>-fstdate. CLEAR <ls_udmo_entity>-fsttime. ENDLOOP. " You are reminded that descriptions in other languages do not have to be in existence, although they may. IF lines( lt_udmo_entities ) > 0. io_xml->add( iv_name = 'UDMO_ENTITIES' ig_data = lt_udmo_entities ). ENDIF. ENDMETHOD. METHOD serialize_long_texts. " The model has short texts in multiple languages. These are held in DM40T. " The model has a long description also in a master language, with other long descriptions " maintained as translations using SE63 Translation Editor. All of these long texts are held in DOK* TYPES BEGIN OF ty_language_type. TYPES language TYPE dm40t-sprache. TYPES END OF ty_language_type. DATA BEGIN OF ls_udmo_long_text. DATA language TYPE dm40t-sprache. DATA header TYPE thead. DATA content TYPE xstring. DATA END OF ls_udmo_long_text. DATA lt_udmo_long_texts LIKE STANDARD TABLE OF ls_udmo_long_text. DATA lt_udmo_languages TYPE STANDARD TABLE OF ty_language_type. DATA ls_udmo_language LIKE LINE OF lt_udmo_languages. DATA: lv_error_status TYPE lxestatprc. " In which languages are the short texts are maintained. SELECT sprache AS language FROM dm40t INTO TABLE lt_udmo_languages WHERE dmoid = mv_data_model AND as4local = mv_activation_state ORDER BY sprache ASCENDING. "#EC CI_NOFIRST " For every language for which a short text is maintained, LOOP AT lt_udmo_languages INTO ls_udmo_language. CLEAR ls_udmo_long_text. CLEAR lv_error_status. ls_udmo_long_text-language = ls_udmo_language-language. " You are reminded that this function gets the most recent version of the texts. CALL FUNCTION 'LXE_OBJ_DOKU_GET_XSTRING' EXPORTING lang = ls_udmo_language-language objtype = c_lxe_text_type objname = mv_lxe_text_name IMPORTING header = ls_udmo_long_text-header content = ls_udmo_long_text-content pstatus = lv_error_status. CHECK lv_error_status = 'S'. "Success " Administrative information is not serialised CLEAR ls_udmo_long_text-header-tdfuser. CLEAR ls_udmo_long_text-header-tdfdate. CLEAR ls_udmo_long_text-header-tdftime. CLEAR ls_udmo_long_text-header-tdluser. CLEAR ls_udmo_long_text-header-tdldate. CLEAR ls_udmo_long_text-header-tdltime. APPEND ls_udmo_long_text TO lt_udmo_long_texts. ENDLOOP. " You are reminded that long texts do not have to be in existence IF lines( lt_udmo_long_texts ) > 0. io_xml->add( iv_name = 'UDMO_LONG_TEXTS' ig_data = lt_udmo_long_texts ). ENDIF. ENDMETHOD. METHOD serialize_model. DATA ls_dm40l TYPE dm40l. " See SDU_MODEL_GET. SELECT SINGLE * FROM dm40l INTO ls_dm40l WHERE dmoid = mv_data_model AND as4local = mv_activation_state. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from UDMO - model serialisation' ). ENDIF. " You are reminded that administrative data is not serialised. CLEAR ls_dm40l-lstdate. CLEAR ls_dm40l-lsttime. CLEAR ls_dm40l-lstuser. CLEAR ls_dm40l-fstdate. CLEAR ls_dm40l-fsttime. CLEAR ls_dm40l-fstuser. io_xml->add( iv_name = 'DM40L' ig_data = ls_dm40l ). ENDMETHOD. METHOD serialize_short_texts. DATA lt_udmo_texts TYPE STANDARD TABLE OF ty_udmo_text_type WITH DEFAULT KEY. " You are reminded that administrative information, such as last changed by user, date, time is not serialised. " You are reminded that active short texts of all (existent) languages are serialised. SELECT sprache dmoid as4local langbez FROM dm40t INTO CORRESPONDING FIELDS OF TABLE lt_udmo_texts WHERE dmoid = mv_data_model AND as4local = mv_activation_state ORDER BY sprache ASCENDING. "#EC CI_NOFIRST " You are reminded that descriptions in other languages do not have to be in existence. IF lines( lt_udmo_texts ) > 0. io_xml->add( iv_name = 'UDMO_TEXTS' ig_data = lt_udmo_texts ). ENDIF. ENDMETHOD. METHOD update_tree. CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT' EXPORTING object = mv_data_model operation = 'INSERT' type = c_correction_object_type. ENDMETHOD. METHOD zif_abapgit_object~changed_by. SELECT SINGLE lstuser INTO rv_user FROM dm40l WHERE dmoid = mv_data_model AND as4local = mv_activation_state. IF sy-subrc <> 0. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. * You are reminded that this function model checks for * - permissions * - locks * - connection to transport and correction system * - deletion of data model, model relations and all documentation * - update of object tree * - releasing of lock CALL FUNCTION 'RPY_DATAMODEL_DELETE' EXPORTING model_name = mv_data_model EXCEPTIONS cancelled = 1 permission_error = 2 not_found = 3 is_used = 4 OTHERS = 5. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~deserialize. * You are reminded that this method checks for * - validity of data model name with regard to naming conventions * - permissions and locks * - connection to transport and correction system * - insert of data model, model relations and all documentation * - update of object tree * - releasing of lock * Is the data model name compliant with naming conventions? is_name_permitted( ). * Access Permission granted? access_modify( ). * Connection to transport and correction system corr_insert( iv_package ). * Insert the data model, relations and documentation TRY. deserialize_model( io_xml ). deserialize_entities( io_xml ). deserialize_short_texts( io_xml ). deserialize_long_texts( io_xml ). update_tree( ). access_free( ). CATCH zcx_abapgit_exception. access_free( ). zcx_abapgit_exception=>raise( 'Error in deserialisation of UDMO' ). ENDTRY. " You are reminded that data models are not relevant for activation. ENDMETHOD. METHOD zif_abapgit_object~exists. " See Function Module SDU_MODEL_EXISTS SELECT COUNT( * ) FROM dm40l WHERE dmoid = mv_data_model AND as4local = mv_activation_state. rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESDUM' iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. " The function module listed below do not open a new window - so we revert to BDC. " CALL FUNCTION 'SDU_MODEL_SHOW' " CALL FUNCTION 'RS_TOOL_ACCESS' DATA lt_bdcdata TYPE TABLE OF bdcdata. FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-program = 'SAPMUD00'. <ls_bdcdata>-dynpro = '0100'. <ls_bdcdata>-dynbegin = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'BDC_OKCODE'. <ls_bdcdata>-fval = '=SHOW'. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'RSUD3-DATM'. <ls_bdcdata>-fval = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'RSUD3-OBJ_KEY'. <ls_bdcdata>-fval = ms_item-obj_name. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SD11' mode_val = 'E' TABLES using_tab = lt_bdcdata EXCEPTIONS system_failure = 1 communication_failure = 2 resource_failure = 3 OTHERS = 4 ##fm_subrc_ok. "#EC CI_SUBRC ENDMETHOD. METHOD zif_abapgit_object~serialize. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. serialize_model( io_xml ). serialize_entities( io_xml ). serialize_short_texts( io_xml ). serialize_long_texts( io_xml ). ENDMETHOD. ENDCLASS.
27.263979
117
0.665554
c8ae42936966e84428eb92b2d7b582fbd92a7369
1,627
abap
ABAP
src/zcl_guidrasil_tools.clas.abap
tricktresor/guidrasil
fe3c388c81e1443b7a4dc6e58db4ba0906582702
[ "MIT" ]
9
2018-10-11T15:14:09.000Z
2022-03-19T06:50:29.000Z
src/zcl_guidrasil_tools.clas.abap
tricktresor/guidrasil
fe3c388c81e1443b7a4dc6e58db4ba0906582702
[ "MIT" ]
7
2018-10-11T15:30:25.000Z
2019-01-16T16:04:34.000Z
src/zcl_guidrasil_tools.clas.abap
tricktresor/guidrasil
fe3c388c81e1443b7a4dc6e58db4ba0906582702
[ "MIT" ]
3
2018-10-11T15:30:59.000Z
2020-06-02T21:55:39.000Z
class ZCL_GUIDRASIL_TOOLS definition public final create public . *"* public components of class ZCL_GUIDRASIL_TOOLS *"* do not include other source files here!!! public section. type-pools SLIS . class-methods GUID_CREATE returning value(EV_GUID) type GUID_16 . class-methods VIEW_ATTRIBUTES importing !IV_STRUCTURE_NAME type TABNAME !IS_STRUCTURE_VALUES type ANY changing !CV_NAME type CLIKE exceptions ERROR . class-methods TODO importing !WAS type STRING optional . class-methods SWITCH_BOOL importing !CURRENT_STATE type ABAP_BOOL returning value(SWITCHED_STATE) type ABAP_BOOL . class-methods SWITCH_INT importing !CURRENT_STATE type INT4 returning value(SWITCHED_STATE) type INT4 . protected section. *"* protected components of class ZCL_GUIDRASIL_TOOLS *"* do not include other source files here!!! private section. *"* private components of class ZCL_GUIDRASIL_TOOLS *"* do not include other source files here!!! ENDCLASS. CLASS ZCL_GUIDRASIL_TOOLS IMPLEMENTATION. method GUID_CREATE. STATICS lv_guid TYPE i. ADD 1 TO lv_guid. ev_guid = lv_guid. endmethod. METHOD switch_bool. IF current_state = abap_true. switched_state = abap_false. ELSE. switched_state = abap_true. ENDIF. ENDMETHOD. METHOD switch_int. IF current_state = 1. switched_state = 0. ELSE. switched_state = 1. ENDIF. ENDMETHOD. METHOD TODO. ENDMETHOD. METHOD view_attributes. MESSAGE 'No attributes to display'(msg) TYPE 'S'. ENDMETHOD. ENDCLASS.
18.280899
53
0.708666
c8afce401b58c46433dc8058637bac0844dbae0e
332
abap
ABAP
src/zrapcloud_uuid_four_levels/zbp_i_af_demolevel3_01.clas.locals_imp.abap
SAP-samples/abap-platform-code-samples-cloud
9bc0a977a318643a7d53dcb28b5ed3c2c9fef3ed
[ "Apache-2.0" ]
5
2021-09-21T22:24:50.000Z
2022-02-23T16:36:03.000Z
src/zrapcloud_uuid_four_levels/zbp_i_af_demolevel3_01.clas.locals_imp.abap
SAP-samples/abap-platform-code-samples-cloud
9bc0a977a318643a7d53dcb28b5ed3c2c9fef3ed
[ "Apache-2.0" ]
null
null
null
src/zrapcloud_uuid_four_levels/zbp_i_af_demolevel3_01.clas.locals_imp.abap
SAP-samples/abap-platform-code-samples-cloud
9bc0a977a318643a7d53dcb28b5ed3c2c9fef3ed
[ "Apache-2.0" ]
null
null
null
CLASS LHC_DEMOLEVEL3 DEFINITION INHERITING FROM CL_ABAP_BEHAVIOR_HANDLER. PRIVATE SECTION. METHODS: CALCULATESEMANTICKEY3 FOR DETERMINE ON SAVE IMPORTING KEYS FOR DemoLevel3~CalculateSemanticKey3 . ENDCLASS. CLASS LHC_DEMOLEVEL3 IMPLEMENTATION. METHOD CALCULATESEMANTICKEY3. ENDMETHOD. ENDCLASS.
25.538462
73
0.78012
c8ba0a24922579a56865a75914b95353eca04bbf
4,845
abap
ABAP
src/ui/core/zcl_abapgit_gui_html_processor.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
1
2020-03-28T06:23:11.000Z
2020-03-28T06:23:11.000Z
src/ui/core/zcl_abapgit_gui_html_processor.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
null
null
null
src/ui/core/zcl_abapgit_gui_html_processor.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_html_processor DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. CONSTANTS c_css_build_name TYPE string VALUE 'css/bundle.css'. CONSTANTS c_preprocess_marker TYPE string VALUE `<!-- abapgit HTML preprocessor -->`. CONSTANTS c_comment_start TYPE string VALUE `<!--`. CONSTANTS c_comment_end TYPE string VALUE `-->`. INTERFACES zif_abapgit_gui_html_processor . METHODS constructor IMPORTING ii_asset_man TYPE REF TO zif_abapgit_gui_asset_manager. METHODS preserve_css IMPORTING !iv_css_url TYPE string . PROTECTED SECTION. PRIVATE SECTION. DATA mt_preserve_css TYPE string_table. DATA mi_asset_man TYPE REF TO zif_abapgit_gui_asset_manager. METHODS patch_html IMPORTING iv_html TYPE string EXPORTING ev_html TYPE string et_css_urls TYPE string_table RAISING zcx_abapgit_exception. METHODS is_preserved IMPORTING !iv_css_url TYPE string RETURNING VALUE(rv_yes) TYPE abap_bool. METHODS find_head_offset IMPORTING iv_html TYPE string RETURNING VALUE(rv_head_end) TYPE i RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_HTML_PROCESSOR IMPLEMENTATION. METHOD constructor. mi_asset_man = ii_asset_man. ENDMETHOD. METHOD is_preserved. READ TABLE mt_preserve_css TRANSPORTING NO FIELDS WITH KEY table_line = iv_css_url. rv_yes = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD patch_html. CONSTANTS lc_css_re TYPE string VALUE `<link\s+rel="stylesheet"\s+type="text/css"\s+href="(\S+)">`. DATA lv_head_end TYPE i. DATA lo_css_re TYPE REF TO cl_abap_regex. DATA lo_matcher TYPE REF TO cl_abap_matcher. DATA lv_css_path TYPE string. DATA lv_marker TYPE string. DATA lv_off TYPE i. DATA lv_len TYPE i. DATA lv_cur TYPE i. DATA lv_css_build TYPE string VALUE '<link rel="stylesheet" type="text/css" href="$BUILD_NAME">'. REPLACE FIRST OCCURRENCE OF '$BUILD_NAME' IN lv_css_build WITH c_css_build_name. " Mmmm CLEAR: ev_html, et_css_urls. lv_head_end = find_head_offset( iv_html ). CREATE OBJECT lo_css_re EXPORTING ignore_case = abap_true pattern = lc_css_re. lo_matcher = lo_css_re->create_matcher( text = substring( val = iv_html len = lv_head_end ) ). WHILE lo_matcher->find_next( ) = abap_true. lv_css_path = lo_matcher->get_submatch( 1 ). IF abap_false = is_preserved( lv_css_path ). lv_off = lo_matcher->get_offset( ). lv_len = lo_matcher->get_length( ). ev_html = ev_html && substring( val = iv_html off = lv_cur len = lv_off - lv_cur ). ev_html = ev_html && c_comment_start && substring( val = iv_html off = lv_off len = lv_len ) && c_comment_end. lv_cur = lv_off + lv_len. APPEND lv_css_path TO et_css_urls. ENDIF. ENDWHILE. ev_html = ev_html && substring( val = iv_html off = lv_cur len = lv_head_end - lv_cur ). IF lines( et_css_urls ) > 0. lv_marker = cl_abap_char_utilities=>newline && ` ` " Assume 4 space indent, maybe improve and detect ? && c_preprocess_marker && cl_abap_char_utilities=>newline && ` `. ev_html = ev_html && lv_marker && lv_css_build. ENDIF. ev_html = ev_html && substring( val = iv_html off = lv_head_end ). ENDMETHOD. METHOD preserve_css. APPEND iv_css_url TO mt_preserve_css. ENDMETHOD. METHOD zif_abapgit_gui_html_processor~process. DATA lo_css_processor TYPE REF TO zcl_abapgit_gui_css_processor. DATA lt_css_urls TYPE string_table. DATA lv_css_build TYPE string. FIELD-SYMBOLS <lv_url> LIKE LINE OF lt_css_urls. patch_html( EXPORTING iv_html = iv_html IMPORTING ev_html = rv_html et_css_urls = lt_css_urls ). IF lines( lt_css_urls ) > 0. CREATE OBJECT lo_css_processor EXPORTING ii_asset_manager = mi_asset_man. LOOP AT lt_css_urls ASSIGNING <lv_url>. lo_css_processor->add_file( <lv_url> ). ENDLOOP. lv_css_build = lo_css_processor->process( ). ii_gui_services->cache_asset( iv_url = |{ c_css_build_name }| iv_type = 'text' iv_subtype = 'css' iv_text = lv_css_build ). ENDIF. ENDMETHOD. METHOD find_head_offset. rv_head_end = find( val = iv_html regex = |{ cl_abap_char_utilities=>newline }?\\s*</head>| case = abap_false ). IF rv_head_end <= 0. rv_head_end = find( val = iv_html regex = |</head>| case = abap_false ). IF rv_head_end <= 0. zcx_abapgit_exception=>raise( 'HTML preprocessor: </head> not found' ). ENDIF. ENDIF. ENDMETHOD. ENDCLASS.
27.685714
118
0.669143
c8bdbf9d14a25541b587043afa848efde7972243
10,064
abap
ABAP
src/zcl_abapgit_dependencies.clas.abap
se38/abapGit
6d9320505c98e2a663d9564cb927e7d58721899f
[ "MIT" ]
1
2020-08-05T05:25:41.000Z
2020-08-05T05:25:41.000Z
src/zcl_abapgit_dependencies.clas.abap
se38/abapGit
6d9320505c98e2a663d9564cb927e7d58721899f
[ "MIT" ]
null
null
null
src/zcl_abapgit_dependencies.clas.abap
se38/abapGit
6d9320505c98e2a663d9564cb927e7d58721899f
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_dependencies DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS resolve CHANGING !ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_dependency, depname TYPE dd02l-tabname, deptyp TYPE c LENGTH 4, deplocal TYPE dd02l-as4local, refname TYPE dd02l-tabname, reftyp TYPE c LENGTH 4, kind TYPE c LENGTH 1, END OF ty_dependency . TYPES: tty_dedenpency TYPE STANDARD TABLE OF ty_dependency WITH NON-UNIQUE DEFAULT KEY . TYPES: BEGIN OF ty_item, obj_type TYPE tadir-object, obj_name TYPE tadir-obj_name, devclass TYPE devclass, END OF ty_item . CLASS-METHODS resolve_ddic CHANGING !ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . CLASS-METHODS get_ddls_dependencies IMPORTING iv_ddls_name TYPE tadir-obj_name RETURNING VALUE(rt_dependency) TYPE tty_dedenpency . CLASS-METHODS resolve_packages CHANGING ct_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt. ENDCLASS. CLASS zcl_abapgit_dependencies IMPLEMENTATION. METHOD get_ddls_dependencies. DATA: lt_ddls_name TYPE TABLE OF ddsymtab, ls_ddls_name TYPE ddsymtab. ls_ddls_name-name = iv_ddls_name. INSERT ls_ddls_name INTO TABLE lt_ddls_name. PERFORM ('DDLS_GET_DEP') IN PROGRAM ('RADMASDL') TABLES lt_ddls_name rt_dependency. ENDMETHOD. METHOD resolve. DATA: lv_tabclass TYPE dd02l-tabclass. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF ct_tadir. " misuse field KORRNUM to fix deletion sequence LOOP AT ct_tadir ASSIGNING <ls_tadir>. CASE <ls_tadir>-object. WHEN 'DEVC'. " Packages last <ls_tadir>-korrnum = '9990'. WHEN 'DOMA'. <ls_tadir>-korrnum = '9000'. WHEN 'PARA'. " PARA after DTEL <ls_tadir>-korrnum = '8100'. WHEN 'DTEL'. <ls_tadir>-korrnum = '8000'. WHEN 'DCLS'. " AUTH after DCLS <ls_tadir>-korrnum = '7100'. WHEN 'AUTH'. " AUTH after DCLS <ls_tadir>-korrnum = '7050'. WHEN 'TTYP' OR 'TABL' OR 'VIEW'. SELECT SINGLE tabclass FROM dd02l INTO lv_tabclass WHERE tabname = <ls_tadir>-obj_name AND as4local = 'A' AND as4vers = '0000'. IF sy-subrc = 0 AND lv_tabclass = 'APPEND'. " delete append structures before database tables <ls_tadir>-korrnum = '6500'. ELSE. <ls_tadir>-korrnum = '7000'. ENDIF. WHEN 'IASP'. <ls_tadir>-korrnum = '5520'. WHEN 'IARP'. <ls_tadir>-korrnum = '5510'. WHEN 'IATU'. <ls_tadir>-korrnum = '5500'. WHEN 'SUSC'. <ls_tadir>-korrnum = '5000'. WHEN 'ACID'. " ACID after PROG/FUGR/CLAS <ls_tadir>-korrnum = '3000'. WHEN 'PROG'. " delete includes after main programs SELECT COUNT(*) FROM reposrc WHERE progname = <ls_tadir>-obj_name AND r3state = 'A' AND subc = 'I'. IF sy-subrc = 0. <ls_tadir>-korrnum = '2000'. ELSE. <ls_tadir>-korrnum = '1000'. ENDIF. WHEN 'IDOC'. <ls_tadir>-korrnum = '2000'. WHEN 'IEXT'. <ls_tadir>-korrnum = '1500'. WHEN OTHERS. <ls_tadir>-korrnum = '1000'. ENDCASE. ENDLOOP. resolve_ddic( CHANGING ct_tadir = ct_tadir ). resolve_packages( CHANGING ct_tadir = ct_tadir ). SORT ct_tadir BY korrnum ASCENDING. ENDMETHOD. METHOD resolve_ddic. * this will make sure the deletion sequence of structures/tables work * in case they have dependencies with .INCLUDE TYPES: BEGIN OF ty_edge, from TYPE ty_item, to TYPE ty_item, END OF ty_edge. DATA: lt_nodes TYPE TABLE OF ty_item, lt_edges TYPE TABLE OF ty_edge, lt_findstrings TYPE TABLE OF rsfind, lv_plus TYPE i VALUE 1, lv_find_obj_cls TYPE euobj-id, lv_index TYPE i, lv_before TYPE i, lt_founds TYPE TABLE OF rsfindlst, lt_scope TYPE STANDARD TABLE OF seu_obj, lt_dependency TYPE tty_dedenpency. FIELD-SYMBOLS: <ls_tadir_ddls> TYPE zif_abapgit_definitions=>ty_tadir, <ls_dependency> TYPE ty_dependency, <ls_tadir_dependent> TYPE zif_abapgit_definitions=>ty_tadir, <ls_tadir> LIKE LINE OF ct_tadir, <ls_edge> LIKE LINE OF lt_edges, <ls_found> LIKE LINE OF lt_founds, <ls_node> LIKE LINE OF lt_nodes. " build nodes LOOP AT ct_tadir ASSIGNING <ls_tadir> WHERE object = 'TABL' OR object = 'VIEW' OR object = 'TTYP'. APPEND INITIAL LINE TO lt_nodes ASSIGNING <ls_node>. <ls_node>-obj_name = <ls_tadir>-obj_name. <ls_node>-obj_type = <ls_tadir>-object. ENDLOOP. APPEND 'TABL' TO lt_scope. APPEND 'VIEW' TO lt_scope. APPEND 'STRU' TO lt_scope. APPEND 'TTYP' TO lt_scope. " build edges LOOP AT lt_nodes ASSIGNING <ls_node>. CLEAR lt_findstrings. APPEND <ls_node>-obj_name TO lt_findstrings. lv_find_obj_cls = <ls_node>-obj_type. CALL FUNCTION 'RS_EU_CROSSREF' EXPORTING i_find_obj_cls = lv_find_obj_cls TABLES i_findstrings = lt_findstrings o_founds = lt_founds i_scope_object_cls = lt_scope EXCEPTIONS not_executed = 1 not_found = 2 illegal_object = 3 no_cross_for_this_object = 4 batch = 5 batchjob_error = 6 wrong_type = 7 object_not_exist = 8 OTHERS = 9. IF sy-subrc <> 0. CONTINUE. ENDIF. LOOP AT lt_founds ASSIGNING <ls_found>. APPEND INITIAL LINE TO lt_edges ASSIGNING <ls_edge>. <ls_edge>-from = <ls_node>. <ls_edge>-to-obj_name = <ls_found>-object. CASE <ls_found>-object_cls. WHEN 'DS' OR 'DT'. <ls_edge>-to-obj_type = 'TABL'. WHEN 'DV'. <ls_edge>-to-obj_type = 'VIEW'. WHEN 'DA'. <ls_edge>-to-obj_type = 'TTYP'. WHEN OTHERS. zcx_abapgit_exception=>raise( 'resolve_ddic, unknown object_cls' ). ENDCASE. ENDLOOP. ENDLOOP. " build DDLS edges LOOP AT ct_tadir ASSIGNING <ls_tadir_ddls> WHERE object = 'DDLS'. CLEAR: lt_dependency. APPEND INITIAL LINE TO lt_nodes ASSIGNING <ls_node>. <ls_node>-obj_name = <ls_tadir_ddls>-obj_name. <ls_node>-obj_type = <ls_tadir_ddls>-object. lt_dependency = get_ddls_dependencies( <ls_tadir_ddls>-obj_name ). LOOP AT lt_dependency ASSIGNING <ls_dependency> WHERE deptyp = 'DDLS' AND refname = <ls_tadir_ddls>-obj_name. READ TABLE ct_tadir ASSIGNING <ls_tadir_dependent> WITH KEY pgmid = 'R3TR' object = 'DDLS' obj_name = <ls_dependency>-depname BINARY SEARCH. CHECK sy-subrc = 0. APPEND INITIAL LINE TO lt_edges ASSIGNING <ls_edge>. <ls_edge>-from = <ls_node>. <ls_edge>-to-obj_name = <ls_dependency>-depname. <ls_edge>-to-obj_type = 'DDLS'. ENDLOOP. ENDLOOP. DO. lv_before = lines( lt_nodes ). LOOP AT lt_nodes ASSIGNING <ls_node>. lv_index = sy-tabix. READ TABLE lt_edges WITH KEY from-obj_name = <ls_node>-obj_name from-obj_type = <ls_node>-obj_type TRANSPORTING NO FIELDS. IF sy-subrc <> 0. LOOP AT ct_tadir ASSIGNING <ls_tadir> WHERE obj_name = <ls_node>-obj_name AND object = <ls_node>-obj_type. <ls_tadir>-korrnum = <ls_tadir>-korrnum + lv_plus. CONDENSE <ls_tadir>-korrnum. ENDLOOP. DELETE lt_edges WHERE to-obj_name = <ls_node>-obj_name AND to-obj_type = <ls_node>-obj_type. DELETE lt_nodes INDEX lv_index. EXIT. " make sure the sequence is fixed ENDIF. ENDLOOP. IF lv_before = lines( lt_nodes ). EXIT. ENDIF. lv_plus = lv_plus + 1. ENDDO. ENDMETHOD. METHOD resolve_packages. DATA: lt_subpackages TYPE zif_abapgit_sap_package=>ty_devclass_tt. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF ct_tadir, <lv_subpackage> LIKE LINE OF lt_subpackages, <ls_tadir_subpackage> LIKE LINE OF ct_tadir. " List subpackage before corresponding superpackage LOOP AT ct_tadir ASSIGNING <ls_tadir> WHERE object = 'DEVC'. lt_subpackages = zcl_abapgit_factory=>get_sap_package( |{ <ls_tadir>-obj_name }| )->list_subpackages( ). LOOP AT lt_subpackages ASSIGNING <lv_subpackage>. READ TABLE ct_tadir ASSIGNING <ls_tadir_subpackage> WITH KEY object = 'DEVC' obj_name = <lv_subpackage>. IF sy-subrc = 0. <ls_tadir_subpackage>-korrnum = condense( |{ <ls_tadir_subpackage>-korrnum - 1 }| ). ENDIF. ENDLOOP. ENDLOOP. ENDMETHOD. ENDCLASS.
30.49697
110
0.564189
c8be3f69c171791edfe8a5389bac7d40aa19690c
6,077
abap
ABAP
src/zabapgit_page.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
src/zabapgit_page.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
src/zabapgit_page.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Include ZABAPGIT_PAGE *&---------------------------------------------------------------------* *----------------------------------------------------------------------* * INTERFACE lif_gui_page DEFINITION *----------------------------------------------------------------------* INTERFACE lif_gui_page. METHODS on_event IMPORTING iv_action TYPE clike iv_prev_page TYPE clike iv_getdata TYPE clike OPTIONAL it_postdata TYPE cnht_post_data_tab OPTIONAL EXPORTING ei_page TYPE REF TO lif_gui_page ev_state TYPE i RAISING lcx_exception lcx_cancel. METHODS render RETURNING VALUE(ro_html) TYPE REF TO lcl_html RAISING lcx_exception. ENDINTERFACE. CLASS lcl_gui_page DEFINITION ABSTRACT. PUBLIC SECTION. INTERFACES lif_gui_page. PROTECTED SECTION. TYPES: BEGIN OF ty_control, redirect_url TYPE string, page_title TYPE string, page_menu TYPE REF TO lcl_html_toolbar, END OF ty_control. DATA: ms_control TYPE ty_control. METHODS render_content ABSTRACT RETURNING VALUE(ro_html) TYPE REF TO lcl_html RAISING lcx_exception. METHODS scripts RETURNING VALUE(ro_html) TYPE REF TO lcl_html RAISING lcx_exception. PRIVATE SECTION. METHODS html_head RETURNING VALUE(ro_html) TYPE REF TO lcl_html. METHODS title RETURNING VALUE(ro_html) TYPE REF TO lcl_html. METHODS footer RETURNING VALUE(ro_html) TYPE REF TO lcl_html. METHODS redirect RETURNING VALUE(ro_html) TYPE REF TO lcl_html. ENDCLASS. "lcl_gui_page CLASS lcl_gui_page IMPLEMENTATION. METHOD html_head. CREATE OBJECT ro_html. ro_html->add( '<head>' ). "#EC NOTEXT ro_html->add( '<meta http-equiv="content-type" content="text/html; charset=utf-8">' ). "#EC NOTEXT ro_html->add( '<meta http-equiv="X-UA-Compatible" content="IE=11,10,9,8" />' ). "#EC NOTEXT ro_html->add( '<title>abapGit</title>' ). "#EC NOTEXT ro_html->add( '<link rel="stylesheet" type="text/css" href="css/common.css">' ). ro_html->add( '<script type="text/javascript" src="js/common.js"></script>' ). "#EC NOTEXT ro_html->add( lcl_gui_asset_manager=>get_webfont_link( ) ). " Web fonts ro_html->add( '</head>' ). "#EC NOTEXT ENDMETHOD. "html_head METHOD title. CREATE OBJECT ro_html. ro_html->add( '<div id="header">' ). "#EC NOTEXT ro_html->add( '<table class="w100"><tr>' ). "#EC NOTEXT ro_html->add( |<td class="logo">{ lcl_html=>a( iv_txt = '<img src="img/logo" alt="logo">' iv_act = gc_action-abapgit_home ) }</td>| ). "#EC NOTEXT ro_html->add( |<td class="headpad"><span class="page_title"> &#x25BA; { ms_control-page_title }</span></td>| ). "#EC NOTEXT IF ms_control-page_menu IS BOUND. ro_html->add( '<td class="headpad right">' ). "#EC NOTEXT ro_html->add( ms_control-page_menu->render( ) ). ro_html->add( '</td>' ). "#EC NOTEXT ENDIF. ro_html->add( '</tr></table>' ). "#EC NOTEXT ro_html->add( '</div>' ). "#EC NOTEXT ENDMETHOD. "render page title METHOD footer. CREATE OBJECT ro_html. ro_html->add( '<div id="footer">' ). "#EC NOTEXT ro_html->add( '<img src="img/logo" alt="logo">' ). "#EC NOTEXT ro_html->add( '<table class="w100"><tr>' ). "#EC NOTEXT ro_html->add( '<td class="w40"></td>' ). "#EC NOTEXT ro_html->add( |<td><span class="version">{ gc_abap_version }</span></td>| ). "#EC NOTEXT ro_html->add( '<td id="debug-output" class="w40"></td>' ). "#EC NOTEXT ro_html->add( '</tr></table>' ). "#EC NOTEXT ro_html->add( '</div>' ). "#EC NOTEXT ENDMETHOD. "footer METHOD redirect. CREATE OBJECT ro_html. ro_html->add( '<!DOCTYPE html>' ). "#EC NOTEXT ro_html->add( '<html>' ). "#EC NOTEXT ro_html->add( '<head>' ). "#EC NOTEXT ro_html->add( |<meta http-equiv="refresh" content="0; url={ ms_control-redirect_url }">| ). "#EC NOTEXT ro_html->add( '</head>'). "#EC NOTEXT ro_html->add( '</html>'). "#EC NOTEXT ENDMETHOD. METHOD scripts. ASSERT 1 = 1. " Dummy ENDMETHOD. "scripts METHOD lif_gui_page~on_event. ev_state = gc_event_state-not_handled. ENDMETHOD. "lif_gui_page~on_event METHOD lif_gui_page~render. DATA lo_script TYPE REF TO lcl_html. " Redirect IF ms_control-redirect_url IS NOT INITIAL. ro_html = redirect( ). RETURN. ENDIF. " Real page CREATE OBJECT ro_html. ro_html->add( '<!DOCTYPE html>' ). "#EC NOTEXT ro_html->add( '<html>' ). "#EC NOTEXT ro_html->add( html_head( ) ). ro_html->add( '<body>' ). "#EC NOTEXT ro_html->add( title( ) ). ro_html->add( render_content( ) ). ro_html->add( footer( ) ). ro_html->add( '</body>' ). "#EC NOTEXT lo_script = scripts( ). IF lo_script IS BOUND AND lo_script->is_empty( ) = abap_false. ro_html->add( '<script type="text/javascript">' ). ro_html->add( lo_script ). ro_html->add( 'confirmInitialized();' ). ro_html->add( '</script>' ). ENDIF. ro_html->add( '</html>'). "#EC NOTEXT ENDMETHOD. " lif_gui_page~render. ENDCLASS. "lcl_gui_page
32.324468
102
0.519006
c8c55aa8050332ae367a5e6192e52063a619312d
10,639
abap
ABAP
src/zcl_abapgit_repo_online.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
src/zcl_abapgit_repo_online.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
src/zcl_abapgit_repo_online.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_repo_online DEFINITION PUBLIC INHERITING FROM zcl_abapgit_repo FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_git_operations . ALIASES create_branch FOR zif_abapgit_git_operations~create_branch . ALIASES push FOR zif_abapgit_git_operations~push . METHODS get_url RETURNING VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-url . METHODS get_branch_name RETURNING VALUE(rv_name) TYPE zif_abapgit_persistence=>ty_repo-branch_name . METHODS set_url IMPORTING !iv_url TYPE zif_abapgit_persistence=>ty_repo-url RAISING zcx_abapgit_exception . METHODS set_branch_name IMPORTING !iv_branch_name TYPE zif_abapgit_persistence=>ty_repo-branch_name RAISING zcx_abapgit_exception . METHODS get_sha1_remote RETURNING VALUE(rv_sha1) TYPE zif_abapgit_definitions=>ty_sha1 RAISING zcx_abapgit_exception . METHODS get_objects RETURNING VALUE(rt_objects) TYPE zif_abapgit_definitions=>ty_objects_tt RAISING zcx_abapgit_exception . METHODS get_unnecessary_local_objs RETURNING VALUE(rt_unnecessary_local_objects) TYPE zif_abapgit_definitions=>ty_tadir_tt RAISING zcx_abapgit_exception . METHODS get_files_remote REDEFINITION . METHODS get_name REDEFINITION . METHODS rebuild_local_checksums REDEFINITION . METHODS has_remote_source REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. DATA mt_objects TYPE zif_abapgit_definitions=>ty_objects_tt . DATA mv_branch TYPE zif_abapgit_definitions=>ty_sha1 . METHODS handle_stage_ignore IMPORTING !io_stage TYPE REF TO zcl_abapgit_stage RAISING zcx_abapgit_exception . METHODS set_objects IMPORTING !it_objects TYPE zif_abapgit_definitions=>ty_objects_tt RAISING zcx_abapgit_exception . METHODS fetch_remote RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION. METHOD fetch_remote. DATA: lo_progress TYPE REF TO zcl_abapgit_progress, ls_pull TYPE zcl_abapgit_git_porcelain=>ty_pull_result. IF mv_request_remote_refresh = abap_false. RETURN. ENDIF. CREATE OBJECT lo_progress EXPORTING iv_total = 1. lo_progress->show( iv_current = 1 iv_text = 'Fetch remote files' ) ##NO_TEXT. ls_pull = zcl_abapgit_git_porcelain=>pull( iv_url = get_url( ) iv_branch_name = get_branch_name( ) ). set_files_remote( ls_pull-files ). set_objects( ls_pull-objects ). mv_branch = ls_pull-branch. ENDMETHOD. METHOD get_branch_name. rv_name = ms_data-branch_name. ENDMETHOD. METHOD get_files_remote. fetch_remote( ). rt_files = super->get_files_remote( ). ENDMETHOD. METHOD get_name. rv_name = zcl_abapgit_url=>name( ms_data-url ). rv_name = cl_http_utility=>if_http_utility~unescape_url( rv_name ). ENDMETHOD. METHOD get_objects. fetch_remote( ). rt_objects = mt_objects. ENDMETHOD. METHOD get_sha1_remote. fetch_remote( ). rv_sha1 = mv_branch. ENDMETHOD. METHOD get_unnecessary_local_objs. DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, lt_tadir_unique TYPE HASHED TABLE OF zif_abapgit_definitions=>ty_tadir WITH UNIQUE KEY pgmid object obj_name, lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, lt_remote TYPE zif_abapgit_definitions=>ty_files_tt, lt_status TYPE zif_abapgit_definitions=>ty_results_tt, lv_package TYPE zif_abapgit_persistence=>ty_repo-package. FIELD-SYMBOLS: <ls_status> TYPE zif_abapgit_definitions=>ty_result, <ls_tadir> TYPE zif_abapgit_definitions=>ty_tadir. " delete objects which are added locally but are not in remote repo lt_local = get_files_local( ). lt_remote = get_files_remote( ). lt_status = status( ). lv_package = get_package( ). lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( lv_package ). SORT lt_tadir BY pgmid ASCENDING object ASCENDING obj_name ASCENDING devclass ASCENDING. LOOP AT lt_status ASSIGNING <ls_status> WHERE lstate = zif_abapgit_definitions=>c_state-added. READ TABLE lt_tadir ASSIGNING <ls_tadir> WITH KEY pgmid = 'R3TR' object = <ls_status>-obj_type obj_name = <ls_status>-obj_name devclass = <ls_status>-package BINARY SEARCH. IF sy-subrc <> 0. * skip objects that does not exist locally CONTINUE. ENDIF. INSERT <ls_tadir> INTO TABLE lt_tadir_unique. ENDLOOP. rt_unnecessary_local_objects = lt_tadir_unique. ENDMETHOD. METHOD get_url. rv_url = ms_data-url. ENDMETHOD. METHOD handle_stage_ignore. DATA: lv_add TYPE abap_bool, lo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit, lt_stage TYPE zcl_abapgit_stage=>ty_stage_tt. FIELD-SYMBOLS: <ls_stage> LIKE LINE OF lt_stage. lo_dot_abapgit = get_dot_abapgit( ). lt_stage = io_stage->get_all( ). LOOP AT lt_stage ASSIGNING <ls_stage> WHERE method = zcl_abapgit_stage=>c_method-ignore. lo_dot_abapgit->add_ignore( iv_path = <ls_stage>-file-path iv_filename = <ls_stage>-file-filename ). " remove it from the staging object, as the action is handled here io_stage->reset( iv_path = <ls_stage>-file-path iv_filename = <ls_stage>-file-filename ). lv_add = abap_true. ENDLOOP. IF lv_add = abap_true. io_stage->add( iv_path = zif_abapgit_definitions=>c_root_dir iv_filename = zif_abapgit_definitions=>c_dot_abapgit iv_data = lo_dot_abapgit->serialize( ) ). set_dot_abapgit( lo_dot_abapgit ). ENDIF. ENDMETHOD. METHOD has_remote_source. rv_yes = abap_true. ENDMETHOD. METHOD rebuild_local_checksums. " TODO: method unify to base class ! DATA: lt_remote TYPE zif_abapgit_definitions=>ty_files_tt, lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, ls_last_item TYPE zif_abapgit_definitions=>ty_item, lt_checksums TYPE zif_abapgit_persistence=>ty_local_checksum_tt. FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums, <ls_file_sig> LIKE LINE OF <ls_checksum>-files, <ls_remote> LIKE LINE OF lt_remote, <ls_local> LIKE LINE OF lt_local. lt_local = get_files_local( ). DELETE lt_local " Remove non-code related files except .abapgit WHERE item IS INITIAL AND NOT ( file-path = zif_abapgit_definitions=>c_root_dir AND file-filename = zif_abapgit_definitions=>c_dot_abapgit ). SORT lt_local BY item. lt_remote = get_files_remote( ). SORT lt_remote BY path filename. LOOP AT lt_local ASSIGNING <ls_local>. IF ls_last_item <> <ls_local>-item OR sy-tabix = 1. " First or New item reached ? APPEND INITIAL LINE TO lt_checksums ASSIGNING <ls_checksum>. <ls_checksum>-item = <ls_local>-item. ls_last_item = <ls_local>-item. ENDIF. READ TABLE lt_remote ASSIGNING <ls_remote> WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename BINARY SEARCH. CHECK sy-subrc = 0. " Ignore new local ones APPEND INITIAL LINE TO <ls_checksum>-files ASSIGNING <ls_file_sig>. MOVE-CORRESPONDING <ls_local>-file TO <ls_file_sig>. " If hashes are equal -> local sha1 is OK " Else if R-branch is ahead -> assume changes were remote, state - local sha1 " Else (branches equal) -> assume changes were local, state - remote sha1 IF <ls_local>-file-sha1 <> <ls_remote>-sha1. <ls_file_sig>-sha1 = <ls_remote>-sha1. ENDIF. ENDLOOP. set( it_checksums = lt_checksums ). reset_status( ). ENDMETHOD. METHOD set_branch_name. IF ms_data-local_settings-write_protected = abap_true. zcx_abapgit_exception=>raise( 'Cannot switch branch. Local code is write-protected by repo config' ). ENDIF. reset_remote( ). set( iv_branch_name = iv_branch_name ). ENDMETHOD. METHOD set_objects. mt_objects = it_objects. ENDMETHOD. METHOD set_url. IF ms_data-local_settings-write_protected = abap_true. zcx_abapgit_exception=>raise( 'Cannot change URL. Local code is write-protected by repo config' ). ENDIF. reset_remote( ). set( iv_url = iv_url ). ENDMETHOD. METHOD zif_abapgit_git_operations~create_branch. DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1. ASSERT iv_name CP 'refs/heads/+*'. IF iv_from IS INITIAL. lv_sha1 = get_sha1_remote( ). ELSE. lv_sha1 = iv_from. ENDIF. zcl_abapgit_git_porcelain=>create_branch( iv_url = get_url( ) iv_name = iv_name iv_from = lv_sha1 ). " automatically switch to new branch set_branch_name( iv_name ). ENDMETHOD. METHOD zif_abapgit_git_operations~push. * assumption: PUSH is done on top of the currently selected branch DATA: ls_push TYPE zcl_abapgit_git_porcelain=>ty_push_result, lv_text TYPE string. IF ms_data-branch_name CP 'refs/tags*'. lv_text = |You're working on a tag. Currently it's not | && |possible to push on tags. Consider creating a branch instead|. zcx_abapgit_exception=>raise( lv_text ). ENDIF. IF ms_data-local_settings-block_commit = abap_true AND mv_code_inspector_successful = abap_false. zcx_abapgit_exception=>raise( |A successful code inspection is required| ). ENDIF. handle_stage_ignore( io_stage ). ls_push = zcl_abapgit_git_porcelain=>push( is_comment = is_comment io_stage = io_stage iv_branch_name = get_branch_name( ) iv_url = get_url( ) iv_parent = get_sha1_remote( ) it_old_objects = get_objects( ) ). set_objects( ls_push-new_objects ). set_files_remote( ls_push-new_files ). mv_branch = ls_push-branch. update_local_checksums( ls_push-updated_files ). reset_status( ). CLEAR: mv_code_inspector_successful. ENDMETHOD. ENDCLASS.
27.923885
107
0.672432
c8c74e45df8c7858ec455eda0969e8071cb641ad
9,165
abap
ABAP
src/ui/zcl_abapgit_tag_popups.clas.abap
geert-janklaps/abapGit
14d2db23f6144470845503d8766a67d55442d9a0
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_tag_popups.clas.abap
geert-janklaps/abapGit
14d2db23f6144470845503d8766a67d55442d9a0
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_tag_popups.clas.abap
geert-janklaps/abapGit
14d2db23f6144470845503d8766a67d55442d9a0
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_tag_popups DEFINITION PUBLIC FINAL CREATE PRIVATE GLOBAL FRIENDS zcl_abapgit_ui_factory. PUBLIC SECTION. INTERFACES: zif_abapgit_tag_popups. PRIVATE SECTION. TYPES: BEGIN OF ty_tag_out. INCLUDE TYPE zif_abapgit_definitions=>ty_git_tag. TYPES: body_icon TYPE icon_d, END OF ty_tag_out, tty_tag_out TYPE STANDARD TABLE OF ty_tag_out WITH NON-UNIQUE DEFAULT KEY. DATA: mt_tags TYPE tty_tag_out, mo_docking_container TYPE REF TO cl_gui_docking_container, mo_text_control TYPE REF TO cl_gui_textedit. METHODS: on_double_click FOR EVENT double_click OF cl_salv_events_table IMPORTING row column, prepare_tags_for_display IMPORTING it_tags TYPE zif_abapgit_definitions=>ty_git_tag_list_tt RETURNING VALUE(rt_tags_out) TYPE zcl_abapgit_tag_popups=>tty_tag_out, clean_up, show_docking_container_with IMPORTING iv_text TYPE string. ENDCLASS. CLASS ZCL_ABAPGIT_TAG_POPUPS IMPLEMENTATION. METHOD clean_up. IF mo_text_control IS BOUND. mo_text_control->finalize( ). mo_text_control->free( EXCEPTIONS cntl_error = 1 cntl_system_error = 2 OTHERS = 3 ). ASSERT sy-subrc = 0. CLEAR: mo_text_control. ENDIF. IF mo_docking_container IS BOUND. mo_docking_container->finalize( ). mo_docking_container->free( EXCEPTIONS cntl_error = 1 cntl_system_error = 2 OTHERS = 3 ). ASSERT sy-subrc = 0. CLEAR: mo_docking_container. ENDIF. ENDMETHOD. METHOD on_double_click. FIELD-SYMBOLS: <ls_tag> TYPE ty_tag_out. READ TABLE mt_tags ASSIGNING <ls_tag> INDEX row. IF sy-subrc <> 0 OR <ls_tag>-body IS INITIAL. RETURN. ENDIF. show_docking_container_with( <ls_tag>-body ). ENDMETHOD. METHOD prepare_tags_for_display. DATA: ls_tag_out LIKE LINE OF rt_tags_out. FIELD-SYMBOLS: <ls_tag> TYPE zif_abapgit_definitions=>ty_git_tag. LOOP AT it_tags ASSIGNING <ls_tag>. CLEAR: ls_tag_out. MOVE-CORRESPONDING <ls_tag> TO ls_tag_out. ls_tag_out-name = zcl_abapgit_git_tag=>remove_tag_prefix( ls_tag_out-name ). IF ls_tag_out-body IS NOT INITIAL. ls_tag_out-body_icon = |{ icon_display_text }|. ENDIF. INSERT ls_tag_out INTO TABLE rt_tags_out. ENDLOOP. ENDMETHOD. METHOD show_docking_container_with. IF mo_docking_container IS NOT BOUND. CREATE OBJECT mo_docking_container EXPORTING side = cl_gui_docking_container=>dock_at_bottom extension = 120 EXCEPTIONS cntl_error = 1 cntl_system_error = 2 create_error = 3 lifetime_error = 4 lifetime_dynpro_dynpro_link = 5 OTHERS = 6. ASSERT sy-subrc = 0. ENDIF. IF mo_text_control IS NOT BOUND. CREATE OBJECT mo_text_control EXPORTING parent = mo_docking_container EXCEPTIONS error_cntl_create = 1 error_cntl_init = 2 error_cntl_link = 3 error_dp_create = 4 gui_type_not_supported = 5 OTHERS = 6. ASSERT sy-subrc = 0. mo_text_control->set_readonly_mode( EXCEPTIONS error_cntl_call_method = 1 invalid_parameter = 2 OTHERS = 3 ). ASSERT sy-subrc = 0. ENDIF. mo_text_control->set_textstream( EXPORTING text = iv_text EXCEPTIONS error_cntl_call_method = 1 not_supported_by_gui = 2 OTHERS = 3 ). ASSERT sy-subrc = 0. ENDMETHOD. METHOD zif_abapgit_tag_popups~tag_list_popup. DATA: lo_alv TYPE REF TO cl_salv_table, lo_table_header TYPE REF TO cl_salv_form_header_info, lo_columns TYPE REF TO cl_salv_columns_table, lx_alv TYPE REF TO cx_salv_error, lt_tags TYPE zif_abapgit_definitions=>ty_git_tag_list_tt, lo_event TYPE REF TO cl_salv_events_table. CLEAR: mt_tags. lt_tags = zcl_abapgit_factory=>get_branch_overview( io_repo )->get_tags( ). IF lines( lt_tags ) = 0. zcx_abapgit_exception=>raise( `There are no tags for this repository` ). ENDIF. mt_tags = prepare_tags_for_display( lt_tags ). TRY. cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv CHANGING t_table = mt_tags ). lo_columns = lo_alv->get_columns( ). lo_columns->get_column( `TYPE` )->set_technical( ). lo_columns->get_column( `DISPLAY_NAME` )->set_technical( ). lo_columns->get_column( `BODY` )->set_technical( ). lo_columns->get_column( `NAME` )->set_medium_text( 'Tag name' ). lo_columns->set_column_position( columnname = 'NAME' position = 1 ). lo_columns->get_column( `TAGGER_NAME` )->set_medium_text( 'Tagger' ). lo_columns->set_column_position( columnname = 'TAGGER_NAME' position = 2 ). lo_columns->get_column( `TAGGER_EMAIL` )->set_medium_text( 'Tagger E-Mail' ). lo_columns->set_column_position( columnname = 'TAGGER_EMAIL' position = 3 ). lo_columns->get_column( `MESSAGE` )->set_medium_text( 'Tag message' ). lo_columns->set_column_position( columnname = 'MESSAGE' position = 4 ). lo_columns->get_column( `BODY_ICON` )->set_medium_text( 'Body' ). lo_columns->get_column( `BODY_ICON` )->set_output_length( 4 ). lo_columns->set_column_position( columnname = 'BODY_ICON' position = 5 ). lo_columns->get_column( `SHA1` )->set_output_length( 15 ). lo_columns->get_column( `SHA1` )->set_medium_text( 'SHA' ). lo_columns->set_column_position( columnname = 'SHA1' position = 6 ). lo_columns->get_column( `OBJECT` )->set_output_length( 15 ). lo_columns->get_column( `OBJECT` )->set_medium_text( 'Object' ). lo_columns->set_column_position( columnname = 'OBJECT' position = 7 ). lo_columns->set_optimize( ). lo_alv->set_screen_popup( start_column = 7 end_column = 200 start_line = 1 end_line = 25 ). CREATE OBJECT lo_table_header EXPORTING text = `Tags`. lo_alv->set_top_of_list( lo_table_header ). lo_event = lo_alv->get_event( ). SET HANDLER on_double_click FOR lo_event. lo_alv->display( ). CATCH cx_salv_error INTO lx_alv. zcx_abapgit_exception=>raise( lx_alv->get_text( ) ). ENDTRY. clean_up( ). ENDMETHOD. METHOD zif_abapgit_tag_popups~tag_select_popup. DATA: lt_tags TYPE zif_abapgit_definitions=>ty_git_tag_list_tt, lv_answer TYPE c LENGTH 1, lt_selection TYPE TABLE OF spopli, lv_name_with_prefix TYPE string. FIELD-SYMBOLS: <ls_sel> LIKE LINE OF lt_selection, <ls_tag> LIKE LINE OF lt_tags. lt_tags = zcl_abapgit_factory=>get_branch_overview( io_repo )->get_tags( ). IF lines( lt_tags ) = 0. zcx_abapgit_exception=>raise( `There are no tags for this repository` ). ENDIF. LOOP AT lt_tags ASSIGNING <ls_tag>. INSERT INITIAL LINE INTO lt_selection INDEX 1 ASSIGNING <ls_sel>. <ls_sel>-varoption = zcl_abapgit_git_tag=>remove_tag_prefix( <ls_tag>-name ). ENDLOOP. CALL FUNCTION 'POPUP_TO_DECIDE_LIST' EXPORTING textline1 = 'Select tag' titel = 'Select tag' start_col = 30 start_row = 5 IMPORTING answer = lv_answer TABLES t_spopli = lt_selection EXCEPTIONS not_enough_answers = 1 too_much_answers = 2 too_much_marks = 3 OTHERS = 4. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from POPUP_TO_DECIDE_LIST' ). ENDIF. IF lv_answer = 'A'. RETURN. ENDIF. READ TABLE lt_selection ASSIGNING <ls_sel> WITH KEY selflag = abap_true. ASSERT sy-subrc = 0. lv_name_with_prefix = zcl_abapgit_git_tag=>add_tag_prefix( <ls_sel>-varoption ). READ TABLE lt_tags ASSIGNING <ls_tag> WITH KEY name = lv_name_with_prefix. ASSERT sy-subrc = 0. rs_tag = <ls_tag>. ENDMETHOD. ENDCLASS.
28.462733
85
0.587561
c8c75f38059c591dd17b6476c75ade54fc36b811
211
abap
ABAP
src/ze_arsh_sdhi.enho.07612c09.abap
boy0korea/ALL_ROUND_SEARCH_HELP
f5ba8ab0c8266918cf4faf2d89a35378a68d4a9c
[ "MIT" ]
null
null
null
src/ze_arsh_sdhi.enho.07612c09.abap
boy0korea/ALL_ROUND_SEARCH_HELP
f5ba8ab0c8266918cf4faf2d89a35378a68d4a9c
[ "MIT" ]
null
null
null
src/ze_arsh_sdhi.enho.07612c09.abap
boy0korea/ALL_ROUND_SEARCH_HELP
f5ba8ab0c8266918cf4faf2d89a35378a68d4a9c
[ "MIT" ]
null
null
null
"Name: \PR:SAPLSDHI\FO:SET_HELP_INFO_FROM_FOCUS\SE:END\EI ENHANCEMENT 0 ZE_ARSH_SDHI. * MEMORY ID 'CALLFIELD'. CALL FUNCTION 'ZARSH_EXPORT_CALLFIELD' CHANGING help_info = help_info. ENDENHANCEMENT.
23.444444
57
0.767773
c8c85e66634ec6c10145beae2a6706473264ea9c
227
abap
ABAP
src/unmanaged/#dmo#bp_booking_u18.clas.abap
SAP-Cloud-Platform/flight18
8e20ebbb832f8a27465c5a191fd45e773b3efee2
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u18.clas.abap
SAP-Cloud-Platform/flight18
8e20ebbb832f8a27465c5a191fd45e773b3efee2
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u18.clas.abap
SAP-Cloud-Platform/flight18
8e20ebbb832f8a27465c5a191fd45e773b3efee2
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/bp_booking_u18 DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF /dmo/i_travel_u18 . PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /dmo/bp_booking_u18 IMPLEMENTATION. ENDCLASS.
14.1875
41
0.76652
c8ce086967c1455662fa322cb9febbd554dec4df
1,332
abap
ABAP
src/data/zcl_csr_8859_7.clas.abap
sandraros/abap-CSR
8023f26fa8764f389e90f8a546e00fcc1b5d9c75
[ "MIT" ]
1
2020-01-10T03:29:48.000Z
2020-01-10T03:29:48.000Z
src/data/zcl_csr_8859_7.clas.abap
sandraros/abap-CSR
8023f26fa8764f389e90f8a546e00fcc1b5d9c75
[ "MIT" ]
null
null
null
src/data/zcl_csr_8859_7.clas.abap
sandraros/abap-CSR
8023f26fa8764f389e90f8a546e00fcc1b5d9c75
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en"></p> "! CLASS zcl_csr_8859_7 DEFINITION PUBLIC INHERITING FROM zcl_csr_sbcs ABSTRACT CREATE PUBLIC . PUBLIC SECTION. METHODS constructor . METHODS get_name REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_csr_8859_7 IMPLEMENTATION. METHOD constructor. super->constructor( ). CONCATENATE '2020202020202020' '2020202020202020' '2020202020202020' '2020202020202020' '2020202020202000' '2020202020202020' '2020202020202020' '2020202020202020' '2061626364656667' '68696A6B6C6D6E6F' '7071727374757677' '78797A2020202020' '2061626364656667' '68696A6B6C6D6E6F' '7071727374757677' '78797A2020202020' '2020202020202020' '2020202020202020' '2020202020202020' '2020202020202020' '20A1A22020202020' '2020202020202020' '202020202020DC20' 'DDDEDF20FC20FDFE' 'C0E1E2E3E4E5E6E7' 'E8E9EAEBECEDEEEF' 'F0F120F3F4F5F6F7' 'F8F9FAFBDCDDDEDF' 'E0E1E2E3E4E5E6E7' 'E8E9EAEBECEDEEEF' 'F0F1F2F3F4F5F6F7' 'F8F9FAFBFCFDFE20' INTO charmap. ENDMETHOD. METHOD get_name. IF have_c1_bytes = abap_true. name = 'windows-1253'. ELSE. name = 'ISO-8859-7'. ENDIF. ENDMETHOD. ENDCLASS.
17.298701
51
0.683934
c8d1d27476b365122aa7690202cfc49937160fc6
21,122
abap
ABAP
src/objects/zcl_abapgit_object_udmo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
1
2020-08-05T05:25:41.000Z
2020-08-05T05:25:41.000Z
src/objects/zcl_abapgit_object_udmo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_udmo.clas.abap
goreraks/abapGit
e4bafbe7159650d0a465bb6584f950e4add6b21f
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_udmo DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . METHODS constructor IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_language TYPE spras . PROTECTED SECTION. METHODS corr_insert REDEFINITION . PRIVATE SECTION. TYPES: " You are reminded that the text serialisation / de-serialisation methods depend upon a common type. " To make the dependency explicit, there is one common definition. BEGIN OF ty_udmo_text_type. TYPES sprache TYPE dm40t-sprache. TYPES dmoid TYPE dm40t-dmoid. TYPES langbez TYPE dm40t-langbez. TYPES as4local TYPE dm40t-as4local. TYPES END OF ty_udmo_text_type . DATA mv_data_model TYPE uddmodl . DATA mv_text_object TYPE doku_obj . DATA mv_lxe_text_name TYPE lxeobjname . DATA mv_activation_state TYPE as4local . DATA ms_object_type TYPE rsdeo . CONSTANTS c_transport_object_class TYPE trobjtype VALUE 'SUDM' ##NO_TEXT. CONSTANTS c_lxe_text_type TYPE lxeobjtype VALUE 'IM' ##NO_TEXT. CONSTANTS c_correction_object_type TYPE rsdeo-objtype VALUE 'UDMO' ##NO_TEXT. CONSTANTS c_active_state TYPE as4local VALUE 'A' ##NO_TEXT. METHODS is_name_permitted RAISING zcx_abapgit_exception . METHODS update_tree . METHODS serialize_short_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_short_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_long_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_long_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_entities IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_entities IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS access_modify RETURNING VALUE(rv_result) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS access_free RETURNING VALUE(rv_result) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS deserialize_model IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_model IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_UDMO IMPLEMENTATION. METHOD access_free. " Release the lock on the object. CALL FUNCTION 'RS_ACCESS_PERMISSION' EXPORTING mode = 'FREE' object = me->ms_object_type object_class = me->c_transport_object_class EXCEPTIONS canceled_in_corr = 1 enqueued_by_user = 2 enqueue_system_failure = 3 illegal_parameter_values = 4 locked_by_author = 5 no_modify_permission = 6 no_show_permission = 7 permission_failure = 8 request_language_denied = 9 OTHERS = 10. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ELSE. rv_result = abap_true. ENDIF. ENDMETHOD. METHOD access_modify. * You are reminded that mode modify is the same as insert, with one important difference: * Mode INSERT is intended for newly created objects, for which a TADIR entry does not yet * exist. In that case, the system shows a pop-up for the entry of the package, which isn't * desirable when the SAPGUI is not available. * In the context of abapGit, the package is known. CALL FUNCTION 'RS_ACCESS_PERMISSION' EXPORTING authority_check = abap_true global_lock = abap_true mode = 'MODIFY' object = me->ms_object_type object_class = me->c_transport_object_class EXCEPTIONS canceled_in_corr = 1 enqueued_by_user = 2 enqueue_system_failure = 3 illegal_parameter_values = 4 locked_by_author = 5 no_modify_permission = 6 no_show_permission = 7 permission_failure = 8 request_language_denied = 9 OTHERS = 10. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ELSE. rv_result = abap_true. ENDIF. ENDMETHOD. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). " Conversion to Data model me->mv_data_model = is_item-obj_name. " Default activation state is active me->mv_activation_state = c_active_state. " Derive the data model's text object mv_text_object = 'UDMD' && is_item-obj_name. " And set the text object to active mv_text_object+30(1) = mv_activation_state. mv_lxe_text_name = mv_text_object. " Correction and Transport System object me->ms_object_type-objtype = c_correction_object_type. me->ms_object_type-objname = is_item-obj_name. ENDMETHOD. METHOD corr_insert. " You are reminded that SUDM - Data Model has no part objects e.g. no LIMU " Therefore global lock is always appropriate " You are reminded that the master language (in TADIR) is taken from MV_LANGUAGE. CALL FUNCTION 'RS_CORR_INSERT' EXPORTING object = me->ms_object_type object_class = me->c_transport_object_class devclass = iv_package master_language = mv_language mode = 'INSERT' global_lock = abap_true suppress_dialog = abap_true EXCEPTIONS cancelled = 1 permission_failure = 2 unknown_objectclass = 3 OTHERS = 4. IF sy-subrc = 1. zcx_abapgit_exception=>raise( 'Cancelled' ). ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from RS_CORR_INSERT' ). ENDIF. ENDMETHOD. METHOD deserialize_entities. DATA lt_udmo_entities TYPE STANDARD TABLE OF dm41s WITH DEFAULT KEY. DATA ls_udmo_entity LIKE LINE OF lt_udmo_entities. io_xml->read( EXPORTING iv_name = 'UDMO_ENTITIES' CHANGING cg_data = lt_udmo_entities ). LOOP AT lt_udmo_entities INTO ls_udmo_entity. CALL FUNCTION 'SDU_DMO_ENT_PUT' EXPORTING object = ls_udmo_entity EXCEPTIONS ret_code = 0 OTHERS = 0. ENDLOOP. ENDMETHOD. METHOD deserialize_long_texts. DATA BEGIN OF ls_udmo_long_text. DATA language TYPE dm40t-sprache. DATA header TYPE thead. DATA content TYPE xstring. DATA END OF ls_udmo_long_text. DATA lt_udmo_long_texts LIKE STANDARD TABLE OF ls_udmo_long_text. DATA ls_header TYPE thead. io_xml->read( EXPORTING iv_name = 'UDMO_LONG_TEXTS' CHANGING cg_data = lt_udmo_long_texts ). LOOP AT lt_udmo_long_texts INTO ls_udmo_long_text. ls_udmo_long_text-header-tdfuser = sy-uname. ls_udmo_long_text-header-tdfdate = sy-datum. ls_udmo_long_text-header-tdftime = sy-uzeit. " You are reminded that the target system may already have some texts in " existence. So we determine the highest existent version. CLEAR ls_header-tdversion. SELECT MAX( dokversion ) INTO ls_header-tdversion FROM dokhl WHERE id = me->c_lxe_text_type AND object = me->mv_text_object AND langu = ls_udmo_long_text-language. " Increment the version ls_header-tdversion = ls_header-tdversion + 1. ls_udmo_long_text-header-tdversion = ls_header-tdversion. " This function module takes care of the variation in text processing between various objects. CALL FUNCTION 'LXE_OBJ_DOKU_PUT_XSTRING' EXPORTING slang = me->mv_language tlang = ls_udmo_long_text-language objtype = me->c_lxe_text_type objname = me->mv_lxe_text_name header = ls_udmo_long_text-header content = ls_udmo_long_text-content. ENDLOOP. ENDMETHOD. METHOD deserialize_model. DATA ls_dm40l TYPE dm40l. io_xml->read( EXPORTING iv_name = 'DM40L' CHANGING cg_data = ls_dm40l ). " See SDU_MODEL_PUT GET TIME. ls_dm40l-flg_frame = abap_true. ls_dm40l-fstdate = sy-datum. ls_dm40l-fsttime = sy-uzeit. ls_dm40l-fstuser = sy-uname. ls_dm40l-lstdate = sy-datum. ls_dm40l-lsttime = sy-uzeit. ls_dm40l-lstuser = sy-uname. MODIFY dm40l FROM ls_dm40l. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SDU_MODEL_PUT' ). ENDIF. ENDMETHOD. METHOD deserialize_short_texts. DATA lt_udmo_texts TYPE STANDARD TABLE OF ty_udmo_text_type WITH DEFAULT KEY. DATA ls_udmo_text TYPE ty_udmo_text_type. DATA ls_dm40t TYPE dm40t. " Deserialize the XML io_xml->read( EXPORTING iv_name = 'UDMO_TEXTS' CHANGING cg_data = lt_udmo_texts ). " For every text provided LOOP AT lt_udmo_texts INTO ls_udmo_text. " Does the text already exist? This is the same logic as used " in the FM SDU_MODEL_PUT SELECT SINGLE * FROM dm40t INTO ls_dm40t WHERE sprache = ls_udmo_text-sprache AND dmoid = ls_udmo_text-dmoid AND as4local = me->mv_activation_state. IF sy-subrc = 0. " There is already an active description for this language " but the provided description differs IF ls_dm40t-langbez <> ls_udmo_text-langbez. ls_dm40t-langbez = ls_udmo_text-langbez. ls_dm40t-lstdate = sy-datum. ls_dm40t-lsttime = sy-uzeit. ls_dm40t-lstuser = sy-uname. MODIFY dm40t FROM ls_dm40t. ENDIF. ELSE. " There is no EXISTING active description in this language ls_dm40t-as4local = ls_udmo_text-as4local. ls_dm40t-dmoid = ls_udmo_text-dmoid. ls_dm40t-langbez = ls_udmo_text-langbez. ls_dm40t-lstdate = sy-datum. ls_dm40t-lsttime = sy-uzeit. ls_dm40t-lstuser = sy-uname. ls_dm40t-sprache = ls_udmo_text-sprache. INSERT dm40t FROM ls_dm40t. ENDIF. ENDLOOP. ENDMETHOD. METHOD is_name_permitted. " It is unlikely that a serialised data model will have a name that is not permitted. However " there may be reservations in TRESE which could prohibit the data model name. " So to be safe, we check. Tx SD11 does this check. CALL FUNCTION 'SDU_SAA_CHECK' EXPORTING obj_name = me->ms_object_type-objname obj_type = me->ms_object_type-objtype EXCEPTIONS wrong_type = 01. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD serialize_entities. DATA lt_udmo_entities TYPE STANDARD TABLE OF dm41s WITH DEFAULT KEY. FIELD-SYMBOLS <ls_udmo_entity> TYPE dm41s. SELECT * FROM dm41s INTO TABLE lt_udmo_entities WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state. LOOP AT lt_udmo_entities ASSIGNING <ls_udmo_entity>. " You are reminded that administrative information, such as last changed by user, date, time is not serialised. CLEAR <ls_udmo_entity>-lstuser. CLEAR <ls_udmo_entity>-lstdate. CLEAR <ls_udmo_entity>-lsttime. CLEAR <ls_udmo_entity>-fstuser. CLEAR <ls_udmo_entity>-fstdate. CLEAR <ls_udmo_entity>-fsttime. ENDLOOP. " You are reminded that descriptions in other languages do not have to be in existence, although they may. IF lines( lt_udmo_entities ) > 0. io_xml->add( iv_name = 'UDMO_ENTITIES' ig_data = lt_udmo_entities ). ENDIF. ENDMETHOD. METHOD serialize_long_texts. " The model has short texts in multiple languages. These are held in DM40T. " The model has a long description also in a master language, with other long descriptions " maintained as translations using SE63 Translation Editor. All of these long texts are held in DOK* TYPES BEGIN OF ls_language_type. TYPES language TYPE dm40t-sprache. TYPES END OF ls_language_type. DATA BEGIN OF ls_udmo_long_text. DATA language TYPE dm40t-sprache. DATA header TYPE thead. DATA content TYPE xstring. DATA END OF ls_udmo_long_text. DATA lt_udmo_long_texts LIKE STANDARD TABLE OF ls_udmo_long_text. DATA lt_udmo_languages TYPE STANDARD TABLE OF ls_language_type. DATA ls_udmo_language LIKE LINE OF lt_udmo_languages. DATA: lv_error_status TYPE lxestatprc. " In which languages are the short texts are maintained. SELECT sprache AS language FROM dm40t INTO TABLE lt_udmo_languages WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state ORDER BY sprache ASCENDING. "#EC CI_NOFIRST " For every language for which a short text is maintained, LOOP AT lt_udmo_languages INTO ls_udmo_language. CLEAR ls_udmo_long_text. CLEAR lv_error_status. ls_udmo_long_text-language = ls_udmo_language-language. " You are reminded that this function gets the most recent version of the texts. CALL FUNCTION 'LXE_OBJ_DOKU_GET_XSTRING' EXPORTING lang = ls_udmo_language-language objtype = me->c_lxe_text_type objname = me->mv_lxe_text_name IMPORTING header = ls_udmo_long_text-header content = ls_udmo_long_text-content pstatus = lv_error_status. CHECK lv_error_status = 'S'. "Success " Administrative information is not serialised CLEAR ls_udmo_long_text-header-tdfuser. CLEAR ls_udmo_long_text-header-tdfdate. CLEAR ls_udmo_long_text-header-tdftime. CLEAR ls_udmo_long_text-header-tdluser. CLEAR ls_udmo_long_text-header-tdldate. CLEAR ls_udmo_long_text-header-tdltime. APPEND ls_udmo_long_text TO lt_udmo_long_texts. ENDLOOP. " You are reminded that long texts do not have to be in existence IF lines( lt_udmo_long_texts ) > 0. io_xml->add( iv_name = 'UDMO_LONG_TEXTS' ig_data = lt_udmo_long_texts ). ENDIF. ENDMETHOD. METHOD serialize_model. DATA ls_dm40l TYPE dm40l. " See SDU_MODEL_GET. SELECT SINGLE * FROM dm40l INTO ls_dm40l WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from UDMO - model serialisation' ). ENDIF. " You are reminded that administrative data is not serialised. CLEAR ls_dm40l-lstdate. CLEAR ls_dm40l-lsttime. CLEAR ls_dm40l-lstuser. CLEAR ls_dm40l-fstdate. CLEAR ls_dm40l-fsttime. CLEAR ls_dm40l-fstuser. io_xml->add( iv_name = 'DM40L' ig_data = ls_dm40l ). ENDMETHOD. METHOD serialize_short_texts. DATA lt_udmo_texts TYPE STANDARD TABLE OF ty_udmo_text_type WITH DEFAULT KEY. " You are reminded that administrative information, such as last changed by user, date, time is not serialised. " You are reminded that active short texts of all (existent) languages are serialised. SELECT sprache dmoid as4local langbez FROM dm40t INTO CORRESPONDING FIELDS OF TABLE lt_udmo_texts WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state ORDER BY sprache ASCENDING. "#EC CI_NOFIRST " You are reminded that descriptions in other languages do not have to be in existence. IF lines( lt_udmo_texts ) > 0. io_xml->add( iv_name = 'UDMO_TEXTS' ig_data = lt_udmo_texts ). ENDIF. ENDMETHOD. METHOD update_tree. CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT' EXPORTING object = me->mv_data_model operation = 'INSERT' type = me->c_correction_object_type. ENDMETHOD. METHOD zif_abapgit_object~changed_by. SELECT SINGLE lstuser INTO rv_user FROM dm40l WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state. IF sy-subrc <> 0. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. * You are reminded that this function model checks for * - permissions * - locks * - connection to transport and correction system * - deletion of data model, model relations and all documentation * - update of object tree * - releasing of lock CALL FUNCTION 'RPY_DATAMODEL_DELETE' EXPORTING model_name = me->mv_data_model EXCEPTIONS cancelled = 1 permission_error = 2 not_found = 3 is_used = 4 OTHERS = 5. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~deserialize. * You are reminded that this method checks for * - validity of data model name with regard to naming conventions * - permissions and locks * - connection to transport and correction system * - insert of data model, model relations and all documentation * - update of object tree * - releasing of lock * Is the data model name compliant with naming conventions? is_name_permitted( ). * Access Permission granted? access_modify( ). * Connection to transport and correction system corr_insert( iv_package ). * Insert the data model, relations and documentation TRY. deserialize_model( io_xml ). deserialize_entities( io_xml ). deserialize_short_texts( io_xml ). deserialize_long_texts( io_xml ). update_tree( ). access_free( ). CATCH zcx_abapgit_exception. me->access_free( ). zcx_abapgit_exception=>raise( 'Error in deserialisation of UDMO' ). ENDTRY. " You are reminded that data models are not relevant for activation. ENDMETHOD. METHOD zif_abapgit_object~exists. " See Function Module SDU_MODEL_EXISTS SELECT COUNT( * ) FROM dm40l WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state. rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESDUM' iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. " The function module listed below do not open a new window - so we revert to BDC. " CALL FUNCTION 'SDU_MODEL_SHOW' " CALL FUNCTION 'RS_TOOL_ACCESS' DATA lt_bdcdata TYPE TABLE OF bdcdata. FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-program = 'SAPMUD00'. <ls_bdcdata>-dynpro = '0100'. <ls_bdcdata>-dynbegin = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'BDC_OKCODE'. <ls_bdcdata>-fval = '=SHOW'. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'RSUD3-DATM'. <ls_bdcdata>-fval = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'RSUD3-OBJ_KEY'. <ls_bdcdata>-fval = ms_item-obj_name. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SD11' mode_val = 'E' TABLES using_tab = lt_bdcdata EXCEPTIONS system_failure = 1 communication_failure = 2 resource_failure = 3 OTHERS = 4 ##fm_subrc_ok. "#EC CI_SUBRC ENDMETHOD. METHOD zif_abapgit_object~serialize. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. serialize_model( io_xml ). me->serialize_entities( io_xml ). me->serialize_short_texts( io_xml ). me->serialize_long_texts( io_xml ). ENDMETHOD. ENDCLASS.
27.46684
117
0.664331
c8d8c809d2608989fce6cd647e41241ac4d4b63e
1,954
abap
ABAP
lbn-gtt-template-tpo/abap/zsrc/zpof_gtt.fugr.zpof_gtt_ee_po_item_del_rel.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
12
2020-09-25T07:54:40.000Z
2021-09-27T12:29:34.000Z
lbn-gtt-template-tpo/abap/zsrc/zpof_gtt.fugr.zpof_gtt_ee_po_item_del_rel.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
2
2020-10-15T05:20:41.000Z
2022-02-14T09:28:02.000Z
lbn-gtt-template-tpo/abap/zsrc/zpof_gtt.fugr.zpof_gtt_ee_po_item_del_rel.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
50
2020-09-29T03:06:01.000Z
2022-03-28T16:04:45.000Z
FUNCTION zpof_gtt_ee_po_item_del_rel. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM *" REFERENCE(I_EVENT_TYPES) TYPE /SAPTRX/EVTYPES *" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER *" REFERENCE(I_EVENTTYPE_TAB) TYPE TRXAS_EVENTTYPE_TABS_WA *" REFERENCE(I_EVENT) TYPE TRXAS_EVT_CTAB_WA *" EXPORTING *" VALUE(E_RESULT) LIKE SY-BINPT *" TABLES *" C_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL *" EXCEPTIONS *" PARAMETER_ERROR *" RELEVANCE_DETERM_ERROR *" STOP_PROCESSING *"---------------------------------------------------------------------- DATA: lo_udm_message TYPE REF TO cx_udm_message, ls_bapiret TYPE bapiret2. TRY. e_result = lcl_ae_performer=>check_relevance( EXPORTING is_definition = VALUE #( maintab = lif_app_constants=>cs_tabledef-po_item_new mastertab = lif_app_constants=>cs_tabledef-po_header_new ) io_ae_factory = NEW lcl_ae_factory_po_item_del( ) iv_appsys = i_appsys is_event_type = i_event_types it_all_appl_tables = i_all_appl_tables is_events = i_event ). CATCH cx_udm_message INTO lo_udm_message. lcl_tools=>get_errors_log( EXPORTING io_umd_message = lo_udm_message iv_appsys = i_appsys IMPORTING es_bapiret = ls_bapiret ). " add error message APPEND ls_bapiret TO c_logtable. " throw corresponding exception CASE lo_udm_message->textid. WHEN lif_ef_constants=>cs_errors-stop_processing. RAISE stop_processing. WHEN lif_ef_constants=>cs_errors-table_determination. RAISE relevance_determ_error. ENDCASE. ENDTRY. ENDFUNCTION.
35.527273
92
0.598772
c8dda8f80431e07ea68818f00ff19aadfa991720
333
abap
ABAP
src/zabappgp.fugr.z_abappgp_check_prime.abap
larshp/abapPGP
82cb07e17ad1c402275bb9e01f1b7bc3d1b2021f
[ "MIT" ]
5
2016-11-19T14:35:50.000Z
2022-03-16T03:09:49.000Z
src/zabappgp.fugr.z_abappgp_check_prime.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
34
2016-09-29T18:06:29.000Z
2022-01-19T06:41:02.000Z
src/zabappgp.fugr.z_abappgp_check_prime.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
3
2018-12-07T15:30:46.000Z
2021-04-13T18:38:53.000Z
FUNCTION z_abappgp_check_prime. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(IV_INTEGER) TYPE STRING *" EXPORTING *" VALUE(EV_PRIME) TYPE FLAG *"---------------------------------------------------------------------- * todo? RETURN. ENDFUNCTION.
22.2
72
0.384384
c8dfd48624c0fc5ae9599b22563629609e26f677
6,093
abap
ABAP
src/objects/zcl_abapgit_object_vcls.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
1
2020-01-31T16:40:50.000Z
2020-01-31T16:40:50.000Z
src/objects/zcl_abapgit_object_vcls.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_vcls.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
1
2020-01-31T16:23:43.000Z
2020-01-31T16:23:43.000Z
CLASS zcl_abapgit_object_vcls DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. PRIVATE SECTION. * See include MTOBJCON: CONSTANTS: c_cluster_type TYPE c VALUE 'C'. CONSTANTS: c_mode_insert TYPE obj_para-maint_mode VALUE 'I'. ENDCLASS. CLASS zcl_abapgit_object_vcls IMPLEMENTATION. METHOD zif_abapgit_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. "zif_abapgit_object~has_changed_since METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. " todo ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. "zif_abapgit_object~get_metadata METHOD zif_abapgit_object~exists. DATA lv_changedate TYPE vcldir-changedate. SELECT SINGLE changedate INTO lv_changedate FROM vcldir WHERE vclname = ms_item-obj_name. rv_bool = boolc( sy-subrc = 0 ). IF lv_changedate IS INITIAL. * same logic as in function module VIEWCLUSTER_GET_DEFINITION rv_bool = abap_false. ENDIF. ENDMETHOD. "zif_abapgit_object~exists METHOD zif_abapgit_object~serialize. DATA: lv_vclname TYPE vcl_name, ls_vcldir_entry TYPE v_vcldir, lt_vclstruc TYPE TABLE OF v_vclstruc, lt_vclstrudep TYPE TABLE OF v_vclstdep, lt_vclmf TYPE TABLE OF v_vclmf. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. lv_vclname = ms_item-obj_name. CALL FUNCTION 'VIEWCLUSTER_GET_DEFINITION' EXPORTING vclname = lv_vclname IMPORTING vcldir_entry = ls_vcldir_entry TABLES vclstruc_tab = lt_vclstruc vclstrudep_tab = lt_vclstrudep vclmf_tab = lt_vclmf EXCEPTIONS viewcluster_not_found = 1 incomplete_viewcluster = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error in VIEWCLUSTER_GET_DEFINITION' ). ENDIF. CLEAR ls_vcldir_entry-author. io_xml->add( iv_name = 'VCLDIR' ig_data = ls_vcldir_entry ). io_xml->add( iv_name = 'VLCSTRUC_TAB' ig_data = lt_vclstruc ). io_xml->add( iv_name = 'VCLSTRUDEP_TAB' ig_data = lt_vclstrudep ). io_xml->add( iv_name = 'VCLMF_TAB' ig_data = lt_vclmf ). ENDMETHOD. "serialize METHOD zif_abapgit_object~deserialize. DATA: ls_vcldir_entry TYPE v_vcldir, lt_vclstruc TYPE TABLE OF v_vclstruc, lt_vclstrudep TYPE TABLE OF v_vclstdep, lt_vclmf TYPE TABLE OF v_vclmf, lv_objectname TYPE ob_object. io_xml->read( EXPORTING iv_name = 'VCLDIR' CHANGING cg_data = ls_vcldir_entry ). io_xml->read( EXPORTING iv_name = 'VLCSTRUC_TAB' CHANGING cg_data = lt_vclstruc ). io_xml->read( EXPORTING iv_name = 'VCLSTRUDEP_TAB' CHANGING cg_data = lt_vclstrudep ). io_xml->read( EXPORTING iv_name = 'lt_vclstrudep' CHANGING cg_data = lt_vclmf ). ls_vcldir_entry-author = sy-uname. CALL FUNCTION 'VIEWCLUSTER_SAVE_DEFINITION' EXPORTING vcldir_entry = ls_vcldir_entry TABLES vclstruc_tab = lt_vclstruc vclstrudep_tab = lt_vclstrudep vclmf_tab = lt_vclmf. lv_objectname = ls_vcldir_entry-vclname. CALL FUNCTION 'OBJ_GENERATE' EXPORTING iv_objectname = lv_objectname iv_objecttype = c_cluster_type iv_maint_mode = c_mode_insert iv_devclass = iv_package EXCEPTIONS illegal_call = 1 object_not_found = 2 generate_error = 3 transport_error = 4 object_enqueue_failed = 5 OTHERS = 6. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error in OBJ_GENERATE for VCLS' ). ENDIF. ENDMETHOD. "deserialize METHOD zif_abapgit_object~delete. * Do the same as in VIEWCLUSTER_SAVE_DEFINITION DATA: lv_vclname TYPE vcl_name. lv_vclname = ms_item-obj_name. DELETE FROM vcldir WHERE vclname = lv_vclname. "#EC CI_SUBRC DELETE FROM vcldirt WHERE vclname = lv_vclname. "#EC CI_NOFIRST "#EC CI_SUBRC DELETE FROM vclstruc WHERE vclname = lv_vclname. "#EC CI_SUBRC DELETE FROM vclstruct WHERE vclname = lv_vclname. "#EC CI_NOFIRST "#EC CI_SUBRC DELETE FROM vclstrudep WHERE vclname = lv_vclname. "#EC CI_SUBRC DELETE FROM vclmf WHERE vclname = lv_vclname. "#EC CI_SUBRC ENDMETHOD. "delete METHOD zif_abapgit_object~jump. DATA: lv_vclname TYPE vcl_name. lv_vclname = ms_item-obj_name. CALL FUNCTION 'VIEWCLUSTER_MAINTENANCE_CALL' EXPORTING viewcluster_name = lv_vclname maintenance_action = 'S' EXCEPTIONS client_reference = 1 foreign_lock = 2 viewcluster_not_found = 3 viewcluster_is_inconsistent = 4 missing_generated_function = 5 no_upd_auth = 6 no_show_auth = 7 object_not_found = 8 no_tvdir_entry = 9 no_clientindep_auth = 10 invalid_action = 11 saving_correction_failed = 12 system_failure = 13 unknown_field_in_dba_sellist = 14 missing_corr_number = 15 OTHERS = 16. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error in VIEWCLUSTER_MAINTENANCE_CALL' ). ENDIF. ENDMETHOD. "jump METHOD zif_abapgit_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null. ENDMETHOD. ENDCLASS. "zcl_abapgit_object_vcls IMPLEMENTATION
32.238095
96
0.625472
c8e8326b424aec849a09a964180347aa0b4c1a1d
7,451
abap
ABAP
zbugtracker_core/zbugtracker_persistence/zcl_bughier_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
3
2019-02-10T22:03:43.000Z
2021-05-26T06:49:55.000Z
zbugtracker_core/zbugtracker_persistence/zcl_bughier_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
2
2020-05-06T14:25:17.000Z
2022-01-13T10:06:40.000Z
zbugtracker_core/zbugtracker_persistence/zcl_bughier_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
1
2021-05-26T06:49:56.000Z
2021-05-26T06:49:56.000Z
class ZCL_BUGHIER_PERSIST definition public final create protected global friends ZCB_BUGHIER_PERSIST . *"* public components of class ZCL_BUGHIER_PERSIST *"* do not include other source files here!!! public section. interfaces IF_OS_STATE . methods GET_BUG returning value(RESULT) type ZBT_ID_BUG raising CX_OS_OBJECT_NOT_FOUND . methods GET_NEXT_BUG returning value(RESULT) type ZBT_ID_NEXT_BUG raising CX_OS_OBJECT_NOT_FOUND . methods GET_PRODUCTO returning value(RESULT) type ZBT_ID_PRODUCTO raising CX_OS_OBJECT_NOT_FOUND . class CL_OS_SYSTEM definition load . protected section. *"* protected components of class ZCL_BUGHIER_PERSIST *"* do not include other source files here!!! data BUG type ZBT_ID_BUG . data NEXT_BUG type ZBT_ID_NEXT_BUG . data PRODUCTO type ZBT_ID_PRODUCTO . private section. *"* private components of class ZCL_BUGHIER_PERSIST *"* do not include other source files here!!! ENDCLASS. CLASS ZCL_BUGHIER_PERSIST IMPLEMENTATION. method GET_BUG. ***BUILD 051401 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute BUG * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = BUG. " GET_BUG endmethod. method GET_NEXT_BUG. ***BUILD 051401 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute NEXT_BUG * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = NEXT_BUG. " GET_NEXT_BUG endmethod. method GET_PRODUCTO. ***BUILD 051401 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute PRODUCTO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = PRODUCTO. " GET_PRODUCTO endmethod. method IF_OS_STATE~GET. ***BUILD 051401 " returning result type ref to object ************************************************************************ * Purpose : Get state. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * GENERATED: Do not modify ************************************************************************ data: STATE_OBJECT type ref to CL_OS_STATE. create object STATE_OBJECT. call method STATE_OBJECT->SET_STATE_FROM_OBJECT( ME ). result = STATE_OBJECT. endmethod. method IF_OS_STATE~HANDLE_EXCEPTION. ***BUILD 051401 " importing I_EXCEPTION type ref to IF_OS_EXCEPTION_INFO optional " importing I_EX_OS type ref to CX_OS_OBJECT_NOT_FOUND optional ************************************************************************ * Purpose : Handles exceptions during attribute access. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : If an exception is raised during attribut access, * this method is called and the exception is passed * as a paramater. The default is to raise the exception * again, so that the caller can handle the exception. * But it is also possible to handle the exception * here in the callee. * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 * - 2000-08-02 : (SB) OO Exceptions ************************************************************************ * Modify if you like ************************************************************************ if i_ex_os is not initial. raise exception i_ex_os. endif. endmethod. method IF_OS_STATE~INIT. ***BUILD 051401 ************************************************************************ * Purpose : Initialisation of the transient state partition. * * Version : 2.0 * * Precondition : - * * Postcondition : Transient state is initial. * * OO Exceptions : - * * Implementation : Caution!: Avoid Throwing ACCESS Events. * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * Modify if you like ************************************************************************ endmethod. method IF_OS_STATE~INVALIDATE. ***BUILD 051401 ************************************************************************ * Purpose : Do something before all persistent attributes are * cleared. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : - * * Implementation : Whatever you like to do. * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * Modify if you like ************************************************************************ endmethod. method IF_OS_STATE~SET. ***BUILD 051401 " importing I_STATE type ref to object ************************************************************************ * Purpose : Set state. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * GENERATED: Do not modify ************************************************************************ data: STATE_OBJECT type ref to CL_OS_STATE. STATE_OBJECT ?= I_STATE. call method STATE_OBJECT->SET_OBJECT_FROM_STATE( ME ). endmethod. ENDCLASS.
25.430034
72
0.481546
c8e9ae4622ee313c1e5f3dac1caa8d2f426dca6d
824
abap
ABAP
src/zcx_oauth2_error.clas.abap
sandraros/abap2oauth2
8cddc38c9c411ee6f4ff511c6b17cffae18558e8
[ "Apache-2.0" ]
9
2018-10-11T09:03:38.000Z
2022-01-15T07:20:58.000Z
src/zcx_oauth2_error.clas.abap
ivanfemia/abap2oauth2
8cddc38c9c411ee6f4ff511c6b17cffae18558e8
[ "Apache-2.0" ]
1
2018-08-30T10:07:41.000Z
2018-08-30T17:19:23.000Z
src/zcx_oauth2_error.clas.abap
sandraros/abap2oauth2
8cddc38c9c411ee6f4ff511c6b17cffae18558e8
[ "Apache-2.0" ]
4
2018-08-30T18:10:44.000Z
2022-01-15T07:21:00.000Z
class ZCX_OAUTH2_ERROR definition public inheriting from CX_STATIC_CHECK final create public . public section. constants ZCX_OAUTH2_ERROR type SOTR_CONC value '0800273352511EE8AAEB533DECB415B4' ##NO_TEXT. constants TOKEN_EXPIRED type SOTR_CONC value '0800273352511EE8AAEB533DECB3F5B4' ##NO_TEXT. data RESPONSE type ZOAUTH2_API_RESPONSE . methods CONSTRUCTOR importing !TEXTID like TEXTID optional !PREVIOUS like PREVIOUS optional !RESPONSE type ZOAUTH2_API_RESPONSE optional . protected section. private section. ENDCLASS. CLASS ZCX_OAUTH2_ERROR IMPLEMENTATION. method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING TEXTID = TEXTID PREVIOUS = PREVIOUS . IF textid IS INITIAL. me->textid = ZCX_OAUTH2_ERROR . ENDIF. me->RESPONSE = RESPONSE . endmethod. ENDCLASS.
21.128205
95
0.783981
c8eec2a553e7d1c35cd097f4346b2221a6570cba
2,821
abap
ABAP
src/search/zcl_dbbr_search_ioc.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
15
2020-02-05T10:38:12.000Z
2022-02-11T18:06:17.000Z
src/search/zcl_dbbr_search_ioc.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
10
2021-01-19T07:45:37.000Z
2021-07-15T19:08:54.000Z
src/search/zcl_dbbr_search_ioc.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
9
2020-04-08T19:13:18.000Z
2021-10-02T12:53:39.000Z
"! <p class="shorttext synchronized" lang="en">IoC for Db Browser specific search types</p> CLASS zcl_dbbr_search_ioc DEFINITION PUBLIC INHERITING FROM zcl_sat_base_ioc FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_dbbr_c_object_browser. ALIASES: c_search_type FOR zif_dbbr_c_object_browser~c_search_type. METHODS constructor. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_contracts, query_validator TYPE classname VALUE 'ZIF_SAT_QUERY_VALIDATOR', query_converter TYPE classname VALUE 'ZIF_SAT_QUERY_CONVERTER', query_parser TYPE classname VALUE 'ZIF_SAT_OBJECT_QUERY_PARSER', query_config TYPE classname VALUE 'ZIF_SAT_OBJECT_SEARCH_CONFIG', search_provider TYPE classname VALUE 'ZIF_SAT_OBJECT_SEARCH_PROVIDER', search_engine TYPE classname VALUE 'ZIF_SAT_SEARCH_ENGINE', END OF c_contracts, BEGIN OF c_implementer, query_parser TYPE classname VALUE 'ZCL_SAT_OBJECT_QUERY_PARSER', END OF c_implementer. ENDCLASS. CLASS zcl_dbbr_search_ioc IMPLEMENTATION. METHOD constructor. super->constructor( ). add_contract( iv_contract = c_contracts-query_config )->add_implementer( iv_filter = |{ c_search_type-query }| iv_implementer = 'ZCL_DBBR_QUERY_CONFIG' )->add_implementer( iv_filter = |{ c_search_type-package }| iv_implementer = 'ZCL_DBBR_PACKAGE_QUERY_CONFIG' ). add_contract( iv_contract = c_contracts-search_provider )->add_implementer( iv_filter = |{ c_search_type-query }| iv_implementer = 'ZCL_DBBR_OS_QUERY_PROVIDER' ). add_contract( iv_contract = c_contracts-query_parser )->add_implementer( iv_filter = |{ c_search_type-query }| iv_implementer = c_implementer-query_parser it_dependencies = VALUE #( ( parameter = 'IO_CONFIGURATION' contract = c_contracts-query_config filter = c_search_type-query ) ( parameter = 'IO_VALIDATOR' contract = c_contracts-query_validator filter = c_search_type-query ) ( parameter = 'IO_CONVERTER' contract = c_contracts-query_converter ) ) ). add_contract( iv_contract = c_contracts-query_parser )->add_implementer( iv_filter = |{ c_search_type-package }| iv_implementer = c_implementer-query_parser it_dependencies = VALUE #( ( parameter = 'IO_CONFIGURATION' contract = c_contracts-query_config filter = c_search_type-package ) ( parameter = 'IO_VALIDATOR' contract = c_contracts-query_validator ) ( parameter = 'IO_CONVERTER' contract = c_contracts-query_converter ) ) ). ENDMETHOD. ENDCLASS.
45.5
129
0.684509
c8eeca6b5fa65ee201819fd76aa0f295a50b4518
1,328
abap
ABAP
lang/zcx_unsupportedoperation.abap
lhs123/ztest
a9b5710a304c524d4b897a1d0316ee7872b9c425
[ "MIT" ]
86
2015-02-12T01:44:24.000Z
2022-03-17T03:14:48.000Z
lang/zcx_unsupportedoperation.abap
lhs123/ztest
a9b5710a304c524d4b897a1d0316ee7872b9c425
[ "MIT" ]
4
2015-04-10T21:33:56.000Z
2017-07-17T00:19:52.000Z
lang/zcx_unsupportedoperation.abap
lhs123/ztest
a9b5710a304c524d4b897a1d0316ee7872b9c425
[ "MIT" ]
29
2015-04-01T04:19:04.000Z
2021-08-18T07:46:56.000Z
class ZCX_UNSUPPORTEDOPERATION definition public inheriting from ZCX_RUNTIMEEXCEPTION final create public . public section. constants ZCX_UNSUPPORTEDOPERATION type SOTR_CONC value '00155D334B0D1EE2B8FD3C3528612991'. "#EC NOTEXT methods CONSTRUCTOR importing !TEXTID like TEXTID optional !PREVIOUS like PREVIOUS optional !MESSAGE type STRING optional . protected section. private section. ENDCLASS. CLASS ZCX_UNSUPPORTEDOPERATION IMPLEMENTATION. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method ZCX_UNSUPPORTEDOPERATION->CONSTRUCTOR * +-------------------------------------------------------------------------------------------------+ * | [--->] TEXTID LIKE TEXTID(optional) * | [--->] PREVIOUS LIKE PREVIOUS(optional) * | [--->] MESSAGE TYPE STRING(optional) * +--------------------------------------------------------------------------------------</SIGNATURE> method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING TEXTID = TEXTID PREVIOUS = PREVIOUS MESSAGE = MESSAGE . IF textid IS INITIAL. me->textid = ZCX_UNSUPPORTEDOPERATION . ENDIF. endmethod. ENDCLASS.
30.181818
106
0.527108
c8f045180bb3d059480faab391a72f14af4805ff
3,543
abap
ABAP
src/zcl_excel_rows.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
39
2021-12-11T18:27:15.000Z
2022-03-31T14:03:53.000Z
src/zcl_excel_rows.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
115
2021-12-11T08:29:00.000Z
2022-03-30T17:39:42.000Z
src/zcl_excel_rows.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
17
2021-12-12T13:48:59.000Z
2022-03-24T12:28:26.000Z
*----------------------------------------------------------------------* * CLASS ZCL_EXCEL_ROWS DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS zcl_excel_rows DEFINITION PUBLIC FINAL CREATE PUBLIC . *"* public components of class ZCL_EXCEL_ROWS *"* do not include other source files here!!! *"* protected components of class ZABAP_EXCEL_WORKSHEETS *"* do not include other source files here!!! PUBLIC SECTION. METHODS add IMPORTING !io_row TYPE REF TO zcl_excel_row . METHODS clear . METHODS constructor . METHODS get IMPORTING !ip_index TYPE i RETURNING VALUE(eo_row) TYPE REF TO zcl_excel_row . METHODS get_iterator RETURNING VALUE(eo_iterator) TYPE REF TO zcl_excel_collection_iterator . METHODS is_empty RETURNING VALUE(is_empty) TYPE flag . METHODS remove IMPORTING !io_row TYPE REF TO zcl_excel_row . METHODS size RETURNING VALUE(ep_size) TYPE i . METHODS get_min_index RETURNING VALUE(ep_index) TYPE i . METHODS get_max_index RETURNING VALUE(ep_index) TYPE i . PROTECTED SECTION. *"* private components of class ZABAP_EXCEL_RANGES *"* do not include other source files here!!! PRIVATE SECTION. TYPES: BEGIN OF mty_s_hashed_row, row_index TYPE int4, row TYPE REF TO zcl_excel_row, END OF mty_s_hashed_row , mty_ts_hashed_row TYPE HASHED TABLE OF mty_s_hashed_row WITH UNIQUE KEY row_index. DATA rows TYPE REF TO zcl_excel_collection . DATA rows_hashed TYPE mty_ts_hashed_row . ENDCLASS. CLASS zcl_excel_rows IMPLEMENTATION. METHOD add. DATA: ls_hashed_row TYPE mty_s_hashed_row. ls_hashed_row-row_index = io_row->get_row_index( ). ls_hashed_row-row = io_row. INSERT ls_hashed_row INTO TABLE rows_hashed. rows->add( io_row ). ENDMETHOD. "ADD METHOD clear. CLEAR rows_hashed. rows->clear( ). ENDMETHOD. "CLEAR METHOD constructor. CREATE OBJECT rows. ENDMETHOD. "CONSTRUCTOR METHOD get. FIELD-SYMBOLS: <ls_hashed_row> TYPE mty_s_hashed_row. READ TABLE rows_hashed WITH KEY row_index = ip_index ASSIGNING <ls_hashed_row>. IF sy-subrc = 0. eo_row = <ls_hashed_row>-row. ENDIF. ENDMETHOD. "GET METHOD get_iterator. eo_iterator ?= rows->get_iterator( ). ENDMETHOD. "GET_ITERATOR METHOD get_max_index. FIELD-SYMBOLS: <ls_hashed_row> TYPE mty_s_hashed_row. LOOP AT rows_hashed ASSIGNING <ls_hashed_row>. IF <ls_hashed_row>-row_index > ep_index. ep_index = <ls_hashed_row>-row_index. ENDIF. ENDLOOP. ENDMETHOD. METHOD get_min_index. FIELD-SYMBOLS: <ls_hashed_row> TYPE mty_s_hashed_row. LOOP AT rows_hashed ASSIGNING <ls_hashed_row>. IF ep_index = 0 OR <ls_hashed_row>-row_index < ep_index. ep_index = <ls_hashed_row>-row_index. ENDIF. ENDLOOP. ENDMETHOD. METHOD is_empty. is_empty = rows->is_empty( ). ENDMETHOD. "IS_EMPTY METHOD remove. DELETE TABLE rows_hashed WITH TABLE KEY row_index = io_row->get_row_index( ) . rows->remove( io_row ). ENDMETHOD. "REMOVE METHOD size. ep_size = rows->size( ). ENDMETHOD. "SIZE ENDCLASS.
24.950704
88
0.615016
c8f9712271e6488422f3e1d3978695e8d03d3d2e
709
abap
ABAP
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.shallowparser/abap/LSTPDA_BP_SERVICES.abap
SvenPeldszus/conqat
28fe004a49453894922aeb27ee3467b1748d23e9
[ "Apache-2.0" ]
1
2020-04-28T20:06:30.000Z
2020-04-28T20:06:30.000Z
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.shallowparser/abap/LSTPDA_BP_SERVICES.abap
SvenPeldszus/conqat
28fe004a49453894922aeb27ee3467b1748d23e9
[ "Apache-2.0" ]
null
null
null
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.shallowparser/abap/LSTPDA_BP_SERVICES.abap
SvenPeldszus/conqat
28fe004a49453894922aeb27ee3467b1748d23e9
[ "Apache-2.0" ]
null
null
null
MODULE get_focus INPUT. CALL FUNCTION 'TPDA_GET_FOCUS'. ENDMODULE. " get_focus INPUT MODULE exit INPUT. CLEAR dynp_vars-set_bp. lcl_dynpro_0300=>clear( ). CLEAR tpda_bp_cr. CLEAR: it_statements, it_functions, it_bp_set. CLEAR ok_code. LEAVE TO SCREEN 0. ENDMODULE. " exit INPUT MODULE init OUTPUT. IF init IS INITIAL. init = 'X'. tab_ctrl_bp_create-activetab = start_tab. CLEAR wa_condition_0210. CLEAR wa_condition_0220. CLEAR wa_condition_0230. CLEAR wa_condition_0250. ENDIF. ENDMODULE. " init OUTPUT MODULE exit_800 INPUT. cancel_800 = 'X'. LEAVE TO SCREEN 0. ENDMODULE. " exit_800 INPUT
24.448276
48
0.665726
74014195e9a125487ceee92317c12f0d99d54af9
1,367
abap
ABAP
src/zcl_abaplint_deps.clas.abap
ed-holland/abaplint-abap-backend
4ea4188f87bcc6a5f4dd2dc2c6d614c76a08fea2
[ "MIT" ]
16
2020-09-04T14:21:30.000Z
2022-02-16T11:28:18.000Z
src/zcl_abaplint_deps.clas.abap
ed-holland/abaplint-abap-backend
4ea4188f87bcc6a5f4dd2dc2c6d614c76a08fea2
[ "MIT" ]
149
2020-07-11T06:21:27.000Z
2022-02-19T06:49:00.000Z
src/zcl_abaplint_deps.clas.abap
ed-holland/abaplint-abap-backend
4ea4188f87bcc6a5f4dd2dc2c6d614c76a08fea2
[ "MIT" ]
15
2020-07-16T21:39:09.000Z
2022-01-01T18:46:10.000Z
CLASS zcl_abaplint_deps DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. METHODS find IMPORTING !iv_object_type TYPE trobjtype !iv_object_name TYPE sobj_name !is_options TYPE zcl_abaplint_deps_find=>ty_options RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt RAISING zcx_abapgit_exception zcx_abaplint_error . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPLINT_DEPS IMPLEMENTATION. METHOD find. DATA lo_serializer TYPE REF TO zcl_abaplint_deps_serializer. DATA lo_find TYPE REF TO zcl_abaplint_deps_find. CREATE OBJECT lo_serializer EXPORTING is_options = is_options. CREATE OBJECT lo_find EXPORTING is_options = is_options. DATA lt_deps TYPE zif_abapgit_definitions=>ty_tadir_tt. lt_deps = lo_find->find_by_item( iv_object_type = iv_object_type iv_object_name = iv_object_name ). DATA ls_dep LIKE LINE OF lt_deps. DATA ls_files_item TYPE zcl_abapgit_objects=>ty_serialization. LOOP AT lt_deps INTO ls_dep. ls_files_item-item-obj_type = ls_dep-object. ls_files_item-item-obj_name = ls_dep-obj_name. ls_files_item-files = lo_serializer->serialize_item( ls_files_item-item ). APPEND LINES OF ls_files_item-files TO rt_files. ENDLOOP. ENDMETHOD. ENDCLASS.
25.314815
80
0.739576
7401d007da1d8458b981bbc3c87601bac8cbcb40
5,060
abap
ABAP
src/objects/zcl_abapgit_object_enhs.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
1
2020-01-31T16:40:50.000Z
2020-01-31T16:40:50.000Z
src/objects/zcl_abapgit_object_enhs.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_enhs.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
1
2020-01-31T16:23:43.000Z
2020-01-31T16:23:43.000Z
CLASS zcl_abapgit_object_enhs DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. PRIVATE SECTION. METHODS: factory IMPORTING iv_tool TYPE enhtooltype RETURNING VALUE(ri_enho) TYPE REF TO zif_abapgit_object_enhs RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_object_enhs IMPLEMENTATION. METHOD zif_abapgit_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. "zif_abapgit_object~has_changed_since METHOD zif_abapgit_object~changed_by. DATA: lv_spot_name TYPE enhspotname, li_spot_ref TYPE REF TO if_enh_spot_tool. lv_spot_name = ms_item-obj_name. TRY. li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ). li_spot_ref->get_attributes( IMPORTING changedby = rv_user ). CATCH cx_enh_root. rv_user = c_user_unknown. ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lv_parent TYPE enhspotcompositename, lv_spot_name TYPE enhspotname, lv_tool TYPE enhspottooltype, lv_package LIKE iv_package, li_spot_ref TYPE REF TO if_enh_spot_tool, li_enhs TYPE REF TO zif_abapgit_object_enhs, lx_root TYPE REF TO cx_root. IF zif_abapgit_object~exists( ) = abap_true. zif_abapgit_object~delete( ). ENDIF. io_xml->read( EXPORTING iv_name = 'TOOL' CHANGING cg_data = lv_tool ). lv_spot_name = ms_item-obj_name. lv_package = iv_package. TRY. cl_enh_factory=>create_enhancement_spot( EXPORTING spot_name = lv_spot_name tooltype = lv_tool dark = abap_false compositename = lv_parent IMPORTING spot = li_spot_ref CHANGING devclass = lv_package ). CATCH cx_enh_root INTO lx_root. zcx_abapgit_exception=>raise( 'Error from CL_ENH_FACTORY' ). ENDTRY. li_enhs = factory( lv_tool ). li_enhs->deserialize( io_xml = io_xml iv_package = iv_package ii_enh_spot_tool = li_spot_ref ). ENDMETHOD. "deserialize METHOD zif_abapgit_object~serialize. DATA: lv_spot_name TYPE enhspotname, li_spot_ref TYPE REF TO if_enh_spot_tool, li_enhs TYPE REF TO zif_abapgit_object_enhs, lx_root TYPE REF TO cx_root. lv_spot_name = ms_item-obj_name. TRY. li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ). CATCH cx_enh_root INTO lx_root. zcx_abapgit_exception=>raise( 'Error from CL_ENH_FACTORY' ). ENDTRY. li_enhs = factory( li_spot_ref->get_tool( ) ). li_enhs->serialize( io_xml = io_xml ii_enh_spot_tool = li_spot_ref ). ENDMETHOD. "serialize METHOD zif_abapgit_object~exists. DATA: lv_spot_name TYPE enhspotname, li_spot_ref TYPE REF TO if_enh_spot_tool. lv_spot_name = ms_item-obj_name. TRY. li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ). rv_bool = abap_true. CATCH cx_enh_root. rv_bool = abap_false. ENDTRY. ENDMETHOD. "exists METHOD zif_abapgit_object~delete. DATA: lv_spot_name TYPE enhspotname, li_enh_object TYPE REF TO if_enh_object, lx_root TYPE REF TO cx_root. lv_spot_name = ms_item-obj_name. TRY. li_enh_object ?= cl_enh_factory=>get_enhancement_spot( spot_name = lv_spot_name lock = abap_true ). li_enh_object->delete( nevertheless_delete = abap_true run_dark = abap_true ). li_enh_object->unlock( ). CATCH cx_enh_root INTO lx_root. zcx_abapgit_exception=>raise( 'Error from CL_ENH_FACTORY' ). ENDTRY. ENDMETHOD. "delete METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. "get_metadata METHOD zif_abapgit_object~jump. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = ms_item-obj_name object_type = 'ENHS' in_new_window = abap_true. ENDMETHOD. "jump METHOD zif_abapgit_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null. ENDMETHOD. METHOD factory. CASE iv_tool. WHEN cl_enh_tool_badi_def=>tooltype. CREATE OBJECT ri_enho TYPE zcl_abapgit_object_enhs_badi_d. WHEN cl_enh_tool_hook_def=>tool_type. CREATE OBJECT ri_enho TYPE zcl_abapgit_object_enhs_hook_d. WHEN OTHERS. zcx_abapgit_exception=>raise( |ENHS: Unsupported tool { iv_tool }| ). ENDCASE. ENDMETHOD. ENDCLASS. "zcl_abapgit_object_enhs
27.650273
96
0.651383
7402700a1e2809eb30aa46067d024b936f1bc27e
1,270
abap
ABAP
src/zcl_capi_abstract_task.clas.abap
sap-russia/zconcurrency_api
13edc2d7a30cf41406fb8129f71b1a7304f0fd90
[ "MIT" ]
19
2021-01-10T15:47:28.000Z
2022-03-18T08:39:04.000Z
src/zcl_capi_abstract_task.clas.abap
sap-russia/zconcurrency_api
13edc2d7a30cf41406fb8129f71b1a7304f0fd90
[ "MIT" ]
7
2021-01-11T09:17:37.000Z
2021-06-06T15:15:05.000Z
src/zcl_capi_abstract_task.clas.abap
sap-russia/zconcurrency_api
13edc2d7a30cf41406fb8129f71b1a7304f0fd90
[ "MIT" ]
10
2021-01-10T15:47:39.000Z
2022-02-06T17:01:36.000Z
CLASS zcl_capi_abstract_task DEFINITION PUBLIC ABSTRACT CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_capi_callable . INTERFACES if_serializable_object . INTERFACES zif_capi_task . METHODS constructor IMPORTING !iv_name TYPE string OPTIONAL . PROTECTED SECTION. CLASS-DATA gv_tasks_quantity TYPE i . DATA mv_id TYPE guid_32 . DATA mv_name TYPE string . METHODS create_task_name . METHODS create_task_id . PRIVATE SECTION. ENDCLASS. CLASS ZCL_CAPI_ABSTRACT_TASK IMPLEMENTATION. METHOD constructor. create_task_id( ). IF iv_name IS INITIAL. create_task_name( ). ELSE. mv_name = iv_name. ENDIF. ENDMETHOD. METHOD create_task_id. CALL FUNCTION 'GUID_CREATE' IMPORTING ev_guid_32 = mv_id. ENDMETHOD. METHOD create_task_name. DATA: lv_tasks_quantity TYPE string. lv_tasks_quantity = gv_tasks_quantity = gv_tasks_quantity + 1. CONCATENATE 'task_' lv_tasks_quantity INTO mv_name. ENDMETHOD. METHOD zif_capi_callable~call. * This method needs to be overridden ENDMETHOD. METHOD zif_capi_task~get_id. rv_id = mv_id. ENDMETHOD. METHOD zif_capi_task~get_name. rv_name = mv_name. ENDMETHOD. ENDCLASS.
16.710526
66
0.711024
7402cd838d758eb65efce336f2ce8e2b4a2fe512
7,245
abap
ABAP
src/yabap2google_core/yabap2google_json/ycl_a2g_jsonbase.clas.abap
dwilhelmi96/abap2gsheet
d531c17e1c06c9d6149b20f037486a5f726e433f
[ "Apache-2.0" ]
14
2020-01-13T13:14:24.000Z
2022-02-22T21:39:12.000Z
src/yabap2google_core/yabap2google_json/ycl_a2g_jsonbase.clas.abap
dwilhelmi96/abap2gsheet
d531c17e1c06c9d6149b20f037486a5f726e433f
[ "Apache-2.0" ]
2
2020-01-14T13:39:50.000Z
2021-08-24T13:22:10.000Z
src/yabap2google_core/yabap2google_json/ycl_a2g_jsonbase.clas.abap
dwilhelmi96/abap2gsheet
d531c17e1c06c9d6149b20f037486a5f726e433f
[ "Apache-2.0" ]
4
2020-01-28T09:35:58.000Z
2021-06-02T18:45:34.000Z
"! <h1>ycl_a2g_jsonbase</h1> "! <p class="shorttext synchronized" lang="en">Cmp. Appl - Abap 2 Google - Json Model Base Abstrace</p> CLASS ycl_a2g_jsonbase DEFINITION PUBLIC ABSTRACT CREATE PUBLIC . PUBLIC SECTION. INTERFACES yif_a2g_json_context . INTERFACES yif_a2g_context . INTERFACES yif_a2g_json . INTERFACES yif_a2g_serialize . "! True CONSTANTS gc_true TYPE oax VALUE 'X' ##NO_TEXT. "! False CONSTANTS gc_false TYPE oax VALUE ' ' ##NO_TEXT. "! Build the class "! @parameter if_msg_manager | message managere where soter alla message triggered by the applicaition METHODS constructor IMPORTING !if_msg_manager TYPE REF TO yif_a2g_msg_manager . PROTECTED SECTION. DATA: "! Rule factory to create the instance of check class go_rule_factory TYPE REF TO ycl_a2g_rule_factory, "! JSON FACTORY FO CHILD GENERATION go_json_factory TYPE REF TO ycl_a2g_json_factory, "! Array of json instance for build json structure go_json_array TYPE REF TO ycl_a2g_array, "! Message manager instance go_msg_manager TYPE REF TO yif_a2g_msg_manager, "! Abap structure for data gv_data TYPE REF TO data, "! Json Data string gv_json TYPE string, gv_struct_nane TYPE string. "! This Method update the single values into the gv_data structure "! @parameter i_fieldname | name of the field of the structure "! @parameter i_value | value to set METHODS update_field IMPORTING !i_fieldname TYPE string !i_value TYPE REF TO data. "! genereta the rule of the class METHODS generate_rules ABSTRACT. "! rebuild the data into the gv_data attribute METHODS rebuild_data ABSTRACT. "! Push down the data to the subobject METHODS push_data ABSTRACT. "! This Method execute the check of the single fields "! @parameter i_fieldname | name of the filed to check "! @parameter i_recheck | check again the value if already checked "! @raising ycx_a2g_objbase | exception class METHODS check_field IMPORTING !i_fieldname TYPE string !i_recheck TYPE oax OPTIONAL RAISING ycx_a2g_objbase. "! This Method execute the check of the single fields "! @parameter i_classname | name of the rule class to instatiate "! @parameter i_fieldname | name of the field to link the class instance "! @parameter i_mandatary | enable the mandatory METHODS generate_rule IMPORTING !i_classname TYPE string !i_fieldname TYPE string !i_mandatary TYPE oax OPTIONAL. "! Convert the abap structure of the class into Json model in string format METHODS abap_2_json . "! Convert a Json model in string format into the abap main structure of the class METHODS json_2_abap . PRIVATE SECTION. ENDCLASS. CLASS ycl_a2g_jsonbase IMPLEMENTATION. METHOD abap_2_json. FIELD-SYMBOLS <fs_struct> TYPE any. ASSIGN me->gv_data->* TO <fs_struct>. me->gv_json = /ui2/cl_json=>serialize( data = <fs_struct> compress = abap_true pretty_name = /ui2/cl_json=>pretty_mode-camel_case ). ENDMETHOD. METHOD check_field. "& Declaration Part DATA: lif_rule TYPE REF TO yif_a2g_rule, lif_context TYPE REF TO yif_a2g_context, ox_rule TYPE REF TO ycx_a2g_rule. "& Source Part lif_context ?= me. lif_rule ?= me->go_rule_factory->get_rule_by_field( i_fieldname ). TRY . lif_rule->execute( i_context = lif_context i_recheck = i_recheck ). CATCH ycx_a2g_rule INTO ox_rule. RAISE EXCEPTION TYPE ycx_a2g_objbase EXPORTING textid = ox_rule->if_t100_message~t100key. CATCH cx_root. * the rule does not exist. go to the next check ENDTRY. ENDMETHOD. METHOD constructor. "& Source Part IF if_msg_manager IS BOUND. me->go_msg_manager ?= if_msg_manager. ELSE. me->go_msg_manager = ycl_a2g_msg_manager=>create_init_msg_manager( ). ENDIF. me->go_rule_factory = NEW #( me->go_msg_manager ). me->go_json_factory = NEW #( me->go_msg_manager ). me->go_json_array = NEW #( ). ENDMETHOD. METHOD generate_rule. "& Declaration Part DATA: lif_rule TYPE REF TO yif_a2g_rule. "& Source Part lif_rule ?= me->go_rule_factory->get_rule_by_field( i_fieldname ). IF NOT lif_rule IS BOUND. lif_rule ?= me->go_rule_factory->get_rule( i_classname ). IF i_mandatary = me->gc_true. lif_rule->set_mandatary( ). ENDIF. lif_rule->assign_dependencies( io_rule_factory = me->go_rule_factory i_fieldname = i_fieldname ). ENDIF. ENDMETHOD. METHOD json_2_abap. FIELD-SYMBOLS <fs_struct> TYPE any. ASSIGN me->gv_data->* TO <fs_struct>. /ui2/cl_json=>deserialize( EXPORTING json = me->gv_json pretty_name = /ui2/cl_json=>pretty_mode-camel_case CHANGING data = <fs_struct> ). ENDMETHOD. METHOD update_field. "& Declaration Part FIELD-SYMBOLS <fs_structure> TYPE any. FIELD-SYMBOLS <fs_field> TYPE any. FIELD-SYMBOLS <fs_field_source> TYPE any. "& Source Part ASSIGN me->gv_data->* TO <fs_structure>. ASSIGN COMPONENT i_fieldname OF STRUCTURE <fs_structure> TO <fs_field>. IF sy-subrc = 0. ASSIGN i_value->* TO <fs_field_source>. <fs_field> = <fs_field_source>. ENDIF. ENDMETHOD. METHOD yif_a2g_context~get_protocol. return = me->go_msg_manager. ENDMETHOD. METHOD yif_a2g_context~read_data. "& Source Part me->rebuild_data( ). return = me->gv_data. ENDMETHOD. METHOD yif_a2g_context~write_data. "& Source Part FIELD-SYMBOLS <fs_struct> TYPE any. FIELD-SYMBOLS <fs_struct_in> TYPE any. ASSIGN me->gv_data->* TO <fs_struct>. ASSIGN input->* TO <fs_struct_in>. <fs_struct> = <fs_struct_in>. me->abap_2_json( ). me->push_data( ). ENDMETHOD. "YIF_cONTEXT~write_data METHOD yif_a2g_json_context~read_json_data. "& Source Part me->rebuild_data( ). me->abap_2_json( ). return = me->gv_json. ENDMETHOD. METHOD yif_a2g_json_context~write_json_data. "& Source Part me->gv_json = input. me->json_2_abap( ). me->push_data( ). ENDMETHOD. "YIF_cONTEXT~write_data METHOD yif_a2g_json~get_abap. me->json_2_abap( ). return = me->gv_data. ENDMETHOD. METHOD yif_a2g_json~get_attribute. * Do Nothing no attribute ad this level ENDMETHOD. METHOD yif_a2g_json~get_element. * Do Nothing no element ad this level ENDMETHOD. METHOD yif_a2g_json~new_element. * Do Nothing no element ad this level ENDMETHOD. METHOD yif_a2g_json~set_attribute. * Do Nothing no attribute ad this level ENDMETHOD. METHOD yif_a2g_json~set_default. * Do Nothing no attribute ad this level ENDMETHOD. ENDCLASS.
28.864542
106
0.654382
7405fbfa3803dd6f874341f6c97eb863682d9b9f
5,740
abap
ABAP
src/checks/zcl_aoc_check_79.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_79.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_79.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
null
null
null
CLASS zcl_aoc_check_79 DEFINITION PUBLIC INHERITING FROM zcl_aoc_super CREATE PUBLIC . PUBLIC SECTION. METHODS constructor . METHODS check REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_method, clsname TYPE seoclsname, cpdname TYPE seocpdname, include TYPE programm, END OF ty_method . TYPES: ty_methods_tt TYPE STANDARD TABLE OF ty_method WITH DEFAULT KEY . DATA mt_compiler TYPE scr_refs . DATA mt_statements TYPE zcl_aoc_scan=>ty_statements . METHODS check_local IMPORTING !is_method TYPE ty_method !is_local TYPE scr_ref RETURNING VALUE(rv_error) TYPE abap_bool . METHODS find_writes IMPORTING !is_method TYPE ty_method !is_local TYPE scr_ref RETURNING VALUE(rt_writes) TYPE scr_refs . METHODS initialize IMPORTING !io_scan TYPE REF TO zcl_aoc_scan . METHODS find_locals IMPORTING !is_method TYPE ty_method RETURNING VALUE(rt_locals) TYPE scr_refs . METHODS find_methods IMPORTING !it_levels TYPE slevel_tab RETURNING VALUE(rt_methods) TYPE ty_methods_tt . ENDCLASS. CLASS ZCL_AOC_CHECK_79 IMPLEMENTATION. METHOD check. * abapOpenChecks * https://github.com/larshp/abapOpenChecks * MIT License DATA: lt_methods TYPE ty_methods_tt, lt_locals TYPE scr_refs, lv_error TYPE abap_bool, ls_local LIKE LINE OF lt_locals, ls_method LIKE LINE OF lt_methods. * Only consider local variables in global methods IF object_type <> 'CLAS'. RETURN. ENDIF. initialize( io_scan ). lt_methods = find_methods( io_scan->levels ). LOOP AT lt_methods INTO ls_method. lt_locals = find_locals( ls_method ). LOOP AT lt_locals INTO ls_local. lv_error = check_local( is_method = ls_method is_local = ls_local ). IF lv_error = abap_true. inform( p_sub_obj_name = ls_method-include p_line = ls_local-line p_kind = mv_errty p_test = myname p_param_1 = ls_local-name p_code = '001' ). ENDIF. ENDLOOP. ENDLOOP. ENDMETHOD. METHOD check_local. DATA: lt_writes TYPE scr_refs, ls_statement LIKE LINE OF mt_statements, ls_first LIKE LINE OF lt_writes. lt_writes = find_writes( is_method = is_method is_local = is_local ). READ TABLE lt_writes INDEX 1 INTO ls_first. IF sy-subrc <> 0. RETURN. ENDIF. * assumption: max one statement per line READ TABLE mt_statements INTO ls_statement WITH KEY include = is_method-include start-row = ls_first-statement->start_line. * note that for changed statements it might not find the correct STR, but this is okay IF sy-subrc <> 0 OR ( ls_statement-str NP 'CLEAR *' AND ls_statement-str NP 'REFRESH *' AND ls_statement-str NP 'FREE *' ). RETURN. ENDIF. LOOP AT mt_statements INTO ls_statement WHERE include = is_method-include AND start-row < ls_first-line. IF ls_statement-str CP 'SELECT SINGLE *' OR ls_statement-str CP 'SELECT * INTO TABLE *' OR ls_statement-str CP 'SELECT * INTO CORRESPONDING FIELDS OF TABLE *' OR ls_statement-str CP 'SELECT * APPENDING TABLE *' OR ls_statement-str CP 'SELECT * APPENDING CORRESPONDING FIELDS OF TABLE *'. CONTINUE. ENDIF. IF ls_statement-str CP 'LOOP AT *' OR ls_statement-str CP 'WHILE *' OR ls_statement-str CP 'SELECT *' OR ls_statement-str CP 'DO *' OR ls_statement-str = 'DO'. RETURN. ENDIF. ENDLOOP. rv_error = abap_true. ENDMETHOD. METHOD constructor. super->constructor( ). version = '001'. position = '079'. has_attributes = abap_true. attributes_ok = abap_true. insert_scimessage( iv_code = '001' iv_text = 'CLEAR as first of variable, &1'(m01) ). ENDMETHOD. METHOD find_locals. rt_locals = mt_compiler. DELETE rt_locals WHERE grade <> cl_abap_compiler=>grade_definition OR mode2 <> '2' OR statement->source_info->name <> is_method-include. ENDMETHOD. METHOD find_methods. DATA: ls_mtdkey TYPE seocpdkey, ls_method LIKE LINE OF rt_methods, ls_level LIKE LINE OF it_levels. LOOP AT it_levels INTO ls_level. cl_oo_classname_service=>get_method_by_include( EXPORTING incname = ls_level-name RECEIVING mtdkey = ls_mtdkey EXCEPTIONS class_not_existing = 1 method_not_existing = 2 OTHERS = 3 ). IF sy-subrc <> 0. CONTINUE. ENDIF. CLEAR ls_method. MOVE-CORRESPONDING ls_mtdkey TO ls_method. ls_method-include = ls_level-name. APPEND ls_method TO rt_methods. ENDLOOP. ENDMETHOD. METHOD find_writes. rt_writes = mt_compiler. DELETE rt_writes WHERE statement->source_info->name <> is_method-include. DELETE rt_writes WHERE full_name <> is_local-full_name. DELETE rt_writes WHERE mode2 <> '6' AND mode2 <> '9' AND mode2 <> 'D'. ENDMETHOD. METHOD initialize. mt_compiler = zcl_aoc_compiler=>get_instance( iv_object_type = object_type iv_object_name = object_name )->get_result( ). mt_statements = io_scan->build_statements( ). ENDMETHOD. ENDCLASS.
24.322034
86
0.624042
7410fab1e0d3111a623b46d1758c729d9aa1dce6
627
abap
ABAP
src/oauth/infrastructure/if_oauth_request_repo.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
1
2020-06-24T22:15:05.000Z
2020-06-24T22:15:05.000Z
src/oauth/infrastructure/if_oauth_request_repo.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
null
null
null
src/oauth/infrastructure/if_oauth_request_repo.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
null
null
null
*"* components of interface /OOP/IF_OAUTH_REQUEST_REPO interface /OOP/IF_OAUTH_REQUEST_REPO public . methods FIND_BY_ID importing !CONSUMER_KEY type /OOP/OA_CONSUMER_KEY !TIMESTAMP type /OOP/OA_TIMESTAMP !NONCE type /OOP/OA_NONCE returning value(RETURNING) type ref to /OOP/CL_OAUTH_REQUEST . methods CREATE importing !REQUEST type ref to /OOP/CL_OAUTH_REQUEST raising /OOP/CX_OAUTH_RECORD_EXISTS . methods UPDATE importing !REQUEST type ref to /OOP/CL_OAUTH_REQUEST raising /OOP/CX_OAUTH_RECORD_NOT_FOUND . endinterface.
26.125
59
0.695375
74111f615383bbe61d4de788f515339653acc8a8
16,029
abap
ABAP
src/objects/zcl_abapgit_object_iobj.clas.abap
D047539/abapGit
cbaf3711b4c41e8376144ad7bd848e6a3d3722bb
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/objects/zcl_abapgit_object_iobj.clas.abap
larshp/abapGit
143f7d4d3b938bdbb418fef5f94665ba1f150fb6
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/objects/zcl_abapgit_object_iobj.clas.abap
D047539/abapGit
cbaf3711b4c41e8376144ad7bd848e6a3d3722bb
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
CLASS zcl_abapgit_object_iobj DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. PROTECTED SECTION. PRIVATE SECTION. METHODS: clear_field IMPORTING iv_fieldname TYPE string CHANGING cg_metadata TYPE any. ENDCLASS. CLASS zcl_abapgit_object_iobj IMPLEMENTATION. METHOD clear_field. FIELD-SYMBOLS: <lg_field> TYPE data. ASSIGN COMPONENT iv_fieldname OF STRUCTURE cg_metadata TO <lg_field>. ASSERT sy-subrc = 0. CLEAR: <lg_field>. ENDMETHOD. METHOD zif_abapgit_object~changed_by. DATA: lv_objna TYPE c LENGTH 30, lr_viobj TYPE REF TO data. FIELD-SYMBOLS: <lg_tstpnm> TYPE any, <lg_viobj> TYPE any. lv_objna = ms_item-obj_name. TRY. CREATE DATA lr_viobj TYPE ('RSD_S_VIOBJ'). CATCH cx_sy_create_data_error. zcx_abapgit_exception=>raise( |IOBJ is not supported on this system| ). ENDTRY. ASSIGN lr_viobj->* TO <lg_viobj>. CALL FUNCTION 'RSD_IOBJ_GET' EXPORTING i_iobjnm = lv_objna i_objvers = 'A' IMPORTING e_s_viobj = <lg_viobj> EXCEPTIONS iobj_not_found = 1 illegal_input = 2 bct_comp_invalid = 3 not_authorized = 4 OTHERS = 5. IF sy-subrc = 0. ASSIGN COMPONENT 'TSTPNM' OF STRUCTURE <lg_viobj> TO <lg_tstpnm>. rv_user = <lg_tstpnm>. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. TYPES: BEGIN OF ty_iobj, objnm TYPE c LENGTH 30. TYPES END OF ty_iobj. DATA: lt_iobjname TYPE STANDARD TABLE OF ty_iobj, lv_subrc TYPE sy-subrc, lv_object TYPE string, lv_object_class TYPE string, lv_transp_pkg TYPE abap_bool. lv_transp_pkg = zcl_abapgit_factory=>get_sap_package( iv_package )->are_changes_recorded_in_tr_req( ). APPEND ms_item-obj_name TO lt_iobjname. CALL FUNCTION 'RSDG_IOBJ_MULTI_DELETE' EXPORTING i_t_iobjnm = lt_iobjname IMPORTING e_subrc = lv_subrc. IF lv_subrc <> 0. zcx_abapgit_exception=>raise( |Error when deleting InfoObject { ms_item-obj_name }| ). ENDIF. IF lv_transp_pkg = abap_true. lv_object_class = ms_item-obj_type. lv_object = ms_item-obj_name. CALL FUNCTION 'RS_CORR_INSERT' EXPORTING object = lv_object object_class = lv_object_class master_language = mv_language global_lock = abap_true mode = 'D' suppress_dialog = abap_true EXCEPTIONS cancelled = 1 permission_failure = 2 unknown_objectclass = 3 OTHERS = 4. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lr_details TYPE REF TO data, lr_infoobj TYPE REF TO data, ls_return TYPE bapiret2, lt_return TYPE STANDARD TABLE OF bapiret2, lr_compounds TYPE REF TO data, lr_attributes TYPE REF TO data, lr_navigationattributes TYPE REF TO data, lr_atrnavinfoprovider TYPE REF TO data, lr_hierarchycharacteristics TYPE REF TO data, lr_elimination TYPE REF TO data, lr_hanafieldsmapping TYPE REF TO data, lr_xxlattributes TYPE REF TO data. FIELD-SYMBOLS: <lg_details> TYPE any, <lt_compounds> TYPE STANDARD TABLE, <lt_attributes> TYPE STANDARD TABLE, <lt_navigationattributes> TYPE STANDARD TABLE, <lt_atrnavinfoprovider> TYPE STANDARD TABLE, <lt_hierarchycharacteristics> TYPE STANDARD TABLE, <lt_elimination> TYPE STANDARD TABLE, <lt_hanafieldsmapping> TYPE STANDARD TABLE, <lt_xxlattributes> TYPE STANDARD TABLE, <lg_infoobject> TYPE data, <lt_infoobjects> TYPE STANDARD TABLE. TRY. CREATE DATA lr_details TYPE ('BAPI6108'). CREATE DATA lr_compounds TYPE STANDARD TABLE OF ('BAPI6108CM'). CREATE DATA lr_attributes TYPE STANDARD TABLE OF ('BAPI6108AT'). CREATE DATA lr_navigationattributes TYPE STANDARD TABLE OF ('BAPI6108AN'). CREATE DATA lr_atrnavinfoprovider TYPE STANDARD TABLE OF ('BAPI6108NP'). CREATE DATA lr_hierarchycharacteristics TYPE STANDARD TABLE OF ('BAPI6108HC'). CREATE DATA lr_elimination TYPE STANDARD TABLE OF ('BAPI6108IE'). CREATE DATA lr_hanafieldsmapping TYPE STANDARD TABLE OF ('BAPI6108HANA_MAP'). CREATE DATA lr_xxlattributes TYPE STANDARD TABLE OF ('BAPI6108ATXXL'). CREATE DATA lr_infoobj TYPE STANDARD TABLE OF ('BAPI6108'). CATCH cx_sy_create_data_error. zcx_abapgit_exception=>raise( |IOBJ is not supported on this system| ). ENDTRY. ASSIGN lr_details->* TO <lg_details>. ASSIGN lr_compounds->* TO <lt_compounds>. ASSIGN lr_attributes->* TO <lt_attributes>. ASSIGN lr_navigationattributes->* TO <lt_navigationattributes>. ASSIGN lr_atrnavinfoprovider->* TO <lt_atrnavinfoprovider>. ASSIGN lr_hierarchycharacteristics->* TO <lt_hierarchycharacteristics>. ASSIGN lr_elimination->* TO <lt_elimination>. ASSIGN lr_hanafieldsmapping->* TO <lt_hanafieldsmapping>. ASSIGN lr_xxlattributes->* TO <lt_xxlattributes>. ASSIGN lr_infoobj->* TO <lt_infoobjects>. io_xml->read( EXPORTING iv_name = 'IOBJ' CHANGING cg_data = <lg_details> ). io_xml->read( EXPORTING iv_name = 'COMPOUNDS' CHANGING cg_data = <lt_compounds> ). io_xml->read( EXPORTING iv_name = 'ATTRIBUTES' CHANGING cg_data = <lt_attributes> ). io_xml->read( EXPORTING iv_name = 'NAVIGATION_ATTRIBUTES' CHANGING cg_data = <lt_navigationattributes> ). io_xml->read( EXPORTING iv_name = 'ATTR_NAVIGATION' CHANGING cg_data = <lt_atrnavinfoprovider> ). io_xml->read( EXPORTING iv_name = 'HIERARCHY' CHANGING cg_data = <lt_hierarchycharacteristics> ). io_xml->read( EXPORTING iv_name = 'ELIMINATION' CHANGING cg_data = <lt_elimination> ). io_xml->read( EXPORTING iv_name = 'HANA_FIELDS_MAPPING' CHANGING cg_data = <lt_hanafieldsmapping> ). io_xml->read( EXPORTING iv_name = 'XXL_ATTRIBUTES' CHANGING cg_data = <lt_xxlattributes> ). " Number ranges are local (should not have been serialized) clear_field( EXPORTING iv_fieldname = 'NUMBRANR' CHANGING cg_metadata = <lg_details> ). TRY. ASSIGN COMPONENT 'INFOOBJECT' OF STRUCTURE <lg_details> TO <lg_infoobject>. ASSERT sy-subrc = 0. IF zif_abapgit_object~exists( ) = abap_false. CALL FUNCTION 'BAPI_IOBJ_CREATE' EXPORTING details = <lg_details> IMPORTING return = ls_return TABLES compounds = <lt_compounds> attributes = <lt_attributes> navigationattributes = <lt_navigationattributes> atrnavinfoprovider = <lt_atrnavinfoprovider> hierarchycharacteristics = <lt_hierarchycharacteristics> elimination = <lt_elimination> hanafieldsmapping = <lt_hanafieldsmapping> xxlattributes = <lt_xxlattributes>. ELSE. CALL FUNCTION 'BAPI_IOBJ_CHANGE' EXPORTING infoobject = <lg_infoobject> details = <lg_details> IMPORTING return = ls_return TABLES compounds = <lt_compounds> attributes = <lt_attributes> navigationattributes = <lt_navigationattributes> atrnavinfoprovider = <lt_atrnavinfoprovider> hierarchycharacteristics = <lt_hierarchycharacteristics> elimination = <lt_elimination> hanafieldsmapping = <lt_hanafieldsmapping> xxlattributes = <lt_xxlattributes>. ENDIF. IF ls_return-type = 'E'. zcx_abapgit_exception=>raise( |Error when creating iobj: { ls_return-message }| ). ENDIF. APPEND <lg_infoobject> TO <lt_infoobjects>. CALL FUNCTION 'BAPI_IOBJ_ACTIVATE_MULTIPLE' TABLES infoobjects = <lt_infoobjects> return = lt_return. READ TABLE lt_return WITH KEY type = 'E' INTO ls_return. IF sy-subrc = 0. zcx_abapgit_exception=>raise( |Error when activating iobj: { ls_return-message }| ). ENDIF. CATCH cx_sy_dyn_call_illegal_func. zcx_abapgit_exception=>raise( |Necessary BW function modules not found| ). ENDTRY. tadir_insert( iv_package ). corr_insert( iv_package ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_iobjnm TYPE c LENGTH 30. SELECT SINGLE iobjnm FROM ('RSDIOBJ') INTO lv_iobjnm WHERE iobjnm = ms_item-obj_name. rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-delete_tadir = abap_true. ENDMETHOD. METHOD zif_abapgit_object~is_active. DATA: lv_objna TYPE c LENGTH 30, lr_viobj TYPE REF TO data. FIELD-SYMBOLS: <lg_objstat> TYPE any, <lg_viobj> TYPE any. lv_objna = ms_item-obj_name. TRY. CREATE DATA lr_viobj TYPE ('RSD_S_VIOBJ'). CATCH cx_sy_create_data_error. zcx_abapgit_exception=>raise( |IOBJ is not supported on this system| ). ENDTRY. ASSIGN lr_viobj->* TO <lg_viobj>. CALL FUNCTION 'RSD_IOBJ_GET' EXPORTING i_iobjnm = lv_objna i_objvers = 'A' IMPORTING e_s_viobj = <lg_viobj>. ASSIGN COMPONENT 'OBJSTAT' OF STRUCTURE <lg_viobj> TO <lg_objstat>. IF <lg_objstat> = 'ACT' AND sy-subrc = 0. rv_active = abap_true. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~is_locked. DATA: lv_object TYPE eqegraarg. lv_object = ms_item-obj_name. OVERLAY lv_object WITH ' '. lv_object = lv_object && '*'. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'E_BIW_PROV' iv_argument = lv_object ). ENDMETHOD. METHOD zif_abapgit_object~jump. " Covered by ZCL_ABAPGIT_OBJECTS=>JUMP ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lv_iobjnam TYPE rsiobjnm, ls_return TYPE bapiret2, lr_details TYPE REF TO data, lr_compounds TYPE REF TO data, lr_attributes TYPE REF TO data, lr_navigationattributes TYPE REF TO data, lr_atrnavinfoprovider TYPE REF TO data, lr_hierarchycharacteristics TYPE REF TO data, lr_elimination TYPE REF TO data, lr_hanafieldsmapping TYPE REF TO data, lr_xxlattributes TYPE REF TO data. FIELD-SYMBOLS: <lg_details> TYPE any, <lt_compounds> TYPE STANDARD TABLE, <lt_attributes> TYPE STANDARD TABLE, <lt_navigationattributes> TYPE STANDARD TABLE, <lt_atrnavinfoprovider> TYPE STANDARD TABLE, <lt_hierarchycharacteristics> TYPE STANDARD TABLE, <lt_elimination> TYPE STANDARD TABLE, <lt_hanafieldsmapping> TYPE STANDARD TABLE, <lt_xxlattributes> TYPE STANDARD TABLE. TRY. CREATE DATA lr_details TYPE ('BAPI6108'). CREATE DATA lr_compounds TYPE STANDARD TABLE OF ('BAPI6108CM'). CREATE DATA lr_attributes TYPE STANDARD TABLE OF ('BAPI6108AT'). CREATE DATA lr_navigationattributes TYPE STANDARD TABLE OF ('BAPI6108AN'). CREATE DATA lr_atrnavinfoprovider TYPE STANDARD TABLE OF ('BAPI6108NP'). CREATE DATA lr_hierarchycharacteristics TYPE STANDARD TABLE OF ('BAPI6108HC'). CREATE DATA lr_elimination TYPE STANDARD TABLE OF ('BAPI6108IE'). CREATE DATA lr_hanafieldsmapping TYPE STANDARD TABLE OF ('BAPI6108HANA_MAP'). CREATE DATA lr_xxlattributes TYPE STANDARD TABLE OF ('BAPI6108ATXXL'). CATCH cx_sy_create_data_error. zcx_abapgit_exception=>raise( |IOBJ is not supported on this system| ). ENDTRY. ASSIGN lr_details->* TO <lg_details>. ASSIGN lr_compounds->* TO <lt_compounds>. ASSIGN lr_attributes->* TO <lt_attributes>. ASSIGN lr_navigationattributes->* TO <lt_navigationattributes>. ASSIGN lr_atrnavinfoprovider->* TO <lt_atrnavinfoprovider>. ASSIGN lr_hierarchycharacteristics->* TO <lt_hierarchycharacteristics>. ASSIGN lr_elimination->* TO <lt_elimination>. ASSIGN lr_hanafieldsmapping->* TO <lt_hanafieldsmapping>. ASSIGN lr_xxlattributes->* TO <lt_xxlattributes>. lv_iobjnam = ms_item-obj_name. CALL FUNCTION 'BAPI_IOBJ_GETDETAIL' EXPORTING infoobject = lv_iobjnam IMPORTING details = <lg_details> return = ls_return TABLES compounds = <lt_compounds> attributes = <lt_attributes> navigationattributes = <lt_navigationattributes> atrnavinfoprovider = <lt_atrnavinfoprovider> hierarchycharacteristics = <lt_hierarchycharacteristics> elimination = <lt_elimination> hanafieldsmapping = <lt_hanafieldsmapping> xxlattributes = <lt_xxlattributes>. IF ls_return-type = 'E'. zcx_abapgit_exception=>raise( |Error getting details of InfoObject: { ls_return-message }| ). ENDIF. clear_field( EXPORTING iv_fieldname = 'TSTPNM' CHANGING cg_metadata = <lg_details> ). clear_field( EXPORTING iv_fieldname = 'TIMESTMP' CHANGING cg_metadata = <lg_details> ). clear_field( EXPORTING iv_fieldname = 'DBROUTID' CHANGING cg_metadata = <lg_details> ). " Number ranges are local clear_field( EXPORTING iv_fieldname = 'NUMBRANR' CHANGING cg_metadata = <lg_details> ). io_xml->add( iv_name = 'IOBJ' ig_data = <lg_details> ). io_xml->add( iv_name = 'COMPOUNDS' ig_data = <lt_compounds> ). io_xml->add( iv_name = 'ATTRIBUTES' ig_data = <lt_attributes> ). io_xml->add( iv_name = 'NAVIGATION_ATTRIBUTES' ig_data = <lt_navigationattributes> ). io_xml->add( iv_name = 'ATTR_NAVIGATION' ig_data = <lt_atrnavinfoprovider> ). io_xml->add( iv_name = 'HIERARCHY' ig_data = <lt_hierarchycharacteristics> ). io_xml->add( iv_name = 'ELIMINATION' ig_data = <lt_elimination> ). io_xml->add( iv_name = 'HANA_FIELDS_MAPPING' ig_data = <lt_hanafieldsmapping> ). io_xml->add( iv_name = 'XXL_ATTRIBUTES' ig_data = <lt_xxlattributes> ). ENDMETHOD. ENDCLASS.
33.324324
106
0.615697
7413d645b4fdc271cd8c8164e46e5299291227f3
31,122
abap
ABAP
src/zrpclstxe.prog.abap
jjtorres8/ZRPCLSTXE
741cb46284d4d2694660b7c911cd5215c68626f9
[ "MIT" ]
null
null
null
src/zrpclstxe.prog.abap
jjtorres8/ZRPCLSTXE
741cb46284d4d2694660b7c911cd5215c68626f9
[ "MIT" ]
null
null
null
src/zrpclstxe.prog.abap
jjtorres8/ZRPCLSTXE
741cb46284d4d2694660b7c911cd5215c68626f9
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Report ZRPCLSTXE *&---------------------------------------------------------------------* *& Información: Programa similar al estándar PC_PAYRESULT (RPCLSTRE) *& que realiza la lectura de los resultados de nómina del *& esquema de paga extra española (cluster XE). *&---------------------------------------------------------------------* *& Creado por: JTD *& Fecha última versión: 23.03.2019 *&---------------------------------------------------------------------* REPORT zrpclstxe. TABLES: pernr. TABLES: pcl1, pcl2. * Llamada a includes. INCLUDE rpppxd00. "Definición del buffer DATA: BEGIN OF COMMON PART buffer. INCLUDE rpppxd10. "Definición del buffer DATA: END OF COMMON PART buffer. INCLUDE rpppxm00. "Instrucciones para el buffer INCLUDE rpc2cd00. "Datos específicos: Cluster Directory INCLUDE rpc2rx00. "Datos específicos: Cluster nómina general INCLUDE rpc2ree0. "Datos específicos: Cluster nómina en España * Definición de variables, tablas y estructuras del cluster: CONSTANTS: marcado(1) VALUE 'X', c_si(1) VALUE '1', c_no(1) VALUE '2', c_cancel(1) VALUE 'A'. *----------------------------------------------------------------------* * CLASS DEFINITION * *----------------------------------------------------------------------* * Local Class to set event CLASS lcl_event_handler DEFINITION. PUBLIC SECTION. METHODS: * Double-click control handle_double_click FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column es_row_no. METHODS: * Hotspot click control handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_row_id e_column_id es_row_no. ENDCLASS. "lcl_event_receiver DEFINITION *----------------------------------------------------------------------* * CLASS IMPLEMENTATION * *----------------------------------------------------------------------* CLASS lcl_event_handler IMPLEMENTATION. * Handle Double Click METHOD handle_double_click. PERFORM handle_double_click USING e_row e_column es_row_no. ENDMETHOD . "handle_double_click * Handle Hotspot Click METHOD handle_hotspot_click. PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no. ENDMETHOD. "handle_hotspot_click ENDCLASS. "lcl_event_receiver IMPLEMENTATION *----------------------------------------------------------------------* * CLASS DEFINITION * *----------------------------------------------------------------------* * Local Class to set event CLASS lcl_event_handler2 DEFINITION. PUBLIC SECTION. METHODS: * Double-click control handle_double_click2 FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row e_column es_row_no. METHODS: * Hotspot click control handle_hotspot_click2 FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_row_id e_column_id es_row_no. ENDCLASS. "lcl_event_receiver DEFINITION *----------------------------------------------------------------------* * CLASS IMPLEMENTATION * *----------------------------------------------------------------------* CLASS lcl_event_handler2 IMPLEMENTATION. * Handle Double Click METHOD handle_double_click2. PERFORM handle_double_click2 USING e_row e_column es_row_no. ENDMETHOD . "handle_double_click * Handle Hotspot Click METHOD handle_hotspot_click2. PERFORM handle_hotspot_click2 USING e_row_id e_column_id es_row_no. ENDMETHOD. "handle_hotspot_click ENDCLASS. "lcl_event_receiver IMPLEMENTATION *---------------------------------------------------------------------* * Tablas, estructuras y variables para el ALV. *---------------------------------------------------------------------* TYPES: BEGIN OF t_rgdir, pernr TYPE persno, seqnr TYPE cdseq, perpara TYPE char7, peren TYPE char7, borrar TYPE char4, END OF t_rgdir. TYPES: BEGIN OF t_tablas, tabla TYPE char10, descripcion TYPE char40, registros(6) TYPE n, END OF t_tablas. DATA: ok_code TYPE syucomm, ok_code2 TYPE syucomm, p_per(6) TYPE c, coment(1) TYPE c, g_main_control TYPE REF TO cl_hr_lstce_main_control, g_error_handler TYPE REF TO cl_hr_lstce_error_handler, gt_list TYPE TABLE OF t_rgdir WITH HEADER LINE, gt_list2 TYPE TABLE OF t_tablas WITH HEADER LINE. DATA: gr_event_handler TYPE REF TO lcl_event_handler, gr_event_handler2 TYPE REF TO lcl_event_handler2, gr_alvgrid TYPE REF TO cl_gui_alv_grid, gr_alvgrid2 TYPE REF TO cl_gui_alv_grid, gc_custom_control_name TYPE scrfname VALUE 'CC_ALV', gc_custom_control_name2 TYPE scrfname VALUE 'CC_ALV2', gr_ccontainer TYPE REF TO cl_gui_custom_container, gr_ccontainer2 TYPE REF TO cl_gui_custom_container, gt_fieldcat TYPE lvc_t_fcat, gt_fieldcat2 TYPE lvc_t_fcat, gs_layout TYPE lvc_s_layo, gs_layout2 TYPE lvc_s_layo. * ... and a model class object DATA: gr_table TYPE REF TO cl_salv_table. * if you want to display the data table on your own Dynpro, you also need a container DATA: gr_container TYPE REF TO cl_gui_custom_container. DATA: g_okcode TYPE syucomm. DATA nombre_tabla TYPE char12. DATA descr_tabla(60). SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(25) text-002 FOR FIELD s_pernr. SELECT-OPTIONS s_pernr FOR pernr-pernr NO INTERVALS MATCHCODE OBJECT prem. SELECTION-SCREEN COMMENT 70(20) text-003 FOR FIELD s_abkrs. SELECT-OPTIONS s_abkrs FOR pernr-abkrs NO INTERVALS MATCHCODE OBJECT h_t549a. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(28) text-005 FOR FIELD p_pbeg. PARAMETER p_pbeg TYPE begda. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF SCREEN 1100. *&---------------------------------------------------------------------* *& Module STATUS_1000 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_1000 OUTPUT. SET PF-STATUS 'BOTONES'. SET TITLEBAR 'TITULO'. ENDMODULE. " STATUS_1000 OUTPUT *&---------------------------------------------------------------------* *& Module Preparar_alvs OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE preparar_alvs OUTPUT. PERFORM preparar_alvs. ENDMODULE. " Preparar_alvs OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_1000 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_1000 INPUT. IF s_pernr[] IS INITIAL AND ok_code EQ 'ENTER'. MESSAGE i016(rp) WITH text-i01. ELSE. CASE ok_code. WHEN 'VOLVER'. PERFORM liberar_memoria. LEAVE TO SCREEN 0. WHEN 'ATRAS'. PERFORM liberar_memoria. LEAVE TO SCREEN 0. WHEN 'SALIR'. PERFORM liberar_memoria. LEAVE PROGRAM. WHEN 'ENTER'. PERFORM seleccionar_registros. PERFORM display_alv. ENDCASE. ENDIF. ENDMODULE. " USER_COMMAND_1000 INPUT *&---------------------------------------------------------------------* *& Form display_alv *----------------------------------------------------------------------* FORM display_alv . CALL METHOD gr_alvgrid->refresh_table_display EXCEPTIONS finished = 1 OTHERS = 2. CALL METHOD gr_alvgrid2->refresh_table_display EXCEPTIONS finished = 1 OTHERS = 2. ENDFORM. " display_alv *&---------------------------------------------------------------------* *& Form handle_double_click *&---------------------------------------------------------------------* FORM handle_double_click USING i_row TYPE lvc_s_row i_column TYPE lvc_s_col is_row_no TYPE lvc_s_roid. READ TABLE gt_list INDEX is_row_no-row_id. IF sy-subrc = 0. CLEAR gt_list2. REFRESH gt_list2. CLEAR rx-key. MOVE gt_list-pernr TO rx-key-pernr. MOVE gt_list-seqnr TO rx-key-seqno. rp-imp-c2-xe. * Relleno la tabla WPBP IF wpbp[] IS NOT INITIAL. MOVE 'WPBP' TO gt_list2-tabla. MOVE 'Puesto tbjo./emol.básicos' TO gt_list2-descripcion. DESCRIBE TABLE wpbp LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla RT IF rt[] IS NOT INITIAL. MOVE 'RT' TO gt_list2-tabla. MOVE 'Tabla de resultados' TO gt_list2-descripcion. DESCRIBE TABLE rt LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla CRT IF crt[] IS NOT INITIAL. MOVE 'CRT' TO gt_list2-tabla. MOVE 'Tablas resultado acumuladas' TO gt_list2-descripcion. DESCRIBE TABLE crt LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla BT IF bt[] IS NOT INITIAL. MOVE 'BT' TO gt_list2-tabla. MOVE 'Transferencia' TO gt_list2-descripcion. DESCRIBE TABLE bt LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla AB IF ab[] IS NOT INITIAL. MOVE 'AB' TO gt_list2-tabla. MOVE 'Absentismos' TO gt_list2-descripcion. DESCRIBE TABLE ab LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla ABC IF abc[] IS NOT INITIAL. MOVE 'ABC' TO gt_list2-tabla. MOVE 'Acumulación Clases de absentismos' TO gt_list2-descripcion. DESCRIBE TABLE abc LINES gt_list2-registros. APPEND gt_list2. ENDIF. ** Relleno la tabla Version * IF version IS NOT INITIAL. * MOVE 'VERSION' TO gt_list2-tabla. * MOVE 'Información de creación' TO gt_list2-descripcion. * DESCRIBE TABLE version LINES gt_list2-registros. * append gt_list2. * ENDIF. * Relleno la tabla Versc IF versc IS NOT INITIAL. MOVE 'VERSC' TO gt_list2-tabla. MOVE 'Información status de nómina' TO gt_list2-descripcion. MOVE 1 TO gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla ST IF st[] IS NOT INITIAL. MOVE 'ST' TO gt_list2-tabla. MOVE 'Impuestos' TO gt_list2-descripcion. DESCRIBE TABLE st LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla ST IF sv[] IS NOT INITIAL. MOVE 'SV' TO gt_list2-tabla. MOVE 'Seguridad Social' TO gt_list2-descripcion. DESCRIBE TABLE sv LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla SP IF sp[] IS NOT INITIAL. MOVE 'SP' TO gt_list2-tabla. MOVE 'Pagas extraordinarias' TO gt_list2-descripcion. DESCRIBE TABLE sp LINES gt_list2-registros. APPEND gt_list2. ENDIF. * Relleno la tabla Garnt IF garnt[] IS NOT INITIAL. MOVE 'GARNT' TO gt_list2-tabla. MOVE 'Retenciones (España)' TO gt_list2-descripcion. DESCRIBE TABLE garnt LINES gt_list2-registros. APPEND gt_list2. ENDIF. ENDIF. CALL METHOD gr_alvgrid2->refresh_table_display EXCEPTIONS finished = 1 OTHERS = 2. ENDFORM. " handle_double_click *---------------------------------------------------------------------* * FORM handle_hotspot_click * *---------------------------------------------------------------------* FORM handle_hotspot_click USING e_row_id TYPE lvc_s_row e_column_id TYPE lvc_s_col es_row_no TYPE lvc_s_roid. DATA: titulo TYPE string, texto TYPE string. DATA answer TYPE char1. DATA clave TYPE pclkey. DATA error TYPE flag. MOVE text-004 TO titulo. CONCATENATE text-006 text-007 text-008 INTO texto SEPARATED BY space. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING titlebar = titulo text_question = texto IMPORTING answer = answer EXCEPTIONS text_not_found = 1 OTHERS = 2. IF answer EQ '1'. READ TABLE gt_list INDEX e_row_id. IF sy-subrc EQ 0. * Existe un report estándar que borra registros del cluster XE. * Hago un submit a este programa. * submit rpudxee0 * with r_iperm = '01' "Normalmente va a ser mensual. * with r_pabrj = gt_list-peren+3(4) * with r_pabrp = gt_list-peren(2) * with r_pernr = gt_list-pernr * with r_test = space * and return. * Mejor que hacer el submit, me creo un perform donde utilizo justo * lo que necesito del report estándar. PERFORM borrar_cluster_xe USING gt_list CHANGING error. IF error EQ space. * Actualizo la lista del ALV. DELETE gt_list INDEX e_row_id. * Refresco el listado. CALL METHOD gr_alvgrid->refresh_table_display EXCEPTIONS finished = 1 OTHERS = 2. ENDIF. ENDIF. ELSE. CALL FUNCTION 'POPUP_TO_INFORM' EXPORTING titel = text-009 txt1 = text-010 txt2 = space. ENDIF. ENDFORM. "handle_hotspot_click *&---------------------------------------------------------------------* *& Form handle_double_click *&---------------------------------------------------------------------* FORM handle_double_click2 USING i_row TYPE lvc_s_row i_column TYPE lvc_s_col is_row_no TYPE lvc_s_roid. READ TABLE gt_list2 INDEX is_row_no-row_id. IF sy-subrc = 0. CLEAR nombre_tabla. CLEAR descr_tabla. MOVE gt_list2-tabla TO nombre_tabla. MOVE gt_list2-descripcion TO descr_tabla. CALL SCREEN '2000'. ENDIF. CALL METHOD gr_alvgrid2->refresh_table_display EXCEPTIONS finished = 1 OTHERS = 2. ENDFORM. " handle_double_click *---------------------------------------------------------------------* * FORM handle_hotspot_click * *---------------------------------------------------------------------* FORM handle_hotspot_click2 USING e_row_id TYPE lvc_s_row e_column_id TYPE lvc_s_col es_row_no TYPE lvc_s_roid. ENDFORM. "handle_hotspot_click *&---------------------------------------------------------------------* *& Form prepare_field_catalog *&---------------------------------------------------------------------* FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat. DATA ls_fcat TYPE lvc_s_fcat. ls_fcat-fieldname = 'PERNR'. ls_fcat-outputlen = '8'. ls_fcat-coltext = 'NºEmpleado'. ls_fcat-seltext = 'NºEmpleado'. APPEND ls_fcat TO pt_fieldcat. CLEAR ls_fcat. ls_fcat-fieldname = 'SEQNR'. ls_fcat-outputlen = '5'. ls_fcat-coltext = 'Secuencia'. ls_fcat-seltext = 'Secuencia'. APPEND ls_fcat TO pt_fieldcat. CLEAR ls_fcat. ls_fcat-fieldname = 'PERPARA'. ls_fcat-outputlen = '7'. ls_fcat-coltext = 'Per.Para'. ls_fcat-seltext = 'Per.Para'. APPEND ls_fcat TO pt_fieldcat. CLEAR ls_fcat. ls_fcat-fieldname = 'PEREN'. ls_fcat-outputlen = '7'. ls_fcat-coltext = 'Per.En'. ls_fcat-seltext = 'Per.En'. APPEND ls_fcat TO pt_fieldcat. * Opción de Borrado sólo disponible en Desarrollo. IF sy-sysid EQ 'ACD'. CLEAR ls_fcat. ls_fcat-fieldname = 'BORRAR'. ls_fcat-outputlen = '3'. ls_fcat-coltext = 'Borrar'. ls_fcat-seltext = 'Borrar'. ls_fcat-icon = 'X'. ls_fcat-hotspot = 'X'. APPEND ls_fcat TO pt_fieldcat. ENDIF. ENDFORM. " prepare_field_catalog *&---------------------------------------------------------------------* *& Form prepare_layout *&---------------------------------------------------------------------* FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo. ps_layout-zebra = 'X'. ps_layout-smalltitle = 'X'. ENDFORM. " prepare_layout *&---------------------------------------------------------------------* *& Form prepare_field_catalog *&---------------------------------------------------------------------* FORM prepare_field_catalog2 CHANGING pt_fieldcat TYPE lvc_t_fcat. DATA ls_fcat TYPE lvc_s_fcat. ls_fcat-fieldname = 'TABLA'. ls_fcat-outputlen = '10'. ls_fcat-coltext = 'Nombre'. ls_fcat-seltext = 'Nombre'. APPEND ls_fcat TO pt_fieldcat. CLEAR ls_fcat. ls_fcat-fieldname = 'DESCRIPCION'. ls_fcat-outputlen = '60'. ls_fcat-coltext = 'Denominación'. ls_fcat-seltext = 'Denominación'. APPEND ls_fcat TO pt_fieldcat. CLEAR ls_fcat. ls_fcat-fieldname = 'REGISTROS'. ls_fcat-outputlen = '6'. ls_fcat-coltext = 'Cant.reg'. ls_fcat-seltext = 'Cant.reg.'. APPEND ls_fcat TO pt_fieldcat. ENDFORM. " prepare_field_catalog *&---------------------------------------------------------------------* *& Form prepare_layout *&---------------------------------------------------------------------* FORM prepare_layout2 CHANGING ps_layout TYPE lvc_s_layo. ps_layout-zebra = 'X'. ps_layout-smalltitle = 'X'. ENDFORM. " prepare_layout *&---------------------------------------------------------------------* *& Form Liberar_memoria *&---------------------------------------------------------------------* FORM liberar_memoria . CALL METHOD gr_alvgrid->free EXCEPTIONS cntl_error = 1 cntl_system_error = 2 OTHERS = 3. CALL METHOD gr_alvgrid2->free EXCEPTIONS cntl_error = 1 cntl_system_error = 2 OTHERS = 3. CALL METHOD gr_ccontainer->free EXCEPTIONS cntl_error = 1 cntl_system_error = 2 OTHERS = 3. CALL METHOD gr_ccontainer2->free EXCEPTIONS cntl_error = 1 cntl_system_error = 2 OTHERS = 3. ENDFORM. " Liberar_memoria *&---------------------------------------------------------------------* *& Form seleccionar_registros *&---------------------------------------------------------------------* FORM seleccionar_registros . * Accedo al cluster: DATA it_empleados TYPE STANDARD TABLE OF pa0001 WITH HEADER LINE. DATA it_pcl2 TYPE TABLE OF pcl2 WITH HEADER LINE. DATA var_srtfd TYPE pclkey. DATA fecha TYPE char6. CLEAR gt_list. REFRESH gt_list. SELECT * INTO TABLE it_empleados FROM pa0001 WHERE pernr IN s_pernr AND abkrs IN s_abkrs AND endda GE p_pbeg. SORT it_empleados BY pernr ASCENDING. DELETE ADJACENT DUPLICATES FROM it_empleados COMPARING pernr. CLEAR fecha. MOVE p_pbeg(6) TO fecha. LOOP AT it_empleados. CLEAR cd-key. MOVE it_empleados-pernr TO cd-key. rp-imp-c2-cu. LOOP AT dir2 WHERE inper GE fecha AND abkrs IN s_abkrs. MOVE it_empleados-pernr TO gt_list-pernr. MOVE dir2-seqnr TO gt_list-seqnr. CONCATENATE dir2-inper+4(2) '.' dir2-inper(4) INTO gt_list-peren. CONCATENATE dir2-fpper+4(2) '.' dir2-fpper(4) INTO gt_list-perpara. MOVE '@18@' TO gt_list-borrar. APPEND gt_list. ENDLOOP. ENDLOOP. ENDFORM. " seleccionar_registros *&---------------------------------------------------------------------* *& Form Preparar_alvs *&---------------------------------------------------------------------* FORM preparar_alvs . IF ( gr_alvgrid IS INITIAL ). CREATE OBJECT gr_ccontainer EXPORTING container_name = gc_custom_control_name EXCEPTIONS cntl_error = 1 cntl_system_error = 2 create_error = 3 lifetime_error = 4 lifetime_dynpro_dynpro_link = 5 OTHERS = 6. CREATE OBJECT gr_alvgrid EXPORTING i_parent = gr_ccontainer EXCEPTIONS error_cntl_create = 1 error_cntl_init = 2 error_cntl_link = 3 error_dp_create = 4 OTHERS = 5. PERFORM prepare_field_catalog CHANGING gt_fieldcat. PERFORM prepare_layout CHANGING gs_layout. CALL METHOD gr_alvgrid->set_table_for_first_display CHANGING it_outtab = gt_list[] it_fieldcatalog = gt_fieldcat EXCEPTIONS invalid_parameter_combination = 1 program_error = 2 too_many_lines = 3 OTHERS = 4. * Definimos los eventos. CREATE OBJECT gr_event_handler. SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid. SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid. *--------------------------------------------------------------------* * SEGUNDO ALV. *--------------------------------------------------------------------* CREATE OBJECT gr_ccontainer2 EXPORTING container_name = gc_custom_control_name2 EXCEPTIONS cntl_error = 1 cntl_system_error = 2 create_error = 3 lifetime_error = 4 lifetime_dynpro_dynpro_link = 5 OTHERS = 6. CREATE OBJECT gr_alvgrid2 EXPORTING i_parent = gr_ccontainer2 EXCEPTIONS error_cntl_create = 1 error_cntl_init = 2 error_cntl_link = 3 error_dp_create = 4 OTHERS = 5. PERFORM prepare_field_catalog2 CHANGING gt_fieldcat2. PERFORM prepare_layout2 CHANGING gs_layout2. CALL METHOD gr_alvgrid2->set_table_for_first_display CHANGING it_outtab = gt_list2[] it_fieldcatalog = gt_fieldcat2 EXCEPTIONS invalid_parameter_combination = 1 program_error = 2 too_many_lines = 3 OTHERS = 4. * Definimos los eventos. CREATE OBJECT gr_event_handler2. SET HANDLER gr_event_handler2->handle_double_click2 FOR gr_alvgrid2. SET HANDLER gr_event_handler2->handle_hotspot_click2 FOR gr_alvgrid2. ENDIF. ENDFORM. " Preparar_alvs *&---------------------------------------------------------------------* *& Module USER_COMMAND_2000 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE user_command_2000 INPUT. CASE g_okcode. WHEN 'VOLVER' OR 'ATRAS' OR 'SALIR'. CALL METHOD gr_container->free EXCEPTIONS cntl_error = 1 cntl_system_error = 2 OTHERS = 3. LEAVE TO SCREEN 0. WHEN OTHERS. * call method gr_container->free * exceptions * cntl_error = 1 * cntl_system_error = 2 * others = 3. * leave program. ENDCASE. CLEAR g_okcode. ENDMODULE. " USER_COMMAND_2000 INPUT *&---------------------------------------------------------------------* *& Module STATUS_2000 OUTPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE status_2000 OUTPUT. FIELD-SYMBOLS <nombre> TYPE table. FIELD-SYMBOLS <nombre2> TYPE any. SET PF-STATUS 'BOTONES'. SET TITLEBAR 'TITULO'. CREATE OBJECT gr_container EXPORTING container_name = 'CONTAINER'. IF NOT ( nombre_tabla EQ 'VERSC' OR nombre_tabla EQ 'VERSION' ). CONCATENATE nombre_tabla '[]' INTO nombre_tabla. ASSIGN (nombre_tabla) TO <nombre>. ELSE. ASSIGN (nombre_tabla) TO <nombre2>. DATA dref TYPE REF TO data. IF nombre_tabla EQ 'VERSC'. CREATE DATA dref TYPE STANDARD TABLE OF ('PC202') WITH DEFAULT KEY. ELSE. CREATE DATA dref TYPE STANDARD TABLE OF ('PC202') WITH DEFAULT KEY. ENDIF. ASSIGN dref->* TO <nombre>. APPEND <nombre2> TO <nombre>. ENDIF. TRY. *gr_container->free( ). cl_salv_table=>factory( EXPORTING r_container = gr_container IMPORTING r_salv_table = gr_table CHANGING t_table = <nombre> ). CATCH cx_salv_msg. ENDTRY. PERFORM display. ENDMODULE. " STATUS_2000 OUTPUT *&--------------------------------------------------------------------* *& Form set_display_settings *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM set_display_settings. DATA texto TYPE lvc_title. DATA: ls_display TYPE REF TO cl_salv_display_settings. ls_display = gr_table->get_display_settings( ). TRY. CLEAR texto. MOVE descr_tabla TO texto. CONCATENATE texto ' - ' gt_list2-tabla INTO texto SEPARATED BY space. ls_display->set_list_header( texto ). ls_display->set_vertical_lines( abap_false ). ls_display->set_horizontal_lines( abap_false ). ls_display->set_striped_pattern( abap_true ). ls_display->set_list_header_size( cl_salv_display_settings=>c_header_size_small ). ls_display->set_suppress_empty_data( abap_true ). CATCH cx_no_check. ENDTRY. ENDFORM. "set_display_settings *&--------------------------------------------------------------------* *& Form set_columns *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM set_columns. DATA: lr_columns TYPE REF TO cl_salv_columns, "global columns settings lr_column TYPE REF TO cl_salv_column_table. "individual column setting lr_columns = gr_table->get_columns( ). lr_columns->set_optimize( abap_true ). ENDFORM. "set_columns *&--------------------------------------------------------------------* *& Form set_sort *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM set_sort. ENDFORM. "set_sort *&--------------------------------------------------------------------* *& Form set_aggregations *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM set_aggregations. ENDFORM. "set_aggregations *&--------------------------------------------------------------------* *& Form set_filter *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM set_filter. ENDFORM. "set_filter *&--------------------------------------------------------------------* *& Form set_metadata *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* FORM set_metadata . *§4 depending on the choices made in the lower frame of the selection screen, * metadata default settings are changed PERFORM set_display_settings. * metadata for columns PERFORM set_columns. * sort by company and flight number PERFORM set_sort. * aggregate the paymentsum PERFORM set_aggregations. * filter by currency PERFORM set_filter. ENDFORM. " set_metadata *&---------------------------------------------------------------------* *& Form display *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM display . *§4 change the metadata default settings PERFORM set_metadata. *§5 offer the default set of ALV generic funtions DATA: lr_functions TYPE REF TO cl_salv_functions_list. lr_functions = gr_table->get_functions( ). lr_functions->set_default( ). *... and display the table gr_table->display( ). ENDFORM. " display *&---------------------------------------------------------------------* *& Form BORRAR_CLUSTER_XE *&---------------------------------------------------------------------* FORM borrar_cluster_xe USING p_gt_list TYPE t_rgdir CHANGING p_error. DATA g_bapireturn LIKE bapireturn1. DATA iperi TYPE iperi. DATA: g_del_dir2 LIKE pc261 OCCURS 0 WITH HEADER LINE, g_old_dir2 LIKE pc261 OCCURS 0 WITH HEADER LINE, g_new_dir2 LIKE pc261 OCCURS 0 WITH HEADER LINE. * Borro la variable que controla si se ha producido error. CLEAR p_error. CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE' EXPORTING number = p_gt_list-pernr IMPORTING return = g_bapireturn. IF g_bapireturn IS NOT INITIAL. MOVE 'X' TO p_error. MESSAGE i016(rp) WITH text-i04. ELSE. MOVE p_gt_list-peren+3(4) TO iperi(4). MOVE p_gt_list-peren(2) TO iperi+4(2). CALL FUNCTION 'HR_ES_DELETE_XE' EXPORTING p_test = space p_pernr = p_gt_list-pernr p_iperm = '01' p_inper = iperi * P_NO_AUTHORITY_CHECK = ' ' TABLES p_del_dir2 = g_del_dir2 p_old_dir2 = g_old_dir2 p_new_dir2 = g_new_dir2 EXCEPTIONS OTHERS = 1. IF sy-subrc NE 0 OR g_del_dir2[] IS INITIAL. MOVE 'X' TO p_error. MESSAGE i016(rp) WITH text-i02. ELSE. CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE' EXPORTING number = p_gt_list-pernr IMPORTING return = g_bapireturn. ENDIF. IF NOT g_del_dir2[] IS INITIAL. MESSAGE i016(rp) WITH text-i03. ENDIF. ENDIF. ENDFORM. " BORRAR_CLUSTER_XE
32.217391
88
0.516708
7414eb139e6e101ea2bacb47d7fd3ced62a6e7e5
505
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_ae_factory_dli_pa.clas.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
3
2021-07-08T07:16:53.000Z
2021-10-18T07:56:18.000Z
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_ae_factory_dli_pa.clas.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_ae_factory_dli_pa.clas.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
CLASS zcl_gtt_mia_ae_factory_dli_pa DEFINITION PUBLIC INHERITING FROM zcl_gtt_mia_ae_factory CREATE PUBLIC . PUBLIC SECTION. METHODS zif_gtt_mia_ae_factory~get_ae_filler REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_gtt_mia_ae_factory_dli_pa IMPLEMENTATION. METHOD zif_gtt_mia_ae_factory~get_ae_filler. ro_ae_filler = NEW zcl_gtt_mia_ae_filler_dli_pa( io_ae_parameters = io_ae_parameters ). ENDMETHOD. ENDCLASS.
19.423077
62
0.760396
74169b3939b7766e021693e7680134028caa75e6
6,796
abap
ABAP
src/pgp/zcl_abappgp_packet_05.clas.abap
larshp/abapPGP
82cb07e17ad1c402275bb9e01f1b7bc3d1b2021f
[ "MIT" ]
5
2016-11-19T14:35:50.000Z
2022-03-16T03:09:49.000Z
src/pgp/zcl_abappgp_packet_05.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
34
2016-09-29T18:06:29.000Z
2022-01-19T06:41:02.000Z
src/pgp/zcl_abappgp_packet_05.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
3
2018-12-07T15:30:46.000Z
2021-04-13T18:38:53.000Z
CLASS zcl_abappgp_packet_05 DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abappgp_packet . ALIASES from_stream FOR zif_abappgp_packet~from_stream . ALIASES get_name FOR zif_abappgp_packet~get_name . ALIASES get_tag FOR zif_abappgp_packet~get_tag . ALIASES to_stream FOR zif_abappgp_packet~to_stream . METHODS decrypt IMPORTING !iv_password TYPE zabappgp_password RETURNING VALUE(ro_private) TYPE REF TO zcl_abappgp_rsa_private_key RAISING zcx_abappgp_invalid_key . METHODS constructor IMPORTING !iv_version TYPE zif_abappgp_constants=>ty_version !iv_time TYPE i !iv_algorithm TYPE zif_abappgp_constants=>ty_algorithm_pub !io_n TYPE REF TO zcl_abappgp_integer !io_e TYPE REF TO zcl_abappgp_integer !iv_sym TYPE zif_abappgp_constants=>ty_algorithm_sym !io_s2k TYPE REF TO zcl_abappgp_string_to_key !iv_ivector TYPE xstring !iv_encrypted TYPE xstring . METHODS get_ivector RETURNING VALUE(rv_ivector) TYPE xstring . METHODS get_encrypted RETURNING VALUE(rv_encrypted) TYPE xstring . METHODS get_s2k RETURNING VALUE(ro_s2k) TYPE REF TO zcl_abappgp_string_to_key . PROTECTED SECTION. DATA mo_e TYPE REF TO zcl_abappgp_integer . DATA mo_n TYPE REF TO zcl_abappgp_integer . DATA mv_algorithm TYPE zif_abappgp_constants=>ty_algorithm_pub . DATA mv_time TYPE i . DATA mv_version TYPE zif_abappgp_constants=>ty_version . DATA mv_sym TYPE zif_abappgp_constants=>ty_algorithm_sym . DATA mo_s2k TYPE REF TO zcl_abappgp_string_to_key . DATA mv_ivector TYPE xstring . DATA mv_encrypted TYPE xstring . PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPPGP_PACKET_05 IMPLEMENTATION. METHOD constructor. mo_e = io_e. mo_n = io_n. mv_algorithm = iv_algorithm. mv_time = iv_time. mv_version = iv_version. mv_sym = iv_sym. mo_s2k = io_s2k. mv_ivector = iv_ivector. mv_encrypted = iv_encrypted. ENDMETHOD. METHOD decrypt. CONSTANTS: lc_hash_length TYPE i VALUE 20. DATA: lv_key TYPE xstring, lv_hash TYPE xstring, lv_offset TYPE i, lv_length TYPE i, lv_plain TYPE xstring, lo_stream TYPE REF TO zcl_abappgp_stream, lo_d TYPE REF TO zcl_abappgp_integer, lo_p TYPE REF TO zcl_abappgp_integer, lo_q TYPE REF TO zcl_abappgp_integer, lo_u TYPE REF TO zcl_abappgp_integer. lv_key = get_s2k( )->build_key( iv_password ). lv_plain = zcl_abappgp_symmetric=>aes256_decrypt_normal( iv_ciphertext = get_encrypted( ) iv_key = lv_key iv_ivector = get_ivector( ) ). lv_length = xstrlen( get_encrypted( ) ). lv_plain = lv_plain(lv_length). lv_offset = xstrlen( lv_plain ) - lc_hash_length. lv_hash = lv_plain+lv_offset(lc_hash_length). lv_plain = lv_plain(lv_offset). IF zcl_abappgp_hash=>sha1( lv_plain ) <> lv_hash. RAISE EXCEPTION TYPE zcx_abappgp_invalid_key. ENDIF. CREATE OBJECT lo_stream EXPORTING iv_data = lv_plain. lo_d = lo_stream->eat_mpi( ). lo_p = lo_stream->eat_mpi( ). lo_q = lo_stream->eat_mpi( ). lo_u = lo_stream->eat_mpi( ). CREATE OBJECT ro_private EXPORTING io_d = lo_d io_p = lo_p io_q = lo_q io_u = lo_u. ENDMETHOD. METHOD get_encrypted. rv_encrypted = mv_encrypted. ENDMETHOD. METHOD get_ivector. rv_ivector = mv_ivector. ENDMETHOD. METHOD get_s2k. ro_s2k = mo_s2k. ENDMETHOD. METHOD zif_abappgp_packet~dump. rv_dump = |{ get_name( ) }(tag { get_tag( ) })({ to_stream( )->get_length( ) } bytes)\n\tVersion\t{ mv_version }\n\tTime\t\t{ zcl_abappgp_time=>format_unix( mv_time ) }\n\tAlgorithm\t{ mv_algorithm }\n\tRSA n\t\t{ mo_n->get_binary_length( ) } bits\n\tRSA e\t\t{ mo_e->get_binary_length( ) } bits\n\tSym\t\t{ mv_sym }\n{ mo_s2k->dump( ) }\tIVector\t{ mv_ivector }\n|. rv_dump = |{ rv_dump }\tEnc RSA d\n|. rv_dump = |{ rv_dump }\tEnc RSA p\n|. rv_dump = |{ rv_dump }\tEnc RSA q\n|. rv_dump = |{ rv_dump }\tEnc RSA u\n|. rv_dump = |{ rv_dump }\tEnc SHA1\n|. ENDMETHOD. METHOD zif_abappgp_packet~from_stream. DATA: lv_version TYPE zif_abappgp_constants=>ty_version, lv_pub TYPE zif_abappgp_constants=>ty_algorithm_pub, lv_sym TYPE zif_abappgp_constants=>ty_algorithm_sym, lv_time TYPE i, lv_usage TYPE x LENGTH 1, lv_ivector TYPE xstring, lv_encrypted TYPE xstring, lo_s2k TYPE REF TO zcl_abappgp_string_to_key, lo_n TYPE REF TO zcl_abappgp_integer, lo_e TYPE REF TO zcl_abappgp_integer. lv_version = io_stream->eat_octet( ). ASSERT lv_version = zif_abappgp_constants=>c_version-version04. lv_time = io_stream->eat_time( ). lv_pub = io_stream->eat_octet( ). ASSERT lv_pub = zif_abappgp_constants=>c_algorithm_pub-rsa. lo_n = io_stream->eat_mpi( ). lo_e = io_stream->eat_mpi( ). lv_usage = io_stream->eat_octet( ). IF lv_usage = 'FF' OR lv_usage = 'FE'. lv_sym = io_stream->eat_octet( ). ASSERT lv_sym = zif_abappgp_constants=>c_algorithm_sym-aes256. lo_s2k = io_stream->eat_s2k( ). lv_ivector = io_stream->eat_octets( 16 ). ENDIF. lv_encrypted = io_stream->get_data( ). CREATE OBJECT ri_packet TYPE zcl_abappgp_packet_05 EXPORTING iv_version = lv_version iv_time = lv_time iv_algorithm = lv_pub io_n = lo_n io_e = lo_e iv_sym = lv_sym io_s2k = lo_s2k iv_ivector = lv_ivector iv_encrypted = lv_encrypted. ENDMETHOD. METHOD zif_abappgp_packet~get_name. rv_name = 'Secret-Key Packet'(001). ENDMETHOD. METHOD zif_abappgp_packet~get_tag. rv_tag = zif_abappgp_constants=>c_tag-secret_key. ENDMETHOD. METHOD zif_abappgp_packet~to_stream. CREATE OBJECT ro_stream. ro_stream->write_octet( mv_version ). ro_stream->write_time( mv_time ). ro_stream->write_octet( mv_algorithm ). ro_stream->write_mpi( mo_n ). ro_stream->write_mpi( mo_e ). ro_stream->write_octet( 'FE' ). ro_stream->write_octet( mv_sym ). ro_stream->write_stream( mo_s2k->to_stream( ) ). ro_stream->write_octets( mv_ivector ). ro_stream->write_octets( mv_encrypted ). ENDMETHOD. ENDCLASS.
26.138462
68
0.649941
7417f85e378bb7976b5407051b108724c3acf96f
5,680
abap
ABAP
clean_code_main/clean_code_checks/y_check_non_class_exception.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_checks/y_check_non_class_exception.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_checks/y_check_non_class_exception.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
CLASS ltd_clean_code_manager DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: y_if_clean_code_manager. ENDCLASS. CLASS ltd_clean_code_manager IMPLEMENTATION. METHOD y_if_clean_code_manager~read_check_customizing. result = VALUE #( ( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'N' threshold = 0 ) ( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'E' threshold = 0 ) ). ENDMETHOD. METHOD y_if_clean_code_manager~calculate_obj_creation_date. result = '20190101'. ENDMETHOD. ENDCLASS. CLASS ltd_ref_scan_manager DEFINITION INHERITING FROM y_scan_manager_double FOR TESTING. PUBLIC SECTION. METHODS set_data_for_ok. METHODS set_data_for_error. METHODS set_pseudo_comment_ok. PRIVATE SECTION. ENDCLASS. CLASS ltd_ref_scan_manager IMPLEMENTATION. METHOD set_data_for_ok. convert_code( VALUE #( ( 'REPORT y_example. ' ) ( ' CLASS cx_demo DEFINITION INHERITING FROM cx_static_check. ' ) ( ' ENDCLASS. ' ) ( ' CLASS y_example DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' EVENTS event. ' ) ( ' METHODS one RAISING cx_demo. ' ) ( ' METHODS two RAISING cx_demo. ' ) ( ' PROTECTED SECTION. ' ) ( ' PRIVATE SECTION. ' ) ( ' ENDCLASS. ' ) ( ' CLASS y_example IMPLEMENTATION. ' ) ( ' METHOD one. ' ) ( ' RAISE EXCEPTION TYPE cx_demo. ' ) ( ' RAISE RESUMABLE EXCEPTION TYPE cx_demo. ' ) ( ' RAISE SHORTDUMP TYPE cx_demo. ' ) ( ' RAISE EVENT event. ' ) ( ' ENDMETHOD. ' ) ( ' METHOD two. ' ) ( ' DATA cflag TYPE abap_bool. ' ) ( ' DATA(iflag) = COND i( WHEN cflag = abap_true THEN 1 ' ) ( ' WHEN cflag = abap_false THEN 0 ' ) ( | ELSE THROW cx_demo_dyn_t100( MESSAGE e888(sabapdemos) WITH 'Illegal value!' ) ). | ) ( ' ENDMETHOD.') ( ' ENDCLASS. ' ) ) ). ENDMETHOD. METHOD set_data_for_error. convert_code( VALUE #( ( 'REPORT y_example. ' ) ( ' CLASS y_example DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' CLASS-METHODS one EXCEPTIONS exception. ' ) ( ' METHODS two EXCEPTIONS exception. ' ) ( ' PROTECTED SECTION. ' ) ( ' PRIVATE SECTION. ' ) ( ' ENDCLASS. ' ) ( ' CLASS y_example IMPLEMENTATION. ' ) ( ' METHOD one. ' ) ( ' RAISE exception. ' ) ( ' ENDMETHOD. ' ) ( ' METHOD two. ' ) ( | MESSAGE 'test' TYPE 'I' RAISING exception.| ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ) ). ENDMETHOD. METHOD set_pseudo_comment_ok. convert_code( VALUE #( ( 'REPORT y_example. ' ) ( ' CLASS y_example DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' CLASS-METHODS one EXCEPTIONS exception. ' ) ( ' METHODS two EXCEPTIONS exception. ' ) ( ' PROTECTED SECTION. ' ) ( ' PRIVATE SECTION. ' ) ( ' ENDCLASS. ' ) ( ' CLASS y_example IMPLEMENTATION. ' ) ( ' METHOD one. ' ) ( ' RAISE exception. "#EC NON_CL_EXCEPT' ) ( ' ENDMETHOD. ' ) ( ' METHOD two. ' ) ( | MESSAGE 'test' TYPE 'I' RAISING exception. "#EC NON_CL_EXCEPT| ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ) ). ENDMETHOD. ENDCLASS. CLASS ltd_clean_code_exemption_no DEFINITION FOR TESTING INHERITING FROM y_exemption_handler. PUBLIC SECTION. METHODS: is_object_exempted REDEFINITION. ENDCLASS. CLASS ltd_clean_code_exemption_no IMPLEMENTATION. METHOD is_object_exempted. RETURN. ENDMETHOD. ENDCLASS. CLASS local_test_class DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. DATA: cut TYPE REF TO y_check_non_class_exception, ref_scan_manager_double TYPE REF TO ltd_ref_scan_manager. METHODS: setup, assert_errors IMPORTING err_cnt TYPE i, assert_pseudo_comments IMPORTING pc_cnt TYPE i, is_bound FOR TESTING, check_ok FOR TESTING, check_error FOR TESTING, check_pseudo_comment_ok FOR TESTING. ENDCLASS. CLASS y_check_non_class_exception DEFINITION LOCAL FRIENDS local_test_class. CLASS local_test_class IMPLEMENTATION. METHOD setup. cut = NEW y_check_non_class_exception( ). ref_scan_manager_double = NEW ltd_ref_scan_manager( ). cut->ref_scan_manager ?= ref_scan_manager_double. cut->clean_code_manager = NEW ltd_clean_code_manager( ). cut->clean_code_exemption_handler = NEW ltd_clean_code_exemption_no( ). cut->attributes_maintained = abap_true. ENDMETHOD. METHOD is_bound. cl_abap_unit_assert=>assert_bound( EXPORTING act = cut ). ENDMETHOD. METHOD check_ok. ref_scan_manager_double->set_data_for_ok( ). cut->run( ). assert_errors( 0 ). assert_pseudo_comments( 0 ). ENDMETHOD. METHOD check_error. ref_scan_manager_double->set_data_for_error( ). cut->run( ). assert_errors( 2 ). assert_pseudo_comments( 0 ). ENDMETHOD. METHOD check_pseudo_comment_ok. ref_scan_manager_double->set_pseudo_comment_ok( ). cut->run( ). assert_errors( 0 ). assert_pseudo_comments( 2 ). ENDMETHOD. METHOD assert_errors. cl_abap_unit_assert=>assert_equals( EXPORTING act = cut->statistics->get_number_errors( ) exp = err_cnt ). ENDMETHOD. METHOD assert_pseudo_comments. cl_abap_unit_assert=>assert_equals( EXPORTING act = cut->statistics->get_number_pseudo_comments( ) exp = pc_cnt ). ENDMETHOD. ENDCLASS.
29.73822
120
0.629577
74198425473b37e7e7974707c9829c2af85421ff
17,418
abap
ABAP
ZCA_ZCX_RETURN3_UNIT_TEST.abap
f4abap/zcx_return3
aed7a324b99f63fb2779b2e91147429d81ab5a6b
[ "MIT" ]
9
2020-06-14T18:52:02.000Z
2022-03-08T10:19:25.000Z
ZCA_ZCX_RETURN3_UNIT_TEST.abap
f4abap/zcx_return3
aed7a324b99f63fb2779b2e91147429d81ab5a6b
[ "MIT" ]
6
2020-06-14T18:56:23.000Z
2021-11-06T13:46:45.000Z
ZCA_ZCX_RETURN3_UNIT_TEST.abap
f4abap/zcx_return3
aed7a324b99f63fb2779b2e91147429d81ab5a6b
[ "MIT" ]
7
2020-10-08T12:34:08.000Z
2022-01-20T16:31:26.000Z
REPORT zca_zcx_sub_return3_unit_test. CLASS zcx_sub_return3 DEFINITION INHERITING FROM zcx_return3. ENDCLASS. CLASS unit_test DEFINITION FOR TESTING RISK LEVEL HARMLESS. PRIVATE SECTION. METHODS get_test_data_bapiret2_1_struc RETURNING VALUE(rs_exp_bapiret2) TYPE bapiret2. METHODS get_test_data_bapiret2_1_tab RETURNING VALUE(rt_exp_bapiret2) TYPE bapiret2_t. METHODS get_bapiret2_00_059_struc RETURNING VALUE(rs_exp_bapiret2) TYPE bapiret2. METHODS get_bapiret2_00_060_struc IMPORTING iv_type TYPE bapi_mtype RETURNING VALUE(rs_exp_bapiret2) TYPE bapiret2. METHODS get_test_data_bapiret2_2_tab RETURNING VALUE(rt_exp_bapiret2) TYPE bapiret2_t. METHODS get_test_data_bapiret2_3_tab RETURNING VALUE(rt_exp_bapiret2) TYPE bapiret2_t. * METHODS sc010_create_system_message FOR TESTING. METHODS sc020_create_system_message_2 FOR TESTING. METHODS sc095_create_by_oo_exception FOR TESTING. METHODS sc030_create_mess_and_text_var FOR TESTING. METHODS sc040_create_bapireturn_struc FOR TESTING. METHODS sc050_create_bapireturn_table FOR TESTING. METHODS sc060_create_by_bapiret1_struc FOR TESTING. METHODS sc070_create_by_bapiret1_table FOR TESTING. METHODS sc080_create_by_bapiret2_struc FOR TESTING. METHODS sc090_create_by_bapiret2_table FOR TESTING. METHODS sc091_create_by_bapiret2_table FOR TESTING. **CREATE_BY_BDC_TABLE METHODS sc100_create_by_text FOR TESTING. "Do not use ENDCLASS. CLASS unit_test IMPLEMENTATION. METHOD get_test_data_bapiret2_1_struc. rs_exp_bapiret2 = VALUE #( type = 'E' id = '00' number = '058' message = 'Entry 1 2 3 does not exist in 4 (check entry)' message_v1 = '1' message_v2 = '2' message_v3 = '3' message_v4 = '4' ). ENDMETHOD. METHOD get_test_data_bapiret2_1_tab. DATA(ls_exp_bapiret2) = get_test_data_bapiret2_1_struc( ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ENDMETHOD. METHOD get_bapiret2_00_059_struc. rs_exp_bapiret2 = VALUE #( type = 'E' id = '00' number = '059' message = '' message_v1 = '' message_v2 = '' message_v3 = '' message_v4 = '' ). MESSAGE ID rs_exp_bapiret2-id TYPE rs_exp_bapiret2-type NUMBER rs_exp_bapiret2-number WITH rs_exp_bapiret2-message_v1 rs_exp_bapiret2-message_v2 rs_exp_bapiret2-message_v3 rs_exp_bapiret2-message_v4 INTO rs_exp_bapiret2-message. ENDMETHOD. METHOD get_bapiret2_00_060_struc. rs_exp_bapiret2 = VALUE #( type = iv_type id = '00' number = '060' message = '' message_v1 = '' message_v2 = '' message_v3 = '' message_v4 = '' ). MESSAGE ID rs_exp_bapiret2-id TYPE rs_exp_bapiret2-type NUMBER rs_exp_bapiret2-number WITH rs_exp_bapiret2-message_v1 rs_exp_bapiret2-message_v2 rs_exp_bapiret2-message_v3 rs_exp_bapiret2-message_v4 INTO rs_exp_bapiret2-message. ENDMETHOD. METHOD get_test_data_bapiret2_2_tab. rt_exp_bapiret2 = get_test_data_bapiret2_1_tab( ). DATA(ls_exp_bapiret2) = get_bapiret2_00_059_struc( ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ENDMETHOD. METHOD get_test_data_bapiret2_3_tab. DATA ls_exp_bapiret2 TYPE bapiret2. ls_exp_bapiret2 = get_bapiret2_00_060_struc( 'S' ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ls_exp_bapiret2 = get_test_data_bapiret2_1_struc( ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ls_exp_bapiret2 = get_bapiret2_00_060_struc( 'I' ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ls_exp_bapiret2 = get_bapiret2_00_060_struc( 'S' ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ls_exp_bapiret2 = get_bapiret2_00_059_struc( ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ls_exp_bapiret2 = get_bapiret2_00_060_struc( 'S' ). APPEND ls_exp_bapiret2 TO rt_exp_bapiret2. ENDMETHOD. METHOD sc010_create_system_message. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_1_tab( ). TRY. "******************************************************** "Create message: Tag '&1' may not be nested in tag '&2' RAISE EXCEPTION TYPE zcx_sub_return3 MESSAGE e058(00) WITH '1' '2' '3' '4'. CATCH zcx_sub_return3 INTO DATA(lx_return). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). DATA(lv_text) = lx_return->get_text( ). cl_abap_unit_assert=>assert_equals( act = lv_text exp = lt_act_bapiret2[ 1 ]-message ). "******************************************************** "Add message: The input value is too big (maximum 255) "Expected DATA(ls_exp_bapiret2) = get_bapiret2_00_059_struc( ). APPEND ls_exp_bapiret2 TO lt_exp_bapiret2. "Actual MESSAGE e059(00) INTO DATA(lv_dummy_2). lx_return->add_system_message( ). lt_act_bapiret2 = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). ENDTRY. ENDMETHOD. METHOD sc020_create_system_message_2. MESSAGE i058(00) WITH '1' '2' '3' '4' INTO DATA(lv_dummy). DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_system_message( ). IF lx_return->has_messages( ) = abap_true. cl_abap_unit_assert=>fail( msg = 'It should not contain messages' ). ENDIF. MESSAGE s058(00) WITH '1' '2' '3' '4' INTO DATA(lv_dummy2). lx_return->add_system_message( ). IF lx_return->has_messages( ) = abap_true. cl_abap_unit_assert=>fail( msg = 'It should not contain messages' ). ENDIF. ENDMETHOD. METHOD sc030_create_mess_and_text_var. "Expected data DATA(ls_exp_bapiret2) = VALUE bapiret2( type = 'E' id = '00' number = '081' message = 'Entry 1 2 3 does not exist in 4 (check entry)' message_v1 = 'V1:45678901234567890123456789012345678901234567890' message_v2 = 'V2:45678901234567890123456789012345678901234567890' message_v3 = 'V3:45678901234567890123456789012345678901234567890' message_v4 = 'V4:45678901234567890123456789012345678901234567890' ). MESSAGE ID ls_exp_bapiret2-id TYPE ls_exp_bapiret2-type NUMBER ls_exp_bapiret2-number WITH ls_exp_bapiret2-message_v1 ls_exp_bapiret2-message_v2 ls_exp_bapiret2-message_v3 ls_exp_bapiret2-message_v4 INTO ls_exp_bapiret2-message. DATA lt_exp_bapiret2 TYPE bapiret2_t. APPEND ls_exp_bapiret2 TO lt_exp_bapiret2. "Call data DATA lv_char_200 TYPE char200. lv_char_200 = ls_exp_bapiret2-message_v1 && ls_exp_bapiret2-message_v2 && ls_exp_bapiret2-message_v3 && ls_exp_bapiret2-message_v4. DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_message_and_text_var( iv_type = ls_exp_bapiret2-type iv_id = ls_exp_bapiret2-id iv_number = ls_exp_bapiret2-number iv_text_variable = lv_char_200 ). "Actual data DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). ENDMETHOD. METHOD sc040_create_bapireturn_struc. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_1_tab( ). DATA(ls_exp_bapiret2) = lt_exp_bapiret2[ 1 ]. DATA ls_bapireturn TYPE bapireturn. ls_bapireturn = VALUE #( type = ls_exp_bapiret2-type code = ls_exp_bapiret2-id && ls_exp_bapiret2-number message = ls_exp_bapiret2-message log_no = ls_exp_bapiret2-log_no log_msg_no = ls_exp_bapiret2-log_msg_no message_v1 = ls_exp_bapiret2-message_v1 message_v2 = ls_exp_bapiret2-message_v2 message_v3 = ls_exp_bapiret2-message_v3 message_v4 = ls_exp_bapiret2-message_v4 ). DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_bapireturn_struc( ls_bapireturn ). IF lx_return->has_messages( ) = abap_false. cl_abap_unit_assert=>fail( msg = 'It should contain messages' ). ENDIF. DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). DATA(lv_text) = lx_return->get_text( ). cl_abap_unit_assert=>assert_equals( act = lv_text exp = lt_exp_bapiret2[ 1 ]-message ). ENDMETHOD. METHOD sc050_create_bapireturn_table. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_2_tab( ). DATA lt_bapireturn TYPE STANDARD TABLE OF bapireturn. LOOP AT lt_exp_bapiret2 ASSIGNING FIELD-SYMBOL(<ls_exp_bapiret2>). DATA ls_bapireturn TYPE bapireturn. ls_bapireturn = VALUE #( type = <ls_exp_bapiret2>-type code = <ls_exp_bapiret2>-id && <ls_exp_bapiret2>-number message = <ls_exp_bapiret2>-message log_no = <ls_exp_bapiret2>-log_no log_msg_no = <ls_exp_bapiret2>-log_msg_no message_v1 = <ls_exp_bapiret2>-message_v1 message_v2 = <ls_exp_bapiret2>-message_v2 message_v3 = <ls_exp_bapiret2>-message_v3 message_v4 = <ls_exp_bapiret2>-message_v4 ). APPEND ls_bapireturn TO lt_bapireturn. ENDLOOP. DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_bapireturn_table( lt_bapireturn ). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). DATA(ls_act_bapiret2) = lx_return->get_bapiret2_struc( ). DATA(ls_exp_bapiret2) = lt_exp_bapiret2[ 1 ]. cl_abap_unit_assert=>assert_equals( act = ls_act_bapiret2 exp = ls_exp_bapiret2 ). ENDMETHOD. METHOD sc060_create_by_bapiret1_struc. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_1_tab( ). DATA(ls_exp_bapiret2) = lt_exp_bapiret2[ 1 ]. DATA ls_bapiret1 TYPE bapiret1. ls_bapiret1 = VALUE #( type = ls_exp_bapiret2-type id = ls_exp_bapiret2-id number = ls_exp_bapiret2-number message = ls_exp_bapiret2-message log_no = ls_exp_bapiret2-log_no log_msg_no = ls_exp_bapiret2-log_msg_no message_v1 = ls_exp_bapiret2-message_v1 message_v2 = ls_exp_bapiret2-message_v2 message_v3 = ls_exp_bapiret2-message_v3 message_v4 = ls_exp_bapiret2-message_v4 ). DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_bapiret1_struc( ls_bapiret1 ). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). ENDMETHOD. METHOD sc070_create_by_bapiret1_table. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_2_tab( ). DATA lt_bapiret1 TYPE STANDARD TABLE OF bapiret1. LOOP AT lt_exp_bapiret2 ASSIGNING FIELD-SYMBOL(<ls_exp_bapiret2>). DATA ls_bapiret1 TYPE bapiret1. ls_bapiret1 = VALUE #( type = <ls_exp_bapiret2>-type id = <ls_exp_bapiret2>-id number = <ls_exp_bapiret2>-number message = <ls_exp_bapiret2>-message log_no = <ls_exp_bapiret2>-log_no log_msg_no = <ls_exp_bapiret2>-log_msg_no message_v1 = <ls_exp_bapiret2>-message_v1 message_v2 = <ls_exp_bapiret2>-message_v2 message_v3 = <ls_exp_bapiret2>-message_v3 message_v4 = <ls_exp_bapiret2>-message_v4 ). APPEND ls_bapiret1 TO lt_bapiret1. ENDLOOP. DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_bapiret1_table( lt_bapiret1 ). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). DATA(ls_act_bapiret2) = lx_return->get_bapiret2_struc( ). DATA(ls_exp_bapiret2) = lt_exp_bapiret2[ 1 ]. cl_abap_unit_assert=>assert_equals( act = ls_act_bapiret2 exp = ls_exp_bapiret2 ). ENDMETHOD. METHOD sc080_create_by_bapiret2_struc. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_1_tab( ). DATA(ls_exp_bapiret2) = lt_exp_bapiret2[ 1 ]. DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_bapiret2_struc( ls_exp_bapiret2 ). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). ENDMETHOD. METHOD sc090_create_by_bapiret2_table. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_2_tab( ). DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_bapiret2_table( lt_exp_bapiret2 ). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). DATA(ls_act_bapiret2) = lx_return->get_bapiret2_struc( ). DATA(ls_exp_bapiret2) = lt_exp_bapiret2[ 1 ]. cl_abap_unit_assert=>assert_equals( act = ls_act_bapiret2 exp = ls_exp_bapiret2 ). DATA(lv_act_text) = lx_return->get_text( ). cl_abap_unit_assert=>assert_equals( act = lv_act_text exp = ls_exp_bapiret2-message ). ENDMETHOD. METHOD sc091_create_by_bapiret2_table. DATA(lt_exp_bapiret2) = get_test_data_bapiret2_2_tab( ). DATA(lt_data_bapiret2) = get_test_data_bapiret2_3_tab( ). DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_bapiret2_table( lt_data_bapiret2 ). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). DATA(ls_act_bapiret2) = lx_return->get_bapiret2_struc( ). DATA(ls_exp_bapiret2) = lt_exp_bapiret2[ 1 ]. cl_abap_unit_assert=>assert_equals( act = ls_act_bapiret2 exp = ls_exp_bapiret2 ). ENDMETHOD. METHOD sc095_create_by_oo_exception. TRY. TRY. RAISE EXCEPTION TYPE cx_aab_object. CATCH cx_root INTO DATA(lx_root). "TODO: change exception class "<Short error name>: &1 &2 &3 &4 MESSAGE e001(00) "Todo: change error number INTO DATA(lv_dummy). "Method will split message text into &1 &2 &3 &4 DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_exception_object( lx_root ). "Change variable name RAISE EXCEPTION lx_return. ENDTRY. CATCH zcx_sub_return3 INTO DATA(lx_return2). DATA(lt_act_bapiret2) = lx_return2->get_bapiret2_table( ). DATA(lt_exp_bapiret2) = VALUE bapiret2_t( ( type = 'E' id = '00' number = '001' message = 'Checkpoint group or activation variant specified does not exist' message_v1 = 'Checkpoint group or activation variant specified d' message_v2 = 'oes not exist' message_v3 = '' message_v4 = '' ) ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). ENDTRY. ENDMETHOD. METHOD sc100_create_by_text. DATA(lt_exp_bapiret2) = VALUE bapiret2_t( ( type = 'E' id = '' number = '000' message = 'Entry A B C does not exist in D (check entry)' message_v1 = 'A' message_v2 = 'B' message_v3 = 'C' message_v4 = 'D' ) ). DATA(lx_return) = NEW zcx_sub_return3( ). lx_return->add_text( iv_type = 'E' iv_message = 'Entry &1 &2 &3 does not exist in &4 (check entry)' iv_variable_1 = 'A' iv_variable_2 = 'B' iv_variable_3 = 'C' iv_variable_4 = 'D' ). DATA(lt_act_bapiret2) = lx_return->get_bapiret2_table( ). cl_abap_unit_assert=>assert_equals( act = lt_act_bapiret2 exp = lt_exp_bapiret2 ). ENDMETHOD. ENDCLASS.
27.824281
92
0.629177
741b13d68ffced81728e667813b1dd0cf2dd617a
9,434
abap
ABAP
src/objects/ycl_abapgit_objects_saxx_super.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/objects/ycl_abapgit_objects_saxx_super.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/objects/ycl_abapgit_objects_saxx_super.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
2
2019-11-24T20:35:16.000Z
2020-04-16T07:29:33.000Z
CLASS ycl_abapgit_objects_saxx_super DEFINITION PUBLIC ABSTRACT INHERITING FROM ycl_abapgit_objects_super. * common class for SAPC and SAMC objects PUBLIC SECTION. INTERFACES: yif_abapgit_object. PROTECTED SECTION. METHODS: get_persistence_class_name ABSTRACT RETURNING VALUE(r_persistence_class_name) TYPE seoclsname, get_data_class_name ABSTRACT RETURNING VALUE(r_data_class_name) TYPE seoclsname, get_data_structure_name ABSTRACT RETURNING VALUE(r_data_structure_name) TYPE string. PRIVATE SECTION. DATA: mo_persistence TYPE REF TO if_wb_object_persist, mo_appl_obj_data TYPE REF TO if_wb_object_data_model, mv_data_structure_name TYPE string, mv_appl_obj_cls_name TYPE seoclsname, mv_persistence_cls_name TYPE seoclsname. METHODS: create_channel_objects RAISING ycx_abapgit_exception, get_data EXPORTING p_data TYPE any RAISING ycx_abapgit_exception, lock RAISING ycx_abapgit_exception, unlock RAISING ycx_abapgit_exception, get_names. ENDCLASS. CLASS ycl_abapgit_objects_saxx_super IMPLEMENTATION. METHOD create_channel_objects. get_names( ). TRY. IF mo_appl_obj_data IS NOT BOUND. CREATE OBJECT mo_appl_obj_data TYPE (mv_appl_obj_cls_name). ENDIF. IF mo_persistence IS NOT BOUND. CREATE OBJECT mo_persistence TYPE (mv_persistence_cls_name). ENDIF. CATCH cx_root. ycx_abapgit_exception=>raise( |{ ms_item-obj_type } not supported| ). ENDTRY. ENDMETHOD. METHOD get_data. DATA: lv_object_key TYPE seu_objkey. lv_object_key = ms_item-obj_name. TRY. mo_persistence->get( EXPORTING p_object_key = lv_object_key p_version = 'A' CHANGING p_object_data = mo_appl_obj_data ). CATCH cx_root. ycx_abapgit_exception=>raise( |{ ms_item-obj_type } not supported| ). ENDTRY. mo_appl_obj_data->get_data( IMPORTING p_data = p_data ). ENDMETHOD. METHOD get_names. IF mv_data_structure_name IS INITIAL. mv_data_structure_name = get_data_structure_name( ). ENDIF. IF mv_appl_obj_cls_name IS INITIAL. mv_appl_obj_cls_name = get_data_class_name( ). ENDIF. IF mv_persistence_cls_name IS INITIAL. mv_persistence_cls_name = get_persistence_class_name( ). ENDIF. ENDMETHOD. METHOD lock. DATA: lv_objname TYPE trobj_name, lv_object_key TYPE seu_objkey, lv_objtype TYPE trobjtype. lv_objname = ms_item-obj_name. lv_object_key = ms_item-obj_name. lv_objtype = ms_item-obj_type. mo_persistence->lock( EXPORTING p_objname_tr = lv_objname p_object_key = lv_object_key p_objtype_tr = lv_objtype EXCEPTIONS foreign_lock = 1 error_occurred = 2 OTHERS = 3 ). IF sy-subrc <> 0. ycx_abapgit_exception=>raise( |Error occured while locking { ms_item-obj_type } | && lv_objname ). ENDIF. ENDMETHOD. METHOD unlock. DATA: lv_objname TYPE trobj_name, lv_object_key TYPE seu_objkey, lv_objtype TYPE trobjtype. lv_objname = ms_item-obj_name. lv_object_key = ms_item-obj_name. lv_objtype = ms_item-obj_type. mo_persistence->unlock( p_objname_tr = lv_objname p_object_key = lv_object_key p_objtype_tr = lv_objtype ). ENDMETHOD. METHOD yif_abapgit_object~changed_by. DATA: lr_data TYPE REF TO data. FIELD-SYMBOLS: <lg_data> TYPE any, <lg_header> TYPE any, <lg_changed_by> TYPE any. create_channel_objects( ). TRY. CREATE DATA lr_data TYPE (mv_data_structure_name). ASSIGN lr_data->* TO <lg_data>. CATCH cx_root. ycx_abapgit_exception=>raise( |{ ms_item-obj_name } not supported| ). ENDTRY. get_data( IMPORTING p_data = <lg_data> ). ASSIGN COMPONENT 'HEADER' OF STRUCTURE <lg_data> TO <lg_header>. ASSERT sy-subrc = 0. ASSIGN COMPONENT 'CHANGED_BY' OF STRUCTURE <lg_header> TO <lg_changed_by>. ASSERT sy-subrc = 0. IF <lg_changed_by> IS NOT INITIAL. rv_user = <lg_changed_by>. ELSE. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD yif_abapgit_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE ycl_abapgit_comparison_null. ENDMETHOD. METHOD yif_abapgit_object~delete. DATA: lv_object_key TYPE seu_objkey. create_channel_objects( ). lv_object_key = ms_item-obj_name. TRY. lock( ). mo_persistence->delete( lv_object_key ). unlock( ). CATCH cx_swb_exception. ycx_abapgit_exception=>raise( |Error occured while deleting { ms_item-obj_type }| ). ENDTRY. ENDMETHOD. METHOD yif_abapgit_object~deserialize. DATA: lr_data TYPE REF TO data. FIELD-SYMBOLS: <lg_data> TYPE any. create_channel_objects( ). TRY. CREATE DATA lr_data TYPE (mv_data_structure_name). ASSIGN lr_data->* TO <lg_data>. CATCH cx_root. ycx_abapgit_exception=>raise( |{ ms_item-obj_type } not supported| ). ENDTRY. io_xml->read( EXPORTING iv_name = ms_item-obj_type CHANGING cg_data = <lg_data> ). IF yif_abapgit_object~exists( ) = abap_true. yif_abapgit_object~delete( ). ENDIF. TRY. lock( ). CALL FUNCTION 'RS_CORR_INSERT' EXPORTING object = ms_item-obj_name object_class = ms_item-obj_type mode = 'I' global_lock = abap_true devclass = iv_package master_language = mv_language EXCEPTIONS cancelled = 1 permission_failure = 2 unknown_objectclass = 3 OTHERS = 4. IF sy-subrc <> 0. ycx_abapgit_exception=>raise( |Error occured while creating { ms_item-obj_type }| ). ENDIF. mo_appl_obj_data->set_data( <lg_data> ). mo_persistence->save( mo_appl_obj_data ). unlock( ). CATCH cx_swb_exception. ycx_abapgit_exception=>raise( |Error occured while creating { ms_item-obj_type }| ). ENDTRY. ENDMETHOD. METHOD yif_abapgit_object~exists. DATA: lv_object_key TYPE seu_objkey. create_channel_objects( ). lv_object_key = ms_item-obj_name. TRY. mo_persistence->get( p_object_key = lv_object_key p_version = 'A' p_existence_check_only = abap_true ). CATCH cx_swb_object_does_not_exist cx_swb_exception. rv_bool = abap_false. RETURN. ENDTRY. rv_bool = abap_true. ENDMETHOD. METHOD yif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-delete_tadir = abap_true. ENDMETHOD. METHOD yif_abapgit_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. METHOD yif_abapgit_object~jump. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = ms_item-obj_name object_type = ms_item-obj_type. ENDMETHOD. METHOD yif_abapgit_object~serialize. DATA: lr_data TYPE REF TO data. FIELD-SYMBOLS: <lg_data> TYPE any, <lg_header> TYPE any, <lg_field> TYPE any. create_channel_objects( ). TRY. CREATE DATA lr_data TYPE (mv_data_structure_name). ASSIGN lr_data->* TO <lg_data>. CATCH cx_root. ycx_abapgit_exception=>raise( |{ ms_item-obj_type } not supported| ). ENDTRY. get_data( IMPORTING p_data = <lg_data> ). ASSIGN COMPONENT 'HEADER' OF STRUCTURE <lg_data> TO <lg_header>. ASSERT sy-subrc = 0. ASSIGN COMPONENT 'CHANGED_ON' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ASSIGN COMPONENT 'CHANGED_BY' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ASSIGN COMPONENT 'CHANGED_AT' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ASSIGN COMPONENT 'CHANGED_CLNT' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ASSIGN COMPONENT 'CREATED_ON' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ASSIGN COMPONENT 'CREATED_BY' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ASSIGN COMPONENT 'CREATED_AT' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ASSIGN COMPONENT 'CREATED_CLNT' OF STRUCTURE <lg_header> TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. io_xml->add( iv_name = ms_item-obj_type ig_data = <lg_data> ). ENDMETHOD. METHOD yif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. ENDCLASS.
23.467662
104
0.630167