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
034655751e2afa1ebbb605c18807151bf4759793
2,587
abap
ABAP
src/zcl_excel_hyperlink.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
39
2021-12-11T18:27:15.000Z
2022-03-31T14:03:53.000Z
src/zcl_excel_hyperlink.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
115
2021-12-11T08:29:00.000Z
2022-03-30T17:39:42.000Z
src/zcl_excel_hyperlink.clas.abap
boy0korea/abap2xlsx
bea794926b201b1c9199efc4e24ac062113e4f6f
[ "Apache-2.0" ]
17
2021-12-12T13:48:59.000Z
2022-03-24T12:28:26.000Z
CLASS zcl_excel_hyperlink DEFINITION PUBLIC FINAL CREATE PRIVATE . *"* public components of class ZCL_EXCEL_HYPERLINK *"* do not include other source files here!!! PUBLIC SECTION. CLASS-METHODS create_external_link IMPORTING !iv_url TYPE string RETURNING VALUE(ov_link) TYPE REF TO zcl_excel_hyperlink . CLASS-METHODS create_internal_link IMPORTING !iv_location TYPE string RETURNING VALUE(ov_link) TYPE REF TO zcl_excel_hyperlink . METHODS is_internal RETURNING VALUE(ev_ret) TYPE abap_bool . METHODS set_cell_reference IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row RAISING zcx_excel . METHODS get_ref RETURNING VALUE(ev_ref) TYPE string . METHODS get_url RETURNING VALUE(ev_url) TYPE string . *"* protected components of class ZCL_EXCEL_HYPERLINK *"* do not include other source files here!!! PROTECTED SECTION. *"* private components of class ZCL_EXCEL_HYPERLINK *"* do not include other source files here!!! PRIVATE SECTION. DATA location TYPE string . DATA cell_reference TYPE string . DATA internal TYPE abap_bool . DATA column TYPE zexcel_cell_column_alpha . DATA row TYPE zexcel_cell_row . CLASS-METHODS create IMPORTING !iv_url TYPE string !iv_internal TYPE abap_bool RETURNING VALUE(ov_link) TYPE REF TO zcl_excel_hyperlink . ENDCLASS. CLASS zcl_excel_hyperlink IMPLEMENTATION. METHOD create. DATA: lo_hyperlink TYPE REF TO zcl_excel_hyperlink. CREATE OBJECT lo_hyperlink. lo_hyperlink->location = iv_url. lo_hyperlink->internal = iv_internal. ov_link = lo_hyperlink. ENDMETHOD. METHOD create_external_link. ov_link = zcl_excel_hyperlink=>create( iv_url = iv_url iv_internal = abap_false ). ENDMETHOD. METHOD create_internal_link. ov_link = zcl_excel_hyperlink=>create( iv_url = iv_location iv_internal = abap_true ). ENDMETHOD. METHOD get_ref. ev_ref = row. CONDENSE ev_ref. CONCATENATE column ev_ref INTO ev_ref. ENDMETHOD. METHOD get_url. ev_url = me->location. ENDMETHOD. METHOD is_internal. ev_ret = me->internal. ENDMETHOD. METHOD set_cell_reference. me->column = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column me->row = ip_row. ENDMETHOD. ENDCLASS.
23.953704
122
0.676846
0348258dfb27e42c9abee54a1031d8bb49dcd67d
9,588
abap
ABAP
src/unmanaged/#dmo#cl_travel_auxiliary09.clas.abap
SAP-Cloud-Platform/flight09
ddf2acaa35f581b40dd2580a6fd225b4de87a40f
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#cl_travel_auxiliary09.clas.abap
SAP-Cloud-Platform/flight09
ddf2acaa35f581b40dd2580a6fd225b4de87a40f
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#cl_travel_auxiliary09.clas.abap
SAP-Cloud-Platform/flight09
ddf2acaa35f581b40dd2580a6fd225b4de87a40f
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/cl_travel_auxiliary09 DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. * Type definition for import parameters -------------------------- TYPES tt_travel_create TYPE TABLE FOR CREATE /dmo/i_travel_u09. TYPES tt_travel_update TYPE TABLE FOR UPDATE /dmo/i_travel_u09. TYPES tt_travel_delete TYPE TABLE FOR DELETE /dmo/i_travel_u09. TYPES tt_travel_failed TYPE TABLE FOR FAILED /dmo/i_travel_u09. TYPES tt_travel_mapped TYPE TABLE FOR MAPPED /dmo/i_travel_u09. TYPES tt_travel_reported TYPE TABLE FOR REPORTED /dmo/i_travel_u09. TYPES tt_booking_create TYPE TABLE FOR CREATE /dmo/i_booking_u09. TYPES tt_booking_update TYPE TABLE FOR UPDATE /dmo/i_booking_u09. TYPES tt_booking_delete TYPE TABLE FOR DELETE /dmo/i_booking_u09. TYPES tt_booking_failed TYPE TABLE FOR FAILED /dmo/i_booking_u09. TYPES tt_booking_mapped TYPE TABLE FOR MAPPED /dmo/i_booking_u09. TYPES tt_booking_reported TYPE TABLE FOR REPORTED /dmo/i_booking_u09. TYPES tt_bookingsupplement_failed TYPE TABLE FOR FAILED /dmo/i_bookingsupplement_u09. TYPES tt_bookingsupplement_mapped TYPE TABLE FOR MAPPED /dmo/i_bookingsupplement_u09. TYPES tt_bookingsupplement_reported TYPE TABLE FOR REPORTED /dmo/i_bookingsupplement_u09. CLASS-METHODS map_travel_cds_to_db IMPORTING is_i_travel_u TYPE /dmo/i_travel_u09 RETURNING VALUE(rs_travel) TYPE /dmo/if_flight_legacy09=>ts_travel_in. CLASS-METHODS map_travel_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id09 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy09=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_travel_reported. CLASS-METHODS map_booking_cds_to_db IMPORTING is_i_booking TYPE /dmo/i_booking_u09 RETURNING VALUE(rs_booking) TYPE /dmo/if_flight_legacy09=>ts_booking_in. CLASS-METHODS map_booking_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id09 OPTIONAL iv_booking_id TYPE /dmo/booking_id09 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy09=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_booking_reported. CLASS-METHODS map_bookingsupplemnt_cds_to_db IMPORTING is_i_bookingsupplement TYPE /dmo/i_bookingsupplement_u09 RETURNING VALUE(rs_bookingsupplement) TYPE /dmo/if_flight_legacy09=>ts_booking_supplement_in. CLASS-METHODS map_bookingsupplemnt_message IMPORTING iv_cid TYPE string OPTIONAL iv_travel_id TYPE /dmo/travel_id09 OPTIONAL iv_booking_id TYPE /dmo/booking_id09 OPTIONAL iv_bookingsupplement_id TYPE /dmo/booking_supplement_id09 OPTIONAL is_message TYPE LINE OF /dmo/if_flight_legacy09=>tt_message RETURNING VALUE(rs_report) TYPE LINE OF tt_bookingsupplement_reported. PROTECTED SECTION. PRIVATE SECTION. CLASS-METHODS new_message IMPORTING id TYPE symsgid number TYPE symsgno severity TYPE if_abap_behv_message=>t_severity v1 TYPE simple OPTIONAL v2 TYPE simple OPTIONAL v3 TYPE simple OPTIONAL v4 TYPE simple OPTIONAL RETURNING VALUE(obj) TYPE REF TO if_abap_behv_message . ENDCLASS. CLASS /dmo/cl_travel_auxiliary09 IMPLEMENTATION. METHOD map_travel_cds_to_db. rs_travel = CORRESPONDING #( is_i_travel_u MAPPING travel_id = travelid agency_id = agencyid customer_id = customerid begin_date = begindate end_date = enddate booking_fee = bookingfee total_price = totalprice currency_code = currencycode description = memo status = status ). ENDMETHOD. METHOD map_travel_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-%msg = lo. ENDMETHOD. METHOD map_booking_cds_to_db. rs_booking = CORRESPONDING #( is_i_booking MAPPING booking_id = bookingid booking_date = bookingdate customer_id = customerid carrier_id = airlineid connection_id = connectionid flight_date = flightdate flight_price = flightprice currency_code = currencycode ). ENDMETHOD. METHOD map_booking_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-bookingid = iv_booking_id. rs_report-%msg = lo. ENDMETHOD. METHOD map_bookingsupplemnt_cds_to_db. rs_bookingsupplement = CORRESPONDING #( is_i_bookingsupplement MAPPING booking_id = bookingid booking_supplement_id = bookingsupplementid supplement_id = supplementid price = price currency_code = currencycode ). ENDMETHOD. METHOD map_bookingsupplemnt_message. DATA(lo) = new_message( id = is_message-msgid number = is_message-msgno severity = if_abap_behv_message=>severity-error v1 = is_message-msgv1 v2 = is_message-msgv2 v3 = is_message-msgv3 v4 = is_message-msgv4 ). rs_report-%cid = iv_cid. rs_report-travelid = iv_travel_id. rs_report-bookingid = iv_booking_id. rs_report-bookingSupplementid = iv_bookingsupplement_id. rs_report-%msg = lo. ENDMETHOD. METHOD new_message. obj = NEW lcl_abap_behv_msg( textid = VALUE #( msgid = id msgno = number attr1 = COND #( WHEN v1 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV1' ) attr2 = COND #( WHEN v2 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV2' ) attr3 = COND #( WHEN v3 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV3' ) attr4 = COND #( WHEN v4 IS NOT INITIAL THEN 'IF_T100_DYN_MSG~MSGV4' ) ) msgty = SWITCH #( severity WHEN if_abap_behv_message=>severity-error THEN 'E' WHEN if_abap_behv_message=>severity-warning THEN 'W' WHEN if_abap_behv_message=>severity-information THEN 'I' WHEN if_abap_behv_message=>severity-success THEN 'S' ) msgv1 = |{ v1 }| msgv2 = |{ v2 }| msgv3 = |{ v3 }| msgv4 = |{ v4 }| ). obj->m_severity = severity. ENDMETHOD. ENDCLASS.
47.231527
121
0.492386
034ace1dd475b6e90640bb66d1f14679dfd93a77
1,798
abap
ABAP
src/zcl_rl_repo_logo_factory.clas.abap
victorizbitskiy/abapGitRepositoryLogo
dfc4acbce2ca1a58bc0b096133d9541de873d721
[ "MIT" ]
null
null
null
src/zcl_rl_repo_logo_factory.clas.abap
victorizbitskiy/abapGitRepositoryLogo
dfc4acbce2ca1a58bc0b096133d9541de873d721
[ "MIT" ]
null
null
null
src/zcl_rl_repo_logo_factory.clas.abap
victorizbitskiy/abapGitRepositoryLogo
dfc4acbce2ca1a58bc0b096133d9541de873d721
[ "MIT" ]
null
null
null
CLASS zcl_rl_repo_logo_factory DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. TYPES: BEGIN OF ty_repo, owner TYPE string, name TYPE string, END OF ty_repo . CONSTANTS: BEGIN OF c_service, github TYPE string VALUE 'github', gitlab TYPE string VALUE 'gitlab', END OF c_service . CLASS-METHODS get_instance IMPORTING !iv_service TYPE string !is_repo TYPE ty_repo !iv_token TYPE string !iv_ssl_id TYPE ssfapplssl DEFAULT 'ANONYM' !iv_proxy_url TYPE string OPTIONAL !iv_proxy_port TYPE string OPTIONAL RETURNING VALUE(ri_repo_logo_git) TYPE REF TO zif_rl_repo_logo_git RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_RL_REPO_LOGO_FACTORY IMPLEMENTATION. METHOD get_instance. CASE iv_service. WHEN c_service-github. CREATE OBJECT ri_repo_logo_git TYPE zcl_rl_repo_logo_github EXPORTING is_repo = is_repo iv_token = iv_token iv_ssl_id = iv_ssl_id iv_proxy_url = iv_proxy_url iv_proxy_port = iv_proxy_port. WHEN c_service-gitlab. CREATE OBJECT ri_repo_logo_git TYPE zcl_rl_repo_logo_gitlab EXPORTING is_repo = is_repo iv_token = iv_token iv_ssl_id = iv_ssl_id iv_proxy_url = iv_proxy_url iv_proxy_port = iv_proxy_port. WHEN OTHERS. zcx_abapgit_exception=>raise( |Getting a logo for the { iv_service } service is not supported| ). ENDCASE. ENDMETHOD. ENDCLASS.
24.972222
105
0.603448
034b5769a142a47a18e92eaca500a8aa629ce4ae
1,589
abap
ABAP
src/zcl_capi_thread_pool_executor.clas.testclasses.abap
larshp/zconcurrency_api
9404d8c6b04d71ada3c8afa963a3f13dab153ac2
[ "MIT" ]
19
2021-01-10T15:47:28.000Z
2022-03-18T08:39:04.000Z
src/zcl_capi_thread_pool_executor.clas.testclasses.abap
larshp/zconcurrency_api
9404d8c6b04d71ada3c8afa963a3f13dab153ac2
[ "MIT" ]
7
2021-01-11T09:17:37.000Z
2021-06-06T15:15:05.000Z
src/zcl_capi_thread_pool_executor.clas.testclasses.abap
larshp/zconcurrency_api
9404d8c6b04d71ada3c8afa963a3f13dab153ac2
[ "MIT" ]
10
2021-01-10T15:47:39.000Z
2022-02-06T17:01:36.000Z
CLASS ltc_capi_thread_pool_executor DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. DATA: mo_cut TYPE REF TO zcl_capi_thread_pool_executor. "class under test CLASS-METHODS: class_setup. CLASS-METHODS: class_teardown. METHODS: setup. METHODS: teardown. METHODS: invoke_all FOR TESTING. ENDCLASS. "ltc_Capi_Thread_Pool_Executor CLASS ltc_capi_thread_pool_executor IMPLEMENTATION. METHOD class_setup. ENDMETHOD. METHOD class_teardown. ENDMETHOD. METHOD setup. DATA lo_capi_message_handler TYPE REF TO zif_capi_message_handler. mo_cut = zcl_capi_executors=>new_fixed_thread_pool( iv_server_group = 'parallel_generators' io_capi_message_handler = lo_capi_message_handler ). ENDMETHOD. METHOD teardown. ENDMETHOD. METHOD invoke_all. DATA lo_tasks TYPE REF TO zcl_capi_collection. DATA lo_results TYPE REF TO zif_capi_collection. DATA lo_capi_tasks_invocation TYPE REF TO zcx_capi_tasks_invocation. DATA lv_message_text TYPE string. CREATE OBJECT lo_tasks. TRY. lo_results = mo_cut->zif_capi_executor_service~invoke_all( lo_tasks ). IF lo_results IS NOT BOUND. cl_aunit_assert=>fail( msg = 'Testing invoke_all' ). ENDIF. CATCH zcx_capi_tasks_invocation INTO lo_capi_tasks_invocation. lv_message_text = lo_capi_tasks_invocation->get_text( ). cl_aunit_assert=>fail( msg = lv_message_text ). ENDTRY. ENDMETHOD. ENDCLASS.
24.075758
108
0.716174
034c3a20885ea1d2acc08746e866d9b1ecfdd6b6
544
abap
ABAP
src/z_adicer_strategy_factory.clas.abap
abap-code-dojo/abapdicer
41ca61917deca06d3c6a13549fe2f7b6b52b3188
[ "MIT" ]
2
2019-12-08T17:46:08.000Z
2021-03-20T18:14:46.000Z
src/z_adicer_strategy_factory.clas.abap
abap-code-dojo/abapdicer
41ca61917deca06d3c6a13549fe2f7b6b52b3188
[ "MIT" ]
2
2019-12-05T15:59:35.000Z
2019-12-05T19:43:42.000Z
src/z_adicer_strategy_factory.clas.abap
abap-code-dojo/abapdicer
41ca61917deca06d3c6a13549fe2f7b6b52b3188
[ "MIT" ]
2
2020-03-19T14:26:26.000Z
2021-10-13T13:36:08.000Z
class Z_ADICER_STRATEGY_FACTORY definition public final create public . public section. class-methods CREATE importing !STRATEGY type ZADICER_GAME_STRATEGY returning value(OBJECT) type ref to ZIF_ADICER_STRATEGY . protected section. private section. ENDCLASS. CLASS Z_ADICER_STRATEGY_FACTORY IMPLEMENTATION. METHOD create. TRY. CREATE OBJECT object TYPE (strategy). CATCH cx_sy_create_object_error. object = NEW z_adicer_strategy_tst_empty( ). ENDTRY. ENDMETHOD. ENDCLASS.
17
53
0.735294
0353a4d5adab57093359560cebd231062bdc1fab
1,716
abap
ABAP
zbugtracker_core/zbugtracker_persistence/zca_bug_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
3
2019-02-10T22:03:43.000Z
2021-05-26T06:49:55.000Z
zbugtracker_core/zbugtracker_persistence/zca_bug_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
2
2020-05-06T14:25:17.000Z
2022-01-13T10:06:40.000Z
zbugtracker_core/zbugtracker_persistence/zca_bug_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
1
2021-05-26T06:49:56.000Z
2021-05-26T06:49:56.000Z
class ZCA_BUG_PERSIST definition public inheriting from ZCB_BUG_PERSIST final create private . *"* public components of class ZCA_BUG_PERSIST *"* do not include other source files here!!! public section. class-data AGENT type ref to ZCA_BUG_PERSIST read-only . class-methods CLASS_CONSTRUCTOR . protected section. *"* protected components of class ZCA_BUG_PERSIST *"* do not include other source files here!!! private section. *"* private components of class ZCA_BUG_PERSIST *"* do not include other source files here!!! ENDCLASS. CLASS ZCA_BUG_PERSIST IMPLEMENTATION. method CLASS_CONSTRUCTOR. ***BUILD 051401 ************************************************************************ * Purpose : Initialize the 'class'. * * Version : 2.0 * * Precondition : - * * Postcondition : Singleton is created. * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 1999-09-20 : (OS) Initial Version * - 2000-03-06 : (BGR) 2.0 modified REGISTER_CLASS_AGENT ************************************************************************ * GENERATED: Do not modify ************************************************************************ create object AGENT. call method AGENT->REGISTER_CLASS_AGENT exporting I_CLASS_NAME = 'ZCL_BUG_PERSIST' I_CLASS_AGENT_NAME = 'ZCA_BUG_PERSIST' I_CLASS_GUID = 'DF33B1346B5A51F19286080027E6C24E' I_CLASS_AGENT_GUID = 'DF33B1346B5A5DF19286080027E6C24E' I_AGENT = AGENT I_STORAGE_LOCATION = 'ZBT_BUG' I_CLASS_AGENT_VERSION = '2.0'. "CLASS_CONSTRUCTOR endmethod. ENDCLASS.
26.4
72
0.581002
035526c72cb67344a69b2306526df5c6dc97dfd1
3,849
abap
ABAP
src/checks/y_check_empty_catches.clas.testclasses.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
202
2020-05-05T13:41:12.000Z
2022-03-26T15:18:13.000Z
src/checks/y_check_empty_catches.clas.testclasses.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
322
2020-05-05T19:14:35.000Z
2022-03-22T14:48:44.000Z
src/checks/y_check_empty_catches.clas.testclasses.abap
lucasborin/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
59
2020-05-05T18:59:19.000Z
2022-03-20T11:24:48.000Z
CLASS ltc_class_based DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_class_based IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_empty_catches( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT ut_test. ' ) ( ' CLASS classname DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' METHODS class_based. ' ) ( ' ENDCLASS. ' ) ( ' CLASS classname IMPLEMENTATION. ' ) ( ' METHOD class_based. ' ) ( ' TRY. ' ) ( ' CATCH cx_sy_no_handler. ' ) ( '* comment' ) ( ' ENDTRY. ' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT ut_test. ' ) ( ' CLASS classname DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' METHODS class_based. ' ) ( ' ENDCLASS. ' ) ( ' CLASS classname IMPLEMENTATION. ' ) ( ' METHOD class_based. ' ) ( ' TRY. ' ) ( ' CATCH cx_sy_no_handler. ' ) ( ' DATA cx TYPE c. ' ) ( ' ENDTRY. ' ) ( ' ENDMETHOD. ' ) ( 'ENDCLASS. ' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT ut_test. ' ) ( ' CLASS classname DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' METHODS class_based. ' ) ( ' ENDCLASS. ' ) ( ' CLASS classname IMPLEMENTATION. ' ) ( ' METHOD class_based. ' ) ( ' TRY. ' ) ( ' CATCH cx_sy_no_handler. "#EC EMPTY_CATCH ' ) ( '* comment ' ) ( ' ENDTRY. ' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. ENDCLASS. CLASS ltc_system_based DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_system_based IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_empty_catches( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT ut_test. ' ) ( ' CLASS classname DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' METHODS system_based. ' ) ( ' ENDCLASS. ' ) ( ' CLASS classname IMPLEMENTATION. ' ) ( ' METHOD system_based. ' ) ( ' CATCH SYSTEM-EXCEPTIONS OTHERS = 1. ' ) ( ' ENDCATCH. ' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT ut_test. ' ) ( ' CLASS classname DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' METHODS system_based. ' ) ( ' ENDCLASS. ' ) ( ' CLASS classname IMPLEMENTATION. ' ) ( ' METHOD system_based. ' ) ( ' CATCH SYSTEM-EXCEPTIONS OTHERS = 1. ' ) ( ' ROLLBACK WORK. ' ) ( ' ENDCATCH. ' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT ut_test. ' ) ( ' CLASS classname DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' METHODS system_based. ' ) ( ' ENDCLASS. ' ) ( ' CLASS classname IMPLEMENTATION. ' ) ( ' METHOD system_based. ' ) ( ' CATCH SYSTEM-EXCEPTIONS OTHERS = 1. "#EC EMPTY_CATCH ' ) ( ' ENDCATCH. ' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. ENDCLASS.
26.183673
114
0.548454
0355e4d69034a5faad632971d5ae0d39f8d759d9
6,893
abap
ABAP
src/ycl_abapgit_dot_abapgit.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/ycl_abapgit_dot_abapgit.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/ycl_abapgit_dot_abapgit.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
2
2019-11-24T20:35:16.000Z
2020-04-16T07:29:33.000Z
CLASS ycl_abapgit_dot_abapgit DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS build_default RETURNING VALUE(ro_dot_abapgit) TYPE REF TO ycl_abapgit_dot_abapgit . CLASS-METHODS deserialize IMPORTING !iv_xstr TYPE xstring RETURNING VALUE(ro_dot_abapgit) TYPE REF TO ycl_abapgit_dot_abapgit RAISING ycx_abapgit_exception . METHODS constructor IMPORTING !is_data TYPE yif_abapgit_dot_abapgit=>ty_dot_abapgit . METHODS serialize RETURNING VALUE(rv_xstr) TYPE xstring RAISING ycx_abapgit_exception . METHODS get_data RETURNING VALUE(rs_data) TYPE yif_abapgit_dot_abapgit=>ty_dot_abapgit . METHODS add_ignore IMPORTING !iv_path TYPE string !iv_filename TYPE string . METHODS is_ignored IMPORTING !iv_path TYPE string !iv_filename TYPE string RETURNING VALUE(rv_ignored) TYPE abap_bool . METHODS remove_ignore IMPORTING !iv_path TYPE string !iv_filename TYPE string . METHODS get_starting_folder RETURNING VALUE(rv_path) TYPE string . METHODS get_folder_logic RETURNING VALUE(rv_logic) TYPE string . METHODS set_folder_logic IMPORTING !iv_logic TYPE string . METHODS set_starting_folder IMPORTING !iv_path TYPE string . METHODS get_master_language RETURNING VALUE(rv_language) TYPE spras . * set_master_language * IMPORTING iv_language TYPE spras, METHODS get_signature RETURNING VALUE(rs_signature) TYPE yif_abapgit_definitions=>ty_file_signature RAISING ycx_abapgit_exception . METHODS get_requirements RETURNING VALUE(rt_requirements) TYPE yif_abapgit_dot_abapgit=>ty_requirement_tt. METHODS set_requirements IMPORTING it_requirements TYPE yif_abapgit_dot_abapgit=>ty_requirement_tt. PRIVATE SECTION. DATA: ms_data TYPE yif_abapgit_dot_abapgit=>ty_dot_abapgit. CLASS-METHODS: to_xml IMPORTING is_data TYPE yif_abapgit_dot_abapgit=>ty_dot_abapgit RETURNING VALUE(rv_xml) TYPE string RAISING ycx_abapgit_exception, from_xml IMPORTING iv_xml TYPE string RETURNING VALUE(rs_data) TYPE yif_abapgit_dot_abapgit=>ty_dot_abapgit. ENDCLASS. CLASS ycl_abapgit_dot_abapgit IMPLEMENTATION. METHOD add_ignore. DATA: lv_name TYPE string. FIELD-SYMBOLS: <lv_ignore> LIKE LINE OF ms_data-ignore. lv_name = iv_path && iv_filename. READ TABLE ms_data-ignore FROM lv_name TRANSPORTING NO FIELDS. IF sy-subrc = 0. RETURN. ENDIF. APPEND INITIAL LINE TO ms_data-ignore ASSIGNING <lv_ignore>. <lv_ignore> = lv_name. ENDMETHOD. METHOD build_default. DATA: ls_data TYPE yif_abapgit_dot_abapgit=>ty_dot_abapgit. ls_data-master_language = sy-langu. ls_data-starting_folder = '/src/'. ls_data-folder_logic = yif_abapgit_dot_abapgit=>c_folder_logic-prefix. APPEND '/.gitignore' TO ls_data-ignore. APPEND '/LICENSE' TO ls_data-ignore. APPEND '/README.md' TO ls_data-ignore. APPEND '/package.json' TO ls_data-ignore. APPEND '/.travis.yml' TO ls_data-ignore. CREATE OBJECT ro_dot_abapgit EXPORTING is_data = ls_data. ENDMETHOD. METHOD constructor. ms_data = is_data. ENDMETHOD. METHOD deserialize. DATA: lv_xml TYPE string, ls_data TYPE yif_abapgit_dot_abapgit=>ty_dot_abapgit. lv_xml = ycl_abapgit_convert=>xstring_to_string_utf8( iv_xstr ). ls_data = from_xml( lv_xml ). CREATE OBJECT ro_dot_abapgit EXPORTING is_data = ls_data. ENDMETHOD. METHOD from_xml. DATA: lv_xml TYPE string. lv_xml = iv_xml. * fix downward compatibility REPLACE ALL OCCURRENCES OF '<_--28C_DATA_--29>' IN lv_xml WITH '<DATA>'. REPLACE ALL OCCURRENCES OF '</_--28C_DATA_--29>' IN lv_xml WITH '</DATA>'. CALL TRANSFORMATION id OPTIONS value_handling = 'accept_data_loss' SOURCE XML lv_xml RESULT data = rs_data ##NO_TEXT. * downward compatibility IF rs_data-folder_logic IS INITIAL. rs_data-folder_logic = yif_abapgit_dot_abapgit=>c_folder_logic-prefix. ENDIF. ENDMETHOD. METHOD get_data. rs_data = ms_data. ENDMETHOD. METHOD get_folder_logic. rv_logic = ms_data-folder_logic. ENDMETHOD. METHOD get_master_language. rv_language = ms_data-master_language. ENDMETHOD. METHOD get_signature. rs_signature-path = yif_abapgit_definitions=>c_root_dir. rs_signature-filename = yif_abapgit_definitions=>c_dot_abapgit. rs_signature-sha1 = ycl_abapgit_hash=>sha1( iv_type = yif_abapgit_definitions=>c_type-blob iv_data = serialize( ) ). ENDMETHOD. "get_signature METHOD get_starting_folder. rv_path = ms_data-starting_folder. ENDMETHOD. METHOD is_ignored. DATA: lv_name TYPE string, lv_starting TYPE string, lv_dot TYPE string, lv_count TYPE i, lv_ignore TYPE string. lv_name = iv_path && iv_filename. CONCATENATE ms_data-starting_folder '*' INTO lv_starting. CONCATENATE '/' yif_abapgit_definitions=>c_dot_abapgit INTO lv_dot. LOOP AT ms_data-ignore INTO lv_ignore. FIND ALL OCCURRENCES OF '/' IN lv_name MATCH COUNT lv_count. IF lv_name CP lv_ignore OR ( ms_data-starting_folder <> '/' AND lv_count > 1 AND NOT lv_name CP lv_starting AND NOT lv_name = lv_dot ). rv_ignored = abap_true. RETURN. ENDIF. ENDLOOP. ENDMETHOD. METHOD remove_ignore. DATA: lv_name TYPE string. lv_name = iv_path && iv_filename. DELETE TABLE ms_data-ignore FROM lv_name. ENDMETHOD. METHOD serialize. DATA: lv_xml TYPE string. lv_xml = to_xml( ms_data ). rv_xstr = ycl_abapgit_convert=>string_to_xstring_utf8( lv_xml ). ENDMETHOD. METHOD set_folder_logic. ms_data-folder_logic = iv_logic. ENDMETHOD. METHOD set_starting_folder. ms_data-starting_folder = iv_path. ENDMETHOD. METHOD to_xml. CALL TRANSFORMATION id OPTIONS initial_components = 'suppress' SOURCE data = is_data RESULT XML rv_xml. rv_xml = ycl_abapgit_xml_pretty=>print( rv_xml ). REPLACE FIRST OCCURRENCE OF REGEX '<\?xml version="1\.0" encoding="[\w-]+"\?>' IN rv_xml WITH '<?xml version="1.0" encoding="utf-8"?>'. ASSERT sy-subrc = 0. ENDMETHOD. METHOD get_requirements. rt_requirements = ms_data-requirements. ENDMETHOD. METHOD set_requirements. ms_data-requirements = it_requirements. ENDMETHOD. ENDCLASS.
23.130872
98
0.67895
03592363e2e7f44bc8e1d0fa01d99b29f1cec4ea
2,623
abap
ABAP
src/zunitdemo_example_1/zunitdemo_ex1_cl_migrator_3.clas.testclasses.abap
RainerWinkler/ABAP-Unit-Test-Demo
ab84490e0450c4bde65473f55042ab3ed6a4ea64
[ "MIT" ]
1
2020-09-26T11:09:54.000Z
2020-09-26T11:09:54.000Z
src/zunitdemo_example_1/zunitdemo_ex1_cl_migrator_3.clas.testclasses.abap
RainerWinkler/ABAP-Unit-Test-Demo
ab84490e0450c4bde65473f55042ab3ed6a4ea64
[ "MIT" ]
null
null
null
src/zunitdemo_example_1/zunitdemo_ex1_cl_migrator_3.clas.testclasses.abap
RainerWinkler/ABAP-Unit-Test-Demo
ab84490e0450c4bde65473f55042ab3ed6a4ea64
[ "MIT" ]
3
2019-11-25T17:30:22.000Z
2022-02-11T06:38:02.000Z
CLASS ltcl_test DEFINITION DEFERRED. CLASS zunitdemo_ex1_cl_migrator_3 DEFINITION LOCAL FRIENDS ltcl_test. CLASS ltcl_test DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA f_cut TYPE REF TO zunitdemo_ex1_cl_migrator_3. DATA: test_data TYPE STANDARD TABLE OF sflight WITH DEFAULT KEY, expecteds TYPE STANDARD TABLE OF sflight WITH DEFAULT KEY. METHODS: setup, _prepare_test_data, _migrate, _check IMPORTING message TYPE string, simple FOR TESTING RAISING cx_static_check, simple2 FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_test IMPLEMENTATION. METHOD setup. f_cut = NEW #( ). ENDMETHOD. METHOD simple. test_data = VALUE #( ( carrid = |TST| connid = 1 fldate = |20200101| price = 1 ) ). _prepare_test_data( ). _migrate( ). expecteds = VALUE #( ( mandt = sy-mandt carrid = |TST| connid = 1 fldate = |20200101| price = 2 ) ). _check( 'Expect correctly migrated data' ). ENDMETHOD. METHOD simple2. test_data = VALUE #( ( carrid = |TST| connid = 1 fldate = |20200101| price = 100 ) ). _prepare_test_data( ). _migrate( ). expecteds = VALUE #( ( mandt = sy-mandt carrid = |TST| connid = 1 fldate = |20200101| price = 110 ) ). _check( 'Expect correctly migrated data' ). ENDMETHOD. METHOD _prepare_test_data. " Prepare test data for migration DELETE FROM sflight WHERE carrid = 'TST'. COMMIT WORK AND WAIT. INSERT sflight FROM TABLE test_data. COMMIT WORK AND WAIT. ENDMETHOD. METHOD _migrate. " Migrate f_cut->migrate( carrid_range = VALUE #( ( sign = |I| option = |EQ| low = 'TST' ) ) ). COMMIT WORK AND WAIT. ENDMETHOD. METHOD _check. " Check DATA: actuals TYPE STANDARD TABLE OF sflight WITH DEFAULT KEY. SELECT * FROM sflight INTO TABLE @actuals WHERE carrid = 'TST'. SORT actuals. SORT expecteds. cl_abap_unit_assert=>assert_equals( msg = message exp = expecteds act = actuals ). ENDMETHOD. ENDCLASS.
23.212389
89
0.532215
035a6450a5689c22e6a151c3d856db575d5794ba
9,878
abap
ABAP
src/objects/zcl_abapgit_object_suso.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
317
2020-09-25T19:50:59.000Z
2022-03-29T22:59:01.000Z
src/objects/zcl_abapgit_object_suso.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
1,114
2020-09-24T07:44:36.000Z
2022-03-31T18:01:19.000Z
src/objects/zcl_abapgit_object_suso.clas.abap
wangdongcheng/abapGit
7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab
[ "MIT" ]
167
2020-09-24T18:31:37.000Z
2022-03-24T10:07:04.000Z
CLASS zcl_abapgit_object_suso DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. METHODS: constructor IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item iv_language TYPE spras. PROTECTED SECTION. PRIVATE SECTION. DATA: mv_objectname TYPE tobj-objct. METHODS: delete_documentation RAISING zcx_abapgit_exception, pre_check RAISING zcx_abapgit_exception, regenerate_sap_all. ENDCLASS. CLASS zcl_abapgit_object_suso IMPLEMENTATION. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). mv_objectname = ms_item-obj_name. ENDMETHOD. METHOD delete_documentation. DATA: lv_docu_obj TYPE dokhl-object, lv_dummy TYPE sy-langu. lv_docu_obj = mv_objectname. SELECT SINGLE langu FROM dokil INTO lv_dummy WHERE id = 'UO' "#EC CI_GENBUFF AND object = lv_docu_obj. IF sy-subrc = 0. CALL FUNCTION 'DOKU_DELETE_ALL' EXPORTING doku_id = 'UO' doku_object = lv_docu_obj suppress_transport = space EXCEPTIONS header_without_text = 1 index_without_header = 2 no_authority_for_devclass_xxxx = 3 no_docu_found = 4 object_is_already_enqueued = 5 object_is_enqueued_by_corr = 6 techn_enqueue_problem = 7 user_break = 8 OTHERS = 9. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDIF. ENDMETHOD. METHOD pre_check. CONSTANTS: lc_act_delete TYPE activ_auth VALUE '06'. DATA: lv_act_head TYPE activ_auth, lv_dummy TYPE string, lo_suso TYPE REF TO object, lv_failed TYPE abap_bool, lv_suso_collect_in_cts TYPE i, ls_clskey TYPE seoclskey. " Downport: CL_SUSO_GEN doesn't exist in 702 ls_clskey-clsname = |CL_SUSO_GEN|. CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK' EXPORTING clskey = ls_clskey EXCEPTIONS not_specified = 1 not_existing = 2 is_interface = 3 no_text = 4 inconsistent = 5 OTHERS = 6. IF sy-subrc = 0. " so these check are not executed in 702 CREATE OBJECT lo_suso TYPE ('CL_SUSO_GEN'). CALL METHOD lo_suso->('SUSO_LOAD_FROM_DB') EXPORTING id_object = mv_objectname RECEIVING ed_failed = lv_failed. IF lv_failed = abap_true. " Object & does not exist; choose an existing object MESSAGE s111(01) WITH mv_objectname INTO lv_dummy. zcx_abapgit_exception=>raise_t100( ). ENDIF. CALL METHOD lo_suso->('GET_SUSO_EDIT_MODE') EXPORTING id_object = mv_objectname id_planed_act = lc_act_delete IMPORTING ed_mode_head = lv_act_head. IF lv_act_head <> lc_act_delete. zcx_abapgit_exception=>raise( |SUSO { mv_objectname }: Delete not allowed. Check where-used in SU21| ). ENDIF. CALL METHOD lo_suso->('SUSO_COLLECT_IN_CTS') EXPORTING id_object = mv_objectname RECEIVING ed_result = lv_suso_collect_in_cts. IF lv_suso_collect_in_cts IS NOT INITIAL. zcx_abapgit_exception=>raise( |SUSO { mv_objectname }: Cannot delete| ). ENDIF. ENDIF. ENDMETHOD. METHOD regenerate_sap_all. DATA: ls_e071 TYPE e071, lt_e071 TYPE STANDARD TABLE OF e071, lt_e071k TYPE STANDARD TABLE OF e071k. ls_e071-pgmid = 'R3TR'. ls_e071-object = ms_item-obj_type. ls_e071-obj_name = ms_item-obj_name. INSERT ls_e071 INTO TABLE lt_e071. CALL FUNCTION 'PRGN_AFTER_IMP_SUSO_SAP_ALL' EXPORTING iv_tarclient = '000' iv_is_upgrade = space TABLES tt_e071 = lt_e071 tt_e071k = lt_e071k. ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. " todo ENDMETHOD. METHOD zif_abapgit_object~delete. " FM SUSR_DELETE_OBJECT calls the UI. Therefore we reimplement it here. " As the class CL_SUSO_GEN isn't present in 702, we call dynamically and " skip the pre checks on 702 system. That seems ok. pre_check( ). delete_documentation( ). DELETE FROM tobj WHERE objct = mv_objectname. DELETE FROM tobjt WHERE object = mv_objectname. DELETE FROM tactz WHERE brobj = mv_objectname. CALL FUNCTION 'SUPV_DELETE_OBJECT_ASSIGNMENTS' EXPORTING object_name = mv_objectname all_releases = abap_true. CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT' EXPORTING object = mv_objectname type = 'SUSO' operation = 'DELETE'. regenerate_sap_all( ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. * see function group SUSA DATA: lv_objectname TYPE trobj_name, ls_tobj TYPE tobj, ls_tobjt TYPE tobjt, ls_tobjvorflg TYPE tobjvorflg, lt_tactz TYPE TABLE OF tactz, lt_tobjvordat TYPE TABLE OF tobjvordat, lt_tobjvor TYPE TABLE OF tobjvor. ASSERT NOT ms_item-obj_name IS INITIAL. io_xml->read( EXPORTING iv_name = 'TOBJ' CHANGING cg_data = ls_tobj ). ls_tobj-bname = sy-uname. io_xml->read( EXPORTING iv_name = 'TOBJT' CHANGING cg_data = ls_tobjt ). io_xml->read( EXPORTING iv_name = 'TOBJVORFLG' CHANGING cg_data = ls_tobjvorflg ). io_xml->read( EXPORTING iv_name = 'TACTZ' CHANGING cg_data = lt_tactz ). io_xml->read( EXPORTING iv_name = 'TOBJVORDAT' CHANGING cg_data = lt_tobjvordat ). io_xml->read( EXPORTING iv_name = 'TOBJVOR' CHANGING cg_data = lt_tobjvor ). tadir_insert( iv_package ). lv_objectname = mv_objectname. CALL FUNCTION 'SUSR_COMMEDITCHECK' EXPORTING objectname = lv_objectname transobjecttype = 'O'. MODIFY tobj FROM ls_tobj. "#EC CI_SUBRC MODIFY tobjt FROM ls_tobjt. "#EC CI_SUBRC MODIFY tobjvorflg FROM ls_tobjvorflg. "#EC CI_SUBRC DELETE FROM tactz WHERE brobj = ms_item-obj_name. "#EC CI_SUBRC INSERT tactz FROM TABLE lt_tactz. "#EC CI_SUBRC DELETE FROM tobjvordat WHERE objct = ms_item-obj_name. "#EC CI_SUBRC INSERT tobjvordat FROM TABLE lt_tobjvordat. "#EC CI_SUBRC DELETE FROM tobjvor WHERE objct = ms_item-obj_name. "#EC CI_SUBRC INSERT tobjvor FROM TABLE lt_tobjvor. "#EC CI_SUBRC regenerate_sap_all( ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_objct TYPE tobj-objct. SELECT SINGLE objct FROM tobj INTO lv_objct WHERE objct = ms_item-obj_name. rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). 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 'SUSR_SHOW_OBJECT' EXPORTING object = mv_objectname. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_tobj TYPE tobj, ls_tobjt TYPE tobjt, ls_tobjvorflg TYPE tobjvorflg, lt_tactz TYPE TABLE OF tactz, lt_tobjvordat TYPE TABLE OF tobjvordat, lt_tobjvor TYPE TABLE OF tobjvor. SELECT SINGLE * FROM tobj INTO ls_tobj WHERE objct = ms_item-obj_name. IF sy-subrc <> 0. RETURN. ENDIF. CLEAR ls_tobj-bname. SELECT SINGLE * FROM tobjt INTO ls_tobjt WHERE object = ms_item-obj_name AND langu = mv_language. "#EC CI_GENBUFF IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'TOBJT no english description' && ' for object (' && ms_item-obj_name && ')' ). ENDIF. SELECT SINGLE * FROM tobjvorflg INTO ls_tobjvorflg WHERE objct = ms_item-obj_name. "#EC CI_SUBRC SELECT * FROM tactz INTO TABLE lt_tactz WHERE brobj = ms_item-obj_name ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF SELECT * FROM tobjvordat INTO TABLE lt_tobjvordat WHERE objct = ms_item-obj_name ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF SELECT * FROM tobjvor INTO TABLE lt_tobjvor WHERE objct = ms_item-obj_name ORDER BY PRIMARY KEY. "#EC CI_SUBRC io_xml->add( iv_name = 'TOBJ' ig_data = ls_tobj ). io_xml->add( iv_name = 'TOBJT' ig_data = ls_tobjt ). io_xml->add( iv_name = 'TOBJVORFLG' ig_data = ls_tobjvorflg ). io_xml->add( ig_data = lt_tactz iv_name = 'TACTZ' ). io_xml->add( ig_data = lt_tobjvordat iv_name = 'TOBJVORDAT' ). io_xml->add( ig_data = lt_tobjvor iv_name = 'TOBJVOR' ). ENDMETHOD. ENDCLASS.
26.625337
111
0.612168
035dec88202c9faacdd6bab8a6c10c306b98ec37
126
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_sts/zcl_gtt_sts_pe_fu_filler.clas.testclasses.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
3
2021-07-08T07:16:53.000Z
2021-10-18T07:56:18.000Z
lbn-gtt-standard-app/abap/zsrc/zgtt_sts/zcl_gtt_sts_pe_fu_filler.clas.testclasses.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_sts/zcl_gtt_sts_pe_fu_filler.clas.testclasses.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
*"* use this source file for your ABAP unit test classes INCLUDE zgtt_sts_pe_fu_filler_01 IF FOUND. " Test FU Planned Events
31.5
67
0.793651
035e1289857766b61e56c92743069f3540fdb291
42
abap
ABAP
hello-abap/hello-world.abap
florianbussmann/hello-world
f36cade4b04c7cc9e10e81e6a1b1b5c34816895a
[ "MIT" ]
2
2015-03-15T03:13:01.000Z
2021-05-31T11:55:35.000Z
hello-abap/hello-world.abap
florianbussmann/hello-world
f36cade4b04c7cc9e10e81e6a1b1b5c34816895a
[ "MIT" ]
1
2015-01-28T19:47:01.000Z
2015-01-28T19:47:01.000Z
hello-abap/hello-world.abap
florianbussmann/hello-world
f36cade4b04c7cc9e10e81e6a1b1b5c34816895a
[ "MIT" ]
3
2015-01-25T00:20:49.000Z
2015-04-13T03:39:05.000Z
REPORT ZHELLOWORLD. WRITE 'Hello, World.'.
21
22
0.761905
0360286d9ee57e15ba0c24edd608bf6aac79cc22
9,829
abap
ABAP
src/repo/zcl_abapgit_repo_content_list.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
src/repo/zcl_abapgit_repo_content_list.clas.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
20
2021-07-01T03:02:23.000Z
2021-10-04T08:33:21.000Z
src/repo/zcl_abapgit_repo_content_list.clas.abap
mmastora/abapGit
a3e598ac1f06b1e71555af8e4b9d8790bd5b48c2
[ "MIT" ]
1
2018-07-09T09:09:43.000Z
2018-07-09T09:09:43.000Z
CLASS zcl_abapgit_repo_content_list DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS constructor IMPORTING io_repo TYPE REF TO zcl_abapgit_repo. METHODS list IMPORTING iv_path TYPE string iv_by_folders TYPE abap_bool iv_changes_only TYPE abap_bool RETURNING VALUE(rt_repo_items) TYPE zif_abapgit_definitions=>ty_repo_item_tt RAISING zcx_abapgit_exception. METHODS get_log RETURNING VALUE(ri_log) TYPE REF TO zif_abapgit_log. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_sortkey, default TYPE i VALUE 9999, parent_dir TYPE i VALUE 0, dir TYPE i VALUE 1, orphan TYPE i VALUE 2, changed TYPE i VALUE 3, inactive TYPE i VALUE 4, END OF c_sortkey. DATA: mo_repo TYPE REF TO zcl_abapgit_repo, mi_log TYPE REF TO zif_abapgit_log. METHODS build_repo_items_local_only RETURNING VALUE(rt_repo_items) TYPE zif_abapgit_definitions=>ty_repo_item_tt RAISING zcx_abapgit_exception. METHODS build_repo_items_with_remote RETURNING VALUE(rt_repo_items) TYPE zif_abapgit_definitions=>ty_repo_item_tt RAISING zcx_abapgit_exception. METHODS build_folders IMPORTING iv_cur_dir TYPE string CHANGING ct_repo_items TYPE zif_abapgit_definitions=>ty_repo_item_tt RAISING zcx_abapgit_exception. METHODS filter_changes CHANGING ct_repo_items TYPE zif_abapgit_definitions=>ty_repo_item_tt. METHODS check_repo_size RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_REPO_CONTENT_LIST IMPLEMENTATION. METHOD build_folders. DATA: lv_index TYPE i, lt_subitems LIKE ct_repo_items, ls_subitem LIKE LINE OF ct_repo_items, ls_folder LIKE LINE OF ct_repo_items. DATA lo_state TYPE REF TO zcl_abapgit_item_state. FIELD-SYMBOLS <ls_item> LIKE LINE OF ct_repo_items. LOOP AT ct_repo_items ASSIGNING <ls_item>. lv_index = sy-tabix. CHECK <ls_item>-path <> iv_cur_dir. " files in target dir - just leave them be IF zcl_abapgit_path=>is_subdir( iv_path = <ls_item>-path iv_parent = iv_cur_dir ) = abap_true. ls_subitem-changes = <ls_item>-changes. ls_subitem-path = <ls_item>-path. ls_subitem-lstate = <ls_item>-lstate. ls_subitem-rstate = <ls_item>-rstate. APPEND ls_subitem TO lt_subitems. ENDIF. DELETE ct_repo_items INDEX lv_index. ENDLOOP. SORT lt_subitems BY path ASCENDING. LOOP AT lt_subitems ASSIGNING <ls_item>. AT NEW path. CLEAR ls_folder. ls_folder-path = <ls_item>-path. ls_folder-sortkey = c_sortkey-dir. " Directory ls_folder-is_dir = abap_true. CREATE OBJECT lo_state. ENDAT. ls_folder-changes = ls_folder-changes + <ls_item>-changes. lo_state->sum_with_repo_item( <ls_item> ). AT END OF path. ls_folder-lstate = lo_state->local( ). ls_folder-rstate = lo_state->remote( ). APPEND ls_folder TO ct_repo_items. ENDAT. ENDLOOP. ENDMETHOD. METHOD build_repo_items_local_only. DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt, ls_item TYPE zif_abapgit_definitions=>ty_item. FIELD-SYMBOLS: <ls_repo_item> LIKE LINE OF rt_repo_items, <ls_tadir> LIKE LINE OF lt_tadir. lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( iv_package = mo_repo->get_package( ) io_dot = mo_repo->get_dot_abapgit( ) ). LOOP AT lt_tadir ASSIGNING <ls_tadir>. APPEND INITIAL LINE TO rt_repo_items ASSIGNING <ls_repo_item>. <ls_repo_item>-obj_type = <ls_tadir>-object. <ls_repo_item>-obj_name = <ls_tadir>-obj_name. <ls_repo_item>-path = <ls_tadir>-path. MOVE-CORRESPONDING <ls_repo_item> TO ls_item. <ls_repo_item>-inactive = boolc( zcl_abapgit_objects=>is_active( ls_item ) = abap_false ). IF <ls_repo_item>-inactive = abap_true. <ls_repo_item>-sortkey = c_sortkey-inactive. ELSE. <ls_repo_item>-sortkey = c_sortkey-default. " Default sort key ENDIF. IF <ls_repo_item>-obj_type IS NOT INITIAL. MOVE-CORRESPONDING <ls_repo_item> TO ls_item. IF zcl_abapgit_objects=>exists( ls_item ) = abap_true. <ls_repo_item>-changed_by = zcl_abapgit_objects=>changed_by( ls_item ). ENDIF. CLEAR ls_item. ENDIF. ENDLOOP. ENDMETHOD. METHOD build_repo_items_with_remote. DATA: lo_state TYPE REF TO zcl_abapgit_item_state, ls_file TYPE zif_abapgit_definitions=>ty_repo_file, lt_status TYPE zif_abapgit_definitions=>ty_results_tt, ls_item TYPE zif_abapgit_definitions=>ty_item, ls_previous LIKE ls_item, lv_changed_by TYPE string. FIELD-SYMBOLS: <ls_status> LIKE LINE OF lt_status, <ls_repo_item> LIKE LINE OF rt_repo_items. lt_status = mo_repo->status( mi_log ). LOOP AT lt_status ASSIGNING <ls_status>. AT NEW obj_name. "obj_type + obj_name APPEND INITIAL LINE TO rt_repo_items ASSIGNING <ls_repo_item>. <ls_repo_item>-obj_type = <ls_status>-obj_type. <ls_repo_item>-obj_name = <ls_status>-obj_name. <ls_repo_item>-inactive = <ls_status>-inactive. <ls_repo_item>-sortkey = c_sortkey-default. " Default sort key <ls_repo_item>-changes = 0. <ls_repo_item>-path = <ls_status>-path. CREATE OBJECT lo_state. ENDAT. IF <ls_status>-filename IS NOT INITIAL. MOVE-CORRESPONDING <ls_status> TO ls_file. ls_file-is_changed = boolc( <ls_status>-match = abap_false ). " TODO refactor APPEND ls_file TO <ls_repo_item>-files. IF <ls_status>-inactive = abap_true AND <ls_repo_item>-sortkey > c_sortkey-changed. <ls_repo_item>-sortkey = c_sortkey-inactive. ENDIF. IF ls_file-is_changed = abap_true. <ls_repo_item>-sortkey = c_sortkey-changed. " Changed files <ls_repo_item>-changes = <ls_repo_item>-changes + 1. lo_state->sum_with_status_item( <ls_status> ). ENDIF. ENDIF. IF <ls_repo_item>-changes > 0 AND <ls_repo_item>-obj_type IS NOT INITIAL. MOVE-CORRESPONDING <ls_repo_item> TO ls_item. IF ls_previous = ls_item. <ls_repo_item>-changed_by = lv_changed_by. ELSEIF zcl_abapgit_objects=>exists( ls_item ) = abap_true. <ls_repo_item>-changed_by = zcl_abapgit_objects=>changed_by( ls_item ). ls_previous = ls_item. lv_changed_by = <ls_repo_item>-changed_by. ENDIF. CLEAR ls_item. ENDIF. AT END OF obj_name. "obj_type + obj_name IF <ls_repo_item>-obj_type IS INITIAL. <ls_repo_item>-sortkey = c_sortkey-orphan. "Virtual objects ENDIF. <ls_repo_item>-lstate = lo_state->local( ). <ls_repo_item>-rstate = lo_state->remote( ). <ls_repo_item>-packmove = lo_state->is_reassigned( ). ENDAT. ENDLOOP. ENDMETHOD. METHOD check_repo_size. CONSTANTS lc_new_repo_size TYPE i VALUE 10. DATA lt_remote TYPE zif_abapgit_definitions=>ty_files_tt. lt_remote = mo_repo->get_files_remote( ). IF lines( lt_remote ) > lc_new_repo_size. " Less files means it's a new repo (with just readme and license, for example) which is ok READ TABLE lt_remote TRANSPORTING NO FIELDS WITH KEY path = zif_abapgit_definitions=>c_root_dir filename = zif_abapgit_definitions=>c_dot_abapgit. IF sy-subrc <> 0. mi_log->add_warning( |Cannot find .abapgit.xml - Is this an abapGit repository?| ). ENDIF. ENDIF. ENDMETHOD. METHOD constructor. mo_repo = io_repo. CREATE OBJECT mi_log TYPE zcl_abapgit_log. ENDMETHOD. METHOD filter_changes. FIELD-SYMBOLS: <ls_item> TYPE zif_abapgit_definitions=>ty_repo_item. DELETE ct_repo_items WHERE changes = 0 AND inactive = abap_false. LOOP AT ct_repo_items ASSIGNING <ls_item> WHERE inactive = abap_false. DELETE <ls_item>-files WHERE is_changed = abap_false. ENDLOOP. ENDMETHOD. METHOD get_log. DATA li_repo_log TYPE REF TO zif_abapgit_log. DATA lt_repo_msg TYPE zif_abapgit_log=>ty_log_outs. DATA lr_repo_msg TYPE REF TO zif_abapgit_log=>ty_log_out. ri_log = mi_log. "add warning and error messages from repo log li_repo_log = mo_repo->get_log( ). IF li_repo_log IS BOUND. lt_repo_msg = li_repo_log->get_messages( ). LOOP AT lt_repo_msg REFERENCE INTO lr_repo_msg WHERE type CA 'EW'. CASE lr_repo_msg->type. WHEN 'E'. ri_log->add_error( lr_repo_msg->text ). WHEN 'W'. ri_log->add_warning( lr_repo_msg->text ). WHEN OTHERS. CONTINUE. ENDCASE. ENDLOOP. ENDIF. ENDMETHOD. METHOD list. mi_log->clear( ). IF mo_repo->has_remote_source( ) = abap_true. rt_repo_items = build_repo_items_with_remote( ). check_repo_size( ). ELSE. rt_repo_items = build_repo_items_local_only( ). ENDIF. IF iv_by_folders = abap_true. build_folders( EXPORTING iv_cur_dir = iv_path CHANGING ct_repo_items = rt_repo_items ). ENDIF. IF iv_changes_only = abap_true. " There are never changes for offline repositories filter_changes( CHANGING ct_repo_items = rt_repo_items ). ENDIF. SORT rt_repo_items BY sortkey ASCENDING path ASCENDING obj_name ASCENDING. ENDMETHOD. ENDCLASS.
31.706452
96
0.664869
03657acc8022a9e7f9e4fd29a729ce05c24000a2
14,448
abap
ABAP
src/ui/zcl_abapgit_gui_page_main.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
1
2019-05-27T18:50:14.000Z
2019-05-27T18:50:14.000Z
src/ui/zcl_abapgit_gui_page_main.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_main.clas.abap
kwaishang/abapGit
2807443c82cc9a28df342dde9b8d5f083162f8eb
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_main DEFINITION PUBLIC FINAL CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page. PUBLIC SECTION. INTERFACES: zif_abapgit_gui_page_hotkey. METHODS: constructor RAISING zcx_abapgit_exception, zif_abapgit_gui_event_handler~on_event REDEFINITION. PROTECTED SECTION. METHODS: render_content REDEFINITION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_actions, show TYPE string VALUE 'show' ##NO_TEXT, changed_by TYPE string VALUE 'changed_by', overview TYPE string VALUE 'overview', documentation TYPE string VALUE 'documentation', END OF c_actions. DATA: mv_show TYPE zif_abapgit_persistence=>ty_value, mo_repo_content TYPE REF TO zcl_abapgit_gui_view_repo. METHODS: test_changed_by RAISING zcx_abapgit_exception, retrieve_active_repo RAISING zcx_abapgit_exception, render_toc IMPORTING it_repo_list TYPE zif_abapgit_definitions=>ty_repo_ref_tt RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, build_main_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar, render_repo IMPORTING io_repo TYPE REF TO zcl_abapgit_repo RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_gui_page_main IMPLEMENTATION. METHOD build_main_menu. DATA: lo_advsub TYPE REF TO zcl_abapgit_html_toolbar, lo_helpsub TYPE REF TO zcl_abapgit_html_toolbar. CREATE OBJECT ro_menu. CREATE OBJECT lo_advsub. CREATE OBJECT lo_helpsub. lo_advsub->add( iv_txt = 'Repository overview' iv_act = zif_abapgit_definitions=>c_action-go_repo_overview ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Database util' iv_act = zif_abapgit_definitions=>c_action-go_db ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Package to zip' iv_act = zif_abapgit_definitions=>c_action-zip_package ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Transport to zip' iv_act = zif_abapgit_definitions=>c_action-zip_transport ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Object to files' iv_act = zif_abapgit_definitions=>c_action-zip_object ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Test changed by' iv_act = c_actions-changed_by ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Page playground' iv_act = zif_abapgit_definitions=>c_action-go_playground ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Debug info' iv_act = zif_abapgit_definitions=>c_action-go_debuginfo ) ##NO_TEXT. lo_advsub->add( iv_txt = 'Settings' iv_act = zif_abapgit_definitions=>c_action-go_settings ) ##NO_TEXT. lo_helpsub->add( iv_txt = 'Tutorial' iv_act = zif_abapgit_definitions=>c_action-go_tutorial ) ##NO_TEXT. lo_helpsub->add( iv_txt = 'Documentation' iv_act = c_actions-documentation ) ##NO_TEXT. ro_menu->add( iv_txt = '+ Online' iv_act = zif_abapgit_definitions=>c_action-repo_newonline ) ##NO_TEXT. ro_menu->add( iv_txt = '+ Offline' iv_act = zif_abapgit_definitions=>c_action-repo_newoffline ) ##NO_TEXT. ro_menu->add( iv_txt = 'Explore' iv_act = zif_abapgit_definitions=>c_action-go_explore ) ##NO_TEXT. ro_menu->add( iv_txt = 'Advanced' io_sub = lo_advsub ) ##NO_TEXT. ro_menu->add( iv_txt = 'Help' io_sub = lo_helpsub ) ##NO_TEXT. ENDMETHOD. METHOD constructor. super->constructor( ). ms_control-page_title = 'HOME'. ms_control-page_menu = build_main_menu( ). ENDMETHOD. METHOD render_content. DATA: lt_repos TYPE zif_abapgit_definitions=>ty_repo_ref_tt, lx_error TYPE REF TO zcx_abapgit_exception, lo_tutorial TYPE REF TO zcl_abapgit_gui_view_tutorial, lo_repo LIKE LINE OF lt_repos. retrieve_active_repo( ). " Get and validate key of user default repo CREATE OBJECT ro_html. TRY. lt_repos = zcl_abapgit_repo_srv=>get_instance( )->list( ). CATCH zcx_abapgit_exception INTO lx_error. ro_html->add( zcl_abapgit_gui_chunk_lib=>render_error( ix_error = lx_error ) ). RETURN. ENDTRY. ro_html->add( render_toc( lt_repos ) ). IF mv_show IS INITIAL OR lines( lt_repos ) = 0. CREATE OBJECT lo_tutorial. ro_html->add( lo_tutorial->render( ) ). ELSE. lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( mv_show ). ro_html->add( render_repo( lo_repo ) ). ENDIF. ENDMETHOD. METHOD render_repo. DATA lo_news TYPE REF TO zcl_abapgit_news. CREATE OBJECT ro_html. lo_news = zcl_abapgit_news=>create( io_repo ). ro_html->add( |<div class="repo" id="repo{ io_repo->get_key( ) }">| ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( io_repo = io_repo io_news = lo_news iv_interactive_branch = abap_true ) ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_news( io_news = lo_news ) ). ro_html->add( mo_repo_content->render( ) ). ro_html->add( '</div>' ). ENDMETHOD. METHOD render_toc. DATA: lo_pback TYPE REF TO zcl_abapgit_persist_background, lv_current TYPE abap_bool, lv_key TYPE zif_abapgit_persistence=>ty_repo-key, lv_icon TYPE string, lo_repo LIKE LINE OF it_repo_list, lo_favbar TYPE REF TO zcl_abapgit_html_toolbar, lo_allbar TYPE REF TO zcl_abapgit_html_toolbar, lt_favorites TYPE zcl_abapgit_persistence_user=>tt_favorites, lv_repo_title TYPE string. CREATE OBJECT ro_html. CREATE OBJECT lo_favbar. CREATE OBJECT lo_allbar. CREATE OBJECT lo_pback. lt_favorites = zcl_abapgit_persistence_user=>get_instance( )->get_favorites( ). LOOP AT it_repo_list INTO lo_repo. lv_key = lo_repo->get_key( ). lv_current = abap_false. IF lv_key = mv_show. lv_current = abap_true. ENDIF. lv_repo_title = lo_repo->get_name( ). IF lo_pback->exists( lv_key ) = abap_true. lv_repo_title = lv_repo_title && '<sup>bg</sup>'. " Background marker ENDIF. READ TABLE lt_favorites TRANSPORTING NO FIELDS WITH KEY table_line = lv_key. IF sy-subrc = 0. DELETE lt_favorites INDEX sy-tabix. " for later cleanup lo_favbar->add( iv_txt = lv_repo_title iv_act = |{ c_actions-show }?{ lv_key }| iv_cur = lv_current ). ENDIF. IF lo_repo->is_offline( ) = abap_true. lv_icon = 'plug/darkgrey'. ELSE. lv_icon = 'cloud-upload-alt/blue'. ENDIF. lo_allbar->add( iv_txt = lv_repo_title iv_act = |{ c_actions-show }?{ lv_key }| iv_ico = lv_icon iv_cur = lv_current ). ENDLOOP. " Cleanup orphan favorites (for removed repos) LOOP AT lt_favorites INTO lv_key. zcl_abapgit_persistence_user=>get_instance( )->toggle_favorite( lv_key ). ENDLOOP. " Render HTML ro_html->add( '<div id="toc">' ) ##NO_TEXT. " TODO refactor html & css ro_html->add( '<div class="toc_grid">' ) ##NO_TEXT. ro_html->add( '<div class="toc_row">' ) ##NO_TEXT. ********************************************************************** ro_html->add( '<table class="w100"><tr>' ). ro_html->add( |<td class="pad-sides">{ zcl_abapgit_html=>icon( iv_name = 'star/blue' iv_hint = 'Favorites' ) }</td>| ). ro_html->add( '<td class="pad-sides w100 favorites">' ). " Maximize width IF lo_favbar->count( ) > 0. ro_html->add( lo_favbar->render( iv_sort = abap_true ) ). ELSE. ro_html->add( |<span class="grey">No favorites so far. For more info please check { zcl_abapgit_html=>a( iv_txt = 'tutorial' iv_act = zif_abapgit_definitions=>c_action-go_tutorial ) }</span>| ). ENDIF. ro_html->add( '</td>' ). ro_html->add( '<td>' ). ro_html->add( lo_allbar->render_as_droplist( iv_label = zcl_abapgit_html=>icon( iv_name = 'bars/blue' ) iv_action = c_actions-overview iv_right = abap_true iv_sort = abap_true ) ). ro_html->add( '</td>' ). ro_html->add( '</tr></table>' ). ********************************************************************** ro_html->add( '</div>' ). ro_html->add( '</div>' ). ro_html->add( '</div>' ). ENDMETHOD. METHOD retrieve_active_repo. DATA: lv_show_old LIKE mv_show. TRY. zcl_abapgit_repo_srv=>get_instance( )->list( ). CATCH zcx_abapgit_exception. RETURN. ENDTRY. lv_show_old = mv_show. mv_show = zcl_abapgit_persistence_user=>get_instance( )->get_repo_show( ). " Get default repo from user cfg IF mv_show IS NOT INITIAL. TRY. " verify the key exists zcl_abapgit_repo_srv=>get_instance( )->get( mv_show ). CATCH zcx_abapgit_exception. CLEAR mv_show. zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( mv_show ). ENDTRY. ENDIF. IF lv_show_old <> mv_show AND NOT mv_show IS INITIAL. CREATE OBJECT mo_repo_content EXPORTING iv_key = mv_show. " Reinit content state ENDIF. ENDMETHOD. METHOD test_changed_by. DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir, lv_user TYPE xubname, ls_item TYPE zif_abapgit_definitions=>ty_item. ls_tadir = zcl_abapgit_ui_factory=>get_popups( )->popup_object( ). IF ls_tadir IS INITIAL. RETURN. ENDIF. ls_item-obj_type = ls_tadir-object. ls_item-obj_name = ls_tadir-obj_name. lv_user = zcl_abapgit_objects=>changed_by( ls_item ). MESSAGE lv_user TYPE 'S'. ENDMETHOD. METHOD zif_abapgit_gui_page_hotkey~get_hotkey_actions. DATA: ls_hotkey_action TYPE zif_abapgit_gui_page_hotkey=>ty_hotkey_with_name. ls_hotkey_action-name = |abapGit settings|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_settings. ls_hotkey_action-hotkey = |x|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Stage changes|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_stage. ls_hotkey_action-hotkey = |s|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Switch branch|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_branch_switch. ls_hotkey_action-hotkey = |b|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Installed repo list|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_repo_overview. ls_hotkey_action-hotkey = |o|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Refresh repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_refresh. ls_hotkey_action-hotkey = |r|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Pull|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_pull. ls_hotkey_action-hotkey = |p|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Add online repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_newonline. ls_hotkey_action-hotkey = |n|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Uninstall repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_purge. ls_hotkey_action-hotkey = |u|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Show diffs|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_diff. ls_hotkey_action-hotkey = |d|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-name = |Run code inspector|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_code_inspector. ls_hotkey_action-hotkey = |i|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA: lv_key TYPE zif_abapgit_persistence=>ty_repo-key, li_repo_overview TYPE REF TO zif_abapgit_gui_renderable. IF NOT mo_repo_content IS INITIAL. mo_repo_content->zif_abapgit_gui_event_handler~on_event( EXPORTING iv_action = iv_action iv_prev_page = iv_prev_page iv_getdata = iv_getdata it_postdata = it_postdata IMPORTING ei_page = ei_page ev_state = ev_state ). IF ev_state <> zcl_abapgit_gui=>c_event_state-not_handled. RETURN. ENDIF. ENDIF. lv_key = iv_getdata. CASE iv_action. WHEN c_actions-show. zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lv_key ). TRY. zcl_abapgit_repo_srv=>get_instance( )->get( lv_key )->refresh( ). CATCH zcx_abapgit_exception ##NO_HANDLER. ENDTRY. ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-changed_by. test_changed_by( ). ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN c_actions-documentation. zcl_abapgit_services_abapgit=>open_abapgit_wikipage( ). ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN c_actions-overview. CREATE OBJECT li_repo_overview TYPE zcl_abapgit_gui_page_repo_over. ei_page = li_repo_overview. ev_state = zcl_abapgit_gui=>c_event_state-new_page. WHEN OTHERS. super->zif_abapgit_gui_event_handler~on_event( EXPORTING iv_action = iv_action iv_prev_page = iv_prev_page iv_getdata = iv_getdata it_postdata = it_postdata IMPORTING ei_page = ei_page ev_state = ev_state ). ENDCASE. ENDMETHOD. ENDCLASS.
34.156028
117
0.654416
03665109a521aa638536aead9bf559bc4bdda35f
896
abap
ABAP
src/zdop_dnm_fg.fugr.saplzdop_dnm_fg.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
3
2021-12-22T07:35:51.000Z
2022-01-12T13:37:33.000Z
src/zdop_dnm_fg.fugr.saplzdop_dnm_fg.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
src/zdop_dnm_fg.fugr.saplzdop_dnm_fg.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE LZDOP_DNM_FGTOP. " Global Data INCLUDE LZDOP_DNM_FGUXX. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LZDOP_DNM_FGF... " Subroutines * INCLUDE LZDOP_DNM_FGO... " PBO-Modules * INCLUDE LZDOP_DNM_FGI... " PAI-Modules * INCLUDE LZDOP_DNM_FGE... " Events * INCLUDE LZDOP_DNM_FGP... " Local class implement. * INCLUDE LZDOP_DNM_FGT99. " ABAP Unit tests
56
69
0.356027
0366a3df3c2b0ff4a8d3a67c22319227d10ce4b0
17,911
abap
ABAP
src/zcl_excel.clas.abap
jrodriguez-rc/abap2xlsx
7b48cd0d90583a27bfa1fc97898b14aff79711fb
[ "Apache-2.0" ]
1
2022-01-20T23:59:28.000Z
2022-01-20T23:59:28.000Z
src/zcl_excel.clas.abap
gregorwolf/abap2xlsx
5110f924b435e23f4474381d0e43f0686b9d0421
[ "Apache-2.0" ]
null
null
null
src/zcl_excel.clas.abap
gregorwolf/abap2xlsx
5110f924b435e23f4474381d0e43f0686b9d0421
[ "Apache-2.0" ]
1
2021-07-09T02:06:21.000Z
2021-07-09T02:06:21.000Z
class ZCL_EXCEL definition public create public . public section. *"* public components of class ZCL_EXCEL *"* do not include other source files here!!! interfaces ZIF_EXCEL_BOOK_PROPERTIES . interfaces ZIF_EXCEL_BOOK_PROTECTION . interfaces ZIF_EXCEL_BOOK_VBA_PROJECT . data LEGACY_PALETTE type ref to ZCL_EXCEL_LEGACY_PALETTE read-only . data SECURITY type ref to ZCL_EXCEL_SECURITY . data USE_TEMPLATE type ABAP_BOOL . methods ADD_NEW_AUTOFILTER importing !IO_SHEET type ref to ZCL_EXCEL_WORKSHEET returning value(RO_AUTOFILTER) type ref to ZCL_EXCEL_AUTOFILTER raising ZCX_EXCEL . methods ADD_NEW_COMMENT returning value(EO_COMMENT) type ref to ZCL_EXCEL_COMMENT . methods ADD_NEW_DRAWING importing !IP_TYPE type ZEXCEL_DRAWING_TYPE default ZCL_EXCEL_DRAWING=>TYPE_IMAGE !IP_TITLE type CLIKE optional returning value(EO_DRAWING) type ref to ZCL_EXCEL_DRAWING . methods ADD_NEW_RANGE returning value(EO_RANGE) type ref to ZCL_EXCEL_RANGE . methods ADD_NEW_STYLE importing !IP_GUID type ZEXCEL_CELL_STYLE optional returning value(EO_STYLE) type ref to ZCL_EXCEL_STYLE . methods ADD_NEW_WORKSHEET importing !IP_TITLE type ZEXCEL_SHEET_TITLE optional returning value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . methods ADD_STATIC_STYLES . methods CONSTRUCTOR . methods DELETE_WORKSHEET importing !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . methods DELETE_WORKSHEET_BY_INDEX importing !IV_INDEX type NUMERIC raising ZCX_EXCEL . methods DELETE_WORKSHEET_BY_NAME importing !IV_TITLE type CLIKE raising ZCX_EXCEL . methods GET_ACTIVE_SHEET_INDEX returning value(R_ACTIVE_WORKSHEET) type ZEXCEL_ACTIVE_WORKSHEET . methods GET_ACTIVE_WORKSHEET returning value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET . methods GET_AUTOFILTERS_REFERENCE returning value(RO_AUTOFILTERS) type ref to ZCL_EXCEL_AUTOFILTERS . methods GET_DEFAULT_STYLE returning value(EP_STYLE) type ZEXCEL_CELL_STYLE . methods GET_DRAWINGS_ITERATOR importing !IP_TYPE type ZEXCEL_DRAWING_TYPE returning value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . methods GET_NEXT_TABLE_ID returning value(EP_ID) type I . methods GET_RANGES_ITERATOR returning value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . methods GET_STATIC_CELLSTYLE_GUID importing !IP_CSTYLE_COMPLETE type ZEXCEL_S_CSTYLE_COMPLETE !IP_CSTYLEX_COMPLETE type ZEXCEL_S_CSTYLEX_COMPLETE returning value(EP_GUID) type ZEXCEL_CELL_STYLE . methods GET_STYLES_ITERATOR returning value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . methods GET_STYLE_INDEX_IN_STYLES importing !IP_GUID type ZEXCEL_CELL_STYLE returning value(EP_INDEX) type SYTABIX raising ZCX_EXCEL . methods GET_STYLE_TO_GUID importing !IP_GUID type ZEXCEL_CELL_STYLE returning value(EP_STYLEMAPPING) type ZEXCEL_S_STYLEMAPPING raising ZCX_EXCEL . methods GET_THEME exporting !EO_THEME type ref to ZCL_EXCEL_THEME . methods GET_WORKSHEETS_ITERATOR returning value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR . methods GET_WORKSHEETS_NAME returning value(EP_NAME) type ZEXCEL_WORKSHEETS_NAME . methods GET_WORKSHEETS_SIZE returning value(EP_SIZE) type I . methods GET_WORKSHEET_BY_INDEX importing !IV_INDEX type NUMERIC returning value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET . methods GET_WORKSHEET_BY_NAME importing !IP_SHEET_NAME type ZEXCEL_SHEET_TITLE returning value(EO_WORKSHEET) type ref to ZCL_EXCEL_WORKSHEET . methods SET_ACTIVE_SHEET_INDEX importing !I_ACTIVE_WORKSHEET type ZEXCEL_ACTIVE_WORKSHEET raising ZCX_EXCEL . methods SET_ACTIVE_SHEET_INDEX_BY_NAME importing !I_WORKSHEET_NAME type ZEXCEL_WORKSHEETS_NAME . methods SET_DEFAULT_STYLE importing !IP_STYLE type ZEXCEL_CELL_STYLE raising ZCX_EXCEL . methods SET_THEME importing !IO_THEME type ref to ZCL_EXCEL_THEME . protected section. data WORKSHEETS type ref to ZCL_EXCEL_WORKSHEETS . private section. constants VERSION type CHAR10 value '7.2.0'. "#EC NOTEXT data AUTOFILTERS type ref to ZCL_EXCEL_AUTOFILTERS . data CHARTS type ref to ZCL_EXCEL_DRAWINGS . data DEFAULT_STYLE type ZEXCEL_CELL_STYLE . *"* private components of class ZCL_EXCEL *"* do not include other source files here!!! data DRAWINGS type ref to ZCL_EXCEL_DRAWINGS . data RANGES type ref to ZCL_EXCEL_RANGES . data STYLES type ref to ZCL_EXCEL_STYLES . data T_STYLEMAPPING1 type ZEXCEL_T_STYLEMAPPING1 . data T_STYLEMAPPING2 type ZEXCEL_T_STYLEMAPPING2 . data THEME type ref to ZCL_EXCEL_THEME . data COMMENTS type ref to ZCL_EXCEL_COMMENTS . methods GET_STYLE_FROM_GUID importing !IP_GUID type ZEXCEL_CELL_STYLE returning value(EO_STYLE) type ref to ZCL_EXCEL_STYLE . methods STYLEMAPPING_DYNAMIC_STYLE importing !IP_STYLE type ref to ZCL_EXCEL_STYLE returning value(EO_STYLE2) type ZEXCEL_S_STYLEMAPPING . ENDCLASS. CLASS ZCL_EXCEL IMPLEMENTATION. METHOD add_new_autofilter. * Check for autofilter reference: new or overwrite; only one per sheet ro_autofilter = autofilters->add( io_sheet ) . ENDMETHOD. METHOD add_new_comment. CREATE OBJECT eo_comment. comments->add( eo_comment ). ENDMETHOD. method ADD_NEW_DRAWING. * Create default blank worksheet CREATE OBJECT eo_drawing EXPORTING ip_type = ip_type ip_title = ip_title. CASE ip_type. WHEN 'image'. drawings->add( eo_drawing ). WHEN 'hd_ft'. drawings->add( eo_drawing ). WHEN 'chart'. charts->add( eo_drawing ). ENDCASE. endmethod. method ADD_NEW_RANGE. * Create default blank range CREATE OBJECT eo_range. ranges->add( eo_range ). endmethod. method ADD_NEW_STYLE. * Start of deletion # issue 139 - Dateretention of cellstyles * CREATE OBJECT eo_style. * styles->add( eo_style ). * End of deletion # issue 139 - Dateretention of cellstyles * Start of insertion # issue 139 - Dateretention of cellstyles * Create default style CREATE OBJECT eo_style EXPORTING ip_guid = ip_guid. styles->add( eo_style ). DATA: style2 TYPE zexcel_s_stylemapping. * Copy to new representations style2 = stylemapping_dynamic_style( eo_style ). INSERT style2 INTO TABLE t_stylemapping1. INSERT style2 INTO TABLE t_stylemapping2. * End of insertion # issue 139 - Dateretention of cellstyles endmethod. method ADD_NEW_WORKSHEET. * Create default blank worksheet CREATE OBJECT eo_worksheet EXPORTING ip_excel = me ip_title = ip_title. worksheets->add( eo_worksheet ). worksheets->active_worksheet = worksheets->size( ). endmethod. METHOD add_static_styles. " # issue 139 FIELD-SYMBOLS: <style1> LIKE LINE OF t_stylemapping1, <style2> LIKE LINE OF t_stylemapping2. DATA: style TYPE REF TO zcl_excel_style. LOOP AT me->t_stylemapping1 ASSIGNING <style1> WHERE added_to_iterator IS INITIAL. READ TABLE me->t_stylemapping2 ASSIGNING <style2> WITH TABLE KEY guid = <style1>-guid. CHECK sy-subrc = 0. " Should always be true since these tables are being filled parallel style = me->add_new_style( <style1>-guid ). zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <style1>-complete_style i_sourcex = <style1>-complete_stylex CHANGING e_target = style ). ENDLOOP. ENDMETHOD. method CONSTRUCTOR. DATA: lo_style TYPE REF TO zcl_excel_style. * Inizialize instance objects CREATE OBJECT security. CREATE OBJECT worksheets. CREATE OBJECT ranges. CREATE OBJECT styles. CREATE OBJECT drawings EXPORTING ip_type = zcl_excel_drawing=>type_image. CREATE OBJECT charts EXPORTING ip_type = zcl_excel_drawing=>type_chart. CREATE OBJECT comments. CREATE OBJECT legacy_palette. CREATE OBJECT autofilters. me->zif_excel_book_protection~initialize( ). me->zif_excel_book_properties~initialize( ). try. me->add_new_worksheet( ). catch zcx_excel. " suppress syntax check error assert 1 = 2. " some error processing anyway endtry. me->add_new_style( ). " Standard style lo_style = me->add_new_style( ). " Standard style with fill gray125 lo_style->fill->filltype = zcl_excel_style_fill=>c_fill_pattern_gray125. endmethod. METHOD delete_worksheet. DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, l_size TYPE i, lv_errormessage TYPE string. l_size = get_worksheets_size( ). IF l_size = 1. " Only 1 worksheet left --> check whether this is the worksheet to be deleted lo_worksheet = me->get_worksheet_by_index( 1 ). IF lo_worksheet = io_worksheet. lv_errormessage = 'Deleting last remaining worksheet is not allowed'(002). zcx_excel=>raise_text( lv_errormessage ). ENDIF. ENDIF. me->worksheets->remove( io_worksheet ). ENDMETHOD. METHOD delete_worksheet_by_index. DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, lv_errormessage TYPE string. lo_worksheet = me->get_worksheet_by_index( iv_index ). IF lo_worksheet IS NOT BOUND. lv_errormessage = 'Worksheet not existing'(001). zcx_excel=>raise_text( lv_errormessage ). ENDIF. me->delete_worksheet( lo_worksheet ). ENDMETHOD. METHOD delete_worksheet_by_name. DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, lv_errormessage TYPE string. lo_worksheet = me->get_worksheet_by_name( iv_title ). IF lo_worksheet IS NOT BOUND. lv_errormessage = 'Worksheet not existing'(001). zcx_excel=>raise_text( lv_errormessage ). ENDIF. me->delete_worksheet( lo_worksheet ). ENDMETHOD. method GET_ACTIVE_SHEET_INDEX. r_active_worksheet = me->worksheets->active_worksheet. endmethod. method GET_ACTIVE_WORKSHEET. eo_worksheet = me->worksheets->get( me->worksheets->active_worksheet ). endmethod. method GET_AUTOFILTERS_REFERENCE. ro_autofilters = autofilters. endmethod. method GET_DEFAULT_STYLE. ep_style = me->default_style. endmethod. method GET_DRAWINGS_ITERATOR. CASE ip_type. WHEN zcl_excel_drawing=>type_image. eo_iterator = me->drawings->get_iterator( ). WHEN zcl_excel_drawing=>type_chart. eo_iterator = me->charts->get_iterator( ). WHEN OTHERS. ENDCASE. endmethod. method GET_NEXT_TABLE_ID. DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_iterator TYPE REF TO cl_object_collection_iterator, lv_tables_count TYPE i. lo_iterator = me->get_worksheets_iterator( ). WHILE lo_iterator->has_next( ) EQ abap_true. lo_worksheet ?= lo_iterator->get_next( ). lv_tables_count = lo_worksheet->get_tables_size( ). ADD lv_tables_count TO ep_id. ENDWHILE. ADD 1 TO ep_id. endmethod. method GET_RANGES_ITERATOR. eo_iterator = me->ranges->get_iterator( ). endmethod. METHOD get_static_cellstyle_guid. " # issue 139 DATA: style LIKE LINE OF me->t_stylemapping1. READ TABLE me->t_stylemapping1 INTO style WITH TABLE KEY dynamic_style_guid = style-guid " no dynamic style --> look for initial guid here complete_style = ip_cstyle_complete complete_stylex = ip_cstylex_complete. IF sy-subrc <> 0. style-complete_style = ip_cstyle_complete. style-complete_stylex = ip_cstylex_complete. * CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases * IMPORTING * ev_guid_16 = style-guid. style-guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call INSERT style INTO TABLE me->t_stylemapping1. INSERT style INTO TABLE me->t_stylemapping2. ENDIF. ep_guid = style-guid. ENDMETHOD. method GET_STYLES_ITERATOR. eo_iterator = me->styles->get_iterator( ). endmethod. METHOD get_style_from_guid. DATA: lo_style TYPE REF TO zcl_excel_style, lo_iterator TYPE REF TO cl_object_collection_iterator. lo_iterator = styles->get_iterator( ). WHILE lo_iterator->has_next( ) = abap_true. lo_style ?= lo_iterator->get_next( ). IF lo_style->get_guid( ) = ip_guid. eo_style = lo_style. RETURN. ENDIF. ENDWHILE. ENDMETHOD. method GET_STYLE_INDEX_IN_STYLES. DATA: index TYPE syindex. DATA: lo_iterator TYPE REF TO cl_object_collection_iterator, lo_style TYPE REF TO zcl_excel_style. CHECK ip_guid IS NOT INITIAL. lo_iterator = me->get_styles_iterator( ). WHILE lo_iterator->has_next( ) = 'X'. ADD 1 TO index. lo_style ?= lo_iterator->get_next( ). IF lo_style->get_guid( ) = ip_guid. ep_index = index. EXIT. ENDIF. ENDWHILE. IF ep_index IS INITIAL. zcx_excel=>raise_text( 'Index not found' ). else. SUBTRACT 1 from ep_index. " In excel list starts with "0" ENDIF. endmethod. METHOD get_style_to_guid. DATA: lo_style TYPE REF TO zcl_excel_style. " # issue 139 READ TABLE me->t_stylemapping2 INTO ep_stylemapping WITH TABLE KEY guid = ip_guid. IF sy-subrc <> 0. zcx_excel=>raise_text( 'GUID not found' ). ENDIF. IF ep_stylemapping-dynamic_style_guid IS NOT INITIAL. lo_style = me->get_style_from_guid( ip_guid ). zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = lo_style CHANGING e_target = ep_stylemapping-complete_style e_targetx = ep_stylemapping-complete_stylex ). ENDIF. ENDMETHOD. method GET_THEME. eo_theme = theme. endmethod. method GET_WORKSHEETS_ITERATOR. eo_iterator = me->worksheets->get_iterator( ). endmethod. method GET_WORKSHEETS_NAME. ep_name = me->worksheets->name. endmethod. METHOD get_worksheets_size. ep_size = me->worksheets->size( ). ENDMETHOD. METHOD get_worksheet_by_index. DATA: lv_index TYPE zexcel_active_worksheet. lv_index = iv_index. eo_worksheet = me->worksheets->get( lv_index ). ENDMETHOD. METHOD get_worksheet_by_name. DATA: lv_index TYPE zexcel_active_worksheet, l_size TYPE i. l_size = get_worksheets_size( ). DO l_size TIMES. lv_index = sy-index. eo_worksheet = me->worksheets->get( lv_index ). IF eo_worksheet->get_title( ) = ip_sheet_name. RETURN. ENDIF. ENDDO. CLEAR eo_worksheet. ENDMETHOD. METHOD set_active_sheet_index. DATA: lo_worksheet TYPE REF TO zcl_excel_worksheet, lv_errormessage TYPE string. *--------------------------------------------------------------------* * Check whether worksheet exists *--------------------------------------------------------------------* lo_worksheet = me->get_worksheet_by_index( i_active_worksheet ). IF lo_worksheet IS NOT BOUND. lv_errormessage = 'Worksheet not existing'(001). zcx_excel=>raise_text( lv_errormessage ). ENDIF. me->worksheets->active_worksheet = i_active_worksheet. ENDMETHOD. METHOD set_active_sheet_index_by_name. DATA: ws_it TYPE REF TO cl_object_collection_iterator, ws TYPE REF TO zcl_excel_worksheet, lv_title TYPE zexcel_sheet_title, count TYPE i VALUE 1. ws_it = me->worksheets->get_iterator( ). WHILE ws_it->has_next( ) = abap_true. ws ?= ws_it->get_next( ). lv_title = ws->get_title( ). IF lv_title = i_worksheet_name. me->worksheets->active_worksheet = count. EXIT. ENDIF. count = count + 1. ENDWHILE. ENDMETHOD. method SET_DEFAULT_STYLE. me->default_style = ip_style. endmethod. method SET_THEME. theme = io_theme. endmethod. method STYLEMAPPING_DYNAMIC_STYLE. " # issue 139 eo_style2-dynamic_style_guid = ip_style->get_guid( ). eo_style2-guid = eo_style2-dynamic_style_guid. eo_style2-added_to_iterator = abap_true. * don't care about attributes here, since this data may change * dynamically endmethod. METHOD zif_excel_book_properties~initialize. DATA: lv_timestamp TYPE timestampl. me->zif_excel_book_properties~application = 'Microsoft Excel'. me->zif_excel_book_properties~appversion = '12.0000'. GET TIME STAMP FIELD lv_timestamp. me->zif_excel_book_properties~created = lv_timestamp. me->zif_excel_book_properties~creator = sy-uname. me->zif_excel_book_properties~description = zcl_excel=>version. me->zif_excel_book_properties~modified = lv_timestamp. me->zif_excel_book_properties~lastmodifiedby = sy-uname. ENDMETHOD. method ZIF_EXCEL_BOOK_PROTECTION~INITIALIZE. me->zif_excel_book_protection~protected = zif_excel_book_protection=>c_unprotected. me->zif_excel_book_protection~lockrevision = zif_excel_book_protection=>c_unlocked. me->zif_excel_book_protection~lockstructure = zif_excel_book_protection=>c_unlocked. me->zif_excel_book_protection~lockwindows = zif_excel_book_protection=>c_unlocked. CLEAR me->zif_excel_book_protection~workbookpassword. CLEAR me->zif_excel_book_protection~revisionspassword. endmethod. method ZIF_EXCEL_BOOK_VBA_PROJECT~SET_CODENAME. me->zif_excel_book_vba_project~codename = ip_codename. endmethod. method ZIF_EXCEL_BOOK_VBA_PROJECT~SET_CODENAME_PR. me->zif_excel_book_vba_project~codename_pr = ip_codename_pr. endmethod. method ZIF_EXCEL_BOOK_VBA_PROJECT~SET_VBAPROJECT. me->zif_excel_book_vba_project~vbaproject = ip_vbaproject. endmethod. ENDCLASS.
26.574184
120
0.72341
0367bc2994cf79b0a7c2f2a16ae03be7939f936b
1,536
abap
ABAP
codigos/conexion-ftp-desde-abap-poo/ZFTP001/ZFTP001.abap
elvisseag/SAP-ABAP
a87dd206fa9c2e460f5b4bb818e2b2736f51aef5
[ "MIT" ]
26
2018-02-22T02:57:24.000Z
2022-01-23T22:07:35.000Z
codigos/conexion-ftp-desde-abap-poo/ZFTP001/ZFTP001.abap
elvisseag/SAP-ABAP
a87dd206fa9c2e460f5b4bb818e2b2736f51aef5
[ "MIT" ]
13
2017-04-25T16:13:33.000Z
2017-11-24T11:57:49.000Z
codigos/conexion-ftp-desde-abap-poo/ZFTP001/ZFTP001.abap
elvisseag/SAP-ABAP
a87dd206fa9c2e460f5b4bb818e2b2736f51aef5
[ "MIT" ]
14
2018-08-29T16:01:06.000Z
2022-01-23T22:07:43.000Z
*&---------------------------------------------------------------------* *& Report ZFTP001 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* INCLUDE zftp001_top. "Include de elementos para el programa INCLUDE zftp001_mimp. "Include para la implementeacion de metodos y perform START-OF-SELECTION. "Inicio del programa DATA: obj TYPE REF TO actions. "Creacin del objeto que se instanciara CREATE OBJECT obj. "en nuestro metodo obj->encrypt( contrasena = passerv llave = key ). "Llamada el metodo encrypt hdl = obj->connect( usuario = user contrasena = password "Llamada al metodo connect la cual ipdestino = ip destsap = dest ). "almacenamos el resultado en una varible CONCATENATE 'cd' '-ruta de la carpeta-' INTO wa_commands-line SEPARATED BY space. obj->append( line = wa_commands-line ). "Llamada al metodo que agrega lista de comandos obj->append( line = 'dir' ). "" mtab_data = obj->send_comm( encargado = hdl index = 0 comandos = commands ). "Llamada al metodo que hace el "envio de Comandos via FTP LOOP AT mtab_data INTO wa_mtab. "Visualizamos el contenido de la ejecucion WRITE:/ wa_mtab-line. "de nuestro comando FTP ENDLOOP. obj->close( hdl ). "Llamada al metodo que cierra la coneion FTP END-OF-SELECTION.
42.666667
110
0.546224
036a36d93f7485bf39ba1e12f417366b86e81dbb
888
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ctp_sh_to_dl.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
3
2021-07-08T07:16:53.000Z
2021-10-18T07:56:18.000Z
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ctp_sh_to_dl.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zgtt_mia.fugr.zgtt_mia_ctp_sh_to_dl.abap
SAP-samples/logistics-business-network-gtt-standardapps-samples
eea4aae1bb74112a3a34f14c6f94f496ca708ea3
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
FUNCTION zgtt_mia_ctp_sh_to_dl. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(IS_SHIPMENT) TYPE CXSHIPMENT *"---------------------------------------------------------------------- TRY. DATA(lo_head) = zcl_gtt_mia_ctp_snd_sh_to_dlh=>get_instance( ). DATA(lo_ship) = NEW zcl_gtt_mia_ctp_shipment_data( is_shipment = is_shipment ). " Delivery header lo_head->prepare_idoc_data( io_ship_data = lo_ship ). lo_head->send_idoc_data( ). CATCH cx_udm_message INTO DATA(lo_udm_message). zcl_gtt_mia_tools=>log_exception( EXPORTING io_udm_message = lo_udm_message iv_object = zif_gtt_mia_ef_constants=>cs_logs-object-shipment_ctp iv_subobject = zif_gtt_mia_ef_constants=>cs_logs-subobject-shipment_ctp ). ENDTRY. ENDFUNCTION.
35.52
86
0.597973
036cb8859aee821cf7e416b2afad579b6a3fb10a
386
abap
ABAP
src/ydk_alv.fugr.conversion_exit_ydk19_output.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
src/ydk_alv.fugr.conversion_exit_ydk19_output.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
src/ydk_alv.fugr.conversion_exit_ydk19_output.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
FUNCTION CONVERSION_EXIT_YDK19_OUTPUT . *"-------------------------------------------------------------------- *"*"Локальный интерфейс: *" IMPORTING *" REFERENCE(INPUT) *" EXPORTING *" REFERENCE(OUTPUT) *"-------------------------------------------------------------------- * see FM YDK_CONVERSION_EXIT_REGISTER PERFORM output USING '19' input CHANGING output. ENDFUNCTION.
32.166667
70
0.476684
0372632e144510e0900d89e7a2c5a87ebe061e9d
1,702
abap
ABAP
src/ui/zcl_abapgit_ui_injector.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
317
2020-09-25T19:50:59.000Z
2022-03-29T22:59:01.000Z
src/ui/zcl_abapgit_ui_injector.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
1,114
2020-09-24T07:44:36.000Z
2022-03-31T18:01:19.000Z
src/ui/zcl_abapgit_ui_injector.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
167
2020-09-24T18:31:37.000Z
2022-03-24T10:07:04.000Z
CLASS zcl_abapgit_ui_injector DEFINITION PUBLIC CREATE PRIVATE . PUBLIC SECTION. CLASS-METHODS set_popups IMPORTING !ii_popups TYPE REF TO zif_abapgit_popups . CLASS-METHODS set_tag_popups IMPORTING !ii_tag_popups TYPE REF TO zif_abapgit_tag_popups . CLASS-METHODS set_frontend_services IMPORTING !ii_fe_serv TYPE REF TO zif_abapgit_frontend_services . CLASS-METHODS set_gui_services IMPORTING !ii_gui_services TYPE REF TO zif_abapgit_gui_services . CLASS-METHODS get_dummy_gui_services RETURNING VALUE(ri_gui_services) TYPE REF TO zif_abapgit_gui_services . CLASS-METHODS set_html_viewer IMPORTING !ii_html_viewer TYPE REF TO zif_abapgit_html_viewer . CLASS-METHODS set_gui_jumper IMPORTING !ii_gui_jumper TYPE REF TO zif_abapgit_gui_jumper . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_abapgit_ui_injector IMPLEMENTATION. METHOD get_dummy_gui_services. ri_gui_services = lcl_gui_services_dummy=>create( ). ENDMETHOD. METHOD set_frontend_services. zcl_abapgit_ui_factory=>gi_fe_services = ii_fe_serv. ENDMETHOD. METHOD set_gui_jumper. zcl_abapgit_ui_factory=>gi_gui_jumper = ii_gui_jumper. ENDMETHOD. METHOD set_gui_services. zcl_abapgit_ui_factory=>gi_gui_services = ii_gui_services. ENDMETHOD. METHOD set_html_viewer. zcl_abapgit_ui_factory=>gi_html_viewer = ii_html_viewer. ENDMETHOD. METHOD set_popups. zcl_abapgit_ui_factory=>gi_popups = ii_popups. ENDMETHOD. METHOD set_tag_popups. zcl_abapgit_ui_factory=>gi_tag_popups = ii_tag_popups. ENDMETHOD. ENDCLASS.
20.023529
69
0.752056
0374e91a604e2201cffc19d81401fcdb5330a748
2,046
abap
ABAP
src/zabapgit_test_clif.prog.abap
mbtools/abapGIT-merged
39357fa732724a2fc3587f3a316d2918e31bc977
[ "MIT" ]
null
null
null
src/zabapgit_test_clif.prog.abap
mbtools/abapGIT-merged
39357fa732724a2fc3587f3a316d2918e31bc977
[ "MIT" ]
null
null
null
src/zabapgit_test_clif.prog.abap
mbtools/abapGIT-merged
39357fa732724a2fc3587f3a316d2918e31bc977
[ "MIT" ]
null
null
null
************************************************************************ * ZABAPGIT_TEST_CLIF * abapGIT test of CLIF user exit ************************************************************************ REPORT zabapgit_test_clif. TABLES: seoclass. INCLUDE zabapgit_user_exit. SELECT-OPTIONS so_class FOR seoclass-clsname OBLIGATORY. DATA: gr_exit TYPE REF TO zcl_abapgit_user_exit, gt_classes TYPE TABLE OF seoclsname, gs_class_key TYPE seoclskey, gv_source TYPE string, gt_source TYPE zif_abapgit_definitions=>ty_string_tt, g_msg TYPE string, g_word TYPE string, g_line TYPE i, g_text_1 TYPE sy-msgv1, g_text_2 TYPE sy-msgv2. START-OF-SELECTION. CREATE OBJECT gr_exit. SELECT clsname FROM seoclass INTO TABLE gt_classes WHERE clsname IN so_class ORDER BY PRIMARY KEY. LOOP AT gt_classes INTO gs_class_key-clsname. WRITE: / gs_class_key-clsname COLOR COL_HEADING. SKIP. TRY. CALL METHOD gr_exit->zif_abapgit_exit~custom_serialize_abap_clif EXPORTING is_class_key = gs_class_key RECEIVING rt_source = gt_source. CATCH cx_root. WRITE: / 'Error' COLOR COL_NEGATIVE, sy-msgv1, sy-msgv2, sy-msgv3, sy-msgv4. SKIP. CONTINUE. ENDTRY. WRITE: / 'Success' COLOR COL_POSITIVE. SKIP. * SYNTAX-CHECK FOR gt_source "PROGRAM gs_class_key-clsname * MESSAGE g_msg LINE g_line WORD g_word. * IF sy-subrc = 0. * WRITE: / 'Success' COLOR COL_POSITIVE. * SKIP. * ELSE. * WRITE g_line TO g_text_2 LEFT-JUSTIFIED. * CONCATENATE 'syntax error:' g_msg INTO g_text_1 * SEPARATED BY space. * CONCATENATE 'Line:' g_text_2 'Token:' g_word INTO g_text_2 * SEPARATED BY space. * WRITE: / g_text_1 COLOR COL_NEGATIVE, g_text_2 COLOR COL_NEGATIVE. * ENDIF. * LOOP AT gt_source INTO gv_source. * IF gv_source IS INITIAL. * SKIP. * ELSE. * WRITE / gv_source. * ENDIF. * ENDLOOP. ENDLOOP.
26.571429
84
0.619746
0375a61951e82ccd90d92186139d5a7eb5bc44e6
928
abap
ABAP
src/zcl_ref_entity.clas.abap
alaible/dbg_value_statement
b28f7292be763f01bc231ddd9a9ff3b6aa845230
[ "MIT" ]
1
2022-01-12T06:45:24.000Z
2022-01-12T06:45:24.000Z
src/zcl_ref_entity.clas.abap
alaible/dbg_value_statement
b28f7292be763f01bc231ddd9a9ff3b6aa845230
[ "MIT" ]
2
2022-01-12T06:40:57.000Z
2022-01-14T07:29:51.000Z
src/zcl_ref_entity.clas.abap
alaible/dbg_value_statement
b28f7292be763f01bc231ddd9a9ff3b6aa845230
[ "MIT" ]
null
null
null
CLASS zcl_ref_entity DEFINITION PUBLIC INHERITING FROM zcl_simple_entity CREATE PUBLIC. PUBLIC SECTION. METHODS: constructor IMPORTING iv_key TYPE string iv_type TYPE string iv_typekind type c iv_indent type i, get_node_type REDEFINITION, contains_reference REDEFINITION, get_content REDEFINITION. PROTECTED SECTION. DATA: mv_type TYPE string. ENDCLASS. CLASS ZCL_REF_ENTITY IMPLEMENTATION. METHOD constructor. super->constructor( iv_typekind = iv_typekind iv_indent = iv_indent ). me->mv_key = iv_key. me->mv_type = iv_type. ENDMETHOD. METHOD contains_reference. rv_contains_ref = abap_true. ENDMETHOD. METHOD get_content. rt_content = VALUE #( ( |{ me->mv_key } = REF_FOR::{ me->mv_type }| ) ). ENDMETHOD. METHOD get_node_type. rv_node_type = 'reference'. ENDMETHOD. ENDCLASS.
22.095238
87
0.676724
037679749279729eccfef4216c4e527bdcc66015
13,083
abap
ABAP
src/ui/zcl_abapgit_gui_page_commit.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_commit.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_commit.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_commit DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_page FINAL CREATE PUBLIC . PUBLIC SECTION. CONSTANTS: BEGIN OF c_action, commit_post TYPE string VALUE 'commit_post', commit_cancel TYPE string VALUE 'commit_cancel', END OF c_action . METHODS constructor IMPORTING io_repo TYPE REF TO zcl_abapgit_repo_online io_stage TYPE REF TO zcl_abapgit_stage RAISING zcx_abapgit_exception. METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION . PROTECTED SECTION. CLASS-METHODS parse_commit_request IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_commit) TYPE zif_abapgit_services_git=>ty_commit_fields RAISING zcx_abapgit_exception . METHODS render_content REDEFINITION . PRIVATE SECTION. DATA mo_repo TYPE REF TO zcl_abapgit_repo_online . DATA mo_stage TYPE REF TO zcl_abapgit_stage . DATA ms_commit TYPE zif_abapgit_services_git=>ty_commit_fields . METHODS render_menu RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_stage RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_form RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_text_input IMPORTING !iv_name TYPE string !iv_label TYPE string !iv_value TYPE string OPTIONAL !iv_max_length TYPE string OPTIONAL RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS get_comment_default RETURNING VALUE(rv_text) TYPE string . METHODS get_comment_object IMPORTING !it_stage TYPE zif_abapgit_definitions=>ty_stage_tt RETURNING VALUE(rv_text) TYPE string . METHODS get_comment_file IMPORTING !it_stage TYPE zif_abapgit_definitions=>ty_stage_tt RETURNING VALUE(rv_text) TYPE string . METHODS render_scripts RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_COMMIT IMPLEMENTATION. METHOD constructor. super->constructor( ). mo_repo = io_repo. mo_stage = io_stage. ms_control-page_title = 'Commit'. ENDMETHOD. METHOD get_comment_default. DATA: lo_settings TYPE REF TO zcl_abapgit_settings, lt_stage TYPE zif_abapgit_definitions=>ty_stage_tt. " Get setting for default comment text lo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ). rv_text = lo_settings->get_commitmsg_comment_default( ). IF rv_text IS INITIAL. RETURN. ENDIF. " Determine texts for scope of commit lt_stage = mo_stage->get_all( ). REPLACE '$FILE' IN rv_text WITH get_comment_file( lt_stage ). REPLACE '$OBJECT' IN rv_text WITH get_comment_object( lt_stage ). ENDMETHOD. METHOD get_comment_file. DATA: lv_count TYPE i, lv_value TYPE c LENGTH 10. FIELD-SYMBOLS: <ls_stage> LIKE LINE OF it_stage. lv_count = lines( it_stage ). IF lv_count = 1. " Just one file so we use the file name READ TABLE it_stage ASSIGNING <ls_stage> INDEX 1. ASSERT sy-subrc = 0. rv_text = <ls_stage>-file-filename. ELSE. " For multiple file we use the count instead WRITE lv_count TO lv_value LEFT-JUSTIFIED. CONCATENATE lv_value 'files' INTO rv_text SEPARATED BY space. ENDIF. ENDMETHOD. METHOD get_comment_object. DATA: lv_count TYPE i, lv_value TYPE c LENGTH 10, ls_item TYPE zif_abapgit_definitions=>ty_item, lt_items TYPE zif_abapgit_definitions=>ty_items_tt. FIELD-SYMBOLS: <ls_stage> LIKE LINE OF it_stage. " Get objects LOOP AT it_stage ASSIGNING <ls_stage>. CLEAR ls_item. ls_item-obj_type = <ls_stage>-status-obj_type. ls_item-obj_name = <ls_stage>-status-obj_name. COLLECT ls_item INTO lt_items. ENDLOOP. lv_count = lines( lt_items ). IF lv_count = 1. " Just one object so we use the object name READ TABLE lt_items INTO ls_item INDEX 1. ASSERT sy-subrc = 0. CONCATENATE ls_item-obj_type ls_item-obj_name INTO rv_text SEPARATED BY space. ELSE. " For multiple objects we use the count instead WRITE lv_count TO lv_value LEFT-JUSTIFIED. CONCATENATE lv_value 'objects' INTO rv_text SEPARATED BY space. ENDIF. ENDMETHOD. METHOD parse_commit_request. DATA lo_map TYPE REF TO zcl_abapgit_string_map. lo_map = ii_event->form_data( iv_upper_cased = abap_true ). lo_map->to_abap( CHANGING cs_container = rs_commit ). REPLACE ALL OCCURRENCES OF zif_abapgit_definitions=>c_crlf IN rs_commit-body WITH zif_abapgit_definitions=>c_newline. 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_package = abap_false iv_branch = mo_repo->get_branch_name( ) ) ). ri_html->add( render_menu( ) ). ri_html->add( render_form( ) ). ri_html->add( render_stage( ) ). ri_html->add( '</div>' ). register_deferred_script( render_scripts( ) ). ENDMETHOD. METHOD render_form. CONSTANTS: lc_body_col_max TYPE i VALUE 150. DATA: li_user TYPE REF TO zif_abapgit_persist_user. DATA: lv_user TYPE string. DATA: lv_email TYPE string. DATA: lv_s_param TYPE string. DATA: lo_settings TYPE REF TO zcl_abapgit_settings. DATA: lv_body_size TYPE i. DATA: lv_comment TYPE string. DATA: lv_body TYPE string. DATA: lv_author_name TYPE string. DATA: lv_author_email TYPE string. * see https://git-scm.com/book/ch5-2.html * commit messages should be max 50 characters * body should wrap at 72 characters li_user = zcl_abapgit_persistence_user=>get_instance( ). lv_user = li_user->get_repo_git_user_name( mo_repo->get_url( ) ). IF lv_user IS INITIAL. lv_user = li_user->get_default_git_user_name( ). ENDIF. IF lv_user IS INITIAL. " get default from user master record lv_user = zcl_abapgit_user_master_record=>get_instance( sy-uname )->get_name( ). ENDIF. lv_email = li_user->get_repo_git_user_email( mo_repo->get_url( ) ). IF lv_email IS INITIAL. lv_email = li_user->get_default_git_user_email( ). ENDIF. IF lv_email IS INITIAL. " get default from user master record lv_email = zcl_abapgit_user_master_record=>get_instance( sy-uname )->get_email( ). ENDIF. IF ms_commit IS NOT INITIAL. lv_user = ms_commit-committer_name. lv_email = ms_commit-committer_email. lv_comment = ms_commit-comment. lv_body = ms_commit-body. lv_author_name = ms_commit-author_name. lv_author_email = ms_commit-author_email. ENDIF. IF lv_comment IS INITIAL. lv_comment = get_comment_default( ). ENDIF. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div class="form-container">' ). ri_html->add( '<form id="commit_form" class="aligned-form"' && ' method="post" action="sapevent:commit_post">' ). ri_html->add( render_text_input( iv_name = 'committer_name' iv_label = 'Committer Name' iv_value = lv_user ) ). ri_html->add( render_text_input( iv_name = 'committer_email' iv_label = 'Committer E-mail' iv_value = lv_email ) ). lo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ). lv_s_param = lo_settings->get_commitmsg_comment_length( ). ri_html->add( render_text_input( iv_name = 'comment' iv_label = 'Comment' iv_value = lv_comment iv_max_length = lv_s_param ) ). ri_html->add( '<div class="row">' ). ri_html->add( '<label for="c-body">Body</label>' ). lv_body_size = lo_settings->get_commitmsg_body_size( ). IF lv_body_size > lc_body_col_max. lv_body_size = lc_body_col_max. ENDIF. ri_html->add( |<textarea id="c-body" name="body" rows="10" cols="| && |{ lv_body_size }">{ lv_body }</textarea>| ). ri_html->add( '<input type="submit" class="hidden-submit">' ). ri_html->add( '</div>' ). ri_html->add( '<div class="row">' ). ri_html->add( '<span class="cell"></span>' ). ri_html->add( '<span class="cell sub-title">Optionally,' && ' specify author (same as committer by default)</span>' ). ri_html->add( '</div>' ). ri_html->add( render_text_input( iv_name = 'author_name' iv_label = 'Author Name' iv_value = lv_author_name ) ). ri_html->add( render_text_input( iv_name = 'author_email' iv_label = 'Author E-mail' iv_value = lv_author_email ) ). ri_html->add( '</form>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_menu. DATA lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar. CREATE OBJECT ri_html TYPE zcl_abapgit_html. CREATE OBJECT lo_toolbar. lo_toolbar->add( iv_act = 'submitFormById(''commit_form'');' iv_txt = 'Commit' iv_typ = zif_abapgit_html=>c_action_type-onclick iv_opt = zif_abapgit_html=>c_html_opt-strong ). lo_toolbar->add( iv_act = c_action-commit_cancel iv_txt = 'Cancel' iv_opt = zif_abapgit_html=>c_html_opt-cancel ). ri_html->add( '<div class="paddings">' ). ri_html->add( lo_toolbar->render( ) ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_scripts. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ). ri_html->add( 'setInitialFocus("comment");' ). ENDMETHOD. METHOD render_stage. DATA: lt_stage TYPE zif_abapgit_definitions=>ty_stage_tt. FIELD-SYMBOLS: <ls_stage> LIKE LINE OF lt_stage. CREATE OBJECT ri_html TYPE zcl_abapgit_html. lt_stage = mo_stage->get_all( ). ri_html->add( '<table class="stage_tab">' ). ri_html->add( '<thead>' ). ri_html->add( '<tr>' ). ri_html->add( '<th colspan="3">Staged Files</th>' ). ri_html->add( '</tr>' ). ri_html->add( '</thead>' ). ri_html->add( '<tbody>' ). LOOP AT lt_stage ASSIGNING <ls_stage>. ri_html->add( '<tr>' ). ri_html->add( '<td>' ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = <ls_stage>-status-lstate iv_rstate = <ls_stage>-status-rstate ) ). ri_html->add( '</td>' ). ri_html->add( '<td class="method">' ). ri_html->add( |<b>{ zcl_abapgit_stage=>method_description( <ls_stage>-method ) }</b>| ). ri_html->add( '</td>' ). ri_html->add( '<td>' ). ri_html->add( <ls_stage>-file-path && <ls_stage>-file-filename ). ri_html->add( '</td>' ). ri_html->add( '</tr>' ). ENDLOOP. ri_html->add( '</tbody>' ). ri_html->add( '</table>' ). ENDMETHOD. METHOD render_text_input. DATA lv_attrs TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF iv_value IS NOT INITIAL AND iv_max_length IS NOT INITIAL. lv_attrs = | value="{ iv_value }" maxlength="{ iv_max_length }"|. ELSEIF iv_value IS NOT INITIAL. lv_attrs = | value="{ iv_value }"|. ELSEIF iv_max_length IS NOT INITIAL. lv_attrs = | maxlength="{ iv_max_length }"|. ENDIF. ri_html->add( '<div class="row">' ). ri_html->add( |<label for="{ iv_name }">{ iv_label }</label>| ). ri_html->add( |<input id="{ iv_name }" name="{ iv_name }" type="text"{ lv_attrs }>| ). ri_html->add( '</div>' ). ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. CASE ii_event->mv_action. WHEN c_action-commit_post. ms_commit = parse_commit_request( ii_event ). ms_commit-repo_key = mo_repo->get_key( ). zcl_abapgit_services_git=>commit( is_commit = ms_commit io_repo = mo_repo io_stage = mo_stage ). MESSAGE 'Commit was successful' TYPE 'S'. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back_to_bookmark. WHEN c_action-commit_cancel. 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.
29.334081
96
0.641061
03796c408191d86269f99a305c54be1fa1ffed6d
1,899
abap
ABAP
src/gui/cl_salv_table.clas.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
src/gui/cl_salv_table.clas.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
src/gui/cl_salv_table.clas.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
CLASS cl_salv_table DEFINITION PUBLIC. PUBLIC SECTION. CLASS-METHODS factory EXPORTING r_salv_table TYPE any CHANGING t_table TYPE any. METHODS get_selections RETURNING VALUE(val) TYPE REF TO cl_salv_table. METHODS set_selection_mode IMPORTING val TYPE any. METHODS close_screen. METHODS refresh. METHODS display. METHODS set_screen_status IMPORTING pfstatus TYPE any report TYPE any. METHODS set_screen_popup IMPORTING start_column TYPE i end_column TYPE i start_line TYPE i end_line TYPE i. METHODS get_event RETURNING VALUE(val) TYPE REF TO any. METHODS get_display_settings RETURNING VALUE(val) TYPE REF TO cl_salv_table. METHODS set_striped_pattern IMPORTING val TYPE any. METHODS set_list_header IMPORTING val TYPE any. METHODS set_top_of_list IMPORTING val TYPE any. METHODS get_columns RETURNING VALUE(val) TYPE REF TO cl_salv_table. ENDCLASS. CLASS cl_salv_table IMPLEMENTATION. METHOD set_selection_mode. ASSERT 1 = 'todo'. ENDMETHOD. METHOD set_striped_pattern. ASSERT 1 = 'todo'. ENDMETHOD. METHOD set_list_header. ASSERT 1 = 'todo'. ENDMETHOD. METHOD factory. ASSERT 1 = 'todo'. ENDMETHOD. METHOD get_selections. ASSERT 1 = 'todo'. ENDMETHOD. METHOD close_screen. ASSERT 1 = 'todo'. ENDMETHOD. METHOD refresh. ASSERT 1 = 'todo'. ENDMETHOD. METHOD display. ASSERT 1 = 'todo'. ENDMETHOD. METHOD set_screen_status. ASSERT 1 = 'TODO'. ENDMETHOD. METHOD set_screen_popup. ASSERT 1 = 'TODO'. ENDMETHOD. METHOD get_event. ASSERT 1 = 'TODO'. ENDMETHOD. METHOD get_display_settings. ASSERT 1 = 'TODO'. ENDMETHOD. METHOD set_top_of_list. ASSERT 1 = 'TODO'. ENDMETHOD. METHOD get_columns. ASSERT 1 = 'TODO'. ENDMETHOD. ENDCLASS.
21.579545
74
0.691943
037c6ccbaa70fbb421cdc3a3fd1778f19e84a107
17,136
abap
ABAP
src/ui/zcl_abapgit_gui_page_commit.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
317
2020-09-25T19:50:59.000Z
2022-03-29T22:59:01.000Z
src/ui/zcl_abapgit_gui_page_commit.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
1,114
2020-09-24T07:44:36.000Z
2022-03-31T18:01:19.000Z
src/ui/zcl_abapgit_gui_page_commit.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
167
2020-09-24T18:31:37.000Z
2022-03-24T10:07:04.000Z
CLASS zcl_abapgit_gui_page_commit DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_component FINAL CREATE PRIVATE. PUBLIC SECTION. INTERFACES zif_abapgit_gui_event_handler. INTERFACES zif_abapgit_gui_renderable. CLASS-METHODS create IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo_online !io_stage TYPE REF TO zcl_abapgit_stage !iv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result DEFAULT zif_abapgit_definitions=>c_sci_result-no_run RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception. METHODS constructor IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo_online !io_stage TYPE REF TO zcl_abapgit_stage !iv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_id, committer TYPE string VALUE 'committer', committer_name TYPE string VALUE 'committer_name', committer_email TYPE string VALUE 'committer_email', message TYPE string VALUE 'message', comment TYPE string VALUE 'comment', body TYPE string VALUE 'body', author TYPE string VALUE 'author', author_name TYPE string VALUE 'author_name', author_email TYPE string VALUE 'author_email', new_branch_name TYPE string VALUE 'new_branch_name', END OF c_id. CONSTANTS: BEGIN OF c_event, commit TYPE string VALUE 'commit', END OF c_event. DATA mo_form TYPE REF TO zcl_abapgit_html_form. DATA mo_form_data TYPE REF TO zcl_abapgit_string_map. DATA mo_form_util TYPE REF TO zcl_abapgit_html_form_utils. DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map. DATA mo_settings TYPE REF TO zcl_abapgit_settings. DATA mo_repo TYPE REF TO zcl_abapgit_repo_online. DATA mo_stage TYPE REF TO zcl_abapgit_stage. DATA mt_stage TYPE zif_abapgit_definitions=>ty_stage_tt. DATA ms_commit TYPE zif_abapgit_services_git=>ty_commit_fields. DATA mv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result. METHODS render_stage_summary RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception. METHODS render_stage_details RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception. METHODS validate_form IMPORTING !io_form_data TYPE REF TO zcl_abapgit_string_map RETURNING VALUE(ro_validation_log) TYPE REF TO zcl_abapgit_string_map RAISING zcx_abapgit_exception. METHODS get_form_schema RETURNING VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form. METHODS get_defaults RAISING zcx_abapgit_exception. METHODS get_committer_name RETURNING VALUE(rv_user) TYPE string RAISING zcx_abapgit_exception. METHODS get_committer_email RETURNING VALUE(rv_email) TYPE string RAISING zcx_abapgit_exception. METHODS get_comment_default RETURNING VALUE(rv_text) TYPE string. METHODS get_comment_object IMPORTING !it_stage TYPE zif_abapgit_definitions=>ty_stage_tt RETURNING VALUE(rv_text) TYPE string. METHODS get_comment_file IMPORTING !it_stage TYPE zif_abapgit_definitions=>ty_stage_tt RETURNING VALUE(rv_text) TYPE string. METHODS is_valid_email IMPORTING iv_email TYPE string RETURNING VALUE(rv_valid) TYPE abap_bool. METHODS branch_name_to_internal IMPORTING iv_branch_name TYPE string RETURNING VALUE(rv_new_branch_name) TYPE string. ENDCLASS. CLASS zcl_abapgit_gui_page_commit IMPLEMENTATION. METHOD branch_name_to_internal. rv_new_branch_name = zcl_abapgit_git_branch_list=>complete_heads_branch_name( zcl_abapgit_git_branch_list=>normalize_branch_name( iv_branch_name ) ). ENDMETHOD. METHOD constructor. super->constructor( ). mo_repo = io_repo. mo_stage = io_stage. mt_stage = mo_stage->get_all( ). mv_sci_result = iv_sci_result. " Get settings from DB mo_settings = zcl_abapgit_persist_factory=>get_settings( )->read( ). CREATE OBJECT mo_validation_log. CREATE OBJECT mo_form_data. mo_form = get_form_schema( ). mo_form_util = zcl_abapgit_html_form_utils=>create( mo_form ). ENDMETHOD. METHOD create. DATA lo_component TYPE REF TO zcl_abapgit_gui_page_commit. CREATE OBJECT lo_component EXPORTING io_repo = io_repo io_stage = io_stage iv_sci_result = iv_sci_result. ri_page = zcl_abapgit_gui_page_hoc=>create( iv_page_title = 'Commit' ii_child_component = lo_component ). ENDMETHOD. METHOD get_comment_default. rv_text = mo_settings->get_commitmsg_comment_default( ). IF rv_text IS INITIAL. RETURN. ENDIF. REPLACE '$FILE' IN rv_text WITH get_comment_file( mt_stage ). REPLACE '$OBJECT' IN rv_text WITH get_comment_object( mt_stage ). ENDMETHOD. METHOD get_comment_file. DATA: lv_count TYPE i, lv_value TYPE c LENGTH 10. FIELD-SYMBOLS <ls_stage> LIKE LINE OF it_stage. lv_count = lines( it_stage ). IF lv_count = 1. " Just one file so we use the file name READ TABLE it_stage ASSIGNING <ls_stage> INDEX 1. ASSERT sy-subrc = 0. rv_text = <ls_stage>-file-filename. ELSE. " For multiple file we use the count instead WRITE lv_count TO lv_value LEFT-JUSTIFIED. CONCATENATE lv_value 'files' INTO rv_text SEPARATED BY space. ENDIF. ENDMETHOD. METHOD get_comment_object. DATA: lv_count TYPE i, lv_value TYPE c LENGTH 10, ls_item TYPE zif_abapgit_definitions=>ty_item, lt_items TYPE zif_abapgit_definitions=>ty_items_tt. FIELD-SYMBOLS <ls_stage> LIKE LINE OF it_stage. " Get objects LOOP AT it_stage ASSIGNING <ls_stage>. CLEAR ls_item. ls_item-obj_type = <ls_stage>-status-obj_type. ls_item-obj_name = <ls_stage>-status-obj_name. COLLECT ls_item INTO lt_items. ENDLOOP. lv_count = lines( lt_items ). IF lv_count = 1. " Just one object so we use the object name READ TABLE lt_items INTO ls_item INDEX 1. ASSERT sy-subrc = 0. CONCATENATE ls_item-obj_type ls_item-obj_name INTO rv_text SEPARATED BY space. ELSE. " For multiple objects we use the count instead WRITE lv_count TO lv_value LEFT-JUSTIFIED. CONCATENATE lv_value 'objects' INTO rv_text SEPARATED BY space. ENDIF. ENDMETHOD. METHOD get_committer_email. DATA li_user TYPE REF TO zif_abapgit_persist_user. li_user = zcl_abapgit_persistence_user=>get_instance( ). rv_email = li_user->get_repo_git_user_email( mo_repo->get_url( ) ). IF rv_email IS INITIAL. rv_email = li_user->get_default_git_user_email( ). ENDIF. IF rv_email IS INITIAL. " get default from user record rv_email = zcl_abapgit_user_record=>get_instance( sy-uname )->get_email( ). ENDIF. ENDMETHOD. METHOD get_committer_name. DATA li_user TYPE REF TO zif_abapgit_persist_user. li_user = zcl_abapgit_persistence_user=>get_instance( ). rv_user = li_user->get_repo_git_user_name( mo_repo->get_url( ) ). IF rv_user IS INITIAL. rv_user = li_user->get_default_git_user_name( ). ENDIF. IF rv_user IS INITIAL. " get default from user record rv_user = zcl_abapgit_user_record=>get_instance( sy-uname )->get_name( ). ENDIF. ENDMETHOD. METHOD get_defaults. ms_commit-committer_name = get_committer_name( ). ms_commit-committer_email = get_committer_email( ). ms_commit-comment = get_comment_default( ). " Committer mo_form_data->set( iv_key = c_id-committer_name iv_val = ms_commit-committer_name ). mo_form_data->set( iv_key = c_id-committer_email iv_val = ms_commit-committer_email ). " Message mo_form_data->set( iv_key = c_id-comment iv_val = ms_commit-comment ). ENDMETHOD. METHOD get_form_schema. DATA: lv_commitmsg_comment_length TYPE i. ro_form = zcl_abapgit_html_form=>create( iv_form_id = 'commit-form' iv_help_page = 'https://docs.abapgit.org/guide-stage-commit.html' ). lv_commitmsg_comment_length = mo_settings->get_commitmsg_comment_length( ). ro_form->text( iv_name = c_id-comment iv_label = 'Comment' iv_required = abap_true iv_max = lv_commitmsg_comment_length iv_placeholder = |Add a mandatory comment with max { lv_commitmsg_comment_length } characters| )->textarea( iv_name = c_id-body iv_label = 'Body' iv_rows = 6 iv_cols = mo_settings->get_commitmsg_body_size( ) iv_placeholder = 'Add an optional description...' )->text( iv_name = c_id-committer_name iv_label = 'Committer Name' iv_required = abap_true )->text( iv_name = c_id-committer_email iv_label = 'Committer Email' iv_required = abap_true ). IF mo_settings->get_commitmsg_hide_author( ) IS INITIAL. ro_form->text( iv_name = c_id-author_name iv_label = 'Author Name' iv_placeholder = 'Optionally, specify an author (same as committer by default)' )->text( iv_name = c_id-author_email iv_label = 'Author Email' ). ENDIF. ro_form->text( iv_name = c_id-new_branch_name iv_label = 'New Branch Name' iv_placeholder = 'Optionally, enter a new branch name for this commit' iv_condense = abap_true ). ro_form->command( iv_label = 'Commit' iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main iv_action = c_event-commit )->command( iv_label = 'Back' iv_action = zif_abapgit_definitions=>c_action-go_back ). ENDMETHOD. METHOD is_valid_email. " Email address validation (RFC 5322) " https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s01.html CONSTANTS lc_email_regex TYPE string VALUE '[\w!#$%&*+/=?`{|}~^-]+(?:\.[\w!#$%&*+/=?`{|}~^-]+)*@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,6}'. IF iv_email IS INITIAL. rv_valid = abap_true. ELSE. FIND REGEX lc_email_regex IN iv_email. rv_valid = boolc( sy-subrc = 0 ). ENDIF. ENDMETHOD. METHOD render_stage_details. FIELD-SYMBOLS <ls_stage> LIKE LINE OF mt_stage. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<table class="stage_tab">' ). ri_html->add( '<thead>' ). ri_html->add( '<tr>' ). ri_html->add( '<th colspan="3">Staged Files (See <a href="#top">Summary</a> Above)</th>' ). ri_html->add( '</tr>' ). ri_html->add( '</thead>' ). ri_html->add( '<tbody>' ). LOOP AT mt_stage ASSIGNING <ls_stage>. ri_html->add( '<tr>' ). ri_html->add( '<td>' ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = <ls_stage>-status-lstate iv_rstate = <ls_stage>-status-rstate ) ). ri_html->add( '</td>' ). ri_html->add( '<td class="method">' ). ri_html->add( zcl_abapgit_stage=>method_description( <ls_stage>-method ) ). ri_html->add( '</td>' ). ri_html->add( '<td>' ). ri_html->add( <ls_stage>-file-path && <ls_stage>-file-filename ). ri_html->add( '</td>' ). ri_html->add( '</tr>' ). ENDLOOP. ri_html->add( '</tbody>' ). ri_html->add( '</table>' ). ENDMETHOD. METHOD render_stage_summary. DATA: BEGIN OF ls_sum, method TYPE string, count TYPE i, END OF ls_sum, lt_sum LIKE STANDARD TABLE OF ls_sum WITH DEFAULT KEY. FIELD-SYMBOLS <ls_stage> LIKE LINE OF mt_stage. CREATE OBJECT ri_html TYPE zcl_abapgit_html. LOOP AT mt_stage ASSIGNING <ls_stage>. ls_sum-method = <ls_stage>-method. ls_sum-count = 1. COLLECT ls_sum INTO lt_sum. ENDLOOP. ri_html->add( 'Stage Summary: ' ). READ TABLE lt_sum INTO ls_sum WITH TABLE KEY method = zif_abapgit_definitions=>c_method-add. IF sy-subrc = 0. ri_html->add( |<span class="diff_banner diff_ins" title="add">+ { ls_sum-count }</span>| ). ENDIF. READ TABLE lt_sum INTO ls_sum WITH TABLE KEY method = zif_abapgit_definitions=>c_method-rm. IF sy-subrc = 0. ri_html->add( |<span class="diff_banner diff_del" title="remove">- { ls_sum-count }</span>| ). ENDIF. READ TABLE lt_sum INTO ls_sum WITH TABLE KEY method = zif_abapgit_definitions=>c_method-ignore. IF sy-subrc = 0. ri_html->add( |<span class="diff_banner diff_upd" title="ignore">~ { ls_sum-count }</span>| ). ENDIF. IF lines( mt_stage ) = 1. ri_html->add( 'file' ). ELSE. ri_html->add( 'files' ). ENDIF. ri_html->add( '(See <a href="#stage-details">Details</a> Below)' ). ENDMETHOD. METHOD validate_form. DATA: lt_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt, lv_new_branch_name TYPE string. ro_validation_log = mo_form_util->validate( io_form_data ). IF is_valid_email( io_form_data->get( c_id-committer_email ) ) = abap_false. ro_validation_log->set( iv_key = c_id-committer_email iv_val = |Invalid email address| ). ENDIF. IF is_valid_email( io_form_data->get( c_id-author_email ) ) = abap_false. ro_validation_log->set( iv_key = c_id-author_email iv_val = |Invalid email address| ). ENDIF. lv_new_branch_name = io_form_data->get( c_id-new_branch_name ). IF lv_new_branch_name IS NOT INITIAL. " check if branch already exists lt_branches = zcl_abapgit_git_transport=>branches( mo_repo->get_url( ) )->get_branches_only( ). READ TABLE lt_branches TRANSPORTING NO FIELDS WITH TABLE KEY name_key COMPONENTS name = branch_name_to_internal( lv_new_branch_name ). IF sy-subrc = 0. ro_validation_log->set( iv_key = c_id-new_branch_name iv_val = |Branch already exists| ). ENDIF. ENDIF. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA lv_new_branch_name TYPE string. mo_form_data = mo_form_util->normalize( ii_event->form_data( ) ). CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-go_back. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back. WHEN c_event-commit. " Validate form entries before committing mo_validation_log = validate_form( mo_form_data ). IF mo_validation_log->is_empty( ) = abap_true. " new branch fields not needed in commit data mo_form_data->strict( abap_false ). mo_form_data->to_abap( CHANGING cs_container = ms_commit ). REPLACE ALL OCCURRENCES OF zif_abapgit_definitions=>c_crlf IN ms_commit-body WITH zif_abapgit_definitions=>c_newline. lv_new_branch_name = mo_form_data->get( c_id-new_branch_name ). " create new branch and commit to it if branch name is not empty IF lv_new_branch_name IS NOT INITIAL. lv_new_branch_name = branch_name_to_internal( lv_new_branch_name ). " creates a new branch and automatically switches to it mo_repo->create_branch( lv_new_branch_name ). ENDIF. zcl_abapgit_services_git=>commit( is_commit = ms_commit io_repo = mo_repo io_stage = mo_stage ). MESSAGE 'Commit was successful' TYPE 'S'. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back_to_bookmark. ELSE. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDIF. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. gui_services( )->register_event_handler( me ). IF mo_form_util->is_empty( mo_form_data ) = abap_true. get_defaults( ). ENDIF. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="top" class="paddings">' ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( mo_repo ) ). ri_html->add( '</div>' ). ri_html->add( '<div id="stage-summary" class="dialog w800px paddings">' ). ri_html->add( render_stage_summary( ) ). ri_html->add( '</div>' ). ri_html->add( mo_form->render( iv_form_class = 'w800px' io_values = mo_form_data io_validation_log = mo_validation_log ) ). ri_html->add( '<div id="stage-details" class="dialog w800px">' ). ri_html->add( render_stage_details( ) ). ri_html->add( '</div>' ). ENDMETHOD. ENDCLASS.
30.010508
119
0.663107
037e90c751e9c2485da47e889fc82efeddbaed5e
4,097
abap
ABAP
src/objects/zcl_abapgit_object_auth.clas.abap
joymike/abapGit
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
[ "MIT" ]
1
2019-05-27T18:50:14.000Z
2019-05-27T18:50:14.000Z
src/objects/zcl_abapgit_object_auth.clas.abap
joymike/abapGit
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_auth.clas.abap
joymike/abapGit
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_auth DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. METHODS constructor IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item iv_language TYPE spras. PROTECTED SECTION. PRIVATE SECTION. DATA: mv_fieldname TYPE authx-fieldname. ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_AUTH IMPLEMENTATION. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). mv_fieldname = ms_item-obj_name. ENDMETHOD. METHOD zif_abapgit_object~changed_by. * looks like "changed by user" is not stored in the database rv_user = c_user_unknown. ENDMETHOD. METHOD zif_abapgit_object~delete. " there is a bug in SAP standard, the TADIR entries are not deleted " when the AUTH object is deleted in transaction SU20 " FM SUSR_AUTF_DELETE_FIELD calls the UI, therefore we reimplement its logic DATA: lt_objlst TYPE susr_t_xuobject, lo_auth TYPE REF TO cl_auth_tools, lv_dummy TYPE string. " authority check CREATE OBJECT lo_auth. IF lo_auth->authority_check_suso( actvt = '06' fieldname = mv_fieldname ) <> 0. MESSAGE e463(01) WITH mv_fieldname INTO lv_dummy. zcx_abapgit_exception=>raise_t100( ). ENDIF. " if field is used check lt_objlst = lo_auth->suso_where_used_afield( mv_fieldname ). IF lt_objlst IS NOT INITIAL. MESSAGE i453(01) WITH mv_fieldname INTO lv_dummy. zcx_abapgit_exception=>raise_t100( ). ENDIF. " collect fieldname into a transport task IF lo_auth->add_afield_to_trkorr( mv_fieldname ) <> 0. "no transport -> no deletion MESSAGE e507(0m) INTO lv_dummy. zcx_abapgit_exception=>raise_t100( ). ENDIF. DELETE FROM authx WHERE fieldname = mv_fieldname. IF sy-subrc <> 0. MESSAGE e507(0m) INTO lv_dummy. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~deserialize. * see include LSAUT_FIELDF02 DATA: ls_authx TYPE authx, lo_auth TYPE REF TO cl_auth_tools. io_xml->read( EXPORTING iv_name = 'AUTHX' CHANGING cg_data = ls_authx ). tadir_insert( iv_package ). CREATE OBJECT lo_auth. IF lo_auth->add_afield_to_trkorr( ls_authx-fieldname ) <> 0. zcx_abapgit_exception=>raise( 'Error deserializing AUTH' ). ENDIF. MODIFY authx FROM ls_authx. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error deserializing AUTH' ). ENDIF. CALL FUNCTION 'DB_COMMIT'. lo_auth->set_authfld_info_from_db( ls_authx-fieldname ). ENDMETHOD. METHOD zif_abapgit_object~exists. SELECT SINGLE fieldname FROM authx INTO mv_fieldname WHERE fieldname = ms_item-obj_name. "#EC CI_GENBUFF rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-delete_tadir = abap_true. ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. * TODO, this function module does not exist in 702 CALL FUNCTION 'SU20_MAINTAIN_SNGL' EXPORTING id_field = mv_fieldname id_wbo_mode = abap_false. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_authx TYPE authx. SELECT SINGLE * FROM authx INTO ls_authx WHERE fieldname = ms_item-obj_name. "#EC CI_GENBUFF IF sy-subrc <> 0. RETURN. ENDIF. io_xml->add( iv_name = 'AUTHX' ig_data = ls_authx ). ENDMETHOD. ENDCLASS.
23.819767
96
0.689285
03816d41f06624f7f1fbcf8308a176bd048bc34a
5,699
abap
ABAP
src/add_column/zcl_zdemo_fe_add_colum_mpc.clas.abap
s-cbrunn/FioriElementsExamples
2ef83536b6569a518d323b8037c66cf4703151c1
[ "Apache-2.0" ]
null
null
null
src/add_column/zcl_zdemo_fe_add_colum_mpc.clas.abap
s-cbrunn/FioriElementsExamples
2ef83536b6569a518d323b8037c66cf4703151c1
[ "Apache-2.0" ]
null
null
null
src/add_column/zcl_zdemo_fe_add_colum_mpc.clas.abap
s-cbrunn/FioriElementsExamples
2ef83536b6569a518d323b8037c66cf4703151c1
[ "Apache-2.0" ]
null
null
null
class ZCL_ZDEMO_FE_ADD_COLUM_MPC definition public inheriting from /IWBEP/CL_MGW_PUSH_ABS_MODEL create public . public section. interfaces IF_SADL_GW_MODEL_EXPOSURE_DATA . types: TS_ZC_FE_ADD_COLUMNTYPE type ZCADDCOLUMN . types: TT_ZC_FE_ADD_COLUMNTYPE type standard table of TS_ZC_FE_ADD_COLUMNTYPE . constants GC_ZC_FE_ADD_COLUMNTYPE type /IWBEP/IF_MGW_MED_ODATA_TYPES=>TY_E_MED_ENTITY_NAME value 'ZC_FE_ADD_COLUMNType' ##NO_TEXT. methods DEFINE redefinition . methods GET_LAST_MODIFIED redefinition . protected section. private section. methods DEFINE_RDS_4 raising /IWBEP/CX_MGW_MED_EXCEPTION . methods GET_LAST_MODIFIED_RDS_4 returning value(RV_LAST_MODIFIED_RDS) type TIMESTAMP . ENDCLASS. CLASS ZCL_ZDEMO_FE_ADD_COLUM_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!!! &* *& &* *&---------------------------------------------------------------------* model->set_schema_namespace( 'ZDEMO_FE_ADD_COLUMN_SRV' ). define_rds_4( ). get_last_modified_rds_4( ). endmethod. method DEFINE_RDS_4. *&---------------------------------------------------------------------* *& 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!!! &* *& &* *&---------------------------------------------------------------------* * This code is generated for Reference Data Source * 4 *&---------------------------------------------------------------------* TRY. if_sadl_gw_model_exposure_data~get_model_exposure( )->expose( model )->expose_vocabulary( vocab_anno_model ). CATCH cx_sadl_exposure_error INTO DATA(lx_sadl_exposure_error). RAISE EXCEPTION TYPE /iwbep/cx_mgw_med_exception EXPORTING previous = lx_sadl_exposure_error. ENDTRY. 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 '20211108200840'. "#EC NOTEXT DATA: lv_rds_last_modified TYPE timestamp . rv_last_modified = super->get_last_modified( ). IF rv_last_modified LT lc_gen_date_time. rv_last_modified = lc_gen_date_time. ENDIF. lv_rds_last_modified = GET_LAST_MODIFIED_RDS_4( ). IF rv_last_modified LT lv_rds_last_modified. rv_last_modified = lv_rds_last_modified . ENDIF . endmethod. method GET_LAST_MODIFIED_RDS_4. *&---------------------------------------------------------------------* *& 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!!! &* *& &* *&---------------------------------------------------------------------* * This code is generated for Reference Data Source * 4 *&---------------------------------------------------------------------* CONSTANTS: co_gen_date_time TYPE timestamp VALUE '20211108200840'. TRY. rv_last_modified_rds = CAST cl_sadl_gw_model_exposure( if_sadl_gw_model_exposure_data~get_model_exposure( ) )->get_last_modified( ). CATCH cx_root. rv_last_modified_rds = co_gen_date_time. ENDTRY. IF rv_last_modified_rds < co_gen_date_time. rv_last_modified_rds = co_gen_date_time. ENDIF. endmethod. method IF_SADL_GW_MODEL_EXPOSURE_DATA~GET_MODEL_EXPOSURE. CONSTANTS: co_gen_timestamp TYPE timestamp VALUE '20211108200841'. DATA(lv_sadl_xml) = |<?xml version="1.0" encoding="utf-16"?>| & |<sadl:definition xmlns:sadl="http://sap.com/sap.nw.f.sadl" syntaxVersion="" >| & | <sadl:dataSource type="CDS" name="ZC_FE_ADD_COLUMN" binding="ZC_FE_ADD_COLUMN" />| & |<sadl:resultSet>| & |<sadl:structure name="ZC_FE_ADD_COLUMN" dataSource="ZC_FE_ADD_COLUMN" maxEditMode="RO" exposure="TRUE" >| & | <sadl:query name="SADL_QUERY">| & | </sadl:query>| & |</sadl:structure>| & |</sadl:resultSet>| & |</sadl:definition>| . ro_model_exposure = cl_sadl_gw_model_exposure=>get_exposure_xml( iv_uuid = CONV #( 'ZDEMO_FE_ADD_COLUMN' ) iv_timestamp = co_gen_timestamp iv_sadl_xml = lv_sadl_xml ). endmethod. ENDCLASS.
41
140
0.509563
038b4294a918f2f967626d4332a9623f1179ab99
632
abap
ABAP
src/backend/zif_ags_object.intf.abap
flaiker/abapGitServer
40b098dd5ca2edcbdfe6cbf7e85fc77d53d00d5e
[ "MIT" ]
null
null
null
src/backend/zif_ags_object.intf.abap
flaiker/abapGitServer
40b098dd5ca2edcbdfe6cbf7e85fc77d53d00d5e
[ "MIT" ]
null
null
null
src/backend/zif_ags_object.intf.abap
flaiker/abapGitServer
40b098dd5ca2edcbdfe6cbf7e85fc77d53d00d5e
[ "MIT" ]
null
null
null
INTERFACE zif_ags_object PUBLIC. METHODS deserialize IMPORTING !iv_data TYPE xstring !iv_adler32 TYPE zags_adler32 OPTIONAL RAISING zcx_ags_error . METHODS get_adler32 RETURNING VALUE(rv_adler32) TYPE zags_adler32 RAISING zcx_ags_error . METHODS get_sha1 RETURNING VALUE(rv_sha1) TYPE zags_sha1 RAISING zcx_ags_error . METHODS get_type RETURNING VALUE(rv_type) TYPE zags_type . METHODS save RAISING zcx_ags_error . METHODS serialize RETURNING VALUE(rv_data) TYPE xstring RAISING zcx_ags_error . ENDINTERFACE.
19.75
44
0.688291
03969f72042450d441790081df042a0bc039372d
14,570
abap
ABAP
chapter_12/yy_head_first_4_duck_composite.prog.abap
sekharchandra-d/Design_Pattern_ABAP
c6ea18bc5f2156989758cc433f99794e19da0100
[ "MIT" ]
4
2018-01-23T00:34:45.000Z
2022-03-18T16:13:57.000Z
chapter_12/yy_head_first_4_duck_composite.prog.abap
sekharchandra-d/Design_Pattern_ABAP
c6ea18bc5f2156989758cc433f99794e19da0100
[ "MIT" ]
1
2018-01-23T06:28:25.000Z
2021-10-05T16:52:56.000Z
chapter_12/yy_head_first_4_duck_composite.prog.abap
sekharchandra-d/Design_Pattern_ABAP
c6ea18bc5f2156989758cc433f99794e19da0100
[ "MIT" ]
7
2018-02-21T14:55:38.000Z
2021-12-17T12:58:10.000Z
*&---------------------------------------------------------------------* *& Sample for Patterns of Patterns - Compound Pattern *& based on Head First Design Patterns: Chapter 12 *&---------------------------------------------------------------------* REPORT yy_head_first_4_duck_composite. *&---------------------------------------------------------------------* *& First, we'll create a Quackable interface. *&---------------------------------------------------------------------* INTERFACE lif_quackable. METHODS quack. " Quackables only need to do one thing well: Quack! ENDINTERFACE. *&---------------------------------------------------------------------* *& Now, some Ducks that implment Quackable. *&---------------------------------------------------------------------* *& Start with your standard Mallard duck. *&---------------------------------------------------------------------* CLASS lcl_mallard_duck DEFINITION FINAL. PUBLIC SECTION. INTERFACES lif_quackable. ENDCLASS. CLASS lcl_mallard_duck IMPLEMENTATION. METHOD lif_quackable~quack. cl_demo_output=>write( |Quack| ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& We've got to have some variation of species if we want *& this to be an interesting simulator. Add a Redhead duck. *&---------------------------------------------------------------------* CLASS lcl_redhead_duck DEFINITION FINAL. PUBLIC SECTION. INTERFACES lif_quackable. ENDCLASS. CLASS lcl_redhead_duck IMPLEMENTATION. METHOD lif_quackable~quack. cl_demo_output=>write( |Quack| ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& This wouldn't be much fun if we didn't add other kinds of Ducks too. *&---------------------------------------------------------------------* *& A Duck Call that quacks but doesn't sound quite like the real thing. *&---------------------------------------------------------------------* CLASS lcl_duck_call DEFINITION FINAL. PUBLIC SECTION. INTERFACES lif_quackable. ENDCLASS. CLASS lcl_duck_call IMPLEMENTATION. METHOD lif_quackable~quack. cl_demo_output=>write( |Kwak| ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& A Rubber Duck that makes a squeak when it quacks. *&---------------------------------------------------------------------* CLASS lcl_rubber_duck DEFINITION FINAL. PUBLIC SECTION. INTERFACES lif_quackable. ENDCLASS. CLASS lcl_rubber_duck IMPLEMENTATION. METHOD lif_quackable~quack. cl_demo_output=>write( |Squeak| ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& A Decoy Duck that doesn't make any sound. *&---------------------------------------------------------------------* CLASS lcl_decoy_duck DEFINITION FINAL. PUBLIC SECTION. INTERFACES lif_quackable. ENDCLASS. CLASS lcl_decoy_duck IMPLEMENTATION. METHOD lif_quackable~quack. cl_demo_output=>write( |<< Silence >>| ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& When ducks are around, geese can't be far. *&---------------------------------------------------------------------* CLASS lcl_goose DEFINITION FINAL. PUBLIC SECTION. METHODS honk. " A Goose is a honker, not a quacker. ENDCLASS. CLASS lcl_goose IMPLEMENTATION. METHOD honk. cl_demo_output=>write( |Honk| ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& We need a goose adapter so geese can play in the simulator, too. *&---------------------------------------------------------------------* CLASS lcl_goose_adapter DEFINITION FINAL. PUBLIC SECTION. " Remember, an Adapter implements the target interface, " which in this case is Quackable. INTERFACES lif_quackable. METHODS constructor IMPORTING io_goose TYPE REF TO lcl_goose. PRIVATE SECTION. DATA mo_goose TYPE REF TO lcl_goose. ENDCLASS. CLASS lcl_goose_adapter IMPLEMENTATION. METHOD constructor. " The constructor takes the goose we are going to adapt. mo_goose = io_goose. ENDMETHOD. METHOD lif_quackable~quack. " When quack is called, it is delegated to the goose's honk method. mo_goose->honk( ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& We're going to make those Quackologists happy and give them *& some quack counts. Quack Counter is a decorator. *&---------------------------------------------------------------------* CLASS lcl_quack_counter DEFINITION FINAL. PUBLIC SECTION. " As with Adapter, we need to implement the target interface. INTERFACES lif_quackable. METHODS constructor IMPORTING io_duck TYPE REF TO lif_quackable. " We're adding one other method to the decorator. This static " method just returns the number of quacks that have occured " in all Quackable instances. CLASS-METHODS quacks RETURNING VALUE(rv_number_of_quacks) TYPE i. PRIVATE SECTION. " We've got an instance variable to hold on to the " quacker we're decorating. DATA mo_duck TYPE REF TO lif_quackable. " And we're counting ALL quacks, so we'll use a static " variable to keep track. CLASS-DATA gv_number_of_quacks TYPE i VALUE 0. ENDCLASS. CLASS lcl_quack_counter IMPLEMENTATION. METHOD constructor. " We get the reference to the Quackable we're decorating " in the constructor. mo_duck = io_duck. ENDMETHOD. METHOD lif_quackable~quack. " When quack is called, we delegate the call to the Quackable " we're decorating... mo_duck->quack( ). " ...then we increase the number of quacks. ADD 1 TO gv_number_of_quacks. ENDMETHOD. METHOD quacks. rv_number_of_quacks = gv_number_of_quacks. ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& We need a factory to produce ducks! *&---------------------------------------------------------------------* *& We're defining an abstract factory that subclasses will implement *& to create different families. *&---------------------------------------------------------------------* CLASS lcl_abstract_duck_factory DEFINITION ABSTRACT. PUBLIC SECTION. " Each method creates one kind of duck. METHODS: create_mallard_duck ABSTRACT RETURNING VALUE(ro_duck) TYPE REF TO lif_quackable, create_redhead_duck ABSTRACT RETURNING VALUE(ro_duck) TYPE REF TO lif_quackable, create_duck_call ABSTRACT RETURNING VALUE(ro_duck) TYPE REF TO lif_quackable, create_rubber_duck ABSTRACT RETURNING VALUE(ro_duck) TYPE REF TO lif_quackable, create_decoy_duck ABSTRACT RETURNING VALUE(ro_duck) TYPE REF TO lif_quackable. ENDCLASS. *&---------------------------------------------------------------------* *& Basic Duck Factory inherits from the abstract factory. *&---------------------------------------------------------------------* CLASS lcl_basic_duck_factory DEFINITION INHERITING FROM lcl_abstract_duck_factory. PUBLIC SECTION. " Each method creates a product: a particular kind of Quackable. " The actual type of product is unknown to the simulator - it just " knows it's getting a Quackable oject. METHODS: create_mallard_duck REDEFINITION, create_redhead_duck REDEFINITION, create_duck_call REDEFINITION, create_rubber_duck REDEFINITION, create_decoy_duck REDEFINITION. ENDCLASS. CLASS lcl_basic_duck_factory IMPLEMENTATION. METHOD create_mallard_duck. ro_duck = NEW lcl_mallard_duck( ). ENDMETHOD. METHOD create_redhead_duck. ro_duck = NEW lcl_redhead_duck( ). ENDMETHOD. METHOD create_duck_call. ro_duck = NEW lcl_duck_call( ). ENDMETHOD. METHOD create_rubber_duck. ro_duck = NEW lcl_rubber_duck( ). ENDMETHOD. METHOD create_decoy_duck. ro_duck = NEW lcl_decoy_duck( ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& Counting Duck Factory also inherits from the abstract factory. *&---------------------------------------------------------------------* CLASS lcl_counting_duck_factory DEFINITION FINAL INHERITING FROM lcl_basic_duck_factory. PUBLIC SECTION. " Each method wraps the Quackable with the quack counting decorator. " The simulator will never know the difference; it just gets back " a Quackable object. But now our rangers can be sure that all " quacks are being counted. METHODS: create_mallard_duck REDEFINITION, create_redhead_duck REDEFINITION, create_duck_call REDEFINITION, create_rubber_duck REDEFINITION, create_decoy_duck REDEFINITION. ENDCLASS. CLASS lcl_counting_duck_factory IMPLEMENTATION. METHOD create_mallard_duck. ro_duck = NEW lcl_quack_counter( super->create_mallard_duck( ) ). ENDMETHOD. METHOD create_redhead_duck. ro_duck = NEW lcl_quack_counter( super->create_redhead_duck( ) ). ENDMETHOD. METHOD create_duck_call. ro_duck = NEW lcl_quack_counter( super->create_duck_call( ) ). ENDMETHOD. METHOD create_rubber_duck. ro_duck = NEW lcl_quack_counter( super->create_rubber_duck( ) ). ENDMETHOD. METHOD create_decoy_duck. ro_duck = NEW lcl_quack_counter( super->create_decoy_duck( ) ). ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& §12) Let's create a flock of ducks (actually a flock of Quackables) *&---------------------------------------------------------------------* CLASS lcl_flock DEFINITION FINAL. PUBLIC SECTION. " Remember, the composite needs to implement the same interface as " the leaf elements. Our leaf elements are Quackables. INTERFACES lif_quackable. " The add() method adds a Quackable to the Flock. METHODS add IMPORTING io_quacker TYPE REF TO lif_quackable. PRIVATE SECTION. " We're using an internal table inside each Flock to hold " the Quackables that belong to the Flock. DATA mt_quackers TYPE STANDARD TABLE OF REF TO lif_quackable WITH EMPTY KEY. ENDCLASS. CLASS lcl_flock IMPLEMENTATION. METHOD add. INSERT io_quacker INTO TABLE mt_quackers. ENDMETHOD. METHOD lif_quackable~quack. " Now for the quack method - after all, the Flock is a Quackable " too. The quack() method in Flock needs to work over the entire " Flock. Here we iterate through the internal table and call the " quack() method on each element. LOOP AT mt_quackers INTO DATA(lo_quacker). lo_quacker->quack( ). ENDLOOP. ENDMETHOD. ENDCLASS. *&---------------------------------------------------------------------* *& §13) Now we need to alter the simulator. Let's give it a spin... *&---------------------------------------------------------------------* *& They all implement the same Quackable interface, but their *& unique implementations allow them to quack in their own way. *&---------------------------------------------------------------------* CLASS lcl_duck_simulator DEFINITION FINAL. PUBLIC SECTION. " Here's our main method to get everything going. CLASS-METHODS main. PRIVATE SECTION. " Here we "overload" the simulate method to simulate just one duck. METHODS simulate IMPORTING io_duck TYPE REF TO lif_quackable OPTIONAL io_factory TYPE REF TO lcl_abstract_duck_factory OPTIONAL PREFERRED PARAMETER io_duck. ENDCLASS. CLASS lcl_duck_simulator IMPLEMENTATION. METHOD main. " First we create the factory that we're going to pass into " the simulate() method. DATA(lo_duck_factory) = NEW lcl_counting_duck_factory( ). " We create a simulator and then call its simulate() method. NEW lcl_duck_simulator( )->simulate( io_factory = lo_duck_factory ). ENDMETHOD. METHOD simulate. IF io_duck IS NOT SUPPLIED. " We need some ducks, so here we create one of each Quackable... " The simulate() method takes an Abstract Duck Factory and uses " it to create ducks rather than instantiating them directly. DATA(lo_redhead_duck) = io_factory->create_redhead_duck( ). DATA(lo_duck_call) = io_factory->create_duck_call( ). DATA(lo_rubber_duck) = io_factory->create_rubber_duck( ). DATA(lo_decoy_duck) = io_factory->create_decoy_duck( ). " We make a Goose that acts like a Quackable duck by wrapping " the Goose in the Goose Adapter. The park ranger told us he " didn't want to count geese honks, so we don't decorate it. DATA(lo_goose_duck) = NEW lcl_goose_adapter( NEW lcl_goose( ) ). "First we create a Flock, and load it up with Quackables. cl_demo_output=>write_text( |\nDuck Simulator with Composite Flocks:| ). DATA(lo_flock_of_ducks) = NEW lcl_flock( ). lo_flock_of_ducks->add( lo_redhead_duck ). lo_flock_of_ducks->add( lo_duck_call ). lo_flock_of_ducks->add( lo_rubber_duck ). lo_flock_of_ducks->add( lo_decoy_duck ). lo_flock_of_ducks->add( lo_goose_duck ). " Then we create a new Flock of mallards. DATA(lo_flock_of_mallards) = NEW lcl_flock( ). DO 4 TIMES. " Here we're creating a little family of mallards... DATA(lo_mallard_duck) = io_factory->create_mallard_duck( ). " ...and adding them to the Flock of mallards. lo_flock_of_mallards->add( lo_mallard_duck ). ENDDO. " Then we add the Flock of mallards to the main flock. lo_flock_of_ducks->add( lo_flock_of_mallards ). " Let's test out the entire Flock! cl_demo_output=>write_text( |\n-- Whole Flock Simulation| ). simulate( lo_flock_of_ducks ). " Then let's test out the mallard's Flock. cl_demo_output=>write_text( |\n-- Mallard Flock Simulation| ). simulate( lo_flock_of_mallards ). " Finally, let's give the Quackologist the data. cl_demo_output=>write_text( |\nThe ducks quacked { lcl_quack_counter=>quacks( ) } times| ). ELSE. " Here we let polymorphism do its magic: no matter what kind of " Quackable gets passed in, the simulate method asks it to quack. " Nothing needs to change here; a Flock is a Quackable! io_duck->quack( ). ENDIF. ENDMETHOD. ENDCLASS. START-OF-SELECTION. cl_demo_output=>begin_section( |Patterns of Patterns - Compound Pattern (composite)| ). cl_demo_output=>line( ). lcl_duck_simulator=>main( ). cl_demo_output=>display( ).
37.844156
72
0.605491
03985f42699ac89d49d7ec5ae2994af59969bf3e
384
abap
ABAP
src/ydk_alv.fugr.conversion_exit_ydk05_input.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
src/ydk_alv.fugr.conversion_exit_ydk05_input.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
src/ydk_alv.fugr.conversion_exit_ydk05_input.abap
DKiyanov/ydk_alv_fcat
e438be091901f96f69cea54a1a3a8578abd1029b
[ "MIT" ]
null
null
null
FUNCTION CONVERSION_EXIT_YDK05_INPUT . *"-------------------------------------------------------------------- *"*"Локальный интерфейс: *" IMPORTING *" REFERENCE(INPUT) *" EXPORTING *" REFERENCE(OUTPUT) *"-------------------------------------------------------------------- * see FM YDK_CONVERSION_EXIT_REGISTER PERFORM input USING '05' input CHANGING output. ENDFUNCTION.
32
70
0.473958
039ceffca1158284df9b108aeb7b521bcad84cf2
356
abap
ABAP
src/zif_abapgit_code_inspector.intf.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/zif_abapgit_code_inspector.intf.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/zif_abapgit_code_inspector.intf.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
INTERFACE zif_abapgit_code_inspector PUBLIC . METHODS run IMPORTING !iv_variant TYPE sci_chkv !iv_save TYPE abap_bool DEFAULT abap_false RETURNING VALUE(rt_list) TYPE scit_alvlist RAISING zcx_abapgit_exception . METHODS is_successful RETURNING VALUE(rv_success) TYPE abap_bool . ENDINTERFACE.
20.941176
54
0.710674
039dee1720820d76fca42e24156d8844c04dd1b4
11,335
abap
ABAP
src/zcl_ioc_container_abstract.clas.abap
alezhu/ABAP-IoC-Container
188edc8937c2f1807e5e1e217104edc2f1d2ca0a
[ "MIT" ]
null
null
null
src/zcl_ioc_container_abstract.clas.abap
alezhu/ABAP-IoC-Container
188edc8937c2f1807e5e1e217104edc2f1d2ca0a
[ "MIT" ]
null
null
null
src/zcl_ioc_container_abstract.clas.abap
alezhu/ABAP-IoC-Container
188edc8937c2f1807e5e1e217104edc2f1d2ca0a
[ "MIT" ]
null
null
null
CLASS zcl_ioc_container_abstract DEFINITION PUBLIC ABSTRACT CREATE PROTECTED. PUBLIC SECTION. METHODS: register IMPORTING !interface_name TYPE string !class_name TYPE string RAISING zcx_ioc_container, deregister IMPORTING !interface_name TYPE string OPTIONAL, register_instance IMPORTING !interface_name TYPE string !instance TYPE REF TO object, deregister_instance IMPORTING !interface_name TYPE string OPTIONAL, resolve IMPORTING !interface_name TYPE string RETURNING VALUE(new_object) TYPE REF TO object. PROTECTED SECTION. TYPES: BEGIN OF ts_mapping_table. TYPES interface_name TYPE string. TYPES class_name TYPE string. TYPES END OF ts_mapping_table. TYPES: tt_mapping_table TYPE HASHED TABLE OF ts_mapping_table WITH UNIQUE KEY interface_name. TYPES: BEGIN OF ts_instance_mapping_table. TYPES interface_name TYPE string. TYPES object_reference TYPE REF TO object. TYPES END OF ts_instance_mapping_table. TYPES: tt_instance_mapping_table TYPE HASHED TABLE OF ts_instance_mapping_table WITH UNIQUE KEY interface_name. DATA: mapping_table TYPE tt_mapping_table, instance_mapping_table TYPE tt_instance_mapping_table, ioc_container_name TYPE string. CLASS-METHODS: get_class_name IMPORTING container_instance TYPE REF TO zcl_ioc_container_abstract RETURNING VALUE(container_class_name) TYPE string. METHODS: constructor, create_object ABSTRACT IMPORTING !class_name TYPE string !parameter_tab TYPE abap_parmbind_tab OPTIONAL RETURNING VALUE(new_object) TYPE REF TO object. PRIVATE SECTION. CONSTANTS: constructor_name TYPE string VALUE `CONSTRUCTOR`. METHODS: assert_creation_possible IMPORTING !class_name TYPE string RETURNING VALUE(object_descriptor) TYPE REF TO cl_abap_objectdescr RAISING zcx_ioc_container, assert_obj_creation_possible IMPORTING !type_descriptor TYPE REF TO cl_abap_typedescr RETURNING VALUE(object_descriptor) TYPE REF TO cl_abap_objectdescr RAISING zcx_ioc_container, check_create_private IMPORTING !type_descriptor TYPE REF TO cl_abap_typedescr RAISING zcx_ioc_container, check_not_instantiatable IMPORTING !object_descriptor TYPE REF TO cl_abap_objectdescr RAISING zcx_ioc_container, get_parameter_type_name IMPORTING !parameter_descriptor TYPE REF TO cl_abap_datadescr RETURNING VALUE(parameter_type_name) TYPE string, get_type_descriptor IMPORTING !class_name TYPE string RETURNING VALUE(type_descriptor) TYPE REF TO cl_abap_typedescr, get_registered_object IMPORTING !interface_name TYPE string RETURNING VALUE(registered_object) TYPE REF TO object, get_registered_mapping IMPORTING !interface_name TYPE string RETURNING VALUE(class_name) TYPE string, get_parameter_descriptor IMPORTING !object_descriptor TYPE REF TO cl_abap_objectdescr !parameter_name TYPE abap_parmname RETURNING VALUE(parameter_descriptor) TYPE REF TO cl_abap_datadescr. ENDCLASS. CLASS ZCL_IOC_CONTAINER_ABSTRACT IMPLEMENTATION. METHOD assert_creation_possible. DATA(type_descriptor) = get_type_descriptor( class_name ). IF type_descriptor IS NOT BOUND. RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>error_in_type_determination ). ENDIF. object_descriptor = assert_obj_creation_possible( type_descriptor ). ENDMETHOD. METHOD assert_obj_creation_possible. check_create_private( type_descriptor ). object_descriptor = CAST cl_abap_objectdescr( type_descriptor ). check_not_instantiatable( object_descriptor ). ENDMETHOD. METHOD check_create_private. DATA(class_descriptor) = CAST cl_abap_classdescr( type_descriptor ). IF class_descriptor->create_visibility NE cl_abap_objectdescr=>public. DATA(friends) = class_descriptor->get_friend_types( ). LOOP AT friends ASSIGNING FIELD-SYMBOL(<friend>). IF <friend>->get_relative_name( ) EQ ioc_container_name. RETURN. ENDIF. ENDLOOP. RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>class_is_create_private ). ENDIF. ENDMETHOD. METHOD check_not_instantiatable. IF object_descriptor->is_instantiatable( ) NE abap_true. RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>object_is_not_instantiatable ). ENDIF. ENDMETHOD. METHOD constructor. ioc_container_name = get_class_name( me ). ENDMETHOD. METHOD deregister. IF interface_name IS SUPPLIED. DELETE TABLE mapping_table WITH TABLE KEY interface_name = to_upper( interface_name ). ELSE. CLEAR mapping_table[]. ENDIF. ENDMETHOD. METHOD deregister_instance. IF interface_name IS SUPPLIED. DELETE TABLE instance_mapping_table WITH TABLE KEY interface_name = to_upper( interface_name ). ELSE. CLEAR instance_mapping_table[]. ENDIF. ENDMETHOD. METHOD get_class_name. cl_abap_classdescr=>describe_by_object_ref( EXPORTING p_object_ref = container_instance RECEIVING p_descr_ref = DATA(type_descriptor) EXCEPTIONS OTHERS = 1 ). CHECK sy-subrc IS INITIAL. container_class_name = type_descriptor->get_relative_name( ). ENDMETHOD. METHOD get_parameter_descriptor. object_descriptor->get_method_parameter_type( EXPORTING p_method_name = constructor_name p_parameter_name = parameter_name RECEIVING p_descr_ref = parameter_descriptor EXCEPTIONS OTHERS = 1 ). IF sy-subrc IS NOT INITIAL. " This should not happen as the method and parameter names " are returned from the object descriptor CLEAR parameter_descriptor. ENDIF. ENDMETHOD. METHOD get_parameter_type_name. DATA(reference_descriptor) = CAST cl_abap_refdescr( parameter_descriptor ). DATA(referenced_type) = reference_descriptor->get_referenced_type( ). IF referenced_type->kind EQ cl_abap_typedescr=>kind_class. DATA(parameter_obj_descriptor) = CAST cl_abap_objectdescr( referenced_type ). parameter_type_name = parameter_obj_descriptor->get_relative_name( ). ELSEIF referenced_type->kind EQ cl_abap_typedescr=>kind_intf. DATA(interface_descriptor) = CAST cl_abap_intfdescr( referenced_type ). parameter_type_name = interface_descriptor->get_relative_name( ). ENDIF. ENDMETHOD. METHOD get_registered_mapping. class_name = VALUE #( mapping_table[ interface_name = to_upper( interface_name ) ]-class_name DEFAULT to_upper( interface_name ) ). ENDMETHOD. METHOD get_registered_object. registered_object = VALUE #( instance_mapping_table[ interface_name = to_upper( interface_name ) ]-object_reference OPTIONAL ). ENDMETHOD. METHOD get_type_descriptor. cl_abap_classdescr=>describe_by_name( EXPORTING p_name = to_upper( class_name ) RECEIVING p_descr_ref = type_descriptor EXCEPTIONS OTHERS = 1 ). IF sy-subrc IS NOT INITIAL. CLEAR type_descriptor. ENDIF. ENDMETHOD. METHOD register. assert_creation_possible( to_upper( class_name ) ). ASSIGN mapping_table[ interface_name = to_upper( interface_name ) ] TO FIELD-SYMBOL(<mapping>). IF <mapping> IS ASSIGNED. <mapping>-class_name = to_upper( class_name ). ELSE. INSERT VALUE #( interface_name = to_upper( interface_name ) class_name = to_upper( class_name ) ) INTO TABLE mapping_table. ENDIF. ENDMETHOD. METHOD register_instance. ASSIGN instance_mapping_table[ interface_name = to_upper( interface_name ) ] TO FIELD-SYMBOL(<instance_mapping>). IF <instance_mapping> IS ASSIGNED. <instance_mapping>-object_reference = instance. ELSE. INSERT VALUE #( interface_name = to_upper( interface_name ) object_reference = instance ) INTO TABLE instance_mapping_table. ENDIF. ENDMETHOD. METHOD resolve. CHECK interface_name IS NOT INITIAL. new_object = get_registered_object( interface_name ). IF new_object IS BOUND. RETURN. ENDIF. DATA(class_name) = get_registered_mapping( interface_name ). DATA(type_descriptor) = get_type_descriptor( class_name ). IF type_descriptor IS NOT BOUND OR type_descriptor->kind NE cl_abap_typedescr=>kind_class. RETURN. ENDIF. TRY. DATA(object_descriptor) = assert_obj_creation_possible( type_descriptor ). CATCH zcx_ioc_container. RETURN. ENDTRY. DATA(constructor) = VALUE #( object_descriptor->methods[ name = constructor_name ] OPTIONAL ). IF lines( constructor-parameters ) GT 0. FIELD-SYMBOLS: <fs> TYPE any. LOOP AT constructor-parameters INTO DATA(constructor_parameter). UNASSIGN <fs>. DATA(parameter_descriptor) = get_parameter_descriptor( object_descriptor = object_descriptor parameter_name = constructor_parameter-name ). IF parameter_descriptor IS NOT BOUND. " This should not happen as the method and parameter names " are returned from the object descriptor CONTINUE. ENDIF. IF constructor_parameter-type_kind EQ cl_abap_typedescr=>typekind_oref. DATA(parameter_type_name) = get_parameter_type_name( parameter_descriptor ). DATA: ref TYPE REF TO data. CREATE DATA ref TYPE REF TO (parameter_type_name). ASSIGN ref->* TO <fs>. <fs> ?= resolve( parameter_type_name ). ELSE. DATA(type_name) = parameter_descriptor->get_relative_name( ). CREATE DATA ref TYPE (type_name). ASSIGN ref->* TO <fs>. ENDIF. IF constructor_parameter-is_optional EQ abap_true AND ( <fs> IS NOT ASSIGNED OR <fs> IS INITIAL ). " Optional parameters that are "null" can be skipped CONTINUE. ENDIF. DATA(parameter_tab) = VALUE abap_parmbind_tab( ( name = constructor_parameter-name kind = cl_abap_objectdescr=>exporting value = REF #( <fs> ) ) ). ENDLOOP. new_object = create_object( class_name = class_name parameter_tab = parameter_tab ). ELSE. new_object = create_object( class_name ). ENDIF. ENDMETHOD. ENDCLASS.
25.644796
95
0.666784
039ff501f41c7a2a54182dbb0136a9a71621430b
608
abap
ABAP
Task/Date-format/ABAP/date-format.abap
LaudateCorpus1/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
1
2018-11-09T22:08:38.000Z
2018-11-09T22:08:38.000Z
Task/Date-format/ABAP/date-format.abap
seanwallawalla-forks/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
null
null
null
Task/Date-format/ABAP/date-format.abap
seanwallawalla-forks/RosettaCodeData
9ad63ea473a958506c041077f1d810c0c7c8c18d
[ "Info-ZIP" ]
1
2018-11-09T22:08:40.000Z
2018-11-09T22:08:40.000Z
report zdate. data: lv_month type string, lv_weekday type string, lv_date type string, lv_day type c. call function 'DATE_COMPUTE_DAY' exporting date = sy-datum importing day = lv_day. select single ltx from t247 into lv_month where spras = sy-langu and mnr = sy-datum+4(2). select single langt from t246 into lv_weekday where sprsl = sy-langu and wotnr = lv_day. concatenate lv_weekday ', ' lv_month ' ' sy-datum+6(2) ', ' sy-datum(4) into lv_date respecting blanks. write lv_date. concatenate sy-datum(4) '-' sy-datum+4(2) '-' sy-datum+6(2) into lv_date. write / lv_date.
27.636364
103
0.705592
03a3f2bdf8be2b9278b251d075d58f3ccc036cb2
999
abap
ABAP
src/sources/zcl_abak_source_database.clas.testclasses.abap
abapinho/abak
5061b122d930c3d7c584690f86c8b4685075ee7f
[ "MIT" ]
38
2018-12-13T09:03:30.000Z
2022-02-11T17:57:33.000Z
src/sources/zcl_abak_source_database.clas.testclasses.abap
abapinho/abaK
5061b122d930c3d7c584690f86c8b4685075ee7f
[ "MIT" ]
59
2018-12-13T09:20:02.000Z
2019-12-10T09:40:25.000Z
src/sources/zcl_abak_source_database.clas.testclasses.abap
abapinho/zabaK
5061b122d930c3d7c584690f86c8b4685075ee7f
[ "MIT" ]
14
2018-12-15T18:17:07.000Z
2019-04-23T08:32:56.000Z
*"* use this source file for your ABAP unit test classes CLASS lcl_unittest DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. DATA: f_cut TYPE REF TO zcl_abak_source_database. METHODS: check_table_invalid FOR TESTING. METHODS: get_type FOR TESTING RAISING zcx_abak. ENDCLASS. "lcl_Unittest CLASS lcl_unittest IMPLEMENTATION. METHOD check_table_invalid. TRY. CREATE OBJECT f_cut EXPORTING i_tablename = 'INVALID'. cl_abap_unit_assert=>fail( msg = 'Table is invalid so exception should have happened' ). CATCH zcx_abak. RETURN. ENDTRY. ENDMETHOD. METHOD get_type. CREATE OBJECT f_cut EXPORTING i_tablename = 'ZABAK_DEFAULT'. cl_abap_unit_assert=>assert_equals( exp = zif_abak_consts=>source_type-database act = f_cut->zif_abak_source~get_type( ) ). ENDMETHOD. ENDCLASS. "lcl_Unittest
23.232558
96
0.666667
03aaf6c90831084e8aded93c93871d91ee619b0a
2,622
abap
ABAP
src/checks/y_check_number_interfaces.clas.abap
sb-sap/code-pal-for-abap
f8610510ab37d8c03f1552d416541d196bf99e6d
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_number_interfaces.clas.abap
sb-sap/code-pal-for-abap
f8610510ab37d8c03f1552d416541d196bf99e6d
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_number_interfaces.clas.abap
sb-sap/code-pal-for-abap
f8610510ab37d8c03f1552d416541d196bf99e6d
[ "Apache-2.0" ]
null
null
null
CLASS y_check_number_interfaces DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUBLIC . PUBLIC SECTION. METHODS constructor . PROTECTED SECTION. METHODS execute_check REDEFINITION. METHODS inspect_tokens REDEFINITION. PRIVATE SECTION. DATA interface_counter TYPE i VALUE 0. METHODS checkif_error IMPORTING index TYPE i statement TYPE sstmnt. ENDCLASS. CLASS Y_CHECK_NUMBER_INTERFACES IMPLEMENTATION. METHOD checkif_error. DATA(check_configuration) = detect_check_configuration( error_count = interface_counter statement = statement ). IF check_configuration IS INITIAL. RETURN. ENDIF. raise_error( statement_level = statement-level statement_index = index statement_from = statement-from error_priority = check_configuration-prio parameter_01 = |{ interface_counter }| parameter_02 = |{ check_configuration-threshold }| ). ENDMETHOD. METHOD constructor. super->constructor( ). settings-pseudo_comment = '"#EC NMBR_INTERFACES' ##NO_TEXT. settings-threshold = 4. settings-documentation = |{ c_docs_path-checks }number-interfaces.md|. set_check_message( 'There are &1 interfaces, exceeding threshold of &2' ). ENDMETHOD. METHOD execute_check. LOOP AT ref_scan_manager->get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>) WHERE stmnt_type EQ scan_struc_stmnt_type-class_definition OR stmnt_type EQ scan_struc_stmnt_type-interface. is_testcode = test_code_detector->is_testcode( <structure> ). TRY. DATA(check_configuration) = check_configurations[ apply_on_testcode = abap_true ]. CATCH cx_sy_itab_line_not_found. IF is_testcode EQ abap_true. CONTINUE. ENDIF. ENDTRY. READ TABLE ref_scan_manager->get_statements( ) INTO DATA(statement_for_message) INDEX <structure>-stmnt_from. interface_counter = 0. LOOP AT ref_scan_manager->get_statements( ) ASSIGNING FIELD-SYMBOL(<statement>) FROM <structure>-stmnt_from TO <structure>-stmnt_to. inspect_tokens( statement = <statement> ). ENDLOOP. checkif_error( index = <structure>-stmnt_from statement = statement_for_message ). ENDLOOP. ENDMETHOD. METHOD inspect_tokens. CHECK get_token_abs( statement-from ) EQ 'INTERFACES'. ADD 1 TO interface_counter. ENDMETHOD. ENDCLASS.
29.133333
92
0.665904
03b61fa271fa1bf00818e7c350e94bb582daae09
1,698
abap
ABAP
src/persist/zif_abapgit_persist_repo.intf.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
317
2020-09-25T19:50:59.000Z
2022-03-29T22:59:01.000Z
src/persist/zif_abapgit_persist_repo.intf.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
1,114
2020-09-24T07:44:36.000Z
2022-03-31T18:01:19.000Z
src/persist/zif_abapgit_persist_repo.intf.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
167
2020-09-24T18:31:37.000Z
2022-03-24T10:07:04.000Z
INTERFACE zif_abapgit_persist_repo PUBLIC . METHODS add IMPORTING !iv_url TYPE string !iv_branch_name TYPE string !iv_branch TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL iv_display_name TYPE string OPTIONAL !iv_package TYPE devclass !iv_offline TYPE abap_bool DEFAULT abap_false !is_dot_abapgit TYPE zif_abapgit_dot_abapgit=>ty_dot_abapgit RETURNING VALUE(rv_key) TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . METHODS delete IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . METHODS list RETURNING VALUE(rt_repos) TYPE zif_abapgit_persistence=>ty_repos RAISING zcx_abapgit_exception . METHODS list_favorites IMPORTING it_keys TYPE zif_abapgit_persistence=>ty_repo_keys RETURNING VALUE(rt_repos) TYPE zif_abapgit_persistence=>ty_repos RAISING zcx_abapgit_exception . METHODS lock IMPORTING !iv_mode TYPE enqmode !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . METHODS read IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RETURNING VALUE(rs_repo) TYPE zif_abapgit_persistence=>ty_repo RAISING zcx_abapgit_exception zcx_abapgit_not_found . METHODS update_metadata IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key !is_meta TYPE zif_abapgit_persistence=>ty_repo_xml !is_change_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask RAISING zcx_abapgit_exception . ENDINTERFACE.
30.872727
72
0.722615
03b877bc30da0c45a9b05f594006853633809b39
33,187
abap
ABAP
src/ui/zcl_abapgit_gui_chunk_lib.clas.abap
JanisB-AT/abapGit
a8517ae26f71ffc6f2bee22a643242cc0c477b99
[ "MIT" ]
2
2021-03-20T20:27:04.000Z
2021-03-20T20:34:58.000Z
src/ui/zcl_abapgit_gui_chunk_lib.clas.abap
JanisB-AT/abapGit
a8517ae26f71ffc6f2bee22a643242cc0c477b99
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_chunk_lib.clas.abap
JanisB-AT/abapGit
a8517ae26f71ffc6f2bee22a643242cc0c477b99
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_chunk_lib DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. TYPES: BEGIN OF ty_event_signature, method TYPE string, name TYPE string, END OF ty_event_signature . CLASS-METHODS class_constructor . CLASS-METHODS render_error IMPORTING !ix_error TYPE REF TO zcx_abapgit_exception OPTIONAL !iv_error TYPE string OPTIONAL !iv_extra_style TYPE string OPTIONAL RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . CLASS-METHODS render_repo_top IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo !iv_show_package TYPE abap_bool DEFAULT abap_true !iv_show_branch TYPE abap_bool DEFAULT abap_true !iv_show_commit TYPE abap_bool DEFAULT abap_true !iv_interactive_branch TYPE abap_bool DEFAULT abap_false !io_news TYPE REF TO zcl_abapgit_news OPTIONAL RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_item_state IMPORTING !iv_lstate TYPE char1 !iv_rstate TYPE char1 RETURNING VALUE(rv_html) TYPE string . CLASS-METHODS render_js_error_banner RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_news IMPORTING !io_news TYPE REF TO zcl_abapgit_news RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_commit_popup IMPORTING !iv_content TYPE csequence !iv_id TYPE csequence RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_error_message_box IMPORTING !ix_error TYPE REF TO zcx_abapgit_exception RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . CLASS-METHODS render_order_by_header_cells IMPORTING !it_col_spec TYPE zif_abapgit_definitions=>ty_col_spec_tt !iv_order_by TYPE string !iv_order_descending TYPE abap_bool RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . CLASS-METHODS render_warning_banner IMPORTING !iv_text TYPE string RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . CLASS-METHODS render_infopanel IMPORTING !iv_div_id TYPE string !iv_title TYPE string !iv_hide TYPE abap_bool DEFAULT abap_true !iv_hint TYPE string OPTIONAL !iv_scrollable TYPE abap_bool DEFAULT abap_true !io_content TYPE REF TO zif_abapgit_html RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_event_as_form IMPORTING !is_event TYPE ty_event_signature RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . CLASS-METHODS render_repo_palette IMPORTING !iv_action TYPE string RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS advanced_submenu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . CLASS-METHODS help_submenu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . CLASS-METHODS settings_toolbar IMPORTING !iv_act TYPE string RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . CLASS-METHODS settings_repo_toolbar IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key !iv_act TYPE string RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . CLASS-METHODS render_branch_name IMPORTING !iv_branch TYPE string OPTIONAL !iv_repo_key TYPE zif_abapgit_persistence=>ty_value OPTIONAL !io_repo TYPE REF TO zcl_abapgit_repo_online OPTIONAL !iv_interactive TYPE abap_bool DEFAULT abap_true RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_package_name IMPORTING !iv_package TYPE devclass !iv_interactive TYPE abap_bool DEFAULT abap_true !iv_suppress_title TYPE abap_bool DEFAULT abap_false RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_user_name IMPORTING !iv_username TYPE xubname !iv_interactive TYPE abap_bool DEFAULT abap_true !iv_icon_only TYPE abap_bool DEFAULT abap_false !iv_suppress_title TYPE abap_bool DEFAULT abap_false RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_transport IMPORTING !iv_transport TYPE trkorr !iv_interactive TYPE abap_bool DEFAULT abap_true !iv_icon_only TYPE abap_bool DEFAULT abap_false RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . PROTECTED SECTION. CLASS-METHODS render_repo_top_commit_hash IMPORTING !ii_html TYPE REF TO zif_abapgit_html !io_repo_online TYPE REF TO zcl_abapgit_repo_online RAISING zcx_abapgit_exception . PRIVATE SECTION. CLASS-DATA gv_time_zone TYPE timezone . CLASS-METHODS get_t100_text IMPORTING !iv_msgid TYPE scx_t100key-msgid !iv_msgno TYPE scx_t100key-msgno RETURNING VALUE(rv_text) TYPE string . CLASS-METHODS normalize_program_name IMPORTING !iv_program_name TYPE sy-repid RETURNING VALUE(rv_normalized_program_name) TYPE string . ENDCLASS. CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. METHOD advanced_submenu. DATA: li_gui_functions TYPE REF TO zif_abapgit_gui_functions, lv_supports_ie_devtools TYPE abap_bool. li_gui_functions = zcl_abapgit_ui_factory=>get_gui_functions( ). lv_supports_ie_devtools = li_gui_functions->is_sapgui_for_windows( ). CREATE OBJECT ro_menu. ro_menu->add( iv_txt = 'Database Utility' iv_act = zif_abapgit_definitions=>c_action-go_db )->add( iv_txt = 'Package to ZIP' iv_act = zif_abapgit_definitions=>c_action-zip_package )->add( iv_txt = 'Transport to ZIP' iv_act = zif_abapgit_definitions=>c_action-zip_transport )->add( iv_txt = 'Object to Files' iv_act = zif_abapgit_definitions=>c_action-zip_object )->add( iv_txt = 'Debug Info' iv_act = zif_abapgit_definitions=>c_action-go_debuginfo ). IF lv_supports_ie_devtools = abap_true. ro_menu->add( iv_txt = 'Open IE DevTools' iv_act = zif_abapgit_definitions=>c_action-ie_devtools ). ENDIF. ENDMETHOD. METHOD class_constructor. CALL FUNCTION 'GET_SYSTEM_TIMEZONE' IMPORTING timezone = gv_time_zone EXCEPTIONS customizing_missing = 1 OTHERS = 2. ASSERT sy-subrc = 0. ENDMETHOD. METHOD get_t100_text. SELECT SINGLE text FROM t100 INTO rv_text WHERE arbgb = iv_msgid AND msgnr = iv_msgno AND sprsl = sy-langu. ENDMETHOD. METHOD help_submenu. CREATE OBJECT ro_menu. ro_menu->add( iv_txt = 'Tutorial' iv_act = zif_abapgit_definitions=>c_action-go_tutorial )->add( iv_txt = 'Documentation' iv_act = zif_abapgit_definitions=>c_action-documentation )->add( iv_txt = 'Explore' iv_act = zif_abapgit_definitions=>c_action-go_explore )->add( iv_txt = 'Changelog' iv_act = zif_abapgit_definitions=>c_action-changelog ). ENDMETHOD. METHOD normalize_program_name. rv_normalized_program_name = substring_before( val = iv_program_name regex = `(=+CP)?$` ). ENDMETHOD. METHOD render_branch_name. DATA: lv_key TYPE string, lv_branch TYPE string, lv_selected_commit TYPE string, lv_commit_short_sha TYPE string, lv_text TYPE string, lv_class TYPE string. IF iv_repo_key IS NOT INITIAL. lv_key = iv_repo_key. ELSEIF io_repo IS BOUND. lv_key = io_repo->get_key( ). ELSE. zcx_abapgit_exception=>raise( 'Either iv_repo_key or io_repo must be supplied' ). ENDIF. IF iv_branch IS NOT INITIAL. lv_branch = iv_branch. lv_text = zcl_abapgit_git_branch_list=>get_display_name( lv_branch ). ELSEIF io_repo IS BOUND. lv_selected_commit = io_repo->get_selected_commit( ). IF lv_selected_commit IS NOT INITIAL. "Convert to short commit. Example: (ae623b9...) lv_commit_short_sha = lv_selected_commit+0(7). lv_text = |({ lv_commit_short_sha }...)|. ELSE. lv_branch = io_repo->get_selected_branch( ). lv_text = zcl_abapgit_git_branch_list=>get_display_name( lv_branch ). ENDIF. ELSE. zcx_abapgit_exception=>raise( 'Either iv_branch or io_repo must be supplied' ). ENDIF. IF zcl_abapgit_git_branch_list=>get_type( lv_branch ) = zif_abapgit_definitions=>c_git_branch_type-branch. lv_class = 'branch branch_branch'. ELSE. lv_class = 'branch'. ENDIF. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( |<span class="{ lv_class }">| ). ri_html->add_icon( iv_name = 'code-branch/grey70' iv_hint = 'Current branch' ). IF iv_interactive = abap_true. ri_html->add_a( iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_switch }?key={ lv_key }| iv_txt = lv_text ). ELSE. ri_html->add( lv_text ). ENDIF. ri_html->add( '</span>' ). ENDMETHOD. METHOD render_commit_popup. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<ul class="hotkeys">' ). ri_html->add( |<li>| && |<span>{ iv_content }</span>| && |</li>| ). ri_html->add( '</ul>' ). ri_html = render_infopanel( iv_div_id = |{ iv_id }| iv_title = 'Commit details' iv_hide = abap_true iv_scrollable = abap_false io_content = ri_html ). ENDMETHOD. METHOD render_error. DATA lv_error TYPE string. DATA lv_class TYPE string VALUE 'panel error center'. IF iv_extra_style IS NOT INITIAL. lv_class = lv_class && ` ` && iv_extra_style. ENDIF. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF ix_error IS BOUND. lv_error = ix_error->get_text( ). ELSE. lv_error = iv_error. ENDIF. ri_html->add( |<div class="{ lv_class }">| ). ri_html->add( |{ ri_html->icon( 'exclamation-circle/red' ) } { lv_error }| ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_error_message_box. DATA: lv_error_text TYPE string, lv_longtext TYPE string, lv_program_name TYPE sy-repid, lv_title TYPE string, lv_text TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. lv_error_text = ix_error->get_text( ). lv_longtext = ix_error->if_message~get_longtext( abap_true ). REPLACE FIRST OCCURRENCE OF REGEX |({ zcx_abapgit_exception=>gc_section_text-cause }{ cl_abap_char_utilities=>newline })| IN lv_longtext WITH |<h3>$1</h3>|. REPLACE FIRST OCCURRENCE OF REGEX |({ zcx_abapgit_exception=>gc_section_text-system_response }{ cl_abap_char_utilities=>newline })| IN lv_longtext WITH |<h3>$1</h3>|. REPLACE FIRST OCCURRENCE OF REGEX |({ zcx_abapgit_exception=>gc_section_text-what_to_do }{ cl_abap_char_utilities=>newline })| IN lv_longtext WITH |<h3>$1</h3>|. REPLACE FIRST OCCURRENCE OF REGEX |({ zcx_abapgit_exception=>gc_section_text-sys_admin }{ cl_abap_char_utilities=>newline })| IN lv_longtext WITH |<h3>$1</h3>|. ri_html->add( |<div id="message" class="message-panel">| ). ri_html->add( |{ ri_html->icon( 'exclamation-circle/red' ) } { lv_error_text }| ). ri_html->add( |<div class="float-right">| ). ri_html->add_a( iv_txt = `&#x274c;` iv_act = `toggleDisplay('message')` iv_class = `close-btn` iv_typ = zif_abapgit_html=>c_action_type-onclick ). ri_html->add( |</div>| ). ri_html->add( |<div class="float-right message-panel-commands">| ). IF ix_error->if_t100_message~t100key-msgid IS NOT INITIAL. lv_title = get_t100_text( iv_msgid = ix_error->if_t100_message~t100key-msgid iv_msgno = ix_error->if_t100_message~t100key-msgno ). lv_text = |Message ({ ix_error->if_t100_message~t100key-msgid }/{ ix_error->if_t100_message~t100key-msgno })|. ri_html->add_a( iv_txt = lv_text iv_typ = zif_abapgit_html=>c_action_type-sapevent iv_act = zif_abapgit_definitions=>c_action-goto_message iv_title = lv_title iv_id = `a_goto_message` ). ENDIF. ix_error->get_source_position( IMPORTING program_name = lv_program_name ). lv_title = normalize_program_name( lv_program_name ). ri_html->add_a( iv_txt = `Goto source` iv_act = zif_abapgit_definitions=>c_action-goto_source iv_typ = zif_abapgit_html=>c_action_type-sapevent iv_title = lv_title iv_id = `a_goto_source` ). ri_html->add_a( iv_txt = `Callstack` iv_act = zif_abapgit_definitions=>c_action-show_callstack iv_typ = zif_abapgit_html=>c_action_type-sapevent iv_id = `a_callstack` ). ri_html->add( |</div>| ). ri_html->add( |<div class="message-panel-commands">| ). ri_html->add( |{ lv_longtext }| ). ri_html->add( |</div>| ). ri_html->add( |</div>| ). ENDMETHOD. METHOD render_event_as_form. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( |<form id='form_{ is_event-name }' method={ is_event-method } action='sapevent:{ is_event-name }'></form>| ). ENDMETHOD. METHOD render_infopanel. DATA lv_display TYPE string. DATA lv_class TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF iv_hide = abap_true. " Initially hide lv_display = 'display:none'. ENDIF. lv_class = 'info-panel'. IF iv_scrollable = abap_false. " Initially hide lv_class = lv_class && ' info-panel-fixed'. ENDIF. ri_html->add( |<div id="{ iv_div_id }" class="{ lv_class }" style="{ lv_display }">| ). ri_html->add( |<div class="info-title">{ iv_title }| && '<div class="float-right">' && ri_html->a( iv_txt = '&#x274c;' iv_typ = zif_abapgit_html=>c_action_type-onclick iv_act = |toggleDisplay('{ iv_div_id }')| iv_class = 'close-btn' ) && '</div></div>' ). IF iv_hint IS NOT INITIAL. ri_html->add( '<div class="info-hint">' && ri_html->icon( iv_name = 'exclamation-triangle' iv_class = 'pad-right' ) && iv_hint && '</div>' ). ENDIF. ri_html->add( |<div class="info-list">| ). ri_html->add( io_content ). ri_html->add( '</div>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_item_state. DATA: lv_system TYPE string. FIELD-SYMBOLS <lv_state> TYPE char1. rv_html = '<span class="state-block">'. DO 2 TIMES. CASE sy-index. WHEN 1. ASSIGN iv_lstate TO <lv_state>. lv_system = 'Local:'. WHEN 2. ASSIGN iv_rstate TO <lv_state>. lv_system = 'Remote:'. ENDCASE. CASE <lv_state>. WHEN zif_abapgit_definitions=>c_state-unchanged. "None or unchanged IF iv_lstate = zif_abapgit_definitions=>c_state-added OR iv_rstate = zif_abapgit_definitions=>c_state-added. rv_html = rv_html && |<span class="none" title="{ lv_system } Not exists">X</span>|. ELSE. rv_html = rv_html && |<span class="none" title="{ lv_system } No changes">&nbsp;</span>|. ENDIF. WHEN zif_abapgit_definitions=>c_state-modified. "Changed rv_html = rv_html && |<span class="changed" title="{ lv_system } Modified">M</span>|. WHEN zif_abapgit_definitions=>c_state-added. "Added new rv_html = rv_html && |<span class="added" title="{ lv_system } Added new">A</span>|. WHEN zif_abapgit_definitions=>c_state-mixed. "Multiple changes (multifile) rv_html = rv_html && |<span class="mixed" title="{ lv_system } Multiple changes">&#x25A0;</span>|. WHEN zif_abapgit_definitions=>c_state-deleted. "Deleted rv_html = rv_html && |<span class="deleted" title="{ lv_system } Deleted">D</span>|. ENDCASE. ENDDO. rv_html = rv_html && '</span>'. ENDMETHOD. METHOD render_js_error_banner. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="js-error-banner" class="dummydiv error">' ). ri_html->add( |{ ri_html->icon( 'exclamation-triangle/red' ) }| && ' If this does not disappear soon,' && ' then there is a JS init error, please log an issue' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_news. DATA: lv_text TYPE string, lv_hint TYPE string, lt_log TYPE zcl_abapgit_news=>ty_logs. FIELD-SYMBOLS: <ls_line> LIKE LINE OF lt_log. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF io_news IS NOT BOUND OR io_news->has_news( ) = abap_false. RETURN. ENDIF. lt_log = io_news->get_log( ). " Render news LOOP AT lt_log ASSIGNING <ls_line>. IF <ls_line>-is_header = abap_true. IF <ls_line>-pos_to_cur > 0. lv_text = <ls_line>-text && '<span class="version-marker update">update</span>'. ELSEIF <ls_line>-pos_to_cur = 0. lv_text = <ls_line>-text && '<span class="version-marker">current</span>'. ELSE. " < 0 lv_text = <ls_line>-text. ENDIF. ri_html->add( |<h1>{ lv_text }</h1>| ). ELSE. <ls_line>-text = escape( val = <ls_line>-text format = cl_abap_format=>e_html_text ). ri_html->add( |<li>{ <ls_line>-text }</li>| ). ENDIF. ENDLOOP. " Wrap IF io_news->has_important( ) = abap_true. lv_hint = 'Please note changes marked with "!"'. ENDIF. ri_html = render_infopanel( iv_div_id = 'news' iv_title = 'Announcement of the latest changes' iv_hint = lv_hint iv_hide = boolc( io_news->has_unseen( ) = abap_false ) io_content = ri_html ). ENDMETHOD. METHOD render_order_by_header_cells. DATA: lv_tmp TYPE string, lv_disp_name TYPE string. FIELD-SYMBOLS <ls_col> LIKE LINE OF it_col_spec. CREATE OBJECT ri_html TYPE zcl_abapgit_html. LOOP AT it_col_spec ASSIGNING <ls_col>. " e.g. <th class="ro-detail">Created at [{ gv_time_zone }]</th> lv_tmp = '<th'. IF <ls_col>-css_class IS NOT INITIAL. lv_tmp = lv_tmp && | class="{ <ls_col>-css_class }"|. ENDIF. lv_tmp = lv_tmp && '>'. IF <ls_col>-display_name IS NOT INITIAL. lv_disp_name = <ls_col>-display_name. IF <ls_col>-add_tz = abap_true. lv_disp_name = lv_disp_name && | [{ gv_time_zone }]|. ENDIF. IF <ls_col>-tech_name = iv_order_by. IF iv_order_descending = abap_true. lv_tmp = lv_tmp && ri_html->a( iv_txt = lv_disp_name iv_act = |{ zif_abapgit_definitions=>c_action-direction }?direction=ASCENDING| iv_title = <ls_col>-title ). ELSE. lv_tmp = lv_tmp && ri_html->a( iv_txt = lv_disp_name iv_act = |{ zif_abapgit_definitions=>c_action-direction }?direction=DESCENDING| iv_title = <ls_col>-title ). ENDIF. ELSEIF <ls_col>-allow_order_by = abap_true. lv_tmp = lv_tmp && ri_html->a( iv_txt = lv_disp_name iv_act = |{ zif_abapgit_definitions=>c_action-change_order_by }?orderBy={ <ls_col>-tech_name }| iv_title = <ls_col>-title ). ELSE. lv_tmp = lv_tmp && ri_html->a( iv_txt = lv_disp_name iv_act = `` iv_title = <ls_col>-title ). ENDIF. ENDIF. IF <ls_col>-tech_name = iv_order_by AND iv_order_by IS NOT INITIAL. IF iv_order_descending = abap_true. lv_tmp = lv_tmp && | &#x25BE;|. " arrow down ELSE. lv_tmp = lv_tmp && | &#x25B4;|. " arrow up ENDIF. ENDIF. lv_tmp = lv_tmp && '</th>'. ri_html->add( lv_tmp ). ENDLOOP. ENDMETHOD. METHOD render_package_name. DATA: lv_obj_name TYPE tadir-obj_name, lv_jump TYPE string, lv_title TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF iv_package IS INITIAL. RETURN. ENDIF. IF iv_suppress_title = abap_false. SELECT SINGLE ctext FROM tdevct INTO lv_title WHERE devclass = iv_package AND spras = sy-langu ##SUBRC_OK. ENDIF. lv_obj_name = iv_package. lv_jump = zcl_abapgit_html_action_utils=>jump_encode( iv_obj_type = 'DEVC' iv_obj_name = lv_obj_name ). ri_html->add( |<span class="package-box">| ). ri_html->add_icon( iv_name = 'box/grey70' iv_hint = 'SAP package' ). IF iv_interactive = abap_true. ri_html->add_a( iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_jump }| iv_title = lv_title iv_txt = to_lower( iv_package ) ). ELSE. ri_html->add( to_lower( iv_package ) ). ENDIF. ri_html->add( '</span>' ). ENDMETHOD. METHOD render_repo_palette. DATA lt_repo_obj_list TYPE zif_abapgit_repo_srv=>ty_repo_list. DATA lt_repo_list TYPE zif_abapgit_persistence=>ty_repos. DATA lv_repo_json TYPE string. DATA lv_size TYPE i. DATA ls_repo_data LIKE LINE OF lt_repo_list. FIELD-SYMBOLS: <ls_repo> LIKE LINE OF lt_repo_list, <lr_repo_obj> LIKE LINE OF lt_repo_obj_list. lt_repo_obj_list = zcl_abapgit_repo_srv=>get_instance( )->list( ). LOOP AT lt_repo_obj_list ASSIGNING <lr_repo_obj>. ls_repo_data = <lr_repo_obj>->ms_data. ls_repo_data-local_settings-display_name = <lr_repo_obj>->get_name( ). APPEND ls_repo_data TO lt_repo_list. ENDLOOP. lv_size = lines( lt_repo_list ). SORT lt_repo_list BY local_settings-display_name AS TEXT. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( 'var repoCatalog = [' ). " Maybe separate this into another method if needed in more places LOOP AT lt_repo_list ASSIGNING <ls_repo>. lv_repo_json = |\{ key: "{ <ls_repo>-key }", isOffline: "{ <ls_repo>-offline }", displayName: "{ <ls_repo>-local_settings-display_name }" \}|. IF sy-tabix < lv_size. lv_repo_json = lv_repo_json && ','. ENDIF. ri_html->add( lv_repo_json ). ENDLOOP. ri_html->add( '];' ). ri_html->add( |var gGoRepoPalette = new CommandPalette(createRepoCatalogEnumerator(repoCatalog, "{ iv_action }"), \{| ). ri_html->add( ' toggleKey: "F2",' ). ri_html->add( ' hotkeyDescription: "Go to repo ..."' ). ri_html->add( '});' ). ENDMETHOD. METHOD render_repo_top. DATA: lo_repo_online TYPE REF TO zcl_abapgit_repo_online, lo_pback TYPE REF TO zcl_abapgit_persist_background, lx_error TYPE REF TO zcx_abapgit_exception, lv_hint TYPE string, lv_icon TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. CREATE OBJECT lo_pback. IF io_repo->is_offline( ) = abap_true. lv_icon = 'plug/darkgrey'. lv_hint = 'Offline repository'. ELSE. lv_icon = 'cloud-upload-alt/blue'. lv_hint = 'On-line repository'. ENDIF. ri_html->add( '<table class="w100"><tr>' ). ri_html->add( '<td class="repo_name">' ). " Repo type and name ri_html->add_icon( iv_name = lv_icon iv_hint = lv_hint ). ri_html->add( |<span class="name">{ io_repo->get_name( ) }</span>| ). IF io_repo->is_offline( ) = abap_false. lo_repo_online ?= io_repo. ri_html->add_a( iv_txt = lo_repo_online->get_url( ) iv_act = |{ zif_abapgit_definitions=>c_action-url }?url=| && |{ lo_repo_online->get_url( ) }| iv_class = |url| ). IF iv_show_commit = abap_true. TRY. render_repo_top_commit_hash( ii_html = ri_html io_repo_online = lo_repo_online ). CATCH zcx_abapgit_exception INTO lx_error. " In case of missing or wrong credentials, show message in status bar lv_hint = lx_error->get_text( ). IF lv_hint CS 'credentials'. MESSAGE lv_hint TYPE 'S' DISPLAY LIKE 'E'. ENDIF. ENDTRY. ENDIF. ENDIF. " News IF io_news IS BOUND AND io_news->has_news( ) = abap_true. IF io_news->has_updates( ) = abap_true. lv_icon = 'arrow-circle-up/warning'. ELSE. lv_icon = 'arrow-circle-up/grey80'. ENDIF. ri_html->add_a( iv_act = |toggleDisplay('news')| iv_typ = zif_abapgit_html=>c_action_type-onclick iv_txt = ri_html->icon( iv_name = lv_icon iv_class = 'pad-sides' iv_hint = 'Display changelog' ) ). ENDIF. ri_html->add( '</td>' ). ri_html->add( '<td class="repo_attr right">' ). " Fav IF abap_true = zcl_abapgit_persistence_user=>get_instance( )->is_favorite_repo( io_repo->get_key( ) ). lv_icon = 'star/blue'. ELSE. lv_icon = 'star/grey'. ENDIF. ri_html->add_a( iv_act = |{ zif_abapgit_definitions=>c_action-repo_toggle_fav }?key={ io_repo->get_key( ) }| iv_txt = ri_html->icon( iv_name = lv_icon iv_class = 'pad-sides' iv_hint = 'Click to toggle favorite' ) ). " BG IF lo_pback->exists( io_repo->get_key( ) ) = abap_true. ri_html->add( '<span class="bg_marker" title="background">BG</span>' ). ENDIF. " Write protect IF io_repo->get_local_settings( )-write_protected = abap_true. ri_html->add_icon( iv_name = 'lock/grey70' iv_hint = 'Locked from pulls' ). ENDIF. " Branch IF io_repo->is_offline( ) = abap_false. lo_repo_online ?= io_repo. IF iv_show_branch = abap_true. ri_html->add( render_branch_name( io_repo = lo_repo_online iv_interactive = iv_interactive_branch ) ). ENDIF. ENDIF. " Package IF iv_show_package = abap_true. ri_html->add( render_package_name( io_repo->get_package( ) ) ). ENDIF. ri_html->add( '</td>' ). ri_html->add( '</tr></table>' ). ENDMETHOD. METHOD render_repo_top_commit_hash. DATA: lv_commit_hash TYPE zif_abapgit_definitions=>ty_sha1, lv_commit_short_hash TYPE zif_abapgit_definitions=>ty_sha1, lv_display_url TYPE zif_abapgit_persistence=>ty_repo-url, lo_url TYPE REF TO zcl_abapgit_git_url, lv_icon_commit TYPE string. lv_commit_hash = io_repo_online->get_current_remote( ). lv_commit_short_hash = lv_commit_hash(7). lv_icon_commit = ii_html->icon( iv_name = 'code-commit' iv_class = 'pad-sides' iv_hint = 'Commit' ). CREATE OBJECT lo_url. TRY. lv_display_url = lo_url->get_commit_display_url( io_repo_online ). ii_html->add_a( iv_txt = |{ lv_icon_commit }{ lv_commit_short_hash }| iv_act = |{ zif_abapgit_definitions=>c_action-url }?url={ lv_display_url }| iv_class = |url| ). CATCH zcx_abapgit_exception. ii_html->add( |<span class="url">{ lv_icon_commit }{ lv_commit_short_hash }</span>| ). ENDTRY. ENDMETHOD. METHOD render_transport. DATA: lv_title TYPE string, lv_jump TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF iv_transport IS INITIAL. RETURN. ENDIF. SELECT SINGLE as4text FROM e07t INTO lv_title WHERE trkorr = iv_transport AND langu = sy-langu ##SUBRC_OK. lv_jump = |{ zif_abapgit_definitions=>c_action-jump_transport }?transport={ iv_transport }|. IF iv_icon_only = abap_true. ri_html->add_a( iv_act = lv_jump iv_title = |Transport { iv_transport }| iv_txt = zcl_abapgit_html=>icon( 'truck-solid/darkgrey' ) ). ELSE. ri_html->add( |<span class="transport-box">| ). ri_html->add_icon( iv_name = 'truck-solid/grey70' iv_hint = 'Transport' ). IF iv_interactive = abap_true. ri_html->add_a( iv_act = lv_jump iv_title = lv_title iv_txt = to_lower( iv_transport ) ). ELSE. ri_html->add( to_lower( iv_transport ) ). ENDIF. ri_html->add( '</span>' ). ENDIF. ENDMETHOD. METHOD render_user_name. DATA: ls_user_address TYPE addr3_val, lv_title TYPE string, lv_jump TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF iv_username IS INITIAL. RETURN. ENDIF. IF iv_username <> zcl_abapgit_objects_super=>c_user_unknown AND iv_suppress_title = abap_false. CALL FUNCTION 'SUSR_USER_ADDRESS_READ' EXPORTING user_name = iv_username IMPORTING user_address = ls_user_address EXCEPTIONS user_address_not_found = 1 OTHERS = 2. IF sy-subrc = 0. lv_title = ls_user_address-name_text. ENDIF. ENDIF. lv_jump = |{ zif_abapgit_definitions=>c_action-jump_user }?user={ iv_username }|. IF iv_icon_only = abap_true. ri_html->add_a( iv_act = lv_jump iv_title = lv_title iv_txt = zcl_abapgit_html=>icon( 'user-solid/darkgrey' ) ). ELSE. ri_html->add( |<span class="user-box">| ). ri_html->add_icon( iv_name = 'user-solid/grey70' iv_hint = 'User name' ). IF iv_interactive = abap_true AND iv_username <> zcl_abapgit_objects_super=>c_user_unknown. ri_html->add_a( iv_act = lv_jump iv_title = lv_title iv_txt = to_lower( iv_username ) ). ELSE. ri_html->add( to_lower( iv_username ) ). ENDIF. ri_html->add( '</span>' ). ENDIF. ENDMETHOD. METHOD render_warning_banner. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div class="dummydiv warning">' ). ri_html->add( |{ ri_html->icon( 'exclamation-triangle/yellow' ) } { iv_text }| ). ri_html->add( '</div>' ). ENDMETHOD. METHOD settings_repo_toolbar. CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-repo-settings'. ro_menu->add( iv_txt = 'Repository' iv_act = |{ zif_abapgit_definitions=>c_action-repo_settings }?key={ iv_key }| iv_cur = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_settings ) )->add( iv_txt = 'Local' iv_act = |{ zif_abapgit_definitions=>c_action-repo_local_settings }?key={ iv_key }| iv_cur = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_local_settings ) )->add( iv_txt = 'Stats' iv_act = |{ zif_abapgit_definitions=>c_action-repo_infos }?key={ iv_key }| iv_cur = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_infos ) ). ENDMETHOD. METHOD settings_toolbar. CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-settings'. ro_menu->add( iv_txt = 'Global' iv_act = zif_abapgit_definitions=>c_action-go_settings iv_cur = boolc( iv_act = zif_abapgit_definitions=>c_action-go_settings ) )->add( iv_txt = 'Personal' iv_act = zif_abapgit_definitions=>c_action-go_settings_personal iv_cur = boolc( iv_act = zif_abapgit_definitions=>c_action-go_settings_personal ) ). ENDMETHOD. ENDCLASS.
31.972062
118
0.61741
03c06a54a08d9fdd5e3ba0306d2b6a7b9a0f7524
1,744
abap
ABAP
src/zcl_abap_to_json_id.clas.abap
julianocacheta/abap-oo-basics
9a0043d22dce1b4753e7253aa0b8c4084cc02071
[ "Apache-2.0" ]
82
2020-04-24T14:57:30.000Z
2022-03-16T03:01:36.000Z
src/zcl_abap_to_json_id.clas.abap
julianocacheta/abap-oo-basics
9a0043d22dce1b4753e7253aa0b8c4084cc02071
[ "Apache-2.0" ]
1
2020-06-11T12:36:13.000Z
2020-06-11T12:36:13.000Z
src/zcl_abap_to_json_id.clas.abap
julianocacheta/abap-oo-basics
9a0043d22dce1b4753e7253aa0b8c4084cc02071
[ "Apache-2.0" ]
26
2020-05-07T17:32:20.000Z
2022-03-08T06:37:32.000Z
CLASS zcl_abap_to_json_id DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_abap_to_json_id IMPLEMENTATION. METHOD if_oo_adt_classrun~main. DATA(ua_0058) = NEW zcl_oo_tutorial_5( carrier_id = `UA` connection_id = `0058` flight_date = `20201214` ). DATA(json_writer) = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ). CALL TRANSFORMATION id SOURCE flight = ua_0058 RESULT XML data(json_out). "json_writer. DATA(json_out). "out->write( json_out ). clear ua_0058. data object_xml type zobject_xml. object_xml-id = 1. object_xml-content = json_out. MODIFY ZOBJECT_XML from @object_xml. data context2 type ref to zcl_oo_tutorial_5. CALL TRANSFORMATION id SOURCE XML json_out RESULT flight = context2. out->write( context2->get_flight_details( ) ). TRY. DATA(reader) = cl_sxml_string_reader=>create( json_writer->get_output( ) ). DATA(writer) = CAST if_sxml_writer( cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ) ). writer->set_option( option = if_sxml_writer=>co_opt_linebreaks ). writer->set_option( option = if_sxml_writer=>co_opt_indent ). reader->next_node( ). reader->skip_node( writer ). DATA(json_output) = cl_abap_conv_codepage=>create_in( )->convert( CAST cl_sxml_string_writer( writer )->get_output( ) ). CATCH cx_sxml_parse_error into data(error). out->write( error->get_text( ) ). RETURN. ENDTRY. out->write( json_output ). ENDMETHOD. ENDCLASS.
33.538462
129
0.662844
03c549119be6bce55a77cf16d6785f48c58075d5
328
abap
ABAP
src/day15/zcl_advent2020_day15_rename.clas.abap
joltdx/abap-advent-2020-template
a1d1be1026188fa04ac864f942a8dd12d1a814e1
[ "Unlicense" ]
12
2020-11-15T10:37:25.000Z
2021-02-06T15:28:46.000Z
src/day15/zcl_advent2020_day15_rename.clas.abap
joltdx/abap-advent-2020-template
a1d1be1026188fa04ac864f942a8dd12d1a814e1
[ "Unlicense" ]
62
2020-11-25T08:25:20.000Z
2022-02-01T04:03:10.000Z
src/day15/zcl_advent2020_day15_rename.clas.abap
joltdx/abap-advent-2020-template
a1d1be1026188fa04ac864f942a8dd12d1a814e1
[ "Unlicense" ]
5
2020-11-25T05:28:48.000Z
2021-12-05T08:18:36.000Z
CLASS zcl_advent2020_day15_rename DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_advent2020_rename . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ADVENT2020_DAY15_RENAME IMPLEMENTATION. METHOD zif_advent2020_rename~solve. output = 'todo'. ENDMETHOD. ENDCLASS.
13.666667
49
0.768293
03c615004f6851b43809dcf9ddf9bde0bcc1119e
18,516
abap
ABAP
lbn-gtt-template-ts/abap/zsrc/zsst_gtt_cl_send_delivery_idoc.clas.abap
zenonkowalewski/logistics-business-network-gtt-samples
c34ddff27f339768ae61a6dc8eb4330ecc5ca320
[ "Apache-2.0" ]
12
2020-09-25T07:54:40.000Z
2021-09-27T12:29:34.000Z
lbn-gtt-template-ts/abap/zsrc/zsst_gtt_cl_send_delivery_idoc.clas.abap
zenonkowalewski/logistics-business-network-gtt-samples
c34ddff27f339768ae61a6dc8eb4330ecc5ca320
[ "Apache-2.0" ]
2
2020-10-15T05:20:41.000Z
2022-02-14T09:28:02.000Z
lbn-gtt-template-ts/abap/zsrc/zsst_gtt_cl_send_delivery_idoc.clas.abap
zenonkowalewski/logistics-business-network-gtt-samples
c34ddff27f339768ae61a6dc8eb4330ecc5ca320
[ "Apache-2.0" ]
50
2020-09-29T03:06:01.000Z
2022-03-28T16:04:45.000Z
CLASS zsst_gtt_cl_send_delivery_idoc DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. TYPES: BEGIN OF ty_delivery_item, delivery_number TYPE /scmtms/base_btd_id, delivery_item_number TYPE /scmtms/base_btd_item_id, freight_unit_number TYPE /scmtms/tor_id, change_mode TYPE /bobf/conf_change_mode, stop_id_dst TYPE /scmtms/stop_id, log_locid_dst TYPE /scmtms/location_id, country_code_dst TYPE land1, city_name_dst TYPE ad_city1, evt_exp_datetime TYPE /saptrx/event_exp_datetime, evt_exp_tzone TYPE /saptrx/timezone, END OF ty_delivery_item . TYPES: tt_delivery_item TYPE SORTED TABLE OF ty_delivery_item WITH UNIQUE KEY delivery_number delivery_item_number freight_unit_number . TYPES: tt_tor_type TYPE SORTED TABLE OF /scmtms/tor_type WITH UNIQUE KEY table_line . TYPES: BEGIN OF ty_aotype, tor_type TYPE /scmtms/tor_type, aotype TYPE /saptrx/aotype, END OF ty_aotype . TYPES: tt_aottype TYPE SORTED TABLE OF ty_aotype WITH UNIQUE KEY tor_type . TYPES: BEGIN OF ty_aotype_item, obj_type TYPE /saptrx/trk_obj_type, aot_type TYPE /saptrx/aotype, END OF ty_aotype_item . TYPES: tt_aotype_item TYPE TABLE OF ty_aotype_item . TYPES: BEGIN OF ty_aotypes_new, trk_obj_type TYPE /saptrx/aotypes-trk_obj_type, aotype TYPE /saptrx/aotypes-aotype, trxservername TYPE /saptrx/aotypes-trxservername, END OF ty_aotypes_new . TYPES: tt_aotypes_new TYPE TABLE OF ty_aotypes_new . TYPES: BEGIN OF ty_trxserv, trx_server_id TYPE /saptrx/trxserv-trx_server_id, trx_server TYPE /saptrx/trxserv-trx_server, END OF ty_trxserv . TYPES: tt_trxserv TYPE TABLE OF ty_trxserv . TYPES: BEGIN OF ty_likp, vbeln TYPE likp-vbeln, "Delivery kodat TYPE likp-kodat, "Picking Date kouhr TYPE likp-kouhr, "Picking Time (Local Time, with Reference to a Plant) vstel TYPE likp-vstel, "Shipping Point / Receiving Point wadat TYPE likp-wadat, "Planned Goods Movement Date wauhr TYPE likp-wauhr, "Time of Goods Issue (Local, Relating to a Plant) kunnr TYPE likp-kunnr, "Ship-to Party END OF ty_likp. types: tt_likp type table of ty_likp. types: BEGIN OF ty_delivery_item_new, delivery_number TYPE VBELN_VL, delivery_item_number TYPE POSNR_VL, freight_unit_number TYPE /scmtms/tor_id, change_mode TYPE /bobf/conf_change_mode, stop_id_dst TYPE /scmtms/stop_id, log_locid_dst TYPE /scmtms/location_id, country_code_dst TYPE land1, city_name_dst TYPE ad_city1, evt_exp_datetime TYPE /saptrx/event_exp_datetime, evt_exp_tzone TYPE /saptrx/timezone, END OF ty_delivery_item_new . types: tt_delivery_item_new TYPE TABLE OF ty_delivery_item. CONSTANTS cv_base_btd_tco_inb_dlv TYPE /scmtms/base_btd_tco VALUE '58' ##NO_TEXT. METHODS send_delivery_idoc . METHODS constructor IMPORTING !it_tor_root_sstring TYPE /scmtms/t_em_bo_tor_root !it_tor_root_before_sstring TYPE /scmtms/t_em_bo_tor_root !it_tor_item_sstring TYPE /scmtms/t_em_bo_tor_item !it_tor_item_before_sstring TYPE /scmtms/t_em_bo_tor_item !it_tor_stop_sstring TYPE /scmtms/t_em_bo_tor_stop !it_tor_stop_addr_sstring TYPE /scmtms/t_em_bo_loc_addr . protected section. PRIVATE SECTION. CONSTANTS cv_base_btd_tco_outb_dlv TYPE /scmtms/base_btd_tco VALUE '73' ##NO_TEXT. CONSTANTS: BEGIN OF cs_aotype, BEGIN OF freight_unit, azure TYPE /saptrx/aotype VALUE 'ZGTT_SHP_FU_AZR', integration TYPE /saptrx/aotype VALUE 'ZGTT_SHP_FU_INT', acceptance TYPE /saptrx/aotype VALUE 'ZGTT_SHP_FU_ACC', END OF freight_unit, END OF cs_aotype . CONSTANTS: BEGIN OF cs_control, dlv_no TYPE /saptrx/paramname VALUE 'YN_DLV_NO', dlv_item_no TYPE /saptrx/paramname VALUE 'YN_DLV_ITEM_NO', act_bus_tz TYPE /saptrx/paramname VALUE 'ACTUAL_BUSINESS_TIMEZONE', ACT_BUS_Tm TYPE /saptrx/paramname VALUE 'ACTUAL_BUSINESS_DATETIME', act_tec_tz TYPE /saptrx/paramname VALUE 'ACTUAL_TECHNICAL_TIMEZONE', act_tec_tm TYPE /saptrx/paramname VALUE 'ACTUAL_TECHNICAL_DATETIME', END OF cs_control. CONSTANTS: BEGIN OF cs_tracking, outbound_delivery TYPE /saptrx/trxcod VALUE 'OUTBOUND_DELIVERY', outbound_delivery_itm TYPE /saptrx/trxcod VALUE 'OUTBOUND_DELIVERY_IT', freight_unit TYPE /saptrx/trxcod VALUE 'FREIGHT_UNIT', END OF cs_tracking. CONSTANTS: BEGIN OF cs_eventdata, BEGIN OF milestone, picking TYPE /saptrx/appl_event_tag VALUE 'PICKING', packing TYPE /saptrx/appl_event_tag VALUE 'PACKING', goods_issue TYPE /saptrx/appl_event_tag VALUE 'GOODS_ISSUE', dlv_pod TYPE /saptrx/appl_event_tag VALUE 'DLV_POD', pod TYPE /saptrx/appl_event_tag VALUE 'POD', END OF milestone, BEGIN OF loctype, ShippingPoint TYPE /saptrx/loc_id_type VALUE 'ShippingPoint', Customer TYPE /saptrx/loc_id_type VALUE 'Customer', END OF loctype, LogisticLocation TYPE /saptrx/loc_id_type VALUE 'LogisticLocation', END OF cs_eventdata. DATA mt_allowed_fu_type TYPE tt_tor_type . DATA mt_tor_root TYPE /scmtms/t_em_bo_tor_root . DATA mt_tor_root_before TYPE /scmtms/t_em_bo_tor_root . DATA mt_tor_item TYPE /scmtms/t_em_bo_tor_item . DATA mt_tor_item_before TYPE /scmtms/t_em_bo_tor_item . DATA mt_tor_stop TYPE /scmtms/t_em_bo_tor_stop . DATA mt_tor_stop_before TYPE /scmtms/t_em_bo_tor_stop . DATA mt_tor_stop_addr TYPE /scmtms/t_em_bo_loc_addr . METHODS get_delivery_items RETURNING VALUE(rt_delivery_item) TYPE tt_delivery_item . METHODS get_allowed_fu_types RETURNING VALUE(rt_fu_type) TYPE tt_tor_type . METHODS add_delivery_item_to_send_list IMPORTING !is_tor_root TYPE /scmtms/s_em_bo_tor_root !iv_change_mode TYPE /bobf/conf_change_mode CHANGING !ct_delivery_item TYPE tt_delivery_item . METHODS get_dlv_item_based_on_tor_root CHANGING !ct_delivery_item TYPE tt_delivery_item . METHODS get_dlv_item_based_on_tor_item CHANGING !ct_delivery_item TYPE tt_delivery_item . METHODS get_dlv_item_based_on_tor_stop CHANGING !ct_delivery_item TYPE tt_delivery_item . METHODS get_required_data IMPORTING !iv_change_mode TYPE /bobf/conf_change_mode !iv_tor_root_node_id TYPE /scmtms/bo_node_id CHANGING !cs_delivery_item TYPE ty_delivery_item . METHODS conversion_alpha_input IMPORTING !input TYPE clike EXPORTING VALUE(output) TYPE clike . METHODS get_tor_stop_before RETURNING VALUE(rt_tor_stop_before) TYPE /scmtms/t_em_bo_tor_stop . ENDCLASS. CLASS ZSST_GTT_CL_SEND_DELIVERY_IDOC IMPLEMENTATION. METHOD add_delivery_item_to_send_list. DATA ls_delivery_item TYPE ty_delivery_item. LOOP AT mt_tor_item ASSIGNING FIELD-SYMBOL(<ls_tor_item>) USING KEY item_parent WHERE parent_node_id = is_tor_root-node_id. CHECK ( <ls_tor_item>-base_btd_tco = cv_base_btd_tco_inb_dlv OR <ls_tor_item>-base_btd_tco = cv_base_btd_tco_outb_dlv ) AND <ls_tor_item>-base_btd_id IS NOT INITIAL AND <ls_tor_item>-base_btditem_id IS NOT INITIAL. ls_delivery_item-delivery_number = <ls_tor_item>-base_btd_id. ls_delivery_item-delivery_item_number = <ls_tor_item>-base_btditem_id. ls_delivery_item-freight_unit_number = is_tor_root-tor_id. ls_delivery_item-change_mode = iv_change_mode. get_required_data( EXPORTING iv_change_mode = iv_change_mode iv_tor_root_node_id = is_tor_root-node_id CHANGING cs_delivery_item = ls_delivery_item ). INSERT ls_delivery_item INTO TABLE ct_delivery_item. ENDLOOP. ENDMETHOD. METHOD constructor. mt_tor_root = it_tor_root_sstring. mt_tor_root_before = it_tor_root_before_sstring. mt_tor_item = it_tor_item_sstring. mt_tor_item_before = it_tor_item_before_sstring. mt_tor_stop = it_tor_stop_sstring. mt_tor_stop_addr = it_tor_stop_addr_sstring. mt_tor_stop_before = get_tor_stop_before( ). mt_allowed_fu_type = get_allowed_fu_types( ). ENDMETHOD. METHOD conversion_alpha_input. CLEAR:output. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = input IMPORTING output = output. ENDMETHOD. METHOD get_allowed_fu_types. DATA lt_aotype TYPE tt_aottype. DATA(lt_tor_root) = VALUE /scmtms/t_em_bo_tor_root( FOR <ls_tor_root> IN mt_tor_root WHERE ( tor_cat = /scmtms/if_tor_const=>sc_tor_category-freight_unit ) ( <ls_tor_root> ) ). SELECT type AS tor_type, aotype FROM /scmtms/c_torty INTO TABLE @lt_aotype FOR ALL ENTRIES IN @lt_tor_root WHERE type = @lt_tor_root-tor_type. LOOP AT lt_aotype ASSIGNING FIELD-SYMBOL(<ls_aotype>). CHECK <ls_aotype>-aotype = cs_aotype-freight_unit-acceptance OR <ls_aotype>-aotype = cs_aotype-freight_unit-azure OR <ls_aotype>-aotype = cs_aotype-freight_unit-integration. INSERT <ls_aotype>-tor_type INTO TABLE rt_fu_type. ENDLOOP. ENDMETHOD. METHOD get_delivery_items. get_dlv_item_based_on_tor_root( CHANGING ct_delivery_item = rt_delivery_item ). get_dlv_item_based_on_tor_item( CHANGING ct_delivery_item = rt_delivery_item ). get_dlv_item_based_on_tor_stop( CHANGING ct_delivery_item = rt_delivery_item ). ENDMETHOD. METHOD get_dlv_item_based_on_tor_item. DATA ls_delivery_item TYPE ty_delivery_item. LOOP AT mt_tor_item ASSIGNING FIELD-SYMBOL(<ls_tor_item>) WHERE ( base_btd_tco = cv_base_btd_tco_inb_dlv OR base_btd_tco = cv_base_btd_tco_outb_dlv ) AND ( change_mode = /bobf/if_frw_c=>sc_modify_delete OR change_mode = /bobf/if_frw_c=>sc_modify_create ) AND base_btd_id IS NOT INITIAL AND base_btditem_id IS NOT INITIAL. ASSIGN mt_tor_root[ node_id = <ls_tor_item>-parent_node_id ] TO FIELD-SYMBOL(<ls_tor_root>). CHECK sy-subrc = 0 AND <ls_tor_root>-tor_cat = /scmtms/if_tor_const=>sc_tor_category-freight_unit. ls_delivery_item-delivery_number = <ls_tor_item>-base_btd_id. ls_delivery_item-delivery_item_number = <ls_tor_item>-base_btditem_id. ls_delivery_item-freight_unit_number = <ls_tor_root>-tor_id. ls_delivery_item-change_mode = <ls_tor_item>-change_mode. get_required_data( EXPORTING iv_change_mode = <ls_tor_item>-change_mode iv_tor_root_node_id = <ls_tor_root>-node_id CHANGING cs_delivery_item = ls_delivery_item ). INSERT ls_delivery_item INTO TABLE ct_delivery_item. ENDLOOP. ENDMETHOD. METHOD get_dlv_item_based_on_tor_root. LOOP AT mt_tor_root ASSIGNING FIELD-SYMBOL(<ls_tor_root>) WHERE tor_cat = /scmtms/if_tor_const=>sc_tor_category-freight_unit. CHECK line_exists( mt_allowed_fu_type[ table_line = <ls_tor_root>-tor_type ] ) AND ( <ls_tor_root>-base_btd_tco = cv_base_btd_tco_inb_dlv OR <ls_tor_root>-base_btd_tco = cv_base_btd_tco_outb_dlv ). IF <ls_tor_root>-change_mode = /bobf/if_frw_c=>sc_modify_delete. add_delivery_item_to_send_list( EXPORTING is_tor_root = <ls_tor_root> iv_change_mode = /bobf/if_frw_c=>sc_modify_delete CHANGING ct_delivery_item = ct_delivery_item ). CONTINUE. ENDIF. ASSIGN mt_tor_root_before[ node_id = <ls_tor_root>-node_id ] TO FIELD-SYMBOL(<ls_tor_root_before>). IF sy-subrc = 0. CHECK <ls_tor_root_before>-base_btd_tco <> cv_base_btd_tco_inb_dlv AND <ls_tor_root_before>-base_btd_tco <> cv_base_btd_tco_outb_dlv. add_delivery_item_to_send_list( EXPORTING is_tor_root = <ls_tor_root> iv_change_mode = /bobf/if_frw_c=>sc_modify_update CHANGING ct_delivery_item = ct_delivery_item ). ELSE. add_delivery_item_to_send_list( EXPORTING is_tor_root = <ls_tor_root> iv_change_mode = /bobf/if_frw_c=>sc_modify_create CHANGING ct_delivery_item = ct_delivery_item ). ENDIF. ENDLOOP. ENDMETHOD. METHOD get_dlv_item_based_on_tor_stop. DATA lv_tabix TYPE sy-tabix. LOOP AT mt_tor_stop ASSIGNING FIELD-SYMBOL(<ls_tor_stop>) GROUP BY ( parent_node_id = <ls_tor_stop>-parent_node_id group_size = GROUP SIZE ) ASSIGNING FIELD-SYMBOL(<lt_group>). LOOP AT GROUP <lt_group> ASSIGNING FIELD-SYMBOL(<ls_tor_stop_current>). lv_tabix += 1. CHECK lv_tabix = <lt_group>-group_size. ASSIGN mt_tor_stop_before[ node_id = <ls_tor_stop_current>-node_id ] TO FIELD-SYMBOL(<ls_tor_stop_before>). CHECK ( sy-subrc = 0 AND <ls_tor_stop_current>-log_locid <> <ls_tor_stop_before>-log_locid ) OR sy-subrc <> 0. " Freight Unit destination was changed => send IDOC ASSIGN mt_tor_root[ node_id = <ls_tor_stop_current>-parent_node_id ] TO FIELD-SYMBOL(<ls_tor_root>). CHECK sy-subrc = 0 AND <ls_tor_root>-tor_cat = /scmtms/if_tor_const=>sc_tor_category-freight_unit. add_delivery_item_to_send_list( EXPORTING is_tor_root = <ls_tor_root> iv_change_mode = /bobf/if_frw_c=>sc_modify_update CHANGING ct_delivery_item = ct_delivery_item ). ENDLOOP. CLEAR lv_tabix. ENDLOOP. ENDMETHOD. METHOD get_required_data. DATA: lt_stop TYPE /scmtms/t_em_bo_tor_stop, lv_time_zone TYPE sy-zonlo. IF iv_change_mode = /bobf/if_frw_c=>sc_modify_delete. lt_stop = VALUE #( FOR <ls_stop> IN mt_tor_stop_before USING KEY parent_autoplan WHERE ( parent_node_id = iv_tor_root_node_id ) ( <ls_stop> ) ). ELSE. lt_stop = VALUE #( FOR <ls_stop> IN mt_tor_stop USING KEY parent_autoplan WHERE ( parent_node_id = iv_tor_root_node_id ) ( <ls_stop> ) ). ENDIF. DATA(lv_dst_stop_seq_num) = lines( lt_stop ). ASSIGN lt_stop[ seq_num = lv_dst_stop_seq_num ] TO FIELD-SYMBOL(<ls_stop_dst>). IF sy-subrc = 0. cs_delivery_item-stop_id_dst = <ls_stop_dst>-stop_id. cs_delivery_item-log_locid_dst = <ls_stop_dst>-log_locid. ASSIGN mt_tor_stop_addr[ parent_node_id = <ls_stop_dst>-log_loc_uuid ] TO FIELD-SYMBOL(<ls_tor_stop_addr>). IF sy-subrc = 0. cs_delivery_item-country_code_dst = <ls_tor_stop_addr>-country_code. cs_delivery_item-city_name_dst = <ls_tor_stop_addr>-city_name. lv_time_zone = COND #( WHEN <ls_tor_stop_addr>-time_zone_code IS NOT INITIAL THEN <ls_tor_stop_addr>-time_zone_code ELSE sy-zonlo ). cs_delivery_item-evt_exp_tzone = lv_time_zone. ENDIF. CONVERT TIME STAMP <ls_stop_dst>-assgn_end TIME ZONE lv_time_zone INTO DATE DATA(lv_conv_date) TIME DATA(lv_conv_time). cs_delivery_item-evt_exp_datetime = |0{ lv_conv_date }{ lv_conv_time }|. ENDIF. ENDMETHOD. METHOD GET_TOR_STOP_BEFORE. DATA ls_tor_stop_before TYPE /scmtms/s_em_bo_tor_stop. /scmtms/cl_tor_helper_stop=>get_stop_sequence( EXPORTING it_root_key = VALUE #( FOR <ls_tor_root> IN mt_tor_root ( key = <ls_tor_root>-node_id ) ) iv_before_image = abap_true IMPORTING et_stop_seq_d = DATA(lt_stop_seq_d) ). LOOP AT lt_stop_seq_d ASSIGNING FIELD-SYMBOL(<ls_stop_seq_d>). LOOP AT <ls_stop_seq_d>-stop_seq ASSIGNING FIELD-SYMBOL(<ls_stop_seq>). DATA(lv_tabix) = sy-tabix. MOVE-CORRESPONDING <ls_stop_seq> TO ls_tor_stop_before. ls_tor_stop_before-parent_node_id = <ls_stop_seq>-root_key. ASSIGN <ls_stop_seq_d>-stop_map[ tabix = lv_tabix ] TO FIELD-SYMBOL(<ls_stop_map>). ls_tor_stop_before-node_id = <ls_stop_map>-stop_key. INSERT ls_tor_stop_before INTO TABLE rt_tor_stop_before. ENDLOOP. ENDLOOP. ENDMETHOD. METHOD send_delivery_idoc. *---------------------------------------------------------------------* * Trigger point: During the save of freight unit * Main Purpose: * 1)Fill tracking table for delivery item(Delivery item should watch relevant FUs) * 2)Add planned POD events in delivery item *---------------------------------------------------------------------* *---------------------------------------------------------------------* * Variant & Inner table & work area defination *---------------------------------------------------------------------* DATA: lv_vbeln TYPE lips-vbeln, lv_posnrc TYPE char6, lt_delivery_item TYPE tt_delivery_item, lt_delivery_item_new TYPE tt_delivery_item_new, ls_delivery_item_new TYPE ty_delivery_item_new. *---------------------------------------------------------------------* * Main logic *---------------------------------------------------------------------* CLEAR zsst_gtt_cl_toolkit=>gt_delivery_item. lt_delivery_item = get_delivery_items( ). LOOP AT lt_delivery_item ASSIGNING FIELD-SYMBOL(<fs_delivery_item>). me->conversion_alpha_input( EXPORTING input = <fs_delivery_item>-delivery_number IMPORTING output = lv_vbeln ). me->conversion_alpha_input( EXPORTING input = <fs_delivery_item>-delivery_item_number IMPORTING output = lv_posnrc ). MOVE-CORRESPONDING <fs_delivery_item> TO ls_delivery_item_new. ls_delivery_item_new-delivery_number = lv_vbeln. ls_delivery_item_new-delivery_item_number = lv_posnrc. APPEND ls_delivery_item_new TO zsst_gtt_cl_toolkit=>gt_delivery_item. CLEAR: lv_vbeln, lv_posnrc, ls_delivery_item_new. ENDLOOP. ENDMETHOD. ENDCLASS.
37.180723
135
0.680979
03cc5f538275f22b5e5e2d6354ffba5c4f1323e1
247
abap
ABAP
src/unmanaged/#dmo#bp_bookingsupplement_u03.clas.abap
SAP-Cloud-Platform/flight03
ad1cf6a14e72c57a6fe3d552fd759937e12e3ad7
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_bookingsupplement_u03.clas.abap
SAP-Cloud-Platform/flight03
ad1cf6a14e72c57a6fe3d552fd759937e12e3ad7
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_bookingsupplement_u03.clas.abap
SAP-Cloud-Platform/flight03
ad1cf6a14e72c57a6fe3d552fd759937e12e3ad7
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/bp_bookingsupplement_u03 DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF /dmo/i_travel_u03 . PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /dmo/bp_bookingsupplement_u03 IMPLEMENTATION. ENDCLASS.
15.4375
51
0.785425
03cd4aaea3e3e372cc6e369704069e496b5ddd62
2,373
abap
ABAP
src/zif_adu_email.intf.abap
jrodriguez-rc/abap-dev-tools
6cbbd40e3739db038a878cdd1093dfe0cb9e406f
[ "MIT" ]
35
2020-08-27T10:36:55.000Z
2022-02-14T07:56:52.000Z
src/zif_adu_email.intf.abap
jrodriguez-rc/abap-dev-tools
6cbbd40e3739db038a878cdd1093dfe0cb9e406f
[ "MIT" ]
2
2020-11-01T09:53:44.000Z
2022-02-10T08:10:53.000Z
src/zif_adu_email.intf.abap
jrodriguez-rc/abap-dev-tools
6cbbd40e3739db038a878cdd1093dfe0cb9e406f
[ "MIT" ]
6
2020-11-03T08:29:47.000Z
2021-09-11T15:24:05.000Z
"! <p class="shorttext synchronized" lang="en">Email utilities</p> INTERFACE zif_adu_email PUBLIC. CONSTANTS: BEGIN OF document_type, binary TYPE so_obj_tp VALUE `BIN`, html TYPE so_obj_tp VALUE `HTM`, raw TYPE so_obj_tp VALUE `RAW`, END OF document_type. TYPES: BEGIN OF ts_attachment, type TYPE so_obj_tp, subject TYPE so_obj_des, size TYPE so_obj_len, content_hex TYPE solix_tab, END OF ts_attachment, tt_attachment TYPE STANDARD TABLE OF zif_adu_email=>ts_attachment WITH DEFAULT KEY. METHODS send_email IMPORTING text TYPE soli_tab OPTIONAL subject TYPE so_obj_des recipients TYPE bcsy_smtpa attachments TYPE zif_adu_email=>tt_attachment OPTIONAL document_type TYPE so_obj_tp DEFAULT zif_adu_email=>document_type-raw commit_work TYPE abap_bool OPTIONAL RETURNING VALUE(result) TYPE abap_bool RAISING cx_send_req_bcs cx_address_bcs cx_document_bcs. METHODS send_from_user IMPORTING username TYPE uname text TYPE soli_tab OPTIONAL subject TYPE so_obj_des recipients TYPE bcsy_smtpa attachments TYPE zif_adu_email=>tt_attachment OPTIONAL document_type TYPE so_obj_tp DEFAULT zif_adu_email=>document_type-raw commit_work TYPE abap_bool OPTIONAL RETURNING VALUE(result) TYPE abap_bool RAISING cx_send_req_bcs cx_address_bcs cx_document_bcs. METHODS send_from_smtp_address IMPORTING sender TYPE ad_smtpadr sender_name TYPE ad_smtpadr OPTIONAL text TYPE soli_tab OPTIONAL subject TYPE so_obj_des recipients TYPE bcsy_smtpa attachments TYPE zif_adu_email=>tt_attachment OPTIONAL document_type TYPE so_obj_tp DEFAULT zif_adu_email=>document_type-raw commit_work TYPE abap_bool OPTIONAL RETURNING VALUE(result) TYPE abap_bool RAISING cx_send_req_bcs cx_address_bcs cx_document_bcs. METHODS xstring_to_attachment IMPORTING content TYPE xstring type TYPE so_obj_tp subject TYPE so_obj_des size TYPE so_obj_len OPTIONAL RETURNING VALUE(result) TYPE zif_adu_email=>ts_attachment. ENDINTERFACE.
30.037975
87
0.68563
03d05cc7c6ce652c629b981ea7c0ba3fde08a24a
647
abap
ABAP
src/profiles/ycx_failed_to_add_a_line.clas.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
202
2020-05-05T13:41:12.000Z
2022-03-26T15:18:13.000Z
src/profiles/ycx_failed_to_add_a_line.clas.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
322
2020-05-05T19:14:35.000Z
2022-03-22T14:48:44.000Z
src/profiles/ycx_failed_to_add_a_line.clas.abap
lucasborin/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
59
2020-05-05T18:59:19.000Z
2022-03-20T11:24:48.000Z
class YCX_FAILED_TO_ADD_A_LINE definition public inheriting from CX_STATIC_CHECK final create public . public section. interfaces IF_T100_MESSAGE . methods CONSTRUCTOR importing !TEXTID like IF_T100_MESSAGE=>T100KEY optional !PREVIOUS like PREVIOUS optional . protected section. private section. ENDCLASS. CLASS YCX_FAILED_TO_ADD_A_LINE IMPLEMENTATION. method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING PREVIOUS = PREVIOUS . clear me->textid. if textid is initial. IF_T100_MESSAGE~T100KEY = IF_T100_MESSAGE=>DEFAULT_TEXTID. else. IF_T100_MESSAGE~T100KEY = TEXTID. endif. endmethod. ENDCLASS.
17.486486
60
0.785162
03d485719cf3ddb5f17307924ac573b463773961
333
abap
ABAP
src/legacy/#dmo#flight_travel_api15.fugr.#dmo#flight_travel_save15.abap
SAP-Cloud-Platform/flight15
af2de21cb04a2eb8d16e801d2ce668f88ba62789
[ "BSD-Source-Code" ]
1
2019-11-14T15:21:07.000Z
2019-11-14T15:21:07.000Z
src/legacy/#dmo#flight_travel_api15.fugr.#dmo#flight_travel_save15.abap
SAP-Cloud-Platform/flight15
af2de21cb04a2eb8d16e801d2ce668f88ba62789
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api15.fugr.#dmo#flight_travel_save15.abap
SAP-Cloud-Platform/flight15
af2de21cb04a2eb8d16e801d2ce668f88ba62789
[ "BSD-Source-Code" ]
null
null
null
"! API for Saving the Transactional Buffer of the Travel API "! FUNCTION /DMO/FLIGHT_TRAVEL_SAVE15. *"---------------------------------------------------------------------- *"*"Local Interface: *"---------------------------------------------------------------------- /dmo/cl_flight_legacy15=>get_instance( )->save( ). ENDFUNCTION.
37
72
0.423423
03d8551ec4bb068dc96cb781cfcc9be4e4e6fa74
1,001
abap
ABAP
src/objects/texts/zif_abapgit_lxe_texts.intf.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/objects/texts/zif_abapgit_lxe_texts.intf.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/objects/texts/zif_abapgit_lxe_texts.intf.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
INTERFACE zif_abapgit_lxe_texts PUBLIC . TYPES: BEGIN OF ty_lxe_i18n, source_lang TYPE lxeisolang, target_lang TYPE lxeisolang, custmnr TYPE lxecustmnr, objtype TYPE trobjtype, objname TYPE lxeobjname, text_pairs TYPE STANDARD TABLE OF lxe_pcx_s1 WITH DEFAULT KEY, END OF ty_lxe_i18n . TYPES: ty_tlxe_i18n TYPE STANDARD TABLE OF ty_lxe_i18n WITH DEFAULT KEY . METHODS serialize IMPORTING !iv_lxe_text_name TYPE string DEFAULT 'LXE_TEXTS' !iv_object_type TYPE trobjtype !iv_object_name TYPE sobj_name !ii_xml TYPE REF TO zif_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize IMPORTING !iv_lxe_text_name TYPE string DEFAULT 'LXE_TEXTS' !iv_object_type TYPE trobjtype OPTIONAL !iv_object_name TYPE sobj_name OPTIONAL !ii_xml TYPE REF TO zif_abapgit_xml_input RAISING zcx_abapgit_exception . ENDINTERFACE.
29.441176
70
0.701299
03db5766bb34ba9c4167fbad4f62bf74f966adaa
386
abap
ABAP
src/abap.type.abap
g-back/open-abap
e00240aefb27d7053f70f75328e0a320e29a628d
[ "MIT" ]
20
2020-10-02T09:37:08.000Z
2022-03-26T15:29:11.000Z
src/abap.type.abap
g-back/open-abap
e00240aefb27d7053f70f75328e0a320e29a628d
[ "MIT" ]
28
2020-12-02T15:19:10.000Z
2022-03-24T06:12:47.000Z
src/abap.type.abap
g-back/open-abap
e00240aefb27d7053f70f75328e0a320e29a628d
[ "MIT" ]
2
2020-11-17T13:21:38.000Z
2021-11-07T14:35:54.000Z
TYPE-POOL abap. TYPES abap_encoding TYPE c LENGTH 20. TYPES: BEGIN OF abap_trans_srcbind, name TYPE string, value TYPE REF TO data, END OF abap_trans_srcbind. TYPES abap_trans_srcbind_tab TYPE STANDARD TABLE OF abap_trans_srcbind WITH DEFAULT KEY. TYPES abap_trans_resbind_tab TYPE abap_trans_srcbind_tab. CONSTANTS abap_max_comp_name_ln TYPE i VALUE 30.
25.733333
88
0.779793
03db7c311645bd730e038661d842bd9ddec3213a
2,943
abap
ABAP
src/objects/ecatt/ycl_abapgit_ecatt_sp_download.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/objects/ecatt/ycl_abapgit_ecatt_sp_download.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/objects/ecatt/ycl_abapgit_ecatt_sp_download.clas.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
2
2019-11-24T20:35:16.000Z
2020-04-16T07:29:33.000Z
CLASS ycl_abapgit_ecatt_sp_download DEFINITION PUBLIC INHERITING FROM cl_apl_ecatt_download CREATE PUBLIC . PUBLIC SECTION. METHODS: download REDEFINITION, get_xml_stream RETURNING VALUE(rv_xml_stream) TYPE xstring, get_xml_stream_size RETURNING VALUE(rv_xml_stream_size) TYPE int4. PROTECTED SECTION. METHODS: download_data REDEFINITION. PRIVATE SECTION. DATA: mv_xml_stream TYPE xstring, mv_xml_stream_size TYPE int4. METHODS: set_sp_data_to_template. ENDCLASS. CLASS ycl_abapgit_ecatt_sp_download IMPLEMENTATION. METHOD download. " We inherit from CL_APL_ECATT_DOWNLOAD because CL_APL_ECATT_SP_DOWNLOAD " doesn't exist in 702 " Downport DATA: lv_partyp TYPE string. load_help = im_load_help. typ = im_object_type. TRY. cl_apl_ecatt_object=>show_object( EXPORTING im_obj_type = im_object_type im_name = im_object_name im_version = im_object_version IMPORTING re_object = ecatt_object ). CATCH cx_ecatt INTO ex_ecatt. RETURN. ENDTRY. lv_partyp = cl_apl_ecatt_const=>params_type_par. set_attributes_to_template( ). set_sp_data_to_template( ). download_data( ). ENDMETHOD. METHOD download_data. " Downport ycl_abapgit_ecatt_helper=>download_data( EXPORTING ii_template_over_all = template_over_all IMPORTING ev_xml_stream = mv_xml_stream ev_xml_stream_size = mv_xml_stream_size ). ENDMETHOD. METHOD get_xml_stream. rv_xml_stream = mv_xml_stream. ENDMETHOD. METHOD get_xml_stream_size. rv_xml_stream_size = mv_xml_stream_size. ENDMETHOD. METHOD set_sp_data_to_template. " downport DATA: li_dom TYPE REF TO if_ixml_document, li_start_profile_data_node TYPE REF TO if_ixml_element, li_element TYPE REF TO if_ixml_element, lv_sp_xml TYPE etxml_line_str, lo_ecatt_sp TYPE REF TO object. FIELD-SYMBOLS: <ecatt_object> TYPE data. li_start_profile_data_node = template_over_all->create_simple_element( name = 'START_PROFILE' parent = root_node ). ASSIGN ('ECATT_OBJECT') TO <ecatt_object>. ASSERT sy-subrc = 0. lo_ecatt_sp = <ecatt_object>. TRY. CALL METHOD lo_ecatt_sp->('GET_SP_ATTRIBUTES') IMPORTING e_sp_xml = lv_sp_xml. CATCH cx_ecatt_apl. ENDTRY. CALL FUNCTION 'SDIXML_XML_TO_DOM' EXPORTING xml = lv_sp_xml IMPORTING document = li_dom. li_element = li_dom->get_root_element( ). li_start_profile_data_node->append_child( new_child = li_element ). ENDMETHOD. ENDCLASS.
21.172662
76
0.64526
03e5618a93e1c8f95d01bc9717c9c6bcf0378cbd
7,352
abap
ABAP
src/ui/core/zcl_abapgit_gui_html_processor.clas.testclasses.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
2
2021-01-08T21:38:32.000Z
2021-11-17T19:37:14.000Z
src/ui/core/zcl_abapgit_gui_html_processor.clas.testclasses.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
src/ui/core/zcl_abapgit_gui_html_processor.clas.testclasses.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
CLASS ltcl_gui_mock DEFINITION FOR TESTING FINAL. PUBLIC SECTION. TYPES: BEGIN OF ty_cache_signature, url TYPE string, type TYPE string, data TYPE string, END OF ty_cache_signature. INTERFACES zif_abapgit_gui_services. METHODS get_asset RETURNING VALUE(rs_asset) TYPE ty_cache_signature. PRIVATE SECTION. DATA ms_last_cache_signature TYPE ty_cache_signature. ENDCLASS. CLASS ltcl_gui_mock IMPLEMENTATION. METHOD zif_abapgit_gui_services~cache_asset. ms_last_cache_signature-url = iv_url. ms_last_cache_signature-type = iv_type && '/' && iv_subtype. ms_last_cache_signature-data = iv_text. ENDMETHOD. METHOD zif_abapgit_gui_services~register_event_handler. ENDMETHOD. METHOD zif_abapgit_gui_services~get_current_page_name. ENDMETHOD. METHOD zif_abapgit_gui_services~get_hotkeys_ctl. ENDMETHOD. METHOD zif_abapgit_gui_services~get_html_parts. ENDMETHOD. METHOD zif_abapgit_gui_services~get_log. ENDMETHOD. METHOD get_asset. rs_asset = ms_last_cache_signature. ENDMETHOD. ENDCLASS. CLASS ltcl_html_processor_test DEFINITION DEFERRED. CLASS zcl_abapgit_gui_html_processor DEFINITION LOCAL FRIENDS ltcl_html_processor_test. CLASS ltcl_html_processor_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. DATA mv_source TYPE string. DATA mo_cut TYPE REF TO zcl_abapgit_gui_html_processor. DATA mo_gui_mock TYPE REF TO ltcl_gui_mock. METHODS render_html IMPORTING iv_src TYPE string RETURNING VALUE(rv_html) TYPE string. METHODS setup. METHODS process_typical FOR TESTING RAISING zcx_abapgit_exception. METHODS process_with_preserve FOR TESTING RAISING zcx_abapgit_exception. METHODS process_no_css FOR TESTING RAISING zcx_abapgit_exception. METHODS process_fails FOR TESTING RAISING zcx_abapgit_exception. METHODS find_head_closing_tag FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_html_processor_test IMPLEMENTATION. METHOD render_html. rv_html = iv_src. REPLACE ALL OCCURRENCES OF '\n' IN rv_html WITH cl_abap_char_utilities=>newline. ENDMETHOD. METHOD setup. DATA lo_asset_man TYPE REF TO zcl_abapgit_gui_asset_manager. lo_asset_man = NEW #( ). lo_asset_man->register_asset( iv_url = 'css/style1.css' iv_type = 'text/css' iv_inline = 'dummy1' ). lo_asset_man->register_asset( iv_url = 'css/style2.css' iv_type = 'text/css' iv_inline = 'dummy2' ). lo_asset_man->register_asset( iv_url = 'css/style3.css' iv_type = 'text/css' iv_inline = 'dummy3' ). mo_cut = NEW #( ii_asset_man = lo_asset_man ). mo_gui_mock = NEW #( ). mv_source = render_html( `<html>\n` && ` <head>\n` && ` <title>abapGit</title>\n` && ` <LINK rel="stylesheet" type="text/css" href="css/style1.css">\n` && " +case & extra space ` <link rel="stylesheet" type="text/css" href="css/style2.css">\n` && ` <link rel="stylesheet" type="text/css" href="css/style3.css">\n` && ` <script type="text/javascript" src="js/common.js"></script>\n` && ` </head>\n` && ` <body>hello</body>\n` && `</html>\n` ). ENDMETHOD. METHOD process_typical. DATA lv_act TYPE string. lv_act = mo_cut->zif_abapgit_gui_html_processor~process( iv_html = mv_source ii_gui_services = mo_gui_mock ). cl_abap_unit_assert=>assert_equals( act = lv_act exp = render_html( `<html>\n` && ` <head>\n` && ` <title>abapGit</title>\n` && ` <!--<LINK rel="stylesheet" type="text/css" href="css/style1.css">-->\n` && ` <!--<link rel="stylesheet" type="text/css" href="css/style2.css">-->\n` && ` <!--<link rel="stylesheet" type="text/css" href="css/style3.css">-->\n` && ` <script type="text/javascript" src="js/common.js"></script>\n` && ` <!-- abapgit HTML preprocessor -->\n` && ` <link rel="stylesheet" type="text/css" href="css/bundle.css">\n` && ` </head>\n` && ` <body>hello</body>\n` && `</html>\n` ) ). " GUI call checks cl_abap_unit_assert=>assert_equals( act = mo_gui_mock->get_asset( )-url exp = 'css/bundle.css' ). cl_abap_unit_assert=>assert_equals( act = mo_gui_mock->get_asset( )-type exp = 'text/css' ). cl_abap_unit_assert=>assert_equals( act = mo_gui_mock->get_asset( )-data exp = render_html( 'dummy1\ndummy2\ndummy3' ) ). ENDMETHOD. METHOD process_with_preserve. DATA lv_act TYPE string. mo_cut->preserve_css( 'css/style2.css' ). lv_act = mo_cut->zif_abapgit_gui_html_processor~process( iv_html = mv_source ii_gui_services = mo_gui_mock ). cl_abap_unit_assert=>assert_equals( act = lv_act exp = render_html( `<html>\n` && ` <head>\n` && ` <title>abapGit</title>\n` && ` <!--<LINK rel="stylesheet" type="text/css" href="css/style1.css">-->\n` && ` <link rel="stylesheet" type="text/css" href="css/style2.css">\n` && " Preserved ` <!--<link rel="stylesheet" type="text/css" href="css/style3.css">-->\n` && ` <script type="text/javascript" src="js/common.js"></script>\n` && ` <!-- abapgit HTML preprocessor -->\n` && ` <link rel="stylesheet" type="text/css" href="css/bundle.css">\n` && ` </head>\n` && ` <body>hello</body>\n` && `</html>\n` ) ). ENDMETHOD. METHOD process_no_css. DATA lv_act TYPE string. lv_act = mo_cut->zif_abapgit_gui_html_processor~process( iv_html = '<html><head></head></html>' ii_gui_services = mo_gui_mock ). cl_abap_unit_assert=>assert_equals( act = lv_act exp = '<html><head></head></html>' ). ENDMETHOD. METHOD process_fails. TRY. " BTW this is valid HTML, maybe refactor the code ... mo_cut->zif_abapgit_gui_html_processor~process( iv_html = '<html><body></body></html>' ii_gui_services = mo_gui_mock ). cl_abap_unit_assert=>fail( ). CATCH zcx_abapgit_exception ##NO_HANDLER. ENDTRY. ENDMETHOD. METHOD find_head_closing_tag. "given DATA: lv_head_end TYPE i, lv_html TYPE string. lv_html = '<!DOCTYPE html><html><head><title>abapGit</title><link rel="stylesheet" type="text/css" ' && 'href="css/common.css"><link rel="stylesheet" type="text/css" href="css/ag-icons.css">' && '<link rel="stylesheet" type="text/css" href="css/theme-default.css"><script type="text/javascript"' && ' src="js/common.js"></script></head>'. "when TRY. lv_head_end = mo_cut->find_head_offset( iv_html = lv_html ). CATCH zcx_abapgit_exception. cl_abap_unit_assert=>fail( msg = 'HEAD closing tag could not be found' ). ENDTRY. "then cl_abap_unit_assert=>assert_equals( act = lv_head_end exp = 299 msg = 'Head closing tag was not found' ). ENDMETHOD. ENDCLASS.
32.104803
117
0.626768
03e565b5758e9b5a99578e96f4b1c84628148c5c
1,063
abap
ABAP
src/zdop_filter_badi.prog.abap
DogukanP/batch-input-transporting
3f1022f58499dcf394b127ba392d3a0fe58dfb90
[ "MIT" ]
3
2021-12-22T07:35:51.000Z
2022-01-12T13:37:33.000Z
src/zdop_filter_badi.prog.abap
DogukanP/batch-input-transporting
3f1022f58499dcf394b127ba392d3a0fe58dfb90
[ "MIT" ]
null
null
null
src/zdop_filter_badi.prog.abap
DogukanP/batch-input-transporting
3f1022f58499dcf394b127ba392d3a0fe58dfb90
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Report ZDOP_FILTER_BADI *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ZDOP_FILTER_BADI. DATA go_kdv_badi TYPE REF TO zif_ex_dop_filter_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_FILTER_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.
25.926829
72
0.573848
03e7280fa289400bea55b2dac6a3706c20592a43
3,876
abap
ABAP
src/legacy/#dmo#flight_travel_api01.fugr.#dmo#flight_travel_calc_pri_01.abap
SAP-Cloud-Platform/flight01
23e52f647b63e9c70f1bfc524aa46f0f36540795
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api01.fugr.#dmo#flight_travel_calc_pri_01.abap
SAP-Cloud-Platform/flight01
23e52f647b63e9c70f1bfc524aa46f0f36540795
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api01.fugr.#dmo#flight_travel_calc_pri_01.abap
SAP-Cloud-Platform/flight01
23e52f647b63e9c70f1bfc524aa46f0f36540795
[ "BSD-Source-Code" ]
null
null
null
"! <h1>Flight Price Engine</h1> "! "! If no parameters are applied, the price of every flight will be recalculated. "! "! @parameter it_flight | Set of Flights which should be recalculate prices FUNCTION /DMO/FLIGHT_TRAVEL_CALC_PRI_01. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(IT_FLIGHT) TYPE /DMO/IF_FLIGHT_LEGACY01=>TT_FLIGHT *" OPTIONAL *"---------------------------------------------------------------------- TYPES BEGIN OF ty_seats_occupied. INCLUDE TYPE /dmo/flight01. TYPES distance TYPE /dmo/connecti_01-distance. TYPES distance_unit TYPE /dmo/connecti_01-distance_unit. TYPES END OF ty_seats_occupied. TYPES: tt_flight TYPE STANDARD TABLE OF /dmo/flight01 WITH KEY client carrier_id connection_id flight_date. DATA: lt_seats_occupied TYPE TABLE OF ty_seats_occupied. IF it_flight IS SUPPLIED. SELECT FROM /dmo/booking01 AS booking JOIN /dmo/connecti_01 AS connection ON booking~carrier_id = connection~carrier_id AND booking~connection_id = connection~connection_id JOIN /dmo/flight01 AS flight ON booking~carrier_id = flight~carrier_id AND booking~connection_id = flight~connection_id AND booking~flight_date = flight~flight_date JOIN @it_flight AS t ON booking~carrier_id = t~carrier_id AND booking~connection_id = t~connection_id FIELDS booking~carrier_id, booking~connection_id, booking~flight_date, COUNT(*) AS seats_occupied, connection~distance, connection~distance_unit, flight~currency_code, flight~plane_type_id, flight~seats_max, flight~seats_occupied GROUP BY booking~carrier_id, booking~connection_id, booking~flight_date, connection~distance, connection~distance_unit, flight~currency_code, flight~plane_type_id, flight~seats_max, flight~seats_occupied INTO CORRESPONDING FIELDS OF TABLE @lt_seats_occupied. ELSE. SELECT FROM /dmo/booking01 AS booking JOIN /dmo/connecti_01 AS connection ON booking~carrier_id = connection~carrier_id AND booking~connection_id = connection~connection_id JOIN /dmo/flight01 AS flight ON booking~carrier_id = flight~carrier_id AND booking~connection_id = flight~connection_id AND booking~flight_date = flight~flight_date FIELDS booking~carrier_id, booking~connection_id, booking~flight_date, COUNT(*) AS seats_occupied, connection~distance, connection~distance_unit, flight~currency_code, flight~plane_type_id, flight~seats_max, flight~seats_occupied GROUP BY booking~carrier_id, booking~connection_id, booking~flight_date, connection~distance, connection~distance_unit, flight~currency_code, flight~plane_type_id, flight~seats_max, flight~seats_occupied INTO CORRESPONDING FIELDS OF TABLE @lt_seats_occupied. ENDIF. LOOP AT lt_seats_occupied ASSIGNING FIELD-SYMBOL(<seats_occupied>). <seats_occupied>-price = ( ( 3 * ( <seats_occupied>-seats_occupied * 100 DIV <seats_occupied>-seats_max ) ** 2 DIV 400 ) + 25 ) * <seats_occupied>-distance DIV 100. ENDLOOP. UPDATE /dmo/flight01 FROM TABLE @( CORRESPONDING tt_flight( lt_seats_occupied MAPPING carrier_id = carrier_id connection_id = connection_id flight_date = flight_date price = price currency_code = currency_code plane_type_id = plane_type_id seats_max = seats_max seats_occupied = seats_occupied ) ). ENDFUNCTION.
48.45
168
0.651445
03e9048ea900035956837bcb839682894f86d7e2
175
abap
ABAP
src/zdop_lcl_structure_enhancement.enho.067867a7.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
src/zdop_lcl_structure_enhancement.enho.067867a7.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
src/zdop_lcl_structure_enhancement.enho.067867a7.abap
DogukanP/ABAP-SSR
c2019809e7c809235e3a96641f4188d96cdeeebb
[ "Apache-2.0" ]
null
null
null
"Name: \PR:ZDOP_LCL_STRUCTURE_ENHANCEMENT\DA:GS_MARA\SE:END\EI ENHANCEMENT 0 ZDOP_LCL_STRUCTURE_ENHANCEMENT. DATA : mbrsh type mbrsh, meins type meins. ENDENHANCEMENT.
29.166667
62
0.8
03eb82c4ab48850bd12b2398449b87091bb9669c
951
abap
ABAP
src/ui/zaoc_naming.fugr.saplzaoc_naming.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
199
2015-02-17T07:08:01.000Z
2022-03-23T09:50:05.000Z
src/ui/zaoc_naming.fugr.saplzaoc_naming.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
769
2015-01-03T07:09:11.000Z
2022-03-21T11:59:53.000Z
src/ui/zaoc_naming.fugr.saplzaoc_naming.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
109
2015-03-09T10:22:34.000Z
2022-03-08T08:47:41.000Z
******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE lzaoc_namingtop. " Global Declarations INCLUDE lzaoc_naminguxx. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LZAOC_NAMINGF... " Subroutines * INCLUDE LZAOC_NAMINGO... " PBO-Modules * INCLUDE LZAOC_NAMINGI... " PAI-Modules * INCLUDE LZAOC_NAMINGE... " Events * INCLUDE LZAOC_NAMINGP... " Local class implement. * INCLUDE LZAOC_NAMINGT99. " ABAP Unit tests INCLUDE lzaoc_namingf01. INCLUDE lzaoc_namingf02.
50.052632
69
0.390116
03f37de90f4cffc0af466c472573923bc6d6c10d
13,881
abap
ABAP
src/zdemo_excel39.prog.abap
rotda/abap2xlsx
45e11a380943c425a5c8b350e2e506ec3fd46d9c
[ "Apache-2.0" ]
null
null
null
src/zdemo_excel39.prog.abap
rotda/abap2xlsx
45e11a380943c425a5c8b350e2e506ec3fd46d9c
[ "Apache-2.0" ]
null
null
null
src/zdemo_excel39.prog.abap
rotda/abap2xlsx
45e11a380943c425a5c8b350e2e506ec3fd46d9c
[ "Apache-2.0" ]
null
null
null
*&---------------------------------------------------------------------* *& Report ZDEMO_EXCEL16 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zdemo_excel39. DATA: lo_excel TYPE REF TO zcl_excel, lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_drawing TYPE REF TO zcl_excel_drawing. DATA lv_value TYPE i. DATA: ls_io TYPE skwf_io. DATA: ls_upper TYPE zexcel_drawing_location, ls_lower TYPE zexcel_drawing_location. DATA: lo_bar1 TYPE REF TO zcl_excel_graph_bars, lo_bar1_stacked TYPE REF TO zcl_excel_graph_bars, lo_bar2 TYPE REF TO zcl_excel_graph_bars, lo_pie TYPE REF TO zcl_excel_graph_pie, lo_line TYPE REF TO zcl_excel_graph_line. CONSTANTS: gc_save_file_name TYPE string VALUE '39_Charts.xlsx'. INCLUDE zdemo_excel_outputopt_incl. START-OF-SELECTION. " Create a pie chart and series CREATE OBJECT lo_pie. CALL METHOD lo_pie->create_serie EXPORTING ip_order = 0 ip_sheet = 'Values' ip_lbl_from_col = 'B' ip_lbl_from_row = '1' ip_lbl_to_col = 'B' ip_lbl_to_row = '3' ip_ref_from_col = 'A' ip_ref_from_row = '1' ip_ref_to_col = 'A' ip_ref_to_row = '3' ip_sername = 'My serie 1'. " Set style lo_pie->set_style( zcl_excel_graph=>c_style_15 ). " Create a bar chart, series and axes CREATE OBJECT lo_bar1. CALL METHOD lo_bar1->create_serie EXPORTING ip_order = 0 ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no ip_lbl = 'Values!$D$1:$D$3' ip_ref = 'Values!$C$1:$C$3' ip_sername = 'My serie 1'. CALL METHOD lo_bar1->create_serie EXPORTING ip_order = 1 ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no ip_lbl = 'Values!$B$1:$B$3' ip_ref = 'Values!$A$1:$A$3' ip_sername = 'My serie 2'. CALL METHOD lo_bar1->create_ax EXPORTING * ip_axid = ip_type = zcl_excel_graph_bars=>c_catax * ip_orientation = * ip_delete = * ip_axpos = * ip_formatcode = * ip_sourcelinked = * ip_majortickmark = * ip_minortickmark = * ip_ticklblpos = * ip_crossax = * ip_crosses = * ip_auto = * ip_lblalgn = * ip_lbloffset = * ip_nomultilvllbl = * ip_crossbetween = . CALL METHOD lo_bar1->create_ax EXPORTING * ip_axid = ip_type = zcl_excel_graph_bars=>c_valax * ip_orientation = * ip_delete = * ip_axpos = * ip_formatcode = * ip_sourcelinked = * ip_majortickmark = * ip_minortickmark = * ip_ticklblpos = * ip_crossax = * ip_crosses = * ip_auto = * ip_lblalgn = * ip_lbloffset = * ip_nomultilvllbl = * ip_crossbetween = . " Set style lo_bar1->set_style( zcl_excel_graph=>c_style_default ). lo_bar1->set_title( ip_value = 'TITLE!' ). " Set label to none lo_bar1->set_print_lbl( zcl_excel_graph_bars=>c_show_false ). * Same barchart - but this time stacked CREATE OBJECT lo_bar1_stacked. CALL METHOD lo_bar1_stacked->create_serie EXPORTING ip_order = 0 ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no ip_lbl = 'Values!$D$1:$D$3' ip_ref = 'Values!$C$1:$C$3' ip_sername = 'My serie 1'. CALL METHOD lo_bar1_stacked->create_serie EXPORTING ip_order = 1 ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_no ip_lbl = 'Values!$B$1:$B$3' ip_ref = 'Values!$A$1:$A$3' ip_sername = 'My serie 2'. CALL METHOD lo_bar1_stacked->create_ax EXPORTING ip_type = zcl_excel_graph_bars=>c_catax . CALL METHOD lo_bar1_stacked->create_ax EXPORTING ip_type = zcl_excel_graph_bars=>c_valax. " Set style lo_bar1_stacked->set_style( zcl_excel_graph=>c_style_default ). " Set label to none lo_bar1_stacked->set_print_lbl( zcl_excel_graph_bars=>c_show_false ). " Make it stacked lo_bar1_stacked->ns_groupingval = zcl_excel_graph_bars=>c_groupingval_stacked. " Create a bar chart, series and axes CREATE OBJECT lo_bar2. CALL METHOD lo_bar2->create_serie EXPORTING ip_order = 0 ip_invertifnegative = zcl_excel_graph_bars=>c_invertifnegative_yes ip_lbl = 'Values!$D$1:$D$3' ip_ref = 'Values!$C$1:$C$3' ip_sername = 'My serie 1'. CALL METHOD lo_bar2->create_ax EXPORTING * ip_axid = ip_type = zcl_excel_graph_bars=>c_catax * ip_orientation = * ip_delete = * ip_axpos = * ip_formatcode = * ip_sourcelinked = * ip_majortickmark = * ip_minortickmark = * ip_ticklblpos = * ip_crossax = * ip_crosses = * ip_auto = * ip_lblalgn = * ip_lbloffset = * ip_nomultilvllbl = * ip_crossbetween = . CALL METHOD lo_bar2->create_ax EXPORTING * ip_axid = ip_type = zcl_excel_graph_bars=>c_valax * ip_orientation = * ip_delete = * ip_axpos = * ip_formatcode = * ip_sourcelinked = * ip_majortickmark = * ip_minortickmark = * ip_ticklblpos = * ip_crossax = * ip_crosses = * ip_auto = * ip_lblalgn = * ip_lbloffset = * ip_nomultilvllbl = * ip_crossbetween = . " Set layout lo_bar2->set_show_legend_key( zcl_excel_graph_bars=>c_show_true ). lo_bar2->set_show_values( zcl_excel_graph_bars=>c_show_true ). lo_bar2->set_show_cat_name( zcl_excel_graph_bars=>c_show_true ). lo_bar2->set_show_ser_name( zcl_excel_graph_bars=>c_show_true ). lo_bar2->set_show_percent( zcl_excel_graph_bars=>c_show_true ). lo_bar2->set_varycolor( zcl_excel_graph_bars=>c_show_true ). " Create a line chart, series and axes CREATE OBJECT lo_line. CALL METHOD lo_line->create_serie EXPORTING ip_order = 0 ip_symbol = zcl_excel_graph_line=>c_symbol_auto ip_smooth = zcl_excel_graph_line=>c_show_false ip_lbl = 'Values!$D$1:$D$3' ip_ref = 'Values!$C$1:$C$3' ip_sername = 'My serie 1'. CALL METHOD lo_line->create_serie EXPORTING ip_order = 1 ip_symbol = zcl_excel_graph_line=>c_symbol_none ip_smooth = zcl_excel_graph_line=>c_show_false ip_lbl = 'Values!$B$1:$B$3' ip_ref = 'Values!$A$1:$A$3' ip_sername = 'My serie 2'. CALL METHOD lo_line->create_serie EXPORTING ip_order = 2 ip_symbol = zcl_excel_graph_line=>c_symbol_auto ip_smooth = zcl_excel_graph_line=>c_show_false ip_lbl = 'Values!$F$1:$F$3' ip_ref = 'Values!$E$1:$E$3' ip_sername = 'My serie 3'. CALL METHOD lo_line->create_ax EXPORTING * ip_axid = ip_type = zcl_excel_graph_line=>c_catax * ip_orientation = * ip_delete = * ip_axpos = * ip_majortickmark = * ip_minortickmark = * ip_ticklblpos = * ip_crossax = * ip_crosses = * ip_auto = * ip_lblalgn = * ip_lbloffset = * ip_nomultilvllbl = * ip_crossbetween = . CALL METHOD lo_line->create_ax EXPORTING * ip_axid = ip_type = zcl_excel_graph_line=>c_valax * ip_orientation = * ip_delete = * ip_axpos = * ip_formatcode = * ip_sourcelinked = * ip_majortickmark = * ip_minortickmark = * ip_ticklblpos = * ip_crossax = * ip_crosses = * ip_auto = * ip_lblalgn = * ip_lbloffset = * ip_nomultilvllbl = * ip_crossbetween = . " Creates active sheet CREATE OBJECT lo_excel. " Get active sheet (Pie sheet) lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet->set_title( 'PieChart' ). " Create global drawing, set type as pie chart, assign chart, set position and media type lo_drawing = lo_worksheet->excel->add_new_drawing( ip_type = zcl_excel_drawing=>type_chart ip_title = 'CHART PIE' ). lo_drawing->graph = lo_pie. lo_drawing->graph_type = zcl_excel_drawing=>c_graph_pie. "Set chart position (anchor 2 cells) ls_lower-row = 30. ls_lower-col = 20. lo_drawing->set_position2( EXPORTING ip_from = ls_upper ip_to = ls_lower ). lo_drawing->set_media( EXPORTING ip_media_type = zcl_excel_drawing=>c_media_type_xml ). lo_worksheet->add_drawing( lo_drawing ). " BarChart1 sheet lo_worksheet = lo_excel->add_new_worksheet( ). lo_worksheet->set_title( ip_title = 'BarChart1' ). " Create global drawing, set type as bar chart, assign chart, set position and media type lo_drawing = lo_worksheet->excel->add_new_drawing( ip_type = zcl_excel_drawing=>type_chart ip_title = 'CHART BARS WITH 2 SERIES' ). lo_drawing->graph = lo_bar1. lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. "Set chart position (anchor 2 cells) ls_upper-row = 0. ls_upper-col = 11. ls_lower-row = 22. ls_lower-col = 21. lo_drawing->set_position2( EXPORTING ip_from = ls_upper ip_to = ls_lower ). lo_drawing->set_media( EXPORTING ip_media_type = zcl_excel_drawing=>c_media_type_xml ). lo_worksheet->add_drawing( lo_drawing ). lo_drawing = lo_worksheet->excel->add_new_drawing( ip_type = zcl_excel_drawing=>type_chart ip_title = 'Stacked CHART BARS WITH 2 SER.' ). lo_drawing->graph = lo_bar1_stacked. lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. "Set chart position (anchor 2 cells) ls_upper-row = 0. ls_upper-col = 1. ls_lower-row = 22. ls_lower-col = 10. lo_drawing->set_position2( EXPORTING ip_from = ls_upper ip_to = ls_lower ). lo_drawing->set_media( EXPORTING ip_media_type = zcl_excel_drawing=>c_media_type_xml ). lo_worksheet->add_drawing( lo_drawing ). " BarChart2 sheet lo_worksheet = lo_excel->add_new_worksheet( ). lo_worksheet->set_title( ip_title = 'BarChart2' ). " Create global drawing, set type as bar chart, assign chart, set position and media type lo_drawing = lo_worksheet->excel->add_new_drawing( ip_type = zcl_excel_drawing=>type_chart ip_title = 'CHART BARS WITH 1 SERIE' ). lo_drawing->graph = lo_bar2. lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars. "Set chart position (anchor 2 cells) ls_upper-row = 0. ls_upper-col = 0. ls_lower-row = 30. ls_lower-col = 20. lo_drawing->set_position2( EXPORTING ip_from = ls_upper ip_to = ls_lower ). lo_drawing->set_media( EXPORTING ip_media_type = zcl_excel_drawing=>c_media_type_xml ). lo_worksheet->add_drawing( lo_drawing ). " LineChart sheet lo_worksheet = lo_excel->add_new_worksheet( ). lo_worksheet->set_title( ip_title = 'LineChart' ). " Create global drawing, set type as line chart, assign chart, set position and media type lo_drawing = lo_worksheet->excel->add_new_drawing( ip_type = zcl_excel_drawing=>type_chart ip_title = 'CHART LINES' ). lo_drawing->graph = lo_line. lo_drawing->graph_type = zcl_excel_drawing=>c_graph_line. "Set chart position (anchor 2 cells) ls_upper-row = 0. ls_upper-col = 0. ls_lower-row = 30. ls_lower-col = 20. lo_drawing->set_position2( EXPORTING ip_from = ls_upper ip_to = ls_lower ). lo_drawing->set_media( EXPORTING ip_media_type = zcl_excel_drawing=>c_media_type_xml ). lo_worksheet->add_drawing( lo_drawing ). " Values sheet lo_worksheet = lo_excel->add_new_worksheet( ). lo_worksheet->set_title( ip_title = 'Values' ). " Set values for chart lv_value = 1. lo_worksheet->set_cell( ip_column = 'A' ip_row = 1 ip_value = lv_value ). lv_value = 2. lo_worksheet->set_cell( ip_column = 'A' ip_row = 2 ip_value = lv_value ). lv_value = 3. lo_worksheet->set_cell( ip_column = 'A' ip_row = 3 ip_value = lv_value ). " Set labels for chart lo_worksheet->set_cell( ip_column = 'B' ip_row = 1 ip_value = 'One' ). lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Two' ). lo_worksheet->set_cell( ip_column = 'B' ip_row = 3 ip_value = 'Three' ). " Set values for chart lv_value = 3. lo_worksheet->set_cell( ip_column = 'C' ip_row = 1 ip_value = lv_value ). lv_value = 2. lo_worksheet->set_cell( ip_column = 'C' ip_row = 2 ip_value = lv_value ). lv_value = -1. lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = lv_value ). " Set labels for chart lo_worksheet->set_cell( ip_column = 'D' ip_row = 3 ip_value = 'One (Minus)' ). lo_worksheet->set_cell( ip_column = 'D' ip_row = 2 ip_value = 'Two' ). lo_worksheet->set_cell( ip_column = 'D' ip_row = 1 ip_value = 'Three' ). " Set values for chart lv_value = 3. lo_worksheet->set_cell( ip_column = 'E' ip_row = 1 ip_value = lv_value ). lv_value = 1. lo_worksheet->set_cell( ip_column = 'E' ip_row = 2 ip_value = lv_value ). lv_value = 2. lo_worksheet->set_cell( ip_column = 'E' ip_row = 3 ip_value = lv_value ). " Set labels for chart lo_worksheet->set_cell( ip_column = 'F' ip_row = 3 ip_value = 'Two' ). lo_worksheet->set_cell( ip_column = 'F' ip_row = 2 ip_value = 'One' ). lo_worksheet->set_cell( ip_column = 'F' ip_row = 1 ip_value = 'Three' ). *** Create output lcl_output=>output( lo_excel ).
29.223158
92
0.628773
03f491c4e1d4e870955eab17a3b76db1e32a8acf
4,150
abap
ABAP
src/zcl_minesweeper.clas.testclasses.abap
pokrakam/exercism-test
0003ffe4ea182945053d96c3bcf174338f3d4395
[ "MIT" ]
null
null
null
src/zcl_minesweeper.clas.testclasses.abap
pokrakam/exercism-test
0003ffe4ea182945053d96c3bcf174338f3d4395
[ "MIT" ]
3
2022-01-08T08:03:49.000Z
2022-03-23T10:46:22.000Z
src/zcl_minesweeper.clas.testclasses.abap
pokrakam/exercism-test
0003ffe4ea182945053d96c3bcf174338f3d4395
[ "MIT" ]
1
2022-01-08T07:51:14.000Z
2022-01-08T07:51:14.000Z
CLASS ltc_test DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA cut TYPE REF TO zcl_minesweeper. METHODS setup. METHODS assert_that IMPORTING input TYPE string_table output TYPE string_table. METHODS no_rows FOR TESTING RAISING cx_static_check. METHODS no_columns FOR TESTING RAISING cx_static_check. METHODS no_mines FOR TESTING RAISING cx_static_check. METHODS only_mines FOR TESTING RAISING cx_static_check. METHODS mine_surrounded_by_spaces FOR TESTING RAISING cx_static_check. METHODS space_surrounded_by_mines FOR TESTING RAISING cx_static_check. METHODS horizontal_line FOR TESTING RAISING cx_static_check. METHODS horizontal_line_mines_at_ends FOR TESTING RAISING cx_static_check. METHODS vertical_line FOR TESTING RAISING cx_static_check. METHODS vertical_line_mines_at_ends FOR TESTING RAISING cx_static_check. METHODS cross FOR TESTING RAISING cx_static_check. METHODS large_minefield FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltc_test IMPLEMENTATION. METHOD setup. CREATE OBJECT cut. ENDMETHOD. METHOD no_rows. assert_that( input = VALUE #( ) output = VALUE #( ) ). ENDMETHOD. METHOD no_columns. assert_that( input = VALUE #( ( ) ) output = VALUE #( ( ) ) ). ENDMETHOD. METHOD no_mines. assert_that( input = VALUE #( ( ` ` ) ( ` ` ) ( ` ` ) ) output = VALUE #( ( ` ` ) ( ` ` ) ( ` ` ) ) ). ENDMETHOD. METHOD only_mines. assert_that( input = VALUE #( ( `***` ) ( `***` ) ( `***` ) ) output = VALUE #( ( `***` ) ( `***` ) ( `***` ) ) ). ENDMETHOD. METHOD mine_surrounded_by_spaces. assert_that( input = VALUE #( ( ` ` ) ( ` * ` ) ( ` ` ) ) output = VALUE #( ( `111` ) ( `1*1` ) ( `111` ) ) ). ENDMETHOD. METHOD space_surrounded_by_mines. assert_that( input = VALUE #( ( `***` ) ( `* *` ) ( `***` ) ) output = VALUE #( ( `***` ) ( `*8*` ) ( `***` ) ) ). ENDMETHOD. METHOD horizontal_line. assert_that( input = VALUE #( ( ` * * ` ) ) output = VALUE #( ( `1*2*1` ) ) ). ENDMETHOD. METHOD horizontal_line_mines_at_ends. assert_that( input = VALUE #( ( `* *` ) ) output = VALUE #( ( `*1 1*` ) ) ). ENDMETHOD. METHOD vertical_line. assert_that( input = VALUE #( ( ` ` ) ( `*` ) ( ` ` ) ( `*` ) ( ` ` ) ) output = VALUE #( ( `1` ) ( `*` ) ( `2` ) ( `*` ) ( `1` ) ) ). ENDMETHOD. METHOD vertical_line_mines_at_ends. assert_that( input = VALUE #( ( `*` ) ( ` ` ) ( ` ` ) ( ` ` ) ( `*` ) ) output = VALUE #( ( `*` ) ( `1` ) ( ` ` ) ( `1` ) ( `*` ) ) ). ENDMETHOD. METHOD cross. assert_that( input = VALUE #( ( ` * ` ) ( ` * ` ) ( `*****` ) ( ` * ` ) ( ` * ` ) ) output = VALUE #( ( ` 2*2 ` ) ( `25*52` ) ( `*****` ) ( `25*52` ) ( ` 2*2 ` ) ) ). ENDMETHOD. METHOD large_minefield. assert_that( input = VALUE #( ( ` * * ` ) ( ` * ` ) ( ` * ` ) ( ` * *` ) ( ` * * ` ) ( ` ` ) ) output = VALUE #( ( `1*22*1` ) ( `12*322` ) ( ` 123*2` ) ( `112*4*` ) ( `1*22*2` ) ( `111111` ) ) ). ENDMETHOD. METHOD assert_that. DATA(act) = cut->annotate( input ). cl_abap_unit_assert=>assert_equals( act = act exp = output ). ENDMETHOD. ENDCLASS.
21.614583
78
0.442651
03f73905630b3cb8d60d4eb5cf6d160b66a47be1
14,112
abap
ABAP
ZCX_RETURN3_750.abap
f4abap/zcx_return3
aed7a324b99f63fb2779b2e91147429d81ab5a6b
[ "MIT" ]
9
2020-06-14T18:52:02.000Z
2022-03-08T10:19:25.000Z
ZCX_RETURN3_750.abap
f4abap/zcx_return3
aed7a324b99f63fb2779b2e91147429d81ab5a6b
[ "MIT" ]
6
2020-06-14T18:56:23.000Z
2021-11-06T13:46:45.000Z
ZCX_RETURN3_750.abap
f4abap/zcx_return3
aed7a324b99f63fb2779b2e91147429d81ab5a6b
[ "MIT" ]
7
2020-10-08T12:34:08.000Z
2022-01-20T16:31:26.000Z
CLASS zcx_return3 DEFINITION PUBLIC INHERITING FROM cx_static_check CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_t100_message . INTERFACES if_t100_dyn_msg . ALIASES msgty FOR if_t100_dyn_msg~msgty . TYPES: gtt_bapireturn_t TYPE STANDARD TABLE OF bapireturn WITH DEFAULT KEY . TYPES: gtt_bdc_messages TYPE STANDARD TABLE OF bdcmsgcoll WITH DEFAULT KEY . METHODS constructor IMPORTING !textid LIKE if_t100_message=>t100key OPTIONAL !previous LIKE previous OPTIONAL !gt_return TYPE bapiret2_t OPTIONAL !msgty TYPE symsgty OPTIONAL . METHODS has_messages RETURNING VALUE(rv_has_messages) TYPE abap_bool. METHODS get_bapiret2_struc RETURNING VALUE(rs_bapiret2) TYPE bapiret2 . METHODS get_bapiret2_table RETURNING VALUE(rt_bapiret2) TYPE bapiret2_t . METHODS add_system_message IMPORTING !iv_field_name TYPE bapi_fld OPTIONAL . METHODS add_message_and_text_var IMPORTING !iv_type TYPE bapi_mtype !iv_id TYPE symsgid !iv_number TYPE symsgno !iv_text_variable TYPE char200 . METHODS add_exception_object IMPORTING !ir_exception_object TYPE REF TO cx_root. METHODS add_bapireturn_struc IMPORTING !is_bapireturn TYPE bapireturn . METHODS add_bapireturn_table IMPORTING !it_return TYPE gtt_bapireturn_t . METHODS add_bapiret1_struc IMPORTING !is_return TYPE bapiret1 . METHODS add_bapiret1_table IMPORTING !it_return TYPE bapiret1_tab . METHODS add_bapiret2_struc IMPORTING !is_return TYPE bapiret2 . METHODS add_bapiret2_table IMPORTING !it_return TYPE bapiret2_t . METHODS add_bdc_table IMPORTING !it_bdc_messages TYPE gtt_bdc_messages. METHODS add_text IMPORTING !iv_type TYPE bapi_mtype DEFAULT 'E' !iv_message TYPE bapi_msg !iv_variable_1 TYPE symsgv !iv_variable_2 TYPE symsgv !iv_variable_3 TYPE symsgv !iv_variable_4 TYPE symsgv . * PROTECTED SECTION. DATA gt_return TYPE bapiret2_t . METHODS map_text_var_to_bapiret2 IMPORTING !iv_type TYPE bapi_mtype !iv_id TYPE symsgid !iv_number TYPE symsgno !iv_text TYPE char200 RETURNING VALUE(rs_bapiret2) TYPE bapiret2 . METHODS map_bapireturn_to_bapiret2 IMPORTING !is_bapireturn TYPE bapireturn RETURNING VALUE(rs_bapiret2) TYPE bapiret2 . METHODS map_bapiret1_to_bapiret2 IMPORTING !is_bapireturn TYPE bapiret1 RETURNING VALUE(rs_bapiret2) TYPE bapiret2 . CLASS-METHODS map_bdc_to_bapiret2 IMPORTING !is_bdc_message TYPE bdcmsgcoll RETURNING VALUE(rs_bapiret2) TYPE bapiret2 . PRIVATE SECTION. ENDCLASS. CLASS zcx_return3 IMPLEMENTATION. METHOD constructor ##ADT_SUPPRESS_GENERATION. CALL METHOD super->constructor EXPORTING previous = previous. me->msgty = msgty . CLEAR me->textid. IF textid IS INITIAL. if_t100_message~t100key = if_t100_message=>default_textid. ELSE. if_t100_message~t100key = textid. ENDIF. ENDMETHOD. METHOD has_messages. IF gt_return[] IS NOT INITIAL. rv_has_messages = abap_true. ENDIF. ENDMETHOD. METHOD get_bapiret2_struc. IF gt_return[] IS INITIAL. IF if_t100_message~t100key-msgid = if_t100_message~default_textid-msgid AND if_t100_message~t100key-msgno = if_t100_message~default_textid-msgno. CLEAR if_t100_message~t100key. ENDIF. IF if_t100_message~t100key IS NOT INITIAL. MESSAGE ID if_t100_message~t100key-msgid TYPE msgty NUMBER if_t100_message~t100key-msgno WITH if_t100_dyn_msg~msgv1 if_t100_dyn_msg~msgv2 if_t100_dyn_msg~msgv3 if_t100_dyn_msg~msgv4 INTO DATA(lv_message). DATA(ls_bapiret2) = VALUE bapiret2( type = msgty id = if_t100_message~t100key-msgid number = if_t100_message~t100key-msgno message = lv_message message_v1 = if_t100_dyn_msg~msgv1 message_v2 = if_t100_dyn_msg~msgv2 message_v3 = if_t100_dyn_msg~msgv3 message_v4 = if_t100_dyn_msg~msgv4 ). APPEND ls_bapiret2 TO gt_return. ENDIF. ENDIF. READ TABLE gt_return INTO rs_bapiret2 INDEX 1. ENDMETHOD. METHOD get_bapiret2_table. IF gt_return[] IS INITIAL. DATA(ls_bapiret2) = get_bapiret2_struc( ). APPEND ls_bapiret2 TO rt_bapiret2. ELSE. rt_bapiret2 = gt_return. ENDIF. ENDMETHOD. METHOD add_system_message. DATA: ls_return TYPE bapiret2. ls_return-type = sy-msgty. ls_return-id = sy-msgid. ls_return-number = sy-msgno. ls_return-message_v1 = sy-msgv1. ls_return-message_v2 = sy-msgv2. ls_return-message_v3 = sy-msgv3. ls_return-message_v4 = sy-msgv4. ls_return-field = iv_field_name. add_bapiret2_struc( ls_return ). ENDMETHOD. METHOD add_message_and_text_var. DATA(ls_bapiret2) = map_text_var_to_bapiret2( iv_type = iv_type iv_id = iv_id iv_number = iv_number iv_text = iv_text_variable ). me->add_bapiret2_struc( ls_bapiret2 ). ENDMETHOD. METHOD add_exception_object. "******************************************************** "Split message text string into variables of length 50 DATA(lv_text) = ir_exception_object->get_text( ). DATA: BEGIN OF ls_variables, msgv1(50), msgv2(50), msgv3(50), msgv4(50), END OF ls_variables. ls_variables = lv_text. "******************************************************** "Add message DATA: ls_bapiret2 TYPE bapiret2. ls_bapiret2-type = sy-msgty. ls_bapiret2-id = sy-msgid. ls_bapiret2-number = sy-msgno. ls_bapiret2-message_v1 = ls_variables-msgv1. ls_bapiret2-message_v2 = ls_variables-msgv2. ls_bapiret2-message_v3 = ls_variables-msgv3. ls_bapiret2-message_v4 = ls_variables-msgv4. add_bapiret2_struc( ls_bapiret2 ). ENDMETHOD. METHOD add_bapireturn_struc. DATA(ls_bapiret2) = map_bapireturn_to_bapiret2( is_bapireturn ). me->add_bapiret2_struc( ls_bapiret2 ). ENDMETHOD. METHOD add_bapireturn_table. LOOP AT it_return ASSIGNING FIELD-SYMBOL(<ls_return>). add_bapireturn_struc( <ls_return> ). ENDLOOP. ENDMETHOD. METHOD add_bapiret1_struc. DATA(ls_bapiret2_struc) = map_bapiret1_to_bapiret2( is_return ). add_bapiret2_struc( ls_bapiret2_struc ). ENDMETHOD. METHOD add_bapiret1_table. LOOP AT it_return ASSIGNING FIELD-SYMBOL(<ls_return>). add_bapiret1_struc( <ls_return> ). ENDLOOP. ENDMETHOD. METHOD add_bapiret2_struc. "Update GT_RETURN if instantiated by RAISE EXCEPTION. get_bapiret2_struc( ). IF is_return-type CA 'EAX'. DATA(ls_return) = is_return. IF ls_return-id IS NOT INITIAL. MESSAGE ID ls_return-id TYPE ls_return-type NUMBER ls_return-number WITH ls_return-message_v1 ls_return-message_v2 ls_return-message_v3 ls_return-message_v4 INTO ls_return-message. ENDIF. APPEND ls_return TO gt_return. ENDIF. IF lines( gt_return ) = 1. msgty = is_return-type. if_t100_dyn_msg~msgv1 = is_return-message_v1. if_t100_dyn_msg~msgv2 = is_return-message_v2. if_t100_dyn_msg~msgv3 = is_return-message_v3. if_t100_dyn_msg~msgv4 = is_return-message_v4. if_t100_message~t100key-msgid = is_return-id. if_t100_message~t100key-msgno = is_return-number. IF if_t100_dyn_msg~msgv1 IS NOT INITIAL. if_t100_message~t100key-attr1 = 'IF_T100_DYN_MSG~MSGV1'. ENDIF. IF if_t100_dyn_msg~msgv2 IS NOT INITIAL. if_t100_message~t100key-attr2 = 'IF_T100_DYN_MSG~MSGV2'. ENDIF. IF if_t100_dyn_msg~msgv3 IS NOT INITIAL. if_t100_message~t100key-attr3 = 'IF_T100_DYN_MSG~MSGV3'. ENDIF. IF if_t100_dyn_msg~msgv4 IS NOT INITIAL. if_t100_message~t100key-attr4 = 'IF_T100_DYN_MSG~MSGV4'. ENDIF. ENDIF. ENDMETHOD. METHOD add_bdc_table. DATA lt_bapiret2 TYPE bapiret2_t. LOOP AT it_bdc_messages ASSIGNING FIELD-SYMBOL(<ls_bdc_message>). APPEND INITIAL LINE TO lt_bapiret2 ASSIGNING FIELD-SYMBOL(<ls_bapiret2>). <ls_bapiret2> = map_bdc_to_bapiret2( <ls_bdc_message> ). ENDLOOP. ENDMETHOD. METHOD add_bapiret2_table. LOOP AT it_return ASSIGNING FIELD-SYMBOL(<ls_return>). add_bapiret2_struc( <ls_return> ). ENDLOOP. ENDMETHOD. METHOD add_text. "Example: "IV_TYPE = 'E' "IV_MESSAGE = 'Sales order &1 not found.' "IV_VARIABLE_1 = '100001 "IV_VARIABLE_2 = '' "IV_VARIABLE_3 = '' "IV_VARIABLE_4 = '' DATA: lv_message TYPE bapi_msg, ls_return TYPE bapiret2. lv_message = iv_message. DO 4 TIMES. DATA lv_placeholder_name TYPE c LENGTH 2. DATA lv_variable_name TYPE c LENGTH 15. lv_placeholder_name = '&' && sy-index. lv_variable_name = 'iv_variable_' && sy-index. ASSIGN (lv_variable_name) TO FIELD-SYMBOL(<lv_variable>). REPLACE ALL OCCURRENCES OF lv_placeholder_name IN lv_message WITH <lv_variable> IN CHARACTER MODE. DATA lv_return_var_name TYPE c LENGTH 15. lv_return_var_name = 'MESSAGE_V' && sy-index. ASSIGN COMPONENT lv_return_var_name OF STRUCTURE ls_return TO FIELD-SYMBOL(<lv_return_variable>). <lv_return_variable> = <lv_variable>. ENDDO. ls_return-type = iv_type. ls_return-message = lv_message. add_bapiret2_struc( ls_return ). ENDMETHOD. METHOD map_text_var_to_bapiret2. "*************************************************** " Convert text to variables "*************************************************** rs_bapiret2-type = iv_type. rs_bapiret2-id = iv_id. rs_bapiret2-number = iv_number. "*************************************************** " Convert text to variables "*************************************************** TYPES: BEGIN OF ltv_variable, text TYPE c LENGTH 50, END OF ltv_variable. DATA: lv_text_string TYPE string, lt_text TYPE STANDARD TABLE OF ltv_variable. lv_text_string = iv_text. CALL FUNCTION 'CONVERT_STRING_TO_TABLE' EXPORTING i_string = lv_text_string i_tabline_length = 50 TABLES et_table = lt_text. LOOP AT lt_text ASSIGNING FIELD-SYMBOL(<ls_variable>). CASE sy-tabix. WHEN 1. rs_bapiret2-message_v1 = <ls_variable>-text. WHEN 2. rs_bapiret2-message_v2 = <ls_variable>-text. WHEN 3. rs_bapiret2-message_v3 = <ls_variable>-text. WHEN 4. rs_bapiret2-message_v4 = <ls_variable>-text. ENDCASE. ENDLOOP. ENDMETHOD. METHOD map_bapireturn_to_bapiret2. rs_bapiret2-type = is_bapireturn-type. "Example value field code: IS504 rs_bapiret2-id = is_bapireturn-code+0(2). rs_bapiret2-number = is_bapireturn-code+2(3). rs_bapiret2-message = is_bapireturn-message. rs_bapiret2-log_no = is_bapireturn-log_no. rs_bapiret2-log_msg_no = is_bapireturn-log_msg_no. rs_bapiret2-message_v1 = is_bapireturn-message_v1. rs_bapiret2-message_v2 = is_bapireturn-message_v2. rs_bapiret2-message_v3 = is_bapireturn-message_v3. rs_bapiret2-message_v4 = is_bapireturn-message_v4. ENDMETHOD. METHOD map_bapiret1_to_bapiret2. rs_bapiret2-type = is_bapireturn-type. rs_bapiret2-id = is_bapireturn-id. rs_bapiret2-number = is_bapireturn-number. rs_bapiret2-message = is_bapireturn-message. rs_bapiret2-log_no = is_bapireturn-log_no. rs_bapiret2-log_msg_no = is_bapireturn-log_msg_no. rs_bapiret2-message_v1 = is_bapireturn-message_v1. rs_bapiret2-message_v2 = is_bapireturn-message_v2. rs_bapiret2-message_v3 = is_bapireturn-message_v3. rs_bapiret2-message_v4 = is_bapireturn-message_v4. ENDMETHOD. METHOD map_bdc_to_bapiret2. rs_bapiret2-type = is_bdc_message-msgtyp. rs_bapiret2-id = is_bdc_message-msgid. rs_bapiret2-number = is_bdc_message-msgnr. rs_bapiret2-message_v1 = is_bdc_message-msgv1. rs_bapiret2-message_v2 = is_bdc_message-msgv2. rs_bapiret2-message_v3 = is_bdc_message-msgv3. rs_bapiret2-message_v4 = is_bdc_message-msgv4. MESSAGE ID rs_bapiret2-id TYPE rs_bapiret2-type NUMBER rs_bapiret2-number WITH rs_bapiret2-message_v1 rs_bapiret2-message_v2 rs_bapiret2-message_v3 rs_bapiret2-message_v4 INTO rs_bapiret2-message. ENDMETHOD. ENDCLASS.
24.976991
82
0.614867
03f770a6c15b3f3f220be3b169d6dc0fefd1ff67
1,541
abap
ABAP
src/#usi#bal_exceptions/#usi#cx_bal_not_allowed.clas.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_exceptions/#usi#cx_bal_not_allowed.clas.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_exceptions/#usi#cx_bal_not_allowed.clas.abap
SchwarzIT/sap-usi-logging-api
35eab62618409a75987fa90c655b00a98b5dbe76
[ "Apache-2.0" ]
null
null
null
class /USI/CX_BAL_NOT_ALLOWED definition public inheriting from /USI/CX_BAL_ROOT create public . public section. constants: begin of WRONG_LOGGER_STATE, msgid type symsgid value '/USI/BAL', msgno type symsgno value '018', attr1 type scx_attrname value '', attr2 type scx_attrname value '', attr3 type scx_attrname value '', attr4 type scx_attrname value '', end of WRONG_LOGGER_STATE . constants: begin of ONLY_OWNER_MAY_DO_THAT, msgid type symsgid value '/USI/BAL', msgno type symsgno value '030', attr1 type scx_attrname value '', attr2 type scx_attrname value '', attr3 type scx_attrname value '', attr4 type scx_attrname value '', end of ONLY_OWNER_MAY_DO_THAT . methods CONSTRUCTOR importing !TEXTID like IF_T100_MESSAGE=>T100KEY optional !PREVIOUS like PREVIOUS optional !PARAM1 type SYMSGV optional !PARAM2 type SYMSGV optional !PARAM3 type SYMSGV optional !PARAM4 type SYMSGV optional !DETAILS type ref to /USI/IF_EXCEPTION_DETAILS optional . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /USI/CX_BAL_NOT_ALLOWED IMPLEMENTATION. method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING PREVIOUS = PREVIOUS PARAM1 = PARAM1 PARAM2 = PARAM2 PARAM3 = PARAM3 PARAM4 = PARAM4 DETAILS = DETAILS . 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.
24.460317
63
0.719014
03fac8ef664926b2fdb081c72aa95b3e8ecbdffa
4,930
abap
ABAP
src/objects/zcl_abapgit_object_styl.clas.abap
sb-sap/abapGit
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_styl.clas.abap
sb-sap/abapGit
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_styl.clas.abap
sb-sap/abapGit
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_styl DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. PRIVATE SECTION. TYPES: BEGIN OF ty_style, header TYPE itcda, paragraphs TYPE STANDARD TABLE OF itcdp WITH DEFAULT KEY, strings TYPE STANDARD TABLE OF itcds WITH DEFAULT KEY, tabs TYPE STANDARD TABLE OF itcdq WITH DEFAULT KEY, END OF ty_style. ENDCLASS. CLASS zcl_abapgit_object_styl IMPLEMENTATION. METHOD zif_abapgit_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. "zif_abapgit_object~has_changed_since METHOD zif_abapgit_object~changed_by. DATA: ls_style TYPE ty_style, lv_name TYPE itcda-tdstyle. lv_name = ms_item-obj_name. CALL FUNCTION 'READ_STYLE' EXPORTING style = lv_name IMPORTING style_header = ls_style-header TABLES paragraphs = ls_style-paragraphs strings = ls_style-strings tabs = ls_style-tabs. rv_user = ls_style-header-tdluser. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-delete_tadir = abap_true. ENDMETHOD. "zif_abapgit_object~get_metadata METHOD zif_abapgit_object~exists. DATA: ls_style TYPE ty_style, lv_name TYPE itcda-tdstyle, lv_found TYPE abap_bool. lv_name = ms_item-obj_name. CALL FUNCTION 'READ_STYLE' EXPORTING style = lv_name IMPORTING found = lv_found TABLES paragraphs = ls_style-paragraphs strings = ls_style-strings tabs = ls_style-tabs. rv_bool = boolc( lv_found = abap_true ). ENDMETHOD. "zif_abapgit_object~exists METHOD zif_abapgit_object~jump. DATA: ls_bcdata TYPE bdcdata, lt_bcdata TYPE STANDARD TABLE OF bdcdata. ls_bcdata-program = 'SAPMSSCS'. ls_bcdata-dynpro = '1100'. ls_bcdata-dynbegin = 'X'. APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'RSSCS-TDSTYLE'. ls_bcdata-fval = ms_item-obj_name. APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'RSSCS-TDSPRAS'. ls_bcdata-fval = sy-langu. APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'RSSCS-TDHEADEROB'. ls_bcdata-fval = 'X'. APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'BDC_OKCODE'. ls_bcdata-fval = '=SHOW'. APPEND ls_bcdata TO lt_bcdata. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SE72' mode_val = 'E' TABLES using_tab = lt_bcdata EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, STYL' ). ENDIF. ENDMETHOD. "jump METHOD zif_abapgit_object~delete. DATA: lv_style TYPE itcda-tdstyle. lv_style = ms_item-obj_name. CALL FUNCTION 'DELETE_STYLE' EXPORTING style = lv_style language = '*'. ENDMETHOD. "delete METHOD zif_abapgit_object~deserialize. DATA: ls_style TYPE ty_style. io_xml->read( EXPORTING iv_name = 'STYLE' CHANGING cg_data = ls_style ). CALL FUNCTION 'SAVE_STYLE' EXPORTING style_header = ls_style-header TABLES paragraphs = ls_style-paragraphs strings = ls_style-strings tabs = ls_style-tabs. tadir_insert( iv_package ). ENDMETHOD. "deserialize METHOD zif_abapgit_object~serialize. DATA: ls_style TYPE ty_style, lv_name TYPE itcda-tdstyle. lv_name = ms_item-obj_name. CALL FUNCTION 'READ_STYLE' EXPORTING style = lv_name IMPORTING style_header = ls_style-header TABLES paragraphs = ls_style-paragraphs strings = ls_style-strings tabs = ls_style-tabs. CLEAR: ls_style-header-tdfuser, ls_style-header-tdfdate, ls_style-header-tdftime, ls_style-header-tdfreles, ls_style-header-tdluser, ls_style-header-tdldate, ls_style-header-tdltime, ls_style-header-tdlreles. io_xml->add( iv_name = 'STYLE' ig_data = ls_style ). ENDMETHOD. "serialize METHOD zif_abapgit_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null. ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. ENDCLASS. "zcl_abapgit_object_styl IMPLEMENTATION
25.153061
96
0.635091
03fd3da3a236bc379d800b7748b74649b97f3cb6
4,716
abap
ABAP
src/zcl_io_x_reader.clas.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
src/zcl_io_x_reader.clas.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
src/zcl_io_x_reader.clas.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en">Abstract byte reader</p> CLASS zcl_io_x_reader DEFINITION PUBLIC ABSTRACT CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_io_close_resource ALL METHODS FINAL . INTERFACES zif_io_reader FINAL METHODS data_available is_x_reader read skip . INTERFACES zif_io_x_reader FINAL METHODS read . ALIASES close FOR zif_io_close_resource~close . ALIASES data_available FOR zif_io_reader~data_available . ALIASES delete_mark FOR zif_io_reader~delete_mark . ALIASES is_closed FOR zif_io_close_resource~is_closed . ALIASES is_mark_supported FOR zif_io_reader~is_mark_supported . ALIASES is_reset_supported FOR zif_io_reader~is_reset_supported . ALIASES is_x_reader FOR zif_io_reader~is_x_reader . ALIASES read FOR zif_io_x_reader~read . ALIASES reset FOR zif_io_reader~reset . ALIASES reset_to_mark FOR zif_io_reader~reset_to_mark . ALIASES set_mark FOR zif_io_reader~set_mark . ALIASES skip FOR zif_io_reader~skip . ALIASES is_auto_close_performed FOR zif_io_reader~is_auto_close_enabled . METHODS constructor . PROTECTED SECTION. DATA close_managed_internally TYPE abap_bool VALUE abap_false. PRIVATE SECTION. TYPE-POOLS abap . DATA closed TYPE abap_bool VALUE abap_false. "#EC NOTEXT . ENDCLASS. CLASS zcl_io_x_reader IMPLEMENTATION. METHOD constructor. ENDMETHOD. METHOD zif_io_close_resource~close. IF close_managed_internally = abap_true. CALL METHOD me->('CLOSE_INTERNAL'). ELSE. " not implemented by the resource closed = abap_true. ENDIF. ENDMETHOD. METHOD zif_io_close_resource~is_closed. IF close_managed_internally = abap_true. CALL METHOD me->('IS_CLOSED_INTERNAL') RECEIVING closed = closed. ELSE. closed = me->closed. ENDIF. ENDMETHOD. METHOD zif_io_reader~data_available. IF closed = abap_true. RAISE EXCEPTION TYPE zcx_io_resource_already_closed. ENDIF. CALL METHOD me->('DATA_AVAILABLE_INTERNAL') RECEIVING available = available. ENDMETHOD. METHOD zif_io_x_reader~read. IF length <= 0. RAISE EXCEPTION TYPE zcx_io_parameter_invalid_range EXPORTING parameter = 'LENGTH' value = CONV #( length ). ENDIF. IF is_closed( ) = abap_true. RAISE EXCEPTION TYPE zcx_io_resource_already_closed. ENDIF. CALL METHOD me->('READ_INTERNAL') EXPORTING length = length RECEIVING result = result. ENDMETHOD. METHOD zif_io_reader~is_auto_close_enabled. result = abap_false. ENDMETHOD. METHOD zif_io_reader~delete_mark. IF closed IS NOT INITIAL. RAISE EXCEPTION TYPE zcx_io_resource_already_closed. ENDIF. " Improvement of standard ASSIGN ('ME->M_MARK') TO FIELD-SYMBOL(<mark>). CHECK sy-subrc = 0. <mark> = -1. ENDMETHOD. METHOD zif_io_reader~is_mark_supported. res = abap_false. ENDMETHOD. METHOD zif_io_reader~is_reset_supported. result = abap_false. ENDMETHOD. METHOD zif_io_reader~is_x_reader. result = abap_true. ENDMETHOD. METHOD zif_io_reader~read. DATA type TYPE REF TO cl_abap_typedescr. type = cl_abap_typedescr=>describe_by_data( read_data ). IF type = cl_abap_elemdescr=>get_xstring( ). read_data = read( length ). ELSE. RAISE EXCEPTION TYPE cx_parameter_invalid_type EXPORTING textid = zcx_io_parameter_invalid_type=>zcx_io_parameter_invalid_type parameter = `READ_DATA` type = type->get_relative_name( ). ENDIF. ENDMETHOD. METHOD zif_io_reader~reset. IF closed = abap_true. RAISE EXCEPTION TYPE zcx_io_resource_already_closed. ENDIF. RAISE EXCEPTION TYPE zcx_io_stream_position_error EXPORTING textid = zcx_io_stream_position_error=>zcx_io_reset_not_supported. ENDMETHOD. METHOD zif_io_reader~reset_to_mark. IF closed = abap_true. RAISE EXCEPTION TYPE zcx_io_resource_already_closed. ENDIF. RAISE EXCEPTION TYPE zcx_io_stream_position_error EXPORTING textid = zcx_io_stream_position_error=>zcx_io_mark_not_supported. ENDMETHOD. METHOD zif_io_reader~set_mark. IF closed = abap_true. RAISE EXCEPTION TYPE zcx_io_resource_already_closed. ENDIF. RAISE EXCEPTION TYPE zcx_io_stream_position_error EXPORTING textid = zcx_io_stream_position_error=>zcx_io_mark_not_supported. ENDMETHOD. METHOD zif_io_reader~skip. read( length ). ENDMETHOD. ENDCLASS.
21.534247
114
0.705895
ff0146eb374710d7888356edfbad272395dc92ce
14,798
abap
ABAP
src/service/zcl_ags_service_git.clas.abap
mbtools/abapGitServer
cab6405fcee5769c6d828e7dd3a8ca24856a4c49
[ "MIT" ]
null
null
null
src/service/zcl_ags_service_git.clas.abap
mbtools/abapGitServer
cab6405fcee5769c6d828e7dd3a8ca24856a4c49
[ "MIT" ]
null
null
null
src/service/zcl_ags_service_git.clas.abap
mbtools/abapGitServer
cab6405fcee5769c6d828e7dd3a8ca24856a4c49
[ "MIT" ]
null
null
null
CLASS zcl_ags_service_git DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_ags_service . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_push, old TYPE zags_sha1, new TYPE zags_sha1, name TYPE zags_branch_name, length TYPE i, END OF ty_push . TYPES: BEGIN OF ty_request, want TYPE STANDARD TABLE OF zags_sha1 WITH DEFAULT KEY, have TYPE STANDARD TABLE OF zags_sha1 WITH DEFAULT KEY, capabilities TYPE STANDARD TABLE OF string WITH DEFAULT KEY, deepen TYPE i, END OF ty_request . TYPES: ty_ack_mode TYPE c LENGTH 1 . CONSTANTS: BEGIN OF c_ack_mode, normal TYPE ty_ack_mode VALUE '1', detailed TYPE ty_ack_mode VALUE '2', not_specified TYPE ty_ack_mode VALUE '3', END OF c_ack_mode . DATA mi_server TYPE REF TO if_http_server . METHODS find_ack_mode IMPORTING !is_request TYPE ty_request RETURNING VALUE(rv_mode) TYPE ty_ack_mode . METHODS negotiate_packfile IMPORTING !io_response TYPE REF TO zcl_ags_xstream !is_request TYPE ty_request . METHODS branch_list IMPORTING !iv_service TYPE string RAISING zcx_ags_error . METHODS decode_push IMPORTING !iv_data TYPE xstring RETURNING VALUE(rs_push) TYPE ty_push RAISING zcx_ags_error . METHODS decode_request IMPORTING !iv_string TYPE string RETURNING VALUE(rs_request) TYPE ty_request . METHODS get_null RETURNING VALUE(rv_char) TYPE char1 . METHODS pack RAISING zcx_ags_error . METHODS repo_name RETURNING VALUE(rv_name) TYPE zags_repos-name . METHODS unpack RAISING zcx_ags_error . METHODS unpack_ok IMPORTING !iv_branch_name TYPE zags_branch_name RETURNING VALUE(rv_xstring) TYPE xstring . ENDCLASS. CLASS ZCL_AGS_SERVICE_GIT IMPLEMENTATION. METHOD branch_list. DEFINE _capability. APPEND &1 TO lt_capabilities ##no_text. END-OF-DEFINITION. DATA: lv_reply TYPE string, lt_reply TYPE TABLE OF string, lv_length TYPE xstring, lv_tmp TYPE string, lt_capabilities TYPE TABLE OF string, lv_content TYPE string, lv_utf TYPE string, lv_name TYPE zags_repos-name, lv_head TYPE zags_sha1, lo_repo TYPE REF TO zcl_ags_repo, lt_branches TYPE zcl_ags_repo=>ty_branches_tt, lv_raw TYPE xstring. FIELD-SYMBOLS: <lo_branch> LIKE LINE OF lt_branches. IF iv_service IS INITIAL. RAISE EXCEPTION TYPE zcx_ags_error EXPORTING textid = zcx_ags_error=>m003. ENDIF. _capability 'multi_ack'. * _capability 'thin-pack'. _capability 'no-thin'. _capability 'side-band'. _capability 'side-band-64k'. * _capability 'ofs-delta'. _capability 'shallow'. _capability 'no-progress'. _capability 'include-tag'. _capability 'report-status'. _capability 'multi_ack_detailed'. _capability 'no-done'. _capability 'symref=HEAD:refs/heads/master'. _capability 'agent=git/abapGitServer'. CONCATENATE LINES OF lt_capabilities INTO lv_reply SEPARATED BY space. lv_name = repo_name( ). CREATE OBJECT lo_repo EXPORTING iv_name = lv_name. lv_head = lo_repo->get_branch( lo_repo->get_data( )-head )->get_data( )-sha1. lv_content = |# service={ iv_service }| ##NO_TEXT. lv_length = zcl_ags_length=>encode( strlen( lv_content ) + 5 ). lv_utf = to_lower( zcl_ags_util=>xstring_to_string_utf8( lv_length ) ). lv_tmp = lv_utf && lv_content. APPEND lv_tmp TO lt_reply. lv_content = |{ lv_head } HEAD{ get_null( ) }{ lv_reply }|. lv_length = zcl_ags_length=>encode( strlen( lv_content ) + 5 ). lv_utf = to_lower( zcl_ags_util=>xstring_to_string_utf8( lv_length ) ). lv_tmp = '0000' && lv_utf && lv_content. APPEND lv_tmp TO lt_reply. lt_branches = lo_repo->list_branches( ). LOOP AT lt_branches ASSIGNING <lo_branch>. lv_content = <lo_branch>->get_data( )-sha1 && | | && <lo_branch>->get_data( )-name ##no_text. lv_length = zcl_ags_length=>encode( strlen( lv_content ) + 5 ). lv_utf = to_lower( zcl_ags_util=>xstring_to_string_utf8( lv_length ) ). lv_tmp = lv_utf && lv_content. APPEND lv_tmp TO lt_reply. ENDLOOP. APPEND '0000' TO lt_reply. CONCATENATE LINES OF lt_reply INTO lv_reply SEPARATED BY cl_abap_char_utilities=>newline. mi_server->response->set_header_field( name = 'Server' value = 'abapGitServer' ) ##no_text. mi_server->response->set_header_field( name = 'Cache-Control' value = 'no-cache' ) ##no_text. mi_server->response->set_content_type( |application/x-{ iv_service }-advertisement| ) ##no_text. * must be sent as raw, using data will change the content-type of the response lv_raw = zcl_ags_util=>string_to_xstring_utf8( lv_reply ). mi_server->response->set_data( lv_raw ). ENDMETHOD. METHOD decode_push. DATA: lv_first TYPE xstring, lv_utf TYPE string, lv_data TYPE string, lt_data TYPE TABLE OF string. lv_first = iv_data(4). lv_utf = zcl_ags_util=>xstring_to_string_utf8( lv_first ). rs_push-length = zcl_ags_length=>decode( lv_utf ). lv_first = iv_data(rs_push-length). lv_data = zcl_ags_util=>xstring_to_string_utf8( lv_first ). lv_data = lv_data+4. " skip length, already decoded SPLIT lv_data AT get_null( ) INTO TABLE lt_data. ASSERT lines( lt_data ) > 0. READ TABLE lt_data INDEX 1 INTO lv_data. "#EC CI_SUBRC rs_push-old = lv_data. rs_push-new = lv_data+41. rs_push-name = lv_data+82. ENDMETHOD. METHOD decode_request. * todo: add unit tests DATA: lv_line TYPE string, lv_command TYPE string, lv_rest TYPE string, lv_capabilities TYPE string, lt_lines TYPE TABLE OF string. SPLIT iv_string AT cl_abap_char_utilities=>newline INTO TABLE lt_lines. LOOP AT lt_lines INTO lv_line. SPLIT lv_line AT space INTO lv_command lv_rest. IF lv_command(4) = '0000'. lv_command = lv_command+4. ENDIF. IF strlen( lv_command ) >= 4. lv_command = lv_command+4. ENDIF. CASE lv_command. WHEN 'want'. IF lines( rs_request-want ) = 0. SPLIT lv_rest AT space INTO lv_rest lv_capabilities. SPLIT lv_capabilities AT space INTO TABLE rs_request-capabilities. ENDIF. APPEND lv_rest TO rs_request-want. WHEN 'have'. APPEND lv_rest TO rs_request-have. WHEN 'deepen'. rs_request-deepen = lv_rest. WHEN '' OR 'done'. RETURN. WHEN OTHERS. * todo, unknown command ASSERT 0 = 1. ENDCASE. ENDLOOP. SORT rs_request-want ASCENDING. DELETE ADJACENT DUPLICATES FROM rs_request-want. ENDMETHOD. METHOD find_ack_mode. READ TABLE is_request-capabilities WITH KEY table_line = 'multi_ack' TRANSPORTING NO FIELDS. IF sy-subrc = 0. rv_mode = c_ack_mode-normal. ENDIF. READ TABLE is_request-capabilities WITH KEY table_line = 'multi_ack_detailed' TRANSPORTING NO FIELDS. IF sy-subrc = 0. ASSERT rv_mode IS INITIAL. rv_mode = c_ack_mode-detailed. ENDIF. IF rv_mode IS INITIAL. rv_mode = c_ack_mode-not_specified. ENDIF. ENDMETHOD. METHOD get_null. DATA: lv_x(4) TYPE x VALUE '00000000', lv_z(2) TYPE c. FIELD-SYMBOLS <lv_y> TYPE c. ASSIGN lv_x TO <lv_y> CASTING. lv_z = <lv_y>. rv_char = lv_z(1). ENDMETHOD. METHOD negotiate_packfile. * see https://github.com/git/git/blob/master/Documentation/technical/pack-protocol.txt#L298 DATA: lv_ack_mode TYPE ty_ack_mode, lv_no_done TYPE abap_bool, lv_subrc LIKE sy-subrc, lv_data TYPE string, lv_sha1 LIKE LINE OF is_request-have, lo_server TYPE REF TO cl_http_server. lv_ack_mode = find_ack_mode( is_request ). READ TABLE is_request-capabilities WITH KEY table_line = 'no-done' TRANSPORTING NO FIELDS. lv_no_done = xsdbool( sy-subrc = 0 ). IF lv_ack_mode = c_ack_mode-detailed AND lines( is_request-have ) = 0. lv_ack_mode = c_ack_mode-normal. ENDIF. CASE lv_ack_mode. WHEN c_ack_mode-normal. io_response->append_length( zcl_ags_util=>string_to_xstring_utf8( |NAK\n| ) ). WHEN c_ack_mode-detailed. IF lv_no_done = abap_false. LOOP AT is_request-have INTO lv_sha1. * todo, "common" or "ready"? io_response->append_length( zcl_ags_util=>string_to_xstring_utf8( |ACK { lv_sha1 } common\n| ) ). ENDLOOP. io_response->append_length( zcl_ags_util=>string_to_xstring_utf8( |NAK\n| ) ). mi_server->response->set_data( io_response->get( ) ). lo_server ?= mi_server. lo_server->send_response( ). lv_subrc = lo_server->receive_request( ). lv_data = mi_server->request->get_cdata( ). * todo, this works, but everything is sent, just like a clone operation io_response->clear( ). ENDIF. io_response->append_length( zcl_ags_util=>string_to_xstring_utf8( |ACK { is_request-want[ 1 ] }\n| ) ). WHEN c_ack_mode-not_specified. * todo, not implemented ASSERT 0 = 1. WHEN OTHERS. ASSERT 0 = 1. ENDCASE. ENDMETHOD. METHOD pack. CONSTANTS: lc_length TYPE i VALUE 8196. DATA: lo_response TYPE REF TO zcl_ags_xstream, lo_commit TYPE REF TO zcl_ags_obj_commit, lt_objects TYPE zif_abapgit_definitions=>ty_objects_tt, lv_pack TYPE xstring, lv_tmp TYPE xstring, lv_repo TYPE zags_repos-repo, ls_request TYPE ty_request, lv_branch LIKE LINE OF ls_request-want, lv_length TYPE i. ls_request = decode_request( mi_server->request->get_cdata( ) ). lv_repo = zcl_ags_repo=>get_instance( repo_name( ) )->get_data( )-repo. CREATE OBJECT lo_response. negotiate_packfile( io_response = lo_response is_request = ls_request ). LOOP AT ls_request-want INTO lv_branch. lo_commit = zcl_ags_obj_commit=>load( iv_repo = lv_repo iv_sha1 = lv_branch ). APPEND LINES OF zcl_ags_pack=>explode( iv_repo = lv_repo ii_object = lo_commit iv_deepen = ls_request-deepen ) TO lt_objects. ENDLOOP. * make sure there are no duplicate objects SORT lt_objects BY type ASCENDING sha1 ASCENDING. DELETE ADJACENT DUPLICATES FROM lt_objects COMPARING type sha1. lv_pack = zcl_ags_pack=>encode( lt_objects ). WHILE xstrlen( lv_pack ) > 0. IF xstrlen( lv_pack ) >= lc_length. lv_length = lc_length. ELSE. lv_length = xstrlen( lv_pack ). ENDIF. lv_tmp = lv_pack(lv_length). lo_response->append_band01( lv_tmp ). lv_pack = lv_pack+lv_length. ENDWHILE. lo_response->append( zcl_ags_util=>string_to_xstring_utf8( '0000' ) ). mi_server->response->set_data( lo_response->get( ) ). mi_server->response->set_header_field( name = if_http_header_fields=>content_type value = 'application/x-git-upload-pack-result' ) ##NO_TEXT. ENDMETHOD. METHOD repo_name. DATA: lv_path TYPE string. lv_path = mi_server->request->get_header_field( '~path' ). FIND REGEX 'sap/zabapgitserver/git/(.*)\.git*' IN lv_path SUBMATCHES rv_name ##no_text. ENDMETHOD. METHOD unpack. CONSTANTS: lc_utf_0000 TYPE x LENGTH 4 VALUE '30303030'. DATA: lv_xstring TYPE xstring, lt_objects TYPE zif_abapgit_definitions=>ty_objects_tt, lo_repo TYPE REF TO zcl_ags_repo, lo_branch TYPE REF TO zcl_ags_branch, ls_push TYPE ty_push. ls_push = decode_push( mi_server->request->get_data( ) ). lv_xstring = mi_server->request->get_data( ). lv_xstring = lv_xstring+ls_push-length. ASSERT lv_xstring(4) = lc_utf_0000. lv_xstring = lv_xstring+4. lt_objects = zcl_ags_pack=>decode( lv_xstring ). lo_repo = zcl_ags_repo=>get_instance( repo_name( ) ). IF ls_push-old CO '0'. * create branch lo_repo->create_branch( iv_name = ls_push-name iv_commit = ls_push-new ). ELSEIF ls_push-new CO '0'. * delete branch lo_branch = lo_repo->get_branch( ls_push-name ). ASSERT lo_branch->get_data( )-sha1 = ls_push-old. lo_branch->delete( ). ELSE. * update branch lo_repo->get_branch( ls_push-name )->push( iv_new = ls_push-new iv_old = ls_push-old it_objects = lt_objects ). ENDIF. * method set_data has to be used, or SAP will modify the "Content-Type" header mi_server->response->set_data( unpack_ok( ls_push-name ) ). mi_server->response->set_header_field( name = if_http_header_fields=>content_type value = 'application/x-git-receive-pack-result' ) ##NO_TEXT. ENDMETHOD. METHOD unpack_ok. DATA: lo_response TYPE REF TO zcl_ags_xstream. CREATE OBJECT lo_response. * send report-status when capability is enabled, lo_response->append_band01( zcl_ags_xstream=>create( )->append_length( zcl_ags_util=>string_to_xstring_utf8( |unpack ok\n| ) )->get( ) ). lo_response->append_band01( zcl_ags_xstream=>create( )->append_length( zcl_ags_util=>string_to_xstring_utf8( |ok { iv_branch_name }\n| ) )->get( ) ). lo_response->append_band01( zcl_ags_util=>string_to_xstring_utf8( '0000' ) ). lo_response->append( zcl_ags_util=>string_to_xstring_utf8( '0000' ) ). rv_xstring = lo_response->get( ). ENDMETHOD. METHOD zif_ags_service~run. DATA: lv_path TYPE string, lv_xdata TYPE string. mi_server = ii_server. lv_path = mi_server->request->get_header_field( '~path_info' ). lv_xdata = mi_server->request->get_data( ). IF lv_xdata IS INITIAL. branch_list( mi_server->request->get_form_field( 'service' ) ). ELSEIF lv_path CP '*git-upload-pack*'. pack( ). ELSEIF lv_path CP '*git-receive-pack*'. unpack( ). ELSE. RAISE EXCEPTION TYPE zcx_ags_error EXPORTING textid = zcx_ags_error=>m008. ENDIF. ENDMETHOD. ENDCLASS.
28.026515
111
0.646101
ff02af31dca45dd690d7244ffddf1d80f4a27f38
90,982
abap
ABAP
zbugtracker_core/zbugtracker_persistence/zcb_producto_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
3
2019-02-10T22:03:43.000Z
2021-05-26T06:49:55.000Z
zbugtracker_core/zbugtracker_persistence/zcb_producto_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
2
2020-05-06T14:25:17.000Z
2022-01-13T10:06:40.000Z
zbugtracker_core/zbugtracker_persistence/zcb_producto_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
1
2021-05-26T06:49:56.000Z
2021-05-26T06:49:56.000Z
class ZCB_PRODUCTO_PERSIST definition public inheriting from CL_OS_CA_COMMON abstract create public . *"* public components of class ZCB_PRODUCTO_PERSIST *"* do not include other source files here!!! public section. methods CREATE_PERSISTENT importing !I_PRODUCTO type ZBT_ID_PRODUCTO returning value(RESULT) type ref to ZCL_PRODUCTO_PERSIST raising CX_OS_OBJECT_EXISTING . methods CREATE_TRANSIENT importing !I_PRODUCTO type ZBT_ID_PRODUCTO returning value(RESULT) type ref to ZCL_PRODUCTO_PERSIST raising CX_OS_OBJECT_EXISTING . methods DELETE_PERSISTENT importing !I_PRODUCTO type ZBT_ID_PRODUCTO raising CX_OS_OBJECT_NOT_EXISTING . methods GET_PERSISTENT importing !I_PRODUCTO type ZBT_ID_PRODUCTO returning value(RESULT) type ref to ZCL_PRODUCTO_PERSIST raising CX_OS_OBJECT_NOT_FOUND . methods GET_TRANSIENT importing !I_PRODUCTO type ZBT_ID_PRODUCTO returning value(RESULT) type ref to ZCL_PRODUCTO_PERSIST raising CX_OS_OBJECT_NOT_FOUND . methods IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_KEY redefinition . methods IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_KEY_TAB redefinition . methods IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_QUERY redefinition . methods IF_OS_CA_SERVICE~SAVE redefinition . methods IF_OS_CA_SERVICE~SAVE_IN_UPDATE_TASK redefinition . methods IF_OS_FACTORY~CREATE_PERSISTENT_BY_KEY redefinition . methods IF_OS_FACTORY~CREATE_TRANSIENT_BY_KEY redefinition . protected section. *"* protected components of class ZCB_PRODUCTO_PERSIST *"* do not include other source files here!!! types TYP_OID type OS_GUID . types TYP_TYPE type OS_GUID . types TYP_OBJECT_REF type ref to ZCL_PRODUCTO_PERSIST . types: begin of TYP_BUSINESS_KEY , PRODUCTO type ZBT_ID_PRODUCTO , end of TYP_BUSINESS_KEY . types: TYP_BUSINESS_KEY_TAB type standard table of TYP_BUSINESS_KEY with non-unique default key . types: begin of TYP_DB_DATA , PRODUCTO type ZBT_ID_PRODUCTO , end of TYP_DB_DATA . types: TYP_DB_DATA_TAB type standard table of TYP_DB_DATA with non-unique default key . types: TYP_OID_TAB type standard table of TYP_OID with non-unique default key . types: TYP_OBJECT_REF_TAB type standard table of TYP_OBJECT_REF with non-unique default key . types: begin of TYP_SPECIAL_OBJECT_INFO , OBJECT_ID type TYP_INTERNAL_OID , ID_STATUS type TYP_ID_STATUS , BUSINESS_KEY type TYP_BUSINESS_KEY , end of TYP_SPECIAL_OBJECT_INFO . types: TYP_SPECIAL_OBJECT_INFO_TAB type sorted table of TYP_SPECIAL_OBJECT_INFO with unique key OBJECT_ID . types: TYP_SPECIAL_BKEY_TAB type sorted table of TYP_SPECIAL_OBJECT_INFO with unique key BUSINESS_KEY . types: TYP_DB_DELETE_TAB type standard table of TYP_SPECIAL_OBJECT_INFO with non-unique default key . data CURRENT_SPECIAL_OBJECT_INFO type TYP_SPECIAL_OBJECT_INFO . data MAP_ATT_INFO_TAB type OSTYP_RT_MAP_ATT_INFO_SRT_TAB . data SPECIAL_BKEY_TAB type TYP_SPECIAL_BKEY_TAB . data SPECIAL_OBJECT_INFO type TYP_SPECIAL_OBJECT_INFO_TAB . methods PM_LOAD_AND_SET_ATTRIBUTES importing !I_BUSINESS_KEY type TYP_BUSINESS_KEY optional raising CX_OS_OBJECT_NOT_FOUND . methods PM_DELETE_PERSISTENT . methods PM_CREATE_REPRESENTANT importing !I_BUSINESS_KEY type TYP_BUSINESS_KEY optional returning value(RESULT) type TYP_OBJECT_REF . methods PM_CHECK_AND_SET_ATTRIBUTES importing !I_BUSINESS_KEY type TYP_BUSINESS_KEY optional !I_ID_PROVIDED type TYP_ID_STATUS default 0 !I_OBJECT_DATA type TYP_DB_DATA raising CX_OS_OBJECT_NOT_FOUND . methods MAP_SET_ATTRIBUTES importing !I_OBJECT_DATA type TYP_DB_DATA !I_OBJECT_REF type TYP_OBJECT_REF raising CX_OS_OBJECT_NOT_FOUND . methods MAP_SERIALIZE_BKEY importing !I_BUSINESS_KEY type TYP_BUSINESS_KEY returning value(RESULT) type STRING . methods MAP_SAVE_TO_DATABASE importing !I_DELETES type TYP_DB_DELETE_TAB !I_INSERTS type TYP_DB_DATA_TAB !I_UPDATES type TYP_DB_DATA_TAB . methods MAP_MERGE_IDENTIFIER importing !I_BUSINESS_KEY_TAB type TYP_BUSINESS_KEY_TAB changing !C_DB_DATA_TAB type TYP_DB_DATA_TAB . methods MAP_LOAD_FROM_DATABASE_KEY importing !I_BUSINESS_KEY_TAB type TYP_BUSINESS_KEY_TAB returning value(RESULT) type TYP_DB_DATA_TAB . methods MAP_LOAD_FROM_DATABASE importing !I_ORDER_BY_CLAUSE type STRING optional !I_SUBCLASSES type OS_BOOLEAN default OSCON_FALSE !I_UPTO type I default 0 !I_WHERE_CLAUSE type STRING optional !PAR1 type ANY optional !PAR2 type ANY optional !PAR3 type ANY optional returning value(RESULT) type TYP_DB_DATA_TAB . methods MAP_INITIALIZE_METADATA . methods MAP_GET_ATTRIBUTES importing !I_OBJECT_REF_TAB type TYP_OBJECT_REF_TAB exporting value(E_OBJECT_DATA_TAB) type TYP_DB_DATA_TAB . methods MAP_EXTRACT_IDENTIFIER importing !I_DB_DATA type TYP_DB_DATA exporting value(E_BUSINESS_KEY) type TYP_BUSINESS_KEY . methods DELETE_SPECIAL_OBJECT_INFO redefinition . methods LOAD_SPECIAL_OBJECT_INFO redefinition . methods MAP_INVALIDATE redefinition . methods OS_PM_DELETE_PERSISTENT redefinition . methods PM_LOAD redefinition . methods SAVE_SPECIAL_OBJECT_INFO redefinition . private section. *"* private components of class ZCB_PRODUCTO_PERSIST *"* do not include other source files here!!! ENDCLASS. CLASS ZCB_PRODUCTO_PERSIST IMPLEMENTATION. method CREATE_PERSISTENT. ***BUILD 051402 * IMPORTING I_PRODUCTO TYPE ZBT_ID_PRODUCTO * RETURNING RESULT TYPE REF TO ZCL_PRODUCTO_PERSIST ************************************************************************ * Purpose : Create a new persistent object identified by the * given business key * * Version : 2.0 * * Precondition : No object exists with the given business key, neither * in memory nor on database. * * Postcondition : The object exists in memory and will result in a * new entry on database when the top transaction is * closed. * * OO Exceptions : CX_OS_OBJECT_EXISTING( * PERSISTENT_CREATING_PERSISTENT, * TRANSIENT_CREATING_PERSISTENT) * propagates OS_PM_CREATED_PERSISTENT * * Implementation : 1. Check if there is already an object with the * same key * 2. If there is one, let OS_PM_HANDLE_CREATE_ON_EXIST * decide if it is allowed to re-use the object * 3. If there is none, create a new object * 4. Set Attributes * 5. Register the object as NEW and initialize it * 6. Clean up * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version 2.0 * - 2000-08-03 : (SB) OO Exceptions * - 2001-01-10 : (SB) persistent attributes as optional parameters * - 2001-10-30 : (SB) type mapping * - 2002-01-17 : (SB) private attributes in super classes * - 2003-04-28 : (SB) reuse of instances reimplemented ************************************************************************ data: THE_OBJECT type TYP_OBJECT_REF, BUSINESS_KEY type TYP_BUSINESS_KEY, BKEY_STRING type STRING. data: TEMP_CURRENT_OBJECT_IREF type ref to object. clear CURRENT_OBJECT_IREF. *< Generated from mapping: BUSINESS_KEY-PRODUCTO = I_PRODUCTO. *> * * 1. Check if there is already an object with this key read table SPECIAL_BKEY_TAB into CURRENT_SPECIAL_OBJECT_INFO with table key BUSINESS_KEY = BUSINESS_KEY. if ( SY-SUBRC = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = SY-TABIX. endif. "( entry found ) if ( not CURRENT_OBJECT_IREF is initial ). * * 2. Found an entry. Check if it is allowed to re-use it THE_OBJECT ?= CURRENT_OBJECT_IREF. case CURRENT_OBJECT_INFO-PM_STATUS. when OSCON_OSTATUS_DELETED or OSCON_OSTATUS_NOT_LOADED. try. *< Generated from mapping: THE_OBJECT->PRODUCTO = I_PRODUCTO. *> call method OS_PM_HANDLE_CREATE_ON_EXIST exporting I_TRANSIENT = OSCON_FALSE. cleanup. clear CURRENT_SPECIAL_OBJECT_INFO. call method OS_CLEAR_CURRENT. endtry. when OSCON_OSTATUS_TRANSIENT. TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_EXISTING definition load. raise exception type CX_OS_OBJECT_EXISTING exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_EXISTING=>TRANSIENT_CREATING_PERSISTENT. when others. TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_EXISTING definition load. raise exception type CX_OS_OBJECT_EXISTING exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_EXISTING=>PERSISTENT_CREATING_PERSISTENT. endcase. else. "( No entry found ) * * 3. Create a new object THE_OBJECT = PM_CREATE_REPRESENTANT( I_BUSINESS_KEY = BUSINESS_KEY ). * * 4. Set attributes *< Generated from mapping: *> * * 5. register object as 'NEW' and initialize it. call method OS_PM_CREATED_PERSISTENT. endif. "( Eintrag vorhanden ) * * 6. Clean-up clear CURRENT_SPECIAL_OBJECT_INFO. RESULT = THE_OBJECT. "CREATE_PERSISTENT endmethod. method CREATE_TRANSIENT. ***BUILD 051402 * IMPORTING I_PRODUCTO TYPE ZBT_ID_PRODUCTO * RETURNING RESULT TYPE REF TO ZCL_PRODUCTO_PERSIST ************************************************************************ * Purpose : Create a new transient object identified by the * given business key * * Version : 2.0 * * Precondition : No object exists with the given business key, neither * in memory nor on database. * * Postcondition : The object exists in memory until it is RELEASEd * * OO Exceptions : CX_OS_OBJECT_EXISTING( * PERSISTENT_CREATING_TRANSIENT, * TRANSIENT_CREATING_TRANSIENT) * propagates OS_PM_CREATED_TRANSIENT * * Implementation : 1. Check if there is already an object with the * same key * 2. If there is one, let OS_PM_HANDLE_CREATE_ON_EXIST * decide if it is allowed to re-use the object * 3. If there is none, create a new object * 4. Set Attributes * 5. Register the object as TRANSIENT and initialize it * 6. Clean up * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version 2.0 * - 2000-08-02 : (SB) OO Exceptions * - 2001-01-10 : (SB) persistent attributes as optional parameters * - 2001-10-30 : (SB) type mapping * - 2002-01-17 : (SB) private attributes in super classes * - 2003-04-28 : (SB) reuse of instances reimplemented ************************************************************************ data: THE_OBJECT type TYP_OBJECT_REF, BUSINESS_KEY type TYP_BUSINESS_KEY, BKEY_STRING type STRING. data: TEMP_CURRENT_OBJECT_IREF type ref to object. clear CURRENT_OBJECT_IREF. *< Generated from mapping: BUSINESS_KEY-PRODUCTO = I_PRODUCTO. *> * * 1. Check if there is already an object with the same key read table SPECIAL_BKEY_TAB into CURRENT_SPECIAL_OBJECT_INFO with table key BUSINESS_KEY = BUSINESS_KEY. if ( SY-SUBRC = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = SY-TABIX. endif. "( entry found ) if ( not CURRENT_OBJECT_IREF is initial ). * * 2. Found an entry. Check if it is allowed to re-use it THE_OBJECT ?= CURRENT_OBJECT_IREF. case CURRENT_OBJECT_INFO-PM_STATUS. when OSCON_OSTATUS_DELETED or OSCON_OSTATUS_NOT_LOADED. try. *< Generated from mapping: THE_OBJECT->PRODUCTO = I_PRODUCTO. *> call method OS_PM_HANDLE_CREATE_ON_EXIST exporting I_TRANSIENT = OSCON_TRUE. cleanup. clear CURRENT_SPECIAL_OBJECT_INFO. call method OS_CLEAR_CURRENT. endtry. when OSCON_OSTATUS_TRANSIENT. TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_EXISTING definition load. raise exception type CX_OS_OBJECT_EXISTING exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_EXISTING=>TRANSIENT_CREATING_TRANSIENT. when others. TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_EXISTING definition load. raise exception type CX_OS_OBJECT_EXISTING exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_EXISTING=>PERSISTENT_CREATING_TRANSIENT. endcase. else. "( Noch kein Eintrag ) * * 3. If there is none, create a new object THE_OBJECT = PM_CREATE_REPRESENTANT( I_BUSINESS_KEY = BUSINESS_KEY ). * * 4. Set attributes *< Generated from mapping: *> * * 5. Register the object as TRANSIENT and initialize it call method OS_PM_CREATED_TRANSIENT. endif. "( Eintrag vorhanden ) * * 6. Clean up clear CURRENT_SPECIAL_OBJECT_INFO. RESULT = THE_OBJECT. "CREATE_TRANSIENT endmethod. method DELETE_PERSISTENT. ***BUILD 051402 * IMPORTING I_PRODUCTO TYPE ZBT_ID_PRODUCTO. * raising CX_OS_OBJECT_NOT_EXISTING ************************************************************************ * Purpose : Delete persistent object. It is marked DELETED in * memory and removed from DB when the top transaction * is closed. * * Version : 2.0 * * Precondition : The object is persistent (not transient) * * Postcondition : Instance is marked for deletion. * * OO Exceptions : CX_OS_OBJECT_NOT_EXISTING(TRANSIENT_BY_BKEY, * CREATED_AND_DELETED_BY_BKEY,BY_BKEY) * ( propagates PM_LOAD_AND_SET_ATTRIBUTES ) * propagates PM_DELETE_PERSISTENT * * Implementation : 1. Check if there is already an object with that * business key * 2. If not: create representative object and check * if there is an entry on DB (Need to be sure that * no other object exists with the OID that belongs * to the given Business Key) * 3. If it already exists: call PM_DELETE_PERSISTENT * ************************************************************************ * Changelog: * - 1999-09-21 : (OS) Initial Version * - 2000-03-06 : (BGR) Version 2.0 * - 2000-08-03 : (SB) OO Exceptions * - 2000-10-30 : (SB) Type Mapping ************************************************************************ data: BUSINESS_KEY type TYP_BUSINESS_KEY . data: EX_OS_OBJECT_NOT_FOUND type ref to CX_OS_OBJECT_NOT_FOUND. data: EX_OS_OBJECT_STATE type ref to CX_OS_OBJECT_STATE. data: BKEY_STRING type STRING. * 1. Check if there is already an object with that business key clear: CURRENT_OBJECT_IREF, CURRENT_SPECIAL_OBJECT_INFO. *< Generated from mapping: BUSINESS_KEY-PRODUCTO = I_PRODUCTO. *> read table SPECIAL_BKEY_TAB into CURRENT_SPECIAL_OBJECT_INFO with table key BUSINESS_KEY = BUSINESS_KEY. if ( SY-SUBRC = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = SY-TABIX. endif. if ( CURRENT_OBJECT_IREF is initial ). * * 2. If not: create representative object and check * * if there is an entry on DB (Need to be sure that * * no other object exists with the OID that belongs * * to the given Business Key) try. call method PM_LOAD_AND_SET_ATTRIBUTES exporting I_BUSINESS_KEY = BUSINESS_KEY. catch CX_OS_OBJECT_NOT_FOUND into EX_OS_OBJECT_NOT_FOUND. * * If the object is not found by key - raise object not existing * * by key. If a reference has a illegal class GUID (i.e. object * * not found by ref error) - ignore. if ( EX_OS_OBJECT_NOT_FOUND->TEXTID = CX_OS_OBJECT_NOT_FOUND=>BY_BKEY ). call method OS_CLEAR_CURRENT. class CX_OS_OBJECT_NOT_EXISTING definition load. raise exception type CX_OS_OBJECT_NOT_EXISTING exporting BKEY = EX_OS_OBJECT_NOT_FOUND->BKEY TABLE = EX_OS_OBJECT_NOT_FOUND->TABLE TEXTID = CX_OS_OBJECT_NOT_EXISTING=>BY_BKEY. endif. cleanup. call method OS_CLEAR_CURRENT. endtry. endif." ( No Entry in administrative data? ) * * 3. If it already exists: call PM_DELETE_PERSISTENT if not ( CURRENT_OBJECT_IREF is initial ). try. call method PM_DELETE_PERSISTENT. catch CX_OS_OBJECT_STATE into EX_OS_OBJECT_STATE. if ( EX_OS_OBJECT_STATE->TEXTID = CX_OS_OBJECT_STATE=>TRANSIENT ). BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). class CX_OS_OBJECT_NOT_EXISTING definition load. raise exception type CX_OS_OBJECT_NOT_EXISTING exporting BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_EXISTING=>TRANSIENT_BY_BKEY. endif. if ( EX_OS_OBJECT_STATE->TEXTID = CX_OS_OBJECT_STATE=>CREATED_AND_DELETED ). BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). class CX_OS_OBJECT_NOT_EXISTING definition load. raise exception type CX_OS_OBJECT_NOT_EXISTING exporting BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_EXISTING=>CREATED_AND_DELETED_BY_BKEY. endif. endtry. endif. "DELETE_PERSISTENT endmethod. method DELETE_SPECIAL_OBJECT_INFO. ***BUILD 051401 ************************************************************************ * Purpose : Delete current entry SPECIAL_OBJECT_INFO * * Version : 2.0 * * Precondition : Index is set in CURRENT_OBJECT_INDEX * * Postcondition : entry is deleted * * OO Exceptions : -- * * Implementation : * ************************************************************************ * Changelog: * - 2000-03-02 : (BGR) Initial Version * - 2001-10-30 : (SB) Type Mapping ************************************************************************ read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO index CURRENT_OBJECT_INDEX. delete table SPECIAL_BKEY_TAB with table key BUSINESS_KEY = CURRENT_SPECIAL_OBJECT_INFO-BUSINESS_KEY. delete SPECIAL_OBJECT_INFO index CURRENT_OBJECT_INDEX. clear CURRENT_SPECIAL_OBJECT_INFO. "DELETE_SPECIAL_OBJECT_INFO endmethod. method GET_PERSISTENT. ***BUILD 051402 * importing I_PRODUCTO TYPE ZBT_ID_PRODUCTO. * returning RESULT TYPE REF TO ZCL_PRODUCTO_PERSIST * raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get reference of an persistent object. * * Version : 2.0 * * Precondition : -- * * Postcondition : Persistent object is active * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * (IS_TRANSIENT_BY_BKEY,DELETED_BY_BKEY) * propagates PM_LOAD_AND_SET_ATTRIBUTES * propagates OS_PM_LOADED_PERISISTENT * * Implementation : 1. Look for object in SPECIAL_OBJECT_INFO. If found, * check if it is still valid * 2. Object found: Check PM_STATUS * 2a. If Status is TRANSIENT or DELETED, error! * 2b. If Status is NOT_LOADED, continue with 3. * 2c. If Status is NEW, LOADED or CHANGED, success! * 3. Load object data from database and set object * 3.a. Completion in super class * 4. clean up * ************************************************************************ * Changelog: * - 1999-09-21 : (OS) Initial Version * - 2000-03-07 : (BGR) Version 2.0 - Common Superclass * - 2000-08-02 : (SB) OO Exceptions * - 2000-10-30 : (SB) Type Mapping * - 2004-01-21 : (SB) Type Mapping Refactoring ************************************************************************ data: BUSINESS_KEY type TYP_BUSINESS_KEY, FLAG_NOT_LOADED type OS_BOOLEAN, BKEY_STRING type STRING. data: TEMP_CURRENT_OBJECT_IREF type ref to OBJECT. * * 1. Look for object in SPECIAL_OBJECT_INFO. If found, check if it * * is still valid clear: CURRENT_OBJECT_IREF. *< Generated from mapping: BUSINESS_KEY-PRODUCTO = I_PRODUCTO. *> read table SPECIAL_BKEY_TAB into CURRENT_SPECIAL_OBJECT_INFO with table key BUSINESS_KEY = BUSINESS_KEY. if ( SY-SUBRC = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = SY-TABIX. endif. if ( not CURRENT_OBJECT_IREF is initial ). * * 2. Object found: Check PM_STATUS case CURRENT_OBJECT_INFO-PM_STATUS. * * 2a. If Status is TRANSIENT or DELETED, error! when OSCON_OSTATUS_DELETED. *!!!!! Error: Object activation failed - Object marked for deletion TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>DELETED_BY_BKEY. when OSCON_OSTATUS_TRANSIENT. *!!!!! Error: Object activation failed - Object is transient TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>IS_TRANSIENT_BY_BKEY. * * 2b. If Status is NOT_LOADED, continue with 3. when OSCON_OSTATUS_NOT_LOADED. FLAG_NOT_LOADED = OSCON_TRUE. * * 2c. If Status is NEW, LOADED or CHANGED, success! when others. FLAG_NOT_LOADED = OSCON_FALSE. endcase. "PM_STATUS else." ( CURRENT_OBJECT_IREF is initial ). FLAG_NOT_LOADED = OSCON_TRUE. endif." ( Entry in administrative data? ) * * 3. Load object data from database and set object if ( FLAG_NOT_LOADED = OSCON_TRUE ). * * internal Undo append INTERNAL_NEXT_UNDO_INFO to INTERNAL_TRANSACTION_STACK. INTERNAL_CURRENT_TRANSACTION = SY-TABIX. try. call method PM_LOAD_AND_SET_ATTRIBUTES exporting I_BUSINESS_KEY = BUSINESS_KEY. result ?= CURRENT_OBJECT_IREF. * * 3.a. Completion in super class call method OS_PM_LOADED_PERSISTENT. cleanup. call method OS_INTERNAL_UNDO. call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. endtry. * * Clean-up internal Undo delete INTERNAL_TRANSACTION_STACK index INTERNAL_CURRENT_TRANSACTION. add -1 to INTERNAL_CURRENT_TRANSACTION. if ( INTERNAL_TRANSACTION_STACK is initial ). clear INTERNAL_UNDO_INFO. INTERNAL_NEXT_UNDO_INFO = 1. endif. "( INTERNAL_TRANSACTION_STACK is initial? ) else. "( Object already loaded ) RESULT ?= CURRENT_OBJECT_IREF. call method OS_CLEAR_CURRENT. endif. "( Loading necessesary? ) * * 4. clean up clear CURRENT_SPECIAL_OBJECT_INFO. "GET_PERSISTENT endmethod. method GET_TRANSIENT. ***BUILD 051402 * IMPORTING I_PRODUCTO TYPE ZBT_ID_PRODUCTO. * RETURNING RESULT TYPE REF TO ZCL_PRODUCTO_PERSIST * raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get reference of an transient object. * * Version : 2.0 * * Precondition : object has been created transient * * Postcondition : -- * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * (TRANSIENT_BY_BKEY, IS_PERSISTENT_BY_BKEY) * * Implementation : 1. look for entry in SPECIAL_OBJECT_INFO and check * if it is still valid * 2. If it not valid or no object found: Error * 3. If it is valid: Check state * 3a. Not Transient: Error! * 3b. Transient: Success! * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version * - 2000-08-03 : (SB) OO Exceptions * - 2000-10-30 : (SB) Type Mapping ************************************************************************ data: BUSINESS_KEY type TYP_BUSINESS_KEY, BKEY_STRING type STRING . data: TEMP_CURRENT_OBJECT_IREF type ref to OBJECT. * * 1. look for entry in SPECIAL_OBJECT_INFO and check if it is * * still valid clear CURRENT_OBJECT_IREF. *< Generated from mapping: BUSINESS_KEY-PRODUCTO = I_PRODUCTO. *> read table SPECIAL_BKEY_TAB into CURRENT_SPECIAL_OBJECT_INFO with table KEY BUSINESS_KEY = BUSINESS_KEY. if ( SY-SUBRC = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = SY-TABIX. endif. * * 2. If it not valid or no object found: Error if ( CURRENT_OBJECT_IREF is initial ). *!!! Error: Object activation failed - no entry in administrative data BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>TRANSIENT_BY_BKEY. else. "( Entry exists ) * * 3. If it is valid: Check state if ( CURRENT_OBJECT_INFO-PM_STATUS <> OSCON_OSTATUS_TRANSIENT ). * * 3a. Not Transient: Error! *!!!!! Error: Object is not transient TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>IS_PERSISTENT_BY_BKEY. endif. "( PM_STATUS <> transient ) endif." ( Entry in administrative data? ) * * 3b. Transient: Success! RESULT ?= CURRENT_OBJECT_IREF. call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. "GET_TRANSIENT endmethod. method IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_KEY. ***BUILD 051402 * importing I_KEY type any * returning result type ref to object ************************************************************************ * Purpose : Get a persistent object identified by the * given business key * * Version : 2.0 * * Precondition : The object exists with the given business key, * either in memory or on database. * * Postcondition : The object exists in memory, RESULT is the reference * * OO Exceptions : propagates GET_PERSISTENT * * Implementation : call GET_PERSISTENT * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version 2.0 * - 2000-08-02 : (SB) OO Exceptions ************************************************************************ data: BUSINESS_KEY type TYP_BUSINESS_KEY. BUSINESS_KEY = I_KEY. *< Generated from mapping: call method GET_PERSISTENT exporting I_PRODUCTO = BUSINESS_KEY-PRODUCTO receiving RESULT = RESULT. *> "IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_KEY endmethod. method IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_KEY_TAB. ***BUILD 051402 "importing I_KEY_TAB type INDEX TABLE "returning value(RESULT) type OSREFTAB "raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get persistent objects by Business Key table * * Version : 2.0 * * Precondition : - * * Postcondition : For each entry in the KEY table, there is a corres- * ponding entry in the RESULT table. If the object was * found in the cache or the database, then a reference * to this object can be found in the RESULT table, * if not, the reference is initial. The persistent * objects are active. * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * (IS_TRANSIENT_BY_BKEY,DELETED_BY_BKEY) * propagates PM_LOAD_AND_SET_ATTRIBUTES * propagates OS_PM_LOADED_PERISISTENT * * Implementation : 1. Look for object in SPECIAL_OBJECT_INFO. If found, * check if it is still valid * 2. Object found: Check PM_STATUS * 2a. If Status is TRANSIENT or DELETED, error! * 2b. If Status is NOT_LOADED, continue with 3. * 2c. If Status is NEW, LOADED or CHANGED, success! * 3. Load object data from database and set object * 3.a Completion in super class * 4. clean up * ************************************************************************ * Changelog: * - 2004-01-07 : (SB) Initial version ************************************************************************ types: begin of TYP_BUSINESS_KEY_INDEX, BUSINESS_KEY type TYP_BUSINESS_KEY, INDEX type SY-TABIX, end of TYP_BUSINESS_KEY_INDEX, TYP_BUSINESS_KEY_INDEX_TAB type sorted table of TYP_BUSINESS_KEY_INDEX with non-unique key BUSINESS_KEY. data: FLAG_NOT_LOADED type OS_BOOLEAN, BKEY_STRING type STRING, TEMP_OBJECT_REF type TYP_OBJECT_REF, BUSINESS_KEY type TYP_BUSINESS_KEY, BUSINESS_KEY_TAB type TYP_BUSINESS_KEY_TAB, OBJECT_DATA_TAB type TYP_DB_DATA_TAB, BUSINESS_KEY_INDEX type TYP_BUSINESS_KEY_INDEX, BUSINESS_KEY_INDEX_TAB type TYP_BUSINESS_KEY_INDEX_TAB, NEXT_INDEX type SY-TABIX. data: TEMP_CURRENT_OBJECT_IREF type ref to OBJECT. field-symbols: <FS_OBJECT_DATA> type TYP_DB_DATA, <FS_BUSINESS_KEY> type TYP_BUSINESS_KEY, <FS_BUSINESS_KEY_INDEX> type TYP_BUSINESS_KEY_INDEX. * * 1. Look for objects in SPECIAL_OBJECT_INFO. If found, check if they * * are still valid loop at I_KEY_TAB assigning <FS_BUSINESS_KEY>. "#EC GEN_OK clear CURRENT_OBJECT_IREF. read table SPECIAL_BKEY_TAB into CURRENT_SPECIAL_OBJECT_INFO with table key BUSINESS_KEY = <FS_BUSINESS_KEY>. if ( SY-SUBRC = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = SY-TABIX. endif. if ( not CURRENT_OBJECT_IREF is initial ). * * 2. Object found: Check PM_STATUS case CURRENT_OBJECT_INFO-PM_STATUS. * * 2a. If Status is TRANSIENT or DELETED, error! when OSCON_OSTATUS_DELETED. *!!!!!!! Error: Object activation failed - Object marked for deletion TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( <FS_BUSINESS_KEY> ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>DELETED_BY_BKEY. when OSCON_OSTATUS_TRANSIENT. *!!!!!!! Error: Object activation failed - Object is transient TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( <FS_BUSINESS_KEY> ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>IS_TRANSIENT_BY_BKEY. * * 2b. If Status is NOT_LOADED, continue with 3. when OSCON_OSTATUS_NOT_LOADED. FLAG_NOT_LOADED = OSCON_TRUE. * * 2c. If Status is NEW, LOADED or CHANGED, success! when others. FLAG_NOT_LOADED = OSCON_FALSE. endcase. else." ( CURRENT_OBJECT_IREF is initial ) FLAG_NOT_LOADED = OSCON_TRUE. endif. if ( FLAG_NOT_LOADED = OSCON_TRUE ). append <FS_BUSINESS_KEY> to BUSINESS_KEY_TAB. endif. TEMP_OBJECT_REF ?= CURRENT_OBJECT_IREF. append TEMP_OBJECT_REF to RESULT. call method OS_CLEAR_CURRENT. endloop. * * 3. Load object data from database and set objects if ( BUSINESS_KEY_TAB is not initial ). * * internal Undo append INTERNAL_NEXT_UNDO_INFO to INTERNAL_TRANSACTION_STACK. INTERNAL_CURRENT_TRANSACTION = SY-TABIX. try. call method MAP_LOAD_FROM_DATABASE_KEY exporting I_BUSINESS_KEY_TAB = BUSINESS_KEY_TAB receiving result = OBJECT_DATA_TAB. catch CX_OS_DB_SELECT. clear OBJECT_DATA_TAB. endtry. loop at I_KEY_TAB assigning <FS_BUSINESS_KEY>. "EC GEN_OK BUSINESS_KEY_INDEX-BUSINESS_KEY = <FS_BUSINESS_KEY>. BUSINESS_KEY_INDEX-INDEX = SY-TABIX. insert BUSINESS_KEY_INDEX into table BUSINESS_KEY_INDEX_TAB. endloop. try. loop at OBJECT_DATA_TAB assigning <FS_OBJECT_DATA>. call method MAP_EXTRACT_IDENTIFIER exporting I_DB_DATA = <FS_OBJECT_DATA> importing E_BUSINESS_KEY = BUSINESS_KEY. clear CURRENT_OBJECT_IREF. call method PM_CHECK_AND_SET_ATTRIBUTES exporting I_OBJECT_DATA = <FS_OBJECT_DATA> I_ID_PROVIDED = ID_STATUS_NONE. TEMP_OBJECT_REF ?= CURRENT_OBJECT_IREF. read table BUSINESS_KEY_INDEX_TAB with key BUSINESS_KEY = BUSINESS_KEY assigning <FS_BUSINESS_KEY_INDEX>. while ( ( SY-SUBRC = 0 ) and ( <FS_BUSINESS_KEY_INDEX>-BUSINESS_KEY = BUSINESS_KEY ) ). NEXT_INDEX = SY-TABIX + 1. modify RESULT from TEMP_OBJECT_REF index <FS_BUSINESS_KEY_INDEX>-INDEX. read table BUSINESS_KEY_INDEX_TAB index NEXT_INDEX assigning <FS_BUSINESS_KEY_INDEX>. endwhile. * * 3.a. Completion in super class call method OS_PM_LOADED_PERSISTENT. clear CURRENT_SPECIAL_OBJECT_INFO. endloop. cleanup. call method OS_INTERNAL_UNDO. call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. endtry. * * Clean-up internal Undo delete INTERNAL_TRANSACTION_STACK index INTERNAL_CURRENT_TRANSACTION. add -1 to INTERNAL_CURRENT_TRANSACTION. if ( INTERNAL_TRANSACTION_STACK is initial ). clear INTERNAL_UNDO_INFO. INTERNAL_NEXT_UNDO_INFO = 1. endif. "( INTERNAL_TRANSACTION_STACK is initial? ) endif. * * 4. clean up clear CURRENT_SPECIAL_OBJECT_INFO. "IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_KEY_TAB endmethod. method IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_QUERY. ***BUILD 051402 " importing I_QUERY type ref to IF_OS_QUERY " I_PARAMETER_TAB type OSTYP_DREF_TAB optional " I_PAR1 type ANY optional " I_PAR2 type ANY optional " I_PAR3 type ANY optional " I_SUBCLASSES type OS_BOOLEAN default OSCON_FALSE " I_UPTO type I default 0 " returning value(RESULT) type OSREFTAB " raising CX_OS_OBJECT_NOT_FOUND " CX_OS_QUERY_ERROR ************************************************************************ * Purpose : Get persistent objects by Query * * Version : 2.0 * * Precondition : -- * * Postcondition : For each instance that satifies the filter * expression, there is a corresponding entry in the * RESULT table. The persistent objects are active. * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * (DELETED_BY_BKEY,TRANSIENT_BY_BKEY) * propagates PM_CHECK_AND_SET_ATTRIBUTES * propagates OS_PM_LOADED_PERISISTENT * * Implementation : 1. Load data by query * 2. Set objects from data * 2a. Object found: Check PM_STATUS * 2b. Object not found, replace * 2c. Set attributes * 2d. Completion in super class * 3. clean up * ************************************************************************ * Changelog: * - 2004-03-25 : (SB) Initial version ************************************************************************ data: FLAG_NOT_LOADED type OS_BOOLEAN, BKEY_STRING type STRING, TEMP_OBJECT_REF type TYP_OBJECT_REF, BUSINESS_KEY type TYP_BUSINESS_KEY, OBJECT_DATA_TAB type TYP_DB_DATA_TAB, QUERY type ref to IF_OS_QRY_SERVICE, WHERE_CLAUSE type STRING, ORDER_BY_CLAUSE type STRING. data: TEMP_CURRENT_OBJECT_IREF type ref to OBJECT. field-symbols: <FS_OBJECT_DATA> type TYP_DB_DATA. * * 1. Load data with query try. call method MAP_INITIALIZE_METADATA. QUERY ?= I_QUERY. call method QUERY->MAP exporting I_CLASS_AGENT = ME I_MAP_ATT_TAB = MAP_ATT_INFO_TAB. call method QUERY->GET_ORDER_BY_CLAUSE receiving RESULT = ORDER_BY_CLAUSE. if ( I_PARAMETER_TAB is supplied ). if ( ( I_PAR1 is supplied ) or ( I_PAR2 is supplied ) or ( I_PAR3 is supplied ) ). raise exception type CX_OS_QUERY_PARAMETER_ERROR exporting TEXTID = CX_OS_QUERY_PARAMETER_ERROR=>CALL_ERROR. endif. call method QUERY->GET_WHERE_CLAUSE exporting I_PARAMETER_TAB = I_PARAMETER_TAB receiving RESULT = WHERE_CLAUSE. call method MAP_LOAD_FROM_DATABASE exporting I_WHERE_CLAUSE = WHERE_CLAUSE I_ORDER_BY_CLAUSE = ORDER_BY_CLAUSE I_SUBCLASSES = I_SUBCLASSES I_UPTO = I_UPTO receiving result = OBJECT_DATA_TAB. else. call method QUERY->GET_WHERE_CLAUSE receiving RESULT = WHERE_CLAUSE. call method MAP_LOAD_FROM_DATABASE exporting I_WHERE_CLAUSE = WHERE_CLAUSE I_ORDER_BY_CLAUSE = ORDER_BY_CLAUSE I_SUBCLASSES = I_SUBCLASSES I_UPTO = I_UPTO PAR1 = I_PAR1 PAR2 = I_PAR2 PAR3 = I_PAR3 receiving result = OBJECT_DATA_TAB. endif. catch CX_OS_DB_SELECT. clear OBJECT_DATA_TAB. endtry. * * 2. Set objects from data try. * * internal Undo append INTERNAL_NEXT_UNDO_INFO to INTERNAL_TRANSACTION_STACK. INTERNAL_CURRENT_TRANSACTION = SY-TABIX. loop at OBJECT_DATA_TAB assigning <FS_OBJECT_DATA>. call method MAP_EXTRACT_IDENTIFIER exporting I_DB_DATA = <FS_OBJECT_DATA> importing E_BUSINESS_KEY = BUSINESS_KEY. clear CURRENT_OBJECT_IREF. read table SPECIAL_BKEY_TAB into CURRENT_SPECIAL_OBJECT_INFO with table key BUSINESS_KEY = BUSINESS_KEY. if ( SY-SUBRC = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = SY-TABIX. endif. if ( not CURRENT_OBJECT_IREF is initial ). * * 2a. Object found: Check PM_STATUS case CURRENT_OBJECT_INFO-PM_STATUS. * * 2a1. If Status is TRANSIENT or DELETED, error! when OSCON_OSTATUS_DELETED. * !!!!!!!! Error: Object activation failed - Object marked for deletion TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>DELETED_BY_BKEY. when OSCON_OSTATUS_TRANSIENT. * !!!!!!!!!! Error: Object activation failed - Object is transient TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. BKEY_STRING = MAP_SERIALIZE_BKEY( BUSINESS_KEY ). call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_NOT_FOUND definition load. raise exception type CX_OS_OBJECT_NOT_FOUND exporting OBJECT = TEMP_CURRENT_OBJECT_IREF BKEY = BKEY_STRING TEXTID = CX_OS_OBJECT_NOT_FOUND=>IS_TRANSIENT_BY_BKEY. * * 2a2. If Status is NOT_LOADED, replace when OSCON_OSTATUS_NOT_LOADED. FLAG_NOT_LOADED = OSCON_TRUE. * * 2a2. If Status is NEW, LOADED or CHANGED, don't replace when others. FLAG_NOT_LOADED = OSCON_FALSE. endcase. else." ( CURRENT_OBJECT_IREF is initial ) * * 2b. Object not found, replace FLAG_NOT_LOADED = OSCON_TRUE. endif. TEMP_OBJECT_REF ?= CURRENT_OBJECT_IREF. if ( FLAG_NOT_LOADED = OSCON_TRUE ). * * 2c. Set attributes call method PM_CHECK_AND_SET_ATTRIBUTES exporting I_OBJECT_DATA = <FS_OBJECT_DATA> I_ID_PROVIDED = ID_STATUS_NONE. TEMP_OBJECT_REF ?= CURRENT_OBJECT_IREF. * * 2d. Completion in super class call method OS_PM_LOADED_PERSISTENT. endif. append TEMP_OBJECT_REF to RESULT. call method OS_CLEAR_CURRENT. endloop. * * Clean-up internal Undo delete INTERNAL_TRANSACTION_STACK index INTERNAL_CURRENT_TRANSACTION. add -1 to INTERNAL_CURRENT_TRANSACTION. if ( INTERNAL_TRANSACTION_STACK is initial ). clear INTERNAL_UNDO_INFO. INTERNAL_NEXT_UNDO_INFO = 1. endif. "( INTERNAL_TRANSACTION_STACK is initial? ) cleanup. call method OS_INTERNAL_UNDO. call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. endtry. * * 3. clean up clear CURRENT_SPECIAL_OBJECT_INFO. "IF_OS_CA_PERSISTENCY~GET_PERSISTENT_BY_QUERY endmethod. method IF_OS_CA_SERVICE~SAVE. ***BUILD 051401 ************************************************************************ * Purpose : Prepare data for database (buffer) transfer * * Version : 2.0 * * Precondition : -- * * Postcondition : data is prepared for saving * if UPDATE_MODE is direct, it is saved to DB * if UPDATE_MODE is LOCAL or UPDATE_TASK, * the corresponding function call is registered * * OO Exceptions : propagates MAP_SAVE_TO_DATABASE * propagates MAP_GET_ATTRIBUTES. * * Implementation : * ************************************************************************ * Changelog: * - 2000-03-02 : (BGR) Initial Version * - 2000-08-02 : (SB) OO Exceptions * - 2001-01-06 : (SB) Update with EXPORT TO DATA BUFFER * - 2003-03-20 : (SB) post only if there dirty instances ************************************************************************ data: NEW_OBJECT_REF_TAB type TYP_OBJECT_REF_TAB, CHANGED_OBJECT_REF_TAB type TYP_OBJECT_REF_TAB, INSERT_DATA_TAB type TYP_DB_DATA_TAB , INSERT_KEY_TAB type TYP_BUSINESS_KEY_TAB, UPDATE_DATA_TAB type TYP_DB_DATA_TAB , UPDATE_KEY_TAB type TYP_BUSINESS_KEY_TAB, DELETE_TAB type TYP_DB_DELETE_TAB , UPDATE_MODE type OS_DMODE, OBJECT_REF type TYP_OBJECT_REF, OBJECT_INDEX type TYP_INDEX, XCONTAINER type XSTRING. field-symbols: <FS_OBJECT_INFO_ITEM> type TYP_OBJECT_INFO, <FS_SPECIAL_OBJECT_INFO_ITEM> type TYP_SPECIAL_OBJECT_INFO. * * 1. get strong reference, BKey for all objects with status * * NEW, CHANGED or DELETED loop at OBJECT_INFO assigning <FS_OBJECT_INFO_ITEM> "#EC CI_SORTSEQ where ( PM_STATUS = OSCON_OSTATUS_NEW or "#EC CI_SORTSEQ PM_STATUS = OSCON_OSTATUS_CHANGED or "#EC CI_SORTSEQ PM_STATUS = OSCON_OSTATUS_DELETED ) and "#EC CI_SORTSEQ OM_IGNORE = OSCON_FALSE. "#EC CI_SORTSEQ OBJECT_INDEX = sy-tabix. case <FS_OBJECT_INFO_ITEM>-PM_STATUS. when OSCON_OSTATUS_NEW. read table SPECIAL_OBJECT_INFO assigning <FS_SPECIAL_OBJECT_INFO_ITEM> index OBJECT_INDEX. OBJECT_REF ?= <FS_OBJECT_INFO_ITEM>-OBJECT_IREF. append OBJECT_REF to NEW_OBJECT_REF_TAB. append <FS_SPECIAL_OBJECT_INFO_ITEM>-BUSINESS_KEY to INSERT_KEY_TAB. when OSCON_OSTATUS_CHANGED. read table SPECIAL_OBJECT_INFO assigning <FS_SPECIAL_OBJECT_INFO_ITEM> index OBJECT_INDEX. OBJECT_REF ?= <FS_OBJECT_INFO_ITEM>-OBJECT_IREF. append OBJECT_REF to CHANGED_OBJECT_REF_TAB. append <FS_SPECIAL_OBJECT_INFO_ITEM>-BUSINESS_KEY to UPDATE_KEY_TAB. when OSCON_OSTATUS_DELETED. read table SPECIAL_OBJECT_INFO assigning <FS_SPECIAL_OBJECT_INFO_ITEM> index OBJECT_INDEX. append <FS_SPECIAL_OBJECT_INFO_ITEM> to DELETE_TAB. endcase." Status endloop. "at OBJECT_INFO * * 2. get attributes for new and changed objects * * New Objects if ( not NEW_OBJECT_REF_TAB is initial ). call method MAP_GET_ATTRIBUTES exporting I_OBJECT_REF_TAB = NEW_OBJECT_REF_TAB importing E_OBJECT_DATA_TAB = INSERT_DATA_TAB. call method MAP_MERGE_IDENTIFIER exporting I_BUSINESS_KEY_TAB = INSERT_KEY_TAB changing C_DB_DATA_TAB = INSERT_DATA_TAB. endif. "( not NEW_OBJECT_REF_TAB is initial ). * * Changed Objects if ( not CHANGED_OBJECT_REF_TAB is initial ). call method MAP_GET_ATTRIBUTES exporting I_OBJECT_REF_TAB = CHANGED_OBJECT_REF_TAB importing E_OBJECT_DATA_TAB = UPDATE_DATA_TAB. call method MAP_MERGE_IDENTIFIER exporting I_BUSINESS_KEY_TAB = UPDATE_KEY_TAB changing C_DB_DATA_TAB = UPDATE_DATA_TAB. endif. "( not CHANGED_OBJECT_REF_TAB is initial ). * * 3. perform or subscribe DB operations if ( ( INSERT_DATA_TAB is not initial ) or ( UPDATE_DATA_TAB is not initial ) or ( DELETE_TAB is not initial ) ). UPDATE_MODE = PERSISTENCY_MANAGER->GET_UPDATE_MODE( ). if ( UPDATE_MODE = DMODE_DIRECT ). * * Direct DB operations call method MAP_SAVE_TO_DATABASE exporting I_INSERTS = INSERT_DATA_TAB I_UPDATES = UPDATE_DATA_TAB I_DELETES = DELETE_TAB. else." ( Update task ) * * export data to be saved to DB to data buffer export INSERT_DATA_TAB = INSERT_DATA_TAB UPDATE_DATA_TAB = UPDATE_DATA_TAB DELETE_TAB = DELETE_TAB to data buffer XCONTAINER. * * call update function in update task. this function * * calls the method if_os_ca_service~save_in_update_task * * of this class agent. call function 'OS_UPDATE_CLASS' in update task exporting CLASSNAME = CLASS_INFO-CLASS_AGENT_NAME XCONTAINER = XCONTAINER. endif." (Update mode?) endif." (something to post?) "IF_OS_CA_SERVICE~SAVE endmethod. method IF_OS_CA_SERVICE~SAVE_IN_UPDATE_TASK. ***BUILD 051401 " importing XCONTAINER type XSTRING optional ************************************************************************ * Purpose : save object data to DB when running in update task * mode. * * Version : 2.0 * * Precondition : no object service environment is set, no objects * exist in update task * * Postcondition : data has been saved to DB * * OO Exceptions : propagates MAP_SAVE_TO_DATABASE * * Implementation : * ************************************************************************ * Changelog: * - 2000-03-02 : (BGR) Initial Version * - 2000-08-02 : (SB) OO Exceptions * - 2001-01-06 : (SB) Update with EXPORT TO DATA BUFFER ************************************************************************ data: INSERT_DATA_TAB type TYP_DB_DATA_TAB , UPDATE_DATA_TAB type TYP_DB_DATA_TAB , DELETE_TAB type TYP_DB_DELETE_TAB . * * import data to be saved to DB from data buffer import INSERT_DATA_TAB = INSERT_DATA_TAB UPDATE_DATA_TAB = UPDATE_DATA_TAB DELETE_TAB = DELETE_TAB from data buffer XCONTAINER. * * store them to DB call method MAP_SAVE_TO_DATABASE exporting I_INSERTS = INSERT_DATA_TAB I_UPDATES = UPDATE_DATA_TAB I_DELETES = DELETE_TAB. "IF_OS_CA_SERVICE~SAVE_IN_UPDATE_TASK endmethod. method IF_OS_FACTORY~CREATE_PERSISTENT_BY_KEY. ***BUILD 051402 * importing I_KEY type any * returning result type ref to object ************************************************************************ * Purpose : Create a new persistent object identified by the * given business key * * Version : 2.0 * * Precondition : No object exists with the given business key, neither * in memory nor on database. * * Postcondition : The object exists in memory and will result in a * new entry on database when the top transaction is * closed. * * OO Exceptions : propagates CREATE_PERSISTENT * * Implementation : call CREATE_PERSISTENT * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version 2.0 * - 2000-08-02 : (SB) OO Exceptions ************************************************************************ data: BUSINESS_KEY type TYP_BUSINESS_KEY. BUSINESS_KEY = I_KEY. *< Generated from mapping: call method CREATE_PERSISTENT exporting I_PRODUCTO = BUSINESS_KEY-PRODUCTO receiving RESULT = RESULT. *> "IF_OS_FACTORY~CREATE_PERSISTENT_BY_KEY endmethod. method IF_OS_FACTORY~CREATE_TRANSIENT_BY_KEY. ***BUILD 051402 * importing I_KEY type any * returning result type ref to object ************************************************************************ * Purpose : Create a new transient object identified by the * given business key * * Version : 2.0 * * Precondition : No object exists with the given business key * * Postcondition : The object exists in memory * * OO Exceptions : propagates CREATE_TRANSIENT * * Implementation : call CREATE_TRANSIENT * ************************************************************************ * Changelog: * - 2001-01-01 : (SB) Initial Version 2.0 ************************************************************************ data: BUSINESS_KEY type TYP_BUSINESS_KEY. BUSINESS_KEY = I_KEY. *< Generated from mapping: call method CREATE_TRANSIENT exporting I_PRODUCTO = BUSINESS_KEY-PRODUCTO receiving RESULT = RESULT. *> "IF_OS_FACTORY~CREATE_TRANSIENT_BY_KEY endmethod. method LOAD_SPECIAL_OBJECT_INFO. ***BUILD 051401 ************************************************************************ * Purpose : Load CURRENT_SPECIAL_OBJECT_INFO from * SPECIAL_OBJECT_INFO * * Version : 2.0 * * Precondition : Index is set in CURRENT_OBJECT_INDEX * * Postcondition : entry is loaded * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-02 : (BGR) Initial Version ************************************************************************ read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO index CURRENT_OBJECT_INDEX. "LOAD_SPECIAL_OBJECT_INFO endmethod. method MAP_EXTRACT_IDENTIFIER. ***BUILD 051402 " importing I_DB_DATA type TYP_DB_DATA " exporting E_BUSINESS_KEY type TYP_BUSINESS_KEY ************************************************************************ * Purpose : Extract Business Key from given DB_DATA * * Version : 2.0 * * Precondition : DB_DATA is a structure with object data read from * DB including Keys and GUID * * Postcondition : E_BUSINESS_KEY is the business key extracted from * I_DB_DATA * * OO Exceptions : -- * * Implementation : * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version * - 2000-08-02 : (SB) OO Exceptions ************************************************************************ * Generated! Do not modify! ************************************************************************ *<Generated from mapping: E_BUSINESS_KEY-PRODUCTO = I_DB_DATA-PRODUCTO. *> "MAP_EXTRACT_IDENTIFIER endmethod. method MAP_GET_ATTRIBUTES. ***BUILD 051401 " importing I_OBJECT_REF_TAB type TYP_OBJECT_REF_TAB " exporting E_OBJECT_DATA_TAB type TYP_DB_DATA_TAB ************************************************************************ * Purpose : Get object data from objects * * Version : 2.0 * * Precondition : I_OBJECT_REF_TAB is a list of objects that have a * valid state (new, changed) * * Postcondition : E_OBJECT_DATA_TAB contains all object data of the * given objects. It is a table of the same size like * I_OBJECT_REF_TAB with corresponding entries. * GUID (and Business Key) will be added later. * * OO Exceptions : CX_OS_OBJECT_REFERENCE collects GET_OID_BY_REF * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version * - 2000-08-03 : (SB) OO Exceptions * - 2002-01-17 : (SB) private attributes in super classes ************************************************************************ * Generated! Do not modify! ************************************************************************ data: THE_OBJECT type ref to ZCL_PRODUCTO_PERSIST, OBJECT_DATA_ITEM type TYP_DB_DATA, PM_SERVICE type ref to IF_OS_PM_SERVICE. "#EC NEEDED data: EX type ref to CX_ROOT, "#EC * EX_TAB type OSTABLEREF. PM_SERVICE ?= PERSISTENCY_MANAGER. loop at I_OBJECT_REF_TAB into THE_OBJECT. clear OBJECT_DATA_ITEM. *< Generated from mapping: OBJECT_DATA_ITEM-PRODUCTO = THE_OBJECT->PRODUCTO. *> APPEND OBJECT_DATA_ITEM TO E_OBJECT_DATA_TAB. endloop."at I_OBJECT_REF_TAB if ( not EX_TAB is initial ). raise exception type CX_OS_OBJECT_REFERENCE exporting EXCEPTION_TAB = EX_TAB. endif. "MAP_GET_ATTRIBUTES endmethod. method MAP_INITIALIZE_METADATA. ***BUILD 051401 ************************************************************************ * Purpose : Initialize the mapping metadata, * * Version : 2.0 * * Precondition : - * * Postcondition : The mapping metadata table MAP_ATT_INFO_TAB * contains an entry for all persistent attributes * accessible from a query expression * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2004-03-25 : (SB) Initial Version ************************************************************************ data: MAP_ATT_INFO type OSTYP_RT_MAP_ATT_INFO. if MAP_ATT_INFO_TAB is initial. clear MAP_ATT_INFO. MAP_ATT_INFO-NAME = 'PRODUCTO'. MAP_ATT_INFO-EXPOSURE = '2'. MAP_ATT_INFO-RECORDNAME = 'ZBT_PRODUCTO'. MAP_ATT_INFO-FIELD_NAME1 = 'PRODUCTO'. insert MAP_ATT_INFO into table MAP_ATT_INFO_TAB. endif. "MAP_INITIALIZE_METADATA endmethod. method MAP_INVALIDATE. ***BUILD 051401 " importing I_OBJECT_IREF_TAB type TYP_OBJECT_TAB ************************************************************************ * Purpose : Invalidate state of all objects in I_OBJECT_IREF_TAB * * Version : 2.0 * * Precondition : Objects in I_OBJECT_IREF_TAB exist * * Postcondition : Their state in cleared * * OO Exceptions : - * * Implementation : - call method IF_OS_STATE~INVALIDATE * - clear object's (persistent) attributes * ************************************************************************ * Changelog: * - 2000-04-17 : (BGR) Initial Version * - 2000-08-02 : (SB) OO Exceptions * - 2002-01-17 : (SB) private attributes in super classes ************************************************************************ data: OBJECT_IREF type TYP_OBJECT_IREF, THE_OBJECT type ref TO ZCL_PRODUCTO_PERSIST. loop at I_OBJECT_IREF_TAB into OBJECT_IREF. if ( not OBJECT_IREF is initial ). call method OBJECT_IREF->INVALIDATE. THE_OBJECT ?= OBJECT_IREF. *< Generated from Mapping: clear: THE_OBJECT->PRODUCTO. *> endif. "( not initial ) endloop. "at I_OBJECT_IREF_TAB "MAP_INVALIDATE endmethod. method MAP_LOAD_FROM_DATABASE. ***BUILD 051401 " importing I_WHERE_CLAUSE type STRING optional " I_ORDER_BY_CLAUSE type STRING optional " I_SUBCLASSES type OS_BOOLEAN default OSCON_FALSE " I_UPTO type I value 0 " PAR1 type ANY optional " PAR2 type ANY optional " PAR3 type ANY optional " returning value(RESULT) type TYP_DB_DATA_TAB ************************************************************************ * Purpose : Load object data identified by I_WHERE_CLAUSE with * PAR1, PAR2 and PAR3 from DB to DB_DATA Table * * Version : 2.0 * * Precondition : I_WHERE_CLAUSE is valid where clause in Open-SQL * * Postcondition : RESULT is the corresponding table of object * attributes read from DB * * OO Exceptions : CX_OS_DB_SELECT * * Implementation : - * ************************************************************************ * Changelog: * - 2004-03-25 : (SB) Initial Version * - 2005-04-06 : (SB) Single Table ************************************************************************ data: DB_DATA type TYP_DB_DATA. *< Generated from mapping: types: TYP_DB_DATA_LOCAL type ZBT_PRODUCTO. *> types: TYP_DB_DATA_LOCAL_TAB type standard table of TYP_DB_DATA_LOCAL with non-unique default key . data: DB_DATA_LOCAL_TAB type TYP_DB_DATA_LOCAL_TAB. field-symbols: <FS_DB_DATA_LOCAL> type TYP_DB_DATA_LOCAL. *< Generated from mapping: field-symbols: <FS_DB_ZBT_PRODUCTO> type ZBT_PRODUCTO. *> *< Generated from mapping: select * from ZBT_PRODUCTO up to I_UPTO rows into table DB_DATA_LOCAL_TAB where (I_WHERE_CLAUSE) order by (I_ORDER_BY_CLAUSE). *> * * error handling if ( SY-SUBRC <> 0 ). class CX_OS_DB_SELECT definition load. raise exception type CX_OS_DB_SELECT exporting TABLE = 'ZBT_PRODUCTO' WHERE_CLAUSE = I_WHERE_CLAUSE TEXTID = CX_OS_DB_SELECT=>BY_QUERY. endif. "( Error ) loop at DB_DATA_LOCAL_TAB assigning <FS_DB_DATA_LOCAL>. assign <FS_DB_DATA_LOCAL> to <FS_DB_ZBT_PRODUCTO>. *< Generated from mapping: DB_DATA-PRODUCTO = <FS_DB_ZBT_PRODUCTO>-PRODUCTO. *> append DB_DATA to RESULT. endloop." at DB_TAB "MAP_LOAD_FROM_DATABASE endmethod. method MAP_LOAD_FROM_DATABASE_KEY. ***BUILD 051401 " importing I_BUSINESS_KEY_TAB type TYP_BUSINESS_KEY_TAB " returning value(RESULT) type TYP_DB_DATA_TAB ************************************************************************ * Purpose : Load object data identified by I_BUSINESS_KEY_TAB * from DB to DB_DATA Table * * Version : 2.0 * * Precondition : I_BUSINESS_KEY_TAB is a table of valid business keys * * Postcondition : RESULT is the corresponding table of object * attributes read from DB * * OO Exceptions : CX_OS_DB_SELECT * * Implementation : - * ************************************************************************ * Changelog: * - 1999-09-21 : (OS) Initial Version * - 2000-03-06 : (BGR) Version 2.0 - difference between loading 1 and * many entries * - 2000-06-15 : (BGR) Support for multi-table loading * - 2000-08-03 : (SB) OO Exceptions * - 2001-03-27 : (MWI) Loading several objects (type mapping) * - 2001-11-26 : (SB) Refactoring Generation * - 2002-01-17 : (SB) Bugfix for tables with namespace * - 2002-01-17 : (SB) private attributes in super classes * - 2004-01-07 : (SB) Multi Access * - 2005-02-22 : (SB) Inner Joins * - 2005-04-06 : (SB) Single Table ************************************************************************ data: DB_DATA type TYP_DB_DATA. *< Generated from mapping: types: TYP_DB_DATA_LOCAL type ZBT_PRODUCTO. *> types: TYP_DB_DATA_LOCAL_TAB type standard table of TYP_DB_DATA_LOCAL with non-unique default key . data: DB_DATA_LOCAL_TAB type TYP_DB_DATA_LOCAL_TAB. field-symbols: <FS_DB_DATA_LOCAL> type TYP_DB_DATA_LOCAL. *< Generated from mapping: field-symbols: <FS_DB_ZBT_PRODUCTO> type ZBT_PRODUCTO. *> *< Generated from mapping: select * from ZBT_PRODUCTO into table DB_DATA_LOCAL_TAB for all entries in I_BUSINESS_KEY_TAB where ZBT_PRODUCTO~PRODUCTO = I_BUSINESS_KEY_TAB-PRODUCTO. *> * * error handling if ( SY-SUBRC <> 0 ). class CX_OS_DB_SELECT definition load. raise exception type CX_OS_DB_SELECT exporting TABLE = 'ZBT_PRODUCTO' TEXTID = CX_OS_DB_SELECT=>BY_BKEYTAB. endif. "( Error ) loop at DB_DATA_LOCAL_TAB assigning <FS_DB_DATA_LOCAL>. assign <FS_DB_DATA_LOCAL> to <FS_DB_ZBT_PRODUCTO>. *< Generated from mapping: DB_DATA-PRODUCTO = <FS_DB_ZBT_PRODUCTO>-PRODUCTO. *> append DB_DATA to RESULT. endloop." at DB_DATA_LOCAL_TAB "MAP_LOAD_FROM_DATABASE_KEY endmethod. method MAP_MERGE_IDENTIFIER. ***BUILD 051402 " importing I_BUSINESS_KEY_TAB type TYP_BUSINESS_KEY_TAB " changing C_DB_DATA_TAB type TYP_DB_DATA_TAB ************************************************************************ * Purpose : Merge Table I_BUSINESS_KEY_TAB to C_DB_DATA_TAB. * The result is a complete DB_DATA table to be stored * in DB. * * Version : 2.0 * * Precondition : C_DB_DATA is a Table filled with object data * I_BUSINESS_KEY_TAB is a table of the same size with * corresponding entries. * * Postcondition : C_DB_DATA_TAB is complete * * OO Exceptions : -- * * Implementation : * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version ************************************************************************ * Generated! Do not modify! ************************************************************************ data: BUSINESS_KEY type TYP_BUSINESS_KEY. field-symbols <FS_OBJECT_DATA> type TYP_DB_DATA. loop at C_DB_DATA_TAB assigning <FS_OBJECT_DATA>. read table I_BUSINESS_KEY_TAB into BUSINESS_KEY index SY-TABIX. *< Generated from mapping: <FS_OBJECT_DATA>-PRODUCTO = BUSINESS_KEY-PRODUCTO. *> endloop." at C_DB_DATA_TAB "MAP_MERGE_IDENTIFIER endmethod. method MAP_SAVE_TO_DATABASE. ***BUILD 051401 " importing I_DELETES type TYP_DB_DELETE_TAB " I_INSERTS type TYP_DB_DATA_TAB " I_UPDATES type TYP_DB_DATA_TAB ************************************************************************ * Purpose : Do database operations: * Insert new object data from I_INSERTS, * Update changed object data from I_UPDATES and * Delete entries for deleted objects from I_DELETES * * Version : 2.0 * * Precondition : I_DELETES,I_INSERTS and I_UPDATES contain ALL * necessary information (Keys, Data) * If this method is called in update task, there * is NO MORE information, no objects exist anymore. * * Postcondition : All database operations have been performed. * * OO Exceptions : CX_OS_DB_INSERT, CX_OS_DB_UPDATE, CX_OS_DB_DELETE * * Implementation : - * ************************************************************************ * Changelog: * - 1999-09-21 : (OS) Initial Version * - 2000-03-06 : (BGR) Version 2.0 * - 2001-11-26 : (SB) Refactoring Generation * - 2002-01-17 : (SB) private attributes in super classes ************************************************************************ *< Generated from mapping: * * ZBT_PRODUCTO: internal tables for mass operation data DB_ITB_ZBT_PRODUCTO type STANDARD TABLE OF ZBT_PRODUCTO. data DB_UTB_ZBT_PRODUCTO type STANDARD TABLE OF ZBT_PRODUCTO. data DB_DTB_ZBT_PRODUCTO type STANDARD TABLE OF ZBT_PRODUCTO. * * ZBT_PRODUCTO: headlines for tables data DB_ILN_ZBT_PRODUCTO type ZBT_PRODUCTO. data DB_ULN_ZBT_PRODUCTO type ZBT_PRODUCTO. data DB_DLN_ZBT_PRODUCTO type ZBT_PRODUCTO. *> field-symbols <FS_INSERT> type TYP_DB_DATA. field-symbols <FS_UPDATE> type TYP_DB_DATA. field-symbols <FS_DELETE> type TYP_SPECIAL_OBJECT_INFO. * * Collect Inserts loop at I_INSERTS assigning <FS_INSERT>. *< Generated from mapping: DB_ILN_ZBT_PRODUCTO-PRODUCTO = <FS_INSERT>-PRODUCTO. append DB_ILN_ZBT_PRODUCTO to DB_ITB_ZBT_PRODUCTO. *> endloop. "at I_INSERTS * * Collect Updates loop at I_UPDATES assigning <FS_UPDATE>. *< Generated from mapping: DB_ULN_ZBT_PRODUCTO-PRODUCTO = <FS_UPDATE>-PRODUCTO. append DB_ULN_ZBT_PRODUCTO TO DB_UTB_ZBT_PRODUCTO. *> endloop. "at I_UPDATES * * Collect Deletes loop at I_DELETES assigning <FS_DELETE>. DB_DLN_ZBT_PRODUCTO-PRODUCTO = <FS_DELETE>-BUSINESS_KEY-PRODUCTO. append DB_DLN_ZBT_PRODUCTO TO DB_DTB_ZBT_PRODUCTO. endloop. "at I_DELETES * * Perform DB Operations: *< Generated from mapping: * * DB Deletes delete ZBT_PRODUCTO FROM TABLE DB_DTB_ZBT_PRODUCTO. if SY-SUBRC <> 0. raise exception type CX_OS_DB_DELETE exporting TABLE = 'ZBT_PRODUCTO'. endif. * * DB Inserts insert ZBT_PRODUCTO FROM TABLE DB_ITB_ZBT_PRODUCTO accepting duplicate keys. if SY-SUBRC <> 0. raise exception type CX_OS_DB_INSERT exporting TABLE = 'ZBT_PRODUCTO'. endif. * * DB Updates update ZBT_PRODUCTO FROM TABLE DB_UTB_ZBT_PRODUCTO. if SY-SUBRC <> 0. raise exception type CX_OS_DB_UPDATE exporting TABLE = 'ZBT_PRODUCTO'. endif. *> "MAP_SAVE_TO_DATABASE endmethod. method MAP_SERIALIZE_BKEY. ***BUILD 051401 " importing I_BUSINESS_KEY type TYP_BUSINESS_KEY " returning value(RESULT) type STRING ************************************************************************ * Purpose : Converts business key to string. Can't be done * by move because of possible GUIDs (type X) in * business key structure. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2000-11-23 : (SB) initial versiuon ************************************************************************ * Generated! Do not modify! ************************************************************************ data: TEMP_STRING type STRING. data: COMP_STRING type STRING. *< Generated from mapping: COMP_STRING = I_BUSINESS_KEY-PRODUCTO. concatenate COMP_STRING TEMP_STRING into TEMP_STRING. *> RESULT = TEMP_STRING. " MAP_SERIALIZE_BKEY endmethod. method MAP_SET_ATTRIBUTES. ***BUILD 051401 " importing I_OBJECT_DATA type TYP_DB_DATA " I_OBJECT_REF type TYP_OBJECT_REF " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set objects from given object data * * Version : 2.0 * * Precondition : I_OBJECT_REF is a reference to the object that will * be set with data from I_OBJECT_DATA * * Postcondition : The object's attributes are set. * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version * - 2000-08-03 : (SB) OO Exceptions * - 2002-01-17 : (SB) private attributes in super classes ************************************************************************ * Generated! Do not modify! ************************************************************************ data: THE_OBJECT type ref to ZCL_PRODUCTO_PERSIST, AN_OBJECT type ref to OBJECT, "#EC * PM_SERVICE type ref to IF_OS_PM_SERVICE. "#EC NEEDED PM_SERVICE ?= PERSISTENCY_MANAGER. THE_OBJECT = I_OBJECT_REF. *< Generated from mapping: THE_OBJECT->PRODUCTO = I_OBJECT_DATA-PRODUCTO. *> "MAP_SET_ATTRIBUTES endmethod. method OS_PM_DELETE_PERSISTENT. ***BUILD 051401 ************************************************************************ * Purpose : Delete persistent object. It is marked DELETED in * memory and removed from DB when the top transaction * is closed. * * Version : 2.0 * * Precondition : The object is persistent (not transient), CURRENT * is set * * Postcondition : Instance is marked for deletion. * * OO Exceptions : propagates PM_DELETE_PERSISTENT * * Implementation : load special object info and * call PM_DELETE_PERSISTENT * ************************************************************************ * Changelog: * - 2001-12-14 : (SB) Initial Version ************************************************************************ call method LOAD_SPECIAL_OBJECT_INFO( ). call method PM_DELETE_PERSISTENT( ). "OS_PM_DELETE_PERSISTENT . endmethod. method PM_CHECK_AND_SET_ATTRIBUTES. ***BUILD 051401 " importing I_OBJECT_DATA type TYP_DB_DATA " importing I_BUSINESS_KEY type TYP_BUSINESS_KEY optional " I_ID_PROVIDED type TYP_ID_STATUS default ID_STATUS_NONE ************************************************************************ * Purpose : check loaded object data of a persistent object and * set object's attributes * if CURRENT is clear, create new representant, * if CURRENT is set, use this object to set the loaded * data * If I_ID_PROVIDED is set to ID_STATUS_NONE, Look for * an entry in SPECIAL_OBJECT_INFO with the given * Business Key * * Version : 2.0 * * Precondition : * * Postcondition : Persistent object data is checked and object * attributes are set. CURRENT is set. * * OO Exception : CX_OS_OBJECT_STATE(INTERNAL_CHANGED,INTERNAL_DELETED, * INTERNAL_TRANSIENT, INTERNAL_NEW) * propagates MAP_SET_ATTRIBUTES * * Implementation : 1. If CURRENT is clear: * 1a. I_ID_PROVIDED = ID_STATUS_NONE?: * Check if another object exists with this * Business Key * 1b. I_ID_PROVIDED <> ID_STATUS_NONE or no entry * found: * Create a new Representative object * 1c. If an object has been found: * Check if it is allowed to set it * 2. set PM_DBSTATUS EXISTING * 3. Temporarily save CURRENT_* * 4. set object attributes (resolving references) * 5. restore CURRENT_* * ************************************************************************ * Changelog: * - 2000-05-17 : (BGR) Initial Version 2.0 * - 2000-08-03 : (SB) OO Exceptions ************************************************************************ data: LOADED_BUSINESS_KEY type TYP_BUSINESS_KEY. data: TEMP_CURRENT_OBJECT_INFO type TYP_OBJECT_INFO, TEMP_CURRENT_OBJECT_INDEX type TYP_INDEX, TEMP_CURRENT_SPECIAL_OI type TYP_SPECIAL_OBJECT_INFO, TEMP_CURRENT_OBJECT_IREF type TYP_OBJECT_IREF, INTERNAL_UNDO_INFO_ITEM type TYP_INTERNAL_UNDO_INFO, TEMP_OBJECT_REF type TYP_OBJECT_REF. * * Get both Business Key from DB data call method MAP_EXTRACT_IDENTIFIER exporting I_DB_DATA = I_OBJECT_DATA importing E_BUSINESS_KEY = LOADED_BUSINESS_KEY. if ( CURRENT_OBJECT_IREF is initial ). * * 1. If CURRENT is clear: if ( I_ID_PROVIDED = ID_STATUS_NONE ). * * 1a. Check if another object exists with this Business Key read table SPECIAL_BKEY_TAB into TEMP_CURRENT_SPECIAL_OI with table key BUSINESS_KEY = LOADED_BUSINESS_KEY. if ( sy-subrc = 0 ). read table SPECIAL_OBJECT_INFO into CURRENT_SPECIAL_OBJECT_INFO with table key OBJECT_ID = TEMP_CURRENT_SPECIAL_OI-OBJECT_ID. call method OS_LOAD_AND_VALIDATE_CURRENT exporting I_INDEX = sy-tabix. endif. " ( Entry found for BKEY? ) endif. "( no ID Provided ) if ( CURRENT_OBJECT_IREF is initial ). * * 1b. Create a new Representative object and a new entry call method PM_CREATE_REPRESENTANT exporting I_BUSINESS_KEY = LOADED_BUSINESS_KEY. else. "( Found an entry for the business key ) * * Now we know an entry exists on DB CURRENT_OBJECT_INFO-PM_DBSTATUS = OSCON_DBSTATUS_EXISTING. modify OBJECT_INFO from CURRENT_OBJECT_INFO index CURRENT_OBJECT_INDEX. * * 1c. Check if it is allowed to use the found object. case CURRENT_OBJECT_INFO-PM_STATUS. * * PM_STATUS = NOT_LOADED: re-use entry and object when OSCON_OSTATUS_NOT_LOADED. * * PM_STATUS = LOADED: re-use entry and object when OSCON_OSTATUS_LOADED. * * other PM_STATUS: Error! when OSCON_OSTATUS_NEW. *!!!!!!!!!! Error! Object already exists on DB * * This NEW object should be created on DB by the next * * COMMIT. Now an entry was found with the same key! class CX_OS_OBJECT_STATE definition load. raise exception type CX_OS_OBJECT_STATE exporting OBJECT = CURRENT_OBJECT_IREF TEXTID = CX_OS_OBJECT_STATE=>INTERNAL_NEW. when OSCON_OSTATUS_CHANGED. *!!!!!!!!!!! Error: Object has a DB relevant status class CX_OS_OBJECT_STATE definition load. raise exception type CX_OS_OBJECT_STATE exporting OBJECT = CURRENT_OBJECT_IREF TEXTID = CX_OS_OBJECT_STATE=>INTERNAL_CHANGED. when OSCON_OSTATUS_DELETED. *!!!!!!!!!!! Error: Object marked for deletion class CX_OS_OBJECT_STATE definition load. raise exception type CX_OS_OBJECT_STATE exporting OBJECT = CURRENT_OBJECT_IREF TEXTID = CX_OS_OBJECT_STATE=>INTERNAL_DELETED. when OSCON_OSTATUS_TRANSIENT. *!!!!!!!!!!! Error: Object is transient class CX_OS_OBJECT_STATE definition load. raise exception type CX_OS_OBJECT_STATE exporting OBJECT = CURRENT_OBJECT_IREF TEXTID = CX_OS_OBJECT_STATE=>INTERNAL_TRANSIENT. endcase. endif. "( CURRENT initial? ) endif. "( CURRENT initial? ) * * 2. set PM_DBSTATUS EXISTING CURRENT_OBJECT_INFO-PM_DBSTATUS = OSCON_DBSTATUS_EXISTING. * * internal Undo entry: INTERNAL_UNDO_INFO_ITEM-OBJECT_INDEX = CURRENT_OBJECT_INDEX. INTERNAL_UNDO_INFO_ITEM-OBJECT_INFO = CURRENT_OBJECT_INFO. append INTERNAL_UNDO_INFO_ITEM to INTERNAL_UNDO_INFO. INTERNAL_NEXT_UNDO_INFO = sy-tabix + 1. * * To avoid recursive loading of the same object (INIT method) * * temporarily set status 'LOADING' CURRENT_OBJECT_INFO-PM_STATUS = OSCON_OSTATUS_LOADING. modify OBJECT_INFO from CURRENT_OBJECT_INFO index CURRENT_OBJECT_INDEX. * * 3. Temporarily save CURRENT_* TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. TEMP_CURRENT_OBJECT_INFO = CURRENT_OBJECT_INFO. TEMP_CURRENT_OBJECT_INDEX = CURRENT_OBJECT_INDEX. TEMP_CURRENT_SPECIAL_OI = CURRENT_SPECIAL_OBJECT_INFO. * * 4. set object attributes (resolving references) TEMP_OBJECT_REF ?= CURRENT_OBJECT_IREF . call method MAP_SET_ATTRIBUTES exporting I_OBJECT_DATA = I_OBJECT_DATA I_OBJECT_REF = TEMP_OBJECT_REF. * * 5. restore CURRENT_* CURRENT_OBJECT_INFO = TEMP_CURRENT_OBJECT_INFO. CURRENT_OBJECT_INDEX = TEMP_CURRENT_OBJECT_INDEX. CURRENT_SPECIAL_OBJECT_INFO = TEMP_CURRENT_SPECIAL_OI. CURRENT_OBJECT_IREF = TEMP_CURRENT_OBJECT_IREF. * * the method call get_ref_by_oid in map_set_attributes * * eventually creates new entries in the * * administrative data tables, it is necessary to * * to recalculate the index read table OBJECT_INFO transporting no fields with table key OBJECT_ID = CURRENT_OBJECT_INFO-OBJECT_ID. CURRENT_OBJECT_INDEX = sy-tabix. "PM_CHECK_AND_SET_ATTRIBUTES endmethod. method PM_CREATE_REPRESENTANT. ***BUILD 051402 " importing I_BUSINESS_KEY type TYP_BUSINESS_KEY " returning result type TYP_OBJECT_REF ************************************************************************ * Purpose : Create a new representative object including a new * entry in administrative data (OBJECT_INFO and * SPECIAL_OBJECT_INFO) * * Version : 2.0 * * Precondition : No object exists with the same Business Key * * Postcondition : A new object exists, corresponding entries in * OBJECT_INFO and SPECIAL_OBJECT_INFO have been * inserted, CURRENT is set * * OO Exceptions : -- * * Implementation : 1. Create object and set BKey attributes * 2. Get internal OID for the new object * 3. Create new entry in SPECIAL_OBJECT_INFO * 4. Let super class create a new entry in OBJECT_INFO * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 * - 2000-08-02 : (SB) OO Exceptions * - 2001-10-30 : (SB) Type Mapping ************************************************************************ data: NEW_OBJECT type ref to ZCL_PRODUCTO_PERSIST. * * 1. Create object and set BKey attributes create object NEW_OBJECT. * < Generated from mapping: NEW_OBJECT->PRODUCTO = I_BUSINESS_KEY-PRODUCTO. * > * * 2. Get internal OID for the new object and set CURRENT_SPECIAL_OI clear CURRENT_SPECIAL_OBJECT_INFO. CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID = OS_GET_INTERNAL_OID_BY_REF( I_OBJECT = NEW_OBJECT ). CURRENT_SPECIAL_OBJECT_INFO-BUSINESS_KEY = I_BUSINESS_KEY. CURRENT_SPECIAL_OBJECT_INFO-ID_STATUS = ID_STATUS_COMPLETE. * * 3. Create new entry in SPECIAL_OBJECT_INFO insert CURRENT_SPECIAL_OBJECT_INFO into table SPECIAL_OBJECT_INFO. insert CURRENT_SPECIAL_OBJECT_INFO into table SPECIAL_BKEY_TAB. * * 4. Let super class create a new entry in OBJECT_INFO call method OS_CREATE_NEW_ENTRY_FOR_REPR exporting I_OBJECT = NEW_OBJECT I_INTERNAL_OID = CURRENT_SPECIAL_OBJECT_INFO-OBJECT_ID. RESULT = NEW_OBJECT. "PM_CREATE_REPRESENTANT endmethod. method PM_DELETE_PERSISTENT. ***BUILD 051401 ************************************************************************ * Purpose : Delete persistent object. It is marked DELETED in * memory and removed from DB when the top transaction * is closed. * * Version : 2.0 * * Precondition : The object is persistent (not transient), CURRENT * is set * * Postcondition : Instance is marked for deletion. * * OO Exception : CX_OS_OBJECT_STATE(CREATED_AND_DELETED,TRANSIENT) * propagates OS_PM_DELETED_PERSISTENT * ( propagates MAP_LOAD_FROM_DATABASE_KEY ) * * Implementation : 1. Check the state of the object: * 1a. Object is already deleted - done * 1b. Object is transient - Error * 1c. Object is new, loaded or changed - continue * 1d. Object is not_loaded: * Check DBSTATUS: * 1d1. DBSTATUS Unknown/Existing - continue * 1d2. DBSTATUS Not existing - Error * 2. Completion: call OS_PM_DELETED_PERSISTENT * ************************************************************************ * Changelog: * - 2000-03-06 : (BGR) Initial Version 2.0 * - 2000-08-03 : (SB) OO Exceptions ************************************************************************ data: TEMP_CURRENT_OBJECT_IREF type TYP_OBJECT_IREF . * * 1. Check the state of the object: case CURRENT_OBJECT_INFO-PM_STATUS. when OSCON_OSTATUS_DELETED. * * 1a. Object is already deleted - done call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. exit. when OSCON_OSTATUS_TRANSIENT. * * 1b. Object is transient - Error *!! error: object already exists transient TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_STATE definition load. raise exception type CX_OS_OBJECT_STATE exporting OBJECT = TEMP_CURRENT_OBJECT_IREF TEXTID = CX_OS_OBJECT_STATE=>TRANSIENT. when OSCON_OSTATUS_NEW or OSCON_OSTATUS_CHANGED or OSCON_OSTATUS_LOADED. * * 1c. Object is new, loaded or changed - continue when OSCON_OSTATUS_NOT_LOADED. * * 1d. Object is not_loaded: Check DBSTATUS: case CURRENT_OBJECT_INFO-PM_DBSTATUS. when OSCON_DBSTATUS_EXISTING or OSCON_DBSTATUS_UNKNOWN. * * 1d1. DBSTATUS Existing/Unknown - continue when OSCON_DBSTATUS_NOT_EXISTING. * * 1d2. DBSTATUS Not existing - Error *!!!! error: No DB entry for the object TEMP_CURRENT_OBJECT_IREF = CURRENT_OBJECT_IREF. call method OS_CLEAR_CURRENT. clear CURRENT_SPECIAL_OBJECT_INFO. class CX_OS_OBJECT_STATE definition load. raise exception type CX_OS_OBJECT_STATE exporting OBJECT = TEMP_CURRENT_OBJECT_IREF TEXTID = CX_OS_OBJECT_STATE=>CREATED_AND_DELETED. endcase. "PM_DBSTATUS endcase. "PM_STATUS * * 2. Completion: call OS_PM_DELETED_PERSISTENT call method OS_PM_DELETED_PERSISTENT. clear CURRENT_SPECIAL_OBJECT_INFO. "PM_DELETE_PERSISTENT endmethod. method PM_LOAD. ***BUILD 051401 ************************************************************************ * Purpose : Load data from DB into Object specified by CURRENT * * Version : 2.0 * * Precondition : CURRENT_* is set * * Postcondition : object is loaded or exceptions is raised * * OO Exceptions : propagates PM_LOAD_AND_SET_ATTRIBUTES * * Implementation : call PM_LOAD_AND_SET_ATTRIBUTES * ************************************************************************ * Changelog: * - 2000-03-02 : (BGR) Initial Version * - 2000-08-03 : (SB) OO Exceptions * - 2001-11-14 : (SB) Type mapping ************************************************************************ call method PM_LOAD_AND_SET_ATTRIBUTES exporting I_BUSINESS_KEY = CURRENT_SPECIAL_OBJECT_INFO-BUSINESS_KEY. "PM_LOAD endmethod. method PM_LOAD_AND_SET_ATTRIBUTES. ***BUILD 051401 " importing I_BUSINESS_KEY type TYP_BUSINESS_KEY optional ************************************************************************ * Purpose : Load object data of a persistent object and set * object's attributes * if CURRENT is clear, load data using I_BUSINESS_KEY. * if CURRENT is set, use the BKEY stored there. * * Version : 2.0 * * Precondition : An entry for the given Business Key exists on * database. CURRENT can be set (use this * object to set attributes to) or clear. * * Postcondition : Persistent object data is loaded and object * attributes are set. CURRENT is set. * * OO Exceptions : propagates PM_CHECK_AND_SET_ATTRIBUTES * propagates MAP_LOAD_FROM_DATABASE_KEY/GUID * * Implementation : 1. Check Source of DB Keys: Business Key from * CURRENT_SPECIAL_OBJECT_INFO or from I_BUSINESS_KEY * 2. Load from Database * 2.a. Type Mapping: Set E_TYPE and return if case of * type mismatch * 3. Check loaded data and set object's attributes * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 * - 2000-05-17 : (BGR) use PM_CHECK_AND_SET_ATTRIBUTES * - 2000-08-03 : (SB) OO Exceptions * - 2004-01-21 : (SB) Type Mapping Refactoring * - 2005-02-22 : (SB) Set Exception parameters ************************************************************************ data: OBJECT_DATA_TAB type TYP_DB_DATA_TAB, OBJECT_DATA type TYP_DB_DATA, BUSINESS_KEY type TYP_BUSINESS_KEY, BUSINESS_KEY_TAB type TYP_BUSINESS_KEY_TAB. data: SERIALIZED_BUSINESS_KEY type STRING . * * 1. Check Source of DB Keys: Business Key from * * CURRENT_SPECIAL_OBJECT_INFO or from I_BUSINESS_KEY? if ( CURRENT_OBJECT_IREF is initial ). BUSINESS_KEY = I_BUSINESS_KEY. else. "( CURRENT is set ). * * Get BKey from CURRENT_SPECIAL_OBJECT_INFO BUSINESS_KEY = CURRENT_SPECIAL_OBJECT_INFO-BUSINESS_KEY. endif. "( CURRENT set? ). * * 2. Load from Database try. append BUSINESS_KEY to BUSINESS_KEY_TAB. call method MAP_LOAD_FROM_DATABASE_KEY exporting I_BUSINESS_KEY_TAB = BUSINESS_KEY_TAB receiving result = OBJECT_DATA_TAB. catch CX_OS_DB_SELECT. class CX_OS_OBJECT_NOT_FOUND definition load. call method MAP_SERIALIZE_BKEY exporting I_BUSINESS_KEY = BUSINESS_KEY receiving RESULT = SERIALIZED_BUSINESS_KEY. raise exception type CX_OS_OBJECT_NOT_FOUND exporting BKEY = SERIALIZED_BUSINESS_KEY TEXTID = CX_OS_OBJECT_NOT_FOUND=>BY_BKEY. endtry. read table OBJECT_DATA_TAB into OBJECT_DATA index 1. * * 3. Now Check the loaded data and set the Object. call method PM_CHECK_AND_SET_ATTRIBUTES exporting I_OBJECT_DATA = OBJECT_DATA I_BUSINESS_KEY = BUSINESS_KEY I_ID_PROVIDED = ID_STATUS_COMPLETE. "PM_LOAD_AND_SET_ATTRIBUTES endmethod. method SAVE_SPECIAL_OBJECT_INFO. ***BUILD 051401 ************************************************************************ * Purpose : Save CURRENT_SPECIAL_OBJECT_INFO into * SPECIAL_OBJECT_INFO * * Version : 2.0 * * Precondition : Index is set in CURRENT_OBJECT_INDEX * * Postcondition : entry is saved * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-02 : (BGR) Initial Version ************************************************************************ modify SPECIAL_OBJECT_INFO from CURRENT_SPECIAL_OBJECT_INFO index CURRENT_OBJECT_INDEX. "SAVE_SPECIAL_OBJECT_INFO endmethod. ENDCLASS.
31.449015
72
0.619595
ff0848bf2b3050932a956635305eef968dda6933
1,309
abap
ABAP
src/zbc_job_schedule.fugr.saplzbc_job_schedule.abap
attilaberencsi/zbc_job_scheduler
ee1a7a23635a063957bb01f5d2e4b2fbc9e9c032
[ "MIT" ]
null
null
null
src/zbc_job_schedule.fugr.saplzbc_job_schedule.abap
attilaberencsi/zbc_job_scheduler
ee1a7a23635a063957bb01f5d2e4b2fbc9e9c032
[ "MIT" ]
null
null
null
src/zbc_job_schedule.fugr.saplzbc_job_schedule.abap
attilaberencsi/zbc_job_scheduler
ee1a7a23635a063957bb01f5d2e4b2fbc9e9c032
[ "MIT" ]
null
null
null
* regenerated at 20.10.2016 10:18:53 by BERENCSI_A ******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE LZBC_JOB_SCHEDULETOP. " Global Data INCLUDE LZBC_JOB_SCHEDULEUXX. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LZBC_JOB_SCHEDULEF... " Subroutines * INCLUDE LZBC_JOB_SCHEDULEO... " PBO-Modules * INCLUDE LZBC_JOB_SCHEDULEI... " PAI-Modules * INCLUDE LZBC_JOB_SCHEDULEE... " Events * INCLUDE LZBC_JOB_SCHEDULEP... " Local class implement. * INCLUDE LZBC_JOB_SCHEDULET99. " ABAP Unit tests INCLUDE LZBC_JOB_SCHEDULEF00 . " subprograms INCLUDE LZBC_JOB_SCHEDULEI00 . " PAI modules INCLUDE LSVIMFXX . " subprograms INCLUDE LSVIMOXX . " PBO modules INCLUDE LSVIMIXX . " PAI modules INCLUDE lzbc_job_schedulef01.
54.541667
69
0.440031
ff0a5d519f6e653ea88003fa9501aa8092db2820
3,277
abap
ABAP
src/tests/zcl_deactivated_thread.clas.abap
xinitrc86/zthread
0c8cdb7ebde82475a639a55954e063a920559bb7
[ "MIT" ]
8
2021-08-25T13:03:09.000Z
2021-09-22T01:27:48.000Z
src/tests/zcl_deactivated_thread.clas.abap
xinitrc86/zthread
0c8cdb7ebde82475a639a55954e063a920559bb7
[ "MIT" ]
3
2021-08-25T16:23:45.000Z
2021-09-29T11:48:41.000Z
src/tests/zcl_deactivated_thread.clas.abap
xinitrc86/zthread
0c8cdb7ebde82475a639a55954e063a920559bb7
[ "MIT" ]
1
2021-09-19T20:31:29.000Z
2021-09-19T20:31:29.000Z
"! <p>A thread for tests.<br> "! You can use deactivated threads in conjunction with the "! deactivated thread factory. <br> "! This thread allows for setting of results or errors, as well as "! returning the runnable for which it was called. <br> "! <strong>This deactivated thread does not call the runnable.</strong> "! <strong>This deactivated thread immediately calls the callback object upon start. </strong> "! </p> class zcl_deactivated_thread definition public inheriting from zcl_thread final create public for testing. public section. methods: "! <p>Returns the runnable for which the Thread was created</p> "! @parameter ro_result | <p>Thread's runnable</p> get_runnable returning value(ro_result) type ref to zif_runnable, "! <p>Set the result which will be sent to the callback routine</p> "! @parameter io_result | <p>the result to be sent back</p> set_result importing io_result type ref to zif_runnable_result, "! <p>Set the error which will be sent to the callback routine</p> "! @parameter io_error | <p>the error to be sent back</p> set_error importing io_error type ref to cx_root, "! <p>Allows the verification if the thread was started</p> "! @parameter r_result | <p>ABAP_TRUE/ABAP_FALSE</p> was_started returning value(r_result) type abap_bool, "! <p>Deactivated thread constructor.</p> "! "! @parameter io_runnable | <p>Runnable</p> "! @parameter io_callback | <p>Callback routine</p> "! @parameter iv_taskname | <p>Task name</p> constructor importing io_runnable type ref to zif_runnable io_callback type ref to zif_thread_callback optional iv_taskname type char32, get_result redefinition, on_end redefinition, start redefinition. protected section. private section. data: v_started type abap_bool, o_callback type ref to zif_thread_callback, o_runnable type ref to zif_runnable, o_result type ref to zif_runnable_result, o_error type ref to cx_root, v_taskname type char32. endclass. class zcl_deactivated_thread implementation. method get_runnable. ro_result = o_runnable. endmethod. method set_result. o_result = io_result. endmethod. method set_error. o_error = io_error. endmethod. method constructor. super->constructor( io_callback = io_callback io_runnable = io_runnable iv_taskname = iv_taskname ). o_callback = io_callback. o_runnable = io_runnable. v_taskname = iv_taskname. endmethod. method start. v_started = abap_true. on_end( v_taskname ). endmethod. method on_end. if o_callback is bound and o_result is bound. o_callback->on_result( iv_taskname = p_task io_result = o_result ). endif. if o_callback is bound and o_error is bound. o_callback->on_error( iv_taskname = p_task io_error = o_error ). endif. endmethod. method get_result. ro_result = o_result. endmethod. method was_started. r_result = me->v_started. endmethod. endclass.
26.007937
94
0.665243
ff0ae329e5393a87635494ecdeb7cc334f42ee20
1,638
abap
ABAP
zcl_fmwp_fmadptr_test.clas.abap
hapejot/abapFLWrapper
fee1bce8baa1f4d3bb5c1404447fcf5d8ee49f97
[ "MIT" ]
1
2019-07-01T18:31:39.000Z
2019-07-01T18:31:39.000Z
zcl_fmwp_fmadptr_test.clas.abap
hapejot/abapFLWrapper
fee1bce8baa1f4d3bb5c1404447fcf5d8ee49f97
[ "MIT" ]
5
2018-04-24T09:26:06.000Z
2018-05-21T19:59:56.000Z
zcl_fmwp_fmadptr_test.clas.abap
hapejot/abapFLWrapper
fee1bce8baa1f4d3bb5c1404447fcf5d8ee49f97
[ "MIT" ]
null
null
null
CLASS zcl_fmwp_fmadptr_test DEFINITION FOR TESTING PUBLIC DURATION SHORT ABSTRACT RISK LEVEL HARMLESS CREATE PUBLIC . PUBLIC SECTION. METHODS: instanciate FOR TESTING RAISING cx_static_check, read FOR TESTING RAISING cx_static_check. PROTECTED SECTION. DATA: m_cont TYPE REF TO zcl_abapdi_container, m_cut TYPE REF TO zif_fmwp_fmadptr. PRIVATE SECTION. ENDCLASS. CLASS ZCL_FMWP_FMADPTR_TEST IMPLEMENTATION. METHOD instanciate. cl_abap_unit_assert=>assert_bound( act = m_cut ). ENDMETHOD. METHOD read. " data(fname) = |FUNCTION_IMPORT_DOKU|. DATA(m_fm) = CAST zcl_fmwp_fminfo( m_cut->read_fm( 'Function_Import_Doku' ) ). cl_abap_unit_assert=>assert_bound( msg = 'fm not bound' act = m_fm ). cl_abap_unit_assert=>assert_equals( msg = 'different func.name' act = m_fm->get_head( )-name exp = 'FUNCTION_IMPORT_DOKU' ). DATA(result) = m_fm->get_parameters( ). DATA(param1) = result[ parameter = 'REMOTE_CALL' ]. cl_abap_unit_assert=>assert_equals( msg = 'Remote Parameter' exp = 'E' act = param1-kind ). cl_abap_unit_assert=>assert_equals( msg = 'importing' exp = 'I' act = result[ parameter = 'WITH_ENHANCEMENTS' ]-kind ). cl_abap_unit_assert=>assert_equals( msg = 'table' exp = 'T' act = result[ parameter = 'CHANGING_PARAMETER' ]-kind ). cl_abap_unit_assert=>assert_equals( msg = 'exception' exp = 'X' act = result[ parameter = 'FUNCTION_NOT_FOUND' ]-kind ). cl_abap_unit_assert=>assert_equals( msg = 'changing' exp = 'C' act = result[ parameter = 'TST_CHG' ]-kind ). ENDMETHOD. ENDCLASS.
34.851064
131
0.69536
ff16309b0c7c26f2ec9f625c7ffc17772c61897b
4,739
abap
ABAP
src/objects/zcl_abapgit_object_iarp.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
1
2019-09-11T20:57:34.000Z
2019-09-11T20:57:34.000Z
src/objects/zcl_abapgit_object_iarp.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_iarp.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_iarp DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. PROTECTED SECTION. PRIVATE SECTION. METHODS: read EXPORTING es_attr TYPE w3resoattr et_parameters TYPE w3resopara_tabletype RAISING zcx_abapgit_exception, save IMPORTING is_attr TYPE w3resoattr it_parameters TYPE w3resopara_tabletype RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_IARP IMPLEMENTATION. METHOD read. DATA: li_resource TYPE REF TO if_w3_api_resource, ls_name TYPE w3resokey. ls_name = ms_item-obj_name. cl_w3_api_resource=>if_w3_api_resource~load( EXPORTING p_resource_name = ls_name IMPORTING p_resource = li_resource EXCEPTIONS object_not_existing = 1 permission_failure = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from w3api_resource~load' ). ENDIF. li_resource->get_attributes( IMPORTING p_attributes = es_attr ). CLEAR: es_attr-chname, es_attr-tdate, es_attr-ttime, es_attr-devclass. li_resource->get_parameters( IMPORTING p_parameters = et_parameters ). ENDMETHOD. METHOD save. DATA: li_resource TYPE REF TO if_w3_api_resource. cl_w3_api_resource=>if_w3_api_resource~create_new( EXPORTING p_resource_data = is_attr IMPORTING p_resource = li_resource ). li_resource->set_attributes( is_attr ). li_resource->set_parameters( it_parameters ). li_resource->if_w3_api_object~save( ). ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. " todo ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: li_resource TYPE REF TO if_w3_api_resource, ls_name TYPE w3resokey. ls_name = ms_item-obj_name. cl_w3_api_resource=>if_w3_api_resource~load( EXPORTING p_resource_name = ls_name IMPORTING p_resource = li_resource EXCEPTIONS object_not_existing = 1 permission_failure = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from if_w3_api_resource~load' ). ENDIF. li_resource->if_w3_api_object~set_changeable( abap_true ). li_resource->if_w3_api_object~delete( ). li_resource->if_w3_api_object~save( ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: ls_attr TYPE w3resoattr, lt_parameters TYPE w3resopara_tabletype. io_xml->read( EXPORTING iv_name = 'ATTR' CHANGING cg_data = ls_attr ). io_xml->read( EXPORTING iv_name = 'PARAMETERS' CHANGING cg_data = lt_parameters ). ls_attr-devclass = iv_package. save( is_attr = ls_attr it_parameters = lt_parameters ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: ls_name TYPE w3resokey. ls_name = ms_item-obj_name. cl_w3_api_resource=>if_w3_api_resource~load( EXPORTING p_resource_name = ls_name EXCEPTIONS object_not_existing = 1 permission_failure = 2 error_occured = 3 OTHERS = 4 ). IF sy-subrc = 1. rv_bool = abap_false. ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from w3_api_resource~load' ). ELSE. rv_bool = abap_true. ENDIF. 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. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_attr TYPE w3resoattr, lt_parameters TYPE w3resopara_tabletype. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. read( IMPORTING es_attr = ls_attr et_parameters = lt_parameters ). io_xml->add( iv_name = 'ATTR' ig_data = ls_attr ). io_xml->add( iv_name = 'PARAMETERS' ig_data = lt_parameters ). ENDMETHOD. ENDCLASS.
22.783654
96
0.653513
ff1eeb8e84f677ca5b4d227af3f539b1c1256f45
6,862
abap
ABAP
src/objects/zcl_abapgit_object_ucsa.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
2
2021-03-20T20:27:04.000Z
2021-03-20T20:34:58.000Z
src/objects/zcl_abapgit_object_ucsa.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
40
2021-06-01T05:58:26.000Z
2022-03-01T05:02:17.000Z
src/objects/zcl_abapgit_object_ucsa.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
1
2021-08-18T07:58:26.000Z
2021-08-18T07:58:26.000Z
CLASS zcl_abapgit_object_ucsa DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_version, active TYPE r3state VALUE 'A', inactive TYPE r3state VALUE 'I', END OF c_version . TYPES: ty_id TYPE c LENGTH 30. METHODS: get_persistence IMPORTING iv_id TYPE ty_id RETURNING VALUE(ro_persistence) TYPE REF TO object, clear_dynamic_fields CHANGING cg_complete_comm_assembly TYPE any, clear_field IMPORTING iv_fieldname TYPE csequence CHANGING cg_header TYPE any. ENDCLASS. CLASS zcl_abapgit_object_ucsa IMPLEMENTATION. METHOD clear_dynamic_fields. FIELD-SYMBOLS: <lg_header> TYPE any. ASSIGN COMPONENT 'HEADER' OF STRUCTURE cg_complete_comm_assembly TO <lg_header>. ASSERT sy-subrc = 0. clear_field( EXPORTING iv_fieldname = 'CREATEDBY' CHANGING cg_header = <lg_header> ). clear_field( EXPORTING iv_fieldname = 'CREATEDON' CHANGING cg_header = <lg_header> ). clear_field( EXPORTING iv_fieldname = 'CREATEDAT' CHANGING cg_header = <lg_header> ). clear_field( EXPORTING iv_fieldname = 'CHANGEDBY' CHANGING cg_header = <lg_header> ). clear_field( EXPORTING iv_fieldname = 'CHANGEDON' CHANGING cg_header = <lg_header> ). clear_field( EXPORTING iv_fieldname = 'CHANGEDAT' CHANGING cg_header = <lg_header> ). ENDMETHOD. METHOD clear_field. FIELD-SYMBOLS: <lg_field> TYPE any. ASSIGN COMPONENT iv_fieldname OF STRUCTURE cg_header TO <lg_field>. ASSERT sy-subrc = 0. CLEAR <lg_field>. ENDMETHOD. METHOD get_persistence. CALL METHOD ('CL_UCON_SA_DB_PERSIST')=>('IF_UCON_SA_PERSIST~GET_INSTANCE') EXPORTING id = iv_id RECEIVING instance = ro_persistence. ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lv_id TYPE ty_id, lx_root TYPE REF TO cx_root, lv_text TYPE string, lo_persistence TYPE REF TO object. TRY. lv_id = ms_item-obj_name. lo_persistence = get_persistence( lv_id ). CALL METHOD lo_persistence->('IF_UCON_SA_PERSIST~DELETE') EXPORTING version = c_version-active. CATCH cx_root INTO lx_root. lv_text = lx_root->get_text( ). zcx_abapgit_exception=>raise( lv_text ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lv_id TYPE ty_id, lx_root TYPE REF TO cx_root, lv_text TYPE string, lo_persistence TYPE REF TO object, lr_complete_comm_assembly TYPE REF TO data. FIELD-SYMBOLS: <lg_complete_comm_assembly> TYPE any. TRY. CREATE DATA lr_complete_comm_assembly TYPE ('UCONSERVASCOMPLETE'). ASSIGN lr_complete_comm_assembly->* TO <lg_complete_comm_assembly>. ASSERT sy-subrc = 0. io_xml->read( EXPORTING iv_name = 'UCSA' CHANGING cg_data = <lg_complete_comm_assembly> ). lv_id = ms_item-obj_name. lo_persistence = get_persistence( lv_id ). CALL METHOD lo_persistence->('IF_UCON_SA_PERSIST~CREATE'). CALL METHOD lo_persistence->('IF_UCON_SA_PERSIST~SAVE') EXPORTING sa = <lg_complete_comm_assembly> version = c_version-active. tadir_insert( iv_package ). CATCH cx_root INTO lx_root. lv_text = lx_root->get_text( ). zcx_abapgit_exception=>raise( lv_text ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_id TYPE ty_id, lo_persistence TYPE REF TO object. lv_id = ms_item-obj_name. TRY. lo_persistence = get_persistence( lv_id ). " Interface IF_UCON_SA_PERSIST and other objects are not present " in lower Netweaver realeses. Therefore we have to call them " dynamically to be downward comapatible. CALL METHOD lo_persistence->('IF_UCON_SA_PERSIST~LOAD') EXPORTING version = c_version-active language = mv_language. CATCH cx_root. rv_bool = abap_false. RETURN. ENDTRY. rv_bool = abap_true. 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. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = ms_item-obj_name object_type = ms_item-obj_type in_new_window = abap_true EXCEPTIONS not_executed = 1 invalid_object_type = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lv_id TYPE ty_id, lx_root TYPE REF TO cx_root, lv_text TYPE string, lo_persistence TYPE REF TO object, lr_complete_comm_assembly TYPE REF TO data. FIELD-SYMBOLS: <lg_complete_comm_assembly> TYPE any. lv_id = ms_item-obj_name. TRY. CREATE DATA lr_complete_comm_assembly TYPE ('UCONSERVASCOMPLETE'). ASSIGN lr_complete_comm_assembly->* TO <lg_complete_comm_assembly>. ASSERT sy-subrc = 0. lo_persistence = get_persistence( lv_id ). CALL METHOD lo_persistence->('IF_UCON_SA_PERSIST~LOAD') EXPORTING version = c_version-active language = mv_language IMPORTING sa = <lg_complete_comm_assembly>. clear_dynamic_fields( CHANGING cg_complete_comm_assembly = <lg_complete_comm_assembly> ). io_xml->add( iv_name = 'UCSA' ig_data = <lg_complete_comm_assembly> ). CATCH cx_root INTO lx_root. lv_text = lx_root->get_text( ). zcx_abapgit_exception=>raise( lv_text ). ENDTRY. ENDMETHOD. ENDCLASS.
23.743945
97
0.62868
ff20c1550aaedb3638e0119673adc1f620e83b48
9,964
abap
ABAP
src/objects/zcl_abapgit_object_tobj.clas.abap
qinhanguyun/abapGit
272925fff7625a65a22825b546790948769f1556
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_tobj.clas.abap
qinhanguyun/abapGit
272925fff7625a65a22825b546790948769f1556
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_tobj.clas.abap
qinhanguyun/abapGit
272925fff7625a65a22825b546790948769f1556
[ "MIT" ]
1
2019-12-31T11:44:14.000Z
2019-12-31T11:44:14.000Z
CLASS zcl_abapgit_object_tobj 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. TYPES: BEGIN OF ty_tobj, tddat TYPE tddat, tvdir TYPE tvdir, tvimf TYPE STANDARD TABLE OF tvimf WITH DEFAULT KEY, END OF ty_tobj. METHODS: read_extra IMPORTING iv_tabname TYPE vim_name RETURNING VALUE(rs_tobj) TYPE ty_tobj, update_extra IMPORTING is_tobj TYPE ty_tobj, delete_extra IMPORTING iv_tabname TYPE vim_name. ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_TOBJ IMPLEMENTATION. METHOD delete_extra. DELETE FROM tddat WHERE tabname = iv_tabname. DELETE FROM tvdir WHERE tabname = iv_tabname. DELETE FROM tvimf WHERE tabname = iv_tabname. ENDMETHOD. METHOD read_extra. SELECT SINGLE * FROM tddat INTO rs_tobj-tddat WHERE tabname = iv_tabname. SELECT SINGLE * FROM tvdir INTO rs_tobj-tvdir WHERE tabname = iv_tabname. CLEAR: rs_tobj-tvdir-gendate, rs_tobj-tvdir-gentime. SELECT * FROM tvimf INTO TABLE rs_tobj-tvimf WHERE tabname = iv_tabname. ENDMETHOD. METHOD update_extra. DATA: lt_current_tvimf TYPE STANDARD TABLE OF tvimf. FIELD-SYMBOLS: <ls_tvimf> TYPE tvimf. MODIFY tddat FROM is_tobj-tddat. MODIFY tvdir FROM is_tobj-tvdir. SELECT * INTO TABLE lt_current_tvimf FROM tvimf WHERE tabname = is_tobj-tddat-tabname ORDER BY PRIMARY KEY. LOOP AT lt_current_tvimf ASSIGNING <ls_tvimf>. READ TABLE is_tobj-tvimf WITH KEY tabname = <ls_tvimf>-tabname event = <ls_tvimf>-event TRANSPORTING NO FIELDS. IF sy-subrc <> 0. DELETE tvimf FROM <ls_tvimf>. ENDIF. ENDLOOP. MODIFY tvimf FROM TABLE is_tobj-tvimf. ENDMETHOD. METHOD zif_abapgit_object~changed_by. DATA: lv_type_pos TYPE i. lv_type_pos = strlen( ms_item-obj_name ) - 1. SELECT SINGLE luser FROM objh INTO rv_user WHERE objectname = ms_item-obj_name(lv_type_pos) AND objecttype = ms_item-obj_name+lv_type_pos. "#EC CI_GENBUFF IF sy-subrc <> 0. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: ls_objh TYPE objh, lv_type_pos TYPE i. lv_type_pos = strlen( ms_item-obj_name ) - 1. ls_objh-objectname = ms_item-obj_name(lv_type_pos). ls_objh-objecttype = ms_item-obj_name+lv_type_pos. CALL FUNCTION 'OBJ_GENERATE' EXPORTING iv_objectname = ls_objh-objectname iv_objecttype = ls_objh-objecttype iv_maint_mode = 'D' EXCEPTIONS illegal_call = 1 object_not_found = 2 generate_error = 3 transport_error = 4 object_enqueue_failed = 5 OTHERS = 6. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from OBJ_GENERATE' ). ENDIF. delete_extra( ls_objh-objectname ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: ls_objh TYPE objh, ls_objt TYPE objt, lt_objs TYPE tt_objs, lt_objsl TYPE tt_objsl, lt_objm TYPE tt_objm, ls_tobj TYPE ty_tobj. io_xml->read( EXPORTING iv_name = 'OBJH' CHANGING cg_data = ls_objh ). io_xml->read( EXPORTING iv_name = 'OBJT' CHANGING cg_data = ls_objt ). io_xml->read( EXPORTING iv_name = 'OBJS' CHANGING cg_data = lt_objs ). io_xml->read( EXPORTING iv_name = 'OBJSL' CHANGING cg_data = lt_objsl ). io_xml->read( EXPORTING iv_name = 'OBJM' CHANGING cg_data = lt_objm ). CALL FUNCTION 'OBJ_GENERATE' EXPORTING iv_objectname = ls_objh-objectname iv_objecttype = ls_objh-objecttype iv_maint_mode = 'I' iv_objecttext = ls_objt-ddtext iv_objcateg = ls_objh-objcateg iv_objtransp = ls_objh-objtransp iv_devclass = iv_package TABLES tt_v_obj_s = lt_objs tt_objm = lt_objm EXCEPTIONS illegal_call = 1 object_not_found = 2 generate_error = 3 transport_error = 4 object_enqueue_failed = 5 OTHERS = 6. IF sy-subrc <> 0. * TOBJ has to be saved/generated after the DDIC tables have been * activated - fixed with late deserialization zcx_abapgit_exception=>raise( 'error from OBJ_GENERATE' ). ENDIF. CALL FUNCTION 'OBJ_SET_IMPORTABLE' EXPORTING iv_objectname = ls_objh-objectname iv_objecttype = ls_objh-objecttype iv_importable = ls_objh-importable EXCEPTIONS object_not_defined = 1 invalid = 2 transport_error = 3 object_enqueue_failed = 4 OTHERS = 5. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from OBJ_SET_IMPORTABLE' ). ENDIF. * fm OBJ_GENERATE takes the defaults from the DDIC object * set OBJTRANSP directly, should be okay looking at the code in OBJ_SET_IMPORTABLE * locking has been done in OBJ_SET_IMPORTABLE plus recording of transport UPDATE objh SET objtransp = ls_objh-objtransp WHERE objectname = ls_objh-objectname AND objecttype = ls_objh-objecttype. io_xml->read( EXPORTING iv_name = 'TOBJ' CHANGING cg_data = ls_tobj ). ls_tobj-tvdir-gendate = sy-datum. ls_tobj-tvdir-gentime = sy-uzeit. update_extra( ls_tobj ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_objectname TYPE objh-objectname, lv_type_pos TYPE i. lv_type_pos = strlen( ms_item-obj_name ) - 1. SELECT SINGLE objectname FROM objh INTO lv_objectname WHERE objectname = ms_item-obj_name(lv_type_pos) AND objecttype = ms_item-obj_name+lv_type_pos. "#EC CI_GENBUFF rv_bool = boolc( sy-subrc = 0 ). 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 = zif_abapgit_object~get_metadata( ). IF ls_meta-late_deser = abap_true. APPEND zif_abapgit_object=>gc_step_id-late TO rt_steps. ELSEIF ls_meta-ddic = abap_true. APPEND zif_abapgit_object=>gc_step_id-ddic TO rt_steps. ELSE. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-late_deser = 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: 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 = substring( val = ms_item-obj_name len = strlen( ms_item-obj_name ) - 1 ). APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'VIMDYNFLDS-ELEM_GEN'. ls_bcdata-fval = abap_true. APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'BDC_OKCODE'. ls_bcdata-fval = '=SHOW'. 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, TOBJ' ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_objh TYPE objh, ls_objt TYPE objt, lt_objs TYPE tt_objs, lt_objsl TYPE tt_objsl, lt_objm TYPE tt_objm, ls_tobj TYPE ty_tobj, lv_type_pos TYPE i. lv_type_pos = strlen( ms_item-obj_name ) - 1. ls_objh-objectname = ms_item-obj_name(lv_type_pos). ls_objh-objecttype = ms_item-obj_name+lv_type_pos. CALL FUNCTION 'CTO_OBJECT_GET' EXPORTING iv_objectname = ls_objh-objectname iv_objecttype = ls_objh-objecttype iv_language = mv_language iv_sel_objt = abap_true iv_sel_objs = abap_true iv_sel_objsl = abap_true iv_sel_objm = abap_true IMPORTING es_objh = ls_objh es_objt = ls_objt TABLES tt_objs = lt_objs tt_objsl = lt_objsl tt_objm = lt_objm EXCEPTIONS object_not_defined = 1 OTHERS = 2. IF sy-subrc = 1. RETURN. ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from CTO_OBJECT_GET' ). ENDIF. CLEAR: ls_objh-luser, ls_objh-ldate. io_xml->add( iv_name = 'OBJH' ig_data = ls_objh ). io_xml->add( iv_name = 'OBJT' ig_data = ls_objt ). io_xml->add( iv_name = 'OBJS' ig_data = lt_objs ). io_xml->add( iv_name = 'OBJSL' ig_data = lt_objsl ). io_xml->add( iv_name = 'OBJM' ig_data = lt_objm ). ls_tobj = read_extra( ls_objh-objectname ). io_xml->add( iv_name = 'TOBJ' ig_data = ls_tobj ). ENDMETHOD. ENDCLASS.
27.988764
96
0.626556
ff2566cbeabe063d5585e0291e5f6eee90b1513e
3,222
abap
ABAP
zcl_schema_productmodel.clas.abap
se38/SchemA
cc8170068f8fad04452a0b8d688e05a2212caad5
[ "Apache-2.0" ]
2
2017-10-09T09:11:29.000Z
2017-12-11T08:28:51.000Z
zcl_schema_productmodel.clas.abap
se38/SchemA
cc8170068f8fad04452a0b8d688e05a2212caad5
[ "Apache-2.0" ]
4
2016-01-07T15:34:20.000Z
2018-10-17T13:39:29.000Z
zcl_schema_productmodel.clas.abap
se38/SchemA
cc8170068f8fad04452a0b8d688e05a2212caad5
[ "Apache-2.0" ]
4
2016-01-10T09:00:38.000Z
2018-10-17T23:07:00.000Z
"! schema.org: PRODUCTMODEL A datasheet or vendor specification of a product (in the sense of a prototypical description). "! <h1>SchemA</h1> "! The schema.org ABAP Framework <br/> "! Copyright (C) 2016 Uwe Fetzer together with the SCN ABAP community <br/> "! <br/> "! Project home: https://github.com/se38/SchemA <br/> "! <br/> "! Published under Apache License, Version 2.0 <br/> "! http://www.apache.org/licenses/LICENSE-2.0.html <br/> CLASS zcl_schema_productmodel DEFINITION PUBLIC INHERITING FROM zcl_schema_product CREATE PUBLIC GLOBAL FRIENDS zcl_schema_thing. PUBLIC SECTION. METHODS: constructor IMPORTING i_json TYPE string OPTIONAL, get_is_variant_of RETURNING VALUE(r_result) TYPE REF TO zcl_schema_productmodel, set_is_variant_of IMPORTING i_is_variant_of TYPE REF TO zcl_schema_productmodel, set_is_variant_of_json IMPORTING i_is_variant_of TYPE string, get_predecessor_of RETURNING VALUE(r_result) TYPE REF TO zcl_schema_productmodel, set_predecessor_of IMPORTING i_predecessor_of TYPE REF TO zcl_schema_productmodel, set_predecessor_of_json IMPORTING i_predecessor_of TYPE string, get_successor_of RETURNING VALUE(r_result) TYPE REF TO zcl_schema_productmodel, set_successor_of IMPORTING i_successor_of TYPE REF TO zcl_schema_productmodel, set_successor_of_json IMPORTING i_successor_of TYPE string. PROTECTED SECTION. METHODS: "*--- append attributes of this and all super classes as JSON ---* append_attributes REDEFINITION. PRIVATE SECTION. CLASS-DATA: type TYPE string VALUE 'ProductModel'. DATA: "! A pointer to a base product from which this product is a variant. It is safe to infer that the variant inherits all product features from the base model, unless defined locally. This is not transitive. is_variant_of TYPE REF TO zcl_schema_productmodel, "! A pointer from a previous, often discontinued variant of the product to its newer variant. predecessor_of TYPE REF TO zcl_schema_productmodel, "! A pointer from a newer variant of a product to its previous, often discontinued predecessor. successor_of TYPE REF TO zcl_schema_productmodel. ENDCLASS. CLASS ZCL_SCHEMA_PRODUCTMODEL IMPLEMENTATION. METHOD append_attributes. INCLUDE z_schema_attributes_super. ENDMETHOD. METHOD constructor. INCLUDE z_schema_constructor_super. ENDMETHOD. METHOD get_is_variant_of. r_result = me->is_variant_of. ENDMETHOD. METHOD get_predecessor_of. r_result = me->predecessor_of. ENDMETHOD. METHOD get_successor_of. r_result = me->successor_of. ENDMETHOD. METHOD set_is_variant_of. me->is_variant_of = i_is_variant_of. ENDMETHOD. METHOD set_is_variant_of_json. me->is_variant_of = NEW #( i_is_variant_of ). ENDMETHOD. METHOD set_predecessor_of. me->predecessor_of = i_predecessor_of. ENDMETHOD. METHOD set_predecessor_of_json. me->predecessor_of = NEW #( i_predecessor_of ). ENDMETHOD. METHOD set_successor_of. me->successor_of = i_successor_of. ENDMETHOD. METHOD set_successor_of_json. me->successor_of = NEW #( i_successor_of ). ENDMETHOD. ENDCLASS.
30.396226
210
0.755742
ff288cc1fbdfa794c81873ddbe1a794cef1a0b78
587
abap
ABAP
src/zcl_oo_tutorial_6_a340.clas.abap
julianocacheta/abap-oo-basics
9a0043d22dce1b4753e7253aa0b8c4084cc02071
[ "Apache-2.0" ]
82
2020-04-24T14:57:30.000Z
2022-03-16T03:01:36.000Z
src/zcl_oo_tutorial_6_a340.clas.abap
julianocacheta/abap-oo-basics
9a0043d22dce1b4753e7253aa0b8c4084cc02071
[ "Apache-2.0" ]
1
2020-06-11T12:36:13.000Z
2020-06-11T12:36:13.000Z
src/zcl_oo_tutorial_6_a340.clas.abap
julianocacheta/abap-oo-basics
9a0043d22dce1b4753e7253aa0b8c4084cc02071
[ "Apache-2.0" ]
26
2020-05-07T17:32:20.000Z
2022-03-08T06:37:32.000Z
"! <p class="shorttext synchronized" lang="en">Tutorial #6 - Planetype A340</p> CLASS ZCL_OO_TUTORIAL_6_A340 DEFINITION PUBLIC INHERITING FROM ZCL_OO_TUTORIAL_6_BASE FINAL CREATE PROTECTED GLOBAL FRIENDS ZCL_OO_TUTORIAL_6_BASE. PUBLIC SECTION. METHODS ZIF_OO_TUTORIAL~CALCULATE_FLIGHT_PRICE REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_OO_TUTORIAL_6_A340 IMPLEMENTATION. METHOD ZIF_OO_TUTORIAL~CALCULATE_FLIGHT_PRICE. price = SUPER->CALCULATE_FLIGHT_PRICE( ). PRICE-PRICE = PRICE-PRICE + 15. ENDMETHOD. ENDCLASS.
20.964286
79
0.770017
ff2b4591e760355ee842cd2a93431b023cd3abc0
4,279
abap
ABAP
lbn-gtt-template-ts/abap/zsrc/zsst_gtt.fugr.zsst_gtt_ee_fo_popu.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-ts/abap/zsrc/zsst_gtt.fugr.zsst_gtt_ee_fo_popu.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-ts/abap/zsrc/zsst_gtt.fugr.zsst_gtt_ee_fo_popu.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
FUNCTION zsst_gtt_ee_fo_popu. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM *" REFERENCE(I_EVENT_TYPE) TYPE /SAPTRX/EVTYPES *" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER *" REFERENCE(I_EVENT_TYPE_CNTL_TABS) TYPE TRXAS_EVENTTYPE_TABS *" REFERENCE(I_EVENTS) TYPE TRXAS_EVT_CTABS *" TABLES *" CT_TRACKINGHEADER STRUCTURE /SAPTRX/BAPI_EVM_HEADER *" CT_TRACKLOCATION STRUCTURE /SAPTRX/BAPI_EVM_LOCATIONID *" OPTIONAL *" CT_TRACKADDRESS STRUCTURE /SAPTRX/BAPI_EVM_ADDRESS OPTIONAL *" CT_TRACKLOCATIONDESCR STRUCTURE /SAPTRX/BAPI_EVM_LOCDESCR *" OPTIONAL *" CT_TRACKLOCADDITIONALID STRUCTURE /SAPTRX/BAPI_EVM_LOCADDID *" OPTIONAL *" CT_TRACKPARTNERID STRUCTURE /SAPTRX/BAPI_EVM_PARTNERID *" OPTIONAL *" CT_TRACKPARTNERADDID STRUCTURE /SAPTRX/BAPI_EVM_PARTNERADDID *" OPTIONAL *" CT_TRACKESTIMDEADLINE STRUCTURE /SAPTRX/BAPI_EVM_ESTIMDEADL *" OPTIONAL *" CT_TRACKCONFIRMSTATUS STRUCTURE /SAPTRX/BAPI_EVM_CONFSTAT *" OPTIONAL *" CT_TRACKNEXTEVENT STRUCTURE /SAPTRX/BAPI_EVM_NEXTEVENT *" OPTIONAL *" CT_TRACKNEXTEVDEADLINES STRUCTURE /SAPTRX/BAPI_EVM_NEXTEVDEADL *" OPTIONAL *" CT_TRACKREFERENCES STRUCTURE /SAPTRX/BAPI_EVM_REFERENCE *" OPTIONAL *" CT_TRACKMEASURESULTS STRUCTURE /SAPTRX/BAPI_EVM_MEASRESULT *" OPTIONAL *" CT_TRACKSTATUSATTRIB STRUCTURE /SAPTRX/BAPI_EVM_STATUSATTR *" OPTIONAL *" CT_TRACKPARAMETERS STRUCTURE /SAPTRX/BAPI_EVM_PARAMETERS *" OPTIONAL *" CT_TRACKFILEHEADER STRUCTURE /SAPTRX/BAPI_EVM_FILEHEADER *" OPTIONAL *" CT_TRACKFILEREF STRUCTURE /SAPTRX/BAPI_EVM_FILEREF OPTIONAL *" CT_TRACKFILEBIN STRUCTURE /SAPTRX/BAPI_EVM_FILEBIN OPTIONAL *" CT_TRACKFILECHAR STRUCTURE /SAPTRX/BAPI_EVM_FILECHAR OPTIONAL *" CT_TRACKTEXTHEADER STRUCTURE /SAPTRX/BAPI_EVM_TEXTHEADER *" OPTIONAL *" CT_TRACKTEXTLINES STRUCTURE /SAPTRX/BAPI_EVM_TEXTLINES *" OPTIONAL *" CT_TRACKEEMODIFY STRUCTURE /SAPTRX/BAPI_EVM_EE_MODIFY OPTIONAL *" CT_EXTENSIONIN STRUCTURE BAPIPAREX OPTIONAL *" CT_EXTENSIONOUT STRUCTURE BAPIPAREX OPTIONAL *" CT_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL *" CHANGING *" REFERENCE(C_EVENTID_MAP) TYPE TRXAS_EVTID_EVTCNT_MAP *" EXCEPTIONS *" PARAMETER_ERROR *" EVENT_DATA_ERROR *" STOP_PROCESSING *"---------------------------------------------------------------------- CALL FUNCTION '/SCMTMS/EXTR_EVT_TO_POPU' EXPORTING i_appsys = i_appsys i_event_type = i_event_type i_all_appl_tables = i_all_appl_tables i_event_type_cntl_tabs = i_event_type_cntl_tabs i_events = i_events TABLES ct_trackingheader = ct_trackingheader ct_tracklocation = ct_tracklocation ct_trackaddress = ct_trackaddress CHANGING c_eventid_map = c_eventid_map EXCEPTIONS parameter_error = 1 event_data_error = 2 stop_processing = 3 OTHERS = 4. CASE sy-subrc. WHEN 1. RAISE parameter_error. WHEN 2. RAISE event_data_error. WHEN 3. RAISE stop_processing. ENDCASE. TRY. LOOP AT i_events ASSIGNING FIELD-SYMBOL(<ls_event>). NEW lcl_actual_event( )->get_tor_actual_event_class( <ls_event> )->adjust_ae_location_data( EXPORTING i_all_appl_tables = i_all_appl_tables iv_event_code = /scmtms/if_tor_const=>sc_tor_event-popu i_event = <ls_event> CHANGING ct_trackingheader = ct_trackingheader[] ct_tracklocation = ct_tracklocation[] ct_trackparameters = ct_trackparameters[] ). ENDLOOP. CATCH cx_udm_message INTO DATA(lo_udm_message). lcl_tools=>get_errors_log( EXPORTING io_umd_message = lo_udm_message iv_appsys = i_appsys IMPORTING es_bapiret = DATA(ls_bapiret) ). APPEND ls_bapiret TO ct_logtable. RAISE stop_processing. ENDTRY. ENDFUNCTION.
38.54955
99
0.660668
ff2bd5b385e64b8ef602abd441a2bdd6f1905aa1
9,365
abap
ABAP
src/checks/y_check_db_access_in_ut.clas.abap
pokrakam/code-pal-for-abap
65c008f75d4d2453c6994c57dc03741862c1d510
[ "Apache-2.0" ]
202
2020-05-05T13:41:12.000Z
2022-03-26T15:18:13.000Z
src/checks/y_check_db_access_in_ut.clas.abap
pokrakam/code-pal-for-abap
65c008f75d4d2453c6994c57dc03741862c1d510
[ "Apache-2.0" ]
322
2020-05-05T19:14:35.000Z
2022-03-22T14:48:44.000Z
src/checks/y_check_db_access_in_ut.clas.abap
lucasborin/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
59
2020-05-05T18:59:19.000Z
2022-03-20T11:24:48.000Z
CLASS y_check_db_access_in_ut DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUBLIC. PUBLIC SECTION. METHODS constructor. PROTECTED SECTION. METHODS inspect_structures REDEFINITION. METHODS inspect_tokens REDEFINITION. PRIVATE SECTION. CONSTANTS: BEGIN OF risk_level, harmless TYPE string VALUE 'HARMLESS', dangerous TYPE string VALUE 'DANGEROUS', critical TYPE string VALUE 'CRITICAL', END OF risk_level. CONSTANTS: BEGIN OF check_for, alter TYPE char40 VALUE 'ALTER', delete TYPE char40 VALUE 'DELETE', update TYPE char40 VALUE 'UPDATE', modify TYPE char40 VALUE 'MODIFY', insert TYPE char40 VALUE 'INSERT', select TYPE char40 VALUE 'SELECT', commit TYPE char40 VALUE 'COMMIT', rollback TYPE char40 VALUE 'ROLLBACK', END OF check_for. CONSTANTS: BEGIN OF framework, qsql_if TYPE char40 VALUE 'IF_OSQL_TEST_ENVIRONMENT', qsql_cl TYPE char40 VALUE 'CL_OSQL_TEST_ENVIRONMENT', cds_if TYPE char40 VALUE 'IF_CDS_TEST_ENVIRONMENT', cds_cl TYPE char40 VALUE 'CL_CDS_TEST_ENVIRONMENT', END OF framework. CONSTANTS: BEGIN OF keys, from TYPE char40 VALUE 'FROM', into TYPE char40 VALUE 'INTO', class TYPE char40 VALUE 'CLASS', table TYPE char4 VALUE 'TABL', END OF keys. TYPES: BEGIN OF properties, name TYPE string, risk_level TYPE string, END OF properties. DATA defined_classes TYPE STANDARD TABLE OF properties. METHODS get_class_name IMPORTING structure TYPE sstruc RETURNING VALUE(result) TYPE string RAISING cx_sy_itab_line_not_found. METHODS get_risk_level IMPORTING statement TYPE sstmnt RETURNING VALUE(result) TYPE string. METHODS add_line_to_defined_classes IMPORTING statement TYPE sstmnt structure TYPE sstruc. METHODS check_class IMPORTING index TYPE i statement TYPE sstmnt structure TYPE sstruc. METHODS is_part_of_framework IMPORTING structure TYPE sstruc RETURNING VALUE(result) TYPE abap_bool. METHODS is_persistent_object IMPORTING obj_name TYPE tadir-obj_name RETURNING VALUE(result) TYPE abap_bool. METHODS is_internal_table IMPORTING statement TYPE sstmnt RETURNING VALUE(result) TYPE abap_bool. METHODS get_forbidden_tokens IMPORTING class_name TYPE string RETURNING VALUE(result) TYPE y_char255_tab. METHODS has_ddic_itab_same_syntax IMPORTING token TYPE stokesx RETURNING VALUE(result) TYPE abap_bool. ENDCLASS. CLASS Y_CHECK_DB_ACCESS_IN_UT IMPLEMENTATION. METHOD constructor. super->constructor( ). settings-pseudo_comment = '"#EC DB_ACCESS_UT' ##NO_TEXT. settings-disable_threshold_selection = abap_true. settings-disable_on_prodcode_selection = abap_true. settings-disable_on_testcode_selection = abap_true. settings-threshold = 0. settings-apply_on_productive_code = abap_false. settings-apply_on_test_code = abap_true. settings-documentation = |{ c_docs_path-checks }db-access-in-ut.md|. relevant_statement_types = VALUE #( ( scan_struc_stmnt_type-class_definition ) ( scan_struc_stmnt_type-class_implementation ) ). relevant_structure_types = VALUE #( ). set_check_message( 'Database access(es) within a Unit-Test should be removed!' ). ENDMETHOD. METHOD inspect_tokens. CASE structure-stmnt_type. WHEN scan_struc_stmnt_type-class_definition. add_line_to_defined_classes( statement = statement structure = structure ). WHEN scan_struc_stmnt_type-class_implementation. check_class( index = index statement = statement structure = structure ). ENDCASE. ENDMETHOD. METHOD is_persistent_object. DATA(upper_name) = to_upper( obj_name ). SELECT SINGLE @abap_true FROM tadir INTO @result WHERE obj_name = @upper_name AND object = @keys-table AND delflag = @space. ENDMETHOD. METHOD is_internal_table. DATA(second_token) = get_token_abs( statement-from + 1 ). DATA(third_token) = get_token_abs( statement-from + 2 ). DATA(fourth_token) = get_token_abs( statement-from + 2 ). IF second_token = keys-into. RETURN. ENDIF. DATA(table_name) = COND #( WHEN second_token = keys-from THEN third_token WHEN third_token = keys-into THEN fourth_token ELSE second_token ). IF strlen( table_name ) > 40. RETURN. ENDIF. result = xsdbool( is_persistent_object( CONV #( table_name ) ) = abap_false ). ENDMETHOD. METHOD add_line_to_defined_classes. TRY. DATA(class_config) = VALUE properties( name = get_class_name( structure ) ). CATCH cx_sy_itab_line_not_found. RETURN. ENDTRY. IF line_exists( defined_classes[ name = class_config-name ] ). RETURN. ENDIF. class_config-risk_level = get_risk_level( statement ). IF is_part_of_framework( structure ) = abap_false. APPEND class_config TO defined_classes. ENDIF. ENDMETHOD. METHOD check_class. TRY. DATA(class_name) = get_class_name( structure ). CATCH cx_sy_itab_line_not_found. RETURN. ENDTRY. IF NOT line_exists( defined_classes[ name = class_name ] ). RETURN. ENDIF. DATA(forbidden_tokens) = get_forbidden_tokens( class_name ). DATA(token) = ref_scan_manager->tokens[ statement-from ]. IF NOT line_exists( forbidden_tokens[ table_line = token-str ] ). RETURN. ENDIF. IF has_ddic_itab_same_syntax( token ) = abap_true AND is_internal_table( statement ) = abap_true. RETURN. ENDIF. IF ref_scan_manager->tokens[ statement-from + 1 ]-str = '='. RETURN. ENDIF. DATA(check_configuration) = detect_check_configuration( statement ). IF check_configuration IS INITIAL. RETURN. ENDIF. raise_error( statement_level = statement-level statement_index = index statement_from = statement-from error_priority = check_configuration-prio ). ENDMETHOD. METHOD get_forbidden_tokens. DATA risk_lvl TYPE properties-risk_level. TRY. risk_lvl = defined_classes[ name = class_name ]-risk_level. CATCH cx_sy_itab_line_not_found. risk_lvl = space. ENDTRY. CASE risk_lvl. WHEN risk_level-dangerous OR risk_level-critical. result = VALUE #( ( check_for-alter ) ( check_for-delete ) ( check_for-update ) ( check_for-modify ) ). WHEN OTHERS. result = VALUE #( ( check_for-alter ) ( check_for-delete ) ( check_for-update ) ( check_for-modify ) ( check_for-insert ) ( check_for-select ) ( check_for-commit ) ( check_for-rollback ) ). ENDCASE. ENDMETHOD. METHOD is_part_of_framework. LOOP AT ref_scan_manager->statements ASSIGNING FIELD-SYMBOL(<statement>) FROM structure-stmnt_from TO structure-stmnt_to. LOOP AT ref_scan_manager->tokens TRANSPORTING NO FIELDS FROM <statement>-from TO <statement>-to WHERE str = framework-qsql_if OR str = framework-qsql_cl OR str = framework-cds_if OR str = framework-cds_cl. result = abap_true. RETURN. ENDLOOP. ENDLOOP. ENDMETHOD. METHOD get_class_name. DATA(index) = ref_scan_manager->statements[ structure-stmnt_from ]-from. IF get_token_abs( index ) = keys-class. result = get_token_abs( index + 1 ). ENDIF. ENDMETHOD. METHOD get_risk_level. LOOP AT ref_scan_manager->tokens ASSIGNING FIELD-SYMBOL(<token>) FROM statement-from TO statement-to WHERE str = risk_level-harmless OR str = risk_level-dangerous OR str = risk_level-critical. result = <token>-str. ENDLOOP. ENDMETHOD. METHOD inspect_structures. relevant_statement_types = VALUE #( ( scan_struc_stmnt_type-class_definition ) ). super->inspect_structures( ). relevant_statement_types = VALUE #( ( scan_struc_stmnt_type-class_implementation ) ). super->inspect_structures( ). ENDMETHOD. METHOD has_ddic_itab_same_syntax. result = xsdbool( token-str = check_for-modify OR token-str = check_for-update OR token-str = check_for-delete OR token-str = check_for-insert ). ENDMETHOD. ENDCLASS.
32.071918
91
0.621356
ff2be664effa32dbab64b500c7f06c4b096aac66
58,714
abap
ABAP
src/zcl_excel_common.clas.abap
MCH123/abap2xlsx
39c1ad1b08877ef642b75af3aef4d0cdad76c891
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_common.clas.abap
MCH123/abap2xlsx
39c1ad1b08877ef642b75af3aef4d0cdad76c891
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_common.clas.abap
MCH123/abap2xlsx
39c1ad1b08877ef642b75af3aef4d0cdad76c891
[ "Apache-2.0" ]
null
null
null
class ZCL_EXCEL_COMMON definition public final create public . *"* public components of class ZCL_EXCEL_COMMON *"* do not include other source files here!!! public section. constants C_EXCEL_BASELINE_DATE type D value '19000101'. "#EC NOTEXT class-data C_EXCEL_NUMFMT_OFFSET type INT1 value 164. "#EC NOTEXT . . . . . . . . . . . . . . . . " . constants C_EXCEL_SHEET_MAX_COL type INT4 value 16384. "#EC NOTEXT constants C_EXCEL_SHEET_MIN_COL type INT4 value 1. "#EC NOTEXT constants C_EXCEL_SHEET_MAX_ROW type INT4 value 1048576. "#EC NOTEXT constants C_EXCEL_SHEET_MIN_ROW type INT4 value 1. "#EC NOTEXT class-data C_SPRAS_EN type SPRAS value 'E'. "#EC NOTEXT . . . . . . . . . . . . . . . . " . class-data O_CONV type ref to CL_ABAP_CONV_OUT_CE . constants C_EXCEL_1900_LEAP_YEAR type D value '19000228'. "#EC NOTEXT class-data C_XLSX_FILE_FILTER type STRING value 'Excel Workbook (*.xlsx)|*.xlsx|'. "#EC NOTEXT . . . . . . . " . class-methods CLASS_CONSTRUCTOR . class-methods DESCRIBE_STRUCTURE importing !IO_STRUCT type ref to CL_ABAP_STRUCTDESCR returning value(RT_DFIES) type DDFIELDS . class-methods CONVERT_COLUMN2ALPHA importing !IP_COLUMN type SIMPLE returning value(EP_COLUMN) type ZEXCEL_CELL_COLUMN_ALPHA raising ZCX_EXCEL . class-methods CONVERT_COLUMN2INT importing !IP_COLUMN type SIMPLE returning value(EP_COLUMN) type ZEXCEL_CELL_COLUMN raising ZCX_EXCEL . class-methods CONVERT_COLUMNROW2COLUMN_A_ROW importing !I_COLUMNROW type CLIKE exporting !E_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA !E_ROW type ZEXCEL_CELL_ROW . class-methods CONVERT_RANGE2COLUMN_A_ROW importing !I_RANGE type CLIKE exporting !E_COLUMN_START type ZEXCEL_CELL_COLUMN_ALPHA !E_COLUMN_END type ZEXCEL_CELL_COLUMN_ALPHA !E_ROW_START type ZEXCEL_CELL_ROW !E_ROW_END type ZEXCEL_CELL_ROW !E_SHEET type CLIKE raising ZCX_EXCEL . class-methods DATE_TO_EXCEL_STRING importing !IP_VALUE type D returning value(EP_VALUE) type ZEXCEL_CELL_VALUE . class-methods ENCRYPT_PASSWORD importing !I_PWD type ZEXCEL_AES_PASSWORD returning value(R_ENCRYPTED_PWD) type ZEXCEL_AES_PASSWORD . class-methods ESCAPE_STRING importing !IP_VALUE type CLIKE returning value(EP_ESCAPED_VALUE) type STRING . class-methods UNESCAPE_STRING importing !IV_ESCAPED type CLIKE returning value(EV_UNESCAPED_STRING) type STRING raising ZCX_EXCEL . class-methods EXCEL_STRING_TO_DATE importing !IP_VALUE type ZEXCEL_CELL_VALUE returning value(EP_VALUE) type D raising ZCX_EXCEL . class-methods EXCEL_STRING_TO_TIME importing !IP_VALUE type ZEXCEL_CELL_VALUE returning value(EP_VALUE) type T raising ZCX_EXCEL . class-methods EXCEL_STRING_TO_NUMBER importing !IP_VALUE type ZEXCEL_CELL_VALUE returning value(EP_VALUE) type F raising ZCX_EXCEL . class-methods GET_FIELDCATALOG importing !IP_TABLE type STANDARD TABLE returning value(EP_FIELDCATALOG) type ZEXCEL_T_FIELDCATALOG . class-methods NUMBER_TO_EXCEL_STRING importing value(IP_VALUE) type NUMERIC returning value(EP_VALUE) type ZEXCEL_CELL_VALUE . class-methods RECURSIVE_CLASS_TO_STRUCT importing !I_SOURCE type ANY changing !E_TARGET type DATA !E_TARGETX type DATA . class-methods RECURSIVE_STRUCT_TO_CLASS importing !I_SOURCE type DATA !I_SOURCEX type DATA changing !E_TARGET type ANY . class-methods TIME_TO_EXCEL_STRING importing !IP_VALUE type T returning value(EP_VALUE) type ZEXCEL_CELL_VALUE . type-pools ABAP . class-methods SPLIT_FILE importing !IP_FILE type TEXT255 exporting !EP_FILE type TEXT255 !EP_EXTENSION type CHAR10 !EP_DOTEXTENSION type CHAR10 . class-methods CALCULATE_CELL_DISTANCE importing !IV_REFERENCE_CELL type CLIKE !IV_CURRENT_CELL type CLIKE exporting !EV_ROW_DIFFERENCE type I !EV_COL_DIFFERENCE type I raising ZCX_EXCEL . class-methods DETERMINE_RESULTING_FORMULA importing !IV_REFERENCE_CELL type CLIKE !IV_REFERENCE_FORMULA type CLIKE !IV_CURRENT_CELL type CLIKE returning value(EV_RESULTING_FORMULA) type STRING raising ZCX_EXCEL . class-methods SHIFT_FORMULA importing !IV_REFERENCE_FORMULA type CLIKE value(IV_SHIFT_COLS) type I value(IV_SHIFT_ROWS) type I returning value(EV_RESULTING_FORMULA) type STRING raising ZCX_EXCEL . class-methods IS_CELL_IN_RANGE importing !IP_COLUMN type SIMPLE !IP_ROW type ZEXCEL_CELL_ROW !IP_RANGE type CLIKE returning value(RP_IN_RANGE) type ABAP_BOOL raising ZCX_EXCEL . *"* protected components of class ZCL_EXCEL_COMMON *"* do not include other source files here!!! *"* protected components of class ZCL_EXCEL_COMMON *"* do not include other source files here!!! protected section. private section. class-data C_EXCEL_COL_MODULE type INT2 value 64. "#EC NOTEXT . . . . . . . . . . . . . . . " . class-methods STRUCTURE_CASE importing !IS_COMPONENT type ABAP_COMPONENTDESCR changing !XT_COMPONENTS type ABAP_COMPONENT_TAB . class-methods STRUCTURE_RECURSIVE importing !IS_COMPONENT type ABAP_COMPONENTDESCR returning value(RT_COMPONENTS) type ABAP_COMPONENT_TAB . class-methods CHAR2HEX importing !I_CHAR type CHAR1 returning value(R_HEX) type ZEXCEL_PWD_HASH . class-methods SHL01 importing !I_PWD_HASH type ZEXCEL_PWD_HASH returning value(R_PWD_HASH) type ZEXCEL_PWD_HASH . class-methods SHR14 importing !I_PWD_HASH type ZEXCEL_PWD_HASH returning value(R_PWD_HASH) type ZEXCEL_PWD_HASH . ENDCLASS. CLASS ZCL_EXCEL_COMMON IMPLEMENTATION. METHOD calculate_cell_distance. DATA: lv_reference_row TYPE i, lv_reference_col_alpha TYPE zexcel_cell_column_alpha, lv_reference_col TYPE i, lv_current_row TYPE i, lv_current_col_alpha TYPE zexcel_cell_column_alpha, lv_current_col TYPE i. *--------------------------------------------------------------------* * Split reference cell into numerical row/column representation *--------------------------------------------------------------------* convert_columnrow2column_a_row( EXPORTING i_columnrow = iv_reference_cell IMPORTING e_column = lv_reference_col_alpha e_row = lv_reference_row ). lv_reference_col = convert_column2int( lv_reference_col_alpha ). *--------------------------------------------------------------------* * Split current cell into numerical row/column representation *--------------------------------------------------------------------* convert_columnrow2column_a_row( EXPORTING i_columnrow = iv_current_cell IMPORTING e_column = lv_current_col_alpha e_row = lv_current_row ). lv_current_col = convert_column2int( lv_current_col_alpha ). *--------------------------------------------------------------------* * Calculate row and column difference * Positive: Current cell below reference cell * or Current cell right of reference cell * Negative: Current cell above reference cell * or Current cell left of reference cell *--------------------------------------------------------------------* ev_row_difference = lv_current_row - lv_reference_row. ev_col_difference = lv_current_col - lv_reference_col. ENDMETHOD. method CHAR2HEX. IF o_conv IS NOT BOUND. o_conv = cl_abap_conv_out_ce=>create( endian = 'L' ignore_cerr = abap_true replacement = '#' ). ENDIF. CALL METHOD o_conv->reset( ). CALL METHOD o_conv->write( data = i_char ). r_hex+1 = o_conv->get_buffer( ). " x'65' must be x'0065' endmethod. METHOD class_constructor. c_xlsx_file_filter = 'Excel Workbook (*.xlsx)|*.xlsx|'(005). ENDMETHOD. METHOD convert_column2alpha. DATA: lv_uccpi TYPE i, lv_text TYPE sychar02, lv_module TYPE int4, lv_column TYPE zexcel_cell_column. STATICS: sv_prev_in LIKE lv_column, sv_prev_out LIKE ep_column. * Propagate zcx_excel if error occurs " issue #155 - less restrictive typing for ip_column lv_column = convert_column2int( ip_column ). " issue #155 - less restrictive typing for ip_column *--------------------------------------------------------------------* * Check whether column is in allowed range for EXCEL to handle ( 1-16384 ) *--------------------------------------------------------------------* IF lv_column > 16384 OR lv_column < 1. zcx_excel=>raise_text( 'Index out of bounds' ). ENDIF. *--------------------------------------------------------------------* * Look up for previous succesfull cached result *--------------------------------------------------------------------* IF lv_column = sv_prev_in AND sv_prev_out IS NOT INITIAL. ep_column = sv_prev_out. RETURN. ELSE. CLEAR sv_prev_out. sv_prev_in = lv_column. ENDIF. *--------------------------------------------------------------------* * Build alpha representation of column *--------------------------------------------------------------------* WHILE lv_column GT 0. lv_module = ( lv_column - 1 ) MOD 26. lv_uccpi = 65 + lv_module. lv_column = ( lv_column - lv_module ) / 26. lv_text = cl_abap_conv_in_ce=>uccpi( lv_uccpi ). CONCATENATE lv_text ep_column INTO ep_column. ENDWHILE. *--------------------------------------------------------------------* * Save succesfull output into cache *--------------------------------------------------------------------* sv_prev_out = ep_column. ENDMETHOD. METHOD convert_column2int. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-12-29 * - ... * changes: renaming variables to naming conventions * removing unused variables * removing commented out code that is inactive for more then half a year * message made to support multilinguality * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* * issue#246 - error converting lower case column names * - Stefan Schmoecker, 2012-12-29 * changes: translating the correct variable to upper dase * adding missing exception if input is a number * that is out of bounds * adding missing exception if input contains * illegal characters like german umlauts *--------------------------------------------------------------------* DATA: lv_column TYPE zexcel_cell_column_alpha, lv_column_c TYPE char10, lv_column_s TYPE string, lv_errormessage TYPE string, " Can't pass '...'(abc) to exception-class lv_modulo TYPE i. STATICS: sv_prev_in LIKE lv_column_c, sv_prev_out LIKE ep_column. *--------------------------------------------------------------------* * This module tries to identify which column a user wants to access * Numbers as input are just passed back, anything else will be converted * using EXCEL nomenclatura A = 1, AA = 27, ..., XFD = 16384 *--------------------------------------------------------------------* *--------------------------------------------------------------------* * Normalize input ( upper case , no gaps ) *--------------------------------------------------------------------* lv_column_c = ip_column. * TRANSLATE lv_column TO UPPER CASE. " Fix #246 TRANSLATE lv_column_c TO UPPER CASE. " Fix #246 CONDENSE lv_column_c NO-GAPS. IF lv_column_c EQ ''. * lv_errormessage = 'Unable to interpret input as column'(003). MESSAGE e800(zabap2xlsx) INTO lv_errormessage. zcx_excel=>raise_symsg( ). ENDIF. *--------------------------------------------------------------------* * Look up for previous succesfull cached result *--------------------------------------------------------------------* IF lv_column_c = sv_prev_in AND sv_prev_out IS NOT INITIAL. ep_column = sv_prev_out. RETURN. ELSE. CLEAR sv_prev_out. sv_prev_in = lv_column_c. ENDIF. *--------------------------------------------------------------------* * If a number gets passed, just convert it to an integer and return * the converted value *--------------------------------------------------------------------* TRY. IF lv_column_c CO '1234567890 '. " Fix #164 ep_column = lv_column_c. " Fix #164 *--------------------------------------------------------------------* * Maximum column for EXCEL: XFD = 16384 " if anyone has a reference for this information - please add here instead of this comment *--------------------------------------------------------------------* IF ep_column > 16384 OR ep_column < 1. lv_errormessage = 'Index out of bounds'(004). zcx_excel=>raise_text( lv_errormessage ). ENDIF. EXIT. ENDIF. CATCH cx_sy_conversion_no_number. "#EC NO_HANDLER " Try the character-approach if approach via number has failed ENDTRY. *--------------------------------------------------------------------* * Raise error if unexpected characters turns up *--------------------------------------------------------------------* lv_column_s = lv_column_c. IF lv_column_s CN sy-abcde. * lv_errormessage = 'Unable to interpret input as column'(003). MESSAGE e800(zabap2xlsx) INTO lv_errormessage. zcx_excel=>raise_symsg( ). ENDIF. DO 1 TIMES. "Because of using CHECK *--------------------------------------------------------------------* * Interpret input as number to base 26 with A=1, ... Z=26 * Raise error if unexpected character turns up *--------------------------------------------------------------------* * 1st character *--------------------------------------------------------------------* lv_column = lv_column_c. lv_modulo = cl_abap_conv_out_ce=>uccpi( lv_column+0(1) ) MOD zcl_excel_common=>c_excel_col_module. IF lv_modulo < 1 OR lv_modulo > 26. * lv_errormessage = 'Unable to interpret input as column'(003). MESSAGE e800(zabap2xlsx) INTO lv_errormessage. zcx_excel=>raise_symsg( ). ENDIF. ep_column = lv_modulo. " Leftmost digit *--------------------------------------------------------------------* * 2nd character if present *--------------------------------------------------------------------* CHECK lv_column+1(1) IS NOT INITIAL. " No need to continue if string ended lv_modulo = cl_abap_conv_out_ce=>uccpi( lv_column+1(1) ) MOD zcl_excel_common=>c_excel_col_module. IF lv_modulo < 1 OR lv_modulo > 26. * lv_errormessage = 'Unable to interpret input as column'(003). MESSAGE e800(zabap2xlsx) INTO lv_errormessage. zcx_excel=>raise_symsg( ). ENDIF. ep_column = 26 * ep_column + lv_modulo. " if second digit is present first digit is for 26^1 *--------------------------------------------------------------------* * 3rd character if present *--------------------------------------------------------------------* CHECK lv_column+2(1) IS NOT INITIAL. " No need to continue if string ended lv_modulo = cl_abap_conv_out_ce=>uccpi( lv_column+2(1) ) MOD zcl_excel_common=>c_excel_col_module. IF lv_modulo < 1 OR lv_modulo > 26. * lv_errormessage = 'Unable to interpret input as column'(003). MESSAGE e800(zabap2xlsx) INTO lv_errormessage. zcx_excel=>raise_symsg( ). ENDIF. ep_column = 26 * ep_column + lv_modulo. " if third digit is present first digit is for 26^2 and second digit for 26^1 ENDDO. *--------------------------------------------------------------------* * Maximum column for EXCEL: XFD = 16384 " if anyone has a reference for this information - please add here instead of this comment *--------------------------------------------------------------------* IF ep_column > 16384 OR ep_column < 1. lv_errormessage = 'Index out of bounds'(004). zcx_excel=>raise_text( lv_errormessage ). ENDIF. *--------------------------------------------------------------------* * Save succesfull output into cache *--------------------------------------------------------------------* sv_prev_out = ep_column. ENDMETHOD. method CONVERT_COLUMNROW2COLUMN_A_ROW. *--------------------------------------------------------------------* "issue #256 - replacing char processing with regex *--------------------------------------------------------------------* * Stefan Schmoecker, 2013-08-11 * Allow input to be CLIKE instead of STRING *--------------------------------------------------------------------* DATA: pane_cell_row_a TYPE string, lv_columnrow type string. lv_columnrow = i_columnrow. " Get rid of trailing blanks FIND REGEX '^(\D+)(\d+)$' IN lv_columnrow SUBMATCHES e_column pane_cell_row_a. e_row = pane_cell_row_a. endmethod. method CONVERT_RANGE2COLUMN_A_ROW. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-12-07 * - ... * changes: renaming variables to naming conventions * aligning code * added exceptionclass * added errorhandling for invalid range * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* * issue#241 - error when sheetname contains "!" * - sheetname should be returned unescaped * - Stefan Schmoecker, 2012-12-07 * changes: changed coding to support sheetnames with "!" * unescaping sheetname *--------------------------------------------------------------------* * issue#155 - lessening restrictions of input parameters * - Stefan Schmoecker, 2012-12-07 * changes: i_range changed to clike * e_sheet changed to clike *--------------------------------------------------------------------* DATA: lv_sheet TYPE string, lv_range TYPE string, lv_columnrow_start TYPE string, lv_columnrow_end TYPE string, lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class *--------------------------------------------------------------------* * Split input range into sheetname and Area * 4 cases - a) input empty --> nothing to do * - b) sheetname existing - starts with ' example 'Sheet 1'!$B$6:$D$13 * - c) sheetname existing - does not start with ' example Sheet1!$B$6:$D$13 * - d) no sheetname - just area example $B$6:$D$13 *--------------------------------------------------------------------* * Initialize output parameters CLEAR: e_column_start, e_column_end, e_row_start, e_row_end, e_sheet. IF i_range IS INITIAL. " a) input empty --> nothing to do EXIT. ELSEIF i_range(1) = `'`. " b) sheetname existing - starts with ' FIND REGEX '\![^\!]*$' IN i_range MATCH OFFSET sy-fdpos. " Find last ! IF sy-subrc = 0. lv_sheet = i_range(sy-fdpos). ADD 1 TO sy-fdpos. lv_range = i_range. SHIFT lv_range LEFT BY sy-fdpos PLACES. ELSE. lv_errormessage = 'Invalid range'(001). zcx_excel=>raise_text( lv_errormessage ). ENDIF. ELSEIF i_range CS '!'. " c) sheetname existing - does not start with ' SPLIT i_range AT '!' INTO lv_sheet lv_range. ELSE. " d) no sheetname - just area lv_range = i_range. ENDIF. REPLACE ALL OCCURRENCES OF '$' IN lv_range WITH ''. SPLIT lv_range AT ':' INTO lv_columnrow_start lv_columnrow_end. convert_columnrow2column_a_row( EXPORTING i_columnrow = lv_columnrow_start IMPORTING e_column = e_column_start e_row = e_row_start ). convert_columnrow2column_a_row( EXPORTING i_columnrow = lv_columnrow_end IMPORTING e_column = e_column_end e_row = e_row_end ). e_sheet = unescape_string( lv_sheet ). " Return in unescaped form endmethod. method DATE_TO_EXCEL_STRING. DATA: lv_date_diff TYPE i. CHECK ip_value IS NOT INITIAL AND ip_value <> space. " Needed hack caused by the problem that: " Excel 2000 incorrectly assumes that the year 1900 is a leap year " http://support.microsoft.com/kb/214326/en-us IF ip_value > c_excel_1900_leap_year. lv_date_diff = ip_value - c_excel_baseline_date + 2. ELSE. lv_date_diff = ip_value - c_excel_baseline_date + 1. ENDIF. ep_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_date_diff ). endmethod. method DESCRIBE_STRUCTURE. DATA: lt_components TYPE abap_component_tab, lt_comps TYPE abap_component_tab, ls_component TYPE abap_componentdescr, lo_elemdescr TYPE REF TO cl_abap_elemdescr, ls_dfies TYPE dfies, l_position TYPE tabfdpos. "for DDIC structure get the info directly IF io_struct->is_ddic_type( ) = abap_true. rt_dfies = io_struct->get_ddic_field_list( ). ELSE. lt_components = io_struct->get_components( ). LOOP AT lt_components INTO ls_component. structure_case( EXPORTING is_component = ls_component CHANGING xt_components = lt_comps ) . ENDLOOP. LOOP AT lt_comps INTO ls_component. CLEAR ls_dfies. IF ls_component-type->kind = cl_abap_typedescr=>kind_elem. "E Elementary Type ADD 1 TO l_position. lo_elemdescr ?= ls_component-type. IF lo_elemdescr->is_ddic_type( ) = abap_true. ls_dfies = lo_elemdescr->get_ddic_field( ). ls_dfies-fieldname = ls_component-name. ls_dfies-position = l_position. ELSE. ls_dfies-fieldname = ls_component-name. ls_dfies-position = l_position. ls_dfies-inttype = lo_elemdescr->type_kind. ls_dfies-leng = lo_elemdescr->length. ls_dfies-outputlen = lo_elemdescr->length. ls_dfies-decimals = lo_elemdescr->decimals. ls_dfies-fieldtext = ls_component-name. ls_dfies-reptext = ls_component-name. ls_dfies-scrtext_s = ls_component-name. ls_dfies-scrtext_m = ls_component-name. ls_dfies-scrtext_l = ls_component-name. ls_dfies-dynpfld = abap_true. ENDIF. INSERT ls_dfies INTO TABLE rt_dfies. ENDIF. ENDLOOP. ENDIF. endmethod. METHOD determine_resulting_formula. DATA: lv_row_difference TYPE i, lv_col_difference TYPE i. *--------------------------------------------------------------------* * Calculate distance of reference and current cell *--------------------------------------------------------------------* calculate_cell_distance( EXPORTING iv_reference_cell = iv_reference_cell iv_current_cell = iv_current_cell IMPORTING ev_row_difference = lv_row_difference ev_col_difference = lv_col_difference ). *--------------------------------------------------------------------* * and shift formula by using the row- and columndistance *--------------------------------------------------------------------* ev_resulting_formula = shift_formula( iv_reference_formula = iv_reference_formula iv_shift_rows = lv_row_difference iv_shift_cols = lv_col_difference ). ENDMETHOD. "determine_resulting_formula method ENCRYPT_PASSWORD. DATA lv_curr_offset TYPE i. DATA lv_curr_char TYPE c LENGTH 1. DATA lv_curr_hex TYPE zexcel_pwd_hash. DATA lv_pwd_len TYPE zexcel_pwd_hash. DATA lv_pwd_hash TYPE zexcel_pwd_hash. CONSTANTS: lv_0x7fff TYPE zexcel_pwd_hash VALUE '7FFF', lv_0x0001 TYPE zexcel_pwd_hash VALUE '0001', lv_0xce4b TYPE zexcel_pwd_hash VALUE 'CE4B'. DATA lv_pwd TYPE zexcel_aes_password. lv_pwd = i_pwd(15). lv_pwd_len = STRLEN( lv_pwd ). lv_curr_offset = lv_pwd_len - 1. WHILE lv_curr_offset GE 0. lv_curr_char = lv_pwd+lv_curr_offset(1). lv_curr_hex = char2hex( lv_curr_char ). lv_pwd_hash = ( shr14( lv_pwd_hash ) BIT-AND lv_0x0001 ) BIT-OR ( shl01( lv_pwd_hash ) BIT-AND lv_0x7fff ). lv_pwd_hash = lv_pwd_hash BIT-XOR lv_curr_hex. SUBTRACT 1 FROM lv_curr_offset. ENDWHILE. lv_pwd_hash = ( shr14( lv_pwd_hash ) BIT-AND lv_0x0001 ) BIT-OR ( shl01( lv_pwd_hash ) BIT-AND lv_0x7fff ). lv_pwd_hash = lv_pwd_hash BIT-XOR lv_0xce4b. lv_pwd_hash = lv_pwd_hash BIT-XOR lv_pwd_len. WRITE lv_pwd_hash TO r_encrypted_pwd. endmethod. method ESCAPE_STRING. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-12-08 * - ... * changes: aligning code * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* * issue#242 - Support escaping for white-spaces * - Escaping also necessary when ' encountered in input * - Stefan Schmoecker, 2012-12-08 * changes: switched check if escaping is necessary to regular expression * and moved the "REPLACE" *--------------------------------------------------------------------* * issue#155 - lessening restrictions of input parameters * - Stefan Schmoecker, 2012-12-08 * changes: ip_value changed to clike *--------------------------------------------------------------------* DATA: lv_value TYPE string. *--------------------------------------------------------------------* * There exist various situations when a space will be used to separate * different parts of a string. When we have a string consisting spaces * that will cause errors unless we "escape" the string by putting ' at * the beginning and at the end of the string. *--------------------------------------------------------------------* *--------------------------------------------------------------------* * When allowing clike-input parameters we might encounter trailing * "real" blanks . These are automatically eliminated when moving * the input parameter to a string. * Now any remaining spaces ( white-spaces or normal spaces ) should * trigger the escaping as well as any ' *--------------------------------------------------------------------* lv_value = ip_value. FIND REGEX `\s|'` IN lv_value. " \s finds regular and white spaces IF sy-subrc = 0. REPLACE ALL OCCURRENCES OF `'` IN lv_value WITH `''`. CONCATENATE `'` lv_value `'` INTO lv_value . ENDIF. ep_escaped_value = lv_value. endmethod. method EXCEL_STRING_TO_DATE. DATA: lv_date_int TYPE i. TRY. lv_date_int = ip_value. ep_value = lv_date_int + c_excel_baseline_date - 2. " Needed hack caused by the problem that: " Excel 2000 incorrectly assumes that the year 1900 is a leap year " http://support.microsoft.com/kb/214326/en-us IF ep_value < c_excel_1900_leap_year. ep_value = ep_value + 1. ENDIF. CATCH cx_sy_conversion_error. zcx_excel=>raise_text( 'Index out of bounds' ). ENDTRY. endmethod. method EXCEL_STRING_TO_NUMBER. * If we encounter anything more complicated in EXCEL we might have to extend this * But currently this works fine - even for numbers in scientific notation ep_value = ip_value. endmethod. method EXCEL_STRING_TO_TIME. DATA: lv_seconds_in_day TYPE i, lv_day_fraction TYPE f, lc_seconds_in_day TYPE i VALUE 86400. TRY. lv_day_fraction = ip_value. lv_seconds_in_day = lv_day_fraction * lc_seconds_in_day. ep_value = lv_seconds_in_day. CATCH cx_sy_conversion_error. zcx_excel=>raise_text( 'Unable to interpret time' ). ENDTRY. endmethod. METHOD get_fieldcatalog. DATA: lr_dref_tab TYPE REF TO data, lo_salv_table TYPE REF TO cl_salv_table, lo_salv_columns_table TYPE REF TO cl_salv_columns_table, lt_salv_t_column_ref TYPE salv_t_column_ref, ls_salv_t_column_ref LIKE LINE OF lt_salv_t_column_ref, lo_salv_column_table TYPE REF TO cl_salv_column_table. FIELD-SYMBOLS: <tab> TYPE STANDARD TABLE. FIELD-SYMBOLS: <fcat> LIKE LINE OF ep_fieldcatalog. * Get copy of IP_TABLE-structure <-- must be changeable to create salv CREATE DATA lr_dref_tab LIKE ip_table. ASSIGN lr_dref_tab->* TO <tab>. * Create salv --> implicitly create fieldcat TRY. cl_salv_table=>factory( IMPORTING r_salv_table = lo_salv_table CHANGING t_table = <tab> ). lo_salv_columns_table = lo_salv_table->get_columns( ). lt_salv_t_column_ref = lo_salv_columns_table->get( ). CATCH cx_root. * maybe some errorhandling here - just haven't made up my mind yet ENDTRY. * Loop through columns and set relevant fields ( fieldname, texts ) LOOP AT lt_salv_t_column_ref INTO ls_salv_t_column_ref. lo_salv_column_table ?= ls_salv_t_column_ref-r_column. APPEND INITIAL LINE TO ep_fieldcatalog ASSIGNING <fcat>. <fcat>-position = sy-tabix. <fcat>-fieldname = ls_salv_t_column_ref-columnname. <fcat>-scrtext_s = ls_salv_t_column_ref-r_column->get_short_text( ). <fcat>-scrtext_m = ls_salv_t_column_ref-r_column->get_medium_text( ). <fcat>-scrtext_l = ls_salv_t_column_ref-r_column->get_long_text( ). <fcat>-abap_type = lo_salv_column_table->get_ddic_inttype( ). <fcat>-dynpfld = 'X'. " What in the world would we exclude here? " except for the MANDT-field of most tables ( 1st column that is ) IF <fcat>-position = 1 AND lo_salv_column_table->get_ddic_datatype( ) = 'CLNT'. CLEAR <fcat>-dynpfld. ENDIF. * For fields that don't a description ( i.e. defined by "field type i," ) * just use the fieldname as description - that is better than nothing IF <fcat>-scrtext_s IS INITIAL AND <fcat>-scrtext_m IS INITIAL AND <fcat>-scrtext_l IS INITIAL. CONCATENATE 'Col:' <fcat>-fieldname INTO <fcat>-scrtext_l SEPARATED BY space. <fcat>-scrtext_m = <fcat>-scrtext_l. <fcat>-scrtext_s = <fcat>-scrtext_l. ENDIF. ENDLOOP. ENDMETHOD. method IS_CELL_IN_RANGE. DATA lv_column_start TYPE zexcel_cell_column_alpha. DATA lv_column_end TYPE zexcel_cell_column_alpha. DATA lv_row_start TYPE zexcel_cell_row. DATA lv_row_end TYPE zexcel_cell_row. DATA lv_column_start_i TYPE zexcel_cell_column. DATA lv_column_end_i TYPE zexcel_cell_column. DATA lv_column_i TYPE zexcel_cell_column. * Split range and convert columns convert_range2column_a_row( exporting i_range = ip_range IMPORTING e_column_start = lv_column_start e_column_end = lv_column_end e_row_start = lv_row_start e_row_end = lv_row_end ). lv_column_start_i = convert_column2int( ip_column = lv_column_start ). lv_column_end_i = convert_column2int( ip_column = lv_column_end ). lv_column_i = convert_column2int( ip_column = ip_column ). * Check if cell is in range IF lv_column_i >= lv_column_start_i AND lv_column_i <= lv_column_end_i AND ip_row >= lv_row_start AND ip_row <= lv_row_end. rp_in_range = abap_true. ENDIF. endmethod. method NUMBER_TO_EXCEL_STRING. DATA: lv_value_c TYPE c LENGTH 100. WRITE ip_value TO lv_value_c EXPONENT 0 NO-GROUPING NO-SIGN. REPLACE ALL OCCURRENCES OF ',' IN lv_value_c WITH '.'. ep_value = lv_value_c. CONDENSE ep_value. IF ip_value < 0. CONCATENATE '-' ep_value INTO ep_value. ELSEIF ip_value EQ 0. ep_value = '0'. ENDIF. endmethod. method RECURSIVE_CLASS_TO_STRUCT. " # issue 139 * is working for me - but after looking through this coding I guess * I'll rewrite this to a version w/o recursion * This is private an no one using it so far except me, so no need to hurry DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name TYPE fieldname, flag_class TYPE flag. FIELD-SYMBOLS: <field> TYPE any, <fieldx> TYPE any, <attribute> TYPE any. descr ?= cl_abap_structdescr=>describe_by_data( e_target ). LOOP AT descr->components INTO wa_component. * Assign structure and X-structure ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <field>. ASSIGN COMPONENT wa_component-name OF STRUCTURE e_targetx TO <fieldx>. * At least one field in the structure should be marked - otherwise continue with next field CLEAR flag_class. * maybe source is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <attribute>. IF sy-subrc <> 0. * not - then it is an attribute of the class - use different assign then CONCATENATE 'i_source->' wa_component-name INTO attribute_name. ASSIGN (attribute_name) TO <attribute>. IF sy-subrc <> 0. EXIT. ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps flag_class = abap_true. ENDIF. CASE wa_component-type_kind. WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursio * IF flag_class = abap_true. ** Only borders will be passed as unbound references. But since we want to set a value we have to create an instance * ENDIF. zcl_excel_common=>recursive_class_to_struct( EXPORTING i_source = <attribute> CHANGING e_target = <field> e_targetx = <fieldx> ). WHEN OTHERS. <field> = <attribute>. <fieldx> = abap_true. ENDCASE. ENDLOOP. endmethod. METHOD recursive_struct_to_class. " # issue 139 * is working for me - but after looking through this coding I guess * I'll rewrite this to a version w/o recursion * This is private an no one using it so far except me, so no need to hurry DATA: descr TYPE REF TO cl_abap_structdescr, wa_component LIKE LINE OF descr->components, attribute_name TYPE fieldname, flag_class TYPE flag, o_border TYPE REF TO zcl_excel_style_border. FIELD-SYMBOLS: <field> TYPE any, <fieldx> TYPE any, <attribute> TYPE any. descr ?= cl_abap_structdescr=>describe_by_data( i_source ). LOOP AT descr->components INTO wa_component. * Assign structure and X-structure ASSIGN COMPONENT wa_component-name OF STRUCTURE i_source TO <field>. ASSIGN COMPONENT wa_component-name OF STRUCTURE i_sourcex TO <fieldx>. * At least one field in the structure should be marked - otherwise continue with next field CHECK <fieldx> CA abap_true. CLEAR flag_class. * maybe target is just a structure - try assign component... ASSIGN COMPONENT wa_component-name OF STRUCTURE e_target TO <attribute>. IF sy-subrc <> 0. * not - then it is an attribute of the class - use different assign then CONCATENATE 'E_TARGET->' wa_component-name INTO attribute_name. ASSIGN (attribute_name) TO <attribute>. IF sy-subrc <> 0.EXIT.ENDIF. " Should not happen if structure is built properly - otherwise just exit to create no dumps flag_class = abap_true. ENDIF. CASE wa_component-type_kind. WHEN cl_abap_structdescr=>typekind_struct1 OR cl_abap_structdescr=>typekind_struct2. " Structure --> use recursion " To avoid dump with attribute GRADTYPE of class ZCL_EXCEL_STYLE_FILL " quick and really dirty fix -> check the attribute name " Border has to be initialized somewhere else IF wa_component-name EQ 'GRADTYPE'. flag_class = abap_false. ENDIF. IF flag_class = abap_true AND <attribute> IS INITIAL. * Only borders will be passed as unbound references. But since we want to set a value we have to create an instance CREATE OBJECT o_border. <attribute> = o_border. ENDIF. zcl_excel_common=>recursive_struct_to_class( EXPORTING i_source = <field> i_sourcex = <fieldx> CHANGING e_target = <attribute> ). * WHEN cl_abap_structdescr=>typekind_struct2. " String * CHECK <fieldx> = abap_true. " Marked for change * <attribute_s> = <field>. WHEN OTHERS. CHECK <fieldx> = abap_true. " Marked for change <attribute> = <field>. ENDCASE. ENDLOOP. ENDMETHOD. METHOD shift_formula. CONSTANTS: lcv_operators TYPE string VALUE '+-/*^%=<>&, !', lcv_letters TYPE string VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ$', lcv_digits TYPE string VALUE '0123456789', lcv_cell_reference_error TYPE string VALUE '#REF!'. DATA: lv_tcnt TYPE i, " Counter variable lv_tlen TYPE i, " Temp variable length lv_cnt TYPE i, " Counter variable lv_cnt2 TYPE i, " Counter variable lv_offset1 TYPE i, " Character offset lv_numchars TYPE i, " Number of characters counter lv_tchar(1) TYPE c, " Temp character lv_tchar2(1) TYPE c, " Temp character lv_cur_form(2000) TYPE c, " Formula for current cell lv_ref_cell_addr TYPE string, " Reference cell address lv_tcol1 TYPE string, " Temp column letter lv_tcol2 TYPE string, " Temp column letter lv_tcoln TYPE i, " Temp column number lv_trow1 TYPE string, " Temp row number lv_trow2 TYPE string, " Temp row number lv_flen TYPE i, " Length of reference formula lv_tlen2 TYPE i, " Temp variable length lv_substr1 TYPE string, " Substring variable lv_abscol TYPE string, " Absolute column symbol lv_absrow TYPE string, " Absolute row symbol lv_errormessage TYPE string. *--------------------------------------------------------------------* * When copying a cell in EXCEL to another cell any inherent formulas * are copied as well. Cell-references in the formula are being adjusted * by the distance of the new cell to the original one *--------------------------------------------------------------------* * §1 Parse reference formula character by character * §2 Identify Cell-references * §3 Shift cell-reference * §4 Build resulting formula *--------------------------------------------------------------------* *--------------------------------------------------------------------* * No distance --> Reference = resulting cell/formula *--------------------------------------------------------------------* IF iv_shift_cols = 0 AND iv_shift_rows = 0. ev_resulting_formula = iv_reference_formula. EXIT. " done ENDIF. lv_flen = STRLEN( iv_reference_formula ). lv_numchars = 1. *--------------------------------------------------------------------* * §1 Parse reference formula character by character *--------------------------------------------------------------------* DO lv_flen TIMES. CLEAR: lv_tchar, lv_substr1, lv_ref_cell_addr. lv_cnt2 = lv_cnt + 1. IF lv_cnt2 > lv_flen. EXIT. " Done ENDIF. *--------------------------------------------------------------------* * Here we have the current character in the formula *--------------------------------------------------------------------* lv_tchar = iv_reference_formula+lv_cnt(1). *--------------------------------------------------------------------* * Operators or opening parenthesis will separate possible cellreferences *--------------------------------------------------------------------* IF ( lv_tchar CA lcv_operators OR lv_tchar CA '(' ) AND lv_cnt2 = 1. lv_substr1 = iv_reference_formula+lv_offset1(1). CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_numchars = 1. CONTINUE. " --> next character in formula can be analyzed ENDIF. *--------------------------------------------------------------------* * Quoted literal text holds no cell reference --> advance to end of text *--------------------------------------------------------------------* IF lv_tchar EQ '"'. lv_cnt = lv_cnt + 1. lv_numchars = lv_numchars + 1. lv_tchar = iv_reference_formula+lv_cnt(1). WHILE lv_tchar NE '"'. lv_cnt = lv_cnt + 1. lv_numchars = lv_numchars + 1. lv_tchar = iv_reference_formula+lv_cnt(1). ENDWHILE. lv_cnt2 = lv_cnt + 1. lv_substr1 = iv_reference_formula+lv_offset1(lv_numchars). CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. IF lv_cnt = lv_flen. EXIT. ENDIF. lv_offset1 = lv_cnt. lv_numchars = 1. lv_tchar = iv_reference_formula+lv_cnt(1). lv_cnt2 = lv_cnt + 1. CONTINUE. " --> next character in formula can be analyzed ENDIF. *--------------------------------------------------------------------* * Operators or parenthesis or last character in formula will separate possible cellreferences *--------------------------------------------------------------------* IF lv_tchar CA lcv_operators OR lv_tchar CA '():' OR lv_cnt2 = lv_flen. IF lv_cnt > 0. lv_substr1 = iv_reference_formula+lv_offset1(lv_numchars). *--------------------------------------------------------------------* * Check for text concatenation and functions *--------------------------------------------------------------------* IF ( lv_tchar CA lcv_operators AND lv_tchar EQ lv_substr1 ) OR lv_tchar EQ '('. CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_cnt2 = lv_cnt + 1. lv_numchars = 1. CONTINUE. " --> next character in formula can be analyzed ENDIF. lv_tlen = lv_cnt2 - lv_offset1. *--------------------------------------------------------------------* * Exclude mathematical operators and closing parentheses *--------------------------------------------------------------------* IF lv_tchar CA lcv_operators OR lv_tchar CA ':)'. IF lv_cnt2 = lv_flen AND lv_numchars = 1. CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_cnt2 = lv_cnt + 1. lv_numchars = 1. CONTINUE. " --> next character in formula can be analyzed ELSE. lv_tlen = lv_tlen - 1. ENDIF. ENDIF. *--------------------------------------------------------------------* * Capture reference cell address *--------------------------------------------------------------------* TRY. MOVE: iv_reference_formula+lv_offset1(lv_tlen) TO lv_ref_cell_addr. "Ref cell address CATCH cx_root. lv_errormessage = 'Internal error in Class ZCL_EXCEL_COMMON Method SHIFT_FORMULA Spot 1 '. " Change to messageclass if possible zcx_excel=>raise_text( lv_errormessage ). ENDTRY. *--------------------------------------------------------------------* * Split cell address into characters and numbers *--------------------------------------------------------------------* CLEAR: lv_tlen, lv_tcnt, lv_tcol1, lv_trow1. lv_tlen = STRLEN( lv_ref_cell_addr ). IF lv_tlen <> 0. CLEAR: lv_tcnt. DO lv_tlen TIMES. CLEAR: lv_tchar2. lv_tchar2 = lv_ref_cell_addr+lv_tcnt(1). IF lv_tchar2 CA lcv_letters. CONCATENATE lv_tcol1 lv_tchar2 INTO lv_tcol1. ELSEIF lv_tchar2 CA lcv_digits. CONCATENATE lv_trow1 lv_tchar2 INTO lv_trow1. ENDIF. lv_tcnt = lv_tcnt + 1. ENDDO. ENDIF. *--------------------------------------------------------------------* * Check for invalid cell address *--------------------------------------------------------------------* IF lv_tcol1 IS INITIAL OR lv_trow1 IS INITIAL. CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_cnt2 = lv_cnt + 1. lv_numchars = 1. CONTINUE. ENDIF. *--------------------------------------------------------------------* * Check for range names *--------------------------------------------------------------------* CLEAR: lv_tlen. lv_tlen = STRLEN( lv_tcol1 ). IF lv_tlen GT 3. CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_cnt2 = lv_cnt + 1. lv_numchars = 1. CONTINUE. ENDIF. *--------------------------------------------------------------------* * Check for valid row *--------------------------------------------------------------------* IF lv_trow1 GT 1048576. CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_cnt2 = lv_cnt + 1. lv_numchars = 1. CONTINUE. ENDIF. *--------------------------------------------------------------------* * Check for absolute column or row reference *--------------------------------------------------------------------* CLEAR: lv_tcol2, lv_trow2, lv_abscol, lv_absrow. lv_tlen2 = STRLEN( lv_tcol1 ) - 1. IF lv_tcol1 IS NOT INITIAL. lv_abscol = lv_tcol1(1). ENDIF. IF lv_tlen2 GE 0. lv_absrow = lv_tcol1+lv_tlen2(1). ENDIF. IF lv_abscol EQ '$' AND lv_absrow EQ '$'. lv_tlen2 = lv_tlen2 - 1. IF lv_tlen2 > 0. lv_tcol1 = lv_tcol1+1(lv_tlen2). ENDIF. lv_tlen2 = lv_tlen2 + 1. ELSEIF lv_abscol EQ '$'. lv_tcol1 = lv_tcol1+1(lv_tlen2). ELSEIF lv_absrow EQ '$'. lv_tcol1 = lv_tcol1(lv_tlen2). ENDIF. *--------------------------------------------------------------------* * Check for valid column *--------------------------------------------------------------------* TRY. lv_tcoln = zcl_excel_common=>convert_column2int( lv_tcol1 ) + iv_shift_cols. CATCH zcx_excel. CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_cnt2 = lv_cnt + 1. lv_numchars = 1. CONTINUE. ENDTRY. *--------------------------------------------------------------------* * Check whether there is a referencing problem *--------------------------------------------------------------------* lv_trow2 = lv_trow1 + iv_shift_rows. IF ( lv_tcoln < 1 AND lv_abscol <> '$' ) " Maybe we should add here max-column and max row-tests as well. OR ( lv_trow2 < 1 AND lv_absrow <> '$' ). " Check how EXCEL behaves in this case *--------------------------------------------------------------------* * Referencing problem encountered --> set error *--------------------------------------------------------------------* CONCATENATE lv_cur_form lcv_cell_reference_error INTO lv_cur_form. ELSE. *--------------------------------------------------------------------* * No referencing problems --> adjust row and column *--------------------------------------------------------------------* *--------------------------------------------------------------------* * Adjust column *--------------------------------------------------------------------* IF lv_abscol EQ '$'. CONCATENATE lv_cur_form lv_abscol lv_tcol1 INTO lv_cur_form. ELSEIF iv_shift_cols EQ 0. CONCATENATE lv_cur_form lv_tcol1 INTO lv_cur_form. ELSE. TRY. lv_tcol2 = zcl_excel_common=>convert_column2alpha( lv_tcoln ). CONCATENATE lv_cur_form lv_tcol2 INTO lv_cur_form. CATCH zcx_excel. CONCATENATE lv_cur_form lv_substr1 INTO lv_cur_form. lv_cnt = lv_cnt + 1. lv_offset1 = lv_cnt. lv_cnt2 = lv_cnt + 1. lv_numchars = 1. CONTINUE. ENDTRY. ENDIF. *--------------------------------------------------------------------* * Adjust row *--------------------------------------------------------------------* IF lv_absrow EQ '$'. CONCATENATE lv_cur_form lv_absrow lv_trow1 INTO lv_cur_form. ELSEIF iv_shift_rows = 0. CONCATENATE lv_cur_form lv_trow1 INTO lv_cur_form. * elseif lv_trow2 < 1. * CONCATENATE lv_cur_form lc_cell_reference_error INTO lv_cur_form. ELSE. CONCATENATE lv_cur_form lv_trow2 INTO lv_cur_form. ENDIF. ENDIF. lv_numchars = 0. IF lv_tchar CA lcv_operators OR lv_tchar CA ':)'. CONCATENATE lv_cur_form lv_tchar INTO lv_cur_form. ENDIF. lv_offset1 = lv_cnt2. ENDIF. ENDIF. lv_numchars = lv_numchars + 1. lv_cnt = lv_cnt + 1. lv_cnt2 = lv_cnt + 1. ENDDO. *--------------------------------------------------------------------* * Return resulting formula *--------------------------------------------------------------------* IF lv_cur_form IS NOT INITIAL. MOVE lv_cur_form TO ev_resulting_formula. ENDIF. ENDMETHOD. method SHL01. DATA: lv_bit TYPE i, lv_curr_pos TYPE i VALUE 2, lv_prev_pos TYPE i VALUE 1. DO 15 TIMES. GET BIT lv_curr_pos OF i_pwd_hash INTO lv_bit. SET BIT lv_prev_pos OF r_pwd_hash TO lv_bit. ADD 1 TO lv_curr_pos. ADD 1 TO lv_prev_pos. ENDDO. SET BIT 16 OF r_pwd_hash TO 0. endmethod. method SHR14. DATA: lv_bit TYPE i, lv_curr_pos TYPE i, lv_next_pos TYPE i. r_pwd_hash = i_pwd_hash. DO 14 TIMES. lv_curr_pos = 15. lv_next_pos = 16. DO 15 TIMES. GET BIT lv_curr_pos OF r_pwd_hash INTO lv_bit. SET BIT lv_next_pos OF r_pwd_hash TO lv_bit. SUBTRACT 1 FROM lv_curr_pos. SUBTRACT 1 FROM lv_next_pos. ENDDO. SET BIT 1 OF r_pwd_hash TO 0. ENDDO. endmethod. method SPLIT_FILE. DATA: lt_hlp TYPE TABLE OF text255, ls_hlp TYPE text255. DATA: lf_ext(10) TYPE c, lf_dot_ext(10) TYPE c. DATA: lf_anz TYPE i, lf_len TYPE i. ** --------------------------------------------------------------------- CLEAR: lt_hlp, ep_file, ep_extension, ep_dotextension. ** Split the whole file at '.' SPLIT ip_file AT '.' INTO TABLE lt_hlp. ** get the extenstion from the last line of table DESCRIBE TABLE lt_hlp LINES lf_anz. IF lf_anz <= 1. ep_file = ip_file. EXIT. ENDIF. READ TABLE lt_hlp INTO ls_hlp INDEX lf_anz. ep_extension = ls_hlp. lf_ext = ls_hlp. IF NOT lf_ext IS INITIAL. CONCATENATE '.' lf_ext INTO lf_dot_ext. ENDIF. ep_dotextension = lf_dot_ext. ** get only the filename lf_len = strlen( ip_file ) - strlen( lf_dot_ext ). IF lf_len > 0. ep_file = ip_file(lf_len). ENDIF. endmethod. method STRUCTURE_CASE. DATA: lt_comp_str TYPE abap_component_tab. CASE is_component-type->kind. WHEN cl_abap_typedescr=>kind_elem. "E Elementary Type INSERT is_component INTO TABLE xt_components. WHEN cl_abap_typedescr=>kind_table. "T Table INSERT is_component INTO TABLE xt_components. WHEN cl_abap_typedescr=>kind_struct. "S Structure lt_comp_str = structure_recursive( is_component = is_component ). INSERT LINES OF lt_comp_str INTO TABLE xt_components. WHEN OTHERS. "cl_abap_typedescr=>kind_ref or cl_abap_typedescr=>kind_class or cl_abap_typedescr=>kind_intf. * We skip it. for now. ENDCASE. endmethod. method STRUCTURE_RECURSIVE. DATA: lo_struct TYPE REF TO cl_abap_structdescr, lt_components TYPE abap_component_tab, ls_components TYPE abap_componentdescr. REFRESH rt_components. lo_struct ?= is_component-type. lt_components = lo_struct->get_components( ). LOOP AT lt_components INTO ls_components. structure_case( EXPORTING is_component = ls_components CHANGING xt_components = rt_components ) . ENDLOOP. endmethod. method TIME_TO_EXCEL_STRING. DATA: lv_seconds_in_day TYPE i, lv_day_fraction TYPE f, lc_time_baseline TYPE t VALUE '000000', lc_seconds_in_day TYPE i VALUE 86400. lv_seconds_in_day = ip_value - lc_time_baseline. lv_day_fraction = lv_seconds_in_day / lc_seconds_in_day. ep_value = zcl_excel_common=>number_to_excel_string( ip_value = lv_day_fraction ). endmethod. method UNESCAPE_STRING. CONSTANTS lcv_regex TYPE string VALUE `^'[^']` & `|` & " Beginning single ' OR `[^']'$` & `|` & " Trailing single ' OR `[^']'[^']`. " Single ' somewhere in between DATA: lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class *--------------------------------------------------------------------* * This method is used to extract the "real" string from an escaped string. * An escaped string can be identified by a beginning ' which must be * accompanied by a trailing ' * All '' in between beginning and trailing ' are treated as single ' *--------------------------------------------------------------------* *--------------------------------------------------------------------* * When allowing clike-input parameters we might encounter trailing * "real" blanks . These are automatically eliminated when moving * the input parameter to a string. *--------------------------------------------------------------------* ev_unescaped_string = iv_escaped. " Pass through if not escaped CHECK ev_unescaped_string IS NOT INITIAL. " Nothing to do if empty CHECK ev_unescaped_string(1) = `'`. " Nothing to do if not escaped *--------------------------------------------------------------------* * Remove leading and trailing ' *--------------------------------------------------------------------* REPLACE REGEX `^'(.*)'$` IN ev_unescaped_string WITH '$1'. IF sy-subrc <> 0. lv_errormessage = 'Input not properly escaped - &'(002). zcx_excel=>raise_text( lv_errormessage ). ENDIF. *--------------------------------------------------------------------* * Any remaining single ' should not be here *--------------------------------------------------------------------* FIND REGEX lcv_regex IN ev_unescaped_string. IF sy-subrc = 0. lv_errormessage = 'Input not properly escaped - &'(002). zcx_excel=>raise_text( lv_errormessage ). ENDIF. *--------------------------------------------------------------------* * Replace '' with ' *--------------------------------------------------------------------* REPLACE ALL OCCURRENCES OF `''` IN ev_unescaped_string WITH `'`. endmethod. ENDCLASS.
37.855577
140
0.543891
ff2e54348c576fa0b06c541217c59636fab433c7
5,390
abap
ABAP
src/objects/zcl_abapgit_object_enhs.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2020-11-12T17:34:15.000Z
2020-11-12T17:34:15.000Z
src/objects/zcl_abapgit_object_enhs.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2017-10-27T09:32:58.000Z
2017-10-27T09:32:58.000Z
src/objects/zcl_abapgit_object_enhs.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2021-07-09T02:07:11.000Z
2021-07-09T02:07:11.000Z
CLASS zcl_abapgit_object_enhs DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. 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, lx_enh_root TYPE REF TO cx_enh_root, 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 INTO lx_enh_root. zcx_abapgit_exception=>raise_with_text( lx_enh_root ). 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, lx_enh_root TYPE REF TO cx_enh_root, 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( iv_package ). ENDIF. io_xml->read( EXPORTING iv_name = 'TOOL' CHANGING cg_data = lv_tool ). lv_spot_name = ms_item-obj_name. lv_package = iv_package. TRY. cl_enh_factory=>create_enhancement_spot( EXPORTING spot_name = lv_spot_name tooltype = lv_tool dark = abap_false compositename = lv_parent IMPORTING spot = li_spot_ref CHANGING devclass = lv_package ). CATCH cx_enh_root INTO lx_enh_root. zcx_abapgit_exception=>raise_with_text( lx_enh_root ). ENDTRY. li_enhs = factory( lv_tool ). li_enhs->deserialize( ii_xml = io_xml iv_package = iv_package ii_enh_spot_tool = li_spot_ref ). zcl_abapgit_sotr_handler=>create_sotr( iv_package = iv_package io_xml = io_xml ). 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. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. 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_enh_root TYPE REF TO cx_enh_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_enh_root. zcx_abapgit_exception=>raise_with_text( lx_enh_root ). ENDTRY. li_enhs = factory( li_spot_ref->get_tool( ) ). li_enhs->serialize( ii_xml = io_xml ii_enh_spot_tool = li_spot_ref ). zcl_abapgit_sotr_handler=>read_sotr( iv_pgmid = 'R3TR' iv_object = ms_item-obj_type iv_obj_name = ms_item-obj_name io_xml = io_xml ). ENDMETHOD. ENDCLASS.
24.83871
96
0.65102
ff33da4d348fc9434e122e1e110e7c40adbd0b4e
5,566
abap
ABAP
src/zif_io_reader.intf.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
src/zif_io_reader.intf.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
src/zif_io_reader.intf.abap
sandraros/abap-io
8281d5631bed73c411c8e8296944bb98745f9cee
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en">Reader methods</p> "! INTERFACE zif_io_reader PUBLIC . INTERFACES zif_io_close_resource . ALIASES close FOR zif_io_close_resource~close . ALIASES is_closed FOR zif_io_close_resource~is_closed . "! <p class="shorttext synchronized" lang="en">SKIP</p> "! "! @parameter length | <p class="shorttext synchronized" lang="en">LENGTH</p> "! @raising zcx_io_parameter_invalid_range | <p class="shorttext synchronized" lang="en">ZCX_IO_PARAMETER_INVALID_RANGE</p> "! @raising zcx_io_resource_already_closed | <p class="shorttext synchronized" lang="en">ZCX_IO_RESOURCE_ALREADY_CLOSED</p> "! @raising zcx_io_stream_error | <p class="shorttext synchronized" lang="en">ZCX_IO_STREAM_ERROR</p> METHODS skip IMPORTING !length TYPE abap_msize RAISING zcx_io_parameter_invalid_range zcx_io_resource_already_closed zcx_io_stream_error . "! <p class="shorttext synchronized" lang="en">IS_RESET_SUPPORTED</p> "! "! @parameter result | <p class="shorttext synchronized" lang="en">RESULT</p> METHODS is_reset_supported RETURNING VALUE(result) TYPE abap_bool . "! <p class="shorttext synchronized" lang="en">SET_MARK</p> "! "! @raising zcx_io_stream_position_error | <p class="shorttext synchronized" lang="en">ZCX_IO_STREAM_POSITION_ERROR</p> "! @raising zcx_io_resource_already_closed | <p class="shorttext synchronized" lang="en">ZCX_IO_RESOURCE_ALREADY_CLOSED</p> METHODS set_mark RAISING zcx_io_stream_position_error zcx_io_resource_already_closed . "! <p class="shorttext synchronized" lang="en">DELETE_MARK</p> "! "! @raising zcx_io_resource_already_closed | <p class="shorttext synchronized" lang="en">ZCX_IO_RESOURCE_ALREADY_CLOSED</p> METHODS delete_mark RAISING zcx_io_resource_already_closed . "! <p class="shorttext synchronized" lang="en">IS_MARK_SUPPORTED</p> "! "! @parameter res | <p class="shorttext synchronized" lang="en">RES</p> METHODS is_mark_supported RETURNING VALUE(res) TYPE abap_bool . "! <p class="shorttext synchronized" lang="en">RESET_TO_MARK</p> "! "! @raising zcx_io_stream_position_error | <p class="shorttext synchronized" lang="en">ZCX_IO_STREAM_POSITION_ERROR</p> "! @raising zcx_io_resource_already_closed | <p class="shorttext synchronized" lang="en">ZCX_IO_RESOURCE_ALREADY_CLOSED</p> METHODS reset_to_mark RAISING zcx_io_stream_position_error zcx_io_resource_already_closed . "! <p class="shorttext synchronized" lang="en">DATA_AVAILABLE</p> "! "! @parameter available | <p class="shorttext synchronized" lang="en">AVAILABLE</p> "! @raising zcx_io_resource_already_closed | <p class="shorttext synchronized" lang="en">ZCX_IO_RESOURCE_ALREADY_CLOSED</p> "! @raising zcx_io_stream_error | <p class="shorttext synchronized" lang="en">ZCX_IO_STREAM_ERROR</p> METHODS data_available RETURNING VALUE(available) TYPE abap_bool RAISING zcx_io_resource_already_closed zcx_io_stream_error . "! <p class="shorttext synchronized" lang="en">READ</p> "! "! @parameter length | <p class="shorttext synchronized" lang="en">LENGTH</p> "! @parameter read_data | <p class="shorttext synchronized" lang="en">READ_DATA</p> "! @raising zcx_io_parameter_invalid_range | <p class="shorttext synchronized" lang="en">ZCX_IO_PARAMETER_INVALID_RANGE</p> "! @raising zcx_io_parameter_invalid_type | <p class="shorttext synchronized" lang="en">ZCX_IO_PARAMETER_INVALID_TYPE</p> "! @raising zcx_io_resource_already_closed | <p class="shorttext synchronized" lang="en">ZCX_IO_RESOURCE_ALREADY_CLOSED</p> "! @raising zcx_io_stream_error | <p class="shorttext synchronized" lang="en">ZCX_IO_STREAM_ERROR</p> METHODS read IMPORTING !length TYPE abap_msize EXPORTING !read_data TYPE any RAISING zcx_io_parameter_invalid_range zcx_io_parameter_invalid_type zcx_io_resource_already_closed zcx_io_stream_error . "! <p class="shorttext synchronized" lang="en">IS_X_READER</p> "! "! @parameter result | <p class="shorttext synchronized" lang="en">RESULT</p> "! @raising zcx_io_stream_state_error | <p class="shorttext synchronized" lang="en">ZCX_IO_STREAM_STATE_ERROR</p> METHODS is_x_reader RETURNING VALUE(result) TYPE abap_bool RAISING zcx_io_stream_state_error . "! <p class="shorttext synchronized" lang="en">RESET_TO_MARK</p> "! "! @raising zcx_io_stream_position_error | <p class="shorttext synchronized" lang="en">ZCX_IO_STREAM_POSITION_ERROR</p> "! @raising zcx_io_resource_already_closed | <p class="shorttext synchronized" lang="en">ZCX_IO_RESOURCE_ALREADY_CLOSED</p> METHODS reset RAISING zcx_io_resource_already_closed zcx_io_stream_position_error . "! For some types of stream readers, the stream may be automatically closed "! after the last character or byte is read. For example, it's the case of "! database LOB column reader streams (ZCL_IO_DB_C_READER and ZCL_IO_DB_X_READER). "! <p class="shorttext synchronized" lang="en">Stream may be automatically closed</p> "! "! @parameter result | <p class="shorttext synchronized" lang="en">'X' if automatically closed at end of stream</p> METHODS is_auto_close_enabled RETURNING VALUE(result) TYPE abap_bool . ENDINTERFACE.
43.484375
127
0.715595
ff36e3d578ded936531cea2f14e9db4794c3d589
3,357
abap
ABAP
src/objects/zcl_abapgit_object_auth.clas.abap
sb-sap/abapGit
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_auth.clas.abap
sb-sap/abapGit
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_auth.clas.abap
sb-sap/abapGit
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_auth DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. ENDCLASS. CLASS zcl_abapgit_object_auth IMPLEMENTATION. METHOD zif_abapgit_object~changed_by. * looks like "changed by user" is not stored in the database rv_user = c_user_unknown. 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: lv_fieldname TYPE authx-fieldname. lv_fieldname = ms_item-obj_name. * there is a bug in SAP standard, the TADIR entries are not deleted * when the AUTH object is deleted in transaction SU20 CALL FUNCTION 'SUSR_AUTF_DELETE_FIELD' EXPORTING fieldname = lv_fieldname EXCEPTIONS delete_not_possible = 1 field_in_use = 2 not_existing = 3 no_authority = 4 OTHERS = 5. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SUSR_AUTF_DELETE_FIELD' ). ENDIF. ENDMETHOD. "zif_abapgit_object~delete METHOD zif_abapgit_object~deserialize. * see include LSAUT_FIELDF02 DATA: ls_authx TYPE authx, lo_auth TYPE REF TO cl_auth_tools. io_xml->read( EXPORTING iv_name = 'AUTHX' CHANGING cg_data = ls_authx ). CREATE OBJECT lo_auth. IF lo_auth->add_afield_to_trkorr( ls_authx-fieldname ) <> 0. zcx_abapgit_exception=>raise( 'Error deserializing AUTH' ). ENDIF. MODIFY authx FROM ls_authx. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error deserializing AUTH' ). ENDIF. CALL FUNCTION 'DB_COMMIT'. lo_auth->set_authfld_info_from_db( ls_authx-fieldname ). ENDMETHOD. "zif_abapgit_object~deserialize METHOD zif_abapgit_object~exists. DATA: lv_fieldname TYPE authx-fieldname. SELECT SINGLE fieldname FROM authx INTO lv_fieldname WHERE fieldname = ms_item-obj_name. "#EC CI_GENBUFF rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. "zif_abapgit_object~exists METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. "zif_abapgit_object~get_metadata METHOD zif_abapgit_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. "zif_abapgit_object~has_changed_since METHOD zif_abapgit_object~jump. DATA: lv_field TYPE fieldname. lv_field = ms_item-obj_name. * TODO, this function module does not exist in 702 CALL FUNCTION 'SU20_MAINTAIN_SNGL' EXPORTING id_field = lv_field id_wbo_mode = abap_false. ENDMETHOD. "zif_abapgit_object~jump METHOD zif_abapgit_object~serialize. DATA: ls_authx TYPE authx. SELECT SINGLE * FROM authx INTO ls_authx WHERE fieldname = ms_item-obj_name. "#EC CI_GENBUFF IF sy-subrc <> 0. RETURN. ENDIF. io_xml->add( iv_name = 'AUTHX' ig_data = ls_authx ). ENDMETHOD. "zif_abapgit_object~serialize METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. ENDCLASS.
24.326087
96
0.679476
ff381509f920d8c90c85df03295fc003b242aeaa
2,103
abap
ABAP
src/zcl_bw_tools.clas.testclasses.abap
bwabap/bw_toolbox
f548bbb0f466d495268b98f223ef012ddde4cbf8
[ "MIT" ]
25
2018-12-28T06:31:17.000Z
2022-03-29T07:35:13.000Z
src/zcl_bw_tools.clas.testclasses.abap
bwabap/bw_toolbox
f548bbb0f466d495268b98f223ef012ddde4cbf8
[ "MIT" ]
10
2019-01-06T16:14:57.000Z
2020-10-29T10:22:28.000Z
src/zcl_bw_tools.clas.testclasses.abap
bwabap/bw_toolbox
f548bbb0f466d495268b98f223ef012ddde4cbf8
[ "MIT" ]
10
2019-01-05T09:49:57.000Z
2021-05-22T06:16:02.000Z
CLASS ltcl_tools_tesing DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. METHODS: get_eom_test FOR TESTING RAISING cx_static_check, open_file_auth_test FOR TESTING RAISING cx_static_check, remove_whitespaces_test FOR TESTING RAISING cx_static_check, remove_newline_test FOR TESTING RAISING cx_static_check, check_statistics_test FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_tools_tesing IMPLEMENTATION. METHOD get_eom_test. DATA(lv_date_example) = conv sy-datum( '20181129' ). DATA(lv_ceom) = conv sy-datum( '20181130' ). cl_abap_unit_assert=>assert_equals( act = zcl_bw_tools=>get_eom_date( lv_date_example ) exp = lv_ceom ). ENDMETHOD. METHOD open_file_auth_test. cl_abap_unit_assert=>assert_equals( act = zcl_bw_tools=>check_open_file_auth( iv_path = '/usr/sap/NPL/D00/work/available.log' ) exp = abap_true ). ENDMETHOD. METHOD remove_whitespaces_test. cl_abap_unit_assert=>assert_equals( act = zcl_bw_tools=>remove_whitespaces( iv_string = ' test' ) exp = 'test' ). ENDMETHOD. METHOD remove_newline_test. DATA(lv_tsring) = |test{ cl_abap_char_utilities=>newline }|. cl_abap_unit_assert=>assert_equals( act = zcl_bw_tools=>remove_newline( iv_string = lv_tsring ) exp = 'test' ). ENDMETHOD. METHOD check_statistics_test. DATA lt_date TYPE RANGE OF sy-datum. lt_date = VALUE #( ( sign = 'I' option = 'BT' low = '20180101' high = '99999999' ) ). zcl_bw_tools=>check_statistics( EXPORTING it_date = lt_date iv_processchain = 'TEST_PC' iv_variant = 'ZPAK_BY40S1EJACIMADX9V3D2SKQH1' IMPORTING es_stats = DATA(ls_stats) ). cl_abap_unit_assert=>assert_equals( act = ls_stats exp = ls_stats ). ENDMETHOD. ENDCLASS.
28.418919
91
0.631954
ff3af7a4a649c7d2afa274e8c65c5fcb80e9117c
3,258
abap
ABAP
src/zcx_xtt_exception.clas.abap
monty79/xtt
fab2320149a42fa9147836d98570b36a9208bd3e
[ "Apache-2.0" ]
25
2019-03-08T08:03:41.000Z
2021-11-28T20:19:12.000Z
src/zcx_xtt_exception.clas.abap
monty79/xtt
fab2320149a42fa9147836d98570b36a9208bd3e
[ "Apache-2.0" ]
10
2018-02-09T09:54:19.000Z
2021-05-19T07:02:21.000Z
src/zcx_xtt_exception.clas.abap
monty79/xtt
fab2320149a42fa9147836d98570b36a9208bd3e
[ "Apache-2.0" ]
10
2019-03-08T08:03:42.000Z
2021-04-03T12:54:54.000Z
class ZCX_XTT_EXCEPTION definition public inheriting from CX_STATIC_CHECK final create public . public section. *"* public components of class ZCX_XTT_EXCEPTION *"* do not include other source files here!!! interfaces IF_T100_MESSAGE . constants: begin of ZCX_XTT_EXCEPTION, msgid type symsgid value 'ZSY_XTT', msgno type symsgno value '000', attr1 type scx_attrname value 'MSGV1', attr2 type scx_attrname value 'MSGV2', attr3 type scx_attrname value 'MSGV3', attr4 type scx_attrname value 'MSGV4', end of ZCX_XTT_EXCEPTION . data MSGV1 type MSGV1 . data MSGV2 type MSGV2 . data MSGV3 type MSGV3 . data MSGV4 type MSGV4 . methods CONSTRUCTOR importing !TEXTID like IF_T100_MESSAGE=>T100KEY optional !PREVIOUS like PREVIOUS optional !MSGV1 type MSGV1 optional !MSGV2 type MSGV2 optional !MSGV3 type MSGV3 optional !MSGV4 type MSGV4 optional . class-methods RAISE_SYS_ERROR importing !IV_MESSAGE type CSEQUENCE optional value(IO_ERROR) type ref to CX_ROOT optional raising ZCX_XTT_EXCEPTION . class-methods RAISE_DUMP importing !IV_MESSAGE type CSEQUENCE optional !IO_ERROR type ref to CX_ROOT optional . protected section. *"* protected components of class ZCX_XTT_EXCEPTION *"* do not include other source files here!!! private section. *"* private components of class ZCX_XTT_EXCEPTION *"* do not include other source files here!!! ENDCLASS. CLASS ZCX_XTT_EXCEPTION IMPLEMENTATION. method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING PREVIOUS = PREVIOUS . me->MSGV1 = MSGV1 . me->MSGV2 = MSGV2 . me->MSGV3 = MSGV3 . me->MSGV4 = MSGV4 . clear me->textid. if textid is initial. IF_T100_MESSAGE~T100KEY = ZCX_XTT_EXCEPTION . else. IF_T100_MESSAGE~T100KEY = TEXTID. endif. endmethod. METHOD raise_dump. DATA: lv_message TYPE string. IF io_error IS SUPPLIED. lv_message = io_error->get_text( ). ELSE. lv_message = iv_message. ENDIF. MESSAGE lv_message TYPE 'S' DISPLAY LIKE 'E'. MESSAGE lv_message TYPE 'X'. ENDMETHOD. METHOD raise_sys_error. DATA: BEGIN OF ls_string, part1 TYPE symsgv, part2 TYPE symsgv, part3 TYPE symsgv, part4 TYPE symsgv, END OF ls_string. DATA lv_incl TYPE syrepid. DATA lv_line TYPE i. DATA lv_text TYPE string. " From string IF iv_message IS NOT INITIAL. ls_string = iv_message. ENDIF. WHILE ls_string IS INITIAL AND io_error IS NOT INITIAL. ls_string = io_error->get_text( ). " For debug io_error->get_source_position( IMPORTING include_name = lv_incl source_line = lv_line ). " put break-point here ---> { lv_incl } - { lv_line } io_error = io_error->previous. ENDWHILE. " Any error based on system message IF ls_string IS INITIAL. MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO ls_string. ENDIF. " Devided to blocks RAISE EXCEPTION TYPE zcx_xtt_exception EXPORTING textid = zcx_xtt_exception=>zcx_xtt_exception msgv1 = ls_string-part1 msgv2 = ls_string-part2 msgv3 = ls_string-part3 msgv4 = ls_string-part4. ENDMETHOD. ENDCLASS.
23.955882
105
0.707796
ff417b71f27490df7fe3bef503692715031902ad
1,457
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zif_gtt_mia_factory.intf.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
3
2021-07-08T07:16:53.000Z
2021-10-18T07:56:18.000Z
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zif_gtt_mia_factory.intf.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zif_gtt_mia_factory.intf.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
INTERFACE zif_gtt_mia_factory PUBLIC . METHODS get_bo_reader IMPORTING !io_ef_parameters TYPE REF TO zif_gtt_mia_ef_parameters RETURNING VALUE(ro_bo_reader) TYPE REF TO zif_gtt_mia_tp_reader . METHODS get_ef_parameters IMPORTING !iv_appsys TYPE /saptrx/applsystem !is_app_obj_types TYPE /saptrx/aotypes !it_all_appl_tables TYPE trxas_tabcontainer !it_app_type_cntl_tabs TYPE trxas_apptype_tabs OPTIONAL !it_app_objects TYPE trxas_appobj_ctabs RETURNING VALUE(ro_ef_parameters) TYPE REF TO zif_gtt_mia_ef_parameters . METHODS get_ef_processor IMPORTING !is_definition TYPE zif_gtt_mia_ef_types=>ts_definition !io_bo_factory TYPE REF TO zif_gtt_mia_factory !iv_appsys TYPE /saptrx/applsystem !is_app_obj_types TYPE /saptrx/aotypes !it_all_appl_tables TYPE trxas_tabcontainer !it_app_type_cntl_tabs TYPE trxas_apptype_tabs !it_app_objects TYPE trxas_appobj_ctabs RETURNING VALUE(ro_ef_processor) TYPE REF TO zif_gtt_mia_ef_processor RAISING cx_udm_message . METHODS get_pe_filler IMPORTING !io_ef_parameters TYPE REF TO zif_gtt_mia_ef_parameters !io_bo_reader TYPE REF TO zif_gtt_mia_tp_reader RETURNING VALUE(ro_pe_filler) TYPE REF TO zif_gtt_mia_pe_filler RAISING cx_udm_message . ENDINTERFACE.
35.536585
69
0.722032
ff43912e381c9f6f167b788ca5ef8de9fc5d04c4
8,073
abap
ABAP
src/ui/zcl_abapgit_gui_page_bkg.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
1
2020-04-21T04:00:18.000Z
2020-04-21T04:00:18.000Z
src/ui/zcl_abapgit_gui_page_bkg.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
1
2017-10-27T09:32:58.000Z
2017-10-27T09:32:58.000Z
src/ui/zcl_abapgit_gui_page_bkg.clas.abap
Elberet/abapGit
b7b5c2e62e6d029f194b079f6dd94741ec52f4a5
[ "MIT" ]
1
2021-07-09T02:07:11.000Z
2021-07-09T02:07:11.000Z
CLASS zcl_abapgit_gui_page_bkg DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_page FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS constructor IMPORTING iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception. METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION . PROTECTED SECTION. METHODS read_persist IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo_online RETURNING VALUE(rs_persist) TYPE zcl_abapgit_persist_background=>ty_background RAISING zcx_abapgit_exception . METHODS render_methods IMPORTING !is_per TYPE zcl_abapgit_persist_background=>ty_background RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_settings IMPORTING !is_per TYPE zcl_abapgit_persist_background=>ty_background RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS build_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . CLASS-METHODS update IMPORTING !is_bg_task TYPE zcl_abapgit_persist_background=>ty_background RAISING zcx_abapgit_exception . METHODS render RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS decode IMPORTING !iv_getdata TYPE clike RETURNING VALUE(rs_fields) TYPE zcl_abapgit_persist_background=>ty_background . METHODS render_content REDEFINITION . PRIVATE SECTION. DATA mv_key TYPE zif_abapgit_persistence=>ty_repo-key . ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_BKG IMPLEMENTATION. METHOD build_menu. CREATE OBJECT ro_menu. ro_menu->add( iv_txt = 'Run background logic' iv_act = zif_abapgit_definitions=>c_action-go_background_run ). ENDMETHOD. METHOD constructor. super->constructor( ). mv_key = iv_key. ms_control-page_title = 'Background'. ms_control-page_menu = build_menu( ). ENDMETHOD. METHOD decode. DATA: lt_fields TYPE tihttpnvp. FIELD-SYMBOLS: <ls_setting> LIKE LINE OF rs_fields-settings. rs_fields-key = mv_key. lt_fields = zcl_abapgit_html_action_utils=>parse_fields_upper_case_name( iv_getdata ). zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = 'METHOD' it_field = lt_fields CHANGING cg_field = rs_fields ). IF rs_fields-method IS INITIAL. RETURN. ENDIF. zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = 'USERNAME' it_field = lt_fields CHANGING cg_field = rs_fields ). zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = 'PASSWORD' it_field = lt_fields CHANGING cg_field = rs_fields ). CALL METHOD (rs_fields-method)=>zif_abapgit_background~get_settings CHANGING ct_settings = rs_fields-settings. LOOP AT rs_fields-settings ASSIGNING <ls_setting>. zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = <ls_setting>-key it_field = lt_fields CHANGING cg_field = <ls_setting>-value ). ENDLOOP. ASSERT NOT rs_fields IS INITIAL. ENDMETHOD. METHOD read_persist. DATA: lo_per TYPE REF TO zcl_abapgit_persist_background, lt_per TYPE zcl_abapgit_persist_background=>ty_background_keys. CREATE OBJECT lo_per. lt_per = lo_per->list( ). READ TABLE lt_per INTO rs_persist WITH KEY key = io_repo->get_key( ). IF sy-subrc <> 0. CLEAR rs_persist. ENDIF. ENDMETHOD. METHOD render. DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online, ls_per TYPE zcl_abapgit_persist_background=>ty_background. lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( mv_key ). ls_per = read_persist( lo_repo ). CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="toc" class="settings_container">' ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( lo_repo ) ). ri_html->add( '<br>' ). ri_html->add( render_methods( ls_per ) ). ri_html->add( '<u>HTTP Authentication, optional</u><br>' ). ri_html->add( '(password will be saved in clear text)<br>' ). ri_html->add( '<table>' ). ri_html->add( '<tr>' ). ri_html->add( '<td>Username:</td>' ). ri_html->add( '<td><input type="text" name="username" value="' && ls_per-username && '"></td>' ). ri_html->add( '</tr>' ). ri_html->add( '<tr>' ). ri_html->add( '<td>Password:</td>' ). ri_html->add( '<td><input type="text" name="password" value="' && ls_per-password && '"></td>' ). ri_html->add( '</tr>' ). ri_html->add( '</table>' ). ri_html->add( '<br>' ). ri_html->add( render_settings( ls_per ) ). ri_html->add( '<br>' ). ri_html->add( '<input type="submit" value="Save">' ). ri_html->add( '</form>' ). ri_html->add( '<br>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_content. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( render( ) ). ENDMETHOD. METHOD render_methods. DATA: lt_methods TYPE zcl_abapgit_background=>ty_methods, ls_method LIKE LINE OF lt_methods, lv_checked TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. lt_methods = zcl_abapgit_background=>list_methods( ). ri_html->add( '<u>Method</u><br>' ). ri_html->add( |<form method="get" action="sapevent:{ zif_abapgit_definitions=>c_action-bg_update }">| ). IF is_per-method IS INITIAL. lv_checked = ' checked'. ENDIF. ri_html->add( '<input type="radio" name="method" value=""' && lv_checked && '>Do nothing<br>' ). LOOP AT lt_methods INTO ls_method. CLEAR lv_checked. IF is_per-method = ls_method-class. lv_checked = ' checked'. ENDIF. ri_html->add( '<input type="radio" name="method" value="' && ls_method-class && '"' && lv_checked && '>' && ls_method-description && '<br>' ). ENDLOOP. ri_html->add( '<br>' ). ENDMETHOD. METHOD render_settings. DATA: lt_settings LIKE is_per-settings, ls_setting LIKE LINE OF lt_settings. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF is_per-method IS INITIAL. RETURN. ENDIF. lt_settings = is_per-settings. * skip invalid values, from old background logic IF is_per-method <> 'push' AND is_per-method <> 'pull' AND is_per-method <> 'nothing'. CALL METHOD (is_per-method)=>zif_abapgit_background~get_settings CHANGING ct_settings = lt_settings. ENDIF. IF lines( lt_settings ) = 0. RETURN. ENDIF. ri_html->add( '<table>' ). LOOP AT lt_settings INTO ls_setting. ri_html->add( '<tr>' ). ri_html->add( '<td>' && ls_setting-key && ':</td>' ). ri_html->add( '<td><input type="text" name="' && ls_setting-key && '" value="' && ls_setting-value && '"></td>' ). ri_html->add( '</tr>' ). ENDLOOP. ri_html->add( '</table>' ). ENDMETHOD. METHOD update. DATA lo_persistence TYPE REF TO zcl_abapgit_persist_background. CREATE OBJECT lo_persistence. IF is_bg_task-method IS INITIAL. lo_persistence->delete( is_bg_task-key ). ELSE. lo_persistence->modify( is_bg_task ). ENDIF. MESSAGE 'Saved' TYPE 'S'. COMMIT WORK. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA ls_fields TYPE zcl_abapgit_persist_background=>ty_background. CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-bg_update. ls_fields = decode( ii_event->mv_getdata ). update( ls_fields ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN OTHERS. rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ). ENDCASE. ENDMETHOD. ENDCLASS.
24.993808
108
0.649944
ff4642fc5eee7e18c6a006b3766e3f2b0a76a059
15,254
abap
ABAP
src/zcl_mustache_render.clas.abap
DerGuteWolf/abap_mustache
dea46f417d96541c338e9d164a72bbf801c448c3
[ "MIT" ]
null
null
null
src/zcl_mustache_render.clas.abap
DerGuteWolf/abap_mustache
dea46f417d96541c338e9d164a72bbf801c448c3
[ "MIT" ]
null
null
null
src/zcl_mustache_render.clas.abap
DerGuteWolf/abap_mustache
dea46f417d96541c338e9d164a72bbf801c448c3
[ "MIT" ]
null
null
null
class zcl_mustache_render definition public final create public . public section. types: begin of ty_context, tokens type zif_mustache=>ty_token_tt, partials type zif_mustache=>ty_partial_tt, x_format type zif_mustache=>ty_x_format, part_depth type i, end of ty_context . " Max depth of partials recursion, feel free to change for your needs constants c_max_partials_depth type i value 10. "#EC NOTEXT constants: begin of c_data_type, elem type char10 value 'IFPCDNTg', struc type char2 value 'uv', table type char1 value 'h', oref type char1 value 'r', end of c_data_type . class-methods render_section importing !is_statics type ty_context !i_data type any !it_data_stack type zif_mustache=>ty_ref_tt optional !iv_start_idx type i default 1 !iv_path type string default '/' changing !ct_lines type string_table raising zcx_mustache_error . class-methods render_loop importing !is_statics type ty_context !it_data_stack type zif_mustache=>ty_ref_tt !iv_start_idx type i !iv_path type string changing !ct_lines type string_table raising zcx_mustache_error . class-methods find_value importing !iv_name type string !it_data_stack type zif_mustache=>ty_ref_tt returning value(rv_val) type string raising zcx_mustache_error . class-methods find_walker importing !iv_name type string !it_data_stack type zif_mustache=>ty_ref_tt !iv_level type i returning value(rv_ref) type ref to data raising zcx_mustache_error . class-methods eval_condition importing !iv_var type any !iv_cond type zif_mustache=>ty_token-cond returning value(rv_result) type abap_bool raising zcx_mustache_error . class-methods render_oref importing !io_obj type ref to object !iv_tag_name type string optional returning value(rv_val) type string raising zcx_mustache_error . class-methods class_constructor . protected section. private section. class-data: c_ty_struc_tt_absolute_name type abap_abstypename. ENDCLASS. CLASS ZCL_MUSTACHE_RENDER IMPLEMENTATION. method class_constructor. data lt_dummy type zif_mustache=>ty_struc_tt. c_ty_struc_tt_absolute_name = cl_abap_typedescr=>describe_by_data( lt_dummy )->absolute_name. endmethod. "class_constructor method eval_condition. case iv_cond. when zif_mustache=>c_section_condition-if. if iv_var is not initial. rv_result = abap_true. endif. when zif_mustache=>c_section_condition-ifnot. if iv_var is initial. rv_result = abap_true. endif. when others. zcx_mustache_error=>raise( msg = |Unknown condition '{ iv_cond }'| rc = 'UC' ). endcase. endmethod. "eval_condition method find_value. data: lr type ref to data, lv_type type c. field-symbols: <field> type any. lr = find_walker( iv_name = iv_name it_data_stack = it_data_stack iv_level = lines( it_data_stack ) ). " Start from deepest level DATA(t) = cl_abap_datadescr=>describe_by_data_ref( lr ). assign lr->* to <field>. lv_type = cl_abap_datadescr=>get_data_type_kind( <field> ). if lv_type ca c_data_type-elem. " Element data type rv_val = |{ <field> }|. elseif lv_type ca c_data_type-oref. " Object or interface instance rv_val = render_oref( iv_tag_name = iv_name io_obj = <field> ). else. zcx_mustache_error=>raise( msg = |Cannot convert { iv_name } to string| rc = 'CCTS' ). endif. endmethod. " find_value. method find_walker. data: lo_type type ref to cl_abap_typedescr, lv_type type c, lv_found type abap_bool, lv_name_upper type string, lr type ref to data. field-symbols: <field> type any, <struc> type any, <fname> type string, <rec> type zif_mustache=>ty_struc, <table> type any table. lv_name_upper = to_upper( iv_name ). read table it_data_stack into lr index iv_level. assign lr->* to <field>. lv_type = cl_abap_datadescr=>get_data_type_kind( <field> ). unassign <field>. if lv_type ca c_data_type-elem. " Element data type. " Assuming value can happen just at the lowest level " Then just ignore but don't throw an error " it will be found by name in higher context levels " Except special item @tabline " It assumes iterating on table of elements if lv_name_upper = '@TABLINE'. rv_ref = lr. lv_found = abap_true. endif. elseif lv_type ca c_data_type-struc. " Structure assign lr->* to <struc>. assign component lv_name_upper of structure <struc> to <field>. if sy-subrc = 0. " Found get reference of <field> into rv_ref. lv_found = abap_true. endif. elseif lv_type ca c_data_type-table. " Table lo_type = cl_abap_typedescr=>describe_by_data_ref( lr ). if lo_type->absolute_name <> c_ty_struc_tt_absolute_name. zcx_mustache_error=>raise( msg = |Cannot find values in tables other than of ty_struc_tt type| rc = 'WTT' ). endif. assign lr->* to <table>. loop at <table> assigning <rec>. if to_upper( <rec>-name ) = lv_name_upper. lv_found = abap_true. if <rec>-dref is not initial. rv_ref = <rec>-dref. elseif <rec>-oref is not initial. get reference of <rec>-oref into rv_ref. else. get reference of <rec>-val into rv_ref. endif. exit. endif. endloop. else. " Anything else is unsupported zcx_mustache_error=>raise( msg = |Can find values in structures or ty_struc_tt tables only| rc = 'WVT' ). endif. if lv_found <> abap_true. if iv_level > 1. " Search upper levels rv_ref = find_walker( iv_name = iv_name it_data_stack = it_data_stack iv_level = iv_level - 1 ). else. zcx_mustache_error=>raise( msg = |Field '{ iv_name }' not found in supplied data| rc = 'FNF' ). endif. endif. endmethod. "find_walker method render_loop. data: lr type ref to data, ls_statics type ty_context, lv_level type i, lv_idx type i, lt_buf type string_table, lv_has_words type abap_bool, lv_has_tags type abap_bool, lv_last_content_idx type i, lv_val type string. field-symbols: <field> type any, <partial> like line of is_statics-partials, <token> like line of is_statics-tokens. " Rendering loop loop at is_statics-tokens assigning <token> from iv_start_idx. lv_idx = sy-tabix. assert <token>-level > 0. " Protection from programming errors if lv_level = 0. lv_level = <token>-level. " Copy from first record endif. if <token>-level < lv_level. " Reached end of section exit. endif. if <token>-level > lv_level. " Processed by deeper sections continue. endif. if <token>-type <> zif_mustache=>c_token_type-static. lv_has_tags = abap_true. endif. case <token>-type. when zif_mustache=>c_token_type-static. " Static particle if <token>-content = cl_abap_char_utilities=>newline. if lv_has_words = abap_true or lv_has_tags = abap_false or lv_last_content_idx < lines( lt_buf ). " has non-space statics or did not have tags (so empty line is intended) or some tags rendered append lines of lt_buf to ct_lines. append <token>-content to ct_lines. endif. clear: lt_buf, lv_has_words, lv_has_tags, lv_last_content_idx. else. append <token>-content to lt_buf. lv_last_content_idx = lines( lt_buf ). if lv_has_words = abap_false and <token>-content cn ` `. lv_has_words = abap_true. endif. endif. when zif_mustache=>c_token_type-etag or zif_mustache=>c_token_type-utag. " Single tag lv_val = find_value( iv_name = <token>-content it_data_stack = it_data_stack ). if <token>-type = zif_mustache=>c_token_type-etag and is_statics-x_format is not initial. lv_val = escape( val = lv_val format = is_statics-x_format ). endif. append lv_val to lt_buf. when zif_mustache=>c_token_type-section. lr = find_walker( iv_name = <token>-content it_data_stack = it_data_stack iv_level = lines( it_data_stack ) ). " Start from deepest level assign lr->* to <field>. if abap_true = eval_condition( iv_var = <field> iv_cond = <token>-cond ). render_section( exporting is_statics = is_statics it_data_stack = it_data_stack iv_start_idx = lv_idx + 1 i_data = <field> iv_path = iv_path && <token>-content && '/' changing ct_lines = lt_buf ). endif. when zif_mustache=>c_token_type-partial. if is_statics-part_depth = c_max_partials_depth. zcx_mustache_error=>raise( msg = |Max partials depth reached ({ c_max_partials_depth })| rc = 'MPD' ). endif. read table is_statics-partials assigning <partial> with key name = <token>-content. if sy-subrc > 0. zcx_mustache_error=>raise( msg = |Partial '{ <token>-content }' not found| rc = 'PNF' ). endif. ls_statics-tokens = <partial>-obj->get_tokens( ). ls_statics-partials = <partial>-obj->get_partials( ). ls_statics-x_format = is_statics-x_format. ls_statics-part_depth = is_statics-part_depth + 1. render_loop( exporting is_statics = ls_statics it_data_stack = it_data_stack iv_start_idx = 1 " Start from start iv_path = iv_path && '>' && <token>-content && '/' changing ct_lines = lt_buf ). when others. assert 0 = 1. " Cannot reach, programming error endcase. endloop. append lines of lt_buf to ct_lines. endmethod. " render_loop. method render_oref. data lo_type type ref to cl_abap_objectdescr. data ls_meth like line of lo_type->methods. data ls_param like line of ls_meth-parameters. data lv_meth_found type abap_bool. data lv_if type abap_methname. data lv_if_meth type abap_methname. lo_type ?= cl_abap_objectdescr=>describe_by_object_ref( io_obj ). loop at lo_type->methods into ls_meth. split ls_meth-name at '~' into lv_if lv_if_meth. if lv_if = 'RENDER' and lv_if_meth is initial or lv_if_meth = 'RENDER'. lv_meth_found = abap_true. exit. endif. endloop. if lv_meth_found = abap_false. zcx_mustache_error=>raise( msg = |Object does not have render method for tag '{ iv_tag_name }'| rc = 'ODHR' ). endif. read table ls_meth-parameters transporting no fields with key parm_kind = 'I' is_optional = ''. if sy-subrc is initial. zcx_mustache_error=>raise( msg = |Object render() has mandatory params for tag '{ iv_tag_name }'| rc = 'ORMP' ). endif. read table ls_meth-parameters into ls_param with key parm_kind = cl_abap_objectdescr=>returning type_kind = cl_abap_typedescr=>typekind_string. if sy-subrc is not initial. zcx_mustache_error=>raise( msg = |Object render() does not return string for tag '{ iv_tag_name }'| rc = 'ORRS' ). endif. data lt_ptab type abap_parmbind_tab. data ls_ptab like line of lt_ptab. ls_ptab-name = ls_param-name. ls_ptab-kind = cl_abap_objectdescr=>receiving. get reference of rv_val into ls_ptab-value. insert ls_ptab into table lt_ptab. call method io_obj->(ls_meth-name) parameter-table lt_ptab. endmethod. method render_section. data: lr type ref to data, lv_type type c, lv_unitab type abap_bool, lt_data_stack like it_data_stack. lv_type = cl_abap_datadescr=>get_data_type_kind( i_data ). if lv_type ca c_data_type-table and cl_abap_typedescr=>describe_by_data( i_data )->absolute_name = c_ty_struc_tt_absolute_name. lv_unitab = abap_true. elseif lv_type = cl_abap_typedescr=>typekind_oref. data lo_data type ref to zcl_mustache_data. data ls_data_struc type zif_mustache=>ty_struc_tt. try . lo_data ?= i_data. catch cx_sy_move_cast_error ##NO_HANDLER. zcx_mustache_error=>raise( msg = |Cannot render section { iv_path }, wrong data item type| rc = 'CRWD' ). endtry. ls_data_struc = lo_data->get( ). get reference of ls_data_struc into lr. lv_unitab = abap_true. endif. if lv_type ca c_data_type-struc or lv_type ca c_data_type-elem or lv_unitab = abap_true. " Update context lt_data_stack = it_data_stack. if lr is initial. " Not assigned above get reference of i_data into lr. endif. append lr to lt_data_stack. " Input is a structure - one time render render_loop( exporting is_statics = is_statics it_data_stack = lt_data_stack iv_start_idx = iv_start_idx iv_path = iv_path changing ct_lines = ct_lines ). elseif lv_type ca c_data_type-table. " Input is a table - iterate field-symbols <table> type any table. field-symbols <tabline> type any. assign i_data to <table>. loop at <table> assigning <tabline>. render_section( exporting is_statics = is_statics it_data_stack = it_data_stack iv_start_idx = iv_start_idx i_data = <tabline> iv_path = iv_path changing ct_lines = ct_lines ). endloop. else. zcx_mustache_error=>raise( msg = |Cannot render section { iv_path }, wrong data item type| rc = 'CRWD' ). endif. endmethod. " render_section. ENDCLASS.
31.386831
109
0.603448
ff491a523f6f68b0bec13b7f866ea276d24a97b9
13,353
abap
ABAP
src/git/zcl_abapgit_git_transport.clas.abap
psio3123/abapGit
2722adffab67d16551b5ac6a11a037d55651aa56
[ "MIT" ]
1
2021-07-06T02:00:25.000Z
2021-07-06T02:00:25.000Z
src/git/zcl_abapgit_git_transport.clas.abap
sapfans/abapGit
7c32f824df2de4f18b62e7b18f846c3ba31992f5
[ "MIT" ]
29
2021-07-01T01:02:19.000Z
2022-03-01T01:06:16.000Z
src/git/zcl_abapgit_git_transport.clas.abap
wangdongcheng/abapGit
7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_git_transport DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. * remote to local CLASS-METHODS upload_pack_by_branch IMPORTING !iv_url TYPE string !iv_branch_name TYPE string !iv_deepen_level TYPE i DEFAULT 1 !it_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt OPTIONAL EXPORTING !et_objects TYPE zif_abapgit_definitions=>ty_objects_tt !ev_branch TYPE zif_abapgit_definitions=>ty_sha1 RAISING zcx_abapgit_exception . CLASS-METHODS upload_pack_by_commit IMPORTING !iv_url TYPE string !iv_hash TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL !iv_deepen_level TYPE i DEFAULT 0 EXPORTING !et_objects TYPE zif_abapgit_definitions=>ty_objects_tt !ev_commit TYPE zif_abapgit_definitions=>ty_sha1 RAISING zcx_abapgit_exception . * local to remote CLASS-METHODS receive_pack IMPORTING !iv_url TYPE string !iv_old TYPE zif_abapgit_definitions=>ty_sha1 !iv_new TYPE zif_abapgit_definitions=>ty_sha1 !iv_branch_name TYPE string !iv_pack TYPE xstring RAISING zcx_abapgit_exception . CLASS-METHODS branches IMPORTING !iv_url TYPE string RETURNING VALUE(ro_branch_list) TYPE REF TO zcl_abapgit_git_branch_list RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_service, receive TYPE string VALUE 'receive', "#EC NOTEXT upload TYPE string VALUE 'upload', "#EC NOTEXT END OF c_service . CONSTANTS: BEGIN OF c_smart_response_check, BEGIN OF get_refs, content_regex TYPE string VALUE '^[0-9a-f]{4}#', content_type TYPE string VALUE 'application/x-git-<service>-pack-advertisement', END OF get_refs, END OF c_smart_response_check . CLASS-METHODS check_report_status IMPORTING !iv_string TYPE string RAISING zcx_abapgit_exception . CLASS-METHODS branch_list IMPORTING !iv_url TYPE string !iv_service TYPE string EXPORTING !eo_client TYPE REF TO zcl_abapgit_http_client !eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list RAISING zcx_abapgit_exception . CLASS-METHODS find_branch IMPORTING !iv_url TYPE string !iv_service TYPE string !iv_branch_name TYPE string EXPORTING !eo_client TYPE REF TO zcl_abapgit_http_client !ev_branch TYPE zif_abapgit_definitions=>ty_sha1 !eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list RAISING zcx_abapgit_exception . CLASS-METHODS parse EXPORTING !ev_pack TYPE xstring CHANGING !cv_data TYPE xstring RAISING zcx_abapgit_exception . CLASS-METHODS upload_pack IMPORTING !io_client TYPE REF TO zcl_abapgit_http_client !iv_url TYPE string !iv_deepen_level TYPE i DEFAULT 0 !it_hashes TYPE zif_abapgit_definitions=>ty_sha1_tt RETURNING VALUE(rt_objects) TYPE zif_abapgit_definitions=>ty_objects_tt RAISING zcx_abapgit_exception . ENDCLASS. CLASS zcl_abapgit_git_transport IMPLEMENTATION. METHOD branches. DATA: lo_client TYPE REF TO zcl_abapgit_http_client. branch_list( EXPORTING iv_url = iv_url iv_service = c_service-upload IMPORTING eo_client = lo_client eo_branch_list = ro_branch_list ). lo_client->close( ). ENDMETHOD. METHOD branch_list. DATA: lv_data TYPE string. DATA: lv_expected_content_type TYPE string. eo_client = zcl_abapgit_http=>create_by_url( iv_url = iv_url iv_service = iv_service ). lv_expected_content_type = c_smart_response_check-get_refs-content_type. REPLACE '<service>' IN lv_expected_content_type WITH iv_service. eo_client->check_smart_response( iv_expected_content_type = lv_expected_content_type iv_content_regex = c_smart_response_check-get_refs-content_regex ). lv_data = eo_client->get_cdata( ). CREATE OBJECT eo_branch_list EXPORTING iv_data = lv_data. ENDMETHOD. METHOD check_report_status. DATA: lv_string TYPE string, lv_error TYPE string, lv_unpack_status TYPE string, lv_unpack_code TYPE string, lv_unpack_text TYPE string, lv_commnd_status TYPE string, lv_commnd_code TYPE string, lv_commnd_text TYPE string. " Based on https://git-scm.com/docs/pack-protocol/2.2.3#_report_status lv_string = iv_string. IF lv_string = ''. lv_error = 'Unexpected empty reply'. ELSEIF strlen( lv_string ) < 4. lv_error = 'Missing pkt length for unpack status'. ELSE. lv_string = lv_string+4. SPLIT lv_string AT zif_abapgit_definitions=>c_newline INTO lv_unpack_status lv_string. SPLIT lv_unpack_status AT space INTO lv_unpack_text lv_unpack_code. IF lv_unpack_text <> 'unpack'. lv_error = 'Unexpected unpack status'. ELSEIF lv_unpack_code <> 'ok'. lv_error = |Unpack not ok ({ lv_unpack_code })|. ELSEIF lv_string = ''. lv_error = 'Unexpected command status'. ELSEIF strlen( lv_string ) < 4. lv_error = 'Missing pkt length for command status'. ELSE. lv_string = lv_string+4. SPLIT lv_string AT zif_abapgit_definitions=>c_newline INTO lv_commnd_status lv_string. SPLIT lv_commnd_status AT space INTO lv_commnd_code lv_commnd_text. IF lv_commnd_code <> 'ok'. "=ng " Some pre-defined error messages IF lv_commnd_text CP '*pre-receive hook declined*'. lv_error = 'Pre-receive hook declined'. ELSEIF lv_commnd_text CP '*protected branch hook declined*'. lv_error = 'Protected branch hook declined'. ELSEIF lv_commnd_text CP '*push declined due to email privacy*'. lv_error = 'Push declined due to email privacy'. ELSEIF lv_commnd_text CP '*funny refname*'. lv_error = 'Funny refname'. ELSEIF lv_commnd_text CP '*failed to update ref*'. lv_error = 'Failed to update ref'. ELSEIF lv_commnd_text CP '*missing necessary objects*'. lv_error = 'Missing necessary objects'. ELSEIF lv_commnd_text CP '*refusing to delete the current branch*'. lv_error = 'Branch delete not allowed'. ELSEIF lv_commnd_text CP '*cannot lock ref*reference already exists*'. lv_error = 'Branch already exists'. ELSEIF lv_commnd_text CP '*cannot lock ref*but expected*'. lv_error = 'Branch cannot be locked'. ELSEIF lv_commnd_text CP '*invalid committer*'. lv_error = 'Invalid committer'. ELSE. " Otherwise return full error message lv_error = lv_commnd_text. ENDIF. ELSEIF strlen( lv_string ) < 4. lv_error = 'Missing flush-pkt'. ELSEIF lv_string <> '0000' AND lv_string <> '00000000'. " We update only one reference at a time so this should be the end lv_error = 'Unexpected end of status (flush-pkt)'. ENDIF. ENDIF. ENDIF. IF lv_error IS NOT INITIAL. zcx_abapgit_exception=>raise( |Git protocol error: { lv_error }| ). ENDIF. ENDMETHOD. METHOD find_branch. branch_list( EXPORTING iv_url = iv_url iv_service = iv_service IMPORTING eo_client = eo_client eo_branch_list = eo_branch_list ). IF ev_branch IS SUPPLIED. ev_branch = eo_branch_list->find_by_name( iv_branch_name )-sha1. ENDIF. ENDMETHOD. METHOD parse. CONSTANTS: lc_band1 TYPE x VALUE '01'. DATA: lv_len TYPE i, lv_contents TYPE xstring, lv_pack TYPE xstring. WHILE xstrlen( cv_data ) >= 4. lv_len = zcl_abapgit_git_utils=>length_utf8_hex( cv_data ). IF lv_len > xstrlen( cv_data ). zcx_abapgit_exception=>raise( 'parse, string length too large' ). ENDIF. lv_contents = cv_data(lv_len). IF lv_len = 0. cv_data = cv_data+4. CONTINUE. ELSE. cv_data = cv_data+lv_len. ENDIF. lv_contents = lv_contents+4. IF xstrlen( lv_contents ) > 1 AND lv_contents(1) = lc_band1. CONCATENATE lv_pack lv_contents+1 INTO lv_pack IN BYTE MODE. ENDIF. ENDWHILE. ev_pack = lv_pack. ENDMETHOD. METHOD receive_pack. DATA: lo_client TYPE REF TO zcl_abapgit_http_client, lv_cmd_pkt TYPE string, lv_line TYPE string, lv_tmp TYPE xstring, lv_xstring TYPE xstring, lv_string TYPE string, lv_cap_list TYPE string, lv_buffer TYPE string. find_branch( EXPORTING iv_url = iv_url iv_service = c_service-receive iv_branch_name = iv_branch_name IMPORTING eo_client = lo_client ). lo_client->set_headers( iv_url = iv_url iv_service = c_service-receive ). lv_cap_list = 'report-status'. lv_line = iv_old && ` ` && iv_new && ` ` && iv_branch_name && zcl_abapgit_git_utils=>get_null( ) && ` ` && lv_cap_list && zif_abapgit_definitions=>c_newline. lv_cmd_pkt = zcl_abapgit_git_utils=>pkt_string( lv_line ). lv_buffer = lv_cmd_pkt && '0000'. lv_tmp = zcl_abapgit_convert=>string_to_xstring_utf8( lv_buffer ). CONCATENATE lv_tmp iv_pack INTO lv_xstring IN BYTE MODE. lv_xstring = lo_client->send_receive_close( lv_xstring ). lv_string = zcl_abapgit_convert=>xstring_to_string_utf8( lv_xstring ). check_report_status( lv_string ). ENDMETHOD. METHOD upload_pack. DATA: lv_capa TYPE string, lv_line TYPE string, lv_buffer TYPE string, lv_xstring TYPE xstring, lv_pack TYPE xstring. FIELD-SYMBOLS: <lv_hash> LIKE LINE OF it_hashes. io_client->set_headers( iv_url = iv_url iv_service = c_service-upload ). LOOP AT it_hashes FROM 1 ASSIGNING <lv_hash>. IF sy-tabix = 1. lv_capa = 'side-band-64k no-progress multi_ack'. lv_line = 'want' && ` ` && <lv_hash> && ` ` && lv_capa && zif_abapgit_definitions=>c_newline. ELSE. lv_line = 'want' && ` ` && <lv_hash> && zif_abapgit_definitions=>c_newline. ENDIF. lv_buffer = lv_buffer && zcl_abapgit_git_utils=>pkt_string( lv_line ). ENDLOOP. IF iv_deepen_level > 0. lv_buffer = lv_buffer && zcl_abapgit_git_utils=>pkt_string( |deepen { iv_deepen_level }| && zif_abapgit_definitions=>c_newline ). ENDIF. lv_buffer = lv_buffer && '0000' && '0009done' && zif_abapgit_definitions=>c_newline. lv_xstring = io_client->send_receive_close( zcl_abapgit_convert=>string_to_xstring_utf8( lv_buffer ) ). parse( IMPORTING ev_pack = lv_pack CHANGING cv_data = lv_xstring ). IF lv_pack IS INITIAL. zcx_abapgit_exception=>raise( 'Response could not be parsed - empty pack returned.' ). ENDIF. rt_objects = zcl_abapgit_git_pack=>decode( lv_pack ). ENDMETHOD. METHOD upload_pack_by_branch. DATA: lo_client TYPE REF TO zcl_abapgit_http_client, lt_hashes TYPE zif_abapgit_definitions=>ty_sha1_tt. FIELD-SYMBOLS: <ls_branch> LIKE LINE OF it_branches. CLEAR: et_objects, ev_branch. find_branch( EXPORTING iv_url = iv_url iv_service = c_service-upload iv_branch_name = iv_branch_name IMPORTING eo_client = lo_client ev_branch = ev_branch ). IF it_branches IS INITIAL. APPEND ev_branch TO lt_hashes. ELSE. LOOP AT it_branches ASSIGNING <ls_branch>. APPEND <ls_branch>-sha1 TO lt_hashes. ENDLOOP. ENDIF. et_objects = upload_pack( io_client = lo_client iv_url = iv_url iv_deepen_level = iv_deepen_level it_hashes = lt_hashes ). ENDMETHOD. METHOD upload_pack_by_commit. DATA: lo_client TYPE REF TO zcl_abapgit_http_client, lt_hashes TYPE zif_abapgit_definitions=>ty_sha1_tt. CLEAR: et_objects, ev_commit. APPEND iv_hash TO lt_hashes. ev_commit = iv_hash. lo_client = zcl_abapgit_http=>create_by_url( iv_url = iv_url iv_service = c_service-upload ). et_objects = upload_pack( io_client = lo_client iv_url = iv_url iv_deepen_level = iv_deepen_level it_hashes = lt_hashes ). ENDMETHOD. ENDCLASS.
29.872483
107
0.628099
ff49b9be8e5b6d85ef9956100e8fd1a191735408
828
abap
ABAP
src/zcalog.fugr.lzcalogf01.abap
mcfly77/ABAP_LOGGING
9e94256fb848f96e3489b38e771ee58380100846
[ "MIT" ]
null
null
null
src/zcalog.fugr.lzcalogf01.abap
mcfly77/ABAP_LOGGING
9e94256fb848f96e3489b38e771ee58380100846
[ "MIT" ]
null
null
null
src/zcalog.fugr.lzcalogf01.abap
mcfly77/ABAP_LOGGING
9e94256fb848f96e3489b38e771ee58380100846
[ "MIT" ]
null
null
null
*----------------------------------------------------------------------* ***INCLUDE LZCALOGF01. *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Form popup_no_stacktrace *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM popup_no_stacktrace . CALL FUNCTION 'POPUP_TO_INFORM' EXPORTING titel = 'No Stacktrace'(010) " Titelzeile des Dialogfensters txt1 = 'No stacktrace for the log entry'(011) txt2 = ''(012) * txt3 = SPACE * txt4 = SPACE . ENDFORM.
26.709677
72
0.274155
ff4bb3478f457f4c59e0f30b3923ab518bde238e
3,597
abap
ABAP
src/utils/ycl_abapgit_diff.clas.testclasses.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/utils/ycl_abapgit_diff.clas.testclasses.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/utils/ycl_abapgit_diff.clas.testclasses.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
2
2019-11-24T20:35:16.000Z
2020-04-16T07:29:33.000Z
CLASS ltcl_diff DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA: mt_new TYPE TABLE OF string, mt_old TYPE TABLE OF string, mt_expected TYPE yif_abapgit_definitions=>ty_diffs_tt, ms_expected LIKE LINE OF mt_expected. METHODS: setup. METHODS: test. METHODS: diff01 FOR TESTING, diff02 FOR TESTING, diff03 FOR TESTING, diff04 FOR TESTING, diff05 FOR TESTING, diff06 FOR TESTING. ENDCLASS. CLASS ltcl_diff IMPLEMENTATION. DEFINE _new. APPEND &1 TO mt_new. END-OF-DEFINITION. DEFINE _old. APPEND &1 TO mt_old. END-OF-DEFINITION. DEFINE _expected. CLEAR ms_expected. ms_expected-new_num = &1. ms_expected-new = &2. ms_expected-result = &3. ms_expected-old_num = &4. ms_expected-old = &5. APPEND ms_expected TO mt_expected. END-OF-DEFINITION. METHOD setup. CLEAR mt_new. CLEAR mt_old. CLEAR mt_expected. ENDMETHOD. METHOD test. DATA: lv_new TYPE string, lv_xnew TYPE xstring, lv_old TYPE string, lv_xold TYPE xstring, lo_diff TYPE REF TO ycl_abapgit_diff, lt_diff TYPE yif_abapgit_definitions=>ty_diffs_tt. FIELD-SYMBOLS: <ls_diff> LIKE LINE OF lt_diff. CONCATENATE LINES OF mt_new INTO lv_new SEPARATED BY yif_abapgit_definitions=>c_newline. CONCATENATE LINES OF mt_old INTO lv_old SEPARATED BY yif_abapgit_definitions=>c_newline. lv_xnew = ycl_abapgit_convert=>string_to_xstring_utf8( lv_new ). lv_xold = ycl_abapgit_convert=>string_to_xstring_utf8( lv_old ). CREATE OBJECT lo_diff EXPORTING iv_new = lv_xnew iv_old = lv_xold. lt_diff = lo_diff->get( ). LOOP AT lt_diff ASSIGNING <ls_diff>. CLEAR <ls_diff>-short. ENDLOOP. cl_abap_unit_assert=>assert_equals( act = lt_diff exp = mt_expected ). ENDMETHOD. METHOD diff01. * insert _new 'A'. " " NEW " STATUS " OLD _expected 1 'A' yif_abapgit_definitions=>c_diff-insert '' ''. test( ). ENDMETHOD. METHOD diff02. * identical _new 'A'. _old 'A'. " " NEW " STATUS " OLD _expected 1 'A' '' 1 'A'. test( ). ENDMETHOD. METHOD diff03. * delete _old 'A'. " " NEW " STATUS " OLD _expected '' '' yif_abapgit_definitions=>c_diff-delete 1 'A'. test( ). ENDMETHOD. METHOD diff04. * update _new 'A+'. _old 'A'. " " NEW " STATUS " OLD _expected 1 'A+' yif_abapgit_definitions=>c_diff-update 1 'A'. test( ). ENDMETHOD. METHOD diff05. * identical _new 'A'. _new 'B'. _old 'A'. _old 'B'. " " NEW " STATUS " OLD _expected 1 'A' '' 1 'A'. _expected 2 'B' '' 2 'B'. test( ). ENDMETHOD. METHOD diff06. _new 'A'. _new 'B'. _new 'inserted'. _new 'C'. _new 'D update'. _old 'A'. _old 'B'. _old 'C'. _old 'D'. " " NEW " STATUS " OLD _expected 1 'A' '' 1 'A'. _expected 2 'B' '' 2 'B'. _expected 3 'inserted' yif_abapgit_definitions=>c_diff-insert '' ''. _expected 4 'C' '' 3 'C'. _expected 5 'D update' yif_abapgit_definitions=>c_diff-update 4 'D'. test( ). ENDMETHOD. ENDCLASS.
20.791908
92
0.560467
ff5208621e2b3942817c4aa188496a416e311fa3
931
abap
ABAP
src/data/zcl_csr_8859_2_hu.clas.abap
sandraros/abap-CSR
8023f26fa8764f389e90f8a546e00fcc1b5d9c75
[ "MIT" ]
1
2020-01-10T03:29:48.000Z
2020-01-10T03:29:48.000Z
src/data/zcl_csr_8859_2_hu.clas.abap
sandraros/abap-CSR
8023f26fa8764f389e90f8a546e00fcc1b5d9c75
[ "MIT" ]
null
null
null
src/data/zcl_csr_8859_2_hu.clas.abap
sandraros/abap-CSR
8023f26fa8764f389e90f8a546e00fcc1b5d9c75
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en">Hungarian</p> "! CLASS zcl_csr_8859_2_hu DEFINITION PUBLIC INHERITING FROM zcl_csr_8859_2 CREATE PUBLIC . PUBLIC SECTION. METHODS constructor . METHODS get_language REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_csr_8859_2_hu IMPLEMENTATION. METHOD constructor. super->constructor( ). CONCATENATE '20612020617A20626520656720656C20666520686120686F206973206B65206B69206BF6206C65206D61206D65206D69' '206E6520737A20746520E97361206161206B61206D612073616B20616E20617A2062616E62656E656779656B20656C20' '656C65656D20656E20657265657420657465657474677920686F67696E746973206B20616BF67A6D65676D696E6E2061' '6E616B6E656B6E656D6E74206F6779732061737A65737A74737AE173E96774206174742074E1737A6572E16E20E97320' INTO ngrams. ENDMETHOD. METHOD get_language. language = 'hu'. ENDMETHOD. ENDCLASS.
21.159091
102
0.804511
ff548524660c6e2e04ee8f4da792ab52b570048a
6,237
abap
ABAP
src/zaps_parameter/zcl_aps_parameterset_report.clas.testclasses.abap
BiberM/ABAPParallelizationService
d0fca92dfe05456e73fadafd8763b7953e49eb57
[ "MIT" ]
7
2021-09-13T20:09:13.000Z
2022-02-11T18:22:07.000Z
src/zaps_parameter/zcl_aps_parameterset_report.clas.testclasses.abap
BiberM/ABAPParallelizationService
d0fca92dfe05456e73fadafd8763b7953e49eb57
[ "MIT" ]
8
2021-10-03T16:40:59.000Z
2022-01-23T21:06:37.000Z
src/zaps_parameter/zcl_aps_parameterset_report.clas.testclasses.abap
BiberM/ABAPParallelizationService
d0fca92dfe05456e73fadafd8763b7953e49eb57
[ "MIT" ]
1
2021-12-22T16:56:37.000Z
2021-12-22T16:56:37.000Z
*"* use this source file for your ABAP unit test classes class ltcl_parameterset_report definition deferred. class zcl_aps_parameterset_report definition local friends ltcl_parameterset_report. class ltcl_parameterset_report definition final for testing duration short risk level harmless. private section. data: settings type ref to ztd_aps_settings, cut type ref to zcl_aps_parameterset_report. methods: setup, addParameterValid for testing raising cx_static_check, addParameterInvalid for testing raising cx_static_check, addSelectOptionValid for testing raising cx_static_check, addSelectOptionAllInvalid for testing raising cx_static_check, addSelectOptionPartInvalid for testing raising cx_static_check, executeValidCall for testing raising cx_static_check. endclass. class ltcl_parameterset_report implementation. method addparameterinvalid. " given data(parameterValue) = conv char14( 'AB1' ). " when try. cut->zif_aps_parameterset_report~addparameter( i_parametername = 'INVALID' i_parametervalue = conv #( parameterValue ) ). catch zcx_aps_unknown_parameter. " exactly what we expect return. endtry. cl_abap_unit_assert=>fail( 'invalid parameter not found' ). endmethod. method addparametervalid. " given data(parameterValue) = conv char14( 'AB1' ). " when try. cut->zif_aps_parameterset_report~addparameter( i_parametername = 'PARAMET' i_parametervalue = conv #( parameterValue ) ). catch zcx_aps_unknown_parameter. cl_abap_unit_assert=>fail( 'add valid parameter failed' ). endtry. " then cl_abap_unit_assert=>assert_equals( act = lines( cut->selections ) exp = 1 ). cl_abap_unit_assert=>assert_equals( act = cut->selections[ 1 ]-low exp = parameterValue ). endmethod. method addselectoptionallinvalid. " given data(selectOption) = value rotselect( ( fieldnm = 'IAMINVALID' sign = 'I' option = 'BT' low = 42 high = 1337 ) ). " when try. cut->zif_aps_parameterset_report~addSelectOption( selectOption ). catch zcx_aps_unknown_parameter. " exactly what we expect return. endtry. " Invalid Select Option not found --> error! cl_abap_unit_assert=>fail( msg = 'Invalid Select Option not found' quit = if_abap_unit_constant=>quit-no ). cl_abap_unit_assert=>assert_initial( cut->selections ). endmethod. method addselectoptionpartinvalid. " given data(selectOption) = value rotselect( ( fieldnm = 'SELECTO' sign = 'I' option = 'BT' low = 42 high = 1337 ) ( fieldnm = 'IAMINVALID' sign = 'I' option = 'BT' low = 42 high = 1337 ) ). " when try. cut->zif_aps_parameterset_report~addSelectOption( selectOption ). catch zcx_aps_unknown_parameter. " exactly what we expect return. endtry. " Invalid Select Option not found --> error! cl_abap_unit_assert=>fail( msg = 'Invalid Select Option not found' quit = if_abap_unit_constant=>quit-no ). cl_abap_unit_assert=>assert_initial( cut->selections ). endmethod. method addselectoptionvalid. " given data(selectOption) = value rotselect( fieldnm = 'SELECTO' sign = 'I' option = 'BT' ( low = 0 high = 42 ) ( low = 1337 high = 31337 ) ). " when try. cut->zif_aps_parameterset_report~addSelectOption( selectOption ). catch zcx_aps_unknown_parameter. cl_abap_unit_assert=>fail( 'add valid select option failed' ). endtry. " then cl_abap_unit_assert=>assert_equals( act = lines( cut->selections ) exp = 2 ). endmethod. method executevalidcall. " given try. cut->zif_aps_parameterset_report~addparameter( i_parametername = 'PARAMET' i_parametervalue = 'ABC' ). cut->zif_aps_parameterset_report~addselectoption( value rotselect( fieldnm = 'SELECTO' sign = 'I' option = 'BT' ( low = 0 high = 42 ) ( low = 1337 high = 31337 ) ) ). catch zcx_aps_unknown_parameter. cl_abap_unit_assert=>fail( 'Error setting selection screen data' ). endtry. data(selectionScreenData) = cut->zif_aps_parameterset_report~getSelectionsTable( ). data(reportName) = settings->zif_aps_settings~getNameOfExecutable( ). submit (reportName) with selection-table selectionScreenData and return. endmethod. method setup. settings = new #( ). settings->setAppDefinition( value #( appid = 'UNITTEST' typeofexecutable = 'R' nameofexecutable = 'DEMO_PROGRAM_SUBMIT_REP' ) ). try. cut = new #( settings ). catch zcx_aps_unknown_executable. cl_abap_unit_assert=>fail( 'Please execute demo report DEMO_PROGRAM_SUBMIT_REP once to generate selection screen' ). endtry. endmethod. endclass.
27.96861
122
0.541126
ff557b2f2e5ffb026a1fcd9e819dffdecb968adf
6,750
abap
ABAP
src/checks/zcl_aoc_check_25.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
199
2015-02-17T07:08:01.000Z
2022-03-23T09:50:05.000Z
src/checks/zcl_aoc_check_25.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
769
2015-01-03T07:09:11.000Z
2022-03-21T11:59:53.000Z
src/checks/zcl_aoc_check_25.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
109
2015-03-09T10:22:34.000Z
2022-03-08T08:47:41.000Z
CLASS zcl_aoc_check_25 DEFINITION PUBLIC INHERITING FROM zcl_aoc_super CREATE PUBLIC . PUBLIC SECTION. METHODS constructor . METHODS check REDEFINITION . METHODS get_attributes REDEFINITION . METHODS if_ci_test~query_attributes REDEFINITION . METHODS put_attributes REDEFINITION . PROTECTED SECTION. TYPES: BEGIN OF ty_field, name TYPE string, level TYPE i, row TYPE token_row, END OF ty_field . TYPES: ty_fields_tt TYPE STANDARD TABLE OF ty_field WITH NON-UNIQUE DEFAULT KEY . DATA mv_skip_radio TYPE sychar01 . METHODS strip IMPORTING !iv_input TYPE string RETURNING VALUE(rv_output) TYPE string . METHODS analyze IMPORTING !io_scan TYPE REF TO zcl_aoc_scan !it_fields TYPE ty_fields_tt . METHODS find_fields IMPORTING !it_tokens TYPE stokesx_tab !it_statements TYPE sstmnt_tab RETURNING VALUE(rt_fields) TYPE ty_fields_tt . PRIVATE SECTION. ENDCLASS. CLASS ZCL_AOC_CHECK_25 IMPLEMENTATION. METHOD analyze. * this might not be 100% correct but will work for most cases DATA: lv_include TYPE program, lv_name TYPE string, lt_fields LIKE it_fields. FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements, <ls_field> LIKE LINE OF it_fields, <ls_token> LIKE LINE OF io_scan->tokens. lt_fields = it_fields. LOOP AT io_scan->statements ASSIGNING <ls_statement>. LOOP AT io_scan->tokens ASSIGNING <ls_token> FROM <ls_statement>-from TO <ls_statement>-to WHERE type <> io_scan->gc_token-comment AND type <> io_scan->gc_token-literal. lv_name = strip( <ls_token>-str ). DELETE lt_fields WHERE name = lv_name AND ( row <> <ls_token>-row OR level <> <ls_statement>-level ). ENDLOOP. ENDLOOP. LOOP AT lt_fields ASSIGNING <ls_field>. lv_include = io_scan->get_include( <ls_field>-level ). inform( p_sub_obj_name = lv_include p_line = <ls_field>-row p_kind = mv_errty p_test = myname p_code = '001' p_param_1 = <ls_field>-name ). ENDLOOP. ENDMETHOD. METHOD check. * abapOpenChecks * https://github.com/larshp/abapOpenChecks * MIT License DATA: lt_fields TYPE ty_fields_tt. lt_fields = find_fields( it_tokens = io_scan->tokens it_statements = io_scan->statements ). analyze( io_scan = io_scan it_fields = lt_fields ). ENDMETHOD. METHOD constructor. super->constructor( ). version = '001'. position = '025'. has_attributes = abap_true. attributes_ok = abap_true. enable_rfc( ). mv_skip_radio = abap_true. insert_scimessage( iv_code = '001' iv_text = '&1 not referenced statically'(m01) ). ENDMETHOD. METHOD find_fields. DATA: lv_keyword TYPE string, lt_code TYPE string_table, ls_result TYPE zcl_aoc_parser=>ty_result, ls_field LIKE LINE OF rt_fields, lv_statement TYPE string. FIELD-SYMBOLS: <ls_statement> LIKE LINE OF it_statements, <ls_rt> LIKE LINE OF ls_result-tokens, <ls_token> LIKE LINE OF it_tokens. LOOP AT it_statements ASSIGNING <ls_statement> WHERE type = zcl_aoc_scan=>gc_statement-standard. CLEAR lv_keyword. CLEAR lv_statement. LOOP AT it_tokens ASSIGNING <ls_token> FROM <ls_statement>-from TO <ls_statement>-to WHERE type <> zcl_aoc_scan=>gc_token-comment. IF lv_keyword IS INITIAL. lv_keyword = <ls_token>-str. ENDIF. IF lv_statement IS INITIAL. lv_statement = <ls_token>-str. ELSE. CONCATENATE lv_statement <ls_token>-str INTO lv_statement SEPARATED BY space. ENDIF. ENDLOOP. IF lv_keyword <> 'PARAMETERS' AND lv_keyword <> 'PARAMETER' AND lv_keyword <> 'SELECT-OPTIONS'. CONTINUE. " current loop ENDIF. CLEAR lt_code. APPEND lv_statement TO lt_code. ls_result = zcl_aoc_parser=>run( it_code = lt_code iv_rule = lv_keyword ). IF ls_result-match = abap_false. CONTINUE. ENDIF. LOOP AT ls_result-tokens ASSIGNING <ls_rt> WHERE value = zcl_aoc_parser=>c_role-fielddefid AND type = zcl_aoc_parser=>c_type-role. IF mv_skip_radio = abap_true. READ TABLE ls_result-tokens WITH KEY type = zcl_aoc_parser=>c_type-terminal code = 'RADIOBUTTON' TRANSPORTING NO FIELDS. IF sy-subrc = 0. CONTINUE. ENDIF. ENDIF. CLEAR ls_field. ls_field-name = strip( <ls_rt>-code ). ls_field-level = <ls_statement>-level. ls_field-row = <ls_token>-row. APPEND ls_field TO rt_fields. ENDLOOP. ENDLOOP. ENDMETHOD. METHOD get_attributes. EXPORT mv_errty = mv_errty mv_skip_radio = mv_skip_radio TO DATA BUFFER p_attributes. ENDMETHOD. METHOD if_ci_test~query_attributes. zzaoc_top. zzaoc_fill_att mv_errty 'Error Type' ''. "#EC NOTEXT zzaoc_fill_att mv_skip_radio 'Skip radio buttons' 'C'. "#EC NOTEXT zzaoc_popup. ENDMETHOD. METHOD put_attributes. IMPORT mv_errty = mv_errty mv_skip_radio = mv_skip_radio FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED ASSERT sy-subrc = 0. ENDMETHOD. METHOD strip. DATA: lv_offset TYPE i, lv_length TYPE i. rv_output = iv_input. FIND FIRST OCCURRENCE OF '[' IN rv_output MATCH OFFSET lv_offset. IF sy-subrc = 0. rv_output = rv_output(lv_offset). ENDIF. FIND FIRST OCCURRENCE OF '+' IN rv_output MATCH OFFSET lv_offset. IF sy-subrc = 0. rv_output = rv_output(lv_offset). ENDIF. lv_length = strlen( rv_output ) - 1. IF strlen( rv_output ) > 1 AND rv_output(1) = '(' AND rv_output+lv_length(1) = ')'. lv_length = lv_length - 1. rv_output = rv_output+1(lv_length). ELSE. FIND FIRST OCCURRENCE OF '(' IN rv_output MATCH OFFSET lv_offset. IF sy-subrc = 0. rv_output = rv_output(lv_offset). ENDIF. ENDIF. IF strlen( rv_output ) > 1 AND rv_output(1) = '@'. rv_output = rv_output+1. ENDIF. ENDMETHOD. ENDCLASS.
24.107143
87
0.607111
ff5aa6e296805f0ef70225f01efa82864b7bc56b
2,710
abap
ABAP
src/zcl_security_cc_problem_1.clas.testclasses.abap
se38/devtoberfest-2021-security-coding-challenge
c22e2a1132d5b01b4060b30b3fbd4e7d934894ee
[ "Apache-2.0" ]
null
null
null
src/zcl_security_cc_problem_1.clas.testclasses.abap
se38/devtoberfest-2021-security-coding-challenge
c22e2a1132d5b01b4060b30b3fbd4e7d934894ee
[ "Apache-2.0" ]
null
null
null
src/zcl_security_cc_problem_1.clas.testclasses.abap
se38/devtoberfest-2021-security-coding-challenge
c22e2a1132d5b01b4060b30b3fbd4e7d934894ee
[ "Apache-2.0" ]
null
null
null
"* use this source file for your ABAP unit test classes CLASS ltcl_test_problem_1 DEFINITION DEFERRED. CLASS zcl_security_cc_problem_1 DEFINITION LOCAL FRIENDS ltcl_test_problem_1. CLASS ltcl_test_problem_1 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. TYPES tt_flights TYPE STANDARD TABLE OF /dmo/flight WITH EMPTY KEY. DATA cut TYPE REF TO zcl_security_cc_problem_1. CLASS-DATA osql TYPE REF TO if_osql_test_environment. CLASS-METHODS class_setup. CLASS-METHODS class_teardown. METHODS setup. METHODS test_select_valid_input FOR TESTING RAISING cx_static_check. METHODS test_select_invalid_input FOR TESTING RAISING cx_static_check. ENDCLASS. CLASS ltcl_test_problem_1 IMPLEMENTATION. METHOD test_select_valid_input. TRY. cut->update_flights( i_carrierid = 'AA' i_connectionid = '0018' i_seatsmax = '245' ). cl_abap_unit_assert=>assert_equals( act = cut->select_flights( i_carrierid = 'AA' i_connectionid = '0018' ) exp = VALUE tt_flights( ( client ='001' carrier_id ='AA' connection_id ='0018' flight_date ='20191122' price ='3823.00 ' currency_code ='USD' plane_type_id ='767-200' seats_max ='245' seats_occupied ='247' ) ) ). CATCH cx_abap_not_an_integer INTO DATA(lcx). cl_abap_unit_assert=>fail( lcx->get_text( ) ). ENDTRY. ENDMETHOD. METHOD test_select_invalid_input. TRY. cut->update_flights( i_carrierid = 'AA' i_connectionid = '0018' i_seatsmax = `142', PRICE = '1` ). cl_abap_unit_assert=>fail( 'Method should throw an exception' ) ##no_text. CATCH cx_abap_not_an_integer INTO DATA(lcx). cl_abap_unit_assert=>assert_equals( act = lcx->get_text( ) exp = `142', PRICE = '1 is not a valid integer.` ) ##no_text. ENDTRY. ENDMETHOD. METHOD class_setup. osql = cl_osql_test_environment=>create( VALUE #( ( '/DMO/FLIGHT' ) ) ). DATA(flights) = VALUE tt_flights( ( client ='001' carrier_id ='AA' connection_id ='0018' flight_date ='20191122' price ='3823.00 ' currency_code ='USD' plane_type_id ='767-200' seats_max ='260' seats_occupied ='247' ) ( client ='001' carrier_id ='AZ' connection_id ='0788' flight_date ='20200919' price ='7580.00 ' currency_code ='EUR' plane_type_id ='767-200' seats_max ='260' seats_occupied ='221' ) ). osql->insert_test_data( flights ). ENDMETHOD. METHOD class_teardown. osql->destroy( ). ENDMETHOD. METHOD setup. cut = NEW #( ). ENDMETHOD. ENDCLASS.
31.149425
202
0.6631
ff5b0a0e2b012f37d1ad74552b999a08e9b3ab12
3,549
abap
ABAP
src/zcl_cct_i_fed_state_m.clas.locals_imp.abap
soschlegel/CoronaContactTracing
1bc844fefba896a7f39d366980b77c6b09bfd6ee
[ "Apache-2.0" ]
null
null
null
src/zcl_cct_i_fed_state_m.clas.locals_imp.abap
soschlegel/CoronaContactTracing
1bc844fefba896a7f39d366980b77c6b09bfd6ee
[ "Apache-2.0" ]
null
null
null
src/zcl_cct_i_fed_state_m.clas.locals_imp.abap
soschlegel/CoronaContactTracing
1bc844fefba896a7f39d366980b77c6b09bfd6ee
[ "Apache-2.0" ]
2
2020-11-22T14:01:47.000Z
2020-11-23T18:19:35.000Z
CLASS lhc_ZCCT_M_FED_STATE DEFINITION INHERITING FROM cl_abap_behavior_handler. PRIVATE SECTION. CONSTANTS: BEGIN OF country_unknown, msgid TYPE symsgid VALUE 'ZCCT_FED_STATE', msgno TYPE symsgno VALUE '001', END OF country_unknown, BEGIN OF fedState_empty_name, msgid TYPE symsgid VALUE 'ZCCT_FED_STATE', msgno TYPE symsgno VALUE '002', END OF fedState_empty_name. METHODS validateCountryKey FOR VALIDATE ON SAVE IMPORTING keys FOR zcct_m_fed_state~validateCountryKey. METHODS validateFedStateName FOR VALIDATE ON SAVE IMPORTING keys FOR zcct_m_fed_state~validateFedStateName. ENDCLASS. CLASS lhc_ZCCT_M_FED_STATE IMPLEMENTATION. METHOD validateCountryKey. READ ENTITY zcct_m_fed_state\\zcct_m_fed_state FROM VALUE #( FOR <root_key> IN keys ( %key-id = <root_key>-id %control = VALUE #( countryid = if_abap_behv=>mk-on ) ) ) RESULT DATA(lt_fedState). DATA lt_country TYPE SORTED TABLE OF I_Country WITH UNIQUE KEY Country. " Optimization of DB select: extract distinct non-initial country ids lt_country = CORRESPONDING #( lt_fedState DISCARDING DUPLICATES MAPPING Country = countryid EXCEPT * ). DELETE lt_country WHERE Country IS INITIAL. CHECK lt_country IS NOT INITIAL. " Check if customer ID exist SELECT FROM I_Country FIELDS Country FOR ALL ENTRIES IN @lt_country WHERE Country = @lt_country-Country INTO TABLE @DATA(lt_country_db). " Raise msg for non existing customer id LOOP AT lt_fedState INTO DATA(ls_fedState). IF ls_fedState-countryid IS NOT INITIAL AND NOT line_exists( lt_country_db[ Country = ls_fedState-countryid ] ). APPEND VALUE #( id = ls_fedState-countryid ) TO failed-zcct_m_fed_state. APPEND VALUE #( id = ls_fedState-countryid %msg = new_message( id = country_unknown-msgid number = country_unknown-msgno v1 = ls_fedState-countryid severity = if_abap_behv_message=>severity-error ) %element-countryid = if_abap_behv=>mk-on ) TO reported-zcct_m_fed_state. ENDIF. ENDLOOP. ENDMETHOD. METHOD validateFedStateName. READ ENTITY zcct_m_fed_state\\zcct_m_fed_state FROM VALUE #( FOR <root_key> IN keys ( %key-id = <root_key>-id %control = VALUE #( countryid = if_abap_behv=>mk-on ) ) ) RESULT DATA(lt_fedState). DATA lt_name TYPE SORTED TABLE OF zcct_i_fed_state WITH UNIQUE KEY name. lt_name = CORRESPONDING #( lt_fedState DISCARDING DUPLICATES MAPPING name = name EXCEPT * ). DELETE lt_name WHERE name IS INITIAL. CHECK lt_name IS INITIAL. LOOP AT lt_fedState INTO DATA(ls_fedState). APPEND VALUE #( id = ls_fedState-id ) TO failed-zcct_m_fed_state. APPEND VALUE #( id = ls_fedState-id %msg = new_message( id = fedState_empty_name-msgid number = fedState_empty_name-msgno v1 = ls_fedState-id severity = if_abap_behv_message=>severity-error ) %element-name = if_abap_behv=>mk-on ) TO reported-zcct_m_fed_state. ENDLOOP. ENDMETHOD. ENDCLASS.
41.752941
118
0.626655
ff5b529a31a22f40b3eb5b30d8bae4bb710c758a
709
abap
ABAP
kapitel_21/zbook_http.fugr.saplzbook_http.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
12
2018-06-22T10:55:06.000Z
2022-03-22T12:10:48.000Z
kapitel_21/zbook_http.fugr.saplzbook_http.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
5
2018-06-25T11:45:26.000Z
2019-09-04T19:41:55.000Z
kapitel_21/zbook_http.fugr.saplzbook_http.abap
abapkochbuch/Sources
159775b787fcbc4c6b7eff01e505144b7c33a437
[ "MIT" ]
7
2018-07-02T14:20:28.000Z
2022-03-25T19:33:33.000Z
******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE LZBOOK_HTTPTOP. " Global Data INCLUDE LZBOOK_HTTPUXX. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LZBOOK_HTTPF... " Subprograms * INCLUDE LZBOOK_HTTPO... " PBO-Modules * INCLUDE LZBOOK_HTTPI... " PAI-Modules
54.538462
67
0.301834
ff5b5b2ae3bd2a3e9dcdb60c5cfb0f4e28dd8987
966
abap
ABAP
src/gui/zmqba_gui_widget.fugr.saplzmqba_gui_widget.abap
gregorwolf/MQBA
336adbbb0d2db9d103bdb97b75552a533557d43d
[ "MIT" ]
10
2018-08-29T07:07:26.000Z
2021-07-09T06:27:04.000Z
src/gui/zmqba_gui_widget.fugr.saplzmqba_gui_widget.abap
gregorwolf/MQBA
336adbbb0d2db9d103bdb97b75552a533557d43d
[ "MIT" ]
6
2018-08-29T11:01:54.000Z
2019-02-16T15:14:11.000Z
src/gui/zmqba_gui_widget.fugr.saplzmqba_gui_widget.abap
gregorwolf/MQBA
336adbbb0d2db9d103bdb97b75552a533557d43d
[ "MIT" ]
7
2018-08-29T11:34:34.000Z
2020-06-22T04:16:22.000Z
******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE LZMQBA_GUI_WIDGETTOP. " Global Declarations INCLUDE LZMQBA_GUI_WIDGETUXX. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LZMQBA_GUI_WIDGETF... " Subroutines * INCLUDE LZMQBA_GUI_WIDGETO... " PBO-Modules * INCLUDE LZMQBA_GUI_WIDGETI... " PAI-Modules * INCLUDE LZMQBA_GUI_WIDGETE... " Events * INCLUDE LZMQBA_GUI_WIDGETP... " Local class implement. * INCLUDE LZMQBA_GUI_WIDGETT99. " ABAP Unit tests INCLUDE lzmqba_gui_widgeto01. INCLUDE lzmqba_gui_widgeti01.
48.3
69
0.435818
ff6165cf802c447963240bafc02adc0b173a6f88
1,761
abap
ABAP
src/ydklist.fugr.ydk_list_for_form.abap
DKiyanov/YDK_LIST
06095ca2ee6fe5ced7f582f007fcfaf1a4e79d85
[ "MIT" ]
null
null
null
src/ydklist.fugr.ydk_list_for_form.abap
DKiyanov/YDK_LIST
06095ca2ee6fe5ced7f582f007fcfaf1a4e79d85
[ "MIT" ]
null
null
null
src/ydklist.fugr.ydk_list_for_form.abap
DKiyanov/YDK_LIST
06095ca2ee6fe5ced7f582f007fcfaf1a4e79d85
[ "MIT" ]
null
null
null
FUNCTION YDK_LIST_FOR_FORM. *"---------------------------------------------------------------------- *"*"Локальный интерфейс: *" IMPORTING *" REFERENCE(CALLBACK_PROGRAM) TYPE CLIKE OPTIONAL *" REFERENCE(CALLBACK_FORM) 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: lcallback_program LIKE sy-repid. DATA: lcallback_form(30) TYPE c. FIELD-SYMBOLS <lparams> TYPE ydk_list=>ty_param_tab. DATA: lcall_mode TYPE c. DATA: subrc LIKE sy-subrc. CLEAR exit_dlg. lcallback_program = rcallback_program. lcallback_form = rcallback_form. IF <rparams> IS ASSIGNED. ASSIGN <rparams> TO <lparams>. UNASSIGN <rparams>. ENDIF. lcall_mode = gcall_mode. rcallback_program = callback_program. IF rcallback_program IS INITIAL. CALL 'AB_GET_CALLER' ID 'PROGRAM' FIELD rcallback_program. ENDIF. rcallback_form = callback_form. IF params IS SUPPLIED AND params IS NOT INITIAL. ASSIGN params TO <rparams>. ENDIF. gcall_mode = 'P'. 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. rcallback_program = lcallback_program. rcallback_form = lcallback_form. UNASSIGN <rparams>. IF <lparams> IS ASSIGNED. ASSIGN <lparams> TO <rparams>. ENDIF. IF subrc <> 0. RAISE cancel. ENDIF. ENDFUNCTION.
25.521739
72
0.629756
ff61720ff9b5d3b6fae80f4cc42066d0eb6c91fb
15,614
abap
ABAP
src/objects/zcl_abapgit_object_tabl.clas.abap
dbalser/adapGit-Review
af2ac3625337b6db0818054da53de8fbd8cccbd8
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_tabl.clas.abap
dbalser/adapGit-Review
af2ac3625337b6db0818054da53de8fbd8cccbd8
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_tabl.clas.abap
dbalser/adapGit-Review
af2ac3625337b6db0818054da53de8fbd8cccbd8
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_tabl DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. PRIVATE SECTION. CONSTANTS: c_longtext_id_tabl TYPE dokil-id VALUE 'TB'. ENDCLASS. CLASS zcl_abapgit_object_tabl IMPLEMENTATION. METHOD zif_abapgit_object~changed_by. TYPES: BEGIN OF ty_data, as4user TYPE as4user, as4date TYPE as4date, as4time TYPE as4time, END OF ty_data. DATA: lt_data TYPE STANDARD TABLE OF ty_data WITH DEFAULT KEY, ls_data LIKE LINE OF lt_data. SELECT as4user as4date as4time FROM dd02l INTO TABLE lt_data WHERE tabname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. SELECT as4user as4date as4time APPENDING TABLE lt_data FROM dd09l WHERE tabname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. SELECT as4user as4date as4time APPENDING TABLE lt_data FROM dd12l WHERE sqltab = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. SORT lt_data BY as4date DESCENDING as4time DESCENDING. READ TABLE lt_data INDEX 1 INTO ls_data. IF sy-subrc = 0. rv_user = ls_data-as4user. ELSE. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~compare_to_remote_version. DATA: lo_table_validation TYPE REF TO zcl_abapgit_object_tabl_valid, lo_local_version_output TYPE REF TO zcl_abapgit_xml_output, lo_local_version_input TYPE REF TO zcl_abapgit_xml_input, lv_validation_text TYPE string. CREATE OBJECT lo_local_version_output. me->zif_abapgit_object~serialize( lo_local_version_output ). CREATE OBJECT lo_local_version_input EXPORTING iv_xml = lo_local_version_output->render( ). CREATE OBJECT lo_table_validation. lv_validation_text = lo_table_validation->validate( io_remote_version = io_remote_version_xml io_local_version = lo_local_version_input ). IF lv_validation_text IS NOT INITIAL. lv_validation_text = |Database Table { ms_item-obj_name }: { lv_validation_text }|. CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_object_tabl_dialog EXPORTING iv_message = lv_validation_text. ELSE. CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lv_objname TYPE rsedd0-ddobjname, lv_tabclass TYPE dd02l-tabclass, lv_no_ask TYPE abap_bool, lv_subrc TYPE sy-subrc, lr_data TYPE REF TO data. FIELD-SYMBOLS: <lg_data> TYPE any. lv_objname = ms_item-obj_name. lv_no_ask = abap_true. SELECT SINGLE tabclass FROM dd02l INTO lv_tabclass WHERE tabname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. IF sy-subrc = 0 AND lv_tabclass = 'TRANSP'. * Avoid dump in dynamic SELECT in case the table does not exist on database CALL FUNCTION 'DB_EXISTS_TABLE' EXPORTING tabname = lv_objname IMPORTING subrc = lv_subrc. IF lv_subrc = 0. * it cannot delete table with table wihtout asking CREATE DATA lr_data TYPE (lv_objname). ASSIGN lr_data->* TO <lg_data>. SELECT SINGLE * FROM (lv_objname) INTO <lg_data>. IF sy-subrc = 0. lv_no_ask = abap_false. ENDIF. ENDIF. ENDIF. CALL FUNCTION 'RS_DD_DELETE_OBJ' EXPORTING no_ask = lv_no_ask objname = lv_objname objtype = 'T' EXCEPTIONS not_executed = 1 object_not_found = 2 object_not_specified = 3 permission_failure = 4. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from RS_DD_DELETE_OBJ, TABL' ). ENDIF. delete_longtexts( c_longtext_id_tabl ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lv_name TYPE ddobjname, lv_tname TYPE trobj_name, ls_dd02v TYPE dd02v, ls_dd09l TYPE dd09l, lt_dd03p TYPE TABLE OF dd03p, lt_dd05m TYPE TABLE OF dd05m, lt_dd08v TYPE TABLE OF dd08v, lt_dd12v TYPE dd12vtab, lt_dd17v TYPE dd17vtab, ls_dd17v LIKE LINE OF lt_dd17v, lt_secondary LIKE lt_dd17v, lt_dd35v TYPE TABLE OF dd35v, lt_dd36m TYPE dd36mttyp, ls_dd12v LIKE LINE OF lt_dd12v. io_xml->read( EXPORTING iv_name = 'DD02V' CHANGING cg_data = ls_dd02v ). io_xml->read( EXPORTING iv_name = 'DD09L' CHANGING cg_data = ls_dd09l ). io_xml->read( EXPORTING iv_name = 'DD03P_TABLE' CHANGING cg_data = lt_dd03p ). io_xml->read( EXPORTING iv_name = 'DD05M_TABLE' CHANGING cg_data = lt_dd05m ). io_xml->read( EXPORTING iv_name = 'DD08V_TABLE' CHANGING cg_data = lt_dd08v ). io_xml->read( EXPORTING iv_name = 'DD12V' CHANGING cg_data = lt_dd12v ). io_xml->read( EXPORTING iv_name = 'DD17V' CHANGING cg_data = lt_dd17v ). io_xml->read( EXPORTING iv_name = 'DD35V_TALE' CHANGING cg_data = lt_dd35v ). io_xml->read( EXPORTING iv_name = 'DD36M' CHANGING cg_data = lt_dd36m ). corr_insert( iv_package ). lv_name = ms_item-obj_name. " type conversion CALL FUNCTION 'DDIF_TABL_PUT' EXPORTING name = lv_name dd02v_wa = ls_dd02v dd09l_wa = ls_dd09l TABLES dd03p_tab = lt_dd03p dd05m_tab = lt_dd05m dd08v_tab = lt_dd08v dd35v_tab = lt_dd35v dd36m_tab = lt_dd36m EXCEPTIONS tabl_not_found = 1 name_inconsistent = 2 tabl_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from DDIF_TABL_PUT' ). ENDIF. zcl_abapgit_objects_activation=>add_item( ms_item ). * handle indexes LOOP AT lt_dd12v INTO ls_dd12v. * todo, call corr_insert? CLEAR lt_secondary. LOOP AT lt_dd17v INTO ls_dd17v WHERE sqltab = ls_dd12v-sqltab AND indexname = ls_dd12v-indexname. APPEND ls_dd17v TO lt_secondary. ENDLOOP. CALL FUNCTION 'DDIF_INDX_PUT' EXPORTING name = ls_dd12v-sqltab id = ls_dd12v-indexname dd12v_wa = ls_dd12v TABLES dd17v_tab = lt_secondary 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' ). ENDIF. CALL FUNCTION 'DD_DD_TO_E071' EXPORTING type = 'INDX' name = ls_dd12v-sqltab id = ls_dd12v-indexname IMPORTING obj_name = lv_tname. zcl_abapgit_objects_activation=>add( iv_type = 'INDX' iv_name = lv_tname ). ENDLOOP. deserialize_longtexts( io_xml ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_tabname TYPE dd02l-tabname. SELECT SINGLE tabname FROM dd02l INTO lv_tabname WHERE tabname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-ddic = abap_true. ENDMETHOD. METHOD zif_abapgit_object~has_changed_since. DATA: lv_date TYPE dats, lv_time TYPE tims, lt_indexes TYPE STANDARD TABLE OF dd09l. FIELD-SYMBOLS <ls_index> LIKE LINE OF lt_indexes. SELECT SINGLE as4date as4time FROM dd02l " Table INTO (lv_date, lv_time) WHERE tabname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. rv_changed = check_timestamp( iv_timestamp = iv_timestamp iv_date = lv_date iv_time = lv_time ). IF rv_changed = abap_true. RETURN. ENDIF. SELECT SINGLE as4date as4time FROM dd09l " Table tech settings INTO (lv_date, lv_time) WHERE tabname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. rv_changed = check_timestamp( iv_timestamp = iv_timestamp iv_date = lv_date iv_time = lv_time ). IF rv_changed = abap_true. RETURN. ENDIF. SELECT as4date as4time FROM dd12l " Table tech settings INTO CORRESPONDING FIELDS OF TABLE lt_indexes WHERE sqltab = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000' ORDER BY PRIMARY KEY ##TOO_MANY_ITAB_FIELDS. LOOP AT lt_indexes ASSIGNING <ls_index>. rv_changed = check_timestamp( iv_timestamp = iv_timestamp iv_date = <ls_index>-as4date iv_time = <ls_index>-as4time ). IF rv_changed = abap_true. RETURN. ENDIF. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESDICT' iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. jump_se11( iv_radio = 'RSRD1-DDTYPE' iv_field = 'RSRD1-DDTYPE_VAL' ). ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lv_name TYPE ddobjname, ls_dd02v TYPE dd02v, ls_dd09l TYPE dd09l, lt_dd03p TYPE TABLE OF dd03p, lt_dd05m TYPE TABLE OF dd05m, lt_dd08v TYPE TABLE OF dd08v, lt_dd12v TYPE dd12vtab, lt_dd17v TYPE dd17vtab, lt_dd35v TYPE TABLE OF dd35v, lv_index LIKE sy-index, lv_masklen TYPE c LENGTH 4, lt_dd36m TYPE dd36mttyp. FIELD-SYMBOLS: <ls_dd12v> LIKE LINE OF lt_dd12v, <ls_dd05m> LIKE LINE OF lt_dd05m, <ls_dd36m> LIKE LINE OF lt_dd36m, <ls_dd03p> LIKE LINE OF lt_dd03p, <lg_roworcolst> TYPE any. lv_name = ms_item-obj_name. CALL FUNCTION 'DDIF_TABL_GET' EXPORTING name = lv_name langu = mv_language IMPORTING dd02v_wa = ls_dd02v dd09l_wa = ls_dd09l TABLES dd03p_tab = lt_dd03p dd05m_tab = lt_dd05m dd08v_tab = lt_dd08v dd12v_tab = lt_dd12v dd17v_tab = lt_dd17v dd35v_tab = lt_dd35v dd36m_tab = lt_dd36m EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from DDIF_TABL_GET' ). ENDIF. IF ls_dd02v IS INITIAL. RETURN. " object does not exits ENDIF. CLEAR: ls_dd02v-as4user, ls_dd02v-as4date, ls_dd02v-as4time. * reset numeric field, so XML does not crash IF ls_dd02v-prozpuff = ''. CLEAR ls_dd02v-prozpuff. ENDIF. IF ls_dd02v-datmin = ''. CLEAR ls_dd02v-datmin. ENDIF. IF ls_dd02v-datmax = ''. CLEAR ls_dd02v-datmax. ENDIF. IF ls_dd02v-datavg = ''. CLEAR ls_dd02v-datavg. ENDIF. CLEAR: ls_dd09l-as4user, ls_dd09l-as4date, ls_dd09l-as4time. ASSIGN COMPONENT 'ROWORCOLST' OF STRUCTURE ls_dd09l TO <lg_roworcolst>. IF sy-subrc = 0 AND <lg_roworcolst> = 'C'. CLEAR <lg_roworcolst>. "To avoid diff errors. This field doesn't exists in all releases ENDIF. LOOP AT lt_dd12v ASSIGNING <ls_dd12v>. CLEAR: <ls_dd12v>-as4user, <ls_dd12v>-as4date, <ls_dd12v>-as4time. ENDLOOP. * remove nested structures DELETE lt_dd03p WHERE depth <> '00'. * remove fields from .INCLUDEs DELETE lt_dd03p WHERE adminfield <> '0'. LOOP AT lt_dd03p ASSIGNING <ls_dd03p> WHERE NOT rollname IS INITIAL. CLEAR: <ls_dd03p>-ddlanguage, <ls_dd03p>-dtelmaster, <ls_dd03p>-logflag, <ls_dd03p>-ddtext, <ls_dd03p>-reservedte, <ls_dd03p>-reptext, <ls_dd03p>-scrtext_s, <ls_dd03p>-scrtext_m, <ls_dd03p>-scrtext_l. lv_masklen = <ls_dd03p>-masklen. IF lv_masklen = '' OR NOT lv_masklen CO '0123456789'. * make sure the field contains valid data, or the XML will dump CLEAR <ls_dd03p>-masklen. ENDIF. IF <ls_dd03p>-comptype = 'E'. * type specified via data element CLEAR: <ls_dd03p>-domname, <ls_dd03p>-inttype, <ls_dd03p>-intlen, <ls_dd03p>-mask, <ls_dd03p>-memoryid, <ls_dd03p>-headlen, <ls_dd03p>-scrlen1, <ls_dd03p>-scrlen2, <ls_dd03p>-scrlen3, <ls_dd03p>-datatype, <ls_dd03p>-leng, <ls_dd03p>-outputlen, <ls_dd03p>-deffdname, <ls_dd03p>-convexit, <ls_dd03p>-entitytab, <ls_dd03p>-dommaster, <ls_dd03p>-domname3l, <ls_dd03p>-decimals, <ls_dd03p>-lowercase, <ls_dd03p>-signflag. ENDIF. IF <ls_dd03p>-shlporigin = 'D'. * search help from domain CLEAR: <ls_dd03p>-shlpfield, <ls_dd03p>-shlpname. ENDIF. * XML output assumes correct field content IF <ls_dd03p>-routputlen = ' '. CLEAR <ls_dd03p>-routputlen. ENDIF. ENDLOOP. * remove foreign keys inherited from .INCLUDEs DELETE lt_dd08v WHERE noinherit = 'N'. LOOP AT lt_dd05m ASSIGNING <ls_dd05m>. lv_index = sy-tabix. READ TABLE lt_dd08v WITH KEY fieldname = <ls_dd05m>-fieldname TRANSPORTING NO FIELDS. IF sy-subrc <> 0. DELETE lt_dd05m INDEX lv_index. ENDIF. ENDLOOP. * remove inherited search helps DELETE lt_dd35v WHERE shlpinher = abap_true. LOOP AT lt_dd36m ASSIGNING <ls_dd36m>. lv_index = sy-tabix. READ TABLE lt_dd35v WITH KEY fieldname = <ls_dd36m>-fieldname TRANSPORTING NO FIELDS. IF sy-subrc <> 0. DELETE lt_dd36m INDEX lv_index. ENDIF. ENDLOOP. io_xml->add( iv_name = 'DD02V' ig_data = ls_dd02v ). IF NOT ls_dd09l IS INITIAL. io_xml->add( iv_name = 'DD09L' ig_data = ls_dd09l ). ENDIF. io_xml->add( ig_data = lt_dd03p iv_name = 'DD03P_TABLE' ). io_xml->add( ig_data = lt_dd05m iv_name = 'DD05M_TABLE' ). io_xml->add( ig_data = lt_dd08v iv_name = 'DD08V_TABLE' ). io_xml->add( iv_name = 'DD12V' ig_data = lt_dd12v ). io_xml->add( iv_name = 'DD17V' ig_data = lt_dd17v ). io_xml->add( ig_data = lt_dd35v iv_name = 'DD35V_TALE' ). io_xml->add( iv_name = 'DD36M' ig_data = lt_dd36m ). serialize_longtexts( io_xml = io_xml iv_longtext_id = c_longtext_id_tabl ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. ENDCLASS.
28.861368
106
0.605546
ff61ace9211bf94fcbd99143b1bd0c98c8f1eb33
188
abap
ABAP
src/zif_abapgit_version.intf.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
null
null
null
src/zif_abapgit_version.intf.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
null
null
null
src/zif_abapgit_version.intf.abap
sagardarji/abapGit
a1699302a652d304f66e1ecda2f232158dbd879d
[ "MIT" ]
null
null
null
INTERFACE zif_abapgit_version PUBLIC . CONSTANTS gc_xml_version TYPE string VALUE 'v1.0.0' ##NO_TEXT. CONSTANTS gc_abap_version TYPE string VALUE '1.92.0' ##NO_TEXT. ENDINTERFACE.
23.5
65
0.771277
ff6531e9ec081d2d0db689bee7771e6b3c742085
7,535
abap
ABAP
src/persist/zcl_abapgit_persistence_repo.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
1
2020-03-28T06:23:11.000Z
2020-03-28T06:23:11.000Z
src/persist/zcl_abapgit_persistence_repo.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
null
null
null
src/persist/zcl_abapgit_persistence_repo.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_persistence_repo DEFINITION PUBLIC CREATE PROTECTED GLOBAL FRIENDS zcl_abapgit_persist_factory . PUBLIC SECTION. INTERFACES zif_abapgit_persist_repo . METHODS constructor . PROTECTED SECTION. ALIASES list FOR zif_abapgit_persist_repo~list . ALIASES read FOR zif_abapgit_persist_repo~read . PRIVATE SECTION. DATA mt_meta_fields TYPE STANDARD TABLE OF abap_compname. DATA mo_db TYPE REF TO zcl_abapgit_persistence_db . METHODS from_xml IMPORTING !iv_repo_xml_string TYPE string RETURNING VALUE(rs_repo) TYPE zif_abapgit_persistence=>ty_repo_xml RAISING zcx_abapgit_exception . METHODS to_xml IMPORTING !is_repo TYPE zif_abapgit_persistence=>ty_repo RETURNING VALUE(rv_repo_xml_string) TYPE string . METHODS get_next_id RETURNING VALUE(rv_next_repo_id) TYPE zif_abapgit_persistence=>ty_content-value RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_PERSISTENCE_REPO IMPLEMENTATION. METHOD constructor. DATA ls_dummy_meta_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask. DATA ls_dummy_meta TYPE zif_abapgit_persistence=>ty_repo_xml. DATA lo_type_meta_mask TYPE REF TO cl_abap_structdescr. DATA lo_type_meta TYPE REF TO cl_abap_structdescr. FIELD-SYMBOLS <ls_comp> LIKE LINE OF lo_type_meta_mask->components. " Collect actual list of fields in repo meta data (used in update_meta) lo_type_meta_mask ?= cl_abap_structdescr=>describe_by_data( ls_dummy_meta_mask ). lo_type_meta ?= cl_abap_structdescr=>describe_by_data( ls_dummy_meta ). LOOP AT lo_type_meta_mask->components ASSIGNING <ls_comp>. APPEND <ls_comp>-name TO mt_meta_fields. ENDLOOP. mo_db = zcl_abapgit_persistence_db=>get_instance( ). ENDMETHOD. METHOD from_xml. DATA: lv_xml TYPE string. lv_xml = iv_repo_xml_string. * fix downward compatibility REPLACE ALL OCCURRENCES OF '<_--28C_TYPE_REPO_--29>' IN lv_xml WITH '<REPO>'. REPLACE ALL OCCURRENCES OF '</_--28C_TYPE_REPO_--29>' IN lv_xml WITH '</REPO>'. CALL TRANSFORMATION id OPTIONS value_handling = 'accept_data_loss' SOURCE XML lv_xml RESULT repo = rs_repo ##NO_TEXT. * automatic migration of old fields FIND FIRST OCCURRENCE OF '</HEAD_BRANCH><WRITE_PROTECT>X</WRITE_PROTECT>' IN lv_xml. IF sy-subrc = 0. rs_repo-local_settings-write_protected = abap_true. ENDIF. FIND FIRST OCCURRENCE OF '<IGNORE_SUBPACKAGES>X</IGNORE_SUBPACKAGES></REPO>' IN lv_xml. IF sy-subrc = 0. rs_repo-local_settings-ignore_subpackages = abap_true. ENDIF. IF rs_repo IS INITIAL. zcx_abapgit_exception=>raise( 'Inconsistent repo metadata' ). ENDIF. ENDMETHOD. METHOD get_next_id. * todo: Lock the complete persistence in order to prevent concurrent repo-creation * however the current approach will most likely work in almost all cases DATA: lt_content TYPE zif_abapgit_persistence=>tt_content. FIELD-SYMBOLS: <ls_content> LIKE LINE OF lt_content. rv_next_repo_id = 1. lt_content = mo_db->list_by_type( zcl_abapgit_persistence_db=>c_type_repo ). LOOP AT lt_content ASSIGNING <ls_content>. IF <ls_content>-value >= rv_next_repo_id. rv_next_repo_id = <ls_content>-value + 1. ENDIF. ENDLOOP. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = rv_next_repo_id IMPORTING output = rv_next_repo_id. ENDMETHOD. METHOD to_xml. DATA: ls_xml TYPE zif_abapgit_persistence=>ty_repo_xml. MOVE-CORRESPONDING is_repo TO ls_xml. CALL TRANSFORMATION id SOURCE repo = ls_xml RESULT XML rv_repo_xml_string. ENDMETHOD. METHOD zif_abapgit_persist_repo~add. DATA: ls_repo TYPE zif_abapgit_persistence=>ty_repo, lv_repo_as_xml TYPE string. ls_repo-url = iv_url. ls_repo-branch_name = iv_branch_name. ls_repo-package = iv_package. ls_repo-offline = iv_offline. ls_repo-created_by = sy-uname. GET TIME STAMP FIELD ls_repo-created_at. ls_repo-dot_abapgit = is_dot_abapgit. ls_repo-local_settings-display_name = iv_display_name. lv_repo_as_xml = to_xml( ls_repo ). rv_key = get_next_id( ). mo_db->add( iv_type = zcl_abapgit_persistence_db=>c_type_repo iv_value = rv_key iv_data = lv_repo_as_xml ). ENDMETHOD. METHOD zif_abapgit_persist_repo~delete. DATA: lo_background TYPE REF TO zcl_abapgit_persist_background. CREATE OBJECT lo_background. lo_background->delete( iv_key ). mo_db->delete( iv_type = zcl_abapgit_persistence_db=>c_type_repo iv_value = iv_key ). ENDMETHOD. METHOD zif_abapgit_persist_repo~list. DATA: lt_content TYPE zif_abapgit_persistence=>tt_content, ls_content LIKE LINE OF lt_content, ls_repo LIKE LINE OF rt_repos. lt_content = mo_db->list_by_type( zcl_abapgit_persistence_db=>c_type_repo ). LOOP AT lt_content INTO ls_content. MOVE-CORRESPONDING from_xml( ls_content-data_str ) TO ls_repo. IF ls_repo-local_settings-write_protected = abap_false AND zcl_abapgit_factory=>get_environment( )->is_repo_object_changes_allowed( ) = abap_false. ls_repo-local_settings-write_protected = abap_true. ENDIF. ls_repo-key = ls_content-value. INSERT ls_repo INTO TABLE rt_repos. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_persist_repo~lock. mo_db->lock( iv_mode = iv_mode iv_type = zcl_abapgit_persistence_db=>c_type_repo iv_value = iv_key ). ENDMETHOD. METHOD zif_abapgit_persist_repo~read. DATA lt_repo TYPE zif_abapgit_persistence=>tt_repo. lt_repo = list( ). READ TABLE lt_repo INTO rs_repo WITH KEY key = iv_key. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_abapgit_not_found. ENDIF. ENDMETHOD. METHOD zif_abapgit_persist_repo~update_metadata. DATA: lv_blob TYPE zif_abapgit_persistence=>ty_content-data_str, ls_persistent_meta TYPE zif_abapgit_persistence=>ty_repo. FIELD-SYMBOLS <lv_field> LIKE LINE OF mt_meta_fields. FIELD-SYMBOLS <lg_dst> TYPE any. FIELD-SYMBOLS <lg_src> TYPE any. FIELD-SYMBOLS <lv_changed> TYPE abap_bool. ASSERT NOT iv_key IS INITIAL. IF is_change_mask IS INITIAL. RETURN. ENDIF. " Validations IF is_change_mask-url = abap_true AND is_meta-url IS INITIAL. zcx_abapgit_exception=>raise( 'update, url empty' ). ENDIF. TRY. ls_persistent_meta = read( iv_key ). CATCH zcx_abapgit_not_found. zcx_abapgit_exception=>raise( 'repo key not found' ). ENDTRY. " Update LOOP AT mt_meta_fields ASSIGNING <lv_field>. ASSIGN COMPONENT <lv_field> OF STRUCTURE is_change_mask TO <lv_changed>. ASSERT sy-subrc = 0. CHECK <lv_changed> = abap_true. ASSIGN COMPONENT <lv_field> OF STRUCTURE ls_persistent_meta TO <lg_dst>. ASSERT sy-subrc = 0. ASSIGN COMPONENT <lv_field> OF STRUCTURE is_meta TO <lg_src>. ASSERT sy-subrc = 0. <lg_dst> = <lg_src>. ENDLOOP. lv_blob = to_xml( ls_persistent_meta ). mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo iv_value = iv_key iv_data = lv_blob ). ENDMETHOD. ENDCLASS.
27.702206
97
0.702588
ff680791673b10e746451a5c662cd6efda18fc1d
1,516
abap
ABAP
src/cl_abapgit_res_repos.clas.locals_def.abap
SAP/project-odense
85f94a04b5a31998ab42b8595b30f01f99347d90
[ "Apache-2.0" ]
19
2020-08-27T11:47:00.000Z
2021-07-01T08:34:51.000Z
src/cl_abapgit_res_repos.clas.locals_def.abap
SAP/project-odense
85f94a04b5a31998ab42b8595b30f01f99347d90
[ "Apache-2.0" ]
5
2020-08-27T12:05:20.000Z
2021-11-03T14:01:45.000Z
src/cl_abapgit_res_repos.clas.locals_def.abap
SAP/project-odense
85f94a04b5a31998ab42b8595b30f01f99347d90
[ "Apache-2.0" ]
4
2020-08-27T11:55:51.000Z
2022-02-27T18:53:17.000Z
*"* use this source file for any type of declarations (class *"* definitions, interfaces or type declarations) you need for *"* components in the private section INTERFACE lif_abapgit_provider. METHODS: validate_package IMPORTING iv_package TYPE devclass RAISING cx_abapgit_exception, is_tr_check_required IMPORTING iv_package TYPE devclass RETURNING VALUE(rv_is_required) TYPE abap_bool RAISING cx_abapgit_exception, list_repositories RETURNING VALUE(rt_list) TYPE if_abapgit_definitions=>ty_repo_ref_tt RAISING cx_abapgit_exception, validate_transport_request IMPORTING iv_transport_request TYPE trkorr RAISING cx_abapgit_exception, set_authentication_info IMPORTING iv_user TYPE string iv_password TYPE string, perform_import IMPORTING is_request_data TYPE cl_abapgit_res_repos=>ty_request_data ii_log TYPE REF TO if_abapgit_log RAISING cx_abapgit_exception, link_repo IMPORTING is_request_data TYPE cl_abapgit_res_repos=>ty_request_data RAISING cx_abapgit_exception. ENDINTERFACE. CLASS lcl_abapgit_provider DEFINITION. PUBLIC SECTION. INTERFACES: lif_abapgit_provider. ENDCLASS. CLASS ltcl_abapgit_repos_resource DEFINITION DEFERRED. CLASS cl_abapgit_res_repos DEFINITION LOCAL FRIENDS ltcl_abapgit_repos_resource.
52.275862
90
0.708443
ff68accc1751d7cb9ef0e33ceea90e4df7669fc6
229
abap
ABAP
src/zrapcloud_uuid_four_levels/zbp_i_af_demolevel4_01.clas.abap
SAP-samples/abap-platform-code-samples-cloud
9bc0a977a318643a7d53dcb28b5ed3c2c9fef3ed
[ "Apache-2.0" ]
5
2021-09-21T22:24:50.000Z
2022-02-23T16:36:03.000Z
src/zrapcloud_uuid_four_levels/zbp_i_af_demolevel4_01.clas.abap
SAP-samples/abap-platform-code-samples-cloud
9bc0a977a318643a7d53dcb28b5ed3c2c9fef3ed
[ "Apache-2.0" ]
null
null
null
src/zrapcloud_uuid_four_levels/zbp_i_af_demolevel4_01.clas.abap
SAP-samples/abap-platform-code-samples-cloud
9bc0a977a318643a7d53dcb28b5ed3c2c9fef3ed
[ "Apache-2.0" ]
null
null
null
class ZBP_I_AF_DEMOLEVEL4_01 definition public abstract final for behavior of ZI_AF_DEMOLEVEL1_01 . public section. protected section. private section. ENDCLASS. CLASS ZBP_I_AF_DEMOLEVEL4_01 IMPLEMENTATION. ENDCLASS.
14.3125
44
0.820961
ff6ce7bf7f6f6c882e54e4f24df15a4e4380b88f
130
abap
ABAP
src/test/no_initial_selectn/z2mse_test_fgr_b.fugr.lz2mse_test_fgr_btop.abap
sabatale/SAP2Moose
59553fab013de732e2b7c9e67b6a4de799617b6a
[ "MIT" ]
25
2017-09-05T12:57:46.000Z
2021-12-18T21:47:13.000Z
src/test/no_initial_selectn/z2mse_test_fgr_b.fugr.lz2mse_test_fgr_btop.abap
sabatale/SAP2Moose
59553fab013de732e2b7c9e67b6a4de799617b6a
[ "MIT" ]
72
2017-09-18T15:16:20.000Z
2021-12-10T20:09:32.000Z
src/test/no_initial_selectn/z2mse_test_fgr_b.fugr.lz2mse_test_fgr_btop.abap
sabatale/SAP2Moose
59553fab013de732e2b7c9e67b6a4de799617b6a
[ "MIT" ]
6
2017-11-05T19:23:19.000Z
2020-02-01T20:02:51.000Z
FUNCTION-POOL Z2MSE_TEST_FGR_B. "MESSAGE-ID .. * INCLUDE LZ2MSE_TEST_FGR_BD... " Local class definition
32.5
69
0.630769
ff6d2911884518050370200fc077e4018fb5df02
3,500
abap
ABAP
src/objects/core/zcl_abapgit_objects_activation.clas.testclasses.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
1
2018-05-11T09:36:31.000Z
2018-05-11T09:36:31.000Z
src/objects/core/zcl_abapgit_objects_activation.clas.testclasses.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
1
2022-01-11T09:52:04.000Z
2022-01-11T09:52:04.000Z
src/objects/core/zcl_abapgit_objects_activation.clas.testclasses.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
2
2016-12-14T09:31:45.000Z
2018-03-27T12:00:44.000Z
CLASS ltcl_tests DEFINITION DEFERRED. CLASS zcl_abapgit_objects_activation DEFINITION LOCAL FRIENDS ltcl_tests. CLASS ltcl_tests DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. PRIVATE SECTION. DATA mo_cut TYPE REF TO zcl_abapgit_objects_activation. METHODS: setup, is_active FOR TESTING RAISING zcx_abapgit_exception, is_ddic_type FOR TESTING, get_ddic_type FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_tests IMPLEMENTATION. METHOD setup. CREATE OBJECT mo_cut. ENDMETHOD. METHOD is_active. DATA ls_item TYPE zif_abapgit_definitions=>ty_item. " DDIC, exists ls_item-obj_type = 'TABL'. ls_item-obj_name = 'T000'. cl_abap_unit_assert=>assert_equals( act = mo_cut->is_active( ls_item ) exp = abap_true ). " DDIC, does not exist ls_item-obj_type = 'TABL'. ls_item-obj_name = 'TABL_ABAPGIT'. cl_abap_unit_assert=>assert_equals( act = mo_cut->is_active( ls_item ) exp = abap_true ). " non-DDIC, exists ls_item-obj_type = 'PROG'. ls_item-obj_name = 'SAPMSYST'. cl_abap_unit_assert=>assert_equals( act = mo_cut->is_active( ls_item ) exp = abap_true ). ls_item-obj_type = 'SFSW'. ls_item-obj_name = 'SRIS_SWITCH_SOURCE_SEARCH'. cl_abap_unit_assert=>assert_equals( act = mo_cut->is_active( ls_item ) exp = abap_true ). " non-DDIC, does not exist ls_item-obj_type = 'FUGR'. ls_item-obj_name = 'FUGR_ABAPGIT'. cl_abap_unit_assert=>assert_equals( act = mo_cut->is_active( ls_item ) exp = abap_true ). ENDMETHOD. METHOD is_ddic_type. cl_abap_unit_assert=>assert_equals( act = mo_cut->is_ddic_type( 'TABL' ) exp = abap_true ). cl_abap_unit_assert=>assert_equals( act = mo_cut->is_ddic_type( 'PROG' ) exp = abap_false ). ENDMETHOD. METHOD get_ddic_type. DATA: lv_type TYPE ddobjtyp, lv_name TYPE ddobjname, lv_id TYPE ddobjectid. mo_cut->get_ddic_type( EXPORTING iv_obj_type = 'TABL' iv_obj_name = 'T005' IMPORTING ev_type = lv_type ev_name = lv_name ev_id = lv_id ). cl_abap_unit_assert=>assert_equals( act = lv_type exp = 'TABL' ). cl_abap_unit_assert=>assert_equals( act = lv_name exp = 'T005' ). cl_abap_unit_assert=>assert_equals( act = lv_id exp = '' ). " index id at +10 mo_cut->get_ddic_type( EXPORTING iv_obj_type = 'XINX' iv_obj_name = 'T005 Z00' IMPORTING ev_type = lv_type ev_name = lv_name ev_id = lv_id ). cl_abap_unit_assert=>assert_equals( act = lv_type exp = 'XINX' ). cl_abap_unit_assert=>assert_equals( act = lv_name exp = 'T005' ). cl_abap_unit_assert=>assert_equals( act = lv_id exp = 'Z00' ). " index id at +30 mo_cut->get_ddic_type( EXPORTING iv_obj_type = 'XINX' iv_obj_name = 'ZLONG_TABLE_NAME Z99' IMPORTING ev_type = lv_type ev_name = lv_name ev_id = lv_id ). cl_abap_unit_assert=>assert_equals( act = lv_type exp = 'XINX' ). cl_abap_unit_assert=>assert_equals( act = lv_name exp = 'ZLONG_TABLE_NAME' ). cl_abap_unit_assert=>assert_equals( act = lv_id exp = 'Z99' ). ENDMETHOD. ENDCLASS.
23.333333
73
0.629429
ff7b71bda470d282eab908ed0260e56e1c4cb982
1,661
abap
ABAP
src/zcl_sci_longdoc_check.clas.locals_imp.abap
wozjac/sci-long-doc-check
0dc88b84817f77c0cae6b43aef9e7c1a416ca7ee
[ "MIT" ]
null
null
null
src/zcl_sci_longdoc_check.clas.locals_imp.abap
wozjac/sci-long-doc-check
0dc88b84817f77c0cae6b43aef9e7c1a416ca7ee
[ "MIT" ]
null
null
null
src/zcl_sci_longdoc_check.clas.locals_imp.abap
wozjac/sci-long-doc-check
0dc88b84817f77c0cae6b43aef9e7c1a416ca7ee
[ "MIT" ]
null
null
null
CLASS lcl_object_info IMPLEMENTATION. METHOD set_object. DATA: class_name TYPE seoclsname. class_name = object_name. CASE object_type. WHEN 'CLAS'. m_object_metadata = get_object_metadata( name = class_name type = object_type ). m_document_id-attribute = 'CA'. m_document_id-event = 'CE'. m_document_id-method = 'CO'. m_document_id-object = 'CL'. WHEN 'INTF'. m_object_metadata = get_object_metadata( name = class_name type = object_type ). m_document_id-attribute = 'IA'. m_document_id-event = 'IE'. m_document_id-method = 'IO'. m_document_id-object = 'IF'. ENDCASE. m_object_type = object_type. m_object_name = object_name. ENDMETHOD. METHOD get_object_metadata. TRY. CASE type. WHEN 'CLAS'. object_metadata = cl_oo_interface=>get_instance( name ). WHEN 'INTF'. object_metadata = cl_oo_object=>get_instance( name ). ENDCASE. CATCH cx_class_not_existent. RAISE EXCEPTION TYPE cx_sy_create_object_error. ENDTRY. ENDMETHOD. METHOD get_attributes. attributes = m_object_metadata->get_attributes( ). IF non_private = abap_true. DELETE attributes WHERE exposure = 0. ENDIF. ENDMETHOD. METHOD get_events. events = m_object_metadata->get_events( ). IF non_private = abap_true. DELETE events WHERE exposure = 0. ENDIF. ENDMETHOD. METHOD get_methods. methods = m_object_metadata->get_methods( ). IF non_private = abap_true. DELETE methods WHERE exposure = 0. ENDIF. ENDMETHOD. ENDCLASS.
26.365079
88
0.655629
ff7cd26934d5ce47e35f97ab75568bfb1e54d7eb
12,727
abap
ABAP
src/zcl_acs_abapdocs_code_scanner.clas.abap
twinformatics/abapdocs-code-scanner
6553c054a2231b54ee8c0fe4ea1d892dd6dff9f7
[ "MIT" ]
null
null
null
src/zcl_acs_abapdocs_code_scanner.clas.abap
twinformatics/abapdocs-code-scanner
6553c054a2231b54ee8c0fe4ea1d892dd6dff9f7
[ "MIT" ]
null
null
null
src/zcl_acs_abapdocs_code_scanner.clas.abap
twinformatics/abapdocs-code-scanner
6553c054a2231b54ee8c0fe4ea1d892dd6dff9f7
[ "MIT" ]
null
null
null
"! scans code of class/interfaces to read abapDocs of public method/type descriptions<br/> "! for examples look at the unit test class ltcl_example class zcl_acs_abapdocs_code_scanner definition public final create private . public section. "! factory method <br/> "! create a code scanner instance for a class/interface/type descriptor<br/> "! in error case, returns either an empty tree or a null reference class-methods create_by_typedescr importing typedescr type ref to cl_abap_typedescr create_empty_instance_on_error type abap_bool default abap_true returning value(instance) type ref to zcl_acs_abapdocs_code_scanner. "! get annotations included in the abapDocs of the current method/field methods get_annotations returning value(annotations) type ref to zif_acs_abapdocs_annotation. "! get text of abapDocs excluding annotations of the current method/field methods get_description returning value(description) type string. "! get abapDocs scan object for a type description methods get_abapdocs_for_child importing name type string returning value(abapdocs_for_child) type ref to zcl_acs_abapdocs_code_scanner. methods get_typedescr returning value(typedescr) type ref to cl_abap_typedescr. "! get all fields that have the specific annotation of one scanned source code object (class/interface) <br/> "! result: table: field-name : annotation-value <br/> "! e.g. used for retrieving jsonName in runtime methods get_fields_with_annotation importing field_keyword type string default 'TYPES' annotation_key type string returning value(name_mappings) type /ui2/cl_json=>name_mappings. protected section. private section. types: begin of t_annotation_and_description, annotation_pairs type zcl_acs_abapdocs_annotation=>t_key_values, description type string, end of t_annotation_and_description, begin of t_scan_cache, class_pool_name type string, abapdocs_tree type ref to lif_abapdocs_scan_tree, end of t_scan_cache . class-data scan_cache type hashed table of t_scan_cache with unique key class_pool_name. class-data annotation_regex type ref to cl_abap_regex. data abapdocs_tree type ref to lif_abapdocs_scan_tree. data path type lif_abapdocs_scan_tree=>t_path. data typedescr type ref to cl_abap_typedescr. data typedescrs_of_childs type abap_component_symbol_tab. "! load on demand (like a cache) data annotations type ref to zif_acs_abapdocs_annotation. data description type string. methods constructor importing abapdocs_tree type ref to lif_abapdocs_scan_tree path type lif_abapdocs_scan_tree=>t_path typedescr type ref to cl_abap_typedescr annotation_and_description type t_annotation_and_description . class-methods extract_annotations_and_descr importing docs_lines type lif_abapdocs_scan_tree=>t_abapdocs_source_lines returning value(anno_and_desc) type t_annotation_and_description. class-methods get_path_for_typedescr importing absolute_name type abap_abstypename returning value(path) type lif_abapdocs_scan_tree=>t_path. class-methods extract_class_pool_name importing i_absolute_name type abap_abstypename returning value(r_class_pool_name) type string raising cx_sy_matcher cx_sy_regex . class-methods split_into_annoation_key_value importing docs_line type seo_section_source_line returning value(annotation) type zcl_acs_abapdocs_annotation=>t_key_value. ENDCLASS. CLASS ZCL_ACS_ABAPDOCS_CODE_SCANNER IMPLEMENTATION. method constructor. me->abapdocs_tree = abapdocs_tree. me->path = path. me->typedescr = typedescr. * data(annotation_and_description) = extract_annoations_and_descr( abapdocs_tree->get_abapdocs_for_path( path ) ). me->annotations = new zcl_acs_abapdocs_annotation( annotation_and_description-annotation_pairs ). me->description = annotation_and_description-description. condense me->description. endmethod. method create_by_typedescr. data(class_pool_name) = zcl_acs_abapdocs_code_scanner=>extract_class_pool_name( typedescr->absolute_name ). data(path) = get_path_for_typedescr( typedescr->absolute_name ). if class_pool_name is not initial. try. if not line_exists( scan_cache[ class_pool_name = class_pool_name ] ). data(abapdocs_scan_tree) = new lcl_abapdocs_scan_tree( ). lcl_abapdocs_reposrc_scanner=>fill_tree( scan_tree = abapdocs_scan_tree class_pool_name = class_pool_name ). insert value #( class_pool_name = class_pool_name abapdocs_tree = abapdocs_scan_tree ) into table scan_cache. endif. data(abapdocs_tree) = scan_cache[ class_pool_name = class_pool_name ]-abapdocs_tree. instance = new #( abapdocs_tree = abapdocs_tree path = path typedescr = typedescr annotation_and_description = extract_annotations_and_descr( abapdocs_tree->get_abapdocs_for_path( path ) ) ). catch lcx_error into data(lx_error). if create_empty_instance_on_error = abap_true. " create a dummy/empty instance instance = new #( abapdocs_tree = new lcl_abapdocs_scan_tree( ) path = value #( ) typedescr = typedescr annotation_and_description = value #( ) ). endif. endtry. else. if create_empty_instance_on_error = abap_true. " create a dummy/empty instance instance = new #( abapdocs_tree = new lcl_abapdocs_scan_tree( ) path = value #( ) typedescr = typedescr annotation_and_description = value #( ) ). endif. endif. endmethod. method extract_annotations_and_descr. " conditions: description text is always before annotations " description is not allowed after an annotation " --> all lines after an annotations belongs to that annotation data description_lines type standard table of string. data annotation_key_values type zcl_acs_abapdocs_annotation=>t_key_values. loop at docs_lines into data(docs_line). data(annotation) = split_into_annoation_key_value( docs_line ). if annotation is not initial. " line includes an "@" --> new annotation if not line_exists( annotation_key_values[ key = annotation-key ] ). " annotation keys should be unique, in case of multiple occurrence the first one wins insert annotation into table annotation_key_values assigning field-symbol(<last_annotation>). endif. else. if <last_annotation> is assigned. " line belongs to the annotation above <last_annotation>-value = |{ <last_annotation>-value } { condense( docs_line ) }|. else. " no annotation so far --> it's an description append docs_line to description_lines. endif. endif. endloop. anno_and_desc = value #( annotation_pairs = annotation_key_values description = reduce string( init text = `` sep = `` for desc_line in description_lines next text = |{ text }{ sep }{ condense( desc_line ) }| sep = ` ` ) ). endmethod. method extract_class_pool_name. " eg: \CLASS-POOL=ZCL_ACS_ABAPDOCS_CODE_SCANNER\CLASS=LTCL_CLASS_WITH_ABAP_DOCS\TYPE=T_LITERAL data(matcher) = cl_abap_matcher=>create( pattern = '^\\(CLASS|INTERFACE)(-POOL)?=([A-Z0-9_/]*)(\\.*)?$' text = i_absolute_name ). if matcher->find_next( ). r_class_pool_name = matcher->get_submatch( 3 ). endif. endmethod. method get_abapdocs_for_child. data childs_typedescr type ref to cl_abap_typedescr. data(childs_path) = value #( base me->path ( |{ name case = lower }| ) ). " try to retrieve typedescr of child if me->typedescr is bound. case cl_abap_classdescr=>get_class_name( me->typedescr ). when '\CLASS=CL_ABAP_STRUCTDESCR'. if me->typedescrs_of_childs is initial. me->typedescrs_of_childs = cast cl_abap_structdescr( me->typedescr )->get_symbols( ). endif. if line_exists( me->typedescrs_of_childs[ name = name ] ). childs_typedescr = me->typedescrs_of_childs[ name = name ]-type. endif. when '\CLASS=CL_ABAP_TABLEDESCR'. childs_typedescr = cast cl_abap_tabledescr( me->typedescr )->get_table_line_type( ). if childs_typedescr->kind = cl_abap_typedescr=>kind_ref. childs_typedescr = cast cl_abap_refdescr( childs_typedescr )->get_referenced_type( ). endif. abapdocs_for_child = zcl_acs_abapdocs_code_scanner=>create_by_typedescr( childs_typedescr ). return. when '\CLASS=CL_ABAP_CLASSDESCR' or '\CLASS=CL_ABAP_INTFDESCR'. cast cl_abap_objectdescr( me->typedescr )->get_attribute_type( exporting p_name = name receiving p_descr_ref = childs_typedescr exceptions attribute_not_found = 1 others = 2 ). * if sy-subrc <> 0. " error is handled below with "childs_typedescr is bound" * endif. endcase. endif. data(annot_and_desc_of_field) = extract_annotations_and_descr( abapdocs_tree->get_abapdocs_for_path( childs_path ) ). " type of data element or structure " in case of a sub structure in a type definition abapdocs_of_type is null if childs_typedescr is bound and not childs_typedescr->is_ddic_type( ) * and cl_abap_classdescr=>get_class_name( childs_typedescr ) <> '\CLASS=CL_ABAP_ELEMDESCR' . data(abapdocs_of_childs_type) = zcl_acs_abapdocs_code_scanner=>create_by_typedescr( typedescr = childs_typedescr create_empty_instance_on_error = abap_false ). endif. if abapdocs_of_childs_type is bound. " null e.g. in case of local type-descr like "\TYPE=%_T00004S00000048O0000089440" or "\TYPE=STRING" abapdocs_for_child = abapdocs_of_childs_type. abapdocs_for_child->annotations = new zcl_acs_abapdocs_annotation( value #( base annot_and_desc_of_field-annotation_pairs for key in abapdocs_for_child->annotations->get_keys( ) ( key = key value = abapdocs_for_child->annotations->get_value( key ) ) ) ). if annot_and_desc_of_field-description is not initial. abapdocs_for_child->description = annot_and_desc_of_field-description. endif. else. abapdocs_for_child = new #( abapdocs_tree = me->abapdocs_tree path = childs_path typedescr = childs_typedescr annotation_and_description = value #( annotation_pairs = annot_and_desc_of_field-annotation_pairs description = annot_and_desc_of_field-description ) ). endif. endmethod. method get_annotations. annotations = me->annotations. endmethod. method get_description. description = me->description. endmethod. method get_fields_with_annotation. name_mappings = me->abapdocs_tree->get_fields_with_annotation( field_keyword = field_keyword annotation_key = annotation_key ). endmethod. method get_path_for_typedescr. " eg: \CLASS-POOL=ZCL_ACS_ABAPDOCS_CODE_SCANNER\CLASS=LTCL_CLASS_WITH_ABAP_DOCS\TYPE=T_LITERAL split |{ condense( absolute_name ) }| at '\' into table data(parts). loop at parts into data(part) where table_line is not initial. split part at '=' into data(type) data(name). if sy-subrc = 0 and type <> 'CLASS-POOL'. append |{ name case = lower }| to path. endif. endloop. endmethod. method get_typedescr. typedescr = me->typedescr. endmethod. method split_into_annoation_key_value. if annotation_regex is not bound. annotation_regex = new #( '\s*@(\w{3,})\s*(:)?\s*(.*)?' ). endif. data(matcher) = annotation_regex->create_matcher( text = docs_line ). if matcher->find_next( ). annotation = value #( key = matcher->get_submatch( 1 ) value = matcher->get_submatch( 3 ) ). endif. endmethod. ENDCLASS.
36.783237
165
0.679736
ff7d3d693db64c32864c9fe732bf71c709d47a7e
21,063
abap
ABAP
src/objects/zcl_abapgit_object_udmo.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
1
2019-09-11T20:57:34.000Z
2019-09-11T20:57:34.000Z
src/objects/zcl_abapgit_object_udmo.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_udmo.clas.abap
matt1as/abapGit
c7093e753ed23fa3937adb15602989c4ceea35b9
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_udmo DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . METHODS constructor IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_language TYPE spras . PROTECTED SECTION. METHODS corr_insert REDEFINITION . PRIVATE SECTION. TYPES: " You are reminded that the text serialisation / de-serialisation methods depend upon a common type. " To make the dependency explicit, there is one common definition. BEGIN OF ty_udmo_text_type. TYPES sprache TYPE dm40t-sprache. TYPES dmoid TYPE dm40t-dmoid. TYPES langbez TYPE dm40t-langbez. TYPES as4local TYPE dm40t-as4local. TYPES END OF ty_udmo_text_type . DATA mv_data_model TYPE uddmodl . DATA mv_text_object TYPE doku_obj . DATA mv_lxe_text_name TYPE lxeobjname . DATA mv_activation_state TYPE as4local . DATA ms_object_type TYPE rsdeo . CONSTANTS c_transport_object_class TYPE trobjtype VALUE 'SUDM' ##NO_TEXT. CONSTANTS c_lxe_text_type TYPE lxeobjtype VALUE 'IM' ##NO_TEXT. CONSTANTS c_correction_object_type TYPE rsdeo-objtype VALUE 'UDMO' ##NO_TEXT. CONSTANTS c_active_state TYPE as4local VALUE 'A' ##NO_TEXT. METHODS is_name_permitted RAISING zcx_abapgit_exception . METHODS update_tree . METHODS serialize_short_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_short_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_long_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_long_texts IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_entities IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . METHODS deserialize_entities IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS access_modify RETURNING VALUE(rv_result) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS access_free RETURNING VALUE(rv_result) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS deserialize_model IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_input RAISING zcx_abapgit_exception . METHODS serialize_model IMPORTING !io_xml TYPE REF TO zcl_abapgit_xml_output RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_UDMO IMPLEMENTATION. METHOD access_free. " Release the lock on the object. CALL FUNCTION 'RS_ACCESS_PERMISSION' EXPORTING mode = 'FREE' object = me->ms_object_type object_class = me->c_transport_object_class EXCEPTIONS canceled_in_corr = 1 enqueued_by_user = 2 enqueue_system_failure = 3 illegal_parameter_values = 4 locked_by_author = 5 no_modify_permission = 6 no_show_permission = 7 permission_failure = 8 request_language_denied = 9 OTHERS = 10. IF sy-subrc NE 0. zcx_abapgit_exception=>raise_t100( ). ELSE. rv_result = abap_true. ENDIF. ENDMETHOD. METHOD access_modify. * You are reminded that mode modify is the same as insert, with one important difference: * Mode INSERT is intended for newly created objects, for which a TADIR entry does not yet * exist. In that case, the system shows a pop-up for the entry of the package, which isn't * desirable when the SAPGUI is not available. * In the context of abapGit, the package is known. CALL FUNCTION 'RS_ACCESS_PERMISSION' EXPORTING authority_check = abap_true global_lock = abap_true mode = 'MODIFY' object = me->ms_object_type object_class = me->c_transport_object_class EXCEPTIONS canceled_in_corr = 1 enqueued_by_user = 2 enqueue_system_failure = 3 illegal_parameter_values = 4 locked_by_author = 5 no_modify_permission = 6 no_show_permission = 7 permission_failure = 8 request_language_denied = 9 OTHERS = 10. IF sy-subrc NE 0. zcx_abapgit_exception=>raise_t100( ). ELSE. rv_result = abap_true. ENDIF. ENDMETHOD. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). " Conversion to Data model me->mv_data_model = is_item-obj_name. " Default activation state is active me->mv_activation_state = c_active_state. " Derive the data model's text object mv_text_object = 'UDMD' && is_item-obj_name. " And set the text object to active mv_text_object+30(1) = mv_activation_state. mv_lxe_text_name = mv_text_object. " Correction and Transport System object me->ms_object_type-objtype = c_correction_object_type. me->ms_object_type-objname = is_item-obj_name. ENDMETHOD. METHOD corr_insert. " You are reminded that SUDM - Data Model has no part objects e.g. no LIMU " Therefore global lock is always appropriate " You are reminded that the master language (in TADIR) is taken from MV_LANGUAGE. CALL FUNCTION 'RS_CORR_INSERT' EXPORTING object = me->ms_object_type object_class = me->c_transport_object_class devclass = iv_package master_language = mv_language mode = 'INSERT' global_lock = abap_true EXCEPTIONS cancelled = 1 permission_failure = 2 unknown_objectclass = 3 OTHERS = 4. IF sy-subrc = 1. zcx_abapgit_exception=>raise( 'Cancelled' ). ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from RS_CORR_INSERT' ). ENDIF. ENDMETHOD. METHOD deserialize_entities. DATA lt_udmo_entities TYPE STANDARD TABLE OF dm41s WITH DEFAULT KEY. DATA ls_udmo_entity LIKE LINE OF lt_udmo_entities. io_xml->read( EXPORTING iv_name = 'UDMO_ENTITIES' CHANGING cg_data = lt_udmo_entities ). LOOP AT lt_udmo_entities INTO ls_udmo_entity. CALL FUNCTION 'SDU_DMO_ENT_PUT' EXPORTING object = ls_udmo_entity EXCEPTIONS ret_code = 0 OTHERS = 0. ENDLOOP. ENDMETHOD. METHOD deserialize_long_texts. TYPES BEGIN OF language_type. TYPES language TYPE dm40t-sprache. TYPES END OF language_type. DATA BEGIN OF ls_udmo_long_text. DATA language TYPE dm40t-sprache. DATA header TYPE thead. DATA content TYPE xstring. DATA END OF ls_udmo_long_text. DATA lt_udmo_long_texts LIKE STANDARD TABLE OF ls_udmo_long_text. DATA ls_header TYPE thead. io_xml->read( EXPORTING iv_name = 'UDMO_LONG_TEXTS' CHANGING cg_data = lt_udmo_long_texts ). LOOP AT lt_udmo_long_texts INTO ls_udmo_long_text. ls_udmo_long_text-header-tdfuser = sy-uname. ls_udmo_long_text-header-tdfdate = sy-datum. ls_udmo_long_text-header-tdftime = sy-uzeit. " You are reminded that the target system may already have some texts in " existence. So we determine the highest existent version. CLEAR ls_header-tdversion. SELECT MAX( dokversion ) INTO ls_header-tdversion FROM dokhl WHERE id = me->c_lxe_text_type AND object = me->mv_text_object AND langu = ls_udmo_long_text-language. " Increment the version ls_header-tdversion = ls_header-tdversion + 1. ls_udmo_long_text-header-tdversion = ls_header-tdversion. " This function module takes care of the variation in text processing between various objects. CALL FUNCTION 'LXE_OBJ_DOKU_PUT_XSTRING' EXPORTING slang = me->mv_language tlang = ls_udmo_long_text-language objtype = me->c_lxe_text_type objname = me->mv_lxe_text_name header = ls_udmo_long_text-header content = ls_udmo_long_text-content. ENDLOOP. ENDMETHOD. METHOD deserialize_model. DATA ls_dm40l TYPE dm40l. io_xml->read( EXPORTING iv_name = 'DM40L' CHANGING cg_data = ls_dm40l ). " See SDU_MODEL_PUT GET TIME. ls_dm40l-flg_frame = abap_true. ls_dm40l-fstdate = sy-datum. ls_dm40l-fsttime = sy-uzeit. ls_dm40l-fstuser = sy-uname. ls_dm40l-lstdate = sy-datum. ls_dm40l-lsttime = sy-uzeit. ls_dm40l-lstuser = sy-uname. MODIFY dm40l FROM ls_dm40l. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SDU_MODEL_PUT' ). ENDIF. ENDMETHOD. METHOD deserialize_short_texts. DATA lt_udmo_texts TYPE STANDARD TABLE OF ty_udmo_text_type WITH DEFAULT KEY. DATA ls_udmo_text TYPE ty_udmo_text_type. DATA ls_dm40t TYPE dm40t. " Deserialize the XML io_xml->read( EXPORTING iv_name = 'UDMO_TEXTS' CHANGING cg_data = lt_udmo_texts ). " For every text provided LOOP AT lt_udmo_texts INTO ls_udmo_text. " Does the text already exist? This is the same logic as used " in the FM SDU_MODEL_PUT SELECT SINGLE * FROM dm40t INTO ls_dm40t WHERE sprache EQ ls_udmo_text-sprache AND dmoid EQ ls_udmo_text-dmoid AND as4local EQ me->mv_activation_state. IF sy-subrc EQ 0. " There is already an active description for this language " but the provided description differs IF ls_dm40t-langbez NE ls_udmo_text-langbez. ls_dm40t-langbez = ls_udmo_text-langbez. ls_dm40t-lstdate = sy-datum. ls_dm40t-lsttime = sy-uzeit. ls_dm40t-lstuser = sy-uname. MODIFY dm40t FROM ls_dm40t. ENDIF. ELSE. " There is no EXISTING active description in this language ls_dm40t-as4local = ls_udmo_text-as4local. ls_dm40t-dmoid = ls_udmo_text-dmoid. ls_dm40t-langbez = ls_udmo_text-langbez. ls_dm40t-lstdate = sy-datum. ls_dm40t-lsttime = sy-uzeit. ls_dm40t-lstuser = sy-uname. ls_dm40t-sprache = ls_udmo_text-sprache. INSERT dm40t FROM ls_dm40t. ENDIF. ENDLOOP. ENDMETHOD. METHOD is_name_permitted. " It is unlikely that a serialised data model will have a name that is not permitted. However " there may be reservations in TRESE which could prohibit the data model name. " So to be safe, we check. Tx SD11 does this check. CALL FUNCTION 'SDU_SAA_CHECK' EXPORTING obj_name = me->ms_object_type-objname obj_type = me->ms_object_type-objtype EXCEPTIONS wrong_type = 01. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD serialize_entities. DATA lt_udmo_entities TYPE STANDARD TABLE OF dm41s WITH DEFAULT KEY. FIELD-SYMBOLS <ls_udmo_entity> TYPE dm41s. SELECT * FROM dm41s INTO TABLE lt_udmo_entities WHERE dmoid EQ me->mv_data_model AND as4local EQ me->mv_activation_state. LOOP AT lt_udmo_entities ASSIGNING <ls_udmo_entity>. " You are reminded that administrative information, such as last changed by user, date, time is not serialised. CLEAR <ls_udmo_entity>-lstuser. CLEAR <ls_udmo_entity>-lstdate. CLEAR <ls_udmo_entity>-lsttime. CLEAR <ls_udmo_entity>-fstuser. CLEAR <ls_udmo_entity>-fstdate. CLEAR <ls_udmo_entity>-fsttime. ENDLOOP. " You are reminded that descriptions in other languages do not have to be in existence, although they may. IF lines( lt_udmo_entities ) > 0. io_xml->add( iv_name = 'UDMO_ENTITIES' ig_data = lt_udmo_entities ). ENDIF. ENDMETHOD. METHOD serialize_long_texts. " The model has short texts in multiple languages. These are held in DM40T. " The model has a long description also in a master language, with other long descriptions " maintained as translations using SE63 Translation Editor. All of these long texts are held in DOK* TYPES BEGIN OF ls_language_type. TYPES language TYPE dm40t-sprache. TYPES END OF ls_language_type. DATA BEGIN OF ls_udmo_long_text. DATA language TYPE dm40t-sprache. DATA header TYPE thead. DATA content TYPE xstring. DATA END OF ls_udmo_long_text. DATA lt_udmo_long_texts LIKE STANDARD TABLE OF ls_udmo_long_text. DATA lt_udmo_languages TYPE STANDARD TABLE OF ls_language_type. DATA ls_udmo_language LIKE LINE OF lt_udmo_languages. DATA: lv_error_status TYPE lxestatprc. " In which languages are the short texts are maintained. SELECT sprache AS language FROM dm40t INTO TABLE lt_udmo_languages WHERE dmoid EQ me->mv_data_model AND as4local EQ me->mv_activation_state ORDER BY sprache ASCENDING. "#EC CI_NOFIRST " For every language for which a short text is maintained, LOOP AT lt_udmo_languages INTO ls_udmo_language. CLEAR ls_udmo_long_text. CLEAR lv_error_status. ls_udmo_long_text-language = ls_udmo_language-language. " You are reminded that this function gets the most recent version of the texts. CALL FUNCTION 'LXE_OBJ_DOKU_GET_XSTRING' EXPORTING lang = ls_udmo_language-language objtype = me->c_lxe_text_type objname = me->mv_lxe_text_name IMPORTING header = ls_udmo_long_text-header content = ls_udmo_long_text-content pstatus = lv_error_status. CHECK lv_error_status EQ 'S'. "Success " Administrative information is not serialised CLEAR ls_udmo_long_text-header-tdfuser. CLEAR ls_udmo_long_text-header-tdfdate. CLEAR ls_udmo_long_text-header-tdftime. CLEAR ls_udmo_long_text-header-tdluser. CLEAR ls_udmo_long_text-header-tdldate. CLEAR ls_udmo_long_text-header-tdltime. APPEND ls_udmo_long_text TO lt_udmo_long_texts. ENDLOOP. " You are reminded that long texts do not have to be in existence IF lines( lt_udmo_long_texts ) GT 0. io_xml->add( iv_name = 'UDMO_LONG_TEXTS' ig_data = lt_udmo_long_texts ). ENDIF. ENDMETHOD. METHOD serialize_model. DATA ls_dm40l TYPE dm40l. " See SDU_MODEL_GET. SELECT SINGLE * FROM dm40l INTO ls_dm40l WHERE dmoid EQ me->mv_data_model AND as4local EQ me->mv_activation_state. IF sy-subrc NE 0. zcx_abapgit_exception=>raise( 'error from UDMO - model serialisation' ). ENDIF. " You are reminded that administrative data is not serialised. CLEAR ls_dm40l-lstdate. CLEAR ls_dm40l-lsttime. CLEAR ls_dm40l-lstuser. CLEAR ls_dm40l-fstdate. CLEAR ls_dm40l-fsttime. CLEAR ls_dm40l-fstuser. io_xml->add( iv_name = 'DM40L' ig_data = ls_dm40l ). ENDMETHOD. METHOD serialize_short_texts. DATA lt_udmo_texts TYPE STANDARD TABLE OF ty_udmo_text_type WITH DEFAULT KEY. " You are reminded that administrative information, such as last changed by user, date, time is not serialised. " You are reminded that active short texts of all (existent) languages are serialised. SELECT sprache dmoid as4local langbez FROM dm40t INTO CORRESPONDING FIELDS OF TABLE lt_udmo_texts WHERE dmoid EQ me->mv_data_model AND as4local EQ me->mv_activation_state ORDER BY sprache ASCENDING. "#EC CI_NOFIRST " You are reminded that descriptions in other languages do not have to be in existence. IF lines( lt_udmo_texts ) GT 0. io_xml->add( iv_name = 'UDMO_TEXTS' ig_data = lt_udmo_texts ). ENDIF. ENDMETHOD. METHOD update_tree. CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT' EXPORTING object = me->mv_data_model operation = 'INSERT' type = me->c_correction_object_type. ENDMETHOD. METHOD zif_abapgit_object~changed_by. SELECT SINGLE lstuser INTO rv_user FROM dm40l WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state. IF sy-subrc NE 0. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. * You are reminded that this function model checks for * - permissions * - locks * - connection to transport and correction system * - deletion of data model, model relations and all documentation * - update of object tree * - releasing of lock CALL FUNCTION 'RPY_DATAMODEL_DELETE' EXPORTING model_name = me->mv_data_model EXCEPTIONS cancelled = 1 permission_error = 2 not_found = 3 is_used = 4 OTHERS = 5. IF sy-subrc NE 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~deserialize. * You are reminded that this method checks for * - validity of data model name with regard to naming conventions * - permissions and locks * - connection to transport and correction system * - insert of data model, model relations and all documentation * - update of object tree * - releasing of lock * Is the data model name compliant with naming conventions? is_name_permitted( ). * Access Permission granted? access_modify( ). * Connection to transport and correction system corr_insert( iv_package ). * Insert the data model, relations and documentation TRY. deserialize_model( io_xml ). deserialize_entities( io_xml ). deserialize_short_texts( io_xml ). deserialize_long_texts( io_xml ). update_tree( ). access_free( ). CATCH zcx_abapgit_exception. me->access_free( ). zcx_abapgit_exception=>raise( 'Error in deserialisation of UDMO' ). ENDTRY. " You are reminded that data models are not relevant for activation. ENDMETHOD. METHOD zif_abapgit_object~exists. " See Function Module SDU_MODEL_EXISTS SELECT COUNT( * ) FROM dm40l WHERE dmoid = me->mv_data_model AND as4local = me->mv_activation_state. rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESDUM' iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. " The function module listed below do not open a new window - so we revert to BDC. " CALL FUNCTION 'SDU_MODEL_SHOW' " CALL FUNCTION 'RS_TOOL_ACCESS' DATA lt_bdcdata TYPE TABLE OF bdcdata. FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-program = 'SAPMUD00'. <ls_bdcdata>-dynpro = '0100'. <ls_bdcdata>-dynbegin = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'BDC_OKCODE'. <ls_bdcdata>-fval = '=SHOW'. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'RSUD3-DATM'. <ls_bdcdata>-fval = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'RSUD3-OBJ_KEY'. <ls_bdcdata>-fval = ms_item-obj_name. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SD11' mode_val = 'E' TABLES using_tab = lt_bdcdata EXCEPTIONS system_failure = 1 communication_failure = 2 resource_failure = 3 OTHERS = 4 ##fm_subrc_ok. "#EC CI_SUBRC ENDMETHOD. METHOD zif_abapgit_object~serialize. IF zif_abapgit_object~exists( ) = abap_false. RETURN. ENDIF. serialize_model( io_xml ). me->serialize_entities( io_xml ). me->serialize_short_texts( io_xml ). me->serialize_long_texts( io_xml ). ENDMETHOD. ENDCLASS.
27.497389
117
0.66586