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
sequencelengths 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
sequencelengths 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
sequencelengths 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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
791cfd08dad66a0617d059aaef60459d770900fd | 2,578 | abap | ABAP | src/ixml/if_ixml_element.intf.abap | pokrakam/deps | 24f51311310887700c41f13c1eee306c3f8acc8b | [
"MIT"
] | null | null | null | src/ixml/if_ixml_element.intf.abap | pokrakam/deps | 24f51311310887700c41f13c1eee306c3f8acc8b | [
"MIT"
] | null | null | null | src/ixml/if_ixml_element.intf.abap | pokrakam/deps | 24f51311310887700c41f13c1eee306c3f8acc8b | [
"MIT"
] | null | null | null | INTERFACE if_ixml_element PUBLIC.
INTERFACES if_ixml_node.
METHODS:
remove_attribute_ns
IMPORTING foo TYPE string,
get_attributes
RETURNING VALUE(attr) TYPE REF TO if_ixml_named_node_map,
get_next
RETURNING VALUE(next) TYPE REF TO if_ixml_element,
get_name
RETURNING VALUE(name) TYPE string,
append_child
IMPORTING
new_child TYPE REF TO if_ixml_element
RETURNING
VALUE(rc) TYPE i,
clone
RETURNING VALUE(val) TYPE REF TO if_ixml_node,
create_filter_node_type
IMPORTING name TYPE string
RETURNING VALUE(val) TYPE REF TO any,
create_iterator
RETURNING VALUE(val) TYPE REF TO if_ixml_node_iterator,
find_from_name_ns
IMPORTING
name TYPE string
namespace TYPE string OPTIONAL
depth TYPE i OPTIONAL
RETURNING VALUE(val) TYPE REF TO if_ixml_element,
find_from_name
IMPORTING
name TYPE string
namespace TYPE string OPTIONAL
depth TYPE i OPTIONAL
RETURNING VALUE(val) TYPE REF TO if_ixml_element,
get_attribute_node
IMPORTING name TYPE string
RETURNING VALUE(val) TYPE REF TO if_ixml_attribute,
get_attribute_ns
IMPORTING
name TYPE string
RETURNING VALUE(val) TYPE string,
get_attribute
IMPORTING
name TYPE string
namespace TYPE string OPTIONAL
RETURNING VALUE(val) TYPE string,
get_children
RETURNING VALUE(val) TYPE REF TO if_ixml_node_list,
get_elements_by_tag_name
IMPORTING
name TYPE string
namespace TYPE string OPTIONAL
RETURNING
VALUE(val) TYPE any,
get_elements_by_tag_name_ns
IMPORTING name TYPE string
RETURNING VALUE(val) TYPE any,
get_first_child
RETURNING VALUE(val) TYPE REF TO if_ixml_node,
get_value
RETURNING VALUE(val) TYPE string,
remove_attribute
IMPORTING name TYPE string,
remove_node,
remove_child
IMPORTING
old_child TYPE REF TO if_ixml_element,
render
IMPORTING
ostream TYPE any,
set_attribute_node_ns
IMPORTING
attr TYPE any,
set_attribute_node
IMPORTING
attr TYPE any,
set_attribute
IMPORTING
name TYPE string
namespace TYPE string OPTIONAL
value TYPE string,
set_attribute_ns
IMPORTING
name TYPE string
prefix TYPE string OPTIONAL
value TYPE string,
set_value
IMPORTING
value TYPE string
RETURNING VALUE(rc) TYPE i.
ENDINTERFACE. | 27.72043 | 63 | 0.676106 |
792074cd2e884059ca79f9e025f891c7f9c95f0b | 7,394 | abap | ABAP | src/yabap2google_core/yabap2google_rule/ycl_a2g_simple_rule.clas.abap | dwilhelmi96/abap2gsheet | d531c17e1c06c9d6149b20f037486a5f726e433f | [
"Apache-2.0"
] | 14 | 2020-01-13T13:14:24.000Z | 2022-02-22T21:39:12.000Z | src/yabap2google_core/yabap2google_rule/ycl_a2g_simple_rule.clas.abap | dwilhelmi96/abap2gsheet | d531c17e1c06c9d6149b20f037486a5f726e433f | [
"Apache-2.0"
] | 2 | 2020-01-14T13:39:50.000Z | 2021-08-24T13:22:10.000Z | src/yabap2google_core/yabap2google_rule/ycl_a2g_simple_rule.clas.abap | dwilhelmi96/abap2gsheet | d531c17e1c06c9d6149b20f037486a5f726e433f | [
"Apache-2.0"
] | 4 | 2020-01-28T09:35:58.000Z | 2021-06-02T18:45:34.000Z | "!<h1>YIF_A2G_SIMPLE_RULE</h1>
"! <p class="shorttext synchronized" lang="en">Cmp. Appl - Abap 2 Google - Simple Rule</p>
"!<p>This class in an abstract class for all simple checks class needs.</p>
CLASS ycl_a2g_simple_rule DEFINITION
PUBLIC
ABSTRACT
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES yif_a2g_rule .
"! This Method create the instance ( User the Factory class to instantiate all class
"! @parameter if_msg_manager | Cmp. Appl. - Abap 2 Google - Message Manager interface
METHODS constructor
IMPORTING
!if_msg_manager TYPE REF TO yif_a2g_msg_manager OPTIONAL .
"! True
CONSTANTS gc_true TYPE oax VALUE 'X' ##NO_TEXT.
"! False
CONSTANTS gc_false TYPE oax VALUE ' ' ##NO_TEXT.
PROTECTED SECTION.
"! Flag data changed
DATA is_changed TYPE oax VALUE ' ' ##NO_TEXT.
"! Array for dependant instance for top down checks
DATA go_dependant TYPE REF TO ycl_a2g_array .
"! Message manager
DATA gif_msg_manager TYPE REF TO yif_a2g_msg_manager .
"! Filed old value
DATA old_value TYPE REF TO data .
"! FActory for rule management
DATA go_rule_factory TYPE REF TO ycl_a2g_rule_factory .
"! name of the field to check
DATA gv_fieldname TYPE string .
"! Mandatary fields
DATA gv_mandatary TYPE oax .
"! Constats to individuate the Observer
CONSTANTS gc_observ TYPE string VALUE 'Observ' ##NO_TEXT.
"! Constats to individuate the precondition
CONSTANTS gc_precon TYPE string VALUE 'Precond' ##NO_TEXT.
"! This Method Checks the validity of the checks
"! @parameter if_context | Context od data checks
"! @raising ycx_a2g_rule | Rule Exception
METHODS is_valid ABSTRACT
IMPORTING !if_context TYPE REF TO yif_a2g_context
RAISING ycx_a2g_rule .
"! This Method Checks if the input is changed
"! @parameter if_context | Context of data checks
"! @parameter return | identify if there are some changes
METHODS has_input_changed ABSTRACT
IMPORTING !if_context TYPE REF TO yif_a2g_context
RETURNING VALUE(return) TYPE oax .
"! This Method get the dependencies of the checks
METHODS get_dependencies .
"! This Method Add the precondition to the class
"! @parameter if_rule | Instance of the checks to add as precondition
METHODS add_precondition
IMPORTING !if_rule TYPE REF TO yif_a2g_rule .
"! This Method checks il the field is mandatary
"! @parameter if_context | Context of data checks
"! @raising ycx_a2g_rule | Rule Exception field is manadatary
METHODS is_mandatary
IMPORTING !if_context TYPE REF TO yif_a2g_context
RAISING ycx_a2g_rule .
PRIVATE SECTION.
"! Internal progressive ids
DATA gv_num TYPE numc4 .
"! This Method give back the next free number
"! @parameter return | Next IDs
METHODS get_next_number
RETURNING VALUE(return) TYPE numc4 .
ENDCLASS.
CLASS ycl_a2g_simple_rule IMPLEMENTATION.
METHOD add_precondition.
"& Declaration Part
DATA: lv_name TYPE string.
DATA: lo_object TYPE REF TO object.
"& Source Part
DATA(lv_seqno) = me->get_next_number( ).
lv_name = me->gc_precon && lv_seqno.
lo_object ?= if_rule.
me->go_dependant->setinstance( im_name = lv_name
im_object = lo_object ).
ENDMETHOD. "add_precondition
METHOD constructor.
"& Declaration Part
"& Source Part
me->gif_msg_manager ?= if_msg_manager.
me->go_dependant = NEW #( ).
ENDMETHOD. "constructor
METHOD get_dependencies.
ENDMETHOD. "GET_DEPENDENCIES
METHOD get_next_number.
"& Declaration Part
"& Source Part
ADD 1 TO me->gv_num.
return = me->gv_num.
ENDMETHOD. "GET_NEXT_NUMBER
METHOD is_mandatary.
"& Declaration Part
FIELD-SYMBOLS <fs_ref_check> TYPE any.
DATA: ls_t100key TYPE scx_t100key.
"& Source Part
IF me->gv_mandatary = me->gc_true.
ASSIGN old_value->* TO <fs_ref_check>.
CHECK sy-subrc = 0.
IF <fs_ref_check> IS INITIAL.
ls_t100key-msgid = 'YA2GRULE'.
ls_t100key-msgno = '000'.
ls_t100key-attr1 = me->gv_fieldname.
me->gif_msg_manager->register( im_t100key = ls_t100key
im_msgty = me->gif_msg_manager->gc_error ).
RAISE EXCEPTION TYPE ycx_a2g_rule
EXPORTING
textid = ls_t100key.
ENDIF.
ENDIF.
ENDMETHOD. "is_mandatary
METHOD yif_a2g_rule~assign_dependencies.
"& Declaration Part
DATA: lif_rule TYPE REF TO yif_a2g_rule.
"& Source Part
me->go_rule_factory ?= io_rule_factory.
me->gv_fieldname = i_fieldname.
lif_rule ?= me.
me->go_rule_factory->register_rule_for_field( if_rule = lif_rule
i_fieldname = me->gv_fieldname ).
me->go_rule_factory->set_scope( i_scope = me->go_rule_factory->gc_scope_full
if_rule = lif_rule ).
ENDMETHOD. "yif_a2g_rule~assign_dependencies
METHOD yif_a2g_rule~attach.
"& Declaration Part
DATA: lv_name TYPE string,
lo_object TYPE REF TO object.
"& Source Part
IF if_rule IS BOUND.
DATA(lv_seqno) = me->get_next_number( ).
lv_name = me->gc_observ && lv_seqno.
lo_object ?= if_rule.
me->go_dependant->setinstance( im_name = lv_name
im_object = lo_object ).
ENDIF.
ENDMETHOD. "yif_a2g_rule~attach
METHOD yif_a2g_rule~execute.
"& Declaration Part
DATA: lv_changed TYPE oax.
DATA: lif_rule TYPE REF TO yif_a2g_rule.
DATA: lv_exist TYPE xfeld.
"& Source Part
IF i_recheck = me->gc_true.
lv_changed = i_recheck.
ELSE.
lv_changed = me->has_input_changed( i_context ).
ENDIF.
IF lv_changed = me->gc_true.
*** Check precoditions
TRY.
LOOP AT me->go_dependant->getpartnamesofinstances( im_substr = me->gc_precon ) INTO DATA(lv_name) .
CAST yif_a2g_rule( me->go_dependant->getinstance( lv_name ) )->execute( i_context ).
ENDLOOP.
me->is_valid( i_context ).
me->is_mandatary( i_context ).
* Waterfall checks.
LOOP AT me->go_dependant->getpartnamesofinstances( im_substr = me->gc_observ ) INTO lv_name.
TRY.
CAST yif_a2g_rule( me->go_dependant->getinstance( lv_name ) )->execute( i_context = i_context
i_recheck = 'X' ).
CATCH ycx_a2g_rule INTO DATA(ox_rule).
*** Missing .... Register error after waterfall checks. after raise ycx_a2g_rule excption again
ENDTRY.
ENDLOOP.
CATCH ycx_a2g_rule INTO ox_rule.
RAISE EXCEPTION TYPE ycx_a2g_rule
EXPORTING
textid = ox_rule->if_t100_message~t100key.
ENDTRY.
ENDIF.
ENDMETHOD. "yif_a2g_rule~execute
METHOD yif_a2g_rule~set_mandatary.
"& Declaration Part
"& Source Part
me->gv_mandatary = 'X'.
ENDMETHOD. "yif_a2g_rule~SET_MANDATARY
ENDCLASS.
| 31.46383 | 109 | 0.63281 |
7922fdfa557eee23b89fda8d078beb7f7991c563 | 1,993 | abap | ABAP | src/zcl_excel_range.clas.abap | rotda/abap2xlsx | 45e11a380943c425a5c8b350e2e506ec3fd46d9c | [
"Apache-2.0"
] | 1 | 2021-04-30T19:32:09.000Z | 2021-04-30T19:32:09.000Z | src/zcl_excel_range.clas.abap | rotda/abap2xlsx | 45e11a380943c425a5c8b350e2e506ec3fd46d9c | [
"Apache-2.0"
] | null | null | null | src/zcl_excel_range.clas.abap | rotda/abap2xlsx | 45e11a380943c425a5c8b350e2e506ec3fd46d9c | [
"Apache-2.0"
] | 1 | 2021-03-17T14:34:50.000Z | 2021-03-17T14:34:50.000Z | class ZCL_EXCEL_RANGE definition
public
final
create public .
*"* public components of class ZCL_EXCEL_RANGE
*"* do not include other source files here!!!
public section.
constants GCV_PRINT_TITLE_NAME type STRING value '_xlnm.Print_Titles'. "#EC NOTEXT
data NAME type ZEXCEL_RANGE_NAME .
data GUID type ZEXCEL_RANGE_GUID .
methods GET_GUID
returning
value(EP_GUID) type ZEXCEL_RANGE_GUID .
methods SET_VALUE
importing
!IP_SHEET_NAME type ZEXCEL_SHEET_TITLE
!IP_START_ROW type ZEXCEL_CELL_ROW
!IP_START_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA
!IP_STOP_ROW type ZEXCEL_CELL_ROW
!IP_STOP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA .
methods GET_VALUE
returning
value(EP_VALUE) type ZEXCEL_RANGE_VALUE .
methods SET_RANGE_VALUE
importing
!IP_VALUE type ZEXCEL_RANGE_VALUE .
*"* protected components of class ZABAP_EXCEL_WORKSHEET
*"* do not include other source files here!!!
protected section.
*"* private components of class ZCL_EXCEL_RANGE
*"* do not include other source files here!!!
private section.
data VALUE type ZEXCEL_RANGE_VALUE .
ENDCLASS.
CLASS ZCL_EXCEL_RANGE IMPLEMENTATION.
method GET_GUID.
ep_guid = me->guid.
endmethod.
method GET_VALUE.
ep_value = me->value.
endmethod.
method SET_RANGE_VALUE.
me->value = ip_value.
endmethod.
method SET_VALUE.
DATA: lv_start_row_c TYPE char7,
lv_stop_row_c TYPE char7,
lv_value TYPE string.
lv_stop_row_c = ip_stop_row.
SHIFT lv_stop_row_c RIGHT DELETING TRAILING space.
SHIFT lv_stop_row_c LEFT DELETING LEADING space.
lv_start_row_c = ip_start_row.
SHIFT lv_start_row_c RIGHT DELETING TRAILING space.
SHIFT lv_start_row_c LEFT DELETING LEADING space.
lv_value = ip_sheet_name.
me->value = zcl_excel_common=>escape_string( ip_value = lv_value ).
CONCATENATE me->value '!$' ip_start_column '$' lv_start_row_c ':$' ip_stop_column '$' lv_stop_row_c INTO me->value.
endmethod.
ENDCLASS.
| 24.9125 | 117 | 0.753136 |
792fc41b54052a4f1ac0466345dae6b975c62859 | 989 | abap | ABAP | src/oea/zif_advoat_c_oea.intf.abap | stockbal/abap-object-analysis-tools | a0619eb31a18a2469b491ed24ff913ca989b5bb5 | [
"MIT"
] | 1 | 2021-05-09T12:46:26.000Z | 2021-05-09T12:46:26.000Z | src/oea/zif_advoat_c_oea.intf.abap | stockbal/abap-object-analysis-tools | a0619eb31a18a2469b491ed24ff913ca989b5bb5 | [
"MIT"
] | null | null | null | src/oea/zif_advoat_c_oea.intf.abap | stockbal/abap-object-analysis-tools | a0619eb31a18a2469b491ed24ff913ca989b5bb5 | [
"MIT"
] | null | null | null | "! <p class="shorttext synchronized" lang="en">Constants for object environment analysis</p>
INTERFACE zif_advoat_c_oea
PUBLIC .
CONSTANTS:
"! <p class="shorttext synchronized" lang="en">Aggregation level for object environment</p>
BEGIN OF c_aggregation_level,
by_type TYPE zif_advoat_ty_oea=>ty_aggregation_level VALUE '1',
by_calling_object TYPE zif_advoat_ty_oea=>ty_aggregation_level VALUE '2',
END OF c_aggregation_level.
CONSTANTS:
"! <p class="shorttext synchronized" lang="en">Mode for object environment analysis</p>
BEGIN OF c_analysis_mode,
"! Analysis of used objects
by_object TYPE zif_advoat_ty_oea=>ty_analysis_mode VALUE '1',
"! Analysis results are aggregated to get an overview which packages a given
"! package is using <br/>
"! This is useful to detect any package violations
by_package TYPE zif_advoat_ty_oea=>ty_analysis_mode VALUE '2',
END OF c_analysis_mode.
ENDINTERFACE.
| 43 | 95 | 0.73003 |
7936ea1f87b299165106c7a4a7be016cb72fc5a0 | 5,130 | abap | ABAP | src/zcl_abapgit_migrations.clas.abap | RainerWinkler/abapGit | 03dca5625f4b99753a33b4b5642bf9558f2c7454 | [
"MIT"
] | null | null | null | src/zcl_abapgit_migrations.clas.abap | RainerWinkler/abapGit | 03dca5625f4b99753a33b4b5642bf9558f2c7454 | [
"MIT"
] | null | null | null | src/zcl_abapgit_migrations.clas.abap | RainerWinkler/abapGit | 03dca5625f4b99753a33b4b5642bf9558f2c7454 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_migrations DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS run
RAISING zcx_abapgit_exception.
PRIVATE SECTION.
CLASS-METHODS rebuild_local_checksums_161112
RAISING
zcx_abapgit_exception .
CLASS-METHODS local_dot_abapgit
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_MIGRATIONS IMPLEMENTATION.
METHOD local_dot_abapgit.
DATA: lt_repos TYPE zif_abapgit_definitions=>ty_repo_ref_tt,
lv_shown TYPE abap_bool,
lo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit,
lv_txt1 TYPE string,
lv_txt2 TYPE string,
lx_exception TYPE REF TO zcx_abapgit_exception.
FIELD-SYMBOLS: <lo_repo> LIKE LINE OF lt_repos.
lt_repos = zcl_abapgit_repo_srv=>get_instance( )->list( ).
LOOP AT lt_repos ASSIGNING <lo_repo>.
lo_dot_abapgit = <lo_repo>->get_dot_abapgit( ).
IF lo_dot_abapgit->get_data( ) IS INITIAL.
IF <lo_repo>->is_offline( ) = abap_true.
lo_dot_abapgit = zcl_abapgit_dot_abapgit=>build_default( ).
ELSE.
IF lv_shown = abap_false.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Migration'
txt1 = '.abapgit.xml is migrated to local state'
txt2 = 'Login to remote repositories if needed'.
lv_shown = abap_true.
ENDIF.
" Skip repos that cannot be fetched.
" Particuarly useful on systems where users do not allow
" everybody to fetch their repos.
TRY.
<lo_repo>->refresh( ).
CATCH zcx_abapgit_exception INTO lx_exception.
lv_txt1 = lx_exception->get_text( ).
lv_txt2 = |Please do not use the "{ <lo_repo>->get_name( ) }" repository until migrated|.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Migration has failed'
txt1 = lv_txt1
txt2 = lv_txt2
txt3 = 'You will be prompted to migrate the repository every time you run abapGit.'
txt4 = 'You can safely remove the repository in its ''Advanced -> Remove'' menu.'.
CONTINUE.
ENDTRY.
lo_dot_abapgit = <lo_repo>->find_remote_dot_abapgit( ).
IF lo_dot_abapgit IS INITIAL. " .abapgit.xml is not in the remote repo yet
lo_dot_abapgit = zcl_abapgit_dot_abapgit=>build_default( ).
ENDIF.
ENDIF.
<lo_repo>->set_dot_abapgit( lo_dot_abapgit ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD rebuild_local_checksums_161112.
DATA: lt_repos TYPE zif_abapgit_definitions=>ty_repo_ref_tt,
lv_repo_list TYPE string,
lv_question TYPE string,
lv_answer TYPE c,
lv_index TYPE i,
lo_repo TYPE REF TO zcl_abapgit_repo_online.
FIELD-SYMBOLS: <lo_repo> LIKE LINE OF lt_repos.
lt_repos = zcl_abapgit_repo_srv=>get_instance( )->list( ).
LOOP AT lt_repos ASSIGNING <lo_repo>.
lv_index = sy-tabix.
IF <lo_repo>->is_offline( ) = abap_true. " Skip local repos
DELETE lt_repos INDEX lv_index.
CONTINUE.
ENDIF.
" Ignore empty repos or repos with file checksums
IF lines( <lo_repo>->get_local_checksums( ) ) = 0
OR lines( <lo_repo>->get_local_checksums_per_file( ) ) > 0.
DELETE lt_repos INDEX lv_index.
CONTINUE.
ENDIF.
lv_repo_list = lv_repo_list && `, ` && <lo_repo>->get_name( ).
ENDLOOP.
IF lines( lt_repos ) = 0.
RETURN. " All OK
ENDIF.
SHIFT lv_repo_list BY 2 PLACES LEFT. " Remove leading ', '
lv_question = 'abapGit wants to rebuild missing local checksums'
&& ' (changes from 2016-12-11).'
&& ' Generally this is safe except if there are both local '
&& ' and remote changes at the same time. If unsure, please'
&& ' skip and update repos individually'
&& ' by "Advances/Update local checksums" command.'
&& | Repos affected: { lv_repo_list }|.
lv_answer = zcl_abapgit_popups=>popup_to_confirm(
titlebar = 'Warning'
text_question = lv_question
text_button_1 = 'OK'
icon_button_1 = 'ICON_OK'
text_button_2 = 'Skip update'
icon_button_2 = 'ICON_CANCEL'
default_button = '2'
display_cancel_button = abap_false ). "#EC NOTEXT
IF lv_answer = '2'.
RETURN.
ENDIF.
LOOP AT lt_repos ASSIGNING <lo_repo>.
lo_repo ?= <lo_repo>.
lo_repo->rebuild_local_checksums( ).
ENDLOOP.
ENDMETHOD. " rebuild_local_checksums_20161112.
METHOD run.
" Migrate STDTEXT to TABLE
zcl_abapgit_persist_migrate=>run( ).
" Rebuild local file checksums
rebuild_local_checksums_161112( ).
" local .abapgit.xml state, issue #630
local_dot_abapgit( ).
ENDMETHOD. " run.
ENDCLASS.
| 30.718563 | 103 | 0.607212 |
7939984ac7f4552b4ff5445703bdcfa82acf5f1b | 816 | abap | ABAP | src/zdop_filter_badi_test.prog.abap | DogukanP/ABAP-SSR | c2019809e7c809235e3a96641f4188d96cdeeebb | [
"Apache-2.0"
] | null | null | null | src/zdop_filter_badi_test.prog.abap | DogukanP/ABAP-SSR | c2019809e7c809235e3a96641f4188d96cdeeebb | [
"Apache-2.0"
] | null | null | null | src/zdop_filter_badi_test.prog.abap | DogukanP/ABAP-SSR | c2019809e7c809235e3a96641f4188d96cdeeebb | [
"Apache-2.0"
] | null | null | null | REPORT zdop_filter_badi_test.
DATA go_kdv_badi TYPE REF TO zif_ex_dop_must_badi.
DATA gs_vbak TYPE vbak.
DATA gt_vbap TYPE vbap_t.
DATA gs_kna1 TYPE kna1.
DATA gv_kdv TYPE p.
PARAMETERS pa_vbeln TYPE vbeln_va.
START-OF-SELECTION.
SELECT SINGLE * FROM vbak INTO gs_vbak WHERE vbeln = pa_vbeln.
IF sy-subrc IS INITIAL.
SELECT * FROM vbap INTO TABLE gt_vbap WHERE vbeln = pa_vbeln.
SELECT SINGLE * FROM kna1 INTO gs_kna1 WHERE kunnr = gs_vbak-kunnr.
ENDIF.
CALL METHOD cl_exithandler=>get_instance
EXPORTING
exit_name = 'ZDOP_MUST _BADI'
CHANGING
instance = go_kdv_badi.
CALL METHOD go_kdv_badi->kdv_hesapla
EXPORTING
is_vbak = gs_vbak
it_vbap = gt_vbap
flt_val = gs_kna1-land1
IMPORTING
ev_kdv = gv_kdv.
WRITE :/'KDV Miktari', gv_kdv.
| 22.666667 | 71 | 0.721814 |
7939a47c9cbfde805247203433f0ad003fa6c297 | 7,396 | abap | ABAP | src/zcl_abapgit_factory.clas.abap | wdecpacloudcourse01/abap_a07 | ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed | [
"MIT"
] | null | null | null | src/zcl_abapgit_factory.clas.abap | wdecpacloudcourse01/abap_a07 | ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed | [
"MIT"
] | null | null | null | src/zcl_abapgit_factory.clas.abap | wdecpacloudcourse01/abap_a07 | ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_factory DEFINITION
PUBLIC
CREATE PRIVATE
GLOBAL FRIENDS zcl_abapgit_injector .
PUBLIC SECTION.
CLASS-METHODS get_tadir
RETURNING
VALUE(ri_tadir) TYPE REF TO zif_abapgit_tadir .
CLASS-METHODS get_sap_package
IMPORTING
!iv_package TYPE devclass
RETURNING
VALUE(ri_sap_package) TYPE REF TO zif_abapgit_sap_package .
CLASS-METHODS get_code_inspector
IMPORTING
!iv_package TYPE devclass
!iv_check_variant_name TYPE sci_chkv
RETURNING
VALUE(ri_code_inspector) TYPE REF TO zif_abapgit_code_inspector
RAISING
zcx_abapgit_exception .
CLASS-METHODS get_syntax_check
IMPORTING
!iv_package TYPE devclass
RETURNING
VALUE(ri_syntax_check) TYPE REF TO zif_abapgit_code_inspector
RAISING
zcx_abapgit_exception .
CLASS-METHODS get_adhoc_code_inspector
IMPORTING
!iv_package TYPE devclass
iv_test_name TYPE sci_tstval-testname
RETURNING
VALUE(ri_adhoc_code_inspector) TYPE REF TO zif_abapgit_code_inspector
RAISING
zcx_abapgit_exception .
CLASS-METHODS get_abap_unit_tests
IMPORTING
!iv_package TYPE devclass
RETURNING
VALUE(ri_abap_unit_tests) TYPE REF TO zif_abapgit_code_inspector
RAISING
zcx_abapgit_exception .
CLASS-METHODS get_branch_overview
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo_online
RETURNING
VALUE(ri_branch_overview) TYPE REF TO zif_abapgit_branch_overview
RAISING
zcx_abapgit_exception .
CLASS-METHODS get_stage_logic
RETURNING
VALUE(ri_logic) TYPE REF TO zif_abapgit_stage_logic .
CLASS-METHODS get_cts_api
RETURNING
VALUE(ri_cts_api) TYPE REF TO zif_abapgit_cts_api.
CLASS-METHODS get_frontend_services
RETURNING
VALUE(ri_fe_serv) TYPE REF TO zif_abapgit_frontend_services.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_sap_package,
package TYPE devclass,
instance TYPE REF TO zif_abapgit_sap_package,
END OF ty_sap_package .
TYPES:
tty_sap_package TYPE HASHED TABLE OF ty_sap_package
WITH UNIQUE KEY package .
TYPES:
BEGIN OF ty_code_inspector,
package TYPE devclass,
check_variant_name TYPE sci_chkv,
instance TYPE REF TO zif_abapgit_code_inspector,
END OF ty_code_inspector .
TYPES:
tty_code_inspector TYPE HASHED TABLE OF ty_code_inspector
WITH UNIQUE KEY package check_variant_name .
TYPES:
BEGIN OF ty_syntax_check,
package TYPE devclass,
instance TYPE REF TO zif_abapgit_code_inspector,
END OF ty_syntax_check .
TYPES:
tty_syntax_check TYPE HASHED TABLE OF ty_syntax_check
WITH UNIQUE KEY package .
CLASS-DATA gi_tadir TYPE REF TO zif_abapgit_tadir .
CLASS-DATA gt_sap_package TYPE tty_sap_package .
CLASS-DATA gt_code_inspector TYPE tty_code_inspector .
CLASS-DATA gt_syntax_check TYPE tty_syntax_check .
CLASS-DATA gi_stage_logic TYPE REF TO zif_abapgit_stage_logic .
CLASS-DATA gi_cts_api TYPE REF TO zif_abapgit_cts_api.
CLASS-DATA gi_adhoc_code_inspector TYPE REF TO zif_abapgit_code_inspector.
CLASS-DATA gi_fe_services TYPE REF TO zif_abapgit_frontend_services.
ENDCLASS.
CLASS ZCL_ABAPGIT_FACTORY IMPLEMENTATION.
METHOD get_abap_unit_tests.
IF gi_adhoc_code_inspector IS BOUND.
ri_abap_unit_tests = gi_adhoc_code_inspector.
ELSE.
CREATE OBJECT ri_abap_unit_tests
TYPE zcl_abapgit_abap_unit_tests
EXPORTING
iv_package = iv_package.
ENDIF.
ENDMETHOD.
METHOD get_adhoc_code_inspector.
IF gi_adhoc_code_inspector IS BOUND.
ri_adhoc_code_inspector = gi_adhoc_code_inspector.
ELSE.
CREATE OBJECT ri_adhoc_code_inspector
TYPE zcl_abapgit_adhoc_code_insp
EXPORTING
iv_package = iv_package
iv_test_name = iv_test_name.
ENDIF.
ENDMETHOD.
METHOD get_branch_overview.
CREATE OBJECT ri_branch_overview
TYPE zcl_abapgit_branch_overview
EXPORTING
io_repo = io_repo.
ENDMETHOD.
METHOD get_code_inspector.
DATA: ls_code_inspector LIKE LINE OF gt_code_inspector.
FIELD-SYMBOLS: <ls_code_inspector> TYPE zcl_abapgit_factory=>ty_code_inspector.
READ TABLE gt_code_inspector ASSIGNING <ls_code_inspector>
WITH TABLE KEY package = iv_package
check_variant_name = iv_check_variant_name.
IF sy-subrc <> 0.
ls_code_inspector-package = iv_package.
ls_code_inspector-check_variant_name = iv_check_variant_name.
CREATE OBJECT ls_code_inspector-instance TYPE zcl_abapgit_code_inspector
EXPORTING
iv_package = iv_package
iv_check_variant_name = iv_check_variant_name.
INSERT ls_code_inspector
INTO TABLE gt_code_inspector
ASSIGNING <ls_code_inspector>.
ENDIF.
ri_code_inspector = <ls_code_inspector>-instance.
ENDMETHOD.
METHOD get_cts_api.
IF gi_cts_api IS NOT BOUND.
CREATE OBJECT gi_cts_api TYPE zcl_abapgit_cts_api.
ENDIF.
ri_cts_api = gi_cts_api.
ENDMETHOD.
METHOD get_frontend_services.
IF gi_fe_services IS INITIAL.
CREATE OBJECT gi_fe_services TYPE zcl_abapgit_frontend_services.
ENDIF.
ri_fe_serv = gi_fe_services.
ENDMETHOD.
METHOD get_sap_package.
DATA: ls_sap_package TYPE ty_sap_package.
FIELD-SYMBOLS: <ls_sap_package> TYPE ty_sap_package.
READ TABLE gt_sap_package ASSIGNING <ls_sap_package>
WITH TABLE KEY package = iv_package.
IF sy-subrc <> 0.
ls_sap_package-package = iv_package.
CREATE OBJECT ls_sap_package-instance TYPE zcl_abapgit_sap_package
EXPORTING
iv_package = iv_package.
INSERT ls_sap_package
INTO TABLE gt_sap_package
ASSIGNING <ls_sap_package>.
ENDIF.
ri_sap_package = <ls_sap_package>-instance.
ENDMETHOD.
METHOD get_stage_logic.
IF gi_stage_logic IS INITIAL.
CREATE OBJECT gi_stage_logic
TYPE zcl_abapgit_stage_logic.
ENDIF.
ri_logic = gi_stage_logic.
ENDMETHOD.
METHOD get_syntax_check.
DATA: ls_syntax_check LIKE LINE OF gt_syntax_check.
FIELD-SYMBOLS: <ls_syntax_check> TYPE zcl_abapgit_factory=>ty_syntax_check.
READ TABLE gt_syntax_check ASSIGNING <ls_syntax_check>
WITH TABLE KEY package = iv_package.
IF sy-subrc <> 0.
ls_syntax_check-package = iv_package.
CREATE OBJECT ls_syntax_check-instance TYPE zcl_abapgit_syntax_check
EXPORTING
iv_package = iv_package.
INSERT ls_syntax_check
INTO TABLE gt_syntax_check
ASSIGNING <ls_syntax_check>.
ENDIF.
ri_syntax_check = <ls_syntax_check>-instance.
ENDMETHOD.
METHOD get_tadir.
IF gi_tadir IS INITIAL.
CREATE OBJECT gi_tadir TYPE zcl_abapgit_tadir.
ENDIF.
ri_tadir = gi_tadir.
ENDMETHOD.
ENDCLASS.
| 27.700375 | 91 | 0.687804 |
793a3c882b80c6acb23de0f3f4aff7d0399f3b02 | 1,332 | abap | ABAP | src/repo/zcl_abapgit_repo_offline.clas.abap | abapGit/upport | 322935c225756b5107d7c835e6ccc13ba3dcbe4a | [
"MIT"
] | 2 | 2021-01-08T21:38:32.000Z | 2021-11-17T19:37:14.000Z | src/repo/zcl_abapgit_repo_offline.clas.abap | abapGit/upport | 322935c225756b5107d7c835e6ccc13ba3dcbe4a | [
"MIT"
] | null | null | null | src/repo/zcl_abapgit_repo_offline.clas.abap | abapGit/upport | 322935c225756b5107d7c835e6ccc13ba3dcbe4a | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_repo_offline DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_repo
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS set_name
IMPORTING
!iv_url TYPE string
RAISING
zcx_abapgit_exception .
METHODS get_name
REDEFINITION .
METHODS has_remote_source
REDEFINITION .
PROTECTED SECTION.
METHODS reset_remote
REDEFINITION .
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_repo_offline IMPLEMENTATION.
METHOD get_name.
rv_name = super->get_name( ).
IF rv_name IS INITIAL.
rv_name = ms_data-url.
ENDIF.
ENDMETHOD.
METHOD has_remote_source.
rv_yes = xsdbool( lines( mt_remote ) > 0 ).
ENDMETHOD.
METHOD reset_remote.
DATA lt_backup LIKE mt_remote.
" online repo has online source to renew data from, offline does not
" so offline repo preserves the remote
" in case of partial pull failure the user will immediately see the new difference
" UI will detect "pullable" content based on mt_status
" in the uniform way both for online and offline repos
" for more details see discussion in 2096 and 1953
lt_backup = mt_remote.
super->reset_remote( ).
set_files_remote( lt_backup ).
ENDMETHOD.
METHOD set_name.
set( iv_url = iv_url ).
ENDMETHOD.
ENDCLASS.
| 19.880597 | 86 | 0.696697 |
7944425baea06523c2ce0a1f5b5730da0b9b6f86 | 4,874 | abap | ABAP | src/objects/zcl_abapgit_oo_serializer.clas.testclasses.abap | wdecpacloudcourse01/abap_a07 | ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_oo_serializer.clas.testclasses.abap | wdecpacloudcourse01/abap_a07 | ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_oo_serializer.clas.testclasses.abap | wdecpacloudcourse01/abap_a07 | ad7809e4f2bc4da133c17c9a4c0536d7ea5ebbed | [
"MIT"
] | null | null | null | CLASS ltcl_oo_serialize DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
setup,
empty_include FOR TESTING RAISING cx_static_check,
one_line_include FOR TESTING RAISING cx_static_check,
one_line_include_2 FOR TESTING RAISING cx_static_check,
one_line_include_3 FOR TESTING RAISING cx_static_check,
two_line_include FOR TESTING RAISING cx_static_check,
two_line_include_2 FOR TESTING RAISING cx_static_check,
two_line_include_3 FOR TESTING RAISING cx_static_check,
more_than_two_lines FOR TESTING RAISING cx_static_check,
_given_source_is
IMPORTING
iv_source TYPE LINE OF zif_abapgit_definitions=>ty_string_tt,
_given_empty_test_include,
_when_skip_is_calculated,
_then_should_be_skipped,
_then_should_not_be_skipped.
DATA: mo_oo_serializer TYPE REF TO zcl_abapgit_oo_serializer,
mt_source TYPE zif_abapgit_definitions=>ty_string_tt,
mv_skip_testclass TYPE abap_bool.
ENDCLASS.
CLASS ltcl_oo_serialize IMPLEMENTATION.
METHOD setup.
CREATE OBJECT mo_oo_serializer.
ENDMETHOD.
METHOD empty_include.
_given_empty_test_include( ).
_when_skip_is_calculated( ).
_then_should_be_skipped( ).
ENDMETHOD.
METHOD one_line_include.
_given_source_is( `*"* use this source file for your ABAP unit test classes` ).
_when_skip_is_calculated( ).
_then_should_be_skipped( ).
ENDMETHOD.
METHOD one_line_include_2.
_given_source_is( `*` ).
_when_skip_is_calculated( ).
_then_should_be_skipped( ).
ENDMETHOD.
METHOD one_line_include_3.
_given_source_is( `write: 'This is ABAP'.` ).
_when_skip_is_calculated( ).
_then_should_not_be_skipped( ).
ENDMETHOD.
METHOD two_line_include.
_given_source_is( `*"* use this source file for your ABAP unit test classes` ).
_given_source_is( `` ).
_when_skip_is_calculated( ).
_then_should_be_skipped( ).
ENDMETHOD.
METHOD two_line_include_2.
_given_source_is( `*"* use this source file for your ABAP unit test classes` ).
_given_source_is( `write: 'This is ABAP'.` ).
_when_skip_is_calculated( ).
_then_should_not_be_skipped( ).
ENDMETHOD.
METHOD two_line_include_3.
_given_source_is( ` ` ).
_given_source_is( `*"* use this source file for your ABAP unit test classes` ).
_when_skip_is_calculated( ).
_then_should_not_be_skipped( ).
ENDMETHOD.
METHOD more_than_two_lines.
_given_source_is( `*"* use this source file for your ABAP unit test classes` ).
_given_source_is( `CLASS ltcl_test DEFINITION FINAL FOR TESTING` ).
_given_source_is( ` DURATION SHORT` ).
_given_source_is( ` RISK LEVEL HARMLESS.` ).
_given_source_is( ` ` ).
_given_source_is( ` PRIVATE SECTION.` ).
_given_source_is( ` METHODS:` ).
_given_source_is( ` first_test FOR TESTING RAISING cx_static_check.` ).
_given_source_is( `ENDCLASS.` ).
_given_source_is( ` ` ).
_given_source_is( `CLASS ltcl_test IMPLEMENTATION.` ).
_given_source_is( ` ` ).
_given_source_is( ` METHOD first_test.` ).
_given_source_is( ` cl_abap_unit_assert=>fail( 'This is a real test' ).` ).
_given_source_is( ` ENDMETHOD.` ).
_given_source_is( ` ` ).
_given_source_is( `ENDCLASS.` ).
_when_skip_is_calculated( ).
_then_should_not_be_skipped( ).
ENDMETHOD.
METHOD _given_source_is.
INSERT iv_source INTO TABLE mt_source.
ENDMETHOD.
METHOD _given_empty_test_include.
ENDMETHOD.
METHOD _when_skip_is_calculated.
mv_skip_testclass = mo_oo_serializer->calculate_skip_testclass( mt_source ).
ENDMETHOD.
METHOD _then_should_be_skipped.
cl_abap_unit_assert=>assert_equals(
act = mv_skip_testclass
exp = abap_true
msg = |Testclass should be skipped| ).
ENDMETHOD.
METHOD _then_should_not_be_skipped.
cl_abap_unit_assert=>assert_equals(
act = mv_skip_testclass
exp = abap_false
msg = |Testclass should not be skipped| ).
ENDMETHOD.
ENDCLASS.
| 27.851429 | 83 | 0.605868 |
7945b301a9e7c8eb89069b3005c1ea48a1f15883 | 36,236 | abap | ABAP | bmbench.abap | benchmarko/BMbench | b5ca448d2c075bb95bdfdf4bdbc98430fca7dc8e | [
"MIT"
] | null | null | null | bmbench.abap | benchmarko/BMbench | b5ca448d2c075bb95bdfdf4bdbc98430fca7dc8e | [
"MIT"
] | null | null | null | bmbench.abap | benchmarko/BMbench | b5ca448d2c075bb95bdfdf4bdbc98430fca7dc8e | [
"MIT"
] | null | null | null | *&---------------------------------------------------------------------*
*& Report ZMVTEST06 *
*& *
*&---------------------------------------------------------------------*
*&
*& 21.08.2002 extended system info
*& 04.09.2002 0.04 calibration corrected
*& 11.02.2003 0.041 output format changed
*& 19.02.2003 0.05 kernel info
*& 25.02.2003 benchmark bench00 uses type I, bench01 uses P
*& 23.10.2006 0.06 based on version 0.05
*&
*&---------------------------------------------------------------------*
*
* Notes (4.6C):
* - '/' does rounding, 'DIV' not.
* - WHILE ... ENDWHILE is slower than DO n TIMES...ENDDO
* - WHILE ... ENDWHILE is also slower that LOOP AT <itab> into wa
* - using field symbols seems to be slow, so avoid them
* (e.g. read table <ts> assigning <fs> -> read table p1 into wa)
* (For small tables prefer append+table copy instead of field symbols)
*
* with integer arithmetic we get an overflow...
*
* Notes:
* - Data types:
* - I (integer, 4 byte): -2147483648 bis 2147483647
* - P (packed): depends on number of digits
* - F (floating point): 2,225073E-308 bis 1,769313E+308
*
*
*
REPORT ZMVTEST06 NO STANDARD PAGE HEADING LINE-SIZE 200.
CONSTANTS:
PRG_VERSION(5) TYPE C VALUE '0.06'.
PARAMETERS: BENCH1(1) TYPE C DEFAULT '0',
BENCH2(1) TYPE C DEFAULT '5',
N(9) TYPE C DEFAULT '1000000'.
PERFORM MAIN USING BENCH1 BENCH2 N.
EXIT.
*---------------------------------------------------------------------*
* FORM BENCH00 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> VALUE(LOOPS) *
* --> VALUE(N) *
* --> X *
*---------------------------------------------------------------------*
FORM BENCH00 USING VALUE(LOOPS) TYPE I
VALUE(N) TYPE I
CHANGING X TYPE I.
CONSTANTS: PART1 TYPE I VALUE 1000. " n must be divisible by part1!
DATA: SUM1 TYPE I VALUE 0,
F1 TYPE F VALUE '0.0'.
DATA: N_DIV_PART1 TYPE I VALUE 0,
J TYPE I VALUE 0.
N_DIV_PART1 = N DIV PART1.
* CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 4.
F1 = ( ( N DIV 2 ) * ( N + 1 ) ).
SUM1 = F1 MOD 65536. " MOD 2147483648.
* MOD 2147483648 is much more expensive than MOD 65536. Why?
DO LOOPS TIMES.
* mod in loop is expensive, so try a workaround for n=1000000...
* DO N TIMES.
* X = ( X + SY-INDEX ) MOD 65536. " MOD 2147483648
* ENDDO.
DO N_DIV_PART1 TIMES.
J = N_DIV_PART1 * ( SY-INDEX - 1 ).
DO N_DIV_PART1 TIMES.
X = ( X + J + SY-INDEX ).
ENDDO.
X = X MOD 65536.
ENDDO.
IF SY-INDEX < LOOPS.
X = X - SUM1.
IF X <> 0.
X = X + 1. "force error for many wrong computations
EXIT. "return.
ENDIF.
ENDIF.
ENDDO.
* ENDCATCH.
* IF SY-SUBRC = 4.
* WRITE: / 'Overflow! x=',X, ', sy-index=', SY-INDEX.
* ENDIF.
X = X MOD 65536.
ENDFORM. "BENCH01
*&--------------------------------------------------------------------*
*& Form BENCH01
*&--------------------------------------------------------------------*
* we are using the (slow) packed type 'P' with 7*2-1 digits here
*---------------------------------------------------------------------*
* -->VALUE(LOOPStext
* -->VALUE(N) text
* -->X text
*---------------------------------------------------------------------*
FORM BENCH01 USING VALUE(LOOPS) TYPE I
VALUE(N) TYPE I
CHANGING X_P TYPE I.
DATA: SUM1(7) TYPE P VALUE 0,
X(7) TYPE P VALUE 0.
* CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 4.
SUM1 = ( ( N DIV 2 ) * ( N + 1 ) ).
DO LOOPS TIMES.
DO N TIMES.
X = X + SY-INDEX.
ENDDO.
IF SY-INDEX < LOOPS.
X = X - SUM1.
IF X <> 0.
X = X + 1. "force error for many wrong computations
X_P = X MOD 65536.
EXIT. "return.
ENDIF.
ENDIF.
ENDDO.
* ENDCATCH.
* IF SY-SUBRC = 4.
* WRITE: / 'Overflow! x=',X, ', sy-index=', SY-INDEX.
* ENDIF.
X_P = X MOD 65536.
ENDFORM. "BENCH01
*---------------------------------------------------------------------*
* FORM BENCH02 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> VALUE(LOOPS) *
* --> VALUE(N) *
* --> XP *
*---------------------------------------------------------------------*
FORM BENCH02 USING VALUE(LOOPS) TYPE I
VALUE(N) TYPE I
CHANGING XP TYPE I.
DATA: X TYPE F VALUE '0.0',
SUM1 TYPE F VALUE '0.0'.
SUM1 = ( N / 2 ) * ( N + 1 ).
DO LOOPS TIMES.
DO N TIMES.
X = X + SY-INDEX.
ENDDO.
IF SY-INDEX < LOOPS.
X = X - SUM1.
IF X <> 0.
X = X + 1. "force error for many wrong computations
EXIT. "return.
ENDIF.
ENDIF.
ENDDO.
XP = X MOD 65536.
ENDFORM. "BENCH02
*---------------------------------------------------------------------*
* FORM BENCH02_SLOW_WHILE *
*---------------------------------------------------------------------*
* This is the same as BENCH02 but with a while loop which seems
* to be slower than a DO loop.
*---------------------------------------------------------------------*
* --> VALUE(LOOPS) *
* --> VALUE(N) *
* --> XP *
*---------------------------------------------------------------------*
*FORM BENCH02_SLOW_WHILE USING VALUE(LOOPS) TYPE I
* VALUE(N) TYPE I
* CHANGING XP TYPE I.
* DATA X TYPE F VALUE '0.0'.
* DATA SUM1 TYPE F VALUE '0.0'.
* DATA I TYPE I VALUE 0.
* SUM1 = ( N / 2 ) * ( N + 1 ).
*
* WHILE LOOPS > 0.
* LOOPS = LOOPS - 1.
* I = N.
* WHILE I > 0.
* X = X + I.
* I = I - 1.
* ENDWHILE.
* IF LOOPS > 0.
* X = X - SUM1.
* IF X <> 0.
* X = X + 1. "force error for many wrong computations
* EXIT. "return.
* ENDIF.
* ENDIF.
* ENDWHILE.
* XP = X MOD 65536. "TRUNC?
*ENDFORM. "BENCH02_SLOW_WHILE
*---------------------------------------------------------------------*
* FORM BENCH03 *
*---------------------------------------------------------------------*
* Sieve of Eratosthenes
* More than 1 loops only possible for n=1000000
* n=500000 : x=41538
* n=1000000 : x=78498
*---------------------------------------------------------------------*
* --> VALUE(LOOPS) *
* --> VALUE(N) *
* --> X *
*---------------------------------------------------------------------*
FORM BENCH03 USING VALUE(LOOPS) TYPE I
VALUE(N) TYPE I
CHANGING X TYPE I.
DATA: I TYPE I VALUE 0,
I_MUL_I TYPE I VALUE 0,
J TYPE I VALUE 0,
BIT1 TYPE I VALUE 0.
X = 0. "number of primes below n
N = N DIV 2. " only up to 500.000
CONSTANTS: MAX1 TYPE I VALUE 62501.
DATA: SIEVE1(MAX1) TYPE X. "only constant here, only up to 65535
SET BIT N OF SIEVE1 TO 0. " check if we've enough bits...
IF SY-SUBRC <> 0.
WRITE: / 'Error: Not enough bits in array!'.
EXIT.
ENDIF.
SET BIT 1 OF SIEVE1 TO 0. "we're starting with i=1
DO LOOPS TIMES.
* initialize sieve
I = 2.
WHILE I <= N.
SET BIT I OF SIEVE1 TO 1.
I = I + 1.
ENDWHILE.
* compute primes
I = 2.
I_MUL_I = I * I.
WHILE I_MUL_I <= N.
GET BIT I OF SIEVE1 INTO BIT1.
IF BIT1 > 0.
J = I_MUL_I.
WHILE J <= N.
SET BIT J OF SIEVE1 TO 0.
J = J + I.
ENDWHILE.
ENDIF.
I = I + 1.
I_MUL_I = I * I.
ENDWHILE.
* count primes (starting from i=1)
I = 1.
WHILE I <= N.
GET BIT I OF SIEVE1 INTO BIT1.
IF BIT1 > 0.
X = X + 1.
ENDIF.
I = I + 1.
ENDWHILE.
* check prime count
IF SY-INDEX < LOOPS. "some more loops left?
X = X - 41538. "yes, set x back to 0
IF X <> 0. "now x must be 0 again
X = X + 1. "force error for many wrong computations
EXIT. "Error
ENDIF.
ENDIF.
ENDDO.
ENDFORM. "BENCH03
*---------------------------------------------------------------------*
* FORM BENCH04 *
*---------------------------------------------------------------------*
* bench04 (Integer 32 bit)
* nth random number number
* Random number generator taken from
* Raj Jain: The Art of Computer Systems Performance Analysis,
* John Wiley & Sons, 1991, page 442-444.
* It needs longs with at least 32 bit.
* Starting with x0=1, x10000 should be 1043618065, x1000000 = 1227283347
*---------------------------------------------------------------------*
* --> VALUE(LOOPS) *
* --> VALUE(N) *
* --> X *
*---------------------------------------------------------------------*
FORM BENCH04 USING VALUE(LOOPS) TYPE I
VALUE(N) TYPE I
CHANGING X TYPE I.
CONSTANTS: M TYPE I VALUE 2147483647, "modulus, do not change!
A TYPE I VALUE 16807, "multiplier
Q TYPE I VALUE 127773, "m div a
R TYPE I VALUE 2836. "m mod a
DATA:
X_DIV_Q TYPE I,
X_MOD_Q TYPE I,
SUM1 TYPE I VALUE 1227283347.
X = 1. "last random value
DO LOOPS TIMES.
DO N TIMES.
X_DIV_Q = X DIV Q.
X_MOD_Q = X - Q * X_DIV_Q.
X = A * X_MOD_Q - R * X_DIV_Q.
IF X <= 0.
X = X + M. "x is new random number
ENDIF.
ENDDO.
IF SY-INDEX < LOOPS.
X = X - SUM1.
IF X <> 0.
X = X + 1. "force error for many wrong computations
EXIT. "return.
ENDIF.
X = X + 1. " restart with 1
ENDIF.
ENDDO.
ENDFORM. "BENCH04
*---------------------------------------------------------------------*
* FORM BENCH05 *
*---------------------------------------------------------------------*
* bench05 (Integer 32 bit)
* n over n/2 mod 65536 (Pascal's triangle)
* (we just need to store the last 2 lines of computation)
*---------------------------------------------------------------------*
* --> VALUE(LOOPS) *
* --> VALUE(N) *
* --> X *
*---------------------------------------------------------------------*
FORM BENCH05 USING VALUE(LOOPS) TYPE I
VALUE(N) TYPE I
CHANGING X TYPE I.
DATA: K TYPE I,
I TYPE I,
J TYPE I,
I_MOD_2 TYPE I,
DIV2 TYPE I,
WA1 TYPE I,
WA2 TYPE I,
PAS1 TYPE STANDARD TABLE OF I INITIAL SIZE 100,
PAS2 TYPE STANDARD TABLE OF I INITIAL SIZE 100.
X = 0.
N = N DIV 500.
K = N DIV 2.
J = N - K.
IF J < K. "keep k minimal with n over k = n over n-k
K = J.
ENDIF.
DO LOOPS TIMES.
REFRESH PAS1.
APPEND 1 TO PAS1.
I = 3.
WHILE I <= N.
PAS2 = PAS1.
REFRESH PAS1.
APPEND 1 TO PAS1. "set first column to 1
APPEND I TO PAS1. "second column is i
WA1 = I - 1. "last second column
LOOP AT PAS2 INTO WA2.
CHECK SY-TABIX >= 3. "starting with index 3
WA1 = ( WA1 + WA2 ) MOD 65536. "sum: use mod to avoid overflow
APPEND WA1 TO PAS1.
WA1 = WA2. "save element for next round
ENDLOOP.
DIV2 = ( I - 1 ) DIV 2.
I_MOD_2 = I MOD 2.
IF DIV2 < K AND I_MOD_2 = 0. "new element
WA2 = 2 * WA1. "wa1 contains already pas2[min1+1]
APPEND WA2 TO PAS1.
ENDIF.
I = I + 1.
ENDWHILE.
J = K + 1. "get pas1[n mod 2][k]
READ TABLE PAS1 INDEX J INTO WA1.
X = ( X + WA1 ) MOD 65536.
IF SY-INDEX < LOOPS.
X = X - 27200.
IF X <> 0.
X = X + 1. "force error for many wrong computations
EXIT. "return.
ENDIF.
ENDIF.
ENDDO.
* debug output
* IF 1 = 0.
* WRITE: / 'DEBUG: '.
* LOOP AT PAS1 INTO WA1.
* WRITE: WA1, ' '.
* ENDLOOP.
* WRITE: /.
* ENDIF.
FREE PAS1.
FREE PAS2.
ENDFORM. "BENCH05
*&--------------------------------------------------------------------*
*& Form BENCH05_OK3
*&--------------------------------------------------------------------*
* This version of bench05 is unused.
*---------------------------------------------------------------------*
* -->VALUE(LOOPS)
* -->VALUE(N_P)
* -->X
*---------------------------------------------------------------------*
*FORM BENCH05_OK3 USING VALUE(LOOPS) TYPE I
* VALUE(N_P) TYPE I
* CHANGING X TYPE I.
*
* DATA: N TYPE I,
* K TYPE I,
* I TYPE I,
* J TYPE I,
* I_MOD_2 TYPE I,
* MIN1 TYPE I,
* SUM1 TYPE I,
* WA1 TYPE I,
* WA2 TYPE I,
* PAS1 TYPE STANDARD TABLE OF I INITIAL SIZE 100,
* PAS2 TYPE STANDARD TABLE OF I INITIAL SIZE 100.
*
* X = 0.
* N = N_P DIV 500.
* K = N DIV 2.
*
* J = N - K.
* IF J < K. "keep k minimal with n over k = n over
* K = J.
* ENDIF.
*
* DO LOOPS TIMES.
* REFRESH PAS1.
* APPEND 1 TO PAS1.
* I = 2.
* WHILE I <= N.
* PAS2 = PAS1.
* REFRESH PAS1.
* APPEND 1 TO PAS1. "set first column to 1
* APPEND I TO PAS1. "second column is i
*
* MIN1 = ( I - 1 ) DIV 2.
* IF K < MIN1.
* MIN1 = K.
* ENDIF.
*
* J = 2.
* READ TABLE PAS2 INDEX J INTO WA2.
* WHILE J <= MIN1. "up to min(i, k)
* WA1 = WA2.
* J = J + 1.
* READ TABLE PAS2 INDEX J INTO WA2.
* SUM1 = ( WA1 + WA2 ) MOD 65536. "use mod to avoid overflow
* APPEND SUM1 TO PAS1.
* ENDWHILE.
* I_MOD_2 = I MOD 2.
* IF MIN1 < K AND I_MOD_2 = 0. "new element
* J = MIN1 + 1.
* READ TABLE PAS2 INDEX J INTO WA1.
* SUM1 = 2 * WA1.
* APPEND SUM1 TO PAS1.
* ENDIF.
* I = I + 1.
* ENDWHILE.
*
* J = K + 1. "get pas1[n mod 2][k]
* READ TABLE PAS1 INDEX J INTO WA1.
* X = ( X + WA1 ) MOD 65536.
* IF SY-INDEX < LOOPS.
* X = X - 27200.
* IF X <> 0.
* X = X + 1. "force error for many wrong computations
* EXIT. "return.
* ENDIF.
* ENDIF.
*
* ENDDO.
*
* FREE PAS1.
* FREE PAS2.
*ENDFORM. "BENCH05_OK3
*&--------------------------------------------------------------------*
*& Form BENCH05_OK2
*&--------------------------------------------------------------------*
* This version of bench05 is unused.
*---------------------------------------------------------------------*
* -->VALUE(LOOPS)
* -->VALUE(N_P)
* -->X
*---------------------------------------------------------------------*
*FORM BENCH05_OK2 USING VALUE(LOOPS) TYPE I
* VALUE(N_P) TYPE I
* CHANGING X TYPE I.
*
* DATA: N TYPE I,
* K TYPE I,
* I TYPE I,
* J TYPE I,
* I_MOD_2 TYPE I,
* MIN1 TYPE I,
* SUM1 TYPE I,
* WA TYPE I,
* PAS1 TYPE STANDARD TABLE OF I INITIAL SIZE 100,
* PAS2 TYPE STANDARD TABLE OF I INITIAL SIZE 100.
*
* X = 0.
* N = N_P DIV 500.
* K = N DIV 2.
*
* J = N - K.
* IF J < K. "keep k minimal with n over k = n over
* K = J.
* ENDIF.
*
* DO LOOPS TIMES.
* REFRESH PAS1.
* APPEND 1 TO PAS1.
* I = 2.
* WHILE I <= N.
* PAS2 = PAS1.
* REFRESH PAS1.
* APPEND 1 TO PAS1. "set first column to 1
* APPEND I TO PAS1. "second column is i
*
* MIN1 = ( I - 1 ) DIV 2.
* IF K < MIN1.
* MIN1 = K.
* ENDIF.
*
* J = 2.
* WHILE J <= MIN1. "up to min(i, k)
* READ TABLE PAS2 INDEX J INTO SUM1.
* J = J + 1.
* READ TABLE PAS2 INDEX J INTO WA.
* SUM1 = ( SUM1 + WA ) MOD 65536. "use mod to avoid overflow
* APPEND SUM1 TO PAS1.
* ENDWHILE.
* I_MOD_2 = I MOD 2.
* IF MIN1 < K AND I_MOD_2 = 0. "new element
* J = MIN1 + 1.
* READ TABLE PAS2 INDEX J INTO WA.
* SUM1 = 2 * WA.
* APPEND SUM1 TO PAS1.
* ENDIF.
* I = I + 1.
* ENDWHILE.
*
* J = K + 1. "get pas1[n mod 2][k]
* READ TABLE PAS1 INDEX J INTO WA.
* X = ( X + WA ) MOD 65536.
* IF SY-INDEX < LOOPS.
* X = X - 27200.
* IF X <> 0.
* X = X + 1. "force error for many wrong computations
* EXIT. "return.
* ENDIF.
* ENDIF.
*
* ENDDO.
*
** debug output
** DATA: WA TYPE I.
** WRITE: / 'DEBUG: '.
** LOOP AT <PS1> INTO WA.
** WRITE: WA, ' '.
** ENDLOOP.
** WRITE: /.
*
* FREE PAS1.
* FREE PAS2.
*ENDFORM. "BENCH05_OK2
*---------------------------------------------------------------------*
* FORM run_bench *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> VALUE(BENCH) *
* --> VALUE(LOOPS) *
* --> VALUE(N) *
* --> X *
*---------------------------------------------------------------------*
FORM RUN_BENCH USING VALUE(BENCH) TYPE I
VALUE(LOOPS) TYPE I
VALUE(N) TYPE I
CHANGING X TYPE I.
DATA CHECK1 TYPE I VALUE 0.
X = 0.
* or use: PERFORM bench OF bench01 bench02 bench03 bench04 bench05.
CASE BENCH.
WHEN 0.
PERFORM BENCH00 USING LOOPS N CHANGING X.
CHECK1 = 10528.
WHEN 1.
PERFORM BENCH01 USING LOOPS N CHANGING X.
CHECK1 = 10528.
WHEN 2.
PERFORM BENCH02 USING LOOPS N CHANGING X.
CHECK1 = 10528.
WHEN 3.
PERFORM BENCH03 USING LOOPS N CHANGING X.
CHECK1 = 41538.
WHEN 4.
PERFORM BENCH04 USING LOOPS N CHANGING X.
CHECK1 = 1227283347.
WHEN 5.
PERFORM BENCH05 USING LOOPS N CHANGING X.
CHECK1 = 27200.
WHEN OTHERS.
WRITE: / 'Error: Unknown benchmark:', (1) BENCH.
CHECK1 = X + 1.
ENDCASE.
IF X <> CHECK1.
WRITE: / 'Error(bench' NO-GAP, (1) BENCH NO-GAP,
'): x=' NO-GAP, X USING EDIT MASK 'V__________'.
X = -1.
* STOP.
ENDIF.
ENDFORM. "RUN_BENCH
*&--------------------------------------------------------------------*
*& Form GET_MS
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->MS text
*---------------------------------------------------------------------*
FORM GET_MS CHANGING MS TYPE I.
DATA: T1 TYPE I.
GET RUN TIME FIELD T1.
MS = T1 / 1000.
ENDFORM. "GET_MS
*FROM GET_MS_TEST1 CHANGING MS TYPE I.
*DATA: P1 TYPE timestampl.
* GET TIME STAMP FIELD P1.
* *TODO: MS = P1 / 1000.
"ENDFORM.
*&--------------------------------------------------------------------*
*& Form CHECKBITS_INT1
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->BITS text
*---------------------------------------------------------------------*
FORM CHECKBITS_INT1 CHANGING BITS TYPE I.
DATA: NUM TYPE I VALUE 1,
TMP_NUM TYPE I,
LAST_NUM TYPE I VALUE 0.
BITS = 0.
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 4.
WHILE BITS < 101.
BITS = BITS + 1. "increment before overflow
LAST_NUM = NUM.
NUM = NUM * 2.
NUM = NUM + 1.
TMP_NUM = ( NUM - 1 ) DIV 2.
IF TMP_NUM <> LAST_NUM.
EXIT.
ENDIF.
ENDWHILE.
ENDCATCH.
* IF SY-SUBRC = 4.
** WRITE: / 'DEBUG: Overflow! bits=',bits.
* ENDIF.
ENDFORM. "CHECKBITS_INT1
*&--------------------------------------------------------------------*
*& Form CHECKBITS_NUM1
*&--------------------------------------------------------------------*
* check number type, currently unused
*---------------------------------------------------------------------*
* -->BITS text
*---------------------------------------------------------------------*
*FORM CHECKBITS_NUM1_UNUSED CHANGING BITS TYPE I.
* DATA: NUM TYPE N VALUE 1,
* TMP_NUM TYPE N,
* LAST_NUM TYPE N VALUE 0.
*
* BITS = 0.
* CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 4.
* WHILE BITS < 101.
* BITS = BITS + 1. "increment before overflow
* LAST_NUM = NUM.
* NUM = NUM * 2.
* NUM = NUM + 1.
* TMP_NUM = ( NUM - 1 ) DIV 2.
* IF TMP_NUM <> LAST_NUM.
* EXIT.
* ENDIF.
* ENDWHILE.
*
* ENDCATCH.
** IF SY-SUBRC = 4.
*** WRITE: / 'DEBUG: Overflow! bits=',bits.
** ENDIF.
*ENDFORM. "CHECKBITS_NUM1
*&--------------------------------------------------------------------*
*& Form CHECKBITS_PACKED1
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->BITS text
*---------------------------------------------------------------------*
FORM CHECKBITS_PACKED1 CHANGING BITS TYPE I.
DATA: NUM(7) TYPE P VALUE 1,
TMP_NUM(7) TYPE P,
LAST_NUM(7) TYPE P VALUE 0.
BITS = 0.
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 4.
WHILE BITS < 101.
BITS = BITS + 1. "increment before overflow
LAST_NUM = NUM.
NUM = NUM * 2.
NUM = NUM + 1.
TMP_NUM = ( NUM - 1 ) DIV 2.
IF TMP_NUM <> LAST_NUM.
EXIT.
ENDIF.
ENDWHILE.
ENDCATCH.
* IF SY-SUBRC = 4.
** WRITE: / 'DEBUG: Overflow! bits=',bits.
* ENDIF.
ENDFORM. "CHECKBITS_PACKED1
*&--------------------------------------------------------------------*
*& Form CHECKBITS_DOUBLE1
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->BITS text
*---------------------------------------------------------------------*
FORM CHECKBITS_DOUBLE1 CHANGING BITS TYPE I.
DATA: NUM TYPE F VALUE '1.0',
TMP_NUM TYPE F,
LAST_NUM TYPE F VALUE '0.0'.
BITS = 0.
WHILE BITS < 101.
BITS = BITS + 1.
LAST_NUM = NUM.
NUM = NUM * 2.
NUM = NUM + 1.
TMP_NUM = ( NUM - 1 ) / 2.
IF TMP_NUM <> LAST_NUM.
EXIT.
ENDIF.
ENDWHILE.
ENDFORM. "CHECKBITS_DOUBLE1
*&--------------------------------------------------------------------*
*& Form GET_KINFO
*&--------------------------------------------------------------------*
* Get and write the kernel information (optional)
* (see also RSUVM002)
*---------------------------------------------------------------------*
* -->KERNEL_RELEtext
* -->KERNEL_PATCtext
*---------------------------------------------------------------------*
FORM GET_KINFO CHANGING KERNEL_RELEASE TYPE C
KERNEL_PATCH TYPE C.
TYPES:
BEGIN OF KERNEL_VERSION_INFO,
KEY(21) TYPE C,
DATA(59) TYPE C,
END OF KERNEL_VERSION_INFO.
DATA:
T_KERNEL_VERSION_INFO TYPE STANDARD TABLE OF KERNEL_VERSION_INFO,
WA_KERNEL_VERSION_INFO LIKE LINE OF T_KERNEL_VERSION_INFO.
CALL 'SAPCORE' ID 'ID' FIELD 'VERSION'
ID 'TABLE' FIELD T_KERNEL_VERSION_INFO.
IF SY-SUBRC = 0.
READ TABLE T_KERNEL_VERSION_INFO INDEX 12 INTO
WA_KERNEL_VERSION_INFO.
IF SY-SUBRC = 0 AND WA_KERNEL_VERSION_INFO-KEY = 'kernel release'.
KERNEL_RELEASE = WA_KERNEL_VERSION_INFO-DATA.
ENDIF.
READ TABLE T_KERNEL_VERSION_INFO INDEX 15 INTO
WA_KERNEL_VERSION_INFO.
IF SY-SUBRC = 0 AND WA_KERNEL_VERSION_INFO-KEY =
'kernel patch level'.
KERNEL_PATCH = WA_KERNEL_VERSION_INFO-DATA.
ENDIF.
ENDIF.
ENDFORM. "get_kinfo
*&---------------------------------------------------------------------*
*& Form FORMAT_I2STR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->I1 text
* -->STR text
*----------------------------------------------------------------------*
FORM FORMAT_I2STR USING I1 TYPE I
CHANGING STR TYPE C.
* DATA:
* NS1(11) TYPE C.
* WRITE I1 TO NS1 USING EDIT MASK 'V__________'.
* WRITE I1 TO STR USING EDIT MASK 'V__________'.
WRITE I1 TO STR USING EDIT MASK '__________'.
* WRITE I1 TO NS1 LEFT-JUSTIFIED.
ENDFORM. "FORMAT_I2STR
*&---------------------------------------------------------------------*
*& Form WRITE_I2STR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->I1 text
* -->STR text
*----------------------------------------------------------------------*
FORM WRITE_I2STR USING I1 TYPE I
CHANGING STR TYPE C.
DATA:
STR2(11) TYPE C.
* LEN TYPE I.
PERFORM FORMAT_I2STR USING I1 CHANGING STR2.
* LEN = STRLEN( STR ).
* WRITE: AT (LEN) STR NO-GAP.
CONCATENATE STR STR2 INTO STR.
ENDFORM. "WRITE_I2STR
*&---------------------------------------------------------------------*
*& Form PRINT_SYSTEM_INFO
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM PRINT_SYSTEM_INFO.
DATA:
NS1(10) TYPE C,
NS2(10) TYPE C,
NS3(10) TYPE C,
LEN1 TYPE I,
LEN2 TYPE I,
LEN3 TYPE I,
KERNEL_REL(10) TYPE C,
KERNEL_PATCH(10) TYPE C.
WRITE SY-SYSID TO NS1 LEFT-JUSTIFIED. LEN1 = STRLEN( NS1 ).
WRITE SY-SAPRL TO NS2 LEFT-JUSTIFIED. LEN2 = STRLEN( NS2 ).
WRITE: 'sysid=' NO-GAP, AT (LEN1) NS1 NO-GAP,
', saprel=' NO-GAP, AT (LEN2) NS2 NO-GAP, ','.
DATA: SYSNO(2) TYPE N.
CALL FUNCTION 'GET_SYSTEM_NUMBER'
IMPORTING
INSTANCENUMBER = SYSNO.
WRITE SY-HOST TO NS1 LEFT-JUSTIFIED. LEN1 = STRLEN( NS1 ).
WRITE SY-OPSYS TO NS2 LEFT-JUSTIFIED. LEN2 = STRLEN( NS2 ).
WRITE SY-DBSYS TO NS3 LEFT-JUSTIFIED. LEN3 = STRLEN( NS3 ).
WRITE: 'host=' NO-GAP, AT (LEN1) NS1 NO-GAP,
', sysno=' NO-GAP, SYSNO NO-GAP,
', opsys=' NO-GAP, AT (LEN2) NS2 NO-GAP,
', dbsys=' NO-GAP, AT (LEN3) NS3 NO-GAP.
PERFORM GET_KINFO CHANGING KERNEL_REL KERNEL_PATCH.
WRITE KERNEL_REL TO NS1 LEFT-JUSTIFIED. LEN1 = STRLEN( NS1 ).
WRITE KERNEL_PATCH TO NS2 LEFT-JUSTIFIED. LEN2 = STRLEN( NS2 ).
WRITE: ', kernel_rel=' NO-GAP, AT (LEN1) NS1 NO-GAP,
', kernel_patch=' NO-GAP, AT (LEN2) NS2.
ENDFORM. "PRINT_SYSTEM_INFO
*&--------------------------------------------------------------------*
*& Form MAIN
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->VALUE(BENCH)
* -->VALUE(BENCH)
* -->VALUE(N)
*---------------------------------------------------------------------*
FORM MAIN USING VALUE(P_BENCH1) TYPE C
VALUE(P_BENCH2) TYPE C
VALUE(P_N) TYPE C.
CONSTANTS:
CALI_MS TYPE I VALUE 1001,
DELTA_MS TYPE I VALUE 100,
MAX_MS TYPE I VALUE 10000.
DATA:
T_START TYPE I,
BENCH1 TYPE I,
BENCH2 TYPE I,
N TYPE I,
BENCH_RES1 TYPE STANDARD TABLE OF F.
BENCH1 = P_BENCH1.
BENCH2 = P_BENCH2.
N = P_N.
* SET RUN TIME CLOCK RESOLUTION HIGH. "is default
PERFORM GET_MS CHANGING T_START.
* PERFORM CHECKBITS_INT1 CHANGING B_INT1.
* WRITE B_INT1 TO NS1 LEFT-JUSTIFIED. LEN1 = STRLEN( NS1 ).
* PERFORM CHECKBITS_PACKED1 CHANGING B_PACK1.
* WRITE B_PACK1 TO NS2 LEFT-JUSTIFIED. LEN2 = STRLEN( NS2 ).
* PERFORM CHECKBITS_DOUBLE1 CHANGING B_DOUBLE1.
* WRITE B_DOUBLE1 TO NS3 LEFT-JUSTIFIED. LEN3 = STRLEN( NS3 ).
* WRITE: / 'BM Bench v0.6 (ABAP) -- (int:' NO-GAP, AT (LEN1) NS1,
* 'packed:' NO-GAP, AT (LEN2) NS2, 'double:' NO-GAP,
* AT (LEN3) NS3 NO-GAP, ')'.
DATA:
STR(150) TYPE C,
STR_LEN TYPE I,
B_INT1 TYPE I.
STR = 'BM Bench v0.6 (ABAP) -- (int:'.
PERFORM CHECKBITS_INT1 CHANGING B_INT1.
PERFORM WRITE_I2STR USING B_INT1 CHANGING STR.
CONCATENATE STR ' packed:' INTO STR.
PERFORM CHECKBITS_PACKED1 CHANGING B_INT1.
PERFORM WRITE_I2STR USING B_INT1 CHANGING STR.
CONCATENATE STR ' double:' INTO STR.
PERFORM CHECKBITS_DOUBLE1 CHANGING B_INT1.
PERFORM WRITE_I2STR USING B_INT1 CHANGING STR.
CONCATENATE STR ')' INTO STR.
STR_LEN = STRLEN( STR ).
WRITE: AT (STR_LEN) STR.
PERFORM PRINT_SYSTEM_INFO.
WRITE: / '(c) Marco Vieth, 2006'.
WRITE: / 'Date:', SY-DATUM, SY-UZEIT.
SET COUNTRY 'EN'. "English decimal number format
BENCH2 = BENCH2 + 1 - BENCH1.
DO BENCH2 TIMES.
DATA:
BENCH TYPE I,
LOOPS TYPE I,
X TYPE I,
T1 TYPE I,
T2 TYPE I.
BENCH = BENCH1 + SY-INDEX - 1.
LOOPS = 1.
X = 0.
T1 = 0.
T2 = 0.
DATA:
BENCH_STR(10) TYPE C,
BENCH_STR_LEN TYPE I,
N_STR(10) TYPE C,
N_STR_LEN TYPE I.
WRITE BENCH TO BENCH_STR LEFT-JUSTIFIED NO-SIGN NO-GROUPING.
BENCH_STR_LEN = STRLEN( BENCH_STR ).
WRITE N TO N_STR LEFT-JUSTIFIED NO-SIGN NO-GROUPING.
N_STR_LEN = STRLEN( N_STR ).
WRITE: / 'Calibrating benchmark', AT (BENCH_STR_LEN) BENCH_STR,
'with n=' NO-GAP, AT (N_STR_LEN) N_STR.
WHILE 1 >= 1.
DATA:
T1_START TYPE I,
T_DELTA TYPE I,
LOOPS_P_SEC TYPE F.
PERFORM GET_MS CHANGING T1_START.
PERFORM RUN_BENCH USING BENCH LOOPS N CHANGING X.
PERFORM GET_MS CHANGING T1.
T1 = T1 - T1_START.
* compute difference abs(measures-estimated)
IF T2 > T1.
T_DELTA = T2 - T1.
ELSE.
T_DELTA = T1 - T2.
ENDIF.
IF T1 > 0.
LOOPS_P_SEC = LOOPS * 1000 / T1.
ELSE.
LOOPS_P_SEC = 0.
ENDIF.
DATA:
X_STR(10) TYPE C,
X_STR_LEN TYPE I.
IF X >= 0.
WRITE X TO X_STR LEFT-JUSTIFIED NO-SIGN NO-GROUPING.
ELSE.
WRITE X TO X_STR LEFT-JUSTIFIED NO-GROUPING.
ENDIF.
X_STR_LEN = STRLEN( X_STR ).
WRITE: /(10) LOOPS_P_SEC EXPONENT 0 DECIMALS 3 NO-GAP,
'/s (time=' NO-GAP,
(7) T1 NO-SIGN NO-GROUPING, 'ms, loops=',
(8) LOOPS NO-SIGN NO-GROUPING NO-GAP, ', delta=',
(6) T_DELTA NO-SIGN NO-GROUPING, 'ms, x=' NO-GAP,
AT (X_STR_LEN) X_STR NO-GAP, ')'.
* some error?
IF X = -1.
APPEND -1 TO BENCH_RES1.
EXIT.
ENDIF.
* do we have some estimated/expected time?
IF T2 > 0.
* smaller than delta_ms=100?
IF T_DELTA < DELTA_MS.
APPEND LOOPS_P_SEC TO BENCH_RES1.
DATA:
T1_STR(10) TYPE C,
T1_STR_LEN TYPE I,
LOOPS_STR(10) TYPE C,
LOOPS_STR_LEN TYPE I,
T_DELTA_STR(10) TYPE C,
T_DELTA_STR_LEN TYPE I,
LPS_STR(20) TYPE C,
LPS_STR_LEN TYPE I.
WRITE T1 TO T1_STR LEFT-JUSTIFIED NO-SIGN NO-GROUPING.
T1_STR_LEN = STRLEN( T1_STR ).
WRITE LOOPS TO LOOPS_STR LEFT-JUSTIFIED NO-SIGN NO-GROUPING.
LOOPS_STR_LEN = STRLEN( LOOPS_STR ).
WRITE T_DELTA TO T_DELTA_STR LEFT-JUSTIFIED NO-SIGN
NO-GROUPING.
T_DELTA_STR_LEN = STRLEN( T_DELTA_STR ).
WRITE LOOPS_P_SEC TO LPS_STR LEFT-JUSTIFIED NO-SIGN
NO-GROUPING EXPONENT 0 DECIMALS 3.
LPS_STR_LEN = STRLEN( LPS_STR ).
WRITE: / 'Benchmark', AT (BENCH_STR_LEN) BENCH_STR,
'(ABAP):', AT (LPS_STR_LEN) LPS_STR NO-GAP,
'/s (time=' NO-GAP, AT (T1_STR_LEN) T1_STR NO-SIGN,
'ms, loops=' NO-GAP, AT (LOOPS_STR_LEN) LOOPS_STR NO-GAP,
', delta=' NO-GAP, AT (T_DELTA_STR_LEN) T_DELTA_STR NO-GAP,
' ms)'.
EXIT.
ENDIF.
ENDIF.
IF T1 > MAX_MS.
DATA:
MAX_MS_STR(10) TYPE C,
MAX_MS_STR_LEN TYPE I.
WRITE T1 TO MAX_MS_STR LEFT-JUSTIFIED NO-SIGN NO-GROUPING.
MAX_MS_STR_LEN = STRLEN( MAX_MS_STR ).
WRITE: / 'Benchmark', AT (BENCH_STR_LEN) BENCH_STR,
'(ABAP): Time already >', AT (MAX_MS_STR_LEN) MAX_MS_STR,
'ms. No measurement possible.'.
APPEND -1 TO BENCH_RES1. "TTT??
EXIT.
ENDIF.
DATA:
SCALE_FACT TYPE I.
* scale a bit up to 1100 ms (cali_ms+100)
IF ( T1 < CALI_MS ) AND ( T1 > 0 ).
SCALE_FACT = ( ( CALI_MS + 100 ) DIV T1 ) + 1.
ELSE.
SCALE_FACT = 2.
ENDIF.
LOOPS = LOOPS * SCALE_FACT.
T2 = T1 * SCALE_FACT.
ENDWHILE.
ENDDO.
WRITE: / ''.
WRITE: / 'Throughput for all benchmarks (loops per sec):'.
WRITE: / 'BM Results (ABAP) :'.
DATA:
TMP_F TYPE F.
LOOP AT BENCH_RES1 INTO TMP_F.
WRITE: AT (9) TMP_F EXPONENT 0 DECIMALS 2 NO-SIGN.
ENDLOOP.
PERFORM GET_MS CHANGING T2.
T2 = T2 - T_START.
DATA:
T2_STR(10) TYPE C,
T2_STR_LEN TYPE I.
WRITE T2 TO T2_STR LEFT-JUSTIFIED NO-SIGN NO-GROUPING.
T2_STR_LEN = STRLEN( T2_STR ).
WRITE: / 'Total elapsed time:', AT (T2_STR_LEN) T2_STR, 'ms'.
ENDFORM. "MAIN
*
* end
* | 30.146423 | 73 | 0.413815 |
794d858a49f3e4a98410ee4b4f3a4e0814bb42f9 | 3,016 | abap | ABAP | src/objects/zcl_abapgit_object_enho_fugr.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | 1 | 2019-05-27T18:50:14.000Z | 2019-05-27T18:50:14.000Z | src/objects/zcl_abapgit_object_enho_fugr.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_enho_fugr.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | 1 | 2019-12-31T11:44:14.000Z | 2019-12-31T11:44:14.000Z | CLASS zcl_abapgit_object_enho_fugr DEFINITION PUBLIC.
PUBLIC SECTION.
METHODS: constructor
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
io_files TYPE REF TO zcl_abapgit_objects_files.
INTERFACES: zif_abapgit_object_enho.
PRIVATE SECTION.
DATA: ms_item TYPE zif_abapgit_definitions=>ty_item,
mo_files TYPE REF TO zcl_abapgit_objects_files.
ENDCLASS.
CLASS zcl_abapgit_object_enho_fugr IMPLEMENTATION.
METHOD constructor.
ms_item = is_item.
mo_files = io_files.
ENDMETHOD.
METHOD zif_abapgit_object_enho~deserialize.
DATA: lo_fugrdata TYPE REF TO cl_enh_tool_fugr,
ls_enha_data TYPE enhfugrdata,
li_tool TYPE REF TO if_enh_tool,
lv_tool TYPE enhtooltype,
lv_package TYPE devclass.
FIELD-SYMBOLS: <ls_fuba> TYPE enhfugrfuncdata.
io_xml->read(
EXPORTING
iv_name = 'TOOL'
CHANGING
cg_data = lv_tool ).
io_xml->read(
EXPORTING
iv_name = 'FUGRDATA'
CHANGING
cg_data = ls_enha_data ).
lv_package = iv_package.
TRY.
cl_enh_factory=>create_enhancement(
EXPORTING
enhname = |{ ms_item-obj_name }|
enhtype = ''
enhtooltype = lv_tool
IMPORTING
enhancement = li_tool
CHANGING
devclass = lv_package ).
lo_fugrdata ?= li_tool.
lo_fugrdata->set_fugr( ls_enha_data-fugr ).
LOOP AT ls_enha_data-enh_fubas ASSIGNING <ls_fuba>.
lo_fugrdata->set_func_data( func_name = <ls_fuba>-fuba
func_enhadata = <ls_fuba> ).
ENDLOOP.
lo_fugrdata->if_enh_object~save( run_dark = abap_true ).
lo_fugrdata->if_enh_object~unlock( ).
CATCH cx_enh_root.
zcx_abapgit_exception=>raise( |error deserializing ENHO fugrdata { ms_item-obj_name }| ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object_enho~serialize.
DATA: lo_fugrdata TYPE REF TO cl_enh_tool_fugr,
lv_fugr_name TYPE rs38l-area,
ls_enha_data TYPE enhfugrdata.
FIELD-SYMBOLS: <ls_docuobj> TYPE enhfugrparamdocu.
lo_fugrdata ?= ii_enh_tool.
lo_fugrdata->get_fugr(
IMPORTING
fugr_name = lv_fugr_name ).
TRY.
lo_fugrdata->get_all_data_for_fugr(
EXPORTING
fugr_name = lv_fugr_name
IMPORTING
enha_data = ls_enha_data ).
LOOP AT ls_enha_data-docuobjs ASSIGNING <ls_docuobj>.
CLEAR: <ls_docuobj>-shorttext,
<ls_docuobj>-longtext.
ENDLOOP.
CATCH cx_enh_not_found.
zcx_abapgit_exception=>raise( |error deserializing ENHO fugrdata { ms_item-obj_name }| ).
ENDTRY.
io_xml->add( iv_name = 'TOOL'
ig_data = lo_fugrdata->if_enh_tool~get_tool( ) ).
io_xml->add( iv_name = 'FUGRDATA'
ig_data = ls_enha_data ).
ENDMETHOD.
ENDCLASS.
| 24.721311 | 97 | 0.630305 |
795b3aa16eb54e139f792d2ad7ec14d467728dec | 5,301 | abap | ABAP | src/objects/zcl_abapgit_object_enhs.clas.abap | ravishankarojha/abapGit | 4bc4b63e0fcf5389457db5a36de643fe75977c2a | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_enhs.clas.abap | ravishankarojha/abapGit | 4bc4b63e0fcf5389457db5a36de643fe75977c2a | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_enhs.clas.abap | ravishankarojha/abapGit | 4bc4b63e0fcf5389457db5a36de643fe75977c2a | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_object_enhs DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS:
factory
IMPORTING
iv_tool TYPE enhtooltype
RETURNING
VALUE(ri_enho) TYPE REF TO zif_abapgit_object_enhs
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_ENHS IMPLEMENTATION.
METHOD factory.
CASE iv_tool.
WHEN cl_enh_tool_badi_def=>tooltype.
CREATE OBJECT ri_enho TYPE zcl_abapgit_object_enhs_badi_d.
WHEN cl_enh_tool_hook_def=>tool_type.
CREATE OBJECT ri_enho TYPE zcl_abapgit_object_enhs_hook_d.
WHEN OTHERS.
zcx_abapgit_exception=>raise( |ENHS: Unsupported tool { iv_tool }| ).
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
DATA: lv_spot_name TYPE enhspotname,
li_spot_ref TYPE REF TO if_enh_spot_tool.
lv_spot_name = ms_item-obj_name.
TRY.
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
li_spot_ref->get_attributes( IMPORTING changedby = rv_user ).
CATCH cx_enh_root.
rv_user = c_user_unknown.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_spot_name TYPE enhspotname,
li_enh_object TYPE REF TO if_enh_object.
lv_spot_name = ms_item-obj_name.
TRY.
li_enh_object ?= cl_enh_factory=>get_enhancement_spot( spot_name = lv_spot_name
lock = abap_true ).
li_enh_object->delete( nevertheless_delete = abap_true
run_dark = abap_true ).
li_enh_object->unlock( ).
CATCH cx_enh_root.
zcx_abapgit_exception=>raise( 'Error from CL_ENH_FACTORY' ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_parent TYPE enhspotcompositename,
lv_spot_name TYPE enhspotname,
lv_tool TYPE enhspottooltype,
lv_package LIKE iv_package,
li_spot_ref TYPE REF TO if_enh_spot_tool,
li_enhs TYPE REF TO zif_abapgit_object_enhs.
IF zif_abapgit_object~exists( ) = abap_true.
zif_abapgit_object~delete( ).
ENDIF.
io_xml->read( EXPORTING iv_name = 'TOOL'
CHANGING cg_data = lv_tool ).
lv_spot_name = ms_item-obj_name.
lv_package = iv_package.
TRY.
cl_enh_factory=>create_enhancement_spot(
EXPORTING
spot_name = lv_spot_name
tooltype = lv_tool
dark = abap_false
compositename = lv_parent
IMPORTING
spot = li_spot_ref
CHANGING
devclass = lv_package ).
CATCH cx_enh_root.
zcx_abapgit_exception=>raise( 'Error from CL_ENH_FACTORY' ).
ENDTRY.
li_enhs = factory( lv_tool ).
li_enhs->deserialize( io_xml = io_xml
iv_package = iv_package
ii_enh_spot_tool = li_spot_ref ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_spot_name TYPE enhspotname,
li_spot_ref TYPE REF TO if_enh_spot_tool.
lv_spot_name = ms_item-obj_name.
TRY.
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
rv_bool = abap_true.
CATCH cx_enh_root.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
DATA: ls_meta TYPE zif_abapgit_definitions=>ty_metadata.
ls_meta = get_metadata( ).
IF ls_meta-late_deser = abap_true.
APPEND zif_abapgit_object=>gc_step_id-late TO rt_steps.
ELSEIF ls_meta-ddic = abap_true.
APPEND zif_abapgit_object=>gc_step_id-ddic TO rt_steps.
ELSE.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
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.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW'
object_name = ms_item-obj_name
object_type = 'ENHS'
in_new_window = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_spot_name TYPE enhspotname,
li_spot_ref TYPE REF TO if_enh_spot_tool,
li_enhs TYPE REF TO zif_abapgit_object_enhs,
lx_root TYPE REF TO cx_root.
lv_spot_name = ms_item-obj_name.
TRY.
li_spot_ref = cl_enh_factory=>get_enhancement_spot( lv_spot_name ).
CATCH cx_enh_root INTO lx_root.
zcx_abapgit_exception=>raise( 'Error from CL_ENH_FACTORY' ).
ENDTRY.
li_enhs = factory( li_spot_ref->get_tool( ) ).
li_enhs->serialize( io_xml = io_xml
ii_enh_spot_tool = li_spot_ref ).
ENDMETHOD.
ENDCLASS.
| 24.428571 | 96 | 0.651575 |
795fbd1546a8c2ba70b744d66b6e17897f2c8607 | 1,331 | abap | ABAP | src/z_aqo_save_data.prog.abap | bizhuka/py_demo | 3c7f0e055785d63c03fef8d062b20966c5524a71 | [
"Apache-2.0"
] | null | null | null | src/z_aqo_save_data.prog.abap | bizhuka/py_demo | 3c7f0e055785d63c03fef8d062b20966c5524a71 | [
"Apache-2.0"
] | null | null | null | src/z_aqo_save_data.prog.abap | bizhuka/py_demo | 3c7f0e055785d63c03fef8d062b20966c5524a71 | [
"Apache-2.0"
] | null | null | null | *&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
REPORT z_aqo_save_data.
PARAMETERS:
p_exp RADIOBUTTON GROUP gr1 DEFAULT 'X',
p_imp RADIOBUTTON GROUP gr1.
CLASS lcl_main DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS:
start_of_selection RAISING zcx_eui_exception.
ENDCLASS.
CLASS lcl_main IMPLEMENTATION.
METHOD start_of_selection.
CASE abap_true.
WHEN p_exp.
SELECT * INTO TABLE @DATA(lt_data) "#EC CI_NOWHERE.
FROM ztaqo_option.
CALL TRANSFORMATION id SOURCE data = lt_data
RESULT XML DATA(lv_xml).
NEW zcl_eui_file( iv_xstring = lv_xml )->download( iv_save_dialog = 'X' ).
WHEN p_imp.
CHECK sy-sysid = 'SB6'.
DATA(lo_file) = NEW zcl_eui_file( )->import_from_file( ).
CALL TRANSFORMATION id SOURCE XML lo_file->mv_xstring
RESULT data = lt_data.
" DELETE FROM ztaqo_option.
INSERT ztaqo_option FROM TABLE lt_data.
COMMIT WORK AND WAIT.
ENDCASE.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
TRY.
lcl_main=>start_of_selection( ).
CATCH zcx_eui_exception INTO DATA(lo_error).
MESSAGE lo_error TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
| 28.319149 | 82 | 0.581518 |
7960678641f59768e64bfb4e866f6c10329a6a35 | 920 | abap | ABAP | src/ui/zcl_dbbr_tree_dnd_object.clas.abap | reichr-dev/abap-db-browser | d513d49692f1f0ee613c8eab2c99e325ef5b78fe | [
"MIT"
] | 15 | 2020-02-05T10:38:12.000Z | 2022-02-11T18:06:17.000Z | src/ui/zcl_dbbr_tree_dnd_object.clas.abap | reichr-dev/abap-db-browser | d513d49692f1f0ee613c8eab2c99e325ef5b78fe | [
"MIT"
] | 10 | 2021-01-19T07:45:37.000Z | 2021-07-15T19:08:54.000Z | src/ui/zcl_dbbr_tree_dnd_object.clas.abap | reichr-dev/abap-db-browser | d513d49692f1f0ee613c8eab2c99e325ef5b78fe | [
"MIT"
] | 9 | 2020-04-08T19:13:18.000Z | 2021-10-02T12:53:39.000Z | class ZCL_DBBR_TREE_DND_OBJECT definition
public
create public .
public section.
methods CONSTRUCTOR
importing
!IT_NODE_KEYS type TREEMNOTAB .
methods HAS_MORE_KEYS
returning
value(RF_HAS_MORE) type BOOLEAN .
methods GET_NEXT_NODE
returning
value(RV_NODE_KEY) type TM_NODEKEY .
methods GET_ALL_KEYS
returning
value(RT_KEYS) type TREEMNOTAB .
protected section.
private section.
data MT_NODE_KEYS type TREEMNOTAB .
ENDCLASS.
CLASS ZCL_DBBR_TREE_DND_OBJECT IMPLEMENTATION.
method CONSTRUCTOR.
mt_node_keys = it_node_keys.
endmethod.
method GET_ALL_KEYS.
rt_keys = mt_node_keys.
endmethod.
method GET_NEXT_NODE.
CHECK has_more_keys( ).
rv_node_key = mt_node_keys[ 1 ].
DELETE mt_node_keys INDEX 1.
endmethod.
method HAS_MORE_KEYS.
rf_has_more = xsdbool( mt_node_keys IS NOT INITIAL ).
endmethod.
ENDCLASS.
| 15.333333 | 57 | 0.729348 |
796465bbf615f86d5486746ed32d775e2b4314b8 | 763 | abap | ABAP | src/objects/ecatt/ycl_abapgit_ecatt_script_upl.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | null | null | null | src/objects/ecatt/ycl_abapgit_ecatt_script_upl.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | null | null | null | src/objects/ecatt/ycl_abapgit_ecatt_script_upl.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | 2 | 2019-11-24T20:35:16.000Z | 2020-04-16T07:29:33.000Z | CLASS ycl_abapgit_ecatt_script_upl DEFINITION
PUBLIC
INHERITING FROM cl_apl_ecatt_script_upload
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS:
z_set_stream_for_upload
IMPORTING
iv_xml TYPE xstring.
PROTECTED SECTION.
METHODS:
upload_data_from_stream REDEFINITION.
PRIVATE SECTION.
DATA: mv_external_xml TYPE xstring.
ENDCLASS.
CLASS YCL_ABAPGIT_ECATT_SCRIPT_UPL IMPLEMENTATION.
METHOD upload_data_from_stream.
" Downport
template_over_all = ycl_abapgit_ecatt_helper=>upload_data_from_stream( mv_external_xml ).
ENDMETHOD.
METHOD z_set_stream_for_upload.
" downport from CL_ABAPGIT_ECATT_DATA_UPLOAD SET_STREAM_FOR_UPLOAD
mv_external_xml = iv_xml.
ENDMETHOD.
ENDCLASS.
| 18.166667 | 93 | 0.76671 |
7965efebb3a9369970eeb00b2a52c0480dc98311 | 3,271 | abap | ABAP | src/model/zcl_wasm_module.clas.abap | larshp/abap-wasm | 6837323d08d9cb1476b6b1611ccbb0bf637f812f | [
"MIT"
] | 11 | 2020-01-02T14:28:48.000Z | 2021-12-10T11:18:13.000Z | src/model/zcl_wasm_module.clas.abap | larshp/abap-wasm | 6837323d08d9cb1476b6b1611ccbb0bf637f812f | [
"MIT"
] | 12 | 2019-12-27T11:03:01.000Z | 2021-07-15T13:45:47.000Z | src/model/zcl_wasm_module.clas.abap | larshp/abap-wasm | 6837323d08d9cb1476b6b1611ccbb0bf637f812f | [
"MIT"
] | null | null | null | CLASS zcl_wasm_module DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
TYPES:
BEGIN OF ty_type,
parameter_types TYPE xstring,
result_types TYPE xstring,
END OF ty_type .
TYPES:
ty_types TYPE STANDARD TABLE OF ty_type WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_code,
locals TYPE xstring,
instructions TYPE xstring,
END OF ty_code .
TYPES:
ty_codes TYPE STANDARD TABLE OF ty_code WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_export,
name TYPE string,
type TYPE x LENGTH 1,
index TYPE i,
END OF ty_export .
TYPES:
ty_exports TYPE STANDARD TABLE OF ty_export WITH DEFAULT KEY .
TYPES:
ty_functions TYPE STANDARD TABLE OF i WITH DEFAULT KEY .
METHODS constructor
IMPORTING
!it_types TYPE ty_types OPTIONAL
!it_codes TYPE ty_codes OPTIONAL
!it_exports TYPE ty_exports OPTIONAL
!it_functions TYPE ty_functions OPTIONAL .
METHODS get_types
RETURNING
VALUE(rt_result) TYPE ty_types .
METHODS get_codes
RETURNING
VALUE(rt_result) TYPE ty_codes .
METHODS get_exports
RETURNING
VALUE(rt_result) TYPE ty_exports .
METHODS get_functions
RETURNING
VALUE(rt_result) TYPE ty_functions .
METHODS get_code_by_index
IMPORTING
!iv_index TYPE i
RETURNING
VALUE(rs_code) TYPE ty_code.
METHODS get_function_by_index
IMPORTING
!iv_index TYPE i
RETURNING
VALUE(rv_type) TYPE i .
METHODS get_export_by_name
IMPORTING
!iv_name TYPE string
RETURNING
VALUE(rs_export) TYPE ty_export .
METHODS get_type_by_index
IMPORTING
!iv_index TYPE i
RETURNING
VALUE(rs_type) TYPE ty_type .
PROTECTED SECTION.
PRIVATE SECTION.
DATA mt_types TYPE ty_types .
DATA mt_codes TYPE ty_codes .
DATA mt_exports TYPE ty_exports .
DATA mt_functions TYPE ty_functions .
ENDCLASS.
CLASS ZCL_WASM_MODULE IMPLEMENTATION.
METHOD constructor.
mt_types = it_types.
mt_codes = it_codes.
mt_exports = it_exports.
mt_functions = it_functions.
ENDMETHOD.
METHOD get_codes.
rt_result = mt_codes.
ENDMETHOD.
METHOD get_code_by_index.
* index is zero based
DATA(lv_index) = iv_index + 1.
READ TABLE mt_codes INDEX lv_index INTO rs_code.
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD get_exports.
rt_result = mt_exports.
ENDMETHOD.
METHOD get_export_by_name.
* todo, this should read "WITH KEY name = iv_name" instead
READ TABLE mt_exports INDEX 1 INTO rs_export.
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD get_functions.
rt_result = mt_functions.
ENDMETHOD.
METHOD get_function_by_index.
* index is zero based
DATA(lv_index) = iv_index + 1.
READ TABLE mt_functions INDEX lv_index INTO rv_type.
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD get_types.
rt_result = mt_types.
ENDMETHOD.
METHOD get_type_by_index.
* index is zero based
DATA(lv_index) = iv_index + 1.
READ TABLE mt_types INDEX lv_index INTO rs_type.
ASSERT sy-subrc = 0.
ENDMETHOD.
ENDCLASS.
| 21.379085 | 68 | 0.660654 |
79690ba356391f7d484d7ace18aef5109cdca4b1 | 525 | abap | ABAP | src/zmarkdown.prog.abap | FreHu/zmarkdown | 450c8933ca4a5f89a4e5a1a6b0dbadf6363f8c3e | [
"Unlicense"
] | 1 | 2022-03-17T09:33:25.000Z | 2022-03-17T09:33:25.000Z | src/zmarkdown.prog.abap | FreHu/zmarkdown | 450c8933ca4a5f89a4e5a1a6b0dbadf6363f8c3e | [
"Unlicense"
] | 6 | 2021-02-05T20:12:13.000Z | 2021-02-13T10:44:55.000Z | src/zmarkdown.prog.abap | FreHu/zmarkdown | 450c8933ca4a5f89a4e5a1a6b0dbadf6363f8c3e | [
"Unlicense"
] | null | null | null | report zmarkdown.
data(demo) = new zcl_markdown_demo( ).
cl_demo_output=>display_text( demo->get( ) ).
data(class_docu) = new zcl_markdown_docu_clas(
class_name = `ZCL_MARKDOWN_DOCU_CLAS`
document = new zcl_markdown( ) ).
cl_demo_output=>display_text( class_docu->doc->content ).
class_docu = new zcl_markdown_docu_clas(
class_name = `ZCL_MARKDOWN_DOCU_CLAS`
document = new zcl_markdown_html( ) ).
cl_demo_output=>display_html(
zcl_markdown_html=>html(
zcl_markdown_html=>body( class_docu->doc->content ) ) ).
| 30.882353 | 58 | 0.76 |
796bf4f39f9454274323ddc87c9b0994ca0e8a9e | 1,871 | abap | ABAP | zcl_oa2c_specifics_zazure.clas.abap | gregorwolf/abapOAuthAzure | b4d23d2ccf46fb12245f99b52647af2c521c7bd9 | [
"Apache-2.0"
] | 4 | 2018-05-13T06:55:40.000Z | 2020-02-14T18:50:09.000Z | zcl_oa2c_specifics_zazure.clas.abap | gregorwolf/abapOAuthAzure | b4d23d2ccf46fb12245f99b52647af2c521c7bd9 | [
"Apache-2.0"
] | null | null | null | zcl_oa2c_specifics_zazure.clas.abap | gregorwolf/abapOAuthAzure | b4d23d2ccf46fb12245f99b52647af2c521c7bd9 | [
"Apache-2.0"
] | null | null | null | class ZCL_OA2C_SPECIFICS_ZAZURE definition
public
inheriting from CL_OA2C_SPECIFICS_ABSTRACT
create public .
public section.
methods IF_OA2C_SPECIFICS~GET_CONFIG_EXTENSION
redefinition .
methods IF_OA2C_SPECIFICS~GET_ENDPOINT_SETTINGS
redefinition .
methods IF_OA2C_SPECIFICS~GET_SUPPORTED_GRANT_TYPES
redefinition .
methods IF_OA2C_SPECIFICS~GET_AC_AUTH_REQU_PARAM_NAMES
redefinition .
protected section.
private section.
ENDCLASS.
CLASS ZCL_OA2C_SPECIFICS_ZAZURE IMPLEMENTATION.
METHOD if_oa2c_specifics~get_ac_auth_requ_param_names.
DATA: ls_add_param TYPE if_oa2c_specifics~ty_s_add_param.
CALL METHOD super->if_oa2c_specifics~get_ac_auth_requ_param_names
IMPORTING
e_client_id = e_client_id
e_redirect_uri = e_redirect_uri
e_response_type = e_response_type
e_response_type_value = e_response_type_value
e_scope = e_scope.
ls_add_param-name = `resource`.
INSERT ls_add_param INTO TABLE et_add_param_names.
ls_add_param-name = `prompt`.
INSERT ls_add_param INTO TABLE et_add_param_names.
ENDMETHOD.
METHOD if_oa2c_specifics~get_config_extension.
r_config_extension = `ZAZURE`.
ENDMETHOD.
METHOD if_oa2c_specifics~get_endpoint_settings.
CONSTANTS c_app_id TYPE string VALUE ''.
e_changeable = abap_false.
e_authorization_endpoint_path = `login.windows.net/` && c_app_id && `/oauth2/authorize`.
e_token_endpoint_path = `login.windows.net/` && c_app_id && `/oauth2/token`.
CLEAR e_revocation_endpoint_path.
ENDMETHOD.
method IF_OA2C_SPECIFICS~GET_SUPPORTED_GRANT_TYPES.
e_authorization_code = abap_true.
e_saml20_assertion = abap_false.
e_refresh = abap_true.
e_revocation = abap_false.
endmethod.
ENDCLASS.
| 27.115942 | 92 | 0.738108 |
796edf9da61255952a539586535639f5a13c95bf | 3,721 | abap | ABAP | src/zcl_excel_data_validation.clas.abap | bizhuka/abap2xlsx | d69d4d6fdfb4090c50991b56b16809cf1c092001 | [
"Apache-2.0"
] | 1 | 2022-01-20T23:59:28.000Z | 2022-01-20T23:59:28.000Z | src/zcl_excel_data_validation.clas.abap | gregorwolf/abap2xlsx | 5110f924b435e23f4474381d0e43f0686b9d0421 | [
"Apache-2.0"
] | null | null | null | src/zcl_excel_data_validation.clas.abap | gregorwolf/abap2xlsx | 5110f924b435e23f4474381d0e43f0686b9d0421 | [
"Apache-2.0"
] | 1 | 2021-07-09T02:06:21.000Z | 2021-07-09T02:06:21.000Z | class ZCL_EXCEL_DATA_VALIDATION definition
public
final
create public .
public section.
*"* public components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
type-pools ABAP .
data ERRORSTYLE type ZEXCEL_DATA_VAL_ERROR_STYLE .
data OPERATOR type ZEXCEL_DATA_VAL_OPERATOR .
data ALLOWBLANK type FLAG value 'X'. "#EC NOTEXT . . . . . . . . . . " .
data CELL_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA .
data CELL_COLUMN_TO type ZEXCEL_CELL_COLUMN_ALPHA .
data CELL_ROW type ZEXCEL_CELL_ROW .
data CELL_ROW_TO type ZEXCEL_CELL_ROW .
constants C_TYPE_CUSTOM type ZEXCEL_DATA_VAL_TYPE value 'custom'. "#EC NOTEXT
constants C_TYPE_LIST type ZEXCEL_DATA_VAL_TYPE value 'list'. "#EC NOTEXT
data SHOWERRORMESSAGE type FLAG value 'X'. "#EC NOTEXT . . . . . . . . . . " .
data SHOWINPUTMESSAGE type FLAG value 'X'. "#EC NOTEXT . . . . . . . . . . " .
data TYPE type ZEXCEL_DATA_VAL_TYPE .
data FORMULA1 type ZEXCEL_VALIDATION_FORMULA1 .
data FORMULA2 type ZEXCEL_VALIDATION_FORMULA1 .
constants C_TYPE_NONE type ZEXCEL_DATA_VAL_TYPE value 'none'. "#EC NOTEXT
constants C_TYPE_DATE type ZEXCEL_DATA_VAL_TYPE value 'date'. "#EC NOTEXT
constants C_TYPE_DECIMAL type ZEXCEL_DATA_VAL_TYPE value 'decimal'. "#EC NOTEXT
constants C_TYPE_TEXTLENGTH type ZEXCEL_DATA_VAL_TYPE value 'textLength'. "#EC NOTEXT
constants C_TYPE_TIME type ZEXCEL_DATA_VAL_TYPE value 'time'. "#EC NOTEXT
constants C_TYPE_WHOLE type ZEXCEL_DATA_VAL_TYPE value 'whole'. "#EC NOTEXT
constants C_STYLE_STOP type ZEXCEL_DATA_VAL_ERROR_STYLE value 'stop'. "#EC NOTEXT
constants C_STYLE_WARNING type ZEXCEL_DATA_VAL_ERROR_STYLE value 'warning'. "#EC NOTEXT
constants C_STYLE_INFORMATION type ZEXCEL_DATA_VAL_ERROR_STYLE value 'information'. "#EC NOTEXT
constants C_OPERATOR_BETWEEN type ZEXCEL_DATA_VAL_OPERATOR value 'between'. "#EC NOTEXT
constants C_OPERATOR_EQUAL type ZEXCEL_DATA_VAL_OPERATOR value 'equal'. "#EC NOTEXT
constants C_OPERATOR_GREATERTHAN type ZEXCEL_DATA_VAL_OPERATOR value 'greaterThan'. "#EC NOTEXT
constants C_OPERATOR_GREATERTHANOREQUAL type ZEXCEL_DATA_VAL_OPERATOR value 'greaterThanOrEqual'. "#EC NOTEXT
constants C_OPERATOR_LESSTHAN type ZEXCEL_DATA_VAL_OPERATOR value 'lessThan'. "#EC NOTEXT
constants C_OPERATOR_LESSTHANOREQUAL type ZEXCEL_DATA_VAL_OPERATOR value 'lessThanOrEqual'. "#EC NOTEXT
constants C_OPERATOR_NOTBETWEEN type ZEXCEL_DATA_VAL_OPERATOR value 'notBetween'. "#EC NOTEXT
constants C_OPERATOR_NOTEQUAL type ZEXCEL_DATA_VAL_OPERATOR value 'notEqual'. "#EC NOTEXT
data SHOWDROPDOWN type FLAG .
data ERRORTITLE type STRING .
data ERROR type STRING .
data PROMPTTITLE type STRING .
data PROMPT type STRING .
methods CONSTRUCTOR .
*"* protected components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
*"* protected components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
protected section.
private section.
*"* private components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
ENDCLASS.
CLASS ZCL_EXCEL_DATA_VALIDATION IMPLEMENTATION.
method CONSTRUCTOR.
" Initialise instance variables
formula1 = ''.
formula2 = ''.
type = me->c_type_none.
errorstyle = me->c_style_stop.
operator = ''.
allowblank = abap_false.
showdropdown = abap_false.
showinputmessage = abap_true.
showerrormessage = abap_true.
errortitle = ''.
error = ''.
prompttitle = ''.
prompt = ''.
* inizialize dimension range
cell_row = 1.
cell_column = 'A'.
endmethod.
ENDCLASS.
| 44.297619 | 111 | 0.74953 |
796f45bdd7aee479bff5b94b33157292e9884a4a | 4,228 | abap | ABAP | src/#usi#bal_data_containers/#usi#cl_bal_dc_html.clas.testclasses.abap | SchwarzIT/sap-usi-logging-api | 35eab62618409a75987fa90c655b00a98b5dbe76 | [
"Apache-2.0"
] | 19 | 2022-01-20T19:07:52.000Z | 2022-03-15T19:14:34.000Z | src/#usi#bal_data_containers/#usi#cl_bal_dc_html.clas.testclasses.abap | SchwarzIT/sap-usi-logging-api | 35eab62618409a75987fa90c655b00a98b5dbe76 | [
"Apache-2.0"
] | 4 | 2022-01-26T22:52:22.000Z | 2022-01-26T23:33:59.000Z | src/#usi#bal_data_containers/#usi#cl_bal_dc_html.clas.testclasses.abap | SchwarzIT/sap-usi-logging-api | 35eab62618409a75987fa90c655b00a98b5dbe76 | [
"Apache-2.0"
] | null | null | null | *"* use this source file for your ABAP unit test classes
*--------------------------------------------------------------------*
* Unit test: Serialization
*--------------------------------------------------------------------*
CLASS lcl_unit_tests_serialization DEFINITION DEFERRED.
CLASS /usi/cl_bal_dc_html DEFINITION LOCAL FRIENDS lcl_unit_tests_serialization.
CLASS lcl_unit_tests_serialization DEFINITION FINAL FOR TESTING.
"#AU Risk_Level Harmless
"#AU Duration Short
PRIVATE SECTION.
METHODS test_deserialize_bad_xml FOR TESTING.
METHODS test_deserialize_valid_xml FOR TESTING.
ENDCLASS.
CLASS lcl_unit_tests_serialization IMPLEMENTATION.
METHOD test_deserialize_bad_xml.
DATA: cut TYPE REF TO /usi/cl_bal_dc_html.
TRY.
cut ?= /usi/cl_bal_dc_html=>/usi/if_bal_data_container~deserialize( `Garbage input - should fail.` ).
cl_aunit_assert=>fail( 'Input was garbage! Exception expected!' ).
CATCH /usi/cx_bal_root.
RETURN.
ENDTRY.
ENDMETHOD.
METHOD test_deserialize_valid_xml.
DATA: cut TYPE REF TO /usi/cl_bal_dc_html,
document TYPE string,
title TYPE REF TO /usi/if_bal_text_container_c40,
serialized_data_container TYPE /usi/bal_xml_string,
serialized_title_in TYPE /usi/bal_xml_string,
serialized_title_out TYPE /usi/bal_xml_string,
unexpected_exception TYPE REF TO /usi/cx_bal_root.
" serialize
document = `<html><head/><body><p>test document</p></body></html>`.
CREATE OBJECT title TYPE /usi/cl_bal_tc_literal_c40
EXPORTING
i_text = 'Test document title'.
CREATE OBJECT cut
EXPORTING
i_html_document = document
i_document_title = title.
TRY.
serialized_data_container = cut->/usi/if_bal_data_container~serialize( ).
CATCH /usi/cx_bal_root INTO unexpected_exception.
/usi/cl_bal_aunit_exception=>fail_on_unexpected_exception( unexpected_exception ).
ENDTRY.
CLEAR cut.
" deserialize
TRY.
cut ?= /usi/cl_bal_dc_html=>/usi/if_bal_data_container~deserialize( serialized_data_container ).
CATCH /usi/cx_bal_root INTO unexpected_exception.
/usi/cl_bal_aunit_exception=>fail_on_unexpected_exception( unexpected_exception ).
ENDTRY.
" compare
cl_aunit_assert=>assert_equals(
act = cut->html_document
exp = document
).
serialized_title_in = title->serialize( ).
serialized_title_out = cut->document_title->serialize( ).
cl_aunit_assert=>assert_equals(
act = serialized_title_out
exp = serialized_title_in
).
ENDMETHOD.
ENDCLASS.
*--------------------------------------------------------------------*
* Unit test: Cardinality
*--------------------------------------------------------------------*
CLASS lcl_unit_test_cardinality DEFINITION FINAL FOR TESTING.
"#AU Risk_Level Harmless
"#AU Duration Short
PRIVATE SECTION.
METHODS assert_is_multi_use FOR TESTING.
ENDCLASS.
CLASS lcl_unit_test_cardinality IMPLEMENTATION.
METHOD assert_is_multi_use.
DATA actual_result TYPE abap_bool.
actual_result = /usi/cl_bal_dc_html=>/usi/if_bal_data_container~is_multiple_use_allowed( ).
cl_aunit_assert=>assert_equals(
act = actual_result
exp = abap_true
).
ENDMETHOD.
ENDCLASS.
*--------------------------------------------------------------------*
* Unit test: Classname
*--------------------------------------------------------------------*
CLASS lcl_unit_test_classname DEFINITION FINAL CREATE PUBLIC FOR TESTING.
"#AU Risk_Level Harmless
"#AU Duration Short
PRIVATE SECTION.
METHODS assert_returns_right_classname FOR TESTING.
ENDCLASS.
CLASS lcl_unit_test_classname IMPLEMENTATION.
METHOD assert_returns_right_classname.
DATA: cut_description TYPE REF TO /usi/cl_bal_aunit_cut_descr_cl,
actual_result TYPE classname.
actual_result = /usi/cl_bal_dc_html=>/usi/if_bal_data_container~get_classname( ).
cut_description = /usi/cl_bal_aunit_cut_descr_cl=>get_instance( ).
cut_description->assert_classname_equals( actual_result ).
ENDMETHOD.
ENDCLASS.
| 35.233333 | 109 | 0.651372 |
797531dc703c587b36c9a98b433db9c3776e6e82 | 904 | abap | ABAP | src/zrecai.fugr.saplzrecai.abap | cesar-sap/abap_recast_web_hook | b8235540ec910098ccaab2a1ae314692971c3a83 | [
"Apache-2.0"
] | null | null | null | src/zrecai.fugr.saplzrecai.abap | cesar-sap/abap_recast_web_hook | b8235540ec910098ccaab2a1ae314692971c3a83 | [
"Apache-2.0"
] | null | null | null | src/zrecai.fugr.saplzrecai.abap | cesar-sap/abap_recast_web_hook | b8235540ec910098ccaab2a1ae314692971c3a83 | [
"Apache-2.0"
] | null | null | null | *******************************************************************
* System-defined Include-files. *
*******************************************************************
INCLUDE LZRECAITOP. " Global Declarations
INCLUDE LZRECAIUXX. " Function Modules
*******************************************************************
* User-defined Include-files (if necessary). *
*******************************************************************
* INCLUDE LZRECAIF... " Subroutines
* INCLUDE LZRECAIO... " PBO-Modules
* INCLUDE LZRECAII... " PAI-Modules
* INCLUDE LZRECAIE... " Events
* INCLUDE LZRECAIP... " Local class implement.
* INCLUDE LZRECAIT99. " ABAP Unit tests
| 56.5 | 69 | 0.317478 |
7979a230a2ef01a8ce855ded7da4331a53a54e5f | 12,094 | abap | ABAP | src/ui/zcl_abapgit_hotkeys.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | null | null | null | src/ui/zcl_abapgit_hotkeys.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | null | null | null | src/ui/zcl_abapgit_hotkeys.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_hotkeys DEFINITION
PUBLIC
FINAL
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,
gt_interface_implementations TYPE saboo_iimpt.
CLASS-METHODS:
filter_relevant_classes
IMPORTING
it_classes TYPE seo_relkeys
RETURNING
VALUE(rt_classes) TYPE seo_relkeys,
get_class_package
IMPORTING
iv_class_name TYPE seoclsname
RETURNING
VALUE(rv_package) TYPE devclass,
get_referred_class_name
IMPORTING
io_ref TYPE any
RETURNING
VALUE(rv_name) TYPE seoclsname,
get_hotkeys_by_class_name
IMPORTING
iv_class_name TYPE seoclsname
RETURNING
VALUE(rt_hotkeys) TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr,
get_hotkeys_from_global_intf
RETURNING
VALUE(rt_hotkeys) TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr
RAISING
zcx_abapgit_exception,
get_hotkeys_from_local_intf
RETURNING
VALUE(rt_hotkeys) TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr
RAISING
zcx_abapgit_exception,
get_local_intf_implementations
RETURNING
VALUE(rt_interface_implementations) TYPE saboo_iimpt
RAISING
zcx_abapgit_exception,
render_js_part
IMPORTING
it_hotkeys TYPE zif_abapgit_gui_hotkeys=>tty_hotkey_with_descr
RETURNING
VALUE(ro_html) TYPE REF TO zcl_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_js_part.
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 ro_html.
ro_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.
" Note
" normally render method should be able to call mi_gui_services->get_html_parts( )
" thus the class must inherit from zcl_abapgit_gui_component
" but problem is that component constructor calls get_gui which creates gui if it is missing
" and the hotkeys class itself is created during get_gui so it is infinite loop
" solutions:
" A) separate hotkeys into logic and render (which is actually a good way, but it so nicely fit together ...)
" B) convert mi_gui_services to a getter - which I will do but later
zcl_abapgit_ui_factory=>get_gui_services( )->get_html_parts( )->add_part(
iv_collection = zcl_abapgit_gui_component=>c_html_parts-scripts
ii_part = render_js_part( 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.21256 | 117 | 0.694642 |
797a9ab33724a4cf8b7055bac0bec285e02df744 | 2,238 | abap | ABAP | src/zkr_postcode.fugr.lzkr_postcodetop.abap | boy0korea/kr_postcode | 07548da1053c8bfdd88e50a2d94c58f0703e4662 | [
"MIT"
] | null | null | null | src/zkr_postcode.fugr.lzkr_postcodetop.abap | boy0korea/kr_postcode | 07548da1053c8bfdd88e50a2d94c58f0703e4662 | [
"MIT"
] | null | null | null | src/zkr_postcode.fugr.lzkr_postcodetop.abap | boy0korea/kr_postcode | 07548da1053c8bfdd88e50a2d94c58f0703e4662 | [
"MIT"
] | null | null | null | FUNCTION-POOL zkr_postcode. "MESSAGE-ID ..
CLASS lcl_event_handler DEFINITION DEFERRED.
DATA: gs_addr TYPE zcl_kr_postcode=>ts_addr,
go_gui_full_screen TYPE REF TO cl_gui_docking_container,
go_gui_html_viewer TYPE REF TO cl_gui_html_viewer,
go_event_handler TYPE REF TO lcl_event_handler.
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS on_sapevent
FOR EVENT sapevent OF cl_gui_html_viewer
IMPORTING
!action
!frame
!getdata
!postdata
!query_table .
ENDCLASS. "lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_sapevent.
PERFORM on_sapevent USING action postdata.
ENDMETHOD.
ENDCLASS. "lcl_event_handler IMPLEMENTATION
CLASS lcl_on_close_wdr_f4_elementary DEFINITION.
PUBLIC SECTION.
CLASS-METHODS on_close
FOR EVENT on_controller_exit OF cl_wdr_controller
IMPORTING controller.
ENDCLASS.
CLASS lcl_on_close_wdr_f4_elementary IMPLEMENTATION.
METHOD on_close.
DATA: lo_m TYPE REF TO if_wd_message_manager,
lt_m TYPE if_wd_message_manager=>ty_t_messages,
ls_m TYPE if_wd_message_manager=>ty_s_message.
IF controller->component->component_name EQ 'WDR_F4_ELEMENTARY'.
lo_m = controller->component->if_wd_controller~get_message_manager( ).
lt_m = lo_m->get_messages( ).
LOOP AT lt_m INTO ls_m.
IF ls_m-msg_object IS INSTANCE OF cx_wdr_value_help.
lo_m->remove_message( ls_m-msg_id ).
ENDIF.
ENDLOOP.
SET HANDLER lcl_on_close_wdr_f4_elementary=>on_close ACTIVATION abap_false.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 36.688525 | 81 | 0.577748 |
797c7533f0b40396edf644aa2579610ca32f0be4 | 3,645 | abap | ABAP | src/foundation/y_scan_statistics.clas.testclasses.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | null | null | null | src/foundation/y_scan_statistics.clas.testclasses.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | 1 | 2022-02-27T18:48:26.000Z | 2022-02-27T18:48:26.000Z | src/foundation/y_scan_statistics.clas.testclasses.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | null | null | null | CLASS ltc_statistics DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
DATA: cut TYPE REF TO y_if_scan_statistics.
METHODS:
setup,
is_bound FOR TESTING,
check_errors FOR TESTING,
check_warnings FOR TESTING,
check_notes FOR TESTING,
check_pseudo_comments FOR TESTING,
increment_pseudo_comments FOR TESTING.
ENDCLASS.
CLASS ltc_statistics IMPLEMENTATION.
METHOD setup.
cut ?= NEW y_scan_statistics( ).
ENDMETHOD.
METHOD is_bound.
cl_abap_unit_assert=>assert_bound( cut ).
ENDMETHOD.
METHOD check_errors.
cut->collect( kind = y_check_base=>c_error
pc = '' ).
cl_abap_unit_assert=>assert_equals( act = cut->count-errors
exp = 1 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-warnings
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-notes
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-pseudo_comments
exp = 0 ).
ENDMETHOD.
METHOD check_warnings.
cut->collect( kind = y_check_base=>c_warning
pc = '' ).
cl_abap_unit_assert=>assert_equals( act = cut->count-errors
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-warnings
exp = 1 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-notes
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-pseudo_comments
exp = 0 ).
ENDMETHOD.
METHOD check_notes.
cut->collect( kind = y_check_base=>c_note
pc = '' ).
cl_abap_unit_assert=>assert_equals( act = cut->count-errors
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-warnings
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-notes
exp = 1 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-pseudo_comments
exp = 0 ).
ENDMETHOD.
METHOD check_pseudo_comments.
cut->collect( kind = y_check_base=>c_error
pc = 'P' ).
cl_abap_unit_assert=>assert_equals( act = cut->count-errors
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-warnings
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-notes
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-pseudo_comments
exp = 1 ).
ENDMETHOD.
METHOD increment_pseudo_comments.
cut->collect( kind = y_check_base=>c_error
pc = 'P' ).
cut->collect( kind = y_check_base=>c_error
pc = 'P' ).
cl_abap_unit_assert=>assert_equals( act = cut->count-errors
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-warnings
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-notes
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = cut->count-pseudo_comments
exp = 2 ).
ENDMETHOD.
ENDCLASS.
| 31.422414 | 72 | 0.524829 |
797f18bc912ab4849172ee63f0fcc3bdfd293deb | 22,466 | abap | ABAP | src/objects/zcl_abapgit_object_devc.clas.abap | stoamandl/abapGit-1.80.0 | a683f04e6519f6b4257f314ed554fbc1c6bd9631 | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_devc.clas.abap | stoamandl/abapGit-1.80.0 | a683f04e6519f6b4257f314ed554fbc1c6bd9631 | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_devc.clas.abap | stoamandl/abapGit-1.80.0 | a683f04e6519f6b4257f314ed554fbc1c6bd9631 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_object_devc DEFINITION PUBLIC
INHERITING FROM zcl_abapgit_objects_super
FINAL.
PUBLIC SECTION.
INTERFACES:
zif_abapgit_object.
ALIASES:
mo_files FOR zif_abapgit_object~mo_files.
METHODS:
constructor IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item
iv_language TYPE spras.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS:
get_package RETURNING VALUE(ri_package) TYPE REF TO if_package
RAISING zcx_abapgit_exception,
update_pinf_usages IMPORTING ii_package TYPE REF TO if_package
it_usage_data TYPE scomppdata
RAISING zcx_abapgit_exception,
set_lock IMPORTING ii_package TYPE REF TO if_package
iv_lock TYPE abap_bool
RAISING zcx_abapgit_exception,
is_empty
IMPORTING iv_package_name TYPE devclass
RETURNING VALUE(rv_is_empty) TYPE abap_bool
RAISING zcx_abapgit_exception,
load_package
IMPORTING iv_package_name TYPE devclass
RETURNING VALUE(ri_package) TYPE REF TO if_package
RAISING zcx_abapgit_exception.
DATA:
mv_local_devclass TYPE devclass.
ENDCLASS.
CLASS zcl_abapgit_object_devc IMPLEMENTATION.
METHOD constructor.
super->constructor( is_item = is_item
iv_language = iv_language ).
IF is_item-devclass IS NOT INITIAL.
mv_local_devclass = is_item-devclass.
ELSE.
mv_local_devclass = is_item-obj_name.
ENDIF.
ENDMETHOD.
METHOD get_package.
IF me->zif_abapgit_object~exists( ) = abap_true.
ri_package = load_package( mv_local_devclass ).
ENDIF.
ENDMETHOD.
METHOD is_empty.
DATA: lv_object_name TYPE tadir-obj_name,
lt_subpackages TYPE zif_abapgit_sap_package=>ty_devclass_tt.
lt_subpackages = zcl_abapgit_factory=>get_sap_package( iv_package_name )->list_subpackages( ).
IF lines( lt_subpackages ) > 0.
rv_is_empty = abap_false.
RETURN.
ENDIF.
SELECT SINGLE obj_name
FROM tadir
INTO lv_object_name
WHERE pgmid = 'R3TR'
AND NOT ( object = 'DEVC' AND obj_name = iv_package_name )
AND devclass = iv_package_name.
rv_is_empty = boolc( sy-subrc <> 0 ).
ENDMETHOD.
METHOD load_package.
cl_package_factory=>load_package(
EXPORTING
i_package_name = iv_package_name
i_force_reload = abap_true
IMPORTING
e_package = ri_package
EXCEPTIONS
object_not_existing = 1
unexpected_error = 2
intern_err = 3
no_access = 4
object_locked_and_modified = 5
OTHERS = 6 ).
IF sy-subrc = 1.
RETURN.
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD set_lock.
DATA: lv_changeable TYPE abap_bool.
ii_package->get_changeable( IMPORTING e_changeable = lv_changeable ).
IF lv_changeable <> iv_lock.
ii_package->set_changeable(
EXPORTING
i_changeable = iv_lock
EXCEPTIONS
object_locked_by_other_user = 1
permission_failure = 2
object_already_changeable = 3
object_already_unlocked = 4
object_just_created = 5
object_deleted = 6
object_modified = 7
object_not_existing = 8
object_invalid = 9
unexpected_error = 10
OTHERS = 11 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
ii_package->set_permissions_changeable(
EXPORTING
i_changeable = iv_lock
* downport, does not exist in 7.30. Let's see if we can get along without it
* i_suppress_dialog = abap_true
EXCEPTIONS
object_already_changeable = 1
object_already_unlocked = 2
object_locked_by_other_user = 3
object_modified = 4
object_just_created = 5
object_deleted = 6
permission_failure = 7
object_invalid = 8
unexpected_error = 9
OTHERS = 10 ).
IF ( sy-subrc = 1 AND iv_lock = abap_true ) OR ( sy-subrc = 2 AND iv_lock = abap_false ).
" There's no getter to find out beforehand...
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD update_pinf_usages.
DATA: lt_current_permissions TYPE tpak_permission_to_use_list,
li_usage TYPE REF TO if_package_permission_to_use,
ls_data_sign TYPE scomppsign,
ls_add_permission_data TYPE pkgpermdat,
lt_handled TYPE SORTED TABLE OF i WITH UNIQUE KEY table_line.
FIELD-SYMBOLS: <ls_usage_data> LIKE LINE OF it_usage_data.
" Get the current permissions
ii_package->get_permissions_to_use(
IMPORTING
e_permissions = lt_current_permissions
EXCEPTIONS
object_invalid = 1
unexpected_error = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ls_data_sign-err_sever = abap_true.
" New permissions
LOOP AT it_usage_data ASSIGNING <ls_usage_data>.
READ TABLE lt_current_permissions
WITH KEY table_line->package_interface_name = <ls_usage_data>-intf_name
INTO li_usage.
IF sy-subrc = 0 AND li_usage IS BOUND.
INSERT sy-tabix INTO TABLE lt_handled.
" Permission already exists, update attributes
li_usage->set_all_attributes(
EXPORTING
i_permission_data = <ls_usage_data>
i_data_sign = ls_data_sign
EXCEPTIONS
object_not_changeable = 1
object_invalid = 2
intern_err = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ELSE.
" Permission does not exist yet, add it
MOVE-CORRESPONDING <ls_usage_data> TO ls_add_permission_data.
ii_package->add_permission_to_use(
EXPORTING
i_pkg_permission_data = ls_add_permission_data
EXCEPTIONS
object_not_changeable = 1
object_access_error = 2
object_already_existing = 3
object_invalid = 4
unexpected_error = 5
OTHERS = 6 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
FREE li_usage.
ENDLOOP.
" Delete missing usages
LOOP AT lt_current_permissions INTO li_usage.
READ TABLE lt_handled WITH TABLE KEY table_line = sy-tabix TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
li_usage->delete(
EXCEPTIONS
object_not_changeable = 1
object_invalid = 2
* deletion_not_allowed = 3 downport, does not exist in 7.30
intern_err = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = get_package( )->changed_by.
ENDMETHOD.
METHOD zif_abapgit_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: li_package TYPE REF TO if_package,
lv_package TYPE devclass.
" Package deletion is a bit tricky. A package can only be deleted if there are no objects
" contained in it. This includes subpackages, so first the leaf packages need to be deleted.
" Unfortunately deleted objects that are still contained in an unreleased transport request
" also count towards the contained objects counter.
" -> Currently we delete only empty packages
"
" If objects are deleted, the TADIR entry is deleted when the transport request is released.
" So before we can delete the package, the transport which deletes the objects
" in the package has to be released.
lv_package = ms_item-obj_name.
IF is_empty( lv_package ) = abap_true.
li_package = load_package( lv_package ).
IF li_package IS NOT BOUND.
RETURN.
ENDIF.
TRY.
CALL METHOD li_package->('SET_CHANGEABLE')
EXPORTING
i_changeable = abap_true
i_suppress_dialog = abap_true " Parameter missing in 702
EXCEPTIONS
object_locked_by_other_user = 1
permission_failure = 2
object_already_changeable = 3
object_already_unlocked = 4
object_just_created = 5
object_deleted = 6
object_modified = 7
object_not_existing = 8
object_invalid = 9
unexpected_error = 10
OTHERS = 11.
CATCH cx_root.
li_package->set_changeable(
EXPORTING
i_changeable = abap_true
EXCEPTIONS
object_locked_by_other_user = 1
permission_failure = 2
object_already_changeable = 3
object_already_unlocked = 4
object_just_created = 5
object_deleted = 6
object_modified = 7
object_not_existing = 8
object_invalid = 9
unexpected_error = 10
OTHERS = 11 ).
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
TRY.
CALL METHOD li_package->('DELETE')
EXPORTING
i_suppress_dialog = abap_true " Parameter missing in 702
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
intern_err = 4
OTHERS = 5.
CATCH cx_root.
li_package->delete(
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
intern_err = 4
OTHERS = 5 ).
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
li_package->save(
EXPORTING
i_suppress_dialog = abap_true
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
cancelled_in_corr = 3
permission_failure = 4
unexpected_error = 5
intern_err = 6
OTHERS = 7 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: li_package TYPE REF TO if_package,
ls_package_data TYPE scompkdtln,
ls_data_sign TYPE scompksign,
lt_usage_data TYPE scomppdata,
ls_save_sign TYPE paksavsign.
FIELD-SYMBOLS: <ls_usage_data> TYPE scomppdtln.
mv_local_devclass = iv_package.
io_xml->read(
EXPORTING
iv_name = 'DEVC'
CHANGING
cg_data = ls_package_data ).
li_package = get_package( ).
" Swap out repository package name with the local installation package name
ls_package_data-devclass = mv_local_devclass.
ls_package_data-pdevclass = li_package->transport_layer.
" Parent package is not changed. Assume the folder logic already created the package and set
" the hierarchy before.
CLEAR ls_package_data-parentcl.
ls_data_sign-ctext = abap_true.
* ls_data_sign-korrflag = abap_true.
ls_data_sign-as4user = abap_true.
ls_data_sign-pdevclass = abap_true.
* ls_data_sign-dlvunit = abap_true.
ls_data_sign-comp_posid = abap_true.
ls_data_sign-component = abap_true.
* ls_data_sign-parentcl = abap_true. " No parent package change here
ls_data_sign-perminher = abap_true.
ls_data_sign-intfprefx = abap_true.
ls_data_sign-packtype = abap_true.
ls_data_sign-restricted = abap_true.
ls_data_sign-mainpack = abap_true.
ls_data_sign-srv_check = abap_true.
ls_data_sign-cli_check = abap_true.
ls_data_sign-ext_alias = abap_true.
ls_data_sign-project_guid = abap_true.
ls_data_sign-project_id = abap_true.
ls_data_sign-project_passdown = abap_true.
IF ls_package_data-ctext IS INITIAL.
ls_package_data-ctext = mv_local_devclass.
ENDIF.
IF ls_package_data-dlvunit IS INITIAL.
ls_package_data-dlvunit = 'HOME'.
ENDIF.
ls_package_data-as4user = cl_abap_syst=>get_user_name( ).
IF li_package IS BOUND.
" Package already exists, change it
set_lock( ii_package = li_package iv_lock = abap_true ).
li_package->set_all_attributes(
EXPORTING
i_package_data = ls_package_data
i_data_sign = ls_data_sign
EXCEPTIONS
object_not_changeable = 1
object_deleted = 2
object_invalid = 3
short_text_missing = 4
author_not_existing = 5
local_package = 6
software_component_invalid = 7
layer_invalid = 8
korrflag_invalid = 9
component_not_existing = 10
component_missing = 11
authorize_failure = 12
prefix_in_use = 13
unexpected_error = 14
intern_err = 15
* wrong_mainpack_value = 16 downport, does not exist in 7.30
* superpackage_invalid = 17 downport, does not exist in 7.30
OTHERS = 18 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
* " If the application component was cleared SET_ALL_ATTRIBUTES doesn't change it
* IF ls_package_data-component IS INITIAL AND li_package->application_component IS NOT INITIAL.
*
* ENDIF.
ELSE.
" Package does not exist yet, create it
" This shouldn't really happen, because the folder logic initially creates the packages.
cl_package_factory=>create_new_package(
IMPORTING
e_package = li_package
CHANGING
c_package_data = ls_package_data
EXCEPTIONS
object_already_existing = 1
object_just_created = 2
not_authorized = 3
wrong_name_prefix = 4
undefined_name = 5
reserved_local_name = 6
invalid_package_name = 7
short_text_missing = 8
software_component_invalid = 9
layer_invalid = 10
author_not_existing = 11
component_not_existing = 12
component_missing = 13
prefix_in_use = 14
unexpected_error = 15
intern_err = 16
no_access = 17
* invalid_translation_depth = 18 downport, does not exist in 7.30
* wrong_mainpack_value = 19 downport, does not exist in 7.30
* superpackage_invalid = 20 downport, does not exist in 7.30
* error_in_cts_checks = 21 downport, does not exist in 7.31
OTHERS = 22 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
" Load package interface usages
TRY.
io_xml->read(
EXPORTING
iv_name = 'PERMISSION'
CHANGING
cg_data = lt_usage_data ).
CATCH zcx_abapgit_exception ##NO_HANDLER.
" No permissions saved
ENDTRY.
LOOP AT lt_usage_data ASSIGNING <ls_usage_data>.
<ls_usage_data>-client_pak = mv_local_devclass.
ENDLOOP.
update_pinf_usages( ii_package = li_package
it_usage_data = lt_usage_data ).
ls_save_sign-pack = ls_save_sign-permis = ls_save_sign-elems = ls_save_sign-interf = abap_true.
li_package->save_generic(
EXPORTING
i_save_sign = ls_save_sign
EXCEPTIONS
cancelled_in_corr = 1
permission_failure = 2
object_not_changeable = 3
object_invalid = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
set_lock( ii_package = li_package iv_lock = abap_false ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
" Check remote package if deserialize has not been called before this
IF mv_local_devclass IS INITIAL.
rv_bool = abap_false.
ELSE.
cl_package_helper=>check_package_existence(
EXPORTING
i_package_name = mv_local_devclass
IMPORTING
e_package_exists = rv_bool
EXCEPTIONS
intern_err = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~has_changed_since.
rv_changed = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA: lv_object TYPE eqegraarg.
lv_object = |DV{ ms_item-obj_name }|.
OVERLAY lv_object WITH ' '.
lv_object = lv_object && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'EEUDB'
iv_argument = lv_object ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW'
object_name = ms_item-obj_name
object_type = 'DEVC'
in_new_window = abap_true
EXCEPTIONS
not_executed = 1
invalid_object_type = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_package_data TYPE scompkdtln,
li_package TYPE REF TO if_package,
lt_intf_usages TYPE tpak_permission_to_use_list,
lt_usage_data TYPE scomppdata,
ls_usage_data TYPE scomppdtln,
li_usage TYPE REF TO if_package_permission_to_use.
FIELD-SYMBOLS: <lg_field> TYPE any.
li_package = get_package( ).
IF li_package IS NOT BOUND.
zcx_abapgit_exception=>raise( |Could not find package to serialize.| ).
ENDIF.
li_package->get_all_attributes(
IMPORTING
e_package_data = ls_package_data
EXCEPTIONS
object_invalid = 1
package_deleted = 2
intern_err = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CLEAR: ls_package_data-devclass,
ls_package_data-parentcl.
" Clear administrative data to prevent diffs
CLEAR: ls_package_data-created_by,
ls_package_data-created_on,
ls_package_data-changed_by,
ls_package_data-changed_on,
ls_package_data-as4user.
" Clear text descriptions that might be localized
CLEAR: ls_package_data-comp_text,
ls_package_data-dlvu_text,
ls_package_data-layer_text.
ASSIGN COMPONENT 'TRANSLATION_DEPTH_TEXT'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
ASSIGN COMPONENT 'TRANSLATION_GRAPH_DEPTH_TEXT'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
" Clear things related to local installation package
CLEAR: ls_package_data-namespace,
ls_package_data-dlvunit,
ls_package_data-pdevclass.
" Not usable on customer systems
ASSIGN COMPONENT 'TRANSLATION_DEPTH'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
ASSIGN COMPONENT 'TRANSLATION_GRAPH_DEPTH'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
CLEAR: ls_package_data-korrflag.
io_xml->add( iv_name = 'DEVC' ig_data = ls_package_data ).
" Save package interface usages
li_package->get_permissions_to_use(
IMPORTING
e_permissions = lt_intf_usages
EXCEPTIONS
object_invalid = 1
unexpected_error = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
LOOP AT lt_intf_usages INTO li_usage.
li_usage->get_all_attributes(
IMPORTING
e_permission_data = ls_usage_data
EXCEPTIONS
object_invalid = 1
intern_err = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CLEAR: ls_usage_data-pack_name, ls_usage_data-client_pak.
APPEND ls_usage_data TO lt_usage_data.
ENDLOOP.
IF lt_usage_data IS NOT INITIAL.
io_xml->add( iv_name = 'PERMISSION' ig_data = lt_usage_data ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
ENDCLASS.
| 31.509116 | 100 | 0.586264 |
797f580698da82cdbda8f7f710a6f644c6903cd1 | 4,319 | abap | ABAP | src/formula/zcl_dbbr_fe_bldr_for_subroutn.clas.abap | reichr-dev/abap-db-browser | d513d49692f1f0ee613c8eab2c99e325ef5b78fe | [
"MIT"
] | 15 | 2020-02-05T10:38:12.000Z | 2022-02-11T18:06:17.000Z | src/formula/zcl_dbbr_fe_bldr_for_subroutn.clas.abap | reichr-dev/abap-db-browser | d513d49692f1f0ee613c8eab2c99e325ef5b78fe | [
"MIT"
] | 10 | 2021-01-19T07:45:37.000Z | 2021-07-15T19:08:54.000Z | src/formula/zcl_dbbr_fe_bldr_for_subroutn.clas.abap | reichr-dev/abap-db-browser | d513d49692f1f0ee613c8eab2c99e325ef5b78fe | [
"MIT"
] | 9 | 2020-04-08T19:13:18.000Z | 2021-10-02T12:53:39.000Z | CLASS ZCL_DBBR_fe_bldr_for_subroutn DEFINITION
PUBLIC
INHERITING FROM ZCL_DBBR_fe_generic_form_bldr
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES ZIF_DBBR_fe_formula_builder.
METHODS constructor
IMPORTING
ir_formula TYPE REF TO ZCL_DBBR_formula
ir_tabfields TYPE REF TO ZCL_DBBR_tabfield_list
it_comp_types TYPE ZDBBR_abap_comp_type_itab.
PRIVATE SECTION.
DATA mr_formula TYPE REF TO ZCL_DBBR_formula.
DATA mr_tabfields TYPE REF TO ZCL_DBBR_tabfield_list.
DATA mt_comp_types TYPE ZDBBR_abap_comp_type_itab.
METHODS build_clear_form_fld_lines
CHANGING
ct_form TYPE string_table.
METHODS include_row_and_form_fields
IMPORTING
it_stmnt TYPE ZIF_DBBR_fe_types=>tt_statement
CHANGING
ct_form TYPE string_table.
ENDCLASS.
CLASS ZCL_DBBR_fe_bldr_for_subroutn IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
mr_formula = ir_formula.
mt_comp_types = it_comp_types.
mr_tabfields = ir_tabfields.
ENDMETHOD.
METHOD ZIF_DBBR_fe_formula_builder~build_formula.
et_lines = VALUE #( ( |REPORT Z_FORMULA.| )
( ) ).
" insert macro for field-symbol definition
et_lines = VALUE #(
BASE et_lines
( |DEFINE macro_row_comp.| )
( | ASSIGN ('ROW->&1') to FIELD-SYMBOL(<&1>).| )
( | CHECK sy-subrc = 0.| )
( |END-OF-DEFINITION.| )
( )
).
mr_formula->get_statements( IMPORTING et_statements = DATA(lt_stmnt) ).
et_lines = VALUE #( BASE et_lines ( |FORM { zif_dbbr_c_fe_global=>c_formula_subroutine_form } CHANGING row TYPE REF TO data.| ) ( ) ).
" include try block to catch all kinds of exceptions during formula calculations
et_lines = VALUE #( BASE et_lines ( |TRY.| ) ( ) ).
include_row_and_form_fields( EXPORTING it_stmnt = lt_stmnt
CHANGING ct_form = et_lines ).
include_normal_statements( EXPORTING it_statements = lt_stmnt
if_use_subroutine_strings = abap_true
IMPORTING et_form = et_lines ).
et_lines = VALUE #( BASE et_lines ( )
( |CATCH CX_ROOT.| ) ).
" clear all formula field values
build_clear_form_fld_lines( CHANGING ct_form = et_lines ).
et_lines = VALUE #( BASE et_lines ( )
( |ENDTRY.| ) ).
et_lines = VALUE #( BASE et_lines ( |ENDFORM.| ) ).
* ZCL_SAT_SYSTEM_HELPER=>check_abap_syntax( et_lines ).
ENDMETHOD.
METHOD build_clear_form_fld_lines.
mr_formula->get_formula_fields( IMPORTING et_fields = DATA(lt_fields) ).
LOOP AT lt_fields ASSIGNING FIELD-SYMBOL(<ls_form_field>).
ct_form = VALUE #(
BASE ct_form
( | CLEAR <X_{ <ls_form_field>-field }>.| )
).
ENDLOOP.
ENDMETHOD.
METHOD include_row_and_form_fields.
DATA: lt_row_fields TYPE string_table,
lv_terminator TYPE char1.
LOOP AT it_stmnt ASSIGNING FIELD-SYMBOL(<ls_stmnt>).
lt_row_fields = VALUE #( BASE lt_row_fields
FOR <ls_token> IN <ls_stmnt>-tokens
WHERE ( is_formula_field = abap_true OR is_row_field = abap_true )
( COND #( WHEN <ls_token>-is_formula_field = abap_true THEN 'X_' && <ls_token>-str
WHEN <ls_token>-is_row_field = abap_true THEN ZCL_DBBR_formula_helper=>get_raw_row_field( <ls_token>-str ) ) )
).
ENDLOOP.
SORT lt_row_fields.
DELETE ADJACENT DUPLICATES FROM lt_row_fields.
IF mr_formula->is_color_column_needed( ).
lt_row_fields = VALUE #( BASE lt_row_fields ( zif_dbbr_c_special_out_columns=>cell_col_row_color ) ).
ENDIF.
DATA(lv_lines) = lines( lt_row_fields ).
LOOP AT lt_row_fields ASSIGNING FIELD-SYMBOL(<lv_row_field>).
IF lv_lines = sy-tabix.
lv_terminator = '.'.
ELSE.
lv_terminator = ','.
ENDIF.
IF sy-tabix = 1.
ct_form = VALUE #( BASE ct_form
( |macro_row_comp: { <lv_row_field> }{ lv_terminator }| ) ).
ELSE.
ct_form = VALUE #( BASE ct_form
( | { <lv_row_field> }{ lv_terminator }| ) ).
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
| 33.223077 | 138 | 0.634869 |
7981e0bda39a60b23bbef200f75b4bdebc9abdce | 226 | abap | ABAP | objects/CLAS/ZCL_ZODATA_PURCHASE_BO_DPC/METH ZPURCHASE_REQ_HE_GET_ENTITY.abap | yashjain1224/GctsSAP | 2b7cb60620b93cde81cfd29cb6deb9d914fbee9d | [
"MIT"
] | null | null | null | objects/CLAS/ZCL_ZODATA_PURCHASE_BO_DPC/METH ZPURCHASE_REQ_HE_GET_ENTITY.abap | yashjain1224/GctsSAP | 2b7cb60620b93cde81cfd29cb6deb9d914fbee9d | [
"MIT"
] | null | null | null | objects/CLAS/ZCL_ZODATA_PURCHASE_BO_DPC/METH ZPURCHASE_REQ_HE_GET_ENTITY.abap | yashjain1224/GctsSAP | 2b7cb60620b93cde81cfd29cb6deb9d914fbee9d | [
"MIT"
] | null | null | null | method ZPURCHASE_REQ_HE_GET_ENTITY.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_not_impl_exc
EXPORTING
textid = /iwbep/cx_mgw_not_impl_exc=>method_not_implemented
method = 'ZPURCHASE_REQ_HE_GET_ENTITY'.
endmethod. | 37.666667 | 65 | 0.787611 |
798859fe0a44895947697bfced27cf116ee1c8af | 5,497 | abap | ABAP | src/objects/ecatt/zcl_abapgit_ecatt_sp_upload.clas.abap | DiscoveryConsulting/abapGit | 437052cd6a32ddbd9a808730284c7f9f4ee100e7 | [
"MIT"
] | null | null | null | src/objects/ecatt/zcl_abapgit_ecatt_sp_upload.clas.abap | DiscoveryConsulting/abapGit | 437052cd6a32ddbd9a808730284c7f9f4ee100e7 | [
"MIT"
] | null | null | null | src/objects/ecatt/zcl_abapgit_ecatt_sp_upload.clas.abap | DiscoveryConsulting/abapGit | 437052cd6a32ddbd9a808730284c7f9f4ee100e7 | [
"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: <ecatt_object> TYPE any.
TRY.
li_section = template_over_all->find_from_name_ns( 'START_PROFILE' ).
IF NOT li_section IS INITIAL.
CLASS cl_ixml DEFINITION LOAD.
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 <ecatt_object>.
ASSERT sy-subrc = 0.
lo_ecatt_sp = <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,
lv_exception_occurred TYPE etonoff,
lo_ecatt_sp TYPE REF TO object.
FIELD-SYMBOLS: <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 <ecatt_sp>.
ASSERT sy-subrc = 0.
lo_ecatt_sp = <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.
lv_exception_occurred = 'X'.
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.807512 | 93 | 0.601601 |
79893234e66b3c92f11772209892ad02e35d9e84 | 2,185 | abap | ABAP | src/fixes/zcl_aof_aoc_check_55.clas.testclasses.abap | larshp/abapOpenFix | fe5ab30b5ee8e1354f26a87a93a4819e0a0a46c5 | [
"MIT"
] | null | null | null | src/fixes/zcl_aof_aoc_check_55.clas.testclasses.abap | larshp/abapOpenFix | fe5ab30b5ee8e1354f26a87a93a4819e0a0a46c5 | [
"MIT"
] | 5 | 2017-02-28T14:52:06.000Z | 2017-05-30T10:28:37.000Z | src/fixes/zcl_aof_aoc_check_55.clas.testclasses.abap | larshp/abapOpenFix | fe5ab30b5ee8e1354f26a87a93a4819e0a0a46c5 | [
"MIT"
] | 2 | 2017-03-08T08:31:57.000Z | 2019-02-28T08:43:34.000Z | CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL.
PRIVATE SECTION.
DATA: mi_fixer TYPE REF TO zif_aof_fixer,
mt_input TYPE string_table,
mt_expected TYPE string_table.
METHODS:
setup,
test01 FOR TESTING,
test02 FOR TESTING,
test03 FOR TESTING.
* test04 FOR TESTING.
ENDCLASS. "ltcl_Test
CLASS ltcl_test IMPLEMENTATION.
METHOD setup.
CREATE OBJECT mi_fixer TYPE zcl_aof_aoc_check_55.
CLEAR mt_input.
CLEAR mt_expected.
ENDMETHOD.
METHOD test01.
APPEND 'DATA: foo type c.' TO mt_input.
APPEND 'DATA: bar type c.' TO mt_input.
APPEND 'DATA: foo type c,' TO mt_expected.
APPEND ' bar type c.' TO mt_expected.
zcl_aof_fixer_unit_test=>test(
ii_fixer = mi_fixer
it_input = mt_input
it_expected = mt_expected
iv_line = 2 ).
ENDMETHOD.
METHOD test02.
APPEND 'DATA foo type c.' TO mt_input.
APPEND 'DATA bar type c.' TO mt_input.
APPEND 'DATA: foo type c,' TO mt_expected.
APPEND ' bar type c.' TO mt_expected.
zcl_aof_fixer_unit_test=>test(
ii_fixer = mi_fixer
it_input = mt_input
it_expected = mt_expected
iv_line = 2 ).
ENDMETHOD.
METHOD test03.
APPEND 'DATA foo type c.' TO mt_input.
APPEND '' TO mt_input.
APPEND 'DATA bar type c.' TO mt_input.
APPEND 'DATA: foo type c,' TO mt_expected.
APPEND ' bar type c.' TO mt_expected.
zcl_aof_fixer_unit_test=>test(
ii_fixer = mi_fixer
it_input = mt_input
it_expected = mt_expected
iv_line = 3 ).
ENDMETHOD.
* todo
* METHOD test04.
*
* APPEND 'DATA foo type c.' TO mt_input.
* APPEND 'DATA bar type c.' TO mt_input.
* APPEND 'DATA moo type c.' TO mt_input.
*
* APPEND 'DATA: foo type c,' TO mt_expected.
* APPEND ' bar type c,' TO mt_expected.
* APPEND ' moo type c.' TO mt_expected.
*
* zcl_aof_fixer_unit_test=>test(
* ii_fixer = mi_fixer
* it_input = mt_input
* it_expected = mt_expected
* iv_line = 2 ).
*
* ENDMETHOD.
ENDCLASS.
| 22.525773 | 80 | 0.622883 |
7989de5cf513c6eddc099f464627fce6d60da13e | 7,268 | abap | ABAP | src/ui/zcl_abapgit_gui_page_main.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/zcl_abapgit_gui_page_main.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/zcl_abapgit_gui_page_main.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_gui_page_main DEFINITION
PUBLIC
FINAL
CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page.
PUBLIC SECTION.
INTERFACES: zif_abapgit_gui_hotkeys.
METHODS:
constructor
IMPORTING iv_only_favorites TYPE abap_bool
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,
overview TYPE string VALUE 'overview',
select TYPE string VALUE 'select',
apply_filter TYPE string VALUE 'apply_filter',
abapgit_home TYPE string VALUE 'abapgit_home',
END OF c_actions.
DATA: mo_repo_overview TYPE REF TO zcl_abapgit_gui_page_repo_over,
mv_repo_key TYPE zif_abapgit_persistence=>ty_value,
mv_only_favorites TYPE abap_bool.
METHODS build_main_menu
RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_MAIN IMPLEMENTATION.
METHOD build_main_menu.
CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-main'.
ro_menu->add(
iv_txt = zcl_abapgit_gui_buttons=>new_online( )
iv_act = zif_abapgit_definitions=>c_action-repo_newonline
)->add(
iv_txt = zcl_abapgit_gui_buttons=>new_offline( )
iv_act = zif_abapgit_definitions=>c_action-repo_newoffline
)->add(
iv_txt = zcl_abapgit_gui_buttons=>settings( )
iv_act = zif_abapgit_definitions=>c_action-go_settings
)->add(
iv_txt = zcl_abapgit_gui_buttons=>advanced( )
iv_title = 'Utilities'
io_sub = zcl_abapgit_gui_chunk_lib=>advanced_submenu( )
)->add(
iv_txt = zcl_abapgit_gui_buttons=>help( )
iv_title = 'Help'
io_sub = zcl_abapgit_gui_chunk_lib=>help_submenu( ) ).
ENDMETHOD.
METHOD constructor.
super->constructor( ).
ms_control-page_menu = build_main_menu( ).
ms_control-page_title = 'Repository List'.
mv_only_favorites = iv_only_favorites.
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
gui_services( )->get_hotkeys_ctl( )->register_hotkeys( zif_abapgit_gui_hotkeys~get_hotkey_actions( ) ).
IF mo_repo_overview IS INITIAL OR mo_repo_overview->mv_only_favorites <> mv_only_favorites.
CREATE OBJECT mo_repo_overview EXPORTING iv_only_favorites = mv_only_favorites.
ENDIF.
ri_html->add( mo_repo_overview->zif_abapgit_gui_renderable~render( ) ).
register_deferred_script( zcl_abapgit_gui_chunk_lib=>render_repo_palette( c_actions-select ) ).
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
DATA: lv_key TYPE zif_abapgit_persistence=>ty_value.
lv_key = ii_event->query( )->get( 'KEY' ).
CASE ii_event->mv_action.
WHEN c_actions-abapgit_home.
CLEAR mv_repo_key.
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_actions-select.
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.
mv_repo_key = lv_key.
CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_repo_view
EXPORTING
iv_key = lv_key.
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
WHEN zif_abapgit_definitions=>c_action-change_order_by.
mo_repo_overview->set_order_by( ii_event->query( )->get( 'ORDERBY' ) ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-toggle_favorites.
mv_only_favorites = ii_event->query( )->get( 'FAVORITES' ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-direction.
mo_repo_overview->set_order_direction(
boolc( ii_event->query( )->get( 'DIRECTION' ) = 'DESCENDING' ) ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_actions-apply_filter.
mo_repo_overview->set_filter( ii_event->mt_postdata ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-go_patch.
CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_patch
EXPORTING
iv_key = lv_key.
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
WHEN OTHERS.
rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ).
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_gui_hotkeys~get_hotkey_actions.
DATA: ls_hotkey_action LIKE LINE OF rt_hotkey_actions.
ls_hotkey_action-ui_component = 'Main'.
ls_hotkey_action-description = |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-description = |New 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-description = |New Offline Repository|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_newoffline.
ls_hotkey_action-hotkey = |o|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Stage|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_stage.
ls_hotkey_action-hotkey = |s|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Diff|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_repo_diff.
ls_hotkey_action-hotkey = |d|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Check|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_code_inspector.
ls_hotkey_action-hotkey = |c|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Pull|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_reset.
ls_hotkey_action-hotkey = |p|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Patch|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_patch.
ls_hotkey_action-hotkey = |p|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
" registered/handled in js
ls_hotkey_action-description = |Previous Repository|.
ls_hotkey_action-action = `#`.
ls_hotkey_action-hotkey = |4|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Next Repository|.
ls_hotkey_action-action = `##`.
ls_hotkey_action-hotkey = |6|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Open Repository|.
ls_hotkey_action-action = `###`.
ls_hotkey_action-hotkey = |Enter|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ENDMETHOD.
ENDCLASS.
| 33.187215 | 107 | 0.729499 |
798a611335cdee2c1c95e8942469ea2345036887 | 5,784 | abap | ABAP | clean_code_main/clean_code_checks/y_check_db_access_in_ut.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | clean_code_main/clean_code_checks/y_check_db_access_in_ut.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | clean_code_main/clean_code_checks/y_check_db_access_in_ut.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | CLASS lcl_test_code_detector DEFINITION.
PUBLIC SECTION.
INTERFACES y_if_testcode_detector.
ENDCLASS.
CLASS lcl_test_code_detector IMPLEMENTATION.
METHOD y_if_testcode_detector~set_ref_scan_manager.
RETURN.
ENDMETHOD.
METHOD y_if_testcode_detector~clear.
RETURN.
ENDMETHOD.
METHOD y_if_testcode_detector~is_testcode.
result = abap_true.
ENDMETHOD.
ENDCLASS.
CLASS ltd_clean_code_manager DEFINITION FOR TESTING.
PUBLIC SECTION.
INTERFACES: y_if_clean_code_manager.
ENDCLASS.
CLASS ltd_clean_code_manager IMPLEMENTATION.
METHOD y_if_clean_code_manager~read_check_customizing.
result = VALUE #( ( apply_on_testcode = abap_true prio = 'N' threshold = 0 )
( apply_on_testcode = abap_true prio = 'E' threshold = 0 ) ).
ENDMETHOD.
METHOD y_if_clean_code_manager~calculate_obj_creation_date.
result = '19000101'.
ENDMETHOD.
ENDCLASS.
CLASS ltd_ref_scan_manager DEFINITION FOR TESTING INHERITING FROM y_scan_manager_double.
PUBLIC SECTION.
METHODS:
set_data_for_ok,
set_data_for_error,
set_check_pseudo_comment_ok.
ENDCLASS.
CLASS ltd_ref_scan_manager IMPLEMENTATION.
METHOD set_data_for_ok.
inject_code( VALUE #(
( 'REPORT ut_test.' )
( 'CLASS lcl_classname DEFINITION FOR TESTING.' )
( ' PUBLIC SECTION.' )
( ' METHODS methodname.' )
( 'ENDCLASS.' )
( 'CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD methodname.' )
( ' DATA itab TYPE STANDARD TABLE OF c.' )
( | INSERT 'a' INTO TABLE itab.| )
( | MODIFY TABLE itab FROM 'a'.| )
( | DELETE itab INDEX 1.| )
( | DELETE itab FROM 'a'.| )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
) ).
ENDMETHOD.
METHOD set_data_for_error.
inject_code( VALUE #(
( 'REPORT ut_test.' )
( 'CLASS lcl_classname DEFINITION FOR TESTING.' )
( ' PUBLIC SECTION.' )
( ' METHODS methodname.' )
( 'ENDCLASS.' )
( 'CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD methodname.' )
( ' DATA line TYPE tadir.' )
( ' DATA table TYPE STANDARD TABLE OF line.' )
( ' COMMIT WORK.' )
( ' ROLLBACK WORK.' )
( ' SELECT * FROM tadir INTO TABLE table.' )
( ' INSERT INTO tadir VALUES line.' )
( ' INSERT tadir FROM line.' )
( ' UPDATE tadir FROM line.' )
( ' MODIFY tadir FROM line.' )
( ' DELETE FROM tadir.' )
( ' DELETE tadir FROM line.' )
( ' EXEC SQL.' )
( ' ENDEXEC.' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
) ).
ENDMETHOD.
METHOD set_check_pseudo_comment_ok.
inject_code( VALUE #(
( 'REPORT ut_test.' )
( 'CLASS lcl_classname DEFINITION FOR TESTING.' )
( ' PUBLIC SECTION.' )
( ' METHODS methodname.' )
( 'ENDCLASS.' )
( 'CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD methodname.' )
( ' DATA line TYPE tadir.' )
( ' DATA table TYPE STANDARD TABLE OF line.' )
( ' COMMIT WORK. "#EC DB_ACCESS_UT' )
( ' ROLLBACK WORK. "#EC DB_ACCESS_UT' )
( ' SELECT * FROM tadir INTO TABLE table. "#EC DB_ACCESS_UT' )
( ' INSERT INTO tadir VALUES line. "#EC DB_ACCESS_UT' )
( ' INSERT tadir FROM line. "#EC DB_ACCESS_UT' )
( ' UPDATE tadir FROM line. "#EC DB_ACCESS_UT' )
( ' MODIFY tadir FROM line. "#EC DB_ACCESS_UT' )
( ' DELETE FROM tadir. "#EC DB_ACCESS_UT' )
( ' DELETE tadir FROM line. "#EC DB_ACCESS_UT' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
) ).
ENDMETHOD.
ENDCLASS.
CLASS ltd_clean_code_exemption_no DEFINITION FOR TESTING
INHERITING FROM y_exemption_handler.
PUBLIC SECTION.
METHODS: is_object_exempted REDEFINITION.
ENDCLASS.
CLASS ltd_clean_code_exemption_no IMPLEMENTATION.
METHOD is_object_exempted.
RETURN.
ENDMETHOD.
ENDCLASS.
CLASS local_test_class DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
DATA: cut TYPE REF TO y_check_db_access_in_ut,
ref_scan_manager_double TYPE REF TO ltd_ref_scan_manager.
METHODS:
setup,
assert_errors IMPORTING err_cnt TYPE i,
assert_pseudo_comments IMPORTING pc_cnt TYPE i,
is_bound FOR TESTING,
check_ok FOR TESTING,
check_error FOR TESTING,
check_pseudo_comment_ok FOR TESTING.
ENDCLASS.
CLASS y_check_db_access_in_ut DEFINITION LOCAL FRIENDS local_test_class.
CLASS local_test_class IMPLEMENTATION.
METHOD setup.
cut = NEW y_check_db_access_in_ut( ).
ref_scan_manager_double = NEW ltd_ref_scan_manager( ).
cut->ref_scan_manager ?= ref_scan_manager_double.
cut->clean_code_manager = NEW ltd_clean_code_manager( ).
cut->test_code_detector = NEW lcl_test_code_detector( ).
cut->clean_code_exemption_handler = NEW ltd_clean_code_exemption_no( ).
cut->attributes_maintained = abap_true.
ENDMETHOD.
METHOD is_bound.
cl_abap_unit_assert=>assert_bound(
EXPORTING
act = cut ).
ENDMETHOD.
METHOD check_ok.
ref_scan_manager_double->set_data_for_ok( ).
cut->run( ).
assert_errors( 0 ).
assert_pseudo_comments( 0 ).
ENDMETHOD.
METHOD check_error.
ref_scan_manager_double->set_data_for_error( ).
cut->run( ).
assert_errors( 10 ).
assert_pseudo_comments( 0 ).
ENDMETHOD.
METHOD check_pseudo_comment_ok.
ref_scan_manager_double->set_check_pseudo_comment_ok( ).
cut->run( ).
assert_errors( 0 ).
assert_pseudo_comments( 9 ).
ENDMETHOD.
METHOD assert_errors.
cl_abap_unit_assert=>assert_equals(
EXPORTING
act = cut->statistics->get_number_errors( )
exp = err_cnt ).
ENDMETHOD.
METHOD assert_pseudo_comments.
cl_abap_unit_assert=>assert_equals(
EXPORTING
act = cut->statistics->get_number_pseudo_comments( )
exp = pc_cnt ).
ENDMETHOD.
ENDCLASS.
| 27.674641 | 88 | 0.671162 |
798dcf9a61b47186775e7623d2e4ddb0ae17bb96 | 659 | abap | ABAP | src/zcl_rl_repo_logo.clas.abap | victorizbitskiy/abapGitRepositoryLogo | dfc4acbce2ca1a58bc0b096133d9541de873d721 | [
"MIT"
] | null | null | null | src/zcl_rl_repo_logo.clas.abap | victorizbitskiy/abapGitRepositoryLogo | dfc4acbce2ca1a58bc0b096133d9541de873d721 | [
"MIT"
] | null | null | null | src/zcl_rl_repo_logo.clas.abap | victorizbitskiy/abapGitRepositoryLogo | dfc4acbce2ca1a58bc0b096133d9541de873d721 | [
"MIT"
] | null | null | null | CLASS zcl_rl_repo_logo DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES zif_rl_repo_logo.
METHODS constructor
IMPORTING
!iv_logo TYPE xstring
!iv_extension TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
DATA mv_logo TYPE xstring.
DATA mv_extension TYPE string.
ENDCLASS.
CLASS ZCL_RL_REPO_LOGO IMPLEMENTATION.
METHOD constructor.
mv_logo = iv_logo.
mv_extension = iv_extension.
ENDMETHOD.
METHOD zif_rl_repo_logo~get.
rv_logo = mv_logo.
ENDMETHOD.
METHOD zif_rl_repo_logo~get_extension.
rv_extension = mv_extension.
ENDMETHOD.
ENDCLASS.
| 13.729167 | 40 | 0.711684 |
79977c2f3125949643932cf54cf7e54f9c353533 | 9,049 | abap | ABAP | src/demo/z_xtt_demo_cld.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_cld.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_cld.prog.abap | bizhuka/x | 39fe24c6f62746215dc6e1e1f9ef6df8f0c25862 | [
"Apache-2.0"
] | 10 | 2019-03-08T08:03:42.000Z | 2021-04-03T12:54:54.000Z | *&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
CLASS lcl_report DEFINITION DEFERRED.
TYPES:
BEGIN OF ts_merge,
key TYPE string,
val TYPE REF TO data,
obj TYPE REF TO object, " For 160 only
END OF ts_merge,
tt_merge TYPE STANDARD TABLE OF ts_merge WITH DEFAULT KEY, " Same order HASHED UNIQUE KEY key,
" Random table data
BEGIN OF ts_rand_data,
group TYPE string,
caption TYPE string,
date TYPE d,
sum1 TYPE bf_rbetr, " P with sign
sum2 TYPE bf_rbetr, " P with sign
END OF ts_rand_data,
tt_rand_data TYPE STANDARD TABLE OF ts_rand_data WITH DEFAULT KEY,
BEGIN OF ts_no_sum,
group TYPE string,
caption TYPE string,
date TYPE d,
END OF ts_no_sum,
BEGIN OF ts_grid_params,
r_table TYPE REF TO data,
s_layout TYPE lvc_s_layo,
t_catalog TYPE lvc_t_fcat,
t_sort TYPE lvc_t_sort,
t_toolbar TYPE ttb_button,
END OF ts_grid_params.
**********************************************************************
**********************************************************************
INTERFACE lif_injection.
METHODS:
send_merge
IMPORTING
is_merge TYPE ts_merge,
prepare
IMPORTING
io_xtt TYPE REF TO zcl_xtt.
ENDINTERFACE.
**********************************************************************
**********************************************************************
CLASS lcl_demo DEFINITION ABSTRACT.
PUBLIC SECTION.
TYPES:
BEGIN OF ts_screen_opt,
row_count TYPE abap_bool,
colum_count TYPE abap_bool,
block_count TYPE abap_bool,
zip TYPE abap_bool,
img_size TYPE abap_bool,
END OF ts_screen_opt,
BEGIN OF ts_template,
objid TYPE wwwdata-objid,
END OF ts_template,
tt_template TYPE STANDARD TABLE OF ts_template WITH DEFAULT KEY.
DATA:
v_desc TYPE string.
METHODS:
get_desc_text
RETURNING VALUE(rv_desc_text) TYPE string,
get_url_base
RETURNING VALUE(rv_url_base) TYPE string,
get_screen_opt
RETURNING VALUE(rs_opt) TYPE ts_screen_opt,
template FINAL,
show FINAL
IMPORTING
it_merge TYPE tt_merge,
download FINAL
IMPORTING
it_merge TYPE tt_merge
" test all templates
io_injection TYPE REF TO lif_injection OPTIONAL
iv_template TYPE csequence OPTIONAL,
send FINAL
IMPORTING
it_merge TYPE tt_merge,
set_merge_info ABSTRACT
IMPORTING
io_report TYPE REF TO lcl_report
RETURNING VALUE(rv_exit) TYPE abap_bool,
get_templates ABSTRACT
RETURNING VALUE(rt_templates) TYPE tt_template,
download_template
IMPORTING
io_file TYPE REF TO zif_xtt_file
iv_file_name TYPE csequence OPTIONAL,
get_from_template
IMPORTING
iv_template TYPE csequence
EXPORTING
ev_type TYPE string
eo_xtt TYPE REF TO zcl_xtt
eo_file TYPE REF TO zif_xtt_file,
on_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING
sender
e_ucomm.
PROTECTED SECTION.
METHODS:
_merge
IMPORTING
io_xtt TYPE REF TO zcl_xtt
it_merge TYPE tt_merge,
_do_download
IMPORTING
io_xtt TYPE REF TO zcl_xtt,
_make_string_message
IMPORTING
iv_info TYPE csequence
RETURNING VALUE(rr_message) TYPE REF TO string.
PRIVATE SECTION.
TYPES:
BEGIN OF ts_vrm_value,
key TYPE wwwdata-objid,
text TYPE text80,
END OF ts_vrm_value,
tt_vrm_value TYPE STANDARD TABLE OF ts_vrm_value WITH DEFAULT KEY.
METHODS:
_show_screen
IMPORTING
iv_dynnr TYPE sydynnr
iv_lb_id TYPE vrm_id
iv_title TYPE csequence
RETURNING VALUE(rv_template) TYPE string,
_get_template_lisbox
RETURNING VALUE(rt_listbox) TYPE tt_vrm_value,
_get_template_by_f4
RETURNING VALUE(rv_template) TYPE string,
_send_email
IMPORTING
io_xtt TYPE REF TO zcl_xtt,
_is_break_point_active.
ENDCLASS.
**********************************************************************
**********************************************************************
CLASS lcl_report DEFINITION FINAL FRIENDS zcl_eui_event_caller.
PUBLIC SECTION.
CONSTANTS:
BEGIN OF c_cmd,
template TYPE syucomm VALUE 'TEMPLATE',
send TYPE syucomm VALUE 'SEND',
show TYPE syucomm VALUE 'SHOW',
download TYPE syucomm VALUE 'DOWNLOAD',
END OF c_cmd.
TYPES:
BEGIN OF ts_demo,
ind TYPE numc3,
inst TYPE REF TO lcl_demo,
END OF ts_demo,
tt_demo TYPE SORTED TABLE OF ts_demo WITH UNIQUE KEY ind,
BEGIN OF ts_merge_alv,
root_id TYPE string,
ui_type TYPE string,
field TYPE string,
value TYPE string, " For simple value
t_color TYPE lvc_t_scol,
END OF ts_merge_alv,
tt_merge_alv TYPE STANDARD TABLE OF ts_merge_alv WITH DEFAULT KEY.
METHODS:
constructor
IMPORTING
io_injection TYPE REF TO lif_injection OPTIONAL,
pbo,
start_of_selection,
f4_full_path
IMPORTING
iv_title TYPE csequence
CHANGING
cv_fullpath TYPE csequence,
f4_dir_browse
IMPORTING
iv_title TYPE csequence
CHANGING
cv_path TYPE csequence,
merge_add_one
IMPORTING
is_root TYPE any
iv_root_id TYPE string DEFAULT 'R'
io_helper TYPE REF TO object OPTIONAL,
" Random data for tables
get_random_table
IMPORTING
iv_column_cnt TYPE numc2 DEFAULT 2
EXPORTING
et_table TYPE STANDARD TABLE,
init_random_generator,
show_alv
IMPORTING is_grid_params TYPE ts_grid_params
CHANGING co_alv TYPE REF TO zcl_eui_alv OPTIONAL.
CLASS-METHODS:
class_constructor.
" Current example
DATA o_demo TYPE REF TO lcl_demo READ-ONLY.
DATA t_merge TYPE tt_merge READ-ONLY.
" Random numbers
DATA mo_rand_i TYPE REF TO cl_abap_random_int READ-ONLY.
DATA mo_rand_p TYPE REF TO cl_abap_random_packed READ-ONLY.
" Test mode
DATA mo_injection TYPE REF TO lif_injection READ-ONLY.
PRIVATE SECTION.
CLASS-DATA:
t_demo TYPE tt_demo.
DATA t_merge_alv TYPE tt_merge_alv.
DATA mo_menu_docu TYPE REF TO zcl_eui_menu.
METHODS:
_online_docu_button,
_on_function_selected FOR EVENT function_selected OF cl_gui_toolbar "#EC CALLED
IMPORTING
fcode,
_hide_online_docu,
_get_docu_url
IMPORTING
iv_append TYPE csequence
RETURNING VALUE(rv_full_url) TYPE string,
_update_demo_listbox,
_merge_get_sub_fields
IMPORTING
is_root TYPE any
iv_root_id TYPE string
RETURNING VALUE(rt_sub_field) TYPE zcl_eui_type=>tt_field_desc,
_get_dref
IMPORTING
is_root TYPE any
iv_field TYPE csequence
RETURNING VALUE(rr_data) TYPE REF TO data,
_merge_add_sub_fields_to_alv
IMPORTING
is_root TYPE any
iv_root_id TYPE string
it_sub_field TYPE zcl_eui_type=>tt_field_desc,
_get_table_text
IMPORTING
ir_value TYPE REF TO data
ir_alv TYPE REF TO ts_merge_alv
RETURNING VALUE(rv_text) TYPE string,
_get_grid_params
RETURNING VALUE(rs_gp) TYPE ts_grid_params,
_on_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid "#EC CALLED
IMPORTING "sender
e_row_id,
_on_user_command FOR EVENT user_command OF cl_gui_alv_grid "#EC CALLED
IMPORTING
sender
e_ucomm,
_on_top_of_page FOR EVENT top_of_page OF cl_gui_alv_grid "#EC CALLED
IMPORTING
e_dyndoc_id,
_get_from_root_id
IMPORTING
iv_root_id TYPE csequence
RETURNING VALUE(rr_root) TYPE REF TO data,
_make_std_table_copy
IMPORTING
it_table TYPE ANY TABLE
RETURNING VALUE(rr_table) TYPE REF TO data,
_make_tech_catalog
IMPORTING
ir_table TYPE REF TO data
RETURNING VALUE(rt_catalog) TYPE lvc_t_fcat,
_make_toolbar
RETURNING VALUE(rt_toolbar) TYPE ttb_button.
ENDCLASS.
**********************************************************************
| 27.01194 | 97 | 0.580064 |
7997b17e268b498a20bae8f5156284ebf192c36e | 5,299 | abap | ABAP | src/objects/zcl_abapgit_object_ftgl.clas.abap | boy0korea/abapGit | 0168ae74a87f3102901f33016c027653f62b15a6 | [
"MIT"
] | 1 | 2021-02-24T08:58:29.000Z | 2021-02-24T08:58:29.000Z | src/objects/zcl_abapgit_object_ftgl.clas.abap | boy0korea/abapGit | 0168ae74a87f3102901f33016c027653f62b15a6 | [
"MIT"
] | 40 | 2021-06-01T05:58:26.000Z | 2022-03-01T05:02:17.000Z | src/objects/zcl_abapgit_object_ftgl.clas.abap | kjetil-kilhavn/abapGit | 423cdd100902c58d5199d9f25cc86ce8ac899099 | [
"MIT"
] | 1 | 2021-08-18T07:58:26.000Z | 2021-08-18T07:58:26.000Z | CLASS zcl_abapgit_object_ftgl 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:
mv_toggle_id TYPE c LENGTH 40, "sftgl_ft_id
mr_toggle TYPE REF TO data.
METHODS:
clear_field
IMPORTING
iv_fieldname TYPE string
CHANGING
cg_header TYPE any.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_FTGL IMPLEMENTATION.
METHOD clear_field.
FIELD-SYMBOLS: <lg_field> TYPE data.
ASSIGN
COMPONENT iv_fieldname
OF STRUCTURE cg_header
TO <lg_field>.
ASSERT sy-subrc = 0.
CLEAR: <lg_field>.
ENDMETHOD.
METHOD constructor.
super->constructor(
is_item = is_item
iv_language = iv_language ).
mv_toggle_id = ms_item-obj_name.
TRY.
CREATE DATA mr_toggle TYPE ('FTGL_S_WB_FEATURE_TOGGLE').
CATCH cx_root.
zcx_abapgit_exception=>raise( |FTGL not supported in your NW release| ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA:
lv_return_code TYPE i.
CALL METHOD ('CL_FEATURE_TOGGLE_OBJECT')=>delete
EXPORTING
iv_toggle_id = mv_toggle_id
RECEIVING
rv_rc = lv_return_code.
IF lv_return_code <> 0.
zcx_abapgit_exception=>raise( |Cannot delete feature toggle { mv_toggle_id }. |
&& |Error { sy-subrc } from cl_feature_toggle_object=>delete| ).
ENDIF.
corr_insert( iv_package ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA:
lo_toggle TYPE REF TO object,
lx_error TYPE REF TO cx_root.
FIELD-SYMBOLS: <lg_toggle> TYPE data.
ASSIGN mr_toggle->* TO <lg_toggle>.
ASSERT sy-subrc = 0.
io_xml->read(
EXPORTING
iv_name = 'FTGL'
CHANGING
cg_data = <lg_toggle> ).
TRY.
CALL METHOD ('CL_FEATURE_TOGGLE_OBJECT')=>create_toggle_by_content
EXPORTING
is_content = <lg_toggle>
RECEIVING
ro_toggle = lo_toggle.
CALL METHOD lo_toggle->('SAVE').
tadir_insert( iv_package ).
corr_insert( iv_package ).
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise_with_text( lx_error ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
CALL METHOD ('CL_FEATURE_TOGGLE')=>is_defined
EXPORTING
iv_toggle_id = mv_toggle_id
RECEIVING
rc_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-late 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 = exists_a_lock_entry_for( iv_lock_object = 'E_FTGL'
iv_argument = |{ mv_toggle_id }*| ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'RS_TOOL_ACCESS_REMOTE'
STARTING NEW TASK 'GIT'
EXPORTING
operation = 'SHOW'
object_name = ms_item-obj_name
object_type = ms_item-obj_type
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:
lx_error TYPE REF TO cx_root,
lo_toggle TYPE REF TO object.
FIELD-SYMBOLS: <lg_toggle> TYPE data.
ASSIGN mr_toggle->* TO <lg_toggle>.
ASSERT sy-subrc = 0.
TRY.
CALL METHOD ('CL_FEATURE_TOGGLE_OBJECT')=>create_toggle_by_id
EXPORTING
iv_toggle_id = mv_toggle_id
RECEIVING
ro_toggle = lo_toggle.
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise_with_text( lx_error ).
ENDTRY.
CALL METHOD lo_toggle->('GET_CONTENT')
RECEIVING
rs_content = <lg_toggle>.
clear_field( EXPORTING iv_fieldname = 'HEADER-OWNER' CHANGING cg_header = <lg_toggle> ).
clear_field( EXPORTING iv_fieldname = 'HEADER-CREATED_DATE' CHANGING cg_header = <lg_toggle> ).
clear_field( EXPORTING iv_fieldname = 'HEADER-CREATED_TIME' CHANGING cg_header = <lg_toggle> ).
clear_field( EXPORTING iv_fieldname = 'HEADER-CHANGEDBY ' CHANGING cg_header = <lg_toggle> ).
clear_field( EXPORTING iv_fieldname = 'HEADER-CHANGED_DATE' CHANGING cg_header = <lg_toggle> ).
clear_field( EXPORTING iv_fieldname = 'HEADER-CHANGED_TIME' CHANGING cg_header = <lg_toggle> ).
io_xml->add(
iv_name = 'FTGL'
ig_data = <lg_toggle> ).
ENDMETHOD.
ENDCLASS.
| 23.446903 | 99 | 0.651821 |
7997d0291186ee6e14eef85432d5c4f758ba0b30 | 230 | abap | ABAP | test_v2/test002/zcl_icf_impl002.clas.abap | abap-openapi/abap-openapi | 0c2c7fc8b4f47e415e6bcc375af388e1935c1f03 | [
"MIT"
] | 1 | 2022-03-19T22:37:53.000Z | 2022-03-19T22:37:53.000Z | test_v2/test002/zcl_icf_impl002.clas.abap | abap-openapi/abap-openapi | 0c2c7fc8b4f47e415e6bcc375af388e1935c1f03 | [
"MIT"
] | null | null | null | test_v2/test002/zcl_icf_impl002.clas.abap | abap-openapi/abap-openapi | 0c2c7fc8b4f47e415e6bcc375af388e1935c1f03 | [
"MIT"
] | null | null | null | CLASS zcl_icf_impl002 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES zif_interface002.
ENDCLASS.
CLASS zcl_icf_impl002 IMPLEMENTATION.
METHOD zif_interface002~_test.
* Add implementation logic here
ENDMETHOD.
ENDCLASS. | 19.166667 | 40 | 0.813043 |
799985e3cc16c8ed0c527b47976801207bb488a3 | 784 | abap | ABAP | zcx_mocka_in_time_exception.clas.abap | uweku/mockA | cd519afdac3bdda0e61095740572c591d43abaee | [
"Apache-2.0"
] | 37 | 2015-02-11T22:11:04.000Z | 2021-03-31T11:26:07.000Z | zcx_mocka_in_time_exception.clas.abap | uweku/mockA | cd519afdac3bdda0e61095740572c591d43abaee | [
"Apache-2.0"
] | 16 | 2015-02-13T05:45:07.000Z | 2020-12-04T06:46:37.000Z | zcx_mocka_in_time_exception.clas.abap | uweku/mockA | cd519afdac3bdda0e61095740572c591d43abaee | [
"Apache-2.0"
] | 7 | 2015-03-27T00:05:20.000Z | 2018-11-22T14:06:07.000Z | class ZCX_MOCKA_IN_TIME_EXCEPTION definition
public
inheriting from CX_NO_CHECK
final
create public .
public section.
*"* public components of class ZCX_MOCKA_IN_TIME_EXCEPTION
*"* do not include other source files here!!!
methods CONSTRUCTOR
importing
!TEXTID like TEXTID optional
!PREVIOUS like PREVIOUS optional .
protected section.
*"* protected components of class ZCX_MOCKA_IN_TIME_EXCEPTION
*"* do not include other source files here!!!
private section.
*"* private components of class ZCX_MOCKA_IN_TIME_EXCEPTION
*"* do not include other source files here!!!
ENDCLASS.
CLASS ZCX_MOCKA_IN_TIME_EXCEPTION IMPLEMENTATION.
method CONSTRUCTOR.
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
TEXTID = TEXTID
PREVIOUS = PREVIOUS
.
endmethod.
ENDCLASS.
| 21.777778 | 61 | 0.781888 |
799b706a426db13c18ac9df78b974f256829e8c3 | 659 | abap | ABAP | exercises/practice/hello-world/zcl_hello_world.clas.testclasses.abap | pokrakam/abap | 163a6f881c2b714f41b84cbb2ac3553103b16b80 | [
"MIT"
] | null | null | null | exercises/practice/hello-world/zcl_hello_world.clas.testclasses.abap | pokrakam/abap | 163a6f881c2b714f41b84cbb2ac3553103b16b80 | [
"MIT"
] | 1 | 2022-02-28T04:41:42.000Z | 2022-02-28T04:41:42.000Z | exercises/practice/hello-world/zcl_hello_world.clas.testclasses.abap | ErikSchierboom/abap | b03be27bcd74801942a11370cda7b63660cacf55 | [
"MIT"
] | null | null | null | CLASS ltcl_hello_world DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun_out.
PRIVATE SECTION.
METHODS test FOR TESTING RAISING cx_static_check.
DATA text TYPE string.
ENDCLASS.
CLASS ltcl_hello_world IMPLEMENTATION.
METHOD test.
CAST if_oo_adt_classrun( NEW zcl_hello_world( ) )->main( me ).
cl_abap_unit_assert=>assert_equals(
act = if_oo_adt_classrun_out~get( )
exp = 'Hello, World!' ).
ENDMETHOD.
METHOD if_oo_adt_classrun_out~write.
text = data.
ENDMETHOD.
METHOD if_oo_adt_classrun_out~get.
output = text.
ENDMETHOD.
ENDCLASS.
| 21.258065 | 87 | 0.735964 |
79a32cf1566bb884eccb65af778725cf53676cd7 | 5,115 | abap | ABAP | lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt_ae_def.prog.abap | DanHaer/logistics-business-network-gtt-samples | 739978ac389da6f3530b26cd6402a3892f4b605a | [
"Apache-2.0"
] | null | null | null | lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt_ae_def.prog.abap | DanHaer/logistics-business-network-gtt-samples | 739978ac389da6f3530b26cd6402a3892f4b605a | [
"Apache-2.0"
] | null | null | null | lbn-gtt-template-ts/ABAP/zsrc/zsst_gtt_ae_def.prog.abap | DanHaer/logistics-business-network-gtt-samples | 739978ac389da6f3530b26cd6402a3892f4b605a | [
"Apache-2.0"
] | null | null | null | *&---------------------------------------------------------------------*
*& Include ZSST_GTT_AE
*&---------------------------------------------------------------------*
INTERFACE lif_actual_event.
TYPES: tt_tracklocation TYPE STANDARD TABLE OF /saptrx/bapi_evm_locationid.
TYPES: tt_trackingheader TYPE STANDARD TABLE OF /saptrx/bapi_evm_header.
TYPES: tt_trackparameters TYPE STANDARD TABLE OF /saptrx/bapi_evm_parameters.
TYPES: tt_execution_info TYPE STANDARD TABLE OF /scmtms/s_em_bo_tor_execinfo WITH DEFAULT KEY.
CONSTANTS:
BEGIN OF cs_location_type,
logistic TYPE string VALUE 'LogisticLocation',
END OF cs_location_type,
BEGIN OF cs_trxcode,
shipment_order TYPE /saptrx/trxcod VALUE 'SHIPMENT_ORDER',
END OF cs_trxcode,
BEGIN OF cs_tabledef,
tor_stop TYPE string VALUE 'TOR_STOP',
tor_root TYPE string VALUE 'TOR_ROOT',
tor_execution_info TYPE string VALUE 'TOR_EXECUTION_INFO',
tor_execution_info_before TYPE string VALUE 'TOR_EXECUTION_INFO_BEFORE',
END OF cs_tabledef,
BEGIN OF cs_event_id,
BEGIN OF standard,
departure TYPE /saptrx/ev_evtid VALUE 'DEPARTURE',
arrival TYPE /saptrx/ev_evtid VALUE 'ARRIV_DEST',
pod TYPE /saptrx/ev_evtid VALUE 'POD',
popu TYPE /saptrx/ev_evtid VALUE 'POPU',
load_begin TYPE /saptrx/ev_evtid VALUE 'LOAD_BEGIN',
load_end TYPE /saptrx/ev_evtid VALUE 'LOAD_END',
coupling TYPE /saptrx/ev_evtid VALUE 'COUPLING',
decoupling TYPE /saptrx/ev_evtid VALUE 'DECOUPLING',
unload_begin TYPE /saptrx/ev_evtid VALUE 'UNLOAD_BEGIN',
unload_end TYPE /saptrx/ev_evtid VALUE 'UNLOAD_END',
END OF standard,
BEGIN OF model,
shp_departure TYPE /saptrx/ev_evtid VALUE 'DEPARTURE',
shp_arrival TYPE /saptrx/ev_evtid VALUE 'ARRIV_DEST',
shp_pod TYPE /saptrx/ev_evtid VALUE 'POD',
popu TYPE /saptrx/ev_evtid VALUE 'POPU',
load_start TYPE /saptrx/ev_evtid VALUE 'LOAD_BEGIN',
load_end TYPE /saptrx/ev_evtid VALUE 'LOAD_END',
coupling TYPE /saptrx/ev_evtid VALUE 'COUPLING',
decoupling TYPE /saptrx/ev_evtid VALUE 'DECOUPLING',
unload_begin TYPE /saptrx/ev_evtid VALUE 'UNLOAD_BEGIN',
unload_end TYPE /saptrx/ev_evtid VALUE 'UNLOAD_END',
END OF model,
END OF cs_event_id.
METHODS adjust_ae_location_data
IMPORTING
i_all_appl_tables TYPE trxas_tabcontainer
iv_clear_standard_param TYPE abap_bool DEFAULT abap_true
CHANGING
ct_trackingheader TYPE tt_trackingheader
ct_tracklocation TYPE tt_tracklocation
ct_trackparameters TYPE tt_trackparameters.
METHODS check_event_relevance
IMPORTING
i_all_appl_tables TYPE trxas_tabcontainer
iv_event_code TYPE /scmtms/tor_event
i_event TYPE trxas_evt_ctab_wa
EXPORTING
VALUE(e_result) LIKE sy-binpt.
METHODS check_application_event_source
IMPORTING
i_all_appl_tables TYPE trxas_tabcontainer
iv_event_code TYPE /scmtms/tor_event
i_event TYPE trxas_evt_ctab_wa
EXPORTING
VALUE(e_result) LIKE sy-binpt.
METHODS check_tor_type_specific_events
IMPORTING
iv_event_code TYPE /scmtms/tor_event
RETURNING
VALUE(e_result) LIKE sy-binpt.
ENDINTERFACE.
CLASS lcl_actual_event DEFINITION.
PUBLIC SECTION.
INTERFACES lif_actual_event.
CLASS-METHODS get_tor_actual_event_class
IMPORTING
i_event TYPE trxas_evt_ctab_wa
RETURNING
VALUE(ro_actual_event) TYPE REF TO lif_actual_event
RAISING
cx_udm_message.
PRIVATE SECTION.
METHODS get_stop
IMPORTING
i_all_appl_tables TYPE trxas_tabcontainer
RETURNING
VALUE(rt_stop) TYPE /scmtms/t_em_bo_tor_stop.
METHODS get_root
IMPORTING
i_all_appl_tables TYPE trxas_tabcontainer
RETURNING
VALUE(rt_root) TYPE /scmtms/t_em_bo_tor_root.
METHODS get_locid2
IMPORTING
i_tor_id TYPE /scmtms/tor_id
i_seq_num TYPE /scmtms/seq_num
RETURNING
VALUE(rv_locid2) TYPE /saptrx/ev_locid2.
METHODS get_execution
IMPORTING
i_all_appl_tables TYPE trxas_tabcontainer
iv_old TYPE abap_bool DEFAULT abap_false
EXPORTING
VALUE(et_execution) TYPE /scmtms/t_em_bo_tor_execinfo.
METHODS get_model_event_id
IMPORTING
iv_standard_event_id TYPE /saptrx/ev_evtid
RETURNING
VALUE(rv_model_event_id) TYPE /saptrx/ev_evtid.
ENDCLASS.
CLASS lcl_fo_actual_event DEFINITION INHERITING FROM lcl_actual_event.
PUBLIC SECTION.
METHODS lif_actual_event~check_tor_type_specific_events REDEFINITION.
ENDCLASS.
CLASS lcl_fb_actual_event DEFINITION INHERITING FROM lcl_actual_event.
PUBLIC SECTION.
METHODS lif_actual_event~check_tor_type_specific_events REDEFINITION.
ENDCLASS.
| 35.769231 | 97 | 0.678788 |
79a3605d0a1decca7a96195ddaa994f3add46083 | 4,504 | abap | ABAP | src/zdop_material_data.fugr.saplzdop_material_data.abap | DogukanP/ABAP-SSR | c2019809e7c809235e3a96641f4188d96cdeeebb | [
"Apache-2.0"
] | null | null | null | src/zdop_material_data.fugr.saplzdop_material_data.abap | DogukanP/ABAP-SSR | c2019809e7c809235e3a96641f4188d96cdeeebb | [
"Apache-2.0"
] | null | null | null | src/zdop_material_data.fugr.saplzdop_material_data.abap | DogukanP/ABAP-SSR | c2019809e7c809235e3a96641f4188d96cdeeebb | [
"Apache-2.0"
] | null | null | null | *******************************************************************
* System-defined Include-files. *
*******************************************************************
INCLUDE LZDOP_MATERIAL_DATATOP. " Global Data
INCLUDE LZDOP_MATERIAL_DATAUXX. " Function Modules
*******************************************************************
* User-defined Include-files (if necessary). *
*******************************************************************
* INCLUDE LZDOP_MATERIAL_DATAF... " Subroutines
* INCLUDE LZDOP_MATERIAL_DATAO... " PBO-Modules
* INCLUDE LZDOP_MATERIAL_DATAI... " PAI-Modules
* INCLUDE LZDOP_MATERIAL_DATAE... " Events
* INCLUDE LZDOP_MATERIAL_DATAP... " Local class implement.
* INCLUDE LZDOP_MATERIAL_DATAT99. " ABAP Unit tests
* DIESES INCLUDE NICHT MEHR AENDERN! *
* NEUE INCLUDES IN BESTEHENDE INCLUDES AUFNEHMEN! *
*------------------------------------------------------------------
* PBO-Module
*------------------------------------------------------------------
INCLUDE LMGD1OXX. "zentrale PBO-Module Bildbausteine
INCLUDE LMGD1O01. "PBO-Module für Kurztexthandling
INCLUDE LMGD1O02. "PBO-Module für Steuerhandling
INCLUDE LMGD1O03. "PBO-Module für Verbrauchswerte
INCLUDE LMGD1O04. "PBO-Mdoule Mengeneinheiten
INCLUDE LMGD1O05. "PBO-Module für Prognosewerte
INCLUDE LMGD1O06. "PBO-Module für EAN
INCLUDE LMGD1O07. "PBO-Module für Langtexte
INCLUDE LMGD1O08. "PBO-Module für Table-Control Steuerung
INCLUDE LMGD1O1K. "PBO-Modul für Klassif.-Subscreen
*------------------------------------------------------------------
* PAI-Module
*------------------------------------------------------------------
INCLUDE LMGD1IXX. "zentrale PAI-Module Bildbausteine
INCLUDE LMGD1IYY. "Gemeinsame PAI-Module Bildbaustein/Trägerprogramm
INCLUDE LMGD1I01. "Prüfmodule Datenbilder MARA, MAKT (Kopfbaustein)
INCLUDE LMGD1I02. "Prüfmodule Datenbilder MARC, MARD, MPGD
INCLUDE LMGD1I03. "Prüfmodule Datenbilder QM-Daten (MARA/MARC)
INCLUDE LMGD1I04. "Prüfmodule Datenbilder MBEW
INCLUDE LMGD1I05. "Prüfmodule Datenbilder MFHM
INCLUDE LMGD1I06. "Prüfmodule Datenbilder MLGN, MLGT
INCLUDE LMGD1I07. "Prüfmodule Datenbilder MPOP
INCLUDE LMGD1I08. "Prüfmodule Datenbilder MVKE
INCLUDE LMGD1I09. "Prüfmodule für Kurztexthandling
INCLUDE LMGD1I10. "PAI-Module für Steuerhandling
INCLUDE LMGD1I11. "PAI-Module für Verbrauchswerte
INCLUDE LMGD1I12. "PAI-Module Mengeneinheiten
INCLUDE LMGD1I13. "PAI-Module für Prognosewerte
INCLUDE LMGD1I14. "PAI-Module EAN
INCLUDE LMGD1I15. "PAI-Module für Langtexte
INCLUDE LMGD1I17. "PAI-Module für TC-Steuerung
INCLUDE LMGD1I7O. "PAI-Module für Klassif.-Subscreen
INCLUDE LMGD1IHX. "Eingabehilfen Bildbausteine
*------------------------------------------------------------------
*
* FORM-Routinen
*
*------------------------------------------------------------------
INCLUDE LMGD1FXX. "zentrale Formroutinen Bildbausteine
INCLUDE LMGD1FYY. "Gemeinsame Form-Routinen Bildbaustein/Tägerpr.
INCLUDE LMGD1FSC. "zentrale Blätterroutinen Bildbausteine
INCLUDE LMGD1F01. "Form-Routinen Kurztexthandling
INCLUDE LMGD1F02. "Form-Routinen Steuerhandling
INCLUDE LMGD1F03. "Form-Routinen I Verbrauchswerte/Prognosewerte
INCLUDE LMGD1F06. "Form-Routinen II Verbrauchswerte/Prognosewerte
INCLUDE LMGD1F04. "Form-Routinen Mengeneinheiten
INCLUDE LMGD1F05. "Form-Routinen EAN
*
INCLUDE LMGD1FHX. "spezielle Eingabehilfen Bildbausteine
INCLUDE LMGMMFHX. "allg. Routinen Eingabehilfen
* generierte Form-Routinen für Bildbausteine
INCLUDE MMMGXGUW. "Holen der Daten auf den Bildbaustein
INCLUDE MMMGXSUW. "Übergeben der Daten vom Bildbaustein
INCLUDE MMMGXRBD. "Zus. Vorschlagshandling before Dialog
INCLUDE MMMGXRAD. "Zus. Vorschlagshandling after Dialog
INCLUDE LMGD1I7K.
*INCLUDE LMGD1F2F.
INCLUDE LMGD1O1J.
INCLUDE LMGD1I7Q.
INCLUDE LMGD1OV0.
INCLUDE LMGD1I7T.
* DIESES INCLUDE NICHT MEHR AENDERN! *
* NEUE INCLUDES IN BESTEHENDE INCLUDES AUFNEHMEN! *
INCLUDE lzdop_material_datao01.
INCLUDE lzdop_material_datao02.
INCLUDE lzdop_material_datai01.
| 45.04 | 72 | 0.604574 |
79a6a6f7f3b78eaf0a1662875a1b06a422d7e719 | 2,647 | abap | ABAP | yea_service.intf.abap | gregorwolf/express.abap | 0452ace555304cec6bcb6ce28782291c3a231351 | [
"MIT"
] | 22 | 2017-06-10T06:13:33.000Z | 2021-11-05T00:52:23.000Z | yea_service.intf.abap | gregorwolf/express.abap | 0452ace555304cec6bcb6ce28782291c3a231351 | [
"MIT"
] | null | null | null | yea_service.intf.abap | gregorwolf/express.abap | 0452ace555304cec6bcb6ce28782291c3a231351 | [
"MIT"
] | 6 | 2018-09-14T12:50:26.000Z | 2020-07-31T09:58:57.000Z | interface YEA_SERVICE
public .
interfaces IF_HTTP_EXTENSION .
methods USE
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods GET
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods HEAD
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods POST
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods PUT
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods DELETE
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods PATCH
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods COPY
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods OPTIONS
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods LINK
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods UNLINK
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods PURGE
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods LOCK
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods UNLOCK
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods PROPFIND
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods VIEW
importing
!PATH type STRING
!ROUTE type ref to YEA_ROUTE
returning
value(RETURNING) type ref to YEA_SERVICE .
methods ROOT
returning
value(RETURNING) type STRING .
methods TRACE
returning
value(RETURNING) type STRINGTAB .
endinterface.
| 24.063636 | 48 | 0.668304 |
79a87ce13ca00bb0d3865785552015a5f6140b04 | 8,590 | abap | ABAP | src/objects/zcl_abapgit_objects_activation.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | 1 | 2019-11-29T05:30:57.000Z | 2019-11-29T05:30:57.000Z | src/objects/zcl_abapgit_objects_activation.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_objects_activation.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_objects_activation DEFINITION PUBLIC CREATE PUBLIC.
PUBLIC SECTION.
CLASS-METHODS add
IMPORTING iv_type TYPE trobjtype
iv_name TYPE clike
iv_delete TYPE abap_bool DEFAULT abap_false
RAISING zcx_abapgit_exception.
CLASS-METHODS add_item
IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item
RAISING zcx_abapgit_exception.
CLASS-METHODS activate
IMPORTING iv_ddic TYPE abap_bool DEFAULT abap_false
RAISING zcx_abapgit_exception.
CLASS-METHODS clear.
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-DATA:
gt_classes TYPE STANDARD TABLE OF seoclsname WITH DEFAULT KEY .
CLASS-DATA:
gt_objects TYPE TABLE OF dwinactiv .
CLASS-METHODS update_where_used .
CLASS-METHODS use_new_activation_logic
RETURNING
VALUE(rv_use_new_activation_logic) TYPE abap_bool .
CLASS-METHODS activate_new
IMPORTING
!iv_ddic TYPE abap_bool DEFAULT abap_false
RAISING
zcx_abapgit_exception .
CLASS-METHODS activate_old
IMPORTING
!iv_ddic TYPE abap_bool DEFAULT abap_false
RAISING
zcx_abapgit_exception .
CLASS-METHODS activate_ddic
RAISING
zcx_abapgit_exception .
CLASS-METHODS show_activation_errors
IMPORTING
!iv_logname TYPE ddmass-logname
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECTS_ACTIVATION IMPLEMENTATION.
METHOD activate.
IF use_new_activation_logic( ) = abap_true.
activate_new( iv_ddic ).
ELSE.
activate_old( iv_ddic ).
ENDIF.
update_where_used( ).
ENDMETHOD.
METHOD activate_ddic.
DATA: lt_gentab TYPE STANDARD TABLE OF dcgentb,
lv_rc TYPE sy-subrc,
ls_gentab LIKE LINE OF lt_gentab,
lt_deltab TYPE STANDARD TABLE OF dcdeltb,
lt_action_tab TYPE STANDARD TABLE OF dctablres,
lv_logname TYPE ddmass-logname.
FIELD-SYMBOLS: <ls_object> LIKE LINE OF gt_objects.
LOOP AT gt_objects ASSIGNING <ls_object>.
ls_gentab-tabix = sy-tabix.
ls_gentab-type = <ls_object>-object.
ls_gentab-name = <ls_object>-obj_name.
IF ls_gentab-type = 'INDX'.
CALL FUNCTION 'DD_E071_TO_DD'
EXPORTING
object = <ls_object>-object
obj_name = <ls_object>-obj_name
IMPORTING
name = ls_gentab-name
id = ls_gentab-indx.
ENDIF.
INSERT ls_gentab INTO TABLE lt_gentab.
ENDLOOP.
IF lt_gentab IS NOT INITIAL.
lv_logname = |ABAPGIT_{ sy-datum }_{ sy-uzeit }|.
CALL FUNCTION 'DD_MASS_ACT_C3'
EXPORTING
ddmode = 'O'
medium = 'T' " transport order
device = 'T' " saves to table DDRPH?
version = 'M' " activate newest
logname = lv_logname
write_log = abap_true
log_head_tail = abap_true
t_on = space
prid = 1
IMPORTING
act_rc = lv_rc
TABLES
gentab = lt_gentab
deltab = lt_deltab
cnvtab = lt_action_tab
EXCEPTIONS
access_failure = 1
no_objects = 2
locked = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from DD_MASS_ACT_C3' ).
ENDIF.
IF lv_rc > 0.
show_activation_errors( lv_logname ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD activate_new.
DATA: li_progress TYPE REF TO zif_abapgit_progress.
IF gt_objects IS INITIAL.
RETURN.
ENDIF.
li_progress = zcl_abapgit_progress=>get_instance( 100 ).
IF iv_ddic = abap_true.
li_progress->show( iv_current = 98
iv_text = 'Activating DDIC' ).
activate_ddic( ).
ELSE.
li_progress->show( iv_current = 98
iv_text = 'Activating non DDIC' ).
activate_old( ).
ENDIF.
ENDMETHOD.
METHOD activate_old.
DATA: lv_popup TYPE abap_bool.
IF gt_objects IS NOT INITIAL.
lv_popup = zcl_abapgit_ui_factory=>get_gui_functions( )->gui_is_available( ).
CALL FUNCTION 'RS_WORKING_OBJECTS_ACTIVATE'
EXPORTING
activate_ddic_objects = iv_ddic
with_popup = lv_popup
TABLES
objects = gt_objects
EXCEPTIONS
excecution_error = 1
cancelled = 2
insert_into_corr_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_WORKING_OBJECTS_ACTIVATE' ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD add.
* function group SEWORKINGAREA
* function module RS_INSERT_INTO_WORKING_AREA
* class CL_WB_ACTIVATION_WORK_AREA
DATA: lt_objects TYPE dwinactiv_tab,
lv_obj_name TYPE dwinactiv-obj_name.
FIELD-SYMBOLS: <ls_object> LIKE LINE OF lt_objects.
lv_obj_name = iv_name.
CASE iv_type.
WHEN 'CLAS'.
APPEND iv_name TO gt_classes.
WHEN 'WDYN'.
* todo, move this to the object type include instead
CALL FUNCTION 'RS_INACTIVE_OBJECTS_IN_OBJECT'
EXPORTING
obj_name = lv_obj_name
object = iv_type
TABLES
inactive_objects = lt_objects
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RS_INACTIVE_OBJECTS_IN_OBJECT' ).
ENDIF.
LOOP AT lt_objects ASSIGNING <ls_object>.
<ls_object>-delet_flag = iv_delete.
ENDLOOP.
APPEND LINES OF lt_objects TO gt_objects.
WHEN OTHERS.
APPEND INITIAL LINE TO gt_objects ASSIGNING <ls_object>.
<ls_object>-object = iv_type.
<ls_object>-obj_name = lv_obj_name.
<ls_object>-delet_flag = iv_delete.
ENDCASE.
ENDMETHOD.
METHOD add_item.
add( iv_type = is_item-obj_type
iv_name = is_item-obj_name ).
ENDMETHOD.
METHOD clear.
CLEAR gt_objects.
CLEAR gt_classes.
ENDMETHOD.
METHOD show_activation_errors.
DATA: lt_lines TYPE STANDARD TABLE OF trlog,
lv_logname_db TYPE ddprh-protname,
li_log TYPE REF TO zif_abapgit_log.
FIELD-SYMBOLS: <ls_line> LIKE LINE OF lt_lines.
lv_logname_db = iv_logname.
CALL FUNCTION 'TR_READ_LOG'
EXPORTING
iv_log_type = 'DB'
iv_logname_db = lv_logname_db
TABLES
et_lines = lt_lines
EXCEPTIONS
invalid_input = 1
access_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from TR_READ_LOG' ).
ENDIF.
DELETE lt_lines WHERE severity <> 'E'.
CREATE OBJECT li_log TYPE zcl_abapgit_log.
LOOP AT lt_lines ASSIGNING <ls_line>.
li_log->add( <ls_line>-line ).
ENDLOOP.
IF li_log->count( ) > 0.
zcl_abapgit_log_viewer=>show_log( iv_header_text = 'Activation Errors'
ii_log = li_log ).
ENDIF.
ENDMETHOD.
METHOD update_where_used.
DATA: lv_class LIKE LINE OF gt_classes,
lo_cross TYPE REF TO cl_wb_crossreference,
lv_include TYPE programm,
li_progress TYPE REF TO zif_abapgit_progress.
li_progress = zcl_abapgit_progress=>get_instance( lines( gt_classes ) ).
LOOP AT gt_classes INTO lv_class.
IF sy-tabix MOD 20 = 0.
li_progress->show(
iv_current = sy-tabix
iv_text = 'Updating where-used lists' ).
ENDIF.
lv_include = cl_oo_classname_service=>get_classpool_name( lv_class ).
CREATE OBJECT lo_cross
EXPORTING
p_name = lv_include
p_include = lv_include.
lo_cross->index_actualize( ).
ENDLOOP.
ENDMETHOD.
METHOD use_new_activation_logic.
* left for easy rollback, cleanup later
* IF zcl_abapgit_persist_settings=>get_instance( )->read( )->get_experimental_features( ) = abap_true.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = 'DD_MASS_ACT_C3'
EXCEPTIONS
function_not_exist = 1
OTHERS = 2.
IF sy-subrc = 0.
rv_use_new_activation_logic = abap_true.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 24.97093 | 102 | 0.611176 |
79a94acf6371884e060cede941bff713be44d58d | 1,490 | abap | ABAP | src/objects/zcl_abapgit_object_pdts.clas.locals_def.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_pdts.clas.locals_def.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_pdts.clas.locals_def.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE lif_task_definition.
TYPES: BEGIN OF ty_task_data,
short_text TYPE hr_mcshort,
plvar TYPE plvar,
wi_text TYPE witext,
method TYPE hrs1201,
method_binding TYPE hrsmtbind,
starting_events TYPE hrsevtab,
starting_events_binding TYPE hrsevbind,
terminating_events TYPE hrsetmtab,
terminating_events_binding TYPE hrsevbind,
descriptions TYPE wstexts,
END OF ty_task_data.
METHODS clear_origin_data.
METHODS get_definition RETURNING VALUE(rs_result) TYPE ty_task_data.
METHODS get_container RETURNING VALUE(ri_result) TYPE REF TO if_swf_cnt_container.
METHODS get_user_container RETURNING VALUE(ri_result) TYPE REF TO if_swf_cnt_container.
METHODS import_container IMPORTING iv_xml_string TYPE xstring
RAISING zcx_abapgit_exception.
METHODS create_task RAISING zcx_abapgit_exception.
METHODS save IMPORTING iv_package TYPE devclass OPTIONAL
RAISING zcx_abapgit_exception.
METHODS change_wi_text RAISING zcx_abapgit_exception.
METHODS change_method RAISING zcx_abapgit_exception.
METHODS change_start_events RAISING zcx_abapgit_exception.
METHODS change_terminating_events RAISING zcx_abapgit_exception.
METHODS change_text RAISING zcx_abapgit_exception.
ENDINTERFACE.
| 46.5625 | 89 | 0.69396 |
79ac4b2ae09d9da74995ba54f5ac9ea3bba79117 | 1,528 | abap | ABAP | src/ydklist.fugr.ydk_list_for_class.abap | DKiyanov/YDK_LIST | 06095ca2ee6fe5ced7f582f007fcfaf1a4e79d85 | [
"MIT"
] | null | null | null | src/ydklist.fugr.ydk_list_for_class.abap | DKiyanov/YDK_LIST | 06095ca2ee6fe5ced7f582f007fcfaf1a4e79d85 | [
"MIT"
] | null | null | null | src/ydklist.fugr.ydk_list_for_class.abap | DKiyanov/YDK_LIST | 06095ca2ee6fe5ced7f582f007fcfaf1a4e79d85 | [
"MIT"
] | null | null | null | FUNCTION ydk_list_for_class.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(CLASSNAME) TYPE CLIKE
*" REFERENCE(METHOD) TYPE CLIKE
*" REFERENCE(COL) DEFAULT 5
*" REFERENCE(ROW) DEFAULT 5
*" REFERENCE(WIDTH) OPTIONAL
*" REFERENCE(HEIGHT) OPTIONAL
*" REFERENCE(PARAMS) TYPE YDK_LIST=>TY_PARAM_TAB OPTIONAL
*" EXCEPTIONS
*" CANCEL
*"----------------------------------------------------------------------
DATA: rcol TYPE i.
DATA: brow TYPE i.
DATA: lclassname TYPE string.
DATA: lmethod TYPE string.
FIELD-SYMBOLS <lparams> TYPE ydk_list=>ty_param_tab.
DATA: lcall_mode TYPE c.
DATA: subrc LIKE sy-subrc.
CLEAR exit_dlg.
lclassname = rclassname.
lmethod = rmethod.
IF <rparams> IS ASSIGNED.
ASSIGN <rparams> TO <lparams>.
UNASSIGN <rparams>.
ENDIF.
lcall_mode = gcall_mode.
rclassname = classname.
rmethod = method.
IF params IS SUPPLIED AND params IS NOT INITIAL.
ASSIGN params TO <rparams>.
ENDIF.
gcall_mode = 'S'.
IF width IS INITIAL AND height IS INITIAL.
CALL SCREEN 0100.
ELSE.
rcol = col + width.
brow = row + height.
CALL SCREEN 0110 STARTING AT col row
ENDING AT rcol brow.
ENDIF.
subrc = sy-subrc.
rclassname = lclassname.
rmethod = lmethod.
UNASSIGN <rparams>.
IF <lparams> IS ASSIGNED.
ASSIGN <lparams> TO <rparams>.
ENDIF.
IF subrc <> 0.
RAISE cancel.
ENDIF.
ENDFUNCTION.
| 23.507692 | 72 | 0.593586 |
79ad554a83cb7a8e60aaedd014d32e1b7d8d85e7 | 5,914 | abap | ABAP | src/objects/zcl_abapgit_longtexts.clas.abap | sagardarji/abapGit | a1699302a652d304f66e1ecda2f232158dbd879d | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_longtexts.clas.abap | sagardarji/abapGit | a1699302a652d304f66e1ecda2f232158dbd879d | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_longtexts.clas.abap | sagardarji/abapGit | a1699302a652d304f66e1ecda2f232158dbd879d | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_longtexts DEFINITION
PUBLIC
CREATE PRIVATE
GLOBAL FRIENDS zcl_abapgit_factory.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING
iv_longtexts_name TYPE string OPTIONAL,
changed_by
IMPORTING
iv_object_name TYPE sobj_name
iv_longtext_id TYPE dokil-id
it_dokil TYPE zif_abapgit_definitions=>tty_dokil OPTIONAL
RETURNING
VALUE(rv_user) TYPE xubname
RAISING
zcx_abapgit_exception,
serialize
IMPORTING
iv_object_name TYPE sobj_name
iv_longtext_id TYPE dokil-id
it_dokil TYPE zif_abapgit_definitions=>tty_dokil OPTIONAL
io_xml TYPE REF TO zcl_abapgit_xml_output
RAISING
zcx_abapgit_exception,
deserialize
IMPORTING
io_xml TYPE REF TO zcl_abapgit_xml_input
iv_master_language TYPE langu
RAISING
zcx_abapgit_exception,
delete
IMPORTING
iv_object_name TYPE sobj_name
iv_longtext_id TYPE dokil-id
RAISING
zcx_abapgit_exception.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_longtext,
dokil TYPE dokil,
head TYPE thead,
lines TYPE tline_tab,
END OF ty_longtext,
tty_longtexts TYPE STANDARD TABLE OF ty_longtext
WITH NON-UNIQUE DEFAULT KEY.
CONSTANTS:
c_longtexts_name TYPE string VALUE 'LONGTEXTS' ##NO_TEXT,
c_docu_state_active TYPE dokstate VALUE 'A' ##NO_TEXT.
DATA:
mv_longtexts_name TYPE string.
METHODS:
read
IMPORTING
iv_object_name TYPE sobj_name
iv_longtext_id TYPE dokil-id
it_dokil TYPE zif_abapgit_definitions=>tty_dokil
RETURNING
VALUE(rt_longtexts) TYPE tty_longtexts
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_longtexts IMPLEMENTATION.
METHOD constructor.
IF iv_longtexts_name IS NOT INITIAL.
mv_longtexts_name = iv_longtexts_name.
ELSE.
mv_longtexts_name = c_longtexts_name.
ENDIF.
ENDMETHOD.
METHOD delete.
DATA: lt_dokil TYPE zif_abapgit_definitions=>tty_dokil.
FIELD-SYMBOLS: <ls_dokil> TYPE dokil.
SELECT * FROM dokil
INTO TABLE lt_dokil
WHERE id = iv_longtext_id
AND object = iv_object_name.
LOOP AT lt_dokil ASSIGNING <ls_dokil>.
CALL FUNCTION 'DOCU_DEL'
EXPORTING
id = <ls_dokil>-id
langu = <ls_dokil>-langu
object = <ls_dokil>-object
typ = <ls_dokil>-typ
EXCEPTIONS
ret_code = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD deserialize.
DATA: lt_longtexts TYPE tty_longtexts,
lv_no_masterlang TYPE dokil-masterlang.
FIELD-SYMBOLS: <ls_longtext> TYPE ty_longtext.
io_xml->read(
EXPORTING
iv_name = mv_longtexts_name
CHANGING
cg_data = lt_longtexts ).
LOOP AT lt_longtexts ASSIGNING <ls_longtext>.
lv_no_masterlang = boolc( iv_master_language <> <ls_longtext>-dokil-langu ).
CALL FUNCTION 'DOCU_UPDATE'
EXPORTING
head = <ls_longtext>-head
state = c_docu_state_active
typ = <ls_longtext>-dokil-typ
version = <ls_longtext>-dokil-version
no_masterlang = lv_no_masterlang
TABLES
line = <ls_longtext>-lines.
ENDLOOP.
ENDMETHOD.
METHOD serialize.
DATA: lt_longtexts TYPE tty_longtexts.
lt_longtexts = read( iv_object_name = iv_object_name
iv_longtext_id = iv_longtext_id
it_dokil = it_dokil ).
io_xml->add( iv_name = mv_longtexts_name
ig_data = lt_longtexts ).
ENDMETHOD.
METHOD changed_by.
DATA: lt_longtexts TYPE tty_longtexts.
FIELD-SYMBOLS: <ls_longtext> TYPE ty_longtext.
lt_longtexts = read( iv_object_name = iv_object_name
iv_longtext_id = iv_longtext_id
it_dokil = it_dokil ).
READ TABLE lt_longtexts INDEX 1 ASSIGNING <ls_longtext>.
IF sy-subrc = 0.
rv_user = <ls_longtext>-head-tdluser.
ENDIF.
ENDMETHOD.
METHOD read.
DATA: ls_longtext TYPE ty_longtext,
lt_dokil TYPE zif_abapgit_definitions=>tty_dokil.
FIELD-SYMBOLS: <ls_dokil> LIKE LINE OF lt_dokil.
IF lines( it_dokil ) > 0.
lt_dokil = it_dokil.
ELSEIF iv_longtext_id IS NOT INITIAL.
SELECT * FROM dokil
INTO TABLE lt_dokil
WHERE id = iv_longtext_id
AND object = iv_object_name
ORDER BY PRIMARY KEY.
ELSE.
zcx_abapgit_exception=>raise( |serialize_longtexts parameter error| ).
ENDIF.
LOOP AT lt_dokil ASSIGNING <ls_dokil>
WHERE txtlines > 0.
CLEAR: ls_longtext.
ls_longtext-dokil = <ls_dokil>.
CALL FUNCTION 'DOCU_READ'
EXPORTING
id = <ls_dokil>-id
langu = <ls_dokil>-langu
object = <ls_dokil>-object
typ = <ls_dokil>-typ
version = <ls_dokil>-version
IMPORTING
head = ls_longtext-head
TABLES
line = ls_longtext-lines.
CLEAR: ls_longtext-head-tdfuser,
ls_longtext-head-tdfreles,
ls_longtext-head-tdfdate,
ls_longtext-head-tdftime,
ls_longtext-head-tdluser,
ls_longtext-head-tdlreles,
ls_longtext-head-tdldate,
ls_longtext-head-tdltime.
INSERT ls_longtext INTO TABLE rt_longtexts.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
| 24.237705 | 82 | 0.606358 |
79b15fbd0290162c25d5719f582ebb4b0a1d6ec6 | 13,883 | abap | ABAP | src/legacy/#dmo#cx_flight_legacy04.clas.abap | SAP-Cloud-Platform/flight04 | 8c66bd222a10eac25582da83d0a3347dd41cd55b | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#cx_flight_legacy04.clas.abap | SAP-Cloud-Platform/flight04 | 8c66bd222a10eac25582da83d0a3347dd41cd55b | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#cx_flight_legacy04.clas.abap | SAP-Cloud-Platform/flight04 | 8c66bd222a10eac25582da83d0a3347dd41cd55b | [
"BSD-Source-Code"
] | null | null | null | CLASS /dmo/cx_flight_legacy04 DEFINITION
PUBLIC
INHERITING FROM cx_static_check
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_t100_message .
CONSTANTS:
gc_msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
BEGIN OF agency_unkown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '001',
attr1 TYPE scx_attrname VALUE 'MV_AGENCY_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF agency_unkown,
BEGIN OF customer_unkown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '002',
attr1 TYPE scx_attrname VALUE 'MV_CUSTOMER_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF customer_unkown,
BEGIN OF connection_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '004',
attr1 TYPE scx_attrname VALUE 'MV_CARRIER_ID',
attr2 TYPE scx_attrname VALUE 'MV_CONNECTION_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF connection_unknown ,
BEGIN OF carrier_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '005',
attr1 TYPE scx_attrname VALUE 'MV_CARRIER_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF carrier_unknown ,
BEGIN OF supplement_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '006',
attr1 TYPE scx_attrname VALUE 'MV_SUPPLEMENT_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF supplement_unknown,
BEGIN OF travel_status_invalid,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '007',
attr1 TYPE scx_attrname VALUE 'MV_STATUS',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_status_invalid,
BEGIN OF currency_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '008',
attr1 TYPE scx_attrname VALUE 'MV_CURRENCY_CODE',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF currency_unknown,
BEGIN OF travel_no_key,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '009',
attr1 TYPE scx_attrname VALUE '',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_no_key,
BEGIN OF no_begin_date,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '013',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF no_begin_date,
BEGIN OF no_end_date,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '014',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF no_end_date,
BEGIN OF end_date_before_begin_date,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '015',
attr1 TYPE scx_attrname VALUE 'MV_BEGIN_DATE',
attr2 TYPE scx_attrname VALUE 'MV_END_DATE',
attr3 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr4 TYPE scx_attrname VALUE '',
END OF end_date_before_begin_date,
BEGIN OF travel_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '016',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_unknown,
BEGIN OF booking_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '017',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_unknown,
BEGIN OF booking_no_key,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '018',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_no_key,
BEGIN OF booking_booking_date_invalid,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '019',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_DATE',
attr4 TYPE scx_attrname VALUE '',
END OF booking_booking_date_invalid,
BEGIN OF flight_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '020',
attr1 TYPE scx_attrname VALUE 'MV_CARRIER_ID',
attr2 TYPE scx_attrname VALUE 'MV_CONNECTION_ID',
attr3 TYPE scx_attrname VALUE 'MV_FLIGHT_DATE',
attr4 TYPE scx_attrname VALUE '',
END OF flight_unknown,
BEGIN OF booking_supplement_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '021',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_unknown,
BEGIN OF booking_supplement_no_key,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '022',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_no_key,
BEGIN OF booking_exists,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '023',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_exists,
BEGIN OF booking_supplement_exists,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '024',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_exists,
BEGIN OF travel_no_control,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '025',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_no_control,
BEGIN OF booking_no_control,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '026',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_no_control,
BEGIN OF booking_supplement_no_control,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '027',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_no_control,
BEGIN OF booking_supplement_suppl_id_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '028',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_suppl_id_u,
BEGIN OF booking_supplement_pri_curr_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '029',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_pri_curr_u,
BEGIN OF booking_flight_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '030',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_flight_u,
BEGIN OF booking_price_currency_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '031',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_price_currency_u,
BEGIN OF travel_lock,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '032',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_UNAME',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_lock,
BEGIN OF travel_already_exists,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_04',
msgno TYPE symsgno VALUE '033',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_already_exists.
METHODS constructor
IMPORTING
textid LIKE if_t100_message=>t100key OPTIONAL
previous LIKE previous OPTIONAL
travel_id TYPE /dmo/travel_id04 OPTIONAL
booking_id TYPE /dmo/booking_id04 OPTIONAL
booking_supplement_id TYPE /dmo/booking_supplement_id04 OPTIONAL
agency_id TYPE /dmo/agency_id04 OPTIONAL
customer_id TYPE /dmo/customer_id04 OPTIONAL
carrier_id TYPE /dmo/carrier04-carrier_id OPTIONAL
connection_id TYPE /dmo/connecti_04-connection_id OPTIONAL
supplement_id TYPE /dmo/suppleme_04-supplement_id OPTIONAL
begin_date TYPE /dmo/begin_date04 OPTIONAL
end_date TYPE /dmo/end_date04 OPTIONAL
booking_date TYPE /dmo/booking_date04 OPTIONAL
flight_date TYPE /dmo/flight_date04 OPTIONAL
status TYPE /dmo/travel_status04 OPTIONAL
currency_code TYPE /dmo/currency_code04 OPTIONAL
uname TYPE syuname OPTIONAL.
DATA: mv_travel_id TYPE /dmo/travel_id04,
mv_booking_id TYPE /dmo/booking_id04,
mv_booking_supplement_id TYPE /dmo/booking_supplement_id04,
mv_agency_id TYPE /dmo/agency_id04,
mv_customer_id TYPE /dmo/customer_id04,
mv_carrier_id TYPE /dmo/carrier04-carrier_id,
mv_connection_id TYPE /dmo/connecti_04-connection_id,
mv_supplement_id TYPE /dmo/suppleme_04-supplement_id,
mv_begin_date TYPE /dmo/begin_date04,
mv_end_date TYPE /dmo/end_date04,
mv_booking_date TYPE /dmo/booking_date04,
mv_flight_date TYPE /dmo/flight_date04,
mv_status TYPE /dmo/travel_status04,
mv_currency_code TYPE /dmo/currency_code04,
mv_uname TYPE syuname.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS /dmo/cx_flight_legacy04 IMPLEMENTATION.
METHOD constructor ##ADT_SUPPRESS_GENERATION.
super->constructor( previous = previous ).
me->mv_travel_id = travel_id.
me->mv_booking_id = booking_id.
me->mv_booking_supplement_id = booking_supplement_id.
me->mv_agency_id = agency_id.
me->mv_customer_id = customer_id.
me->mv_carrier_id = carrier_id.
me->mv_connection_id = connection_id.
me->mv_supplement_id = supplement_id.
me->mv_begin_date = begin_date.
me->mv_end_date = end_date.
me->mv_booking_date = booking_date.
me->mv_flight_date = flight_date.
me->mv_status = status.
me->mv_currency_code = currency_code.
me->mv_uname = uname.
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.
| 39.893678 | 74 | 0.655262 |
79b23941ae3de0d9f4eaef6fea20abeedd824c7c | 9,639 | abap | ABAP | src/objects/zcl_abapgit_objects_files.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 1 | 2021-01-21T15:34:26.000Z | 2021-01-21T15:34:26.000Z | src/objects/zcl_abapgit_objects_files.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 1 | 2020-01-05T16:45:32.000Z | 2020-01-05T16:45:32.000Z | src/objects/zcl_abapgit_objects_files.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_objects_files DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
!is_item TYPE zif_abapgit_definitions=>ty_item
!iv_path TYPE string OPTIONAL .
METHODS add_string
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
!iv_string TYPE string
RAISING
zcx_abapgit_exception .
METHODS read_string
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
RETURNING
VALUE(rv_string) TYPE string
RAISING
zcx_abapgit_exception .
METHODS add_xml
IMPORTING
!iv_extra TYPE clike OPTIONAL
!io_xml TYPE REF TO zcl_abapgit_xml_output
!iv_normalize TYPE abap_bool DEFAULT abap_true
!is_metadata TYPE zif_abapgit_definitions=>ty_metadata OPTIONAL
RAISING
zcx_abapgit_exception .
METHODS read_xml
IMPORTING
!iv_extra TYPE clike OPTIONAL
RETURNING
VALUE(ro_xml) TYPE REF TO zcl_abapgit_xml_input
RAISING
zcx_abapgit_exception .
METHODS read_abap
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_error TYPE abap_bool DEFAULT abap_true
RETURNING
VALUE(rt_abap) TYPE abaptxt255_tab
RAISING
zcx_abapgit_exception .
METHODS add_abap
IMPORTING
!iv_extra TYPE clike OPTIONAL
!it_abap TYPE STANDARD TABLE
RAISING
zcx_abapgit_exception .
METHODS add
IMPORTING
!is_file TYPE zif_abapgit_definitions=>ty_file .
METHODS add_raw
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
!iv_data TYPE xstring
RAISING
zcx_abapgit_exception .
METHODS read_raw
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
RETURNING
VALUE(rv_data) TYPE xstring
RAISING
zcx_abapgit_exception .
METHODS get_files
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt .
METHODS set_files
IMPORTING
!it_files TYPE zif_abapgit_definitions=>ty_files_tt .
METHODS get_accessed_files
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_file_signatures_tt .
METHODS contains
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
RETURNING
VALUE(rv_present) TYPE abap_bool.
PROTECTED SECTION.
METHODS read_file
IMPORTING
!iv_filename TYPE string
!iv_error TYPE abap_bool DEFAULT abap_true
RETURNING
VALUE(rv_data) TYPE xstring
RAISING
zcx_abapgit_exception .
METHODS filename
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
RETURNING
VALUE(rv_filename) TYPE string .
PRIVATE SECTION.
DATA ms_item TYPE zif_abapgit_definitions=>ty_item .
DATA mt_accessed_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt .
DATA mt_files TYPE zif_abapgit_definitions=>ty_files_tt .
DATA mv_path TYPE string .
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECTS_FILES IMPLEMENTATION.
METHOD add.
APPEND is_file TO mt_files.
ENDMETHOD.
METHOD add_abap.
DATA: lv_source TYPE string,
ls_file TYPE zif_abapgit_definitions=>ty_file.
CONCATENATE LINES OF it_abap INTO lv_source SEPARATED BY zif_abapgit_definitions=>c_newline.
* when editing files via eg. GitHub web interface it adds a newline at end of file
lv_source = lv_source && zif_abapgit_definitions=>c_newline.
ls_file-path = '/'.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = 'abap' ). "#EC NOTEXT
ls_file-data = zcl_abapgit_convert=>string_to_xstring_utf8( lv_source ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD add_raw.
DATA: ls_file TYPE zif_abapgit_definitions=>ty_file.
ls_file-path = '/'.
ls_file-data = iv_data.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD add_string.
DATA: ls_file TYPE zif_abapgit_definitions=>ty_file.
ls_file-path = '/'.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ). "#EC NOTEXT
ls_file-data = zcl_abapgit_convert=>string_to_xstring_utf8( iv_string ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD add_xml.
DATA: lv_xml TYPE string,
ls_file TYPE zif_abapgit_definitions=>ty_file.
lv_xml = io_xml->render( iv_normalize = iv_normalize
is_metadata = is_metadata ).
ls_file-path = '/'.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = 'xml' ). "#EC NOTEXT
REPLACE FIRST OCCURRENCE
OF REGEX '<\?xml version="1\.0" encoding="[\w-]+"\?>'
IN lv_xml
WITH '<?xml version="1.0" encoding="utf-8"?>'.
ASSERT sy-subrc = 0.
ls_file-data = zcl_abapgit_convert=>string_to_xstring_utf8_bom( lv_xml ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD constructor.
ms_item = is_item.
mv_path = iv_path.
ENDMETHOD.
METHOD contains.
DATA: lv_filename TYPE string.
lv_filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ).
IF mv_path IS NOT INITIAL.
READ TABLE mt_files TRANSPORTING NO FIELDS WITH KEY path = mv_path
filename = lv_filename.
ELSE.
READ TABLE mt_files TRANSPORTING NO FIELDS WITH KEY filename = lv_filename.
ENDIF.
IF sy-subrc = 0.
rv_present = abap_true.
ENDIF.
ENDMETHOD.
METHOD filename.
DATA: lv_obj_name TYPE string.
lv_obj_name = ms_item-obj_name.
IF ms_item-obj_type = 'DEVC'.
" Packages have a fixed filename so that the repository can be installed to a different
" package(-hierarchy) on the client and not show up as a different package in the repo.
lv_obj_name = 'package'.
ENDIF.
IF iv_extra IS INITIAL.
CONCATENATE lv_obj_name '.' ms_item-obj_type
INTO rv_filename. "#EC NOTEXT
ELSE.
CONCATENATE lv_obj_name '.' ms_item-obj_type '.' iv_extra
INTO rv_filename. "#EC NOTEXT
ENDIF.
IF iv_ext IS NOT INITIAL.
CONCATENATE rv_filename '.' iv_ext
INTO rv_filename.
ENDIF.
* handle namespaces
REPLACE ALL OCCURRENCES OF '/' IN rv_filename WITH '#'.
TRANSLATE rv_filename TO LOWER CASE.
ENDMETHOD.
METHOD get_accessed_files.
rt_files = mt_accessed_files.
ENDMETHOD.
METHOD get_files.
rt_files = mt_files.
ENDMETHOD.
METHOD read_abap.
DATA: lv_filename TYPE string,
lv_data TYPE xstring,
lv_abap TYPE string.
lv_filename = filename( iv_extra = iv_extra
iv_ext = 'abap' ). "#EC NOTEXT
lv_data = read_file( iv_filename = lv_filename
iv_error = iv_error ).
IF lv_data IS INITIAL. " Post-handling of iv_error = false
RETURN.
ENDIF.
lv_abap = zcl_abapgit_convert=>xstring_to_string_utf8( lv_data ).
SPLIT lv_abap AT zif_abapgit_definitions=>c_newline INTO TABLE rt_abap.
ENDMETHOD.
METHOD read_file.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF mt_files,
<ls_accessed> LIKE LINE OF mt_accessed_files.
IF mv_path IS NOT INITIAL.
READ TABLE mt_files ASSIGNING <ls_file> WITH KEY path = mv_path
filename = iv_filename.
ELSE.
READ TABLE mt_files ASSIGNING <ls_file> WITH KEY filename = iv_filename.
ENDIF.
IF sy-subrc <> 0.
IF iv_error = abap_true.
zcx_abapgit_exception=>raise( |File not found: { iv_filename }| ).
ELSE.
RETURN.
ENDIF.
ENDIF.
" Update access table
READ TABLE mt_accessed_files TRANSPORTING NO FIELDS
WITH KEY path = <ls_file>-path filename = <ls_file>-filename.
IF sy-subrc > 0. " Not found ? -> Add
APPEND INITIAL LINE TO mt_accessed_files ASSIGNING <ls_accessed>.
MOVE-CORRESPONDING <ls_file> TO <ls_accessed>.
ENDIF.
rv_data = <ls_file>-data.
ENDMETHOD.
METHOD read_raw.
DATA: lv_filename TYPE string.
lv_filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ).
rv_data = read_file( lv_filename ).
ENDMETHOD.
METHOD read_string.
DATA: lv_filename TYPE string,
lv_data TYPE xstring.
lv_filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ). "#EC NOTEXT
lv_data = read_file( lv_filename ).
rv_string = zcl_abapgit_convert=>xstring_to_string_utf8( lv_data ).
ENDMETHOD.
METHOD read_xml.
DATA: lv_filename TYPE string,
lv_data TYPE xstring,
lv_xml TYPE string.
lv_filename = filename( iv_extra = iv_extra
iv_ext = 'xml' ). "#EC NOTEXT
lv_data = read_file( lv_filename ).
lv_xml = zcl_abapgit_convert=>xstring_to_string_utf8( lv_data ).
CREATE OBJECT ro_xml
EXPORTING
iv_xml = lv_xml
iv_filename = lv_filename.
ENDMETHOD.
METHOD set_files.
mt_files = it_files.
ENDMETHOD.
ENDCLASS.
| 25.91129 | 96 | 0.627762 |
79b3dd67e09d7c3bcd77b55d1d7b05e3f5e107f2 | 225 | abap | ABAP | src/unmanaged/#dmo#bp_travel_u22.clas.abap | SAP-Cloud-Platform/flight22 | 8b58c183b68adfc754da273ee6b4bc40c59b688a | [
"BSD-Source-Code"
] | null | null | null | src/unmanaged/#dmo#bp_travel_u22.clas.abap | SAP-Cloud-Platform/flight22 | 8b58c183b68adfc754da273ee6b4bc40c59b688a | [
"BSD-Source-Code"
] | null | null | null | src/unmanaged/#dmo#bp_travel_u22.clas.abap | SAP-Cloud-Platform/flight22 | 8b58c183b68adfc754da273ee6b4bc40c59b688a | [
"BSD-Source-Code"
] | null | null | null | CLASS /dmo/bp_travel_u22 DEFINITION
PUBLIC
ABSTRACT
FINAL
FOR BEHAVIOR OF /dmo/i_travel_u22 .
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS /dmo/bp_travel_u22 IMPLEMENTATION.
ENDCLASS.
| 14.0625 | 40 | 0.764444 |
79b715aa0754f159e810d3fa73609ee3320c1dfa | 5,001 | abap | ABAP | src/zmonsters_p01_enablers/zmonsters_c06_debugger/zds_laughing_monster.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/zds_laughing_monster.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/zds_laughing_monster.prog.abap | hardyp/AbapToTheFuture03 | 5de922d589237142288c099d92655f9811eee4fa | [
"MIT"
] | 17 | 2019-02-28T06:59:06.000Z | 2022-01-12T23:54:57.000Z | *<SCRIPT:PERSISTENT>
REPORT rstpda_script_template.
*<SCRIPT:HEADER>
*<SCRIPTNAME>ZDS_LAUGHING_MONSTER</SCRIPTNAME>
*<SCRIPT_CLASS>LCL_DEBUGGER_SCRIPT</SCRIPT_CLASS>
*<SCRIPT_COMMENT>Laughing Monster Debugger Script</SCRIPT_COMMENT>
*<SINGLE_STEP>X</SINGLE_STEP>
*</SCRIPT:HEADER>
*<SCRIPT:PRESETTINGS>
*</SCRIPT:PRESETTINGS>
*<SCRIPT:SCRIPT_CLASS>
*---------------------------------------------------------------------*
* CLASS lcl_debugger_script DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_debugger_script DEFINITION INHERITING FROM cl_tpda_script_class_super .
PUBLIC SECTION.
METHODS: prologue REDEFINITION,
init REDEFINITION,
script REDEFINITION,
end REDEFINITION.
ENDCLASS. "lcl_debugger_script DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_debugger_script IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_debugger_script IMPLEMENTATION.
METHOD prologue.
*** generate abap_source (source handler for ABAP)
super->prologue( ).
ENDMETHOD. "prolog
METHOD init.
*--------------------------------------------------------------------*
* Listing 06.07 - INIT Method
*--------------------------------------------------------------------*
* Local Variables
DATA(log_header_data) = VALUE bal_s_log(
object = 'MONSTER'
extnumber = '12345' ).
TRY.
"The APPL_LOG object is inherited from the superclass
appl_log = cl_tpda_script_messages=>create_appl_log( log_header_data ).
CATCH cx_tpda_application_log .
"No point going on / Return Control to Debugger
me->break( ).
ENDTRY.
ENDMETHOD. "init
METHOD script.
*--------------------------------------------------------------------*
* Listing 06.08 - SCRIPT Method for Laughing Example
*--------------------------------------------------------------------*
* Local Variables
DATA: current_number TYPE sy-tabix,
variable_name TYPE tpda_var_name,
info_text TYPE char255,
message_type TYPE char01.
* What line are we on?
TRY.
DATA(current_line) = abap_source->line( ).
CATCH cx_tpda_src_info .
RETURN.
CATCH cx_tpda_src_descr_invalidated .
RETURN.
ENDTRY.
* Get Current Variable Values
variable_name = 'CURRENT_NUMBER'.
TRY.
DATA(variable_value) =
cl_tpda_script_data_descr=>get_simple_value( variable_name ).
current_number = variable_value.
CATCH cx_tpda_varname .
RETURN.
CATCH cx_tpda_script_no_simple_type .
RETURN.
ENDTRY.
* Analyse current situation
CASE current_line.
WHEN 29."Laugh Count Changed
info_text = |Laugh trigger { current_number } is supposed to be exactly divisible by 3|.
IF current_number MOD 3 <> 0.
CONCATENATE info_text 'and it is not'
INTO info_text SEPARATED BY space.
message_type = 'E'.
ELSE.
CONCATENATE info_text 'and it is'
INTO info_text SEPARATED BY space.
message_type = 'S'.
ENDIF.
WHEN 33."Lightning Count Changed
info_text = |Lightning trigger { current_number } is supposed to be exactly divisible by 5|.
IF current_number MOD 5 <> 0.
CONCATENATE info_text 'and it is not'
INTO info_text SEPARATED BY space.
message_type = 'E'.
ELSE.
CONCATENATE info_text 'and it is'
INTO info_text SEPARATED BY space.
message_type = 'S'.
ENDIF.
WHEN OTHERS.
RETURN.
ENDCASE.
* Write the information into the application log
TRY.
appl_log->add_message_free_text(
p_mess_type = message_type
p_text = info_text ).
CATCH cx_tpda_application_log .
RETURN.
ENDTRY.
"When done, return control to the real debugger
IF current_number = 10.
me->break( ).
ENDIF.
ENDMETHOD. "script
METHOD end.
*---------------------------------------------------------------------*
* Listing 06.09 - END
*--------------------------------------------------------------------*
*** insert your code which shall be executed at the end of the scripting (before trace is saved)
*** here
TRY.
appl_log->display_log( p_title = 'Laughing Monster Log' ).
CATCH cx_tpda_application_log .
RETURN.
ENDTRY.
ENDMETHOD. "end
ENDCLASS. "lcl_debugger_script IMPLEMENTATION
*</SCRIPT:SCRIPT_CLASS>
*</SCRIPT:PERSISTENT>
| 31.45283 | 100 | 0.519296 |
79b9291ddf3019c5777312dfff6215c9303f2074 | 350 | abap | ABAP | src/legacy/#dmo#flight_travel_api21.fugr.#dmo#flight_travel_initiali_21.abap | SAP-Cloud-Platform/flight21 | 5fbb7d19f08a8bc8fc7de56eb29fef47b313ead4 | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#flight_travel_api21.fugr.#dmo#flight_travel_initiali_21.abap | SAP-Cloud-Platform/flight21 | 5fbb7d19f08a8bc8fc7de56eb29fef47b313ead4 | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#flight_travel_api21.fugr.#dmo#flight_travel_initiali_21.abap | SAP-Cloud-Platform/flight21 | 5fbb7d19f08a8bc8fc7de56eb29fef47b313ead4 | [
"BSD-Source-Code"
] | null | null | null | "! API for Initializing the Transactional Buffer of the Travel API
"!
FUNCTION /DMO/FLIGHT_TRAVEL_INITIALI_21.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------
/dmo/cl_flight_legacy21=>get_instance( )->initialize( ).
ENDFUNCTION.
| 38.888889 | 72 | 0.451429 |
79c3df0661bf93a8b5c1eb672ad85eddf469594e | 8,224 | abap | ABAP | src/legacy/#dmo#tc_flight_travel_api07.clas.abap | SAP-Cloud-Platform/flight07 | 5b1bc28b7fb22b79ebaa946ea1e2a7f35bc412e7 | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#tc_flight_travel_api07.clas.abap | SAP-Cloud-Platform/flight07 | 5b1bc28b7fb22b79ebaa946ea1e2a7f35bc412e7 | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#tc_flight_travel_api07.clas.abap | SAP-Cloud-Platform/flight07 | 5b1bc28b7fb22b79ebaa946ea1e2a7f35bc412e7 | [
"BSD-Source-Code"
] | null | null | null | CLASS /dmo/tc_flight_travel_api07 DEFINITION
PUBLIC
ABSTRACT
CREATE PUBLIC
FOR TESTING
DURATION MEDIUM
RISK LEVEL HARMLESS .
PUBLIC SECTION.
PROTECTED SECTION.
METHODS cuerd_travel FOR TESTING RAISING cx_static_check.
PRIVATE SECTION.
CLASS-DATA gv_agency_id_1 TYPE /dmo/agency_id07.
CLASS-DATA gv_agency_id_2 TYPE /dmo/agency_id07.
CLASS-DATA gv_agency_id_unknown TYPE /dmo/agency_id07.
CLASS-DATA gv_customer_id_1 TYPE /dmo/customer_id07.
CLASS-DATA gv_customer_id_2 TYPE /dmo/customer_id07.
CLASS-DATA gv_customer_id_unknown TYPE /dmo/customer_id07.
CLASS-METHODS class_setup.
ENDCLASS.
CLASS /dmo/tc_flight_travel_api07 IMPLEMENTATION.
METHOD class_setup.
DATA lt_agency_id TYPE SORTED TABLE OF /dmo/agency_id07 WITH UNIQUE KEY table_line.
SELECT DISTINCT agency_id FROM /dmo/agency07 ORDER BY agency_id DESCENDING INTO TABLE @lt_agency_id .
DATA lt_customer_id TYPE SORTED TABLE OF /dmo/customer_id07 WITH UNIQUE KEY table_line.
SELECT DISTINCT customer_id FROM /dmo/customer07 ORDER BY customer_id DESCENDING INTO TABLE @lt_customer_id .
" Select 2 known agency IDs
IF lines( lt_agency_id ) < 2.
cl_abap_unit_assert=>abort( msg = 'No agency data!' ).
ENDIF.
gv_agency_id_1 = lt_agency_id[ 1 ].
gv_agency_id_2 = lt_agency_id[ 2 ].
cl_abap_unit_assert=>assert_differs( act = gv_agency_id_1 exp = gv_agency_id_2 )." To be totally sure
" Select 2 known customer IDs
IF lines( lt_customer_id ) < 2.
cl_abap_unit_assert=>abort( msg = 'No customer data!' ).
ENDIF.
gv_customer_id_1 = lt_customer_id[ 1 ].
gv_customer_id_2 = lt_customer_id[ 2 ].
cl_abap_unit_assert=>assert_differs( act = gv_customer_id_1 exp = gv_customer_id_2 )." To be totally sure
" Determine an unknown agency ID
gv_agency_id_unknown = lt_agency_id[ 1 ].
DO.
gv_agency_id_unknown = gv_agency_id_unknown + 1.
READ TABLE lt_agency_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = gv_agency_id_unknown.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
" Determine an unknown customer ID
gv_customer_id_unknown = lt_customer_id[ 1 ].
DO.
gv_customer_id_unknown = gv_customer_id_unknown + 1.
READ TABLE lt_customer_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = gv_customer_id_unknown.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
ENDMETHOD.
METHOD cuerd_travel.
DATA ls_travel_in TYPE /dmo/if_flight_legacy07=>ts_travel_in.
DATA ls_travel_inx TYPE /dmo/if_flight_legacy07=>ts_travel_inx.
DATA ls_travel TYPE /dmo/travel07.
DATA lt_messages TYPE /dmo/if_flight_legacy07=>tt_message.
" Create Travel and Commit
ls_travel_in-agency_id = gv_agency_id_1.
ls_travel_in-customer_id = gv_customer_id_1.
ls_travel_in-begin_date = '20180101'.
ls_travel_in-end_date = '20180201'.
ls_travel_in-description = 'My Test'.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_CREATE07'
EXPORTING
is_travel = ls_travel_in
IMPORTING
es_travel = ls_travel
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
DATA(lv_travel_id) = ls_travel-travel_id.
cl_abap_unit_assert=>assert_not_initial( lv_travel_id ).
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_SAVE07'.
" DB Check
SELECT SINGLE agency_id, customer_id, description FROM /dmo/travel07 WHERE travel_id = @lv_travel_id INTO ( @DATA(lv_agency_id), @DATA(lv_customer_id), @DATA(lv_description) ).
cl_abap_unit_assert=>assert_subrc( ).
cl_abap_unit_assert=>assert_equals( act = lv_agency_id exp = gv_agency_id_1 ).
cl_abap_unit_assert=>assert_equals( act = lv_customer_id exp = gv_customer_id_1 ).
cl_abap_unit_assert=>assert_equals( act = lv_description exp = 'My Test' ).
" Update
CLEAR ls_travel_in.
ls_travel_in-travel_id = lv_travel_id.
ls_travel_in-agency_id = gv_agency_id_2.
ls_travel_in-customer_id = gv_customer_id_2.
ls_travel_in-description = 'My New Test'.
ls_travel_inx-travel_id = lv_travel_id.
ls_travel_inx-agency_id = abap_true.
ls_travel_inx-customer_id = abap_true.
ls_travel_inx-description = abap_true.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_UPDATE07'
EXPORTING
is_travel = ls_travel_in
is_travelx = ls_travel_inx
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
" Action
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_SET_BOOK_07'
EXPORTING
iv_travel_id = lv_travel_id
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
" Faulty Update - All or Nothing -> Nothing
CLEAR ls_travel_in.
ls_travel_in-travel_id = lv_travel_id.
ls_travel_in-agency_id = gv_agency_id_unknown.
ls_travel_in-customer_id = gv_customer_id_1.
ls_travel_inx-travel_id = lv_travel_id.
ls_travel_inx-agency_id = abap_true.
ls_travel_inx-customer_id = abap_true.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_UPDATE07'
EXPORTING
is_travel = ls_travel_in
is_travelx = ls_travel_inx
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_not_initial( lt_messages ).
" Faulty Update - All or Nothing -> Nothing
CLEAR lt_messages.
CLEAR ls_travel_in.
ls_travel_in-travel_id = lv_travel_id.
ls_travel_in-agency_id = gv_agency_id_1.
ls_travel_in-customer_id = gv_customer_id_unknown.
ls_travel_inx-travel_id = lv_travel_id.
ls_travel_inx-agency_id = abap_true.
ls_travel_inx-customer_id = abap_true.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_UPDATE07'
EXPORTING
is_travel = ls_travel_in
is_travelx = ls_travel_inx
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_not_initial( lt_messages ).
" Read DB only
CLEAR ls_travel.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_READ07'
EXPORTING
iv_travel_id = lv_travel_id
iv_include_buffer = abap_false
IMPORTING
es_travel = ls_travel
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-travel_id exp = lv_travel_id ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-agency_id exp = gv_agency_id_1 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-customer_id exp = gv_customer_id_1 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-status exp = CONV /dmo/travel_status07( /dmo/if_flight_legacy07=>travel_status-new ) ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-description exp = 'My Test' ).
" Read with buffer
CLEAR ls_travel.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_READ07'
EXPORTING
iv_travel_id = lv_travel_id
iv_include_buffer = abap_true
IMPORTING
es_travel = ls_travel
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-travel_id exp = lv_travel_id ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-agency_id exp = gv_agency_id_2 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-customer_id exp = gv_customer_id_2 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-status exp = CONV /dmo/travel_status07( /dmo/if_flight_legacy07=>travel_status-booked ) ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-description exp = 'My New Test' ).
" Delete
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_DELETE07'
EXPORTING
iv_travel_id = lv_travel_id
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
" Delete again -> Error
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_DELETE07'
EXPORTING
iv_travel_id = lv_travel_id
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_not_initial( lt_messages ).
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_SAVE07'.
ENDMETHOD.
ENDCLASS.
| 38.792453 | 180 | 0.714859 |
79c7d4ab2f70338aafa1ac37fd4e4a79fe4d108a | 1,274 | abap | ABAP | src/zif_abapgit_sap_package.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/zif_abapgit_sap_package.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/zif_abapgit_sap_package.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_sap_package
PUBLIC .
TYPES:
ty_devclass_tt TYPE STANDARD TABLE OF devclass WITH DEFAULT KEY .
METHODS create
IMPORTING
!is_package TYPE scompkdtln
RAISING
zcx_abapgit_exception .
METHODS create_local
RAISING
zcx_abapgit_exception .
METHODS list_subpackages
RETURNING
VALUE(rt_list) TYPE ty_devclass_tt .
METHODS list_superpackages
RETURNING
VALUE(rt_list) TYPE ty_devclass_tt
RAISING
zcx_abapgit_exception .
METHODS read_parent
RETURNING
VALUE(rv_parentcl) TYPE tdevc-parentcl
RAISING
zcx_abapgit_exception .
METHODS create_child
IMPORTING
!iv_child TYPE devclass
RAISING
zcx_abapgit_exception .
METHODS exists
RETURNING
VALUE(rv_bool) TYPE abap_bool .
METHODS are_changes_recorded_in_tr_req
RETURNING
VALUE(rv_are_changes_rec_in_tr_req) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS get_transport_type
RETURNING
VALUE(rs_transport_type) TYPE zif_abapgit_definitions=>ty_transport_type
RAISING
zcx_abapgit_exception .
METHODS get_transport_layer
RETURNING
VALUE(rv_transport_layer) TYPE devlayer
RAISING
zcx_abapgit_exception .
ENDINTERFACE.
| 24.037736 | 78 | 0.739403 |
79c957b53dfc799be42830997b08abd109abee3e | 5,060 | abap | ABAP | clean_code_main/clean_code_foundation/y_test_code_detector.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | clean_code_main/clean_code_foundation/y_test_code_detector.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | clean_code_main/clean_code_foundation/y_test_code_detector.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | CLASS ltd_ref_scan_manager_test DEFINITION FOR TESTING INHERITING FROM y_scan_manager_double.
PUBLIC SECTION.
METHODS:
set_data_without_test,
set_data_with_test.
ENDCLASS.
CLASS ltd_ref_scan_manager_test IMPLEMENTATION.
METHOD set_data_without_test.
inject_code( VALUE #(
( 'REPORT lcl_test.' )
( 'CLASS lcl_classname DEFINITION.' )
( ' PUBLIC SECTION.' )
( ' METHODS methodname.' )
( ' DATA itest TYPE i.' )
( 'ENDCLASS.' )
( 'CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD methodname.' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
) ).
ENDMETHOD.
METHOD set_data_with_test.
inject_code( VALUE #(
( 'REPORT lcl_test.' )
( 'CLASS lcl_classname DEFINITION FOR TESTING.' )
( ' PUBLIC SECTION.' )
( ' METHODS methodname.' )
( ' DATA itest TYPE i.' )
( 'ENDCLASS.' )
( 'CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD methodname.' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
) ).
ENDMETHOD.
ENDCLASS.
CLASS ltc_test_code_detector DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
DATA: cut TYPE REF TO y_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 y_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( ).
LOOP AT ref_scan_manager_double->y_if_scan_manager~get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
FROM 2 WHERE stmnt_type EQ scan_struc_stmnt_type-class_definition.
cl_abap_unit_assert=>assert_equals(
act = cut->y_if_testcode_detector~is_testcode( <structure> )
exp = abap_false ).
EXIT.
ENDLOOP.
ENDMETHOD.
METHOD is_test_class_yes.
ref_scan_manager_double->set_data_with_test( ).
LOOP AT ref_scan_manager_double->y_if_scan_manager~get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
FROM 2 WHERE stmnt_type EQ scan_struc_stmnt_type-class_definition.
cl_abap_unit_assert=>assert_equals(
act = cut->y_if_testcode_detector~is_testcode( <structure> )
exp = abap_true ).
EXIT.
ENDLOOP.
ENDMETHOD.
METHOD is_test_method_no.
ref_scan_manager_double->set_data_without_test( ).
LOOP AT ref_scan_manager_double->y_if_scan_manager~get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
FROM 2 WHERE stmnt_type EQ scan_struc_stmnt_type-method.
cl_abap_unit_assert=>assert_equals(
act = cut->y_if_testcode_detector~is_testcode( <structure> )
exp = abap_false ).
ENDLOOP.
ENDMETHOD.
METHOD is_test_method_yes.
ref_scan_manager_double->set_data_with_test( ).
LOOP AT ref_scan_manager_double->y_if_scan_manager~get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
FROM 2 WHERE stmnt_type EQ scan_struc_stmnt_type-method.
cl_abap_unit_assert=>assert_equals(
act = cut->y_if_testcode_detector~is_testcode( <structure> )
exp = abap_true ).
ENDLOOP.
ENDMETHOD.
METHOD is_if_in_test_code_yes.
ref_scan_manager_double->set_data_with_test( ).
LOOP AT ref_scan_manager_double->y_if_scan_manager~get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
FROM 2 WHERE stmnt_type EQ scan_struc_stmnt_type-class_definition.
cl_abap_unit_assert=>assert_equals(
act = cut->y_if_testcode_detector~is_testcode( <structure> )
exp = abap_true ).
ENDLOOP.
ENDMETHOD.
METHOD is_test_attribute_no.
ref_scan_manager_double->set_data_without_test( ).
LOOP AT ref_scan_manager_double->y_if_scan_manager~get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
FROM 2 WHERE stmnt_type EQ scan_struc_stmnt_type-class_definition.
cl_abap_unit_assert=>assert_equals(
act = cut->y_if_testcode_detector~is_testcode( <structure> )
exp = abap_false ).
ENDLOOP.
ENDMETHOD.
METHOD is_test_attribute_yes.
ref_scan_manager_double->set_data_with_test( ).
LOOP AT ref_scan_manager_double->y_if_scan_manager~get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
FROM 2 WHERE stmnt_type EQ scan_struc_stmnt_type-class_definition.
cl_abap_unit_assert=>assert_equals(
act = cut->y_if_testcode_detector~is_testcode( <structure> )
exp = abap_true ).
ENDLOOP.
ENDMETHOD.
ENDCLASS.
| 30.119048 | 108 | 0.709684 |
79ccbfb94e70a1a53a372bc5074a631eb2a7a57e | 2,132 | abap | ABAP | src/zca_umdi_r_uml_diagram.prog.abap | irodrigob/uml_diagram | cd7c1e66ead68a3f2b93fbd9015986ac0c3c7c9a | [
"MIT"
] | null | null | null | src/zca_umdi_r_uml_diagram.prog.abap | irodrigob/uml_diagram | cd7c1e66ead68a3f2b93fbd9015986ac0c3c7c9a | [
"MIT"
] | null | null | null | src/zca_umdi_r_uml_diagram.prog.abap | irodrigob/uml_diagram | cd7c1e66ead68a3f2b93fbd9015986ac0c3c7c9a | [
"MIT"
] | null | null | null | *&---------------------------------------------------------------------*
*& Report ZCA_UMDI_R_UML_DIAGRAM
*&---------------------------------------------------------------------*
*& Description: Generate the UML diagram according to the objects entered on the screen
* & Author: Iván Rodrigo - 30/09/2019
*&---------------------------------------------------------------------*
REPORT zca_umdi_r_uml_diagram MESSAGE-ID zca_umdi.
INCLUDE zca_umdi_r_uml_diagram_top.
*----------------------------------------------------------------------*
* Selection Screen
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
SELECT-OPTIONS: s_pack FOR mv_package,
s_class FOR mv_object MATCHCODE OBJECT seo_classes_interfaces,
s_intf FOR mv_object MATCHCODE OBJECT seo_classes_interfaces,
s_report FOR mv_report.
SELECTION-SCREEN END OF BLOCK bl1.
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE TEXT-t02.
PARAMETERS p_yuml AS CHECKBOX USER-COMMAND yuml.
SELECTION-SCREEN BEGIN OF BLOCK blyuml WITH FRAME TITLE TEXT-t03.
PARAMETERS: p_ycode RADIOBUTTON GROUP g1 MODIF ID yum,
p_yhtml RADIOBUTTON GROUP g1 MODIF ID yum.
SELECTION-SCREEN END OF BLOCK blyuml.
SELECTION-SCREEN END OF BLOCK bl2.
INCLUDE zca_umdi_r_uml_diagram_c01.
AT SELECTION-SCREEN OUTPUT.
lcl_contr=>handle_pbo( ).
*----------------------------------------------------------------------*
* Start of selection
*----------------------------------------------------------------------*
START-OF-SELECTION.
" Se instancia el controlador local para la gestion de todos los procesos.
DATA(lo_contr) = NEW lcl_contr( ).
" Búsqueda de datos
lo_contr->search( ).
*----------------------------------------------------------------------*
* End of selection
*----------------------------------------------------------------------*
END-OF-SELECTION.
lo_contr->show_data( IMPORTING ev_no_data = DATA(lv_no_data) ).
IF lv_no_data = abap_true.
MESSAGE TEXT-s01 TYPE zif_ca_umdi_data=>cs_message-types-success.
ENDIF.
| 38.071429 | 87 | 0.527205 |
79cd0e40c31b6ba90f4ad9ec58dc5c5bc07ad25b | 25,078 | abap | ABAP | zrstpda_object_visualizer.prog.abap | nomssi/ABAP-Object-Visualizer | f70086361e1c30819957f06c16643dd27c0daec8 | [
"MIT"
] | 57 | 2015-09-25T03:06:48.000Z | 2022-03-01T02:25:40.000Z | zrstpda_object_visualizer.prog.abap | nomssi/ABAP-Object-Visualizer | f70086361e1c30819957f06c16643dd27c0daec8 | [
"MIT"
] | 9 | 2015-09-12T13:54:57.000Z | 2020-11-25T08:28:30.000Z | zrstpda_object_visualizer.prog.abap | nomssi/ABAP-Object-Visualizer | f70086361e1c30819957f06c16643dd27c0daec8 | [
"MIT"
] | 10 | 2016-06-20T13:01:06.000Z | 2021-09-25T05:20:12.000Z | *<SCRIPT:PERSISTENT>
REPORT zrstpda_object_visualizer.
*<SCRIPT:HEADER>
*<SCRIPTNAME>ZRSTPDA_OBJECT_VISUALIZER</SCRIPTNAME>
*<SCRIPT_CLASS>LCL_DEBUGGER_SCRIPT</SCRIPT_CLASS>
*<SCRIPT_COMMENT>ABAP Object Visualizer</SCRIPT_COMMENT>
*<SINGLE_RUN>X</SINGLE_RUN>
*</SCRIPT:HEADER>
*<SCRIPT:PRESETTINGS>
*</SCRIPT:PRESETTINGS>
*<SCRIPT:SCRIPT_CLASS>
* See https://github.com/larshp/ABAP-Object-Visualizer
********************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2015 Lars Hvam Petersen
* Copyright (c) 2020 Jacques Nomssi Nzali
*
* 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.
********************************************************************************
CONSTANTS:
c_mode_aut TYPE char01 VALUE 'T', " for ABAP Unit Test
c_mode_url TYPE char01 VALUE 'U',
c_mode_txt TYPE char01 VALUE space.
CONSTANTS c_plantuml_server TYPE string
VALUE 'http://www.plantuml.com/plantuml/img/' ##NO_TEXT.
TYPES tv_scale TYPE perct.
CONSTANTS c_default_scale TYPE tv_scale VALUE '0.7'.
TYPES: BEGIN OF ts_diagram_config,
local_path TYPE string,
java_jar TYPE string,
java_appl TYPE string,
server_url TYPE string,
output_mode TYPE char01,
skip_dialog TYPE flag,
scale TYPE tv_scale,
shadowing TYPE flag,
display_source TYPE flag,
hpages TYPE sytabix,
vpages TYPE sytabix,
END OF ts_diagram_config.
CLASS lcl_file_name DEFINITION.
PUBLIC SECTION.
CLASS-METHODS new IMPORTING iv_mode TYPE char01
RETURNING VALUE(ro_file) TYPE REF TO lcl_file_name.
METHODS constructor IMPORTING iv_mode TYPE char01.
METHODS dialog RETURNING VALUE(rv_user_action) TYPE i.
METHODS get_prefix RETURNING VALUE(rv_name) TYPE string
RAISING cx_dynamic_check.
METHODS get_fullpath RETURNING VALUE(rv_name) TYPE string.
PROTECTED SECTION.
TYPES: BEGIN OF ts_fullpath,
title TYPE string,
name TYPE string,
ext TYPE string,
path TYPE string,
filter TYPE string,
END OF ts_fullpath.
DATA ms_file TYPE ts_fullpath.
ENDCLASS.
*----------------------------------------------------------------------*
* CLASS lcl_plant_uml DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_plant_uml DEFINITION.
PUBLIC SECTION.
METHODS constructor IMPORTING iv_diagram TYPE string.
METHODS to_url IMPORTING iv_base_url TYPE string DEFAULT c_plantuml_server
RETURNING VALUE(rv_url) TYPE string
RAISING cx_dynamic_check.
METHODS output IMPORTING is_cfg TYPE ts_diagram_config RAISING cx_dynamic_check.
PROTECTED SECTION.
TYPES tv_base64 TYPE c LENGTH 65.
CONSTANTS:
c_standard TYPE tv_base64 VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' ##NO_TEXT,
c_plantuml TYPE tv_base64 VALUE '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0' ##NO_TEXT.
DATA mv_diagram TYPE string.
METHODS to_xstring IMPORTING iv_string TYPE string
RETURNING VALUE(rv_xstring) TYPE xstring
RAISING cx_dynamic_check.
METHODS source IMPORTING iv_display_source TYPE flag
RETURNING VALUE(rv_source) TYPE string.
METHODS png_file_name IMPORTING io_name TYPE REF TO lcl_file_name
is_cfg TYPE ts_diagram_config
RETURNING VALUE(rv_name) TYPE string.
METHODS parameter_string IMPORTING io_name TYPE REF TO lcl_file_name
is_cfg TYPE ts_diagram_config
RETURNING VALUE(rv_param) TYPE string.
METHODS show_html IMPORTING iv_html TYPE string
iv_size TYPE string DEFAULT cl_abap_browser=>xlarge
RAISING cx_dynamic_check.
METHODS to_png IMPORTING io_name TYPE REF TO lcl_file_name
is_cfg TYPE ts_diagram_config
RETURNING VALUE(rv_name) TYPE string.
ENDCLASS.
*----------------------------------------------------------------------*
* CLASS lcl_file DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_file DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
CONSTANTS:
c_mode_txt TYPE char01 VALUE space,
c_mode_png TYPE char01 VALUE 'P'.
CLASS-METHODS download
IMPORTING iv_data TYPE xstring
io_name TYPE REF TO lcl_file_name
RETURNING VALUE(rv_subrc) TYPE sysubrc.
ENDCLASS. "lcl_file DEFINITION
CLASS lcl_file_name_dummy DEFINITION INHERITING FROM lcl_file_name.
PUBLIC SECTION.
METHODS dialog REDEFINITION.
ENDCLASS.
*---------------------------------------------------------------------*
* CLASS lcl_debugger_script DEFINITION
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
CLASS lcl_debugger_script DEFINITION
INHERITING FROM cl_tpda_script_class_super FINAL ##NEEDED.
PUBLIC SECTION.
METHODS:
script REDEFINITION.
PRIVATE SECTION.
CONSTANTS: c_newline
LIKE cl_abap_char_utilities=>newline
VALUE cl_abap_char_utilities=>newline.
DATA: mt_visited TYPE TABLE OF string,
mv_graph TYPE string.
METHODS:
popup
RETURNING VALUE(rv_name) TYPE string,
to_clipboard,
to_plantuml
IMPORTING iv_diagram TYPE string,
name
IMPORTING iv_name TYPE string
RETURNING VALUE(rv_name) TYPE string,
handle_tab
IMPORTING iv_name TYPE string
io_descr TYPE REF TO cl_tpda_script_data_descr
RAISING cx_tpda,
handle_object
IMPORTING iv_name TYPE string
io_descr TYPE REF TO cl_tpda_script_data_descr
RAISING cx_tpda,
handle_objref
IMPORTING iv_name TYPE string
RAISING cx_tpda,
handle_string
IMPORTING iv_name TYPE string
io_descr TYPE REF TO cl_tpda_script_data_descr
RAISING cx_tpda,
handle_simple
IMPORTING iv_name TYPE string
io_descr TYPE REF TO cl_tpda_script_data_descr
RAISING cx_tpda,
handle_struct
IMPORTING iv_name TYPE string
io_descr TYPE REF TO cl_tpda_script_data_descr
RAISING cx_tpda,
handle_dataref
IMPORTING !iv_name TYPE string
io_descr TYPE REF TO cl_tpda_script_data_descr
RAISING
cx_tpda ,
handle
IMPORTING iv_name TYPE string
RAISING cx_tpda.
ENDCLASS. "lcl_debugger_script DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_debugger_script IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_debugger_script IMPLEMENTATION.
METHOD popup.
DATA: lv_returncode TYPE c,
lt_fields TYPE TABLE OF sval.
APPEND VALUE #( tabname = 'ABAPTXT255'
fieldname = 'LINE'
fieldtext = 'Object'(002)
field_obl = abap_true
value = 'GO_CLASS' ) TO lt_fields.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
popup_title = 'Choose object'(005)
IMPORTING
returncode = lv_returncode
TABLES
fields = lt_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 2.
IF sy-subrc <> 0 OR lv_returncode = 'A'.
RETURN.
ENDIF.
rv_name = to_upper( VALUE #( lt_fields[ 1 ]-value OPTIONAL ) ).
ENDMETHOD.
METHOD handle_simple.
DATA: lo_elem TYPE REF TO cl_tpda_script_elemdescr,
lv_value TYPE string.
lo_elem ?= io_descr.
lv_value = lo_elem->value( ).
REPLACE ALL OCCURRENCES OF c_newline IN lv_value WITH space.
mv_graph = |{ mv_graph }"{ name( iv_name ) }" [{ c_newline
}label = "{ lv_value }"{ c_newline
}shape = "record" ];{ c_newline }|.
ENDMETHOD.
METHOD handle_struct.
DATA: lv_label TYPE string,
lv_edges TYPE string,
lv_name TYPE string,
lt_components TYPE tpda_script_struc_componentsit,
lo_struct TYPE REF TO cl_tpda_script_structdescr,
lv_match_offset TYPE i.
lo_struct ?= io_descr.
lo_struct->components( IMPORTING p_components_it = lt_components ).
FIND REGEX '\*$' IN iv_name MATCH OFFSET lv_match_offset.
lv_label = 'Structure'(004).
LOOP AT lt_components ASSIGNING FIELD-SYMBOL(<ls_component>).
lv_label = |{ lv_label } \|<f{ sy-tabix }> { name( <ls_component>-compname ) }\\{ c_newline }|.
IF lv_match_offset = 0.
lv_name = |{ iv_name }-{ <ls_component>-compname }|.
ELSE.
lv_name = |{ iv_name(lv_match_offset) }{ <ls_component>-compname }|.
ENDIF.
lv_edges = |{ lv_edges }"{ name( iv_name ) }":<f{ sy-tabix }> -> "{ name( lv_name ) }";{ c_newline }|.
handle( lv_name ).
ENDLOOP.
mv_graph = |{ mv_graph }"{ name( iv_name ) }" [{ c_newline
}label = "{ lv_label }"{ c_newline
}shape = "record" ];{ c_newline
}{ lv_edges }|.
ENDMETHOD.
METHOD name.
rv_name = iv_name.
REPLACE ALL OCCURRENCES OF:
'{' IN rv_name WITH '\{',
'}' IN rv_name WITH '\}'.
ENDMETHOD.
METHOD handle_tab.
DATA: lv_name TYPE string,
lv_label TYPE string,
lv_edges TYPE string,
lo_table TYPE REF TO cl_tpda_script_tabledescr.
lo_table ?= io_descr.
lv_label = 'Table'(001).
DO lo_table->linecnt( ) TIMES.
lv_name = |{ iv_name }[{ sy-index }]|.
lv_label = |{ lv_label } \|<f{ sy-index }> { sy-index }\\{ c_newline }|.
lv_edges = |{ lv_edges }"{ name( iv_name ) }":<f{ sy-index
}> -> "{ name( lv_name ) }";{ c_newline }|.
handle( lv_name ).
ENDDO.
mv_graph = |{ mv_graph }"{ name( iv_name ) }" [{ c_newline
}label = "{ lv_label }"{ c_newline
}shape = "record" ];{ c_newline
}{ lv_edges }|.
ENDMETHOD.
METHOD handle_object.
DATA: lo_object TYPE REF TO cl_tpda_script_objectdescr,
lv_name TYPE string,
lv_label TYPE string,
lv_color TYPE string,
lv_edges TYPE string,
lv_type TYPE string,
lt_attributes TYPE tpda_script_object_attribut_it.
lo_object ?= io_descr.
lt_attributes = lo_object->attributes( ).
lv_label = 'Object'(002).
LOOP AT lt_attributes ASSIGNING FIELD-SYMBOL(<ls_attribute>).
lv_label = |{ lv_label } \|<f{ sy-tabix }> { name( <ls_attribute>-name ) }\\{ c_newline }|.
CONCATENATE iv_name '-' <ls_attribute>-name INTO lv_name.
CASE <ls_attribute>-acckind.
WHEN if_tpda_control=>ak_private.
lv_color = 'red'.
lv_type = 'private'.
WHEN if_tpda_control=>ak_protected.
lv_color = 'yellow'.
lv_type = 'protected'.
WHEN if_tpda_control=>ak_public.
lv_color = 'green'.
lv_type = 'public'.
WHEN OTHERS.
ASSERT 1 = 1 + 1.
ENDCASE.
lv_edges = |{ lv_edges }"{ name( iv_name ) }":<f{ sy-tabix
}> -> "{ name( lv_name ) }" [fontcolor={ lv_color
} label="{ lv_type }"];{ c_newline }|.
handle( lv_name ).
ENDLOOP.
mv_graph = |{ mv_graph }"{ name( iv_name ) }" [{ c_newline
}label = "{ lv_label }"{ c_newline
}shape = "record" ];{ c_newline
}{ lv_edges }|.
ENDMETHOD.
METHOD handle_objref.
DATA: ls_info TYPE tpda_scr_quick_info,
lv_label TYPE string.
FIELD-SYMBOLS: <ls_symobjref> TYPE tpda_sys_symbobjref.
ls_info = cl_tpda_script_data_descr=>get_quick_info( iv_name ).
ASSIGN ls_info-quickdata->* TO <ls_symobjref>.
IF <ls_symobjref>-instancename <> '{O:initial}'.
handle( <ls_symobjref>-instancename ).
ENDIF.
IF iv_name CA '{'.
lv_label = 'ref'.
ELSE.
lv_label = iv_name.
ENDIF.
mv_graph = |{ mv_graph }"{ name( iv_name ) }" [{ c_newline
}label = "{ lv_label }"{ c_newline
}shape = "record" ];{ c_newline
}"{ name( iv_name ) }" -> "{ name( <ls_symobjref>-instancename ) }";{ c_newline
}|.
ENDMETHOD.
METHOD handle_string.
DATA: lo_string TYPE REF TO cl_tpda_script_stringdescr,
lv_value TYPE string.
lo_string ?= io_descr.
lv_value = lo_string->value( ).
REPLACE ALL OCCURRENCES OF c_newline IN lv_value WITH space.
mv_graph = |{ mv_graph }"{ name( iv_name ) }" [{ c_newline
}label = "'{ lv_value }'"{ c_newline
}shape = "record" ];{ c_newline }|.
ENDMETHOD.
METHOD handle_dataref.
DATA: ls_info TYPE tpda_scr_quick_info.
FIELD-SYMBOLS: <ls_symobjref> TYPE tpda_sys_symbdatref.
ls_info = cl_tpda_script_data_descr=>get_quick_info( iv_name ).
ASSIGN ls_info-quickdata->* TO <ls_symobjref>.
FIND REGEX '^\{[A-Z]:initial\}$' IN <ls_symobjref>-instancename IGNORING CASE.
IF sy-subrc <> 0.
handle( <ls_symobjref>-instancename ).
ENDIF.
mv_graph = |{ mv_graph }"{ name( iv_name ) }" [{ c_newline
}label = "ref"{ c_newline
}shape = "record" ];{ c_newline
}"{ name( iv_name ) }" -> "{ name( <ls_symobjref>-instancename ) }";{ c_newline }|.
ENDMETHOD.
METHOD script.
DATA: lv_name TYPE string,
lx_tpda TYPE REF TO cx_tpda.
TRY.
lv_name = popup( ).
IF lv_name IS INITIAL.
RETURN.
ENDIF.
CLEAR mt_visited.
handle( lv_name ).
mv_graph = |digraph g \{{ c_newline
}graph [{ c_newline
}rankdir = "LR"{ c_newline
}];{ c_newline
}{ mv_graph }{ c_newline
}\}|.
to_plantuml( |@startdot\n{ mv_graph }\n@enddot| ).
to_clipboard( ).
CATCH cx_tpda_varname.
MESSAGE 'Unknown variable'(006) TYPE 'I'.
CATCH cx_tpda INTO lx_tpda.
MESSAGE lx_tpda TYPE 'I'.
ENDTRY.
ENDMETHOD.
METHOD handle.
DATA: ls_info TYPE tpda_scr_quick_info,
lo_descr TYPE REF TO cl_tpda_script_data_descr.
TRY.
READ TABLE mt_visited FROM iv_name TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
RETURN.
ENDIF.
APPEND iv_name TO mt_visited.
lo_descr = cl_tpda_script_data_descr=>factory( iv_name ).
ls_info = cl_tpda_script_data_descr=>get_quick_info( iv_name ).
CASE ls_info-metatype.
WHEN cl_tpda_script_data_descr=>mt_simple.
handle_simple( iv_name = iv_name
io_descr = lo_descr ).
WHEN cl_tpda_script_data_descr=>mt_struct.
handle_struct( iv_name = iv_name
io_descr = lo_descr ).
WHEN cl_tpda_script_data_descr=>mt_string.
handle_string( iv_name = iv_name
io_descr = lo_descr ).
WHEN cl_tpda_script_data_descr=>mt_tab.
handle_tab( iv_name = iv_name
io_descr = lo_descr ).
WHEN cl_tpda_script_data_descr=>mt_datref.
handle_dataref( iv_name = iv_name
io_descr = lo_descr ).
WHEN cl_tpda_script_data_descr=>mt_object.
handle_object( iv_name = iv_name
io_descr = lo_descr ).
WHEN cl_tpda_script_data_descr=>mt_objref.
handle_objref( iv_name ).
ENDCASE.
CATCH cx_root.
ASSERT 1 = 1 + 1.
ENDTRY.
ENDMETHOD. "script
METHOD to_clipboard.
DATA: lt_table TYPE STANDARD TABLE OF abaptxt255 ##NEEDED,
lv_rc TYPE i.
SPLIT mv_graph AT c_newline INTO TABLE lt_table.
cl_gui_frontend_services=>clipboard_export(
IMPORTING
data = lt_table
CHANGING
rc = lv_rc
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
no_authority = 4
OTHERS = 5 ). "#EC CI_SUBRC
ASSERT sy-subrc = 0.
MESSAGE 'Exported to clipboard'(003) TYPE 'I'.
ENDMETHOD.
METHOD to_plantuml.
DATA ls_cfg TYPE ts_diagram_config.
ls_cfg-scale = c_default_scale.
ls_cfg-server_url = c_plantuml_server.
ls_cfg-hpages = 1.
ls_cfg-vpages = 1.
ls_cfg-output_mode = c_mode_url.
NEW lcl_plant_uml( iv_diagram )->output( ls_cfg ).
ENDMETHOD.
ENDCLASS. "lcl_debugger_script IMPLEMENTATION
*----------------------------------------------------------------------*
* CLASS lcl_plant_uml IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_plant_uml IMPLEMENTATION.
METHOD constructor.
mv_diagram = iv_diagram.
ENDMETHOD. "constructor
METHOD source.
CLEAR rv_source.
CHECK iv_display_source EQ abap_true.
rv_source = |<p>{ mv_diagram }</p>|.
ENDMETHOD.
METHOD show_html.
cl_abap_browser=>show_html( html_string = iv_html
size = iv_size
context_menu = abap_true ).
ENDMETHOD.
METHOD output.
CASE is_cfg-output_mode.
WHEN c_mode_url.
show_html( |<img src="{ to_url( ) }"/>\n{ source( is_cfg-display_source ) }| ).
WHEN OTHERS.
* export data as PlantUML source
lcl_file=>download( io_name = lcl_file_name=>new( is_cfg-output_mode )
iv_data = to_xstring( mv_diagram ) ).
ENDCASE.
ENDMETHOD. "output
METHOD to_url.
DATA lv_bin TYPE xstring.
* for PlantUML Server: Convert to UTF-8, then deflate, then encode (base64 variant)
cl_abap_gzip=>compress_binary(
EXPORTING
raw_in = to_xstring( mv_diagram ) " UTF-8
compress_level = 9
IMPORTING
gzip_out = lv_bin ).
rv_url = iv_base_url &&
translate( val = cl_http_utility=>encode_x_base64( lv_bin )
from = c_standard
to = c_plantuml ).
ENDMETHOD. "to_url
METHOD to_xstring.
cl_abap_conv_out_ce=>create( encoding = 'UTF-8' )->convert( EXPORTING data = iv_string
IMPORTING buffer = rv_xstring ).
ENDMETHOD. "to_xstring
METHOD parameter_string.
rv_param = |-jar { is_cfg-java_jar } -o { is_cfg-local_path } "{ io_name->get_fullpath( ) }"|.
ENDMETHOD.
METHOD png_file_name.
TRY.
rv_name = |{ is_cfg-local_path }{ io_name->get_prefix( ) }.png|.
CATCH cx_dynamic_check.
CLEAR rv_name.
ENDTRY.
ENDMETHOD.
METHOD to_png.
CLEAR rv_name.
cl_gui_frontend_services=>execute(
EXPORTING application = is_cfg-java_appl
parameter = parameter_string( io_name = io_name
is_cfg = is_cfg )
synchronous = 'X'
EXCEPTIONS OTHERS = 1 ).
CHECK sy-subrc EQ 0.
rv_name = png_file_name( io_name = io_name
is_cfg = is_cfg ).
ENDMETHOD.
ENDCLASS. "lcl_plant_uml IMPLEMENTATION
CLASS lcl_file_name_dummy IMPLEMENTATION.
METHOD dialog.
ms_file-path = |test.txt|.
rv_user_action = cl_gui_frontend_services=>action_cancel.
ENDMETHOD.
ENDCLASS.
*----------------------------------------------------------------------*
* CLASS lcl_file IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_file IMPLEMENTATION.
METHOD download.
rv_subrc = 1.
CHECK io_name->dialog( ) NE cl_gui_frontend_services=>action_cancel.
rv_subrc = cl_uml_utilities=>save_xml_local( xml = iv_data
filename = io_name->get_fullpath( ) ).
ENDMETHOD.
ENDCLASS. "lcl_file IMPLEMENTATION
CLASS lcl_file_name IMPLEMENTATION.
METHOD new.
CASE iv_mode.
WHEN c_mode_aut.
ro_file = NEW lcl_file_name_dummy( iv_mode ).
WHEN OTHERS.
ro_file = NEW lcl_file_name( iv_mode ).
ENDCASE.
ENDMETHOD.
METHOD constructor.
CASE iv_mode.
WHEN c_mode_txt.
ms_file = VALUE #( title = |Save UML text source|
ext = |.txt| ).
WHEN OTHERS.
ms_file = VALUE #( title = |Save As...|
ext = |.txt| ).
ENDCASE.
ENDMETHOD.
METHOD get_prefix.
rv_name = shift_right( val = ms_file-name
places = strlen( ms_file-ext ) ).
ENDMETHOD.
METHOD get_fullpath.
rv_name = ms_file-path.
ENDMETHOD.
METHOD dialog.
DATA lv_path TYPE string ##needed.
CLEAR rv_user_action.
cl_gui_frontend_services=>file_save_dialog(
EXPORTING
window_title = ms_file-title " Window Title
default_extension = ms_file-ext " Default Extension
file_filter = ms_file-filter
CHANGING
filename = ms_file-name " File Name to Save
path = lv_path " Path to File
fullpath = ms_file-path " Path + File Name
user_action = rv_user_action
" User Action (C Class Const ACTION_OK, ACTION_OVERWRITE etc)
* file_encoding =
EXCEPTIONS
OTHERS = 0 ).
ENDMETHOD.
ENDCLASS.
| 35.02514 | 121 | 0.534971 |
79cdd5e1cb88aec5898e62f24a6def2aa0daa9ad | 8,788 | abap | ABAP | src/objects/zcl_abapgit_object_vcls.clas.abap | abapGit/upport | 322935c225756b5107d7c835e6ccc13ba3dcbe4a | [
"MIT"
] | 2 | 2021-01-08T21:38:32.000Z | 2021-11-17T19:37:14.000Z | src/objects/zcl_abapgit_object_vcls.clas.abap | abapGit/upport | 322935c225756b5107d7c835e6ccc13ba3dcbe4a | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_vcls.clas.abap | abapGit/upport | 322935c225756b5107d7c835e6ccc13ba3dcbe4a | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_object_vcls DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
PROTECTED SECTION.
PRIVATE SECTION.
* See include MTOBJCON:
CONSTANTS c_cluster_type TYPE c VALUE 'C' ##NO_TEXT.
CONSTANTS c_mode_insert TYPE obj_para-maint_mode VALUE 'I' ##NO_TEXT.
METHODS check_lock
IMPORTING
!iv_tabname TYPE tabname
!iv_argument TYPE seqg3-garg
RETURNING
VALUE(rv_is_locked) TYPE abap_bool
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_object_vcls IMPLEMENTATION.
METHOD check_lock.
DATA:
ls_rstable_key TYPE rstable, " Lock argument for table RSTABLE
lv_argument TYPE eqegraarg.
" Set Values for generic table lock
ls_rstable_key-tabname = iv_tabname.
ls_rstable_key-varkey = iv_argument.
" include all sub keys
lv_argument = ls_rstable_key.
lv_argument = lv_argument && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'E_TABLEE'
iv_argument = lv_argument ).
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
* Do the same as in VIEWCLUSTER_SAVE_DEFINITION
DATA: lv_vclname TYPE vcl_name.
lv_vclname = ms_item-obj_name.
DELETE FROM vcldir WHERE vclname = lv_vclname. "#EC CI_SUBRC
DELETE FROM vcldirt WHERE vclname = lv_vclname. "#EC CI_NOFIRST "#EC CI_SUBRC
DELETE FROM vclstruc WHERE vclname = lv_vclname. "#EC CI_SUBRC
DELETE FROM vclstruct WHERE vclname = lv_vclname. "#EC CI_NOFIRST "#EC CI_SUBRC
DELETE FROM vclstrudep WHERE vclname = lv_vclname. "#EC CI_SUBRC
DELETE FROM vclmf WHERE vclname = lv_vclname. "#EC CI_SUBRC
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: ls_vcldir_entry TYPE v_vcldir,
lt_vclstruc TYPE TABLE OF v_vclstruc,
lt_vclstrudep TYPE TABLE OF v_vclstdep,
lt_vclmf TYPE TABLE OF v_vclmf,
lv_objectname TYPE ob_object.
io_xml->read( EXPORTING iv_name = 'VCLDIR'
CHANGING cg_data = ls_vcldir_entry ).
io_xml->read( EXPORTING iv_name = 'VLCSTRUC_TAB'
CHANGING cg_data = lt_vclstruc ).
io_xml->read( EXPORTING iv_name = 'VCLSTRUDEP_TAB'
CHANGING cg_data = lt_vclstrudep ).
io_xml->read( EXPORTING iv_name = 'lt_vclstrudep'
CHANGING cg_data = lt_vclmf ).
ls_vcldir_entry-author = sy-uname.
ls_vcldir_entry-changedate = sy-datum.
CALL FUNCTION 'VIEWCLUSTER_SAVE_DEFINITION'
EXPORTING
vcldir_entry = ls_vcldir_entry
TABLES
vclstruc_tab = lt_vclstruc
vclstrudep_tab = lt_vclstrudep
vclmf_tab = lt_vclmf.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = ms_item-obj_name
object_class = ms_item-obj_type
devclass = iv_package
master_language = mv_language
mode = 'INSERT'
global_lock = abap_true
suppress_dialog = abap_true
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
zcx_abapgit_exception=>raise( 'Cancelled' ).
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lv_objectname = ls_vcldir_entry-vclname.
CALL FUNCTION 'OBJ_GENERATE'
EXPORTING
iv_objectname = lv_objectname
iv_objecttype = c_cluster_type
iv_maint_mode = c_mode_insert
iv_devclass = iv_package
EXCEPTIONS
illegal_call = 1
object_not_found = 2
generate_error = 3
transport_error = 4
object_enqueue_failed = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA lv_changedate TYPE vcldir-changedate.
SELECT SINGLE changedate INTO lv_changedate FROM vcldir
WHERE vclname = ms_item-obj_name.
rv_bool = xsdbool( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
DATA lv_changedate TYPE vcldir-changedate.
SELECT SINGLE changedate INTO lv_changedate FROM vcldir
WHERE vclname = ms_item-obj_name.
* see logic in function module VIEWCLUSTER_GET_DEFINITION
rv_active = xsdbool( lv_changedate IS NOT INITIAL ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA:
lv_argument TYPE seqg3-garg,
lv_argument_langu TYPE seqg3-garg.
lv_argument = ms_item-obj_name.
lv_argument_langu = |@{ ms_item-obj_name }|.
"Check all relevant maintein tabeles for view clusters
IF check_lock( iv_tabname = 'VCLDIR'
iv_argument = lv_argument ) = abap_true
OR check_lock( iv_tabname = 'VCLDIRT'
iv_argument = lv_argument_langu ) = abap_true
OR check_lock( iv_tabname = 'VCLSTRUC'
iv_argument = lv_argument ) = abap_true
OR check_lock( iv_tabname = 'VCLSTRUCT'
iv_argument = lv_argument_langu ) = abap_true
OR check_lock( iv_tabname = 'VCLMF'
iv_argument = lv_argument ) = abap_true.
rv_is_locked = abap_true.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: ls_bcdata TYPE bdcdata,
lt_bcdata TYPE STANDARD TABLE OF bdcdata.
ls_bcdata-program = 'SAPMSVIM'.
ls_bcdata-dynpro = '0050'.
ls_bcdata-dynbegin = 'X'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'VIMDYNFLDS-VIEWNAME'.
ls_bcdata-fval = ms_item-obj_name.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'VIMDYNFLDS-STRUCT_MNT'.
ls_bcdata-fval = 'X'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'BDC_OKCODE'.
ls_bcdata-fval = '=CLUS'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-program = 'SAPMSVIM'.
ls_bcdata-dynpro = '0052 '.
ls_bcdata-dynbegin = 'X'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'VIMDYNFLDS-VCLNAME'.
ls_bcdata-fval = ms_item-obj_name.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'BDC_OKCODE'.
ls_bcdata-fval = '=CLSH'.
APPEND ls_bcdata TO lt_bcdata.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'SE54'
mode_val = 'E'
TABLES
using_tab = lt_bcdata
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, SE35' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_vclname TYPE vcl_name,
ls_vcldir_entry TYPE v_vcldir,
lt_vclstruc TYPE TABLE OF v_vclstruc,
lt_vclstrudep TYPE TABLE OF v_vclstdep,
lt_vclmf TYPE TABLE OF v_vclmf.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
lv_vclname = ms_item-obj_name.
CALL FUNCTION 'VIEWCLUSTER_GET_DEFINITION'
EXPORTING
vclname = lv_vclname
IMPORTING
vcldir_entry = ls_vcldir_entry
TABLES
vclstruc_tab = lt_vclstruc
vclstrudep_tab = lt_vclstrudep
vclmf_tab = lt_vclmf
EXCEPTIONS
viewcluster_not_found = 1
incomplete_viewcluster = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
SORT lt_vclstrudep BY vclname object objfield.
CLEAR ls_vcldir_entry-author.
CLEAR ls_vcldir_entry-changedate.
io_xml->add( iv_name = 'VCLDIR'
ig_data = ls_vcldir_entry ).
io_xml->add( iv_name = 'VLCSTRUC_TAB'
ig_data = lt_vclstruc ).
io_xml->add( iv_name = 'VCLSTRUDEP_TAB'
ig_data = lt_vclstrudep ).
io_xml->add( iv_name = 'VCLMF_TAB'
ig_data = lt_vclmf ).
ENDMETHOD.
ENDCLASS.
| 27.987261 | 96 | 0.637005 |
79d83c1525908a42971bada3426123a1f90dbcab | 15,169 | abap | ABAP | src/ui/zcl_abapgit_gui_page_repo_sett.clas.abap | mkaesemann/abapG | 467d8d367ceab1fc8acfdb4e96490e59fe3387b8 | [
"MIT"
] | 1 | 2020-04-21T04:00:18.000Z | 2020-04-21T04:00:18.000Z | src/ui/zcl_abapgit_gui_page_repo_sett.clas.abap | marcellourbani/abapGit | 7386b5a1902b0a3859ff1c62d8b6ceebd296e879 | [
"MIT"
] | 1 | 2017-10-27T09:32:58.000Z | 2017-10-27T09:32:58.000Z | src/ui/zcl_abapgit_gui_page_repo_sett.clas.abap | mkaesemann/abapGit | 467d8d367ceab1fc8acfdb4e96490e59fe3387b8 | [
"MIT"
] | 1 | 2021-07-09T02:07:11.000Z | 2021-07-09T02:07:11.000Z | CLASS zcl_abapgit_gui_page_repo_sett DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_page
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
RAISING zcx_abapgit_exception.
METHODS zif_abapgit_gui_event_handler~on_event
REDEFINITION .
PROTECTED SECTION.
CONSTANTS:
BEGIN OF c_action,
save_settings TYPE string VALUE 'save_settings',
END OF c_action .
DATA mo_repo TYPE REF TO zcl_abapgit_repo.
METHODS render_dot_abapgit
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html .
METHODS render_local_settings
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS render_remotes
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS save
IMPORTING
!it_postdata TYPE cnht_post_data_tab
RAISING
zcx_abapgit_exception .
METHODS save_dot_abap
IMPORTING
!it_post_fields TYPE tihttpnvp
RAISING
zcx_abapgit_exception .
METHODS save_local_settings
IMPORTING
!it_post_fields TYPE tihttpnvp
RAISING
zcx_abapgit_exception .
METHODS save_remotes
IMPORTING
!it_post_fields TYPE tihttpnvp
RAISING
zcx_abapgit_exception .
METHODS render_dot_abapgit_reqs
IMPORTING
ii_html TYPE REF TO zif_abapgit_html
it_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt.
METHODS render_table_row
IMPORTING
iv_name TYPE string
iv_value TYPE string
RETURNING
VALUE(rv_html) TYPE string.
METHODS render_content
REDEFINITION .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_REPO_SETT IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
ms_control-page_title = 'Repository Settings'.
mo_repo = io_repo.
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( `<div class="repo">` ).
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( io_repo = mo_repo
iv_show_commit = abap_false ) ).
ri_html->add( `</div>` ).
ri_html->add( '<div class="settings_container">' ).
ri_html->add( |<form id="settings_form" method="post" action="sapevent:{ c_action-save_settings }">| ).
render_dot_abapgit( ri_html ).
IF mo_repo->is_offline( ) = abap_false.
render_remotes( ri_html ).
ENDIF.
render_local_settings( ri_html ).
ri_html->add( '<input type="submit" value="Save" class="floating-button blue-set emphasis">' ).
ri_html->add( '</form>' ).
ri_html->add( '</div>' ).
ENDMETHOD.
METHOD render_dot_abapgit.
DATA: ls_dot TYPE zif_abapgit_dot_abapgit=>ty_dot_abapgit,
lv_select_html TYPE string,
lv_selected TYPE string,
lv_language TYPE t002t-sptxt,
lv_ignore TYPE string,
lt_folder_logic TYPE string_table.
FIELD-SYMBOLS: <lv_folder_logic> TYPE LINE OF string_table,
<lv_ignore> TYPE string.
ls_dot = mo_repo->get_dot_abapgit( )->get_data( ).
APPEND zif_abapgit_dot_abapgit=>c_folder_logic-full TO lt_folder_logic.
APPEND zif_abapgit_dot_abapgit=>c_folder_logic-prefix TO lt_folder_logic.
ii_html->add( '<h2>.abapgit.xml</h2>' ).
ii_html->add( '<table class="settings">' ).
SELECT SINGLE sptxt INTO lv_language FROM t002t
WHERE spras = sy-langu AND sprsl = ls_dot-master_language.
IF sy-subrc <> 0.
lv_language = 'Unknown language. Check your settings.'.
ENDIF.
ii_html->add( render_table_row(
iv_name = 'Master Language'
iv_value = |{ ls_dot-master_language } ({ lv_language })|
) ).
lv_select_html = '<select name="folder_logic">'.
LOOP AT lt_folder_logic ASSIGNING <lv_folder_logic>.
IF ls_dot-folder_logic = <lv_folder_logic>.
lv_selected = ' selected'.
ELSE.
CLEAR: lv_selected.
ENDIF.
lv_select_html = lv_select_html
&& |<option value="{ <lv_folder_logic> }"{ lv_selected }>{ <lv_folder_logic> }</option>|.
ENDLOOP.
lv_select_html = lv_select_html && '</select>'.
ii_html->add( render_table_row(
iv_name = 'Folder Logic'
iv_value = lv_select_html
) ).
ii_html->add( render_table_row(
iv_name = 'Starting Folder'
iv_value = |<input name="starting_folder" type="text" size="10" value="{ ls_dot-starting_folder }">|
) ).
LOOP AT ls_dot-ignore ASSIGNING <lv_ignore>.
lv_ignore = lv_ignore && <lv_ignore> && zif_abapgit_definitions=>c_newline.
ENDLOOP.
ii_html->add( render_table_row(
iv_name = 'Ignore Files'
iv_value = |<textarea name="ignore_files" rows="{ lines( ls_dot-ignore )
}" cols="50">{ lv_ignore }</textarea>|
) ).
ii_html->add( '</table>' ).
render_dot_abapgit_reqs(
it_requirements = ls_dot-requirements
ii_html = ii_html ).
ENDMETHOD.
METHOD render_dot_abapgit_reqs.
CONSTANTS: lc_requirement_edit_min_count TYPE i VALUE 5.
DATA lv_req_index TYPE i.
DATA lv_requirement_count TYPE i.
DATA lt_requirements LIKE it_requirements.
FIELD-SYMBOLS <ls_requirement> TYPE zif_abapgit_dot_abapgit=>ty_requirement.
lt_requirements = it_requirements.
lv_requirement_count = lines( lt_requirements ).
IF lv_requirement_count < lc_requirement_edit_min_count.
DO - lv_requirement_count + lc_requirement_edit_min_count TIMES.
APPEND INITIAL LINE TO lt_requirements.
ENDDO.
ENDIF.
ii_html->add( '<h3>Requirements</h3>' ).
ii_html->add( '<table class="settings-package-requirements" id="requirement-tab">' ).
ii_html->add( '<tr><th>Software Component</th><th>Min. Release</th><th>Min. Patch</th></tr>' ).
LOOP AT lt_requirements ASSIGNING <ls_requirement>.
lv_req_index = sy-tabix.
ii_html->add( '<tr>' ).
ii_html->add( |<td><input name="req_com_{ lv_req_index }" maxlength=30 type="text" | &&
|value="{ <ls_requirement>-component }"></td>| ).
ii_html->add( |<td><input name="req_rel_{ lv_req_index }" maxlength=10 type="text" | &&
|value="{ <ls_requirement>-min_release }"></td>| ).
ii_html->add( |<td><input name="req_pat_{ lv_req_index }" maxlength=10 type="text" | &&
|value="{ <ls_requirement>-min_patch }"></td>| ).
ii_html->add( '</tr>' ).
ENDLOOP.
ii_html->add( '</table>' ).
ENDMETHOD.
METHOD render_local_settings.
DATA: lv_checked TYPE string,
ls_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings.
ls_settings = mo_repo->get_local_settings( ).
ii_html->add( '<h2>Local Settings</h2>' ).
ii_html->add( '<table class="settings">' ).
ii_html->add( render_table_row(
iv_name = 'Display Name'
iv_value = |<input name="display_name" type="text" size="30" value="{ ls_settings-display_name }">|
) ).
CLEAR lv_checked.
IF ls_settings-write_protected = abap_true.
IF zcl_abapgit_factory=>get_environment( )->is_repo_object_changes_allowed( ) = abap_true.
lv_checked = | checked|.
ELSE.
lv_checked = | checked disabled|.
ENDIF.
ENDIF.
ii_html->add( render_table_row(
iv_name = 'Write Protected'
iv_value = |<input name="write_protected" type="checkbox"{ lv_checked }>|
) ).
CLEAR lv_checked.
IF ls_settings-ignore_subpackages = abap_true.
lv_checked = | checked|.
ENDIF.
ii_html->add( render_table_row(
iv_name = 'Ignore Subpackages'
iv_value = |<input name="ignore_subpackages" type="checkbox"{ lv_checked }>|
) ).
CLEAR lv_checked.
IF ls_settings-only_local_objects = abap_true.
lv_checked = | checked|.
ENDIF.
ii_html->add( render_table_row(
iv_name = 'Only Local Objects'
iv_value = |<input name="only_local_objects" type="checkbox"{ lv_checked }>|
) ).
ii_html->add( render_table_row(
iv_name = 'Code Inspector Check Variant'
iv_value = |<input name="check_variant" type="text" size="30" value="{
ls_settings-code_inspector_check_variant }">|
) ).
CLEAR lv_checked.
IF ls_settings-block_commit = abap_true.
lv_checked = | checked|.
ENDIF.
ii_html->add( render_table_row(
iv_name = 'Block Commit If Code Inspection Has Errors'
iv_value = |<input name="block_commit" type="checkbox"{ lv_checked }>|
) ).
CLEAR lv_checked.
IF ls_settings-serialize_master_lang_only = abap_true.
lv_checked = | checked|.
ENDIF.
ii_html->add( render_table_row(
iv_name = 'Serialize Master Language Only'
iv_value = |<input name="serialize_master_lang_only" type="checkbox"{ lv_checked }>|
) ).
ii_html->add( '</table>' ).
ENDMETHOD.
METHOD render_remotes.
DATA lo_repo_online TYPE REF TO zcl_abapgit_repo_online.
lo_repo_online ?= mo_repo.
ii_html->add( '<h2>Remotes</h2>' ).
ii_html->add( '<table class="settings">' ).
" TODO maybe make it editable ?
ii_html->add( render_table_row(
iv_name = 'Current remote'
iv_value = |{ lo_repo_online->get_url( )
} <span class="grey">@{ lo_repo_online->get_selected_branch( ) }</span>| ) ).
ii_html->add( render_table_row(
iv_name = 'Switched origin'
iv_value = |<input name="switched_origin" type="text" size="60" value="{
lo_repo_online->get_switched_origin( ) }">| ) ).
ii_html->add( '</table>' ).
ENDMETHOD.
METHOD render_table_row.
rv_html = '<tr>'
&& |<td>{ iv_name }</td>|
&& |<td>{ iv_value }</td>|
&& '</tr>'.
ENDMETHOD.
METHOD save.
DATA: lt_post_fields TYPE tihttpnvp,
lv_msg TYPE string.
lt_post_fields = zcl_abapgit_html_action_utils=>parse_post_form_data( it_postdata ).
save_dot_abap( lt_post_fields ).
save_remotes( lt_post_fields ).
save_local_settings( lt_post_fields ).
mo_repo->refresh( ).
lv_msg = |{ mo_repo->get_name( ) }: settings saved successfully.|.
MESSAGE lv_msg TYPE 'S'.
ENDMETHOD.
METHOD save_dot_abap.
DATA: lo_dot TYPE REF TO zcl_abapgit_dot_abapgit,
ls_post_field LIKE LINE OF it_post_fields,
lv_ignore TYPE string,
lt_ignore TYPE STANDARD TABLE OF string WITH DEFAULT KEY,
lo_requirements TYPE REF TO lcl_requirements.
lo_dot = mo_repo->get_dot_abapgit( ).
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'folder_logic'.
ASSERT sy-subrc = 0.
lo_dot->set_folder_logic( ls_post_field-value ).
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'starting_folder'.
ASSERT sy-subrc = 0.
lo_dot->set_starting_folder( ls_post_field-value ).
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'ignore_files'.
ASSERT sy-subrc = 0.
" Remove everything
lt_ignore = lo_dot->get_data( )-ignore.
LOOP AT lt_ignore INTO lv_ignore.
lo_dot->remove_ignore( iv_path = ''
iv_filename = lv_ignore ).
ENDLOOP.
" Add newly entered files
CLEAR lt_ignore.
REPLACE ALL OCCURRENCES OF zif_abapgit_definitions=>c_crlf IN ls_post_field-value
WITH zif_abapgit_definitions=>c_newline.
SPLIT ls_post_field-value AT zif_abapgit_definitions=>c_newline INTO TABLE lt_ignore.
DELETE lt_ignore WHERE table_line IS INITIAL.
LOOP AT lt_ignore INTO lv_ignore.
lo_dot->add_ignore( iv_path = ''
iv_filename = lv_ignore ).
ENDLOOP.
lo_requirements = lcl_requirements=>new( ).
LOOP AT it_post_fields INTO ls_post_field WHERE name CP 'req_*'.
CASE ls_post_field-name+4(3).
WHEN 'com'.
lo_requirements->set_component( ls_post_field-value ).
WHEN 'rel'.
lo_requirements->set_min_release( ls_post_field-value ).
WHEN 'pat'.
lo_requirements->set_min_patch( ls_post_field-value ).
ENDCASE.
ENDLOOP.
lo_dot->set_requirements( lo_requirements->get_as_table( ) ).
mo_repo->set_dot_abapgit( lo_dot ).
ENDMETHOD.
METHOD save_local_settings.
DATA: ls_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings,
ls_post_field LIKE LINE OF it_post_fields,
lv_check_variant TYPE sci_chkv.
ls_settings = mo_repo->get_local_settings( ).
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'display_name'.
ASSERT sy-subrc = 0.
ls_settings-display_name = ls_post_field-value.
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'write_protected' value = 'on'.
ls_settings-write_protected = boolc( sy-subrc = 0 ).
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'ignore_subpackages' value = 'on'.
ls_settings-ignore_subpackages = boolc( sy-subrc = 0 ).
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'only_local_objects' value = 'on'.
ls_settings-only_local_objects = boolc( sy-subrc = 0 ).
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'check_variant'.
ASSERT sy-subrc = 0.
lv_check_variant = to_upper( ls_post_field-value ).
IF ls_post_field-value IS NOT INITIAL.
zcl_abapgit_code_inspector=>validate_check_variant( lv_check_variant ).
ENDIF.
ls_settings-code_inspector_check_variant = lv_check_variant.
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'block_commit' value = 'on'.
ls_settings-block_commit = boolc( sy-subrc = 0 ).
IF ls_settings-block_commit = abap_true
AND ls_settings-code_inspector_check_variant IS INITIAL.
zcx_abapgit_exception=>raise( |If block commit is active, a check variant has to be maintained.| ).
ENDIF.
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'serialize_master_lang_only' value = 'on'.
ls_settings-serialize_master_lang_only = boolc( sy-subrc = 0 ).
mo_repo->set_local_settings( ls_settings ).
ENDMETHOD.
METHOD save_remotes.
DATA ls_post_field LIKE LINE OF it_post_fields.
DATA lo_online_repo TYPE REF TO zcl_abapgit_repo_online.
IF mo_repo->is_offline( ) = abap_true.
RETURN.
ENDIF.
lo_online_repo ?= mo_repo.
READ TABLE it_post_fields INTO ls_post_field WITH KEY name = 'switched_origin'.
ASSERT sy-subrc = 0.
lo_online_repo->switch_origin(
iv_url = ls_post_field-value
iv_overwrite = abap_true ).
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
CASE ii_event->mv_action.
WHEN c_action-save_settings.
save( ii_event->mt_postdata ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back.
WHEN OTHERS.
rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ).
ENDCASE.
ENDMETHOD.
ENDCLASS.
| 30.831301 | 107 | 0.666029 |
79d9b927dec18f5f4c07cb30af06f689b1b284a1 | 2,560 | abap | ABAP | src/objects/zcl_abapgit_object_iwsg.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_iwsg.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_iwsg.clas.abap | ed-holland/abapGit | 380508d72c02f37f15344165411fc5a145f73e72 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_iwsg DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
METHODS get_generic
RETURNING
VALUE(ro_generic) TYPE REF TO zcl_abapgit_objects_generic
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
METHODS get_field_rules
RETURNING
VALUE(ro_result) TYPE REF TO zif_abapgit_field_rules.
ENDCLASS.
CLASS zcl_abapgit_object_iwsg IMPLEMENTATION.
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.
METHOD get_field_rules.
ro_result = zcl_abapgit_field_rules=>create( ).
ro_result->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CREATED_BY'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user
)->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CREATED_TIMESTMP'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp
)->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CHANGED_BY'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user
)->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CHANGED_TIMESTMP'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp ).
ENDMETHOD.
ENDCLASS.
| 19.844961 | 70 | 0.703125 |
79d9fb48420867f47d590329810795aef101d32c | 51,952 | abap | ABAP | src/zcl_text2tab_parser.clas.testclasses.abap | larshp/text2tab | 315f42b884f18943de5d09c9efc1acb330c694c0 | [
"MIT"
] | null | null | null | src/zcl_text2tab_parser.clas.testclasses.abap | larshp/text2tab | 315f42b884f18943de5d09c9efc1acb330c694c0 | [
"MIT"
] | null | null | null | src/zcl_text2tab_parser.clas.testclasses.abap | larshp/text2tab | 315f42b884f18943de5d09c9efc1acb330c694c0 | [
"MIT"
] | null | null | null | class ltcl_text2tab_parser_test definition for testing
final risk level harmless duration short.
public section.
types:
begin of ty_dummy,
mandt type mandt,
tdate type d,
tchar type c length 8,
traw type x length 1,
tstring type string,
talpha type veri_alpha,
tdecimal type p length 13 decimals 2, " dmbtr
tnumber type n length 4,
tinteger type i,
tfloat type float,
end of ty_dummy,
begin of ty_dummy_with_time,
tchar(8),
ttime type t,
end of ty_dummy_with_time,
tt_dummy type standard table of ty_dummy with default key,
begin of ty_dummy_corresponding,
tdate type d,
tchar type c length 8,
_another type i,
end of ty_dummy_corresponding,
tt_dummy_corresponding type standard table of ty_dummy_corresponding with default key,
begin of ty_dummy_str,
mandt type string,
tdate type string,
tchar type string,
traw type string,
tstring type string,
talpha type string,
tdecimal type string,
tnumber type string,
tinteger type string,
tfloat type string,
end of ty_dummy_str,
tt_dummy_str type standard table of ty_dummy_str with default key.
types:
begin of ty_dummy_with_nonflat,
mandt type mandt,
tdate type d,
nonflat type ty_dummy,
tchar type c length 8,
end of ty_dummy_with_nonflat.
types:
begin of ty_deep_sub,
id type i,
sub type string,
end of ty_deep_sub,
tt_deep_sub type standard table of ty_deep_sub with key id,
begin of ty_deep,
field1 type i,
field2 type i,
deep_struc type ty_deep_sub,
deep_tab type tt_deep_sub,
end of ty_deep,
tt_deep type standard table of ty_deep with key field1.
* ================
private section.
constants c_tab like cl_abap_char_utilities=>horizontal_tab value cl_abap_char_utilities=>horizontal_tab.
constants c_crlf like cl_abap_char_utilities=>cr_lf value cl_abap_char_utilities=>cr_lf.
constants c_lf like cl_abap_char_utilities=>newline value cl_abap_char_utilities=>newline.
constants c_dummy type ty_dummy value is initial.
constants c_dummy_corresponding type ty_dummy_corresponding value is initial.
data o type ref to zcl_text2tab_parser. "class under test
* ==== TESTING ===
methods create for testing.
methods apply_conv_exit for testing.
methods parse_field_positive for testing raising zcx_text2tab_error.
methods parse_field_negative for testing raising zcx_text2tab_error.
methods parse_field_special for testing raising zcx_text2tab_error.
methods map_head_structure for testing.
methods map_head_structure_corresp for testing raising zcx_text2tab_error.
methods map_head_structure_w_ignores for testing raising zcx_text2tab_error.
methods parse_line_negative for testing.
methods parse_data_empty_line for testing.
methods parse_negative for testing.
methods parse for testing raising zcx_text2tab_error.
methods parse_time for testing raising zcx_text2tab_error.
methods parse_float for testing raising zcx_text2tab_error.
methods parse_ignore_convexit for testing raising zcx_text2tab_error.
methods parse_typeless for testing.
methods with_renames for testing.
methods deep_structures for testing.
methods parse_corresponding for testing raising zcx_text2tab_error.
* ==== HELPERS ===
data mt_dummy_tmp type tt_dummy.
data mt_dummy_str_tmp type tt_dummy_str.
data mt_strict_tmp type abap_bool.
data mt_field_components type zcl_text2tab_utils=>tt_comp_descr.
methods setup raising zcx_text2tab_error.
methods get_dummy_data
importing
i_strict type abap_bool default abap_true
exporting
e_dummy_struc type ty_dummy
e_dummy_tab type tt_dummy
e_dummy_tab_s type tt_dummy_str
e_dummy_header type string
e_dummy_string type string
e_map_corresp type int4_table
e_map type int4_table.
methods get_dummy_data_with_time
exporting
e_exp_result type ty_dummy_with_time
e_with_valid_time type string
e_with_invalid_time type string.
methods _append_dummy
importing
iv_str type string
changing
ct_tab type standard table.
methods append_dummy
importing
iv_str type string.
methods append_dummy_s
importing
iv_str type string.
methods test_parse
importing
positive type abap_bool
f type string
v type string
exp type any optional
err type string optional.
methods test_parse_positive
importing
f type string
v type string
exp type any.
methods test_parse_negative
importing
f type string
v type string
err type string.
endclass.
class zcl_text2tab_parser definition local friends ltcl_text2tab_parser_test.
class ltcl_deep_helper definition final for testing.
public section.
interfaces zif_text2tab_deep_provider.
methods constructor
importing
i_tab type ltcl_text2tab_parser_test=>tt_deep_sub.
data mt_tab type ltcl_text2tab_parser_test=>tt_deep_sub.
endclass.
class ltcl_deep_helper implementation.
method constructor.
mt_tab = i_tab.
endmethod.
method zif_text2tab_deep_provider~select.
data lv_id type i.
data lt_tab like mt_tab.
field-symbols <i> type any.
if i_address cs '222'. " Very straihgt but why not ? :)
lv_id = 222.
else.
assign component 'FIELD2' of structure i_cursor to <i>.
lv_id = <i>.
endif.
if cl_abap_typedescr=>describe_by_data( e_container )->kind = 'T'.
loop at mt_tab assigning <i> where id = lv_id.
append <i> to lt_tab.
endloop.
e_container = lt_tab.
else. " structure
read table mt_tab into e_container with key id = lv_id.
endif.
endmethod.
endclass.
**********************************************************************
* Implementation
**********************************************************************
class ltcl_text2tab_parser_test implementation.
method setup.
o = zcl_text2tab_parser=>create( c_dummy ).
endmethod.
method create.
data:
lo type ref to zcl_text2tab_parser,
lx type ref to zcx_text2tab_error,
lv_date_format type zcl_text2tab_parser=>ty_date_format,
ls_dummy type ty_dummy,
lt_dummy type tt_dummy,
lv_dummy type i.
try.
lo = zcl_text2tab_parser=>create( i_pattern = ls_dummy ).
cl_abap_unit_assert=>assert_not_initial( act = lo ).
cl_abap_unit_assert=>assert_equals( act = lo->mv_amount_format exp = ' ,' ).
lo = zcl_text2tab_parser=>create( i_pattern = lt_dummy i_amount_format = ' .' ).
cl_abap_unit_assert=>assert_not_initial( act = lo ).
cl_abap_unit_assert=>assert_equals( act = lo->mv_amount_format exp = ' .' ).
lo = zcl_text2tab_parser=>create( i_pattern = ls_dummy i_amount_format = 'x' ).
cl_abap_unit_assert=>assert_not_initial( act = lo ).
cl_abap_unit_assert=>assert_equals( act = lo->mv_amount_format exp = ' ,' ).
lo = zcl_text2tab_parser=>create( i_pattern = ls_dummy ).
cl_abap_unit_assert=>assert_not_initial( act = lo ).
cl_abap_unit_assert=>assert_equals( act = lo->mv_date_format exp = 'DMY.' ).
lo = zcl_text2tab_parser=>create( i_pattern = ls_dummy i_date_format = 'YMD' ).
cl_abap_unit_assert=>assert_not_initial( act = lo ).
cl_abap_unit_assert=>assert_equals( act = lo->mv_date_format exp = 'YMD' ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
clear lx.
try.
lo = zcl_text2tab_parser=>create( i_pattern = lv_dummy ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals( act = lx->code exp = 'PE' ). " Pattern error
endtry.
cl_abap_unit_assert=>assert_not_initial( act = lx ).
do 3 times.
case sy-index.
when 1.
lv_date_format = 'XXX'.
when 2.
lv_date_format = 'DM'.
when 3.
lv_date_format = 'DMY='.
endcase.
clear lx.
try.
lo = zcl_text2tab_parser=>create( i_pattern = ls_dummy i_date_format = lv_date_format ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals( act = lx->code exp = 'UD' ). " Unsupported date format
endtry.
cl_abap_unit_assert=>assert_not_initial( act = lx ).
enddo.
endmethod.
method parse.
data:
dummy_act type ty_dummy,
dummy_tab_act type tt_dummy,
dummy_htab type hashed table of ty_dummy with unique key tdate,
dummy_stab type sorted table of ty_dummy with unique key tdate,
dummy_exp type ty_dummy,
dummy_tab_exp type tt_dummy,
dummy_head type string,
l_string type string,
lt_strings type table of string,
lt_header_act type standard table of string,
lt_header_exp type standard table of string,
lx type ref to zcx_text2tab_error.
" Strict parsing *********************************
get_dummy_data(
importing
e_dummy_struc = dummy_exp
e_dummy_tab = dummy_tab_exp
e_dummy_header = dummy_head
e_dummy_string = l_string ).
split dummy_head at c_tab into table lt_header_exp.
o->parse(
exporting
i_data = l_string
importing
e_container = dummy_act ).
cl_abap_unit_assert=>assert_equals(
act = dummy_act
exp = dummy_exp ).
o->parse(
exporting
i_data = l_string
importing
e_container = dummy_tab_act
e_head_fields = lt_header_act ).
cl_abap_unit_assert=>assert_equals(
act = dummy_tab_act
exp = dummy_tab_exp ).
cl_abap_unit_assert=>assert_equals(
act = lt_header_act
exp = lt_header_exp ).
" Parse to sorted and hashed tables ***************
o->parse(
exporting
i_data = l_string
importing
e_container = dummy_stab ).
cl_abap_unit_assert=>assert_equals(
act = dummy_stab
exp = dummy_tab_exp ).
o->parse(
exporting
i_data = l_string
importing
e_container = dummy_htab ).
cl_abap_unit_assert=>assert_equals(
act = dummy_htab
exp = dummy_tab_exp ).
" Parse without head
split l_string at c_crlf into table lt_strings.
delete lt_strings index 1.
concatenate lines of lt_strings into l_string separated by c_crlf.
o->parse(
exporting
i_data = l_string
i_has_head = abap_false
importing
e_container = dummy_tab_act ).
cl_abap_unit_assert=>assert_equals(
act = dummy_tab_act
exp = dummy_tab_exp ).
" NOT STRICT parsing ******************************
get_dummy_data(
exporting
i_strict = abap_false
importing
e_dummy_tab = dummy_tab_exp
e_dummy_header = dummy_head
e_dummy_string = l_string ).
split dummy_head at c_tab into table lt_header_exp.
o->parse(
exporting
i_data = l_string
i_strict = abap_false
importing
e_container = dummy_tab_act
e_head_fields = lt_header_act ).
cl_abap_unit_assert=>assert_equals(
act = dummy_tab_act
exp = dummy_tab_exp ).
cl_abap_unit_assert=>assert_equals(
act = lt_header_act
exp = lt_header_exp ).
endmethod.
method parse_time.
data: l_exp_result type ty_dummy_with_time,
l_act_result type ty_dummy_with_time,
l_with_valid_time type string,
l_with_invalid_time type string,
cut type ref to zcl_text2tab_parser,
l_exc_expected type ref to zcx_text2tab_error.
get_dummy_data_with_time(
importing
e_exp_result = l_exp_result
e_with_valid_time = l_with_valid_time
e_with_invalid_time = l_with_invalid_time ).
cut = zcl_text2tab_parser=>create( l_exp_result ).
" not successfull parsing
try.
cut->parse(
exporting
i_data = l_with_invalid_time
importing
e_container = l_act_result ).
cl_abap_unit_assert=>fail( msg = |no exception when given invalid time| ).
catch zcx_text2tab_error into l_exc_expected.
cl_abap_unit_assert=>assert_equals(
exp = 'IT'
act = l_exc_expected->code
msg = |should throw exception-code IT on invalid time| ).
endtry.
" successfull parsing
cut->parse(
exporting
i_data = l_with_valid_time
importing
e_container = l_act_result ).
cl_abap_unit_assert=>assert_equals(
exp = l_exp_result
act = l_act_result
msg = |parsing should be sucessfull with correct time| ).
endmethod.
method parse_negative.
data: begin of wrong_struc ##NEEDED,
mandt type mandt,
tdate type d,
tchar type c length 8,
end of wrong_struc.
data:
l_exp_code type char2,
dummy_val type char40 ##NEEDED,
dummy_tab_act type tt_dummy ##NEEDED,
l_string type string,
l_string_bak type string,
lx type ref to zcx_text2tab_error.
get_dummy_data( importing e_dummy_string = l_string_bak ).
do 7 times.
clear lx.
l_string = l_string_bak.
try.
case sy-index.
when 1. " Parse to field (not table or structure)
l_exp_code = 'PE'.
o->parse(
exporting
i_data = l_string
importing
e_container = dummy_val ).
when 2. " Parse empty file
clear l_string.
l_exp_code = 'DE'.
o->parse(
exporting
i_data = l_string
importing
e_container = dummy_tab_act ).
when 3. " Add empty line at the beginning
l_string = c_crlf && l_string.
l_exp_code = 'HE'.
o->parse(
exporting
i_data = l_string
importing
e_container = dummy_tab_act ).
when 4. " Wrong params: strict = false and has_head = false
l_exp_code = 'WP'.
o->parse(
exporting
i_data = l_string
i_strict = abap_false
i_has_head = abap_false
importing
e_container = dummy_tab_act ).
when 5. " Wrong container type
l_exp_code = 'TE'.
o->parse(
exporting
i_data = l_string
importing
e_container = wrong_struc ).
when 6. " Wrong params: strict = true and corresponding = true
l_exp_code = 'WP'.
o->parse(
exporting
i_data = l_string
i_strict = abap_true
i_corresponding = abap_true
importing
e_container = dummy_tab_act ).
when 7. " Wrong params: strict = true and has_head = false
l_exp_code = 'WP'.
o->parse(
exporting
i_data = l_string
i_strict = abap_false
i_has_head = abap_false
i_corresponding = abap_true
importing
e_container = dummy_tab_act ).
endcase.
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals( exp = l_exp_code act = lx->code msg = |parse, case { sy-index }| ).
endtry.
cl_abap_unit_assert=>assert_not_initial( act = lx msg = |parse, case { sy-index }| ).
enddo.
endmethod.
method apply_conv_exit.
data:
l_dummy type ty_dummy,
lx type ref to zcx_text2tab_error.
try .
o->apply_conv_exit(
exporting
i_convexit = 'ALPHA'
i_value = '123'
importing
e_field = l_dummy-talpha ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
cl_abap_unit_assert=>assert_equals( act = l_dummy-talpha exp = '0000000123' ).
" Check wrong exit
clear lx.
try .
o->apply_conv_exit(
exporting
i_convexit = 'NONAME'
i_value = '123'
importing
e_field = l_dummy-talpha ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals( act = lx->code exp = 'EM' ).
endtry.
cl_abap_unit_assert=>assert_not_initial( act = lx ).
endmethod.
method test_parse.
data ls_dummy type ty_dummy.
data ls_component like line of mt_field_components.
data lx type ref to zcx_text2tab_error.
field-symbols <fld> type any.
read table mt_field_components into ls_component with key name = f.
cl_abap_unit_assert=>assert_subrc( ).
assign component f of structure ls_dummy to <fld>.
cl_abap_unit_assert=>assert_subrc( ).
try.
o->parse_field(
exporting
is_component = ls_component
i_value = v
importing
e_field = <fld> ).
if positive = abap_true.
cl_abap_unit_assert=>assert_equals(
act = <fld>
exp = exp
msg = |Parse field positive: { f }| ).
else.
cl_abap_unit_assert=>fail( |Parse field negative didn''t raise: { f }| ).
endif.
catch zcx_text2tab_error into lx.
if positive = abap_true.
cl_abap_unit_assert=>fail( |Parse field positive must not raise: { f }| ).
else.
cl_abap_unit_assert=>assert_equals(
act = lx->code
exp = err
msg = |Parse field negative wrong code: { f } [{ lx->code }]| ).
endif.
endtry.
endmethod.
method test_parse_positive.
test_parse(
positive = abap_true
f = f
v = v
exp = exp ).
endmethod.
method test_parse_negative.
test_parse(
positive = abap_false
f = f
v = v
err = err ).
endmethod.
method parse_field_positive.
data ls_dummy type ty_dummy.
data lo_struc_descr type ref to cl_abap_structdescr.
lo_struc_descr ?= cl_abap_structdescr=>describe_by_data( ls_dummy ).
mt_field_components = zcl_text2tab_utils=>describe_struct(
i_struc = lo_struc_descr
i_ignore_nonflat = abap_false ).
" Positive tests ******************************
test_parse_positive( f = 'TDATE' v = '01.02.2015' exp = '20150201' ).
test_parse_positive( f = 'TDATE' v = '1.2.2015' exp = '20150201' ).
test_parse_positive( f = 'TCHAR' v = 'ABC' exp = 'ABC' ).
test_parse_positive( f = 'TSTRING' v = 'The string test' exp = 'The string test' ).
test_parse_positive( f = 'TALPHA' v = '100000' exp = '0000100000' ).
test_parse_positive( f = 'TNUMBER' v = '2015' exp = '2015' ).
test_parse_positive( f = 'TINTEGER' v = '123' exp = 123 ).
test_parse_positive( f = 'TRAW' v = '8E' exp = '8E' ).
test_parse_positive( f = 'TFLOAT' v = '1,123456789' exp = '1.123456789' ).
test_parse_positive( f = 'TFLOAT' v = '"1,123456789"' exp = '1.123456789' ). " Quoted data, issue#6
test_parse_positive( f = 'TNUMBER' v = '"2015"' exp = '2015' ). " Quoted data
" Decimal converion tests *********************
test_parse_positive( f = 'TDECIMAL' v = '1234,12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '-1234,12' exp = '-1234.12' ).
" Different amount formats
test_parse_positive( f = 'TDECIMAL' v = '-1234,12' exp = '-1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1234,12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1234' exp = '1234' ).
test_parse_positive( f = 'TDECIMAL' v = '1 234' exp = '1234' ).
test_parse_positive( f = 'TDECIMAL' v = '1 234,12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '14,12' exp = '14.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1 234 567,12' exp = '1234567.12' ).
test_parse_positive( f = 'TDECIMAL' v = '0' exp = '0' ).
test_parse_positive( f = 'TDECIMAL' v = '0,0' exp = '0' ).
test_parse_positive( f = 'TDECIMAL' v = '' exp = '0' ).
test_parse_positive( f = 'TDECIMAL' v = '15' exp = '15' ).
o->mv_amount_format = '.,'.
test_parse_positive( f = 'TDECIMAL' v = '1234,12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1 234,12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1.234,12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1.234' exp = '1234' ).
test_parse_positive( f = 'TDECIMAL' v = '14,12' exp = '14.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1.234.567,12' exp = '1234567.12' ).
o->mv_amount_format = ',.'.
test_parse_positive( f = 'TDECIMAL' v = '1234.12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1 234.12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1,234.12' exp = '1234.12' ).
test_parse_positive( f = 'TDECIMAL' v = '14.12' exp = '14.12' ).
test_parse_positive( f = 'TDECIMAL' v = '1,234,567.12' exp = '1234567.12' ).
" Date tests **********************************
o->mv_date_format = 'MDY'.
test_parse_positive( f = 'TDATE' v = '02012015' exp = '20150201' ).
o->mv_date_format = 'YMD'.
test_parse_positive( f = 'TDATE' v = '20150201' exp = '20150201' ).
o->mv_date_format = 'YMD-'.
test_parse_positive( f = 'TDATE' v = '2015-02-01' exp = '20150201' ).
test_parse_positive( f = 'TDATE' v = '2015-2-1' exp = '20150201' ).
test_parse_positive( f = 'TDATE' v = ` ` exp = '00000000' ).
test_parse_positive( f = 'TDATE' v = '' exp = '00000000' ).
o->mv_date_format = 'DMY.'. " Back to default
endmethod.
method parse_field_negative.
data:
ls_dummy type ty_dummy,
lo_struc_descr type ref to cl_abap_structdescr,
lt_components type zcl_text2tab_utils=>tt_comp_descr,
ls_component like line of lt_components,
lx type ref to zcx_text2tab_error.
lo_struc_descr ?= cl_abap_structdescr=>describe_by_data( ls_dummy ).
mt_field_components = zcl_text2tab_utils=>describe_struct(
i_struc = lo_struc_descr
i_ignore_nonflat = abap_false ).
" Negative tests ******************************
test_parse_negative( f = 'TNUMBER' v = '20ha' err = 'PF' ).
" Negative decimal tests
o->mv_amount_format = ' ,'. " Set defaults
test_parse_negative( f = 'TDECIMAL' v = '1 234.12' err = 'PF' ).
test_parse_negative( f = 'TDECIMAL' v = '1 234_12' err = 'PF' ).
test_parse_negative( f = 'TDECIMAL' v = '1234,123' err = 'PF' ). " 3 decimal digits into amount which has just 2
test_parse_negative( f = 'TDECIMAL' v = '1234,12_' err = 'PF' ).
test_parse_negative( f = 'TDECIMAL' v = 'Not-a-number' err = 'PF' ).
o->mv_amount_format = '.,'.
test_parse_negative( f = 'TDECIMAL' v = '1 234.12' err = 'PF' ).
test_parse_negative( f = 'TDECIMAL' v = '1,234.12' err = 'PF' ).
o->mv_amount_format = ',.'.
test_parse_negative( f = 'TDECIMAL' v = '1 234,12' err = 'PF' ).
test_parse_negative( f = 'TDECIMAL' v = '1.234,12' err = 'PF' ).
" Date tests **********************************
" Negative tests
o->mv_date_format = 'YMD'.
test_parse_negative( f = 'TDATE' v = '2015020' err = 'DL' ). " Too short
o->mv_date_format = 'DMY.'. " Back to default
test_parse_negative( f = 'TDATE' v = '01.02.20156' err = 'DL' ). " Too long
test_parse_negative( f = 'TDATE' v = 'AB022015' err = 'DY' ). " Wrong symbols
test_parse_negative( f = 'TDATE' v = '01.02-2015' err = 'DY' ). " Wrong separators
test_parse_negative( f = 'TDATE' v = '1.2.201567' err = 'DP' ). " Wrong part length
test_parse_negative( f = 'TDATE' v = '123.2.2015' err = 'DP' ). " Wrong part length
test_parse_negative( f = 'TDATE' v = '01022015' err = 'DS' ). " No separators
test_parse_negative( f = 'TDATE' v = '01.012015' err = 'DS' ). " No second separator
test_parse_negative( f = 'TDATE' v = '40.01.2015' err = 'DU' ). " Incorrect day
test_parse_negative( f = 'TDATE' v = '01.13.2015' err = 'DU' ). " Incorrect month
" Overflow ************************************
test_parse_negative( f = 'TCHAR' v = 'ABCDEFGH123' err = 'FS' ).
test_parse_negative( f = 'TNUMBER' v = '201567' err = 'FS' ).
test_parse_negative( f = 'TRAW' v = '8E8F' err = 'FS' ).
test_parse_negative( f = 'TRAW' v = '8E8' err = 'FS' ).
endmethod.
method parse_field_special.
data lx type ref to zcx_text2tab_error.
data lv_meins type meins.
data ls_comp like line of mt_field_components.
" CONV EXITS
ls_comp-type_kind = cl_abap_typedescr=>typekind_char.
ls_comp-edit_mask = 'CUNIT'.
ls_comp-output_length = 3.
o->parse_field(
exporting
is_component = ls_comp
i_value = 'KG'
importing
e_field = lv_meins ).
cl_abap_unit_assert=>assert_equals(
act = lv_meins
exp = 'KG' ).
try.
ls_comp-type_kind = cl_abap_typedescr=>typekind_char.
ls_comp-edit_mask = 'CUNIT'.
ls_comp-output_length = 3.
o->parse_field(
exporting
is_component = ls_comp
i_value = '??'
importing
e_field = lv_meins ).
cl_abap_unit_assert=>fail( ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals(
act = lx->code
exp = 'EF' ).
endtry.
endmethod.
method parse_float.
data lv_act type p length 6 decimals 2.
o->parse_float(
exporting
i_value = '1,23'
i_decimals = 2
importing
e_field = lv_act ).
cl_abap_unit_assert=>assert_equals(
act = lv_act
exp = '1.23' ).
o->parse_float(
exporting
i_value = '1'
i_decimals = 0
importing
e_field = lv_act ).
cl_abap_unit_assert=>assert_equals(
act = lv_act
exp = '1' ).
endmethod.
method map_head_structure.
data:
l_header type string,
l_header_bak type string,
l_exp_code type char2,
l_act_map type int4_table,
l_exp_map type int4_table,
l_ren_map type zcl_text2tab_utils=>th_field_name_map,
l_rename like line of l_ren_map,
lx type ref to zcx_text2tab_error.
get_dummy_data(
exporting
i_strict = abap_false " Reduced
importing
e_dummy_header = l_header
e_map = l_exp_map ).
" Positive test
try.
o->map_head_structure(
exporting
i_rename_map = l_ren_map
i_header = l_header
i_strict = abap_false
i_corresponding = abap_false
importing
et_map = l_act_map ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
cl_abap_unit_assert=>assert_equals( act = l_act_map exp = l_exp_map ).
" Renames
l_header = replace( val = l_header sub = 'TSTRING' with = 'SOME_FIELD' ).
l_rename-from = 'SOME_FIELD'.
l_rename-to = 'TSTRING'.
insert l_rename into table l_ren_map.
try.
o->map_head_structure(
exporting
i_rename_map = l_ren_map
i_header = l_header
i_strict = abap_false
i_corresponding = abap_false
importing
et_map = l_act_map ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
cl_abap_unit_assert=>assert_equals( act = l_act_map exp = l_exp_map ).
clear l_ren_map.
get_dummy_data( " Complete
importing
e_dummy_header = l_header_bak
e_map = l_exp_map ).
delete l_exp_map index 1. " remove MANDT mapping
" Skip MANDT
l_header = l_header_bak.
replace first occurrence of 'MANDT' && c_tab in l_header with ''.
try.
o->map_head_structure(
exporting
i_rename_map = l_ren_map
i_header = l_header
i_strict = abap_true
i_corresponding = abap_false
importing
et_map = l_act_map ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
cl_abap_unit_assert=>assert_equals( act = l_act_map exp = l_exp_map ).
" Negative tests
do 6 times.
clear lx.
l_header = l_header_bak.
case sy-index.
when 1. " Duplicate field names
replace first occurrence of 'TCHAR' in l_header with 'TDATE'.
l_exp_code = 'DN'.
when 2. " Empty field names
replace first occurrence of 'TCHAR' in l_header with ''.
l_exp_code = 'EN'.
when 3. " Unknown field in text
replace first occurrence of 'TCHAR' in l_header with 'UNKNOWN'.
l_exp_code = 'MC'.
when 4. " More fields than in target structure
l_header = l_header && c_tab && 'EXCESS_FIELD'.
l_exp_code = 'CN'.
when 5. " Empty field at the end
l_header = l_header && c_tab.
l_exp_code = 'EE'.
when 6.
l_rename-from = 'TCHAR'.
l_rename-to = 'TSTRING'.
insert l_rename into table l_ren_map.
l_exp_code = 'DR'.
endcase.
try.
o->map_head_structure(
i_rename_map = l_ren_map
i_header = l_header
i_corresponding = abap_false
i_strict = abap_true ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals(
exp = l_exp_code
act = lx->code
msg = |map_head_structure, case { sy-index }| ).
endtry.
cl_abap_unit_assert=>assert_not_initial(
act = lx
msg = |map_head_structure, case { sy-index }| ).
enddo.
" Negative tests, typeless
o->mv_is_typeless = abap_true.
do 5 times.
clear lx.
case sy-index.
when 1. " Too long field
l_header = 'A123456789_123456789_123456789_EXTRA'.
l_exp_code = 'WE'.
when 2. " Special characters
l_header = 'A123456789_123456789_123456789_EXTRA'.
l_exp_code = 'WE'.
endcase.
try.
o->map_head_structure(
i_rename_map = l_ren_map
i_header = l_header
i_corresponding = abap_false
i_strict = abap_false ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals(
exp = l_exp_code
act = lx->code
msg = |map_head_structure typeless, case { sy-index }| ).
endtry.
cl_abap_unit_assert=>assert_not_initial(
act = lx
msg = |map_head_structure typeless, case { sy-index }| ).
enddo.
endmethod.
method map_head_structure_corresp.
data:
l_header type string,
l_act_map type int4_table,
l_exp_map type int4_table,
l_ren_map type zcl_text2tab_utils=>th_field_name_map.
get_dummy_data(
importing
e_map_corresp = l_exp_map
e_dummy_header = l_header ).
o = zcl_text2tab_parser=>create( c_dummy_corresponding ).
o->map_head_structure(
exporting
i_rename_map = l_ren_map
i_header = l_header
i_strict = abap_false
i_corresponding = abap_true
importing
et_map = l_act_map ).
cl_abap_unit_assert=>assert_equals(
act = l_act_map
exp = l_exp_map ).
endmethod.
method parse_line_negative.
data:
l_dataline type string,
l_header_bak type string,
l_exp_code type char2,
lt_map type int4_table,
lx type ref to zcx_text2tab_error.
get_dummy_data( importing e_dummy_header = l_header_bak
e_map = lt_map ).
" Negative tests
do 2 times.
clear lx.
l_dataline = l_header_bak.
case sy-index.
when 1. " More fields than in header
l_dataline = l_dataline && c_tab && 'EXCESSFLD'.
l_exp_code = '>H'.
when 2. " Less fields than in header
replace first occurrence of c_tab && 'TINTEGER' in l_dataline with ''.
l_exp_code = '<H'.
endcase.
try.
o->parse_line( i_dataline = l_dataline it_map = lt_map ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals(
exp = l_exp_code
act = lx->code
msg = |parse_line_negative, case { sy-index }| ).
endtry.
cl_abap_unit_assert=>assert_not_initial(
act = lx
msg = |parse_line_negative, case { sy-index }| ).
enddo.
endmethod.
method parse_data_empty_line.
data:
dummy_tab_exp type tt_dummy,
dummy_tab_act type tt_dummy,
l_string type string,
lt_data type table of string,
lt_map type int4_table,
lx type ref to zcx_text2tab_error.
get_dummy_data( importing e_dummy_tab = dummy_tab_exp
e_dummy_string = l_string
e_map = lt_map ).
split l_string at c_crlf into table lt_data.
delete lt_data index 1.
" Add empty line at the end *****************************
try.
append '' to lt_data.
o->parse_data(
exporting
it_data = lt_data
it_map = lt_map
importing
e_container = dummy_tab_act ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
cl_abap_unit_assert=>assert_equals( act = dummy_tab_act exp = dummy_tab_exp ).
" Add empty line in the middle ***************************
try.
insert '' into lt_data index 2.
o->parse_data(
exporting
it_data = lt_data
it_map = lt_map
importing
e_container = dummy_tab_act ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals( act = lx->code exp = 'LE' ).
endtry.
cl_abap_unit_assert=>assert_not_initial( act = lx ).
endmethod.
method _append_dummy.
data lt_vals type string_table.
data lo_table type ref to cl_abap_tabledescr.
data lo_struc type ref to cl_abap_structdescr.
data lr type ref to data.
field-symbols <c> like line of lo_struc->components.
field-symbols <v> like line of lt_vals.
field-symbols <fld> type any.
field-symbols <struc> type any.
lo_table ?= cl_abap_typedescr=>describe_by_data( ct_tab ).
lo_struc ?= lo_table->get_table_line_type( ).
create data lr like line of ct_tab.
assign lr->* to <struc>.
split iv_str at '|' into table lt_vals.
loop at lo_struc->components assigning <c>.
read table lt_vals index sy-tabix assigning <v>.
cl_abap_unit_assert=>assert_subrc( ).
assign component <c>-name of structure <struc> to <fld>.
<fld> = condense( <v> ).
endloop.
append <struc> to ct_tab.
endmethod.
method append_dummy.
_append_dummy(
exporting
iv_str = iv_str
changing
ct_tab = mt_dummy_tmp ).
endmethod.
method append_dummy_s.
_append_dummy(
exporting
iv_str = iv_str
changing
ct_tab = mt_dummy_str_tmp ).
endmethod.
method get_dummy_data.
data:
l_dummy_s type ty_dummy_str,
l_offs type i,
l_fields type i,
l_string type string.
field-symbols <d> like line of e_dummy_tab.
field-symbols <ds> like line of e_dummy_tab_s.
clear e_map.
if i_strict = abap_true.
l_string = 'MANDT\tTDATE\tTCHAR\tTRAW\tTSTRING\tTALPHA\tTDECIMAL\tTNUMBER\tTINTEGER\tTFLOAT\n'
&& '\t01.01.2015\tTrololo1\t8A\tString1\t100000\t1234567,81\t2015\t1111\t1,12345\n'
&& '\t02.01.2016\tTrololo2\t8B\tString2\t200000\t1234567,82\t2016\t2222\t1,00\n'
&& '\t03.01.2016\tTrololo3\t8C\tString3\t300000\t1234567,83\t2015\t3333\t1\n' .
do 10 times.
append sy-index to e_map.
enddo.
append -1 to e_map_corresp.
append 1 to e_map_corresp.
append 2 to e_map_corresp.
do 7 times.
append -1 to e_map_corresp.
enddo.
else.
l_string = 'TDATE\tTSTRING\tTCHAR\tTDECIMAL\tTNUMBER\n'
&& '01.01.2015\tString1\tTrololo1\t1234567,81\t2015\n'
&& '02.01.2016\tString2\tTrololo2\t1234567,82\t2016\n'
&& '03.01.2016\tString3\tTrololo3\t1234567,83\t2015\n' .
append 2 to e_map.
append 5 to e_map.
append 3 to e_map.
append 7 to e_map.
append 8 to e_map.
append 1 to e_map_corresp.
append -1 to e_map_corresp.
append 3 to e_map_corresp.
append -1 to e_map_corresp.
append -1 to e_map_corresp.
endif.
replace all occurrences of '\t' in l_string with c_tab.
replace all occurrences of '\n' in l_string with c_crlf.
clear mt_dummy_tmp.
" |TDATE |TCHAR |TRAW |TSTRING |TALPHA |TDECIMAL |TNUM |TINT |TFLOAT
append_dummy( '|20150101 |Trololo1 |8A |String1 |0000100000 |1234567.81 |2015 |1111 |1.12345' ).
append_dummy( '|20160102 |Trololo2 |8B |String2 |0000200000 |1234567.82 |2016 |2222 |1.00' ).
append_dummy( '|20160103 |Trololo3 |8C |String3 |0000300000 |1234567.83 |2015 |3333 |1.00' ).
e_dummy_tab = mt_dummy_tmp.
if i_strict = abap_false.
loop at e_dummy_tab assigning <d>.
clear: <d>-traw, <d>-tinteger, <d>-talpha, <d>-tfloat.
endloop.
endif.
clear mt_dummy_str_tmp.
" |TDATE |TCHAR |TRAW |TSTRING |TALPHA |TDECIMAL |TNUM |TINT |TFLOAT
append_dummy_s( '|01.01.2015 |Trololo1 |8A |String1 |100000 |1234567,81 |2015 |1111 |1,12345' ).
append_dummy_s( '|02.01.2016 |Trololo2 |8B |String2 |200000 |1234567,82 |2016 |2222 |1,00' ).
append_dummy_s( '|03.01.2016 |Trololo3 |8C |String3 |300000 |1234567,83 |2015 |3333 |1' ).
e_dummy_tab_s = mt_dummy_str_tmp.
if i_strict = abap_false.
loop at e_dummy_tab_s assigning <ds>.
clear: <ds>-traw, <ds>-tinteger, <ds>-talpha, <ds>-tfloat.
endloop.
endif.
read table e_dummy_tab into e_dummy_struc index 1.
e_dummy_string = l_string.
find first occurrence of c_crlf in l_string match offset l_offs.
e_dummy_header = l_string+0(l_offs).
endmethod.
method get_dummy_data_with_time.
e_with_valid_time = 'TCHAR\tTTIME\n'
&& 'Trolo2\t08:30:00'.
replace all occurrences of '\t' in e_with_valid_time with c_tab.
replace all occurrences of '\n' in e_with_valid_time with c_crlf.
e_with_invalid_time = 'TCHAR\tTTIME\n'
&& 'Trolo2\t88:30:00'.
replace all occurrences of '\t' in e_with_invalid_time with c_tab.
replace all occurrences of '\n' in e_with_invalid_time with c_crlf.
e_exp_result-tchar = 'Trolo2'.
e_exp_result-ttime = '083000'.
endmethod.
method parse_typeless.
data:
l_string type string,
lt_exp type tt_dummy_str,
lr_data type ref to data,
lx type ref to zcx_text2tab_error.
field-symbols:
<fld> type string,
<tab> type standard table.
get_dummy_data(
importing
e_dummy_tab_s = lt_exp
e_dummy_string = l_string ).
try.
o = zcl_text2tab_parser=>create_typeless( ).
o->parse(
exporting
i_data = l_string
importing
e_container = lr_data ).
assign lr_data->* to <tab>.
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
cl_abap_unit_assert=>assert_equals( act = lines( <tab> ) exp = 3 ).
cl_abap_unit_assert=>assert_equals( act = <tab> exp = lt_exp ).
" Check components are the same
" cl_abap_unit_assert accepts similar tables with different fielnames (wtf?)
data lo_tt_act type ref to cl_abap_tabledescr.
data lo_tt_exp type ref to cl_abap_tabledescr.
data lo_st_act type ref to cl_abap_structdescr.
data lo_st_exp type ref to cl_abap_structdescr.
lo_tt_act ?= cl_abap_typedescr=>describe_by_data( <tab> ).
lo_tt_exp ?= cl_abap_typedescr=>describe_by_data( lt_exp ).
lo_st_act ?= lo_tt_act->get_table_line_type( ).
lo_st_exp ?= lo_tt_exp->get_table_line_type( ).
cl_abap_unit_assert=>assert_equals(
act = lo_st_act->get_components( )
exp = lo_st_exp->get_components( ) ).
" Negatives
try.
o->parse(
exporting
i_data = l_string
importing
e_container = lt_exp ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals( act = lx->code exp = 'DR' ).
endtry.
cl_abap_unit_assert=>assert_not_initial( act = lx ).
endmethod.
method with_renames.
data:
l_string type string,
lt_typed_act type tt_dummy,
lt_typed_exp type tt_dummy,
lt_exp type tt_dummy_str,
lr_data type ref to data,
lv_dummy_head type string,
lt_header_act type standard table of string,
lt_header_exp type standard table of string,
lx type ref to zcx_text2tab_error.
field-symbols:
<fld> type string,
<tab> type standard table.
get_dummy_data(
importing
e_dummy_tab = lt_typed_exp
e_dummy_header = lv_dummy_head
e_dummy_tab_s = lt_exp
e_dummy_string = l_string ).
split lv_dummy_head at c_tab into table lt_header_exp.
l_string = replace( val = l_string sub = 'TSTRING' with = 'SOME_FIELD' ).
data lt_map type zcl_text2tab_utils=>tt_field_name_map.
field-symbols <map> like line of lt_map.
append initial line to lt_map assigning <map>.
<map>-from = 'some_field'.
<map>-to = 'tstring'.
" Typefull
try.
o->parse(
exporting
i_data = l_string
i_rename_fields = lt_map
importing
e_container = lt_typed_act
e_head_fields = lt_header_act ).
cl_abap_unit_assert=>assert_equals( act = lt_typed_act exp = lt_typed_exp ).
cl_abap_unit_assert=>assert_equals( act = lt_header_act exp = lt_header_exp ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
try. " string based
o->parse(
exporting
i_data = l_string
i_rename_fields = 'some_field:tstring'
importing
e_container = lt_typed_act
e_head_fields = lt_header_act ).
cl_abap_unit_assert=>assert_equals( act = lt_typed_act exp = lt_typed_exp ).
cl_abap_unit_assert=>assert_equals( act = lt_header_act exp = lt_header_exp ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
" Typeless
try.
o = zcl_text2tab_parser=>create_typeless( ).
o->parse(
exporting
i_data = l_string
i_rename_fields = lt_map
importing
e_container = lr_data ).
assign lr_data->* to <tab>.
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
cl_abap_unit_assert=>assert_equals( act = lines( <tab> ) exp = 3 ).
cl_abap_unit_assert=>assert_equals( act = <tab> exp = lt_exp ).
" Check components are the same
" cl_abap_unit_assert accepts similar tables with different fielnames (wtf?)
data lo_tt_act type ref to cl_abap_tabledescr.
data lo_tt_exp type ref to cl_abap_tabledescr.
data lo_st_act type ref to cl_abap_structdescr.
data lo_st_exp type ref to cl_abap_structdescr.
lo_tt_act ?= cl_abap_typedescr=>describe_by_data( <tab> ).
lo_tt_exp ?= cl_abap_typedescr=>describe_by_data( lt_exp ).
lo_st_act ?= lo_tt_act->get_table_line_type( ).
lo_st_exp ?= lo_tt_exp->get_table_line_type( ).
cl_abap_unit_assert=>assert_equals(
act = lo_st_act->get_components( )
exp = lo_st_exp->get_components( ) ).
endmethod.
method map_head_structure_w_ignores.
data ls_dummy type ty_dummy_with_nonflat.
data ls_exp type ty_dummy_with_nonflat.
o = zcl_text2tab_parser=>create(
i_pattern = ls_dummy
i_ignore_nonflat = abap_true ).
data:
lt_ren_map type zcl_text2tab_utils=>th_field_name_map,
lt_act_map type zcl_text2tab_parser=>tt_field_map,
lt_exp_map type zcl_text2tab_parser=>tt_field_map,
lx type ref to zcx_text2tab_error.
" Happy path
o->map_head_structure(
exporting
i_rename_map = lt_ren_map
i_header = |TDATE{ c_tab }TCHAR|
i_corresponding = abap_false
i_strict = abap_false
importing
et_map = lt_act_map ).
append 2 to lt_exp_map.
append 4 to lt_exp_map.
cl_abap_unit_assert=>assert_equals( act = lt_act_map exp = lt_exp_map ).
" Fail with ignored field
try .
o->map_head_structure(
exporting
i_rename_map = lt_ren_map
i_header = |TDATE{ c_tab }TCHAR{ c_tab }NONFLAT|
i_corresponding = abap_false
i_strict = abap_false
importing
et_map = lt_act_map ).
cl_abap_unit_assert=>fail( ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>assert_equals( act = lx->code exp = 'IG' ).
endtry.
" Integrated
o->parse(
exporting
i_data = |TDATE{ c_tab }TCHAR{ c_lf }01.01.2019{ c_tab }AAA|
i_strict = abap_false
importing
e_container = ls_dummy ).
ls_exp-tdate = '20190101'.
ls_exp-tchar = 'AAA'.
cl_abap_unit_assert=>assert_equals( act = ls_dummy exp = ls_exp ).
endmethod.
method deep_structures.
data lx type ref to zcx_text2tab_error.
data lt_exp type tt_deep.
data lt_sub type tt_deep_sub.
data l_input type string.
data lt_header_exp type standard table of string.
field-symbols <i> like line of lt_exp.
field-symbols <j> like line of <i>-deep_tab.
" Fill expected data
append initial line to lt_exp assigning <i>.
<i>-field1 = 1.
<i>-field2 = 111.
<i>-deep_struc-id = 111.
<i>-deep_struc-sub = 'Ones'.
append initial line to <i>-deep_tab assigning <j>.
<j>-id = 111.
<j>-sub = 'Ones'.
append initial line to <i>-deep_tab assigning <j>.
<j>-id = 111.
<j>-sub = 'One one one'.
append initial line to lt_exp assigning <i>.
<i>-field1 = 2.
<i>-field2 = 222.
<i>-deep_struc-id = 222.
<i>-deep_struc-sub = 'Twos'.
append initial line to <i>-deep_tab assigning <j>.
<j>-id = 222.
<j>-sub = 'Twos'.
append initial line to lt_exp assigning <i>.
<i>-field1 = 3.
<i>-field2 = 333.
append initial line to lt_exp assigning <i>.
<i>-field1 = 4.
<i>-field2 = 444.
" Sub
append initial line to lt_sub assigning <j>.
<j>-id = 111.
<j>-sub = 'Ones'.
append initial line to lt_sub assigning <j>.
<j>-id = 111.
<j>-sub = 'One one one'.
append initial line to lt_sub assigning <j>.
<j>-id = 222.
<j>-sub = 'Twos'.
" Header
append 'FIELD1' to lt_header_exp.
append 'FIELD2' to lt_header_exp.
append 'DEEP_STRUC' to lt_header_exp.
append 'DEEP_TAB' to lt_header_exp.
" Input
l_input = 'FIELD1\tFIELD2\tDEEP_STRUC\tDEEP_TAB\n'
&& '1\t111\t@ext[id=@field2]\t@ext[id=@field2]\n' " Test ref to field in current tab
&& '2\t222\t@ext[id=222]\t@ext[id=222]\n' " Test fixed value
&& '3\t333\t@ext[id=@field2]\t@ext[id=@field2]\n' " Test empty ext source
&& '4\t444\t\t\n'. " Test empty ref
replace all occurrences of '\t' in l_input with c_tab.
replace all occurrences of '\n' in l_input with c_lf.
" Run
data lt_act type tt_deep.
data lt_header_act type standard table of string.
data lo_deep_provider type ref to ltcl_deep_helper.
create object lo_deep_provider exporting i_tab = lt_sub.
try.
o = zcl_text2tab_parser=>create(
i_pattern = lt_exp
i_deep_provider = lo_deep_provider ).
o->parse(
exporting
i_data = l_input
importing
e_container = lt_act
e_head_fields = lt_header_act ).
cl_abap_unit_assert=>assert_equals( act = lt_act exp = lt_exp ).
cl_abap_unit_assert=>assert_equals( act = lt_header_act exp = lt_header_exp ).
catch zcx_text2tab_error into lx.
cl_abap_unit_assert=>fail( lx->get_text( ) ).
endtry.
endmethod.
method parse_corresponding.
data src_text type string.
data exp_base type tt_dummy.
data exp_tab type tt_dummy_corresponding.
data act_tab like exp_tab.
field-symbols <expb> like line of exp_base.
field-symbols <exp> like line of exp_tab.
get_dummy_data(
importing
e_dummy_tab = exp_base
e_dummy_string = src_text ).
loop at exp_base assigning <expb>.
append initial line to exp_tab assigning <exp>.
move-corresponding <expb> to <exp>.
endloop.
o = zcl_text2tab_parser=>create( c_dummy_corresponding ).
o->parse(
exporting
i_data = src_text
i_corresponding = abap_true
i_strict = abap_false
importing
e_container = act_tab ).
cl_abap_unit_assert=>assert_equals(
act = act_tab
exp = exp_tab ).
endmethod.
method parse_ignore_convexit.
types:
begin of lty_dummy,
uom type msehi,
end of lty_dummy.
data lt_exp type table of lty_dummy.
data lt_act type table of lty_dummy.
data lv_src type string.
lv_src = 'UOM\nKG\nPC'. " => KG, ST
replace all occurrences of '\n' in lv_src with c_crlf.
" IMPORTANT !! PC -> ST may not present in all systems !
" If this method fails, probably just comment first part of the test (without ignore)
" Part 1 - no ignore
zcl_text2tab_parser=>create( lt_act )->parse(
exporting
i_data = lv_src
importing
e_container = lt_act ).
clear lt_exp.
append 'KG' to lt_exp.
append 'ST' to lt_exp.
cl_abap_unit_assert=>assert_equals(
act = lt_act
exp = lt_exp ).
" Part 2 - ignore CUNIT
zcl_text2tab_parser=>create( lt_act )->ignore_conv_exit( 'CUNIT' )->parse(
exporting
i_data = lv_src
importing
e_container = lt_act ).
clear lt_exp.
append 'KG' to lt_exp.
append 'PC' to lt_exp. " No conversion
cl_abap_unit_assert=>assert_equals(
act = lt_act
exp = lt_exp ).
endmethod.
endclass.
| 32.148515 | 116 | 0.609774 |
79dc223bce20b32c16bdacb907dca55cda4ac253 | 2,941 | abap | ABAP | src/legacy/#dmo#flight_travel_api03.fugr.#dmo#flight_travel_create03.abap | SAP-Cloud-Platform/flight03 | ad1cf6a14e72c57a6fe3d552fd759937e12e3ad7 | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#flight_travel_api03.fugr.#dmo#flight_travel_create03.abap | SAP-Cloud-Platform/flight03 | ad1cf6a14e72c57a6fe3d552fd759937e12e3ad7 | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#flight_travel_api03.fugr.#dmo#flight_travel_create03.abap | SAP-Cloud-Platform/flight03 | ad1cf6a14e72c57a6fe3d552fd759937e12e3ad7 | [
"BSD-Source-Code"
] | null | null | null | "! <h1>API for Creating a Travel</h1>
"!
"! <p>
"! Function module to create a single Travel instance with the possibility to create related Bookings and
"! Booking Supplements in the same call (so called deep-create).
"! </p>
"!
"! <p>
"! The <em>travel_id</em> will be provided be the API but the IDs of Booking <em>booking_id</em> as well
"! of Booking Supplements <em>booking_id</em> and <em>booking_supplement_id</em>.
"! </p>
"!
"!
"! @parameter is_travel | Travel Data
"! @parameter it_booking | Table of predefined Booking Key <em>booking_id</em> and Booking Data
"! @parameter it_booking_supplement | Table of predefined Booking Supplement Key <em>booking_id</em>, <em>booking_supplement_id</em> and Booking Supplement Data
"! @parameter es_travel | Evaluated Travel Data like /DMO/TRAVEL03
"! @parameter et_booking | Table of evaluated Bookings like /DMO/BOOKING03
"! @parameter et_booking_supplement | Table of evaluated Booking Supplements like /DMO/BOOK_SUP_03
"! @parameter et_messages | Table of occurred messages
"!
FUNCTION /DMO/FLIGHT_TRAVEL_CREATE03.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IS_TRAVEL) TYPE /DMO/IF_FLIGHT_LEGACY03=>TS_TRAVEL_IN
*" REFERENCE(IT_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY03=>TT_BOOKING_IN
*" OPTIONAL
*" REFERENCE(IT_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY03=>TT_BOOKING_SUPPLEMENT_IN OPTIONAL
*" EXPORTING
*" REFERENCE(ES_TRAVEL) TYPE /DMO/TRAVEL03
*" REFERENCE(ET_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY03=>TT_BOOKING
*" REFERENCE(ET_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY03=>TT_BOOKING_SUPPLEMENT
*" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY03=>TT_MESSAGE
*"----------------------------------------------------------------------
CLEAR es_travel.
CLEAR et_booking.
CLEAR et_booking_supplement.
CLEAR et_messages.
/dmo/cl_flight_legacy03=>get_instance( )->create_travel( EXPORTING is_travel = is_travel
it_booking = it_booking
it_booking_supplement = it_booking_supplement
IMPORTING es_travel = es_travel
et_booking = et_booking
et_booking_supplement = et_booking_supplement
et_messages = DATA(lt_messages) ).
/dmo/cl_flight_legacy03=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages
IMPORTING et_messages = et_messages ).
ENDFUNCTION.
| 54.462963 | 160 | 0.579395 |
79e005ab2e7bba9ac61c3fc439541c6fa7d43e68 | 185 | abap | ABAP | src/zcl_eui_logger.clas.macros.abap | bizhuka/eui | 90695f86799f3baf15b99951e2f17281fc2ae3e9 | [
"Apache-2.0"
] | 43 | 2020-04-28T07:35:31.000Z | 2022-02-28T02:40:57.000Z | src/zcl_eui_logger.clas.macros.abap | bizhuka/eui | 90695f86799f3baf15b99951e2f17281fc2ae3e9 | [
"Apache-2.0"
] | 2 | 2020-04-23T16:07:01.000Z | 2020-04-25T07:29:54.000Z | src/zcl_eui_logger.clas.macros.abap | bizhuka/eui | 90695f86799f3baf15b99951e2f17281fc2ae3e9 | [
"Apache-2.0"
] | 5 | 2020-04-23T07:42:26.000Z | 2021-05-13T12:19:32.000Z | *"* use this source file for any macro definitions you need
*"* in the implementation part of the class
DEFINE set_default.
IF &1 IS INITIAL.
&1 = &2.
ENDIF.
END-OF-DEFINITION.
| 20.555556 | 59 | 0.702703 |
79e1d81fb3d2d3d9116a34f4dd191c9b6e9fb7f3 | 718 | abap | ABAP | src/zcx_credit_calculator.clas.abap | germanysources/cds_samples | c1a0efe829ea4c788b9d518a3e025d1ebe54122c | [
"MIT"
] | null | null | null | src/zcx_credit_calculator.clas.abap | germanysources/cds_samples | c1a0efe829ea4c788b9d518a3e025d1ebe54122c | [
"MIT"
] | null | null | null | src/zcx_credit_calculator.clas.abap | germanysources/cds_samples | c1a0efe829ea4c788b9d518a3e025d1ebe54122c | [
"MIT"
] | null | null | null | class ZCX_CREDIT_CALCULATOR definition
public
inheriting from CX_SADL_EXIT
final
create public .
public section.
constants ENTITY_NOT_SUPPORTED type SOTR_CONC value '39AC48DD21231EEA84F2040017B744C4' ##NO_TEXT.
constants FILTER_ELEMENT_WRONG type SOTR_CONC value '39AC48DD21231EEA86B273B3B726CF52' ##NO_TEXT.
methods CONSTRUCTOR
importing
!TEXTID like TEXTID optional
!PREVIOUS type ref to CX_ROOT optional .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCX_CREDIT_CALCULATOR IMPLEMENTATION.
METHOD constructor ##ADT_SUPPRESS_GENERATION.
CALL METHOD super->constructor
EXPORTING
textid = textid
previous = previous.
ENDMETHOD.
ENDCLASS.
| 22.4375 | 99 | 0.767409 |
79e44361e9fa2b832dfeb80f6b116128230de317 | 1,596 | abap | ABAP | guide/database.abap | byzhi/abap | 8d88125515737d7cb7948da0bf84e3ee303c5f65 | [
"MIT"
] | null | null | null | guide/database.abap | byzhi/abap | 8d88125515737d7cb7948da0bf84e3ee303c5f65 | [
"MIT"
] | null | null | null | guide/database.abap | byzhi/abap | 8d88125515737d7cb7948da0bf84e3ee303c5f65 | [
"MIT"
] | null | null | null | *&---------------------------------------------------------------------*
*& Report Z_DATABASE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
* # ABAP Dictionary
* https://help.sap.com/saphelp_nwes72/helpdata/en/cf/21ea0b446011d189700000e8322d00/frameset.htm
* use the ABAP Dictionary to create and manage data definitions (metadata).
* 'se11'
* database table: spfli
* https://www.sapdatasheet.org/abap/tabl/spfli.html
* show table contects
* utilities -> table contects -> display
REPORT Z_DATABASE.
* select * from table
DATA: wa_scarr TYPE scarr.
SELECT SINGLE *
FROM scarr
INTO wa_scarr.
WRITE: wa_scarr-carrid, wa_scarr-carrname, wa_scarr-currcode.
* select single
TYPES: BEGIN OF ty_spfli,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
countryfr TYPE spfli-countryfr,
countryto TYPE spfli-countryto,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF ty_spfli.
DATA wa_spfli TYPE ty_spfli.
SELECT SINGLE carrid connid countryfr countryto cityfrom cityto
FROM spfli
INTO CORRESPONDING FIELDS OF wa_spfli
WHERE carrid = 'AA' AND connid = '0017'.
* if result
IF sy-subrc = 0.
WRITE: wa_spfli-carrid, wa_spfli-connid, wa_spfli-countryfr, wa_spfli-countryto, wa_spfli-cityfrom, wa_spfli-cityto, wa_spfli-cityto.
* if no result
ELSE.
WRITE: 'no result.'.
ENDIF.
* select multi
DATA wa_spfli2 TYPE spfli.
SELECT *
FROM spfli
INTO wa_spfli2.
WRITE: / wa_spfli2-carrid, wa_spfli2-connid, wa_spfli2-cityfrom, wa_spfli2-cityto.
ENDSELECT. | 24.553846 | 136 | 0.657268 |
79e9c26918590421cc9a3be137085d626e8839f4 | 1,655 | abap | ABAP | src/utils/zcl_abapgit_hash.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/utils/zcl_abapgit_hash.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/utils/zcl_abapgit_hash.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z |
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS FINAL.
PRIVATE SECTION.
METHODS:
adler32 FOR TESTING,
sha1 FOR TESTING RAISING zcx_abapgit_exception,
sha1_raw_valid FOR TESTING RAISING zcx_abapgit_exception,
sha1_raw_invalid FOR TESTING RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD adler32.
DATA: lv_adler TYPE zif_abapgit_definitions=>ty_adler32.
lv_adler = zcl_abapgit_hash=>adler32( '1122334455667788' ).
cl_abap_unit_assert=>assert_equals(
act = lv_adler
exp = '08000265' ).
ENDMETHOD.
METHOD sha1.
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1.
lv_sha1 = zcl_abapgit_hash=>sha1(
iv_type = zif_abapgit_definitions=>c_type-commit
iv_data = '112211221122' ).
cl_abap_unit_assert=>assert_equals(
act = lv_sha1
exp = 'af2261a340c5188baf86a64a581d22012303023c' ).
ENDMETHOD.
METHOD sha1_raw_valid.
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1,
lv_input TYPE xstring.
lv_input = 'C5188BAF86A64A581D2201'.
lv_sha1 = zcl_abapgit_hash=>sha1_raw( lv_input ).
cl_abap_unit_assert=>assert_equals(
act = lv_sha1
exp = '0ec2eba75071f87988ced3237cae5ec7c5efd795' ).
ENDMETHOD.
METHOD sha1_raw_invalid.
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1,
lv_input TYPE xstring.
lv_input = 'LOREM_IPSUM'.
lv_sha1 = zcl_abapgit_hash=>sha1_raw( lv_input ).
cl_abap_unit_assert=>assert_equals(
act = lv_sha1
exp = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ).
ENDMETHOD.
ENDCLASS.
| 22.364865 | 65 | 0.720846 |
79ee37bd8fb62feb352b2acb042fe0237dc7ef83 | 16,519 | abap | ABAP | #gal#job_sap.clas.abap | galileo-group/galileo-abap-lib | a013885096af9bc461d6000ad27b91789f150d00 | [
"MIT"
] | 2 | 2017-11-02T12:33:44.000Z | 2019-10-14T10:10:13.000Z | #gal#job_sap.clas.abap | galileo-group/galileo-abap-lib | a013885096af9bc461d6000ad27b91789f150d00 | [
"MIT"
] | 1 | 2017-11-05T19:36:27.000Z | 2020-10-23T14:35:47.000Z | #gal#job_sap.clas.abap | galileo-group/galileo-abap-lib | a013885096af9bc461d6000ad27b91789f150d00 | [
"MIT"
] | null | null | null | "! <p class="shorttext synchronized" lang="en">SAP Job (report)</p>
CLASS /gal/job_sap DEFINITION
PUBLIC
INHERITING FROM /gal/job
FINAL
CREATE PRIVATE .
*"* public components of class /GAL/JOB_SAP
*"* do not include other source files here!!!
PUBLIC SECTION.
TYPE-POOLS abap .
"! <p class="shorttext synchronized" lang="en">ABAP Program: Current Main Program</p>
DATA program_name TYPE syrepid READ-ONLY .
"! <p class="shorttext synchronized" lang="en">rsparams Table</p>
DATA selection_table TYPE rsparams_tt READ-ONLY .
"! <p class="shorttext synchronized" lang="en">System ID</p>
DATA execution_system TYPE /gal/system_id .
"! <p class="shorttext synchronized" lang="en">Create Job from Parameters</p>
"!
"! @parameter job_name | <p class="shorttext synchronized" lang="en">Job name</p>
"! @parameter destination | <p class="shorttext synchronized" lang="en">RFC Route from central system to execution target</p>
"! @parameter execution_system | <p class="shorttext synchronized" lang="en">System ID</p>
"! @parameter program_name | <p class="shorttext synchronized" lang="en">ABAP Program: Current Main Program</p>
"! @parameter selection_table | <p class="shorttext synchronized" lang="en">rsparams Table</p>
"! @parameter job | <p class="shorttext synchronized" lang="en">SAP Job (report)</p>
"! @raising /gal/cx_js_exception | <p class="shorttext synchronized" lang="en">Exception from Job Scheduler</p>
CLASS-METHODS create_job
IMPORTING
!job_name TYPE btcjob DEFAULT 'BACKGROUND_JOB'
!destination TYPE string OPTIONAL
!execution_system TYPE /gal/system_id OPTIONAL
!program_name TYPE syrepid
!selection_table TYPE rsparams_tt OPTIONAL
!uc4_mode TYPE /gal/uc4_mode DEFAULT space
RETURNING
VALUE(job) TYPE REF TO /gal/job_sap
RAISING
/gal/cx_js_exception .
"! <p class="shorttext synchronized" lang="en">Beschreibugn für Jobtyp zurückgeben</p>
"!
"! @parameter classname | <p class="shorttext synchronized" lang="en">Classname of Job</p>
"! @parameter description | <p class="shorttext synchronized" lang="en">Description of Jobtype</p>
CLASS-METHODS get_jobtype_descr_jobspec
IMPORTING
!classname TYPE classname
EXPORTING
!description TYPE string .
"! <p class="shorttext synchronized" lang="en">Create Job from Database</p>
"!
"! @parameter id | <p class="shorttext synchronized" lang="en">Job ID</p>
"! @parameter undelete_before_init | <p class="shorttext synchronized" lang="en">Perform an Undelete before the init</p>
"! @parameter job | <p class="shorttext synchronized" lang="en">SAP Job (report)</p>
"! @raising /gal/cx_js_exception | <p class="shorttext synchronized" lang="en">Exception from Job Scheduler</p>
CLASS-METHODS read_job_from_db_jobspec
IMPORTING
!id TYPE /gal/job_id
!undelete_before_init TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(job) TYPE REF TO /gal/job_sap
RAISING
/gal/cx_js_exception .
METHODS delete_from_db
REDEFINITION .
METHODS execute_async
REDEFINITION .
METHODS get_program_name
REDEFINITION .
METHODS store_to_db
REDEFINITION .
PROTECTED SECTION.
*"* protected components of class /GAL/JOB_SAP
*"* do not include other source files here!!!
"! <p class="shorttext synchronized" lang="en">Init attributes from Parameters (subclass)</p>
"!
"! @parameter execution_system | <p class="shorttext synchronized" lang="en">System ID</p>
"! @parameter program_name | <p class="shorttext synchronized" lang="en">ABAP Program: Current Main Program</p>
"! @parameter selection_table | <p class="shorttext synchronized" lang="en">rsparams Table</p>
METHODS init_attrs_create_sap
IMPORTING
!execution_system TYPE /gal/system_id OPTIONAL
!program_name TYPE syrepid
!selection_table TYPE rsparams_tt OPTIONAL .
METHODS init_attrs_from_db
REDEFINITION .
PRIVATE SECTION.
*"* private components of class /GAL/JOB_SAP
*"* do not include other source files here!!!
"! <p class="shorttext synchronized" lang="en">Create Job from Database</p>
"!
"! @parameter id | <p class="shorttext synchronized" lang="en">Job ID</p>
"! @parameter undelete_before_init | <p class="shorttext synchronized" lang="en">Perform an Undelete before the init</p>
"! @parameter job | <p class="shorttext synchronized" lang="en">SAP Job (report)</p>
"! @raising /gal/cx_js_exception | <p class="shorttext synchronized" lang="en">Exception from Job Scheduler</p>
CLASS-METHODS read_job_from_db_sap
IMPORTING
!id TYPE /gal/job_id
!undelete_before_init TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(job) TYPE REF TO /gal/job_sap
RAISING
/gal/cx_js_exception .
ENDCLASS.
CLASS /gal/job_sap IMPLEMENTATION.
METHOD create_job.
DATA l_ex TYPE REF TO /gal/cx_js_exception.
IF NOT destination IS INITIAL AND execution_system IS INITIAL.
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>sap_job_dest_wo_exec_sys.
ENDIF.
* Create job
CREATE OBJECT job.
* Initialize base class
job->init_attrs_create( job_name = job_name
destination = destination
uc4_mode = uc4_mode ).
* Initialize SAP job
job->init_attrs_create_sap( execution_system = execution_system
program_name = program_name
selection_table = selection_table ).
* Store job in database
job->enqueue( refresh = abap_false ).
TRY.
job->store_to_db( ).
CATCH /gal/cx_js_exception INTO l_ex.
job->dequeue( ).
RAISE EXCEPTION l_ex.
ENDTRY.
job->dequeue( ).
ENDMETHOD.
METHOD delete_from_db.
DATA:
l_message TYPE string,
l_var1 TYPE string,
l_ex TYPE REF TO /gal/cx_js_exception,
l_key_value TYPE string.
enqueue( ).
l_key_value = id.
CALL FUNCTION '/GAL/JS_DB_COPY_ENTRY_TO_HIST'
EXPORTING
rfc_route_info = store_rfc_route_info
hist_table_name = '/GAL/JD01S_HIST'
table_name = '/GAL/JOBDATA01S'
key_field = 'ID'
key_value = l_key_value
EXCEPTIONS
rfc_exception = 1
cannot_create_hist_entry = 2
OTHERS = 3.
IF sy-subrc <> 0.
/gal/trace=>write_error( ).
ENDIF.
CALL FUNCTION '/GAL/JS_DB_DELETE'
EXPORTING
rfc_route_info = store_rfc_route_info
table_name = '/GAL/JOBDATA01S'
id = id
EXCEPTIONS
rfc_exception = 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
INTO l_message.
dequeue( ).
l_var1 = id.
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>cannot_delete_job_from_db
var1 = l_var1
var2 = '/GAL/JOBDATA01S'
var3 = l_message.
ENDIF.
TRY.
CALL METHOD super->delete_from_db
EXPORTING
force = force.
CATCH /gal/cx_js_exception INTO l_ex.
dequeue( ).
RAISE EXCEPTION l_ex.
ENDTRY.
dequeue( ).
ENDMETHOD.
METHOD execute_async.
DATA l_ex TYPE REF TO /gal/cx_js_exception.
DATA l_var1 TYPE string.
DATA l_list_object TYPE STANDARD TABLE OF abaplist.
DATA l_progname TYPE progname.
enqueue( ).
TRY.
super->execute_async( ).
SELECT SINGLE name INTO l_progname FROM trdir WHERE name = program_name. "#EC CI_SUBRC
IF l_progname IS INITIAL.
l_var1 = program_name.
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>programm_does_not_exist
var1 = l_var1.
ENDIF.
* Execute report and save list
SUBMIT (program_name)
WITH SELECTION-TABLE selection_table
EXPORTING LIST TO MEMORY
AND RETURN. "#EC CI_SUBMIT
* Write list to spool (if any)
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = l_list_object
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
CALL FUNCTION 'WRITE_LIST'
TABLES
listobject = l_list_object
EXCEPTIONS
OTHERS = 0.
ENDIF.
* Perform post processing
post_process( ).
/gal/job=>run_job_scheduler( ).
CATCH /gal/cx_js_exception INTO l_ex.
dequeue( ).
RAISE EXCEPTION l_ex.
ENDTRY.
dequeue( ).
ENDMETHOD.
METHOD get_jobtype_descr_jobspec.
description = TEXT-000.
ENDMETHOD.
METHOD get_program_name.
program_name = me->program_name.
ENDMETHOD.
METHOD init_attrs_create_sap.
me->execution_system = execution_system.
me->program_name = program_name.
me->selection_table = selection_table.
classname = '/GAL/JOB_SAP'.
ENDMETHOD.
METHOD init_attrs_from_db.
DATA:
l_table_line TYPE /gal/db_datas,
l_table_line_elem TYPE /gal/db_data,
l_message TYPE string,
l_var1 TYPE string,
l_xml_ex TYPE REF TO cx_transformation_error,
l_key_value TYPE string.
super->init_attrs_from_db(
undelete_before_init = undelete_before_init
id = id
).
classname = '/GAL/JOB_SAP'.
IF undelete_before_init = abap_true.
l_key_value = id.
CALL FUNCTION '/GAL/JS_DB_MOVE_HIST_E_TO_DB'
EXPORTING
rfc_route_info = store_rfc_route_info
hist_table_name = '/GAL/JD01S_HIST'
table_name = '/GAL/JOBDATA01S'
key_field = 'ID'
key_value = l_key_value
EXCEPTIONS
rfc_exception = 1
cannot_create_entry = 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
INTO l_message.
l_var1 = id.
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>cannot_undelete_job
var1 = l_var1
var2 = l_message.
ENDIF.
ENDIF.
IF read_from_hist = abap_false.
CALL FUNCTION '/GAL/JS_DB_SELECT_SINGLE'
EXPORTING
rfc_route_info = store_rfc_route_info
table_name = '/GAL/JOBDATA01S'
id = id
IMPORTING
table_line = l_table_line
EXCEPTIONS
no_data_found = 1
OTHERS = 2.
ELSE.
CALL FUNCTION '/GAL/JS_DB_SELECT_SINGLE'
EXPORTING
rfc_route_info = store_rfc_route_info
table_name = '/GAL/JD01S_HIST'
id = id
IMPORTING
table_line = l_table_line
EXCEPTIONS
no_data_found = 1
OTHERS = 2.
ENDIF.
IF sy-subrc = 1.
RAISE EXCEPTION TYPE /gal/cx_js_no_job_data_found
EXPORTING
textid = /gal/cx_js_no_job_data_found=>/gal/cx_js_no_job_data_found
var1 = l_var1
var2 = '/GAL/JOBDATA01S'.
ELSEIF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO l_message.
l_var1 = id.
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>cannot_read_job_from_db
var1 = l_var1
var2 = '/GAL/JOBDATA01S'
var3 = l_message.
ENDIF.
IF l_table_line IS INITIAL.
l_var1 = id.
RAISE EXCEPTION TYPE /gal/cx_js_no_job_data_found
EXPORTING
textid = /gal/cx_js_no_job_data_found=>/gal/cx_js_no_job_data_found
var1 = l_var1.
ENDIF.
CLEAR l_table_line_elem.
READ TABLE l_table_line WITH KEY attribute = 'PROGRAM_NAME' INTO l_table_line_elem.
IF sy-subrc = 0.
program_name = l_table_line_elem-value.
ENDIF.
READ TABLE l_table_line WITH KEY attribute = 'EXECUTION_SYSTEM' INTO l_table_line_elem.
IF sy-subrc = 0.
execution_system = l_table_line_elem-value.
ENDIF.
TRY.
CLEAR l_table_line_elem.
READ TABLE l_table_line WITH KEY attribute = 'SEL_TABLE_SER' INTO l_table_line_elem.
IF sy-subrc = 0.
CALL TRANSFORMATION id
OPTIONS value_handling = 'default'
SOURCE XML l_table_line_elem-value
RESULT selection_table = selection_table. "#EC NOTEXT
ENDIF.
CATCH cx_transformation_error INTO l_xml_ex.
CALL METHOD l_xml_ex->if_message~get_text
RECEIVING
result = l_var1.
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>error_deserializing_xml
var1 = l_var1.
ENDTRY.
ENDMETHOD.
METHOD read_job_from_db_jobspec.
read_job_from_db_sap(
EXPORTING
id = id
undelete_before_init = undelete_before_init
RECEIVING
job = job
).
ENDMETHOD.
METHOD read_job_from_db_sap.
CREATE OBJECT job.
job->init_attrs_from_db(
undelete_before_init = undelete_before_init
id = id
).
ENDMETHOD.
METHOD store_to_db.
DATA l_var1 TYPE string.
DATA lt_table_line TYPE /gal/db_datas.
DATA l_table_line_elem TYPE /gal/db_data.
DATA l_message TYPE string.
DATA l_xml_ex TYPE REF TO cx_transformation_error.
l_table_line_elem-attribute = 'ID'.
l_table_line_elem-value = id.
INSERT l_table_line_elem INTO TABLE lt_table_line.
l_table_line_elem-attribute = 'EXECUTION_SYSTEM'.
l_table_line_elem-value = execution_system.
INSERT l_table_line_elem INTO TABLE lt_table_line.
l_table_line_elem-attribute = 'PROGRAM_NAME'.
l_table_line_elem-value = program_name.
INSERT l_table_line_elem INTO TABLE lt_table_line.
TRY.
l_table_line_elem-attribute = 'SEL_TABLE_SER'.
CALL TRANSFORMATION id
OPTIONS data_refs = 'heap-or-create'
initial_components = 'include'
technical_types = 'error'
value_handling = 'default'
xml_header = 'full'
SOURCE selection_table = selection_table
RESULT XML l_table_line_elem-value. "#EC NOTEXT
INSERT l_table_line_elem INTO TABLE lt_table_line.
CATCH cx_transformation_error INTO l_xml_ex.
l_var1 = l_xml_ex->if_message~get_text( ).
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>error_creating_xml
var1 = l_var1.
ENDTRY.
CALL FUNCTION '/GAL/JS_DB_WRITE'
EXPORTING
rfc_route_info = store_rfc_route_info
table_name = '/GAL/JOBDATA01S'
table_line = lt_table_line
EXCEPTIONS
rfc_exception = 1
wrong_content_data = 2
cannot_write_to_db = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO l_message.
l_var1 = id.
RAISE EXCEPTION TYPE /gal/cx_js_exception
EXPORTING
textid = /gal/cx_js_exception=>cannot_create_job_in_db
var1 = l_var1
var2 = '/GAL/JOBDATA01S'
var3 = l_message.
ENDIF.
super->store_to_db( ).
ENDMETHOD.
ENDCLASS.
| 31.585086 | 138 | 0.610085 |
79eeeba671e89751876dcc8e8e4df006b72d4c15 | 7,295 | abap | ABAP | src/apack/zcl_abapgit_apack_reader.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/apack/zcl_abapgit_apack_reader.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/apack/zcl_abapgit_apack_reader.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_apack_reader DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
TYPES ty_package_name TYPE devclass .
CLASS-METHODS create_instance
IMPORTING
!iv_package_name TYPE ty_package_name
RETURNING
VALUE(ro_manifest_reader) TYPE REF TO zcl_abapgit_apack_reader .
CLASS-METHODS deserialize
IMPORTING
!iv_package_name TYPE ty_package_name
!iv_xstr TYPE xstring
RETURNING
VALUE(ro_manifest_reader) TYPE REF TO zcl_abapgit_apack_reader
RAISING
zcx_abapgit_exception.
METHODS get_manifest_descriptor
RETURNING
VALUE(rs_manifest_descriptor) TYPE zif_abapgit_apack_definitions=>ty_descriptor
RAISING
zcx_abapgit_exception.
METHODS set_manifest_descriptor
IMPORTING
!is_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor
RAISING
zcx_abapgit_exception.
METHODS copy_manifest_descriptor
IMPORTING
!io_manifest_provider TYPE REF TO object
RAISING
zcx_abapgit_exception.
METHODS has_manifest
RETURNING
VALUE(rv_has_manifest) TYPE abap_bool
RAISING
zcx_abapgit_exception.
METHODS constructor
IMPORTING
!iv_package_name TYPE ty_package_name .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_s_manifest_declaration,
clsname TYPE seoclsname,
devclass TYPE devclass,
END OF ty_s_manifest_declaration .
DATA mv_package_name TYPE ty_package_name .
DATA ms_cached_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor .
DATA mv_is_cached TYPE abap_bool .
CLASS-METHODS from_xml
IMPORTING
iv_xml TYPE string
RETURNING
VALUE(rs_data) TYPE zif_abapgit_apack_definitions=>ty_descriptor.
METHODS format_version
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_apack_reader IMPLEMENTATION.
METHOD constructor.
mv_package_name = iv_package_name.
ENDMETHOD.
METHOD copy_manifest_descriptor.
DATA: ls_my_manifest_wo_deps TYPE zif_abapgit_apack_definitions=>ty_descriptor_wo_dependencies,
ls_my_dependency TYPE zif_abapgit_apack_definitions=>ty_dependency,
ls_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor,
lv_descriptor_cust TYPE string,
lv_descriptor_sap TYPE string.
FIELD-SYMBOLS: <lg_descriptor> TYPE any,
<lt_dependencies> TYPE ANY TABLE,
<lg_dependency> TYPE any.
lv_descriptor_cust = zif_abapgit_apack_definitions=>c_apack_interface_cust && '~DESCRIPTOR'.
lv_descriptor_sap = zif_abapgit_apack_definitions=>c_apack_interface_sap && '~DESCRIPTOR'.
ASSIGN io_manifest_provider->(lv_descriptor_cust) TO <lg_descriptor>.
IF <lg_descriptor> IS NOT ASSIGNED.
ASSIGN io_manifest_provider->(lv_descriptor_sap) TO <lg_descriptor>.
ENDIF.
IF <lg_descriptor> IS ASSIGNED.
" A little more complex than a normal MOVE-CORRSPONDING
" to avoid dumps in case of future updates to the dependencies table structure
ASSIGN COMPONENT 'DEPENDENCIES' OF STRUCTURE <lg_descriptor> TO <lt_dependencies>.
IF <lt_dependencies> IS ASSIGNED.
LOOP AT <lt_dependencies> ASSIGNING <lg_dependency>.
MOVE-CORRESPONDING <lg_dependency> TO ls_my_dependency.
INSERT ls_my_dependency INTO TABLE ls_descriptor-dependencies.
ENDLOOP.
MOVE-CORRESPONDING <lg_descriptor> TO ls_my_manifest_wo_deps.
MOVE-CORRESPONDING ls_my_manifest_wo_deps TO ls_descriptor.
ENDIF.
ENDIF.
set_manifest_descriptor( ls_descriptor ).
ENDMETHOD.
METHOD create_instance.
CREATE OBJECT ro_manifest_reader
EXPORTING
iv_package_name = iv_package_name.
ENDMETHOD.
METHOD deserialize.
DATA: lv_xml TYPE string,
ls_data TYPE zif_abapgit_apack_definitions=>ty_descriptor.
lv_xml = zcl_abapgit_convert=>xstring_to_string_utf8( iv_xstr ).
ls_data = from_xml( lv_xml ).
ro_manifest_reader = create_instance( iv_package_name ).
ro_manifest_reader = create_instance( iv_package_name ).
ro_manifest_reader->set_manifest_descriptor( ls_data ).
ENDMETHOD.
METHOD format_version.
FIELD-SYMBOLS: <ls_dependency> TYPE zif_abapgit_apack_definitions=>ty_dependency.
TRANSLATE ms_cached_descriptor-version TO LOWER CASE.
ms_cached_descriptor-sem_version = zcl_abapgit_version=>conv_str_to_version( ms_cached_descriptor-version ).
LOOP AT ms_cached_descriptor-dependencies ASSIGNING <ls_dependency>.
<ls_dependency>-sem_version = zcl_abapgit_version=>conv_str_to_version( <ls_dependency>-version ).
ENDLOOP.
ENDMETHOD.
METHOD from_xml.
DATA: lv_xml TYPE string.
lv_xml = iv_xml.
CALL TRANSFORMATION id
OPTIONS value_handling = 'accept_data_loss'
SOURCE XML lv_xml
RESULT data = rs_data.
ENDMETHOD.
METHOD get_manifest_descriptor.
DATA: lo_manifest_provider TYPE REF TO object,
ls_manifest_implementation TYPE ty_s_manifest_declaration.
IF mv_is_cached IS INITIAL AND mv_package_name IS NOT INITIAL.
SELECT SINGLE seometarel~clsname tadir~devclass FROM seometarel "#EC CI_NOORDER
INNER JOIN tadir ON seometarel~clsname = tadir~obj_name "#EC CI_BUFFJOIN
INTO ls_manifest_implementation
WHERE tadir~pgmid = 'R3TR' AND
tadir~object = 'CLAS' AND
seometarel~version = '1' AND
seometarel~refclsname = zif_abapgit_apack_definitions=>c_apack_interface_cust AND
tadir~devclass = mv_package_name.
IF ls_manifest_implementation IS INITIAL.
SELECT SINGLE seometarel~clsname tadir~devclass FROM seometarel "#EC CI_NOORDER
INNER JOIN tadir ON seometarel~clsname = tadir~obj_name "#EC CI_BUFFJOIN
INTO ls_manifest_implementation
WHERE tadir~pgmid = 'R3TR' AND
tadir~object = 'CLAS' AND
seometarel~version = '1' AND
seometarel~refclsname = zif_abapgit_apack_definitions=>c_apack_interface_sap AND
tadir~devclass = mv_package_name.
ENDIF.
IF ls_manifest_implementation IS NOT INITIAL.
TRY.
CREATE OBJECT lo_manifest_provider TYPE (ls_manifest_implementation-clsname).
CATCH cx_sy_create_object_error.
CLEAR: rs_manifest_descriptor.
ENDTRY.
IF lo_manifest_provider IS BOUND.
copy_manifest_descriptor( lo_manifest_provider ).
ENDIF.
ENDIF.
mv_is_cached = abap_true.
ENDIF.
rs_manifest_descriptor = ms_cached_descriptor.
ENDMETHOD.
METHOD has_manifest.
DATA: ls_returned_manifest TYPE zif_abapgit_apack_definitions=>ty_descriptor.
ls_returned_manifest = get_manifest_descriptor( ).
rv_has_manifest = abap_false.
IF ls_returned_manifest IS NOT INITIAL.
rv_has_manifest = abap_true.
ENDIF.
ENDMETHOD.
METHOD set_manifest_descriptor.
mv_is_cached = abap_true.
ms_cached_descriptor = is_manifest_descriptor.
format_version( ).
ENDMETHOD.
ENDCLASS.
| 31.175214 | 112 | 0.714462 |
79f0a144674fb51fd89e3a104c5130639de070f1 | 1,972 | abap | ABAP | kapitel_04/zbook_ticket_save.fugr.z_rfc_read_form.abap | abapkochbuch/Sources | 159775b787fcbc4c6b7eff01e505144b7c33a437 | [
"MIT"
] | 12 | 2018-06-22T10:55:06.000Z | 2022-03-22T12:10:48.000Z | kapitel_04/zbook_ticket_save.fugr.z_rfc_read_form.abap | abapkochbuch/Sources | 159775b787fcbc4c6b7eff01e505144b7c33a437 | [
"MIT"
] | 5 | 2018-06-25T11:45:26.000Z | 2019-09-04T19:41:55.000Z | kapitel_04/zbook_ticket_save.fugr.z_rfc_read_form.abap | abapkochbuch/Sources | 159775b787fcbc4c6b7eff01e505144b7c33a437 | [
"MIT"
] | 7 | 2018-07-02T14:20:28.000Z | 2022-03-25T19:33:33.000Z | FUNCTION z_rfc_read_form.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(CLIENT) LIKE SY-MANDT DEFAULT SY-MANDT
*" VALUE(FORM) LIKE ITCTA-TDFORM
*" VALUE(LANGUAGE) LIKE SY-LANGU DEFAULT SY-LANGU
*" VALUE(OLANGUAGE) LIKE SY-LANGU DEFAULT SPACE
*" VALUE(OSTATUS) LIKE ITCTA-TDSTATUS DEFAULT SPACE
*" VALUE(STATUS) LIKE ITCTA-TDSTATUS DEFAULT SPACE
*" VALUE(THROUGHCLIENT) TYPE CHAR01 DEFAULT SPACE
*" VALUE(READ_ONLY_HEADER) TYPE CHAR01 DEFAULT SPACE
*" VALUE(THROUGHLANGUAGE) TYPE CHAR01 DEFAULT SPACE
*" EXPORTING
*" VALUE(FORM_HEADER) LIKE ITCTA STRUCTURE ITCTA
*" VALUE(FOUND) TYPE CHAR01
*" VALUE(HEADER) LIKE THEAD STRUCTURE THEAD
*" VALUE(OLANGUAGE) LIKE SY-LANGU
*" TABLES
*" FORM_LINES STRUCTURE TLINE OPTIONAL
*" PAGES STRUCTURE ITCTG OPTIONAL
*" PAGE_WINDOWS STRUCTURE ITCTH OPTIONAL
*" PARAGRAPHS STRUCTURE ITCDP OPTIONAL
*" STRINGS STRUCTURE ITCDS OPTIONAL
*" TABS STRUCTURE ITCDQ OPTIONAL
*" WINDOWS STRUCTURE ITCTW OPTIONAL
*"----------------------------------------------------------------------
CALL FUNCTION 'READ_FORM'
EXPORTING
client = sy-mandt
form = form
language = sy-langu
olanguage = olanguage
ostatus = ostatus
status = status
throughclient = throughclient
read_only_header = read_only_header
throughlanguage = throughlanguage
IMPORTING
form_header = form_header
found = found
header = header
olanguage = olanguage
TABLES
form_lines = form_lines
pages = pages
page_windows = page_windows
paragraphs = paragraphs
strings = strings
tabs = tabs
windows = windows.
ENDFUNCTION.
| 35.214286 | 72 | 0.573022 |
79f19c7197ecdc095f3b53ffcbabe69b71dcbdfa | 1,932 | abap | ABAP | src/zcl_index.clas.abap | JohannesKonings/test-abap-aws-lambda | 9931f9ce12cc53dc6b105691636fcbefba702d79 | [
"MIT"
] | null | null | null | src/zcl_index.clas.abap | JohannesKonings/test-abap-aws-lambda | 9931f9ce12cc53dc6b105691636fcbefba702d79 | [
"MIT"
] | null | null | null | src/zcl_index.clas.abap | JohannesKonings/test-abap-aws-lambda | 9931f9ce12cc53dc6b105691636fcbefba702d79 | [
"MIT"
] | null | null | null | CLASS zcl_index DEFINITION PUBLIC.
PUBLIC SECTION.
TYPES: BEGIN OF ty_header,
field TYPE string,
value TYPE string,
END OF ty_header.
TYPES ty_headers TYPE STANDARD TABLE OF ty_header WITH DEFAULT KEY.
TYPES: BEGIN OF ty_http,
headers TYPE ty_headers,
body TYPE string,
END OF ty_http.
METHODS:
logic
RETURNING
VALUE(rv_text) TYPE string,
run
IMPORTING
method TYPE string OPTIONAL
path TYPE string OPTIONAL
query TYPE string OPTIONAL
request TYPE ty_http OPTIONAL
RETURNING
VALUE(response) TYPE ty_http
RAISING
cx_static_check.
ENDCLASS.
CLASS zcl_index IMPLEMENTATION.
METHOD logic.
DATA: lv_text TYPE string,
lv_string TYPE string,
lt_words TYPE STANDARD TABLE OF string,
lt_letters TYPE STANDARD TABLE OF string,
lv_word TYPE string.
lv_string = `serverless is fun`.
SPLIT lv_string AT | | INTO TABLE lt_words.
DELETE lt_words WHERE table_line = ''.
lv_text = |Number of words: { lines( lt_words ) }\n|.
LOOP AT lt_words INTO lv_word.
lv_text = |{ lv_text }Number of unique characters in the word: { lv_word } -|.
CLEAR lt_letters.
WHILE lv_word <> ''.
APPEND lv_word(1) TO lt_letters.
lv_word = lv_word+1.
ENDWHILE.
SORT lt_letters.
DELETE ADJACENT DUPLICATES FROM lt_letters.
lv_text = |{ lv_text } { lines( lt_letters ) }\n|.
ENDLOOP.
rv_text = lv_text.
ENDMETHOD.
METHOD run.
response-body = |hello world { method } { path } { query }\n{ logic( ) }|.
DATA ls_header TYPE ty_header.
ls_header-field = 'content-type'.
ls_header-value = 'text/plain'.
APPEND ls_header TO response-headers.
ENDMETHOD.
ENDCLASS. | 24.455696 | 84 | 0.60559 |
79f24f449291d8adfa25c3eb37014d8563fea59e | 13,747 | abap | ABAP | src/profiles/y_profile_manager.clas.abap | jrodriguez-rc/code-pal-for-abap | 3f6ed019f33941a226575b7239c60596c8305b45 | [
"Apache-2.0"
] | 2 | 2020-06-23T13:27:21.000Z | 2020-11-03T12:19:18.000Z | src/profiles/y_profile_manager.clas.abap | jrodriguez-rc/code-pal-for-abap | 3f6ed019f33941a226575b7239c60596c8305b45 | [
"Apache-2.0"
] | null | null | null | src/profiles/y_profile_manager.clas.abap | jrodriguez-rc/code-pal-for-abap | 3f6ed019f33941a226575b7239c60596c8305b45 | [
"Apache-2.0"
] | null | null | null | CLASS y_profile_manager DEFINITION PUBLIC CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES y_if_profile_manager.
ALIASES create FOR y_if_profile_manager~create.
ALIASES get_checks_from_db for y_if_profile_manager~get_checks_from_db.
PROTECTED SECTION.
METHODS has_time_collision
IMPORTING timeline_one_start TYPE dats
timeline_one_end TYPE dats
timeline_two_start TYPE dats
timeline_two_end TYPE dats
RETURNING VALUE(result) TYPE abap_bool.
METHODS is_point_in_time
IMPORTING time_start TYPE dats
time_end TYPE dats
point TYPE dats
RETURNING VALUE(result) TYPE abap_bool.
PRIVATE SECTION.
CONSTANTS: checks_type TYPE tabname VALUE 'YTAB_CHECKS',
delegates_type TYPE tabname VALUE 'YTAB_DELEGATES',
profiles_type TYPE tabname VALUE 'YTAB_PROFILES'.
CONSTANTS standardprofile TYPE ytab_profiles-profile VALUE 'SYSTEM-WIDE STANDARD'.
CLASS-METHODS get_check_base_package RETURNING value(result) TYPE devclass.
CLASS-METHODS get_checks_package RETURNING value(result) TYPE devclass.
ENDCLASS.
CLASS y_profile_manager IMPLEMENTATION.
METHOD has_time_collision.
result = xsdbool( is_point_in_time( time_start = timeline_one_start
time_end = timeline_one_end
point = timeline_two_start ) OR
is_point_in_time( time_start = timeline_one_start
time_end = timeline_one_end
point = timeline_two_end ) OR
is_point_in_time( time_start = timeline_two_start
time_end = timeline_two_end
point = timeline_one_start ) OR
is_point_in_time( time_start = timeline_two_start
time_end = timeline_two_end
point = timeline_one_end ) ).
ENDMETHOD.
METHOD is_point_in_time.
result = xsdbool( time_start LE point AND time_end GE point ).
ENDMETHOD.
METHOD y_if_profile_manager~check_delegation_rights.
SELECT * FROM ytab_delegates INTO TABLE @DATA(table) WHERE profile = @profile AND delegate = @sy-uname.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_no_delegation_rights.
ENDIF.
ENDMETHOD.
METHOD y_if_profile_manager~check_time_overlap.
IF check-start_date > check-end_date.
RAISE EXCEPTION TYPE ycx_time_overlap.
ENDIF.
DATA table TYPE SORTED TABLE OF ytab_checks WITH UNIQUE KEY profile
checkid
start_date
end_date
objects_created_on
prio
apply_on_testcode.
SELECT * FROM ytab_checks INTO TABLE @table WHERE profile EQ @check-profile AND
checkid EQ @check-checkid AND
prio EQ @check-prio AND
objects_created_on EQ @check-objects_created_on AND
apply_on_testcode EQ @check-apply_on_testcode.
IF sy-subrc EQ 0.
IF selected_check IS NOT INITIAL.
DELETE TABLE table WITH TABLE KEY profile = selected_check-profile
checkid = selected_check-checkid
start_date = selected_check-start_date
end_date = selected_check-end_date
objects_created_on = selected_check-objects_created_on
prio = selected_check-prio
apply_on_testcode = selected_check-apply_on_testcode.
ENDIF.
LOOP AT table INTO DATA(line).
IF has_time_collision( timeline_one_start = line-start_date
timeline_one_end = line-end_date
timeline_two_start = check-start_date
timeline_two_end = check-end_date ) EQ abap_true.
RAISE EXCEPTION TYPE ycx_time_overlap.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD y_if_profile_manager~delete_check.
DELETE FROM ytab_checks WHERE profile EQ @check-profile AND
checkid EQ @check-checkid AND
start_date EQ @check-start_date AND
end_date EQ @check-end_date AND
objects_created_on EQ @check-objects_created_on AND
prio EQ @check-prio AND
threshold EQ @check-threshold AND
apply_on_testcode EQ @check-apply_on_testcode.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_failed_to_remove_a_line.
ENDIF.
COMMIT WORK.
ENDMETHOD.
METHOD y_if_profile_manager~delete_delegate.
DELETE FROM ytab_delegates WHERE profile EQ @delegate-profile AND
delegate EQ @delegate-delegate.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_failed_to_remove_a_line.
ENDIF.
COMMIT WORK.
ENDMETHOD.
METHOD y_if_profile_manager~delete_profile.
IF profile-is_standard EQ abap_true.
RAISE EXCEPTION TYPE ycx_failed_to_remove_a_line.
ENDIF.
DELETE FROM ytab_profiles WHERE username EQ @profile-username AND
profile EQ @profile-profile AND
is_standard EQ @abap_false.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_failed_to_remove_a_line.
ENDIF.
TRY.
y_if_profile_manager~select_checks( profile-profile ).
CATCH ycx_entry_not_found.
DELETE FROM ytab_delegates WHERE profile EQ @profile-profile.
ENDTRY.
COMMIT WORK.
ENDMETHOD.
METHOD y_if_profile_manager~get_checks_type_name.
result = checks_type.
ENDMETHOD.
METHOD y_if_profile_manager~get_check_description.
SELECT SINGLE descript FROM vseoclass WHERE langu EQ @sy-langu AND clsname EQ @classname INTO @result.
IF sy-subrc NE 0.
SELECT SINGLE descript FROM vseoclass WHERE clsname EQ @classname INTO @result.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_entry_not_found.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD y_if_profile_manager~get_delegates_type_name.
result = delegates_type.
ENDMETHOD.
METHOD y_if_profile_manager~get_profiles_type_name.
result = profiles_type.
ENDMETHOD.
METHOD y_if_profile_manager~get_registered_profiles.
SELECT profile FROM ytab_checks APPENDING TABLE @result.
DATA(prof_subrc) = sy-subrc.
SELECT profile FROM ytab_profiles APPENDING TABLE @result.
IF sy-subrc NE 0 AND
prof_subrc NE 0.
RAISE EXCEPTION TYPE ycx_entry_not_found.
ENDIF.
SORT result AS TEXT ASCENDING.
DELETE ADJACENT DUPLICATES FROM result.
ENDMETHOD.
METHOD y_if_profile_manager~import_profile.
DATA(profile) = structure-profile.
DATA(delegates) = structure-delegates.
DATA(checks) = structure-checks.
IF y_if_profile_manager~profile_exists( profile-profile ).
y_if_profile_manager~check_delegation_rights( profile-profile ).
ENDIF.
profile-last_changed_by = sy-uname.
profile-last_changed_on = sy-datum.
profile-last_changed_at = sy-timlo.
y_if_profile_manager~insert_profile( profile ).
y_if_profile_manager~cleanup_profile( profile-profile ).
LOOP AT delegates ASSIGNING FIELD-SYMBOL(<delegate>).
y_if_profile_manager~insert_delegate( <delegate> ).
ENDLOOP.
LOOP AT checks ASSIGNING FIELD-SYMBOL(<check>).
<check>-last_changed_by = sy-uname.
<check>-last_changed_on = sy-datum.
<check>-last_changed_at = sy-timlo.
y_if_profile_manager~insert_check( <check> ).
ENDLOOP.
ENDMETHOD.
METHOD y_if_profile_manager~insert_check.
INSERT INTO ytab_checks VALUES check.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_failed_to_add_a_line.
ENDIF.
COMMIT WORK.
ENDMETHOD.
METHOD y_if_profile_manager~insert_delegate.
INSERT INTO ytab_delegates VALUES delegate.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_failed_to_add_a_line.
ENDIF.
COMMIT WORK.
ENDMETHOD.
METHOD y_if_profile_manager~insert_profile.
IF profile-is_standard EQ abap_true OR
profile-profile EQ standardprofile.
RAISE EXCEPTION TYPE ycx_failed_to_add_a_line.
ENDIF.
MODIFY ytab_profiles FROM profile.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_failed_to_add_a_line.
ENDIF.
COMMIT WORK AND WAIT.
TRY.
y_if_profile_manager~select_delegates( profile-profile ).
CATCH ycx_entry_not_found.
y_if_profile_manager~insert_delegate( VALUE ytab_delegates( profile = profile-profile
delegate = sy-uname ) ).
ENDTRY.
ENDMETHOD.
METHOD y_if_profile_manager~register_standard_profile.
SELECT SINGLE * FROM ytab_profiles INTO @DATA(line) WHERE is_standard = @abap_true.
IF sy-subrc NE 0.
DATA(profile) = VALUE ytab_profiles( username = 'ADMIN'
profile = standardprofile
is_standard = abap_true
last_changed_by = 'ADMIN'
last_changed_on = sy-datlo
last_changed_at = sy-timlo ). "#EC DECL_IN_IF
INSERT INTO ytab_profiles VALUES profile.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE cx_failed.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD y_if_profile_manager~select_checks.
SELECT * FROM ytab_checks INTO TABLE @result WHERE profile = @profile.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_entry_not_found.
ENDIF.
ENDMETHOD.
METHOD y_if_profile_manager~select_delegates.
SELECT * FROM ytab_delegates INTO TABLE @result WHERE profile = @profile.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_entry_not_found.
ENDIF.
ENDMETHOD.
METHOD y_if_profile_manager~select_existing_checks.
DATA(checks) = get_checks_from_db( ).
IF checks IS INITIAL.
RAISE EXCEPTION TYPE ycx_entry_not_found.
ENDIF.
LOOP AT checks ASSIGNING FIELD-SYMBOL(<line>).
SELECT SINGLE clsname, descript
FROM vseoclass
INTO @DATA(line)
WHERE ( langu EQ @sy-langu OR langu EQ 'E' )
AND clsname EQ @<line>-obj_name.
IF sy-subrc = 0.
APPEND line TO result.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD y_if_profile_manager~select_profiles.
SELECT * FROM ytab_profiles INTO TABLE @result WHERE username = @username OR
is_standard = @abap_true.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_entry_not_found.
ENDIF.
LOOP AT result ASSIGNING FIELD-SYMBOL(<line>) WHERE username NE username AND is_standard = abap_true.
<line>-username = username.
ENDLOOP.
UNASSIGN <line>.
ENDMETHOD.
METHOD y_if_profile_manager~select_all_profiles.
SELECT * FROM ytab_profiles INTO TABLE @result.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE ycx_entry_not_found.
ENDIF.
ENDMETHOD.
METHOD y_if_profile_manager~cleanup_profile.
y_if_profile_manager~remove_all_delegates( profile ).
y_if_profile_manager~remove_all_checks( profile ).
ENDMETHOD.
METHOD y_if_profile_manager~remove_all_delegates.
TRY.
DATA(delegates) = y_if_profile_manager~select_delegates( profile ).
CATCH ycx_entry_not_found.
RETURN.
ENDTRY.
LOOP AT delegates ASSIGNING FIELD-SYMBOL(<delegate>).
TRY.
y_if_profile_manager~delete_delegate( <delegate> ).
CATCH ycx_failed_to_remove_a_line.
CONTINUE.
ENDTRY.
ENDLOOP.
ENDMETHOD.
METHOD y_if_profile_manager~remove_all_checks.
TRY.
DATA(checks) = y_if_profile_manager~select_checks( profile ).
CATCH ycx_entry_not_found.
RETURN.
ENDTRY.
LOOP AT checks ASSIGNING FIELD-SYMBOL(<check>).
TRY.
y_if_profile_manager~delete_check( <check> ).
CATCH ycx_failed_to_remove_a_line.
CONTINUE.
ENDTRY.
ENDLOOP.
ENDMETHOD.
METHOD y_if_profile_manager~profile_exists.
try.
"Based on Delegates because the profile might be inactive
result = xsdbool( y_if_profile_manager~select_delegates( name ) IS NOT INITIAL ).
catch ycx_entry_not_found.
result = abap_false.
endtry.
ENDMETHOD.
METHOD get_checks_package.
result = get_check_base_package( ).
REPLACE 'FOUNDATION' IN result WITH 'CHECKS'.
ENDMETHOD.
METHOD get_checks_from_db.
DATA(package) = get_checks_package( ).
SELECT *
FROM tadir
WHERE devclass = @package
INTO TABLE @result.
ENDMETHOD.
METHOD get_check_base_package.
SELECT SINGLE devclass
FROM tadir
INTO result
WHERE obj_name = 'Y_CHECK_BASE'.
ENDMETHOD.
METHOD y_if_profile_manager~create.
result = NEW y_profile_manager( ).
ENDMETHOD.
ENDCLASS.
| 32.730952 | 107 | 0.624209 |
79f286f44f7b44f3aad062d984b8118525d2e8f9 | 1,080 | abap | ABAP | src/z4_01_business_objects/z4_012_monster/zcl_4_monster_model.clas.locals_imp.abap | larshp/ABAPToTheFuture04 | 43b686f8d9fd7b7fb5414249152dffa54fd05dd8 | [
"MIT"
] | 30 | 2019-03-03T03:33:55.000Z | 2022-03-11T01:12:55.000Z | src/z4_01_business_objects/z4_012_monster/zcl_4_monster_model.clas.locals_imp.abap | larshp/ABAPToTheFuture04 | 43b686f8d9fd7b7fb5414249152dffa54fd05dd8 | [
"MIT"
] | 19 | 2019-02-24T10:58:17.000Z | 2020-04-05T08:29:55.000Z | src/z4_01_business_objects/z4_012_monster/zcl_4_monster_model.clas.locals_imp.abap | larshp/ABAPToTheFuture04 | 43b686f8d9fd7b7fb5414249152dffa54fd05dd8 | [
"MIT"
] | 17 | 2019-02-28T06:59:06.000Z | 2022-01-12T23:54:57.000Z | *"* use this source file for the definition and implementation of
*"* local helper classes, interface definitions and type
*"* declarations
CLASS lcl_weapon_iterator DEFINITION.
PUBLIC SECTION.
METHODS: constructor,
get_next_weapon RETURNING VALUE(rd_weapon) TYPE string.
PRIVATE SECTION.
DATA: weapon_table TYPE TABLE OF string,
last_used_index TYPE sy-tabix.
ENDCLASS.
CLASS lcl_weapon_iterator IMPLEMENTATION.
METHOD constructor.
weapon_table = VALUE string_table(
( |'FEATHER DUSTER'| )
( |'PEASHOOTER'| )
( |'THE BIG KNIFE'| )
( |'GUN'| )
( |'MACHINE GUN'| )
( |'LASER PISTOL'| )
( |'NUCLEAR MISSILE'| ) ).
ENDMETHOD.
METHOD get_next_weapon.
CASE last_used_index.
WHEN 0.
DATA(row_to_read) = 1.
WHEN lines( weapon_table ).
row_to_read = 1.
WHEN OTHERS.
row_to_read = last_used_index + 1.
ENDCASE.
READ TABLE weapon_table INTO rd_weapon INDEX row_to_read.
ASSERT sy-subrc EQ 0.
last_used_index = row_to_read.
ENDMETHOD.
ENDCLASS.
| 21.6 | 65 | 0.662037 |
79f37ea324bc356cf5cc10c87520ad9ad99b7049 | 554 | abap | ABAP | src/data/zcl_csr_2022kr.clas.abap | sandraros/abap-CSR | 8023f26fa8764f389e90f8a546e00fcc1b5d9c75 | [
"MIT"
] | 1 | 2020-01-10T03:29:48.000Z | 2020-01-10T03:29:48.000Z | src/data/zcl_csr_2022kr.clas.abap | sandraros/abap-CSR | 8023f26fa8764f389e90f8a546e00fcc1b5d9c75 | [
"MIT"
] | null | null | null | src/data/zcl_csr_2022kr.clas.abap | sandraros/abap-CSR | 8023f26fa8764f389e90f8a546e00fcc1b5d9c75 | [
"MIT"
] | null | null | null | "! <p class="shorttext synchronized" lang="en"></p>
"!
CLASS zcl_csr_2022kr DEFINITION
PUBLIC
INHERITING FROM zcl_csr_2022
CREATE PUBLIC .
PUBLIC SECTION.
METHODS get_name
REDEFINITION .
METHODS get_language
REDEFINITION .
METHODS match
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_csr_2022kr IMPLEMENTATION.
METHOD get_language.
language = 'kr'.
ENDMETHOD.
METHOD get_name.
name = 'ISO-2022-KR'.
ENDMETHOD.
METHOD match.
ENDMETHOD.
ENDCLASS.
| 12.590909 | 51 | 0.67509 |
79f7294ec73572c7b6338560b6261f433d9aeda0 | 2,049 | abap | ABAP | src/zobject_instance_lifetime.prog.abap | pokrakam/abapClosureTest | dcd79a8eb5822095dcca225d9da663d4c45dd9af | [
"MIT"
] | null | null | null | src/zobject_instance_lifetime.prog.abap | pokrakam/abapClosureTest | dcd79a8eb5822095dcca225d9da663d4c45dd9af | [
"MIT"
] | null | null | null | src/zobject_instance_lifetime.prog.abap | pokrakam/abapClosureTest | dcd79a8eb5822095dcca225d9da663d4c45dd9af | [
"MIT"
] | null | null | null | REPORT zobject_instance_lifetime.
CLASS lcl_test DEFINITION CREATE PUBLIC.
PUBLIC SECTION.
DATA some_i TYPE i.
DATA short_string TYPE string.
DATA long_string TYPE string.
DATA small_itab TYPE STANDARD TABLE OF i.
DATA large_itab TYPE STANDARD TABLE OF i.
METHODS get_string_ref RETURNING VALUE(result) TYPE REF TO string.
METHODS fill_data.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_test IMPLEMENTATION.
METHOD get_string_ref.
result = REF #( long_string ).
ENDMETHOD.
METHOD fill_data.
short_string = 'Foo'.
long_string = `1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890` &&
`1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890` &&
`1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890` &&
`1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890` &&
`1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890`.
DO 5 TIMES.
APPEND sy-index TO small_itab.
ENDDO.
DO 10000 TIMES.
APPEND sy-index TO large_itab.
ENDDO.
ENDMETHOD.
ENDCLASS.
CLASS lcl_main DEFINITION CREATE PUBLIC.
PUBLIC SECTION.
METHODS run.
ENDCLASS.
CLASS lcl_main IMPLEMENTATION.
METHOD run.
DATA(o) = NEW lcl_test( ).
o->short_string = `Foo`.
CLEAR o.
cl_abap_memory_utilities=>do_garbage_collection( ).
o = NEW lcl_test( ).
o->short_string = `Foo`.
CLEAR o.
cl_abap_memory_utilities=>do_garbage_collection( ).
o = NEW lcl_test( ).
o->fill_data( ).
DATA(sref) = o->get_string_ref( ).
CLEAR o.
cl_abap_memory_utilities=>do_garbage_collection( ).
CLEAR sref.
cl_abap_memory_utilities=>do_garbage_collection( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
NEW lcl_main( )->run( ).
| 24.686747 | 123 | 0.731088 |
79f7663d36612fcfb77db604a9f9326ccbc43e67 | 1,294 | abap | ABAP | src/alv/zcx_uitb_alv_no_data.clas.abap | stockbal/abap-ui-toolbox | 93ee48975deab71aa16e3c898c9863b0c4e6ee19 | [
"MIT"
] | 3 | 2021-03-08T13:02:46.000Z | 2021-11-30T20:04:44.000Z | src/alv/zcx_uitb_alv_no_data.clas.abap | stockbal/abap-ui-toolbox | 93ee48975deab71aa16e3c898c9863b0c4e6ee19 | [
"MIT"
] | 1 | 2021-03-31T17:13:50.000Z | 2021-03-31T20:05:02.000Z | src/alv/zcx_uitb_alv_no_data.clas.abap | stockbal/abap-ui-toolbox | 93ee48975deab71aa16e3c898c9863b0c4e6ee19 | [
"MIT"
] | null | null | null | CLASS ZCX_UITB_alv_no_data DEFINITION
PUBLIC
INHERITING FROM ZCX_UITB_alv_error
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CONSTANTS:
BEGIN OF ZCX_UITB_alv_no_data,
msgid TYPE symsgid VALUE 'ZUITB_EXCEPTION',
msgno TYPE symsgno VALUE '006',
attr1 TYPE scx_attrname VALUE '',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF ZCX_UITB_alv_no_data.
METHODS constructor
IMPORTING
!textid LIKE if_t100_message=>t100key OPTIONAL
!previous LIKE previous OPTIONAL
!msgv1 TYPE sy-msgv1 OPTIONAL
!msgv2 TYPE sy-msgv2 OPTIONAL
!msgv3 TYPE sy-msgv3 OPTIONAL
!msgv4 TYPE sy-msgv4 OPTIONAL .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCX_UITB_ALV_NO_DATA IMPLEMENTATION.
METHOD constructor ##ADT_SUPPRESS_GENERATION.
CALL METHOD super->constructor
EXPORTING
previous = previous
msgv1 = msgv1
msgv2 = msgv2
msgv3 = msgv3
msgv4 = msgv4.
CLEAR me->textid.
IF textid IS INITIAL.
if_t100_message~t100key = ZCX_UITB_alv_no_data.
ELSE.
if_t100_message~t100key = textid.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 24.884615 | 56 | 0.659196 |
79f8773f096d0d363be1a90ab961a9a9be205b4b | 130 | abap | ABAP | src/test/z_expimp_table_test.fugr.lz_expimp_table_testtop.abap | sandraros/Export-Import-Tables | f3ce4d77b159e953f50f19a05e0a63451f606f98 | [
"MIT"
] | 2 | 2021-08-13T14:03:44.000Z | 2021-10-04T15:05:24.000Z | src/test/z_expimp_table_test.fugr.lz_expimp_table_testtop.abap | sandraros/Export-Import-Tables | f3ce4d77b159e953f50f19a05e0a63451f606f98 | [
"MIT"
] | 7 | 2020-10-07T12:33:22.000Z | 2021-08-16T18:44:00.000Z | src/test/z_expimp_table_test.fugr.lz_expimp_table_testtop.abap | sandraros/Export-Import-Tables | f3ce4d77b159e953f50f19a05e0a63451f606f98 | [
"MIT"
] | null | null | null | FUNCTION-POOL Z_EXPIMP_TABLE_TEST. "MESSAGE-ID ..
* INCLUDE LZ_EXPIMP_TABLE_TESTD... " Local class definition
| 32.5 | 69 | 0.676923 |
79fd90e1c4cb0dbdb48722a140a55ae7656553c2 | 806 | abap | ABAP | src/zcl_abak_format_factory.clas.abap | abapinho/abaKTravis | ab368aaccc9bb0b018e6cd6208cd4abc934861a0 | [
"MIT"
] | null | null | null | src/zcl_abak_format_factory.clas.abap | abapinho/abaKTravis | ab368aaccc9bb0b018e6cd6208cd4abc934861a0 | [
"MIT"
] | null | null | null | src/zcl_abak_format_factory.clas.abap | abapinho/abaKTravis | ab368aaccc9bb0b018e6cd6208cd4abc934861a0 | [
"MIT"
] | null | null | null | class ZCL_ABAK_FORMAT_FACTORY definition
public
final
create public .
public section.
class-methods GET_INSTANCE
importing
!I_FORMAT_TYPE type ZABAK_FORMAT_TYPE
returning
value(RO_INSTANCE) type ref to ZIF_ABAK_FORMAT
raising
ZCX_ABAK .
PROTECTED SECTION.
private section.
ENDCLASS.
CLASS ZCL_ABAK_FORMAT_FACTORY IMPLEMENTATION.
METHOD get_instance.
CASE i_format_type.
WHEN zif_abak_consts=>format_type-database.
CREATE OBJECT ro_instance TYPE zcl_abak_format_db.
WHEN zif_abak_consts=>format_type-xml.
CREATE OBJECT ro_instance TYPE zcl_abak_format_xml.
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_abak
EXPORTING
textid = zcx_abak=>invalid_parameters.
ENDCASE.
ENDMETHOD.
ENDCLASS.
| 19.190476 | 59 | 0.723325 |
0303ef23912bfb0c9b2e4732c5e611cea8850d65 | 4,727 | abap | ABAP | src/zmockup_compiler.prog.abap | sbcgua/mockup_compiler | 12f88ab51edc80275ab4f42bcf52a547391c99eb | [
"MIT"
] | null | null | null | src/zmockup_compiler.prog.abap | sbcgua/mockup_compiler | 12f88ab51edc80275ab4f42bcf52a547391c99eb | [
"MIT"
] | 5 | 2018-08-21T13:58:13.000Z | 2020-01-07T08:58:34.000Z | src/zmockup_compiler.prog.abap | sbcgua/mockup_compiler | 12f88ab51edc80275ab4f42bcf52a547391c99eb | [
"MIT"
] | 2 | 2018-08-21T13:49:03.000Z | 2019-01-01T19:13:41.000Z | report zmockup_compiler.
**********************************************************************
* INCLUDES
**********************************************************************
include zmockup_compiler_error.
include zmockup_compiler_w3mi_contrib.
include zmockup_compiler_xlrd_contrib.
include zmockup_compiler_utils.
include zmockup_compiler_meta.
include zmockup_compiler_workbook_prs.
include zmockup_compiler_app.
**********************************************************************
* ENTRY POINT
**********************************************************************
constants:
GC_DIR_PARAM_NAME TYPE CHAR20 VALUE 'ZMOCKUP_COMPILER_DIR',
GC_OBJ_PARAM_NAME TYPE CHAR20 VALUE 'ZMOCKUP_COMPILER_OBJ',
GC_INC_PARAM_NAME TYPE CHAR20 VALUE 'ZMOCKUP_COMPILER_INC'.
form main using pv_srcdir pv_incdir pv_mimename pv_watch pv_rebuild.
data lo_app type ref to lcl_app.
data lx type ref to cx_static_check.
data l_str type string.
if pv_srcdir is initial.
message 'Source directory parameter is mandatory' type 'S' display like 'E'. "#EC NOTEXT
endif.
if pv_mimename is initial.
message 'MIME object name is mandatory' type 'S' display like 'E'. "#EC NOTEXT
endif.
try.
create object lo_app
exporting
iv_dir = |{ pv_srcdir }|
iv_include = |{ pv_incdir }|
iv_mime_key = |{ pv_mimename }|
iv_rebuild = pv_rebuild
iv_do_watch = pv_watch.
lo_app->run( ).
catch lcx_error zcx_w3mime_error into lx.
l_str = lx->get_text( ).
message l_str type 'E'.
endtry.
endform.
form f4_include_path changing c_path type char255.
c_path = zcl_w3mime_fs=>choose_dir_dialog( ).
if c_path is not initial.
set parameter id GC_INC_PARAM_NAME field c_path.
endif.
endform.
form f4_srcdir_path changing c_path type char255.
c_path = zcl_w3mime_fs=>choose_dir_dialog( ).
if c_path is not initial.
set parameter id GC_DIR_PARAM_NAME field c_path.
endif.
endform.
form f4_mime_path changing c_path.
c_path = zcl_w3mime_storage=>choose_mime_dialog( ).
if c_path is not initial.
set parameter id GC_OBJ_PARAM_NAME field c_path.
endif.
endform.
**********************************************************************
* SELECTION SCREEN
**********************************************************************
selection-screen begin of block b1 with frame title txt_b1.
selection-screen begin of line.
selection-screen comment (24) t_mime for field p_mime.
parameters p_mime type w3objid visible length 40.
selection-screen comment (24) t_mime2.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (24) t_dir for field p_dir.
parameters p_dir type char255 visible length 40.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (24) t_inc for field p_inc.
parameters p_inc type char255 visible length 40.
selection-screen comment (24) t_inc2.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (24) t_watch for field p_watch.
parameters p_watch type abap_bool as checkbox.
selection-screen end of line.
selection-screen begin of line.
selection-screen comment (24) t_rebld for field p_rebld.
parameters p_rebld type abap_bool as checkbox.
selection-screen comment (40) t_rebld2.
selection-screen end of line.
selection-screen end of block b1.
initialization.
txt_b1 = 'Compile parameters'. "#EC NOTEXT
t_dir = 'Source directory'. "#EC NOTEXT
t_inc = 'Includes directory'. "#EC NOTEXT
t_inc2 = ' (optional)'. "#EC NOTEXT
t_mime = 'Target W3MI object'. "#EC NOTEXT
t_mime2 = ' (must be existing one)'. "#EC NOTEXT
t_watch = 'Keep watching source'. "#EC NOTEXT
t_rebld = 'Re-build from scratch'. "#EC NOTEXT
t_rebld2 = ' (Ignore metadata)'. "#EC NOTEXT
get parameter id GC_DIR_PARAM_NAME field p_dir.
get parameter id GC_INC_PARAM_NAME field p_inc.
get parameter id GC_OBJ_PARAM_NAME field p_mime.
at selection-screen on value-request for p_dir.
perform f4_srcdir_path changing p_dir.
at selection-screen on value-request for p_mime.
perform f4_mime_path changing p_mime.
at selection-screen on value-request for p_inc.
perform f4_include_path changing p_inc.
at selection-screen on p_dir.
if p_dir is not initial.
set parameter id GC_DIR_PARAM_NAME field p_dir.
endif.
at selection-screen on p_inc.
if p_inc is not initial.
set parameter id GC_INC_PARAM_NAME field p_inc.
endif.
at selection-screen on p_mime.
if p_mime is not initial.
set parameter id GC_OBJ_PARAM_NAME field p_mime.
endif.
start-of-selection.
perform main using p_dir p_inc p_mime p_watch p_rebld.
| 31.304636 | 92 | 0.681616 |
0305d1f79a212e570ab9752664b26008a45e353f | 904 | abap | ABAP | src/zvgc_fg_test_cadcall.fugr.saplzvgc_fg_test_cadcall.abap | vgonzcam/ZVGC_TEST_CADCALL | 69a22a3d516294a567c5c16398458f08d41f3c5d | [
"BSD-Source-Code"
] | null | null | null | src/zvgc_fg_test_cadcall.fugr.saplzvgc_fg_test_cadcall.abap | vgonzcam/ZVGC_TEST_CADCALL | 69a22a3d516294a567c5c16398458f08d41f3c5d | [
"BSD-Source-Code"
] | null | null | null | src/zvgc_fg_test_cadcall.fugr.saplzvgc_fg_test_cadcall.abap | vgonzcam/ZVGC_TEST_CADCALL | 69a22a3d516294a567c5c16398458f08d41f3c5d | [
"BSD-Source-Code"
] | null | null | null | *******************************************************************
* System-defined Include-files. *
*******************************************************************
INCLUDE LZVGC_FG_TEST_CADCALLTOP. " Global Declarations
INCLUDE LZVGC_FG_TEST_CADCALLUXX. " Function Modules
*******************************************************************
* User-defined Include-files (if necessary). *
*******************************************************************
* INCLUDE LZVGC_FG_TEST_CADCALLF... " Subroutines
* INCLUDE LZVGC_FG_TEST_CADCALLO... " PBO-Modules
* INCLUDE LZVGC_FG_TEST_CADCALLI... " PAI-Modules
* INCLUDE LZVGC_FG_TEST_CADCALLE... " Events
* INCLUDE LZVGC_FG_TEST_CADCALLP... " Local class implement.
* INCLUDE LZVGC_FG_TEST_CADCALLT99. " ABAP Unit tests
| 56.5 | 69 | 0.441372 |
030ad65d28563872b89c1e34c6075ed682affb4d | 319 | abap | ABAP | src/ztmaf_material.fugr.lztmaf_materiali00.abap | keremkoseoglu/rapmaf_backend | d9b3bdc6e83fe071951a38b1660c816300e29f1c | [
"MIT"
] | 2 | 2021-07-25T09:18:11.000Z | 2021-07-26T05:05:38.000Z | src/ztmaf_material.fugr.lztmaf_materiali00.abap | keremkoseoglu/rapmaf_backend | d9b3bdc6e83fe071951a38b1660c816300e29f1c | [
"MIT"
] | null | null | null | src/ztmaf_material.fugr.lztmaf_materiali00.abap | keremkoseoglu/rapmaf_backend | d9b3bdc6e83fe071951a38b1660c816300e29f1c | [
"MIT"
] | 2 | 2021-07-26T10:14:52.000Z | 2021-08-19T09:53:25.000Z | *---------------------------------------------------------------------*
* view related PAI modules
* generation date: 16.07.2021 at 08:32:16
* view maintenance generator version: #001407#
*---------------------------------------------------------------------*
INCLUDE LSVIMITX . "base table related PAI modules
| 39.875 | 71 | 0.404389 |
030cb84f4eb0d61f7e30077a485be26391de4421 | 494 | abap | ABAP | src/zif_cilib_exception.intf.abap | flaiker/ci-lib | 80cb7704d0f0bb1242f104c0175cf95dfa29d987 | [
"MIT"
] | 10 | 2018-12-23T20:06:08.000Z | 2021-03-20T07:44:13.000Z | src/zif_cilib_exception.intf.abap | Saurabhsharma009/ci-lib | 3e53b77f632bb703522868d7c2bb7441d52feafb | [
"MIT"
] | 11 | 2018-12-22T16:39:28.000Z | 2020-06-10T07:36:35.000Z | src/zif_cilib_exception.intf.abap | Saurabhsharma009/ci-lib | 3e53b77f632bb703522868d7c2bb7441d52feafb | [
"MIT"
] | 3 | 2019-11-16T13:43:44.000Z | 2021-07-26T10:02:12.000Z | "! Exception
INTERFACE zif_cilib_exception PUBLIC.
INTERFACES:
if_t100_message.
CONSTANTS:
BEGIN OF gc_default_message,
msgid TYPE symsgid VALUE 'ZCILIB',
msgno TYPE symsgno VALUE '006',
attr1 TYPE scx_attrname VALUE 'ZIF_CILIB_EXCEPTION~MS_MSG-MSGV1',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF gc_default_message.
DATA:
ms_msg TYPE zcilib_msg READ-ONLY.
ENDINTERFACE.
| 29.058824 | 71 | 0.716599 |
0310a222b076b620a1f3cbc59cb888ea77799117 | 130 | abap | ABAP | src/oea/zadvoat_oea_parallel.fugr.lzadvoat_oea_paralleltop.abap | stockbal/abap-object-analysis-tools | a0619eb31a18a2469b491ed24ff913ca989b5bb5 | [
"MIT"
] | 1 | 2021-05-09T12:46:26.000Z | 2021-05-09T12:46:26.000Z | src/oea/zadvoat_oea_parallel.fugr.lzadvoat_oea_paralleltop.abap | stockbal/abap-object-analysis-tools | a0619eb31a18a2469b491ed24ff913ca989b5bb5 | [
"MIT"
] | null | null | null | src/oea/zadvoat_oea_parallel.fugr.lzadvoat_oea_paralleltop.abap | stockbal/abap-object-analysis-tools | a0619eb31a18a2469b491ed24ff913ca989b5bb5 | [
"MIT"
] | null | null | null | FUNCTION-POOL ZADVOAT_OEA_PARALLEL. "MESSAGE-ID ..
* INCLUDE LZADVOAT_OEA_PARALLELD... " Local class definition
| 32.5 | 69 | 0.692308 |
03158f56b40c5223a62a948344394da9dbf3fe55 | 232 | abap | ABAP | objects/CLAS/ZCL_ZGWSO_DPC/METH SALESORDERITEMSE_GET_ENTITYSET.abap | abhilashhaa/HCL_Githup | 454be7f157c72fbb75550dea67c9167e405a4fdb | [
"Apache-2.0"
] | null | null | null | objects/CLAS/ZCL_ZGWSO_DPC/METH SALESORDERITEMSE_GET_ENTITYSET.abap | abhilashhaa/HCL_Githup | 454be7f157c72fbb75550dea67c9167e405a4fdb | [
"Apache-2.0"
] | null | null | null | objects/CLAS/ZCL_ZGWSO_DPC/METH SALESORDERITEMSE_GET_ENTITYSET.abap | abhilashhaa/HCL_Githup | 454be7f157c72fbb75550dea67c9167e405a4fdb | [
"Apache-2.0"
] | null | null | null | method SALESORDERITEMSE_GET_ENTITYSET.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_not_impl_exc
EXPORTING
textid = /iwbep/cx_mgw_not_impl_exc=>method_not_implemented
method = 'SALESORDERITEMSE_GET_ENTITYSET'.
endmethod. | 38.666667 | 65 | 0.793103 |
031a4f1298c0096de642babfbb0f0ac795006690 | 2,335 | abap | ABAP | src/legacy/#dmo#flight_travel_api25.fugr.#dmo#flight_travel_read25.abap | SAP-Cloud-Platform/flight25 | f27adcaa4e14ff4e2cf8d737dec7a23b1789821e | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#flight_travel_api25.fugr.#dmo#flight_travel_read25.abap | SAP-Cloud-Platform/flight25 | f27adcaa4e14ff4e2cf8d737dec7a23b1789821e | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#flight_travel_api25.fugr.#dmo#flight_travel_read25.abap | SAP-Cloud-Platform/flight25 | f27adcaa4e14ff4e2cf8d737dec7a23b1789821e | [
"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/TRAVEL25 related to the importing Travel ID
"! @parameter et_booking | Table of Bookings like /DMO/BOOKING25 related to the importing Travel ID
"! @parameter et_booking_supplement | Table of Booking Supplements like /DMO/BOOK_SUP_25 related to the importing Travel ID
"! @parameter et_messages | Table of occurred messages
"!
FUNCTION /DMO/FLIGHT_TRAVEL_READ25.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_TRAVEL_ID) TYPE /DMO/TRAVEL_ID25
*" REFERENCE(IV_INCLUDE_BUFFER) TYPE ABAP_BOOLEAN DEFAULT
*" ABAP_TRUE
*" EXPORTING
*" REFERENCE(ES_TRAVEL) TYPE /DMO/TRAVEL25
*" REFERENCE(ET_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY25=>TT_BOOKING
*" REFERENCE(ET_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY25=>TT_BOOKING_SUPPLEMENT
*" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY25=>TT_MESSAGE
*"----------------------------------------------------------------------
CLEAR es_travel.
CLEAR et_booking.
CLEAR et_booking_supplement.
CLEAR et_messages.
/dmo/cl_flight_legacy25=>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_legacy25=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages
IMPORTING et_messages = et_messages ).
ENDFUNCTION.
| 51.888889 | 123 | 0.569165 |
031cf84e98e253a571d35da09e7698c9b419f51a | 13,883 | abap | ABAP | src/legacy/#dmo#cx_flight_legacy06.clas.abap | SAP-Cloud-Platform/flight06 | 8ee5b2eee6e6d22d0cc0b5064da49720bfe7523a | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#cx_flight_legacy06.clas.abap | SAP-Cloud-Platform/flight06 | 8ee5b2eee6e6d22d0cc0b5064da49720bfe7523a | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#cx_flight_legacy06.clas.abap | SAP-Cloud-Platform/flight06 | 8ee5b2eee6e6d22d0cc0b5064da49720bfe7523a | [
"BSD-Source-Code"
] | null | null | null | CLASS /dmo/cx_flight_legacy06 DEFINITION
PUBLIC
INHERITING FROM cx_static_check
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_t100_message .
CONSTANTS:
gc_msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
BEGIN OF agency_unkown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '001',
attr1 TYPE scx_attrname VALUE 'MV_AGENCY_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF agency_unkown,
BEGIN OF customer_unkown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '002',
attr1 TYPE scx_attrname VALUE 'MV_CUSTOMER_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF customer_unkown,
BEGIN OF connection_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '004',
attr1 TYPE scx_attrname VALUE 'MV_CARRIER_ID',
attr2 TYPE scx_attrname VALUE 'MV_CONNECTION_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF connection_unknown ,
BEGIN OF carrier_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '005',
attr1 TYPE scx_attrname VALUE 'MV_CARRIER_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF carrier_unknown ,
BEGIN OF supplement_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '006',
attr1 TYPE scx_attrname VALUE 'MV_SUPPLEMENT_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF supplement_unknown,
BEGIN OF travel_status_invalid,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '007',
attr1 TYPE scx_attrname VALUE 'MV_STATUS',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_status_invalid,
BEGIN OF currency_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '008',
attr1 TYPE scx_attrname VALUE 'MV_CURRENCY_CODE',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF currency_unknown,
BEGIN OF travel_no_key,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '009',
attr1 TYPE scx_attrname VALUE '',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_no_key,
BEGIN OF no_begin_date,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '013',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF no_begin_date,
BEGIN OF no_end_date,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '014',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF no_end_date,
BEGIN OF end_date_before_begin_date,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '015',
attr1 TYPE scx_attrname VALUE 'MV_BEGIN_DATE',
attr2 TYPE scx_attrname VALUE 'MV_END_DATE',
attr3 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr4 TYPE scx_attrname VALUE '',
END OF end_date_before_begin_date,
BEGIN OF travel_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '016',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_unknown,
BEGIN OF booking_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '017',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_unknown,
BEGIN OF booking_no_key,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '018',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_no_key,
BEGIN OF booking_booking_date_invalid,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '019',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_DATE',
attr4 TYPE scx_attrname VALUE '',
END OF booking_booking_date_invalid,
BEGIN OF flight_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '020',
attr1 TYPE scx_attrname VALUE 'MV_CARRIER_ID',
attr2 TYPE scx_attrname VALUE 'MV_CONNECTION_ID',
attr3 TYPE scx_attrname VALUE 'MV_FLIGHT_DATE',
attr4 TYPE scx_attrname VALUE '',
END OF flight_unknown,
BEGIN OF booking_supplement_unknown,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '021',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_unknown,
BEGIN OF booking_supplement_no_key,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '022',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_no_key,
BEGIN OF booking_exists,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '023',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_exists,
BEGIN OF booking_supplement_exists,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '024',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_exists,
BEGIN OF travel_no_control,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '025',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_no_control,
BEGIN OF booking_no_control,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '026',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_no_control,
BEGIN OF booking_supplement_no_control,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '027',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_no_control,
BEGIN OF booking_supplement_suppl_id_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '028',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_suppl_id_u,
BEGIN OF booking_supplement_pri_curr_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '029',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE 'MV_BOOKING_SUPPLEMENT_ID',
attr4 TYPE scx_attrname VALUE '',
END OF booking_supplement_pri_curr_u,
BEGIN OF booking_flight_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '030',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_flight_u,
BEGIN OF booking_price_currency_u,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '031',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_BOOKING_ID',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF booking_price_currency_u,
BEGIN OF travel_lock,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '032',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE 'MV_UNAME',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_lock,
BEGIN OF travel_already_exists,
msgid TYPE symsgid VALUE '/DMO/CM_FLIGHT_LE_06',
msgno TYPE symsgno VALUE '033',
attr1 TYPE scx_attrname VALUE 'MV_TRAVEL_ID',
attr2 TYPE scx_attrname VALUE '',
attr3 TYPE scx_attrname VALUE '',
attr4 TYPE scx_attrname VALUE '',
END OF travel_already_exists.
METHODS constructor
IMPORTING
textid LIKE if_t100_message=>t100key OPTIONAL
previous LIKE previous OPTIONAL
travel_id TYPE /dmo/travel_id06 OPTIONAL
booking_id TYPE /dmo/booking_id06 OPTIONAL
booking_supplement_id TYPE /dmo/booking_supplement_id06 OPTIONAL
agency_id TYPE /dmo/agency_id06 OPTIONAL
customer_id TYPE /dmo/customer_id06 OPTIONAL
carrier_id TYPE /dmo/carrier06-carrier_id OPTIONAL
connection_id TYPE /dmo/connecti_06-connection_id OPTIONAL
supplement_id TYPE /dmo/suppleme_06-supplement_id OPTIONAL
begin_date TYPE /dmo/begin_date06 OPTIONAL
end_date TYPE /dmo/end_date06 OPTIONAL
booking_date TYPE /dmo/booking_date06 OPTIONAL
flight_date TYPE /dmo/flight_date06 OPTIONAL
status TYPE /dmo/travel_status06 OPTIONAL
currency_code TYPE /dmo/currency_code06 OPTIONAL
uname TYPE syuname OPTIONAL.
DATA: mv_travel_id TYPE /dmo/travel_id06,
mv_booking_id TYPE /dmo/booking_id06,
mv_booking_supplement_id TYPE /dmo/booking_supplement_id06,
mv_agency_id TYPE /dmo/agency_id06,
mv_customer_id TYPE /dmo/customer_id06,
mv_carrier_id TYPE /dmo/carrier06-carrier_id,
mv_connection_id TYPE /dmo/connecti_06-connection_id,
mv_supplement_id TYPE /dmo/suppleme_06-supplement_id,
mv_begin_date TYPE /dmo/begin_date06,
mv_end_date TYPE /dmo/end_date06,
mv_booking_date TYPE /dmo/booking_date06,
mv_flight_date TYPE /dmo/flight_date06,
mv_status TYPE /dmo/travel_status06,
mv_currency_code TYPE /dmo/currency_code06,
mv_uname TYPE syuname.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS /dmo/cx_flight_legacy06 IMPLEMENTATION.
METHOD constructor ##ADT_SUPPRESS_GENERATION.
super->constructor( previous = previous ).
me->mv_travel_id = travel_id.
me->mv_booking_id = booking_id.
me->mv_booking_supplement_id = booking_supplement_id.
me->mv_agency_id = agency_id.
me->mv_customer_id = customer_id.
me->mv_carrier_id = carrier_id.
me->mv_connection_id = connection_id.
me->mv_supplement_id = supplement_id.
me->mv_begin_date = begin_date.
me->mv_end_date = end_date.
me->mv_booking_date = booking_date.
me->mv_flight_date = flight_date.
me->mv_status = status.
me->mv_currency_code = currency_code.
me->mv_uname = uname.
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.
| 39.893678 | 74 | 0.655262 |
031f19bf85332e0c0064d595c5234d9aad660abb | 311 | abap | ABAP | src/zif_bc009_request.intf.abap | OlegBash599/ZCTS_BROWSER | 9056099a072f6ec9f020dd84fca7ec92c05694bb | [
"MIT"
] | 12 | 2019-11-02T22:17:58.000Z | 2020-12-21T18:34:25.000Z | src/zif_bc009_request.intf.abap | OlegBash599/ZCTS_BROWSER | 9056099a072f6ec9f020dd84fca7ec92c05694bb | [
"MIT"
] | 2 | 2019-08-31T21:07:42.000Z | 2019-09-02T11:33:40.000Z | src/zif_bc009_request.intf.abap | OlegBash599/ZCTS_BROWSER | 9056099a072f6ec9f020dd84fca7ec92c05694bb | [
"MIT"
] | 5 | 2019-09-02T06:23:54.000Z | 2020-12-20T13:45:33.000Z | interface ZIF_BC009_REQUEST
public .
constants MC_N type SEOCLSNAME value 'ZIF_BC009_REQUEST'. "#EC NOTEXT
methods MOVE_AS_COPY
importing
!IV_TRKORR type TRKORR
raising
resumable(ZCX_BC009_REQUEST) .
methods SET_TARGET
importing
!IV_TRG_SYS type SYSYSID .
endinterface.
| 19.4375 | 71 | 0.733119 |
032199fb5af792d50706d9454a115ed7d743540f | 5,776 | abap | ABAP | src/zcl_aff_generator.clas.abap | SAP/abap-file-formats-tools | fd59597e21c498dc701b72928d7971935d9fecdb | [
"MIT"
] | 3 | 2022-03-15T07:09:53.000Z | 2022-03-29T21:34:57.000Z | src/zcl_aff_generator.clas.abap | SAP/abap-file-formats-tools | fd59597e21c498dc701b72928d7971935d9fecdb | [
"MIT"
] | 22 | 2022-03-14T14:47:11.000Z | 2022-03-31T15:27:18.000Z | src/zcl_aff_generator.clas.abap | SAP/abap-file-formats-tools | fd59597e21c498dc701b72928d7971935d9fecdb | [
"MIT"
] | null | null | null | CLASS zcl_aff_generator DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor
IMPORTING
writer TYPE REF TO zif_aff_writer.
METHODS generate_type
IMPORTING
data TYPE data
RETURNING
VALUE(result) TYPE string_table
RAISING
zcx_aff_tools.
METHODS get_log
RETURNING
VALUE(log) TYPE REF TO zif_aff_log.
PRIVATE SECTION.
DATA:
writer TYPE REF TO zif_aff_writer,
log TYPE REF TO zif_aff_log.
METHODS:
check_input
IMPORTING
type_description TYPE REF TO cl_abap_typedescr,
process_type_description
IMPORTING
type_description TYPE REF TO cl_abap_typedescr
type_name TYPE string OPTIONAL
RAISING
zcx_aff_tools,
process_element
IMPORTING
element_description TYPE REF TO cl_abap_elemdescr
element_name TYPE string OPTIONAL
RAISING
zcx_aff_tools,
process_structure
IMPORTING
structure_description TYPE REF TO cl_abap_structdescr
structure_name TYPE string
RAISING
zcx_aff_tools,
process_table
IMPORTING
table_description TYPE REF TO cl_abap_tabledescr
table_name TYPE string
RAISING
zcx_aff_tools,
process_include
IMPORTING
structure_description TYPE REF TO cl_abap_structdescr
RAISING
zcx_aff_tools,
process_components
IMPORTING
components TYPE cl_abap_structdescr=>component_table
RAISING
zcx_aff_tools,
check_mandatory_fields
IMPORTING
structure_description TYPE REF TO cl_abap_structdescr.
ENDCLASS.
CLASS zcl_aff_generator IMPLEMENTATION.
METHOD constructor.
me->writer = writer.
log = NEW zcl_aff_log( ).
ENDMETHOD.
METHOD generate_type.
DATA(type_description) = cl_abap_typedescr=>describe_by_data( data ).
check_input( type_description ).
process_type_description( type_description ).
result = writer->get_output( ).
log->join( log_to_join = writer->get_log( ) ).
ENDMETHOD.
METHOD check_input.
TRY.
DATA(structure_description) = CAST cl_abap_structdescr( type_description ).
check_mandatory_fields( structure_description ).
CATCH cx_sy_move_cast_error.
MESSAGE w123(zaff_tools) INTO DATA(message) ##NEEDED.
log->add_warning( message = zcl_aff_log=>get_sy_message( ) component_name = type_description->get_relative_name( ) ).
ENDTRY.
ENDMETHOD.
METHOD check_mandatory_fields.
DATA(components) = structure_description->get_components( ).
IF NOT ( line_exists( components[ name = 'HEADER' ] ) AND line_exists( components[ name = 'FORMAT_VERSION' ] ) ).
MESSAGE w124(zaff_tools) INTO DATA(message) ##NEEDED.
log->add_warning( message = zcl_aff_log=>get_sy_message( ) component_name = structure_description->get_relative_name( ) ).
ENDIF.
ENDMETHOD.
METHOD process_type_description.
CASE type_description->kind.
WHEN cl_abap_typedescr=>kind_elem.
process_element(
element_name = type_name
element_description = CAST #( type_description ) ).
WHEN cl_abap_typedescr=>kind_struct.
process_structure(
structure_name = type_name
structure_description = CAST #( type_description ) ).
WHEN cl_abap_typedescr=>kind_table.
process_table(
table_name = type_name
table_description = CAST #( type_description ) ).
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_aff_tools MESSAGE e100(zaff_tools) WITH type_description->kind.
ENDCASE.
ENDMETHOD.
METHOD process_element.
DATA(name) = COND #( WHEN element_name IS NOT INITIAL THEN element_name
ELSE element_description->get_relative_name( ) ).
writer->write_element(
element_name = name
element_description = element_description ).
ENDMETHOD.
METHOD process_structure.
DATA(name) = COND #( WHEN structure_name IS NOT INITIAL THEN structure_name
ELSE structure_description->get_relative_name( ) ).
writer->open_node(
node_name = name
node_description = structure_description ).
DATA(components) = structure_description->get_components( ).
process_components( components ).
writer->close_node(
node_name = name
node_description = structure_description ).
ENDMETHOD.
METHOD process_include.
DATA(components) = structure_description->get_components( ).
writer->open_include( structure_description ).
process_components( components ).
writer->close_include( ).
ENDMETHOD.
METHOD process_components.
LOOP AT components ASSIGNING FIELD-SYMBOL(<component>).
IF <component>-as_include = abap_true.
process_include( CAST #( <component>-type ) ).
ELSE.
process_type_description(
type_name = <component>-name
type_description = <component>-type ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD process_table.
DATA(name) = COND #( WHEN table_name IS NOT INITIAL THEN table_name
ELSE table_description->get_relative_name( ) ).
writer->open_node(
node_name = name
node_description = table_description ).
DATA(line_description) = table_description->get_table_line_type( ).
process_type_description( line_description ).
writer->close_node(
node_name = name
node_description = table_description ).
ENDMETHOD.
METHOD get_log.
log = me->log.
ENDMETHOD.
ENDCLASS.
| 31.221622 | 128 | 0.666378 |
03219f26c400be01b4f5fa7ecb8284ed095f2c76 | 559 | abap | ABAP | src/deps/zcl_abaplint_deps_serializer.clas.locals_imp.abap | sbcgua/abaplint-sci-client | 9f269f4b3d12a7fd3f090bf615ffd2d9e1c371ff | [
"MIT"
] | 16 | 2020-09-04T14:21:30.000Z | 2022-02-16T11:28:18.000Z | src/deps/zcl_abaplint_deps_serializer.clas.locals_imp.abap | sbcgua/abaplint-sci-client | 9f269f4b3d12a7fd3f090bf615ffd2d9e1c371ff | [
"MIT"
] | 149 | 2020-07-11T06:21:27.000Z | 2022-02-19T06:49:00.000Z | src/deps/zcl_abaplint_deps_serializer.clas.locals_imp.abap | sbcgua/abaplint-sci-client | 9f269f4b3d12a7fd3f090bf615ffd2d9e1c371ff | [
"MIT"
] | 15 | 2020-07-16T21:39:09.000Z | 2022-01-01T18:46:10.000Z | *"* use this source file for the definition and implementation of
*"* local helper classes, interface definitions and type
*"* declarations
CLASS lcl_longtexts DEFINITION.
PUBLIC SECTION.
INTERFACES zif_abapgit_longtexts.
ENDCLASS.
CLASS lcl_longtexts IMPLEMENTATION.
METHOD zif_abapgit_longtexts~changed_by.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_longtexts~serialize.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_longtexts~deserialize.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_longtexts~delete.
RETURN.
ENDMETHOD.
ENDCLASS.
| 19.275862 | 65 | 0.774597 |
0323d08d5d37bf9149b05def325ebd7baf782fb2 | 2,646 | abap | ABAP | src/objects/zcl_abapgit_object_iwmo.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_iwmo.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_iwmo.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_object_iwmo DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
METHODS get_generic
RETURNING
VALUE(ro_generic) TYPE REF TO zcl_abapgit_objects_generic
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_object_iwmo IMPLEMENTATION.
METHOD get_generic.
CREATE OBJECT ro_generic
EXPORTING
is_item = ms_item
iv_language = mv_language.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = zcl_abapgit_objects_super=>c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
get_generic( )->delete( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
get_generic( )->deserialize(
iv_package = iv_package
io_xml = io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
rv_bool = get_generic( )->exists( ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: lv_mdl_technical_name TYPE c LENGTH 32,
lv_version TYPE bdc_fval,
lt_bdcdata TYPE TABLE OF bdcdata.
FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata.
lv_mdl_technical_name = ms_item-obj_name.
lv_version = ms_item-obj_name+32(4).
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-program = '/IWBEP/R_DST_MODEL_BUILDER'.
<ls_bdcdata>-dynpro = '0100'.
<ls_bdcdata>-dynbegin = 'X'.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-fnam = 'GS_MODEL_SCREEN_100-TECHNICAL_NAME'.
<ls_bdcdata>-fval = lv_mdl_technical_name.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-fnam = 'GS_MODEL_SCREEN_100-VERSION'.
<ls_bdcdata>-fval = lv_version.
zcl_abapgit_ui_factory=>get_gui_jumper( )->jump_batch_input(
iv_tcode = '/IWBEP/REG_MODEL'
it_bdcdata = lt_bdcdata ).
rv_exit = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
get_generic( )->serialize( io_xml ).
ENDMETHOD.
ENDCLASS.
| 20.511628 | 65 | 0.713152 |
0326e3adc14001ad23d5a042e8a480d41a331c63 | 1,970 | abap | ABAP | src/ztest_cascade_append.prog.abap | sbcgua/benchmarks | bf8827665f2caca6d3d5f0d741b558c310f302e5 | [
"MIT"
] | null | null | null | src/ztest_cascade_append.prog.abap | sbcgua/benchmarks | bf8827665f2caca6d3d5f0d741b558c310f302e5 | [
"MIT"
] | null | null | null | src/ztest_cascade_append.prog.abap | sbcgua/benchmarks | bf8827665f2caca6d3d5f0d741b558c310f302e5 | [
"MIT"
] | null | null | null | report ztest_cascade_append.
include ztest_benchmark.
class lcl_app definition final.
public section.
methods setter1
importing
depth type i default 0
changing
ct_nodes type zif_ajson=>ty_nodes_tt.
methods setter2
importing
depth type i default 0
changing
ct_nodes type zif_ajson=>ty_nodes_tt.
methods test_setter1.
methods test_setter2.
class-methods main.
methods run
importing
iv_method type string.
data mv_num_rounds type i.
endclass.
class lcl_app implementation.
method setter1.
check depth <= 3.
append initial line to ct_nodes.
append initial line to ct_nodes.
setter1(
exporting
depth = depth + 1
changing
ct_nodes = ct_nodes ).
endmethod.
method setter2.
check depth <= 3.
append initial line to ct_nodes.
append initial line to ct_nodes.
data lt_nodes like ct_nodes.
setter1(
exporting
depth = depth + 1
changing
ct_nodes = lt_nodes ).
append lines of lt_nodes to ct_nodes.
endmethod.
method test_setter1.
data lt_nodes type zif_ajson=>ty_nodes_tt.
do 1000 times.
setter1( changing ct_nodes = lt_nodes ).
enddo.
endmethod.
method test_setter2.
data lt_nodes type zif_ajson=>ty_nodes_tt.
do 1000 times.
setter2( changing ct_nodes = lt_nodes ).
enddo.
endmethod.
method run.
data lo_benchmark type ref to lcl_benchmark.
create object lo_benchmark
exporting
io_object = me
iv_method = iv_method
iv_times = mv_num_rounds.
lo_benchmark->run( ).
lo_benchmark->print( ).
endmethod.
method main.
data lo_app type ref to lcl_app.
create object lo_app.
lo_app->mv_num_rounds = 1000.
lo_app->run( 'test_setter1' ).
lo_app->run( 'test_setter2' ).
endmethod.
endclass.
start-of-selection.
lcl_app=>main( ).
| 16.837607 | 48 | 0.651269 |
032fd9909f08147f89321878f156bf6f9ef7ec71 | 10,304 | abap | ABAP | src/zcl_abapgit_zip.clas.abap | mkysoft/abapGit | 7bcdb5ee6eac380b0c0062f024e8099356efc802 | [
"MIT"
] | null | null | null | src/zcl_abapgit_zip.clas.abap | mkysoft/abapGit | 7bcdb5ee6eac380b0c0062f024e8099356efc802 | [
"MIT"
] | null | null | null | src/zcl_abapgit_zip.clas.abap | mkysoft/abapGit | 7bcdb5ee6eac380b0c0062f024e8099356efc802 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_zip DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS export
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
!iv_show_log TYPE abap_bool DEFAULT abap_true
!it_filter TYPE zif_abapgit_definitions=>ty_tadir_tt OPTIONAL
RETURNING
VALUE(rv_xstr) TYPE xstring
RAISING
zcx_abapgit_exception .
CLASS-METHODS export_object
RAISING
zcx_abapgit_exception .
CLASS-METHODS export_package
EXPORTING
!ev_xstr TYPE xstring
!ev_package TYPE devclass
RAISING
zcx_abapgit_exception .
CLASS-METHODS load
IMPORTING
!iv_xstr TYPE xstring
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS save_binstring_to_localfile
IMPORTING iv_filename TYPE string
iv_binstring TYPE xstring
RAISING zcx_abapgit_exception.
CLASS-METHODS encode_files
IMPORTING
!it_files TYPE zif_abapgit_definitions=>ty_files_item_tt
RETURNING
VALUE(rv_xstr) TYPE xstring
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
CLASS-DATA gv_prev TYPE string .
PRIVATE SECTION.
CLASS-METHODS filename
IMPORTING
!iv_str TYPE string
EXPORTING
!ev_path TYPE string
!ev_filename TYPE string
RAISING
zcx_abapgit_exception .
CLASS-METHODS normalize_path
CHANGING
!ct_files TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception.
CLASS-METHODS unzip_file
IMPORTING
!iv_xstr TYPE xstring
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_ZIP IMPLEMENTATION.
METHOD encode_files.
DATA: lo_zip TYPE REF TO cl_abap_zip,
lv_filename TYPE string.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF it_files.
CREATE OBJECT lo_zip.
LOOP AT it_files ASSIGNING <ls_file>.
CONCATENATE <ls_file>-file-path+1 <ls_file>-file-filename INTO lv_filename.
lo_zip->add( name = lv_filename
content = <ls_file>-file-data ).
ENDLOOP.
rv_xstr = lo_zip->save( ).
ENDMETHOD.
METHOD export.
DATA: li_log TYPE REF TO zif_abapgit_log,
lt_zip TYPE zif_abapgit_definitions=>ty_files_item_tt,
lv_package TYPE devclass.
CREATE OBJECT li_log TYPE zcl_abapgit_log.
lv_package = io_repo->get_package( ).
IF zcl_abapgit_factory=>get_sap_package( lv_package )->exists( ) = abap_false.
zcx_abapgit_exception=>raise( |Package { lv_package } doesn't exist| ).
ENDIF.
lt_zip = io_repo->get_files_local( ii_log = li_log
it_filter = it_filter ).
IF li_log->count( ) > 0 AND iv_show_log = abap_true.
zcl_abapgit_log_viewer=>show_log( iv_header_text = 'Zip Export Log'
ii_log = li_log ).
ENDIF.
rv_xstr = encode_files( lt_zip ).
ENDMETHOD.
METHOD export_object.
DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir,
lv_folder TYPE string,
lv_fullpath TYPE string,
lv_sep TYPE c LENGTH 1,
ls_files_item TYPE zcl_abapgit_objects=>ty_serialization.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF ls_files_item-files.
WHILE ls_tadir IS INITIAL.
ls_tadir = zcl_abapgit_ui_factory=>get_popups( )->popup_object( ).
IF ls_tadir IS INITIAL.
MESSAGE 'Object couldn''t be found' TYPE 'S' DISPLAY LIKE 'E'.
ENDIF.
ENDWHILE.
ls_files_item-item-obj_type = ls_tadir-object.
ls_files_item-item-obj_name = ls_tadir-obj_name.
ls_files_item = zcl_abapgit_objects=>serialize( is_item = ls_files_item-item
iv_language = sy-langu ).
IF lines( ls_files_item-files ) = 0.
MESSAGE 'Empty' TYPE 'S'.
RETURN.
ENDIF.
cl_gui_frontend_services=>directory_browse(
EXPORTING
initial_folder = gv_prev
CHANGING
selected_folder = lv_folder ).
IF lv_folder IS INITIAL.
RETURN.
ENDIF.
gv_prev = lv_folder.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_sep ).
LOOP AT ls_files_item-files ASSIGNING <ls_file>.
CONCATENATE lv_folder lv_sep <ls_file>-filename INTO lv_fullpath.
save_binstring_to_localfile( iv_filename = lv_fullpath
iv_binstring = <ls_file>-data ).
ENDLOOP.
ENDMETHOD.
METHOD export_package.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_offline,
ls_data TYPE zif_abapgit_persistence=>ty_repo,
li_popups TYPE REF TO zif_abapgit_popups.
DATA lv_serialize_master_lang_only TYPE abap_bool.
ls_data-key = 'DUMMY'.
ls_data-dot_abapgit = zcl_abapgit_dot_abapgit=>build_default( )->get_data( ).
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->popup_package_export(
IMPORTING
ev_package = ls_data-package
ev_folder_logic = ls_data-dot_abapgit-folder_logic
ev_serialize_master_lang_only = lv_serialize_master_lang_only ).
IF ls_data-package IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
ls_data-local_settings-serialize_master_lang_only = lv_serialize_master_lang_only.
CREATE OBJECT lo_repo
EXPORTING
is_data = ls_data.
ev_xstr = export( lo_repo ).
ev_package = ls_data-package.
ENDMETHOD.
METHOD filename.
IF iv_str CA '/'.
FIND REGEX '(.*/)(.*)' IN iv_str
SUBMATCHES ev_path ev_filename.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Malformed path' ).
ENDIF.
IF ev_path <> '/'.
CONCATENATE '/' ev_path INTO ev_path.
ENDIF.
ELSE.
ev_path = '/'.
ev_filename = iv_str.
ENDIF.
TRANSLATE ev_filename TO LOWER CASE.
ENDMETHOD.
METHOD load.
rt_files = unzip_file( iv_xstr ).
ENDMETHOD.
METHOD normalize_path.
* removes first folder from path if needed
DATA: lt_split TYPE TABLE OF string,
lv_needed TYPE abap_bool,
lv_length TYPE i,
lv_split LIKE LINE OF lt_split.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF ct_files.
READ TABLE ct_files INDEX 1 ASSIGNING <ls_file>.
IF sy-subrc <> 0.
RETURN.
ENDIF.
SPLIT <ls_file>-path AT '/' INTO TABLE lt_split.
IF sy-subrc <> 0.
RETURN.
ENDIF.
READ TABLE lt_split INDEX 2 INTO lv_split.
IF sy-subrc <> 0 OR strlen( lv_split ) = 0.
RETURN.
ENDIF.
CONCATENATE '/' lv_split '/*' INTO lv_split.
lv_needed = abap_true.
LOOP AT ct_files ASSIGNING <ls_file>.
IF NOT <ls_file>-path CP lv_split.
lv_needed = abap_false.
EXIT. " current loop
ENDIF.
ENDLOOP.
IF lv_needed = abap_true.
lv_length = strlen( lv_split ) - 2.
LOOP AT ct_files ASSIGNING <ls_file>.
<ls_file>-path = <ls_file>-path+lv_length.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD save_binstring_to_localfile.
DATA lt_rawdata TYPE solix_tab.
lt_rawdata = cl_bcs_convert=>xstring_to_solix( iv_binstring ).
cl_gui_frontend_services=>gui_download(
EXPORTING
bin_filesize = xstrlen( iv_binstring )
filename = iv_filename
filetype = 'BIN'
CHANGING
data_tab = lt_rawdata
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from gui_download' ).
ENDIF.
ENDMETHOD.
METHOD unzip_file.
DATA: lo_zip TYPE REF TO cl_abap_zip,
lv_data TYPE xstring.
FIELD-SYMBOLS: <ls_zipfile> LIKE LINE OF lo_zip->files,
<ls_file> LIKE LINE OF rt_files.
CREATE OBJECT lo_zip.
lo_zip->load( EXPORTING
zip = iv_xstr
EXCEPTIONS
zip_parse_error = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from zip' ).
ENDIF.
LOOP AT lo_zip->files ASSIGNING <ls_zipfile>.
lo_zip->get(
EXPORTING
name = <ls_zipfile>-name
IMPORTING
content = lv_data
EXCEPTIONS
zip_index_error = 1
zip_decompression_error = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from zip get' ).
ENDIF.
APPEND INITIAL LINE TO rt_files ASSIGNING <ls_file>.
filename(
EXPORTING
iv_str = <ls_zipfile>-name
IMPORTING
ev_path = <ls_file>-path
ev_filename = <ls_file>-filename ).
<ls_file>-data = lv_data.
<ls_file>-sha1 = zcl_abapgit_hash=>sha1( iv_type = zif_abapgit_definitions=>c_type-blob
iv_data = <ls_file>-data ).
ENDLOOP.
DELETE rt_files WHERE filename IS INITIAL.
normalize_path( CHANGING ct_files = rt_files ).
ENDMETHOD.
ENDCLASS.
| 26.763636 | 93 | 0.606658 |
03323fe2face77544cc02b2c152adc71da3b4a1b | 3,306 | abap | ABAP | src/zabapgit_ci_tests.prog.abap | gregorwolf/abapGitCI | 4129986c33b4d5dff16881a2000c2079bb019c90 | [
"MIT"
] | null | null | null | src/zabapgit_ci_tests.prog.abap | gregorwolf/abapGitCI | 4129986c33b4d5dff16881a2000c2079bb019c90 | [
"MIT"
] | null | null | null | src/zabapgit_ci_tests.prog.abap | gregorwolf/abapGitCI | 4129986c33b4d5dff16881a2000c2079bb019c90 | [
"MIT"
] | null | null | null | *&---------------------------------------------------------------------*
*& Report ZABAPGIT_CI_TESTS
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zabapgit_ci_tests.
PARAMETERS: p_test TYPE flag DEFAULT abap_true.
PARAMETERS: p_delete TYPE flag.
START-OF-SELECTION.
TYPES: BEGIN OF t_abapgit_repo_with_name,
name TYPE string,
abapgit_repo TYPE REF TO zcl_abapgit_repo,
END OF t_abapgit_repo_with_name.
TYPES: tt_abapgit_repo_with_name TYPE STANDARD TABLE OF t_abapgit_repo_with_name WITH KEY name.
DATA: lt_tt_abapgit_repo_with_name TYPE tt_abapgit_repo_with_name.
DATA: lo_abapgit_ci TYPE REF TO zcl_abapgit_ci.
CREATE OBJECT lo_abapgit_ci.
DATA(lt_repos) = lo_abapgit_ci->get_test_repo_list( ).
DATA(lt_abapgit_repos) = zcl_abapgit_repo_srv=>get_instance( )->list( ).
LOOP AT lt_abapgit_repos ASSIGNING FIELD-SYMBOL(<fs_abapgit_repo>).
APPEND INITIAL LINE TO lt_tt_abapgit_repo_with_name ASSIGNING FIELD-SYMBOL(<fs_abapgit_repo_with_name>).
<fs_abapgit_repo_with_name>-name = <fs_abapgit_repo>->get_name( ).
<fs_abapgit_repo_with_name>-abapgit_repo = <fs_abapgit_repo>.
ENDLOOP.
LOOP AT lt_repos ASSIGNING FIELD-SYMBOL(<fs_repo>).
IF p_test = abap_true AND sy-tabix > 3.
EXIT.
ENDIF.
WRITE: / <fs_repo>-name.
READ TABLE lt_tt_abapgit_repo_with_name WITH KEY name = <fs_repo>-name ASSIGNING <fs_abapgit_repo_with_name>.
IF sy-subrc <> 0.
IF p_delete <> abap_true.
DATA(lv_package) = lo_abapgit_ci->create_local_package_name( <fs_repo>-name ).
TRY.
lo_abapgit_ci->create_package_if_not_existing(
iv_package = lv_package
is_repo = <fs_repo>
).
CATCH zcx_abapgit_exception INTO DATA(ex).
WRITE: ex->get_longtext( ).
ENDTRY.
ENDIF.
ELSE.
TRY.
* " Delete Repository
DATA: is_checks TYPE zif_abapgit_definitions=>ty_delete_checks.
IF p_delete = abap_true.
WRITE: / 'delete'.
TRY.
zcl_abapgit_repo_srv=>get_instance( )->purge(
EXPORTING
io_repo = <fs_abapgit_repo_with_name>-abapgit_repo
is_checks = is_checks
).
CATCH zcx_abapgit_exception INTO ex.
WRITE: ex->get_longtext( ).
zcl_abapgit_repo_srv=>get_instance( )->delete( io_repo = <fs_abapgit_repo_with_name>-abapgit_repo ).
zcl_abapgit_repo_srv=>get_instance( )->purge(
EXPORTING
io_repo = <fs_abapgit_repo_with_name>-abapgit_repo
is_checks = is_checks
).
ENDTRY.
ENDIF.
CATCH zcx_abapgit_exception INTO ex.
WRITE: ex->get_longtext( ).
ENDTRY.
ENDIF.
IF p_delete <> abap_true.
TRY.
" Pull Repository
lo_abapgit_ci->pull( iv_key = <fs_abapgit_repo_with_name>-abapgit_repo->get_key( ) ).
CATCH zcx_abapgit_exception INTO ex.
WRITE: ex->get_longtext( ).
ENDTRY.
ENDIF.
ENDLOOP.
| 37.568182 | 116 | 0.588022 |
033493ced85850f720eef5dcbb652c12c9ef3bc1 | 5,357 | abap | ABAP | src/objects/zcl_abapgit_object_xinx.clas.abap | matt1as/abapGit | c7093e753ed23fa3937adb15602989c4ceea35b9 | [
"MIT"
] | 1 | 2019-09-11T20:57:34.000Z | 2019-09-11T20:57:34.000Z | src/objects/zcl_abapgit_object_xinx.clas.abap | matt1as/abapGit | c7093e753ed23fa3937adb15602989c4ceea35b9 | [
"MIT"
] | null | null | null | src/objects/zcl_abapgit_object_xinx.clas.abap | matt1as/abapGit | c7093e753ed23fa3937adb15602989c4ceea35b9 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_object_xinx 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.
TYPES: BEGIN OF ty_extension_index,
dd12v TYPE dd12v,
t_dd17v TYPE STANDARD TABLE OF dd17v
WITH NON-UNIQUE DEFAULT KEY,
END OF ty_extension_index.
DATA:
mv_name TYPE ddobjname,
mv_id TYPE ddobjectid.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_XINX IMPLEMENTATION.
METHOD constructor.
super->constructor( is_item = is_item
iv_language = iv_language ).
cl_wb_object_type=>get_key_components_from_id(
EXPORTING
p_key = |{ ms_item-obj_name }|
p_external_id = swbm_c_type_ddic_db_tabxinx
IMPORTING
p_key_component1 = mv_name
p_key_component2 = mv_id
EXCEPTIONS
too_many_key_components = 1
objecttype_not_existing = 2
OTHERS = 3 ).
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
" RS_DD_INDX_DELETE calls the GUI. Someday we need a better solution
CALL FUNCTION 'RS_DD_INDX_DELETE'
EXPORTING
objname = mv_name
indexname = mv_id
extension = abap_true
EXCEPTIONS
object_not_found = 1
object_not_specified = 2
permission_failure = 3
action_cancelled = 4
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from RS_DD_INDX_DELETE { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: ls_extension_index TYPE ty_extension_index,
lv_rc TYPE sy-subrc.
io_xml->read(
EXPORTING
iv_name = 'XINX'
CHANGING
cg_data = ls_extension_index ).
tadir_insert( iv_package ).
CALL FUNCTION 'DDIF_INDX_PUT'
EXPORTING
name = mv_name
id = mv_id
dd12v_wa = ls_extension_index-dd12v
TABLES
dd17v_tab = ls_extension_index-t_dd17v
EXCEPTIONS
indx_not_found = 1
name_inconsistent = 2
indx_inconsistent = 3
put_failure = 4
put_refused = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from DDIF_INDX_PUT { sy-subrc }| ).
ENDIF.
CALL FUNCTION 'DDIF_INDX_ACTIVATE'
EXPORTING
name = mv_name
id = mv_id
IMPORTING
rc = lv_rc
EXCEPTIONS
not_found = 1
put_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from DDIF_INDX_ACTIVATE { sy-subrc }| ).
ENDIF.
IF lv_rc <> 0.
zcx_abapgit_exception=>raise( |Cannot activate extension index { mv_id } of table { mv_name }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_dd12v TYPE dd12v.
CALL FUNCTION 'DDIF_INDX_GET'
EXPORTING
name = mv_name
id = mv_id
IMPORTING
dd12v_wa = lv_dd12v
EXCEPTIONS
illegal_input = 1
OTHERS = 2.
rv_bool = boolc( lv_dd12v IS NOT INITIAL ).
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.
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( |Error from RS_TOOL_ACCESS { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_extension_index TYPE ty_extension_index.
CALL FUNCTION 'DDIF_INDX_GET'
EXPORTING
name = mv_name
id = mv_id
langu = sy-langu
IMPORTING
dd12v_wa = ls_extension_index-dd12v
TABLES
dd17v_tab = ls_extension_index-t_dd17v
EXCEPTIONS
illegal_input = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from DDIF_INDX_GET { sy-subrc }| ).
ENDIF.
CLEAR: ls_extension_index-dd12v-as4user,
ls_extension_index-dd12v-as4date,
ls_extension_index-dd12v-as4time.
io_xml->add( iv_name = 'XINX'
ig_data = ls_extension_index ).
ENDMETHOD.
ENDCLASS.
| 24.022422 | 103 | 0.595483 |
03354863b78ef7a841d70b0fe46c8e23d41993d3 | 130 | abap | ABAP | src/test2/m3/z2mse_test2_m3_fgr_a.fugr.lz2mse_test2_m3_fgr_atop.abap | sabatale/SAP2Moose | 59553fab013de732e2b7c9e67b6a4de799617b6a | [
"MIT"
] | 25 | 2017-09-05T12:57:46.000Z | 2021-12-18T21:47:13.000Z | src/test2/m3/z2mse_test2_m3_fgr_a.fugr.lz2mse_test2_m3_fgr_atop.abap | sabatale/SAP2Moose | 59553fab013de732e2b7c9e67b6a4de799617b6a | [
"MIT"
] | 72 | 2017-09-18T15:16:20.000Z | 2021-12-10T20:09:32.000Z | src/test2/m3/z2mse_test2_m3_fgr_a.fugr.lz2mse_test2_m3_fgr_atop.abap | sabatale/SAP2Moose | 59553fab013de732e2b7c9e67b6a4de799617b6a | [
"MIT"
] | 6 | 2017-11-05T19:23:19.000Z | 2020-02-01T20:02:51.000Z | FUNCTION-POOL Z2MSE_TEST2_M3_FGR_A. "MESSAGE-ID ..
* INCLUDE LZ2MSE_TEST2_M3_FGR_AD... " Local class definition
| 32.5 | 69 | 0.692308 |
033ae767d17c8a1c1343ce30a22f3271f3669cbf | 13,650 | abap | ABAP | src/objects/ycl_abapgit_objects_super.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | null | null | null | src/objects/ycl_abapgit_objects_super.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | null | null | null | src/objects/ycl_abapgit_objects_super.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | 2 | 2019-11-24T20:35:16.000Z | 2020-04-16T07:29:33.000Z | CLASS ycl_abapgit_objects_super DEFINITION PUBLIC ABSTRACT.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING
is_item TYPE yif_abapgit_definitions=>ty_item
iv_language TYPE spras.
CLASS-METHODS:
jump_adt
IMPORTING i_obj_name TYPE yif_abapgit_definitions=>ty_item-obj_name
i_obj_type TYPE yif_abapgit_definitions=>ty_item-obj_type
i_sub_obj_name TYPE yif_abapgit_definitions=>ty_item-obj_name OPTIONAL
i_sub_obj_type TYPE yif_abapgit_definitions=>ty_item-obj_type OPTIONAL
i_line_number TYPE i OPTIONAL
RAISING ycx_abapgit_exception.
CONSTANTS: c_user_unknown TYPE xubname VALUE 'UNKNOWN'.
PROTECTED SECTION.
DATA: ms_item TYPE yif_abapgit_definitions=>ty_item,
mv_language TYPE spras.
METHODS:
check_timestamp
IMPORTING
iv_timestamp TYPE timestamp
iv_date TYPE datum
iv_time TYPE uzeit
RETURNING
VALUE(rv_changed) TYPE abap_bool,
get_metadata
RETURNING VALUE(rs_metadata) TYPE yif_abapgit_definitions=>ty_metadata,
corr_insert
IMPORTING iv_package TYPE devclass
RAISING ycx_abapgit_exception,
tadir_insert
IMPORTING iv_package TYPE devclass
RAISING ycx_abapgit_exception,
jump_se11
IMPORTING iv_radio TYPE string
iv_field TYPE string
RAISING ycx_abapgit_exception,
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 ycx_abapgit_exception,
set_default_package
IMPORTING iv_package TYPE devclass,
serialize_longtexts
IMPORTING io_xml TYPE REF TO ycl_abapgit_xml_output
iv_longtext_id TYPE dokil-id OPTIONAL
it_dokil TYPE yif_abapgit_definitions=>tty_dokil OPTIONAL
RAISING ycx_abapgit_exception,
deserialize_longtexts
IMPORTING io_xml TYPE REF TO ycl_abapgit_xml_input
RAISING ycx_abapgit_exception,
delete_longtexts
IMPORTING iv_longtext_id TYPE dokil-id
RAISING ycx_abapgit_exception.
PRIVATE SECTION.
CLASS-METHODS:
is_adt_jump_possible
IMPORTING io_object TYPE REF TO cl_wb_object
io_adt TYPE REF TO object
RETURNING VALUE(r_is_adt_jump_possible) TYPE abap_bool
RAISING ycx_abapgit_exception.
CLASS-METHODS:
get_adt_objects_and_names
IMPORTING
i_obj_name TYPE yif_abapgit_definitions=>ty_item-obj_name
i_obj_type TYPE yif_abapgit_definitions=>ty_item-obj_type
EXPORTING
eo_adt_uri_mapper TYPE REF TO object
eo_adt_objectref TYPE REF TO object
e_program TYPE progname
e_include TYPE progname
RAISING
ycx_abapgit_exception.
ENDCLASS.
CLASS ycl_abapgit_objects_super IMPLEMENTATION.
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 check_timestamp.
DATA: lv_ts TYPE timestamp.
IF sy-subrc = 0 AND iv_date IS NOT INITIAL AND iv_time IS NOT INITIAL.
cl_abap_tstmp=>systemtstmp_syst2utc(
EXPORTING syst_date = iv_date
syst_time = iv_time
IMPORTING utc_tstmp = lv_ts ).
IF lv_ts < iv_timestamp.
rv_changed = abap_false. " Unchanged
ELSE.
rv_changed = abap_true.
ENDIF.
ELSE. " Not found? => changed
rv_changed = abap_true.
ENDIF.
ENDMETHOD.
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: ls_object TYPE ddenqs.
ls_object-objtype = ms_item-obj_type.
ls_object-objname = ms_item-obj_name.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = ls_object
object_class = 'DICT'
devclass = iv_package
master_language = mv_language
mode = 'INSERT'
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc = 1.
ycx_abapgit_exception=>raise( 'Cancelled' ).
ELSEIF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'error from RS_CORR_INSERT' ).
ENDIF.
ENDMETHOD.
METHOD delete_longtexts.
ycl_abapgit_longtexts=>delete( iv_longtext_id = iv_longtext_id
iv_object_name = ms_item-obj_name ).
ENDMETHOD.
METHOD deserialize_longtexts.
ycl_abapgit_longtexts=>deserialize( io_xml = io_xml
iv_master_language = mv_language ).
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.
ycx_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' ##no_text.
ENDMETHOD.
METHOD is_adt_jump_possible.
DATA: lo_wb_request TYPE REF TO cl_wb_request,
lo_adt_uri_mapper_vit TYPE REF TO object,
lv_vit_wb_request TYPE abap_bool.
cl_wb_request=>create_from_object_ref(
EXPORTING
p_wb_object = io_object
RECEIVING
p_wb_request = lo_wb_request
EXCEPTIONS
illegal_operation = 1
cancelled = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDIF.
TRY.
CALL METHOD io_adt->('IF_ADT_TOOLS_CORE_FACTORY~GET_URI_MAPPER_VIT')
RECEIVING
result = lo_adt_uri_mapper_vit.
CALL METHOD lo_adt_uri_mapper_vit->('IF_ADT_URI_MAPPER_VIT~IS_VIT_WB_REQUEST')
EXPORTING
wb_request = lo_wb_request
RECEIVING
result = lv_vit_wb_request.
IF lv_vit_wb_request = abap_true.
r_is_adt_jump_possible = abap_false.
ELSE.
r_is_adt_jump_possible = abap_true.
ENDIF.
CATCH cx_root.
ycx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDTRY.
ENDMETHOD.
METHOD jump_adt.
DATA: lv_adt_link TYPE string.
DATA: lo_adt_uri_mapper TYPE REF TO object ##needed.
DATA: lo_adt_objref TYPE REF TO object ##needed.
DATA: lo_adt_sub_objref TYPE REF TO object ##needed.
DATA: lv_program TYPE progname.
DATA: lv_include TYPE progname.
FIELD-SYMBOLS: <lv_uri> TYPE string.
get_adt_objects_and_names(
EXPORTING
i_obj_name = i_obj_name
i_obj_type = i_obj_type
IMPORTING
eo_adt_uri_mapper = lo_adt_uri_mapper
eo_adt_objectref = lo_adt_objref
e_program = lv_program
e_include = lv_include ).
TRY.
IF i_sub_obj_name IS NOT INITIAL.
IF ( lv_program <> i_obj_name AND lv_include IS INITIAL ) OR
( lv_program = lv_include AND i_sub_obj_name IS NOT INITIAL ).
lv_include = i_sub_obj_name.
ENDIF.
CALL METHOD lo_adt_uri_mapper->('IF_ADT_URI_MAPPER~MAP_INCLUDE_TO_OBJREF')
EXPORTING
program = lv_program
include = lv_include
line = i_line_number
line_offset = 0
end_line = i_line_number
end_offset = 1
RECEIVING
result = lo_adt_sub_objref.
IF lo_adt_sub_objref IS NOT INITIAL.
lo_adt_objref = lo_adt_sub_objref.
ENDIF.
ENDIF.
ASSIGN ('LO_ADT_OBJREF->REF_DATA-URI') TO <lv_uri>.
ASSERT sy-subrc = 0.
CONCATENATE 'adt://' sy-sysid <lv_uri> INTO lv_adt_link.
cl_gui_frontend_services=>execute( EXPORTING document = lv_adt_link
EXCEPTIONS OTHERS = 1 ).
IF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDIF.
CATCH cx_root.
ycx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDTRY.
ENDMETHOD.
METHOD get_adt_objects_and_names.
DATA lv_obj_type TYPE trobjtype.
DATA lv_obj_name TYPE trobj_name.
DATA lo_object TYPE REF TO cl_wb_object.
DATA lo_adt TYPE REF TO object.
FIELD-SYMBOLS <lv_uri> TYPE string.
lv_obj_name = i_obj_name.
lv_obj_type = i_obj_type.
TRY.
cl_wb_object=>create_from_transport_key(
EXPORTING
p_object = lv_obj_type
p_obj_name = lv_obj_name
RECEIVING
p_wb_object = lo_object
EXCEPTIONS
OTHERS = 1 ).
IF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDIF.
CALL METHOD ('CL_ADT_TOOLS_CORE_FACTORY')=>('GET_INSTANCE')
RECEIVING
result = lo_adt.
IF is_adt_jump_possible( io_object = lo_object
io_adt = lo_adt ) = abap_false.
ycx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDIF.
CALL METHOD lo_adt->('IF_ADT_TOOLS_CORE_FACTORY~GET_URI_MAPPER')
RECEIVING
result = eo_adt_uri_mapper.
CALL METHOD eo_adt_uri_mapper->('IF_ADT_URI_MAPPER~MAP_WB_OBJECT_TO_OBJREF')
EXPORTING
wb_object = lo_object
RECEIVING
result = eo_adt_objectref.
ASSIGN ('EO_ADT_OBJECTREF->REF_DATA-URI') TO <lv_uri>.
ASSERT sy-subrc = 0.
CALL METHOD eo_adt_uri_mapper->('IF_ADT_URI_MAPPER~MAP_OBJREF_TO_INCLUDE')
EXPORTING
uri = <lv_uri>
IMPORTING
program = e_program
include = e_include.
CATCH cx_root.
ycx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDTRY.
ENDMETHOD.
METHOD jump_se11.
DATA: lt_bdcdata TYPE TABLE OF bdcdata.
FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-program = 'SAPLSD_ENTRY'.
<ls_bdcdata>-dynpro = '1000'.
<ls_bdcdata>-dynbegin = abap_true.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-fnam = 'BDC_OKCODE'.
<ls_bdcdata>-fval = '=WB_DISPLAY'.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-fnam = iv_radio.
<ls_bdcdata>-fval = abap_true.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-fnam = iv_field.
<ls_bdcdata>-fval = ms_item-obj_name.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'SE11'
mode_val = 'E'
TABLES
using_tab = lt_bdcdata
EXCEPTIONS
system_failure = 1
communication_failure = 2
resource_failure = 3
OTHERS = 4
##fm_subrc_ok. "#EC CI_SUBRC
ENDMETHOD.
METHOD serialize_longtexts.
ycl_abapgit_longtexts=>serialize( iv_object_name = ms_item-obj_name
iv_longtext_id = iv_longtext_id
it_dokil = it_dokil
io_xml = io_xml ).
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.
ycx_abapgit_exception=>raise( 'error from TR_TADIR_INTERFACE' ).
ENDIF.
ENDMETHOD.
ENDCLASS.
| 29.354839 | 88 | 0.611209 |
033b686a714b40f967e2a17ba089ce4b4876d1d8 | 14,765 | abap | ABAP | src/objects/ycl_abapgit_object_tran.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | null | null | null | src/objects/ycl_abapgit_object_tran.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | null | null | null | src/objects/ycl_abapgit_object_tran.clas.abap | abapGit/y-version | 2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc | [
"MIT"
] | 2 | 2019-11-24T20:35:16.000Z | 2020-04-16T07:29:33.000Z | CLASS ycl_abapgit_object_tran DEFINITION PUBLIC INHERITING FROM ycl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES yif_abapgit_object.
ALIASES mo_files FOR yif_abapgit_object~mo_files.
PRIVATE SECTION.
CONSTANTS: c_oo_program(9) VALUE '\PROGRAM=',
c_oo_class(7) VALUE '\CLASS=',
c_oo_method(8) VALUE '\METHOD=',
c_oo_tcode TYPE tcode VALUE 'OS_APPLICATION',
c_oo_frclass(30) VALUE 'CLASS',
c_oo_frmethod(30) VALUE 'METHOD',
c_oo_frupdtask(30) VALUE 'UPDATE_MODE',
c_oo_synchron VALUE 'S',
c_oo_asynchron VALUE 'U',
c_true TYPE c VALUE 'X',
c_false TYPE c VALUE space.
METHODS:
split_parameters
CHANGING ct_rsparam TYPE s_param
cs_rsstcd TYPE rsstcd
cs_tstcp TYPE tstcp
cs_tstc TYPE tstc,
split_parameters_comp
IMPORTING ig_type TYPE any
ig_param TYPE any
CHANGING cg_value TYPE any,
serialize_texts
IMPORTING io_xml TYPE REF TO ycl_abapgit_xml_output
RAISING ycx_abapgit_exception,
deserialize_texts
IMPORTING io_xml TYPE REF TO ycl_abapgit_xml_input
RAISING ycx_abapgit_exception.
ENDCLASS.
CLASS YCL_ABAPGIT_OBJECT_TRAN IMPLEMENTATION.
METHOD deserialize_texts.
DATA lt_tpool_i18n TYPE TABLE OF tstct.
FIELD-SYMBOLS <ls_tpool> LIKE LINE OF lt_tpool_i18n.
" Read XML-files data
io_xml->read( EXPORTING iv_name = 'I18N_TPOOL'
CHANGING cg_data = lt_tpool_i18n ).
" Force t-code name (security reasons)
LOOP AT lt_tpool_i18n ASSIGNING <ls_tpool>.
<ls_tpool>-tcode = ms_item-obj_name.
ENDLOOP.
IF lines( lt_tpool_i18n ) > 0.
MODIFY tstct FROM TABLE lt_tpool_i18n.
IF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'Update of t-code translations failed' ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD serialize_texts.
DATA lt_tpool_i18n TYPE TABLE OF tstct.
" Skip master language - it was already serialized
" Don't serialize t-code itself
SELECT sprsl ttext
INTO CORRESPONDING FIELDS OF TABLE lt_tpool_i18n
FROM tstct
WHERE sprsl <> mv_language
AND tcode = ms_item-obj_name. "#EC CI_GENBUFF
IF lines( lt_tpool_i18n ) > 0.
SORT lt_tpool_i18n BY sprsl ASCENDING.
io_xml->add( iv_name = 'I18N_TPOOL'
ig_data = lt_tpool_i18n ).
ENDIF.
ENDMETHOD.
METHOD split_parameters.
* see subroutine split_parameters in include LSEUKF01
DATA: lv_off TYPE i,
lv_param_beg TYPE i,
lv_length TYPE i,
ls_param LIKE LINE OF ct_rsparam.
FIELD-SYMBOLS <lg_f> TYPE any.
CLEAR cs_rsstcd-s_vari.
IF cs_tstcp-param(1) = '\'. " OO-Transaktion ohne FR
split_parameters_comp( EXPORTING ig_type = c_oo_program
ig_param = cs_tstcp-param
CHANGING cg_value = cs_tstc-pgmna ).
split_parameters_comp( EXPORTING ig_type = c_oo_class
ig_param = cs_tstcp-param
CHANGING cg_value = cs_rsstcd-classname ).
split_parameters_comp( EXPORTING ig_type = c_oo_method
ig_param = cs_tstcp-param
CHANGING cg_value = cs_rsstcd-method ).
IF NOT cs_tstc-pgmna IS INITIAL.
cs_rsstcd-s_local = c_true.
ENDIF.
RETURN.
ELSEIF cs_tstcp-param(1) = '@'. " Transaktionsvariante
cs_rsstcd-s_vari = c_true.
IF cs_tstcp-param(2) = '@@'.
cs_rsstcd-s_ind_vari = c_true.
lv_off = 2.
ELSE.
CLEAR cs_rsstcd-s_ind_vari.
lv_off = 1.
ENDIF.
IF cs_tstcp-param CA ' '.
ENDIF.
sy-fdpos = sy-fdpos - lv_off.
IF sy-fdpos > 0.
cs_rsstcd-call_tcode = cs_tstcp-param+lv_off(sy-fdpos).
sy-fdpos = sy-fdpos + 1 + lv_off.
cs_rsstcd-variant = cs_tstcp-param+sy-fdpos.
ENDIF.
ELSEIF cs_tstcp-param(1) = '/'.
cs_rsstcd-st_tcode = c_true.
cs_rsstcd-st_prog = space.
IF cs_tstcp-param+1(1) = '*'.
cs_rsstcd-st_skip_1 = c_true.
ELSE.
CLEAR cs_rsstcd-st_skip_1.
ENDIF.
IF cs_tstcp-param CA ' '.
ENDIF.
lv_param_beg = sy-fdpos + 1.
sy-fdpos = sy-fdpos - 2.
IF sy-fdpos > 0.
cs_rsstcd-call_tcode = cs_tstcp-param+2(sy-fdpos).
ENDIF.
SHIFT cs_tstcp-param BY lv_param_beg PLACES.
ELSE.
cs_rsstcd-st_tcode = space.
cs_rsstcd-st_prog = c_true.
ENDIF.
DO 254 TIMES.
IF cs_tstcp-param = space.
EXIT.
ENDIF.
CLEAR ls_param.
IF cs_tstcp-param CA '='.
CHECK sy-fdpos <> 0.
ASSIGN cs_tstcp-param(sy-fdpos) TO <lg_f>.
ls_param-field = <lg_f>.
IF ls_param-field(1) = space.
SHIFT ls_param-field.
ENDIF.
sy-fdpos = sy-fdpos + 1.
SHIFT cs_tstcp-param BY sy-fdpos PLACES.
IF cs_tstcp-param CA ';'.
IF sy-fdpos <> 0.
ASSIGN cs_tstcp-param(sy-fdpos) TO <lg_f>.
ls_param-value = <lg_f>.
IF ls_param-value(1) = space.
SHIFT ls_param-value.
ENDIF.
ENDIF.
sy-fdpos = sy-fdpos + 1.
SHIFT cs_tstcp-param BY sy-fdpos PLACES.
APPEND ls_param TO ct_rsparam.
ELSE.
lv_length = strlen( cs_tstcp-param ).
CHECK lv_length > 0.
ASSIGN cs_tstcp-param(lv_length) TO <lg_f>.
ls_param-value = <lg_f>.
IF ls_param-value(1) = space.
SHIFT ls_param-value.
ENDIF.
lv_length = lv_length + 1.
SHIFT cs_tstcp-param BY lv_length PLACES.
APPEND ls_param TO ct_rsparam.
ENDIF.
ENDIF.
ENDDO.
* oo-Transaktion mit Framework
IF cs_rsstcd-call_tcode = c_oo_tcode.
cs_rsstcd-s_trframe = c_true.
LOOP AT ct_rsparam INTO ls_param.
CASE ls_param-field.
WHEN c_oo_frclass.
cs_rsstcd-classname = ls_param-value.
WHEN c_oo_frmethod.
cs_rsstcd-method = ls_param-value.
WHEN c_oo_frupdtask.
IF ls_param-value = c_oo_synchron.
cs_rsstcd-s_upddir = c_true.
cs_rsstcd-s_updtask = c_false.
cs_rsstcd-s_updlok = c_false.
ELSEIF ls_param-value = c_oo_asynchron.
cs_rsstcd-s_upddir = c_false.
cs_rsstcd-s_updtask = c_true.
cs_rsstcd-s_updlok = c_false.
ELSE.
cs_rsstcd-s_upddir = c_false.
cs_rsstcd-s_updtask = c_false.
cs_rsstcd-s_updlok = c_true.
ENDIF.
ENDCASE.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD split_parameters_comp.
DATA: lv_off TYPE i.
IF ig_param CS ig_type.
lv_off = sy-fdpos + strlen( ig_type ).
cg_value = ig_param+lv_off.
IF cg_value CA '\'.
CLEAR cg_value+sy-fdpos.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD yif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD yif_abapgit_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE ycl_abapgit_comparison_null.
ENDMETHOD.
METHOD yif_abapgit_object~delete.
DATA: lv_transaction TYPE tstc-tcode.
lv_transaction = ms_item-obj_name.
CALL FUNCTION 'RPY_TRANSACTION_DELETE'
EXPORTING
transaction = lv_transaction
EXCEPTIONS
not_excecuted = 1
object_not_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'Error from RPY_TRANSACTION_DELETE' ).
ENDIF.
ENDMETHOD.
METHOD yif_abapgit_object~deserialize.
CONSTANTS: lc_hex_tra TYPE x VALUE '00',
* c_hex_men TYPE x VALUE '01',
lc_hex_par TYPE x VALUE '02',
lc_hex_rep TYPE x VALUE '80'.
* c_hex_rpv TYPE x VALUE '10',
* c_hex_obj TYPE x VALUE '08',
* c_hex_chk TYPE x VALUE '04',
* c_hex_enq TYPE x VALUE '20'.
DATA: lv_dynpro TYPE d020s-dnum,
ls_tstc TYPE tstc,
lv_type TYPE rglif-docutype,
ls_tstct TYPE tstct,
ls_tstcc TYPE tstcc,
ls_tstcp TYPE tstcp,
lt_param_values TYPE TABLE OF rsparam,
ls_rsstcd TYPE rsstcd.
IF yif_abapgit_object~exists( ) = abap_true.
yif_abapgit_object~delete( ).
ENDIF.
io_xml->read( EXPORTING iv_name = 'TSTC'
CHANGING cg_data = ls_tstc ).
io_xml->read( EXPORTING iv_name = 'TSTCC'
CHANGING cg_data = ls_tstcc ).
io_xml->read( EXPORTING iv_name = 'TSTCT'
CHANGING cg_data = ls_tstct ).
io_xml->read( EXPORTING iv_name = 'TSTCP'
CHANGING cg_data = ls_tstcp ).
lv_dynpro = ls_tstc-dypno.
CASE ls_tstc-cinfo.
WHEN lc_hex_tra.
lv_type = ststc_c_type_dialog.
WHEN lc_hex_rep.
lv_type = ststc_c_type_report.
WHEN lc_hex_par.
lv_type = ststc_c_type_parameters.
* todo, or ststc_c_type_variant?
WHEN OTHERS.
ycx_abapgit_exception=>raise( 'Transaction, unknown CINFO' ).
ENDCASE.
IF ls_tstcp IS NOT INITIAL.
split_parameters(
CHANGING
ct_rsparam = lt_param_values
cs_rsstcd = ls_rsstcd
cs_tstcp = ls_tstcp
cs_tstc = ls_tstc ).
ENDIF.
CALL FUNCTION 'RPY_TRANSACTION_INSERT'
EXPORTING
transaction = ls_tstc-tcode
program = ls_tstc-pgmna
dynpro = lv_dynpro
language = mv_language
development_class = iv_package
transaction_type = lv_type
shorttext = ls_tstct-ttext
called_transaction = ls_rsstcd-call_tcode
called_transaction_skip = ls_rsstcd-st_skip_1
variant = ls_rsstcd-variant
cl_independend = ls_rsstcd-s_ind_vari
html_enabled = ls_tstcc-s_webgui
java_enabled = ls_tstcc-s_platin
wingui_enabled = ls_tstcc-s_win32
TABLES
param_values = lt_param_values
EXCEPTIONS
cancelled = 1
already_exist = 2
permission_error = 3
name_not_allowed = 4
name_conflict = 5
illegal_type = 6
object_inconsistent = 7
db_access_error = 8
OTHERS = 9.
IF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'Error from RPY_TRANSACTION_INSERT' ).
ENDIF.
" Texts deserializing (translations)
deserialize_texts( io_xml ).
ENDMETHOD.
METHOD yif_abapgit_object~exists.
DATA: lv_tcode TYPE tstc-tcode.
SELECT SINGLE tcode FROM tstc INTO lv_tcode
WHERE tcode = ms_item-obj_name. "#EC CI_GENBUFF
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD yif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD yif_abapgit_object~has_changed_since.
rv_changed = abap_true.
ENDMETHOD.
METHOD yif_abapgit_object~jump.
DATA: lt_bdcdata TYPE TABLE OF bdcdata.
FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-program = 'SAPLSEUK'.
<ls_bdcdata>-dynpro = '0390'.
<ls_bdcdata>-dynbegin = abap_true.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-fnam = 'BDC_OKCODE'.
<ls_bdcdata>-fval = '=SHOW'.
APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>.
<ls_bdcdata>-fnam = 'TSTC-TCODE'.
<ls_bdcdata>-fval = ms_item-obj_name.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'SE93'
mode_val = 'E'
TABLES
using_tab = lt_bdcdata
EXCEPTIONS
system_failure = 1
communication_failure = 2
resource_failure = 3
OTHERS = 4
##fm_subrc_ok. "#EC CI_SUBRC
ENDMETHOD.
METHOD yif_abapgit_object~serialize.
DATA: lv_transaction TYPE tstc-tcode,
lt_tcodes TYPE TABLE OF tstc,
ls_tcode LIKE LINE OF lt_tcodes,
ls_tstct TYPE tstct,
ls_tstcp TYPE tstcp,
lt_gui_attr TYPE TABLE OF tstcc,
ls_gui_attr LIKE LINE OF lt_gui_attr.
lv_transaction = ms_item-obj_name.
CALL FUNCTION 'RPY_TRANSACTION_READ'
EXPORTING
transaction = lv_transaction
TABLES
tcodes = lt_tcodes
gui_attributes = lt_gui_attr
EXCEPTIONS
permission_error = 1
cancelled = 2
not_found = 3
object_not_found = 4
OTHERS = 5.
IF sy-subrc = 4 OR sy-subrc = 3.
RETURN.
ELSEIF sy-subrc <> 0.
ycx_abapgit_exception=>raise( 'Error from RPY_TRANSACTION_READ' ).
ENDIF.
SELECT SINGLE * FROM tstct INTO ls_tstct
WHERE sprsl = mv_language
AND tcode = lv_transaction. "#EC CI_SUBRC "#EC CI_GENBUFF
SELECT SINGLE * FROM tstcp INTO ls_tstcp
WHERE tcode = lv_transaction. "#EC CI_SUBRC "#EC CI_GENBUFF
READ TABLE lt_tcodes INDEX 1 INTO ls_tcode.
ASSERT sy-subrc = 0.
READ TABLE lt_gui_attr INDEX 1 INTO ls_gui_attr.
ASSERT sy-subrc = 0.
io_xml->add( iv_name = 'TSTC'
ig_data = ls_tcode ).
io_xml->add( iv_name = 'TSTCC'
ig_data = ls_gui_attr ).
io_xml->add( iv_name = 'TSTCT'
ig_data = ls_tstct ).
IF ls_tstcp IS NOT INITIAL.
io_xml->add( iv_name = 'TSTCP'
ig_data = ls_tstcp ).
ENDIF.
" Texts serializing (translations)
serialize_texts( io_xml ).
ENDMETHOD.
METHOD yif_abapgit_object~is_locked.
DATA: lv_object TYPE eqegraarg.
lv_object = |TN{ ms_item-obj_name }|.
OVERLAY lv_object WITH ' '.
lv_object = lv_object && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'EEUDB'
iv_argument = lv_object ).
ENDMETHOD.
ENDCLASS.
| 29.471058 | 96 | 0.584829 |
033be9245003a7d2453f98a0a9a7b05568da3432 | 106 | abap | ABAP | src/y_code_pal_version.intf.abap | thomham/code-pal-for-abap | c58c4333f236a17937335871d9261b0897209399 | [
"Apache-2.0"
] | null | null | null | src/y_code_pal_version.intf.abap | thomham/code-pal-for-abap | c58c4333f236a17937335871d9261b0897209399 | [
"Apache-2.0"
] | null | null | null | src/y_code_pal_version.intf.abap | thomham/code-pal-for-abap | c58c4333f236a17937335871d9261b0897209399 | [
"Apache-2.0"
] | null | null | null | INTERFACE y_code_pal_version PUBLIC.
CONSTANTS abap TYPE string VALUE '1.06.0' ##NO_TEXT.
ENDINTERFACE.
| 26.5 | 54 | 0.792453 |
033d2befe9c7d92fe68def2deaef05224fd95b3e | 7,717 | abap | ABAP | src/zcl_soap_static.clas.abap | ivangurin/abapSOAP | 5ff38c1cf5c06da24c8d9514410f9f7f03fee33c | [
"MIT"
] | 1 | 2019-04-29T21:58:06.000Z | 2019-04-29T21:58:06.000Z | src/zcl_soap_static.clas.abap | ivangurin/abapSOAP | 5ff38c1cf5c06da24c8d9514410f9f7f03fee33c | [
"MIT"
] | null | null | null | src/zcl_soap_static.clas.abap | ivangurin/abapSOAP | 5ff38c1cf5c06da24c8d9514410f9f7f03fee33c | [
"MIT"
] | null | null | null | *----------------------------------------------------------------------*
* CLASS ZCL_SOAP_STATIC DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class ZCL_SOAP_STATIC definition
public
final
create public .
*"* public components of class ZCL_SOAP_STATIC
*"* do not include other source files here!!!
public section.
types:
begin of ts_envelope,
header type string,
body type string,
end of ts_envelope .
types:
begin of ts_fault,
faultcode type string,
faultstring type string,
detail type string,
end of ts_fault .
constants FIELD_ACTION type STRING value 'SOAPAction' ##NO_TEXT.
constants CONTENT_TYPE type STRING value 'text/xml;charset=UTF-8' ##NO_TEXT.
class-methods ENVELOPE_DATA2XML
importing
!IS_ENVELOPE type TS_ENVELOPE
returning
value(E_XML) type STRING
raising
ZCX_GENERIC .
class-methods ENVELOPE_XML2DATA
importing
!I_XML type STRING
returning
value(ES_DATA) type TS_ENVELOPE
raising
ZCX_GENERIC .
class-methods FAULT_XML2DATA
importing
!I_XML type STRING
returning
value(ES_DATA) type TS_FAULT
raising
ZCX_GENERIC .
protected section.
*"* protected components of class ZCL_SOAP_STATIC
*"* do not include other source files here!!!
private section.
*"* private components of class ZCL_SOAP_STATIC
*"* do not include other source files here!!!
ENDCLASS.
CLASS ZCL_SOAP_STATIC IMPLEMENTATION.
method envelope_data2xml.
try.
call transformation zsoap_envelope_data2xml
source data = is_envelope
result xml e_xml.
data lx_root type ref to cx_root.
catch cx_root into lx_root.
zcx_generic=>raise( ix_root = lx_root ).
endtry.
endmethod. "envelope2xml
method envelope_xml2data.
try.
data lr_ixml type ref to if_ixml.
lr_ixml = cl_ixml=>create( ).
data lr_stream_factory type ref to if_ixml_stream_factory.
lr_stream_factory = lr_ixml->create_stream_factory( ).
data lr_stream type ref to if_ixml_istream.
lr_stream = lr_stream_factory->create_istream_string( i_xml ).
data lr_document type ref to if_ixml_document.
lr_document = lr_ixml->create_document( ).
data lr_parser type ref to if_ixml_parser.
lr_parser =
lr_ixml->create_parser(
stream_factory = lr_stream_factory
istream = lr_stream
document = lr_document ).
lr_parser->parse( ).
data lr_root type ref to if_ixml_node.
lr_root = lr_document->get_root( ).
data lt_children type ref to if_ixml_node_list.
lt_children = lr_root->get_children( ).
data lr_iterator type ref to if_ixml_node_iterator.
lr_iterator = lt_children->create_iterator( ).
data lr_node type ref to if_ixml_node.
lr_node = lr_iterator->get_next( ). " Envelope
data l_namespace type string.
l_namespace = lr_node->get_namespace( ).
data lr_header type ref to if_ixml_element.
lr_header =
lr_document->find_from_name(
name = 'Header' "#EC NOTEXT
namespace = l_namespace ).
if lr_header is bound.
lt_children = lr_header->get_children( ).
lr_iterator = lt_children->create_iterator( ).
lr_node = lr_iterator->get_next( ).
data lr_xml type ref to cl_xml_document.
create object lr_xml.
lr_xml->create_with_node( lr_node ).
lr_xml->render_2_string(
importing
stream = es_data-header ).
endif.
data lr_body type ref to if_ixml_element.
lr_body =
lr_document->find_from_name(
name = 'Body' "#EC NOTEXT
namespace = l_namespace ).
if lr_body is bound.
lt_children = lr_body->get_children( ).
lr_iterator = lt_children->create_iterator( ).
lr_node = lr_iterator->get_next( ).
create object lr_xml.
lr_xml->create_with_node( lr_node ).
lr_xml->render_2_string( importing stream = es_data-body ).
endif.
*** call transformation Z_SOAP_ENVELOPE_XML2DATA
*** source xml i_xml
*** result envelope = es_envelope.
data lx_root type ref to cx_root.
catch cx_root into lx_root.
zcx_generic=>raise( ix_root = lx_root ).
endtry.
endmethod. "xml2envelope
method fault_xml2data.
try.
data lr_ixml type ref to if_ixml.
lr_ixml = cl_ixml=>create( ).
data lr_stream_factory type ref to if_ixml_stream_factory.
lr_stream_factory = lr_ixml->create_stream_factory( ).
data lr_stream type ref to if_ixml_istream.
lr_stream = lr_stream_factory->create_istream_string( i_xml ).
data lr_document type ref to if_ixml_document.
lr_document = lr_ixml->create_document( ).
data lr_parser type ref to if_ixml_parser.
lr_parser =
lr_ixml->create_parser(
stream_factory = lr_stream_factory
istream = lr_stream
document = lr_document ).
lr_parser->parse( ).
data lr_root type ref to if_ixml_node.
lr_root = lr_document->get_root( ).
data lt_children type ref to if_ixml_node_list.
lt_children = lr_root->get_children( ).
data lr_iterator type ref to if_ixml_node_iterator.
lr_iterator = lt_children->create_iterator( ).
data lr_node type ref to if_ixml_node.
lr_node = lr_iterator->get_next( ). " Fault node
data l_namespace type string.
l_namespace = lr_node->get_namespace( ).
data lr_element type ref to if_ixml_element.
lr_element =
lr_document->find_from_name(
name = 'faultcode'
namespace = l_namespace ).
if lr_element is not bound.
lr_element = lr_document->find_from_name( 'faultcode' ).
endif.
if lr_element is bound.
es_data-faultcode = lr_element->get_value( ).
endif.
free lr_element.
lr_element =
lr_document->find_from_name(
name = 'faultstring'
namespace = l_namespace ).
if lr_element is not bound.
lr_element = lr_document->find_from_name( 'faultstring' ).
endif.
if lr_element is bound.
es_data-faultstring = lr_element->get_value( ).
endif.
free lr_element.
lr_element =
lr_document->find_from_name(
name = 'detail'
namespace = l_namespace ).
if lr_element is not bound.
lr_element = lr_document->find_from_name( 'detail' ).
endif.
if lr_element is bound.
data l_value type string.
l_value = lr_element->get_value( ).
if l_value is not initial.
data lr_xml type ref to cl_xml_document.
create object lr_xml.
lr_xml->create_with_node( lr_element ).
lr_xml->render_2_string(
importing
stream = es_data-detail ).
endif.
endif.
data lx_root type ref to cx_root.
catch cx_root into lx_root.
zcx_generic=>raise( ix_root = lx_root ).
endtry.
endmethod. "xml2fault
ENDCLASS.
| 28.061818 | 78 | 0.595957 |
034011aea120eb21ef83a3e9206ebc6b8b8b9774 | 858 | abap | ABAP | ABAP/Functions/Functions.abap | etiiiR/SAP-ABAP-Development | f01d5ee8b6e9cb0daf5958d1ce4b1ed3a4d7cffb | [
"MIT"
] | 50 | 2017-08-27T21:50:20.000Z | 2022-03-23T23:06:44.000Z | ABAP/Functions/Functions.abap | MislavJaksic/SAP-ABAP-Development | f01d5ee8b6e9cb0daf5958d1ce4b1ed3a4d7cffb | [
"MIT"
] | null | null | null | ABAP/Functions/Functions.abap | MislavJaksic/SAP-ABAP-Development | f01d5ee8b6e9cb0daf5958d1ce4b1ed3a4d7cffb | [
"MIT"
] | 23 | 2017-08-31T09:17:27.000Z | 2022-01-20T07:57:17.000Z | REPORT functions.
*In ABAP there are both subroutines and functions
*For modularization, there are also include programs, macros, global classes and function groups
DATA number TYPE i VALUE 5.
DATA str TYPE string VALUE 'String'.
PERFORM subroutine USING number
str.
WRITE number. "-> 5
WRITE str. "-> Subroutine changed me.
*Function module
*Use the 'Pattern' button to fill in the function module call
DATA words TYPE spell.
CALL FUNCTION 'SPELL_AMOUNT' EXPORTING amount = 15 "what you give to the function module
IMPORTING in_words = words."what you get from the function module
WRITE / words-word. "-> FIFTEEN
FORM subroutine USING value(number) "pass by value
CHANGING str. "pass by reference
number = number DIV 2.
str = 'Subroutine changed me.'.
ENDFORM.
| 34.32 | 96 | 0.689977 |
03407c41e6b50d9930d4c61bd4fa872f97ddb22f | 707 | abap | ABAP | src/zcl_control.clas.abap | aufaraditya/ABAP-MVC-Design-Pattern-Template | 40238e36c4266003ae4dfb2e522d2dde19f6ed1a | [
"MIT"
] | null | null | null | src/zcl_control.clas.abap | aufaraditya/ABAP-MVC-Design-Pattern-Template | 40238e36c4266003ae4dfb2e522d2dde19f6ed1a | [
"MIT"
] | null | null | null | src/zcl_control.clas.abap | aufaraditya/ABAP-MVC-Design-Pattern-Template | 40238e36c4266003ae4dfb2e522d2dde19f6ed1a | [
"MIT"
] | null | null | null | CLASS zcl_control DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
DATA model TYPE REF TO zcl_model .
METHODS get_object
IMPORTING
!name TYPE char30 .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_control IMPLEMENTATION.
METHOD get_object .
DATA: object TYPE REF TO object.
TRY.
CREATE OBJECT object TYPE (name).
CATCH cx_sy_create_object_error INTO DATA(object_error).
MESSAGE |{ object_error->get_text( ) }| TYPE 'E'.
ENDTRY.
TRY.
model ?= object.
CATCH cx_sy_move_cast_error INTO DATA(casting_error).
MESSAGE |{ casting_error->get_text( ) }| TYPE 'E'.
ENDTRY.
ENDMETHOD.
ENDCLASS.
| 18.128205 | 62 | 0.660537 |
03414e4893e7d9258bbbb510c04385cd8c4e0069 | 175,308 | abap | ABAP | src/zcl_excel_worksheet.clas.abap | gabrielros/abap2xlsx_ES | 3f913357547d18a28f09aae122e5464079458ff7 | [
"Apache-2.0"
] | null | null | null | src/zcl_excel_worksheet.clas.abap | gabrielros/abap2xlsx_ES | 3f913357547d18a28f09aae122e5464079458ff7 | [
"Apache-2.0"
] | null | null | null | src/zcl_excel_worksheet.clas.abap | gabrielros/abap2xlsx_ES | 3f913357547d18a28f09aae122e5464079458ff7 | [
"Apache-2.0"
] | null | null | null | class ZCL_EXCEL_WORKSHEET definition
public
create public .
public section.
*"* public components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
type-pools ABAP .
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 .
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
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 .
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 .
methods ADD_NEW_STYLE_COND
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 .
type-pools SLIS .
type-pools SOI .
methods BIND_ALV_OLE2
importing
!I_DOCUMENT_URL type CHAR255 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
exporting
!ES_TABLE_SETTINGS type ZEXCEL_S_TABLE_SETTINGS
raising
ZCX_EXCEL .
methods CALCULATE_COLUMN_WIDTHS
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 .
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 .
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
raising
ZCX_EXCEL .
methods GET_COLUMN
importing
!IP_COLUMN type SIMPLE
returning
value(EO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
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 .
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_DRAWINGS
importing
!IP_TYPE type ZEXCEL_DRAWING_TYPE optional
returning
value(R_DRAWINGS) type ref to ZCL_EXCEL_DRAWINGS .
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 UUID .
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_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
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_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
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 XFELD optional
!IP_NO_HEADER type XFELD optional
raising
ZCX_EXCEL .
methods SET_TITLE
importing
!IP_TITLE type ZEXCEL_SHEET_TITLE
raising
ZCX_EXCEL .
*"* protected components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
protected section.
private section.
types:
BEGIN OF mty_s_font_metric,
char TYPE c LENGTH 1,
char_width TYPE tdcwidths,
END OF mty_s_font_metric .
types:
mty_th_font_metrics
TYPE HASHED TABLE OF mty_s_font_metric
WITH UNIQUE KEY char .
types:
BEGIN OF mty_s_font_cache,
font_name TYPE zexcel_style_font_name,
font_height TYPE tdfontsize,
flag_bold TYPE abap_bool,
flag_italic TYPE abap_bool,
th_font_metrics TYPE mty_th_font_metrics,
END OF mty_s_font_cache .
types:
mty_th_font_cache
TYPE HASHED TABLE OF mty_s_font_cache
WITH UNIQUE KEY font_name font_height flag_bold flag_italic .
types:
* types:
* mty_ts_row_dimension TYPE SORTED TABLE OF zexcel_s_worksheet_rowdimensio WITH UNIQUE KEY row .
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 .
*"* 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 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 UUID .
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 .
class-data MTH_FONT_CACHE type MTY_TH_FONT_CACHE .
data MT_MERGED_CELLS type MTY_TS_MERGE .
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 .
methods CALCULATE_CELL_WIDTH
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
returning
value(EP_WIDTH) type FLOAT
raising
ZCX_EXCEL .
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 PRINT_TITLE_SET_RANGE .
methods UPDATE_DIMENSION_RANGE
raising
ZCX_EXCEL .
ENDCLASS.
CLASS ZCL_EXCEL_WORKSHEET IMPLEMENTATION.
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.
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.
method ADD_NEW_DATA_VALIDATION.
CREATE OBJECT eo_data_validation.
data_validations->add( eo_data_validation ).
endmethod.
METHOD add_new_range.
* Create default blank range
CREATE OBJECT eo_range.
ranges->add( eo_range ).
ENDMETHOD.
METHOD add_new_row.
CREATE OBJECT eo_row
EXPORTING
ip_index = ip_row.
rows->add( eo_row ).
ENDMETHOD.
METHOD add_new_style_cond.
CREATE OBJECT eo_style_cond.
styles_cond->add( eo_style_cond ).
ENDMETHOD.
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.
method BIND_ALV_OLE2.
*--------------------------------------------------------------------*
* Method description:
* Method use to export a CL_GUI_ALV_GRID object to xlsx/xls file
* with list header and characteristics of ALV field catalog such as:
* + Total, group's subtotal
* + Quantity fields, amount fields (dependent fields)
* + No_out, no_zero, ...
* Technique use in method:
* SAP Desktop Office Integration (DOI)
*--------------------------------------------------------------------*
* Data for session 0: DOI constructor
* ------------------------------------------
data: lo_control type ref to I_OI_CONTAINER_CONTROL.
data: lo_proxy type ref to I_OI_DOCUMENT_PROXY.
data: lo_spreadsheet type ref to I_OI_SPREADSHEET.
data: lo_error type ref to I_OI_ERROR.
data: lc_retcode type SOI_RET_STRING.
data: li_has type i. "Proxy has spreadsheet interface?
data: l_is_closed type i.
* Data for session 1: Get LVC data from ALV object
* ------------------------------------------
data: l_has_activex,
l_doctype_excel_sheet(11) type c.
* LVC
data: lt_fieldcat_lvc type LVC_T_FCAT.
data: wa_fieldcat_lvc type lvc_s_fcat.
data: lt_sort_lvc type LVC_T_SORT.
data: lt_filter_idx_lvc type LVC_T_FIDX.
data: lt_GROUPLEVELS_LVC type LVC_T_GRPL.
* KKBLO
DATA: LT_FIELDCAT_KKBLO Type KKBLO_T_FIELDCAT.
DATA: LT_SORT_KKBLO Type KKBLO_T_SORTINFO.
DATA: LT_GROUPLEVELS_KKBLO Type KKBLO_T_GROUPLEVELS.
DATA: LT_FILTER_IDX_KKBLO Type KKBLO_T_SFINFO.
data: wa_listheader like line of it_listheader.
* Subtotal
data: lt_collect00 type ref to data.
data: lt_collect01 type ref to data.
data: lt_collect02 type ref to data.
data: lt_collect03 type ref to data.
data: lt_collect04 type ref to data.
data: lt_collect05 type ref to data.
data: lt_collect06 type ref to data.
data: lt_collect07 type ref to data.
data: lt_collect08 type ref to data.
data: lt_collect09 type ref to data.
* data table name
data: l_tabname type kkblo_tabname.
* local object
data: lo_grid type ref to lcl_gui_alv_grid.
* data table get from ALV
data: lt_alv type ref to data.
* total / subtotal data
field-symbols: <f_collect00> type standard table.
field-symbols: <f_collect01> type standard table.
field-symbols: <f_collect02> type standard table.
field-symbols: <f_collect03> type standard table.
field-symbols: <f_collect04> type standard table.
field-symbols: <f_collect05> type standard table.
field-symbols: <f_collect06> type standard table.
field-symbols: <f_collect07> type standard table.
field-symbols: <f_collect08> type standard table.
field-symbols: <f_collect09> type standard table.
* table before append subtotal lines
field-symbols: <f_alv_tab> type standard table.
* data for session 2: sort, filter and calculate total/subtotal
* ------------------------------------------
* table to save index of subotal / total line in excel tanle
* this ideal to control index of subtotal / total line later
* for ex, when get subtotal / total line to format
types: begin of st_subtot_indexs,
index type i,
end of st_subtot_indexs.
data: lt_subtot_indexs type table of st_subtot_indexs.
data: wa_subtot_indexs like line of lt_subtot_indexs.
* data table after append subtotal
data: lt_excel type ref to data.
data: l_tabix type i.
data: l_save_index type i.
* dyn subtotal table name
data: l_collect type string.
* subtotal range, to format subtotal (and total)
data: subranges type soi_range_list.
data: subrangeitem type soi_range_item.
data: l_sub_index type i.
* table after append subtotal lines
field-symbols: <f_excel_tab> type standard table.
field-symbols: <f_excel_line> type any.
* dyn subtotal tables
field-symbols: <f_collect_tab> type standard table.
field-symbols: <f_collect_line> type any.
field-symbols: <f_filter_idx_line> like line of LT_FILTER_IDX_KKBLO.
field-symbols: <f_fieldcat_line> like line of LT_FIELDCAT_KKBLO.
field-symbols: <f_grouplevels_line> like line of LT_GROUPLEVELS_KKBLO.
field-symbols: <f_line> type any.
* Data for session 3: map data to semantic table
* ------------------------------------------
types: begin of st_column_index,
fieldname type kkblo_fieldname,
tabname type kkblo_tabname,
col like sy-index,
end of st_column_index.
* columns index
data: lt_column_index type table of st_column_index.
data: wa_column_index like line of lt_column_index.
* table of dependent field ( currency and quantity unit field)
data: lt_fieldcat_depf type kkblo_t_fieldcat.
data: wa_fieldcat_depf type kkblo_fieldcat.
* XXL interface:
* -XXL: contain exporting columns characteristic
data: lt_sema type table of gxxlt_s initial size 0.
data: wa_sema like line of lt_sema.
* -XXL interface: header
data: lt_hkey type table of gxxlt_h initial size 0.
data: wa_hkey like line of lt_hkey.
* -XXL interface: header keys
data: lt_vkey type table of gxxlt_v initial size 0.
data: wa_vkey like line of lt_vkey.
* Number of H Keys: number of key columns
data: l_n_hrz_keys type i.
* Number of data columns in the list object: non-key columns no
data: l_n_att_cols type i.
* Number of V Keys: number of header row
data: l_n_vrt_keys type i.
* curency to format amount
data: lt_tcurx type table of tcurx.
data: wa_tcurx like line of lt_tcurx.
data: l_def type flag. " currency / quantity flag
data: wa_t006 type t006. " decimal place of unit
data: l_num type i. " table columns number
data: l_typ type c. " table type
data: wa type ref to data.
data: l_int type i.
data: l_counter type i.
field-symbols: <f_excel_column> type any.
field-symbols: <f_fcat_column> type any.
* Data for session 4: write to excel
* ------------------------------------------
data: sema_type type c.
data l_error type ref to c_oi_proxy_error.
data count type i.
data datac type i.
data datareal type i. " exporting column number
data vkeycount type i.
data all type i.
data mit type i value 1. " index of recent row?
data li_col_pos type i value 1. " column position
data li_col_num type i. " table columns number
field-symbols: <line> type any.
field-symbols: <item> type any.
data td type sydes_desc.
data: typ.
data: ranges type soi_range_list.
data: rangeitem type soi_range_item.
data: contents type soi_generic_table.
data: contentsitem type soi_generic_item.
data: semaitem type gxxlt_s.
data: hkeyitem type gxxlt_h.
data: vkeyitem type gxxlt_v.
data: li_commentary_rows type i. "row number of title lines + 1
data: lo_error_w type ref to i_oi_error.
data: l_retcode type soi_ret_string.
data: no_flush type c value 'X'.
data: li_head_top type i. "header rows position
* Data for session 5: Save and clode document
* ------------------------------------------
data: li_document_size type i.
data: ls_path type RLGRAP-FILENAME.
* MACRO: Close_document
*-------------------------------------------
DEFINE close_document.
clear: l_is_closed.
IF lo_proxy is not initial.
* check proxy detroyed adi
call method lo_proxy->is_destroyed
IMPORTING
ret_value = l_is_closed.
* if dun detroyed yet: close -> release proxy
IF l_is_closed is initial.
call method lo_proxy->close_document
* EXPORTING
* do_save = do_save
IMPORTING
error = lo_error
retcode = lc_retcode.
ENDIF.
call method lo_proxy->release_document
IMPORTING
error = lo_error
retcode = lC_retcode.
else.
lc_retcode = c_oi_errors=>ret_document_not_open.
ENDIF.
* Detroy control container
IF lo_control is not initial.
CALL METHOD lo_control->destroy_control.
ENDIF.
clear:
lo_spreadsheet,
lo_proxy,
lo_control.
* free local
clear: l_is_closed.
END-OF-DEFINITION.
* Macro to catch DOI error
*-------------------------------------------
DEFINE error_doi.
if lc_retcode ne c_oi_errors=>ret_ok.
close_document.
call method lo_error->raise_message
EXPORTING
type = 'E'.
clear: lo_error.
endif.
END-OF-DEFINITION.
*--------------------------------------------------------------------*
* SESSION 0: DOI CONSTRUCTOR
*--------------------------------------------------------------------*
* check active windown
call function 'GUI_HAS_ACTIVEX'
IMPORTING
return = l_has_activex.
if l_has_activex is initial.
raise MISS_GUIDE.
endif.
* Get Container Object of Screen
call method c_oi_container_control_creator=>get_container_control
IMPORTING
control = lo_control
retcode = lC_retcode.
error_doi.
* Initialize Container control
CALL METHOD lo_control->init_control
EXPORTING
parent = CL_GUI_CONTAINER=>DEFAULT_SCREEN
r3_application_name = ''
inplace_enabled = 'X'
no_flush = 'X'
register_on_close_event = 'X'
register_on_custom_event = 'X'
IMPORTING
error = lO_ERROR
retcode = lc_retcode.
error_doi.
* Get Proxy Document:
* check exist of document proxy, if exist -> close first
if not lo_proxy is initial.
close_document.
endif.
IF i_xls is not initial.
* xls format, doctype = soi_doctype_excel97_sheet
l_doctype_excel_sheet = 'Excel.Sheet.8'.
else.
* xlsx format, doctype = soi_doctype_excel_sheet
l_doctype_excel_sheet = 'Excel.Sheet'.
ENDIF.
CALL METHOD lo_control->get_document_proxy
EXPORTING
document_type = l_doctype_excel_sheet
register_container = 'X'
IMPORTING
document_proxy = lo_proxy
error = lO_ERROR
retcode = lc_retcode.
error_doi.
IF I_DOCUMENT_URL is initial.
* create new excel document
call method lo_proxy->create_document
EXPORTING
create_view_data = 'X'
open_inplace = 'X'
no_flush = 'X'
IMPORTING
ERROR = lO_ERROR
retcode = lc_retcode.
error_doi.
else.
* Read excel template for i_DOCUMENT_URL
* this excel template can be store in local or server
CALL METHOD lo_proxy->open_document
EXPORTING
document_url = i_document_url
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
endif.
* Check Spreadsheet Interface of Document Proxy
CALL METHOD lo_proxy->has_spreadsheet_interface
IMPORTING
is_available = li_has
error = lO_ERROR
retcode = lc_retcode.
error_doi.
* create Spreadsheet object
CHECK li_has IS NOT INITIAL.
CALL METHOD lo_proxy->get_spreadsheet_interface
IMPORTING
sheet_interface = lo_spreadsheet
error = lO_ERROR
retcode = lc_retcode.
error_doi.
*--------------------------------------------------------------------*
* SESSION 1: GET LVC DATA FROM ALV OBJECT
*--------------------------------------------------------------------*
* data table
create object lo_grid
EXPORTING
i_parent = CL_GUI_CONTAINER=>SCREEN0.
call method lo_grid->get_alv_attributes
EXPORTING
io_grid = io_alv
IMPORTING
Et_table = lt_alv.
assign lt_alv->* to <f_alv_tab>.
* fieldcat
CALL METHOD iO_alv->GET_FRONTEND_FIELDCATALOG
IMPORTING
ET_FIELDCATALOG = lt_fieldcat_LVC.
* table name
loop at lt_fieldcat_LVC into wa_fieldcat_lvc
where not tabname is initial.
l_tabname = wa_fieldcat_lvc-tabname.
exit.
endloop.
if sy-subrc ne 0.
l_tabname = '1'.
endif.
clear: wa_fieldcat_lvc.
* sort table
CALL METHOD IO_ALV->GET_SORT_CRITERIA
IMPORTING
ET_SORT = lt_sort_lvc.
* filter index
CALL METHOD IO_ALV->GET_FILTERED_ENTRIES
IMPORTING
ET_FILTERED_ENTRIES = lt_filter_idx_lvc.
* group level + subtotal
CALL METHOD IO_ALV->GET_SUBTOTALS
IMPORTING
EP_COLLECT00 = lt_collect00
EP_COLLECT01 = lt_collect01
EP_COLLECT02 = lt_collect02
EP_COLLECT03 = lt_collect03
EP_COLLECT04 = lt_collect04
EP_COLLECT05 = lt_collect05
EP_COLLECT06 = lt_collect06
EP_COLLECT07 = lt_collect07
EP_COLLECT08 = lt_collect08
EP_COLLECT09 = lt_collect09
ET_GROUPLEVELS = lt_GROUPLEVELS_LVC.
assign lt_collect00->* to <f_collect00>.
assign lt_collect01->* to <f_collect01>.
assign lt_collect02->* to <f_collect02>.
assign lt_collect03->* to <f_collect03>.
assign lt_collect04->* to <f_collect04>.
assign lt_collect05->* to <f_collect05>.
assign lt_collect06->* to <f_collect06>.
assign lt_collect07->* to <f_collect07>.
assign lt_collect08->* to <f_collect08>.
assign lt_collect09->* to <f_collect09>.
* transfer to KKBLO struct
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
IT_FIELDCAT_LVC = lt_fieldcat_lvc
IT_SORT_LVC = lt_sort_lvc
IT_FILTER_INDEX_LVC = lt_filter_idx_lvc
IT_GROUPLEVELS_LVC = lt_grouplevels_lvc
IMPORTING
ET_FIELDCAT_KKBLO = lt_fieldcat_kkblo
ET_SORT_KKBLO = lt_sort_kkblo
ET_FILTERED_ENTRIES_KKBLO = lt_filter_idx_kkblo
ET_GROUPLEVELS_KKBLO = lt_grouplevels_kkblo
TABLES
IT_DATA = <f_alv_tab>
EXCEPTIONS
IT_DATA_MISSING = 1
IT_FIELDCAT_LVC_MISSING = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
raise ex_transfer_KKBLO_ERROR.
ENDIF.
clear:
wa_fieldcat_lvc,
lt_fieldcat_lvc,
lt_sort_lvc,
lt_filter_idx_lvc,
lt_GROUPLEVELS_LVC.
clear:
lo_grid.
*--------------------------------------------------------------------*
* SESSION 2: SORT, FILTER AND CALCULATE TOTAL / SUBTOTAL
*--------------------------------------------------------------------*
* append subtotal & total line
create data lt_excel like <f_ALV_TAB>.
assign lt_excel->* to <f_excel_tab>.
loop at <f_alv_tab> assigning <f_line>.
l_save_index = sy-tabix.
* filter base on filter index table
read table LT_FILTER_IDX_KKBLO assigning <f_filter_idx_line>
with key index = l_save_index
binary search.
if sy-subrc ne 0.
append <f_line> to <f_excel_tab>.
endif.
* append subtotal lines
read table LT_GROUPLEVELS_KKBLO assigning <f_grouplevels_line>
with key index_to = l_save_index
binary search.
if sy-subrc = 0.
l_tabix = sy-tabix.
do.
if <f_grouplevels_line>-subtot eq 'X' and
<f_grouplevels_line>-hide_level is initial and
<f_grouplevels_line>-cindex_from ne 0.
* dynamic append subtotal line to excel table base on grouplevel table
* ex <f_GROUPLEVELS_line>-level = 1
* then <f_collect_tab> = '<F_COLLECT01>'
l_collect = <f_grouplevels_line>-level.
condense l_collect.
concatenate '<F_COLLECT0'
l_collect '>'
* '->*'
into l_collect.
assign (l_collect) to <f_collect_tab>.
* incase there're more than 1 total line of group, at the same level
* for example: subtotal of multi currency
LOOP AT <f_collect_tab> assigning <f_collect_line>.
IF sy-tabix between <f_grouplevels_line>-cindex_from
and <f_grouplevels_line>-cindex_to.
append <f_collect_line> to <f_excel_tab>.
* save subtotal lines index
wa_subtot_indexs-index = sy-tabix.
append wa_subtot_indexs to lt_subtot_indexs.
* append sub total ranges table for format later
add 1 to l_sub_index.
subrangeitem-name = l_sub_index.
condense subrangeitem-name.
concatenate 'SUBTOT'
subrangeitem-name
into subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
append subrangeitem to subranges.
clear: subrangeitem.
ENDIF.
ENDLOOP.
unassign: <f_collect_tab>.
unassign: <f_collect_line>.
clear: l_collect.
endif.
* check next subtotal level of group
unassign: <f_grouplevels_line>.
add 1 to l_tabix.
read table LT_GROUPLEVELS_KKBLO assigning <f_grouplevels_line>
index l_tabix.
if sy-subrc ne 0
or <f_grouplevels_line>-index_to ne l_save_index.
exit.
endif.
unassign:
<f_collect_tab>,
<f_collect_line>.
enddo.
endif.
clear:
l_tabix,
l_save_index.
unassign:
<f_filter_idx_line>,
<f_grouplevels_line>.
endloop.
* free local data
unassign:
<f_line>,
<f_collect_tab>,
<f_collect_line>,
<f_fieldcat_line>.
* append grand total line
IF <f_collect00> is assigned.
assign <f_collect00> to <f_collect_tab>.
if <f_collect_tab> is not initial.
LOOP AT <f_collect_tab> assigning <f_collect_line>.
append <f_collect_line> to <f_excel_tab>.
* save total line index
wa_subtot_indexs-index = sy-tabix.
append wa_subtot_indexs to lt_subtot_indexs.
* append grand total range (to format)
add 1 to l_sub_index.
subrangeitem-name = l_sub_index.
condense subrangeitem-name.
concatenate 'TOTAL'
subrangeitem-name
into subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
append subrangeitem to subranges.
ENDLOOP.
endif.
ENDIF.
clear:
subrangeitem,
LT_SORT_KKBLO,
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>.
unassign:
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>,
<f_collect_tab>,
<f_collect_line>.
*--------------------------------------------------------------------*
* SESSION 3: MAP DATA TO SEMANTIC TABLE
*--------------------------------------------------------------------*
* get dependent field field: currency and quantity
create data wa like line of <f_excel_tab>.
assign wa->* to <f_excel_line>.
describe field <f_excel_line> type l_typ components l_num.
do l_num times.
l_save_index = sy-index.
assign component l_save_index of structure <f_excel_line>
to <f_excel_column>.
if sy-subrc ne 0.
message e059(0k) with 'FATAL ERROR' raising fatal_error.
endif.
loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
where tabname = l_tabname.
assign component <f_fieldcat_line>-fieldname
of structure <f_excel_line> to <f_fcat_column>.
describe distance between <f_excel_column> and <f_fcat_column>
into l_int in byte mode.
* append column index
* this columns index is of table, not fieldcat
if l_int = 0.
wa_column_index-fieldname = <f_fieldcat_line>-fieldname.
wa_column_index-tabname = <f_fieldcat_line>-tabname.
wa_column_index-col = l_save_index.
append wa_column_index to lt_column_index.
endif.
* append dependent fields (currency and quantity unit)
if <f_fieldcat_line>-cfieldname is not initial.
clear wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-cfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-ctabname.
collect wa_fieldcat_depf into lt_fieldcat_depf.
endif.
if <f_fieldcat_line>-qfieldname is not initial.
clear wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-qfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-qtabname.
collect wa_fieldcat_depf into lt_fieldcat_depf.
endif.
* rewrite field data type
if <f_fieldcat_line>-inttype = 'X'
and <f_fieldcat_line>-datatype(3) = 'INT'.
<f_fieldcat_line>-inttype = 'I'.
endif.
endloop.
clear: l_save_index.
unassign: <f_fieldcat_line>.
enddo.
* build semantic tables
l_n_hrz_keys = 1.
* Get keyfigures
loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
where tabname = l_tabname
and tech ne 'X'
and no_out ne 'X'.
clear wa_sema.
clear wa_hkey.
* Units belong to keyfigures -> display as str
read table lt_fieldcat_depf into wa_fieldcat_depf with key
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
if sy-subrc = 0.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
* Keyfigures
else.
case <f_fieldcat_line>-datatype.
when 'QUAN'.
wa_sema-col_typ = 'N03'.
if <f_fieldcat_line>-no_sum ne 'X'.
wa_sema-col_ops = 'ADD'.
else.
wa_sema-col_ops = 'NOP'. " no dependent field
endif.
when 'DATS'.
wa_sema-col_typ = 'DAT'.
wa_sema-col_ops = 'NOP'.
when 'CHAR' OR 'UNIT' OR 'CUKY'. " Added fieldformats UNIT and CUKY - dd. 26-10-2012 Wouter Heuvelmans
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'. " dependent field
* incase numeric, ex '00120' -> display as '12'
when 'NUMC'.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
when others.
wa_sema-col_typ = 'NUM'.
if <f_fieldcat_line>-no_sum ne 'X'.
wa_sema-col_ops = 'ADD'.
else.
wa_sema-col_ops = 'NOP'.
endif.
endcase.
endif.
l_counter = l_counter + 1.
l_n_att_cols = l_n_att_cols + 1.
wa_sema-col_no = l_counter.
read table lt_column_index into wa_column_index with key
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
if sy-subrc = 0.
wa_sema-col_src = wa_column_index-col.
else.
raise fatal_error.
endif.
* columns index of ref currency field in table
if not <f_fieldcat_line>-cfieldname is initial.
read table lt_column_index into wa_column_index with key
fieldname = <f_fieldcat_line>-cfieldname
tabname = <f_fieldcat_line>-ctabname.
if sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
endif.
* quantities fields
* treat as currency when display on excel
elseif not <f_fieldcat_line>-qfieldname is initial.
read table lt_column_index into wa_column_index with key
fieldname = <f_fieldcat_line>-qfieldname
tabname = <f_fieldcat_line>-qtabname.
if sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
endif.
endif.
* Treat of fixed currency in the fieldcatalog for column
data: l_num_help(2) type n.
if not <f_fieldcat_line>-currency is initial.
select * from tcurx into table lt_tcurx.
sort lt_tcurx.
read table lt_tcurx into wa_tcurx
with key currkey = <f_fieldcat_line>-currency.
if sy-subrc = 0.
l_num_help = wa_tcurx-currdec.
concatenate 'N' l_num_help into wa_sema-col_typ.
wa_sema-col_cur = sy-tabix * ( -1 ).
endif.
endif.
wa_hkey-col_no = l_n_att_cols.
wa_hkey-row_no = l_n_hrz_keys.
wa_hkey-col_name = <f_fieldcat_line>-reptext.
append wa_hkey to lt_hkey.
append wa_sema to lt_sema.
endloop.
* free local data
clear:
lt_column_index,
wa_column_index,
lt_fieldcat_depf,
wa_fieldcat_depf,
lt_tcurx,
wa_tcurx,
l_num,
l_typ,
wa,
l_int,
l_counter.
unassign:
<f_fieldcat_line>,
<f_excel_line>,
<f_excel_column>,
<f_fcat_column>.
*--------------------------------------------------------------------*
* SESSION 4: WRITE TO EXCEL
*--------------------------------------------------------------------*
clear: wa_tcurx.
refresh: lt_tcurx.
* if spreadsheet dun have proxy yet
if li_has is initial.
l_retcode = c_oi_errors=>ret_interface_not_supported.
call method c_oi_errors=>create_error_for_retcode
EXPORTING
retcode = l_retcode
no_flush = no_flush
IMPORTING
error = lo_error_w.
exit.
endif.
create object l_error
EXPORTING
object_name = 'OLE_DOCUMENT_PROXY'
method_name = 'get_ranges_names'.
call method c_oi_errors=>add_error
EXPORTING
error = l_error.
describe table lt_sema lines datareal.
describe table <f_excel_tab> lines datac.
describe table lt_vkey lines vkeycount.
if datac = 0.
raise inv_data_range.
endif.
if vkeycount ne l_n_vrt_keys.
raise dim_mismatch_vkey.
endif.
all = l_n_vrt_keys + l_n_att_cols.
if datareal ne all.
raise dim_mismatch_sema.
endif.
data: decimal type c.
* get decimal separator format ('.', ',', ...) in Office config
call method lo_proxy->get_application_property
EXPORTING
property_name = 'INTERNATIONAL'
subproperty_name = 'DECIMAL_SEPARATOR'
CHANGING
retvalue = decimal.
data: wa_usr type usr01.
select * from usr01 into wa_usr where bname = sy-uname.
endselect.
data: comma_elim(4) type c.
field-symbols <g> type any.
data search_item(4) value ' #'.
concatenate ',' decimal '.' decimal into comma_elim.
data help type i. " table (with subtotal) line number
help = datac.
data: rowmax type i value 1. " header row number
data: columnmax type i value 0. " header columns number
loop at lt_hkey into hkeyitem.
if hkeyitem-col_no > columnmax.
columnmax = hkeyitem-col_no.
endif.
if hkeyitem-row_no > rowmax.
rowmax = hkeyitem-row_no.
endif.
endloop.
data: hkeycolumns type i. " header columns no
hkeycolumns = columnmax.
if hkeycolumns < l_n_att_cols.
hkeycolumns = l_n_att_cols.
endif.
columnmax = 0.
loop at lt_vkey into vkeyitem.
if vkeyitem-col_no > columnmax.
columnmax = vkeyitem-col_no.
endif.
endloop.
data overflow type i value 1.
data testname(10) type c.
data temp2 type i. " 1st item row position in excel
data realmit type i value 1.
data realoverflow type i value 1. " row index in content
call method lo_spreadsheet->screen_update
EXPORTING
updating = ''.
call method lo_spreadsheet->load_lib.
data: str(40) type c. " range names of columns range (w/o col header)
data: rows type i. " row postion of 1st item line in ecxel
* calculate row position of data table
describe table iT_LISTHEADER lines li_commentary_rows.
* if grid had title, add 1 empy line between title and table
if li_commentary_rows ne 0.
add 1 to li_commentary_rows.
endif.
* add top position of block data
li_commentary_rows = li_commentary_rows + i_top - 1.
* write header (commentary rows)
data: li_commentary_row_index type i value 1.
data: li_content_index type i value 1.
data: ls_index(10) type c.
data ls_commentary_range(40) type c value 'TITLE'.
data: li_font_bold type i.
data: li_font_italic type i.
data: li_font_size type i.
loop at iT_LISTHEADER into wa_listheader.
li_commentary_row_index = i_top + li_content_index - 1.
ls_index = li_content_index.
condense ls_index.
concatenate ls_commentary_range(5) ls_index
into ls_commentary_range.
condense ls_commentary_range.
* insert title range
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = ls_commentary_range
top = li_commentary_row_index
left = i_left
rows = 1
columns = 1
no_flush = no_flush.
* format range
case wa_listheader-typ.
when 'H'. "title
li_font_size = 16.
li_font_bold = 1.
li_font_italic = -1.
when 'S'. "subtile
li_font_size = -1.
li_font_bold = 1.
li_font_italic = -1.
when others. "'A' comment
li_font_size = -1.
li_font_bold = -1.
li_font_italic = 1.
endcase.
call method lo_spreadsheet->set_font
EXPORTING
rangename = ls_commentary_range
family = ''
size = li_font_size
bold = li_font_bold
italic = li_font_italic
align = 0
no_flush = no_flush.
* title: range content
rangeitem-name = ls_commentary_range.
rangeitem-columns = 1.
rangeitem-rows = 1.
append rangeitem to ranges.
contentsitem-row = li_content_index.
contentsitem-column = 1.
concatenate wa_listheader-key
wa_listheader-info
into contentsitem-value
separated by space.
condense contentsitem-value.
append contentsitem to contents.
add 1 to li_content_index.
clear:
rangeitem,
contentsitem,
ls_index.
endloop.
* set range data title
call method lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
refresh:
ranges,
contents.
rows = rowmax + li_commentary_rows + 1.
all = wa_usr-datfm.
all = all + 3.
loop at lt_sema into semaitem.
if semaitem-col_typ = 'DAT' or semaitem-col_typ = 'MON' or
semaitem-col_typ = 'N00' or semaitem-col_typ = 'N01' or
semaitem-col_typ = 'N01' or semaitem-col_typ = 'N02' or
semaitem-col_typ = 'N03' or semaitem-col_typ = 'PCT' or
semaitem-col_typ = 'STR' or semaitem-col_typ = 'NUM'.
clear str.
str = semaitem-col_no.
condense str.
concatenate 'DATA' str into str.
mit = semaitem-col_no.
li_col_pos = semaitem-col_no + i_left - 1.
* range from data1 to data(n), for each columns of table
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = str
top = rows
left = li_col_pos
rows = help
columns = 1
no_flush = no_flush.
data dec type i value -1.
data typeinfo type sydes_typeinfo.
loop at <f_excel_tab> assigning <line>.
assign component semaitem-col_no of structure <line> to <item>.
describe field <item> into td.
read table td-types index 1 into typeinfo.
if typeinfo-type = 'P'.
dec = typeinfo-decimals.
elseif typeinfo-type = 'I'.
dec = 0.
endif.
describe field <line> type typ components count.
mit = 1.
do count times.
if mit = semaitem-col_src.
assign component sy-index of structure <line> to <item>.
describe field <item> into td.
read table td-types index 1 into typeinfo.
if typeinfo-type = 'P'.
dec = typeinfo-decimals.
endif.
exit.
endif.
mit = mit + 1.
enddo.
exit.
endloop.
* format for each columns of table (w/o columns headers)
if semaitem-col_typ = 'DAT'.
if semaitem-col_no > vkeycount.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = all
no_flush = no_flush.
else.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
endif.
elseif semaitem-col_typ = 'STR'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
elseif semaitem-col_typ = 'MON'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 10
no_flush = no_flush.
elseif semaitem-col_typ = 'N00'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 0
no_flush = no_flush.
elseif semaitem-col_typ = 'N01'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 1
no_flush = no_flush.
elseif semaitem-col_typ = 'N02'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
elseif semaitem-col_typ = 'N03'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 3
no_flush = no_flush.
elseif semaitem-col_typ = 'N04'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 4
no_flush = no_flush.
elseif semaitem-col_typ = 'NUM'.
if dec eq -1.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
else.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = dec
no_flush = no_flush.
endif.
elseif semaitem-col_typ = 'PCT'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 3
decimals = 0
no_flush = no_flush.
endif.
endif.
endloop.
* get item contents for set_range_data method
* get currency cell also
mit = 1.
data: currcells type soi_cell_table.
data: curritem type soi_cell_item.
curritem-rows = 1.
curritem-columns = 1.
curritem-front = -1.
curritem-back = -1.
curritem-font = ''.
curritem-size = -1.
curritem-bold = -1.
curritem-italic = -1.
curritem-align = -1.
curritem-frametyp = -1.
curritem-framecolor = -1.
curritem-currency = ''.
curritem-number = 1.
curritem-input = -1.
data: const type i.
* Change for Correction request
* Initial 10000 lines are missing in Excel Export
* if there are only 2 columns in exported List object.
if datareal gt 2.
const = 20000 / datareal.
else.
const = 20000 / ( datareal + 2 ).
endif.
data: lines type i.
data: innerlines type i.
data: counter type i.
data: curritem2 like curritem.
data: curritem3 like curritem.
data: length type i.
data: found.
* append content table (for method set_range_content)
loop at <f_excel_tab> assigning <line>.
* save line index to compare with lt_subtot_indexs,
* to discover line is a subtotal / totale line or not
* ex use to set 'dun display zero in subtotal / total line'
l_save_index = sy-tabix.
do datareal times.
read table lt_sema into semaitem with key col_no = sy-index.
if semaitem-col_src ne 0.
assign component semaitem-col_src
of structure <line> to <item>.
else.
assign component sy-index
of structure <line> to <item>.
endif.
contentsitem-row = realoverflow.
if sy-subrc = 0.
move semaitem-col_ops to search_item(3).
search 'ADD#CNT#MIN#MAX#AVG#NOP#DFT#'
for search_item.
if sy-subrc ne 0.
raise error_in_sema.
endif.
move semaitem-col_typ to search_item(3).
search 'NUM#N00#N01#N02#N03#N04#PCT#DAT#MON#STR#'
for search_item.
if sy-subrc ne 0.
raise error_in_sema.
endif.
contentsitem-column = sy-index.
if semaitem-col_typ eq 'DAT' or semaitem-col_typ eq 'MON'.
if semaitem-col_no > vkeycount.
" Hinweis 512418
" EXCEL bezieht Datumsangaben
" auf den 31.12.1899, behandelt
" aber 1900 als ein Schaltjahr
" d.h. ab 1.3.1900 korrekt
" 1.3.1900 als Zahl = 61
data: genesis type d value '18991230'.
data: number_of_days type p.
* change for date in char format & sema_type = X
data: temp_date type d.
if not <item> is initial and not <item> co ' ' and not
<item> co '0'.
* change for date in char format & sema_type = X starts
if sema_type = 'X'.
describe field <item> type typ.
if typ = 'C'.
temp_date = <item>.
number_of_days = temp_date - genesis.
else.
number_of_days = <item> - genesis.
endif.
else.
number_of_days = <item> - genesis.
endif.
* change for date in char format & sema_type = X ends
if number_of_days < 61.
number_of_days = number_of_days - 1.
endif.
set country 'DE'.
write number_of_days to contentsitem-value
no-grouping
left-justified.
set country space.
translate contentsitem-value using comma_elim.
else.
clear contentsitem-value.
endif.
else.
move <item> to contentsitem-value.
endif.
elseif semaitem-col_typ eq 'NUM' or
semaitem-col_typ eq 'N00' or
semaitem-col_typ eq 'N01' or
semaitem-col_typ eq 'N02' or
semaitem-col_typ eq 'N03' or
semaitem-col_typ eq 'N04' or
semaitem-col_typ eq 'PCT'.
set country 'DE'.
describe field <item> type typ.
if semaitem-col_cur is initial.
if typ ne 'F'.
write <item> to contentsitem-value no-grouping
no-sign decimals 14.
else.
write <item> to contentsitem-value no-grouping
no-sign.
endif.
else.
* Treat of fixed curreny for column >>Y9CK007319
if semaitem-col_cur < 0.
semaitem-col_cur = semaitem-col_cur * ( -1 ).
select * from tcurx into table lt_tcurx.
sort lt_tcurx.
read table lt_tcurx into
wa_tcurx index semaitem-col_cur.
if sy-subrc = 0.
if typ ne 'F'.
write <item> to contentsitem-value no-grouping
currency wa_tcurx-currkey no-sign decimals 14.
else.
write <item> to contentsitem-value no-grouping
currency wa_tcurx-currkey no-sign.
endif.
endif.
else.
assign component semaitem-col_cur
of structure <line> to <g>.
* mit = index of recent row
curritem-top = rowmax + mit + li_commentary_rows.
li_col_pos = sy-index + i_left - 1.
curritem-left = li_col_pos.
* if filed is quantity field (qfieldname ne space)
* or amount field (cfieldname ne space), then format decimal place
* corresponding with config
clear: l_def.
read table LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
with key tabname = l_tabname
tech = space
no_out = space
col_pos = semaitem-col_no.
IF sy-subrc = 0.
IF <f_fieldcat_line>-cfieldname is not initial.
l_def = 'C'.
else."if <f_fieldcat_line>-qfieldname is not initial.
l_def = 'Q'.
ENDIF.
ENDIF.
* if field is amount field
* exporting of amount field base on currency decimal table: TCURX
IF l_def = 'C'. "field is amount field
select single * from tcurx into wa_tcurx
where currkey = <g>.
* if amount ref to un-know currency -> default decimal = 2
if sy-subrc eq 0.
curritem-decimals = wa_tcurx-currdec.
else.
curritem-decimals = 2.
endif.
append curritem to currcells.
if typ ne 'F'.
write <item> to contentsitem-value
currency <g>
no-sign no-grouping.
else.
write <item> to contentsitem-value
decimals 14 currency <g>
no-sign no-grouping.
endif.
* if field is quantity field
* exporting of quantity field base on quantity decimal table: T006
else."if l_def = 'Q'. " field is quantity field
clear: wa_t006.
select single * from t006 into wa_t006
where MSEHI = <g>.
* if quantity ref to un-know unit-> default decimal = 2
if sy-subrc eq 0.
curritem-decimals = wa_t006-decan.
else.
curritem-decimals = 2.
endif.
append curritem to currcells.
write <item> to contentsitem-value
unit <g>
no-sign no-grouping.
condense contentsitem-value.
ENDIF.
endif. "Y9CK007319
endif.
condense contentsitem-value.
* add function fieldcat-no zero display
loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
where tabname = l_tabname
and tech ne 'X'
and no_out ne 'X'.
if <f_fieldcat_line>-col_pos = semaitem-col_no.
if <f_fieldcat_line>-no_zero = 'X'.
if <item> = '0'.
clear: contentsitem-value.
endif.
* dun display zero in total/subtotal line too
else.
clear: wa_subtot_indexs.
read table lt_subtot_indexs into wa_subtot_indexs
with key index = l_save_index.
IF sy-subrc = 0.
if <item> = '0'.
clear: contentsitem-value.
endif.
ENDIF.
endif.
endif.
endloop.
unassign: <f_fieldcat_line>.
if <item> lt 0.
search contentsitem-value for 'E'.
if sy-fdpos eq 0.
* use prefix notation for signed numbers
translate contentsitem-value using '- '.
condense contentsitem-value no-gaps.
concatenate '-' contentsitem-value
into contentsitem-value.
else.
concatenate '-' contentsitem-value
into contentsitem-value.
endif.
endif.
set country space.
* Hier wird nur die korrekte Kommaseparatierung gemacht, wenn die
* Zeichen einer
* Zahl enthalten sind. Das ist für Timestamps, die auch ":" enthalten.
* Für die
* darf keine Kommaseparierung stattfinden.
* Changing for correction request - Y6BK041073
if contentsitem-value co '0123456789.,-+E '.
translate contentsitem-value using comma_elim.
endif.
else.
clear contentsitem-value.
* if type is not numeric -> dun display with zero
write <item> to contentsitem-value no-zero.
shift contentsitem-value left deleting leading space.
endif.
append contentsitem to contents.
endif.
enddo.
realmit = realmit + 1.
realoverflow = realoverflow + 1.
mit = mit + 1.
* overflow = current row index in content table
overflow = overflow + 1.
endloop.
unassign: <f_fieldcat_line>.
* set item range for set_range_data method
testname = mit / const.
condense testname.
concatenate 'TEST' testname into testname.
realoverflow = realoverflow - 1.
realmit = realmit - 1.
help = realoverflow.
rangeitem-name = testname.
rangeitem-columns = datareal.
rangeitem-rows = help.
append rangeitem to ranges.
* insert item range dim
temp2 = rowmax + 1 + li_commentary_rows + realmit - realoverflow.
* items data
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = testname
top = temp2
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* get columns header contents for set_range_data method
* export columns header only if no columns header option = space
data: rowcount type i.
data: columncount type i.
if i_columns_header = 'X'.
* append columns header to contents: hkey
rowcount = 1.
do rowmax times.
columncount = 1.
do hkeycolumns times.
loop at lt_hkey into hkeyitem where col_no = columncount
and row_no = rowcount.
endloop.
if sy-subrc = 0.
str = hkeyitem-col_name.
contentsitem-value = hkeyitem-col_name.
else.
contentsitem-value = str.
endif.
contentsitem-column = columncount.
contentsitem-row = rowcount.
append contentsitem to contents.
columncount = columncount + 1.
enddo.
rowcount = rowcount + 1.
enddo.
* incase columns header in multiline
data: rowmaxtemp type i.
if rowmax > 1.
rowmaxtemp = rowmax - 1.
rowcount = 1.
do rowmaxtemp times.
columncount = 1.
do columnmax times.
contentsitem-column = columncount.
contentsitem-row = rowcount.
contentsitem-value = ''.
append contentsitem to contents.
columncount = columncount + 1.
enddo.
rowcount = rowcount + 1.
enddo.
endif.
* append columns header to contents: vkey
columncount = 1.
do columnmax times.
loop at lt_vkey into vkeyitem where col_no = columncount.
endloop.
contentsitem-value = vkeyitem-col_name.
contentsitem-row = rowmax.
contentsitem-column = columncount.
append contentsitem to contents.
columncount = columncount + 1.
enddo.
*--------------------------------------------------------------------*
* set header range for method set_range_data
* insert header keys range dim
li_head_top = li_commentary_rows + 1.
li_col_pos = i_left.
* insert range headers
if hkeycolumns ne 0.
rangeitem-name = 'TESTHKEY'.
rangeitem-rows = rowmax.
rangeitem-columns = hkeycolumns.
append rangeitem to ranges.
clear: rangeitem.
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = 'TESTHKEY'
top = li_head_top
left = li_col_pos
rows = rowmax
columns = hkeycolumns
no_flush = no_flush.
endif.
endif.
* format for columns header + total + subtotal
* ------------------------------------------
help = rowmax + realmit. " table + header lines
data: lt_format type soi_format_table.
data: wa_format like line of lt_format.
data: wa_format_temp like line of lt_format.
field-symbols: <f_source> type any.
field-symbols: <f_des> type any.
* columns header format
wa_format-front = -1.
wa_format-back = 15. "grey
wa_format-font = space.
wa_format-size = -1.
wa_format-bold = 1.
wa_format-align = 0.
wa_format-frametyp = -1.
wa_format-framecolor = -1.
* get column header format from input record
* -> map input format
if i_columns_header = 'X'.
wa_format-name = 'TESTHKEY'.
if i_format_col_header is not initial.
describe field i_format_col_header type l_typ components
li_col_num.
do li_col_num times.
if sy-index ne 1. " dun map range name
assign component sy-index of structure i_format_col_header
to <f_source>.
if <f_source> is not initial.
assign component sy-index of structure wa_format to <f_des>.
<f_des> = <f_source>.
unassign: <f_des>.
endif.
unassign: <f_source>.
endif.
enddo.
clear: li_col_num.
endif.
append wa_format to lt_format.
endif.
* Zusammenfassen der Spalten mit gleicher Nachkommastellenzahl
* collect vertical cells (col) with the same number of decimal places
* to increase perfomance in currency cell format
describe table currcells lines lines.
lines = lines - 1.
do lines times.
describe table currcells lines innerlines.
innerlines = innerlines - 1.
sort currcells by left top.
clear found.
do innerlines times.
read table currcells index sy-index into curritem.
counter = sy-index + 1.
read table currcells index counter into curritem2.
if curritem-left eq curritem2-left.
length = curritem-top + curritem-rows.
if length eq curritem2-top.
if curritem-decimals eq curritem2-decimals.
move curritem to curritem3.
curritem3-rows = curritem3-rows + curritem2-rows.
curritem-left = -1.
modify currcells index sy-index from curritem.
curritem2-left = -1.
modify currcells index counter from curritem2.
append curritem3 to currcells.
found = 'X'.
endif.
endif.
endif.
enddo.
if found is initial.
exit.
endif.
delete currcells where left = -1.
enddo.
* Zusammenfassen der Zeilen mit gleicher Nachkommastellenzahl
* collect horizontal cells (row) with the same number of decimal places
* to increase perfomance in currency cell format
describe table currcells lines lines.
lines = lines - 1.
do lines times.
describe table currcells lines innerlines.
innerlines = innerlines - 1.
sort currcells by top left.
clear found.
do innerlines times.
read table currcells index sy-index into curritem.
counter = sy-index + 1.
read table currcells index counter into curritem2.
if curritem-top eq curritem2-top and curritem-rows eq
curritem2-rows.
length = curritem-left + curritem-columns.
if length eq curritem2-left.
if curritem-decimals eq curritem2-decimals.
move curritem to curritem3.
curritem3-columns = curritem3-columns + curritem2-columns.
curritem-left = -1.
modify currcells index sy-index from curritem.
curritem2-left = -1.
modify currcells index counter from curritem2.
append curritem3 to currcells.
found = 'X'.
endif.
endif.
endif.
enddo.
if found is initial.
exit.
endif.
delete currcells where left = -1.
enddo.
* Ende der Zusammenfassung
* item data: format for currency cell, corresponding with currency
call method lo_spreadsheet->cell_format
EXPORTING
cells = currcells
no_flush = no_flush.
* item data: write item table content
call method lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
* whole table range to format all table
if i_columns_header = 'X'.
li_head_top = li_commentary_rows + 1.
else.
li_head_top = li_commentary_rows + 2.
help = help - 1.
endif.
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = 'WHOLE_TABLE'
top = li_head_top
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* columns width auto fix
* this parameter = space in case use with exist template
IF i_columns_autofit = 'X'.
call method lo_spreadsheet->fit_widest
EXPORTING
name = 'WHOLE_TABLE'
no_flush = no_flush.
ENDIF.
* frame
* The parameter has 8 bits
*0 Left margin
*1 Top marginT
*2 Bottom margin
*3 Right margin
*4 Horizontal line
*5 Vertical line
*6 Thinness
*7 Thickness
* here 127 = 1111111 6-5-4-3-2-1 mean Thin-ver-hor-right-bot-top-left
* ( final DOI method call, set no_flush = space
* equal to call method CL_GUI_CFW=>FLUSH )
call method lo_spreadsheet->set_frame
EXPORTING
rangename = 'WHOLE_TABLE'
typ = 127
color = 1
no_flush = space
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
* reformat subtotal / total line after format wholw table
loop at subranges into subrangeitem.
l_sub_index = subrangeitem-rows + li_commentary_rows + rowmax.
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = subrangeitem-name
left = i_left
top = l_sub_index
rows = 1
columns = datareal
no_flush = no_flush.
wa_format-name = subrangeitem-name.
* default format:
* - clolor: subtotal = light yellow, subtotal = yellow
* - frame: box
IF subrangeitem-name(3) = 'SUB'.
wa_format-back = 36. "subtotal line
wa_format_temp = i_format_subtotal.
else.
wa_format-back = 27. "total line
wa_format_temp = i_format_total.
endif.
wa_format-FRAMETYP = 79.
wa_format-FRAMEcolor = 1.
wa_format-number = -1.
wa_format-align = -1.
* get subtoal + total format from intput parameter
* overwrite default format
if wa_format_temp is not initial.
describe field wa_format_temp type l_typ components li_col_num.
do li_col_num times.
if sy-index ne 1. " dun map range name
assign component sy-index of structure wa_format_temp
to <f_source>.
if <f_source> is not initial.
assign component sy-index of structure wa_format to <f_des>.
<f_des> = <f_source>.
unassign: <f_des>.
endif.
unassign: <f_source>.
endif.
enddo.
clear: li_col_num.
endif.
append wa_format to lt_format.
clear: wa_format-name.
clear: l_sub_index.
clear: wa_format_temp.
endloop.
if lt_format[] is not initial.
call method lo_spreadsheet->set_ranges_format
EXPORTING
formattable = lt_format
no_flush = no_flush.
refresh: lt_format.
endif.
*--------------------------------------------------------------------*
call method lo_spreadsheet->screen_update
EXPORTING
updating = 'X'.
call method c_oi_errors=>flush_errors.
lo_error_w = l_error.
lc_retcode = lo_error_w->error_code.
** catch no_flush -> led to dump ( optional )
* go_error = l_error.
* gc_retcode = go_error->error_code.
* error_doi.
clear:
lt_sema,
wa_sema,
lt_hkey,
wa_hkey,
lt_vkey,
wa_vkey,
l_n_hrz_keys,
l_n_att_cols,
l_n_vrt_keys,
count,
datac,
datareal,
vkeycount,
all,
mit,
li_col_pos,
li_col_num,
ranges,
rangeitem,
contents,
contentsitem,
semaitem,
hkeyitem,
vkeyitem,
li_commentary_rows,
l_retcode,
li_head_top,
<f_excel_tab>.
clear:
lo_error_w.
unassign:
<line>,
<item>,
<f_excel_tab>.
*--------------------------------------------------------------------*
* SESSION 5: SAVE AND CLOSE FILE
*--------------------------------------------------------------------*
* ex of save path: 'FILE://C:\temp\test.xlsx'
concatenate 'FILE://' I_save_path
into ls_path.
call method lo_proxy->save_document_to_url
EXPORTING
no_flush = 'X'
url = ls_path
IMPORTING
error = lo_error
retcode = lc_retcode
CHANGING
document_size = li_document_size.
error_doi.
* if save successfully -> raise successful message
* message i499(sy) with 'Document is Exported to ' p_path.
message i499(sy) with 'Data has been exported successfully'.
clear:
ls_path,
li_document_size.
close_document.
endmethod.
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 char3,
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.
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->if_object_collection~get_iterator( ).
WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true.
lo_curtable ?= lo_iterator->if_object_collection_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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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.
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.
ELSE.
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 ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval> ).
ENDIF.
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. "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.
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
*--------------------------------------------------------------------*
CONSTANTS:
lc_default_font_name TYPE zexcel_style_font_name VALUE 'Calibri', "#EC NOTEXT
lc_default_font_height TYPE tdfontsize VALUE '110',
lc_excel_cell_padding TYPE float VALUE '0.75'.
DATA: ld_cell_value TYPE zexcel_cell_value,
ld_current_character TYPE c LENGTH 1,
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 lc_default_font_height,
lt_itcfc TYPE STANDARD TABLE OF itcfc,
ld_offset TYPE i,
ld_length TYPE i,
ld_uccp TYPE i,
ls_font_metric TYPE mty_s_font_metric,
ld_width_from_font_metrics TYPE i,
ld_font_family TYPE itcfh-tdfamily,
ld_font_name TYPE zexcel_style_font_name VALUE lc_default_font_name,
lt_font_families LIKE STANDARD TABLE OF ld_font_family,
ls_font_cache TYPE mty_s_font_cache.
FIELD-SYMBOLS: <ls_font_cache> TYPE mty_s_font_cache,
<ls_font_metric> TYPE mty_s_font_metric,
<ls_itcfc> TYPE itcfc.
" 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.
" Check if the same font (font name and font attributes) was already
" used before
READ TABLE mth_font_cache
WITH TABLE KEY
font_name = ld_font_name
font_height = ld_font_height
flag_bold = ld_flag_bold
flag_italic = ld_flag_italic
ASSIGNING <ls_font_cache>.
IF sy-subrc <> 0.
" Font is used for the first time
" Add the font to our local font cache
ls_font_cache-font_name = ld_font_name.
ls_font_cache-font_height = ld_font_height.
ls_font_cache-flag_bold = ld_flag_bold.
ls_font_cache-flag_italic = ld_flag_italic.
INSERT ls_font_cache INTO TABLE mth_font_cache
ASSIGNING <ls_font_cache>.
" Determine the SAPscript font family name from the Excel
" font name
SELECT tdfamily
FROM tfo01
INTO TABLE lt_font_families
UP TO 1 ROWS
WHERE tdtext = ld_font_name
ORDER BY PRIMARY KEY.
" Check if a matching font family was found
" Fonts can be uploaded from TTF files using transaction SE73
IF lines( lt_font_families ) > 0.
READ TABLE lt_font_families INDEX 1 INTO ld_font_family.
" Load font metrics (returns a table with the size of each letter
" in the font)
CALL FUNCTION 'LOAD_FONT'
EXPORTING
family = ld_font_family
height = ld_font_height
printer = 'SWIN'
bold = ld_flag_bold
italic = ld_flag_italic
TABLES
metric = lt_itcfc
EXCEPTIONS
font_family = 1
codepage = 2
device_type = 3
OTHERS = 4.
IF sy-subrc <> 0.
CLEAR lt_itcfc.
ENDIF.
" For faster access, convert each character number to the actual
" character, and store the characters and their sizes in a hash
" table
LOOP AT lt_itcfc ASSIGNING <ls_itcfc>.
ld_uccp = <ls_itcfc>-cpcharno.
ls_font_metric-char =
cl_abap_conv_in_ce=>uccpi( ld_uccp ).
ls_font_metric-char_width = <ls_itcfc>-tdcwidths.
INSERT ls_font_metric
INTO TABLE <ls_font_cache>-th_font_metrics.
ENDLOOP.
ENDIF.
ENDIF.
" Calculate the cell width
" If available, use font metrics
IF lines( <ls_font_cache>-th_font_metrics ) = 0.
" Font metrics are not available
" -> Calculate the cell width using only the font size
ld_length = strlen( ld_cell_value ).
ep_width = ld_length * ld_font_height / lc_default_font_height + lc_excel_cell_padding.
ELSE.
" Font metrics are available
" Calculate the size of the text by adding the sizes of each
" letter
ld_length = strlen( ld_cell_value ).
DO ld_length TIMES.
" Subtract 1, because the first character is at offset 0
ld_offset = sy-index - 1.
" Read the current character from the cell value
ld_current_character = ld_cell_value+ld_offset(1).
" Look up the size of the current letter
READ TABLE <ls_font_cache>-th_font_metrics
WITH TABLE KEY char = ld_current_character
ASSIGNING <ls_font_metric>.
IF sy-subrc = 0.
" The size of the letter is known
" -> Add the actual size of the letter
ADD <ls_font_metric>-char_width TO ld_width_from_font_metrics.
ELSE.
" The size of the letter is unknown
" -> Add the font height as the default letter size
ADD ld_font_height TO ld_width_from_font_metrics.
ENDIF.
ENDDO.
" Add cell padding (Excel makes columns a bit wider than the space
" that is needed for the text itself) and convert unit
" (division by 100)
ep_width = ld_width_from_font_metrics / 100 + lc_excel_cell_padding.
ENDIF.
" 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: cell_value TYPE zexcel_cell_value.
DATA: cell_style TYPE REF TO zcl_excel_style.
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.
METHOD change_cell_style.
" issue # 139
DATA: stylemapping TYPE zexcel_s_stylemapping,
complete_style TYPE zexcel_s_cstyle_complete,
complete_stylex TYPE zexcel_s_cstylex_complete,
borderx TYPE zexcel_s_cstylex_border,
l_guid TYPE zexcel_cell_style. "issue # 177
* We have a lot of parameters. Use some macros to make the coding more structured
DEFINE clear_initial_colorxfields.
if &1-rgb is initial.
clear &2-rgb.
endif.
if &1-indexed is initial.
clear &2-indexed.
endif.
if &1-theme is initial.
clear &2-theme.
endif.
if &1-tint is initial.
clear &2-tint.
endif.
END-OF-DEFINITION.
DEFINE move_supplied_borders.
if ip_&1 is supplied. " only act if parameter was supplied
if ip_x&1 is supplied. "
borderx = ip_x&1. " use supplied x-parameter
else.
clear borderx with 'X'.
* clear in a way that would be expected to work easily
if ip_&1-border_style is initial.
clear borderx-border_style.
endif.
clear_initial_colorxfields ip_&1-border_color borderx-border_color.
endif.
move-corresponding ip_&1 to complete_style-&2.
move-corresponding borderx to complete_stylex-&2.
endif.
END-OF-DEFINITION.
* First get current stylsettings
TRY.
me->get_cell( EXPORTING ip_column = ip_column " Cell Column
ip_row = ip_row " Cell Row
IMPORTING ep_guid = l_guid )." Cell Value ). "issue # 177
stylemapping = me->excel->get_style_to_guid( l_guid ). "issue # 177
complete_style = stylemapping-complete_style.
complete_stylex = stylemapping-complete_stylex.
CATCH zcx_excel.
* Error --> use submitted style
ENDTRY.
* move_supplied_multistyles: complete.
IF ip_complete IS SUPPLIED.
IF ip_xcomplete IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Complete styleinfo has to be supplied with corresponding X-field'.
ENDIF.
MOVE-CORRESPONDING ip_complete TO complete_style.
MOVE-CORRESPONDING ip_xcomplete TO complete_stylex.
ENDIF.
IF ip_font IS SUPPLIED.
DATA: fontx LIKE ip_xfont.
IF ip_xfont IS SUPPLIED.
fontx = ip_xfont.
ELSE.
* Only supplied values should be used - exception: Flags bold and italic strikethrough underline
MOVE 'X' TO: fontx-bold,
fontx-italic,
fontx-strikethrough,
fontx-underline_mode.
CLEAR fontx-color WITH 'X'.
clear_initial_colorxfields ip_font-color fontx-color.
IF ip_font-family IS NOT INITIAL.
fontx-family = 'X'.
ENDIF.
IF ip_font-name IS NOT INITIAL.
fontx-name = 'X'.
ENDIF.
IF ip_font-scheme IS NOT INITIAL.
fontx-scheme = 'X'.
ENDIF.
IF ip_font-size IS NOT INITIAL.
fontx-size = 'X'.
ENDIF.
IF ip_font-underline_mode IS NOT INITIAL.
fontx-underline_mode = 'X'.
ENDIF.
ENDIF.
MOVE-CORRESPONDING ip_font TO complete_style-font.
MOVE-CORRESPONDING fontx TO complete_stylex-font.
* Correction for undeline mode
ENDIF.
IF ip_fill IS SUPPLIED.
DATA: fillx LIKE ip_xfill.
IF ip_xfill IS SUPPLIED.
fillx = ip_xfill.
ELSE.
CLEAR fillx WITH 'X'.
IF ip_fill-filltype IS INITIAL.
CLEAR fillx-filltype.
ENDIF.
clear_initial_colorxfields ip_fill-fgcolor fillx-fgcolor.
clear_initial_colorxfields ip_fill-bgcolor fillx-bgcolor.
ENDIF.
MOVE-CORRESPONDING ip_fill TO complete_style-fill.
MOVE-CORRESPONDING fillx TO complete_stylex-fill.
ENDIF.
IF ip_borders IS SUPPLIED.
DATA: bordersx LIKE ip_xborders.
IF ip_xborders IS SUPPLIED.
bordersx = ip_xborders.
ELSE.
CLEAR bordersx WITH 'X'.
IF ip_borders-allborders-border_style IS INITIAL.
CLEAR bordersx-allborders-border_style.
ENDIF.
IF ip_borders-diagonal-border_style IS INITIAL.
CLEAR bordersx-diagonal-border_style.
ENDIF.
IF ip_borders-down-border_style IS INITIAL.
CLEAR bordersx-down-border_style.
ENDIF.
IF ip_borders-left-border_style IS INITIAL.
CLEAR bordersx-left-border_style.
ENDIF.
IF ip_borders-right-border_style IS INITIAL.
CLEAR bordersx-right-border_style.
ENDIF.
IF ip_borders-top-border_style IS INITIAL.
CLEAR bordersx-top-border_style.
ENDIF.
clear_initial_colorxfields ip_borders-allborders-border_color bordersx-allborders-border_color.
clear_initial_colorxfields ip_borders-diagonal-border_color bordersx-diagonal-border_color.
clear_initial_colorxfields ip_borders-down-border_color bordersx-down-border_color.
clear_initial_colorxfields ip_borders-left-border_color bordersx-left-border_color.
clear_initial_colorxfields ip_borders-right-border_color bordersx-right-border_color.
clear_initial_colorxfields ip_borders-top-border_color bordersx-top-border_color.
ENDIF.
MOVE-CORRESPONDING ip_borders TO complete_style-borders.
MOVE-CORRESPONDING bordersx TO complete_stylex-borders.
ENDIF.
IF ip_alignment IS SUPPLIED.
DATA: alignmentx LIKE ip_xalignment.
IF ip_xalignment IS SUPPLIED.
alignmentx = ip_xalignment.
ELSE.
CLEAR alignmentx WITH 'X'.
IF ip_alignment-horizontal IS INITIAL.
CLEAR alignmentx-horizontal.
ENDIF.
IF ip_alignment-vertical IS INITIAL.
CLEAR alignmentx-vertical.
ENDIF.
ENDIF.
MOVE-CORRESPONDING ip_alignment TO complete_style-alignment.
MOVE-CORRESPONDING alignmentx TO complete_stylex-alignment.
ENDIF.
IF ip_protection IS SUPPLIED.
MOVE-CORRESPONDING ip_protection TO complete_style-protection.
IF ip_xprotection IS SUPPLIED.
MOVE-CORRESPONDING ip_xprotection TO complete_stylex-protection.
ELSE.
IF ip_protection-hidden IS NOT INITIAL.
complete_stylex-protection-hidden = 'X'.
ENDIF.
IF ip_protection-locked IS NOT INITIAL.
complete_stylex-protection-locked = 'X'.
ENDIF.
ENDIF.
ENDIF.
move_supplied_borders : borders_allborders borders-allborders,
borders_diagonal borders-diagonal ,
borders_down borders-down ,
borders_left borders-left ,
borders_right borders-right ,
borders_top borders-top .
DEFINE move_supplied_singlestyles.
if ip_&1 is supplied.
complete_style-&2 = ip_&1.
complete_stylex-&2 = 'X'.
endif.
END-OF-DEFINITION.
move_supplied_singlestyles: number_format_format_code number_format-format_code,
font_bold font-bold,
font_color font-color,
font_color_rgb font-color-rgb,
font_color_indexed font-color-indexed,
font_color_theme font-color-theme,
font_color_tint font-color-tint,
font_family font-family,
font_italic font-italic,
font_name font-name,
font_scheme font-scheme,
font_size font-size,
font_strikethrough font-strikethrough,
font_underline font-underline,
font_underline_mode font-underline_mode,
fill_filltype fill-filltype,
fill_rotation fill-rotation,
fill_fgcolor fill-fgcolor,
fill_fgcolor_rgb fill-fgcolor-rgb,
fill_fgcolor_indexed fill-fgcolor-indexed,
fill_fgcolor_theme fill-fgcolor-theme,
fill_fgcolor_tint fill-fgcolor-tint,
fill_bgcolor fill-bgcolor,
fill_bgcolor_rgb fill-bgcolor-rgb,
fill_bgcolor_indexed fill-bgcolor-indexed,
fill_bgcolor_theme fill-bgcolor-theme,
fill_bgcolor_tint fill-bgcolor-tint,
fill_gradtype_type fill-gradtype-TYPE,
fill_gradtype_degree fill-gradtype-DEGREE,
fill_gradtype_bottom fill-gradtype-BOTTOM,
fill_gradtype_left fill-gradtype-LEFT,
fill_gradtype_top fill-gradtype-TOP,
fill_gradtype_right fill-gradtype-RIGHT,
fill_gradtype_position1 fill-gradtype-POSITION1,
fill_gradtype_position2 fill-gradtype-POSITION2,
fill_gradtype_position3 fill-gradtype-POSITION3,
borders_diagonal_mode borders-diagonal_mode,
alignment_horizontal alignment-horizontal,
alignment_vertical alignment-vertical,
alignment_textrotation alignment-textrotation,
alignment_wraptext alignment-wraptext,
alignment_shrinktofit alignment-shrinktofit,
alignment_indent alignment-indent,
protection_hidden protection-hidden,
protection_locked protection-locked,
borders_allborders_style borders-allborders-border_style,
borders_allborders_color borders-allborders-border_color,
borders_allbo_color_rgb borders-allborders-border_color-rgb,
borders_allbo_color_indexed borders-allborders-border_color-indexed,
borders_allbo_color_theme borders-allborders-border_color-theme,
borders_allbo_color_tint borders-allborders-border_color-tint,
borders_diagonal_style borders-diagonal-border_style,
borders_diagonal_color borders-diagonal-border_color,
borders_diagonal_color_rgb borders-diagonal-border_color-rgb,
borders_diagonal_color_inde borders-diagonal-border_color-indexed,
borders_diagonal_color_them borders-diagonal-border_color-theme,
borders_diagonal_color_tint borders-diagonal-border_color-tint,
borders_down_style borders-down-border_style,
borders_down_color borders-down-border_color,
borders_down_color_rgb borders-down-border_color-rgb,
borders_down_color_indexed borders-down-border_color-indexed,
borders_down_color_theme borders-down-border_color-theme,
borders_down_color_tint borders-down-border_color-tint,
borders_left_style borders-left-border_style,
borders_left_color borders-left-border_color,
borders_left_color_rgb borders-left-border_color-rgb,
borders_left_color_indexed borders-left-border_color-indexed,
borders_left_color_theme borders-left-border_color-theme,
borders_left_color_tint borders-left-border_color-tint,
borders_right_style borders-right-border_style,
borders_right_color borders-right-border_color,
borders_right_color_rgb borders-right-border_color-rgb,
borders_right_color_indexed borders-right-border_color-indexed,
borders_right_color_theme borders-right-border_color-theme,
borders_right_color_tint borders-right-border_color-tint,
borders_top_style borders-top-border_style,
borders_top_color borders-top-border_color,
borders_top_color_rgb borders-top-border_color-rgb,
borders_top_color_indexed borders-top-border_color-indexed,
borders_top_color_theme borders-top-border_color-theme,
borders_top_color_tint borders-top-border_color-tint.
* Now we have a completly filled styles.
* This can be used to get the guid
* Return guid if requested. Might be used if copy&paste of styles is requested
ep_guid = me->excel->get_static_cellstyle_guid( ip_cstyle_complete = complete_style
ip_cstylex_complete = complete_stylex ).
me->set_cell_style( ip_column = ip_column
ip_row = ip_row
ip_style = ep_guid ).
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.
* 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.
METHOD delete_merge.
FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells.
DATA: is_merged TYPE abap_bool.
*--------------------------------------------------------------------*
* 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.
LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>.
is_merged = me->is_cell_merged( ip_column = ip_cell_column
ip_row = ip_cell_row ).
IF is_merged = abap_true.
DELETE me->mt_merged_cells. " Delete this merge, that includes this cell
EXIT.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
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
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Row outline to be deleted does not exist'.
ENDIF.
ENDMETHOD.
method FREEZE_PANES.
IF ip_num_columns IS NOT SUPPLIED AND ip_num_rows IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Pleas provide number of rows and/or columns to freeze'.
ENDIF.
IF ip_num_columns IS SUPPLIED AND ip_num_columns <= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Number of columns to freeze should be positive'.
ENDIF.
IF ip_num_rows IS SUPPLIED AND ip_num_rows <= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = '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.
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.
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.
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.
" 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 REQUESTED.
style_iterator = me->excel->get_styles_iterator( ).
WHILE style_iterator->has_next( ) = 'X'.
style ?= style_iterator->get_next( ).
IF style->get_guid( ) = ls_sheet_content-cell_style.
ep_style = style.
EXIT.
ENDIF.
ENDWHILE.
ENDIF.
ENDMETHOD.
METHOD get_column.
DATA: lo_column_iterator TYPE REF TO cl_object_collection_iterator,
lo_column TYPE REF TO zcl_excel_column,
lv_column TYPE zexcel_cell_column.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
lo_column_iterator = me->get_columns_iterator( ).
WHILE lo_column_iterator->has_next( ) = abap_true.
lo_column ?= lo_column_iterator->get_next( ).
IF lo_column->get_column_index( ) = lv_column.
eo_column = lo_column.
EXIT.
ENDIF.
ENDWHILE.
IF eo_column IS NOT BOUND.
eo_column = me->add_new_column( ip_column ).
ENDIF.
ENDMETHOD.
METHOD get_columns.
eo_columns = me->columns.
ENDMETHOD.
METHOD GET_COLUMNS_ITERATOR.
eo_iterator = me->columns->get_iterator( ).
ENDMETHOD.
method GET_DATA_VALIDATIONS_ITERATOR.
eo_iterator = me->data_validations->get_iterator( ).
endmethod.
method GET_DATA_VALIDATIONS_SIZE.
ep_size = me->data_validations->size( ).
endmethod.
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.
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.
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.
METHOD get_default_row.
IF me->row_default IS NOT BOUND.
CREATE OBJECT me->row_default.
ENDIF.
eo_row = me->row_default.
ENDMETHOD.
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.
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.
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.
method GET_FREEZE_CELL.
ep_row = me->freeze_pane_cell_row.
ep_column = me->freeze_pane_cell_column.
endmethod.
METHOD get_guid.
ep_guid = me->guid.
ENDMETHOD.
method GET_HIGHEST_COLUMN.
me->update_dimension_range( ).
r_highest_column = me->lower_cell-cell_column.
endmethod.
METHOD get_highest_row.
me->update_dimension_range( ).
r_highest_row = me->lower_cell-cell_row.
ENDMETHOD.
method GET_HYPERLINKS_ITERATOR.
eo_iterator = hyperlinks->get_iterator( ).
endmethod.
method GET_HYPERLINKS_SIZE.
ep_size = hyperlinks->size( ).
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.
method GET_PAGEBREAKS.
ro_pagebreaks = mo_pagebreaks.
endmethod.
method GET_RANGES_ITERATOR.
eo_iterator = me->ranges->get_iterator( ).
endmethod.
METHOD get_row.
DATA: lo_row_iterator TYPE REF TO cl_object_collection_iterator,
lo_row TYPE REF TO zcl_excel_row.
lo_row_iterator = me->get_rows_iterator( ).
WHILE lo_row_iterator->has_next( ) = abap_true.
lo_row ?= lo_row_iterator->get_next( ).
IF lo_row->get_row_index( ) = ip_row.
eo_row = lo_row.
EXIT.
ENDIF.
ENDWHILE.
IF eo_row IS NOT BOUND.
eo_row = me->add_new_row( ip_row ).
ENDIF.
ENDMETHOD.
METHOD GET_ROWS.
eo_rows = me->rows.
ENDMETHOD.
METHOD get_rows_iterator.
eo_iterator = me->rows->get_iterator( ).
ENDMETHOD.
METHOD get_row_outlines.
rt_row_outlines = me->mt_row_outlines.
ENDMETHOD.
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.
METHOD get_style_cond_iterator.
eo_iterator = styles_cond->get_iterator( ).
ENDMETHOD.
method GET_TABCOLOR.
ev_tabcolor = me->tabcolor.
endmethod.
method GET_TABLES_ITERATOR.
eo_iterator = tables->if_object_collection~get_iterator( ).
endmethod.
method GET_TABLES_SIZE.
ep_size = tables->if_object_collection~size( ).
endmethod.
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.
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.
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.
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.
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,
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.
IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = '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 ).
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.
CASE lv_value_type.
WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2.
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.
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.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = '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.
* 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>-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-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.
* 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.
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 INITIAL. " no need to create new entry in sheet_content when no 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.
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.
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.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Please supply a positive number as column-width'.
ENDIF.
lo_column->set_width( width ).
EXIT.
CATCH cx_sy_conversion_no_number.
* Strange stuff passed --> raise error
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = '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.
method SET_DEFAULT_EXCEL_DATE_FORMAT.
IF ip_default_excel_date_format IS INITIAL.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Default date format cannot be blank'.
ENDIF.
default_excel_date_format = ip_default_excel_date_format.
endmethod.
METHOD set_merge.
DATA: ls_merge TYPE mty_merge,
lv_errormessage TYPE string.
*--------------------------------------------------------------------*
* 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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDLOOP.
*--------------------------------------------------------------------*
* Everything seems ok --> add to merge table
*--------------------------------------------------------------------*
INSERT ls_merge INTO TABLE me->mt_merged_cells.
ENDMETHOD.
method SET_PRINT_GRIDLINES.
me->print_gridlines = i_print_gridlines.
endmethod.
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.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Please supply a positive number as row-height'.
ENDIF.
lo_row->set_row_height( height ).
EXIT.
CATCH cx_sy_conversion_no_number.
* Strange stuff passed --> raise error
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Unable to interpret supplied input as number'.
ENDTRY.
ENDMETHOD.
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.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'First row of outline must be a positive number'.
ENDIF.
IF iv_row_to < iv_row_from.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = '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.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Unknown collapse state'.
ENDCASE.
ENDMETHOD.
method SET_SHOW_GRIDLINES.
me->show_gridlines = i_show_gridlines.
endmethod.
method SET_SHOW_ROWCOLHEADERS.
me->show_rowcolheaders = i_show_rowcolheaders.
endmethod.
method SET_TABCOLOR.
me->tabcolor = iv_tabcolor.
endmethod.
method SET_TABLE.
DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr,
lr_data TYPE REF TO data,
ls_header TYPE x030l,
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 ).
ls_header = lo_tabdescr->get_ddic_header( ).
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>.
MOVE <fs_fldval> TO lv_cell_value.
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.
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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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 `'`.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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.
METHOD update_dimension_range.
DATA: ls_sheet_content TYPE zexcel_s_cell_data,
lt_sheet_content TYPE zexcel_t_cell_data_unsorted,
lv_row_alpha TYPE string,
lv_column_alpha TYPE zexcel_cell_column_alpha.
CHECK sheet_content IS NOT INITIAL.
* update dimension range
lt_sheet_content = sheet_content.
"upper left corner
SORT lt_sheet_content BY cell_row.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
upper_cell-cell_row = ls_sheet_content-cell_row.
SORT lt_sheet_content BY cell_column.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
upper_cell-cell_column = ls_sheet_content-cell_column.
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.
"bottom right corner
SORT lt_sheet_content BY cell_row DESCENDING.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
lower_cell-cell_row = ls_sheet_content-cell_row.
SORT lt_sheet_content BY cell_column DESCENDING.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
lower_cell-cell_column = ls_sheet_content-cell_column.
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.
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.
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.
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.
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.
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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
IF lv_col_from_int > lv_col_to_int.
lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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.
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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
IF iv_rows_from > iv_rows_to.
lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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.
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.
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.
method ZIF_EXCEL_SHEET_PROPERTIES~SET_STYLE.
zif_excel_sheet_properties~style = ip_style.
endmethod.
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.
method ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME.
me->zif_excel_sheet_vba_project~codename = ip_codename.
endmethod.
method ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME_PR.
me->zif_excel_sheet_vba_project~codename_pr = ip_codename_pr.
endmethod.
ENDCLASS.
| 33.417461 | 255 | 0.622128 |
0343f5ac020b781e37b26d8ca83d55dc2b99ec56 | 5,161 | abap | ABAP | src/zcl_adcoset_search_scope.clas.abap | stockbal/abap-code-search-tools | cf195de4d00c5e73810c80eee879fa9e009dee7a | [
"MIT"
] | 8 | 2022-01-10T17:40:04.000Z | 2022-03-15T09:09:56.000Z | src/zcl_adcoset_search_scope.clas.abap | stockbal/abap-code-search-tools | cf195de4d00c5e73810c80eee879fa9e009dee7a | [
"MIT"
] | null | null | null | src/zcl_adcoset_search_scope.clas.abap | stockbal/abap-code-search-tools | cf195de4d00c5e73810c80eee879fa9e009dee7a | [
"MIT"
] | null | null | null | "! <p class="shorttext synchronized" lang="en">Search scope implementation</p>
CLASS zcl_adcoset_search_scope DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES:
zif_adcoset_search_scope.
METHODS:
constructor
IMPORTING
search_scope TYPE zif_adcoset_ty_global=>ty_search_scope
parallel_mode TYPE abap_bool OPTIONAL.
PROTECTED SECTION.
PRIVATE SECTION.
DATA:
search_scope TYPE zif_adcoset_ty_global=>ty_search_scope,
object_count TYPE i,
current_offset TYPE i,
package_size TYPE i,
is_more_objects_available TYPE abap_bool,
parallel_mode TYPE abap_bool.
METHODS:
determine_count,
set_package_size,
resolve_packages.
ENDCLASS.
CLASS zcl_adcoset_search_scope IMPLEMENTATION.
METHOD constructor.
me->search_scope = search_scope.
me->parallel_mode = parallel_mode.
resolve_packages( ).
determine_count( ).
set_package_size( ).
ENDMETHOD.
METHOD zif_adcoset_search_scope~count.
result = object_count.
ENDMETHOD.
METHOD zif_adcoset_search_scope~has_next_package.
result = xsdbool( current_offset < object_count ).
ENDMETHOD.
METHOD zif_adcoset_search_scope~next_package.
SELECT object_type AS type,
object_name AS name,
owner,
devclass AS package_name
FROM zadcoset_repoobj
WHERE object_type IN @search_scope-object_type_range
AND object_name IN @search_scope-object_name_range
AND ps_posid IN @search_scope-appl_comp_range
AND devclass IN @search_scope-package_range
AND owner IN @search_scope-owner_range
AND created_date IN @search_scope-created_on_range
ORDER BY object_name
INTO CORRESPONDING FIELDS OF TABLE @result
UP TO @package_size ROWS
OFFSET @current_offset.
current_offset = current_offset + package_size.
ENDMETHOD.
METHOD zif_adcoset_search_scope~more_objects_in_scope.
result = is_more_objects_available.
ENDMETHOD.
METHOD determine_count.
DATA(selection_limit) = COND i(
WHEN search_scope-max_objects > 0 THEN search_scope-max_objects + 1
ELSE 0 ).
SELECT COUNT(*)
FROM zadcoset_repoobj
WHERE object_type IN @search_scope-object_type_range
AND object_name IN @search_scope-object_name_range
AND ps_posid IN @search_scope-appl_comp_range
AND devclass IN @search_scope-package_range
AND owner IN @search_scope-owner_range
AND created_date IN @search_scope-created_on_range
INTO @object_count
UP TO @selection_limit ROWS.
IF object_count = selection_limit.
object_count = search_scope-max_objects.
is_more_objects_available = abap_true.
ENDIF.
ENDMETHOD.
METHOD set_package_size.
" ??? >
" Should the package size be set depending on the available task.
" ??? <
IF parallel_mode = abap_true.
IF object_count >= 50 AND object_count < 200.
package_size = 25.
ELSEIF object_count >= 200 AND object_count < 800.
package_size = 50.
ELSEIF object_count >= 800 AND object_count < 2000.
package_size = 100.
ELSE.
package_size = 150.
ENDIF.
ELSE.
" fixed size during sequential mode regardless of full scope
package_size = 100.
ENDIF.
ENDMETHOD.
METHOD resolve_packages.
DATA: include_package_range TYPE zif_adcoset_ty_global=>ty_package_name_range,
exclude_package_range TYPE zif_adcoset_ty_global=>ty_package_name_range.
FIELD-SYMBOLS: <package_range> TYPE LINE OF zif_adcoset_ty_global=>ty_package_name_range.
CHECK search_scope-package_range IS NOT INITIAL.
" only determine sub packages from ranges with option EQ
LOOP AT search_scope-package_range ASSIGNING <package_range> WHERE option = 'EQ'.
IF <package_range>-sign = 'I'.
include_package_range = VALUE #( BASE include_package_range ( <package_range> ) ).
ELSEIF <package_range>-sign = 'E'.
exclude_package_range = VALUE #( BASE exclude_package_range ( sign = 'I' option = 'EQ' low = <package_range>-low ) ).
ENDIF.
DELETE search_scope-package_range.
ENDLOOP.
" collect sub packages of packages that should be excluded
exclude_package_range = VALUE #( BASE exclude_package_range
( LINES OF zcl_adcoset_devc_reader=>get_subpackages_by_range( exclude_package_range ) ) ).
" convert sign back to 'E' for the excluded packages
LOOP AT exclude_package_range ASSIGNING <package_range>.
<package_range>-sign = 'E'.
ENDLOOP.
search_scope-package_range = VALUE #( BASE search_scope-package_range
( LINES OF include_package_range )
( LINES OF zcl_adcoset_devc_reader=>get_subpackages_by_range( include_package_range ) )
( LINES OF exclude_package_range ) ).
SORT search_scope-package_range BY sign option low high.
DELETE ADJACENT DUPLICATES FROM search_scope-package_range COMPARING sign option low high.
ENDMETHOD.
ENDCLASS.
| 31.278788 | 125 | 0.702771 |
034409bd5231d42b6dbae02a9ba91cd3a7f7082b | 1,663 | abap | ABAP | src/zcl_z_abapgit_test_mpc.clas.abap | abapGit-tests/IWPR | ccf79d09efdb060cec378f286009aca5d7a79254 | [
"MIT"
] | null | null | null | src/zcl_z_abapgit_test_mpc.clas.abap | abapGit-tests/IWPR | ccf79d09efdb060cec378f286009aca5d7a79254 | [
"MIT"
] | null | null | null | src/zcl_z_abapgit_test_mpc.clas.abap | abapGit-tests/IWPR | ccf79d09efdb060cec378f286009aca5d7a79254 | [
"MIT"
] | 1 | 2019-08-28T20:28:50.000Z | 2019-08-28T20:28:50.000Z | class ZCL_Z_ABAPGIT_TEST_MPC definition
public
inheriting from /IWBEP/CL_MGW_PUSH_ABS_MODEL
create public .
public section.
methods DEFINE
redefinition .
methods GET_LAST_MODIFIED
redefinition .
protected section.
private section.
ENDCLASS.
CLASS ZCL_Z_ABAPGIT_TEST_MPC IMPLEMENTATION.
method DEFINE.
*&---------------------------------------------------------------------*
*& Generated code for the MODEL PROVIDER BASE CLASS &*
*& &*
*& !!!NEVER MODIFY THIS CLASS. IN CASE YOU WANT TO CHANGE THE MODEL &*
*& DO THIS IN THE MODEL PROVIDER SUBCLASS!!! &*
*& &*
*&---------------------------------------------------------------------*
endmethod.
method GET_LAST_MODIFIED.
*&---------------------------------------------------------------------*
*& Generated code for the MODEL PROVIDER BASE CLASS &*
*& &*
*& !!!NEVER MODIFY THIS CLASS. IN CASE YOU WANT TO CHANGE THE MODEL &*
*& DO THIS IN THE MODEL PROVIDER SUBCLASS!!! &*
*& &*
*&---------------------------------------------------------------------*
CONSTANTS: lc_gen_date_time TYPE timestamp VALUE '20190227081330'. "#EC NOTEXT
rv_last_modified = super->get_last_modified( ).
IF rv_last_modified LT lc_gen_date_time.
rv_last_modified = lc_gen_date_time.
ENDIF.
endmethod.
ENDCLASS.
| 33.938776 | 97 | 0.438364 |