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
4cb7b8c3faffee40e273dc60f47d2cd2fd7f134c
220
abap
ABAP
objects/CLAS/ZCL_ZGWSO_DPC/METH SALESORDERSET_GET_ENTITY.abap
abhilashhaa/HCL_Githup
454be7f157c72fbb75550dea67c9167e405a4fdb
[ "Apache-2.0" ]
null
null
null
objects/CLAS/ZCL_ZGWSO_DPC/METH SALESORDERSET_GET_ENTITY.abap
abhilashhaa/HCL_Githup
454be7f157c72fbb75550dea67c9167e405a4fdb
[ "Apache-2.0" ]
null
null
null
objects/CLAS/ZCL_ZGWSO_DPC/METH SALESORDERSET_GET_ENTITY.abap
abhilashhaa/HCL_Githup
454be7f157c72fbb75550dea67c9167e405a4fdb
[ "Apache-2.0" ]
null
null
null
method SALESORDERSET_GET_ENTITY. RAISE EXCEPTION TYPE /iwbep/cx_mgw_not_impl_exc EXPORTING textid = /iwbep/cx_mgw_not_impl_exc=>method_not_implemented method = 'SALESORDERSET_GET_ENTITY'. endmethod.
36.666667
65
0.781818
4cbc90a4216cdd076e8595a5469869cb76b483ed
34,655
abap
ABAP
src/objects/core/zcl_abapgit_file_status.clas.testclasses.abap
ed-holland/abap
22a455e10c3d3272ef35ddf20b837fb421c8ddc3
[ "MIT" ]
317
2020-09-25T19:50:59.000Z
2022-03-29T22:59:01.000Z
src/objects/core/zcl_abapgit_file_status.clas.testclasses.abap
ed-holland/abap
22a455e10c3d3272ef35ddf20b837fb421c8ddc3
[ "MIT" ]
1,114
2020-09-24T07:44:36.000Z
2022-03-31T18:01:19.000Z
src/objects/core/zcl_abapgit_file_status.clas.testclasses.abap
ed-holland/abap
22a455e10c3d3272ef35ddf20b837fb421c8ddc3
[ "MIT" ]
167
2020-09-24T18:31:37.000Z
2022-03-24T10:07:04.000Z
CLASS ltcl_run_checks DEFINITION DEFERRED. CLASS zcl_abapgit_file_status DEFINITION LOCAL FRIENDS ltcl_run_checks. CLASS ltcl_util DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PUBLIC SECTION. CLASS-METHODS check_contains IMPORTING ii_log TYPE REF TO zif_abapgit_log iv_pattern TYPE string. ENDCLASS. CLASS ltcl_util IMPLEMENTATION. METHOD check_contains. DATA lt_messages TYPE zif_abapgit_log=>ty_log_outs. DATA ls_message LIKE LINE OF lt_messages. DATA lv_contains TYPE abap_bool. lt_messages = ii_log->get_messages( ). LOOP AT lt_messages INTO ls_message. IF ls_message-text CP iv_pattern. lv_contains = abap_true. EXIT. ENDIF. ENDLOOP. cl_abap_unit_assert=>assert_equals( act = lv_contains exp = abap_true ). ENDMETHOD. ENDCLASS. CLASS ltcl_run_checks DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PRIVATE SECTION. DATA: mt_results TYPE zif_abapgit_definitions=>ty_results_tt, mo_dot TYPE REF TO zcl_abapgit_dot_abapgit, mi_log TYPE REF TO zif_abapgit_log. METHODS: append_result IMPORTING iv_obj_type TYPE trobjtype iv_obj_name TYPE sobj_name iv_match TYPE abap_bool iv_lstate TYPE char1 iv_rstate TYPE char1 iv_package TYPE devclass iv_path TYPE string iv_filename TYPE string iv_packmove TYPE abap_bool OPTIONAL, setup, positive FOR TESTING RAISING zcx_abapgit_exception, neg_diff_path_for_same_obj FOR TESTING RAISING zcx_abapgit_exception, neg_incorrect_path_vs_pack FOR TESTING RAISING zcx_abapgit_exception, neg_similar_filenames FOR TESTING RAISING zcx_abapgit_exception, neg_empty_filenames FOR TESTING RAISING zcx_abapgit_exception, package_move FOR TESTING RAISING zcx_abapgit_exception, check_namespace FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_run_checks IMPLEMENTATION. METHOD append_result. DATA ls_result LIKE LINE OF mt_results. ls_result-inactive = abap_false. ls_result-obj_type = iv_obj_type. ls_result-obj_name = iv_obj_name. ls_result-match = iv_match. ls_result-lstate = iv_lstate. ls_result-rstate = iv_rstate. ls_result-package = iv_package. ls_result-path = iv_path. ls_result-filename = iv_filename. ls_result-packmove = iv_packmove. APPEND ls_result TO mt_results. ENDMETHOD. METHOD setup. CREATE OBJECT mi_log TYPE zcl_abapgit_log. mo_dot = zcl_abapgit_dot_abapgit=>build_default( ). mo_dot->set_starting_folder( '/' ). " assumed by unit tests ENDMETHOD. METHOD positive. " 0 Positive append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$' iv_path = '/' iv_filename = 'zclass1.clas.abap' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = 'zclass1.clas.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = 'ZDOMA1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = 'zdoma1.doma.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = 'ZDOMA2' iv_match = ' ' iv_lstate = 'M' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = 'zdoma2.doma.xml' ). zcl_abapgit_file_status=>run_checks( ii_log = mi_log it_results = mt_results io_dot = mo_dot iv_top = '$Z$' ). cl_abap_unit_assert=>assert_equals( act = mi_log->count( ) exp = 0 ). ENDMETHOD. METHOD neg_diff_path_for_same_obj. " 1 Negative, different path for same object append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$' iv_path = '/' iv_filename = 'zclass1.clas.abap' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/sub' iv_filename = 'zclass1.clas.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = 'ZDOMA1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = 'zdoma1.doma.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = 'ZDOMA2' iv_match = ' ' iv_lstate = 'M' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = 'zdoma2.doma.xml' ). zcl_abapgit_file_status=>run_checks( ii_log = mi_log it_results = mt_results io_dot = mo_dot iv_top = '$Z$' ). " This one is not pure - incorrect path also triggers path vs package check cl_abap_unit_assert=>assert_equals( act = mi_log->count( ) exp = 2 ). ltcl_util=>check_contains( ii_log = mi_log iv_pattern = |Files for object *| ). ENDMETHOD. METHOD neg_incorrect_path_vs_pack. " 2 Negative, incorrect path vs package append_result( iv_obj_type = 'CLAS' iv_obj_name = '$$ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zclass1.clas.abap' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = '$$ZCLASS1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zclass1.clas.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/sub' iv_filename = '$$zdoma1.doma.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA2' iv_match = ' ' iv_lstate = 'M' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zdoma2.doma.xml' ). zcl_abapgit_file_status=>run_checks( ii_log = mi_log it_results = mt_results io_dot = mo_dot iv_top = '$Z$' ). cl_abap_unit_assert=>assert_equals( act = mi_log->count( ) exp = 1 ). ltcl_util=>check_contains( ii_log = mi_log iv_pattern = |Package and path does not match for object, *| ). ENDMETHOD. METHOD neg_similar_filenames. " 3 Negative, similar filenames append_result( iv_obj_type = 'CLAS' iv_obj_name = '$$ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zclass1.clas.abap' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = '$$ZCLASS1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zclass1.clas.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zdoma1.doma.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA2' iv_match = ' ' iv_lstate = 'M' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zdoma1.doma.xml' ). zcl_abapgit_file_status=>run_checks( ii_log = mi_log it_results = mt_results io_dot = mo_dot iv_top = '$Z$' ). cl_abap_unit_assert=>assert_equals( act = mi_log->count( ) exp = 1 ). ltcl_util=>check_contains( ii_log = mi_log iv_pattern = |Multiple files with same filename, *| ). ENDMETHOD. METHOD neg_empty_filenames. " 4 Negative, empty filenames append_result( iv_obj_type = 'CLAS' iv_obj_name = '$$ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zclass1.clas.abap' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = '$$ZCLASS1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = '$$zclass1.clas.xml' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_match = 'X' iv_lstate = ' ' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = '' ). zcl_abapgit_file_status=>run_checks( ii_log = mi_log it_results = mt_results io_dot = mo_dot iv_top = '$Z$' ). cl_abap_unit_assert=>assert_equals( act = mi_log->count( ) exp = 1 ). ltcl_util=>check_contains( ii_log = mi_log iv_pattern = |Filename is empty for object *| ). ENDMETHOD. METHOD package_move. " 5 Changed package assignment append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$' iv_path = '/' iv_filename = 'zclass1.clas.abap' iv_packmove = 'X' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = ' ' iv_lstate = 'A' iv_rstate = ' ' iv_package = '$Z$SUB' iv_path = '/sub' iv_filename = 'zclass1.clas.abap' iv_packmove = 'X' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$' iv_path = '/' iv_filename = 'zclass1.clas.xml' iv_packmove = 'X' ). append_result( iv_obj_type = 'CLAS' iv_obj_name = 'ZCLASS1' iv_match = ' ' iv_lstate = 'A' iv_rstate = ' ' iv_package = '$Z$SUB' iv_path = '/sub' iv_filename = 'zclass1.clas.xml' iv_packmove = 'X' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = 'ZDOMA1' iv_match = ' ' iv_lstate = 'A' iv_rstate = ' ' iv_package = '$Z$' iv_path = '/' iv_filename = 'zdoma1.doma.xml' iv_packmove = 'X' ). append_result( iv_obj_type = 'DOMA' iv_obj_name = 'ZDOMA2' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '$Z$SUB' iv_path = '/sub' iv_filename = 'zdoma1.doma.xml' iv_packmove = 'X' ). zcl_abapgit_file_status=>run_checks( ii_log = mi_log it_results = mt_results io_dot = mo_dot iv_top = '$Z$' ). " Three files, but only two msg (for two changed objects) cl_abap_unit_assert=>assert_equals( act = mi_log->count( ) exp = 2 ). ltcl_util=>check_contains( ii_log = mi_log iv_pattern = |Changed package assignment for object*| ). ENDMETHOD. METHOD check_namespace. " 6 Missing namespace append_result( iv_obj_type = 'CLAS' iv_obj_name = '/NOTEXIST/ZCLASS1' iv_match = ' ' iv_lstate = ' ' iv_rstate = 'A' iv_package = '/NOTEXIST/Z' iv_path = '/' iv_filename = '#notexist#zclass1.clas.xml' ). zcl_abapgit_file_status=>run_checks( ii_log = mi_log it_results = mt_results io_dot = mo_dot iv_top = '/NOTEXIST/Z' ). cl_abap_unit_assert=>assert_equals( act = mi_log->count( ) exp = 1 ). ltcl_util=>check_contains( ii_log = mi_log iv_pattern = |Namespace *| ). ENDMETHOD. ENDCLASS. CLASS lcl_status_result DEFINITION. PUBLIC SECTION. METHODS: constructor IMPORTING it_results TYPE zif_abapgit_definitions=>ty_results_tt, get_line IMPORTING iv_line TYPE i RETURNING VALUE(rs_data) TYPE zif_abapgit_definitions=>ty_result, assert_lines IMPORTING iv_lines TYPE i iv_msg TYPE csequence OPTIONAL. PRIVATE SECTION. DATA: mt_results TYPE zif_abapgit_definitions=>ty_results_tt. ENDCLASS. CLASS lcl_status_result IMPLEMENTATION. METHOD constructor. mt_results = it_results. SORT mt_results BY path filename. ENDMETHOD. METHOD get_line. READ TABLE mt_results INDEX iv_line INTO rs_data. cl_abap_unit_assert=>assert_subrc( ). ENDMETHOD. METHOD assert_lines. cl_abap_unit_assert=>assert_equals( act = lines( mt_results ) exp = iv_lines msg = iv_msg ). ENDMETHOD. ENDCLASS. CLASS ltcl_status_helper DEFINITION DEFERRED. CLASS zcl_abapgit_file_status DEFINITION LOCAL FRIENDS ltcl_status_helper. CLASS ltcl_status_helper DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: zif_abapgit_tadir. METHODS: constructor, add_tadir IMPORTING iv_obj_type TYPE tadir-object iv_obj_name TYPE tadir-obj_name iv_devclass TYPE tadir-devclass, add_remote IMPORTING iv_path TYPE string DEFAULT '/' iv_filename TYPE string iv_sha1 TYPE zif_abapgit_definitions=>ty_sha1, add_local IMPORTING iv_path TYPE string DEFAULT '/' iv_filename TYPE string iv_sha1 TYPE zif_abapgit_definitions=>ty_sha1 iv_obj_type TYPE tadir-object OPTIONAL iv_obj_name TYPE tadir-obj_name OPTIONAL iv_devclass TYPE devclass DEFAULT '$Z$', add_state IMPORTING iv_path TYPE string DEFAULT '/' iv_filename TYPE string iv_sha1 TYPE zif_abapgit_definitions=>ty_sha1, run IMPORTING iv_devclass TYPE devclass DEFAULT '$Z$' RETURNING VALUE(ro_result) TYPE REF TO lcl_status_result RAISING zcx_abapgit_exception. PRIVATE SECTION. TYPES: BEGIN OF ty_tadir, obj_type TYPE tadir-object, obj_name TYPE tadir-obj_name, devclass TYPE tadir-devclass, END OF ty_tadir. DATA: mt_tadir TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY, mt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, mt_remote TYPE zif_abapgit_definitions=>ty_files_tt, mt_state TYPE zif_abapgit_definitions=>ty_file_signatures_tt. ENDCLASS. CLASS ltcl_status_helper IMPLEMENTATION. METHOD constructor. zcl_abapgit_injector=>set_tadir( me ). ENDMETHOD. METHOD add_tadir. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF mt_tadir. APPEND INITIAL LINE TO mt_tadir ASSIGNING <ls_tadir>. <ls_tadir>-obj_type = iv_obj_type. <ls_tadir>-obj_name = iv_obj_name. <ls_tadir>-devclass = iv_devclass. ENDMETHOD. METHOD zif_abapgit_tadir~get_object_package. DATA: ls_tadir LIKE LINE OF mt_tadir. IF lines( mt_tadir ) > 0. READ TABLE mt_tadir INTO ls_tadir WITH KEY obj_type = iv_object obj_name = iv_obj_name. cl_abap_unit_assert=>assert_subrc( ). rv_devclass = ls_tadir-devclass. ENDIF. ENDMETHOD. METHOD zif_abapgit_tadir~read. cl_abap_unit_assert=>fail( ). ENDMETHOD. METHOD zif_abapgit_tadir~read_single. cl_abap_unit_assert=>fail( ). ENDMETHOD. METHOD add_remote. FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote. APPEND INITIAL LINE TO mt_remote ASSIGNING <ls_remote>. <ls_remote>-path = iv_path. <ls_remote>-filename = iv_filename. <ls_remote>-sha1 = iv_sha1. ENDMETHOD. METHOD add_local. FIELD-SYMBOLS: <ls_local> LIKE LINE OF mt_local. APPEND INITIAL LINE TO mt_local ASSIGNING <ls_local>. <ls_local>-item-obj_type = iv_obj_type. <ls_local>-item-obj_name = iv_obj_name. <ls_local>-item-devclass = iv_devclass. <ls_local>-file-path = iv_path. <ls_local>-file-filename = iv_filename. <ls_local>-file-sha1 = iv_sha1. ENDMETHOD. METHOD add_state. FIELD-SYMBOLS: <ls_state> LIKE LINE OF mt_state. APPEND INITIAL LINE TO mt_state ASSIGNING <ls_state>. <ls_state>-path = iv_path. <ls_state>-filename = iv_filename. <ls_state>-sha1 = iv_sha1. ENDMETHOD. METHOD run. DATA: lt_results TYPE zif_abapgit_definitions=>ty_results_tt, lo_dot TYPE REF TO zcl_abapgit_dot_abapgit. lo_dot = zcl_abapgit_dot_abapgit=>build_default( ). lo_dot->set_starting_folder( '/' ). " assumed by unit tests lt_results = zcl_abapgit_file_status=>calculate_status( iv_devclass = iv_devclass io_dot = lo_dot it_local = mt_local it_remote = mt_remote it_cur_state = mt_state ). CREATE OBJECT ro_result EXPORTING it_results = lt_results. ENDMETHOD. ENDCLASS. CLASS ltcl_calculate_status DEFINITION DEFERRED. CLASS zcl_abapgit_file_status DEFINITION LOCAL FRIENDS ltcl_calculate_status. CLASS ltcl_calculate_status DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PRIVATE SECTION. DATA: mo_helper TYPE REF TO ltcl_status_helper, mo_result TYPE REF TO lcl_status_result. METHODS: setup, complete_local, complete_remote, complete_state, only_remote FOR TESTING RAISING zcx_abapgit_exception, only_local FOR TESTING RAISING zcx_abapgit_exception, match FOR TESTING RAISING zcx_abapgit_exception, diff FOR TESTING RAISING zcx_abapgit_exception, moved FOR TESTING RAISING zcx_abapgit_exception, local_outside_main FOR TESTING RAISING zcx_abapgit_exception, complete FOR TESTING RAISING zcx_abapgit_exception, only_local2 FOR TESTING RAISING zcx_abapgit_exception, only_remote2 FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_calculate_status IMPLEMENTATION. METHOD setup. CREATE OBJECT mo_helper. ENDMETHOD. METHOD moved. mo_helper->add_local( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_filename = '$$zdoma1.doma.xml' iv_path = '/foo/' iv_devclass = 'FOO' iv_sha1 = 'D1' ). mo_helper->add_remote( iv_filename = '$$zdoma1.doma.xml' iv_path = '/bar/' iv_sha1 = 'D1' ). mo_helper->add_tadir( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_devclass = 'FOO' ). mo_result = mo_helper->run( iv_devclass = 'FOO' ). mo_result->assert_lines( iv_lines = 2 iv_msg = 'there must be a status calculated for both files, they are in different folders' ). ENDMETHOD. METHOD only_remote. mo_helper->add_remote( iv_filename = '$$zdoma1.doma.xml' iv_sha1 = 'D1' ). mo_result = mo_helper->run( ). mo_result->assert_lines( 1 ). cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 1 )-rstate exp = zif_abapgit_definitions=>c_state-added ). ENDMETHOD. METHOD only_local. mo_helper->add_local( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_filename = '$$zdoma1.doma.xml' iv_sha1 = 'D1' ). mo_result = mo_helper->run( ). mo_result->assert_lines( 1 ). cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 1 )-lstate exp = zif_abapgit_definitions=>c_state-added ). ENDMETHOD. METHOD match. mo_helper->add_local( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_filename = '$$zdoma1.doma.xml' iv_sha1 = 'D1' ). mo_helper->add_remote( iv_filename = '$$zdoma1.doma.xml' iv_sha1 = 'D1' ). mo_result = mo_helper->run( ). mo_result->assert_lines( 1 ). cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 1 )-match exp = abap_true ). ENDMETHOD. METHOD diff. mo_helper->add_local( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_filename = '$$zdoma1.doma.xml' iv_sha1 = '12345' ). mo_helper->add_remote( iv_filename = '$$zdoma1.doma.xml' iv_sha1 = '54321' ). mo_result = mo_helper->run( ). mo_result->assert_lines( 1 ). cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 1 )-lstate exp = zif_abapgit_definitions=>c_state-modified ). cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 1 )-rstate exp = zif_abapgit_definitions=>c_state-modified ). ENDMETHOD. METHOD local_outside_main. mo_helper->add_tadir( iv_obj_type = 'DOMA' iv_obj_name = '$$ZDOMA1' iv_devclass = '$OUTSIDE$' ). mo_helper->add_remote( iv_filename = '$$zdoma1.doma.xml' iv_sha1 = '54321' ). mo_result = mo_helper->run( ). mo_result->assert_lines( 1 ). " it should appear as not existing locally cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 1 )-rstate exp = zif_abapgit_definitions=>c_state-added ). ENDMETHOD. METHOD complete_local. mo_helper->add_local( iv_path = '/' iv_filename = '.abapgit.xml' iv_sha1 = '1017' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_created_locally.prog.abap' iv_sha1 = '1001' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_created_locally.prog.xml' iv_sha1 = '1022' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_deleted_remotely.prog.abap' iv_sha1 = '1016' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_deleted_remotely.prog.xml' iv_sha1 = '1003' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_modified_both.prog.abap' iv_sha1 = '1028' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_modified_both.prog.xml' iv_sha1 = '1032' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_modified_locally.prog.abap' iv_sha1 = '1023' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_modified_locally.prog.xml' iv_sha1 = '1033' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_modified_remotely.prog.abap' iv_sha1 = '1018' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_modified_remotely.prog.xml' iv_sha1 = '1011' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_mod_del.prog.abap' iv_sha1 = '1012' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_mod_del.prog.xml' iv_sha1 = '1006' ). mo_helper->add_local( iv_path = '/src/' iv_filename = 'package.devc.xml' iv_sha1 = '1027' ). mo_helper->add_local( iv_path = '/src/sub/' iv_filename = 'ztest_move_package.prog.xml' iv_sha1 = '1040' ). mo_helper->add_local( iv_path = '/src/sub/' iv_filename = 'package.devc.xml' iv_sha1 = '1041' ). mo_helper->add_local( iv_path = '/src/sub/' iv_filename = 'ztest_move_package_w_change.prog.xml' iv_sha1 = '1042' ). ENDMETHOD. METHOD complete_remote. mo_helper->add_remote( iv_path = '/' iv_filename = '.abapgit.xml' iv_sha1 = '1017' ). mo_helper->add_remote( iv_path = '/' iv_filename = 'README.md' iv_sha1 = '1007' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'package.devc.xml' iv_sha1 = '1027' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_created_remotely.prog.abap' iv_sha1 = '1025' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_created_remotely.prog.xml' iv_sha1 = '1015' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_del_mod.prog.abap' iv_sha1 = '1024' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_del_mod.prog.xml' iv_sha1 = '1013' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_deleted_locally.prog.abap' iv_sha1 = '1008' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_deleted_locally.prog.xml' iv_sha1 = '1009' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_modified_both.prog.abap' iv_sha1 = '1002' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_modified_both.prog.xml' iv_sha1 = '1030' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_modified_locally.prog.abap' iv_sha1 = '1026' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_modified_locally.prog.xml' iv_sha1 = '1021' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_modified_remotely.prog.abap' iv_sha1 = '1019' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_modified_remotely.prog.xml' iv_sha1 = '1031' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_move_package.prog.xml' iv_sha1 = '1040' ). mo_helper->add_remote( iv_path = '/src/sub/' iv_filename = 'package.devc.xml' iv_sha1 = '1041' ). mo_helper->add_remote( iv_path = '/src/' iv_filename = 'ztest_move_package_w_change.prog.xml' iv_sha1 = '2042' ). ENDMETHOD. METHOD complete_state. mo_helper->add_state( iv_path = '/' iv_filename = '.abapgit.xml' iv_sha1 = '1017' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'package.devc.xml' iv_sha1 = '1027' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_deleted_locally.prog.abap' iv_sha1 = '1008' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_deleted_locally.prog.xml' iv_sha1 = '1009' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_deleted_remotely.prog.abap' iv_sha1 = '1016' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_deleted_remotely.prog.xml' iv_sha1 = '1003' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_del_mod.prog.abap' iv_sha1 = '1020' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_del_mod.prog.xml' iv_sha1 = '1029' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_modified_both.prog.abap' iv_sha1 = '1010' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_modified_both.prog.xml' iv_sha1 = '1004' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_modified_locally.prog.abap' iv_sha1 = '1026' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_modified_locally.prog.xml' iv_sha1 = '1021' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_modified_remotely.prog.abap' iv_sha1 = '1018' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_modified_remotely.prog.xml' iv_sha1 = '1011' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_mod_del.prog.abap' iv_sha1 = '1014' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_mod_del.prog.xml' iv_sha1 = '1005' ). mo_helper->add_state( iv_path = '/src/sub/' iv_filename = 'ztest_move_package.prog.xml' iv_sha1 = '1040' ). mo_helper->add_state( iv_path = '/src/sub/' iv_filename = 'package.devc.xml' iv_sha1 = '1041' ). mo_helper->add_state( iv_path = '/src/sub/' iv_filename = 'ztest_move_package_w_change.prog.xml' iv_sha1 = '1042' ). ENDMETHOD. METHOD complete. DATA: ls_line TYPE zif_abapgit_definitions=>ty_result, lv_act TYPE c LENGTH 4, lv_exp TYPE c LENGTH 4. complete_local( ). complete_remote( ). complete_state( ). mo_result = mo_helper->run( ). mo_result->assert_lines( 26 ). DO 26 TIMES. ls_line = mo_result->get_line( sy-index ). lv_act+0(1) = ls_line-match. lv_act+1(1) = ls_line-lstate. lv_act+2(1) = ls_line-rstate. lv_act+3(1) = ls_line-packmove. CASE sy-index. WHEN 1. lv_exp = 'X '. " no changes WHEN 2. lv_exp = ' A'. " add remote WHEN 3. lv_exp = 'X '. " no change WHEN 4 OR 5. lv_exp = ' A '. " add local WHEN 6 OR 7. lv_exp = ' A'. " add remote WHEN 8 OR 9. lv_exp = ' DM'. " delete local, modify remote WHEN 10 OR 11. lv_exp = ' D '. " delete local WHEN 12 OR 13. lv_exp = ' D'. " delete remote WHEN 14 OR 15. lv_exp = ' MD'. " modify local, delete remote WHEN 16 OR 17. lv_exp = ' MM'. " modify both sides WHEN 18 OR 19. lv_exp = ' M '. " modify local WHEN 20 OR 21. lv_exp = ' M'. " modify remote WHEN 22. lv_exp = ' D X'. " package move (no change) WHEN 23. lv_exp = ' D '. " package move with change WHEN 24. lv_exp = 'X '. " no chagen WHEN 25. lv_exp = ' A X'. " package move (no change) WHEN 26. lv_exp = ' A '. " package move with change ENDCASE. cl_abap_unit_assert=>assert_equals( act = lv_act exp = lv_exp msg = |Line { sy-index }: { ls_line-filename }| ). ENDDO. ENDMETHOD. METHOD only_local2. mo_helper->add_local( iv_path = '/src/' iv_filename = 'ztest_deleted_remotely.prog.abap' iv_sha1 = '1016' ). mo_helper->add_state( iv_path = '/src/' iv_filename = 'ztest_deleted_remotely.prog.abap' iv_sha1 = '2016' ). " different checksum mo_result = mo_helper->run( ). mo_result->assert_lines( 1 ). " it should appear as deleted remotely cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 1 )-lstate exp = zif_abapgit_definitions=>c_state-added ). ENDMETHOD. METHOD only_remote2. mo_helper->add_local( iv_path = '/src/sub/' iv_obj_name = 'ZCL_CLAS' iv_obj_type = 'CLAS' iv_filename = 'zcl_clas.clas.abap' iv_sha1 = '112233' ). mo_helper->add_remote( iv_path = '/src/sub/' iv_filename = 'zcl_clas.clas.abap' iv_sha1 = '332211' ). mo_helper->add_remote( iv_path = '/src/sub/' iv_filename = 'zcl_clas.clas.locals_imp.abap' iv_sha1 = '1111' ). mo_helper->add_state( iv_path = '/src/sub/' iv_filename = 'zcl_clas.clas.locals_imp.abap' iv_sha1 = '1111' ). mo_result = mo_helper->run( iv_devclass = '$DIFFERENT$' ). mo_result->assert_lines( 2 ). cl_abap_unit_assert=>assert_equals( act = mo_result->get_line( 2 )-match exp = abap_false ). ENDMETHOD. ENDCLASS.
28.879167
101
0.551262
4cbef3b192f0cdbb21c14474c33b2aada222cab2
7,990
abap
ABAP
clean_code_main/clean_code_foundation/y_clean_code_manager.clas.abap
leeroberts67/code-pal-for-abap
26b4d7efd22f5863b825c638ae6128e9331cb924
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_foundation/y_clean_code_manager.clas.abap
leeroberts67/code-pal-for-abap
26b4d7efd22f5863b825c638ae6128e9331cb924
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_foundation/y_clean_code_manager.clas.abap
leeroberts67/code-pal-for-abap
26b4d7efd22f5863b825c638ae6128e9331cb924
[ "Apache-2.0" ]
null
null
null
CLASS y_clean_code_manager DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES y_if_clean_code_manager . PROTECTED SECTION. private section. data OBJECT_CREATION_DATE type ref to Y_IF_OBJECT_CREATION_DATE . methods DETERMINE_PROFILES importing !USERNAME type XUBNAME returning value(RESULT) type STRING_TABLE raising YCX_NO_CHECK_CUSTOMIZING . methods DETERMINE_CHECKS importing !PROFILE type STRING !CHECKID type SEOCLSNAME !OBJ_CREATION_DATE type DATUM returning value(RESULT) type Y_IF_CLEAN_CODE_MANAGER=>CHECK_CONFIGURATIONS raising YCX_NO_CHECK_CUSTOMIZING . ENDCLASS. CLASS Y_CLEAN_CODE_MANAGER IMPLEMENTATION. METHOD determine_checks. DATA profile_manager TYPE REF TO object. DATA check_configuration TYPE y_if_clean_code_manager=>check_configuration. DATA checks_ref TYPE REF TO data. DATA check_ref TYPE REF TO data. DATA profile_name_ref TYPE REF TO data. FIELD-SYMBOLS <checks> TYPE ANY TABLE. FIELD-SYMBOLS <check> TYPE any. FIELD-SYMBOLS <profile_name> TYPE any. FIELD-SYMBOLS <checkid> TYPE any. FIELD-SYMBOLS <start_date> TYPE any. FIELD-SYMBOLS <end_date> TYPE any. FIELD-SYMBOLS <objects_created_on> TYPE any. FIELD-SYMBOLS <threshold> TYPE any. FIELD-SYMBOLS <prio> TYPE any. FIELD-SYMBOLS <apply_on_productive_code> TYPE any. FIELD-SYMBOLS <apply_on_testcode> TYPE any. TRY. CREATE DATA checks_ref TYPE STANDARD TABLE OF (`YTAB_CHECKS`) WITH DEFAULT KEY. ASSIGN checks_ref->* TO <checks>. CREATE DATA profile_name_ref TYPE (`YCICC_PROFILE`). ASSIGN profile_name_ref->* TO <profile_name>. <profile_name> = profile. CREATE OBJECT profile_manager TYPE (`Y_PROFILE_MANAGER`). DATA(ptab) = VALUE abap_parmbind_tab( ( name = 'PROFILE' kind = cl_abap_objectdescr=>exporting value = REF #( <profile_name> ) ) ( name = 'RESULT' kind = cl_abap_objectdescr=>returning value = REF #( <checks> ) ) ). CALL METHOD profile_manager->(`Y_IF_PROFILE_MANAGER~SELECT_CHECKS`) PARAMETER-TABLE ptab. IF <checks> IS ASSIGNED. CREATE DATA check_ref TYPE (`YTAB_CHECKS`). ASSIGN check_ref->* TO <check>. LOOP AT <checks> ASSIGNING <check>. ASSIGN COMPONENT `CHECKID` OF STRUCTURE <check> TO <checkid>. ASSIGN COMPONENT `START_DATE` OF STRUCTURE <check> TO <start_date>. ASSIGN COMPONENT `END_DATE` OF STRUCTURE <check> TO <end_date>. ASSIGN COMPONENT `OBJECTS_CREATED_ON` OF STRUCTURE <check> TO <objects_created_on>. ASSIGN COMPONENT `THRESHOLD` OF STRUCTURE <check> TO <threshold>. ASSIGN COMPONENT `PRIO` OF STRUCTURE <check> TO <prio>. ASSIGN COMPONENT `APPLY_ON_PRODUCTIVE_CODE` OF STRUCTURE <check> TO <apply_on_productive_code>. ASSIGN COMPONENT `APPLY_ON_TESTCODE` OF STRUCTURE <check> TO <apply_on_testcode>. IF <checkid> = checkid AND <start_date> <= sy-datlo AND <end_date> >= sy-datlo AND <objects_created_on> <= obj_creation_date. check_configuration-object_creation_date = <objects_created_on>. check_configuration-threshold = <threshold>. check_configuration-prio = <prio>. check_configuration-apply_on_productive_code = <apply_on_productive_code>. check_configuration-apply_on_testcode = <apply_on_testcode>. result = VALUE #( BASE result ( CORRESPONDING #( check_configuration ) ) ). ENDIF. ENDLOOP. ENDIF. CATCH cx_sy_create_data_error cx_sy_create_object_error ycx_entry_not_found. RETURN. ENDTRY. ENDMETHOD. METHOD determine_profiles. DATA obj_name TYPE string. DATA profile_db TYPE string VALUE `YTAB_PROFILE_REP`. DATA callstack TYPE sys_callst. CALL FUNCTION 'SYSTEM_CALLSTACK' IMPORTING et_callstack = callstack. FIND FIRST OCCURRENCE OF `Y_CLEAN_CODE_REPORTING` IN TABLE callstack. IF sy-subrc = 0. SELECT SINGLE obj_name FROM tadir INTO obj_name WHERE pgmid = 'R3TR' AND object = 'TABL' AND obj_name = profile_db. IF sy-subrc = 0. SELECT profile FROM (profile_db) INTO TABLE result. IF sy-subrc = 0. RETURN. ENDIF. ENDIF. ENDIF. DATA profile_manager TYPE REF TO object. DATA profiles_ref TYPE REF TO data. FIELD-SYMBOLS <profiles> TYPE ANY TABLE. DATA profile_ref TYPE REF TO data. FIELD-SYMBOLS <profile> TYPE any. FIELD-SYMBOLS <profile_name> TYPE any. TRY. CREATE DATA profiles_ref TYPE STANDARD TABLE OF (`YTAB_PROFILES`) WITH DEFAULT KEY. ASSIGN profiles_ref->* TO <profiles>. CREATE DATA profile_ref TYPE (`YTAB_PROFILES`). ASSIGN profile_ref->* TO <profile>. CREATE OBJECT profile_manager TYPE (`Y_PROFILE_MANAGER`). CATCH cx_sy_create_object_error cx_sy_create_data_error. RETURN. ENDTRY. DATA(ptab) = VALUE abap_parmbind_tab( ( name = 'USERNAME' kind = cl_abap_objectdescr=>exporting value = REF #( username ) ) ( name = 'RESULT' kind = cl_abap_objectdescr=>returning value = REF #( <profiles> ) ) ). TRY. CALL METHOD profile_manager->(`Y_IF_PROFILE_MANAGER~SELECT_PROFILES`) PARAMETER-TABLE ptab. CATCH ycx_entry_not_found. RAISE EXCEPTION TYPE ycx_no_check_customizing. ENDTRY. LOOP AT <profiles> ASSIGNING <profile>. ASSIGN COMPONENT `PROFILE` OF STRUCTURE <profile> TO <profile_name>. APPEND <profile_name> TO result. ENDLOOP. ENDMETHOD. METHOD y_if_clean_code_manager~calculate_obj_creation_date. IF object_creation_date IS NOT BOUND. object_creation_date = NEW y_object_creation_date( ). ENDIF. CASE object_type. WHEN 'INTF'. result = object_creation_date->get_interface_create_date( object_name ). WHEN 'CLAS'. result = object_creation_date->get_class_create_date( object_name ). WHEN 'FUGR'. result = object_creation_date->get_function_group_create_date( object_name ). WHEN 'PROG'. result = object_creation_date->get_program_create_date( object_name ). WHEN OTHERS. ENDCASE. ENDMETHOD. METHOD y_if_clean_code_manager~read_check_customizing. TRY. DATA(profiles) = determine_profiles( username ). CATCH ycx_no_check_customizing. RAISE EXCEPTION TYPE ycx_no_check_customizing. ENDTRY. DATA(obj_creation_date) = y_if_clean_code_manager~calculate_obj_creation_date( object_name = object_name object_type = object_type ). LOOP AT profiles ASSIGNING FIELD-SYMBOL(<profile>). TRY. DATA(check_configurations) = determine_checks( profile = <profile> checkid = checkid obj_creation_date = obj_creation_date ). CATCH ycx_no_check_customizing. CONTINUE. ENDTRY. APPEND LINES OF check_configurations TO result. ENDLOOP. IF lines( result ) = 0. RAISE EXCEPTION TYPE ycx_no_check_customizing. ENDIF. ENDMETHOD. ENDCLASS.
36.484018
111
0.622153
4cc20867bda39202de650ddb827e9b8d446388cf
1,435
abap
ABAP
src/adt/zcx_sat_adt_object_search.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
9
2019-11-14T12:27:19.000Z
2022-01-26T16:35:09.000Z
src/adt/zcx_sat_adt_object_search.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
13
2019-12-04T15:02:12.000Z
2021-11-25T16:43:12.000Z
src/adt/zcx_sat_adt_object_search.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
4
2019-11-14T13:59:43.000Z
2020-08-05T09:58:30.000Z
"! <p class="shorttext synchronized" lang="en">ADT Object Search error</p> CLASS zcx_sat_adt_object_search DEFINITION PUBLIC INHERITING FROM zcx_sat_adt_rest_error FINAL CREATE PUBLIC . PUBLIC SECTION. "! <p class="shorttext synchronized" lang="en">CONSTRUCTOR</p> METHODS constructor IMPORTING textid LIKE if_t100_message=>t100key OPTIONAL previous LIKE previous OPTIONAL subtype TYPE sadt_exc_type OPTIONAL msgv1 TYPE symsgv DEFAULT sy-msgv1 msgv2 TYPE symsgv DEFAULT sy-msgv2 msgv3 TYPE symsgv DEFAULT sy-msgv3 msgv4 TYPE symsgv DEFAULT sy-msgv4 properties TYPE REF TO if_adt_exception_properties OPTIONAL . METHODS get_type REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcx_sat_adt_object_search IMPLEMENTATION. METHOD constructor ##ADT_SUPPRESS_GENERATION. CALL METHOD super->constructor EXPORTING previous = previous subtype = subtype msgv1 = msgv1 msgv2 = msgv2 msgv3 = msgv3 msgv4 = msgv4 properties = properties. CLEAR me->textid. IF textid IS INITIAL. if_t100_message~t100key = if_t100_message=>default_textid. ELSE. if_t100_message~t100key = textid. ENDIF. ENDMETHOD. METHOD get_type. result = 'objectsearch'. ENDMETHOD. ENDCLASS.
26.090909
74
0.667596
4cc4aabc79ae4f1b50ac551dc574f68d2bf721e1
828
abap
ABAP
src/ytticksys_jisto.fugr.lytticksys_jistot00.abap
keremkoseoglu/ticksys
95fd5453a037716eb1bd33633950e4f4b1e8d677
[ "Apache-2.0" ]
4
2020-11-12T07:33:43.000Z
2022-02-15T18:04:29.000Z
src/ytticksys_jisto.fugr.lytticksys_jistot00.abap
MikeSidorochkin/ticksys
a3fc7d827943481d309fb88038003962ef9676b5
[ "Apache-2.0" ]
8
2020-11-03T08:13:48.000Z
2022-01-17T07:50:51.000Z
src/ytticksys_jisto.fugr.lytticksys_jistot00.abap
MikeSidorochkin/ticksys
a3fc7d827943481d309fb88038003962ef9676b5
[ "Apache-2.0" ]
3
2020-11-30T06:14:17.000Z
2021-09-11T18:01:30.000Z
*---------------------------------------------------------------------* * view related data declarations * generation date: 21.11.2020 at 10:41:08 * view maintenance generator version: #001407# *---------------------------------------------------------------------* *...processing: YTTICKSYS_JISTO.................................* DATA: BEGIN OF STATUS_YTTICKSYS_JISTO . "state vector INCLUDE STRUCTURE VIMSTATUS. DATA: END OF STATUS_YTTICKSYS_JISTO . CONTROLS: TCTRL_YTTICKSYS_JISTO TYPE TABLEVIEW USING SCREEN '0001'. *.........table declarations:.................................* TABLES: *YTTICKSYS_JISTO . TABLES: YTTICKSYS_JISTO . * general table data declarations.............. INCLUDE LSVIMTDT .
46
71
0.456522
4cc52f42e5983fecc663d4b4a167c9d2ea3f631c
4,214
abap
ABAP
src/utils/zcl_abapgit_convert.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
src/utils/zcl_abapgit_convert.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
src/utils/zcl_abapgit_convert.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_convert DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS bitbyte_to_int IMPORTING !iv_bits TYPE clike RETURNING VALUE(rv_int) TYPE i . CLASS-METHODS x_to_bitbyte IMPORTING !iv_x TYPE x RETURNING VALUE(rv_bitbyte) TYPE zif_abapgit_definitions=>ty_bitbyte . CLASS-METHODS string_to_xstring_utf8 IMPORTING !iv_string TYPE string RETURNING VALUE(rv_xstring) TYPE xstring . CLASS-METHODS xstring_to_string_utf8 IMPORTING !iv_data TYPE xstring RETURNING VALUE(rv_string) TYPE string . CLASS-METHODS xstring_to_int IMPORTING !iv_xstring TYPE xstring RETURNING VALUE(rv_i) TYPE i RAISING zcx_abapgit_exception . CLASS-METHODS int_to_xstring4 IMPORTING !iv_i TYPE i RETURNING VALUE(rv_xstring) TYPE xstring . CLASS-METHODS split_string IMPORTING !iv_string TYPE string RETURNING VALUE(rt_lines) TYPE string_table . ENDCLASS. CLASS ZCL_ABAPGIT_CONVERT IMPLEMENTATION. METHOD bitbyte_to_int. DATA: lv_bitbyte TYPE string, lv_len TYPE i, lv_offset TYPE i. lv_bitbyte = iv_bits. SHIFT lv_bitbyte LEFT DELETING LEADING '0 '. lv_len = strlen( lv_bitbyte ). lv_offset = lv_len - 1. rv_int = 0. DO lv_len TIMES. IF sy-index = 1. "Intialize CASE lv_bitbyte+lv_offset(1). WHEN '1'. rv_int = 1. ENDCASE. ELSE. CASE lv_bitbyte+lv_offset(1). WHEN '1'. rv_int = rv_int + ( 2 ** ( sy-index - 1 ) ). ENDCASE. ENDIF. lv_offset = lv_offset - 1. "Move Cursor ENDDO. ENDMETHOD. METHOD int_to_xstring4. * returns xstring of length 4 containing the integer value iv_i DATA: lv_x TYPE x LENGTH 4. lv_x = iv_i. rv_xstring = lv_x. ENDMETHOD. METHOD split_string. FIND FIRST OCCURRENCE OF cl_abap_char_utilities=>cr_lf IN iv_string. " Convert string into table depending on separator type CR_LF vs. LF IF sy-subrc = 0. SPLIT iv_string AT cl_abap_char_utilities=>cr_lf INTO TABLE rt_lines. ELSE. SPLIT iv_string AT cl_abap_char_utilities=>newline INTO TABLE rt_lines. ENDIF. ENDMETHOD. METHOD string_to_xstring_utf8. DATA: lo_obj TYPE REF TO cl_abap_conv_out_ce. TRY. lo_obj = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ). lo_obj->convert( EXPORTING data = iv_string IMPORTING buffer = rv_xstring ). CATCH cx_parameter_invalid_range cx_sy_codepage_converter_init cx_sy_conversion_codepage cx_parameter_invalid_type. "#EC NO_HANDLER ENDTRY. ENDMETHOD. METHOD xstring_to_int. DATA: lv_xstring TYPE xstring, lv_x TYPE x. lv_xstring = iv_xstring. WHILE xstrlen( lv_xstring ) > 0. lv_x = lv_xstring(1). rv_i = rv_i * 256 + lv_x. lv_xstring = lv_xstring+1. ENDWHILE. ENDMETHOD. METHOD xstring_to_string_utf8. DATA: lv_len TYPE i, lo_obj TYPE REF TO cl_abap_conv_in_ce. TRY. lo_obj = cl_abap_conv_in_ce=>create( input = iv_data encoding = 'UTF-8' ). lv_len = xstrlen( iv_data ). lo_obj->read( EXPORTING n = lv_len IMPORTING data = rv_string ). CATCH cx_parameter_invalid_range cx_sy_codepage_converter_init cx_sy_conversion_codepage cx_parameter_invalid_type. "#EC NO_HANDLER ENDTRY. ENDMETHOD. METHOD x_to_bitbyte. CLEAR rv_bitbyte. GET BIT 1 OF iv_x INTO rv_bitbyte+0(1). GET BIT 2 OF iv_x INTO rv_bitbyte+1(1). GET BIT 3 OF iv_x INTO rv_bitbyte+2(1). GET BIT 4 OF iv_x INTO rv_bitbyte+3(1). GET BIT 5 OF iv_x INTO rv_bitbyte+4(1). GET BIT 6 OF iv_x INTO rv_bitbyte+5(1). GET BIT 7 OF iv_x INTO rv_bitbyte+6(1). GET BIT 8 OF iv_x INTO rv_bitbyte+7(1). ENDMETHOD. ENDCLASS.
22.414894
77
0.618889
4cc58e44593e4468aaf0c612adf4579b11025b84
1,650
abap
ABAP
src/cts/zif_abapgit_cts_api.intf.abap
IvxLars/abapGit
bcdeebb3ad1432034b5ad1ea40683470956b8e07
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/cts/zif_abapgit_cts_api.intf.abap
IvxLars/abapGit
bcdeebb3ad1432034b5ad1ea40683470956b8e07
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/cts/zif_abapgit_cts_api.intf.abap
IvxLars/abapGit
bcdeebb3ad1432034b5ad1ea40683470956b8e07
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
INTERFACE zif_abapgit_cts_api PUBLIC . TYPES: BEGIN OF ty_transport, obj_type TYPE tadir-object, obj_name TYPE tadir-obj_name, trkorr TYPE trkorr, END OF ty_transport. TYPES ty_transport_list TYPE SORTED TABLE OF ty_transport WITH NON-UNIQUE KEY obj_type obj_name. "! Returns the transport request / task the object is currently in "! @parameter is_item | Object "! @parameter rv_transport | Transport request / task "! @raising zcx_abapgit_exception | Object is not in a transport METHODS get_transport_for_object IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item RETURNING VALUE(rv_transport) TYPE trkorr RAISING zcx_abapgit_exception . "! Check if change recording is possible for the given package "! @parameter iv_package | Package "! @parameter rv_possible | Change recording is possible "! @raising zcx_abapgit_exception | Package could not be loaded METHODS is_chrec_possible_for_package IMPORTING !iv_package TYPE devclass RETURNING VALUE(rv_possible) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS get_transports_for_list IMPORTING !it_items TYPE zif_abapgit_definitions=>ty_items_tt RETURNING VALUE(rt_transports) TYPE ty_transport_list RAISING zcx_abapgit_exception . METHODS get_r3tr_obj_for_limu_obj IMPORTING iv_object TYPE tadir-object iv_obj_name TYPE trobj_name EXPORTING ev_object TYPE tadir-object ev_obj_name TYPE trobj_name RAISING zcx_abapgit_exception . ENDINTERFACE.
31.730769
98
0.719394
4cc5a26062e3b26e70ffd4387a41278e34fb7d44
29,821
abap
ABAP
src/ui/zcl_abapgit_gui_view_repo.clas.abap
wdecpacloudcourse01/abap_a07
ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_view_repo.clas.abap
wdecpacloudcourse01/abap_a07
ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_view_repo.clas.abap
wdecpacloudcourse01/abap_a07
ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_view_repo DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_gui_page . INTERFACES zif_abapgit_gui_page_hotkey. ALIASES render FOR zif_abapgit_gui_page~render . CONSTANTS: BEGIN OF c_actions, 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, display_more TYPE string VALUE 'display_more' ##NO_TEXT, END OF c_actions . METHODS constructor IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . PRIVATE SECTION. 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. METHODS: render_head_line IMPORTING iv_lstate TYPE char1 iv_rstate TYPE char1 RETURNING VALUE(ro_html) TYPE REF TO zcl_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(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, render_item_files IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, render_item_command IMPORTING is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ro_html) TYPE REF TO zcl_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(ro_html) TYPE REF TO zcl_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. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_VIEW_REPO IMPLEMENTATION. 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( " Show/Hide files iv_txt = 'Show files' iv_chk = boolc( NOT mv_hide_files = abap_true ) iv_act = c_actions-toggle_hide_files ). ro_toolbar->add( " Show changes only iv_txt = 'Show changes only' iv_chk = mv_changes_only iv_act = c_actions-toggle_changes ). ENDIF. ro_toolbar->add( " Show/Hide folders iv_txt = 'Show folders' iv_chk = mv_show_folders iv_act = c_actions-toggle_folders ). 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_key TYPE zif_abapgit_persistence=>ty_value, lv_wp_opt LIKE zif_abapgit_definitions=>c_html_opt-crossout, lv_crossout LIKE zif_abapgit_definitions=>c_html_opt-crossout, lv_pull_opt LIKE zif_abapgit_definitions=>c_html_opt-crossout. CREATE OBJECT ro_toolbar. CREATE OBJECT lo_tb_branch. CREATE OBJECT lo_tb_advanced. CREATE OBJECT lo_tb_tag. lv_key = mo_repo->get_key( ). IF mo_repo->get_local_settings( )-write_protected = abap_true. lv_wp_opt = zif_abapgit_definitions=>c_html_opt-crossout. lv_pull_opt = zif_abapgit_definitions=>c_html_opt-crossout. ELSE. lv_pull_opt = zif_abapgit_definitions=>c_html_opt-strong. ENDIF. " Build branch drop-down ======================== IF mo_repo->is_offline( ) = abap_false. " Online ? lo_tb_branch->add( iv_txt = 'Overview' iv_act = |{ zif_abapgit_definitions=>c_action-go_branch_overview }?{ lv_key }| ). lo_tb_branch->add( iv_txt = 'Switch' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_switch }?{ lv_key }| iv_opt = lv_wp_opt ). lo_tb_branch->add( iv_txt = 'Create' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_create }?{ lv_key }| ). lo_tb_branch->add( iv_txt = 'Delete' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_delete }?{ lv_key }| ). lo_tb_tag->add( iv_txt = 'Overview' iv_act = |{ zif_abapgit_definitions=>c_action-go_tag_overview }?{ lv_key }| ). lo_tb_tag->add( iv_txt = 'Switch' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_switch }?{ lv_key }| iv_opt = lv_wp_opt ). lo_tb_tag->add( iv_txt = 'Create' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_create }?{ lv_key }| ). lo_tb_tag->add( iv_txt = 'Delete' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_delete }?{ lv_key }| ). ENDIF. " Build advanced drop-down ======================== IF iv_rstate IS NOT INITIAL OR iv_lstate IS NOT INITIAL. " In case of asyncronicities lo_tb_advanced->add( iv_txt = 'Reset local' iv_act = |{ zif_abapgit_definitions=>c_action-git_reset }?{ lv_key }| iv_opt = lv_wp_opt ). ENDIF. IF mo_repo->is_offline( ) = abap_false. " Online ? lo_tb_advanced->add( iv_txt = 'Background mode' iv_act = |{ zif_abapgit_definitions=>c_action-go_background }?{ lv_key }| ). lo_tb_advanced->add( iv_txt = 'Change remote' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remote_change }?{ lv_key }| ). lo_tb_advanced->add( iv_txt = 'Make off-line' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remote_detach }?{ lv_key }| ). lo_tb_advanced->add( iv_txt = 'Force stage' iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }?{ lv_key }| ). CLEAR lv_crossout. IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-transport_to_branch ) = abap_false. lv_crossout = zif_abapgit_definitions=>c_html_opt-crossout. ENDIF. lo_tb_advanced->add( iv_txt = 'Transport to Branch' iv_act = |{ zif_abapgit_definitions=>c_action-repo_transport_to_branch }?{ lv_key }| iv_opt = lv_crossout ). ELSE. lo_tb_advanced->add( iv_txt = 'Make on-line' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remote_attach }?{ lv_key }| ). ENDIF. lo_tb_advanced->add( iv_txt = 'Syntax Check' iv_act = |{ zif_abapgit_definitions=>c_action-repo_syntax_check }?{ lv_key }| ). lo_tb_advanced->add( iv_txt = 'Run Code Inspector' iv_act = |{ zif_abapgit_definitions=>c_action-repo_code_inspector }?{ lv_key }| ). lo_tb_advanced->add( iv_txt = 'Repo settings' iv_act = |{ zif_abapgit_definitions=>c_action-repo_settings }?{ lv_key }| ). CLEAR lv_crossout. IF zcl_abapgit_auth=>is_allowed( zif_abapgit_auth=>gc_authorization-update_local_checksum ) = abap_false. lv_crossout = zif_abapgit_definitions=>c_html_opt-crossout. ENDIF. lo_tb_advanced->add( iv_txt = 'Update local checksums' iv_act = |{ zif_abapgit_definitions=>c_action-repo_refresh_checksums }?{ lv_key }| iv_opt = lv_crossout ). IF mo_repo->get_dot_abapgit( )->get_master_language( ) <> sy-langu. lo_tb_advanced->add( iv_txt = 'Open in master language' iv_act = |{ zif_abapgit_definitions=>c_action-repo_open_in_master_lang }?{ lv_key }| ). ENDIF. lo_tb_advanced->add( iv_txt = 'Remove' iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }?{ lv_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_definitions=>c_html_opt-crossout. ENDIF. lo_tb_advanced->add( iv_txt = 'Uninstall' iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }?{ lv_key }| iv_opt = lv_crossout ). " Build main toolbar ============================== IF mo_repo->is_offline( ) = abap_false. " Online ? 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 }?{ lv_key }| iv_opt = lv_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 }?{ lv_key }| iv_opt = zif_abapgit_definitions=>c_html_opt-strong ). ENDIF. IF iv_rstate IS NOT INITIAL OR iv_lstate IS NOT INITIAL. " Any changes ro_toolbar->add( iv_txt = 'Show diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?key={ lv_key }| iv_opt = zif_abapgit_definitions=>c_html_opt-strong ). ENDIF. ro_toolbar->add( iv_txt = 'Branch' io_sub = lo_tb_branch ) ##NO_TEXT. ro_toolbar->add( iv_txt = 'Tag' io_sub = lo_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 }?{ lv_key }| iv_opt = zif_abapgit_definitions=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Show diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?key={ lv_key }| iv_opt = zif_abapgit_definitions=>c_html_opt-strong ). ENDIF. ro_toolbar->add( iv_txt = 'Import <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-zip_import }?{ lv_key }| iv_opt = zif_abapgit_definitions=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Export <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-zip_export }?{ lv_key }| iv_opt = zif_abapgit_definitions=>c_html_opt-strong ). ENDIF. ro_toolbar->add( iv_txt = 'Advanced' io_sub = lo_tb_advanced ) ##NO_TEXT. ro_toolbar->add( iv_txt = 'Refresh' iv_act = |{ zif_abapgit_definitions=>c_action-repo_refresh }?{ lv_key }| ). ro_toolbar->add( iv_txt = zcl_abapgit_html=>icon( iv_name = 'settings/grey70' ) io_sub = build_grid_menu( ) ). ENDMETHOD. METHOD build_inactive_object_code. IF is_item-inactive = abap_true. rv_inactive_html_code = zcl_abapgit_html=>icon( iv_name = 'zap/orange' iv_hint = 'Object or object part is inactive' iv_class = 'inactive' ). ENDIF. 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 constructor. DATA lo_settings TYPE REF TO zcl_abapgit_settings. super->constructor( ). 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( ). " 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. 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'. rv_html = zcl_abapgit_html=>icon( 'file-code/darkgrey' ). WHEN 'W3MI' OR 'W3HT'. rv_html = zcl_abapgit_html=>icon( 'file-binary/darkgrey' ). WHEN ''. rv_html = space. " no icon WHEN OTHERS. rv_html = zcl_abapgit_html=>icon( 'file/darkgrey' ). ENDCASE. IF is_item-is_dir = abap_true. rv_html = zcl_abapgit_html=>icon( 'file-directory/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_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 ro_html. lo_toolbar = build_head_menu( iv_lstate = iv_lstate iv_rstate = iv_rstate ). ro_html->add( '<div class="paddings">' ). ro_html->add( '<table class="w100"><tr>' ). IF mv_show_folders = abap_true. ro_html->add( |<td class="current_dir">{ mv_cur_dir }</td>| ). ENDIF. ro_html->add( '<td class="right">' ). ro_html->add( lo_toolbar->render( iv_right = abap_true ) ). ro_html->add( '</td>' ). ro_html->add( '</tr></table>' ). ro_html->add( '</div>' ). ENDMETHOD. METHOD render_item. DATA: lv_link TYPE string, lv_colspan TYPE i. CREATE OBJECT ro_html. IF iv_render_transports = abap_false. lv_colspan = 2. ELSE. lv_colspan = 3. ENDIF. ro_html->add( |<tr{ get_item_class( is_item ) }>| ). IF is_item-obj_name IS INITIAL AND is_item-is_dir = abap_false. ro_html->add( |<td colspan="{ lv_colspan }"></td>| && '<td class="object">' && '<i class="grey">non-code and meta files</i>' && '</td>' ). ELSE. ro_html->add( |<td class="icon">{ get_item_icon( is_item ) }</td>| ). IF iv_render_transports = abap_true. ro_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 ). ro_html->add( |<td class="dir" colspan="2">{ lv_link }</td>| ). ELSE. lv_link = build_obj_jump_link( is_item ). ro_html->add( |<td class="type">{ is_item-obj_type }</td>| ). ro_html->add( |<td class="object">{ lv_link } { build_inactive_object_code( is_item ) }</td>| ). ENDIF. ENDIF. " Files ro_html->add( '<td class="files">' ). ro_html->add( render_item_files( is_item ) ). ro_html->add( '</td>' ). " Command IF mo_repo->has_remote_source( ) = abap_true. ro_html->add( '<td class="cmd">' ). ro_html->add( render_item_command( is_item ) ). ro_html->add( '</td>' ). ENDIF. ro_html->add( '</tr>' ). ENDMETHOD. METHOD render_item_command. DATA: lv_difflink TYPE string, ls_file LIKE LINE OF is_item-files. CREATE OBJECT ro_html. IF is_item-is_dir = abap_true. " Directory ro_html->add( '<div>' ). ro_html->add( |<span class="grey">{ is_item-changes } changes</span>| ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_item-lstate iv_rstate = is_item-rstate ) ). ro_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 ). ro_html->add( '<div>' ). ro_html->add_a( iv_txt = |view diff ({ is_item-changes })| iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?{ lv_difflink }| ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_item-lstate iv_rstate = is_item-rstate ) ). ro_html->add( '</div>' ). ELSE. LOOP AT is_item-files INTO ls_file. ro_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 ). ro_html->add_a( iv_txt = 'view diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?{ lv_difflink }| ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = ls_file-lstate iv_rstate = ls_file-rstate ) ). ELSE. ro_html->add( '&nbsp;' ). ENDIF. ro_html->add( '</div>' ). ENDLOOP. ENDIF. ENDIF. ENDMETHOD. METHOD render_item_files. DATA: ls_file LIKE LINE OF is_item-files. CREATE OBJECT ro_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. ro_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_parent_dir. CREATE OBJECT ro_html. ro_html->add( '<tr class="folder">' ). ro_html->add( |<td class="icon">{ zcl_abapgit_html=>icon( 'dir' ) }</td>| ). ro_html->add( |<td class="object" colspan="4">{ build_dir_jump_link( '..' ) }</td>| ). IF mo_repo->has_remote_source( ) = abap_true. ro_html->add( |<td colspan="1"></td>| ). " Dummy for online ENDIF. ro_html->add( '</tr>' ). ENDMETHOD. METHOD zif_abapgit_gui_page_hotkey~get_hotkey_actions. ENDMETHOD. METHOD zif_abapgit_gui_page~on_event. DATA: lv_path TYPE string. CASE iv_action. WHEN c_actions-toggle_hide_files. " Toggle file diplay mv_hide_files = zcl_abapgit_persistence_user=>get_instance( )->toggle_hide_files( ). ev_state = zif_abapgit_definitions=>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 = zif_abapgit_definitions=>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 = zif_abapgit_definitions=>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 = zif_abapgit_definitions=>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 = zif_abapgit_definitions=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_open_in_master_lang. open_in_master_language( ). ev_state = zif_abapgit_definitions=>c_event_state-re_render. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_page~render. 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, lo_log TYPE REF TO zcl_abapgit_log, lv_render_transports TYPE abap_bool. FIELD-SYMBOLS <ls_item> LIKE LINE OF lt_repo_items. " Reinit, for the case of type change mo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( mo_repo->get_key( ) ). CREATE OBJECT ro_html. 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 ). 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. ro_html->add( render_head_line( iv_lstate = lv_lstate iv_rstate = lv_rstate ) ). lo_log = lo_browser->get_log( ). IF mo_repo->is_offline( ) = abap_false AND lo_log->count( ) > 0. ro_html->add( '<div class="log">' ). ro_html->add( lo_log->to_html( ) ). " shows eg. list of unsupported objects ro_html->add( '</div>' ). ENDIF. ro_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. ro_html->add( |<div class="repo_banner panel success">| && |ZIP source is attached and completely <b>matches</b> to the local state| && |</div>| ). ENDIF. " Repo content table ro_html->add( '<table class="repo_tab">' ). IF zcl_abapgit_path=>is_root( mv_cur_dir ) = abap_false. ro_html->add( render_parent_dir( ) ). ENDIF. IF lines( lt_repo_items ) = 0. ro_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. ro_html->add( render_item( is_item = <ls_item> iv_render_transports = lv_render_transports ) ). ENDLOOP. ENDIF. ro_html->add( '</table>' ). IF lv_max = abap_true. ro_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 }|. ro_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 ) } )| ). ro_html->add( '</div>' ). ENDIF. ro_html->add( '</div>' ). CATCH zcx_abapgit_exception INTO lx_error. ro_html->add( render_head_line( iv_lstate = lv_lstate iv_rstate = lv_rstate ) ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_error( ix_error = lx_error ) ). ENDTRY. ENDMETHOD. ENDCLASS.
37.557935
114
0.608229
4cc69b0e121a14c58bde53be1c71d71f098aa78a
176
abap
ABAP
lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt.fugr.lzsst_gtttop.abap
DanHaer/logistics-business-network-gtt-samples
739978ac389da6f3530b26cd6402a3892f4b605a
[ "Apache-2.0" ]
12
2020-09-25T07:54:40.000Z
2021-09-27T12:29:34.000Z
lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt.fugr.lzsst_gtttop.abap
DanHaer/logistics-business-network-gtt-samples
739978ac389da6f3530b26cd6402a3892f4b605a
[ "Apache-2.0" ]
2
2020-10-15T05:20:41.000Z
2022-02-14T09:28:02.000Z
lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt.fugr.lzsst_gtttop.abap
DanHaer/logistics-business-network-gtt-samples
739978ac389da6f3530b26cd6402a3892f4b605a
[ "Apache-2.0" ]
50
2020-09-29T03:06:01.000Z
2022-03-28T16:04:45.000Z
FUNCTION-POOL ZSST_GTT. "MESSAGE-ID .. *INCLUDE lzsst_gtt_v2d01. " Local class definition *INCLUDE lzsst_gtt_v2d00. INCLUDE zsst_gtt_ae_def.
25.142857
66
0.653409
4ccc6dbcec64001305647d453d13073244a8566c
29,169
abap
ABAP
clean_code_main/clean_code_checks/y_check_base.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_checks/y_check_base.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_checks/y_check_base.clas.testclasses.abap
lucasborin-tmp/code-pal-for-abap
2b6509207cf682247d9dbad0aaf45771887fb2c1
[ "Apache-2.0" ]
null
null
null
CLASS ltc_base DEFINITION DEFERRED. CLASS y_check_base DEFINITION LOCAL FRIENDS ltc_base. CLASS ltd_clean_code_manager_error DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: y_if_clean_code_manager. ENDCLASS. CLASS ltd_clean_code_manager_error IMPLEMENTATION. METHOD y_if_clean_code_manager~calculate_obj_creation_date. RETURN. ENDMETHOD. 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 = 2 ) ( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'W' threshold = 1 ) ). ENDMETHOD. ENDCLASS. CLASS ltc_check_base_mock DEFINITION FOR TESTING INHERITING FROM y_check_base. PROTECTED SECTION. METHODS inspect_tokens REDEFINITION. ENDCLASS. CLASS ltc_check_base_mock IMPLEMENTATION. METHOD inspect_tokens. RETURN. ENDMETHOD. ENDCLASS. CLASS ltd_clean_code_manager_warning DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: y_if_clean_code_manager. ENDCLASS. CLASS ltd_clean_code_manager_warning IMPLEMENTATION. METHOD y_if_clean_code_manager~calculate_obj_creation_date. RETURN. ENDMETHOD. METHOD y_if_clean_code_manager~read_check_customizing. result = VALUE #( ( apply_on_testcode = abap_false prio = 'E' threshold = 5 ) ( apply_on_testcode = abap_false prio = 'W' threshold = 1 ) ). ENDMETHOD. ENDCLASS. CLASS ltd_ref_scan_manager DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: y_if_scan_manager PARTIALLY IMPLEMENTED. METHODS: set_data_for_ok, set_data_for_error, set_pseudo_comment_ok. PRIVATE SECTION. DATA: ref_scan TYPE REF TO cl_ci_scan, levels TYPE slevel_tab, structures TYPE sstruc_tab, statements TYPE sstmnt_tab, tokens TYPE stokesx_tab. ENDCLASS. CLASS ltd_ref_scan_manager IMPLEMENTATION. METHOD y_if_scan_manager~get_structures. result = structures. ENDMETHOD. METHOD y_if_scan_manager~get_statements. result = statements. ENDMETHOD. METHOD y_if_scan_manager~get_tokens. result = tokens. ENDMETHOD. METHOD y_if_scan_manager~get_levels. result = levels. ENDMETHOD. METHOD y_if_scan_manager~set_ref_scan. RETURN. ENDMETHOD. METHOD y_if_scan_manager~is_scan_ok. result = abap_true. ENDMETHOD. METHOD set_data_for_ok. levels = VALUE #( ( depth = 1 level = 0 stmnt = 0 from = 1 to = 5 name = 'ZTEST' type = 'P' ) ). structures = VALUE #( ( stmnt_from = 1 stmnt_to = 5 stmnt_type = scan_struc_stmnt_type-method ) ). statements = VALUE #( ( level = 1 from = '1' to = '2' type = 'K' ) ( level = 1 from = '3' to = '7' type = 'K' ) ( level = 1 from = '8' to = '10' type = 'K' ) ( level = 1 from = '11' to = '11' type = 'K' ) ( level = 1 from = '12' to = '12' type = 'K' ) ). tokens = VALUE #( ( str = 'METHOD' type = 'I' row = 1 ) ( str = 'CALC' type = 'I' row = 1 ) ( str = 'IF' type = 'I' row = 2 ) ( str = 'VALUE_A' type = 'I' row = 2 ) ( str = '=' type = 'I' row = 2 ) ( str = '1' type = 'I' row = 2 ) ( str = 'VALUE_B' type = 'I' row = 3 ) ( str = '=' type = 'I' row = 3 ) ( str = '2' type = 'I' row = 3 ) ( str = 'ENDIF' type = 'I' row = 4 ) ( str = 'ENDMETHOD' type = 'I' row = 5 ) ). ENDMETHOD. METHOD set_data_for_error. levels = VALUE #( ( depth = 1 level = 0 stmnt = 0 from = 1 to = 11 name = 'ZTEST' type = 'P' ) ). structures = VALUE #( ( stmnt_from = 1 stmnt_to = 11 stmnt_type = scan_struc_stmnt_type-method ) ). statements = VALUE #( ( level = 1 from = '1' to = '2' type = 'K' ) ( level = 1 from = '3' to = '6' type = 'K' ) ( level = 1 from = '7' to = '9' type = 'K' ) ( level = 1 from = '10' to = '12' type = 'K' ) ( level = 1 from = '13' to = '17' type = 'K' ) ( level = 1 from = '18' to = '19' type = 'K' ) ( level = 1 from = '20' to = '21' type = 'K' ) ( level = 1 from = '22' to = '22' type = 'K' ) ( level = 1 from = '23' to = '23' type = 'K' ) ( level = 1 from = '24' to = '24' type = 'K' ) ( level = 1 from = '25' to = '25' type = 'K' ) ). tokens = VALUE #( ( str = 'METHOD' type = 'I' row = 1 ) ( str = 'CALC' type = 'I' row = 1 ) ( str = 'IF' type = 'I' row = 2 ) ( str = 'VALUE_A' type = 'I' row = 2 ) ( str = '=' type = 'I' row = 2 ) ( str = '1' type = 'I' row = 2 ) ( str = 'VALUE_B' type = 'I' row = 3 ) ( str = '=' type = 'I' row = 3 ) ( str = '2' type = 'I' row = 3 ) ( str = 'DO' type = 'I' row = 6 ) ( str = 'COUNTER' type = 'I' row = 6 ) ( str = 'TIMES' type = 'I' row = 6 ) ( str = 'VALUE_C' type = 'I' row = 7 ) ( str = '=' type = 'I' row = 7 ) ( str = 'VALUE_C' type = 'I' row = 7 ) ( str = '+' type = 'I' row = 7 ) ( str = '1' type = 'I' row = 7 ) ( str = 'CASE' type = 'I' row = 8 ) ( str = 'VALUE_D' type = 'I' row = 8 ) ( str = 'WHEN' type = 'I' row = 9 ) ( str = 'ACTIVE' type = 'I' row = 9 ) ( str = 'ENDCASE' type = 'I' row = 10 ) ( str = 'ENDDO' type = 'I' row = 11 ) ( str = 'ENDIF' type = 'I' row = 12 ) ( str = 'ENDMETHOD' type = 'I' row = 13 ) ). ENDMETHOD. METHOD set_pseudo_comment_ok. set_data_for_error( ). statements = VALUE #( BASE statements ( level = 1 from = '26' to = '26' type = 'P' ) ). tokens = VALUE #( BASE tokens ( str = '"#EC CI_CYCLO' type = 'C' row = 14 ) ). 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 ltc_base DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. DATA: cut TYPE REF TO y_check_base, ref_scan_manager_double TYPE REF TO ltd_ref_scan_manager. METHODS: setup, assert_errors IMPORTING err_cnt TYPE i, assert_warnings IMPORTING warn_cnt TYPE i, assert_pseudo_comments IMPORTING pc_cnt TYPE i, is_bound FOR TESTING, raise_error FOR TESTING, raise_pseudo_comment FOR TESTING. ENDCLASS. CLASS ltc_base IMPLEMENTATION. METHOD setup. cut = NEW ltc_check_base_mock( ). ref_scan_manager_double = NEW ltd_ref_scan_manager( ). cut->ref_scan_manager ?= ref_scan_manager_double. cut->clean_code_exemption_handler = NEW ltd_clean_code_exemption_no( ). cut->statistics = NEW lcl_statistics( ). ENDMETHOD. METHOD is_bound. cl_abap_unit_assert=>assert_bound( EXPORTING act = cut ). ENDMETHOD. METHOD raise_error. cut->clean_code_manager = NEW ltd_clean_code_manager_error( ). ref_scan_manager_double->set_data_for_error( ). cut->scimessages = VALUE #( ( test = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY' code = 100 kind = 'E' text = |Cyclotomic complexity is &1, exceeding threshold of &2| pcom = |CI_CYCLO| ) ( test = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY' code = 101 kind = 'W' text = |Cyclotomic complexity is &1, exceeding threshold of &2| pcom = |CI_CYCLO| ) ( test = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY' code = 102 kind = 'N' text = |Cyclotomic complexity is &1, exceeding threshold of &2| pcom = |CI_CYCLO| ) ). cut->settings-pseudo_comment = '#EC CI_CYCLO'. cut->myname = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY'. cut->raise_error( EXPORTING object_type = '' statement_level = 0 statement_from = 0 statement_index = 11 error_priority = 'E' ). assert_errors( 1 ). assert_warnings( 0 ). assert_pseudo_comments( 0 ). ENDMETHOD. METHOD raise_pseudo_comment. cut->clean_code_manager = NEW ltd_clean_code_manager_warning( ). ref_scan_manager_double->set_pseudo_comment_ok( ). cut->scimessages = VALUE #( ( test = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY' code = 100 kind = 'E' text = |Cyclotomic complexity is &1, exceeding threshold of &2| pcom = |CI_CYCLO| ) ( test = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY' code = 101 kind = 'W' text = |Cyclotomic complexity is &1, exceeding threshold of &2| pcom = |CI_CYCLO| ) ( test = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY' code = 102 kind = 'N' text = |Cyclotomic complexity is &1, exceeding threshold of &2| pcom = |CI_CYCLO| ) ). cut->settings-pseudo_comment = '#EC CI_CYCLO'. cut->myname = 'CL_CI_CC_CYCLOMATIC_COMPLEXITY'. cut->raise_error( EXPORTING object_type = '' statement_level = 0 statement_from = 0 statement_index = 11 error_priority = 'W' ). assert_errors( 0 ). assert_warnings( 0 ). assert_pseudo_comments( 1 ). ENDMETHOD. METHOD assert_errors. cl_abap_unit_assert=>assert_equals( EXPORTING act = cut->statistics->get_number_errors( ) exp = err_cnt ). ENDMETHOD. METHOD assert_warnings. cl_abap_unit_assert=>assert_equals( EXPORTING act = cut->statistics->get_number_warnings( ) exp = warn_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. CLASS ltc_statistics DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. DATA: cut TYPE REF TO lcl_statistics. METHODS: setup, is_bound FOR TESTING, check_errors FOR TESTING, check_warnings FOR TESTING, check_pseudo_comments FOR TESTING, increment_pseudo_comments FOR TESTING. ENDCLASS. CLASS ltc_statistics IMPLEMENTATION. METHOD setup. cut = NEW lcl_statistics( ). ENDMETHOD. METHOD is_bound. cl_abap_unit_assert=>assert_bound( EXPORTING act = cut ). ENDMETHOD. METHOD check_errors. cut->y_if_scan_statistics~collect( EXPORTING kind = 'E' pc = '' ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_errors( ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_warnings( ) exp = 0 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_pseudo_comments( ) exp = 0 ). ENDMETHOD. METHOD check_warnings. cut->y_if_scan_statistics~collect( EXPORTING kind = 'W' pc = '' ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_errors( ) exp = 0 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_warnings( ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_pseudo_comments( ) exp = 0 ). ENDMETHOD. METHOD check_pseudo_comments. cut->y_if_scan_statistics~collect( EXPORTING kind = 'E' pc = 'P' ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_errors( ) exp = 0 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_warnings( ) exp = 0 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_pseudo_comments( ) exp = 1 ). ENDMETHOD. METHOD increment_pseudo_comments. cut->y_if_scan_statistics~collect( EXPORTING kind = 'E' pc = 'P' ). cut->y_if_scan_statistics~increment_pseudo_comment_cnt( ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_errors( ) exp = 0 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_warnings( ) exp = 0 ). cl_abap_unit_assert=>assert_equals( act = cut->y_if_scan_statistics~get_number_pseudo_comments( ) exp = 2 ). ENDMETHOD. ENDCLASS. CLASS ltd_ref_scan_manager_test DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: y_if_scan_manager PARTIALLY IMPLEMENTED. METHODS: set_data_without_test, set_data_with_test. PRIVATE SECTION. DATA: ref_scan TYPE REF TO cl_ci_scan, levels TYPE slevel_tab, structures TYPE sstruc_tab, statements TYPE sstmnt_tab, tokens TYPE stokesx_tab. ENDCLASS. CLASS ltd_ref_scan_manager_test IMPLEMENTATION. METHOD y_if_scan_manager~get_structures. result = structures. ENDMETHOD. METHOD y_if_scan_manager~get_statements. result = statements. ENDMETHOD. METHOD y_if_scan_manager~get_tokens. result = tokens. ENDMETHOD. METHOD y_if_scan_manager~get_levels. result = levels. ENDMETHOD. METHOD y_if_scan_manager~set_ref_scan. RETURN. ENDMETHOD. METHOD y_if_scan_manager~is_scan_ok. result = abap_true. ENDMETHOD. METHOD set_data_without_test. levels = VALUE #( ( depth = 1 level = 0 stmnt = 0 from = 1 to = 5 name = 'ZTEST' type = 'P' ) ( depth = 1 level = 0 stmnt = 0 from = 6 to = 9 name = 'ZTEST' type = 'P' ) ). structures = VALUE #( ( stmnt_from = 1 stmnt_to = 5 stmnt_type = scan_struc_stmnt_type-class_definition back = 0 ) ( stmnt_from = 6 stmnt_to = 9 stmnt_type = scan_struc_stmnt_type-class_implementation back = 0 ) ( stmnt_from = 2 stmnt_to = 4 stmnt_type = scan_struc_stmnt_type-public_section back = 2 ) ( stmnt_from = 7 stmnt_to = 8 stmnt_type = scan_struc_stmnt_type-method back = 2 ) ). statements = VALUE #( ( level = 1 from = '1' to = '3' type = 'K' ) ( level = 1 from = '4' to = '5' type = 'K' ) ( level = 1 from = '6' to = '7' type = 'K' ) ( level = 1 from = '8' to = '11' type = 'K' ) ( level = 1 from = '12' to = '12' type = 'K' ) ( level = 1 from = '13' to = '15' type = 'K' ) ( level = 1 from = '16' to = '17' type = 'K' ) ( level = 1 from = '18' to = '18' type = 'K' ) ( level = 1 from = '19' to = '19' type = 'K' ) ). tokens = VALUE #( ( str = 'CLASS' type = 'I' row = 1 ) ( str = 'CLASS_1' type = 'I' row = 1 ) ( str = 'DEFINITION' type = 'I' row = 1 ) ( str = 'PUBLIC' type = 'I' row = 2 ) ( str = 'SECTION' type = 'I' row = 2 ) ( str = 'METHODS' type = 'I' row = 3 ) ( str = 'METHOD_1' type = 'I' row = 3 ) ( str = 'DATA' type = 'I' row = 4 ) ( str = 'D1' type = 'I' row = 4 ) ( str = 'TYPE' type = 'I' row = 4 ) ( str = 'INT4' type = 'I' row = 4 ) ( str = 'ENDCLASS' type = 'I' row = 5 ) ( str = 'CLASS' type = 'I' row = 6 ) ( str = 'CLASS_1' type = 'I' row = 6 ) ( str = 'IMPLEMENTATION' type = 'I' row = 6 ) ( str = 'METHOD' type = 'I' row = 7 ) ( str = 'METHOD_1' type = 'I' row = 7 ) ( str = 'ENDMETHOD' type = 'I' row = 8 ) ( str = 'ENDCLASS' type = 'I' row = 9 ) ). ENDMETHOD. METHOD set_data_with_test. levels = VALUE #( ( depth = 1 level = 0 stmnt = 0 from = 1 to = 5 name = 'ZTEST' type = 'P' ) ( depth = 1 level = 0 stmnt = 0 from = 12 to = 12 name = 'ZTEST' type = 'P' ) ). structures = VALUE #( ( stmnt_from = 1 stmnt_to = 5 stmnt_type = scan_struc_stmnt_type-class_definition back = 0 ) ( stmnt_from = 6 stmnt_to = 12 stmnt_type = scan_struc_stmnt_type-class_implementation back = 0 ) ( stmnt_from = 2 stmnt_to = 4 stmnt_type = scan_struc_stmnt_type-public_section back = 2 ) ( stmnt_from = 7 stmnt_to = 11 stmnt_type = scan_struc_stmnt_type-method back = 2 ) ( stmnt_from = 8 stmnt_to = 10 stmnt_type = scan_struc_stmnt_type-if back = 4 ) ). statements = VALUE #( ( level = 1 from = '1' to = '5' type = 'K' ) ( level = 1 from = '6' to = '7' type = 'K' ) ( level = 1 from = '8' to = '11' type = 'K' ) ( level = 1 from = '12' to = '15' type = 'K' ) ( level = 1 from = '16' to = '16' type = 'K' ) ( level = 1 from = '17' to = '19' type = 'K' ) ( level = 1 from = '20' to = '21' type = 'K' ) ( level = 1 from = '22' to = '25' type = 'K' ) ( level = 1 from = '26' to = '28' type = 'K' ) ( level = 1 from = '29' to = '29' type = 'K' ) ( level = 1 from = '30' to = '30' type = 'K' ) ( level = 1 from = '31' to = '31' type = 'K' ) ). tokens = VALUE #( ( str = 'CLASS' type = 'I' row = 1 ) ( str = 'TEST_CLASS_1' type = 'I' row = 1 ) ( str = 'DEFINITION' type = 'I' row = 1 ) ( str = 'FOR' type = 'I' row = 1 ) ( str = 'TESTING' type = 'I' row = 1 ) ( str = 'PUBLIC' type = 'I' row = 2 ) ( str = 'SECTION' type = 'I' row = 2 ) ( str = 'METHODS' type = 'I' row = 3 ) ( str = 'TEST_METHOD_1' type = 'I' row = 3 ) ( str = 'FOR' type = 'I' row = 3 ) ( str = 'TESTING' type = 'I' row = 3 ) ( str = 'DATA' type = 'I' row = 4 ) ( str = 'TEST_INT' type = 'I' row = 4 ) ( str = 'TYPE' type = 'I' row = 4 ) ( str = 'INT4' type = 'I' row = 4 ) ( str = 'ENDCLASS' type = 'I' row = 5 ) ( str = 'CLASS' type = 'I' row = 6 ) ( str = 'TEST_CLASS_1' type = 'I' row = 6 ) ( str = 'IMPLEMENTATION' type = 'I' row = 6 ) ( str = 'METHOD' type = 'I' row = 7 ) ( str = 'TEST_METHOD_1' type = 'I' row = 7 ) ( str = 'IF' type = 'I' row = 8 ) ( str = 'COUNT' type = 'I' row = 8 ) ( str = '=' type = 'I' row = 8 ) ( str = 'MAX' type = 'I' row = 8 ) ( str = 'MIN' type = 'I' row = 9 ) ( str = '=' type = 'I' row = 9 ) ( str = '2' type = 'I' row = 9 ) ( str = 'ENDIF' type = 'I' row = 10 ) ( str = 'ENDMETHOD' type = 'I' row = 11 ) ( str = 'ENDCLASS' type = 'I' row = 12 ) ). ENDMETHOD. ENDCLASS. CLASS ltc_test_code_detector DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. DATA: cut TYPE REF TO lcl_test_code_detector, ref_scan_manager_double TYPE REF TO ltd_ref_scan_manager_test. METHODS: setup, is_bound FOR TESTING, is_test_class_no FOR TESTING, is_test_class_yes FOR TESTING, is_test_method_no FOR TESTING, is_test_method_yes FOR TESTING, is_if_in_test_code_yes FOR TESTING, is_test_attribute_no FOR TESTING, is_test_attribute_yes FOR TESTING. ENDCLASS. CLASS ltc_test_code_detector IMPLEMENTATION. METHOD setup. ref_scan_manager_double = NEW ltd_ref_scan_manager_test( ). cut = NEW lcl_test_code_detector( ). cut->y_if_testcode_detector~set_ref_scan_manager( ref_scan_manager_double ). ENDMETHOD. METHOD is_bound. cl_abap_unit_assert=>assert_bound( EXPORTING act = cut ). ENDMETHOD. METHOD is_test_class_no. ref_scan_manager_double->set_data_without_test( ). DATA(structures) = ref_scan_manager_double->y_if_scan_manager~get_structures( ). READ TABLE structures INTO DATA(structure) INDEX 1. cl_abap_unit_assert=>assert_equals( act = cut->y_if_testcode_detector~is_testcode( structure ) exp = abap_false ). ENDMETHOD. METHOD is_test_class_yes. ref_scan_manager_double->set_data_with_test( ). DATA(structures) = ref_scan_manager_double->y_if_scan_manager~get_structures( ). READ TABLE structures INTO DATA(structure) INDEX 1. cl_abap_unit_assert=>assert_equals( act = cut->y_if_testcode_detector~is_testcode( structure ) exp = abap_true ). ENDMETHOD. METHOD is_test_method_no. ref_scan_manager_double->set_data_without_test( ). DATA(structures) = ref_scan_manager_double->y_if_scan_manager~get_structures( ). READ TABLE structures INTO DATA(structure) INDEX 4. cl_abap_unit_assert=>assert_equals( act = cut->y_if_testcode_detector~is_testcode( structure ) exp = abap_false ). ENDMETHOD. METHOD is_test_method_yes. ref_scan_manager_double->set_data_with_test( ). DATA(structures) = ref_scan_manager_double->y_if_scan_manager~get_structures( ). READ TABLE structures INTO DATA(structure) INDEX 4. cl_abap_unit_assert=>assert_equals( act = cut->y_if_testcode_detector~is_testcode( structure ) exp = abap_true ). ENDMETHOD. METHOD is_if_in_test_code_yes. ref_scan_manager_double->set_data_with_test( ). DATA(structures) = ref_scan_manager_double->y_if_scan_manager~get_structures( ). READ TABLE structures INTO DATA(structure) INDEX 5. cl_abap_unit_assert=>assert_equals( act = cut->y_if_testcode_detector~is_testcode( structure ) exp = abap_true ). ENDMETHOD. METHOD is_test_attribute_no. ref_scan_manager_double->set_data_without_test( ). DATA(structures) = ref_scan_manager_double->y_if_scan_manager~get_structures( ). READ TABLE structures INTO DATA(structure) INDEX 3. cl_abap_unit_assert=>assert_equals( act = cut->y_if_testcode_detector~is_testcode( structure ) exp = abap_false ). ENDMETHOD. METHOD is_test_attribute_yes. ref_scan_manager_double->set_data_with_test( ). DATA(structures) = ref_scan_manager_double->y_if_scan_manager~get_structures( ). READ TABLE structures INTO DATA(structure) INDEX 3. cl_abap_unit_assert=>assert_equals( act = cut->y_if_testcode_detector~is_testcode( structure ) exp = abap_true ). ENDMETHOD. ENDCLASS. CLASS ltc_check_configuration DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. DATA: cut TYPE REF TO y_check_base, exp TYPE y_if_clean_code_manager=>check_configuration. METHODS: setup, is_bound FOR TESTING, no_config_ok FOR TESTING, one_config_ok FOR TESTING, one_config_error FOR TESTING, two_configs_same_prio_err FOR TESTING, two_configs_diff_prio_warn FOR TESTING, two_configs_diff_prio_err FOR TESTING, two_configs_same_limit_err FOR TESTING, two_configs_diff_test_note FOR TESTING. ENDCLASS. CLASS y_check_base DEFINITION LOCAL FRIENDS ltc_check_configuration. CLASS ltc_check_configuration IMPLEMENTATION. METHOD setup. cut = NEW ltc_check_base_mock( ). ENDMETHOD. METHOD is_bound. cl_abap_unit_assert=>assert_bound( act = cut ). ENDMETHOD. METHOD no_config_ok. exp = VALUE #( apply_on_testcode = abap_false prio = '' threshold = 0 ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 3 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. METHOD one_config_ok. exp = VALUE #( apply_on_testcode = abap_false prio = '' threshold = 0 ). cut->check_configurations = VALUE #( ( apply_on_testcode = abap_false prio = 'E' threshold = 5 ) ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 3 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. METHOD one_config_error. exp = VALUE #( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 5 ). cut->check_configurations = VALUE #( ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 5 ) ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 15 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. METHOD two_configs_same_prio_err. exp = VALUE #( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 5 ). cut->check_configurations = VALUE #( ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 10 ) ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 5 ) ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 15 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. METHOD two_configs_diff_prio_warn. exp = VALUE #( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'W' threshold = 5 ). cut->check_configurations = VALUE #( ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 10 ) ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'W' threshold = 5 ) ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 8 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. METHOD two_configs_diff_prio_err. exp = VALUE #( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 5 ). cut->check_configurations = VALUE #( ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'W' threshold = 10 ) ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 5 ) ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 8 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. METHOD two_configs_same_limit_err. exp = VALUE #( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'W' threshold = 10 ). cut->check_configurations = VALUE #( ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'N' threshold = 10 ) ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'W' threshold = 10 ) ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 12 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. METHOD two_configs_diff_test_note. exp = VALUE #( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'N' threshold = 10 ). cut->check_configurations = VALUE #( ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'N' threshold = 10 ) ( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'N' threshold = 10 ) ). cl_abap_unit_assert=>assert_equals( act = cut->detect_check_configuration( threshold = 12 include = 'Y____TEST' ) exp = exp ). ENDMETHOD. ENDCLASS.
40.344398
182
0.573554
4cce41ebe74e5d8c3dacfa92f443dbcfbf78766d
2,335
abap
ABAP
src/legacy/#dmo#flight_travel_api01.fugr.#dmo#flight_travel_read01.abap
SAP-Cloud-Platform/flight01
23e52f647b63e9c70f1bfc524aa46f0f36540795
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api01.fugr.#dmo#flight_travel_read01.abap
SAP-Cloud-Platform/flight01
23e52f647b63e9c70f1bfc524aa46f0f36540795
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api01.fugr.#dmo#flight_travel_read01.abap
SAP-Cloud-Platform/flight01
23e52f647b63e9c70f1bfc524aa46f0f36540795
[ "BSD-Source-Code" ]
null
null
null
"! <h1>API for Getting a Travel</h1> "! "! <p> "! Function module to get a single Travel instance with all related Bookings and "! Booking Supplements related to the importing Travel ID. "! </p> "! "! "! @parameter iv_travel_id | Travel ID "! @parameter iv_include_buffer | Include any changes that have not yet been committed "! @parameter es_travel | Travel Data like /DMO/TRAVEL01 related to the importing Travel ID "! @parameter et_booking | Table of Bookings like /DMO/BOOKING01 related to the importing Travel ID "! @parameter et_booking_supplement | Table of Booking Supplements like /DMO/BOOK_SUP_01 related to the importing Travel ID "! @parameter et_messages | Table of occurred messages "! FUNCTION /DMO/FLIGHT_TRAVEL_READ01. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(IV_TRAVEL_ID) TYPE /DMO/TRAVEL_ID01 *" REFERENCE(IV_INCLUDE_BUFFER) TYPE ABAP_BOOLEAN DEFAULT *" ABAP_TRUE *" EXPORTING *" REFERENCE(ES_TRAVEL) TYPE /DMO/TRAVEL01 *" REFERENCE(ET_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY01=>TT_BOOKING *" REFERENCE(ET_BOOKING_SUPPLEMENT) TYPE *" /DMO/IF_FLIGHT_LEGACY01=>TT_BOOKING_SUPPLEMENT *" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY01=>TT_MESSAGE *"---------------------------------------------------------------------- CLEAR es_travel. CLEAR et_booking. CLEAR et_booking_supplement. CLEAR et_messages. /dmo/cl_flight_legacy01=>get_instance( )->get_travel( EXPORTING iv_travel_id = iv_travel_id iv_include_buffer = iv_include_buffer IMPORTING es_travel = es_travel et_booking = et_booking et_booking_supplement = et_booking_supplement et_messages = DATA(lt_messages) ). /dmo/cl_flight_legacy01=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages IMPORTING et_messages = et_messages ). ENDFUNCTION.
51.888889
123
0.569165
4cd0270d8c185e5193acea7130d7fa681795f73a
6,703
abap
ABAP
src/checks/zcl_aoc_check_64.clas.abap
phaniacumen/SAPPROJ
dc4bf7a03d9ab2f4ac30bb77f6f38e6a55e5fcc4
[ "MIT" ]
1
2018-04-22T04:47:28.000Z
2018-04-22T04:47:28.000Z
src/checks/zcl_aoc_check_64.clas.abap
phaniacumen/SAPPROJ
dc4bf7a03d9ab2f4ac30bb77f6f38e6a55e5fcc4
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_64.clas.abap
phaniacumen/SAPPROJ
dc4bf7a03d9ab2f4ac30bb77f6f38e6a55e5fcc4
[ "MIT" ]
null
null
null
CLASS zcl_aoc_check_64 DEFINITION PUBLIC INHERITING FROM zcl_aoc_super_root CREATE PUBLIC . PUBLIC SECTION. METHODS constructor . METHODS get_message_text REDEFINITION . METHODS if_ci_test~query_attributes REDEFINITION . METHODS put_attributes REDEFINITION . METHODS run REDEFINITION . METHODS get_attributes REDEFINITION . PROTECTED SECTION. DATA mv_covered TYPE abap_bool . DATA mi_result TYPE REF TO if_scv_result . DATA mv_risk TYPE saunit_d_allowed_risk_level . DATA mv_duration TYPE saunit_d_allowed_rt_duration . METHODS node IMPORTING !ii_node TYPE REF TO if_scv_result_node . METHODS walk IMPORTING !ir_node TYPE REF TO if_scv_result_node . PRIVATE SECTION. ENDCLASS. CLASS ZCL_AOC_CHECK_64 IMPLEMENTATION. METHOD constructor. super->constructor( ). description = 'Unit test not covering class'. "#EC NOTEXT category = 'ZCL_AOC_CATEGORY'. version = '001'. position = '064'. has_documentation = c_true. has_attributes = abap_true. attributes_ok = abap_true. mv_errty = c_error. mv_duration = if_aunit_attribute_enums=>c_duration-medium. mv_risk = if_aunit_attribute_enums=>c_risk_level-harmless. add_obj_type( 'CLAS' ). ENDMETHOD. "CONSTRUCTOR METHOD get_attributes. EXPORT mv_errty = mv_errty mv_duration = mv_duration mv_risk = mv_risk TO DATA BUFFER p_attributes. ENDMETHOD. METHOD get_message_text. CLEAR p_text. CASE p_code. WHEN '001'. p_text = 'Unit test not covering class'. "#EC NOTEXT WHEN OTHERS. super->get_message_text( EXPORTING p_test = p_test p_code = p_code IMPORTING p_text = p_text ). ENDCASE. ENDMETHOD. METHOD if_ci_test~query_attributes. zzaoc_top. zzaoc_fill_att mv_errty 'Error Type' ''. "#EC NOTEXT zzaoc_fill_att mv_duration 'Duration' ''. "#EC NOTEXT zzaoc_fill_att mv_risk 'Risk' ''. "#EC NOTEXT zzaoc_popup. ENDMETHOD. METHOD node. DATA: lv_pb_type TYPE cvd_pb_type, lv_pb_name TYPE cvd_pb_name, lv_prog_class TYPE cvd_prog_class, lv_prog_type TYPE cvd_prog_type, lv_prog_name TYPE cvd_prog_name. CASE ii_node->subtype. WHEN 'METH'. DATA(lo_insp) = cl_scv_pblock_inspector=>create( ii_node ). lv_pb_type = 'METH'. lv_pb_name = lo_insp->get_method_name( ). lv_prog_class = lo_insp->get_class_name( ). lv_prog_type = lo_insp->get_program_subtype( ). lv_prog_name = lo_insp->get_program_name( ). WHEN OTHERS. lv_pb_type = ii_node->subtype. lv_pb_name = ii_node->name. CLEAR lv_prog_class. lv_prog_type = ii_node->get_parent( )->subtype. lv_prog_name = ii_node->get_parent( )->name. ENDCASE. DATA(lo_ui_factory) = NEW cl_scov_stmnt_cov_ui_factory( ). DATA(lo_pb_info) = lo_ui_factory->create_pb_info( im_pb_type = lv_pb_type im_pb_name = lv_pb_name im_prog_class = lv_prog_class im_prog_type = lv_prog_type im_prog_name = lv_prog_name ). DATA(lt_tkey_selops) = VALUE cvt_test_key_selops( ( option = 'EQ' sign = 'I' low = mi_result->get_measurement( )->get_testkey( ) ) ). DATA(li_container) = lo_ui_factory->create_stmnt_dcon_factory( lt_tkey_selops )->create_stmnt_data_container( lo_pb_info ). * DATA(lt_source) = li_container->get_source( ). DATA(lt_meta) = li_container->get_stmnt_cov_meta_data( ). * 102 = covered READ TABLE lt_meta WITH KEY color = '102' TRANSPORTING NO FIELDS. IF sy-subrc = 0. mv_covered = abap_true. ENDIF. ENDMETHOD. METHOD put_attributes. IMPORT mv_errty = mv_errty mv_duration = mv_duration mv_risk = mv_risk FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED ASSERT sy-subrc = 0. ENDMETHOD. METHOD run. * abapOpenChecks * https://github.com/larshp/abapOpenChecks * MIT License DATA: li_node TYPE REF TO if_scv_result_node, lt_keys TYPE sabp_t_tadir_keys, ls_key LIKE LINE OF lt_keys, lv_clsname TYPE seoclsname, lo_runner TYPE REF TO cl_aucv_test_runner_abstract, li_coverage TYPE REF TO if_aucv_cvrg_rslt_provider, li_aunit TYPE REF TO if_saunit_internal_result, lo_aunit TYPE REF TO cl_saunit_internal_result, lo_passport TYPE REF TO object. IF object_type <> 'CLAS'. RETURN. ENDIF. DATA(ls_info) = cl_aunit_prog_info=>get_program_info( allow_commit = abap_true obj_type = object_type obj_name = object_name ). IF ls_info-has_tests = abap_false. RETURN. ENDIF. CALL METHOD ('\PROGRAM=SAPLSAUCV_GUI_RUNNER\CLASS=PASSPORT')=>get RECEIVING result = lo_passport. lo_runner = cl_aucv_test_runner_coverage=>create( lo_passport ). ls_key-obj_name = object_name. ls_key-obj_type = object_type. APPEND ls_key TO lt_keys. lo_runner->run_for_program_keys( EXPORTING i_limit_on_duration_category = mv_duration i_limit_on_risk_level = mv_risk i_program_keys = lt_keys IMPORTING e_coverage_result = li_coverage e_aunit_result = li_aunit ). lo_aunit ?= li_aunit. IF lo_aunit->f_task_data-info-has_skipped = abap_true. * Some or all unit tests skipped, could not determine coverage RETURN. ENDIF. TRY. mi_result = li_coverage->build_coverage_result( ). CATCH cx_scv_execution_error cx_scv_call_error. RETURN. ENDTRY. mv_covered = abap_false. LOOP AT mi_result->get_root_node( )->get_children( ) INTO li_node. walk( li_node ). ENDLOOP. IF mv_covered = abap_false. lv_clsname = object_name. inform( p_sub_obj_type = c_type_include p_sub_obj_name = cl_oo_classname_service=>get_ccau_name( lv_clsname ) p_line = 1 p_kind = mv_errty p_test = myname p_code = '001' ). ENDIF. ENDMETHOD. METHOD walk. IF ir_node->has_children( ) = abap_false. node( ir_node ). ENDIF. LOOP AT ir_node->get_children( ) INTO DATA(li_node). walk( li_node ). ENDLOOP. ENDMETHOD. ENDCLASS.
25.681992
83
0.635835
4cd4d3841071d964000d8d832a3369d50c5d704d
10,479
abap
ABAP
src/objects/zcl_abapgit_object_iatu.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
1
2018-05-11T09:36:31.000Z
2018-05-11T09:36:31.000Z
src/objects/zcl_abapgit_object_iatu.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_iatu.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
2
2016-12-14T09:31:45.000Z
2018-03-27T12:00:44.000Z
CLASS zcl_abapgit_object_iatu DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. PROTECTED SECTION. PRIVATE SECTION. METHODS: read EXPORTING es_attr TYPE w3tempattr ev_source TYPE string RAISING zcx_abapgit_exception, save IMPORTING is_attr TYPE w3tempattr iv_source TYPE string RAISING zcx_abapgit_exception, w3_api_load IMPORTING is_name TYPE iacikeyt RETURNING VALUE(ri_template) TYPE REF TO if_w3_api_template RAISING zcx_abapgit_exception, w3_api_set_changeable IMPORTING iv_changeable TYPE abap_bool ii_template TYPE REF TO if_w3_api_template RAISING zcx_abapgit_exception, w3_api_delete IMPORTING ii_template TYPE REF TO if_w3_api_template RAISING zcx_abapgit_exception, w3_api_save IMPORTING ii_template TYPE REF TO if_w3_api_template RAISING zcx_abapgit_exception, w3_api_get_attributes IMPORTING ii_template TYPE REF TO if_w3_api_template RETURNING VALUE(rs_attributes) TYPE w3tempattr RAISING zcx_abapgit_exception, w3_api_get_source IMPORTING ii_template TYPE REF TO if_w3_api_template RETURNING VALUE(rt_source) TYPE w3htmltabtype RAISING zcx_abapgit_exception, w3_api_create_new IMPORTING is_template_data TYPE w3tempattr RETURNING VALUE(ri_template) TYPE REF TO if_w3_api_template RAISING zcx_abapgit_exception, w3_api_set_attributes IMPORTING ii_template TYPE REF TO if_w3_api_template is_attr TYPE w3tempattr RAISING zcx_abapgit_exception, w3_api_set_source IMPORTING ii_template TYPE REF TO if_w3_api_template it_source TYPE w3htmltabtype RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_object_iatu IMPLEMENTATION. METHOD read. DATA: li_template TYPE REF TO if_w3_api_template, lt_source TYPE w3htmltabtype, ls_name TYPE iacikeyt. ls_name = ms_item-obj_name. li_template = w3_api_load( is_name = ls_name ). es_attr = w3_api_get_attributes( ii_template = li_template ). CLEAR: es_attr-chname, es_attr-tdate, es_attr-ttime, es_attr-devclass. lt_source = w3_api_get_source( ii_template = li_template ). CONCATENATE LINES OF lt_source INTO ev_source RESPECTING BLANKS. ENDMETHOD. METHOD save. DATA: lt_source TYPE w3htmltabtype, lv_source TYPE string, li_template TYPE REF TO if_w3_api_template. li_template = w3_api_create_new( is_template_data = is_attr ). w3_api_set_attributes( ii_template = li_template is_attr = is_attr ). lv_source = iv_source. WHILE strlen( lv_source ) >= 255. APPEND lv_source(255) TO lt_source. lv_source = lv_source+255. ENDWHILE. IF NOT lv_source IS INITIAL. APPEND lv_source TO lt_source. ENDIF. w3_api_set_source( ii_template = li_template it_source = lt_source ). w3_api_save( li_template ). " Release locks w3_api_set_changeable( ii_template = li_template iv_changeable = abap_false ). ENDMETHOD. METHOD w3_api_create_new. cl_w3_api_template=>if_w3_api_template~create_new( EXPORTING p_template_data = is_template_data p_program_name = is_template_data-programm IMPORTING p_template = ri_template 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 user_error = 8 OTHERS = 9 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Error from w3_api_template~create_new subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_delete. ii_template->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 w3_api_template~delete subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_get_attributes. ii_template->get_attributes( IMPORTING p_attributes = rs_attributes EXCEPTIONS object_invalid = 1 template_deleted = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Error from w3_api_template~get_attributes subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_get_source. ii_template->get_source( IMPORTING p_source = rt_source EXCEPTIONS object_invalid = 1 template_deleted = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Error from w3_api_template~get_source subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_load. cl_w3_api_template=>if_w3_api_template~load( EXPORTING p_template_name = is_name IMPORTING p_template = ri_template EXCEPTIONS object_not_existing = 1 permission_failure = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Error from if_w3_api_template~load subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_save. ii_template->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 w3_api_template~save subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_set_attributes. ii_template->set_attributes( EXPORTING p_attributes = is_attr 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 w3_api_template~set_attributes subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_set_changeable. ii_template->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 w3_api_template~set_changeable subrc={ sy-subrc }| ). ENDIF. ENDMETHOD. METHOD w3_api_set_source. ii_template->set_source( EXPORTING p_source = it_source 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 w3_api_template~set_source 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_template TYPE REF TO if_w3_api_template, ls_name TYPE iacikeyt. ls_name = ms_item-obj_name. li_template = w3_api_load( is_name = ls_name ). w3_api_set_changeable( ii_template = li_template iv_changeable = abap_true ). w3_api_delete( ii_template = li_template ). w3_api_save( ii_template = li_template ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: ls_attr TYPE w3tempattr, lv_source TYPE string. io_xml->read( EXPORTING iv_name = 'ATTR' CHANGING cg_data = ls_attr ). lv_source = zif_abapgit_object~mo_files->read_string( 'html' ). ls_attr-devclass = iv_package. save( is_attr = ls_attr iv_source = lv_source ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: ls_name TYPE iacikeyt. ls_name = ms_item-obj_name. cl_w3_api_template=>s_check_exist( EXPORTING p_template_name = ls_name IMPORTING p_exists = rv_bool ). 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 w3tempattr, lv_source TYPE string. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. read( IMPORTING es_attr = ls_attr ev_source = lv_source ). io_xml->add( iv_name = 'ATTR' ig_data = ls_attr ). zif_abapgit_object~mo_files->add_string( iv_ext = 'html' iv_string = lv_source ). ENDMETHOD. ENDCLASS.
25.434466
101
0.62172
4cdbaf339625eef1a70aaa8b6eaab37409bd925c
11,819
abap
ABAP
src/zaqo_editor_old_cli_opt.prog.abap
bizhuka/aqo
08af38bde14b2cb2512072a7ad5ed1d9259a8221
[ "Apache-2.0" ]
20
2018-04-03T11:02:23.000Z
2022-01-14T16:25:52.000Z
src/zaqo_editor_old_cli_opt.prog.abap
bizhuka/aqo
08af38bde14b2cb2512072a7ad5ed1d9259a8221
[ "Apache-2.0" ]
3
2019-09-12T06:24:28.000Z
2021-11-20T13:37:40.000Z
src/zaqo_editor_old_cli_opt.prog.abap
bizhuka/aqo
08af38bde14b2cb2512072a7ad5ed1d9259a8221
[ "Apache-2.0" ]
9
2018-04-18T16:08:30.000Z
2021-05-17T17:22:23.000Z
*&---------------------------------------------------------------------* *&---------------------------------------------------------------------* CLASS lcl_opt IMPLEMENTATION. METHOD initialization. " se38 or se80 (todo ZAQO_EDITOR) IF sy-tcode CP 'SE*'. zcx_aqo_exception=>raise_dump( iv_message = 'Please use ZAQO* transactions instead!'(ms2) ). ENDIF. " Mandt is open mv_is_dev = zcl_aqo_helper=>is_dev_mandt( ). " Button IN DEV CREATE OBJECT mo_odocu. DATA lv_command TYPE syucomm. GET PARAMETER ID: 'ZAQO_PACKAGE_ID' FIELD p_pack, 'ZAQO_OPTION_ID' FIELD p_opt_id, 'ZAQO_COMMAND' FIELD lv_command. " 1 time only SET PARAMETER ID 'ZAQO_COMMAND' FIELD ''. CHECK p_pack IS NOT INITIAL AND p_opt_id IS NOT INITIAL. pai( CHANGING cv_cmd = lv_command ). ENDMETHOD. METHOD pbo. CONSTANTS: c_ui_app TYPE sy-cprog VALUE 'SAPLZFG_EUI_SCREEN'. CASE sy-dynnr. WHEN 1000. IF zcl_aqo_helper=>is_in_editor( iv_is_viewer = abap_true ) = abap_true. SET TITLEBAR 'TITLE_100' OF PROGRAM c_ui_app WITH 'View option'(vop). ELSE. SET TITLEBAR 'TITLE_100' OF PROGRAM c_ui_app WITH 'Edit option'(eop). ENDIF. WHEN OTHERS. ENDCASE. ENDMETHOD. METHOD pai. DATA: lo_err TYPE REF TO zcx_aqo_exception. " Change menu mo_eui_menu = zcl_aqo_option=>get_menu( iv_package_id = p_pack iv_option_id = p_opt_id ). TRY. CASE cv_cmd. WHEN 'SAVE'. do_save( ). WHEN mc_action-new_option. start_of_selection( mc_action-new_option ). WHEN OTHERS. RETURN. ENDCASE. CATCH zcx_aqo_exception INTO lo_err. MESSAGE lo_err TYPE 'S' DISPLAY LIKE 'E'. ENDTRY. CLEAR cv_cmd. ENDMETHOD. METHOD start_of_selection. mo_odocu->hide_button( ). " Try to create DATA lo_err TYPE REF TO zcx_aqo_exception. TRY. mo_option = zcl_aqo_option=>create( iv_package_id = p_pack iv_option_id = p_opt_id ). CATCH zcx_aqo_exception INTO lo_err. MESSAGE lo_err TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDTRY. IF mo_option->lock( ) <> abap_true. mv_read_only = abap_true. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno DISPLAY LIKE 'E' WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. " Just show values IF zcl_aqo_helper=>is_in_editor( iv_is_viewer = abap_true ) = abap_true. mv_read_only = abap_true. ENDIF. fill_fields( ). find_f4_tables( ). launch_action( iv_action ). ENDMETHOD. METHOD fill_fields. " Create new table CLEAR mt_fld_value. DATA lt_skip_field TYPE stringtab. DATA ls_field_value TYPE REF TO zcl_aqo_helper=>ts_field_value. DATA lo_err TYPE REF TO zcx_aqo_exception. LOOP AT mo_option->mt_field_value REFERENCE INTO ls_field_value. TRY. add_one_field( ls_field_value->* ). CATCH zcx_aqo_exception INTO lo_err. APPEND ls_field_value->name TO lt_skip_field. MESSAGE lo_err TYPE 'I'. ENDTRY. ENDLOOP. " Any error during importing? CHECK lt_skip_field IS NOT INITIAL. DATA lv_fields TYPE string. CONCATENATE LINES OF lt_skip_field INTO lv_fields SEPARATED BY `, `. MESSAGE s040(zaqo_message) WITH lv_fields DISPLAY LIKE 'E'. ENDMETHOD. METHOD find_f4_tables. DATA ls_field_value TYPE REF TO zcl_aqo_helper=>ts_field_value. LOOP AT mo_option->mt_field_value REFERENCE INTO ls_field_value WHERE ui_type = zcl_eui_type=>mc_ui_type-table AND ( table_kind = cl_abap_tabledescr=>tablekind_sorted OR table_kind = cl_abap_tabledescr=>tablekind_hashed ) AND key_defkind = cl_abap_tabledescr=>keydefkind_user AND unique = abap_true. "#EC CI_HASHSEQ " Only for relations 1 - 1 CHECK lines( ls_field_value->key[] ) = 1. DATA lr_ft_table TYPE REF TO lvc_s_dral. APPEND INITIAL LINE TO mt_f4_tables REFERENCE INTO lr_ft_table. lr_ft_table->handle = 154. lr_ft_table->int_value = ls_field_value->name. CONCATENATE ls_field_value->name ` - ` ls_field_value->label INTO lr_ft_table->value. ENDLOOP. ENDMETHOD. METHOD launch_action. " Choose action DATA lv_action LIKE iv_action. lv_action = iv_action. IF lv_action IS INITIAL. CASE mv_is_dev. WHEN abap_true. lv_action = mc_action-tech_view. " Show immediately values WHEN abap_false. lv_action = mc_action-edit_values. ENDCASE. ENDIF. " Create new option IF lv_action = mc_action-new_option. lv_action = mc_action-tech_view. MESSAGE 'Create new option'(crt) TYPE 'S'. " Is not new ? IF mo_option->ms_db_item-fields IS NOT INITIAL. MESSAGE 'Option already exist'(oae) TYPE 'S' DISPLAY LIKE 'E'. ENDIF. ENDIF. " Decide what to do DATA lo_fld_value_alv TYPE REF TO lcl_fld_value_alv. lo_fld_value_alv = lcl_fld_value_alv=>get_instance( ). CASE lv_action. WHEN mc_action-tech_view. lo_fld_value_alv->call_screen( ). WHEN mc_action-edit_values. IF mo_option->ms_db_item-fields IS INITIAL. MESSAGE 'Option do not exist'(odn) TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDIF. " Custom checks CHECK lo_fld_value_alv->data_check( ) = abap_true. lo_fld_value_alv->sel_screen_show( ). ENDCASE. ENDMETHOD. METHOD add_one_field. " Get current value DATA lr_value TYPE REF TO data. IF ir_data IS NOT INITIAL. lr_value = ir_data. ELSE. lr_value = mo_option->get_field_value( is_field_value-name ). ENDIF. DATA ls_fld_value TYPE REF TO ts_fld_value. " Paste new data APPEND INITIAL LINE TO mt_fld_value REFERENCE INTO ls_fld_value. MOVE-CORRESPONDING is_field_value TO ls_fld_value->*. ls_fld_value->cur_value = lr_value. " Quick edit for all type of fields ls_fld_value->value_button = icon_display_more. set_icons( EXPORTING iv_ui_type = ls_fld_value->ui_type IMPORTING ev_icon = ls_fld_value->icon ev_catalog = ls_fld_value->catalog ). " Show history IF lines( ls_fld_value->value ) > 1. ls_fld_value->history_logs = icon_protocol. ENDIF. ENDMETHOD. METHOD set_icons. CLEAR: ev_icon, ev_catalog. CASE iv_ui_type. WHEN zcl_eui_type=>mc_ui_type-string. ev_icon = icon_change_text. WHEN zcl_eui_type=>mc_ui_type-range. ev_icon = icon_interval_include_green. WHEN zcl_eui_type=>mc_ui_type-table. ev_icon = icon_wd_table. ev_catalog = icon_catalog. " <--- show field catalog WHEN OTHERS. ev_icon = icon_equal_green. ENDCASE. ENDMETHOD. METHOD is_editable. CHECK mv_read_only <> abap_true AND iv_editable <> abap_undefined. IF iv_editable = abap_true OR mv_is_dev = abap_true. rv_editable = abap_true. ENDIF. ENDMETHOD. METHOD do_save. DATA: ls_fld_value TYPE REF TO lcl_opt=>ts_fld_value, ls_field_value TYPE zcl_aqo_helper=>ts_field_value, lo_err TYPE REF TO zcx_aqo_exception, lv_new_value TYPE string, lv_info TYPE string. FIELD-SYMBOLS: <lv_value> TYPE any. " IF locked by another user CHECK lcl_opt=>mv_read_only <> abap_true. CLEAR mo_option->mt_field_value. LOOP AT mt_fld_value REFERENCE INTO ls_fld_value. CLEAR ls_field_value. MOVE-CORRESPONDING ls_fld_value->* TO ls_field_value. " As JSON string ASSIGN ls_fld_value->cur_value->* TO <lv_value>. lv_new_value = zcl_eui_conv=>to_json( <lv_value> ). " Add new value mo_option->add_history_value( EXPORTING iv_value = lv_new_value CHANGING cs_field_value = ls_field_value ). INSERT ls_field_value INTO TABLE mo_option->mt_field_value. ENDLOOP. TRY. lv_info = mo_option->save( ). IF lv_info IS NOT INITIAL. MESSAGE lv_info TYPE 'S'. ENDIF. CATCH zcx_aqo_exception INTO lo_err. MESSAGE lo_err TYPE 'S' DISPLAY LIKE 'E'. ENDTRY. ENDMETHOD. METHOD on_f4. " Show SH DATA lt_ret TYPE STANDARD TABLE OF ddshretval. CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST' EXPORTING tabname = '' " No need returns all fields in SH exit "#EC NOTEXT fieldname = '' "#EC NOTEXT searchhelp = 'ZHAQO_OPTION' "#EC NOTEXT dynpprog = sy-repid dynpnr = sy-dynnr TABLES return_tab = lt_ret EXCEPTIONS OTHERS = 5. CHECK sy-subrc = 0. " UI fields DATA lt_dynp TYPE STANDARD TABLE OF dynpread. DATA ls_dynp TYPE REF TO dynpread. " Write back DATA ls_ret TYPE REF TO ddshretval. LOOP AT lt_ret REFERENCE INTO ls_ret WHERE fieldname = 'PACKAGE_ID' OR fieldname = 'OPTION_ID'. " Update 2 fields APPEND INITIAL LINE TO lt_dynp REFERENCE INTO ls_dynp. ls_dynp->fieldvalue = ls_ret->fieldval. CASE ls_ret->fieldname. WHEN 'PACKAGE_ID'. "#EC NOTEXT p_pack = ls_ret->fieldval. SET PARAMETER ID 'ZAQO_PACKAGE_ID' FIELD ls_ret->fieldval. ls_dynp->fieldname = 'P_PACK'. WHEN 'OPTION_ID'. "#EC NOTEXT p_opt_id = ls_ret->fieldval. SET PARAMETER ID 'ZAQO_OPTION_ID' FIELD ls_ret->fieldval. ls_dynp->fieldname = 'P_OPT_ID'. ENDCASE. ENDLOOP. " Update both fields CALL FUNCTION 'DYNP_VALUES_UPDATE' EXPORTING dyname = sy-cprog dynumb = sy-dynnr TABLES dynpfields = lt_dynp. ENDMETHOD. METHOD code_scan_f4. MESSAGE 'Check existence of option by code scanning. For search help use upper field!'(ms1) TYPE 'S' DISPLAY LIKE 'W'. " Read from memory GET PARAMETER ID 'ZAQO_PACKAGE_ID' FIELD p_pack. GET PARAMETER ID 'ZAQO_OPTION_ID' FIELD p_opt_id. CHECK p_pack IS NOT INITIAL AND p_opt_id IS NOT INITIAL. " All usage DATA lt_usage TYPE zcl_aqo_helper=>tt_usage. lt_usage = zcl_aqo_helper=>get_usage( ). DATA lt_return TYPE STANDARD TABLE OF ddshretval. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'INDEX' dynpprog = sy-repid dynpnr = sy-dynnr value_org = 'S' TABLES value_tab = lt_usage return_tab = lt_return EXCEPTIONS OTHERS = 3. CHECK sy-subrc = 0 AND lt_return[] IS NOT INITIAL. DATA lr_return TYPE REF TO ddshretval. READ TABLE lt_return REFERENCE INTO lr_return INDEX 1. CHECK sy-subrc = 0. DATA ls_usage TYPE zcl_aqo_helper=>ts_usage. READ TABLE lt_usage INTO ls_usage INDEX 1. IF ls_usage-include IS INITIAL OR ls_usage-line IS INITIAL. MESSAGE s015(zaqo_message) DISPLAY LIKE 'E'. RETURN. ENDIF. " Drilldown zcl_aqo_helper=>navigate_to( iv_include = ls_usage-include iv_position = ls_usage-line ). ENDMETHOD. METHOD set_menu_visible. CHECK mo_eui_menu IS NOT INITIAL. DATA lo_container TYPE REF TO cl_gui_container. lo_container = mo_eui_menu->get_container( ). CHECK lo_container IS NOT INITIAL. lo_container->set_visible( iv_visible ). ENDMETHOD. ENDCLASS. "LCL_MAIN IMPLEMENTATION
29.84596
122
0.632118
4cdc38887611d71670df990562d92c34f4c3d61d
8,862
abap
ABAP
src/zcl_eui_file_io.clas.locals_imp.abap
monty79/eui
f96152d0ddd72b45f63b040d5ab5ac334399d33d
[ "Apache-2.0" ]
null
null
null
src/zcl_eui_file_io.clas.locals_imp.abap
monty79/eui
f96152d0ddd72b45f63b040d5ab5ac334399d33d
[ "Apache-2.0" ]
null
null
null
src/zcl_eui_file_io.clas.locals_imp.abap
monty79/eui
f96152d0ddd72b45f63b040d5ab5ac334399d33d
[ "Apache-2.0" ]
null
null
null
*"* use this source file for the definition and implementation of *"* local helper classes, interface definitions and type *"* declarations CLASS lcl_helper IMPLEMENTATION. METHOD fill_mapping. DATA: lt_fieldcat LIKE et_fieldcat, ls_excel_map TYPE zcl_eui_file_io=>ts_excel_map. FIELD-SYMBOLS: <lt_excel_map> TYPE zcl_eui_file_io=>tt_excel_map, <ls_excel_map> TYPE zcl_eui_file_io=>ts_excel_map, <ls_fieldcat> TYPE lvc_s_fcat. " Use exiting IF ir_excel_map IS NOT INITIAL. er_excel_map = ir_excel_map. ELSE. " New mapping CREATE DATA er_excel_map. ENDIF. " Main mapping ASSIGN er_excel_map->* TO <lt_excel_map>. " Detect fm for conversion exit lt_fieldcat = zcl_eui_type=>get_catalog( ir_table = ir_table ). CLEAR et_fieldcat. " No mapping IF <lt_excel_map> IS INITIAL. LOOP AT lt_fieldcat ASSIGNING <ls_fieldcat>. ls_excel_map-field = <ls_fieldcat>-fieldname. ls_excel_map-column_index = sy-tabix. APPEND ls_excel_map TO <lt_excel_map>. ENDLOOP. ENDIF. " Fill fm & gen type SORT lt_fieldcat BY fieldname. LOOP AT <lt_excel_map> ASSIGNING <ls_excel_map>. " If not in catalog skip it READ TABLE lt_fieldcat ASSIGNING <ls_fieldcat> BINARY SEARCH WITH KEY fieldname = <ls_excel_map>-field. IF sy-subrc <> 0. <ls_excel_map>-gen_type = mc_gen_type-skip. CONTINUE. ENDIF. " For export to excel IF et_fieldcat IS REQUESTED. APPEND <ls_fieldcat> TO et_fieldcat. ENDIF. " Only if not supplied IF <ls_excel_map>-column_index IS INITIAL. <ls_excel_map>-column_index = zcl_eui_file_io=>column_2_int( <ls_excel_map>-column_name ). ENDIF. " Detect conversion Exit <ls_excel_map>-fm = <ls_fieldcat>-edit_mask. CASE <ls_fieldcat>-inttype. WHEN cl_abap_typedescr=>typekind_packed OR cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_num OR cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2 OR cl_abap_typedescr=>typekind_numeric OR '/' OR 'a' or 'E'. " sync with ZCL_XTT_REPLACE_BLOCK->TREE_INITIALIZE() "cl_abap_typedescr=>typekind_decfloat OR "cl_abap_typedescr=>typekind_decfloat16 OR "cl_abap_typedescr=>typekind_decfloat34. <ls_excel_map>-gen_type = mc_gen_type-number. WHEN cl_abap_typedescr=>typekind_date. <ls_excel_map>-gen_type = mc_gen_type-date. WHEN cl_abap_typedescr=>typekind_time. <ls_excel_map>-gen_type = mc_gen_type-time. WHEN cl_abap_typedescr=>typekind_table. " xstring? ENDCASE. " Get FM name IF <ls_excel_map>-fm IS NOT INITIAL. REPLACE `==` IN <ls_excel_map>-fm WITH ``. CONCATENATE 'CONVERSION_EXIT_' <ls_excel_map>-fm '_INPUT' INTO <ls_excel_map>-fm. ENDIF. ENDLOOP. " delete table fields only DELETE <lt_excel_map> WHERE gen_type = lcl_helper=>mc_gen_type-skip. ENDMETHOD. METHOD export_2_table. DATA lo_event_caller TYPE REF TO zcl_eui_event_caller. DATA lv_has_handler TYPE abap_bool. DATA lv_row TYPE sy-tabix. DATA lo_error TYPE REF TO cx_root. DATA lv_error_message TYPE text255. DATA lv_message TYPE text255. DATA lv_input TYPE text1000. DATA lr_value TYPE REF TO data. DATA lr_row TYPE REF TO data. FIELD-SYMBOLS <lt_table> TYPE STANDARD TABLE. FIELD-SYMBOLS <lt_source> TYPE STANDARD TABLE. FIELD-SYMBOLS <ls_row> TYPE any. FIELD-SYMBOLS <ls_excel_map> TYPE zcl_eui_file_io=>ts_excel_map. FIELD-SYMBOLS <lv_src> TYPE any. FIELD-SYMBOLS <lv_dest> TYPE any. FIELD-SYMBOLS <ls_import> TYPE any. " Ref to table ASSIGN ir_source->* TO <lt_source>. " Have any data? IF <lt_source> IS INITIAL. MESSAGE s003(zeui_message) WITH io_file->mv_file_name INTO sy-msgli. zcx_eui_exception=>raise_sys_error( ). ENDIF. " If have some errors DO 1 TIMES. CHECK io_handler IS NOT INITIAL. " Send events to IO_HANDLER CREATE OBJECT lo_event_caller. lo_event_caller->add_handler( io_handler = io_handler ). " Is ok ? lv_has_handler = lo_event_caller->has_handler( iv_of_class = 'ZCL_EUI_FILE_IO' iv_for_event = 'MAPPING_ERROR' ). CHECK lv_has_handler <> abap_true. " Cannot call CLEAR lo_event_caller. ENDDO. " Add one by one ASSIGN ir_table->* TO <lt_table>. CLEAR <lt_table>. LOOP AT <lt_source> ASSIGNING <ls_import> FROM iv_row_from. lv_row = sy-tabix. " New row APPEND INITIAL LINE TO <lt_table> ASSIGNING <ls_row>. " Fill items LOOP AT ir_excel_map->* ASSIGNING <ls_excel_map>. UNASSIGN: <lv_src>, <lv_dest>. ASSIGN COMPONENT: <ls_excel_map>-column_index OF STRUCTURE <ls_import> TO <lv_src>, <ls_excel_map>-field OF STRUCTURE <ls_row> TO <lv_dest>. " Oops IF <lv_src> IS NOT ASSIGNED. MESSAGE s005(zeui_message) WITH <ls_excel_map>-column_name <ls_excel_map>-column_index io_file->mv_file_name INTO sy-msgli. zcx_eui_exception=>raise_sys_error( ). ENDIF. " Sometimes have leading spaces lv_input = <lv_src>. CONDENSE lv_input. IF <lv_dest> IS NOT ASSIGNED. MESSAGE s006(zeui_message) WITH <ls_excel_map>-field INTO sy-msgli. zcx_eui_exception=>raise_sys_error( ). ENDIF. " No errors CLEAR lo_error. TRY. IF <ls_excel_map>-fm IS NOT INITIAL. " Try to convert CALL FUNCTION <ls_excel_map>-fm EXPORTING input = lv_input IMPORTING output = <lv_dest> EXCEPTIONS error_message = 1 OTHERS = 2. ELSE. CASE <ls_excel_map>-gen_type. WHEN lcl_helper=>mc_gen_type-number. REPLACE FIRST OCCURRENCE OF ',' IN lv_input WITH '.'. CONDENSE lv_input NO-GAPS. <lv_dest> = lv_input. sy-subrc = 0. WHEN lcl_helper=>mc_gen_type-time. REPLACE ALL OCCURRENCES OF `:` IN lv_input WITH ``. CONCATENATE lv_input+0(2) lv_input+2(2) lv_input+4(2) INTO <lv_dest>. sy-subrc = 0. WHEN lcl_helper=>mc_gen_type-date. CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL' EXPORTING date_external = lv_input IMPORTING date_internal = <lv_dest> EXCEPTIONS error_message = 1 OTHERS = 2. WHEN OTHERS. <lv_dest> = lv_input. sy-subrc = 0. ENDCASE. ENDIF. " Just create own exception CHECK sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_error_message. zcx_eui_exception=>raise_sys_error( iv_message = lv_error_message ). CATCH cx_root INTO lo_error. ENDTRY. " All ok ? CHECK lo_error IS NOT INITIAL. " if have no handlers then dump IF lo_event_caller IS INITIAL. zcx_eui_exception=>raise_dump( io_error = lo_error ). ENDIF. " Send event to handler GET REFERENCE OF <lv_dest> INTO lr_value. GET REFERENCE OF <ls_row> INTO lr_row. lo_event_caller->call_handlers( iv_of_class = 'ZCL_EUI_FILE_IO' iv_for_event = 'MAPPING_ERROR' iv_param_nam_00 = 'SENDER' iv_param_val_00 = io_file iv_param_nam_01 = 'IV_SOURCE' iv_param_val_01 = <lv_src> iv_param_nam_02 = 'IV_ROW' iv_param_val_02 = lv_row iv_param_nam_03 = 'IS_EXCEL_MAP' iv_param_val_03 = <ls_excel_map> iv_param_nam_04 = 'IO_ERROR' iv_param_val_04 = lo_error iv_param_nam_05 = 'CV_VALUE' iv_param_val_05 = lr_value iv_param_nam_06 = 'CS_ROW' iv_param_val_06 = lr_row ). * RAISE EVENT mapping_error EXPORTING * IV_SOURCE = <lv_src> * IV_ROW = lv_row * IS_EXCEL_MAP = <ls_excel_map> * IO_ERROR = lo_error * CV_VALUE = lr_value * CS_ROW = lr_row. ENDLOOP. ENDLOOP. ENDMETHOD. ENDCLASS.
34.348837
133
0.607876
4ce1cb5e40b10a079af0e745046f91b42ae15224
10,080
abap
ABAP
src/ui/zcl_abapgit_gui_page.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
13
2021-12-01T10:05:18.000Z
2022-03-01T10:03:40.000Z
src/ui/zcl_abapgit_gui_page.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page DEFINITION PUBLIC ABSTRACT INHERITING FROM zcl_abapgit_gui_component CREATE PUBLIC. PUBLIC SECTION. INTERFACES: zif_abapgit_gui_renderable, zif_abapgit_gui_event_handler, zif_abapgit_gui_error_handler. METHODS: constructor RAISING zcx_abapgit_exception. PROTECTED SECTION. CONSTANTS: BEGIN OF c_page_layout, centered TYPE string VALUE `centered`, full_width TYPE string VALUE `full_width`, END OF c_page_layout. TYPES: BEGIN OF ty_control, page_layout TYPE string, page_title TYPE string, page_menu TYPE REF TO zcl_abapgit_html_toolbar, END OF ty_control . DATA ms_control TYPE ty_control . METHODS render_content ABSTRACT RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . PRIVATE SECTION. TYPES: ty_time TYPE p LENGTH 10 DECIMALS 2. DATA mo_settings TYPE REF TO zcl_abapgit_settings . DATA mx_error TYPE REF TO zcx_abapgit_exception . DATA mo_exception_viewer TYPE REF TO zcl_abapgit_exception_viewer . METHODS render_deferred_parts IMPORTING !ii_html TYPE REF TO zif_abapgit_html !iv_part_category TYPE string RAISING zcx_abapgit_exception . METHODS html_head RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS title RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS footer IMPORTING !iv_time TYPE ty_time RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_link_hints IMPORTING !ii_html TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_command_palettes IMPORTING !ii_html TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_hotkey_overview RETURNING VALUE(ro_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_error_message_box RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS scripts RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . ENDCLASS. CLASS zcl_abapgit_gui_page IMPLEMENTATION. METHOD constructor. super->constructor( ). mo_settings = zcl_abapgit_persist_factory=>get_settings( )->read( ). ms_control-page_layout = c_page_layout-centered. ENDMETHOD. METHOD footer. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="footer">' ). ri_html->add( '<table class="w100"><tr>' ). ri_html->add( '<td class="w40"></td>' ). " spacer ri_html->add( '<td class="center">' ). ri_html->add( '<div class="logo">' ). ri_html->add( ri_html->icon( 'git-alt' ) ). ri_html->add( ri_html->icon( iv_name = 'abapgit' iv_hint = |{ iv_time } sec| ) ). ri_html->add( '</div>' ). ri_html->add( |<div class="version">{ zif_abapgit_version=>c_abap_version }</div>| ). ri_html->add( '</td>' ). ri_html->add( '<td id="debug-output" class="w40"></td>' ). ri_html->add( '</tr></table>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD html_head. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<head>' ). ri_html->add( '<meta http-equiv="content-type" content="text/html; charset=utf-8">' ). ri_html->add( '<meta http-equiv="X-UA-Compatible" content="IE=11,10,9,8" />' ). ri_html->add( '<title>abapGit</title>' ). ri_html->add( '<link rel="stylesheet" type="text/css" href="css/common.css">' ). ri_html->add( '<link rel="stylesheet" type="text/css" href="css/ag-icons.css">' ). " Themes ri_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-default.css">' ). " Theme basis CASE mo_settings->get_ui_theme( ). WHEN zcl_abapgit_settings=>c_ui_theme-dark. ri_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-dark.css">' ). WHEN zcl_abapgit_settings=>c_ui_theme-belize. ri_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-belize-blue.css">' ). ENDCASE. ri_html->add( '<script src="js/common.js"></script>' ). CASE mo_settings->get_icon_scaling( ). " Enforce icon scaling WHEN mo_settings->c_icon_scaling-large. ri_html->add( '<style>.icon { font-size: 200% }</style>' ). WHEN mo_settings->c_icon_scaling-small. ri_html->add( '<style>.icon.large { font-size: inherit }</style>' ). ENDCASE. ri_html->add( '</head>' ). ENDMETHOD. METHOD render_command_palettes. ii_html->add( 'var gCommandPalette = new CommandPalette(enumerateToolbarActions, {' ). ii_html->add( ' toggleKey: "F1",' ). ii_html->add( ' hotkeyDescription: "Command ..."' ). ii_html->add( '});' ). ENDMETHOD. METHOD render_deferred_parts. DATA lt_parts TYPE zif_abapgit_html=>ty_table_of. DATA li_part LIKE LINE OF lt_parts. lt_parts = gui_services( )->get_html_parts( )->get_parts( iv_part_category ). LOOP AT lt_parts INTO li_part. ii_html->add( li_part ). ENDLOOP. ENDMETHOD. METHOD render_error_message_box. " You should remember that the we have to instantiate ro_html even " it's overwritten further down. Because ADD checks whether it's " bound. CREATE OBJECT ri_html TYPE zcl_abapgit_html. " You should remember that we render the message panel only " if we have an error. IF mx_error IS NOT BOUND. RETURN. ENDIF. ri_html = zcl_abapgit_gui_chunk_lib=>render_error_message_box( mx_error ). " You should remember that the exception viewer dispatches the events of " error message panel CREATE OBJECT mo_exception_viewer EXPORTING ix_error = mx_error. " You should remember that we render the message panel just once " for each exception/error text. CLEAR: mx_error. ENDMETHOD. METHOD render_hotkey_overview. DATA lo_hotkeys_component TYPE REF TO zif_abapgit_gui_renderable. lo_hotkeys_component ?= gui_services( )->get_hotkeys_ctl( ). " Mmmm ... ro_html = lo_hotkeys_component->render( ). ENDMETHOD. METHOD render_link_hints. DATA: lv_link_hint_key TYPE c LENGTH 1. lv_link_hint_key = mo_settings->get_link_hint_key( ). IF mo_settings->get_link_hints_enabled( ) = abap_true AND lv_link_hint_key IS NOT INITIAL. ii_html->add( |activateLinkHints("{ lv_link_hint_key }");| ). ii_html->add( |setInitialFocusWithQuerySelector('a span', true);| ). ii_html->add( |enableArrowListNavigation();| ). ENDIF. ENDMETHOD. METHOD scripts. CREATE OBJECT ri_html TYPE zcl_abapgit_html. render_deferred_parts( ii_html = ri_html iv_part_category = c_html_parts-scripts ). render_link_hints( ri_html ). render_command_palettes( ri_html ). ENDMETHOD. METHOD title. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="header">' ). ri_html->add( '<div class="logo">' ). ri_html->add( ri_html->icon( 'git-alt' ) ). ri_html->add( ri_html->icon( 'abapgit' ) ). ri_html->add( '</div>' ). ri_html->add( |<div class="page-title"><span class="spacer">&#x25BA;</span>{ ms_control-page_title }</div>| ). IF ms_control-page_menu IS BOUND. ri_html->add( '<div class="float-right">' ). ri_html->add( ms_control-page_menu->render( iv_right = abap_true ) ). ri_html->add( '</div>' ). ENDIF. ri_html->add( '</div>' ). ENDMETHOD. METHOD zif_abapgit_gui_error_handler~handle_error. mx_error = ix_error. rv_handled = abap_true. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-goto_source. IF mo_exception_viewer IS BOUND. mo_exception_viewer->goto_source( ). ENDIF. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-show_callstack. IF mo_exception_viewer IS BOUND. mo_exception_viewer->show_callstack( ). ENDIF. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-goto_message. IF mo_exception_viewer IS BOUND. mo_exception_viewer->goto_message( ). ENDIF. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. DATA: li_script TYPE REF TO zif_abapgit_html, lv_start TYPE i, lv_end TYPE i, lv_total TYPE ty_time. gui_services( )->register_event_handler( me ). GET RUN TIME FIELD lv_start. " Real page CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<!DOCTYPE html>' ). ri_html->add( '<html lang="en">' ). ri_html->add( html_head( ) ). ri_html->add( |<body class="{ ms_control-page_layout }">| ). ri_html->add( title( ) ). ri_html->add( '<div class="not_sticky">' ). ri_html->add( render_content( ) ). " TODO -> render child ri_html->add( render_hotkey_overview( ) ). ri_html->add( render_error_message_box( ) ). render_deferred_parts( ii_html = ri_html iv_part_category = c_html_parts-hidden_forms ). GET RUN TIME FIELD lv_end. lv_total = ( lv_end - lv_start ) / 1000 / 1000. ri_html->add( footer( lv_total ) ). ri_html->add( '</div>' ). li_script = scripts( ). IF li_script IS BOUND AND li_script->is_empty( ) = abap_false. ri_html->add( '<script>' ). ri_html->add( li_script ). ri_html->add( 'confirmInitialized();' ). ri_html->add( '</script>' ). ENDIF. ri_html->add( '</body>' ). ri_html->add( '</html>' ). ENDMETHOD. ENDCLASS.
27.024129
114
0.658829
4ce1eaa602e361c6d4275ef87910543819644de7
4,287
abap
ABAP
lbn-gtt-template-ts/abap/zsrc/zsst_gtt.fugr.zsst_gtt_ee_fo_load_start.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-ts/abap/zsrc/zsst_gtt.fugr.zsst_gtt_ee_fo_load_start.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-ts/abap/zsrc/zsst_gtt.fugr.zsst_gtt_ee_fo_load_start.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
FUNCTION zsst_gtt_ee_fo_load_start. *"---------------------------------------------------------------------- *"*"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 *"---------------------------------------------------------------------- CALL FUNCTION '/SCMTMS/EXTR_EVT_TO_LB' EXPORTING i_appsys = i_appsys i_event_type = i_event_type i_all_appl_tables = i_all_appl_tables i_event_type_cntl_tabs = i_event_type_cntl_tabs i_events = i_events TABLES ct_trackingheader = ct_trackingheader ct_tracklocation = ct_tracklocation ct_trackaddress = ct_trackaddress CHANGING c_eventid_map = c_eventid_map EXCEPTIONS parameter_error = 1 event_data_error = 2 stop_processing = 3 OTHERS = 4. CASE sy-subrc. WHEN 1. RAISE parameter_error. WHEN 2. RAISE event_data_error. WHEN 3. RAISE stop_processing. ENDCASE. TRY. LOOP AT i_events ASSIGNING FIELD-SYMBOL(<ls_event>). NEW lcl_actual_event( )->get_tor_actual_event_class( <ls_event> )->adjust_ae_location_data( EXPORTING i_all_appl_tables = i_all_appl_tables iv_event_code = /scmtms/if_tor_const=>sc_tor_event-load_begin i_event = <ls_event> CHANGING ct_trackingheader = ct_trackingheader[] ct_tracklocation = ct_tracklocation[] ct_trackparameters = ct_trackparameters[] ). ENDLOOP. CATCH cx_udm_message INTO DATA(lo_udm_message). lcl_tools=>get_errors_log( EXPORTING io_umd_message = lo_udm_message iv_appsys = i_appsys IMPORTING es_bapiret = DATA(ls_bapiret) ). APPEND ls_bapiret TO ct_logtable. RAISE stop_processing. ENDTRY. ENDFUNCTION.
38.972727
99
0.661768
4ce58fa369c588b12b08a0c7e84487ae12d6b989
1,570
abap
ABAP
src/FUNCTION Z_SYNC_PERS_LREP_REMOTE.abap
SAP/abap-fiori-launchpad-pers-sync
40acc2770f62ef6b59ee9a00044c72394dee096b
[ "Adobe-2006" ]
4
2019-01-15T15:15:44.000Z
2019-10-26T09:25:42.000Z
src/FUNCTION Z_SYNC_PERS_LREP_REMOTE.abap
SAP-samples/abap-fiori-launchpad-pers-sync
40acc2770f62ef6b59ee9a00044c72394dee096b
[ "Adobe-2006" ]
null
null
null
src/FUNCTION Z_SYNC_PERS_LREP_REMOTE.abap
SAP-samples/abap-fiori-launchpad-pers-sync
40acc2770f62ef6b59ee9a00044c72394dee096b
[ "Adobe-2006" ]
null
null
null
function Z_SYNC_PERS_LREP_REMOTE. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(IS_CONTENT_ID) TYPE /UIF/LREP_CONT_ID OPTIONAL *" VALUE(IV_PACKAGE) TYPE DEVCLASS OPTIONAL *" VALUE(IV_TRKORR) TYPE TRKORR OPTIONAL *" VALUE(IV_CONTENT) TYPE /UIF/LREP_CONTENT OPTIONAL *" VALUE(IS_FILE_ID) TYPE /UIF/LREP_FILE_ID OPTIONAL *" VALUE(IV_LAYER_TYPE) TYPE /UIF/LREP_LAYER_TYPE OPTIONAL *" EXCEPTIONS *" ERROR_OCCURRED *"---------------------------------------------------------------------- * Deletes or creates/updates LREP personalization in target system *"-------------------------------------------------------------------- data: lv_result_content type /uif/lrep_content. data: eo_lrep_api type ref to /uif/cl_lrep_api. create object eo_lrep_api type /uif/cl_lrep_api. IF IS_FILE_ID IS NOT INITIAL. *DELETE eo_lrep_api->delete_content( exporting is_file_id = is_file_id iv_layer_type = iv_layer_type iv_trkorr = iv_trkorr iv_synchronous_update = abap_true ). ELSE. *CREATE, UPDATE eo_lrep_api->write_content( exporting is_cont_id = is_content_id iv_package = iv_package iv_trkorr = iv_trkorr iv_content = iv_content iv_synchronous_update = abap_true importing ev_content = lv_result_content ). ENDIF. eo_lrep_api->commit_work( ). endfunction.
32.040816
72
0.566242
4ce5d6207ac8a637edb6f9032c2810d50ed6c813
1,615
abap
ABAP
src/zcl_jak_data_out.clas.abap
FreHu/abap-platform-jak
c51f630dc78cc2d67c5aca3b660736eab3d5d099
[ "BSD-Source-Code" ]
null
null
null
src/zcl_jak_data_out.clas.abap
FreHu/abap-platform-jak
c51f630dc78cc2d67c5aca3b660736eab3d5d099
[ "BSD-Source-Code" ]
32
2021-06-16T07:16:59.000Z
2021-06-24T09:40:13.000Z
src/zcl_jak_data_out.clas.abap
SebastianWolf-SAP/abap-platform-jak
5e2f9d40480373de746a0990748e70e5a2f8ef68
[ "Apache-2.0" ]
null
null
null
CLASS zcl_jak_data_out DEFINITION PUBLIC INHERITING FROM zcl_jak_data FINAL CREATE PRIVATE. PUBLIC SECTION. INTERFACES: zif_jak_data_out. CLASS-METHODS: initialize IMPORTING i_my_data TYPE any RETURNING VALUE(r_jak_data) TYPE REF TO zif_jak_data_out. PROTECTED SECTION. PRIVATE SECTION. METHODS: constructor IMPORTING i_data TYPE any i_current_status TYPE zif_jak_data=>ty_s_jak_status. ENDCLASS. CLASS ZCL_JAK_DATA_OUT IMPLEMENTATION. METHOD constructor. super->constructor( i_current_status = i_current_status ). DATA(json_writer) = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ). CALL TRANSFORMATION id SOURCE yy = i_data RESULT XML json_writer. raw_text = cl_abap_conv_codepage=>create_in( )->convert( source = json_writer->get_output( ) ). raw_text = shift_left( val = raw_text places = 6 ). raw_text = shift_right( val = raw_text places = 1 ). ENDMETHOD. METHOD initialize. DATA status TYPE zif_jak_data=>ty_s_jak_status. status-is_valid = abap_true. r_jak_data = NEW zcl_jak_data_out( i_data = i_my_data i_current_status = status ). ENDMETHOD. METHOD zif_jak_data_out~get_json. r_json = raw_text. ENDMETHOD. METHOD zif_jak_data_out~prepare_http_response. i_http_response->set_header_field( i_name = if_web_http_header=>content_type i_value = if_web_http_header=>accept_application_json ). i_http_response->set_text( i_text = raw_text ). ENDMETHOD. ENDCLASS.
30.471698
137
0.700929
4ce6096c7b7204f9449e965a04521c45e97702b3
1,773
abap
ABAP
src/pgp/zcl_abappgp_packet_18.clas.abap
larshp/abapPGP
82cb07e17ad1c402275bb9e01f1b7bc3d1b2021f
[ "MIT" ]
5
2016-11-19T14:35:50.000Z
2022-03-16T03:09:49.000Z
src/pgp/zcl_abappgp_packet_18.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
34
2016-09-29T18:06:29.000Z
2022-01-19T06:41:02.000Z
src/pgp/zcl_abappgp_packet_18.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
3
2018-12-07T15:30:46.000Z
2021-04-13T18:38:53.000Z
CLASS zcl_abappgp_packet_18 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 constructor IMPORTING !iv_version TYPE xsequence !iv_data TYPE xstring . PROTECTED SECTION. DATA mv_version TYPE xstring . DATA mv_data TYPE xstring . PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPPGP_PACKET_18 IMPLEMENTATION. METHOD constructor. ASSERT iv_version = '01'. mv_version = iv_version. mv_data = iv_data. ENDMETHOD. METHOD zif_abappgp_packet~dump. rv_dump = |{ get_name( ) }(tag { get_tag( ) })({ to_stream( )->get_length( ) } bytes)\n\tVersion\t{ mv_version }\n\tData\t\t{ xstrlen( mv_data ) } bytes\n|. ENDMETHOD. METHOD zif_abappgp_packet~from_stream. DATA: lv_version TYPE x LENGTH 1, lv_data TYPE xstring. lv_version = io_stream->eat_octet( ). lv_data = io_stream->get_data( ). CREATE OBJECT ri_packet TYPE zcl_abappgp_packet_18 EXPORTING iv_version = lv_version iv_data = lv_data. ENDMETHOD. METHOD zif_abappgp_packet~get_name. rv_name = 'Sym. Encrypted and Integrity Protected Data Packet'(001). ENDMETHOD. METHOD zif_abappgp_packet~get_tag. rv_tag = zif_abappgp_constants=>c_tag-symmetrical_inte. ENDMETHOD. METHOD zif_abappgp_packet~to_stream. CREATE OBJECT ro_stream. ro_stream->write_octet( mv_version ). ro_stream->write_octets( mv_data ). ENDMETHOD. ENDCLASS.
18.861702
80
0.689227
4ce7ad28a2149d3ce73ef567f03448c53c61f8e3
3,151
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_event_rel_dl_hd.clas.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "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_event_rel_dl_hd.clas.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_event_rel_dl_hd.clas.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
CLASS zcl_gtt_mia_event_rel_dl_hd DEFINITION PUBLIC INHERITING FROM zcl_gtt_mia_event_rel_dl_main CREATE PUBLIC . PUBLIC SECTION. PROTECTED SECTION. METHODS get_field_name REDEFINITION . METHODS get_object_status REDEFINITION . METHODS get_old_appobjid REDEFINITION. PRIVATE SECTION. ENDCLASS. CLASS zcl_gtt_mia_event_rel_dl_hd IMPLEMENTATION. METHOD get_field_name. CASE iv_milestone. WHEN zif_gtt_mia_app_constants=>cs_milestone-dl_put_away. rv_field_name = COND #( WHEN iv_internal = abap_true THEN 'KOSTA' ELSE 'KOSTK' ). WHEN zif_gtt_mia_app_constants=>cs_milestone-dl_packing. rv_field_name = COND #( WHEN iv_internal = abap_true THEN 'PKSTA' ELSE 'PKSTK' ). WHEN zif_gtt_mia_app_constants=>cs_milestone-dl_goods_receipt. rv_field_name = COND #( WHEN iv_internal = abap_true THEN 'WBSTA' ELSE 'WBSTK' ). WHEN zif_gtt_mia_app_constants=>cs_milestone-dl_pod. rv_field_name = 'PDSTK'. WHEN OTHERS. MESSAGE e009(zgtt_mia) WITH iv_milestone INTO DATA(lv_dummy). zcl_gtt_mia_tools=>throw_exception( ). ENDCASE. IF iv_internal = abap_true. rv_field_name = |Z_{ rv_field_name }|. ENDIF. ENDMETHOD. METHOD get_object_status. * TYPES: tt_vbuk TYPE STANDARD TABLE OF vbuk. DATA: lv_dummy TYPE char100. FIELD-SYMBOLS: <lt_vbuk> TYPE shp_vl10_vbuk_t, <ls_vbuk> TYPE vbukvb, <lv_value> TYPE any. DATA(lv_fname) = get_field_name( iv_milestone = iv_milestone ). DATA(lv_vbeln) = zcl_gtt_mia_tools=>get_field_of_structure( ir_struct_data = ms_app_objects-maintabref iv_field_name = 'VBELN' ). DATA(lr_vbuk) = mo_ef_parameters->get_appl_table( iv_tabledef = zif_gtt_mia_app_constants=>cs_tabledef-dl_hdr_status_new ). CLEAR rv_value. ASSIGN lr_vbuk->* TO <lt_vbuk>. IF <lt_vbuk> IS ASSIGNED. READ TABLE <lt_vbuk> ASSIGNING <ls_vbuk> WITH KEY vbeln = lv_vbeln. IF sy-subrc = 0. ASSIGN COMPONENT lv_fname OF STRUCTURE <ls_vbuk> TO <lv_value>. IF <lv_value> IS ASSIGNED. rv_value = <lv_value>. ELSE. MESSAGE e001(zgtt_mia) WITH lv_fname 'VBUP' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ELSE. MESSAGE e005(zgtt_mia) WITH 'VBUK' lv_vbeln INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ELSE. MESSAGE e002(zgtt_mia) WITH 'VBUK' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDMETHOD. METHOD get_old_appobjid. rv_appobjid = zcl_gtt_mia_tools=>get_field_of_structure( ir_struct_data = ms_app_objects-maintabref iv_field_name = 'VBELN' ). ENDMETHOD. ENDCLASS.
28.908257
100
0.613139
4ce874776fe9bde49711eb134b207c0995a6b4b5
463
abap
ABAP
src/zabap_test_0059.prog.abap
larshp/ABAPTestSuite
afbcbaa387da13f5d9685b5cdc4d32dcda0461ed
[ "MIT" ]
null
null
null
src/zabap_test_0059.prog.abap
larshp/ABAPTestSuite
afbcbaa387da13f5d9685b5cdc4d32dcda0461ed
[ "MIT" ]
null
null
null
src/zabap_test_0059.prog.abap
larshp/ABAPTestSuite
afbcbaa387da13f5d9685b5cdc4d32dcda0461ed
[ "MIT" ]
1
2018-04-19T09:34:45.000Z
2018-04-19T09:34:45.000Z
REPORT zabap_test_0059 NO STANDARD PAGE HEADING. TYPES: BEGIN OF st_structure, foo TYPE i, bar TYPE i, END OF st_structure. DATA: lt_table TYPE TABLE OF st_structure, ls_structure TYPE st_structure. CLEAR ls_structure. ls_structure-foo = 7. ls_structure-bar = 8. APPEND ls_structure TO lt_table. CLEAR ls_structure. READ TABLE lt_table WITH KEY foo = 7 TRANSPORTING NO FIELDS. WRITE: / sy-subrc. WRITE: / ls_structure-foo.
22.047619
60
0.725702
4cee08552e0bd3fc593f9f9cc9997e8fcc67ab78
3,167
abap
ABAP
src/parsing/zcl_aoc_structure.clas.abap
D072189/abapOpenChecks
03b3ddd245b44e2409540057ca92dd036ec7b726
[ "MIT" ]
199
2015-02-17T07:08:01.000Z
2022-03-23T09:50:05.000Z
src/parsing/zcl_aoc_structure.clas.abap
D072189/abapOpenChecks
03b3ddd245b44e2409540057ca92dd036ec7b726
[ "MIT" ]
769
2015-01-03T07:09:11.000Z
2022-03-21T11:59:53.000Z
src/parsing/zcl_aoc_structure.clas.abap
D072189/abapOpenChecks
03b3ddd245b44e2409540057ca92dd036ec7b726
[ "MIT" ]
109
2015-03-09T10:22:34.000Z
2022-03-08T08:47:41.000Z
CLASS zcl_aoc_structure DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. CLASS zcl_aoc_super DEFINITION LOAD . TYPES: ty_structure_tt TYPE STANDARD TABLE OF REF TO zcl_aoc_structure WITH DEFAULT KEY . TYPES: ty_string_tt TYPE STANDARD TABLE OF string WITH DEFAULT KEY . TYPES: BEGIN OF ty_statement, statement TYPE string, level TYPE level_levl, row TYPE token_row, END OF ty_statement . CLASS-METHODS to_string IMPORTING !io_structure TYPE REF TO zcl_aoc_structure RETURNING VALUE(rt_string) TYPE ty_string_tt . CLASS-METHODS to_string_simple IMPORTING !io_structure TYPE REF TO zcl_aoc_structure RETURNING VALUE(rv_string) TYPE string . CLASS-METHODS build IMPORTING !it_tokens TYPE stokesx_tab !it_statements TYPE sstmnt_tab !it_structures TYPE zcl_aoc_super=>ty_structures_tt RETURNING VALUE(ro_structure) TYPE REF TO zcl_aoc_structure . METHODS get_statement RETURNING VALUE(rs_statement) TYPE ty_statement . METHODS get_structure RETURNING VALUE(rt_structure) TYPE ty_structure_tt . METHODS get_type RETURNING VALUE(rv_type) TYPE stru_type . PROTECTED SECTION. DATA mv_stmnt_type TYPE stru_type . DATA mt_structure TYPE ty_structure_tt . DATA ms_statement TYPE ty_statement . DATA mv_type TYPE stru_type . PRIVATE SECTION. ENDCLASS. CLASS ZCL_AOC_STRUCTURE IMPLEMENTATION. METHOD build. DATA: lo_build TYPE REF TO lcl_build. CREATE OBJECT lo_build EXPORTING it_tokens = it_tokens it_statements = it_statements it_structures = it_structures. ro_structure = lo_build->build( ). ro_structure = lcl_simplify=>simplify( ro_structure ). ENDMETHOD. METHOD get_statement. rs_statement = ms_statement. ENDMETHOD. METHOD get_structure. rt_structure = mt_structure. ENDMETHOD. METHOD get_type. rv_type = mv_stmnt_type. ENDMETHOD. METHOD to_string. DATA: lv_string TYPE string, lt_string TYPE ty_string_tt, lv_temp TYPE string, lo_structure TYPE REF TO zcl_aoc_structure. lv_temp = |{ io_structure->ms_statement-statement }, Children: { lines( io_structure->mt_structure ) }, Type: { io_structure->mv_type }, Stmnt type: { io_structure->mv_stmnt_type }|. APPEND lv_temp TO rt_string. LOOP AT io_structure->mt_structure INTO lo_structure. lt_string = to_string( lo_structure ). LOOP AT lt_string INTO lv_string. lv_string = '__' && lv_string. APPEND lv_string TO rt_string. ENDLOOP. ENDLOOP. ENDMETHOD. METHOD to_string_simple. DATA: lo_structure TYPE REF TO zcl_aoc_structure. rv_string = io_structure->ms_statement-statement. LOOP AT io_structure->mt_structure INTO lo_structure. rv_string = rv_string && cl_abap_char_utilities=>newline && to_string_simple( lo_structure ). ENDLOOP. ENDMETHOD. ENDCLASS.
23.286765
88
0.677929
4cf878a19ede22a021abbb5ae022413730944692
183
abap
ABAP
app/templates/report.abap
diesire/abap-boilerplate-alv
5385cadec46fe48cb0e7fbedc2f6cc63f81bed80
[ "MIT" ]
null
null
null
app/templates/report.abap
diesire/abap-boilerplate-alv
5385cadec46fe48cb0e7fbedc2f6cc63f81bed80
[ "MIT" ]
null
null
null
app/templates/report.abap
diesire/abap-boilerplate-alv
5385cadec46fe48cb0e7fbedc2f6cc63f81bed80
[ "MIT" ]
null
null
null
report {{report.name}}. {{top.gen}} {{zcl_util_alv.gen}} {{zcl_util_ctx.gen}} {{alv.gen}} {{app.gen}} {{screen9000pbo.gen}} {{screen9000pai.gen}} {{screen9000form.gen}} {{events.gen}}
18.3
23
0.666667
4cfda20cf809d5f7bc0cd878b082cdd677b45c95
3,649
abap
ABAP
src/objects/zcl_abapgit_object_shi8.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
1
2019-09-11T20:57:34.000Z
2019-09-11T20:57:34.000Z
src/objects/zcl_abapgit_object_shi8.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_shi8.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_shi8 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: mv_assignment_id TYPE hier_sfw_id. ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_SHI8 IMPLEMENTATION. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). mv_assignment_id = ms_item-obj_name. ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lv_deleted TYPE abap_bool, ls_message TYPE hier_mess. CALL FUNCTION 'STREE_SFW_ASSIGNMENT_DELETE' EXPORTING assignment_id = mv_assignment_id IMPORTING id_deleted = lv_deleted message = ls_message. IF lv_deleted = abap_false. zcx_abapgit_exception=>raise( |{ ls_message-msgtxt }| ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: ls_assignment_data TYPE ttree_sfw_nodes, ls_node_data TYPE hier_iface, lv_saved TYPE abap_bool, ls_message TYPE hier_mess. io_xml->read( EXPORTING iv_name = 'SHI8' CHANGING cg_data = ls_assignment_data ). ls_node_data-tree_id = ls_assignment_data-tree_id. ls_node_data-node_id = ls_assignment_data-node_id. CALL FUNCTION 'STREE_SFW_ASSIGNMENT_SAVE' EXPORTING assignment_id = ls_assignment_data-sfw_ass_id switch_id = ls_assignment_data-switch_id reaction = ls_assignment_data-reaction node_data = ls_node_data IMPORTING data_saved = lv_saved message = ls_message. IF lv_saved = abap_false. zcx_abapgit_exception=>raise( |{ ls_message-msgtxt }| ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~exists. CALL FUNCTION 'STREE_SFW_ASSIGNMENT_ID_EXISTS' EXPORTING assignment_id = mv_assignment_id IMPORTING exists = rv_bool. ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. 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. zcx_abapgit_exception=>raise( |TODO: Jump SHI8| ). ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lt_assignments TYPE STANDARD TABLE OF hier_sfw_assignment_id, ls_assignment LIKE LINE OF lt_assignments, lt_assignment_data TYPE STANDARD TABLE OF ttree_sfw_nodes, ls_assignment_data LIKE LINE OF lt_assignment_data. ls_assignment-sfw_ass_id = mv_assignment_id. INSERT ls_assignment INTO TABLE lt_assignments. CALL FUNCTION 'STREE_SFW_ASSIGNMENT_READ' TABLES it_assignments = lt_assignments et_assignment_data = lt_assignment_data. READ TABLE lt_assignment_data INTO ls_assignment_data INDEX 1. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Error serializing { ms_item-obj_type } { ms_item-obj_name }| ). ENDIF. io_xml->add( iv_name = 'SHI8' ig_data = ls_assignment_data ). ENDMETHOD. ENDCLASS.
23.849673
101
0.686489
9801a0f7fd0c7a3397dfd69b7e80630751dcb030
4,803
abap
ABAP
#gal#jobsched1.fugr.#gal#js_update_preconditions.abap
galileo-group/galileo-abap-lib
a013885096af9bc461d6000ad27b91789f150d00
[ "MIT" ]
2
2017-11-02T12:33:44.000Z
2019-10-14T10:10:13.000Z
#gal#jobsched1.fugr.#gal#js_update_preconditions.abap
galileo-group/galileo-abap-lib
a013885096af9bc461d6000ad27b91789f150d00
[ "MIT" ]
1
2017-11-05T19:36:27.000Z
2020-10-23T14:35:47.000Z
#gal#jobsched1.fugr.#gal#js_update_preconditions.abap
galileo-group/galileo-abap-lib
a013885096af9bc461d6000ad27b91789f150d00
[ "MIT" ]
null
null
null
FUNCTION /gal/js_update_preconditions. *"---------------------------------------------------------------------- *"*"Lokale Schnittstelle: *" IMPORTING *" REFERENCE(RFC_ROUTE_INFO) TYPE /GAL/RFC_ROUTE_INFO OPTIONAL *" REFERENCE(JOB_ID) TYPE /GAL/JOB_ID OPTIONAL *" EXCEPTIONS *" EXECUTION_FAILED *" RFC_EXCEPTION *"---------------------------------------------------------------------- DATA: l_jobdata02 TYPE /gal/jobdata02, l_jobdata02j TYPE /gal/jobdata02j, l_jobdata02r TYPE /gal/jobdata02r, BEGIN OF l_jobdata, job_id TYPE /gal/job_id, precond_id TYPE /gal/precondition_id, precond_type TYPE /gal/precondition_type, END OF l_jobdata, lt_jobdata LIKE TABLE OF l_jobdata, lt_fulfilled TYPE TABLE OF /gal/precondition_id, l_fulfilled TYPE /gal/precondition_id, l_curr_ts TYPE timestamp, l_job_status TYPE /gal/job_status, lt_job_id_range TYPE RANGE OF /gal/job_id, l_job_id_range LIKE LINE OF lt_job_id_range, l_message_stack TYPE REF TO /gal/message_stack, l_dummy TYPE /gal/precondition_id. "#EC NEEDED cfw_custom_auth /gal/cfw_auth=>const_cab_no_check. cfw_follow_rfc_route rfc_route_info. cfw_pass_exception rfc_exception. cfw_pass_exception execution_failed. cfw_remote_coding. CREATE OBJECT l_message_stack. IF NOT job_id IS INITIAL. l_job_id_range-sign = 'I'. l_job_id_range-option = 'EQ'. l_job_id_range-low = job_id. INSERT l_job_id_range INTO TABLE lt_job_id_range. "#EC CI_SUBRC ENDIF. SELECT j1~id j2~id j2~type INTO (l_jobdata-job_id, l_jobdata-precond_id, l_jobdata-precond_type) FROM /gal/jobdata01 AS j1 INNER JOIN /gal/jobdata02 AS j2 ON j1~id = j2~job_id WHERE j1~status = 'W' AND j1~id IN lt_job_id_range. APPEND l_jobdata TO lt_jobdata. ENDSELECT. "#EC CI_SUBRC LOOP AT lt_jobdata INTO l_jobdata. CASE l_jobdata-precond_type. WHEN 'J'. SELECT SINGLE * FROM /gal/jobdata02j INTO l_jobdata02j WHERE id = l_jobdata-precond_id. "#EC CI_SUBRC SELECT SINGLE status FROM /gal/jobdata01 INTO l_job_status WHERE id = l_jobdata02j-predec_job_id. "#EC CI_SUBRC IF l_job_status = 'F'. * Jobs mit Status 'E' brauchen eine andere Möglichkeit auf 'F' gesetzt zu werden APPEND l_jobdata-precond_id TO lt_fulfilled. ENDIF. WHEN 'T'. GET TIME STAMP FIELD l_curr_ts. SELECT SINGLE id FROM /gal/jobdata02t INTO l_dummy WHERE id = l_jobdata-precond_id AND timestamp <= l_curr_ts. "#EC CI_SUBRC IF sy-dbcnt > 0. INSERT l_jobdata-precond_id INTO TABLE lt_fulfilled. ENDIF. WHEN 'U'. SELECT SINGLE id FROM /gal/jobdata02u INTO l_dummy WHERE id = l_jobdata-precond_id AND status = 'N'. "#EC CI_SUBRC IF sy-dbcnt = 0. INSERT l_jobdata-precond_id INTO TABLE lt_fulfilled. ENDIF. WHEN 'R'. SELECT SINGLE * FROM /gal/jobdata02r INTO l_jobdata02r WHERE id = l_jobdata-precond_id. "#EC CI_SUBRC CALL FUNCTION '/GAL/JS_UPDATE_RESOURCES' EXPORTING resource_string = l_jobdata02r-resource_id EXCEPTIONS rfc_exception = 1 OTHERS = 2. IF sy-subrc = 1. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING rfc_exception. ELSEIF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING execution_failed. ENDIF. ENDCASE. ENDLOOP. CALL FUNCTION 'ENQUEUE_/GAL/E_JOBDATA02' EXPORTING _wait = 'X' _scope = '1' EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. IF sy-subrc <> 0. l_message_stack->push( ). /gal/trace=>write_error( ). l_message_stack->pop( ). MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING execution_failed. ENDIF. LOOP AT lt_fulfilled INTO l_fulfilled. SELECT SINGLE * FROM /gal/jobdata02 INTO l_jobdata02 WHERE id = l_fulfilled AND status NE 'F'. "Exclude fulfilled in select cause status might have changed sincve checking CHECK sy-subrc = 0. l_jobdata02-status = 'F'. UPDATE /gal/jobdata02 FROM l_jobdata02. "#EC CI_SUBRC ENDLOOP. COMMIT WORK. CALL FUNCTION 'DEQUEUE_/GAL/E_JOBDATA02' EXPORTING _scope = '1'. ENDFUNCTION.
34.553957
119
0.618155
9801cec6c17448dae70777872fa11b8daeaf1935
595
abap
ABAP
src/zcl_excel_font.clas.testclasses.abap
yanluckly/abap2xlsx
68707e1469e8a39982f0a672fb8788c3be15337f
[ "Apache-2.0" ]
1
2018-11-16T10:52:31.000Z
2018-11-16T10:52:31.000Z
src/zcl_excel_font.clas.testclasses.abap
pokrakam/abap2xlsx
8f65718db4e4210d3f02810ee8ca6c233a807fed
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_font.clas.testclasses.abap
pokrakam/abap2xlsx
8f65718db4e4210d3f02810ee8ca6c233a807fed
[ "Apache-2.0" ]
null
null
null
CLASS ltcl_Test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. METHODS calculate FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_Test IMPLEMENTATION. METHOD calculate. DATA lv_width TYPE f. lv_width = zcl_excel_font=>calculate_text_width( iv_font_name = 'foobar' iv_font_height = 20 iv_flag_bold = abap_false iv_flag_italic = abap_false iv_cell_value = 'hello world' ). cl_abap_unit_assert=>assert_equals( act = lv_width exp = '2.75' ). ENDMETHOD. ENDCLASS.
21.25
80
0.689076
9805df87bc2d9c3b5e2806c4da493e9b8a98c90e
620
abap
ABAP
zif_aim_external_tool_adapter.intf.abap
mrsimpson/aim
ae8a7763839c8a1d1ed7d57fdb187f5c4ce4b3bc
[ "MIT" ]
null
null
null
zif_aim_external_tool_adapter.intf.abap
mrsimpson/aim
ae8a7763839c8a1d1ed7d57fdb187f5c4ce4b3bc
[ "MIT" ]
null
null
null
zif_aim_external_tool_adapter.intf.abap
mrsimpson/aim
ae8a7763839c8a1d1ed7d57fdb187f5c4ce4b3bc
[ "MIT" ]
null
null
null
interface ZIF_AIM_EXTERNAL_TOOL_ADAPTER public . methods GET_TASK importing !IS_EXT_REFERENCE type YAIM_TASK_EXT_REF exporting !EV_EXISTS type ABAP_BOOL !EV_TITLE type YAIM_TASK_TITLE !EV_PRIORITY type YAIM_TASK_PRIORITY !EV_DESCRIPTION type YAIM_TASK_DESCRIPTION !EV_STATUS type YAIM_TASK_STATUS !EV_ASSIGNEE type YAIM_TASK_ASSIGNEE raising ZCX_AIM_EXTERNAL_TOOL . methods CHECK_EXISTENCE importing !IS_EXT_REFERENCE type YAIM_TASK_EXT_REF exporting !EV_EXISTS type ABAP_BOOL raising ZCX_AIM_EXTERNAL_TOOL . endinterface.
25.833333
48
0.748387
9807e0eef61df529443a2940bba907549e8ee4fb
6,464
abap
ABAP
src/json/cl_json_array.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
1
2020-06-24T22:15:05.000Z
2020-06-24T22:15:05.000Z
src/json/cl_json_array.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
null
null
null
src/json/cl_json_array.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
null
null
null
class /OOP/CL_JSON_ARRAY definition public inheriting from /OOP/CL_OBJECT final create public . public section. *"* public components of class /OOP/CL_JSON_ARRAY *"* do not include other source files here!!! type-pools ABAP . interfaces /OOP/IF_JSON_VALUE . aliases GET_TYPE for /OOP/IF_JSON_VALUE~GET_TYPE . methods CONSTRUCTOR . methods ADD importing !VALUE type ref to /OOP/IF_JSON_VALUE returning value(RETURNING) type ABAP_BOOL . methods CLEAR . methods GET importing !INDEX type I returning value(RETURNING) type ref to /OOP/IF_JSON_VALUE . methods ITERATOR returning value(RETURNING) type ref to /OOP/IF_ITERATOR . methods REMOVE importing !VALUE type ref to /OOP/IF_JSON_VALUE returning value(RETURNING) type ABAP_BOOL . methods SET importing !INDEX type I !VALUE type ref to /OOP/IF_JSON_VALUE returning value(RETURNING) type ref to /OOP/IF_JSON_VALUE . methods SIZE returning value(RETURNING) type I . protected section. *"* protected components of class /OOP/CL_JSON_ARRAY *"* do not include other source files here!!! private section. *"* private components of class /OOP/CL_JSON_ARRAY *"* do not include other source files here!!! data VALUES type ref to /OOP/CL_ARRAYLIST . ENDCLASS. CLASS /OOP/CL_JSON_ARRAY IMPLEMENTATION. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->/OOP/IF_JSON_VALUE~GET_TYPE * +-------------------------------------------------------------------------------------------------+ * | [<-()] RETURNING TYPE I * +--------------------------------------------------------------------------------------</SIGNATURE> method /oop/if_json_value~get_type. returning = /oop/cl_json_types=>type_array. endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->ADD * +-------------------------------------------------------------------------------------------------+ * | [--->] VALUE TYPE REF TO /OOP/IF_JSON_VALUE * | [<-()] RETURNING TYPE ABAP_BOOL * +--------------------------------------------------------------------------------------</SIGNATURE> method add. data object type ref to /oop/cl_object. object ?= value. returning = me->values->add( object ). endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->CLEAR * +-------------------------------------------------------------------------------------------------+ * +--------------------------------------------------------------------------------------</SIGNATURE> method clear. me->values->clear( ). endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->CONSTRUCTOR * +-------------------------------------------------------------------------------------------------+ * +--------------------------------------------------------------------------------------</SIGNATURE> method constructor. super->constructor( ). " Init values list create object me->values. endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->GET * +-------------------------------------------------------------------------------------------------+ * | [--->] INDEX TYPE I * | [<-()] RETURNING TYPE REF TO /OOP/IF_JSON_VALUE * +--------------------------------------------------------------------------------------</SIGNATURE> method get. returning ?= me->values->get( index ). endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->ITERATOR * +-------------------------------------------------------------------------------------------------+ * | [<-()] RETURNING TYPE REF TO /OOP/IF_ITERATOR * +--------------------------------------------------------------------------------------</SIGNATURE> method iterator. returning = me->values->iterator( ). endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->REMOVE * +-------------------------------------------------------------------------------------------------+ * | [--->] VALUE TYPE REF TO /OOP/IF_JSON_VALUE * | [<-()] RETURNING TYPE ABAP_BOOL * +--------------------------------------------------------------------------------------</SIGNATURE> method remove. data object type ref to /oop/cl_object. object ?= value. returning = me->values->remove( object ). endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->SET * +-------------------------------------------------------------------------------------------------+ * | [--->] INDEX TYPE I * | [--->] VALUE TYPE REF TO /OOP/IF_JSON_VALUE * | [<-()] RETURNING TYPE REF TO /OOP/IF_JSON_VALUE * +--------------------------------------------------------------------------------------</SIGNATURE> method set. data object type ref to /oop/cl_object. object ?= value. returning ?= me->values->set( index = index element = object ). endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method /OOP/CL_JSON_ARRAY->SIZE * +-------------------------------------------------------------------------------------------------+ * | [<-()] RETURNING TYPE I * +--------------------------------------------------------------------------------------</SIGNATURE> method size. returning = me->values->size( ). endmethod. ENDCLASS.
40.149068
102
0.374845
980ae3548dd5846177dec810618c706c5798ffb6
35,692
abap
ABAP
src/legacy/#dmo#cl_flight_legacy14.clas.abap
SAP-Cloud-Platform/flight14
4a89f087f6906c61683be65938dc48265ac70344
[ "BSD-Source-Code" ]
2
2020-08-31T12:56:04.000Z
2021-04-12T07:36:40.000Z
src/legacy/#dmo#cl_flight_legacy14.clas.abap
SAP-Cloud-Platform/flight14
4a89f087f6906c61683be65938dc48265ac70344
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#cl_flight_legacy14.clas.abap
SAP-Cloud-Platform/flight14
4a89f087f6906c61683be65938dc48265ac70344
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/cl_flight_legacy14 DEFINITION PUBLIC FINAL CREATE PRIVATE GLOBAL FRIENDS /dmo/cl_flight_data_generat_14. PUBLIC SECTION. INTERFACES /dmo/if_flight_legacy14. TYPES: BEGIN OF ENUM ty_change_mode STRUCTURE change_mode," Key checks are done separately create, update," Only fields that have been changed need to be checked END OF ENUM ty_change_mode STRUCTURE change_mode. CLASS-METHODS: get_instance RETURNING VALUE(ro_instance) TYPE REF TO /dmo/cl_flight_legacy14. " With respect to the same method call of create/update/delete_travel() we have All or Nothing. " I.e. when one of the levels contains an error, the complete call is refused. " However, the buffer is not cleared in case of an error. " I.e. when the caller wants to start over, he needs to call Initialize() explicitly. METHODS set_status_to_booked IMPORTING iv_travel_id TYPE /dmo/travel_id14 EXPORTING et_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message. METHODS create_travel IMPORTING is_travel TYPE /dmo/if_flight_legacy14=>ts_travel_in it_booking TYPE /dmo/if_flight_legacy14=>tt_booking_in OPTIONAL it_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement_in OPTIONAL EXPORTING es_travel TYPE /dmo/travel14 et_booking TYPE /dmo/if_flight_legacy14=>tt_booking et_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement et_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message. METHODS update_travel IMPORTING is_travel TYPE /dmo/if_flight_legacy14=>ts_travel_in is_travelx TYPE /dmo/if_flight_legacy14=>ts_travel_inx it_booking TYPE /dmo/if_flight_legacy14=>tt_booking_in OPTIONAL it_bookingx TYPE /dmo/if_flight_legacy14=>tt_booking_inx OPTIONAL it_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement_in OPTIONAL it_booking_supplementx TYPE /dmo/if_flight_legacy14=>tt_booking_supplement_inx OPTIONAL EXPORTING es_travel TYPE /dmo/travel14 et_booking TYPE /dmo/if_flight_legacy14=>tt_booking et_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement et_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message. METHODS delete_travel IMPORTING iv_travel_id TYPE /dmo/travel_id14 EXPORTING et_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message. METHODS get_travel IMPORTING iv_travel_id TYPE /dmo/travel_id14 iv_include_buffer TYPE abap_boolean iv_include_temp_buffer TYPE abap_boolean OPTIONAL EXPORTING es_travel TYPE /dmo/travel14 et_booking TYPE /dmo/if_flight_legacy14=>tt_booking et_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement et_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message. METHODS save. METHODS initialize. METHODS convert_messages IMPORTING it_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message EXPORTING et_messages TYPE /dmo/if_flight_legacy14=>tt_message. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA go_instance TYPE REF TO /dmo/cl_flight_legacy14. CLASS-METHODS: "! Calculation of Price <br/> "! <br/> "! Price will be calculated using distance multiplied and occupied seats.<br/> "! Depending on how many seats in percentage are occupied the formula <br/> "! 3/400·x² + 25<br/> "! will be applied.<br/> "! 0% seats occupied leads to 25% of distance as price.<br/> "! 75% seats occupied leads to 50% of distance as price.<br/> "! 100% seats occupied leads to 100% of distance as price.<br/> "! @parameter iv_seats_occupied_percent | occupied seats "! @parameter iv_flight_distance | flight distance in kilometer "! @parameter rv_price | calculated flight price calculate_flight_price IMPORTING iv_seats_occupied_percent TYPE /dmo/plane_seats_occupied14 iv_flight_distance TYPE i RETURNING VALUE(rv_price) TYPE /dmo/flight_price14 ##RELAX. METHODS lock_travel IMPORTING iv_lock TYPE abap_bool RAISING /dmo/cx_flight_legacy14 ##RELAX ##NEEDED. METHODS _resolve_attribute IMPORTING iv_attrname TYPE scx_attrname ix TYPE REF TO /dmo/cx_flight_legacy14 RETURNING VALUE(rv_symsgv) TYPE symsgv. "! Final determinations / derivations after all levels have been prepared, e.g. bottom-up derivations METHODS _determine EXPORTING et_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message CHANGING cs_travel TYPE /dmo/travel14 ct_booking TYPE /dmo/if_flight_legacy14=>tt_booking ct_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement. METHODS _determine_travel_total_price CHANGING cs_travel TYPE /dmo/travel14 ct_booking TYPE /dmo/if_flight_legacy14=>tt_booking ct_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement ct_messages TYPE /dmo/if_flight_legacy14=>tt_if_t100_message ##NEEDED. METHODS _convert_currency IMPORTING iv_currency_code_source TYPE /dmo/currency_code14 iv_currency_code_target TYPE /dmo/currency_code14 iv_amount TYPE /dmo/total_price14 RETURNING VALUE(rv_amount) TYPE /dmo/total_price14. ENDCLASS. CLASS /dmo/cl_flight_legacy14 IMPLEMENTATION. METHOD calculate_flight_price. DATA: lv_percentage_of_max_price TYPE i. lv_percentage_of_max_price = ( 3 * iv_seats_occupied_percent ** 2 DIV 400 ) + 25 ##OPERATOR[**]. rv_price = lv_percentage_of_max_price * iv_flight_distance DIV 100. ENDMETHOD. METHOD convert_messages. CLEAR et_messages. DATA ls_message TYPE symsg. LOOP AT it_messages INTO DATA(lr_error) ##INTO_OK. ls_message-msgty = 'E'. ls_message-msgid = lr_error->t100key-msgid. ls_message-msgno = lr_error->t100key-msgno. IF lr_error IS INSTANCE OF /dmo/cx_flight_legacy14. DATA(lx) = CAST /dmo/cx_flight_legacy14( lr_error ). ls_message-msgv1 = _resolve_attribute( iv_attrname = lr_error->t100key-attr1 ix = lx ). ls_message-msgv2 = _resolve_attribute( iv_attrname = lr_error->t100key-attr2 ix = lx ). ls_message-msgv3 = _resolve_attribute( iv_attrname = lr_error->t100key-attr3 ix = lx ). ls_message-msgv4 = _resolve_attribute( iv_attrname = lr_error->t100key-attr4 ix = lx ). ENDIF. APPEND ls_message TO et_messages. ENDLOOP. ENDMETHOD. METHOD create_travel. CLEAR: es_travel, et_booking, et_booking_supplement, et_messages. " Travel lcl_travel_buffer=>get_instance( )->cud_prep( EXPORTING it_travel = VALUE #( ( CORRESPONDING #( is_travel ) ) ) it_travelx = VALUE #( ( travel_id = is_travel-travel_id action_code = /dmo/if_flight_legacy14=>action_code-create ) ) IMPORTING et_travel = DATA(lt_travel) et_messages = et_messages ). IF et_messages IS INITIAL. ASSERT lines( lt_travel ) = 1. es_travel = lt_travel[ 1 ]. ENDIF. " Bookings IF et_messages IS INITIAL. DATA lt_booking TYPE /dmo/if_flight_legacy14=>tt_booking. DATA lt_bookingx TYPE /dmo/if_flight_legacy14=>tt_bookingx. LOOP AT it_booking INTO DATA(ls_booking_in). DATA ls_booking TYPE /dmo/booking14. ls_booking = CORRESPONDING #( ls_booking_in ). ls_booking-travel_id = es_travel-travel_id. INSERT ls_booking INTO TABLE lt_booking. INSERT VALUE #( travel_id = ls_booking-travel_id booking_id = ls_booking-booking_id action_code = /dmo/if_flight_legacy14=>action_code-create ) INTO TABLE lt_bookingx. ENDLOOP. lcl_booking_buffer=>get_instance( )->cud_prep( EXPORTING it_booking = lt_booking it_bookingx = lt_bookingx IMPORTING et_booking = et_booking et_messages = DATA(lt_messages) ). APPEND LINES OF lt_messages TO et_messages. ENDIF. " Booking Supplements IF et_messages IS INITIAL. DATA lt_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement. DATA lt_booking_supplementx TYPE /dmo/if_flight_legacy14=>tt_booking_supplementx. LOOP AT it_booking_supplement INTO DATA(ls_booking_supplement_in). DATA ls_booking_supplement TYPE /dmo/book_sup_14. ls_booking_supplement = CORRESPONDING #( ls_booking_supplement_in ). ls_booking_supplement-travel_id = es_travel-travel_id. IF lcl_booking_buffer=>get_instance( )->check_booking_id( EXPORTING iv_travel_id = ls_booking_supplement-travel_id iv_booking_id = ls_booking_supplement-booking_id CHANGING ct_messages = et_messages ) = abap_false. EXIT. ENDIF. INSERT ls_booking_supplement INTO TABLE lt_booking_supplement. INSERT VALUE #( travel_id = ls_booking_supplement-travel_id booking_id = ls_booking_supplement-booking_id booking_supplement_id = ls_booking_supplement-booking_supplement_id action_code = /dmo/if_flight_legacy14=>action_code-create ) INTO TABLE lt_booking_supplementx. ENDLOOP. IF et_messages IS INITIAL. lcl_booking_supplement_buffer=>get_instance( )->cud_prep( EXPORTING it_booking_supplement = lt_booking_supplement it_booking_supplementx = lt_booking_supplementx IMPORTING et_booking_supplement = et_booking_supplement et_messages = lt_messages ). APPEND LINES OF lt_messages TO et_messages. ENDIF. ENDIF. " Now do any derivations that require the whole business object (not only a single node), but which may in principle result in an error IF et_messages IS INITIAL. _determine( IMPORTING et_messages = et_messages CHANGING cs_travel = es_travel ct_booking = et_booking ct_booking_supplement = et_booking_supplement ). ENDIF. IF et_messages IS INITIAL. lcl_travel_buffer=>get_instance( )->cud_copy( ). lcl_booking_buffer=>get_instance( )->cud_copy( ). lcl_booking_supplement_buffer=>get_instance( )->cud_copy( ). ELSE. CLEAR: es_travel, et_booking, et_booking_supplement. lcl_travel_buffer=>get_instance( )->cud_disc( ). lcl_booking_buffer=>get_instance( )->cud_disc( ). lcl_booking_supplement_buffer=>get_instance( )->cud_disc( ). ENDIF. ENDMETHOD. METHOD delete_travel. CLEAR et_messages. get_travel( EXPORTING iv_travel_id = iv_travel_id iv_include_buffer = abap_true iv_include_temp_buffer = abap_true IMPORTING et_booking = DATA(lt_booking) et_booking_supplement = DATA(lt_booking_supplement) et_messages = et_messages ). IF et_messages IS INITIAL. lcl_booking_supplement_buffer=>get_instance( )->cud_prep( EXPORTING it_booking_supplement = CORRESPONDING #( lt_booking_supplement MAPPING travel_id = travel_id booking_id = booking_id booking_supplement_id = booking_supplement_id EXCEPT * ) it_booking_supplementx = VALUE #( FOR ls_bs IN lt_booking_supplement ( action_code = /dmo/if_flight_legacy14=>action_code-delete travel_id = ls_bs-travel_id booking_id = ls_bs-booking_id booking_supplement_id = ls_bs-booking_supplement_id ) ) iv_no_delete_check = abap_true " No existence check required IMPORTING et_messages = DATA(lt_messages) ). APPEND LINES OF lt_messages TO et_messages. ENDIF. IF et_messages IS INITIAL. lcl_booking_buffer=>get_instance( )->cud_prep( EXPORTING it_booking = CORRESPONDING #( lt_booking MAPPING travel_id = travel_id booking_id = booking_id EXCEPT * ) it_bookingx = VALUE #( FOR ls_b IN lt_booking ( action_code = /dmo/if_flight_legacy14=>action_code-delete travel_id = ls_b-travel_id booking_id = ls_b-booking_id ) ) iv_no_delete_check = abap_true " No existence check required IMPORTING et_messages = lt_messages ). APPEND LINES OF lt_messages TO et_messages. ENDIF. IF et_messages IS INITIAL. lcl_travel_buffer=>get_instance( )->cud_prep( EXPORTING it_travel = VALUE #( ( travel_id = iv_travel_id ) ) it_travelx = VALUE #( ( travel_id = iv_travel_id action_code = /dmo/if_flight_legacy14=>action_code-delete ) ) iv_no_delete_check = abap_true " No existence check required IMPORTING et_messages = lt_messages ). APPEND LINES OF lt_messages TO et_messages. ENDIF. IF et_messages IS INITIAL. lcl_travel_buffer=>get_instance( )->cud_copy( ). lcl_booking_buffer=>get_instance( )->cud_copy( ). lcl_booking_supplement_buffer=>get_instance( )->cud_copy( ). ELSE. lcl_travel_buffer=>get_instance( )->cud_disc( ). lcl_booking_buffer=>get_instance( )->cud_disc( ). lcl_booking_supplement_buffer=>get_instance( )->cud_disc( ). ENDIF. ENDMETHOD. METHOD get_instance. go_instance = COND #( WHEN go_instance IS BOUND THEN go_instance ELSE NEW #( ) ). ro_instance = go_instance. ENDMETHOD. METHOD get_travel. CLEAR: es_travel, et_booking, et_booking_supplement, et_messages. IF iv_travel_id IS INITIAL. APPEND NEW /dmo/cx_flight_legacy14( textid = /dmo/cx_flight_legacy14=>travel_no_key ) TO et_messages. RETURN. ENDIF. lcl_travel_buffer=>get_instance( )->get( EXPORTING it_travel = VALUE #( ( travel_id = iv_travel_id ) ) iv_include_buffer = iv_include_buffer iv_include_temp_buffer = iv_include_temp_buffer IMPORTING et_travel = DATA(lt_travel) ). IF lt_travel IS INITIAL. APPEND NEW /dmo/cx_flight_legacy14( textid = /dmo/cx_flight_legacy14=>travel_unknown travel_id = iv_travel_id ) TO et_messages. RETURN. ENDIF. ASSERT lines( lt_travel ) = 1. es_travel = lt_travel[ 1 ]. lcl_booking_buffer=>get_instance( )->get( EXPORTING it_booking = VALUE #( ( travel_id = iv_travel_id ) ) iv_include_buffer = iv_include_buffer iv_include_temp_buffer = iv_include_temp_buffer IMPORTING et_booking = et_booking ). lcl_booking_supplement_buffer=>get_instance( )->get( EXPORTING it_booking_supplement = CORRESPONDING #( et_booking MAPPING travel_id = travel_id booking_id = booking_id EXCEPT * ) iv_include_buffer = iv_include_buffer iv_include_temp_buffer = iv_include_temp_buffer IMPORTING et_booking_supplement = et_booking_supplement ). ENDMETHOD. METHOD initialize. lcl_travel_buffer=>get_instance( )->initialize( ). lcl_booking_buffer=>get_instance( )->initialize( ). lcl_booking_supplement_buffer=>get_instance( )->initialize( ). ENDMETHOD. METHOD lock_travel ##NEEDED. * IF iv_lock = abap_true. * CALL FUNCTION 'ENQUEUE_/DMO/ETRAVEL14' * EXCEPTIONS * foreign_lock = 1 * system_failure = 2 * OTHERS = 3. * IF sy-subrc <> 0. * RAISE EXCEPTION TYPE /dmo/cx_flight_legacy14 * EXPORTING * textid = /dmo/cx_flight_legacy14=>travel_lock. * ENDIF. * ELSE. * CALL FUNCTION 'DEQUEUE_/DMO/ETRAVEL14'. * ENDIF. ENDMETHOD. METHOD save. lcl_travel_buffer=>get_instance( )->save( ). lcl_booking_buffer=>get_instance( )->save( ). lcl_booking_supplement_buffer=>get_instance( )->save( ). initialize( ). ENDMETHOD. METHOD set_status_to_booked. lcl_travel_buffer=>get_instance( )->set_status_to_booked( EXPORTING iv_travel_id = iv_travel_id IMPORTING et_messages = et_messages ). ENDMETHOD. METHOD update_travel. CLEAR es_travel. CLEAR et_booking. CLEAR et_booking_supplement. CLEAR et_messages. " Travel IF is_travel-travel_id IS INITIAL. APPEND NEW /dmo/cx_flight_legacy14( textid = /dmo/cx_flight_legacy14=>travel_no_key ) TO et_messages. RETURN. ENDIF. DATA ls_travelx TYPE /dmo/if_flight_legacy14=>ts_travelx. ls_travelx = CORRESPONDING #( is_travelx ). ls_travelx-action_code = /dmo/if_flight_legacy14=>action_code-update. lcl_travel_buffer=>get_instance( )->cud_prep( EXPORTING it_travel = VALUE #( ( CORRESPONDING #( is_travel ) ) ) it_travelx = VALUE #( ( ls_travelx ) ) IMPORTING et_travel = DATA(lt_travel) et_messages = et_messages ). " We may need to delete Booking Supplements of deleted Bookings " Read all Booking Supplements before any Bookings are deleted get_travel( EXPORTING iv_travel_id = is_travel-travel_id iv_include_buffer = abap_true iv_include_temp_buffer = abap_true IMPORTING et_booking_supplement = DATA(lt_booking_supplement_del) ). " Bookings IF et_messages IS INITIAL. " Ignore provided Travel ID of subnode tables DATA lt_booking TYPE /dmo/if_flight_legacy14=>tt_booking. DATA lt_bookingx TYPE /dmo/if_flight_legacy14=>tt_bookingx. LOOP AT it_booking INTO DATA(ls_booking_in). DATA ls_booking TYPE /dmo/booking14. ls_booking = CORRESPONDING #( ls_booking_in ). ls_booking-travel_id = is_travel-travel_id. INSERT ls_booking INTO TABLE lt_booking. ENDLOOP. LOOP AT it_bookingx INTO DATA(ls_booking_inx). DATA ls_bookingx TYPE /dmo/if_flight_legacy14=>ts_bookingx. ls_bookingx = CORRESPONDING #( ls_booking_inx ). ls_bookingx-travel_id = is_travel-travel_id. INSERT ls_bookingx INTO TABLE lt_bookingx. ENDLOOP. lcl_booking_buffer=>get_instance( )->cud_prep( EXPORTING it_booking = lt_booking it_bookingx = lt_bookingx IMPORTING et_booking = et_booking et_messages = DATA(lt_messages) ). APPEND LINES OF lt_messages TO et_messages. ENDIF. " Booking Supplements IF et_messages IS INITIAL. " Ignore provided Travel ID of subnode tables DATA lt_booking_supplement TYPE /dmo/if_flight_legacy14=>tt_booking_supplement. DATA lt_booking_supplementx TYPE /dmo/if_flight_legacy14=>tt_booking_supplementx. LOOP AT it_booking_supplement INTO DATA(ls_booking_supplement_in). DATA ls_booking_supplement TYPE /dmo/book_sup_14. ls_booking_supplement = CORRESPONDING #( ls_booking_supplement_in ). ls_booking_supplement-travel_id = is_travel-travel_id. IF lcl_booking_buffer=>get_instance( )->check_booking_id( EXPORTING iv_travel_id = ls_booking_supplement-travel_id iv_booking_id = ls_booking_supplement-booking_id CHANGING ct_messages = et_messages ) = abap_false. EXIT. ENDIF. INSERT ls_booking_supplement INTO TABLE lt_booking_supplement. ENDLOOP. IF et_messages IS INITIAL. LOOP AT it_booking_supplementx INTO DATA(ls_booking_supplement_inx). DATA ls_booking_supplementx TYPE /dmo/if_flight_legacy14=>ts_booking_supplementx. ls_booking_supplementx = CORRESPONDING #( ls_booking_supplement_inx ). ls_booking_supplementx-travel_id = is_travel-travel_id. INSERT ls_booking_supplementx INTO TABLE lt_booking_supplementx. ENDLOOP. lcl_booking_supplement_buffer=>get_instance( )->cud_prep( EXPORTING it_booking_supplement = lt_booking_supplement it_booking_supplementx = lt_booking_supplementx IMPORTING et_booking_supplement = et_booking_supplement et_messages = lt_messages ). APPEND LINES OF lt_messages TO et_messages. ENDIF. ENDIF. " For Bookings to be deleted we also need to delete the Booking Supplements IF et_messages IS INITIAL AND lt_booking_supplement_del IS NOT INITIAL AND line_exists( lt_bookingx[ action_code = CONV /dmo/action_code14( /dmo/if_flight_legacy14=>action_code-delete ) ] ). " Remove any Bookings from internal table that must not be deleted LOOP AT lt_booking_supplement_del ASSIGNING FIELD-SYMBOL(<s_booking_supplement_del>). READ TABLE lt_bookingx TRANSPORTING NO FIELDS WITH KEY action_code = CONV /dmo/action_code14( /dmo/if_flight_legacy14=>action_code-delete ) travel_id = <s_booking_supplement_del>-travel_id booking_id = <s_booking_supplement_del>-booking_id. IF sy-subrc <> 0. DELETE lt_booking_supplement_del. ENDIF. ENDLOOP. lcl_booking_supplement_buffer=>get_instance( )->cud_prep( EXPORTING it_booking_supplement = CORRESPONDING #( lt_booking_supplement_del MAPPING travel_id = travel_id booking_id = booking_id booking_supplement_id = booking_supplement_id EXCEPT * ) it_booking_supplementx = VALUE #( FOR ls_bs IN lt_booking_supplement_del ( action_code = /dmo/if_flight_legacy14=>action_code-delete travel_id = ls_bs-travel_id booking_id = ls_bs-booking_id booking_supplement_id = ls_bs-booking_supplement_id ) ) iv_no_delete_check = abap_true " No existence check required IMPORTING et_messages = et_messages ). ENDIF. IF et_messages IS INITIAL. ASSERT lines( lt_travel ) = 1. " Now do any derivations that require the whole business object (not only a single node), but which may in principle result in an error " The derivation may need the complete Business Object, i.e. including unchanged subnodes get_travel( EXPORTING iv_travel_id = lt_travel[ 1 ]-travel_id iv_include_buffer = abap_true iv_include_temp_buffer = abap_true IMPORTING es_travel = es_travel et_booking = et_booking et_booking_supplement = et_booking_supplement et_messages = et_messages ). ASSERT et_messages IS INITIAL. _determine( IMPORTING et_messages = et_messages CHANGING cs_travel = es_travel ct_booking = et_booking ct_booking_supplement = et_booking_supplement ). IF et_messages IS INITIAL. " We do not want to return all subnodes, but only those that have been created or changed. " So currently it is not implemented that a determination of a booking changes another booking as the other booking cannot be properly returned. LOOP AT et_booking ASSIGNING FIELD-SYMBOL(<s_booking>). LOOP AT it_bookingx TRANSPORTING NO FIELDS WHERE booking_id = <s_booking>-booking_id AND ( action_code = CONV /dmo/action_code14( /dmo/if_flight_legacy14=>action_code-create ) OR action_code = CONV /dmo/action_code14( /dmo/if_flight_legacy14=>action_code-update ) ). EXIT. ENDLOOP. IF sy-subrc <> 0. DELETE et_booking. ENDIF. ENDLOOP. LOOP AT et_booking_supplement ASSIGNING FIELD-SYMBOL(<s_booking_supplement>). LOOP AT it_booking_supplementx TRANSPORTING NO FIELDS WHERE booking_id = <s_booking_supplement>-booking_id AND booking_supplement_id = <s_booking_supplement>-booking_supplement_id AND ( action_code = CONV /dmo/action_code14( /dmo/if_flight_legacy14=>action_code-create ) OR action_code = CONV /dmo/action_code14( /dmo/if_flight_legacy14=>action_code-update ) ). EXIT. ENDLOOP. IF sy-subrc <> 0. DELETE et_booking_supplement. ENDIF. ENDLOOP. ENDIF. ENDIF. IF et_messages IS INITIAL. lcl_travel_buffer=>get_instance( )->cud_copy( ). lcl_booking_buffer=>get_instance( )->cud_copy( ). lcl_booking_supplement_buffer=>get_instance( )->cud_copy( ). ELSE. CLEAR: es_travel, et_booking, et_booking_supplement. lcl_travel_buffer=>get_instance( )->cud_disc( ). lcl_booking_buffer=>get_instance( )->cud_disc( ). lcl_booking_supplement_buffer=>get_instance( )->cud_disc( ). ENDIF. ENDMETHOD. METHOD _convert_currency. DATA(lv_exchange_rate_date) = cl_abap_context_info=>get_system_date( )." Do not buffer: Current date may change during lifetime of session /dmo/cl_flight_amdp14=>convert_currency( EXPORTING iv_amount = iv_amount iv_currency_code_source = iv_currency_code_source iv_currency_code_target = iv_currency_code_target iv_exchange_rate_date = lv_exchange_rate_date IMPORTING ev_amount = rv_amount ). ENDMETHOD. METHOD _determine. ASSERT cs_travel-travel_id IS NOT INITIAL. LOOP AT ct_booking TRANSPORTING NO FIELDS WHERE travel_id <> cs_travel-travel_id. EXIT. ENDLOOP. ASSERT sy-subrc = 4. LOOP AT ct_booking_supplement TRANSPORTING NO FIELDS WHERE travel_id <> cs_travel-travel_id. EXIT. ENDLOOP. ASSERT sy-subrc = 4. CLEAR et_messages. _determine_travel_total_price( CHANGING cs_travel = cs_travel ct_booking = ct_booking ct_booking_supplement = ct_booking_supplement ct_messages = et_messages ). ENDMETHOD. METHOD _determine_travel_total_price. DATA lv_add TYPE /dmo/total_price14. DATA(lv_currency_code_target) = cs_travel-currency_code. " If we do not have a Travel Currency Code yet, " we may derive it when all the subnodes have the same non-initial Currency Code IF lv_currency_code_target IS INITIAL. DATA lv_ok TYPE abap_bool. lv_ok = abap_true. LOOP AT ct_booking ASSIGNING FIELD-SYMBOL(<s_booking>). IF sy-tabix = 1. lv_currency_code_target = <s_booking>-currency_code. ENDIF. IF <s_booking>-currency_code IS INITIAL. lv_ok = abap_false. EXIT. ENDIF. IF lv_currency_code_target <> <s_booking>-currency_code. lv_ok = abap_false. EXIT. ENDIF. ENDLOOP. IF lv_ok = abap_true. LOOP AT ct_booking_supplement ASSIGNING FIELD-SYMBOL(<s_booking_supplement>). IF <s_booking_supplement>-currency_code IS INITIAL. lv_ok = abap_false. EXIT. ENDIF. IF lv_currency_code_target <> <s_booking_supplement>-currency_code. lv_ok = abap_false. EXIT. ENDIF. ENDLOOP. ENDIF. ENDIF. IF lv_currency_code_target IS NOT INITIAL. " Total Price = Booking Fee + Booking Flight Prices + Booking Supplement Prices cs_travel-total_price = cs_travel-booking_fee. cs_travel-currency_code = lv_currency_code_target. LOOP AT ct_booking ASSIGNING <s_booking> GROUP BY <s_booking>-currency_code INTO DATA(booking_currency_code). lv_add = REDUCE #( INIT sum = 0 FOR b IN GROUP booking_currency_code NEXT sum = sum + b-flight_price ). IF booking_currency_code <> lv_currency_code_target. lv_add = _convert_currency( iv_currency_code_source = booking_currency_code iv_currency_code_target = lv_currency_code_target iv_amount = lv_add ). ENDIF. cs_travel-total_price = cs_travel-total_price + lv_add. ENDLOOP. LOOP AT ct_booking_supplement ASSIGNING <s_booking_supplement> GROUP BY <s_booking_supplement>-currency_code INTO DATA(supplement_currency_code). lv_add = REDUCE #( INIT sum = 0 FOR s IN GROUP supplement_currency_code NEXT sum = sum + s-price ). IF supplement_currency_code <> lv_currency_code_target. lv_add = _convert_currency( iv_currency_code_source = supplement_currency_code iv_currency_code_target = lv_currency_code_target iv_amount = lv_add ). ENDIF. cs_travel-total_price = cs_travel-total_price + lv_add. ENDLOOP. lcl_travel_buffer=>get_instance( )->cud_prep( EXPORTING it_travel = VALUE #( ( travel_id = cs_travel-travel_id total_price = cs_travel-total_price currency_code = cs_travel-currency_code ) ) it_travelx = VALUE #( ( action_code = /dmo/if_flight_legacy14=>action_code-update travel_id = cs_travel-travel_id total_price = abap_true currency_code = abap_true ) ) IMPORTING et_messages = DATA(lt_messages) ). ASSERT lt_messages IS INITIAL. ENDIF. ENDMETHOD. METHOD _resolve_attribute. CLEAR rv_symsgv. CASE iv_attrname. WHEN ''. rv_symsgv = ''. WHEN 'MV_TRAVEL_ID'. rv_symsgv = |{ ix->mv_travel_id ALPHA = OUT }|. WHEN 'MV_BOOKING_ID'. rv_symsgv = |{ ix->mv_booking_id ALPHA = OUT }|. WHEN 'MV_BOOKING_SUPPLEMENT_ID'. rv_symsgv = |{ ix->mv_booking_supplement_id ALPHA = OUT }|. WHEN 'MV_AGENCY_ID'. rv_symsgv = |{ ix->mv_agency_id ALPHA = OUT }|. WHEN 'MV_CUSTOMER_ID'. rv_symsgv = |{ ix->mv_customer_id ALPHA = OUT }|. WHEN 'MV_CARRIER_ID'. rv_symsgv = |{ ix->mv_carrier_id ALPHA = OUT }|. WHEN 'MV_CONNECTION_ID'. rv_symsgv = |{ ix->mv_connection_id ALPHA = OUT }|. WHEN 'MV_SUPPLEMENT_ID'. rv_symsgv = ix->mv_supplement_id. WHEN 'MV_BEGIN_DATE'. rv_symsgv = |{ ix->mv_begin_date DATE = USER }|. WHEN 'MV_END_DATE'. rv_symsgv = |{ ix->mv_end_date DATE = USER }|. WHEN 'MV_BOOKING_DATE'. rv_symsgv = |{ ix->mv_booking_date DATE = USER }|. WHEN 'MV_FLIGHT_DATE'. rv_symsgv = |{ ix->mv_flight_date DATE = USER }|. WHEN 'MV_STATUS'. rv_symsgv = ix->mv_status. WHEN 'MV_CURRENCY_CODE'. rv_symsgv = ix->mv_currency_code. WHEN 'MV_UNAME'. rv_symsgv = ix->mv_uname. WHEN OTHERS. ASSERT 1 = 2. ENDCASE. ENDMETHOD. ENDCLASS.
55.595016
237
0.584389
980caba12d21dec38b469c1bfba3cb1ab952fba5
44,376
abap
ABAP
src/zcl_excel_worksheet.clas.testclasses.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_worksheet.clas.testclasses.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_worksheet.clas.testclasses.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
null
null
null
CLASS ltc_normalize_column_heading DEFINITION DEFERRED. CLASS ltc_normalize_columnrow_param DEFINITION DEFERRED. CLASS ltc_normalize_range_param DEFINITION DEFERRED. CLASS ltc_calculate_table_bottom_rig DEFINITION DEFERRED. CLASS ltc_normalize_style_param DEFINITION DEFERRED. CLASS ltc_check_cell_column_formula DEFINITION DEFERRED. CLASS ltc_check_overlapping DEFINITION DEFERRED. CLASS ltc_set_cell_value_types DEFINITION DEFERRED. CLASS zcl_excel_worksheet DEFINITION LOCAL FRIENDS ltc_normalize_column_heading ltc_normalize_columnrow_param ltc_normalize_range_param ltc_calculate_table_bottom_rig ltc_check_overlapping ltc_normalize_style_param ltc_check_cell_column_formula ltc_set_cell_value_types. CLASS lcl_excel_worksheet_test DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. * ================ DATA: f_cut TYPE REF TO zcl_excel_worksheet. "class under test CLASS-METHODS: class_setup. CLASS-METHODS: class_teardown. METHODS: setup. METHODS: teardown. METHODS: set_merge FOR TESTING RAISING cx_static_check. METHODS: delete_merge FOR TESTING RAISING cx_static_check. METHODS: get_dimension_range FOR TESTING RAISING cx_static_check. ENDCLASS. "lcl_Excel_Worksheet_Test CLASS ltc_calculate_table_bottom_rig DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. METHODS: simple FOR TESTING RAISING cx_static_check, empty_table FOR TESTING RAISING cx_static_check, column_not_selected FOR TESTING RAISING cx_static_check. DATA: test_table TYPE TABLE OF string, field_catalog TYPE zexcel_t_fieldcatalog, field_catalog_line TYPE zexcel_s_fieldcatalog, table_settings TYPE zexcel_s_table_settings. "class under test ENDCLASS. CLASS ltc_check_cell_column_formula DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. METHODS: success FOR TESTING RAISING cx_static_check. METHODS: fails_both_formula_id_value FOR TESTING RAISING cx_static_check. METHODS: fails_both_formula_id_formula FOR TESTING RAISING cx_static_check. METHODS: formula_id_not_found FOR TESTING RAISING cx_static_check. METHODS: outside_table_fails__above FOR TESTING RAISING cx_static_check. METHODS: outside_table_fails__below FOR TESTING RAISING cx_static_check. METHODS: outside_table_fails__left FOR TESTING RAISING cx_static_check. METHODS: outside_table_fails__right FOR TESTING RAISING cx_static_check. METHODS: must_be_in_same_column FOR TESTING RAISING cx_static_check. METHODS: setup. METHODS: should_fail IMPORTING ip_formula_id TYPE zexcel_s_cell_data-column_formula_id ip_formula TYPE zexcel_s_cell_data-cell_formula OPTIONAL ip_value TYPE zexcel_s_cell_data-cell_value OPTIONAL ip_row TYPE zexcel_s_cell_data-cell_row ip_column TYPE zexcel_s_cell_data-cell_column ip_exp TYPE string RAISING zcx_excel. DATA: mt_column_formulas TYPE zcl_excel_worksheet=>mty_th_column_formula, c_messages LIKE zcl_excel_worksheet=>c_messages. ENDCLASS. CLASS ltc_check_overlapping DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. TYPES : BEGIN OF ty_parameters, BEGIN OF input, table_settings TYPE zexcel_s_table_settings, other_table_settings TYPE zcl_excel_worksheet=>ty_table_settings, END OF input, BEGIN OF output, fails TYPE abap_bool, END OF output, END OF ty_parameters. DATA: table_1_settings TYPE zexcel_s_table_settings. METHODS: no_overlap_top FOR TESTING RAISING cx_static_check, no_overlap_left FOR TESTING RAISING cx_static_check, no_overlap_bottom FOR TESTING RAISING cx_static_check, no_overlap_right FOR TESTING RAISING cx_static_check, overlap_top FOR TESTING RAISING cx_static_check, overlap_left FOR TESTING RAISING cx_static_check, overlap_bottom FOR TESTING RAISING cx_static_check, overlap_right FOR TESTING RAISING cx_static_check. METHODS setup. METHODS assert IMPORTING input TYPE ty_parameters-input exp TYPE ty_parameters-output RAISING cx_static_check. ENDCLASS. CLASS ltc_normalize_column_heading DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. TYPES : BEGIN OF ty_parameters, BEGIN OF input, default_descr TYPE c LENGTH 1, field_catalog TYPE zexcel_t_fieldcatalog, END OF input, BEGIN OF output, field_catalog TYPE zexcel_t_fieldcatalog, END OF output, END OF ty_parameters. DATA: cut TYPE REF TO zcl_excel_worksheet. "class under test METHODS setup. METHODS: prefer_small_text FOR TESTING RAISING cx_static_check, prefer_medium_text FOR TESTING RAISING cx_static_check, prefer_long_text FOR TESTING RAISING cx_static_check, default_text_if_none FOR TESTING RAISING cx_static_check, invalid_default_descr FOR TESTING RAISING cx_static_check. METHODS assert IMPORTING input TYPE ty_parameters-input exp TYPE ty_parameters-output RAISING cx_static_check. ENDCLASS. CLASS ltc_normalize_columnrow_param DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. TYPES : BEGIN OF ty_parameters, BEGIN OF input, columnrow TYPE string, column TYPE string, row TYPE zexcel_cell_row, END OF input, BEGIN OF output, fails TYPE abap_bool, column TYPE zexcel_cell_column, row TYPE zexcel_cell_row, END OF output, END OF ty_parameters. DATA: cut TYPE REF TO zcl_excel_worksheet. "class under test METHODS setup. METHODS: test FOR TESTING RAISING cx_static_check, all_parameters_passed FOR TESTING RAISING cx_static_check, none_parameter_passed FOR TESTING RAISING cx_static_check. METHODS assert IMPORTING input TYPE ty_parameters-input exp TYPE ty_parameters-output RAISING cx_static_check. ENDCLASS. CLASS ltc_normalize_range_param DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. TYPES : BEGIN OF ty_parameters, BEGIN OF input, range TYPE string, column_start TYPE string, column_end TYPE string, row TYPE zexcel_cell_row, row_to TYPE zexcel_cell_row, END OF input, BEGIN OF output, fails TYPE abap_bool, column_start TYPE zexcel_cell_column, column_end TYPE zexcel_cell_column, row_start TYPE zexcel_cell_row, row_end TYPE zexcel_cell_row, END OF output, END OF ty_parameters. DATA: cut TYPE REF TO zcl_excel_worksheet. "class under test METHODS setup. METHODS: range_one_cell FOR TESTING RAISING cx_static_check, relative_range FOR TESTING RAISING cx_static_check, invalid_range FOR TESTING RAISING cx_static_check, absolute_range FOR TESTING RAISING cx_static_check, reverse_range_not_supported FOR TESTING RAISING cx_static_check, all_parameters_passed FOR TESTING RAISING cx_static_check, none_parameter_passed FOR TESTING RAISING cx_static_check, start_without_end FOR TESTING RAISING cx_static_check. METHODS assert IMPORTING input TYPE ty_parameters-input exp TYPE ty_parameters-output RAISING cx_static_check. ENDCLASS. CLASS ltc_normalize_style_param DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. TYPES : BEGIN OF ty_parameters_output, fails TYPE abap_bool, guid TYPE zexcel_cell_style, END OF ty_parameters_output. DATA: excel TYPE REF TO zcl_excel, cut TYPE REF TO zcl_excel_worksheet, "class under test exp TYPE ty_parameters_output. METHODS setup. METHODS: ref_to_zcl_excel_style FOR TESTING RAISING cx_static_check, zexcel_cell_style FOR TESTING RAISING cx_static_check, raw_16_bytes FOR TESTING RAISING cx_static_check, other FOR TESTING RAISING cx_static_check. METHODS assert IMPORTING input TYPE any exp TYPE ty_parameters_output RAISING cx_static_check. ENDCLASS. CLASS ltc_set_cell_value_types DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. DATA: excel TYPE REF TO zcl_excel, cut TYPE REF TO zcl_excel_worksheet. "class under test METHODS setup. METHODS: int8 FOR TESTING RAISING cx_static_check. METHODS assert IMPORTING input TYPE any exp TYPE string RAISING cx_static_check. ENDCLASS. CLASS lcl_excel_worksheet_test IMPLEMENTATION. * ============================================== METHOD class_setup. * =================== ENDMETHOD. "class_Setup METHOD class_teardown. * ====================== ENDMETHOD. "class_Teardown METHOD setup. * ============= DATA lo_excel TYPE REF TO zcl_excel. CREATE OBJECT lo_excel. TRY. CREATE OBJECT f_cut EXPORTING ip_excel = lo_excel. CATCH zcx_excel. cl_abap_unit_assert=>fail( 'Could not create instance' ). ENDTRY. ENDMETHOD. "setup METHOD teardown. * ================ ENDMETHOD. "teardown METHOD set_merge. * ==================== DATA lt_merge TYPE string_table. DATA lv_merge TYPE string. DATA lv_size TYPE i. DATA lv_size_next TYPE i. * Test 1. Simple test for initial value lt_merge = f_cut->get_merge( ). lv_size = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size exp = 0 msg = 'Initial state of merge table is not empty' level = if_aunit_constants=>critical ). * Test 2. Add merge f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). lt_merge = f_cut->get_merge( ). lv_size_next = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size_next - lv_size exp = 1 msg = 'Expect add 1 table line when 1 merge added' level = if_aunit_constants=>critical ). * Test 2. Add same merge lv_size = lv_size_next. TRY. f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). CATCH zcx_excel. ENDTRY. lt_merge = f_cut->get_merge( ). lv_size_next = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size_next - lv_size exp = 0 msg = 'Expect no change when add same merge' level = if_aunit_constants=>critical ). * Test 3. Add one different merge lv_size = lv_size_next. f_cut->set_merge( ip_column_start = 4 ip_column_end = 5 ip_row = 2 ip_row_to = 3 ). lt_merge = f_cut->get_merge( ). lv_size_next = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size_next - lv_size exp = 1 msg = 'Expect 1 change when add different merge' level = if_aunit_constants=>critical ). * Test 4. Merge added with concrete value #1 f_cut->delete_merge( ). f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). lt_merge = f_cut->get_merge( ). READ TABLE lt_merge INTO lv_merge INDEX 1. cl_abap_unit_assert=>assert_equals( act = lv_merge exp = 'B2:C3' msg = 'Expect B2:C3' level = if_aunit_constants=>critical ). * Test 5. Merge added with concrete value #2 f_cut->delete_merge( ). f_cut->set_merge( ip_column_start = 4 ip_column_end = 5 ip_row = 4 ip_row_to = 5 ). lt_merge = f_cut->get_merge( ). READ TABLE lt_merge INTO lv_merge INDEX 1. cl_abap_unit_assert=>assert_equals( act = lv_merge exp = 'D4:E5' msg = 'Expect D4:E5' level = if_aunit_constants=>critical ). ENDMETHOD. METHOD delete_merge. * ==================== DATA lt_merge TYPE string_table. DATA lv_merge TYPE string. DATA lv_size TYPE i. DATA lv_index TYPE i. * Test 1. Simple test delete all merges f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). f_cut->delete_merge( ). lt_merge = f_cut->get_merge( ). lv_size = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size exp = 0 msg = 'Expect merge table with 1 line fully cleared' level = if_aunit_constants=>critical ). * Test 2. Simple test delete all merges DO 10 TIMES. f_cut->set_merge( ip_column_start = 2 + sy-index * 2 ip_column_end = 3 + sy-index * 2 ip_row = 2 + sy-index * 2 ip_row_to = 3 + sy-index * 2 ). ENDDO. f_cut->delete_merge( ). lt_merge = f_cut->get_merge( ). lv_size = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size exp = 0 msg = 'Expect merge table with few lines fully cleared' level = if_aunit_constants=>critical ). * Test 3. Delete concrete merge with success DO 4 TIMES. lv_index = sy-index. f_cut->delete_merge( ). f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). CASE lv_index. WHEN 1. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 2 ). WHEN 2. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 3 ). WHEN 3. f_cut->delete_merge( ip_cell_column = 3 ip_cell_row = 2 ). WHEN 4. f_cut->delete_merge( ip_cell_column = 3 ip_cell_row = 3 ). ENDCASE. lt_merge = f_cut->get_merge( ). lv_size = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size exp = 0 msg = 'Expect merge table with 1 line fully cleared' level = if_aunit_constants=>critical ). ENDDO. * Test 4. Delete concrete merge with fail DO 4 TIMES. lv_index = sy-index. f_cut->delete_merge( ). f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). CASE lv_index. WHEN 1. f_cut->delete_merge( ip_cell_column = 1 ip_cell_row = 2 ). WHEN 2. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 1 ). WHEN 3. f_cut->delete_merge( ip_cell_column = 4 ip_cell_row = 2 ). WHEN 4. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 4 ). ENDCASE. lt_merge = f_cut->get_merge( ). lv_size = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size exp = 1 msg = 'Expect no merge were deleted' level = if_aunit_constants=>critical ). ENDDO. * Test 5. Delete concrete merge #1 f_cut->delete_merge( ). f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). f_cut->set_merge( ip_column_start = 4 ip_column_end = 5 ip_row = 4 ip_row_to = 5 ). f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 2 ). lt_merge = f_cut->get_merge( ). lv_size = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size exp = 1 msg = 'Expect we have the one merge' level = if_aunit_constants=>critical ). READ TABLE lt_merge INTO lv_merge INDEX 1. cl_abap_unit_assert=>assert_equals( act = lv_merge exp = 'D4:E5' msg = 'Expect delete B2:C3 merge' level = if_aunit_constants=>critical ). * Test 6. Delete concrete merge #2 f_cut->delete_merge( ). f_cut->set_merge( ip_column_start = 2 ip_column_end = 3 ip_row = 2 ip_row_to = 3 ). f_cut->set_merge( ip_column_start = 4 ip_column_end = 5 ip_row = 4 ip_row_to = 5 ). f_cut->delete_merge( ip_cell_column = 4 ip_cell_row = 4 ). lt_merge = f_cut->get_merge( ). lv_size = lines( lt_merge ). cl_abap_unit_assert=>assert_equals( act = lv_size exp = 1 msg = 'Expect we have the one merge' level = if_aunit_constants=>critical ). READ TABLE lt_merge INTO lv_merge INDEX 1. cl_abap_unit_assert=>assert_equals( act = lv_merge exp = 'B2:C3' msg = 'Expect delete D4:E5 merge' level = if_aunit_constants=>critical ). ENDMETHOD. "delete_Merge METHOD get_dimension_range. cl_abap_unit_assert=>assert_equals( act = f_cut->get_dimension_range( ) exp = 'A1' msg = 'get_dimension_range inital value' level = if_aunit_constants=>critical ). f_cut->set_cell( ip_row = 2 ip_column = 3 ip_value = 'Dummy' ). f_cut->set_cell( ip_row = 5 ip_column = 6 ip_value = 'Dummy' ). cl_abap_unit_assert=>assert_equals( act = f_cut->get_dimension_range( ) exp = 'C2:F5' msg = 'get_dimension_range' level = if_aunit_constants=>critical ). ENDMETHOD. ENDCLASS. "lcl_Excel_Worksheet_Test CLASS ltc_calculate_table_bottom_rig IMPLEMENTATION. METHOD simple. APPEND INITIAL LINE TO test_table. APPEND INITIAL LINE TO test_table. field_catalog_line-dynpfld = abap_true. field_catalog_line-fieldname = 'COL1'. APPEND field_catalog_line TO field_catalog. field_catalog_line-dynpfld = abap_true. field_catalog_line-fieldname = 'COL2'. APPEND field_catalog_line TO field_catalog. table_settings-top_left_column = 'A'. table_settings-top_left_row = '1'. zcl_excel_worksheet=>calculate_table_bottom_right( EXPORTING ip_table = test_table it_field_catalog = field_catalog CHANGING cs_settings = table_settings ). cl_abap_unit_assert=>assert_equals( act = table_settings-bottom_right_column exp = 'B' ). cl_abap_unit_assert=>assert_equals( act = table_settings-bottom_right_row exp = 3 ). ENDMETHOD. METHOD empty_table. field_catalog_line-dynpfld = abap_true. field_catalog_line-fieldname = 'COL1'. APPEND field_catalog_line TO field_catalog. table_settings-top_left_column = 'B'. table_settings-top_left_row = '2'. zcl_excel_worksheet=>calculate_table_bottom_right( EXPORTING ip_table = test_table it_field_catalog = field_catalog CHANGING cs_settings = table_settings ). cl_abap_unit_assert=>assert_equals( act = table_settings-bottom_right_column exp = 'B' ). cl_abap_unit_assert=>assert_equals( act = table_settings-bottom_right_row exp = 2 ). ENDMETHOD. METHOD column_not_selected. APPEND INITIAL LINE TO test_table. field_catalog_line-dynpfld = abap_true. field_catalog_line-fieldname = 'COL1'. APPEND field_catalog_line TO field_catalog. field_catalog_line-dynpfld = abap_false. field_catalog_line-fieldname = 'COL2'. APPEND field_catalog_line TO field_catalog. table_settings-top_left_column = 'B'. table_settings-top_left_row = '2'. zcl_excel_worksheet=>calculate_table_bottom_right( EXPORTING ip_table = test_table it_field_catalog = field_catalog CHANGING cs_settings = table_settings ). cl_abap_unit_assert=>assert_equals( act = table_settings-bottom_right_column exp = 'B' ). cl_abap_unit_assert=>assert_equals( act = table_settings-bottom_right_row exp = 3 ). ENDMETHOD. ENDCLASS. CLASS ltc_check_cell_column_formula IMPLEMENTATION. METHOD setup. DATA: ls_column_formula TYPE zcl_excel_worksheet=>mty_s_column_formula. c_messages = zcl_excel_worksheet=>c_messages. " Column Formula in table A1:B4 (for unknown reason, bottom_right_row is last actual row minus 1) CLEAR ls_column_formula. ls_column_formula-id = 1. ls_column_formula-column = 1. ls_column_formula-table_top_left_row = 1. ls_column_formula-table_bottom_right_row = 3. ls_column_formula-table_left_column_int = 1. ls_column_formula-table_right_column_int = 2. INSERT ls_column_formula INTO TABLE mt_column_formulas. " Column Formula in table D1:E4 (for unknown reason, bottom_right_row is last actual row minus 1) CLEAR ls_column_formula. ls_column_formula-id = 2. ls_column_formula-column = 4. ls_column_formula-table_top_left_row = 1. ls_column_formula-table_bottom_right_row = 3. ls_column_formula-table_left_column_int = 4. ls_column_formula-table_right_column_int = 5. INSERT ls_column_formula INTO TABLE mt_column_formulas. ENDMETHOD. METHOD success. zcl_excel_worksheet=>check_cell_column_formula( it_column_formulas = mt_column_formulas ip_column_formula_id = 1 ip_formula = '' ip_value = '' ip_row = 2 ip_column = 1 ). ENDMETHOD. METHOD fails_both_formula_id_value. should_fail( ip_formula_id = 1 ip_formula = '' ip_value = '3.14' ip_row = 2 ip_column = 1 ip_exp = c_messages-formula_id_only_is_possible ). ENDMETHOD. METHOD fails_both_formula_id_formula. should_fail( ip_formula_id = 1 ip_formula = 'A2' ip_value = '' ip_row = 2 ip_column = 1 ip_exp = c_messages-formula_id_only_is_possible ). ENDMETHOD. METHOD formula_id_not_found. should_fail( ip_formula_id = 3 ip_row = 1 ip_column = 1 ip_exp = c_messages-column_formula_id_not_found ). ENDMETHOD. METHOD outside_table_fails__above. should_fail( ip_formula_id = 2 ip_row = 1 ip_column = 1 ip_exp = c_messages-formula_not_in_this_table ). ENDMETHOD. METHOD outside_table_fails__below. should_fail( ip_formula_id = 2 ip_row = 5 ip_column = 1 ip_exp = c_messages-formula_not_in_this_table ). ENDMETHOD. METHOD outside_table_fails__left. should_fail( ip_formula_id = 2 ip_row = 2 ip_column = 0 ip_exp = c_messages-formula_not_in_this_table ). ENDMETHOD. METHOD outside_table_fails__right. should_fail( ip_formula_id = 2 ip_row = 2 ip_column = 3 ip_exp = c_messages-formula_not_in_this_table ). ENDMETHOD. METHOD must_be_in_same_column. should_fail( ip_formula_id = 1 ip_row = 2 ip_column = 2 ip_exp = c_messages-formula_in_other_column ). ENDMETHOD. METHOD should_fail. DATA: lo_exception TYPE REF TO zcx_excel. TRY. zcl_excel_worksheet=>check_cell_column_formula( EXPORTING it_column_formulas = mt_column_formulas ip_column_formula_id = ip_formula_id ip_formula = ip_formula ip_value = ip_value ip_row = ip_row ip_column = ip_column ). cl_abap_unit_assert=>fail( msg = |Should have failed with error "{ ip_exp }"| ). CATCH zcx_excel INTO lo_exception. cl_abap_unit_assert=>assert_equals( act = lo_exception->get_text( ) exp = ip_exp msg = ip_exp ). ENDTRY. ENDMETHOD. ENDCLASS. CLASS ltc_check_overlapping IMPLEMENTATION. METHOD setup. table_1_settings-top_left_column = 'C'. table_1_settings-top_left_row = 3. table_1_settings-bottom_right_column = 'D'. table_1_settings-bottom_right_row = 4. ENDMETHOD. METHOD no_overlap_top. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'C'. input-table_settings-top_left_row = 1. input-table_settings-bottom_right_column = 'D'. input-table_settings-bottom_right_row = 2. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_false. assert( input = input exp = exp ). ENDMETHOD. METHOD no_overlap_left. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'A'. input-table_settings-top_left_row = 3. input-table_settings-bottom_right_column = 'B'. input-table_settings-bottom_right_row = 4. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_false. assert( input = input exp = exp ). ENDMETHOD. METHOD no_overlap_bottom. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'C'. input-table_settings-top_left_row = 5. input-table_settings-bottom_right_column = 'D'. input-table_settings-bottom_right_row = 6. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_false. assert( input = input exp = exp ). ENDMETHOD. METHOD no_overlap_right. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'E'. input-table_settings-top_left_row = 3. input-table_settings-bottom_right_column = 'F'. input-table_settings-bottom_right_row = 4. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_false. assert( input = input exp = exp ). ENDMETHOD. METHOD overlap_top. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'C'. input-table_settings-top_left_row = 2. input-table_settings-bottom_right_column = 'D'. input-table_settings-bottom_right_row = 3. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD overlap_left. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'B'. input-table_settings-top_left_row = 3. input-table_settings-bottom_right_column = 'C'. input-table_settings-bottom_right_row = 4. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD overlap_bottom. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'C'. input-table_settings-top_left_row = 4. input-table_settings-bottom_right_column = 'D'. input-table_settings-bottom_right_row = 5. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD overlap_right. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-table_settings-top_left_column = 'D'. input-table_settings-top_left_row = 3. input-table_settings-bottom_right_column = 'E'. input-table_settings-bottom_right_row = 4. APPEND table_1_settings TO input-other_table_settings. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD assert. DATA: error TYPE REF TO zcx_excel. FIELD-SYMBOLS: <table> TYPE STANDARD TABLE. TRY. zcl_excel_worksheet=>check_table_overlapping( is_table_settings = input-table_settings it_other_table_settings = input-other_table_settings ). IF exp-fails = abap_true. cl_abap_unit_assert=>fail( msg = 'Overlap exists, exception was expected' ). ENDIF. CATCH zcx_excel INTO error. IF exp-fails = abap_false. RAISE EXCEPTION error. ENDIF. RETURN. ENDTRY. ENDMETHOD. ENDCLASS. CLASS ltc_normalize_column_heading IMPLEMENTATION. METHOD setup. DATA: lo_excel TYPE REF TO zcl_excel. CREATE OBJECT lo_excel. TRY. CREATE OBJECT cut EXPORTING ip_excel = lo_excel. CATCH zcx_excel. cl_abap_unit_assert=>fail( 'Could not create instance' ). ENDTRY. ENDMETHOD. METHOD prefer_small_text. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output, field TYPE zexcel_s_fieldcatalog. input-default_descr = 'S'. field-dynpfld = abap_true. field-scrtext_s = 'Column1_S'. field-scrtext_m = 'Column1_M'. field-scrtext_l = 'Column1_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column1_S'. APPEND field TO exp-field_catalog. field-scrtext_s = ''. field-scrtext_m = 'Column2_M'. field-scrtext_l = 'Column2_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column2_M'. APPEND field TO exp-field_catalog. field-scrtext_s = ''. field-scrtext_m = 'Column3_M'. field-scrtext_l = ''. APPEND field TO input-field_catalog. field-scrtext_l = 'Column3_M'. APPEND field TO exp-field_catalog. field-scrtext_s = ''. field-scrtext_m = ''. field-scrtext_l = 'Column4_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column4_L'. APPEND field TO exp-field_catalog. assert( input = input exp = exp ). ENDMETHOD. METHOD prefer_medium_text. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output, field TYPE zexcel_s_fieldcatalog. input-default_descr = 'M'. field-dynpfld = abap_true. field-scrtext_s = 'Column1_S'. field-scrtext_m = 'Column1_M'. field-scrtext_l = 'Column1_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column1_M'. APPEND field TO exp-field_catalog. field-scrtext_s = 'Column2_S'. field-scrtext_m = ''. field-scrtext_l = 'Column2_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column2_S'. APPEND field TO exp-field_catalog. field-scrtext_s = 'Column3_S'. field-scrtext_m = ''. field-scrtext_l = ''. APPEND field TO input-field_catalog. field-scrtext_l = 'Column3_S'. APPEND field TO exp-field_catalog. field-scrtext_s = ''. field-scrtext_m = ''. field-scrtext_l = 'Column4_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column4_L'. APPEND field TO exp-field_catalog. assert( input = input exp = exp ). ENDMETHOD. METHOD prefer_long_text. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output, field TYPE zexcel_s_fieldcatalog. input-default_descr = 'L'. field-dynpfld = abap_true. field-scrtext_s = 'Column1_S'. field-scrtext_m = 'Column1_M'. field-scrtext_l = 'Column1_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column1_L'. APPEND field TO exp-field_catalog. field-scrtext_s = 'Column2_S'. field-scrtext_m = 'Column2_M'. field-scrtext_l = ''. APPEND field TO input-field_catalog. field-scrtext_l = 'Column2_M'. APPEND field TO exp-field_catalog. field-scrtext_s = 'Column3_S'. field-scrtext_m = ''. field-scrtext_l = ''. APPEND field TO input-field_catalog. field-scrtext_l = 'Column3_S'. APPEND field TO exp-field_catalog. assert( input = input exp = exp ). ENDMETHOD. METHOD default_text_if_none. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output, field TYPE zexcel_s_fieldcatalog. input-default_descr = 'S'. field-dynpfld = abap_true. field-scrtext_s = ''. field-scrtext_m = ''. field-scrtext_l = ''. APPEND field TO input-field_catalog. field-scrtext_l = 'Column'. APPEND field TO exp-field_catalog. field-scrtext_s = ''. field-scrtext_m = ''. field-scrtext_l = ''. APPEND field TO input-field_catalog. field-scrtext_l = 'Column 1'. APPEND field TO exp-field_catalog. assert( input = input exp = exp ). ENDMETHOD. METHOD invalid_default_descr. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output, field TYPE zexcel_s_fieldcatalog. input-default_descr = '?'. field-dynpfld = abap_true. field-scrtext_s = 'Column1_S'. field-scrtext_m = 'Column1_M'. field-scrtext_l = 'Column1_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column1_M'. APPEND field TO exp-field_catalog. field-scrtext_s = 'Column2_S'. field-scrtext_m = ''. field-scrtext_l = 'Column2_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column2_S'. APPEND field TO exp-field_catalog. field-scrtext_s = 'Column3_S'. field-scrtext_m = ''. field-scrtext_l = ''. APPEND field TO input-field_catalog. field-scrtext_l = 'Column3_S'. APPEND field TO exp-field_catalog. field-scrtext_s = ''. field-scrtext_m = ''. field-scrtext_l = 'Column4_L'. APPEND field TO input-field_catalog. field-scrtext_l = 'Column4_L'. APPEND field TO exp-field_catalog. assert( input = input exp = exp ). ENDMETHOD. METHOD assert. DATA: act TYPE ty_parameters-output. act-field_catalog = cut->normalize_column_heading_texts( iv_default_descr = input-default_descr it_field_catalog = input-field_catalog ). cl_abap_unit_assert=>assert_equals( exp = exp-field_catalog act = act-field_catalog ). ENDMETHOD. ENDCLASS. CLASS ltc_normalize_columnrow_param IMPLEMENTATION. METHOD setup. DATA: lo_excel TYPE REF TO zcl_excel. CREATE OBJECT lo_excel. TRY. CREATE OBJECT cut EXPORTING ip_excel = lo_excel. CATCH zcx_excel. cl_abap_unit_assert=>fail( 'Could not create instance' ). ENDTRY. ENDMETHOD. METHOD test. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-columnrow = 'B4'. exp-column = 2. exp-row = 4. assert( input = input exp = exp ). ENDMETHOD. METHOD all_parameters_passed. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-columnrow = 'B4'. input-column = 'B'. input-row = 4. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD none_parameter_passed. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD assert. DATA: act TYPE ty_parameters-output, error TYPE REF TO zcx_excel, input_text TYPE string, message TYPE string. TRY. cut->normalize_columnrow_parameter( EXPORTING ip_columnrow = input-columnrow ip_column = input-column ip_row = input-row IMPORTING ep_column = act-column ep_row = act-row ). IF exp-fails = abap_true. message = |Should have failed for { input_text }|. cl_abap_unit_assert=>fail( msg = message ). ENDIF. CATCH zcx_excel INTO error. IF exp-fails = abap_false. RAISE EXCEPTION error. ENDIF. RETURN. ENDTRY. input_text = |input column/row { input-columnrow }, column { input-column }, row { input-row }|. message = |Invalid column for { input_text }|. cl_abap_unit_assert=>assert_equals( msg = message exp = exp-column act = act-column ). message = |Invalid row for { input_text }|. cl_abap_unit_assert=>assert_equals( msg = message exp = exp-row act = act-row ). ENDMETHOD. ENDCLASS. CLASS ltc_normalize_range_param IMPLEMENTATION. METHOD setup. DATA: lo_excel TYPE REF TO zcl_excel. CREATE OBJECT lo_excel. TRY. CREATE OBJECT cut EXPORTING ip_excel = lo_excel. CATCH zcx_excel. cl_abap_unit_assert=>fail( 'Could not create instance' ). ENDTRY. ENDMETHOD. METHOD range_one_cell. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. CLEAR: input, exp. input-range = 'B4:B4'. exp-column_start = 2. exp-column_end = 2. exp-row_start = 4. exp-row_end = 4. assert( input = input exp = exp ). ENDMETHOD. METHOD relative_range. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. CLEAR: input, exp. input-range = 'B4:AA10'. exp-column_start = 2. exp-column_end = 27. exp-row_start = 4. exp-row_end = 10. assert( input = input exp = exp ). ENDMETHOD. METHOD absolute_range. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. CLEAR: input, exp. input-range = '$B$4:$AA$10'. exp-column_start = 2. exp-column_end = 27. exp-row_start = 4. exp-row_end = 10. assert( input = input exp = exp ). ENDMETHOD. METHOD invalid_range. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. CLEAR: input, exp. input-range = 'B4'. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD reverse_range_not_supported. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. CLEAR: input, exp. input-range = 'B4:A1'. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD all_parameters_passed. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-range = 'B4:B4'. input-column_start = 'B'. input-row = 4. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD none_parameter_passed. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. exp-fails = abap_true. assert( input = input exp = exp ). ENDMETHOD. METHOD start_without_end. DATA: input TYPE ty_parameters-input, exp TYPE ty_parameters-output. input-column_start = 'B'. input-row = 4. exp-column_start = 2. exp-column_end = 2. exp-row_start = 4. exp-row_end = 4. assert( input = input exp = exp ). ENDMETHOD. METHOD assert. DATA: act TYPE ty_parameters-output, error TYPE REF TO zcx_excel, input_text TYPE string, message TYPE string. input_text = |input range { input-range }, column start { input-column_start }, column end { input-column_end }|. TRY. cut->normalize_range_parameter( EXPORTING ip_range = input-range ip_column_start = input-column_start ip_column_end = input-column_end ip_row = input-row ip_row_to = input-row_to IMPORTING ep_column_start = act-column_start ep_column_end = act-column_end ep_row = act-row_start ep_row_to = act-row_end ). IF exp-fails = abap_true. message = |Should have failed for { input_text }|. cl_abap_unit_assert=>fail( msg = message ). ENDIF. CATCH zcx_excel INTO error. IF exp-fails = abap_false. RAISE EXCEPTION error. ENDIF. RETURN. ENDTRY. message = |Invalid column start for { input_text }|. cl_abap_unit_assert=>assert_equals( msg = message exp = exp-column_start act = act-column_start ). message = |Invalid column end for { input_text }|. cl_abap_unit_assert=>assert_equals( msg = message exp = exp-column_end act = act-column_end ). message = |Invalid row start for { input_text }|. cl_abap_unit_assert=>assert_equals( msg = message exp = exp-row_start act = act-row_start ). message = |Invalid row start for { input_text }|. cl_abap_unit_assert=>assert_equals( msg = message exp = exp-row_end act = act-row_end ). ENDMETHOD. ENDCLASS. CLASS ltc_normalize_style_param IMPLEMENTATION. METHOD setup. CREATE OBJECT excel. TRY. CREATE OBJECT cut EXPORTING ip_excel = excel. CATCH zcx_excel. cl_abap_unit_assert=>fail( 'Could not create instance' ). ENDTRY. ENDMETHOD. METHOD ref_to_zcl_excel_style. DATA: style TYPE REF TO zcl_excel_style. style = excel->add_new_style( ). exp-fails = abap_false. exp-guid = style->get_guid( ). assert( input = style exp = exp ). ENDMETHOD. METHOD zexcel_cell_style. DATA: style TYPE REF TO zcl_excel_style. style = excel->add_new_style( ). exp-fails = abap_false. exp-guid = style->get_guid( ). assert( input = exp-guid exp = exp ). ENDMETHOD. METHOD raw_16_bytes. DATA: raw_16_bytes TYPE x LENGTH 16. raw_16_bytes = 'A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1A1'. exp-fails = abap_false. exp-guid = raw_16_bytes. assert( input = raw_16_bytes exp = exp ). ENDMETHOD. METHOD other. exp-fails = abap_true. assert( input = 'A' exp = exp ). ENDMETHOD. METHOD assert. DATA: rtti TYPE REF TO cl_abap_typedescr, message TYPE string, act TYPE zexcel_cell_style, error TYPE REF TO zcx_excel, input_text TYPE string. rtti = cl_abap_typedescr=>describe_by_data( input ). IF rtti->type_kind = rtti->typekind_oref. rtti = cl_abap_typedescr=>describe_by_object_ref( input ). input_text = |REF TO { rtti->absolute_name }|. ELSE. input_text = rtti->absolute_name. ENDIF. TRY. act = cut->normalize_style_parameter( input ). IF exp-fails = abap_true. message = |Input type { input_text } accepted but only REF TO \\CLASS=ZCL_EXCEL_STYLE, \\TYPE=ZEXCEL_CELL_STYLE or any X type are supported|. cl_abap_unit_assert=>fail( msg = message ). ENDIF. CATCH zcx_excel INTO error. IF exp-fails = abap_false. message = |Input type { input_text } made it fail but it should succeed with result { exp-guid }|. cl_abap_unit_assert=>fail( msg = message ). ENDIF. RETURN. ENDTRY. cl_abap_unit_assert=>assert_equals( exp = exp-guid act = act ). ENDMETHOD. ENDCLASS. CLASS ltc_set_cell_value_types IMPLEMENTATION. METHOD setup. CREATE OBJECT excel. TRY. CREATE OBJECT cut EXPORTING ip_excel = excel. CATCH zcx_excel. cl_abap_unit_assert=>fail( 'Could not create instance' ). ENDTRY. ENDMETHOD. METHOD int8. DATA: ref_int8 TYPE REF TO data, int8 TYPE int8 VALUE 33400000000. FIELD-SYMBOLS: <value> TYPE simple, <typekind_int8> TYPE abap_typekind. ASSIGN ('CL_ABAP_TYPEDESCR=>TYPEKIND_INT8') TO <typekind_int8>. IF sy-subrc <> 0. cl_abap_unit_assert=>fail( msg = 'Test skipped with old kernel (INT8 not supported)' level = if_aunit_constants=>tolerable ). RETURN. ENDIF. CREATE DATA ref_int8 TYPE ('INT8'). ASSIGN ref_int8->* TO <value>. <value> = 33400000000. assert( input = <value> exp = '33400000000' ). ENDMETHOD. METHOD assert. DATA: act TYPE string, message TYPE string. cut->set_cell( ip_column = 'A' ip_row = 1 ip_value = input ). cut->get_cell( EXPORTING ip_column = 'A' ip_row = 1 IMPORTING ep_value = act ). IF act <> exp. message = |Input value '{ input }' turns into { act } instead of { exp }|. cl_abap_unit_assert=>fail( msg = message ). ENDIF. ENDMETHOD. ENDCLASS.
27.494424
151
0.655084
980cd02e923bfb89d90d79bbe33564aaf309117b
18,908
abap
ABAP
src/zcl_ibmc_util.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_util.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_util.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_UTIL definition public final create public . public section. "! Converts an internal table to JSON string in table schema format. "! E.g.: '&#123;"fields": ["PET", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]&#125;' "! "! @parameter I_ITAB | Internal table to be converted. "! @parameter I_DICTIONARY | Dictionary to be used for mapping ABAP identifiers to JSON keys. "! @parameter I_LOWER_CASE | If set to C_BOOLEAN_TRUE all keys in JSON string will be lower case. "! @parameter IT_EXCLUDED_FIELDS | Internal table of table fields in I_ITAB that should not occur in result. "! @parameter E_JSON | JSON string. "! class-methods ITAB_TO_TABLESCHEMA importing !I_ITAB type ANY TABLE !I_DICTIONARY type ANY optional !I_LOWER_CASE type ZCL_IBMC_SERVICE=>BOOLEAN default ZCL_IBMC_SERVICE=>C_BOOLEAN_FALSE !IT_EXCLUDED_FIELDS type ZCL_IBMC_SERVICE=>TT_STRING optional returning value(E_JSON) type STRING . "! Converts a JSON string in table schema format to an internal table. "! E.g.: '&#123;"tableschema_key": &#123;"fields": ["PET", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]&#125;&#125;' "! "! @parameter I_JSON | JSON string. "! @parameter I_TABLESCHEMA_KEY | Key in JSON string that holds the table schema. "! @parameter E_ITAB | Internal table containing converted data. "! class-methods TABLESCHEMA_TO_ITAB importing !I_JSON type STRING !I_TABLESCHEMA_KEY type STRING optional exporting !E_ITAB type ANY TABLE . "! Converts a timestamp in UTC to a timestamp in local time. "! "! @parameter IV_TIMESTAMP | Timestamp (UTC). "! @parameter EV_LOCAL | Timestamp (local time). "! class-methods CONVERT_TIMESTAMP_TO_LOCAL importing !IV_TIMESTAMP type TIMESTAMP returning value(EV_LOCAL) type STRING . "! Determine MIME type from a file name, e.g. 'docu.txt' -&gt; 'text_/plain'. "! "! @parameter I_FILENAME | Filename with extension. "! @parameter E_MIMETYPE | MIME type. "! class-methods GET_MIMETYPE_FROM_EXTENSION importing !I_FILENAME type STRING returning value(E_MIMETYPE) type STRING . "! Converts a timestamp in UTC to a timestamp in another timezone. "! "! @parameter I_TIMESTAMP | Timestamp (UTC). "! @parameter I_TIMEZONE | Time zone "! @parameter E_TIMESTAMP | Timestamp in give time zone. "! class-methods UTC_TO_TIMEZONE importing !I_TIMESTAMP type TIMESTAMP !I_TIMEZONE type ZIF_IBMC_SERVICE_ARCH=>TY_TIMEZONE optional returning value(E_TIMESTAMP) type TIMESTAMP . "! Converts datetime format to a timestamp, i.e. yyyy-mm-ddThh:mm:ssZ -&gt; YYYYMMDDHHMMSS "! "! @parameter I_DATETIME | Input in datetime format. "! @parameter E_TIMESTAMP | Timestamp. "! class-methods CONVERT_DATETIME_TO_TIMESTAMP importing !I_DATETIME type ZCL_IBMC_SERVICE=>DATETIME returning value(E_TIMESTAMP) type TIMESTAMP . "! Converts a timestamp to datetime format, i.e. YYYYMMDDHHMMSS -&gt; yyyy-mm-ddThh:mm:ssZ "! "! @parameter I_TIMESTAMP | Timestamp. "! @parameter E_DATETIME | Datetime format. "! class-methods CONVERT_TIMESTAMP_TO_DATETIME importing !I_TIMESTAMP type TIMESTAMP returning value(E_DATETIME) type ZCL_IBMC_SERVICE=>DATETIME . protected section. private section. ENDCLASS. CLASS ZCL_IBMC_UTIL IMPLEMENTATION. method CONVERT_DATETIME_TO_TIMESTAMP. constants: c_zero type timestamp value '0'. " avoid conversion at runtime " check if input string applies to schema yyyy-mm-ddThh:mm:ssZ if i_datetime cp '++++-++-++T++:++:++*'. try. e_timestamp = i_datetime(4) * 10000000000 + i_datetime+5(2) * 100000000 + i_datetime+8(2) * 1000000 + i_datetime+11(2) * 10000 + i_datetime+14(2) * 100 + i_datetime+17(2). catch cx_sy_conversion_no_number. " invalid input e_timestamp = c_zero. endtry. else. " invalid input e_timestamp = c_zero. endif. endmethod. method CONVERT_TIMESTAMP_TO_DATETIME. data: lv_year(4) type n, lv_month(2) type n, lv_day(2) type n, lv_hour(2) type n, lv_min(2) type n, lv_sec(2) type n, lv_rest type timestamp. lv_rest = i_timestamp. lv_year = lv_rest div 10000000000. lv_rest = lv_rest - ( lv_year * 10000000000 ). lv_month = lv_rest div 100000000. lv_rest = lv_rest - ( lv_month * 100000000 ). lv_day = lv_rest div 1000000. lv_rest = lv_rest - ( lv_day * 1000000 ). lv_hour = lv_rest div 10000. lv_rest = lv_rest - ( lv_hour * 10000 ). lv_min = lv_rest div 100. lv_rest = lv_rest - ( lv_min * 100 ). lv_sec = lv_rest div 1. " type conversion concatenate lv_year '-' lv_month '-' lv_day 'T' lv_hour ':' lv_min ':' lv_sec 'Z' into e_datetime. endmethod. method convert_timestamp_to_local. data: lv_dats type d, lv_tims type t, lv_timezone type zif_ibmc_service_arch=>ty_timezone, lv_datc(10) type c, lv_timc(8) type c. " split timestamp to date and time according to time zone lv_timezone = zcl_ibmc_service_arch=>get_timezone( ). convert time stamp iv_timestamp time zone lv_timezone into date lv_dats time lv_tims. " write date and time to string using local date/time format lv_datc = conv #( lv_dats ). lv_timc = conv #( lv_tims ). concatenate lv_datc lv_timc into ev_local separated by space. endmethod. method get_mimetype_from_extension. data: l_extension type string. if i_filename is initial. e_mimetype = zif_ibmc_service_arch=>c_mediatype-all. exit. endif. find regex '\.([^\.]*)$' in i_filename submatches l_extension. if sy-subrc <> 0. l_extension = i_filename. endif. translate l_extension to lower case. case l_extension. when 'jpg' or 'jpeg'. e_mimetype = zif_ibmc_service_arch=>c_mediatype-image_jpeg. when 'png'. e_mimetype = zif_ibmc_service_arch=>c_mediatype-image_png. when 'txt'. e_mimetype = zif_ibmc_service_arch=>c_mediatype-text_plain. when 'csv'. e_mimetype = zif_ibmc_service_arch=>c_mediatype-text_csv. when others. e_mimetype = `application/` && l_extension ##NO_TEXT. endcase. endmethod. method itab_to_tableschema. " Converts an internal table to a JSON object string with keys "fields" and "values". " Example: I_ITAB = | PET | NUMBER | " ------------------- " | Cat | 5 | " | Rabbit | 2 | " --> E_JSON = '{"fields": ["PET", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]}' " Field names are mapped according to I_DICTIONARY. " Example: BEGIN OF i_dictionary, " PET type string value 'MyPet', " END OF i_dictionary. " --> E_JSON = '{"fields": ["MyPet", "NUMBER"], "values": [["Cat",5],["Rabbit",2]]}' " Field names are translated to lower case, if I_LOWER_CASE = zcl_ibmc_service=>c_boolean_true. " Field types must be elementary or table of elementary. " Field names in table IT_EXCLUDED_FIELDS are skipped and will not appear in the JSON string. data: lt_comp type cl_abap_structdescr=>component_table, ls_comp like line of lt_comp, lo_datadescr type ref to cl_abap_datadescr, lo_tabledesc type ref to cl_abap_tabledescr, lo_struct type ref to cl_abap_structdescr, lv_fieldname type string, lv_sep1(1) type c, lv_sep2(1) type c, lv_sep3(1) type c. field-symbols: <ls_itab_line> type any, <lv_comp> type any, <lt_comp> type any table, <lv_jsonname> type string. " the following data type are character-like, thus the according values must be quoted data(lc_character_types) = cl_abap_datadescr=>typekind_char && cl_abap_datadescr=>typekind_clike && cl_abap_datadescr=>typekind_csequence && cl_abap_datadescr=>typekind_string && cl_abap_datadescr=>typekind_date && cl_abap_datadescr=>typekind_time && cl_abap_datadescr=>typekind_num. " get internal table fields lo_tabledesc ?= cl_abap_tabledescr=>describe_by_data( i_itab ). lo_struct ?= lo_tabledesc->get_table_line_type( ). lt_comp = lo_struct->get_components( ). " append field names to JSON string e_json = `{"fields": [` ##NO_TEXT. clear lv_sep1. loop at lt_comp into ls_comp. read table it_excluded_fields with key table_line = ls_comp-name transporting no fields. if sy-subrc = 0. continue. endif. lv_fieldname = ls_comp-name. if i_dictionary is supplied. assign component ls_comp-name of structure i_dictionary to <lv_jsonname>. if sy-subrc = 0. lv_fieldname = <lv_jsonname>. endif. endif. if i_lower_case eq zcl_ibmc_service=>c_boolean_true. translate lv_fieldname to lower case. endif. e_json = e_json && lv_sep1 && `"` && lv_fieldname && `"`. lv_sep1 = `,`. endloop. " append values to JSON string e_json = e_json && `], "values": [` ##NO_TEXT. clear lv_sep1. loop at i_itab assigning <ls_itab_line>. " loop on itab records clear lv_sep2. e_json = e_json && lv_sep1 && `[`. loop at lt_comp into ls_comp. " loop on record fields read table it_excluded_fields with key table_line = ls_comp-name transporting no fields. if sy-subrc = 0. continue. endif. if ls_comp-type->type_kind eq cl_abap_datadescr=>typekind_table. " field type is subtable, get line type assign component ls_comp-name of structure <ls_itab_line> to <lt_comp>. lo_tabledesc ?= cl_abap_tabledescr=>describe_by_data( <lt_comp> ). lo_datadescr = lo_tabledesc->get_table_line_type( ). " add field values of subtable to JSON string clear lv_sep3. e_json = e_json && lv_sep2 && `[`. loop at <lt_comp> assigning <lv_comp>. if lo_datadescr->type_kind ca lc_character_types. e_json = e_json && lv_sep3 && `"` && <lv_comp> && `"`. else. e_json = e_json && lv_sep3 && <lv_comp>. endif. lv_sep3 = `,`. endloop. e_json = e_json && `]`. else. " field type is elementary, add field value to JSON string assign component ls_comp-name of structure <ls_itab_line> to <lv_comp>. if ls_comp-type->type_kind ca lc_character_types. e_json = e_json && lv_sep2 && `"` && <lv_comp> && `"`. else. e_json = e_json && lv_sep2 && <lv_comp>. endif. endif. lv_sep2 = `,`. endloop. e_json = e_json && `]`. lv_sep1 = `,`. endloop. e_json = e_json && `]}` ##NO_TEXT. endmethod. method tableschema_to_itab. data: lt_comp type cl_abap_structdescr=>component_table, ls_comp like line of lt_comp, lv_field type string, lt_field type standard table of string, lv_fieldname type string, lv_tabix type i, lv_tableschema_key type string, lo_structdescr type ref to cl_abap_structdescr, lo_datadescr type ref to cl_abap_datadescr, lo_tabledescr type ref to cl_abap_tabledescr, lr_values type ref to data, lr_comp type ref to data, lr_data type ref to data, lv_json type string. field-symbols: <lr_data> type ref to data, <lt_field> type any table, <la_comp> type any, <lv_comp> type any, <lt_comp> type any table, <ls_root> type any, <ls_parsed> type any, <lr_values_tab> type ref to data, <lt_values_tab> type any table, <lt_values> type any table, <ls_itab> type any, <lt_itab> type any table, <lt_ref> type any table. " dynamically create data structure: " begin of <ls_root>, " tableschema_key type ref to data, " end of <ls_root>. if i_tableschema_key is initial. lv_json = `{ "tableschema_key": ` && i_json && ` }` ##NO_TEXT. lv_tableschema_key = `tableschema_key` ##NO_TEXT. else. lv_json = i_json. lv_tableschema_key = i_tableschema_key. endif. ls_comp-name = lv_tableschema_key. ls_comp-type ?= cl_abap_datadescr=>describe_by_data( lr_data ). append ls_comp to lt_comp. lo_structdescr = cl_abap_structdescr=>create( lt_comp ). create data lr_data type handle lo_structdescr. assign lr_data->* to <ls_root>. " parse JSON try. zcl_ibmc_service=>parse_json( exporting i_json = lv_json "i_dictionary = c_abapname_dictionary changing c_abap = <ls_root> ). catch zcx_ibmc_service_exception. return. endtry. assign component lv_tableschema_key of structure <ls_root> to <lr_data>. assign <lr_data>->* to <ls_parsed>. unassign <lr_values_tab>. assign component 'VALUES' of structure <ls_parsed> to <lr_values_tab>. " I_JSON does not have table schema on highest level, check if any subkey has " check all components lo_structdescr ?= cl_abap_structdescr=>describe_by_data( <ls_parsed> ). clear lt_comp[]. lt_comp = lo_structdescr->get_components( ). loop at lt_comp into ls_comp. assign component ls_comp-name of structure <ls_parsed> to <lr_data>. lo_datadescr ?= cl_abap_datadescr=>describe_by_data_ref( <lr_data> ). if lo_datadescr->type_kind eq cl_abap_datadescr=>typekind_table. assign <lr_data>->* to <lt_comp>. loop at <lt_comp> assigning <lr_data> ##GEN_OK. exit. endloop. endif. assign <lr_data>->* to <la_comp>. assign component 'VALUES' of structure <la_comp> to <lr_values_tab>. if sy-subrc = 0. assign <la_comp> to <ls_parsed>. exit. endif. endloop. if not <lr_values_tab> is assigned. return. endif. assign <lr_values_tab>->* to <lt_values_tab>. assign component 'FIELDS' of structure <ls_parsed> to <lr_data>. if sy-subrc = 0. assign <lr_data>->* to <lt_field>. loop at <lt_field> assigning <lr_data> ##GEN_OK. assign <lr_data>->* to <la_comp>. append <la_comp> to lt_field. endloop. else. data(lv_count) = lines( <lt_values_tab> ). data(lv_index) = 0. while lv_index < lv_count. lv_fieldname = `FIELD` && lv_index. lv_index = lv_index + 1. append lv_fieldname to lt_field. endwhile. endif. " get data fields; read first values for reference if lines( <lt_values_tab> ) < 1. return. endif. loop at <lt_values_tab> into lr_data. assign lr_data->* to <lt_values>. exit. endloop. clear lt_comp[]. loop at <lt_values> into lr_values. " field name lv_tabix = lv_tabix + 1. read table lt_field index lv_tabix into lv_field. if sy-subrc <> 0. lv_field = `C` && lv_tabix. endif. ls_comp-name = lv_field. " read data type assign lr_values->* to <la_comp>. lo_datadescr ?= cl_abap_datadescr=>describe_by_data( <la_comp> ). if lo_datadescr->type_kind = cl_abap_structdescr=>typekind_table. " data type is internal table (of references) " -> create new internal table layout w/o references lo_tabledescr ?= cl_abap_tabledescr=>describe_by_data( <la_comp> ). lo_datadescr = lo_tabledescr->get_table_line_type( ). if lo_datadescr->type_kind = cl_abap_datadescr=>typekind_dref. assign <la_comp> to <lt_comp>. loop at <lt_comp> into lr_comp. exit. endloop. " read first table record lo_datadescr ?= cl_abap_datadescr=>describe_by_data_ref( lr_comp ). endif. ls_comp-type = cl_abap_tabledescr=>create( p_line_type = lo_datadescr ). else. ls_comp-type = lo_datadescr. endif. append ls_comp to lt_comp. endloop. " create data structure lo_structdescr = cl_abap_structdescr=>create( lt_comp ). create data lr_data type handle lo_structdescr. assign lr_data->* to <ls_itab>. create data lr_data like table of <ls_itab>. assign lr_data->* to <lt_itab>. " populate data structure loop at <lt_values_tab> into lr_data. assign lr_data->* to <lt_values>. if not <ls_itab> is assigned. create data lr_data type handle lo_structdescr. assign lr_data->* to <ls_itab>. endif. lv_tabix = 0. loop at <lt_values> into lr_values. lv_tabix = lv_tabix + 1. read table lt_comp index lv_tabix into ls_comp. case ls_comp-type->type_kind. when cl_abap_structdescr=>typekind_table. assign component ls_comp-name of structure <ls_itab> to <lt_comp>. assign lr_values->* to <lt_ref>. loop at <lt_ref> into lr_data. assign lr_data->* to <la_comp>. insert <la_comp> into table <lt_comp>. endloop. when others. assign component ls_comp-name of structure <ls_itab> to <lv_comp>. assign lr_values->* to <la_comp>. <lv_comp> = <la_comp>. endcase. endloop. insert <ls_itab> into table <lt_itab>. unassign <ls_itab>. " force data creation at next loop step endloop. move-corresponding <lt_itab> to e_itab. endmethod. method utc_to_timezone. data: lv_timezone type zif_ibmc_service_arch=>ty_timezone, lv_date type d, lv_time type t. if i_timezone is initial. lv_timezone = zcl_ibmc_service_arch=>get_timezone( ). else. lv_timezone = i_timezone. endif. convert time stamp i_timestamp time zone lv_timezone into date lv_date time lv_time. convert date lv_date time lv_time into time stamp e_timestamp time zone 'UTC'. endmethod. ENDCLASS.
33.824687
121
0.642321
98105146f82e4f68d6932d972c4050abdd24049b
24,792
abap
ABAP
src/zsdev_mxspool2csv.prog.abap
stefan-dv/TEST4ABAPGIT
e9a6f7589aecdb181749f027de3352d6f537e6af
[ "Apache-2.0" ]
null
null
null
src/zsdev_mxspool2csv.prog.abap
stefan-dv/TEST4ABAPGIT
e9a6f7589aecdb181749f027de3352d6f537e6af
[ "Apache-2.0" ]
null
null
null
src/zsdev_mxspool2csv.prog.abap
stefan-dv/TEST4ABAPGIT
e9a6f7589aecdb181749f027de3352d6f537e6af
[ "Apache-2.0" ]
null
null
null
REPORT zsdev_mxspool2csv. * *&—————————————————————————————————————————————————————————————————————* *& Report ZMXSPOOL2CSV * *& * *&—————————————————————————————————————————————————————————————————————* *& Converts spool request into csv document and emails it to * *& recipicant. * *& * *& Execution * *&—————————————————————————————————————————————————————————————————————* *& This program must be run as a background job in-order for the write * *& commands to create a Spool request rather than be displayed on * *& screen * *&—————————————————————————————————————————————————————————————————————* TABLES: tsp01. SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1 NO INTERVALS. PARAMETER: p_job LIKE tbtcp-jobname. PARAMETER: p_job_al AS CHECKBOX. "Mail spools of all job steps PARAMETER: p_step LIKE tbtcp-stepcount. PARAMETER: p_spono LIKE tsp01-rqident. PARAMETER: p_delspl AS CHECKBOX. PARAMETER: p_otf AS CHECKBOX. PARAMETER: p_mlnout AS CHECKBOX. "Send mail when no spool output PARAMETER: p_mlnoui LIKE solisti1-line. "Inform. text when no output PARAMETER: p_skphdr AS CHECKBOX. PARAMETER: p_skip TYPE i. SELECTION-SCREEN END OF BLOCK bl1. SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-bl2 NO INTERVALS. PARAMETER: p_email0 LIKE somlreci1-receiver. * DEFAULT '[email protected]'. PARAMETER: p_email1 LIKE somlreci1-receiver. PARAMETER: p_email2 LIKE somlreci1-receiver. PARAMETER: p_email3 LIKE somlreci1-receiver. PARAMETER: p_email4 LIKE somlreci1-receiver. PARAMETER: p_email5 LIKE somlreci1-receiver. PARAMETER: p_email6 LIKE somlreci1-receiver. PARAMETER: p_email7 LIKE somlreci1-receiver. PARAMETER: p_email8 LIKE somlreci1-receiver. PARAMETER: p_email9 LIKE somlreci1-receiver. PARAMETER: p_sender LIKE somlreci1-receiver. PARAMETER: p_subj LIKE sodocchgi1-obj_descr DEFAULT 'Subject'. PARAMETER: p_body1 LIKE solisti1-line DEFAULT 'Message Body text, line 1'. PARAMETER: p_body2 LIKE solisti1-line DEFAULT 'Message Body text, line 2'. PARAMETER: p_body3 LIKE solisti1-line DEFAULT 'Message Body text, line 3'. PARAMETER: p_atdesc LIKE solisti1 DEFAULT 'Example.csv document attachment'. PARAMETER: p_atname LIKE solisti1 DEFAULT 'Attachname'. SELECTION-SCREEN END OF BLOCK bl2. *DATA DECLARATION DATA: gd_recsize TYPE i. * Spool IDs TYPES: BEGIN OF t_tbtcp. INCLUDE STRUCTURE tbtcp. TYPES: END OF t_tbtcp. DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0, wa_tbtcp TYPE t_tbtcp. DATA: w_spool_nr LIKE tsp01-rqident. * Job Runtime Parameters DATA: gd_eventid LIKE tbtcm-eventid, gd_eventparm LIKE tbtcm-eventparm, gd_external_program_active LIKE tbtcm-xpgactive, gd_jobcount LIKE tbtcm-jobcount, gd_jobname LIKE tbtcm-jobname, gd_stepcount LIKE tbtcm-stepcount, gd_jobname_current LIKE tbtcm-jobname, gd_stepcount_current LIKE tbtcm-stepcount, gd_error TYPE sy-subrc, gd_reciever TYPE sy-subrc. DATA: w_recsize TYPE i. DATA: tab_lines LIKE sy-tabix. DATA: tab_lines1 LIKE sy-tabix. DATA: gd_subject LIKE sodocchgi1-obj_descr, it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE, it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE, gd_sender_type LIKE soextreci1-adr_typ, gd_attachment_desc TYPE so_obj_nam, gd_attachment_name TYPE so_obj_des. DATA: BEGIN OF it_attach OCCURS 0, spool_id LIKE tsp01-rqident, content_bin LIKE solisti1 OCCURS 0. DATA: END OF it_attach. *Printer params DATA: params LIKE pri_params, days(1) TYPE n VALUE 2, count(3) TYPE n VALUE 1, valid TYPE c. DATA: gd_objtype LIKE rststype-type. * Spool to csv conversions DATA: gd_spool_nr LIKE tsp01-rqident, gd_destination LIKE rlgrap-filename, gd_bytecount LIKE tst01-dsize, gd_buffer TYPE string. DATA: BEGIN OF it_spools OCCURS 0, spool_id LIKE tsp01-rqident, END OF it_spools. * Binary store for csv DATA: BEGIN OF it_csv_output OCCURS 0. INCLUDE STRUCTURE tline. DATA: END OF it_csv_output. RANGES: rgd_stepcount FOR tbtcp-stepcount. CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV', c_no(1) TYPE c VALUE ' ', c_device(4) TYPE c VALUE 'LOCL'. ************************************************************************ *START-OF-SELECTION. START-OF-SELECTION. IF sy-batch EQ 'X'. IF p_spono IS INITIAL. * Spool number is primary IF p_job IS INITIAL. * Current Job PERFORM get_job_details. IF p_step IS INITIAL. IF NOT p_job_al IS INITIAL. * Previous step CLEAR rgd_stepcount. rgd_stepcount-sign = 'I'. rgd_stepcount-option = 'LT'. rgd_stepcount-low = gd_stepcount. APPEND rgd_stepcount. ELSE. * gd_stepcount = gd_stepcount - 1. CLEAR rgd_stepcount. rgd_stepcount-sign = 'I'. rgd_stepcount-option = 'EQ'. rgd_stepcount-low = gd_stepcount - 1. APPEND rgd_stepcount. ENDIF. ELSE. * gd_stepcount = p_step. CLEAR rgd_stepcount. rgd_stepcount-sign = 'I'. rgd_stepcount-option = 'EQ'. rgd_stepcount-low = p_step. APPEND rgd_stepcount. ENDIF. ELSE. gd_jobname = p_job. IF p_step IS INITIAL. IF NOT p_job_al IS INITIAL. REFRESH: rgd_stepcount. ELSE. * Both step and job are required SKIP. WRITE:/ 'Program needs job & step in-order for spool determination' . ENDIF. STOP. ELSE. * gd_stepcount = p_step. CLEAR rgd_stepcount. rgd_stepcount-sign = 'I'. rgd_stepcount-option = 'EQ'. rgd_stepcount-low = p_step. APPEND rgd_stepcount. ENDIF. PERFORM get_other_job_details. ENDIF. PERFORM obtain_spool_id. * for debugging => Uncomment next statements SKIP. WRITE:/ 'Job Name :', gd_jobname. WRITE:/ 'Step Number :', gd_stepcount. WRITE:/ 'Job Number :', gd_jobcount. WRITE:/ 'Spool Number :', gd_spool_nr. * IF gd_spool_nr IS INITIAL. IF it_spools[] IS INITIAL and p_mlnout IS INITIAL. *********************************** ** If batch spool number must be found. ************************************ SKIP. WRITE:/ 'No spool found'. STOP. ENDIF. ELSE. * gd_spool_nr = p_spono. it_spools-spool_id = p_spono. APPEND it_spools. ENDIF. ELSE. IF p_spono IS INITIAL. *********************************** ** If interactive spool number must be filled in. ************************************ SKIP. WRITE:/ 'Program must be executed in background OR '. WRITE:/ ' spool-number must be filled in.'. STOP. ELSE. * gd_spool_nr = p_spono. it_spools-spool_id = p_spono. APPEND it_spools. ENDIF. ENDIF. REFRESH: it_attach. LOOP AT it_spools. REFRESH: it_mess_att. gd_spool_nr = it_spools-spool_id. SELECT SINGLE * FROM tsp01 WHERE rqident = gd_spool_nr. CALL FUNCTION 'RSTS_GET_ATTRIBUTES' EXPORTING name = tsp01-rqo1name part = 1 IMPORTING objtype = gd_objtype. IF gd_objtype(3) = 'OTF' OR not p_otf is initial. PERFORM convert_otf_spool_to_csv. ELSE. PERFORM convert_abab_spool_to_csv. ENDIF. CHECK NOT it_mess_att[] IS INITIAL. it_attach-spool_id = gd_spool_nr. it_attach-content_bin[] = it_mess_att[]. APPEND it_attach. ENDLOOP. PERFORM process_email. IF p_delspl EQ 'X'. PERFORM delete_spool. ENDIF. IF sy-sysid = c_dev. WAIT UP TO 5 SECONDS. SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN. ENDIF. END-OF-SELECTION. *———————————————————————* * FORM obtain_spool_id * *———————————————————————* FORM obtain_spool_id. CHECK NOT ( gd_jobname IS INITIAL ). * CHECK NOT ( gd_jobcount IS INITIAL ). SELECT * FROM tbtcp INTO TABLE it_tbtcp WHERE jobname = gd_jobname AND jobcount = gd_jobcount * AND stepcount = gd_stepcount AND stepcount IN rgd_stepcount AND listident <> '0000000000' ORDER BY jobname jobcount stepcount. * READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1. * IF sy-subrc = 0. * MESSAGE s004(zdd) WITH gd_spool_nr. * gd_spool_nr = wa_tbtcp-listident. * MESSAGE s004(zdd) WITH gd_spool_nr. * ELSE. * MESSAGE s005(zdd). * ENDIF. LOOP AT it_tbtcp INTO wa_tbtcp. it_spools-spool_id = wa_tbtcp-listident. APPEND it_spools. ENDLOOP. ENDFORM. *———————————————————————* * FORM get_job_details * *———————————————————————* FORM get_job_details. * Get current job details CALL FUNCTION 'GET_JOB_RUNTIME_INFO' IMPORTING eventid = gd_eventid eventparm = gd_eventparm external_program_active = gd_external_program_active jobcount = gd_jobcount jobname = gd_jobname stepcount = gd_stepcount EXCEPTIONS no_runtime_info = 1 OTHERS = 2. ENDFORM. *———————————————————————————————* * FORM get_other_job_details * *———————————————————————————————* FORM get_other_job_details. * Get info of other job CHECK NOT ( gd_jobname IS INITIAL ). * CHECK NOT ( gd_stepcount IS INITIAL ). * Get current job details CALL FUNCTION 'GET_JOB_RUNTIME_INFO' IMPORTING eventid = gd_eventid eventparm = gd_eventparm external_program_active = gd_external_program_active jobcount = gd_jobcount jobname = gd_jobname_current stepcount = gd_stepcount_current EXCEPTIONS no_runtime_info = 1 OTHERS = 2. * If jobname is equal to current take this one * else * Get info of other job TAKE LAST SCHEDULE IF NOT gd_jobname_current = gd_jobname. SELECT * FROM tbtcp INTO TABLE it_tbtcp WHERE jobname = gd_jobname * AND stepcount = gd_stepcount AND stepcount IN rgd_stepcount AND listident <> '0000000000' ORDER BY sdldate DESCENDING sdltime DESCENDING. READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1. IF sy-subrc = 0. gd_jobcount = wa_tbtcp-jobcount. ENDIF. ENDIF. ENDFORM. *—————————————————————————————————* * FORM convert_abab_spool_to_csv * *—————————————————————————————————* FORM convert_abab_spool_to_csv. DATA it_spool_csv type TEXT2048 OCCURS 0 WITH HEADER LINE. *FM called that returns the Spool Request Number data into and internal table CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB' EXPORTING rqident = gd_spool_nr "Spool Request Number first_line = 1 TABLES buffer = it_spool_csv "Internal table that will have the Spool Request No data EXCEPTIONS no_such_job = 1 not_abap_list = 2 job_contains_no_data = 3 selection_empty = 4 no_permission = 5 can_not_access = 6 read_error = 7 OTHERS = 8. *To convert the spool data into excel format constants: con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB, con_cret type c value cl_abap_char_utilities=>CR_LF. Data: it_string type string, it_header type string. Data: len type i, split type i, offset type i. clear: it_header , it_string. LOOP AT it_spool_csv into it_string. if not it_string is initial. if not p_skphdr is initial and not it_string(1) = '|'. clear it_string. endif. endif. if p_skip is initial. if not it_string is initial. if not it_string+1(10) = '----------'. if not it_string = it_header. if it_header is initial. it_header = it_string. it_string = it_string+1. * replace all ; by : to avoid field-separator issue REPLACE ALL OCCURRENCES OF ';' IN it_string WITH ':'. REPLACE ALL OCCURRENCES OF '|' IN it_string WITH ';'. else. * replace all ; by : to avoid field-separator issue REPLACE ALL OCCURRENCES OF ';' IN it_string WITH ':'. REPLACE ALL OCCURRENCES OF '|' IN it_string WITH ';'. CONCATENATE con_cret it_string+1 INTO it_string. endif. len = STRLEN( it_string ). split = len div 255 + 1. clear offset. do split times. if len < 255. APPEND it_string+offset(len) to it_mess_att. else. APPEND it_string+offset(255) to it_mess_att. endif. len = len - 255. offset = offset + 255. enddo. endif. endif. endif. else. p_skip = p_skip - 1. endif. ENDLOOP. ENDFORM. *—————————————————————————————————* * FORM convert_otf_spool_to_csv * *—————————————————————————————————* FORM convert_otf_spool_to_csv. DATA it_spool_csv type soli OCCURS 0 WITH HEADER LINE. DATA it_spool_raw type soli OCCURS 0 WITH HEADER LINE. *FM called that returns the Spool Request Number data into and internal table CALL FUNCTION 'RSPO_RETURN_SPOOLJOB' EXPORTING rqident = gd_spool_nr "Spool Request Number first_line = 1 desired_type = 'RAW' TABLES buffer = it_spool_raw "Internal table that will have the Spool Request No data EXCEPTIONS no_such_job = 1 not_abap_list = 2 job_contains_no_data = 3 selection_empty = 4 no_permission = 5 can_not_access = 6 read_error = 7 OTHERS = 8. Data: it_string type string, it_header type string. LOOP AT it_spool_raw into it_string. if not it_string is initial. if not p_skphdr is initial and not it_string(1) = '|'. clear it_string. endif. endif. if p_skip is initial. if not it_string is initial. if not it_string+1(10) = '----------'. if not it_string = it_header. if it_header is initial. it_header = it_string. it_string = it_string+1. * replace all ; by : to avoid field-separator issue REPLACE ALL OCCURRENCES OF ';' IN it_string WITH ':'. REPLACE ALL OCCURRENCES OF '|' IN it_string WITH ';'. APPEND it_string+1 to it_spool_csv. else. * replace all ; by : to avoid field-separator issue REPLACE ALL OCCURRENCES OF ';' IN it_string WITH ':'. REPLACE ALL OCCURRENCES OF '|' IN it_string WITH ';'. APPEND it_string+1 to it_spool_csv. endif. endif. endif. endif. else. p_skip = p_skip - 1. endif. ENDLOOP. *To convert the spool data into excel format CALL FUNCTION 'SO_RAW_TO_RTF' TABLES objcont_old = it_spool_csv "Internal table having spool data objcont_new = it_mess_att. "Int table having Excel format data converted from Spool data ENDFORM. *———————————————————————* *FORM process_email * *———————————————————————* FORM process_email. * DESCRIBE TABLE it_mess_att LINES gd_recsize. * CHECK gd_recsize > 0. IF p_mlnout IS INITIAL. CHECK NOT it_attach[] IS INITIAL. ENDIF. IF p_email0 IS INITIAL. * Get E-mail of current user SELECT SINGLE smtp_addr INTO p_email0 FROM adr6 AS a JOIN usr21 AS u ON u~persnumber = a~persnumber AND u~addrnumber = a~addrnumber WHERE u~bname = sy-uname. ENDIF. CHECK NOT p_email0 IS INITIAL OR NOT p_email1 IS INITIAL OR NOT p_email2 IS INITIAL OR NOT p_email3 IS INITIAL OR NOT p_email4 IS INITIAL OR NOT p_email5 IS INITIAL OR NOT p_email6 IS INITIAL OR NOT p_email7 IS INITIAL OR NOT p_email8 IS INITIAL OR NOT p_email9 IS INITIAL. PERFORM send_email. ENDFORM. *———————————————————————* * FORM send_email * *———————————————————————* * –> p_email * *———————————————————————* FORM send_email. REFRESH it_mess_bod. * Default subject matter gd_subject = p_subj. IF it_attach[] IS INITIAL. it_mess_bod = p_mlnoui. APPEND it_mess_bod. ELSE. gd_attachment_desc = p_atdesc. gd_attachment_name = p_atname. IF NOT ( p_body1 IS INITIAL ). it_mess_bod = p_body1. APPEND it_mess_bod. ELSE. it_mess_bod = 'Copy of spool in attachment'. APPEND it_mess_bod. ENDIF. IF NOT ( p_body2 IS INITIAL ). it_mess_bod = p_body2. APPEND it_mess_bod. ENDIF. IF NOT ( p_body3 IS INITIAL ). it_mess_bod = p_body3. APPEND it_mess_bod. ENDIF. ENDIF. * If no sender specified - default blank IF p_sender EQ space. gd_sender_type = space. ELSE. gd_sender_type = 'INT'. ENDIF. * Send file by email as .csv speadsheet PERFORM send_file_as_email_attachment TABLES it_mess_bod * it_mess_att USING gd_subject 'csv' gd_attachment_desc gd_attachment_name p_sender gd_sender_type CHANGING gd_error. ENDFORM. *———————————————————————* * FORM delete_spool * *———————————————————————* FORM delete_spool. DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char. ld_spool_nr = gd_spool_nr. CHECK p_delspl <> c_no. CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ' EXPORTING spoolid = ld_spool_nr. ENDFORM. *&———————————————————————* *& Form SEND_FILE_AS_EMAIL_ATTACHMENT *&———————————————————————* * Send email *———————————————————————-* FORM send_file_as_email_attachment TABLES it_message *it_attach USING p_mtitle p_format p_filename p_attdescription p_sender_address p_sender_addres_type CHANGING p_error. DATA: ld_error TYPE sy-subrc, ld_reciever TYPE sy-subrc, ld_mtitle LIKE sodocchgi1-obj_descr, ld_format TYPE so_obj_tp, ld_attdescription TYPE so_obj_des, ld_attfilename TYPE so_obj_des, ld_sender_address LIKE soextreci1-receiver, ld_sender_address_type LIKE soextreci1-adr_typ, ld_receiver LIKE sy-subrc, ld_att_nbr TYPE n. DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE, t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE, t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, * t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE, t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE, t_obj_bin LIKE solisti1 OCCURS 10 WITH HEADER LINE, w_cnt TYPE i, w_sent_all(1) TYPE c, w_doc_data LIKE sodocchgi1. ld_mtitle = p_mtitle. ld_format = p_format. ld_attdescription = p_attdescription. ld_attfilename = p_filename. ld_sender_address = p_sender_address. ld_sender_address_type = p_sender_addres_type. * Fill the document data. w_doc_data-doc_size = 1. * Fill the document data and get size of attachment CLEAR w_doc_data. READ TABLE it_message INDEX w_cnt. w_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_message ). w_doc_data-obj_langu = sy-langu. w_doc_data-obj_name = 'SAPRPT'. w_doc_data-obj_descr = ld_mtitle. w_doc_data-sensitivty = 'F'. * CLEAR t_attachment. * REFRESH t_attachment. * t_attachment[] = it_attach[]. * Describe the body of the message CLEAR t_packing_list. REFRESH t_packing_list. t_packing_list-transf_bin = space. t_packing_list-head_start = 1. t_packing_list-head_num = 0. t_packing_list-body_start = 1. DESCRIBE TABLE it_message LINES t_packing_list-body_num. t_packing_list-doc_type = 'RAW'. APPEND t_packing_list. DESCRIBE TABLE it_attach LINES w_cnt. LOOP AT it_attach. ld_att_nbr = sy-tabix. DESCRIBE TABLE t_obj_bin LINES tab_lines. * Create attachment notification t_packing_list-transf_bin = 'X'. t_packing_list-head_start = 1. t_packing_list-head_num = 1. * t_packing_list-body_start = 1. t_packing_list-body_start = tab_lines + 1. * DESCRIBE TABLE t_attachment LINES t_packing_list-body_num. APPEND LINES OF it_attach-content_bin[] TO t_obj_bin[]. DESCRIBE TABLE it_attach-content_bin LINES tab_lines1. t_packing_list-body_num = tab_lines1. t_packing_list-doc_type = ld_format. IF w_cnt = 1. t_packing_list-obj_descr = ld_attdescription. t_packing_list-obj_name = ld_attfilename. ELSE. IF NOT ld_attdescription IS INITIAL. CONCATENATE ld_attdescription ld_att_nbr INTO t_packing_list-obj_descr SEPARATED BY '_'. ELSE. CONCATENATE 'ATT_' ld_att_nbr INTO t_packing_list-obj_descr. ENDIF. ENDIF. REPLACE '&DATE' WITH sy-datum INTO t_packing_list-obj_descr. REPLACE '&TIME' WITH sy-uzeit INTO t_packing_list-obj_descr. REPLACE '&USER' WITH sy-uname INTO t_packing_list-obj_descr. CONDENSE t_packing_list-obj_descr NO-GAPS. REPLACE '&JOBNAME' WITH gd_jobname(20) INTO t_packing_list-obj_descr. CONDENSE t_packing_list-obj_descr NO-GAPS. t_packing_list-doc_size = t_packing_list-body_num * 255. APPEND t_packing_list. ENDLOOP. * Add the recipients email address CLEAR t_receivers. REFRESH t_receivers. t_receivers-rec_type = 'U'. t_receivers-com_type = 'INT'. t_receivers-notif_del = 'X'. t_receivers-notif_ndel = 'X'. IF NOT p_email0 IS INITIAL. t_receivers-receiver = p_email0. APPEND t_receivers. ENDIF. IF NOT p_email1 IS INITIAL. t_receivers-receiver = p_email1. APPEND t_receivers. ENDIF. IF NOT p_email2 IS INITIAL. t_receivers-receiver = p_email2. APPEND t_receivers. ENDIF. IF NOT p_email3 IS INITIAL. t_receivers-receiver = p_email3. APPEND t_receivers. ENDIF. IF NOT p_email4 IS INITIAL. t_receivers-receiver = p_email4. APPEND t_receivers. ENDIF. IF NOT p_email5 IS INITIAL. t_receivers-receiver = p_email5. APPEND t_receivers. ENDIF. IF NOT p_email6 IS INITIAL. t_receivers-receiver = p_email6. APPEND t_receivers. ENDIF. IF NOT p_email7 IS INITIAL. t_receivers-receiver = p_email7. APPEND t_receivers. ENDIF. IF NOT p_email8 IS INITIAL. t_receivers-receiver = p_email8. APPEND t_receivers. ENDIF. IF NOT p_email9 IS INITIAL. t_receivers-receiver = p_email9. APPEND t_receivers. ENDIF. CALL FUNCTION 'SO_DOCUMENT_SEND_API1' EXPORTING document_data = w_doc_data put_in_outbox = 'X' sender_address = ld_sender_address sender_address_type = ld_sender_address_type commit_work = 'X' IMPORTING sent_to_all = w_sent_all TABLES packing_list = t_packing_list * contents_bin = t_attachment contents_bin = t_obj_bin contents_txt = it_message receivers = t_receivers EXCEPTIONS too_many_receivers = 1 document_not_sent = 2 document_type_not_exist = 3 operation_no_authorization = 4 parameter_error = 5 x_error = 6 enqueue_error = 7 OTHERS = 8. * Populate zerror return code ld_error = sy-subrc. * Populate zreceiver return code LOOP AT t_receivers. ld_receiver = t_receivers-retrn_code. ENDLOOP. ENDFORM.
30.569667
105
0.598217
98134fc17dbb20620355ff84bd6c66d0547b3564
2,320
abap
ABAP
src/checks/zcl_aoc_check_76.clas.testclasses.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
199
2015-02-17T07:08:01.000Z
2022-03-23T09:50:05.000Z
src/checks/zcl_aoc_check_76.clas.testclasses.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
769
2015-01-03T07:09:11.000Z
2022-03-21T11:59:53.000Z
src/checks/zcl_aoc_check_76.clas.testclasses.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
109
2015-03-09T10:22:34.000Z
2022-03-08T08:47:41.000Z
CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. DATA: mt_code TYPE string_table, ms_result TYPE scirest_ad, mo_check TYPE REF TO zcl_aoc_check_76. METHODS: setup, export_import FOR TESTING, test001_01 FOR TESTING, test001_02 FOR TESTING, test001_03 FOR TESTING, test001_04 FOR TESTING. ENDCLASS. CLASS ltcl_test IMPLEMENTATION. METHOD setup. CREATE OBJECT mo_check. zcl_aoc_unit_test=>set_check( mo_check ). zcl_aoc_unit_test=>set_object_type( 'CLAS' ). ENDMETHOD. "setup METHOD export_import. zcl_aoc_unit_test=>export_import( mo_check ). ENDMETHOD. METHOD test001_01. DATA lv_code TYPE string. lv_code = |SELECT * INTO TABLE @DATA(lt_data) FROM e070 INNER| && | JOIN e07t ON e070~trkorr = e07t~trkorr WHERE e07t~langu = @sy-langu.|. APPEND lv_code TO mt_code. ms_result = zcl_aoc_unit_test=>check( mt_code ). cl_abap_unit_assert=>assert_equals( exp = '001' act = ms_result-code ). ENDMETHOD. METHOD test001_02. DATA lv_code TYPE string. lv_code = |SELECT * INTO TABLE @DATA(lt_data) FROM e070 INNER JOIN e071 ON e070~trkorr = e071~trkorr.|. APPEND lv_code TO mt_code. ms_result = zcl_aoc_unit_test=>check( mt_code ). cl_abap_unit_assert=>assert_equals( exp = space act = ms_result-code ). ENDMETHOD. METHOD test001_03. DATA lv_code TYPE string. lv_code = |SELECT * INTO TABLE @DATA(lt_data) FROM e070 AS korr INNER JOIN e071 ON e070~trkorr = e071~trkorr.|. APPEND lv_code TO mt_code. ms_result = zcl_aoc_unit_test=>check( mt_code ). cl_abap_unit_assert=>assert_equals( exp = space act = ms_result-code ). ENDMETHOD. METHOD test001_04. DATA lv_code TYPE string. lv_code = |SELECT * INTO TABLE @DATA(lt_data) FROM e07t AS text INNER JOIN e070 ON e07t~trkorr = e070~trkorr.|. APPEND lv_code TO mt_code. ms_result = zcl_aoc_unit_test=>check( mt_code ). cl_abap_unit_assert=>assert_equals( exp = '001' act = ms_result-code ). ENDMETHOD. ENDCLASS.
26.067416
115
0.640948
9813fea0e23c57967b45f28efc36268aa879adf2
333
abap
ABAP
src/legacy/#dmo#flight_travel_api28.fugr.#dmo#flight_travel_save28.abap
SAP-Cloud-Platform/flight28
35f184474aa1fb65d95f0c4d259dd1b64c051906
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api28.fugr.#dmo#flight_travel_save28.abap
SAP-Cloud-Platform/flight28
35f184474aa1fb65d95f0c4d259dd1b64c051906
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api28.fugr.#dmo#flight_travel_save28.abap
SAP-Cloud-Platform/flight28
35f184474aa1fb65d95f0c4d259dd1b64c051906
[ "BSD-Source-Code" ]
null
null
null
"! API for Saving the Transactional Buffer of the Travel API "! FUNCTION /DMO/FLIGHT_TRAVEL_SAVE28. *"---------------------------------------------------------------------- *"*"Local Interface: *"---------------------------------------------------------------------- /dmo/cl_flight_legacy28=>get_instance( )->save( ). ENDFUNCTION.
37
72
0.423423
98171c331b84d02273fdf0648ad3adf7af78f508
2,072
abap
ABAP
src/ui/zcl_abapgit_html_viewer_gui.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2020-04-21T04:00:18.000Z
2020-04-21T04:00:18.000Z
src/ui/zcl_abapgit_html_viewer_gui.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_html_viewer_gui.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2021-07-09T02:07:11.000Z
2021-07-09T02:07:11.000Z
CLASS zcl_abapgit_html_viewer_gui DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_html_viewer . METHODS constructor . PROTECTED SECTION. DATA mo_html_viewer TYPE REF TO cl_gui_html_viewer . METHODS on_event FOR EVENT sapevent OF cl_gui_html_viewer IMPORTING !action !frame !getdata !postdata !query_table . PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPGIT_HTML_VIEWER_GUI IMPLEMENTATION. METHOD constructor. DATA: lt_events TYPE cntl_simple_events, ls_event LIKE LINE OF lt_events. CREATE OBJECT mo_html_viewer EXPORTING query_table_disabled = abap_true parent = cl_gui_container=>screen0. ls_event-eventid = zif_abapgit_html_viewer=>m_id_sapevent. ls_event-appl_event = abap_true. APPEND ls_event TO lt_events. mo_html_viewer->set_registered_events( lt_events ). SET HANDLER me->on_event FOR mo_html_viewer. ENDMETHOD. METHOD on_event. RAISE EVENT zif_abapgit_html_viewer~sapevent EXPORTING action = action frame = frame getdata = getdata postdata = postdata query_table = query_table. ENDMETHOD. METHOD zif_abapgit_html_viewer~close_document. mo_html_viewer->close_document( ). ENDMETHOD. METHOD zif_abapgit_html_viewer~free. mo_html_viewer->free( ). ENDMETHOD. METHOD zif_abapgit_html_viewer~load_data. mo_html_viewer->load_data( EXPORTING url = iv_url type = iv_type subtype = iv_subtype size = iv_size IMPORTING assigned_url = ev_assigned_url CHANGING data_table = ct_data_table ). ENDMETHOD. METHOD zif_abapgit_html_viewer~set_registered_events. mo_html_viewer->set_registered_events( it_events ). ENDMETHOD. METHOD zif_abapgit_html_viewer~show_url. mo_html_viewer->show_url( iv_url ). ENDMETHOD. ENDCLASS.
19.185185
65
0.668919
981e36e3671fc22a6dac8a936731cd37d8117554
10,503
abap
ABAP
src/ui/zcl_abapgit_gui_page_addonline.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_addonline.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_addonline.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_addonline DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_component FINAL CREATE PRIVATE . PUBLIC SECTION. INTERFACES zif_abapgit_gui_event_handler. INTERFACES zif_abapgit_gui_renderable. CLASS-METHODS create " TODO importing prefilled form data RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception. METHODS constructor RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_id, url TYPE string VALUE 'url', package TYPE string VALUE 'package', branch_name TYPE string VALUE 'branch_name', display_name TYPE string VALUE 'display_name', folder_logic TYPE string VALUE 'folder_logic', ignore_subpackages TYPE string VALUE 'ignore_subpackages', master_lang_only TYPE string VALUE 'master_lang_only', END OF c_id. CONSTANTS: BEGIN OF c_event, go_back TYPE string VALUE 'go-back', choose_package TYPE string VALUE 'choose-package', create_package TYPE string VALUE 'create-package', choose_branch TYPE string VALUE 'choose-branch', add_online_repo TYPE string VALUE 'add-repo-online', END OF c_event. DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map. DATA mo_form_data TYPE REF TO zcl_abapgit_string_map. DATA mo_form TYPE REF TO zcl_abapgit_html_form. METHODS parse_form IMPORTING it_form_fields TYPE tihttpnvp RETURNING VALUE(ro_form_data) TYPE REF TO zcl_abapgit_string_map RAISING zcx_abapgit_exception. METHODS validate_form IMPORTING io_form_data TYPE REF TO zcl_abapgit_string_map RETURNING VALUE(ro_validation_log) TYPE REF TO zcl_abapgit_string_map RAISING zcx_abapgit_exception. METHODS get_form_schema RETURNING VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_ADDONLINE IMPLEMENTATION. METHOD constructor. super->constructor( ). CREATE OBJECT mo_validation_log. CREATE OBJECT mo_form_data. mo_form = get_form_schema( ). ENDMETHOD. METHOD create. DATA lo_component TYPE REF TO zcl_abapgit_gui_page_addonline. CREATE OBJECT lo_component. ri_page = zcl_abapgit_gui_page_hoc=>create( iv_page_title = 'Clone online repository' ii_child_component = lo_component ). ENDMETHOD. METHOD get_form_schema. ro_form = zcl_abapgit_html_form=>create( iv_form_id = 'add-repo-online-form' ). ro_form->text( iv_name = c_id-url iv_required = abap_true iv_label = 'Git repository URL' iv_hint = 'HTTPS address of the repository to clone' iv_placeholder = 'https://github.com/...git' )->text( iv_name = c_id-package iv_side_action = c_event-choose_package iv_required = abap_true iv_upper_case = abap_true iv_label = 'Package' iv_hint = 'SAP package for the code (should be a dedicated one)' iv_placeholder = 'Z... / $...' ). ro_form->text( iv_name = c_id-branch_name iv_side_action = c_event-choose_branch iv_label = 'Branch' iv_hint = 'Switch to a specific branch on clone (default: autodetect)' iv_placeholder = 'autodetect default branch' ). ro_form->radio( iv_name = c_id-folder_logic iv_default_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix iv_label = 'Folder logic' iv_hint = 'Define how package folders are named in the repo (see https://docs.abapgit.org)' )->option( iv_label = 'Prefix' iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix )->option( iv_label = 'Full' iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-full )->text( iv_name = c_id-display_name iv_label = 'Display name' iv_hint = 'Name to show instead of original repo name (optional)' )->checkbox( iv_name = c_id-ignore_subpackages iv_label = 'Ignore subpackages' iv_hint = 'Syncronize root package only (see https://docs.abapgit.org)' )->checkbox( iv_name = c_id-master_lang_only iv_label = 'Serialize master language only' iv_hint = 'Ignore translations, serialize just master language' )->command( iv_label = 'Clone online repo' iv_is_main = abap_true iv_action = c_event-add_online_repo )->command( iv_label = 'Create package' iv_action = c_event-create_package )->command( iv_label = 'Back' iv_action = c_event-go_back ). ENDMETHOD. METHOD parse_form. DATA ls_field LIKE LINE OF it_form_fields. CREATE OBJECT ro_form_data. " temporary, TODO refactor later, after gui_event class is ready, move to on_event LOOP AT it_form_fields INTO ls_field. ro_form_data->set( iv_key = ls_field-name iv_val = ls_field-value ). ENDLOOP. ro_form_data = mo_form->validate_normalize_form_data( ro_form_data ). ENDMETHOD. METHOD validate_form. DATA lx_err TYPE REF TO zcx_abapgit_exception. ro_validation_log = mo_form->validate_required_fields( io_form_data ). IF io_form_data->get( c_id-url ) IS NOT INITIAL. TRY. zcl_abapgit_url=>validate( io_form_data->get( c_id-url ) ). CATCH zcx_abapgit_exception INTO lx_err. ro_validation_log->set( iv_key = c_id-url iv_val = lx_err->get_text( ) ). ENDTRY. ENDIF. IF io_form_data->get( c_id-package ) IS NOT INITIAL. TRY. zcl_abapgit_repo_srv=>get_instance( )->validate_package( iv_package = |{ io_form_data->get( c_id-package ) }| iv_ign_subpkg = |{ io_form_data->get( c_id-ignore_subpackages ) }| ). CATCH zcx_abapgit_exception INTO lx_err. ro_validation_log->set( iv_key = c_id-package iv_val = lx_err->get_text( ) ). ENDTRY. ENDIF. IF io_form_data->get( c_id-folder_logic ) <> zif_abapgit_dot_abapgit=>c_folder_logic-prefix AND io_form_data->get( c_id-folder_logic ) <> zif_abapgit_dot_abapgit=>c_folder_logic-full. ro_validation_log->set( iv_key = c_id-folder_logic iv_val = |Invalid folder logic { io_form_data->get( c_id-folder_logic ) }. Must be { zif_abapgit_dot_abapgit=>c_folder_logic-prefix } or { zif_abapgit_dot_abapgit=>c_folder_logic-full } | ). ENDIF. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA: ls_repo_params TYPE zif_abapgit_services_repo=>ty_repo_params, lo_new_online_repo TYPE REF TO zcl_abapgit_repo_online. " import data from html before re-render mo_form_data = parse_form( zcl_abapgit_html_action_utils=>parse_post_form_data( ii_event->mt_postdata ) ). CASE ii_event->mv_action. WHEN c_event-go_back. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back. WHEN c_event-create_package. mo_form_data->set( iv_key = c_id-package iv_val = zcl_abapgit_services_basis=>create_package( iv_prefill_package = |{ mo_form_data->get( 'package' ) }| ) ). IF mo_form_data->get( c_id-package ) IS NOT INITIAL. mo_validation_log = validate_form( mo_form_data ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ELSE. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDIF. WHEN c_event-choose_package. mo_form_data->set( iv_key = c_id-package iv_val = zcl_abapgit_ui_factory=>get_popups( )->popup_search_help( 'TDEVC-DEVCLASS' ) ). IF mo_form_data->get( c_id-package ) IS NOT INITIAL. mo_validation_log = validate_form( mo_form_data ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ELSE. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDIF. WHEN c_event-choose_branch. mo_validation_log = validate_form( mo_form_data ). IF mo_validation_log->has( c_id-url ) = abap_true. mo_validation_log->set( iv_key = c_id-branch_name iv_val = 'Check URL issues' ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. " Display errors RETURN. ENDIF. mo_form_data->set( iv_key = c_id-branch_name iv_val = zcl_abapgit_ui_factory=>get_popups( )->branch_list_popup( mo_form_data->get( c_id-url ) )-name ). IF mo_form_data->get( c_id-branch_name ) IS INITIAL. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ELSE. mo_form_data->set( iv_key = c_id-branch_name iv_val = replace( " strip technical val = mo_form_data->get( c_id-branch_name ) sub = zif_abapgit_definitions=>c_git_branch-heads_prefix with = '' ) ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDIF. WHEN c_event-add_online_repo. mo_validation_log = validate_form( mo_form_data ). IF mo_validation_log->is_empty( ) = abap_true. mo_form_data->to_abap( CHANGING cs_container = ls_repo_params ). lo_new_online_repo = zcl_abapgit_services_repo=>new_online( ls_repo_params ). CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_repo_view EXPORTING iv_key = lo_new_online_repo->get_key( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing. ELSE. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. " Display errors ENDIF. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. gui_services( )->register_event_handler( me ). CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( mo_form->render( iv_form_class = 'dialog w600px m-em5-sides margin-v1' " to center add wmax600px and auto-center instead io_values = mo_form_data io_validation_log = mo_validation_log ) ). ENDMETHOD. ENDCLASS.
33.555911
116
0.65924
9820130f00a19e434a878169f5bdb75bd0b7b8ac
1,507
abap
ABAP
src/api/github/zgha_github_test.prog.abap
DennisLybecker-INVIXO/ci_tools
4f24ce0635271f19f9d03fd9eee6d7098ccc4220
[ "MIT" ]
null
null
null
src/api/github/zgha_github_test.prog.abap
DennisLybecker-INVIXO/ci_tools
4f24ce0635271f19f9d03fd9eee6d7098ccc4220
[ "MIT" ]
1
2021-01-18T10:15:45.000Z
2021-01-18T10:15:45.000Z
src/github/zgha_github_test.prog.abap
abapGit/git_host_apis
ed7e54045c73eccb43a16507f1987c5dbabfffd3
[ "MIT" ]
null
null
null
REPORT zgha_github_test. PARAMETERS: p_token TYPE text100 OBLIGATORY, p_plis TYPE c RADIOBUTTON GROUP g1, p_pcre TYPE c RADIOBUTTON GROUP g1, p_clis TYPE c RADIOBUTTON GROUP g1, p_pclo TYPE c RADIOBUTTON GROUP g1, p_pmer TYPE c RADIOBUTTON GROUP g1. START-OF-SELECTION. PERFORM run. FORM run. zcl_gha_http_client=>add_header( iv_name = 'Authorization' iv_value = |token { p_token }| ). ****************** CASE abap_true. WHEN p_plis. DATA(lt_plist) = zcl_gha_github_factory=>get_pull_requests( iv_owner = 'Microsoft' iv_repo = 'vscode' )->list( ). WHEN p_pcre. zcl_gha_github_factory=>get_pull_requests( iv_owner = 'abapGit' iv_repo = 'abap_git_hosts_apis' )->create( iv_title = 'title' iv_head = 'branch' iv_base = 'master' ). WHEN p_clis. DATA(lt_clist) = zcl_gha_github_factory=>get_comments( iv_owner = 'abapGit' iv_repo = 'abap_git_hosts_apis' )->list( 3 ). WHEN p_pclo. zcl_gha_github_factory=>get_pull_requests( iv_owner = 'abapGit' iv_repo = 'abap_git_hosts_apis' )->update( iv_number = 4 iv_state = 'closed' ). WHEN p_pmer. zcl_gha_github_factory=>get_pull_requests( iv_owner = 'abapGit' iv_repo = 'abap_git_hosts_apis' )->merge( iv_number = 4 iv_merge_method = 'squash' ). ENDCASE. ENDFORM.
28.980769
65
0.605176
9822151d93eb488ac88d2e0ba3dad20d15128243
5,319
abap
ABAP
Task/24-game-Solve/ABAP/24-game-solve.abap
LaudateCorpus1/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
1
2018-11-09T22:08:38.000Z
2018-11-09T22:08:38.000Z
Task/24-game-Solve/ABAP/24-game-solve.abap
seanwallawalla-forks/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
null
null
null
Task/24-game-Solve/ABAP/24-game-solve.abap
seanwallawalla-forks/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
1
2018-11-09T22:08:40.000Z
2018-11-09T22:08:40.000Z
data: lv_flag type c, lv_number type i, lt_numbers type table of i. constants: c_no_val type i value 9999. append 1 to lt_numbers. append 1 to lt_numbers. append 2 to lt_numbers. append 7 to lt_numbers. write 'Evaluating 24 with the following input: '. loop at lt_numbers into lv_number. write lv_number. endloop. perform solve_24 using lt_numbers. form eval_formula using iv_eval type string changing ev_out type i. call function 'EVAL_FORMULA' "analysis of a syntactically correct formula exporting formula = iv_eval importing value = ev_out exceptions others = 1. if sy-subrc <> 0. ev_out = -1. endif. endform. " Solve a 24 puzzle. form solve_24 using it_numbers like lt_numbers. data: lv_flag type c, lv_op1 type c, lv_op2 type c, lv_op3 type c, lv_var1 type c, lv_var2 type c, lv_var3 type c, lv_var4 type c, lv_eval type string, lv_result type i, lv_var type i. define retrieve_var. read table it_numbers index &1 into lv_var. &2 = lv_var. end-of-definition. define retrieve_val. perform eval_formula using lv_eval changing lv_result. if lv_result = 24. write / lv_eval. endif. end-of-definition. " Loop through all the possible number permutations. do. " Init. the operations table. retrieve_var: 1 lv_var1, 2 lv_var2, 3 lv_var3, 4 lv_var4. do 4 times. case sy-index. when 1. lv_op1 = '+'. when 2. lv_op1 = '*'. when 3. lv_op1 = '-'. when 4. lv_op1 = '/'. endcase. do 4 times. case sy-index. when 1. lv_op2 = '+'. when 2. lv_op2 = '*'. when 3. lv_op2 = '-'. when 4. lv_op2 = '/'. endcase. do 4 times. case sy-index. when 1. lv_op3 = '+'. when 2. lv_op3 = '*'. when 3. lv_op3 = '-'. when 4. lv_op3 = '/'. endcase. concatenate '(' '(' lv_var1 lv_op1 lv_var2 ')' lv_op2 lv_var3 ')' lv_op3 lv_var4 into lv_eval separated by space. retrieve_val. concatenate '(' lv_var1 lv_op1 lv_var2 ')' lv_op2 '(' lv_var3 lv_op3 lv_var4 ')' into lv_eval separated by space. retrieve_val. concatenate '(' lv_var1 lv_op1 '(' lv_var2 lv_op2 lv_var3 ')' ')' lv_op3 lv_var4 into lv_eval separated by space. retrieve_val. concatenate lv_var1 lv_op1 '(' '(' lv_var2 lv_op2 lv_var3 ')' lv_op3 lv_var4 ')' into lv_eval separated by space. retrieve_val. concatenate lv_var1 lv_op1 '(' lv_var2 lv_op2 '(' lv_var3 lv_op3 lv_var4 ')' ')' into lv_eval separated by space. retrieve_val. enddo. enddo. enddo. " Once we've reached the last permutation -> Exit. perform permute using it_numbers changing lv_flag. if lv_flag = 'X'. exit. endif. enddo. endform. " Permutation function - this is used to permute: " A = {A1...AN} -> Set of supplied variables. " B = {B1...BN - 1} -> Set of operators. " Can be used for an unbounded size set. Relies " on lexicographic ordering of the set. form permute using iv_set like lt_numbers changing ev_last type c. data: lv_len type i, lv_first type i, lv_third type i, lv_count type i, lv_temp type i, lv_temp_2 type i, lv_second type i, lv_changed type c, lv_perm type i. describe table iv_set lines lv_len. lv_perm = lv_len - 1. lv_changed = ' '. " Loop backwards through the table, attempting to find elements which " can be permuted. If we find one, break out of the table and set the " flag indicating a switch. do. if lv_perm <= 0. exit. endif. " Read the elements. read table iv_set index lv_perm into lv_first. add 1 to lv_perm. read table iv_set index lv_perm into lv_second. subtract 1 from lv_perm. if lv_first < lv_second. lv_changed = 'X'. exit. endif. subtract 1 from lv_perm. enddo. " Last permutation. if lv_changed <> 'X'. ev_last = 'X'. exit. endif. " Swap tail decresing to get a tail increasing. lv_count = lv_perm + 1. do. lv_first = lv_len + lv_perm - lv_count + 1. if lv_count >= lv_first. exit. endif. read table iv_set index lv_count into lv_temp. read table iv_set index lv_first into lv_temp_2. modify iv_set index lv_count from lv_temp_2. modify iv_set index lv_first from lv_temp. add 1 to lv_count. enddo. lv_count = lv_len - 1. do. if lv_count <= lv_perm. exit. endif. read table iv_set index lv_count into lv_first. read table iv_set index lv_perm into lv_second. read table iv_set index lv_len into lv_third. if ( lv_first < lv_third ) and ( lv_first > lv_second ). lv_len = lv_count. endif. subtract 1 from lv_count. enddo. read table iv_set index lv_perm into lv_temp. read table iv_set index lv_len into lv_temp_2. modify iv_set index lv_perm from lv_temp_2. modify iv_set index lv_len from lv_temp. endform.
26.728643
124
0.610265
982320225cf0a47d1c56bf5696e43f418907c794
15,129
abap
ABAP
src/ui/zcl_abapgit_gui_page_main.clas.abap
hf-kklein/abapGit
3e64854e567570b58c7298e118143c8198a49512
[ "MIT" ]
1
2021-01-21T15:34:26.000Z
2021-01-21T15:34:26.000Z
src/ui/zcl_abapgit_gui_page_main.clas.abap
hf-kklein/abapGit
3e64854e567570b58c7298e118143c8198a49512
[ "MIT" ]
1
2020-01-05T16:45:32.000Z
2020-01-05T16:45:32.000Z
src/ui/zcl_abapgit_gui_page_main.clas.abap
hf-kklein/abapGit
3e64854e567570b58c7298e118143c8198a49512
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_main DEFINITION PUBLIC FINAL CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page. PUBLIC SECTION. INTERFACES: zif_abapgit_gui_page_hotkey. METHODS: constructor RAISING zcx_abapgit_exception, zif_abapgit_gui_event_handler~on_event REDEFINITION. PROTECTED SECTION. METHODS: render_content REDEFINITION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_actions, show TYPE string VALUE 'show' ##NO_TEXT, changed_by TYPE string VALUE 'changed_by', overview TYPE string VALUE 'overview', documentation TYPE string VALUE 'documentation', changelog TYPE string VALUE 'changelog', END OF c_actions. DATA: mv_show TYPE zif_abapgit_persistence=>ty_value, mo_repo_content TYPE REF TO zcl_abapgit_gui_view_repo. METHODS: test_changed_by RAISING zcx_abapgit_exception, retrieve_active_repo RAISING zcx_abapgit_exception, render_toc IMPORTING it_repo_list TYPE zif_abapgit_definitions=>ty_repo_ref_tt RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, build_main_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar, render_repo IMPORTING io_repo TYPE REF TO zcl_abapgit_repo RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_MAIN IMPLEMENTATION. METHOD build_main_menu. DATA: lo_advsub TYPE REF TO zcl_abapgit_html_toolbar, lo_helpsub TYPE REF TO zcl_abapgit_html_toolbar. CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-main'. CREATE OBJECT lo_advsub. CREATE OBJECT lo_helpsub. lo_advsub->add( iv_txt = 'Repository overview' iv_act = zif_abapgit_definitions=>c_action-go_repo_overview ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Database util' iv_act = zif_abapgit_definitions=>c_action-go_db ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Package to zip' iv_act = zif_abapgit_definitions=>c_action-zip_package ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Transport to zip' iv_act = zif_abapgit_definitions=>c_action-zip_transport ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Object to files' iv_act = zif_abapgit_definitions=>c_action-zip_object ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Test changed by' iv_act = c_actions-changed_by ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Page playground' iv_act = zif_abapgit_definitions=>c_action-go_playground ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Debug info' iv_act = zif_abapgit_definitions=>c_action-go_debuginfo ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Settings' iv_act = zif_abapgit_definitions=>c_action-go_settings ) ##NO_TEXT. lo_helpsub->add( iv_txt = 'Tutorial' iv_act = zif_abapgit_definitions=>c_action-go_tutorial ) ##NO_TEXT. lo_helpsub->add( iv_txt = 'Documentation' iv_act = c_actions-documentation ) ##NO_TEXT. lo_helpsub->add( iv_txt = 'Changelog' iv_act = c_actions-changelog ) ##NO_TEXT. ro_menu->add( iv_txt = '+ Online' iv_act = zif_abapgit_definitions=>c_action-repo_newonline ) ##NO_TEXT. ro_menu->add( iv_txt = '+ Offline' iv_act = zif_abapgit_definitions=>c_action-repo_newoffline ) ##NO_TEXT. ro_menu->add( iv_txt = 'Explore' iv_act = zif_abapgit_definitions=>c_action-go_explore ) ##NO_TEXT. ro_menu->add( iv_txt = 'Advanced' io_sub = lo_advsub ) ##NO_TEXT. ro_menu->add( iv_txt = 'Help' io_sub = lo_helpsub ) ##NO_TEXT. ENDMETHOD. METHOD constructor. super->constructor( ). ms_control-page_title = 'HOME'. ms_control-page_menu = build_main_menu( ). ENDMETHOD. METHOD render_content. DATA: lt_repos TYPE zif_abapgit_definitions=>ty_repo_ref_tt, lx_error TYPE REF TO zcx_abapgit_exception, li_tutorial TYPE REF TO zif_abapgit_gui_renderable, lo_repo LIKE LINE OF lt_repos. retrieve_active_repo( ). " Get and validate key of user default repo CREATE OBJECT ro_html. TRY. lt_repos = zcl_abapgit_repo_srv=>get_instance( )->list( ). CATCH zcx_abapgit_exception INTO lx_error. ro_html->add( zcl_abapgit_gui_chunk_lib=>render_error( ix_error = lx_error ) ). RETURN. ENDTRY. ro_html->add( render_toc( lt_repos ) ). IF mv_show IS INITIAL OR lines( lt_repos ) = 0. CREATE OBJECT li_tutorial TYPE zcl_abapgit_gui_view_tutorial. ro_html->add( li_tutorial->render( ) ). ELSE. lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( mv_show ). ro_html->add( render_repo( lo_repo ) ). ENDIF. ENDMETHOD. METHOD render_repo. DATA lo_news TYPE REF TO zcl_abapgit_news. CREATE OBJECT ro_html. lo_news = zcl_abapgit_news=>create( io_repo ). ro_html->add( |<div class="repo" id="repo{ io_repo->get_key( ) }">| ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( io_repo = io_repo io_news = lo_news iv_interactive_branch = abap_true ) ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_news( io_news = lo_news ) ). IF mo_repo_content IS BOUND. ro_html->add( mo_repo_content->render( ) ). ENDIF. ro_html->add( '</div>' ). ENDMETHOD. METHOD render_toc. DATA: lo_pback TYPE REF TO zcl_abapgit_persist_background, lv_current TYPE abap_bool, lv_key TYPE zif_abapgit_persistence=>ty_repo-key, lv_icon TYPE string, lo_repo LIKE LINE OF it_repo_list, lo_favbar TYPE REF TO zcl_abapgit_html_toolbar, lo_allbar TYPE REF TO zcl_abapgit_html_toolbar, lt_favorites TYPE zcl_abapgit_persistence_user=>tt_favorites, lv_repo_title TYPE string. CREATE OBJECT ro_html. CREATE OBJECT lo_favbar. CREATE OBJECT lo_allbar EXPORTING iv_id = 'toc-all-repos'. CREATE OBJECT lo_pback. lt_favorites = zcl_abapgit_persistence_user=>get_instance( )->get_favorites( ). LOOP AT it_repo_list INTO lo_repo. lv_key = lo_repo->get_key( ). lv_current = abap_false. IF lv_key = mv_show. lv_current = abap_true. ENDIF. lv_repo_title = lo_repo->get_name( ). IF lo_pback->exists( lv_key ) = abap_true. lv_repo_title = lv_repo_title && '<sup>bg</sup>'. " Background marker ENDIF. READ TABLE lt_favorites TRANSPORTING NO FIELDS WITH KEY table_line = lv_key. IF sy-subrc = 0. DELETE lt_favorites INDEX sy-tabix. " for later cleanup lo_favbar->add( iv_txt = lv_repo_title iv_act = |{ c_actions-show }?{ lv_key }| iv_cur = lv_current ). ENDIF. IF lo_repo->is_offline( ) = abap_true. lv_icon = 'plug/darkgrey'. ELSE. lv_icon = 'cloud-upload-alt/blue'. ENDIF. lo_allbar->add( iv_txt = lv_repo_title iv_act = |{ c_actions-show }?{ lv_key }| iv_ico = lv_icon iv_cur = lv_current ). ENDLOOP. " Cleanup orphan favorites (for removed repos) LOOP AT lt_favorites INTO lv_key. zcl_abapgit_persistence_user=>get_instance( )->toggle_favorite( lv_key ). ENDLOOP. " Render HTML ro_html->add( '<div id="toc">' ) ##NO_TEXT. " TODO refactor html & css ro_html->add( '<div class="toc_grid">' ) ##NO_TEXT. ro_html->add( '<div class="toc_row">' ) ##NO_TEXT. ********************************************************************** ro_html->add( '<table class="w100"><tr>' ). ro_html->add( |<td class="pad-sides">{ zcl_abapgit_html=>icon( iv_name = 'star/blue' iv_hint = 'Favorites' ) }</td>| ). ro_html->add( '<td class="pad-sides w100 favorites">' ). " Maximize width IF lo_favbar->count( ) > 0. ro_html->add( lo_favbar->render( iv_sort = abap_true ) ). ELSE. ro_html->add( |<span class="grey">No favorites so far. For more info please check { zcl_abapgit_html=>a( iv_txt = 'tutorial' iv_act = zif_abapgit_definitions=>c_action-go_tutorial ) }</span>| ). ENDIF. ro_html->add( '</td>' ). ro_html->add( '<td>' ). ro_html->add( lo_allbar->render_as_droplist( iv_label = zcl_abapgit_html=>icon( iv_name = 'bars/blue' ) iv_action = c_actions-overview iv_right = abap_true iv_sort = abap_true ) ). ro_html->add( '</td>' ). ro_html->add( '</tr></table>' ). ********************************************************************** ro_html->add( '</div>' ). ro_html->add( '</div>' ). ro_html->add( '</div>' ). ENDMETHOD. METHOD retrieve_active_repo. DATA: lv_show_old LIKE mv_show. TRY. zcl_abapgit_repo_srv=>get_instance( )->list( ). CATCH zcx_abapgit_exception. RETURN. ENDTRY. lv_show_old = mv_show. mv_show = zcl_abapgit_persistence_user=>get_instance( )->get_repo_show( ). " Get default repo from user cfg IF mv_show IS NOT INITIAL. TRY. " verify the key exists zcl_abapgit_repo_srv=>get_instance( )->get( mv_show ). CATCH zcx_abapgit_exception. CLEAR mv_show. zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( mv_show ). ENDTRY. ENDIF. IF lv_show_old <> mv_show AND NOT mv_show IS INITIAL. CREATE OBJECT mo_repo_content EXPORTING iv_key = mv_show. " Reinit content state ENDIF. ENDMETHOD. METHOD test_changed_by. DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir, lv_user TYPE xubname, ls_item TYPE zif_abapgit_definitions=>ty_item. ls_tadir = zcl_abapgit_ui_factory=>get_popups( )->popup_object( ). IF ls_tadir IS INITIAL. RETURN. ENDIF. ls_item-obj_type = ls_tadir-object. ls_item-obj_name = ls_tadir-obj_name. lv_user = zcl_abapgit_objects=>changed_by( ls_item ). MESSAGE lv_user TYPE 'S'. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA: lv_key TYPE zif_abapgit_persistence=>ty_repo-key, li_repo_overview TYPE REF TO zif_abapgit_gui_renderable. IF NOT mo_repo_content IS INITIAL. mo_repo_content->zif_abapgit_gui_event_handler~on_event( EXPORTING iv_action = iv_action iv_prev_page = iv_prev_page iv_getdata = iv_getdata it_postdata = it_postdata IMPORTING ei_page = ei_page ev_state = ev_state ). IF ev_state <> zcl_abapgit_gui=>c_event_state-not_handled. RETURN. ENDIF. ENDIF. lv_key = iv_getdata. CASE iv_action. WHEN c_actions-show. zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lv_key ). TRY. zcl_abapgit_repo_srv=>get_instance( )->get( lv_key )->refresh( ). CATCH zcx_abapgit_exception ##NO_HANDLER. ENDTRY. ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-changed_by. test_changed_by( ). ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN c_actions-documentation. zcl_abapgit_services_abapgit=>open_abapgit_wikipage( ). ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN c_actions-changelog. zcl_abapgit_services_abapgit=>open_abapgit_changelog( ). ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN c_actions-overview. CREATE OBJECT li_repo_overview TYPE zcl_abapgit_gui_page_repo_over. ei_page = li_repo_overview. ev_state = zcl_abapgit_gui=>c_event_state-new_page. WHEN OTHERS. super->zif_abapgit_gui_event_handler~on_event( EXPORTING iv_action = iv_action iv_prev_page = iv_prev_page iv_getdata = iv_getdata it_postdata = it_postdata IMPORTING ei_page = ei_page ev_state = ev_state ). ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_page_hotkey~get_hotkey_actions. DATA: ls_hotkey_action TYPE zif_abapgit_gui_page_hotkey=>ty_hotkey_with_name. ls_hotkey_action-name = |abapGit settings|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_settings. ls_hotkey_action-hotkey = |x|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |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-name = |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-name = |Installed repo list|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_repo_overview. ls_hotkey_action-hotkey = |o|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |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-name = |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-name = |Add online repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_newonline. ls_hotkey_action-hotkey = |n|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |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-name = |Show diffs|. 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-name = |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-name = |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. ENDCLASS.
34.699541
117
0.65662
98239177e4bffe5b117fe56c5e69f5b21656a56a
3,452
abap
ABAP
src/json/zcl_abapgit_ajson_filter_lib.clas.locals_imp.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/json/zcl_abapgit_ajson_filter_lib.clas.locals_imp.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/json/zcl_abapgit_ajson_filter_lib.clas.locals_imp.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
********************************************************************** * FILTER EMPTY VALUES ********************************************************************** CLASS lcl_empty_filter DEFINITION FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_ajson_filter. ENDCLASS. CLASS lcl_empty_filter IMPLEMENTATION. METHOD zif_abapgit_ajson_filter~keep_node. rv_keep = boolc( ( iv_visit = zif_abapgit_ajson_filter=>visit_type-value AND is_node-value IS NOT INITIAL ) OR ( iv_visit <> zif_abapgit_ajson_filter=>visit_type-value AND is_node-children > 0 ) ). " children = 0 on open for initially empty nodes and on close for filtered ones ENDMETHOD. ENDCLASS. ********************************************************************** * FILTER PREDEFINED PATHS ********************************************************************** CLASS lcl_paths_filter DEFINITION FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_ajson_filter. METHODS constructor IMPORTING it_skip_paths TYPE string_table OPTIONAL iv_skip_paths TYPE string OPTIONAL RAISING zcx_abapgit_ajson_error. PRIVATE SECTION. DATA mt_skip_paths TYPE HASHED TABLE OF string WITH UNIQUE KEY table_line. ENDCLASS. CLASS lcl_paths_filter IMPLEMENTATION. METHOD zif_abapgit_ajson_filter~keep_node. DATA lv_path TYPE string. lv_path = is_node-path && is_node-name. READ TABLE mt_skip_paths WITH KEY table_line = lv_path TRANSPORTING NO FIELDS. rv_keep = boolc( sy-subrc <> 0 ). ENDMETHOD. METHOD constructor. DATA lv_s TYPE string. DATA lt_tab TYPE string_table. FIELD-SYMBOLS <s> TYPE string. IF boolc( iv_skip_paths IS INITIAL ) = boolc( it_skip_paths IS INITIAL ). " XOR zcx_abapgit_ajson_error=>raise( 'no filter path specified' ). ENDIF. LOOP AT it_skip_paths INTO lv_s. lv_s = to_lower( lv_s ). APPEND lv_s TO lt_tab. ENDLOOP. IF iv_skip_paths IS NOT INITIAL. SPLIT iv_skip_paths AT ',' INTO TABLE lt_tab. LOOP AT lt_tab ASSIGNING <s>. IF <s> IS INITIAL. DELETE lt_tab INDEX sy-tabix. CONTINUE. ENDIF. <s> = condense( to_lower( <s> ) ). ENDLOOP. ENDIF. SORT lt_tab BY table_line. DELETE ADJACENT DUPLICATES FROM lt_tab. mt_skip_paths = lt_tab. ENDMETHOD. ENDCLASS. ********************************************************************** * MULTI FILTER ********************************************************************** CLASS lcl_and_filter DEFINITION FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_ajson_filter. METHODS constructor IMPORTING it_filters TYPE zif_abapgit_ajson_filter=>ty_filter_tab RAISING zcx_abapgit_ajson_error. PRIVATE SECTION. DATA mt_filters TYPE zif_abapgit_ajson_filter=>ty_filter_tab. ENDCLASS. CLASS lcl_and_filter IMPLEMENTATION. METHOD zif_abapgit_ajson_filter~keep_node. DATA li_filter LIKE LINE OF mt_filters. rv_keep = abap_true. LOOP AT mt_filters INTO li_filter. rv_keep = li_filter->keep_node( is_node = is_node iv_visit = iv_visit ). IF rv_keep = abap_false. RETURN. ENDIF. ENDLOOP. ENDMETHOD. METHOD constructor. DATA li_filter LIKE LINE OF it_filters. LOOP AT it_filters INTO li_filter WHERE table_line IS BOUND. APPEND li_filter TO mt_filters. ENDLOOP. ENDMETHOD. ENDCLASS.
26.553846
99
0.622248
9826cd56ee348f2606237dece3f32dc17b5f0550
297
abap
ABAP
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.shallowparser/abap/IF_DEMO.abap
assessorgeneral/ConQAT
2a462f23f22c22aa9d01a7a204453d1be670ba60
[ "Apache-2.0" ]
4
2016-06-26T01:13:39.000Z
2022-03-04T16:42:35.000Z
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.shallowparser/abap/IF_DEMO.abap
brynary/conqat
52172907ec76c4b0915091343f0975dc0cf4891c
[ "Apache-2.0" ]
null
null
null
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.shallowparser/abap/IF_DEMO.abap
brynary/conqat
52172907ec76c4b0915091343f0975dc0cf4891c
[ "Apache-2.0" ]
7
2015-04-01T03:50:54.000Z
2021-11-11T05:19:48.000Z
*"* components of interface IF_DEMO interface IF_DEMO public . interfaces IF_DEMO_BASE . data x type string read-only . interface IF_DEMO_RULES load . methods GET returning value(RULES) type IF_DEMO_RULES=>GT_RULES_T raising CX_ROOT . endinterface.
18.5625
50
0.683502
98292d8ceb66c331cd044ea35bd24bebc4253f4e
421
abap
ABAP
src/zif_adcoset_search_query.intf.abap
stockbal/abap-code-search-tools
cf195de4d00c5e73810c80eee879fa9e009dee7a
[ "MIT" ]
8
2022-01-10T17:40:04.000Z
2022-03-15T09:09:56.000Z
src/zif_adcoset_search_query.intf.abap
stockbal/abap-code-search-tools
cf195de4d00c5e73810c80eee879fa9e009dee7a
[ "MIT" ]
null
null
null
src/zif_adcoset_search_query.intf.abap
stockbal/abap-code-search-tools
cf195de4d00c5e73810c80eee879fa9e009dee7a
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en">Search query for code search</p> INTERFACE zif_adcoset_search_query PUBLIC. METHODS: "! <p class="shorttext synchronized" lang="en">Runs search query</p> run, "! <p class="shorttext synchronized" lang="en">Retrieve search results</p> get_results RETURNING VALUE(result) TYPE zif_adcoset_ty_global=>ty_search_result_objects. ENDINTERFACE.
30.071429
79
0.719715
9829305b527edbf1a08ecce3a7e65da6c19f4b7f
1,113
abap
ABAP
src/pgp/zcl_abappgp_subpacket_05.clas.abap
larshp/abapPGP
82cb07e17ad1c402275bb9e01f1b7bc3d1b2021f
[ "MIT" ]
5
2016-11-19T14:35:50.000Z
2022-03-16T03:09:49.000Z
src/pgp/zcl_abappgp_subpacket_05.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
34
2016-09-29T18:06:29.000Z
2022-01-19T06:41:02.000Z
src/pgp/zcl_abappgp_subpacket_05.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
3
2018-12-07T15:30:46.000Z
2021-04-13T18:38:53.000Z
CLASS zcl_abappgp_subpacket_05 DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abappgp_subpacket . ALIASES from_stream FOR zif_abappgp_subpacket~from_stream . ALIASES get_name FOR zif_abappgp_subpacket~get_name . ALIASES get_type FOR zif_abappgp_subpacket~get_type . ALIASES to_stream FOR zif_abappgp_subpacket~to_stream . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPPGP_SUBPACKET_05 IMPLEMENTATION. METHOD zif_abappgp_subpacket~dump. rv_dump = |\tSub - { get_name( ) }(sub { get_type( ) })({ to_stream( )->get_length( ) } bytes)\n\t\ttodo\n|. ENDMETHOD. METHOD zif_abappgp_subpacket~from_stream. * todo CREATE OBJECT ri_packet TYPE zcl_abappgp_subpacket_05. ENDMETHOD. METHOD zif_abappgp_subpacket~get_name. rv_name = 'Trust Signature'. ENDMETHOD. METHOD zif_abappgp_subpacket~get_type. rv_type = zif_abappgp_constants=>c_sub_type-trust_signature. ENDMETHOD. METHOD zif_abappgp_subpacket~to_stream. CREATE OBJECT ro_stream. * todo ENDMETHOD. ENDCLASS.
17.390625
112
0.736748
982dcd9842a83d026d212be32a1a625ccf45cf7c
11,093
abap
ABAP
src/zcl_abapgit_news.clas.testclasses.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
1
2021-01-21T15:34:26.000Z
2021-01-21T15:34:26.000Z
src/zcl_abapgit_news.clas.testclasses.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
1
2020-01-05T16:45:32.000Z
2020-01-05T16:45:32.000Z
src/zcl_abapgit_news.clas.testclasses.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
null
null
null
CLASS ltcl_relevant DEFINITION DEFERRED. CLASS zcl_abapgit_news DEFINITION LOCAL FRIENDS ltcl_relevant. CLASS ltcl_relevant DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. METHODS: test01 FOR TESTING, test02 FOR TESTING, test03 FOR TESTING. ENDCLASS. CLASS ltcl_relevant IMPLEMENTATION. METHOD test01. DATA: lv_relevant TYPE abap_bool. lv_relevant = zcl_abapgit_news=>is_relevant( 'https://github.com/larshp/abapGit.git' ). cl_abap_unit_assert=>assert_equals( act = lv_relevant exp = abap_true ). ENDMETHOD. METHOD test02. DATA: lv_relevant TYPE abap_bool. lv_relevant = zcl_abapgit_news=>is_relevant( 'https://github.com/larshp/abapGit' ). cl_abap_unit_assert=>assert_equals( act = lv_relevant exp = abap_true ). ENDMETHOD. METHOD test03. DATA: lv_relevant TYPE abap_bool. lv_relevant = zcl_abapgit_news=>is_relevant( 'https://github.com/larshp/something' ). cl_abap_unit_assert=>assert_equals( act = lv_relevant exp = abap_false ). ENDMETHOD. ENDCLASS. ********************************************************************** * Helper classed CLASS lcl_string_buffer DEFINITION FINAL. PUBLIC SECTION. DATA mt_buffer TYPE string_table. METHODS add IMPORTING iv_str TYPE string. ENDCLASS. CLASS lcl_string_buffer IMPLEMENTATION. METHOD add. APPEND iv_str TO mt_buffer. ENDMETHOD. ENDCLASS. CLASS lcl_log_entries DEFINITION FINAL. PUBLIC SECTION. DATA mt_log_entries TYPE zcl_abapgit_news=>tt_log. METHODS add IMPORTING iv_str TYPE string. ENDCLASS. CLASS lcl_log_entries IMPLEMENTATION. METHOD add. DATA ls_log LIKE LINE OF mt_log_entries. DATA lv_pos_to_cur_str TYPE string. SPLIT iv_str AT '/' INTO ls_log-version ls_log-is_header ls_log-is_important lv_pos_to_cur_str ls_log-text. CONDENSE ls_log-version. CONDENSE ls_log-is_header. CONDENSE ls_log-is_important. CONDENSE ls_log-text. ls_log-pos_to_cur = lv_pos_to_cur_str. APPEND ls_log TO mt_log_entries. ENDMETHOD. ENDCLASS. ********************************************************************** CLASS ltcl_news DEFINITION DEFERRED. CLASS zcl_abapgit_news DEFINITION LOCAL FRIENDS ltcl_news. *----------------------------------------------------------------------* * CLASS ltcl_news DEFINITION *----------------------------------------------------------------------* * Definition of test class for news announcement *----------------------------------------------------------------------* CLASS ltcl_news DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PRIVATE SECTION. METHODS: version_to_numeric FOR TESTING, compare_versions FOR TESTING, normalize_version FOR TESTING, parse_line FOR TESTING, parse FOR TESTING. ENDCLASS. *----------------------------------------------------------------------* * CLASS ltcl_news IMPLEMENTATION *----------------------------------------------------------------------* * Implementation of test class for news announcement *----------------------------------------------------------------------* CLASS ltcl_news IMPLEMENTATION. METHOD version_to_numeric. DATA: lv_version_exp TYPE i VALUE 1023010, lv_version_act TYPE i. lv_version_act = zcl_abapgit_news=>version_to_numeric( '1.23.10' ). cl_abap_unit_assert=>assert_equals( exp = lv_version_exp act = lv_version_act msg = ' Error during conversion of version to numeric value' ). ENDMETHOD. METHOD compare_versions. DATA lv_result TYPE i. " Case 1: version A > version B lv_result = zcl_abapgit_news=>compare_versions( iv_a = '1.28.10' iv_b = '1.23.10' ). cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_result msg = ' Error during comparison of versions. Case: A > B' ). CLEAR: lv_result. " Case 2: version A < version B lv_result = zcl_abapgit_news=>compare_versions( iv_a = '1.28.10' iv_b = '2.23.10' ). cl_abap_unit_assert=>assert_equals( exp = -1 act = lv_result msg = ' Error during comparison of versions. Case: A < B' ). CLEAR: lv_result. " Case 3: version A = version B lv_result = zcl_abapgit_news=>compare_versions( iv_a = '1.28.10' iv_b = '1.28.10' ). cl_abap_unit_assert=>assert_equals( exp = 0 act = lv_result msg = ' Error during comparison of versions. Case: A = B' ). ENDMETHOD. METHOD normalize_version. cl_abap_unit_assert=>assert_equals( act = zcl_abapgit_news=>normalize_version( '1.28.10' ) exp = '1.28.10' ). cl_abap_unit_assert=>assert_equals( act = zcl_abapgit_news=>normalize_version( 'v1.28.10' ) exp = '1.28.10' ). cl_abap_unit_assert=>assert_equals( act = zcl_abapgit_news=>normalize_version( 'b1.28.10' ) exp = '' ). cl_abap_unit_assert=>assert_equals( act = zcl_abapgit_news=>normalize_version( 'x.y.z' ) exp = '' ). ENDMETHOD. METHOD parse_line. DATA: ls_log TYPE zcl_abapgit_news=>ty_log. ls_log = zcl_abapgit_news=>parse_line( iv_line = '======' iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_initial( ls_log ). ls_log = zcl_abapgit_news=>parse_line( iv_line = '' iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_initial( ls_log ). ls_log = zcl_abapgit_news=>parse_line( iv_line = '------' iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_initial( ls_log ). CLEAR ls_log. ls_log = zcl_abapgit_news=>parse_line( iv_line = '2017-02-13 v1.28.0' iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_equals( act = ls_log-version exp = '1.28.0' ). cl_abap_unit_assert=>assert_equals( act = ls_log-is_header exp = abap_true ). cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur exp = 1 ). CLEAR ls_log. ls_log = zcl_abapgit_news=>parse_line( iv_line = '2017-02-13 v1.26.0' iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_equals( act = ls_log-version exp = '1.26.0' ). cl_abap_unit_assert=>assert_equals( act = ls_log-is_header exp = abap_true ). cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur exp = -1 ). CLEAR ls_log. ls_log = zcl_abapgit_news=>parse_line( iv_line = 'news' iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_equals( act = ls_log-version exp = '' ). cl_abap_unit_assert=>assert_equals( act = ls_log-is_header exp = abap_false ). cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur exp = 0 ). cl_abap_unit_assert=>assert_equals( act = ls_log-is_important exp = abap_false ). cl_abap_unit_assert=>assert_equals( act = ls_log-text exp = 'news' ). CLEAR ls_log. ls_log = zcl_abapgit_news=>parse_line( iv_line = ' ! important news' iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_equals( act = ls_log-version exp = '' ). cl_abap_unit_assert=>assert_equals( act = ls_log-is_header exp = abap_false ). cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur exp = 0 ). cl_abap_unit_assert=>assert_equals( act = ls_log-is_important exp = abap_true ). cl_abap_unit_assert=>assert_equals( act = ls_log-text exp = ' ! important news' ). ENDMETHOD. METHOD parse. DATA lt_log_act TYPE zcl_abapgit_news=>tt_log. DATA lo_src_text_buf TYPE REF TO lcl_string_buffer. DATA lo_log_entries TYPE REF TO lcl_log_entries. " Generate test data CREATE OBJECT lo_src_text_buf. lo_src_text_buf->add( '======' ). lo_src_text_buf->add( '------' ). lo_src_text_buf->add( ` ` ). lo_src_text_buf->add( 'abapGit changelog' ). lo_src_text_buf->add( '2017-02-13 v1.28.0' ). lo_src_text_buf->add( '------------------' ). lo_src_text_buf->add( '+ Staging page redesigned' ). lo_src_text_buf->add( '! Support for core data services' ). lo_src_text_buf->add( ` ` ). lo_src_text_buf->add( '2017-01-25 v1.27.0' ). lo_src_text_buf->add( '------------------' ). lo_src_text_buf->add( '+ Two factor authentication with github.com' ). lo_src_text_buf->add( '2017-01-25 v1.26.0' ). " Case 1 " Generate expected results CREATE OBJECT lo_log_entries. " VERSION HEAD IMP POS TEXT lo_log_entries->add( '1.28.0 /X / /1 /2017-02-13 v1.28.0' ). lo_log_entries->add( '1.28.0 / / /0 /+ Staging page redesigned' ). lo_log_entries->add( '1.28.0 / /X /0 /! Support for core data services' ). lo_log_entries->add( '1.27.0 /X / /1 /2017-01-25 v1.27.0' ). lo_log_entries->add( '1.27.0 / / /0 /+ Two factor authentication with github.com' ). lt_log_act = zcl_abapgit_news=>parse( it_lines = lo_src_text_buf->mt_buffer iv_current_version = '1.26.01' ). cl_abap_unit_assert=>assert_equals( exp = lo_log_entries->mt_log_entries act = lt_log_act msg = ' Error during parsing: Case 1.' ). " Case 2 (exect version match) CREATE OBJECT lo_log_entries. " VERSION HEAD IMP UPD TEXT lo_log_entries->add( '1.28.0 /X / /1 /2017-02-13 v1.28.0' ). lo_log_entries->add( '1.28.0 / / /0 /+ Staging page redesigned' ). lo_log_entries->add( '1.28.0 / /X /0 /! Support for core data services' ). lt_log_act = zcl_abapgit_news=>parse( it_lines = lo_src_text_buf->mt_buffer iv_current_version = '1.27.00' ). cl_abap_unit_assert=>assert_equals( exp = lo_log_entries->mt_log_entries act = lt_log_act msg = ' Error during parsing: Case 2.' ). " Case 3 (display tail) CREATE OBJECT lo_log_entries. " VERSION HEAD IMP UPD TEXT lo_log_entries->add( '1.28.0 /X / /0 /2017-02-13 v1.28.0' ). lo_log_entries->add( '1.28.0 / / /0 /+ Staging page redesigned' ). lo_log_entries->add( '1.28.0 / /X /0 /! Support for core data services' ). lo_log_entries->add( '1.27.0 /X / /-1 /2017-01-25 v1.27.0' ). lo_log_entries->add( '1.27.0 / / /0 /+ Two factor authentication with github.com' ). lo_log_entries->add( '1.26.0 /X / /-1 /2017-01-25 v1.26.0' ). lt_log_act = zcl_abapgit_news=>parse( it_lines = lo_src_text_buf->mt_buffer iv_current_version = '1.28.00' ). cl_abap_unit_assert=>assert_equals( exp = lo_log_entries->mt_log_entries act = lt_log_act msg = ' Error during parsing: Case 3.' ). ENDMETHOD. ENDCLASS.
33.513595
103
0.6075
982e1f6d6cd676f439d7ee11cea70801541dba4c
3,179
abap
ABAP
src/zexport_utils.clas.abap
ABAP-prep/abap_db_preparator
099a5867a5c20faa72b9cd27988992dceb35efa2
[ "MIT" ]
9
2020-04-03T21:24:24.000Z
2022-01-06T14:59:05.000Z
src/zexport_utils.clas.abap
ABAP-prep/abap_db_preparator
099a5867a5c20faa72b9cd27988992dceb35efa2
[ "MIT" ]
8
2020-02-15T11:49:00.000Z
2021-05-04T11:59:40.000Z
src/zexport_utils.clas.abap
ABAP-prep/abap_db_preparator
099a5867a5c20faa72b9cd27988992dceb35efa2
[ "MIT" ]
5
2021-01-05T11:40:23.000Z
2022-03-31T13:43:26.000Z
CLASS zexport_utils DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. TYPES: _conditions TYPE STANDARD TABLE OF string . CLASS-METHODS get_table_for_all_entries IMPORTING !table_conjunction TYPE zexport_table_list RETURNING VALUE(table_name) TYPE tabname EXCEPTIONS not_for_all_entries_cond . "! Perform select-statement "! @parameter table_name | Dictionary-Name of table_for_all_entries CLASS-METHODS select IMPORTING !table_for_all_entries TYPE STANDARD TABLE !table_conjunction TYPE zexport_table_list !table_name TYPE tabname select_from_fake TYPE abap_bool DEFAULT abap_false EXPORTING result TYPE STANDARD TABLE RAISING zcx_export_error. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZEXPORT_UTILS IMPLEMENTATION. METHOD get_table_for_all_entries. CONSTANTS: expression TYPE string VALUE 'FOR ALL ENTRIES IN'. DATA(where_restriction) = table_conjunction-where_restriction. TRANSLATE where_restriction TO UPPER CASE. DATA(length) = strlen( expression ). IF strlen( where_restriction ) < length OR where_restriction+0(length) <> expression. RAISE not_for_all_entries_cond. ENDIF. SHIFT where_restriction BY length PLACES LEFT. FIND FIRST OCCURRENCE OF 'WHERE' IN where_restriction MATCH OFFSET length IGNORING CASE. table_name = where_restriction+0(length). CONDENSE table_name NO-GAPS. ENDMETHOD. METHOD select. DATA: offset TYPE i, length TYPE i. IF table_for_all_entries IS INITIAL. RAISE EXCEPTION TYPE zcx_export_empty EXPORTING table_name = table_name. ENDIF. CLEAR result. FIND FIRST OCCURRENCE OF 'WHERE' IN table_conjunction-where_restriction MATCH OFFSET offset MATCH LENGTH length IGNORING CASE. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_export_where_clause_invali EXPORTING table = table_conjunction-source_table where_clause = table_conjunction-where_restriction failure_description = CONV string( text-001 ). ENDIF. offset = offset + length. DATA(where_restriction) = table_conjunction-where_restriction+offset. REPLACE ALL OCCURRENCES OF table_name IN where_restriction WITH 'table_for_all_entries' IGNORING CASE. DATA(select_table) = COND tabname( WHEN select_from_fake = abap_true THEN table_conjunction-fake_table ELSE table_conjunction-source_table ). TRY. SELECT * FROM (select_table) INTO TABLE result FOR ALL ENTRIES IN table_for_all_entries WHERE (where_restriction). CATCH cx_sy_dynamic_osql_error INTO DATA(osql_syntax_error). RAISE EXCEPTION TYPE zcx_export_where_clause_invali EXPORTING table = table_conjunction-source_table where_clause = table_conjunction-where_restriction failure_description = osql_syntax_error->msgtext. ENDTRY. ENDMETHOD. ENDCLASS.
29.990566
75
0.692356
982e71e699f6cd2022d511cac2ac427debb490db
35,074
abap
ABAP
src/objects/zcl_abapgit_object_fugr.clas.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_fugr.clas.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_fugr.clas.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_fugr DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_program FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. PROTECTED SECTION. PRIVATE SECTION. TYPES: ty_rs38l_incl_tt TYPE STANDARD TABLE OF rs38l_incl WITH DEFAULT KEY . TYPES: BEGIN OF ty_function, funcname TYPE rs38l_fnam, global_flag TYPE rs38l-global, remote_call TYPE rs38l-remote, update_task TYPE rs38l-utask, short_text TYPE tftit-stext, remote_basxml TYPE rs38l-basxml_enabled, import TYPE STANDARD TABLE OF rsimp WITH DEFAULT KEY, changing TYPE STANDARD TABLE OF rscha WITH DEFAULT KEY, export TYPE STANDARD TABLE OF rsexp WITH DEFAULT KEY, tables TYPE STANDARD TABLE OF rstbl WITH DEFAULT KEY, exception TYPE STANDARD TABLE OF rsexc WITH DEFAULT KEY, documentation TYPE STANDARD TABLE OF rsfdo WITH DEFAULT KEY, exception_classes TYPE abap_bool, END OF ty_function . TYPES: ty_function_tt TYPE STANDARD TABLE OF ty_function WITH DEFAULT KEY . TYPES: ty_sobj_name_tt TYPE STANDARD TABLE OF sobj_name WITH DEFAULT KEY . TYPES: BEGIN OF ty_tpool_i18n, language TYPE langu, textpool TYPE zif_abapgit_definitions=>ty_tpool_tt, END OF ty_tpool_i18n . TYPES: tt_tpool_i18n TYPE STANDARD TABLE OF ty_tpool_i18n . METHODS update_where_used IMPORTING !it_includes TYPE ty_sobj_name_tt . METHODS main_name RETURNING VALUE(rv_program) TYPE program RAISING zcx_abapgit_exception . METHODS functions RETURNING VALUE(rt_functab) TYPE ty_rs38l_incl_tt RAISING zcx_abapgit_exception . METHODS includes RETURNING VALUE(rt_includes) TYPE ty_sobj_name_tt RAISING zcx_abapgit_exception . METHODS serialize_functions RETURNING VALUE(rt_functions) TYPE ty_function_tt RAISING zcx_abapgit_exception . METHODS deserialize_functions IMPORTING !it_functions TYPE ty_function_tt !ii_log TYPE REF TO zif_abapgit_log RAISING zcx_abapgit_exception . METHODS serialize_xml IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_xml IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input !iv_package TYPE devclass RAISING zcx_abapgit_exception . METHODS serialize_includes RAISING zcx_abapgit_exception . METHODS deserialize_includes IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input !iv_package TYPE devclass !ii_log TYPE REF TO zif_abapgit_log RAISING zcx_abapgit_exception . METHODS are_exceptions_class_based IMPORTING !iv_function_name TYPE rs38l_fnam RETURNING VALUE(rv_return) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS is_function_group_locked RETURNING VALUE(rv_is_functions_group_locked) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS is_any_include_locked RETURNING VALUE(rv_is_any_include_locked) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS is_any_function_module_locked RETURNING VALUE(rv_any_function_module_locked) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS get_abap_version IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RETURNING VALUE(rv_abap_version) TYPE progdir-uccheck RAISING zcx_abapgit_exception . METHODS update_func_group_short_text IMPORTING !iv_group TYPE rs38l-area !iv_short_text TYPE tftit-stext . METHODS serialize_texts IMPORTING !iv_prog_name TYPE programm !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_texts IMPORTING !iv_prog_name TYPE programm !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_FUGR IMPLEMENTATION. METHOD are_exceptions_class_based. DATA: lt_dokumentation TYPE TABLE OF funct, lt_exception_list TYPE TABLE OF rsexc, lt_export_parameter TYPE TABLE OF rsexp, lt_import_parameter TYPE TABLE OF rsimp, lt_tables_parameter TYPE TABLE OF rstbl. CALL FUNCTION 'FUNCTION_IMPORT_DOKU' EXPORTING funcname = iv_function_name IMPORTING exception_class = rv_return TABLES dokumentation = lt_dokumentation exception_list = lt_exception_list export_parameter = lt_export_parameter import_parameter = lt_import_parameter tables_parameter = lt_tables_parameter EXCEPTIONS error_message = 1 function_not_found = 2 invalid_name = 3 OTHERS = 4. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from FUNCTION_IMPORT_DOKU' ). ENDIF. ENDMETHOD. METHOD deserialize_functions. DATA: lv_include TYPE rs38l-include, lv_area TYPE rs38l-area, lv_group TYPE rs38l-area, lv_namespace TYPE rs38l-namespace, lt_source TYPE TABLE OF abaptxt255, lv_msg TYPE string, lv_corrnum TYPE e070use-ordernum. FIELD-SYMBOLS: <ls_func> LIKE LINE OF it_functions. lv_corrnum = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum. LOOP AT it_functions ASSIGNING <ls_func>. lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ). lv_area = ms_item-obj_name. CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT' EXPORTING complete_area = lv_area IMPORTING namespace = lv_namespace group = lv_group EXCEPTIONS OTHERS = 12. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg. ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }| is_item = ms_item ). CONTINUE. "with next function module ENDIF. CALL FUNCTION 'FUNCTION_EXISTS' EXPORTING funcname = <ls_func>-funcname IMPORTING include = lv_include EXCEPTIONS function_not_exist = 1. IF sy-subrc = 0. * delete the function module to make sure the parameters are updated * havent found a nice way to update the paramters CALL FUNCTION 'FUNCTION_DELETE' EXPORTING funcname = <ls_func>-funcname suppress_success_message = abap_true EXCEPTIONS error_message = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg. ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }| is_item = ms_item ). CONTINUE. "with next function module ENDIF. ENDIF. CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT' EXPORTING funcname = <ls_func>-funcname function_pool = lv_group interface_global = <ls_func>-global_flag remote_call = <ls_func>-remote_call short_text = <ls_func>-short_text update_task = <ls_func>-update_task exception_class = <ls_func>-exception_classes namespace = lv_namespace remote_basxml_supported = <ls_func>-remote_basxml corrnum = lv_corrnum IMPORTING function_include = lv_include TABLES import_parameter = <ls_func>-import export_parameter = <ls_func>-export tables_parameter = <ls_func>-tables changing_parameter = <ls_func>-changing exception_list = <ls_func>-exception parameter_docu = <ls_func>-documentation EXCEPTIONS double_task = 1 error_message = 2 function_already_exists = 3 invalid_function_pool = 4 invalid_name = 5 too_many_functions = 6 no_modify_permission = 7 no_show_permission = 8 enqueue_system_failure = 9 canceled_in_corr = 10 OTHERS = 11. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg. ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }| is_item = ms_item ). CONTINUE. "with next function module ENDIF. INSERT REPORT lv_include FROM lt_source. ii_log->add_success( iv_msg = |Function module { <ls_func>-funcname } imported| is_item = ms_item ). ENDLOOP. ENDMETHOD. METHOD deserialize_includes. DATA: lo_xml TYPE REF TO zcl_abapgit_xml_input, ls_progdir TYPE ty_progdir, lt_includes TYPE ty_sobj_name_tt, lt_tpool TYPE textpool_table, lt_tpool_ext TYPE zif_abapgit_definitions=>ty_tpool_tt, lt_source TYPE TABLE OF abaptxt255, lx_exc TYPE REF TO zcx_abapgit_exception. FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes. tadir_insert( iv_package ). io_xml->read( EXPORTING iv_name = 'INCLUDES' CHANGING cg_data = lt_includes ). LOOP AT lt_includes ASSIGNING <lv_include>. "ignore simple transformation includes (as long as they remain in existing repositories) IF strlen( <lv_include> ) = 33 AND <lv_include>+30(3) = 'XTI'. ii_log->add_warning( iv_msg = |Simple Transformation include { <lv_include> } ignored| is_item = ms_item ). CONTINUE. ENDIF. TRY. lt_source = mo_files->read_abap( iv_extra = <lv_include> ). lo_xml = mo_files->read_xml( <lv_include> ). lo_xml->read( EXPORTING iv_name = 'PROGDIR' CHANGING cg_data = ls_progdir ). lo_xml->read( EXPORTING iv_name = 'TPOOL' CHANGING cg_data = lt_tpool_ext ). lt_tpool = read_tpool( lt_tpool_ext ). deserialize_program( is_progdir = ls_progdir it_source = lt_source it_tpool = lt_tpool iv_package = iv_package ). deserialize_textpool( iv_program = <lv_include> it_tpool = lt_tpool iv_is_include = abap_true ). ii_log->add_success( iv_msg = |Include { ls_progdir-name } imported| is_item = ms_item ). CATCH zcx_abapgit_exception INTO lx_exc. ii_log->add_exception( ix_exc = lx_exc is_item = ms_item ). CONTINUE. ENDTRY. ENDLOOP. ENDMETHOD. METHOD deserialize_texts. DATA: lt_tpool_i18n TYPE tt_tpool_i18n, lt_tpool TYPE textpool_table. FIELD-SYMBOLS <ls_tpool> LIKE LINE OF lt_tpool_i18n. io_xml->read( EXPORTING iv_name = 'I18N_TPOOL' CHANGING cg_data = lt_tpool_i18n ). LOOP AT lt_tpool_i18n ASSIGNING <ls_tpool>. lt_tpool = read_tpool( <ls_tpool>-textpool ). deserialize_textpool( iv_program = iv_prog_name iv_language = <ls_tpool>-language it_tpool = lt_tpool ). ENDLOOP. ENDMETHOD. METHOD deserialize_xml. DATA: lv_complete TYPE rs38l-area, lv_namespace TYPE rs38l-namespace, lv_areat TYPE tlibt-areat, lv_stext TYPE tftit-stext, lv_group TYPE rs38l-area, lv_abap_version TYPE trdir-uccheck, lv_corrnum TYPE e070use-ordernum. lv_abap_version = get_abap_version( io_xml ). lv_complete = ms_item-obj_name. CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT' EXPORTING complete_area = lv_complete IMPORTING namespace = lv_namespace group = lv_group EXCEPTIONS include_not_exists = 1 group_not_exists = 2 no_selections = 3 no_function_include = 4 no_function_pool = 5 delimiter_wrong_position = 6 no_customer_function_group = 7 no_customer_function_include = 8 reserved_name_customer = 9 namespace_too_long = 10 area_length_error = 11 OTHERS = 12. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from FUNCTION_INCLUDE_SPLIT' ). ENDIF. io_xml->read( EXPORTING iv_name = 'AREAT' CHANGING cg_data = lv_areat ). lv_stext = lv_areat. lv_corrnum = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum. CALL FUNCTION 'RS_FUNCTION_POOL_INSERT' EXPORTING function_pool = lv_group short_text = lv_stext namespace = lv_namespace devclass = iv_package unicode_checks = lv_abap_version corrnum = lv_corrnum suppress_corr_check = abap_false EXCEPTIONS name_already_exists = 1 name_not_correct = 2 function_already_exists = 3 invalid_function_pool = 4 invalid_name = 5 too_many_functions = 6 no_modify_permission = 7 no_show_permission = 8 enqueue_system_failure = 9 canceled_in_corr = 10 undefined_error = 11 OTHERS = 12. CASE sy-subrc. WHEN 0. " Everything is ok WHEN 1 OR 3. " If the function group exists we need to manually update the short text update_func_group_short_text( iv_group = lv_group iv_short_text = lv_stext ). WHEN OTHERS. zcx_abapgit_exception=>raise( |error from RS_FUNCTION_POOL_INSERT, code: { sy-subrc }| ). ENDCASE. ENDMETHOD. METHOD functions. DATA: lv_area TYPE rs38l-area. lv_area = ms_item-obj_name. CALL FUNCTION 'RS_FUNCTION_POOL_CONTENTS' EXPORTING function_pool = lv_area TABLES functab = rt_functab EXCEPTIONS function_pool_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from RS_FUNCTION_POOL_CONTENTS' ). ENDIF. SORT rt_functab BY funcname ASCENDING. DELETE ADJACENT DUPLICATES FROM rt_functab COMPARING funcname. ENDMETHOD. METHOD get_abap_version. DATA: lt_includes TYPE ty_sobj_name_tt, ls_progdir TYPE ty_progdir, lo_xml TYPE REF TO zcl_abapgit_xml_input. FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes. io_xml->read( EXPORTING iv_name = 'INCLUDES' CHANGING cg_data = lt_includes ). LOOP AT lt_includes ASSIGNING <lv_include>. lo_xml = mo_files->read_xml( <lv_include> ). lo_xml->read( EXPORTING iv_name = 'PROGDIR' CHANGING cg_data = ls_progdir ). IF ls_progdir-uccheck IS INITIAL. CONTINUE. ELSEIF rv_abap_version IS INITIAL. rv_abap_version = ls_progdir-uccheck. CONTINUE. ELSEIF rv_abap_version <> ls_progdir-uccheck. *** All includes need to have the same ABAP language version zcx_abapgit_exception=>raise( 'different ABAP Language Versions' ). ENDIF. ENDLOOP. IF rv_abap_version IS INITIAL. rv_abap_version = 'X'. ENDIF. ENDMETHOD. METHOD includes. TYPES: BEGIN OF ty_reposrc, progname TYPE reposrc-progname, cnam TYPE reposrc-cnam, END OF ty_reposrc. DATA: lt_reposrc TYPE STANDARD TABLE OF ty_reposrc WITH DEFAULT KEY, ls_reposrc LIKE LINE OF lt_reposrc, lv_program TYPE program, lv_maintviewname LIKE LINE OF rt_includes, lv_offset_ns TYPE i, lv_tabix LIKE sy-tabix, lt_functab TYPE ty_rs38l_incl_tt, lt_tadir_includes TYPE HASHED TABLE OF objname WITH UNIQUE KEY table_line. FIELD-SYMBOLS: <lv_include> LIKE LINE OF rt_includes, <ls_func> LIKE LINE OF lt_functab. lv_program = main_name( ). lt_functab = functions( ). CALL FUNCTION 'RS_GET_ALL_INCLUDES' EXPORTING program = lv_program * WITH_RESERVED_INCLUDES = * WITH_CLASS_INCLUDES = ' ' hmm, todo TABLES includetab = rt_includes EXCEPTIONS not_existent = 1 no_program = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from RS_GET_ALL_INCLUDES' ). ENDIF. LOOP AT lt_functab ASSIGNING <ls_func>. DELETE TABLE rt_includes FROM <ls_func>-include. ENDLOOP. * handle generated maintenance views IF ms_item-obj_name(1) <> '/'. "FGroup name does not contain a namespace lv_maintviewname = |L{ ms_item-obj_name }T00|. ELSE. "FGroup name contains a namespace lv_offset_ns = find( val = ms_item-obj_name+1 sub = '/' ). lv_offset_ns = lv_offset_ns + 2. lv_maintviewname = |{ ms_item-obj_name(lv_offset_ns) }L{ ms_item-obj_name+lv_offset_ns }T00|. ENDIF. READ TABLE rt_includes WITH KEY table_line = lv_maintviewname TRANSPORTING NO FIELDS. IF sy-subrc <> 0. APPEND lv_maintviewname TO rt_includes. ENDIF. IF lines( rt_includes ) > 0. " check which includes have their own tadir entry " these includes might reside in a different package or might be shared between multiple function groups " or other programs and are hence no part of the to serialized FUGR object " they will be handled as individual objects when serializing their package " in addition, referenced XTI includes referencing (simple) transformations must be ignored SELECT obj_name INTO TABLE lt_tadir_includes FROM tadir FOR ALL ENTRIES IN rt_includes WHERE pgmid = 'R3TR' AND object = 'PROG' AND obj_name = rt_includes-table_line. LOOP AT rt_includes ASSIGNING <lv_include>. " skip autogenerated includes from Table Maintenance Generator IF <lv_include> CP 'LSVIM*'. DELETE rt_includes INDEX sy-tabix. CONTINUE. ENDIF. READ TABLE lt_tadir_includes WITH KEY table_line = <lv_include> TRANSPORTING NO FIELDS. IF sy-subrc = 0. DELETE rt_includes. CONTINUE. ENDIF. IF strlen( <lv_include> ) = 33 AND <lv_include>+30(3) = 'XTI'. "ignore referenced (simple) transformation includes DELETE rt_includes. CONTINUE. ENDIF. ENDLOOP. SELECT progname cnam FROM reposrc INTO TABLE lt_reposrc FOR ALL ENTRIES IN rt_includes WHERE progname = rt_includes-table_line AND r3state = 'A'. SORT lt_reposrc BY progname ASCENDING. ENDIF. LOOP AT rt_includes ASSIGNING <lv_include>. lv_tabix = sy-tabix. * make sure the include exists READ TABLE lt_reposrc INTO ls_reposrc WITH KEY progname = <lv_include> BINARY SEARCH. IF sy-subrc <> 0. DELETE rt_includes INDEX lv_tabix. ENDIF. ENDLOOP. APPEND lv_program TO rt_includes. ENDMETHOD. METHOD is_any_function_module_locked. DATA: lt_functions TYPE ty_rs38l_incl_tt. FIELD-SYMBOLS: <ls_function> TYPE rs38l_incl. TRY. lt_functions = functions( ). CATCH zcx_abapgit_exception. RETURN. ENDTRY. LOOP AT lt_functions ASSIGNING <ls_function>. IF exists_a_lock_entry_for( iv_lock_object = 'ESFUNCTION' iv_argument = |{ <ls_function>-funcname }| ) = abap_true. rv_any_function_module_locked = abap_true. EXIT. ENDIF. ENDLOOP. ENDMETHOD. METHOD is_any_include_locked. DATA: lt_includes TYPE ty_sobj_name_tt. FIELD-SYMBOLS: <lv_include> TYPE sobj_name. TRY. lt_includes = includes( ). CATCH zcx_abapgit_exception. RETURN. ENDTRY. LOOP AT lt_includes ASSIGNING <lv_include>. IF exists_a_lock_entry_for( iv_lock_object = 'ESRDIRE' iv_argument = |{ <lv_include> }| ) = abap_true. rv_is_any_include_locked = abap_true. EXIT. ENDIF. ENDLOOP. ENDMETHOD. METHOD is_function_group_locked. DATA: lv_object TYPE eqegraarg. lv_object = |FG{ ms_item-obj_name }|. OVERLAY lv_object WITH ' '. lv_object = lv_object && '*'. rv_is_functions_group_locked = exists_a_lock_entry_for( iv_lock_object = 'EEUDB' iv_argument = lv_object ). ENDMETHOD. METHOD main_name. DATA: lv_area TYPE rs38l-area, lv_namespace TYPE rs38l-namespace, lv_group TYPE rs38l-area. lv_area = ms_item-obj_name. CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT' EXPORTING complete_area = lv_area IMPORTING namespace = lv_namespace group = lv_group EXCEPTIONS include_not_exists = 1 group_not_exists = 2 no_selections = 3 no_function_include = 4 no_function_pool = 5 delimiter_wrong_position = 6 no_customer_function_group = 7 no_customer_function_include = 8 reserved_name_customer = 9 namespace_too_long = 10 area_length_error = 11 OTHERS = 12. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from FUNCTION_INCLUDE_SPLIT' ). ENDIF. CONCATENATE lv_namespace 'SAPL' lv_group INTO rv_program. ENDMETHOD. METHOD serialize_functions. DATA: lt_source TYPE TABLE OF rssource, lt_functab TYPE ty_rs38l_incl_tt, lt_new_source TYPE rsfb_source, ls_function LIKE LINE OF rt_functions. FIELD-SYMBOLS: <ls_func> LIKE LINE OF lt_functab, <ls_documentation> TYPE LINE OF ty_function-documentation. lt_functab = functions( ). LOOP AT lt_functab ASSIGNING <ls_func>. * fm RPY_FUNCTIONMODULE_READ does not support source code * lines longer than 72 characters CLEAR ls_function. MOVE-CORRESPONDING <ls_func> TO ls_function. CLEAR lt_new_source. CLEAR lt_source. CALL FUNCTION 'RPY_FUNCTIONMODULE_READ_NEW' EXPORTING functionname = <ls_func>-funcname IMPORTING global_flag = ls_function-global_flag remote_call = ls_function-remote_call update_task = ls_function-update_task short_text = ls_function-short_text remote_basxml_supported = ls_function-remote_basxml TABLES import_parameter = ls_function-import changing_parameter = ls_function-changing export_parameter = ls_function-export tables_parameter = ls_function-tables exception_list = ls_function-exception documentation = ls_function-documentation source = lt_source CHANGING new_source = lt_new_source EXCEPTIONS error_message = 1 function_not_found = 2 invalid_name = 3 OTHERS = 4. IF sy-subrc = 2. CONTINUE. ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from RPY_FUNCTIONMODULE_READ_NEW' ). ENDIF. LOOP AT ls_function-documentation ASSIGNING <ls_documentation>. CLEAR <ls_documentation>-index. ENDLOOP. ls_function-exception_classes = are_exceptions_class_based( <ls_func>-funcname ). APPEND ls_function TO rt_functions. IF NOT lt_new_source IS INITIAL. mo_files->add_abap( iv_extra = <ls_func>-funcname it_abap = lt_new_source ). ELSE. mo_files->add_abap( iv_extra = <ls_func>-funcname it_abap = lt_source ). ENDIF. ENDLOOP. ENDMETHOD. METHOD serialize_includes. DATA: lt_includes TYPE ty_sobj_name_tt. FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes. lt_includes = includes( ). LOOP AT lt_includes ASSIGNING <lv_include>. * todo, filename is not correct, a include can be used in several programs serialize_program( is_item = ms_item io_files = mo_files iv_program = <lv_include> iv_extra = <lv_include> ). ENDLOOP. ENDMETHOD. METHOD serialize_texts. DATA: lt_tpool_i18n TYPE tt_tpool_i18n, lt_tpool TYPE textpool_table. FIELD-SYMBOLS <ls_tpool> LIKE LINE OF lt_tpool_i18n. IF io_xml->i18n_params( )-serialize_master_lang_only = abap_true. RETURN. ENDIF. " Table d010tinf stores info. on languages in which program is maintained " Select all active translations of program texts " Skip master language - it was already serialized SELECT DISTINCT language INTO CORRESPONDING FIELDS OF TABLE lt_tpool_i18n FROM d010tinf WHERE r3state = 'A' AND prog = iv_prog_name AND language <> mv_language. SORT lt_tpool_i18n BY language ASCENDING. LOOP AT lt_tpool_i18n ASSIGNING <ls_tpool>. READ TEXTPOOL iv_prog_name LANGUAGE <ls_tpool>-language INTO lt_tpool. <ls_tpool>-textpool = add_tpool( lt_tpool ). ENDLOOP. IF lines( lt_tpool_i18n ) > 0. io_xml->add( iv_name = 'I18N_TPOOL' ig_data = lt_tpool_i18n ). ENDIF. ENDMETHOD. METHOD serialize_xml. DATA: lt_includes TYPE ty_sobj_name_tt, lv_areat TYPE tlibt-areat. SELECT SINGLE areat INTO lv_areat FROM tlibt WHERE spras = mv_language AND area = ms_item-obj_name. "#EC CI_GENBUFF "#EC CI_SUBRC lt_includes = includes( ). io_xml->add( iv_name = 'AREAT' ig_data = lv_areat ). io_xml->add( iv_name = 'INCLUDES' ig_data = lt_includes ). ENDMETHOD. METHOD update_func_group_short_text. " We update the short text directly. " SE80 does the same in " Program SAPLSEUF / LSEUFF07 " FORM GROUP_CHANGE UPDATE tlibt SET areat = iv_short_text WHERE spras = mv_language AND area = iv_group. ENDMETHOD. METHOD update_where_used. * make extra sure the where-used list is updated after deletion * Experienced some problems with the T00 include * this method just tries to update everything DATA: lv_include LIKE LINE OF it_includes, lo_cross TYPE REF TO cl_wb_crossreference. LOOP AT it_includes INTO lv_include. CREATE OBJECT lo_cross EXPORTING p_name = lv_include p_include = lv_include. lo_cross->index_actualize( ). ENDLOOP. ENDMETHOD. METHOD zif_abapgit_object~changed_by. TYPES: BEGIN OF ty_stamps, user TYPE xubname, date TYPE d, time TYPE t, END OF ty_stamps. DATA: lt_stamps TYPE STANDARD TABLE OF ty_stamps WITH DEFAULT KEY, lv_program TYPE program, lt_includes TYPE ty_sobj_name_tt. FIELD-SYMBOLS: <ls_stamp> LIKE LINE OF lt_stamps, <lv_include> LIKE LINE OF lt_includes. lv_program = main_name( ). CALL FUNCTION 'RS_GET_ALL_INCLUDES' EXPORTING program = lv_program TABLES includetab = lt_includes EXCEPTIONS not_existent = 1 no_program = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from RS_GET_ALL_INCLUDES' ). ENDIF. SELECT unam AS user udat AS date utime AS time FROM reposrc APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps WHERE progname = lv_program AND r3state = 'A'. "#EC CI_SUBRC LOOP AT lt_includes ASSIGNING <lv_include>. SELECT unam AS user udat AS date utime AS time FROM reposrc APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps WHERE progname = <lv_include> AND r3state = 'A'. "#EC CI_SUBRC ENDLOOP. SELECT unam AS user udat AS date utime AS time FROM repotext " Program text pool APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps WHERE progname = lv_program AND r3state = 'A'. "#EC CI_SUBRC SELECT vautor AS user vdatum AS date vzeit AS time FROM eudb " GUI APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps WHERE relid = 'CU' AND name = lv_program AND srtf2 = 0 ##TOO_MANY_ITAB_FIELDS. * Screens: username not stored in D020S database table SORT lt_stamps BY date DESCENDING time DESCENDING. READ TABLE lt_stamps INDEX 1 ASSIGNING <ls_stamp>. IF sy-subrc = 0. rv_user = <ls_stamp>-user. ELSE. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lv_area TYPE rs38l-area, lt_includes TYPE ty_sobj_name_tt, lv_corrnum TYPE e070use-ordernum. lt_includes = includes( ). lv_area = ms_item-obj_name. lv_corrnum = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum. CALL FUNCTION 'RS_FUNCTION_POOL_DELETE' EXPORTING area = lv_area suppress_popups = abap_true skip_progress_ind = abap_true corrnum = lv_corrnum EXCEPTIONS canceled_in_corr = 1 enqueue_system_failure = 2 function_exist = 3 not_executed = 4 no_modify_permission = 5 no_show_permission = 6 permission_failure = 7 pool_not_exist = 8 cancelled = 9 OTHERS = 10. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from RS_FUNCTION_POOL_DELETE' ). ENDIF. update_where_used( lt_includes ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lv_program_name TYPE programm, lt_functions TYPE ty_function_tt, lt_dynpros TYPE ty_dynpro_tt, ls_cua TYPE ty_cua. deserialize_xml( io_xml = io_xml iv_package = iv_package ). io_xml->read( EXPORTING iv_name = 'FUNCTIONS' CHANGING cg_data = lt_functions ). deserialize_functions( it_functions = lt_functions ii_log = ii_log ). deserialize_includes( io_xml = io_xml iv_package = iv_package ii_log = ii_log ). lv_program_name = main_name( ). deserialize_texts( iv_prog_name = lv_program_name io_xml = io_xml ). io_xml->read( EXPORTING iv_name = 'DYNPROS' CHANGING cg_data = lt_dynpros ). deserialize_dynpros( lt_dynpros ). io_xml->read( EXPORTING iv_name = 'CUA' CHANGING cg_data = ls_cua ). deserialize_cua( iv_program_name = lv_program_name is_cua = ls_cua ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_pool TYPE tlibg-area. lv_pool = ms_item-obj_name. CALL FUNCTION 'RS_FUNCTION_POOL_EXISTS' EXPORTING function_pool = lv_pool EXCEPTIONS pool_not_exists = 1. rv_bool = boolc( sy-subrc <> 1 ). 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. DATA: lv_program TYPE program. lv_program = main_name( ). IF is_function_group_locked( ) = abap_true OR is_any_include_locked( ) = abap_true OR is_any_function_module_locked( ) = abap_true OR is_any_dynpro_locked( lv_program ) = abap_true OR is_cua_locked( lv_program ) = abap_true OR is_text_locked( lv_program ) = abap_true. rv_is_locked = abap_true. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~jump. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = ms_item-obj_name object_type = 'FUGR' in_new_window = abap_true. ENDMETHOD. METHOD zif_abapgit_object~serialize. * function group SEUF * function group SIFP * function group SUNI DATA: lt_functions TYPE ty_function_tt, ls_progdir TYPE ty_progdir, lv_program_name TYPE programm, lt_dynpros TYPE ty_dynpro_tt, ls_cua TYPE ty_cua. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. serialize_xml( io_xml ). lt_functions = serialize_functions( ). io_xml->add( iv_name = 'FUNCTIONS' ig_data = lt_functions ). serialize_includes( ). lv_program_name = main_name( ). ls_progdir = read_progdir( lv_program_name ). serialize_texts( iv_prog_name = lv_program_name io_xml = io_xml ). IF ls_progdir-subc = 'F'. lt_dynpros = serialize_dynpros( lv_program_name ). io_xml->add( iv_name = 'DYNPROS' ig_data = lt_dynpros ). ls_cua = serialize_cua( lv_program_name ). io_xml->add( iv_name = 'CUA' ig_data = ls_cua ). ENDIF. ENDMETHOD. ENDCLASS.
30.525674
115
0.615527
983166fcdacfe481d48c65cdf6e61d4ff352dd48
5,140
abap
ABAP
guide/functionmodule.abap
byzhi/abap
8d88125515737d7cb7948da0bf84e3ee303c5f65
[ "MIT" ]
null
null
null
guide/functionmodule.abap
byzhi/abap
8d88125515737d7cb7948da0bf84e3ee303c5f65
[ "MIT" ]
null
null
null
guide/functionmodule.abap
byzhi/abap
8d88125515737d7cb7948da0bf84e3ee303c5f65
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Report Z_FUNCTIONMODULE *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z_FUNCTIONMODULE. * Function modules are procedures that are defined in special ABAP programs only. * Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. * Unlike subroutines, you do not define function modules in the source code of your program. * example 1 * click 'spell' to see the structure. DATA result LIKE spell. PARAMETERS num TYPE I. * click 'Pattern' button, input 'spell_amount'. CALL FUNCTION 'SPELL_AMOUNT' EXPORTING AMOUNT = num CURRENCY = ' ' FILLER = ' ' LANGUAGE = SY-LANGU IMPORTING IN_WORDS = result EXCEPTIONS NOT_FOUND = 1 TOO_LARGE = 2 OTHERS = 3 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. WRITE: '', SY-SUBRC. ELSE. WRITE: 'Result is:', result-word. " add '-word.' because must be a character-type field. ENDIF. * input 123 * Result is: * ONE HUNDRED TWENTY-THRE * example 2 *&---------------------------------------------------------------------* *& Report Z_FUNCTIONMODULE_2 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT Z_FUNCTIONMODULE_2. INCLUDE Z_FM_DEF. INCLUDE Z_FM_MAIN. INCLUDE Z_FM_SUB. *&---------------------------------------------------------------------* *& Include Z_FM_DEF *&---------------------------------------------------------------------* DATA it_spfli TYPE TABLE OF spfli. *&---------------------------------------------------------------------* *& Include Z_FM_MAIN *&---------------------------------------------------------------------* START-OF-SELECTION. PERFORM get_data. PERFORM show_data. *&---------------------------------------------------------------------* *& Include Z_FM_SUB *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form get_data *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM get_data . SELECT * FROM spfli INTO TABLE it_spfli. ENDFORM. " get_data *&---------------------------------------------------------------------* *& Form show_data *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM show_data . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC' EXPORTING * I_INTERFACE_CHECK = ' ' * I_BYPASSING_BUFFER = * I_BUFFER_ACTIVE = * I_CALLBACK_PROGRAM = ' ' * I_CALLBACK_PF_STATUS_SET = ' ' * I_CALLBACK_USER_COMMAND = ' ' * I_CALLBACK_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_TOP_OF_PAGE = ' ' * I_CALLBACK_HTML_END_OF_LIST = ' ' I_STRUCTURE_NAME = 'SPFLI' * I_BACKGROUND_ID = ' ' * I_GRID_TITLE = * I_GRID_SETTINGS = * IS_LAYOUT_LVC = * IT_FIELDCAT_LVC = * IT_EXCLUDING = * IT_SPECIAL_GROUPS_LVC = * IT_SORT_LVC = * IT_FILTER_LVC = * IT_HYPERLINK = * IS_SEL_HIDE = * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT_LVC = * IS_REPREP_ID_LVC = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_HTML_HEIGHT_TOP = * I_HTML_HEIGHT_END = * IT_EXCEPT_QINFO_LVC = * IR_SALV_FULLSCREEN_ADAPTER = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES T_OUTTAB = it_spfli * EXCEPTIONS * PROGRAM_ERROR = 1 * OTHERS = 2 . IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. ENDFORM. " show_data
32.738854
137
0.377821
9834e6a47b1a1a4549f6126db0012e5d33c8760f
5,382
abap
ABAP
src/objects/ecatt/zcl_abapgit_ecatt_sp_upload.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
src/objects/ecatt/zcl_abapgit_ecatt_sp_upload.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
src/objects/ecatt/zcl_abapgit_ecatt_sp_upload.clas.abap
stoamandl/abapGit-1.80.0
a683f04e6519f6b4257f314ed554fbc1c6bd9631
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_ecatt_sp_upload DEFINITION PUBLIC INHERITING FROM cl_apl_ecatt_upload FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS: z_set_stream_for_upload IMPORTING iv_xml TYPE xstring, upload REDEFINITION. PROTECTED SECTION. METHODS: upload_data_from_stream REDEFINITION, get_ecatt_sp RAISING cx_ecatt_apl . PRIVATE SECTION. DATA: mv_external_xml TYPE xstring. ENDCLASS. CLASS ZCL_ABAPGIT_ECATT_SP_UPLOAD IMPLEMENTATION. METHOD get_ecatt_sp. " downport DATA: li_ixml TYPE REF TO if_ixml, li_section TYPE REF TO if_ixml_element, li_dom TYPE REF TO if_ixml_document, li_root TYPE REF TO if_ixml_node, lv_start_profile TYPE etxml_line_str, lv_exception_occurred TYPE etonoff, lo_ecatt_sp TYPE REF TO object. FIELD-SYMBOLS: <lg_ecatt_object> TYPE any. TRY. li_section = template_over_all->find_from_name_ns( 'START_PROFILE' ). IF NOT li_section IS INITIAL. li_ixml = cl_ixml=>create( ). li_dom = li_ixml->create_document( ). li_root ?= li_section->clone( ). li_dom->append_child( new_child = li_root ). CALL FUNCTION 'SDIXML_DOM_TO_XML' EXPORTING document = li_dom IMPORTING xml_as_string = lv_start_profile. ASSIGN ('ECATT_OBJECT') TO <lg_ecatt_object>. ASSERT sy-subrc = 0. lo_ecatt_sp = <lg_ecatt_object>. CALL METHOD lo_ecatt_sp->('SET_SP_ATTRIBUTES') EXPORTING i_sp_xml = lv_start_profile. ENDIF. CATCH cx_ecatt_apl. lv_exception_occurred = 'X'. ENDTRY. IF lv_exception_occurred = 'X'. raise_upload_exception( previous = exception_to_raise ). ENDIF. ENDMETHOD. METHOD upload. " We inherit from CL_APL_ECATT_UPLOAD because CL_APL_ECATT_SP_UPLOAD " doesn't exist in 702 " Downport "26.03.2013 DATA: lx_ecatt TYPE REF TO cx_ecatt_apl, lv_exists TYPE etonoff, lv_exc_occ TYPE etonoff, ls_tadir TYPE tadir, lo_ecatt_sp TYPE REF TO object. FIELD-SYMBOLS: <lg_ecatt_sp> TYPE any, <lv_d_akh> TYPE data, <lv_i_akh> TYPE data. TRY. ch_object-i_devclass = ch_object-d_devclass. ASSIGN COMPONENT 'D_AKH' OF STRUCTURE ch_object TO <lv_d_akh>. " doesn't exist in 702 ASSIGN COMPONENT 'I_AKH' OF STRUCTURE ch_object TO <lv_i_akh>. " doesn't exist in 702 IF <lv_d_akh> IS ASSIGNED AND <lv_i_akh> IS ASSIGNED. <lv_i_akh> = <lv_d_akh>. ENDIF. super->upload( CHANGING ch_object = ch_object ). upload_data_from_stream( ch_object-filename ). CATCH cx_ecatt_apl INTO lx_ecatt. IF template_over_all IS INITIAL. RAISE EXCEPTION lx_ecatt. ELSE. lv_exc_occ = 'X'. ENDIF. ENDTRY. TRY. CALL METHOD ('GET_ATTRIBUTES_FROM_DOM_NEW') " doesn't exist in 720 CHANGING ch_object = ch_object. CATCH cx_ecatt_apl INTO lx_ecatt. lv_exc_occ = 'X'. ENDTRY. ASSIGN me->ecatt_object TO <lg_ecatt_sp>. ASSERT sy-subrc = 0. lo_ecatt_sp = <lg_ecatt_sp>. TRY. get_ecatt_sp( ). CATCH cx_ecatt_apl INTO lx_ecatt. lv_exc_occ = 'X'. ENDTRY. TRY. lv_exists = cl_apl_ecatt_object=>existence_check_object( im_name = ch_object-d_obj_name im_version = ch_object-d_obj_ver im_obj_type = ch_object-s_obj_type im_exists_any_version = 'X' ). IF lv_exists EQ space. CALL METHOD lo_ecatt_sp->('SET_TADIR_FOR_NEW_OBJECT') EXPORTING im_tadir_for_new_object = tadir_preset. ENDIF. CATCH cx_ecatt. CLEAR lv_exists. ENDTRY. TRY. CALL METHOD lo_ecatt_sp->('SAVE') EXPORTING im_do_commit = 'X'. CATCH cx_ecatt_apl INTO lx_ecatt. lv_exc_occ = 'X'. ENDTRY. * Devesh,C5129871 18.07.2011 Releasing enqueu after uploading *begin TRY. ecatt_object->close_object( im_suppress_events ='X' ). CATCH cx_ecatt_apl INTO lx_ecatt. ENDTRY. *end * get devclass from existing object TRY. cl_apl_ecatt_object=>get_tadir_entry( EXPORTING im_obj_name = ch_object-d_obj_name im_obj_type = ch_object-s_obj_type IMPORTING ex_tadir = ls_tadir ). ch_object-d_devclass = ls_tadir-devclass. CATCH cx_ecatt. CLEAR ls_tadir. ENDTRY. IF lv_exc_occ = 'X'. raise_upload_exception( previous = lx_ecatt ). ENDIF. ENDMETHOD. METHOD upload_data_from_stream. " Downport template_over_all = zcl_abapgit_ecatt_helper=>upload_data_from_stream( mv_external_xml ). ENDMETHOD. METHOD z_set_stream_for_upload. " downport from CL_APL_ECATT_START_PROFIL SET_STREAM_FOR_UPLOAD mv_external_xml = iv_xml. ENDMETHOD. ENDCLASS.
25.751196
93
0.602936
9835d9f78f2c61299e908f94a074ac97f02413b1
40,177
abap
ABAP
day02/task1.abap
julianschmuckli/adventofcode_2020
18c6aa2014f1994a9cccb36346bf52a46038242e
[ "Apache-2.0" ]
1
2020-12-04T14:41:29.000Z
2020-12-04T14:41:29.000Z
day02/task1.abap
julianschmuckli/adventofcode_2020
18c6aa2014f1994a9cccb36346bf52a46038242e
[ "Apache-2.0" ]
null
null
null
day02/task1.abap
julianschmuckli/adventofcode_2020
18c6aa2014f1994a9cccb36346bf52a46038242e
[ "Apache-2.0" ]
null
null
null
TYPES: BEGIN OF t_input, password TYPE string, END OF t_input. * Input declaration DATA: lv_input TYPE TABLE OF t_input, wa_input LIKE LINE OF lv_input. * Assign with the puzzle input. lv_input = VALUE #( ( password = '4-7 z: zzzfzlzzz' ) ( password = '3-4 l: blllk' ) ( password = '8-11 j: jjjjjjjgjjjj' ) ( password = '6-7 l: lllhlbl' ) ( password = '10-13 x: xmhfsbjxptxxv' ) ( password = '2-3 s: ssvxszrvj' ) ( password = '4-6 r: rtrrrqv' ) ( password = '5-6 c: cbccxc' ) ( password = '3-4 g: zwvg' ) ( password = '2-4 d: fqfqlcdzbtmph' ) ( password = '10-13 s: cmssgslvrssfsl' ) ( password = '1-4 d: hdsdddq' ) ( password = '2-5 d: jdptwdv' ) ( password = '3-4 l: vlcl' ) ( password = '2-5 k: mdkkkmkq' ) ( password = '3-4 j: wjjt' ) ( password = '4-10 h: wmfqghskgjtt' ) ( password = '8-9 c: cccccccnp' ) ( password = '4-5 q: qqjzm' ) ( password = '5-16 h: hhhhhhhhhhhhhhhhhhh' ) ( password = '11-14 g: vghggggggggggwggggbg' ) ( password = '1-13 s: ssssssssssdsxss' ) ( password = '3-6 x: bxlxxznq' ) ( password = '16-17 f: hfwfqffffwsffsffl' ) ( password = '12-14 v: rbvvgvvwvvvvcvjv' ) ( password = '6-8 r: rrfrrrrr' ) ( password = '4-13 j: wsbmtjhjtpmljjfbk' ) ( password = '2-7 k: pzdwgnknf' ) ( password = '14-18 f: tsdqbvgbxwvfhfffpn' ) ( password = '4-13 c: vxpccvfhcnvscrtngc' ) ( password = '1-2 z: nmbzcz' ) ( password = '4-6 k: wkvfcgpsnk' ) ( password = '1-4 m: smppnnmm' ) ( password = '1-3 v: jlcvv' ) ( password = '6-10 f: ffjfsnfbfxfvklfffff' ) ( password = '4-7 v: vvvvvvvvv' ) ( password = '8-10 c: tcccccdcwcc' ) ( password = '4-11 r: xwxfvzbcrvr' ) ( password = '2-18 w: rwznqcwkzpqlmngpjnrn' ) ( password = '3-19 h: qbhsthtkmhfnnkxvbphk' ) ( password = '1-3 b: bbbbb' ) ( password = '3-9 p: pppppppppp' ) ( password = '10-13 t: tttttttrttttttt' ) ( password = '2-3 f: hffjff' ) ( password = '1-2 k: zzkkv' ) ( password = '4-5 s: snbss' ) ( password = '8-11 f: fffffffpfff' ) ( password = '8-16 r: hlgcwsqqrpcflnsng' ) ( password = '2-8 k: kkkkkkkffvkk' ) ( password = '7-15 k: ckcphgbjkpvkrwk' ) ( password = '15-17 w: wvlwwnwzwwwwmswwww' ) ( password = '1-2 j: zgjjj' ) ( password = '5-8 x: xxxxdxxjxxx' ) ( password = '12-16 v: qvdnvqdsgcxwqsnv' ) ( password = '12-14 s: jswppnmlxbzjwn' ) ( password = '1-3 g: ghgg' ) ( password = '5-14 k: rbckkkvdltkmckp' ) ( password = '9-11 h: qhffhhhdchshh' ) ( password = '4-5 g: gggvgg' ) ( password = '2-5 t: gtdjfp' ) ( password = '7-8 g: vgtdgggb' ) ( password = '1-4 s: hbssskscq' ) ( password = '12-13 r: rfjrrjrrrrrgg' ) ( password = '13-16 j: jjjjjjjjjjjjjjjjjj' ) ( password = '3-14 p: hvkjnlhpngzrvpw' ) ( password = '8-10 g: kgggwrggggg' ) ( password = '12-18 f: fmlbmsfxsgpjnvfkkf' ) ( password = '2-3 f: dffg' ) ( password = '6-7 l: llllllll' ) ( password = '1-3 s: jshth' ) ( password = '1-5 s: gssss' ) ( password = '3-4 p: mgpptdwztpkfjmgmsw' ) ( password = '4-6 c: cfcksc' ) ( password = '4-6 v: hvdvgscqv' ) ( password = '18-20 t: thtjtvjttbttxtthttpt' ) ( password = '2-4 c: cmcc' ) ( password = '3-5 q: qqnqhv' ) ( password = '6-10 l: pllrllllllxlllh' ) ( password = '3-5 k: hzknk' ) ( password = '13-17 t: hcttttvdttttjtttpntt' ) ( password = '9-14 d: dxdddddddsdddhddddd' ) ( password = '4-5 p: rmcps' ) ( password = '3-9 z: hzcmfzspk' ) ( password = '3-8 v: cmqvvkwv' ) ( password = '18-19 n: nnslnnnnnmnnnnnnnxnn' ) ( password = '4-5 c: cghcccscccc' ) ( password = '11-16 k: kkkkkkmkkkklkkkk' ) ( password = '2-5 r: grlrr' ) ( password = '6-19 w: wzxxrbwwzjwftpzwzdg' ) ( password = '15-16 w: wwwwlwwwwwwwwwjw' ) ( password = '3-9 x: pvxtkcnsnrcx' ) ( password = '1-8 q: jqmxxgqq' ) ( password = '7-9 t: wntmvtnlqt' ) ( password = '10-12 t: ttttttzttttt' ) ( password = '15-16 c: gjcgjxbnscbcchqc' ) ( password = '8-11 g: dgfggjjzggg' ) ( password = '10-11 x: brpxrlbkvxf' ) ( password = '11-14 p: ppppppppppgpppp' ) ( password = '4-13 p: kdmndpfnjpsdp' ) ( password = '6-10 j: mmnzjjjhrdj' ) ( password = '4-12 b: bbbbhbbhblbsb' ) ( password = '10-11 z: zzwrzzzzzhnzz' ) ( password = '6-7 s: ssltvnszhr' ) ( password = '4-7 k: skckkkkl' ) ( password = '1-12 s: sljgsxwslfcqss' ) ( password = '12-14 f: wffzfkkfczqtdf' ) ( password = '3-4 d: wgqs' ) ( password = '6-7 v: vlvvvvqvvpv' ) ( password = '2-9 t: kwxfnqpvtsnhm' ) ( password = '7-12 b: bbbbbbwbbbbbbbb' ) ( password = '2-7 m: rscmzmms' ) ( password = '1-5 s: hgjsszkss' ) ( password = '8-11 x: vxxrxwxdxxvxrqkrz' ) ( password = '8-11 f: fkfdgnqfllfjlc' ) ( password = '1-2 g: ngggzggmgjggmtzdgcv' ) ( password = '6-11 q: tvjdmvttzvbxfdqgd' ) ( password = '5-8 f: fmfffkff' ) ( password = '2-5 d: dxddjqdxv' ) ( password = '2-8 k: bbpsjxtkljbk' ) ( password = '12-16 q: ldqqqqqqqqqqqqqq' ) ( password = '2-4 n: nvxf' ) ( password = '2-6 w: wwwwwzwv' ) ( password = '4-7 h: hhnshhrhh' ) ( password = '3-7 g: mgcqcfl' ) ( password = '2-4 c: hcbczxmk' ) ( password = '15-17 g: ggggggggggggggggfg' ) ( password = '12-13 w: wwwwwwwwwwjwww' ) ( password = '6-8 r: rgrrrprtr' ) ( password = '13-16 n: nqnnnnnnnnnnrnnh' ) ( password = '4-7 d: mdddvdd' ) ( password = '10-14 p: hpjpwppppsbpwspppp' ) ( password = '11-14 v: vvvvvvvvvvvpvfvv' ) ( password = '4-5 x: vwxrlxfxbxpq' ) ( password = '1-6 v: zvvvvrvv' ) ( password = '4-5 q: qqjqqsd' ) ( password = '3-4 f: ffff' ) ( password = '13-14 m: mmmmmmmdmmmmzz' ) ( password = '11-14 r: rrrrzrrtmrqrrrdrl' ) ( password = '14-18 q: qqqqqqqqqqqqkgqqqv' ) ( password = '2-5 f: mffzfzjmlmrzqk' ) ( password = '13-14 x: xxxxxxxtxxxjxxx' ) ( password = '1-3 s: qshtqssxsqb' ) ( password = '4-11 t: tttptttwttbtt' ) ( password = '3-6 s: gbmgst' ) ( password = '2-12 v: hvmnqtnvmjdkghcfjmtd' ) ( password = '12-19 g: gggggggggggmgggggggg' ) ( password = '9-10 m: mmmmmmmmcmm' ) ( password = '1-10 f: fffffffffhf' ) ( password = '1-12 k: vkkkkkzkkkksk' ) ( password = '1-9 m: mmmmmmmmmmmm' ) ( password = '4-6 w: wlqwzw' ) ( password = '17-18 d: ddddffdddddddddlddd' ) ( password = '3-4 g: hgzg' ) ( password = '3-5 r: fbrnbr' ) ( password = '2-7 j: rrjjsmjjjzj' ) ( password = '15-18 n: nnnnnhnnnnnnnnbnnjnn' ) ( password = '2-4 b: hzltnwvbs' ) ( password = '11-12 k: skkkkkkkkkkk' ) ( password = '6-11 x: xxxbxxxxxpjhxvxxxfxx' ) ( password = '4-5 d: dhjdd' ) ( password = '2-7 v: vbvvbvvvvvvv' ) ( password = '4-5 g: ngggl' ) ( password = '10-17 p: ppppppptpppppgpppp' ) ( password = '5-11 f: fqcfvtpfqhc' ) ( password = '7-14 d: hpdsddwtcddqhblt' ) ( password = '5-6 k: kkkkqhkkk' ) ( password = '4-7 w: vjkwjmwwwwhrv' ) ( password = '2-3 c: dcqw' ) ( password = '3-4 q: qqnmqqqqqn' ) ( password = '3-5 b: bbbbb' ) ( password = '13-14 z: qsbkzgzhmzthzzcrp' ) ( password = '6-13 t: nttstttttttttttt' ) ( password = '13-14 v: xvxvvfjvvvvtvk' ) ( password = '2-3 q: qvwqq' ) ( password = '1-4 v: nvpsv' ) ( password = '3-5 v: vvvvsvvb' ) ( password = '3-4 p: npph' ) ( password = '1-3 l: lllllf' ) ( password = '18-19 j: jjjjjjjjjjjjjjjjjhh' ) ( password = '8-12 d: vmhvddqddhdd' ) ( password = '2-7 l: rfdzrldw' ) ( password = '3-4 n: lnnjsn' ) ( password = '2-3 m: mxlfvqmm' ) ( password = '16-20 n: nmsnmdhwvwzlsrpnvcdn' ) ( password = '8-13 l: lllllllqllllbl' ) ( password = '6-7 w: lpwwwvhww' ) ( password = '3-5 s: sqsshnwp' ) ( password = '1-4 z: zzzk' ) ( password = '11-13 z: zzzzzzzzzzjzzzz' ) ( password = '2-3 n: nnnnt' ) ( password = '2-5 b: jbpdn' ) ( password = '2-16 m: bmflbclkmlfkpwdmf' ) ( password = '3-4 b: bbjc' ) ( password = '10-11 b: bbbdbbbbbbvbbb' ) ( password = '5-11 z: zzzzzkzzzzzzzzzzwzzz' ) ( password = '2-13 k: qkfbfkxxpvwpqbg' ) ( password = '5-8 n: jnxpnngs' ) ( password = '2-4 z: bbnk' ) ( password = '1-2 w: glww' ) ( password = '1-6 g: zggggg' ) ( password = '1-3 g: bgjg' ) ( password = '8-15 v: vvvvvvvpvvvvvvvvv' ) ( password = '2-8 t: jtvkktkg' ) ( password = '1-5 n: xzvnp' ) ( password = '16-20 w: mnxtkjwkmbqjwnndwwws' ) ( password = '7-8 g: xgggggggg' ) ( password = '13-15 m: gwjdqbtmnfjfwsmj' ) ( password = '1-3 r: lrzrmqrr' ) ( password = '14-15 x: xxxxxxxxxxxxxcxx' ) ( password = '16-19 c: cccccccccccccccccczc' ) ( password = '1-7 j: tbjrsjjnj' ) ( password = '11-17 j: jjjjjjjjjjjjjjjjfjj' ) ( password = '2-3 s: prsc' ) ( password = '5-15 f: qfgftfffffrfffvff' ) ( password = '7-11 f: fffffffffffff' ) ( password = '9-11 j: vhpjgjfjjkjmvfjvhdj' ) ( password = '3-6 g: gggtgggrg' ) ( password = '7-9 g: lzgggggfg' ) ( password = '6-7 b: bbqtbtb' ) ( password = '5-7 h: hfthhfhhhh' ) ( password = '12-19 g: lggggggggggnbbggfgl' ) ( password = '1-11 z: zzzzzzzzkzzzzz' ) ( password = '5-10 r: gxdbrvrzrb' ) ( password = '3-4 c: chnc' ) ( password = '5-10 h: hhhhhhhhhhhrhhsh' ) ( password = '4-5 d: dqrmdd' ) ( password = '9-10 z: ztxnxptzzz' ) ( password = '3-4 k: kvxksw' ) ( password = '3-5 t: gstxtvbsbmzflfrft' ) ( password = '1-14 v: vtvdnmqqfjkwft' ) ( password = '7-9 n: kgsndnnnn' ) ( password = '3-4 p: pvcp' ) ( password = '12-14 c: zchftgbmccpcvjbr' ) ( password = '1-10 k: cckkkkskjk' ) ( password = '1-2 t: tlbt' ) ( password = '6-15 j: vqnjjjzjsmctzqj' ) ( password = '7-8 n: nnnnnnmxz' ) ( password = '10-13 b: bbbbbbhbbcbbb' ) ( password = '5-7 m: qmmmmjv' ) ( password = '2-8 n: nnncnnntnnnmnnn' ) ( password = '3-6 f: mvhwpdnfccnkhxq' ) ( password = '5-11 h: hhhhhhhhhhsh' ) ( password = '15-16 g: gggdggsgkgggggzg' ) ( password = '5-6 j: jjjjjbj' ) ( password = '3-4 f: mftk' ) ( password = '10-11 p: pxpppppppbppppppp' ) ( password = '8-9 g: dnjkxldnwgcdmqgnq' ) ( password = '18-20 q: qqqqqqqqqqqqqqqqqqqp' ) ( password = '5-7 q: vqpqfqrhqbdkkq' ) ( password = '3-5 h: nvhshgvzr' ) ( password = '13-14 l: rllnczlblllcll' ) ( password = '1-6 r: rnltrrr' ) ( password = '17-18 f: fffffffffffffffffff' ) ( password = '17-18 z: kzzzfzwzzdklxzskjl' ) ( password = '3-9 v: vczjvwrxvmsn' ) ( password = '8-13 f: fffffvffffffffffffff' ) ( password = '4-8 v: vvznvvvgvv' ) ( password = '10-12 l: lmllzlrllblwh' ) ( password = '8-11 d: pdcddddcdddbdbdd' ) ( password = '1-2 t: dtttttttdzbttckrtt' ) ( password = '1-7 w: wwwwwwpzwwww' ) ( password = '6-7 d: wsdvprj' ) ( password = '17-18 w: tjflkmhjvgfwccdbgw' ) ( password = '7-12 p: gfjwrhsmpcvppw' ) ( password = '2-3 p: pbpl' ) ( password = '18-19 m: mmmmmmmmmmmmmmmmmmmm' ) ( password = '3-4 d: bjdbdvjmtp' ) ( password = '3-4 l: jlllhblkr' ) ( password = '6-7 j: ljbkvlvjnv' ) ( password = '5-9 d: dddkddddddd' ) ( password = '4-10 l: fxflvrnjxb' ) ( password = '2-8 v: bshlrvvvvfk' ) ( password = '10-14 p: pppcppppppppprpppp' ) ( password = '3-8 w: svwfghvp' ) ( password = '2-10 t: tpttttttttt' ) ( password = '4-5 s: ssszsssl' ) ( password = '1-4 n: nnfn' ) ( password = '4-7 w: wwwfwwlwwwwwwwww' ) ( password = '11-12 f: tqflrfffqfffffffxc' ) ( password = '1-3 q: qfqxbqqbqtcvfkbfng' ) ( password = '2-3 n: twnffvn' ) ( password = '3-4 x: hxhxwxxxxbxwdt' ) ( password = '4-8 k: wnhtrzjwrkcmblnbhc' ) ( password = '9-10 m: mmmplzmcmm' ) ( password = '14-16 g: cgdgfgvgbfzggcrskll' ) ( password = '3-4 f: fhff' ) ( password = '6-18 w: wwpskqxwgwwwwcwvxw' ) ( password = '6-8 h: fvhqxkwqlssjhmqsv' ) ( password = '4-5 k: kkkkk' ) ( password = '1-4 n: nnnfn' ) ( password = '3-5 r: rrdrrrr' ) ( password = '10-11 k: qkkxkkkkkqk' ) ( password = '12-13 m: mtmmmmmmmmmhm' ) ( password = '3-5 v: kvvhkksv' ) ( password = '2-3 m: mrmm' ) ( password = '14-17 x: xxxxxxxxxxxxxxxxr' ) ( password = '7-8 c: cckccmscmc' ) ( password = '9-17 w: wlwwwgwkjzwxmjwhs' ) ( password = '1-4 k: kkkkkkkkkk' ) ( password = '6-11 j: jjjjzjjjjfj' ) ( password = '4-5 s: zssbs' ) ( password = '4-6 g: qfrggpcgqwgg' ) ( password = '10-13 g: tggggxsgggggggggg' ) ( password = '3-9 m: qmzjjjmqnlhc' ) ( password = '7-15 p: qlrpprvmgzlltpm' ) ( password = '3-6 z: pxzzbzzb' ) ( password = '4-12 c: jlkckndszjgcvjfcxw' ) ( password = '8-9 r: rrrcrrrrrr' ) ( password = '2-12 m: rnmmmlxmvvmzrqmmqw' ) ( password = '6-8 t: xpdtttttccz' ) ( password = '8-15 p: ppppppppppppppnppk' ) ( password = '3-4 j: zzxc' ) ( password = '1-8 z: nfqznthhzzgzwsttfbz' ) ( password = '3-4 z: znzs' ) ( password = '6-9 z: fzzzzzzzszzzzzz' ) ( password = '1-2 n: nnnn' ) ( password = '3-17 x: hhxhqhfkzvpxlsrzx' ) ( password = '4-6 h: thhpkhxhlzdhhrh' ) ( password = '11-12 p: ppppppppppfwpppppp' ) ( password = '8-11 h: hmgkhhhhhwhhhmhk' ) ( password = '3-4 w: wwwwvf' ) ( password = '1-5 j: jqjqj' ) ( password = '3-11 w: nblvwbwjwmwswfwtsrw' ) ( password = '5-10 v: hvrvvggjfv' ) ( password = '4-5 j: cjqqs' ) ( password = '3-7 n: lnnqnwnnnn' ) ( password = '2-4 t: kkmp' ) ( password = '13-14 f: ffffffffffffff' ) ( password = '6-10 h: tzswmhnbdqqpcv' ) ( password = '1-5 v: zvvvvv' ) ( password = '8-9 r: rvprrrrrdrr' ) ( password = '2-4 l: dwxf' ) ( password = '5-7 n: nnnnnjn' ) ( password = '9-12 x: xxxxxxxkpxxfxxxxfxx' ) ( password = '8-14 x: xxgjxdsccwtfvxq' ) ( password = '16-19 h: cbhkhjhmcdxhndnhhnmh' ) ( password = '4-8 d: dpdclrdjqd' ) ( password = '7-9 t: rtntcctgtrfpmq' ) ( password = '3-4 s: smlf' ) ( password = '6-7 n: gnljnnnnn' ) ( password = '16-18 t: ttttttttttttkttwtdtt' ) ( password = '3-5 d: zddzdkws' ) ( password = '9-10 w: wwwwwwwwsr' ) ( password = '9-11 g: ggggggggggg' ) ( password = '11-13 h: jqjhnrrhzxtmhhhhbcq' ) ( password = '4-6 x: xxxxxqxxxx' ) ( password = '13-18 s: pswsfxfjkhvsskssbsgr' ) ( password = '2-6 f: fffffp' ) ( password = '14-15 r: rrrrlrrrrsrvrrrrmlrr' ) ( password = '9-12 m: smmmzmmtsmnp' ) ( password = '9-14 q: xqgqqxqjqgzqlqwnq' ) ( password = '2-15 w: wwmwwwwwrwwwwwd' ) ( password = '2-6 c: cbcccnc' ) ( password = '18-19 r: rrrrrjrrrrrrrrrrrgrk' ) ( password = '3-13 d: rvwpflbrfrgpd' ) ( password = '5-7 t: ntxttrtprgtvxt' ) ( password = '2-14 k: rbffdmghvzwbml' ) ( password = '4-5 m: mmhmwc' ) ( password = '6-7 z: zkhlqqgpvllmbf' ) ( password = '7-10 r: rrrrrrbrpvrr' ) ( password = '14-17 m: mmnmmmmmmmmmmbmmmm' ) ( password = '3-5 r: rvcrssrrwrr' ) ( password = '12-19 t: ttttttttmttbttttttxt' ) ( password = '9-19 v: vvvvvvvvpvvvvvvvvvxv' ) ( password = '15-18 d: ddhddcddsddddwdldd' ) ( password = '7-10 k: qkcmkgkblkxkzb' ) ( password = '11-14 n: nnnnnnnnnhnnnnnnn' ) ( password = '10-16 k: kkkvkkkkkkktkkkkk' ) ( password = '6-8 s: sdfjbrswbwkvsqlz' ) ( password = '1-2 g: dsgg' ) ( password = '16-19 g: bpggwcpzdgpnggggkrg' ) ( password = '5-7 l: rllwlls' ) ( password = '8-9 s: sssssssss' ) ( password = '12-13 b: bbbbbqbtbbbkb' ) ( password = '13-15 w: zwwwwwwtxwwdkvwwww' ) ( password = '4-5 c: pccckcc' ) ( password = '4-6 v: hnvbrb' ) ( password = '3-6 q: jbqrqq' ) ( password = '3-4 w: wwwww' ) ( password = '5-14 k: hgmkkwxknkwhlkddg' ) ( password = '3-4 k: kkdk' ) ( password = '4-5 p: ppzppppp' ) ( password = '5-7 k: kkkkkkpkk' ) ( password = '12-13 m: mmmmmmmmmmmmmmmm' ) ( password = '1-6 r: srrrwnsrrrrr' ) ( password = '18-20 p: ppppgppffppwpppppppp' ) ( password = '7-8 f: ffffffjhffffffff' ) ( password = '2-4 l: dsqq' ) ( password = '10-12 q: qqqqqqqvqqsf' ) ( password = '3-8 l: svrqdrlx' ) ( password = '3-5 w: wwswmw' ) ( password = '12-15 q: tntnjzqhcnqqqqt' ) ( password = '1-8 j: nscgpjmj' ) ( password = '7-11 j: jjjtsrjjtjx' ) ( password = '5-6 m: tktpcvp' ) ( password = '1-2 z: cdzkbqbhjn' ) ( password = '3-4 h: hhhxh' ) ( password = '4-15 g: gggfgggmggggggngpgp' ) ( password = '1-6 z: zzswkz' ) ( password = '1-5 g: gggggg' ) ( password = '8-14 h: phjhfhxhjcztrw' ) ( password = '9-11 h: hhhhhhhhhhlh' ) ( password = '15-17 t: txcjtthtthtmtntttl' ) ( password = '7-8 z: zzzpzdzj' ) ( password = '2-9 x: xxxxxxxxlxxxtxlx' ) ( password = '6-11 j: mjqtrjrmhbjpsjw' ) ( password = '1-2 b: bbbbnbgbbbb' ) ( password = '6-7 z: cptkzzz' ) ( password = '12-13 v: vvwcwvvvvvqsdpvxvlvv' ) ( password = '1-13 w: hwwwwwwwwwvwswwwwwwg' ) ( password = '8-9 h: xjhgckphh' ) ( password = '9-13 z: zzzzzzzzzzzzkzz' ) ( password = '2-9 c: ncxccnclc' ) ( password = '4-8 h: hnmhhfhhtmch' ) ( password = '5-7 p: pppxkpst' ) ( password = '2-4 b: fwlwgbbbxhbb' ) ( password = '9-16 z: zzzzzzzzhzzzzzzvzz' ) ( password = '5-18 t: ttttktttttttttttttt' ) ( password = '1-2 t: hftttzt' ) ( password = '16-19 w: jcpwnqwwwlmwfflwwgkw' ) ( password = '1-3 d: dddg' ) ( password = '13-16 r: hrlwdqrrtrrqrwrp' ) ( password = '3-4 j: xjcj' ) ( password = '18-19 n: nnnhnnnnnnnnnnnnnpnn' ) ( password = '4-5 q: qqqqrq' ) ( password = '13-14 d: ddddddddqdddptdd' ) ( password = '8-13 n: vsnnnvwnrfqmnsctkq' ) ( password = '2-12 d: ddddddddddddddddbv' ) ( password = '7-9 m: msmmmmgmm' ) ( password = '14-17 t: wttxttzrttccttttmt' ) ( password = '1-3 z: hzbz' ) ( password = '6-15 p: pppppzppppppppxpp' ) ( password = '5-6 j: gggjxpdcnjjxjjnmv' ) ( password = '4-6 k: kmwkkzf' ) ( password = '2-10 j: pjjjzjjzsq' ) ( password = '9-14 n: nnqnxnnnzwnnnnxmnnln' ) ( password = '2-3 j: jjjmkffhsz' ) ( password = '11-12 n: lxmlktcnknnn' ) ( password = '17-18 w: wwwwwwpwwjkmwwcwwwww' ) ( password = '4-6 k: vkkxfksbkkkkkkxkk' ) ( password = '3-12 r: nrdrrkrcmbrkrsrrrr' ) ( password = '7-8 t: ttttttwttt' ) ( password = '4-6 s: scsssvkqsks' ) ( password = '6-11 h: hhhhhwhhhhmfhhhh' ) ( password = '4-9 n: nnnrnnnnnn' ) ( password = '2-5 z: zzzwz' ) ( password = '5-6 d: dddddxddd' ) ( password = '6-7 f: ffffnrgx' ) ( password = '4-13 d: xjndrdhnxdqnddj' ) ( password = '5-6 v: cvktvf' ) ( password = '2-15 x: lxhsltbnrdwwxbxftvb' ) ( password = '9-16 r: rrrrrrrrrrrrrrrfrvrr' ) ( password = '1-8 m: cwgsmxmrsmm' ) ( password = '4-11 l: gdcllsllkllwcv' ) ( password = '1-3 d: pfsjdhjjvzdsqkcq' ) ( password = '10-16 r: rrrrrrrrrrrrrrrhrr' ) ( password = '8-11 d: dmdddhddddkdddd' ) ( password = '7-12 l: lldsllcllmlbl' ) ( password = '8-14 b: wdztcvrbdcbmsjglr' ) ( password = '2-6 w: wbwwwnw' ) ( password = '6-7 g: tmlqggg' ) ( password = '10-11 q: qqqqqqqzqdqqqnqqqqq' ) ( password = '7-14 b: bbbvbbbbbbbbbbblbqbb' ) ( password = '1-3 d: dgrdn' ) ( password = '4-6 m: mmmmmsmm' ) ( password = '5-6 v: vvvvvvv' ) ( password = '1-2 s: fdsss' ) ( password = '14-17 v: vvvvvwvvvvvvvwvvx' ) ( password = '1-4 p: pppbpppppppg' ) ( password = '6-7 j: jjjjjjj' ) ( password = '10-12 h: hhhhhhhhhhhhhhhr' ) ( password = '3-8 r: srhrrrprvzvpv' ) ( password = '11-12 s: sssssssssstm' ) ( password = '2-6 f: gffcnfrjhjjk' ) ( password = '2-4 b: bbbqbb' ) ( password = '9-11 l: llllllllrlclll' ) ( password = '3-9 n: nnndvnnnnjn' ) ( password = '4-18 j: jqbjlwhjmgfhzrszzjz' ) ( password = '2-14 r: rrdkhrjrprrrwr' ) ( password = '6-9 r: rrrrrrrrrrrr' ) ( password = '3-7 h: hhghhgh' ) ( password = '2-11 v: hzxmqjrknfvn' ) ( password = '7-8 r: jwsrrrpgggjzqtcvprs' ) ( password = '1-2 g: tnggg' ) ( password = '4-10 z: mzpcsdnmzzmhmtl' ) ( password = '4-10 j: jwvjdhtkfjjpq' ) ( password = '12-13 w: wwwwwfwwmwwnwww' ) ( password = '5-8 h: hhhdmhhphhhhhhhhhhh' ) ( password = '9-10 j: jjjjjjjjjjxjjjj' ) ( password = '6-8 t: ttgtttqgrvt' ) ( password = '7-11 r: rrrrrrqrrrv' ) ( password = '5-10 r: rrrrrrrrrrr' ) ( password = '17-18 w: hwkgjwkwztwwxwwwww' ) ( password = '6-10 s: bvrfsgjxfs' ) ( password = '3-7 n: zclkprdknp' ) ( password = '7-15 t: ttttfptttnwztttqvt' ) ( password = '7-12 f: ffffszszfffn' ) ( password = '6-11 x: mfxpwxbxxnqt' ) ( password = '7-12 j: kjjjjjmhpvjjjj' ) ( password = '2-3 d: ddsdb' ) ( password = '3-5 c: czbcd' ) ( password = '5-9 h: zbxhfglzk' ) ( password = '6-7 x: xxxxxlxx' ) ( password = '1-4 b: tbbt' ) ( password = '8-12 p: pzlppppzxdvp' ) ( password = '2-10 m: mfhhbrjzcmh' ) ( password = '13-14 q: qqqqqqpqqqqqwvqqqx' ) ( password = '4-5 l: hldll' ) ( password = '15-16 n: snhnjgfbntnplcnf' ) ( password = '6-10 x: xxxxhxxxxx' ) ( password = '15-18 n: pnngsnxccmnkgznncfn' ) ( password = '3-8 l: ghlllqmlgb' ) ( password = '1-4 q: pqqwq' ) ( password = '7-8 w: wwwwrwwdw' ) ( password = '19-20 t: tttttttttttttttttttj' ) ( password = '4-15 x: mfnfttdtqtdxkwp' ) ( password = '3-8 z: zzzzzzzlz' ) ( password = '12-16 d: dddqdddddddpdddsdd' ) ( password = '8-11 h: hhhhhhhhhhhh' ) ( password = '11-15 q: qqqqqqqqqqqpqqqqkq' ) ( password = '8-11 f: fxqzkthfxnd' ) ( password = '12-16 k: mbwkkkkkwgkkkklx' ) ( password = '4-8 q: gbnbrhbqkbxpqn' ) ( password = '3-13 c: cccccccccccctcc' ) ( password = '3-4 m: mmjvwm' ) ( password = '14-17 d: ddddzwxdqnrjdtddj' ) ( password = '3-10 j: xjsjjjjjhhnjbjwj' ) ( password = '11-13 s: sssssmssssnsl' ) ( password = '5-8 f: kwnfrnvr' ) ( password = '6-12 b: vfbjzbpkcbvdbb' ) ( password = '6-7 q: gqqhhqq' ) ( password = '1-4 q: qfkb' ) ( password = '3-4 r: nrrc' ) ( password = '11-14 z: znlzkbvzlzzvjz' ) ( password = '5-7 h: hhkwvfb' ) ( password = '3-7 t: trhfkdjm' ) ( password = '10-11 n: nnnnnnnnnznn' ) ( password = '2-3 q: qqjqjfbqnqtgxpfqn' ) ( password = '3-5 f: ffffm' ) ( password = '11-12 d: dtdddddcdddd' ) ( password = '4-7 s: ssssvsss' ) ( password = '2-14 f: qfkkkfkffznrcfk' ) ( password = '7-13 z: dczxkclzzzztz' ) ( password = '6-17 m: cjtfbndqvnnbmtmrm' ) ( password = '10-11 w: wwwwwwwwwlww' ) ( password = '7-18 d: vdppddfsfkddpjtfvr' ) ( password = '17-18 p: ppppppppppppppppppp' ) ( password = '12-13 c: zcchscccccqlc' ) ( password = '5-6 r: pfjjrrzr' ) ( password = '2-8 q: qqqqqqqzjq' ) ( password = '5-6 b: blbbbps' ) ( password = '4-5 l: lllllll' ) ( password = '6-11 n: rgplnnsnnfn' ) ( password = '4-10 j: rddsbjrstr' ) ( password = '5-6 h: hvrltlrjhhnmqkxhhxkl' ) ( password = '3-9 s: ssqsssssjssssssssbss' ) ( password = '8-9 r: rvvrrrxsrrdtrb' ) ( password = '11-13 b: tbtbwmbbbhqmb' ) ( password = '8-9 b: fcbbpvlvjhmkf' ) ( password = '15-16 f: ffffffffzffffffb' ) ( password = '7-10 t: zfpwcwmxlbhxtjtp' ) ( password = '2-5 z: zdzzbz' ) ( password = '5-6 p: xphrnbf' ) ( password = '6-11 f: qffpxfmfcpff' ) ( password = '6-11 m: pmjrmjqjvrv' ) ( password = '1-2 q: kwqqh' ) ( password = '6-7 x: xxkxxxxkxxxx' ) ( password = '12-15 w: wwwwwwwwwxwswwww' ) ( password = '15-16 q: qqsfgdgqqqqqwqqqqq' ) ( password = '9-18 q: qqqqqwqqqqqqqqqqqqqq' ) ( password = '5-6 v: lvvqvv' ) ( password = '14-16 b: dbfrbbbkbbpbkbbm' ) ( password = '1-2 p: kjpp' ) ( password = '2-4 q: krjv' ) ( password = '2-7 t: mkmtdgh' ) ( password = '1-2 s: jfss' ) ( password = '8-12 v: vvvxhvvvxzmvqwvq' ) ( password = '10-11 p: ptptjpcnppp' ) ( password = '3-4 x: ffdhvxnxxx' ) ( password = '3-8 x: xxfcxxxwxlxxxqxxx' ) ( password = '1-2 g: gggg' ) ( password = '6-8 d: dddddcdjjdlddddd' ) ( password = '1-11 v: vvvvvnvvvvhvkvv' ) ( password = '2-5 s: lfsnrs' ) ( password = '4-17 t: ttthtttftttttttrt' ) ( password = '12-14 z: rbfrzlfvwcbkczqm' ) ( password = '13-15 m: kmmqhbmmmpmmhfm' ) ( password = '4-8 v: vxnpvvhjvvj' ) ( password = '6-8 s: lzzntswssxn' ) ( password = '2-3 n: snngn' ) ( password = '8-14 t: dttttttttttjttt' ) ( password = '1-8 s: sssssssss' ) ( password = '16-18 n: tznvpjjbgxmpfwhnbn' ) ( password = '14-15 j: jjmjjfjjjjnjjjj' ) ( password = '4-12 t: dkwtrtlqntpll' ) ( password = '17-18 d: nrlrntddjdkddtdztm' ) ( password = '4-7 q: xmmdqzqlfqmhf' ) ( password = '16-17 n: nnnnnnnnfnnnnnnknnnn' ) ( password = '9-11 m: mmmmmmmjjzs' ) ( password = '2-6 b: dbjdgbglbgx' ) ( password = '5-15 b: rrlbbkwbbntwfkb' ) ( password = '4-5 n: pnjvn' ) ( password = '1-4 b: pkbd' ) ( password = '12-13 k: kkkkkkkkkkkdlkkkk' ) ( password = '1-5 j: hbljlvdjnvfj' ) ( password = '1-3 l: llll' ) ( password = '8-10 j: jcmjqlbjjh' ) ( password = '3-6 q: qqlhcnc' ) ( password = '2-6 d: grqczd' ) ( password = '1-2 b: blzbmnjfd' ) ( password = '6-8 d: ddztdfdhdd' ) ( password = '7-11 r: rrrtrdrxmsgrs' ) ( password = '1-4 b: bbkc' ) ( password = '2-5 s: ssmswssss' ) ( password = '4-8 n: nnnbnnnxnn' ) ( password = '2-3 d: dsrdddd' ) ( password = '16-17 r: zrvrrrtzrrrrrrrrfr' ) ( password = '4-9 v: jvmqvvvvvvwx' ) ( password = '5-6 x: xxxxxb' ) ( password = '5-6 t: tfttnc' ) ( password = '3-4 p: pprfp' ) ( password = '6-11 j: ptcjmstmtbhxfvpsww' ) ( password = '4-5 x: xdhqx' ) ( password = '6-7 d: dddddddd' ) ( password = '4-5 b: wbjbppzbhjkf' ) ( password = '2-6 g: gggggdg' ) ( password = '3-8 j: jjjfrjjkjjjmjjml' ) ( password = '7-11 h: hwhhbrhhhzh' ) ( password = '5-9 b: lpgjbssbbxk' ) ( password = '6-7 s: nsxssssssss' ) ( password = '3-4 l: mllnl' ) ( password = '5-6 r: rmpgdk' ) ( password = '1-4 p: fpbmctbpl' ) ( password = '5-6 s: scnmsss' ) ( password = '2-4 m: jdkpmhmhmqtft' ) ( password = '8-15 d: ddddpsdrdrqdmddd' ) ( password = '6-7 s: snsssfs' ) ( password = '4-6 g: ggggggg' ) ( password = '7-8 x: xxxxbxxx' ) ( password = '6-8 b: bmbbbvbhbbb' ) ( password = '9-10 r: rrrrrpmrtmrrr' ) ( password = '3-11 x: xxqpxtxmhdrxtxxxxxxx' ) ( password = '10-12 l: lwlpljllllllll' ) ( password = '3-5 l: lzlrl' ) ( password = '3-5 b: bbbbvbpbbbbb' ) ( password = '5-9 z: zwzzzzzzkc' ) ( password = '12-14 l: qlnlxwrzpgllplbml' ) ( password = '4-7 n: lwdzpjtmn' ) ( password = '5-10 b: bbbbjbbbbx' ) ( password = '6-7 j: njzdjjsxfpp' ) ( password = '5-14 j: djnljhlrdmqnxcht' ) ( password = '3-4 z: dtzz' ) ( password = '10-11 m: tcmmhmhcsmm' ) ( password = '9-13 p: pppphpppppcphfwbp' ) ( password = '1-6 m: lmmmmw' ) ( password = '2-4 q: hnzqqqprm' ) ( password = '17-18 p: plpfzlkpzdhfpptgpq' ) ( password = '3-17 r: rrprrrrrrrrrrrrrlrr' ) ( password = '5-8 n: nnnznnnnnn' ) ( password = '3-12 s: khjvspqsbmcst' ) ( password = '6-8 w: cwbmhwqw' ) ( password = '2-4 d: dddddp' ) ( password = '1-6 b: tsbbbgbt' ) ( password = '3-10 d: vvhzmpscssdwcxlvjjd' ) ( password = '2-3 m: mmmmmmmmmnmmmmmmmmj' ) ( password = '2-13 q: qqcpmtfwwffdqkwn' ) ( password = '15-16 k: kkkkkkkkkkkkkkmf' ) ( password = '2-3 j: jjnv' ) ( password = '1-2 b: btbb' ) ( password = '5-7 b: bbbbxhbbxtbb' ) ( password = '5-7 g: gggggglgzg' ) ( password = '3-4 b: bbpc' ) ( password = '1-11 k: kkkkgkkkkkskk' ) ( password = '1-14 h: lhthhhhnchhhhxhhhh' ) ( password = '6-7 q: qfqlqbkqqqvqfqzqs' ) ( password = '3-5 s: ssbsss' ) ( password = '9-13 h: hhnhhjhvhdhhhbhhh' ) ( password = '4-7 j: txdsljn' ) ( password = '13-16 z: dgzkzzzkzzzzbxznw' ) ( password = '7-8 s: sssssxgs' ) ( password = '13-14 h: sphwccnrvhlbhjx' ) ( password = '12-15 x: vtcxxxqjcwzbkxx' ) ( password = '3-5 v: vjlvvvvvnv' ) ( password = '11-14 k: klkkkkkkkkwkkkkkk' ) ( password = '9-10 c: cccctcccccccccc' ) ( password = '8-9 b: bbbbqlvnbq' ) ( password = '3-7 d: ddddddddd' ) ( password = '4-7 s: pbmwcmsrd' ) ( password = '4-6 s: gxssqsw' ) ( password = '7-16 r: rqdpsrrchrtcblnlsrr' ) ( password = '10-15 x: gjbvwkmpzxfrvxx' ) ( password = '3-6 k: drkchxtzkhnn' ) ( password = '1-2 g: nzvkggbdg' ) ( password = '16-17 f: fffffffffffffffkbf' ) ( password = '1-9 t: gttttvttstt' ) ( password = '10-12 c: cgcvcdcccwcccccj' ) ( password = '7-8 k: zkkpkkkf' ) ( password = '8-9 n: ngfnvnrwnnfl' ) ( password = '11-13 j: hssxkhgvdhcjxhp' ) ( password = '3-4 b: bbbbbbbbbbbbtck' ) ( password = '3-7 b: nphsgbwbv' ) ( password = '9-13 w: wwwwwwwwgwwwwwwwww' ) ( password = '12-15 v: vvvvvvvvvvvvvvvvv' ) ( password = '6-15 k: ftlgvkjxcngkwkjrnwn' ) ( password = '11-13 k: kkskkkkkkkkkkkkk' ) ( password = '1-13 s: sssslsnssssssssssss' ) ( password = '9-11 t: ttttttttttttt' ) ( password = '1-2 h: hmhh' ) ( password = '6-7 h: hmhhghv' ) ( password = '2-4 v: gvnv' ) ( password = '3-6 l: hplmlltl' ) ( password = '5-16 s: pqvnxbbxfnhdhmsswqx' ) ( password = '4-13 z: dmwwlzznknzbzvzzw' ) ( password = '9-10 c: cflcqdcwcvqmkjdqsgpc' ) ( password = '4-10 f: mffxxfffflfsfgmlmxf' ) ( password = '3-4 d: vdxdbw' ) ( password = '1-3 z: wzdzzzg' ) ( password = '9-10 z: zzzzwzzzlnz' ) ( password = '2-5 n: knlfn' ) ( password = '5-7 c: klcbczc' ) ( password = '5-12 f: jrdqgrzkdplws' ) ( password = '3-5 w: kftbw' ) ( password = '1-4 s: sssgrs' ) ( password = '6-9 n: hngnnnnjnnnn' ) ( password = '13-14 k: kkkkkkkkkkqqkjk' ) ( password = '10-18 s: xbsssxqqmvmshskjjs' ) ( password = '5-6 k: snxjhwglkt' ) ( password = '10-13 h: mtthhhxmsvlshhhnhl' ) ( password = '7-16 z: zzzzzzwzzzzzzzzzzz' ) ( password = '14-16 m: rmmvmhtmfmmmjmmcmmmm' ) ( password = '8-11 s: sssssdsssspsss' ) ( password = '6-9 g: clgdxllghzggqfvrxgzf' ) ( password = '14-15 x: xxxxxxxxxxxsrxxxx' ) ( password = '4-11 q: hqplnqwfsthmhspq' ) ( password = '12-13 g: pzggkchrpjsct' ) ( password = '7-12 t: zctsttbtttttt' ) ( password = '3-4 s: jknhdlnsgssg' ) ( password = '9-16 c: xlcrsqspctdcvhqc' ) ( password = '4-19 f: vvzfktsstkbkngbfndmv' ) ( password = '9-11 b: bbhbbbjmzbh' ) ( password = '3-6 x: xqxxxvrx' ) ( password = '7-8 g: gggggmgx' ) ( password = '9-11 k: jrkpwggvkxk' ) ( password = '3-4 m: mhpfmmmm' ) ( password = '6-7 f: fqfffldrf' ) ( password = '9-10 j: tjjcjdtjdj' ) ( password = '2-5 c: qcccf' ) ( password = '5-8 b: bbvbqbbtbbbbbb' ) ( password = '6-7 q: hhpwdqqfxzgjgqv' ) ( password = '2-5 q: rjqxs' ) ( password = '9-11 q: hlcqqqxlrtq' ) ( password = '2-13 n: nnnvwxgqbvdlnckgzgsr' ) ( password = '15-16 l: jtcxfkljlwllpbgb' ) ( password = '3-4 c: ccmscc' ) ( password = '9-14 l: llllllllhllllhl' ) ( password = '2-5 z: zzzgzzzw' ) ( password = '2-8 b: blclwtdbz' ) ( password = '2-3 l: llhllll' ) ( password = '8-10 s: sssssssszr' ) ( password = '1-4 f: fffz' ) ( password = '4-11 t: ttttttttttltt' ) ( password = '3-7 m: wcmkmznf' ) ( password = '6-8 v: lnkgrvnvprjcjhfvwph' ) ( password = '6-9 b: bkntwbwtbnk' ) ( password = '3-4 j: jjjjj' ) ( password = '2-12 z: qznmdxwggvnz' ) ( password = '3-7 s: ssssslsssjssss' ) ( password = '4-11 d: xdjddkjvqdddpddlmdmq' ) ( password = '3-5 r: rrnrrrrdrr' ) ( password = '6-8 g: zbgwtwzg' ) ( password = '2-3 l: lmll' ) ( password = '5-11 t: pvnmcqlcnztqf' ) ( password = '5-6 j: jcljjdmmd' ) ( password = '13-14 z: zzzzzzzzzzzzgr' ) ( password = '4-6 q: xvcwqtd' ) ( password = '6-9 t: tttttdttbtt' ) ( password = '1-5 m: mmmmmmmmmmmbmmmmm' ) ( password = '4-5 h: hnvvpgtgmh' ) ( password = '3-7 t: ttpttttt' ) ( password = '5-6 t: ngtttt' ) ( password = '2-9 h: jxhhhhhhhhhhhlhwpgg' ) ( password = '3-15 l: sslflhrrkcgvlhw' ) ( password = '8-10 g: ggggwggbgdgg' ) ( password = '8-14 t: tjttlttrhtgvtm' ) ( password = '7-8 m: mmmmmfmm' ) ( password = '10-11 n: kwnvzvnlnkn' ) ( password = '7-11 f: fffffhjffffff' ) ( password = '1-16 g: gggggggggggggggsggg' ) ( password = '8-11 z: ntpzzdfzpzz' ) ( password = '15-18 v: vwvnvvbvvkvvvvdjvjv' ) ( password = '8-17 z: zzzzzzzgzzzzzzzznzz' ) ( password = '7-8 j: jjfjjjjjjmrj' ) ( password = '9-14 q: dprqqqzcfmcqqxqq' ) ( password = '5-7 w: wwwwwwhw' ) ( password = '10-11 g: gggggghggwmg' ) ( password = '1-2 x: nhxx' ) ( password = '9-10 t: tttktttlvttv' ) ( password = '6-9 j: zpjhrjjffq' ) ( password = '16-19 v: fvmrhxmvbvppzpwvvxbq' ) ( password = '1-3 b: sbbbb' ) ( password = '2-9 t: btbqhwgttpx' ) ( password = '4-5 r: zdzrr' ) ( password = '2-3 q: qqfq' ) ( password = '8-9 j: vsjhjqvmjjx' ) ( password = '5-14 l: llllwllllkllldllll' ) ( password = '9-12 t: fltmrbqsjhqt' ) ( password = '6-8 z: xdzzzlzzbj' ) ( password = '3-20 f: zjrwrnzmlswpsrfjgjht' ) ( password = '11-12 v: zjxrkvjkwqvf' ) ( password = '11-15 r: rrrrrrrrrrtrrrjr' ) ( password = '1-5 l: qlxlcllkllllwl' ) ( password = '11-12 s: ssssssssssts' ) ( password = '7-8 p: ppppppxw' ) ( password = '7-9 b: bbbbhbnbfdbbbdb' ) ( password = '4-8 f: grmvkbqbflnz' ) ( password = '18-19 w: wgwwwwwwwwwwwwwwwdqw' ) ( password = '6-14 r: rrrrrtrrrrrrrlrrrrv' ) ( password = '1-2 t: tttttttgtztt' ) ( password = '5-8 j: jxfjjjjjpfj' ) ( password = '6-15 k: kfqnbvrjkmxptfdnnrkk' ) ( password = '7-8 m: mmmmmmcqmmm' ) ( password = '6-13 p: pppppppppppprpppppp' ) ( password = '1-5 d: wdrpd' ) ( password = '7-9 b: bbbbbbbbzbbbbb' ) ( password = '3-11 j: jkrdcvmfctjvr' ) ( password = '3-9 t: vpnqgxmjqccmjpkdt' ) ( password = '3-7 l: llllllll' ) ( password = '5-8 f: fffcnczfrfs' ) ( password = '11-16 h: hhhshchnhxpshpdh' ) ( password = '5-6 x: cxxtdx' ) ( password = '11-15 k: gxltfbjcplqkkdhlc' ) ( password = '3-9 g: twgvrlcgjljpwmrnxdtn' ) ( password = '1-7 x: xxdxxxxxqqlxxxx' ) ( password = '2-4 n: nnnt' ) ( password = '11-13 h: hhhhhhhhhhlhhh' ) ( password = '12-13 d: csddgmqzwmzmnj' ) ( password = '11-12 h: hhbvhhhhchhx' ) ( password = '7-11 h: hhhhhhhshhmhhh' ) ( password = '15-16 w: wwwwwwwswwwwwwbh' ) ( password = '3-4 f: sfffffffk' ) ( password = '9-14 g: ggggggfggggggg' ) ( password = '11-13 p: pppppppdppppppppppps' ) ( password = '10-12 v: vhvvvvvvvgvnvvvfvv' ) ( password = '1-19 l: lqlpllcdnllblkldlvp' ) ( password = '2-3 t: rnbj' ) ( password = '12-13 d: ddddsddddddbdqfdqld' ) ( password = '2-15 l: klrxxlgjbvdqxgtgwpn' ) ( password = '2-4 d: ddnp' ) ( password = '7-8 d: dzdddjmtd' ) ( password = '3-16 r: rrwrrrrrrrrrrrrrrr' ) ( password = '11-12 d: rdddddddkddwrdx' ) ( password = '6-8 z: zzzzgzlqzzvkz' ) ( password = '15-18 g: gggggggggggggggggcgg' ) ( password = '6-11 c: zcvcsxmclmrwk' ) ( password = '5-11 h: hqszlhzshhjh' ) ( password = '5-6 z: zjwzzz' ) ( password = '8-12 q: qqqqqqqqqqqqqq' ) ( password = '4-6 d: tdddtdrlx' ) ( password = '2-5 s: zbfljqksqrnfrwrw' ) ( password = '5-7 d: ddkddwzd' ) ( password = '5-6 p: hpxpxp' ) ( password = '7-9 g: ggggggxgw' ) ( password = '3-5 b: tbfzb' ) ( password = '9-14 z: pzszffgpzkkzczbznn' ) ( password = '14-18 s: tsssslssslsrmzsvfzs' ) ( password = '9-10 h: hhhhhhhhnhh' ) ( password = '8-9 w: wnvwrxpwwzsmdzwmwl' ) ( password = '1-2 d: qddddd' ) ( password = '4-8 k: kkklkkkkkkk' ) ( password = '3-4 m: kmzvvm' ) ( password = '10-12 t: xntkttqkhgthrfhk' ) ( password = '7-13 n: nnnnvrkznnnnn' ) ( password = '1-4 l: lllklx' ) ( password = '3-4 p: pnns' ) ( password = '6-8 r: rrrrrdpr' ) ( password = '5-10 v: vnztdmgllb' ) ( password = '12-15 z: zzzzzzzzzzzgzzm' ) ( password = '2-5 j: kjkkmjvcr' ) ( password = '4-13 r: rrrrrrrrrrrrmzrr' ) ( password = '3-6 w: wktbfw' ) ( password = '6-8 h: hhhhhzhhhhh' ) ( password = '5-16 m: dxlsprxpxflmmdls' ) ( password = '3-4 v: xqvr' ) ( password = '8-11 k: kkkkkkklkkkk' ) ( password = '3-4 t: qtmsttdttmzthtttt' ) ( password = '4-6 w: wkwbkww' ) ( password = '1-2 d: dddc' ) ( password = '9-10 b: bbbbbbbbbb' ) ( password = '11-12 n: nnnnnnnnnnnnhn' ) ( password = '9-10 m: nmhjhtmvvm' ) ( password = '2-5 l: hgllrllllllll' ) ( password = '3-4 t: tvtkt' ) ( password = '5-6 p: bpbmppwpqnpxp' ) ( password = '4-8 r: rrrnrrrrrrm' ) ( password = '6-12 z: zhzbzszkzwbgvz' ) ( password = '13-14 b: bjbbbcbqdbbbjwbbbbbb' ) ( password = '4-8 n: nnnnnnnnn' ) ( password = '6-10 l: lllllllllll' ) ( password = '4-6 q: qqqqqqq' ) ( password = '3-5 d: bddzv' ) ( password = '9-10 l: vllwpvltmwvl' ) ( password = '7-14 p: cppbprpppppphm' ) ( password = '12-17 k: kkkkkkkkkkkkkkkkkkk' ) ( password = '6-7 t: wstglttttltwqpxd' ) ( password = '2-5 t: wtrkt' ) ( password = '10-18 v: vvvvvvvvrgkbvvsvvvv' ) ( password = '8-9 p: nvsqptgpphmh' ) ( password = '5-7 c: jccvlccsmqbrfnspf' ) ( password = '4-6 g: zsggtg' ) ( password = '6-8 p: pppphpqdppdp' ) ( password = '2-14 f: kqfffffgfffffdffff' ) ( password = '7-9 h: whhhhhhhh' ) ( password = '2-3 w: wmlwwwwwwwwwwwwwwwzw' ) ( password = '5-6 h: hhhhghhhhhx' ) ( password = '1-5 z: dzzzzzzz' ) ( password = '14-16 g: ggggggggggggglghl' ) ( password = '4-8 c: ccfcmcccccf' ) ( password = '2-3 h: hwhd' ) ( password = '9-12 w: wwwczwwwzwwwwwwww' ) ( password = '2-3 b: bpqb' ) ( password = '2-7 b: dbrxzktblnqgj' ) ( password = '2-8 w: wgwwwwwbtw' ) ( password = '6-11 b: bbbbbbbbbbbb' ) ( password = '7-12 m: ztmpmzvmtmbc' ) ( password = '4-5 f: kxhkg' ) ( password = '12-13 n: xlnqqnbdqnfvnldjf' ) ( password = '3-4 r: jzrr' ) ( password = '9-12 q: qqqqwqqqsqvbqcs' ) ( password = '11-12 c: txkdrczkwcccbjfwctcg' ) ( password = '9-11 w: xwwwwwjdrwgwgrw' ) ( password = '4-12 n: qfnpgktmggzmr' ) ( password = '2-11 t: ttflcgqrrmx' ) ( password = '8-15 d: rdjkddzdddpttdbg' ) ( password = '9-12 d: ddddddddbdddvd' ) ( password = '5-10 h: lhvlhhctdhdq' ) ( password = '10-16 b: nbbbbbbbbsmcmbbr' ) ( password = '5-10 d: qmddddddddd' ) ( password = '4-6 h: hhhhthh' ) ( password = '2-5 j: jjksjmmsvttvfsgf' ) ( password = '7-9 c: xbhznccvk' ) ( password = '9-13 m: pshmvvqqmnkkmklrhxq' ) ( password = '8-9 s: ssssssssssss' ) ( password = '13-17 p: wpnmpwjbntllpqmhp' ) ( password = '6-7 d: ddddddkddddd' ) ( password = '6-7 p: gvpspmj' ) ( password = '3-15 s: gwsllhxsrfzqlmsls' ) ( password = '5-7 v: vvvvvvwvv' ) ( password = '4-5 x: mvxjx' ) ( password = '2-5 q: bpkjqqqttgpddg' ) ( password = '4-6 d: dddhdhd' ) ( password = '4-6 s: scsncs' ) ( password = '5-10 m: mmmmpmmmmkmmmm' ) ( password = '5-14 r: rrrrrrrrrrrrrsrrrr' ) ( password = '7-10 d: zddddddldxtmfzddd' ) ( password = '2-5 x: vxwxz' ) ( password = '2-5 h: khxnhmczfhrwdkggd' ) ( password = '12-16 v: vvvrvfvvvkvvvvvxkvc' ) ( password = '3-4 f: rcbf' ) ( password = '11-15 m: mklrxvmkmmvmmzmm' ) ( password = '9-14 w: qwwwwwlwbwwwwswww' ) ( password = '7-16 z: zzzzzzbzzzzzzzzpzzzz' ) ( password = '16-18 f: fffffffqffffffffff' ) ( password = '1-5 l: llllll' ) ( password = '3-4 m: vmmmpcd' ) ( password = '15-18 j: jjjjjjjjjjjjjjmjjjj' ) ( password = '3-4 g: ggdgg' ) ( password = '12-14 x: xrmzlxxlrxfglxj' ) ( password = '3-4 f: tfxrbbffqf' ) ( password = '7-8 p: pppppbvpc' ) ( password = '12-13 t: tttttfzwtttvt' ) ( password = '7-8 n: nnnnnnns' ) ( password = '10-12 d: dwjdddddwdkqdm' ) ( password = '4-6 f: fzwrzjrcq' ) ( password = '6-8 b: tbbbbbcbbbbb' ) ( password = '4-7 v: vvvgvvvv' ) ( password = '18-19 k: kkkkkkkkkkkkkkkkkkm' ) ( password = '7-10 l: llllllcllll' ) ( password = '1-6 d: bdddddddd' ) ( password = '8-14 r: rrrrwrxrrrrrrgrrdrz' ) ( password = '2-10 n: nfnnnnlnnnnn' ) ( password = '5-6 l: lklllhl' ) ( password = '17-19 r: rrrrrrrrrrrrrrrrrrj' ) ( password = '4-7 p: tknpspbhpcr' ) ( password = '5-7 x: tvhrbsrtf' ) ( password = '10-11 x: xxxxxxxxxxxx' ) ( password = '13-15 v: vsbvvbvlvqcznwvvvh' ) ( password = '4-5 v: vpsdlnvvbvvvpfqvvvv' ) ( password = '16-18 k: lrhszjpkxkqpzskzbkvt' ) ( password = '12-13 c: ccccccccccccdc' ) ( password = '9-14 p: ppvppppppppppppppppp' ) ( password = '5-11 b: pjbbbbbbbbblbvb' ) ( password = '2-4 m: fmtwnjwlfcsgpdmxhtd' ) ( password = '7-12 l: zflcvdlllfkvtfqptll' ) ( password = '11-12 g: ggggggnjghggkggfn' ) ( password = '8-10 z: dfzxgzzbpz' ) ( password = '5-6 w: wwwfkc' ) ( password = '9-10 w: wwwwwwbwwhww' ) ( password = '5-6 g: kgggjg' ) ( password = '4-8 s: ssssssscs' ) ( password = '12-20 t: ttttttltttvttttttttt' ) ). * Starting the Task DATA: wa_current LIKE LINE OF lv_input, lv_result TYPE i VALUE 0, lr_result TYPE match_result_tab, lr_lines TYPE i, ln_min TYPE i, ln_max TYPE i. LOOP AT lv_input INTO wa_current. SPLIT wa_current-password AT ': ' INTO TABLE DATA(lv_options). READ TABLE lv_options INTO DATA(lv_pattern) INDEX 1. READ TABLE lv_options INTO DATA(lv_password) INDEX 2. " The password, which should be validated. " Split the pattern in limits and letter. SPLIT lv_pattern AT ' ' INTO TABLE DATA(lv_pattern_options). READ TABLE lv_pattern_options INTO DATA(lv_limits) INDEX 1. READ TABLE lv_pattern_options INTO DATA(lv_letter) INDEX 2. " The letter, which should be used as regex SPLIT lv_limits AT '-' INTO TABLE DATA(lv_limits_options). READ TABLE lv_limits_options INTO DATA(lv_min) INDEX 1. " Minimum appearance of the letter. READ TABLE lv_limits_options INTO DATA(lv_max) INDEX 2. " Maximum appearance of the letter. " Convert the strings to numbers. ln_min = lv_min. ln_max = lv_max. " Find the occurrences in the password. FIND ALL OCCURRENCES OF lv_letter IN lv_password RESULTS lr_result. " Get amount of occurrences. lr_lines = lines( lr_result ). IF lr_lines GE ln_min AND lr_lines LE ln_max. lv_result = lv_result + 1. ENDIF. ENDLOOP. WRITE: 'Total valid passwords: ' && lv_result.
38.227402
105
0.615825
9836a55efebe8cf97c0fa20253dea2cf4e877ba9
3,951
abap
ABAP
src/legacy/#dmo#flight_travel_api15.fugr.#dmo#flight_travel_update15.abap
SAP-Cloud-Platform/flight15
af2de21cb04a2eb8d16e801d2ce668f88ba62789
[ "BSD-Source-Code" ]
1
2019-11-14T15:21:07.000Z
2019-11-14T15:21:07.000Z
src/legacy/#dmo#flight_travel_api15.fugr.#dmo#flight_travel_update15.abap
SAP-Cloud-Platform/flight15
af2de21cb04a2eb8d16e801d2ce668f88ba62789
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api15.fugr.#dmo#flight_travel_update15.abap
SAP-Cloud-Platform/flight15
af2de21cb04a2eb8d16e801d2ce668f88ba62789
[ "BSD-Source-Code" ]
null
null
null
"! <h1>API for Updating a Travel</h1> "! "! <p> "! Function module to update a single Travel instance with the possibility to update related Bookings and "! Booking Supplements in the same call. "! </p> "! "! <p> "! For an operation only on a Booking or Booking Supplement the Travel Data Change Flag structure still must be applied. "! It then contains only the <em>travel_id</em> and all flags set to <em>false</em> respectively left <em>initial</em>. "! </p> "! "! "! @parameter is_travel | Travel Data "! @parameter is_travelx | Travel Data Change Flags "! @parameter it_booking | Table of predefined Booking Key <em>booking_id</em> and Booking Data "! @parameter it_bookingx | Change Flag Table of Booking Data with predefined Booking Key <em>booking_id</em> "! @parameter it_booking_supplement | Table of predefined Booking Supplement Key <em>booking_id</em>, <em>booking_supplement_id</em> and Booking Supplement Data "! @parameter it_booking_supplementx | Change Flag Table of Booking Supplement Data with predefined Booking Supplement Key <em>booking_id</em>, <em>booking_supplement_id</em> "! @parameter es_travel | Evaluated Travel Data like /DMO/TRAVEL15 "! @parameter et_booking | Table of evaluated Bookings like /DMO/BOOKING15 "! @parameter et_booking_supplement | Table of evaluated Booking Supplements like /DMO/BOOK_SUP_15 "! @parameter et_messages | Table of occurred messages "! FUNCTION /DMO/FLIGHT_TRAVEL_UPDATE15. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(IS_TRAVEL) TYPE /DMO/IF_FLIGHT_LEGACY15=>TS_TRAVEL_IN *" REFERENCE(IS_TRAVELX) TYPE /DMO/IF_FLIGHT_LEGACY15=>TS_TRAVEL_INX *" REFERENCE(IT_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY15=>TT_BOOKING_IN *" OPTIONAL *" REFERENCE(IT_BOOKINGX) TYPE *" /DMO/IF_FLIGHT_LEGACY15=>TT_BOOKING_INX OPTIONAL *" REFERENCE(IT_BOOKING_SUPPLEMENT) TYPE *" /DMO/IF_FLIGHT_LEGACY15=>TT_BOOKING_SUPPLEMENT_IN OPTIONAL *" REFERENCE(IT_BOOKING_SUPPLEMENTX) TYPE *" /DMO/IF_FLIGHT_LEGACY15=>TT_BOOKING_SUPPLEMENT_INX OPTIONAL *" EXPORTING *" REFERENCE(ES_TRAVEL) TYPE /DMO/TRAVEL15 *" REFERENCE(ET_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY15=>TT_BOOKING *" REFERENCE(ET_BOOKING_SUPPLEMENT) TYPE *" /DMO/IF_FLIGHT_LEGACY15=>TT_BOOKING_SUPPLEMENT *" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY15=>TT_MESSAGE *"---------------------------------------------------------------------- CLEAR es_travel. CLEAR et_booking. CLEAR et_booking_supplement. CLEAR et_messages. /dmo/cl_flight_legacy15=>get_instance( )->update_travel( EXPORTING is_travel = is_travel it_booking = it_booking it_booking_supplement = it_booking_supplement is_travelx = is_travelx it_bookingx = it_bookingx it_booking_supplementx = it_booking_supplementx IMPORTING es_travel = es_travel et_booking = et_booking et_booking_supplement = et_booking_supplement et_messages = DATA(lt_messages) ). /dmo/cl_flight_legacy15=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages IMPORTING et_messages = et_messages ). ENDFUNCTION.
60.784615
174
0.581625
983abc16bd64703a87e21c66aae6aff077b770d9
1,887
abap
ABAP
src/zcl_i_a2cc_where_used_provider.clas.testclasses.abap
jrodriguez-rc/ABAP-2-CODE-CHARTA
dc0f6af72ebcbb72b442479f782b8265d3c5b888
[ "MIT" ]
8
2021-01-29T15:37:02.000Z
2022-01-17T14:17:56.000Z
src/zcl_i_a2cc_where_used_provider.clas.testclasses.abap
jrodriguez-rc/ABAP-2-CODE-CHARTA
dc0f6af72ebcbb72b442479f782b8265d3c5b888
[ "MIT" ]
2
2021-06-28T05:13:47.000Z
2021-07-01T05:03:59.000Z
src/zcl_i_a2cc_where_used_provider.clas.testclasses.abap
jrodriguez-rc/ABAP-2-CODE-CHARTA
dc0f6af72ebcbb72b442479f782b8265d3c5b888
[ "MIT" ]
2
2021-06-30T07:13:35.000Z
2021-09-14T12:45:32.000Z
*"* use this source file for your ABAP unit test classes CLASS ltcl_test_provider DEFINITION DEFERRED. CLASS zcl_i_a2cc_where_used_provider DEFINITION LOCAL FRIENDS ltcl_test_provider. CLASS ltcl_test_provider DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA cut TYPE REF TO zif_i_A2CC_where_used_provider. METHODS: setup, fail_with_xxxx FOR TESTING RAISING cx_static_check, succeed_with_meth FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS lth_dummy_where_used DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES zif_i_A2CC_where_used. ENDCLASS. CLASS lth_dummy_where_used IMPLEMENTATION. METHOD zif_i_A2CC_where_used~get_cross_references. ENDMETHOD. ENDCLASS. CLASS ltcl_test_provider IMPLEMENTATION. METHOD setup. cut = NEW zcl_i_a2cc_where_used_provider( ). cast zcl_i_a2cc_where_used_provider( cut )->set_configuration( VALUE #( ( objecttype = 'CLAS' subtype = 'METH' instance = NEW lth_dummy_where_used( ) ) ) ). ENDMETHOD. METHOD succeed_with_meth. TRY. "given configuration with METH "when called with subtype Meth cut->get( objecttype = 'CLAS' subtype = 'METH' ). "then expext implementation CATCH zcx_i_A2CC_metrics_impl_error. cl_abap_unit_assert=>fail( 'Expect implementation' ). ENDTRY. ENDMETHOD. METHOD fail_with_xxxx. CONSTANTS any_non_existant_value TYPE zif_i_A2CC_where_used_provider=>subtype VALUE 'XXXX' ##NO_TEXT. TRY. "given instance and "when called with nonsense subtype cut->get( objecttype = 'CLAS' subtype = any_non_existant_value ). "then expext exception cl_abap_unit_assert=>fail( 'Expect exception zcx_i_metric_implement_error' ). CATCH zcx_i_A2CC_metrics_impl_error. ENDTRY. ENDMETHOD. ENDCLASS.
29.030769
159
0.737149
983fbf83bf5ee62e505b151d0862fa877eaf9eb8
3,337
abap
ABAP
src/objects/core/zcl_abapgit_serialize.clas.testclasses.abap
abap-weasel/abapGit
fcb079b651dd5ec9a0946241537dcb52b9282147
[ "MIT" ]
2
2021-03-20T20:27:04.000Z
2021-03-20T20:34:58.000Z
src/objects/core/zcl_abapgit_serialize.clas.testclasses.abap
abap-weasel/abapGit
fcb079b651dd5ec9a0946241537dcb52b9282147
[ "MIT" ]
40
2021-06-01T05:58:26.000Z
2022-03-01T05:02:17.000Z
src/objects/core/zcl_abapgit_serialize.clas.testclasses.abap
wangdongcheng/abapGit
7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab
[ "MIT" ]
1
2021-08-18T07:58:26.000Z
2021-08-18T07:58:26.000Z
CLASS ltcl_determine_max_threads DEFINITION DEFERRED. CLASS zcl_abapgit_serialize DEFINITION LOCAL FRIENDS ltcl_determine_max_threads. CLASS ltcl_determine_max_threads DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. DATA: mo_cut TYPE REF TO zcl_abapgit_serialize. METHODS: setup, determine_max_threads FOR TESTING RAISING zcx_abapgit_exception, force FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_determine_max_threads IMPLEMENTATION. METHOD setup. CREATE OBJECT mo_cut. ENDMETHOD. METHOD determine_max_threads. DATA: lv_threads TYPE i. lv_threads = mo_cut->determine_max_threads( ). cl_abap_unit_assert=>assert_differs( act = lv_threads exp = 0 ). ENDMETHOD. METHOD force. DATA: lv_threads TYPE i. lv_threads = mo_cut->determine_max_threads( abap_true ). cl_abap_unit_assert=>assert_equals( act = lv_threads exp = 1 ). ENDMETHOD. ENDCLASS. CLASS ltcl_serialize DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. DATA: mo_cut TYPE REF TO zcl_abapgit_serialize. METHODS: setup, test FOR TESTING RAISING zcx_abapgit_exception, unsupported FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_serialize IMPLEMENTATION. METHOD setup. CREATE OBJECT mo_cut. ENDMETHOD. METHOD test. DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, lt_sequential TYPE zif_abapgit_definitions=>ty_files_item_tt, lt_parallel TYPE zif_abapgit_definitions=>ty_files_item_tt. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF lt_tadir. APPEND INITIAL LINE TO lt_tadir ASSIGNING <ls_tadir>. <ls_tadir>-object = 'PROG'. <ls_tadir>-obj_name = 'RSABAPPROGRAM'. <ls_tadir>-devclass = 'PACKAGE'. <ls_tadir>-path = 'foobar'. lt_sequential = mo_cut->serialize( it_tadir = lt_tadir iv_force_sequential = abap_true ). lt_parallel = mo_cut->serialize( it_tadir = lt_tadir iv_force_sequential = abap_false ). cl_abap_unit_assert=>assert_equals( act = lt_sequential exp = lt_parallel ). ENDMETHOD. METHOD unsupported. DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, li_log1 TYPE REF TO zif_abapgit_log, li_log2 TYPE REF TO zif_abapgit_log. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF lt_tadir. APPEND INITIAL LINE TO lt_tadir ASSIGNING <ls_tadir>. <ls_tadir>-object = 'ABCD'. <ls_tadir>-obj_name = 'OBJECT'. CREATE OBJECT li_log1 TYPE zcl_abapgit_log. mo_cut->serialize( it_tadir = lt_tadir ii_log = li_log1 iv_force_sequential = abap_true ). CREATE OBJECT li_log2 TYPE zcl_abapgit_log. mo_cut->serialize( it_tadir = lt_tadir ii_log = li_log2 iv_force_sequential = abap_false ). cl_abap_unit_assert=>assert_char_cp( act = zcl_abapgit_log_viewer=>to_html( li_log1 )->render( ) exp = '*Object type ABCD not supported*' ). cl_abap_unit_assert=>assert_char_cp( act = zcl_abapgit_log_viewer=>to_html( li_log2 )->render( ) exp = '*Object type ABCD not supported*' ). ENDMETHOD. ENDCLASS.
24.718519
97
0.694936
98431ee28257d44058cfe9444deecf8c756213aa
1,639
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_ae_factory.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.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.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 DEFINITION PUBLIC ABSTRACT CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_gtt_mia_ae_factory . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_gtt_mia_ae_factory IMPLEMENTATION. METHOD zif_gtt_mia_ae_factory~get_ae_filler. ENDMETHOD. METHOD zif_gtt_mia_ae_factory~get_ae_parameters. ro_ae_parameters = NEW zcl_gtt_mia_ae_parameters( iv_appsys = iv_appsys is_event_type = is_event_type it_all_appl_tables = it_all_appl_tables it_event_type_cntl_tabs = it_event_type_cntl_tabs it_events = it_events ). ENDMETHOD. METHOD zif_gtt_mia_ae_factory~get_ae_processor. DATA: lo_ae_parameters TYPE REF TO zif_gtt_mia_ae_parameters, lo_ae_filler TYPE REF TO zif_gtt_mia_ae_filler. lo_ae_parameters = zif_gtt_mia_ae_factory~get_ae_parameters( iv_appsys = iv_appsys is_event_type = is_event_type it_all_appl_tables = it_all_appl_tables it_event_type_cntl_tabs = it_event_type_cntl_tabs it_events = it_events ). lo_ae_filler = zif_gtt_mia_ae_factory~get_ae_filler( io_ae_parameters = lo_ae_parameters ). ro_ae_processor = NEW zcl_gtt_mia_ae_processor( is_definition = is_definition io_ae_parameters = lo_ae_parameters io_ae_filler = lo_ae_filler ). ENDMETHOD. ENDCLASS.
28.754386
75
0.633313
98434b619016fbee2866c7f6579668332f294e7f
449
abap
ABAP
src/zcl_im_dop_satis_imp.clas.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
src/zcl_im_dop_satis_imp.clas.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
src/zcl_im_dop_satis_imp.clas.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
class ZCL_IM_DOP_SATIS_IMP definition public final create public . public section. interfaces ZIF_EX_DOP_SATIS_BADI . protected section. private section. ENDCLASS. CLASS ZCL_IM_DOP_SATIS_IMP IMPLEMENTATION. METHOD zif_ex_dop_satis_badi~satis_dokuman_filtrele. DATA : ls_vbap TYPE vbap. LOOP AT ct_vbap INTO ls_vbap. IF ls_vbap-matnr EQ 'M-02'. DELETE ct_vbap. ENDIF. ENDLOOP. ENDMETHOD. ENDCLASS.
16.035714
54
0.739421
984676e6e95dd1f680461e8f2ed89dcc1a945ed9
40,252
abap
ABAP
src/zcl_mdg_bp_helper_staging.clas.abap
selmayalcin/ZMEDEPIA_MDG_UTILITIES
90b1c9d2deef08fcaa967281fa1f27535e8c39ac
[ "MIT" ]
null
null
null
src/zcl_mdg_bp_helper_staging.clas.abap
selmayalcin/ZMEDEPIA_MDG_UTILITIES
90b1c9d2deef08fcaa967281fa1f27535e8c39ac
[ "MIT" ]
null
null
null
src/zcl_mdg_bp_helper_staging.clas.abap
selmayalcin/ZMEDEPIA_MDG_UTILITIES
90b1c9d2deef08fcaa967281fa1f27535e8c39ac
[ "MIT" ]
null
null
null
class ZCL_MDG_BP_HELPER_STAGING definition public inheriting from ZCL_MDG_BP_HELPER final create private . public section. class-methods DESTRUCT_INSTANCE . class-methods GET_INSTANCE returning value(RO_BP_DATA) type ref to ZCL_MDG_BP_HELPER exceptions INSTANCE_CREATION_FAILED ENTITY_DATA_ALL_READ_ERROR APP_CONTEXT_GET_FAILED APPCONTEXT_ATTRIBUTE_GET_ERROR UNEXPECTED_ERROR MODEL_GET_FAILED . methods PROCESS_EXT_NUMBER_ASSIGNMENT importing !IO_CHANGED_DATA type ref to IF_USMD_DELTA_BUFFER_READ . PROTECTED SECTION. PRIVATE SECTION. DATA gt_all_changed_detail TYPE usmd_th_change_document_change . DATA gt_all_changed_value TYPE usmd_ts_change_document_value . DATA gt_change_documents TYPE zif_mdg_datatypes=>gty_t_change_document . CLASS-DATA go_instance TYPE REF TO zcl_mdg_bp_helper_staging . DATA gv_crid TYPE usmd_crequest . DATA gv_wiid TYPE sww_wiid . CLASS-DATA gv_final_status_set TYPE abap_bool . METHODS constructor EXCEPTIONS entity_data_all_read_error app_context_get_failed appcontext_attribute_get_error model_get_failed discard_instance unexpected_error . METHODS get_where_condition IMPORTING !is_record TYPE any !iv_entity TYPE usmd_entity EXPORTING !ev_where TYPE string . METHODS read_changed_documents EXPORTING !et_change_documents TYPE zif_mdg_datatypes=>gty_t_change_document !et_all_changed_detail TYPE usmd_th_change_document_change !et_all_changed_value TYPE usmd_ts_change_document_value . METHODS read_entity_data_cr EXCEPTIONS entity_data_all_read_error app_context_get_failed appcontext_attribute_get_error model_get_failed discard_instance data_not_found dyn_assignment_failed . METHODS read_active_data_of_cr IMPORTING * !iv_crequest TYPE usmd_crequest !io_model TYPE REF TO if_usmd_model_ext !it_businesspartner TYPE ANY TABLE EXPORTING !et_entity_data_act TYPE usmd_ts_data_entity . ENDCLASS. CLASS ZCL_MDG_BP_HELPER_STAGING IMPLEMENTATION. METHOD constructor. super->constructor( ). CALL METHOD read_entity_data_cr EXCEPTIONS entity_data_all_read_error = 1 app_context_get_failed = 2 appcontext_attribute_get_error = 3 model_get_failed = 4 discard_instance = 5 OTHERS = 6. IF sy-subrc <> 0. CASE sy-subrc. WHEN 1. RAISE entity_data_all_read_error. WHEN 2. RAISE app_context_get_failed. WHEN 3. RAISE appcontext_attribute_get_error. WHEN 4. RAISE model_get_failed. WHEN 5. RAISE discard_instance. WHEN OTHERS. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 000 RAISING unexpected_error. ENDCASE. ENDIF. ENDMETHOD. METHOD destruct_instance. FREE go_instance. ENDMETHOD. METHOD get_instance. DATA: lo_app_context TYPE REF TO if_usmd_app_context, lv_force_reload TYPE abap_bool, lo_crequest_util TYPE REF TO cl_usmd_crequest_util, lo_model TYPE REF TO if_usmd_model, ls_crequest TYPE usmd_s_crequest, lt_messages TYPE usmd_t_message, lv_error TYPE abap_bool, lv_bp TYPE bu_partner. FIELD-SYMBOLS: <ls_message> TYPE usmd_s_message. lv_force_reload = abap_false. CALL METHOD cl_usmd_app_context=>get_context RECEIVING eo_context = lo_app_context. IF ( lo_app_context IS BOUND AND lo_app_context->mv_crequest_id IS INITIAL ) OR lo_app_context IS NOT BOUND. lv_bp = zcl_mdg_bp_helper_utilities=>get_current_bp_from_fpm_para( ). CALL METHOD zcl_mdg_bp_helper_active=>get_instance EXPORTING iv_bp_id = lv_bp RECEIVING ro_bp_data = ro_bp_data EXCEPTIONS instance_creation_failed = 1 entity_data_all_read_error = 2 app_context_get_failed = 3 appcontext_attribute_get_error = 4 unexpected_error = 5 model_get_failed = 6 OTHERS = 7. IF sy-subrc <> 0. CASE sy-subrc. WHEN 1. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_bp TYPE 'X' NUMBER 001 RAISING entity_data_all_read_error. WHEN 2. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_br_bp TYPE 'X' NUMBER 004 RAISING app_context_get_failed. WHEN 3. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_br_bp TYPE 'X' NUMBER 004 RAISING app_context_get_failed . WHEN 4. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 001 RAISING model_get_failed. WHEN 5. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 001 RAISING instance_creation_failed. WHEN 6. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 000 RAISING unexpected_error. WHEN OTHERS. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 000 RAISING unexpected_error. ENDCASE. ENDIF. RETURN. ELSEIF go_instance IS BOUND. IF lo_app_context->mv_wi_id <> go_instance->gv_wiid OR go_instance->gv_crid <> lo_app_context->mv_crequest_id. go_instance->gv_wiid = lo_app_context->mv_wi_id. go_instance->gv_crid = lo_app_context->mv_crequest_id. lv_force_reload = abap_true. ENDIF. IF gv_final_status_set = abap_false. CREATE OBJECT lo_crequest_util. CALL METHOD cl_usmd_model=>get_instance EXPORTING i_usmd_model = if_mdg_bp_constants=>gc_bp_model IMPORTING eo_instance = lo_model et_message = lt_messages. LOOP AT lt_messages ASSIGNING <ls_message> WHERE msgty CA 'EAX'. lv_error = abap_true. EXIT. ENDLOOP. IF lv_error = abap_false. CALL METHOD lo_crequest_util->get_crequest EXPORTING id_crequest = lo_app_context->mv_crequest_id io_model = lo_model IMPORTING es_crequest = ls_crequest. IF ls_crequest IS NOT INITIAL. IF ls_crequest-usmd_creq_status = usmd0_cs_crequest_status-finally_approved OR ls_crequest-usmd_creq_status = usmd0_cs_crequest_status-finally_approved. gv_final_status_set = abap_true. lv_force_reload = abap_true. ENDIF. ENDIF. ENDIF. ENDIF. ENDIF. IF go_instance IS INITIAL OR lv_force_reload = abap_true. CREATE OBJECT go_instance TYPE zcl_mdg_bp_helper_staging EXCEPTIONS entity_data_all_read_error = 1 app_context_get_failed = 2 appcontext_attribute_get_error = 3 model_get_failed = 4 discard_instance = 5 unexpected_error = 6 OTHERS = 7. IF sy-subrc <> 0. CASE sy-subrc. WHEN 1. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_bp TYPE 'X' NUMBER 001 RAISING entity_data_all_read_error. WHEN 2. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_br_bp TYPE 'X' NUMBER 004 RAISING app_context_get_failed. WHEN 3. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_br_bp TYPE 'X' NUMBER 004 RAISING app_context_get_failed . WHEN 4. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 001 RAISING model_get_failed. WHEN 5. CALL METHOD destruct_instance. RETURN. WHEN 6. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 000 RAISING unexpected_error. WHEN OTHERS. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 000 RAISING unexpected_error. ENDCASE. ELSE. IF go_instance IS BOUND. go_instance->gv_wiid = lo_app_context->mv_wi_id. go_instance->gv_crid = lo_app_context->mv_crequest_id. ENDIF. ro_bp_data = go_instance. IF ro_bp_data IS NOT BOUND. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_gen TYPE 'X' NUMBER 002 RAISING instance_creation_failed. ENDIF. ENDIF. ELSE. ro_bp_data = go_instance. ENDIF. ENDMETHOD. METHOD get_where_condition. DATA: lt_entity_keys TYPE usmd_t_entity. FIELD-SYMBOLS: <lv_entity_key> TYPE usmd_entity, <lv_data_key> TYPE any. CLEAR ev_where. CALL METHOD get_keys_of_entity EXPORTING iv_entity = iv_entity IMPORTING et_entity_keys = lt_entity_keys. * Build where condition LOOP AT lt_entity_keys ASSIGNING <lv_entity_key>. ASSIGN COMPONENT <lv_entity_key> OF STRUCTURE is_record TO <lv_data_key>. IF sy-subrc = 0 AND <lv_data_key> IS NOT INITIAL. IF ev_where IS NOT INITIAL. CONCATENATE ev_where ' AND ' INTO ev_where RESPECTING BLANKS. ENDIF. CONCATENATE ev_where <lv_entity_key> ' = ''' <lv_data_key> '''' INTO ev_where RESPECTING BLANKS. ENDIF. ENDLOOP. ENDMETHOD. METHOD process_ext_number_assignment. DATA: lr_data_upd_bp_header TYPE REF TO data, lr_data_upd_bp_cntrl TYPE REF TO data, lr_entity_data_struc TYPE REF TO data, lr_entity_data_table TYPE REF TO data, lv_is_tmp_key TYPE usmd_flg, lr_entity TYPE REF TO data, lt_bp_header TYPE zif_mdg_bp_datatypes=>gty_t_bp_header, lt_bp_rel TYPE zif_mdg_bp_datatypes=>gty_t_bp_rel, lv_main_bp TYPE bu_partner, lt_entity_keys TYPE usmd_t_entity, lv_where TYPE string. FIELD-SYMBOLS: <lt_data_upd_bp_header> TYPE SORTED TABLE, <ls_data_upd_bp_header> TYPE any, <lt_data_upd_bp_cntrl> TYPE SORTED TABLE, <lv_bp_header> TYPE any, <lv_entity> TYPE usmd_entity, <lt_entity> TYPE SORTED TABLE, <ls_entity> TYPE any, <lt_entity_exchg_new> TYPE SORTED TABLE, <ls_entity_exchg_new> TYPE any, <lv_bp_header_exchg_key> TYPE any, <ls_bp_header> TYPE /mdgbp/_s_bp_pp_bp_header. * get header data CALL METHOD io_changed_data->read_data EXPORTING i_entity = if_mdg_bp_constants~gc_bp_model_entity-bp i_struct = if_usmd_model_ext=>gc_struct_key_attr IMPORTING er_t_data_upd = lr_data_upd_bp_header. UNASSIGN <lt_data_upd_bp_header>. ASSIGN lr_data_upd_bp_header->* TO <lt_data_upd_bp_header>. * get central data CALL METHOD io_changed_data->read_data EXPORTING i_entity = if_mdg_bp_constants~gc_bp_model_entity-central i_struct = if_usmd_model_ext=>gc_struct_key_attr IMPORTING er_t_data_upd = lr_data_upd_bp_cntrl. UNASSIGN <lt_data_upd_bp_cntrl>. ASSIGN lr_data_upd_bp_cntrl->* TO <lt_data_upd_bp_cntrl>. * check if specific case is triggered (update of centrl and header at once) IF <lt_data_upd_bp_header> IS ASSIGNED AND <lt_data_upd_bp_cntrl> IS ASSIGNED. READ TABLE <lt_data_upd_bp_header> ASSIGNING <ls_data_upd_bp_header> INDEX 1. ASSIGN COMPONENT if_mdg_bp_constants~gc_field-bp_header OF STRUCTURE <ls_data_upd_bp_header> TO <lv_bp_header>. IF <lv_bp_header> IS ASSIGNED. "only process if tempory key was provided before CALL METHOD go_model->is_temporary_key EXPORTING i_fieldname = if_mdg_bp_constants~gc_field-bp_header is_key = <ls_data_upd_bp_header> RECEIVING ef_temporary = lv_is_tmp_key. IF lv_is_tmp_key = abap_false. " get additional entities to identfy previous key CALL METHOD get_bp_header IMPORTING et_bp_header = lt_bp_header. CALL METHOD get_bp_rel IMPORTING et_bp_rel = lt_bp_rel. LOOP AT lt_bp_header ASSIGNING <ls_bp_header>. READ TABLE lt_bp_rel WITH KEY partner2 = <ls_bp_header>-bp_header TRANSPORTING NO FIELDS. "#EC CI_SORTSEQ IF sy-subrc <> 0. "that's the key lv_main_bp = <ls_bp_header>-bp_header. EXIT. ENDIF. ENDLOOP. " check if extnumber is already assigned --> skip IF <lv_bp_header> = lv_main_bp. RETURN. ENDIF. " drop all entries based on previous key LOOP AT get_all_entities( ) ASSIGNING <lv_entity>. CLEAR: lv_where. CALL METHOD get_keys_of_entity EXPORTING iv_entity = <lv_entity> IMPORTING et_entity_keys = lt_entity_keys. " consider use of different key name in serveral entities READ TABLE lt_entity_keys WITH KEY table_line = if_mdg_bp_constants~gc_field-bp_header TRANSPORTING NO FIELDS ##WARN_OK. IF sy-subrc = 0. CONCATENATE 'BP_HEADER = ' '''' lv_main_bp '''' INTO lv_where RESPECTING BLANKS. ELSE. READ TABLE lt_entity_keys WITH KEY table_line = if_mdg_bp_constants~gc_field-partner1 TRANSPORTING NO FIELDS ##WARN_OK. IF sy-subrc = 0. CONCATENATE 'PARTNER1 = ' '''' lv_main_bp '''' INTO lv_where RESPECTING BLANKS. ELSE. "if key is not available --> proceed with next CONTINUE. ENDIF. ENDIF. " fetch table and execute DELETE to drop old key entries CALL METHOD get_entity_reference EXPORTING iv_entity = <lv_entity> IMPORTING er_entity = lr_entity. IF lr_entity IS NOT BOUND. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_bp TYPE 'X' NUMBER 003 INTO zcl_mdg_general_functions=>gv_error_message. ENDIF. " for all entites, exchange the temporary key with the external number ASSIGN lr_entity->* TO <lt_entity>. IF <lt_entity> IS ASSIGNED AND <lt_entity> IS NOT INITIAL. CREATE DATA lr_entity_data_table LIKE <lt_entity>. ASSIGN lr_entity_data_table->* TO <lt_entity_exchg_new>. LOOP AT <lt_entity> ASSIGNING <ls_entity>. "#EC CI_NESTED " create empty structure of same type and move all data into it CREATE DATA lr_entity_data_struc LIKE LINE OF <lt_entity>. ASSIGN lr_entity_data_struc->* TO <ls_entity_exchg_new>. MOVE-CORRESPONDING <ls_entity> TO <ls_entity_exchg_new>. " exchange BP number with new external number ASSIGN COMPONENT 'BP_HEADER' OF STRUCTURE <ls_entity_exchg_new> TO <lv_bp_header_exchg_key>. IF sy-subrc = 0. <lv_bp_header_exchg_key> = <lv_bp_header>. ELSE. ASSIGN COMPONENT 'PARTNER1' OF STRUCTURE <ls_entity_exchg_new> TO <lv_bp_header_exchg_key>. IF sy-subrc = 0. <lv_bp_header_exchg_key> = <lv_bp_header>. ELSE. CONTINUE. ENDIF. ENDIF. " insert entity into temporary table INSERT <ls_entity_exchg_new> INTO TABLE <lt_entity_exchg_new>. ENDLOOP. " delete all old entries and insert new DELETE <lt_entity> WHERE (lv_where). IF sy-subrc = 0. INSERT LINES OF <lt_entity_exchg_new> INTO TABLE <lt_entity>. ENDIF. ENDIF. ENDLOOP. ENDIF. ENDIF. ENDIF. ENDMETHOD. METHOD read_active_data_of_cr. DATA: ls_bp_rel_sel TYPE usmd_s_sel, lt_bp_rel1_sel TYPE usmd_ts_sel, lt_bp_rel2_sel TYPE usmd_ts_sel, ls_sel TYPE usmd_s_sel, lt_sel TYPE usmd_ts_sel, lt_entity_data_act TYPE usmd_ts_data_entity. FIELD-SYMBOLS: <lv_bp> TYPE bu_partner, <ls_data_bp_rel_all> TYPE usmd_sx_data_entity, <lv_partner1> TYPE any, <lv_partner2> TYPE any, <lt_bp_rel_data> TYPE ANY TABLE, <ls_bp_rel_data> TYPE any, <ls_entity_data_act_tmp> TYPE usmd_sx_data_entity, <ls_entity_data_act> TYPE usmd_sx_data_entity, <lt_data_tmp> TYPE ANY TABLE, <ls_data_tmp> TYPE any, <lt_data_act> TYPE ANY TABLE. CLEAR et_entity_data_act. LOOP AT it_businesspartner ASSIGNING <lv_bp>. ##GEN_OK ls_sel-fieldname = if_mdg_bp_constants~gc_field-bp_header. ls_sel-sign = usmd0_cs_ra-sign_i. ls_sel-option = usmd0_cs_ra-option_eq. ls_sel-low = <lv_bp>. INSERT ls_sel INTO TABLE lt_sel. " get BP_REL data ls_bp_rel_sel-sign = usmd0_cs_ra-sign_i. ls_bp_rel_sel-option = usmd0_cs_ra-option_eq. ls_bp_rel_sel-low = <lv_bp>. " get BP_REL data of partner 1 into active data ls_bp_rel_sel-fieldname = if_mdg_bp_constants~gc_field-partner1. INSERT ls_bp_rel_sel INTO TABLE lt_bp_rel1_sel. " get BP_REL data of partner 2 into active data ls_bp_rel_sel-fieldname = if_mdg_bp_constants~gc_field-partner2. INSERT ls_bp_rel_sel INTO TABLE lt_bp_rel2_sel. ENDLOOP. "Read BP_REL active data of partner 1 IF lt_bp_rel1_sel IS NOT INITIAL. CALL METHOD io_model->read_entity_data_all EXPORTING i_fieldname = if_mdg_bp_constants~gc_field-bp_rel if_active = abap_true it_sel = lt_bp_rel1_sel IMPORTING et_data_entity = lt_entity_data_act. ENDIF. INSERT LINES OF lt_entity_data_act INTO TABLE et_entity_data_act. * APPEND LINES OF lt_entity_data_act TO lt_entity_data_bprel. CLEAR lt_entity_data_act. "Read BP_REL active data of partner 2 IF lt_bp_rel2_sel IS NOT INITIAL. CALL METHOD io_model->read_entity_data_all EXPORTING i_fieldname = if_mdg_bp_constants~gc_field-bp_rel if_active = abap_true it_sel = lt_bp_rel2_sel IMPORTING et_data_entity = lt_entity_data_act. ENDIF. *merge BP_REL data of partner 2 and all active data LOOP AT lt_entity_data_act ASSIGNING <ls_entity_data_act_tmp>. UNASSIGN <ls_entity_data_act>. READ TABLE et_entity_data_act ASSIGNING <ls_entity_data_act> WITH TABLE KEY usmd_entity = <ls_entity_data_act_tmp>-usmd_entity usmd_entity_cont = <ls_entity_data_act_tmp>-usmd_entity_cont struct = <ls_entity_data_act_tmp>-struct. IF <ls_entity_data_act> IS ASSIGNED. ASSIGN <ls_entity_data_act_tmp>-r_t_data->* TO <lt_data_tmp>. ASSIGN <ls_entity_data_act>-r_t_data->* TO <lt_data_act>. LOOP AT <lt_data_tmp> ASSIGNING <ls_data_tmp>. "#EC CI_NESTED INSERT <ls_data_tmp> INTO TABLE <lt_data_act>. ENDLOOP. ELSE. INSERT <ls_entity_data_act_tmp> INTO TABLE et_entity_data_act. ENDIF. ENDLOOP. * re-load the data of the related BP LOOP AT et_entity_data_act ASSIGNING <ls_data_bp_rel_all> WHERE usmd_entity = if_mdg_bp_constants~gc_bp_model_entity-relation AND usmd_entity_cont IS INITIAL. UNASSIGN: <lt_bp_rel_data>, <ls_bp_rel_data>, <lv_partner1>, <lv_partner2>. CLEAR ls_sel-low. ASSIGN <ls_data_bp_rel_all>-r_t_data->* TO <lt_bp_rel_data>. LOOP AT <lt_bp_rel_data> ASSIGNING <ls_bp_rel_data>. "#EC CI_NESTED "partner 1 ASSIGN COMPONENT if_mdg_bp_constants~gc_field-partner1 OF STRUCTURE <ls_bp_rel_data> TO <lv_partner1>. IF <lv_partner1> IS ASSIGNED AND <lv_partner1> IS NOT INITIAL. READ TABLE lt_sel WITH KEY low = <lv_partner1> TRANSPORTING NO FIELDS. "#EC CI_SORTSEQ IF sy-subrc NE 0. ls_sel-low = <lv_partner1>. INSERT ls_sel INTO TABLE lt_sel. ENDIF. ENDIF. "partner 2 ASSIGN COMPONENT if_mdg_bp_constants~gc_field-partner2 OF STRUCTURE <ls_bp_rel_data> TO <lv_partner2>. IF <lv_partner2> IS ASSIGNED AND <lv_partner2> IS NOT INITIAL. READ TABLE lt_sel WITH KEY low = <lv_partner2> TRANSPORTING NO FIELDS. "#EC CI_SORTSEQ IF sy-subrc NE 0. ls_sel-low = <lv_partner2>. INSERT ls_sel INTO TABLE lt_sel. ENDIF. ENDIF. ENDLOOP. ENDLOOP. CLEAR: lt_entity_data_act. "Read active data of main BP IF lt_sel IS NOT INITIAL. CALL METHOD io_model->read_entity_data_all EXPORTING i_fieldname = if_mdg_bp_constants~gc_field-bp_header if_active = abap_true it_sel = lt_sel IMPORTING et_data_entity = lt_entity_data_act. ENDIF. INSERT LINES OF lt_entity_data_act INTO TABLE et_entity_data_act. ENDMETHOD. METHOD read_changed_documents. TYPES: BEGIN OF ty_s_tab, field(50), END OF ty_s_tab. DATA: lo_adapter TYPE REF TO if_usmd_chg_doc_adapter, lt_change_request_id TYPE cl_usmd_mdf_change_document=>t_change_request, lt_document_header TYPE cl_usmd_mdf_change_document=>t_document_header, lt_changed_value TYPE usmd_ts_change_document_value, lt_changed_detail TYPE usmd_th_change_document_change, lt_compound_value TYPE usmd_ts_change_document_value, lt_message TYPE usmd_t_message, ls_change_document TYPE zif_mdg_datatypes=>gty_s_change_document, lt_tab TYPE TABLE OF ty_s_tab, lv_line TYPE i, lv_field TYPE string, lv_crequest TYPE usmd_crequest, lo_app_context TYPE REF TO if_usmd_app_context. CLEAR:et_change_documents,et_all_changed_detail,et_all_changed_value. FIELD-SYMBOLS: <ls_docu_header> TYPE if_usmd_chg_doc_adapter_type=>s_document_header, <ls_changed_detail> TYPE usmd_s_change_document_change. lo_app_context = cl_usmd_app_context=>get_context( ). lo_app_context->get_attributes( IMPORTING ev_crequest_id = lv_crequest ). IF gt_change_documents IS INITIAL. cl_usmd_adapter_provider=>get_chg_document_adapter( EXPORTING i_usmd_model = zcl_mdg_bp_helper=>if_mdg_bp_constants~gc_bp_model IMPORTING eo_chg_doc_adapter = lo_adapter ). IF lo_adapter IS NOT BOUND OR lv_crequest IS INITIAL. RETURN. ENDIF. * Read change document header data INSERT lv_crequest INTO TABLE lt_change_request_id. lo_adapter->read_document_header( EXPORTING it_crequest = lt_change_request_id IMPORTING et_document_header = lt_document_header ). * Read change document position data LOOP AT lt_document_header ASSIGNING <ls_docu_header>. lo_adapter->read_document_lines( EXPORTING is_document_header = <ls_docu_header> IMPORTING et_changed_value = lt_changed_value et_changed_detail = lt_changed_detail et_compound_value = lt_compound_value et_message = lt_message ). CLEAR: ls_change_document-changed_value, ls_change_document-compound_value, ls_change_document-message, ls_change_document-changed_details. APPEND LINES OF: lt_changed_value TO ls_change_document-changed_value, lt_compound_value TO ls_change_document-compound_value, lt_message TO ls_change_document-message. INSERT LINES OF lt_changed_detail INTO TABLE ls_change_document-changed_details. * MDG API returns text with table name, extract the table name from relationship details. LOOP AT lt_changed_detail ASSIGNING <ls_changed_detail>. "#EC CI_NESTED SPLIT <ls_changed_detail>-table AT space INTO TABLE lt_tab. DESCRIBE TABLE lt_tab LINES lv_line. READ TABLE lt_tab TRANSPORTING ALL FIELDS INTO lv_field INDEX lv_line. IF sy-subrc = 0. <ls_changed_detail>-table = lv_field. ENDIF. INSERT <ls_changed_detail> INTO TABLE et_all_changed_detail. ENDLOOP. APPEND LINES OF lt_changed_value TO et_all_changed_value. APPEND ls_change_document TO et_change_documents. ENDLOOP. gt_change_documents = et_change_documents. gt_all_changed_detail = et_all_changed_detail. gt_all_changed_value = et_all_changed_value. ELSE. et_change_documents = gt_change_documents. et_all_changed_detail = gt_all_changed_detail. et_all_changed_value = gt_all_changed_value. ENDIF. ENDMETHOD. METHOD read_entity_data_cr. TYPES: BEGIN OF ty_s_usmd1222, entity_type TYPE usmd_entity, entity_key TYPE usmd_entity_key_hash, entity_key_string TYPE usmd_entity_key_string, END OF ty_s_usmd1222, ty_t_usmd1222 TYPE SORTED TABLE OF ty_s_usmd1222 WITH UNIQUE KEY entity_type entity_key. CONSTANTS: lc_prefix TYPE string VALUE 'GT_', lc_suffix_text TYPE string VALUE '_TXT'. DATA: lt_key_all TYPE usmd_ts_entity_data, lo_context TYPE REF TO if_usmd_app_context, lo_model TYPE REF TO if_usmd_model_ext, lt_entity_data TYPE usmd_ts_data_entity, lt_entity_data_act TYPE usmd_ts_data_entity, ls_entity_data_act TYPE usmd_sx_data_entity, lt_data_entity_bp_ad TYPE usmd_ts_data_entity, lt_data_entity_bp_rel TYPE usmd_ts_data_entity, * lt_message TYPE usmd_t_message, ##NEEDED lv_entity TYPE usmd_entity, lv_fieldname TYPE usmd_fieldname, lr_entity_key_struc TYPE REF TO data, lr_entity_key_struc_1222 TYPE REF TO data, lo_key_conv TYPE REF TO if_usmd_key_conversion, lt_usmd1222 TYPE ty_t_usmd1222, lv_is_parallel TYPE boolean, lt_businesspartner TYPE TABLE OF bu_partner, lv_found TYPE boolean, lv_updated TYPE boolean, lr_entity TYPE REF TO data, lv_entity_tabname TYPE seocpdname. FIELD-SYMBOLS: <ls_usmd1222> TYPE ty_s_usmd1222, <ls_entity_data> TYPE usmd_sx_data_entity, <ls_entity_data_act> TYPE usmd_sx_data_entity, <lt_entity> TYPE ANY TABLE, <lt_entity_act> TYPE ANY TABLE, <ls_entity> TYPE any, <ls_entity_act> TYPE any, <ls_entity_key_struc> TYPE any, <ls_entity_key_struc_1222> TYPE any, <lt_data> TYPE ANY TABLE, <lt_mt_entity> TYPE SORTED TABLE, <ls_key_all> TYPE usmd_sx_entity_data, <lt_key> TYPE ANY TABLE. CALL METHOD cl_usmd_app_context=>get_context RECEIVING eo_context = lo_context. IF lo_context IS NOT BOUND. RAISE app_context_get_failed. ENDIF. *Get Model Instance and CR ID from the aplication context CALL METHOD lo_context->get_attributes IMPORTING eo_model = lo_model. IF lo_model IS NOT BOUND. RAISE appcontext_attribute_get_error. ENDIF. "Set key fields: CR ID, WI ID, Final status me->gv_crid = lo_context->mv_crequest_id. me->gv_wiid = lo_context->mv_wi_id. IF cl_usmd_crequest_util=>is_crequest_closed( i_crequest_status = cl_usmd_crequest_util=>get_cr_status_by_cr( i_crequest = lo_context->mv_crequest_id ) ). me->gv_final_status_set = abap_true. ENDIF. * Get all business partner in CR CALL METHOD lo_model->get_cr_objectlist EXPORTING i_crequest = lo_context->mv_crequest_id IMPORTING et_key_all = lt_key_all. READ TABLE lt_key_all ASSIGNING <ls_key_all> WITH TABLE KEY entity = if_mdg_bp_constants~gc_field-bp_header. IF sy-subrc IS INITIAL. ASSIGN <ls_key_all>-r_data->* TO <lt_key>. lt_businesspartner = <lt_key>. ELSE. RETURN. ENDIF. IF me->gv_final_status_set EQ abap_false. *read all BP entity DATA from staging area CALL METHOD lo_model->read_entity_data_all EXPORTING i_fieldname = if_mdg_bp_constants~gc_field-bp_header i_crequest = lo_context->mv_crequest_id if_active = abap_false IMPORTING * et_message = lt_message et_data_entity = lt_entity_data. * special handling for entity bp_rel CALL METHOD lo_model->read_entity_data_all EXPORTING i_fieldname = 'BP_REL' i_crequest = lo_context->mv_crequest_id if_active = abap_false IMPORTING * et_message = lt_message et_data_entity = lt_data_entity_bp_rel. INSERT LINES OF lt_data_entity_bp_rel INTO TABLE lt_entity_data. * Special handling for entity ADDRNO CALL METHOD lo_model->read_entity_data_all EXPORTING i_fieldname = 'ADDRNO' i_crequest = lo_context->mv_crequest_id if_active = abap_false IMPORTING * et_message = lt_message et_data_entity = lt_data_entity_bp_ad. INSERT LINES OF lt_data_entity_bp_ad INTO TABLE lt_entity_data. ELSE. CALL METHOD read_active_data_of_cr EXPORTING * iv_crequest = lo_context->mv_crequest_id io_model = lo_model it_businesspartner = lt_businesspartner IMPORTING et_entity_data_act = lt_entity_data. ENDIF. "If we have a CR type that has parallel processing enabled we have to remove changes from other CRs CALL METHOD cl_usmd2_cust_access_service=>is_parallel_cr_type EXPORTING iv_creq_type = lo_context->mv_crequest_type RECEIVING rv_is_parallel = lv_is_parallel. IF lv_is_parallel EQ abap_true. SELECT entity_type entity_key entity_key_string FROM usmd1222 "#EC CI_SUBRC INTO TABLE lt_usmd1222 WHERE crequest_id EQ lo_context->mv_crequest_id. "Get active data CALL METHOD read_active_data_of_cr EXPORTING * iv_crequest = lo_context->mv_crequest_id io_model = lo_model it_businesspartner = lt_businesspartner IMPORTING et_entity_data_act = lt_entity_data_act. CALL METHOD cl_usmd_key_conversion=>get_instance RECEIVING ro_key_conversion = lo_key_conv. LOOP AT lt_usmd1222 ASSIGNING <ls_usmd1222>. lv_entity = <ls_usmd1222>-entity_type. lv_fieldname = lv_entity. CALL METHOD lo_model->create_data_reference EXPORTING i_fieldname = lv_fieldname i_struct = lo_model->gc_struct_key if_table = abap_false IMPORTING er_data = lr_entity_key_struc_1222. ASSIGN lr_entity_key_struc_1222->* TO <ls_entity_key_struc_1222>. CALL METHOD lo_model->create_data_reference EXPORTING i_fieldname = lv_fieldname i_struct = lo_model->gc_struct_key if_table = abap_false IMPORTING er_data = lr_entity_key_struc. ASSIGN lr_entity_key_struc->* TO <ls_entity_key_struc>. "Get key of change CALL METHOD lo_key_conv->string_tech_2_entity_key EXPORTING iv_key_string = <ls_usmd1222>-entity_key_string IMPORTING ev_entity_type = lv_entity es_entity_key = <ls_entity_key_struc_1222>. "Get the corresponding inactive data UNASSIGN <ls_entity_data>. READ TABLE lt_entity_data ASSIGNING <ls_entity_data> WITH KEY usmd_entity = if_mdg_bp_constants~gc_field-bp_header usmd_entity_cont = lv_entity. IF sy-subrc IS NOT INITIAL. READ TABLE lt_entity_data ASSIGNING <ls_entity_data> WITH KEY usmd_entity = lv_entity usmd_entity_cont = space. ENDIF. IF <ls_entity_data> IS ASSIGNED. ASSIGN <ls_entity_data>-r_t_data->* TO <lt_entity>. lv_found = abap_false. LOOP AT <lt_entity> ASSIGNING <ls_entity>. "#EC CI_NESTED MOVE-CORRESPONDING <ls_entity> TO <ls_entity_key_struc>. IF <ls_entity_key_struc> EQ <ls_entity_key_struc_1222>. lv_found = abap_true. EXIT. ENDIF. ENDLOOP. "If found replace the act data with inact data "If NOT found we have a deletion -> remove from active data IF lv_found EQ abap_true. "Update or Insert UNASSIGN <ls_entity_data_act>. READ TABLE lt_entity_data_act ASSIGNING <ls_entity_data_act> WITH KEY usmd_entity = if_mdg_bp_constants~gc_field-bp_header usmd_entity_cont = lv_entity. IF sy-subrc IS NOT INITIAL. READ TABLE lt_entity_data_act ASSIGNING <ls_entity_data_act> WITH KEY usmd_entity = lv_entity usmd_entity_cont = space. ENDIF. IF <ls_entity_data_act> IS ASSIGNED. "Update lv_updated = abap_false. ASSIGN <ls_entity_data_act>-r_t_data->* TO <lt_entity_act>. LOOP AT <lt_entity_act> ASSIGNING <ls_entity_act>. "#EC CI_NESTED MOVE-CORRESPONDING <ls_entity_act> TO <ls_entity_key_struc>. IF <ls_entity_key_struc> EQ <ls_entity_key_struc_1222>. DELETE TABLE <lt_entity_act> FROM <ls_entity_act>. "#EC CI_ANYSEQ INSERT <ls_entity> INTO TABLE <lt_entity_act>. lv_updated = abap_true. EXIT. ENDIF. ENDLOOP. IF lv_updated EQ abap_false. "Insert new entry INSERT <ls_entity> INTO TABLE <lt_entity_act>. ENDIF. ELSE. "Insert CLEAR ls_entity_data_act. ls_entity_data_act-struct = <ls_entity_data>-struct. ls_entity_data_act-usmd_entity = <ls_entity_data>-usmd_entity. ls_entity_data_act-usmd_entity_cont = <ls_entity_data>-usmd_entity_cont. CREATE DATA ls_entity_data_act-r_t_data LIKE <lt_entity>. ASSIGN ls_entity_data_act-r_t_data->* TO <lt_entity_act>. INSERT <ls_entity> INTO TABLE <lt_entity_act>. INSERT ls_entity_data_act INTO TABLE lt_entity_data_act. ENDIF. ELSE. "delete UNASSIGN <ls_entity_data_act>. READ TABLE lt_entity_data_act ASSIGNING <ls_entity_data_act> WITH KEY usmd_entity = if_mdg_bp_constants~gc_field-bp_header usmd_entity_cont = lv_entity. IF sy-subrc IS NOT INITIAL. READ TABLE lt_entity_data_act ASSIGNING <ls_entity_data_act> WITH KEY usmd_entity = lv_entity usmd_entity_cont = space. ENDIF. IF <ls_entity_data_act> IS ASSIGNED. ASSIGN <ls_entity_data_act>-r_t_data->* TO <lt_entity_act>. LOOP AT <lt_entity_act> ASSIGNING <ls_entity_act>. "#EC CI_NESTED MOVE-CORRESPONDING <ls_entity_act> TO <ls_entity_key_struc>. IF <ls_entity_key_struc> EQ <ls_entity_key_struc_1222>. DELETE TABLE <lt_entity_act> FROM <ls_entity_act>. "#EC CI_ANYSEQ ENDIF. ENDLOOP. ENDIF. "IF <ls_entity_data_act> IS ASSIGNED. ENDIF. ELSE. "Delete UNASSIGN <ls_entity_data_act>. READ TABLE lt_entity_data_act ASSIGNING <ls_entity_data_act> WITH KEY usmd_entity = if_mdg_bp_constants~gc_field-bp_header usmd_entity_cont = lv_entity. IF sy-subrc IS NOT INITIAL. READ TABLE lt_entity_data_act ASSIGNING <ls_entity_data_act> WITH KEY usmd_entity = lv_entity usmd_entity_cont = space. ENDIF. IF <ls_entity_data_act> IS ASSIGNED. ASSIGN <ls_entity_data_act>-r_t_data->* TO <lt_entity_act>. LOOP AT <lt_entity_act> ASSIGNING <ls_entity_act>. "#EC CI_NESTED MOVE-CORRESPONDING <ls_entity_act> TO <ls_entity_key_struc>. IF <ls_entity_key_struc> EQ <ls_entity_key_struc_1222>. DELETE TABLE <lt_entity_act> FROM <ls_entity_act>. "#EC CI_ANYSEQ ENDIF. ENDLOOP. ENDIF."IF <ls_entity_data_act> IS ASSIGNED. ENDIF. ENDLOOP. lt_entity_data = lt_entity_data_act. ENDIF. "IF lv_is_parallel EQ abap_true. "Now we have gathered the correct data "It has to be stored in the GTs * Transform untyped to typed data LOOP AT lt_entity_data ASSIGNING <ls_entity_data>. CLEAR: lv_entity_tabname, lr_entity. UNASSIGN: <ls_entity>, <lt_data>, <lt_mt_entity>. * Construct export table name and assign it to field symbol (it's used to fill the related mt) CASE <ls_entity_data>-struct. WHEN if_usmd_model_ext=>gc_struct_key_attr. IF <ls_entity_data>-usmd_entity_cont IS INITIAL. CONCATENATE lc_prefix <ls_entity_data>-usmd_entity INTO lv_entity_tabname. ELSE. CONCATENATE lc_prefix <ls_entity_data>-usmd_entity_cont INTO lv_entity_tabname. ENDIF. WHEN if_usmd_model_ext=>gc_struct_key_txt_langu. IF <ls_entity_data>-usmd_entity_cont IS INITIAL. CONCATENATE lc_prefix <ls_entity_data>-usmd_entity lc_suffix_text INTO lv_entity_tabname. ELSE. CONCATENATE lc_prefix <ls_entity_data>-usmd_entity_cont lc_suffix_text INTO lv_entity_tabname. ENDIF. ENDCASE. * write data to gt_* tables ASSIGN (lv_entity_tabname) TO <lt_mt_entity>. "#EC CI_SUBRC IF <lt_mt_entity> IS NOT ASSIGNED. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_bp TYPE 'X' NUMBER 002 WITH lv_entity_tabname. RAISE dyn_assignment_failed. ENDIF. CREATE DATA lr_entity LIKE LINE OF <lt_mt_entity>. ASSIGN lr_entity->* TO <ls_entity>. IF <ls_entity> IS NOT ASSIGNED. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_bp TYPE 'X' NUMBER 002 WITH lv_entity_tabname. RAISE dyn_assignment_failed. ENDIF. CLEAR: <ls_entity>, <lt_mt_entity>. ASSIGN <ls_entity_data>-r_t_data->* TO <lt_data>. IF sy-subrc <> 0. MESSAGE ID zcl_mdg_general_functions=>gc_msg_class_dm_bp TYPE 'X' NUMBER 002 WITH lv_entity_tabname. RAISE dyn_assignment_failed. ENDIF. IF <lt_data> IS ASSIGNED. MOVE-CORRESPONDING <lt_data> TO <lt_mt_entity>. ENDIF. ENDLOOP. ENDMETHOD. ENDCLASS.
37.689139
164
0.643024
9846920244cbc976bef787e3e807122bac24a762
3,154
abap
ABAP
src/objects/zcl_abapgit_object_g4bs.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/objects/zcl_abapgit_object_g4bs.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/objects/zcl_abapgit_object_g4bs.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
CLASS zcl_abapgit_object_g4bs 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 . METHODS get_field_rules RETURNING VALUE(ro_result) TYPE REF TO zif_abapgit_field_rules. ENDCLASS. CLASS zcl_abapgit_object_g4bs IMPLEMENTATION. METHOD get_field_rules. ro_result = zcl_abapgit_field_rules=>create( ). ro_result->add( iv_table = '/IWBEP/I_V4_MSRV' iv_field = 'CREATED_BY' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user )->add( iv_table = '/IWBEP/I_V4_MSRV' iv_field = 'CHANGED_BY' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user )->add( iv_table = '/IWBEP/I_V4_MSRV' iv_field = 'CREATED_TS' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp )->add( iv_table = '/IWBEP/I_V4_MSRV' iv_field = 'CHANGED_TS' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp )->add( iv_table = '/IWBEP/I_V4_MSRT' iv_field = 'CREATED_BY' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user )->add( iv_table = '/IWBEP/I_V4_MSRT' iv_field = 'CHANGED_BY' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user )->add( iv_table = '/IWBEP/I_V4_MSRT' iv_field = 'CREATED_TS' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp )->add( iv_table = '/IWBEP/I_V4_MSRT' iv_field = 'CHANGED_TS' iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp ). ENDMETHOD. METHOD get_generic. CREATE OBJECT ro_generic EXPORTING io_field_rules = get_field_rules( ) 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( iv_package ). 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.
21.751724
70
0.688015
98501f42269f2e196a31071f99433df15af768ea
18,691
abap
ABAP
src/objects/zcl_abapgit_object_bdef.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
2
2020-11-17T10:39:56.000Z
2021-02-25T09:31:47.000Z
src/objects/zcl_abapgit_object_bdef.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
37
2021-06-01T05:57:18.000Z
2022-03-01T05:02:10.000Z
src/objects/zcl_abapgit_object_bdef.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_bdef 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 RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. DATA mi_persistence TYPE REF TO if_wb_object_persist . DATA mi_wb_object_operator TYPE REF TO object . DATA mv_behaviour_definition_key TYPE seu_objkey . DATA mr_behaviour_definition TYPE REF TO data . METHODS clear_fields CHANGING !cs_metadata TYPE any . METHODS clear_field IMPORTING !iv_fieldname TYPE csequence CHANGING !cs_metadata TYPE any . METHODS get_transport_req_if_needed IMPORTING !iv_package TYPE devclass RETURNING VALUE(rv_transport_request) TYPE trkorr RAISING zcx_abapgit_exception . METHODS get_wb_object_operator RETURNING VALUE(ri_wb_object_operator) TYPE REF TO object RAISING zcx_abapgit_exception . METHODS merge_object_data IMPORTING !io_object_data TYPE REF TO object RETURNING VALUE(ro_object_data_merged) TYPE REF TO if_wb_object_data_model RAISING zcx_abapgit_exception . METHODS get_object_data IMPORTING !io_xml TYPE REF TO zif_abapgit_xml_input RETURNING VALUE(ro_object_data) TYPE REF TO if_wb_object_data_model RAISING zcx_abapgit_exception . ENDCLASS. CLASS zcl_abapgit_object_bdef IMPLEMENTATION. METHOD clear_field. FIELD-SYMBOLS: <lv_value> TYPE data. ASSIGN COMPONENT iv_fieldname OF STRUCTURE cs_metadata TO <lv_value>. ASSERT sy-subrc = 0. CLEAR: <lv_value>. ENDMETHOD. METHOD clear_fields. FIELD-SYMBOLS: <lv_links> TYPE ANY TABLE. FIELD-SYMBOLS: <lv_value> TYPE data. FIELD-SYMBOLS <ls_item> TYPE any. clear_field( EXPORTING iv_fieldname = 'VERSION' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'CREATED_AT' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'CREATED_BY' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'CHANGED_AT' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'CHANGED_BY' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'RESPONSIBLE' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'PACKAGE_REF' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'CONTAINER_REF' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MASTER_SYSTEM' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-CHANGED_AT' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-CHANGED_BY' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-CREATED_AT' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-CREATED_BY' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-RESPONSIBLE' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-PACKAGE_REF' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-CONTAINER_REF' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'MAIN_OBJECT-MASTER_SYSTEM' CHANGING cs_metadata = cs_metadata ). clear_field( EXPORTING iv_fieldname = 'SYNTAX_CONFIGURATION' CHANGING cs_metadata = cs_metadata ). ASSIGN COMPONENT 'LINKS' OF STRUCTURE cs_metadata TO <lv_links>. ASSERT sy-subrc = 0. LOOP AT <lv_links> ASSIGNING <ls_item>. ASSIGN COMPONENT 'COMMON_ATTRIBUTES' OF STRUCTURE <ls_item> TO <lv_value>. ASSERT sy-subrc = 0. CLEAR: <lv_value>. ENDLOOP. ENDMETHOD. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). mv_behaviour_definition_key = ms_item-obj_name. TRY. CREATE DATA mr_behaviour_definition TYPE ('CL_BLUE_SOURCE_OBJECT_DATA=>TY_OBJECT_DATA'). CREATE OBJECT mi_persistence TYPE ('CL_BDEF_OBJECT_PERSIST'). CATCH cx_sy_create_error. zcx_abapgit_exception=>raise( |BDEF not supported by your NW release| ). ENDTRY. ENDMETHOD. METHOD get_object_data. DATA: lr_metadata TYPE REF TO data, lr_data TYPE REF TO data. FIELD-SYMBOLS: <lv_metadata_node> TYPE any, <ls_metadata> TYPE any, <lv_source> TYPE any, <lg_data> TYPE any. CREATE DATA lr_data TYPE ('CL_BLUE_SOURCE_OBJECT_DATA=>TY_OBJECT_DATA'). ASSIGN lr_data->* TO <lg_data>. ASSERT sy-subrc = 0. ASSIGN COMPONENT 'METADATA' OF STRUCTURE <lg_data> TO <lv_metadata_node>. ASSERT sy-subrc = 0. CREATE DATA lr_metadata TYPE ('IF_ADT_TOOLS_CORE_SOURCE_TYPES=>TY_ABAP_SOURCE_MAIN_OBJECT'). ASSIGN lr_metadata->* TO <ls_metadata>. ASSERT sy-subrc = 0. io_xml->read( EXPORTING iv_name = 'BDEF' CHANGING cg_data = <ls_metadata> ). <lv_metadata_node> = <ls_metadata>. ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <lg_data> TO <lv_source>. ASSERT sy-subrc = 0. <lv_source> = mo_files->read_string( 'asbdef' ). CREATE OBJECT ro_object_data TYPE ('CL_BLUE_SOURCE_OBJECT_DATA'). ro_object_data->set_data( p_data = <lg_data> ). ENDMETHOD. METHOD get_transport_req_if_needed. DATA: li_sap_package TYPE REF TO zif_abapgit_sap_package. li_sap_package = zcl_abapgit_factory=>get_sap_package( iv_package ). IF li_sap_package->are_changes_recorded_in_tr_req( ) = abap_true. rv_transport_request = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum. ENDIF. ENDMETHOD. METHOD get_wb_object_operator. DATA: ls_object_type TYPE wbobjtype, lx_error TYPE REF TO cx_root. IF mi_wb_object_operator IS BOUND. ri_wb_object_operator = mi_wb_object_operator. ENDIF. ls_object_type-objtype_tr = 'BDEF'. ls_object_type-subtype_wb = 'BDO'. TRY. CALL METHOD ('CL_WB_OBJECT_OPERATOR')=>('CREATE_INSTANCE') EXPORTING object_type = ls_object_type object_key = mv_behaviour_definition_key RECEIVING result = mi_wb_object_operator. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. ri_wb_object_operator = mi_wb_object_operator. ENDMETHOD. METHOD merge_object_data. DATA: lo_object_data TYPE REF TO object, lo_object_data_old TYPE REF TO if_wb_object_data_model, lr_new TYPE REF TO data, lr_old TYPE REF TO data, lo_wb_object_operator TYPE REF TO object. FIELD-SYMBOLS: <ls_new> TYPE any, <ls_old> TYPE any, <lv_field_old> TYPE any, <lv_field_new> TYPE any. CREATE OBJECT lo_object_data TYPE ('CL_BLUE_SOURCE_OBJECT_DATA'). lo_object_data = io_object_data. CREATE DATA lr_new TYPE ('CL_BLUE_SOURCE_OBJECT_DATA=>TY_OBJECT_DATA'). ASSIGN lr_new->* TO <ls_new>. ASSERT sy-subrc = 0. CREATE DATA lr_old TYPE ('CL_BLUE_SOURCE_OBJECT_DATA=>TY_OBJECT_DATA'). ASSIGN lr_old->* TO <ls_old>. ASSERT sy-subrc = 0. CALL METHOD lo_object_data->('IF_WB_OBJECT_DATA_MODEL~GET_DATA') EXPORTING p_metadata_only = abap_false p_data_selection = 'AL' IMPORTING p_data = <ls_new>. lo_wb_object_operator = get_wb_object_operator( ). CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ') EXPORTING data_selection = 'AL' " if_wb_object_data_selection_co=>c_all_data IMPORTING eo_object_data = lo_object_data_old. CALL METHOD lo_object_data_old->('GET_DATA') EXPORTING p_metadata_only = abap_false p_data_selection = 'AL' " if_wb_object_data_selection_co=>c_all_data IMPORTING p_data = <ls_old>. ASSIGN COMPONENT 'METADATA-DESCRIPTION' OF STRUCTURE <ls_old> TO <lv_field_old>. ASSIGN COMPONENT 'METADATA-DESCRIPTION' OF STRUCTURE <ls_new> TO <lv_field_new>. <lv_field_old> = <lv_field_new>. ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_old> TO <lv_field_old>. ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_new> TO <lv_field_new>. <lv_field_old> = <lv_field_new>. CREATE OBJECT ro_object_data_merged TYPE ('CL_BLUE_SOURCE_OBJECT_DATA'). CALL METHOD ro_object_data_merged->('SET_DATA') EXPORTING p_data = <ls_old>. ENDMETHOD. METHOD zif_abapgit_object~changed_by. DATA: li_object_data_model TYPE REF TO if_wb_object_data_model, li_wb_object_operator TYPE REF TO object, lx_error TYPE REF TO cx_root. li_wb_object_operator = get_wb_object_operator( ). TRY. CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ') IMPORTING eo_object_data = li_object_data_model. rv_user = li_object_data_model->get_changed_by( ). CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lx_error TYPE REF TO cx_root, li_wb_object_operator TYPE REF TO object, lv_transport_request TYPE trkorr. lv_transport_request = get_transport_req_if_needed( iv_package ). li_wb_object_operator = get_wb_object_operator( ). TRY. CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~DELETE') EXPORTING transport_request = lv_transport_request. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lo_object_data TYPE REF TO if_wb_object_data_model, lo_object_data_merged TYPE REF TO if_wb_object_data_model, lo_wb_object_operator TYPE REF TO object, lx_error TYPE REF TO cx_root, lv_transport_request TYPE trkorr, lr_wbobjtype TYPE REF TO data, lr_category TYPE REF TO data. FIELD-SYMBOLS: <ls_wbobjtype> TYPE any, <lv_category> TYPE any, <lv_field> TYPE any. TRY. lo_object_data = get_object_data( io_xml ). lv_transport_request = get_transport_req_if_needed( iv_package ). CREATE DATA lr_wbobjtype TYPE ('WBOBJTYPE'). ASSIGN lr_wbobjtype->* TO <ls_wbobjtype>. ASSIGN COMPONENT 'OBJTYPE_TR' OF STRUCTURE <ls_wbobjtype> TO <lv_field>. <lv_field> = 'BDEF'. ASSIGN COMPONENT 'SUBTYPE_WB' OF STRUCTURE <ls_wbobjtype> TO <lv_field>. <lv_field> = 'BDO'. CREATE DATA lr_category TYPE ('WBADT_RESOURCE_CATEGORY'). ASSIGN lr_category->* TO <lv_category>. CALL METHOD ('CL_BLUE_WB_UTILITY')=>('GET_RESOURCE_CATEGORY') EXPORTING is_object_type = <ls_wbobjtype> RECEIVING result = <lv_category>. lo_wb_object_operator = get_wb_object_operator( ). tadir_insert( iv_package ). IF zif_abapgit_object~exists( ) = abap_false. CASE <lv_category>. WHEN '1'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_atomic. CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~CREATE') EXPORTING io_object_data = lo_object_data data_selection = 'AL' " if_wb_object_data_selection_co=>c_all_data version = 'I' package = iv_package transport_request = lv_transport_request. WHEN '2'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_compound_s. CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~CREATE') EXPORTING io_object_data = lo_object_data data_selection = 'P' " if_wb_object_data_selection_co=>c_properties version = 'I' package = iv_package transport_request = lv_transport_request. CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE') EXPORTING io_object_data = lo_object_data data_selection = 'D' "if_wb_object_data_selection_co=>c_data_content version = 'I' transport_request = lv_transport_request. WHEN OTHERS. ENDCASE. ELSE. lo_object_data_merged = merge_object_data( lo_object_data ). CASE <lv_category>. WHEN '1'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_atomic. CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE') EXPORTING io_object_data = lo_object_data_merged data_selection = 'AL' "if_wb_object_data_selection_co=>c_all_data version = 'I' transport_request = lv_transport_request. WHEN '2'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_compound_s. CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE') EXPORTING io_object_data = lo_object_data_merged data_selection = 'P' "if_wb_object_data_selection_co=>c_properties version = 'I' transport_request = lv_transport_request. CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE') EXPORTING io_object_data = lo_object_data_merged data_selection = 'D' "if_wb_object_data_selection_co=>c_data_content version = 'I' transport_request = lv_transport_request. WHEN OTHERS. ENDCASE. ENDIF. corr_insert( iv_package ). CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. zcl_abapgit_objects_activation=>add_item( ms_item ). ENDMETHOD. METHOD zif_abapgit_object~exists. TRY. mi_persistence->get( p_object_key = mv_behaviour_definition_key p_version = 'A' p_existence_check_only = abap_true ). rv_bool = abap_true. CATCH cx_swb_exception. 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( ). rs_metadata-ddic = abap_false. 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 = exists_a_lock_entry_for( iv_lock_object = 'ESDIC' iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = ms_item-obj_name object_type = ms_item-obj_type 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: li_object_data_model TYPE REF TO if_wb_object_data_model, li_wb_object_operator TYPE REF TO object, lx_error TYPE REF TO cx_root, lv_source TYPE string. FIELD-SYMBOLS: <ls_behaviour_definition> TYPE any, <lv_metadata> TYPE any, <lv_source> TYPE string. ASSIGN mr_behaviour_definition->* TO <ls_behaviour_definition>. ASSERT sy-subrc = 0. li_wb_object_operator = get_wb_object_operator( ). TRY. CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ') EXPORTING version = 'A' IMPORTING data = <ls_behaviour_definition> eo_object_data = li_object_data_model. ASSIGN COMPONENT 'METADATA' OF STRUCTURE <ls_behaviour_definition> TO <lv_metadata>. ASSERT sy-subrc = 0. clear_fields( CHANGING cs_metadata = <lv_metadata> ). ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_behaviour_definition> TO <lv_source>. ASSERT sy-subrc = 0. lv_source = <lv_source>. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. io_xml->add( iv_name = 'BDEF' ig_data = <lv_metadata> ). mo_files->add_string( iv_ext = 'asbdef' iv_string = lv_source ). ENDMETHOD. ENDCLASS.
28.888717
106
0.63362
98523362153bbddc70d826ec0e3bc64c92422b02
1,327
abap
ABAP
src/zmonsters_p01_enablers/zmonsters_c06_debugger/zch06_debugger_scripting.prog.abap
hardyp/AbapToTheFuture03
5de922d589237142288c099d92655f9811eee4fa
[ "MIT" ]
30
2019-03-03T03:33:55.000Z
2022-03-11T01:12:55.000Z
src/zmonsters_p01_enablers/zmonsters_c06_debugger/zch06_debugger_scripting.prog.abap
hardyp/AbapToTheFuture03
5de922d589237142288c099d92655f9811eee4fa
[ "MIT" ]
19
2019-02-24T10:58:17.000Z
2020-04-05T08:29:55.000Z
src/zmonsters_p01_enablers/zmonsters_c06_debugger/zch06_debugger_scripting.prog.abap
hardyp/AbapToTheFuture03
5de922d589237142288c099d92655f9811eee4fa
[ "MIT" ]
17
2019-02-28T06:59:06.000Z
2022-01-12T23:54:57.000Z
*&---------------------------------------------------------------------* *& Report ZCH06_DEBUGGER_SCRIPTING *&---------------------------------------------------------------------* *& To use a "Toastmaster" term this program is the "Target Speaker" *& That is it has no purpose of its own, it exists only as an example *& to be shot down (corrected) by Debugger Scripting *&---------------------------------------------------------------------* REPORT zch06_debugger_scripting. START-OF-SELECTION. PERFORM laugh_like_a_monster. *&---------------------------------------------------------------------* *& Form LAUGH_LIKE_A_MONSTER *&---------------------------------------------------------------------* * Listing 6.06 - Laughing Program with Error *----------------------------------------------------------------------* FORM laugh_like_a_monster . * Local Variables DATA: current_number TYPE sy-tabix, laugh_count TYPE sy-tabix, lightning_count TYPE sy-tabix. DO 10 TIMES. ADD 1 TO current_number. WRITE:/ 'Monster has counted to',current_number. IF current_number DIV 3 = 0."Error Here! WRITE:/ 'Ha ha ha!'. ADD 1 TO laugh_count. ENDIF. IF current_number MOD 5 = 0. WRITE:/ 'Lightning Flashes!'. ADD 1 TO lightning_count. ENDIF. ENDDO. ENDFORM.
35.864865
72
0.472494
9853c043b8a197bc5622a39c115dfe3625e4cacb
9,788
abap
ABAP
src/objects/core/zcl_abapgit_objects_check.clas.abap
sergiodnf/abapGit
aca75af509a71f7d0481b182441a5ac6a30e2fd0
[ "MIT" ]
null
null
null
src/objects/core/zcl_abapgit_objects_check.clas.abap
sergiodnf/abapGit
aca75af509a71f7d0481b182441a5ac6a30e2fd0
[ "MIT" ]
40
2021-06-01T05:58:26.000Z
2022-03-01T05:02:17.000Z
src/objects/core/zcl_abapgit_objects_check.clas.abap
pokrakam/abapGit
7e55a358cfcdf26dadcb4709768bd8e92e31fd87
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_objects_check DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS deserialize_checks IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo RETURNING VALUE(rs_checks) TYPE zif_abapgit_definitions=>ty_deserialize_checks RAISING zcx_abapgit_exception . CLASS-METHODS checks_adjust IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo !is_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks CHANGING !ct_results TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. CLASS-METHODS warning_overwrite_adjust IMPORTING !it_overwrite TYPE zif_abapgit_definitions=>ty_overwrite_tt CHANGING !ct_results TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception. CLASS-METHODS warning_overwrite_find IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt RETURNING VALUE(rt_overwrite) TYPE zif_abapgit_definitions=>ty_overwrite_tt. CLASS-METHODS warning_package_adjust IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo !it_overwrite TYPE zif_abapgit_definitions=>ty_overwrite_tt CHANGING !ct_results TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception. CLASS-METHODS warning_package_find IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt !io_repo TYPE REF TO zcl_abapgit_repo RETURNING VALUE(rt_overwrite) TYPE zif_abapgit_definitions=>ty_overwrite_tt RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_objects_check IMPLEMENTATION. METHOD checks_adjust. warning_overwrite_adjust( EXPORTING it_overwrite = is_checks-overwrite CHANGING ct_results = ct_results ). warning_package_adjust( EXPORTING io_repo = io_repo it_overwrite = is_checks-warning_package CHANGING ct_results = ct_results ). ENDMETHOD. METHOD deserialize_checks. DATA: lt_results TYPE zif_abapgit_definitions=>ty_results_tt, li_package TYPE REF TO zif_abapgit_sap_package. " get unfiltered status to evaluate properly which warnings are required lt_results = zcl_abapgit_file_status=>status( io_repo ). rs_checks-overwrite = warning_overwrite_find( lt_results ). rs_checks-warning_package = warning_package_find( io_repo = io_repo it_results = lt_results ). IF lines( lt_results ) > 0. li_package = zcl_abapgit_factory=>get_sap_package( io_repo->get_package( ) ). rs_checks-transport-required = li_package->are_changes_recorded_in_tr_req( ). IF NOT rs_checks-transport-required IS INITIAL. rs_checks-transport-type = li_package->get_transport_type( ). ENDIF. ENDIF. ENDMETHOD. METHOD warning_overwrite_adjust. DATA: lt_overwrite LIKE it_overwrite, ls_overwrite LIKE LINE OF lt_overwrite. FIELD-SYMBOLS: <ls_overwrite> LIKE LINE OF lt_overwrite. * make sure to get the current status, as something might have changed in the meanwhile lt_overwrite = warning_overwrite_find( ct_results ). LOOP AT lt_overwrite ASSIGNING <ls_overwrite>. READ TABLE it_overwrite INTO ls_overwrite WITH TABLE KEY object_type_and_name COMPONENTS obj_type = <ls_overwrite>-obj_type obj_name = <ls_overwrite>-obj_name. IF sy-subrc <> 0 OR ls_overwrite-decision IS INITIAL. zcx_abapgit_exception=>raise( |Overwrite { <ls_overwrite>-obj_type } { <ls_overwrite>-obj_name } undecided| ). ENDIF. IF ls_overwrite-decision = zif_abapgit_definitions=>c_no. DELETE ct_results WHERE obj_type = <ls_overwrite>-obj_type AND obj_name = <ls_overwrite>-obj_name. ASSERT sy-subrc = 0. ENDIF. ENDLOOP. ENDMETHOD. METHOD warning_overwrite_find. DATA: lv_status TYPE c LENGTH 2, lt_changes TYPE STANDARD TABLE OF zif_abapgit_definitions=>ty_overwrite WITH DEFAULT KEY. FIELD-SYMBOLS: <ls_result> LIKE LINE OF it_results, <ls_changes> LIKE LINE OF lt_changes. " collect all actions for object that have been changed LOOP AT it_results ASSIGNING <ls_result> WHERE NOT obj_type IS INITIAL. APPEND INITIAL LINE TO lt_changes ASSIGNING <ls_changes>. MOVE-CORRESPONDING <ls_result> TO <ls_changes>. CONCATENATE <ls_result>-lstate <ls_result>-rstate INTO lv_status RESPECTING BLANKS. CASE lv_status. WHEN ' '. " no changes <ls_changes>-action = zif_abapgit_objects=>c_deserialize_action-none. WHEN ' A' OR 'D ' OR 'DM'. " added remotely or deleted locally <ls_changes>-action = zif_abapgit_objects=>c_deserialize_action-add. <ls_changes>-icon = icon_create. <ls_changes>-text = 'Add local object'. WHEN 'A ' OR ' D' OR 'MD'. " added locally or deleted remotely <ls_changes>-action = zif_abapgit_objects=>c_deserialize_action-delete. <ls_changes>-icon = icon_delete. <ls_changes>-text = 'Delete local object'. WHEN 'M ' OR 'MM'. " modified locally <ls_changes>-action = zif_abapgit_objects=>c_deserialize_action-overwrite. <ls_changes>-icon = icon_change. <ls_changes>-text = 'Overwrite local object'. WHEN ' M'. " modified only remotely <ls_changes>-action = zif_abapgit_objects=>c_deserialize_action-update. <ls_changes>-icon = icon_change. <ls_changes>-text = 'Update local object'. WHEN OTHERS. ASSERT 0 = 1. ENDCASE. ENDLOOP. " Remove duplicate actions SORT lt_changes. DELETE ADJACENT DUPLICATES FROM lt_changes. " Check if deletions are for complete object or just a part LOOP AT lt_changes ASSIGNING <ls_changes> WHERE action = zif_abapgit_objects=>c_deserialize_action-delete. LOOP AT lt_changes TRANSPORTING NO FIELDS WHERE obj_type = <ls_changes>-obj_type AND obj_name = <ls_changes>-obj_name AND action <> zif_abapgit_objects=>c_deserialize_action-delete. EXIT. ENDLOOP. IF sy-subrc = 0. " There's some other action, so object will be recreated after deletion <ls_changes>-action = zif_abapgit_objects=>c_deserialize_action-delete_add. <ls_changes>-icon = icon_adopt. <ls_changes>-text = 'Delete and recreate local object'. ENDIF. ENDLOOP. DELETE lt_changes WHERE action = zif_abapgit_objects=>c_deserialize_action-none. " If there are multiple changes in an object, keep highest priority action SORT lt_changes BY obj_type obj_name action DESCENDING. DELETE ADJACENT DUPLICATES FROM lt_changes COMPARING obj_type obj_name. rt_overwrite = lt_changes. ENDMETHOD. METHOD warning_package_adjust. DATA: lt_overwrite LIKE it_overwrite, ls_overwrite LIKE LINE OF lt_overwrite. FIELD-SYMBOLS: <ls_overwrite> LIKE LINE OF lt_overwrite. * make sure to get the current status, as something might have changed in the meanwhile lt_overwrite = warning_package_find( it_results = ct_results io_repo = io_repo ). LOOP AT lt_overwrite ASSIGNING <ls_overwrite>. READ TABLE it_overwrite INTO ls_overwrite WITH TABLE KEY object_type_and_name COMPONENTS obj_type = <ls_overwrite>-obj_type obj_name = <ls_overwrite>-obj_name. IF sy-subrc <> 0 OR ls_overwrite-decision IS INITIAL. zcx_abapgit_exception=>raise( |Overwrite of package { <ls_overwrite>-obj_type } { <ls_overwrite>-obj_name } undecided| ). ENDIF. IF ls_overwrite-decision = zif_abapgit_definitions=>c_no. DELETE ct_results WHERE obj_type = <ls_overwrite>-obj_type AND obj_name = <ls_overwrite>-obj_name. ASSERT sy-subrc = 0. ENDIF. ENDLOOP. ENDMETHOD. METHOD warning_package_find. DATA: lv_package TYPE devclass, lt_overwrite_unique TYPE HASHED TABLE OF zif_abapgit_definitions=>ty_overwrite WITH UNIQUE KEY obj_type obj_name devclass, ls_overwrite LIKE LINE OF rt_overwrite, ls_tadir TYPE zif_abapgit_definitions=>ty_tadir. DATA: lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic. FIELD-SYMBOLS: <ls_result> LIKE LINE OF it_results. lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ). LOOP AT it_results ASSIGNING <ls_result> WHERE match IS INITIAL. lv_package = lo_folder_logic->path_to_package( iv_top = io_repo->get_package( ) io_dot = io_repo->get_dot_abapgit( ) iv_path = <ls_result>-path iv_create_if_not_exists = abap_false ). ls_tadir = zcl_abapgit_factory=>get_tadir( )->read_single( iv_object = <ls_result>-obj_type iv_obj_name = <ls_result>-obj_name ). IF NOT ls_tadir IS INITIAL AND ls_tadir-devclass <> lv_package. * overwriting object from different package than expected CLEAR ls_overwrite. ls_overwrite-obj_type = <ls_result>-obj_type. ls_overwrite-obj_name = <ls_result>-obj_name. ls_overwrite-devclass = ls_tadir-devclass. INSERT ls_overwrite INTO TABLE lt_overwrite_unique. ENDIF. ENDLOOP. rt_overwrite = lt_overwrite_unique. ENDMETHOD. ENDCLASS.
33.868512
110
0.681753
9854615c1fa54d2ea17e912338ea31064138a149
5,138
abap
ABAP
src/zcl_timem_part.clas.abap
thorsten-wolf-neptune/abapTimeMachine
ee9228c54f87d037afca032eedf3eede9ca4b987
[ "MIT" ]
null
null
null
src/zcl_timem_part.clas.abap
thorsten-wolf-neptune/abapTimeMachine
ee9228c54f87d037afca032eedf3eede9ca4b987
[ "MIT" ]
null
null
null
src/zcl_timem_part.clas.abap
thorsten-wolf-neptune/abapTimeMachine
ee9228c54f87d037afca032eedf3eede9ca4b987
[ "MIT" ]
null
null
null
"! Represents a part of an object, including all the versions of that part that "! exist in the system. CLASS zcl_timem_part DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. "! Object name DATA name TYPE string READ-ONLY . "! Part type DATA vrsd_type TYPE versobjtyp READ-ONLY . "! Part name DATA vrsd_name TYPE versobjnam READ-ONLY . "! Constructs a new part "! @parameter name | Object name "! @parameter vrsd_type | Part type "! @parameter vrsd_name | Part object METHODS constructor IMPORTING !name TYPE string !vrsd_type TYPE versobjtyp !vrsd_name TYPE versobjnam RAISING zcx_timem . METHODS get_timestamps RETURNING VALUE(result) TYPE ztimem_timestamp_t . METHODS get_source RETURNING VALUE(result) TYPE ztimem_line_t RAISING zcx_timem . METHODS revert IMPORTING ts TYPE timestamp RAISING zcx_timem. PROTECTED SECTION. PRIVATE SECTION. TYPES: ty_t_version TYPE STANDARD TABLE OF REF TO zcl_timem_version WITH KEY table_line . DATA versions TYPE ty_t_version . METHODS load_versions IMPORTING !vrsd_type TYPE versobjtyp !vrsd_name TYPE versobjnam RAISING zcx_timem . METHODS get_version_at_timestamp IMPORTING ts TYPE timestamp RETURNING VALUE(result) TYPE REF TO zcl_timem_version . METHODS get_versions_until_timestamp IMPORTING ts TYPE timestamp RETURNING VALUE(result) TYPE ty_t_version . "! Calculates and returns a list of the diffed source already filled with blame "! details. METHODS get_diffed_source_with_blame IMPORTING ts TYPE timestamp RETURNING VALUE(result) TYPE ztimem_line_t RAISING zcx_timem . METHODS get_source_at_timestamp IMPORTING ts TYPE timestamp RETURNING VALUE(result) TYPE ztimem_line_t RAISING zcx_timem . ENDCLASS. CLASS ZCL_TIMEM_PART IMPLEMENTATION. METHOD constructor. me->name = name. me->vrsd_type = vrsd_type. me->vrsd_name = vrsd_name. load_versions( vrsd_type = vrsd_type vrsd_name = vrsd_name ). ENDMETHOD. METHOD get_diffed_source_with_blame. DATA diff TYPE REF TO zcl_timem_diff. DATA temp1 TYPE zcl_timem_part=>ty_t_version. DATA version LIKE LINE OF temp1. CREATE OBJECT diff TYPE zcl_timem_diff. temp1 = get_versions_until_timestamp( ts ). LOOP AT temp1 INTO version. result = diff->compute( lines_old = result lines_new = version->get_source( ) ). ENDLOOP. ENDMETHOD. METHOD get_source. DATA options TYPE REF TO zcl_timem_options. options = zcl_timem_options=>get_instance( ). result = SWITCH #( options->get_instance( )->mode WHEN zcl_timem_consts=>mode-blame THEN get_diffed_source_with_blame( options->timestamp ) WHEN zcl_timem_consts=>mode-time_machine THEN get_source_at_timestamp( options->timestamp ) ). ENDMETHOD. METHOD get_source_at_timestamp. DATA version TYPE REF TO zcl_timem_version. version = get_version_at_timestamp( ts ). IF version IS BOUND. result = version->get_source( ). ENDIF. ENDMETHOD. METHOD get_timestamps. DATA ts LIKE LINE OF result. DATA version LIKE LINE OF versions. LOOP AT versions INTO version. ts = |{ version->date }{ version->time }|. COLLECT ts INTO result. ENDLOOP. ENDMETHOD. METHOD get_versions_until_timestamp. DATA date TYPE d. DATA temp2 TYPE zcl_timem_part=>ty_t_version. DATA time TYPE t. DATA version LIKE LINE OF versions. CONVERT TIME STAMP ts TIME ZONE space INTO DATE date TIME time. LOOP AT versions INTO version. APPEND version TO temp2. ENDLOOP. result = temp2. ENDMETHOD. METHOD get_version_at_timestamp. DATA date TYPE d. DATA time TYPE t. CONVERT TIME STAMP ts TIME ZONE space INTO DATE date TIME time. " The last one should be the one we want LOOP AT versions INTO result WHERE table_line->date < date OR ( table_line->date = date AND table_line->time <= time ). ENDLOOP. ENDMETHOD. METHOD load_versions. DATA vrsd TYPE REF TO zcl_timem_vrsd. DATA temp4 TYPE zcl_timem_part=>ty_t_version. DATA s_vrsd LIKE LINE OF vrsd->vrsd_list. DATA temp1 TYPE REF TO zcl_timem_version. CREATE OBJECT vrsd TYPE zcl_timem_vrsd EXPORTING type = vrsd_type name = vrsd_name. LOOP AT vrsd->vrsd_list INTO s_vrsd. CREATE OBJECT temp1 TYPE zcl_timem_version EXPORTING vrsd = s_vrsd. APPEND temp1 TO temp4. ENDLOOP. versions = temp4. ENDMETHOD. METHOD revert. DATA version TYPE REF TO zcl_timem_version. version = get_version_at_timestamp( ts ). IF version IS BOUND. version->retrieve( ). ENDIF. ENDMETHOD. ENDCLASS.
25.310345
100
0.662125
985786cdfdd304b07c4fd7312f5c25ab5e52b2e0
4,920
abap
ABAP
src/demo/z_xtt_demo_n070.prog.abap
bizhuka/x
39fe24c6f62746215dc6e1e1f9ef6df8f0c25862
[ "Apache-2.0" ]
25
2019-03-08T08:03:41.000Z
2021-11-28T20:19:12.000Z
src/demo/z_xtt_demo_n070.prog.abap
bizhuka/x
39fe24c6f62746215dc6e1e1f9ef6df8f0c25862
[ "Apache-2.0" ]
10
2018-02-09T09:54:19.000Z
2021-05-19T07:02:21.000Z
src/demo/z_xtt_demo_n070.prog.abap
bizhuka/x
39fe24c6f62746215dc6e1e1f9ef6df8f0c25862
[ "Apache-2.0" ]
10
2019-03-08T08:03:42.000Z
2021-04-03T12:54:54.000Z
*&---------------------------------------------------------------------* * Most of the tasks could be performed without macro. * Macro cannot run in background and executed only in MS Office at Windows. * This drawbacks and security issues narrow the scope of VBA macro. * That's why I highly do not recommend to use them at all. * on other hand ON_PREPARE_RAW event always works *&---------------------------------------------------------------------* CLASS lcl_demo_070 DEFINITION FINAL INHERITING FROM lcl_demo. PUBLIC SECTION. METHODS: get_desc_text REDEFINITION, get_url_base REDEFINITION, set_merge_info REDEFINITION, get_templates REDEFINITION, on_pbo_07 FOR EVENT pbo_event OF zif_eui_manager "#EC CALLED IMPORTING sender io_container. PROTECTED SECTION. METHODS: _merge REDEFINITION, _do_download REDEFINITION, on_prepare_raw_07 FOR EVENT prepare_raw OF zcl_xtt IMPORTING "sender iv_path ir_content, " Type Ref To XSTRING check_ole_07 IMPORTING io_ole_app TYPE ole2_object. ENDCLASS. *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* CLASS lcl_demo_070 IMPLEMENTATION. METHOD get_desc_text. rv_desc_text = 'Macro call & on_prepare_raw'(070). ENDMETHOD. METHOD get_url_base. rv_url_base = '/xtt/macro/'. ENDMETHOD. METHOD set_merge_info. TYPES: BEGIN OF ts_root, message TYPE string, END OF ts_root. DATA ls_root TYPE ts_root. ls_root-message = 'No data at all'(nda). io_report->merge_add_one( ls_root ). ENDMETHOD. METHOD _merge. SET HANDLER on_prepare_raw_07 FOR io_xtt. " do not call io_xtt->merge( ), no data for the example " For Excel only io_xtt->add_raw_event( 'xl/worksheets/sheet1.xml' ). "#EC NOTEXT ENDMETHOD. " No macro. Always works, even in background mode " Use for XML parsing (Called in the end of GET_RAW) METHOD on_prepare_raw_07. " if 'IV_PATH' is initial then intire XLSX or DOCX archive CHECK iv_path = 'xl/worksheets/sheet1.xml'. "#EC NOTEXT * " For REGEX * DATA lv_string TYPE string. * lv_string = zcl_eui_conv=>xstring_to_string( ir_content->* ). " Use XML classes DATA lo_doc TYPE REF TO if_ixml_document. lo_doc = zcl_eui_conv=>str_to_xml( iv_xstr = ir_content->* ). " Find Excel columns DATA lo_col TYPE REF TO if_ixml_element. lo_col ?= lo_doc->find_from_name( 'col' ). " Update columns WHILE lo_col IS BOUND. DATA lv_mod TYPE i. lv_mod = sy-index MOD 2. " Hide every 2nd column IF lv_mod = 0. lo_col->set_attribute( name = 'hidden' "#EC NOTEXT value = '1' ). ENDIF. lo_col ?= lo_col->get_next( ). ENDWHILE. " Write data back zcl_eui_conv=>xml_to_str( EXPORTING io_doc = lo_doc IMPORTING ev_xstr = ir_content->* ). ENDMETHOD. METHOD _do_download. DATA lv_ole_app TYPE ole2_object. io_xtt->download( " All parameters are optional EXPORTING iv_open = zcl_xtt=>mc_by-ole " Open with ole CHANGING cv_fullpath = p_path cv_ole_app = lv_ole_app ). " Get ole2_object back " Call macro. Works good regardless VBA politics check_ole_07( io_ole_app = lv_ole_app ). ENDMETHOD. " Macro always will execute for download method (regardless VBA security level) " Show method depends on security options, usually doesn't work (that's why do not call macro in SHOW ) METHOD on_pbo_07. " Just for test. @SHOW( ) APPEND 'EXIT' TO sender->ms_status-exclude. APPEND 'CANC' TO sender->ms_status-exclude. " 1 time only CHECK io_container IS NOT INITIAL. DATA lo_eui_file TYPE REF TO zcl_eui_file. DATA ls_ole_info TYPE zcl_eui_file=>ts_ole_info. lo_eui_file ?= sender. ls_ole_info = lo_eui_file->get_ole_info( ). " Call macro Error check_ole_07( io_ole_app = ls_ole_info-app ). ENDMETHOD. " Ok for 'xtt->DOWNLOAD( )', but not ok for 'xtt->SHOW( )' METHOD check_ole_07. DATA lv_charts TYPE ole2_object. " Better to use XML than macro CHECK io_ole_app IS NOT INITIAL. " @see on_prepare_raw_07 CALL METHOD OF io_ole_app 'Run' EXPORTING #1 = 'MAIN.start' #2 = 'From SAP'(fsp). " OR Call OLE like that SET PROPERTY OF io_ole_app 'StatusBar' = 'OLE Call'(ole). GET PROPERTY OF io_ole_app 'Charts' = lv_charts. CALL METHOD OF lv_charts 'Add'. ENDMETHOD. METHOD get_templates. " xls(M) & doc(M) APPEND `ZXXT_DEMO_070-XLSM` TO rt_templates. APPEND `ZXXT_DEMO_070-DOCM` TO rt_templates. ENDMETHOD. ENDCLASS.
29.112426
105
0.618699
985989225599ba26681cf652130ed09a87ad9e00
20,225
abap
ABAP
src/objects/zcl_abapgit_object_fdt0.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_fdt0.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_fdt0.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_fdt0 DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . PROTECTED SECTION. PRIVATE SECTION. METHODS check_is_local RETURNING VALUE(rv_is_local) TYPE abap_bool . METHODS get_application_id RETURNING VALUE(rv_application_id) TYPE fdt_admn_0000s-application_id . METHODS before_xml_deserialize IMPORTING !iv_package TYPE devclass EXPORTING !ev_create TYPE abap_bool !ev_is_local TYPE abap_bool CHANGING !co_dom_tree TYPE REF TO if_ixml_document RAISING zcx_abapgit_exception . METHODS filter_xml_serialize CHANGING !co_ixml_element TYPE REF TO if_ixml_element RAISING zcx_abapgit_exception . METHODS set_field IMPORTING !iv_name TYPE string !iv_value TYPE string DEFAULT '' CHANGING !co_ixml_element TYPE REF TO if_ixml_element RAISING zcx_abapgit_exception . ENDCLASS. CLASS zcl_abapgit_object_fdt0 IMPLEMENTATION. METHOD before_xml_deserialize. DATA lv_application_id TYPE fdt_admn_0000s-application_id. DATA lv_timestamp TYPE timestamp. DATA lv_transport TYPE string. DATA lv_dlvunit TYPE tdevc-dlvunit. DATA lo_node_local TYPE REF TO if_ixml_element. DATA lo_node_package TYPE REF TO if_ixml_element. DATA lo_node_id TYPE REF TO if_ixml_element. DATA lo_xml_element TYPE REF TO if_ixml_element. DATA lv_count TYPE i. lo_node_local = co_dom_tree->find_from_name( name = 'Local' namespace = 'FDTNS' ). IF lo_node_local IS BOUND. ev_is_local = lo_node_local->get_value( ). ENDIF. lo_node_package = co_dom_tree->find_from_name( name = 'DevelopmentPackage' namespace = 'FDTNS' ). IF lo_node_package IS BOUND. lo_node_package->set_value( value = |{ iv_package }| ). ENDIF. lo_node_id = co_dom_tree->find_from_name( name = 'ApplicationId' namespace = 'FDTNS' ). IF lo_node_id IS BOUND. lv_application_id = lo_node_id->get_value( ). SELECT COUNT( * ) FROM fdt_admn_0000s INTO lv_count WHERE object_type = 'AP' AND id = lv_application_id AND deleted = ''. ev_create = xsdbool( lv_count = 0 ). ENDIF. " Fill in user/time/system-specific fields GET TIME STAMP FIELD lv_timestamp. lv_transport = |${ sy-sysid }0000000000000001|. lo_xml_element = co_dom_tree->get_root_element( ). IF ev_create = abap_true. set_field( EXPORTING iv_name = 'CreationUser' iv_value = |{ sy-uname }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'CreationTimestamp' iv_value = |{ lv_timestamp }| CHANGING co_ixml_element = lo_xml_element ). ENDIF. set_field( EXPORTING iv_name = 'ChangeUser' iv_value = |{ sy-uname }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'ChangeTimestamp' iv_value = |{ lv_timestamp }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'User' iv_value = |{ sy-uname }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'Timestamp' iv_value = |{ lv_timestamp }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'Trrequest' iv_value = lv_transport CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'Trversion' iv_value = '000001' CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'Trtimestamp' iv_value = |{ lv_timestamp }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'Trsysid' iv_value = |{ sy-sysid }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'Trclient' iv_value = |{ sy-mandt }| CHANGING co_ixml_element = lo_xml_element ). set_field( EXPORTING iv_name = 'OversId' iv_value = |{ lv_application_id }| CHANGING co_ixml_element = lo_xml_element ). SELECT SINGLE dlvunit FROM tdevc INTO lv_dlvunit WHERE devclass = iv_package. IF sy-subrc = 0. set_field( EXPORTING iv_name = 'SoftwareComponent' iv_value = |{ lv_dlvunit }| CHANGING co_ixml_element = lo_xml_element ). ENDIF. lo_xml_element->set_attribute( name = 'Client' value = |{ sy-mandt }| ). lo_xml_element->set_attribute( name = 'Date' value = |{ sy-datum }| ). lo_xml_element->set_attribute( name = 'SAPRelease' value = |{ sy-saprl }| ). lo_xml_element->set_attribute( name = 'Server' value = |{ sy-host }| ). lo_xml_element->set_attribute( name = 'SourceExportReqID' value = lv_transport ). lo_xml_element->set_attribute( name = 'SystemID' value = |{ sy-sysid }| ). lo_xml_element->set_attribute( name = 'Time' value = |{ sy-uzeit }| ). lo_xml_element->set_attribute( name = 'User' value = |{ sy-uname }| ). ENDMETHOD. METHOD check_is_local. SELECT SINGLE local_object FROM fdt_admn_0000s INTO rv_is_local WHERE object_type = 'AP' AND name = ms_item-obj_name. ENDMETHOD. METHOD filter_xml_serialize. DATA lo_components_node TYPE REF TO if_ixml_element. lo_components_node = co_ixml_element->find_from_name( name = 'ComponentReleases' namespace = 'FDTNS' ). IF lo_components_node IS BOUND. co_ixml_element->remove_child( old_child = lo_components_node ). ENDIF. " Clear user/time/system-specific fields set_field( EXPORTING iv_name = 'CreationUser' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'CreationTimestamp' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'ChangeUser' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'ChangeTimestamp' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'User' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'Timestamp' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'Trrequest' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'Trversion' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'Trtimestamp' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'Trsysid' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'Trclient' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'OversId' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'SoftwareComponent' CHANGING co_ixml_element = co_ixml_element ). set_field( EXPORTING iv_name = 'DevelopmentPackage' CHANGING co_ixml_element = co_ixml_element ). " Clear attributes of root FDTNS:Fdt node co_ixml_element->set_attribute( name = 'Client' value = '' ). co_ixml_element->set_attribute( name = 'Date' value = '' ). co_ixml_element->set_attribute( name = 'SAPRelease' value = '' ). co_ixml_element->set_attribute( name = 'Server' value = '' ). co_ixml_element->set_attribute( name = 'SourceExportReqID' value = '' ). co_ixml_element->set_attribute( name = 'SystemID' value = '' ). co_ixml_element->set_attribute( name = 'Time' value = '' ). co_ixml_element->set_attribute( name = 'User' value = '' ). ENDMETHOD. METHOD get_application_id. SELECT SINGLE application_id FROM fdt_admn_0000s INTO rv_application_id WHERE object_type = 'AP' AND name = ms_item-obj_name. ENDMETHOD. METHOD set_field. DATA: lo_node_collection TYPE REF TO if_ixml_node_collection, lo_node TYPE REF TO if_ixml_node, lv_index TYPE i. lo_node_collection = co_ixml_element->get_elements_by_tag_name( namespace = 'FDTNS' name = iv_name ). lv_index = 0. WHILE lv_index < lo_node_collection->get_length( ). lo_node = lo_node_collection->get_item( lv_index ). lo_node->set_value( iv_value ). lv_index = lv_index + 1. ENDWHILE. ENDMETHOD. METHOD zif_abapgit_object~changed_by. DATA lv_ch_user TYPE fdt_admn_0000s-ch_user. SELECT SINGLE ch_user FROM fdt_admn_0000s INTO lv_ch_user WHERE object_type = 'AP' AND name = ms_item-obj_name. rv_user = lv_ch_user. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA lv_is_local TYPE abap_bool. DATA lt_application_id TYPE TABLE OF fdt_admn_0000s-application_id. DATA ls_object_category_sel TYPE if_fdt_query=>s_object_category_sel. DATA lv_failure TYPE abap_bool. DATA lx_fdt_input TYPE REF TO cx_fdt_input. lv_is_local = check_is_local( ). SELECT application_id FROM fdt_admn_0000s INTO TABLE lt_application_id WHERE object_type = 'AP' AND name = ms_item-obj_name. ls_object_category_sel-system_objects = 'X'. TRY. IF lv_is_local = abap_true. cl_fdt_delete_handling=>mark_for_delete_via_job( EXPORTING is_object_category_sel = ls_object_category_sel ita_application_id = lt_application_id iv_background = abap_true iv_local_option = '1' iv_appl_transported_option = '2' iv_obj_transported_option = '2' IMPORTING ev_failure = lv_failure ). IF lv_failure IS INITIAL. cl_fdt_delete_handling=>delete_logical_via_job( EXPORTING is_object_category_sel = ls_object_category_sel ita_application_id = lt_application_id iv_retention_time = 0 iv_background = abap_true iv_local_option = '1' iv_appl_transported_option = '2' iv_obj_transported_option = '2' IMPORTING ev_failure = lv_failure ). IF lv_failure IS INITIAL. cl_fdt_delete_handling=>delete_physical_via_job( EXPORTING is_object_category_sel = ls_object_category_sel ita_application_id = lt_application_id iv_retention_time = 0 iv_background = abap_true iv_local_option = '1' iv_appl_transported_option = '2' IMPORTING ev_failure = lv_failure ). ENDIF. ENDIF. ELSE. cl_fdt_delete_handling=>mark_for_delete_via_job( EXPORTING is_object_category_sel = ls_object_category_sel ita_application_id = lt_application_id iv_background = abap_true iv_local_option = '2' iv_appl_transported_option = '1' iv_obj_transported_option = '1' IMPORTING ev_failure = lv_failure ). IF lv_failure IS INITIAL. cl_fdt_delete_handling=>delete_logical_via_job( EXPORTING is_object_category_sel = ls_object_category_sel ita_application_id = lt_application_id iv_retention_time = 0 iv_background = abap_true iv_local_option = '2' iv_appl_transported_option = '1' iv_obj_transported_option = '1' IMPORTING ev_failure = lv_failure ). IF lv_failure IS INITIAL. cl_fdt_delete_handling=>delete_physical_via_job( EXPORTING is_object_category_sel = ls_object_category_sel ita_application_id = lt_application_id iv_retention_time = 0 iv_background = abap_true iv_local_option = '2' iv_appl_transported_option = '1' IMPORTING ev_failure = lv_failure ). ENDIF. ENDIF. ENDIF. IF lv_failure = abap_true. zcx_abapgit_exception=>raise( |Error deleting { ms_item-obj_type } { ms_item-obj_name }| ). ENDIF. CATCH cx_fdt_input INTO lx_fdt_input. zcx_abapgit_exception=>raise_with_text( lx_fdt_input ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA lo_dexc TYPE REF TO if_fdt_data_exchange. DATA lx_fdt_input TYPE REF TO cx_fdt_input. DATA lo_dom_tree TYPE REF TO if_ixml_document. DATA lv_is_local TYPE abap_bool. DATA lt_message TYPE if_fdt_types=>t_message. DATA lv_create TYPE abap_bool. FIELD-SYMBOLS <ls_message> TYPE if_fdt_types=>s_message. lo_dom_tree = io_xml->get_raw( ). before_xml_deserialize( EXPORTING iv_package = iv_package IMPORTING ev_create = lv_create ev_is_local = lv_is_local CHANGING co_dom_tree = lo_dom_tree ). lo_dexc = cl_fdt_factory=>if_fdt_factory~get_instance( )->get_data_exchange( ). TRY. IF lv_is_local = abap_true. "Local Object lo_dexc->import_xml( EXPORTING io_dom_tree = lo_dom_tree iv_create = lv_create iv_activate = abap_true iv_simulate = abap_false IMPORTING et_message = lt_message ). ELSE. "Transportable Object lo_dexc->import_xml( EXPORTING io_dom_tree = lo_dom_tree iv_create = lv_create iv_activate = abap_true iv_simulate = abap_false iv_workbench_trrequest = iv_transport IMPORTING et_message = lt_message ). ENDIF. LOOP AT lt_message ASSIGNING <ls_message>. ii_log->add( iv_msg = <ls_message>-text iv_type = <ls_message>-msgty ). ENDLOOP. CATCH cx_fdt_input INTO lx_fdt_input. zcx_abapgit_exception=>raise_with_text( lx_fdt_input ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~exists. DATA lv_count TYPE i. SELECT COUNT( * ) FROM fdt_admn_0000s INTO lv_count WHERE object_type = 'AP' AND name = ms_item-obj_name AND deleted = ''. rv_bool = boolc( lv_count > 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. DATA lo_local_version_output TYPE REF TO zcl_abapgit_xml_output. DATA lo_local_version_input TYPE REF TO zcl_abapgit_xml_input. CREATE OBJECT lo_local_version_output. zif_abapgit_object~serialize( lo_local_version_output ). CREATE OBJECT lo_local_version_input EXPORTING iv_xml = lo_local_version_output->zif_abapgit_xml_output~render( ). CREATE OBJECT ri_comparator TYPE zcl_abapgit_object_tabl_compar EXPORTING ii_local = lo_local_version_input. 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_application_id TYPE fdt_admn_0000s-application_id. DATA lx_fdt_input TYPE REF TO cx_fdt_input. DATA lo_instance TYPE REF TO if_fdt_admin_data. DATA lt_version TYPE if_fdt_admin_data=>ts_version. DATA lv_index TYPE sy-tabix. FIELD-SYMBOLS <ls_version> LIKE LINE OF lt_version. lv_application_id = get_application_id( ). TRY. cl_fdt_factory=>get_instance_generic( EXPORTING iv_id = lv_application_id IMPORTING eo_instance = lo_instance ). CATCH cx_fdt_input INTO lx_fdt_input. zcx_abapgit_exception=>raise_with_text( lx_fdt_input ). ENDTRY. lo_instance->get_versions( IMPORTING ets_version = lt_version ). lv_index = lines( lt_version ). READ TABLE lt_version ASSIGNING <ls_version> INDEX lv_index. rv_active = boolc( <ls_version>-state = 'A' ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. DATA lv_application_id TYPE string. lv_application_id = get_application_id( ). rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'FDT_ENQUEUE_ID' iv_argument = |$ST{ lv_application_id }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. DATA lv_application_id TYPE fdt_admn_0000s-application_id. DATA lx_root TYPE REF TO cx_root. DATA lo_fdt_wd TYPE REF TO if_fdt_wd_factory. lv_application_id = get_application_id( ). IF lv_application_id IS NOT INITIAL. TRY. lo_fdt_wd = cl_fdt_wd_factory=>if_fdt_wd_factory~get_instance( ). lo_fdt_wd->get_ui_execution( )->execute_workbench( iv_id = lv_application_id ). CATCH cx_root INTO lx_root. zcx_abapgit_exception=>raise_with_text( lx_root ). ENDTRY. ELSE. zcx_abapgit_exception=>raise( 'Could not open BRF+ Workbench' ). ENDIF. rv_exit = abap_true. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA lo_dexc TYPE REF TO if_fdt_data_exchange. DATA lv_application_id TYPE fdt_admn_0000s-application_id. DATA lx_fdt_input TYPE REF TO cx_fdt_input. DATA lv_xml_fdt0_application TYPE string. DATA lo_xml_document TYPE REF TO if_ixml_document. DATA lo_xml_element TYPE REF TO if_ixml_element. lv_application_id = get_application_id( ). lo_dexc = cl_fdt_factory=>if_fdt_factory~get_instance( )->get_data_exchange( ). TRY. lo_dexc->export_xml_application( EXPORTING iv_application_id = lv_application_id iv_schema = if_fdt_data_exchange=>gc_xml_schema_type_external iv_xml_version = if_fdt_data_exchange=>gc_xml_version IMPORTING ev_string = lv_xml_fdt0_application ). lo_xml_document = cl_ixml_80_20=>parse_to_document( stream_string = lv_xml_fdt0_application ). lo_xml_element = lo_xml_document->get_root_element( ). filter_xml_serialize( CHANGING co_ixml_element = lo_xml_element ). io_xml->set_raw( lo_xml_element ). CATCH cx_fdt_input INTO lx_fdt_input. zcx_abapgit_exception=>raise_with_text( lx_fdt_input ). ENDTRY. ENDMETHOD. ENDCLASS.
28.566384
118
0.613943
985ef3348526a34ff4164da2f2833cb5438e1298
1,111
abap
ABAP
src/pgp/zcl_abappgp_subpacket_12.clas.abap
larshp/abapPGP
82cb07e17ad1c402275bb9e01f1b7bc3d1b2021f
[ "MIT" ]
5
2016-11-19T14:35:50.000Z
2022-03-16T03:09:49.000Z
src/pgp/zcl_abappgp_subpacket_12.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
34
2016-09-29T18:06:29.000Z
2022-01-19T06:41:02.000Z
src/pgp/zcl_abappgp_subpacket_12.clas.abap
MikeSidorochkin/abapPGP
da3216c3511e341a9f6de790150d07801f3bd48a
[ "MIT" ]
3
2018-12-07T15:30:46.000Z
2021-04-13T18:38:53.000Z
CLASS zcl_abappgp_subpacket_12 DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abappgp_subpacket . ALIASES from_stream FOR zif_abappgp_subpacket~from_stream . ALIASES get_name FOR zif_abappgp_subpacket~get_name . ALIASES get_type FOR zif_abappgp_subpacket~get_type . ALIASES to_stream FOR zif_abappgp_subpacket~to_stream . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPPGP_SUBPACKET_12 IMPLEMENTATION. METHOD zif_abappgp_subpacket~dump. rv_dump = |\tSub - { get_name( ) }(sub { get_type( ) })({ to_stream( )->get_length( ) } bytes)\n\t\ttodo\n|. ENDMETHOD. METHOD zif_abappgp_subpacket~from_stream. * todo CREATE OBJECT ri_packet TYPE zcl_abappgp_subpacket_12. ENDMETHOD. METHOD zif_abappgp_subpacket~get_name. rv_name = 'Revocation Key'. ENDMETHOD. METHOD zif_abappgp_subpacket~get_type. rv_type = zif_abappgp_constants=>c_sub_type-revocation_key. ENDMETHOD. METHOD zif_abappgp_subpacket~to_stream. CREATE OBJECT ro_stream. * todo ENDMETHOD. ENDCLASS.
17.359375
112
0.736274
98669c549c7a9455f3fcb94f4ed4effa04b34e34
1,505
abap
ABAP
src/zcx_i18nchk_error.clas.abap
stockbal/abap-i18n-checker
ded12177f605678f692b55fec4da3de9973f9911
[ "MIT" ]
null
null
null
src/zcx_i18nchk_error.clas.abap
stockbal/abap-i18n-checker
ded12177f605678f692b55fec4da3de9973f9911
[ "MIT" ]
null
null
null
src/zcx_i18nchk_error.clas.abap
stockbal/abap-i18n-checker
ded12177f605678f692b55fec4da3de9973f9911
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en">General error during i18n check</p> CLASS zcx_i18nchk_error DEFINITION PUBLIC INHERITING FROM cx_static_check CREATE PUBLIC . PUBLIC SECTION. INTERFACES: if_t100_message. DATA: msgv1 TYPE sy-msgv1, msgv2 TYPE sy-msgv2, msgv3 TYPE sy-msgv3, msgv4 TYPE sy-msgv4. METHODS: "! <p class="shorttext synchronized" lang="en">CONSTRUCTOR</p> constructor IMPORTING previous LIKE previous OPTIONAL text TYPE string OPTIONAL. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcx_i18nchk_error IMPLEMENTATION. METHOD constructor ##ADT_SUPPRESS_GENERATION. DATA: fill_t100key TYPE abap_bool. CALL METHOD super->constructor EXPORTING previous = previous. CLEAR textid. IF text IS NOT INITIAL. fill_t100key = abap_true. zcl_i18nchk_message_util=>split_string_to_symsg( text ). ELSEIF sy-msgid IS NOT INITIAL. fill_t100key = abap_true. ENDIF. IF fill_t100key = abap_true. msgv1 = sy-msgv1. msgv2 = sy-msgv2. msgv3 = sy-msgv3. msgv4 = sy-msgv4. if_t100_message~t100key = VALUE #( msgid = sy-msgid msgno = sy-msgno attr1 = 'MSGV1' attr2 = 'MSGV2' attr3 = 'MSGV3' attr4 = 'MSGV4' ). ELSE. if_t100_message~t100key = if_t100_message=>default_textid. ENDIF. me->previous = previous. ENDMETHOD. ENDCLASS.
21.5
82
0.643854
9866ca187a99df833fd0fdc580ad0d8beb33869f
611
abap
ABAP
src/zif_adv_check.intf.abap
hhelibeb/abap-data-validator
f40fc35c4167730cee200f27dadec76964ea3203
[ "MIT" ]
24
2020-01-06T15:05:12.000Z
2022-02-11T17:58:35.000Z
src/zif_adv_check.intf.abap
hhelibeb/abap-data-validation
f40fc35c4167730cee200f27dadec76964ea3203
[ "MIT" ]
9
2020-01-04T22:36:05.000Z
2020-11-12T09:25:53.000Z
src/zif_adv_check.intf.abap
hhelibeb/abap-data-validation
f40fc35c4167730cee200f27dadec76964ea3203
[ "MIT" ]
10
2020-01-04T13:52:28.000Z
2022-03-26T08:06:19.000Z
INTERFACE zif_adv_check PUBLIC . CONSTANTS: c_interface_name TYPE seoclsname VALUE 'ZIF_ADV_CHECK'. CONSTANTS: c_method_name TYPE seocpdname VALUE 'IS_VALID'. CLASS-METHODS: "! <p class="shorttext synchronized" lang="en"></p> "! "! @parameter data data to be validated| <p class="shorttext synchronized" lang="en"></p> "! @parameter valid if 'X', valid | <p class="shorttext synchronized" lang="en"></p> is_valid IMPORTING !data TYPE simple RETURNING VALUE(valid) TYPE abap_bool. ENDINTERFACE.
40.733333
106
0.613748
98675da53f72e7587189d9268588f491edc02d50
2,901
abap
ABAP
src/checks/y_check_declaration_in_if.clas.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_declaration_in_if.clas.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_declaration_in_if.clas.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
CLASS y_check_declaration_in_if DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUBLIC . PUBLIC SECTION. METHODS constructor . PROTECTED SECTION. METHODS execute_check REDEFINITION. METHODS inspect_tokens REDEFINITION. PRIVATE SECTION. DATA branch_counter TYPE i VALUE 0 ##NO_TEXT. CONSTANTS first_if TYPE i VALUE 1 ##NO_TEXT. METHODS check_if_error IMPORTING index TYPE i keyword TYPE string statement TYPE sstmnt. ENDCLASS. CLASS Y_CHECK_DECLARATION_IN_IF IMPLEMENTATION. METHOD constructor. super->constructor( ). settings-pseudo_comment = '"#EC DECL_IN_IF' ##NO_TEXT. settings-disable_threshold_selection = abap_true. settings-threshold = 0. settings-prio = c_warning. settings-documentation = |{ c_docs_path-checks }declaration-in-if.md|. set_check_message( 'Declarations in IF-Blocks should be removed!' ). ENDMETHOD. METHOD execute_check. LOOP AT ref_scan_manager->get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>) WHERE stmnt_type EQ scan_struc_stmnt_type-if. is_testcode = test_code_detector->is_testcode( <structure> ). TRY. DATA(check_configuration) = check_configurations[ apply_on_testcode = abap_true ]. CATCH cx_sy_itab_line_not_found. IF is_testcode EQ abap_true. CONTINUE. ENDIF. ENDTRY. DATA(index) = <structure>-stmnt_from. LOOP AT ref_scan_manager->get_statements( ) ASSIGNING FIELD-SYMBOL(<statement>) FROM <structure>-stmnt_from TO <structure>-stmnt_to. inspect_tokens( index = index statement = <statement> ). index = index + 1. ENDLOOP. ENDLOOP. ENDMETHOD. METHOD inspect_tokens. DATA(keyword) = get_token_abs( statement-from ). CASE keyword. WHEN 'IF'. branch_counter = branch_counter + 1. WHEN 'ENDIF'. branch_counter = branch_counter - 1. WHEN 'DATA' OR 'FIELD-SYMBOLS' OR 'TYPES'. check_if_error( index = index keyword = keyword statement = statement ). ENDCASE. IF keyword CP 'DATA(*)'. check_if_error( index = index keyword = keyword statement = statement ). ENDIF. ENDMETHOD. METHOD check_if_error. IF branch_counter = first_if. DATA(check_configuration) = detect_check_configuration( statement ). IF check_configuration IS INITIAL. RETURN. ENDIF. raise_error( statement_level = statement-level statement_index = index statement_from = statement-from error_priority = check_configuration-prio parameter_01 = |{ keyword }| ). ENDIF. ENDMETHOD. ENDCLASS.
26.372727
92
0.633919
98688a8ea722f5dd9b9c36e069a6985097c3f93c
11,708
abap
ABAP
src/legacy/#dmo#if_flight_legacy08.intf.abap
SAP-Cloud-Platform/flight08
1cf83833e737b8a8572854d94889740f8e5de0c9
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#if_flight_legacy08.intf.abap
SAP-Cloud-Platform/flight08
1cf83833e737b8a8572854d94889740f8e5de0c9
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#if_flight_legacy08.intf.abap
SAP-Cloud-Platform/flight08
1cf83833e737b8a8572854d94889740f8e5de0c9
[ "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_legacy08 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/TRAVEL08 TYPES tt_travel TYPE SORTED TABLE OF /dmo/travel08 WITH UNIQUE KEY travel_id. "! Table type of the table /DMO/BOOKING08 TYPES tt_booking TYPE SORTED TABLE OF /dmo/booking08 WITH UNIQUE KEY travel_id booking_id. "! Table type of the table /DMO/BOOK_SUP_08 TYPES tt_booking_supplement TYPE SORTED TABLE OF /dmo/book_sup_08 WITH UNIQUE KEY travel_id booking_id booking_supplement_id. "! Table type of the table /DMO/FLIGHT08 TYPES tt_flight TYPE STANDARD TABLE OF /dmo/flight08 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_id08. 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_id08. 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_id08. 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/TRAVEL08, /DMO/BOOKING08, /DMO/BOOK_SUP_08 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_code08. 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_code08. 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_code08. 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_code08, 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_status08, 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/travel08_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_id08. INCLUDE TYPE /dmo/booking08_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_id08. TYPES booking_supplement_id TYPE /dmo/booking_supplement_id08. INCLUDE TYPE /dmo/book_sup_08_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_id08. TYPES action_code TYPE /dmo/action_code08. 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_id08. TYPES booking_supplement_id TYPE /dmo/booking_supplement_id08. TYPES action_code TYPE /dmo/action_code08. 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
98742cdcec40210db7882694649b9f247850fcdb
5,869
abap
ABAP
src/checks/zcl_aoc_check_79.clas.abap
kjetil-kilhavn/abapOpenChecks
252374cba0b9ca9fd646b18709c5291a79dd0486
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_79.clas.abap
kjetil-kilhavn/abapOpenChecks
252374cba0b9ca9fd646b18709c5291a79dd0486
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_79.clas.abap
kjetil-kilhavn/abapOpenChecks
252374cba0b9ca9fd646b18709c5291a79dd0486
[ "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 "search for CLEAR, but CLEAR x WITH y is okay IF sy-subrc = 0 AND ( ( ls_statement-str CP 'CLEAR *' AND ls_statement-str NP 'CLEAR * WITH *' ) OR ls_statement-str CP 'REFRESH *' OR ls_statement-str CP 'FREE *' ). 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. ENDIF. 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 usage 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.763713
88
0.620719
9875640e27b7f79772ad75233bdec64829ebc6b7
2,676
abap
ABAP
src/zunitdemo_simple.clas.testclasses.abap
RainerWinkler/ABAP-Unit-Test-Demo
ab84490e0450c4bde65473f55042ab3ed6a4ea64
[ "MIT" ]
1
2020-09-26T11:09:54.000Z
2020-09-26T11:09:54.000Z
src/zunitdemo_simple.clas.testclasses.abap
RainerWinkler/ABAP-Unit-Test-Demo
ab84490e0450c4bde65473f55042ab3ed6a4ea64
[ "MIT" ]
null
null
null
src/zunitdemo_simple.clas.testclasses.abap
RainerWinkler/ABAP-Unit-Test-Demo
ab84490e0450c4bde65473f55042ab3ed6a4ea64
[ "MIT" ]
3
2019-11-25T17:30:22.000Z
2022-02-11T06:38:02.000Z
CLASS ltcl_demo DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA: f_cut TYPE REF TO zunitdemo_simple. METHODS: test_with_test_injections FOR TESTING RAISING cx_static_check, test_with_test_parameters FOR TESTING RAISING cx_static_check, test_with_mock_class FOR TESTING RAISING cx_static_check, test_wth_abap_test_double_frwk FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_demo IMPLEMENTATION. METHOD test_with_test_injections. TEST-INJECTION sy_datum. date = '20170102'. END-TEST-INJECTION. f_cut = NEW #( ). DATA: day_act TYPE n LENGTH 2. day_act = f_cut->actual_day( ). cl_abap_unit_assert=>assert_equals( msg = 'Today is the second day of the month' exp = '02' act = day_act ). ENDMETHOD. METHOD test_with_test_parameters. f_cut = NEW #( date_for_test = '20170102' ). DATA: day_act TYPE n LENGTH 2. day_act = f_cut->actual_day2( ). cl_abap_unit_assert=>assert_equals( msg = 'Today is the second day of the month' exp = '02' act = day_act ). ENDMETHOD. METHOD test_with_mock_class. DATA: day_provider TYPE REF TO zunitdemo_simple_actdate_mock. day_provider = NEW #( test_day = '20170102' ). f_cut = NEW #( actdate_provider = day_provider ). DATA: day_act TYPE n LENGTH 2. day_act = f_cut->actual_day3( ). cl_abap_unit_assert=>assert_equals( msg = 'Today is the second day of the month' exp = '02' act = day_act ). ENDMETHOD. METHOD test_wth_abap_test_double_frwk. " Use the ABAP Test Double Framework for the test DATA: actdate_interface TYPE REF TO zunitdemo_interface_actdate. actdate_interface ?= cl_abap_testdouble=>create( object_name = 'zunitdemo_interface_actdate' * double_name = ). " Specify that 20170102 is returned, cl_abap_testdouble=>configure_call( double = actdate_interface )->returning( value = '20170102' ). " when this method is called actdate_interface->get_date( ). f_cut = NEW #( actdate_interface = actdate_interface ). DATA: day_act TYPE n LENGTH 2. day_act = f_cut->actual_day4( ). cl_abap_unit_assert=>assert_equals( msg = 'Today is the second day of the month' exp = '02' act = day_act ). ENDMETHOD. ENDCLASS.
26.76
102
0.613976
98757529decdb50f9272be902fdc427cf4dd1cf0
8,053
abap
ABAP
kapitel_10/zbook_status_html.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
12
2018-06-22T10:55:06.000Z
2022-03-22T12:10:48.000Z
kapitel_10/zbook_status_html.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
5
2018-06-25T11:45:26.000Z
2019-09-04T19:41:55.000Z
kapitel_10/zbook_status_html.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
7
2018-07-02T14:20:28.000Z
2022-03-25T19:33:33.000Z
REPORT zbook_status_html. *----------------------------------------------------------------------* * CLASS lcl_status DEFINITION *----------------------------------------------------------------------* CLASS lcl_status DEFINITION. PUBLIC SECTION. METHODS constructor IMPORTING cc_name TYPE clike OPTIONAL container TYPE REF TO cl_gui_container OPTIONAL status TYPE zbook_ticket_status OPTIONAL. METHODS set_status IMPORTING status TYPE clike. METHODS get_html EXPORTING html TYPE STANDARD TABLE. EVENTS status_changed EXPORTING VALUE(status) TYPE zbook_ticket_status. PROTECTED SECTION. DATA gv_current_status TYPE zbook_ticket_status. DATA gr_doc TYPE REF TO cl_dd_document. METHODS refresh. METHODS add_status2table IMPORTING icon TYPE icon_name text TYPE clike code TYPE clike col1 TYPE REF TO cl_dd_area col2 TYPE REF TO cl_dd_area. METHODS create_dyndoc. METHODS handle_links FOR EVENT clicked OF cl_dd_link_element IMPORTING sender . ENDCLASS. "lcl_status DEFINITION *----------------------------------------------------------------------* * CLASS lcl_status IMPLEMENTATION *----------------------------------------------------------------------* CLASS lcl_status IMPLEMENTATION. METHOD constructor. *== data DATA lr_container TYPE REF TO cl_gui_container. DATA lv_cc_name TYPE sdydo_value. IF cc_name <> space. *== use given name of custom control lv_cc_name = cc_name. ELSE. *== use given container lr_container = container. ENDIF. IF status IS INITIAL. gv_current_status = 'OPEN'. ELSE. gv_current_status = status. ENDIF. create_dyndoc( ). gr_doc->display_document( container = lv_cc_name parent = lr_container ) . ENDMETHOD. "constructor METHOD set_status. gv_current_status = status. create_dyndoc( ). refresh( ). ENDMETHOD. "set_status METHOD refresh. gr_doc->display_document( reuse_control = 'X' ) . ENDMETHOD. "refresh METHOD add_status2table. DATA link TYPE REF TO cl_dd_link_element. CALL METHOD col1->add_icon EXPORTING sap_icon = icon alternative_text = text. IF gv_current_status = code. col2->add_text( text = text ). ELSE. CALL METHOD col2->add_link EXPORTING text = text name = code IMPORTING link = link. SET HANDLER handle_links FOR link. ENDIF. ENDMETHOD. "ADD_STATUS2TABLE METHOD create_dyndoc. DATA text TYPE sdydo_text_element. DATA link TYPE REF TO cl_dd_link_element. DATA lr_table TYPE REF TO cl_dd_table_element. DATA lr_column_1 TYPE REF TO cl_dd_area. DATA lr_column_2 TYPE REF TO cl_dd_area. IF gr_doc IS INITIAL. CREATE OBJECT gr_doc. ELSE. gr_doc->initialize_document( ). ENDIF. CALL METHOD gr_doc->add_text EXPORTING text = 'Status aktiviert:' sap_style = 'heading'. text = gv_current_status. CALL METHOD gr_doc->add_text EXPORTING text = text sap_style = 'heading'. gr_doc->new_line( repeat = 1 ). * set Heading text = 'Statusänderungen'. CALL METHOD gr_doc->add_text EXPORTING text = text sap_style = 'heading'. gr_doc->new_line( ). CALL METHOD gr_doc->add_table EXPORTING with_heading = 'X' no_of_columns = 2 width = '100%' with_a11y_marks = 'X' a11y_label = 'Statustabelle' IMPORTING table = lr_table. * set columns CALL METHOD lr_table->add_column EXPORTING heading = 'Status' IMPORTING column = lr_column_1. CALL METHOD lr_table->add_column EXPORTING heading = 'Erklärung' IMPORTING column = lr_column_2. add_status2table( icon = 'ICON_STATUS_OPEN' text = 'Öffnen' code = 'OPEN' col1 = lr_column_1 col2 = lr_column_2 ). lr_table->new_row( ). add_status2table( icon = 'ICON_COMPLETE' text = 'Abschließen' code = 'CLSD' col1 = lr_column_1 col2 = lr_column_2 ). lr_table->new_row( ). add_status2table( icon = 'ICON_DELETE' text = 'löschen' code = 'DELE' col1 = lr_column_1 col2 = lr_column_2 ). lr_table->new_row( ). add_status2table( icon = 'ICON_PARTNER' text = 'in Arbeit' code = 'WORK' col1 = lr_column_1 col2 = lr_column_2 ). lr_table->new_row( ). add_status2table( icon = 'ICON_CUSTOMER' text = 'Warten auf Anwender' code = 'USER' col1 = lr_column_1 col2 = lr_column_2 ). lr_table->new_row( ). add_status2table( icon = 'ICON_DEFECT' text = 'Zurück gestellt' code = 'HOLD' col1 = lr_column_1 col2 = lr_column_2 ). lr_table->new_row( ). add_status2table( icon = 'ICON_CANCEL' text = 'Ablehnen' code = 'DECL' col1 = lr_column_1 col2 = lr_column_2 ). gr_doc->merge_document( ). ENDMETHOD. "CREATE_DYNDOC METHOD get_html. DATA lv_url TYPE c LENGTH 80. DATA lt_html TYPE TABLE OF text1000. html = gr_doc->html_table. * call method gr_doc->html_control->load_data * exporting * type = 'text' * subtype = 'html' * importing * assigned_url = lv_url * changing * data_table = html * exceptions * others = 1. ENDMETHOD. METHOD handle_links. *== set new status set_status( sender->name ). RAISE EVENT status_changed EXPORTING status = gv_current_status. ENDMETHOD. "HANDLE_SUBMIT_LINKS ENDCLASS. "lcl_status IMPLEMENTATION PARAMETERS p_status TYPE zbook_ticket_status DEFAULT 'OPEN'. *----------------------------------------------------------------------* * CLASS lcl_handler DEFINITION *----------------------------------------------------------------------* CLASS lcl_handler DEFINITION. PUBLIC SECTION. METHODS status_clicked FOR EVENT status_changed OF lcl_status IMPORTING status. ENDCLASS. "lcl_handler DEFINITION *----------------------------------------------------------------------* * CLASS lcl_handler IMPLEMENTATION *----------------------------------------------------------------------* CLASS lcl_handler IMPLEMENTATION. METHOD status_clicked. p_status = status. ENDMETHOD. "status_clicked ENDCLASS. "lcl_handler IMPLEMENTATION INITIALIZATION. DATA lr_dock TYPE REF TO cl_gui_docking_container. DATA lr_handler TYPE REF TO lcl_handler. DATA lr_status TYPE REF TO lcl_status. CREATE OBJECT lr_dock EXPORTING side = lr_dock->dock_at_left extension = 250 no_autodef_progid_dynnr = 'X'. CREATE OBJECT lr_handler. CREATE OBJECT lr_status EXPORTING status = p_status container = lr_dock. SET HANDLER lr_handler->status_clicked FOR lr_status. DATA lt_html TYPE TABLE OF text1000. lr_status->get_html( IMPORTING html = lt_html ). AT SELECTION-SCREEN. lr_status->set_status( p_status ).
27.768966
72
0.535949
9878bdc523d3d4338ce6a2e979df860c32697b22
162,446
abap
ABAP
src/zcl_excel_worksheet.clas.abap
AndreaBorgia-Abo/abap2xlsx
2818544c9a581ab88791d5dbdbdea8c868558ab3
[ "Apache-2.0" ]
251
2019-02-23T03:36:38.000Z
2021-12-10T21:39:23.000Z
src/zcl_excel_worksheet.clas.abap
AndreaBorgia-Abo/abap2xlsx
2818544c9a581ab88791d5dbdbdea8c868558ab3
[ "Apache-2.0" ]
278
2019-02-17T10:42:59.000Z
2021-12-10T20:24:56.000Z
src/zcl_excel_worksheet.clas.abap
AndreaBorgia-Abo/abap2xlsx
2818544c9a581ab88791d5dbdbdea8c868558ab3
[ "Apache-2.0" ]
130
2019-02-20T13:25:30.000Z
2021-12-09T03:20:31.000Z
CLASS zcl_excel_worksheet DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. *"* public components of class ZCL_EXCEL_WORKSHEET *"* do not include other source files here!!! *"* protected components of class ZCL_EXCEL_WORKSHEET *"* do not include other source files here!!! *"* protected components of class ZCL_EXCEL_WORKSHEET *"* do not include other source files here!!! TYPE-POOLS abap . TYPE-POOLS slis . TYPE-POOLS soi . INTERFACES zif_excel_sheet_printsettings . INTERFACES zif_excel_sheet_properties . INTERFACES zif_excel_sheet_protection . INTERFACES zif_excel_sheet_vba_project . TYPES: BEGIN OF mty_s_outline_row, row_from TYPE i, row_to TYPE i, collapsed TYPE abap_bool, END OF mty_s_outline_row . TYPES: mty_ts_outlines_row TYPE SORTED TABLE OF mty_s_outline_row WITH UNIQUE KEY row_from row_to . TYPES: BEGIN OF mty_s_ignored_errors, "! Cell reference (e.g. "A1") or list like "A1 A2" or range "A1:G1" cell_coords TYPE zexcel_cell_coords, "! Ignore errors when cells contain formulas that result in an error. eval_error TYPE abap_bool, "! Ignore errors when formulas contain text formatted cells with years represented as 2 digits. two_digit_text_year TYPE abap_bool, "! Ignore errors when numbers are formatted as text or are preceded by an apostrophe. number_stored_as_text TYPE abap_bool, "! Ignore errors when a formula in a region of your WorkSheet differs from other formulas in the same region. formula TYPE abap_bool, "! Ignore errors when formulas omit certain cells in a region. formula_range TYPE abap_bool, "! Ignore errors when unlocked cells contain formulas. unlocked_formula TYPE abap_bool, "! Ignore errors when formulas refer to empty cells. empty_cell_reference TYPE abap_bool, "! Ignore errors when a cell's value in a Table does not comply with the Data Validation rules specified. list_data_validation TYPE abap_bool, "! Ignore errors when cells contain a value different from a calculated column formula. "! In other words, for a calculated column, a cell in that column is considered to have an error "! if its formula is different from the calculated column formula, or doesn't contain a formula at all. calculated_column TYPE abap_bool, END OF mty_s_ignored_errors, mty_th_ignored_errors TYPE HASHED TABLE OF mty_s_ignored_errors WITH UNIQUE KEY cell_coords, BEGIN OF mty_s_column_formula, id TYPE i, column TYPE zexcel_cell_column, formula TYPE string, table_top_left_row TYPE zexcel_cell_row, table_bottom_right_row TYPE zexcel_cell_row, table_left_column_int TYPE zexcel_cell_column, table_right_column_int TYPE zexcel_cell_column, END OF mty_s_column_formula . TYPES: mty_th_column_formula TYPE HASHED TABLE OF mty_s_column_formula WITH UNIQUE KEY id . TYPES ty_doc_url TYPE c LENGTH 255. TYPES: BEGIN OF mty_merge, row_from TYPE i, row_to TYPE i, col_from TYPE i, col_to TYPE i, END OF mty_merge . TYPES: mty_ts_merge TYPE SORTED TABLE OF mty_merge WITH UNIQUE KEY table_line . TYPES ty_area TYPE c LENGTH 1. CONSTANTS c_break_column TYPE zexcel_break VALUE 2. "#EC NOTEXT CONSTANTS c_break_none TYPE zexcel_break VALUE 0. "#EC NOTEXT CONSTANTS c_break_row TYPE zexcel_break VALUE 1. "#EC NOTEXT CONSTANTS: BEGIN OF c_area, whole TYPE ty_area VALUE 'W', "#EC NOTEXT topleft TYPE ty_area VALUE 'T', "#EC NOTEXT END OF c_area. DATA excel TYPE REF TO zcl_excel READ-ONLY . DATA print_gridlines TYPE zexcel_print_gridlines READ-ONLY VALUE abap_false. "#EC NOTEXT DATA sheet_content TYPE zexcel_t_cell_data . DATA sheet_setup TYPE REF TO zcl_excel_sheet_setup . DATA show_gridlines TYPE zexcel_show_gridlines READ-ONLY VALUE abap_true. "#EC NOTEXT DATA show_rowcolheaders TYPE zexcel_show_gridlines READ-ONLY VALUE abap_true. "#EC NOTEXT DATA styles TYPE zexcel_t_sheet_style . DATA tabcolor TYPE zexcel_s_tabcolor READ-ONLY . DATA column_formulas TYPE mty_th_column_formula READ-ONLY . CLASS-DATA: BEGIN OF c_messages READ-ONLY, formula_id_only_is_possible TYPE string, column_formula_id_not_found TYPE string, formula_not_in_this_table TYPE string, formula_in_other_column TYPE string, END OF c_messages. DATA mt_merged_cells TYPE mty_ts_merge READ-ONLY . METHODS add_comment IMPORTING !ip_comment TYPE REF TO zcl_excel_comment . METHODS add_drawing IMPORTING !ip_drawing TYPE REF TO zcl_excel_drawing . METHODS add_new_column IMPORTING !ip_column TYPE simple RETURNING VALUE(eo_column) TYPE REF TO zcl_excel_column RAISING zcx_excel . METHODS add_new_style_cond IMPORTING !ip_dimension_range TYPE string DEFAULT 'A1' RETURNING VALUE(eo_style_cond) TYPE REF TO zcl_excel_style_cond. METHODS add_new_data_validation RETURNING VALUE(eo_data_validation) TYPE REF TO zcl_excel_data_validation . METHODS add_new_range RETURNING VALUE(eo_range) TYPE REF TO zcl_excel_range . METHODS add_new_row IMPORTING !ip_row TYPE simple RETURNING VALUE(eo_row) TYPE REF TO zcl_excel_row . METHODS bind_alv IMPORTING !io_alv TYPE REF TO object !it_table TYPE STANDARD TABLE !i_top TYPE i DEFAULT 1 !i_left TYPE i DEFAULT 1 !table_style TYPE zexcel_table_style OPTIONAL !i_table TYPE abap_bool DEFAULT abap_true RAISING zcx_excel . METHODS bind_alv_ole2 IMPORTING !i_document_url TYPE ty_doc_url DEFAULT space !i_xls TYPE c DEFAULT space !i_save_path TYPE string !io_alv TYPE REF TO cl_gui_alv_grid !it_listheader TYPE slis_t_listheader OPTIONAL !i_top TYPE i DEFAULT 1 !i_left TYPE i DEFAULT 1 !i_columns_header TYPE c DEFAULT 'X' !i_columns_autofit TYPE c DEFAULT 'X' !i_format_col_header TYPE soi_format_item OPTIONAL !i_format_subtotal TYPE soi_format_item OPTIONAL !i_format_total TYPE soi_format_item OPTIONAL EXCEPTIONS miss_guide ex_transfer_kkblo_error fatal_error inv_data_range dim_mismatch_vkey dim_mismatch_sema error_in_sema . METHODS bind_table IMPORTING !ip_table TYPE STANDARD TABLE !it_field_catalog TYPE zexcel_t_fieldcatalog OPTIONAL !is_table_settings TYPE zexcel_s_table_settings OPTIONAL VALUE(iv_default_descr) TYPE c OPTIONAL !iv_no_line_if_empty TYPE abap_bool DEFAULT abap_false EXPORTING !es_table_settings TYPE zexcel_s_table_settings RAISING zcx_excel . METHODS calculate_column_widths RAISING zcx_excel . METHODS change_area_style IMPORTING !ip_column_start TYPE simple !ip_column_end TYPE simple OPTIONAL !ip_row TYPE zexcel_cell_row !ip_row_to TYPE zexcel_cell_row OPTIONAL !ip_style_changer TYPE REF TO zif_excel_style_changer RAISING zcx_excel. METHODS change_cell_style IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row !ip_complete TYPE zexcel_s_cstyle_complete OPTIONAL !ip_xcomplete TYPE zexcel_s_cstylex_complete OPTIONAL !ip_font TYPE zexcel_s_cstyle_font OPTIONAL !ip_xfont TYPE zexcel_s_cstylex_font OPTIONAL !ip_fill TYPE zexcel_s_cstyle_fill OPTIONAL !ip_xfill TYPE zexcel_s_cstylex_fill OPTIONAL !ip_borders TYPE zexcel_s_cstyle_borders OPTIONAL !ip_xborders TYPE zexcel_s_cstylex_borders OPTIONAL !ip_alignment TYPE zexcel_s_cstyle_alignment OPTIONAL !ip_xalignment TYPE zexcel_s_cstylex_alignment OPTIONAL !ip_number_format_format_code TYPE zexcel_number_format OPTIONAL !ip_protection TYPE zexcel_s_cstyle_protection OPTIONAL !ip_xprotection TYPE zexcel_s_cstylex_protection OPTIONAL !ip_font_bold TYPE flag OPTIONAL !ip_font_color TYPE zexcel_s_style_color OPTIONAL !ip_font_color_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_font_color_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_font_color_theme TYPE zexcel_style_color_theme OPTIONAL !ip_font_color_tint TYPE zexcel_style_color_tint OPTIONAL !ip_font_family TYPE zexcel_style_font_family OPTIONAL !ip_font_italic TYPE flag OPTIONAL !ip_font_name TYPE zexcel_style_font_name OPTIONAL !ip_font_scheme TYPE zexcel_style_font_scheme OPTIONAL !ip_font_size TYPE zexcel_style_font_size OPTIONAL !ip_font_strikethrough TYPE flag OPTIONAL !ip_font_underline TYPE flag OPTIONAL !ip_font_underline_mode TYPE zexcel_style_font_underline OPTIONAL !ip_fill_filltype TYPE zexcel_fill_type OPTIONAL !ip_fill_rotation TYPE zexcel_rotation OPTIONAL !ip_fill_fgcolor TYPE zexcel_s_style_color OPTIONAL !ip_fill_fgcolor_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_fill_fgcolor_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_fill_fgcolor_theme TYPE zexcel_style_color_theme OPTIONAL !ip_fill_fgcolor_tint TYPE zexcel_style_color_tint OPTIONAL !ip_fill_bgcolor TYPE zexcel_s_style_color OPTIONAL !ip_fill_bgcolor_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_fill_bgcolor_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_fill_bgcolor_theme TYPE zexcel_style_color_theme OPTIONAL !ip_fill_bgcolor_tint TYPE zexcel_style_color_tint OPTIONAL !ip_borders_allborders TYPE zexcel_s_cstyle_border OPTIONAL !ip_fill_gradtype_type TYPE zexcel_s_gradient_type-type OPTIONAL !ip_fill_gradtype_degree TYPE zexcel_s_gradient_type-degree OPTIONAL !ip_xborders_allborders TYPE zexcel_s_cstylex_border OPTIONAL !ip_borders_diagonal TYPE zexcel_s_cstyle_border OPTIONAL !ip_fill_gradtype_bottom TYPE zexcel_s_gradient_type-bottom OPTIONAL !ip_fill_gradtype_top TYPE zexcel_s_gradient_type-top OPTIONAL !ip_xborders_diagonal TYPE zexcel_s_cstylex_border OPTIONAL !ip_borders_diagonal_mode TYPE zexcel_diagonal OPTIONAL !ip_fill_gradtype_right TYPE zexcel_s_gradient_type-right OPTIONAL !ip_borders_down TYPE zexcel_s_cstyle_border OPTIONAL !ip_fill_gradtype_left TYPE zexcel_s_gradient_type-left OPTIONAL !ip_fill_gradtype_position1 TYPE zexcel_s_gradient_type-position1 OPTIONAL !ip_xborders_down TYPE zexcel_s_cstylex_border OPTIONAL !ip_borders_left TYPE zexcel_s_cstyle_border OPTIONAL !ip_fill_gradtype_position2 TYPE zexcel_s_gradient_type-position2 OPTIONAL !ip_fill_gradtype_position3 TYPE zexcel_s_gradient_type-position3 OPTIONAL !ip_xborders_left TYPE zexcel_s_cstylex_border OPTIONAL !ip_borders_right TYPE zexcel_s_cstyle_border OPTIONAL !ip_xborders_right TYPE zexcel_s_cstylex_border OPTIONAL !ip_borders_top TYPE zexcel_s_cstyle_border OPTIONAL !ip_xborders_top TYPE zexcel_s_cstylex_border OPTIONAL !ip_alignment_horizontal TYPE zexcel_alignment OPTIONAL !ip_alignment_vertical TYPE zexcel_alignment OPTIONAL !ip_alignment_textrotation TYPE zexcel_text_rotation OPTIONAL !ip_alignment_wraptext TYPE flag OPTIONAL !ip_alignment_shrinktofit TYPE flag OPTIONAL !ip_alignment_indent TYPE zexcel_indent OPTIONAL !ip_protection_hidden TYPE zexcel_cell_protection OPTIONAL !ip_protection_locked TYPE zexcel_cell_protection OPTIONAL !ip_borders_allborders_style TYPE zexcel_border OPTIONAL !ip_borders_allborders_color TYPE zexcel_s_style_color OPTIONAL !ip_borders_allbo_color_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_borders_allbo_color_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_borders_allbo_color_theme TYPE zexcel_style_color_theme OPTIONAL !ip_borders_allbo_color_tint TYPE zexcel_style_color_tint OPTIONAL !ip_borders_diagonal_style TYPE zexcel_border OPTIONAL !ip_borders_diagonal_color TYPE zexcel_s_style_color OPTIONAL !ip_borders_diagonal_color_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_borders_diagonal_color_inde TYPE zexcel_style_color_indexed OPTIONAL !ip_borders_diagonal_color_them TYPE zexcel_style_color_theme OPTIONAL !ip_borders_diagonal_color_tint TYPE zexcel_style_color_tint OPTIONAL !ip_borders_down_style TYPE zexcel_border OPTIONAL !ip_borders_down_color TYPE zexcel_s_style_color OPTIONAL !ip_borders_down_color_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_borders_down_color_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_borders_down_color_theme TYPE zexcel_style_color_theme OPTIONAL !ip_borders_down_color_tint TYPE zexcel_style_color_tint OPTIONAL !ip_borders_left_style TYPE zexcel_border OPTIONAL !ip_borders_left_color TYPE zexcel_s_style_color OPTIONAL !ip_borders_left_color_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_borders_left_color_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_borders_left_color_theme TYPE zexcel_style_color_theme OPTIONAL !ip_borders_left_color_tint TYPE zexcel_style_color_tint OPTIONAL !ip_borders_right_style TYPE zexcel_border OPTIONAL !ip_borders_right_color TYPE zexcel_s_style_color OPTIONAL !ip_borders_right_color_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_borders_right_color_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_borders_right_color_theme TYPE zexcel_style_color_theme OPTIONAL !ip_borders_right_color_tint TYPE zexcel_style_color_tint OPTIONAL !ip_borders_top_style TYPE zexcel_border OPTIONAL !ip_borders_top_color TYPE zexcel_s_style_color OPTIONAL !ip_borders_top_color_rgb TYPE zexcel_style_color_argb OPTIONAL !ip_borders_top_color_indexed TYPE zexcel_style_color_indexed OPTIONAL !ip_borders_top_color_theme TYPE zexcel_style_color_theme OPTIONAL !ip_borders_top_color_tint TYPE zexcel_style_color_tint OPTIONAL RETURNING VALUE(ep_guid) TYPE zexcel_cell_style RAISING zcx_excel . CLASS-METHODS class_constructor. METHODS constructor IMPORTING !ip_excel TYPE REF TO zcl_excel !ip_title TYPE zexcel_sheet_title OPTIONAL RAISING zcx_excel . METHODS delete_merge IMPORTING !ip_cell_column TYPE simple OPTIONAL !ip_cell_row TYPE zexcel_cell_row OPTIONAL RAISING zcx_excel . METHODS delete_row_outline IMPORTING !iv_row_from TYPE i !iv_row_to TYPE i RAISING zcx_excel . METHODS freeze_panes IMPORTING !ip_num_columns TYPE i OPTIONAL !ip_num_rows TYPE i OPTIONAL RAISING zcx_excel . METHODS get_active_cell RETURNING VALUE(ep_active_cell) TYPE string RAISING zcx_excel . METHODS get_cell IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row EXPORTING !ep_value TYPE zexcel_cell_value !ep_rc TYPE sysubrc !ep_style TYPE REF TO zcl_excel_style !ep_guid TYPE zexcel_cell_style !ep_formula TYPE zexcel_cell_formula !et_rtf TYPE zexcel_t_rtf RAISING zcx_excel . METHODS get_column IMPORTING !ip_column TYPE simple RETURNING VALUE(eo_column) TYPE REF TO zcl_excel_column RAISING zcx_excel . METHODS get_columns RETURNING VALUE(eo_columns) TYPE REF TO zcl_excel_columns . METHODS get_columns_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_style_cond_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_data_validations_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_data_validations_size RETURNING VALUE(ep_size) TYPE i . METHODS get_default_column RETURNING VALUE(eo_column) TYPE REF TO zcl_excel_column RAISING zcx_excel. METHODS get_default_excel_date_format RETURNING VALUE(ep_default_excel_date_format) TYPE zexcel_number_format . METHODS get_default_excel_time_format RETURNING VALUE(ep_default_excel_time_format) TYPE zexcel_number_format . METHODS get_default_row RETURNING VALUE(eo_row) TYPE REF TO zcl_excel_row . METHODS get_dimension_range RETURNING VALUE(ep_dimension_range) TYPE string RAISING zcx_excel . METHODS get_comments RETURNING VALUE(r_comments) TYPE REF TO zcl_excel_comments . METHODS get_drawings IMPORTING !ip_type TYPE zexcel_drawing_type OPTIONAL RETURNING VALUE(r_drawings) TYPE REF TO zcl_excel_drawings . METHODS get_comments_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_drawings_iterator IMPORTING !ip_type TYPE zexcel_drawing_type RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_freeze_cell EXPORTING !ep_row TYPE zexcel_cell_row !ep_column TYPE zexcel_cell_column . METHODS get_guid RETURNING VALUE(ep_guid) TYPE sysuuid_x16 . METHODS get_highest_column RETURNING VALUE(r_highest_column) TYPE zexcel_cell_column RAISING zcx_excel . METHODS get_highest_row RETURNING VALUE(r_highest_row) TYPE int4 RAISING zcx_excel . METHODS get_hyperlinks_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_hyperlinks_size RETURNING VALUE(ep_size) TYPE i . METHODS get_ignored_errors RETURNING VALUE(rt_ignored_errors) TYPE mty_th_ignored_errors. METHODS get_merge RETURNING VALUE(merge_range) TYPE string_table RAISING zcx_excel . METHODS get_pagebreaks RETURNING VALUE(ro_pagebreaks) TYPE REF TO zcl_excel_worksheet_pagebreaks RAISING zcx_excel . METHODS get_ranges_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_row IMPORTING !ip_row TYPE int4 RETURNING VALUE(eo_row) TYPE REF TO zcl_excel_row . METHODS get_rows RETURNING VALUE(eo_rows) TYPE REF TO zcl_excel_rows . METHODS get_rows_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_row_outlines RETURNING VALUE(rt_row_outlines) TYPE mty_ts_outlines_row . METHODS get_style_cond IMPORTING !ip_guid TYPE zexcel_cell_style RETURNING VALUE(eo_style_cond) TYPE REF TO zcl_excel_style_cond . METHODS get_tabcolor RETURNING VALUE(ev_tabcolor) TYPE zexcel_s_tabcolor . METHODS get_tables_iterator RETURNING VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_tables_size RETURNING VALUE(ep_size) TYPE i . METHODS get_title IMPORTING !ip_escaped TYPE flag DEFAULT '' RETURNING VALUE(ep_title) TYPE zexcel_sheet_title . METHODS is_cell_merged IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row RETURNING VALUE(rp_is_merged) TYPE abap_bool RAISING zcx_excel . METHODS set_cell IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row !ip_value TYPE simple OPTIONAL !ip_formula TYPE zexcel_cell_formula OPTIONAL !ip_style TYPE zexcel_cell_style OPTIONAL !ip_hyperlink TYPE REF TO zcl_excel_hyperlink OPTIONAL !ip_data_type TYPE zexcel_cell_data_type OPTIONAL !ip_abap_type TYPE abap_typekind OPTIONAL !it_rtf TYPE zexcel_t_rtf OPTIONAL !ip_column_formula_id TYPE mty_s_column_formula-id OPTIONAL RAISING zcx_excel . METHODS set_cell_formula IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row !ip_formula TYPE zexcel_cell_formula RAISING zcx_excel . METHODS set_cell_style IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row !ip_style TYPE zexcel_cell_style RAISING zcx_excel . METHODS set_column_width IMPORTING !ip_column TYPE simple !ip_width_fix TYPE simple DEFAULT 0 !ip_width_autosize TYPE flag DEFAULT 'X' RAISING zcx_excel . METHODS set_default_excel_date_format IMPORTING !ip_default_excel_date_format TYPE zexcel_number_format RAISING zcx_excel . METHODS set_ignored_errors IMPORTING it_ignored_errors TYPE mty_th_ignored_errors. METHODS set_merge IMPORTING !ip_column_start TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_min_col !ip_column_end TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_max_col !ip_row TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_min_row !ip_row_to TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_max_row !ip_style TYPE zexcel_cell_style OPTIONAL "added parameter !ip_value TYPE simple OPTIONAL "added parameter !ip_formula TYPE zexcel_cell_formula OPTIONAL "added parameter RAISING zcx_excel . METHODS set_print_gridlines IMPORTING !i_print_gridlines TYPE zexcel_print_gridlines . METHODS set_row_height IMPORTING !ip_row TYPE simple !ip_height_fix TYPE simple RAISING zcx_excel . METHODS set_row_outline IMPORTING !iv_row_from TYPE i !iv_row_to TYPE i !iv_collapsed TYPE abap_bool RAISING zcx_excel . METHODS set_show_gridlines IMPORTING !i_show_gridlines TYPE zexcel_show_gridlines . METHODS set_show_rowcolheaders IMPORTING !i_show_rowcolheaders TYPE zexcel_show_rowcolheader . METHODS set_tabcolor IMPORTING !iv_tabcolor TYPE zexcel_s_tabcolor . METHODS set_table IMPORTING !ip_table TYPE STANDARD TABLE !ip_hdr_style TYPE zexcel_cell_style OPTIONAL !ip_body_style TYPE zexcel_cell_style OPTIONAL !ip_table_title TYPE string !ip_top_left_column TYPE zexcel_cell_column_alpha DEFAULT 'B' !ip_top_left_row TYPE zexcel_cell_row DEFAULT 3 !ip_transpose TYPE abap_bool OPTIONAL !ip_no_header TYPE abap_bool OPTIONAL RAISING zcx_excel . METHODS set_title IMPORTING !ip_title TYPE zexcel_sheet_title RAISING zcx_excel . METHODS get_table IMPORTING !iv_skipped_rows TYPE int4 DEFAULT 0 !iv_skipped_cols TYPE int4 DEFAULT 0 !iv_max_col TYPE int4 OPTIONAL !iv_max_row TYPE int4 OPTIONAL EXPORTING !et_table TYPE STANDARD TABLE RAISING zcx_excel . METHODS set_merge_style IMPORTING !ip_column_start TYPE simple OPTIONAL !ip_column_end TYPE simple OPTIONAL !ip_row TYPE zexcel_cell_row OPTIONAL !ip_row_to TYPE zexcel_cell_row OPTIONAL !ip_style TYPE zexcel_cell_style OPTIONAL RAISING zcx_excel . METHODS set_area_formula IMPORTING !ip_column_start TYPE simple !ip_column_end TYPE simple OPTIONAL !ip_row TYPE zexcel_cell_row !ip_row_to TYPE zexcel_cell_row OPTIONAL !ip_formula TYPE zexcel_cell_formula !ip_merge TYPE abap_bool OPTIONAL !ip_area TYPE ty_area DEFAULT c_area-topleft RAISING zcx_excel . METHODS set_area_style IMPORTING !ip_column_start TYPE simple !ip_column_end TYPE simple OPTIONAL !ip_row TYPE zexcel_cell_row !ip_row_to TYPE zexcel_cell_row OPTIONAL !ip_style TYPE zexcel_cell_style !ip_merge TYPE abap_bool OPTIONAL RAISING zcx_excel . METHODS set_area IMPORTING !ip_column_start TYPE simple !ip_column_end TYPE simple OPTIONAL !ip_row TYPE zexcel_cell_row !ip_row_to TYPE zexcel_cell_row OPTIONAL !ip_value TYPE simple OPTIONAL !ip_formula TYPE zexcel_cell_formula OPTIONAL !ip_style TYPE zexcel_cell_style OPTIONAL !ip_hyperlink TYPE REF TO zcl_excel_hyperlink OPTIONAL !ip_data_type TYPE zexcel_cell_data_type OPTIONAL !ip_abap_type TYPE abap_typekind OPTIONAL !ip_merge TYPE abap_bool OPTIONAL !ip_area TYPE ty_area DEFAULT c_area-topleft RAISING zcx_excel . METHODS get_header_footer_drawings RETURNING VALUE(rt_drawings) TYPE zexcel_t_drawings . METHODS set_area_hyperlink IMPORTING !ip_column_start TYPE simple !ip_column_end TYPE simple OPTIONAL !ip_row TYPE zexcel_cell_row !ip_row_to TYPE zexcel_cell_row OPTIONAL !ip_url TYPE string !ip_is_internal TYPE abap_bool RAISING zcx_excel . PROTECTED SECTION. PRIVATE SECTION. *"* private components of class ZCL_EXCEL_WORKSHEET *"* do not include other source files here!!! DATA active_cell TYPE zexcel_s_cell_data . DATA charts TYPE REF TO zcl_excel_drawings . DATA columns TYPE REF TO zcl_excel_columns . DATA row_default TYPE REF TO zcl_excel_row . DATA column_default TYPE REF TO zcl_excel_column . DATA styles_cond TYPE REF TO zcl_excel_styles_cond . DATA data_validations TYPE REF TO zcl_excel_data_validations . DATA default_excel_date_format TYPE zexcel_number_format . DATA default_excel_time_format TYPE zexcel_number_format . DATA comments TYPE REF TO zcl_excel_comments . DATA drawings TYPE REF TO zcl_excel_drawings . DATA freeze_pane_cell_column TYPE zexcel_cell_column . DATA freeze_pane_cell_row TYPE zexcel_cell_row . DATA guid TYPE sysuuid_x16 . DATA hyperlinks TYPE REF TO cl_object_collection . DATA lower_cell TYPE zexcel_s_cell_data . DATA mo_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks . DATA mt_row_outlines TYPE mty_ts_outlines_row . DATA print_title_col_from TYPE zexcel_cell_column_alpha . DATA print_title_col_to TYPE zexcel_cell_column_alpha . DATA print_title_row_from TYPE zexcel_cell_row . DATA print_title_row_to TYPE zexcel_cell_row . DATA ranges TYPE REF TO zcl_excel_ranges . DATA rows TYPE REF TO zcl_excel_rows . DATA tables TYPE REF TO cl_object_collection . DATA title TYPE zexcel_sheet_title VALUE 'Worksheet'. "#EC NOTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . " . DATA upper_cell TYPE zexcel_s_cell_data . DATA mt_ignored_errors TYPE mty_th_ignored_errors. DATA right_to_left TYPE abap_bool. METHODS calculate_cell_width IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row RETURNING VALUE(ep_width) TYPE float RAISING zcx_excel . CLASS-METHODS check_cell_column_formula IMPORTING it_column_formulas TYPE mty_th_column_formula ip_column_formula_id TYPE mty_s_column_formula-id ip_formula TYPE zexcel_cell_formula ip_value TYPE simple ip_row TYPE zexcel_cell_row ip_column TYPE zexcel_cell_column RAISING zcx_excel. METHODS check_rtf IMPORTING !ip_value TYPE simple VALUE(ip_style) TYPE zexcel_cell_style OPTIONAL CHANGING !ct_rtf TYPE zexcel_t_rtf RAISING zcx_excel . METHODS clear_initial_colorxfields IMPORTING is_color TYPE zexcel_s_style_color CHANGING cs_xcolor TYPE zexcel_s_cstylex_color. METHODS generate_title RETURNING VALUE(ep_title) TYPE zexcel_sheet_title . METHODS get_value_type IMPORTING !ip_value TYPE simple EXPORTING !ep_value TYPE simple !ep_value_type TYPE abap_typekind . METHODS move_supplied_borders IMPORTING iv_border_supplied TYPE abap_bool is_border TYPE zexcel_s_cstyle_border iv_xborder_supplied TYPE abap_bool is_xborder TYPE zexcel_s_cstylex_border CHANGING cs_complete_style_border TYPE zexcel_s_cstyle_border cs_complete_stylex_border TYPE zexcel_s_cstylex_border. METHODS print_title_set_range . METHODS update_dimension_range RAISING zcx_excel . ENDCLASS. CLASS zcl_excel_worksheet IMPLEMENTATION. METHOD add_comment. comments->include( ip_comment ). ENDMETHOD. "add_comment METHOD add_drawing. CASE ip_drawing->get_type( ). WHEN zcl_excel_drawing=>type_image. drawings->include( ip_drawing ). WHEN zcl_excel_drawing=>type_chart. charts->include( ip_drawing ). ENDCASE. ENDMETHOD. "ADD_DRAWING METHOD add_new_column. DATA: lv_column_alpha TYPE zexcel_cell_column_alpha. lv_column_alpha = zcl_excel_common=>convert_column2alpha( ip_column ). CREATE OBJECT eo_column EXPORTING ip_index = lv_column_alpha ip_excel = me->excel ip_worksheet = me. columns->add( eo_column ). ENDMETHOD. "ADD_NEW_COLUMN METHOD add_new_data_validation. CREATE OBJECT eo_data_validation. data_validations->add( eo_data_validation ). ENDMETHOD. "ADD_NEW_DATA_VALIDATION METHOD add_new_range. * Create default blank range CREATE OBJECT eo_range. ranges->add( eo_range ). ENDMETHOD. "ADD_NEW_RANGE METHOD add_new_row. CREATE OBJECT eo_row EXPORTING ip_index = ip_row. rows->add( eo_row ). ENDMETHOD. "ADD_NEW_ROW METHOD add_new_style_cond. CREATE OBJECT eo_style_cond EXPORTING ip_dimension_range = ip_dimension_range. styles_cond->add( eo_style_cond ). ENDMETHOD. "ADD_NEW_STYLE_COND METHOD bind_alv. DATA: lo_converter TYPE REF TO zcl_excel_converter. CREATE OBJECT lo_converter. TRY. lo_converter->convert( EXPORTING io_alv = io_alv it_table = it_table i_row_int = i_top i_column_int = i_left i_table = i_table i_style_table = table_style io_worksheet = me CHANGING co_excel = excel ). CATCH zcx_excel . ENDTRY. ENDMETHOD. "BIND_ALV METHOD bind_alv_ole2. CALL METHOD ('ZCL_EXCEL_OLE')=>('BIND_ALV_OLE2') EXPORTING i_document_url = i_document_url i_xls = i_xls i_save_path = i_save_path io_alv = io_alv it_listheader = it_listheader i_top = i_top i_left = i_left i_columns_header = i_columns_header i_columns_autofit = i_columns_autofit i_format_col_header = i_format_col_header i_format_subtotal = i_format_subtotal i_format_total = i_format_total EXCEPTIONS miss_guide = 1 ex_transfer_kkblo_error = 2 fatal_error = 3 inv_data_range = 4 dim_mismatch_vkey = 5 dim_mismatch_sema = 6 error_in_sema = 7 OTHERS = 8. IF sy-subrc <> 0. CASE sy-subrc. WHEN 1. RAISE miss_guide. WHEN 2. RAISE ex_transfer_kkblo_error. WHEN 3. RAISE fatal_error. WHEN 4. RAISE inv_data_range. WHEN 5. RAISE dim_mismatch_vkey. WHEN 6. RAISE dim_mismatch_sema. WHEN 7. RAISE error_in_sema. ENDCASE. ENDIF. ENDMETHOD. "BIND_ALV_OLE2 METHOD bind_table. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmöcker, (wi p) 2012-12-01 * - ... * aligning code * message made to support multilinguality *--------------------------------------------------------------------* * issue #237 - Check if overlapping areas exist * - Alessandro Iannacci 2012-12-01 * changes: - Added raise if overlaps are detected *--------------------------------------------------------------------* CONSTANTS: lc_top_left_column TYPE zexcel_cell_column_alpha VALUE 'A', lc_top_left_row TYPE zexcel_cell_row VALUE 1. DATA: lv_row_int TYPE zexcel_cell_row, lv_first_row TYPE zexcel_cell_row, lv_last_row TYPE zexcel_cell_row, lv_column_int TYPE zexcel_cell_column, lv_column_alpha TYPE zexcel_cell_column_alpha, lt_field_catalog TYPE zexcel_t_fieldcatalog, lv_id TYPE i, lv_rows TYPE i, lv_formula TYPE string, ls_settings TYPE zexcel_s_table_settings, lo_table TYPE REF TO zcl_excel_table, lt_column_name_buffer TYPE SORTED TABLE OF string WITH UNIQUE KEY table_line, lv_value TYPE string, lv_value_lowercase TYPE string, lv_syindex TYPE c LENGTH 3, lv_errormessage TYPE string, "ins issue #237 lv_columns TYPE i, lt_columns TYPE zexcel_t_fieldcatalog, lv_maxcol TYPE i, lv_maxrow TYPE i, lo_iterator TYPE REF TO cl_object_collection_iterator, lo_style_cond TYPE REF TO zcl_excel_style_cond, lo_curtable TYPE REF TO zcl_excel_table. DATA: ls_column_formula TYPE mty_s_column_formula, lv_mincol TYPE i. FIELD-SYMBOLS: <ls_field_catalog> TYPE zexcel_s_fieldcatalog, <ls_field_catalog_custom> TYPE zexcel_s_fieldcatalog, <fs_table_line> TYPE any, <fs_fldval> TYPE any. ls_settings = is_table_settings. IF ls_settings-top_left_column IS INITIAL. ls_settings-top_left_column = lc_top_left_column. ENDIF. IF ls_settings-table_style IS INITIAL. ls_settings-table_style = zcl_excel_table=>builtinstyle_medium2. ENDIF. IF ls_settings-top_left_row IS INITIAL. ls_settings-top_left_row = lc_top_left_row. ENDIF. IF it_field_catalog IS NOT SUPPLIED. lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = ip_table ). ELSE. lt_field_catalog = it_field_catalog. ENDIF. SORT lt_field_catalog BY position. *--------------------------------------------------------------------* * issue #237 Check if overlapping areas exist Start *--------------------------------------------------------------------* "Get the number of columns for the current table lt_columns = lt_field_catalog. DELETE lt_columns WHERE dynpfld NE abap_true. DESCRIBE TABLE lt_columns LINES lv_columns. "Calculate the top left row of the current table lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ). lv_row_int = ls_settings-top_left_row. "Get number of row for the current table DESCRIBE TABLE ip_table LINES lv_rows. "Calculate the bottom right row for the current table lv_maxcol = lv_column_int + lv_columns - 1. lv_maxrow = lv_row_int + lv_rows - 1. ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( lv_maxcol ). ls_settings-bottom_right_row = lv_maxrow. lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ). lo_iterator = me->tables->get_iterator( ). WHILE lo_iterator->has_next( ) EQ abap_true. lo_curtable ?= lo_iterator->get_next( ). IF ( ( ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row ) OR ( ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row ) ) AND ( ( lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) ) OR ( lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) ) ). lv_errormessage = 'Table overlaps with previously bound table and will not be added to worksheet.'(400). zcx_excel=>raise_text( lv_errormessage ). ENDIF. ENDWHILE. *--------------------------------------------------------------------* * issue #237 Check if overlapping areas exist End *--------------------------------------------------------------------* CREATE OBJECT lo_table. lo_table->settings = ls_settings. lo_table->set_data( ir_data = ip_table ). lv_id = me->excel->get_next_table_id( ). lo_table->set_id( iv_id = lv_id ). * lo_table->fieldcat = lt_field_catalog[]. me->tables->add( lo_table ). * It is better to loop column by column (only visible column) LOOP AT lt_field_catalog ASSIGNING <ls_field_catalog> WHERE dynpfld EQ abap_true. lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ). " Due restrinction of new table object we cannot have two column with the same name " Check if a column with the same name exists, if exists add a counter " If no medium description is provided we try to use small or long * lv_value = <ls_field_catalog>-scrtext_m. FIELD-SYMBOLS: <scrtxt1> TYPE any, <scrtxt2> TYPE any, <scrtxt3> TYPE any. CASE iv_default_descr. WHEN 'M'. ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>. ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>. ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>. WHEN 'S'. ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt1>. ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>. ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>. WHEN 'L'. ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt1>. ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>. ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt3>. WHEN OTHERS. ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>. ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>. ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>. ENDCASE. IF <scrtxt1> IS NOT INITIAL. lv_value = <scrtxt1>. <ls_field_catalog>-scrtext_l = lv_value. ELSEIF <scrtxt2> IS NOT INITIAL. lv_value = <scrtxt2>. <ls_field_catalog>-scrtext_l = lv_value. ELSEIF <scrtxt3> IS NOT INITIAL. lv_value = <scrtxt3>. <ls_field_catalog>-scrtext_l = lv_value. ELSE. lv_value = 'Column'. " default value as Excel does <ls_field_catalog>-scrtext_l = lv_value. ENDIF. WHILE 1 = 1. lv_value_lowercase = lv_value. TRANSLATE lv_value_lowercase TO LOWER CASE. READ TABLE lt_column_name_buffer TRANSPORTING NO FIELDS WITH KEY table_line = lv_value_lowercase BINARY SEARCH. IF sy-subrc <> 0. <ls_field_catalog>-scrtext_l = lv_value. INSERT lv_value_lowercase INTO TABLE lt_column_name_buffer. EXIT. ELSE. lv_syindex = sy-index. CONCATENATE <ls_field_catalog>-scrtext_l lv_syindex INTO lv_value. ENDIF. ENDWHILE. " First of all write column header IF <ls_field_catalog>-style_header IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = lv_value ip_style = <ls_field_catalog>-style_header ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = lv_value ). ENDIF. IF <ls_field_catalog>-column_formula IS NOT INITIAL. ls_column_formula-id = lines( column_formulas ) + 1. ls_column_formula-column = lv_column_int. ls_column_formula-formula = <ls_field_catalog>-column_formula. ls_column_formula-table_top_left_row = lo_table->settings-top_left_row. ls_column_formula-table_bottom_right_row = lo_table->settings-bottom_right_row. ls_column_formula-table_left_column_int = lv_mincol. ls_column_formula-table_right_column_int = lv_maxcol. INSERT ls_column_formula INTO TABLE column_formulas. ENDIF. ADD 1 TO lv_row_int. LOOP AT ip_table ASSIGNING <fs_table_line>. ASSIGN COMPONENT <ls_field_catalog>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>. " issue #290 Add formula support in table IF <ls_field_catalog>-formula EQ abap_true. IF <ls_field_catalog>-style IS NOT INITIAL. IF <ls_field_catalog>-abap_type IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_formula = <fs_fldval> ip_abap_type = <ls_field_catalog>-abap_type ip_style = <ls_field_catalog>-style ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_formula = <fs_fldval> ip_style = <ls_field_catalog>-style ). ENDIF. ELSEIF <ls_field_catalog>-abap_type IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_formula = <fs_fldval> ip_abap_type = <ls_field_catalog>-abap_type ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_formula = <fs_fldval> ). ENDIF. ELSEIF <ls_field_catalog>-column_formula IS NOT INITIAL. " Column formulas IF <ls_field_catalog>-style IS NOT INITIAL. IF <ls_field_catalog>-abap_type IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_column_formula_id = ls_column_formula-id ip_abap_type = <ls_field_catalog>-abap_type ip_style = <ls_field_catalog>-style ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_column_formula_id = ls_column_formula-id ip_style = <ls_field_catalog>-style ). ENDIF. ELSEIF <ls_field_catalog>-abap_type IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_column_formula_id = ls_column_formula-id ip_abap_type = <ls_field_catalog>-abap_type ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_column_formula_id = ls_column_formula-id ). ENDIF. ELSE. IF <ls_field_catalog>-style IS NOT INITIAL. IF <ls_field_catalog>-abap_type IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = <fs_fldval> ip_abap_type = <ls_field_catalog>-abap_type ip_style = <ls_field_catalog>-style ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = <fs_fldval> ip_style = <ls_field_catalog>-style ). ENDIF. ELSE. IF <ls_field_catalog>-abap_type IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_abap_type = <ls_field_catalog>-abap_type ip_value = <fs_fldval> ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = <fs_fldval> ). ENDIF. ENDIF. ENDIF. ADD 1 TO lv_row_int. ENDLOOP. IF sy-subrc <> 0 AND iv_no_line_if_empty = abap_false. "create empty row if table has no data me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = space ). ADD 1 TO lv_row_int. ENDIF. *--------------------------------------------------------------------* " totals *--------------------------------------------------------------------* IF <ls_field_catalog>-totals_function IS NOT INITIAL. lv_formula = lo_table->get_totals_formula( ip_column = <ls_field_catalog>-scrtext_l ip_function = <ls_field_catalog>-totals_function ). IF <ls_field_catalog>-style_total IS NOT INITIAL. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_formula = lv_formula ip_style = <ls_field_catalog>-style_total ). ELSE. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_formula = lv_formula ). ENDIF. ENDIF. lv_row_int = ls_settings-top_left_row. ADD 1 TO lv_column_int. *--------------------------------------------------------------------* " conditional formatting *--------------------------------------------------------------------* IF <ls_field_catalog>-style_cond IS NOT INITIAL. lv_first_row = ls_settings-top_left_row + 1. " +1 to exclude header lv_last_row = ls_settings-top_left_row + lv_rows. lo_style_cond = me->get_style_cond( <ls_field_catalog>-style_cond ). lo_style_cond->set_range( ip_start_column = lv_column_alpha ip_start_row = lv_first_row ip_stop_column = lv_column_alpha ip_stop_row = lv_last_row ). ENDIF. ENDLOOP. *--------------------------------------------------------------------* " Set field catalog *--------------------------------------------------------------------* lo_table->fieldcat = lt_field_catalog[]. es_table_settings = ls_settings. es_table_settings-bottom_right_column = lv_column_alpha. " >> Issue #291 IF ip_table IS INITIAL. es_table_settings-bottom_right_row = ls_settings-top_left_row + 2. "Last rows ELSE. es_table_settings-bottom_right_row = ls_settings-top_left_row + lv_rows + 1. "Last rows ENDIF. " << Issue #291 ENDMETHOD. "BIND_TABLE METHOD calculate_cell_width. *--------------------------------------------------------------------* * issue #293 - Roberto Bianco * - Christian Assig 2014-03-14 * * changes: - Calculate widths using SAPscript font metrics * (transaction SE73) * - Calculate the width of dates * - Add additional width for auto filter buttons * - Add cell padding to simulate Excel behavior *--------------------------------------------------------------------* DATA: ld_cell_value TYPE zexcel_cell_value, ld_style_guid TYPE zexcel_cell_style, ls_stylemapping TYPE zexcel_s_stylemapping, lo_table_object TYPE REF TO object, lo_table TYPE REF TO zcl_excel_table, ld_table_top_left_column TYPE zexcel_cell_column, ld_table_bottom_right_column TYPE zexcel_cell_column, ld_flag_contains_auto_filter TYPE abap_bool VALUE abap_false, ld_flag_bold TYPE abap_bool VALUE abap_false, ld_flag_italic TYPE abap_bool VALUE abap_false, ld_date TYPE d, ld_date_char TYPE c LENGTH 50, ld_font_height TYPE tdfontsize VALUE zcl_excel_font=>lc_default_font_height, ld_font_name TYPE zexcel_style_font_name VALUE zcl_excel_font=>lc_default_font_name. " Determine cell content and cell style me->get_cell( EXPORTING ip_column = ip_column ip_row = ip_row IMPORTING ep_value = ld_cell_value ep_guid = ld_style_guid ). " ABAP2XLSX uses tables to define areas containing headers and " auto-filters. Find out if the current cell is in the header " of one of these tables. LOOP AT me->tables->collection INTO lo_table_object. " Downcast: OBJECT -> ZCL_EXCEL_TABLE lo_table ?= lo_table_object. " Convert column letters to corresponding integer values ld_table_top_left_column = zcl_excel_common=>convert_column2int( lo_table->settings-top_left_column ). ld_table_bottom_right_column = zcl_excel_common=>convert_column2int( lo_table->settings-bottom_right_column ). " Is the current cell part of the table header? IF ip_column BETWEEN ld_table_top_left_column AND ld_table_bottom_right_column AND ip_row EQ lo_table->settings-top_left_row. " Current cell is part of the table header " -> Assume that an auto filter is present and that the font is " bold ld_flag_contains_auto_filter = abap_true. ld_flag_bold = abap_true. ENDIF. ENDLOOP. " If a style GUID is present, read style attributes IF ld_style_guid IS NOT INITIAL. TRY. " Read style attributes ls_stylemapping = me->excel->get_style_to_guid( ld_style_guid ). " If the current cell contains the default date format, " convert the cell value to a date and calculate its length IF ls_stylemapping-complete_style-number_format-format_code = zcl_excel_style_number_format=>c_format_date_std. " Convert excel date to ABAP date ld_date = zcl_excel_common=>excel_string_to_date( ld_cell_value ). " Format ABAP date using user's formatting settings WRITE ld_date TO ld_date_char. " Remember the formatted date to calculate the cell size ld_cell_value = ld_date_char. ENDIF. " Read the font size and convert it to the font height " used by SAPscript (multiplication by 10) IF ls_stylemapping-complete_stylex-font-size = abap_true. ld_font_height = ls_stylemapping-complete_style-font-size * 10. ENDIF. " If set, remember the font name IF ls_stylemapping-complete_stylex-font-name = abap_true. ld_font_name = ls_stylemapping-complete_style-font-name. ENDIF. " If set, remember whether font is bold and italic. IF ls_stylemapping-complete_stylex-font-bold = abap_true. ld_flag_bold = ls_stylemapping-complete_style-font-bold. ENDIF. IF ls_stylemapping-complete_stylex-font-italic = abap_true. ld_flag_italic = ls_stylemapping-complete_style-font-italic. ENDIF. CATCH zcx_excel. "#EC NO_HANDLER " Style GUID is present, but style was not found " Continue with default values ENDTRY. ENDIF. ep_width = zcl_excel_font=>calculate_text_width( iv_font_name = ld_font_name iv_font_height = ld_font_height iv_flag_bold = ld_flag_bold iv_flag_italic = ld_flag_italic iv_cell_value = ld_cell_value ). " If the current cell contains an auto filter, make it a bit wider. " The size used by the auto filter button does not depend on the font " size. IF ld_flag_contains_auto_filter = abap_true. ADD 2 TO ep_width. ENDIF. ENDMETHOD. METHOD calculate_column_widths. TYPES: BEGIN OF t_auto_size, col_index TYPE int4, width TYPE float, END OF t_auto_size. TYPES: tt_auto_size TYPE TABLE OF t_auto_size. DATA: lo_column_iterator TYPE REF TO cl_object_collection_iterator, lo_column TYPE REF TO zcl_excel_column. DATA: auto_size TYPE flag. DATA: auto_sizes TYPE tt_auto_size. DATA: count TYPE int4. DATA: highest_row TYPE int4. DATA: width TYPE float. FIELD-SYMBOLS: <auto_size> LIKE LINE OF auto_sizes. lo_column_iterator = me->get_columns_iterator( ). WHILE lo_column_iterator->has_next( ) = abap_true. lo_column ?= lo_column_iterator->get_next( ). auto_size = lo_column->get_auto_size( ). IF auto_size = abap_true. APPEND INITIAL LINE TO auto_sizes ASSIGNING <auto_size>. <auto_size>-col_index = lo_column->get_column_index( ). <auto_size>-width = -1. ENDIF. ENDWHILE. " There is only something to do if there are some auto-size columns IF NOT auto_sizes IS INITIAL. highest_row = me->get_highest_row( ). LOOP AT auto_sizes ASSIGNING <auto_size>. count = 1. WHILE count <= highest_row. * Do not check merged cells IF is_cell_merged( ip_column = <auto_size>-col_index ip_row = count ) = abap_false. width = calculate_cell_width( ip_column = <auto_size>-col_index " issue #155 - less restrictive typing for ip_column ip_row = count ). IF width > <auto_size>-width. <auto_size>-width = width. ENDIF. ENDIF. count = count + 1. ENDWHILE. lo_column = me->get_column( <auto_size>-col_index ). " issue #155 - less restrictive typing for ip_column lo_column->set_width( <auto_size>-width ). ENDLOOP. ENDIF. ENDMETHOD. "CALCULATE_COLUMN_WIDTHS METHOD change_area_style. DATA: lv_row TYPE zexcel_cell_row, lv_row_start TYPE zexcel_cell_row, lv_row_to TYPE zexcel_cell_row, lv_column_int TYPE zexcel_cell_column_alpha, lv_column TYPE zexcel_cell_column_alpha, lv_column_start TYPE zexcel_cell_column_alpha, lv_column_end TYPE zexcel_cell_column_alpha, lv_column_start_int TYPE zexcel_cell_column_alpha, lv_column_end_int TYPE zexcel_cell_column_alpha. lv_row_to = ip_row_to. lv_row = ip_row. IF lv_row_to IS INITIAL OR ip_row_to IS NOT SUPPLIED. lv_row_to = lv_row. ENDIF. lv_column_start = ip_column_start. lv_column_end = ip_column_end. IF lv_column_end IS INITIAL OR ip_column_end IS NOT SUPPLIED. lv_column_end = lv_column_start. ENDIF. lv_column_start_int = zcl_excel_common=>convert_column2int( lv_column_start ). lv_column_end_int = zcl_excel_common=>convert_column2int( lv_column_end ). IF lv_column_start_int > lv_column_end_int OR lv_row > lv_row_to. RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'Wrong Merging Parameters'. ENDIF. lv_column_int = lv_column_start_int. lv_row_start = lv_row. WHILE lv_column_int <= lv_column_end_int. lv_column = zcl_excel_common=>convert_column2alpha( lv_column_int ). lv_row = lv_row_start. WHILE lv_row <= lv_row_to. ip_style_changer->apply( ip_worksheet = me ip_column = lv_column_int ip_row = lv_row ). ADD 1 TO lv_row. ENDWHILE. ADD 1 TO lv_column_int. ENDWHILE. ENDMETHOD. METHOD change_cell_style. DATA: changer TYPE REF TO zif_excel_style_changer. changer = zcl_excel_style_changer=>create( excel = excel ). IF ip_complete IS SUPPLIED. IF ip_xcomplete IS NOT SUPPLIED. zcx_excel=>raise_text( 'Complete styleinfo has to be supplied with corresponding X-field' ). ENDIF. changer->set_complete( ip_complete = ip_complete ip_xcomplete = ip_xcomplete ). ENDIF. IF ip_font IS SUPPLIED. IF ip_xfont IS SUPPLIED. changer->set_complete_font( ip_font = ip_font ip_xfont = ip_xfont ). ELSE. changer->set_complete_font( ip_font = ip_font ). ENDIF. ENDIF. IF ip_fill IS SUPPLIED. IF ip_xfill IS SUPPLIED. changer->set_complete_fill( ip_fill = ip_fill ip_xfill = ip_xfill ). ELSE. changer->set_complete_fill( ip_fill = ip_fill ). ENDIF. ENDIF. IF ip_borders IS SUPPLIED. IF ip_xborders IS SUPPLIED. changer->set_complete_borders( ip_borders = ip_borders ip_xborders = ip_xborders ). ELSE. changer->set_complete_borders( ip_borders = ip_borders ). ENDIF. ENDIF. IF ip_alignment IS SUPPLIED. IF ip_xalignment IS SUPPLIED. changer->set_complete_alignment( ip_alignment = ip_alignment ip_xalignment = ip_xalignment ). ELSE. changer->set_complete_alignment( ip_alignment = ip_alignment ). ENDIF. ENDIF. IF ip_protection IS SUPPLIED. IF ip_xprotection IS SUPPLIED. changer->set_complete_protection( ip_protection = ip_protection ip_xprotection = ip_xprotection ). ELSE. changer->set_complete_protection( ip_protection = ip_protection ). ENDIF. ENDIF. IF ip_borders_allborders IS SUPPLIED. IF ip_xborders_allborders IS SUPPLIED. changer->set_complete_borders_all( ip_borders_allborders = ip_borders_allborders ip_xborders_allborders = ip_xborders_allborders ). ELSE. changer->set_complete_borders_all( ip_borders_allborders = ip_borders_allborders ). ENDIF. ENDIF. IF ip_borders_diagonal IS SUPPLIED. IF ip_xborders_diagonal IS SUPPLIED. changer->set_complete_borders_diagonal( ip_borders_diagonal = ip_borders_diagonal ip_xborders_diagonal = ip_xborders_diagonal ). ELSE. changer->set_complete_borders_diagonal( ip_borders_diagonal = ip_borders_diagonal ). ENDIF. ENDIF. IF ip_borders_down IS SUPPLIED. IF ip_xborders_down IS SUPPLIED. changer->set_complete_borders_down( ip_borders_down = ip_borders_down ip_xborders_down = ip_xborders_down ). ELSE. changer->set_complete_borders_down( ip_borders_down = ip_borders_down ). ENDIF. ENDIF. IF ip_borders_left IS SUPPLIED. IF ip_xborders_left IS SUPPLIED. changer->set_complete_borders_left( ip_borders_left = ip_borders_left ip_xborders_left = ip_xborders_left ). ELSE. changer->set_complete_borders_left( ip_borders_left = ip_borders_left ). ENDIF. ENDIF. IF ip_borders_right IS SUPPLIED. IF ip_xborders_right IS SUPPLIED. changer->set_complete_borders_right( ip_borders_right = ip_borders_right ip_xborders_right = ip_xborders_right ). ELSE. changer->set_complete_borders_right( ip_borders_right = ip_borders_right ). ENDIF. ENDIF. IF ip_borders_top IS SUPPLIED. IF ip_xborders_top IS SUPPLIED. changer->set_complete_borders_top( ip_borders_top = ip_borders_top ip_xborders_top = ip_xborders_top ). ELSE. changer->set_complete_borders_top( ip_borders_top = ip_borders_top ). ENDIF. ENDIF. IF ip_number_format_format_code IS SUPPLIED. changer->set_number_format( ip_number_format_format_code ). ENDIF. IF ip_font_bold IS SUPPLIED. changer->set_font_bold( ip_font_bold ). ENDIF. IF ip_font_color IS SUPPLIED. changer->set_font_color( ip_font_color ). ENDIF. IF ip_font_color_rgb IS SUPPLIED. changer->set_font_color_rgb( ip_font_color_rgb ). ENDIF. IF ip_font_color_indexed IS SUPPLIED. changer->set_font_color_indexed( ip_font_color_indexed ). ENDIF. IF ip_font_color_theme IS SUPPLIED. changer->set_font_color_theme( ip_font_color_theme ). ENDIF. IF ip_font_color_tint IS SUPPLIED. changer->set_font_color_tint( ip_font_color_tint ). ENDIF. IF ip_font_family IS SUPPLIED. changer->set_font_family( ip_font_family ). ENDIF. IF ip_font_italic IS SUPPLIED. changer->set_font_italic( ip_font_italic ). ENDIF. IF ip_font_name IS SUPPLIED. changer->set_font_name( ip_font_name ). ENDIF. IF ip_font_scheme IS SUPPLIED. changer->set_font_scheme( ip_font_scheme ). ENDIF. IF ip_font_size IS SUPPLIED. changer->set_font_size( ip_font_size ). ENDIF. IF ip_font_strikethrough IS SUPPLIED. changer->set_font_strikethrough( ip_font_strikethrough ). ENDIF. IF ip_font_underline IS SUPPLIED. changer->set_font_underline( ip_font_underline ). ENDIF. IF ip_font_underline_mode IS SUPPLIED. changer->set_font_underline_mode( ip_font_underline_mode ). ENDIF. IF ip_fill_filltype IS SUPPLIED. changer->set_fill_filltype( ip_fill_filltype ). ENDIF. IF ip_fill_rotation IS SUPPLIED. changer->set_fill_rotation( ip_fill_rotation ). ENDIF. IF ip_fill_fgcolor IS SUPPLIED. changer->set_fill_fgcolor( ip_fill_fgcolor ). ENDIF. IF ip_fill_fgcolor_rgb IS SUPPLIED. changer->set_fill_fgcolor_rgb( ip_fill_fgcolor_rgb ). ENDIF. IF ip_fill_fgcolor_indexed IS SUPPLIED. changer->set_fill_fgcolor_indexed( ip_fill_fgcolor_indexed ). ENDIF. IF ip_fill_fgcolor_theme IS SUPPLIED. changer->set_fill_fgcolor_theme( ip_fill_fgcolor_theme ). ENDIF. IF ip_fill_fgcolor_tint IS SUPPLIED. changer->set_fill_fgcolor_tint( ip_fill_fgcolor_tint ). ENDIF. IF ip_fill_bgcolor IS SUPPLIED. changer->set_fill_bgcolor( ip_fill_bgcolor ). ENDIF. IF ip_fill_bgcolor_rgb IS SUPPLIED. changer->set_fill_bgcolor_rgb( ip_fill_bgcolor_rgb ). ENDIF. IF ip_fill_bgcolor_indexed IS SUPPLIED. changer->set_fill_bgcolor_indexed( ip_fill_bgcolor_indexed ). ENDIF. IF ip_fill_bgcolor_theme IS SUPPLIED. changer->set_fill_bgcolor_theme( ip_fill_bgcolor_theme ). ENDIF. IF ip_fill_bgcolor_tint IS SUPPLIED. changer->set_fill_bgcolor_tint( ip_fill_bgcolor_tint ). ENDIF. IF ip_fill_gradtype_type IS SUPPLIED. changer->set_fill_gradtype_type( ip_fill_gradtype_type ). ENDIF. IF ip_fill_gradtype_degree IS SUPPLIED. changer->set_fill_gradtype_degree( ip_fill_gradtype_degree ). ENDIF. IF ip_fill_gradtype_bottom IS SUPPLIED. changer->set_fill_gradtype_bottom( ip_fill_gradtype_bottom ). ENDIF. IF ip_fill_gradtype_left IS SUPPLIED. changer->set_fill_gradtype_left( ip_fill_gradtype_left ). ENDIF. IF ip_fill_gradtype_top IS SUPPLIED. changer->set_fill_gradtype_top( ip_fill_gradtype_top ). ENDIF. IF ip_fill_gradtype_right IS SUPPLIED. changer->set_fill_gradtype_right( ip_fill_gradtype_right ). ENDIF. IF ip_fill_gradtype_position1 IS SUPPLIED. changer->set_fill_gradtype_position1( ip_fill_gradtype_position1 ). ENDIF. IF ip_fill_gradtype_position2 IS SUPPLIED. changer->set_fill_gradtype_position2( ip_fill_gradtype_position2 ). ENDIF. IF ip_fill_gradtype_position3 IS SUPPLIED. changer->set_fill_gradtype_position3( ip_fill_gradtype_position3 ). ENDIF. IF ip_borders_diagonal_mode IS SUPPLIED. changer->set_borders_diagonal_mode( ip_borders_diagonal_mode ). ENDIF. IF ip_alignment_horizontal IS SUPPLIED. changer->set_alignment_horizontal( ip_alignment_horizontal ). ENDIF. IF ip_alignment_vertical IS SUPPLIED. changer->set_alignment_vertical( ip_alignment_vertical ). ENDIF. IF ip_alignment_textrotation IS SUPPLIED. changer->set_alignment_textrotation( ip_alignment_textrotation ). ENDIF. IF ip_alignment_wraptext IS SUPPLIED. changer->set_alignment_wraptext( ip_alignment_wraptext ). ENDIF. IF ip_alignment_shrinktofit IS SUPPLIED. changer->set_alignment_shrinktofit( ip_alignment_shrinktofit ). ENDIF. IF ip_alignment_indent IS SUPPLIED. changer->set_alignment_indent( ip_alignment_indent ). ENDIF. IF ip_protection_hidden IS SUPPLIED. changer->set_protection_hidden( ip_protection_hidden ). ENDIF. IF ip_protection_locked IS SUPPLIED. changer->set_protection_locked( ip_protection_locked ). ENDIF. IF ip_borders_allborders_style IS SUPPLIED. changer->set_borders_allborders_style( ip_borders_allborders_style ). ENDIF. IF ip_borders_allborders_color IS SUPPLIED. changer->set_borders_allborders_color( ip_borders_allborders_color ). ENDIF. IF ip_borders_allbo_color_rgb IS SUPPLIED. changer->set_borders_allbo_color_rgb( ip_borders_allbo_color_rgb ). ENDIF. IF ip_borders_allbo_color_indexed IS SUPPLIED. changer->set_borders_allbo_color_indexe( ip_borders_allbo_color_indexed ). ENDIF. IF ip_borders_allbo_color_theme IS SUPPLIED. changer->set_borders_allbo_color_theme( ip_borders_allbo_color_theme ). ENDIF. IF ip_borders_allbo_color_tint IS SUPPLIED. changer->set_borders_allbo_color_tint( ip_borders_allbo_color_tint ). ENDIF. IF ip_borders_diagonal_style IS SUPPLIED. changer->set_borders_diagonal_style( ip_borders_diagonal_style ). ENDIF. IF ip_borders_diagonal_color IS SUPPLIED. changer->set_borders_diagonal_color( ip_borders_diagonal_color ). ENDIF. IF ip_borders_diagonal_color_rgb IS SUPPLIED. changer->set_borders_diagonal_color_rgb( ip_borders_diagonal_color_rgb ). ENDIF. IF ip_borders_diagonal_color_inde IS SUPPLIED. changer->set_borders_diagonal_color_ind( ip_borders_diagonal_color_inde ). ENDIF. IF ip_borders_diagonal_color_them IS SUPPLIED. changer->set_borders_diagonal_color_the( ip_borders_diagonal_color_them ). ENDIF. IF ip_borders_diagonal_color_tint IS SUPPLIED. changer->set_borders_diagonal_color_tin( ip_borders_diagonal_color_tint ). ENDIF. IF ip_borders_down_style IS SUPPLIED. changer->set_borders_down_style( ip_borders_down_style ). ENDIF. IF ip_borders_down_color IS SUPPLIED. changer->set_borders_down_color( ip_borders_down_color ). ENDIF. IF ip_borders_down_color_rgb IS SUPPLIED. changer->set_borders_down_color_rgb( ip_borders_down_color_rgb ). ENDIF. IF ip_borders_down_color_indexed IS SUPPLIED. changer->set_borders_down_color_indexed( ip_borders_down_color_indexed ). ENDIF. IF ip_borders_down_color_theme IS SUPPLIED. changer->set_borders_down_color_theme( ip_borders_down_color_theme ). ENDIF. IF ip_borders_down_color_tint IS SUPPLIED. changer->set_borders_down_color_tint( ip_borders_down_color_tint ). ENDIF. IF ip_borders_left_style IS SUPPLIED. changer->set_borders_left_style( ip_borders_left_style ). ENDIF. IF ip_borders_left_color IS SUPPLIED. changer->set_borders_left_color( ip_borders_left_color ). ENDIF. IF ip_borders_left_color_rgb IS SUPPLIED. changer->set_borders_left_color_rgb( ip_borders_left_color_rgb ). ENDIF. IF ip_borders_left_color_indexed IS SUPPLIED. changer->set_borders_left_color_indexed( ip_borders_left_color_indexed ). ENDIF. IF ip_borders_left_color_theme IS SUPPLIED. changer->set_borders_left_color_theme( ip_borders_left_color_theme ). ENDIF. IF ip_borders_left_color_tint IS SUPPLIED. changer->set_borders_left_color_tint( ip_borders_left_color_tint ). ENDIF. IF ip_borders_right_style IS SUPPLIED. changer->set_borders_right_style( ip_borders_right_style ). ENDIF. IF ip_borders_right_color IS SUPPLIED. changer->set_borders_right_color( ip_borders_right_color ). ENDIF. IF ip_borders_right_color_rgb IS SUPPLIED. changer->set_borders_right_color_rgb( ip_borders_right_color_rgb ). ENDIF. IF ip_borders_right_color_indexed IS SUPPLIED. changer->set_borders_right_color_indexe( ip_borders_right_color_indexed ). ENDIF. IF ip_borders_right_color_theme IS SUPPLIED. changer->set_borders_right_color_theme( ip_borders_right_color_theme ). ENDIF. IF ip_borders_right_color_tint IS SUPPLIED. changer->set_borders_right_color_tint( ip_borders_right_color_tint ). ENDIF. IF ip_borders_top_style IS SUPPLIED. changer->set_borders_top_style( ip_borders_top_style ). ENDIF. IF ip_borders_top_color IS SUPPLIED. changer->set_borders_top_color( ip_borders_top_color ). ENDIF. IF ip_borders_top_color_rgb IS SUPPLIED. changer->set_borders_top_color_rgb( ip_borders_top_color_rgb ). ENDIF. IF ip_borders_top_color_indexed IS SUPPLIED. changer->set_borders_top_color_indexed( ip_borders_top_color_indexed ). ENDIF. IF ip_borders_top_color_theme IS SUPPLIED. changer->set_borders_top_color_theme( ip_borders_top_color_theme ). ENDIF. IF ip_borders_top_color_tint IS SUPPLIED. changer->set_borders_top_color_tint( ip_borders_top_color_tint ). ENDIF. ep_guid = changer->apply( ip_worksheet = me ip_column = ip_column ip_row = ip_row ). ENDMETHOD. "CHANGE_CELL_STYLE METHOD check_cell_column_formula. FIELD-SYMBOLS <fs_column_formula> TYPE zcl_excel_worksheet=>mty_s_column_formula. IF ip_value IS NOT INITIAL OR ip_formula IS NOT INITIAL. zcx_excel=>raise_text( c_messages-formula_id_only_is_possible ). ENDIF. READ TABLE it_column_formulas WITH TABLE KEY id = ip_column_formula_id ASSIGNING <fs_column_formula>. IF sy-subrc <> 0. zcx_excel=>raise_text( c_messages-column_formula_id_not_found ). ENDIF. IF ip_row < <fs_column_formula>-table_top_left_row + 1 OR ip_row > <fs_column_formula>-table_bottom_right_row + 1 OR ip_column < <fs_column_formula>-table_left_column_int OR ip_column > <fs_column_formula>-table_right_column_int. zcx_excel=>raise_text( c_messages-formula_not_in_this_table ). ENDIF. IF ip_column <> <fs_column_formula>-column. zcx_excel=>raise_text( c_messages-formula_in_other_column ). ENDIF. ENDMETHOD. METHOD check_rtf. DATA: lo_style TYPE REF TO zcl_excel_style, lo_iterator TYPE REF TO cl_object_collection_iterator, lv_next_rtf_offset TYPE i, lv_tabix TYPE i, lv_value TYPE string, lv_val_length TYPE i, ls_rtf LIKE LINE OF ct_rtf. FIELD-SYMBOLS: <rtf> LIKE LINE OF ct_rtf. IF ip_style IS NOT SUPPLIED. ip_style = excel->get_default_style( ). ENDIF. lo_iterator = excel->get_styles_iterator( ). WHILE lo_iterator->has_next( ) = abap_true. lo_style ?= lo_iterator->get_next( ). IF lo_style->get_guid( ) = ip_style. EXIT. ENDIF. CLEAR lo_style. ENDWHILE. lv_next_rtf_offset = 0. LOOP AT ct_rtf ASSIGNING <rtf>. lv_tabix = sy-tabix. IF lv_next_rtf_offset < <rtf>-offset. ls_rtf-offset = lv_next_rtf_offset. ls_rtf-length = <rtf>-offset - lv_next_rtf_offset. ls_rtf-font = lo_style->font->get_structure( ). INSERT ls_rtf INTO ct_rtf INDEX lv_tabix. ELSEIF lv_next_rtf_offset > <rtf>-offset. RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'Gaps or overlaps in RTF data offset/length specs'. ENDIF. lv_next_rtf_offset = <rtf>-offset + <rtf>-length. ENDLOOP. lv_value = ip_value. lv_val_length = strlen( lv_value ). IF lv_val_length > lv_next_rtf_offset. ls_rtf-offset = lv_next_rtf_offset. ls_rtf-length = lv_val_length - lv_next_rtf_offset. ls_rtf-font = lo_style->font->get_structure( ). INSERT ls_rtf INTO TABLE ct_rtf. ELSEIF lv_val_length > lv_next_rtf_offset. RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'RTF specs length is not equal to value length'. ENDIF. ENDMETHOD. METHOD class_constructor. c_messages-formula_id_only_is_possible = |{ 'If Formula ID is used, value and formula must be empty'(008) }|. c_messages-column_formula_id_not_found = |{ 'The Column Formula does not exist'(009) }|. c_messages-formula_not_in_this_table = |{ 'The cell uses a Column Formula which should be part of the same table'(010) }|. c_messages-formula_in_other_column = |{ 'The cell uses a Column Formula which is in a different column'(011) }|. ENDMETHOD. METHOD clear_initial_colorxfields. IF is_color-rgb IS INITIAL. CLEAR cs_xcolor-rgb. ENDIF. IF is_color-indexed IS INITIAL. CLEAR cs_xcolor-indexed. ENDIF. IF is_color-theme IS INITIAL. CLEAR cs_xcolor-theme. ENDIF. IF is_color-tint IS INITIAL. CLEAR cs_xcolor-tint. ENDIF. ENDMETHOD. METHOD constructor. DATA: lv_title TYPE zexcel_sheet_title. me->excel = ip_excel. * CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases * IMPORTING * ev_guid_16 = me->guid. me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call IF ip_title IS NOT INITIAL. lv_title = ip_title. ELSE. * lv_title = me->guid. " del issue #154 - Names of worksheets lv_title = me->generate_title( ). " ins issue #154 - Names of worksheets ENDIF. me->set_title( ip_title = lv_title ). CREATE OBJECT sheet_setup. CREATE OBJECT styles_cond. CREATE OBJECT data_validations. CREATE OBJECT tables. CREATE OBJECT columns. CREATE OBJECT rows. CREATE OBJECT ranges. " issue #163 CREATE OBJECT mo_pagebreaks. CREATE OBJECT drawings EXPORTING ip_type = zcl_excel_drawing=>type_image. CREATE OBJECT charts EXPORTING ip_type = zcl_excel_drawing=>type_chart. me->zif_excel_sheet_protection~initialize( ). me->zif_excel_sheet_properties~initialize( ). CREATE OBJECT hyperlinks. CREATE OBJECT comments. " (+) Issue #180 * initialize active cell coordinates active_cell-cell_row = 1. active_cell-cell_column = 1. * inizialize dimension range lower_cell-cell_row = 1. lower_cell-cell_column = 1. upper_cell-cell_row = 1. upper_cell-cell_column = 1. ENDMETHOD. "CONSTRUCTOR METHOD delete_merge. DATA: lv_column TYPE i. *--------------------------------------------------------------------* * If cell information is passed delete merge including this cell, * otherwise delete all merges *--------------------------------------------------------------------* IF ip_cell_column IS INITIAL OR ip_cell_row IS INITIAL. CLEAR me->mt_merged_cells. ELSE. lv_column = zcl_excel_common=>convert_column2int( ip_cell_column ). LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS WHERE ( row_from <= ip_cell_row AND row_to >= ip_cell_row ) AND ( col_from <= lv_column AND col_to >= lv_column ). DELETE me->mt_merged_cells. EXIT. ENDLOOP. ENDIF. ENDMETHOD. "DELETE_MERGE METHOD delete_row_outline. DELETE me->mt_row_outlines WHERE row_from = iv_row_from AND row_to = iv_row_to. IF sy-subrc <> 0. " didn't find outline that was to be deleted zcx_excel=>raise_text( 'Row outline to be deleted does not exist' ). ENDIF. ENDMETHOD. "DELETE_ROW_OUTLINE METHOD freeze_panes. IF ip_num_columns IS NOT SUPPLIED AND ip_num_rows IS NOT SUPPLIED. zcx_excel=>raise_text( 'Pleas provide number of rows and/or columns to freeze' ). ENDIF. IF ip_num_columns IS SUPPLIED AND ip_num_columns <= 0. zcx_excel=>raise_text( 'Number of columns to freeze should be positive' ). ENDIF. IF ip_num_rows IS SUPPLIED AND ip_num_rows <= 0. zcx_excel=>raise_text( 'Number of rows to freeze should be positive' ). ENDIF. freeze_pane_cell_column = ip_num_columns + 1. freeze_pane_cell_row = ip_num_rows + 1. ENDMETHOD. "FREEZE_PANES METHOD generate_title. DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator, lo_worksheet TYPE REF TO zcl_excel_worksheet. DATA: t_titles TYPE HASHED TABLE OF zexcel_sheet_title WITH UNIQUE KEY table_line, title TYPE zexcel_sheet_title, sheetnumber TYPE i. * Get list of currently used titles lo_worksheets_iterator = me->excel->get_worksheets_iterator( ). WHILE lo_worksheets_iterator->has_next( ) = abap_true. lo_worksheet ?= lo_worksheets_iterator->get_next( ). title = lo_worksheet->get_title( ). INSERT title INTO TABLE t_titles. ADD 1 TO sheetnumber. ENDWHILE. * Now build sheetnumber. Increase counter until we hit a number that is not used so far ADD 1 TO sheetnumber. " Start counting with next number DO. title = sheetnumber. SHIFT title LEFT DELETING LEADING space. CONCATENATE 'Sheet'(001) title INTO ep_title. INSERT ep_title INTO TABLE t_titles. IF sy-subrc = 0. " Title not used so far --> take it EXIT. ENDIF. ADD 1 TO sheetnumber. ENDDO. ENDMETHOD. "GENERATE_TITLE METHOD get_active_cell. DATA: lv_active_column TYPE zexcel_cell_column_alpha, lv_active_row TYPE string. lv_active_column = zcl_excel_common=>convert_column2alpha( active_cell-cell_column ). lv_active_row = active_cell-cell_row. SHIFT lv_active_row RIGHT DELETING TRAILING space. SHIFT lv_active_row LEFT DELETING LEADING space. CONCATENATE lv_active_column lv_active_row INTO ep_active_cell. ENDMETHOD. "GET_ACTIVE_CELL METHOD get_cell. DATA: lv_column TYPE zexcel_cell_column, ls_sheet_content TYPE zexcel_s_cell_data. lv_column = zcl_excel_common=>convert_column2int( ip_column ). READ TABLE sheet_content INTO ls_sheet_content WITH TABLE KEY cell_row = ip_row cell_column = lv_column. ep_rc = sy-subrc. ep_value = ls_sheet_content-cell_value. ep_guid = ls_sheet_content-cell_style. " issue 139 - added this to be used for columnwidth calculation ep_formula = ls_sheet_content-cell_formula. IF et_rtf IS SUPPLIED AND ls_sheet_content-rtf_tab IS NOT INITIAL. et_rtf = ls_sheet_content-rtf_tab. ENDIF. " Addition to solve issue #120, contribution by Stefan Schmöcker DATA: style_iterator TYPE REF TO cl_object_collection_iterator, style TYPE REF TO zcl_excel_style. IF ep_style IS SUPPLIED. CLEAR ep_style. style_iterator = me->excel->get_styles_iterator( ). WHILE style_iterator->has_next( ) = abap_true. style ?= style_iterator->get_next( ). IF style->get_guid( ) = ls_sheet_content-cell_style. ep_style = style. EXIT. ENDIF. ENDWHILE. ENDIF. ENDMETHOD. "GET_CELL METHOD get_column. DATA: lv_column TYPE zexcel_cell_column. lv_column = zcl_excel_common=>convert_column2int( ip_column ). eo_column = me->columns->get( ip_index = lv_column ). IF eo_column IS NOT BOUND. eo_column = me->add_new_column( ip_column ). ENDIF. ENDMETHOD. "GET_COLUMN METHOD get_columns. DATA: columns TYPE TABLE OF i, column TYPE i. FIELD-SYMBOLS: <sheet_cell> TYPE zexcel_s_cell_data. LOOP AT sheet_content ASSIGNING <sheet_cell>. COLLECT <sheet_cell>-cell_column INTO columns. ENDLOOP. LOOP AT columns INTO column. " This will create the column instance if it doesn't exist get_column( column ). ENDLOOP. eo_columns = me->columns. ENDMETHOD. "GET_COLUMNS METHOD get_columns_iterator. get_columns( ). eo_iterator = me->columns->get_iterator( ). ENDMETHOD. "GET_COLUMNS_ITERATOR METHOD get_comments. DATA: lo_comment TYPE REF TO zcl_excel_comment, lo_iterator TYPE REF TO cl_object_collection_iterator. CREATE OBJECT r_comments. lo_iterator = comments->get_iterator( ). WHILE lo_iterator->has_next( ) = abap_true. lo_comment ?= lo_iterator->get_next( ). r_comments->include( lo_comment ). ENDWHILE. ENDMETHOD. "get_comments METHOD get_comments_iterator. eo_iterator = comments->get_iterator( ). ENDMETHOD. "get_comments_iterator METHOD get_data_validations_iterator. eo_iterator = me->data_validations->get_iterator( ). ENDMETHOD. "GET_DATA_VALIDATIONS_ITERATOR METHOD get_data_validations_size. ep_size = me->data_validations->size( ). ENDMETHOD. "GET_DATA_VALIDATIONS_SIZE METHOD get_default_column. IF me->column_default IS NOT BOUND. CREATE OBJECT me->column_default EXPORTING ip_index = 'A' " ???? ip_worksheet = me ip_excel = me->excel. ENDIF. eo_column = me->column_default. ENDMETHOD. "GET_DEFAULT_COLUMN METHOD get_default_excel_date_format. CONSTANTS: c_lang_e TYPE lang VALUE 'E'. IF default_excel_date_format IS NOT INITIAL. ep_default_excel_date_format = default_excel_date_format. RETURN. ENDIF. "try to get defaults TRY. cl_abap_datfm=>get_date_format_des( EXPORTING im_langu = c_lang_e IMPORTING ex_dateformat = default_excel_date_format ). CATCH cx_abap_datfm_format_unknown. ENDTRY. " and fallback to fixed format IF default_excel_date_format IS INITIAL. default_excel_date_format = zcl_excel_style_number_format=>c_format_date_ddmmyyyydot. ENDIF. ep_default_excel_date_format = default_excel_date_format. ENDMETHOD. "GET_DEFAULT_EXCEL_DATE_FORMAT METHOD get_default_excel_time_format. DATA: l_timefm TYPE xutimefm. IF default_excel_time_format IS NOT INITIAL. ep_default_excel_time_format = default_excel_time_format. RETURN. ENDIF. * Let's get default l_timefm = cl_abap_timefm=>get_environment_timefm( ). CASE l_timefm. WHEN 0. *0 24 Hour Format (Example: 12:05:10) default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6. WHEN 1. *1 12 Hour Format (Example: 12:05:10 PM) default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. WHEN 2. *2 12 Hour Format (Example: 12:05:10 pm) for now all the same. no chnage upper lower default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. WHEN 3. *3 Hours from 0 to 11 (Example: 00:05:10 PM) for now all the same. no chnage upper lower default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. WHEN 4. *4 Hours from 0 to 11 (Example: 00:05:10 pm) for now all the same. no chnage upper lower default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2. WHEN OTHERS. " and fallback to fixed format default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6. ENDCASE. ep_default_excel_time_format = default_excel_time_format. ENDMETHOD. "GET_DEFAULT_EXCEL_TIME_FORMAT METHOD get_default_row. IF me->row_default IS NOT BOUND. CREATE OBJECT me->row_default. ENDIF. eo_row = me->row_default. ENDMETHOD. "GET_DEFAULT_ROW METHOD get_dimension_range. me->update_dimension_range( ). IF upper_cell EQ lower_cell. "only one cell " Worksheet not filled * IF upper_cell-cell_coords = '0'. IF upper_cell-cell_coords IS INITIAL. ep_dimension_range = 'A1'. ELSE. ep_dimension_range = upper_cell-cell_coords. ENDIF. ELSE. CONCATENATE upper_cell-cell_coords ':' lower_cell-cell_coords INTO ep_dimension_range. ENDIF. ENDMETHOD. "GET_DIMENSION_RANGE METHOD get_drawings. DATA: lo_drawing TYPE REF TO zcl_excel_drawing, lo_iterator TYPE REF TO cl_object_collection_iterator. CASE ip_type. WHEN zcl_excel_drawing=>type_image. r_drawings = drawings. WHEN zcl_excel_drawing=>type_chart. r_drawings = charts. WHEN space. CREATE OBJECT r_drawings EXPORTING ip_type = ''. lo_iterator = drawings->get_iterator( ). WHILE lo_iterator->has_next( ) = abap_true. lo_drawing ?= lo_iterator->get_next( ). r_drawings->include( lo_drawing ). ENDWHILE. lo_iterator = charts->get_iterator( ). WHILE lo_iterator->has_next( ) = abap_true. lo_drawing ?= lo_iterator->get_next( ). r_drawings->include( lo_drawing ). ENDWHILE. WHEN OTHERS. ENDCASE. ENDMETHOD. "GET_DRAWINGS METHOD get_drawings_iterator. CASE ip_type. WHEN zcl_excel_drawing=>type_image. eo_iterator = drawings->get_iterator( ). WHEN zcl_excel_drawing=>type_chart. eo_iterator = charts->get_iterator( ). ENDCASE. ENDMETHOD. "GET_DRAWINGS_ITERATOR METHOD get_freeze_cell. ep_row = me->freeze_pane_cell_row. ep_column = me->freeze_pane_cell_column. ENDMETHOD. "GET_FREEZE_CELL METHOD get_guid. ep_guid = me->guid. ENDMETHOD. "GET_GUID METHOD get_header_footer_drawings. DATA: ls_odd_header TYPE zexcel_s_worksheet_head_foot, ls_odd_footer TYPE zexcel_s_worksheet_head_foot, ls_even_header TYPE zexcel_s_worksheet_head_foot, ls_even_footer TYPE zexcel_s_worksheet_head_foot, ls_hd_ft TYPE zexcel_s_worksheet_head_foot. FIELD-SYMBOLS: <fs_drawings> TYPE zexcel_s_drawings. me->sheet_setup->get_header_footer( IMPORTING ep_odd_header = ls_odd_header ep_odd_footer = ls_odd_footer ep_even_header = ls_even_header ep_even_footer = ls_even_footer ). ********************************************************************** *** Odd header ls_hd_ft = ls_odd_header. IF ls_hd_ft-left_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-left_image. ENDIF. IF ls_hd_ft-right_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-right_image. ENDIF. IF ls_hd_ft-center_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-center_image. ENDIF. ********************************************************************** *** Odd footer ls_hd_ft = ls_odd_footer. IF ls_hd_ft-left_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-left_image. ENDIF. IF ls_hd_ft-right_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-right_image. ENDIF. IF ls_hd_ft-center_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-center_image. ENDIF. ********************************************************************** *** Even header ls_hd_ft = ls_even_header. IF ls_hd_ft-left_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-left_image. ENDIF. IF ls_hd_ft-right_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-right_image. ENDIF. IF ls_hd_ft-center_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-center_image. ENDIF. ********************************************************************** *** Even footer ls_hd_ft = ls_even_footer. IF ls_hd_ft-left_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-left_image. ENDIF. IF ls_hd_ft-right_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-right_image. ENDIF. IF ls_hd_ft-center_image IS NOT INITIAL. APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>. <fs_drawings>-drawing = ls_hd_ft-center_image. ENDIF. ENDMETHOD. "get_header_footer_drawings METHOD get_highest_column. me->update_dimension_range( ). r_highest_column = me->lower_cell-cell_column. ENDMETHOD. "GET_HIGHEST_COLUMN METHOD get_highest_row. me->update_dimension_range( ). r_highest_row = me->lower_cell-cell_row. ENDMETHOD. "GET_HIGHEST_ROW METHOD get_hyperlinks_iterator. eo_iterator = hyperlinks->get_iterator( ). ENDMETHOD. "GET_HYPERLINKS_ITERATOR METHOD get_hyperlinks_size. ep_size = hyperlinks->size( ). ENDMETHOD. "GET_HYPERLINKS_SIZE METHOD get_ignored_errors. rt_ignored_errors = mt_ignored_errors. ENDMETHOD. METHOD get_merge. FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells. DATA: lv_col_from TYPE string, lv_col_to TYPE string, lv_row_from TYPE string, lv_row_to TYPE string, lv_merge_range TYPE string. LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>. lv_col_from = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_from ). lv_col_to = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_to ). lv_row_from = <ls_merged_cell>-row_from. lv_row_to = <ls_merged_cell>-row_to . CONCATENATE lv_col_from lv_row_from ':' lv_col_to lv_row_to INTO lv_merge_range. CONDENSE lv_merge_range NO-GAPS. APPEND lv_merge_range TO merge_range. ENDLOOP. ENDMETHOD. "GET_MERGE METHOD get_pagebreaks. ro_pagebreaks = mo_pagebreaks. ENDMETHOD. "GET_PAGEBREAKS METHOD get_ranges_iterator. eo_iterator = me->ranges->get_iterator( ). ENDMETHOD. "GET_RANGES_ITERATOR METHOD get_row. eo_row = me->rows->get( ip_index = ip_row ). IF eo_row IS NOT BOUND. eo_row = me->add_new_row( ip_row ). ENDIF. ENDMETHOD. "GET_ROW METHOD get_rows. DATA: row TYPE i. FIELD-SYMBOLS: <sheet_cell> TYPE zexcel_s_cell_data. IF sheet_content IS NOT INITIAL. row = 0. DO. " Find the next row READ TABLE sheet_content ASSIGNING <sheet_cell> WITH KEY cell_row = row. CASE sy-subrc. WHEN 4. " row doesn't exist, but it exists another row, SY-TABIX points to the first cell in this row. READ TABLE sheet_content ASSIGNING <sheet_cell> INDEX sy-tabix. ASSERT sy-subrc = 0. row = <sheet_cell>-cell_row. WHEN 8. " it was the last available row EXIT. ENDCASE. " This will create the row instance if it doesn't exist get_row( row ). row = row + 1. ENDDO. ENDIF. eo_rows = me->rows. ENDMETHOD. "GET_ROWS METHOD get_rows_iterator. get_rows( ). eo_iterator = me->rows->get_iterator( ). ENDMETHOD. "GET_ROWS_ITERATOR METHOD get_row_outlines. rt_row_outlines = me->mt_row_outlines. ENDMETHOD. "GET_ROW_OUTLINES METHOD get_style_cond. DATA: lo_style_iterator TYPE REF TO cl_object_collection_iterator, lo_style_cond TYPE REF TO zcl_excel_style_cond. lo_style_iterator = me->get_style_cond_iterator( ). WHILE lo_style_iterator->has_next( ) = abap_true. lo_style_cond ?= lo_style_iterator->get_next( ). IF lo_style_cond->get_guid( ) = ip_guid. eo_style_cond = lo_style_cond. EXIT. ENDIF. ENDWHILE. ENDMETHOD. "GET_STYLE_COND METHOD get_style_cond_iterator. eo_iterator = styles_cond->get_iterator( ). ENDMETHOD. "GET_STYLE_COND_ITERATOR METHOD get_tabcolor. ev_tabcolor = me->tabcolor. ENDMETHOD. "GET_TABCOLOR METHOD get_table. *--------------------------------------------------------------------* * Comment D. Rauchenstein * With this method, we get a fully functional Excel Upload, which solves * a few issues of the other excel upload tools * ZBCABA_ALSM_EXCEL_UPLOAD_EXT: Reads only up to 50 signs per Cell, Limit * in row-Numbers. Other have Limitations of Lines, or you are not able * to ignore filters or choosing the right tab. * * To get a fully functional XLSX Upload, you can use it e.g. with method * CL_EXCEL_READER_2007->ZIF_EXCEL_READER~LOAD_FILE() *--------------------------------------------------------------------* FIELD-SYMBOLS: <ls_line> TYPE data. FIELD-SYMBOLS: <lv_value> TYPE data. DATA lv_actual_row TYPE int4. DATA lv_actual_row_string TYPE string. DATA lv_actual_col TYPE int4. DATA lv_actual_col_string TYPE string. DATA lv_errormessage TYPE string. DATA lv_max_col TYPE zexcel_cell_column. DATA lv_max_row TYPE int4. DATA lv_delta_col TYPE int4. DATA lv_value TYPE zexcel_cell_value. DATA lv_rc TYPE sysubrc. DATA lx_conversion_error TYPE REF TO cx_sy_conversion_error. DATA lv_float TYPE f. DATA lv_type. lv_max_col = me->get_highest_column( ). IF iv_max_col IS SUPPLIED AND iv_max_col < lv_max_col. lv_max_col = iv_max_col. ENDIF. lv_max_row = me->get_highest_row( ). IF iv_max_row IS SUPPLIED AND iv_max_row < lv_max_row. lv_max_row = iv_max_row. ENDIF. *--------------------------------------------------------------------* * The row counter begins with 1 and should be corrected with the skips *--------------------------------------------------------------------* lv_actual_row = iv_skipped_rows + 1. lv_actual_col = iv_skipped_cols + 1. TRY. *--------------------------------------------------------------------* * Check if we the basic features are possible with given "any table" *--------------------------------------------------------------------* APPEND INITIAL LINE TO et_table ASSIGNING <ls_line>. IF sy-subrc <> 0 OR <ls_line> IS NOT ASSIGNED. lv_errormessage = 'Error at inserting new Line to internal Table'(002). zcx_excel=>raise_text( lv_errormessage ). ELSE. lv_delta_col = lv_max_col - iv_skipped_cols. ASSIGN COMPONENT lv_delta_col OF STRUCTURE <ls_line> TO <lv_value>. IF sy-subrc <> 0 OR <lv_value> IS NOT ASSIGNED. lv_errormessage = 'Internal table has less columns than excel'(003). zcx_excel=>raise_text( lv_errormessage ). ELSE. *--------------------------------------------------------------------* *now we are ready for handle the table data *--------------------------------------------------------------------* REFRESH et_table. *--------------------------------------------------------------------* * Handle each Row until end on right side *--------------------------------------------------------------------* WHILE lv_actual_row <= lv_max_row . *--------------------------------------------------------------------* * Handle each Column until end on bottom * First step is to step back on first column *--------------------------------------------------------------------* lv_actual_col = iv_skipped_cols + 1. UNASSIGN <ls_line>. APPEND INITIAL LINE TO et_table ASSIGNING <ls_line>. IF sy-subrc <> 0 OR <ls_line> IS NOT ASSIGNED. lv_errormessage = 'Error at inserting new Line to internal Table'(002). zcx_excel=>raise_text( lv_errormessage ). ENDIF. WHILE lv_actual_col <= lv_max_col. lv_delta_col = lv_actual_col - iv_skipped_cols. ASSIGN COMPONENT lv_delta_col OF STRUCTURE <ls_line> TO <lv_value>. IF sy-subrc <> 0. lv_actual_col_string = lv_actual_col. lv_actual_row_string = lv_actual_row. CONCATENATE 'Error at assigning field (Col:'(004) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage. zcx_excel=>raise_text( lv_errormessage ). ENDIF. me->get_cell( EXPORTING ip_column = lv_actual_col " Cell Column ip_row = lv_actual_row " Cell Row IMPORTING ep_value = lv_value " Cell Value ep_rc = lv_rc " Return Value of ABAP Statements ). IF lv_rc <> 0 AND lv_rc <> 4 "No found error means, zero/no value in cell AND lv_rc <> 8. "rc is 8 when the last row contains cells with zero / no values lv_actual_col_string = lv_actual_col. lv_actual_row_string = lv_actual_row. CONCATENATE 'Error at reading field value (Col:'(007) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage. zcx_excel=>raise_text( lv_errormessage ). ENDIF. TRY. DESCRIBE FIELD <lv_value> TYPE lv_type. IF lv_type = 'D'. <lv_value> = zcl_excel_common=>excel_string_to_date( ip_value = lv_value ). ELSE. <lv_value> = lv_value. "Will raise exception if data type of <lv_value> is not float (or decfloat16/34) and excel delivers exponential number e.g. -2.9398924194538267E-2 ENDIF. CATCH cx_sy_conversion_error INTO lx_conversion_error. "Another try with conversion to float... IF lv_type = 'P'. <lv_value> = lv_float = lv_value. ELSE. RAISE EXCEPTION lx_conversion_error. "Pass on original exception ENDIF. ENDTRY. * CATCH zcx_excel. " ADD 1 TO lv_actual_col. ENDWHILE. ADD 1 TO lv_actual_row. ENDWHILE. ENDIF. ENDIF. CATCH cx_sy_assign_cast_illegal_cast. lv_actual_col_string = lv_actual_col. lv_actual_row_string = lv_actual_row. CONCATENATE 'Error at assigning field (Col:'(004) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage. zcx_excel=>raise_text( lv_errormessage ). CATCH cx_sy_assign_cast_unknown_type. lv_actual_col_string = lv_actual_col. lv_actual_row_string = lv_actual_row. CONCATENATE 'Error at assigning field (Col:'(004) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage. zcx_excel=>raise_text( lv_errormessage ). CATCH cx_sy_assign_out_of_range. lv_errormessage = 'Internal table has less columns than excel'(003). zcx_excel=>raise_text( lv_errormessage ). CATCH cx_sy_conversion_error. lv_actual_col_string = lv_actual_col. lv_actual_row_string = lv_actual_row. CONCATENATE 'Error at converting field value (Col:'(006) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage. zcx_excel=>raise_text( lv_errormessage ). ENDTRY. ENDMETHOD. "get_table METHOD get_tables_iterator. eo_iterator = tables->get_iterator( ). ENDMETHOD. "GET_TABLES_ITERATOR METHOD get_tables_size. ep_size = tables->size( ). ENDMETHOD. "GET_TABLES_SIZE METHOD get_title. DATA lv_value TYPE string. IF ip_escaped EQ abap_true. lv_value = me->title. ep_title = zcl_excel_common=>escape_string( lv_value ). ELSE. ep_title = me->title. ENDIF. ENDMETHOD. "GET_TITLE METHOD get_value_type. DATA: lo_addit TYPE REF TO cl_abap_elemdescr, ls_dfies TYPE dfies, l_function TYPE funcname, l_value(50) TYPE c. ep_value = ip_value. ep_value_type = cl_abap_typedescr=>typekind_string. " Thats our default if something goes wrong. TRY. lo_addit ?= cl_abap_typedescr=>describe_by_data( ip_value ). CATCH cx_sy_move_cast_error. CLEAR lo_addit. ENDTRY. IF lo_addit IS BOUND. lo_addit->get_ddic_field( RECEIVING p_flddescr = ls_dfies EXCEPTIONS not_found = 1 no_ddic_type = 2 OTHERS = 3 ) . IF sy-subrc = 0. ep_value_type = ls_dfies-inttype. IF ls_dfies-convexit IS NOT INITIAL. * We need to convert with output conversion function CONCATENATE 'CONVERSION_EXIT_' ls_dfies-convexit '_OUTPUT' INTO l_function. SELECT SINGLE funcname INTO l_function FROM tfdir WHERE funcname = l_function. IF sy-subrc = 0. CALL FUNCTION l_function EXPORTING input = ip_value IMPORTING * LONG_TEXT = output = l_value * SHORT_TEXT = EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE. TRY. ep_value = l_value. CATCH cx_root. ep_value = ip_value. ENDTRY. ENDIF. ENDIF. ENDIF. ELSE. ep_value_type = lo_addit->get_data_type_kind( ip_value ). ENDIF. ENDIF. ENDMETHOD. "GET_VALUE_TYPE METHOD is_cell_merged. DATA: lv_column TYPE i. FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells. lv_column = zcl_excel_common=>convert_column2int( ip_column ). rp_is_merged = abap_false. " Assume not in merged area LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>. IF <ls_merged_cell>-col_from <= lv_column AND <ls_merged_cell>-col_to >= lv_column AND <ls_merged_cell>-row_from <= ip_row AND <ls_merged_cell>-row_to >= ip_row. rp_is_merged = abap_true. " until we are proven different RETURN. ENDIF. ENDLOOP. ENDMETHOD. "IS_CELL_MERGED METHOD move_supplied_borders. DATA: ls_borderx TYPE zexcel_s_cstylex_border. IF iv_border_supplied = abap_true. " only act if parameter was supplied IF iv_xborder_supplied = abap_true. " ls_borderx = is_xborder. " use supplied x-parameter ELSE. CLEAR ls_borderx WITH 'X'. " <============================== DDIC structure enh. category to set? " clear in a way that would be expected to work easily IF is_border-border_style IS INITIAL. CLEAR ls_borderx-border_style. ENDIF. clear_initial_colorxfields( EXPORTING is_color = is_border-border_color CHANGING cs_xcolor = ls_borderx-border_color ). ENDIF. MOVE-CORRESPONDING is_border TO cs_complete_style_border. MOVE-CORRESPONDING ls_borderx TO cs_complete_stylex_border. ENDIF. ENDMETHOD. METHOD print_title_set_range. *--------------------------------------------------------------------* * issue#235 - repeat rows/columns * - Stefan Schmoecker, 2012-12-02 *--------------------------------------------------------------------* DATA: lo_range_iterator TYPE REF TO cl_object_collection_iterator, lo_range TYPE REF TO zcl_excel_range, lv_repeat_range_sheetname TYPE string, lv_repeat_range_col TYPE string, lv_row_char_from TYPE char10, lv_row_char_to TYPE char10, lv_repeat_range_row TYPE string, lv_repeat_range TYPE string. *--------------------------------------------------------------------* * Get range that represents printarea * if non-existant, create it *--------------------------------------------------------------------* lo_range_iterator = me->get_ranges_iterator( ). WHILE lo_range_iterator->has_next( ) = abap_true. lo_range ?= lo_range_iterator->get_next( ). IF lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name. EXIT. " Found it ENDIF. CLEAR lo_range. ENDWHILE. IF me->print_title_col_from IS INITIAL AND me->print_title_row_from IS INITIAL. *--------------------------------------------------------------------* * No print titles are present, *--------------------------------------------------------------------* IF lo_range IS BOUND. me->ranges->remove( lo_range ). ENDIF. ELSE. *--------------------------------------------------------------------* * Print titles are present, *--------------------------------------------------------------------* IF lo_range IS NOT BOUND. lo_range = me->add_new_range( ). lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name. ENDIF. lv_repeat_range_sheetname = me->get_title( ). lv_repeat_range_sheetname = zcl_excel_common=>escape_string( lv_repeat_range_sheetname ). *--------------------------------------------------------------------* * Repeat-columns *--------------------------------------------------------------------* IF me->print_title_col_from IS NOT INITIAL. CONCATENATE lv_repeat_range_sheetname '!$' me->print_title_col_from ':$' me->print_title_col_to INTO lv_repeat_range_col. ENDIF. *--------------------------------------------------------------------* * Repeat-rows *--------------------------------------------------------------------* IF me->print_title_row_from IS NOT INITIAL. lv_row_char_from = me->print_title_row_from. lv_row_char_to = me->print_title_row_to. CONCATENATE '!$' lv_row_char_from ':$' lv_row_char_to INTO lv_repeat_range_row. CONDENSE lv_repeat_range_row NO-GAPS. CONCATENATE lv_repeat_range_sheetname lv_repeat_range_row INTO lv_repeat_range_row. ENDIF. *--------------------------------------------------------------------* * Concatenate repeat-rows and columns *--------------------------------------------------------------------* IF lv_repeat_range_col IS INITIAL. lv_repeat_range = lv_repeat_range_row. ELSEIF lv_repeat_range_row IS INITIAL. lv_repeat_range = lv_repeat_range_col. ELSE. CONCATENATE lv_repeat_range_col lv_repeat_range_row INTO lv_repeat_range SEPARATED BY ','. ENDIF. lo_range->set_range_value( lv_repeat_range ). ENDIF. ENDMETHOD. "PRINT_TITLE_SET_RANGE METHOD set_area. DATA: lv_row TYPE zexcel_cell_row, lv_row_start TYPE zexcel_cell_row, lv_row_end TYPE zexcel_cell_row, lv_column_int TYPE zexcel_cell_column_alpha, lv_column TYPE zexcel_cell_column_alpha, lv_column_start TYPE zexcel_cell_column_alpha, lv_column_end TYPE zexcel_cell_column_alpha, lv_column_start_int TYPE zexcel_cell_column_alpha, lv_column_end_int TYPE zexcel_cell_column_alpha. lv_row_end = ip_row_to. lv_row = ip_row. IF lv_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED. lv_row_end = lv_row. ENDIF. lv_column_start = ip_column_start. lv_column_end = ip_column_end. IF lv_column_end IS INITIAL OR ip_column_end IS NOT SUPPLIED. lv_column_end = lv_column_start. ENDIF. lv_column_start_int = zcl_excel_common=>convert_column2int( lv_column_start ). lv_column_end_int = zcl_excel_common=>convert_column2int( lv_column_end ). IF lv_column_start_int > lv_column_end_int OR lv_row > lv_row_end. RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'Wrong Merging Parameters'. ENDIF. " IP_AREA has been added to maintain ascending compatibility (see discussion in PR 869) IF ip_merge = abap_true OR ip_area = c_area-topleft. IF ip_data_type IS SUPPLIED OR ip_abap_type IS SUPPLIED. me->set_cell( ip_column = lv_column_start ip_row = lv_row ip_value = ip_value ip_formula = ip_formula ip_style = ip_style ip_hyperlink = ip_hyperlink ip_data_type = ip_data_type ip_abap_type = ip_abap_type ). ELSE. me->set_cell( ip_column = lv_column_start ip_row = lv_row ip_value = ip_value ip_formula = ip_formula ip_style = ip_style ip_hyperlink = ip_hyperlink ). ENDIF. ELSE. lv_column_int = lv_column_start_int. lv_row_start = lv_row. WHILE lv_column_int <= lv_column_end_int. lv_column = zcl_excel_common=>convert_column2alpha( lv_column_int ). lv_row = lv_row_start. WHILE lv_row <= lv_row_end. IF ip_data_type IS SUPPLIED OR ip_abap_type IS SUPPLIED. me->set_cell( ip_column = lv_column ip_row = lv_row ip_value = ip_value ip_formula = ip_formula ip_style = ip_style ip_hyperlink = ip_hyperlink ip_data_type = ip_data_type ip_abap_type = ip_abap_type ). ELSE. me->set_cell( ip_column = lv_column ip_row = lv_row ip_value = ip_value ip_formula = ip_formula ip_style = ip_style ip_hyperlink = ip_hyperlink ). ENDIF. ADD 1 TO lv_row. ENDWHILE. ADD 1 TO lv_column_int. ENDWHILE. ENDIF. IF ip_style IS SUPPLIED. me->set_area_style( ip_column_start = lv_column_start ip_column_end = lv_column_end ip_row = lv_row ip_row_to = lv_row_end ip_style = ip_style ). ENDIF. IF ip_merge IS SUPPLIED AND ip_merge = abap_true. me->set_merge( ip_column_start = lv_column_start ip_column_end = lv_column_end ip_row = lv_row ip_row_to = lv_row_end ). ENDIF. ENDMETHOD. "set_area METHOD set_area_formula. DATA: ld_row TYPE zexcel_cell_row, ld_row_start TYPE zexcel_cell_row, ld_row_end TYPE zexcel_cell_row, ld_column TYPE zexcel_cell_column_alpha, ld_column_end TYPE zexcel_cell_column_alpha, ld_column_int TYPE zexcel_cell_column_alpha, ld_column_end_int TYPE zexcel_cell_column_alpha. ld_row_end = ip_row_to. ld_row = ip_row. IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED. ld_row_end = ld_row. ENDIF. ld_column = ip_column_start. ld_column_end = ip_column_end. IF ld_column_end IS INITIAL OR ip_column_end IS NOT SUPPLIED. ld_column_end = ld_column. ENDIF. ld_column_int = zcl_excel_common=>convert_column2int( ld_column ). ld_column_end_int = zcl_excel_common=>convert_column2int( ld_column_end ). IF ld_column_int > ld_column_end_int OR ld_row > ld_row_end. RAISE EXCEPTION TYPE zcx_excel EXPORTING error = 'Wrong Merging Parameters'. ENDIF. " IP_AREA has been added to maintain ascending compatibility (see discussion in PR 869) IF ip_merge = abap_true OR ip_area = c_area-topleft. me->set_cell_formula( ip_column = ld_column ip_row = ld_row ip_formula = ip_formula ). ELSE. ld_row_start = ld_row. WHILE ld_column_int <= ld_column_end_int. ld_column = zcl_excel_common=>convert_column2alpha( ld_column_int ). ld_row = ld_row_start. WHILE ld_row <= ld_row_end. me->set_cell_formula( ip_column = ld_column ip_row = ld_row ip_formula = ip_formula ). ADD 1 TO ld_row. ENDWHILE. ADD 1 TO ld_column_int. ENDWHILE. ENDIF. IF ip_merge IS SUPPLIED AND ip_merge = abap_true. me->set_merge( ip_column_start = ld_column ip_row = ld_row ip_column_end = ld_column_end ip_row_to = ld_row_end ). ENDIF. ENDMETHOD. "set_area_formula METHOD set_area_hyperlink. DATA: ld_row_start TYPE zexcel_cell_row, ld_row_end TYPE zexcel_cell_row, ld_column_start_int TYPE zexcel_cell_column, ld_column_end_int TYPE zexcel_cell_column, ld_current_column TYPE zexcel_cell_column_alpha, ld_current_row TYPE zexcel_cell_row, ld_value TYPE string. DATA: lv_column TYPE zexcel_cell_column, lo_hyperlink TYPE REF TO zcl_excel_hyperlink. ld_row_end = ip_row_to. ld_row_start = ip_row. IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED. ld_row_end = ld_row_start. ENDIF. ld_column_start_int = zcl_excel_common=>convert_column2int( ip_column_start ). ld_column_end_int = zcl_excel_common=>convert_column2int( ip_column_end ). IF ld_column_end_int IS INITIAL OR ip_column_end IS NOT SUPPLIED. ld_column_end_int = ld_column_start_int. ENDIF. WHILE ld_column_start_int <= ld_column_end_int. ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start_int ). ld_current_row = ld_row_start. WHILE ld_current_row <= ld_row_end. me->get_cell( EXPORTING ip_column = ld_current_column ip_row = ld_current_row IMPORTING ep_value = ld_value ). IF ip_is_internal = abap_true. lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = ip_url ). ELSE. lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = ip_url ). ENDIF. me->set_cell( ip_column = ld_current_column ip_row = ld_current_row ip_value = ld_value ip_hyperlink = lo_hyperlink ). ADD 1 TO ld_current_row. ENDWHILE. ADD 1 TO ld_column_start_int. ENDWHILE. ENDMETHOD. "SET_AREA_HYPERLINK METHOD set_area_style. DATA: ld_row_start TYPE zexcel_cell_row, ld_row_end TYPE zexcel_cell_row, ld_column_start_int TYPE zexcel_cell_column, ld_column_end_int TYPE zexcel_cell_column, ld_current_column TYPE zexcel_cell_column_alpha, ld_current_row TYPE zexcel_cell_row. ld_row_end = ip_row_to. ld_row_start = ip_row. IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED. ld_row_end = ld_row_start. ENDIF. ld_column_start_int = zcl_excel_common=>convert_column2int( ip_column_start ). ld_column_end_int = zcl_excel_common=>convert_column2int( ip_column_end ). IF ld_column_end_int IS INITIAL OR ip_column_end IS NOT SUPPLIED. ld_column_end_int = ld_column_start_int. ENDIF. WHILE ld_column_start_int <= ld_column_end_int. ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start_int ). ld_current_row = ld_row_start. WHILE ld_current_row <= ld_row_end. me->set_cell_style( ip_row = ld_current_row ip_column = ld_current_column ip_style = ip_style ). ADD 1 TO ld_current_row. ENDWHILE. ADD 1 TO ld_column_start_int. ENDWHILE. IF ip_merge IS SUPPLIED AND ip_merge = abap_true. me->set_merge( ip_column_start = ip_column_start ip_row = ld_row_start ip_column_end = ld_current_column ip_row_to = ld_row_end ). ENDIF. ENDMETHOD. "SET_AREA_STYLE METHOD set_cell. DATA: lv_column TYPE zexcel_cell_column, ls_sheet_content TYPE zexcel_s_cell_data, lv_row_alpha TYPE string, lv_col_alpha TYPE zexcel_cell_column_alpha, lv_value TYPE zexcel_cell_value, lv_data_type TYPE zexcel_cell_data_type, lv_value_type TYPE abap_typekind, lv_style_guid TYPE zexcel_cell_style, lo_addit TYPE REF TO cl_abap_elemdescr, lt_rtf TYPE zexcel_t_rtf, lo_value TYPE REF TO data, lo_value_new TYPE REF TO data. FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data, <fs_numeric> TYPE numeric, <fs_date> TYPE d, <fs_time> TYPE t, <fs_value> TYPE simple, <fs_typekind_int8> TYPE abap_typekind. FIELD-SYMBOLS: <fs_column_formula> TYPE mty_s_column_formula. IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED AND ip_column_formula_id = 0. zcx_excel=>raise_text( 'Please provide the value or formula' ). ENDIF. * Begin of change issue #152 - don't touch exisiting style if only value is passed * lv_style_guid = ip_style. lv_column = zcl_excel_common=>convert_column2int( ip_column ). IF ip_column_formula_id <> 0. check_cell_column_formula( it_column_formulas = column_formulas ip_column_formula_id = ip_column_formula_id ip_formula = ip_formula ip_value = ip_value ip_row = ip_row ip_column = lv_column ). ENDIF. READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH TABLE KEY cell_row = ip_row " Changed to access via table key , Stefan Schmöcker, 2013-08-03 cell_column = lv_column. IF sy-subrc = 0. IF ip_style IS INITIAL. " If no style is provided as method-parameter and cell is found use cell's current style lv_style_guid = <fs_sheet_content>-cell_style. ELSE. " Style provided as method-parameter --> use this lv_style_guid = ip_style. ENDIF. ELSE. " No cell found --> use supplied style even if empty lv_style_guid = ip_style. ENDIF. * End of change issue #152 - don't touch exisiting style if only value is passed IF ip_value IS SUPPLIED. "if data type is passed just write the value. Otherwise map abap type to excel and perform conversion "IP_DATA_TYPE is passed by excel reader so source types are preserved *First we get reference into local var. CREATE DATA lo_value LIKE ip_value. ASSIGN lo_value->* TO <fs_value>. <fs_value> = ip_value. IF ip_data_type IS SUPPLIED. IF ip_abap_type IS NOT SUPPLIED. get_value_type( EXPORTING ip_value = ip_value IMPORTING ep_value = <fs_value> ) . ENDIF. lv_value = <fs_value>. lv_data_type = ip_data_type. ELSE. IF ip_abap_type IS SUPPLIED. lv_value_type = ip_abap_type. ELSE. get_value_type( EXPORTING ip_value = ip_value IMPORTING ep_value = <fs_value> ep_value_type = lv_value_type ). ENDIF. ASSIGN ('CL_ABAP_TYPEDESCR=>TYPEKIND_INT8') TO <fs_typekind_int8>. IF sy-subrc <> 0. ASSIGN space TO <fs_typekind_int8>. "not used as typekind! ENDIF. CASE lv_value_type. WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2 OR <fs_typekind_int8>. "Allow INT8 types columns lo_addit = cl_abap_elemdescr=>get_i( ). CREATE DATA lo_value_new TYPE HANDLE lo_addit. ASSIGN lo_value_new->* TO <fs_numeric>. IF sy-subrc = 0. <fs_numeric> = <fs_value>. lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ). ENDIF. WHEN cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_packed OR cl_abap_typedescr=>typekind_decfloat OR cl_abap_typedescr=>typekind_decfloat16 OR cl_abap_typedescr=>typekind_decfloat34. lo_addit = cl_abap_elemdescr=>get_f( ). CREATE DATA lo_value_new TYPE HANDLE lo_addit. ASSIGN lo_value_new->* TO <fs_numeric>. IF sy-subrc = 0. <fs_numeric> = <fs_value>. lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ). ENDIF. WHEN cl_abap_typedescr=>typekind_char OR cl_abap_typedescr=>typekind_string OR cl_abap_typedescr=>typekind_num OR cl_abap_typedescr=>typekind_hex. lv_value = <fs_value>. lv_data_type = 's'. WHEN cl_abap_typedescr=>typekind_date. lo_addit = cl_abap_elemdescr=>get_d( ). CREATE DATA lo_value_new TYPE HANDLE lo_addit. ASSIGN lo_value_new->* TO <fs_date>. IF sy-subrc = 0. <fs_date> = <fs_value>. lv_value = zcl_excel_common=>date_to_excel_string( ip_value = <fs_date> ) . ENDIF. * Begin of change issue #152 - don't touch exisiting style if only value is passed * Moved to end of routine - apply date-format even if other styleinformation is passed * IF ip_style IS NOT SUPPLIED. "get default date format in case parameter is initial * lo_style = excel->add_new_style( ). * lo_style->number_format->format_code = get_default_excel_date_format( ). * lv_style_guid = lo_style->get_guid( ). * ENDIF. * End of change issue #152 - don't touch exisiting style if only value is passed WHEN cl_abap_typedescr=>typekind_time. lo_addit = cl_abap_elemdescr=>get_t( ). CREATE DATA lo_value_new TYPE HANDLE lo_addit. ASSIGN lo_value_new->* TO <fs_time>. IF sy-subrc = 0. <fs_time> = <fs_value>. lv_value = zcl_excel_common=>time_to_excel_string( ip_value = <fs_time> ). ENDIF. * Begin of change issue #152 - don't touch exisiting style if only value is passed * Moved to end of routine - apply time-format even if other styleinformation is passed * IF ip_style IS NOT SUPPLIED. "get default time format for user in case parameter is initial * lo_style = excel->add_new_style( ). * lo_style->number_format->format_code = zcl_excel_style_number_format=>c_format_date_time6. * lv_style_guid = lo_style->get_guid( ). * ENDIF. * End of change issue #152 - don't touch exisiting style if only value is passed WHEN OTHERS. zcx_excel=>raise_text( 'Invalid data type of input value' ). ENDCASE. ENDIF. ENDIF. IF ip_hyperlink IS BOUND. ip_hyperlink->set_cell_reference( ip_column = ip_column ip_row = ip_row ). me->hyperlinks->add( ip_hyperlink ). ENDIF. IF lv_value CS '_x'. " Issue #761 value "_x0041_" rendered as "A". " "_x...._", where "." is 0-9 a-f or A-F (case insensitive), is an internal value in sharedStrings.xml " that Excel uses to store special characters, it's interpreted like Unicode character U+.... " for instance "_x0041_" is U+0041 which is "A". " To not interpret such text, the first underscore is replaced with "_x005f_". " The value "_x0041_" is to be stored internally "_x005f_x0041_" so that it's rendered like "_x0041_". " Note that REGEX is time consuming, it's why "CS" is used above to improve the performance. REPLACE ALL OCCURRENCES OF REGEX '_(x[0-9a-fA-F]{4}_)' IN lv_value WITH '_x005f_$1' RESPECTING CASE. ENDIF. * Begin of change issue #152 - don't touch exisiting style if only value is passed * Read table moved up, so that current style may be evaluated * lv_column = zcl_excel_common=>convert_column2int( ip_column ). * READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row * cell_column = lv_column. * * IF sy-subrc EQ 0. IF <fs_sheet_content> IS ASSIGNED. * End of change issue #152 - don't touch exisiting style if only value is passed <fs_sheet_content>-cell_value = lv_value. <fs_sheet_content>-cell_formula = ip_formula. <fs_sheet_content>-column_formula_id = ip_column_formula_id. <fs_sheet_content>-cell_style = lv_style_guid. <fs_sheet_content>-data_type = lv_data_type. ELSE. ls_sheet_content-cell_row = ip_row. ls_sheet_content-cell_column = lv_column. ls_sheet_content-cell_value = lv_value. ls_sheet_content-cell_formula = ip_formula. ls_sheet_content-column_formula_id = ip_column_formula_id. ls_sheet_content-cell_style = lv_style_guid. ls_sheet_content-data_type = lv_data_type. lv_row_alpha = ip_row. * SHIFT lv_row_alpha RIGHT DELETING TRAILING space."del #152 - replaced with condense - should be faster * SHIFT lv_row_alpha LEFT DELETING LEADING space. "del #152 - replaced with condense - should be faster CONDENSE lv_row_alpha NO-GAPS. "ins #152 - replaced 2 shifts - should be faster lv_col_alpha = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column CONCATENATE lv_col_alpha lv_row_alpha INTO ls_sheet_content-cell_coords. " issue #155 - less restrictive typing for ip_column INSERT ls_sheet_content INTO TABLE sheet_content ASSIGNING <fs_sheet_content>. "ins #152 - Now <fs_sheet_content> always holds the data * APPEND ls_sheet_content TO sheet_content. * SORT sheet_content BY cell_row cell_column. " me->update_dimension_range( ). ENDIF. IF ip_formula IS INITIAL AND lv_value IS NOT INITIAL AND it_rtf IS NOT INITIAL. lt_rtf = it_rtf. check_rtf( EXPORTING ip_value = lv_value ip_style = lv_style_guid CHANGING ct_rtf = lt_rtf ). <fs_sheet_content>-rtf_tab = lt_rtf. ENDIF. * Begin of change issue #152 - don't touch exisiting style if only value is passed * For Date- or Timefields change the formatcode if nothing is set yet * Enhancement option: Check if existing formatcode is a date/ or timeformat * If not, use default DATA: lo_format_code_datetime TYPE zexcel_number_format. DATA: stylemapping TYPE zexcel_s_stylemapping. CASE lv_value_type. WHEN cl_abap_typedescr=>typekind_date. TRY. stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ). CATCH zcx_excel . ENDTRY. IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR stylemapping-complete_style-number_format-format_code IS INITIAL. lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_std. ELSE. lo_format_code_datetime = stylemapping-complete_style-number_format-format_code. ENDIF. me->change_cell_style( ip_column = ip_column ip_row = ip_row ip_number_format_format_code = lo_format_code_datetime ). WHEN cl_abap_typedescr=>typekind_time. TRY. stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ). CATCH zcx_excel . ENDTRY. IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR stylemapping-complete_style-number_format-format_code IS INITIAL. lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_time6. ELSE. lo_format_code_datetime = stylemapping-complete_style-number_format-format_code. ENDIF. me->change_cell_style( ip_column = ip_column ip_row = ip_row ip_number_format_format_code = lo_format_code_datetime ). ENDCASE. * End of change issue #152 - don't touch exisiting style if only value is passed * Fix issue #162 lv_value = ip_value. IF lv_value CS cl_abap_char_utilities=>cr_lf. me->change_cell_style( ip_column = ip_column ip_row = ip_row ip_alignment_wraptext = abap_true ). ENDIF. * End of Fix issue #162 ENDMETHOD. "SET_CELL METHOD set_cell_formula. DATA: lv_column TYPE zexcel_cell_column, ls_sheet_content LIKE LINE OF me->sheet_content. FIELD-SYMBOLS: <sheet_content> LIKE LINE OF me->sheet_content. *--------------------------------------------------------------------* * Get cell to set formula into *--------------------------------------------------------------------* lv_column = zcl_excel_common=>convert_column2int( ip_column ). READ TABLE me->sheet_content ASSIGNING <sheet_content> WITH TABLE KEY cell_row = ip_row cell_column = lv_column. IF sy-subrc <> 0. " Create new entry in sheet_content if necessary CHECK ip_formula IS NOT INITIAL. " only create new entry in sheet_content when a formula is passed ls_sheet_content-cell_row = ip_row. ls_sheet_content-cell_column = lv_column. INSERT ls_sheet_content INTO TABLE me->sheet_content ASSIGNING <sheet_content>. ENDIF. *--------------------------------------------------------------------* * Fieldsymbol now holds the relevant cell *--------------------------------------------------------------------* <sheet_content>-cell_formula = ip_formula. ENDMETHOD. "SET_CELL_FORMULA METHOD set_cell_style. DATA: lv_column TYPE zexcel_cell_column, lv_style_guid TYPE zexcel_cell_style. FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data. lv_style_guid = ip_style. lv_column = zcl_excel_common=>convert_column2int( ip_column ). READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row cell_column = lv_column. IF sy-subrc EQ 0. <fs_sheet_content>-cell_style = lv_style_guid. ELSE. set_cell( ip_column = ip_column ip_row = ip_row ip_value = '' ip_style = ip_style ). ENDIF. ENDMETHOD. "SET_CELL_STYLE METHOD set_column_width. DATA: lo_column TYPE REF TO zcl_excel_column. DATA: width TYPE float. lo_column = me->get_column( ip_column ). * if a fix size is supplied use this IF ip_width_fix IS SUPPLIED. TRY. width = ip_width_fix. IF width <= 0. zcx_excel=>raise_text( 'Please supply a positive number as column-width' ). ENDIF. lo_column->set_width( width ). RETURN. CATCH cx_sy_conversion_no_number. * Strange stuff passed --> raise error zcx_excel=>raise_text( 'Unable to interpret supplied input as number' ). ENDTRY. ENDIF. * If we get down to here, we have to use whatever is found in autosize. lo_column->set_auto_size( ip_width_autosize ). ENDMETHOD. "SET_COLUMN_WIDTH METHOD set_default_excel_date_format. IF ip_default_excel_date_format IS INITIAL. zcx_excel=>raise_text( 'Default date format cannot be blank' ). ENDIF. default_excel_date_format = ip_default_excel_date_format. ENDMETHOD. "SET_DEFAULT_EXCEL_DATE_FORMAT METHOD set_ignored_errors. mt_ignored_errors = it_ignored_errors. ENDMETHOD. METHOD set_merge. DATA: ls_merge TYPE mty_merge, lv_errormessage TYPE string. ... "just after variables definition IF ip_value IS SUPPLIED OR ip_formula IS SUPPLIED. " if there is a value or formula set the value to the top-left cell "maybe it is necessary to support other paramters for set_cell IF ip_value IS SUPPLIED. me->set_cell( ip_row = ip_row ip_column = ip_column_start ip_value = ip_value ). ENDIF. IF ip_formula IS SUPPLIED. me->set_cell( ip_row = ip_row ip_column = ip_column_start ip_value = ip_formula ). ENDIF. ENDIF. "call to set_merge_style to apply the style to all cells at the matrix IF ip_style IS SUPPLIED. me->set_merge_style( ip_row = ip_row ip_column_start = ip_column_start ip_row_to = ip_row_to ip_column_end = ip_column_end ip_style = ip_style ). ENDIF. ... *--------------------------------------------------------------------* * Build new range area to insert into range table *--------------------------------------------------------------------* ls_merge-row_from = ip_row. IF ip_row IS SUPPLIED AND ip_row IS NOT INITIAL AND ip_row_to IS NOT SUPPLIED. ls_merge-row_to = ls_merge-row_from. ELSE. ls_merge-row_to = ip_row_to. ENDIF. IF ls_merge-row_from > ls_merge-row_to. lv_errormessage = 'Merge: First row larger then last row'(405). zcx_excel=>raise_text( lv_errormessage ). ENDIF. ls_merge-col_from = zcl_excel_common=>convert_column2int( ip_column_start ). IF ip_column_start IS SUPPLIED AND ip_column_start IS NOT INITIAL AND ip_column_end IS NOT SUPPLIED. ls_merge-col_to = ls_merge-col_from. ELSE. ls_merge-col_to = zcl_excel_common=>convert_column2int( ip_column_end ). ENDIF. IF ls_merge-col_from > ls_merge-col_to. lv_errormessage = 'Merge: First column larger then last column'(406). zcx_excel=>raise_text( lv_errormessage ). ENDIF. *--------------------------------------------------------------------* * Check merge not overlapping with existing merges *--------------------------------------------------------------------* LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS WHERE NOT ( row_from > ls_merge-row_to OR row_to < ls_merge-row_from OR col_from > ls_merge-col_to OR col_to < ls_merge-col_from ). lv_errormessage = 'Overlapping merges'(404). zcx_excel=>raise_text( lv_errormessage ). ENDLOOP. *--------------------------------------------------------------------* * Everything seems ok --> add to merge table *--------------------------------------------------------------------* INSERT ls_merge INTO TABLE me->mt_merged_cells. ENDMETHOD. "SET_MERGE METHOD set_merge_style. DATA: ld_row_start TYPE zexcel_cell_row, ld_row_end TYPE zexcel_cell_row, ld_column_start TYPE zexcel_cell_column, ld_column_end TYPE zexcel_cell_column, ld_current_column TYPE zexcel_cell_column_alpha, ld_current_row TYPE zexcel_cell_row. ld_row_end = ip_row_to. ld_row_start = ip_row. IF ld_row_end IS INITIAL. ld_row_end = ld_row_start. ENDIF. ld_column_start = zcl_excel_common=>convert_column2int( ip_column_start ). ld_column_end = zcl_excel_common=>convert_column2int( ip_column_end ). IF ld_column_end IS INITIAL. ld_column_end = ld_column_start. ENDIF. "set the style cell by cell WHILE ld_column_start <= ld_column_end. ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start ). ld_current_row = ld_row_start. WHILE ld_current_row <= ld_row_end. me->set_cell_style( ip_row = ld_current_row ip_column = ld_current_column ip_style = ip_style ). ADD 1 TO ld_current_row. ENDWHILE. ADD 1 TO ld_column_start. ENDWHILE. ENDMETHOD. "set_merge_style METHOD set_print_gridlines. me->print_gridlines = i_print_gridlines. ENDMETHOD. "SET_PRINT_GRIDLINES METHOD set_row_height. DATA: lo_row TYPE REF TO zcl_excel_row. DATA: height TYPE float. lo_row = me->get_row( ip_row ). * if a fix size is supplied use this TRY. height = ip_height_fix. IF height <= 0. zcx_excel=>raise_text( 'Please supply a positive number as row-height' ). ENDIF. lo_row->set_row_height( height ). RETURN. CATCH cx_sy_conversion_no_number. * Strange stuff passed --> raise error zcx_excel=>raise_text( 'Unable to interpret supplied input as number' ). ENDTRY. ENDMETHOD. "SET_ROW_HEIGHT METHOD set_row_outline. DATA: ls_row_outline LIKE LINE OF me->mt_row_outlines. FIELD-SYMBOLS: <ls_row_outline> LIKE LINE OF me->mt_row_outlines. READ TABLE me->mt_row_outlines ASSIGNING <ls_row_outline> WITH TABLE KEY row_from = iv_row_from row_to = iv_row_to. IF sy-subrc <> 0. IF iv_row_from <= 0. zcx_excel=>raise_text( 'First row of outline must be a positive number' ). ENDIF. IF iv_row_to < iv_row_from. zcx_excel=>raise_text( 'Last row of outline may not be less than first line of outline' ). ENDIF. ls_row_outline-row_from = iv_row_from. ls_row_outline-row_to = iv_row_to. INSERT ls_row_outline INTO TABLE me->mt_row_outlines ASSIGNING <ls_row_outline>. ENDIF. CASE iv_collapsed. WHEN abap_true OR abap_false. <ls_row_outline>-collapsed = iv_collapsed. WHEN OTHERS. zcx_excel=>raise_text( 'Unknown collapse state' ). ENDCASE. ENDMETHOD. "SET_ROW_OUTLINE METHOD set_show_gridlines. me->show_gridlines = i_show_gridlines. ENDMETHOD. "SET_SHOW_GRIDLINES METHOD set_show_rowcolheaders. me->show_rowcolheaders = i_show_rowcolheaders. ENDMETHOD. "SET_SHOW_ROWCOLHEADERS METHOD set_tabcolor. me->tabcolor = iv_tabcolor. ENDMETHOD. "SET_TABCOLOR METHOD set_table. DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr, lr_data TYPE REF TO data, lt_dfies TYPE ddfields, lv_row_int TYPE zexcel_cell_row, lv_column_int TYPE zexcel_cell_column, lv_column_alpha TYPE zexcel_cell_column_alpha, lv_cell_value TYPE zexcel_cell_value. FIELD-SYMBOLS: <fs_table_line> TYPE any, <fs_fldval> TYPE any, <fs_dfies> TYPE dfies. lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ). lv_row_int = ip_top_left_row. CREATE DATA lr_data LIKE LINE OF ip_table. lo_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ). lt_dfies = lo_tabdescr->get_ddic_field_list( ). * It is better to loop column by column LOOP AT lt_dfies ASSIGNING <fs_dfies>. lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ). IF ip_no_header = abap_false. " First of all write column header lv_cell_value = <fs_dfies>-scrtext_m. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = lv_cell_value ip_style = ip_hdr_style ). IF ip_transpose = abap_true. ADD 1 TO lv_column_int. ELSE. ADD 1 TO lv_row_int. ENDIF. ENDIF. LOOP AT ip_table ASSIGNING <fs_table_line>. lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ). ASSIGN COMPONENT <fs_dfies>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>. lv_cell_value = <fs_fldval>. me->set_cell( ip_column = lv_column_alpha ip_row = lv_row_int ip_value = <fs_fldval> "lv_cell_value ip_style = ip_body_style ). IF ip_transpose = abap_true. ADD 1 TO lv_column_int. ELSE. ADD 1 TO lv_row_int. ENDIF. ENDLOOP. IF ip_transpose = abap_true. lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ). ADD 1 TO lv_row_int. ELSE. lv_row_int = ip_top_left_row. ADD 1 TO lv_column_int. ENDIF. ENDLOOP. ENDMETHOD. "SET_TABLE METHOD set_title. *--------------------------------------------------------------------* * ToDos: * 2do §1 The current coding for replacing a named ranges name * after renaming a sheet should be checked if it is * really working if sheetname should be escaped *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (wip ) 2012-12-08 * - ... * changes: aligning code * message made to support multilinguality *--------------------------------------------------------------------* * issue#243 - ' is not allowed as first character in sheet title * - Stefan Schmoecker, 2012-12-02 * changes: added additional check for ' as first character *--------------------------------------------------------------------* DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator, lo_worksheet TYPE REF TO zcl_excel_worksheet, errormessage TYPE string, lv_rangesheetname_old TYPE string, lv_rangesheetname_new TYPE string, lo_ranges_iterator TYPE REF TO cl_object_collection_iterator, lo_range TYPE REF TO zcl_excel_range, lv_range_value TYPE zexcel_range_value, lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class *--------------------------------------------------------------------* * Check whether title consists only of allowed characters * Illegal characters are: / \ [ ] * ? : --> http://msdn.microsoft.com/en-us/library/ff837411.aspx * Illegal characters not in documentation: ' as first character *--------------------------------------------------------------------* IF ip_title CA '/\[]*?:'. lv_errormessage = 'Found illegal character in sheetname. List of forbidden characters: /\[]*?:'(402). zcx_excel=>raise_text( lv_errormessage ). ENDIF. IF ip_title IS NOT INITIAL AND ip_title(1) = `'`. lv_errormessage = 'Sheetname may not start with &'(403). " & used instead of ' to allow fallbacklanguage REPLACE '&' IN lv_errormessage WITH `'`. zcx_excel=>raise_text( lv_errormessage ). ENDIF. *--------------------------------------------------------------------* * Check whether title is unique in workbook *--------------------------------------------------------------------* lo_worksheets_iterator = me->excel->get_worksheets_iterator( ). WHILE lo_worksheets_iterator->has_next( ) = 'X'. lo_worksheet ?= lo_worksheets_iterator->get_next( ). CHECK me->guid <> lo_worksheet->get_guid( ). " Don't check against itself IF ip_title = lo_worksheet->get_title( ). " Not unique --> raise exception errormessage = 'Duplicate sheetname &'. REPLACE '&' IN errormessage WITH ip_title. zcx_excel=>raise_text( errormessage ). ENDIF. ENDWHILE. *--------------------------------------------------------------------* * Remember old sheetname and rename sheet to desired name *--------------------------------------------------------------------* CONCATENATE me->title '!' INTO lv_rangesheetname_old. me->title = ip_title. *--------------------------------------------------------------------* * After changing this worksheet's title we have to adjust * all ranges that are referring to this worksheet. *--------------------------------------------------------------------* * 2do §1 - Check if the following quickfix is solid * I fear it isn't - but this implementation is better then * nothing at all since it handles a supposed majority of cases *--------------------------------------------------------------------* CONCATENATE me->title '!' INTO lv_rangesheetname_new. lo_ranges_iterator = me->excel->get_ranges_iterator( ). WHILE lo_ranges_iterator->has_next( ) = 'X'. lo_range ?= lo_ranges_iterator->get_next( ). lv_range_value = lo_range->get_value( ). REPLACE ALL OCCURRENCES OF lv_rangesheetname_old IN lv_range_value WITH lv_rangesheetname_new. IF sy-subrc = 0. lo_range->set_range_value( lv_range_value ). ENDIF. ENDWHILE. ENDMETHOD. "SET_TITLE METHOD update_dimension_range. DATA: ls_sheet_content TYPE zexcel_s_cell_data, lv_row_alpha TYPE string, lv_column_alpha TYPE zexcel_cell_column_alpha. CHECK sheet_content IS NOT INITIAL. upper_cell-cell_row = rows->get_min_index( ). IF upper_cell-cell_row = 0. upper_cell-cell_row = zcl_excel_common=>c_excel_sheet_max_row. ENDIF. upper_cell-cell_column = zcl_excel_common=>c_excel_sheet_max_col. lower_cell-cell_row = rows->get_max_index( ). IF lower_cell-cell_row = 0. lower_cell-cell_row = zcl_excel_common=>c_excel_sheet_min_row. ENDIF. lower_cell-cell_column = zcl_excel_common=>c_excel_sheet_min_col. LOOP AT sheet_content INTO ls_sheet_content. IF upper_cell-cell_row > ls_sheet_content-cell_row. upper_cell-cell_row = ls_sheet_content-cell_row. ENDIF. IF upper_cell-cell_column > ls_sheet_content-cell_column. upper_cell-cell_column = ls_sheet_content-cell_column. ENDIF. IF lower_cell-cell_row < ls_sheet_content-cell_row. lower_cell-cell_row = ls_sheet_content-cell_row. ENDIF. IF lower_cell-cell_column < ls_sheet_content-cell_column. lower_cell-cell_column = ls_sheet_content-cell_column. ENDIF. ENDLOOP. lv_row_alpha = upper_cell-cell_row. lv_column_alpha = zcl_excel_common=>convert_column2alpha( upper_cell-cell_column ). SHIFT lv_row_alpha RIGHT DELETING TRAILING space. SHIFT lv_row_alpha LEFT DELETING LEADING space. CONCATENATE lv_column_alpha lv_row_alpha INTO upper_cell-cell_coords. lv_row_alpha = lower_cell-cell_row. lv_column_alpha = zcl_excel_common=>convert_column2alpha( lower_cell-cell_column ). SHIFT lv_row_alpha RIGHT DELETING TRAILING space. SHIFT lv_row_alpha LEFT DELETING LEADING space. CONCATENATE lv_column_alpha lv_row_alpha INTO lower_cell-cell_coords. ENDMETHOD. "UPDATE_DIMENSION_RANGE METHOD zif_excel_sheet_printsettings~clear_print_repeat_columns. *--------------------------------------------------------------------* * adjust internal representation *--------------------------------------------------------------------* CLEAR: me->print_title_col_from, me->print_title_col_to . *--------------------------------------------------------------------* * adjust corresponding range *--------------------------------------------------------------------* me->print_title_set_range( ). ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_COLUMNS METHOD zif_excel_sheet_printsettings~clear_print_repeat_rows. *--------------------------------------------------------------------* * adjust internal representation *--------------------------------------------------------------------* CLEAR: me->print_title_row_from, me->print_title_row_to . *--------------------------------------------------------------------* * adjust corresponding range *--------------------------------------------------------------------* me->print_title_set_range( ). ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_ROWS METHOD zif_excel_sheet_printsettings~get_print_repeat_columns. ev_columns_from = me->print_title_col_from. ev_columns_to = me->print_title_col_to. ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_COLUMNS METHOD zif_excel_sheet_printsettings~get_print_repeat_rows. ev_rows_from = me->print_title_row_from. ev_rows_to = me->print_title_row_to. ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_ROWS METHOD zif_excel_sheet_printsettings~set_print_repeat_columns. *--------------------------------------------------------------------* * issue#235 - repeat rows/columns * - Stefan Schmöcker, 2012-12-02 *--------------------------------------------------------------------* DATA: lv_col_from_int TYPE i, lv_col_to_int TYPE i, lv_errormessage TYPE string. lv_col_from_int = zcl_excel_common=>convert_column2int( iv_columns_from ). lv_col_to_int = zcl_excel_common=>convert_column2int( iv_columns_to ). *--------------------------------------------------------------------* * Check if valid range is supplied *--------------------------------------------------------------------* IF lv_col_from_int < 1. lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401). zcx_excel=>raise_text( lv_errormessage ). ENDIF. IF lv_col_from_int > lv_col_to_int. lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401). zcx_excel=>raise_text( lv_errormessage ). ENDIF. *--------------------------------------------------------------------* * adjust internal representation *--------------------------------------------------------------------* me->print_title_col_from = iv_columns_from. me->print_title_col_to = iv_columns_to. *--------------------------------------------------------------------* * adjust corresponding range *--------------------------------------------------------------------* me->print_title_set_range( ). ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_COLUMNS METHOD zif_excel_sheet_printsettings~set_print_repeat_rows. *--------------------------------------------------------------------* * issue#235 - repeat rows/columns * - Stefan Schmöcker, 2012-12-02 *--------------------------------------------------------------------* DATA: lv_errormessage TYPE string. *--------------------------------------------------------------------* * Check if valid range is supplied *--------------------------------------------------------------------* IF iv_rows_from < 1. lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401). zcx_excel=>raise_text( lv_errormessage ). ENDIF. IF iv_rows_from > iv_rows_to. lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401). zcx_excel=>raise_text( lv_errormessage ). ENDIF. *--------------------------------------------------------------------* * adjust internal representation *--------------------------------------------------------------------* me->print_title_row_from = iv_rows_from. me->print_title_row_to = iv_rows_to. *--------------------------------------------------------------------* * adjust corresponding range *--------------------------------------------------------------------* me->print_title_set_range( ). ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_ROWS METHOD zif_excel_sheet_properties~get_right_to_left. result = right_to_left. ENDMETHOD. METHOD zif_excel_sheet_properties~get_style. IF zif_excel_sheet_properties~style IS NOT INITIAL. ep_style = zif_excel_sheet_properties~style. ELSE. ep_style = me->excel->get_default_style( ). ENDIF. ENDMETHOD. "ZIF_EXCEL_SHEET_PROPERTIES~GET_STYLE METHOD zif_excel_sheet_properties~initialize. zif_excel_sheet_properties~show_zeros = zif_excel_sheet_properties=>c_showzero. zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_on. zif_excel_sheet_properties~summaryright = zif_excel_sheet_properties=>c_right_on. * inizialize zoomscale values zif_excel_sheet_properties~zoomscale = 100. zif_excel_sheet_properties~zoomscale_normal = 100. zif_excel_sheet_properties~zoomscale_pagelayoutview = 100 . zif_excel_sheet_properties~zoomscale_sheetlayoutview = 100 . ENDMETHOD. "ZIF_EXCEL_SHEET_PROPERTIES~INITIALIZE METHOD zif_excel_sheet_properties~set_right_to_left. me->right_to_left = right_to_left. ENDMETHOD. METHOD zif_excel_sheet_properties~set_style. zif_excel_sheet_properties~style = ip_style. ENDMETHOD. "ZIF_EXCEL_SHEET_PROPERTIES~SET_STYLE METHOD zif_excel_sheet_protection~initialize. me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_unprotected. CLEAR me->zif_excel_sheet_protection~password. me->zif_excel_sheet_protection~auto_filter = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~delete_columns = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~delete_rows = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~format_cells = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~format_columns = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~format_rows = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~insert_columns = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~insert_hyperlinks = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~insert_rows = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_noactive. * me->zif_excel_sheet_protection~password = zif_excel_sheet_protection=>c_noactive. "issue #68 me->zif_excel_sheet_protection~pivot_tables = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~select_locked_cells = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~select_unlocked_cells = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_noactive. me->zif_excel_sheet_protection~sort = zif_excel_sheet_protection=>c_noactive. ENDMETHOD. "ZIF_EXCEL_SHEET_PROTECTION~INITIALIZE METHOD zif_excel_sheet_vba_project~set_codename. me->zif_excel_sheet_vba_project~codename = ip_codename. ENDMETHOD. "ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME METHOD zif_excel_sheet_vba_project~set_codename_pr. me->zif_excel_sheet_vba_project~codename_pr = ip_codename_pr. ENDMETHOD. "ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME_PR ENDCLASS.
38.640818
217
0.628313
9879e37c65a814a1fc9b7478d23cc9aed00c16ef
4,418
abap
ABAP
src/zcl_web_hooks_event_handler.clas.abap
Allam76/abapWebHooks
1f21f5834ef911592000a46a1fd57fe2ea86f267
[ "MIT" ]
null
null
null
src/zcl_web_hooks_event_handler.clas.abap
Allam76/abapWebHooks
1f21f5834ef911592000a46a1fd57fe2ea86f267
[ "MIT" ]
null
null
null
src/zcl_web_hooks_event_handler.clas.abap
Allam76/abapWebHooks
1f21f5834ef911592000a46a1fd57fe2ea86f267
[ "MIT" ]
null
null
null
class zcl_web_hooks_event_handler definition public create public . public section. interfaces bi_event_handler_static . class-methods send importing rectype type swfdevtyp-rectype data type string. class-methods convert_to_json importing id type string container type ref to if_swf_ifs_parameter_container returning value(data) type string. protected section. private section. endclass. class zcl_web_hooks_event_handler implementation. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Static Public Method ZCL_WEB_HOOKS_EVENT_HANDLER=>BI_EVENT_HANDLER_STATIC~ON_EVENT * +-------------------------------------------------------------------------------------------------+ * | [--->] SENDER TYPE SIBFLPORB * | [--->] EVENT TYPE SIBFEVENT * | [--->] EVENT_CONTAINER TYPE REF TO IF_SWF_IFS_PARAMETER_CONTAINER * | [--->] RECTYPE TYPE SWFERECTYP * | [--->] HANDLER TYPE SIBFLPORB * | [<---] RESULT TYPE SWFREVRSLT * | [!CX!] CX_BO_ERROR * | [!CX!] CX_BO_TEMPORARY * +--------------------------------------------------------------------------------------</SIGNATURE> method bi_event_handler_static~on_event. data l_rectype type swfdevtyp-rectype. select single swfdevtyp~rectype from swfdevtyp inner join swfdevena on swfdevtyp~objcateg = swfdevena~objcateg and swfdevtyp~objtype = swfdevena~objtype and swfdevtyp~event = swfdevena~event and swfdevtyp~rectype = swfdevena~rectype into l_rectype where swfdevtyp~objcateg = 'BO' and swfdevtyp~objtype = sender-objtype and swfdevtyp~event = event and swfdevtyp~rectype = rectype and swfdevena~enabled = 'X'. if sy-subrc = 0. send( rectype = l_rectype data = convert_to_json( id = conv #( sender-instid ) container = event_container ) ). endif. endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Static Public Method ZCL_WEB_HOOKS_EVENT_HANDLER=>CONVERT_TO_JSON * +-------------------------------------------------------------------------------------------------+ * | [--->] ID TYPE STRING * | [--->] CONTAINER TYPE REF TO IF_SWF_IFS_PARAMETER_CONTAINER * | [<-()] DATA TYPE STRING * +--------------------------------------------------------------------------------------</SIGNATURE> method convert_to_json. data(lo_json) = zcl_json_document=>create( ). lo_json->append_data( exporting iv_name = 'id' data = id ). data(lt_par_names) = container->list_names( ). loop at lt_par_names into data(l_par_name). container->get_value_ref( exporting name = l_par_name importing value_ref = data(lo_par) ). lo_json->append_data( exporting iv_name = conv #( l_par_name ) data = lo_par ). endloop. data = lo_json->get_json( ). endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Static Public Method ZCL_WEB_HOOKS_EVENT_HANDLER=>SEND * +-------------------------------------------------------------------------------------------------+ * | [--->] RECTYPE TYPE SWFDEVTYP-RECTYPE * | [--->] DATA TYPE STRING * +--------------------------------------------------------------------------------------</SIGNATURE> method send. cl_http_client=>create( exporting host = conv #( rectype ) service = '' importing client = data(lo_client) exceptions others = 4 ). if sy-subrc <> 0. return. endif. lo_client->request->set_method( 'POST' ). lo_client->request->set_cdata( data ). lo_client->send( exceptions others = 4 ). if sy-subrc <> 0. lo_client->get_last_error( importing message = data(smsg) ). return. endif. lo_client->receive( exceptions others = 4 ). if sy-subrc <> 0. lo_client->get_last_error( importing message = data(rmsg) ). return. endif. data(l_return) = lo_client->response->get_cdata( ). lo_client->close( ). endmethod. endclass.
39.097345
144
0.500679
987ba6e22a00cc7ec49d2226b6d1eea61d16e8c0
5,417
abap
ABAP
src/ui/core/zcl_abapgit_gui_css_processor.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
3
2020-05-31T18:55:42.000Z
2021-01-08T21:36:09.000Z
src/ui/core/zcl_abapgit_gui_css_processor.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
null
null
null
src/ui/core/zcl_abapgit_gui_css_processor.clas.abap
timbolski/downport
c5fa01ed27c8265606d7a67832d64164d1769c79
[ "MIT" ]
2
2021-01-08T21:36:15.000Z
2022-03-29T05:40:00.000Z
CLASS zcl_abapgit_gui_css_processor DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. METHODS: constructor IMPORTING ii_asset_manager TYPE REF TO zif_abapgit_gui_asset_manager, add_file IMPORTING iv_url TYPE string, process RETURNING VALUE(rv_result) TYPE string RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_css_var, name TYPE string, value TYPE string, END OF ty_css_var, ty_css_vars TYPE SORTED TABLE OF ty_css_var WITH UNIQUE KEY name. METHODS: get_css_vars_in_string IMPORTING iv_string TYPE string RETURNING VALUE(rt_variables) TYPE ty_css_vars, resolve_var_recursively IMPORTING iv_variable_name TYPE string CHANGING ct_variables TYPE ty_css_vars RAISING zcx_abapgit_exception. DATA: mi_asset_manager TYPE REF TO zif_abapgit_gui_asset_manager, mt_files TYPE string_table. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_CSS_PROCESSOR IMPLEMENTATION. METHOD add_file. APPEND iv_url TO mt_files. ENDMETHOD. METHOD constructor. mi_asset_manager = ii_asset_manager. ENDMETHOD. METHOD get_css_vars_in_string. CONSTANTS: lc_root_pattern TYPE string VALUE `:root\s*\{([^\}]*)\}`, lc_variable_pattern TYPE string VALUE `\-\-([\w\d-]+)\s*:\s*([^\n\r;]*);`. DATA: lv_root TYPE string, lo_matcher TYPE REF TO cl_abap_matcher, lo_regex TYPE REF TO cl_abap_regex, ls_variable LIKE LINE OF rt_variables. " Only the :root element may define variables for now FIND FIRST OCCURRENCE OF REGEX lc_root_pattern IN iv_string SUBMATCHES lv_root. IF sy-subrc = 0 AND lv_root IS NOT INITIAL. CREATE OBJECT lo_regex EXPORTING pattern = lc_variable_pattern. lo_matcher = lo_regex->create_matcher( text = lv_root ). WHILE lo_matcher->find_next( ) = abap_true. ls_variable-name = lo_matcher->get_submatch( 1 ). ls_variable-value = lo_matcher->get_submatch( 2 ). INSERT ls_variable INTO TABLE rt_variables. IF sy-subrc <> 0. MODIFY TABLE rt_variables FROM ls_variable. ENDIF. ENDWHILE. ENDIF. ENDMETHOD. METHOD process. DATA: lt_contents TYPE STANDARD TABLE OF string, lv_content TYPE string, lt_css_variables TYPE ty_css_vars, lt_css_vars_in_file TYPE ty_css_vars. FIELD-SYMBOLS: <lv_url> TYPE string, <ls_css_variable> LIKE LINE OF lt_css_vars_in_file, <lv_content> LIKE LINE OF lt_contents. " 1. Determine all variables and their values. Later definitions overwrite previous ones. LOOP AT mt_files ASSIGNING <lv_url>. lv_content = mi_asset_manager->get_text_asset( iv_url = <lv_url> iv_assert_subtype = 'css' ). lt_css_vars_in_file = get_css_vars_in_string( lv_content ). LOOP AT lt_css_vars_in_file ASSIGNING <ls_css_variable>. INSERT <ls_css_variable> INTO TABLE lt_css_variables. IF sy-subrc <> 0. MODIFY TABLE lt_css_variables FROM <ls_css_variable>. ENDIF. ENDLOOP. APPEND lv_content TO lt_contents. ENDLOOP. " 2. Replace all variable usages in variables LOOP AT lt_css_variables ASSIGNING <ls_css_variable> WHERE value CS 'var(--'. resolve_var_recursively( EXPORTING iv_variable_name = <ls_css_variable>-name CHANGING ct_variables = lt_css_variables ). ENDLOOP. " 3. Replace all other variable usages by inlining the values. LOOP AT lt_contents ASSIGNING <lv_content>. LOOP AT lt_css_variables ASSIGNING <ls_css_variable>. REPLACE ALL OCCURRENCES OF |var(--{ <ls_css_variable>-name })| IN <lv_content> WITH <ls_css_variable>-value. ENDLOOP. ENDLOOP. rv_result = concat_lines_of( table = lt_contents sep = cl_abap_char_utilities=>newline ). ENDMETHOD. METHOD resolve_var_recursively. CONSTANTS: lc_variable_usage_pattern TYPE string VALUE `var\(\-\-([^\)]*)\)`. DATA: lv_variable_name TYPE string. FIELD-SYMBOLS: <ls_variable> LIKE LINE OF ct_variables, <ls_other_variable> LIKE LINE OF ct_variables. READ TABLE ct_variables WITH TABLE KEY name = iv_variable_name ASSIGNING <ls_variable>. IF sy-subrc = 0. DO. FIND FIRST OCCURRENCE OF REGEX lc_variable_usage_pattern IN <ls_variable>-value SUBMATCHES lv_variable_name. IF sy-subrc = 0. resolve_var_recursively( EXPORTING iv_variable_name = lv_variable_name CHANGING ct_variables = ct_variables ). READ TABLE ct_variables WITH TABLE KEY name = lv_variable_name ASSIGNING <ls_other_variable>. REPLACE FIRST OCCURRENCE OF |var(--{ lv_variable_name })| IN <ls_variable>-value WITH <ls_other_variable>-value. ELSE. EXIT. ENDIF. ENDDO. ELSE. zcx_abapgit_exception=>raise( |CSS variable { iv_variable_name } not resolveable| ). ENDIF. ENDMETHOD. ENDCLASS.
33.233129
103
0.646853
987f224c0954e3531210ff16d8c00689af5bc702
11,389
abap
ABAP
src/objects/zcl_abapgit_objects_super.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
2
2020-11-17T10:39:56.000Z
2021-02-25T09:31:47.000Z
src/objects/zcl_abapgit_objects_super.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
40
2021-06-01T05:58:26.000Z
2022-03-01T05:02:17.000Z
src/objects/zcl_abapgit_objects_super.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
1
2021-08-18T07:58:26.000Z
2021-08-18T07:58:26.000Z
CLASS zcl_abapgit_objects_super DEFINITION PUBLIC ABSTRACT CREATE PUBLIC . PUBLIC SECTION. CONSTANTS c_user_unknown TYPE xubname VALUE 'UNKNOWN'. METHODS constructor IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_language TYPE spras . CLASS-METHODS jump_adt IMPORTING !iv_obj_name TYPE zif_abapgit_definitions=>ty_item-obj_name !iv_obj_type TYPE zif_abapgit_definitions=>ty_item-obj_type !iv_sub_obj_name TYPE zif_abapgit_definitions=>ty_item-obj_name OPTIONAL !iv_sub_obj_type TYPE zif_abapgit_definitions=>ty_item-obj_type OPTIONAL !iv_line_number TYPE i OPTIONAL RAISING zcx_abapgit_exception . PROTECTED SECTION. DATA ms_item TYPE zif_abapgit_definitions=>ty_item . DATA mv_language TYPE spras . METHODS get_metadata RETURNING VALUE(rs_metadata) TYPE zif_abapgit_definitions=>ty_metadata . METHODS corr_insert IMPORTING !iv_package TYPE devclass !ig_object_class TYPE any OPTIONAL RAISING zcx_abapgit_exception . METHODS tadir_insert IMPORTING !iv_package TYPE devclass RAISING zcx_abapgit_exception . METHODS jump_se11 RAISING zcx_abapgit_exception . METHODS exists_a_lock_entry_for IMPORTING !iv_lock_object TYPE string !iv_argument TYPE seqg3-garg OPTIONAL RETURNING VALUE(rv_exists_a_lock_entry) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS set_default_package IMPORTING !iv_package TYPE devclass . METHODS serialize_longtexts IMPORTING !ii_xml TYPE REF TO zif_abapgit_xml_output !iv_longtext_id TYPE dokil-id OPTIONAL !it_dokil TYPE zif_abapgit_definitions=>ty_dokil_tt OPTIONAL RAISING zcx_abapgit_exception . METHODS deserialize_longtexts IMPORTING !ii_xml TYPE REF TO zif_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS delete_longtexts IMPORTING !iv_longtext_id TYPE dokil-id RAISING zcx_abapgit_exception . METHODS is_active RETURNING VALUE(rv_active) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS delete_ddic IMPORTING VALUE(iv_objtype) TYPE string VALUE(iv_no_ask) TYPE abap_bool DEFAULT abap_true VALUE(iv_no_ask_delete_append) TYPE abap_bool DEFAULT abap_false RAISING zcx_abapgit_exception . METHODS serialize_lxe_texts IMPORTING !ii_xml TYPE REF TO zif_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_lxe_texts IMPORTING !ii_xml TYPE REF TO zif_abapgit_xml_input RAISING zcx_abapgit_exception . PRIVATE SECTION. ENDCLASS. CLASS zcl_abapgit_objects_super IMPLEMENTATION. METHOD constructor. ms_item = is_item. ASSERT NOT ms_item IS INITIAL. mv_language = iv_language. ASSERT NOT mv_language IS INITIAL. ENDMETHOD. METHOD corr_insert. DATA: lv_object TYPE string, lv_object_class TYPE string. IF ig_object_class IS NOT INITIAL. lv_object_class = ig_object_class. IF ig_object_class = 'DICT'. CONCATENATE ms_item-obj_type ms_item-obj_name INTO lv_object. ELSE. lv_object = ms_item-obj_name. ENDIF. ELSE. lv_object_class = ms_item-obj_type. lv_object = ms_item-obj_name. ENDIF. CALL FUNCTION 'RS_CORR_INSERT' EXPORTING object = lv_object object_class = lv_object_class devclass = iv_package master_language = mv_language global_lock = abap_true mode = 'I' 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. ENDMETHOD. METHOD delete_ddic. DATA: lv_objname TYPE rsedd0-ddobjname, lv_objtype TYPE rsedd0-ddobjtype. lv_objname = ms_item-obj_name. lv_objtype = iv_objtype. TRY. CALL FUNCTION 'RS_DD_DELETE_OBJ' EXPORTING no_ask = iv_no_ask objname = lv_objname objtype = lv_objtype no_ask_delete_append = iv_no_ask_delete_append EXCEPTIONS not_executed = 1 object_not_found = 2 object_not_specified = 3 permission_failure = 4 dialog_needed = 5 OTHERS = 6. CATCH cx_sy_dyn_call_param_not_found. " no_ask_delete_append not available in lower releases CALL FUNCTION 'RS_DD_DELETE_OBJ' EXPORTING no_ask = iv_no_ask objname = lv_objname objtype = lv_objtype EXCEPTIONS not_executed = 1 object_not_found = 2 object_not_specified = 3 permission_failure = 4 dialog_needed = 5 OTHERS = 6. ENDTRY. IF sy-subrc = 5. zcx_abapgit_exception=>raise( |Object { ms_item-obj_type } { ms_item-obj_name } has dependencies and must be deleted manually| ). ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Error deleting { ms_item-obj_type } { ms_item-obj_name }| ). ENDIF. ENDMETHOD. METHOD delete_longtexts. zcl_abapgit_factory=>get_longtexts( )->delete( iv_longtext_id = iv_longtext_id iv_object_name = ms_item-obj_name ). ENDMETHOD. METHOD deserialize_longtexts. zcl_abapgit_factory=>get_longtexts( )->deserialize( ii_xml = ii_xml iv_main_language = mv_language ). ENDMETHOD. METHOD deserialize_lxe_texts. zcl_abapgit_factory=>get_lxe_texts( )->deserialize( iv_object_type = ms_item-obj_type iv_object_name = ms_item-obj_name ii_xml = ii_xml ). ENDMETHOD. METHOD exists_a_lock_entry_for. DATA: lt_lock_entries TYPE STANDARD TABLE OF seqg3. CALL FUNCTION 'ENQUEUE_READ' EXPORTING guname = '*' garg = iv_argument TABLES enq = lt_lock_entries EXCEPTIONS communication_failure = 1 system_failure = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. READ TABLE lt_lock_entries TRANSPORTING NO FIELDS WITH KEY gobj = iv_lock_object. IF sy-subrc = 0. rv_exists_a_lock_entry = abap_true. ENDIF. ENDMETHOD. METHOD get_metadata. DATA: lv_class TYPE string. lv_class = cl_abap_classdescr=>describe_by_object_ref( me )->get_relative_name( ). REPLACE FIRST OCCURRENCE OF 'ZCL_ABAPGIT' IN lv_class WITH 'LCL'. rs_metadata-class = lv_class. rs_metadata-version = 'v1.0.0'. ENDMETHOD. METHOD is_active. DATA: lt_messages TYPE STANDARD TABLE OF sprot_u WITH DEFAULT KEY, lt_e071_tadirs TYPE STANDARD TABLE OF e071 WITH DEFAULT KEY, ls_e071_tadir LIKE LINE OF lt_e071_tadirs. ms_item-inactive = abap_false. ls_e071_tadir-object = ms_item-obj_type. ls_e071_tadir-obj_name = ms_item-obj_name. INSERT ls_e071_tadir INTO TABLE lt_e071_tadirs. CALL FUNCTION 'RS_INACTIVE_OBJECTS_WARNING' EXPORTING suppress_protocol = abap_false with_program_includes = abap_false suppress_dictionary_check = abap_false TABLES p_e071 = lt_e071_tadirs p_xmsg = lt_messages. IF lt_messages IS NOT INITIAL. ms_item-inactive = abap_true. ENDIF. rv_active = boolc( ms_item-inactive = abap_false ). ENDMETHOD. METHOD jump_adt. DATA: lv_adt_link TYPE string, lx_error TYPE REF TO cx_root. TRY. lv_adt_link = zcl_abapgit_adt_link=>generate( iv_obj_name = iv_obj_name iv_obj_type = iv_obj_type iv_sub_obj_name = iv_sub_obj_name iv_line_number = iv_line_number ). cl_gui_frontend_services=>execute( EXPORTING document = lv_adt_link EXCEPTIONS OTHERS = 1 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |ADT Jump Error - failed to open link { lv_adt_link }. Subrc={ sy-subrc }| ). ENDIF. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = 'ADT Jump Error' ix_previous = lx_error ). ENDTRY. ENDMETHOD. METHOD jump_se11. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = ms_item-obj_name object_type = ms_item-obj_type devclass = ms_item-devclass in_new_window = abap_true EXCEPTIONS not_executed = 1 invalid_object_type = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Jump to SE11 failed (subrc={ sy-subrc } ).| ). ENDIF. ENDMETHOD. METHOD serialize_longtexts. zcl_abapgit_factory=>get_longtexts( )->serialize( iv_object_name = ms_item-obj_name iv_longtext_id = iv_longtext_id it_dokil = it_dokil ii_xml = ii_xml ). ENDMETHOD. METHOD serialize_lxe_texts. IF ii_xml->i18n_params( )-main_language_only = abap_true OR ii_xml->i18n_params( )-translation_languages IS INITIAL. RETURN. ENDIF. zcl_abapgit_factory=>get_lxe_texts( )->serialize( iv_object_type = ms_item-obj_type iv_object_name = ms_item-obj_name ii_xml = ii_xml ). ENDMETHOD. METHOD set_default_package. " In certain cases we need to set the package package via ABAP memory " because we can't supply it via the APIs. " " Set default package, see function module RS_CORR_INSERT FORM get_current_devclass. " " We use ABAP memory instead the SET parameter because it is " more reliable. SET parameter doesn't work when multiple objects " are deserialized which uses the ABAP memory mechanism. " We don't need to reset the memory as it is done in above mentioned form routine. EXPORT current_devclass FROM iv_package TO MEMORY ID 'EUK'. ENDMETHOD. METHOD tadir_insert. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = abap_false wi_tadir_pgmid = 'R3TR' wi_tadir_object = ms_item-obj_type wi_tadir_obj_name = ms_item-obj_name wi_tadir_author = sy-uname wi_tadir_devclass = iv_package wi_tadir_masterlang = mv_language iv_delflag = abap_false EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. ENDCLASS.
27.778049
117
0.626043
98848f8656d84d832ad871fd8657535acec8837c
7,230
abap
ABAP
src/rtti/cl_abap_typedescr.clas.testclasses.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
src/rtti/cl_abap_typedescr.clas.testclasses.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
src/rtti/cl_abap_typedescr.clas.testclasses.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
CLASS ltcl_test DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PRIVATE SECTION. METHODS typekind_int FOR TESTING. METHODS typekind_char FOR TESTING. METHODS typekind_structure FOR TESTING. METHODS typekind_xstring FOR TESTING. METHODS typekind_string FOR TESTING. METHODS typekind_date FOR TESTING. METHODS typekind_time FOR TESTING. METHODS typekind_dref FOR TESTING. METHODS typekind_numc FOR TESTING. METHODS typekind_hex FOR TESTING. METHODS kind_elem FOR TESTING. METHODS kind_table FOR TESTING. METHODS field_symbol FOR TESTING. METHODS abap_bool_absolute FOR TESTING. METHODS abap_true_absolute FOR TESTING. METHODS xsdboolean_absolute FOR TESTING. METHODS describe_by_name_t000 FOR TESTING. ENDCLASS. CLASS ltcl_test IMPLEMENTATION. METHOD kind_elem. DATA lv_int TYPE i. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( lv_int ). cl_abap_unit_assert=>assert_equals( act = type->kind exp = cl_abap_typedescr=>kind_elem ). ENDMETHOD. METHOD kind_table. DATA tab TYPE STANDARD TABLE OF i WITH DEFAULT KEY. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( tab ). cl_abap_unit_assert=>assert_equals( act = type->kind exp = cl_abap_typedescr=>kind_table ). ENDMETHOD. METHOD typekind_char. DATA cthing TYPE c LENGTH 3. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( cthing ). cl_abap_unit_assert=>assert_not_initial( type ). cl_abap_unit_assert=>assert_not_initial( type->type_kind ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_char ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 6 ). " yes, UTF16 in internal representation ENDMETHOD. METHOD typekind_dref. DATA foo TYPE REF TO data. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( foo ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_dref ). ENDMETHOD. METHOD typekind_int. DATA integer TYPE i. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( integer ). cl_abap_unit_assert=>assert_not_initial( type ). cl_abap_unit_assert=>assert_not_initial( type->type_kind ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_int ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 4 ). ENDMETHOD. METHOD typekind_xstring. DATA data TYPE xstring. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( data ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_xstring ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 8 ). ENDMETHOD. METHOD typekind_string. DATA data TYPE string. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( data ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_string ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 8 ). ENDMETHOD. METHOD typekind_structure. TYPES: BEGIN OF ty_struc, a TYPE string, c TYPE i, END OF ty_struc. DATA ls_struc_act TYPE ty_struc. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( ls_struc_act ). cl_abap_unit_assert=>assert_not_initial( type ). cl_abap_unit_assert=>assert_not_initial( type->type_kind ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_struct2 ). ENDMETHOD. METHOD field_symbol. DATA integer TYPE i. DATA type TYPE REF TO cl_abap_typedescr. FIELD-SYMBOLS <fs> TYPE i. ASSIGN integer TO <fs>. type = cl_abap_typedescr=>describe_by_data( <fs> ). cl_abap_unit_assert=>assert_not_initial( type ). cl_abap_unit_assert=>assert_not_initial( type->type_kind ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_int ). ENDMETHOD. METHOD typekind_date. DATA data TYPE d. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( data ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_date ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 16 ). ENDMETHOD. METHOD typekind_time. DATA data TYPE t. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( data ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_time ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 12 ). ENDMETHOD. METHOD typekind_hex. DATA data TYPE x LENGTH 4. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( data ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_hex ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 4 ). ENDMETHOD. METHOD typekind_numc. DATA data TYPE n LENGTH 4. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( data ). cl_abap_unit_assert=>assert_equals( act = type->type_kind exp = cl_abap_typedescr=>typekind_num ). cl_abap_unit_assert=>assert_equals( act = type->length exp = 8 ). ENDMETHOD. METHOD abap_bool_absolute. DATA bool TYPE abap_bool. DATA lo_type TYPE REF TO cl_abap_typedescr. lo_type = cl_abap_typedescr=>describe_by_data( bool ). * this is checked in ajson(which is used by abapGit) cl_abap_unit_assert=>assert_equals( act = lo_type->absolute_name exp = '\TYPE-POOL=ABAP\TYPE=ABAP_BOOL' ). ENDMETHOD. METHOD abap_true_absolute. DATA lo_type TYPE REF TO cl_abap_typedescr. lo_type = cl_abap_typedescr=>describe_by_data( abap_true ). * this is checked in ajson(which is used by abapGit) cl_abap_unit_assert=>assert_equals( act = lo_type->absolute_name exp = '\TYPE-POOL=ABAP\TYPE=ABAP_BOOL' ). ENDMETHOD. METHOD xsdboolean_absolute. DATA lo_type TYPE REF TO cl_abap_typedescr. DATA lv_xsd TYPE xsdboolean. lo_type = cl_abap_typedescr=>describe_by_data( lv_xsd ). * this is checked in ajson(which is used by abapGit) cl_abap_unit_assert=>assert_equals( act = lo_type->absolute_name exp = '\TYPE=XSDBOOLEAN' ). ENDMETHOD. METHOD describe_by_name_t000. DATA lo_type TYPE REF TO cl_abap_typedescr. lo_type = cl_abap_typedescr=>describe_by_name( 'T000' ). cl_abap_unit_assert=>assert_equals( act = lo_type->kind exp = cl_abap_typedescr=>kind_struct ). ENDMETHOD. ENDCLASS.
31.572052
80
0.710235
988af3d768e7aaf753a868015b29776e4e93aa80
510
abap
ABAP
kapitel_04/mzbook_ticket_status_0050o01.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
12
2018-06-22T10:55:06.000Z
2022-03-22T12:10:48.000Z
kapitel_04/mzbook_ticket_status_0050o01.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
5
2018-06-25T11:45:26.000Z
2019-09-04T19:41:55.000Z
kapitel_04/mzbook_ticket_status_0050o01.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
7
2018-07-02T14:20:28.000Z
2022-03-25T19:33:33.000Z
*----------------------------------------------------------------------* ***INCLUDE MZBOOK_TICKET_STATUS_0050O01 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Module STATUS_0050 OUTPUT *&---------------------------------------------------------------------* MODULE status_0050 OUTPUT. SET PF-STATUS '50'. SET TITLEBAR '50'. CLEAR gv_okcode. ENDMODULE. " STATUS_0050 OUTPUT
36.428571
72
0.288235
988d775082b140f50d3180df7e1c237afc01dbc7
4,117
abap
ABAP
src/zesy_call_oo_bdc.prog.abap
engswee/equalize-bdc-oo-model
bf22d801663b692cae45fd4fd4c2cd5773916ced
[ "MIT" ]
null
null
null
src/zesy_call_oo_bdc.prog.abap
engswee/equalize-bdc-oo-model
bf22d801663b692cae45fd4fd4c2cd5773916ced
[ "MIT" ]
null
null
null
src/zesy_call_oo_bdc.prog.abap
engswee/equalize-bdc-oo-model
bf22d801663b692cae45fd4fd4c2cd5773916ced
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Report ZESY_CALL_OO_BDC *& *&---------------------------------------------------------------------* REPORT zesy_call_oo_bdc. *----------------------------------------------------------------------* * Selection Screen *----------------------------------------------------------------------* PARAMETER: p_kunnr TYPE kna1-kunnr DEFAULT '2400', p_vkorg TYPE knvv-vkorg DEFAULT '1000', p_vtweg TYPE knvv-vtweg DEFAULT '10', p_spart TYPE knvv-spart DEFAULT '00'. SELECTION-SCREEN SKIP 1. PARAMETER: p_delblk TYPE kna1-lifsd DEFAULT '01', p_bilblk TYPE kna1-faksd DEFAULT '01'. SELECTION-SCREEN SKIP 1. PARAMETER: p_tran RADIOBUTTON GROUP r1 DEFAULT 'X', p_sess RADIOBUTTON GROUP r1. *----------------------------------------------------------------------* * Data Declarations *----------------------------------------------------------------------* DATA: g_bdc TYPE REF TO zcl_bc_bdc, g_messages TYPE tab_bdcmsgcoll, g_message LIKE LINE OF g_messages, g_subrc TYPE sy-subrc, g_exception TYPE REF TO zcx_batch_input_error, g_error TYPE string. *----------------------------------------------------------------------* * Initialization *----------------------------------------------------------------------* *INITIALIZATION. *----------------------------------------------------------------------* * Start of Selection *----------------------------------------------------------------------* START-OF-SELECTION. * Create an object for BDC IF p_tran = 'X'. g_bdc = zcl_bc_bdc=>s_instantiate( im_bdc_type = 'CT' im_tcode = 'VD05' ). ELSEIF p_sess = 'X'. g_bdc = zcl_bc_bdc=>s_instantiate( im_bdc_type = 'BI' im_tcode = 'VD05' im_group = 'MY_SESSION' im_keep = 'X' im_holddate = '20140528' ). ENDIF. * Populate first screen g_bdc->add_screen( im_repid = 'SAPMF02D' im_dynnr = '0507'). g_bdc->add_field( im_fld = 'BDC_OKCODE' im_val = '/00'). g_bdc->add_field( im_fld = 'RF02D-KUNNR' im_val = p_kunnr ). g_bdc->add_field( im_fld = 'RF02D-VKORG' im_val = p_vkorg ). g_bdc->add_field( im_fld = 'RF02D-VTWEG' im_val = p_vtweg ). g_bdc->add_field( im_fld = 'RF02D-SPART' im_val = p_spart ). * Populate second screen g_bdc->add_screen( im_repid = 'SAPMF02D' im_dynnr = '0510'). g_bdc->add_field( im_fld = 'BDC_OKCODE' im_val = '=UPDA'). g_bdc->add_field( im_fld = 'KNA1-LIFSD' im_val = p_delblk ). g_bdc->add_field( im_fld = 'KNA1-FAKSD' im_val = p_bilblk ). *----------------------------------------------------------------------* * End of Selection *----------------------------------------------------------------------* END-OF-SELECTION. IF p_tran = 'X'. g_bdc->process( IMPORTING ex_subrc = g_subrc ex_messages = g_messages ). * Display processing status IF g_subrc = 0. WRITE:/ 'Success:'. ELSE. WRITE:/ 'Error:'. * Display messages in list LOOP AT g_messages INTO g_message. MESSAGE ID g_message-msgid TYPE g_message-msgtyp NUMBER g_message-msgnr WITH g_message-msgv1 g_message-msgv2 g_message-msgv3 g_message-msgv4 INTO g_error. WRITE:/ g_error. ENDLOOP. ENDIF. ELSEIF p_sess = 'X'. TRY. g_bdc->process( ). WRITE: 'Success: Check session in SM35'. CATCH zcx_batch_input_error INTO g_exception. WRITE:/ 'Error creating batch input session:'. MESSAGE ID g_exception->msgid TYPE 'E' NUMBER g_exception->msgno WITH g_exception->msgv1 g_exception->msgv2 g_exception->msgv3 g_exception->msgv4 INTO g_error. WRITE:/ g_error. ENDTRY. ENDIF.
36.114035
72
0.462958
988df16179722197516af24331d58d008395ed1c
6,152
abap
ABAP
src/z_adicer_strategy_enno.clas.abap
abap-code-dojo/abapdicer
41ca61917deca06d3c6a13549fe2f7b6b52b3188
[ "MIT" ]
2
2019-12-08T17:46:08.000Z
2021-03-20T18:14:46.000Z
src/z_adicer_strategy_enno.clas.abap
abap-code-dojo/abapdicer
41ca61917deca06d3c6a13549fe2f7b6b52b3188
[ "MIT" ]
2
2019-12-05T15:59:35.000Z
2019-12-05T19:43:42.000Z
src/z_adicer_strategy_enno.clas.abap
abap-code-dojo/abapdicer
41ca61917deca06d3c6a13549fe2f7b6b52b3188
[ "MIT" ]
2
2020-03-19T14:26:26.000Z
2021-10-13T13:36:08.000Z
class Z_ADICER_STRATEGY_ENNO definition public create public . public section. interfaces ZIF_ADICER_STRATEGY . PROTECTED SECTION. DATA favorite_kind TYPE zadicer_score_cell . DATA abapdicer_count TYPE i . private section. methods KEEP_ALL_DICE changing !DICE_ROLL type ZIF_ADICER_DICE_ENGINE=>TT_ROLL . methods KEEP_DICE_VALUE importing !VALUE type ZADICER_SCORE_CELL changing !DICE_ROLL type ZIF_ADICER_DICE_ENGINE=>TT_ROLL . ENDCLASS. CLASS Z_ADICER_STRATEGY_ENNO IMPLEMENTATION. METHOD keep_all_dice. LOOP AT dice_roll ASSIGNING FIELD-SYMBOL(<dice>). <dice>-keep = abap_true. ENDLOOP. ENDMETHOD. METHOD keep_dice_value. LOOP AT dice_roll ASSIGNING FIELD-SYMBOL(<dice>) WHERE value = value. <dice>-keep = abap_true. ENDLOOP. ENDMETHOD. METHOD zif_adicer_strategy~decide_on_result. score_cell = favorite_kind. ENDMETHOD. METHOD zif_adicer_strategy~decide_on_roll. TYPES: BEGIN OF decision, kind TYPE zadicer_score_cell, count TYPE i, END OF decision, decisions TYPE STANDARD TABLE OF decision WITH EMPTY KEY. DATA decision_table TYPE decisions. TYPES: BEGIN OF ts_my_dice_roll, value TYPE i, END OF ts_my_dice_roll. DATA my_dice_roll TYPE STANDARD TABLE OF ts_my_dice_roll. "prepare own dice roll to detect straights my_dice_roll = CORRESPONDING #( dice_roll ). SORT my_dice_roll BY value ASCENDING. DELETE ADJACENT DUPLICATES FROM my_dice_roll COMPARING value. "set default decision to CHANCE if no other fits favorite_kind = zif_adicer_scoresheet=>lower_chance. "build decision table: count number of each cube "1,2,2,5,5 "will be " 1: 1 " 2: 2 " 3: 0 " 4: 0 " 5: 2 " 6: 0 decision_table = VALUE #( ( kind = 1 count = REDUCE i( INIT count = 0 FOR dice IN dice_roll WHERE ( value = 1 ) NEXT count = count + 1 ) ) ( kind = 2 count = REDUCE i( INIT count = 0 FOR dice IN dice_roll WHERE ( value = 2 ) NEXT count = count + 1 ) ) ( kind = 3 count = REDUCE i( INIT count = 0 FOR dice IN dice_roll WHERE ( value = 3 ) NEXT count = count + 1 ) ) ( kind = 4 count = REDUCE i( INIT count = 0 FOR dice IN dice_roll WHERE ( value = 4 ) NEXT count = count + 1 ) ) ( kind = 5 count = REDUCE i( INIT count = 0 FOR dice IN dice_roll WHERE ( value = 5 ) NEXT count = count + 1 ) ) ( kind = 6 count = REDUCE i( INIT count = 0 FOR dice IN dice_roll WHERE ( value = 6 ) NEXT count = count + 1 ) ) ). "sort descending by number of cubes " 2: 2 " 5: 2 " 1: 1 " 3: 0 " 4: 0 " 6: 0 * SORT decision_table BY * count DESCENDING "most values on top * kind DESCENDING. "high values on top SORT decision_table BY count DESCENDING "most values on top kind ASCENDING. "high values on top DATA(max) = decision_table[ 1 ]. IF max-count = 5. "yeaaah: abapDicer!! set all dice to KEEP favorite_kind = zif_adicer_scoresheet=>lower_abapdicer. keep_all_dice( CHANGING dice_roll = dice_roll ). ADD 1 TO abapdicer_count. RETURN. ENDIF. IF decision_table[ 1 ]-count = 1 AND decision_table[ 2 ]-count = 1 AND decision_table[ 3 ]-count = 1 AND decision_table[ 4 ]-count = 1 AND decision_table[ 5 ]-count = 1. IF scoresheet->check_cell_empty( kind = zif_adicer_scoresheet=>lower_large_straight ). favorite_kind = zif_adicer_scoresheet=>lower_large_straight. keep_all_dice( CHANGING dice_roll = dice_roll ). RETURN. ENDIF. ELSEIF lines( my_dice_roll ) = 4 AND my_dice_roll[ 1 ]-value = 1 AND my_dice_roll[ 2 ]-value = 2 AND my_dice_roll[ 3 ]-value = 3 AND my_dice_roll[ 4 ]-value = 4. IF scoresheet->check_cell_empty( kind = zif_adicer_scoresheet=>lower_small_straight ). favorite_kind = zif_adicer_scoresheet=>lower_small_straight. keep_all_dice( CHANGING dice_roll = dice_roll ). RETURN. ENDIF. ELSEIF lines( my_dice_roll ) = 4 AND my_dice_roll[ 1 ]-value = 2 AND my_dice_roll[ 2 ]-value = 3 AND my_dice_roll[ 3 ]-value = 4 AND my_dice_roll[ 4 ]-value = 5. IF scoresheet->check_cell_empty( kind = zif_adicer_scoresheet=>lower_small_straight ). favorite_kind = zif_adicer_scoresheet=>lower_small_straight. keep_all_dice( CHANGING dice_roll = dice_roll ). RETURN. ENDIF. ELSEIF decision_table[ 1 ]-count = 3 AND decision_table[ 2 ]-count = 2. IF scoresheet->check_cell_empty( kind = zif_adicer_scoresheet=>lower_full_house ). favorite_kind = zif_adicer_scoresheet=>lower_full_house. keep_all_dice( CHANGING dice_roll = dice_roll ). RETURN. ENDIF. ELSEIF decision_table[ 1 ]-count = 4. IF scoresheet->check_cell_empty( kind = zif_adicer_scoresheet=>lower_4_ofakind ). IF round <= 2. "try to gain 5-of-a-kind with next throws keep_dice_value( EXPORTING value = decision_table[ 1 ]-kind CHANGING dice_roll = dice_roll ). ELSE. "take 4-of-akind favorite_kind = zif_adicer_scoresheet=>lower_4_ofakind. keep_all_dice( CHANGING dice_roll = dice_roll ). ENDIF. RETURN. ENDIF. ELSEIF decision_table[ 1 ]-count = 3. IF scoresheet->check_cell_empty( kind = zif_adicer_scoresheet=>lower_3_ofakind ). favorite_kind = zif_adicer_scoresheet=>lower_3_ofakind. keep_all_dice( CHANGING dice_roll = dice_roll ). RETURN. ENDIF. ENDIF. "check and set upper section IF scoresheet->ask_cell_value( kind = max-kind ) = zif_adicer_scoresheet=>empty. favorite_kind = max-kind. LOOP AT dice_roll ASSIGNING FIELD-SYMBOL(<dice>). IF <dice>-value = max-kind. "keep all dice with this max value <dice>-keep = abap_true. ELSE. <dice>-keep = abap_false. ENDIF. ENDLOOP. ENDIF. ENDMETHOD. ENDCLASS.
30.914573
118
0.649545
9895654ccdce13fe36efd876da70affd0a8438cc
5,242
abap
ABAP
src/checks/zcl_aoc_check_40.clas.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_40.clas.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_40.clas.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
null
null
null
CLASS zcl_aoc_check_40 DEFINITION PUBLIC INHERITING FROM zcl_aoc_super CREATE PUBLIC. PUBLIC SECTION. METHODS constructor. METHODS check REDEFINITION. METHODS get_message_text REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_AOC_CHECK_40 IMPLEMENTATION. METHOD check. * abapOpenChecks * https://github.com/larshp/abapOpenChecks * MIT License TYPES: BEGIN OF t_stack, stackposition TYPE i, position TYPE i, row TYPE token_row, END OF t_stack. DATA: lv_include TYPE sobj_name, lv_check TYPE abap_bool, lv_stack TYPE i, lt_stack TYPE STANDARD TABLE OF t_stack WITH NON-UNIQUE KEY stackposition, ls_stack LIKE LINE OF lt_stack, lv_report TYPE i, lv_position TYPE i, lv_row TYPE token_row, lv_statement TYPE string. FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements, <ls_token> LIKE LINE OF io_scan->tokens. LOOP AT io_scan->statements ASSIGNING <ls_statement> WHERE type <> io_scan->gc_statement-empty AND type <> io_scan->gc_statement-comment AND type <> io_scan->gc_statement-comment_in_stmnt AND type <> io_scan->gc_statement-macro_definition AND type <> io_scan->gc_statement-pragma. lv_position = sy-tabix. CLEAR lv_statement. LOOP AT io_scan->tokens ASSIGNING <ls_token> FROM <ls_statement>-from TO <ls_statement>-to WHERE type = io_scan->gc_token-identifier OR type = io_scan->gc_token-list. IF lv_statement IS INITIAL. lv_statement = <ls_token>-str. ELSE. CONCATENATE lv_statement <ls_token>-str INTO lv_statement SEPARATED BY space. ENDIF. ENDLOOP. IF lv_statement CP 'IF *' OR lv_statement CP 'CASE *'. lv_stack = lv_stack + 1. ENDIF. IF lv_statement CP 'READ TABLE *' OR lv_statement CP 'IMPORT *' OR lv_statement CP 'ASSIGN COMPONENT *' OR lv_statement CP 'ASSIGN (*'. IF lv_check = abap_true. lv_include = io_scan->get_include( <ls_statement>-level ). inform( p_sub_obj_name = lv_include p_line = lv_row p_kind = mv_errty p_position = lv_report p_test = myname p_code = '001' ). ENDIF. lv_report = lv_position. lv_check = abap_true. lv_row = <ls_token>-row. CONTINUE. " to next statement ENDIF. IF lv_statement = 'ENDIF' OR lv_statement = 'ENDCASE'. lv_stack = lv_stack - 1. CONTINUE. ENDIF. IF lv_check = abap_true AND ( lv_statement CP 'ELSE*' OR lv_statement CP 'WHEN *' ). "collect for re-check after ENDIF/ENDCASE ls_stack-position = lv_report. ls_stack-row = lv_row. ls_stack-stackposition = lv_stack - 1. APPEND ls_stack TO lt_stack. lv_check = abap_false. ENDIF. IF lv_check = abap_true AND NOT lv_statement CP '* SY-SUBRC *' AND NOT lv_statement CP '*CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC*'. lv_include = io_scan->get_include( <ls_statement>-level ). inform( p_sub_obj_name = lv_include p_line = lv_row p_kind = mv_errty p_position = lv_report p_test = myname p_code = '001' ). ENDIF. "re-check return code of last statement within IF/CASE-clause LOOP AT lt_stack INTO ls_stack WHERE stackposition = lv_stack. IF NOT lv_statement CP '* SY-SUBRC *' AND NOT lv_statement CP '*CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC*'. lv_include = io_scan->get_include( <ls_statement>-level ). inform( p_sub_obj_name = lv_include p_line = ls_stack-row p_kind = mv_errty p_position = ls_stack-position p_test = myname p_code = '001' ). ENDIF. ENDLOOP. DELETE lt_stack WHERE stackposition = lv_stack. lv_check = abap_false. ENDLOOP. ENDMETHOD. METHOD constructor. DATA: ls_message LIKE LINE OF scimessages. super->constructor( ). version = '001'. position = '040'. has_attributes = abap_true. attributes_ok = abap_true. enable_rfc( ). ls_message-test = myname. ls_message-code = '001'. ls_message-kind = c_error. ls_message-pcom = '"#EC CI_SUBRC'. INSERT ls_message INTO TABLE scimessages. ENDMETHOD. METHOD get_message_text. CLEAR p_text. CASE p_code. WHEN '001'. p_text = 'Check SY-SUBRC'. "#EC NOTEXT WHEN OTHERS. super->get_message_text( EXPORTING p_test = p_test p_code = p_code IMPORTING p_text = p_text ). ENDCASE. ENDMETHOD. ENDCLASS.
28.802198
90
0.575353
9896e3c019415104b992cc6bd5f512fa2828b2ba
2,268
abap
ABAP
lbn-gtt-template-tpo/abap/zsrc/zpof_gtt.fugr.zpof_gtt_ee_dl_hdr.abap
zenonkowalewski/logistics-business-network-gtt-samples
c34ddff27f339768ae61a6dc8eb4330ecc5ca320
[ "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_dl_hdr.abap
zenonkowalewski/logistics-business-network-gtt-samples
c34ddff27f339768ae61a6dc8eb4330ecc5ca320
[ "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_dl_hdr.abap
zenonkowalewski/logistics-business-network-gtt-samples
c34ddff27f339768ae61a6dc8eb4330ecc5ca320
[ "Apache-2.0" ]
50
2020-09-29T03:06:01.000Z
2022-03-28T16:04:45.000Z
FUNCTION zpof_gtt_ee_dl_hdr. *"---------------------------------------------------------------------- *"*"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_APP_TYPE_CNTL_TABS) TYPE TRXAS_APPTYPE_TABS *" REFERENCE(I_APP_OBJECTS) TYPE TRXAS_APPOBJ_CTABS *" TABLES *" E_EXPEVENTDATA STRUCTURE /SAPTRX/EXP_EVENTS *" E_MEASRMNTDATA STRUCTURE /SAPTRX/MEASR_DATA OPTIONAL *" E_INFODATA STRUCTURE /SAPTRX/INFO_DATA OPTIONAL *" E_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL *" EXCEPTIONS *" PARAMETER_ERROR *" EXP_EVENT_DETERM_ERROR *" TABLE_DETERMINATION_ERROR *" STOP_PROCESSING *"---------------------------------------------------------------------- DATA: lo_udm_message TYPE REF TO cx_udm_message, ls_bapiret TYPE bapiret2. CLEAR e_logtable[]. TRY. lcl_ef_performer=>get_planned_events( EXPORTING is_definition = VALUE #( maintab = lif_app_constants=>cs_tabledef-dl_header_new ) io_factory = NEW lcl_factory_dl_header( ) iv_appsys = i_appsys is_app_obj_types = i_app_obj_types it_all_appl_tables = i_all_appl_tables it_app_type_cntl_tabs = i_app_type_cntl_tabs it_app_objects = i_app_objects CHANGING ct_expeventdata = e_expeventdata[] ct_measrmntdata = e_measrmntdata[] ct_infodata = e_infodata[] ). 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 e_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 table_determination_error. ENDCASE. ENDTRY. ENDFUNCTION.
36.580645
94
0.613316
9897001e65d66aa339fdeed9bb8ef7f049073df8
1,294
abap
ABAP
kapitel_04/mzbook_ticket_init_control_f03.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
12
2018-06-22T10:55:06.000Z
2022-03-22T12:10:48.000Z
kapitel_04/mzbook_ticket_init_control_f03.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
5
2018-06-25T11:45:26.000Z
2019-09-04T19:41:55.000Z
kapitel_04/mzbook_ticket_init_control_f03.prog.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
7
2018-07-02T14:20:28.000Z
2022-03-25T19:33:33.000Z
*&---------------------------------------------------------------------* *& Form INIT_CONTROL_FRAMEWORK_RIGHT *&---------------------------------------------------------------------* FORM init_control_framework_right. DATA l_caption TYPE sbptcaptn. DATA lt_captions TYPE sbptcaptns. CHECK gr_docker_right IS INITIAL. CREATE OBJECT gr_docker_right EXPORTING side = cl_gui_docking_container=>dock_at_right extension = 250 name = 'DockerRight'. l_caption-caption = 'Dokumentation'. l_caption-icon = icon_personal_help. APPEND l_caption TO lt_captions. l_caption-caption = 'Meldungen'. l_caption-icon = icon_information. APPEND l_caption TO lt_captions. l_caption-caption = 'Status'. l_caption-icon = icon_status_overview. APPEND l_caption TO lt_captions. CREATE OBJECT gr_drawer EXPORTING parent = gr_docker_right captions = lt_captions EXCEPTIONS max_number_of_cells_exceeded = 1 OTHERS = 2. * CREATE OBJECT gr_appl. SET HANDLER lcl_application=>drawer_clicked FOR gr_drawer. gr_drawer->set_active( 1 ). ENDFORM. " INIT_CONTROL_FRAMEWORK
30.809524
72
0.57187
989be79cd1ba8fb388d76e1d4037bc4a80507321
2,642
abap
ABAP
src/zcl_timem_object_tr.clas.abap
desmoloch/abapTimeMachine
130fa94cc26dafbd1daa79f628deb1b847d3d76f
[ "MIT" ]
32
2019-12-13T10:10:13.000Z
2021-02-15T13:01:08.000Z
src/zcl_timem_object_tr.clas.abap
desmoloch/abapTimeMachine
130fa94cc26dafbd1daa79f628deb1b847d3d76f
[ "MIT" ]
51
2019-11-30T13:36:49.000Z
2021-02-22T07:32:14.000Z
src/zcl_timem_object_tr.clas.abap
desmoloch/abapTimeMachine
130fa94cc26dafbd1daa79f628deb1b847d3d76f
[ "MIT" ]
4
2020-08-14T06:54:59.000Z
2021-01-10T11:00:05.000Z
"! Representation of a program/include object. This object consists of a single part which "! this class will be able to create and return. CLASS zcl_timem_object_tr DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. INTERFACES zif_timem_object. METHODS constructor IMPORTING !id TYPE trkorr. PROTECTED SECTION. PRIVATE SECTION. DATA id TYPE trkorr. METHODS get_object_keys RETURNING VALUE(result) TYPE trwbo_t_e071 RAISING zcx_timem. METHODS get_object IMPORTING object_key TYPE trwbo_s_e071 RETURNING VALUE(result) TYPE REF TO zif_timem_object RAISING zcx_timem. ENDCLASS. CLASS ZCL_TIMEM_OBJECT_TR IMPLEMENTATION. METHOD constructor. me->id = id. ENDMETHOD. METHOD get_object. result = COND #( WHEN object_key-pgmid = 'R3TR' AND ( object_key-object = 'CLAS' OR object_key-object = 'FUGR' ) OR object_key-pgmid = 'LIMU' AND object_key-object = 'FUNC' THEN NEW zcl_timem_object_factory( )->get_instance( object_type = object_key-object object_name = CONV #( object_key-obj_name ) ) WHEN object_key-pgmid = 'LIMU' AND object_key-object = 'REPS' THEN NEW zcl_timem_object_factory( )->get_instance( object_type = 'PROG' object_name = CONV #( object_key-obj_name ) ) ). ENDMETHOD. METHOD get_object_keys. DATA request_data TYPE trwbo_request. request_data-h-trkorr = id. CALL FUNCTION 'TRINT_READ_REQUEST' EXPORTING iv_read_objs = abap_true CHANGING cs_request = request_data EXCEPTIONS error_occured = 1 OTHERS = 2. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_timem. ENDIF. result = request_data-objects. SORT result BY pgmid ASCENDING object ASCENDING obj_name ASCENDING. DELETE ADJACENT DUPLICATES FROM result COMPARING pgmid object obj_name. ENDMETHOD. METHOD zif_timem_object~check_exists. TRY. NEW zcl_timem_request( me->id ). result = abap_true. CATCH zcx_timem. result = abap_false. ENDTRY. ENDMETHOD. METHOD zif_timem_object~get_name. result = id. ENDMETHOD. METHOD zif_timem_object~get_part_list. LOOP AT get_object_keys( ) INTO DATA(object_key). DATA(object) = get_object( object_key ). IF object IS BOUND. LOOP AT object->get_part_list( ) INTO DATA(part). part-name = |({ object->get_name( ) }) { part-name }|. INSERT part INTO TABLE result. ENDLOOP. ENDIF. ENDLOOP. ENDMETHOD. ENDCLASS.
24.691589
101
0.661998
989d37e91e7a04f2e78ca8c97fba8c9bcf777351
4,801
abap
ABAP
src/parsing/zcl_aoc_boolean_tokens.clas.testclasses.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
1
2019-06-05T13:02:40.000Z
2019-06-05T13:02:40.000Z
src/parsing/zcl_aoc_boolean_tokens.clas.testclasses.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
null
null
null
src/parsing/zcl_aoc_boolean_tokens.clas.testclasses.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
1
2019-08-08T12:13:30.000Z
2019-08-08T12:13:30.000Z
CLASS lcl_parse DEFINITION FINAL. PUBLIC SECTION. CLASS-METHODS: parse IMPORTING iv_string TYPE string RETURNING VALUE(ro_tokens) TYPE REF TO zcl_aoc_boolean_tokens. ENDCLASS. CLASS lcl_parse IMPLEMENTATION. METHOD parse. DATA: lt_code TYPE string_table, lt_tokens TYPE stokesx_tab, lt_statements TYPE sstmnt_tab ##NEEDED. APPEND iv_string TO lt_code. SCAN ABAP-SOURCE lt_code TOKENS INTO lt_tokens STATEMENTS INTO lt_statements WITH ANALYSIS WITH COMMENTS WITH PRAGMAS abap_true. cl_abap_unit_assert=>assert_subrc( ). CREATE OBJECT ro_tokens EXPORTING it_tokens = lt_tokens. ENDMETHOD. ENDCLASS. CLASS ltcl_find_end_paren DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. METHODS: test IMPORTING iv_code TYPE string iv_start TYPE i iv_exp TYPE i, find01 FOR TESTING, find02 FOR TESTING, find03 FOR TESTING. ENDCLASS. CLASS ltcl_find_end_paren IMPLEMENTATION. METHOD test. DATA: lv_end TYPE i, lo_tokens TYPE REF TO zcl_aoc_boolean_tokens. lo_tokens = lcl_parse=>parse( iv_code ). lv_end = lo_tokens->find_end_paren( iv_start ). cl_abap_unit_assert=>assert_equals( act = lv_end exp = iv_exp ). ENDMETHOD. METHOD find01. test( iv_code = 'foo( )' iv_start = 1 iv_exp = 2 ). ENDMETHOD. METHOD find02. test( iv_code = 'foo( )->bar( )' iv_start = 1 iv_exp = 3 ). ENDMETHOD. METHOD find03. test( iv_code = 'foo( bar( ) )' iv_start = 1 iv_exp = 4 ). ENDMETHOD. ENDCLASS. CLASS ltcl_to_string DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. METHODS: test_to_string IMPORTING iv_code TYPE string, to_string01 FOR TESTING, to_string02 FOR TESTING, to_string03 FOR TESTING, to_string04 FOR TESTING. ENDCLASS. CLASS ltcl_to_string IMPLEMENTATION. METHOD test_to_string. DATA: lo_tokens TYPE REF TO zcl_aoc_boolean_tokens. lo_tokens = lcl_parse=>parse( iv_code ). cl_abap_unit_assert=>assert_equals( act = lo_tokens->to_string( ) exp = to_upper( iv_code ) ). ENDMETHOD. METHOD to_string01. test_to_string( 'foo = bar' ). ENDMETHOD. METHOD to_string02. test_to_string( 'moo = foo-bar' ). ENDMETHOD. METHOD to_string03. test_to_string( 'moo = foo->bar' ). ENDMETHOD. METHOD to_string04. test_to_string( 'moo = foo->bar( 2 )' ). ENDMETHOD. ENDCLASS. CLASS ltcl_replace DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. METHODS: test_replace IMPORTING iv_code TYPE string iv_start TYPE i iv_end TYPE i OPTIONAL iv_replace TYPE string iv_expected TYPE string, replace01 FOR TESTING, replace02 FOR TESTING. ENDCLASS. CLASS ltcl_replace IMPLEMENTATION. METHOD test_replace. DATA: lo_tokens TYPE REF TO zcl_aoc_boolean_tokens. lo_tokens = lcl_parse=>parse( iv_code )->replace( iv_start = iv_start iv_end = iv_end iv_str = iv_replace ). cl_abap_unit_assert=>assert_equals( act = lo_tokens->to_string( ) exp = to_upper( iv_expected ) ). ENDMETHOD. METHOD replace01. test_replace( iv_code = 'moo boo foo' iv_start = 2 iv_replace = 'baa' iv_expected = 'moo baa foo' ). ENDMETHOD. METHOD replace02. test_replace( iv_code = 'moo boo foo' iv_start = 2 iv_end = 3 iv_replace = 'baa' iv_expected = 'moo baa' ). ENDMETHOD. ENDCLASS. CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. METHODS: test_remove IMPORTING iv_code TYPE string iv_index TYPE i iv_expected TYPE string, remove01 FOR TESTING. ENDCLASS. "ltcl_Test CLASS ltcl_test IMPLEMENTATION. METHOD test_remove. DATA: lo_tokens TYPE REF TO zcl_aoc_boolean_tokens. lo_tokens = lcl_parse=>parse( iv_code )->remove( iv_index ). cl_abap_unit_assert=>assert_equals( act = lo_tokens->to_string( ) exp = to_upper( iv_expected ) ). ENDMETHOD. METHOD remove01. test_remove( iv_code = 'foo bar' iv_index = 2 iv_expected = 'foo' ). ENDMETHOD. ENDCLASS.
21.337778
90
0.613206
989e0ad5ad25cf738ed94e6a5c06bb15d6ce0eec
247,331
abap
ABAP
z_moose_extractor.abap
SAP2Moose/SAP2Moose
de56cf32ed6eeadff37e79d0bc32288cc6547ca4
[ "MIT" ]
25
2017-09-05T12:57:46.000Z
2021-12-18T21:47:13.000Z
z_moose_extractor.abap
SAP2Moose/SAP2Moose
de56cf32ed6eeadff37e79d0bc32288cc6547ca4
[ "MIT" ]
72
2017-09-18T15:16:20.000Z
2021-12-10T20:09:32.000Z
z_moose_extractor.abap
SAP2Moose/SAP2Moose
de56cf32ed6eeadff37e79d0bc32288cc6547ca4
[ "MIT" ]
6
2017-11-05T19:23:19.000Z
2020-02-01T20:02:51.000Z
* generated on system T57 at 05.02.2021 on 13:24:39 * * This is version 1.2.2 * *The MIT License (MIT) * *Copyright (c) 2016 Rainer Winkler, CubeServ * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE. "! The latest version is available on https://github.com/SAP2Moose/SAP2Moose "! "! Thanks to Enno Wulff for providing the initial ABAP 7.31 version "! REPORT z2mse_moose_extractor2. TABLES tadir. "So that select-options work SELECTION-SCREEN BEGIN OF BLOCK block_global_source WITH FRAME TITLE TEXT-001. SELECTION-SCREEN END OF BLOCK block_global_source. SELECTION-SCREEN BEGIN OF BLOCK block_selct_sap_comp WITH FRAME TITLE TEXT-002. SELECT-OPTIONS s_pack FOR tadir-devclass. SELECT-OPTIONS s_spack FOR tadir-devclass. DATA: element_filter TYPE string. PARAMETERS p_eltyp TYPE text30. PARAMETERS p_elpar TYPE c LENGTH 30. PARAMETERS p_elnam TYPE c LENGTH 61. PARAMETERS p_sub AS CHECKBOX DEFAULT 'X'. PARAMETERS p_nup TYPE i DEFAULT -1. PARAMETERS p_ndown TYPE i DEFAULT 1. "Exclude interfaces in sap name space when found via where used analysis PARAMETERS p_ex AS CHECKBOX DEFAULT 'X'. PARAMETERS p_dyn TYPE string. "Classes to determine dynamic accesses *SELECT-OPTIONS s_compsn FOR tadir-obj_name. SELECTION-SCREEN END OF BLOCK block_selct_sap_comp. SELECTION-SCREEN BEGIN OF BLOCK block_using_comp WITH FRAME TITLE TEXT-003. *PARAMETERS: p_dm AS CHECKBOX DEFAULT ' '. *"! Usages outside package grouped *"! If false, a recursive search for using components is performed until no further using components are found *DATA g_param_usage_outpack_groupd TYPE abap_bool. *g_param_usage_outpack_groupd = p_dm. SELECTION-SCREEN END OF BLOCK block_using_comp. SELECTION-SCREEN BEGIN OF BLOCK block_infos WITH FRAME TITLE TEXT-004. *PARAMETERS: p_list AS CHECKBOX DEFAULT ' '. *"! List Tokens of selected programs *DATA g_parameter_list_tokens TYPE abap_bool. *g_parameter_list_tokens = p_list. SELECTION-SCREEN END OF BLOCK block_infos. " include z_mse. ******************************************** Begin Include Z_MSE_ABAP ***************************** *The MIT License (MIT) * *Copyright (c) 2016 Rainer Winkler, CubeServ * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE. SELECTION-SCREEN BEGIN OF BLOCK bl_model_settings WITH FRAME TITLE TEXT-100. PARAMETERS: p_down AS CHECKBOX DEFAULT 'X', " Default filename p_df TYPE string. *"! Download model to file *DATA g_parameter_download_file TYPE abap_bool. *g_parameter_download_file = p_down. SELECTION-SCREEN END OF BLOCK bl_model_settings. SELECTION-SCREEN BEGIN OF BLOCK bl_customize WITH FRAME TITLE TEXT-200. PARAMETERS: p_intrev AS CHECKBOX DEFAULT ''. SELECTION-SCREEN END OF BLOCK bl_customize. " Begin Model "! Specifies a model. "! Create an instance only once, otherwise there will be multiple models each containing only part of the informations. CLASS cl_model DEFINITION CREATE PUBLIC . PUBLIC SECTION. TYPES: BEGIN OF line_type, line TYPE string, END OF line_type. TYPES: lines_type TYPE STANDARD TABLE OF line_type WITH DEFAULT KEY. METHODS constructor. "! Add a named entity "! @parameter elementname | The name of the FAMIX Element. Like FAMIX.NamedEntity "! @parameter name_group | optional to handle cases where names may be duplicates "! @parameter is_named_entity | True if the entity has a name "! @parameter is_id_required | Set true if (id: ...) is always required "! @parameter can_be_referenced_by_name | True if referencing by name is possible (For this the name has to be unique) "! @parameter name | the name of a FAMIX Entity that inherits from FAMIX.NamedEntity leave empty is is_named_entity is false "! @parameter exists_already_with_id | only if can_be_referenced_by_name true. Zero if it does not yet exist, otherwise filled with id "! @parameter processedid | the id in model either if just created or already existing METHODS add_entity IMPORTING elementname TYPE clike name_group TYPE clike OPTIONAL is_named_entity TYPE abap_bool is_id_required TYPE abap_bool DEFAULT '' can_be_referenced_by_name TYPE abap_bool name TYPE clike OPTIONAL EXPORTING VALUE(exists_already_with_id) TYPE i VALUE(processed_id) TYPE i. "! Generates a string with a valid MSE file METHODS make_mse EXPORTING mse_model TYPE lines_type. "! Generates an attribute of type string "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter attribute_name | the name of the attribute "! @parameter string | The value of the attribute METHODS add_string IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL attribute_name TYPE clike string TYPE clike. "! Generates an attribute of type reference using a name "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter attribute_name | the name of the attribute "! @parameter elementname | the element type of the reference "! @parameter name_of_reference | the reference METHODS add_reference_by_name IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL attribute_name TYPE clike type_of_reference TYPE clike name_group_of_reference TYPE clike OPTIONAL name_of_reference TYPE clike. "! Generates an attribute of type reference using an id "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter attribute_name | the name of the attribute "! @parameter reference_id | the id of the reference METHODS add_reference_by_id IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL attribute_name TYPE clike reference_id TYPE i. "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element METHODS add_boolean IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL attribute_name TYPE clike is_true TYPE abap_bool. " Public type so that the caller is able to test the model TYPES: "! A public type that returns the attributes of the model "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element BEGIN OF public_attribute_type, attribute_id TYPE i, attribute_type TYPE string, string TYPE string, reference TYPE i, boolean TYPE abap_bool, END OF public_attribute_type. TYPES: "! A public table type to contain the attributes of an element public_attributes_type TYPE HASHED TABLE OF public_attribute_type WITH UNIQUE KEY attribute_id. TYPES: "! A type that contains informations on an element BEGIN OF public_element_type, element_id TYPE i, element_type TYPE string, is_named_entity TYPE abap_bool, is_id_required TYPE abap_bool, public_attributes TYPE public_attributes_type, END OF public_element_type. TYPES: "! A public table type to contain all elements of a model public_elements_type TYPE HASHED TABLE OF public_element_type WITH UNIQUE KEY element_id. "! Returns the current model "! Use for checks and to decide what further actions are done to build the model. "! Also to give a feedback what is extracted METHODS get_model RETURNING VALUE(public_elements) TYPE public_elements_type. protected section. PRIVATE SECTION. TYPES: BEGIN OF element_in_model_type, element_id TYPE i, is_named_entity TYPE abap_bool, is_id_required TYPE abap_bool, element_type TYPE string, END OF element_in_model_type. "! A table with all Elements in the model DATA g_elements_in_model TYPE HASHED TABLE OF element_in_model_type WITH UNIQUE KEY element_id. TYPES: BEGIN OF named_entity_type, element_type TYPE string, element_name_group TYPE string, element_name TYPE string, element_id TYPE i, END OF named_entity_type. "! A table to find IDs using the names DATA g_named_entities TYPE HASHED TABLE OF named_entity_type WITH UNIQUE KEY element_type element_name_group element_name. TYPES value_type TYPE c LENGTH 1. "! An attribute where a name is specified CONSTANTS string_value TYPE value_type VALUE 'S'. "! An attribute where a reference is specified CONSTANTS reference_value TYPE value_type VALUE 'R'. CONSTANTS boolean_value TYPE value_type VALUE 'B'. TYPES: BEGIN OF attribute_type, element_id TYPE i, attribute_id TYPE i, attribute_type TYPE string, value_type TYPE value_type, name TYPE string, reference TYPE i, boolean TYPE abap_bool, END OF attribute_type. "! A table with all the attributes of an entity DATA g_attributes TYPE SORTED TABLE OF attribute_type WITH UNIQUE KEY element_id attribute_id. "! The ID of processed entity in the model DATA g_processed_id TYPE i. "! The ID of any attribute. Unique together with mv_id DATA g_attribute_id TYPE i. "! True if attribute is already identically assigned METHODS _check_if_attr_already_there IMPORTING attribute TYPE cl_model=>attribute_type RETURNING VALUE(already_there) TYPE abap_bool. METHODS _get_element_id IMPORTING element_id TYPE i element_type TYPE clike element_name_group TYPE clike element_name TYPE clike RETURNING VALUE(my_element_id) TYPE i. ENDCLASS. CLASS CL_MODEL IMPLEMENTATION. METHOD add_boolean. DATA ls_attribute LIKE LINE OF g_attributes. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_attribute. ls_attribute-element_id = _get_element_id( element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name ). ls_attribute-attribute_type = attribute_name. ls_attribute-value_type = boolean_value. ls_attribute-boolean = is_true. " SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. sy-subrc = 1. WHILE sy-subrc <> 0. ADD 1 TO g_attribute_id. ls_attribute-attribute_id = g_attribute_id. INSERT ls_attribute INTO TABLE g_attributes. ENDWHILE. ENDIF. ENDMETHOD. METHOD add_entity. IF can_be_referenced_by_name EQ abap_true. ASSERT name_group IS NOT INITIAL. ENDIF. FIELD-SYMBOLS <ls_name> LIKE LINE OF g_named_entities. IF can_be_referenced_by_name EQ abap_true. READ TABLE g_named_entities ASSIGNING <ls_name> WITH TABLE KEY element_type = elementname element_name_group = name_group element_name = name. IF sy-subrc EQ 0. "OK exists_already_with_id = <ls_name>-element_id. processed_id = <ls_name>-element_id. RETURN. ENDIF. ENDIF. ADD 1 TO g_processed_id. g_attribute_id = 0. IF can_be_referenced_by_name EQ abap_true. DATA ls_named_entity LIKE LINE OF g_named_entities. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_named_entity. ls_named_entity-element_type = elementname. ls_named_entity-element_name_group = name_group. ls_named_entity-element_name = name. ls_named_entity-element_id = g_processed_id. INSERT ls_named_entity INTO TABLE g_named_entities. ENDIF. DATA ls_elements_in_model LIKE LINE OF g_elements_in_model. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_elements_in_model. ls_elements_in_model-element_id = g_processed_id. ls_elements_in_model-is_named_entity = is_named_entity. ls_elements_in_model-is_id_required = is_id_required. ls_elements_in_model-element_type = elementname. INSERT ls_elements_in_model INTO TABLE g_elements_in_model. IF is_named_entity EQ abap_true. me->add_string( EXPORTING element_id = g_processed_id attribute_name = 'name' string = name element_name_group = name_group ). ENDIF. processed_id = g_processed_id. ENDMETHOD. METHOD add_reference_by_id. DATA ls_attribute TYPE attribute_type. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_attribute. ls_attribute-element_id = _get_element_id( element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name ). ls_attribute-attribute_type = attribute_name. ls_attribute-value_type = reference_value. ls_attribute-reference = reference_id. " SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. sy-subrc = 1. WHILE sy-subrc <> 0. ADD 1 TO g_attribute_id. ls_attribute-attribute_id = g_attribute_id. INSERT ls_attribute INTO TABLE g_attributes. ENDWHILE. ENDIF. ENDMETHOD. METHOD add_reference_by_name. ASSERT name_group_of_reference IS NOT INITIAL. FIELD-SYMBOLS <named_entity> LIKE LINE OF g_named_entities. READ TABLE g_named_entities ASSIGNING <named_entity> WITH TABLE KEY element_type = type_of_reference element_name_group = name_group_of_reference element_name = name_of_reference. * ASSERT sy-subrc EQ 0. "OK IF sy-subrc <> 0. ASSERT 1 = 2. ENDIF. DATA ls_attribute LIKE LINE OF g_attributes. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_attribute. ls_attribute-element_id = _get_element_id( element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name ). ls_attribute-attribute_type = attribute_name. ls_attribute-value_type = reference_value. ls_attribute-reference = <named_entity>-element_id. " SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. sy-subrc = 1. WHILE sy-subrc <> 0. ADD 1 TO g_attribute_id. ls_attribute-attribute_id = g_attribute_id. INSERT ls_attribute INTO TABLE g_attributes. ENDWHILE. ENDIF. ENDMETHOD. METHOD add_string. DATA ls_attribute LIKE LINE OF g_attributes. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_attribute. ls_attribute-element_id = _get_element_id( element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name ). ls_attribute-attribute_type = attribute_name. ls_attribute-value_type = string_value. ls_attribute-name = string. " SAP_2_FAMIX_52 Do not attributes twice if they are added with identical attributes IF _check_if_attr_already_there( ls_attribute ) EQ abap_false. sy-subrc = 1. WHILE sy-subrc <> 0. ADD 1 TO g_attribute_id. ls_attribute-attribute_id = g_attribute_id. INSERT ls_attribute INTO TABLE g_attributes. ENDWHILE. ENDIF. ENDMETHOD. METHOD constructor. g_processed_id = 0. ENDMETHOD. METHOD get_model. DATA ls_public_element TYPE public_element_type. DATA ls_public_attribute TYPE public_attribute_type. DATA lt_public_attributes TYPE public_attributes_type. CLEAR public_elements. DATA ls_elements_in_model LIKE LINE OF g_elements_in_model. LOOP AT g_elements_in_model INTO ls_elements_in_model. CLEAR lt_public_attributes. DATA ls_attributes LIKE LINE OF g_attributes. LOOP AT g_attributes INTO ls_attributes WHERE element_id = ls_elements_in_model-element_id. CLEAR ls_public_attribute. ls_public_attribute-attribute_id = ls_attributes-attribute_id. ls_public_attribute-attribute_type = ls_attributes-attribute_type. ls_public_attribute-boolean = ls_attributes-boolean. ls_public_attribute-reference = ls_attributes-reference. ls_public_attribute-string = ls_attributes-name. INSERT ls_public_attribute INTO TABLE lt_public_attributes. ENDLOOP. CLEAR ls_public_element. ls_public_element-element_type = ls_elements_in_model-element_type. ls_public_element-element_id = ls_elements_in_model-element_id. ls_public_element-is_named_entity = ls_elements_in_model-is_named_entity. ls_public_element-is_id_required = ls_elements_in_model-is_id_required. ls_public_element-public_attributes = lt_public_attributes. INSERT ls_public_element INTO TABLE public_elements. ENDLOOP. ENDMETHOD. METHOD make_mse. " SAP_2_FAMIX_34 Allow to export the model in the .mse Moose format DATA: mse_model_line TYPE line_type. mse_model_line-line = |( |. SORT g_elements_in_model BY element_id. DATA is_first TYPE boolean VALUE abap_true. FIELD-SYMBOLS <element_in_model> LIKE LINE OF g_elements_in_model. LOOP AT g_elements_in_model ASSIGNING <element_in_model>. IF is_first EQ abap_false. APPEND mse_model_line TO mse_model. CLEAR mse_model_line. ENDIF. mse_model_line-line = mse_model_line-line && |(| && <element_in_model>-element_type. IF <element_in_model>-is_named_entity EQ abap_true OR <element_in_model>-is_id_required EQ abap_true. mse_model_line-line = mse_model_line-line && | (id: | && <element_in_model>-element_id && | )|. ENDIF. FIELD-SYMBOLS <attribute> LIKE LINE OF g_attributes. LOOP AT g_attributes ASSIGNING <attribute> WHERE element_id = <element_in_model>-element_id. APPEND mse_model_line TO mse_model. mse_model_line-line = | (| && <attribute>-attribute_type. ASSERT ( <attribute>-value_type EQ string_value ) OR ( <attribute>-value_type EQ reference_value ) OR ( <attribute>-value_type EQ boolean_value ). CASE <attribute>-value_type. WHEN string_value. mse_model_line-line = mse_model_line-line && | '| && <attribute>-name && |')|. WHEN reference_value. mse_model_line-line = mse_model_line-line && | (ref: | && <attribute>-reference && |))|. WHEN boolean_value. ASSERT ( <attribute>-boolean EQ abap_true ) OR ( <attribute>-boolean EQ abap_false ). CASE <attribute>-boolean. WHEN abap_true. mse_model_line-line = mse_model_line-line && | true)|. WHEN abap_false. mse_model_line-line = mse_model_line-line && | false)|. ENDCASE. ENDCASE. ENDLOOP. mse_model_line-line = mse_model_line-line && |)|. is_first = abap_false. ENDLOOP. mse_model_line-line = mse_model_line-line && |)|. APPEND mse_model_line TO mse_model. ENDMETHOD. METHOD _check_if_attr_already_there. " Check if attribute is already there DATA ls_attribute_2 TYPE attribute_type. DATA ls_attribute_3 TYPE attribute_type. ls_attribute_3 = attribute. CLEAR ls_attribute_3-attribute_id. already_there = abap_false. LOOP AT g_attributes INTO ls_attribute_2 WHERE element_id = attribute-element_id. CLEAR ls_attribute_2-attribute_id. IF ls_attribute_2 EQ ls_attribute_3. already_there = abap_true. EXIT. ENDIF. ENDLOOP. ENDMETHOD. METHOD _get_element_id. " Get element ID IF element_id <> 0. my_element_id = element_id. ELSE. ASSERT element_name_group IS NOT INITIAL. FIELD-SYMBOLS <element_named_entity> LIKE LINE OF g_named_entities. READ TABLE g_named_entities ASSIGNING <element_named_entity> WITH TABLE KEY element_type = element_type element_name_group = element_name_group element_name = element_name. ASSERT sy-subrc EQ 0. "OK my_element_id = <element_named_entity>-element_id. ENDIF. ENDMETHOD. ENDCLASS. CLASS cl_output_model DEFINITION CREATE PUBLIC. PUBLIC SECTION. METHODS make IMPORTING mse_model TYPE cl_model=>lines_type g_parameter_download_file TYPE abap_bool i_default_prefix TYPE string. protected section. private section. ENDCLASS. CLASS CL_OUTPUT_MODEL IMPLEMENTATION. METHOD make. " Download the file DATA: filename TYPE string, default_file_name TYPE string, pathname TYPE string, fullpath TYPE string, user_action TYPE i. default_file_name = |{ i_default_prefix }_{ sy-sysid }_{ sy-datum }_{ sy-uzeit }|. IF g_parameter_download_file EQ abap_true. cl_gui_frontend_services=>file_save_dialog( EXPORTING default_extension = 'mse' default_file_name = default_file_name CHANGING filename = filename " File Name to Save path = pathname " Path to File fullpath = fullpath " Path + File Name user_action = user_action ). " User Action (C Class Const ACTION_OK, ACTION_OVERWRITE etc) IF user_action = cl_gui_frontend_services=>action_cancel. WRITE: / 'Canceled by user'. ELSE. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING filename = fullpath TABLES data_tab = mse_model. ENDIF. ENDIF. ENDMETHOD. ENDCLASS. ******************************************** End Include Z_MSE_ABAP ******************************* " include z_famix. ******************************************** Begin Include Z_FAMIX_ABAP *************************** *The MIT License (MIT) * *Copyright (c) 2016 Rainer Winkler, CubeServ * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE. CLASS cl_famix_entity DEFINITION ABSTRACT CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. PROTECTED SECTION. DATA g_elementname TYPE string. DATA g_model TYPE REF TO cl_model. DATA g_last_used_id TYPE i. private section. ENDCLASS. CLASS CL_FAMIX_ENTITY IMPLEMENTATION. METHOD constructor. g_model = model. ENDMETHOD. ENDCLASS. CLASS cl_famix_sourced_entity DEFINITION ABSTRACT INHERITING FROM cl_famix_entity CREATE PUBLIC. PUBLIC SECTION. "! Declare source language "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter source_language_element | the FAMIX element of the source language "! @parameter source_language_name | the name of the source language METHODS set_declared_source_language IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL source_language_element TYPE clike source_language_name TYPE clike. protected section. private section. ENDCLASS. CLASS CL_FAMIX_SOURCED_ENTITY IMPLEMENTATION. METHOD set_declared_source_language. g_model->add_reference_by_name( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'declaredSourceLanguage' type_of_reference = source_language_element name_of_reference = source_language_name ). ENDMETHOD. ENDCLASS. class CL_FAMIX_FILE_ANCHOR definition inheriting from CL_FAMIX_ENTITY create public . public section. "! Call once to create a new file anchor entiry "! @parameter element_id | The ID of the element for which a source is specified "! @parameter file_name | The path or link to the source methods ADD importing !ELEMENT_ID type I !FILE_NAME type CLIKE exporting value(ID) type I . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS CL_FAMIX_FILE_ANCHOR IMPLEMENTATION. METHOD add. g_model->add_entity( EXPORTING elementname = |FAMIX.FileAnchor| name_group = |FILE_ANCHOR| is_named_entity = abap_false is_id_required = abap_true can_be_referenced_by_name = abap_false IMPORTING processed_id = id ). g_model->add_reference_by_id( EXPORTING element_id = id attribute_name = 'element' reference_id = element_id ). g_model->add_string( EXPORTING element_id = id attribute_name = 'fileName' string = file_name ). g_last_used_id = id. ENDMETHOD. ENDCLASS. CLASS cl_famix_named_entity DEFINITION INHERITING FROM cl_famix_sourced_entity ABSTRACT CREATE PUBLIC. PUBLIC SECTION. "! Call once to create a new named entity "! @parameter exists_already_with_id | Contains the id if entry already existed. "! @parameter id | The id in model either if just created or already existing. "! @parameter modifiers | A list of modifiers separated by blank. This attribute is marked by an asterisk in the Moose Meta Browser, which may be the sign of this. Will be an Ordered Collection in Moose. METHODS add IMPORTING name_group TYPE clike OPTIONAL name TYPE clike modifiers TYPE clike OPTIONAL EXPORTING VALUE(exists_already_with_id) TYPE i VALUE(id) TYPE i. "! Call once to set the parent package "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter parent_package | the name of an element of type FAMIX.Package METHODS set_parent_package IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL parent_package TYPE clike parent_package_name_group TYPE clike. "! Set the container an element is in using the reference "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter container_element | the FAMIX element of the Container "! @parameter source_anchor_id | the id of the SoureceAnchor METHODS set_source_anchor_by_id IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL source_anchor_id TYPE i. PROTECTED SECTION. private section. ENDCLASS. CLASS CL_FAMIX_NAMED_ENTITY IMPLEMENTATION. METHOD add. " ASSERT name_group IS NOT INITIAL. g_model->add_entity( EXPORTING elementname = g_elementname is_named_entity = abap_true can_be_referenced_by_name = abap_true name_group = name_group name = name IMPORTING exists_already_with_id = exists_already_with_id processed_id = id ). IF modifiers IS SUPPLIED. g_model->add_string( EXPORTING element_id = id attribute_name = 'modifiers' string = modifiers ). ENDIF. g_last_used_id = id. ENDMETHOD. METHOD set_parent_package. g_model->add_reference_by_name( element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name type_of_reference = 'FAMIX.Package' name_of_reference = parent_package name_group_of_reference = parent_package_name_group attribute_name = 'parentPackage' ). ENDMETHOD. METHOD set_source_anchor_by_id. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'sourceAnchor' reference_id = source_anchor_id ). ENDMETHOD. ENDCLASS. CLASS cl_famix_attribute DEFINITION INHERITING FROM cl_famix_named_entity CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. "! Store the relation between class, attribute name and id in internal table to enable associations "! Call before performing the next time the method add, because the ID is stored internally after creating an element "! @parameter class | the class of the method "! @parameter attribute | the attribute name METHODS store_id IMPORTING name_group TYPE clike class TYPE clike attribute TYPE clike. "! Returns the ID for a given attribute of a class "! Returns 0 if the attribute is not known "! @parameter class | the class of the attribute "! @parameter attribute | the attribute name "! @parameter id | the ID of the element METHODS get_id IMPORTING name_group TYPE clike class TYPE clike attribute TYPE clike RETURNING VALUE(id) TYPE i. METHODS add REDEFINITION. "! set the parent type, for instance the class the method is contained in "! Provide either ID or type and name of element "! For parent: provide either parent_element and parent_name or parent_id "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter parent_element | the FAMIX element of the parent Type "! @parameter parent_name_group | the name group of the parent element "! @parameter parent_name | the name of the parent element "! @parameter parent_id | the id of the parent element METHODS set_parent_type IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL parent_element TYPE clike OPTIONAL parent_name_group TYPE clike OPTIONAL parent_name TYPE clike OPTIONAL parent_id TYPE i OPTIONAL. protected section. PRIVATE SECTION. TYPES: BEGIN OF attribute_id_type, name_group TYPE string, class TYPE string, attribute TYPE string, id TYPE i, END OF attribute_id_type. DATA: g_attribute_ids TYPE HASHED TABLE OF attribute_id_type WITH UNIQUE KEY name_group class attribute. ENDCLASS. CLASS CL_FAMIX_ATTRIBUTE IMPLEMENTATION. METHOD add. g_model->add_entity( EXPORTING elementname = g_elementname is_named_entity = abap_true can_be_referenced_by_name = abap_false name = name IMPORTING processed_id = id ). g_last_used_id = id. ENDMETHOD. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Attribute'. ENDMETHOD. METHOD get_id. FIELD-SYMBOLS <attribute_id> LIKE LINE OF g_attribute_ids. READ TABLE g_attribute_ids ASSIGNING <attribute_id> WITH TABLE KEY name_group = name_group class = class attribute = attribute. IF sy-subrc EQ 0. "OK id = <attribute_id>-id. ELSE. id = 0. ENDIF. ENDMETHOD. METHOD set_parent_type. ASSERT ( parent_element IS SUPPLIED AND parent_name IS SUPPLIED ) OR parent_id IS SUPPLIED. IF parent_element IS SUPPLIED AND parent_name IS SUPPLIED. g_model->add_reference_by_name( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'parentType' type_of_reference = parent_element name_group_of_reference = parent_name_group name_of_reference = parent_name ). ELSEIF parent_id IS SUPPLIED. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'parentType' reference_id = parent_id ). ENDIF. ENDMETHOD. METHOD store_id. DATA ls_attribute_id LIKE LINE OF g_attribute_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_attribute_id. ls_attribute_id-id = g_last_used_id. ls_attribute_id-name_group = name_group. ls_attribute_id-class = class. ls_attribute_id-attribute = attribute. INSERT ls_attribute_id INTO TABLE g_attribute_ids. ENDMETHOD. ENDCLASS. CLASS cl_famix_container_entity DEFINITION INHERITING FROM cl_famix_named_entity ABSTRACT CREATE PUBLIC. PUBLIC SECTION. "! Set the container an element is in "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter container_element | the FAMIX element of the Container "! @parameter parent_container | the name of the Container METHODS set_container IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL container_element TYPE clike parent_container TYPE clike parent_container_name_group TYPE clike. "! Set the container an element is in using the reference "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter container_element | the FAMIX element of the Container "! @parameter parent_container_id | the id of the Container METHODS set_container_by_id IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL container_element TYPE clike parent_container_id TYPE i. PROTECTED SECTION. private section. ENDCLASS. CLASS CL_FAMIX_CONTAINER_ENTITY IMPLEMENTATION. METHOD set_container. g_model->add_reference_by_name( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name type_of_reference = container_element name_of_reference = parent_container name_group_of_reference = parent_container_name_group attribute_name = 'container' ). ENDMETHOD. METHOD set_container_by_id. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'container' reference_id = parent_container_id ). ENDMETHOD. ENDCLASS. CLASS cl_famix_behavioural_entty DEFINITION INHERITING FROM CL_famix_container_entity ABSTRACT CREATE PUBLIC. PUBLIC SECTION. "! Set the signature of a method "! This might not be relevant for ABAP, but is contained here for completeness "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter signature | The signature like myMethod( myParameters, ...) METHODS set_signature IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL signature TYPE clike. protected section. private section. ENDCLASS. CLASS CL_FAMIX_BEHAVIOURAL_ENTTY IMPLEMENTATION. METHOD set_signature. g_model->add_string( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'signature' string = signature ). ENDMETHOD. ENDCLASS. CLASS cl_famix_package DEFINITION INHERITING FROM cl_famix_named_entity CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. METHODS add REDEFINITION. protected section. private section. ENDCLASS. CLASS CL_FAMIX_PACKAGE IMPLEMENTATION. METHOD add. g_model->add_entity( EXPORTING elementname = g_elementname is_named_entity = abap_true can_be_referenced_by_name = abap_true name_group = name_group name = name IMPORTING exists_already_with_id = exists_already_with_id processed_id = id ). g_last_used_id = id. ENDMETHOD. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Package'. ENDMETHOD. ENDCLASS. CLASS cl_famix_method DEFINITION INHERITING FROM CL_famix_behavioural_entty CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. METHODS add REDEFINITION. "! set the parent type, for instance the class the method is contained in "! Provide either parent_name or parent_id "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter parent_element | the FAMIX element of the parent Type "! @parameter parent_name_group | optional the name group of the parent element "! @parameter parent_name | optional the name of the parent element "! @parameter parent_id | optional the id of the parent element METHODS set_parent_type IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL parent_element TYPE clike parent_name_group TYPE clike OPTIONAL parent_name TYPE clike OPTIONAL parent_id TYPE i OPTIONAL. "! Store the relation between class, method name and id in internal table to enable associations "! Call before performing the next time the method add, because the ID is stored internally after creating an element "! @parameter class_name_group | the name group of the class of the method "! @parameter class | the class of the method "! @parameter method_name_group | the name group of the method name "! @parameter method | the method name METHODS store_id IMPORTING class_name_group TYPE clike class TYPE clike method_name_group TYPE clike method TYPE clike. "! Returns the ID for a given method of a class "! Returns 0 if the class is not known "! @parameter class_name_group | the name group of the class of the method "! @parameter class | the class of the method "! @parameter method_name_group | the name group of the method name "! @parameter method | the method name "! @parameter id | the ID of the element METHODS get_id IMPORTING class_name_group TYPE clike class TYPE clike method_name_group TYPE clike method TYPE clike RETURNING VALUE(id) TYPE i. protected section. PRIVATE SECTION. TYPES: BEGIN OF ty_method_id, class_name_group TYPE string, class TYPE string, method_name_group TYPE string, method TYPE string, id TYPE i, END OF ty_method_id. DATA: g_method_ids TYPE HASHED TABLE OF ty_method_id WITH UNIQUE KEY class_name_group class method_name_group method. ENDCLASS. CLASS CL_FAMIX_METHOD IMPLEMENTATION. METHOD add. g_model->add_entity( EXPORTING elementname = g_elementname is_named_entity = abap_true can_be_referenced_by_name = abap_false name = name IMPORTING processed_id = id ). g_last_used_id = id. ENDMETHOD. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Method'. ENDMETHOD. METHOD get_id. FIELD-SYMBOLS <method_id> LIKE LINE OF g_method_ids. READ TABLE g_method_ids ASSIGNING <method_id> WITH TABLE KEY class_name_group = class_name_group class = class method_name_group = method_name_group method = method. IF sy-subrc EQ 0. "OK id = <method_id>-id. ELSE. id = 0. ENDIF. ENDMETHOD. METHOD set_parent_type. ASSERT parent_name IS SUPPLIED OR parent_id IS SUPPLIED. IF parent_name IS SUPPLIED. g_model->add_reference_by_name( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'parentType' type_of_reference = parent_element name_group_of_reference = parent_name_group name_of_reference = parent_name ). ELSEIF parent_id IS SUPPLIED. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'parentType' reference_id = parent_id ). ENDIF. ENDMETHOD. METHOD store_id. DATA ls_method_id LIKE LINE OF g_method_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_method_id. ls_method_id-id = g_last_used_id. ls_method_id-class_name_group = class_name_group. ls_method_id-class = class. ls_method_id-method_name_group = method_name_group. ls_method_id-method = method. INSERT ls_method_id INTO TABLE g_method_ids. ENDMETHOD. ENDCLASS. CLASS cl_famix_class DEFINITION INHERITING FROM CL_famix_container_entity CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. "! Set if it is an interface "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element METHODS is_interface IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL . protected section. private section. ENDCLASS. CLASS CL_FAMIX_CLASS IMPLEMENTATION. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Class'. ENDMETHOD. METHOD is_interface. g_model->add_boolean( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'isInterface' is_true = abap_true ). ENDMETHOD. ENDCLASS. CLASS cl_famix_association DEFINITION INHERITING FROM cl_famix_sourced_entity ABSTRACT CREATE PUBLIC. PUBLIC SECTION. METHODS add RETURNING VALUE(id) TYPE i. protected section. private section. ENDCLASS. CLASS CL_FAMIX_ASSOCIATION IMPLEMENTATION. METHOD add. g_model->add_entity( EXPORTING elementname = g_elementname is_named_entity = abap_false can_be_referenced_by_name = abap_false IMPORTING processed_id = id ). g_last_used_id = id. ENDMETHOD. ENDCLASS. CLASS cl_famix_access DEFINITION INHERITING FROM CL_famix_association CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. "! Checks that accessor and variable of an access are a new access "! @parameter accessor_id | the accessing method or function (type BehaviouralEntity) "! @parameter variable_id | the accessed parameter, variable ... (type StructuralEntity) METHODS is_new_access IMPORTING accessor_id TYPE i variable_id TYPE i RETURNING VALUE(is_new) TYPE abap_bool. "! defines accessor and variable of an access "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter accessor_id | the accessing method or function (type BehaviouralEntity) "! @parameter variable_id | the accessed parameter, variable ... (type StructuralEntity) METHODS set_accessor_variable_relation IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL accessor_id TYPE i variable_id TYPE i. protected section. PRIVATE SECTION. TYPES: BEGIN OF ty_accessor_variable_id, accessor_id TYPE i, variable_id TYPE i, END OF ty_accessor_variable_id. DATA: g_accessor_variable_ids TYPE HASHED TABLE OF ty_accessor_variable_id WITH UNIQUE KEY accessor_id variable_id. ENDCLASS. CLASS CL_FAMIX_ACCESS IMPLEMENTATION. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Access'. ENDMETHOD. METHOD is_new_access. READ TABLE g_accessor_variable_ids TRANSPORTING NO FIELDS WITH TABLE KEY accessor_id = accessor_id variable_id = variable_id. IF sy-subrc <> 0. "OK is_new = abap_true. ENDIF. ENDMETHOD. METHOD set_accessor_variable_relation. DATA ls_accessor_id LIKE LINE OF g_accessor_variable_ids. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_accessor_id. ls_accessor_id-accessor_id = accessor_id. ls_accessor_id-variable_id = variable_id. INSERT ls_accessor_id INTO TABLE g_accessor_variable_ids. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'accessor' reference_id = accessor_id ). g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'variable' reference_id = variable_id ). ENDMETHOD. ENDCLASS. CLASS cl_famix_invocation DEFINITION INHERITING FROM CL_famix_association CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. METHODS is_new_invocation_to_candidate IMPORTING sender_id TYPE i candidates_id TYPE i RETURNING VALUE(is_new) TYPE abap_bool. "! defines an invocation "! this also models standard call by functions or methods to components other than attributes "! Us this method to reference the receiver using his id "! Provide either ID or type and name of element "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter elemenent_type | the element type of the element (not needed if ID is provided) "! @parameter element_name_group | the name group of the element where the ID shall be added "! @parameter element_name | the name of the element "! @parameter sender_id | the id of the sender or calling method or function "! @parameter candidates_id | the id of the candidate, this is the used method or function of type BehaviouralEntity in case of method or function usage "! @parameter receiver_id | optional the id of the receiver or called method or function "! @parameter signature | optional a signature "! @parameter receiver_source_code | optional a receiver source code METHODS set_invocation_by_reference IMPORTING element_id TYPE i element_type TYPE clike OPTIONAL element_name_group TYPE clike OPTIONAL element_name TYPE clike OPTIONAL sender_id TYPE i candidates_id TYPE i OPTIONAL receiver_id TYPE i OPTIONAL signature TYPE clike OPTIONAL receiver_source_code TYPE clike OPTIONAL. protected section. PRIVATE SECTION. TYPES: BEGIN OF ty_sender_candidate, sender_id TYPE i, candidates_id TYPE i, END OF ty_sender_candidate. DATA g_sender_candidates TYPE HASHED TABLE OF ty_sender_candidate WITH UNIQUE KEY sender_id candidates_id. ENDCLASS. CLASS CL_FAMIX_INVOCATION IMPLEMENTATION. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Invocation'. ENDMETHOD. METHOD is_new_invocation_to_candidate. READ TABLE g_sender_candidates TRANSPORTING NO FIELDS WITH TABLE KEY sender_id = sender_id candidates_id = candidates_id. IF sy-subrc <> 0. "OK is_new = abap_true. ENDIF. ENDMETHOD. METHOD set_invocation_by_reference. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'sender' reference_id = sender_id ). IF candidates_id IS SUPPLIED. DATA ls_sender_candidate LIKE LINE OF g_sender_candidates. " ABAP 7.31 use prefix ls_ to prevent shadowing after conversion CLEAR ls_sender_candidate. ls_sender_candidate-sender_id = sender_id. ls_sender_candidate-candidates_id = candidates_id. INSERT ls_sender_candidate INTO TABLE g_sender_candidates. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'candidates' reference_id = candidates_id ). ENDIF. IF receiver_id IS SUPPLIED. g_model->add_reference_by_id( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'receiver' reference_id = receiver_id ). ENDIF. IF signature IS SUPPLIED. g_model->add_string( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'signature' string = signature ). ENDIF. IF receiver_source_code IS SUPPLIED. g_model->add_string( EXPORTING element_id = element_id element_type = element_type element_name_group = element_name_group element_name = element_name attribute_name = 'receiverSourceCode' string = receiver_source_code ). ENDIF. ENDMETHOD. ENDCLASS. CLASS cl_famix_inheritance DEFINITION INHERITING FROM CL_famix_association CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. "! defines an inheritance "! @parameter element_id | the ID of the element where the ID shall be added "! @parameter subclass_element | the FAMIX element of the subclass Type "! @parameter subclass_name_group | the name group of the subclass "! @parameter subclass_name | the name of the subclass "! @parameter superclass_element | the FAMIX element of the subclass Type "! @parameter superclass_name_group | the name group "! @parameter superclass_name | the name of the subclass of the superclass METHODS set_sub_and_super_class IMPORTING element_id TYPE i subclass_element TYPE clike subclass_name_group TYPE clike subclass_name TYPE clike superclass_element TYPE clike superclass_name_group TYPE clike superclass_name TYPE clike. protected section. private section. ENDCLASS. CLASS CL_FAMIX_INHERITANCE IMPLEMENTATION. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Inheritance'. ENDMETHOD. METHOD set_sub_and_super_class. g_model->add_reference_by_name( EXPORTING element_id = element_id attribute_name = 'subclass' type_of_reference = subclass_element name_group_of_reference = subclass_name_group name_of_reference = subclass_name ). g_model->add_reference_by_name( EXPORTING element_id = element_id attribute_name = 'superclass' type_of_reference = superclass_element name_group_of_reference = superclass_name_group name_of_reference = superclass_name ). ENDMETHOD. ENDCLASS. CLASS cl_famix_custom_source_lng DEFINITION INHERITING FROM cl_famix_entity CREATE PUBLIC. PUBLIC SECTION. "! @parameter exists_already_with_id | contains the id if entry already existed METHODS add IMPORTING name TYPE clike name_group TYPE clike EXPORTING VALUE(exists_already_with_id) TYPE i VALUE(id) TYPE i. METHODS constructor IMPORTING model TYPE REF TO cl_model. protected section. private section. ENDCLASS. CLASS CL_FAMIX_CUSTOM_SOURCE_LNG IMPLEMENTATION. METHOD add. g_model->add_entity( EXPORTING elementname = g_elementname is_named_entity = abap_true can_be_referenced_by_name = abap_true name = name name_group = name_group IMPORTING exists_already_with_id = exists_already_with_id processed_id = id ). g_last_used_id = id. ENDMETHOD. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.CustomSourceLanguage'. ENDMETHOD. ENDCLASS. class ZCX_2MSE_EXTR3_CLASSES_WR_TYPE definition inheriting from CX_NO_CHECK create public . public section. interfaces IF_T100_DYN_MSG . interfaces IF_T100_MESSAGE . methods CONSTRUCTOR importing !TEXTID like IF_T100_MESSAGE=>T100KEY optional !PREVIOUS like PREVIOUS optional . protected section. private section. ENDCLASS. CLASS ZCX_2MSE_EXTR3_CLASSES_WR_TYPE IMPLEMENTATION. method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING PREVIOUS = PREVIOUS . clear me->textid. if textid is initial. IF_T100_MESSAGE~T100KEY = IF_T100_MESSAGE=>DEFAULT_TEXTID. else. IF_T100_MESSAGE~T100KEY = TEXTID. endif. endmethod. ENDCLASS. " Obsolete: CLASS cl_famix_module DEFINITION INHERITING FROM cl_famix_named_entity CREATE PUBLIC. PUBLIC SECTION. METHODS constructor IMPORTING model TYPE REF TO cl_model. METHODS add REDEFINITION. protected section. private section. ENDCLASS. CLASS CL_FAMIX_MODULE IMPLEMENTATION. METHOD add. g_model->add_entity( EXPORTING elementname = g_elementname is_named_entity = abap_true can_be_referenced_by_name = abap_true name = name name_group = name_group IMPORTING exists_already_with_id = exists_already_with_id processed_id = id ). g_last_used_id = id. ENDMETHOD. METHOD constructor. CALL METHOD super->constructor( model ). g_elementname = 'FAMIX.Module'. ENDMETHOD. ENDCLASS. ******************************************** End Include Z_FAMIX_ABAP ***************************** CLASS CL_EXTR3_ACCESS_OR_INVOCATN DEFINITION DEFERRED. CLASS CL_EXTR3_ASSOCIATION DEFINITION DEFERRED. CLASS CL_EXTR3_MODEL_BUILDER DEFINITION DEFERRED. CLASS CL_EXTR3_ELEMENTS DEFINITION DEFERRED. "! I know all elements and associations between elements that are currently known. "! I provide general methods to add new elements and associations between elements. CLASS cl_extr3_element_manager DEFINITION . PUBLIC SECTION. DATA model TYPE REF TO cl_model. DATA famix_package TYPE REF TO cl_famix_package. DATA famix_class TYPE REF TO cl_famix_class. DATA famix_method TYPE REF TO cl_famix_method. DATA famix_attribute TYPE REF TO cl_famix_attribute. DATA famix_invocation TYPE REF TO cl_famix_invocation. DATA famix_access TYPE REF TO cl_famix_access. DATA famix_file_anchor TYPE REF TO cl_famix_file_anchor. DATA exclude_found_sap_intf TYPE abap_bool READ-ONLY. DATA interface_use_structure TYPE abap_bool READ-ONLY. "! A unique identifier for each object extracted TYPES element_id_type TYPE i. TYPES: BEGIN OF association_type, element_id1 TYPE element_id_type, element_id2 TYPE element_id_type, ass_type TYPE c LENGTH 30, "To prevent problem with local classes, better would be: cl_extr3_association=>ass_type, association TYPE REF TO cl_extr3_association, END OF association_type. TYPES associations_type TYPE STANDARD TABLE OF association_type WITH KEY element_id1 element_id2 ass_type association. METHODS constructor IMPORTING i_model_builder TYPE REF TO cl_extr3_model_builder i_exclude_found_sap_intf TYPE abap_bool i_interface_use_structure TYPE abap_bool. "! Call if an element might be added. "! Add the element if it is not already part of the model. METHODS add_element IMPORTING element TYPE REF TO cl_extr3_elements is_specific TYPE abap_bool RETURNING VALUE(element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS add_association IMPORTING element_1 TYPE element_id_type element_2 TYPE element_id_type association TYPE REF TO cl_extr3_association. "! Call so that the classes that contain the collected elements determine further informations that are required for the model. METHODS collect_infos IMPORTING sysid TYPE string OPTIONAL. "! Call to build the mse model METHODS make_model RETURNING VALUE(r_result) TYPE cl_model=>lines_type. METHODS get_element IMPORTING i_element_id TYPE element_id_type RETURNING VALUE(r_result) TYPE REF TO cl_extr3_elements. METHODS get_associations IMPORTING i_element_id TYPE element_id_type RETURNING VALUE(associations) TYPE associations_type. DATA model_builder TYPE REF TO cl_extr3_model_builder. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF element_type, element_id TYPE element_id_type, "! A reference to the instance that handles this object element TYPE REF TO cl_extr3_elements, END OF element_type. TYPES elements_type TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. DATA elements TYPE elements_type. TYPES associations1_type TYPE SORTED TABLE OF association_type WITH UNIQUE KEY element_id1 element_id2 ass_type. TYPES associations2_type TYPE SORTED TABLE OF association_type WITH UNIQUE KEY element_id2 element_id1 ass_type. DATA associations1 TYPE associations1_type. DATA associations2 TYPE associations2_type. DATA next_element_id TYPE i. ENDCLASS. "! I am the top superclass for all classes that require the element manager. CLASS cl_extr3 DEFINITION CREATE PROTECTED . PUBLIC SECTION. "! Call once to clear all global variables. This is required before an extraction is repeated CLASS-METHODS clear_all. CONSTANTS: ng_source_language TYPE string VALUE 'SOURCE_LANGUAGE', ng_abap_package TYPE string VALUE 'ABAP_PACKAGE', ng_abap_class TYPE string VALUE 'ABAP_CLASS', ng_abap_method TYPE string VALUE 'ABAP_METHOD', ng_abap_program TYPE string VALUE 'ABAP_PROGRAM', ng_abap_webdynpro TYPE string VALUE 'ABAP_WEBDYNPRO', ng_sap_table TYPE string VALUE 'SAP_TABLE'. PROTECTED SECTION. DATA element_manager TYPE REF TO cl_extr3_element_manager. METHODS constructor IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager. PRIVATE SECTION. ENDCLASS. "! I describe an association between elements. "! I have sub classes that specify concrete types of associations. CLASS cl_extr3_association DEFINITION INHERITING FROM cl_extr3. PUBLIC SECTION. types ass_type TYPE c LENGTH 30. DATA type TYPE ass_type READ-ONLY. CONSTANTS: parent_package_ass LIKE type VALUE 'parent_package', access_ass LIKE type VALUE 'access', invocation_ass LIKE type VALUE 'invocation'. METHODS make_model IMPORTING association TYPE cl_extr3_element_manager=>association_type. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS cl_extr3_access_or_invocatn DEFINITION INHERITING FROM cl_extr3_association CREATE PUBLIC . PUBLIC SECTION. PROTECTED SECTION. METHODS _get_famix_id_used_and_using IMPORTING i_association TYPE cl_extr3_element_manager=>association_type EXPORTING e_using_method_id TYPE i e_used_id TYPE i. PRIVATE SECTION. ENDCLASS. CLASS cl_extr3_access DEFINITION INHERITING FROM cl_extr3_access_or_invocatn FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_access. METHODS add IMPORTING accessed_element_id1 TYPE cl_extr3_element_manager=>element_id_type accessing_element_id2 TYPE cl_extr3_element_manager=>element_id_type. METHODS make_model REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA instance TYPE REF TO cl_extr3_access. TYPES: BEGIN OF association_type, accessed_element_id1 TYPE cl_extr3_element_manager=>element_id_type, accessing_element_id2 TYPE cl_extr3_element_manager=>element_id_type, END OF association_type. TYPES associations_type TYPE STANDARD TABLE OF association_type WITH DEFAULT KEY. DATA associations TYPE HASHED TABLE OF association_type WITH UNIQUE KEY accessed_element_id1 accessing_element_id2. ENDCLASS. "! I am the abstract super class of all elements. "! My subclasses know the details of elements. CLASS cl_extr3_elements DEFINITION INHERITING FROM cl_extr3. PUBLIC SECTION. "! True if further informations are collected DATA infos_are_collected TYPE abap_bool. "! Collect further informations METHODS collect_infos IMPORTING sysid TYPE string. DATA type TYPE c LENGTH 30. CONSTANTS: package_type LIKE type VALUE 'package', table_type LIKE type VALUE 'table', class_type LIKE type VALUE 'class', program_type LIKE type VALUE 'program', web_dynpro_comps_type LIKE type VALUE 'web_dynpro_components'. METHODS make_model IMPORTING element_id TYPE cl_extr3_element_manager=>element_id_type associations TYPE cl_extr3_element_manager=>associations_type. METHODS name IMPORTING element_id TYPE cl_extr3_element_manager=>element_id_type EXPORTING element_type TYPE string parent_name TYPE string name TYPE string. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS cl_extr3_invocation DEFINITION INHERITING FROM cl_extr3_access_or_invocatn FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_invocation. METHODS add IMPORTING invoced_element_id1 TYPE cl_extr3_element_manager=>element_id_type invocing_element_id2 TYPE cl_extr3_element_manager=>element_id_type. METHODS make_model REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA instance TYPE REF TO cl_extr3_invocation. TYPES: BEGIN OF association_type, invoced_element_id1 TYPE cl_extr3_element_manager=>element_id_type, invocing_element_id2 TYPE cl_extr3_element_manager=>element_id_type, END OF association_type. TYPES associations_type TYPE STANDARD TABLE OF association_type WITH DEFAULT KEY. DATA associations TYPE HASHED TABLE OF association_type WITH UNIQUE KEY invoced_element_id1 invocing_element_id2. ENDCLASS. CLASS cl_extr3_parent_package DEFINITION INHERITING FROM cl_extr3_association FINAL CREATE PRIVATE . PUBLIC SECTION. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_parent_package. METHODS add IMPORTING element_id TYPE cl_extr3_element_manager=>element_id_type parent_element_id TYPE cl_extr3_element_manager=>element_id_type. METHODS make_model REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA instance TYPE REF TO cl_extr3_parent_package. TYPES: BEGIN OF association_type, element_id1 TYPE cl_extr3_element_manager=>element_id_type, element_id2 TYPE cl_extr3_element_manager=>element_id_type, END OF association_type. TYPES associations_type TYPE STANDARD TABLE OF association_type WITH DEFAULT KEY. DATA associations TYPE HASHED TABLE OF association_type WITH UNIQUE KEY element_id1 element_id2. ENDCLASS. "! I know how to build required associations "! I have subclasses with concrete specifications that are used to find or build concrete associations. CLASS cl_extr3_association_build DEFINITION INHERITING FROM cl_extr3. PUBLIC SECTION. METHODS search_down IMPORTING element_id TYPE cl_extr3_element_manager=>element_id_type. METHODS search_up IMPORTING element_id TYPE cl_extr3_element_manager=>element_id_type. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS cl_extr3_classes DEFINITION INHERITING FROM cl_extr3_elements FINAL CREATE PUBLIC . PUBLIC SECTION. CONSTANTS: is_class_type TYPE seoclstype VALUE 0, interface_type TYPE seoclstype VALUE 1, attribute_type TYPE seocmptype VALUE 0, method_type TYPE seocmptype VALUE 1, event_type TYPE seocmptype VALUE 2. TYPES: BEGIN OF ty_class_component, clsname TYPE string, cmpname TYPE string, cmptype TYPE seocmptype, mtdtype TYPE seomtdtype, END OF ty_class_component. TYPES ty_class_components TYPE STANDARD TABLE OF ty_class_component WITH KEY clsname cmpname. DATA: class_components TYPE ty_class_components. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_classes. METHODS add IMPORTING class TYPE string is_specific TYPE abap_bool EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type VALUE(class_components) TYPE ty_class_components. METHODS add_component IMPORTING clsname TYPE string cmpname TYPE string is_specific TYPE abap_bool EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS class_name IMPORTING element_id TYPE i EXPORTING VALUE(class_name) TYPE string VALUE(clstype) TYPE seoclstype VALUE(exists) TYPE abap_bool. METHODS comp_name IMPORTING element_id TYPE i EXPORTING VALUE(class_name) TYPE string VALUE(cmpname) TYPE string VALUE(cmptype) TYPE seocmptype VALUE(exists) TYPE abap_bool. METHODS is_redefinition_of_method IMPORTING invoced_element_id1 TYPE i invocing_element_id2 TYPE i RETURNING VALUE(r_result) TYPE abap_bool. METHODS make_model REDEFINITION. METHODS name REDEFINITION. METHODS collect_infos REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA instance TYPE REF TO cl_extr3_classes. TYPES: BEGIN OF element_type, element_id TYPE cl_extr3_element_manager=>element_id_type, class_name TYPE string, clstype TYPE seoclstype, adt_link TYPE string, END OF element_type. DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. DATA elements_class_name TYPE HASHED TABLE OF element_type WITH UNIQUE KEY class_name. TYPES: BEGIN OF element_comp_type, element_id TYPE cl_extr3_element_manager=>element_id_type, clsname TYPE string, cmpname TYPE string, cmptype TYPE seocmptype, mtdtype TYPE seomtdtype, adt_link TYPE string, END OF element_comp_type. DATA elements_comp_element_id TYPE HASHED TABLE OF element_comp_type WITH UNIQUE KEY element_id. DATA elements_comp_clsname_cmpname TYPE SORTED TABLE OF element_comp_type WITH UNIQUE KEY clsname cmpname. TYPES: BEGIN OF element_metarel_type, element_id TYPE cl_extr3_element_manager=>element_id_type, refclsname TYPE string, reltype TYPE seoreltype, END OF element_metarel_type. DATA elements_metarel_element_id TYPE HASHED TABLE OF element_metarel_type WITH UNIQUE KEY element_id. DATA elements_metarel_refclsname TYPE HASHED TABLE OF element_metarel_type WITH UNIQUE KEY refclsname. TYPES: BEGIN OF redefined_type, clsname TYPE seoclsname, refclsname TYPE seoclsname, mtdname TYPE seocpdname, END OF redefined_type. TYPES: BEGIN OF redefined_method_type, clsname TYPE seoclsname, defined_in_clsname TYPE seoclsname, method TYPE seocpdname, END OF redefined_method_type. DATA redefined_methods TYPE HASHED TABLE OF redefined_method_type WITH UNIQUE KEY method clsname defined_in_clsname. METHODS _add_component IMPORTING clsname TYPE string cmpname TYPE string is_specific TYPE abap_bool EXPORTING VALUE(is_added) TYPE abap_bool VALUE(is_added_now) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS _add_metarel IMPORTING clsname TYPE string is_specific TYPE abap_bool. "! Call me only after checking that the component to be added is not already added. METHODS _add_single_component_to_class IMPORTING i_found_class_name TYPE string i_found_cmpname TYPE string i_found_cmptype TYPE seocmptype i_found_mtdtype TYPE seomtdtype is_specific TYPE abap_bool RETURNING VALUE(r_new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS _get_redefined IMPORTING class TYPE string RETURNING VALUE(r_result) TYPE cl_extr3_classes=>ty_class_components. ENDCLASS. "! I describe an element of type package CLASS cl_extr3_packages DEFINITION INHERITING FROM cl_extr3_elements CREATE PRIVATE . PUBLIC SECTION. TYPES: ty_s_pack TYPE RANGE OF tadir-devclass. TYPES: BEGIN OF ty_package, package TYPE devclass, parentpackage TYPE parentcl, END OF ty_package. TYPES ty_packages TYPE HASHED TABLE OF ty_package WITH UNIQUE KEY package. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_packages. METHODS add IMPORTING package TYPE devclass EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS devclass IMPORTING i_element_id TYPE i RETURNING VALUE(r_result) TYPE devclass. METHODS make_model REDEFINITION. METHODS name REDEFINITION. METHODS collect_infos REDEFINITION. PROTECTED SECTION. METHODS _does_package_exists IMPORTING i_package TYPE devclass RETURNING VALUE(exists) TYPE abap_bool. PRIVATE SECTION. TYPES: BEGIN OF element_type, element_id TYPE cl_extr3_element_manager=>element_id_type, devclass TYPE devclass, END OF element_type. CLASS-DATA instance TYPE REF TO cl_extr3_packages. DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. DATA elements_devclass TYPE HASHED TABLE OF element_type WITH UNIQUE KEY devclass. ENDCLASS. CLASS cl_extr3_programs DEFINITION INHERITING FROM cl_extr3_elements FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_programs. CONSTANTS: type_function TYPE string VALUE 'FUNCTION', type_function_include TYPE string VALUE 'FUNCTION_INCLUDE', type_program TYPE string VALUE 'PROGRAM', type_bw_transformation TYPE string VALUE 'BW_TRAN'. METHODS add IMPORTING program TYPE program EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS add_function IMPORTING function TYPE string EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS program_name IMPORTING i_element_id TYPE i EXPORTING VALUE(program_type) TYPE string VALUE(program) TYPE progname VALUE(external_program_name_class) TYPE string VALUE(external_program_name_method) TYPE string VALUE(program_attribute_1) TYPE string VALUE(program_attribute_2) TYPE string VALUE(subc) TYPE subc. METHODS add_function_group IMPORTING fgr TYPE string EXPORTING is_added TYPE abap_bool new_element_id TYPE i. METHODS make_model REDEFINITION. METHODS name REDEFINITION. METHODS collect_infos REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA instance TYPE REF TO cl_extr3_programs. TYPES: BEGIN OF element_type, element_id TYPE cl_extr3_element_manager=>element_id_type, program TYPE progname, external_program_name TYPE string, subc TYPE subc, program_type TYPE string, program_attribute_1 TYPE string, program_attribute_2 TYPE string, adt_or_bwmt_link TYPE string, END OF element_type. DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. DATA elements_program TYPE HASHED TABLE OF element_type WITH UNIQUE KEY program. METHODS _convert_program_2_ext_name IMPORTING i_element_program TYPE progname EXPORTING program_type TYPE string program_attribute_1 TYPE string program_attribute_2 TYPE string VALUE(r_result) TYPE string. METHODS _extract_function_name IMPORTING i_element_program TYPE progname EXPORTING function_group TYPE rs38l_area function TYPE rs38l_fnam function_include TYPE string VALUE(r_result) TYPE string. METHODS _extract_sap_bw_logic IMPORTING i_element_program TYPE progname EXPORTING tranid TYPE rstranid VALUE(r_result) TYPE string. METHODS _get_names_for_function_groups IMPORTING i_element TYPE cl_extr3_programs=>element_type RETURNING VALUE(name_of_mapped_class) TYPE string. ENDCLASS. "! I describe elements of type table CLASS cl_extr3_tables DEFINITION INHERITING FROM cl_extr3_elements FINAL CREATE PRIVATE . PUBLIC SECTION. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_tables. METHODS add IMPORTING table TYPE string EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS table_name IMPORTING i_element_id TYPE i RETURNING VALUE(r_result) TYPE tabname. METHODS make_model REDEFINITION. METHODS name REDEFINITION. METHODS collect_infos REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA instance TYPE REF TO cl_extr3_tables. TYPES: BEGIN OF element_type, element_id TYPE cl_extr3_element_manager=>element_id_type, tabname TYPE tabname, END OF element_type. DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. DATA elements_tabname TYPE HASHED TABLE OF element_type WITH UNIQUE KEY tabname. ENDCLASS. CLASS cl_extr3_web_dynpro_comp DEFINITION INHERITING FROM cl_extr3_elements FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS clear. CLASS-METHODS get_instance IMPORTING element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(r_instance) TYPE REF TO cl_extr3_web_dynpro_comp. METHODS add IMPORTING wdy_component_name TYPE wdy_component_name EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS add_component IMPORTING wdy_component_name TYPE wdy_component_name wdy_controller_name TYPE wdy_controller_name EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. METHODS wdy_component_name IMPORTING element_id TYPE i EXPORTING VALUE(wdy_component_name) TYPE wdy_component_name. METHODS wdy_controller_name IMPORTING element_id TYPE i EXPORTING VALUE(wdy_component_name) TYPE wdy_component_name VALUE(wdy_controller_name) TYPE wdy_controller_name. METHODS make_model REDEFINITION. METHODS name REDEFINITION. METHODS collect_infos REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA instance TYPE REF TO cl_extr3_web_dynpro_comp. TYPES: BEGIN OF element_type, element_id TYPE cl_extr3_element_manager=>element_id_type, wdy_component_name TYPE wdy_component_name, END OF element_type. DATA elements_element_id TYPE HASHED TABLE OF element_type WITH UNIQUE KEY element_id. DATA elements_wdy_component_name TYPE HASHED TABLE OF element_type WITH UNIQUE KEY wdy_component_name. TYPES: BEGIN OF element_comp_type, element_id TYPE cl_extr3_element_manager=>element_id_type, wdy_component_name TYPE wdy_component_name, wdy_controller_name TYPE wdy_controller_name, END OF element_comp_type. DATA elements_comp_element_id TYPE HASHED TABLE OF element_comp_type WITH UNIQUE KEY element_id. DATA elements_comp_comp_contr_name TYPE HASHED TABLE OF element_comp_type WITH UNIQUE KEY wdy_component_name wdy_controller_name. METHODS _add_component IMPORTING wdy_component_name TYPE wdy_component_name wdy_controller_name TYPE wdy_controller_name EXPORTING VALUE(is_added) TYPE abap_bool VALUE(new_element_id) TYPE cl_extr3_element_manager=>element_id_type. ENDCLASS. CLASS cl_extr3_tadir_builder DEFINITION INHERITING FROM cl_extr3_association_build FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS constructor IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager. METHODS search_down REDEFINITION. METHODS search_up REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. DATA: tables TYPE REF TO cl_extr3_tables, classes TYPE REF TO cl_extr3_classes, programs TYPE REF TO cl_extr3_programs, web_dynpro_components TYPE REF TO cl_extr3_web_dynpro_comp, parent_package TYPE REF TO cl_extr3_parent_package. ENDCLASS. CLASS cl_extr3_where_used_builder DEFINITION INHERITING FROM cl_extr3_association_build CREATE PUBLIC . PUBLIC SECTION. TYPE-POOLS seop . METHODS set_dynamic_read IMPORTING !i_dynamic_read TYPE string OPTIONAL . METHODS search_down REDEFINITION . METHODS search_up REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF wbcrossgt_type, otype TYPE char2, name TYPE eu_lname, include TYPE programm, direct TYPE sgrade, indirect TYPE sgrade, END OF wbcrossgt_type , wbcrossgts_type TYPE SORTED TABLE OF wbcrossgt_type WITH UNIQUE KEY otype name include, BEGIN OF cross_type, type TYPE char1, name TYPE seu_name, include TYPE syrepid, END OF cross_type, cross_types TYPE STANDARD TABLE OF cross_type WITH DEFAULT KEY, BEGIN OF wbcrossi_type, name TYPE eu_lname, include TYPE program, " Ignore field master, it is in most cases identical to field include END OF wbcrossi_type, wbcrossi_types TYPE STANDARD TABLE OF wbcrossi_type WITH DEFAULT KEY. DATA: g_dynamic_usage TYPE SORTED TABLE OF wbcrossgt WITH UNIQUE KEY otype name include. ENDCLASS. "! I build all initial elements that are the starting point for searching further elements. CLASS cl_extr3_initial_elements DEFINITION FINAL CREATE PUBLIC . PUBLIC SECTION. TYPES: BEGIN OF ty_package, package TYPE devclass, parentpackage TYPE parentcl, END OF ty_package. TYPES ty_packages TYPE HASHED TABLE OF ty_package WITH UNIQUE KEY package. CONSTANTS: select_class_method TYPE string VALUE 'Class', select_table TYPE string VALUE 'Table', select_program TYPE string VALUE 'Program', select_function TYPE string VALUE 'Function'. TYPES: ty_s_pack TYPE RANGE OF tadir-devclass . TYPES: BEGIN OF ty_tdevc_test, devclass TYPE devclass, parentcl TYPE parentcl, END OF ty_tdevc_test. TYPES ty_t_tdevc_test TYPE HASHED TABLE OF ty_tdevc_test WITH UNIQUE KEY devclass. METHODS select_packages IMPORTING !top_packages TYPE ty_s_pack !sub_packages_filter TYPE ty_s_pack OPTIONAL !including_sub_packages TYPE abap_bool DEFAULT abap_false. TYPES: ty_filter TYPE string. METHODS select_specific IMPORTING model_builder TYPE REF TO cl_extr3_model_builder element_manager TYPE REF TO cl_extr3_element_manager i_element_type_filter TYPE ty_filter i_parent_name_filter TYPE ty_filter i_name_filter TYPE ty_filter. METHODS get_selected RETURNING VALUE(r_packages) TYPE ty_packages. "! @parameter tdevc_test | provide test data for table TDEVC during unit tests. METHODS constructor IMPORTING !tdevc_test TYPE ty_t_tdevc_test OPTIONAL. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_package_store, package TYPE devclass, parentpackage TYPE parentcl, subclass_searched TYPE abap_bool, is_to_be_returned TYPE abap_bool, END OF ty_package_store. TYPES ty_packages_store TYPE HASHED TABLE OF ty_package_store WITH UNIQUE KEY package. DATA g_selected_packages TYPE ty_packages. "! Select packages according to filter transfered by report "! @parameter top_packages | Select packages "! @parameter sub_packages_filter | Optional: Include sub packages only if they are filtered by this filter "! @parameter including_sub_packages | Default false: Search sub packages "! Filled during tests DATA g_tdevc_test TYPE ty_t_tdevc_test. DATA g_is_test TYPE abap_bool. METHODS _select_top_packages IMPORTING i_top_packages TYPE cl_extr3_packages=>ty_s_pack RETURNING VALUE(r_packages) TYPE cl_extr3_packages=>ty_packages. TYPES: ty_packages_to_search_sub TYPE HASHED TABLE OF ty_package WITH UNIQUE KEY package. METHODS _select_sub_packages IMPORTING i_packages_to_search_sub TYPE ty_packages_to_search_sub RETURNING VALUE(r_packages) TYPE cl_extr3_packages=>ty_packages. METHODS _select_class IMPORTING name_filter TYPE cl_extr3_initial_elements=>ty_filter element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(new_element_id) TYPE i. METHODS _select_class_method IMPORTING name_filter TYPE cl_extr3_initial_elements=>ty_filter parent_name_filter TYPE cl_extr3_initial_elements=>ty_filter element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(new_element_id) TYPE i. METHODS _select_table IMPORTING name_filter TYPE cl_extr3_initial_elements=>ty_filter element_manager TYPE REF TO cl_extr3_element_manager RETURNING VALUE(new_element_id) TYPE i. METHODS _select_program IMPORTING element_manager TYPE REF TO cl_extr3_element_manager name_filter TYPE cl_extr3_initial_elements=>ty_filter RETURNING VALUE(new_element_id) TYPE i. METHODS _select_function IMPORTING element_manager TYPE REF TO cl_extr3_element_manager name_filter TYPE cl_extr3_initial_elements=>ty_filter RETURNING VALUE(new_element_id) TYPE i. ENDCLASS. "! I know the level where an element was added to the model. "! I know whether it was found in upward or downward search. CLASS cl_extr3_model_builder DEFINITION CREATE PUBLIC . PUBLIC SECTION. TYPES: BEGIN OF found_element_type, where TYPE c LENGTH 1, level TYPE i, "! Not zero in case an element is found in up and down search. If filled this is the level for downsearch alternate_level TYPE i, element_type TYPE string, parent_name TYPE string, name TYPE string, specific TYPE abap_bool, up_search_done TYPE abap_bool, down_search_done TYPE abap_bool, END OF found_element_type. TYPES: found_elements_type TYPE STANDARD TABLE OF found_element_type. METHODS search IMPORTING i_search_up TYPE i i_search_down TYPE i. "! I am called once to notify that the initial selection of elements is started. "! All elements added to the model before my method search is called belong to the level 0 METHODS initial_selection_started. "! Called whenever a new element ID was added to the model. "! @parameters i_is_specific | set to true if the element is added due to a specific search. It is for instance to be false, if all components of a class are added. METHODS new_element_id IMPORTING i_element_id TYPE i i_is_specific TYPE abap_bool. METHODS initialize IMPORTING i_element_manager TYPE REF TO cl_extr3_element_manager i_dynamic_read TYPE string OPTIONAL. METHODS write_found_elements IMPORTING write TYPE abap_bool OPTIONAL EXPORTING fes TYPE found_elements_type. METHODS usage_of_single_element. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF found_in_level_type, element_id TYPE cl_extr3_element_manager=>element_id_type, "! A flag to mark all elements that are part of the initial selection found_in_initial_selection TYPE abap_bool, "! Elements that where added when the main search is finished found_in_post_selection TYPE abap_bool, "! Marks that an initially selected element is analyzed for lower and higher levels as requested initially_selected_analyzed TYPE abap_bool, "! The level where an element is first found. Needed to stop searching as specified. "! Also required to determine whether an upward or downward search will be done. found_in_level_upsearch TYPE i, found_in_level_downsearch TYPE i, "! Used to analyze usages of a single element. "! Marks an element that is specifically marked. "! In case a specific search is done, only elements with this flag are used for an where used analysis specific TYPE abap_bool, END OF found_in_level_type. TYPES found_in_levels_type TYPE HASHED TABLE OF found_in_level_type WITH UNIQUE KEY element_id. DATA: found_in_levels TYPE found_in_levels_type, is_initial_selection TYPE abap_bool, is_up_search TYPE abap_bool, "! Add newly found elements during upsearch in this level level_for_found_in_upsearch TYPE i, is_down_search TYPE abap_bool, "! Add newly found elements during downsearch in this level level_for_found_in_downsearch TYPE i, is_post_selection TYPE abap_bool. TYPES: BEGIN OF builder_type, association_builder TYPE REF TO cl_extr3_association_build, END OF builder_type. DATA element_manager TYPE REF TO cl_extr3_element_manager. "! Use for initial search DATA association_builders_init TYPE STANDARD TABLE OF builder_type. "! Use for final search DATA association_builders_post TYPE STANDARD TABLE OF builder_type. "! Use for search DATA association_builders TYPE STANDARD TABLE OF builder_type. DATA: tadir_builder TYPE REF TO cl_extr3_tadir_builder, where_used_builder TYPE REF TO cl_extr3_where_used_builder. "! A single element is analyzed of usage and using DATA is_usage_of_single_element TYPE abap_bool. METHODS _post_search. METHODS _initial_search. METHODS _search_up IMPORTING i_search_up TYPE i. METHODS _search_down IMPORTING i_search_down TYPE i. ENDCLASS. "! I am the starting point for an extraction. I am called from the main report. CLASS cl_extract3 DEFINITION FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS: check_if_tested RETURNING VALUE(is_tested) TYPE abap_bool. TYPES: ty_s_pack TYPE RANGE OF tadir-devclass . TYPES: ty_string_range TYPE RANGE OF char45. CONSTANTS modifier_abapglobalclass TYPE string VALUE 'ABAPGlobalClass' ##NO_TEXT. CONSTANTS modifier_abapglobalinterface TYPE string VALUE 'ABAPGlobalInterface' ##NO_TEXT. CONSTANTS modifier_webdynpro_component TYPE string VALUE 'ABAPWebDynproComponent'. CONSTANTS modifier_dbtable TYPE string VALUE 'DBTable' ##NO_TEXT. CONSTANTS modifier_program TYPE string VALUE 'ABAPProgram' ##NO_TEXT. CONSTANTS modifier_function_group TYPE string VALUE 'ABAPFunktionGroup' ##NO_TEXT. CONSTANTS modifier_BW_TRANSFORMATION TYPE string VALUE 'BWTransformation' ##NO_TEXT. CONSTANTS modifier_unknown TYPE string VALUE 'UNKNOWN' ##NO_TEXT. METHODS constructor. "! Main start to do the extraction "! @parameter i_search_up | how often is a upward searched in the where-used-information to be repeated. Search infinite if < 0 "! @parameter i_exclude_found_sap_intf | exclude found interfaces in SAP namespace in the where-used analysis METHODS extract IMPORTING model_builder TYPE REF TO cl_extr3_model_builder element_manager TYPE REF TO cl_extr3_element_manager !initial_elements TYPE REF TO cl_extr3_initial_elements i_search_up TYPE i i_search_down TYPE i i_exclude_found_sap_intf TYPE abap_bool EXPORTING !mse_model TYPE cl_model=>lines_type VALUE(nothing_done) TYPE abap_bool . PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA: g_check_for_test_done TYPE abap_bool, g_is_tested TYPE abap_bool. ENDCLASS. CLASS CL_EXTR3_ACCESS IMPLEMENTATION. METHOD add. DATA association TYPE association_type. ASSERT accessed_element_id1 IS NOT INITIAL. ASSERT accessing_element_id2 IS NOT INITIAL. association-accessed_element_id1 = accessed_element_id1. association-accessing_element_id2 = accessing_element_id2. INSERT association INTO TABLE associations. element_manager->add_association( EXPORTING element_1 = association-accessed_element_id1 element_2 = association-accessing_element_id2 association = me ). ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = i_element_manager. ENDIF. instance->type = access_ass.. r_instance = instance. ENDMETHOD. METHOD make_model. DATA using_method_id TYPE i. DATA used_id TYPE i. _get_famix_id_used_and_using( EXPORTING i_association = association IMPORTING e_using_method_id = using_method_id e_used_id = used_id ). ASSERT using_method_id IS NOT INITIAL. ASSERT used_id IS NOT INITIAL. DATA last_id2 TYPE i. last_id2 = element_manager->famix_access->add( ). element_manager->famix_access->set_accessor_variable_relation( EXPORTING element_id = last_id2 accessor_id = using_method_id variable_id = used_id ). ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_ACCESS_OR_INVOCATN IMPLEMENTATION. METHOD _get_famix_id_used_and_using. DATA: invoced_element TYPE REF TO cl_extr3_elements, invocing_element TYPE REF TO cl_extr3_elements. DATA used_id TYPE i. invoced_element = element_manager->get_element( i_element_id = i_association-element_id1 ). invocing_element = element_manager->get_element( i_element_id = i_association-element_id2 ). CASE invoced_element->type. WHEN invoced_element->class_type. DATA classes TYPE REF TO cl_extr3_classes. DATA: invoced_class_name TYPE string, invoced_cmpname TYPE string, invoced_cmptype TYPE seocmptype. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). classes->comp_name( EXPORTING element_id = i_association-element_id1 IMPORTING class_name = invoced_class_name cmpname = invoced_cmpname cmptype = invoced_cmptype ). CASE invoced_cmptype. WHEN classes->attribute_type. e_used_id = element_manager->famix_attribute->get_id( name_group = ng_abap_class class = invoced_class_name attribute = invoced_cmpname ). WHEN classes->method_type OR classes->event_type. e_used_id = element_manager->famix_method->get_id( class_name_group = ng_abap_class class = invoced_class_name method_name_group = ng_abap_method method = invoced_cmpname ). ENDCASE. WHEN invoced_element->table_type. DATA tables TYPE REF TO cl_extr3_tables. DATA tabname TYPE tabname. tables = cl_extr3_tables=>get_instance( i_element_manager = element_manager ). tabname = tables->table_name( i_element_id = i_association-element_id1 ). e_used_id = element_manager->famix_attribute->get_id( name_group = ng_sap_table class = tabname attribute = tabname ). WHEN invoced_element->program_type. DATA programs2 TYPE REF TO cl_extr3_programs. DATA: invoced_ext_progr_name_class TYPE string, invoced_ext_progr_name_method TYPE string. programs2 = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). programs2->program_name( EXPORTING i_element_id = i_association-element_id1 IMPORTING external_program_name_class = invoced_ext_progr_name_class external_program_name_method = invoced_ext_progr_name_method ). e_used_id = element_manager->famix_method->get_id( class_name_group = ng_abap_program class = invoced_ext_progr_name_class method_name_group = ng_abap_program method = invoced_ext_progr_name_method ). WHEN OTHERS. ASSERT 1 = 2. ENDCASE. DATA: invoicing_famix_class TYPE string, invoicing_famix_method TYPE string, invoicing_class_name_group TYPE string, invoicing_method_name_group TYPE string. CASE invocing_element->type. WHEN invocing_element->class_type. invoicing_class_name_group = ng_abap_class. invoicing_method_name_group = ng_abap_method. DATA: invocing_class_name TYPE string, invocing_cmpname TYPE string. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). classes->comp_name( EXPORTING element_id = i_association-element_id2 IMPORTING class_name = invocing_class_name cmpname = invocing_cmpname ). invoicing_famix_class = invocing_class_name. invoicing_famix_method = invocing_cmpname. WHEN invocing_element->web_dynpro_comps_type. invoicing_class_name_group = ng_abap_webdynpro. invoicing_method_name_group = ng_abap_webdynpro. DATA web_dynpro_component TYPE REF TO cl_extr3_web_dynpro_comp. DATA: invocing_wdy_component_name TYPE wdy_component_name, invocing_wdy_controller_name TYPE wdy_controller_name. web_dynpro_component = cl_extr3_web_dynpro_comp=>get_instance( element_manager = element_manager ). web_dynpro_component->wdy_controller_name( EXPORTING element_id = i_association-element_id2 IMPORTING wdy_component_name = invocing_wdy_component_name wdy_controller_name = invocing_wdy_controller_name ). invoicing_famix_class = invocing_wdy_component_name. invoicing_famix_method = invocing_wdy_controller_name. WHEN invocing_element->program_type. invoicing_class_name_group = ng_abap_program. invoicing_method_name_group = ng_abap_program. DATA programs TYPE REF TO cl_extr3_programs. programs = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). programs->program_name( EXPORTING i_element_id = i_association-element_id2 IMPORTING external_program_name_class = invoicing_famix_class external_program_name_method = invoicing_famix_method ). WHEN OTHERS. ASSERT 1 = 2. ENDCASE. DATA using_method_id TYPE i. ASSERT invoicing_class_name_group IS NOT INITIAL. ASSERT invoicing_method_name_group IS NOT INITIAL. e_using_method_id = element_manager->famix_method->get_id( class_name_group = invoicing_class_name_group class = invoicing_famix_class method_name_group = invoicing_method_name_group method = invoicing_famix_method ). ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_ASSOCIATION IMPLEMENTATION. METHOD make_model. " I must be redefined ASSERT 1 = 2. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_INVOCATION IMPLEMENTATION. METHOD add. DATA association TYPE association_type. ASSERT invoced_element_id1 IS NOT INITIAL. ASSERT invocing_element_id2 IS NOT INITIAL. association-invoced_element_id1 = invoced_element_id1. association-invocing_element_id2 = invocing_element_id2. INSERT association INTO TABLE associations. element_manager->add_association( EXPORTING element_1 = association-invoced_element_id1 element_2 = association-invocing_element_id2 association = me ). ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = i_element_manager. ENDIF. instance->type = invocation_ass. r_instance = instance. ENDMETHOD. METHOD make_model. DATA using_method_id TYPE i. DATA used_id TYPE i. _get_famix_id_used_and_using( EXPORTING i_association = association IMPORTING e_using_method_id = using_method_id e_used_id = used_id ). ASSERT using_method_id IS NOT INITIAL. ASSERT used_id IS NOT INITIAL. DATA invocation_id TYPE i. invocation_id = element_manager->famix_invocation->add( ). element_manager->famix_invocation->set_invocation_by_reference( EXPORTING element_id = invocation_id sender_id = using_method_id candidates_id = used_id signature = 'DUMMY' ). ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_PARENT_PACKAGE IMPLEMENTATION. METHOD add. DATA association TYPE association_type. association-element_id1 = element_id. association-element_id2 = parent_element_id. INSERT association INTO TABLE associations. element_manager->add_association( EXPORTING element_1 = association-element_id1 element_2 = association-element_id2 association = me ). ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = i_element_manager. ENDIF. instance->type = parent_package_ass. r_instance = instance. ENDMETHOD. METHOD make_model. " I am added in the elements them self to the model ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_ASSOCIATION_BUILD IMPLEMENTATION. METHOD search_down. " Redefine me ASSERT 1 = 2. ENDMETHOD. METHOD search_up. " Redefine me ASSERT 1 = 2. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_TADIR_BUILDER IMPLEMENTATION. METHOD constructor. super->constructor( i_element_manager = i_element_manager ). parent_package = cl_extr3_parent_package=>get_instance( i_element_manager = element_manager ). classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). programs = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). tables = cl_extr3_tables=>get_instance( i_element_manager = element_manager ). web_dynpro_components = cl_extr3_web_dynpro_comp=>get_instance( element_manager = element_manager ). ENDMETHOD. METHOD search_down. DATA: element TYPE REF TO cl_extr3_elements, package TYPE REF TO cl_extr3_packages, is_found TYPE abap_bool, new_element_id TYPE cl_extr3_element_manager=>element_id_type, class_name TYPE string, tabname TYPE string, function_group TYPE string, program TYPE progname, wdy_component_name TYPE wdy_component_name. element = element_manager->get_element( element_id ). IF element->type EQ element->package_type. package ?= element. DATA devclass TYPE devclass. devclass = package->devclass( element_id ). TYPES: BEGIN OF ty_tadir, pgmid TYPE pgmid, object TYPE trobjtype, obj_name TYPE sobj_name, END OF ty_tadir. DATA: tadir TYPE ty_tadir, tadirs TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY. SELECT pgmid object obj_name FROM tadir INTO TABLE tadirs WHERE devclass = devclass. LOOP AT tadirs INTO tadir. is_found = abap_false. CASE tadir-pgmid. WHEN 'R3TR'. CASE tadir-object. WHEN 'CLAS' OR 'INTF'. class_name = tadir-obj_name. classes->add( EXPORTING class = class_name is_specific = abap_true IMPORTING is_added = is_found new_element_id = new_element_id ). WHEN 'DEVC'. WHEN 'FUGR'. function_group = tadir-obj_name. programs->add_function_group( EXPORTING fgr = function_group IMPORTING is_added = is_found new_element_id = new_element_id ). WHEN 'PROG'. program = tadir-obj_name. programs->add( EXPORTING program = program IMPORTING is_added = is_found new_element_id = new_element_id ). WHEN 'TABL'. tabname = tadir-obj_name. tables->add( EXPORTING table = tabname IMPORTING is_added = is_found new_element_id = new_element_id ). WHEN 'WDYN'. wdy_component_name = tadir-obj_name. web_dynpro_components->add( EXPORTING wdy_component_name = wdy_component_name IMPORTING is_added = is_found new_element_id = new_element_id ). WHEN OTHERS. " TBD handle ENDCASE. WHEN OTHERS. "TBD handle ENDCASE. IF is_found EQ abap_true. parent_package->add( EXPORTING element_id = new_element_id parent_element_id = element_id ). ENDIF. ENDLOOP. ENDIF. ENDMETHOD. METHOD search_up. DATA: element TYPE REF TO cl_extr3_elements, package TYPE REF TO cl_extr3_packages, is_found TYPE abap_bool, new_element_id TYPE cl_extr3_element_manager=>element_id_type, class_name TYPE string, clstype TYPE seoclstype, tabname TYPE tabname. package = cl_extr3_packages=>get_instance( i_element_manager = element_manager ). element = element_manager->get_element( element_id ). DATA: object TYPE trobjtype, obj_name TYPE sobj_name. CLEAR object. CLEAR obj_name. CASE element->type. WHEN element->class_type. classes->class_name( EXPORTING element_id = element_id IMPORTING class_name = class_name clstype = clstype ). obj_name = class_name. IF clstype EQ classes->is_class_type. object = 'CLAS'. ELSEIF clstype EQ classes->interface_type. object = 'INTF'. ELSE. ASSERT 1 = 2. ENDIF. WHEN element->table_type. tabname = tables->table_name( i_element_id = element_id ). object = 'TABL'. obj_name = tabname. WHEN element->program_type. DATA program_type TYPE string. DATA program TYPE progname. DATA program_attribute_1 TYPE string. programs->program_name( EXPORTING i_element_id = element_id IMPORTING program_type = program_type program = program * external_program_name_class = external_program_name_class * external_program_name_method = program_attribute_1 = program_attribute_1 * subc = ). IF program_type EQ programs->type_function OR program_type EQ programs->type_function_include. object = 'FUGR'. obj_name = program_attribute_1. ELSEIF program_type EQ programs->type_program. object = 'PROG'. obj_name = program. ENDIF. ENDCASE. TYPES: BEGIN OF ty_tadir, devclass TYPE devclass, END OF ty_tadir. DATA: tadir TYPE ty_tadir, tadirs TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY. IF object IS NOT INITIAL. SELECT devclass FROM tadir INTO TABLE tadirs WHERE pgmid = 'R3TR' AND object = object AND obj_name = obj_name. IF sy-subrc EQ 0. LOOP AT tadirs INTO tadir. package->add( EXPORTING package = tadir-devclass IMPORTING is_added = is_found new_element_id = new_element_id ). IF is_found EQ abap_true. parent_package->add( EXPORTING element_id = element_id parent_element_id = new_element_id ). ENDIF. ENDLOOP. ENDIF. ENDIF. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_WHERE_USED_BUILDER IMPLEMENTATION. METHOD search_down. DATA: element TYPE REF TO cl_extr3_elements. element = element_manager->get_element( element_id ). DATA invocation TYPE REF TO cl_extr3_invocation. invocation = cl_extr3_invocation=>get_instance( i_element_manager = element_manager ). DATA: include_name TYPE syrepid. CASE element->type. WHEN element->class_type. "TBD DATA: class_name TYPE string, cmpname TYPE string, cmptype TYPE seocmptype, exists TYPE abap_bool. DATA classes TYPE REF TO cl_extr3_classes. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). classes->comp_name( EXPORTING element_id = element_id IMPORTING class_name = class_name cmpname = cmpname cmptype = cmptype exists = exists ). IF exists EQ abap_false. RETURN. ENDIF. DATA: class_key TYPE seoclskey. DATA: includes TYPE seop_methods_w_include. class_key-clsname = class_name. IF cmptype EQ '1' OR cmptype EQ '2'. DATA clsname TYPE seoclsname. clsname = class_key. CALL METHOD cl_oo_classname_service=>get_all_method_includes( EXPORTING clsname = clsname * with_enhancements = " X = searches also for enh.method includes RECEIVING result = includes EXCEPTIONS class_not_existing = 1 OTHERS = 2 ). IF sy-subrc <> 0. " TBD Better error handling RETURN. ENDIF. " This method is described to be obsolete * CALL FUNCTION 'SEO_CLASS_GET_METHOD_INCLUDES' * EXPORTING * clskey = class_key * IMPORTING * includes = includes * EXCEPTIONS * _internal_class_not_existing = 1 * OTHERS = 2. * IF sy-subrc <> 0. * " TBD Better error handling * RETURN. * ENDIF. DATA: include TYPE LINE OF seop_methods_w_include. READ TABLE includes INTO include WITH KEY cpdkey-cpdname = cmpname. IF sy-subrc <> 0. " TBD ? RETURN. ELSE. "SAP_2_FAMIX_78 Provide downsearch for class methods include_name = include-incname. ENDIF. ELSE. RETURN. ENDIF. * CASE cmptype. * WHEN '1'. "Method * WHEN '2'. "Even * ENDCASE. WHEN element->table_type. "Is this needed? WHEN element->program_type. " Duplicate coding 1/2 see method search_up DATA programs2 TYPE REF TO cl_extr3_programs. programs2 = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). DATA: program TYPE progname, program_type TYPE string, program_attribute_2 TYPE string. programs2->program_name( EXPORTING i_element_id = element_id IMPORTING program = program program_type = program_type program_attribute_2 = program_attribute_2 * external_program_name_class = * external_program_name_method = * subc = ). CASE program_type. WHEN programs2->type_program. " SAP_2_FAMIX_73 Provide downsearch for programs include_name = program. WHEN programs2->type_function. include_name = program. WHEN OTHERS. " TBD ENDCASE. ENDCASE. IF include_name IS NOT INITIAL. DATA: wbcrossgts TYPE wbcrossgts_type, wbcrossgt TYPE wbcrossgt_type, cross TYPE cross_type, crosss TYPE cross_types, wbcrossi TYPE wbcrossi_type, wbcrossis TYPE wbcrossi_types. SELECT otype name include direct indirect FROM wbcrossgt INTO TABLE wbcrossgts WHERE include = include_name. SELECT type name include FROM cross INTO TABLE crosss WHERE include = include_name. SELECT name include FROM wbcrossi INTO TABLE wbcrossis WHERE include = include_name. " Read dynamic usages DATA: w TYPE wbcrossgt. LOOP AT g_dynamic_usage INTO w WHERE include = include_name. MOVE-CORRESPONDING w TO wbcrossgt. INSERT wbcrossgt INTO TABLE wbcrossgts. ENDLOOP. LOOP AT crosss INTO cross. DATA: is_added TYPE abap_bool, uses_element_id TYPE cl_extr3_element_manager=>element_id_type. CLEAR is_added. DATA programs TYPE REF TO cl_extr3_programs. programs = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). IF cross-type EQ 'R' OR cross-type EQ 'F'. DATA: program_found TYPE progname. IF cross-type EQ 'R'. " SAP_2_FAMIX_67 Find programs in down search program_found = cross-name. programs->add( EXPORTING program = program_found IMPORTING is_added = is_added new_element_id = uses_element_id ). ELSEIF cross-type EQ 'F'. " SAP_2_FAMIX_72 Find functions in down search DATA function TYPE string. function = cross-name. programs->add_function( EXPORTING function = function IMPORTING is_added = is_added new_element_id = uses_element_id ). ELSE. ASSERT 1 = 2. ENDIF. IF uses_element_id IS INITIAL. "TBD support this kind of elements CONTINUE. ENDIF. IF is_added EQ abap_true. element_manager->model_builder->new_element_id( EXPORTING i_element_id = uses_element_id i_is_specific = abap_true ). ELSE. "TBD what is to be done here? ENDIF. invocation->add( EXPORTING invoced_element_id1 = uses_element_id invocing_element_id2 = element_id ). * ELSEIF cross-type EQ 'F'. * " TBD functions ELSE. " TBD ? ENDIF. ENDLOOP. LOOP AT wbcrossis INTO wbcrossi. CLEAR is_added. programs = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). " SAP_2_FAMIX_70 Find includes in downsearch " This is an include, but it is reported as program, TBD change this program_found = wbcrossi-name. programs->add( EXPORTING program = program_found IMPORTING is_added = is_added new_element_id = uses_element_id ). IF uses_element_id IS INITIAL. "TBD support this kind of elements CONTINUE. ENDIF. IF is_added EQ abap_true. element_manager->model_builder->new_element_id( EXPORTING i_element_id = uses_element_id i_is_specific = abap_true ). ELSE. "TBD what is to be done here? ENDIF. invocation->add( EXPORTING invoced_element_id1 = uses_element_id invocing_element_id2 = element_id ). ENDLOOP. LOOP AT wbcrossgts INTO wbcrossgt. CLEAR is_added. CASE wbcrossgt-otype. WHEN 'ME'. DATA: class TYPE string, method TYPE string. SPLIT wbcrossgt-name AT '\ME:' INTO class method. DATA: part1 TYPE string, part2 TYPE string. SPLIT class AT '\IN:' INTO part1 part2. IF part2 IS NOT INITIAL. CONTINUE." TBD specify this better ENDIF. DATA: temp TYPE string. temp = class && |~| && method. IF cmpname EQ temp. " Implementation of interface methods are in the where used list. These are added explicitely in the class coding. So filter here. CONTINUE. ENDIF. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). " SAP_2_FAMIX_75 Find class methods in downsearch ASSERT class IS NOT INITIAL. TRY. classes->add_component( EXPORTING clsname = class cmpname = method is_specific = abap_true IMPORTING is_added = is_added new_element_id = uses_element_id ). IF uses_element_id IS INITIAL. "TBD support this kind of elements CONTINUE. ENDIF. CATCH zcx_2mse_extr3_classes_wr_type. " This attribute is indeed a type, but types are not stored to the model CONTINUE. ENDTRY. IF is_added EQ abap_true. element_manager->model_builder->new_element_id( EXPORTING i_element_id = uses_element_id i_is_specific = abap_true ). ELSE. "TBD what is to be done here? ENDIF. DATA: is_redefinition_of_method TYPE abap_bool. is_redefinition_of_method = classes->is_redefinition_of_method( invoced_element_id1 = uses_element_id invocing_element_id2 = element_id ). IF is_redefinition_of_method EQ abap_true. invocation->add( EXPORTING invoced_element_id1 = element_id invocing_element_id2 = uses_element_id ). ELSE. invocation->add( EXPORTING invoced_element_id1 = uses_element_id invocing_element_id2 = element_id ). ENDIF. WHEN 'DA'. DATA: attribute TYPE string. SPLIT wbcrossgt-name AT '\DA:' INTO class attribute. SPLIT class AT '\ME:' INTO part1 part2. IF part2 IS NOT INITIAL. CONTINUE." TBD specify this better ENDIF. SPLIT class AT '\IN:' INTO part1 part2. IF part2 IS NOT INITIAL. CONTINUE." TBD specify this better ENDIF. IF attribute IS NOT INITIAL. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). " SAP_2_FAMIX_76 Find class attributes in downsearch ASSERT class IS NOT INITIAL. TRY. classes->add_component( EXPORTING clsname = class cmpname = attribute is_specific = abap_false IMPORTING is_added = is_added new_element_id = uses_element_id ). IF uses_element_id IS INITIAL. "TBD support this kind of elements CONTINUE. ENDIF. CATCH zcx_2mse_extr3_classes_wr_type. " This attribute is indeed a type, but types are not stored to the model CONTINUE. ENDTRY. IF is_added EQ abap_true. element_manager->model_builder->new_element_id( EXPORTING i_element_id = uses_element_id i_is_specific = abap_true ). ELSE. "TBD what is to be done here? ENDIF. DATA access TYPE REF TO cl_extr3_access. access = cl_extr3_access=>get_instance( i_element_manager = element_manager ). IF uses_element_id IS NOT INITIAL. " This may be some irregular object, that is not a class attribute access->add( EXPORTING accessed_element_id1 = uses_element_id accessing_element_id2 = element_id ). ENDIF. ENDIF. WHEN 'TY'. DATA tabclass TYPE tabclass. SELECT SINGLE tabclass FROM dd02l INTO tabclass WHERE tabname = wbcrossgt-name. IF sy-subrc EQ 0. DATA tables TYPE REF TO cl_extr3_tables. tables = cl_extr3_tables=>get_instance( i_element_manager = element_manager ). DATA: new_table TYPE string. new_table = wbcrossgt-name. " SAP_2_FAMIX_77 Find database tables in downsearch tables->add( EXPORTING table = new_table IMPORTING new_element_id = uses_element_id is_added = is_added ). IF uses_element_id IS INITIAL. "TBD support this kind of elements CONTINUE. ENDIF. IF is_added EQ abap_true. element_manager->model_builder->new_element_id( EXPORTING i_element_id = uses_element_id i_is_specific = abap_true ). ELSE. "TBD what is to be done here? ENDIF. IF uses_element_id IS NOT INITIAL. access = cl_extr3_access=>get_instance( i_element_manager = element_manager ). access->add( EXPORTING accessed_element_id1 = uses_element_id accessing_element_id2 = element_id ). ENDIF. ENDIF. ENDCASE. ENDLOOP. ENDIF. ENDMETHOD. METHOD search_up. DATA: element TYPE REF TO cl_extr3_elements, is_access TYPE abap_bool. element = element_manager->get_element( element_id ). DATA classes TYPE REF TO cl_extr3_classes. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). DATA access TYPE REF TO cl_extr3_access. access = cl_extr3_access=>get_instance( i_element_manager = element_manager ). DATA invocation TYPE REF TO cl_extr3_invocation. invocation = cl_extr3_invocation=>get_instance( i_element_manager = element_manager ). CASE element->type. WHEN element->class_type. DATA class_name TYPE string. DATA cmpname TYPE string. DATA cmptype TYPE seocmptype. DATA clstype TYPE seoclstype. DATA exists TYPE abap_bool. IF element_manager->exclude_found_sap_intf EQ abap_true. classes->class_name( EXPORTING element_id = element_id IMPORTING class_name = class_name clstype = clstype exists = exists ). IF exists EQ abap_true. IF clstype EQ classes->interface_type. IF class_name CP 'Y*' OR class_name CP 'Z*' OR class_name CP '/*' . " OK ELSE. " Do not collect, it should be OK just to leave the method here RETURN. ENDIF. ENDIF. ENDIF. ENDIF. classes->comp_name( EXPORTING element_id = element_id IMPORTING class_name = class_name cmpname = cmpname cmptype = cmptype ). IF element_manager->exclude_found_sap_intf EQ abap_true AND class_name CP 'IF*'. " Do not collect, it should be OK just to leave the method here RETURN. ENDIF. DATA: otype TYPE char2, where_used_name TYPE eu_lname. CASE cmptype. WHEN classes->method_type. otype = 'ME'. WHEN classes->attribute_type. otype = 'DA'. is_access = abap_true. WHEN classes->event_type. otype = 'EV'. WHEN OTHERS. ASSERT 1 = 2. ENDCASE. FIND '~' IN cmpname. IF sy-subrc <> 0. where_used_name = class_name && |\\| && otype && |:| && cmpname. ELSE. DATA: interface_name TYPE string, method_name TYPE string. SPLIT cmpname AT '~' INTO interface_name method_name. where_used_name = class_name && |\\IN:| && interface_name && |\\| && otype && |:| && method_name. ENDIF. WHEN element->table_type. DATA tables TYPE REF TO cl_extr3_tables. tables = cl_extr3_tables=>get_instance( i_element_manager = element_manager ). DATA table TYPE tabname. table = tables->table_name( i_element_id = element_id ). otype = 'TY'. where_used_name = table. is_access = abap_true. WHEN element->program_type. " Duplicate coding 2/2 see method search_down DATA programs2 TYPE REF TO cl_extr3_programs. programs2 = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). DATA: program TYPE progname, program_type TYPE string, program_attribute_2 TYPE string. programs2->program_name( EXPORTING i_element_id = element_id IMPORTING program = program program_type = program_type program_attribute_2 = program_attribute_2 * external_program_name_class = * external_program_name_method = * subc = ). DATA: cross_type TYPE char1, cross_name TYPE seu_name. CASE program_type. WHEN programs2->type_program. cross_type = 'R'. cross_name = program. WHEN programs2->type_function. cross_type = 'F'. cross_name = program_attribute_2. WHEN OTHERS. " TBD ENDCASE. ENDCASE. IF where_used_name IS NOT INITIAL OR cross_name IS NOT INITIAL. DATA: wbcrossgts TYPE wbcrossgts_type, wbcrossgt TYPE wbcrossgt_type, cross TYPE cross_type, crosss TYPE cross_types. IF otype IS NOT INITIAL. SELECT otype name include direct indirect FROM wbcrossgt INTO TABLE wbcrossgts WHERE otype = otype AND name = where_used_name. ENDIF. IF cross_type IS NOT INITIAL. SELECT type name include FROM cross INTO TABLE crosss WHERE type = cross_type AND name = cross_name. LOOP AT crosss INTO cross. " Most where used information is in table wbcrossgt. Now some information is read from table cross. Use nonetheless wbcrossgt " for further processing. There is an integration test, that assures the correctness of the whole coding. CLEAR wbcrossgt. wbcrossgt-name = cross-name. wbcrossgt-include = cross-include. INSERT wbcrossgt INTO TABLE wbcrossgts. ENDLOOP. ENDIF. " Read dynamic usages DATA: w TYPE wbcrossgt. LOOP AT g_dynamic_usage INTO w WHERE otype = otype AND name = where_used_name. MOVE-CORRESPONDING w TO wbcrossgt. INSERT wbcrossgt INTO TABLE wbcrossgts. ENDLOOP. LOOP AT wbcrossgts INTO wbcrossgt. DATA: is_added TYPE abap_bool, used_by_element_id TYPE cl_extr3_element_manager=>element_id_type. CLEAR is_added. " Analyze where used table DATA: pgmid TYPE pgmid, object TYPE trobjtype, obj_name TYPE trobj_name. DATA found_class_name TYPE string. DATA found_cmpname TYPE string. cl_oo_include_naming=>get_trkey_by_include( EXPORTING progname = wbcrossgt-include IMPORTING pgmid = pgmid object = object obj_name = obj_name EXCEPTIONS no_objecttype = 1 invalid_include = 2 internal_error = 3 OTHERS = 4 ). IF sy-subrc EQ 0. CASE object. WHEN 'METH'. found_class_name = obj_name+0(30). " TBD include code here? found_cmpname = obj_name+30(61). DATA: temp TYPE string. temp = class_name && |~| && cmpname. IF found_cmpname <> temp. " Implementation of interface methods are in the where used list. These are added explicitely in the class coding. So filter here. TRY. classes->add_component( EXPORTING clsname = found_class_name cmpname = found_cmpname is_specific = abap_false IMPORTING is_added = is_added new_element_id = used_by_element_id ). IF is_added EQ abap_true. element_manager->model_builder->new_element_id( EXPORTING i_element_id = used_by_element_id i_is_specific = abap_true ). ELSE. "TBD what is to be done here? ENDIF. CATCH zcx_2mse_extr3_classes_wr_type. " This attribute is indeed a type, but types are not stored to the model " Do nothing to ignore this attribute ENDTRY. ENDIF. WHEN OTHERS. " TBD is code required here? ENDCASE. * <include_2_component>-is_class_component = abap_true. ELSE. "Check for usage in Web Dynpro ABAP DATA ls_wd_sourcemap TYPE wdy_wb_sourcemap. SELECT SINGLE * FROM wdy_wb_sourcemap INTO ls_wd_sourcemap WHERE relid = 'LI' AND inclname = wbcrossgt-include AND srtf2 = 0. IF sy-subrc EQ 0. DATA web_dynpro_component TYPE REF TO cl_extr3_web_dynpro_comp. web_dynpro_component = cl_extr3_web_dynpro_comp=>get_instance( element_manager = element_manager ). web_dynpro_component->add_component( EXPORTING wdy_component_name = ls_wd_sourcemap-component_name wdy_controller_name = ls_wd_sourcemap-controller_name IMPORTING is_added = is_added new_element_id = used_by_element_id ). ELSE. DATA programs TYPE REF TO cl_extr3_programs. programs = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). programs->add( EXPORTING program = wbcrossgt-include IMPORTING is_added = is_added new_element_id = used_by_element_id ). ENDIF. ENDIF. IF is_added EQ abap_true. IF is_access EQ abap_true. access->add( EXPORTING accessed_element_id1 = element_id accessing_element_id2 = used_by_element_id ). ELSE. DATA: is_redefinition_of_method TYPE abap_bool. is_redefinition_of_method = classes->is_redefinition_of_method( invoced_element_id1 = element_id invocing_element_id2 = used_by_element_id ). IF is_redefinition_of_method EQ ''. invocation->add( EXPORTING invoced_element_id1 = element_id invocing_element_id2 = used_by_element_id ). ELSE. invocation->add( EXPORTING invoced_element_id1 = used_by_element_id invocing_element_id2 = element_id ). ENDIF. ENDIF. ENDIF. ENDLOOP. ENDIF. ENDMETHOD. METHOD set_dynamic_read. DATA: s TYPE string, class TYPE string, t TYPE TABLE OF string, w2 TYPE wbcrossgt. CLEAR g_dynamic_usage. s = i_dynamic_read. TRANSLATE s TO UPPER CASE. CONDENSE s. SPLIT s AT space INTO TABLE t. LOOP AT t INTO class. DATA dyn_usage TYPE STANDARD TABLE OF wbcrossgt WITH DEFAULT KEY. CALL METHOD (class)=>where_used IMPORTING data = dyn_usage. LOOP AT dyn_usage INTO w2. INSERT w2 INTO TABLE g_dynamic_usage. ENDLOOP. ENDLOOP. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_CLASSES IMPLEMENTATION. METHOD add. DATA: element TYPE element_type, element_comp TYPE element_comp_type. READ TABLE elements_class_name INTO element WITH KEY class_name = class. IF sy-subrc EQ 0. is_added = abap_true. new_element_id = element-element_id. LOOP AT elements_comp_clsname_cmpname INTO element_comp WHERE clsname = class. DATA class_component TYPE cl_extr3_classes=>ty_class_component. class_component-clsname = element_comp-clsname. class_component-cmpname = element_comp-cmpname. class_component-cmptype = element_comp-cmptype. class_component-mtdtype = element_comp-mtdtype. INSERT class_component INTO TABLE class_components. ENDLOOP. ELSE. " Does table exists? DATA: found_class_name TYPE seoclsname, found_class_type TYPE seoclstype. " No blank between ( and found... to be 7.02 compatible SELECT SINGLE clsname clstype FROM seoclass INTO (found_class_name , found_class_type ) WHERE clsname = class. IF found_class_name IS NOT INITIAL. is_added = abap_true. ENDIF. IF is_added EQ abap_true. new_element_id = element_manager->add_element( element = me is_specific = is_specific ). element-element_id = new_element_id. element-class_name = class. element-clstype = found_class_type. INSERT element INTO TABLE elements_element_id. INSERT element INTO TABLE elements_class_name. ENDIF. SELECT clsname cmpname cmptype mtdtype FROM seocompo INTO CORRESPONDING FIELDS OF TABLE class_components WHERE cmptype <> 3 " A type AND clsname = class. DATA: redefined_class_components TYPE ty_class_components, redefined_class_component TYPE ty_class_component. redefined_class_components = _get_redefined( class ). LOOP AT redefined_class_components INTO redefined_class_component. INSERT redefined_class_component INTO TABLE class_components. ENDLOOP. LOOP AT class_components INTO class_component. _add_component( EXPORTING clsname = class_component-clsname cmpname = class_component-cmpname is_specific = is_specific ). ENDLOOP. _add_metarel( clsname = class is_specific = is_specific ). ##TODO " Is it correct to set this specific? ENDIF. ENDMETHOD. METHOD add_component. DATA: is_added_now TYPE abap_bool. add( EXPORTING class = clsname is_specific = is_specific IMPORTING is_added = is_added ). IF is_added EQ abap_true. _add_component( EXPORTING clsname = clsname cmpname = cmpname is_specific = is_specific IMPORTING is_added = is_added new_element_id = new_element_id is_added_now = is_added_now ). IF is_specific EQ abap_true AND new_element_id IS NOT INITIAL. element_manager->model_builder->new_element_id( EXPORTING i_element_id = new_element_id i_is_specific = abap_true ). ENDIF. ENDIF. ENDMETHOD. METHOD class_name. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. IF sy-subrc EQ 0. class_name = element-class_name. clstype = element-clstype. exists = abap_true. ENDIF. ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD collect_infos. DATA: part1 TYPE string, part2_classes TYPE string, part2_interfaces TYPE string, name TYPE string, part3 TYPE string. " Get ADT Link to class or interface CONCATENATE 'adt://' sysid '/sap/bc/adt/oo/' INTO part1. part2_classes = 'classes/'. part2_interfaces = 'interfaces/'. part3 = '/source/main'. FIELD-SYMBOLS: <element> TYPE element_type. LOOP AT elements_element_id ASSIGNING <element>. name = <element>-class_name. TRANSLATE name TO LOWER CASE. IF <element>-clstype EQ is_class_type. CONCATENATE part1 part2_classes name part3 INTO <element>-adt_link. ELSEIF <element>-clstype EQ interface_type. CONCATENATE part1 part2_interfaces name part3 INTO <element>-adt_link. ELSE. ASSERT 1 = 2. ENDIF. " Get ADT Link to components DATA: cifkey TYPE seoclskey, cifref TYPE REF TO if_oo_clif_incl_naming, clsref TYPE REF TO if_oo_class_incl_naming, intref TYPE REF TO if_oo_interface_incl_naming, source TYPE seop_source_string, source_protected TYPE seop_source_string, source_private TYPE seop_source_string, source_line TYPE LINE OF seop_source_string. cifkey-clsname = <element>-class_name. CLEAR source. CLEAR source_protected. CLEAR source_private. CALL METHOD cl_oo_include_naming=>get_instance_by_cifkey EXPORTING cifkey = cifkey RECEIVING cifref = cifref EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. " :-( ELSE. CASE cifref->clstype. WHEN seoc_clstype_class. clsref ?= cifref. READ REPORT clsref->public_section INTO source. READ REPORT clsref->protected_section INTO source_protected. READ REPORT clsref->private_section INTO source_private. WHEN seoc_clstype_interface. intref ?= cifref. READ REPORT intref->public_section INTO source. WHEN OTHERS. " What is to be done? ENDCASE. ENDIF. APPEND LINES OF source_protected TO source. APPEND LINES OF source_private TO source. DATA: line_no TYPE i, line TYPE string. line_no = 0. * LOOP AT source INTO source_line. * add 1 to line_no. * line = source_line. * condense line. * split line at ' ' into * ENDLOOP. DATA: tokens TYPE STANDARD TABLE OF stokes, token LIKE LINE OF tokens, next_component TYPE seocmptype, next_line TYPE i. DATA statements TYPE STANDARD TABLE OF sstmnt. SCAN ABAP-SOURCE source TOKENS INTO tokens STATEMENTS INTO statements. LOOP AT tokens INTO token. ADD 1 TO line_no. IF line_no EQ next_line. DATA: element_comp TYPE element_comp_type. READ TABLE elements_comp_clsname_cmpname INTO element_comp WITH TABLE KEY clsname = <element>-class_name cmpname = token-str. IF sy-subrc <> 0. " What to do? ELSE. FIELD-SYMBOLS <element_comp> TYPE element_comp_type. READ TABLE elements_comp_element_id ASSIGNING <element_comp> WITH TABLE KEY element_id = element_comp-element_id. IF sy-subrc <> 0. " What to do? ELSE. DATA: row TYPE string. row = token-row. DATA: adt_link TYPE string. CONCATENATE <element>-adt_link '#start=' row ',1' INTO adt_link. CONDENSE adt_link NO-GAPS. IF <element_comp>-adt_link IS INITIAL. " Are there further hits? <element_comp>-adt_link = adt_link. ENDIF. ENDIF. ENDIF. ELSE. CLEAR next_line. CLEAR next_component. CASE token-str. WHEN 'CLASS-DATA' OR 'DATA'. next_component = attribute_type. next_line = line_no + 1. WHEN 'CLASS-METHODS' OR 'METHODS'. next_component = method_type. next_line = line_no + 1. WHEN 'CLASS-EVENTS' OR 'EVENTS'. next_component = event_type. next_line = line_no + 1. ENDCASE. ENDIF. ENDLOOP. ENDLOOP. ENDMETHOD. METHOD comp_name. DATA element_comp TYPE element_comp_type. READ TABLE elements_comp_element_id INTO element_comp WITH KEY element_id = element_id. IF sy-subrc EQ 0. class_name = element_comp-clsname. cmpname = element_comp-cmpname. cmptype = element_comp-cmptype. exists = abap_true. ENDIF. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = element_manager. ENDIF. instance->type = class_type. r_instance = instance. ENDMETHOD. METHOD is_redefinition_of_method. DATA: invoced TYPE element_comp_type, invocing TYPE element_comp_type. READ TABLE elements_comp_element_id INTO invoced WITH KEY element_id = invoced_element_id1. IF sy-subrc <> 0. RETURN. ENDIF. READ TABLE elements_comp_element_id INTO invocing WITH KEY element_id = invocing_element_id2. IF sy-subrc <> 0. RETURN. ENDIF. IF invoced-cmpname <> invocing-cmpname. RETURN. ENDIF. DATA: r TYPE redefined_method_type. READ TABLE redefined_methods INTO r WITH TABLE KEY method = invocing-cmpname clsname = invocing-clsname defined_in_clsname = invoced-clsname. IF sy-subrc EQ 0. r_result = 'X'. ENDIF. ENDMETHOD. METHOD make_model. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. IF sy-subrc EQ 0. DATA: last_id TYPE i, file_anchor_id TYPE i. IF element-clstype EQ is_class_type. " SAP_2_FAMIX_59 Mark the FAMIX Class with the attribute modifiers = 'ABAPGlobalClass' " SAP_2_FAMIX_6 Map ABAP classes to FAMIX.Class element_manager->famix_class->add( EXPORTING name_group = ng_abap_class name = element-class_name modifiers = cl_extract3=>modifier_abapglobalclass IMPORTING id = last_id ). IF element-adt_link IS NOT INITIAL. element_manager->famix_file_anchor->add( EXPORTING element_id = last_id " Required for Moose 6.1 file_name = element-adt_link IMPORTING id = file_anchor_id ). IF file_anchor_id IS NOT INITIAL. element_manager->famix_class->set_source_anchor_by_id( EXPORTING element_id = last_id source_anchor_id = file_anchor_id ). ENDIF. ENDIF. ELSEIF element-clstype EQ interface_type. " SAP_2_FAMIX_60 Mark the FAMIX Class with the attribute modifiers = 'ABAPGlobalInterface' " SAP_2_FAMIX_7 Map ABAP Interfaces to FAMIX.Class element_manager->famix_class->add( EXPORTING name_group = ng_abap_class name = element-class_name modifiers = cl_extract3=>modifier_abapglobalinterface IMPORTING id = last_id ). " SAP_2_FAMIX_8 Set the attribute isInterface in case of ABAP Interfaces element_manager->famix_class->is_interface( element_id = last_id ). IF element-adt_link IS NOT INITIAL. element_manager->famix_file_anchor->add( EXPORTING element_id = last_id " Required for Moose 6.1 file_name = element-adt_link IMPORTING id = file_anchor_id ). IF file_anchor_id IS NOT INITIAL. element_manager->famix_class->set_source_anchor_by_id( EXPORTING element_id = last_id source_anchor_id = file_anchor_id ). ENDIF. ENDIF. ELSE. ASSERT 1 = 2. ENDIF. DATA association TYPE cl_extr3_element_manager=>association_type. LOOP AT associations INTO association WHERE element_id1 = element_id AND association->type = cl_extr3_association=>parent_package_ass. DATA package TYPE REF TO cl_extr3_packages. package ?= element_manager->get_element( i_element_id = association-element_id2 ). element_manager->famix_class->set_parent_package( element_id = last_id parent_package = package->devclass( i_element_id = association-element_id2 ) parent_package_name_group = ng_abap_package ). ENDLOOP. ELSE. DATA element_comp TYPE element_comp_type. READ TABLE elements_comp_element_id INTO element_comp WITH KEY element_id = element_id. ASSERT sy-subrc EQ 0. CASE element_comp-cmptype. WHEN attribute_type. * DATA last_id TYPE i.! element_manager->famix_attribute->add( EXPORTING name = element_comp-cmpname IMPORTING id = last_id ). element_manager->famix_attribute->set_parent_type( EXPORTING element_id = last_id parent_element = 'FAMIX.Class' parent_name_group = ng_abap_class parent_name = element_comp-clsname ). IF element_comp-adt_link IS NOT INITIAL. element_manager->famix_file_anchor->add( EXPORTING element_id = last_id " Required for Moose 6.1 file_name = element_comp-adt_link IMPORTING id = file_anchor_id ). IF file_anchor_id IS NOT INITIAL. element_manager->famix_attribute->set_source_anchor_by_id( EXPORTING element_id = last_id source_anchor_id = file_anchor_id ). ENDIF. ENDIF. element_manager->famix_attribute->store_id( EXPORTING name_group = ng_abap_class class = element_comp-clsname attribute = element_comp-cmpname ). * sap_attribute->add( EXPORTING class = class-clsname * attribute = component-cmpname ). WHEN method_type OR event_type. " SAP_2_FAMIX_15 Map methods of classes to FAMIX.Method " SAP_2_FAMIX_16 Map methods of interfaces to FAMIX.Method element_manager->famix_method->add( EXPORTING name = element_comp-cmpname IMPORTING id = last_id ). " SAP_2_FAMIX_41 Fill the attribut signature of FAMIX.METHOD with the name of the method " SAP_2_FAMIX_42 Fill the attribut signature of FAMIX.METHOD with the name of the method element_manager->famix_method->set_signature( element_id = last_id signature = element_comp-cmpname ). element_manager->famix_method->set_parent_type( EXPORTING element_id = last_id parent_element = 'FAMIX.Class' parent_name_group = ng_abap_class parent_name = element_comp-clsname ). IF element_comp-adt_link IS NOT INITIAL. element_manager->famix_file_anchor->add( EXPORTING element_id = last_id " Required for Moose 6.1 file_name = element_comp-adt_link IMPORTING id = file_anchor_id ). IF file_anchor_id IS NOT INITIAL. element_manager->famix_method->set_source_anchor_by_id( EXPORTING element_id = last_id source_anchor_id = file_anchor_id ). ENDIF. ENDIF. element_manager->famix_method->store_id( EXPORTING class_name_group = ng_abap_class class = element_comp-clsname method_name_group = ng_abap_method method = element_comp-cmpname ). * sap_method->add( EXPORTING class = class-clsname * method = component-cmpname ). WHEN OTHERS. ASSERT 1 = 2. ENDCASE. ENDIF. ENDMETHOD. METHOD name. DATA: class_name TYPE string, clstype TYPE seoclstype, exists TYPE abap_bool. class_name( EXPORTING element_id = element_id IMPORTING class_name = class_name clstype = clstype exists = exists ). IF exists EQ abap_true. CASE clstype. WHEN is_class_type. element_type = |ABAPClass|. WHEN interface_type. element_type = |ABAPInterface|. WHEN OTHERS. ASSERT 1 = 2. ENDCASE. parent_name = ||. name = class_name. ELSE. DATA: cmpname TYPE string, cmptype TYPE seocmptype. comp_name( EXPORTING element_id = element_id IMPORTING class_name = class_name cmpname = cmpname cmptype = cmptype exists = exists ). ASSERT exists EQ abap_true. DATA element TYPE element_type. READ TABLE elements_class_name INTO element WITH KEY class_name = class_name. ASSERT sy-subrc EQ 0. clstype = element-clstype. CASE clstype. WHEN is_class_type. CASE cmptype. WHEN attribute_type. element_type = |ABAPClassAttribute|. WHEN method_type. element_type = |ABAPClassMethod|. WHEN event_type. element_type = |ABAPClassEvent|. WHEN OTHERS. ASSERT 1 = 2. ENDCASE. WHEN interface_type. CASE cmptype. WHEN attribute_type. element_type = |ABAPInterfaceAttribute|. WHEN method_type. element_type = |ABAPInterfaceMethod|. WHEN event_type. element_type = |ABAPInterfaceEvent|. WHEN OTHERS. ASSERT 1 = 2. ENDCASE. WHEN OTHERS. ASSERT 1 = 2. ENDCASE. parent_name = class_name. name = cmpname. ENDIF. ENDMETHOD. METHOD _add_component. DATA element_comp TYPE element_comp_type. READ TABLE elements_comp_clsname_cmpname INTO element_comp WITH KEY clsname = clsname cmpname = cmpname. IF sy-subrc EQ 0. is_added = abap_true. new_element_id = element_comp-element_id. ELSE. " Does component exists? DATA: found_class_name TYPE string, found_cmpname TYPE string, found_cmptype TYPE seocmptype, found_mtdtype TYPE seomtdtype. SELECT SINGLE clsname cmpname cmptype mtdtype FROM seocompo INTO (found_class_name, found_cmpname, found_cmptype, found_mtdtype ) WHERE clsname = clsname AND cmpname = cmpname. IF found_class_name IS NOT INITIAL. is_added = abap_true. IF found_cmptype EQ 3. " Is type RAISE EXCEPTION TYPE zcx_2mse_extr3_classes_wr_type. ENDIF. ELSE. DATA: redefined_class_components TYPE ty_class_components, redefined_class_component TYPE ty_class_component. redefined_class_components = _get_redefined( clsname ). READ TABLE redefined_class_components INTO redefined_class_component WITH KEY clsname = clsname cmpname = cmpname. IF sy-subrc EQ 0. found_class_name = redefined_class_component-clsname. found_cmpname = redefined_class_component-cmpname. found_cmptype = redefined_class_component-cmptype. found_mtdtype = redefined_class_component-mtdtype. is_added = abap_true. ENDIF. ENDIF. IF is_added EQ abap_true. new_element_id = _add_single_component_to_class( i_found_class_name = found_class_name i_found_cmpname = found_cmpname i_found_cmptype = found_cmptype i_found_mtdtype = found_mtdtype is_specific = is_specific ). is_added_now = abap_true. ENDIF. ENDIF. ENDMETHOD. METHOD _add_metarel. DATA: relation TYPE seometarel, relations TYPE STANDARD TABLE OF seometarel, element_metarel TYPE element_metarel_type, is_added TYPE abap_bool, new_element_id TYPE i. DATA access TYPE REF TO cl_extr3_access. access = cl_extr3_access=>get_instance( i_element_manager = element_manager ). DATA invocation TYPE REF TO cl_extr3_invocation. invocation = cl_extr3_invocation=>get_instance( i_element_manager = element_manager ). SELECT * FROM seometarel INTO TABLE relations WHERE clsname = clsname AND version = 1 AND state = 1. LOOP AT relations INTO relation WHERE reltype = 1 OR reltype = 2. element_metarel-element_id = new_element_id. element_metarel-refclsname = relation-refclsname. element_metarel-reltype = relation-reltype. INSERT element_metarel INTO TABLE elements_metarel_element_id. INSERT element_metarel INTO TABLE elements_metarel_refclsname. IF relation-reltype EQ 1. " Interface DATA: interface_class_components TYPE ty_class_components, interface_class_component TYPE ty_class_component, reclsname_string TYPE string. reclsname_string = relation-refclsname. me->add( EXPORTING class = reclsname_string is_specific = is_specific IMPORTING is_added = is_added new_element_id = new_element_id class_components = interface_class_components ). LOOP AT interface_class_components INTO interface_class_component. new_element_id = _add_single_component_to_class( i_found_class_name = clsname i_found_cmpname = |{ interface_class_component-clsname }~{ interface_class_component-cmpname }| i_found_cmptype = interface_class_component-cmptype i_found_mtdtype = interface_class_component-mtdtype is_specific = is_specific ). DATA interface_element_id TYPE cl_extr3_element_manager=>element_id_type . me->add_component( EXPORTING clsname = interface_class_component-clsname cmpname = interface_class_component-cmpname is_specific = is_specific IMPORTING "* is_added = new_element_id = interface_element_id ). IF interface_class_component-cmptype EQ attribute_type. " Connections between attributes are not expressible in FAMIX, or? * access->add( EXPORTING accessed_element_id1 = new_element_id * accessing_element_id2 = interface_element_id ). ELSE. IF element_manager->interface_use_structure EQ abap_true. invocation->add( EXPORTING invoced_element_id1 = interface_element_id invocing_element_id2 = new_element_id ). ELSE. invocation->add( EXPORTING invoced_element_id1 = new_element_id invocing_element_id2 = interface_element_id ). ENDIF. ENDIF. ENDLOOP. ENDIF. ENDLOOP. ENDMETHOD. METHOD _add_single_component_to_class. " Add single component to class DATA element_comp2 TYPE element_comp_type. ASSERT i_found_cmpname IS NOT INITIAL. r_new_element_id = element_manager->add_element( element = me is_specific = is_specific ). element_comp2-element_id = r_new_element_id. element_comp2-clsname = i_found_class_name. element_comp2-cmpname = i_found_cmpname. element_comp2-cmptype = i_found_cmptype. element_comp2-mtdtype = i_found_mtdtype. INSERT element_comp2 INTO TABLE elements_comp_element_id . INSERT element_comp2 INTO TABLE elements_comp_clsname_cmpname . ENDMETHOD. METHOD _get_redefined. DATA: redefined_components TYPE STANDARD TABLE OF redefined_type WITH DEFAULT KEY, redefined_component TYPE redefined_type, found TYPE abap_bool, superclass TYPE seoclsname, component TYPE cl_extr3_classes=>ty_class_component. SELECT * FROM seoredef INTO CORRESPONDING FIELDS OF TABLE redefined_components WHERE clsname = class AND version = 1. LOOP AT redefined_components INTO redefined_component. superclass = redefined_component-refclsname. found = ''. WHILE found EQ ''. CLEAR component. SELECT SINGLE clsname cmpname cmptype mtdtype FROM seocompo INTO component WHERE cmptype <> 3 " A type AND clsname = superclass AND cmpname = redefined_component-mtdname. IF sy-subrc EQ 0. found = 'X'. DATA redefined_method TYPE redefined_method_type. redefined_method-method = component-cmpname. redefined_method-clsname = class. redefined_method-defined_in_clsname = component-clsname. INSERT redefined_method INTO TABLE redefined_methods. "Allow duplicate inserting here component-clsname = class . INSERT component INTO TABLE r_result. ELSE. " Find next superclass SELECT SINGLE refclsname FROM seometarel INTO superclass WHERE clsname = superclass AND version = 1. IF sy-subrc <> 0. found = 'X'. " Nothing found ENDIF. ENDIF. ENDWHILE. ENDLOOP. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_ELEMENTS IMPLEMENTATION. METHOD COLLECT_INFOS. " Redefine me ASSERT 1 = 2. ENDMETHOD. METHOD make_model. " Redefine me ASSERT 1 = 2. ENDMETHOD. METHOD NAME. " Redefine me ASSERT 1 = 2. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_PACKAGES IMPLEMENTATION. METHOD add. DATA element TYPE element_type. READ TABLE elements_devclass INTO element WITH KEY devclass = package. IF sy-subrc EQ 0. is_added = abap_true. new_element_id = element-element_id. ELSE. DATA exists TYPE abap_bool. exists = _does_package_exists( package ). IF exists EQ abap_true. is_added = abap_true. new_element_id = element_manager->add_element( element = me is_specific = abap_false ). element-element_id = new_element_id. element-devclass = package. INSERT element INTO TABLE elements_element_id. INSERT element INTO TABLE elements_devclass. ENDIF. ENDIF. ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD collect_infos. ENDMETHOD. METHOD devclass. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = i_element_id. ASSERT sy-subrc EQ 0. r_result = element-devclass. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = i_element_manager. ENDIF. instance->type = package_type. r_instance = instance. ENDMETHOD. METHOD make_model. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. ASSERT sy-subrc EQ 0. element_manager->famix_package->add( name = element-devclass name_group = ng_abap_package ). ENDMETHOD. METHOD name. DATA devclass TYPE devclass. devclass = devclass( i_element_id = element_id ). element_type = |ABAPPackage|. parent_name = ||. name = devclass. ENDMETHOD. METHOD _does_package_exists. " SAP_2_FAMIX_66 " Local packages start with a $ and have no entry in table TADIR. So report them always as existing IF i_package+0(1) EQ '$'. exists = abap_true. RETURN. ENDIF. " Does package exists? DATA found_obj_name TYPE sobj_name. SELECT SINGLE obj_name FROM tadir INTO found_obj_name WHERE pgmid = 'R3TR' AND object = 'DEVC' AND obj_name = i_package. IF sy-subrc EQ 0. exists = abap_true. ENDIF. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_PROGRAMS IMPLEMENTATION. METHOD add. DATA element TYPE element_type. READ TABLE elements_program INTO element WITH KEY program = program. IF sy-subrc EQ 0. is_added = abap_true. new_element_id = element-element_id. ELSE. " Does the program exist? DATA found_program TYPE progname. DATA found_subc TYPE subc. " No blank between ( and found... to be 7.02 compatible SELECT SINGLE name subc FROM progdir INTO (found_program, found_subc ) WHERE name = program. IF found_program IS NOT INITIAL. is_added = abap_true. ENDIF. IF is_added EQ abap_true. new_element_id = element_manager->add_element( element = me is_specific = abap_true ). element-element_id = new_element_id. element-program = found_program. _convert_program_2_ext_name( EXPORTING i_element_program = found_program IMPORTING program_type = element-program_type program_attribute_1 = element-program_attribute_1 program_attribute_2 = element-program_attribute_2 r_result = element-external_program_name ). element-subc = found_subc. INSERT element INTO TABLE elements_element_id. INSERT element INTO TABLE elements_program. ENDIF. ENDIF. ENDMETHOD. METHOD add_function. DATA: program_found TYPE progname, tf TYPE tfdir. " TBD find a better solution for this SELECT SINGLE * FROM tfdir INTO tf WHERE funcname = function . IF tf IS NOT INITIAL. "TBD handle error ENDIF. program_found = tf-pname. SHIFT program_found LEFT BY 3 PLACES. program_found = program_found && |U| && tf-include. add( EXPORTING program = program_found IMPORTING is_added = is_added new_element_id = new_element_id ). ENDMETHOD. METHOD add_function_group. DATA pname TYPE pname. TYPES: BEGIN OF ty_function_group, include TYPE includenr, END OF ty_function_group. DATA: fg TYPE ty_function_group, fgs TYPE STANDARD TABLE OF ty_function_group WITH DEFAULT KEY. pname = |SAPL| && fgr. SELECT include FROM tfdir INTO TABLE fgs WHERE pname = pname. LOOP AT fgs INTO fg. DATA progname TYPE progname. progname = |L| && fgr && |U| && fg-include. DATA is_found TYPE abap_bool. DATA: fg_new_element_id TYPE cl_extr3_element_manager=>element_id_type. add( EXPORTING program = progname IMPORTING is_added = is_found new_element_id = fg_new_element_id ). ENDLOOP. ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD collect_infos. FIELD-SYMBOLS: <p> TYPE element_type, <e> TYPE element_type. LOOP AT elements_program ASSIGNING <p>. IF <p>-program_type EQ type_program. TRANSLATE <p>-program_attribute_1 TO LOWER CASE. CONCATENATE 'adt://' sysid '/sap/bc/adt/programs/programs/' <p>-program_attribute_1 INTO <p>-adt_or_bwmt_link. ENDIF. IF <p>-program_type EQ type_function. TRANSLATE <p>-program_attribute_1 TO LOWER CASE. TRANSLATE <p>-program_attribute_2 TO LOWER CASE. CONCATENATE 'adt://' sysid '/sap/bc/adt/functions/groups/' <p>-program_attribute_1 '/fmodules/' <p>-program_attribute_2 INTO <p>-adt_or_bwmt_link. ENDIF. IF <p>-program_type EQ type_function_include. TRANSLATE <p>-program_attribute_1 TO LOWER CASE. TRANSLATE <p>-program_attribute_2 TO LOWER CASE. CONCATENATE 'adt://' sysid '/sap/bc/adt/functions/groups/' <p>-program_attribute_1 '/includes/' <p>-program_attribute_2 INTO <p>-adt_or_bwmt_link. ENDIF. IF <p>-program_type EQ type_bw_transformation. CONCATENATE 'bwmt://' sysid '/sap/bw/modeling/trfn/' <p>-program_attribute_1 INTO <p>-adt_or_bwmt_link. ENDIF. IF <p>-adt_or_bwmt_link IS NOT INITIAL. READ TABLE elements_element_id ASSIGNING <e> WITH TABLE KEY element_id = <p>-element_id. ASSERT sy-subrc EQ 0. <e>-adt_or_bwmt_link = <p>-adt_or_bwmt_link. ENDIF. ENDLOOP. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = i_element_manager. ENDIF. instance->type = program_type. r_instance = instance. ENDMETHOD. METHOD make_model. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. ASSERT sy-subrc EQ 0. DATA: last_id TYPE i, file_anchor_id TYPE i, name_group TYPE string, modifier TYPE string, name_of_mapped_class TYPE string. * famix_package->add( name = table-devclass ). IF element-program_type EQ type_program. name_group = 'ABAP_PROGRAM'. modifier = cl_extract3=>modifier_program. name_of_mapped_class = element-external_program_name. ELSEIF element-program_type EQ type_bw_transformation. name_group = 'BW_TRANSFORMATION'. modifier = cl_extract3=>modifier_bw_transformation. name_of_mapped_class = element-external_program_name. ELSEIF element-program_type EQ type_function OR element-program_type = type_function_include. name_group = 'ABAP_FUNCTIONGROUP'. modifier = cl_extract3=>modifier_function_group. * name_of_mapped_class = element-external_program_name. name_of_mapped_class = _get_names_for_function_groups( element ). * " Get parent package for function group * DATA devclass TYPE tadir-devclass. * SELECT SINGLE devclass FROM tadir INTO devclass WHERE pgmid = 'R3TR' AND object = 'FUGR' AND obj_name = element-program_attribute_1. ELSE. name_group = 'UNKNOWN'. modifier = cl_extract3=>modifier_unknown. name_of_mapped_class = element-external_program_name. ENDIF. " SAP_2_FAMIX_54 Map database tables to FAMIX Class " SAP_2_FAMIX_58 Mark the FAMIX Class with the attribute modifiers = 'DBTable' element_manager->famix_class->add( EXPORTING name_group = name_group name = name_of_mapped_class modifiers = modifier IMPORTING id = last_id ). DATA association TYPE cl_extr3_element_manager=>association_type. * DATA: package_set TYPE abap_bool. LOOP AT associations INTO association WHERE element_id1 = element_id AND association->type = cl_extr3_association=>parent_package_ass. DATA package TYPE REF TO cl_extr3_packages. package ?= element_manager->get_element( i_element_id = association-element_id2 ). element_manager->famix_class->set_parent_package( EXPORTING element_id = last_id parent_package = package->devclass( i_element_id = association-element_id2 ) parent_package_name_group = ng_abap_package ). * package_set = abap_true. ENDLOOP. * IF package_set EQ abap_false. * * DATA packages_elements TYPE REF TO cl_extr3_packages. * * packages_elements = cl_extr3_packages=>get_instance( i_element_manager = element_manager ). * * packages_elements->add( EXPORTING package = devclass ). * * element_manager->famix_class->set_parent_package( EXPORTING element_id = last_id * parent_package = devclass * parent_package_name_group = ng_abap_package ). * ENDIF. DATA dummy_method_id TYPE i. element_manager->famix_method->add( EXPORTING name = element-external_program_name IMPORTING id = dummy_method_id ). element_manager->famix_method->set_signature( element_id = dummy_method_id signature = element-external_program_name ). element_manager->famix_method->set_parent_type( EXPORTING element_id = dummy_method_id parent_element = 'FAMIX.Class' parent_name_group = name_group parent_name = name_of_mapped_class ). element_manager->famix_method->store_id( EXPORTING class_name_group = ng_abap_program class = name_of_mapped_class method_name_group = ng_abap_program method = element-external_program_name ). IF element-adt_or_bwmt_link IS NOT INITIAL. element_manager->famix_file_anchor->add( EXPORTING element_id = dummy_method_id " Required for Moose 6.1 file_name = element-adt_or_bwmt_link IMPORTING id = file_anchor_id ). IF file_anchor_id IS NOT INITIAL. element_manager->famix_method->set_source_anchor_by_id( EXPORTING element_id = dummy_method_id source_anchor_id = file_anchor_id ). ENDIF. ENDIF. ENDMETHOD. METHOD name. element_type = |ABAPProgramOrFunctionOrSAPBW|. program_name( EXPORTING i_element_id = element_id IMPORTING external_program_name_method = name ). parent_name = ||. ENDMETHOD. METHOD program_name. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = i_element_id. ASSERT sy-subrc EQ 0. program_type = element-program_type. program_attribute_1 = element-program_attribute_1. program_attribute_2 = element-program_attribute_2. program = element-program. IF element-program_type EQ type_function OR element-program_type = type_function_include. external_program_name_class = _get_names_for_function_groups( i_element = element ). ELSE. external_program_name_class = element-external_program_name. ENDIF. external_program_name_method = element-external_program_name. subc = element-subc. ENDMETHOD. METHOD _convert_program_2_ext_name. CLEAR program_type. CLEAR program_attribute_1. DATA: tranid TYPE rstranid, function_group TYPE rs38l_area, function TYPE rs38l_fnam, function_include TYPE string, is_tested TYPE abap_bool. CLEAR program_type. CLEAR program_attribute_1. CLEAR program_attribute_2. IF i_element_program+0(3) EQ |ZGP|. " Do check only when potentially needed to improve performance is_tested = cl_extract3=>check_if_tested( ). ENDIF. IF i_element_program+0(1) EQ |L|. _extract_function_name( EXPORTING i_element_program = i_element_program IMPORTING function_group = function_group function = function function_include = function_include r_result = r_result ). IF function IS NOT INITIAL. program_type = type_function. program_attribute_1 = function_group. program_attribute_2 = function. ELSEIF function_include IS NOT INITIAL. program_type = type_function_include. program_attribute_1 = function_group. program_attribute_2 = function_include. ENDIF. ELSEIF i_element_program+0(3) EQ |ZGP|. "Only on test system, currently no SAP BW working there ##TODO " Find better way to determine Unit Test _extract_sap_bw_logic( EXPORTING i_element_program = i_element_program IMPORTING tranid = tranid r_result = r_result ). program_type = type_bw_transformation. program_attribute_1 = tranid. ELSEIF i_element_program+0(2) EQ |GP|. _extract_sap_bw_logic( EXPORTING i_element_program = i_element_program IMPORTING tranid = tranid r_result = r_result ). program_type = type_bw_transformation. program_attribute_1 = tranid. ELSE. r_result = i_element_program. program_type = type_program. program_attribute_1 = i_element_program. ENDIF. ENDMETHOD. METHOD _extract_function_name. " Extract function name DATA: length TYPE i, postfix_position TYPE i, include_type_position TYPE i, function_group_length TYPE i, include_type TYPE string, include TYPE includenr, temp TYPE string, pname TYPE pname, funcname TYPE rs38l_fnam. CLEAR function. CLEAR function_group. CLEAR function_include. length = strlen( i_element_program ). IF length < 5. r_result = i_element_program. ELSE. postfix_position = length - 2. include_type_position = length - 3. function_group_length = length - 4. include = i_element_program+postfix_position(2). include_type = i_element_program+include_type_position(1). temp = i_element_program+0(include_type_position). IF include_type EQ |F| OR include_type EQ |U|. function_group = temp+1(function_group_length). ENDIF. IF include_type EQ |F|. r_result = i_element_program. function_include = i_element_program. ELSEIF include_type EQ |U|. postfix_position = length - 3. CONCATENATE 'SAP' temp INTO pname. SELECT SINGLE funcname FROM tfdir INTO funcname WHERE pname = pname AND include = include. IF sy-subrc <> 0. r_result = i_element_program. ELSE. r_result = |F-| && funcname. function = funcname. ENDIF. ELSE. r_result = i_element_program. ENDIF. ENDIF. ENDMETHOD. METHOD _extract_sap_bw_logic. " Extract SAP BW logic DATA: element_program TYPE progname, transformation_progr_id TYPE rstran_progid, length TYPE i, id_length TYPE i, transformation TYPE rstran, is_tested TYPE abap_bool. CLEAR tranid. element_program = i_element_program. IF element_program+0(3) = 'ZGP'. IF element_program = 'ZGP003N8S45LS1FG375G2BN69Q4G'. is_tested = cl_extract3=>check_if_tested( ). IF is_tested = 'X'. SHIFT element_program LEFT BY 1 PLACES. ENDIF. ENDIF. ENDIF. length = strlen( i_element_program ). id_length = length - 2. transformation_progr_id = i_element_program+2(id_length). IF element_program = 'GP003N8S45LS1FG375G2BN69Q4G' AND is_tested = 'X'. CLEAR transformation. transformation-tranid = |123|. transformation-sourcetype = |ODSO|. transformation-sourcename = |Z2MSET001|. transformation-targettype = |CUBE|. transformation-targetname = |Z2MSET002|. ELSE. SELECT SINGLE * FROM rstran INTO transformation WHERE objvers = 'A' AND tranprog = transformation_progr_id. ENDIF. IF sy-subrc <> 0. r_result = i_element_program. ELSE. r_result = |BW-| && transformation-sourcetype && |-| && transformation-sourcename && |-| && transformation-targettype && |-| && transformation-targetname. " In case of InfoSources there are multiple blanks in the field SOURCENAME " Remove all but a single blank CONDENSE r_result. tranid = transformation-tranid. ENDIF. ENDMETHOD. METHOD _get_names_for_function_groups. CONCATENATE 'FGR-' i_element-program_attribute_1 INTO name_of_mapped_class. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_TABLES IMPLEMENTATION. METHOD add. DATA element TYPE element_type. READ TABLE elements_tabname INTO element WITH KEY tabname = table. IF sy-subrc EQ 0. is_added = abap_true. new_element_id = element-element_id. ELSE. " Does table exists? DATA found_tabname TYPE tabname. DATA found_tabclass TYPE tabclass. " No blank between ( and found... to be 7.02 compatible SELECT tabname tabclass FROM dd02l INTO (found_tabname, found_tabclass ) WHERE tabname = table. ENDSELECT. IF found_tabname IS NOT INITIAL AND found_tabclass <> 'INTTAB' " Not structures AND found_tabclass <> 'APPEND'. " Not append structures is_added = abap_true. ENDIF. IF is_added EQ abap_true. new_element_id = element_manager->add_element( element = me is_specific = abap_true ). element-element_id = new_element_id. element-tabname = table. INSERT element INTO TABLE elements_element_id. INSERT element INTO TABLE elements_tabname. ENDIF. ENDIF. ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD collect_infos. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = i_element_manager. ENDIF. instance->type = table_type. r_instance = instance. ENDMETHOD. METHOD make_model. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. ASSERT sy-subrc EQ 0. DATA last_id TYPE i. * famix_package->add( name = table-devclass ). " SAP_2_FAMIX_54 Map database tables to FAMIX Class " SAP_2_FAMIX_58 Mark the FAMIX Class with the attribute modifiers = 'DBTable' element_manager->famix_class->add( EXPORTING name_group = 'ABAP_TABLE' name = element-tabname modifiers = cl_extract3=>modifier_dbtable IMPORTING id = last_id ). DATA association TYPE cl_extr3_element_manager=>association_type. LOOP AT associations INTO association WHERE element_id1 = element_id AND association->type = cl_extr3_association=>parent_package_ass. DATA package TYPE REF TO cl_extr3_packages. package ?= element_manager->get_element( i_element_id = association-element_id2 ). element_manager->famix_class->set_parent_package( EXPORTING element_id = last_id parent_package = package->devclass( i_element_id = association-element_id2 ) parent_package_name_group = ng_abap_package ). ENDLOOP. DATA dummy_attribute_id TYPE i. " SAP_2_FAMIX_56 Add a dummy attribute with the name of the table element_manager->famix_attribute->add( EXPORTING name = element-tabname IMPORTING id = dummy_attribute_id ). element_manager->famix_attribute->set_parent_type( EXPORTING element_id = dummy_attribute_id parent_id = last_id ). element_manager->famix_attribute->store_id( EXPORTING name_group = ng_sap_table class = element-tabname attribute = element-tabname ). * DATA element TYPE element_type. * * READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. * ASSERT sy-subrc EQ 0. * * element_manager->famix_package->add( name = element-devclass ). ENDMETHOD. METHOD name. DATA: table TYPE tabname. table = table_name( i_element_id = element_id ). element_type = |ABAPDatabaseTable|. parent_name = ||. name = table. ENDMETHOD. METHOD table_name. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = i_element_id. ASSERT sy-subrc EQ 0. r_result = element-tabname. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_WEB_DYNPRO_COMP IMPLEMENTATION. METHOD add. " WDY_COMPONENT " WDY_CONTROLLER DATA element TYPE element_type. READ TABLE elements_wdy_component_name INTO element WITH KEY wdy_component_name = wdy_component_name . IF sy-subrc EQ 0. is_added = abap_true. new_element_id = element-element_id. ELSE. " Does Web Dynpro Component exists? DATA: found_wdy_component_name TYPE wdy_component_name. SELECT SINGLE component_name FROM wdy_component INTO found_wdy_component_name WHERE component_name = wdy_component_name AND version = 'A'. IF found_wdy_component_name IS NOT INITIAL. is_added = abap_true. ENDIF. IF is_added EQ abap_true. new_element_id = element_manager->add_element( element = me is_specific = abap_false ). element-element_id = new_element_id. element-wdy_component_name = found_wdy_component_name. INSERT element INTO TABLE elements_element_id. INSERT element INTO TABLE elements_wdy_component_name. ENDIF. TYPES: BEGIN OF ty_class_component, component_name TYPE wdy_component_name, controller_name TYPE wdy_controller_name, END OF ty_class_component. TYPES ty_class_components TYPE STANDARD TABLE OF ty_class_component WITH KEY component_name controller_name. DATA: class_components TYPE ty_class_components, class_component TYPE ty_class_component. SELECT component_name controller_name FROM wdy_controller INTO CORRESPONDING FIELDS OF TABLE class_components WHERE component_name = wdy_component_name AND version = 'A'. LOOP AT class_components INTO class_component. _add_component( EXPORTING wdy_component_name = class_component-component_name wdy_controller_name = class_component-controller_name ). ENDLOOP. ENDIF. ENDMETHOD. METHOD add_component. add( EXPORTING wdy_component_name = wdy_component_name IMPORTING is_added = is_added ). IF is_added EQ abap_true. _add_component( EXPORTING wdy_component_name = wdy_component_name wdy_controller_name = wdy_controller_name IMPORTING is_added = is_added new_element_id = new_element_id ). element_manager->model_builder->new_element_id( EXPORTING i_element_id = new_element_id i_is_specific = abap_true ). ENDIF. ENDMETHOD. METHOD clear. CLEAR instance. ENDMETHOD. METHOD collect_infos. ENDMETHOD. METHOD get_instance. IF instance IS NOT BOUND. CREATE OBJECT instance EXPORTING i_element_manager = element_manager. ENDIF. instance->type = web_dynpro_comps_type. r_instance = instance. ENDMETHOD. METHOD make_model. DATA: element TYPE element_type, element_component TYPE element_comp_type. DATA class_id TYPE i. DATA method_id TYPE i. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. IF sy-subrc EQ 0. element_manager->famix_class->add( EXPORTING name_group = 'WEB_DYNPRO' name = element-wdy_component_name modifiers = 'ABAPWebDynproComponent' IMPORTING id = class_id ). DATA association TYPE cl_extr3_element_manager=>association_type. LOOP AT associations INTO association WHERE element_id1 = element_id AND association->type = cl_extr3_association=>parent_package_ass. DATA package TYPE REF TO cl_extr3_packages. package ?= element_manager->get_element( i_element_id = association-element_id2 ). element_manager->famix_class->set_parent_package( element_id = class_id parent_package = package->devclass( i_element_id = association-element_id2 ) parent_package_name_group = ng_abap_package ). ENDLOOP. LOOP AT elements_comp_comp_contr_name INTO element_component WHERE wdy_component_name = element-wdy_component_name. element_manager->famix_method->add( EXPORTING name = element_component-wdy_controller_name IMPORTING id = method_id ). element_manager->famix_method->set_signature( element_id = method_id signature = element_component-wdy_controller_name ). element_manager->famix_method->set_parent_type( EXPORTING element_id = method_id parent_element = 'FAMIX.Class' parent_id = class_id ). "! TBD Really required, this appears to be not exact, no namegroup, ... element_manager->famix_method->store_id( EXPORTING class_name_group = ng_abap_webdynpro class = element-wdy_component_name method_name_group = ng_abap_webdynpro method = element_component-wdy_controller_name ). ENDLOOP. ENDIF. ENDMETHOD. METHOD name. DATA: wdy_component_name TYPE wdy_component_name. wdy_component_name( EXPORTING element_id = element_id IMPORTING wdy_component_name = wdy_component_name ). IF wdy_component_name IS NOT INITIAL. element_type = |WebDynproComponent|. parent_name = ||. name = wdy_component_name. ELSE. DATA: wdy_controller_name TYPE wdy_controller_name. wdy_controller_name( EXPORTING element_id = element_id IMPORTING wdy_component_name = wdy_component_name wdy_controller_name = wdy_controller_name ). ASSERT wdy_controller_name IS NOT INITIAL. element_type = |WebDynproController|. parent_name = wdy_component_name. name = wdy_controller_name. ENDIF. ENDMETHOD. METHOD wdy_component_name. DATA element TYPE element_type. READ TABLE elements_element_id INTO element WITH TABLE KEY element_id = element_id. IF sy-subrc EQ 0. wdy_component_name = element-wdy_component_name. ENDIF. ENDMETHOD. METHOD wdy_controller_name. DATA element_comp TYPE element_comp_type. READ TABLE elements_comp_element_id INTO element_comp WITH KEY element_id = element_id. IF sy-subrc EQ 0. wdy_component_name = element_comp-wdy_component_name. wdy_controller_name = element_comp-wdy_controller_name. ENDIF. ENDMETHOD. METHOD _add_component. DATA element_comp TYPE element_comp_type. READ TABLE elements_comp_comp_contr_name INTO element_comp WITH KEY wdy_component_name = wdy_component_name wdy_controller_name = wdy_controller_name . IF sy-subrc EQ 0. is_added = abap_true. new_element_id = element_comp-element_id. ELSE. " Does component exists? DATA: found_component_name TYPE wdy_component_name, found_controller_name TYPE seocmpname. SELECT SINGLE component_name controller_name FROM wdy_controller " No blank between ( and found to be 7.02 compatible INTO (found_component_name, found_controller_name ) WHERE component_name = wdy_component_name AND controller_name = wdy_controller_name AND version = 'A'. IF found_component_name IS NOT INITIAL. is_added = abap_true. ENDIF. IF is_added EQ abap_true. new_element_id = element_manager->add_element( element = me is_specific = abap_false ). element_comp-element_id = new_element_id. element_comp-wdy_component_name = found_component_name. element_comp-wdy_controller_name = found_controller_name. INSERT element_comp INTO TABLE elements_comp_element_id . INSERT element_comp INTO TABLE elements_comp_comp_contr_name . ENDIF. ENDIF. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3 IMPLEMENTATION. METHOD clear_all. cl_extr3_access=>clear( ). cl_extr3_invocation=>clear( ). cl_extr3_parent_package=>clear( ). cl_extr3_classes=>clear( ). cl_extr3_packages=>clear( ). cl_extr3_programs=>clear( ). cl_extr3_tables=>clear( ). cl_extr3_web_dynpro_comp=>clear( ). ENDMETHOD. METHOD constructor. element_manager = i_element_manager. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_ELEMENT_MANAGER IMPLEMENTATION. METHOD add_association. DATA line TYPE association_type. line-element_id1 = element_1. line-element_id2 = element_2. line-ass_type = association->type. line-association = association. INSERT line INTO TABLE associations1. INSERT line INTO TABLE associations2. ENDMETHOD. METHOD add_element. DATA element_line TYPE element_type. element_line-element_id = next_element_id. element_id = next_element_id. element_line-element = element. INSERT element_line INTO TABLE elements. model_builder->new_element_id( i_element_id = element_id i_is_specific = is_specific ). ADD 1 TO next_element_id. ENDMETHOD. METHOD collect_infos. DATA: element TYPE element_type. LOOP AT elements INTO element. IF element-element->infos_are_collected EQ abap_false. element-element->collect_infos( sysid ). element-element->infos_are_collected = abap_true. ENDIF. ENDLOOP. ENDMETHOD. METHOD constructor. model_builder = i_model_builder. exclude_found_sap_intf = i_exclude_found_sap_intf. interface_use_structure = i_interface_use_structure. next_element_id = 1. CREATE OBJECT model. DATA f_custom_source_language TYPE REF TO cl_famix_custom_source_lng. CREATE OBJECT f_custom_source_language EXPORTING model = model. f_custom_source_language->add( name = 'SAP' name_group = cl_extr3=>ng_source_language ). CREATE OBJECT famix_package EXPORTING model = model. CREATE OBJECT famix_class EXPORTING model = model. CREATE OBJECT famix_method EXPORTING model = model. CREATE OBJECT famix_attribute EXPORTING model = model. CREATE OBJECT famix_invocation EXPORTING model = model. CREATE OBJECT famix_access EXPORTING model = model. CREATE OBJECT famix_file_anchor EXPORTING model = model. ENDMETHOD. METHOD get_associations. DATA association TYPE association_type. LOOP AT associations1 INTO association WHERE element_id1 = i_element_id. INSERT association INTO TABLE associations. ENDLOOP. LOOP AT associations2 INTO association WHERE element_id2 = i_element_id. INSERT association INTO TABLE associations. ENDLOOP. SORT associations. DELETE ADJACENT DUPLICATES FROM associations. ENDMETHOD. METHOD get_element. DATA element TYPE element_type. READ TABLE elements INTO element WITH TABLE KEY element_id = i_element_id. ASSERT sy-subrc EQ 0. r_result = element-element. ENDMETHOD. METHOD make_model. DATA: element TYPE element_type, associations TYPE associations_type, association TYPE association_type, step TYPE i. DO 2 TIMES. step = sy-index. LOOP AT elements INTO element. " Add packages first to the Moose model. This simplifies building the model, as many elements have parent IF step EQ 1. IF element-element->type <> element-element->package_type. CONTINUE. ENDIF. ELSEIF element-element->type EQ element-element->package_type. CONTINUE. ENDIF. associations = get_associations( i_element_id = element-element_id ). element-element->make_model( element_id = element-element_id associations = associations ). ENDLOOP. ENDDO. DATA: access TYPE REF TO cl_extr3_access, invocation TYPE REF TO cl_extr3_invocation, association_instance TYPE REF TO cl_extr3_association. access = cl_extr3_access=>get_instance( i_element_manager = me ). invocation = cl_extr3_invocation=>get_instance( i_element_manager = me ). LOOP AT associations1 INTO association. CLEAR association_instance. IF association-association->type EQ association-association->access_ass. association_instance = access. ELSEIF association-association->type EQ association-association->invocation_ass. association_instance = invocation. ENDIF. IF association_instance IS BOUND. association_instance->make_model( association = association ). ENDIF. ENDLOOP. model->make_mse( IMPORTING mse_model = r_result ). ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_INITIAL_ELEMENTS IMPLEMENTATION. METHOD constructor. IF tdevc_test IS SUPPLIED. g_tdevc_test = tdevc_test. g_is_test = abap_true. ENDIF. ENDMETHOD. METHOD get_selected. r_packages = g_selected_packages. ENDMETHOD. METHOD select_packages. DATA: package TYPE ty_package, packages TYPE ty_packages. DATA: package_store TYPE ty_package_store, packages_store TYPE ty_packages_store. FIELD-SYMBOLS <packages_store> TYPE ty_package_store. CLEAR g_selected_packages. packages = _select_top_packages( top_packages ). LOOP AT packages INTO package. CLEAR package_store. package_store-package = package-package. package_store-is_to_be_returned = abap_true. INSERT package_store INTO TABLE packages_store. ENDLOOP. IF including_sub_packages EQ abap_true. DATA: packages_to_search_sub TYPE HASHED TABLE OF ty_package WITH UNIQUE KEY package, something_to_search TYPE abap_bool. something_to_search = abap_true. WHILE something_to_search EQ abap_true. CLEAR packages_to_search_sub. LOOP AT packages_store ASSIGNING <packages_store> WHERE subclass_searched EQ abap_false. <packages_store>-subclass_searched = abap_true. package-package = <packages_store>-package. INSERT package INTO TABLE packages_to_search_sub. ENDLOOP. IF packages_to_search_sub IS NOT INITIAL. packages = _select_sub_packages( i_packages_to_search_sub = packages_to_search_sub ). LOOP AT packages INTO package. CLEAR package_store. package_store-package = package-package. package_store-parentpackage = package-parentpackage. IF package-package IN sub_packages_filter. package_store-is_to_be_returned = abap_true. ENDIF. INSERT package_store INTO TABLE packages_store. ENDLOOP. ELSE. something_to_search = abap_false. ENDIF. ENDWHILE. ENDIF. LOOP AT packages_store INTO package_store WHERE is_to_be_returned = abap_true. package-package = package_store-package. package-parentpackage = package_store-parentpackage. INSERT package INTO TABLE g_selected_packages. ENDLOOP. ENDMETHOD. METHOD select_specific. DATA new_element_id TYPE i. model_builder->initial_selection_started( ). model_builder->usage_of_single_element( ). CASE i_element_type_filter. WHEN cl_extr3_initial_elements=>select_class_method. IF i_parent_name_filter IS INITIAL. new_element_id = _select_class( name_filter = i_name_filter element_manager = element_manager ). ELSE. new_element_id = _select_class_method( name_filter = i_name_filter parent_name_filter = i_parent_name_filter element_manager = element_manager ). ENDIF. WHEN cl_extr3_initial_elements=>select_table. new_element_id = _select_table( name_filter = i_name_filter element_manager = element_manager ). WHEN cl_extr3_initial_elements=>select_program. new_element_id = _select_program( element_manager = element_manager name_filter = i_name_filter ). WHEN cl_extr3_initial_elements=>select_function. new_element_id = _select_function( element_manager = element_manager name_filter = i_name_filter ). WHEN OTHERS. ASSERT 1 = 2. ENDCASE. model_builder->new_element_id( EXPORTING i_element_id = new_element_id i_is_specific = abap_true ). ENDMETHOD. METHOD _select_class. DATA: classes TYPE REF TO cl_extr3_classes, class_components TYPE cl_extr3_classes=>ty_class_components, cc TYPE cl_extr3_classes=>ty_class_component. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). classes->add( EXPORTING class = name_filter is_specific = abap_true IMPORTING new_element_id = new_element_id class_components = class_components ). LOOP AT class_components INTO cc. classes->add_component( EXPORTING clsname = cc-clsname cmpname = cc-cmpname is_specific = abap_true ). ENDLOOP. ENDMETHOD. METHOD _select_class_method. " Select class method DATA classes TYPE REF TO cl_extr3_classes. classes = cl_extr3_classes=>get_instance( element_manager = element_manager ). classes->add_component( EXPORTING clsname = parent_name_filter cmpname = name_filter is_specific = abap_false IMPORTING new_element_id = new_element_id ). ENDMETHOD. METHOD _select_function. " Select function DATA programs2 TYPE REF TO cl_extr3_programs. programs2 = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). programs2->add_function( EXPORTING function = name_filter IMPORTING new_element_id = new_element_id ). ENDMETHOD. METHOD _select_program. " Select program DATA programname TYPE program. programname = name_filter. DATA programs TYPE REF TO cl_extr3_programs. programs = cl_extr3_programs=>get_instance( i_element_manager = element_manager ). programs->add( EXPORTING program = programname IMPORTING new_element_id = new_element_id ). ENDMETHOD. METHOD _select_sub_packages. CLEAR r_packages. IF g_is_test EQ abap_false. SELECT devclass AS package parentcl AS parentpackage FROM tdevc INTO TABLE r_packages FOR ALL ENTRIES IN i_packages_to_search_sub WHERE parentcl = i_packages_to_search_sub-package. ELSE. DATA: package TYPE ty_package, package_test TYPE ty_tdevc_test. LOOP AT g_tdevc_test INTO package_test. READ TABLE i_packages_to_search_sub TRANSPORTING NO FIELDS WITH TABLE KEY package = package_test-parentcl. IF sy-subrc EQ 0. package-package = package_test-devclass. package-parentpackage = package_test-parentcl. INSERT package INTO TABLE r_packages. ENDIF. ENDLOOP. ENDIF. ENDMETHOD. METHOD _select_table. " Select table DATA tables TYPE REF TO cl_extr3_tables. tables = cl_extr3_tables=>get_instance( i_element_manager = element_manager ). tables->add( EXPORTING table = name_filter IMPORTING new_element_id = new_element_id ). ENDMETHOD. METHOD _select_top_packages. CLEAR r_packages. IF g_is_test EQ abap_false. SELECT devclass AS package parentcl AS parentpackage FROM tdevc INTO TABLE r_packages WHERE devclass IN i_top_packages ORDER BY devclass. ELSE. DATA package TYPE ty_package. LOOP AT g_tdevc_test INTO package WHERE devclass IN i_top_packages. INSERT package INTO TABLE r_packages. ENDLOOP. SORT r_packages BY package. ENDIF. ENDMETHOD. ENDCLASS. CLASS CL_EXTR3_MODEL_BUILDER IMPLEMENTATION. METHOD initialize. element_manager = i_element_manager. DATA association_builder_init TYPE builder_type. CREATE OBJECT tadir_builder EXPORTING i_element_manager = i_element_manager. association_builder_init-association_builder = tadir_builder. INSERT association_builder_init INTO TABLE association_builders_init. DATA association_builder_post TYPE builder_type. CREATE OBJECT tadir_builder EXPORTING i_element_manager = i_element_manager. association_builder_post-association_builder = tadir_builder. INSERT association_builder_post INTO TABLE association_builders_post. DATA association_builder TYPE builder_type. CREATE OBJECT where_used_builder EXPORTING i_element_manager = i_element_manager. where_used_builder->set_dynamic_read( i_dynamic_read = i_dynamic_read ). association_builder-association_builder = where_used_builder. INSERT association_builder INTO TABLE association_builders. ENDMETHOD. METHOD initial_selection_started. is_initial_selection = abap_true. ENDMETHOD. METHOD new_element_id. DATA: found_in_level TYPE found_in_level_type, is_new_line TYPE abap_bool. FIELD-SYMBOLS <found_in_level> TYPE found_in_level_type. ASSERT i_element_id IS NOT INITIAL. READ TABLE found_in_levels ASSIGNING <found_in_level> WITH TABLE KEY element_id = i_element_id. IF sy-subrc <> 0. is_new_line = abap_true. ASSIGN found_in_level TO <found_in_level>. <found_in_level>-element_id = i_element_id. ENDIF. IF is_initial_selection EQ abap_true. <found_in_level>-found_in_initial_selection = abap_true. IF i_is_specific EQ abap_true. <found_in_level>-specific = abap_true. ENDIF. ELSEIF is_up_search EQ abap_true. IF <found_in_level>-found_in_level_upsearch IS INITIAL. IF <found_in_level>-found_in_initial_selection EQ 'X' AND <found_in_level>-specific EQ 'X'. " Do overwrite elements which are initially found and specific with a different level. " This would cause errors in down search. ELSE. <found_in_level>-found_in_level_upsearch = level_for_found_in_upsearch. ENDIF. ENDIF. IF i_is_specific EQ abap_true AND <found_in_level>-specific EQ abap_false. IF <found_in_level>-found_in_initial_selection EQ 'X' AND <found_in_level>-specific EQ 'X'. " Do overwrite elements which are initially found and specific with a different level. " This would cause errors in down search. ELSE. <found_in_level>-found_in_level_upsearch = level_for_found_in_upsearch. <found_in_level>-specific = abap_true. ENDIF. ENDIF. ELSEIF is_down_search EQ abap_true. IF <found_in_level>-found_in_level_downsearch IS INITIAL. IF <found_in_level>-found_in_initial_selection EQ 'X' AND <found_in_level>-specific EQ 'X'. " Do overwrite elements which are initially found and specific with a different level. " This would not be correct ELSE. <found_in_level>-found_in_level_downsearch = level_for_found_in_downsearch. ENDIF. ENDIF. IF i_is_specific EQ abap_true AND <found_in_level>-specific EQ abap_false. IF <found_in_level>-found_in_initial_selection EQ 'X' AND <found_in_level>-specific EQ 'X'. " Do overwrite elements which are initially found and specific with a different level. " This would not be correct ELSE. <found_in_level>-found_in_level_downsearch = level_for_found_in_downsearch. <found_in_level>-specific = abap_true. ENDIF. ENDIF. ELSEIF is_post_selection EQ abap_true. <found_in_level>-found_in_post_selection = abap_true. ELSE. ASSERT 1 = 2. ENDIF. IF is_new_line EQ abap_true. INSERT <found_in_level> INTO TABLE found_in_levels. ASSERT sy-subrc EQ 0. ENDIF. ENDMETHOD. METHOD search. _initial_search( ). _search_up( i_search_up ). _search_down( i_search_down ). _post_search( ). ENDMETHOD. METHOD usage_of_single_element. is_usage_of_single_element = abap_true. ENDMETHOD. METHOD write_found_elements. DATA fil TYPE found_in_level_type. DATA: fe TYPE found_element_type. LOOP AT found_in_levels INTO fil. CLEAR fe. fe-specific = fil-specific. IF fil-found_in_initial_selection EQ abap_true. fe-where = |I|. ELSEIF fil-found_in_post_selection EQ abap_true. fe-where = |P|. ELSE. fe-where = |S|. ENDIF. IF fil-found_in_level_upsearch <> 0 AND fil-found_in_level_downsearch <> 0. fe-level = fil-found_in_level_upsearch. fe-alternate_level = -1 * fil-found_in_level_downsearch. ELSEIF fil-found_in_level_upsearch <> 0. fe-level = fil-found_in_level_upsearch. ELSEIF fil-found_in_level_downsearch <> 0. fe-level = -1 * fil-found_in_level_downsearch. ELSE. fe-level = 0. ENDIF. DATA element TYPE REF TO cl_extr3_elements. element = element_manager->get_element( i_element_id = fil-element_id ). element->name( EXPORTING element_id = fil-element_id IMPORTING element_type = fe-element_type parent_name = fe-parent_name name = fe-name ). IF is_usage_of_single_element EQ abap_true AND fe-specific EQ abap_false. CONTINUE. ENDIF. INSERT fe INTO TABLE fes. ENDLOOP. IF is_usage_of_single_element EQ abap_true. SORT fes BY level alternate_level element_type parent_name name. ELSE. SORT fes BY where level alternate_level element_type parent_name name. ENDIF. IF write EQ abap_true. WRITE: / 'Legend:'. WRITE: / 'W - "I" Found in initial search "P" Found in final search (packages that where not initially selected) "S" Found in regular search'. WRITE: / 'L - Level where an element is found'. WRITE: / 'AL - In case an element is found in down and up search, this is the level where it is found in down search'. WRITE: /. FORMAT COLOR COL_HEADING. WRITE: /(1) 'W', (3) 'L', (3) 'AL', (30) 'Type', (30) 'Name of Parent', (61) 'Name'. FORMAT COLOR COL_BACKGROUND. LOOP AT fes INTO fe. NEW-LINE. WRITE: /(1) fe-where, (3) fe-level, (3) fe-alternate_level, (30) fe-element_type, (30) fe-parent_name, (61) fe-name. " Interface method and attributes can yield to very long names. So 2 times 30 plus 1 should be enough. ENDLOOP. ENDIF. ENDMETHOD. METHOD _initial_search. " Initial search DATA: found_in_level TYPE found_in_level_type, first_initial_elements TYPE found_in_levels_type, association_builder TYPE cl_extr3_model_builder=>builder_type. " found_in_levels will be updated in this method, so add this elements to a new temporary table. IF is_usage_of_single_element EQ abap_false. FIELD-SYMBOLS: <fil> TYPE found_in_level_type. LOOP AT found_in_levels ASSIGNING <fil> WHERE found_in_initial_selection EQ abap_true. <fil>-initially_selected_analyzed = abap_true. INSERT <fil> INTO TABLE first_initial_elements. ENDLOOP. LOOP AT association_builders_init INTO association_builder. LOOP AT first_initial_elements INTO found_in_level. association_builder-association_builder->search_down( element_id = found_in_level-element_id ). ENDLOOP. ENDLOOP. ENDIF. is_initial_selection = abap_false. IF is_usage_of_single_element EQ abap_false. " All initially selected elements are marked as specific so that they are correctly searched FIELD-SYMBOLS: <fil2> TYPE found_in_level_type. LOOP AT found_in_levels ASSIGNING <fil2>. <fil2>-specific = abap_true. ENDLOOP. ENDIF. ENDMETHOD. METHOD _post_search. DATA found_in_level TYPE cl_extr3_model_builder=>found_in_level_type. DATA association_builder TYPE cl_extr3_model_builder=>builder_type. " Post search CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING text = 'Final actions of search'. is_post_selection = abap_true. DATA all_elements TYPE found_in_levels_type. all_elements = found_in_levels. LOOP AT association_builders_post INTO association_builder. LOOP AT all_elements INTO found_in_level. * IF is_usage_of_single_element EQ abap_true * AND found_in_level-specific EQ abap_false. * CONTINUE. " Only a single element is analyzed, include only specific elements into where used analysis * ENDIF. association_builder-association_builder->search_up( element_id = found_in_level-element_id ). ENDLOOP. ENDLOOP. is_post_selection = abap_false. ENDMETHOD. METHOD _search_down. " Search down is_down_search = abap_true. DATA: level_to_search_down TYPE i, something_to_be_done_down TYPE abap_bool. IF i_search_down <> 0. something_to_be_done_down = abap_true. WHILE something_to_be_done_down EQ abap_true. DATA temp TYPE string. temp = |Search down for level { level_to_search_down }|."To be 7.02 compatible CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING text = temp. something_to_be_done_down = abap_false. FIELD-SYMBOLS: <fil> TYPE found_in_level_type. LOOP AT found_in_levels ASSIGNING <fil> WHERE found_in_level_downsearch = level_to_search_down. IF * is_usage_of_single_element EQ abap_true * AND <fil>-specific EQ abap_false. CONTINUE. " Only a single element is analyzed, include only specific elements into where used analysis ENDIF. IF level_to_search_down EQ 0. IF <fil>-found_in_initial_selection EQ abap_false. " SAP_2_FAMIX_69 When more than a single level is searched down, the down search is not done for elements that where found in the search up CONTINUE. "Start searching down with the elements found in the initial selection. Ignore all that was found in upsearch ELSE. IF is_usage_of_single_element EQ abap_true AND ( <fil>-specific EQ abap_false OR <fil>-found_in_level_upsearch > 0 ). CONTINUE. " No downsearch for elements that are in initially selected classes but are not initially selected. " They are not initially selected when found in level upsearch is greater than zero ENDIF. ENDIF. ENDIF. level_for_found_in_downsearch = <fil>-found_in_level_downsearch + 1. DATA association_builder TYPE cl_extr3_model_builder=>builder_type. LOOP AT association_builders INTO association_builder. association_builder-association_builder->search_down( element_id = <fil>-element_id ). ENDLOOP. something_to_be_done_down = abap_true. ENDLOOP. ADD 1 TO level_to_search_down. IF i_search_down >= 0 AND i_search_down <= level_to_search_down. something_to_be_done_down = abap_false. ENDIF. ENDWHILE. ENDIF. is_down_search = abap_false. ENDMETHOD. METHOD _search_up. " Search up is_up_search = abap_true. DATA: level_to_search_up TYPE i, something_to_be_done_up TYPE abap_bool. IF i_search_up <> 0. something_to_be_done_up = abap_true. WHILE something_to_be_done_up EQ abap_true. DATA temp TYPE string. temp = |Search up for level { level_to_search_up }|. "To be 7.02 compatible CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING text = temp. something_to_be_done_up = abap_false. FIELD-SYMBOLS: <fil> TYPE found_in_level_type. LOOP AT found_in_levels ASSIGNING <fil> WHERE found_in_level_upsearch = level_to_search_up. IF <fil>-specific EQ abap_false. CONTINUE. " Only a single element is analyzed, include only specific elements into where used analysis ENDIF. level_for_found_in_upsearch = <fil>-found_in_level_upsearch + 1. DATA association_builder TYPE cl_extr3_model_builder=>builder_type. LOOP AT association_builders INTO association_builder. association_builder-association_builder->search_up( element_id = <fil>-element_id ). ENDLOOP. something_to_be_done_up = abap_true. ENDLOOP. ADD 1 TO level_to_search_up. IF i_search_up >= 0 AND i_search_up <= level_to_search_up. something_to_be_done_up = abap_false. ENDIF. ENDWHILE. ENDIF. " SAP_2_FAMIX_68 When more than a single level is searched up, the up search is not done for elements that where found in the search down " Fullfilled because the search down starts here is_up_search = abap_false. ENDMETHOD. ENDCLASS. CLASS CL_EXTRACT3 IMPLEMENTATION. METHOD check_if_tested. IF g_check_for_test_done EQ 'X'. " Buffer result of call to call stack is_tested = g_is_tested. ELSE. DATA et_callstack TYPE sys_callst . CALL FUNCTION 'SYSTEM_CALLSTACK' IMPORTING et_callstack = et_callstack. READ TABLE et_callstack TRANSPORTING NO FIELDS WITH KEY eventname = 'INVOKE_TEST_METHOD'. IF sy-subrc EQ 0. g_is_tested = 'X'. is_tested = 'X'. g_check_for_test_done = 'X'. ENDIF. ENDIF. ENDMETHOD. METHOD constructor. ENDMETHOD. METHOD extract. CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING text = 'Collect initial elements'. model_builder->initial_selection_started( ). * DATA element_manager TYPE REF TO cl_extr3_element_manager. * CREATE OBJECT element_manager * EXPORTING * i_model_builder = model_builder * i_exclude_found_sap_intf = i_exclude_found_sap_intf. * model_builder->initialize( i_element_manager = element_manager ). DATA packages_elements TYPE REF TO cl_extr3_packages. packages_elements = cl_extr3_packages=>get_instance( i_element_manager = element_manager ). DATA: packages TYPE cl_extr3_initial_elements=>ty_packages, package TYPE cl_extr3_initial_elements=>ty_package. packages = initial_elements->get_selected( ). LOOP AT packages INTO package. packages_elements->add( EXPORTING package = package-package ). ENDLOOP. model_builder->search( i_search_up = i_search_up i_search_down = i_search_down ). CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING text = 'Make model file'. DATA sysid TYPE string. sysid = sy-sysid. element_manager->collect_infos( sysid ). mse_model = element_manager->make_model( ). ENDMETHOD. ENDCLASS. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_eltyp. PERFORM fill_f4_eltyp. START-OF-SELECTION. " Inform users when selection is wrong IF s_pack IS INITIAL AND s_spack IS INITIAL AND p_eltyp IS INITIAL AND p_elpar IS INITIAL AND p_elnam IS INITIAL. FORMAT COLOR COL_NEGATIVE. WRITE: / 'Restrict elements to be extracted'. FORMAT COLOR COL_BACKGROUND. WRITE: / 'The extractor is not able to extract the whole system'. WRITE: / 'You should start with a small quantity of elements, to limit problems when experimenting with the tool'. WRITE: / 'Choose a package with only a few 1000 elements'. WRITE: / 'Choose a small number for upward (downward) search if needed'. RETURN. ENDIF. " Process user selection DATA: mse_model TYPE cl_model=>lines_type. DATA sap_extractor TYPE REF TO cl_extract3. DATA: ls_pack_line LIKE LINE OF s_pack. DATA: lt_pack TYPE sap_extractor->ty_s_pack. LOOP AT s_pack INTO ls_pack_line. APPEND ls_pack_line TO lt_pack. ENDLOOP. DATA: ls_spack_line LIKE LINE OF s_pack. DATA: lt_spack TYPE sap_extractor->ty_s_pack. LOOP AT s_spack INTO ls_spack_line. APPEND ls_spack_line TO lt_spack. ENDLOOP. DATA model_builder TYPE REF TO cl_extr3_model_builder. CREATE OBJECT model_builder. DATA element_manager TYPE REF TO cl_extr3_element_manager. CREATE OBJECT element_manager EXPORTING i_model_builder = model_builder i_exclude_found_sap_intf = p_ex i_interface_use_structure = p_intrev. model_builder->initialize( i_element_manager = element_manager i_dynamic_read = p_dyn ). DATA: initial_elements TYPE REF TO cl_extr3_initial_elements. CREATE OBJECT initial_elements. IF lt_pack IS NOT INITIAL AND ( p_eltyp IS INITIAL AND p_elpar IS INITIAL AND p_elnam IS INITIAL ). initial_elements->select_packages( EXPORTING top_packages = lt_pack sub_packages_filter = lt_spack including_sub_packages = abap_true ). ELSEIF lt_pack IS INITIAL AND ( p_eltyp IS NOT INITIAL OR p_elpar IS NOT INITIAL OR p_elnam IS NOT INITIAL ). DATA: p_eltyp_string TYPE string, p_elpar_string TYPE string, p_elnam_string TYPE string. p_eltyp_string = p_eltyp. p_elpar_string = p_elpar. p_elnam_string = p_elnam. IF p_eltyp IS INITIAL. FORMAT COLOR COL_NEGATIVE. WRITE: / |You have to specify the type of the searched element in field 'Element name'|. FORMAT COLOR COL_BACKGROUND. WRITE: / |Click into the field to get a value help|. RETURN. ENDIF. IF p_eltyp_string EQ cl_extr3_initial_elements=>select_function OR p_eltyp_string EQ cl_extr3_initial_elements=>select_program OR p_eltyp_string EQ cl_extr3_initial_elements=>select_table. IF p_elpar_string IS NOT INITIAL. FORMAT COLOR COL_NEGATIVE. WRITE: / 'Do not enter a parent name for this type of element'. FORMAT COLOR COL_BACKGROUND. RETURN. ENDIF. ELSEIF p_eltyp_string EQ cl_extr3_initial_elements=>select_class_method. " The parentname is empty when a whole class is analyzed and filled when only a component is analyzed ELSE. FORMAT COLOR COL_NEGATIVE. WRITE: / |You have to specify a valid value for the type of the searched element in field 'Element name'|. FORMAT COLOR COL_BACKGROUND. WRITE: / |The text you entered is not valid|. WRITE: / |Click into the field to get a value help|. RETURN. ENDIF. IF p_elnam_string IS INITIAL. FORMAT COLOR COL_NEGATIVE. WRITE: / |You have to enter the name of the searched element in the field 'Specific element'|. FORMAT COLOR COL_BACKGROUND. RETURN. ENDIF. initial_elements->select_specific( EXPORTING model_builder = model_builder element_manager = element_manager i_element_type_filter = p_eltyp_string i_parent_name_filter = p_elpar_string i_name_filter = p_elnam_string ). ELSE. FORMAT COLOR COL_TOTAL. WRITE: / 'Enter either a filter by package or by specific component'. FORMAT COLOR COL_BACKGROUND. ENDIF. CREATE OBJECT sap_extractor. DATA nothing_done TYPE boolean. sap_extractor->extract( EXPORTING model_builder = model_builder element_manager = element_manager initial_elements = initial_elements i_search_up = p_nup i_search_down = p_ndown i_exclude_found_sap_intf = abap_true IMPORTING mse_model = mse_model nothing_done = nothing_done ). IF nothing_done EQ abap_true. RETURN. ENDIF. DATA model_outputer TYPE REF TO cl_output_model. CREATE OBJECT model_outputer. model_outputer->make( mse_model = mse_model g_parameter_download_file = p_down i_default_prefix = p_df ). model_builder->write_found_elements( EXPORTING write = abap_true ). FORM fill_f4_eltyp. TYPES: BEGIN OF ty_eltyp, eltyp TYPE text30, END OF ty_eltyp. DATA: lt_eltyps TYPE STANDARD TABLE OF ty_eltyp, ls_eltyp TYPE ty_eltyp. ls_eltyp-eltyp = cl_extr3_initial_elements=>select_class_method. INSERT ls_eltyp INTO TABLE lt_eltyps. ls_eltyp-eltyp = cl_extr3_initial_elements=>select_table. INSERT ls_eltyp INTO TABLE lt_eltyps. ls_eltyp-eltyp = cl_extr3_initial_elements=>select_program. INSERT ls_eltyp INTO TABLE lt_eltyps. ls_eltyp-eltyp = cl_extr3_initial_elements=>select_function. INSERT ls_eltyp INTO TABLE lt_eltyps. CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' EXPORTING retfield = 'P_ELTYP' dynpprog = sy-repid dynpnr = sy-dynnr dynprofield = 'p_eltyp' value_org = 'S' TABLES value_tab = lt_eltyps. ENDFORM.
36.308133
207
0.628312
989e111989e8827c29f04d4e1f6a94c38cfeb352
8,717
abap
ABAP
src/search/zcl_sat_clif_search_param_util.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
9
2019-11-14T12:27:19.000Z
2022-01-26T16:35:09.000Z
src/search/zcl_sat_clif_search_param_util.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
13
2019-12-04T15:02:12.000Z
2021-11-25T16:43:12.000Z
src/search/zcl_sat_clif_search_param_util.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
4
2019-11-14T13:59:43.000Z
2020-08-05T09:58:30.000Z
"! <p class="shorttext synchronized" lang="en">Utility for mapping search parameters for Class/Interface</p> CLASS zcl_sat_clif_search_param_util DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS class_constructor. "! <p class="shorttext synchronized" lang="en">Converts class category to external format</p> "! "! @parameter iv_internal | <p class="shorttext synchronized" lang="en">internal format</p> "! @parameter ev_external | <p class="shorttext synchronized" lang="en">external format</p> "! @parameter ev_description | <p class="shorttext synchronized" lang="en">Description of the category</p> CLASS-METHODS convert_category_to_ext IMPORTING iv_internal TYPE seocategry EXPORTING VALUE(ev_external) TYPE string VALUE(ev_description) TYPE ddtext. "! <p class="shorttext synchronized" lang="en">Retrieves possible class categories</p> "! "! @parameter rt_categories | <p class="shorttext synchronized" lang="en"></p> CLASS-METHODS get_categories RETURNING VALUE(rt_categories) TYPE string_table. "! <p class="shorttext synchronized" lang="en">Converts class category to internal format</p> "! "! @parameter iv_external | <p class="shorttext synchronized" lang="en">external format</p> "! @parameter rv_internal | <p class="shorttext synchronized" lang="en">internal format</p> CLASS-METHODS convert_category_to_int IMPORTING iv_external TYPE string RETURNING VALUE(rv_internal) TYPE seocategry. "! <p class="shorttext synchronized" lang="en">Converts abap language to external format</p> "! "! @parameter iv_internal | <p class="shorttext synchronized" lang="en">internal format</p> "! @parameter ev_external | <p class="shorttext synchronized" lang="en">external format</p> "! @parameter ev_description | <p class="shorttext synchronized" lang="en">Description of the category</p> CLASS-METHODS convert_abap_lang_to_ext IMPORTING iv_internal TYPE abapvrs EXPORTING VALUE(ev_external) TYPE string VALUE(ev_description) TYPE ddtext. CLASS-METHODS get_abap_languages RETURNING VALUE(rt_languages) TYPE string_table. "! <p class="shorttext synchronized" lang="en">Converts abap language to internal format</p> "! "! @parameter iv_external | <p class="shorttext synchronized" lang="en">external format</p> "! @parameter rv_internal | <p class="shorttext synchronized" lang="en">internal format</p> CLASS-METHODS convert_abap_lang_to_int IMPORTING iv_external TYPE string RETURNING VALUE(rv_internal) TYPE abapvrs. PROTECTED SECTION. PRIVATE SECTION. CLASS-DATA mt_category_values TYPE ddfixvalues. CLASS-DATA mt_abap_lang_values TYPE ddfixvalues. ENDCLASS. CLASS zcl_sat_clif_search_param_util IMPLEMENTATION. METHOD class_constructor. DATA(lo_category_type_descr) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( VALUE seocategry( ) ) ). lo_category_type_descr->get_ddic_fixed_values( RECEIVING p_fixed_values = mt_category_values EXCEPTIONS not_found = 1 no_ddic_type = 2 OTHERS = 3 ). DATA(lo_abap_lang_type_descr) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( VALUE abapvrs( ) ) ). lo_abap_lang_type_descr->get_ddic_fixed_values( RECEIVING p_fixed_values = mt_abap_lang_values EXCEPTIONS not_found = 1 no_ddic_type = 2 OTHERS = 3 ). ENDMETHOD. METHOD convert_category_to_ext. DATA lv_default_text TYPE ddtext. CLEAR: ev_external. CASE iv_internal. WHEN '00'. ev_external = zif_sat_c_object_search=>c_class_categories-general. lv_default_text = 'General Class'. WHEN '01'. ev_external = zif_sat_c_object_search=>c_class_categories-exit. lv_default_text = 'Exit Class'. WHEN '10'. ev_external = zif_sat_c_object_search=>c_class_categories-persistent. lv_default_text = 'Persistent Class'. WHEN '11'. ev_external = zif_sat_c_object_search=>c_class_categories-pers_factory. lv_default_text = 'Factory for persistent class'. WHEN '40'. ev_external = zif_sat_c_object_search=>c_class_categories-exception. lv_default_text = 'Exception Class'. WHEN '05'. ev_external = zif_sat_c_object_search=>c_class_categories-test_class. lv_default_text = 'Test Class (ABAP Unit)'. WHEN '45'. ev_external = zif_sat_c_object_search=>c_class_categories-area_class. lv_default_text = 'Area Class (Shared Objects)'. WHEN '80'. ev_external = zif_sat_c_object_search=>c_class_categories-wd_runtime. lv_default_text = 'Web Dynpro Runtime Object'. WHEN '06'. ev_external = zif_sat_c_object_search=>c_class_categories-behavior. lv_default_text = 'Behavior (Class ... for Behavior of ...)'. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_sat_conversion_exc. ENDCASE. CHECK ev_external IS NOT INITIAL. ev_description = VALUE #( mt_category_values[ low = iv_internal ]-ddtext DEFAULT lv_default_text ). ENDMETHOD. METHOD convert_category_to_int. CASE iv_external. WHEN zif_sat_c_object_search=>c_class_categories-general. rv_internal = '00'. WHEN zif_sat_c_object_search=>c_class_categories-exit. rv_internal = '01'. WHEN zif_sat_c_object_search=>c_class_categories-persistent. rv_internal = '10'. WHEN zif_sat_c_object_search=>c_class_categories-pers_factory. rv_internal = '11'. WHEN zif_sat_c_object_search=>c_class_categories-exception. rv_internal = '40'. WHEN zif_sat_c_object_search=>c_class_categories-test_class. rv_internal = '05'. WHEN zif_sat_c_object_search=>c_class_categories-area_class. rv_internal = '45'. WHEN zif_sat_c_object_search=>c_class_categories-wd_runtime. rv_internal = '80'. WHEN zif_sat_c_object_search=>c_class_categories-behavior. rv_internal = '06'. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_sat_conversion_exc. ENDCASE. ENDMETHOD. METHOD convert_abap_lang_to_ext. DATA lv_default_text TYPE ddtext. CLEAR: ev_external. CASE iv_internal. WHEN ''. ev_external = zif_sat_c_object_search=>c_abap_lang_versions-non_unicode. ev_description = 'Non-Unicode ABAP'. WHEN 'X'. ev_external = zif_sat_c_object_search=>c_abap_lang_versions-unicode. ev_description = 'Standard ABAP (Unicode)'. WHEN '2'. ev_external = zif_sat_c_object_search=>c_abap_lang_versions-key_user. ev_description = 'ABAP for key users'. WHEN '3'. ev_external = zif_sat_c_object_search=>c_abap_lang_versions-static_abap_limited_use. ev_description = 'Static ABAP with limited object use'. WHEN '4'. ev_external = zif_sat_c_object_search=>c_abap_lang_versions-std_abap_limited_use. ev_description = 'Standard ABAP with limited object use'. WHEN '5'. ev_external = zif_sat_c_object_search=>c_abap_lang_versions-cloud_platform. ev_description = 'ABAP for SAP Cloud Platform'. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_sat_conversion_exc. ENDCASE. CHECK ev_external IS NOT INITIAL. ev_description = VALUE #( mt_abap_lang_values[ low = iv_internal ]-ddtext DEFAULT lv_default_text ). ENDMETHOD. METHOD convert_abap_lang_to_int. CASE iv_external. WHEN zif_sat_c_object_search=>c_abap_lang_versions-unicode. rv_internal = 'X'. WHEN zif_sat_c_object_search=>c_abap_lang_versions-key_user. rv_internal = '2'. WHEN zif_sat_c_object_search=>c_abap_lang_versions-static_abap_limited_use. rv_internal = '3'. WHEN zif_sat_c_object_search=>c_abap_lang_versions-std_abap_limited_use. rv_internal = '4'. WHEN zif_sat_c_object_search=>c_abap_lang_versions-cloud_platform. rv_internal = '5'. WHEN zif_sat_c_object_search=>c_abap_lang_versions-non_unicode. rv_internal = ''. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_sat_conversion_exc. ENDCASE. ENDMETHOD. METHOD get_abap_languages. rt_languages = VALUE #( FOR cat IN mt_abap_lang_values ( |{ cat-low }| ) ). ENDMETHOD. METHOD get_categories. rt_categories = VALUE #( FOR cat IN mt_category_values ( |{ cat-low }| ) ). ENDMETHOD. ENDCLASS.
34.868
121
0.695652
989fc7e69cec12d7e5ea797364df123224b15e91
5,567
abap
ABAP
src/zdemo_teched5.prog.abap
AndreaBorgia-Abo/demos
2f89e63babc3590ea44773873b7b78db549f4c7b
[ "MIT" ]
251
2019-02-23T03:36:38.000Z
2021-12-10T21:39:23.000Z
src/zdemo_teched5.prog.abap
AndreaBorgia-Abo/demos
2f89e63babc3590ea44773873b7b78db549f4c7b
[ "MIT" ]
278
2019-02-17T10:42:59.000Z
2021-12-10T20:24:56.000Z
src/zdemo_teched5.prog.abap
AndreaBorgia-Abo/demos
2f89e63babc3590ea44773873b7b78db549f4c7b
[ "MIT" ]
130
2019-02-20T13:25:30.000Z
2021-12-09T03:20:31.000Z
*&---------------------------------------------------------------------* *& Report ZDEMO_TECHED3 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zdemo_teched5. ******************************* * Data Object declaration * ******************************* DATA: lo_excel TYPE REF TO zcl_excel, lo_excel_writer TYPE REF TO zif_excel_writer, lo_worksheet TYPE REF TO zcl_excel_worksheet. DATA: lo_style_title TYPE REF TO zcl_excel_style, lo_drawing TYPE REF TO zcl_excel_drawing, lo_range TYPE REF TO zcl_excel_range, lo_data_validation TYPE REF TO zcl_excel_data_validation, lv_style_title_guid TYPE zexcel_cell_style, ls_key TYPE wwwdatatab. DATA: lv_file TYPE xstring, lv_bytecount TYPE i, lt_file_tab TYPE solix_tab. DATA: lv_full_path TYPE string, lv_workdir TYPE string, lv_file_separator TYPE c. CONSTANTS: lv_default_file_name TYPE string VALUE 'TechEd01.xlsx'. ******************************* * Selection screen management * ******************************* PARAMETERS: p_path TYPE zexcel_export_dir. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. lv_workdir = p_path. cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir CHANGING selected_folder = lv_workdir ). p_path = lv_workdir. INITIALIZATION. cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ). cl_gui_cfw=>flush( ). p_path = lv_workdir. START-OF-SELECTION. IF p_path IS INITIAL. p_path = lv_workdir. ENDIF. cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ). CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path. ******************************* * abap2xlsx create XLSX * ******************************* " Create excel instance CREATE OBJECT lo_excel. " Styles lo_style_title = lo_excel->add_new_style( ). lo_style_title->font->bold = abap_true. lo_style_title->font->color-rgb = zcl_excel_style_color=>c_blue. lv_style_title_guid = lo_style_title->get_guid( ). " Get active sheet lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_title( ip_title = 'Demo TechEd' ). lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'TechEd demo' ip_style = lv_style_title_guid ). lo_worksheet->set_cell( ip_column = 'B' ip_row = 7 ip_value = 'Is abap2xlsx simple' ). lo_worksheet->set_cell( ip_column = 'B' ip_row = 8 ip_value = 'Is abap2xlsx CooL' ). " add logo from SMWO lo_drawing = lo_excel->add_new_drawing( ). lo_drawing->set_position( ip_from_row = 2 ip_from_col = 'B' ). ls_key-relid = 'MI'. ls_key-objid = 'WBLOGO'. lo_drawing->set_media_www( ip_key = ls_key ip_width = 140 ip_height = 64 ). " assign drawing to the worksheet lo_worksheet->add_drawing( lo_drawing ). " Add new sheet lo_worksheet = lo_excel->add_new_worksheet( ). lo_worksheet->set_title( ip_title = 'Values' ). " Set values for range lo_worksheet->set_cell( ip_row = 4 ip_column = 'A' ip_value = 1 ). lo_worksheet->set_cell( ip_row = 5 ip_column = 'A' ip_value = 2 ). lo_worksheet->set_cell( ip_row = 6 ip_column = 'A' ip_value = 3 ). lo_worksheet->set_cell( ip_row = 7 ip_column = 'A' ip_value = 4 ). lo_worksheet->set_cell( ip_row = 8 ip_column = 'A' ip_value = 5 ). lo_range = lo_excel->add_new_range( ). lo_range->name = 'Values'. lo_range->set_value( ip_sheet_name = 'Values' ip_start_column = 'A' ip_start_row = 4 ip_stop_column = 'A' ip_stop_row = 8 ). lo_excel->set_active_sheet_index( 1 ). " add data validation lo_worksheet = lo_excel->get_active_worksheet( ). lo_data_validation = lo_worksheet->add_new_data_validation( ). lo_data_validation->type = zcl_excel_data_validation=>c_type_list. lo_data_validation->formula1 = 'Values'. lo_data_validation->cell_row = 7. lo_data_validation->cell_column = 'C'. lo_worksheet->set_cell( ip_row = 7 ip_column = 'C' ip_value = 'Select a value' ). lo_data_validation = lo_worksheet->add_new_data_validation( ). lo_data_validation->type = zcl_excel_data_validation=>c_type_list. lo_data_validation->formula1 = 'Values'. lo_data_validation->cell_row = 8. lo_data_validation->cell_column = 'C'. lo_worksheet->set_cell( ip_row = 8 ip_column = 'C' ip_value = 'Select a value' ). " Create xlsx stream CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007. lv_file = lo_excel_writer->write_file( lo_excel ). ******************************* * Output * ******************************* " Convert to binary lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ). lv_bytecount = xstrlen( lv_file ). " Save the file cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount filename = lv_full_path filetype = 'BIN' CHANGING data_tab = lt_file_tab ).
36.86755
111
0.596731
98a1b08e9285772f6ebdba03ec29340da17d0182
386
abap
ABAP
src/ydk_alv.fugr.conversion_exit_ydk04_output.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
src/ydk_alv.fugr.conversion_exit_ydk04_output.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
src/ydk_alv.fugr.conversion_exit_ydk04_output.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
FUNCTION CONVERSION_EXIT_YDK04_OUTPUT . *"-------------------------------------------------------------------- *"*"Локальный интерфейс: *" IMPORTING *" REFERENCE(INPUT) *" EXPORTING *" REFERENCE(OUTPUT) *"-------------------------------------------------------------------- * see FM YDK_CONVERSION_EXIT_REGISTER PERFORM output USING '04' input CHANGING output. ENDFUNCTION.
32.166667
70
0.476684
98a690a3a3fe032f91241b7f2dfec867e1adeeee
15,701
abap
ABAP
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZSAPLINK_TABLE_CONTENTS.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.dataflow.heuristics/abap/ZSAPLINK_TABLE_CONTENTS.abap
SvenPeldszus/conqat
28fe004a49453894922aeb27ee3467b1748d23e9
[ "Apache-2.0" ]
null
null
null
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZSAPLINK_TABLE_CONTENTS.abap
SvenPeldszus/conqat
28fe004a49453894922aeb27ee3467b1748d23e9
[ "Apache-2.0" ]
null
null
null
class ZSAPLINK_TABLE_CONTENTS definition public inheriting from ZSAPLINK final create public . public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . private section. endclass. "ZSAPLINK_TABLE_CONTENTS definition *----------------------------------------------------------------------* * class ZSAPLINK_TABLE_CONTENTS implementation. *----------------------------------------------------------------------* * *----------------------------------------------------------------------* class ZSAPLINK_TABLE_CONTENTS implementation. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD checkexists. * Plugin created by: * Rich Heilman * [email protected] * No implementation ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createixmldocfromobject. * Plugin created by: * Rich Heilman * [email protected] TYPES: BEGIN OF ttabname, tabname TYPE dd02v-tabname, END OF ttabname. DATA xtabname TYPE ttabname. DATA xdd02v TYPE dd02v. DATA root_node TYPE REF TO if_ixml_element. DATA datarow_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _tablname TYPE ddobjname. DATA _objtype TYPE string. DATA dref_tab TYPE REF TO data. DATA dref_wa TYPE REF TO data. FIELD-SYMBOLS: <dyn_tab> TYPE table. FIELD-SYMBOLS: <dyn_wa> TYPE ANY. * Check that table exits. _tablname = objname. * Does the table exist? CALL FUNCTION 'DDIF_TABL_GET' EXPORTING name = _tablname IMPORTING dd02v_wa = xdd02v EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR xdd02v-tabname IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>error_message msg = `Table not found`. ENDIF. * Create parent node _objtype = getobjecttype( ). root_node = xmldoc->create_element( _objtype ). xtabname-tabname = xdd02v-tabname. me->setattributesfromstructure( node = root_node structure = xtabname ). * Create dynamic internal table and work area CREATE DATA dref_tab TYPE TABLE OF (xdd02v-tabname). ASSIGN dref_tab->* TO <dyn_tab>. CREATE DATA dref_wa LIKE LINE OF <dyn_tab>. ASSIGN dref_wa->* TO <dyn_wa>. * Select all data SELECT * INTO TABLE <dyn_tab> FROM (xdd02v-tabname). * Write records to XML node LOOP AT <dyn_tab> ASSIGNING <dyn_wa>. datarow_node = xmldoc->create_element( `DataRow` ). me->setattributesfromstructure( node = datarow_node structure = <dyn_wa> ). rc = root_node->append_child( datarow_node ). ENDLOOP. * Add node rc = xmldoc->append_child( root_node ). ixmldocument = xmldoc. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ METHOD createobjectfromixmldoc. * Plugin created by: * Rich Heilman * [email protected] TYPES: BEGIN OF ttabname, tabname TYPE dd02v-tabname, END OF ttabname. DATA xtabname TYPE ttabname. DATA xdd02v TYPE dd02v. DATA xtadir TYPE tadir. DATA idd03p TYPE TABLE OF dd03p. DATA xdd03p LIKE LINE OF idd03p. DATA root_node TYPE REF TO if_ixml_element. DATA datarow_node TYPE REF TO if_ixml_element. DATA datarow_filter TYPE REF TO if_ixml_node_filter. DATA datarow_iterator TYPE REF TO if_ixml_node_iterator. DATA _objtype TYPE string. DATA l_answer TYPE string. DATA l_nameclass TYPE c. DATA l_client_dependent TYPE abap_bool. DATA dref_tab TYPE REF TO data. DATA dref_wa TYPE REF TO data. FIELD-SYMBOLS: <dyn_tab> TYPE table. FIELD-SYMBOLS: <dyn_wa> TYPE ANY. FIELD-SYMBOLS: <fs_mandt> TYPE ANY. _objtype = getobjecttype( ). xmldoc = ixmldocument. root_node = xmldoc->find_from_name( _objtype ). * Get table name from XML. me->getstructurefromattributes( EXPORTING node = root_node CHANGING structure = xtabname ). objname = xtabname-tabname. * Check that table exists CALL FUNCTION 'DDIF_TABL_GET' EXPORTING name = xtabname-tabname IMPORTING dd02v_wa = xdd02v TABLES dd03p_tab = idd03p EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR xdd02v-tabname IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>error_message msg = `Table not found`. ENDIF. * Check for MANDT field, if found, then set client dependent READ TABLE idd03p INTO xdd03p WITH KEY fieldname = 'MANDT'. IF sy-subrc = 0. l_client_dependent = abap_true. ENDIF. * Only allow tables in customer namespace CLEAR xtadir. SELECT SINGLE * FROM tadir INTO xtadir WHERE pgmid = 'R3TR' AND object = 'TABL' AND obj_name = xdd02v-tabname. CALL FUNCTION 'TRINT_OBJECT_NAMESPACE_INFO' EXPORTING iv_pgmid = xtadir-pgmid iv_object = xtadir-object iv_objname = xtadir-obj_name IMPORTING ev_nameclass = l_nameclass EXCEPTIONS namespace_not_existing = 1 namespace_use_rejected = 2 invalid_object = 3 OTHERS = 4. IF l_nameclass <> `C`. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>error_message msg = 'Table is not within customer namespace'. ENDIF. * Create dynamic internal table and work area CREATE DATA dref_tab TYPE TABLE OF (xdd02v-tabname). ASSIGN dref_tab->* TO <dyn_tab>. CREATE DATA dref_wa LIKE LINE OF <dyn_tab>. ASSIGN dref_wa->* TO <dyn_wa>. * Build dynamic internal table from XML FREE: datarow_filter, datarow_iterator, datarow_node. datarow_filter = xmldoc->create_filter_name( `DataRow` ). datarow_iterator = xmldoc->create_iterator_filtered( datarow_filter ). datarow_node ?= datarow_iterator->get_next( ). WHILE datarow_node IS NOT INITIAL. APPEND INITIAL LINE TO <dyn_tab> ASSIGNING <dyn_wa>. me->getstructurefromattributes( EXPORTING node = datarow_node CHANGING structure = <dyn_wa> ). datarow_node ?= datarow_iterator->get_next( ). ENDWHILE. * Any records imported from XML, if not, give error. IF LINES( <dyn_tab> ) = 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>error_message msg = `No data records present in XML document`. ENDIF. * Change MANDT field to current client number * Always add imported records to current client number IF l_client_dependent = abap_true. LOOP AT <dyn_tab> ASSIGNING <dyn_wa>. ASSIGN COMPONENT `MANDT` OF STRUCTURE <dyn_wa> TO <fs_mandt>. <fs_mandt> = sy-mandt. ENDLOOP. ENDIF. * Check that db table is initial, if so, then insert data and exit DATA: l_count TYPE i. CASE l_client_dependent . WHEN abap_true. SELECT COUNT( * ) INTO l_count FROM (xdd02v-tabname) CLIENT SPECIFIED WHERE mandt = sy-mandt. WHEN abap_false. SELECT COUNT( * ) INTO l_count FROM (xdd02v-tabname). ENDCASE. IF l_count = 0. INSERT (xdd02v-tabname) FROM TABLE <dyn_tab>. name = objname. RETURN. ENDIF. * Still here, then ask user how he wants to handle the existing * data, either modify it, of delete/insert DATA: text_question TYPE string. text_question = `Table contains data which may be modified, ` & `would you like to modify existing records, ` & `or delete existing data first and insert`. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING text_question = text_question text_button_1 = 'Modify Data' " UPdate table via MODIFY icon_button_1 = 'ICON_CHANGE' text_button_2 = 'Del/Ins Data' " Delete data first, then INSERT icon_button_2 = 'ICON_DELETE' IMPORTING answer = l_answer EXCEPTIONS text_not_found = 1 OTHERS = 2. * Check answer CASE l_answer . WHEN '1'. "Modify existing rows, insert new rows based on key MODIFY (xdd02v-tabname) FROM TABLE <dyn_tab>. WHEN '2'. "Delete existing data first, then insert new data CASE l_client_dependent . WHEN abap_true. DELETE FROM (xdd02v-tabname) WHERE mandt = sy-mandt. WHEN abap_false. DELETE FROM (xdd02v-tabname). ENDCASE. INSERT (xdd02v-tabname) FROM TABLE <dyn_tab>. WHEN 'A'. "Action has been cancelled RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>error_message msg = `Action Cancelled`. ENDCASE. name = objname. ENDMETHOD. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method DELETEOBJECT. * Plugin created by: * Rich Heilman * [email protected] * No implementation endmethod. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| SAPlink is free software; you can redistribute it and/or modify | *| it under the terms of the GNU General Public License as published | *| by the Free Software Foundation; either version 2 of the License, | *| or (at your option) any later version. | *| | *| SAPlink is distributed in the hope that it will be useful, | *| but WITHOUT ANY WARRANTY; without even the implied warranty of | *| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | *| GNU General Public License for more details. | *| | *| You should have received a copy of the GNU General Public License | *| along with SAPlink; if not, write to the | *| Free Software Foundation, Inc., | *| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | *\---------------------------------------------------------------------/ method GETOBJECTTYPE. * Plugin created by: * Rich Heilman * [email protected] objecttype = 'TABU'. "Table Contents endmethod. endclass. "ZSAPLINK_TABLE_CONTENTS implementation
37.833735
79
0.554296
98a6c2b8313646dff09e77cf86ff0af85bf1e5cd
5,461
abap
ABAP
src/zuitb_gui_template.fugr.lzuitb_gui_templatef01.abap
stockbal/abap-ui-toolbox
93ee48975deab71aa16e3c898c9863b0c4e6ee19
[ "MIT" ]
3
2021-03-08T13:02:46.000Z
2021-11-30T20:04:44.000Z
src/zuitb_gui_template.fugr.lzuitb_gui_templatef01.abap
stockbal/abap-ui-toolbox
93ee48975deab71aa16e3c898c9863b0c4e6ee19
[ "MIT" ]
1
2021-03-31T17:13:50.000Z
2021-03-31T20:05:02.000Z
src/zuitb_gui_template.fugr.lzuitb_gui_templatef01.abap
stockbal/abap-ui-toolbox
93ee48975deab71aa16e3c898c9863b0c4e6ee19
[ "MIT" ]
null
null
null
CLASS lcl_exit_callback IMPLEMENTATION. METHOD zif_uitb_exit_callback~cancel_exit. mf_exit_cancelled = abap_true. ENDMETHOD. METHOD zif_uitb_exit_callback~exit_cancelled. rf_exit_cancelled = mf_exit_cancelled. ENDMETHOD. ENDCLASS. CLASS lcl_pai_callback IMPLEMENTATION. METHOD zif_uitb_pai_callback~exit_screen. lcl_local_controller=>clean_up( ). lcl_local_controller=>leave_screen( ). ENDMETHOD. ENDCLASS. CLASS lcl_pbo_callback IMPLEMENTATION. METHOD zif_uitb_pbo_callback~is_first_screen_call. rf_is_first = mf_is_first_screen_call. IF mf_is_first_screen_call = abap_true. CLEAR mf_is_first_screen_call. ENDIF. ENDMETHOD. METHOD zif_uitb_pbo_callback~deactivate_function. APPEND iv_function TO mt_function_exclude. ENDMETHOD. METHOD zif_uitb_pbo_callback~set_title. gs_view_data-title = iv_title. ENDMETHOD. METHOD get_exclude. et_exclude_tab = mt_function_exclude. ENDMETHOD. METHOD constructor. mf_is_first_screen_call = if_first_screen_call. ENDMETHOD. METHOD zif_uitb_pbo_callback~exit_screen. lcl_local_controller=>clean_up( ). lcl_local_controller=>leave_screen( ). ENDMETHOD. METHOD zif_uitb_pbo_callback~set_status. gs_view_data-status = iv_status. gs_view_data-status_prog = COND #( WHEN iv_progname IS INITIAL THEN sy-repid ELSE iv_progname ). ENDMETHOD. METHOD zif_uitb_pbo_callback~deactivate_functions. mt_function_exclude = VALUE #( BASE mt_function_exclude ( LINES OF it_functions ) ). ENDMETHOD. ENDCLASS. CLASS lcl_local_controller IMPLEMENTATION. METHOD pai. DATA(lv_function) = ok_code. CLEAR ok_code. CHECK lv_function IS NOT INITIAL. *.. Check for special leave function where no exit event should be sent IF lv_function = zif_uitb_template_prog=>c_func_leave_no_exit_event. clean_up( ). leave_screen( ). *.... handle the function in the callback program ELSEIF lv_function = zif_uitb_template_prog=>c_func_leave. DATA(lf_exit) = abap_true. should_exit( CHANGING cf_exit = lf_exit ). IF lf_exit = abap_true. clean_up( ). leave_screen( ). ELSE. CLEAR ok_code. ENDIF. ELSE. gs_view_data-controller->raise_user_command( iv_function = lv_function ir_callback = NEW lcl_pai_callback( ) ). ENDIF. ENDMETHOD. METHOD pbo. DATA: lt_exclude_function TYPE STANDARD TABLE OF sy-ucomm. IF gs_view_data-is_first_call = abap_true. clear_functions( ). ENDIF. CLEAR: gs_view_data-status. DATA(lr_callback) = NEW lcl_pbo_callback( gs_view_data-is_first_call ). gs_view_data-controller->raise_before_output( lr_callback ). SET TITLEBAR '0100' WITH gs_view_data-title. " fill dynamic function fill_dynamic_functions( ). lr_callback->get_exclude( IMPORTING et_exclude_tab = lt_exclude_function ). IF gs_view_data-status IS NOT INITIAL. SET PF-STATUS gs_view_data-status OF PROGRAM gs_view_data-status_prog EXCLUDING lt_exclude_function. ELSE. IF gs_view_data-as_dialog = abap_true. SET PF-STATUS '0101' EXCLUDING lt_exclude_function. ELSE. SET PF-STATUS '0100' EXCLUDING lt_exclude_function. ENDIF. ENDIF. CLEAR gs_view_data-is_first_call. ENDMETHOD. METHOD exit. DATA(lf_exit) = abap_true. *... Check if exit event should be called IF ok_code = zif_uitb_template_prog=>c_func_leave OR ok_code = zif_uitb_template_prog=>c_func_quit OR ok_code = zif_uitb_template_prog=>c_func_cancel. should_exit( CHANGING cf_exit = lf_exit ). IF lf_exit = abap_false. CLEAR ok_code. RETURN. ENDIF. ENDIF. IF ok_code = zif_uitb_template_prog=>c_func_cancel. CLEAR ok_code. clean_up( ). leave_screen( ). ELSEIF ok_code = zif_uitb_template_prog=>c_func_quit. CLEAR ok_code. clean_up( ). LEAVE PROGRAM. ENDIF. ENDMETHOD. METHOD clear_functions. ASSIGN ('CHOOSE') TO FIELD-SYMBOL(<lv_choose_function>). IF sy-subrc = 0. CLEAR <lv_choose_function>. ENDIF. DO gc_max_function_number TIMES. DATA(lv_dyn_func_name) = 'FUNC' && sy-index. ASSIGN (lv_dyn_func_name) TO FIELD-SYMBOL(<ls_dyn_function>). IF sy-subrc = 0. CLEAR <ls_dyn_function>. ENDIF. ENDDO. ENDMETHOD. METHOD leave_screen. SET SCREEN 0. LEAVE SCREEN. ENDMETHOD. METHOD fill_dynamic_functions. LOOP AT gs_view_data-functions ASSIGNING FIELD-SYMBOL(<ls_dynamic_function>). ASSIGN (<ls_dynamic_function>-function_id) TO FIELD-SYMBOL(<ls_dyn_function_dynpro>). IF sy-subrc = 0. <ls_dyn_function_dynpro> = <ls_dynamic_function>-function_info. ENDIF. ENDLOOP. ENDMETHOD. METHOD should_exit. DATA(lr_exit_callback) = CAST zif_uitb_exit_callback( NEW lcl_exit_callback( ) ). gs_view_data-controller->raise_exit( lr_exit_callback ). cf_exit = xsdbool( NOT lr_exit_callback->exit_cancelled( ) ). ENDMETHOD. METHOD clean_up. gs_view_data-controller->free_resources( ). CLEAR gs_view_data. " reset to last last screen controller IF gt_view_controller IS NOT INITIAL. gs_view_data = gt_view_controller[ 1 ]. DELETE gt_view_controller INDEX 1. clear_functions( ). fill_dynamic_functions( ). ENDIF. ENDMETHOD. ENDCLASS.
26.129187
106
0.713789
98a8db67f3e619368d3e71285a3d1609fd28f742
6,542
abap
ABAP
src/zcl_abap_graph_node_record.clas.abap
marcellourbani/abapgraph
3de65fff2fee1afd13feb1cde090420a6acafcf6
[ "MIT" ]
8
2018-11-23T15:02:51.000Z
2022-03-18T09:44:22.000Z
src/zcl_abap_graph_node_record.clas.abap
marcellourbani/abapgraph
3de65fff2fee1afd13feb1cde090420a6acafcf6
[ "MIT" ]
2
2019-08-13T17:25:55.000Z
2020-09-17T07:14:01.000Z
src/zcl_abap_graph_node_record.clas.abap
marcellourbani/abapgraph
3de65fff2fee1afd13feb1cde090420a6acafcf6
[ "MIT" ]
3
2020-09-15T12:51:00.000Z
2021-07-09T02:07:16.000Z
class zcl_abap_graph_node_record definition public final create private . public section. interfaces: zif_abap_graph_node. aliases: attributes for zif_abap_graph_node~attributes, id for zif_abap_graph_node~id, graph for zif_abap_graph_node~graph, ty_link for zif_abap_graph_node~ty_link, tt_link for zif_abap_graph_node~tt_link, getlinks for zif_abap_graph_node~getlinks , linkto for zif_abap_graph_node~linkto , render for zif_abap_graph_node~render , tt_node for zif_abap_graph_node~tt_node , ty_nod for zif_abap_graph_node~ty_node . types: begin of ty_component, name type string, value type string, partid type string, nameattributes like attributes, valueattributes like attributes, end of ty_component, tt_component type table of ty_component. data: headerattr like attributes read-only. class-methods create importing id type string label type string optional graph type ref to zcl_abap_graph escape type abap_bool default abap_true returning value(r_result) type ref to zcl_abap_graph_node_record. methods: addcomponent importing name type string value type string escape type abap_bool default abap_true bgcolor type string optional value(partid) type string optional nameattributes like attributes optional valueattributes like attributes optional returning value(componentid) type string. protected section. data: mainlabel type string. private section. data: links type tt_link, components type tt_component. methods validatesource importing i_source type string. methods getcomp importing partid type string returning value(r_result) type string. endclass. class zcl_abap_graph_node_record implementation. method create. if not graph is bound. zcx_abap_graph=>raise( 'A node requires valid parent graph' ). endif. create object r_result. r_result->id = zcl_abap_graph_utilities=>quoteifneeded( id ). r_result->graph = graph. r_result->attributes = zcl_abap_graph_attr=>create( ). if escape = abap_true. r_result->mainlabel = cl_http_utility=>escape_html( label ). else. r_result->mainlabel = label . endif. r_result->attributes->set( name = 'shape' value = 'plaintext' ). r_result->headerattr = zcl_abap_graph_attr=>create( abap_true ). graph->addnode( r_result ). endmethod. method zif_abap_graph_node~getlinks. links = me->links. endmethod. method zif_abap_graph_node~linkto. data: esclabel type string. field-symbols: <link> like line of links. append initial line to links assigning <link>. if source = ''. <link>-parentid = id. else. validatesource( source ). <link>-parentid = source. endif. if graph->has_id( destination ) = abap_false. zcx_abap_graph=>raise( 'Destination must be a valid part of the node' ). endif. <link>-childid = destination. <link>-attributes = zcl_abap_graph_attr=>create( ). esclabel = cl_http_utility=>escape_html( label ). <link>-attributes->set( name = 'label' value = esclabel ). <link>-attributes->set( name = 'color' value = color ). <link>-attributes->set( name = 'fontcolor' value = color ). endmethod. method zif_abap_graph_node~render. data: temp type string, nameattr type string, valueattr type string, comp type string. field-symbols: <comp> like line of components. agdefinitions. temp = headerattr->render( ). agexpand '<<table border="0" cellborder="1" cellspacing="0">\n<tr><td colspan="2" {temp}>{mainlabel}</td></tr>' temp. loop at components assigning <comp>. comp = getcomp( <comp>-partid ). nameattr = <comp>-nameattributes->render( ). valueattr = <comp>-valueattributes->render( ). agexpand '{temp}\n<tr><td{nameattr}>{<comp>-name}</td><td{valueattr}{comp}>{<comp>-value}</td></tr>' temp. endloop. agexpand '{temp}\n</table>>' temp. attributes->setraw( name = 'label' value = temp ). temp = attributes->render( ). agexpand '{id}{temp};' dotsource. endmethod. method addcomponent. field-symbols: <comp> like line of components. if partid <> ''. partid = zcl_abap_graph_utilities=>quoteifneeded( partid ). concatenate id ':' partid into componentid. "will raise an exception for invalid/already used IDs graph->register_id( componentid ). endif. append initial line to components assigning <comp>. <comp>-name = name. <comp>-partid = partid. if escape = abap_true. <comp>-value = cl_http_utility=>escape_html( value ). else. <comp>-value = value . endif. if nameattributes is bound. <comp>-nameattributes = nameattributes. else. <comp>-nameattributes = zcl_abap_graph_attr=>create( abap_true ). endif. if valueattributes is bound. <comp>-valueattributes = valueattributes. else. <comp>-valueattributes = zcl_abap_graph_attr=>create( abap_true ). endif. if bgcolor <> ''. <comp>-nameattributes->set( name = 'bgcolor' value = bgcolor ). <comp>-valueattributes->set( name = 'bgcolor' value = bgcolor ). endif. endmethod. method validatesource. data: parent type string, child type string. if graph->has_id( i_source ) = abap_true. find regex '(".+"):(".+")$' in i_source submatches parent child. endif. if sy-subrc <> 0 or parent <> id. zcx_abap_graph=>raise( 'Source must be a valid part of the node' ). endif. endmethod. method getcomp. if partid <> ''. concatenate ' port=' partid ' ' into r_result respecting blanks. endif. endmethod. endclass.
34.072917
115
0.603485
98a8f622b8e375f20e1d8b012edaf70b659554c7
11,700
abap
ABAP
SM30-SCDO Log/Maintenance_events.abap
zaferonbas/ABAP
15d8f90f13998acdbe222eee8b70c25e055bd588
[ "MIT" ]
24
2017-03-16T10:56:57.000Z
2022-03-17T21:24:58.000Z
SM30-SCDO Log/Maintenance_events.abap
zaferonbas/ABAP
15d8f90f13998acdbe222eee8b70c25e055bd588
[ "MIT" ]
2
2017-03-17T19:54:46.000Z
2018-07-24T06:18:25.000Z
SM30-SCDO Log/Maintenance_events.abap
zaferonbas/ABAP
15d8f90f13998acdbe222eee8b70c25e055bd588
[ "MIT" ]
14
2017-09-29T01:38:57.000Z
2021-10-02T14:05:43.000Z
*&----------------------------------------------------------------* *& Form F_BEFORE_SAVE *&----------------------------------------------------------------* FORM f_before_save ##CALLED. TYPES: BEGIN OF ty_tcdrp, object TYPE cdobjectcl, reportname TYPE cdreport, END OF ty_tcdrp, BEGIN OF ty_view_tab, object TYPE cdobjectcl, tabname TYPE cdtabname, END OF ty_view_tab. DATA: lt_ptab TYPE STANDARD TABLE OF string, lv_prog TYPE string, lv_mess TYPE string, lv_sid TYPE string, lt_obj TYPE STANDARD TABLE OF ty_view_tab, lt_tcdrp TYPE STANDARD TABLE OF ty_tcdrp, lv_fugn TYPE funct_pool, lv_table TYPE cdtabname, lv_namesfunc TYPE namespace, lv_funcgroup TYPE progname, lv_namesprog TYPE namespace, lv_program TYPE progname, lrt_tabname TYPE RANGE OF tabname, lt_dd26v TYPE TABLE OF dd26v, lv_object TYPE cdobjectcl. " Get tabnames " DD: Interface for reading a view from the ABAP/4 Dictionary CALL FUNCTION 'DDIF_VIEW_GET' EXPORTING name = vim_view_name TABLES dd26v_tab = lt_dd26v EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc IS NOT INITIAL. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. IF lt_dd26v IS INITIAL. APPEND INITIAL LINE TO lrt_tabname ASSIGNING FIELD-SYMBOL(<lrs_tabname>). <lrs_tabname>-sign = 'I'. <lrs_tabname>-option = 'EQ'. <lrs_tabname>-low = vim_view_name. ELSE. SORT lt_dd26v BY tabname. DELETE ADJACENT DUPLICATES FROM lt_dd26v COMPARING tabname. "*- LOOP AT lt_dd26v INTO DATA(ls_dd26v). APPEND INITIAL LINE TO lrt_tabname ASSIGNING <lrs_tabname>. <lrs_tabname>-sign = 'I'. <lrs_tabname>-option = 'EQ'. <lrs_tabname>-low = ls_dd26v-tabname. ENDLOOP. ENDIF. " Objects for change document creation SELECT object tabname FROM tcdob INTO TABLE lt_obj WHERE tabname IN lrt_tabname ##WARN_OK. IF sy-subrc IS NOT INITIAL. " No change document objects found MESSAGE i899(cd). RETURN. ENDIF. " Information on Include Reports Generated by RSSCD000 SELECT object reportname FROM tcdrp INTO TABLE lt_tcdrp FOR ALL ENTRIES IN lt_obj WHERE object EQ lt_obj-object ##WARN_OK. IF sy-subrc IS NOT INITIAL. " Update program does not yet exist MESSAGE i446(m2). RETURN. ENDIF. " View Directory SELECT SINGLE area FROM tvdir INTO lv_fugn WHERE tabname EQ vim_view_name. "*- LOOP AT lt_obj ASSIGNING FIELD-SYMBOL(<ls_obj>). READ TABLE lt_tcdrp ASSIGNING FIELD-SYMBOL(<ls_tcdrp>) WITH KEY object = <ls_obj>-object. IF sy-subrc IS NOT INITIAL. CONTINUE. ENDIF. " Split namespace CLEAR: lv_namesprog, lv_program. lv_program = <ls_tcdrp>-reportname. CALL FUNCTION 'RS_NAME_SPLIT_NAMESPACE' EXPORTING name_with_namespace = lv_program IMPORTING namespace = lv_namesprog name_without_namespace = lv_program EXCEPTIONS delimiter_error = 1 OTHERS = 2. IF sy-subrc <> 0. lv_program = <ls_tcdrp>-reportname. ENDIF. CLEAR: lv_namesfunc, lv_funcgroup. lv_funcgroup = lv_fugn. CALL FUNCTION 'RS_NAME_SPLIT_NAMESPACE' EXPORTING name_with_namespace = lv_funcgroup IMPORTING namespace = lv_namesfunc name_without_namespace = lv_funcgroup EXCEPTIONS delimiter_error = 1 OTHERS = 2. IF sy-subrc <> 0. lv_funcgroup = lv_fugn. ENDIF. " Namespace conversion lv_object = <ls_obj>-object. IF lv_object(1) = '/'. SHIFT lv_object LEFT DELETING LEADING '/'. REPLACE FIRST OCCURRENCE OF '/' IN lv_object WITH '_'. ENDIF. lv_table = <ls_obj>-tabname. IF lv_table(1) = '/'. SHIFT lv_table LEFT DELETING LEADING '/'. REPLACE FIRST OCCURRENCE OF '/' IN lv_table WITH '_'. ENDIF. " Subroutine pool APPEND ##NO_TEXT: `PROGRAM SUBPOOL.` TO lt_ptab, ` INCLUDE ` && lv_namesprog && `F` && lv_program && `CDT.` TO lt_ptab, ` INCLUDE ` && lv_namesprog && `F` && lv_program && `CDC.` TO lt_ptab, ` FORM f_process.` TO lt_ptab, ` TYPES: BEGIN OF total.` TO lt_ptab, ` INCLUDE STRUCTURE ` && vim_view_name && `.` TO lt_ptab, ` INCLUDE STRUCTURE vimflagtab.` TO lt_ptab, ` TYPES: END OF total.` TO lt_ptab, ` FIELD-SYMBOLS: <fs_total> TYPE ANY TABLE,` TO lt_ptab, ` <fs_total_wa> TYPE total,` TO lt_ptab, ` <fs_x_namtab> TYPE ANY TABLE,` TO lt_ptab, ` <fs_x_namtab_wa> TYPE vimnamtab,` TO lt_ptab, ` <fs_field> TYPE any.` TO lt_ptab, ` DATA: lv_tabname(40) TYPE c VALUE '(` && lv_namesfunc && `SAPL` && lv_funcgroup && `)TOTAL[]',` TO lt_ptab, ` lv_cond_line TYPE string,` TO lt_ptab, ` lv_cond_line2 TYPE string.` TO lt_ptab, ` ASSIGN (lv_tabname) TO <fs_total>.` TO lt_ptab, ` LOOP AT <fs_total> ASSIGNING <fs_total_wa> CASTING.` TO lt_ptab, ` CASE <fs_total_wa>-action.` TO lt_ptab, ` WHEN 'U'. " Update` TO lt_ptab, ` lv_tabname = '(` && lv_namesfunc && `SAPL` && lv_funcgroup && `)X_NAMTAB[]'.` TO lt_ptab, ` ASSIGN (lv_tabname) TO <fs_x_namtab>.` TO lt_ptab, ` lv_cond_line2 = |keyflag EQ 'X' AND viewfield NE 'MANDT'|.` TO lt_ptab, ` LOOP AT <fs_x_namtab> ASSIGNING <fs_x_namtab_wa> WHERE (lv_cond_line2).` TO lt_ptab, ` ASSIGN COMPONENT <fs_x_namtab_wa>-viewfield OF STRUCTURE <fs_total_wa> TO <fs_field>.` TO lt_ptab, ` IF sy-subrc IS INITIAL.` TO lt_ptab, ` lv_cond_line = lv_cond_line && |AND | && ` TO lt_ptab, ` <fs_x_namtab_wa>-viewfield && | EQ '| && <fs_field> && |' |.` TO lt_ptab, ` objectid = objectid && <fs_field>.` TO lt_ptab, ` UNASSIGN <fs_field>.` TO lt_ptab, ` ENDIF.` TO lt_ptab, ` ENDLOOP.` TO lt_ptab, ` IF sy-subrc IS INITIAL.` TO lt_ptab, ` SHIFT lv_cond_line LEFT BY 3 PLACES.` TO lt_ptab, ` SELECT SINGLE *` TO lt_ptab, ` FROM ` && <ls_obj>-tabname TO lt_ptab, ` INTO *` && <ls_obj>-tabname TO lt_ptab, ` WHERE (lv_cond_line).` TO lt_ptab, ` MOVE-CORRESPONDING <fs_total_wa> TO ` && <ls_obj>-tabname && `.` TO lt_ptab, ` objectid = objectid.` TO lt_ptab, ` tcode = sy-tcode.` TO lt_ptab, ` udate = sy-datum.` TO lt_ptab, ` utime = sy-uzeit.` TO lt_ptab, ` username = sy-uname.` TO lt_ptab, ` cdoc_upd_object = 'U'.` TO lt_ptab, ` upd_` && lv_table && ` = 'U'.` TO lt_ptab, ` PERFORM cd_call_` && lv_object && `.` TO lt_ptab, ` ENDIF.` TO lt_ptab, ` WHEN 'N'. " New` TO lt_ptab, ` lv_tabname = '(` && lv_namesfunc && `SAPL` && lv_funcgroup && `)X_NAMTAB[]'.` TO lt_ptab, ` ASSIGN (lv_tabname) TO <fs_x_namtab>.` TO lt_ptab, ` lv_cond_line2 = |keyflag EQ 'X' AND viewfield NE 'MANDT'|.` TO lt_ptab, ` LOOP AT <fs_x_namtab> ASSIGNING <fs_x_namtab_wa> WHERE (lv_cond_line2).` TO lt_ptab, ` ASSIGN COMPONENT <fs_x_namtab_wa>-viewfield OF STRUCTURE <fs_total_wa> TO <fs_field>.` TO lt_ptab, ` IF sy-subrc IS INITIAL.` TO lt_ptab, ` objectid = objectid && <fs_field>.` TO lt_ptab, ` UNASSIGN <fs_field>.` TO lt_ptab, ` ENDIF.` TO lt_ptab, ` ENDLOOP.` TO lt_ptab, ` IF sy-subrc IS INITIAL.` TO lt_ptab, ` MOVE-CORRESPONDING <fs_total_wa> TO ` && <ls_obj>-tabname && `.` TO lt_ptab, ` objectid = objectid.` TO lt_ptab, ` tcode = sy-tcode.` TO lt_ptab, ` udate = sy-datum.` TO lt_ptab, ` utime = sy-uzeit.` TO lt_ptab, ` username = sy-uname.` TO lt_ptab, ` cdoc_upd_object = 'I'.` TO lt_ptab, ` upd_` && lv_table && ` = 'I'.` TO lt_ptab, ` PERFORM cd_call_` && lv_object && `.` TO lt_ptab, ` ENDIF.` TO lt_ptab, ` WHEN 'D'. " Delete` TO lt_ptab, ` lv_tabname = '(` && lv_namesfunc && `SAPL` && lv_funcgroup && `)X_NAMTAB[]'.` TO lt_ptab, ` ASSIGN (lv_tabname) TO <fs_x_namtab>.` TO lt_ptab, ` lv_cond_line2 = |keyflag EQ 'X' AND viewfield NE 'MANDT'|.` TO lt_ptab, ` LOOP AT <fs_x_namtab> ASSIGNING <fs_x_namtab_wa> WHERE (lv_cond_line2).` TO lt_ptab, ` ASSIGN COMPONENT <fs_x_namtab_wa>-viewfield OF STRUCTURE <fs_total_wa> TO <fs_field>.` TO lt_ptab, ` IF sy-subrc IS INITIAL.` TO lt_ptab, ` objectid = objectid && <fs_field>.` TO lt_ptab, ` UNASSIGN <fs_field>.` TO lt_ptab, ` ENDIF.` TO lt_ptab, ` ENDLOOP.` TO lt_ptab, ` IF sy-subrc IS INITIAL.` TO lt_ptab, ` MOVE-CORRESPONDING <fs_total_wa> TO *` && <ls_obj>-tabname && `.` TO lt_ptab, ` objectid = objectid.` TO lt_ptab, ` tcode = sy-tcode.` TO lt_ptab, ` udate = sy-datum.` TO lt_ptab, ` utime = sy-uzeit.` TO lt_ptab, ` username = sy-uname.` TO lt_ptab, ` cdoc_upd_object = 'D'.` TO lt_ptab, ` upd_` && lv_table && ` = 'D'.` TO lt_ptab, ` PERFORM cd_call_` && lv_object && `.` TO lt_ptab, ` ENDIF.` TO lt_ptab, ` ENDCASE.` TO lt_ptab, ` CLEAR: lv_cond_line, lv_cond_line2, objectid, ` && <ls_obj>-tabname && `, *` && <ls_obj>-tabname && `.` TO lt_ptab, ` ENDLOOP.` TO lt_ptab, ` ENDFORM.` TO lt_ptab. "*- GENERATE SUBROUTINE POOL lt_ptab NAME lv_prog MESSAGE lv_mess SHORTDUMP-ID lv_sid. IF sy-subrc = 0. PERFORM ('F_PROCESS') IN PROGRAM (lv_prog) IF FOUND. ELSEIF sy-subrc = 4. MESSAGE lv_mess TYPE 'I'. ELSEIF sy-subrc = 8. MESSAGE lv_sid TYPE 'I'. ENDIF. CLEAR: lt_ptab. ENDLOOP. ENDFORM. *&----------------------------------------------------------------* *& Form F_AFTER_SAVE *&----------------------------------------------------------------* FORM f_after_save ##CALLED. COMMIT WORK AND WAIT. ENDFORM.
46.613546
133
0.514188
98ab72aec2839dbc8dfbb66f793ba2d2b8f66e8d
566
abap
ABAP
src/ixml/if_ixml_named_node_map.intf.abap
markstuppacher/deps
77ff35a93e4dc000c745452a232e51721e327213
[ "MIT" ]
2
2020-04-19T14:38:41.000Z
2020-10-03T07:50:28.000Z
src/ixml/if_ixml_named_node_map.intf.abap
markstuppacher/deps
77ff35a93e4dc000c745452a232e51721e327213
[ "MIT" ]
38
2019-08-13T17:30:13.000Z
2022-03-08T12:54:56.000Z
src/ixml/if_ixml_named_node_map.intf.abap
markstuppacher/deps
77ff35a93e4dc000c745452a232e51721e327213
[ "MIT" ]
15
2019-11-19T13:45:29.000Z
2022-03-08T11:18:00.000Z
INTERFACE if_ixml_named_node_map PUBLIC. METHODS: create_iterator RETURNING VALUE(iterator) TYPE REF TO if_ixml_node_iterator, get_length RETURNING VALUE(val) TYPE i, get_named_item_ns IMPORTING name TYPE string RETURNING VALUE(val) TYPE REF TO if_ixml_node, get_named_item IMPORTING name TYPE string RETURNING VALUE(val) TYPE REF TO if_ixml_node, remove_named_item IMPORTING name TYPE string, get_item IMPORTING index TYPE i RETURNING VALUE(val) TYPE REF TO if_ixml_node. ENDINTERFACE.
31.444444
66
0.729682
98b2937bcb8f6f32f09531a48825ef815dfd18db
1,059
abap
ABAP
src/objects/ycl_abapgit_object_ectc.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/objects/ycl_abapgit_object_ectc.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/objects/ycl_abapgit_object_ectc.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
2
2019-11-24T20:35:16.000Z
2020-04-16T07:29:33.000Z
CLASS ycl_abapgit_object_ectc DEFINITION PUBLIC INHERITING FROM ycl_abapgit_object_ecatt_super FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS: constructor IMPORTING !is_item TYPE yif_abapgit_definitions=>ty_item !iv_language TYPE spras. PROTECTED SECTION. METHODS: get_object_type REDEFINITION, get_upload REDEFINITION, get_download REDEFINITION, get_lock_object REDEFINITION. ENDCLASS. CLASS ycl_abapgit_object_ectc IMPLEMENTATION. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). ENDMETHOD. METHOD get_object_type. rv_object_type = cl_apl_ecatt_const=>obj_type_test_config. ENDMETHOD. METHOD get_upload. CREATE OBJECT ro_upload TYPE ycl_abapgit_ecatt_config_upl. ENDMETHOD. METHOD get_download. CREATE OBJECT ro_download TYPE ycl_abapgit_ecatt_config_downl. ENDMETHOD. METHOD get_lock_object. rv_lock_object = 'E_ECATT_TC'. ENDMETHOD. ENDCLASS.
17.080645
66
0.720491
98b2f2a5a2d61143b918d992e9b4cb9fa001fe3c
5,442
abap
ABAP
src/zcl_abapgit_repo_online.clas.testclasses.abap
wdecpacloudcourse01/abap_a07
ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed
[ "MIT" ]
null
null
null
src/zcl_abapgit_repo_online.clas.testclasses.abap
wdecpacloudcourse01/abap_a07
ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed
[ "MIT" ]
null
null
null
src/zcl_abapgit_repo_online.clas.testclasses.abap
wdecpacloudcourse01/abap_a07
ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed
[ "MIT" ]
null
null
null
CLASS ltcl_code_inspector DEFINITION FOR TESTING. PUBLIC SECTION. INTERFACES: zif_abapgit_code_inspector. METHODS: constructor IMPORTING iv_package TYPE devclass. PRIVATE SECTION. DATA: mv_package TYPE devclass. ENDCLASS. CLASS ltcl_code_inspector IMPLEMENTATION. METHOD constructor. mv_package = iv_package. ENDMETHOD. METHOD zif_abapgit_code_inspector~run. DATA: ls_list LIKE LINE OF rt_list. IF mv_package = '$DUMMY'. ls_list-kind = 'E'. INSERT ls_list INTO TABLE rt_list. ENDIF. ENDMETHOD. METHOD zif_abapgit_code_inspector~get_inspection. "##needed ENDMETHOD. ENDCLASS. CLASS ltcl_run_code_inspection DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA: mo_repo_online TYPE REF TO zcl_abapgit_repo_online, mv_error_text TYPE string, mt_act_list TYPE scit_alvlist, mv_check_variant TYPE string. METHODS: exception_when_no_check_var FOR TESTING RAISING cx_static_check, exception_when_error FOR TESTING RAISING cx_static_check, no_exception_when_no_error FOR TESTING RAISING cx_static_check, push_not_possible_if_ci_req FOR TESTING RAISING cx_static_check, given_online_repo IMPORTING iv_package TYPE devclass RAISING zcx_abapgit_exception, given_check_variant IMPORTING iv_check_variant TYPE string, given_mock_code_inspector IMPORTING iv_package TYPE devclass iv_check_variant TYPE sci_chkv, given_block_commit IMPORTING iv_block_commit TYPE abap_bool, when_push, then_exception_text_is IMPORTING iv_exp_error_text TYPE csequence, when_run_code_inspector, then_ci_detected_an_error, then_no_exception_is_raised. ENDCLASS. CLASS zcl_abapgit_repo_online DEFINITION LOCAL FRIENDS ltcl_run_code_inspection. CLASS ltcl_run_code_inspection IMPLEMENTATION. METHOD exception_when_no_check_var. given_online_repo( iv_package = '$DUMMY' ). given_check_variant( || ). when_run_code_inspector( ). then_exception_text_is( |Please supply check variant| ). ENDMETHOD. METHOD exception_when_error. given_online_repo( '$DUMMY' ). given_check_variant( |variant| ). given_mock_code_inspector( iv_package = '$DUMMY' iv_check_variant = |variant| ). when_run_code_inspector( ). then_ci_detected_an_error( ). ENDMETHOD. METHOD no_exception_when_no_error. given_online_repo( '$PACKAGE' ). given_check_variant( |variant| ). given_mock_code_inspector( iv_package = '$PACKAGE' iv_check_variant = |variant| ). when_run_code_inspector( ). then_no_exception_is_raised( ). ENDMETHOD. METHOD given_online_repo. DATA: ls_data TYPE zif_abapgit_persistence=>ty_repo. ls_data-key = 'dummmy'. ls_data-package = iv_package. CREATE OBJECT mo_repo_online EXPORTING is_data = ls_data. ENDMETHOD. METHOD given_check_variant. mv_check_variant = iv_check_variant. mo_repo_online->ms_data-local_settings-code_inspector_check_variant = iv_check_variant. ENDMETHOD. METHOD given_mock_code_inspector. DATA: lo_mock_code_inspector TYPE REF TO ltcl_code_inspector. CREATE OBJECT lo_mock_code_inspector EXPORTING iv_package = iv_package. zcl_abapgit_injector=>set_code_inspector( iv_package = iv_package iv_check_variant_name = iv_check_variant ii_code_inspector = lo_mock_code_inspector ). ENDMETHOD. METHOD push_not_possible_if_ci_req. given_online_repo( '$PACKAGE' ). given_check_variant( |variant| ). given_block_commit( abap_true ). when_push( ). then_exception_text_is( |A successful code inspection is required| ). ENDMETHOD. METHOD given_block_commit. mo_repo_online->ms_data-local_settings-block_commit = abap_true. ENDMETHOD. METHOD when_push. DATA: ls_comment TYPE zif_abapgit_definitions=>ty_comment, lo_stage TYPE REF TO zcl_abapgit_stage, lx_error TYPE REF TO zcx_abapgit_exception. CREATE OBJECT lo_stage. TRY. mo_repo_online->push( is_comment = ls_comment io_stage = lo_stage ). CATCH zcx_abapgit_exception INTO lx_error. mv_error_text = lx_error->get_text( ). ENDTRY. ENDMETHOD. METHOD then_exception_text_is. cl_abap_unit_assert=>assert_equals( exp = iv_exp_error_text act = mv_error_text ). ENDMETHOD. METHOD when_run_code_inspector. DATA: lx_error TYPE REF TO zcx_abapgit_exception. TRY. mt_act_list = mo_repo_online->run_code_inspector( |{ mv_check_variant }| ). CATCH zcx_abapgit_exception INTO lx_error. mv_error_text = lx_error->get_text( ). ENDTRY. ENDMETHOD. METHOD then_ci_detected_an_error. READ TABLE mt_act_list TRANSPORTING NO FIELDS WITH KEY kind = 'E'. cl_abap_unit_assert=>assert_subrc( exp = 0 ). ENDMETHOD. METHOD then_no_exception_is_raised. cl_abap_unit_assert=>assert_initial( mv_error_text ). ENDMETHOD. ENDCLASS.
22.303279
95
0.68982
98b5324c0de8a19ea2515ab7d66fa91ebea61e4c
4,657
abap
ABAP
src/checks/y_check_is_interface_in_class.clas.testclasses.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_is_interface_in_class.clas.testclasses.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_is_interface_in_class.clas.testclasses.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
CLASS ltc_class DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_class IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_is_interface_in_class( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( 'REPORT ut_repo.' ) ( 'CLASS lcl_classname DEFINITION.' ) ( ' PUBLIC SECTION.' ) ( ' METHODS publ_method.' ) ( ' PROTECTED SECTION.' ) ( ' PRIVATE SECTION.' ) ( 'ENDCLASS.' ) ( 'CLASS lcl_classname IMPLEMENTATION.' ) ( ' METHOD publ_method.' ) ( ' ENDMETHOD.' ) ( 'ENDCLASS.' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( 'REPORT ut_repo.' ) ( 'CLASS lcl_abstr DEFINITION ABSTRACT.' ) ( ' PUBLIC SECTION.' ) ( ' METHODS abstr_method ABSTRACT.' ) ( ' METHODS constructor.' ) ( 'ENDCLASS.' ) ( 'CLASS lcl_abstr IMPLEMENTATION.' ) ( ' METHOD constructor.' ) ( ' ENDMETHOD.' ) ( 'ENDCLASS.' ) ( 'CLASS lcl_inh_abstr DEFINITION INHERITING FROM lcl_abstr.' ) ( ' PUBLIC SECTION.' ) ( ' METHODS abstr_method REDEFINITION.' ) ( ' METHODS constructor.' ) ( ' PROTECTED SECTION.' ) ( ' METHODS prot_method.' ) ( ' PRIVATE SECTION.' ) ( ' METHODS priv_method.' ) ( 'ENDCLASS.' ) ( 'CLASS lcl_inh_abstr IMPLEMENTATION.' ) ( ' METHOD constructor.' ) ( ' super->constructor( ).' ) ( ' ENDMETHOD.' ) ( ' METHOD abstr_method.' ) ( ' ENDMETHOD.' ) ( ' METHOD prot_method.' ) ( ' ENDMETHOD.' ) ( ' METHOD priv_method.' ) ( ' ENDMETHOD.' ) ( 'ENDCLASS.' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( 'REPORT ut_repo.' ) ( 'CLASS lcl_classname DEFINITION. "#EC INTF_IN_CLASS' ) ( ' PUBLIC SECTION.' ) ( ' METHODS publ_method.' ) ( ' PROTECTED SECTION.' ) ( ' PRIVATE SECTION.' ) ( 'ENDCLASS.' ) ( 'CLASS lcl_classname IMPLEMENTATION.' ) ( ' METHOD publ_method.' ) ( ' ENDMETHOD.' ) ( 'ENDCLASS.' ) ). ENDMETHOD. ENDCLASS. CLASS ltc_test_class DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_test_class IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_is_interface_in_class( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT ut_repo.' ) ( ' CLASS lcl_classname DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.' ) ( ' PUBLIC SECTION.' ) ( ' METHODS publ_method.' ) ( ' METHODS test_method FOR TESTING.' ) ( ' ENDCLASS.' ) ( ' CLASS lcl_classname IMPLEMENTATION.' ) ( ' METHOD publ_method.' ) ( ' ENDMETHOD.' ) ( ' METHOD test_method.' ) ( ' ENDMETHOD.' ) ( ' ENDCLASS.' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT ut_repo.' ) ( ' INTERFACE lif_classname. ' ) ( ' METHODS publ_method. ' ) ( ' ENDINTERFACE. ' ) ( ' CLASS lcl_classname DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.' ) ( ' PUBLIC SECTION.' ) ( ' INTERFACES lif_classname.' ) ( ' ALIASES publ_method FOR lif_classname~publ_method.' ) ( ' METHODS test_method FOR TESTING.' ) ( ' ENDCLASS.' ) ( ' CLASS lcl_classname IMPLEMENTATION.' ) ( ' METHOD publ_method.' ) ( ' ENDMETHOD.' ) ( ' METHOD test_method.' ) ( ' ENDMETHOD.' ) ( ' ENDCLASS.' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( 'REPORT ut_repo.' ) ( ' CLASS lcl_classname DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. "#EC INTF_IN_CLASS' ) ( ' PUBLIC SECTION.' ) ( ' METHODS publ_method.' ) ( ' METHODS test_method FOR TESTING.' ) ( ' ENDCLASS.' ) ( ' CLASS lcl_classname IMPLEMENTATION.' ) ( ' METHOD publ_method.' ) ( ' ENDMETHOD.' ) ( ' METHOD test_method.' ) ( ' ENDMETHOD.' ) ( ' ENDCLASS.' ) ). ENDMETHOD. ENDCLASS.
27.075581
112
0.588576
98b79a888e0cc4906ea6f02fbb5646f35756ba90
328
abap
ABAP
src/day05/zcl_advent2020_day05_rename.clas.abap
joltdx/abap-advent-2020-template
a1d1be1026188fa04ac864f942a8dd12d1a814e1
[ "Unlicense" ]
12
2020-11-15T10:37:25.000Z
2021-02-06T15:28:46.000Z
src/day05/zcl_advent2020_day05_rename.clas.abap
joltdx/abap-advent-2020-template
a1d1be1026188fa04ac864f942a8dd12d1a814e1
[ "Unlicense" ]
62
2020-11-25T08:25:20.000Z
2022-02-01T04:03:10.000Z
src/day05/zcl_advent2020_day05_rename.clas.abap
joltdx/abap-advent-2020-template
a1d1be1026188fa04ac864f942a8dd12d1a814e1
[ "Unlicense" ]
5
2020-11-25T05:28:48.000Z
2021-12-05T08:18:36.000Z
CLASS zcl_advent2020_day05_rename DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_advent2020_rename . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ADVENT2020_DAY05_RENAME IMPLEMENTATION. METHOD zif_advent2020_rename~solve. output = 'todo'. ENDMETHOD. ENDCLASS.
13.666667
49
0.768293
98bb0101aa19a0e2455af31f197335c5072bd038
2,452
abap
ABAP
src/data_access/zcl_dbbr_ob_fav_factory.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
15
2020-02-05T10:38:12.000Z
2022-02-11T18:06:17.000Z
src/data_access/zcl_dbbr_ob_fav_factory.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
10
2021-01-19T07:45:37.000Z
2021-07-15T19:08:54.000Z
src/data_access/zcl_dbbr_ob_fav_factory.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">Factory for managin object browser favorites</p> CLASS zcl_dbbr_ob_fav_factory DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. "! <p class="shorttext synchronized" lang="en">Get all favorites of user</p> CLASS-METHODS get_favorites RETURNING VALUE(rt_favorites) TYPE zdbbr_obj_browser_fav_t. "! <p class="shorttext synchronized" lang="en">Create new favorite</p> CLASS-METHODS create_favorite IMPORTING iv_query TYPE string iv_type TYPE zdbbr_obj_browser_mode iv_name TYPE zdbbr_objbrs_favorite_name RETURNING VALUE(rf_success) TYPE abap_bool. "! <p class="shorttext synchronized" lang="en">Changes the name of a single favorite</p> CLASS-METHODS change_favorite_name IMPORTING iv_id TYPE zdbbr_objbrs_favorite_id iv_name TYPE zdbbr_objbrs_favorite_name RETURNING VALUE(rf_success) TYPE abap_bool. "! <p class="shorttext synchronized" lang="en">Delete favorite for the given id</p> "! CLASS-METHODS delete_favorite IMPORTING iv_id TYPE zdbbr_objbrs_favorite_id RETURNING VALUE(rf_success) TYPE abap_bool. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_dbbr_ob_fav_factory IMPLEMENTATION. METHOD create_favorite. DATA(ls_favorite) = VALUE zdbbr_objbrsfav( id = zcl_sat_system_helper=>create_guid_22( ) created_by = sy-uname entity_type = iv_type favorite_name = iv_name search_string = iv_query ). INSERT zdbbr_objbrsfav FROM ls_favorite. IF sy-subrc = 0. COMMIT WORK. rf_success = abap_true. ELSE. ROLLBACK WORK. ENDIF. ENDMETHOD. METHOD get_favorites. SELECT * FROM zdbbr_objbrsfav WHERE created_by = @sy-uname ORDER BY entity_type ASCENDING INTO CORRESPONDING FIELDS OF TABLE @rt_favorites. ENDMETHOD. METHOD change_favorite_name. UPDATE zdbbr_objbrsfav SET favorite_name = iv_name WHERE id = iv_id. IF sy-subrc = 0. COMMIT WORK. rf_success = abap_true. ELSE. ROLLBACK WORK. ENDIF. ENDMETHOD. METHOD delete_favorite. DELETE FROM zdbbr_objbrsfav WHERE id = iv_id. IF sy-subrc = 0. COMMIT WORK. rf_success = abap_true. ENDIF. ENDMETHOD. ENDCLASS.
28.183908
95
0.668842
98bb0fd853a667120e439502796c93d491a4a789
4,370
abap
ABAP
src/core/zcl_markdown.clas.testclasses.abap
FreHu/zmarkdown
450c8933ca4a5f89a4e5a1a6b0dbadf6363f8c3e
[ "Unlicense" ]
1
2022-03-17T09:33:25.000Z
2022-03-17T09:33:25.000Z
src/core/zcl_markdown.clas.testclasses.abap
FreHu/zmarkdown
450c8933ca4a5f89a4e5a1a6b0dbadf6363f8c3e
[ "Unlicense" ]
6
2021-02-05T20:12:13.000Z
2021-02-13T10:44:55.000Z
src/core/zcl_markdown.clas.testclasses.abap
FreHu/zmarkdown
450c8933ca4a5f89a4e5a1a6b0dbadf6363f8c3e
[ "Unlicense" ]
null
null
null
class lcl_test definition final for testing inheriting from zcl_abap_unit_wrapper duration short risk level harmless. private section. methods: regression_test for testing raising cx_static_check. endclass. class lcl_test implementation. method regression_test. data(demo) = zcl_markdown_demo=>get( ). assert_equals( act = demo exp = |# Markdown generator - showcase\r\n| & |# Heading 1\r\n| & |## Heading 2\r\n| & |### Heading 3\r\n| & |#### Heading 4\r\n| & |##### Heading 5\r\n| & |###### Heading 6\r\n| & |This is text.\r\n| & |**This is bold text.**\r\n| & |*This is italic text.*\r\n| & |***This is italic bold text.***\r\n| & |***This is bold italic text. Carefully note the difference.***\r\n| & |*This is italic* and **this is bold.**\r\n| & |The method `zcl_mardown_style->inline_code` outputs inline code.\r\n| & |## Blockquotes\r\n| & |> # Markdown generator - showcase\r\n| & |> # Heading 1\r\n| & |> ## Heading 2\r\n| & |> ### Heading 3\r\n| & |> #### Heading 4\r\n| & |> ##### Heading 5\r\n| & |> ###### Heading 6\r\n| & |> This is text.\r\n| & |> **This is bold text.**\r\n| & |> *This is italic text.*\r\n| & |> ***This is italic bold text.***\r\n| & |> ***This is bold italic text. Carefully note the difference.***\r\n| & |> *This is italic* and **this is bold.**\r\n| & |> The method `zcl_mardown_style->inline_code` outputs inline code.\r\n| & |> ## Blockquotes\r\n| & |## Nested Blockquotes\r\n| & |> # Markdown generator - showcase\r\n| & |> # Heading 1\r\n| & |> ## Heading 2\r\n| & |> ### Heading 3\r\n| & |> #### Heading 4\r\n| & |> ##### Heading 5\r\n| & |> ###### Heading 6\r\n| & |> This is text.\r\n| & |> **This is bold text.**\r\n| & |> *This is italic text.*\r\n| & |> ***This is italic bold text.***\r\n| & |> ***This is bold italic text. Carefully note the difference.***\r\n| & |> *This is italic* and **this is bold.**\r\n| & |> The method `zcl_mardown_style->inline_code` outputs inline code.\r\n| & |> ## Blockquotes\r\n| & |> > # Markdown generator - showcase\r\n| & |> > # Heading 1\r\n| & |> > ## Heading 2\r\n| & |> > ### Heading 3\r\n| & |> > #### Heading 4\r\n| & |> > ##### Heading 5\r\n| & |> > ###### Heading 6\r\n| & |> > This is text.\r\n| & |> > **This is bold text.**\r\n| & |> > *This is italic text.*\r\n| & |> > ***This is italic bold text.***\r\n| & |> > ***This is bold italic text. Carefully note the difference.***\r\n| & |> > *This is italic* and **this is bold.**\r\n| & |> > The method `zcl_mardown_style->inline_code` outputs inline code.\r\n| & |> > ## Blockquotes\r\n| & |> ## Nested Blockquotes\r\n| & |## Unordered Lists\r\n| & |- Item 1\r\n| & |- Item 2\r\n| & |- Item 3\r\n| & |## Numbered Lists\r\n| & |1. Item 1\r\n| & |2. Item 2\r\n| & |3. Item 3\r\n| & |## Horizontal Rule\r\n| & |__________ \r\n| & |## Code blocks\r\n| & |```abap\r\n| & | )->heading( level = 2 val = `Nested Blockquotes`\r\n| & | )->blockquote( md->document\r\n| & |\r\n| & | )->heading( level = 2 val = `Unordered Lists`\r\n| & | )->list( VALUE stringtab(\r\n| & | ( `Item 1` )\r\n| & | ( `Item 2` )\r\n| & | ( `Item 3` ) )\r\n| & |\r\n| & | )->heading( level = 2 val = `Numbered Lists`\r\n| & | )->numbered_list( VALUE stringtab(\r\n| & | ( `Item 1` )\r\n| & | ( `Item 2` )\r\n| & | ( `Item 3` ) )\r\n| & | )->heading( level = 2 val = `Horizontal Rule`\r\n| & |\r\n| & | )->______________________________(\r\n| & |```\r\n| & |\| col1\| col2\| col3\| col4 \|\r\n| & |\|------\|------\|------\|------\| \r\n| & |\| a \| b \| c \| d \|\r\n| & |\| 1 \| 2 \| 3 \| 4 \|\r\n| & |\| e \| f \| g \| h \|\r\n| & |\| **bold** \| *italic* \| ***bold_italic***`code` \| \|\r\n\r\n| ). endmethod. endclass.
36.115702
82
0.457895
98bceaf1ed340e96fec5dc468b8b339b6a806b25
11,596
abap
ABAP
src/ui/zcl_abapgit_hotkeys.clas.abap
RedWolf112/abapGit
4420de02971a3a61f3c526c2778a9ff669d21a0a
[ "MIT" ]
1
2020-08-05T05:25:41.000Z
2020-08-05T05:25:41.000Z
src/ui/zcl_abapgit_hotkeys.clas.abap
RedWolf112/abapGit
4420de02971a3a61f3c526c2778a9ff669d21a0a
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_hotkeys.clas.abap
RedWolf112/abapGit
4420de02971a3a61f3c526c2778a9ff669d21a0a
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_hotkeys DEFINITION PUBLIC FINAL INHERITING FROM zcl_abapgit_gui_component CREATE PUBLIC . PUBLIC SECTION. INTERFACES: zif_abapgit_gui_hotkey_ctl, zif_abapgit_gui_hotkeys, zif_abapgit_gui_renderable. CONSTANTS: c_showhotkeys_action TYPE string VALUE `showHotkeys` ##NO_TEXT. CLASS-METHODS: get_all_default_hotkeys RETURNING VALUE(rt_hotkey_actions) TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr RAISING zcx_abapgit_exception, merge_hotkeys_with_settings CHANGING ct_hotkey_actions TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr RAISING zcx_abapgit_exception. CLASS-METHODS: should_show_hint RETURNING VALUE(rv_yes) TYPE abap_bool. PROTECTED SECTION. PRIVATE SECTION. DATA: mt_hotkey_providers TYPE TABLE OF REF TO zif_abapgit_gui_hotkeys . CLASS-DATA gv_hint_was_shown TYPE abap_bool . CLASS-DATA gt_interface_implementations TYPE saboo_iimpt . CLASS-METHODS filter_relevant_classes IMPORTING !it_classes TYPE seo_relkeys RETURNING VALUE(rt_classes) TYPE seo_relkeys . CLASS-METHODS get_class_package IMPORTING !iv_class_name TYPE seoclsname RETURNING VALUE(rv_package) TYPE devclass . CLASS-METHODS get_referred_class_name IMPORTING !io_ref TYPE any RETURNING VALUE(rv_name) TYPE seoclsname . CLASS-METHODS get_hotkeys_by_class_name IMPORTING !iv_class_name TYPE seoclsname RETURNING VALUE(rt_hotkeys) TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr . CLASS-METHODS get_hotkeys_from_global_intf RETURNING VALUE(rt_hotkeys) TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr RAISING zcx_abapgit_exception . CLASS-METHODS get_hotkeys_from_local_intf RETURNING VALUE(rt_hotkeys) TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr RAISING zcx_abapgit_exception . CLASS-METHODS get_local_intf_implementations RETURNING VALUE(rt_interface_implementations) TYPE saboo_iimpt RAISING zcx_abapgit_exception . METHODS render_scripts IMPORTING !it_hotkeys TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . ENDCLASS. CLASS ZCL_ABAPGIT_HOTKEYS IMPLEMENTATION. METHOD filter_relevant_classes. DATA lv_this_class_name TYPE seoclsname. DATA lv_this_class_pkg TYPE devclass. DATA lv_class_pkg TYPE devclass. DATA lo_dummy TYPE REF TO zcl_abapgit_hotkeys. FIELD-SYMBOLS <ls_class> LIKE LINE OF it_classes. lv_this_class_name = get_referred_class_name( lo_dummy ). lv_this_class_pkg = get_class_package( lv_this_class_name ). LOOP AT it_classes ASSIGNING <ls_class>. lv_class_pkg = get_class_package( <ls_class>-clsname ). IF lv_class_pkg = lv_this_class_pkg. APPEND <ls_class> TO rt_classes. ENDIF. ENDLOOP. ENDMETHOD. METHOD get_all_default_hotkeys. IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_true. rt_hotkey_actions = get_hotkeys_from_local_intf( ). ELSE. rt_hotkey_actions = get_hotkeys_from_global_intf( ). ENDIF. ENDMETHOD. METHOD get_class_package. SELECT SINGLE devclass FROM tadir INTO rv_package WHERE pgmid = 'R3TR' AND object = 'CLAS' AND obj_name = iv_class_name. ENDMETHOD. METHOD get_hotkeys_by_class_name. CALL METHOD (iv_class_name)=>zif_abapgit_gui_hotkeys~get_hotkey_actions RECEIVING rt_hotkey_actions = rt_hotkeys. ENDMETHOD. METHOD get_hotkeys_from_global_intf. DATA: lt_hotkey_actions LIKE rt_hotkeys, lo_interface TYPE REF TO cl_oo_interface, li_dummy TYPE REF TO zif_abapgit_gui_hotkeys, lt_classes TYPE seo_relkeys. FIELD-SYMBOLS: <ls_class> LIKE LINE OF lt_classes. TRY. lo_interface ?= cl_oo_class=>get_instance( get_referred_class_name( li_dummy ) ). CATCH cx_class_not_existent. RETURN. ENDTRY. lt_classes = lo_interface->get_implementing_classes( ). lt_classes = filter_relevant_classes( lt_classes ). " For security reasons LOOP AT lt_classes ASSIGNING <ls_class>. lt_hotkey_actions = get_hotkeys_by_class_name( <ls_class>-clsname ). INSERT LINES OF lt_hotkey_actions INTO TABLE rt_hotkeys. ENDLOOP. ENDMETHOD. METHOD get_hotkeys_from_local_intf. DATA lt_hotkey_actions LIKE rt_hotkeys. DATA lt_interface_implementations TYPE saboo_iimpt. FIELD-SYMBOLS <ls_intf_implementation> LIKE LINE OF lt_interface_implementations. DATA lv_hotkeys_class_name LIKE <ls_intf_implementation>-refclsname. DATA li_dummy TYPE REF TO zif_abapgit_gui_hotkeys. lv_hotkeys_class_name = get_referred_class_name( li_dummy ). lt_interface_implementations = get_local_intf_implementations( ). LOOP AT lt_interface_implementations ASSIGNING <ls_intf_implementation> WHERE refclsname = lv_hotkeys_class_name. lt_hotkey_actions = get_hotkeys_by_class_name( <ls_intf_implementation>-clsname ). INSERT LINES OF lt_hotkey_actions INTO TABLE rt_hotkeys. ENDLOOP. ENDMETHOD. METHOD get_local_intf_implementations. DATA: ls_type_infos TYPE saboo_vseot, lt_method_implementations TYPE saboo_method_impl_tab, lt_source TYPE saboo_sourt. IF gt_interface_implementations IS INITIAL. READ REPORT sy-cprog INTO lt_source. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Cannot read { sy-cprog }| ). ENDIF. CALL FUNCTION 'SCAN_ABAP_OBJECTS_CLASSES' CHANGING vseo_tabs = ls_type_infos method_impls = lt_method_implementations sourc_tab = lt_source EXCEPTIONS scan_abap_source_error = 1 scan_abap_src_line_too_long = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. gt_interface_implementations = ls_type_infos-iimpl_tab. ENDIF. rt_interface_implementations = gt_interface_implementations. ENDMETHOD. METHOD get_referred_class_name. DATA lo_ref TYPE REF TO cl_abap_refdescr. lo_ref ?= cl_abap_typedescr=>describe_by_data( io_ref ). rv_name = lo_ref->get_referenced_type( )->get_relative_name( ). ENDMETHOD. METHOD merge_hotkeys_with_settings. DATA lt_user_defined_hotkeys TYPE zif_abapgit_definitions=>tty_hotkey. FIELD-SYMBOLS <ls_hotkey> LIKE LINE OF ct_hotkey_actions. FIELD-SYMBOLS <ls_user_defined_hotkey> LIKE LINE OF lt_user_defined_hotkeys. lt_user_defined_hotkeys = zcl_abapgit_persist_settings=>get_instance( )->read( )->get_hotkeys( ). LOOP AT ct_hotkey_actions ASSIGNING <ls_hotkey>. READ TABLE lt_user_defined_hotkeys ASSIGNING <ls_user_defined_hotkey> WITH TABLE KEY action COMPONENTS ui_component = <ls_hotkey>-ui_component action = <ls_hotkey>-action. IF sy-subrc = 0. <ls_hotkey>-hotkey = <ls_user_defined_hotkey>-hotkey. ENDIF. ENDLOOP. ENDMETHOD. METHOD render_scripts. DATA lv_json TYPE string. DATA lt_hotkeys TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr. FIELD-SYMBOLS: <ls_hotkey> LIKE LINE OF lt_hotkeys. lv_json = `{`. LOOP AT it_hotkeys ASSIGNING <ls_hotkey>. IF sy-tabix > 1. lv_json = lv_json && |,|. ENDIF. lv_json = lv_json && | "{ <ls_hotkey>-hotkey }" : "{ <ls_hotkey>-action }" |. ENDLOOP. lv_json = lv_json && `}`. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ). ri_html->add( |setKeyBindings({ lv_json });| ). ENDMETHOD. METHOD should_show_hint. IF gv_hint_was_shown = abap_false. rv_yes = abap_true. gv_hint_was_shown = abap_true. ENDIF. ENDMETHOD. METHOD zif_abapgit_gui_hotkeys~get_hotkey_actions. DATA ls_hotkey LIKE LINE OF rt_hotkey_actions. ls_hotkey-ui_component = 'Hotkeys'. ls_hotkey-action = c_showhotkeys_action. ls_hotkey-description = 'Show hotkeys help'. ls_hotkey-hotkey = '?'. INSERT ls_hotkey INTO TABLE rt_hotkey_actions. ENDMETHOD. METHOD zif_abapgit_gui_hotkey_ctl~get_registered_hotkeys. DATA li_hotkey_provider LIKE LINE OF mt_hotkey_providers. DATA lt_hotkeys LIKE rt_registered_hotkeys. FIELD-SYMBOLS <ls_hotkey> LIKE LINE OF lt_hotkeys. LOOP AT mt_hotkey_providers INTO li_hotkey_provider. APPEND LINES OF li_hotkey_provider->get_hotkey_actions( ) TO lt_hotkeys. ENDLOOP. merge_hotkeys_with_settings( CHANGING ct_hotkey_actions = lt_hotkeys ). " Compress duplicates LOOP AT lt_hotkeys ASSIGNING <ls_hotkey>. READ TABLE rt_registered_hotkeys WITH KEY hotkey = <ls_hotkey>-hotkey TRANSPORTING NO FIELDS. IF sy-subrc = 0. " If found command with same hotkey DELETE rt_registered_hotkeys INDEX sy-tabix. " Later registered commands enjoys the priority ENDIF. APPEND <ls_hotkey> TO rt_registered_hotkeys. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_gui_hotkey_ctl~register_hotkeys. IF ii_hotkeys IS BOUND. APPEND ii_hotkeys TO mt_hotkey_providers. ENDIF. ENDMETHOD. METHOD zif_abapgit_gui_hotkey_ctl~reset. CLEAR mt_hotkey_providers. ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. DATA: lv_hint TYPE string, lt_registered_hotkeys TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr, lv_hotkey TYPE string. FIELD-SYMBOLS <ls_hotkey> LIKE LINE OF lt_registered_hotkeys. zif_abapgit_gui_hotkey_ctl~register_hotkeys( me ). CREATE OBJECT ri_html TYPE zcl_abapgit_html. lt_registered_hotkeys = zif_abapgit_gui_hotkey_ctl~get_registered_hotkeys( ). SORT lt_registered_hotkeys BY ui_component description. register_deferred_script( render_scripts( lt_registered_hotkeys ) ). " Render hotkeys ri_html->add( '<ul class="hotkeys">' ). LOOP AT lt_registered_hotkeys ASSIGNING <ls_hotkey>. ri_html->add( |<li>| && |<span class="key-id">{ <ls_hotkey>-hotkey }</span>| && |<span class="key-descr">{ <ls_hotkey>-description }</span>| && |</li>| ). ENDLOOP. ri_html->add( '</ul>' ). CLEAR lv_hotkey. READ TABLE lt_registered_hotkeys ASSIGNING <ls_hotkey> WITH KEY action = c_showhotkeys_action. IF sy-subrc = 0. lv_hotkey = <ls_hotkey>-hotkey. ENDIF. lv_hint = |Close window with upper right corner 'X'|. IF lv_hotkey IS NOT INITIAL. lv_hint = lv_hint && | or '{ <ls_hotkey>-hotkey }'|. ENDIF. ri_html = zcl_abapgit_gui_chunk_lib=>render_infopanel( iv_div_id = 'hotkeys' iv_title = 'Hotkeys' iv_hint = lv_hint iv_hide = abap_true iv_scrollable = abap_false io_content = ri_html ). IF lv_hotkey IS NOT INITIAL AND should_show_hint( ) = abap_true. ri_html->add( |<div id="hotkeys-hint" class="corner-hint">| && |Press '{ <ls_hotkey>-hotkey }' to get keyboard shortcuts list| && |</div>| ). ENDIF. ENDMETHOD. ENDCLASS.
29.356962
117
0.699983