hexsha
stringlengths 40
40
| size
int64 16
758k
| ext
stringclasses 1
value | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 6
146
| max_stars_repo_name
stringlengths 8
73
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
2
| max_stars_count
int64 1
17.3k
⌀ | max_stars_repo_stars_event_min_datetime
stringclasses 530
values | max_stars_repo_stars_event_max_datetime
stringclasses 529
values | max_issues_repo_path
stringlengths 6
146
| max_issues_repo_name
stringlengths 8
73
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
2
| max_issues_count
int64 1
3.24k
⌀ | max_issues_repo_issues_event_min_datetime
stringclasses 350
values | max_issues_repo_issues_event_max_datetime
stringclasses 350
values | max_forks_repo_path
stringlengths 6
146
| max_forks_repo_name
stringlengths 8
73
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
2
| max_forks_count
int64 1
4.6k
⌀ | max_forks_repo_forks_event_min_datetime
stringclasses 388
values | max_forks_repo_forks_event_max_datetime
stringclasses 388
values | content
stringlengths 16
758k
| avg_line_length
float64 4.13
40.4k
| max_line_length
int64 9
40.4k
| alphanum_fraction
float64 0.04
0.97
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
35b50e079e0f012f6a34d065e21fb2d63ec12821
| 41,413 |
abap
|
ABAP
|
src/#hec1#cl_config_action_app_se.clas.abap
|
kasimirkrass/HEC_GH
|
67b99b294e39fc883d633cd564920e6fa8ec8075
|
[
"Unlicense"
] | null | null | null |
src/#hec1#cl_config_action_app_se.clas.abap
|
kasimirkrass/HEC_GH
|
67b99b294e39fc883d633cd564920e6fa8ec8075
|
[
"Unlicense"
] | null | null | null |
src/#hec1#cl_config_action_app_se.clas.abap
|
kasimirkrass/HEC_GH
|
67b99b294e39fc883d633cd564920e6fa8ec8075
|
[
"Unlicense"
] | null | null | null |
CLASS /hec1/cl_config_action_app_se DEFINITION
PUBLIC
INHERITING FROM /HEC1/CL_LIB_A_SUPERCLASS
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS /bobf/if_frw_action~execute
REDEFINITION .
PROTECTED SECTION.
private section.
data MR_ACT_PARAM_DELETE type ref to DATA .
data MR_ACT_PARAM_CREATE type ref to DATA .
methods DO_SYNCHRONIZE_APP_NODE
importing
!IS_CTX type /BOBF/S_FRW_CTX_ACT
!IT_KEY type /BOBF/T_FRW_KEY
!IO_READ type ref to /BOBF/IF_FRW_READ
!IO_MODIFY type ref to /BOBF/IF_FRW_MODIFY
!IS_PARAMETERS type ref to DATA
exporting
!EO_MESSAGE type ref to /BOBF/IF_FRW_MESSAGE
!ET_FAILED_KEY type /BOBF/T_FRW_KEY
!EV_STATIC_ACTION_FAILED type ABAP_BOOL
!ET_DATA type INDEX TABLE
!ET_DATA_LINK type /BOBF/T_FRW_ACT_EXP_DATA_LINK
raising
/BOBF/CX_FRW .
methods RESET_APP_BACKUP
importing
!IS_CTX type /BOBF/S_FRW_CTX_ACT
!IT_KEY type /BOBF/T_FRW_KEY
!IO_READ type ref to /BOBF/IF_FRW_READ
!IO_MODIFY type ref to /BOBF/IF_FRW_MODIFY
!IS_PARAMETERS type ref to DATA
exporting
!EO_MESSAGE type ref to /BOBF/IF_FRW_MESSAGE
!ET_FAILED_KEY type /BOBF/T_FRW_KEY
!EV_STATIC_ACTION_FAILED type ABAP_BOOL
!ET_DATA type INDEX TABLE
!ET_DATA_LINK type /BOBF/T_FRW_ACT_EXP_DATA_LINK
raising
/BOBF/CX_FRW .
methods RESET_APP_NODE
importing
!IS_CTX type /BOBF/S_FRW_CTX_ACT
!IT_KEY type /BOBF/T_FRW_KEY
!IO_READ type ref to /BOBF/IF_FRW_READ
!IO_MODIFY type ref to /BOBF/IF_FRW_MODIFY
!IS_PARAMETERS type ref to DATA
exporting
!EO_MESSAGE type ref to /BOBF/IF_FRW_MESSAGE
!ET_FAILED_KEY type /BOBF/T_FRW_KEY
!EV_STATIC_ACTION_FAILED type ABAP_BOOL
!ET_DATA type INDEX TABLE
!ET_DATA_LINK type /BOBF/T_FRW_ACT_EXP_DATA_LINK
raising
/BOBF/CX_FRW .
methods RESET_APP_SERVER
importing
!IS_CTX type /BOBF/S_FRW_CTX_ACT
!IT_KEY type /BOBF/T_FRW_KEY
!IO_READ type ref to /BOBF/IF_FRW_READ
!IO_MODIFY type ref to /BOBF/IF_FRW_MODIFY
!IS_PARAMETERS type ref to DATA
exporting
!EO_MESSAGE type ref to /BOBF/IF_FRW_MESSAGE
!ET_FAILED_KEY type /BOBF/T_FRW_KEY
!EV_STATIC_ACTION_FAILED type ABAP_BOOL
!ET_DATA type INDEX TABLE
!ET_DATA_LINK type /BOBF/T_FRW_ACT_EXP_DATA_LINK
raising
/BOBF/CX_FRW .
methods RESET_APP_SERVER_INSTANCE
importing
!IS_CTX type /BOBF/S_FRW_CTX_ACT
!IT_KEY type /BOBF/T_FRW_KEY
!IO_READ type ref to /BOBF/IF_FRW_READ
!IO_MODIFY type ref to /BOBF/IF_FRW_MODIFY
!IS_PARAMETERS type ref to DATA
exporting
!EO_MESSAGE type ref to /BOBF/IF_FRW_MESSAGE
!ET_FAILED_KEY type /BOBF/T_FRW_KEY
!EV_STATIC_ACTION_FAILED type ABAP_BOOL
!ET_DATA type INDEX TABLE
!ET_DATA_LINK type /BOBF/T_FRW_ACT_EXP_DATA_LINK
raising
/BOBF/CX_FRW .
methods RESET_APP_SERVER_PC
importing
!IS_CTX type /BOBF/S_FRW_CTX_ACT
!IT_KEY type /BOBF/T_FRW_KEY
!IO_READ type ref to /BOBF/IF_FRW_READ
!IO_MODIFY type ref to /BOBF/IF_FRW_MODIFY
!IS_PARAMETERS type ref to DATA
exporting
!EO_MESSAGE type ref to /BOBF/IF_FRW_MESSAGE
!ET_FAILED_KEY type /BOBF/T_FRW_KEY
!EV_STATIC_ACTION_FAILED type ABAP_BOOL
!ET_DATA type INDEX TABLE
!ET_DATA_LINK type /BOBF/T_FRW_ACT_EXP_DATA_LINK
raising
/BOBF/CX_FRW .
methods RESET_APP_STORAGE
importing
!IS_CTX type /BOBF/S_FRW_CTX_ACT
!IT_KEY type /BOBF/T_FRW_KEY
!IO_READ type ref to /BOBF/IF_FRW_READ
!IO_MODIFY type ref to /BOBF/IF_FRW_MODIFY
!IS_PARAMETERS type ref to DATA
exporting
!EO_MESSAGE type ref to /BOBF/IF_FRW_MESSAGE
!ET_FAILED_KEY type /BOBF/T_FRW_KEY
!EV_STATIC_ACTION_FAILED type ABAP_BOOL
!ET_DATA type INDEX TABLE
!ET_DATA_LINK type /BOBF/T_FRW_ACT_EXP_DATA_LINK
raising
/BOBF/CX_FRW .
ENDCLASS.
CLASS /HEC1/CL_CONFIG_ACTION_APP_SE IMPLEMENTATION.
METHOD /bobf/if_frw_action~execute.
TRY.
CASE is_ctx-act_key.
" **********************************
" App node Synchronize configuration
" App cluster type: HA
" **********************************
WHEN /hec1/if_configuration_c=>sc_action-app_node-sync_config.
me->do_synchronize_app_node( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING eo_message = eo_message
et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link ).
" **********************************
" Reset App Server Instance
" **********************************
WHEN /hec1/if_configuration_c=>sc_action-app_server_instance-reset_server_instance
OR /hec1/if_configuration_c=>sc_action-app_server_instance-reset_operating_system
OR /hec1/if_configuration_c=>sc_action-app_server_instance-modify_cluster_type.
me->reset_app_server_instance( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING eo_message = eo_message
et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link ).
" **********************************
" Reset App Server Node
" **********************************
WHEN /hec1/if_configuration_c=>sc_action-app_node-reset_ha_info_prov_date OR
/hec1/if_configuration_c=>sc_action-app_node-modify_ha_type_prov_date OR
/hec1/if_configuration_c=>sc_action-app_node-reset_ha_type.
me->reset_app_node( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING eo_message = eo_message
et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link ).
" **********************************
" Reset App Server Performance Category
" **********************************
WHEN /hec1/if_configuration_c=>sc_action-app_server_perform_cat-reset_server_pc.
me->reset_app_server_pc( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING eo_message = eo_message
et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link ).
" **********************************
" Reset App Server
" **********************************
WHEN /hec1/if_configuration_c=>sc_action-app_server-reset_server.
me->reset_app_server( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING eo_message = eo_message
et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link ).
" **********************************
" Reset App Storage
" **********************************
WHEN /hec1/if_configuration_c=>sc_action-app_storage-reset_storage.
me->reset_app_storage( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING eo_message = eo_message
et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link ).
" **********************************
" Reset App Backup
" **********************************
WHEN /hec1/if_configuration_c=>sc_action-app_storage_backup-reset_backup.
me->reset_app_backup( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING eo_message = eo_message
et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link ).
ENDCASE.
CATCH /bobf/cx_frw. " Exception class
ENDTRY.
ENDMETHOD.
METHOD do_synchronize_app_node.
CLEAR: eo_message,
et_failed_key,
ev_static_action_failed,
et_data,
et_data_link.
" Disable determinations
/hec1/cl_lib_d_superclass=>set_switch( abap_false ).
/hec1/cl_config_action_helper=>/hec1/if_bopf_action_helper~do_synchronize_app_node( EXPORTING is_ctx = is_ctx
it_key = it_key
io_read = io_read
io_modify = io_modify
is_parameters = is_parameters
IMPORTING et_failed_key = et_failed_key
ev_static_action_failed = ev_static_action_failed
et_data = et_data
et_data_link = et_data_link
CHANGING co_message = eo_message ).
" Enabale determinations
/hec1/cl_lib_d_superclass=>set_switch( abap_true ).
ENDMETHOD.
METHOD reset_app_backup.
DATA: lt_app_backup TYPE /hec1/t_data_app_backup_ct.
CLEAR: eo_message,
et_failed_key.
io_read->retrieve( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
IMPORTING et_data = lt_app_backup ).
TRY.
DATA(lr_app_backup) = NEW /hec1/s_data_app_backup_cs( lt_app_backup[ 1 ] ).
CATCH cx_sy_itab_line_not_found.
RETURN. ">>>
ENDTRY.
CLEAR: lr_app_backup->price,
lr_app_backup->hec_backup_month_price_fee,
lr_app_backup->hec_backup_class_descr,
lr_app_backup->hec_backup_class_guid,
lr_app_backup->hec_tree_descr.
io_modify->update( iv_node = is_ctx-node_key
iv_key = lr_app_backup->key
is_data = lr_app_backup ).
ENDMETHOD.
METHOD reset_app_server.
DATA: lt_app_server TYPE /hec1/t_data_app_serv_ct,
lt_app_storage TYPE /hec1/t_data_app_storage_ct,
lt_modification TYPE /bobf/t_frw_modification.
CLEAR: eo_message,
et_failed_key.
io_read->retrieve( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
IMPORTING et_data = lt_app_server ).
" Get App Storage
io_read->retrieve_by_association( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
iv_fill_data = abap_true
iv_association = /hec1/if_configuration_c=>sc_association-app_server-app_storage
IMPORTING et_data = lt_app_storage ).
TRY.
DATA(lr_app_server) = REF /hec1/s_data_app_serv_cs( lt_app_server[ 1 ] ).
CATCH cx_sy_itab_line_not_found.
RETURN. ">>>>>
ENDTRY.
CLEAR: lr_app_server->hec_ip_server_descr,
lr_app_server->hec_ip_server_guid,
lr_app_server->hec_host_type_descr,
lr_app_server->hec_host_type_value,
lr_app_server->hec_srv_ram_size,
lr_app_server->hec_srv_cpu_size,
lr_app_server->hec_sec_datacenter_guid,
lr_app_server->hec_srv_main_storage_qty,
lr_app_server->hec_tree_descr,
lr_app_server->hec_as_flavour,
lr_app_server->hec_saps,
lr_app_server->hec_approval_needed,
lr_app_server->price.
lr_app_server->hec_ip_server_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
INSERT VALUE #( data = lr_app_server
node = /hec1/if_configuration_c=>sc_node-app_server
change_mode = /bobf/if_frw_c=>sc_modify_update
key = lr_app_server->key
) INTO TABLE lt_modification.
LOOP AT lt_app_storage REFERENCE INTO DATA(lr_app_storage).
CLEAR: lr_app_storage->hec_ip_storage_guid,
lr_app_storage->hec_storage_descr,
lr_app_storage->hec_month_price_fee,
lr_app_storage->hec_tree_descr,
lr_app_storage->price.
lr_app_storage->hec_ip_storage_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
INSERT VALUE #( data = lr_app_storage
node = /hec1/if_configuration_c=>sc_node-app_storage
change_mode = /bobf/if_frw_c=>sc_modify_update
key = lr_app_storage->key
) INTO TABLE lt_modification.
ENDLOOP. "lt_app_storage
"-----------------------------------
" Do Modify
"-----------------------------------
IF lt_modification IS NOT INITIAL.
io_modify->do_modify( lt_modification ).
io_modify->end_modify( EXPORTING iv_process_immediately = abap_true
IMPORTING eo_message = DATA(lo_message) ).
ENDIF.
ENDMETHOD.
METHOD reset_app_server_instance.
DATA: lt_app_server_instance TYPE /hec1/t_data_app_serv_inst_ct,
ls_action_param TYPE /hec1/s_act_import_parameter, "parameters
lt_solution TYPE /hec1/t_data_solution_ct,
lt_landscape TYPE /hec1/t_config_root_ct,
lt_app_node TYPE /hec1/t_data_app_node_ct,
lt_modification TYPE /bobf/t_frw_modification,
lt_act_param_delete TYPE /bobf/t_frw_node,
lt_act_param_create TYPE /hec1/t_act_create_app_node.
CLEAR: eo_message,
et_failed_key.
io_read->retrieve( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
IMPORTING et_data = lt_app_server_instance ).
" Get App Nodes
io_read->retrieve_by_association( EXPORTING iv_node = /hec1/if_configuration_c=>sc_node-app_server_instance
it_key = it_key
iv_fill_data = abap_true
iv_association = /hec1/if_configuration_c=>sc_association-app_server_instance-app_node
IMPORTING et_data = lt_app_node ).
TRY.
DATA(lr_app_server_instance) = REF /hec1/s_data_app_serv_inst_cs( lt_app_server_instance[ 1 ] ).
CATCH cx_sy_itab_line_not_found.
RETURN. ">>>>
ENDTRY.
CASE is_ctx-act_key.
WHEN /hec1/if_configuration_c=>sc_action-app_server_instance-reset_operating_system
OR /hec1/if_configuration_c=>sc_action-app_server_instance-reset_server_instance.
" ***********************
" Reset Operating System
"
" these fields are also
" cleared when the app
" server instance is
" reset
" ***********************
CLEAR: lr_app_server_instance->hec_sol_apsi_oper_sys_guid,
lr_app_server_instance->hec_operating_sys_guid,
lr_app_server_instance->hec_operating_sys_value,
lr_app_server_instance->hec_operating_sys_descr,
lr_app_server_instance->hec_os_support_stat_value,
lr_app_server_instance->hec_os_support_stat_descr,
"clear os image (technical field)
lr_app_server_instance->hec_asi_opsys_image,
lr_app_server_instance->hec_asi_opsys_image_val,
"clear patch level (technical field)
lr_app_server_instance->hec_asi_patch_level_descr,
lr_app_server_instance->hec_asi_patch_level_guid,
lr_app_server_instance->hec_asi_patch_level_value,
lr_app_server_instance->hec_os_support_stat_value,
lr_app_server_instance->hec_os_support_stat_descr.
lr_app_server_instance->hec_sol_apsi_oper_sys_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
lr_app_server_instance->hec_asi_opsys_image_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
lr_app_server_instance->hec_asi_patch_level_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
DATA(lv_changed) = abap_true.
IF is_ctx-act_key = /hec1/if_configuration_c=>sc_action-app_server_instance-reset_server_instance.
" **********************************
" Reset App Server Instance
" **********************************
" Here all nodes are deleted
CLEAR: lr_app_server_instance->hec_sol_tier_stack_si_guid,
lr_app_server_instance->hec_sol_tier_asi_descr,
" cluster type
lr_app_server_instance->hec_app_cluster_type_value,
lr_app_server_instance->hec_app_cluster_type_descr,
lr_app_server_instance->hec_app_cluster_type_guid,
lr_app_server_instance->hec_sol_apsi_clusttyp_guid,
lr_app_server_instance->hec_clu_support_stat_value,
lr_app_server_instance->hec_clu_support_stat_descr,
lr_app_server_instance->hec_tree_descr.
lr_app_server_instance->hec_sol_tier_stack_si_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
lr_app_server_instance->hec_sol_apsi_clusttyp_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
"delete all nodes underneath
LOOP AT lt_app_node REFERENCE INTO DATA(lr_app_node).
" Delete DB Node
INSERT VALUE #( node = /hec1/if_configuration_c=>sc_node-app_node
key = lr_app_node->key ) INTO TABLE lt_act_param_delete.
ENDLOOP.
lv_changed = abap_true.
ENDIF. " app server instance is changed
" **************************
" Modify Cluster Type
" **************************
WHEN /hec1/if_configuration_c=>sc_action-app_server_instance-modify_cluster_type.
" Get Landscape
io_read->retrieve_by_association( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
iv_association = /hec1/if_configuration_c=>sc_association-app_server_instance-to_root
iv_fill_data = abap_true
IMPORTING et_data = lt_landscape ).
" Get Solution
io_read->retrieve_by_association( EXPORTING iv_node = /hec1/if_configuration_c=>sc_node-app_server_instance
it_key = it_key
iv_fill_data = abap_false
iv_association = /hec1/if_configuration_c=>sc_association-app_server_instance-to_parent
IMPORTING et_target_key = DATA(lt_solution_key) ).
io_read->retrieve_by_association( EXPORTING iv_node = /hec1/if_configuration_c=>sc_node-tier
it_key = lt_solution_key
iv_fill_data = abap_true
iv_association = /hec1/if_configuration_c=>sc_association-tier-to_parent
IMPORTING et_data = lt_solution ).
" Master node will always stay. Depending on the cluster type another node will be added or removed.
ASSIGN is_parameters->* TO FIELD-SYMBOL(<fs_parameters>).
IF <fs_parameters> IS ASSIGNED.
ls_action_param = <fs_parameters>. "#EC CI_FLDEXT_OK[2215424]
TRY.
DATA(lv_clusttyp_guid) = ls_action_param-name_value[ fieldname = /hec1/if_configuration_c=>sc_node_attribute-app_server_instance-hec_sol_apsi_clusttyp_guid ]-value.
CATCH cx_sy_itab_line_not_found.
ENDTRY.
ENDIF. "<fs_parameters> is assigned.
" get results from decision table (TODO: move to determination)
DATA(ls_landscape) = VALUE #( lt_landscape[ 1 ] OPTIONAL ).
SELECT SINGLE *
FROM /hec1/i_appclustertypebasic
INTO @DATA(ls_fdt_cluster_type)
WHERE hec_apm_guid = @ls_landscape-hec_apm_guid
AND hec_sol_tier_stack_si_guid = @lr_app_server_instance->hec_sol_tier_stack_si_guid "ls_app_server_inst_param-hec_sol_tier_stack_si_guid
AND hec_sol_apsi_clusttyp_guid = @lv_clusttyp_guid. "ls_app_server_inst_param-hec_sol_apsi_clusttyp_guid.
lr_app_server_instance->hec_sol_apsi_clusttyp_guid = ls_fdt_cluster_type-hec_sol_apsi_clusttyp_guid.
lr_app_server_instance->hec_app_serv_type_clust_guid = ls_fdt_cluster_type-hec_app_serv_type_clust_guid.
lr_app_server_instance->hec_app_cluster_type_value = ls_fdt_cluster_type-hec_app_cluster_type_value.
lr_app_server_instance->hec_app_cluster_type_descr = ls_fdt_cluster_type-hec_app_cluster_type_descr.
lv_changed = abap_true.
* " get new node quantities from cluster node type
SELECT * "#EC CI_ALL_FIELDS_NEEDED
FROM /hec1/i_appclustnodetypebasic
INTO TABLE @DATA(lt_fdt_cluster_node_type)
WHERE hec_apm_guid = @ls_landscape-hec_apm_guid
AND hec_app_serv_type_clust_guid = @lr_app_server_instance->hec_app_serv_type_clust_guid.
" Get default master app node (relevant for adding nodes)
DATA(lr_app_node_master) = NEW /hec1/s_data_app_node_cs( lt_app_node[ hec_app_clust_node_type_value = /hec1/if_config_constants=>gc_app_clust_node_type-master "#EC CI_SORTSEQ
hec_master_default = abap_true ] ).
" set quantity of node types and determine how many nodes need to be added and deleted
" The result from the decision table contains one line for each required app node. The node type for each line defines the node type for the app node
" A comparison needs to be made to see which nodes need to be added or removed. The master node will always stay
* DATA(lv_master_node_lines) = lines( VALUE /hec1/t_data_app_node_ct( FOR wa IN lt_app_node
* WHERE ( hec_app_clust_node_type_value = /hec1/if_config_constants=>gc_app_clust_node_type-master )
* ( wa ) ) ).
SELECT COUNT( * )
FROM @lt_fdt_cluster_node_type AS clust_node_type
WHERE hec_app_clust_node_type_value = @/hec1/if_config_constants=>gc_app_clust_node_type-standby
INTO @DATA(lv_standby_node_lines_req).
DATA(lv_standby_node_lines_is) = lines( VALUE /hec1/t_data_app_node_ct( FOR app_node IN lt_app_node
WHERE ( hec_app_clust_node_type_value = /hec1/if_config_constants=>gc_app_clust_node_type-standby )
( app_node ) ) ).
" ************
" delete node
" ************
IF lv_standby_node_lines_is GT lv_standby_node_lines_req.
DATA(lv_delete_counter) = 0.
SORT lt_app_node DESCENDING. "Delete, starting with latest
LOOP AT lt_app_node REFERENCE INTO lr_app_node
WHERE hec_app_clust_node_type_value = /hec1/if_config_constants=>gc_app_clust_node_type-standby.
IF lv_delete_counter GE ( lv_standby_node_lines_is - lv_standby_node_lines_req ).
CONTINUE. ">>>
ENDIF.
" Delete DB Node
INSERT VALUE #( node = /hec1/if_configuration_c=>sc_node-app_node
key = lr_app_node->key ) INTO TABLE lt_act_param_delete.
ADD 1 TO lv_delete_counter.
ENDLOOP.
lr_app_server_instance->hec_app_standby_node_qty = lv_standby_node_lines_req.
" *********
" add node
" *********
ELSEIF lv_standby_node_lines_is LT lv_standby_node_lines_req.
DATA(ls_fdt_clust_node_type) = VALUE #( lt_fdt_cluster_node_type[ hec_app_clust_node_type_value = /hec1/if_config_constants=>gc_app_clust_node_type-standby ] OPTIONAL ).
DO ( lv_standby_node_lines_req - lv_standby_node_lines_is ) TIMES.
"-----------------------------------
" Fill action table for
" create App node
"-----------------------------------
INSERT VALUE #( key = lr_app_server_instance->key
parent_key = lr_app_server_instance->parent_key
hec_app_cluster_type_value = SWITCH #( lr_app_server_instance->hec_app_cluster_type_value
WHEN /hec1/if_config_constants=>gc_app_clust_node-none
THEN /hec1/if_config_constants=>gc_app_clust_node-none
WHEN /hec1/if_config_constants=>gc_app_clust_node-ha
THEN /hec1/if_config_constants=>gc_app_clust_node-ha
ELSE /hec1/if_config_constants=>gc_app_clust_node-none )
hec_default_app_server = lr_app_server_instance->hec_default_app_server_inst
) INTO TABLE lt_act_param_create.
ENDDO.
lr_app_server_instance->hec_app_standby_node_qty = lv_standby_node_lines_req.
ENDIF.
ENDCASE. "action
IF lv_changed = abap_true.
INSERT VALUE #( data = lr_app_server_instance
node = is_ctx-node_key
change_mode = /bobf/if_frw_c=>sc_modify_update
key = lr_app_server_instance->key
) INTO TABLE lt_modification.
ENDIF.
"-----------------------------------
" Set delete action
" to GENERAL
"-----------------------------------
IF lt_act_param_delete IS NOT INITIAL.
me->mr_act_param_delete = NEW /bobf/t_frw_node( lt_act_param_delete ).
/hec1/cl_config_det_general=>/hec1/if_config_det_general~set_act_node_keys(
is_ctx = CORRESPONDING #( is_ctx )
it_key = it_key
iv_action = /hec1/cl_config_det_general=>/hec1/if_config_det_general~get_act_key( /hec1/if_config_constant=>gc_act_method-delete_node )
iv_act_exectime = /bobf/if_conf_c=>sc_time_after_validation
ir_act_param = me->mr_act_param_delete ).
ENDIF.
"-----------------------------------
" Set create DB/App server instance
" action to general
"-----------------------------------
IF lt_act_param_create IS NOT INITIAL.
CLEAR me->mr_act_param_create.
me->mr_act_param_create = NEW /hec1/t_act_create_app_node( lt_act_param_create ).
/hec1/cl_config_det_general=>/hec1/if_config_det_general~set_act_node_keys(
is_ctx = CORRESPONDING #( is_ctx )
it_key = it_key
iv_action = /hec1/cl_config_det_general=>/hec1/if_config_det_general~get_act_key( /hec1/if_config_constant=>gc_act_method-create_app_node )
iv_act_exectime = /bobf/if_conf_c=>sc_time_after_validation
ir_act_param = me->mr_act_param_create ).
ENDIF.
"-----------------------------------
" Do Modify
"-----------------------------------
IF lt_modification IS NOT INITIAL.
io_modify->do_modify( lt_modification ).
io_modify->end_modify( EXPORTING iv_process_immediately = abap_true
IMPORTING eo_message = DATA(lo_message) ).
ENDIF.
" TODO: Update Tree Selectability
ENDMETHOD.
METHOD reset_app_server_pc.
" If the app server performance category is reset, all the nodes below it also need to be reset:
" - app storage qty (this does not need to be adjusted separately as the determination triggers an update
" - app storage
" - app server
" if there is only one possible entry for storage or server, that entry is preset
DATA: lt_app_server_pc TYPE /hec1/t_data_app_serv_pc_ct,
lt_app_server TYPE /hec1/t_data_app_serv_ct,
lt_app_storage TYPE /hec1/t_data_app_storage_ct,
lt_modification TYPE /bobf/t_frw_modification.
CLEAR: eo_message,
et_failed_key.
io_read->retrieve( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
IMPORTING et_data = lt_app_server_pc ).
" Get App Server
io_read->retrieve_by_association( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
iv_fill_data = abap_true
iv_association = /hec1/if_configuration_c=>sc_association-app_server_perform_cat-app_server
IMPORTING et_data = lt_app_server
et_target_key = DATA(lt_app_server_key) ).
" Get App Storage
io_read->retrieve_by_association( EXPORTING iv_node = /hec1/if_configuration_c=>sc_node-app_server
it_key = lt_app_server_key
iv_fill_data = abap_true
iv_association = /hec1/if_configuration_c=>sc_association-app_server-app_storage
IMPORTING et_data = lt_app_storage ).
TRY.
DATA(lr_app_server_pc) = REF #( lt_app_server_pc[ 1 ] ).
CATCH cx_sy_itab_line_not_found.
RETURN. ">>>>>
ENDTRY.
CLEAR: lr_app_server_pc->hec_srv_perf_cat_guid,
lr_app_server_pc->hec_srv_perf_cat_descr,
lr_app_server_pc->hec_srv_cpu_class,
lr_app_server_pc->hec_srv_ram_class,
lr_app_server_pc->price,
lr_app_server_pc->hec_tree_descr.
lr_app_server_pc->hec_srv_perf_cat_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
INSERT VALUE #( data = lr_app_server_pc
node = is_ctx-node_key
change_mode = /bobf/if_frw_c=>sc_modify_update
key = lr_app_server_pc->key
) INTO TABLE lt_modification.
" there is only one server in each server performance category
LOOP AT lt_app_server REFERENCE INTO DATA(lr_app_server).
CLEAR: lr_app_server->hec_ip_server_descr,
lr_app_server->hec_ip_server_guid,
lr_app_server->hec_host_type_descr,
lr_app_server->hec_host_type_value,
lr_app_server->hec_srv_ram_size,
lr_app_server->hec_srv_cpu_size,
lr_app_server->hec_sec_datacenter_guid,
lr_app_server->hec_srv_main_storage_qty,
lr_app_server->hec_tree_descr,
lr_app_server->hec_as_flavour,
lr_app_server->hec_saps,
lr_app_server->hec_approval_needed,
lr_app_server->price.
lr_app_server->hec_ip_server_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
INSERT VALUE #( data = lr_app_server
node = /hec1/if_configuration_c=>sc_node-app_server
change_mode = /bobf/if_frw_c=>sc_modify_update
key = lr_app_server->key
) INTO TABLE lt_modification.
ENDLOOP. "lt_app_server
" All Storages need to be updated
LOOP AT lt_app_storage REFERENCE INTO DATA(lr_app_storage).
CLEAR: lr_app_storage->hec_ip_storage_guid,
lr_app_storage->hec_storage_descr,
lr_app_storage->hec_month_price_fee,
lr_app_storage->hec_tree_descr,
lr_app_storage->price.
lr_app_storage->hec_ip_storage_vlqt = /hec1/if_config_constants=>gc_value_list_quantity-multi.
INSERT VALUE #( data = lr_app_storage
node = /hec1/if_configuration_c=>sc_node-app_storage
change_mode = /bobf/if_frw_c=>sc_modify_update
key = lr_app_storage->key
) INTO TABLE lt_modification.
ENDLOOP. "lt_app_storage
"-----------------------------------
" Do Modify
"-----------------------------------
IF lt_modification IS NOT INITIAL.
io_modify->do_modify( lt_modification ).
io_modify->end_modify( EXPORTING iv_process_immediately = abap_true
IMPORTING eo_message = DATA(lo_message) ).
ENDIF.
ENDMETHOD.
METHOD reset_app_storage.
DATA: lt_app_storage TYPE /hec1/t_data_app_storage_ct.
CLEAR: eo_message,
et_failed_key.
" **********************************
" Check instance status and switch
" **********************************
io_read->retrieve( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
IMPORTING et_data = lt_app_storage ).
TRY.
DATA(lr_app_storage) = REF #( lt_app_storage[ 1 ] ).
CATCH cx_sy_itab_line_not_found.
RETURN. ">>>>
ENDTRY.
CLEAR: lr_app_storage->hec_ip_storage_guid,
lr_app_storage->hec_storage_descr,
lr_app_storage->price,
lr_app_storage->hec_tree_descr.
io_modify->update( iv_node = is_ctx-node_key
iv_key = lr_app_storage->key
is_data = lr_app_storage ).
ENDMETHOD.
METHOD reset_app_node.
DATA: lt_app_node TYPE /hec1/t_data_app_node_ct,
lt_modification TYPE /bobf/t_frw_modification.
CLEAR: eo_message,
et_failed_key.
" Get data
io_read->retrieve( EXPORTING iv_node = is_ctx-node_key
it_key = it_key
IMPORTING et_data = lt_app_node ).
LOOP AT lt_app_node REFERENCE INTO DATA(lr_app_node).
CASE is_ctx-act_key.
WHEN /hec1/if_configuration_c=>sc_action-app_node-reset_ha_info_prov_date.
CLEAR: lr_app_node->hec_ha_inf_prov_date,
lr_app_node->hec_ha_info_guid,
lr_app_node->hec_ha_category_value,
lr_app_node->hec_ha_category_descr,
lr_app_node->hec_spc_inst_feature_value,
lr_app_node->hec_spc_inst_feature_descr.
WHEN /hec1/if_configuration_c=>sc_action-app_node-modify_ha_type_prov_date OR
/hec1/if_configuration_c=>sc_action-app_node-reset_ha_type.
IF is_ctx-act_key = /hec1/if_configuration_c=>sc_action-app_node-modify_ha_type_prov_date.
CLEAR lr_app_node->hec_ha_type_prov_date.
ENDIF.
CLEAR: lr_app_node->hec_ha_type_guid,
lr_app_node->hec_ha_type_value,
lr_app_node->hec_ha_type_descr,
lr_app_node->hec_ha_type_curr_suppstat_guid,
lr_app_node->hec_ha_type_curr_suppstat_val,
lr_app_node->hec_ha_type_curr_suppstat_desc.
ENDCASE.
" Fill modification table
INSERT VALUE #( data = lr_app_node
node = /hec1/if_configuration_c=>sc_node-app_node
change_mode = /bobf/if_frw_c=>sc_modify_update
key = lr_app_node->key ) INTO TABLE lt_modification.
ENDLOOP.
"-----------------------------------
" Do Modify
"-----------------------------------
IF lt_modification IS NOT INITIAL.
io_modify->do_modify( lt_modification ).
io_modify->end_modify( EXPORTING iv_process_immediately = abap_true
IMPORTING eo_message = DATA(lo_message) ).
ENDIF.
ENDMETHOD.
ENDCLASS.
| 46.116927 | 182 | 0.541279 |
35b5c5f6ec6847221ec536191eebbdbf81c262af
| 4,540 |
abap
|
ABAP
|
zaoc_01v1.prog.abap
|
larshp/abap101_AOC2017
|
0fd5393776cb2b7ae23914678f0276cf69e6e73d
|
[
"MIT"
] | 3 |
2017-12-15T01:13:35.000Z
|
2020-08-18T15:18:09.000Z
|
zaoc_01v1.prog.abap
|
larshp/abap101_AOC2017
|
0fd5393776cb2b7ae23914678f0276cf69e6e73d
|
[
"MIT"
] | 2 |
2017-12-22T17:29:21.000Z
|
2021-03-01T07:42:36.000Z
|
zaoc_01v1.prog.abap
|
larshp/abap101_AOC2017
|
0fd5393776cb2b7ae23914678f0276cf69e6e73d
|
[
"MIT"
] | 4 |
2017-12-10T15:41:04.000Z
|
2022-01-26T02:52:30.000Z
|
*&---------------------------------------------------------------------*
*& Report zaoc_01v1
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zaoc_01v1.
CLASS solver DEFINITION.
PUBLIC SECTION.
METHODS solve_captcha IMPORTING input_captcha TYPE string
RETURNING VALUE(captcha_solved) TYPE i.
ENDCLASS.
CLASS solver IMPLEMENTATION.
METHOD solve_captcha.
DATA(in_len) = strlen( input_captcha ).
DATA(sum) = 0.
DATA(prev_dig) = input_captcha+0(1).
DATA(offs) = 1.
WHILE offs < in_len.
IF input_captcha+offs(1) = prev_dig.
ADD prev_dig TO sum.
ENDIF.
prev_dig = input_captcha+offs(1).
ADD 1 TO offs.
ENDWHILE.
offs = strlen( input_captcha ) - 1.
IF input_captcha+0(1) = input_captcha+offs(1).
ADD input_captcha+offs(1) TO sum.
ENDIF.
captcha_solved = sum.
ENDMETHOD.
ENDCLASS.
CLASS test_solver DEFINITION FOR TESTING RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA solver TYPE REF TO solver.
METHODS setup.
METHODS test_1122 FOR TESTING.
METHODS test_1111 FOR TESTING.
METHODS test_1234 FOR TESTING.
METHODS test_91212129 FOR TESTING.
ENDCLASS.
CLASS test_solver IMPLEMENTATION.
METHOD setup.
CREATE OBJECT me->solver.
ENDMETHOD.
METHOD test_1111.
DATA(captcha_solved) = solver->solve_captcha( '1111' ).
cl_abap_unit_assert=>assert_equals( exp = 4 act = captcha_solved ).
ENDMETHOD.
METHOD test_1122.
DATA(captcha_solved) = solver->solve_captcha( '1122' ).
cl_abap_unit_assert=>assert_equals( exp = 3 act = captcha_solved ).
ENDMETHOD.
METHOD test_1234.
DATA(captcha_solved) = solver->solve_captcha( '1234' ).
cl_abap_unit_assert=>assert_equals( exp = 0 act = captcha_solved ).
ENDMETHOD.
METHOD test_91212129.
DATA(captcha_solved) = solver->solve_captcha( '91212129' ).
cl_abap_unit_assert=>assert_equals( exp = 9 act = captcha_solved ).
ENDMETHOD.
ENDCLASS.
DATA solver TYPE REF TO solver.
DATA puz_input TYPE string.
START-OF-SELECTION.
CONCATENATE
'18144568296689784866596347266193986531397687719431268499352125948651757961396717561854825453'
'96318113437957491837321373218469774666839963164262237368442532611258528394646232336399175389'
'56471777976912147841492151987159869475736689871887468786783996245337925516513359798471319759'
'65677957755571358934665327487287312467771187981424785514785421781781976477326712674311994735'
'94798738351669989791659543322829419875971595946957876673951847511877175578719623877234576294'
'14773594834566411946853335283295811137885998436213263135923541678464664159435661831929462176'
'89936174884493199368681514958669615226362538622898367728662941275658917124167353496334664239'
'53975383543992966455288653888572723566254878352935361144123168161353544741794191147939155848'
'14439331342838528795113954294891524359966692326812156277237235658722912968785283347733916266'
'72491878762288953597499218397146685679387438634857358552943964839321464529237533868734473777'
'75677568775935587851911342696919721182432589337681255679848332599412874324254489962521576585'
'19239597981975628313138913717359737613844646853162733435418527585253181446813644921734651745'
'12856618292785483181956548813344752352933634979165667651165776587656468598791994573513652324'
'76468751534595962149334662382196555475561521985584296993226941483944688761373817456798951285'
'77855663522859889919464361486528393915931787366249572149175277595742351336664619883558556133'
'77789115472297915429318142824465141688559333787512328799783539285826471818279818457674417354'
'33545439564443588938629769562537825661355891169514539777957652639724179518129432279768716832'
'66964972566849438296666723411626564795635228921417149984778651149446712258982973386859586447'
'28534192317628618817551492975251364233974374724968483637518876583946828819994321129556511537'
'61925338198154439411218465558696465516419255235253462629599696876238882729487336271963661618'
'27869769224451255519279692675913952921981557754349978277388627863415435245448223211121318154'
'75829945625787561369956264826651461575948462782869972654343749617939132353399334744265286151'
'17793159451485756366432929971343691472111974693215945628726788787877921881588319123685865695'
'9258484139254446341'
INTO puz_input.
CREATE OBJECT solver.
DATA(result) = solver->solve_captcha( puz_input ).
WRITE result.
| 41.272727 | 96 | 0.787225 |
35b8c3d49f1a06ebced3ffdd071355b06b136680
| 186,081 |
abap
|
ABAP
|
src/zcl_ibmc_speech_to_text_v1.clas.abap
|
khajafareed/Test01
|
930aee008c984b2d55b4375646c8f459d653eb3c
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_ibmc_speech_to_text_v1.clas.abap
|
khajafareed/Test01
|
930aee008c984b2d55b4375646c8f459d653eb3c
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_ibmc_speech_to_text_v1.clas.abap
|
khajafareed/Test01
|
930aee008c984b2d55b4375646c8f459d653eb3c
|
[
"Apache-2.0"
] | null | null | null |
* Copyright 2019 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
"! <h1>Speech to Text</h1>
"! The IBM® Speech to Text service provides APIs that use IBM's
"! speech-recognition capabilities to produce transcripts of spoken audio. The
"! service can transcribe speech from various languages and audio formats. In
"! addition to basic transcription, the service can produce detailed information
"! about many different aspects of the audio. For most languages, the service
"! supports two sampling rates, broadband and narrowband. It returns all JSON
"! response content in the UTF-8 character set.
"!
"! For speech recognition, the service supports synchronous and asynchronous HTTP
"! Representational State Transfer (REST) interfaces. It also supports a WebSocket
"! interface that provides a full-duplex, low-latency communication channel:
"! Clients send requests and audio to the service and receive results over a
"! single connection asynchronously.
"!
"! The service also offers two customization interfaces. Use language model
"! customization to expand the vocabulary of a base model with domain-specific
"! terminology. Use acoustic model customization to adapt a base model for the
"! acoustic characteristics of your audio. For language model customization, the
"! service also supports grammars. A grammar is a formal language specification
"! that lets you restrict the phrases that the service can recognize.
"!
"! Language model customization is generally available for production use with most
"! supported languages. Acoustic model customization is beta functionality that is
"! available for all supported languages. <br/>
class ZCL_IBMC_SPEECH_TO_TEXT_V1 DEFINITION
public
inheriting from ZCL_IBMC_SERVICE_EXT
create public .
public section.
types:
"! A warning from training of a custom language or custom acoustic model.
begin of T_TRAINING_WARNING,
CODE type STRING,
MESSAGE type STRING,
end of T_TRAINING_WARNING.
types:
"! The response from training of a custom language or custom acoustic model.
begin of T_TRAINING_RESPONSE,
WARNINGS type STANDARD TABLE OF T_TRAINING_WARNING WITH NON-UNIQUE DEFAULT KEY,
end of T_TRAINING_RESPONSE.
types:
"! An alternative hypothesis for a word from speech recognition results.
begin of T_WORD_ALTERNATIVE_RESULT,
CONFIDENCE type DOUBLE,
WORD type STRING,
end of T_WORD_ALTERNATIVE_RESULT.
types:
"! Information about alternative hypotheses for words from speech recognition
"! results.
begin of T_WORD_ALTERNATIVE_RESULTS,
START_TIME type DOUBLE,
END_TIME type DOUBLE,
ALTERNATIVES type STANDARD TABLE OF T_WORD_ALTERNATIVE_RESULT WITH NON-UNIQUE DEFAULT KEY,
end of T_WORD_ALTERNATIVE_RESULTS.
types:
"! A bin with defined boundaries that indicates the number of values in a range of
"! signal characteristics for a histogram. The first and last bins of a histogram
"! are the boundary bins. They cover the intervals between negative infinity and
"! the first boundary, and between the last boundary and positive infinity,
"! respectively.
begin of T_AUDIO_METRICS_HISTOGRAM_BIN,
BEGIN type FLOAT,
END type FLOAT,
COUNT type INTEGER,
end of T_AUDIO_METRICS_HISTOGRAM_BIN.
types:
"! Information about the speakers from speech recognition results.
begin of T_SPEAKER_LABELS_RESULT,
FROM type FLOAT,
TO type FLOAT,
SPEAKER type INTEGER,
CONFIDENCE type FLOAT,
FINAL type BOOLEAN,
end of T_SPEAKER_LABELS_RESULT.
types:
"! An alternative transcript from speech recognition results.
begin of T_SPCH_RECOGNITION_ALTERNATIVE,
TRANSCRIPT type STRING,
CONFIDENCE type DOUBLE,
TIMESTAMPS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
WORD_CONFIDENCE type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
end of T_SPCH_RECOGNITION_ALTERNATIVE.
types:
"! Detailed timing information about the service's processing of the input audio.
begin of T_PROCESSED_AUDIO,
RECEIVED type FLOAT,
SEEN_BY_ENGINE type FLOAT,
TRANSCRIPTION type FLOAT,
SPEAKER_LABELS type FLOAT,
end of T_PROCESSED_AUDIO.
types:
"! If processing metrics are requested, information about the service's processing
"! of the input audio. Processing metrics are not available with the synchronous
"! **Recognize audio** method.
begin of T_PROCESSING_METRICS,
PROCESSED_AUDIO type T_PROCESSED_AUDIO,
WLL_CLCK_SNC_FRST_BYT_RECEIVED type FLOAT,
PERIODIC type BOOLEAN,
end of T_PROCESSING_METRICS.
types:
"! Detailed information about the signal characteristics of the input audio.
begin of T_AUDIO_METRICS_DETAILS,
FINAL type BOOLEAN,
END_TIME type FLOAT,
SIGNAL_TO_NOISE_RATIO type FLOAT,
SPEECH_RATIO type FLOAT,
HIGH_FREQUENCY_LOSS type FLOAT,
DIRECT_CURRENT_OFFSET type STANDARD TABLE OF T_AUDIO_METRICS_HISTOGRAM_BIN WITH NON-UNIQUE DEFAULT KEY,
CLIPPING_RATE type STANDARD TABLE OF T_AUDIO_METRICS_HISTOGRAM_BIN WITH NON-UNIQUE DEFAULT KEY,
SPEECH_LEVEL type STANDARD TABLE OF T_AUDIO_METRICS_HISTOGRAM_BIN WITH NON-UNIQUE DEFAULT KEY,
NON_SPEECH_LEVEL type STANDARD TABLE OF T_AUDIO_METRICS_HISTOGRAM_BIN WITH NON-UNIQUE DEFAULT KEY,
end of T_AUDIO_METRICS_DETAILS.
types:
"! If audio metrics are requested, information about the signal characteristics of
"! the input audio.
begin of T_AUDIO_METRICS,
SAMPLING_INTERVAL type FLOAT,
ACCUMULATED type T_AUDIO_METRICS_DETAILS,
end of T_AUDIO_METRICS.
types:
"! Component results for a speech recognition request.
begin of T_SPEECH_RECOGNITION_RESULT,
FINAL type BOOLEAN,
ALTERNATIVES type STANDARD TABLE OF T_SPCH_RECOGNITION_ALTERNATIVE WITH NON-UNIQUE DEFAULT KEY,
KEYWORDS_RESULT type MAP,
WORD_ALTERNATIVES type STANDARD TABLE OF T_WORD_ALTERNATIVE_RESULTS WITH NON-UNIQUE DEFAULT KEY,
end of T_SPEECH_RECOGNITION_RESULT.
types:
"! The complete results for a speech recognition request.
begin of T_SPEECH_RECOGNITION_RESULTS,
RESULTS type STANDARD TABLE OF T_SPEECH_RECOGNITION_RESULT WITH NON-UNIQUE DEFAULT KEY,
RESULT_INDEX type INTEGER,
SPEAKER_LABELS type STANDARD TABLE OF T_SPEAKER_LABELS_RESULT WITH NON-UNIQUE DEFAULT KEY,
PROCESSING_METRICS type T_PROCESSING_METRICS,
AUDIO_METRICS type T_AUDIO_METRICS,
WARNINGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
end of T_SPEECH_RECOGNITION_RESULTS.
types:
"! Information about a grammar from a custom language model.
begin of T_GRAMMAR,
NAME type STRING,
OUT_OF_VOCABULARY_WORDS type INTEGER,
STATUS type STRING,
ERROR type STRING,
end of T_GRAMMAR.
types:
"! Information about the grammars from a custom language model.
begin of T_GRAMMARS,
GRAMMARS type STANDARD TABLE OF T_GRAMMAR WITH NON-UNIQUE DEFAULT KEY,
end of T_GRAMMARS.
types:
"! Information about a current asynchronous speech recognition job.
begin of T_RECOGNITION_JOB,
ID type STRING,
STATUS type STRING,
CREATED type STRING,
UPDATED type STRING,
URL type STRING,
USER_TOKEN type STRING,
RESULTS type STANDARD TABLE OF T_SPEECH_RECOGNITION_RESULTS WITH NON-UNIQUE DEFAULT KEY,
WARNINGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
end of T_RECOGNITION_JOB.
types:
"! Information about current asynchronous speech recognition jobs.
begin of T_RECOGNITION_JOBS,
RECOGNITIONS type STANDARD TABLE OF T_RECOGNITION_JOB WITH NON-UNIQUE DEFAULT KEY,
end of T_RECOGNITION_JOBS.
types:
"! Information about an audio resource from a custom acoustic model.
begin of T_AUDIO_DETAILS,
TYPE type STRING,
CODEC type STRING,
FREQUENCY type INTEGER,
COMPRESSION type STRING,
end of T_AUDIO_DETAILS.
types:
"! The error response from a failed request.
begin of T_ERROR_MODEL,
ERROR type STRING,
CODE type INTEGER,
CODE_DESCRIPTION type STRING,
WARNINGS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
end of T_ERROR_MODEL.
types:
"! Information about an audio resource from a custom acoustic model.
begin of T_AUDIO_RESOURCE,
DURATION type INTEGER,
NAME type STRING,
DETAILS type T_AUDIO_DETAILS,
STATUS type STRING,
end of T_AUDIO_RESOURCE.
types:
"! Information about an audio resource from a custom acoustic model.
begin of T_AUDIO_LISTING,
DURATION type INTEGER,
NAME type STRING,
DETAILS type T_AUDIO_DETAILS,
STATUS type STRING,
CONTAINER type T_AUDIO_RESOURCE,
AUDIO type STANDARD TABLE OF T_AUDIO_RESOURCE WITH NON-UNIQUE DEFAULT KEY,
end of T_AUDIO_LISTING.
types:
"! An error associated with a word from a custom language model.
begin of T_WORD_ERROR,
ELEMENT type STRING,
end of T_WORD_ERROR.
types:
"! Information about a word from a custom language model.
begin of T_WORD,
WORD type STRING,
SOUNDS_LIKE type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
DISPLAY_AS type STRING,
COUNT type INTEGER,
SOURCE type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
ERROR type STANDARD TABLE OF T_WORD_ERROR WITH NON-UNIQUE DEFAULT KEY,
end of T_WORD.
types:
"! Information about the words from a custom language model.
begin of T_WORDS,
WORDS type STANDARD TABLE OF T_WORD WITH NON-UNIQUE DEFAULT KEY,
end of T_WORDS.
types:
"! Information about a word that is to be added to a custom language model.
begin of T_CUSTOM_WORD,
WORD type STRING,
SOUNDS_LIKE type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
DISPLAY_AS type STRING,
end of T_CUSTOM_WORD.
types:
"! Information about the audio resources from a custom acoustic model.
begin of T_AUDIO_RESOURCES,
TOTAL_MINUTES_OF_AUDIO type DOUBLE,
AUDIO type STANDARD TABLE OF T_AUDIO_RESOURCE WITH NON-UNIQUE DEFAULT KEY,
end of T_AUDIO_RESOURCES.
types:
"! Information about a corpus from a custom language model.
begin of T_CORPUS,
NAME type STRING,
TOTAL_WORDS type INTEGER,
OUT_OF_VOCABULARY_WORDS type INTEGER,
STATUS type STRING,
ERROR type STRING,
end of T_CORPUS.
types:
"! Information about the corpora from a custom language model.
begin of T_CORPORA,
CORPORA type STANDARD TABLE OF T_CORPUS WITH NON-UNIQUE DEFAULT KEY,
end of T_CORPORA.
types:
"! Information about an existing custom language model.
begin of T_LANGUAGE_MODEL,
CUSTOMIZATION_ID type STRING,
CREATED type STRING,
UPDATED type STRING,
LANGUAGE type STRING,
DIALECT type STRING,
VERSIONS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
OWNER type STRING,
NAME type STRING,
DESCRIPTION type STRING,
BASE_MODEL_NAME type STRING,
STATUS type STRING,
PROGRESS type INTEGER,
ERROR type STRING,
WARNINGS type STRING,
end of T_LANGUAGE_MODEL.
types:
"! Information about existing custom language models.
begin of T_LANGUAGE_MODELS,
CUSTOMIZATIONS type STANDARD TABLE OF T_LANGUAGE_MODEL WITH NON-UNIQUE DEFAULT KEY,
end of T_LANGUAGE_MODELS.
types:
"! Information about an existing custom acoustic model.
begin of T_ACOUSTIC_MODEL,
CUSTOMIZATION_ID type STRING,
CREATED type STRING,
UPDATED type STRING,
LANGUAGE type STRING,
VERSIONS type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY,
OWNER type STRING,
NAME type STRING,
DESCRIPTION type STRING,
BASE_MODEL_NAME type STRING,
STATUS type STRING,
PROGRESS type INTEGER,
WARNINGS type STRING,
end of T_ACOUSTIC_MODEL.
types:
"! Information about existing custom acoustic models.
begin of T_ACOUSTIC_MODELS,
CUSTOMIZATIONS type STANDARD TABLE OF T_ACOUSTIC_MODEL WITH NON-UNIQUE DEFAULT KEY,
end of T_ACOUSTIC_MODELS.
types:
"!
begin of T_INLINE_OBJECT,
CORPUS_FILE type FILE,
end of T_INLINE_OBJECT.
types:
"! Additional service features that are supported with the model.
begin of T_SUPPORTED_FEATURES,
CUSTOM_LANGUAGE_MODEL type BOOLEAN,
SPEAKER_LABELS type BOOLEAN,
end of T_SUPPORTED_FEATURES.
types:
"! Information about the new custom language model.
begin of T_CREATE_LANGUAGE_MODEL,
NAME type STRING,
BASE_MODEL_NAME type STRING,
DIALECT type STRING,
DESCRIPTION type STRING,
end of T_CREATE_LANGUAGE_MODEL.
types:
"! Information about an available language model.
begin of T_SPEECH_MODEL,
NAME type STRING,
LANGUAGE type STRING,
RATE type INTEGER,
URL type STRING,
SUPPORTED_FEATURES type T_SUPPORTED_FEATURES,
DESCRIPTION type STRING,
end of T_SPEECH_MODEL.
types:
"! Information about the available language models.
begin of T_SPEECH_MODELS,
MODELS type STANDARD TABLE OF T_SPEECH_MODEL WITH NON-UNIQUE DEFAULT KEY,
end of T_SPEECH_MODELS.
types:
"! Information about the new custom acoustic model.
begin of T_CREATE_ACOUSTIC_MODEL,
NAME type STRING,
BASE_MODEL_NAME type STRING,
DESCRIPTION type STRING,
end of T_CREATE_ACOUSTIC_MODEL.
types:
"! Information about the words that are to be added to a custom language model.
begin of T_CUSTOM_WORDS,
WORDS type STANDARD TABLE OF T_CUSTOM_WORD WITH NON-UNIQUE DEFAULT KEY,
end of T_CUSTOM_WORDS.
types:
"! Information about a match for a keyword from speech recognition results.
begin of T_KEYWORD_RESULT,
NORMALIZED_TEXT type STRING,
START_TIME type DOUBLE,
END_TIME type DOUBLE,
CONFIDENCE type DOUBLE,
end of T_KEYWORD_RESULT.
types:
"! The empty response from a request.
T_EMPTY_RESPONSE_BODY type JSONOBJECT.
types:
"! Information about a request to register a callback for asynchronous speech
"! recognition.
begin of T_REGISTER_STATUS,
STATUS type STRING,
URL type STRING,
end of T_REGISTER_STATUS.
constants:
begin of C_REQUIRED_FIELDS,
T_TRAINING_WARNING type string value '|CODE|MESSAGE|',
T_TRAINING_RESPONSE type string value '|',
T_WORD_ALTERNATIVE_RESULT type string value '|CONFIDENCE|WORD|',
T_WORD_ALTERNATIVE_RESULTS type string value '|START_TIME|END_TIME|ALTERNATIVES|',
T_AUDIO_METRICS_HISTOGRAM_BIN type string value '|BEGIN|END|COUNT|',
T_SPEAKER_LABELS_RESULT type string value '|FROM|TO|SPEAKER|CONFIDENCE|FINAL|',
T_SPCH_RECOGNITION_ALTERNATIVE type string value '|TRANSCRIPT|',
T_PROCESSED_AUDIO type string value '|RECEIVED|SEEN_BY_ENGINE|TRANSCRIPTION|',
T_PROCESSING_METRICS type string value '|PROCESSED_AUDIO|WLL_CLCK_SNC_FRST_BYT_RECEIVED|PERIODIC|',
T_AUDIO_METRICS_DETAILS type string value '|FINAL|END_TIME|SPEECH_RATIO|HIGH_FREQUENCY_LOSS|DIRECT_CURRENT_OFFSET|CLIPPING_RATE|SPEECH_LEVEL|NON_SPEECH_LEVEL|',
T_AUDIO_METRICS type string value '|SAMPLING_INTERVAL|ACCUMULATED|',
T_SPEECH_RECOGNITION_RESULT type string value '|FINAL|ALTERNATIVES|',
T_SPEECH_RECOGNITION_RESULTS type string value '|',
T_GRAMMAR type string value '|NAME|OUT_OF_VOCABULARY_WORDS|STATUS|',
T_GRAMMARS type string value '|GRAMMARS|',
T_RECOGNITION_JOB type string value '|ID|STATUS|CREATED|',
T_RECOGNITION_JOBS type string value '|RECOGNITIONS|',
T_AUDIO_DETAILS type string value '|',
T_ERROR_MODEL type string value '|ERROR|CODE|CODE_DESCRIPTION|',
T_AUDIO_RESOURCE type string value '|DURATION|NAME|DETAILS|STATUS|',
T_AUDIO_LISTING type string value '|',
T_WORD_ERROR type string value '|ELEMENT|',
T_WORD type string value '|WORD|SOUNDS_LIKE|DISPLAY_AS|COUNT|SOURCE|',
T_WORDS type string value '|WORDS|',
T_CUSTOM_WORD type string value '|',
T_AUDIO_RESOURCES type string value '|TOTAL_MINUTES_OF_AUDIO|AUDIO|',
T_CORPUS type string value '|NAME|TOTAL_WORDS|OUT_OF_VOCABULARY_WORDS|STATUS|',
T_CORPORA type string value '|CORPORA|',
T_LANGUAGE_MODEL type string value '|CUSTOMIZATION_ID|',
T_LANGUAGE_MODELS type string value '|CUSTOMIZATIONS|',
T_ACOUSTIC_MODEL type string value '|CUSTOMIZATION_ID|',
T_ACOUSTIC_MODELS type string value '|CUSTOMIZATIONS|',
T_INLINE_OBJECT type string value '|CORPUS_FILE|',
T_SUPPORTED_FEATURES type string value '|CUSTOM_LANGUAGE_MODEL|SPEAKER_LABELS|',
T_CREATE_LANGUAGE_MODEL type string value '|NAME|BASE_MODEL_NAME|',
T_SPEECH_MODEL type string value '|NAME|LANGUAGE|RATE|URL|SUPPORTED_FEATURES|DESCRIPTION|',
T_SPEECH_MODELS type string value '|MODELS|',
T_CREATE_ACOUSTIC_MODEL type string value '|NAME|BASE_MODEL_NAME|',
T_CUSTOM_WORDS type string value '|WORDS|',
T_KEYWORD_RESULT type string value '|NORMALIZED_TEXT|START_TIME|END_TIME|CONFIDENCE|',
T_REGISTER_STATUS type string value '|STATUS|URL|',
__DUMMY type string value SPACE,
end of C_REQUIRED_FIELDS .
constants:
begin of C_ABAPNAME_DICTIONARY,
RECOGNITIONS type string value 'recognitions',
ID type string value 'id',
STATUS type string value 'status',
CREATED type string value 'created',
UPDATED type string value 'updated',
URL type string value 'url',
USER_TOKEN type string value 'user_token',
RESULTS type string value 'results',
WARNINGS type string value 'warnings',
RESULT_INDEX type string value 'result_index',
SPEAKER_LABELS type string value 'speaker_labels',
SPEAKERLABELS type string value 'speakerLabels',
PROCESSING_METRICS type string value 'processing_metrics',
AUDIO_METRICS type string value 'audio_metrics',
FINAL type string value 'final',
ALTERNATIVES type string value 'alternatives',
KEYWORDS_RESULT type string value 'keywords_result',
INNER type string value 'inner',
WORD_ALTERNATIVES type string value 'word_alternatives',
WORDALTERNATIVES type string value 'wordAlternatives',
NORMALIZED_TEXT type string value 'normalized_text',
START_TIME type string value 'start_time',
END_TIME type string value 'end_time',
CONFIDENCE type string value 'confidence',
WORD type string value 'word',
TRANSCRIPT type string value 'transcript',
TIMESTAMPS type string value 'timestamps',
WORD_CONFIDENCE type string value 'word_confidence',
WORDCONFIDENCE type string value 'wordConfidence',
FROM type string value 'from',
TO type string value 'to',
SPEAKER type string value 'speaker',
PROCESSED_AUDIO type string value 'processed_audio',
WLL_CLCK_SNC_FRST_BYT_RECEIVED type string value 'wall_clock_since_first_byte_received',
PERIODIC type string value 'periodic',
RECEIVED type string value 'received',
SEEN_BY_ENGINE type string value 'seen_by_engine',
TRANSCRIPTION type string value 'transcription',
SAMPLING_INTERVAL type string value 'sampling_interval',
ACCUMULATED type string value 'accumulated',
SIGNAL_TO_NOISE_RATIO type string value 'signal_to_noise_ratio',
SPEECH_RATIO type string value 'speech_ratio',
HIGH_FREQUENCY_LOSS type string value 'high_frequency_loss',
DIRECT_CURRENT_OFFSET type string value 'direct_current_offset',
DIRECTCURRENTOFFSET type string value 'directCurrentOffset',
CLIPPING_RATE type string value 'clipping_rate',
CLIPPINGRATE type string value 'clippingRate',
SPEECH_LEVEL type string value 'speech_level',
SPEECHLEVEL type string value 'speechLevel',
NON_SPEECH_LEVEL type string value 'non_speech_level',
NONSPEECHLEVEL type string value 'nonSpeechLevel',
BEGIN type string value 'begin',
END type string value 'end',
COUNT type string value 'count',
MODELS type string value 'models',
NAME type string value 'name',
LANGUAGE type string value 'language',
RATE type string value 'rate',
SUPPORTED_FEATURES type string value 'supported_features',
DESCRIPTION type string value 'description',
CUSTOM_LANGUAGE_MODEL type string value 'custom_language_model',
BASE_MODEL_NAME type string value 'base_model_name',
DIALECT type string value 'dialect',
CUSTOMIZATIONS type string value 'customizations',
CUSTOMIZATION_ID type string value 'customization_id',
VERSIONS type string value 'versions',
OWNER type string value 'owner',
PROGRESS type string value 'progress',
ERROR type string value 'error',
CORPORA type string value 'corpora',
TOTAL_WORDS type string value 'total_words',
OUT_OF_VOCABULARY_WORDS type string value 'out_of_vocabulary_words',
WORDS type string value 'words',
SOUNDS_LIKE type string value 'sounds_like',
SOUNDSLIKE type string value 'soundsLike',
DISPLAY_AS type string value 'display_as',
SOURCE type string value 'source',
ELEMENT type string value 'element',
GRAMMARS type string value 'grammars',
TOTAL_MINUTES_OF_AUDIO type string value 'total_minutes_of_audio',
AUDIO type string value 'audio',
DURATION type string value 'duration',
DETAILS type string value 'details',
TYPE type string value 'type',
CODEC type string value 'codec',
FREQUENCY type string value 'frequency',
COMPRESSION type string value 'compression',
CONTAINER type string value 'container',
CODE type string value 'code',
MESSAGE type string value 'message',
CODE_DESCRIPTION type string value 'code_description',
CORPUS_FILE type string value 'corpus_file',
end of C_ABAPNAME_DICTIONARY .
methods GET_APPNAME
redefinition .
methods GET_REQUEST_PROP
redefinition .
methods GET_SDK_VERSION_DATE
redefinition .
"! List models.
"!
"! @parameter E_RESPONSE |
"! Service return value of type T_SPEECH_MODELS
"!
methods LIST_MODELS
importing
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_SPEECH_MODELS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Get a model.
"!
"! @parameter I_model_id |
"! The identifier of the model in the form of its name from the output of the **Get
"! a model** method.
"! @parameter E_RESPONSE |
"! Service return value of type T_SPEECH_MODEL
"!
methods GET_MODEL
importing
!I_model_id type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_SPEECH_MODEL
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Recognize audio.
"!
"! @parameter I_audio |
"! The audio to transcribe.
"! @parameter I_Content_Type |
"! The format (MIME type) of the audio. For more information about specifying an
"! audio format, see **Audio formats (content types)** in the method description.
"! @parameter I_model |
"! The identifier of the model that is to be used for the recognition request. See
"! [Languages and
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -models#models).
"! @parameter I_language_customization_id |
"! The customization ID (GUID) of a custom language model that is to be used with
"! the recognition request. The base model of the specified custom language model
"! must match the model specified with the `model` parameter. You must make the
"! request with credentials for the instance of the service that owns the custom
"! model. By default, no custom language model is used. See [Custom
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -input#custom-input).
"!
"! **Note:** Use this parameter instead of the deprecated `customization_id`
"! parameter.
"! @parameter I_acoustic_customization_id |
"! The customization ID (GUID) of a custom acoustic model that is to be used with
"! the recognition request. The base model of the specified custom acoustic model
"! must match the model specified with the `model` parameter. You must make the
"! request with credentials for the instance of the service that owns the custom
"! model. By default, no custom acoustic model is used. See [Custom
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -input#custom-input).
"! @parameter I_base_model_version |
"! The version of the specified base model that is to be used with the recognition
"! request. Multiple versions of a base model can exist when a model is updated
"! for internal improvements. The parameter is intended primarily for use with
"! custom models that have been upgraded for a new base model. The default value
"! depends on whether the parameter is used with or without a custom model. See
"! [Base model
"! version](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-tex
"! t-input#version).
"! @parameter I_customization_weight |
"! If you specify the customization ID (GUID) of a custom language model with the
"! recognition request, the customization weight tells the service how much weight
"! to give to words from the custom language model compared to those from the base
"! model for the current request.
"!
"! Specify a value between 0.0 and 1.0. Unless a different customization weight was
"! specified for the custom model when it was trained, the default value is 0.3. A
"! customization weight that you specify overrides a weight that was specified
"! when the custom model was trained.
"!
"! The default value yields the best performance in general. Assign a higher value
"! if your audio makes frequent use of OOV words from the custom model. Use
"! caution when setting the weight: a higher value can improve the accuracy of
"! phrases from the custom model's domain, but it can negatively affect
"! performance on non-domain phrases.
"!
"! See [Custom
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -input#custom-input).
"! @parameter I_inactivity_timeout |
"! The time in seconds after which, if only silence (no speech) is detected in
"! streaming audio, the connection is closed with a 400 error. The parameter is
"! useful for stopping audio submission from a live microphone when a user simply
"! walks away. Use `-1` for infinity. See [Inactivity
"! timeout](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-tex
"! t-input#timeouts-inactivity).
"! @parameter I_keywords |
"! An array of keyword strings to spot in the audio. Each keyword string can
"! include one or more string tokens. Keywords are spotted only in the final
"! results, not in interim hypotheses. If you specify any keywords, you must also
"! specify a keywords threshold. You can spot a maximum of 1000 keywords. Omit the
"! parameter or specify an empty array if you do not need to spot keywords. See
"! [Keyword
"! spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-output#keyword_spotting).
"! @parameter I_keywords_threshold |
"! A confidence value that is the lower bound for spotting a keyword. A word is
"! considered to match a keyword if its confidence is greater than or equal to the
"! threshold. Specify a probability between 0.0 and 1.0. If you specify a
"! threshold, you must also specify one or more keywords. The service performs no
"! keyword spotting if you omit either parameter. See [Keyword
"! spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-output#keyword_spotting).
"! @parameter I_max_alternatives |
"! The maximum number of alternative transcripts that the service is to return. By
"! default, the service returns a single transcript. If you specify a value of
"! `0`, the service uses the default value, `1`. See [Maximum
"! alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-t
"! o-text-output#max_alternatives).
"! @parameter I_word_alternatives_threshold |
"! A confidence value that is the lower bound for identifying a hypothesis as a
"! possible word alternative (also known as "Confusion Networks"). An alternative
"! word is considered if its confidence is greater than or equal to the threshold.
"! Specify a probability between 0.0 and 1.0. By default, the service computes no
"! alternative words. See [Word
"! alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-t
"! o-text-output#word_alternatives).
"! @parameter I_word_confidence |
"! If `true`, the service returns a confidence measure in the range of 0.0 to 1.0
"! for each word. By default, the service returns no word confidence scores. See
"! [Word
"! confidence](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-
"! text-output#word_confidence).
"! @parameter I_timestamps |
"! If `true`, the service returns time alignment for each word. By default, no
"! timestamps are returned. See [Word
"! timestamps](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-
"! text-output#word_timestamps).
"! @parameter I_profanity_filter |
"! If `true`, the service filters profanity from all output except for keyword
"! results by replacing inappropriate words with a series of asterisks. Set the
"! parameter to `false` to return results with no censoring. Applies to US English
"! transcription only. See [Profanity
"! filtering](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-t
"! ext-output#profanity_filter).
"! @parameter I_smart_formatting |
"! If `true`, the service converts dates, times, series of digits and numbers,
"! phone numbers, currency values, and internet addresses into more readable,
"! conventional representations in the final transcript of a recognition request.
"! For US English, the service also converts certain keyword strings to
"! punctuation symbols. By default, the service performs no smart formatting.
"!
"! **Note:** Applies to US English, Japanese, and Spanish transcription only.
"!
"! See [Smart
"! formatting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-
"! text-output#smart_formatting).
"! @parameter I_speaker_labels |
"! If `true`, the response includes labels that identify which words were spoken by
"! which participants in a multi-person exchange. By default, the service returns
"! no speaker labels. Setting `speaker_labels` to `true` forces the `timestamps`
"! parameter to be `true`, regardless of whether you specify `false` for the
"! parameter.
"!
"! **Note:** Applies to US English, Japanese, and Spanish (both broadband and
"! narrowband models) and UK English (narrowband model) transcription only. To
"! determine whether a language model supports speaker labels, you can also use
"! the **Get a model** method and check that the attribute `speaker_labels` is set
"! to `true`.
"!
"! See [Speaker
"! labels](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -output#speaker_labels).
"! @parameter I_customization_id |
"! **Deprecated.** Use the `language_customization_id` parameter to specify the
"! ** customization ID (GUID) of a custom language model that is to be used with the
"! ** recognition request. Do not specify both parameters with a request.
"! @parameter I_grammar_name |
"! The name of a grammar that is to be used with the recognition request. If you
"! specify a grammar, you must also use the `language_customization_id` parameter
"! to specify the name of the custom language model for which the grammar is
"! defined. The service recognizes only strings that are recognized by the
"! specified grammar; it does not recognize other custom words from the model's
"! words resource. See
"! [Grammars](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-t
"! ext-input#grammars-input).
"! @parameter I_redaction |
"! If `true`, the service redacts, or masks, numeric data from final transcripts.
"! The feature redacts any number that has three or more consecutive digits by
"! replacing each digit with an `X` character. It is intended to redact sensitive
"! numeric data, such as credit card numbers. By default, the service performs no
"! redaction.
"!
"! When you enable redaction, the service automatically enables smart formatting,
"! regardless of whether you explicitly disable that feature. To ensure maximum
"! security, the service also disables keyword spotting (ignores the `keywords`
"! and `keywords_threshold` parameters) and returns only a single final transcript
"! (forces the `max_alternatives` parameter to be `1`).
"!
"! **Note:** Applies to US English, Japanese, and Korean transcription only.
"!
"! See [Numeric
"! redaction](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-t
"! ext-output#redaction).
"! @parameter I_audio_metrics |
"! If `true`, requests detailed information about the signal characteristics of the
"! input audio. The service returns audio metrics with the final transcription
"! results. By default, the service returns no audio metrics.
"! @parameter E_RESPONSE |
"! Service return value of type T_SPEECH_RECOGNITION_RESULTS
"!
methods RECOGNIZE
importing
!I_audio type FILE
!I_Content_Type type STRING default 'application/octet-stream'
!I_model type STRING default 'en-US_BroadbandModel'
!I_language_customization_id type STRING optional
!I_acoustic_customization_id type STRING optional
!I_base_model_version type STRING optional
!I_customization_weight type DOUBLE optional
!I_inactivity_timeout type INTEGER optional
!I_keywords type TT_STRING optional
!I_keywords_threshold type FLOAT optional
!I_max_alternatives type INTEGER optional
!I_word_alternatives_threshold type FLOAT optional
!I_word_confidence type BOOLEAN default c_boolean_false
!I_timestamps type BOOLEAN default c_boolean_false
!I_profanity_filter type BOOLEAN default c_boolean_true
!I_smart_formatting type BOOLEAN default c_boolean_false
!I_speaker_labels type BOOLEAN default c_boolean_false
!I_customization_id type STRING optional
!I_grammar_name type STRING optional
!I_redaction type BOOLEAN default c_boolean_false
!I_audio_metrics type BOOLEAN default c_boolean_false
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_SPEECH_RECOGNITION_RESULTS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Register a callback.
"!
"! @parameter I_callback_url |
"! An HTTP or HTTPS URL to which callback notifications are to be sent. To be
"! white-listed, the URL must successfully echo the challenge string during URL
"! verification. During verification, the client can also check the signature that
"! the service sends in the `X-Callback-Signature` header to verify the origin of
"! the request.
"! @parameter I_user_secret |
"! A user-specified string that the service uses to generate the HMAC-SHA1
"! signature that it sends via the `X-Callback-Signature` header. The service
"! includes the header during URL verification and with every notification sent to
"! the callback URL. It calculates the signature over the payload of the
"! notification. If you omit the parameter, the service does not send the header.
"! @parameter E_RESPONSE |
"! Service return value of type T_REGISTER_STATUS
"!
methods REGISTER_CALLBACK
importing
!I_callback_url type STRING
!I_user_secret type STRING optional
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_REGISTER_STATUS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Unregister a callback.
"!
"! @parameter I_callback_url |
"! The callback URL that is to be unregistered.
"!
methods UNREGISTER_CALLBACK
importing
!I_callback_url type STRING
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Create a job.
"!
"! @parameter I_audio |
"! The audio to transcribe.
"! @parameter I_Content_Type |
"! The format (MIME type) of the audio. For more information about specifying an
"! audio format, see **Audio formats (content types)** in the method description.
"! @parameter I_model |
"! The identifier of the model that is to be used for the recognition request. See
"! [Languages and
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -models#models).
"! @parameter I_callback_url |
"! A URL to which callback notifications are to be sent. The URL must already be
"! successfully white-listed by using the **Register a callback** method. You can
"! include the same callback URL with any number of job creation requests. Omit
"! the parameter to poll the service for job completion and results.
"!
"! Use the `user_token` parameter to specify a unique user-specified string with
"! each job to differentiate the callback notifications for the jobs.
"! @parameter I_events |
"! If the job includes a callback URL, a comma-separated list of notification
"! events to which to subscribe. Valid events are
"! * `recognitions.started` generates a callback notification when the service
"! begins to process the job.
"! * `recognitions.completed` generates a callback notification when the job is
"! complete. You must use the **Check a job** method to retrieve the results
"! before they time out or are deleted.
"! * `recognitions.completed_with_results` generates a callback notification when
"! the job is complete. The notification includes the results of the request.
"! * `recognitions.failed` generates a callback notification if the service
"! experiences an error while processing the job.
"!
"! The `recognitions.completed` and `recognitions.completed_with_results` events
"! are incompatible. You can specify only of the two events.
"!
"! If the job includes a callback URL, omit the parameter to subscribe to the
"! default events: `recognitions.started`, `recognitions.completed`, and
"! `recognitions.failed`. If the job does not include a callback URL, omit the
"! parameter.
"! @parameter I_user_token |
"! If the job includes a callback URL, a user-specified string that the service is
"! to include with each callback notification for the job; the token allows the
"! user to maintain an internal mapping between jobs and notification events. If
"! the job does not include a callback URL, omit the parameter.
"! @parameter I_results_ttl |
"! The number of minutes for which the results are to be available after the job
"! has finished. If not delivered via a callback, the results must be retrieved
"! within this time. Omit the parameter to use a time to live of one week. The
"! parameter is valid with or without a callback URL.
"! @parameter I_language_customization_id |
"! The customization ID (GUID) of a custom language model that is to be used with
"! the recognition request. The base model of the specified custom language model
"! must match the model specified with the `model` parameter. You must make the
"! request with credentials for the instance of the service that owns the custom
"! model. By default, no custom language model is used. See [Custom
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -input#custom-input).
"!
"! **Note:** Use this parameter instead of the deprecated `customization_id`
"! parameter.
"! @parameter I_acoustic_customization_id |
"! The customization ID (GUID) of a custom acoustic model that is to be used with
"! the recognition request. The base model of the specified custom acoustic model
"! must match the model specified with the `model` parameter. You must make the
"! request with credentials for the instance of the service that owns the custom
"! model. By default, no custom acoustic model is used. See [Custom
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -input#custom-input).
"! @parameter I_base_model_version |
"! The version of the specified base model that is to be used with the recognition
"! request. Multiple versions of a base model can exist when a model is updated
"! for internal improvements. The parameter is intended primarily for use with
"! custom models that have been upgraded for a new base model. The default value
"! depends on whether the parameter is used with or without a custom model. See
"! [Base model
"! version](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-tex
"! t-input#version).
"! @parameter I_customization_weight |
"! If you specify the customization ID (GUID) of a custom language model with the
"! recognition request, the customization weight tells the service how much weight
"! to give to words from the custom language model compared to those from the base
"! model for the current request.
"!
"! Specify a value between 0.0 and 1.0. Unless a different customization weight was
"! specified for the custom model when it was trained, the default value is 0.3. A
"! customization weight that you specify overrides a weight that was specified
"! when the custom model was trained.
"!
"! The default value yields the best performance in general. Assign a higher value
"! if your audio makes frequent use of OOV words from the custom model. Use
"! caution when setting the weight: a higher value can improve the accuracy of
"! phrases from the custom model's domain, but it can negatively affect
"! performance on non-domain phrases.
"!
"! See [Custom
"! models](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -input#custom-input).
"! @parameter I_inactivity_timeout |
"! The time in seconds after which, if only silence (no speech) is detected in
"! streaming audio, the connection is closed with a 400 error. The parameter is
"! useful for stopping audio submission from a live microphone when a user simply
"! walks away. Use `-1` for infinity. See [Inactivity
"! timeout](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-tex
"! t-input#timeouts-inactivity).
"! @parameter I_keywords |
"! An array of keyword strings to spot in the audio. Each keyword string can
"! include one or more string tokens. Keywords are spotted only in the final
"! results, not in interim hypotheses. If you specify any keywords, you must also
"! specify a keywords threshold. You can spot a maximum of 1000 keywords. Omit the
"! parameter or specify an empty array if you do not need to spot keywords. See
"! [Keyword
"! spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-output#keyword_spotting).
"! @parameter I_keywords_threshold |
"! A confidence value that is the lower bound for spotting a keyword. A word is
"! considered to match a keyword if its confidence is greater than or equal to the
"! threshold. Specify a probability between 0.0 and 1.0. If you specify a
"! threshold, you must also specify one or more keywords. The service performs no
"! keyword spotting if you omit either parameter. See [Keyword
"! spotting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-output#keyword_spotting).
"! @parameter I_max_alternatives |
"! The maximum number of alternative transcripts that the service is to return. By
"! default, the service returns a single transcript. If you specify a value of
"! `0`, the service uses the default value, `1`. See [Maximum
"! alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-t
"! o-text-output#max_alternatives).
"! @parameter I_word_alternatives_threshold |
"! A confidence value that is the lower bound for identifying a hypothesis as a
"! possible word alternative (also known as "Confusion Networks"). An alternative
"! word is considered if its confidence is greater than or equal to the threshold.
"! Specify a probability between 0.0 and 1.0. By default, the service computes no
"! alternative words. See [Word
"! alternatives](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-t
"! o-text-output#word_alternatives).
"! @parameter I_word_confidence |
"! If `true`, the service returns a confidence measure in the range of 0.0 to 1.0
"! for each word. By default, the service returns no word confidence scores. See
"! [Word
"! confidence](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-
"! text-output#word_confidence).
"! @parameter I_timestamps |
"! If `true`, the service returns time alignment for each word. By default, no
"! timestamps are returned. See [Word
"! timestamps](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-
"! text-output#word_timestamps).
"! @parameter I_profanity_filter |
"! If `true`, the service filters profanity from all output except for keyword
"! results by replacing inappropriate words with a series of asterisks. Set the
"! parameter to `false` to return results with no censoring. Applies to US English
"! transcription only. See [Profanity
"! filtering](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-t
"! ext-output#profanity_filter).
"! @parameter I_smart_formatting |
"! If `true`, the service converts dates, times, series of digits and numbers,
"! phone numbers, currency values, and internet addresses into more readable,
"! conventional representations in the final transcript of a recognition request.
"! For US English, the service also converts certain keyword strings to
"! punctuation symbols. By default, the service performs no smart formatting.
"!
"! **Note:** Applies to US English, Japanese, and Spanish transcription only.
"!
"! See [Smart
"! formatting](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-
"! text-output#smart_formatting).
"! @parameter I_speaker_labels |
"! If `true`, the response includes labels that identify which words were spoken by
"! which participants in a multi-person exchange. By default, the service returns
"! no speaker labels. Setting `speaker_labels` to `true` forces the `timestamps`
"! parameter to be `true`, regardless of whether you specify `false` for the
"! parameter.
"!
"! **Note:** Applies to US English, Japanese, and Spanish (both broadband and
"! narrowband models) and UK English (narrowband model) transcription only. To
"! determine whether a language model supports speaker labels, you can also use
"! the **Get a model** method and check that the attribute `speaker_labels` is set
"! to `true`.
"!
"! See [Speaker
"! labels](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text
"! -output#speaker_labels).
"! @parameter I_customization_id |
"! **Deprecated.** Use the `language_customization_id` parameter to specify the
"! ** customization ID (GUID) of a custom language model that is to be used with the
"! ** recognition request. Do not specify both parameters with a request.
"! @parameter I_grammar_name |
"! The name of a grammar that is to be used with the recognition request. If you
"! specify a grammar, you must also use the `language_customization_id` parameter
"! to specify the name of the custom language model for which the grammar is
"! defined. The service recognizes only strings that are recognized by the
"! specified grammar; it does not recognize other custom words from the model's
"! words resource. See
"! [Grammars](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-t
"! ext-input#grammars-input).
"! @parameter I_redaction |
"! If `true`, the service redacts, or masks, numeric data from final transcripts.
"! The feature redacts any number that has three or more consecutive digits by
"! replacing each digit with an `X` character. It is intended to redact sensitive
"! numeric data, such as credit card numbers. By default, the service performs no
"! redaction.
"!
"! When you enable redaction, the service automatically enables smart formatting,
"! regardless of whether you explicitly disable that feature. To ensure maximum
"! security, the service also disables keyword spotting (ignores the `keywords`
"! and `keywords_threshold` parameters) and returns only a single final transcript
"! (forces the `max_alternatives` parameter to be `1`).
"!
"! **Note:** Applies to US English, Japanese, and Korean transcription only.
"!
"! See [Numeric
"! redaction](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-t
"! ext-output#redaction).
"! @parameter I_processing_metrics |
"! If `true`, requests processing metrics about the service's transcription of the
"! input audio. The service returns processing metrics at the interval specified
"! by the `processing_metrics_interval` parameter. It also returns processing
"! metrics for transcription events, for example, for final and interim results.
"! By default, the service returns no processing metrics.
"! @parameter I_processing_metrics_interval |
"! Specifies the interval in real wall-clock seconds at which the service is to
"! return processing metrics. The parameter is ignored unless the
"! `processing_metrics` parameter is set to `true`.
"!
"! The parameter accepts a minimum value of 0.1 seconds. The level of precision is
"! not restricted, so you can specify values such as 0.25 and 0.125.
"!
"! The service does not impose a maximum value. If you want to receive processing
"! metrics only for transcription events instead of at periodic intervals, set the
"! value to a large number. If the value is larger than the duration of the audio,
"! the service returns processing metrics only for transcription events.
"! @parameter I_audio_metrics |
"! If `true`, requests detailed information about the signal characteristics of the
"! input audio. The service returns audio metrics with the final transcription
"! results. By default, the service returns no audio metrics.
"! @parameter E_RESPONSE |
"! Service return value of type T_RECOGNITION_JOB
"!
methods CREATE_JOB
importing
!I_audio type FILE
!I_Content_Type type STRING default 'application/octet-stream'
!I_model type STRING default 'en-US_BroadbandModel'
!I_callback_url type STRING optional
!I_events type STRING optional
!I_user_token type STRING optional
!I_results_ttl type INTEGER optional
!I_language_customization_id type STRING optional
!I_acoustic_customization_id type STRING optional
!I_base_model_version type STRING optional
!I_customization_weight type DOUBLE optional
!I_inactivity_timeout type INTEGER optional
!I_keywords type TT_STRING optional
!I_keywords_threshold type FLOAT optional
!I_max_alternatives type INTEGER optional
!I_word_alternatives_threshold type FLOAT optional
!I_word_confidence type BOOLEAN default c_boolean_false
!I_timestamps type BOOLEAN default c_boolean_false
!I_profanity_filter type BOOLEAN default c_boolean_true
!I_smart_formatting type BOOLEAN default c_boolean_false
!I_speaker_labels type BOOLEAN default c_boolean_false
!I_customization_id type STRING optional
!I_grammar_name type STRING optional
!I_redaction type BOOLEAN default c_boolean_false
!I_processing_metrics type BOOLEAN default c_boolean_false
!I_processing_metrics_interval type FLOAT optional
!I_audio_metrics type BOOLEAN default c_boolean_false
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_RECOGNITION_JOB
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Check jobs.
"!
"! @parameter E_RESPONSE |
"! Service return value of type T_RECOGNITION_JOBS
"!
methods CHECK_JOBS
importing
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_RECOGNITION_JOBS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Check a job.
"!
"! @parameter I_id |
"! The identifier of the asynchronous job that is to be used for the request. You
"! must make the request with credentials for the instance of the service that
"! owns the job.
"! @parameter E_RESPONSE |
"! Service return value of type T_RECOGNITION_JOB
"!
methods CHECK_JOB
importing
!I_id type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_RECOGNITION_JOB
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete a job.
"!
"! @parameter I_id |
"! The identifier of the asynchronous job that is to be used for the request. You
"! must make the request with credentials for the instance of the service that
"! owns the job.
"!
methods DELETE_JOB
importing
!I_id type STRING
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Create a custom language model.
"!
"! @parameter I_create_language_model |
"! A `CreateLanguageModel` object that provides basic information about the new
"! custom language model.
"! @parameter E_RESPONSE |
"! Service return value of type T_LANGUAGE_MODEL
"!
methods CREATE_LANGUAGE_MODEL
importing
!I_create_language_model type T_CREATE_LANGUAGE_MODEL
!I_contenttype type string default 'application/json'
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_LANGUAGE_MODEL
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! List custom language models.
"!
"! @parameter I_language |
"! The identifier of the language for which custom language or custom acoustic
"! models are to be returned (for example, `en-US`). Omit the parameter to see all
"! custom language or custom acoustic models that are owned by the requesting
"! credentials.
"! @parameter E_RESPONSE |
"! Service return value of type T_LANGUAGE_MODELS
"!
methods LIST_LANGUAGE_MODELS
importing
!I_language type STRING optional
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_LANGUAGE_MODELS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Get a custom language model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter E_RESPONSE |
"! Service return value of type T_LANGUAGE_MODEL
"!
methods GET_LANGUAGE_MODEL
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_LANGUAGE_MODEL
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete a custom language model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"!
methods DELETE_LANGUAGE_MODEL
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Train a custom language model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_word_type_to_add |
"! The type of words from the custom language model's words resource on which to
"! train the model:
"! * `all` (the default) trains the model on all new words, regardless of whether
"! they were extracted from corpora or grammars or were added or modified by the
"! user.
"! * `user` trains the model only on new words that were added or modified by the
"! user directly. The model is not trained on new words extracted from corpora or
"! grammars.
"! @parameter I_customization_weight |
"! Specifies a customization weight for the custom language model. The
"! customization weight tells the service how much weight to give to words from
"! the custom language model compared to those from the base model for speech
"! recognition. Specify a value between 0.0 and 1.0; the default is 0.3.
"!
"! The default value yields the best performance in general. Assign a higher value
"! if your audio makes frequent use of OOV words from the custom model. Use
"! caution when setting the weight: a higher value can improve the accuracy of
"! phrases from the custom model's domain, but it can negatively affect
"! performance on non-domain phrases.
"!
"! The value that you assign is used for all recognition requests that use the
"! model. You can override it for any recognition request by specifying a
"! customization weight for that request.
"! @parameter E_RESPONSE |
"! Service return value of type T_TRAINING_RESPONSE
"!
methods TRAIN_LANGUAGE_MODEL
importing
!I_customization_id type STRING
!I_word_type_to_add type STRING default 'all'
!I_customization_weight type DOUBLE optional
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_TRAINING_RESPONSE
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Reset a custom language model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"!
methods RESET_LANGUAGE_MODEL
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Upgrade a custom language model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"!
methods UPGRADE_LANGUAGE_MODEL
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! List corpora.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter E_RESPONSE |
"! Service return value of type T_CORPORA
"!
methods LIST_CORPORA
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_CORPORA
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Add a corpus.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_corpus_name |
"! The name of the new corpus for the custom language model. Use a localized name
"! that matches the language of the custom model and reflects the contents of the
"! corpus.
"! * Include a maximum of 128 characters in the name.
"! * Do not use characters that need to be URL-encoded. For example, do not use
"! spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs,
"! equals signs, questions marks, and so on in the name. (The service does not
"! prevent the use of these characters. But because they must be URL-encoded
"! wherever used, their use is strongly discouraged.)
"! * Do not use the name of an existing corpus or grammar that is already defined
"! for the custom model.
"! * Do not use the name `user`, which is reserved by the service to denote custom
"! words that are added or modified by the user.
"! * Do not use the name `base_lm` or `default_lm`. Both names are reserved for
"! future use by the service.
"! @parameter I_corpus_file |
"! A plain text file that contains the training data for the corpus. Encode the
"! file in UTF-8 if it contains non-ASCII characters; the service assumes UTF-8
"! encoding if it encounters non-ASCII characters.
"!
"! Make sure that you know the character encoding of the file. You must use that
"! encoding when working with the words in the custom language model. For more
"! information, see [Character
"! encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-corporaWords#charEncoding).
"!
"! With the `curl` command, use the `--data-binary` option to upload the file for
"! the request.
"! @parameter I_allow_overwrite |
"! If `true`, the specified corpus overwrites an existing corpus with the same
"! name. If `false`, the request fails if a corpus with the same name already
"! exists. The parameter has no effect if a corpus with the same name does not
"! already exist.
"!
methods ADD_CORPUS
importing
!I_customization_id type STRING
!I_corpus_name type STRING
!I_corpus_file type FILE
!I_allow_overwrite type BOOLEAN default c_boolean_false
!I_corpus_file_CT type STRING default ZIF_IBMC_SERVICE_ARCH~C_MEDIATYPE-ALL
!I_contenttype type string default 'multipart/form-data'
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Get a corpus.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_corpus_name |
"! The name of the corpus for the custom language model.
"! @parameter E_RESPONSE |
"! Service return value of type T_CORPUS
"!
methods GET_CORPUS
importing
!I_customization_id type STRING
!I_corpus_name type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_CORPUS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete a corpus.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_corpus_name |
"! The name of the corpus for the custom language model.
"!
methods DELETE_CORPUS
importing
!I_customization_id type STRING
!I_corpus_name type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! List custom words.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_word_type |
"! The type of words to be listed from the custom language model's words resource:
"! * `all` (the default) shows all words.
"! * `user` shows only custom words that were added or modified by the user
"! directly.
"! * `corpora` shows only OOV that were extracted from corpora.
"! * `grammars` shows only OOV words that are recognized by grammars.
"! @parameter I_sort |
"! Indicates the order in which the words are to be listed, `alphabetical` or by
"! `count`. You can prepend an optional `+` or `-` to an argument to indicate
"! whether the results are to be sorted in ascending or descending order. By
"! default, words are sorted in ascending alphabetical order. For alphabetical
"! ordering, the lexicographical precedence is numeric values, uppercase letters,
"! and lowercase letters. For count ordering, values with the same count are
"! ordered alphabetically. With the `curl` command, URL-encode the `+` symbol as
"! `%2B`.
"! @parameter E_RESPONSE |
"! Service return value of type T_WORDS
"!
methods LIST_WORDS
importing
!I_customization_id type STRING
!I_word_type type STRING default 'all'
!I_sort type STRING default 'alphabetical'
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_WORDS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Add custom words.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_custom_words |
"! A `CustomWords` object that provides information about one or more custom words
"! that are to be added to or updated in the custom language model.
"!
methods ADD_WORDS
importing
!I_customization_id type STRING
!I_custom_words type T_CUSTOM_WORDS
!I_contenttype type string default 'application/json'
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Add a custom word.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_word_name |
"! The custom word that is to be added to or updated in the custom language model.
"! Do not include spaces in the word. Use a `-` (dash) or `_` (underscore) to
"! connect the tokens of compound words. URL-encode the word if it includes
"! non-ASCII characters. For more information, see [Character
"! encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-corporaWords#charEncoding).
"! @parameter I_custom_word |
"! A `CustomWord` object that provides information about the specified custom word.
"! Specify an empty object to add a word with no sounds-like or display-as
"! information.
"!
methods ADD_WORD
importing
!I_customization_id type STRING
!I_word_name type STRING
!I_custom_word type T_CUSTOM_WORD
!I_contenttype type string default 'application/json'
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Get a custom word.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_word_name |
"! The custom word that is to be read from the custom language model. URL-encode
"! the word if it includes non-ASCII characters. For more information, see
"! [Character
"! encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-corporaWords#charEncoding).
"! @parameter E_RESPONSE |
"! Service return value of type T_WORD
"!
methods GET_WORD
importing
!I_customization_id type STRING
!I_word_name type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_WORD
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete a custom word.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_word_name |
"! The custom word that is to be deleted from the custom language model. URL-encode
"! the word if it includes non-ASCII characters. For more information, see
"! [Character
"! encoding](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-te
"! xt-corporaWords#charEncoding).
"!
methods DELETE_WORD
importing
!I_customization_id type STRING
!I_word_name type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! List grammars.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter E_RESPONSE |
"! Service return value of type T_GRAMMARS
"!
methods LIST_GRAMMARS
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_GRAMMARS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Add a grammar.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_grammar_name |
"! The name of the new grammar for the custom language model. Use a localized name
"! that matches the language of the custom model and reflects the contents of the
"! grammar.
"! * Include a maximum of 128 characters in the name.
"! * Do not use characters that need to be URL-encoded. For example, do not use
"! spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs,
"! equals signs, questions marks, and so on in the name. (The service does not
"! prevent the use of these characters. But because they must be URL-encoded
"! wherever used, their use is strongly discouraged.)
"! * Do not use the name of an existing grammar or corpus that is already defined
"! for the custom model.
"! * Do not use the name `user`, which is reserved by the service to denote custom
"! words that are added or modified by the user.
"! * Do not use the name `base_lm` or `default_lm`. Both names are reserved for
"! future use by the service.
"! @parameter I_grammar_file |
"! A plain text file that contains the grammar in the format specified by the
"! `Content-Type` header. Encode the file in UTF-8 (ASCII is a subset of UTF-8).
"! Using any other encoding can lead to issues when compiling the grammar or to
"! unexpected results in decoding. The service ignores an encoding that is
"! specified in the header of the grammar.
"!
"! With the `curl` command, use the `--data-binary` option to upload the file for
"! the request.
"! @parameter I_Content_Type |
"! The format (MIME type) of the grammar file:
"! * `application/srgs` for Augmented Backus-Naur Form (ABNF), which uses a
"! plain-text representation that is similar to traditional BNF grammars.
"! * `application/srgs+xml` for XML Form, which uses XML elements to represent the
"! grammar.
"! @parameter I_allow_overwrite |
"! If `true`, the specified grammar overwrites an existing grammar with the same
"! name. If `false`, the request fails if a grammar with the same name already
"! exists. The parameter has no effect if a grammar with the same name does not
"! already exist.
"!
methods ADD_GRAMMAR
importing
!I_customization_id type STRING
!I_grammar_name type STRING
!I_grammar_file type STRING
!I_Content_Type type STRING default 'application/srgs'
!I_allow_overwrite type BOOLEAN default c_boolean_false
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Get a grammar.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_grammar_name |
"! The name of the grammar for the custom language model.
"! @parameter E_RESPONSE |
"! Service return value of type T_GRAMMAR
"!
methods GET_GRAMMAR
importing
!I_customization_id type STRING
!I_grammar_name type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_GRAMMAR
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete a grammar.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom language model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_grammar_name |
"! The name of the grammar for the custom language model.
"!
methods DELETE_GRAMMAR
importing
!I_customization_id type STRING
!I_grammar_name type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Create a custom acoustic model.
"!
"! @parameter I_create_acoustic_model |
"! A `CreateAcousticModel` object that provides basic information about the new
"! custom acoustic model.
"! @parameter E_RESPONSE |
"! Service return value of type T_ACOUSTIC_MODEL
"!
methods CREATE_ACOUSTIC_MODEL
importing
!I_create_acoustic_model type T_CREATE_ACOUSTIC_MODEL
!I_contenttype type string default 'application/json'
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_ACOUSTIC_MODEL
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! List custom acoustic models.
"!
"! @parameter I_language |
"! The identifier of the language for which custom language or custom acoustic
"! models are to be returned (for example, `en-US`). Omit the parameter to see all
"! custom language or custom acoustic models that are owned by the requesting
"! credentials.
"! @parameter E_RESPONSE |
"! Service return value of type T_ACOUSTIC_MODELS
"!
methods LIST_ACOUSTIC_MODELS
importing
!I_language type STRING optional
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_ACOUSTIC_MODELS
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Get a custom acoustic model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter E_RESPONSE |
"! Service return value of type T_ACOUSTIC_MODEL
"!
methods GET_ACOUSTIC_MODEL
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_ACOUSTIC_MODEL
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete a custom acoustic model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"!
methods DELETE_ACOUSTIC_MODEL
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Train a custom acoustic model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_custom_language_model_id |
"! The customization ID (GUID) of a custom language model that is to be used during
"! training of the custom acoustic model. Specify a custom language model that has
"! been trained with verbatim transcriptions of the audio resources or that
"! contains words that are relevant to the contents of the audio resources. The
"! custom language model must be based on the same version of the same base model
"! as the custom acoustic model. The credentials specified with the request must
"! own both custom models.
"! @parameter E_RESPONSE |
"! Service return value of type T_TRAINING_RESPONSE
"!
methods TRAIN_ACOUSTIC_MODEL
importing
!I_customization_id type STRING
!I_custom_language_model_id type STRING optional
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_TRAINING_RESPONSE
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Reset a custom acoustic model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"!
methods RESET_ACOUSTIC_MODEL
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Upgrade a custom acoustic model.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_custom_language_model_id |
"! If the custom acoustic model was trained with a custom language model, the
"! customization ID (GUID) of that custom language model. The custom language
"! model must be upgraded before the custom acoustic model can be upgraded. The
"! credentials specified with the request must own both custom models.
"! @parameter I_force |
"! If `true`, forces the upgrade of a custom acoustic model for which no input data
"! has been modified since it was last trained. Use this parameter only to force
"! the upgrade of a custom acoustic model that is trained with a custom language
"! model, and only if you receive a 400 response code and the message `No input
"! data modified since last training`. See [Upgrading a custom acoustic
"! model](https://cloud.ibm.com/docs/services/speech-to-text?topic=speech-to-text-
"! customUpgrade#upgradeAcoustic).
"!
methods UPGRADE_ACOUSTIC_MODEL
importing
!I_customization_id type STRING
!I_custom_language_model_id type STRING optional
!I_force type BOOLEAN default c_boolean_false
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! List audio resources.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter E_RESPONSE |
"! Service return value of type T_AUDIO_RESOURCES
"!
methods LIST_AUDIO
importing
!I_customization_id type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_AUDIO_RESOURCES
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Add an audio resource.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_audio_name |
"! The name of the new audio resource for the custom acoustic model. Use a
"! localized name that matches the language of the custom model and reflects the
"! contents of the resource.
"! * Include a maximum of 128 characters in the name.
"! * Do not use characters that need to be URL-encoded. For example, do not use
"! spaces, slashes, backslashes, colons, ampersands, double quotes, plus signs,
"! equals signs, questions marks, and so on in the name. (The service does not
"! prevent the use of these characters. But because they must be URL-encoded
"! wherever used, their use is strongly discouraged.)
"! * Do not use the name of an audio resource that has already been added to the
"! custom model.
"! @parameter I_audio_resource |
"! The audio resource that is to be added to the custom acoustic model, an
"! individual audio file or an archive file.
"!
"! With the `curl` command, use the `--data-binary` option to upload the file for
"! the request.
"! @parameter I_Content_Type |
"! For an audio-type resource, the format (MIME type) of the audio. For more
"! information, see **Content types for audio-type resources** in the method
"! description.
"!
"! For an archive-type resource, the media type of the archive file. For more
"! information, see **Content types for archive-type resources** in the method
"! description.
"! @parameter I_Contained_Content_Type |
"! **For an archive-type resource,** specify the format of the audio files that are
"! ** contained in the archive file if they are of type `audio/alaw`, `audio/basic`,
"! ** `audio/l16`, or `audio/mulaw`. Include the `rate`, `channels`, and `endianness`
"! ** parameters where necessary. In this case, all audio files that are contained in
"! ** the archive file must be of the indicated type.
"! **
"! **For all other audio formats, you can omit the header. In this case, the audio
"! ** files can be of multiple types as long as they are not of the types listed in
"! ** the previous paragraph.
"! **
"! **The parameter accepts all of the audio formats that are supported for use with
"! ** speech recognition. For more information, see **Content types for audio-type
"! ** resources** in the method description.
"! **
"! ****For an audio-type resource,** omit the header.
"! @parameter I_allow_overwrite |
"! If `true`, the specified audio resource overwrites an existing audio resource
"! with the same name. If `false`, the request fails if an audio resource with the
"! same name already exists. The parameter has no effect if an audio resource with
"! the same name does not already exist.
"!
methods ADD_AUDIO
importing
!I_customization_id type STRING
!I_audio_name type STRING
!I_audio_resource type FILE
!I_Content_Type type STRING default 'application/zip'
!I_Contained_Content_Type type STRING optional
!I_allow_overwrite type BOOLEAN default c_boolean_false
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Get an audio resource.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_audio_name |
"! The name of the audio resource for the custom acoustic model.
"! @parameter E_RESPONSE |
"! Service return value of type T_AUDIO_LISTING
"!
methods GET_AUDIO
importing
!I_customization_id type STRING
!I_audio_name type STRING
!I_accept type string default 'application/json'
exporting
!E_RESPONSE type T_AUDIO_LISTING
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete an audio resource.
"!
"! @parameter I_customization_id |
"! The customization ID (GUID) of the custom acoustic model that is to be used for
"! the request. You must make the request with credentials for the instance of the
"! service that owns the custom model.
"! @parameter I_audio_name |
"! The name of the audio resource for the custom acoustic model.
"!
methods DELETE_AUDIO
importing
!I_customization_id type STRING
!I_audio_name type STRING
!I_accept type string default 'application/json'
raising
ZCX_IBMC_SERVICE_EXCEPTION .
"! Delete labeled data.
"!
"! @parameter I_customer_id |
"! The customer ID for which all data is to be deleted.
"!
methods DELETE_USER_DATA
importing
!I_customer_id type STRING
raising
ZCX_IBMC_SERVICE_EXCEPTION .
protected section.
private section.
methods SET_DEFAULT_QUERY_PARAMETERS
changing
!C_URL type TS_URL .
ENDCLASS.
class ZCL_IBMC_SPEECH_TO_TEXT_V1 IMPLEMENTATION.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_APPNAME
* +-------------------------------------------------------------------------------------------------+
* | [<-()] E_APPNAME TYPE STRING
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_APPNAME.
e_appname = 'Speech to Text'.
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Protected Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_REQUEST_PROP
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_AUTH_METHOD TYPE STRING (default =C_DEFAULT)
* | [<-()] E_REQUEST_PROP TYPE TS_REQUEST_PROP
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_REQUEST_PROP.
data:
lv_auth_method type string ##NEEDED.
e_request_prop = super->get_request_prop( ).
lv_auth_method = i_auth_method.
if lv_auth_method eq c_default.
lv_auth_method = 'IAM'.
endif.
if lv_auth_method is initial.
e_request_prop-auth_basic = c_boolean_false.
e_request_prop-auth_oauth = c_boolean_false.
e_request_prop-auth_apikey = c_boolean_false.
elseif lv_auth_method eq 'IAM'.
e_request_prop-auth_name = 'IAM'.
e_request_prop-auth_type = 'apiKey'.
e_request_prop-auth_headername = 'Authorization'.
e_request_prop-auth_header = c_boolean_true.
elseif lv_auth_method eq 'ICP4D'.
e_request_prop-auth_name = 'ICP4D'.
e_request_prop-auth_type = 'apiKey'.
e_request_prop-auth_headername = 'Authorization'.
e_request_prop-auth_header = c_boolean_true.
elseif lv_auth_method eq 'basicAuth'.
e_request_prop-auth_name = 'basicAuth'.
e_request_prop-auth_type = 'http'.
e_request_prop-auth_basic = c_boolean_true.
else.
endif.
e_request_prop-url-protocol = 'http'.
e_request_prop-url-host = 'localhost'.
e_request_prop-url-path_base = '/speech-to-text/api'.
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_SDK_VERSION_DATE
* +-------------------------------------------------------------------------------------------------+
* | [<-()] E_SDK_VERSION_DATE TYPE STRING
* +--------------------------------------------------------------------------------------</SIGNATURE>
method get_sdk_version_date.
e_sdk_version_date = '20191002122849'.
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->LIST_MODELS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_SPEECH_MODELS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method LIST_MODELS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/models'.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_model_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_SPEECH_MODEL
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/models/{model_id}'.
replace all occurrences of `{model_id}` in ls_request_prop-url-path with i_model_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->RECOGNIZE
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_audio TYPE FILE
* | [--->] I_Content_Type TYPE STRING (default ='application/octet-stream')
* | [--->] I_model TYPE STRING (default ='en-US_BroadbandModel')
* | [--->] I_language_customization_id TYPE STRING(optional)
* | [--->] I_acoustic_customization_id TYPE STRING(optional)
* | [--->] I_base_model_version TYPE STRING(optional)
* | [--->] I_customization_weight TYPE DOUBLE(optional)
* | [--->] I_inactivity_timeout TYPE INTEGER(optional)
* | [--->] I_keywords TYPE TT_STRING(optional)
* | [--->] I_keywords_threshold TYPE FLOAT(optional)
* | [--->] I_max_alternatives TYPE INTEGER(optional)
* | [--->] I_word_alternatives_threshold TYPE FLOAT(optional)
* | [--->] I_word_confidence TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_timestamps TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_profanity_filter TYPE BOOLEAN (default =c_boolean_true)
* | [--->] I_smart_formatting TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_speaker_labels TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_customization_id TYPE STRING(optional)
* | [--->] I_grammar_name TYPE STRING(optional)
* | [--->] I_redaction TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_audio_metrics TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_SPEECH_RECOGNITION_RESULTS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method RECOGNIZE.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/recognize'.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_model is supplied.
lv_queryparam = escape( val = i_model format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `model`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_language_customization_id is supplied.
lv_queryparam = escape( val = i_language_customization_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `language_customization_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_acoustic_customization_id is supplied.
lv_queryparam = escape( val = i_acoustic_customization_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `acoustic_customization_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_base_model_version is supplied.
lv_queryparam = escape( val = i_base_model_version format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `base_model_version`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_customization_weight is supplied.
lv_queryparam = i_customization_weight.
add_query_parameter(
exporting
i_parameter = `customization_weight`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_inactivity_timeout is supplied.
lv_queryparam = i_inactivity_timeout.
add_query_parameter(
exporting
i_parameter = `inactivity_timeout`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_keywords is supplied.
data:
lv_item_keywords type STRING.
clear: lv_queryparam, lv_sep.
loop at i_keywords into lv_item_keywords.
lv_queryparam = lv_queryparam && lv_sep && lv_item_keywords.
lv_sep = ','.
endloop.
lv_queryparam = escape( val = lv_queryparam format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `keywords`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_keywords_threshold is supplied.
lv_queryparam = i_keywords_threshold.
add_query_parameter(
exporting
i_parameter = `keywords_threshold`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_max_alternatives is supplied.
lv_queryparam = i_max_alternatives.
add_query_parameter(
exporting
i_parameter = `max_alternatives`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_word_alternatives_threshold is supplied.
lv_queryparam = i_word_alternatives_threshold.
add_query_parameter(
exporting
i_parameter = `word_alternatives_threshold`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_word_confidence is supplied.
lv_queryparam = i_word_confidence.
add_query_parameter(
exporting
i_parameter = `word_confidence`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_timestamps is supplied.
lv_queryparam = i_timestamps.
add_query_parameter(
exporting
i_parameter = `timestamps`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_profanity_filter is supplied.
lv_queryparam = i_profanity_filter.
add_query_parameter(
exporting
i_parameter = `profanity_filter`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_smart_formatting is supplied.
lv_queryparam = i_smart_formatting.
add_query_parameter(
exporting
i_parameter = `smart_formatting`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_speaker_labels is supplied.
lv_queryparam = i_speaker_labels.
add_query_parameter(
exporting
i_parameter = `speaker_labels`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_customization_id is supplied.
lv_queryparam = escape( val = i_customization_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `customization_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_grammar_name is supplied.
lv_queryparam = escape( val = i_grammar_name format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `grammar_name`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_redaction is supplied.
lv_queryparam = i_redaction.
add_query_parameter(
exporting
i_parameter = `redaction`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_audio_metrics is supplied.
lv_queryparam = i_audio_metrics.
add_query_parameter(
exporting
i_parameter = `audio_metrics`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" process header parameters
data:
lv_headerparam type string ##NEEDED.
if i_Content_Type is supplied.
ls_request_prop-header_content_type = I_Content_Type.
endif.
" process body parameters
ls_request_prop-body_bin = i_audio.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->REGISTER_CALLBACK
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_callback_url TYPE STRING
* | [--->] I_user_secret TYPE STRING(optional)
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_REGISTER_STATUS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method REGISTER_CALLBACK.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/register_callback'.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
lv_queryparam = escape( val = i_callback_url format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `callback_url`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
if i_user_secret is supplied.
lv_queryparam = escape( val = i_user_secret format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `user_secret`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->UNREGISTER_CALLBACK
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_callback_url TYPE STRING
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method UNREGISTER_CALLBACK.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/unregister_callback'.
" standard headers
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
lv_queryparam = escape( val = i_callback_url format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `callback_url`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->CREATE_JOB
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_audio TYPE FILE
* | [--->] I_Content_Type TYPE STRING (default ='application/octet-stream')
* | [--->] I_model TYPE STRING (default ='en-US_BroadbandModel')
* | [--->] I_callback_url TYPE STRING(optional)
* | [--->] I_events TYPE STRING(optional)
* | [--->] I_user_token TYPE STRING(optional)
* | [--->] I_results_ttl TYPE INTEGER(optional)
* | [--->] I_language_customization_id TYPE STRING(optional)
* | [--->] I_acoustic_customization_id TYPE STRING(optional)
* | [--->] I_base_model_version TYPE STRING(optional)
* | [--->] I_customization_weight TYPE DOUBLE(optional)
* | [--->] I_inactivity_timeout TYPE INTEGER(optional)
* | [--->] I_keywords TYPE TT_STRING(optional)
* | [--->] I_keywords_threshold TYPE FLOAT(optional)
* | [--->] I_max_alternatives TYPE INTEGER(optional)
* | [--->] I_word_alternatives_threshold TYPE FLOAT(optional)
* | [--->] I_word_confidence TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_timestamps TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_profanity_filter TYPE BOOLEAN (default =c_boolean_true)
* | [--->] I_smart_formatting TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_speaker_labels TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_customization_id TYPE STRING(optional)
* | [--->] I_grammar_name TYPE STRING(optional)
* | [--->] I_redaction TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_processing_metrics TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_processing_metrics_interval TYPE FLOAT(optional)
* | [--->] I_audio_metrics TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_RECOGNITION_JOB
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method CREATE_JOB.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/recognitions'.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_model is supplied.
lv_queryparam = escape( val = i_model format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `model`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_callback_url is supplied.
lv_queryparam = escape( val = i_callback_url format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `callback_url`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_events is supplied.
lv_queryparam = escape( val = i_events format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `events`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_user_token is supplied.
lv_queryparam = escape( val = i_user_token format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `user_token`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_results_ttl is supplied.
lv_queryparam = i_results_ttl.
add_query_parameter(
exporting
i_parameter = `results_ttl`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_language_customization_id is supplied.
lv_queryparam = escape( val = i_language_customization_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `language_customization_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_acoustic_customization_id is supplied.
lv_queryparam = escape( val = i_acoustic_customization_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `acoustic_customization_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_base_model_version is supplied.
lv_queryparam = escape( val = i_base_model_version format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `base_model_version`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_customization_weight is supplied.
lv_queryparam = i_customization_weight.
add_query_parameter(
exporting
i_parameter = `customization_weight`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_inactivity_timeout is supplied.
lv_queryparam = i_inactivity_timeout.
add_query_parameter(
exporting
i_parameter = `inactivity_timeout`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_keywords is supplied.
data:
lv_item_keywords type STRING.
clear: lv_queryparam, lv_sep.
loop at i_keywords into lv_item_keywords.
lv_queryparam = lv_queryparam && lv_sep && lv_item_keywords.
lv_sep = ','.
endloop.
lv_queryparam = escape( val = lv_queryparam format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `keywords`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_keywords_threshold is supplied.
lv_queryparam = i_keywords_threshold.
add_query_parameter(
exporting
i_parameter = `keywords_threshold`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_max_alternatives is supplied.
lv_queryparam = i_max_alternatives.
add_query_parameter(
exporting
i_parameter = `max_alternatives`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_word_alternatives_threshold is supplied.
lv_queryparam = i_word_alternatives_threshold.
add_query_parameter(
exporting
i_parameter = `word_alternatives_threshold`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_word_confidence is supplied.
lv_queryparam = i_word_confidence.
add_query_parameter(
exporting
i_parameter = `word_confidence`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_timestamps is supplied.
lv_queryparam = i_timestamps.
add_query_parameter(
exporting
i_parameter = `timestamps`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_profanity_filter is supplied.
lv_queryparam = i_profanity_filter.
add_query_parameter(
exporting
i_parameter = `profanity_filter`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_smart_formatting is supplied.
lv_queryparam = i_smart_formatting.
add_query_parameter(
exporting
i_parameter = `smart_formatting`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_speaker_labels is supplied.
lv_queryparam = i_speaker_labels.
add_query_parameter(
exporting
i_parameter = `speaker_labels`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_customization_id is supplied.
lv_queryparam = escape( val = i_customization_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `customization_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_grammar_name is supplied.
lv_queryparam = escape( val = i_grammar_name format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `grammar_name`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_redaction is supplied.
lv_queryparam = i_redaction.
add_query_parameter(
exporting
i_parameter = `redaction`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_processing_metrics is supplied.
lv_queryparam = i_processing_metrics.
add_query_parameter(
exporting
i_parameter = `processing_metrics`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_processing_metrics_interval is supplied.
lv_queryparam = i_processing_metrics_interval.
add_query_parameter(
exporting
i_parameter = `processing_metrics_interval`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_audio_metrics is supplied.
lv_queryparam = i_audio_metrics.
add_query_parameter(
exporting
i_parameter = `audio_metrics`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" process header parameters
data:
lv_headerparam type string ##NEEDED.
if i_Content_Type is supplied.
ls_request_prop-header_content_type = I_Content_Type.
endif.
" process body parameters
ls_request_prop-body_bin = i_audio.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->CHECK_JOBS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_RECOGNITION_JOBS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method CHECK_JOBS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/recognitions'.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->CHECK_JOB
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_RECOGNITION_JOB
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method CHECK_JOB.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/recognitions/{id}'.
replace all occurrences of `{id}` in ls_request_prop-url-path with i_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_JOB
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_id TYPE STRING
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_JOB.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/recognitions/{id}'.
replace all occurrences of `{id}` in ls_request_prop-url-path with i_id ignoring case.
" standard headers
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->CREATE_LANGUAGE_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_create_language_model TYPE T_CREATE_LANGUAGE_MODEL
* | [--->] I_contenttype TYPE string (default ='application/json')
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_LANGUAGE_MODEL
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method CREATE_LANGUAGE_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations'.
" standard headers
ls_request_prop-header_content_type = I_contenttype.
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process body parameters
data:
lv_body type string,
lv_bodyparam type string,
lv_datatype type char.
field-symbols:
<lv_text> type any.
lv_separator = ''.
lv_datatype = get_datatype( i_create_language_model ).
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep or
ls_request_prop-header_content_type cp '*json*'.
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep.
lv_bodyparam = abap_to_json( i_value = i_create_language_model i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ).
else.
lv_bodyparam = abap_to_json( i_name = 'create_language_model' i_value = i_create_language_model ).
endif.
lv_body = lv_body && lv_separator && lv_bodyparam.
else.
assign i_create_language_model to <lv_text>.
lv_bodyparam = <lv_text>.
concatenate lv_body lv_bodyparam into lv_body.
endif.
if ls_request_prop-header_content_type cp '*json*' and lv_body(1) ne '{'.
lv_body = `{` && lv_body && `}`.
endif.
if ls_request_prop-header_content_type cp '*charset=utf-8*'.
ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ).
replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case.
else.
ls_request_prop-body = lv_body.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->LIST_LANGUAGE_MODELS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_language TYPE STRING(optional)
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_LANGUAGE_MODELS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method LIST_LANGUAGE_MODELS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations'.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_language is supplied.
lv_queryparam = escape( val = i_language format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `language`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_LANGUAGE_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_LANGUAGE_MODEL
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_LANGUAGE_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_LANGUAGE_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_LANGUAGE_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->TRAIN_LANGUAGE_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_word_type_to_add TYPE STRING (default ='all')
* | [--->] I_customization_weight TYPE DOUBLE(optional)
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_TRAINING_RESPONSE
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method TRAIN_LANGUAGE_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/train'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_word_type_to_add is supplied.
lv_queryparam = escape( val = i_word_type_to_add format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `word_type_to_add`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_customization_weight is supplied.
lv_queryparam = i_customization_weight.
add_query_parameter(
exporting
i_parameter = `customization_weight`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->RESET_LANGUAGE_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method RESET_LANGUAGE_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/reset'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->UPGRADE_LANGUAGE_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method UPGRADE_LANGUAGE_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/upgrade_model'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->LIST_CORPORA
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_CORPORA
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method LIST_CORPORA.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/corpora'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->ADD_CORPUS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_corpus_name TYPE STRING
* | [--->] I_corpus_file TYPE FILE
* | [--->] I_allow_overwrite TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_corpus_file_CT TYPE STRING (default = ZIF_IBMC_SERVICE_ARCH~C_MEDIATYPE-all)
* | [--->] I_contenttype TYPE string (default ='multipart/form-data')
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method ADD_CORPUS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/corpora/{corpus_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{corpus_name}` in ls_request_prop-url-path with i_corpus_name ignoring case.
" standard headers
ls_request_prop-header_content_type = I_contenttype.
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_allow_overwrite is supplied.
lv_queryparam = i_allow_overwrite.
add_query_parameter(
exporting
i_parameter = `allow_overwrite`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" process form parameters
data:
ls_form_part type ts_form_part,
lt_form_part type tt_form_part,
lv_formdata type string value is initial ##NEEDED,
lv_value type string ##NEEDED,
lv_index(3) type n value '000' ##NEEDED,
lv_keypattern type string ##NEEDED,
lv_base_name type string ##NEEDED,
lv_extension type string ##NEEDED.
if not i_corpus_file is initial.
lv_extension = get_file_extension( I_corpus_file_CT ).
lv_value = `form-data; name="corpus_file"; filename="file` && lv_index && `.` && lv_extension && `"` ##NO_TEXT.
lv_index = lv_index + 1.
clear ls_form_part.
ls_form_part-content_type = I_corpus_file_CT.
ls_form_part-content_disposition = lv_value.
ls_form_part-xdata = i_corpus_file.
append ls_form_part to lt_form_part.
endif.
" execute HTTP POST request
lo_response = HTTP_POST_MULTIPART( i_request_prop = ls_request_prop it_form_part = lt_form_part ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_CORPUS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_corpus_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_CORPUS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_CORPUS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/corpora/{corpus_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{corpus_name}` in ls_request_prop-url-path with i_corpus_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_CORPUS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_corpus_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_CORPUS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/corpora/{corpus_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{corpus_name}` in ls_request_prop-url-path with i_corpus_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->LIST_WORDS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_word_type TYPE STRING (default ='all')
* | [--->] I_sort TYPE STRING (default ='alphabetical')
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_WORDS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method LIST_WORDS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/words'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_word_type is supplied.
lv_queryparam = escape( val = i_word_type format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `word_type`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_sort is supplied.
lv_queryparam = escape( val = i_sort format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `sort`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->ADD_WORDS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_custom_words TYPE T_CUSTOM_WORDS
* | [--->] I_contenttype TYPE string (default ='application/json')
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method ADD_WORDS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/words'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_content_type = I_contenttype.
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process body parameters
data:
lv_body type string,
lv_bodyparam type string,
lv_datatype type char.
field-symbols:
<lv_text> type any.
lv_separator = ''.
lv_datatype = get_datatype( i_custom_words ).
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep or
ls_request_prop-header_content_type cp '*json*'.
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep.
lv_bodyparam = abap_to_json( i_value = i_custom_words i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ).
else.
lv_bodyparam = abap_to_json( i_name = 'custom_words' i_value = i_custom_words ).
endif.
lv_body = lv_body && lv_separator && lv_bodyparam.
else.
assign i_custom_words to <lv_text>.
lv_bodyparam = <lv_text>.
concatenate lv_body lv_bodyparam into lv_body.
endif.
if ls_request_prop-header_content_type cp '*json*' and lv_body(1) ne '{'.
lv_body = `{` && lv_body && `}`.
endif.
if ls_request_prop-header_content_type cp '*charset=utf-8*'.
ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ).
replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case.
else.
ls_request_prop-body = lv_body.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->ADD_WORD
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_word_name TYPE STRING
* | [--->] I_custom_word TYPE T_CUSTOM_WORD
* | [--->] I_contenttype TYPE string (default ='application/json')
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method ADD_WORD.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/words/{word_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{word_name}` in ls_request_prop-url-path with i_word_name ignoring case.
" standard headers
ls_request_prop-header_content_type = I_contenttype.
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process body parameters
data:
lv_body type string,
lv_bodyparam type string,
lv_datatype type char.
field-symbols:
<lv_text> type any.
lv_separator = ''.
lv_datatype = get_datatype( i_custom_word ).
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep or
ls_request_prop-header_content_type cp '*json*'.
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep.
lv_bodyparam = abap_to_json( i_value = i_custom_word i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ).
else.
lv_bodyparam = abap_to_json( i_name = 'custom_word' i_value = i_custom_word ).
endif.
lv_body = lv_body && lv_separator && lv_bodyparam.
else.
assign i_custom_word to <lv_text>.
lv_bodyparam = <lv_text>.
concatenate lv_body lv_bodyparam into lv_body.
endif.
if ls_request_prop-header_content_type cp '*json*' and lv_body(1) ne '{'.
lv_body = `{` && lv_body && `}`.
endif.
if ls_request_prop-header_content_type cp '*charset=utf-8*'.
ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ).
replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case.
else.
ls_request_prop-body = lv_body.
endif.
" execute HTTP PUT request
lo_response = HTTP_PUT( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_WORD
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_word_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_WORD
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_WORD.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/words/{word_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{word_name}` in ls_request_prop-url-path with i_word_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_WORD
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_word_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_WORD.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/words/{word_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{word_name}` in ls_request_prop-url-path with i_word_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->LIST_GRAMMARS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_GRAMMARS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method LIST_GRAMMARS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/grammars'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->ADD_GRAMMAR
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_grammar_name TYPE STRING
* | [--->] I_grammar_file TYPE STRING
* | [--->] I_Content_Type TYPE STRING (default ='application/srgs')
* | [--->] I_allow_overwrite TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method ADD_GRAMMAR.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/grammars/{grammar_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{grammar_name}` in ls_request_prop-url-path with i_grammar_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_allow_overwrite is supplied.
lv_queryparam = i_allow_overwrite.
add_query_parameter(
exporting
i_parameter = `allow_overwrite`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" process header parameters
data:
lv_headerparam type string ##NEEDED.
ls_request_prop-header_content_type = I_Content_Type.
" process body parameters
data:
lv_body type string,
lv_bodyparam type string,
lv_datatype type char.
field-symbols:
<lv_text> type any.
lv_separator = ''.
lv_datatype = get_datatype( i_grammar_file ).
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep or
ls_request_prop-header_content_type cp '*json*'.
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep.
lv_bodyparam = abap_to_json( i_value = i_grammar_file i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ).
else.
lv_bodyparam = abap_to_json( i_name = 'grammar_file' i_value = i_grammar_file ).
endif.
lv_body = lv_body && lv_separator && lv_bodyparam.
else.
assign i_grammar_file to <lv_text>.
lv_bodyparam = <lv_text>.
concatenate lv_body lv_bodyparam into lv_body.
endif.
if ls_request_prop-header_content_type cp '*json*' and lv_body(1) ne '{'.
lv_body = `{` && lv_body && `}`.
endif.
if ls_request_prop-header_content_type cp '*charset=utf-8*'.
ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ).
replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case.
else.
ls_request_prop-body = lv_body.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_GRAMMAR
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_grammar_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_GRAMMAR
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_GRAMMAR.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/grammars/{grammar_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{grammar_name}` in ls_request_prop-url-path with i_grammar_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_GRAMMAR
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_grammar_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_GRAMMAR.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/customizations/{customization_id}/grammars/{grammar_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{grammar_name}` in ls_request_prop-url-path with i_grammar_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->CREATE_ACOUSTIC_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_create_acoustic_model TYPE T_CREATE_ACOUSTIC_MODEL
* | [--->] I_contenttype TYPE string (default ='application/json')
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_ACOUSTIC_MODEL
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method CREATE_ACOUSTIC_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations'.
" standard headers
ls_request_prop-header_content_type = I_contenttype.
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process body parameters
data:
lv_body type string,
lv_bodyparam type string,
lv_datatype type char.
field-symbols:
<lv_text> type any.
lv_separator = ''.
lv_datatype = get_datatype( i_create_acoustic_model ).
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep or
ls_request_prop-header_content_type cp '*json*'.
if lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct or
lv_datatype eq ZIF_IBMC_SERVICE_ARCH~c_datatype-struct_deep.
lv_bodyparam = abap_to_json( i_value = i_create_acoustic_model i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ).
else.
lv_bodyparam = abap_to_json( i_name = 'create_acoustic_model' i_value = i_create_acoustic_model ).
endif.
lv_body = lv_body && lv_separator && lv_bodyparam.
else.
assign i_create_acoustic_model to <lv_text>.
lv_bodyparam = <lv_text>.
concatenate lv_body lv_bodyparam into lv_body.
endif.
if ls_request_prop-header_content_type cp '*json*' and lv_body(1) ne '{'.
lv_body = `{` && lv_body && `}`.
endif.
if ls_request_prop-header_content_type cp '*charset=utf-8*'.
ls_request_prop-body_bin = convert_string_to_utf8( i_string = lv_body ).
replace all occurrences of regex ';\s*charset=utf-8' in ls_request_prop-header_content_type with '' ignoring case.
else.
ls_request_prop-body = lv_body.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->LIST_ACOUSTIC_MODELS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_language TYPE STRING(optional)
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_ACOUSTIC_MODELS
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method LIST_ACOUSTIC_MODELS.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations'.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_language is supplied.
lv_queryparam = escape( val = i_language format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `language`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_ACOUSTIC_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_ACOUSTIC_MODEL
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_ACOUSTIC_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_ACOUSTIC_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_ACOUSTIC_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->TRAIN_ACOUSTIC_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_custom_language_model_id TYPE STRING(optional)
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_TRAINING_RESPONSE
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method TRAIN_ACOUSTIC_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}/train'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_custom_language_model_id is supplied.
lv_queryparam = escape( val = i_custom_language_model_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `custom_language_model_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->RESET_ACOUSTIC_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method RESET_ACOUSTIC_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}/reset'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->UPGRADE_ACOUSTIC_MODEL
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_custom_language_model_id TYPE STRING(optional)
* | [--->] I_force TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method UPGRADE_ACOUSTIC_MODEL.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}/upgrade_model'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_custom_language_model_id is supplied.
lv_queryparam = escape( val = i_custom_language_model_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `custom_language_model_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
if i_force is supplied.
lv_queryparam = i_force.
add_query_parameter(
exporting
i_parameter = `force`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->LIST_AUDIO
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_AUDIO_RESOURCES
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method LIST_AUDIO.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}/audio'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->ADD_AUDIO
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_audio_name TYPE STRING
* | [--->] I_audio_resource TYPE FILE
* | [--->] I_Content_Type TYPE STRING (default ='application/zip')
* | [--->] I_Contained_Content_Type TYPE STRING(optional)
* | [--->] I_allow_overwrite TYPE BOOLEAN (default =c_boolean_false)
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method ADD_AUDIO.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}/audio/{audio_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{audio_name}` in ls_request_prop-url-path with i_audio_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
if i_allow_overwrite is supplied.
lv_queryparam = i_allow_overwrite.
add_query_parameter(
exporting
i_parameter = `allow_overwrite`
i_value = lv_queryparam
i_is_boolean = c_boolean_true
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
endif.
" process header parameters
data:
lv_headerparam type string ##NEEDED.
if i_Content_Type is supplied.
ls_request_prop-header_content_type = I_Content_Type.
endif.
if i_Contained_Content_Type is supplied.
lv_headerparam = I_Contained_Content_Type.
add_header_parameter(
exporting
i_parameter = 'Contained-Content-Type'
i_value = lv_headerparam
changing
c_headers = ls_request_prop-headers ) ##NO_TEXT.
endif.
" process body parameters
ls_request_prop-body_bin = i_audio_resource.
" execute HTTP POST request
lo_response = HTTP_POST( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->GET_AUDIO
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_audio_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [<---] E_RESPONSE TYPE T_AUDIO_LISTING
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method GET_AUDIO.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}/audio/{audio_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{audio_name}` in ls_request_prop-url-path with i_audio_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP GET request
lo_response = HTTP_GET( i_request_prop = ls_request_prop ).
" retrieve JSON data
lv_json = get_response_string( lo_response ).
parse_json(
exporting
i_json = lv_json
i_dictionary = c_abapname_dictionary
changing
c_abap = e_response ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_AUDIO
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customization_id TYPE STRING
* | [--->] I_audio_name TYPE STRING
* | [--->] I_accept TYPE string (default ='application/json')
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_AUDIO.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/acoustic_customizations/{customization_id}/audio/{audio_name}'.
replace all occurrences of `{customization_id}` in ls_request_prop-url-path with i_customization_id ignoring case.
replace all occurrences of `{audio_name}` in ls_request_prop-url-path with i_audio_name ignoring case.
" standard headers
ls_request_prop-header_accept = I_accept.
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_IBMC_SPEECH_TO_TEXT_V1->DELETE_USER_DATA
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_customer_id TYPE STRING
* | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION
* +--------------------------------------------------------------------------------------</SIGNATURE>
method DELETE_USER_DATA.
data:
ls_request_prop type ts_request_prop,
lv_separator(1) type c ##NEEDED,
lv_sep(1) type c ##NEEDED,
lo_response type to_rest_response,
lv_json type string ##NEEDED.
ls_request_prop-url-path = '/v1/user_data'.
" standard headers
set_default_query_parameters(
changing
c_url = ls_request_prop-url ).
" process query parameters
data:
lv_queryparam type string.
lv_queryparam = escape( val = i_customer_id format = cl_abap_format=>e_uri_full ).
add_query_parameter(
exporting
i_parameter = `customer_id`
i_value = lv_queryparam
changing
c_url = ls_request_prop-url ) ##NO_TEXT.
" execute HTTP DELETE request
lo_response = HTTP_DELETE( i_request_prop = ls_request_prop ).
endmethod.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method ZCL_IBMC_SPEECH_TO_TEXT_V1->SET_DEFAULT_QUERY_PARAMETERS
* +-------------------------------------------------------------------------------------------------+
* | [<-->] C_URL TYPE TS_URL
* +--------------------------------------------------------------------------------------</SIGNATURE>
method set_default_query_parameters.
endmethod.
ENDCLASS.
| 39.29905 | 164 | 0.636454 |
35bb8e94094ee69be03964c1d19f5cf1148dcd5f
| 19,375 |
abap
|
ABAP
|
chapter_07/yy_head_first_facade.prog.abap
|
sekharchandra-d/Design_Pattern_ABAP
|
c6ea18bc5f2156989758cc433f99794e19da0100
|
[
"MIT"
] | 4 |
2018-01-23T00:34:45.000Z
|
2022-03-18T16:13:57.000Z
|
chapter_07/yy_head_first_facade.prog.abap
|
sekharchandra-d/Design_Pattern_ABAP
|
c6ea18bc5f2156989758cc433f99794e19da0100
|
[
"MIT"
] | 1 |
2018-01-23T06:28:25.000Z
|
2021-10-05T16:52:56.000Z
|
chapter_07/yy_head_first_facade.prog.abap
|
sekharchandra-d/Design_Pattern_ABAP
|
c6ea18bc5f2156989758cc433f99794e19da0100
|
[
"MIT"
] | 7 |
2018-02-21T14:55:38.000Z
|
2021-12-17T12:58:10.000Z
|
*&---------------------------------------------------------------------*
*& Sample for Being Adaptive - the Facade Pattern
*& based on Head First Design Patterns: Chapter 7
*&---------------------------------------------------------------------*
REPORT yy_head_first_facade.
*&---------------------------------------------------------------------*
*& Home theater component: AM/FM Tuner
*&---------------------------------------------------------------------*
CLASS lcl_tuner DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
on, off, set_am, set_fm,
set_frequency IMPORTING iv_frequency TYPE f,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA:
mv_description TYPE string,
mv_frequency TYPE f.
ENDCLASS.
CLASS lcl_tuner IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD on.
cl_demo_output=>write( |{ mv_description } on| ).
ENDMETHOD.
METHOD off.
cl_demo_output=>write( |{ mv_description } off| ).
ENDMETHOD.
METHOD set_am.
cl_demo_output=>write( |{ mv_description } setting AM mode| ).
ENDMETHOD.
METHOD set_fm.
cl_demo_output=>write( |{ mv_description } setting FM mode| ).
ENDMETHOD.
METHOD set_frequency.
mv_frequency = iv_frequency.
cl_demo_output=>write( |{ mv_description } setting frequency | &
|to { mv_frequency DECIMALS = 1 }| ).
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home theater component: DVD player
*&---------------------------------------------------------------------*
CLASS lcl_dvd_player DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
on, off, eject, stop, pause,
play IMPORTING iv_title TYPE string,
play_episode IMPORTING iv_episode TYPE i,
set_two_channel_audio,
set_surround_audio,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA:
mv_description TYPE string,
mv_title TYPE string,
mv_current_episode TYPE i.
ENDCLASS.
CLASS lcl_dvd_player IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD on.
cl_demo_output=>write( |{ mv_description } on| ).
ENDMETHOD.
METHOD off.
cl_demo_output=>write( |{ mv_description } off| ).
ENDMETHOD.
METHOD eject.
CLEAR mv_title.
cl_demo_output=>write( |{ mv_description } eject| ).
ENDMETHOD.
METHOD stop.
CLEAR mv_current_episode.
cl_demo_output=>write( |{ mv_description } stopped| ).
ENDMETHOD.
METHOD pause.
cl_demo_output=>write( |{ mv_description } paused "{ mv_title }"| ).
ENDMETHOD.
METHOD play.
mv_title = iv_title.
cl_demo_output=>write( |{ mv_description } | &
|playing DVD "{ mv_title }"| ).
ENDMETHOD.
METHOD play_episode.
IF mv_title IS INITIAL.
cl_demo_output=>write( |{ mv_description } can't play episode | &
|{ iv_episode }, no DVD inserted| ).
ELSE.
mv_current_episode = iv_episode.
cl_demo_output=>write( |{ mv_description } playing | &
|episode { mv_current_episode }| ).
ENDIF.
ENDMETHOD.
METHOD set_two_channel_audio.
cl_demo_output=>write( |{ mv_description } set two channel audio| ).
ENDMETHOD.
METHOD set_surround_audio.
cl_demo_output=>write( |{ mv_description } set surround audio| ).
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home theater component: CD player
*&---------------------------------------------------------------------*
CLASS lcl_cd_player DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
on, off, eject, stop, pause,
play IMPORTING iv_title TYPE string,
play_track IMPORTING iv_track TYPE i,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA:
mv_description TYPE string,
mv_title TYPE string,
mv_current_track TYPE i.
ENDCLASS.
CLASS lcl_cd_player IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD on.
cl_demo_output=>write( |{ mv_description } on| ).
ENDMETHOD.
METHOD off.
cl_demo_output=>write( |{ mv_description } off| ).
ENDMETHOD.
METHOD eject.
CLEAR mv_title.
cl_demo_output=>write( |{ mv_description } eject| ).
ENDMETHOD.
METHOD stop.
CLEAR mv_current_track.
cl_demo_output=>write( |{ mv_description } stopped| ).
ENDMETHOD.
METHOD pause.
cl_demo_output=>write( |{ mv_description } paused "{ mv_title }"| ).
ENDMETHOD.
METHOD play.
mv_title = iv_title.
cl_demo_output=>write( |{ mv_description } | &
|playing title "{ mv_title }"| ).
ENDMETHOD.
METHOD play_track.
IF mv_title IS INITIAL.
cl_demo_output=>write( |{ mv_description } can't play track | &
|{ iv_track }, no CD inserted| ).
ELSE.
mv_current_track = iv_track.
cl_demo_output=>write( |{ mv_description } playing | &
|track { mv_current_track }| ).
ENDIF.
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home theater component: Amplifier
*&---------------------------------------------------------------------*
CLASS lcl_amplifier DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
on, off,
set_stereo_sound,
set_surround_sound,
set_volume IMPORTING iv_level TYPE i,
set_tuner IMPORTING io_tuner TYPE REF TO lcl_tuner,
set_dvd IMPORTING io_dvd TYPE REF TO lcl_dvd_player,
set_cd IMPORTING io_cd TYPE REF TO lcl_cd_player,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA:
mv_description TYPE string,
mo_tuner TYPE REF TO lcl_tuner,
mo_dvd TYPE REF TO lcl_dvd_player,
mo_cd TYPE REF TO lcl_cd_player.
ENDCLASS.
CLASS lcl_amplifier IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD on.
cl_demo_output=>write( |{ mv_description } on| ).
ENDMETHOD.
METHOD off.
cl_demo_output=>write( |{ mv_description } off| ).
ENDMETHOD.
METHOD set_stereo_sound.
cl_demo_output=>write( |{ mv_description } stereo mode on| ).
ENDMETHOD.
METHOD set_surround_sound.
cl_demo_output=>write( |{ mv_description } surround sound on| ).
ENDMETHOD.
METHOD set_volume.
cl_demo_output=>write( |{ mv_description } setting volume | &
|to { iv_level }| ).
ENDMETHOD.
METHOD set_tuner.
mo_tuner = io_tuner.
cl_demo_output=>write( |{ mv_description } setting tuner | &
|to { mo_tuner->description( ) }| ).
ENDMETHOD.
METHOD set_dvd.
mo_dvd = io_dvd.
cl_demo_output=>write( |{ mv_description } setting DVD player | &
|to { mo_dvd->description( ) }| ).
ENDMETHOD.
METHOD set_cd.
mo_cd = io_cd.
cl_demo_output=>write( |{ mv_description } setting CD player | &
|to { mo_cd->description( ) }| ).
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home theater component: Projector
*&---------------------------------------------------------------------*
CLASS lcl_projector DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
on, off, wide_screen_mode, tv_mode,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA mv_description TYPE string.
ENDCLASS.
CLASS lcl_projector IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD on.
cl_demo_output=>write( |{ mv_description } on| ).
ENDMETHOD.
METHOD off.
cl_demo_output=>write( |{ mv_description } off| ).
ENDMETHOD.
METHOD wide_screen_mode.
cl_demo_output=>write( |{ mv_description } | &
|in widescreen mode (16x9 aspect ratio)| ).
ENDMETHOD.
METHOD tv_mode.
cl_demo_output=>write( |{ mv_description } | &
|in tv mode (4x3 aspect ratio)| ).
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home theater component: Projector Screen
*&---------------------------------------------------------------------*
CLASS lcl_screen DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
up, down,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA mv_description TYPE string.
ENDCLASS.
CLASS lcl_screen IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD up.
cl_demo_output=>write( |{ mv_description } going up| ).
ENDMETHOD.
METHOD down.
cl_demo_output=>write( |{ mv_description } going down| ).
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home theater component: Theater Lights
*&---------------------------------------------------------------------*
CLASS lcl_theater_lights DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
on, off,
dim IMPORTING iv_level TYPE i,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA mv_description TYPE string.
ENDCLASS.
CLASS lcl_theater_lights IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD on.
cl_demo_output=>write( |{ mv_description } on| ).
ENDMETHOD.
METHOD off.
cl_demo_output=>write( |{ mv_description } off| ).
ENDMETHOD.
METHOD dim.
cl_demo_output=>write( |{ mv_description } | &
|dimming to { iv_level }%| ).
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home theater component: Popcorn Popper
*&---------------------------------------------------------------------*
CLASS lcl_popcorn_popper DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor IMPORTING iv_description TYPE string,
on, off, pop,
description RETURNING VALUE(rv_text) TYPE string.
PRIVATE SECTION.
DATA mv_description TYPE string.
ENDCLASS.
CLASS lcl_popcorn_popper IMPLEMENTATION.
METHOD constructor.
mv_description = iv_description.
ENDMETHOD.
METHOD on.
cl_demo_output=>write( |{ mv_description } on| ).
ENDMETHOD.
METHOD off.
cl_demo_output=>write( |{ mv_description } off| ).
ENDMETHOD.
METHOD pop.
cl_demo_output=>write( |{ mv_description } popping popcorn!| ).
ENDMETHOD.
METHOD description.
rv_text = mv_description.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Home Theater Facade - a unified interface that is easier to use.
*&---------------------------------------------------------------------*
*& The Home Theater Facade manages all those subsystem components for
*& the client. It keeps the client simple and flexible. We can upgrade
*& the home theater components without affecting the client.
*&---------------------------------------------------------------------*
CLASS lcl_home_theater_facade DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING
io_amp TYPE REF TO lcl_amplifier
io_tuner TYPE REF TO lcl_tuner
io_dvd TYPE REF TO lcl_dvd_player
io_cd TYPE REF TO lcl_cd_player
io_projector TYPE REF TO lcl_projector
io_screen TYPE REF TO lcl_screen
io_lights TYPE REF TO lcl_theater_lights
io_popper TYPE REF TO lcl_popcorn_popper,
" watch_movie() follows the same sequence we had to do by hand,
" but wraps it up in a handy method that does all the work.
" Notice that for each task we are delegating the responsibility
" to the corresponding component in the subsystem.
watch_movie IMPORTING iv_movie TYPE string,
" And end_movie() takes care of shutting everything down for us.
" Again, each task is delegated to the appropriate component of
" the subsystem.
end_movie,
listen_to_cd IMPORTING iv_cd_title TYPE string,
end_cd,
listen_to_radio IMPORTING iv_frequency TYPE f,
end_radio,
watch_tv_on_dvd IMPORTING iv_title TYPE string,
end_tv_on_dvd.
PRIVATE SECTION.
" Here's the composition; these are all the components of the
" subsystem we are going to use.
DATA:
mo_amp TYPE REF TO lcl_amplifier,
mo_tuner TYPE REF TO lcl_tuner,
mo_dvd TYPE REF TO lcl_dvd_player,
mo_cd TYPE REF TO lcl_cd_player,
mo_projector TYPE REF TO lcl_projector,
mo_screen TYPE REF TO lcl_screen,
mo_lights TYPE REF TO lcl_theater_lights,
mo_popper TYPE REF TO lcl_popcorn_popper.
ENDCLASS.
CLASS lcl_home_theater_facade IMPLEMENTATION.
METHOD constructor.
" The facade is passed a reference to each component of the
" subsystem in its constructor. The facade then assigns each
" to the corresponding instance variable.
mo_amp = io_amp.
mo_tuner = io_tuner.
mo_dvd = io_dvd.
mo_cd = io_cd.
mo_projector = io_projector.
mo_lights = io_lights.
mo_screen = io_screen.
mo_popper = io_popper.
ENDMETHOD.
METHOD watch_movie.
cl_demo_output=>write_text( |Get ready to watch a movie...| ).
" Turn on the popcorn popper and start popping ...
mo_popper->on( ).
mo_popper->pop( ).
" Dim the lights to 10% ...
mo_lights->dim( 10 ).
" Put the screen down ...
mo_screen->down( ).
" Turn on the projector and put it in wide screen mode ...
mo_projector->on( ).
mo_projector->wide_screen_mode( ).
" Turn on the amplifier, set it to the DVD player, put it in
" surround sound mode and set the volume to 5 ...
mo_amp->on( ).
mo_amp->set_dvd( mo_dvd ).
mo_amp->set_surround_sound( ).
mo_amp->set_volume( 5 ).
" Turn on the DVD player, set the audio to surround and FINALLY,
" play the movie!
mo_dvd->on( ).
mo_dvd->set_surround_audio( ).
mo_dvd->play( iv_movie ).
" Six different classes involved!
ENDMETHOD.
METHOD end_movie.
cl_demo_output=>write_text( |Shutting movie theater down...| ).
mo_popper->off( ).
mo_lights->on( ).
mo_screen->up( ).
mo_projector->off( ).
mo_amp->off( ).
mo_dvd->pause( ).
mo_dvd->stop( ).
mo_dvd->eject( ).
mo_dvd->off( ).
ENDMETHOD.
METHOD listen_to_cd.
cl_demo_output=>write_text( |Get ready for an audio experence...| ).
mo_lights->dim( 10 ).
mo_amp->on( ).
mo_amp->set_volume( 5 ).
mo_amp->set_cd( mo_cd ).
mo_amp->set_stereo_sound( ).
mo_cd->on( ).
mo_cd->play( iv_cd_title ).
mo_cd->play_track( 1 ).
ENDMETHOD.
METHOD end_cd.
cl_demo_output=>write_text( |Shutting down CD...| ).
mo_lights->on( ).
mo_amp->off( ).
mo_cd->pause( ).
mo_cd->stop( ).
mo_cd->eject( ).
mo_cd->off( ).
ENDMETHOD.
METHOD listen_to_radio.
cl_demo_output=>write_text( |Tuning in the airwaves...| ).
mo_tuner->on( ).
mo_tuner->set_fm( ).
mo_tuner->set_frequency( iv_frequency ).
mo_amp->on( ).
mo_amp->set_volume( 5 ).
mo_amp->set_tuner( mo_tuner ).
ENDMETHOD.
METHOD end_radio.
cl_demo_output=>write_text( |Shutting down the tuner...| ).
mo_tuner->set_am( ).
mo_tuner->off( ).
mo_amp->off( ).
ENDMETHOD.
METHOD watch_tv_on_dvd.
cl_demo_output=>write_text( |Get ready for a TV show on DVD...| ).
mo_screen->down( ).
mo_projector->on( ).
mo_projector->tv_mode( ).
mo_amp->on( ).
mo_amp->set_dvd( mo_dvd ).
mo_amp->set_stereo_sound( ).
mo_amp->set_volume( 5 ).
mo_dvd->on( ).
mo_dvd->set_two_channel_audio( ).
mo_dvd->play( iv_title ).
mo_dvd->play_episode( 1 ).
ENDMETHOD.
METHOD end_tv_on_dvd.
cl_demo_output=>write_text( |Shutting down DVD...| ).
mo_screen->up( ).
mo_projector->off( ).
mo_amp->off( ).
mo_dvd->stop( ).
mo_dvd->eject( ).
mo_dvd->off( ).
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& It's SHOWTIME! - this is a client of the subsystem facade
*&---------------------------------------------------------------------*
CLASS lcl_home_theater_test_drive DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS main.
ENDCLASS.
CLASS lcl_home_theater_test_drive IMPLEMENTATION.
METHOD main.
" Here we're creating the components right in the test drive.
" Normally the client is given a facade; it doesn't have to
" construct one itself.
DATA(lo_amp) = NEW lcl_amplifier( |Top-O-Line Amplifier| ).
DATA(lo_tuner) = NEW lcl_tuner( |Top-O-Line AM/FM Tuner| ).
DATA(lo_dvd) = NEW lcl_dvd_player( |Top-O-Line DVD Player| ).
DATA(lo_cd) = NEW lcl_cd_player( |Top-O-Line CD Player| ).
DATA(lo_projector) = NEW lcl_projector( |Top-O-Line Projector| ).
DATA(lo_screen) = NEW lcl_screen( |Theater Screen| ).
DATA(lo_lights) = NEW lcl_theater_lights( |Theater Ceiling Light| ).
DATA(lo_popper) = NEW lcl_popcorn_popper( |Popcorn Popper| ).
" Instantiate the Facade with all the components in the subsystem.
DATA(lo_home_theater) = NEW lcl_home_theater_facade(
io_amp = lo_amp
io_tuner = lo_tuner
io_dvd = lo_dvd
io_cd = lo_cd
io_projector = lo_projector
io_screen = lo_screen
io_lights = lo_lights
io_popper = lo_popper ).
" Use the simplified interface to first start up the movie ...
lo_home_theater->watch_movie( |Raiders of the Lost Ark| ).
cl_demo_output=>line( ).
" ... and then shut it down.
lo_home_theater->end_movie( ).
cl_demo_output=>line( ).
lo_home_theater->listen_to_cd( |Miles Davis - Kind of Blue| ).
cl_demo_output=>line( ).
lo_home_theater->end_cd( ).
cl_demo_output=>line( ).
lo_home_theater->listen_to_radio( CONV #( '91.1' ) ).
cl_demo_output=>line( ).
lo_home_theater->end_radio( ).
cl_demo_output=>line( ).
lo_home_theater->watch_tv_on_dvd( 'M*A*S*H - Season 5' ).
cl_demo_output=>line( ).
lo_home_theater->end_tv_on_dvd( ).
cl_demo_output=>line( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
cl_demo_output=>begin_section(
|Being Adaptive - the Facade Pattern| ).
cl_demo_output=>line( ).
lcl_home_theater_test_drive=>main( ).
cl_demo_output=>display( ).
| 32.563025 | 72 | 0.610323 |
35c140534403efda2396f4d34d538d60640b2cbd
| 5,818 |
abap
|
ABAP
|
src/checks/zcl_aoc_check_39.clas.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 199 |
2015-02-17T07:08:01.000Z
|
2022-03-23T09:50:05.000Z
|
src/checks/zcl_aoc_check_39.clas.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 769 |
2015-01-03T07:09:11.000Z
|
2022-03-21T11:59:53.000Z
|
src/checks/zcl_aoc_check_39.clas.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 109 |
2015-03-09T10:22:34.000Z
|
2022-03-08T08:47:41.000Z
|
CLASS zcl_aoc_check_39 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super_root
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS get_attributes
REDEFINITION .
METHODS if_ci_test~query_attributes
REDEFINITION .
METHODS put_attributes
REDEFINITION .
METHODS run
REDEFINITION .
PROTECTED SECTION.
DATA ms_settings TYPE sci_s_naming_conventions_setup .
METHODS check_name
IMPORTING
!iv_name TYPE tdsfvname
!iv_prefix TYPE sci_e_type_prefix
!it_regular TYPE sci_t_regular_expressions .
METHODS determine_prefix
IMPORTING
!is_ssfgdata TYPE ssfgdata
RETURNING
VALUE(rv_prefix) TYPE sci_e_type_prefix .
METHODS set_defaults .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_39 IMPLEMENTATION.
METHOD check_name.
DATA: lv_regular LIKE LINE OF it_regular.
LOOP AT it_regular INTO lv_regular.
REPLACE ALL OCCURRENCES OF '[:type:]' IN lv_regular WITH iv_prefix.
FIND REGEX lv_regular IN iv_name.
IF sy-subrc = 0.
RETURN.
ENDIF.
ENDLOOP.
inform( p_sub_obj_type = object_type
p_sub_obj_name = object_name
p_test = myname
p_kind = mv_errty
p_code = '001'
p_param_1 = iv_name ).
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '002'.
position = '039'.
has_documentation = abap_true.
has_attributes = abap_true.
attributes_ok = abap_true.
add_obj_type( 'SSFO' ).
set_defaults( ).
insert_scimessage(
iv_code = '001'
iv_text = 'Wrong naming, &1'(m01) ).
ENDMETHOD.
METHOD determine_prefix.
DATA: lo_type TYPE REF TO cl_abap_typedescr,
lv_clstype TYPE seoclass-clsname.
CASE is_ssfgdata-typing.
WHEN 'TYPE'.
cl_abap_typedescr=>describe_by_name(
EXPORTING
p_name = is_ssfgdata-typename
RECEIVING
p_descr_ref = lo_type
EXCEPTIONS
type_not_found = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
RETURN.
ENDIF.
CASE lo_type->kind.
WHEN cl_abap_typedescr=>kind_elem.
rv_prefix = ms_settings-prefix_elementary.
WHEN cl_abap_typedescr=>kind_struct.
rv_prefix = ms_settings-prefix_structure.
WHEN cl_abap_typedescr=>kind_table.
rv_prefix = ms_settings-prefix_table_any.
ENDCASE.
WHEN 'TYPE REF TO'.
SELECT SINGLE clstype FROM seoclass
INTO lv_clstype
WHERE clsname = is_ssfgdata-typename.
IF sy-subrc = 0.
CASE lv_clstype.
WHEN '0'.
rv_prefix = ms_settings-prefix_ref_class.
WHEN '1'.
rv_prefix = ms_settings-prefix_ref_interface.
ENDCASE.
ENDIF.
ENDCASE.
ENDMETHOD.
METHOD get_attributes.
EXPORT
mv_errty = mv_errty
ms_settings = ms_settings
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 ms_settings-prefix_elementary
'Elementary Type' ''. "#EC NOTEXT
zzaoc_fill_att ms_settings-prefix_structure
'Structure' ''. "#EC NOTEXT
zzaoc_fill_att ms_settings-prefix_table_any
'Table' ''. "#EC NOTEXT
zzaoc_fill_att ms_settings-prefix_ref_class
'Reference to Class' ''. "#EC NOTEXT
zzaoc_fill_att ms_settings-prefix_ref_interface
'Reference to Interface' ''. "#EC NOTEXT
zzaoc_fill_att ms_settings-patterns_prog_data_global
'Global Data' ''. "#EC NOTEXT
zzaoc_fill_att ms_settings-patterns_prog_field_symbol_glb
'Field Symbols' ''. "#EC NOTEXT
zzaoc_popup.
ENDMETHOD.
METHOD put_attributes.
IMPORT
mv_errty = mv_errty
ms_settings = ms_settings
FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD run.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lv_name TYPE tdsfname,
lv_prefix TYPE sci_e_type_prefix,
lo_sf TYPE REF TO cl_ssf_fb_smart_form.
FIELD-SYMBOLS: <ls_data> LIKE LINE OF lo_sf->fsymbols.
IF object_type <> 'SSFO'.
RETURN.
ENDIF.
CREATE OBJECT lo_sf.
lv_name = object_name.
lo_sf->load( lv_name ).
LOOP AT lo_sf->fsymbols ASSIGNING <ls_data>.
lv_prefix = determine_prefix( <ls_data> ).
check_name( iv_name = <ls_data>-name
iv_prefix = lv_prefix
it_regular = ms_settings-patterns_prog_field_symbol_glb ).
ENDLOOP.
LOOP AT lo_sf->gdata ASSIGNING <ls_data>.
lv_prefix = determine_prefix( <ls_data> ).
check_name( iv_name = <ls_data>-name
iv_prefix = lv_prefix
it_regular = ms_settings-patterns_prog_data_global ).
ENDLOOP.
ENDMETHOD.
METHOD set_defaults.
CLEAR ms_settings.
ms_settings-prefix_elementary = 'V'.
ms_settings-prefix_structure = 'S'.
ms_settings-prefix_table_any = 'T'.
ms_settings-prefix_ref_class = 'O'.
ms_settings-prefix_ref_interface = 'I'.
APPEND '(/.*/)?G[:type:]_' TO ms_settings-patterns_prog_data_global.
APPEND '<G[:type:]_' TO ms_settings-patterns_prog_field_symbol_glb.
ENDMETHOD.
ENDCLASS.
| 24.652542 | 76 | 0.60691 |
35c1e4ca45462d7bb0def7cecdee6503d2e90201
| 10,196 |
abap
|
ABAP
|
src/utils/zcl_abapgit_utils.clas.testclasses.abap
|
Manny27nyc/abapGit
|
dc51247e9b8c0c792193aba857ec31df3a82db4a
|
[
"MIT"
] | 797 |
2015-02-06T15:38:41.000Z
|
2020-09-23T02:57:02.000Z
|
src/utils/zcl_abapgit_utils.clas.testclasses.abap
|
Manny27nyc/abapGit
|
dc51247e9b8c0c792193aba857ec31df3a82db4a
|
[
"MIT"
] | 2,776 |
2015-01-13T03:59:55.000Z
|
2020-09-23T21:46:34.000Z
|
src/utils/zcl_abapgit_utils.clas.testclasses.abap
|
Manny27nyc/abapGit
|
dc51247e9b8c0c792193aba857ec31df3a82db4a
|
[
"MIT"
] | 499 |
2015-01-13T03:41:36.000Z
|
2020-09-22T11:50:54.000Z
|
CLASS ltcl_extract_author_data DEFINITION FINAL
FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS extract_author_data1 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data2 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data3 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data4 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data5 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data6 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data7 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data8 FOR TESTING RAISING cx_static_check.
METHODS extract_author_data9 FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_extract_author_data IMPLEMENTATION.
METHOD extract_author_data1.
TRY.
zcl_abapgit_utils=>extract_author_data( 'Volker Jägle äÖüß <[email protected]> 1573216988 +0000' ).
CATCH zcx_abapgit_exception.
cl_abap_unit_assert=>fail( |Language-related special characters in author name are allowed.| ).
ENDTRY.
ENDMETHOD.
METHOD extract_author_data2.
TRY.
zcl_abapgit_utils=>extract_author_data(
'pull[bot&%#$] <39814207+pull[bot]@users.noreply.github.com> 1573216988 +0000' ).
CATCH zcx_abapgit_exception.
cl_abap_unit_assert=>fail( |Special characters in author name are allowed.| ).
ENDTRY.
ENDMETHOD.
METHOD extract_author_data3.
TRY.
zcl_abapgit_utils=>extract_author_data(
'pull[bot] <39814207+pull[bot]@users.noreply.github.com> 1573216988 +00001' ).
cl_abap_unit_assert=>fail( |+00001 shouldn't be valid cause it's too long.| ).
CATCH zcx_abapgit_exception.
ENDTRY.
ENDMETHOD.
METHOD extract_author_data4.
TRY.
zcl_abapgit_utils=>extract_author_data(
'pull[bot] <39814207+pull[bot]@users.noreply.github.com> 15732169881 +0000' ).
cl_abap_unit_assert=>fail( |Value shouldn't be valid cause time is invalid.| ).
CATCH zcx_abapgit_exception.
ENDTRY.
ENDMETHOD.
METHOD extract_author_data5.
TRY.
zcl_abapgit_utils=>extract_author_data(
'<39814207+pull[bot]@users.noreply.github.com> 1573216988 +0000' ).
cl_abap_unit_assert=>fail( |Value shouldn't be valid cause no author name was supplied.| ).
CATCH zcx_abapgit_exception.
ENDTRY.
ENDMETHOD.
METHOD extract_author_data6.
TRY.
zcl_abapgit_utils=>extract_author_data( 'pull[bot] 1573216988 +0000' ).
cl_abap_unit_assert=>fail( |Value shouldn't be valid cause no email was supplied.| ).
CATCH zcx_abapgit_exception.
ENDTRY.
ENDMETHOD.
METHOD extract_author_data7.
TRY.
zcl_abapgit_utils=>extract_author_data( 'pull[bot] <39814207+pull[bot]@users.noreply.github.com> +0000' ).
cl_abap_unit_assert=>fail( |Value shouldn't be valid cause no time was supplied.| ).
CATCH zcx_abapgit_exception.
ENDTRY.
ENDMETHOD.
METHOD extract_author_data8.
TRY.
zcl_abapgit_utils=>extract_author_data(
'pull[bot] <39814207+pull[bot]@users.noreply.github.com> 1573216988' ).
cl_abap_unit_assert=>fail( |Value shouldn't be valid cause +0000 wasn't supplied.| ).
CATCH zcx_abapgit_exception.
ENDTRY.
ENDMETHOD.
METHOD extract_author_data9.
TRY.
zcl_abapgit_utils=>extract_author_data(
'<pull[bot]()> <39814207+pull[bot]@users.noreply.github.com> 1573216988 +0000' ).
CATCH zcx_abapgit_exception.
cl_abap_unit_assert=>fail( |Value should be valid though brackets are in author name.| ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
CLASS ltcl_is_binary DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PUBLIC SECTION.
CLASS-METHODS:
class_constructor.
PRIVATE SECTION.
DATA mv_given_file TYPE xstring.
DATA mv_act_is_binary TYPE abap_bool.
CLASS-DATA:
gv_nl TYPE c LENGTH 1,
gv_cr_lf TYPE c LENGTH 2.
METHODS:
cds_metadata_is_text FOR TESTING RAISING cx_static_check,
cds_with_umlaut_is_text FOR TESTING RAISING cx_static_check,
image_is_binary FOR TESTING RAISING cx_static_check,
given_file
IMPORTING
iv_file TYPE string,
given_image,
given_cds_metadata,
given_cds_view_with_umlaut,
when_is_binary_determined,
then_is_not_binary,
then_is_binary.
ENDCLASS.
CLASS ltcl_is_binary IMPLEMENTATION.
METHOD class_constructor.
gv_nl = cl_abap_char_utilities=>newline.
gv_cr_lf = cl_abap_char_utilities=>cr_lf.
ENDMETHOD.
METHOD cds_metadata_is_text.
given_cds_metadata( ).
when_is_binary_determined( ).
then_is_not_binary( ).
ENDMETHOD.
METHOD cds_with_umlaut_is_text.
given_cds_view_with_umlaut( ).
when_is_binary_determined( ).
then_is_not_binary( ).
ENDMETHOD.
METHOD image_is_binary.
given_image( ).
when_is_binary_determined( ).
then_is_binary( ).
ENDMETHOD.
METHOD given_file.
mv_given_file = zcl_abapgit_convert=>string_to_xstring_utf8( iv_file ).
ENDMETHOD.
METHOD given_image.
mv_given_file =
zcl_abapgit_convert=>base64_to_xstring(
`iVBORw0KGgoAAAANSUhEUgAAALEAAAA1CAYAAAAOCAoLAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8Y`
&& `QUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAecSURBVHhe7ZvLilxVFIb1BfQFdOxAcaAgJIgX8B4HOkkPHB`
&& `kxOjFiFBRaEIzowIEYBVGQBMULeIsjFeNI0YGT6EzsB+jETuIblP0V7mbVqn/vs06dc6rqdPbgg+4+a1/`
&& `O3t++VvVV29vbk0plzFSJK6OnSlwZPVXiyuipEldGT5W4MnoGk3jn848nl44/Pdn58D35vFLpi0Ekvvjy`
&& `85N/b795D35XcZVKH/QusRe4ilwZml4lzgmcqCJXhqBXiXc2j0t5LVXkSt/0IvGFn37Y+7mKXFk2nSVOW`
&& `4h/Pvto729V5Moy6SRxEjjhRb549LGZ554q8v7j15/PTs5+/80U9XwIFpbYC5ywIidKM/OqRf7j3O+Tt9`
&& `54QfLjd1/LNBUNbXbbDVfvsXHopsnW33/J2D5ZSOKcwInzv/0yl+bSI/fIWFilyGe+ODXT8BY6RaXZbzC`
&& `QP3j3xOTYEw9OjmwcnGmDu2+9dvo32oJZVqUHZLXpEu+/86qM75PWEjcJDDLdmm4t/Oxh2e8SI6WXtomH`
&& `77x+8unpk3N5sWqp+GW0YSuJIwKD3FK8/oqMtaxCZGaQT069Pdl46MaVdMCq4J39+7ZB5aniSjMxz1Lc4`
&& `4cPyJgIYYmjAk+5/+DMtVtinW8t1LZiv0pcWn0AoRLqOah8rZTAxFDaE5/YfHIvdnCJWwn8P2wfSIvMY7`
&& `h+U8vhfpQ4t+wfuuO66eys0qgBruKA/TVlRA7FlJnyG1TiRQQGKzG/r7vIV4rEVpxE04wJPo2KaYMfGIN`
&& `JHNnH5vASw9xeeWur9+u3dE/JafvMl6enP5dO1YkmiZlh0v0ntLk6Ijalo17pZ/JU8W3w9VIxidw+ONI+`
&& `Xn4VE8VvO2AQibkmU2JFURJD2+s3dUj0IMlLz25MT86+cRJcFSFlTr6cxPw9d4J/bfNoUWbScm2l0ia4S`
&& `yXOp6VsFZ8OSgip3je9p88P1B73xWOHZayH/SvpUx72mWq7hK2L3QNHyL2HJyvxhW+/klJFyUnM774sYm`
&& `2MZefkm3PxFiSi41QjKBBS5aM6ojQoEkio8mt7+md5telzElN/ylTPLAxqmx+ouMgs3ET0rl0NohKdJWa`
&& `pv3zfASlWhJzEama9/Oi9MzEWJb2FmUQ1AA121y3XyGdq5ivNJk34xs4NLJZkdZUHDBibB3nm6h/FDozc`
&& `+9kyF4Vy1F4bVivxLiz9i4qck3jm+m13oJQOjpGthO9oGtMu8Wr/xbJm84BcJ5M/A4UGzQ0YhG3KK20Dg`
&& `Popmf0embhnjjwwFwe2XrkYu0qoOiGVLa8rqq2tiMz61EPF0R48s0TPDEWJYVGRsxIHiQgMdCCdkWZeNX`
&& `p9g6nOo9F8HHnbAQG5bQLpbV6pTsBzv2xTz1IepTg1CFUcpPqr56oduqDaUPWHiutSl0aJYRGRu0gcFTh`
&& `KpMGiHQBq6czF5lBSRSVWceDjbKzKpyQOg440Tdi6RNtQxQ0uMbQRmbiZLcNzT8k4Rd8CQ6TBoh0A6pSd`
&& `i81BvM/DCtE2DngvH5v2xWoFKYmjylXY9157iSEq8pyIwUNiF4HZP/HFFBqNkzmn+ESkwdpIrDqYrYeKJ`
&& `V/iIX1LDNTNh5JTlaXiQEmc3kG9H/g8Ern9vyflD9E2VHFLkxgiIp//89xcutI1GiwqMHs+pPWNUmIIie`
&& `l0G8MMGLmisyg5VVkqDkoSM8j9M8hdsTFzkxaU0OkgZtNE21DFLVViaBKZO+aZNMzEhWu0LgI33ZmqW4A`
&& `hJLaxpXtT4ACq9tVKTlWWigMlsY31NzmgDomeqHTRNozmF2UhiaEkMsLyfBrbwzVajtxVjZ9dfExXidWV`
&& `lo1VA4fn9qYjKmc0DtTAsG2h9vJcD/obGE9UumgbRvOLsrDE0DQjl2Zf6CIwKJlUB/uYLh1Ah/s4sOX6Z`
&& `8hl84C+JUZWHwc2JrelYDUriazaZt9IDJE9sqKrwMCL+8awn1KB6lzVYHJW3+1cP6vnDjxJAiW5/zAkl0`
&& `9UYg6I9oMAylTbKnXYVLMxkF6VD31LrAZTZEXI0VliaCtyHwJDbnnkm2KQO/DRYT4vJUuC+NyNAvhDnYp`
&& `BPOpEObl8/ACEUr3STQfvrJ6r/KbCi+1OgrqRJ+XyBafceyuJ1Vkgt+f2cUA7Uy7QXr5dc/QiMURF7ktg`
&& `aPslG4+dqUqylOCwZGdFUCtEG3ivrvXKXflBk8gRrMSRfvBCRtpIrWCK3iSGJpH7FDjR1Bl0ptoqgO0It`
&& `b9u6hwEVkuwWlYtpCPvXEcibspLSdz0zjxvWpp5Tt7qxiJCUx09tq2hqY0Sqn09vUoMOZGHEBjoDEa57w`
&& `ykTMsp+1oa0WOXOn5Wz0jrBacsyvQzsIXG97JxwLPpGFy2zETTTEze4OtF/sQ3CWwhlvKol7rdSFAvYoj`
&& `1+acBWUJtK9Q7AO1GvD+P5OhdYkDk9EV3hB5K4GXTRo6+yEmsYvtkFe+6aJmDSDxla2v6/Qn16V0lzqok`
&& `HhPDSVzphSpxM1XiNYa9s/ofvfTPpqtY8teRKvGaombgHCr9lUSVeE2pEsepEq8p7HsROYJKfyVRJa6Mn`
&& `ipxZfRUiSujp0pcGT1V4sroqRJXRk+VuDJytif/Aa8ZlmVpfNVQAAAAAElFTkSuQmCC` ).
ENDMETHOD.
METHOD given_cds_metadata.
given_file( `{`
&& gv_nl && `"BASEINFO":`
&& gv_nl && `{`
&& gv_nl && `"FROM":`
&& gv_nl && `[`
&& gv_nl && `"T100"`
&& gv_nl && `],`
&& gv_nl && `"ASSOCIATED":`
&& gv_nl && `[],`
&& gv_nl && `"BASE":`
&& gv_nl && `[],`
&& gv_nl && `"ANNO_REF":`
&& gv_nl && `[],`
&& gv_nl && `"VERSION":0`
&& gv_nl && `}`
&& gv_nl && `}` ).
ENDMETHOD.
METHOD given_cds_view_with_umlaut.
CONSTANTS lc_umlaut_ue TYPE xstring VALUE `C3BC`.
given_file( `@EndUserText.label: `
&& zcl_abapgit_convert=>xstring_to_string_utf8( lc_umlaut_ue )
&& `bernahmekandidat'`
&& gv_cr_lf && `@AbapCatalog.sqlViewName: 'ZTESTDDLSBUG2'`
&& gv_cr_lf && `@AbapCatalog.compiler.compareFilter: true`
&& gv_cr_lf && `@AbapCatalog.preserveKey: true`
&& gv_cr_lf && `@AccessControl.authorizationCheck: #CHECK`
&& gv_cr_lf && `define view ztest_ddls_bug2`
&& gv_cr_lf && ` as select from t100`
&& gv_cr_lf && `{`
&& gv_cr_lf && ` key sprsl as Sprsl,`
&& gv_cr_lf && ` key arbgb as Arbgb,`
&& gv_cr_lf && ` key msgnr as Msgnr,`
&& gv_cr_lf && ` text as Text`
&& gv_cr_lf && `}` ).
ENDMETHOD.
METHOD when_is_binary_determined.
mv_act_is_binary = zcl_abapgit_utils=>is_binary( mv_given_file ).
ENDMETHOD.
METHOD then_is_not_binary.
cl_abap_unit_assert=>assert_false( mv_act_is_binary ).
ENDMETHOD.
METHOD then_is_binary.
cl_abap_unit_assert=>assert_true( mv_act_is_binary ).
ENDMETHOD.
ENDCLASS.
| 35.65035 | 114 | 0.724107 |
35c310b199768b29aaa7be554c3a20b1589efd3f
| 5,148 |
abap
|
ABAP
|
src/zcl_excel_column.clas.abap
|
rotda/abap2xlsx
|
45e11a380943c425a5c8b350e2e506ec3fd46d9c
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_excel_column.clas.abap
|
rotda/abap2xlsx
|
45e11a380943c425a5c8b350e2e506ec3fd46d9c
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_excel_column.clas.abap
|
rotda/abap2xlsx
|
45e11a380943c425a5c8b350e2e506ec3fd46d9c
|
[
"Apache-2.0"
] | null | null | null |
class ZCL_EXCEL_COLUMN definition
public
final
create public .
*"* public components of class ZCL_EXCEL_COLUMN
*"* do not include other source files here!!!
public section.
type-pools ABAP .
methods CONSTRUCTOR
importing
!IP_INDEX type ZEXCEL_CELL_COLUMN_ALPHA
!IP_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET
!IP_EXCEL type ref to ZCL_EXCEL .
methods GET_AUTO_SIZE
returning
value(R_AUTO_SIZE) type ABAP_BOOL .
methods GET_COLLAPSED
returning
value(R_COLLAPSED) type ABAP_BOOL .
methods GET_COLUMN_INDEX
returning
value(R_COLUMN_INDEX) type INT4 .
methods GET_OUTLINE_LEVEL
returning
value(R_OUTLINE_LEVEL) type INT4 .
methods GET_VISIBLE
returning
value(R_VISIBLE) type ABAP_BOOL .
methods GET_WIDTH
returning
value(R_WIDTH) type FLOAT .
methods GET_XF_INDEX
returning
value(R_XF_INDEX) type INT4 .
methods SET_AUTO_SIZE
importing
!IP_AUTO_SIZE type ABAP_BOOL
returning
value(IO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods SET_COLLAPSED
importing
!IP_COLLAPSED type ABAP_BOOL
returning
value(IO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods SET_COLUMN_INDEX
importing
!IP_INDEX type ZEXCEL_CELL_COLUMN_ALPHA
returning
value(IO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods SET_OUTLINE_LEVEL
importing
!IP_OUTLINE_LEVEL type INT4 .
methods SET_VISIBLE
importing
!IP_VISIBLE type ABAP_BOOL
returning
value(IO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods SET_WIDTH
importing
!IP_WIDTH type SIMPLE
returning
value(IO_COLUMN) type ref to ZCL_EXCEL_COLUMN
raising
ZCX_EXCEL .
methods SET_XF_INDEX
importing
!IP_XF_INDEX type INT4
returning
value(IO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods SET_COLUMN_STYLE_BY_GUID
importing
!IP_STYLE_GUID type ZEXCEL_CELL_STYLE
raising
ZCX_EXCEL .
methods GET_COLUMN_STYLE_GUID
returning
value(EP_STYLE_GUID) type ZEXCEL_CELL_STYLE
raising
ZCX_EXCEL .
*"* protected components of class ZCL_EXCEL_COLUMN
*"* do not include other source files here!!!
protected section.
*"* private components of class ZCL_EXCEL_COLUMN
*"* do not include other source files here!!!
private section.
data COLUMN_INDEX type INT4 .
data WIDTH type FLOAT .
data AUTO_SIZE type ABAP_BOOL .
data VISIBLE type ABAP_BOOL .
data OUTLINE_LEVEL type INT4 .
data COLLAPSED type ABAP_BOOL .
data XF_INDEX type INT4 .
data STYLE_GUID type ZEXCEL_CELL_STYLE .
data EXCEL type ref to ZCL_EXCEL .
data WORKSHEET type ref to ZCL_EXCEL_WORKSHEET .
ENDCLASS.
CLASS ZCL_EXCEL_COLUMN IMPLEMENTATION.
method CONSTRUCTOR.
me->column_index = zcl_excel_common=>convert_column2int( ip_index ).
me->width = -1.
me->auto_size = abap_false.
me->visible = abap_true.
me->outline_level = 0.
me->collapsed = abap_false.
me->excel = ip_excel. "ins issue #157 - Allow Style for columns
me->worksheet = ip_worksheet. "ins issue #157 - Allow Style for columns
" set default index to cellXf
me->xf_index = 0.
endmethod.
method GET_AUTO_SIZE.
r_auto_size = me->auto_size.
endmethod.
method GET_COLLAPSED.
r_Collapsed = me->Collapsed.
endmethod.
method GET_COLUMN_INDEX.
r_column_index = me->column_index.
endmethod.
method GET_COLUMN_STYLE_GUID.
IF me->style_guid IS NOT INITIAL.
ep_style_guid = me->style_guid.
ELSE.
ep_style_guid = me->worksheet->zif_excel_sheet_properties~get_style( ).
ENDIF.
endmethod.
method GET_OUTLINE_LEVEL.
r_outline_level = me->outline_level.
endmethod.
method GET_VISIBLE.
r_Visible = me->Visible.
endmethod.
method GET_WIDTH.
r_WIDTH = me->WIDTH.
endmethod.
method GET_XF_INDEX.
r_xf_index = me->xf_index.
endmethod.
METHOD set_auto_size.
me->auto_size = ip_auto_size.
io_column = me.
ENDMETHOD.
METHOD set_collapsed.
me->collapsed = ip_collapsed.
io_column = me.
ENDMETHOD.
METHOD set_column_index.
me->column_index = zcl_excel_common=>convert_column2int( ip_index ).
io_column = me.
ENDMETHOD.
method SET_COLUMN_STYLE_BY_GUID.
DATA: stylemapping TYPE zexcel_s_stylemapping.
IF me->excel IS NOT BOUND.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Internal error - reference to ZCL_EXCEL not bound'.
ENDIF.
TRY.
stylemapping = me->excel->get_style_to_guid( ip_style_guid ).
me->style_guid = stylemapping-guid.
CATCH zcx_excel .
EXIT. " leave as is in case of error
ENDTRY.
endmethod.
method SET_OUTLINE_LEVEL.
me->outline_level = ip_outline_level.
endmethod.
METHOD set_visible.
me->visible = ip_visible.
io_column = me.
ENDMETHOD.
METHOD set_width.
TRY.
me->width = ip_width.
io_column = me.
CATCH cx_sy_conversion_no_number.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Unable to interpret width as number'.
ENDTRY.
ENDMETHOD.
METHOD set_xf_index.
me->xf_index = ip_xf_index.
io_column = me.
ENDMETHOD.
ENDCLASS.
| 22.285714 | 80 | 0.718143 |
35c44f50a1159ce68606ee71f442940ee1e27165
| 1,683 |
abap
|
ABAP
|
src/objects/zcl_abapgit_object_iwmo.clas.abap
|
joymike/abapGit
|
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
|
[
"MIT"
] | 1 |
2020-10-01T06:11:00.000Z
|
2020-10-01T06:11:00.000Z
|
src/objects/zcl_abapgit_object_iwmo.clas.abap
|
joymike/abapGit
|
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
|
[
"MIT"
] | null | null | null |
src/objects/zcl_abapgit_object_iwmo.clas.abap
|
joymike/abapGit
|
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_object_iwmo DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
METHODS get_generic
RETURNING
VALUE(ro_generic) TYPE REF TO zcl_abapgit_objects_generic
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_IWMO IMPLEMENTATION.
METHOD get_generic.
CREATE OBJECT ro_generic
EXPORTING
is_item = ms_item.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = zcl_abapgit_objects_super=>c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
get_generic( )->delete( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
get_generic( )->deserialize(
iv_package = iv_package
io_xml = io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
rv_bool = get_generic( )->exists( ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
zcx_abapgit_exception=>raise( |TODO: Jump| ).
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
get_generic( )->serialize( io_xml ).
ENDMETHOD.
ENDCLASS.
| 16.182692 | 65 | 0.727867 |
35c5263ddb3963eca5f1f34115448fa4d17d7a03
| 878 |
abap
|
ABAP
|
src/zif_advoat_c_tadir_type.intf.abap
|
stockbal/abap-object-analysis-tools
|
a0619eb31a18a2469b491ed24ff913ca989b5bb5
|
[
"MIT"
] | 1 |
2021-05-09T12:46:26.000Z
|
2021-05-09T12:46:26.000Z
|
src/zif_advoat_c_tadir_type.intf.abap
|
stockbal/abap-object-analysis-tools
|
a0619eb31a18a2469b491ed24ff913ca989b5bb5
|
[
"MIT"
] | null | null | null |
src/zif_advoat_c_tadir_type.intf.abap
|
stockbal/abap-object-analysis-tools
|
a0619eb31a18a2469b491ed24ff913ca989b5bb5
|
[
"MIT"
] | null | null | null |
"! <p class="shorttext synchronized" lang="en">Object types in TADIR</p>
INTERFACE zif_advoat_c_tadir_type
PUBLIC .
CONSTANTS:
table TYPE trobjtype VALUE 'TABL' ##NO_TEXT,
table_type TYPE trobjtype VALUE 'TTYP' ##NO_TEXT,
function_group TYPE trobjtype VALUE 'FUGR' ##NO_TEXT,
program TYPE trobjtype VALUE 'PROG' ##NO_TEXT,
package TYPE trobjtype VALUE 'DEVC' ##NO_TEXT,
business_object TYPE trobjtype VALUE 'BOBF' ##NO_TEXT,
class TYPE trobjtype VALUE 'CLAS' ##NO_TEXT,
interface TYPE trobjtype VALUE 'INTF' ##NO_TEXT,
icf_node TYPE trobjtype VALUE 'SICF' ##NO_TEXT,
gw_project TYPE trobjtype VALUE 'IWPR' ##NO_TEXT,
data_definition TYPE trobjtype VALUE 'DDLS' ##NO_TEXT,
structured_object TYPE trobjtype VALUE 'STOB' ##NO_TEXT.
ENDINTERFACE.
| 46.210526 | 72 | 0.661731 |
35c6262a5fc892e30c892cd541e886af32aa1b1e
| 98,237 |
abap
|
ABAP
|
src/legacy/#dmo#cl_flight_legacy01.clas.locals_imp.abap
|
SAP-Cloud-Platform/flight01
|
23e52f647b63e9c70f1bfc524aa46f0f36540795
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#cl_flight_legacy01.clas.locals_imp.abap
|
SAP-Cloud-Platform/flight01
|
23e52f647b63e9c70f1bfc524aa46f0f36540795
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#cl_flight_legacy01.clas.locals_imp.abap
|
SAP-Cloud-Platform/flight01
|
23e52f647b63e9c70f1bfc524aa46f0f36540795
|
[
"BSD-Source-Code"
] | null | null | null |
CLASS lcl_common_checks DEFINITION FINAL CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS is_currency_code_valid IMPORTING iv_currency_code TYPE /dmo/currency_code01
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_boolean.
CLASS-METHODS is_customer_id_valid IMPORTING iv_customer_id TYPE /dmo/customer_id01
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_boolean.
PRIVATE SECTION.
CLASS-DATA mt_currency_code TYPE SORTED TABLE OF /dmo/currency_code01 WITH UNIQUE KEY table_line.
CLASS-DATA mt_customer_id TYPE SORTED TABLE OF /dmo/customer_id01 WITH UNIQUE KEY table_line.
ENDCLASS.
CLASS lcl_common_checks IMPLEMENTATION.
METHOD is_currency_code_valid.
CLEAR rv_is_valid.
IF mt_currency_code IS INITIAL.
" We should use TCURC, but this is not released for "ABAP for SAP Cloud Platform"
SELECT DISTINCT currency FROM i_currency INTO TABLE @mt_currency_code.
ENDIF.
READ TABLE mt_currency_code TRANSPORTING NO FIELDS WITH TABLE KEY table_line = iv_currency_code.
IF sy-subrc = 0.
rv_is_valid = abap_true.
ELSE.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>currency_unknown currency_code = iv_currency_code ) TO ct_messages.
ENDIF.
ENDMETHOD.
METHOD is_customer_id_valid.
CLEAR rv_is_valid.
IF mt_customer_id IS INITIAL.
" There may be very many customers, but we only store the ID in the internal table
SELECT DISTINCT customer_id FROM /dmo/customer01 INTO TABLE @mt_customer_id.
ENDIF.
READ TABLE mt_customer_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = iv_customer_id.
IF sy-subrc = 0.
rv_is_valid = abap_true.
ELSE.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>customer_unkown customer_id = iv_customer_id ) TO ct_messages.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_booking_supplement_buffer DEFINITION FINAL CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS: get_instance RETURNING VALUE(ro_instance) TYPE REF TO lcl_booking_supplement_buffer.
METHODS save.
METHODS initialize.
"! Prepare changes in a temporary buffer
"! @parameter iv_no_delete_check | In some cases we do not need to check the existence of a record to be deleted, as this check has been done before.
"! | E.g. delete all subnodes of a node to be deleted. In this case we have read the subnodes to get their keys.
METHODS cud_prep IMPORTING it_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
it_booking_supplementx TYPE /dmo/if_flight_legacy01=>tt_booking_supplementx
iv_no_delete_check TYPE abap_bool OPTIONAL
EXPORTING et_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
"! Add content of the temporary buffer to the real buffer and clear the temporary buffer
METHODS cud_copy.
"! Discard content of the temporary buffer
METHODS cud_disc.
"! Get all Booking Supplements for given Bookings
METHODS get IMPORTING it_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
iv_include_buffer TYPE abap_boolean
iv_include_temp_buffer TYPE abap_boolean
EXPORTING et_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement.
PRIVATE SECTION.
CLASS-DATA go_instance TYPE REF TO lcl_booking_supplement_buffer.
" Main buffer
DATA: mt_create_buffer TYPE /dmo/if_flight_legacy01=>tt_booking_supplement,
mt_update_buffer TYPE /dmo/if_flight_legacy01=>tt_booking_supplement,
mt_delete_buffer TYPE /dmo/if_flight_legacy01=>tt_booking_supplement_key.
" Temporary buffer valid during create / update / delete Travel
DATA: mt_create_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_booking_supplement,
mt_update_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_booking_supplement,
mt_delete_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_booking_supplement_key.
DATA mt_supplement TYPE SORTED TABLE OF /dmo/suppleme_01 WITH UNIQUE KEY supplement_id.
METHODS _create IMPORTING it_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
EXPORTING et_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _update IMPORTING it_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
it_booking_supplementx TYPE /dmo/if_flight_legacy01=>tt_booking_supplementx
EXPORTING et_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _delete IMPORTING it_booking_supplement TYPE /dmo/if_flight_legacy01=>tt_booking_supplement
iv_no_delete_check TYPE abap_bool
EXPORTING et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _check IMPORTING is_booking_supplement TYPE /dmo/book_sup_01
is_booking_supplementx TYPE /dmo/if_flight_legacy01=>ts_booking_supplementx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_supplement IMPORTING is_booking_supplement TYPE /dmo/book_sup_01
is_booking_supplementx TYPE /dmo/if_flight_legacy01=>ts_booking_supplementx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_currency_code IMPORTING is_booking_supplement TYPE /dmo/book_sup_01
is_booking_supplementx TYPE /dmo/if_flight_legacy01=>ts_booking_supplementx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _determine IMPORTING iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING cs_booking_supplement TYPE /dmo/book_sup_01.
ENDCLASS.
CLASS lcl_booking_supplement_buffer IMPLEMENTATION.
METHOD get_instance.
go_instance = COND #( WHEN go_instance IS BOUND THEN go_instance ELSE NEW #( ) ).
ro_instance = go_instance.
ENDMETHOD.
METHOD _create.
CLEAR et_booking_supplement.
CLEAR et_messages.
TYPES: BEGIN OF ts_travel_booking_suppl_id,
travel_id TYPE /dmo/travel_id01,
booking_id TYPE /dmo/booking_id01,
booking_supplement_id TYPE /dmo/booking_supplement_id01,
END OF ts_travel_booking_suppl_id,
tt_travel_booking_suppl_id TYPE SORTED TABLE OF ts_travel_booking_suppl_id WITH UNIQUE KEY travel_id booking_id booking_supplement_id.
DATA lt_travel_booking_suppl_id TYPE tt_travel_booking_suppl_id.
CHECK it_booking_supplement IS NOT INITIAL.
SELECT FROM /dmo/book_sup_01 FIELDS travel_id, booking_id, booking_supplement_id
FOR ALL ENTRIES IN @it_booking_supplement WHERE travel_id = @it_booking_supplement-travel_id AND booking_id = @it_booking_supplement-booking_id AND booking_supplement_id = @it_booking_supplement-booking_supplement_id
INTO CORRESPONDING FIELDS OF TABLE @lt_travel_booking_suppl_id.
LOOP AT it_booking_supplement INTO DATA(ls_booking_supplement_create) ##INTO_OK.
" Booking_Supplement_ID key must not be initial
IF ls_booking_supplement_create-booking_supplement_id IS INITIAL.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_no_key
travel_id = ls_booking_supplement_create-travel_id
booking_id = ls_booking_supplement_create-booking_id ) TO et_messages.
RETURN.
ENDIF.
" Booking_Supplement_ID key check DB
READ TABLE lt_travel_booking_suppl_id TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = ls_booking_supplement_create-travel_id
booking_id = ls_booking_supplement_create-booking_id
booking_supplement_id = ls_booking_supplement_create-booking_supplement_id.
IF sy-subrc = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_exists
travel_id = ls_booking_supplement_create-travel_id
booking_id = ls_booking_supplement_create-booking_id
booking_supplement_id = ls_booking_supplement_create-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
" Booking_Supplement_ID key check Buffer
READ TABLE mt_create_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = ls_booking_supplement_create-travel_id
booking_id = ls_booking_supplement_create-booking_id
booking_supplement_id = ls_booking_supplement_create-booking_supplement_id.
IF sy-subrc = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_exists
travel_id = ls_booking_supplement_create-travel_id
booking_id = ls_booking_supplement_create-booking_id
booking_supplement_id = ls_booking_supplement_create-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
" Checks
IF _check( EXPORTING is_booking_supplement = ls_booking_supplement_create
iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create
CHANGING ct_messages = et_messages ) = abap_false.
RETURN.
ENDIF.
" standard determinations
_determine( EXPORTING iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create
CHANGING cs_booking_supplement = ls_booking_supplement_create ).
INSERT ls_booking_supplement_create INTO TABLE mt_create_buffer_2.
ENDLOOP.
et_booking_supplement = mt_create_buffer_2.
ENDMETHOD.
METHOD _update.
CLEAR et_booking_supplement.
CLEAR et_messages.
CHECK it_booking_supplement IS NOT INITIAL.
" Check for empty keys
LOOP AT it_booking_supplement ASSIGNING FIELD-SYMBOL(<s_booking_supplement_update>) WHERE booking_supplement_id = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_no_key travel_id = <s_booking_supplement_update>-travel_id booking_id = <s_booking_supplement_update>-booking_id ) TO et_messages.
RETURN.
ENDLOOP.
DATA lt_book_suppl TYPE SORTED TABLE OF /dmo/book_sup_01 WITH UNIQUE KEY travel_id booking_id booking_supplement_id.
SELECT * FROM /dmo/book_sup_01 FOR ALL ENTRIES IN @it_booking_supplement WHERE travel_id = @it_booking_supplement-travel_id
AND booking_id = @it_booking_supplement-booking_id
AND booking_supplement_id = @it_booking_supplement-booking_supplement_id
INTO TABLE @lt_book_suppl.
FIELD-SYMBOLS <s_buffer_booking_supplement> TYPE /dmo/book_sup_01.
DATA ls_buffer_booking_supplement TYPE /dmo/book_sup_01.
LOOP AT it_booking_supplement ASSIGNING <s_booking_supplement_update>.
UNASSIGN <s_buffer_booking_supplement>.
READ TABLE mt_delete_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id.
IF sy-subrc = 0." Error: Record to be updated marked for deletion
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_unknown
travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
IF <s_buffer_booking_supplement> IS NOT ASSIGNED." Special case: record already in temporary create buffer
READ TABLE mt_create_buffer_2 ASSIGNING <s_buffer_booking_supplement> WITH TABLE KEY travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id.
ENDIF.
IF <s_buffer_booking_supplement> IS NOT ASSIGNED." Special case: record already in create buffer
READ TABLE mt_create_buffer INTO ls_buffer_booking_supplement WITH TABLE KEY travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id.
IF sy-subrc = 0.
INSERT ls_buffer_booking_supplement INTO TABLE mt_create_buffer_2 ASSIGNING <s_buffer_booking_supplement>.
ENDIF.
ENDIF.
IF <s_buffer_booking_supplement> IS NOT ASSIGNED." Special case: record already in temporary update buffer
READ TABLE mt_update_buffer_2 ASSIGNING <s_buffer_booking_supplement> WITH TABLE KEY travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id.
ENDIF.
IF <s_buffer_booking_supplement> IS NOT ASSIGNED." Special case: record already in update buffer
READ TABLE mt_update_buffer INTO ls_buffer_booking_supplement WITH TABLE KEY travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id.
IF sy-subrc = 0.
INSERT ls_buffer_booking_supplement INTO TABLE mt_update_buffer_2 ASSIGNING <s_buffer_booking_supplement>.
ENDIF.
ENDIF.
IF <s_buffer_booking_supplement> IS NOT ASSIGNED." Usual case: record not already in update buffer
READ TABLE lt_book_suppl ASSIGNING FIELD-SYMBOL(<s_booking_supplement_old>) WITH TABLE KEY travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id.
IF sy-subrc = 0.
INSERT <s_booking_supplement_old> INTO TABLE mt_update_buffer_2 ASSIGNING <s_buffer_booking_supplement>.
ASSERT sy-subrc = 0.
ENDIF.
ENDIF.
" Error
IF <s_buffer_booking_supplement> IS NOT ASSIGNED.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_unknown
travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
" Merge fields to be updated
READ TABLE it_booking_supplementx ASSIGNING FIELD-SYMBOL(<s_booking_supplementx>) WITH KEY travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id
action_code = /dmo/if_flight_legacy01=>action_code-update.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_no_control
travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
IF <s_booking_supplementx>-supplement_id = abap_true AND <s_booking_supplement_update>-supplement_id <> <s_buffer_booking_supplement>-supplement_id.
" The supplement ID must not be changed (delete the record and create a new one)
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_suppl_id_u
travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
IF ( <s_booking_supplementx>-price = abap_true AND <s_booking_supplementx>-currency_code = abap_false )
OR ( <s_booking_supplementx>-price = abap_false AND <s_booking_supplementx>-currency_code = abap_true ).
" Price and currency code must be changed together
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_pri_curr_u
travel_id = <s_booking_supplement_update>-travel_id
booking_id = <s_booking_supplement_update>-booking_id
booking_supplement_id = <s_booking_supplement_update>-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
DATA lv_field TYPE i.
lv_field = 5.
DO.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_booking_supplementx> TO FIELD-SYMBOL(<v_flag>).
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF <v_flag> = abap_true.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_booking_supplement_update> TO FIELD-SYMBOL(<v_field_new>).
ASSERT sy-subrc = 0.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_buffer_booking_supplement> TO FIELD-SYMBOL(<v_field_old>).
ASSERT sy-subrc = 0.
<v_field_old> = <v_field_new>.
ENDIF.
lv_field = lv_field + 1.
ENDDO.
" Checks
IF _check( EXPORTING is_booking_supplement = <s_buffer_booking_supplement>
is_booking_supplementx = <s_booking_supplementx>
iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update
CHANGING ct_messages = et_messages ) = abap_false.
RETURN.
ENDIF.
" standard determinations
DATA(ls_booking_supplement) = <s_buffer_booking_supplement>." Needed, as key fields must not be changed
_determine( EXPORTING iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update
CHANGING cs_booking_supplement = ls_booking_supplement ).
<s_buffer_booking_supplement>-gr_data = ls_booking_supplement-gr_data.
INSERT <s_buffer_booking_supplement> INTO TABLE et_booking_supplement.
ENDLOOP.
ENDMETHOD.
METHOD _delete.
CLEAR et_messages.
CHECK it_booking_supplement IS NOT INITIAL.
" Check for empty keys
LOOP AT it_booking_supplement ASSIGNING FIELD-SYMBOL(<s_booking_supplement_delete>) WHERE booking_supplement_id = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_no_key
travel_id = <s_booking_supplement_delete>-travel_id
booking_id = <s_booking_supplement_delete>-booking_id ) TO et_messages.
RETURN.
ENDLOOP.
DATA(lt_booking_supplement) = it_booking_supplement.
LOOP AT lt_booking_supplement ASSIGNING <s_booking_supplement_delete>.
" Special case: record already in create buffer
READ TABLE mt_create_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_booking_supplement_delete>-travel_id
booking_id = <s_booking_supplement_delete>-booking_id
booking_supplement_id = <s_booking_supplement_delete>-booking_supplement_id.
IF sy-subrc = 0." Artificial case: Remove entry from create buffer
INSERT VALUE #( travel_id = <s_booking_supplement_delete>-travel_id
booking_id = <s_booking_supplement_delete>-booking_id
booking_supplement_id = <s_booking_supplement_delete>-booking_supplement_id ) INTO TABLE mt_delete_buffer_2.
DELETE lt_booking_supplement.
ENDIF.
ENDLOOP.
IF iv_no_delete_check = abap_false.
DATA lt_book_suppl_db TYPE /dmo/if_flight_legacy01=>tt_booking_supplement_key.
SELECT travel_id, booking_id, booking_supplement_id FROM /dmo/book_sup_01 FOR ALL ENTRIES IN @lt_booking_supplement
WHERE travel_id = @lt_booking_supplement-travel_id AND booking_id = @lt_booking_supplement-booking_id AND booking_supplement_id = @lt_booking_supplement-booking_supplement_id INTO CORRESPONDING FIELDS OF TABLE @lt_book_suppl_db.
ENDIF.
" Check existence and append to delete buffer
LOOP AT lt_booking_supplement ASSIGNING <s_booking_supplement_delete>.
IF iv_no_delete_check = abap_false.
READ TABLE lt_book_suppl_db TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_booking_supplement_delete>-travel_id
booking_id = <s_booking_supplement_delete>-booking_id
booking_supplement_id = <s_booking_supplement_delete>-booking_supplement_id.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_unknown
travel_id = <s_booking_supplement_delete>-travel_id
booking_id = <s_booking_supplement_delete>-booking_id
booking_supplement_id = <s_booking_supplement_delete>-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
ENDIF.
INSERT VALUE #( travel_id = <s_booking_supplement_delete>-travel_id
booking_id = <s_booking_supplement_delete>-booking_id
booking_supplement_id = <s_booking_supplement_delete>-booking_supplement_id ) INTO TABLE mt_delete_buffer_2.
ENDLOOP.
ENDMETHOD.
METHOD save.
ASSERT mt_create_buffer_2 IS INITIAL.
ASSERT mt_update_buffer_2 IS INITIAL.
ASSERT mt_delete_buffer_2 IS INITIAL.
INSERT /dmo/book_sup_01 FROM TABLE @mt_create_buffer.
UPDATE /dmo/book_sup_01 FROM TABLE @mt_update_buffer.
DELETE /dmo/book_sup_01 FROM TABLE @( CORRESPONDING #( mt_delete_buffer ) ).
ENDMETHOD.
METHOD initialize.
CLEAR: mt_create_buffer, mt_update_buffer, mt_delete_buffer.
ENDMETHOD.
METHOD _check.
rv_is_valid = abap_true.
IF NOT _check_supplement( EXPORTING is_booking_supplement = is_booking_supplement
is_booking_supplementx = is_booking_supplementx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_currency_code( EXPORTING is_booking_supplement = is_booking_supplement
is_booking_supplementx = is_booking_supplementx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
ENDMETHOD.
METHOD cud_prep.
CLEAR et_booking_supplement.
CLEAR et_messages.
CHECK it_booking_supplement IS NOT INITIAL.
DATA lt_booking_supplement_c TYPE /dmo/if_flight_legacy01=>tt_booking_supplement.
DATA lt_booking_supplement_u TYPE /dmo/if_flight_legacy01=>tt_booking_supplement.
DATA lt_booking_supplement_d TYPE /dmo/if_flight_legacy01=>tt_booking_supplement.
DATA lt_booking_supplementx_u TYPE /dmo/if_flight_legacy01=>tt_booking_supplementx.
LOOP AT it_booking_supplement ASSIGNING FIELD-SYMBOL(<s_booking_supplement>).
READ TABLE it_booking_supplementx ASSIGNING FIELD-SYMBOL(<s_booking_supplementx>) WITH TABLE KEY travel_id = <s_booking_supplement>-travel_id
booking_id = <s_booking_supplement>-booking_id
booking_supplement_id = <s_booking_supplement>-booking_supplement_id.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_supplement_no_control
travel_id = <s_booking_supplement>-travel_id
booking_id = <s_booking_supplement>-booking_id
booking_supplement_id = <s_booking_supplement>-booking_supplement_id ) TO et_messages.
RETURN.
ENDIF.
CASE CONV /dmo/if_flight_legacy01=>action_code_enum( <s_booking_supplementx>-action_code ).
WHEN /dmo/if_flight_legacy01=>action_code-create.
INSERT <s_booking_supplement> INTO TABLE lt_booking_supplement_c.
WHEN /dmo/if_flight_legacy01=>action_code-update.
INSERT <s_booking_supplement> INTO TABLE lt_booking_supplement_u.
INSERT <s_booking_supplementx> INTO TABLE lt_booking_supplementx_u.
WHEN /dmo/if_flight_legacy01=>action_code-delete.
INSERT <s_booking_supplement> INTO TABLE lt_booking_supplement_d.
ENDCASE.
ENDLOOP.
_create( EXPORTING it_booking_supplement = lt_booking_supplement_c
IMPORTING et_booking_supplement = et_booking_supplement
et_messages = et_messages ).
_update( EXPORTING it_booking_supplement = lt_booking_supplement_u
it_booking_supplementx = lt_booking_supplementx_u
IMPORTING et_booking_supplement = DATA(lt_booking_supplement)
et_messages = DATA(lt_messages) ).
INSERT LINES OF lt_booking_supplement INTO TABLE et_booking_supplement.
APPEND LINES OF lt_messages TO et_messages.
_delete( EXPORTING it_booking_supplement = lt_booking_supplement_d
iv_no_delete_check = iv_no_delete_check
IMPORTING et_messages = lt_messages ).
APPEND LINES OF lt_messages TO et_messages.
ENDMETHOD.
METHOD cud_copy.
LOOP AT mt_create_buffer_2 ASSIGNING FIELD-SYMBOL(<s_create_buffer_2>).
READ TABLE mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_create_buffer>) WITH TABLE KEY travel_id = <s_create_buffer_2>-travel_id
booking_id = <s_create_buffer_2>-booking_id
booking_supplement_id = <s_create_buffer_2>-booking_supplement_id.
IF sy-subrc <> 0.
INSERT VALUE #( travel_id = <s_create_buffer_2>-travel_id
booking_id = <s_create_buffer_2>-booking_id
booking_supplement_id = <s_create_buffer_2>-booking_supplement_id ) INTO TABLE mt_create_buffer ASSIGNING <s_create_buffer>.
ENDIF.
<s_create_buffer>-gr_data = <s_create_buffer_2>-gr_data.
ENDLOOP.
LOOP AT mt_update_buffer_2 ASSIGNING FIELD-SYMBOL(<s_update_buffer_2>).
READ TABLE mt_update_buffer ASSIGNING FIELD-SYMBOL(<s_update_buffer>) WITH TABLE KEY travel_id = <s_update_buffer_2>-travel_id
booking_id = <s_update_buffer_2>-booking_id
booking_supplement_id = <s_update_buffer_2>-booking_supplement_id.
IF sy-subrc <> 0.
INSERT VALUE #( travel_id = <s_update_buffer_2>-travel_id
booking_id = <s_update_buffer_2>-booking_id
booking_supplement_id = <s_update_buffer_2>-booking_supplement_id ) INTO TABLE mt_update_buffer ASSIGNING <s_update_buffer>.
ENDIF.
<s_update_buffer>-gr_data = <s_update_buffer_2>-gr_data.
ENDLOOP.
LOOP AT mt_delete_buffer_2 ASSIGNING FIELD-SYMBOL(<s_delete_buffer_2>).
DELETE mt_create_buffer WHERE travel_id = <s_delete_buffer_2>-travel_id
AND booking_id = <s_delete_buffer_2>-booking_id
AND booking_supplement_id = <s_delete_buffer_2>-booking_supplement_id.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
DELETE mt_update_buffer WHERE travel_id = <s_delete_buffer_2>-travel_id
AND booking_id = <s_delete_buffer_2>-booking_id
AND booking_supplement_id = <s_delete_buffer_2>-booking_supplement_id.
INSERT <s_delete_buffer_2> INTO TABLE mt_delete_buffer.
ENDLOOP.
CLEAR: mt_create_buffer_2, mt_update_buffer_2, mt_delete_buffer_2.
ENDMETHOD.
METHOD cud_disc.
CLEAR: mt_create_buffer_2, mt_update_buffer_2, mt_delete_buffer_2.
ENDMETHOD.
METHOD get.
CLEAR et_booking_supplement.
CHECK it_booking_supplement IS NOT INITIAL.
SELECT * FROM /dmo/book_sup_01 FOR ALL ENTRIES IN @it_booking_supplement WHERE travel_id = @it_booking_supplement-travel_id
AND booking_id = @it_booking_supplement-booking_id
INTO TABLE @et_booking_supplement ##SELECT_FAE_WITH_LOB[DESCRIPTION].
IF iv_include_buffer = abap_true.
LOOP AT it_booking_supplement ASSIGNING FIELD-SYMBOL(<s_booking_supplement>).
LOOP AT mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_create_buffer>) WHERE travel_id = <s_booking_supplement>-travel_id AND booking_id = <s_booking_supplement>-booking_id.
INSERT <s_create_buffer> INTO TABLE et_booking_supplement.
ENDLOOP.
LOOP AT mt_update_buffer ASSIGNING FIELD-SYMBOL(<s_update_buffer>) WHERE travel_id = <s_booking_supplement>-travel_id AND booking_id = <s_booking_supplement>-booking_id.
MODIFY TABLE et_booking_supplement FROM <s_update_buffer>.
ENDLOOP.
LOOP AT mt_delete_buffer ASSIGNING FIELD-SYMBOL(<s_delete_buffer>) WHERE travel_id = <s_booking_supplement>-travel_id AND booking_id = <s_booking_supplement>-booking_id.
DELETE et_booking_supplement WHERE travel_id = <s_delete_buffer>-travel_id
AND booking_id = <s_delete_buffer>-booking_id
AND booking_supplement_id = <s_delete_buffer>-booking_supplement_id.
ENDLOOP.
ENDLOOP.
ENDIF.
IF iv_include_temp_buffer = abap_true.
LOOP AT it_booking_supplement ASSIGNING <s_booking_supplement>.
LOOP AT mt_create_buffer_2 ASSIGNING <s_create_buffer> WHERE travel_id = <s_booking_supplement>-travel_id AND booking_id = <s_booking_supplement>-booking_id.
DELETE et_booking_supplement WHERE travel_id = <s_create_buffer>-travel_id
AND booking_id = <s_create_buffer>-booking_id
AND booking_supplement_id = <s_create_buffer>-booking_supplement_id.
INSERT <s_create_buffer> INTO TABLE et_booking_supplement.
ENDLOOP.
LOOP AT mt_update_buffer_2 ASSIGNING <s_update_buffer> WHERE travel_id = <s_booking_supplement>-travel_id AND booking_id = <s_booking_supplement>-booking_id.
MODIFY TABLE et_booking_supplement FROM <s_update_buffer>.
ENDLOOP.
LOOP AT mt_delete_buffer_2 ASSIGNING <s_delete_buffer> WHERE travel_id = <s_booking_supplement>-travel_id AND booking_id = <s_booking_supplement>-booking_id.
DELETE et_booking_supplement WHERE travel_id = <s_delete_buffer>-travel_id
AND booking_id = <s_delete_buffer>-booking_id
AND booking_supplement_id = <s_delete_buffer>-booking_supplement_id.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD _check_supplement.
rv_is_valid = abap_true.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_booking_supplementx-supplement_id = abap_true ).
IF mt_supplement IS INITIAL.
SELECT * FROM /dmo/suppleme_01 INTO TABLE @mt_supplement.
ENDIF.
READ TABLE mt_supplement TRANSPORTING NO FIELDS WITH TABLE KEY supplement_id = is_booking_supplement-supplement_id.
IF sy-subrc <> 0.
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>supplement_unknown supplement_id = is_booking_supplement-supplement_id ) TO ct_messages.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD _check_currency_code.
rv_is_valid = abap_true.
IF ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create AND is_booking_supplement-currency_code IS NOT INITIAL ) " Will be derived if initial
OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_booking_supplementx-currency_code = abap_true ).
rv_is_valid = lcl_common_checks=>is_currency_code_valid( EXPORTING iv_currency_code = is_booking_supplement-currency_code CHANGING ct_messages = ct_messages ).
ENDIF.
ENDMETHOD.
METHOD _determine.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create.
" Derive price and currency code if one of the fields is initial
IF cs_booking_supplement-price IS INITIAL OR cs_booking_supplement-currency_code IS INITIAL.
IF mt_supplement IS INITIAL.
SELECT * FROM /dmo/suppleme_01 INTO TABLE @mt_supplement.
ENDIF.
READ TABLE mt_supplement ASSIGNING FIELD-SYMBOL(<s_supplement>) WITH TABLE KEY supplement_id = cs_booking_supplement-supplement_id.
ASSERT sy-subrc = 0. " Check has been done before
cs_booking_supplement-price = <s_supplement>-price.
cs_booking_supplement-currency_code = <s_supplement>-currency_code.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_booking_buffer DEFINITION FINAL CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS: get_instance RETURNING VALUE(ro_instance) TYPE REF TO lcl_booking_buffer.
METHODS save.
METHODS initialize.
METHODS check_booking_id IMPORTING iv_travel_id TYPE /dmo/travel_id01
iv_booking_id TYPE /dmo/booking_id01
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
"! Prepare changes in a temporary buffer
"! @parameter iv_no_delete_check | In some cases we do not need to check the existence of a record to be deleted, as this check has been done before.
"! | E.g. delete all subnodes of a node to be deleted. In this case we have read the subnodes to get their keys.
METHODS cud_prep IMPORTING it_booking TYPE /dmo/if_flight_legacy01=>tt_booking
it_bookingx TYPE /dmo/if_flight_legacy01=>tt_bookingx
iv_no_delete_check TYPE abap_bool OPTIONAL
EXPORTING et_booking TYPE /dmo/if_flight_legacy01=>tt_booking
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
"! Add content of the temporary buffer to the real buffer and clear the temporary buffer
METHODS cud_copy.
"! Discard content of the temporary buffer
METHODS cud_disc.
"! Get all Bookings for given Travels
METHODS get IMPORTING it_booking TYPE /dmo/if_flight_legacy01=>tt_booking
iv_include_buffer TYPE abap_boolean
iv_include_temp_buffer TYPE abap_boolean
EXPORTING et_booking TYPE /dmo/if_flight_legacy01=>tt_booking.
PRIVATE SECTION.
CLASS-DATA go_instance TYPE REF TO lcl_booking_buffer.
" Main buffer
DATA: mt_create_buffer TYPE /dmo/if_flight_legacy01=>tt_booking,
mt_update_buffer TYPE /dmo/if_flight_legacy01=>tt_booking,
mt_delete_buffer TYPE /dmo/if_flight_legacy01=>tt_booking_key.
" Temporary buffer valid during create / update / delete Travel
DATA: mt_create_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_booking,
mt_update_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_booking,
mt_delete_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_booking_key.
TYPES: BEGIN OF ts_flight_key,
carrier_id TYPE /dmo/carrier_id01,
connection_id TYPE /dmo/connection_id01,
flight_date TYPE /dmo/flight_date01,
END OF ts_flight_key.
TYPES tt_flight_key TYPE SORTED TABLE OF ts_flight_key WITH UNIQUE KEY carrier_id connection_id flight_date.
DATA mt_flight_key TYPE tt_flight_key.
METHODS _create IMPORTING it_booking TYPE /dmo/if_flight_legacy01=>tt_booking
EXPORTING et_booking TYPE /dmo/if_flight_legacy01=>tt_booking
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _update IMPORTING it_booking TYPE /dmo/if_flight_legacy01=>tt_booking
it_bookingx TYPE /dmo/if_flight_legacy01=>tt_bookingx
EXPORTING et_booking TYPE /dmo/if_flight_legacy01=>tt_booking
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _delete IMPORTING it_booking TYPE /dmo/if_flight_legacy01=>tt_booking
iv_no_delete_check TYPE abap_bool
EXPORTING et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _check IMPORTING is_booking TYPE /dmo/booking01
is_bookingx TYPE /dmo/if_flight_legacy01=>ts_bookingx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_booking_date IMPORTING is_booking TYPE /dmo/booking01
is_bookingx TYPE /dmo/if_flight_legacy01=>ts_bookingx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_customer IMPORTING is_booking TYPE /dmo/booking01
is_bookingx TYPE /dmo/if_flight_legacy01=>ts_bookingx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_flight IMPORTING is_booking TYPE /dmo/booking01
is_bookingx TYPE /dmo/if_flight_legacy01=>ts_bookingx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_currency_code IMPORTING is_booking TYPE /dmo/booking01
is_bookingx TYPE /dmo/if_flight_legacy01=>ts_bookingx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _determine IMPORTING iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING cs_booking TYPE /dmo/booking01.
ENDCLASS.
CLASS lcl_booking_buffer IMPLEMENTATION.
METHOD get_instance.
go_instance = COND #( WHEN go_instance IS BOUND THEN go_instance ELSE NEW #( ) ).
ro_instance = go_instance.
ENDMETHOD.
METHOD _create.
CLEAR et_booking.
CLEAR et_messages.
TYPES: BEGIN OF ts_travel_booking_id,
travel_id TYPE /dmo/travel_id01,
booking_id TYPE /dmo/booking_id01,
END OF ts_travel_booking_id,
tt_travel_booking_id TYPE SORTED TABLE OF ts_travel_booking_id WITH UNIQUE KEY travel_id booking_id.
DATA lt_travel_booking_id TYPE tt_travel_booking_id.
CHECK it_booking IS NOT INITIAL.
SELECT FROM /dmo/booking01 FIELDS travel_id, booking_id FOR ALL ENTRIES IN @it_booking WHERE travel_id = @it_booking-travel_id AND booking_id = @it_booking-booking_id INTO CORRESPONDING FIELDS OF TABLE @lt_travel_booking_id.
LOOP AT it_booking INTO DATA(ls_booking_create) ##INTO_OK.
" Booking_ID key must not be initial
IF ls_booking_create-booking_id IS INITIAL.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_no_key travel_id = ls_booking_create-travel_id ) TO et_messages.
RETURN.
ENDIF.
" Booking_ID key check DB
READ TABLE lt_travel_booking_id TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = ls_booking_create-travel_id booking_id = ls_booking_create-booking_id.
IF sy-subrc = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_exists travel_id = ls_booking_create-travel_id booking_id = ls_booking_create-booking_id ) TO et_messages.
RETURN.
ENDIF.
" Booking_ID key check Buffer
READ TABLE mt_create_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = ls_booking_create-travel_id booking_id = ls_booking_create-booking_id.
IF sy-subrc = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_exists travel_id = ls_booking_create-travel_id booking_id = ls_booking_create-booking_id ) TO et_messages.
RETURN.
ENDIF.
" Checks
IF _check( EXPORTING is_booking = ls_booking_create
iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create
CHANGING ct_messages = et_messages ) = abap_false.
RETURN.
ENDIF.
" standard determinations
_determine( EXPORTING iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create
CHANGING cs_booking = ls_booking_create ).
INSERT ls_booking_create INTO TABLE mt_create_buffer_2.
ENDLOOP.
et_booking = mt_create_buffer_2.
ENDMETHOD.
METHOD _update.
CLEAR et_booking.
CLEAR et_messages.
CHECK it_booking IS NOT INITIAL.
" Check for empty keys
LOOP AT it_booking ASSIGNING FIELD-SYMBOL(<s_booking_update>) WHERE booking_id = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_no_key travel_id = <s_booking_update>-travel_id ) TO et_messages.
RETURN.
ENDLOOP.
DATA lt_booking TYPE SORTED TABLE OF /dmo/booking01 WITH UNIQUE KEY travel_id booking_id.
SELECT * FROM /dmo/booking01 FOR ALL ENTRIES IN @it_booking WHERE travel_id = @it_booking-travel_id AND booking_id = @it_booking-booking_id INTO TABLE @lt_booking.
FIELD-SYMBOLS <s_buffer_booking> TYPE /dmo/booking01.
DATA ls_buffer_booking TYPE /dmo/booking01.
LOOP AT it_booking ASSIGNING <s_booking_update>.
UNASSIGN <s_buffer_booking>.
READ TABLE mt_delete_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id.
IF sy-subrc = 0." Error: Record to be updated marked for deletion
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_unknown travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id ) TO et_messages.
RETURN.
ENDIF.
IF <s_buffer_booking> IS NOT ASSIGNED." Special case: record already in temporary create buffer
READ TABLE mt_create_buffer_2 ASSIGNING <s_buffer_booking> WITH TABLE KEY travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id.
ENDIF.
IF <s_buffer_booking> IS NOT ASSIGNED." Special case: record already in create buffer
READ TABLE mt_create_buffer INTO ls_buffer_booking WITH TABLE KEY travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id.
IF sy-subrc = 0.
INSERT ls_buffer_booking INTO TABLE mt_create_buffer_2 ASSIGNING <s_buffer_booking>.
ENDIF.
ENDIF.
IF <s_buffer_booking> IS NOT ASSIGNED." Special case: record already in temporary update buffer
READ TABLE mt_update_buffer_2 ASSIGNING <s_buffer_booking> WITH TABLE KEY travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id.
ENDIF.
IF <s_buffer_booking> IS NOT ASSIGNED." Special case: record already in update buffer
READ TABLE mt_update_buffer INTO ls_buffer_booking WITH TABLE KEY travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id.
IF sy-subrc = 0.
INSERT ls_buffer_booking INTO TABLE mt_update_buffer_2 ASSIGNING <s_buffer_booking>.
ENDIF.
ENDIF.
IF <s_buffer_booking> IS NOT ASSIGNED." Usual case: record not already in update buffer
READ TABLE lt_booking ASSIGNING FIELD-SYMBOL(<s_booking_old>) WITH TABLE KEY travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id.
IF sy-subrc = 0.
INSERT <s_booking_old> INTO TABLE mt_update_buffer_2 ASSIGNING <s_buffer_booking>.
ASSERT sy-subrc = 0.
ENDIF.
ENDIF.
" Error
IF <s_buffer_booking> IS NOT ASSIGNED.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_unknown travel_id = <s_booking_update>-travel_id booking_id = <s_booking_update>-booking_id ) TO et_messages.
RETURN.
ENDIF.
" Merge fields to be updated
READ TABLE it_bookingx ASSIGNING FIELD-SYMBOL(<s_bookingx>) WITH KEY travel_id = <s_booking_update>-travel_id
booking_id = <s_booking_update>-booking_id
action_code = /dmo/if_flight_legacy01=>action_code-update.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_no_control
travel_id = <s_booking_update>-travel_id
booking_id = <s_booking_update>-booking_id ) TO et_messages.
RETURN.
ENDIF.
IF ( <s_bookingx>-carrier_id = abap_true AND ( <s_booking_update>-carrier_id <> <s_buffer_booking>-carrier_id ) )
OR ( <s_bookingx>-connection_id = abap_true AND ( <s_booking_update>-connection_id <> <s_buffer_booking>-connection_id ) )
OR ( <s_bookingx>-flight_date = abap_true AND ( <s_booking_update>-flight_date <> <s_buffer_booking>-flight_date ) ).
" The flight must not be changed (delete the record and create a new one)
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_flight_u
travel_id = <s_booking_update>-travel_id
booking_id = <s_booking_update>-booking_id ) TO et_messages.
RETURN.
ENDIF.
IF ( <s_bookingx>-flight_price = abap_true AND <s_bookingx>-currency_code = abap_false )
OR ( <s_bookingx>-flight_price = abap_false AND <s_bookingx>-currency_code = abap_true ).
" Price and currency code must be changed together
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_price_currency_u
travel_id = <s_booking_update>-travel_id
booking_id = <s_booking_update>-booking_id ) TO et_messages.
RETURN.
ENDIF.
DATA lv_field TYPE i.
lv_field = 4.
DO.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_bookingx> TO FIELD-SYMBOL(<v_flag>).
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF <v_flag> = abap_true.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_booking_update> TO FIELD-SYMBOL(<v_field_new>).
ASSERT sy-subrc = 0.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_buffer_booking> TO FIELD-SYMBOL(<v_field_old>).
ASSERT sy-subrc = 0.
<v_field_old> = <v_field_new>.
ENDIF.
lv_field = lv_field + 1.
ENDDO.
" Checks
IF _check( EXPORTING is_booking = <s_buffer_booking>
is_bookingx = <s_bookingx>
iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update
CHANGING ct_messages = et_messages ) = abap_false.
RETURN.
ENDIF.
" standard determinations
DATA(ls_booking) = <s_buffer_booking>." Needed, as key fields must not be changed
_determine( EXPORTING iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update
CHANGING cs_booking = ls_booking ).
<s_buffer_booking>-gr_data = ls_booking-gr_data.
INSERT <s_buffer_booking> INTO TABLE et_booking.
ENDLOOP.
ENDMETHOD.
METHOD _delete.
CLEAR et_messages.
CHECK it_booking IS NOT INITIAL.
" Check for empty keys
LOOP AT it_booking ASSIGNING FIELD-SYMBOL(<s_booking_delete>) WHERE booking_id = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_no_key travel_id = <s_booking_delete>-travel_id ) TO et_messages.
RETURN.
ENDLOOP.
DATA(lt_booking) = it_booking.
LOOP AT lt_booking ASSIGNING <s_booking_delete>.
" Special case: record already in create buffer
READ TABLE mt_create_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_booking_delete>-travel_id booking_id = <s_booking_delete>-booking_id.
IF sy-subrc = 0.
INSERT VALUE #( travel_id = <s_booking_delete>-travel_id booking_id = <s_booking_delete>-booking_id ) INTO TABLE mt_delete_buffer_2.
DELETE lt_booking.
ENDIF.
ENDLOOP.
IF iv_no_delete_check = abap_false.
DATA lt_booking_db TYPE /dmo/if_flight_legacy01=>tt_booking_key.
SELECT travel_id, booking_id FROM /dmo/booking01 FOR ALL ENTRIES IN @lt_booking WHERE travel_id = @lt_booking-travel_id AND booking_id = @lt_booking-booking_id INTO CORRESPONDING FIELDS OF TABLE @lt_booking_db.
ENDIF.
" Check existence and append to delete buffer
LOOP AT lt_booking ASSIGNING <s_booking_delete>.
IF iv_no_delete_check = abap_false.
READ TABLE lt_booking_db TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_booking_delete>-travel_id booking_id = <s_booking_delete>-booking_id.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_unknown travel_id = <s_booking_delete>-travel_id booking_id = <s_booking_delete>-booking_id ) TO et_messages.
RETURN.
ENDIF.
ENDIF.
INSERT VALUE #( travel_id = <s_booking_delete>-travel_id booking_id = <s_booking_delete>-booking_id ) INTO TABLE mt_delete_buffer_2.
ENDLOOP.
ENDMETHOD.
METHOD save.
ASSERT mt_create_buffer_2 IS INITIAL.
ASSERT mt_update_buffer_2 IS INITIAL.
ASSERT mt_delete_buffer_2 IS INITIAL.
INSERT /dmo/booking01 FROM TABLE @mt_create_buffer.
UPDATE /dmo/booking01 FROM TABLE @mt_update_buffer.
DELETE /dmo/booking01 FROM TABLE @( CORRESPONDING #( mt_delete_buffer ) ).
ENDMETHOD.
METHOD initialize.
CLEAR: mt_create_buffer, mt_update_buffer, mt_delete_buffer.
ENDMETHOD.
METHOD check_booking_id." Here we can safely assume that the Travel ID has already been checked!
rv_is_valid = abap_false.
IF iv_booking_id IS INITIAL.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_no_key travel_id = iv_travel_id ) TO ct_messages.
RETURN.
ENDIF.
IF line_exists( mt_delete_buffer[ travel_id = iv_travel_id booking_id = iv_booking_id ] ).
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_unknown travel_id = iv_travel_id booking_id = iv_booking_id ) TO ct_messages.
RETURN.
ENDIF.
IF line_exists( mt_delete_buffer_2[ travel_id = iv_travel_id booking_id = iv_booking_id ] ).
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_unknown travel_id = iv_travel_id booking_id = iv_booking_id ) TO ct_messages.
RETURN.
ENDIF.
IF line_exists( mt_create_buffer[ travel_id = iv_travel_id booking_id = iv_booking_id ] ).
rv_is_valid = abap_true.
RETURN.
ENDIF.
IF line_exists( mt_create_buffer_2[ travel_id = iv_travel_id booking_id = iv_booking_id ] ).
rv_is_valid = abap_true.
RETURN.
ENDIF.
SELECT SINGLE FROM /dmo/booking01 FIELDS @abap_true WHERE travel_id = @iv_travel_id AND booking_id = @iv_booking_id INTO @DATA(lv_db_exists).
IF lv_db_exists = abap_true.
rv_is_valid = abap_true.
RETURN.
ENDIF.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_unknown travel_id = iv_travel_id booking_id = iv_booking_id ) TO ct_messages.
ENDMETHOD.
METHOD cud_prep.
CLEAR et_booking.
CLEAR et_messages.
CHECK it_booking IS NOT INITIAL.
DATA lt_booking_c TYPE /dmo/if_flight_legacy01=>tt_booking.
DATA lt_booking_u TYPE /dmo/if_flight_legacy01=>tt_booking.
DATA lt_booking_d TYPE /dmo/if_flight_legacy01=>tt_booking.
DATA lt_bookingx_u TYPE /dmo/if_flight_legacy01=>tt_bookingx.
LOOP AT it_booking ASSIGNING FIELD-SYMBOL(<s_booking>).
READ TABLE it_bookingx ASSIGNING FIELD-SYMBOL(<s_bookingx>) WITH TABLE KEY travel_id = <s_booking>-travel_id booking_id = <s_booking>-booking_id.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_no_control
travel_id = <s_booking>-travel_id
booking_id = <s_booking>-booking_id ) TO et_messages.
RETURN.
ENDIF.
CASE CONV /dmo/if_flight_legacy01=>action_code_enum( <s_bookingx>-action_code ).
WHEN /dmo/if_flight_legacy01=>action_code-create.
INSERT <s_booking> INTO TABLE lt_booking_c.
WHEN /dmo/if_flight_legacy01=>action_code-update.
INSERT <s_booking> INTO TABLE lt_booking_u.
INSERT <s_bookingx> INTO TABLE lt_bookingx_u.
WHEN /dmo/if_flight_legacy01=>action_code-delete.
INSERT <s_booking> INTO TABLE lt_booking_d.
ENDCASE.
ENDLOOP.
_create( EXPORTING it_booking = lt_booking_c
IMPORTING et_booking = et_booking
et_messages = et_messages ).
_update( EXPORTING it_booking = lt_booking_u
it_bookingx = lt_bookingx_u
IMPORTING et_booking = DATA(lt_booking)
et_messages = DATA(lt_messages) ).
INSERT LINES OF lt_booking INTO TABLE et_booking.
APPEND LINES OF lt_messages TO et_messages.
_delete( EXPORTING it_booking = lt_booking_d
iv_no_delete_check = iv_no_delete_check
IMPORTING et_messages = lt_messages ).
APPEND LINES OF lt_messages TO et_messages.
ENDMETHOD.
METHOD cud_copy.
LOOP AT mt_create_buffer_2 ASSIGNING FIELD-SYMBOL(<s_create_buffer_2>).
READ TABLE mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_create_buffer>) WITH TABLE KEY travel_id = <s_create_buffer_2>-travel_id booking_id = <s_create_buffer_2>-booking_id.
IF sy-subrc <> 0.
INSERT VALUE #( travel_id = <s_create_buffer_2>-travel_id booking_id = <s_create_buffer_2>-booking_id ) INTO TABLE mt_create_buffer ASSIGNING <s_create_buffer>.
ENDIF.
<s_create_buffer>-gr_data = <s_create_buffer_2>-gr_data.
ENDLOOP.
LOOP AT mt_update_buffer_2 ASSIGNING FIELD-SYMBOL(<s_update_buffer_2>).
READ TABLE mt_update_buffer ASSIGNING FIELD-SYMBOL(<s_update_buffer>) WITH TABLE KEY travel_id = <s_update_buffer_2>-travel_id booking_id = <s_update_buffer_2>-booking_id.
IF sy-subrc <> 0.
INSERT VALUE #( travel_id = <s_update_buffer_2>-travel_id booking_id = <s_update_buffer_2>-booking_id ) INTO TABLE mt_update_buffer ASSIGNING <s_update_buffer>.
ENDIF.
<s_update_buffer>-gr_data = <s_update_buffer_2>-gr_data.
ENDLOOP.
LOOP AT mt_delete_buffer_2 ASSIGNING FIELD-SYMBOL(<s_delete_buffer_2>).
DELETE mt_create_buffer WHERE travel_id = <s_delete_buffer_2>-travel_id AND booking_id = <s_delete_buffer_2>-booking_id.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
DELETE mt_update_buffer WHERE travel_id = <s_delete_buffer_2>-travel_id AND booking_id = <s_delete_buffer_2>-booking_id.
INSERT <s_delete_buffer_2> INTO TABLE mt_delete_buffer.
ENDLOOP.
CLEAR: mt_create_buffer_2, mt_update_buffer_2, mt_delete_buffer_2.
ENDMETHOD.
METHOD cud_disc.
CLEAR: mt_create_buffer_2, mt_update_buffer_2, mt_delete_buffer_2.
ENDMETHOD.
METHOD get.
CLEAR et_booking.
CHECK it_booking IS NOT INITIAL.
SELECT * FROM /dmo/booking01 FOR ALL ENTRIES IN @it_booking WHERE travel_id = @it_booking-travel_id
INTO TABLE @et_booking ##SELECT_FAE_WITH_LOB[DESCRIPTION].
IF iv_include_buffer = abap_true.
LOOP AT it_booking ASSIGNING FIELD-SYMBOL(<s_booking>).
LOOP AT mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_create_buffer>) WHERE travel_id = <s_booking>-travel_id.
INSERT <s_create_buffer> INTO TABLE et_booking.
ENDLOOP.
LOOP AT mt_update_buffer ASSIGNING FIELD-SYMBOL(<s_update_buffer>) WHERE travel_id = <s_booking>-travel_id.
MODIFY TABLE et_booking FROM <s_update_buffer>.
ENDLOOP.
LOOP AT mt_delete_buffer ASSIGNING FIELD-SYMBOL(<s_delete_buffer>) WHERE travel_id = <s_booking>-travel_id.
DELETE et_booking WHERE travel_id = <s_delete_buffer>-travel_id AND booking_id = <s_delete_buffer>-booking_id.
ENDLOOP.
ENDLOOP.
ENDIF.
IF iv_include_temp_buffer = abap_true.
LOOP AT it_booking ASSIGNING <s_booking>.
LOOP AT mt_create_buffer_2 ASSIGNING <s_create_buffer> WHERE travel_id = <s_booking>-travel_id.
DELETE et_booking WHERE travel_id = <s_create_buffer>-travel_id AND booking_id = <s_create_buffer>-booking_id.
INSERT <s_create_buffer> INTO TABLE et_booking.
ENDLOOP.
LOOP AT mt_update_buffer_2 ASSIGNING <s_update_buffer> WHERE travel_id = <s_booking>-travel_id.
MODIFY TABLE et_booking FROM <s_update_buffer>.
ENDLOOP.
LOOP AT mt_delete_buffer_2 ASSIGNING <s_delete_buffer> WHERE travel_id = <s_booking>-travel_id.
DELETE et_booking WHERE travel_id = <s_delete_buffer>-travel_id AND booking_id = <s_delete_buffer>-booking_id.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD _check.
rv_is_valid = abap_true.
IF NOT _check_booking_date( EXPORTING is_booking = is_booking
is_bookingx = is_bookingx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_customer( EXPORTING is_booking = is_booking
is_bookingx = is_bookingx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_flight( EXPORTING is_booking = is_booking
is_bookingx = is_bookingx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_currency_code( EXPORTING is_booking = is_booking
is_bookingx = is_bookingx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
ENDMETHOD.
METHOD _check_booking_date.
rv_is_valid = abap_true.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_bookingx-booking_date = abap_true ).
" A. Booking Date must not be initial
" B. When the record is created it must not be in the past
IF is_booking-booking_date IS INITIAL OR is_booking-booking_date = '' OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create AND is_booking-booking_date < cl_abap_context_info=>get_system_date( ) ).
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>booking_booking_date_invalid travel_id = is_booking-travel_id booking_id = is_booking-booking_id booking_date = is_booking-booking_date ) TO ct_messages.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD _check_customer.
rv_is_valid = abap_true.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_bookingx-customer_id = abap_true ).
rv_is_valid = lcl_common_checks=>is_customer_id_valid( EXPORTING iv_customer_id = is_booking-customer_id CHANGING ct_messages = ct_messages ).
ENDIF.
ENDMETHOD.
METHOD _check_flight.
rv_is_valid = abap_true.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create
OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update
AND ( is_bookingx-carrier_id = abap_true OR is_bookingx-connection_id = abap_true OR is_bookingx-flight_date = abap_true ) ).
IF mt_flight_key IS INITIAL.
SELECT carrier_id, connection_id, flight_date FROM /dmo/flight01 INTO CORRESPONDING FIELDS OF TABLE @mt_flight_key.
ENDIF.
READ TABLE mt_flight_key TRANSPORTING NO FIELDS WITH TABLE KEY carrier_id = is_booking-carrier_id connection_id = is_booking-connection_id flight_date = is_booking-flight_date.
IF sy-subrc <> 0.
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>flight_unknown carrier_id = is_booking-carrier_id connection_id = is_booking-connection_id flight_date = is_booking-flight_date ) TO ct_messages.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD _check_currency_code.
rv_is_valid = abap_true.
IF ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create AND is_booking-currency_code IS NOT INITIAL ) " Will be derived if initial
OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_bookingx-currency_code = abap_true ).
rv_is_valid = lcl_common_checks=>is_currency_code_valid( EXPORTING iv_currency_code = is_booking-currency_code CHANGING ct_messages = ct_messages ).
ENDIF.
ENDMETHOD.
METHOD _determine.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create.
" Derive price and currency code if one of the fields is initial
IF cs_booking-flight_price IS INITIAL OR cs_booking-currency_code IS INITIAL.
" Flight price might have changed, we need to use current flight price
SELECT SINGLE price, currency_code FROM /dmo/flight01 WHERE carrier_id = @cs_booking-carrier_id
AND connection_id = @cs_booking-connection_id
AND flight_date = @cs_booking-flight_date INTO ( @cs_booking-flight_price, @cs_booking-currency_code ).
ASSERT sy-subrc = 0. " Check has been done before
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_travel_buffer DEFINITION FINAL CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS: get_instance RETURNING VALUE(ro_instance) TYPE REF TO lcl_travel_buffer.
METHODS set_status_to_booked IMPORTING iv_travel_id TYPE /dmo/travel_id01
EXPORTING et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS save.
METHODS initialize.
METHODS check_travel_id IMPORTING iv_travel_id TYPE /dmo/travel_id01
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
"! Prepare changes in a temporary buffer
"! @parameter iv_no_delete_check | In some cases we do not need to check the existence of a record to be deleted, as this check has been done before.
"! | E.g. delete all subnodes of a node to be deleted. In this case we have read the subnodes to get their keys.
METHODS cud_prep IMPORTING it_travel TYPE /dmo/if_flight_legacy01=>tt_travel
it_travelx TYPE /dmo/if_flight_legacy01=>tt_travelx
iv_no_delete_check TYPE abap_bool OPTIONAL
EXPORTING et_travel TYPE /dmo/if_flight_legacy01=>tt_travel
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
"! Add content of the temporary buffer to the real buffer and clear the temporary buffer
METHODS cud_copy.
"! Discard content of the temporary buffer
METHODS cud_disc.
METHODS get IMPORTING it_travel TYPE /dmo/if_flight_legacy01=>tt_travel
iv_include_buffer TYPE abap_boolean
iv_include_temp_buffer TYPE abap_boolean
EXPORTING et_travel TYPE /dmo/if_flight_legacy01=>tt_travel.
PRIVATE SECTION.
CLASS-DATA go_instance TYPE REF TO lcl_travel_buffer.
" Main buffer
DATA: mt_create_buffer TYPE /dmo/if_flight_legacy01=>tt_travel,
mt_update_buffer TYPE /dmo/if_flight_legacy01=>tt_travel,
mt_delete_buffer TYPE /dmo/if_flight_legacy01=>tt_travel_key.
" Temporary buffer valid during create / update / delete Travel
DATA: mt_create_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_travel,
mt_update_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_travel,
mt_delete_buffer_2 TYPE /dmo/if_flight_legacy01=>tt_travel_key.
DATA mt_agency_id TYPE SORTED TABLE OF /dmo/agency_id01 WITH UNIQUE KEY table_line.
METHODS _create IMPORTING it_travel TYPE /dmo/if_flight_legacy01=>tt_travel
EXPORTING et_travel TYPE /dmo/if_flight_legacy01=>tt_travel
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _update IMPORTING it_travel TYPE /dmo/if_flight_legacy01=>tt_travel
it_travelx TYPE /dmo/if_flight_legacy01=>tt_travelx
EXPORTING et_travel TYPE /dmo/if_flight_legacy01=>tt_travel
et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _delete IMPORTING it_travel TYPE /dmo/if_flight_legacy01=>tt_travel
iv_no_delete_check TYPE abap_bool
EXPORTING et_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message.
METHODS _check IMPORTING is_travel TYPE /dmo/travel01
is_travelx TYPE /dmo/if_flight_legacy01=>ts_travelx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_agency IMPORTING is_travel TYPE /dmo/travel01
is_travelx TYPE /dmo/if_flight_legacy01=>ts_travelx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_customer IMPORTING is_travel TYPE /dmo/travel01
is_travelx TYPE /dmo/if_flight_legacy01=>ts_travelx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_dates IMPORTING is_travel TYPE /dmo/travel01
is_travelx TYPE /dmo/if_flight_legacy01=>ts_travelx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_status IMPORTING is_travel TYPE /dmo/travel01
is_travelx TYPE /dmo/if_flight_legacy01=>ts_travelx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _check_currency_code IMPORTING is_travel TYPE /dmo/travel01
is_travelx TYPE /dmo/if_flight_legacy01=>ts_travelx OPTIONAL
iv_change_mode TYPE /dmo/cl_flight_legacy01=>ty_change_mode
CHANGING ct_messages TYPE /dmo/if_flight_legacy01=>tt_if_t100_message
RETURNING VALUE(rv_is_valid) TYPE abap_bool.
METHODS _update_admin IMPORTING iv_new TYPE abap_bool CHANGING cs_travel_admin TYPE /dmo/travel_a_01.
ENDCLASS.
CLASS lcl_travel_buffer IMPLEMENTATION.
METHOD get_instance.
go_instance = COND #( WHEN go_instance IS BOUND THEN go_instance ELSE NEW #( ) ).
ro_instance = go_instance.
ENDMETHOD.
METHOD _create.
CLEAR et_travel.
CLEAR et_messages.
CHECK it_travel IS NOT INITIAL.
DATA lv_travel_id_max TYPE /dmo/travel_id01.
IF lcl_travel_buffer=>get_instance( )->mt_create_buffer IS INITIAL.
SELECT FROM /dmo/travel01 FIELDS MAX( travel_id ) INTO @lv_travel_id_max.
ELSE.
LOOP AT mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_buffer_travel_create>).
IF <s_buffer_travel_create>-travel_id > lv_travel_id_max.
lv_travel_id_max = <s_buffer_travel_create>-travel_id.
ENDIF.
ENDLOOP.
ENDIF.
LOOP AT it_travel INTO DATA(ls_travel_create) ##INTO_OK.
" Checks
IF _check( EXPORTING is_travel = ls_travel_create
iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create
CHANGING ct_messages = et_messages ) = abap_false.
RETURN.
ENDIF.
" standard determinations
ls_travel_create-createdby = sy-uname.
GET TIME STAMP FIELD ls_travel_create-createdat.
ls_travel_create-lastchangedby = ls_travel_create-createdby.
ls_travel_create-lastchangedat = ls_travel_create-createdat.
ls_travel_create-status = /dmo/if_flight_legacy01=>travel_status-new.
" **Internal** numbering: Override travel_id
lv_travel_id_max = lv_travel_id_max + 1.
ASSERT lv_travel_id_max IS NOT INITIAL.
ls_travel_create-travel_id = lv_travel_id_max.
INSERT ls_travel_create INTO TABLE mt_create_buffer_2.
ENDLOOP.
et_travel = mt_create_buffer_2.
ENDMETHOD.
METHOD _update.
DATA lv_new TYPE abap_bool.
CLEAR et_travel.
CLEAR et_messages.
CHECK it_travel IS NOT INITIAL.
" Check for empty keys
READ TABLE it_travel TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = '0'.
IF sy-subrc = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_no_key ) TO et_messages.
RETURN.
ENDIF.
DATA lt_travel TYPE SORTED TABLE OF /dmo/travel01 WITH UNIQUE KEY travel_id.
SELECT * FROM /dmo/travel01 FOR ALL ENTRIES IN @it_travel WHERE travel_id = @it_travel-travel_id INTO TABLE @lt_travel ##SELECT_FAE_WITH_LOB[DESCRIPTION].
FIELD-SYMBOLS <s_buffer_travel> TYPE /dmo/travel01.
DATA ls_buffer_travel TYPE /dmo/travel01.
LOOP AT it_travel ASSIGNING FIELD-SYMBOL(<s_travel_update>).
UNASSIGN <s_buffer_travel>.
READ TABLE mt_delete_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_travel_update>-travel_id.
IF sy-subrc = 0." Error: Record to be updated marked for deletion
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_unknown travel_id = <s_travel_update>-travel_id ) TO et_messages.
RETURN.
ENDIF.
IF <s_buffer_travel> IS NOT ASSIGNED." Special case: record already in temporary create buffer
READ TABLE mt_create_buffer_2 ASSIGNING <s_buffer_travel> WITH TABLE KEY travel_id = <s_travel_update>-travel_id.
IF sy-subrc = 0.
lv_new = abap_true.
ENDIF.
ENDIF.
IF <s_buffer_travel> IS NOT ASSIGNED." Special case: record already in create buffer
lv_new = abap_false.
READ TABLE mt_create_buffer INTO ls_buffer_travel WITH TABLE KEY travel_id = <s_travel_update>-travel_id.
IF sy-subrc = 0.
INSERT ls_buffer_travel INTO TABLE mt_create_buffer_2 ASSIGNING <s_buffer_travel>.
lv_new = abap_true.
ENDIF.
ENDIF.
IF <s_buffer_travel> IS NOT ASSIGNED." Special case: record already in temporary update buffer
READ TABLE mt_update_buffer_2 ASSIGNING <s_buffer_travel> WITH TABLE KEY travel_id = <s_travel_update>-travel_id.
ENDIF.
IF <s_buffer_travel> IS NOT ASSIGNED." Special case: record already in update buffer
READ TABLE mt_update_buffer INTO ls_buffer_travel WITH TABLE KEY travel_id = <s_travel_update>-travel_id.
IF sy-subrc = 0.
INSERT ls_buffer_travel INTO TABLE mt_update_buffer_2 ASSIGNING <s_buffer_travel>.
ENDIF.
ENDIF.
IF <s_buffer_travel> IS NOT ASSIGNED." Usual case: record not already in update buffer
READ TABLE lt_travel ASSIGNING FIELD-SYMBOL(<s_travel_old>) WITH TABLE KEY travel_id = <s_travel_update>-travel_id.
IF sy-subrc = 0.
INSERT <s_travel_old> INTO TABLE mt_update_buffer_2 ASSIGNING <s_buffer_travel>.
ASSERT sy-subrc = 0.
ENDIF.
ENDIF.
" Error
IF <s_buffer_travel> IS NOT ASSIGNED.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_unknown travel_id = <s_travel_update>-travel_id ) TO et_messages.
RETURN.
ENDIF.
" Merge fields to be updated
READ TABLE it_travelx ASSIGNING FIELD-SYMBOL(<s_travelx>) WITH KEY travel_id = <s_travel_update>-travel_id action_code = /dmo/if_flight_legacy01=>action_code-update.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_no_control travel_id = <s_travel_update>-travel_id ) TO et_messages.
RETURN.
ENDIF.
DATA lv_field TYPE i.
lv_field = 3.
DO.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_travelx> TO FIELD-SYMBOL(<v_flag>).
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF <v_flag> = abap_true.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_travel_update> TO FIELD-SYMBOL(<v_field_new>).
ASSERT sy-subrc = 0.
ASSIGN COMPONENT lv_field OF STRUCTURE <s_buffer_travel> TO FIELD-SYMBOL(<v_field_old>).
ASSERT sy-subrc = 0.
<v_field_old> = <v_field_new>.
ENDIF.
lv_field = lv_field + 1.
ENDDO.
" Checks
IF _check( EXPORTING is_travel = <s_buffer_travel>
is_travelx = <s_travelx>
iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update
CHANGING ct_messages = et_messages ) = abap_false.
RETURN.
ENDIF.
" Set administrative fields
_update_admin( EXPORTING iv_new = lv_new CHANGING cs_travel_admin = <s_buffer_travel>-gr_admin ).
" standard determinations
INSERT <s_buffer_travel> INTO TABLE et_travel.
ENDLOOP.
ENDMETHOD.
METHOD _delete.
CLEAR et_messages.
CHECK it_travel IS NOT INITIAL.
" Check for empty keys
READ TABLE it_travel TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = '0'.
IF sy-subrc = 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_no_key ) TO et_messages.
RETURN.
ENDIF.
DATA(lt_travel) = it_travel.
" Special case: record already in create buffer
LOOP AT lt_travel ASSIGNING FIELD-SYMBOL(<s_travel_delete>).
READ TABLE mt_create_buffer TRANSPORTING NO FIELDS WITH KEY travel_id = <s_travel_delete>-travel_id.
IF sy-subrc = 0.
INSERT VALUE #( travel_id = <s_travel_delete>-travel_id ) INTO TABLE mt_delete_buffer_2.
DELETE lt_travel.
ENDIF.
ENDLOOP.
IF iv_no_delete_check = abap_false.
DATA lt_travel_db TYPE SORTED TABLE OF /dmo/travel_id01 WITH UNIQUE KEY table_line.
SELECT travel_id FROM /dmo/travel01 FOR ALL ENTRIES IN @lt_travel WHERE travel_id = @lt_travel-travel_id INTO TABLE @lt_travel_db.
ENDIF.
" Check existence and append to delete buffer
LOOP AT lt_travel ASSIGNING <s_travel_delete>.
IF iv_no_delete_check = abap_false.
READ TABLE lt_travel_db ASSIGNING FIELD-SYMBOL(<s_travel_old>) WITH TABLE KEY table_line = <s_travel_delete>-travel_id.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_unknown travel_id = <s_travel_delete>-travel_id ) TO et_messages.
RETURN.
ENDIF.
ENDIF.
INSERT VALUE #( travel_id = <s_travel_delete>-travel_id ) INTO TABLE mt_delete_buffer_2.
ENDLOOP.
ENDMETHOD.
METHOD set_status_to_booked.
DATA lv_new TYPE abap_bool.
CLEAR et_messages.
" Check for empty travel ID
IF iv_travel_id IS INITIAL.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_no_key ) TO et_messages.
RETURN.
ENDIF.
READ TABLE mt_delete_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = iv_travel_id.
IF sy-subrc = 0." Error: Record of action marked for deletion
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_unknown travel_id = iv_travel_id ) TO et_messages.
RETURN.
ENDIF.
" Special case: Record in CREATE buffer
lv_new = abap_false.
READ TABLE mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_travel>) WITH TABLE KEY travel_id = iv_travel_id.
IF sy-subrc = 0.
lv_new = abap_true.
ENDIF.
" Special case: Record in UPDATE buffer
IF <s_travel> IS NOT ASSIGNED.
READ TABLE mt_update_buffer ASSIGNING <s_travel> WITH TABLE KEY travel_id = iv_travel_id.
ENDIF.
" Usual case: Read record from DB and put it into the UPDATE buffer
IF <s_travel> IS NOT ASSIGNED.
SELECT SINGLE * FROM /dmo/travel01 WHERE travel_id = @iv_travel_id INTO @DATA(ls_travel) .
IF sy-subrc = 0.
INSERT ls_travel INTO TABLE mt_update_buffer ASSIGNING <s_travel>.
ENDIF.
ENDIF.
" Error
IF <s_travel> IS NOT ASSIGNED.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_unknown travel_id = iv_travel_id ) TO et_messages.
RETURN.
ENDIF.
<s_travel>-status = /dmo/if_flight_legacy01=>travel_status-booked.
_update_admin( EXPORTING iv_new = lv_new CHANGING cs_travel_admin = <s_travel>-gr_admin ).
ENDMETHOD.
METHOD save.
ASSERT mt_create_buffer_2 IS INITIAL.
ASSERT mt_update_buffer_2 IS INITIAL.
ASSERT mt_delete_buffer_2 IS INITIAL.
INSERT /dmo/travel01 FROM TABLE @mt_create_buffer.
UPDATE /dmo/travel01 FROM TABLE @mt_update_buffer.
DELETE /dmo/travel01 FROM TABLE @( CORRESPONDING #( mt_delete_buffer ) ).
ENDMETHOD.
METHOD initialize.
CLEAR: mt_create_buffer, mt_update_buffer, mt_delete_buffer.
ENDMETHOD.
METHOD check_travel_id.
rv_is_valid = abap_false.
IF iv_travel_id IS INITIAL.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_no_key ) TO ct_messages.
RETURN.
ENDIF.
IF line_exists( mt_delete_buffer[ travel_id = iv_travel_id ] ).
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_unknown travel_id = iv_travel_id ) TO ct_messages.
RETURN.
ENDIF.
IF line_exists( mt_create_buffer[ travel_id = iv_travel_id ] ).
rv_is_valid = abap_true.
RETURN.
ENDIF.
SELECT SINGLE FROM /dmo/travel01 FIELDS @abap_true WHERE travel_id = @iv_travel_id INTO @DATA(lv_db_exists).
IF lv_db_exists = abap_true.
rv_is_valid = abap_true.
RETURN.
ENDIF.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_unknown travel_id = iv_travel_id ) TO ct_messages.
ENDMETHOD.
METHOD cud_prep.
CLEAR et_travel.
CLEAR et_messages.
CHECK it_travel IS NOT INITIAL.
DATA lt_travel_c TYPE /dmo/if_flight_legacy01=>tt_travel.
DATA lt_travel_u TYPE /dmo/if_flight_legacy01=>tt_travel.
DATA lt_travel_d TYPE /dmo/if_flight_legacy01=>tt_travel.
DATA lt_travelx_u TYPE /dmo/if_flight_legacy01=>tt_travelx.
LOOP AT it_travel ASSIGNING FIELD-SYMBOL(<s_travel>).
READ TABLE it_travelx ASSIGNING FIELD-SYMBOL(<s_travelx>) WITH TABLE KEY travel_id = <s_travel>-travel_id.
IF sy-subrc <> 0.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_no_control
travel_id = <s_travel>-travel_id ) TO et_messages.
RETURN.
ENDIF.
CASE CONV /dmo/if_flight_legacy01=>action_code_enum( <s_travelx>-action_code ).
WHEN /dmo/if_flight_legacy01=>action_code-create.
INSERT <s_travel> INTO TABLE lt_travel_c.
WHEN /dmo/if_flight_legacy01=>action_code-update.
INSERT <s_travel> INTO TABLE lt_travel_u.
INSERT <s_travelx> INTO TABLE lt_travelx_u.
WHEN /dmo/if_flight_legacy01=>action_code-delete.
INSERT <s_travel> INTO TABLE lt_travel_d.
ENDCASE.
ENDLOOP.
_create( EXPORTING it_travel = lt_travel_c
IMPORTING et_travel = et_travel
et_messages = et_messages ).
_update( EXPORTING it_travel = lt_travel_u
it_travelx = lt_travelx_u
IMPORTING et_travel = DATA(lt_travel)
et_messages = DATA(lt_messages) ).
INSERT LINES OF lt_travel INTO TABLE et_travel.
APPEND LINES OF lt_messages TO et_messages.
_delete( EXPORTING it_travel = lt_travel_d
iv_no_delete_check = iv_no_delete_check
IMPORTING et_messages = lt_messages ).
APPEND LINES OF lt_messages TO et_messages.
ENDMETHOD.
METHOD cud_copy.
LOOP AT mt_create_buffer_2 ASSIGNING FIELD-SYMBOL(<s_create_buffer_2>).
READ TABLE mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_create_buffer>) WITH TABLE KEY travel_id = <s_create_buffer_2>-travel_id.
IF sy-subrc <> 0.
INSERT VALUE #( travel_id = <s_create_buffer_2>-travel_id ) INTO TABLE mt_create_buffer ASSIGNING <s_create_buffer>.
ENDIF.
<s_create_buffer>-gr_data = <s_create_buffer_2>-gr_data.
<s_create_buffer>-gr_admin = <s_create_buffer_2>-gr_admin.
ENDLOOP.
LOOP AT mt_update_buffer_2 ASSIGNING FIELD-SYMBOL(<s_update_buffer_2>).
READ TABLE mt_update_buffer ASSIGNING FIELD-SYMBOL(<s_update_buffer>) WITH TABLE KEY travel_id = <s_update_buffer_2>-travel_id.
IF sy-subrc <> 0.
INSERT VALUE #( travel_id = <s_update_buffer_2>-travel_id ) INTO TABLE mt_update_buffer ASSIGNING <s_update_buffer>.
ENDIF.
<s_update_buffer>-gr_data = <s_update_buffer_2>-gr_data.
<s_update_buffer>-gr_admin = <s_update_buffer_2>-gr_admin.
ENDLOOP.
LOOP AT mt_delete_buffer_2 ASSIGNING FIELD-SYMBOL(<s_delete_buffer_2>).
DELETE mt_create_buffer WHERE travel_id = <s_delete_buffer_2>-travel_id.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
DELETE mt_update_buffer WHERE travel_id = <s_delete_buffer_2>-travel_id.
INSERT <s_delete_buffer_2> INTO TABLE mt_delete_buffer.
ENDLOOP.
CLEAR: mt_create_buffer_2, mt_update_buffer_2, mt_delete_buffer_2.
ENDMETHOD.
METHOD cud_disc.
CLEAR: mt_create_buffer_2, mt_update_buffer_2, mt_delete_buffer_2.
ENDMETHOD.
METHOD get.
CLEAR et_travel.
CHECK it_travel IS NOT INITIAL.
SELECT * FROM /dmo/travel01 FOR ALL ENTRIES IN @it_travel WHERE travel_id = @it_travel-travel_id INTO TABLE @et_travel ##SELECT_FAE_WITH_LOB[DESCRIPTION].
IF iv_include_buffer = abap_true.
LOOP AT it_travel ASSIGNING FIELD-SYMBOL(<s_travel>).
READ TABLE mt_create_buffer ASSIGNING FIELD-SYMBOL(<s_create_buffer>) WITH TABLE KEY travel_id = <s_travel>-travel_id.
IF sy-subrc = 0.
INSERT <s_create_buffer> INTO TABLE et_travel.
ENDIF.
READ TABLE mt_update_buffer ASSIGNING FIELD-SYMBOL(<s_update_buffer>) WITH TABLE KEY travel_id = <s_travel>-travel_id.
IF sy-subrc = 0.
MODIFY TABLE et_travel FROM <s_update_buffer>.
ENDIF.
READ TABLE mt_delete_buffer TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_travel>-travel_id.
IF sy-subrc = 0.
DELETE et_travel WHERE travel_id = <s_travel>-travel_id.
ENDIF.
ENDLOOP.
ENDIF.
IF iv_include_temp_buffer = abap_true.
LOOP AT it_travel ASSIGNING <s_travel>.
READ TABLE mt_create_buffer_2 ASSIGNING <s_create_buffer> WITH TABLE KEY travel_id = <s_travel>-travel_id.
IF sy-subrc = 0.
DELETE et_travel WHERE travel_id = <s_travel>-travel_id.
INSERT <s_create_buffer> INTO TABLE et_travel.
ENDIF.
READ TABLE mt_update_buffer_2 ASSIGNING <s_update_buffer> WITH TABLE KEY travel_id = <s_travel>-travel_id.
IF sy-subrc = 0.
MODIFY TABLE et_travel FROM <s_update_buffer>.
ENDIF.
READ TABLE mt_delete_buffer_2 TRANSPORTING NO FIELDS WITH TABLE KEY travel_id = <s_travel>-travel_id.
IF sy-subrc = 0.
DELETE et_travel WHERE travel_id = <s_travel>-travel_id.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD _check.
rv_is_valid = abap_true.
IF NOT _check_agency( EXPORTING is_travel = is_travel
is_travelx = is_travelx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_customer( EXPORTING is_travel = is_travel
is_travelx = is_travelx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_dates( EXPORTING is_travel = is_travel
is_travelx = is_travelx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_status( EXPORTING is_travel = is_travel
is_travelx = is_travelx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
IF NOT _check_currency_code( EXPORTING is_travel = is_travel
is_travelx = is_travelx
iv_change_mode = iv_change_mode
CHANGING ct_messages = ct_messages ).
rv_is_valid = abap_false.
ENDIF.
ENDMETHOD.
METHOD _check_agency.
rv_is_valid = abap_true.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-agency_id = abap_true ).
IF mt_agency_id IS INITIAL.
SELECT DISTINCT agency_id FROM /dmo/agency01 INTO TABLE @mt_agency_id.
ENDIF.
READ TABLE mt_agency_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = is_travel-agency_id.
IF sy-subrc <> 0.
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>agency_unkown agency_id = is_travel-agency_id ) TO ct_messages.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD _check_customer.
rv_is_valid = abap_true.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-customer_id = abap_true ).
rv_is_valid = lcl_common_checks=>is_customer_id_valid( EXPORTING iv_customer_id = is_travel-customer_id CHANGING ct_messages = ct_messages ).
ENDIF.
ENDMETHOD.
METHOD _check_dates.
rv_is_valid = abap_true.
" begin date
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-begin_date = abap_true ).
IF is_travel-begin_date IS INITIAL OR is_travel-begin_date = ''.
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>no_begin_date travel_id = is_travel-travel_id ) TO ct_messages.
ENDIF.
ENDIF.
" end date
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-end_date = abap_true ).
IF is_travel-end_date IS INITIAL OR is_travel-end_date = ''.
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>no_end_date travel_id = is_travel-travel_id ) TO ct_messages.
ENDIF.
ENDIF.
" begin date < = end date
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-begin_date = abap_true )
OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-end_date = abap_true ).
IF is_travel-begin_date IS NOT INITIAL AND is_travel-end_date IS NOT INITIAL.
IF is_travel-begin_date > is_travel-end_date.
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>end_date_before_begin_date begin_date = is_travel-begin_date end_date = is_travel-end_date travel_id = is_travel-travel_id ) TO ct_messages.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD _check_status.
rv_is_valid = abap_true.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-status = abap_true.
CASE is_travel-status.
WHEN CONV /dmo/travel_status01( /dmo/if_flight_legacy01=>travel_status-booked ). " OK
WHEN CONV /dmo/travel_status01( /dmo/if_flight_legacy01=>travel_status-cancelled )." OK
WHEN CONV /dmo/travel_status01( /dmo/if_flight_legacy01=>travel_status-new ). " OK
WHEN CONV /dmo/travel_status01( /dmo/if_flight_legacy01=>travel_status-planned ). " OK
WHEN OTHERS.
rv_is_valid = abap_false.
APPEND NEW /dmo/cx_flight_legacy01( textid = /dmo/cx_flight_legacy01=>travel_status_invalid status = is_travel-status ) TO ct_messages.
ENDCASE.
ENDIF.
ENDMETHOD.
METHOD _check_currency_code.
rv_is_valid = abap_true.
IF is_travel-total_price IS INITIAL AND is_travel-booking_fee IS INITIAL AND is_travel-currency_code IS INITIAL.
" When no prices have been entered yet, the currency code may be initial
RETURN.
ENDIF.
IF iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-create
OR ( iv_change_mode = /dmo/cl_flight_legacy01=>change_mode-update AND is_travelx-currency_code = abap_true ).
rv_is_valid = lcl_common_checks=>is_currency_code_valid( EXPORTING iv_currency_code = is_travel-currency_code CHANGING ct_messages = ct_messages ).
ENDIF.
ENDMETHOD.
METHOD _update_admin.
cs_travel_admin-lastchangedby = sy-uname.
GET TIME STAMP FIELD cs_travel_admin-lastchangedat.
IF iv_new = abap_true.
" For a BO to be created we want created* and lastchanged* to be the same
cs_travel_admin-createdby = cs_travel_admin-lastchangedby.
cs_travel_admin-createdat = cs_travel_admin-lastchangedat.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 53.244986 | 236 | 0.662317 |
35c7880d7fe34ab1832744688e7debceed8104f0
| 12,769 |
abap
|
ABAP
|
src/objects/zcl_abapgit_object_drul.clas.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 1 |
2020-11-12T17:34:15.000Z
|
2020-11-12T17:34:15.000Z
|
src/objects/zcl_abapgit_object_drul.clas.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 1 |
2017-10-27T09:32:58.000Z
|
2017-10-27T09:32:58.000Z
|
src/objects/zcl_abapgit_object_drul.clas.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 1 |
2021-07-09T02:07:11.000Z
|
2021-07-09T02:07:11.000Z
|
CLASS zcl_abapgit_object_drul DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
METHODS:
constructor
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
iv_language TYPE spras
RAISING
zcx_abapgit_exception.
PRIVATE SECTION.
METHODS:
clear_fields
CHANGING
cs_dependency_rule TYPE any,
clear_field
IMPORTING
iv_fieldname TYPE csequence
CHANGING
cs_dependency_rule TYPE any,
fill_metadata_from_db
CHANGING
cs_dependency_rule TYPE any
RAISING
zcx_abapgit_exception,
get_transport_req_if_needed
IMPORTING
iv_package TYPE devclass
RETURNING
VALUE(rv_transport_request) TYPE trkorr
RAISING
zcx_abapgit_exception,
get_wb_object_operator
RETURNING
VALUE(ri_wb_object_operator) TYPE REF TO object
RAISING
zcx_abapgit_exception.
DATA:
mr_dependency_rule TYPE REF TO data,
mv_dependency_rule_key TYPE seu_objkey,
mi_persistence TYPE REF TO if_wb_object_persist,
mi_wb_object_operator TYPE REF TO object.
ENDCLASS.
CLASS zcl_abapgit_object_drul IMPLEMENTATION.
METHOD constructor.
super->constructor(
is_item = is_item
iv_language = iv_language ).
mv_dependency_rule_key = ms_item-obj_name.
TRY.
CREATE DATA mr_dependency_rule TYPE ('CL_DRUL_WB_OBJECT_DATA=>TY_OBJECT_DATA').
CREATE OBJECT mi_persistence TYPE ('CL_DRUL_WB_OBJECT_PERSIST').
CATCH cx_sy_create_error.
zcx_abapgit_exception=>raise( |DRUL not supported by your NW release| ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
DATA:
li_wb_object_operator TYPE REF TO object,
li_object_data_model TYPE REF TO if_wb_object_data_model,
lx_error TYPE REF TO cx_root.
TRY.
li_wb_object_operator = get_wb_object_operator( ).
CALL METHOD li_object_data_model->('IF_WB_OBJECT_OPERATOR~READ')
IMPORTING
eo_object_data = li_object_data_model.
rv_user = li_object_data_model->get_changed_by( ).
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise(
iv_text = lx_error->get_text( )
ix_previous = lx_error ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA:
lx_error TYPE REF TO cx_root,
lv_transport_request TYPE trkorr,
li_wb_object_operator TYPE REF TO object.
lv_transport_request = get_transport_req_if_needed( iv_package ).
li_wb_object_operator = get_wb_object_operator( ).
TRY.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~DELETE')
EXPORTING
transport_request = lv_transport_request.
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise(
iv_text = lx_error->get_text( )
ix_previous = lx_error ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA:
li_object_data_model TYPE REF TO if_wb_object_data_model,
li_wb_object_operator TYPE REF TO object,
lx_error TYPE REF TO cx_root,
lv_transport_request TYPE trkorr.
FIELD-SYMBOLS:
<ls_dependency_rule> TYPE any,
<lv_source> TYPE data.
ASSIGN mr_dependency_rule->* TO <ls_dependency_rule>.
ASSERT sy-subrc = 0.
io_xml->read(
EXPORTING
iv_name = 'DRUL'
CHANGING
cg_data = <ls_dependency_rule> ).
li_wb_object_operator = get_wb_object_operator( ).
TRY.
CREATE OBJECT li_object_data_model TYPE ('CL_DRUL_WB_OBJECT_DATA').
ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_dependency_rule>
TO <lv_source>.
ASSERT sy-subrc = 0.
<lv_source> = mo_files->read_string( 'asdrul' ).
tadir_insert( iv_package ).
lv_transport_request = get_transport_req_if_needed( iv_package ).
IF zif_abapgit_object~exists( ) = abap_true.
" We need to populate created_at, created_by, because otherwise update is not possible
fill_metadata_from_db( CHANGING cs_dependency_rule = <ls_dependency_rule> ).
li_object_data_model->set_data( <ls_dependency_rule> ).
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
EXPORTING
io_object_data = li_object_data_model
transport_request = lv_transport_request.
ELSE.
li_object_data_model->set_data( <ls_dependency_rule> ).
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~CREATE')
EXPORTING
io_object_data = li_object_data_model
data_selection = 'P' " if_wb_object_data_selection_co=>c_properties
package = iv_package
transport_request = lv_transport_request.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
EXPORTING
io_object_data = li_object_data_model
data_selection = 'D' " if_wb_object_data_selection_co=>c_data_content
transport_request = lv_transport_request.
ENDIF.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~ACTIVATE').
corr_insert( iv_package ).
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise(
iv_text = lx_error->get_text( )
ix_previous = lx_error ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
TRY.
mi_persistence->get(
p_object_key = mv_dependency_rule_key
p_version = 'A'
p_existence_check_only = abap_true ).
rv_bool = abap_true.
CATCH cx_swb_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-ddic TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-ddic = abap_true.
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESWB_EO'
iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW'
object_name = ms_item-obj_name
object_type = ms_item-obj_type
in_new_window = abap_true
EXCEPTIONS
not_executed = 1
invalid_object_type = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |RC={ sy-subrc } from RS_TOOL_ACCESS| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA:
li_wb_object_operator TYPE REF TO object,
li_object_data_model TYPE REF TO if_wb_object_data_model,
lx_error TYPE REF TO cx_root,
lv_source TYPE string.
FIELD-SYMBOLS:
<ls_dependency_rule> TYPE any,
<lv_source> TYPE string.
ASSIGN mr_dependency_rule->* TO <ls_dependency_rule>.
ASSERT sy-subrc = 0.
li_wb_object_operator = get_wb_object_operator( ).
TRY.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ')
EXPORTING
version = 'A'
IMPORTING
data = <ls_dependency_rule>
eo_object_data = li_object_data_model.
ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_dependency_rule>
TO <lv_source>.
ASSERT sy-subrc = 0.
lv_source = <lv_source>.
clear_fields( CHANGING cs_dependency_rule = <ls_dependency_rule> ).
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise(
iv_text = lx_error->get_text( )
ix_previous = lx_error ).
ENDTRY.
io_xml->add(
iv_name = 'DRUL'
ig_data = <ls_dependency_rule> ).
mo_files->add_string(
iv_ext = 'asdrul'
iv_string = lv_source ).
ENDMETHOD.
METHOD fill_metadata_from_db.
DATA:
li_wb_object_operator TYPE REF TO object,
lr_dependency_rule_old TYPE REF TO data.
FIELD-SYMBOLS:
<ls_dependency_rule_old> TYPE any,
<lv_created_at> TYPE xsddatetime_z,
<lv_created_by> TYPE syuname,
<lv_created_at_old> TYPE xsddatetime_z,
<lv_created_by_old> TYPE syuname.
li_wb_object_operator = get_wb_object_operator( ).
CREATE DATA lr_dependency_rule_old TYPE ('CL_DRUL_WB_OBJECT_DATA=>TY_OBJECT_DATA').
ASSIGN lr_dependency_rule_old->* TO <ls_dependency_rule_old>.
ASSERT sy-subrc = 0.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ')
IMPORTING
data = <ls_dependency_rule_old>.
ASSIGN COMPONENT 'METADATA-CREATED_BY' OF STRUCTURE cs_dependency_rule
TO <lv_created_by>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'METADATA-CREATED_AT' OF STRUCTURE cs_dependency_rule
TO <lv_created_at>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'METADATA-CREATED_BY' OF STRUCTURE <ls_dependency_rule_old>
TO <lv_created_by_old>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'METADATA-CREATED_AT' OF STRUCTURE <ls_dependency_rule_old>
TO <lv_created_at_old>.
ASSERT sy-subrc = 0.
<lv_created_at> = <lv_created_at_old>.
<lv_created_by> = <lv_created_by_old>.
ENDMETHOD.
METHOD get_transport_req_if_needed.
DATA: li_sap_package TYPE REF TO zif_abapgit_sap_package.
li_sap_package = zcl_abapgit_factory=>get_sap_package( iv_package ).
IF li_sap_package->are_changes_recorded_in_tr_req( ) = abap_true.
rv_transport_request = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum.
ENDIF.
ENDMETHOD.
METHOD get_wb_object_operator.
DATA:
ls_object_type TYPE wbobjtype,
lx_error TYPE REF TO cx_root.
IF mi_wb_object_operator IS BOUND.
ri_wb_object_operator = mi_wb_object_operator.
ENDIF.
ls_object_type-objtype_tr = 'DRUL'.
ls_object_type-subtype_wb = 'DRL'.
TRY.
CALL METHOD ('CL_WB_OBJECT_OPERATOR')=>('CREATE_INSTANCE')
EXPORTING
object_type = ls_object_type
object_key = mv_dependency_rule_key
RECEIVING
result = mi_wb_object_operator.
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise(
iv_text = lx_error->get_text( )
ix_previous = lx_error ).
ENDTRY.
ri_wb_object_operator = mi_wb_object_operator.
ENDMETHOD.
METHOD clear_field.
FIELD-SYMBOLS: <lv_value> TYPE data.
ASSIGN COMPONENT iv_fieldname OF STRUCTURE cs_dependency_rule
TO <lv_value>.
ASSERT sy-subrc = 0.
CLEAR: <lv_value>.
ENDMETHOD.
METHOD clear_fields.
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CREATED_AT'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CREATED_BY'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CHANGED_AT'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CHANGED_BY'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-MASTER_LANGUAGE'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-RESPONSIBLE'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-PACKAGE_REF'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
clear_field(
EXPORTING
iv_fieldname = 'CONTENT-SOURCE'
CHANGING
cs_dependency_rule = cs_dependency_rule ).
ENDMETHOD.
ENDCLASS.
| 26.82563 | 106 | 0.649855 |
35d0c24cf5b07de9f39a91b26e09bffc2d144c4e
| 1,325 |
abap
|
ABAP
|
src/zdbg_script.fugr.lzdbg_scriptcx1.abap
|
alaible/dbg_value_statement
|
b28f7292be763f01bc231ddd9a9ff3b6aa845230
|
[
"MIT"
] | 1 |
2022-01-12T06:45:24.000Z
|
2022-01-12T06:45:24.000Z
|
src/zdbg_script.fugr.lzdbg_scriptcx1.abap
|
alaible/dbg_value_statement
|
b28f7292be763f01bc231ddd9a9ff3b6aa845230
|
[
"MIT"
] | 2 |
2022-01-12T06:40:57.000Z
|
2022-01-14T07:29:51.000Z
|
src/zdbg_script.fugr.lzdbg_scriptcx1.abap
|
alaible/dbg_value_statement
|
b28f7292be763f01bc231ddd9a9ff3b6aa845230
|
[
"MIT"
] | null | null | null |
*&---------------------------------------------------------------------*
*& Include LZDBG_SCRIPTCX1
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
CLASS lcx_screen_error DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES:
if_t100_message,
if_t100_dyn_msg.
ENDCLASS.
*----------------------------------------------------------------------*
CLASS lcx_tree_error DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES:
if_t100_message,
if_t100_dyn_msg.
ENDCLASS.
*----------------------------------------------------------------------*
CLASS lcx_ctrl_error DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES:
if_t100_message,
if_t100_dyn_msg.
ENDCLASS.
*----------------------------------------------------------------------*
CLASS lcx_vrm_value DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES:
if_t100_message,
if_t100_dyn_msg.
ENDCLASS.
*----------------------------------------------------------------------*
CLASS lcx_no_value_set DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES:
if_t100_message,
if_t100_dyn_msg.
ENDCLASS.
| 33.974359 | 72 | 0.467925 |
35d1d06a322219a36370e420f3d9a33084169cd7
| 1,224 |
abap
|
ABAP
|
src/ui/zcl_abapgit_gui_page_syntax.clas.abap
|
JohannesKonings/abapGit
|
8b1cbd4b89bb43eb987e28766145e764762aa12d
|
[
"MIT"
] | null | null | null |
src/ui/zcl_abapgit_gui_page_syntax.clas.abap
|
JohannesKonings/abapGit
|
8b1cbd4b89bb43eb987e28766145e764762aa12d
|
[
"MIT"
] | null | null | null |
src/ui/zcl_abapgit_gui_page_syntax.clas.abap
|
JohannesKonings/abapGit
|
8b1cbd4b89bb43eb987e28766145e764762aa12d
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_gui_page_syntax DEFINITION PUBLIC FINAL CREATE PUBLIC
INHERITING FROM zcl_abapgit_gui_page_codi_base.
PUBLIC SECTION.
INTERFACES: zif_abapgit_gui_page_hotkey.
METHODS:
constructor
IMPORTING io_repo TYPE REF TO zcl_abapgit_repo.
PROTECTED SECTION.
METHODS:
render_content REDEFINITION.
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_SYNTAX IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
ms_control-page_title = 'SYNTAX CHECK'.
mo_repo = io_repo.
ENDMETHOD.
METHOD render_content.
DATA: li_syntax_check TYPE REF TO zif_abapgit_code_inspector.
FIELD-SYMBOLS: <ls_result> LIKE LINE OF mt_result.
li_syntax_check = zcl_abapgit_factory=>get_syntax_check( mo_repo->get_package( ) ).
mt_result = li_syntax_check->run( ).
CREATE OBJECT ro_html.
ro_html->add( '<div class="toc">' ).
IF lines( mt_result ) = 0.
ro_html->add( 'No errors' ).
ENDIF.
LOOP AT mt_result ASSIGNING <ls_result>.
render_result( ro_html = ro_html iv_result = <ls_result> ).
ENDLOOP.
ro_html->add( '</div>' ).
ENDMETHOD.
METHOD zif_abapgit_gui_page_hotkey~get_hotkey_actions.
ENDMETHOD.
ENDCLASS.
| 20.745763 | 87 | 0.712418 |
35d1d1026f6dadd8b3be25651f908804f17b49d4
| 1,929 |
abap
|
ABAP
|
src/zcl_excel_converter.clas.locals_def.abap
|
rotda/abap2xlsx
|
45e11a380943c425a5c8b350e2e506ec3fd46d9c
|
[
"Apache-2.0"
] | 1 |
2021-04-30T19:32:09.000Z
|
2021-04-30T19:32:09.000Z
|
src/zcl_excel_converter.clas.locals_def.abap
|
rotda/abap2xlsx
|
45e11a380943c425a5c8b350e2e506ec3fd46d9c
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_excel_converter.clas.locals_def.abap
|
rotda/abap2xlsx
|
45e11a380943c425a5c8b350e2e506ec3fd46d9c
|
[
"Apache-2.0"
] | null | null | null |
*"* use this source file for any type declarations (class
*"* definitions, interfaces or data types) you need for method
*"* implementation or private method's signature
TYPES: BEGIN OF ts_alv_types,
seoclass TYPE seoclsname,
clsname TYPE seoclsname,
END OF ts_alv_types,
tt_alv_types TYPE HASHED TABLE OF ts_alv_types WITH UNIQUE KEY seoclass.
TYPES: BEGIN OF ts_sort_values,
fieldname TYPE fieldname,
row_int TYPE zexcel_cell_row,
value TYPE REF TO data,
new TYPE flag,
sort_level TYPE int4,
is_collapsed type flag,
END OF ts_sort_values,
tt_sort_values TYPE HASHED TABLE OF ts_sort_values WITH UNIQUE KEY fieldname.
TYPES: BEGIN OF ts_subtotal_rows,
row_int TYPE zexcel_cell_row,
row_int_start TYPE zexcel_cell_row,
columnname TYPE fieldname,
END OF ts_subtotal_rows,
tt_subtotal_rows TYPE HASHED TABLE OF ts_subtotal_rows WITH UNIQUE KEY row_int.
TYPES: BEGIN OF ts_styles,
type TYPE char1,
alignment TYPE zexcel_alignment,
inttype TYPE inttype,
decimals TYPE int1,
style TYPE REF TO zcl_excel_style,
guid TYPE zexcel_cell_style,
END OF ts_styles,
tt_styles TYPE HASHED TABLE OF ts_styles WITH UNIQUE KEY type alignment inttype decimals.
TYPES: BEGIN OF ts_color_styles,
guid_old TYPE zexcel_cell_style,
fontcolor TYPE zexcel_style_color_argb,
fillcolor TYPE zexcel_style_color_argb,
style_new TYPE REF TO zcl_excel_style,
END OF ts_color_styles,
tt_color_styles TYPE HASHED TABLE OF ts_color_styles WITH UNIQUE KEY guid_old fontcolor fillcolor.
| 40.1875 | 108 | 0.627786 |
35d33fbf7884c6d7f24d728f9ce53a1ed0445c5e
| 8,291 |
abap
|
ABAP
|
src/checks/zcl_aoc_check_70.clas.abap
|
FranciscoJJ/abapOpenChecks
|
0bd2443a0e47a27dce104a86ec6161c62c6707fd
|
[
"MIT"
] | 1 |
2019-06-05T13:02:40.000Z
|
2019-06-05T13:02:40.000Z
|
src/checks/zcl_aoc_check_70.clas.abap
|
FranciscoJJ/abapOpenChecks
|
0bd2443a0e47a27dce104a86ec6161c62c6707fd
|
[
"MIT"
] | null | null | null |
src/checks/zcl_aoc_check_70.clas.abap
|
FranciscoJJ/abapOpenChecks
|
0bd2443a0e47a27dce104a86ec6161c62c6707fd
|
[
"MIT"
] | null | null | null |
CLASS zcl_aoc_check_70 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.
DATA mt_pattern_info TYPE sci_t_regular_expressions .
DATA mt_pattern_warning TYPE sci_t_regular_expressions .
DATA mt_pattern_error TYPE sci_t_regular_expressions .
DATA mv_multiline TYPE sap_bool .
PRIVATE SECTION.
METHODS get_comment_tokens
IMPORTING
!it_tokens TYPE stokesx_tab
RETURNING
VALUE(rt_comments) TYPE stokesx_tab .
METHODS get_plain_text_comment
IMPORTING
!it_comments TYPE stokesx_tab
RETURNING
VALUE(rt_comment_texts) TYPE stringtab .
METHODS get_tokens
IMPORTING
!it_tokens TYPE stokesx_tab
!it_statements TYPE sstmnt_tab
!iv_level TYPE i
RETURNING
VALUE(rt_tokens) TYPE stokesx_tab .
METHODS parse
IMPORTING
!it_comments TYPE stokesx_tab
!it_comment_texts TYPE stringtab
!is_level TYPE slevel
!iv_error_type TYPE sci_errty
!iv_pattern TYPE clike .
ENDCLASS.
CLASS ZCL_AOC_CHECK_70 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA:
lt_comment_texts TYPE stringtab,
lt_comments TYPE stokesx_tab,
lt_tokens TYPE stokesx_tab.
FIELD-SYMBOLS:
<ls_level> LIKE LINE OF it_levels,
<lv_pattern> LIKE LINE OF mt_pattern_info.
IF mt_pattern_info IS INITIAL AND mt_pattern_warning IS INITIAL AND mt_pattern_error IS INITIAL.
RETURN.
ENDIF.
LOOP AT it_levels ASSIGNING <ls_level> WHERE type = scan_level_type-program.
CLEAR:
lt_comment_texts,
lt_comments,
lt_tokens.
lt_tokens = get_tokens( it_tokens = it_tokens
it_statements = it_statements
iv_level = sy-tabix ).
lt_comments = get_comment_tokens( lt_tokens ).
IF lt_comments IS INITIAL.
CONTINUE.
ENDIF.
"get plain text from comments
lt_comment_texts = get_plain_text_comment( lt_comments ).
LOOP AT mt_pattern_info ASSIGNING <lv_pattern>.
parse( it_comments = lt_comments
it_comment_texts = lt_comment_texts
is_level = <ls_level>
iv_pattern = <lv_pattern>
iv_error_type = c_note ).
ENDLOOP.
LOOP AT mt_pattern_warning ASSIGNING <lv_pattern>.
parse( it_comments = lt_comments
it_comment_texts = lt_comment_texts
is_level = <ls_level>
iv_pattern = <lv_pattern>
iv_error_type = c_warning ).
ENDLOOP.
LOOP AT mt_pattern_error ASSIGNING <lv_pattern>.
parse( it_comments = lt_comments
it_comment_texts = lt_comment_texts
is_level = <ls_level>
iv_pattern = <lv_pattern>
iv_error_type = c_error ).
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
DATA ls_scimessage TYPE scimessage.
super->constructor( ).
version = '001'.
position = '070'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
APPEND '^TODO' TO mt_pattern_info.
APPEND '^HACK' TO mt_pattern_warning.
APPEND '^FIXME' TO mt_pattern_error.
mv_multiline = abap_false.
ls_scimessage-test = myname.
ls_scimessage-code = '001'.
ls_scimessage-kind = c_error.
ls_scimessage-text = 'Found a suspicious comment: &1'(m01).
ls_scimessage-pcom = ''.
ls_scimessage-pcom_alt = ''.
INSERT ls_scimessage INTO TABLE scimessages.
ENDMETHOD. "CONSTRUCTOR
METHOD get_attributes.
EXPORT
mv_multiline = mv_multiline
mt_pattern_info = mt_pattern_info
mt_pattern_warning = mt_pattern_warning
mt_pattern_error = mt_pattern_error
TO DATA BUFFER p_attributes.
ENDMETHOD.
METHOD get_comment_tokens.
FIELD-SYMBOLS: <ls_token> LIKE LINE OF it_tokens.
"only meaningful comments
LOOP AT it_tokens ASSIGNING <ls_token> WHERE type = scan_token_type-comment AND str CN '*"-&'.
APPEND <ls_token> TO rt_comments.
ENDLOOP.
ENDMETHOD.
METHOD get_plain_text_comment.
FIELD-SYMBOLS:
<lv_comment_text> LIKE LINE OF rt_comment_texts,
<ls_comment> LIKE LINE OF it_comments.
"get plain text from comments
LOOP AT it_comments ASSIGNING <ls_comment>.
APPEND INITIAL LINE TO rt_comment_texts ASSIGNING <lv_comment_text>.
<lv_comment_text> = <ls_comment>-str.
SHIFT <lv_comment_text> LEFT DELETING LEADING '*"-&'.
CONDENSE <lv_comment_text>.
ENDLOOP.
ENDMETHOD.
METHOD get_tokens.
FIELD-SYMBOLS:
<ls_token> LIKE LINE OF it_tokens,
<ls_statement> LIKE LINE OF it_statements.
LOOP AT it_statements ASSIGNING <ls_statement> WHERE level = iv_level.
LOOP AT it_tokens ASSIGNING <ls_token> FROM <ls_statement>-from TO <ls_statement>-to.
APPEND <ls_token> TO rt_tokens.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD if_ci_test~query_attributes.
zzaoc_top.
zzaoc_fill_att mt_pattern_info 'Info regex'(001) ''.
zzaoc_fill_att mt_pattern_warning 'Warning regex'(002) ''.
zzaoc_fill_att mt_pattern_error 'Error regex'(003) ''.
zzaoc_fill_att mv_multiline 'Multiline comments'(004) 'C'.
zzaoc_popup.
IF mt_pattern_info IS NOT INITIAL OR mt_pattern_warning IS NOT INITIAL OR mt_pattern_error IS NOT INITIAL.
attributes_ok = abap_true.
ELSE.
attributes_ok = abap_false.
ENDIF.
ENDMETHOD.
METHOD parse.
DATA:
lv_complete_text TYPE string,
lt_result TYPE match_result_tab.
FIELD-SYMBOLS:
<lv_comment_text> LIKE LINE OF it_comment_texts,
<ls_comment> LIKE LINE OF it_comments,
<ls_result> LIKE LINE OF lt_result.
IF iv_pattern IS INITIAL.
RETURN.
ENDIF.
FIND ALL OCCURRENCES OF REGEX iv_pattern IN TABLE it_comment_texts
IGNORING CASE
RESULTS lt_result.
IF lt_result IS INITIAL.
RETURN.
ENDIF.
LOOP AT lt_result ASSIGNING <ls_result>.
READ TABLE it_comments ASSIGNING <ls_comment> INDEX <ls_result>-line.
IF sy-subrc = 0.
READ TABLE it_comment_texts ASSIGNING <lv_comment_text> INDEX sy-tabix.
IF sy-subrc = 0.
lv_complete_text = <lv_comment_text>.
IF mv_multiline = abap_true.
"Append consecutive comment lines
WHILE sy-subrc = 0.
READ TABLE it_comments ASSIGNING <ls_comment> WITH KEY row = <ls_comment>-row + 1.
IF sy-subrc <> 0.
EXIT.
ENDIF.
READ TABLE it_comment_texts ASSIGNING <lv_comment_text> INDEX sy-tabix.
IF sy-subrc <> 0.
EXIT.
ENDIF.
CONCATENATE lv_complete_text <lv_comment_text> INTO lv_complete_text SEPARATED BY space.
ENDWHILE.
ENDIF.
inform(
p_sub_obj_type = c_type_include
p_sub_obj_name = is_level-name
p_line = <ls_comment>-row
p_column = <ls_comment>-col
p_kind = iv_error_type
p_test = myname
p_code = '001'
p_param_1 = lv_complete_text ).
UNASSIGN <lv_comment_text>.
ENDIF.
UNASSIGN <ls_comment>.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD put_attributes.
IMPORT
mv_multiline = mv_multiline
mt_pattern_info = mt_pattern_info
mt_pattern_warning = mt_pattern_warning
mt_pattern_error = mt_pattern_error
FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED
ASSERT sy-subrc = 0.
ENDMETHOD.
ENDCLASS.
| 28.010135 | 110 | 0.632372 |
35d57128facf4fc97f6b862690e07dd372aa4852
| 20,257 |
abap
|
ABAP
|
src/zfbi_view_search.prog.abap
|
boy0korea/ZFPM_TOOLS
|
9a480054b9f355e5cccb393c9ebe834fa5336633
|
[
"MIT"
] | null | null | null |
src/zfbi_view_search.prog.abap
|
boy0korea/ZFPM_TOOLS
|
9a480054b9f355e5cccb393c9ebe834fa5336633
|
[
"MIT"
] | null | null | null |
src/zfbi_view_search.prog.abap
|
boy0korea/ZFPM_TOOLS
|
9a480054b9f355e5cccb393c9ebe834fa5336633
|
[
"MIT"
] | null | null | null |
* https://github.com/boy0korea/ZFPM_TOOLS
REPORT zfbi_view_search.
TABLES: wdy_md_change_information, /bofu/lfbiv_map, /bofu/s_fbiv_hdr.
**********************************************************************
* SCREEN
**********************************************************************
SELECT-OPTIONS: so_view FOR /bofu/lfbiv_map-view_name,
so_cr_by FOR wdy_md_change_information-author,
so_cr_on FOR wdy_md_change_information-createdon,
so_ch_by FOR wdy_md_change_information-changedby,
so_ch_on FOR wdy_md_change_information-changedon,
so_bo FOR /bofu/s_fbiv_hdr-bo,
so_node FOR /bofu/s_fbiv_hdr-node,
so_ui_st FOR /bofu/s_fbiv_hdr-ui_structure,
so_mapp FOR /bofu/s_fbiv_hdr-ui_mapper_cls,
so_exit FOR /bofu/s_fbiv_hdr-ui_exit_intf_cls.
**********************************************************************
START-OF-SELECTION.
**********************************************************************
PERFORM execute.
**********************************************************************
* global variable
**********************************************************************
TYPES: BEGIN OF ts_outtab.
INCLUDE TYPE /bofu/s_fbiv_hdr.
INCLUDE TYPE wdy_md_change_information.
TYPES: style TYPE lvc_t_styl,
END OF ts_outtab.
DATA: gt_outtab TYPE TABLE OF ts_outtab,
gt_outtab_old TYPE TABLE OF ts_outtab,
gv_edit_mode TYPE flag,
gv_alv_first_time TYPE flag.
**********************************************************************
* form
**********************************************************************
FORM execute.
DATA: lt_wdy_config_data TYPE TABLE OF wdy_config_data,
ls_wdy_config_data TYPE wdy_config_data,
lv_xstring TYPE xstring,
ls_outtab TYPE ts_outtab,
lt_fieldcat_lvc TYPE lvc_t_fcat,
ls_fieldcat_lvc TYPE lvc_s_fcat,
ls_layout_lvc TYPE lvc_s_layo,
lt_excluding TYPE slis_t_extab,
ls_exit_by_user TYPE slis_exit_by_user.
FIELD-SYMBOLS: <ls_fieldcat_lvc> TYPE lvc_s_fcat.
AUTHORITY-CHECK OBJECT 'S_DEVELOP' ID 'ACTVT' FIELD '02'.
IF sy-subrc EQ 0.
gv_edit_mode = abap_true.
ELSE.
gv_edit_mode = abap_false.
APPEND VALUE #( fcode = 'SAVE' ) TO lt_excluding.
ENDIF.
* SELECT view_name
* INTO TABLE lt_view_name
* FROM /bofu/lfbiv_map
* WHERE view_name <> ''
* AND view_name IN so_view
* AND ui_structure IN so_ui_st.
* SORT lt_view_name.
SELECT *
INTO TABLE lt_wdy_config_data
FROM wdy_config_data
WHERE component = /bofu/if_fbi_view_types=>gc_wd_config_component
AND config_id IN so_view
AND author IN so_cr_by
AND createdon IN so_cr_on
AND changedby IN so_ch_by
AND changedon IN so_ch_on.
SORT lt_wdy_config_data BY config_id.
LOOP AT lt_wdy_config_data INTO ls_wdy_config_data.
CLEAR: ls_outtab.
ls_outtab-name = ls_wdy_config_data-config_id.
ls_outtab-author = ls_wdy_config_data-author.
ls_outtab-createdon = ls_wdy_config_data-createdon.
ls_outtab-changedby = ls_wdy_config_data-changedby.
ls_outtab-changedon = ls_wdy_config_data-changedon.
PERFORM get_header USING ls_wdy_config_data-xcontent ls_outtab.
IF so_bo IS NOT INITIAL.
CHECK: ls_outtab-bo IN so_bo.
ENDIF.
IF so_node IS NOT INITIAL.
CHECK: ls_outtab-node IN so_node.
ENDIF.
IF so_ui_st IS NOT INITIAL.
CHECK: ls_outtab-ui_structure IN so_ui_st.
ENDIF.
IF so_mapp IS NOT INITIAL.
CHECK: ls_outtab-ui_mapper_cls IN so_mapp.
ENDIF.
IF so_exit IS NOT INITIAL.
CHECK: ls_outtab-ui_exit_intf_cls IN so_exit.
ENDIF.
APPEND ls_outtab TO gt_outtab.
ENDLOOP.
CHECK: gt_outtab IS NOT INITIAL.
gt_outtab_old = gt_outtab.
ls_layout_lvc-zebra = abap_true.
ls_layout_lvc-no_rowmark = abap_true.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = '/BOFU/S_FBIV_HDR'
CHANGING
ct_fieldcat = lt_fieldcat_lvc.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'WDY_MD_CHANGE_INFORMATION'
CHANGING
ct_fieldcat = lt_fieldcat_lvc.
LOOP AT lt_fieldcat_lvc ASSIGNING <ls_fieldcat_lvc>.
<ls_fieldcat_lvc>-edit = gv_edit_mode.
CASE <ls_fieldcat_lvc>-fieldname.
WHEN 'NAME'.
<ls_fieldcat_lvc>-edit = abap_false.
<ls_fieldcat_lvc>-key = abap_true.
<ls_fieldcat_lvc>-outputlen = 32.
WHEN 'CREATED_BY'
OR 'CREATED_ON'
OR 'CHANGED_BY'
OR 'CHANGED_ON'.
" hide
<ls_fieldcat_lvc>-tech = abap_true.
WHEN 'AUTHOR'
OR 'CREATEDON'
OR 'CHANGEDBY'
OR 'CHANGEDON'.
<ls_fieldcat_lvc>-edit = abap_false.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* i_interface_check = space " Interface consistency check log output
* i_bypassing_buffer = i_bypassing_buffer " Skip All Buffers?
* i_buffer_active = i_buffer_active " Buffer active
i_callback_program = sy-repid " Name of the calling program
i_callback_pf_status_set = 'EDIT_PF_STATUS_SET' " Set EXIT routine to status
i_callback_user_command = 'EDIT_USER_COMMAND' " EXIT routine for command handling
* i_callback_top_of_page = space " EXIT routine for handling TOP-OF-PAGE
* i_callback_html_top_of_page = space " EXIT routine for HTML TOP-OF-PAGE
* i_callback_html_end_of_list = space " EXIT routine for HTML END-OF-LIST
* i_structure_name = i_structure_name " Internal Output Table Structure Name
* i_background_id = i_background_id " Object ID of wallpaper
* i_grid_title = i_grid_title " Control title
* i_grid_settings = i_grid_settings " Grid settings
is_layout_lvc = ls_layout_lvc " List Layout Specifications
it_fieldcat_lvc = lt_fieldcat_lvc " Field Catalog with Field Descriptions
it_excluding = lt_excluding " Table of inactive function codes
* it_special_groups_lvc = it_special_groups_lvc " Grouping fields for column selection
* it_sort_lvc = it_sort_lvc " Sort criteria for first list display
* it_filter_lvc = it_filter_lvc " Filter criteria for first list output
* it_hyperlink = it_hyperlink " Hyperlinks
* is_sel_hide = is_sel_hide " Selection information modification
* i_default = 'X' " Initial variant active/inactive logic
* i_save = space " Variants Can be Saved
* is_variant = is_variant " Variant information
* it_events = it_events " Table of events to perform
* it_event_exit = it_event_exit " Standard fcode exit requests table
* is_print_lvc = is_print_lvc " Print information
* is_reprep_id_lvc = is_reprep_id_lvc " Initialization key for Re/Re interface
* i_screen_start_column = 0 " Coordinates for list in dialog box
* i_screen_start_line = 0 " Coordinates for list in dialog box
* i_screen_end_column = 0 " Coordinates for list in dialog box
* i_screen_end_line = 0 " Coordinates for list in dialog box
* i_html_height_top = i_html_height_top
* i_html_height_end = i_html_height_end
* it_alv_graphics = it_alv_graphics
* it_except_qinfo_lvc = it_except_qinfo_lvc
* ir_salv_fullscreen_adapter = ir_salv_fullscreen_adapter
IMPORTING
* e_exit_caused_by_caller = e_exit_caused_by_caller " Delete list in CALLBACK_USER_COMMAND
es_exit_caused_by_user = ls_exit_by_user " How the user left the list
TABLES
t_outtab = gt_outtab " Table with data to be displayed
EXCEPTIONS
program_error = 1 " Program Errors
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR: gt_outtab, gt_outtab_old.
ENDFORM.
FORM get_header USING iv_xstring TYPE xstring cs_header TYPE data.
DATA: lt_expl TYPE wdy_cfg_expl_data_tab,
ls_expl_attr TYPE wdy_cfg_expl_attribute,
lv_string TYPE string,
lv_offset TYPE i,
lv_offset2 TYPE i,
lv_length TYPE i.
FIELD-SYMBOLS: <lv_data> TYPE data.
lv_string = cl_wdr_configuration_utils=>xml_xstring2string( in_xstring = iv_xstring ).
FIND '<Node Name="HEADER"' IN lv_string MATCH OFFSET lv_offset.
CHECK: sy-subrc EQ 0.
FIND '>' IN SECTION OFFSET lv_offset OF lv_string MATCH OFFSET lv_offset2.
lv_offset2 = lv_offset2 - 1.
IF lv_string+lv_offset2(1) EQ '/'.
lv_offset2 = lv_offset2 + 2.
ELSE.
FIND '</Node>' IN SECTION OFFSET lv_offset2 OF lv_string MATCH OFFSET lv_offset2.
lv_offset2 = lv_offset2 + 7.
ENDIF.
lv_length = lv_offset2 - lv_offset.
lv_string = `<Component>` && lv_string+lv_offset(lv_length) && `</Component>`.
CALL TRANSFORMATION wdr_cfg_comp_transl SOURCE XML lv_string RESULT table = lt_expl.
LOOP AT lt_expl[ 2 ]-attr_list INTO ls_expl_attr.
ASSIGN COMPONENT ls_expl_attr-name OF STRUCTURE cs_header TO <lv_data>.
IF sy-subrc EQ 0.
<lv_data> = ls_expl_attr-value.
ENDIF.
ENDLOOP.
ENDFORM.
FORM set_header USING cv_xstring TYPE xstring is_header TYPE data.
DATA: lt_expl TYPE wdy_cfg_expl_data_tab,
ls_expl TYPE wdy_cfg_expl_data,
ls_expl_attr TYPE wdy_cfg_expl_attribute,
ls_header TYPE /bofu/s_fbiv_hdr_data,
lo_rtti TYPE REF TO cl_abap_structdescr,
ls_comp TYPE abap_compdescr,
lv_header_xml TYPE string,
lo_document TYPE REF TO if_ixml_document,
lo_root_element TYPE REF TO if_ixml_element,
lv_string TYPE string,
lv_offset TYPE i,
lv_offset2 TYPE i,
lv_length TYPE i.
FIELD-SYMBOLS: <lv_data> TYPE data.
MOVE-CORRESPONDING is_header TO ls_header.
lo_rtti ?= cl_abap_structdescr=>describe_by_data( ls_header ).
CLEAR: ls_expl.
ls_expl-simple_format = abap_true.
ls_expl-path = '.HEADER'.
ls_expl-parent_path = 'HEADER'.
APPEND ls_expl TO lt_expl.
CLEAR: ls_expl.
ls_expl-simple_format = abap_true.
ls_expl-path = '.HEADER.000001'.
ls_expl-parent_path = '.HEADER'.
ls_expl-node_name = 'HEADER'.
ls_expl-index = '000001'.
LOOP AT lo_rtti->components INTO ls_comp.
ASSIGN COMPONENT ls_comp-name OF STRUCTURE ls_header TO <lv_data>.
IF <lv_data> IS NOT INITIAL.
ls_expl_attr-name = ls_comp-name.
ls_expl_attr-value = <lv_data>.
APPEND ls_expl_attr TO ls_expl-attr_list.
ENDIF.
ENDLOOP.
APPEND ls_expl TO lt_expl.
lo_document = cl_ixml=>create( )->create_document( ).
lo_root_element = lo_document->create_element( name = if_wdr_cfg_constants=>c_xml_tag-e_component ).
lo_document->append_child( lo_root_element ).
cl_wdr_cfg_persistence_utils=>add_comp_expl_data_to_xml(
EXPORTING
expl_data_tab = lt_expl
root = lo_root_element
document = lo_document
).
lv_header_xml = cl_wdr_configuration_utils=>xml_dom2string( in_dom = lo_document ).
* CATCH cx_wd_configuration. " Exception Class for WD Configuration
FIND '<Node Name="HEADER"' IN lv_header_xml MATCH OFFSET lv_offset.
lv_header_xml = lv_header_xml+lv_offset.
lv_length = strlen( lv_header_xml ) - 12. " </Component>
lv_header_xml = lv_header_xml(lv_length).
lv_string = cl_wdr_configuration_utils=>xml_xstring2string( in_xstring = cv_xstring ).
FIND '<Node Name="HEADER"' IN lv_string MATCH OFFSET lv_offset.
CHECK: sy-subrc EQ 0.
FIND '>' IN SECTION OFFSET lv_offset OF lv_string MATCH OFFSET lv_offset2.
lv_offset2 = lv_offset2 - 1.
IF lv_string+lv_offset2(1) EQ '/'.
lv_offset2 = lv_offset2 + 2.
ELSE.
FIND '</Node>' IN SECTION OFFSET lv_offset2 OF lv_string MATCH OFFSET lv_offset2.
lv_offset2 = lv_offset2 + 7.
ENDIF.
lv_string = lv_string(lv_offset)
&& lv_header_xml
&& lv_string+lv_offset2.
cv_xstring = cl_wdr_configuration_utils=>xml_string2xstring( in_string = lv_string ).
* cl_wdr_cfg_persistence_utils=>save_comp_config_to_db(
* EXPORTING
* config_data = ls_wdcc
* translator = lo_translator
* ).
ENDFORM.
FORM edit_pf_status_set USING ps_extab TYPE slis_t_extab.
SET PF-STATUS 'EDIT' EXCLUDING ps_extab.
ENDFORM.
FORM edit_user_command USING pv_ucomm ps_select TYPE slis_selfield.
DATA: ls_outtab TYPE ts_outtab.
CASE pv_ucomm.
WHEN '&IC1'. "this is for double click on alv output.
*NAME 1 Types /BOFU/FBI_VIEW CHAR 50 0 0 FBI View
*BO 1 Types /BOFU/BO CHAR 30 0 0 Business Object
*NODE 1 Types /BOFU/NODE CHAR 30 0 0 Node
*UI_STRUCTURE 1 Types /BOFU/FBI_NODE_UI_STRUCT CHAR 30 0 0 Node UI Structure
*UI_MAPPER_CLS 1 Types /BOFU/FBI_NODE_UI_MAPPER CHAR 30 0 0 UI Mapper Class for Business Object Node
*UI_EXIT_INTF_CLS 1 Types /BOFU/FBI_NODE_EXIT_INTF CHAR 30 0 0 Exit Interface Class for Business Object Node
*TECH_FLD_STR 1 Types /BOFU/FBI_TECH_FLD_STRUCT CHAR 30 0 0 Technical Fields Structure for field control
*OUTPUT_STR 1 Types /BOFU/FBI_OUTPUT_STRUCT CHAR 30 0 0 Output Structure (Data+TechFields+RelatedView Structs)
CASE ps_select-fieldname.
WHEN 'NAME'.
PERFORM do_web_cfg USING ps_select-value.
WHEN 'UI_MAPPER_CLS'
OR 'UI_EXIT_INTF_CLS'.
PERFORM do_class USING ps_select-value.
WHEN 'UI_STRUCTURE'
OR 'TECH_FLD_STR'
OR 'OUTPUT_STR'.
PERFORM do_structure USING ps_select-value.
ENDCASE.
WHEN 'XML'.
CHECK: ps_select-tabindex > 0.
READ TABLE gt_outtab INTO ls_outtab INDEX ps_select-tabindex.
PERFORM do_xml_wdcc USING ls_outtab-name.
WHEN 'WEB_CFG'.
CHECK: ps_select-tabindex > 0.
READ TABLE gt_outtab INTO ls_outtab INDEX ps_select-tabindex.
PERFORM do_web_cfg USING ls_outtab-name.
WHEN 'SE80'.
CHECK: ps_select-tabindex > 0.
READ TABLE gt_outtab INTO ls_outtab INDEX ps_select-tabindex.
PERFORM do_se80 USING ls_outtab-name.
WHEN 'SAVE'.
PERFORM flush_alv.
PERFORM do_save_edit.
ENDCASE.
ENDFORM.
FORM do_xml_wdcc USING iv_wdcc.
SUBMIT zfpm_tools_xml_edit WITH pr_wdcc = abap_true WITH pa_wdcc = iv_wdcc WITH p_edit = gv_edit_mode AND RETURN.
ENDFORM.
FORM do_class USING iv_class.
DATA: lv_operation TYPE seu_action.
CHECK: iv_class IS NOT INITIAL.
IF gv_edit_mode EQ abap_true.
lv_operation = 'EDIT'.
ELSE.
lv_operation = 'SHOW'.
ENDIF.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = lv_operation " Operation
object_name = iv_class " Object Name
object_type = 'CLAS' " Object Type
EXCEPTIONS
not_executed = 1
invalid_object_type = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
FORM do_structure USING iv_structure.
DATA: lv_operation TYPE seu_action.
CHECK: iv_structure IS NOT INITIAL.
IF gv_edit_mode EQ abap_true.
lv_operation = 'EDIT'.
ELSE.
lv_operation = 'SHOW'.
ENDIF.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = lv_operation " Operation
object_name = iv_structure " Object Name
object_type = 'STRU' " Object Type
EXCEPTIONS
not_executed = 1
invalid_object_type = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM.
FORM do_se80 USING iv_wdcc.
DATA: lv_object_name TYPE char40,
ls_wdy_config_key TYPE wdy_config_key.
ls_wdy_config_key-config_id = iv_wdcc.
lv_object_name = ls_wdy_config_key.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW' " Operation
object_name = lv_object_name " Object Name
object_type = 'WDCC' " Object Type
EXCEPTIONS
not_executed = 1
invalid_object_type = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DO_SE80
FORM do_web_cfg USING iv_wdcc.
DATA: lv_application TYPE wdy_application_name,
lt_parameter TYPE tihttpnvp,
ls_parameter TYPE ihttpnvp.
lv_application = 'CONFIGURE_COMPONENT'.
CLEAR: lt_parameter, ls_parameter.
ls_parameter-name = 'COMP_NAME'.
ls_parameter-value = /bofu/if_fbi_view_types=>gc_wd_config_component.
APPEND ls_parameter TO lt_parameter.
CLEAR: ls_parameter.
ls_parameter-name = 'ACTION'.
IF gv_edit_mode EQ abap_true.
ls_parameter-value = 'CHANGE'.
ELSE.
ls_parameter-value = 'DISPLAY'.
ENDIF.
APPEND ls_parameter TO lt_parameter.
CLEAR: ls_parameter.
ls_parameter-name = 'CONFIG_ID'.
ls_parameter-value = iv_wdcc.
APPEND ls_parameter TO lt_parameter.
CLEAR: ls_parameter.
ls_parameter-name = 'CONFIG_TYPE'.
ls_parameter-value = '00'.
APPEND ls_parameter TO lt_parameter.
CLEAR: ls_parameter.
ls_parameter-name = 'CONFIG_VAR'.
ls_parameter-value = ''.
APPEND ls_parameter TO lt_parameter.
CALL FUNCTION 'WDY_EXECUTE_IN_PLACE'
EXPORTING
* protocol = protocol
* internalmode = 'X'
* smartclient = smartclient
application = lv_application
* container_name = container_name
parameters = lt_parameter
* suppress_output = suppress_output
* IMPORTING
* out_url = out_url
* CHANGING
* viewer = viewer
EXCEPTIONS
invalid_application = 1
browser_not_started = 2
action_cancelled = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DO_WEB_CFG
FORM do_save_edit.
DATA: ls_outtab_old TYPE ts_outtab,
ls_outtab_new TYPE ts_outtab,
ls_wdy_config_data TYPE wdy_config_data,
lv_index TYPE i.
IF gt_outtab EQ gt_outtab_old.
" nothing to save.
RETURN.
ENDIF.
LOOP AT gt_outtab INTO ls_outtab_new.
lv_index = sy-tabix.
READ TABLE gt_outtab_old INTO ls_outtab_old INDEX lv_index.
IF ls_outtab_new <> ls_outtab_old.
SELECT SINGLE *
INTO ls_wdy_config_data
FROM wdy_config_data
WHERE config_id = ls_outtab_new-name
AND config_type = '00'
AND config_var = ''
.
PERFORM set_header USING ls_wdy_config_data-xcontent ls_outtab_new.
ls_outtab_new-changed_by = sy-uname.
GET TIME STAMP FIELD ls_outtab_new-changed_on.
ls_outtab_new-changedby = sy-uname.
ls_outtab_new-changedon = sy-datum.
zcl_fpm_tools=>save_wdcc( is_wdcc = ls_wdy_config_data ).
ENDIF.
ENDLOOP.
gt_outtab_old = gt_outtab.
ENDFORM.
FORM flush_alv.
DATA: lo_grid TYPE REF TO cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lo_grid.
CHECK: lo_grid IS NOT INITIAL.
lo_grid->check_changed_data( ).
ENDFORM.
| 37.443623 | 115 | 0.64358 |
35d944203f897e7f5f5c226985c25bad59db0c9c
| 567 |
abap
|
ABAP
|
src/z_cl_vari_auth_p_program.clas.abap
|
striezl/VariScan
|
2dfd7f5ebf32dd07e0c5cfd59beb952ba81b7a54
|
[
"MIT"
] | 12 |
2020-12-28T08:44:13.000Z
|
2022-01-15T16:54:34.000Z
|
src/z_cl_vari_auth_p_program.clas.abap
|
striezl/VariScan
|
2dfd7f5ebf32dd07e0c5cfd59beb952ba81b7a54
|
[
"MIT"
] | 1 |
2021-02-05T17:14:21.000Z
|
2021-06-17T18:48:18.000Z
|
src/z_cl_vari_auth_p_program.clas.abap
|
striezl/VariScan
|
2dfd7f5ebf32dd07e0c5cfd59beb952ba81b7a54
|
[
"MIT"
] | 1 |
2020-12-28T10:41:59.000Z
|
2020-12-28T10:41:59.000Z
|
class Z_CL_VARI_AUTH_P_PROGRAM definition
public
final
create public .
public section.
interfaces IF_BADI_INTERFACE .
interfaces Z_IF_VARI_AUTH .
protected section.
private section.
ENDCLASS.
CLASS Z_CL_VARI_AUTH_P_PROGRAM IMPLEMENTATION.
method Z_IF_VARI_AUTH~CHECK_AUTHORITY.
ok = abap_true.
endmethod.
METHOD z_if_vari_auth~check_authority_secu.
authority-check object 'S_PROGRAM'
ID 'P_GROUP' FIELD secu
ID 'P_ACTION' FIELD 'VARIANT'.
IF sy-subrc = 0.
ok = abap_true.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 17.181818 | 46 | 0.730159 |
35da3a1d930484978356130662b10bafc8d4afec
| 2,152 |
abap
|
ABAP
|
src/utils/zcl_abapgit_time.clas.abap
|
ludecke/abapGit
|
adc155d199151e7a3623288d0221fd03076a467d
|
[
"MIT"
] | 1 |
2020-11-12T17:34:15.000Z
|
2020-11-12T17:34:15.000Z
|
src/utils/zcl_abapgit_time.clas.abap
|
ludecke/abapGit
|
adc155d199151e7a3623288d0221fd03076a467d
|
[
"MIT"
] | 1 |
2017-10-27T09:32:58.000Z
|
2017-10-27T09:32:58.000Z
|
src/utils/zcl_abapgit_time.clas.abap
|
ludecke/abapGit
|
adc155d199151e7a3623288d0221fd03076a467d
|
[
"MIT"
] | 1 |
2021-07-09T02:07:11.000Z
|
2021-07-09T02:07:11.000Z
|
CLASS zcl_abapgit_time DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES: ty_unixtime TYPE c LENGTH 16.
CLASS-METHODS get_unix
IMPORTING iv_date TYPE sy-datum DEFAULT sy-datum
iv_time TYPE sy-uzeit DEFAULT sy-uzeit
RETURNING VALUE(rv_time) TYPE ty_unixtime
RAISING zcx_abapgit_exception.
CLASS-METHODS get_utc
IMPORTING iv_unix TYPE ty_unixtime
EXPORTING ev_date TYPE sy-datum
ev_time TYPE sy-uzeit.
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS: c_epoch TYPE d VALUE '19700101'.
ENDCLASS.
CLASS zcl_abapgit_time IMPLEMENTATION.
METHOD get_unix.
DATA: lv_i TYPE i,
lv_tz TYPE tznzone,
lv_utcdiff TYPE tznutcdiff,
lv_utcsign TYPE tznutcsign.
lv_i = iv_date - c_epoch.
lv_i = lv_i * 86400.
lv_i = lv_i + iv_time.
CALL FUNCTION 'TZON_GET_OS_TIMEZONE'
IMPORTING
ef_timezone = lv_tz.
CALL FUNCTION 'TZON_GET_OFFSET'
EXPORTING
if_timezone = lv_tz
if_local_date = iv_date
if_local_time = iv_time
IMPORTING
ef_utcdiff = lv_utcdiff
ef_utcsign = lv_utcsign
EXCEPTIONS
conversion_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Timezone error' ).
ENDIF.
CASE lv_utcsign.
WHEN '+'.
lv_i = lv_i - lv_utcdiff.
WHEN '-'.
lv_i = lv_i + lv_utcdiff.
ENDCASE.
rv_time = lv_i.
CONDENSE rv_time.
rv_time+11 = lv_utcsign.
rv_time+12 = lv_utcdiff.
ENDMETHOD.
METHOD get_utc.
DATA: lv_i TYPE i,
lv_utcdiff TYPE tznutcdiff,
lv_utcsign TYPE tznutcsign.
lv_i = iv_unix(10).
lv_utcsign = iv_unix+11.
lv_utcdiff = iv_unix+12.
" GMT + time-zone
CASE lv_utcsign.
WHEN '+'.
lv_i = lv_i + lv_utcdiff.
WHEN '-'.
lv_i = lv_i - lv_utcdiff.
ENDCASE.
ev_time = lv_i MOD 86400.
lv_i = lv_i - ev_time.
lv_i = lv_i / 86400.
ev_date = lv_i + c_epoch.
ENDMETHOD.
ENDCLASS.
| 21.52 | 61 | 0.603625 |
35dd2fa508c52ad63bcd4ba51c61685974a8aefe
| 11,616 |
abap
|
ABAP
|
src/zcl_guidrasil_control_icon.clas.abap
|
christianguenter2/guidrasil
|
afb2a15c1aa7ddc3a041a4ff58b9c4f4476c0e18
|
[
"MIT"
] | null | null | null |
src/zcl_guidrasil_control_icon.clas.abap
|
christianguenter2/guidrasil
|
afb2a15c1aa7ddc3a041a4ff58b9c4f4476c0e18
|
[
"MIT"
] | null | null | null |
src/zcl_guidrasil_control_icon.clas.abap
|
christianguenter2/guidrasil
|
afb2a15c1aa7ddc3a041a4ff58b9c4f4476c0e18
|
[
"MIT"
] | null | null | null |
class ZCL_GUIDRASIL_CONTROL_ICON definition
public
inheriting from ZCL_GUIDRASIL_CONTROL_BASE
final
create public .
*"* public components of class ZCL_GUIDRASIL_CONTROL_ICON
*"* do not include other source files here!!!
public section.
class-methods CLASS_CONSTRUCTOR .
methods CONSTRUCTOR .
class-methods GET_ICON_ID
importing
!ICON_NAME type CLIKE
returning
value(ICON_ID) type ICON_D .
methods APPLY_SETTINGS
redefinition .
methods CREATE
redefinition .
methods GET_DESIGN_FUNCTIONS
redefinition .
methods LOAD_SETTINGS
redefinition .
methods PROVIDE_CONTROL_NAME
redefinition .
methods PROVIDE_TOOLBAR
redefinition .
methods RETURN_CREATION_CODE
redefinition .
methods SAVE_SETTINGS
redefinition .
methods SET_ATTRIBUTE
redefinition .
methods VIEW_ATTRIBUTES
redefinition .
methods ZIF_GUIDRASIL_FUNC_RECEIVER~ON_DROPDOWN_CLICKED
redefinition .
methods ZIF_GUIDRASIL_FUNC_RECEIVER~ON_FUNCTION_SELECTED
redefinition .
protected section.
*"* protected components of class ZCL_GUIDRASIL_CONTROL_ICON
*"* do not include other source files here!!!
data MR_CONTROL_SETTINGS type ref to ZCL_GUIDRASIL_ATTR_ICON .
data MS_SETTINGS type ZGUIDRASIL_SETTING_ICON .
private section.
*"* private components of class ZCL_GUIDRASIL_CONTROL_ICON
*"* do not include other source files here!!!
constants C_FUNCTION_FIT type UI_FUNC value 'PicFit' ##NO_TEXT.
constants C_FUNCTION_FIT_CENTERED type UI_FUNC value 'PicFitCent' ##NO_TEXT.
constants C_FUNCTION_NORMAL type UI_FUNC value 'PicNormal' ##NO_TEXT.
constants C_FUNCTION_NORMAL_CENTERED type UI_FUNC value 'PicNormalCent' ##NO_TEXT.
constants C_FUNCTION_STRETCH type UI_FUNC value 'PicStretch' ##NO_TEXT.
class-methods GET_RANDOM_ICON
returning
value(ICON_NAME) type ICONNAME .
methods ICON_CLICK
for event PICTURE_CLICK of CL_GUI_PICTURE
importing
!MOUSE_POS_X
!MOUSE_POS_Y .
ENDCLASS.
CLASS ZCL_GUIDRASIL_CONTROL_ICON IMPLEMENTATION.
METHOD APPLY_SETTINGS.
DATA lr_picture TYPE REF TO cl_gui_picture.
CHECK gr_control IS BOUND.
lr_picture ?= gr_control.
IF ms_settings-icon_name IS INITIAL.
ms_settings-icon_name = get_random_icon( ). "'ICON_CONNECTION_OBJECT'.
ms_settings-display_mode = cl_gui_picture=>display_mode_fit_center.
ENDIF.
* IF ms_settings-display_mode IS INITIAL.
* ms_settings-display_mode = cl_gui_picture=>display_mode_fit_center.
* ENDIF.
lr_picture->load_picture_from_sap_icons( get_icon_id( ms_settings-icon_name ) ).
lr_picture->set_display_mode( ms_settings-display_mode ).
ENDMETHOD.
METHOD CLASS_CONSTRUCTOR.
SELECT * FROM icon INTO TABLE mt_all_icons.
ENDMETHOD.
METHOD CONSTRUCTOR.
super->constructor( ).
gv_control_short_name = 'ICON'.
ENDMETHOD.
METHOD CREATE.
DATA lr_picture TYPE REF TO cl_gui_picture.
CREATE OBJECT lr_picture
EXPORTING
parent = ir_parent
EXCEPTIONS
OTHERS = 6.
er_control ?= lr_picture.
gr_control = lr_picture.
IF iv_name IS INITIAL.
gv_control_name = zcl_guidrasil_builder=>init_control_name( 'ICON' ).
ELSE.
gv_control_name = iv_name.
ENDIF.
gv_control_short_name = 'ICO'.
gv_control_technical = 'CL_GUI_PICTURE'.
mv_parent_container_name = iv_parent.
apply_settings( ).
DATA lt_events TYPE cntl_simple_events.
DATA ls_event TYPE cntl_simple_event.
ls_event-eventid = lr_picture->eventid_picture_click.
APPEND ls_event TO lt_events.
lr_picture->set_registered_events( lt_events ).
SET HANDLER icon_click FOR lr_picture.
APPEND 'PICTURE_CLICK' TO gt_events.
ENDMETHOD.
METHOD get_design_functions.
DATA lx_menu TYPE REF TO cl_ctmenu. "ew
DATA ls_function TYPE stb_button.
DATA ls_funcmenu TYPE stb_btnmnu. "ew
* et_functions = mr_control_functions->get_design_functions( ).
*>>> dropdown
* ls_function-icon = icon_detail.
* ls_function-butn_type = cntb_id_dropdown. "cntb_btype_dropdown.
* ls_function-function = 'PIC_DROPDOWN'.
* ls_function-text = ''.
* ls_function-quickinfo = 'Controlfunktionen'.
* APPEND ls_function TO et_functions.
*<<< dropdown
ls_function-butn_type = cntb_id_dropmenu.
ls_function-function = c_function_stretch.
ls_function-text = 'Stretch'.
ls_function-quickinfo = 'Stretch icon'.
APPEND ls_function TO et_functions.
ls_function-function = c_function_normal.
ls_function-text = 'Normal'.
ls_function-quickinfo = 'Display normal'.
APPEND ls_function TO et_functions.
ls_function-function = c_function_fit.
ls_function-text = 'Fit'.
ls_function-quickinfo = 'Stretch to fit container'.
APPEND ls_function TO et_functions.
ls_function-function = c_function_normal_centered.
ls_function-text = 'Normal centered'.
ls_function-quickinfo = 'Display normal (centered)'.
APPEND ls_function TO et_functions.
ls_function-function = c_function_fit_centered.
ls_function-text = 'Fit'.
ls_function-quickinfo = 'Fit container (centered)'.
APPEND ls_function TO et_functions.
ls_funcmenu-function = '$CTRLFUNC'.
ls_funcmenu-ctmenu = lx_menu.
APPEND ls_funcmenu TO et_funcmenus.
ENDMETHOD.
METHOD GET_ICON_ID.
SELECT SINGLE id FROM icon INTO icon_id WHERE name = icon_name.
IF sy-subrc > 0.
icon_id = icon_alert.
ENDIF.
ENDMETHOD.
METHOD GET_RANDOM_ICON.
data seed type i.
seed = sy-uzeit.
IF mr_random IS INITIAL.
mr_random = cl_abap_random_int=>create(
seed = seed
min = 1
max = lines( mt_all_icons ) ).
ENDIF.
DATA ls_icon TYPE icon.
READ TABLE mt_all_icons INDEX mr_random->get_next( ) INTO ls_icon.
icon_name = ls_icon-name.
ENDMETHOD.
METHOD ICON_CLICK.
MESSAGE i000(oo) WITH gv_control_name 'IconClick (x/y)' mouse_pos_x mouse_pos_y.
ENDMETHOD.
METHOD LOAD_SETTINGS.
CALL METHOD load
CHANGING
cs_settings = ms_settings.
ENDMETHOD.
METHOD PROVIDE_CONTROL_NAME.
ev_name = gv_control_name.
ev_desc = 'Picture-Control'.
ev_icon = icon_gis_pie.
ev_short = gv_control_short_name.
ENDMETHOD.
METHOD PROVIDE_TOOLBAR.
ENDMETHOD.
METHOD RETURN_CREATION_CODE.
*== data
* APPEND 'DATA $control TYPE REF TO cl_gui_picture.' TO data.
*== code
APPEND 'CREATE OBJECT $control EXPORTING parent = $parent.' TO code.
APPEND |$control->load_picture_from_sap_icons( zcl_guidrasil_control_icon=>get_icon_id( '{ ms_settings-icon_name }' ) ).| TO code.
APPEND '*== Set Display mode' TO code.
APPEND '$control->set_display_mode( cl_gui_picture=>display_mode_fit ).' TO code.
APPEND '*== Picture-Click-Event' TO code.
APPEND 'DATA lt_events TYPE cntl_simple_events.' TO code.
APPEND 'DATA ls_event TYPE cntl_simple_event.' TO code.
APPEND '*== register events' TO code.
APPEND 'ls_event-eventid = $control->eventid_picture_click.' TO code.
APPEND 'APPEND ls_event TO lt_events.' TO code.
APPEND 'SET HANDLER h_picture_click FOR $control.' to code.
APPEND '$control->set_registered_events( lt_events ).' TO code.
ENDMETHOD.
METHOD SAVE_SETTINGS.
DATA lr_picture TYPE REF TO cl_gui_picture.
lr_picture ?= gr_control.
ms_settings-display_mode = lr_picture->display_mode.
save( is_settings = ms_settings ).
ENDMETHOD.
METHOD set_attribute.
zcl_guidrasil_control_base=>set_attribute_ext(
EXPORTING attr = name
value = value
CHANGING settings = ms_settings ).
ENDMETHOD.
METHOD view_attributes.
CALL FUNCTION 'Z_GUIDRASIL_CONTROL_ICON_POPUP'
EXPORTING
ir_control = gr_control
CHANGING
cs_settings = ms_settings
EXCEPTIONS
no_changes = 1.
IF sy-subrc = 0.
apply_settings( ).
ENDIF.
ENDMETHOD.
METHOD zif_guidrasil_func_receiver~on_dropdown_clicked.
DATA lx_menu TYPE REF TO cl_ctmenu.
DATA: BEGIN OF checked,
normal TYPE rm_boolean,
normal_centered TYPE rm_boolean,
fit TYPE rm_boolean,
fit_centered TYPE rm_boolean,
stretch TYPE rm_boolean,
END OF checked.
* CHECK r_receiver = me.
CASE fcode.
WHEN '$CTRLFUNC'.
CREATE OBJECT lx_menu.
CLEAR checked.
CASE ms_settings-display_mode.
WHEN cl_gui_picture=>display_mode_fit.
checked-fit = abap_true.
WHEN cl_gui_picture=>display_mode_normal.
checked-normal = abap_true.
WHEN cl_gui_picture=>display_mode_stretch.
checked-stretch = abap_true.
WHEN cl_gui_picture=>display_mode_normal_center.
checked-normal_centered = abap_true.
WHEN cl_gui_picture=>display_mode_fit_center.
checked-fit_centered = abap_true.
ENDCASE.
lx_menu->add_function(
fcode = c_function_fit
disabled = checked-fit
checked = checked-fit
text = 'Fit display' ). "#EC NOTEXT
lx_menu->add_function(
fcode = c_function_normal
disabled = checked-normal
checked = checked-normal
text = 'Normal display' ). "#EC NOTEXT
lx_menu->add_function(
fcode = c_function_normal_centered
disabled = checked-normal_centered
checked = checked-normal_centered
text = 'Normal centered' ). "#EC NOTEXT
lx_menu->add_function(
fcode = c_function_fit_centered
disabled = checked-fit_centered
checked = checked-fit_centered
text = 'Fit centered' ). "#EC NOTEXT
lx_menu->add_function(
fcode = c_function_stretch
disabled = checked-stretch
checked = checked-stretch
text = 'Stretched' ). "#EC NOTEXT
ENDCASE. "fcode
IF lx_menu IS BOUND.
r_toolbar->track_context_menu(
context_menu = lx_menu
posx = posx
posy = posy ).
ENDIF.
*
* CASE fcode.
* WHEN 'PIC_DROPDOWN'.
* mr_control_functions->on_dropdown_clicked(
* fcode = fcode
* r_toolbar = r_toolbar
* posx = posx
* posy = posy ).
*
* ENDCASE.
ENDMETHOD.
METHOD zif_guidrasil_func_receiver~on_function_selected.
CASE fcode.
WHEN c_function_fit.
ms_settings-display_mode = cl_gui_picture=>display_mode_fit.
apply_settings( ).
WHEN c_function_normal.
ms_settings-display_mode = cl_gui_picture=>display_mode_normal.
apply_settings( ).
WHEN c_function_stretch.
ms_settings-display_mode = cl_gui_picture=>display_mode_stretch.
apply_settings( ).
WHEN c_function_normal_centered.
ms_settings-display_mode = cl_gui_picture=>display_mode_normal_center.
apply_settings( ).
WHEN c_function_fit_centered.
ms_settings-display_mode = cl_gui_picture=>display_mode_fit_center.
apply_settings( ).
ENDCASE.
ENDMETHOD.
ENDCLASS.
| 25.870824 | 132 | 0.667786 |
35ddb28b9115b4aa2fdbd6d9d4593c8673d593e7
| 354 |
abap
|
ABAP
|
src/maic/zcl_trcktrsr_minion_teddy.clas.abap
|
tricktresor/minion_dojo
|
ac870e2a55a230cef4ef59813153c2bfc4691395
|
[
"MIT"
] | 1 |
2018-09-06T19:54:58.000Z
|
2018-09-06T19:54:58.000Z
|
src/maic/zcl_trcktrsr_minion_teddy.clas.abap
|
tricktresor/minion_dojo
|
ac870e2a55a230cef4ef59813153c2bfc4691395
|
[
"MIT"
] | null | null | null |
src/maic/zcl_trcktrsr_minion_teddy.clas.abap
|
tricktresor/minion_dojo
|
ac870e2a55a230cef4ef59813153c2bfc4691395
|
[
"MIT"
] | 1 |
2018-09-09T08:16:35.000Z
|
2018-09-09T08:16:35.000Z
|
class ZCL_TRCKTRSR_MINION_TEDDY definition
public
final
create public .
public section.
interfaces ZIF_TRCKTRSR_MINION_TOOL .
methods CONSTRUCTOR .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_TRCKTRSR_MINION_TEDDY IMPLEMENTATION.
METHOD CONSTRUCTOR.
zif_trcktrsr_minion_tool~name = 'Teddy'.
ENDMETHOD.
ENDCLASS.
| 14.75 | 47 | 0.782486 |
35e2ead0a1ebbd7a8a5314a85115fb7612d54c82
| 1,100 |
abap
|
ABAP
|
zr_gol_main.prog.abap
|
hapejot/gol
|
0fd996d3dd693cb1b0d1a283d6fed8c8a7dc685d
|
[
"MIT"
] | null | null | null |
zr_gol_main.prog.abap
|
hapejot/gol
|
0fd996d3dd693cb1b0d1a283d6fed8c8a7dc685d
|
[
"MIT"
] | null | null | null |
zr_gol_main.prog.abap
|
hapejot/gol
|
0fd996d3dd693cb1b0d1a283d6fed8c8a7dc685d
|
[
"MIT"
] | null | null | null |
*&---------------------------------------------------------------------*
*& Report zr_gol_main
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zr_gol_main.
DATA: go_container TYPE REF TO zcl_abapdi_container,
go_display TYPE REF TO zif_gol_display.
INITIALIZATION.
CREATE OBJECT go_container.
go_container->register( i_if = 'zif_gol_world' i_cl = 'zcl_gol_world' ).
go_container->register( i_if = 'zcl_gol_main' i_single = abap_true ).
go_container->register( i_if = 'zif_gol_display' i_cl = 'zcl_gol_display' i_single = abap_true ).
go_container->register( i_if = 'zcl_gol_settings' i_ob = NEW zcl_gol_settings( i_height = 50 i_width = 100 ) ).
go_display ?= go_container->get_instance( 'zif_gol_display' ).
START-OF-SELECTION.
SET PF-STATUS 'MAIN'.
go_display->start_of_selection( ).
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN OTHERS.
go_display->at_user_command( ).
ENDCASE.
| 35.483871 | 113 | 0.556364 |
35e3eceeaa299e572a299e5379cb5c36333f28aa
| 22,985 |
abap
|
ABAP
|
src/zboarding_pass.clas.abap
|
hendrik77/Advent_of_Code_2020
|
6f8c5de1ffaf5a5dfe03e94ac251641a9ed286eb
|
[
"Apache-2.0"
] | 2 |
2020-12-03T20:19:10.000Z
|
2021-01-21T22:59:16.000Z
|
src/zboarding_pass.clas.abap
|
hendrik77/Advent_of_Code_2020
|
6f8c5de1ffaf5a5dfe03e94ac251641a9ed286eb
|
[
"Apache-2.0"
] | null | null | null |
src/zboarding_pass.clas.abap
|
hendrik77/Advent_of_Code_2020
|
6f8c5de1ffaf5a5dfe03e94ac251641a9ed286eb
|
[
"Apache-2.0"
] | null | null | null |
CLASS zboarding_pass DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES
if_oo_adt_classrun.
METHODS get_row
IMPORTING
seat TYPE string
RETURNING
VALUE(row) TYPE i.
METHODS get_column
IMPORTING
seat TYPE string
RETURNING
VALUE(column) TYPE i.
METHODS get_seat_id
IMPORTING
seat TYPE string
RETURNING
VALUE(id) TYPE i.
METHODS sanity_check
IMPORTING
boarding_passes TYPE string
RETURNING
VALUE(result) TYPE i.
METHODS get_free_seat
IMPORTING
boarding_passes TYPE string
RETURNING
VALUE(seat_id) TYPE i.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS prepare_riddle
RETURNING
VALUE(riddle) TYPE string.
ENDCLASS.
CLASS zboarding_pass IMPLEMENTATION.
METHOD get_row.
DATA(row_code) = substring( val = seat len = 7 ).
DO 7 TIMES.
row += COND i( WHEN substring( val = row_code off = sy-index - 1 len = 1 ) = 'B'
THEN ipow( base = 2 exp = 7 - sy-index )
ELSE 0 ).
ENDDO.
ENDMETHOD.
METHOD if_oo_adt_classrun~main.
out->write( |part 1 - sanitiy check: | && sanity_check( prepare_riddle( ) ) ).
out->write( |part 2 - free seat: | && get_free_seat( prepare_riddle( ) ) ).
ENDMETHOD.
METHOD get_column.
DATA(column_code) = substring( val = seat off = 7 len = 3 ).
DATA(x) = strlen( column_code ).
DATA(code) = 'R'.
DO x TIMES.
column += COND i( WHEN substring( val = column_code off = sy-index - 1 len = 1 ) = code
THEN ipow( base = 2 exp = x - sy-index )
ELSE 0 ).
ENDDO.
ENDMETHOD.
METHOD get_seat_id.
id = get_row( seat ) * 8 + get_column( seat ).
ENDMETHOD.
METHOD prepare_riddle.
riddle =
|BFBFFFFLLL\n| &&
|BBFBBFBRLL\n| &&
|BFBBFFFRRR\n| &&
|FBFFBBBLLL\n| &&
|FFBBFBBRLL\n| &&
|BBBFFFFLRL\n| &&
|BFBBBFBRRR\n| &&
|FBBFFFBLRL\n| &&
|FFBFBBFLLR\n| &&
|FBFFFFBLRL\n| &&
|BBFFBBFRLL\n| &&
|BBFBBBBLLR\n| &&
|FFBBBBFRLR\n| &&
|BBFFBFFRLR\n| &&
|BFFBBFFRRL\n| &&
|BBFBBBFLLR\n| &&
|FBFBBBBRRL\n| &&
|BFFFBFFLRL\n| &&
|FBFFFBFRLL\n| &&
|FBBBFFBLRR\n| &&
|FFFBFBBRLR\n| &&
|FBBFBBFLLR\n| &&
|FBFBFFFLRL\n| &&
|BFFBFBFLLR\n| &&
|BBFBFBBRRL\n| &&
|BFFBBFBRLR\n| &&
|FBFBFFFRRL\n| &&
|BFBFFBBRRL\n| &&
|FBFBFBFLLL\n| &&
|BFFBFFBRRL\n| &&
|FFBBBBBRRL\n| &&
|FFFBFBFRLR\n| &&
|BBFFFBBLRL\n| &&
|BFBFBFFRLL\n| &&
|BFBFFFBRLR\n| &&
|FBBBFFFRRR\n| &&
|BBFFFBFRLL\n| &&
|FBBBFBFRLL\n| &&
|FFBBBFFLRR\n| &&
|FBFBBFBLRL\n| &&
|FBBBBBFLLR\n| &&
|FBFFBBBLRL\n| &&
|FFFBBFFRRL\n| &&
|FBBBFFFRLR\n| &&
|BBFBFFFRLR\n| &&
|BBFBBFBLLL\n| &&
|FBFFBBBRRL\n| &&
|BFFFFBFRRR\n| &&
|FBBFFBFLRR\n| &&
|FBFBBBFLRL\n| &&
|BFBBBBBRRL\n| &&
|BBFFFFBLRL\n| &&
|FBFFFBFLLL\n| &&
|FFFBBFFLLR\n| &&
|FBBBFBFLRR\n| &&
|BBBFFBFRRL\n| &&
|BFBFFFFRLR\n| &&
|FFBFFFBRLR\n| &&
|FBFFBFBRLL\n| &&
|FBBFFFFRLL\n| &&
|FFFBBFBRRR\n| &&
|FBBBBFFLRR\n| &&
|BFBBBFBRLR\n| &&
|BFFFFFFRRR\n| &&
|FFBBBBFRRR\n| &&
|BFFBFBFRRL\n| &&
|BFFBFFFRLR\n| &&
|BBFFBFBLRR\n| &&
|FBFFFBBLLL\n| &&
|FBFFFFFRLR\n| &&
|BFBBFBFLRR\n| &&
|FBBBBBBLRL\n| &&
|BFFFFBBLRR\n| &&
|BFFBFFFRRR\n| &&
|FBFFFBFLRL\n| &&
|BFBBFFBLRR\n| &&
|BBFBBBBLLL\n| &&
|BBFBBBFRRL\n| &&
|FBBBBBBRLR\n| &&
|BFFBFBFLRR\n| &&
|BFFBFFFLLR\n| &&
|FBBBBBFLRL\n| &&
|FBFFFBFRRL\n| &&
|FFBBBBFRRL\n| &&
|BFBBBBBRLR\n| &&
|FBBBBBFRRL\n| &&
|FFBFBFFLLL\n| &&
|BBBFFFFRRL\n| &&
|BBFBBFBRRR\n| &&
|BFBFFFFRLL\n| &&
|FBFFFFFLLR\n| &&
|FFFBBFFLRL\n| &&
|FBFFBFFLRR\n| &&
|FBFFBBFRLR\n| &&
|FFBBBFBLLR\n| &&
|BFFFFBFLRR\n| &&
|BBFBFBFRRR\n| &&
|FBBFBBBLLL\n| &&
|FBBFBFBLLL\n| &&
|FBBBFFBLRL\n| &&
|BBBFFBFRRR\n| &&
|FBBBFBFLRL\n| &&
|FBFFFBFRRR\n| &&
|FBFFBFBRRR\n| &&
|FFBBFFBRLL\n| &&
|BFBFBFBLLR\n| &&
|BBFFFFBRRR\n| &&
|FBBBBBBLLR\n| &&
|FBBBBFFRLR\n| &&
|BBFBBFFLRL\n| &&
|BFBBFBFLLR\n| &&
|FBFFFFFRLL\n| &&
|FFBBFFFLLR\n| &&
|BBFFFBFRRR\n| &&
|BFBBBFFLLR\n| &&
|BBFFFFBRLR\n| &&
|FFBFBBFRLR\n| &&
|BFBFFFBLLL\n| &&
|FBFFBFFLLL\n| &&
|FBBBFBBRLR\n| &&
|BBFBFFFLLR\n| &&
|FBFFFBBRLR\n| &&
|BFFBFBBLLL\n| &&
|BFFBBFFLLR\n| &&
|FBBFFBBRLR\n| &&
|BBFBFFBRLL\n| &&
|FBFBBBFRRL\n| &&
|BFBBBFBLLR\n| &&
|BBFFBBBRLL\n| &&
|BBBFFFBLRL\n| &&
|BBFBFFBRLR\n| &&
|BFFBBBFRRR\n| &&
|FFFBFBBRLL\n| &&
|FBFBFBBRLL\n| &&
|BFFFFFBRLR\n| &&
|FBFFBBBRRR\n| &&
|FBFFBBFLRL\n| &&
|BFFFBBBRLL\n| &&
|FBBBBFFLLL\n| &&
|BBFBFFFRRR\n| &&
|BFBFBBFLLL\n| &&
|FFBBFBFRRL\n| &&
|FFFBBBBRLR\n| &&
|BFFBBBBRLL\n| &&
|FFBFBBFRRL\n| &&
|FBFBFBFRLL\n| &&
|BBBFFFBRRL\n| &&
|BBBFFBFRLR\n| &&
|FBFBFBFLLR\n| &&
|BBFBBFFRLL\n| &&
|FBFBFFFLLR\n| &&
|BBFBFBFRRL\n| &&
|BFFBBFBRRL\n| &&
|FFBFFBFRLR\n| &&
|BFFBBFBRRR\n| &&
|FFBBFFBRRL\n| &&
|BFFFFBBRRL\n| &&
|FBBBBFFRLL\n| &&
|FBBBFFBRRR\n| &&
|FBBFFBFLLL\n| &&
|BBBFFBFRLL\n| &&
|FFFBBFBLLR\n| &&
|BFFBBFFLRR\n| &&
|BFBFBFFLLL\n| &&
|BFBFFBBLRL\n| &&
|FFFBBFBLRR\n| &&
|BBFFBFBLLL\n| &&
|FBBBFBFRRL\n| &&
|BFBBBBBLLR\n| &&
|BBFBFBBLLL\n| &&
|FFBFBFFLRR\n| &&
|BFFFFFFLLR\n| &&
|BFBFBFFRRL\n| &&
|BFBFBBFLLR\n| &&
|FBBBBFFLLR\n| &&
|FFBBFFBLLL\n| &&
|BBFFBFBRRR\n| &&
|FFFBBFBLRL\n| &&
|FBFBFFBLRL\n| &&
|BFBBBBBLLL\n| &&
|BFFFFBFRRL\n| &&
|FBFFFFFLRL\n| &&
|BFFFBFBLRL\n| &&
|BFFBFBFLLL\n| &&
|BBFBBBFRRR\n| &&
|FBFBFFBLRR\n| &&
|FBFBBBBRLL\n| &&
|BBFFFFFLRL\n| &&
|FBBFFFBRRR\n| &&
|FBFFFBBRLL\n| &&
|BFFFBFFLLL\n| &&
|BFFBBFFLRL\n| &&
|FFBFFFBLLL\n| &&
|BFBFBBBLLL\n| &&
|FBBFBFBLRR\n| &&
|FBFFBFFLLR\n| &&
|FBFFBBFRRR\n| &&
|BBFFFBFLLR\n| &&
|BBFBBFBLRL\n| &&
|FBFBBBFRRR\n| &&
|BBFFFFBLLR\n| &&
|FFBFBFBLRL\n| &&
|FFBBBBBLLR\n| &&
|FBFBFBBLRR\n| &&
|FFBBBFFRLL\n| &&
|FBBFBFBRLL\n| &&
|BBFBFFBRRL\n| &&
|BFBFFBFLRR\n| &&
|BFBFFBBRLR\n| &&
|FBBFFFFRRL\n| &&
|FBFFFFFLLL\n| &&
|FBFBBFBRLR\n| &&
|BBFBBFBLRR\n| &&
|BFBBBFFRLR\n| &&
|FBFFBBBLRR\n| &&
|FBFBFBBRRL\n| &&
|BBFFBBFLRL\n| &&
|BBFFFFBLRR\n| &&
|FFBBFFBLLR\n| &&
|BFBBFBBLRR\n| &&
|BBFBFBBRLL\n| &&
|BBFFFBFLLL\n| &&
|FBBFBBBRRR\n| &&
|BFBFBBFRLL\n| &&
|FFBBFFBLRL\n| &&
|FFFBBBFRRR\n| &&
|BFBFFFBLRR\n| &&
|BBFBFBBRRR\n| &&
|BFBFFBBLLR\n| &&
|BFFFBBBRLR\n| &&
|FFBBBBBRLL\n| &&
|FFFBBFBLLL\n| &&
|FBFBBBBLRR\n| &&
|FFBFFBBRLL\n| &&
|BFBBBBFLLL\n| &&
|BFFFBFFRLL\n| &&
|BBFFFBFLRR\n| &&
|BFBFFFFLRR\n| &&
|BFBFBBBRLR\n| &&
|BBFBBBFLRL\n| &&
|FBBFFFFLLR\n| &&
|FFFBBBBLLL\n| &&
|BBBFFBFLLL\n| &&
|FBFFBBBRLL\n| &&
|FBFBFFFLLL\n| &&
|FBBFFBFLLR\n| &&
|BFBFBBFRRL\n| &&
|BFFFFBBRLL\n| &&
|FBFBFFBLLL\n| &&
|BBFFFFFLLL\n| &&
|FFBBBBFLLR\n| &&
|FBFBBBFLLR\n| &&
|BFBBFFBRRL\n| &&
|FBBFFBBRLL\n| &&
|BFBFFFFLLR\n| &&
|BBFBFFFLRL\n| &&
|BFFFBFBLRR\n| &&
|FBBFBBFRRR\n| &&
|FFBFBFFRRL\n| &&
|BBFFFBBLLR\n| &&
|BFBFBFFLRL\n| &&
|BFBFFFBLRL\n| &&
|FBFBBBFLLL\n| &&
|FBBFFBBLLL\n| &&
|BBBFFBFLLR\n| &&
|BFFFBBFLRL\n| &&
|BFFFBFFLLR\n| &&
|BBBFFFFLRR\n| &&
|BBFFBFFLLR\n| &&
|BBFFFBBRRR\n| &&
|BBBFFFBLLR\n| &&
|BFBBBBFRLR\n| &&
|FBBFBBBRLL\n| &&
|BFBBFFBRLL\n| &&
|FBFBFBFLRR\n| &&
|BBFFFBFLRL\n| &&
|FBFBFFBRLL\n| &&
|FBBFBFBRLR\n| &&
|FFBFBBFLRL\n| &&
|BBFBBBFLRR\n| &&
|BFFBFBBLRL\n| &&
|BFFBBBBRLR\n| &&
|BFFFFFBRRR\n| &&
|FBBFFFBRRL\n| &&
|BFBFFBFLLR\n| &&
|FBBFBBFLRL\n| &&
|FBBBBBBLRR\n| &&
|BFBBBFBRRL\n| &&
|BFFFBFBLLL\n| &&
|FBFFFBBRRR\n| &&
|FFBBFFBRLR\n| &&
|BBFFFFFRRL\n| &&
|FFBFBBBRRL\n| &&
|FFBFBBFLRR\n| &&
|BFFFBBBRRL\n| &&
|FFBFBFBLRR\n| &&
|BBFFBFBRLL\n| &&
|BBFBBFBRRL\n| &&
|BBFBBFFRLR\n| &&
|FBBFBFFRLR\n| &&
|BFBBFFBLLL\n| &&
|BBFBFBFRLL\n| &&
|FFBBBFFLLL\n| &&
|FFBBBBBLRR\n| &&
|FBBFBBFRRL\n| &&
|BBFFBFBRLR\n| &&
|BFFFBBFRRL\n| &&
|BBFBBFFLLR\n| &&
|FBFFBBFLRR\n| &&
|BFBFBBBLLR\n| &&
|FFFBBBBRLL\n| &&
|BBFFFFFLRR\n| &&
|BFBBFFBLRL\n| &&
|BFBBFFFLLR\n| &&
|FFFBFBFLLL\n| &&
|FFBFFFFLLR\n| &&
|FBFFFBFLLR\n| &&
|BBBFFFFLLR\n| &&
|BFFBFFFLLL\n| &&
|FFFBBFBRRL\n| &&
|FBBFFFFLLL\n| &&
|FFFBBBFRLL\n| &&
|BBFBBBBLRR\n| &&
|FFFBBBFLRR\n| &&
|FFBBFBFRRR\n| &&
|BFBFBBBLRL\n| &&
|BBFBBBFLLL\n| &&
|FBBBFFBRLR\n| &&
|BFFFBBBRRR\n| &&
|FFBBBBFLRR\n| &&
|FFBBFBBRRL\n| &&
|FBBFFBFRLR\n| &&
|BBFFBBFRRR\n| &&
|BBFBBFBRLR\n| &&
|BFFBBFBLRR\n| &&
|FFBBBBBLRL\n| &&
|BBFFBBBRRR\n| &&
|BFFFBFBRRR\n| &&
|BFFFFFFRRL\n| &&
|BBFFBFBLRL\n| &&
|FBFFFFBLRR\n| &&
|FBFBBFFRRL\n| &&
|BFBFFFBLLR\n| &&
|FFFBFBBLRL\n| &&
|BFFFFFFRLL\n| &&
|BBFFFBBRRL\n| &&
|FFBFBFBRRL\n| &&
|FBBFBFFLLL\n| &&
|FBFFBFBLRR\n| &&
|BFFFFBBRLR\n| &&
|FFBFFFBLRR\n| &&
|BFBFFFBRRL\n| &&
|FBBFFBFRLL\n| &&
|FBFBBFBRRR\n| &&
|FBBBFBFLLR\n| &&
|FBBFFFBLLR\n| &&
|BFFFFBFLLR\n| &&
|FBBBBBBRLL\n| &&
|BBBFFFFRLL\n| &&
|BFFFBBBLRL\n| &&
|FFFBFBFLLR\n| &&
|FBFBBBBLLR\n| &&
|FBFFBFFRRR\n| &&
|BFFFBBBLLL\n| &&
|BFBBFFBRRR\n| &&
|FBBBBFFRRR\n| &&
|BFBFBBFLRR\n| &&
|BFFBFFBLRL\n| &&
|BBFBFFFRLL\n| &&
|FFFBBFBRLL\n| &&
|FBBFFFFRLR\n| &&
|FFBBFBBRLR\n| &&
|BBFFFBBLLL\n| &&
|BBFFFBBRLL\n| &&
|FBBFFFFRRR\n| &&
|BFBFBFBLRR\n| &&
|FFBFFFFRRR\n| &&
|FBFBFBFLRL\n| &&
|FFBFBBFLLL\n| &&
|FFBFBBBRLR\n| &&
|BFBFFFBRLL\n| &&
|FFBFFBBLRL\n| &&
|BFBBBBBRLL\n| &&
|BBFBFFBLRR\n| &&
|FBFFFFBRLR\n| &&
|FFBBBFBRRR\n| &&
|BFBFBBBRRR\n| &&
|FBBBBBFRRR\n| &&
|FBBFBBBLRR\n| &&
|BBFBBBBRRL\n| &&
|BFFBBBFRLL\n| &&
|BBFBFBFLLR\n| &&
|FFBBFFBRRR\n| &&
|BFFFBBBLLR\n| &&
|BFFFBBBLRR\n| &&
|FFFBFBFRRR\n| &&
|BFBFBFBRRL\n| &&
|FFBBBFBRRL\n| &&
|FFFBBBBRRR\n| &&
|FBFFBFFRRL\n| &&
|BFFBFFFRRL\n| &&
|FFFBBBFLRL\n| &&
|FBBBBFFLRL\n| &&
|FFBFFBBRLR\n| &&
|FBBFBBBLRL\n| &&
|FFBFFFFLRR\n| &&
|FBFFBFBRLR\n| &&
|FBBFBBBRRL\n| &&
|FFBBBFBRLL\n| &&
|BFFFFFBLRL\n| &&
|FFFBBFFRLR\n| &&
|BFBFFFBRRR\n| &&
|FFBBFFFLRL\n| &&
|FBBBBFBRLR\n| &&
|FFBBBBFRLL\n| &&
|FFBFFBBLLR\n| &&
|FBFFFFBLLL\n| &&
|FBFBBBBLLL\n| &&
|BFFFBFBRRL\n| &&
|FBBBBBFLLL\n| &&
|FFBBFFFRLL\n| &&
|FBBBFFFLLR\n| &&
|BFFBBBBLLR\n| &&
|BFBFBFFRLR\n| &&
|BFBFFBBLLL\n| &&
|FBFBBFFLRR\n| &&
|FFBBFFFRRL\n| &&
|FBFBBFFRLL\n| &&
|BFFFFBFLLL\n| &&
|FBBBFBBLLL\n| &&
|FBFBFFFRLR\n| &&
|BFFBBBBLRL\n| &&
|FFBFFFFRLL\n| &&
|BFBBFBBLLR\n| &&
|FFBBFBBLRL\n| &&
|FBFBBFBLRR\n| &&
|FBBBBBBRRL\n| &&
|FFBFBBFRRR\n| &&
|FBFFBBFRLL\n| &&
|FBBFFFBRLL\n| &&
|BFFFBFBRLR\n| &&
|BFFBFFBLRR\n| &&
|BBBFFFBRLL\n| &&
|BFBFFBBLRR\n| &&
|BFBBBFBRLL\n| &&
|BBFBFBFRLR\n| &&
|FFFBFBBRRL\n| &&
|BFFFFBBLLR\n| &&
|FBFFBBBRLR\n| &&
|BFBFFBFRLL\n| &&
|FBFBFFBRRL\n| &&
|BFFFFFFLLL\n| &&
|BFFFBBFLLR\n| &&
|BFFFBFBRLL\n| &&
|BFBBBBBLRL\n| &&
|BFFFFBFRLR\n| &&
|BBFBFBFLRL\n| &&
|FBBBBBFRLL\n| &&
|BBFFBFFLRR\n| &&
|FBFBFFBRLR\n| &&
|FFBBBFBLRR\n| &&
|FBBFFFBLRR\n| &&
|BFBBBFBLRL\n| &&
|BFFFBFBLLR\n| &&
|BBFFBBFRLR\n| &&
|BFBBFFFLRR\n| &&
|BFFBFBBRLR\n| &&
|FFBBFFFLLL\n| &&
|FBBBFBFLLL\n| &&
|BFBBBBFLRL\n| &&
|FFBBBBBRRR\n| &&
|FBBFFFBLLL\n| &&
|BFBBFBBLLL\n| &&
|FBBBBFBRLL\n| &&
|FBBFBFFLRL\n| &&
|BFFBBFBLLL\n| &&
|FBBBFBBRRR\n| &&
|BFFBFBFRLL\n| &&
|BBFFBBBLRL\n| &&
|BFBFBFBLRL\n| &&
|FBBBFFFLLL\n| &&
|BFFFBFFRRL\n| &&
|FFBFFBFLLR\n| &&
|BFFBFBBLRR\n| &&
|BFFFFFBRLL\n| &&
|BFBFBBBLRR\n| &&
|FFFBBBBLRL\n| &&
|BFBBBBBRRR\n| &&
|BFFBFBFRLR\n| &&
|BFFBBFFLLL\n| &&
|BBFBBFFRRL\n| &&
|FBBBFFFLRL\n| &&
|FBFFBFFRLL\n| &&
|FBFFFBFLRR\n| &&
|FBBBFBBLLR\n| &&
|BBFFFFBLLL\n| &&
|BFFFBBFRLR\n| &&
|BBFBFBBLRR\n| &&
|FBBFBBBRLR\n| &&
|FBFFFBBRRL\n| &&
|FBBBFFBLLR\n| &&
|FFBBBBFLLL\n| &&
|BFFBFFBLLL\n| &&
|FFBFBFBLLR\n| &&
|BBFFBBBLLL\n| &&
|BBFFFFFRLL\n| &&
|BBFFFBBLRR\n| &&
|FFFBBBFRRL\n| &&
|BFFBFBBRRR\n| &&
|BFFBBFFRLL\n| &&
|FFFBBBFLLL\n| &&
|FBFFFFFRRR\n| &&
|FBBFBBFLRR\n| &&
|FFBBFBFRLL\n| &&
|FFFBFBFRLL\n| &&
|FBBBFBBRLL\n| &&
|BBFFBFFLRL\n| &&
|FFFBBBBLLR\n| &&
|BFFBFBBRLL\n| &&
|BFBFFBFRLR\n| &&
|BFFBFBBLLR\n| &&
|BFFFBBFLLL\n| &&
|BFFFFBFLRL\n| &&
|FBFBBBBRRR\n| &&
|FFBBBBFLRL\n| &&
|BBFFFFBRLL\n| &&
|FFBBBFFRRR\n| &&
|FBFBBFBLLR\n| &&
|FBBBFBBLRR\n| &&
|BBBFFFFLLL\n| &&
|BBFBBFBLLR\n| &&
|BFBBFFBRLR\n| &&
|BFBBBBFRRL\n| &&
|FBBFFBBLRL\n| &&
|BFFBFBFRRR\n| &&
|BFBFBBFLRL\n| &&
|FBFBBFFRLR\n| &&
|FBBFBBFRLL\n| &&
|FFBBFBFLRR\n| &&
|BFBBFBFRRL\n| &&
|BFBBBFFLRR\n| &&
|BFBBFBBRRR\n| &&
|FFBBBBBRLR\n| &&
|BFBBFBFRLR\n| &&
|FFBFFBFRRR\n| &&
|BFFFFBBLRL\n| &&
|BFFBBFBLLR\n| &&
|BFFBBBFLRR\n| &&
|FFBFFFBRLL\n| &&
|BBBFFFBLLL\n| &&
|FBBFBBFLLL\n| &&
|BBFFFBFRRL\n| &&
|FBBBFFFLRR\n| &&
|FBBFBFBRRR\n| &&
|FBBBFFFRRL\n| &&
|BFFBBBFLLL\n| &&
|BFBBFBBLRL\n| &&
|FFBBFBBLLL\n| &&
|BFBBBBFLLR\n| &&
|FBFFFFBRRR\n| &&
|FBBFFFFLRR\n| &&
|FFFBFBBLLR\n| &&
|BFBBFFFLRL\n| &&
|FFBFFBBLRR\n| &&
|FFBFBFBRLL\n| &&
|FFBFFFBLRL\n| &&
|FFFBBFFRRR\n| &&
|FBBFBFFLRR\n| &&
|FBFFBFBRRL\n| &&
|BBFFBBFLLR\n| &&
|FFBFFFBRRL\n| &&
|BBFFBFFRRR\n| &&
|FFBBBFBLRL\n| &&
|FBBFFBFLRL\n| &&
|FBFBBBFRLL\n| &&
|BFFFFBBLLL\n| &&
|BFFBBBBRRR\n| &&
|FFBFBFBRRR\n| &&
|FFBFBBBLLL\n| &&
|BBFFBFFLLL\n| &&
|BFFBFBBRRL\n| &&
|FFBBFBFLRL\n| &&
|FFBBFFFRLR\n| &&
|BFBFBFFLLR\n| &&
|BFBFBBFRLR\n| &&
|FFFBFBBLRR\n| &&
|BFFBFFBRRR\n| &&
|BFFBFFFLRR\n| &&
|FFBFFFBRRR\n| &&
|FBBBFFBLLL\n| &&
|FBFFBFBLLR\n| &&
|BBFBFFBLLL\n| &&
|FFBFBBFRLL\n| &&
|BBFFFFBRRL\n| &&
|FBFBFBBLLR\n| &&
|FBFBFBBLLL\n| &&
|FBBFBFFRRR\n| &&
|FBFBBFBLLL\n| &&
|BBFFBBFLRR\n| &&
|BBFBFFBLRL\n| &&
|FBFBFBBLRL\n| &&
|BFFFFFBLLL\n| &&
|BFFBBBFLLR\n| &&
|BFBBBBBLRR\n| &&
|FBFBBFBRLL\n| &&
|FBFFFFBLLR\n| &&
|BBFFBBBLRR\n| &&
|FBFFFFFRRL\n| &&
|FBFBFBFRLR\n| &&
|BFFFBBFRLL\n| &&
|BFFBFFBLLR\n| &&
|BFBFFFFRRL\n| &&
|FFBFFBFRRL\n| &&
|FBBFBFFRLL\n| &&
|FFBBBFBRLR\n| &&
|BFBBBFFLRL\n| &&
|FBBBBFBRRL\n| &&
|FFFBFBFRRL\n| &&
|BBFBBBFRLR\n| &&
|BFFBFBFLRL\n| &&
|BFFBBFBLRL\n| &&
|FBFBFBFRRR\n| &&
|FBBFFBBRRL\n| &&
|FBFFBFFLRL\n| &&
|BFBFFFFRRR\n| &&
|FFBBFBFLLL\n| &&
|FFFBBFBRLR\n| &&
|BBFFBBBLLR\n| &&
|BBFBFBFLRR\n| &&
|BFFFFFBLLR\n| &&
|BBFBFBBRLR\n| &&
|FBFBFFFLRR\n| &&
|BFBFFBFLLL\n| &&
|BBFBBFFLLL\n| &&
|FBBBFBBRRL\n| &&
|FBFBFBBRLR\n| &&
|FFBBBFFLLR\n| &&
|BFFFFFBLRR\n| &&
|BBFBFFFLRR\n| &&
|FFBFBBBRLL\n| &&
|BBFBFBFLLL\n| &&
|BBFBBFFRRR\n| &&
|BBFBBFFLRR\n| &&
|FFBFBBBRRR\n| &&
|FBFBFBFRRL\n| &&
|BFFFFFFLRR\n| &&
|BFBFBBFRRR\n| &&
|FFFBBFFLLL\n| &&
|FBFBBFFLRL\n| &&
|FBFFBBBLLR\n| &&
|BFFBBBBLLL\n| &&
|FFBFFBFLLL\n| &&
|FBFBFFBRRR\n| &&
|BFBBBFFRRR\n| &&
|BBBFFFFRRR\n| &&
|BFBFBFBLLL\n| &&
|FFBFBBBLRR\n| &&
|BBFFBBBRLR\n| &&
|FFBBFFBLRR\n| &&
|BFBFBBBRRL\n| &&
|FFBBFFFLRR\n| &&
|FFFBBBBRRL\n| &&
|BFBBFBFLLL\n| &&
|FBBBBFBLRR\n| &&
|BBFBFFFRRL\n| &&
|FFBBFBFLLR\n| &&
|BFFFFBBRRR\n| &&
|BBFFBBFLLL\n| &&
|FBFFBFBLLL\n| &&
|BFBBFFFLLL\n| &&
|FFBFFFBLLR\n| &&
|FBFFFBBLLR\n| &&
|BFBBBFFRRL\n| &&
|FBFBBBFRLR\n| &&
|FFBFFBFLRR\n| &&
|BBFFFFFLLR\n| &&
|FBBFBFFLLR\n| &&
|BBFFBFBRRL\n| &&
|BFBFBFFLRR\n| &&
|BBFBFFFLLL\n| &&
|BBFFFBBRLR\n| &&
|BFBFFBBRLL\n| &&
|BFBFBFBRLR\n| &&
|BBFBBBBRLL\n| &&
|BFBBFBBRLL\n| &&
|FFBFBBBLRL\n| &&
|BFBFBBBRLL\n| &&
|FBBFBFBLRL\n| &&
|FBFFFBBLRR\n| &&
|BBFFBBBRRL\n| &&
|BFBFFBFRRR\n| &&
|BBBFFFBLRR\n| &&
|FFBBBFFRRL\n| &&
|FBBFFBFRRL\n| &&
|BFFFBFFRLR\n| &&
|FBFFBFFRLR\n| &&
|FFFBFBBLLL\n| &&
|FFBFBFFRRR\n| &&
|BBFFBFFRRL\n| &&
|FFFBFBFLRL\n| &&
|BFFBBFFRRR\n| &&
|FFBBBFFLRL\n| &&
|FBFBFFBLLR\n| &&
|FBFFBBFRRL\n| &&
|BFFBBFFRLR\n| &&
|BFFBFFBRLR\n| &&
|BFFBFFFLRL\n| &&
|FBFFFFFLRR\n| &&
|FFFBBBBLRR\n| &&
|BFBBFFBLLR\n| &&
|BFBBFBBRLR\n| &&
|BFFFFBFRLL\n| &&
|BBFFFBFRLR\n| &&
|FBFBFFFRRR\n| &&
|FFFBBFFLRR\n| &&
|FBBBBFBLLR\n| &&
|FBBBBBFRLR\n| &&
|FFBFBFBLLL\n| &&
|FBFBBFFLLL\n| &&
|BBFBBBBRLR\n| &&
|BBFFBBFRRL\n| &&
|BBFBBBFRLL\n| &&
|BFBBFBFLRL\n| &&
|BFBBBFFRLL\n| &&
|FBFBFBBRRR\n| &&
|FBBBBBBLLL\n| &&
|BFBFFBBRRR\n| &&
|FBBFFBBRRR\n| &&
|BFFFFFBRRL\n| &&
|FFBBFFFRRR\n| &&
|FFBFFBBLLL\n| &&
|BBBFFBFLRR\n| &&
|BBFBBBBRRR\n| &&
|FBFBFFFRLL\n| &&
|FBBBFBFRRR\n| &&
|FBBBBFFRRL\n| &&
|BFFFFFFLRL\n| &&
|FBBBBBFLRR\n| &&
|BFFBBBFLRL\n| &&
|BFBBFFFRLR\n| &&
|FFBFFFFRLR\n| &&
|FFBBBFFRLR\n| &&
|BFBBFBBRRL\n| &&
|FFBFBFFLLR\n| &&
|BBBFFFFRLR\n| &&
|BBFFFFFRLR\n| &&
|FBBFFBBLLR\n| &&
|BFBFFBFRRL\n| &&
|BFFFBFFLRR\n| &&
|FFBFBFBRLR\n| &&
|BFFFBFFRRR\n| &&
|BFFBBBBRRL\n| &&
|FFBBBBBLLL\n| &&
|BFFBBBFRLR\n| &&
|FBFFFBFRLR\n| &&
|FFBFBFFRLR\n| &&
|BFBBBFBLLL\n| &&
|FBFBBFBRRL\n| &&
|BBFBFBBLRL\n| &&
|BFBBFBFRLL\n| &&
|BFBBBFFLLL\n| &&
|FBBFBBBLLR\n| &&
|FBFFFFBRRL\n| &&
|FBBBBBBRRR\n| &&
|FBFBBBBLRL\n| &&
|FFFBFBBRRR\n| &&
|FFBFBFFLRL\n| &&
|FBFFBBFLLR\n| &&
|FFBBFBBLRR\n| &&
|BBFBFBBLLR\n| &&
|FFFBFBFLRR\n| &&
|BBBFFFBRRR\n| &&
|FFBFFBBRRR\n| &&
|FFBFFBBRRL\n| &&
|FBBFFFFLRL\n| &&
|FBFBBFFRRR\n| &&
|BFBBFFFRLL\n| &&
|FFFBBBFLLR\n| &&
|FBBBBFBLLL\n| &&
|BBFBBBBLRL\n| &&
|BBFBFFBRRR\n| &&
|BFFBBBBLRR\n| &&
|FBBBBFBRRR\n| &&
|BFBFBFFRRR\n| &&
|BFFBBFBRLL\n| &&
|FFBBBFBLLL\n| &&
|BFBFFBFLRL\n| &&
|BFFFBBFLRR\n| &&
|FBBBBFBLRL\n| &&
|FBBFBFFRRL\n| &&
|FFFBBFFRLL\n| &&
|FBFFFBBLRL\n| &&
|FBBFFFBRLR\n| &&
|FBBFBFBRRL\n| &&
|FFBFFFFRRL\n| &&
|FBFBBFFLLR\n| &&
|FBFFBBFLLL\n| &&
|FBBFBFBLLR\n| &&
|BFFBBBFRRL\n| &&
|FFBBFBBLLR\n| &&
|BFBBFBFRRR\n| &&
|BFFFFFFRLR\n| &&
|FBBBFFFRLL\n| &&
|FFBFFBFLRL\n| &&
|FFBFFFFLRL\n| &&
|BBBFFFBRLR\n| &&
|BFFBFFBRLL\n| &&
|BBBFFBFLRL\n| &&
|FBBBFFBRRL\n| &&
|BFBFBFBRRR\n| &&
|FFFBBBFRLR\n| &&
|BBFFBFBLLR\n| &&
|BFBBBBFRLL\n| &&
|BBFBFFBLLR\n| &&
|FFBBFBBRRR\n| &&
|FBBBFBBLRL\n| &&
|BFBBBBFRRR\n| &&
|BFBFBFBRLL\n| &&
|BFBBFFFRRL\n| &&
|FFBFBFFRLL\n| &&
|FBBFBBFRLR\n| &&
|BFFBFFFRLL\n| &&
|BFBBBFBLRR\n| &&
|BBFFFFFRRR\n| &&
|FBFBBBBRLR\n| &&
|FFBBFBFRLR\n| &&
|FFBFFFFLLL\n| &&
|FBBFFBFRRR\n| &&
|FFBFFBFRLL\n| &&
|FBBFFBBLRR\n| &&
|FBBBFBFRLR\n| &&
|BFBBBBFLRR\n| &&
|FFBFBBBLLR\n| &&
|BFFFBBFRRR\n| &&
|FBBBFFBRLL\n| &&
|FBFBBBFLRR\n| &&
|BBFFBFFRLL\n| &&
|FBFFFFBRLL\n| &&
|FBFFBFBLRL|.
ENDMETHOD.
METHOD sanity_check.
SPLIT boarding_passes AT cl_abap_char_utilities=>newline INTO TABLE DATA(bp_tab).
result = REDUCE #( INIT r = 0
FOR boarding_pass IN bp_tab
LET seat_id = get_seat_id( boarding_pass ) IN
* NEXT r = COND #( WHEN r < seat_id THEN seat_id ELSE r ) ).
NEXT r = nmax( val1 = r val2 = seat_id ) ).
ENDMETHOD.
METHOD get_free_seat.
SPLIT boarding_passes AT cl_abap_char_utilities=>newline INTO TABLE DATA(riddle).
TYPES int_tab TYPE STANDARD TABLE OF i WITH EMPTY KEY.
DATA(seat_ids) = VALUE int_tab( FOR r IN riddle ( CONV #( get_seat_id( r ) ) ) ).
SORT seat_ids ASCENDING BY table_line.
DATA(last) = seat_ids[ 1 ].
LOOP AT seat_ids INTO DATA(id) FROM 2.
IF last + 1 <> id.
seat_id = id - 1.
RETURN.
ENDIF.
last = id.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
| 24.29704 | 93 | 0.474701 |
35e5d59056d2a553dbc74faf78f4a3a407708ce2
| 673 |
abap
|
ABAP
|
src/zcx_odin.clas.abap
|
AndreaBorgia-Abo/ODIN
|
c4047da6b5b8523aa96108cb849316d415725cfc
|
[
"MIT"
] | 11 |
2021-04-19T07:29:47.000Z
|
2022-01-06T22:34:26.000Z
|
src/zcx_odin.clas.abap
|
AndreaBorgia-Abo/ODIN
|
c4047da6b5b8523aa96108cb849316d415725cfc
|
[
"MIT"
] | 4 |
2021-04-26T07:45:09.000Z
|
2021-07-26T17:40:22.000Z
|
src/zcx_odin.clas.abap
|
AndreaBorgia-Abo/ODIN
|
c4047da6b5b8523aa96108cb849316d415725cfc
|
[
"MIT"
] | 5 |
2021-04-26T11:32:58.000Z
|
2022-02-09T16:59:19.000Z
|
class ZCX_ODIN definition
public
inheriting from CX_STATIC_CHECK
create public .
public section.
constants ZCX_FDOC type SOTR_CONC value '005056977EF71EEB9AF9D255B6CC868D' ##NO_TEXT.
data TEXT type STRING .
methods CONSTRUCTOR
importing
!TEXTID like TEXTID optional
!PREVIOUS like PREVIOUS optional
!TEXT type STRING optional .
protected section.
private section.
ENDCLASS.
CLASS ZCX_ODIN IMPLEMENTATION.
method CONSTRUCTOR ##ADT_SUPPRESS_GENERATION.
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
TEXTID = TEXTID
PREVIOUS = PREVIOUS
.
IF textid IS INITIAL.
me->textid = ZCX_FDOC .
ENDIF.
me->TEXT = TEXT .
endmethod.
ENDCLASS.
| 18.189189 | 87 | 0.756315 |
35e7140044e5a54152ffb58184feacf0121887c7
| 7,612 |
abap
|
ABAP
|
src/objects/zcl_abapgit_object_ssst.clas.abap
|
qinhanguyun/abapGit
|
272925fff7625a65a22825b546790948769f1556
|
[
"MIT"
] | null | null | null |
src/objects/zcl_abapgit_object_ssst.clas.abap
|
qinhanguyun/abapGit
|
272925fff7625a65a22825b546790948769f1556
|
[
"MIT"
] | null | null | null |
src/objects/zcl_abapgit_object_ssst.clas.abap
|
qinhanguyun/abapGit
|
272925fff7625a65a22825b546790948769f1556
|
[
"MIT"
] | 1 |
2019-12-31T11:44:14.000Z
|
2019-12-31T11:44:14.000Z
|
CLASS zcl_abapgit_object_ssst DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
CONSTANTS: c_style_active TYPE tdactivate VALUE 'A'.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS validate_font
IMPORTING iv_tdfamily TYPE tdfamily
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_SSST IMPLEMENTATION.
METHOD validate_font.
DATA: lv_tdfamily TYPE tfo01-tdfamily.
SELECT SINGLE tdfamily FROM tfo01 INTO lv_tdfamily
WHERE tdfamily = iv_tdfamily.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Font family not found' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
SELECT SINGLE lastuser FROM stxsadm INTO rv_user
WHERE stylename = ms_item-obj_name.
IF sy-subrc <> 0.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_stylename TYPE tdssname.
lv_stylename = ms_item-obj_name.
CALL FUNCTION 'SSF_DELETE_STYLE'
EXPORTING
i_stylename = lv_stylename
i_with_dialog = abap_false
i_with_confirm_dialog = abap_false
EXCEPTIONS
no_name = 1
no_style = 2
style_locked = 3
cancelled = 4
no_access_permission = 5
illegal_language = 6
OTHERS = 7.
IF sy-subrc <> 0 AND sy-subrc <> 2.
zcx_abapgit_exception=>raise( 'error from SSF_DELETE_STYLE' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
* see fm SSF_UPLOAD_STYLE
DATA: ls_header TYPE ssfcats,
ls_new_header TYPE ssfcats,
lt_paragraphs TYPE TABLE OF ssfparas,
lt_strings TYPE TABLE OF ssfstrings,
lt_tabstops TYPE TABLE OF stxstab.
FIELD-SYMBOLS: <lv_spras> TYPE spras.
io_xml->read( EXPORTING iv_name = 'HEADER'
CHANGING cg_data = ls_header ).
io_xml->read( EXPORTING iv_name = 'SSFPARAS'
CHANGING cg_data = lt_paragraphs ).
io_xml->read( EXPORTING iv_name = 'SSFSTRINGS'
CHANGING cg_data = lt_strings ).
io_xml->read( EXPORTING iv_name = 'STXSTAB'
CHANGING cg_data = lt_tabstops ).
validate_font( ls_header-tdfamily ).
CALL FUNCTION 'SSF_READ_STYLE' "Just load FG
EXPORTING
i_style_name = ls_header-stylename
i_style_active_flag = 'A'
EXCEPTIONS
OTHERS = 0.
set_default_package( iv_package ).
ASSIGN ('(SAPLSTXBS)MASTER_LANGUAGE') TO <lv_spras>.
IF sy-subrc = 0.
<lv_spras> = ls_header-masterlang.
ENDIF.
tadir_insert( iv_package ).
CALL FUNCTION 'SSF_SAVE_STYLE'
EXPORTING
i_header = ls_header
IMPORTING
e_header = ls_new_header
TABLES
i_paragraphs = lt_paragraphs
i_strings = lt_strings
i_tabstops = lt_tabstops.
IF ls_new_header IS NOT INITIAL.
CALL FUNCTION 'SSF_ACTIVATE_STYLE'
EXPORTING
i_stylename = ls_header-stylename
EXCEPTIONS
no_name = 1
no_style = 2
cancelled = 3
no_access_permission = 4
illegal_language = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SSF_ACTIVATE_STYLE' ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_stylename TYPE stxsadm-stylename.
SELECT SINGLE stylename
FROM stxshead INTO lv_stylename
WHERE active = c_style_active
AND stylename = ms_item-obj_name
AND vari = ''.
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-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'E_SMSTYLE'
iv_argument = |{ ms_item-obj_name }| ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: ls_bcdata TYPE bdcdata,
lt_bcdata TYPE STANDARD TABLE OF bdcdata.
ls_bcdata-program = 'SAPMSSFS'.
ls_bcdata-dynpro = '0100'.
ls_bcdata-dynbegin = 'X'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'SSFSCREENS-SNAME'.
ls_bcdata-fval = ms_item-obj_name.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'BDC_OKCODE'.
ls_bcdata-fval = '=DISPLAY'.
APPEND ls_bcdata TO lt_bcdata.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'SMARTSTYLES'
mode_val = 'E'
TABLES
using_tab = lt_bcdata
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, SSST' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
* see fm SSF_DOWNLOAD_STYLE
DATA: lv_style_name TYPE tdssname,
ls_header TYPE ssfcats,
lt_paragraphs TYPE TABLE OF ssfparas,
lt_strings TYPE TABLE OF ssfstrings,
lt_tabstops TYPE TABLE OF stxstab.
lv_style_name = ms_item-obj_name.
CALL FUNCTION 'SSF_READ_STYLE'
EXPORTING
i_style_name = lv_style_name
i_style_active_flag = c_style_active
i_style_variant = '%MAIN'
i_style_language = mv_language
IMPORTING
e_header = ls_header
TABLES
e_paragraphs = lt_paragraphs
e_strings = lt_strings
e_tabstops = lt_tabstops
EXCEPTIONS
no_name = 1
no_style = 2
active_style_not_found = 3
inactive_style_not_found = 4
no_variant = 5
no_main_variant = 6
cancelled = 7
no_access_permission = 8
OTHERS = 9.
IF sy-subrc = 2.
RETURN.
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from SSF_READ_STYLE' ).
ENDIF.
CLEAR ls_header-version.
CLEAR ls_header-firstuser.
CLEAR ls_header-firstdate.
CLEAR ls_header-firsttime.
CLEAR ls_header-lastuser.
CLEAR ls_header-lastdate.
CLEAR ls_header-lasttime.
io_xml->add( iv_name = 'HEADER'
ig_data = ls_header ).
io_xml->add( ig_data = lt_paragraphs
iv_name = 'SSFPARAS' ).
io_xml->add( ig_data = lt_strings
iv_name = 'SSFSTRINGS' ).
io_xml->add( ig_data = lt_tabstops
iv_name = 'STXSTAB' ).
ENDMETHOD.
ENDCLASS.
| 26.158076 | 96 | 0.620205 |
35e7ae29c558f9807b0fcb5091fb4f62d351f418
| 5,561 |
abap
|
ABAP
|
src/demo/z_xtt_demo_n131.prog.abap
|
bizhuka/x
|
39fe24c6f62746215dc6e1e1f9ef6df8f0c25862
|
[
"Apache-2.0"
] | 25 |
2019-03-08T08:03:41.000Z
|
2021-11-28T20:19:12.000Z
|
src/demo/z_xtt_demo_n131.prog.abap
|
bizhuka/x
|
39fe24c6f62746215dc6e1e1f9ef6df8f0c25862
|
[
"Apache-2.0"
] | 10 |
2018-02-09T09:54:19.000Z
|
2021-05-19T07:02:21.000Z
|
src/demo/z_xtt_demo_n131.prog.abap
|
bizhuka/x
|
39fe24c6f62746215dc6e1e1f9ef6df8f0c25862
|
[
"Apache-2.0"
] | 10 |
2019-03-08T08:03:42.000Z
|
2021-04-03T12:54:54.000Z
|
*&---------------------------------------------------------------------*
* Instead of writing pretty long expression like this
* {R;cond=value-VORNA+2(1)}
* You can write in a short form
* {R:v-VORNA+2(1)}
*&---------------------------------------------------------------------*
CLASS lcl_demo_131 DEFINITION INHERITING FROM lcl_demo.
PUBLIC SECTION.
TYPES:
" dynamic screen
BEGIN OF ts_screen_context,
s_pernr TYPE RANGE OF pernr_d, " ANLAV-PERNR "for SH PREM
p_max_count TYPE sytabix,
END OF ts_screen_context,
" report structure
BEGIN OF ts_root,
pernr TYPE pernr_d,
nachn TYPE c LENGTH 40, "P0002-NACHN,
vorna TYPE c LENGTH 40, "P0002-VORNA,
midnm TYPE c LENGTH 40, "P0002-MIDNM,
gesch TYPE c LENGTH 1, "P0002-GESCH,
gbdat TYPE d, "P0002-GBDAT,
perid TYPE c LENGTH 20, "P0002-PERID,
photo TYPE xstring,
END OF ts_root,
tt_root TYPE STANDARD TABLE OF ts_root WITH DEFAULT KEY.
METHODS:
get_desc_text REDEFINITION,
* get_url_base REDEFINITION,
set_merge_info REDEFINITION,
get_templates REDEFINITION,
_get_screen_context
IMPORTING
io_report TYPE REF TO lcl_report
RETURNING VALUE(rs_screen_context) TYPE REF TO ts_screen_context,
_get_root
IMPORTING
is_screen_context TYPE ts_screen_context
RETURNING VALUE(rt_root) TYPE tt_root,
_get_photo
IMPORTING
iv_pernr TYPE pernr_d
RETURNING VALUE(rv_photo) TYPE xstring.
ENDCLASS.
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
CLASS lcl_demo_131 IMPLEMENTATION.
METHOD get_desc_text.
rv_desc_text = 'Shorthand for COND #( )'(131).
ENDMETHOD.
* METHOD get_url_base.
* rv_url_base = '/xtt/cond/shorthand/'.
* ENDMETHOD.
METHOD _get_screen_context.
CREATE DATA rs_screen_context.
rs_screen_context->p_max_count = 5.
" Test mode?
CHECK io_report->mo_injection IS INITIAL.
TRY.
DATA lo_screen TYPE REF TO zcl_eui_screen.
CREATE OBJECT lo_screen
EXPORTING
iv_dynnr = zcl_eui_screen=>mc_dynnr-dynamic
ir_context = rs_screen_context.
DATA lo_error TYPE REF TO zcx_eui_exception.
CATCH zcx_eui_exception INTO lo_error.
MESSAGE lo_error TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDTRY.
lo_screen->customize( name = 'P_MAX_COUNT'
required = '1'
iv_label = 'Max. Personnel Number'(mpn) ).
DATA lv_col_end TYPE i.
lo_screen->get_dimension( IMPORTING ev_col_end = lv_col_end ).
lo_screen->popup( iv_col_end = lv_col_end ). " 114 IF lo_screen->set_status( VALUE #( title = '' ) ).
CHECK lo_screen->show( ) <> 'OK'.
" Cancel is pressed
CLEAR rs_screen_context.
ENDMETHOD.
METHOD _get_root.
SELECT DISTINCT pernr nachn vorna midnm gesch gbdat perid
INTO CORRESPONDING FIELDS OF TABLE rt_root
FROM ('PA0002') " No HR in sandbox
UP TO is_screen_context-p_max_count ROWS
WHERE pernr IN is_screen_context-s_pernr[]
AND endda GE sy-datum
AND begda LE sy-datum
AND sprps NE 'X'
ORDER BY pernr.
DATA lr_root TYPE REF TO ts_root.
LOOP AT rt_root REFERENCE INTO lr_root.
" All to_upper
TRANSLATE: lr_root->nachn TO UPPER CASE,
lr_root->vorna TO UPPER CASE,
lr_root->midnm TO UPPER CASE.
lr_root->photo = _get_photo( lr_root->pernr ).
ENDLOOP.
ENDMETHOD.
METHOD _get_photo.
DATA lv_objkey TYPE swotobjid-objkey.
CONCATENATE iv_pernr '%' INTO lv_objkey.
DATA lt_connection TYPE STANDARD TABLE OF bdn_con.
CALL FUNCTION 'BDS_ALL_CONNECTIONS_GET'
EXPORTING
classname = 'PREL'
classtype = 'CL'
objkey = lv_objkey
TABLES
all_connections = lt_connection
EXCEPTIONS
OTHERS = 5.
DATA lr_connection TYPE REF TO bdn_con.
LOOP AT lt_connection REFERENCE INTO lr_connection WHERE doc_type EQ 'HRICOLFOTO' OR doc_type EQ 'HRIEMPFOTO'.
DATA: lt_info TYPE TABLE OF scms_acinf, lr_info TYPE REF TO scms_acinf,
lt_bin TYPE TABLE OF sdokcntbin.
CLEAR: lt_info, lt_bin.
CALL FUNCTION 'SCMS_DOC_READ'
EXPORTING
stor_cat = space
crep_id = lr_connection->contrep
doc_id = lr_connection->bds_docid
TABLES
access_info = lt_info
content_bin = lt_bin
EXCEPTIONS
OTHERS = 15.
CHECK sy-subrc = 0 AND lt_info[] IS NOT INITIAL AND lt_bin IS NOT INITIAL.
READ TABLE lt_info REFERENCE INTO lr_info INDEX 1.
rv_photo = zcl_eui_conv=>binary_to_xstring( it_table = lt_bin
iv_length = lr_info->comp_size ).
RETURN.
ENDLOOP.
ENDMETHOD.
METHOD set_merge_info.
DATA lr_screen_context TYPE REF TO ts_screen_context.
lr_screen_context = _get_screen_context( io_report ).
CHECK lr_screen_context IS NOT INITIAL.
DATA lt_root TYPE tt_root.
lt_root = _get_root( lr_screen_context->* ).
io_report->merge_add_one( lt_root ).
ENDMETHOD.
METHOD get_templates.
APPEND `ZXXT_DEMO_131-XLSX` TO rt_templates.
APPEND `ZXXT_DEMO_131-DOCX` TO rt_templates.
ENDMETHOD.
ENDCLASS.
| 32.905325 | 114 | 0.608883 |
35ea5633f8bee8565b59a371a9d39efe44b23bd4
| 7,451 |
abap
|
ABAP
|
src/objects/core/zcl_abapgit_filename_logic.clas.testclasses.abap
|
IvxLars/abapGit
|
bcdeebb3ad1432034b5ad1ea40683470956b8e07
|
[
"MIT"
] | 797 |
2015-02-06T15:38:41.000Z
|
2020-09-23T02:57:02.000Z
|
src/objects/core/zcl_abapgit_filename_logic.clas.testclasses.abap
|
IvxLars/abapGit
|
bcdeebb3ad1432034b5ad1ea40683470956b8e07
|
[
"MIT"
] | 2,776 |
2015-01-13T03:59:55.000Z
|
2020-09-23T21:46:34.000Z
|
src/objects/core/zcl_abapgit_filename_logic.clas.testclasses.abap
|
IvxLars/abapGit
|
bcdeebb3ad1432034b5ad1ea40683470956b8e07
|
[
"MIT"
] | 499 |
2015-01-13T03:41:36.000Z
|
2020-09-22T11:50:54.000Z
|
CLASS ltcl_run_checks DEFINITION DEFERRED.
CLASS zcl_abapgit_filename_logic DEFINITION LOCAL FRIENDS ltcl_run_checks.
CLASS ltcl_run_checks DEFINITION FOR TESTING RISK LEVEL HARMLESS
DURATION SHORT FINAL.
PRIVATE SECTION.
DATA mo_dot TYPE REF TO zcl_abapgit_dot_abapgit.
METHODS:
setup,
file_to_object FOR TESTING RAISING zcx_abapgit_exception,
object_to_file FOR TESTING RAISING zcx_abapgit_exception,
file_to_object_pack FOR TESTING RAISING zcx_abapgit_exception,
object_to_file_pack FOR TESTING RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ltcl_run_checks IMPLEMENTATION.
METHOD setup.
" Assume for unit tests that starting folder is /src/ with prefix logic
mo_dot = zcl_abapgit_dot_abapgit=>build_default( ).
ENDMETHOD.
METHOD file_to_object.
DATA ls_item TYPE zif_abapgit_definitions=>ty_item.
DATA lv_is_xml TYPE abap_bool.
DATA lv_is_json TYPE abap_bool.
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'zprogram.prog.abap'
iv_path = '/src/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item
ev_is_xml = lv_is_xml ).
cl_abap_unit_assert=>assert_equals(
exp = 'PROG'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = 'ZPROGRAM'
act = ls_item-obj_name ).
cl_abap_unit_assert=>assert_equals(
exp = abap_false
act = lv_is_xml ).
" Subpackage
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'zprogram.prog.abap'
iv_path = '/src/subpack/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item
ev_is_xml = lv_is_xml ).
cl_abap_unit_assert=>assert_equals(
exp = 'PROG'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = 'ZPROGRAM'
act = ls_item-obj_name ).
cl_abap_unit_assert=>assert_equals(
exp = abap_false
act = lv_is_xml ).
" XML
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'zprogram.prog.xml'
iv_path = '/src/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item
ev_is_xml = lv_is_xml ).
cl_abap_unit_assert=>assert_equals(
exp = 'PROG'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = 'ZPROGRAM'
act = ls_item-obj_name ).
cl_abap_unit_assert=>assert_equals(
exp = abap_true
act = lv_is_xml ).
" With special characters
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'ztest%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3dvc.prog.abap'
iv_path = '/src/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item
ev_is_xml = lv_is_xml ).
cl_abap_unit_assert=>assert_equals(
exp = 'PROG'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = 'ZTEST=========================VC'
act = ls_item-obj_name ).
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'zmime_%3c%3e_%3f.w3mi.jpg'
iv_path = '/src/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item
ev_is_xml = lv_is_xml ).
cl_abap_unit_assert=>assert_equals(
exp = 'W3MI'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = 'ZMIME_<>_?'
act = ls_item-obj_name ).
" JSON
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'ztest.chko.json'
iv_path = '/src/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item
ev_is_json = lv_is_json ).
cl_abap_unit_assert=>assert_equals(
exp = 'CHKO'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = 'ZTEST'
act = ls_item-obj_name ).
cl_abap_unit_assert=>assert_equals(
exp = abap_true
act = lv_is_json ).
ENDMETHOD.
METHOD object_to_file.
DATA ls_item TYPE zif_abapgit_definitions=>ty_item.
DATA lv_filename TYPE string.
ls_item-obj_type = 'PROG'.
ls_item-obj_name = 'ZPROGRAM'.
lv_filename = zcl_abapgit_filename_logic=>object_to_file(
is_item = ls_item
iv_ext = 'abap' ).
cl_abap_unit_assert=>assert_equals(
exp = 'zprogram.prog.abap'
act = lv_filename ).
" With namespace
ls_item-obj_type = 'PROG'.
ls_item-obj_name = '/TEST/ZPROGRAM'.
lv_filename = zcl_abapgit_filename_logic=>object_to_file(
is_item = ls_item
iv_ext = 'abap' ).
cl_abap_unit_assert=>assert_equals(
exp = '#test#zprogram.prog.abap'
act = lv_filename ).
" With extra extension
ls_item-obj_type = 'CLAS'.
ls_item-obj_name = 'ZCLASS'.
lv_filename = zcl_abapgit_filename_logic=>object_to_file(
is_item = ls_item
iv_ext = 'abap'
iv_extra = 'testclasses' ).
cl_abap_unit_assert=>assert_equals(
exp = 'zclass.clas.testclasses.abap'
act = lv_filename ).
" With special characters
ls_item-obj_type = 'PROG'.
ls_item-obj_name = 'ZTEST=========================VC'.
lv_filename = zcl_abapgit_filename_logic=>object_to_file(
is_item = ls_item
iv_ext = 'abap' ).
cl_abap_unit_assert=>assert_equals(
exp = 'ztest%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3d%3dvc.prog.abap'
act = lv_filename ).
ls_item-obj_type = 'W3MI'.
ls_item-obj_name = 'ZMIME_<>_?'.
lv_filename = zcl_abapgit_filename_logic=>object_to_file(
is_item = ls_item
iv_ext = 'jpg' ).
cl_abap_unit_assert=>assert_equals(
exp = 'zmime_%3c%3e_%3f.w3mi.jpg'
act = lv_filename ).
ENDMETHOD.
METHOD file_to_object_pack.
DATA ls_item TYPE zif_abapgit_definitions=>ty_item.
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'package.devc.xml'
iv_path = '/src/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item ).
cl_abap_unit_assert=>assert_equals(
exp = 'DEVC'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = '$PACK'
act = ls_item-obj_name ).
" Subpackage
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = 'package.devc.xml'
iv_path = '/src/subpack/'
iv_devclass = '$PACK'
io_dot = mo_dot
IMPORTING
es_item = ls_item ).
cl_abap_unit_assert=>assert_equals(
exp = 'DEVC'
act = ls_item-obj_type ).
cl_abap_unit_assert=>assert_equals(
exp = '$PACK_SUBPACK'
act = ls_item-obj_name ).
ENDMETHOD.
METHOD object_to_file_pack.
DATA ls_item TYPE zif_abapgit_definitions=>ty_item.
DATA lv_filename TYPE string.
ls_item-obj_type = 'DEVC'.
ls_item-obj_name = 'ZPACKAGE'.
lv_filename = zcl_abapgit_filename_logic=>object_to_file(
is_item = ls_item
iv_ext = 'xml' ).
cl_abap_unit_assert=>assert_equals(
exp = 'package.devc.xml'
act = lv_filename ).
ENDMETHOD.
ENDCLASS.
| 26.802158 | 115 | 0.636156 |
35ea70cf805dab212b36f5831acd870d543e4472
| 504 |
abap
|
ABAP
|
src/zcl_leap_example.clas.abap
|
mbtools/ABAP-Exercism-Examples
|
5e3c5e323f892043743968c7defdb7bb5d059fca
|
[
"MIT"
] | 2 |
2022-03-24T23:00:40.000Z
|
2022-03-25T11:28:40.000Z
|
src/zcl_leap_example.clas.abap
|
mbtools/ABAP-Exercism-Examples
|
5e3c5e323f892043743968c7defdb7bb5d059fca
|
[
"MIT"
] | null | null | null |
src/zcl_leap_example.clas.abap
|
mbtools/ABAP-Exercism-Examples
|
5e3c5e323f892043743968c7defdb7bb5d059fca
|
[
"MIT"
] | null | null | null |
CLASS zcl_leap_example DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
METHODS leap
IMPORTING
!year TYPE i
RETURNING
VALUE(result) TYPE abap_bool .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_leap_example IMPLEMENTATION.
METHOD leap.
IF year MOD 4 = 0 AND year MOD 100 <> 0.
result = abap_true.
ELSEIF year MOD 400 = 0.
result = abap_true.
ELSE.
result = abap_false.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 16.258065 | 44 | 0.636905 |
35eb3c692f8a022d3b72fd11a991e6b99686eea4
| 1,770 |
abap
|
ABAP
|
test_v2/test006/zcl_icf_serv006.clas.abap
|
abap-openapi/abap-openapi
|
0c2c7fc8b4f47e415e6bcc375af388e1935c1f03
|
[
"MIT"
] | 1 |
2022-03-19T22:37:53.000Z
|
2022-03-19T22:37:53.000Z
|
test_v2/test006/zcl_icf_serv006.clas.abap
|
abap-openapi/abap-openapi
|
0c2c7fc8b4f47e415e6bcc375af388e1935c1f03
|
[
"MIT"
] | null | null | null |
test_v2/test006/zcl_icf_serv006.clas.abap
|
abap-openapi/abap-openapi
|
0c2c7fc8b4f47e415e6bcc375af388e1935c1f03
|
[
"MIT"
] | null | null | null |
CLASS zcl_icf_serv006 DEFINITION PUBLIC.
* Auto generated by https://github.com/abap-openapi/abap-openapi
PUBLIC SECTION.
INTERFACES if_http_extension.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_icf_serv006 IMPLEMENTATION.
METHOD if_http_extension~handle_request.
DATA li_handler TYPE REF TO zif_interface006.
DATA lv_method TYPE string.
DATA lv_path TYPE string.
CREATE OBJECT li_handler TYPE zcl_icf_impl006.
lv_path = server->request->get_header_field( '~path' ).
lv_method = server->request->get_method( ).
TRY.
IF lv_path = '/test' AND lv_method = 'POST'.
DATA _test TYPE zif_interface006=>posttestrequest.
/ui2/cl_json=>deserialize(
EXPORTING
json = server->request->get_cdata( )
CHANGING
data = _test ).
DATA ret__test TYPE zif_interface006=>ret__test.
ret__test = li_handler->_test(
separator = server->request->get_form_field( 'separator' )
body = _test ).
IF ret__test-200 IS NOT INITIAL.
server->response->set_content_type( 'application/json' ).
server->response->set_cdata( /ui2/cl_json=>serialize( ret__test-200 ) ).
server->response->set_status( code = 200 reason = 'OK' ).
RETURN.
ENDIF.
ENDIF.
CATCH cx_static_check.
server->response->set_content_type( 'text/plain' ).
server->response->set_cdata( 'exception' ).
server->response->set_status( code = 500 reason = 'Error' ).
ENDTRY.
server->response->set_content_type( 'text/plain' ).
server->response->set_cdata( 'no handler found' ).
server->response->set_status( code = 500 reason = 'Error' ).
ENDMETHOD.
ENDCLASS.
| 37.659574 | 84 | 0.643503 |
35eb46277da388faaec4a927da1bfd6fecd72047
| 13,910 |
abap
|
ABAP
|
src/zcx_abapgit_exception.clas.abap
|
ed-holland/abapGit
|
380508d72c02f37f15344165411fc5a145f73e72
|
[
"MIT"
] | null | null | null |
src/zcx_abapgit_exception.clas.abap
|
ed-holland/abapGit
|
380508d72c02f37f15344165411fc5a145f73e72
|
[
"MIT"
] | null | null | null |
src/zcx_abapgit_exception.clas.abap
|
ed-holland/abapGit
|
380508d72c02f37f15344165411fc5a145f73e72
|
[
"MIT"
] | null | null | null |
"! abapGit general error
CLASS zcx_abapgit_exception DEFINITION
PUBLIC
INHERITING FROM cx_static_check
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_t100_message .
CONSTANTS:
BEGIN OF c_section_text,
cause TYPE string VALUE `Cause`,
system_response TYPE string VALUE `System response`,
what_to_do TYPE string VALUE `Procedure`,
sys_admin TYPE string VALUE `System administration`,
END OF c_section_text .
CONSTANTS:
BEGIN OF c_section_token,
cause TYPE string VALUE `&CAUSE&`,
system_response TYPE string VALUE `&SYSTEM_RESPONSE&`,
what_to_do TYPE string VALUE `&WHAT_TO_DO&`,
sys_admin TYPE string VALUE `&SYS_ADMIN&`,
END OF c_section_token .
DATA msgv1 TYPE symsgv READ-ONLY .
DATA msgv2 TYPE symsgv READ-ONLY .
DATA msgv3 TYPE symsgv READ-ONLY .
DATA msgv4 TYPE symsgv READ-ONLY .
DATA mv_longtext TYPE string READ-ONLY.
DATA mt_callstack TYPE abap_callstack READ-ONLY.
DATA mi_log TYPE REF TO zif_abapgit_log READ-ONLY.
"! Raise exception with text
"! @parameter iv_text | Text
"! @parameter ix_previous | Previous exception
"! @parameter ii_log | Log
"! @parameter iv_longtext | Longtext
"! @raising zcx_abapgit_exception | Exception
CLASS-METHODS raise
IMPORTING
!iv_text TYPE clike
!ix_previous TYPE REF TO cx_root OPTIONAL
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
!iv_longtext TYPE csequence OPTIONAL
RAISING
zcx_abapgit_exception .
"! Raise exception with T100 message
"! <p>
"! Will default to sy-msg* variables. These need to be set right before calling this method.
"! </p>
"! @parameter iv_msgid | Message ID
"! @parameter iv_msgno | Message number
"! @parameter iv_msgv1 | Message variable 1
"! @parameter iv_msgv2 | Message variable 2
"! @parameter iv_msgv3 | Message variable 3
"! @parameter iv_msgv4 | Message variable 4
"! @parameter ii_log | Log
"! @parameter ix_previous | Previous exception
"! @parameter iv_longtext | Longtext
"! @raising zcx_abapgit_exception | Exception
CLASS-METHODS raise_t100
IMPORTING
VALUE(iv_msgid) TYPE symsgid DEFAULT sy-msgid
VALUE(iv_msgno) TYPE symsgno DEFAULT sy-msgno
VALUE(iv_msgv1) TYPE symsgv DEFAULT sy-msgv1
VALUE(iv_msgv2) TYPE symsgv DEFAULT sy-msgv2
VALUE(iv_msgv3) TYPE symsgv DEFAULT sy-msgv3
VALUE(iv_msgv4) TYPE symsgv DEFAULT sy-msgv4
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
!ix_previous TYPE REF TO cx_root OPTIONAL
!iv_longtext TYPE csequence OPTIONAL
RAISING
zcx_abapgit_exception .
"! Raise with text from previous exception
"! @parameter ix_previous | Previous exception
"! @parameter iv_longtext | Longtext
"! @raising zcx_abapgit_exception | Exception
CLASS-METHODS raise_with_text
IMPORTING
!ix_previous TYPE REF TO cx_root
!iv_longtext TYPE csequence OPTIONAL
RAISING
zcx_abapgit_exception .
METHODS constructor
IMPORTING
!textid LIKE if_t100_message=>t100key OPTIONAL
!previous LIKE previous OPTIONAL
!log TYPE REF TO zif_abapgit_log OPTIONAL
!msgv1 TYPE symsgv OPTIONAL
!msgv2 TYPE symsgv OPTIONAL
!msgv3 TYPE symsgv OPTIONAL
!msgv4 TYPE symsgv OPTIONAL
!longtext TYPE csequence OPTIONAL .
METHODS get_source_position
REDEFINITION .
METHODS if_message~get_longtext
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS c_generic_error_msg TYPE string VALUE `An error occured (ZCX_ABAPGIT_EXCEPTION)`.
CLASS-METHODS split_text_to_symsg
IMPORTING
!iv_text TYPE string
RETURNING
VALUE(rs_msg) TYPE symsg .
METHODS save_callstack .
METHODS itf_to_string
IMPORTING
!it_itf TYPE tline_tab
RETURNING
VALUE(rv_result) TYPE string .
METHODS get_t100_longtext_itf
RETURNING
VALUE(rt_itf) TYPE tline_tab .
METHODS remove_empty_section
IMPORTING
!iv_tabix_from TYPE i
!iv_tabix_to TYPE i
CHANGING
!ct_itf TYPE tline_tab .
METHODS replace_section_head_with_text
CHANGING
!cs_itf TYPE tline .
CLASS-METHODS remove_newlines_from_string
IMPORTING
iv_string TYPE string
RETURNING
VALUE(rv_result) TYPE string.
ENDCLASS.
CLASS ZCX_ABAPGIT_EXCEPTION IMPLEMENTATION.
METHOD constructor ##ADT_SUPPRESS_GENERATION.
super->constructor( previous = previous ).
me->msgv1 = msgv1.
me->msgv2 = msgv2.
me->msgv3 = msgv3.
me->msgv4 = msgv4.
mi_log = log.
mv_longtext = longtext.
CLEAR me->textid.
IF textid IS INITIAL.
if_t100_message~t100key = if_t100_message=>default_textid.
ELSE.
if_t100_message~t100key = textid.
ENDIF.
save_callstack( ).
ENDMETHOD.
METHOD get_source_position.
FIELD-SYMBOLS: <ls_callstack> TYPE abap_callstack_line.
READ TABLE mt_callstack ASSIGNING <ls_callstack>
INDEX 1.
IF sy-subrc = 0.
program_name = <ls_callstack>-mainprogram.
include_name = <ls_callstack>-include.
source_line = <ls_callstack>-line.
ELSE.
super->get_source_position(
IMPORTING
program_name = program_name
include_name = include_name
source_line = source_line ).
ENDIF.
ENDMETHOD.
METHOD get_t100_longtext_itf.
DATA: lv_docu_key TYPE doku_obj.
FIELD-SYMBOLS <lv_msgv> TYPE any.
lv_docu_key = if_t100_message~t100key-msgid && if_t100_message~t100key-msgno.
CALL FUNCTION 'DOCU_GET'
EXPORTING
id = 'NA'
langu = sy-langu
object = lv_docu_key
typ = 'E'
TABLES
line = rt_itf
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
ASSIGN me->(if_t100_message~t100key-attr1) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V1&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ASSIGN me->(if_t100_message~t100key-attr2) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V2&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ASSIGN me->(if_t100_message~t100key-attr3) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V3&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ASSIGN me->(if_t100_message~t100key-attr4) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V4&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD if_message~get_longtext.
DATA: lv_preserve_newlines_handled TYPE abap_bool VALUE abap_false.
IF mv_longtext IS NOT INITIAL.
result = mv_longtext.
ELSEIF if_t100_message~t100key IS NOT INITIAL.
result = itf_to_string( get_t100_longtext_itf( ) ).
ELSE.
result = super->get_longtext( preserve_newlines ).
lv_preserve_newlines_handled = abap_true.
ENDIF.
IF lv_preserve_newlines_handled = abap_false AND preserve_newlines = abap_false.
result = remove_newlines_from_string( result ).
ENDIF.
ENDMETHOD.
METHOD itf_to_string.
CONSTANTS: lc_format_section TYPE string VALUE 'U1'.
DATA:
lt_stream TYPE TABLE OF tdline,
lt_string TYPE TABLE OF string,
lv_string LIKE LINE OF lt_string,
lt_itf TYPE tline_tab,
lv_has_content TYPE abap_bool,
lv_tabix_from TYPE syst-tabix,
lv_tabix_to TYPE syst-tabix.
FIELD-SYMBOLS: <ls_itf_section> TYPE tline,
<ls_itf_section_item> TYPE tline.
lt_itf = it_itf.
" You should remember that we replace the U1 format because
" that preserves the section header of longtexts.
LOOP AT lt_itf ASSIGNING <ls_itf_section>
WHERE tdformat = lc_format_section.
CLEAR:
lv_has_content,
lv_tabix_to.
lv_tabix_from = sy-tabix.
LOOP AT lt_itf ASSIGNING <ls_itf_section_item>
FROM sy-tabix + 1.
IF <ls_itf_section_item>-tdformat = lc_format_section.
lv_tabix_to = sy-tabix.
EXIT.
ELSEIF <ls_itf_section_item>-tdline IS NOT INITIAL.
lv_has_content = abap_true.
ENDIF.
ENDLOOP.
IF lv_has_content = abap_false.
remove_empty_section(
EXPORTING
iv_tabix_from = lv_tabix_from
iv_tabix_to = lv_tabix_to
CHANGING
ct_itf = lt_itf ).
CONTINUE.
ENDIF.
replace_section_head_with_text( CHANGING cs_itf = <ls_itf_section> ).
ENDLOOP.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
EXPORTING
lf = 'X'
IMPORTING
stream_lines = lt_string
TABLES
itf_text = lt_itf
text_stream = lt_stream.
LOOP AT lt_string INTO lv_string.
IF sy-tabix = 1.
rv_result = lv_string.
ELSE.
CONCATENATE rv_result lv_string
INTO rv_result
SEPARATED BY cl_abap_char_utilities=>newline.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD raise.
DATA lv_text TYPE string.
IF iv_text IS INITIAL.
lv_text = c_generic_error_msg.
ELSE.
lv_text = iv_text.
ENDIF.
split_text_to_symsg( lv_text ).
raise_t100(
ii_log = ii_log
ix_previous = ix_previous
iv_longtext = iv_longtext ).
ENDMETHOD.
METHOD raise_t100.
DATA: ls_t100_key TYPE scx_t100key.
ls_t100_key-msgid = iv_msgid.
ls_t100_key-msgno = iv_msgno.
ls_t100_key-attr1 = 'MSGV1'.
ls_t100_key-attr2 = 'MSGV2'.
ls_t100_key-attr3 = 'MSGV3'.
ls_t100_key-attr4 = 'MSGV4'.
IF iv_msgid IS INITIAL.
CLEAR ls_t100_key.
ENDIF.
RAISE EXCEPTION TYPE zcx_abapgit_exception
EXPORTING
textid = ls_t100_key
log = ii_log
msgv1 = iv_msgv1
msgv2 = iv_msgv2
msgv3 = iv_msgv3
msgv4 = iv_msgv4
previous = ix_previous
longtext = iv_longtext.
ENDMETHOD.
METHOD raise_with_text.
raise(
iv_text = ix_previous->get_text( )
ix_previous = ix_previous
iv_longtext = iv_longtext ).
ENDMETHOD.
METHOD remove_empty_section.
IF iv_tabix_to BETWEEN iv_tabix_from AND lines( ct_itf ).
DELETE ct_itf FROM iv_tabix_from TO iv_tabix_to.
ELSE.
DELETE ct_itf FROM iv_tabix_from.
ENDIF.
ENDMETHOD.
METHOD remove_newlines_from_string.
rv_result = iv_string.
REPLACE ALL OCCURRENCES OF ` ` && cl_abap_char_utilities=>cr_lf IN rv_result WITH ` `.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN rv_result WITH ` `.
REPLACE ALL OCCURRENCES OF ` ` && cl_abap_char_utilities=>newline IN rv_result WITH ` `.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>newline IN rv_result WITH ` `.
ENDMETHOD.
METHOD replace_section_head_with_text.
CASE cs_itf-tdline.
WHEN c_section_token-cause.
cs_itf-tdline = c_section_text-cause.
WHEN c_section_token-system_response.
cs_itf-tdline = c_section_text-system_response.
WHEN c_section_token-what_to_do.
cs_itf-tdline = c_section_text-what_to_do.
WHEN c_section_token-sys_admin.
cs_itf-tdline = c_section_text-sys_admin.
ENDCASE.
ENDMETHOD.
METHOD save_callstack.
FIELD-SYMBOLS: <ls_callstack> TYPE abap_callstack_line.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
callstack = mt_callstack.
" You should remember that the first lines are from zcx_abapgit_exception
" and are removed so that highest level in the callstack is the position where
" the exception is raised.
"
" For the merged report it's hard to do that, because zcx_abapgit_exception
" isn't visible in the callstack. Therefore we have to check the Events.
LOOP AT mt_callstack ASSIGNING <ls_callstack>.
IF <ls_callstack>-mainprogram CP |ZCX_ABAPGIT_EXCEPTION*| " full
OR <ls_callstack>-blockname = `SAVE_CALLSTACK` " merged
OR <ls_callstack>-blockname = `CONSTRUCTOR` " merged
OR <ls_callstack>-blockname CP `RAISE*`. "merged
DELETE TABLE mt_callstack FROM <ls_callstack>.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD split_text_to_symsg.
CONSTANTS:
lc_length_of_msgv TYPE i VALUE 50,
lc_offset_of_last_character TYPE i VALUE 49.
DATA:
lv_text TYPE c LENGTH 200,
lv_rest TYPE c LENGTH 200,
ls_msg TYPE symsg,
lv_msg_var TYPE c LENGTH lc_length_of_msgv,
lv_index TYPE sy-index.
lv_text = iv_text.
DO 4 TIMES.
lv_index = sy-index.
CALL FUNCTION 'TEXT_SPLIT'
EXPORTING
length = lc_length_of_msgv
text = lv_text
IMPORTING
line = lv_msg_var
rest = lv_rest.
IF lv_msg_var+lc_offset_of_last_character(1) = space OR
lv_text+lc_length_of_msgv(1) = space.
" keep the space at the beginning of the rest
" because otherwise it's lost
lv_rest = | { lv_rest }|.
ENDIF.
lv_text = lv_rest.
CASE lv_index.
WHEN 1.
ls_msg-msgv1 = lv_msg_var.
WHEN 2.
ls_msg-msgv2 = lv_msg_var.
WHEN 3.
ls_msg-msgv3 = lv_msg_var.
WHEN 4.
ls_msg-msgv4 = lv_msg_var.
ENDCASE.
ENDDO.
" Set syst using generic error message
MESSAGE e001(00) WITH ls_msg-msgv1 ls_msg-msgv2 ls_msg-msgv3 ls_msg-msgv4 INTO sy-lisel.
rs_msg = ls_msg.
ENDMETHOD.
ENDCLASS.
| 27.987928 | 96 | 0.650395 |
35eb6a2a82eacf3788044cb93190ba35adfa6330
| 7,653 |
abap
|
ABAP
|
lbn-gtt-template-tso/ABAP/zsrc/zgtt_sof.fugr.zgtt_sof_ee_shp_arrival.abap
|
DanHaer/logistics-business-network-gtt-samples
|
739978ac389da6f3530b26cd6402a3892f4b605a
|
[
"Apache-2.0"
] | null | null | null |
lbn-gtt-template-tso/ABAP/zsrc/zgtt_sof.fugr.zgtt_sof_ee_shp_arrival.abap
|
DanHaer/logistics-business-network-gtt-samples
|
739978ac389da6f3530b26cd6402a3892f4b605a
|
[
"Apache-2.0"
] | null | null | null |
lbn-gtt-template-tso/ABAP/zsrc/zgtt_sof.fugr.zgtt_sof_ee_shp_arrival.abap
|
DanHaer/logistics-business-network-gtt-samples
|
739978ac389da6f3530b26cd6402a3892f4b605a
|
[
"Apache-2.0"
] | null | null | null |
FUNCTION zgtt_sof_ee_shp_arrival .
*"----------------------------------------------------------------------
*"*"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
*"----------------------------------------------------------------------
*----------------------------------------------------------------------*
* Top Include
* TYPE-POOLS:trxas.
*----------------------------------------------------------------------*
DATA:
* Container with references
ls_one_app_tables TYPE trxas_tabcontainer_wa,
* Definition of all event type
ls_events TYPE trxas_evt_ctab_wa,
* Bapi for message input: message Header
ls_trackingheader TYPE /saptrx/bapi_evm_header,
* Event Mapping
ls_eventid_map TYPE trxas_evtid_evtcnt_map_wa,
* Location table for event message input
ls_tracklocation TYPE /saptrx/bapi_evm_locationid,
* Shipment Stage(Leg) New
lt_xvtts TYPE STANDARD TABLE OF vttsvb,
* Shipment Stage(Leg) Old
lt_yvtts TYPE STANDARD TABLE OF vttsvb,
* Stops Info table
lt_stops TYPE zgtt_stops,
lv_relevance TYPE boole_d,
lv_cnt TYPE /saptrx/evtcnt,
lv_evtcnt TYPE /saptrx/evtcnt.
FIELD-SYMBOLS:
* Shipment Header
<ls_xvttk> TYPE vttkvb,
* Shipment Stage <leg>
<ls_xvtts> TYPE vttsvb,
* Shipment Stage <leg>
<ls_yvtts> TYPE vttsvb,
* Stops Info
<ls_stops> TYPE zgtt_stop_info.
* <1> Fill general data for all control data records
* Login Language
ls_trackingheader-language = sy-langu.
* <2> Read necessary application tables from table reference
PERFORM read_appl_tables_shipment_leg
TABLES lt_xvtts
lt_yvtts
USING i_all_appl_tables.
* <3> Loop at application objects for geting shipment item data
LOOP AT i_events INTO ls_events.
* Check if Main table is Shipment Header or not.
IF ls_events-maintabdef <> gc_bpt_shipment_header_new.
PERFORM create_logtable_et
TABLES ct_logtable
USING ls_events-maintabdef
space
i_event_type-eventdatafunc
ls_events-eventtype
i_appsys.
EXIT.
ENDIF.
* Read Main Object Table (Shipment Header - VTTKVB)
ASSIGN ls_events-maintabref->* TO <ls_xvttk>.
IF lt_stops IS INITIAL.
CALL FUNCTION 'ZGTT_GET_STOPS_FROM_SHIPMENT'
EXPORTING
iv_tknum = <ls_xvttk>-tknum
it_vtts_new = lt_xvtts
IMPORTING
et_stops = lt_stops.
SORT lt_stops BY tknum tsnum loccat.
ENDIF.
LOOP AT lt_xvtts ASSIGNING <ls_xvtts>
WHERE tknum = <ls_xvttk>-tknum.
lv_relevance = gc_false.
IF <ls_xvtts>-updkz = gc_insert.
* Date cannot be intial.Time can be initial.
IF <ls_xvtts>-daten IS NOT INITIAL.
lv_relevance = gc_true.
ENDIF.
ELSEIF <ls_xvtts>-updkz = gc_update.
READ TABLE lt_yvtts ASSIGNING <ls_yvtts>
WITH KEY tknum = <ls_xvtts>-tknum
tsnum = <ls_xvtts>-tsnum
BINARY SEARCH.
IF sy-subrc IS INITIAL.
IF <ls_xvtts>-daten IS NOT INITIAL
AND ( <ls_xvtts>-daten <> <ls_yvtts>-daten
OR <ls_xvtts>-uaten <> <ls_yvtts>-uaten ).
lv_relevance = gc_true.
ENDIF.
ENDIF.
ENDIF.
IF lv_relevance = gc_true.
READ TABLE lt_stops ASSIGNING <ls_stops>
WITH KEY tknum = <ls_xvtts>-tknum
tsnum = <ls_xvtts>-tsnum
loccat = 'D'.
IF sy-subrc IS INITIAL.
* Check In Code Set
ls_trackingheader-trxcod = 'SHIPMENT_ORDER'.
* Delivery Order Id
ls_trackingheader-trxid = <ls_xvtts>-tknum.
* < Arrival Event >
* Counter for Event
IMPORT lv_evtcnt FROM MEMORY ID 'EVTCNT'.
IF sy-subrc = 0.
lv_evtcnt = lv_evtcnt + 1.
lv_cnt = lv_evtcnt.
EXPORT lv_evtcnt TO MEMORY ID 'EVTCNT'.
FREE lv_evtcnt.
ELSE.
lv_evtcnt = 1000000000.
lv_cnt = lv_evtcnt.
EXPORT lv_evtcnt TO MEMORY ID 'EVTCNT'.
FREE lv_evtcnt.
ENDIF.
ls_trackingheader-evtcnt = lv_cnt.
* Event ID
ls_trackingheader-evtid = 'ARRIV_DEST'.
* Event Date
ls_trackingheader-evtdat = <ls_xvtts>-daten.
* Event Time
ls_trackingheader-evttim = <ls_xvtts>-uaten.
* Event Time Zone
CALL FUNCTION 'GET_SYSTEM_TIMEZONE'
IMPORTING
timezone = ls_trackingheader-evtzon
EXCEPTIONS
customizing_missing = 1
OTHERS = 2.
APPEND ls_trackingheader TO ct_trackingheader.
* Mapping table
ls_eventid_map-eventid = ls_events-eventid.
ls_eventid_map-evtcnt = lv_cnt.
APPEND ls_eventid_map TO c_eventid_map.
ls_tracklocation-evtcnt = lv_cnt.
ls_tracklocation-loccod = <ls_stops>-loctype.
ls_tracklocation-locid1 = <ls_stops>-locid.
ls_tracklocation-locid2 = <ls_stops>-stopid.
APPEND ls_tracklocation TO ct_tracklocation.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFUNCTION.
| 36.270142 | 72 | 0.626421 |
35ee22c3ace1c2ede2e2187681c648297f266d33
| 87 |
abap
|
ABAP
|
src/ztest_interface_2.intf.abap
|
mbtools/abapgit-test-syntax-error
|
9f0b00b756c94cf0f49a652c7cb5a43fb5eb64fc
|
[
"MIT"
] | null | null | null |
src/ztest_interface_2.intf.abap
|
mbtools/abapgit-test-syntax-error
|
9f0b00b756c94cf0f49a652c7cb5a43fb5eb64fc
|
[
"MIT"
] | null | null | null |
src/ztest_interface_2.intf.abap
|
mbtools/abapgit-test-syntax-error
|
9f0b00b756c94cf0f49a652c7cb5a43fb5eb64fc
|
[
"MIT"
] | null | null | null |
interface ZTEST_INTERFACE_2
public .
class-methods HELLO_WORLD_2 .
endinterface.
| 12.428571 | 31 | 0.793103 |
35f178c436b7a2318c716827488e91514f6d919c
| 3,590 |
abap
|
ABAP
|
src/zcl_ajson_mapping.clas.locals_imp.abap
|
albertmink/ajson
|
79a5d855e65ef71e6f28a02253701e23024d1ec8
|
[
"MIT"
] | 23 |
2020-07-13T17:11:24.000Z
|
2022-03-16T07:40:50.000Z
|
src/zcl_ajson_mapping.clas.locals_imp.abap
|
albertmink/ajson
|
79a5d855e65ef71e6f28a02253701e23024d1ec8
|
[
"MIT"
] | 86 |
2020-07-13T16:56:37.000Z
|
2022-03-26T10:37:59.000Z
|
src/zcl_ajson_mapping.clas.locals_imp.abap
|
albertmink/ajson
|
79a5d855e65ef71e6f28a02253701e23024d1ec8
|
[
"MIT"
] | 14 |
2020-07-29T19:10:14.000Z
|
2021-11-08T08:45:58.000Z
|
class lcl_mapping_fields implementation.
method constructor.
data ls_mapping_field like line of mt_mapping_fields.
loop at it_mapping_fields into ls_mapping_field.
ls_mapping_field-abap = to_upper( ls_mapping_field-abap ).
insert ls_mapping_field into table mt_mapping_fields.
endloop.
endmethod.
method zif_ajson_mapping~to_abap.
data ls_mapping_field like line of mt_mapping_fields.
read table mt_mapping_fields into ls_mapping_field
with key json components json = iv_name.
if sy-subrc = 0.
rv_result = ls_mapping_field-abap.
endif.
endmethod.
method zif_ajson_mapping~to_json.
data lv_field type string.
data ls_mapping_field like line of mt_mapping_fields.
lv_field = to_upper( iv_name ).
read table mt_mapping_fields into ls_mapping_field
with key abap components abap = lv_field.
if sy-subrc = 0.
rv_result = ls_mapping_field-json.
endif.
endmethod.
endclass.
class lcl_mapping_to_upper implementation.
method constructor.
mi_mapping_fields = zcl_ajson_mapping=>create_field_mapping( it_mapping_fields ).
endmethod.
method zif_ajson_mapping~to_abap.
rv_result = mi_mapping_fields->to_abap( iv_path = iv_path iv_name = iv_name ).
endmethod.
method zif_ajson_mapping~to_json.
rv_result = mi_mapping_fields->to_json( iv_path = iv_path iv_name = iv_name ).
if rv_result is not initial. " Mapping found
return.
endif.
rv_result = to_upper( iv_name ).
endmethod.
endclass.
class lcl_mapping_to_lower implementation.
method constructor.
mi_mapping_fields = zcl_ajson_mapping=>create_field_mapping( it_mapping_fields ).
endmethod.
method zif_ajson_mapping~to_abap.
rv_result = mi_mapping_fields->to_abap( iv_path = iv_path iv_name = iv_name ).
endmethod.
method zif_ajson_mapping~to_json.
rv_result = mi_mapping_fields->to_json( iv_path = iv_path iv_name = iv_name ).
if rv_result is not initial. " Mapping found
return.
endif.
rv_result = to_lower( iv_name ).
endmethod.
endclass.
class lcl_mapping_camel implementation.
method constructor.
mi_mapping_fields = zcl_ajson_mapping=>create_field_mapping( it_mapping_fields ).
mv_first_json_upper = iv_first_json_upper.
endmethod.
method zif_ajson_mapping~to_abap.
rv_result = mi_mapping_fields->to_abap( iv_path = iv_path iv_name = iv_name ).
if rv_result is not initial. " Mapping found
return.
endif.
rv_result = iv_name.
replace all occurrences of regex `([a-z])([A-Z])` in rv_result with `$1_$2`. "#EC NOTEXT
endmethod.
method zif_ajson_mapping~to_json.
types ty_token type c length 255.
data lt_tokens type standard table of ty_token.
data lv_from type i.
field-symbols <token> like line of lt_tokens.
rv_result = mi_mapping_fields->to_json( iv_path = iv_path iv_name = iv_name ).
if rv_result is not initial. " Mapping found
return.
endif.
rv_result = iv_name.
replace all occurrences of `__` in rv_result with `*`.
translate rv_result to lower case.
translate rv_result using `/_:_~_`.
if mv_first_json_upper = abap_true.
lv_from = 1.
else.
lv_from = 2.
endif.
split rv_result at `_` into table lt_tokens.
loop at lt_tokens assigning <token> from lv_from.
translate <token>(1) to upper case.
endloop.
concatenate lines of lt_tokens into rv_result.
replace all occurrences of `*` in rv_result with `_`.
endmethod.
endclass.
| 20.168539 | 92 | 0.716156 |
35f1daa76fdbb9f0f3f3f707f608d296fa3f4f36
| 3,878 |
abap
|
ABAP
|
#gal#jobsched1.fugr.#gal#js_fill_jd_classname.abap
|
galileo-group/galileo-abap-lib
|
a013885096af9bc461d6000ad27b91789f150d00
|
[
"MIT"
] | 2 |
2017-11-02T12:33:44.000Z
|
2019-10-14T10:10:13.000Z
|
#gal#jobsched1.fugr.#gal#js_fill_jd_classname.abap
|
galileo-group/galileo-abap-lib
|
a013885096af9bc461d6000ad27b91789f150d00
|
[
"MIT"
] | 1 |
2017-11-05T19:36:27.000Z
|
2020-10-23T14:35:47.000Z
|
#gal#jobsched1.fugr.#gal#js_fill_jd_classname.abap
|
galileo-group/galileo-abap-lib
|
a013885096af9bc461d6000ad27b91789f150d00
|
[
"MIT"
] | null | null | null |
FUNCTION /gal/js_fill_jd_classname.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(RFC_ROUTE_INFO) TYPE /GAL/RFC_ROUTE_INFO OPTIONAL
*" REFERENCE(FILL_CURRENT) TYPE ABAP_BOOL DEFAULT ABAP_TRUE
*" REFERENCE(FILL_HIST) TYPE ABAP_BOOL DEFAULT ABAP_TRUE
*" EXPORTING
*" REFERENCE(INCONSISTENT_JOBS_HIST) TYPE /GAL/TT_JOB_IDS
*" REFERENCE(INCONSISTENT_JOBS_CURRENT) TYPE /GAL/TT_JOB_IDS
*" EXCEPTIONS
*" RFC_EXCEPTION
*" UNSUPPORTED_JOBDAT_VERSION
*"----------------------------------------------------------------------
DATA:
l_job_id TYPE /gal/job_id,
l_job_id_dummy TYPE /gal/job_id, "#EC NEEDED
l_classname TYPE classname,
l_value(255) TYPE c,
l_version TYPE /gal/js_db_layer_version,
l_js_config TYPE /gal/js_config.
CLEAR inconsistent_jobs_current.
CLEAR inconsistent_jobs_hist.
* Follow RFC route
cfw_follow_rfc_route rfc_route_info.
cfw_pass_exception rfc_exception.
cfw_pass_exception unsupported_jobdat_version.
cfw_remote_coding.
SELECT SINGLE value INTO l_value FROM /gal/js_config WHERE attribute = 'DB_LAYER_VERSION'.
IF sy-subrc <> 0.
l_version = '000'.
ELSE.
l_version = l_value.
ENDIF.
IF l_version > '001'.
MESSAGE e035 WITH l_version RAISING unsupported_jobdat_version.
RETURN.
ENDIF.
IF fill_current = abap_true.
SELECT id classname FROM /gal/jobdata01 INTO (l_job_id, l_classname). "#EC CI_NOFIELD
"#EC CI_NOWHERE
CHECK l_classname IS INITIAL.
SELECT id FROM /gal/jobdata01s INTO l_job_id_dummy WHERE id = l_job_id.
l_classname = '/GAL/JOB_SAP'.
EXIT. "#EC CI_EXIT_SELECT
ENDSELECT. "#EC CI_SUBRC
IF l_classname IS INITIAL.
SELECT id FROM ('/GAL/JOBDATA01I') INTO l_job_id_dummy WHERE id = l_job_id. "#EC CI_DYNTAB
l_classname = '/GAL/CCM_JOB_IMPORT'.
EXIT. "#EC CI_EXIT_SELECT
ENDSELECT. "#EC CI_SUBRC
ENDIF.
IF l_classname IS INITIAL.
INSERT l_job_id INTO TABLE inconsistent_jobs_current. "#EC CI_SUBRC
CONTINUE.
ENDIF.
UPDATE /gal/jobdata01 SET classname = l_classname WHERE id = l_job_id. "#EC CI_SUBRC
ENDSELECT. "#EC CI_SUBRC
ENDIF.
IF fill_hist = abap_true.
SELECT id classname FROM /gal/jd01_hist INTO (l_job_id, l_classname). "#EC CI_NOFIELD
"#EC CI_NOWHERE
CHECK l_classname IS INITIAL.
SELECT id FROM /gal/jd01s_hist INTO l_job_id_dummy WHERE id = l_job_id.
l_classname = '/GAL/JOB_SAP'.
EXIT. "#EC CI_EXIT_SELECT
ENDSELECT. "#EC CI_SUBRC
IF l_classname IS INITIAL.
SELECT id FROM ('/GAL/JD01I_HIST') INTO l_job_id_dummy WHERE id = l_job_id. "#EC CI_DYNTAB
l_classname = '/GAL/CCM_JOB_IMPORT'.
EXIT. "#EC CI_EXIT_SELECT
ENDSELECT. "#EC CI_SUBRC
ENDIF.
IF l_classname IS INITIAL.
INSERT l_job_id INTO TABLE inconsistent_jobs_hist. "#EC CI_SUBRC
CONTINUE.
ENDIF.
UPDATE /gal/jd01_hist SET classname = l_classname WHERE id = l_job_id. "#EC CI_SUBRC
ENDSELECT. "#EC CI_SUBRC
ENDIF.
l_js_config-attribute = 'DB_LAYER_VERSION'.
l_js_config-value = '001'.
MODIFY /gal/js_config FROM l_js_config. "#EC CI_SUBRC
COMMIT WORK.
ENDFUNCTION.
| 39.171717 | 98 | 0.571944 |
35f2f5cb108ab69924a354c788a453d58321b1d2
| 1,199 |
abap
|
ABAP
|
src/foundation/y_message_registration.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/foundation/y_message_registration.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/foundation/y_message_registration.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_message_registration DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS add_message
IMPORTING
!check_name TYPE csequence
!text TYPE itex132
!pseudo_comment TYPE sci_pcom OPTIONAL
CHANGING
!messages TYPE scimessages .
protected section.
private section.
ENDCLASS.
CLASS Y_MESSAGE_REGISTRATION IMPLEMENTATION.
METHOD add_message.
INSERT VALUE #( test = check_name
code = y_check_base=>c_code-error
kind = cl_ci_test_root=>c_error
text = text
pcom = pseudo_comment+5 ) INTO TABLE messages[].
INSERT VALUE #( test = check_name
code = y_check_base=>c_code-warning
kind = cl_ci_test_root=>c_warning
text = text
pcom = pseudo_comment+5 ) INTO TABLE messages[].
INSERT VALUE #( test = check_name
code = y_check_base=>c_code-notification
kind = cl_ci_test_root=>c_note
text = text
pcom = pseudo_comment+5 ) INTO TABLE messages[].
ENDMETHOD.
ENDCLASS.
| 29.975 | 68 | 0.577148 |
35f3e8f5371972553b50555fdc30928357726d01
| 3,800 |
abap
|
ABAP
|
src/checks/zcl_aoc_check_47.clas.testclasses.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 199 |
2015-02-17T07:08:01.000Z
|
2022-03-23T09:50:05.000Z
|
src/checks/zcl_aoc_check_47.clas.testclasses.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 769 |
2015-01-03T07:09:11.000Z
|
2022-03-21T11:59:53.000Z
|
src/checks/zcl_aoc_check_47.clas.testclasses.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 109 |
2015-03-09T10:22:34.000Z
|
2022-03-08T08:47:41.000Z
|
*----------------------------------------------------------------------*
* CLASS lcl_Test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS
FINAL.
PRIVATE SECTION.
* ================
DATA: mt_code TYPE string_table,
ms_result TYPE scirest_ad,
mo_check TYPE REF TO zcl_aoc_check_47.
METHODS:
setup,
export_import FOR TESTING,
test001_01 FOR TESTING,
test001_02 FOR TESTING,
test001_03 FOR TESTING,
test001_04 FOR TESTING,
test001_05 FOR TESTING.
ENDCLASS. "lcl_Test
*----------------------------------------------------------------------*
* CLASS lcl_Test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test IMPLEMENTATION.
* ==============================
DEFINE _code.
APPEND &1 TO mt_code.
END-OF-DEFINITION.
METHOD setup.
CREATE OBJECT mo_check.
zcl_aoc_unit_test=>set_check( mo_check ).
ENDMETHOD.
METHOD export_import.
zcl_aoc_unit_test=>export_import( mo_check ).
ENDMETHOD.
METHOD test001_01.
* ===========
_code 'CALL FUNCTION ''ZRFC_RFC'''.
_code ' DESTINATION iv_rfc'.
_code ' TABLES'.
_code ' it_where = lt_where'.
_code ' et_data = rt_data'.
_code ' EXCEPTIONS'.
_code ' system_failure = 1 MESSAGE lv_msg'.
_code ' communication_failure = 2 MESSAGE lv_msg'.
_code ' resource_failure = 3.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD. "test1
METHOD test001_02.
* ===========
_code 'CALL FUNCTION ''ZRFC_RFC'''.
_code ' DESTINATION iv_rfc'.
_code ' TABLES'.
_code ' it_where = lt_where'.
_code ' et_data = rt_data'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test001_03.
* ===========
_code 'CALL FUNCTION ''ZRFC_RFC'''.
_code ' DESTINATION iv_rfc'.
_code ' TABLES'.
_code ' it_where = lt_where'.
_code ' et_data = rt_data'.
_code ' EXCEPTIONS'.
_code ' system_failure = 1'.
_code ' communication_failure = 2'.
_code ' resource_failure = 3.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test001_04.
* ===========
_code 'CALL FUNCTION ''ZRFC_RFC'''.
_code ' DESTINATION ''NONE'''.
_code ' TABLES'.
_code ' it_where = lt_where'.
_code ' et_data = rt_data'.
_code ' EXCEPTIONS'.
_code ' system_failure = 1'.
_code ' communication_failure = 2'.
_code ' resource_failure = 3.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_05.
_code 'CALL FUNCTION ''GET_PRINT_PARAMETERS'''.
_code ' EXPORTING'.
_code ' copies = 1'.
_code ' list_name = ''ABC'''.
_code ' list_text = ''text'''.
_code ' destination = iv_tddest.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
ENDCLASS. "lcl_Test
| 27.142857 | 72 | 0.51 |
35f4141b80636e5b1edeb4bde790e8f6bb66db47
| 601 |
abap
|
ABAP
|
src/zcl_utib_custom_value_help.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | 3 |
2021-03-08T13:02:46.000Z
|
2021-11-30T20:04:44.000Z
|
src/zcl_utib_custom_value_help.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | 1 |
2021-03-31T17:13:50.000Z
|
2021-03-31T20:05:02.000Z
|
src/zcl_utib_custom_value_help.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | null | null | null |
CLASS zcl_utib_custom_value_help DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
iv_projection TYPE string
iv_from TYPE string
iv_order_by TYPE string OPTIONAL.
METHODS call_value_help.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS select_data.
METHODS pre_filter_data.
ENDCLASS.
CLASS zcl_utib_custom_value_help IMPLEMENTATION.
METHOD constructor.
ENDMETHOD.
METHOD call_value_help.
ENDMETHOD.
METHOD select_data.
ENDMETHOD.
METHOD pre_filter_data.
ENDMETHOD.
ENDCLASS.
| 15.410256 | 48 | 0.728785 |
35f5b855130178cb3c88e97d4d5be02abfb57baf
| 355 |
abap
|
ABAP
|
src/zunitdemo_barc2017_7.clas.abap
|
RainerWinkler/ABAP-Unit-Test-Demo
|
ab84490e0450c4bde65473f55042ab3ed6a4ea64
|
[
"MIT"
] | 1 |
2020-09-26T11:09:54.000Z
|
2020-09-26T11:09:54.000Z
|
src/zunitdemo_barc2017_7.clas.abap
|
RainerWinkler/ABAP-Unit-Test-Demo
|
ab84490e0450c4bde65473f55042ab3ed6a4ea64
|
[
"MIT"
] | null | null | null |
src/zunitdemo_barc2017_7.clas.abap
|
RainerWinkler/ABAP-Unit-Test-Demo
|
ab84490e0450c4bde65473f55042ab3ed6a4ea64
|
[
"MIT"
] | 3 |
2019-11-25T17:30:22.000Z
|
2022-02-11T06:38:02.000Z
|
CLASS zunitdemo_barc2017_7 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS actual_day
RETURNING VALUE(date) TYPE d.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zunitdemo_barc2017_7 IMPLEMENTATION.
METHOD actual_day.
TEST-SEAM date.
date = sy-datum.
END-TEST-SEAM.
ENDMETHOD.
ENDCLASS.
| 14.791667 | 42 | 0.71831 |
35f6f94690c7a16dac1b779a307902ca4f1ef7a2
| 2,826 |
abap
|
ABAP
|
src/checks/zcl_aoc_check_15.clas.abap
|
phaniacumen/SAPPROJ
|
dc4bf7a03d9ab2f4ac30bb77f6f38e6a55e5fcc4
|
[
"MIT"
] | 1 |
2018-04-22T04:47:28.000Z
|
2018-04-22T04:47:28.000Z
|
src/checks/zcl_aoc_check_15.clas.abap
|
phaniacumen/SAPPROJ
|
dc4bf7a03d9ab2f4ac30bb77f6f38e6a55e5fcc4
|
[
"MIT"
] | null | null | null |
src/checks/zcl_aoc_check_15.clas.abap
|
phaniacumen/SAPPROJ
|
dc4bf7a03d9ab2f4ac30bb77f6f38e6a55e5fcc4
|
[
"MIT"
] | null | null | null |
CLASS zcl_aoc_check_15 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
METHODS get_message_text
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_15 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lv_include TYPE sobj_name,
lv_statement TYPE string.
FIELD-SYMBOLS: <ls_token> LIKE LINE OF it_tokens,
<ls_statement> LIKE LINE OF it_statements.
LOOP AT it_statements ASSIGNING <ls_statement>
WHERE type <> scan_stmnt_type-empty
AND type <> scan_stmnt_type-comment.
CLEAR lv_statement.
LOOP AT it_tokens ASSIGNING <ls_token>
FROM <ls_statement>-from TO <ls_statement>-to
WHERE type <> scan_token_type-comment.
IF lv_statement IS INITIAL.
lv_statement = <ls_token>-str.
ELSE.
CONCATENATE lv_statement <ls_token>-str
INTO lv_statement SEPARATED BY space.
ENDIF.
ENDLOOP.
IF lv_statement CP 'CALL FUNCTION *'
OR lv_statement CP 'CALL METHOD *'
OR lv_statement CP 'CALL CUSTOMER-FUNCTION *'
OR lv_statement CP 'CALL SCREEN *'
OR lv_statement CP 'CALL SELECTION-SCREEN *'
OR lv_statement CP 'CALL TRANSACTION *'
OR lv_statement CP 'CALL TRANSFORMATION *'
OR lv_statement CP 'CALL BADI *'.
CONTINUE.
ELSEIF lv_statement CP 'CALL *'
OR lv_statement CP 'SYSTEM-CALL *'.
lv_include = get_include( p_level = <ls_statement>-level ).
inform( p_sub_obj_type = c_type_include
p_sub_obj_name = lv_include
p_line = <ls_token>-row
p_kind = mv_errty
p_test = myname
p_code = '001' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
description = 'Kernel CALL'. "#EC NOTEXT
category = 'ZCL_AOC_CATEGORY'.
version = '001'.
position = '015'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
mv_errty = c_error.
ENDMETHOD. "CONSTRUCTOR
METHOD get_message_text.
CLEAR p_text.
CASE p_code.
WHEN '001'.
p_text = 'Kernel CALL'. "#EC NOTEXT
WHEN OTHERS.
super->get_message_text( EXPORTING p_test = p_test
p_code = p_code
IMPORTING p_text = p_text ).
ENDCASE.
ENDMETHOD. "GET_MESSAGE_TEXT
ENDCLASS.
| 25.232143 | 71 | 0.581387 |
35f7ae00eddc8abf38fb63e50e8b33fe9799ee87
| 5,169 |
abap
|
ABAP
|
src/alv/zcl_uitb_alv_display_settings.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | 3 |
2021-03-08T13:02:46.000Z
|
2021-11-30T20:04:44.000Z
|
src/alv/zcl_uitb_alv_display_settings.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | 1 |
2021-03-31T17:13:50.000Z
|
2021-03-31T20:05:02.000Z
|
src/alv/zcl_uitb_alv_display_settings.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | null | null | null |
CLASS zcl_uitb_alv_display_settings DEFINITION
PUBLIC
INHERITING FROM zcl_uitb_alv_metadata
FINAL
CREATE PUBLIC
GLOBAL FRIENDS zcl_uitb_alv_metadata_util .
PUBLIC SECTION.
"! <p class="shorttext synchronized" lang="en">CONSTRUCTOR</p>
METHODS constructor
IMPORTING
io_controller TYPE REF TO zif_uitb_alv_metadata_ctrller.
METHODS get_title
RETURNING
VALUE(result) TYPE lvc_title .
METHODS set_title
IMPORTING
!value TYPE lvc_title .
METHODS is_row_move_allowed
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_row_move_allowed
IMPORTING
!value TYPE abap_bool DEFAULT abap_true .
METHODS has_row_marks
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_row_marks
IMPORTING
!value TYPE abap_bool DEFAULT abap_true .
METHODS is_row_insertion_possible
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_row_insertions
IMPORTING
!value TYPE abap_bool .
METHODS is_editable
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_editable
IMPORTING
!value TYPE abap_bool DEFAULT abap_true .
METHODS hide_toolbar
IMPORTING
!value TYPE abap_bool DEFAULT abap_true .
METHODS is_toolbar_hidden
RETURNING
VALUE(result) TYPE abap_bool .
METHODS is_striped
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_striped
IMPORTING
!value TYPE abap_bool DEFAULT abap_true .
METHODS is_merged
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_merged
IMPORTING
!value TYPE abap_bool DEFAULT abap_true .
METHODS is_small_title
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_small_title
IMPORTING
!value TYPE abap_bool DEFAULT abap_true .
METHODS get_drag_n_drop
RETURNING
VALUE(result) TYPE lvc_s_dd01 .
METHODS set_drag_n_drop
IMPORTING
!value TYPE lvc_s_dd01 .
PROTECTED SECTION.
PRIVATE SECTION.
DATA mf_no_row_insertions TYPE abap_bool .
DATA mf_editable TYPE abap_bool .
DATA mf_hide_toolbar TYPE abap_bool .
DATA ms_dnd TYPE lvc_s_dd01 .
DATA mf_striped TYPE abap_bool .
DATA mf_no_merging TYPE abap_bool .
DATA mf_no_row_marks TYPE abap_bool .
DATA mf_no_row_moves TYPE abap_bool .
DATA mv_title TYPE lvc_title .
DATA mf_smalltitle TYPE abap_bool .
ENDCLASS.
CLASS zcl_uitb_alv_display_settings IMPLEMENTATION.
method constructor.
super->constructor(
io_controller = io_controller
iv_name = zif_uitb_c_alv_metadata_types=>display_settings
).
ENDMETHOD.
METHOD get_drag_n_drop.
result = ms_dnd.
ENDMETHOD.
METHOD get_title.
result = mv_title.
ENDMETHOD.
METHOD has_row_marks.
result = xsdbool( mf_no_row_marks = abap_false ).
ENDMETHOD.
METHOD hide_toolbar.
mf_hide_toolbar = value.
ENDMETHOD.
METHOD is_editable.
result = mf_editable.
ENDMETHOD.
METHOD is_merged.
result = xsdbool( mf_no_merging = abap_false ).
ENDMETHOD.
METHOD is_row_insertion_possible.
result = xsdbool( mf_no_row_insertions = abap_false ).
ENDMETHOD.
METHOD is_row_move_allowed.
result = xsdbool( mf_no_row_moves = abap_false ).
ENDMETHOD.
METHOD is_small_title.
result = mf_smalltitle.
ENDMETHOD.
METHOD is_striped.
result = mf_striped.
ENDMETHOD.
METHOD is_toolbar_hidden.
result = mf_hide_toolbar.
ENDMETHOD.
METHOD set_drag_n_drop.
ms_dnd = value.
ENDMETHOD.
METHOD set_editable.
mf_editable = value.
CHECK mr_controller IS BOUND.
mr_controller->set_changed(
iv_name = mv_name
iv_flavour = zif_uitb_c_alv_chglist_flavor=>setter
iv_refresh_mode = zif_uitb_c_alv_refresh=>soft
iv_method = 'SET_EDITABLE'
ir_ref = me
).
ENDMETHOD.
METHOD set_merged.
IF value = abap_true.
mf_no_merging = abap_false.
ELSE.
mf_no_merging = abap_true.
ENDIF.
set_setter_changed( iv_method = 'SET_MERGED' ).
ENDMETHOD.
METHOD set_row_insertions.
IF value = abap_true.
mf_no_row_insertions = abap_false.
ELSE.
mf_no_row_insertions = abap_true.
ENDIF.
ENDMETHOD.
METHOD set_row_marks.
IF value = abap_true.
mf_no_row_marks = abap_false.
ELSE.
mf_no_row_marks = abap_true.
ENDIF.
set_setter_changed( iv_method = 'SET_ROW_MARKS' ).
ENDMETHOD.
METHOD set_row_move_allowed.
IF value = abap_true.
mf_no_row_moves = abap_false.
ELSE.
mf_no_row_moves = abap_true.
ENDIF.
set_setter_changed( iv_method = 'SET_ROW_MOVE_ALLOWED' ).
ENDMETHOD.
METHOD set_small_title.
mf_smalltitle = value.
set_setter_changed( iv_method = 'SET_SMALL_TITLE' ).
ENDMETHOD.
METHOD set_striped.
mf_striped = value.
set_setter_changed( iv_method = 'SET_STRIPED' ).
ENDMETHOD.
METHOD set_title.
mv_title = value.
set_setter_changed( iv_method = 'SET_TITLE' ).
ENDMETHOD.
ENDCLASS.
| 21.902542 | 71 | 0.689302 |
35f989601b475f07700faf2a089c9d93f39a13cb
| 2,838 |
abap
|
ABAP
|
day01/task2.abap
|
julianschmuckli/adventofcode_2020
|
18c6aa2014f1994a9cccb36346bf52a46038242e
|
[
"Apache-2.0"
] | 1 |
2020-12-04T14:41:29.000Z
|
2020-12-04T14:41:29.000Z
|
day01/task2.abap
|
julianschmuckli/adventofcode_2020
|
18c6aa2014f1994a9cccb36346bf52a46038242e
|
[
"Apache-2.0"
] | null | null | null |
day01/task2.abap
|
julianschmuckli/adventofcode_2020
|
18c6aa2014f1994a9cccb36346bf52a46038242e
|
[
"Apache-2.0"
] | null | null | null |
* Input declaration
DATA: lv_input TYPE TABLE OF i WITH EMPTY KEY,
wa_input LIKE LINE OF lv_input.
* Assign with the puzzle input.
lv_input = VALUE #( ( 1837 ) ( 1585 ) ( 1894 ) ( 1715 ) ( 1947 ) ( 1603 ) ( 1746 ) ( 1911 ) ( 1939 ) ( 1791 ) ( 1800 ) ( 1479 ) ( 1138 ) ( 1810 ) ( 1931 ) ( 1833 ) ( 1470 ) ( 1882 ) ( 1725 ) ( 1496 ) ( 1890 ) ( 1862 ) ( 1990 ) ( 1958 ) ( 1997 ) ( 1844 )
( 1524 ) ( 541 ) ( 2001 ) ( 1591 ) ( 1687 ) ( 1941 ) ( 1940 ) ( 1561 ) ( 1813 ) ( 1654 ) ( 1500 ) ( 1575 ) ( 1826 ) ( 2006 ) ( 679 ) ( 1660 ) ( 1679 ) ( 1631 ) ( 2008 ) ( 575 ) ( 1583 ) ( 1883 ) ( 1904 ) ( 1436 ) ( 1650 ) ( 1532 ) ( 1907 ) ( 1803 ) (
1693 ) ( 1700 ) ( 359 ) ( 1516 ) ( 1625 ) ( 1908 ) ( 1994 ) ( 1910 ) ( 1644 ) ( 1706 ) ( 1781 ) ( 1639 ) ( 1662 ) ( 1712 ) ( 1796 ) ( 1915 ) ( 1550 ) ( 1721 ) ( 1697 ) ( 1917 ) ( 1665 ) ( 1646 ) ( 1968 ) ( 1881 ) ( 1893 ) ( 1468 ) ( 1678 ) ( 1774 ) (
285 ) ( 1754 ) ( 1856 ) ( 1677 ) ( 1823 ) ( 1802 ) ( 1681 ) ( 1587 ) ( 1767 ) ( 1711 ) ( 1900 ) ( 1983 ) ( 1787 ) ( 1996 ) ( 1726 ) ( 1982 ) ( 1971 ) ( 1553 ) ( 1542 ) ( 1863 ) ( 2002 ) ( 1831 ) ( 1891 ) ( 1555 ) ( 2000 ) ( 1847 ) ( 1783 ) ( 1873 ) (
1761 ) ( 1742 ) ( 1534 ) ( 1993 ) ( 1898 ) ( 1973 ) ( 1974 ) ( 1597 ) ( 1540 ) ( 1581 ) ( 1864 ) ( 1452 ) ( 1637 ) ( 1649 ) ( 1886 ) ( 1965 ) ( 1460 ) ( 1664 ) ( 1701 ) ( 1647 ) ( 1812 ) ( 1937 ) ( 1902 ) ( 2004 ) ( 1991 ) ( 1718 ) ( 1887 ) ( 1606 ) (
1748 ) ( 1737 ) ( 1608 ) ( 1641 ) ( 1710 ) ( 1724 ) ( 705 ) ( 1985 ) ( 1571 ) ( 1805 ) ( 131 ) ( 1788 ) ( 1707 ) ( 1513 ) ( 1615 ) ( 1897 ) ( 1476 ) ( 1927 ) ( 1745 ) ( 1926 ) ( 1839 ) ( 1807 ) ( 1955 ) ( 1692 ) ( 1645 ) ( 1699 ) ( 1471 ) ( 1604 ) (
1830 ) ( 1622 ) ( 1972 ) ( 1866 ) ( 1814 ) ( 1816 ) ( 1855 ) ( 1820 ) ( 1034 ) ( 1673 ) ( 1704 ) ( 1969 ) ( 1580 ) ( 1980 ) ( 1739 ) ( 1896 ) ( 434 ) ( 497 ) ( 1851 ) ( 1933 ) ( 458 ) ( 1521 ) ( 1551 ) ( 1762 ) ( 2010 ) ( 1614 ) ( 1840 ) ( 1747 ) ( 1875
) ( 1836 ) ( 1895 ) ( 1518 ) ( 1825 ) ( 1987 ) ).
* Starting the Task
DATA: wa_current_number1 LIKE LINE OF lv_input,
wa_current_number2 LIKE LINE OF lv_input,
wa_current_number3 LIKE LINE OF lv_input.
LOOP AT lv_input INTO wa_current_number1.
LOOP AT lv_input INTO wa_current_number2.
LOOP AT lv_input INTO wa_current_number3.
IF wa_current_number1 NE wa_current_number2 AND wa_current_number2 NE wa_current_number3 AND wa_current_number3 NE wa_current_number1.
DATA(lv_sum) = wa_current_number1 + wa_current_number2 + wa_current_number3.
IF lv_sum EQ 2020.
DATA(lv_result) = wa_current_number1 * wa_current_number2 * wa_current_number3.
WRITE: 'Result: ' && lv_result.
EXIT.
ENDIF.
ENDIF.
ENDLOOP.
IF lv_sum EQ 2020.
EXIT.
ENDIF.
ENDLOOP.
IF lv_sum EQ 2020.
EXIT.
ENDIF.
ENDLOOP.
IF lv_result EQ ''.
WRITE: 'No result'.
ENDIF.
| 66 | 253 | 0.542283 |
35fced28d516b0982ec3cecfd46968b6ddb25388
| 5,818 |
abap
|
ABAP
|
src/data_access/zcl_dbbr_jump_destination_f.clas.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 15 |
2020-02-05T10:38:12.000Z
|
2022-02-11T18:06:17.000Z
|
src/data_access/zcl_dbbr_jump_destination_f.clas.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 10 |
2021-01-19T07:45:37.000Z
|
2021-07-15T19:08:54.000Z
|
src/data_access/zcl_dbbr_jump_destination_f.clas.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 9 |
2020-04-08T19:13:18.000Z
|
2021-10-02T12:53:39.000Z
|
CLASS zcl_dbbr_jump_destination_f DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS save_jump_destinations
IMPORTING
!iv_query_id TYPE zdbbr_query_id
if_update_query_flag TYPE abap_bool OPTIONAL
CHANGING
!ct_jump_destinations TYPE zdbbr_jumpdest_data_ui_itab .
METHODS get_jump_destinations
IMPORTING
!iv_query_id TYPE zdbbr_query_id
RETURNING
VALUE(rt_jump_destinations) TYPE zdbbr_jumpdest_data_ui_itab .
METHODS delete_jumpdest_by_query_id
IMPORTING
!iv_query_id TYPE zdbbr_query_id .
PROTECTED SECTION.
PRIVATE SECTION.
METHODS save_jump_destination
CHANGING
!cs_jump_destination TYPE zdbbr_jumpdest_data_ui .
METHODS save_parameter
IMPORTING
!is_parameter TYPE zdbbr_jumpdestp .
METHODS delete_parameters_for_jumpdest
IMPORTING
!iv_jumpdest_id TYPE zdbbr_jumpdest_id .
METHODS delete_jumpdest
IMPORTING
!is_jump_definition TYPE zdbbr_jumpdest .
METHODS read_jump_destinations
IMPORTING
!iv_query_id TYPE zdbbr_query_id
RETURNING
VALUE(rt_jump_destinations) TYPE zdbbr_jumpdest_itab .
METHODS read_params_for_jumpdest
IMPORTING
!iv_jumpdest_id TYPE zdbbr_jumpdest_id
RETURNING
VALUE(rt_params) TYPE zdbbr_jumpparam_itab .
METHODS delete_parameter_by_id
IMPORTING
!iv_parameter_id TYPE memoryid .
ENDCLASS.
CLASS zcl_dbbr_jump_destination_f IMPLEMENTATION.
METHOD delete_jumpdest.
DELETE zdbbr_jumpdest FROM is_jump_definition.
ENDMETHOD.
METHOD delete_jumpdest_by_query_id.
DATA(lt_jump_destinations) = read_jump_destinations( iv_query_id = iv_query_id ).
LOOP AT lt_jump_destinations ASSIGNING FIELD-SYMBOL(<ls_jump_dest>).
delete_parameters_for_jumpdest( iv_jumpdest_id = <ls_jump_dest>-jumpdest_id ).
delete_jumpdest( is_jump_definition = <ls_jump_dest> ).
ENDLOOP.
ENDMETHOD.
METHOD delete_parameters_for_jumpdest.
DELETE FROM zdbbr_jumpdestp WHERE ref_jump_dest = iv_jumpdest_id.
ENDMETHOD.
METHOD delete_parameter_by_id.
DELETE FROM zdbbr_jumpdestp WHERE parameter_id = iv_parameter_id.
ENDMETHOD.
METHOD get_jump_destinations.
DATA: ls_transaction TYPE tstc.
rt_jump_destinations = CORRESPONDING #( read_jump_destinations( iv_query_id = iv_query_id ) ).
LOOP AT rt_jump_destinations ASSIGNING FIELD-SYMBOL(<ls_jump_destination>).
SELECT SINGLE * FROM tstc
INTO CORRESPONDING FIELDS OF ls_transaction
WHERE tcode = <ls_jump_destination>-jump_target.
IF sy-subrc = 0.
<ls_jump_destination>-is_report_transaction = xsdbool( ls_transaction-cinfo = '80' ).
<ls_jump_destination>-program_name = ls_transaction-pgmna.
ENDIF.
ENDLOOP.
" fill parameters for each jump field
LOOP AT rt_jump_destinations ASSIGNING FIELD-SYMBOL(<ls_jump_field>).
<ls_jump_field>-parameters = read_params_for_jumpdest( iv_jumpdest_id = <ls_jump_field>-jumpdest_id ).
ENDLOOP.
ENDMETHOD.
METHOD read_jump_destinations.
SELECT * FROM zdbbr_jumpdest INTO TABLE @rt_jump_destinations
WHERE ref_query_id = @iv_query_id.
ENDMETHOD.
METHOD read_params_for_jumpdest.
SELECT * FROM zdbbr_jumpdestp INTO TABLE @rt_params
WHERE ref_jump_dest = @iv_jumpdest_id.
ENDMETHOD.
METHOD save_jump_destination.
DATA(ls_jumpdest) = CORRESPONDING zdbbr_jumpdest( cs_jump_destination ).
MODIFY zdbbr_jumpdest FROM ls_jumpdest.
DATA(lt_existing_params) = read_params_for_jumpdest( iv_jumpdest_id = ls_jumpdest-jumpdest_id ).
LOOP AT lt_existing_params ASSIGNING FIELD-SYMBOL(<ls_existing_param>).
IF NOT line_exists( cs_jump_destination-parameters[ parameter_id = <ls_existing_param>-parameter_id ] ).
delete_parameter_by_id( <ls_existing_param>-parameter_id ).
ENDIF.
ENDLOOP.
" save remaining parameters
LOOP AT cs_jump_destination-parameters ASSIGNING FIELD-SYMBOL(<ls_param>).
save_parameter( <ls_param> ).
ENDLOOP.
ENDMETHOD.
METHOD save_jump_destinations.
" first find all persisted jump fields for the given query
DATA(lt_jumpdestinations) = read_jump_destinations( iv_query_id = iv_query_id ).
" delete all jump fields that are not in the new list
LOOP AT lt_jumpdestinations ASSIGNING FIELD-SYMBOL(<ls_existing_jumpdest>).
IF NOT line_exists( ct_jump_destinations[ jumpdest_id = <ls_existing_jumpdest>-jumpdest_id ] ).
" first delete dependent parameters
delete_parameters_for_jumpdest( <ls_existing_jumpdest>-jumpdest_id ).
delete_jumpdest( is_jump_definition = <ls_existing_jumpdest> ).
ENDIF.
ENDLOOP.
" save remaining jump destinations
LOOP AT ct_jump_destinations ASSIGNING FIELD-SYMBOL(<ls_jump_dest>).
" is this a new jump destination ?
IF <ls_jump_dest>-jumpdest_id IS INITIAL.
<ls_jump_dest>-jumpdest_id = ZCL_SAT_SYSTEM_HELPER=>create_guid_22( ).
ENDIF.
LOOP AT <ls_jump_dest>-parameters ASSIGNING FIELD-SYMBOL(<ls_param>).
<ls_param>-ref_jump_dest = <ls_jump_dest>-jumpdest_id.
ENDLOOP.
save_jump_destination(
CHANGING
cs_jump_destination = <ls_jump_dest>
).
ENDLOOP.
IF if_update_query_flag = abap_true.
NEW zcl_dbbr_query_factory( )->update_query_flags(
iv_query_id = iv_query_id if_has_jump_fields = xsdbool( ct_jump_destinations IS NOT INITIAL )
).
ENDIF.
" commit changes
MESSAGE |{ 'Jump destinations were successfully saved!'(001) }| TYPE 'S'.
COMMIT WORK.
ENDMETHOD.
METHOD save_parameter.
MODIFY zdbbr_jumpdestp FROM is_parameter.
ENDMETHOD.
ENDCLASS.
| 31.619565 | 110 | 0.732898 |
35fe762130162b10a7f5fec074ccca628212e593
| 15,730 |
abap
|
ABAP
|
lbn-gtt-template-tso/abap/zsrc/zgtt_sof.fugr.zgtt_sof_ote_de_hd.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-tso/abap/zsrc/zgtt_sof.fugr.zgtt_sof_ote_de_hd.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-tso/abap/zsrc/zgtt_sof.fugr.zgtt_sof_ote_de_hd.abap
|
zenonkowalewski/logistics-business-network-gtt-samples
|
c34ddff27f339768ae61a6dc8eb4330ecc5ca320
|
[
"Apache-2.0"
] | 50 |
2020-09-29T03:06:01.000Z
|
2022-03-28T16:04:45.000Z
|
FUNCTION zgtt_sof_ote_de_hd.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM
*" REFERENCE(I_APP_OBJ_TYPES) TYPE /SAPTRX/AOTYPES
*" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER
*" REFERENCE(I_APP_TYPE_CNTL_TABS) TYPE TRXAS_APPTYPE_TABS
*" REFERENCE(I_APP_OBJECTS) TYPE TRXAS_APPOBJ_CTABS
*" TABLES
*" E_CONTROL_DATA STRUCTURE /SAPTRX/CONTROL_DATA
*" E_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL
*" EXCEPTIONS
*" PARAMETER_ERROR
*" CDATA_DETERMINATION_ERROR
*" TABLE_DETERMINATION_ERROR
*" STOP_PROCESSING
*"----------------------------------------------------------------------
*----------------------------------------------------------------------*
* Top Include
* TYPE-POOLS:trxas.
*----------------------------------------------------------------------*
DATA:
ls_app_objects TYPE trxas_appobj_ctab_wa,
ls_control_data TYPE /saptrx/control_data,
lt_xlikp TYPE STANDARD TABLE OF likpvb,
lt_xvbuk TYPE STANDARD TABLE OF vbukvb,
lt_xlips TYPE STANDARD TABLE OF lipsvb,
* business partner table
lt_xvbpa TYPE STANDARD TABLE OF vbpavb,
lv_tzone TYPE timezone,
* door text
lv_ltort TYPE t30bt-ltort,
* warehouse text
lv_lnumt TYPE t300t-lnumt,
* warehouse text / door text
lv_lgtratxt TYPE char60,
* shipping point address number,
lv_adrnr_shpt TYPE adrnr,
* country iso code
lv_countryiso TYPE intca,
* sd document address information
ls_sd_addr TYPE vbadr,
lv_tabix TYPE numc10.
DATA: BEGIN OF ls_address,
line_type TYPE ad_line_tp,
address_line LIKE adrs-line0,
END OF ls_address.
DATA: lt_address LIKE STANDARD TABLE OF ls_address.
FIELD-SYMBOLS:
<ls_xlikp> TYPE likpvb,
<ls_xvbuk> TYPE vbukvb,
<ls_xlips> TYPE lipsvb,
<ls_xvbpa> TYPE vbpavb.
* <1> Read necessary application tables from table reference
* Read Header Status Data New
PERFORM read_appl_table
USING i_all_appl_tables
gc_bpt_delivery_hdrstatus_new
CHANGING lt_xvbuk.
* Read Item New
PERFORM read_appl_table
USING i_all_appl_tables
gc_bpt_delivery_item_new
CHANGING lt_xlips.
* <1> Read Ship-to Party New
PERFORM read_appl_table
USING i_all_appl_tables
gc_bpt_partners_new
CHANGING lt_xvbpa.
* <2> Fill general data for all control data records
ls_control_data-appsys = i_appsys.
ls_control_data-appobjtype = i_app_obj_types-aotype.
ls_control_data-language = sy-langu.
* <3> Loop at application objects for geting Delivery Header
* add the following values which cannot be extracted in EM Data Extraction
*Delivery No. (LIKP-VBELN)
*Ship-To Party (LIKP-KUNNR)
*Document date (LIKP-BLDAT)
*Planned delivery date (LIKP-LFDAT)
*Total Weight (LIKP-BTGEW)
*Net weight (LIKP-NTGEW)
*Total Weight uom (LIKP-GEWEI)
*Volume (LIKP-VOLUM)
*Volume unit (LIKP-VOLEH)
*Picking Status (VBUK-KOSTK)
*Packing Status (VBUK-PKSTK)
*Goods Issue Status (VBUK-WBSTK)
*Warehouse No: LIKP-LGNUM
*Door for warehouse: LIKP-LGTOR
*Warehouse door text: T30BT with LGNUM and LGTOR
*Shipping point / Departure (LIKP-VSTEL)
*Departure address
*Departure country
*Destination (LIKP-KUNNR)
*Destination country
*Destination address
*Destination email
*Destination telephone
*Bill of lading (LIKP-BOLNR)
*Incoterms (LIKP-INCO1)
*Incoterms location 1 (LIKP-INCO2_L)
*Incoterms version (LIKP-INCOV)
* Actual Business Time
* Actual Business Time zone
* Actual Technical Datetime
* Actual Technical Time zone
* Delivery Order Item table
LOOP AT i_app_objects INTO ls_app_objects.
* Application Object ID
ls_control_data-appobjid = ls_app_objects-appobjid.
* Check if Main table is Delivery Header or not.
IF ls_app_objects-maintabdef <> gc_bpt_delivery_header_new.
PERFORM create_logtable_aot
TABLES e_logtable
USING space
ls_app_objects-maintabdef
i_app_obj_types-controldatafunc
ls_app_objects-appobjtype
i_appsys.
RAISE table_determination_error.
ELSE.
* Read Main Object Table
ASSIGN ls_app_objects-maintabref->* TO <ls_xlikp>.
ENDIF.
*Delivery No. (LIKP-VBELN)
ls_control_data-paramname = gc_cp_yn_de_no.
ls_control_data-value = <ls_xlikp>-vbeln.
APPEND ls_control_data TO e_control_data.
*Ship-To Party (LIKP-KUNNR)
ls_control_data-paramname = gc_cp_yn_de_ship_to.
ls_control_data-value = <ls_xlikp>-kunnr.
APPEND ls_control_data TO e_control_data.
*Document date (LIKP-BLDAT)
ls_control_data-paramname = gc_cp_yn_doc_date.
IF <ls_xlikp>-bldat IS NOT INITIAL.
ls_control_data-value = <ls_xlikp>-bldat.
ELSE.
CLEAR ls_control_data-value.
ENDIF.
APPEND ls_control_data TO e_control_data.
*Planned delivery date (LIKP-LFDAT)
ls_control_data-paramname = gc_cp_yn_de_plndelivery_date.
IF <ls_xlikp>-lfdat IS NOT INITIAL.
ls_control_data-value = <ls_xlikp>-lfdat.
ELSE.
CLEAR ls_control_data-value.
ENDIF.
APPEND ls_control_data TO e_control_data.
*Total Weight (LIKP-BTGEW)
ls_control_data-paramname = gc_cp_yn_de_tot_weight.
ls_control_data-value = <ls_xlikp>-btgew.
SHIFT ls_control_data-value LEFT DELETING LEADING space.
APPEND ls_control_data TO e_control_data.
*Net weight (LIKP-NTGEW)
ls_control_data-paramname = gc_cp_yn_de_net_weight.
ls_control_data-value = <ls_xlikp>-ntgew.
SHIFT ls_control_data-value LEFT DELETING LEADING space.
APPEND ls_control_data TO e_control_data.
*Total Weight uom (LIKP-GEWEI)
ls_control_data-paramname = gc_cp_yn_de_tot_weight_uom.
ls_control_data-value = <ls_xlikp>-gewei.
APPEND ls_control_data TO e_control_data.
*Volume (LIKP-VOLUM)
ls_control_data-paramname = gc_cp_yn_de_vol.
ls_control_data-value = <ls_xlikp>-volum.
SHIFT ls_control_data-value LEFT DELETING LEADING space.
APPEND ls_control_data TO e_control_data.
*Volume unit (LIKP-VOLEH)
ls_control_data-paramname = gc_cp_yn_de_vol_uom.
ls_control_data-value = <ls_xlikp>-voleh.
APPEND ls_control_data TO e_control_data.
READ TABLE lt_xvbuk ASSIGNING <ls_xvbuk> WITH KEY vbeln = <ls_xlikp>-vbeln.
*Picking Status (VBUK-KOSTK)
ls_control_data-paramname = gc_cp_yn_de_pick_status.
IF <ls_xvbuk>-kostk IS NOT INITIAL.
ls_control_data-value = <ls_xvbuk>-kostk.
ELSE.
ls_control_data-value = gc_true.
ENDIF.
APPEND ls_control_data TO e_control_data.
*Packing Status (VBUK-PKSTK)
ls_control_data-paramname = gc_cp_yn_de_pack_status.
IF <ls_xvbuk>-pkstk IS NOT INITIAL.
ls_control_data-value = <ls_xvbuk>-pkstk.
ELSE.
ls_control_data-value = gc_true.
ENDIF.
APPEND ls_control_data TO e_control_data.
*Goods Issue Status (VBUK-WBSTK)
ls_control_data-paramname = gc_cp_yn_de_gi_status.
IF <ls_xvbuk>-wbstk IS NOT INITIAL.
ls_control_data-value = <ls_xvbuk>-wbstk.
ELSE.
ls_control_data-value = gc_true.
ENDIF.
APPEND ls_control_data TO e_control_data.
*Warehouse No: LIKP-LGNUM
ls_control_data-paramname = gc_cp_yn_de_warehouse_no.
ls_control_data-value = <ls_xlikp>-lgnum.
APPEND ls_control_data TO e_control_data.
*Door for warehouse: LIKP-LGTOR
ls_control_data-paramname = gc_cp_yn_de_door_no.
ls_control_data-value = <ls_xlikp>-lgtor.
APPEND ls_control_data TO e_control_data.
*Warehouse door text: concatenate T300T-LNUMT '/' T30BT-ltort with LGNUM and LGTOR
CLEAR lv_ltort.
SELECT SINGLE ltort INTO lv_ltort FROM t30bt WHERE spras = sy-langu
AND lgnum = <ls_xlikp>-lgnum
AND lgtor = <ls_xlikp>-lgtor.
CLEAR lv_lnumt.
SELECT SINGLE lnumt INTO lv_lnumt FROM t300t WHERE spras = sy-langu
AND lgnum = <ls_xlikp>-lgnum.
CLEAR lv_lgtratxt.
IF lv_ltort IS NOT INITIAL OR lv_lnumt IS NOT INITIAL.
CONCATENATE lv_lnumt lv_ltort INTO lv_lgtratxt SEPARATED BY '/'.
ENDIF.
ls_control_data-paramname = gc_cp_yn_de_door_txt.
ls_control_data-value = lv_lgtratxt.
APPEND ls_control_data TO e_control_data.
*Shipping point / Departure (LIKP-VSTEL)
ls_control_data-paramname = gc_cp_yn_de_shp_pnt.
ls_control_data-value = <ls_xlikp>-vstel.
APPEND ls_control_data TO e_control_data.
*Location Type for Shipping point / Departure (LIKP-VSTEL)
ls_control_data-paramname = gc_cp_yn_de_shp_pnt_loctype.
ls_control_data-value = 'ShippingPoint'.
APPEND ls_control_data TO e_control_data.
*Departure address
CLEAR lv_adrnr_shpt.
SELECT SINGLE adrnr INTO lv_adrnr_shpt FROM tvst WHERE vstel = <ls_xlikp>-vstel.
CLEAR: lt_address, ls_address.
CALL FUNCTION 'ADDRESS_INTO_PRINTFORM'
EXPORTING
address_type = '1'
address_number = lv_adrnr_shpt
IMPORTING
address_printform_table = lt_address.
CLEAR ls_control_data-value.
LOOP AT lt_address INTO ls_address.
IF sy-tabix = 1.
ls_control_data-value = ls_address-address_line.
ELSE.
IF ls_address-address_line IS NOT INITIAL.
CONCATENATE ls_control_data-value ls_address-address_line INTO ls_control_data-value SEPARATED BY '$'.
ENDIF.
ENDIF.
ENDLOOP.
ls_control_data-paramname = gc_cp_yn_de_shp_addr.
APPEND ls_control_data TO e_control_data.
*Departure country
CLEAR: lv_countryiso, ls_sd_addr.
CALL FUNCTION 'SD_ADDRESS_GET'
EXPORTING
fif_address_number = lv_adrnr_shpt
IMPORTING
fes_address = ls_sd_addr.
CALL FUNCTION 'COUNTRY_CODE_SAP_TO_ISO'
EXPORTING
sap_code = ls_sd_addr-land1
IMPORTING
iso_code = lv_countryiso.
ls_control_data-paramname = gc_cp_yn_de_shp_countryiso.
ls_control_data-value = lv_countryiso.
APPEND ls_control_data TO e_control_data.
*Destination (LIKP-KUNNR)
ls_control_data-paramname = gc_cp_yn_de_dest.
ls_control_data-value = <ls_xlikp>-kunnr.
APPEND ls_control_data TO e_control_data.
*Location Type for Destination (LIKP-KUNNR)
ls_control_data-paramname = gc_cp_yn_de_dest_loctype.
ls_control_data-value = 'Customer'.
APPEND ls_control_data TO e_control_data.
*Destination address
READ TABLE lt_xvbpa ASSIGNING <ls_xvbpa> WITH KEY vbeln = <ls_xlikp>-vbeln
posnr = '000000'
parvw = 'WE' BINARY SEARCH.
CLEAR: lt_address, ls_address.
IF <ls_xvbpa> IS NOT INITIAL.
CALL FUNCTION 'ADDRESS_INTO_PRINTFORM'
EXPORTING
address_type = '1'
address_number = <ls_xvbpa>-adrnr
IMPORTING
address_printform_table = lt_address.
ENDIF.
CLEAR ls_control_data-value.
LOOP AT lt_address INTO ls_address.
IF sy-tabix = 1.
ls_control_data-value = ls_address-address_line.
ELSE.
IF ls_address-address_line IS NOT INITIAL.
CONCATENATE ls_control_data-value ls_address-address_line INTO ls_control_data-value SEPARATED BY '$'.
ENDIF.
ENDIF.
ENDLOOP.
ls_control_data-paramname = gc_cp_yn_de_dest_addr.
APPEND ls_control_data TO e_control_data.
*Destination country, Destination email, Destination telephone
CLEAR: lv_countryiso, ls_sd_addr.
IF <ls_xvbpa> IS NOT INITIAL.
CALL FUNCTION 'SD_ADDRESS_GET'
EXPORTING
fif_address_number = <ls_xvbpa>-adrnr
IMPORTING
fes_address = ls_sd_addr.
CALL FUNCTION 'COUNTRY_CODE_SAP_TO_ISO'
EXPORTING
sap_code = ls_sd_addr-land1
IMPORTING
iso_code = lv_countryiso.
ENDIF.
ls_control_data-paramname = gc_cp_yn_de_dest_countryiso.
ls_control_data-value = lv_countryiso.
APPEND ls_control_data TO e_control_data.
ls_control_data-paramname = gc_cp_yn_de_dest_email.
ls_control_data-value = ls_sd_addr-email_addr.
APPEND ls_control_data TO e_control_data.
ls_control_data-paramname = gc_cp_yn_de_dest_tele.
ls_control_data-value = ls_sd_addr-telf1.
APPEND ls_control_data TO e_control_data.
*Bill of lading (LIKP-BOLNR)
ls_control_data-paramname = gc_cp_yn_de_bol_no.
ls_control_data-value = <ls_xlikp>-bolnr.
APPEND ls_control_data TO e_control_data.
*Incoterms (LIKP-INCO1)
ls_control_data-paramname = gc_cp_yn_de_inco1.
ls_control_data-value = <ls_xlikp>-inco1.
APPEND ls_control_data TO e_control_data.
*Incoterms location 1 (LIKP-INCO2_L)
ls_control_data-paramname = gc_cp_yn_de_inco2_l.
ls_control_data-value = <ls_xlikp>-inco2_l.
APPEND ls_control_data TO e_control_data.
*Incoterms version (LIKP-INCOV)
ls_control_data-paramname = gc_cp_yn_de_incov.
ls_control_data-value = <ls_xlikp>-incov.
APPEND ls_control_data TO e_control_data.
* Actual Business Time zone
CALL FUNCTION 'GET_SYSTEM_TIMEZONE'
IMPORTING
timezone = lv_tzone
EXCEPTIONS
customizing_missing = 1
OTHERS = 2.
ls_control_data-paramname = gc_cp_yn_act_timezone.
ls_control_data-value = lv_tzone.
APPEND ls_control_data TO e_control_data.
* Actual Business Time
* CALL FUNCTION '/SCMB/BOL_TST_TZONE_TO_UTC'
* EXPORTING
* iv_date = sy-datum
* iv_time = sy-uzeit
* IMPORTING
* ev_tst = lv_timestamp.
* .
* ls_control_data-paramname = gc_cp_yn_act_datetime.
* MOVE lv_timestamp TO ls_control_data-value.
* SHIFT ls_control_data-value LEFT DELETING LEADING space.
* CONCATENATE '0' ls_control_data-value INTO ls_control_data-value.
* APPEND ls_control_data TO e_control_data.
ls_control_data-paramname = gc_cp_yn_act_datetime.
CONCATENATE '0' sy-datum sy-uzeit INTO ls_control_data-value.
APPEND ls_control_data TO e_control_data.
* Actual Technical Datetime & Time zone
ls_control_data-paramname = gc_cp_yn_acttec_timezone."ACTUAL_TECHNICAL_TIMEZONE
ls_control_data-value = lv_tzone.
APPEND ls_control_data TO e_control_data.
ls_control_data-paramname = gc_cp_yn_acttec_datetime."ACTUAL_TECHNICAL_DATETIME
CONCATENATE '0' sy-datum sy-uzeit INTO ls_control_data-value.
APPEND ls_control_data TO e_control_data.
* Delivery Order Item table - deleted by enabling One to many association: delivery - delivery items - 20210115
* LOOP AT lt_xlips ASSIGNING <ls_xlips> WHERE updkz <> 'D'.
* lv_tabix = sy-tabix.
* ls_control_data-paramindex = lv_tabix.
* ls_control_data-paramname = gc_cp_yn_de_header_item_cnt.
* ls_control_data-value = lv_tabix.
* SHIFT ls_control_data-value LEFT DELETING LEADING space.
* APPEND ls_control_data TO e_control_data.
*
* ls_control_data-paramindex = lv_tabix.
* ls_control_data-paramname = gc_cp_yn_de_header_item_no.
* CONCATENATE <ls_xlips>-vbeln <ls_xlips>-posnr INTO ls_control_data-value.
* APPEND ls_control_data TO e_control_data.
* ENDLOOP.
* IF sy-subrc NE 0.
* ls_control_data-paramindex = '1'.
* ls_control_data-paramname = gc_cp_yn_de_header_item_cnt.
* ls_control_data-value = ''.
* APPEND ls_control_data TO e_control_data.
* ENDIF.
CLEAR ls_control_data-paramindex.
ENDLOOP.
ENDFUNCTION.
| 36.077982 | 112 | 0.695232 |
35fefed68df2e6c05cd36d05a577539091beb4a0
| 3,951 |
abap
|
ABAP
|
src/legacy/#dmo#flight_travel_api22.fugr.#dmo#flight_travel_update22.abap
|
SAP-Cloud-Platform/flight22
|
8b58c183b68adfc754da273ee6b4bc40c59b688a
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#flight_travel_api22.fugr.#dmo#flight_travel_update22.abap
|
SAP-Cloud-Platform/flight22
|
8b58c183b68adfc754da273ee6b4bc40c59b688a
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#flight_travel_api22.fugr.#dmo#flight_travel_update22.abap
|
SAP-Cloud-Platform/flight22
|
8b58c183b68adfc754da273ee6b4bc40c59b688a
|
[
"BSD-Source-Code"
] | null | null | null |
"! <h1>API for Updating a Travel</h1>
"!
"! <p>
"! Function module to update a single Travel instance with the possibility to update related Bookings and
"! Booking Supplements in the same call.
"! </p>
"!
"! <p>
"! For an operation only on a Booking or Booking Supplement the Travel Data Change Flag structure still must be applied.
"! It then contains only the <em>travel_id</em> and all flags set to <em>false</em> respectively left <em>initial</em>.
"! </p>
"!
"!
"! @parameter is_travel | Travel Data
"! @parameter is_travelx | Travel Data Change Flags
"! @parameter it_booking | Table of predefined Booking Key <em>booking_id</em> and Booking Data
"! @parameter it_bookingx | Change Flag Table of Booking Data with predefined Booking Key <em>booking_id</em>
"! @parameter it_booking_supplement | Table of predefined Booking Supplement Key <em>booking_id</em>, <em>booking_supplement_id</em> and Booking Supplement Data
"! @parameter it_booking_supplementx | Change Flag Table of Booking Supplement Data with predefined Booking Supplement Key <em>booking_id</em>, <em>booking_supplement_id</em>
"! @parameter es_travel | Evaluated Travel Data like /DMO/TRAVEL22
"! @parameter et_booking | Table of evaluated Bookings like /DMO/BOOKING22
"! @parameter et_booking_supplement | Table of evaluated Booking Supplements like /DMO/BOOK_SUP_22
"! @parameter et_messages | Table of occurred messages
"!
FUNCTION /DMO/FLIGHT_TRAVEL_UPDATE22.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IS_TRAVEL) TYPE /DMO/IF_FLIGHT_LEGACY22=>TS_TRAVEL_IN
*" REFERENCE(IS_TRAVELX) TYPE /DMO/IF_FLIGHT_LEGACY22=>TS_TRAVEL_INX
*" REFERENCE(IT_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY22=>TT_BOOKING_IN
*" OPTIONAL
*" REFERENCE(IT_BOOKINGX) TYPE
*" /DMO/IF_FLIGHT_LEGACY22=>TT_BOOKING_INX OPTIONAL
*" REFERENCE(IT_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY22=>TT_BOOKING_SUPPLEMENT_IN OPTIONAL
*" REFERENCE(IT_BOOKING_SUPPLEMENTX) TYPE
*" /DMO/IF_FLIGHT_LEGACY22=>TT_BOOKING_SUPPLEMENT_INX OPTIONAL
*" EXPORTING
*" REFERENCE(ES_TRAVEL) TYPE /DMO/TRAVEL22
*" REFERENCE(ET_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY22=>TT_BOOKING
*" REFERENCE(ET_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY22=>TT_BOOKING_SUPPLEMENT
*" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY22=>TT_MESSAGE
*"----------------------------------------------------------------------
CLEAR es_travel.
CLEAR et_booking.
CLEAR et_booking_supplement.
CLEAR et_messages.
/dmo/cl_flight_legacy22=>get_instance( )->update_travel( EXPORTING is_travel = is_travel
it_booking = it_booking
it_booking_supplement = it_booking_supplement
is_travelx = is_travelx
it_bookingx = it_bookingx
it_booking_supplementx = it_booking_supplementx
IMPORTING es_travel = es_travel
et_booking = et_booking
et_booking_supplement = et_booking_supplement
et_messages = DATA(lt_messages) ).
/dmo/cl_flight_legacy22=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages
IMPORTING et_messages = et_messages ).
ENDFUNCTION.
| 60.784615 | 174 | 0.581625 |
c401e05c0c511f146aebb44e504a59dec1798005
| 29,129 |
abap
|
ABAP
|
src/zpdynmas_new_cls.prog.abap
|
DennstedtB/ZPDYNMAS
|
372045bae1f7f1b3985ea494ea49c40a2cb86d29
|
[
"MIT"
] | 3 |
2019-11-28T21:13:17.000Z
|
2020-11-27T13:49:21.000Z
|
src/zpdynmas_new_cls.prog.abap
|
DennstedtB/ZPDYNMAS
|
372045bae1f7f1b3985ea494ea49c40a2cb86d29
|
[
"MIT"
] | 2 |
2019-05-15T08:23:58.000Z
|
2020-01-04T13:12:54.000Z
|
src/zpdynmas_new_cls.prog.abap
|
DennstedtB/ZPDYNMAS
|
372045bae1f7f1b3985ea494ea49c40a2cb86d29
|
[
"MIT"
] | 1 |
2020-11-27T13:49:22.000Z
|
2020-11-27T13:49:22.000Z
|
*&---------------------------------------------------------------------*
*& Include ZPDYNMAS_NEW_CLS
*&---------------------------------------------------------------------*
CLASS lcl_general_view DEFINITION DEFERRED.
CLASS lcl_tree_view DEFINITION DEFERRED.
CLASS lcx_change_db_not_successfull DEFINITION INHERITING FROM cx_static_check FINAL.
ENDCLASS.
CLASS lcx_change_db_not_successfull IMPLEMENTATION.
ENDCLASS.
CLASS lcx_write_tr_not_successfull DEFINITION INHERITING FROM cx_static_check FINAL.
ENDCLASS.
CLASS lcx_write_tr_not_successfull IMPLEMENTATION.
ENDCLASS.
CLASS lcx_delete_not_successfull DEFINITION INHERITING FROM cx_static_check FINAL.
ENDCLASS.
CLASS lcx_delete_not_successfull IMPLEMENTATION.
ENDCLASS.
CLASS lcl_dynmas DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
TYPES: t_t588z TYPE TABLE OF t588z.
CLASS-METHODS:
"! returns instance of lcl_dynmas
get_instance RETURNING VALUE(r_self) TYPE REF TO lcl_dynmas.
METHODS:
"! selects dynamic actions
select_dynmas.
METHODS:
"! returns complete T588Z
get_whole_table RETURNING VALUE(table) TYPE z_t_t588z.
METHODS:
"! returns every T588Z entry for the given infotype
get_for_infty IMPORTING infty TYPE infty
RETURNING VALUE(rt_all_for_infty) TYPE z_t_t588z,
"! returns every T588Z entry for the given infotype and subtype
get_for_subty IMPORTING infty TYPE infty
subty TYPE subty
RETURNING VALUE(rt_all_for_subty) TYPE z_t_t588z,
"! returns every T588Z entry for the given infotype, subtype and the fieldname
get_for_field IMPORTING infty TYPE infty
subty TYPE subty
field TYPE fieldname
RETURNING VALUE(rt_all_for_field) TYPE z_t_t588z,
"! returns every T588Z entry for the given infotype, subtype, fieldname and the action
get_for_actio IMPORTING infty TYPE infty
subty TYPE subty
field TYPE fieldname
actio TYPE opera
RETURNING VALUE(rt_all_for_actio) TYPE z_t_t588z.
METHODS:
"! Save changes into DB-Table T588Z and write an transport request
save IMPORTING current_t588z TYPE z_t_t588z
origin_t588z TYPE z_t_t588z.
PRIVATE SECTION.
METHODS: constructor.
METHODS:
"! write changes into transport request <br>
"! @Exception: If no entry got written into an TR --> exception
write_transport_request IMPORTING t588z TYPE z_t_t588z
RETURNING VALUE(transport_request) TYPE REF TO zif_trs_transport_request
RAISING lcx_write_tr_not_successfull.
METHODS:
"! writing the changes into the database table <br>
"! @Exception: If there was any error while writing into the db --> Exception
change_db_table IMPORTING origin_t588z TYPE z_t_t588z
current_t588z TYPE z_t_t588z
RAISING lcx_change_db_not_successfull.
METHODS:
"! Adds shown lines into saving table.
prepare_table_for_save IMPORTING current_shown_t588z TYPE z_t_t588z
original_shown_t588z TYPE z_t_t588z
RETURNING VALUE(result) TYPE z_t_t588z.
METHODS:
"! Deletes the modified entries from table complete_t588z
delete_modified_entries RAISING lcx_delete_not_successfull.
CLASS-DATA:
self TYPE REF TO lcl_dynmas.
DATA:
view_control TYPE REF TO lcl_general_view.
DATA:
complete_t588z TYPE z_t_t588z.
ENDCLASS.
CLASS lcl_table_view DEFINITION.
PUBLIC SECTION.
METHODS:
pbo.
METHODS:
insert,
delete,
clear_flag,
insert_flag.
METHODS:
get_origin_table RETURNING VALUE(origin) TYPE z_t_t588z.
CLASS-METHODS:
rebuild_numbers.
CLASS-METHODS: show_table IMPORTING it_t588z TYPE z_t_t588z.
CLASS-METHODS: has_table_changed RETURNING VALUE(changed) TYPE abap_bool.
CLASS-METHODS: get_shown_table RETURNING VALUE(shown) TYPE z_t_t588z.
PRIVATE SECTION.
CLASS-DATA:
origin_shown_table TYPE z_t_t588z.
METHODS:
loop_at_screen.
ENDCLASS.
CLASS lcl_tree_view DEFINITION.
PUBLIC SECTION.
TYPES:
" Type for nodes
BEGIN OF t_keytab,
node_key TYPE num10,
ntype TYPE char01, " I=INFTY, S=SUBTY, F=FNAME, O=OPERA
infty TYPE infty,
subty TYPE subty,
fname TYPE fieldname,
opera TYPE opera,
END OF t_keytab.
CLASS-DATA:
tree_container TYPE REF TO cl_gui_custom_container.
METHODS:
pbo.
METHODS:
add_node IMPORTING node_type TYPE char01
t588z_line TYPE t588z.
METHODS:
get_nodes RETURNING VALUE(r_node_table) TYPE treev_ntab,
get_items RETURNING VALUE(r_item_table) TYPE iwb_mtreeitm.
METHODS:
handle_node_double_click FOR EVENT node_double_click OF cl_gui_column_tree
IMPORTING node_key,
handle_item_double_click FOR EVENT item_double_click OF cl_gui_column_tree
IMPORTING node_key item_name.
PRIVATE SECTION.
DATA:
tree_grid TYPE REF TO cl_gui_column_tree.
" Tree Attributes
DATA:
node_counter TYPE num10,
node_table TYPE treev_ntab,
last_infty_key TYPE treev_node-node_key,
last_subty_key TYPE treev_node-node_key,
last_fname_key TYPE treev_node-node_key.
DATA:
item_table TYPE iwb_mtreeitm,
keytab TYPE TABLE OF t_keytab.
METHODS:
add_node_as_infty IMPORTING t588z_line TYPE t588z,
add_node_as_subty IMPORTING t588z_line TYPE t588z,
add_node_as_field IMPORTING t588z_line TYPE t588z,
add_node_as_funct IMPORTING t588z_line TYPE t588z.
METHODS:
add_item IMPORTING node_key TYPE treev_node-node_key
txt TYPE string,
add_key IMPORTING t588z_line TYPE t588z
node_key TYPE treev_node-node_key
ntype TYPE char01.
ENDCLASS.
CLASS lcl_general_view DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS:
get_instance RETURNING VALUE(r_self) TYPE REF TO lcl_general_view,
pbo.
METHODS:
add_node IMPORTING node_type TYPE char01
t588z_line TYPE t588z.
METHODS:
change_mode IMPORTING read_mode TYPE abap_bool OPTIONAL
write_mode TYPE abap_bool OPTIONAL
PREFERRED PARAMETER read_mode,
get_active_read_mode RETURNING VALUE(r_active_read_mode) TYPE abap_bool.
METHODS:
insert,
delete,
mark_all,
unmark_all.
METHODS:
set_focus IMPORTING s_focus TYPE lcl_tree_view=>t_keytab,
get_focus RETURNING VALUE(r_focus) TYPE lcl_tree_view=>t_keytab.
METHODS:
save_changes.
PRIVATE SECTION.
METHODS:
constructor.
DATA:
active_read_mode TYPE abap_bool.
DATA:
focus TYPE lcl_tree_view=>t_keytab.
CLASS-DATA:
self TYPE REF TO lcl_general_view.
DATA:
tree_view TYPE REF TO lcl_tree_view,
table_view TYPE REF TO lcl_table_view.
METHODS:
init_tree_view,
init_table_view.
ENDCLASS.
CLASS lcl_dynmas IMPLEMENTATION.
METHOD get_instance.
IF self IS NOT BOUND.
self = NEW lcl_dynmas( ).
ENDIF.
r_self = self.
ENDMETHOD.
METHOD constructor.
view_control = lcl_general_view=>get_instance( ).
ENDMETHOD.
METHOD select_dynmas.
SELECT * FROM t588z INTO TABLE complete_t588z.
LOOP AT complete_t588z INTO DATA(t588z).
AT NEW infty.
view_control->add_node( node_type = 'I' t588z_line = t588z ).
ENDAT.
AT NEW subty.
IF t588z-subty IS INITIAL.
t588z-subty = '****'.
ENDIF.
view_control->add_node( node_type = 'S' t588z_line = t588z ).
ENDAT.
AT NEW fname.
IF t588z-fname IS INITIAL.
t588z-fname = '*****'.
ENDIF.
view_control->add_node( node_type = 'F' t588z_line = t588z ).
ENDAT.
AT NEW opera.
view_control->add_node( node_type = 'O' t588z_line = t588z ).
ENDAT.
ENDLOOP.
ENDMETHOD.
METHOD get_whole_table.
table = complete_t588z.
ENDMETHOD.
METHOD get_for_infty.
rt_all_for_infty = FILTER z_t_t588z( complete_t588z WHERE mandt = sy-mandt AND infty = infty ).
ENDMETHOD.
METHOD get_for_subty.
rt_all_for_subty = FILTER z_t_t588z( complete_t588z
WHERE mandt = sy-mandt
AND infty = infty
AND subty = subty ).
ENDMETHOD.
METHOD get_for_field.
rt_all_for_field = FILTER z_t_t588z( complete_t588z
WHERE mandt = sy-mandt
AND infty = infty
AND subty = subty
AND fname = field ).
ENDMETHOD.
METHOD get_for_actio.
rt_all_for_actio = FILTER z_t_t588z( complete_t588z
WHERE mandt = sy-mandt
AND infty = infty
AND subty = subty
AND fname = field
AND opera = actio ).
ENDMETHOD.
METHOD save.
DATA(changed_shown_t588z) = me->prepare_table_for_save( current_shown_t588z = current_t588z
original_shown_t588z = origin_t588z ).
TRY.
me->delete_modified_entries( ).
CATCH lcx_delete_not_successfull.
RETURN.
ENDTRY.
INSERT LINES OF current_t588z INTO complete_t588z INDEX sy-tabix.
" change DB and write transport request
TRY.
me->change_db_table( origin_t588z = origin_t588z
current_t588z = current_t588z ).
me->write_transport_request( t588z = changed_shown_t588z ).
COMMIT WORK.
CATCH: lcx_change_db_not_successfull,
lcx_write_tr_not_successfull.
MESSAGE |{ 'Something went wrong'(msg) }| TYPE 'I'.
ROLLBACK WORK.
RETURN.
ENDTRY.
ENDMETHOD.
METHOD write_transport_request.
DATA:
lt_e071 TYPE TABLE OF e071,
lt_e071k TYPE TABLE OF e071k,
ls_e071k TYPE e071k,
tr_order TYPE trkorr,
tr_task TYPE trkorr.
" Version 1.0
CALL FUNCTION 'TRINT_ORDER_CHOICE'
EXPORTING
wi_order_type = 'W'
wi_task_type = 'Q'
wi_category = 'CUST'
IMPORTING
we_order = tr_order
we_task = tr_task
TABLES
wt_e071 = lt_e071
wt_e071k = lt_e071k
EXCEPTIONS
OTHERS = 6.
IF sy-subrc = 0.
DATA(ls_e071) = VALUE e071( as4pos = 0
pgmid = 'R3TR'
object = 'TABU'
obj_name = 'T588Z'
objfunc = 'K' ).
APPEND ls_e071 TO lt_e071.
LOOP AT t588z INTO DATA(s_t588z).
CONCATENATE sy-mandt s_t588z-infty s_t588z-subty s_t588z-fname
s_t588z-opera s_t588z-seqno INTO ls_e071k-tabkey.
ls_e071k-pgmid = 'R3TR'.
ls_e071k-as4pos = 0.
ls_e071k-object = ls_e071k-mastertype = 'TABU'.
ls_e071k-objname = ls_e071k-mastername = 'T588Z'.
APPEND ls_e071k TO lt_e071k.
CLEAR ls_e071k.
ENDLOOP.
IF lines( lt_e071k ) > 0 AND lines( lt_e071 ) > 0.
CALL FUNCTION 'TR_APPEND_TO_COMM_OBJS_KEYS'
EXPORTING
wi_trkorr = tr_task
TABLES
wt_e071 = lt_e071
wt_e071k = lt_e071k
EXCEPTIONS
OTHERS = 68.
IF sy-subrc = 0.
MESSAGE s000(vz) WITH |{ 'Entries are in Transport Request '(001) } { tr_order }|.
ELSE.
RAISE RESUMABLE EXCEPTION TYPE lcx_write_tr_not_successfull.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD change_db_table.
DATA: vinfo TYPE vargt,
kennz TYPE kenna,
t588z_line TYPE t588z,
highest_rc LIKE sy-subrc VALUE 0.
LOOP AT origin_t588z INTO DATA(origin).
CLEAR: t588z_line, kennz, vinfo.
" check if the line does still exist --> modify KENNZ and VINFO in database
IF line_exists( current_t588z[ infty = origin-infty subty = origin-subty fname = origin-fname
opera = origin-opera seqno = origin-seqno ] ).
t588z_line = current_t588z[ infty = origin-infty subty = origin-subty fname = origin-fname
opera = origin-opera seqno = origin-seqno ].
kennz = t588z_line-kennz.
vinfo = t588z_line-vinfo.
" if both lines are equal the update won't be performed and sy-subrc would be 4 --> exception
IF origin = t588z_line.
CONTINUE.
ENDIF.
UPDATE t588z SET kennz = kennz vinfo = vinfo
WHERE infty = t588z_line-infty
AND subty = t588z_line-subty
AND fname = t588z_line-fname
AND opera = t588z_line-opera
AND seqno = t588z_line.
IF sy-subrc = 4.
RAISE RESUMABLE EXCEPTION TYPE lcx_change_db_not_successfull.
ENDIF.
ELSE.
" delete every entry which is currently not in the table
DELETE FROM t588z WHERE infty = origin-infty AND subty = origin-subty
AND fname = origin-fname AND opera = origin-opera AND seqno = origin-seqno.
IF sy-subrc <> 0.
RAISE RESUMABLE EXCEPTION TYPE lcx_change_db_not_successfull.
ENDIF.
ENDIF.
ENDLOOP.
CLEAR: origin, t588z_line, kennz, vinfo.
" every line which was not in the origin table should get inserted into t588z
LOOP AT current_t588z INTO DATA(current).
" check if line existed in the origin table
IF line_exists( origin_t588z[ infty = current-infty subty = current-subty fname = current-fname
opera = current-opera seqno = current-seqno ] ).
"if yes continue with next entry ( we already processed it )
CONTINUE.
ELSE.
" if not insert it into t588z
INSERT INTO t588z VALUES @current.
IF sy-subrc <> 0.
RAISE RESUMABLE EXCEPTION TYPE lcx_change_db_not_successfull.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD prepare_table_for_save.
result = original_shown_t588z.
LOOP AT current_shown_t588z INTO DATA(shown_t588z).
IF NOT line_exists( original_shown_t588z[ infty = shown_t588z-infty
subty = shown_t588z-subty
fname = shown_t588z-fname
opera = shown_t588z-opera
seqno = shown_t588z-seqno ] ).
INSERT shown_t588z INTO TABLE result.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD delete_modified_entries.
DATA(current_focus) = lcl_general_view=>get_instance( )->get_focus( ).
CASE current_focus-ntype.
WHEN 'I'.
READ TABLE complete_t588z INTO DATA(dummy)
WITH KEY infty = current_focus-infty.
DELETE complete_t588z WHERE infty = current_focus-infty.
WHEN 'S'.
READ TABLE complete_t588z INTO dummy
WITH KEY infty = current_focus-infty subty = current_focus-subty.
DELETE complete_t588z WHERE infty = current_focus-infty AND subty = current_focus-subty.
WHEN 'F'.
READ TABLE complete_t588z INTO dummy
WITH KEY infty = current_focus-infty subty = current_focus-subty
fname = current_focus-fname.
DELETE complete_t588z WHERE infty = current_focus-infty AND subty = current_focus-subty
AND fname = current_focus-fname.
WHEN 'O'.
READ TABLE complete_t588z INTO dummy
WITH KEY infty = current_focus-infty subty = current_focus-subty
fname = current_focus-fname opera = current_focus-opera.
DELETE complete_t588z WHERE infty = current_focus-infty AND subty = current_focus-subty
AND fname = current_focus-fname AND opera = current_focus-opera.
ENDCASE.
IF sy-subrc <> 0.
RAISE RESUMABLE EXCEPTION TYPE lcx_delete_not_successfull.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_table_view IMPLEMENTATION.
METHOD show_table.
tc_t588z-top_line = 1.
MOVE-CORRESPONDING it_t588z TO t588z_itab.
origin_shown_table = it_t588z.
ENDMETHOD.
METHOD has_table_changed.
changed = COND abap_bool( WHEN t588z_itab EQ origin_shown_table THEN abap_false
ELSE abap_true ).
ENDMETHOD.
METHOD get_shown_table.
MOVE-CORRESPONDING t588z_itab TO shown.
ENDMETHOD.
METHOD pbo.
me->loop_at_screen( ).
ENDMETHOD.
METHOD insert.
READ TABLE t588z_itab INTO t588z_wa WITH KEY flag = 'X'.
IF sy-subrc <> 0.
RETURN.
ENDIF.
CLEAR: t588z_wa-seqno, t588z_wa-kennz, t588z_wa-vinfo.
INSERT t588z_wa INTO t588z_itab INDEX sy-tabix.
me->clear_flag( ).
ENDMETHOD.
METHOD delete.
DELETE t588z_itab WHERE flag = abap_true.
ENDMETHOD.
METHOD clear_flag.
LOOP AT t588z_itab ASSIGNING FIELD-SYMBOL(<t588z_line>).
<t588z_line>-flag = abap_false.
ENDLOOP.
ENDMETHOD.
METHOD insert_flag.
LOOP AT t588z_itab ASSIGNING FIELD-SYMBOL(<t588z_line>).
<t588z_line>-flag = abap_true.
ENDLOOP.
ENDMETHOD.
METHOD rebuild_numbers.
DATA: l_t588z LIKE t588z_wa.
" maybe there is a way to exclude the lines which are only a comment
LOOP AT t588z_itab INTO t588z_wa.
IF l_t588z-subty <> t588z_wa-subty OR
l_t588z-fname <> t588z_wa-fname OR
l_t588z-opera <> t588z_wa-opera.
l_t588z = t588z_wa.
CLEAR l_t588z-seqno.
ENDIF.
l_t588z-seqno = l_t588z-seqno + 1.
t588z_wa-seqno = l_t588z-seqno.
MODIFY t588z_itab FROM t588z_wa INDEX sy-tabix.
ENDLOOP.
ENDMETHOD.
METHOD loop_at_screen.
LOOP AT SCREEN."INTO DATA(screen).
" check for edit mode
IF lcl_general_view=>get_instance( )->get_active_read_mode( ) EQ abap_false. " --> it is change mode
" the fields should be ready for input
screen-input = 1.
IF NOT screen-group1 IS INITIAL.
" only subtypes
IF lcl_general_view=>get_instance( )->get_focus( )-ntype = 'S' AND screen-group1 = 'T_S'.
screen-input = 0.
ENDIF.
" Subtypes and Field
IF lcl_general_view=>get_instance( )->get_focus( )-ntype = 'F' AND ( screen-group1 = 'T_S' OR
screen-group1 = 'T_F' ).
screen-input = 0.
ENDIF.
" Subtype, Field and Operation
IF lcl_general_view=>get_instance( )->get_focus( )-ntype = 'O' AND ( screen-group1 = 'T_S' OR
screen-group1 = 'T_F' OR
screen-group1 = 'T_O' ).
screen-input = 0.
ENDIF.
ENDIF.
ELSE.
" read mode is active - no input allowed
screen-input = 0.
ENDIF.
MODIFY SCREEN." FROM screen.
ENDLOOP.
ENDMETHOD.
METHOD get_origin_table.
origin = origin_shown_table.
ENDMETHOD.
ENDCLASS.
CLASS lcl_tree_view IMPLEMENTATION.
METHOD pbo.
DATA:
event TYPE cntl_simple_event,
event_table TYPE cntl_simple_events.
DATA: hierarchy_header TYPE treev_hhdr.
IF lcl_tree_view=>tree_container IS INITIAL.
lcl_tree_view=>tree_container = NEW cl_gui_custom_container(
container_name = 'LCL_TREE_VIEW=>TREE_CONTAINER' ).
hierarchy_header-heading = 'Gefundene Einträge'(ent).
tree_grid = NEW cl_gui_column_tree( parent = lcl_tree_view=>tree_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
hierarchy_column_name = 'Col1'
hierarchy_header = hierarchy_header ).
" Double click on node
CLEAR event_table[].
event-eventid = tree_grid->eventid_node_double_click.
event-appl_event = 'X'. " process PAI if event occurs
APPEND event TO event_table.
" double click on item
event-eventid = tree_grid->eventid_item_double_click.
event-appl_event = 'X'. " process PAI if event occurs
APPEND event TO event_table.
tree_grid->set_registered_events( event_table ).
SET HANDLER me->handle_node_double_click FOR tree_grid.
SET HANDLER me->handle_item_double_click FOR tree_grid.
" build tree
tree_grid->add_nodes_and_items( node_table = node_table
item_table = item_table
item_table_structure_name = 'MTREEITM' ).
ENDIF.
ENDMETHOD.
METHOD handle_item_double_click.
me->handle_node_double_click( node_key ).
ENDMETHOD.
METHOD handle_node_double_click.
DATA t588z TYPE z_t_t588z.
TRY.
DATA(keywa) = keytab[ node_key = node_key ].
IF keywa-subty CS '*'.
CLEAR keywa-subty.
ENDIF.
IF keywa-fname CS '*'.
CLEAR keywa-fname.
ENDIF.
lcl_general_view=>get_instance( )->set_focus( keywa ).
CASE keywa-ntype.
WHEN 'I'.
t588z = lcl_dynmas=>get_instance( )->get_for_infty( infty = keywa-infty ).
WHEN 'S'.
t588z = lcl_dynmas=>get_instance( )->get_for_subty( infty = keywa-infty subty = keywa-subty ).
WHEN 'F'.
t588z = lcl_dynmas=>get_instance( )->get_for_field( infty = keywa-infty subty = keywa-subty
field = keywa-fname ).
WHEN 'O'.
t588z = lcl_dynmas=>get_instance( )->get_for_actio( infty = keywa-infty subty = keywa-subty
field = keywa-fname actio = keywa-opera ).
ENDCASE.
lcl_table_view=>show_table( t588z ).
CATCH cx_sy_itab_line_not_found.
ENDTRY.
ENDMETHOD.
METHOD add_node.
node_counter = node_counter + 1.
CASE node_type.
WHEN 'I'.
me->add_node_as_infty( t588z_line ).
WHEN 'S'.
me->add_node_as_subty( t588z_line ).
WHEN 'F'.
me->add_node_as_field( t588z_line ).
WHEN 'O'.
me->add_node_as_funct( t588z_line ).
WHEN OTHERS.
node_counter = node_counter - 1.
ENDCASE.
ENDMETHOD.
METHOD add_node_as_infty.
DATA node TYPE treev_node.
DATA txt TYPE string.
node-node_key = node_counter.
node-n_image = '@RG@'.
node-exp_image = '@RG@'.
node-isfolder = 'X'.
APPEND node TO node_table.
txt = 'Infotyp' && ` ` && t588z_line-infty.
me->add_item( node_key = node-node_key txt = txt ).
me->add_key( t588z_line = t588z_line
node_key = node-node_key
ntype = 'I' ).
CLEAR last_infty_key.
last_infty_key = node-node_key.
ENDMETHOD.
METHOD add_node_as_subty.
DATA node TYPE treev_node.
DATA txt TYPE string.
node-node_key = node_counter.
node-relatkey = last_infty_key.
node-relatship = cl_gui_column_tree=>relat_last_child.
node-n_image = '@S7@'.
node-exp_image = '@S7@'.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
txt = 'Subtyp' && ` ` && t588z_line-subty.
me->add_item( node_key = node-node_key txt = txt ).
me->add_key( t588z_line = t588z_line
node_key = node-node_key
ntype = 'S' ).
CLEAR last_subty_key.
last_subty_key = node-node_key.
ENDMETHOD.
METHOD add_node_as_field.
DATA node TYPE treev_node.
DATA txt TYPE string.
node-node_key = node_counter.
node-relatkey = last_subty_key.
node-relatship = cl_gui_column_tree=>relat_last_child.
node-n_image = '@HO@'.
node-exp_image = '@HO@'.
node-isfolder = 'X'.
node-expander = 'X'.
APPEND node TO node_table.
txt = 'Feld'(002) && ` ` && t588z_line-fname.
me->add_item( node_key = node-node_key txt = txt ).
me->add_key( t588z_line = t588z_line
node_key = node-node_key
ntype = 'F' ).
CLEAR last_fname_key.
last_fname_key = node-node_key.
ENDMETHOD.
METHOD add_node_as_funct.
DATA node TYPE treev_node.
DATA txt TYPE string.
node-node_key = node_counter.
node-relatkey = last_fname_key.
node-relatship = cl_gui_column_tree=>relat_last_child.
node-n_image = '@P6@'.
APPEND node TO node_table.
txt = SWITCH string( t588z_line-opera
WHEN '00' THEN '00 (generell)'(v00)
WHEN '02' THEN '02 (ändern)'(v02)
WHEN '04' THEN '04 (anlegen)'(v04)
WHEN '06' THEN '06 (anlegen/ändern)'(v06)
WHEN '08' THEN '08 (löschen)'(v08)
WHEN '10' THEN '10 (ändern/löschen)'(v10)
WHEN '12' THEN '12 (anlegen/löschen)'(v12) ).
me->add_item( node_key = node-node_key txt = txt ).
me->add_key( t588z_line = t588z_line
node_key = node-node_key
ntype = 'O' ).
ENDMETHOD.
METHOD add_item.
" Add Item to Tree
DATA item TYPE mtreeitm.
item-node_key = node_key.
item-item_name = 'Col1'.
item-class = cl_gui_column_tree=>item_class_text.
item-text = txt.
APPEND item TO item_table.
ENDMETHOD.
METHOD add_key.
DATA(keywa) = VALUE t_keytab( node_key = node_key
ntype = ntype ).
MOVE-CORRESPONDING t588z_line TO keywa.
APPEND keywa TO keytab.
ENDMETHOD.
METHOD get_nodes.
r_node_table = node_table.
ENDMETHOD.
METHOD get_items.
r_item_table = item_table.
ENDMETHOD.
ENDCLASS.
CLASS lcl_general_view IMPLEMENTATION.
METHOD get_instance.
IF self IS NOT BOUND.
self = NEW lcl_general_view( ).
ENDIF.
r_self = self.
ENDMETHOD.
METHOD set_focus.
focus = s_focus.
ENDMETHOD.
METHOD get_focus.
r_focus = focus.
ENDMETHOD.
METHOD save_changes.
IF me->get_active_read_mode( ) EQ abap_true.
RETURN.
ENDIF.
IF lcl_table_view=>has_table_changed( ).
lcl_dynmas=>get_instance( )->save( current_t588z = lcl_table_view=>get_shown_table( )
origin_t588z = table_view->get_origin_table( ) ).
me->change_mode( ).
ENDIF.
ENDMETHOD.
METHOD pbo.
get_instance( )->init_tree_view( ).
get_instance( )->init_table_view( ).
ENDMETHOD.
METHOD constructor.
active_read_mode = abap_true.
tree_view = NEW lcl_tree_view( ).
table_view = NEW lcl_table_view( ).
ENDMETHOD.
METHOD add_node.
tree_view->add_node( node_type = node_type t588z_line = t588z_line ).
ENDMETHOD.
METHOD init_tree_view.
tree_view->pbo( ).
ENDMETHOD.
METHOD init_table_view.
table_view->pbo( ).
ENDMETHOD.
METHOD change_mode.
" if one of the parameters is supplied!
IF read_mode IS SUPPLIED.
active_read_mode = read_mode.
RETURN.
ENDIF.
IF write_mode IS SUPPLIED.
active_read_mode = COND abap_bool( WHEN write_mode EQ abap_true THEN abap_false
WHEN write_mode EQ abap_false THEN abap_true ).
RETURN.
ENDIF.
" if none of the parameters is supplied
active_read_mode = COND abap_bool( WHEN active_read_mode EQ abap_true THEN abap_false
WHEN active_read_mode EQ abap_false THEN abap_true ).
ENDMETHOD.
METHOD get_active_read_mode.
" if active_read_mode eq abap_false --> write_mode eq true
r_active_read_mode = active_read_mode.
ENDMETHOD.
METHOD insert.
table_view->insert( ).
ENDMETHOD.
METHOD delete.
table_view->delete( ).
ENDMETHOD.
METHOD mark_all.
table_view->insert_flag( ).
ENDMETHOD.
METHOD unmark_all.
table_view->clear_flag( ).
ENDMETHOD.
ENDCLASS.
| 28.253152 | 106 | 0.602767 |
c4033a8a7356883ac79d0981d2ebbf021a87f096
| 5,071 |
abap
|
ABAP
|
src/zcl_dbc.clas.abap
|
CEngelVna/DesignByContract
|
37b491b978cda99f37742b08019c0887be28a8ee
|
[
"MIT"
] | null | null | null |
src/zcl_dbc.clas.abap
|
CEngelVna/DesignByContract
|
37b491b978cda99f37742b08019c0887be28a8ee
|
[
"MIT"
] | null | null | null |
src/zcl_dbc.clas.abap
|
CEngelVna/DesignByContract
|
37b491b978cda99f37742b08019c0887be28a8ee
|
[
"MIT"
] | null | null | null |
CLASS zcl_dbc DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CONSTANTS mc_production TYPE t000-cccategory VALUE 'P' ##NO_TEXT.
CLASS-METHODS ensure
IMPORTING
!which_is_true_if TYPE abap_bool
!that TYPE itex132 .
CLASS-METHODS require
IMPORTING
!which_is_true_if TYPE abap_bool
!that TYPE itex132 .
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS is_production
RETURNING
VALUE(result) TYPE abap_bool .
ENDCLASS.
CLASS zcl_dbc IMPLEMENTATION.
METHOD ensure.
* Local Variables
DATA: call_stack_list TYPE sys_callst,
client_program TYPE dbglprog,
server_program TYPE dbglprog,
client_routine TYPE dbglevent, "Calling Routine
server_routine TYPE dbglevent, "Routine where exception raised
count TYPE i.
* Preconditions
CHECK which_is_true_if = abap_false.
CHECK is_production( ) = abap_false.
DATA(log) = zcl_logger=>new( ).
"Read Call Stack
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
et_callstack = call_stack_list[].
"The call stack works backwards
LOOP AT call_stack_list ASSIGNING FIELD-SYMBOL(<call_stack>).
IF <call_stack>-progname CS 'ZCL_DBC'.
"i.e. we called ourself
CONTINUE.
ENDIF.
count = count + 1."Ha ha ha! Lightning Flashes!
CASE count.
WHEN 1.
server_program = <call_stack>-progname.
server_routine = <call_stack>-eventname.
WHEN 2.
client_program = <call_stack>-progname.
client_routine = <call_stack>-eventname.
WHEN OTHERS.
EXIT."From Loop
ENDCASE.
ENDLOOP.
*--------------------------------------------------------------------*
* Listing 04.14: - Building an Error Message
*--------------------------------------------------------------------*
log->add( :
|{ 'This Diagnosis is intended for IT'(011) }| ),
|{ 'Routine'(001) } { server_routine } { 'of program'(002) }{ server_program } { 'has a contract'(003) } | ),
|{ 'with calling routine'(004) } { client_routine } { 'of program'(002) } { client_program } | ),
|{ 'Routine'(001) } { server_routine } { 'agrees to carry out a certain task'(005) } | ),
|{ 'The task is to ensure that'(012) } { that } | ),
|{ 'That task has not been fulfilled by routine'(013) } { server_routine } | ),
|{ 'Therefore there is an error (bug) in routine'(008) } { server_routine } { 'that needs to be corrected'(009) } | ).
RAISE EXCEPTION TYPE zcx_violated_postcondition
EXPORTING
md_condition = that
mo_error_log = log.
ENDMETHOD.
METHOD is_production.
"T000 - Fully Buffered
SELECT SINGLE cccategory
FROM t000
INTO @DATA(ld_client_function)
WHERE mandt EQ @sy-mandt.
IF ld_client_function = mc_production.
result = abap_true.
ELSE.
result = abap_false.
ENDIF.
ENDMETHOD.
METHOD require.
* Local Variables
DATA: call_stack_list TYPE sys_callst,
client_program TYPE dbglprog,
server_program TYPE dbglprog,
client_routine TYPE dbglevent, "Calling Routine
server_routine TYPE dbglevent, "Routine where exception raised
count TYPE i.
"Preconditions
CHECK which_is_true_if = abap_false.
CHECK is_production( ) = abap_false.
DATA(log) = zcl_logger=>new( ).
"Read Call Stack
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
et_callstack = call_stack_list[].
"The call stack works backwards
LOOP AT call_stack_list ASSIGNING FIELD-SYMBOL(<call_stack>).
IF <call_stack>-progname CS 'ZCL_DBC'.
"i.e. we called ourself
CONTINUE.
ENDIF.
count = count + 1."Ha ha ha! Lightning Flashes!
CASE count.
WHEN 1.
server_program = <call_stack>-progname.
server_routine = <call_stack>-eventname.
WHEN 2.
client_program = <call_stack>-progname.
client_routine = <call_stack>-eventname.
WHEN OTHERS.
EXIT."From Loop
ENDCASE.
ENDLOOP.
"Please feel free to e-phrase the below so it makes better sense and then tell me!
log->add( :
| { 'This Diagnosis is intended for IT'(011) }| ),
| { 'Routine'(001) } { server_routine } { 'of program'(002) } { server_program } { 'has a contract'(003) }| ),
| { 'with routine'(015) } { client_routine } { 'of program'(002) } { client_program }| ),
| { 'Routine'(001) } { server_routine } { 'agrees to carry out a certain task'(005) }| ),
| { 'This requires that'(006) } { that }| ),
| { 'That condition has not been fulfilled by calling routine'(007) } { client_routine }| ),
| { 'and so therefore there is an error (bug) in routine'(014) } { client_routine } { 'that needs to be corrected'(009) }| ).
RAISE EXCEPTION TYPE zcx_violated_precondition
EXPORTING
md_condition = that
mo_error_log = log.
ENDMETHOD.
ENDCLASS.
| 31.496894 | 129 | 0.609347 |
c40e2d9ca264672a6f8deea480883dafa56e1229
| 608 |
abap
|
ABAP
|
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZTESTCL.abap
|
assessorgeneral/ConQAT
|
2a462f23f22c22aa9d01a7a204453d1be670ba60
|
[
"Apache-2.0"
] | null | null | null |
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZTESTCL.abap
|
assessorgeneral/ConQAT
|
2a462f23f22c22aa9d01a7a204453d1be670ba60
|
[
"Apache-2.0"
] | null | null | null |
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZTESTCL.abap
|
assessorgeneral/ConQAT
|
2a462f23f22c22aa9d01a7a204453d1be670ba60
|
[
"Apache-2.0"
] | null | null | null |
class ZTESTCL definition
public
final
create public .
public section.
interfaces ZIF_CQSE_SOURCE_OBJECT .
interfaces ZTEST .
protected section.
private section.
endclass. "ZTESTCL definition
*----------------------------------------------------------------------*
* class ZTESTCL implementation.
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class ZTESTCL implementation.
method ZIF_CQSE_SOURCE_OBJECT~GET_SOURCE.
endmethod.
endclass. "ZTESTCL implementation
| 23.384615 | 73 | 0.473684 |
c40e80b1965780ccc9fd74b96978ce0ded351dfa
| 2,941 |
abap
|
ABAP
|
src/legacy/#dmo#flight_travel_api17.fugr.#dmo#flight_travel_create17.abap
|
SAP-Cloud-Platform/flight17
|
68f6ec3c64c196261c013d63a9ab7eaa0a532931
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#flight_travel_api17.fugr.#dmo#flight_travel_create17.abap
|
SAP-Cloud-Platform/flight17
|
68f6ec3c64c196261c013d63a9ab7eaa0a532931
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#flight_travel_api17.fugr.#dmo#flight_travel_create17.abap
|
SAP-Cloud-Platform/flight17
|
68f6ec3c64c196261c013d63a9ab7eaa0a532931
|
[
"BSD-Source-Code"
] | null | null | null |
"! <h1>API for Creating a Travel</h1>
"!
"! <p>
"! Function module to create a single Travel instance with the possibility to create related Bookings and
"! Booking Supplements in the same call (so called deep-create).
"! </p>
"!
"! <p>
"! The <em>travel_id</em> will be provided be the API but the IDs of Booking <em>booking_id</em> as well
"! of Booking Supplements <em>booking_id</em> and <em>booking_supplement_id</em>.
"! </p>
"!
"!
"! @parameter is_travel | Travel Data
"! @parameter it_booking | Table of predefined Booking Key <em>booking_id</em> and Booking Data
"! @parameter it_booking_supplement | Table of predefined Booking Supplement Key <em>booking_id</em>, <em>booking_supplement_id</em> and Booking Supplement Data
"! @parameter es_travel | Evaluated Travel Data like /DMO/TRAVEL17
"! @parameter et_booking | Table of evaluated Bookings like /DMO/BOOKING17
"! @parameter et_booking_supplement | Table of evaluated Booking Supplements like /DMO/BOOK_SUP_17
"! @parameter et_messages | Table of occurred messages
"!
FUNCTION /DMO/FLIGHT_TRAVEL_CREATE17.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IS_TRAVEL) TYPE /DMO/IF_FLIGHT_LEGACY17=>TS_TRAVEL_IN
*" REFERENCE(IT_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY17=>TT_BOOKING_IN
*" OPTIONAL
*" REFERENCE(IT_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY17=>TT_BOOKING_SUPPLEMENT_IN OPTIONAL
*" EXPORTING
*" REFERENCE(ES_TRAVEL) TYPE /DMO/TRAVEL17
*" REFERENCE(ET_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY17=>TT_BOOKING
*" REFERENCE(ET_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY17=>TT_BOOKING_SUPPLEMENT
*" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY17=>TT_MESSAGE
*"----------------------------------------------------------------------
CLEAR es_travel.
CLEAR et_booking.
CLEAR et_booking_supplement.
CLEAR et_messages.
/dmo/cl_flight_legacy17=>get_instance( )->create_travel( EXPORTING is_travel = is_travel
it_booking = it_booking
it_booking_supplement = it_booking_supplement
IMPORTING es_travel = es_travel
et_booking = et_booking
et_booking_supplement = et_booking_supplement
et_messages = DATA(lt_messages) ).
/dmo/cl_flight_legacy17=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages
IMPORTING et_messages = et_messages ).
ENDFUNCTION.
| 54.462963 | 160 | 0.579395 |
c40f7d494ee6f361134171934685233339a75859
| 3,730 |
abap
|
ABAP
|
src/checks/zcl_aoc_check_20.clas.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 199 |
2015-02-17T07:08:01.000Z
|
2022-03-23T09:50:05.000Z
|
src/checks/zcl_aoc_check_20.clas.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 769 |
2015-01-03T07:09:11.000Z
|
2022-03-21T11:59:53.000Z
|
src/checks/zcl_aoc_check_20.clas.abap
|
DennstedtB/abapOpenChecks
|
551dad876ce09d6b7cca32dd166827f1cdbf33e5
|
[
"MIT"
] | 109 |
2015-03-09T10:22:34.000Z
|
2022-03-08T08:47:41.000Z
|
CLASS zcl_aoc_check_20 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.
DATA mv_nest_offset TYPE int4 .
DATA mv_offset TYPE int4 .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_20 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lv_col TYPE i,
lv_row TYPE i,
lv_offset LIKE mv_offset.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements,
<ls_token> LIKE LINE OF io_scan->tokens.
LOOP AT io_scan->statements ASSIGNING <ls_statement>
WHERE type <> io_scan->gc_statement-comment
AND type <> io_scan->gc_statement-comment_in_stmnt
AND type <> io_scan->gc_statement-empty
AND type <> io_scan->gc_statement-pragma
AND type <> io_scan->gc_statement-macro_definition.
READ TABLE io_scan->tokens ASSIGNING <ls_token> INDEX <ls_statement>-from.
IF sy-subrc = 0.
lv_col = <ls_token>-col.
lv_row = <ls_token>-row.
ELSE.
CONTINUE. " current loop
ENDIF.
IF <ls_token>-col MOD 2 <> 0.
inform( p_sub_obj_name = io_scan->get_include( <ls_statement>-level )
p_line = <ls_token>-row
p_kind = mv_errty
p_test = myname
p_code = '002' ).
ENDIF.
CASE <ls_token>-str.
WHEN 'IF'
OR 'LOOP'
OR 'ELSEIF'
OR 'CATCH'
OR 'DO'
OR 'WHILE'.
lv_offset = mv_nest_offset.
WHEN OTHERS.
lv_offset = mv_offset.
ENDCASE.
LOOP AT io_scan->tokens ASSIGNING <ls_token>
FROM <ls_statement>-from + 1 TO <ls_statement>-to.
IF <ls_token>-row = lv_row.
CONTINUE.
ENDIF.
IF <ls_token>-col < lv_col + lv_offset.
inform( p_sub_obj_name = io_scan->get_include( <ls_statement>-level )
p_line = <ls_token>-row
p_kind = mv_errty
p_test = myname
p_code = '001' ).
EXIT. " current loop
ENDIF.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '020'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
mv_offset = 2.
mv_nest_offset = 4.
insert_scimessage(
iv_code = '001'
iv_text = 'Bad indentation'(m01) ).
insert_scimessage(
iv_code = '002'
iv_text = 'Begin statement at tab position'(m02) ).
ENDMETHOD.
METHOD get_attributes.
EXPORT
mv_errty = mv_errty
mv_offset = mv_offset
mv_nest_offset = mv_nest_offset
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_offset 'Next line offset(spaces)' ''. "#EC NOTEXT
zzaoc_fill_att mv_nest_offset 'Statement increasing nesting' ''. "#EC NOTEXT
zzaoc_popup.
ENDMETHOD.
METHOD put_attributes.
IMPORT
mv_errty = mv_errty
mv_offset = mv_offset
mv_nest_offset = mv_nest_offset
FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED
ASSERT sy-subrc = 0.
ENDMETHOD.
ENDCLASS.
| 23.3125 | 80 | 0.588472 |
c410d916f37b91a16ec03f6ff6846a6f9381642d
| 892 |
abap
|
ABAP
|
src/alv/zcl_uitb_alv_metadata.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | 3 |
2021-03-08T13:02:46.000Z
|
2021-11-30T20:04:44.000Z
|
src/alv/zcl_uitb_alv_metadata.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | 1 |
2021-03-31T17:13:50.000Z
|
2021-03-31T20:05:02.000Z
|
src/alv/zcl_uitb_alv_metadata.clas.abap
|
stockbal/abap-ui-toolbox
|
93ee48975deab71aa16e3c898c9863b0c4e6ee19
|
[
"MIT"
] | null | null | null |
CLASS ZCL_UITB_alv_metadata DEFINITION
PUBLIC
ABSTRACT
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
io_controller TYPE REF TO ZIF_UITB_alv_metadata_ctrller
iv_name TYPE string OPTIONAL .
PROTECTED SECTION.
DATA mr_controller TYPE REF TO ZIF_UITB_alv_metadata_ctrller.
DATA mv_name TYPE string.
METHODS set_setter_changed
IMPORTING
iv_method TYPE string.
private section.
ENDCLASS.
CLASS ZCL_UITB_ALV_METADATA IMPLEMENTATION.
METHOD constructor.
mr_controller = io_controller.
mv_name = iv_name.
ENDMETHOD.
METHOD set_setter_changed.
mr_controller->set_changed(
iv_name = mv_name
iv_flavour = zif_uitb_c_alv_chglist_flavor=>setter
iv_refresh_mode = zif_uitb_c_alv_refresh=>soft
iv_method = iv_method
).
ENDMETHOD.
ENDCLASS.
| 21.756098 | 65 | 0.710762 |
c414658821bbc02d1c4de756f0cd9361480ad6b6
| 1,094 |
abap
|
ABAP
|
src/zif_atd_demo.intf.abap
|
sandraros/Demo-ATD
|
82385d01c14545d223db518d6ee8c3c9c4ba6e70
|
[
"MIT"
] | 6 |
2019-11-27T07:58:16.000Z
|
2022-03-29T05:34:50.000Z
|
src/zif_atd_demo.intf.abap
|
sandraros/Demo-ATD
|
82385d01c14545d223db518d6ee8c3c9c4ba6e70
|
[
"MIT"
] | null | null | null |
src/zif_atd_demo.intf.abap
|
sandraros/Demo-ATD
|
82385d01c14545d223db518d6ee8c3c9c4ba6e70
|
[
"MIT"
] | 2 |
2020-12-29T06:43:57.000Z
|
2021-12-07T11:03:19.000Z
|
INTERFACE zif_atd_demo
PUBLIC .
EVENTS action_done
EXPORTING
VALUE(param_name) TYPE i .
METHODS demo_raise_event .
METHODS several_cases
IMPORTING
!whatever TYPE i
RETURNING
VALUE(result) TYPE i .
METHODS decision_table
IMPORTING
!p1 TYPE i
!p2 TYPE i
RETURNING
VALUE(result) TYPE i .
METHODS demo_raise_exception.
METHODS demo_raise_exception2
IMPORTING
!whatever TYPE i OPTIONAL
RETURNING
VALUE(result) TYPE i .
METHODS exporting
EXPORTING
!result TYPE i .
METHODS importing_required
IMPORTING
!whatever TYPE i
RETURNING
VALUE(result) TYPE i .
METHODS importing_optional
IMPORTING
!whatever TYPE i DEFAULT 33
RETURNING
VALUE(result) TYPE i .
METHODS demo_returning
RETURNING
VALUE(result) TYPE i .
METHODS exporting_returning
EXPORTING
!exporting TYPE i
RETURNING
VALUE(returning) TYPE i .
METHODS changing
CHANGING
!whatever TYPE i .
ENDINTERFACE.
| 17.645161 | 37 | 0.641682 |
c414cbc26e9ea23455a9448ae6cf0709986c0ae8
| 221 |
abap
|
ABAP
|
src/test2/m3/z2mse_test2_m3_fgr_a.fugr.z2mse_test2_m3_function_a.abap
|
sabatale/SAP2Moose
|
59553fab013de732e2b7c9e67b6a4de799617b6a
|
[
"MIT"
] | 25 |
2017-09-05T12:57:46.000Z
|
2021-12-18T21:47:13.000Z
|
src/test2/m3/z2mse_test2_m3_fgr_a.fugr.z2mse_test2_m3_function_a.abap
|
sabatale/SAP2Moose
|
59553fab013de732e2b7c9e67b6a4de799617b6a
|
[
"MIT"
] | 72 |
2017-09-18T15:16:20.000Z
|
2021-12-10T20:09:32.000Z
|
src/test2/m3/z2mse_test2_m3_fgr_a.fugr.z2mse_test2_m3_function_a.abap
|
sabatale/SAP2Moose
|
59553fab013de732e2b7c9e67b6a4de799617b6a
|
[
"MIT"
] | 6 |
2017-11-05T19:23:19.000Z
|
2020-02-01T20:02:51.000Z
|
FUNCTION Z2MSE_TEST2_M3_FUNCTION_A.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------
ENDFUNCTION.
| 20.090909 | 72 | 0.262443 |
c416b9f5975ff05d73f3edd39cafc2b4a0b2290e
| 10,218 |
abap
|
ABAP
|
src/ui/zcl_abapgit_services_git.clas.abap
|
stoamandl/abapGit-1.80.0
|
a683f04e6519f6b4257f314ed554fbc1c6bd9631
|
[
"MIT"
] | null | null | null |
src/ui/zcl_abapgit_services_git.clas.abap
|
stoamandl/abapGit-1.80.0
|
a683f04e6519f6b4257f314ed554fbc1c6bd9631
|
[
"MIT"
] | null | null | null |
src/ui/zcl_abapgit_services_git.clas.abap
|
stoamandl/abapGit-1.80.0
|
a683f04e6519f6b4257f314ed554fbc1c6bd9631
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_services_git DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES:
BEGIN OF ty_commit_fields,
repo_key TYPE zif_abapgit_persistence=>ty_repo-key,
committer_name TYPE string,
committer_email TYPE string,
author_name TYPE string,
author_email TYPE string,
comment TYPE string,
body TYPE string,
END OF ty_commit_fields.
CLASS-METHODS pull
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS reset
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS create_branch
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS switch_branch
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS delete_branch
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS delete_tag
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS switch_tag
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS tag_overview
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
CLASS-METHODS commit
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo_online
!is_commit TYPE ty_commit_fields
!io_stage TYPE REF TO zcl_abapgit_stage
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ABAPGIT_SERVICES_GIT IMPLEMENTATION.
METHOD commit.
DATA: ls_comment TYPE zif_abapgit_definitions=>ty_comment,
li_user TYPE REF TO zif_abapgit_persist_user.
li_user = zcl_abapgit_persistence_user=>get_instance( ).
li_user->set_repo_git_user_name( iv_url = io_repo->get_url( )
iv_username = is_commit-committer_name ).
li_user->set_repo_git_user_email( iv_url = io_repo->get_url( )
iv_email = is_commit-committer_email ).
IF is_commit-committer_name IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: Committer name empty' ).
ELSEIF is_commit-committer_email IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: Committer email empty' ).
ELSEIF is_commit-author_email IS NOT INITIAL AND is_commit-author_name IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: Author name empty' ). " Opposite should be OK ?
ELSEIF is_commit-comment IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: empty comment' ).
ENDIF.
ls_comment-committer-name = is_commit-committer_name.
ls_comment-committer-email = is_commit-committer_email.
ls_comment-author-name = is_commit-author_name.
ls_comment-author-email = is_commit-author_email.
ls_comment-comment = is_commit-comment.
IF NOT is_commit-body IS INITIAL.
CONCATENATE ls_comment-comment '' is_commit-body
INTO ls_comment-comment SEPARATED BY zif_abapgit_definitions=>c_newline.
ENDIF.
io_repo->push( is_comment = ls_comment
io_stage = io_stage ).
COMMIT WORK.
ENDMETHOD.
METHOD create_branch.
DATA: lv_name TYPE string,
lv_cancel TYPE abap_bool,
lo_repo TYPE REF TO zcl_abapgit_repo_online,
li_popups TYPE REF TO zif_abapgit_popups.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->create_branch_popup(
IMPORTING
ev_name = lv_name
ev_cancel = lv_cancel ).
IF lv_cancel = abap_true.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
lo_repo->create_branch( lv_name ).
MESSAGE 'Switched to new branch' TYPE 'S' ##NO_TEXT.
ENDMETHOD.
METHOD delete_branch.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_branch TYPE zif_abapgit_definitions=>ty_git_branch,
lo_popups TYPE REF TO zif_abapgit_popups.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
lo_popups = zcl_abapgit_ui_factory=>get_popups( ).
ls_branch = lo_popups->branch_list_popup( iv_url = lo_repo->get_url( )
iv_hide_branch = lo_repo->get_branch_name( )
iv_hide_head = abap_true ).
IF ls_branch IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
zcl_abapgit_git_porcelain=>delete_branch(
iv_url = lo_repo->get_url( )
is_branch = ls_branch ).
MESSAGE 'Branch deleted' TYPE 'S'.
ENDMETHOD.
METHOD delete_tag.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_tag TYPE zif_abapgit_definitions=>ty_git_tag,
lv_text TYPE string.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
ls_tag = zcl_abapgit_ui_factory=>get_tag_popups( )->tag_select_popup( lo_repo ).
IF ls_tag IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
zcl_abapgit_git_porcelain=>delete_tag(
iv_url = lo_repo->get_url( )
is_tag = ls_tag ).
lv_text = |Tag { zcl_abapgit_tag=>remove_tag_prefix( ls_tag-name ) } deleted| ##NO_TEXT.
MESSAGE lv_text TYPE 'S'.
ENDMETHOD.
METHOD pull.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo.
lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
lo_repo->refresh( ).
zcl_abapgit_services_repo=>gui_deserialize( lo_repo ).
COMMIT WORK.
ENDMETHOD.
METHOD reset.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
lv_answer TYPE c LENGTH 1,
lt_unnecessary_local_objs TYPE zif_abapgit_definitions=>ty_tadir_tt,
lt_selected LIKE lt_unnecessary_local_objs,
lt_columns TYPE stringtab,
ls_checks TYPE zif_abapgit_definitions=>ty_delete_checks,
li_popups TYPE REF TO zif_abapgit_popups.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
IF lo_repo->get_local_settings( )-write_protected = abap_true.
zcx_abapgit_exception=>raise( 'Cannot reset. Local code is write-protected by repo config' ).
ENDIF.
* todo, separate UI and logic
lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm(
iv_titlebar = 'Warning'
iv_text_question = 'Reset local objects?'
iv_text_button_1 = 'Ok'
iv_icon_button_1 = 'ICON_OKAY'
iv_text_button_2 = 'Cancel'
iv_icon_button_2 = 'ICON_CANCEL'
iv_default_button = '2'
iv_display_cancel_button = abap_false ). "#EC NOTEXT
IF lv_answer = '2'.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
lt_unnecessary_local_objs = lo_repo->get_unnecessary_local_objs( ).
IF lines( lt_unnecessary_local_objs ) > 0.
INSERT `OBJECT` INTO TABLE lt_columns.
INSERT `OBJ_NAME` INTO TABLE lt_columns.
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->popup_to_select_from_list(
EXPORTING
it_list = lt_unnecessary_local_objs
iv_header_text = |Which unnecessary objects should be deleted?|
iv_select_column_text = 'Delete?'
it_columns_to_display = lt_columns
IMPORTING
et_list = lt_selected ).
IF lines( lt_selected ) > 0.
ls_checks = lo_repo->delete_checks( ).
IF ls_checks-transport-required = abap_true.
ls_checks-transport-transport = zcl_abapgit_ui_factory=>get_popups(
)->popup_transport_request( ls_checks-transport-type ).
ENDIF.
zcl_abapgit_objects=>delete( it_tadir = lt_selected
is_checks = ls_checks ).
* update repo cache
lo_repo->refresh( ).
ENDIF.
ENDIF.
zcl_abapgit_services_repo=>gui_deserialize( lo_repo ).
ENDMETHOD.
METHOD switch_branch.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_branch TYPE zif_abapgit_definitions=>ty_git_branch.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
ls_branch = zcl_abapgit_ui_factory=>get_popups( )->branch_list_popup(
iv_url = lo_repo->get_url( )
iv_default_branch = lo_repo->get_branch_name( )
iv_show_new_option = abap_true ).
IF ls_branch IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
IF ls_branch-name = zif_abapgit_popups=>c_new_branch_label.
create_branch( iv_key ).
RETURN.
ENDIF.
lo_repo->set_branch_name( ls_branch-name ).
COMMIT WORK AND WAIT.
ENDMETHOD.
METHOD switch_tag.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_tag TYPE zif_abapgit_definitions=>ty_git_tag.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
ls_tag = zcl_abapgit_ui_factory=>get_tag_popups( )->tag_select_popup( lo_repo ).
IF ls_tag IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
lo_repo->set_branch_name( ls_tag-name ).
COMMIT WORK AND WAIT.
ENDMETHOD.
METHOD tag_overview.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
zcl_abapgit_ui_factory=>get_tag_popups( )->tag_list_popup( lo_repo ).
ENDMETHOD.
ENDCLASS.
| 29.877193 | 99 | 0.661969 |
c4184704f35606486688f2e4e72ae49b8a443774
| 145 |
abap
|
ABAP
|
src/adt/if_adt_rest_rfc_application.intf.abap
|
FreHu/deps
|
cace18b54b325d99e4c54293624c1d2811a68ddd
|
[
"MIT"
] | 2 |
2020-04-19T14:38:41.000Z
|
2020-10-03T07:50:28.000Z
|
src/adt/if_adt_rest_rfc_application.intf.abap
|
FreHu/deps
|
cace18b54b325d99e4c54293624c1d2811a68ddd
|
[
"MIT"
] | 38 |
2019-08-13T17:30:13.000Z
|
2022-03-08T12:54:56.000Z
|
src/adt/if_adt_rest_rfc_application.intf.abap
|
FreHu/deps
|
cace18b54b325d99e4c54293624c1d2811a68ddd
|
[
"MIT"
] | 15 |
2019-11-19T13:45:29.000Z
|
2022-03-08T11:18:00.000Z
|
INTERFACE if_adt_rest_rfc_application PUBLIC.
METHODS:
get_static_uri_path
RETURNING
VALUE(result) TYPE string.
ENDINTERFACE.
| 24.166667 | 45 | 0.758621 |
c41c066f714bf9c058baefc7a2a3739253b37006
| 5,544 |
abap
|
ABAP
|
src/zcl_abapgit_repo_online.clas.testclasses.abap
|
sb-sap/abapGit
|
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
|
[
"MIT"
] | null | null | null |
src/zcl_abapgit_repo_online.clas.testclasses.abap
|
sb-sap/abapGit
|
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
|
[
"MIT"
] | null | null | null |
src/zcl_abapgit_repo_online.clas.testclasses.abap
|
sb-sap/abapGit
|
8d1f1c312f5cf70b97fb6f00530be53a5e968a5b
|
[
"MIT"
] | null | null | null |
*"* use this source file for your ABAP unit test classes
CLASS ltd_code_inspector DEFINITION FOR TESTING.
PUBLIC SECTION.
INTERFACES:
zif_abapgit_code_inspector.
METHODS:
constructor
IMPORTING
iv_package TYPE devclass.
PRIVATE SECTION.
DATA mv_package TYPE devclass.
ENDCLASS.
CLASS ltd_code_inspector IMPLEMENTATION.
METHOD constructor.
mv_package = iv_package.
ENDMETHOD.
METHOD zif_abapgit_code_inspector~run.
DATA: ls_list LIKE LINE OF rt_list.
IF mv_package = '$DUMMY'.
ls_list-kind = 'E'.
INSERT ls_list INTO TABLE rt_list.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_code_inspector~get_inspection. "##needed
ENDMETHOD.
ENDCLASS.
CLASS ltcl_run_code_inspection DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA:
mo_repo_online TYPE REF TO zcl_abapgit_repo_online,
mv_error_text TYPE string,
mt_act_list TYPE scit_alvlist.
METHODS:
exception_when_no_check_var FOR TESTING RAISING cx_static_check,
exception_when_error FOR TESTING RAISING cx_static_check,
no_exception_when_no_error FOR TESTING RAISING cx_static_check,
push_not_possible_if_ci_req FOR TESTING RAISING cx_static_check,
given_online_repo
IMPORTING
iv_package TYPE devclass
RAISING
zcx_abapgit_exception,
given_check_variant
IMPORTING
iv_check_variant TYPE string,
given_mock_code_inspector
IMPORTING
iv_package TYPE devclass
iv_check_variant TYPE sci_chkv ,
given_block_commit
IMPORTING
iv_block_commit TYPE abap_bool,
when_push,
then_exception_text_is
IMPORTING
iv_exp_error_text TYPE csequence,
when_run_code_inspector,
then_ci_detected_an_error,
then_no_exception_is_raised.
ENDCLASS.
CLASS zcl_abapgit_repo_online DEFINITION LOCAL FRIENDS ltcl_run_code_inspection.
CLASS ltcl_run_code_inspection IMPLEMENTATION.
METHOD exception_when_no_check_var.
given_online_repo( iv_package = '$DUMMY' ).
given_check_variant( || ).
when_run_code_inspector( ).
then_exception_text_is( |No check variant maintained in repo settings.| ).
ENDMETHOD.
METHOD exception_when_error.
given_online_repo( '$DUMMY' ).
given_check_variant( |variant| ).
given_mock_code_inspector( iv_package = '$DUMMY'
iv_check_variant = |variant| ).
when_run_code_inspector( ).
then_ci_detected_an_error( ).
ENDMETHOD.
METHOD no_exception_when_no_error.
DATA: lx_error TYPE REF TO zcx_abapgit_exception.
given_online_repo( '$PACKAGE' ).
given_check_variant( |variant| ).
given_mock_code_inspector( iv_package = '$PACKAGE'
iv_check_variant = |variant| ).
when_run_code_inspector( ).
then_no_exception_is_raised( ).
ENDMETHOD.
METHOD given_online_repo.
DATA: ls_data TYPE zif_abapgit_persistence=>ty_repo.
ls_data-key = 'dummmy'.
ls_data-package = iv_package.
CREATE OBJECT mo_repo_online
EXPORTING
is_data = ls_data.
ENDMETHOD.
METHOD given_check_variant.
mo_repo_online->ms_data-local_settings-code_inspector_check_variant = iv_check_variant.
ENDMETHOD.
METHOD given_mock_code_inspector.
DATA: lo_mock_code_inspector TYPE REF TO ltd_code_inspector.
CREATE OBJECT lo_mock_code_inspector
EXPORTING
iv_package = iv_package.
zcl_abapgit_injector=>set_code_inspector( iv_package = iv_package
iv_check_variant_name = iv_check_variant
ii_code_inspector = lo_mock_code_inspector ).
ENDMETHOD.
METHOD push_not_possible_if_ci_req.
given_online_repo( '$PACKAGE' ).
given_check_variant( |variant| ).
given_block_commit( abap_true ).
when_push( ).
then_exception_text_is( |A successful code inspection is required| ).
ENDMETHOD.
METHOD given_block_commit.
mo_repo_online->ms_data-local_settings-block_commit = abap_true.
ENDMETHOD.
METHOD when_push.
DATA: ls_comment TYPE zif_abapgit_definitions=>ty_comment,
lo_stage TYPE REF TO zcl_abapgit_stage,
lx_error TYPE REF TO zcx_abapgit_exception.
CREATE OBJECT lo_stage
EXPORTING
iv_branch_name = 'refs/master'
iv_branch_sha1 = 'dummy'.
TRY.
mo_repo_online->push( is_comment = ls_comment
io_stage = lo_stage ).
CATCH zcx_abapgit_exception INTO lx_error.
mv_error_text = lx_error->get_text( ).
ENDTRY.
ENDMETHOD.
METHOD then_exception_text_is.
cl_abap_unit_assert=>assert_equals(
exp = iv_exp_error_text
act = mv_error_text ).
ENDMETHOD.
METHOD when_run_code_inspector.
DATA: lx_error TYPE REF TO zcx_abapgit_exception.
TRY.
mt_act_list = mo_repo_online->run_code_inspector( ).
CATCH zcx_abapgit_exception INTO lx_error.
mv_error_text = lx_error->get_text( ).
ENDTRY.
ENDMETHOD.
METHOD then_ci_detected_an_error.
READ TABLE mt_act_list TRANSPORTING NO FIELDS
WITH KEY kind = 'E'.
cl_abap_unit_assert=>assert_subrc( exp = 0 ).
ENDMETHOD.
METHOD then_no_exception_is_raised.
cl_abap_unit_assert=>assert_initial( mv_error_text ).
ENDMETHOD.
ENDCLASS.
| 22.536585 | 95 | 0.690476 |
c41d5c562699ffeda7641f95b381625e3bfcb8f8
| 19,982 |
abap
|
ABAP
|
src/objects/core/zcl_abapgit_file_status.clas.abap
|
PeregrinTooc/abapGit
|
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
|
[
"MIT"
] | null | null | null |
src/objects/core/zcl_abapgit_file_status.clas.abap
|
PeregrinTooc/abapGit
|
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
|
[
"MIT"
] | null | null | null |
src/objects/core/zcl_abapgit_file_status.clas.abap
|
PeregrinTooc/abapGit
|
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_file_status DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS status
IMPORTING io_repo TYPE REF TO zcl_abapgit_repo
ii_log TYPE REF TO zif_abapgit_log OPTIONAL
RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
RAISING zcx_abapgit_exception.
CLASS-METHODS: identify_object
IMPORTING iv_filename TYPE string
iv_path TYPE string
iv_devclass TYPE devclass OPTIONAL
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
EXPORTING es_item TYPE zif_abapgit_definitions=>ty_item
ev_is_xml TYPE abap_bool
RAISING zcx_abapgit_exception.
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS: calculate_status
IMPORTING iv_devclass TYPE devclass
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
it_remote TYPE zif_abapgit_definitions=>ty_files_tt
it_cur_state TYPE zif_abapgit_definitions=>ty_file_signatures_tt
RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
RAISING zcx_abapgit_exception,
run_checks
IMPORTING ii_log TYPE REF TO zif_abapgit_log
it_results TYPE zif_abapgit_definitions=>ty_results_tt
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
iv_top TYPE devclass
RAISING zcx_abapgit_exception,
build_existing
IMPORTING is_local TYPE zif_abapgit_definitions=>ty_file_item
is_remote TYPE zif_abapgit_definitions=>ty_file
it_state TYPE zif_abapgit_definitions=>ty_file_signatures_ts
RETURNING VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result,
build_new_local
IMPORTING is_local TYPE zif_abapgit_definitions=>ty_file_item
RETURNING VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result,
build_new_remote
IMPORTING iv_devclass TYPE devclass
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
is_remote TYPE zif_abapgit_definitions=>ty_file
it_items TYPE zif_abapgit_definitions=>ty_items_ts
it_state TYPE zif_abapgit_definitions=>ty_file_signatures_ts
RETURNING VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result
RAISING zcx_abapgit_exception,
get_object_package
IMPORTING
iv_object TYPE tadir-object
iv_obj_name TYPE tadir-obj_name
RETURNING
VALUE(rv_devclass) TYPE devclass
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_file_status IMPLEMENTATION.
METHOD build_existing.
DATA: ls_file_sig LIKE LINE OF it_state.
" Item
rs_result-obj_type = is_local-item-obj_type.
rs_result-obj_name = is_local-item-obj_name.
rs_result-package = is_local-item-devclass.
" File
rs_result-path = is_local-file-path.
rs_result-filename = is_local-file-filename.
IF is_local-file-sha1 = is_remote-sha1.
rs_result-match = abap_true.
RETURN.
ENDIF.
" Match against current state
READ TABLE it_state INTO ls_file_sig
WITH KEY path = is_local-file-path
filename = is_local-file-filename
BINARY SEARCH.
IF sy-subrc = 0.
IF ls_file_sig-sha1 <> is_local-file-sha1.
rs_result-lstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
IF ls_file_sig-sha1 <> is_remote-sha1.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
rs_result-match = boolc( rs_result-lstate IS INITIAL
AND rs_result-rstate IS INITIAL ).
ELSE.
" This is a strange situation. As both local and remote exist
" the state should also be present. Maybe this is a first run of the code.
" In this case just compare hashes directly and mark both changed
" the user will presumably decide what to do after checking the actual diff
rs_result-match = boolc( is_local-file-sha1 = is_remote-sha1 ).
IF rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-modified.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD build_new_local.
" Item
rs_result-obj_type = is_local-item-obj_type.
rs_result-obj_name = is_local-item-obj_name.
rs_result-package = is_local-item-devclass.
" File
rs_result-path = is_local-file-path.
rs_result-filename = is_local-file-filename.
" Match
rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-added.
ENDMETHOD.
METHOD build_new_remote.
DATA: ls_item LIKE LINE OF it_items,
ls_file_sig LIKE LINE OF it_state.
" Common and default part
rs_result-path = is_remote-path.
rs_result-filename = is_remote-filename.
rs_result-match = abap_false.
rs_result-rstate = zif_abapgit_definitions=>c_state-added.
identify_object( EXPORTING iv_filename = is_remote-filename
iv_path = is_remote-path
iv_devclass = iv_devclass
io_dot = io_dot
IMPORTING es_item = ls_item ).
" Check if in item index + get package
READ TABLE it_items INTO ls_item
WITH KEY obj_type = ls_item-obj_type obj_name = ls_item-obj_name
BINARY SEARCH.
IF sy-subrc = 0.
" Completely new (xml, abap) and new file in an existing object
rs_result-obj_type = ls_item-obj_type.
rs_result-obj_name = ls_item-obj_name.
rs_result-package = ls_item-devclass.
READ TABLE it_state INTO ls_file_sig
WITH KEY path = is_remote-path filename = is_remote-filename
BINARY SEARCH.
" Existing file but from another package
" was not added during local file proc as was not in tadir for repo package
IF sy-subrc = 0.
IF ls_file_sig-sha1 = is_remote-sha1.
rs_result-match = abap_true.
CLEAR rs_result-rstate.
ELSE.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
" Item is in state and in cache but with no package - it was deleted
" OR devclass is the same as repo package (see #532)
IF ls_item-devclass IS INITIAL OR ls_item-devclass = iv_devclass.
rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ELSE. " Completely unknown file, probably non-abapgit
ASSERT 1 = 1. " No action, just follow defaults
ENDIF.
ENDMETHOD.
METHOD calculate_status.
DATA: lt_remote LIKE it_remote,
lv_index TYPE i,
lt_items TYPE zif_abapgit_definitions=>ty_items_tt,
ls_item LIKE LINE OF lt_items,
lv_is_xml TYPE abap_bool,
lv_sub_fetched TYPE abap_bool,
lt_sub_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt,
lt_items_idx TYPE zif_abapgit_definitions=>ty_items_ts,
lt_state_idx TYPE zif_abapgit_definitions=>ty_file_signatures_ts. " Sorted by path+filename
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF it_remote,
<ls_result> LIKE LINE OF rt_results,
<ls_state> LIKE LINE OF it_cur_state,
<ls_local> LIKE LINE OF it_local.
lt_state_idx = it_cur_state. " Force sort it
lt_remote = it_remote.
SORT lt_remote BY path filename.
" Skip ignored files
LOOP AT lt_remote ASSIGNING <ls_remote>.
lv_index = sy-tabix.
IF io_dot->is_ignored( iv_path = <ls_remote>-path
iv_filename = <ls_remote>-filename ) = abap_true.
DELETE lt_remote INDEX lv_index.
ENDIF.
ENDLOOP.
" Process local files and new local files
LOOP AT it_local ASSIGNING <ls_local>.
APPEND INITIAL LINE TO rt_results ASSIGNING <ls_result>.
IF <ls_local>-item IS NOT INITIAL.
APPEND <ls_local>-item TO lt_items. " Collect for item index
ENDIF.
READ TABLE lt_remote ASSIGNING <ls_remote>
WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename
BINARY SEARCH.
IF sy-subrc = 0. " Exist local and remote
<ls_result> = build_existing(
is_local = <ls_local>
is_remote = <ls_remote>
it_state = lt_state_idx ).
ASSERT <ls_remote>-sha1 IS NOT INITIAL.
CLEAR <ls_remote>-sha1. " Mark as processed
ELSE. " Only L exists
<ls_result> = build_new_local( <ls_local> ).
" Check if same file exists in different location
READ TABLE lt_remote ASSIGNING <ls_remote>
WITH KEY filename = <ls_local>-file-filename.
IF sy-subrc = 0 AND <ls_local>-file-sha1 = <ls_remote>-sha1.
<ls_result>-packmove = abap_true.
ELSEIF sy-subrc = 4.
" Check if file existed before and was deleted remotely
READ TABLE lt_state_idx ASSIGNING <ls_state>
WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename
BINARY SEARCH.
IF sy-subrc = 0.
IF <ls_local>-file-sha1 = <ls_state>-sha1.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-unchanged.
ELSE.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
<ls_result>-rstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ENDIF.
<ls_result>-inactive = <ls_local>-item-inactive.
ENDLOOP.
" Complete item index for unmarked remote files
LOOP AT lt_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL.
identify_object( EXPORTING iv_filename = <ls_remote>-filename
iv_path = <ls_remote>-path
io_dot = io_dot
iv_devclass = iv_devclass
IMPORTING es_item = ls_item
ev_is_xml = lv_is_xml ).
CHECK lv_is_xml = abap_true. " only object definitions
ls_item-devclass = get_object_package(
iv_object = ls_item-obj_type
iv_obj_name = ls_item-obj_name ).
IF NOT ls_item-devclass IS INITIAL AND iv_devclass <> ls_item-devclass.
IF lv_sub_fetched = abap_false.
lt_sub_packages = zcl_abapgit_factory=>get_sap_package( iv_devclass )->list_subpackages( ).
lv_sub_fetched = abap_true.
SORT lt_sub_packages BY table_line. "Optimize Read Access
ENDIF.
" Make sure the package is under the repo main package
READ TABLE lt_sub_packages TRANSPORTING NO FIELDS
WITH KEY table_line = ls_item-devclass
BINARY SEARCH.
IF sy-subrc <> 0.
CLEAR ls_item-devclass.
ENDIF.
ENDIF.
APPEND ls_item TO lt_items.
ENDLOOP.
SORT lt_items DESCENDING. " Default key - type, name, pkg, inactive
DELETE ADJACENT DUPLICATES FROM lt_items COMPARING obj_type obj_name devclass.
lt_items_idx = lt_items. " Self protection + UNIQUE records assertion
" Process new remote files (marked above with empty SHA1)
LOOP AT lt_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL.
APPEND INITIAL LINE TO rt_results ASSIGNING <ls_result>.
<ls_result> = build_new_remote( iv_devclass = iv_devclass
io_dot = io_dot
is_remote = <ls_remote>
it_items = lt_items_idx
it_state = lt_state_idx ).
" Check if same file exists in different location
READ TABLE it_local ASSIGNING <ls_local>
WITH KEY file-filename = <ls_remote>-filename.
IF sy-subrc = 0 AND <ls_local>-file-sha1 = <ls_remote>-sha1.
<ls_result>-packmove = abap_true.
ELSEIF sy-subrc = 4.
" Check if file existed before and was deleted locally
READ TABLE lt_state_idx ASSIGNING <ls_state>
WITH KEY path = <ls_remote>-path filename = <ls_remote>-filename
BINARY SEARCH.
IF sy-subrc = 0.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ENDLOOP.
SORT rt_results BY
obj_type ASCENDING
obj_name ASCENDING
filename ASCENDING.
ENDMETHOD.
METHOD get_object_package.
DATA: lv_name TYPE devclass,
li_package TYPE REF TO zif_abapgit_sap_package.
rv_devclass = zcl_abapgit_factory=>get_tadir( )->get_object_package(
iv_object = iv_object
iv_obj_name = iv_obj_name ).
IF rv_devclass IS INITIAL AND iv_object = 'DEVC' AND iv_obj_name(1) = '$'.
" local packages usually have no tadir entry
lv_name = iv_obj_name.
li_package = zcl_abapgit_factory=>get_sap_package( lv_name ).
IF li_package->exists( ) = abap_true.
rv_devclass = lv_name.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD identify_object.
DATA: lv_name TYPE string,
lv_type TYPE string,
lv_ext TYPE string.
" Guess object type and name
SPLIT to_upper( iv_filename ) AT '.' INTO lv_name lv_type lv_ext.
" Handle namespaces
REPLACE ALL OCCURRENCES OF '#' IN lv_name WITH '/'.
REPLACE ALL OCCURRENCES OF '#' IN lv_type WITH '/'.
REPLACE ALL OCCURRENCES OF '#' IN lv_ext WITH '/'.
" The counter part to this logic must be maintained in ZCL_ABAPGIT_OBJECTS_FILES->FILENAME
IF lv_type = 'DEVC'.
" Try to get a unique package name for DEVC by using the path
ASSERT lv_name = 'PACKAGE'.
lv_name = zcl_abapgit_folder_logic=>get_instance( )->path_to_package(
iv_top = iv_devclass
io_dot = io_dot
iv_create_if_not_exists = abap_false
iv_path = iv_path ).
ELSE.
" Get original object name
lv_name = cl_http_utility=>unescape_url( lv_name ).
ENDIF.
CLEAR es_item.
es_item-obj_type = lv_type.
es_item-obj_name = lv_name.
ev_is_xml = boolc( lv_ext = 'XML' AND strlen( lv_type ) = 4 ).
ENDMETHOD.
METHOD run_checks.
DATA: lv_path TYPE string,
ls_item TYPE zif_abapgit_definitions=>ty_item,
ls_file TYPE zif_abapgit_definitions=>ty_file_signature,
lt_res_sort LIKE it_results,
lt_item_idx LIKE it_results,
lt_move_idx LIKE it_results,
lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic.
FIELD-SYMBOLS: <ls_res1> LIKE LINE OF it_results,
<ls_res2> LIKE LINE OF it_results.
" This method just adds messages to the log. No log, nothing to do here
IF ii_log IS INITIAL.
RETURN.
ENDIF.
" Find all objects which were assigned to a different package
LOOP AT it_results ASSIGNING <ls_res1>
WHERE lstate = zif_abapgit_definitions=>c_state-added AND packmove = abap_true.
READ TABLE lt_move_idx TRANSPORTING NO FIELDS
WITH KEY obj_type = <ls_res1>-obj_type obj_name = <ls_res1>-obj_name
BINARY SEARCH. " Sorted since it_result is sorted
IF sy-subrc <> 0.
ii_log->add( iv_msg = |Changed package assignment for object { <ls_res1>-obj_type } { <ls_res1>-obj_name }|
iv_type = 'W'
iv_rc = '5' ).
APPEND INITIAL LINE TO lt_move_idx ASSIGNING <ls_res2>.
<ls_res2>-obj_type = <ls_res1>-obj_type.
<ls_res2>-obj_name = <ls_res1>-obj_name.
<ls_res2>-path = <ls_res1>-path.
ENDIF.
ENDLOOP.
" Collect object indexe
lt_res_sort = it_results.
SORT lt_res_sort BY obj_type ASCENDING obj_name ASCENDING.
LOOP AT it_results ASSIGNING <ls_res1> WHERE NOT obj_type IS INITIAL AND packmove = abap_false.
IF NOT ( <ls_res1>-obj_type = ls_item-obj_type
AND <ls_res1>-obj_name = ls_item-obj_name ).
APPEND INITIAL LINE TO lt_item_idx ASSIGNING <ls_res2>.
<ls_res2>-obj_type = <ls_res1>-obj_type.
<ls_res2>-obj_name = <ls_res1>-obj_name.
<ls_res2>-path = <ls_res1>-path.
MOVE-CORRESPONDING <ls_res1> TO ls_item.
ENDIF.
ENDLOOP.
" Check files for one object is in the same folder
LOOP AT it_results ASSIGNING <ls_res1>
WHERE NOT obj_type IS INITIAL AND obj_type <> 'DEVC' AND packmove = abap_false.
READ TABLE lt_item_idx ASSIGNING <ls_res2>
WITH KEY obj_type = <ls_res1>-obj_type obj_name = <ls_res1>-obj_name
BINARY SEARCH. " Sorted above
IF sy-subrc <> 0 OR <ls_res1>-path <> <ls_res2>-path. " All paths are same
ii_log->add( iv_msg = |Files for object { <ls_res1>-obj_type } {
<ls_res1>-obj_name } are not placed in the same folder|
iv_type = 'W'
iv_rc = '1' ).
ENDIF.
ENDLOOP.
" Check that objects are created in package corresponding to folder
lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ).
LOOP AT it_results ASSIGNING <ls_res1>
WHERE NOT package IS INITIAL AND NOT path IS INITIAL AND packmove = abap_false.
lv_path = lo_folder_logic->package_to_path(
iv_top = iv_top
io_dot = io_dot
iv_package = <ls_res1>-package ).
IF lv_path <> <ls_res1>-path.
ii_log->add( iv_msg = |Package and path does not match for object, {
<ls_res1>-obj_type } { <ls_res1>-obj_name }|
iv_type = 'W'
iv_rc = '2' ).
ENDIF.
ENDLOOP.
" Check for multiple files with same filename
SORT lt_res_sort BY filename ASCENDING.
LOOP AT lt_res_sort ASSIGNING <ls_res1> WHERE obj_type <> 'DEVC' AND packmove = abap_false.
IF <ls_res1>-filename IS NOT INITIAL AND <ls_res1>-filename = ls_file-filename.
ii_log->add( iv_msg = |Multiple files with same filename, { <ls_res1>-filename }|
iv_type = 'W'
iv_rc = '3' ).
ENDIF.
IF <ls_res1>-filename IS INITIAL.
ii_log->add( iv_msg = |Filename is empty for object { <ls_res1>-obj_type } { <ls_res1>-obj_name }|
iv_type = 'W'
iv_rc = '4' ).
ENDIF.
MOVE-CORRESPONDING <ls_res1> TO ls_file.
ENDLOOP.
ENDMETHOD.
METHOD status.
DATA: lv_index LIKE sy-tabix,
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt.
FIELD-SYMBOLS: <ls_result> LIKE LINE OF rt_results.
lt_local = io_repo->get_files_local( ii_log = ii_log ).
IF lines( lt_local ) <= 2.
" Less equal two means that we have only the .abapgit.xml and the package in
" our local repository. In this case we have to update our local .abapgit.xml
" from the remote one. Otherwise we get errors when e.g. the folder starting
" folder is different.
io_repo->find_remote_dot_abapgit( ).
ENDIF.
rt_results = calculate_status(
iv_devclass = io_repo->get_package( )
io_dot = io_repo->get_dot_abapgit( )
it_local = io_repo->get_files_local( ii_log = ii_log )
it_remote = io_repo->get_files_remote( )
it_cur_state = io_repo->get_local_checksums_per_file( ) ).
run_checks(
ii_log = ii_log
it_results = rt_results
io_dot = io_repo->get_dot_abapgit( )
iv_top = io_repo->get_package( ) ).
ENDMETHOD.
ENDCLASS.
| 37.988593 | 116 | 0.635422 |
c41d5feab6bb3da8c4cdf730767f25d3c0505fef
| 4,165 |
abap
|
ABAP
|
src/checks/zcl_aoc_check_23.clas.abap
|
sbcgua/abapOpenChecks
|
114673b322965d1ee9e783772859bd3f9f734bae
|
[
"MIT"
] | 1 |
2019-06-05T13:02:40.000Z
|
2019-06-05T13:02:40.000Z
|
src/checks/zcl_aoc_check_23.clas.abap
|
sbcgua/abapOpenChecks
|
114673b322965d1ee9e783772859bd3f9f734bae
|
[
"MIT"
] | null | null | null |
src/checks/zcl_aoc_check_23.clas.abap
|
sbcgua/abapOpenChecks
|
114673b322965d1ee9e783772859bd3f9f734bae
|
[
"MIT"
] | 1 |
2019-08-08T12:13:30.000Z
|
2019-08-08T12:13:30.000Z
|
CLASS zcl_aoc_check_23 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
METHODS get_message_text
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_23 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lv_code TYPE sci_errc,
lt_statements LIKE it_statements,
lv_include TYPE program.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF it_statements,
<ls_token> LIKE LINE OF it_tokens.
lt_statements = it_statements.
LOOP AT lt_statements ASSIGNING <ls_statement>
WHERE coloncol <> 0
AND type <> scan_stmnt_type-pragma.
CLEAR lv_code.
READ TABLE it_tokens ASSIGNING <ls_token> INDEX <ls_statement>-from.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
IF <ls_token>-str <> 'TYPES'
AND <ls_token>-str <> 'DATA'
AND <ls_token>-str <> 'CLASS-DATA'
AND <ls_token>-str <> 'STATICS'
AND <ls_token>-str <> 'WRITE'
AND <ls_token>-str <> 'MOVE' " anyhow obsolete
AND <ls_token>-str <> 'RANGES' " anyhow obsolete
AND <ls_token>-str <> 'METHODS'
AND <ls_token>-str <> 'CLEAR'
AND <ls_token>-str <> 'PERFORM'
AND <ls_token>-str <> 'REFRESH'
AND <ls_token>-str <> 'UNASSIGN'
AND <ls_token>-str <> 'FREE'
AND <ls_token>-str <> 'CONSTANTS'
AND <ls_token>-str <> 'TABLES'
AND <ls_token>-str <> 'PARAMETERS'
AND <ls_token>-str <> 'PARAMETER'
AND <ls_token>-str <> 'INTERFACES'
AND <ls_token>-str <> 'SELECT-OPTIONS'
AND <ls_token>-str <> 'SELECTION-SCREEN'
AND <ls_token>-str <> 'ALIASES'
AND <ls_token>-str <> 'INCLUDE'
AND <ls_token>-str <> 'TYPE-POOLS'
AND <ls_token>-str <> 'CLASS-METHODS'
AND <ls_token>-str <> 'FIELD-SYMBOLS'.
lv_code = '001'.
ENDIF.
IF lv_code IS INITIAL
AND strlen( <ls_token>-str ) + <ls_token>-col <> <ls_statement>-coloncol
AND <ls_token>-str <> 'PERFORM'.
lv_code = '002'.
ENDIF.
IF lv_code IS INITIAL.
LOOP AT it_tokens ASSIGNING <ls_token>
FROM <ls_statement>-from TO <ls_statement>-to
WHERE row = <ls_statement>-colonrow.
IF <ls_token>-col = <ls_statement>-coloncol + 1.
lv_code = '003'.
EXIT. " current loop
ENDIF.
ENDLOOP.
ENDIF.
IF NOT lv_code IS INITIAL.
lv_include = get_include( p_level = <ls_statement>-level ).
inform( p_sub_obj_type = c_type_include
p_sub_obj_name = lv_include
p_line = <ls_token>-row
p_kind = mv_errty
p_test = myname
p_code = lv_code ).
* do not report multiple errors for the same chanined statement
DELETE lt_statements
WHERE level = <ls_statement>-level
AND colonrow = <ls_statement>-colonrow
AND coloncol = <ls_statement>-coloncol.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '023'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
mv_errty = c_error.
ENDMETHOD. "CONSTRUCTOR
METHOD get_message_text.
CLEAR p_text.
CASE p_code.
WHEN '001'.
p_text = 'Use chained statements mainly for declarations'. "#EC NOTEXT
WHEN '002'.
p_text = 'Space before colon'. "#EC NOTEXT
WHEN '003'.
p_text = 'Missing space after colon'. "#EC NOTEXT
WHEN OTHERS.
super->get_message_text( EXPORTING p_test = p_test
p_code = p_code
IMPORTING p_text = p_text ).
ENDCASE.
ENDMETHOD. "GET_MESSAGE_TEXT
ENDCLASS.
| 27.222222 | 84 | 0.565186 |
c420ab09b1ab760e23646f8c52651da0c8d8963f
| 433 |
abap
|
ABAP
|
src/fugr/openabap.fugr.text_split.abap
|
sbcgua/open-abap
|
98d939658ec0db2a1ff2bd6979d7c9b52dc9dc5e
|
[
"MIT"
] | 20 |
2020-10-02T09:37:08.000Z
|
2022-03-26T15:29:11.000Z
|
src/fugr/openabap.fugr.text_split.abap
|
sbcgua/open-abap
|
98d939658ec0db2a1ff2bd6979d7c9b52dc9dc5e
|
[
"MIT"
] | 28 |
2020-12-02T15:19:10.000Z
|
2022-03-24T06:12:47.000Z
|
src/fugr/openabap.fugr.text_split.abap
|
sbcgua/open-abap
|
98d939658ec0db2a1ff2bd6979d7c9b52dc9dc5e
|
[
"MIT"
] | 2 |
2020-11-17T13:21:38.000Z
|
2021-11-07T14:35:54.000Z
|
FUNCTION text_split.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(LENGTH)
*" REFERENCE(TEXT)
*" EXPORTING
*" VALUE(LINE)
*" VALUE(REST)
*"----------------------------------------------------------------------
IF strlen( text ) < 50.
line = text.
rest = ''.
ELSE.
line = text(50).
rest = rest+50.
ENDIF.
ENDFUNCTION.
| 20.619048 | 72 | 0.374134 |
c42ac1ff2a48e43f69ab8fcf90ec6befaf9466b1
| 1,875 |
abap
|
ABAP
|
src/data_access/zcl_dbbr_query_exporter.clas.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 15 |
2020-02-05T10:38:12.000Z
|
2022-02-11T18:06:17.000Z
|
src/data_access/zcl_dbbr_query_exporter.clas.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 10 |
2021-01-19T07:45:37.000Z
|
2021-07-15T19:08:54.000Z
|
src/data_access/zcl_dbbr_query_exporter.clas.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 9 |
2020-04-08T19:13:18.000Z
|
2021-10-02T12:53:39.000Z
|
CLASS zcl_dbbr_query_exporter DEFINITION
PUBLIC
FINAL
INHERITING FROM zcl_uitb_generic_exporter
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
iv_file_name TYPE string OPTIONAL
!it_query_info TYPE zdbbr_query_info_ui_itab .
PROTECTED SECTION.
METHODS: build_data_for_export REDEFINITION,
write_success_message REDEFINITION,
write_error_message REDEFINITION.
METHODS: create_internal_table_ref REDEFINITION.
PRIVATE SECTION.
DATA mt_query_info TYPE zdbbr_query_info_ui_itab .
ENDCLASS.
CLASS zcl_dbbr_query_exporter IMPLEMENTATION.
METHOD build_data_for_export.
FIELD-SYMBOLS: <lt_table> TYPE zdbbr_query_data_itab.
ASSIGN mr_source_data_tab->* TO <lt_table>.
DATA(lr_query_f) = NEW zcl_dbbr_query_factory( ).
LOOP AT mt_query_info ASSIGNING FIELD-SYMBOL(<ls_query>).
APPEND lr_query_f->get_query_by_id(
EXPORTING
iv_query_id = <ls_query>-query_id
if_load_jump_destinations = abap_true
if_load_formulas = abap_true
) TO <lt_table>.
ENDLOOP.
CLEAR mt_query_info.
ENDMETHOD.
METHOD constructor.
super->constructor(
iv_default_file_name = COND #(
WHEN iv_file_name IS NOT INITIAL THEN iv_file_name ELSE 'DB-Browser-querys'
)
).
mt_query_info = it_query_info.
ENDMETHOD.
METHOD create_internal_table_ref.
rr_table_ref = NEW zdbbr_query_data_itab( ).
ENDMETHOD.
METHOD write_error_message.
MESSAGE s009(zdbbr_exception) DISPLAY LIKE 'E'.
ENDMETHOD.
METHOD write_success_message.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE.
ASSIGN mr_source_data_tab->* TO <lt_table>.
MESSAGE s038(zdbbr_info) WITH |{ lines( <lt_table> ) }|
mv_full_export_path.
ENDMETHOD.
ENDCLASS.
| 24.350649 | 85 | 0.704533 |
c42ad69b302947cdea00b0c90c6c0857f1d331bb
| 1,088 |
abap
|
ABAP
|
src/ycl_cygnus.clas.testclasses.abap
|
pacheco7/Cygnus
|
251b863a06ffe19c2b80e11edfe7ccfd2f27ffb7
|
[
"MIT"
] | null | null | null |
src/ycl_cygnus.clas.testclasses.abap
|
pacheco7/Cygnus
|
251b863a06ffe19c2b80e11edfe7ccfd2f27ffb7
|
[
"MIT"
] | 1 |
2019-01-19T18:06:40.000Z
|
2020-05-22T15:55:58.000Z
|
src/ycl_cygnus.clas.testclasses.abap
|
pacheco7/Cygnus
|
251b863a06ffe19c2b80e11edfe7ccfd2f27ffb7
|
[
"MIT"
] | null | null | null |
*"* use this source file for your ABAP unit test classes
CLASS test_cygnus DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS CREATE PRIVATE.
PRIVATE SECTION.
METHODS:
t01_trim FOR TESTING,
t02_equals_simple_true FOR TESTING,
t03_equals_simple_false FOR TESTING.
ENDCLASS.
CLASS test_cygnus IMPLEMENTATION.
METHOD t01_trim.
cl_abap_unit_assert=>assert_equals( act = NEW ycl_cygnus( )->trim( ' XYZ ' )
exp = 'XYZ'
msg = |Can't convert the inputed string| ).
ENDMETHOD.
METHOD t02_equals_simple_true.
cl_abap_unit_assert=>assert_true( act = NEW ycl_cygnus( )->equals( im_input1 = 1 im_input2 = 1 )
msg = |The objects must be equivalent| ).
ENDMETHOD.
METHOD t03_equals_simple_false.
cl_abap_unit_assert=>assert_false( act = NEW ycl_cygnus( )->equals( im_input1 = 1 im_input2 = '1' )
msg = |The objects must be different| ).
ENDMETHOD.
ENDCLASS.
| 40.296296 | 103 | 0.613971 |
c42c3b9978fe0408d5bd87b88d04aaf0d1da564d
| 60 |
abap
|
ABAP
|
zbugtracker_model/zbugtacker_conversions.fugr.lzbugtacker_conversionstop.abap
|
rayatus/sapbugtracker
|
c94439c3bb21908f7945fc5bf3bd88868903e8e8
|
[
"MIT"
] | 3 |
2019-02-10T22:03:43.000Z
|
2021-05-26T06:49:55.000Z
|
zbugtracker_model/zbugtacker_conversions.fugr.lzbugtacker_conversionstop.abap
|
rayatus/sapbugtracker
|
c94439c3bb21908f7945fc5bf3bd88868903e8e8
|
[
"MIT"
] | 2 |
2020-05-06T14:25:17.000Z
|
2022-01-13T10:06:40.000Z
|
zbugtracker_model/zbugtacker_conversions.fugr.lzbugtacker_conversionstop.abap
|
rayatus/sapbugtracker
|
c94439c3bb21908f7945fc5bf3bd88868903e8e8
|
[
"MIT"
] | 1 |
2021-05-26T06:49:56.000Z
|
2021-05-26T06:49:56.000Z
|
FUNCTION-POOL ZBUGTACKER_CONVERSIONS. "MESSAGE-ID ..
| 20 | 58 | 0.716667 |
c42e0f84fcc6143c21f47ed3b0e4e5b13384ebb0
| 488 |
abap
|
ABAP
|
src/zcl_local_test.clas.abap
|
pokrakam/openSAP-RAP
|
c6e1ee171a860c8ec6c7ff33ba3cd1215301eb11
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_local_test.clas.abap
|
pokrakam/openSAP-RAP
|
c6e1ee171a860c8ec6c7ff33ba3cd1215301eb11
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_local_test.clas.abap
|
pokrakam/openSAP-RAP
|
c6e1ee171a860c8ec6c7ff33ba3cd1215301eb11
|
[
"Apache-2.0"
] | null | null | null |
CLASS zcl_local_test DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_LOCAL_TEST IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA o TYPE REF TO object.
DATA s TYPE string.
CREATE OBJECT o TYPE ('\PROGRAM=ZBP_I_RAP_TRAVEL_MIPO=========CP\CLASS=LHC_TRAVEL').
CALL METHOD o->('FOO') RECEIVING result = s.
out->write( s ).
ENDMETHOD.
ENDCLASS.
| 16.827586 | 88 | 0.706967 |
c43059ff7e7ea7592d78ada08c178a6ed6feed88
| 8,045 |
abap
|
ABAP
|
src/zcl_abapgit_news.clas.abap
|
abapGit/upport
|
322935c225756b5107d7c835e6ccc13ba3dcbe4a
|
[
"MIT"
] | 2 |
2021-01-08T21:38:32.000Z
|
2021-11-17T19:37:14.000Z
|
src/zcl_abapgit_news.clas.abap
|
abapGit/upport
|
322935c225756b5107d7c835e6ccc13ba3dcbe4a
|
[
"MIT"
] | null | null | null |
src/zcl_abapgit_news.clas.abap
|
abapGit/upport
|
322935c225756b5107d7c835e6ccc13ba3dcbe4a
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_news DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
TYPES:
BEGIN OF ty_log,
version TYPE string,
pos_to_cur TYPE i,
is_header TYPE abap_bool,
is_important TYPE abap_bool,
text TYPE string,
END OF ty_log .
TYPES:
ty_logs TYPE STANDARD TABLE OF ty_log WITH DEFAULT KEY .
CONSTANTS c_tail_length TYPE i VALUE 5 ##NO_TEXT. " Number of versions to display if no updates
CLASS-METHODS create " TODO REFACTOR
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
RETURNING
VALUE(ro_instance) TYPE REF TO zcl_abapgit_news
RAISING
zcx_abapgit_exception .
METHODS get_log
RETURNING
VALUE(rt_log) TYPE ty_logs .
METHODS has_news
RETURNING
VALUE(rv_boolean) TYPE abap_bool .
METHODS has_important
RETURNING
VALUE(rv_boolean) TYPE abap_bool .
METHODS has_updates
RETURNING
VALUE(rv_boolean) TYPE abap_bool .
METHODS has_unseen
RETURNING
VALUE(rv_boolean) TYPE abap_bool .
METHODS constructor
IMPORTING
!iv_rawdata TYPE xstring
!iv_lastseen_version TYPE string
!iv_current_version TYPE string .
PROTECTED SECTION.
PRIVATE SECTION.
DATA mt_log TYPE ty_logs .
DATA mv_current_version TYPE string .
DATA mv_lastseen_version TYPE string .
DATA mv_latest_version TYPE string .
METHODS latest_version
RETURNING
VALUE(rv_version) TYPE string .
CLASS-METHODS parse_line
IMPORTING
!iv_line TYPE string
!iv_current_version TYPE string
RETURNING
VALUE(rs_log) TYPE ty_log .
CLASS-METHODS parse
IMPORTING
!it_lines TYPE string_table
!iv_current_version TYPE string
RETURNING
VALUE(rt_log) TYPE ty_logs .
ENDCLASS.
CLASS zcl_abapgit_news IMPLEMENTATION.
METHOD constructor.
DATA: lt_lines TYPE string_table,
lv_string TYPE string,
ls_log_line LIKE LINE OF mt_log.
" Validate params
mv_current_version = zcl_abapgit_version=>normalize( iv_current_version ).
mv_lastseen_version = zcl_abapgit_version=>normalize( iv_lastseen_version ).
IF mv_current_version IS INITIAL.
RETURN. " Internal format of program version is not correct -> abort parsing
ENDIF.
lv_string = zcl_abapgit_convert=>xstring_to_string_utf8( iv_rawdata ).
lt_lines = zcl_abapgit_convert=>split_string( lv_string ).
mt_log = parse( it_lines = lt_lines
iv_current_version = mv_current_version ).
READ TABLE mt_log INTO ls_log_line INDEX 1.
mv_latest_version = ls_log_line-version. " Empty if not found
ENDMETHOD.
METHOD create.
CONSTANTS: " TODO refactor
lc_log_path TYPE string VALUE '/',
lc_log_filename TYPE string VALUE 'changelog*',
lc_log_filename_up TYPE string VALUE 'CHANGELOG*'.
DATA: lo_apack TYPE REF TO zcl_abapgit_apack_reader,
lt_remote TYPE zif_abapgit_definitions=>ty_files_tt,
lv_version TYPE string,
lv_last_seen TYPE string,
lv_url TYPE string,
lo_repo_online TYPE REF TO zcl_abapgit_repo_online.
FIELD-SYMBOLS <ls_file> LIKE LINE OF lt_remote.
IF io_repo->is_offline( ) = abap_true.
RETURN.
ENDIF.
lo_repo_online ?= io_repo.
lv_url = lo_repo_online->get_url( ).
IF zcl_abapgit_url=>is_abapgit_repo( lv_url ) = abap_true.
lv_version = zif_abapgit_version=>c_abap_version. " TODO refactor
ELSE.
lo_apack = io_repo->get_dot_apack( ).
IF lo_apack IS NOT BOUND.
RETURN.
ENDIF.
lv_version = lo_apack->get_manifest_descriptor( )-version.
ENDIF.
IF lv_version IS INITIAL.
RETURN.
ENDIF.
lv_last_seen = zcl_abapgit_persistence_user=>get_instance( )->get_repo_last_change_seen( lv_url ).
TRY. " Find changelog
lt_remote = io_repo->get_files_remote( ).
CATCH zcx_abapgit_exception.
RETURN.
ENDTRY.
LOOP AT lt_remote ASSIGNING <ls_file> WHERE path = lc_log_path
AND ( filename CP lc_log_filename OR filename CP lc_log_filename_up ).
ro_instance = NEW #( iv_rawdata = <ls_file>-data
iv_current_version = lv_version
iv_lastseen_version = zcl_abapgit_version=>normalize( lv_last_seen ) ).
EXIT.
ENDLOOP.
IF ro_instance IS BOUND AND lv_last_seen <> ro_instance->latest_version( ).
zcl_abapgit_persistence_user=>get_instance( )->set_repo_last_change_seen(
iv_url = lv_url
iv_version = ro_instance->latest_version( ) ).
ENDIF.
ENDMETHOD.
METHOD get_log.
rt_log = mt_log.
ENDMETHOD.
METHOD has_important.
READ TABLE mt_log WITH KEY is_important = abap_true TRANSPORTING NO FIELDS.
rv_boolean = xsdbool( sy-subrc IS INITIAL ).
ENDMETHOD.
METHOD has_news.
rv_boolean = xsdbool( lines( mt_log ) > 0 ).
ENDMETHOD.
METHOD has_unseen.
rv_boolean = xsdbool( zcl_abapgit_version=>compare(
iv_a = mv_latest_version
iv_b = mv_lastseen_version ) > 0 ).
ENDMETHOD.
METHOD has_updates.
rv_boolean = xsdbool( zcl_abapgit_version=>compare(
iv_a = mv_latest_version
iv_b = mv_current_version ) > 0 ).
ENDMETHOD.
METHOD latest_version.
rv_version = mv_latest_version.
ENDMETHOD.
METHOD parse.
DATA: lv_tail TYPE i,
lv_first_version_found TYPE abap_bool,
lv_version TYPE string,
ls_log LIKE LINE OF rt_log.
FIELD-SYMBOLS: <lv_line> LIKE LINE OF it_lines.
LOOP AT it_lines ASSIGNING <lv_line>.
ls_log = parse_line( iv_line = <lv_line>
iv_current_version = iv_current_version ).
" Skip until first version head and Skip empty lines
CHECK ls_log IS NOT INITIAL AND
( lv_first_version_found = abap_true OR ls_log-version IS NOT INITIAL ).
IF lv_first_version_found = abap_false.
lv_first_version_found = abap_true.
IF zcl_abapgit_version=>compare( iv_a = ls_log-version
iv_b = iv_current_version ) <= 0.
lv_tail = c_tail_length. " Display some last versions if no updates
ENDIF.
ENDIF.
IF ls_log-is_header = abap_true.
"Skip everything below current version or show tail news
IF zcl_abapgit_version=>compare( iv_a = ls_log-version
iv_b = iv_current_version ) <= 0.
IF lv_tail > 0.
lv_tail = lv_tail - 1.
ELSE.
EXIT.
ENDIF.
ENDIF.
lv_version = ls_log-version. " Save to fill news lines
ELSE.
ls_log-version = lv_version.
ENDIF.
APPEND ls_log TO rt_log.
ENDLOOP.
ENDMETHOD.
METHOD parse_line.
CONSTANTS: lc_header_pattern TYPE string
VALUE '^\d{4}-\d{2}-\d{2}\s+v(\d{1,3}\.\d{1,3}\.\d{1,3})\s*$'.
DATA: lv_version TYPE string.
IF iv_line IS INITIAL OR iv_line CO ' -='.
RETURN. " Skip empty and markup lines
ENDIF.
" Check if line is a header line
FIND FIRST OCCURRENCE OF REGEX lc_header_pattern IN iv_line SUBMATCHES lv_version.
IF sy-subrc IS INITIAL.
lv_version = zcl_abapgit_version=>normalize( lv_version ).
rs_log-version = lv_version.
rs_log-is_header = abap_true.
rs_log-pos_to_cur = zcl_abapgit_version=>compare( iv_a = lv_version
iv_b = iv_current_version ).
ELSE.
FIND FIRST OCCURRENCE OF REGEX '^\s*!' IN iv_line.
rs_log-is_important = xsdbool( sy-subrc IS INITIAL ). " Change is important
ENDIF.
rs_log-text = iv_line.
ENDMETHOD.
ENDCLASS.
| 28.629893 | 114 | 0.637539 |
c434221447af6eb0474f1208d6ebfb9a5b0db0a5
| 5,834 |
abap
|
ABAP
|
src/ui/db/zcl_abapgit_gui_page_db.clas.abap
|
DiscoveryConsulting/abapGit
|
437052cd6a32ddbd9a808730284c7f9f4ee100e7
|
[
"MIT"
] | null | null | null |
src/ui/db/zcl_abapgit_gui_page_db.clas.abap
|
DiscoveryConsulting/abapGit
|
437052cd6a32ddbd9a808730284c7f9f4ee100e7
|
[
"MIT"
] | null | null | null |
src/ui/db/zcl_abapgit_gui_page_db.clas.abap
|
DiscoveryConsulting/abapGit
|
437052cd6a32ddbd9a808730284c7f9f4ee100e7
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_gui_page_db DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_page
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS zif_abapgit_gui_page~on_event
REDEFINITION .
PROTECTED SECTION.
METHODS render_content
REDEFINITION .
PRIVATE SECTION.
CONSTANTS:
BEGIN OF gc_action,
delete TYPE string VALUE 'delete',
END OF gc_action .
CLASS-METHODS delete
IMPORTING
!is_key TYPE zif_abapgit_persistence=>ty_content
RAISING
zcx_abapgit_exception
zcx_abapgit_cancel .
METHODS explain_content
IMPORTING
!is_data TYPE zif_abapgit_persistence=>ty_content
RETURNING
VALUE(rv_text) TYPE string
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_DB IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
ms_control-page_title = 'DATABASE PERSISTENCY'.
ENDMETHOD. " constructor.
METHOD delete.
DATA: lv_answer TYPE c LENGTH 1.
ASSERT is_key-type IS NOT INITIAL.
lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm(
titlebar = 'Warning'
text_question = 'Delete?'
text_button_1 = 'Ok'
icon_button_1 = 'ICON_DELETE'
text_button_2 = 'Cancel'
icon_button_2 = 'ICON_CANCEL'
default_button = '2'
display_cancel_button = abap_false ). "#EC NOTEXT
IF lv_answer = '2'.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
zcl_abapgit_persistence_db=>get_instance( )->delete(
iv_type = is_key-type
iv_value = is_key-value ).
COMMIT WORK.
ENDMETHOD. " delete
METHOD explain_content.
DATA: ls_result TYPE match_result,
ls_match TYPE submatch_result,
lv_cnt TYPE i.
CASE is_data-type.
WHEN 'REPO'.
FIND FIRST OCCURRENCE OF REGEX '<url>(.*)</url>'
IN is_data-data_str IGNORING CASE RESULTS ls_result.
READ TABLE ls_result-submatches INTO ls_match INDEX 1.
IF sy-subrc IS INITIAL.
rv_text = is_data-data_str+ls_match-offset(ls_match-length).
ENDIF.
FIND FIRST OCCURRENCE OF REGEX '<OFFLINE/>'
IN is_data-data_str IGNORING CASE MATCH COUNT lv_cnt.
IF lv_cnt > 0.
rv_text = |<strong>On-line</strong>, Name: <strong>{
zcl_abapgit_url=>name( rv_text ) }</strong>|.
ELSE.
rv_text = |Off-line, Name: <strong>{ rv_text }</strong>|.
ENDIF.
WHEN 'BACKGROUND'.
FIND FIRST OCCURRENCE OF REGEX '<method>(.*)</method>'
IN is_data-data_str IGNORING CASE RESULTS ls_result.
READ TABLE ls_result-submatches INTO ls_match INDEX 1.
IF sy-subrc IS NOT INITIAL.
RETURN.
ENDIF.
rv_text = |Method: { is_data-data_str+ls_match-offset(ls_match-length) }, |
&& |Repository: { zcl_abapgit_repo_srv=>get_instance( )->get( is_data-value )->get_name( ) }|.
WHEN 'USER'.
rv_text = '-'. " No additional explanation for user
WHEN 'SETTINGS'.
rv_text = '-'.
WHEN OTHERS.
IF strlen( is_data-data_str ) >= 250.
rv_text = is_data-data_str(250).
ELSE.
rv_text = is_data-data_str.
ENDIF.
rv_text = escape( val = rv_text
format = cl_abap_format=>e_html_attr ).
rv_text = |<pre>{ rv_text }</pre>|.
ENDCASE.
ENDMETHOD. "explain_content
METHOD render_content.
DATA: lt_data TYPE zif_abapgit_persistence=>tt_content,
lv_action TYPE string,
lv_trclass TYPE string,
lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar.
FIELD-SYMBOLS: <ls_data> LIKE LINE OF lt_data.
lt_data = zcl_abapgit_persistence_db=>get_instance( )->list( ).
CREATE OBJECT ro_html.
ro_html->add( '<div class="db_list">' ).
ro_html->add( '<table class="db_tab">' ).
" Header
ro_html->add( '<thead>' ).
ro_html->add( '<tr>' ).
ro_html->add( '<th>Type</th>' ).
ro_html->add( '<th>Key</th>' ).
ro_html->add( '<th>Data</th>' ).
ro_html->add( '<th></th>' ).
ro_html->add( '</tr>' ).
ro_html->add( '</thead>' ).
ro_html->add( '<tbody>' ).
" Lines
LOOP AT lt_data ASSIGNING <ls_data>.
CLEAR lv_trclass.
IF sy-tabix = 1.
lv_trclass = ' class="firstrow"' ##NO_TEXT.
ENDIF.
lv_action = zcl_abapgit_html_action_utils=>dbkey_encode( <ls_data> ).
CREATE OBJECT lo_toolbar.
lo_toolbar->add( iv_txt = 'Display' iv_act = |{ zif_abapgit_definitions=>gc_action-db_display }?{ lv_action }| ).
lo_toolbar->add( iv_txt = 'Edit' iv_act = |{ zif_abapgit_definitions=>gc_action-db_edit }?{ lv_action }| ).
lo_toolbar->add( iv_txt = 'Delete' iv_act = |{ gc_action-delete }?{ lv_action }| ).
ro_html->add( |<tr{ lv_trclass }>| ).
ro_html->add( |<td>{ <ls_data>-type }</td>| ).
ro_html->add( |<td>{ <ls_data>-value }</td>| ).
ro_html->add( |<td class="data">{ explain_content( <ls_data> ) }</td>| ).
ro_html->add( '<td>' ).
ro_html->add( lo_toolbar->render( ) ).
ro_html->add( '</td>' ).
ro_html->add( '</tr>' ).
ENDLOOP.
ro_html->add( '</tbody>' ).
ro_html->add( '</table>' ).
ro_html->add( '</div>' ).
ENDMETHOD. "render_content
METHOD zif_abapgit_gui_page~on_event.
DATA: ls_db TYPE zif_abapgit_persistence=>ty_content.
CASE iv_action.
WHEN gc_action-delete.
ls_db = zcl_abapgit_html_action_utils=>dbkey_decode( iv_getdata ).
delete( ls_db ).
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
ENDCASE.
ENDMETHOD.
ENDCLASS.
| 28.738916 | 119 | 0.609016 |
c4376ddea01be94fd251f25e7b7c32acdc915fce
| 388 |
abap
|
ABAP
|
src/cross/zif_dbbr_c_object_browser_mode.intf.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 15 |
2020-02-05T10:38:12.000Z
|
2022-02-11T18:06:17.000Z
|
src/cross/zif_dbbr_c_object_browser_mode.intf.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 10 |
2021-01-19T07:45:37.000Z
|
2021-07-15T19:08:54.000Z
|
src/cross/zif_dbbr_c_object_browser_mode.intf.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 9 |
2020-04-08T19:13:18.000Z
|
2021-10-02T12:53:39.000Z
|
"! <p class="shorttext synchronized" lang="en">Mode for Object Browser</p>
INTERFACE zif_dbbr_c_object_browser_mode
PUBLIC .
CONSTANTS package TYPE zdbbr_obj_browser_mode VALUE 'P'.
CONSTANTS cds_view TYPE zdbbr_obj_browser_mode VALUE 'C'.
CONSTANTS database_table_view TYPE zdbbr_obj_browser_mode VALUE 'D'.
CONSTANTS query TYPE zdbbr_obj_browser_mode VALUE 'Q'.
ENDINTERFACE.
| 43.111111 | 74 | 0.809278 |
c439943b5d8220cefebd5d84b926e0bdf66053ab
| 2,341 |
abap
|
ABAP
|
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZCL_CQSE_ATOMIC_SOURCE_OBJECT.abap
|
assessorgeneral/ConQAT
|
2a462f23f22c22aa9d01a7a204453d1be670ba60
|
[
"Apache-2.0"
] | null | null | null |
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZCL_CQSE_ATOMIC_SOURCE_OBJECT.abap
|
assessorgeneral/ConQAT
|
2a462f23f22c22aa9d01a7a204453d1be670ba60
|
[
"Apache-2.0"
] | null | null | null |
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZCL_CQSE_ATOMIC_SOURCE_OBJECT.abap
|
assessorgeneral/ConQAT
|
2a462f23f22c22aa9d01a7a204453d1be670ba60
|
[
"Apache-2.0"
] | null | null | null |
*----------------------------------------------------------------------*
* CLASS ZCL_CQSE_ATOMIC_SOURCE_OBJECT DEFINITION
*----------------------------------------------------------------------*
* A ABAP source code object which should be exported which consists
* of only one object in table REPOSRC.
*----------------------------------------------------------------------*
CLASS zcl_cqse_atomic_source_object DEFINITION
PUBLIC
INHERITING FROM zcl_cqse_source_object_base
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
!tadir_entry TYPE tadir
!exporter TYPE REF TO zcl_cqse_abap_exporter
!file_object_name TYPE string OPTIONAL
RAISING
zcx_cqse_srcobj_not_exists .
METHODS zif_cqse_source_object~get_meta_data
REDEFINITION .
METHODS zif_cqse_source_object~get_source
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
DATA reposrc_object TYPE REF TO zcl_cqse_reposrc_object .
endclass. "ZCL_CQSE_ATOMIC_SOURCE_OBJECT definition
*----------------------------------------------------------------------*
* class ZCL_CQSE_ATOMIC_SOURCE_OBJECT implementation.
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class ZCL_CQSE_ATOMIC_SOURCE_OBJECT implementation.
METHOD constructor.
data:
program_name type sobj_name.
super->constructor(
tadir_entry = tadir_entry
exporter = exporter
file_object_name = file_object_name
).
program_name = zif_cqse_source_object~get_name( ).
CREATE OBJECT me->reposrc_object
EXPORTING
program_name = program_name
tadir_entry = tadir_entry
exporter = exporter.
ENDMETHOD. "CONSTRUCTOR
METHOD zif_cqse_source_object~get_meta_data.
meta_data = me->reposrc_object->zif_cqse_source_object~get_meta_data( ).
ENDMETHOD. "ZIF_CQSE_SOURCE_OBJECT~GET_META_DATA
METHOD zif_cqse_source_object~get_source.
source = me->reposrc_object->zif_cqse_source_object~get_source( ).
ENDMETHOD. "zif_cqse_source_object~get_source
endclass. "ZCL_CQSE_ATOMIC_SOURCE_OBJECT implementation
| 32.971831 | 77 | 0.575395 |
c43a29486baa0a6a27aaa2924d269405490e1e44
| 9,549 |
abap
|
ABAP
|
src/objects/zcl_abapgit_object_sfpf.clas.abap
|
qinhanguyun/abapGit
|
272925fff7625a65a22825b546790948769f1556
|
[
"MIT"
] | null | null | null |
src/objects/zcl_abapgit_object_sfpf.clas.abap
|
qinhanguyun/abapGit
|
272925fff7625a65a22825b546790948769f1556
|
[
"MIT"
] | null | null | null |
src/objects/zcl_abapgit_object_sfpf.clas.abap
|
qinhanguyun/abapGit
|
272925fff7625a65a22825b546790948769f1556
|
[
"MIT"
] | 1 |
2019-12-31T11:44:14.000Z
|
2019-12-31T11:44:14.000Z
|
CLASS zcl_abapgit_object_sfpf DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
ALIASES mo_files
FOR zif_abapgit_object~mo_files .
CLASS-METHODS fix_oref
IMPORTING
!ii_document TYPE REF TO if_ixml_document
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS c_layout_file_ext TYPE string VALUE 'xdp'.
METHODS:
load
RETURNING VALUE(ri_wb_form) TYPE REF TO if_fp_wb_form
RAISING zcx_abapgit_exception,
form_to_xstring
RETURNING VALUE(rv_xstr) TYPE xstring
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_SFPF IMPLEMENTATION.
METHOD fix_oref.
* During serialization of a SFPF / SFPI object the interface hierarchy
* is represented by attributes "id" and "href", where the id looks
* like "o<number>" and href like "#o<number>". Every run of
* serialization generates a new <number> in these attributes, that
* leads to differences even by comparing of untouched forms.
* The purpose of this method is to renumber the id's consequentially
* and therefore to avoid fictive differences.
* NB: As the method iterator->get_next() works quite slowly,
* it is better to collect all attributes in a cache table
* instead of implementing of a nested loop using get_next().
DATA:
li_iterator TYPE REF TO if_ixml_node_iterator,
li_elem TYPE REF TO if_ixml_element,
lv_new TYPE string,
lv_old TYPE string,
lv_count TYPE i,
BEGIN OF ls_attr_href,
val TYPE string,
attr TYPE REF TO if_ixml_attribute,
END OF ls_attr_href,
lt_attr_href LIKE SORTED TABLE OF ls_attr_href WITH NON-UNIQUE KEY val.
FIELD-SYMBOLS <ls_attr_href> LIKE LINE OF lt_attr_href.
* Collect all attributes href='#o...' in the cache table
li_iterator = ii_document->create_iterator_filtered(
ii_document->create_filter_and(
filter1 = ii_document->create_filter_node_type( if_ixml_node=>co_node_element )
filter2 = ii_document->create_filter_attribute( 'href' ) ) ).
li_elem ?= li_iterator->get_next( ).
WHILE li_elem IS NOT INITIAL.
ls_attr_href-attr = li_elem->get_attribute_node( 'href' ).
ls_attr_href-val = ls_attr_href-attr->get_value( ).
IF ls_attr_href-val CP '##o*'.
INSERT ls_attr_href INTO TABLE lt_attr_href.
ENDIF.
li_elem ?= li_iterator->get_next( ).
ENDWHILE.
* Renumber id='o...' attributes
li_iterator = ii_document->create_iterator_filtered(
ii_document->create_filter_and(
filter1 = ii_document->create_filter_node_type( if_ixml_node=>co_node_element )
filter2 = ii_document->create_filter_attribute( 'id' ) ) ).
li_elem ?= li_iterator->get_next( ).
WHILE li_elem IS NOT INITIAL.
lv_old = li_elem->get_attribute( 'id' ).
IF lv_old CP 'o*'.
lv_count = lv_count + 1.
lv_new = |o{ lv_count }|.
* Rewrite id
IF li_elem->set_attribute( name = 'id' value = lv_new ) IS NOT INITIAL.
zcx_abapgit_exception=>raise( 'SFPF error, FIX_OREF' ).
ENDIF.
* Update references
LOOP AT lt_attr_href ASSIGNING <ls_attr_href> WHERE val = '#' && lv_old.
IF <ls_attr_href>-attr->set_value( '#' && lv_new ) IS NOT INITIAL.
zcx_abapgit_exception=>raise( 'SFPF error, FIX_OREF' ).
ENDIF.
ENDLOOP.
ENDIF.
li_elem ?= li_iterator->get_next( ).
ENDWHILE.
ENDMETHOD.
METHOD form_to_xstring.
CONSTANTS: lc_empty_data TYPE xstring VALUE ''.
DATA: li_fp_form TYPE REF TO if_fp_form,
li_wb_form TYPE REF TO if_fp_wb_form,
li_fp_layout TYPE REF TO if_fp_layout,
lx_fp_err TYPE REF TO cx_fp_api,
lx_fp_conv_err TYPE REF TO cx_fp_api,
lv_layout_data TYPE xstring.
li_wb_form = load( ).
li_fp_form ?= li_wb_form->get_object( ).
li_fp_layout = li_fp_form->get_layout( ).
lv_layout_data = li_fp_layout->get_layout_data( ).
mo_files->add_raw( iv_ext = c_layout_file_ext
iv_data = lv_layout_data ).
TRY.
li_fp_layout->set_layout_data( i_layout_data = lc_empty_data
i_set_xliff_ids = abap_false ).
CATCH cx_fp_api INTO lx_fp_err.
zcx_abapgit_exception=>raise( |SFPF remove layout: { lx_fp_err->get_text( ) }| ).
ENDTRY.
TRY.
rv_xstr = cl_fp_helper=>convert_form_to_xstring( li_fp_form ).
CATCH cx_fp_api INTO lx_fp_conv_err.
" Pass - the exception is handled below!
ENDTRY.
TRY.
li_fp_layout->set_layout_data( i_layout_data = lv_layout_data
i_set_xliff_ids = abap_false ).
CATCH cx_fp_api INTO lx_fp_err.
" Be aware that there might be another exception
" raised by cl_fp_helper=>convert_form_to_xstring( )
zcx_abapgit_exception=>raise( |SFPF recover layout: { lx_fp_err->get_text( ) }| ).
ENDTRY.
IF lx_fp_conv_err IS BOUND.
" This statement handles the exception raised from cl_fp_helper=>convert_form_to_xstring( )
zcx_abapgit_exception=>raise( |SFPF convert_form_to_xstring: { lx_fp_conv_err->get_text( ) }| ).
ENDIF.
ENDMETHOD.
METHOD load.
DATA: lv_name TYPE fpname.
lv_name = ms_item-obj_name.
TRY.
ri_wb_form = cl_fp_wb_form=>load( lv_name ).
CATCH cx_fp_api.
zcx_abapgit_exception=>raise( 'SFPF error, load' ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
SELECT SINGLE lastuser FROM fplayout
INTO rv_user
WHERE name = ms_item-obj_name
AND state = 'A'.
IF rv_user IS INITIAL.
SELECT SINGLE firstuser FROM fplayout
INTO rv_user
WHERE name = ms_item-obj_name
AND state = 'A'.
ENDIF.
IF rv_user IS INITIAL.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_name TYPE fpname,
lo_wb_form TYPE REF TO cl_fp_wb_form.
lo_wb_form ?= load( ).
lv_name = ms_item-obj_name.
TRY.
lo_wb_form->delete( lv_name ).
CATCH cx_fp_api.
zcx_abapgit_exception=>raise( 'SFPI error, delete' ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_xstr TYPE xstring,
lv_layout TYPE xstring,
lv_name TYPE fpname,
li_wb_object TYPE REF TO if_fp_wb_form,
li_form TYPE REF TO if_fp_form,
lx_fp_err TYPE REF TO cx_fp_api.
lv_name = ms_item-obj_name.
lv_xstr = cl_ixml_80_20=>render_to_xstring( io_xml->get_raw( ) ).
TRY.
li_form = cl_fp_helper=>convert_xstring_to_form( lv_xstr ).
IF mo_files->contains( c_layout_file_ext ) = abap_true.
lv_layout = mo_files->read_raw( c_layout_file_ext ).
li_form->get_layout( )->set_layout_data( lv_layout ).
ENDIF.
IF zif_abapgit_object~exists( ) = abap_true.
cl_fp_wb_form=>delete( lv_name ).
ENDIF.
tadir_insert( iv_package ).
li_wb_object = cl_fp_wb_form=>create( i_name = lv_name
i_form = li_form ).
li_wb_object->save( ).
li_wb_object->free( ).
CATCH cx_fp_api INTO lx_fp_err.
zcx_abapgit_exception=>raise( |SFPF deserialization error: { lx_fp_err->get_text( ) }| ).
ENDTRY.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_name TYPE fpname.
SELECT SINGLE name FROM fplayout
INTO lv_name
WHERE name = ms_item-obj_name
AND state = 'A'.
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( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA: lv_object TYPE seqg3-garg.
lv_object = |{ ms_item-obj_name }|.
OVERLAY lv_object WITH ' '.
lv_object = lv_object && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'EFPFORM'
iv_argument = lv_object ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW'
object_name = ms_item-obj_name
object_type = ms_item-obj_type.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_xstr TYPE xstring,
li_document TYPE REF TO if_ixml_document.
lv_xstr = form_to_xstring( ).
li_document = cl_ixml_80_20=>parse_to_document( stream_xstring = lv_xstr ).
fix_oref( li_document ).
io_xml->set_raw( li_document->get_root_element( ) ).
ENDMETHOD.
ENDCLASS.
| 28.58982 | 102 | 0.660488 |
c43adb6b459db6227e0e8e9a624d93a120e30dde
| 394 |
abap
|
ABAP
|
src/objects/zif_abapgit_object_enho.intf.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 1 |
2020-04-10T22:21:41.000Z
|
2020-04-10T22:21:41.000Z
|
src/objects/zif_abapgit_object_enho.intf.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 1 |
2020-01-05T16:45:32.000Z
|
2020-01-05T16:45:32.000Z
|
src/objects/zif_abapgit_object_enho.intf.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 1 |
2019-12-31T11:44:14.000Z
|
2019-12-31T11:44:14.000Z
|
INTERFACE zif_abapgit_object_enho PUBLIC.
METHODS:
deserialize
IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_input
iv_package TYPE devclass
RAISING zcx_abapgit_exception,
serialize
IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_output
ii_enh_tool TYPE REF TO if_enh_tool
RAISING zcx_abapgit_exception.
ENDINTERFACE.
| 28.142857 | 62 | 0.703046 |
c43b94e34598785aa31407d32454767cbf13a09e
| 24,421 |
abap
|
ABAP
|
#gal#cfw_macros.prog.abap
|
galileo-group/galileo-abap-lib
|
a013885096af9bc461d6000ad27b91789f150d00
|
[
"MIT"
] | 2 |
2017-11-02T12:33:44.000Z
|
2019-10-14T10:10:13.000Z
|
#gal#cfw_macros.prog.abap
|
galileo-group/galileo-abap-lib
|
a013885096af9bc461d6000ad27b91789f150d00
|
[
"MIT"
] | 1 |
2017-11-05T19:36:27.000Z
|
2020-10-23T14:35:47.000Z
|
#gal#cfw_macros.prog.abap
|
galileo-group/galileo-abap-lib
|
a013885096af9bc461d6000ad27b91789f150d00
|
[
"MIT"
] | null | null | null |
*&---------------------------------------------------------------------*
*& Include /GAL/CFW_MACROS
*&---------------------------------------------------------------------*
*& This include provides a set of macros to make the use of the Galileo
*& Communication Framework as simple as possible.
*&---------------------------------------------------------------------*
TYPE-POOLS abap.
DEFINE cfw_custom_auth.
DATA __l_custom_auth_behave TYPE /gal/cfw_custom_auth_behave. "#EC NEEDED
__l_custom_auth_behave = &1.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Follow RFC route
*-----------------------------------------------------------------------
DEFINE cfw_follow_rfc_route.
DATA __l_interface_info TYPE /gal/func_interface_info.
DATA __lt_param_bindings TYPE abap_func_parmbind_tab.
DATA __l_param_binding LIKE LINE OF __lt_param_bindings.
DATA __l_exception_name TYPE string. "#EC NEEDED
DATA __l_rfc_route_info TYPE /gal/rfc_route_info.
DATA __l_function_name TYPE string.
DATA __lt_call_stack TYPE abap_callstack.
DATA __l_task TYPE REF TO /gal/task.
DATA __l_exception TYPE REF TO cx_root.
DATA __l_exception_info TYPE /gal/exception_info.
DATA __l_exception_part1 TYPE symsgv. "#EC NEEDED
DATA __l_exception_part2 TYPE symsgv. "#EC NEEDED
DATA __l_exception_part3 TYPE symsgv. "#EC NEEDED
DATA __l_func_ex_info TYPE symsgv. "#EC NEEDED
DATA __l_auth_active TYPE abap_bool.
DATA __l_local_check_req TYPE abap_bool.
DATA __l_auth_excep TYPE REF TO /gal/cx_cfw_auth_exception.
DATA __l_auth_excep_fw TYPE REF TO /gal/cx_cfw_auth_excep_fw.
DATA __l_ctx_data_set TYPE abap_bool.
FIELD-SYMBOLS <__l_param_info> TYPE /gal/func_interface_param_info.
FIELD-SYMBOLS <__l_param_value_local> TYPE any.
FIELD-SYMBOLS <__l_rfc_route_step_info> TYPE /gal/rfc_route_step_info.
FIELD-SYMBOLS <__l_custom_auth_behave> TYPE /gal/cfw_custom_auth_behave.
* Define variables for break-point support
cfw_break_point_support.
* Initialize working copy of RFC route info before executing first step
__l_rfc_route_info = &1.
* Initialize control variables
CLEAR __lt_param_bindings.
CLEAR __lt_call_stack.
CLEAR __l_exception_info.
CLEAR __l_exception_part1.
CLEAR __l_exception_part2.
CLEAR __l_exception_part3.
__l_local_check_req = abap_false.
__l_ctx_data_set = abap_false.
* A custom authority check behavior can be defined by using the macro cfw_Custom_auth in the function module declaration.
* The behavior is stored in field symbol <__l_custom_auth_behave> if existing otherwise default is set.
ASSIGN ('__L_CUSTOM_AUTH_BEHAVE') TO <__l_custom_auth_behave>.
IF sy-subrc <> 0.
DATA __l_custom_auth_behave_default TYPE /gal/cfw_custom_auth_behave VALUE /gal/cfw_auth=>const_cab_final_rfc_step.
ASSIGN __l_custom_auth_behave_default TO <__l_custom_auth_behave>.
ENDIF.
TRY.
IF &1-current_step = 0 AND
&1-step_infos IS INITIAL AND
<__l_custom_auth_behave> NE /gal/cfw_auth=>const_cab_no_check AND
<__l_custom_auth_behave> NE /gal/cfw_auth=>const_cab_final_rfc_step.
* If we are at the initial step and no RFC steps are to be done, checks are only done if required by auth behavior definition.
__l_local_check_req = abap_true.
ENDIF.
IF ( &1-current_step = 0 OR &1-options-resume = abap_true ) AND &1-step_infos IS NOT INITIAL OR __l_local_check_req = abap_true.
* Initialization is needed if:
* - we are at the initial step and RFC step follows
* or
* - a local check is needed (only possible ast initial step)
* Get the function name of current scope (which is to be checked)
/gal/cfw_helper=>get_function_name_ext(
IMPORTING
function_name = __l_function_name
call_stack = __lt_call_stack
).
* Determine function interface
__l_interface_info = /gal/cfw_helper=>get_function_interface(
function_name = __l_function_name
check_compatibility = abap_true
).
* Create parameter binding table for IMPORTING and CHANGING parameters
LOOP AT __l_interface_info-param_info ASSIGNING <__l_param_info>
WHERE parameter_kind CA 'IC'
AND ( parameter_name <> `RFC_ROUTE_INFO` OR parameter_type <> `/GAL/RFC_ROUTE_INFO` ). "#EC CI_STDSEQ
__l_param_binding-name = <__l_param_info>-parameter_name.
__l_param_binding-kind = <__l_param_info>-parameter_kind_int.
ASSIGN (<__l_param_info>-parameter_name) TO <__l_param_value_local>. "#EC CI_SUBRC
GET REFERENCE OF <__l_param_value_local> INTO __l_param_binding-value.
INSERT __l_param_binding INTO TABLE __lt_param_bindings.
ENDLOOP.
* Add EXPORTING parameters with generic type to parameter binding table
LOOP AT __l_interface_info-param_info ASSIGNING <__l_param_info>
WHERE parameter_kind CA 'E'
AND (
parameter_type = `ANY` OR
parameter_type = `ANY TABLE` OR
parameter_type = `C` OR
parameter_type = `CLIKE` OR
parameter_type = `CSEQUENCE` OR
parameter_type = `DATA` OR
parameter_type = `HASHED TABLE` OR
parameter_type = `INDEX TABLE` OR
parameter_type = `N` OR
parameter_type = `NUMERIC` OR
parameter_type = `OBJECT` OR
parameter_type = `P` OR
parameter_type = `SIMPLE` OR
parameter_type = `SORTED TABLE` OR
parameter_type = `STANDARD TABLE` OR
parameter_type = `TABLE` OR
parameter_type = `X` OR
parameter_type = `XSEQUENCE`
). "#EC CI_STDSEQ
__l_param_binding-name = <__l_param_info>-parameter_name.
__l_param_binding-kind = <__l_param_info>-parameter_kind_int.
ASSIGN (<__l_param_info>-parameter_name) TO <__l_param_value_local>. "#EC CI_SUBRC
CREATE DATA __l_param_binding-value LIKE <__l_param_value_local>.
INSERT __l_param_binding INTO TABLE __lt_param_bindings.
ENDLOOP.
ENDIF.
* Check if the authentification framework is active
__l_auth_active = /gal/cfw_auth_config=>is_active( ).
IF __l_auth_active = abap_true AND __l_local_check_req = abap_true.
* If authentification framework is active and we need to perform a local check, the required data is initialized now.
/gal/cfw_auth=>init( ).
/gal/cfw_auth=>set_context_data(
EXPORTING
function_name = __l_function_name
param_bindings = __lt_param_bindings
initial_caller_sysysid = sy-sysid
initial_caller_symandt = sy-mandt
initial_caller_syuname = sy-uname
last_caller_sysysid = sy-sysid
last_caller_symandt = sy-mandt
last_caller_syuname = sy-uname
local_execution = abap_true
first_step = abap_true
final_step = abap_true
rfc_route_info = &1
direct_call = abap_true
).
__l_ctx_data_set = abap_true.
ENDIF.
IF ( NOT &1-step_infos IS INITIAL AND &1-current_step > 0 ) OR __l_local_check_req = abap_true.
* Check authentification if required (valid for local and remote scopes).
* Note: in RFC scope context hast been initialized in function module /GAL/RFC_PROXY_FUNCTION.
/gal/cfw_auth=>check_auth( <__l_custom_auth_behave> ).
IF __l_local_check_req = abap_true.
* Handle authentification excdeptions if we are in a local call.
* In RFC context this handling is done in function module /GAL/RFC_PROXY_FUNCTION.
/gal/cfw_auth=>raise_auth_exception_if_exists( ).
IF __l_auth_active = abap_true.
* Reset context after handling is done.
/gal/cfw_auth=>reset_context_data( ).
ENDIF.
RETURN.
ENDIF.
ENDIF.
* Skip logic if not at initial step
IF &1-current_step = 0.
/gal/cfw_helper=>initialize_rfc_route_info( CHANGING rfc_route_info = __l_rfc_route_info ).
INSERT INITIAL LINE INTO __l_rfc_route_info-step_infos INDEX 1.
__l_rfc_route_info-current_step = 1.
* Get name of current function
IF __l_function_name IS INITIAL.
/gal/cfw_helper=>get_function_name_ext(
IMPORTING
function_name = __l_function_name
call_stack = __l_rfc_route_info-call_stack
).
ELSE.
__l_rfc_route_info-call_stack = __lt_call_stack.
ENDIF.
ENDIF.
* Skip logic if execution on local system is requested
IF ( &1-current_step = 0 OR &1-options-resume = abap_true ) AND &1-step_infos IS NOT INITIAL.
* Create task
CREATE OBJECT __l_task
EXPORTING
function = __l_function_name
rfc_route_info = __l_rfc_route_info.
* Perform synchronous remote function call
__l_task->set_parameters( __lt_param_bindings ).
__l_task->start_sync( ).
__lt_param_bindings = __l_task->parameters_out.
__l_rfc_route_info = __l_task->rfc_route_info.
__l_exception_info = __l_task->exception_info.
* Copy results to EXPORTING and CHANGING parameters
IF __l_exception_info-exception_type IS INITIAL.
LOOP AT __l_interface_info-param_info ASSIGNING <__l_param_info> WHERE parameter_kind CA 'EC'. "#EC CI_STDSEQ
ASSIGN (<__l_param_info>-parameter_name) TO <__l_param_value_local>.
CHECK sy-subrc = 0.
__l_task->get_parameter(
EXPORTING
kind = <__l_param_info>-parameter_kind_int
name = <__l_param_info>-parameter_name
IMPORTING
value = <__l_param_value_local>
).
ENDLOOP.
ENDIF.
* Free reference to task object
CLEAR __l_task.
__l_rfc_route_info-current_step = 0.
ELSE.
READ TABLE __l_rfc_route_info-step_infos INDEX 1 ASSIGNING <__l_rfc_route_step_info>.
/gal/cfw_helper=>update_rfc_route_step_info( CHANGING rfc_route_step_info = <__l_rfc_route_step_info> ).
ENDIF.
* Now authentification exceptions are handled
CATCH /gal/cx_cfw_auth_exception INTO __l_auth_excep.
IF __l_ctx_data_set = abap_true.
TRY.
/gal/cfw_auth=>reset_context_data( force_auth_exception_discard = abap_true ).
CATCH /gal/cx_cfw_auth_excep_fw. "#EC NO_HANDLER
ENDTRY.
ENDIF.
__l_exception_info = /gal/cfw_auth=>fill_cfw_auth_err_ex_info( __l_auth_excep ).
* Finally all other exceptions are handled
CATCH cx_static_check INTO __l_exception.
IF __l_ctx_data_set = abap_true.
TRY.
/gal/cfw_auth=>reset_context_data( ).
__l_exception_info = /gal/cfw_helper=>get_exception_info( __l_exception ).
CATCH /gal/cx_cfw_auth_excep_fw INTO __l_auth_excep_fw.
__l_exception_info = /gal/cfw_auth=>fill_cfw_auth_err_ex_info( __l_auth_excep_fw ).
ENDTRY.
ELSE.
__l_exception_info = /gal/cfw_helper=>get_exception_info( __l_exception ).
ENDIF.
ENDTRY.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Exception Handling Header
*-----------------------------------------------------------------------
DEFINE cfw_handle.
__l_exception_name = `&1`.
TRANSLATE __l_exception_name TO UPPER CASE.
IF __l_rfc_route_info-current_step = 0 AND
(
__l_exception_name = __l_exception_info-exception_name
OR
__l_exception_name = `RFC_EXCEPTION` AND
__l_exception_info-exception_name = 'SYSTEM_FAILURE'
OR
__l_exception_name = `RFC_EXCEPTION` AND
__l_exception_info-exception_name = 'COMMUNICATION_FAILURE'
OR
__l_exception_name = `ANY_EXCEPTION` AND
__l_exception_info-exception_type IS NOT INITIAL
OR
__l_exception_name = `SUCCESS` AND
__l_exception_info-exception_type IS INITIAL
OR
__l_exception_name = `ALL`
).
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Exception Handling Footer
*-----------------------------------------------------------------------
DEFINE cfw_endhandle.
RETURN.
ENDIF.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Exception Handling: Pass message of classic exception
*-----------------------------------------------------------------------
DEFINE cfw_pass_message.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING &1.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Exception Handling: Pass classic exception
*-----------------------------------------------------------------------
DEFINE cfw_pass_exception.
cfw_handle &1.
cfw_raise_exception &1.
cfw_endhandle.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Exception Handling: Raise classic exception
*-----------------------------------------------------------------------
DEFINE cfw_raise_exception.
IF __l_exception_info-exception_type = 'E'.
IF __l_exception_info-message_id IS NOT INITIAL AND
__l_exception_info-message_type IS NOT INITIAL AND
__l_exception_info-message_number IS NOT INITIAL.
MESSAGE ID __l_exception_info-message_id
TYPE __l_exception_info-message_type
NUMBER __l_exception_info-message_number
WITH __l_exception_info-message_var1
__l_exception_info-message_var2
__l_exception_info-message_var3
__l_exception_info-message_var4
RAISING &1.
ELSEIF __l_exception_info-message_text IS NOT INITIAL.
/gal/string=>string_to_message_vars( EXPORTING input = __l_exception_info-message_text
IMPORTING msgv1 = __l_exception_part1
msgv2 = __l_exception_part2
msgv3 = __l_exception_part3 ).
CONCATENATE __l_function_name __l_exception_info-exception_name INTO __l_func_ex_info SEPARATED BY `: `.
MESSAGE e001(/gal/cfw)
WITH __l_func_ex_info
__l_exception_part1
__l_exception_part2
__l_exception_part3
RAISING &1.
ELSE.
CONCATENATE __l_function_name __l_exception_info-exception_name INTO __l_func_ex_info SEPARATED BY `: `.
MESSAGE e000(/gal/cfw)
WITH __l_func_ex_info
RAISING &1.
ENDIF.
ELSE.
IF __l_exception_info-message_text IS NOT INITIAL.
/gal/string=>string_to_message_vars( EXPORTING input = __l_exception_info-message_text
IMPORTING msgv1 = __l_exception_part1
msgv2 = __l_exception_part2
msgv3 = __l_exception_part3 ).
CONCATENATE __l_function_name __l_exception_info-exception_name INTO __l_func_ex_info SEPARATED BY `: `.
DO 0 TIMES. MESSAGE e001(/gal/cfw) WITH '' '' '' ''. ENDDO.
MESSAGE ID '/GAL/CFW' TYPE __l_exception_info-message_type NUMBER '001'
WITH __l_func_ex_info
__l_exception_part1
__l_exception_part2
__l_exception_part3
RAISING &1.
ELSE.
CONCATENATE __l_function_name __l_exception_info-exception_name INTO __l_func_ex_info SEPARATED BY `: `.
DO 0 TIMES. MESSAGE e000(/gal/cfw) WITH ''. ENDDO.
MESSAGE ID '/GAL/CFW' TYPE __l_exception_info-message_type NUMBER '000'
WITH __l_func_ex_info
RAISING &1.
ENDIF.
ENDIF.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Header for remote coding
*-----------------------------------------------------------------------
DEFINE cfw_remote_coding.
IF __l_exception_info-exception_type IS NOT INITIAL.
IF __l_interface_info-uses_exception_classes IS NOT INITIAL.
PERFORM cfw_raise_new_exception IN PROGRAM /gal/cfw_forms
USING __l_exception_info __l_function_name.
ELSE.
PERFORM cfw_raise_classic_exception IN PROGRAM /gal/cfw_forms
USING __l_exception_info __l_function_name.
ENDIF.
ENDIF.
IF __l_rfc_route_info-current_step = 0.
RETURN. "Finished
ENDIF.
DESCRIBE TABLE __l_rfc_route_info-step_infos LINES sy-tfill.
IF __l_rfc_route_info-current_step < sy-tfill.
RETURN. "On the way back
ENDIF.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Get exception mode
*-----------------------------------------------------------------------
DEFINE cfw_get_exception_info.
&1 = __l_exception_info.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Get RFC route info
*-----------------------------------------------------------------------
DEFINE cfw_get_rfc_route_info.
&1 = __l_rfc_route_info.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Debugging Server support
*-----------------------------------------------------------------------
DEFINE cfw_break_point_support.
CONSTANTS __lc_timeout TYPE i VALUE 3000000. "#EC NEEDED
DATA __l_server TYPE /gal/cfw_debug01. "#EC NEEDED
DATA __l_server_found TYPE abap_bool. "#EC NEEDED
DATA __l_commit_required TYPE abap_bool. "#EC NEEDED
DATA __l_debug_request TYPE /gal/cfw_debug02. "#EC NEEDED
DATA __l_wait_start TYPE i. "#EC NEEDED
DATA __l_wait_current TYPE i. "#EC NEEDED
DATA __l_wait_end TYPE i. "#EC NEEDED
DATA __l_skip TYPE abap_bool. "#EC NEEDED
DATA __l_dref TYPE REF TO data. "#EC NEEDED
DATA __l_oref TYPE REF TO object. "#EC NEEDED
FIELD-SYMBOLS <__l_fs> TYPE STANDARD TABLE. "#EC NEEDED
FIELD-SYMBOLS <__l_fs2> TYPE any. "#EC NEEDED
FIELD-SYMBOLS <__l_fs3> TYPE any. "#EC NEEDED
FIELD-SYMBOLS <__l_step_info> TYPE /gal/rfc_route_step_info. "#EC NEEDED
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* RFC break point
*-----------------------------------------------------------------------
DEFINE cfw_rfc_break_point.
* Get information about source step
READ TABLE &1-step_infos INDEX 1
ASSIGNING <__l_step_info>.
* Check for active Debugging servers
SELECT * FROM /gal/cfw_debug01
INTO __l_server
ORDER BY end_date DESCENDING
end_time DESCENDING. "#EC CI_NOWHERE
IF __l_server-end_date < sy-datum OR
__l_server-end_date = sy-datum AND __l_server-end_time < sy-uzeit.
DELETE FROM /gal/cfw_debug01 WHERE server_id = __l_server-server_id. "#EC CI_SUBRC
DELETE FROM /gal/cfw_debug02 WHERE server_id = __l_server-server_id. "#EC CI_SUBRC
__l_commit_required = abap_true.
ELSEIF __l_server_found = abap_false
AND ( &2 = __l_server-event
OR
&2 CP __l_server-event AND &2 <> `/GAL/RFC_PROXY_FUNCTION` ) "#EC BOOL_OK
AND <__l_step_info>-system_id CP __l_server-source_system_id
AND <__l_step_info>-client_id CP __l_server-source_client_id
AND <__l_step_info>-user_id CP __l_server-source_user_id
AND sy-sysid CP __l_server-target_system_id
AND sy-mandt CP __l_server-target_client_id
AND sy-uname CP __l_server-target_user_id. "#EC USER_OK
__l_debug_request-server_id = __l_server-server_id.
CALL FUNCTION 'TH_GET_OWN_WP_NO'
IMPORTING
wp_no = __l_debug_request-process_no
wp_pid = __l_debug_request-process_id
wp_index = __l_debug_request-process_index.
IF sy-saprl >= '740'.
CREATE DATA __l_dref TYPE ('SSI_WORKER_LIST').
ASSIGN __l_dref->* TO <__l_fs>.
TRY.
CREATE OBJECT __l_oref TYPE ('CL_SERVER_INFO').
CALL METHOD __l_oref->('GET_WORKER_LIST')
EXPORTING
worker_index = __l_debug_request-process_index
RECEIVING
worker_list = <__l_fs>.
CATCH cx_root. "#EC CATCH_ALL
__l_skip = abap_true.
ENDTRY.
IF __l_skip = abap_false.
READ TABLE <__l_fs> INDEX 1 ASSIGNING <__l_fs2>.
ASSIGN COMPONENT 'LOGON_ID' OF STRUCTURE <__l_fs2> TO <__l_fs3>.
__l_debug_request-process_logon_id = <__l_fs3>.
ENDIF.
ENDIF.
IF __l_skip = abap_false.
INSERT /gal/cfw_debug02 FROM __l_debug_request.
IF sy-subrc = 0.
__l_server_found = abap_true.
__l_commit_required = abap_true.
ENDIF.
ENDIF.
ENDIF.
ENDSELECT. "#EC CI_SUBRC
* Commit database changes (if any)
IF __l_commit_required = abap_true.
CALL FUNCTION 'DB_COMMIT'.
ENDIF.
* Wait for Debugging Server if found
IF __l_server_found = abap_true.
CLEAR sy-datum. "#EC WRITE_OK
GET RUN TIME FIELD __l_wait_start.
__l_wait_end = __l_wait_start + __lc_timeout.
WHILE sy-datum IS INITIAL.
GET RUN TIME FIELD __l_wait_current.
CHECK __l_wait_current >= __l_wait_end.
GET TIME.
ENDWHILE.
ENDIF.
END-OF-DEFINITION.
*-----------------------------------------------------------------------
* Break point
*-----------------------------------------------------------------------
DEFINE cfw_break_point.
* Check for active Debugging servers
SELECT * FROM /gal/cfw_debug01
INTO __l_server
ORDER BY end_date DESCENDING
end_time DESCENDING. "#EC CI_NOWHERE
IF __l_server-end_date < sy-datum OR
__l_server-end_date = sy-datum AND __l_server-end_time < sy-uzeit.
DELETE FROM /gal/cfw_debug01 WHERE server_id = __l_server-server_id. "#EC CI_SUBRC
DELETE FROM /gal/cfw_debug02 WHERE server_id = __l_server-server_id. "#EC CI_SUBRC
__l_commit_required = abap_true.
ELSEIF __l_server_found = abap_false
AND &1 CP __l_server-event
AND sy-sysid CP __l_server-source_system_id
AND sy-mandt CP __l_server-source_client_id
AND sy-uname CP __l_server-source_user_id
AND sy-sysid CP __l_server-target_system_id
AND sy-mandt CP __l_server-target_client_id
AND sy-uname CP __l_server-target_user_id. "#EC USER_OK
__l_debug_request-server_id = __l_server-server_id.
CALL FUNCTION 'TH_GET_OWN_WP_NO'
IMPORTING
wp_no = __l_debug_request-process_no
wp_pid = __l_debug_request-process_id
wp_index = __l_debug_request-process_index.
IF sy-saprl >= '740'.
CREATE DATA __l_dref TYPE ('SSI_WORKER_LIST').
ASSIGN __l_dref->* TO <__l_fs>.
TRY.
CREATE OBJECT __l_oref TYPE ('CL_SERVER_INFO').
CALL METHOD __l_oref->('GET_WORKER_LIST')
EXPORTING
worker_index = __l_debug_request-process_index
RECEIVING
worker_list = <__l_fs>.
CATCH cx_root. "#EC CATCH_ALL
__l_skip = abap_true.
ENDTRY.
IF __l_skip = abap_false.
READ TABLE <__l_fs> INDEX 1 ASSIGNING <__l_fs2>.
ASSIGN COMPONENT 'LOGON_ID' OF STRUCTURE <__l_fs2> TO <__l_fs3>.
__l_debug_request-process_logon_id = <__l_fs3>.
ENDIF.
ENDIF.
IF __l_skip = abap_false.
INSERT /gal/cfw_debug02 FROM __l_debug_request.
IF sy-subrc = 0.
__l_server_found = abap_true.
__l_commit_required = abap_true.
ENDIF.
ENDIF.
ENDIF.
ENDSELECT. "#EC CI_SUBRC
* Commit database changes (if any)
IF __l_commit_required = abap_true.
CALL FUNCTION 'DB_COMMIT'.
ENDIF.
* Wait for Debugging Server if found (Timeout: 3 seconds)
IF __l_server_found = abap_true.
CLEAR sy-datum. "#EC WRITE_OK
GET RUN TIME FIELD __l_wait_start.
__l_wait_end = __l_wait_start + 3000000. "#EC NUMBER_OK
WHILE sy-datum IS INITIAL.
GET RUN TIME FIELD __l_wait_current.
CHECK __l_wait_current >= __l_wait_end.
GET TIME.
ENDWHILE.
ENDIF.
END-OF-DEFINITION.
| 37.170472 | 131 | 0.626919 |
c43bfd1c075389336ffc8815d263632b5c4bc652
| 215 |
abap
|
ABAP
|
src/zif_sat_c_selection_condition.intf.abap
|
christianguenter2/abap-search-tools
|
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
|
[
"Apache-2.0"
] | 9 |
2019-11-14T12:27:19.000Z
|
2022-01-26T16:35:09.000Z
|
src/zif_sat_c_selection_condition.intf.abap
|
christianguenter2/abap-search-tools
|
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
|
[
"Apache-2.0"
] | 13 |
2019-12-04T15:02:12.000Z
|
2021-11-25T16:43:12.000Z
|
src/zif_sat_c_selection_condition.intf.abap
|
christianguenter2/abap-search-tools
|
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
|
[
"Apache-2.0"
] | 4 |
2019-11-14T13:59:43.000Z
|
2020-08-05T09:58:30.000Z
|
INTERFACE zif_sat_c_selection_condition
PUBLIC .
CONSTANTS on TYPE vsconj VALUE 'ON' ##NO_TEXT.
CONSTANTS or TYPE vsconj VALUE 'OR' ##NO_TEXT.
CONSTANTS and TYPE vsconj VALUE 'AND' ##NO_TEXT.
ENDINTERFACE.
| 26.875 | 50 | 0.75814 |
c4422560892bf1b1c423d236221f7fce41cc6b44
| 238 |
abap
|
ABAP
|
src/zif_ca_gw_openapi_metadata.intf.abap
|
irodrigob/Gateway-OpenAPI
|
dee5ffbe2ebf0cb5fd0337341517853b6c6cc3b9
|
[
"MIT"
] | null | null | null |
src/zif_ca_gw_openapi_metadata.intf.abap
|
irodrigob/Gateway-OpenAPI
|
dee5ffbe2ebf0cb5fd0337341517853b6c6cc3b9
|
[
"MIT"
] | null | null | null |
src/zif_ca_gw_openapi_metadata.intf.abap
|
irodrigob/Gateway-OpenAPI
|
dee5ffbe2ebf0cb5fd0337341517853b6c6cc3b9
|
[
"MIT"
] | null | null | null |
interface ZIF_CA_GW_OPENAPI_METADATA
public .
methods GET_METADATA
returning
value(RV_METADATA) type XSTRING .
methods GET_JSON
exporting
!EV_JSON type XSTRING
!EV_JSON_STRING type STRING .
endinterface.
| 18.307692 | 39 | 0.731092 |
c4446c32326cca942dc622b0040bd06fdf7521e7
| 7,451 |
abap
|
ABAP
|
src/zale_example.prog.abap
|
JohannesKonings/abap-BAL-Graylog-GELF-exporter
|
951d9d00cd2dcef9f3ef61a94e70b4bca1d450f5
|
[
"MIT"
] | 18 |
2021-01-20T13:06:26.000Z
|
2022-03-29T08:17:09.000Z
|
src/zale_example.prog.abap
|
JohannesKonings/abap-BAL-Graylog-GELF-exporter
|
951d9d00cd2dcef9f3ef61a94e70b4bca1d450f5
|
[
"MIT"
] | 161 |
2020-04-17T18:28:54.000Z
|
2022-03-31T03:10:04.000Z
|
src/zale_example.prog.abap
|
JohannesKonings/abap-BAL-Graylog-GELF-exporter
|
951d9d00cd2dcef9f3ef61a94e70b4bca1d450f5
|
[
"MIT"
] | 6 |
2021-02-19T13:16:15.000Z
|
2022-03-24T18:48:33.000Z
|
REPORT zale_example.
PARAMETERS loki AS CHECKBOX.
PARAMETERS gelf AS CHECKBOX.
CONSTANTS object_abe_example TYPE balobj_d VALUE 'ZALE'.
CONSTANTS subobject_abe_example TYPE balsubobj VALUE 'ZALE_EXAMPLE'.
CONSTANTS gelf_url TYPE zale_config-ale_key VALUE 'GELF_URL'.
CONSTANTS loki_url TYPE zale_config-ale_key VALUE 'LOKI_URL'.
START-OF-SELECTION.
"load config
SELECT *
FROM zale_config
INTO TABLE @DATA(configurations).
"log to BAL
DATA log_handle TYPE balloghndl.
DATA log_entry_header TYPE bal_s_log.
log_entry_header-extnumber = 'BAL export example'.
log_entry_header-object = object_abe_example.
log_entry_header-subobject = subobject_abe_example.
log_entry_header-aldate = sy-datum.
log_entry_header-altime = sy-uzeit.
log_entry_header-aluser = sy-uname.
log_entry_header-alprog = sy-repid.
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = log_entry_header
IMPORTING
e_log_handle = log_handle
EXCEPTIONS
log_header_inconsistent = 1
OTHERS = 2.
IF sy-subrc = 0.
CALL FUNCTION 'BAL_LOG_MSG_ADD_FREE_TEXT'
EXPORTING
i_log_handle = log_handle
i_msgty = 'I'
i_text = 'example warning'
EXCEPTIONS
log_not_found = 1
msg_inconsistent = 2
log_is_full = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'BAL_LOG_MSG_ADD_FREE_TEXT'
EXPORTING
i_log_handle = log_handle
i_msgty = 'I'
i_text = 'example error'
EXCEPTIONS
log_not_found = 1
msg_inconsistent = 2
log_is_full = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'BAL_DB_SAVE'
EXPORTING
i_save_all = 'X'
EXCEPTIONS
log_not_found = 1
save_not_allowed = 2
numbering_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
"read from BAL
DATA header_data TYPE STANDARD TABLE OF balhdr.
DATA header_parameters TYPE STANDARD TABLE OF balhdrp.
DATA messages TYPE STANDARD TABLE OF balm.
DATA message_parameters TYPE STANDARD TABLE OF balmp.
DATA contexts TYPE STANDARD TABLE OF balc.
DATA exceptions TYPE STANDARD TABLE OF bal_s_exception.
CALL FUNCTION 'APPL_LOG_READ_DB'
EXPORTING
object = object_abe_example
subobject = subobject_abe_example
date_from = sy-datum
date_to = sy-datum
TABLES
header_data = header_data
header_parameters = header_parameters
messages = messages
message_parameters = message_parameters
contexts = contexts
t_exceptions = exceptions.
LOOP AT header_data INTO DATA(header_data_wa).
LOOP AT messages INTO DATA(message) WHERE lognumber = header_data_wa-lognumber.
"convert to GELF and Loki
DATA(gelf_json) = |\{| &&
|"version": "1.1",| &&
|"host": "{ sy-host }",| &&
|"short_message": "{ header_data_wa-extnumber }",| &&
|"full_message": "{ message-msgv1 }",| &&
|"level": 1,| &&
|"_user_id": "{ header_data_wa-aluser }",| &&
|"_some_info": "foo",| &&
|"_some_env_var": "bar"| &&
|\}|.
DATA time TYPE c LENGTH 8.
DATA timestamp TYPE timestamp.
"rework necessary
CONVERT DATE header_data_wa-aldate TIME header_data_wa-altime INTO TIME STAMP timestamp TIME ZONE 'CST'.
CONVERT TIME STAMP timestamp TIME ZONE 'CST' INTO DATE header_data_wa-aldate TIME header_data_wa-altime.
WRITE header_data_wa-altime TO time USING EDIT MASK '__:__:__'.
DATA(date) = |{ header_data_wa-aldate DATE = ISO }|.
* data(label)
DATA(loki_json) = |\{"streams": [| &&
|\{ "labels": "\{BALexport=\\"{ header_data_wa-extnumber }\\"\}",| &&
| "entries": [\{ "ts": "{ date }T{ time }.801064",| &&
| "line": "{ message-msgv1 }" \}] \}]\}|.
TYPES: BEGIN OF export_target,
url TYPE string,
json TYPE string,
END OF export_target.
DATA export_targets TYPE STANDARD TABLE OF export_target.
DATA export_target LIKE LINE OF export_targets.
"export to GELF and Loki
IF gelf = abap_true.
export_target-url = configurations[ ale_key = gelf_url ]-ale_value.
export_target-json = gelf_json.
APPEND export_target TO export_targets.
ENDIF.
IF loki = abap_true.
export_target-url = configurations[ ale_key = loki_url ]-ale_value.
export_target-json = loki_json.
APPEND export_target TO export_targets.
ENDIF.
LOOP AT export_targets INTO export_target.
cl_http_client=>create_by_url(
EXPORTING
url = export_target-url
IMPORTING
client = DATA(client)
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
client->request->set_method( 'POST' ).
client->request->set_content_type( 'application/json' ).
DATA xjson TYPE xstring.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = export_target-json
* mimetype = SPACE
* encoding =
IMPORTING
buffer = xjson
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
client->request->set_data( xjson ).
client->send(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
client->receive(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
ASSERT 1 = 2.
ENDIF.
client->response->get_status( IMPORTING
code = DATA(http_code)
reason = DATA(reason) ).
ENDLOOP.
ENDLOOP.
ENDLOOP.
sy-subrc = sy-subrc.
| 30.412245 | 110 | 0.558583 |
c4496df495d4ea7fd87f3fe282b7940e448da21b
| 6,018 |
abap
|
ABAP
|
src/utils/zcl_abapgit_adt_link.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 2 |
2021-03-20T20:27:04.000Z
|
2021-03-20T20:34:58.000Z
|
src/utils/zcl_abapgit_adt_link.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 40 |
2021-06-01T05:58:26.000Z
|
2022-03-01T05:02:17.000Z
|
src/utils/zcl_abapgit_adt_link.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 1 |
2018-07-09T09:09:43.000Z
|
2018-07-09T09:09:43.000Z
|
CLASS zcl_abapgit_adt_link DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS generate
IMPORTING
!iv_obj_name TYPE zif_abapgit_definitions=>ty_item-obj_name
!iv_obj_type TYPE zif_abapgit_definitions=>ty_item-obj_type
!iv_sub_obj_name TYPE zif_abapgit_definitions=>ty_item-obj_name OPTIONAL
!iv_line_number TYPE i OPTIONAL
RETURNING
VALUE(rv_result) TYPE string
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS:
get_adt_objects_and_names
IMPORTING
iv_obj_name TYPE zif_abapgit_definitions=>ty_item-obj_name
iv_obj_type TYPE zif_abapgit_definitions=>ty_item-obj_type
EXPORTING
eo_adt_uri_mapper TYPE REF TO object
eo_adt_objectref TYPE REF TO object
ev_program TYPE progname
ev_include TYPE progname
RAISING
zcx_abapgit_exception.
CLASS-METHODS:
is_adt_jump_possible
IMPORTING io_object TYPE REF TO cl_wb_object
io_adt TYPE REF TO object
RETURNING VALUE(rv_is_adt_jump_possible) TYPE abap_bool
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_ADT_LINK IMPLEMENTATION.
METHOD generate.
DATA: lv_adt_link TYPE string.
DATA: lo_adt_uri_mapper TYPE REF TO object ##needed.
DATA: lo_adt_objref TYPE REF TO object ##needed.
DATA: lo_adt_sub_objref TYPE REF TO object ##needed.
DATA: lv_program TYPE progname.
DATA: lv_include TYPE progname.
FIELD-SYMBOLS: <lv_uri> TYPE string.
get_adt_objects_and_names(
EXPORTING
iv_obj_name = iv_obj_name
iv_obj_type = iv_obj_type
IMPORTING
eo_adt_uri_mapper = lo_adt_uri_mapper
eo_adt_objectref = lo_adt_objref
ev_program = lv_program
ev_include = lv_include ).
TRY.
IF iv_sub_obj_name IS NOT INITIAL.
IF ( lv_program <> iv_obj_name AND lv_include IS INITIAL ) OR
( lv_program = lv_include AND iv_sub_obj_name IS NOT INITIAL ).
lv_include = iv_sub_obj_name.
ENDIF.
CALL METHOD lo_adt_uri_mapper->('IF_ADT_URI_MAPPER~MAP_INCLUDE_TO_OBJREF')
EXPORTING
program = lv_program
include = lv_include
line = iv_line_number
line_offset = 0
end_line = iv_line_number
end_offset = 1
RECEIVING
result = lo_adt_sub_objref.
IF lo_adt_sub_objref IS NOT INITIAL.
lo_adt_objref = lo_adt_sub_objref.
ENDIF.
ENDIF.
ASSIGN ('LO_ADT_OBJREF->REF_DATA-URI') TO <lv_uri>.
ASSERT sy-subrc = 0.
CONCATENATE 'adt://' sy-sysid <lv_uri> INTO lv_adt_link.
rv_result = lv_adt_link.
CATCH cx_root.
zcx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDTRY.
ENDMETHOD.
METHOD get_adt_objects_and_names.
DATA lv_obj_type TYPE trobjtype.
DATA lv_obj_name TYPE trobj_name.
DATA lo_object TYPE REF TO cl_wb_object.
DATA lo_adt TYPE REF TO object.
FIELD-SYMBOLS <lv_uri> TYPE string.
lv_obj_name = iv_obj_name.
lv_obj_type = iv_obj_type.
TRY.
cl_wb_object=>create_from_transport_key(
EXPORTING
p_object = lv_obj_type
p_obj_name = lv_obj_name
RECEIVING
p_wb_object = lo_object
EXCEPTIONS
OTHERS = 1 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDIF.
CALL METHOD ('CL_ADT_TOOLS_CORE_FACTORY')=>('GET_INSTANCE')
RECEIVING
result = lo_adt.
IF is_adt_jump_possible( io_object = lo_object
io_adt = lo_adt ) = abap_false.
zcx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDIF.
CALL METHOD lo_adt->('IF_ADT_TOOLS_CORE_FACTORY~GET_URI_MAPPER')
RECEIVING
result = eo_adt_uri_mapper.
CALL METHOD eo_adt_uri_mapper->('IF_ADT_URI_MAPPER~MAP_WB_OBJECT_TO_OBJREF')
EXPORTING
wb_object = lo_object
RECEIVING
result = eo_adt_objectref.
ASSIGN ('EO_ADT_OBJECTREF->REF_DATA-URI') TO <lv_uri>.
ASSERT sy-subrc = 0.
CALL METHOD eo_adt_uri_mapper->('IF_ADT_URI_MAPPER~MAP_OBJREF_TO_INCLUDE')
EXPORTING
uri = <lv_uri>
IMPORTING
program = ev_program
include = ev_include.
CATCH cx_root.
zcx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDTRY.
ENDMETHOD.
METHOD is_adt_jump_possible.
DATA: lo_wb_request TYPE REF TO cl_wb_request,
lo_adt_uri_mapper_vit TYPE REF TO object,
lv_vit_wb_request TYPE abap_bool.
cl_wb_request=>create_from_object_ref(
EXPORTING
p_wb_object = io_object
RECEIVING
p_wb_request = lo_wb_request
EXCEPTIONS
illegal_operation = 1
cancelled = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDIF.
TRY.
CALL METHOD io_adt->('IF_ADT_TOOLS_CORE_FACTORY~GET_URI_MAPPER_VIT')
RECEIVING
result = lo_adt_uri_mapper_vit.
CALL METHOD lo_adt_uri_mapper_vit->('IF_ADT_URI_MAPPER_VIT~IS_VIT_WB_REQUEST')
EXPORTING
wb_request = lo_wb_request
RECEIVING
result = lv_vit_wb_request.
rv_is_adt_jump_possible = boolc( NOT lv_vit_wb_request = abap_true ).
CATCH cx_root.
zcx_abapgit_exception=>raise( 'ADT Jump Error' ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
| 29.940299 | 86 | 0.610003 |
c449db95dc8670c618fb867bae5aed22f7584eb1
| 1,017 |
abap
|
ABAP
|
Task/Ackermann-function/ABAP/ackermann-function.abap
|
LaudateCorpus1/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | 1 |
2018-11-09T22:08:38.000Z
|
2018-11-09T22:08:38.000Z
|
Task/Ackermann-function/ABAP/ackermann-function.abap
|
seanwallawalla-forks/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | null | null | null |
Task/Ackermann-function/ABAP/ackermann-function.abap
|
seanwallawalla-forks/RosettaCodeData
|
9ad63ea473a958506c041077f1d810c0c7c8c18d
|
[
"Info-ZIP"
] | 1 |
2018-11-09T22:08:40.000Z
|
2018-11-09T22:08:40.000Z
|
REPORT zhuberv_ackermann.
CLASS zcl_ackermann DEFINITION.
PUBLIC SECTION.
CLASS-METHODS ackermann IMPORTING m TYPE i
n TYPE i
RETURNING value(v) TYPE i.
ENDCLASS. "zcl_ackermann DEFINITION
CLASS zcl_ackermann IMPLEMENTATION.
METHOD: ackermann.
DATA: lv_new_m TYPE i,
lv_new_n TYPE i.
IF m = 0.
v = n + 1.
ELSEIF m > 0 AND n = 0.
lv_new_m = m - 1.
lv_new_n = 1.
v = ackermann( m = lv_new_m n = lv_new_n ).
ELSEIF m > 0 AND n > 0.
lv_new_m = m - 1.
lv_new_n = n - 1.
lv_new_n = ackermann( m = m n = lv_new_n ).
v = ackermann( m = lv_new_m n = lv_new_n ).
ENDIF.
ENDMETHOD. "ackermann
ENDCLASS. "zcl_ackermann IMPLEMENTATION
PARAMETERS: pa_m TYPE i,
pa_n TYPE i.
DATA: lv_result TYPE i.
START-OF-SELECTION.
lv_result = zcl_ackermann=>ackermann( m = pa_m n = pa_n ).
WRITE: / lv_result.
| 22.108696 | 60 | 0.555556 |
c44a42342c5348bcb33b8be59435ee0d2ba74e90
| 21,815 |
abap
|
ABAP
|
src/not_cloud/zcl_excel_converter_alv.clas.abap
|
boy0korea/abap2xlsx
|
bea794926b201b1c9199efc4e24ac062113e4f6f
|
[
"Apache-2.0"
] | 39 |
2021-12-11T18:27:15.000Z
|
2022-03-31T14:03:53.000Z
|
src/not_cloud/zcl_excel_converter_alv.clas.abap
|
boy0korea/abap2xlsx
|
bea794926b201b1c9199efc4e24ac062113e4f6f
|
[
"Apache-2.0"
] | 115 |
2021-12-11T08:29:00.000Z
|
2022-03-30T17:39:42.000Z
|
src/not_cloud/zcl_excel_converter_alv.clas.abap
|
boy0korea/abap2xlsx
|
bea794926b201b1c9199efc4e24ac062113e4f6f
|
[
"Apache-2.0"
] | 17 |
2021-12-12T13:48:59.000Z
|
2022-03-24T12:28:26.000Z
|
CLASS zcl_excel_converter_alv DEFINITION
PUBLIC
ABSTRACT
CREATE PUBLIC .
*"* public components of class ZCL_EXCEL_CONVERTER_ALV
*"* do not include other source files here!!!
PUBLIC SECTION.
INTERFACES zif_excel_converter
ALL METHODS ABSTRACT .
CLASS-METHODS class_constructor .
*"* protected components of class ZCL_EXCEL_CONVERTER_ALV
*"* do not include other source files here!!!
PROTECTED SECTION.
DATA wt_sort TYPE lvc_t_sort .
DATA wt_filt TYPE lvc_t_filt .
DATA wt_fcat TYPE lvc_t_fcat .
DATA ws_layo TYPE lvc_s_layo .
DATA ws_option TYPE zexcel_s_converter_option .
METHODS update_catalog
CHANGING
!cs_layout TYPE zexcel_s_converter_layo
!ct_fieldcatalog TYPE zexcel_t_converter_fcat .
METHODS apply_sort
IMPORTING
!it_table TYPE STANDARD TABLE
EXPORTING
!eo_table TYPE REF TO data .
METHODS get_color
IMPORTING
!io_table TYPE REF TO data
EXPORTING
!et_colors TYPE zexcel_t_converter_col .
METHODS get_filter
EXPORTING
!et_filter TYPE zexcel_t_converter_fil
CHANGING
!xo_table TYPE REF TO data .
*"* private components of class ZCL_EXCEL_CONVERTER_ALV
*"* do not include other source files here!!!
PRIVATE SECTION.
CLASS-DATA wt_colors TYPE tt_col_converter .
ENDCLASS.
CLASS zcl_excel_converter_alv IMPLEMENTATION.
METHOD apply_sort.
DATA: lt_otab TYPE abap_sortorder_tab,
ls_otab TYPE abap_sortorder.
FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE,
<fs_sort> TYPE lvc_s_sort.
CREATE DATA eo_table LIKE it_table.
ASSIGN eo_table->* TO <fs_table>.
<fs_table> = it_table.
SORT wt_sort BY spos.
LOOP AT wt_sort ASSIGNING <fs_sort>.
IF <fs_sort>-up = abap_true.
ls_otab-name = <fs_sort>-fieldname.
ls_otab-descending = abap_false.
* ls_otab-astext = abap_true. " not only text fields
INSERT ls_otab INTO TABLE lt_otab.
ENDIF.
IF <fs_sort>-down = abap_true.
ls_otab-name = <fs_sort>-fieldname.
ls_otab-descending = abap_true.
* ls_otab-astext = abap_true. " not only text fields
INSERT ls_otab INTO TABLE lt_otab.
ENDIF.
ENDLOOP.
IF lt_otab IS NOT INITIAL.
SORT <fs_table> BY (lt_otab).
ENDIF.
ENDMETHOD.
METHOD class_constructor.
* let's fill the color conversion routines.
DATA: ls_color TYPE ts_col_converter.
* 0 all combination the same
ls_color-col = 0.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 0.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 0.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 0.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
* Blue
ls_color-col = 1.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFB0E4FC'. " 176 228 252 blue
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 1.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FFB0E4FC'. " 176 228 252 blue
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 1.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FF5FCBFE'. " 095 203 254 Int blue
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 1.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FF5FCBFE'. " 095 203 254
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255
INSERT ls_color INTO TABLE wt_colors.
* Gray
ls_color-col = 2.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'.
ls_color-fillcolor = 'FFE5EAF0'. " 229 234 240 gray
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 2.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FFE5EAF0'. " 229 234 240 gray
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 2.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFD8E8F4'. " 216 234 244 int gray
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 2.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FFD8E8F4'. " 216 234 244 int gray
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
*Yellow
ls_color-col = 3.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFEFEB8'. " 254 254 184 yellow
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 3.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FFFEFEB8'. " 254 254 184 yellow
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 3.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFF9ED5D'. " 249 237 093 int yellow
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 3.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FFF9ED5D'. " 249 237 093 int yellow
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
* light blue
ls_color-col = 4.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFCEE7FB'. " 206 231 251 light blue
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 4.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FFCEE7FB'. " 206 231 251 light blue
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 4.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FF9ACCEF'. " 154 204 239 int light blue
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 4.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FF9ACCEF'. " 154 204 239 int light blue
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
* Green
ls_color-col = 5.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFCEF8AE'. " 206 248 174 Green
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 5.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FFCEF8AE'. " 206 248 174 Green
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 5.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FF7AC769'. " 122 199 105 int Green
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 5.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FF7AC769'. " 122 199 105 int Green
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
* Red
ls_color-col = 6.
ls_color-int = 0.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFDBBBC'. " 253 187 188 Red
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 6.
ls_color-int = 0.
ls_color-inv = 1.
ls_color-fontcolor = 'FFFDBBBC'. " 253 187 188 Red
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 6.
ls_color-int = 1.
ls_color-inv = 0.
ls_color-fontcolor = 'FF000000'. " 000 000 000 Black
ls_color-fillcolor = 'FFFB6B6B'. " 251 107 107 int Red
INSERT ls_color INTO TABLE wt_colors.
ls_color-col = 6.
ls_color-int = 1.
ls_color-inv = 1.
ls_color-fontcolor = 'FFFB6B6B'. " 251 107 107 int Red
ls_color-fillcolor = 'FFFFFFFF'. " 255 255 255 White
INSERT ls_color INTO TABLE wt_colors.
ENDMETHOD.
METHOD get_color.
DATA: ls_con_col TYPE zexcel_s_converter_col,
ls_color TYPE ts_col_converter,
l_line TYPE i,
l_color(4) TYPE c.
FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE,
<fs_stab> TYPE any,
<fs> TYPE any,
<ft_slis> TYPE STANDARD TABLE,
<fs_slis> TYPE any.
* Loop trough the table to set the color properties of each line. The color properties field is
* Char 4 and the characters is set as follows:
* Char 1 = C = This is a color property
* Char 2 = 6 = Color code (1 - 7)
* Char 3 = Intensified on/of = 1 = on
* Char 4 = Inverse display = 0 = of
ASSIGN io_table->* TO <fs_tab>.
IF ws_layo-info_fname IS NOT INITIAL OR
ws_layo-ctab_fname IS NOT INITIAL.
LOOP AT <fs_tab> ASSIGNING <fs_stab>.
l_line = sy-tabix.
IF ws_layo-info_fname IS NOT INITIAL.
ASSIGN COMPONENT ws_layo-info_fname OF STRUCTURE <fs_stab> TO <fs>.
IF sy-subrc = 0 AND <fs> IS NOT INITIAL.
l_color = <fs>.
IF l_color(1) = 'C'.
READ TABLE wt_colors INTO ls_color WITH TABLE KEY col = l_color+1(1)
int = l_color+2(1)
inv = l_color+3(1).
IF sy-subrc = 0.
ls_con_col-rownumber = l_line.
ls_con_col-columnname = space.
ls_con_col-fontcolor = ls_color-fontcolor.
ls_con_col-fillcolor = ls_color-fillcolor.
INSERT ls_con_col INTO TABLE et_colors.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
IF ws_layo-ctab_fname IS NOT INITIAL.
ASSIGN COMPONENT ws_layo-ctab_fname OF STRUCTURE <fs_stab> TO <ft_slis>.
IF sy-subrc = 0.
LOOP AT <ft_slis> ASSIGNING <fs_slis>.
ASSIGN COMPONENT 'COLOR' OF STRUCTURE <fs_slis> TO <fs>.
IF sy-subrc = 0.
IF <fs> IS NOT INITIAL.
FIELD-SYMBOLS: <col> TYPE any,
<int> TYPE any,
<inv> TYPE any,
<fname> TYPE any,
<nokeycol> TYPE any.
ASSIGN COMPONENT 'COL' OF STRUCTURE <fs> TO <col>.
ASSIGN COMPONENT 'INT' OF STRUCTURE <fs> TO <int>.
ASSIGN COMPONENT 'INV' OF STRUCTURE <fs> TO <inv>.
READ TABLE wt_colors INTO ls_color WITH TABLE KEY col = <col>
int = <int>
inv = <inv>.
IF sy-subrc = 0.
ls_con_col-rownumber = l_line.
ASSIGN COMPONENT 'FNAME' OF STRUCTURE <fs_slis> TO <fname>.
IF sy-subrc NE 0.
ASSIGN COMPONENT 'FIELDNAME' OF STRUCTURE <fs_slis> TO <fname>.
IF sy-subrc EQ 0.
ls_con_col-columnname = <fname>.
ENDIF.
ELSE.
ls_con_col-columnname = <fname>.
ENDIF.
ls_con_col-fontcolor = ls_color-fontcolor.
ls_con_col-fillcolor = ls_color-fillcolor.
ASSIGN COMPONENT 'NOKEYCOL' OF STRUCTURE <fs_slis> TO <nokeycol>.
IF sy-subrc EQ 0.
ls_con_col-nokeycol = <nokeycol>.
ENDIF.
INSERT ls_con_col INTO TABLE et_colors.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD get_filter.
DATA: ls_filt TYPE lvc_s_filt,
l_line TYPE i,
ls_filter TYPE zexcel_s_converter_fil.
DATA: lo_addit TYPE REF TO cl_abap_elemdescr,
lt_components_tab TYPE cl_abap_structdescr=>component_table,
ls_components TYPE abap_componentdescr,
lo_table TYPE REF TO cl_abap_tabledescr,
lo_struc TYPE REF TO cl_abap_structdescr,
lo_trange TYPE REF TO data,
lo_srange TYPE REF TO data,
lo_ltabdata TYPE REF TO data.
FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE,
<fs_ltab> TYPE STANDARD TABLE,
<fs_stab> TYPE any,
<fs> TYPE any,
<fs1> TYPE any,
<fs_srange> TYPE any,
<fs_trange> TYPE STANDARD TABLE.
IF ws_option-filter = abap_false.
CLEAR et_filter.
RETURN.
ENDIF.
ASSIGN xo_table->* TO <fs_tab>.
CREATE DATA lo_ltabdata LIKE <fs_tab>.
ASSIGN lo_ltabdata->* TO <fs_ltab>.
LOOP AT wt_filt INTO ls_filt.
LOOP AT <fs_tab> ASSIGNING <fs_stab>.
l_line = sy-tabix.
ASSIGN COMPONENT ls_filt-fieldname OF STRUCTURE <fs_stab> TO <fs>.
IF sy-subrc = 0.
IF l_line = 1.
CLEAR lt_components_tab.
ls_components-name = 'SIGN'.
lo_addit ?= cl_abap_typedescr=>describe_by_data( ls_filt-sign ).
ls_components-type = lo_addit .
INSERT ls_components INTO TABLE lt_components_tab.
ls_components-name = 'OPTION'.
lo_addit ?= cl_abap_typedescr=>describe_by_data( ls_filt-option ).
ls_components-type = lo_addit .
INSERT ls_components INTO TABLE lt_components_tab.
ls_components-name = 'LOW'.
lo_addit ?= cl_abap_typedescr=>describe_by_data( <fs> ).
ls_components-type = lo_addit .
INSERT ls_components INTO TABLE lt_components_tab.
ls_components-name = 'HIGH'.
lo_addit ?= cl_abap_typedescr=>describe_by_data( <fs> ).
ls_components-type = lo_addit .
INSERT ls_components INTO TABLE lt_components_tab.
"create new line type
TRY.
lo_struc = cl_abap_structdescr=>create( p_components = lt_components_tab
p_strict = abap_false ).
CATCH cx_sy_struct_creation.
CONTINUE.
ENDTRY.
lo_table = cl_abap_tabledescr=>create( lo_struc ).
CREATE DATA lo_trange TYPE HANDLE lo_table.
CREATE DATA lo_srange TYPE HANDLE lo_struc.
ASSIGN lo_trange->* TO <fs_trange>.
ASSIGN lo_srange->* TO <fs_srange>.
ENDIF.
CLEAR <fs_trange>.
ASSIGN COMPONENT 'SIGN' OF STRUCTURE <fs_srange> TO <fs1>.
<fs1> = ls_filt-sign.
ASSIGN COMPONENT 'OPTION' OF STRUCTURE <fs_srange> TO <fs1>.
<fs1> = ls_filt-option.
ASSIGN COMPONENT 'LOW' OF STRUCTURE <fs_srange> TO <fs1>.
<fs1> = ls_filt-low.
ASSIGN COMPONENT 'HIGH' OF STRUCTURE <fs_srange> TO <fs1>.
<fs1> = ls_filt-high.
INSERT <fs_srange> INTO TABLE <fs_trange>.
IF <fs> IN <fs_trange>.
IF ws_option-filter = abap_true.
ls_filter-rownumber = l_line.
ls_filter-columnname = ls_filt-fieldname.
INSERT ls_filter INTO TABLE et_filter.
ELSE.
INSERT <fs_stab> INTO TABLE <fs_ltab>.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
IF ws_option-filter = abap_undefined.
<fs_tab> = <fs_ltab>.
CLEAR <fs_ltab>.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD update_catalog.
DATA: ls_fieldcatalog TYPE zexcel_s_converter_fcat,
ls_fcat TYPE lvc_s_fcat,
ls_sort TYPE lvc_s_sort,
l_decimals TYPE lvc_decmls.
FIELD-SYMBOLS: <fs_scat> TYPE zexcel_s_converter_fcat.
IF ws_layo-zebra IS NOT INITIAL.
cs_layout-is_stripped = abap_true.
ENDIF.
IF ws_layo-no_keyfix IS INITIAL OR
ws_layo-no_keyfix = '0'.
cs_layout-is_fixed = abap_true.
ENDIF.
LOOP AT wt_fcat INTO ls_fcat.
CLEAR: ls_fieldcatalog,
l_decimals.
CASE ws_option-hidenc.
WHEN abap_false. " We make hiden columns visible
CLEAR ls_fcat-no_out.
WHEN abap_true.
* We convert column and hide it.
WHEN abap_undefined. "We don't convert hiden columns
IF ls_fcat-no_out = abap_true.
ls_fcat-tech = abap_true.
ENDIF.
ENDCASE.
IF ls_fcat-tech = abap_false.
ls_fieldcatalog-tabname = ls_fcat-tabname.
ls_fieldcatalog-fieldname = ls_fcat-fieldname .
ls_fieldcatalog-columnname = ls_fcat-fieldname .
ls_fieldcatalog-position = ls_fcat-col_pos.
ls_fieldcatalog-col_id = ls_fcat-col_id.
ls_fieldcatalog-convexit = ls_fcat-convexit.
ls_fieldcatalog-inttype = ls_fcat-inttype.
ls_fieldcatalog-scrtext_s = ls_fcat-scrtext_s .
ls_fieldcatalog-scrtext_m = ls_fcat-scrtext_m .
ls_fieldcatalog-scrtext_l = ls_fcat-scrtext_l.
l_decimals = ls_fcat-decimals_o.
IF l_decimals IS NOT INITIAL.
ls_fieldcatalog-decimals = l_decimals.
ELSE.
ls_fieldcatalog-decimals = ls_fcat-decimals .
ENDIF.
CASE ws_option-subtot.
WHEN abap_false. " We ignore subtotals
CLEAR ls_fcat-do_sum.
WHEN abap_true. " We convert subtotals and detail
WHEN abap_undefined. " We should only take subtotals and displayed detail
* for now abap_true
ENDCASE.
CASE ls_fcat-do_sum.
WHEN abap_true.
ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_sum.
WHEN 'A'.
ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_min.
WHEN 'B' .
ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_max.
WHEN 'C' .
ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_average.
WHEN OTHERS.
CLEAR ls_fieldcatalog-totals_function .
ENDCASE.
ls_fieldcatalog-fix_column = ls_fcat-fix_column.
IF ws_layo-cwidth_opt IS INITIAL.
IF ls_fcat-col_opt IS NOT INITIAL.
ls_fieldcatalog-is_optimized = abap_true.
ENDIF.
ELSE.
ls_fieldcatalog-is_optimized = abap_true.
ENDIF.
IF ls_fcat-no_out IS NOT INITIAL.
ls_fieldcatalog-is_hidden = abap_true.
ls_fieldcatalog-position = ls_fieldcatalog-col_id. " We hide based on orginal data structure
ENDIF.
* Alignment in each cell
CASE ls_fcat-just.
WHEN 'R'.
ls_fieldcatalog-alignment = zcl_excel_style_alignment=>c_horizontal_right.
WHEN 'L'.
ls_fieldcatalog-alignment = zcl_excel_style_alignment=>c_horizontal_left.
WHEN 'C'.
ls_fieldcatalog-alignment = zcl_excel_style_alignment=>c_horizontal_center.
WHEN OTHERS.
CLEAR ls_fieldcatalog-alignment.
ENDCASE.
* Check for subtotals.
READ TABLE wt_sort INTO ls_sort WITH KEY fieldname = ls_fcat-fieldname.
IF sy-subrc = 0 AND ws_option-subtot <> abap_false.
ls_fieldcatalog-sort_level = 0 .
ls_fieldcatalog-is_subtotalled = ls_sort-subtot.
ls_fieldcatalog-is_collapsed = ls_sort-expa.
IF ls_fieldcatalog-is_subtotalled = abap_true.
ls_fieldcatalog-sort_level = ls_sort-spos.
ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_sum. " we need function for text
ENDIF.
ENDIF.
APPEND ls_fieldcatalog TO ct_fieldcatalog.
ENDIF.
ENDLOOP.
SORT ct_fieldcatalog BY sort_level ASCENDING.
cs_layout-max_subtotal_level = 0.
LOOP AT ct_fieldcatalog ASSIGNING <fs_scat> WHERE sort_level > 0.
cs_layout-max_subtotal_level = cs_layout-max_subtotal_level + 1.
<fs_scat>-sort_level = cs_layout-max_subtotal_level.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
| 36.297837 | 111 | 0.589961 |
c44b8f1b1b0b889369834090c03d134bae0a4553
| 11,281 |
abap
|
ABAP
|
src/zcl_excel_reader_huge_file.clas.testclasses.abap
|
sigitas-stumbras/abap2xlsx
|
156696a9e40e799d8ce38738fbbfc4334fad13c7
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_excel_reader_huge_file.clas.testclasses.abap
|
sigitas-stumbras/abap2xlsx
|
156696a9e40e799d8ce38738fbbfc4334fad13c7
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_excel_reader_huge_file.clas.testclasses.abap
|
sigitas-stumbras/abap2xlsx
|
156696a9e40e799d8ce38738fbbfc4334fad13c7
|
[
"Apache-2.0"
] | null | null | null |
*"* use this source file for your ABAP unit test classes
class lcl_test definition deferred.
class zcl_excel_reader_huge_file definition local friends lcl_test.
*
class lcl_test definition for testing " #AU Risk_Level Harmless
inheriting from cl_aunit_assert. " #AU Duration Short
private section.
data:
out type ref to zcl_excel_reader_huge_file, " object under test
excel type ref to zcl_excel,
worksheet type ref to zcl_excel_worksheet.
methods:
setup,
test_number for testing,
test_shared_string for testing,
test_shared_string_missing for testing,
test_inline_string for testing,
test_empty_cells for testing,
test_boolean for testing,
test_style for testing,
test_style_missing for testing,
test_formula for testing,
test_read_shared_strings for testing,
test_shared_string_some_empty for testing,
test_skip_to_inexistent for testing,
get_reader importing iv_xml type string returning value(eo_reader) type ref to if_sxml_reader,
assert_value_equals importing iv_row type i default 1 iv_col type i default 1 iv_value type string,
assert_formula_equals importing iv_row type i default 1 iv_col type i default 1 iv_formula type string,
assert_style_equals importing iv_row type i default 1 iv_col type i default 1 iv_style type ZEXCEL_CELL_STYLE,
assert_datatype_equals importing iv_row type i default 1 iv_col type i default 1 iv_datatype type string.
endclass. "lcl_test DEFINITION
*
class lcl_test implementation.
*
method test_number.
data lo_reader type ref to if_sxml_reader.
lo_reader = get_reader(
`<c r="A1" t="n"><v>17</v></c>`
).
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
assert_value_equals( `17` ).
assert_datatype_equals( `n` ).
endmethod. "test_shared_string
*
method test_shared_string.
data lo_reader type ref to if_sxml_reader.
data ls_shared_string LIKE LINE OF out->shared_strings.
ls_shared_string-value = `Test1`.
append ls_shared_string to out->shared_strings.
ls_shared_string-value = `Test2`.
append ls_shared_string to out->shared_strings.
lo_reader = get_reader(
`<c r="A1" t="s"><v>1</v></c>`
).
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
assert_value_equals( `Test2` ).
assert_datatype_equals( `s` ).
endmethod. "test_shared_string
*
method test_shared_string_missing.
data: lo_reader type ref to if_sxml_reader,
lo_ex type ref to lcx_not_found,
lv_text type string.
data ls_shared_string LIKE LINE OF out->shared_strings.
ls_shared_string-value = `Test`.
append ls_shared_string to out->shared_strings.
lo_reader = get_reader(
`<c r="A1" t="s"><v>1</v></c>`
).
try.
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
fail(`Index to non-existent shared string should give an error`).
catch lcx_not_found into lo_ex.
lv_text = lo_ex->get_text( ). " >>> May inspect the message in the debugger
endtry.
endmethod.
*
method test_inline_string.
data lo_reader type ref to if_sxml_reader.
lo_reader = get_reader(
`<c r="A1" t="inlineStr"><is><t>Alpha</t></is></c>`
).
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
assert_value_equals( `Alpha` ).
assert_datatype_equals( `inlineStr` ).
endmethod. "test_inline_string
*
method test_boolean.
data lo_reader type ref to if_sxml_reader.
lo_reader = get_reader(
`<c r="A1" t="b"><v>1</v></c>`
).
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
assert_value_equals( `1` ).
assert_datatype_equals( `b` ).
endmethod. "test_boolean
*
method test_formula.
data lo_reader type ref to if_sxml_reader.
lo_reader = get_reader(
`<c r="A1" t="n"><f>A2*A2</f></c>`
).
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
assert_formula_equals( `A2*A2` ).
assert_datatype_equals( `n` ).
endmethod. "test_formula
*
method test_empty_cells.
* There is no need to store an empty cell in the ABAP worksheet structure
data: lo_reader type ref to if_sxml_reader.
data ls_shared_string LIKE LINE OF out->shared_strings.
ls_shared_string-value = ``.
append ls_shared_string to out->shared_strings.
ls_shared_string-value = `t`.
append ls_shared_string to out->shared_strings.
lo_reader = get_reader(
`<c r="A1" t="s"><v>0</v></c>` &
`<c r="A2" t="inlineStr"><is><t></t></is></c>` &
`<c r="A3" t="s"><v>1</v></c>`
).
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
assert_value_equals( iv_row = 1 iv_col = 1 iv_value = `` ).
assert_value_equals( iv_row = 2 iv_col = 1 iv_value = `` ).
assert_value_equals( iv_row = 3 iv_col = 1 iv_value = `t` ).
endmethod.
*
method test_style.
data:
lo_reader type ref to if_sxml_reader,
lo_style type ref to zcl_excel_style,
lv_guid type ZEXCEL_CELL_STYLE.
create object lo_style.
append lo_style to out->styles.
lv_guid = lo_style->get_guid( ).
lo_reader = get_reader(
`<c r="A1" s="0"><v>18</v></c>`
).
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
assert_style_equals( lv_guid ).
endmethod. "test_style
*
method test_style_missing.
data:
lo_reader type ref to if_sxml_reader,
lo_ex type ref to lcx_not_found,
lv_text type string.
lo_reader = get_reader(
`<c r="A1" s="0"><v>18</v></c>`
).
try.
out->read_worksheet_data( io_reader = lo_reader io_worksheet = worksheet ).
fail(`Reference to non-existent style should throw an lcx_not_found exception`).
catch lcx_not_found into lo_ex.
lv_text = lo_ex->get_text( ). " >>> May inspect the message in the debugger
endtry.
endmethod. "test_style
*
method test_read_shared_strings.
data: lo_c2x type ref to cl_abap_conv_out_ce,
lv_xstring type xstring,
lo_reader type ref to if_sxml_reader,
lt_act type zcl_excel_reader_huge_file=>t_shared_strings,
lt_exp type zcl_excel_reader_huge_file=>t_shared_strings,
ls_exp LIKE LINE OF lt_exp.
lo_c2x = cl_abap_conv_out_ce=>create( ).
lo_c2x->convert( exporting data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
importing buffer = lv_xstring ).
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
ls_exp-value = ``.
append ls_exp TO lt_exp.
ls_exp-value = `Alpha`.
append ls_exp TO lt_exp.
ls_exp-value = `Bravo`.
append ls_exp TO lt_exp.
lt_act = out->read_shared_strings( lo_reader ).
assert_equals( act = lt_act
exp = lt_exp ).
endmethod.
method test_shared_string_some_empty.
data: lo_reader type ref to if_sxml_reader,
lt_act type zcl_excel_reader_huge_file=>t_shared_strings,
lt_exp type zcl_excel_reader_huge_file=>t_shared_strings,
ls_exp LIKE LINE OF lt_exp.
lo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to(
`<sst><si><t/></si>` &
`<si><t>Alpha</t></si>` &
`<si><t/></si>` &
`<si><t>Bravo</t></si></sst>`
) ).
ls_exp-value = ``.
append ls_exp TO lt_exp.
ls_exp-value = `Alpha`.
append ls_exp TO lt_exp.
ls_exp-value = ``.
append ls_exp TO lt_exp.
ls_exp-value = `Bravo`.
append ls_exp TO lt_exp.
lt_act = out->read_shared_strings( lo_reader ).
assert_equals( act = lt_act
exp = lt_exp ).
endmethod.
*
method test_skip_to_inexistent.
data: lo_c2x type ref to cl_abap_conv_out_ce,
lv_xstring type xstring,
lo_reader type ref to if_sxml_reader,
lo_ex type ref to lcx_not_found,
lv_text type string.
lo_c2x = cl_abap_conv_out_ce=>create( ).
lo_c2x->convert( exporting data = `<sst><si><t/></si><si><t>Alpha</t></si><si><t>Bravo</t></si></sst>`
importing buffer = lv_xstring ).
lo_reader = cl_sxml_string_reader=>create( lv_xstring ).
try.
out->skip_to( iv_element_name = `nonExistingElement` io_reader = lo_reader ).
fail(`Skipping to non-existing element must raise lcx_not_found exception`).
catch lcx_not_found into lo_ex.
lv_text = lo_ex->get_text( ). " May inspect exception text in debugger
endtry.
endmethod.
*
method get_reader.
data: lv_full type string,
lo_c2x type ref to cl_abap_conv_out_ce,
lv_xstring type xstring.
concatenate `<root><sheetData><row>` iv_xml `</row></sheetData></root>` into lv_full.
lo_c2x = cl_abap_conv_out_ce=>create( ).
lo_c2x->convert( exporting data = lv_full
importing buffer = lv_xstring ).
eo_reader = cl_sxml_string_reader=>create( lv_xstring ).
endmethod. "get_reader
*
method assert_value_equals.
constants: lc_empty_string type string value is initial.
field-symbols: <ls_cell_data> type zexcel_s_cell_data,
<lv_value> type string.
read table worksheet->sheet_content assigning <ls_cell_data>
with table key cell_row = iv_row cell_column = iv_col.
if sy-subrc eq 0.
assign <ls_cell_data>-cell_value to <lv_value>.
else.
assign lc_empty_string to <lv_value>.
endif.
assert_equals( act = <lv_value>
exp = iv_value ).
endmethod. "assert_value_equals
**
method assert_formula_equals.
field-symbols: <ls_cell_data> type zexcel_s_cell_data.
read table worksheet->sheet_content assigning <ls_cell_data>
with table key cell_row = iv_row cell_column = iv_col.
assert_subrc( sy-subrc ).
assert_equals( act = <ls_cell_data>-cell_formula
exp = iv_formula ).
endmethod. "assert_formula_equals
*
method assert_style_equals.
field-symbols: <ls_cell_data> type zexcel_s_cell_data.
read table worksheet->sheet_content assigning <ls_cell_data>
with table key cell_row = iv_row cell_column = iv_col.
assert_subrc( sy-subrc ).
assert_equals( act = <ls_cell_data>-cell_style
exp = iv_style ).
endmethod.
*
method assert_datatype_equals.
field-symbols: <ls_cell_data> type zexcel_s_cell_data.
read table worksheet->sheet_content assigning <ls_cell_data>
with table key cell_row = iv_row cell_column = iv_col.
assert_subrc( sy-subrc ).
assert_equals( act = <ls_cell_data>-data_type
exp = iv_datatype ).
endmethod. "assert_datatype_equals
method setup.
create object out.
create object excel.
create object worksheet
exporting
ip_excel = excel.
endmethod. "setup
endclass. "lcl_test IMPLEMENTATION
| 33.179412 | 116 | 0.658895 |
c457da9f4396bd21c4a90c1ae67f8c9ab22d8a6e
| 32,019 |
abap
|
ABAP
|
src/z_atd_demo.prog.abap
|
sandraros/Demo-ATD
|
82385d01c14545d223db518d6ee8c3c9c4ba6e70
|
[
"MIT"
] | 6 |
2019-11-27T07:58:16.000Z
|
2022-03-29T05:34:50.000Z
|
src/z_atd_demo.prog.abap
|
sandraros/Demo-ATD
|
82385d01c14545d223db518d6ee8c3c9c4ba6e70
|
[
"MIT"
] | null | null | null |
src/z_atd_demo.prog.abap
|
sandraros/Demo-ATD
|
82385d01c14545d223db518d6ee8c3c9c4ba6e70
|
[
"MIT"
] | 2 |
2020-12-29T06:43:57.000Z
|
2021-12-07T11:03:19.000Z
|
*&---------------------------------------------------------------------*
*& Report z_atd_demo
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_atd_demo.
CLASS lcl_cut DEFINITION DEFERRED.
CLASS ltc_atd_aunit DEFINITION
INHERITING FROM cl_aunit_assert
FINAL
FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
setup,
raise_exception_good FOR TESTING RAISING cx_static_check,
raise_exception_good2 FOR TESTING RAISING cx_static_check,
raise_exception_bad FOR TESTING RAISING cx_static_check,
exporting_good FOR TESTING RAISING cx_static_check,
exporting_bad FOR TESTING RAISING cx_static_check,
exporting_returning_good FOR TESTING RAISING cx_static_check,
returning_good FOR TESTING RAISING cx_static_check,
exporting_twice_good FOR TESTING RAISING cx_static_check,
returning_twice_good FOR TESTING RAISING cx_static_check,
times_bad FOR TESTING RAISING cx_static_check,
times_zero_bad FOR TESTING RAISING cx_static_check,
times_good FOR TESTING RAISING cx_static_check,
times_good2 FOR TESTING RAISING cx_static_check,
importing_required_bad FOR TESTING RAISING cx_static_check,
importing_required_good FOR TESTING RAISING cx_static_check,
importing_required_good2 FOR TESTING RAISING cx_static_check,
importing_optional_bad FOR TESTING RAISING cx_static_check,
importing_optional_good FOR TESTING RAISING cx_static_check,
importing_optional_good2 FOR TESTING RAISING cx_static_check,
importing_optional_good3 FOR TESTING RAISING cx_static_check,
changing_good FOR TESTING RAISING cx_static_check,
ignore_parameter_bad FOR TESTING RAISING cx_static_check,
ignore_parameter_good FOR TESTING RAISING cx_static_check,
ignore_all_parameters_bad FOR TESTING RAISING cx_static_check,
ignore_all_parameters_good FOR TESTING RAISING cx_static_check,
two_methods_bad FOR TESTING RAISING cx_static_check,
two_methods_good FOR TESTING RAISING cx_static_check,
several_cases_good FOR TESTING RAISING cx_static_check,
decision_table_good FOR TESTING RAISING cx_static_check,
decision_table_bad FOR TESTING RAISING cx_static_check,
decision_table_bad2 FOR TESTING RAISING cx_static_check,
decision_table_bad3 FOR TESTING RAISING cx_static_check,
decision_table_bad4 FOR TESTING RAISING cx_static_check,
order_of_calls_bad FOR TESTING RAISING cx_static_check,
order_of_calls_bad2 FOR TESTING RAISING cx_static_check,
raise_event_good FOR TESTING RAISING cx_static_check.
METHODS on_action_done FOR EVENT action_done OF zif_atd_demo IMPORTING param_name.
METHODS decision_table_init_bad.
DATA: test_double TYPE REF TO zif_atd_demo,
cut TYPE REF TO lcl_cut,
result TYPE i.
DATA event_param_value TYPE string.
ENDCLASS.
CLASS ltc_atd_max_test_doubles DEFINITION
INHERITING FROM cl_aunit_assert
FINAL
FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS max_test_doubles FOR TESTING.
ENDCLASS.
CLASS lcl_cut DEFINITION
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES zif_atd_demo.
METHODS constructor
IMPORTING
atd_aunit TYPE REF TO zif_atd_demo.
PRIVATE SECTION.
DATA: mr_atd_aunit TYPE REF TO zif_atd_demo.
ENDCLASS.
CLASS lcx_cut DEFINITION INHERITING FROM cx_no_check.
ENDCLASS.
CLASS lcl_cut IMPLEMENTATION.
METHOD constructor.
mr_atd_aunit = atd_aunit.
ENDMETHOD.
METHOD zif_atd_demo~exporting.
mr_atd_aunit->exporting( IMPORTING result = result ).
ENDMETHOD.
METHOD zif_atd_demo~demo_raise_exception.
mr_atd_aunit->demo_raise_exception( ).
ENDMETHOD.
METHOD zif_atd_demo~demo_raise_exception2.
result = mr_atd_aunit->demo_raise_exception2( whatever ).
ENDMETHOD.
METHOD zif_atd_demo~demo_returning.
result = mr_atd_aunit->demo_returning( ).
ENDMETHOD.
METHOD zif_atd_demo~importing_optional.
IF whatever IS NOT SUPPLIED.
result = mr_atd_aunit->importing_optional( ).
ELSE.
result = mr_atd_aunit->importing_optional( whatever ).
ENDIF.
ENDMETHOD.
METHOD zif_atd_demo~importing_required.
result = mr_atd_aunit->importing_required( whatever ).
ENDMETHOD.
METHOD zif_atd_demo~changing.
mr_atd_aunit->changing( CHANGING whatever = whatever ).
ENDMETHOD.
METHOD zif_atd_demo~demo_raise_event.
mr_atd_aunit->demo_raise_event( ).
ENDMETHOD.
METHOD zif_atd_demo~several_cases.
result = mr_atd_aunit->several_cases( whatever = whatever ).
ENDMETHOD.
METHOD zif_atd_demo~decision_table.
result = mr_atd_aunit->decision_table( p1 = p1 p2 = p2 ).
ENDMETHOD.
METHOD zif_atd_demo~exporting_returning.
returning = mr_atd_aunit->exporting_returning( IMPORTING exporting = exporting ).
ENDMETHOD.
ENDCLASS.
CLASS ltc_atd_aunit IMPLEMENTATION.
METHOD setup.
" create test double object
test_double ?= cl_abap_testdouble=>create( 'ZIF_ATD_DEMO' ).
" injecting the test double into the object to be tested (Code Under Test)
CREATE OBJECT cut EXPORTING atd_aunit = test_double.
ENDMETHOD.
METHOD raise_exception_good.
" GOOD EXAMPLE
" When the method DEMO_RAISE_EXCEPTION is called
" Then an exception should be raised
DATA: lx_exp TYPE REF TO lcx_cut,
lx_act TYPE REF TO lcx_cut.
CREATE OBJECT lx_exp.
cl_abap_testdouble=>configure_call( test_double )->raise_exception( lx_exp ).
test_double->demo_raise_exception( ).
TRY.
cut->zif_atd_demo~demo_raise_exception( ).
CATCH lcx_cut INTO lx_act.
ENDTRY.
assert_equals( exp = lx_exp act = lx_act ).
ENDMETHOD.
METHOD raise_exception_good2.
" GOOD EXAMPLE
" When the method DEMO_RAISE_EXCEPTION2 is called with parameter 20
" Then an exception should be raised
"
" When the method DEMO_RAISE_EXCEPTION2 is called with parameter 30
" Then an exception should not be raised and the returned value should be 88
DATA: lx_exp TYPE REF TO lcx_cut,
lx_act TYPE REF TO lcx_cut.
CREATE OBJECT lx_exp.
cl_abap_testdouble=>configure_call( test_double )->raise_exception( lx_exp ).
test_double->demo_raise_exception2( 20 ).
cl_abap_testdouble=>configure_call( test_double )->returning( 88 ).
test_double->demo_raise_exception2( 30 ).
TRY.
cut->zif_atd_demo~demo_raise_exception2( 20 ).
CATCH lcx_cut INTO lx_act.
ENDTRY.
assert_equals( exp = lx_exp act = lx_act ).
result = cut->zif_atd_demo~demo_raise_exception2( 30 ).
assert_equals( exp = 88 act = result ).
ENDMETHOD.
METHOD raise_exception_bad.
" BAD EXAMPLE
" When the call configuration uses both RETURNING and RAISE_EXCEPTION
" Then an exception '[ ABAP Testdouble Framework ] Illegal combination
" of RETURNING with RAISE_EXCEPTION' should be raised
"
" When the call configuration uses both SET_PARAMETER and RAISE_EXCEPTION
" Then an exception 'Illegal config call. Previous
" configuration not complete' should be raised
DATA: lx_exp TYPE REF TO lcx_cut,
lx2 TYPE REF TO cx_atd_exception.
CREATE OBJECT lx_exp.
TRY.
cl_abap_testdouble=>configure_call( test_double )->raise_exception( lx_exp )->returning( 90 ).
fail( ).
CATCH cx_atd_exception INTO lx2.
assert_equals( exp = cx_atd_exception=>illegal_combi_exception
act = lx2->if_t100_message~t100key ).
ENDTRY.
TRY.
cl_abap_testdouble=>configure_call( test_double )->raise_exception( lx_exp )->set_parameter( name = 'OUTPUT' value = 90 ).
fail( ).
CATCH cx_atd_exception INTO lx2.
assert_equals( exp = cx_atd_exception=>illegal_config_call
act = lx2->if_t100_message~t100key ).
ENDTRY.
ENDMETHOD.
METHOD exporting_bad.
" BAD EXAMPLE
" When the call configuration contains IMPORTING
" Then an ABAP Test Double exception should be raised
" Solution: retrieve the results via SET_PARAMETER in the CONFIGURE_CALL
DATA lx2 TYPE REF TO cx_atd_exception.
cl_abap_testdouble=>configure_call( test_double )->set_parameter( name = 'RESULT' value = 20 ).
TRY.
test_double->exporting( IMPORTING result = result ).
CATCH cx_atd_exception INTO lx2.
ENDTRY.
assert_bound( lx2 ).
assert_equals( exp = cx_atd_exception=>export_not_allowed
act = lx2->if_t100_message~t100key ).
ENDMETHOD.
METHOD exporting_good.
" GOOD EXAMPLE
" When the method EXPORTING is called
" Then it should return the exporting parameter RESULT with value 20
cl_abap_testdouble=>configure_call( test_double )->set_parameter( name = 'RESULT' value = 20 ).
test_double->exporting( ).
cut->zif_atd_demo~exporting( IMPORTING result = result ).
assert_equals( exp = 20 act = result ).
ENDMETHOD.
METHOD returning_good.
" GOOD EXAMPLE
" When the method DEMO_RETURNING is called
" Then it should return the returning parameter RESULT with value 97
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
test_double->demo_returning( ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD exporting_twice_good.
" GOOD EXAMPLE
" When the method EXPORTING is called multiple times
" Then it should always return the exporting parameter RESULT with value 20
cl_abap_testdouble=>configure_call( test_double )->set_parameter( name = 'RESULT' value = 20 ).
test_double->exporting( ).
cut->zif_atd_demo~exporting( IMPORTING result = result ).
cut->zif_atd_demo~exporting( IMPORTING result = result ).
assert_equals( exp = 20 act = result ).
ENDMETHOD.
METHOD returning_twice_good.
" GOOD EXAMPLE
" When the method DEMO_RETURNING is called multiple times
" Then it should return the returning parameter RESULT with value 97
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
test_double->demo_returning( ).
result = cut->zif_atd_demo~demo_returning( ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD times_bad.
" BAD EXAMPLE
" When the method DEMO_RETURNING is called the first time
" Then it should return the returning parameter RESULT with value 97
"
" When the method DEMO_RETURNING is called the second time
" Then it should return the returning parameter RESULT with value 0
" But it returns 97 !
" Solution: you should define another call configuration, because
" the last one is always returned.
cl_abap_testdouble=>configure_call( test_double
)->returning( 97
)->times( 1 ). " useless, times( 1 ) is the default if not specified
test_double->demo_returning( ).
result = cut->zif_atd_demo~demo_returning( ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD times_good.
" GOOD EXAMPLE
" When the method DEMO_RETURNING is called the first time
" Then it should return the returning parameter RESULT with value 97
"
" When the method DEMO_RETURNING is called the next times
" Then it should return the returning parameter RESULT with value 0
cl_abap_testdouble=>configure_call( test_double
)->returning( 97 ).
test_double->demo_returning( ).
cl_abap_testdouble=>configure_call( test_double
)->returning( 0 ).
test_double->demo_returning( ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 97 act = result ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 0 act = result ).
" from now on (max times consumed), the last configuration is used
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD times_good2.
" GOOD EXAMPLE
" When the method DEMO_RETURNING is called the two first times
" Then it should return the returning parameter RESULT with value 97
"
" When the method DEMO_RETURNING is called the next times
" Then it should return the returning parameter RESULT with value 0
cl_abap_testdouble=>configure_call( test_double
)->returning( 97
)->times( 2 ).
test_double->demo_returning( ).
cl_abap_testdouble=>configure_call( test_double
)->returning( 0 ).
test_double->demo_returning( ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 97 act = result ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 97 act = result ).
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 0 act = result ).
" from now on (max times consumed), the last configuration is used
result = cut->zif_atd_demo~demo_returning( ).
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD times_zero_bad.
" TIMES( 0 ) doesn't mean unlimited number of times
DATA lx2 TYPE REF TO cx_atd_exception.
TRY.
cl_abap_testdouble=>configure_call( test_double
)->returning( 97
)->times( 0 ). " <--- INVALID
CATCH cx_atd_exception INTO lx2.
ENDTRY.
assert_bound( lx2 ).
assert_equals( exp = cx_atd_exception=>times_zero
act = lx2->if_t100_message~t100key ).
ENDMETHOD.
METHOD exporting_returning_good.
" GOOD EXAMPLE
" When the method EXPORTING_RETURNING is called
" Then it should return the returning parameter with value 97
" and the exporting parameter with value 135
DATA: exporting TYPE i.
cl_abap_testdouble=>configure_call( test_double
)->returning( 97
)->set_parameter( name = 'EXPORTING' value = 135 ).
test_double->exporting_returning( ).
result = cut->zif_atd_demo~exporting_returning( IMPORTING exporting = exporting ).
assert_equals( exp = 97 act = result ).
assert_equals( exp = 135 act = exporting ).
ENDMETHOD.
METHOD importing_required_bad.
" BAD EXAMPLE
" When the method IMPORTING_REQUIRED is called with parameter 5555
" Then it should return 97
" But it returns 0 !
" Solution: replace 5554 with 5555 in the call configuration
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
test_double->importing_required( 5554 ).
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD importing_required_good.
" GOOD EXAMPLE
" When the method IMPORTING_REQUIRED is called with parameter 5555
" Then it should return 97
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
test_double->importing_required( 5555 ).
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD importing_required_good2.
" GOOD EXAMPLE
" When the method IMPORTING_REQUIRED is called with any parameter value
" Then it should return 97
" (note: this test method is the duplicate of IGNORE_PARAMETER_GOOD)
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'WHATEVER' )->returning( 97 ).
test_double->importing_required( whatever = 5554 ). " any value, it's ignored
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD importing_optional_bad.
" BAD EXAMPLE
" When the method IMPORTING_OPTIONAL is called with the optional parameter equal to any value,
" Then it should return 97
" But it returns 0 !
" That doesn't work because you should use the method IGNORE_PARAMETER to indicate "any value".
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
test_double->importing_optional( ).
result = cut->zif_atd_demo~importing_optional( 5555 ).
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD importing_optional_good.
" GOOD EXAMPLE
" When the method IMPORTING_OPTIONAL is called with the optional parameter equal to any value,
" Then it should return 97
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'WHATEVER' )->returning( 97 ).
test_double->importing_optional( ).
result = cut->zif_atd_demo~importing_optional( whatever = 5555 ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD importing_optional_good2.
" GOOD EXAMPLE
" When the method IMPORTING_OPTIONAL is called without the optional parameter
" Then it should return 97
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
test_double->importing_optional( ).
result = cut->zif_atd_demo~importing_optional( ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD importing_optional_good3.
" GOOD EXAMPLE
" When the method IMPORTING_OPTIONAL is called with the optional parameter 5555
" Then it should return 97
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
test_double->importing_optional( 5555 ).
result = cut->zif_atd_demo~importing_optional( 5555 ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD changing_good.
" GOOD EXAMPLE
" When the method CHANGING is called with the changing parameter equal to 0
" Then it should be changed to 40
"
" When the method CHANGING is called with the changing parameter equal to 50
" Then it should be changed to 110
DATA: whatever TYPE i.
cl_abap_testdouble=>configure_call( test_double
)->set_parameter( name = 'WHATEVER' value = 40 ).
whatever = 0.
test_double->changing( CHANGING whatever = whatever ).
cl_abap_testdouble=>configure_call( test_double
)->set_parameter( name = 'WHATEVER' value = 110 ).
whatever = 50.
test_double->changing( CHANGING whatever = whatever ).
whatever = 0.
cut->zif_atd_demo~changing( CHANGING whatever = whatever ).
whatever = whatever + 10.
cut->zif_atd_demo~changing( CHANGING whatever = whatever ).
assert_equals( exp = 110 act = whatever ).
ENDMETHOD.
METHOD ignore_parameter_bad.
" BAD EXAMPLE
" When the method IMPORTING_REQUIRED is called with any parameter value
" Then it should return 97
" But it returns 0 !
" Solution: you missed the second part of the call configuration!
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'WHATEVER' )->returning( 97 ).
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD ignore_parameter_good.
" GOOD EXAMPLE
" When the method IMPORTING_REQUIRED is called with any parameter value
" Then it should return 97
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'WHATEVER' )->returning( 97 ).
test_double->importing_required( 1234 ). " <=== important call & dummy value !
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD ignore_all_parameters_bad.
" BAD EXAMPLE
" When the method IMPORTING_REQUIRED is called with any parameter value
" Then it should return 97
" But it returns 0 !
" Solution: you missed the second part of the call configuration!
cl_abap_testdouble=>configure_call( test_double
)->ignore_all_parameters( )->returning( 97 ).
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD ignore_all_parameters_good.
" GOOD EXAMPLE
" When the method IMPORTING_REQUIRED is called with any parameter value
" Then it should return 97
cl_abap_testdouble=>configure_call( test_double
)->ignore_all_parameters( )->returning( 97 ).
test_double->importing_required( 5554 ). " (dummy value)
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 97 act = result ).
ENDMETHOD.
METHOD two_methods_bad.
" BAD EXAMPLE
" When the method IMPORTING_REQUIRED is called with any parameter value
" Then it should return 97
"
" When the method DEMO_RETURNING is called
" Then it should return 99
" But it returns 0 !
" Solution: you missed the first part of the call configuration! (to set 99)
cl_abap_testdouble=>configure_call( test_double
)->ignore_all_parameters( )->returning( 97 ).
test_double->importing_required( 17 ). " (dummy value)
test_double->demo_returning( ).
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 97 act = result ).
result = test_double->demo_returning( ).
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD two_methods_good.
" GOOD EXAMPLE
" When the method IMPORTING_REQUIRED is called with any parameter value
" Then it should return 97
"
" When the method DEMO_RETURNING is called
" Then it should return 99
cl_abap_testdouble=>configure_call( test_double
)->ignore_all_parameters( )->returning( 97 ).
test_double->importing_required( 17 ). " (dummy value)
cl_abap_testdouble=>configure_call( test_double )->returning( 99 ).
test_double->demo_returning( ).
result = cut->zif_atd_demo~importing_required( 5555 ).
assert_equals( exp = 97 act = result ).
result = test_double->demo_returning( ).
assert_equals( exp = 99 act = result ).
ENDMETHOD.
METHOD several_cases_good.
" GOOD EXAMPLE
" When the method SEVERAL_CASES is called with value 27
" Then it should return 40
"
" When the method SEVERAL_CASES is called with value 29
" Then it should return 70
cl_abap_testdouble=>configure_call( test_double )->returning( 40 ).
test_double->several_cases( 27 ).
cl_abap_testdouble=>configure_call( test_double )->returning( 70 ).
test_double->several_cases( 29 ).
result = cut->zif_atd_demo~several_cases( 27 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~several_cases( 29 ).
assert_equals( exp = 70 act = result ).
result = cut->zif_atd_demo~several_cases( 27 ).
assert_equals( exp = 40 act = result ).
ENDMETHOD.
METHOD decision_table_good.
" case which returns 10
cl_abap_testdouble=>configure_call( test_double
)->returning( 10 )->times( 999999999 ).
test_double->decision_table( p1 = 5 p2 = 5 ).
" case which returns 20
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'P1' )->returning( 20 )->times( 999999999 ).
test_double->decision_table( p1 = 0 p2 = 5 ).
" case which returns 30
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'P2' )->returning( 30 )->times( 999999999 ).
test_double->decision_table( p1 = 5 p2 = 0 ).
" case which returns 40
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'P1' )->ignore_parameter( 'P2'
)->returning( 40 )->times( 999999999 ).
test_double->decision_table( p1 = 0 p2 = 0 ).
" When there's only one matching case
" Then the result is trivial
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 66 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 66 ).
assert_equals( exp = 40 act = result ).
" Scenario Outline
" When there are several matching cases
" Then all of them are returned in turn
" Examples :
" 1) The possible cases are 30 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 30 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 30 act = result ).
" 2) The possible cases are 20 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 20 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 20 act = result ).
" 3) The possible cases are 10, 20, 30 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 10 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 10 act = result ).
ENDMETHOD.
METHOD decision_table_bad.
decision_table_init_bad( ).
" When there's only one matching case
" Then the result is trivial
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 66 ).
assert_equals( exp = 40 act = result ).
" Scenario Outline
" When there are several matching cases
" Then all of them are returned in turn
" Examples :
" 1) The possible cases are 30 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 30 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 40 act = result ).
ENDMETHOD.
METHOD decision_table_bad2.
decision_table_init_bad( ).
" Scenario Outline
" When there are several matching cases
" Then all of them are returned in turn
" Examples :
" 2) The possible cases are 20 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 20 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 40 act = result ).
ENDMETHOD.
METHOD decision_table_bad3.
decision_table_init_bad( ).
" Scenario Outline
" When there are several matching cases
" Then all of them are returned in turn
" Examples :
" 3) The possible cases are 10, 20, 30 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 10 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 20 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 30 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 40 act = result ).
ENDMETHOD.
METHOD decision_table_bad4.
decision_table_init_bad( ).
" Scenario Outline
" When there are several matching cases
" Then all of them are returned in turn
" Examples :
" 1) The possible cases are 30 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 30 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 66 ).
assert_equals( exp = 40 act = result ).
" 2) The possible cases are 20 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 20 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 66 p2 = 5 ).
assert_equals( exp = 40 act = result ).
" 3) The possible cases are 10, 20, 30 and 40:
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 10 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 40 act = result ).
result = cut->zif_atd_demo~decision_table( p1 = 5 p2 = 5 ).
assert_equals( exp = 40 act = result ).
ENDMETHOD.
METHOD decision_table_init_bad.
" case which returns 10
cl_abap_testdouble=>configure_call( test_double
)->returning( 10 ).
test_double->decision_table( p1 = 5 p2 = 5 ).
" case which returns 20
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'P1' )->returning( 20 ).
test_double->decision_table( p1 = 0 p2 = 5 ).
" case which returns 30
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'P2' )->returning( 30 ).
test_double->decision_table( p1 = 5 p2 = 0 ).
" case which returns 40
cl_abap_testdouble=>configure_call( test_double
)->ignore_parameter( 'P1' )->ignore_parameter( 'P2' )->returning( 40 ).
test_double->decision_table( p1 = 0 p2 = 0 ).
ENDMETHOD.
METHOD order_of_calls_bad.
" Wrong call order: those 2 next lines should be switched
test_double->demo_returning( ).
cl_abap_testdouble=>configure_call( test_double )->returning( 97 ).
result = cut->zif_atd_demo~demo_returning( ).
" The result is 0 instead of 97 because of the wrong call order
assert_equals( exp = 0 act = result ).
ENDMETHOD.
METHOD order_of_calls_bad2.
DATA lx2 TYPE REF TO cx_atd_exception.
DATA(callconfig) = cl_abap_testdouble=>configure_call( test_double ).
test_double->demo_returning( ).
TRY.
callconfig->returning( 97 ).
result = cut->zif_atd_demo~demo_returning( ).
CATCH cx_atd_exception INTO lx2.
ENDTRY.
assert_bound( lx2 ).
assert_equals( exp = cx_atd_exception=>invalid_call
act = lx2->if_t100_message~t100key ).
ENDMETHOD.
METHOD raise_event_good.
SET HANDLER on_action_done FOR test_double.
cl_abap_testdouble=>configure_call( test_double
)->raise_event( name = 'ACTION_DONE'
parameters = VALUE #( ( name = 'PARAM_NAME' value = REF i( 20 ) ) )
)->raise_event( name = 'ACTION_DONE'
parameters = VALUE #( ( name = 'PARAM_NAME' value = REF i( 50 ) ) ) ).
" the 2 events should be triggered when the method RAISE_EVENT is called
test_double->demo_raise_event( ).
cut->zif_atd_demo~demo_raise_event( ).
assert_equals( exp = 70 act = event_param_value ).
ENDMETHOD.
METHOD on_action_done.
" This method is used for testing the method RAISE_EVENT.
event_param_value = event_param_value + param_name.
ENDMETHOD.
ENDCLASS.
CLASS ltc_atd_max_test_doubles IMPLEMENTATION.
METHOD max_test_doubles.
DATA: test_double TYPE REF TO object,
lx TYPE REF TO cx_sy_generate_subpool_full.
SELECT
seoclass~clsname AS name
FROM seoclass
INNER JOIN repoload
ON concat( rpad( seoclass~clsname, 30, '=' ), 'IP' ) = repoload~progname
WHERE seoclass~clstype = '1'
AND seoclass~clsname LIKE 'IF_%'
AND ( repoload~udat > repoload~sdat OR
( repoload~udat = repoload~sdat AND repoload~utime >= repoload~stime ) )
INTO TABLE @DATA(interfaces)
UP TO 37 ROWS.
ASSERT lines( interfaces ) = 37.
LOOP AT interfaces FROM 1 TO 36 ASSIGNING FIELD-SYMBOL(<interface>).
test_double ?= cl_abap_testdouble=>create( <interface>-name ).
ENDLOOP.
TRY.
" 37th GENERATE SUBROUTINE POOL
test_double ?= cl_abap_testdouble=>create( interfaces[ 37 ]-name ).
CATCH cx_sy_generate_subpool_full INTO lx.
ENDTRY.
assert_bound( lx ).
assert_equals( exp = 'GENERATE_SUBPOOL_DIR_FULL' act = lx->kernel_errid ).
ENDMETHOD.
ENDCLASS.
| 36.098083 | 130 | 0.684625 |
c4596d0b73bccf50ffff1ef1059f32223e6b5182
| 499 |
abap
|
ABAP
|
src/foundation/y_if_testcode_detector.intf.abap
|
thomham/code-pal-for-abap
|
c58c4333f236a17937335871d9261b0897209399
|
[
"Apache-2.0"
] | 202 |
2020-05-05T13:41:12.000Z
|
2022-03-26T15:18:13.000Z
|
src/foundation/y_if_testcode_detector.intf.abap
|
thomham/code-pal-for-abap
|
c58c4333f236a17937335871d9261b0897209399
|
[
"Apache-2.0"
] | 322 |
2020-05-05T19:14:35.000Z
|
2022-03-22T14:48:44.000Z
|
src/foundation/y_if_testcode_detector.intf.abap
|
lucasborin/code-pal-for-abap
|
4e1247693457e7687648806b18b63cb8968f927a
|
[
"Apache-2.0"
] | 59 |
2020-05-05T18:59:19.000Z
|
2022-03-20T11:24:48.000Z
|
INTERFACE y_if_testcode_detector
PUBLIC .
TYPES:
BEGIN OF t_test_code,
class TYPE seoclsname,
method TYPE seocmpname,
END OF t_test_code .
TYPES:
t_test_codes TYPE STANDARD TABLE OF t_test_code WITH DEFAULT KEY .
METHODS clear .
METHODS is_testcode
IMPORTING
!structure TYPE sstruc
RETURNING
VALUE(result) TYPE abap_bool .
METHODS set_ref_scan_manager
IMPORTING
!ref_scan_manager TYPE REF TO y_if_scan_manager .
ENDINTERFACE.
| 21.695652 | 70 | 0.715431 |
c45a066d27f8942117d4657588102ea716b49cd1
| 217 |
abap
|
ABAP
|
src/zcx_bw_trfn_tester.clas.abap
|
greg2git/bw_trfn_tester
|
1c38256432e02515dda7ff5ff7362735f6ae5c60
|
[
"MIT"
] | null | null | null |
src/zcx_bw_trfn_tester.clas.abap
|
greg2git/bw_trfn_tester
|
1c38256432e02515dda7ff5ff7362735f6ae5c60
|
[
"MIT"
] | null | null | null |
src/zcx_bw_trfn_tester.clas.abap
|
greg2git/bw_trfn_tester
|
1c38256432e02515dda7ff5ff7362735f6ae5c60
|
[
"MIT"
] | 1 |
2021-04-12T12:40:10.000Z
|
2021-04-12T12:40:10.000Z
|
CLASS zcx_bw_trfn_tester DEFINITION
INHERITING FROM cx_static_check
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcx_bw_trfn_tester IMPLEMENTATION.
ENDCLASS.
| 15.5 | 40 | 0.81106 |
c45b1ed7cb50f0459bc3f13786f13050e0e5a9a1
| 385 |
abap
|
ABAP
|
src/zmonsters_p02_transactional/zmonsters_c12_ui5/zcl_d_cds_segw_monster_items_a.clas.abap
|
hardyp/AbapToTheFuture03
|
5de922d589237142288c099d92655f9811eee4fa
|
[
"MIT"
] | 30 |
2019-03-03T03:33:55.000Z
|
2022-03-11T01:12:55.000Z
|
src/zmonsters_p02_transactional/zmonsters_c12_ui5/zcl_d_cds_segw_monster_items_a.clas.abap
|
hardyp/AbapToTheFuture03
|
5de922d589237142288c099d92655f9811eee4fa
|
[
"MIT"
] | 19 |
2019-02-24T10:58:17.000Z
|
2020-04-05T08:29:55.000Z
|
src/zmonsters_p02_transactional/zmonsters_c12_ui5/zcl_d_cds_segw_monster_items_a.clas.abap
|
hardyp/AbapToTheFuture03
|
5de922d589237142288c099d92655f9811eee4fa
|
[
"MIT"
] | 17 |
2019-02-28T06:59:06.000Z
|
2022-01-12T23:54:57.000Z
|
class ZCL_D_CDS_SEGW_MONSTER_ITEMS_A definition
public
inheriting from /BOBF/CL_LIB_D_SUPERCL_SIMPLE
final
create public .
public section.
methods /BOBF/IF_FRW_DETERMINATION~EXECUTE
redefinition .
protected section.
private section.
ENDCLASS.
CLASS ZCL_D_CDS_SEGW_MONSTER_ITEMS_A IMPLEMENTATION.
method /BOBF/IF_FRW_DETERMINATION~EXECUTE.
endmethod.
ENDCLASS.
| 16.73913 | 52 | 0.812987 |
c45b3a51ce5d2fb3ece1f2d448cf64dace902086
| 209,234 |
abap
|
ABAP
|
src/zcl_excel_worksheet.clas.abap
|
becknwj/beck_abap2xlsx
|
0a3beaf7f850f0d654a8b5857fa1ed84543e9d10
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_excel_worksheet.clas.abap
|
becknwj/beck_abap2xlsx
|
0a3beaf7f850f0d654a8b5857fa1ed84543e9d10
|
[
"Apache-2.0"
] | null | null | null |
src/zcl_excel_worksheet.clas.abap
|
becknwj/beck_abap2xlsx
|
0a3beaf7f850f0d654a8b5857fa1ed84543e9d10
|
[
"Apache-2.0"
] | null | null | null |
*----------------------------------------------------------------------*
* CLASS ZCL_EXCEL_WORKSHEET DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_excel_worksheet DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
*"* public components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
*"* protected components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
*"* protected components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
TYPE-POOLS abap .
TYPE-POOLS slis .
TYPE-POOLS soi .
INTERFACES zif_excel_sheet_printsettings .
INTERFACES zif_excel_sheet_properties .
INTERFACES zif_excel_sheet_protection .
INTERFACES zif_excel_sheet_vba_project .
TYPES:
BEGIN OF mty_s_outline_row,
row_from TYPE i,
row_to TYPE i,
collapsed TYPE abap_bool,
END OF mty_s_outline_row .
TYPES:
mty_ts_outlines_row TYPE SORTED TABLE OF mty_s_outline_row WITH UNIQUE KEY row_from row_to .
CONSTANTS c_break_column TYPE zexcel_break VALUE 2. "#EC NOTEXT
CONSTANTS c_break_none TYPE zexcel_break VALUE 0. "#EC NOTEXT
CONSTANTS c_break_row TYPE zexcel_break VALUE 1. "#EC NOTEXT
DATA excel TYPE REF TO zcl_excel READ-ONLY .
DATA print_gridlines TYPE zexcel_print_gridlines READ-ONLY VALUE abap_false. "#EC NOTEXT
DATA sheet_content TYPE zexcel_t_cell_data .
DATA sheet_setup TYPE REF TO zcl_excel_sheet_setup .
DATA show_gridlines TYPE zexcel_show_gridlines READ-ONLY VALUE abap_true. "#EC NOTEXT
DATA show_rowcolheaders TYPE zexcel_show_gridlines READ-ONLY VALUE abap_true. "#EC NOTEXT
DATA styles TYPE zexcel_t_sheet_style .
DATA tabcolor TYPE zexcel_s_tabcolor READ-ONLY .
METHODS add_comment
IMPORTING
!ip_comment TYPE REF TO zcl_excel_comment .
METHODS add_drawing
IMPORTING
!ip_drawing TYPE REF TO zcl_excel_drawing .
METHODS add_new_column
IMPORTING
!ip_column TYPE simple
RETURNING
VALUE(eo_column) TYPE REF TO zcl_excel_column .
METHODS add_new_style_cond
IMPORTING
!ip_dimension_range TYPE string DEFAULT 'A1'
RETURNING
VALUE(eo_style_cond) TYPE REF TO zcl_excel_style_cond.
METHODS add_new_data_validation
RETURNING
VALUE(eo_data_validation) TYPE REF TO zcl_excel_data_validation .
METHODS add_new_range
RETURNING
VALUE(eo_range) TYPE REF TO zcl_excel_range .
METHODS add_new_row
IMPORTING
!ip_row TYPE simple
RETURNING
VALUE(eo_row) TYPE REF TO zcl_excel_row .
METHODS bind_alv
IMPORTING
!io_alv TYPE REF TO object
!it_table TYPE STANDARD TABLE
!i_top TYPE i DEFAULT 1
!i_left TYPE i DEFAULT 1
!table_style TYPE zexcel_table_style OPTIONAL
!i_table TYPE abap_bool DEFAULT abap_true
RAISING
zcx_excel .
METHODS bind_alv_ole2
IMPORTING
!i_document_url TYPE char255 DEFAULT space
!i_xls TYPE c DEFAULT space
!i_save_path TYPE string
!io_alv TYPE REF TO cl_gui_alv_grid
!it_listheader TYPE slis_t_listheader OPTIONAL
!i_top TYPE i DEFAULT 1
!i_left TYPE i DEFAULT 1
!i_columns_header TYPE c DEFAULT 'X'
!i_columns_autofit TYPE c DEFAULT 'X'
!i_format_col_header TYPE soi_format_item OPTIONAL
!i_format_subtotal TYPE soi_format_item OPTIONAL
!i_format_total TYPE soi_format_item OPTIONAL
EXCEPTIONS
miss_guide
ex_transfer_kkblo_error
fatal_error
inv_data_range
dim_mismatch_vkey
dim_mismatch_sema
error_in_sema .
METHODS bind_table
IMPORTING
!ip_table TYPE STANDARD TABLE
!it_field_catalog TYPE zexcel_t_fieldcatalog OPTIONAL
!is_table_settings TYPE zexcel_s_table_settings OPTIONAL
VALUE(iv_default_descr) TYPE c OPTIONAL
!iv_no_line_if_empty TYPE abap_bool DEFAULT abap_false
EXPORTING
!es_table_settings TYPE zexcel_s_table_settings
RAISING
zcx_excel .
METHODS calculate_column_widths
RAISING
zcx_excel .
METHODS change_cell_style
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_complete TYPE zexcel_s_cstyle_complete OPTIONAL
!ip_xcomplete TYPE zexcel_s_cstylex_complete OPTIONAL
!ip_font TYPE zexcel_s_cstyle_font OPTIONAL
!ip_xfont TYPE zexcel_s_cstylex_font OPTIONAL
!ip_fill TYPE zexcel_s_cstyle_fill OPTIONAL
!ip_xfill TYPE zexcel_s_cstylex_fill OPTIONAL
!ip_borders TYPE zexcel_s_cstyle_borders OPTIONAL
!ip_xborders TYPE zexcel_s_cstylex_borders OPTIONAL
!ip_alignment TYPE zexcel_s_cstyle_alignment OPTIONAL
!ip_xalignment TYPE zexcel_s_cstylex_alignment OPTIONAL
!ip_number_format_format_code TYPE zexcel_number_format OPTIONAL
!ip_protection TYPE zexcel_s_cstyle_protection OPTIONAL
!ip_xprotection TYPE zexcel_s_cstylex_protection OPTIONAL
!ip_font_bold TYPE flag OPTIONAL
!ip_font_color TYPE zexcel_s_style_color OPTIONAL
!ip_font_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_font_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_font_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_font_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_font_family TYPE zexcel_style_font_family OPTIONAL
!ip_font_italic TYPE flag OPTIONAL
!ip_font_name TYPE zexcel_style_font_name OPTIONAL
!ip_font_scheme TYPE zexcel_style_font_scheme OPTIONAL
!ip_font_size TYPE zexcel_style_font_size OPTIONAL
!ip_font_strikethrough TYPE flag OPTIONAL
!ip_font_underline TYPE flag OPTIONAL
!ip_font_underline_mode TYPE zexcel_style_font_underline OPTIONAL
!ip_fill_filltype TYPE zexcel_fill_type OPTIONAL
!ip_fill_rotation TYPE zexcel_rotation OPTIONAL
!ip_fill_fgcolor TYPE zexcel_s_style_color OPTIONAL
!ip_fill_fgcolor_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_fill_fgcolor_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_fill_fgcolor_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_fill_fgcolor_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_fill_bgcolor TYPE zexcel_s_style_color OPTIONAL
!ip_fill_bgcolor_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_fill_bgcolor_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_fill_bgcolor_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_fill_bgcolor_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_allborders TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_type TYPE zexcel_s_gradient_type-type OPTIONAL
!ip_fill_gradtype_degree TYPE zexcel_s_gradient_type-degree OPTIONAL
!ip_xborders_allborders TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_diagonal TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_bottom TYPE zexcel_s_gradient_type-bottom OPTIONAL
!ip_fill_gradtype_top TYPE zexcel_s_gradient_type-top OPTIONAL
!ip_xborders_diagonal TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_diagonal_mode TYPE zexcel_diagonal OPTIONAL
!ip_fill_gradtype_right TYPE zexcel_s_gradient_type-right OPTIONAL
!ip_borders_down TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_left TYPE zexcel_s_gradient_type-left OPTIONAL
!ip_fill_gradtype_position1 TYPE zexcel_s_gradient_type-position1 OPTIONAL
!ip_xborders_down TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_left TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_position2 TYPE zexcel_s_gradient_type-position2 OPTIONAL
!ip_fill_gradtype_position3 TYPE zexcel_s_gradient_type-position3 OPTIONAL
!ip_xborders_left TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_right TYPE zexcel_s_cstyle_border OPTIONAL
!ip_xborders_right TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_top TYPE zexcel_s_cstyle_border OPTIONAL
!ip_xborders_top TYPE zexcel_s_cstylex_border OPTIONAL
!ip_alignment_horizontal TYPE zexcel_alignment OPTIONAL
!ip_alignment_vertical TYPE zexcel_alignment OPTIONAL
!ip_alignment_textrotation TYPE zexcel_text_rotation OPTIONAL
!ip_alignment_wraptext TYPE flag OPTIONAL
!ip_alignment_shrinktofit TYPE flag OPTIONAL
!ip_alignment_indent TYPE zexcel_indent OPTIONAL
!ip_protection_hidden TYPE zexcel_cell_protection OPTIONAL
!ip_protection_locked TYPE zexcel_cell_protection OPTIONAL
!ip_borders_allborders_style TYPE zexcel_border OPTIONAL
!ip_borders_allborders_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_allbo_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_allbo_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_allbo_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_allbo_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_diagonal_style TYPE zexcel_border OPTIONAL
!ip_borders_diagonal_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_diagonal_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_diagonal_color_inde TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_diagonal_color_them TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_diagonal_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_down_style TYPE zexcel_border OPTIONAL
!ip_borders_down_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_down_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_down_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_down_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_down_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_left_style TYPE zexcel_border OPTIONAL
!ip_borders_left_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_left_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_left_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_left_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_left_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_right_style TYPE zexcel_border OPTIONAL
!ip_borders_right_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_right_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_right_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_right_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_right_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_top_style TYPE zexcel_border OPTIONAL
!ip_borders_top_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_top_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_top_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_top_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_top_color_tint TYPE zexcel_style_color_tint OPTIONAL
RETURNING
VALUE(ep_guid) TYPE zexcel_cell_style
RAISING
zcx_excel .
METHODS constructor
IMPORTING
!ip_excel TYPE REF TO zcl_excel
!ip_title TYPE zexcel_sheet_title OPTIONAL
RAISING
zcx_excel .
METHODS delete_merge
IMPORTING
!ip_cell_column TYPE simple OPTIONAL
!ip_cell_row TYPE zexcel_cell_row OPTIONAL
RAISING
zcx_excel .
METHODS delete_row_outline
IMPORTING
!iv_row_from TYPE i
!iv_row_to TYPE i
RAISING
zcx_excel .
METHODS freeze_panes
IMPORTING
!ip_num_columns TYPE i OPTIONAL
!ip_num_rows TYPE i OPTIONAL
RAISING
zcx_excel .
METHODS get_active_cell
RETURNING
VALUE(ep_active_cell) TYPE string
RAISING
zcx_excel .
METHODS get_cell
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
EXPORTING
!ep_value TYPE zexcel_cell_value
!ep_rc TYPE sysubrc
!ep_style TYPE REF TO zcl_excel_style
!ep_guid TYPE zexcel_cell_style
!ep_formula TYPE zexcel_cell_formula
RAISING
zcx_excel .
METHODS get_column
IMPORTING
!ip_column TYPE simple
RETURNING
VALUE(eo_column) TYPE REF TO zcl_excel_column .
METHODS get_columns
RETURNING
VALUE(eo_columns) TYPE REF TO zcl_excel_columns .
METHODS get_columns_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_style_cond_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_data_validations_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_data_validations_size
RETURNING
VALUE(ep_size) TYPE i .
METHODS get_default_column
RETURNING
VALUE(eo_column) TYPE REF TO zcl_excel_column .
METHODS get_default_excel_date_format
RETURNING
VALUE(ep_default_excel_date_format) TYPE zexcel_number_format .
METHODS get_default_excel_time_format
RETURNING
VALUE(ep_default_excel_time_format) TYPE zexcel_number_format .
METHODS get_default_row
RETURNING
VALUE(eo_row) TYPE REF TO zcl_excel_row .
METHODS get_dimension_range
RETURNING
VALUE(ep_dimension_range) TYPE string
RAISING
zcx_excel .
METHODS get_comments
RETURNING
VALUE(r_comments) TYPE REF TO zcl_excel_comments .
METHODS get_drawings
IMPORTING
!ip_type TYPE zexcel_drawing_type OPTIONAL
RETURNING
VALUE(r_drawings) TYPE REF TO zcl_excel_drawings .
METHODS get_comments_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_drawings_iterator
IMPORTING
!ip_type TYPE zexcel_drawing_type
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_freeze_cell
EXPORTING
!ep_row TYPE zexcel_cell_row
!ep_column TYPE zexcel_cell_column .
METHODS get_guid
RETURNING
VALUE(ep_guid) TYPE sysuuid_x16 .
METHODS get_highest_column
RETURNING
VALUE(r_highest_column) TYPE zexcel_cell_column
RAISING
zcx_excel .
METHODS get_highest_row
RETURNING
VALUE(r_highest_row) TYPE int4
RAISING
zcx_excel .
METHODS get_hyperlinks_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_hyperlinks_size
RETURNING
VALUE(ep_size) TYPE i .
METHODS get_merge
RETURNING
VALUE(merge_range) TYPE string_table
RAISING
zcx_excel .
METHODS get_pagebreaks
RETURNING
VALUE(ro_pagebreaks) TYPE REF TO zcl_excel_worksheet_pagebreaks
RAISING
zcx_excel .
METHODS get_ranges_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_row
IMPORTING
!ip_row TYPE int4
RETURNING
VALUE(eo_row) TYPE REF TO zcl_excel_row .
METHODS get_rows
RETURNING
VALUE(eo_rows) TYPE REF TO zcl_excel_rows .
METHODS get_rows_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_row_outlines
RETURNING
VALUE(rt_row_outlines) TYPE mty_ts_outlines_row .
METHODS get_style_cond
IMPORTING
!ip_guid TYPE zexcel_cell_style
RETURNING
VALUE(eo_style_cond) TYPE REF TO zcl_excel_style_cond .
METHODS get_tabcolor
RETURNING
VALUE(ev_tabcolor) TYPE zexcel_s_tabcolor .
METHODS get_tables_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_tables_size
RETURNING
VALUE(ep_size) TYPE i .
METHODS get_title
IMPORTING
!ip_escaped TYPE flag DEFAULT ''
RETURNING
VALUE(ep_title) TYPE zexcel_sheet_title .
METHODS is_cell_merged
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
RETURNING
VALUE(rp_is_merged) TYPE abap_bool
RAISING
zcx_excel .
METHODS set_cell
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_value TYPE simple OPTIONAL
!ip_formula TYPE zexcel_cell_formula OPTIONAL
!ip_style TYPE zexcel_cell_style OPTIONAL
!ip_hyperlink TYPE REF TO zcl_excel_hyperlink OPTIONAL
!ip_data_type TYPE zexcel_cell_data_type OPTIONAL
!ip_abap_type TYPE abap_typekind OPTIONAL
RAISING
zcx_excel .
METHODS set_cell_formula
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_formula TYPE zexcel_cell_formula
RAISING
zcx_excel .
METHODS set_cell_style
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_style TYPE zexcel_cell_style
RAISING
zcx_excel .
METHODS set_column_width
IMPORTING
!ip_column TYPE simple
!ip_width_fix TYPE simple DEFAULT 0
!ip_width_autosize TYPE flag DEFAULT 'X'
RAISING
zcx_excel .
METHODS set_default_excel_date_format
IMPORTING
!ip_default_excel_date_format TYPE zexcel_number_format
RAISING
zcx_excel .
METHODS set_merge
IMPORTING
!ip_column_start TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_min_col
!ip_column_end TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_max_col
!ip_row TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_min_row
!ip_row_to TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_max_row
!ip_style TYPE zexcel_cell_style OPTIONAL "added parameter
!ip_value TYPE simple OPTIONAL "added parameter
!ip_formula TYPE zexcel_cell_formula OPTIONAL "added parameter
RAISING
zcx_excel .
METHODS set_print_gridlines
IMPORTING
!i_print_gridlines TYPE zexcel_print_gridlines .
METHODS set_row_height
IMPORTING
!ip_row TYPE simple
!ip_height_fix TYPE simple
RAISING
zcx_excel .
METHODS set_row_outline
IMPORTING
!iv_row_from TYPE i
!iv_row_to TYPE i
!iv_collapsed TYPE abap_bool
RAISING
zcx_excel .
METHODS set_show_gridlines
IMPORTING
!i_show_gridlines TYPE zexcel_show_gridlines .
METHODS set_show_rowcolheaders
IMPORTING
!i_show_rowcolheaders TYPE zexcel_show_rowcolheader .
METHODS set_tabcolor
IMPORTING
!iv_tabcolor TYPE zexcel_s_tabcolor .
METHODS set_table
IMPORTING
!ip_table TYPE STANDARD TABLE
!ip_hdr_style TYPE zexcel_cell_style OPTIONAL
!ip_body_style TYPE zexcel_cell_style OPTIONAL
!ip_table_title TYPE string
!ip_top_left_column TYPE zexcel_cell_column_alpha DEFAULT 'B'
!ip_top_left_row TYPE zexcel_cell_row DEFAULT 3
!ip_transpose TYPE abap_bool OPTIONAL
!ip_no_header TYPE abap_bool OPTIONAL
RAISING
zcx_excel .
METHODS set_title
IMPORTING
!ip_title TYPE zexcel_sheet_title
RAISING
zcx_excel .
METHODS get_table
IMPORTING
!iv_skipped_rows TYPE int4 DEFAULT 0
!iv_skipped_cols TYPE int4 DEFAULT 0
!iv_max_col TYPE int4 OPTIONAL
!iv_max_row TYPE int4 OPTIONAL
EXPORTING
!et_table TYPE STANDARD TABLE
RAISING
zcx_excel .
METHODS set_merge_style
IMPORTING
!ip_column_start TYPE simple OPTIONAL
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row OPTIONAL
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_style TYPE zexcel_cell_style OPTIONAL .
METHODS set_area_formula
IMPORTING
!ip_column_start TYPE simple
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_formula TYPE zexcel_cell_formula
!ip_merge TYPE abap_bool OPTIONAL
RAISING
zcx_excel .
METHODS set_area_style
IMPORTING
!ip_column_start TYPE simple
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_style TYPE zexcel_cell_style
!ip_merge TYPE abap_bool OPTIONAL .
METHODS set_area
IMPORTING
!ip_column_start TYPE simple
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_value TYPE simple OPTIONAL
!ip_formula TYPE zexcel_cell_formula OPTIONAL
!ip_style TYPE zexcel_cell_style OPTIONAL
!ip_hyperlink TYPE REF TO zcl_excel_hyperlink OPTIONAL
!ip_data_type TYPE zexcel_cell_data_type OPTIONAL
!ip_abap_type TYPE abap_typekind OPTIONAL
!ip_merge TYPE abap_bool OPTIONAL
RAISING
zcx_excel .
METHODS get_header_footer_drawings
RETURNING
VALUE(rt_drawings) TYPE zexcel_t_drawings .
METHODS set_area_hyperlink
IMPORTING
!ip_column_start TYPE simple
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_url TYPE string
!ip_is_internal TYPE abap_bool
RAISING
zcx_excel .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF mty_s_font_metric,
char TYPE c LENGTH 1,
char_width TYPE tdcwidths,
END OF mty_s_font_metric .
TYPES:
mty_th_font_metrics
TYPE HASHED TABLE OF mty_s_font_metric
WITH UNIQUE KEY char .
TYPES:
BEGIN OF mty_s_font_cache,
font_name TYPE zexcel_style_font_name,
font_height TYPE tdfontsize,
flag_bold TYPE abap_bool,
flag_italic TYPE abap_bool,
th_font_metrics TYPE mty_th_font_metrics,
END OF mty_s_font_cache .
TYPES:
mty_th_font_cache
TYPE HASHED TABLE OF mty_s_font_cache
WITH UNIQUE KEY font_name font_height flag_bold flag_italic .
TYPES:
* types:
* mty_ts_row_dimension TYPE SORTED TABLE OF zexcel_s_worksheet_rowdimensio WITH UNIQUE KEY row .
BEGIN OF mty_merge,
row_from TYPE i,
row_to TYPE i,
col_from TYPE i,
col_to TYPE i,
END OF mty_merge .
TYPES:
mty_ts_merge TYPE SORTED TABLE OF mty_merge WITH UNIQUE KEY table_line .
*"* private components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
DATA active_cell TYPE zexcel_s_cell_data .
DATA charts TYPE REF TO zcl_excel_drawings .
DATA columns TYPE REF TO zcl_excel_columns .
DATA row_default TYPE REF TO zcl_excel_row .
DATA column_default TYPE REF TO zcl_excel_column .
DATA styles_cond TYPE REF TO zcl_excel_styles_cond .
DATA data_validations TYPE REF TO zcl_excel_data_validations .
DATA default_excel_date_format TYPE zexcel_number_format .
DATA default_excel_time_format TYPE zexcel_number_format .
DATA comments TYPE REF TO zcl_excel_comments .
DATA drawings TYPE REF TO zcl_excel_drawings .
DATA freeze_pane_cell_column TYPE zexcel_cell_column .
DATA freeze_pane_cell_row TYPE zexcel_cell_row .
DATA guid TYPE sysuuid_x16 .
DATA hyperlinks TYPE REF TO cl_object_collection .
DATA lower_cell TYPE zexcel_s_cell_data .
DATA mo_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks .
CLASS-DATA mth_font_cache TYPE mty_th_font_cache .
DATA mt_merged_cells TYPE mty_ts_merge .
DATA mt_row_outlines TYPE mty_ts_outlines_row .
DATA print_title_col_from TYPE zexcel_cell_column_alpha .
DATA print_title_col_to TYPE zexcel_cell_column_alpha .
DATA print_title_row_from TYPE zexcel_cell_row .
DATA print_title_row_to TYPE zexcel_cell_row .
DATA ranges TYPE REF TO zcl_excel_ranges .
DATA rows TYPE REF TO zcl_excel_rows .
DATA tables TYPE REF TO cl_object_collection .
DATA title TYPE zexcel_sheet_title VALUE 'Worksheet'. "#EC NOTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . " .
DATA upper_cell TYPE zexcel_s_cell_data .
METHODS calculate_cell_width
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
RETURNING
VALUE(ep_width) TYPE float
RAISING
zcx_excel .
METHODS generate_title
RETURNING
VALUE(ep_title) TYPE zexcel_sheet_title .
METHODS get_value_type
IMPORTING
!ip_value TYPE simple
EXPORTING
!ep_value TYPE simple
!ep_value_type TYPE abap_typekind .
METHODS print_title_set_range .
METHODS update_dimension_range
RAISING
zcx_excel .
ENDCLASS.
CLASS zcl_excel_worksheet IMPLEMENTATION.
METHOD add_comment.
comments->include( ip_comment ).
ENDMETHOD. "add_comment
METHOD add_drawing.
CASE ip_drawing->get_type( ).
WHEN zcl_excel_drawing=>type_image.
drawings->include( ip_drawing ).
WHEN zcl_excel_drawing=>type_chart.
charts->include( ip_drawing ).
ENDCASE.
ENDMETHOD. "ADD_DRAWING
METHOD add_new_column.
DATA: lv_column_alpha TYPE zexcel_cell_column_alpha.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( ip_column ).
CREATE OBJECT eo_column
EXPORTING
ip_index = lv_column_alpha
ip_excel = me->excel
ip_worksheet = me.
columns->add( eo_column ).
ENDMETHOD. "ADD_NEW_COLUMN
METHOD add_new_data_validation.
CREATE OBJECT eo_data_validation.
data_validations->add( eo_data_validation ).
ENDMETHOD. "ADD_NEW_DATA_VALIDATION
METHOD add_new_range.
* Create default blank range
CREATE OBJECT eo_range.
ranges->add( eo_range ).
ENDMETHOD. "ADD_NEW_RANGE
METHOD add_new_row.
CREATE OBJECT eo_row
EXPORTING
ip_index = ip_row.
rows->add( eo_row ).
ENDMETHOD. "ADD_NEW_ROW
METHOD add_new_style_cond.
CREATE OBJECT eo_style_cond EXPORTING ip_dimension_range = ip_dimension_range.
styles_cond->add( eo_style_cond ).
ENDMETHOD. "ADD_NEW_STYLE_COND
METHOD bind_alv.
DATA: lo_converter TYPE REF TO zcl_excel_converter.
CREATE OBJECT lo_converter.
TRY.
lo_converter->convert(
EXPORTING
io_alv = io_alv
it_table = it_table
i_row_int = i_top
i_column_int = i_left
i_table = i_table
i_style_table = table_style
io_worksheet = me
CHANGING
co_excel = excel ).
CATCH zcx_excel .
ENDTRY.
ENDMETHOD. "BIND_ALV
METHOD bind_alv_ole2.
*--------------------------------------------------------------------*
* Method description:
* Method use to export a CL_GUI_ALV_GRID object to xlsx/xls file
* with list header and characteristics of ALV field catalog such as:
* + Total, group's subtotal
* + Quantity fields, amount fields (dependent fields)
* + No_out, no_zero, ...
* Technique use in method:
* SAP Desktop Office Integration (DOI)
*--------------------------------------------------------------------*
* Data for session 0: DOI constructor
* ------------------------------------------
DATA: lo_control TYPE REF TO i_oi_container_control.
DATA: lo_proxy TYPE REF TO i_oi_document_proxy.
DATA: lo_spreadsheet TYPE REF TO i_oi_spreadsheet.
DATA: lo_error TYPE REF TO i_oi_error.
DATA: lc_retcode TYPE soi_ret_string.
DATA: li_has TYPE i. "Proxy has spreadsheet interface?
DATA: l_is_closed TYPE i.
* Data for session 1: Get LVC data from ALV object
* ------------------------------------------
DATA: l_has_activex,
l_doctype_excel_sheet(11) TYPE c.
* LVC
DATA: lt_fieldcat_lvc TYPE lvc_t_fcat.
DATA: wa_fieldcat_lvc TYPE lvc_s_fcat.
DATA: lt_sort_lvc TYPE lvc_t_sort.
DATA: lt_filter_idx_lvc TYPE lvc_t_fidx.
DATA: lt_grouplevels_lvc TYPE lvc_t_grpl.
* KKBLO
DATA: lt_fieldcat_kkblo TYPE kkblo_t_fieldcat.
DATA: lt_sort_kkblo TYPE kkblo_t_sortinfo.
DATA: lt_grouplevels_kkblo TYPE kkblo_t_grouplevels.
DATA: lt_filter_idx_kkblo TYPE kkblo_t_sfinfo.
DATA: wa_listheader LIKE LINE OF it_listheader.
* Subtotal
DATA: lt_collect00 TYPE REF TO data.
DATA: lt_collect01 TYPE REF TO data.
DATA: lt_collect02 TYPE REF TO data.
DATA: lt_collect03 TYPE REF TO data.
DATA: lt_collect04 TYPE REF TO data.
DATA: lt_collect05 TYPE REF TO data.
DATA: lt_collect06 TYPE REF TO data.
DATA: lt_collect07 TYPE REF TO data.
DATA: lt_collect08 TYPE REF TO data.
DATA: lt_collect09 TYPE REF TO data.
* data table name
DATA: l_tabname TYPE kkblo_tabname.
* local object
DATA: lo_grid TYPE REF TO lcl_gui_alv_grid.
* data table get from ALV
DATA: lt_alv TYPE REF TO data.
* total / subtotal data
FIELD-SYMBOLS: <f_collect00> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect01> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect02> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect03> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect04> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect05> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect06> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect07> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect08> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect09> TYPE STANDARD TABLE.
* table before append subtotal lines
FIELD-SYMBOLS: <f_alv_tab> TYPE STANDARD TABLE.
* data for session 2: sort, filter and calculate total/subtotal
* ------------------------------------------
* table to save index of subotal / total line in excel tanle
* this ideal to control index of subtotal / total line later
* for ex, when get subtotal / total line to format
TYPES: BEGIN OF st_subtot_indexs,
index TYPE i,
END OF st_subtot_indexs.
DATA: lt_subtot_indexs TYPE TABLE OF st_subtot_indexs.
DATA: wa_subtot_indexs LIKE LINE OF lt_subtot_indexs.
* data table after append subtotal
DATA: lt_excel TYPE REF TO data.
DATA: l_tabix TYPE i.
DATA: l_save_index TYPE i.
* dyn subtotal table name
DATA: l_collect TYPE string.
* subtotal range, to format subtotal (and total)
DATA: subranges TYPE soi_range_list.
DATA: subrangeitem TYPE soi_range_item.
DATA: l_sub_index TYPE i.
* table after append subtotal lines
FIELD-SYMBOLS: <f_excel_tab> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_excel_line> TYPE any.
* dyn subtotal tables
FIELD-SYMBOLS: <f_collect_tab> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect_line> TYPE any.
FIELD-SYMBOLS: <f_filter_idx_line> LIKE LINE OF lt_filter_idx_kkblo.
FIELD-SYMBOLS: <f_fieldcat_line> LIKE LINE OF lt_fieldcat_kkblo.
FIELD-SYMBOLS: <f_grouplevels_line> LIKE LINE OF lt_grouplevels_kkblo.
FIELD-SYMBOLS: <f_line> TYPE any.
* Data for session 3: map data to semantic table
* ------------------------------------------
TYPES: BEGIN OF st_column_index,
fieldname TYPE kkblo_fieldname,
tabname TYPE kkblo_tabname,
col LIKE sy-index,
END OF st_column_index.
* columns index
DATA: lt_column_index TYPE TABLE OF st_column_index.
DATA: wa_column_index LIKE LINE OF lt_column_index.
* table of dependent field ( currency and quantity unit field)
DATA: lt_fieldcat_depf TYPE kkblo_t_fieldcat.
DATA: wa_fieldcat_depf TYPE kkblo_fieldcat.
* XXL interface:
* -XXL: contain exporting columns characteristic
DATA: lt_sema TYPE TABLE OF gxxlt_s INITIAL SIZE 0.
DATA: wa_sema LIKE LINE OF lt_sema.
* -XXL interface: header
DATA: lt_hkey TYPE TABLE OF gxxlt_h INITIAL SIZE 0.
DATA: wa_hkey LIKE LINE OF lt_hkey.
* -XXL interface: header keys
DATA: lt_vkey TYPE TABLE OF gxxlt_v INITIAL SIZE 0.
DATA: wa_vkey LIKE LINE OF lt_vkey.
* Number of H Keys: number of key columns
DATA: l_n_hrz_keys TYPE i.
* Number of data columns in the list object: non-key columns no
DATA: l_n_att_cols TYPE i.
* Number of V Keys: number of header row
DATA: l_n_vrt_keys TYPE i.
* curency to format amount
DATA: lt_tcurx TYPE TABLE OF tcurx.
DATA: wa_tcurx LIKE LINE OF lt_tcurx.
DATA: l_def TYPE flag. " currency / quantity flag
DATA: wa_t006 TYPE t006. " decimal place of unit
DATA: l_num TYPE i. " table columns number
DATA: l_typ TYPE c. " table type
DATA: wa TYPE REF TO data.
DATA: l_int TYPE i.
DATA: l_counter TYPE i.
FIELD-SYMBOLS: <f_excel_column> TYPE any.
FIELD-SYMBOLS: <f_fcat_column> TYPE any.
* Data for session 4: write to excel
* ------------------------------------------
DATA: sema_type TYPE c.
DATA l_error TYPE REF TO c_oi_proxy_error.
DATA count TYPE i.
DATA datac TYPE i.
DATA datareal TYPE i. " exporting column number
DATA vkeycount TYPE i.
DATA all TYPE i.
DATA mit TYPE i VALUE 1. " index of recent row?
DATA li_col_pos TYPE i VALUE 1. " column position
DATA li_col_num TYPE i. " table columns number
FIELD-SYMBOLS: <line> TYPE any.
FIELD-SYMBOLS: <item> TYPE any.
DATA td TYPE sydes_desc.
DATA: typ.
DATA: ranges TYPE soi_range_list.
DATA: rangeitem TYPE soi_range_item.
DATA: contents TYPE soi_generic_table.
DATA: contentsitem TYPE soi_generic_item.
DATA: semaitem TYPE gxxlt_s.
DATA: hkeyitem TYPE gxxlt_h.
DATA: vkeyitem TYPE gxxlt_v.
DATA: li_commentary_rows TYPE i. "row number of title lines + 1
DATA: lo_error_w TYPE REF TO i_oi_error.
DATA: l_retcode TYPE soi_ret_string.
DATA: no_flush TYPE c VALUE 'X'.
DATA: li_head_top TYPE i. "header rows position
* Data for session 5: Save and clode document
* ------------------------------------------
DATA: li_document_size TYPE i.
DATA: ls_path TYPE rlgrap-filename.
* MACRO: Close_document
*-------------------------------------------
DEFINE close_document.
CLEAR: l_is_closed.
IF lo_proxy IS NOT INITIAL.
* check proxy detroyed adi
CALL METHOD lo_proxy->is_destroyed
IMPORTING
ret_value = l_is_closed.
* if dun detroyed yet: close -> release proxy
IF l_is_closed IS INITIAL.
CALL METHOD lo_proxy->close_document
* EXPORTING
* do_save = do_save
IMPORTING
error = lo_error
retcode = lc_retcode.
ENDIF.
CALL METHOD lo_proxy->release_document
IMPORTING
error = lo_error
retcode = lc_retcode.
ELSE.
lc_retcode = c_oi_errors=>ret_document_not_open.
ENDIF.
* Detroy control container
IF lo_control IS NOT INITIAL.
CALL METHOD lo_control->destroy_control.
ENDIF.
CLEAR:
lo_spreadsheet,
lo_proxy,
lo_control.
* free local
CLEAR: l_is_closed.
END-OF-DEFINITION.
* Macro to catch DOI error
*-------------------------------------------
DEFINE error_doi.
IF lc_retcode NE c_oi_errors=>ret_ok.
close_document.
CALL METHOD lo_error->raise_message
EXPORTING
type = 'E'.
CLEAR: lo_error.
ENDIF.
END-OF-DEFINITION.
*--------------------------------------------------------------------*
* SESSION 0: DOI CONSTRUCTOR
*--------------------------------------------------------------------*
* check active windown
CALL FUNCTION 'GUI_HAS_ACTIVEX'
IMPORTING
return = l_has_activex.
IF l_has_activex IS INITIAL.
RAISE miss_guide.
ENDIF.
* Get Container Object of Screen
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = lo_control
retcode = lc_retcode.
error_doi.
* Initialize Container control
CALL METHOD lo_control->init_control
EXPORTING
parent = cl_gui_container=>default_screen
r3_application_name = ''
inplace_enabled = 'X'
no_flush = 'X'
register_on_close_event = 'X'
register_on_custom_event = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
* Get Proxy Document:
* check exist of document proxy, if exist -> close first
IF NOT lo_proxy IS INITIAL.
close_document.
ENDIF.
IF i_xls IS NOT INITIAL.
* xls format, doctype = soi_doctype_excel97_sheet
l_doctype_excel_sheet = 'Excel.Sheet.8'.
ELSE.
* xlsx format, doctype = soi_doctype_excel_sheet
l_doctype_excel_sheet = 'Excel.Sheet'.
ENDIF.
CALL METHOD lo_control->get_document_proxy
EXPORTING
document_type = l_doctype_excel_sheet
register_container = 'X'
IMPORTING
document_proxy = lo_proxy
error = lo_error
retcode = lc_retcode.
error_doi.
IF i_document_url IS INITIAL.
* create new excel document
CALL METHOD lo_proxy->create_document
EXPORTING
create_view_data = 'X'
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
ELSE.
* Read excel template for i_DOCUMENT_URL
* this excel template can be store in local or server
CALL METHOD lo_proxy->open_document
EXPORTING
document_url = i_document_url
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
ENDIF.
* Check Spreadsheet Interface of Document Proxy
CALL METHOD lo_proxy->has_spreadsheet_interface
IMPORTING
is_available = li_has
error = lo_error
retcode = lc_retcode.
error_doi.
* create Spreadsheet object
CHECK li_has IS NOT INITIAL.
CALL METHOD lo_proxy->get_spreadsheet_interface
IMPORTING
sheet_interface = lo_spreadsheet
error = lo_error
retcode = lc_retcode.
error_doi.
*--------------------------------------------------------------------*
* SESSION 1: GET LVC DATA FROM ALV OBJECT
*--------------------------------------------------------------------*
* data table
CREATE OBJECT lo_grid
EXPORTING
i_parent = cl_gui_container=>screen0.
CALL METHOD lo_grid->get_alv_attributes
EXPORTING
io_grid = io_alv
IMPORTING
et_table = lt_alv.
ASSIGN lt_alv->* TO <f_alv_tab>.
* fieldcat
CALL METHOD io_alv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fieldcat_lvc.
* table name
LOOP AT lt_fieldcat_lvc INTO wa_fieldcat_lvc
WHERE NOT tabname IS INITIAL.
l_tabname = wa_fieldcat_lvc-tabname.
EXIT.
ENDLOOP.
IF sy-subrc NE 0.
l_tabname = '1'.
ENDIF.
CLEAR: wa_fieldcat_lvc.
* sort table
CALL METHOD io_alv->get_sort_criteria
IMPORTING
et_sort = lt_sort_lvc.
* filter index
CALL METHOD io_alv->get_filtered_entries
IMPORTING
et_filtered_entries = lt_filter_idx_lvc.
* group level + subtotal
CALL METHOD io_alv->get_subtotals
IMPORTING
ep_collect00 = lt_collect00
ep_collect01 = lt_collect01
ep_collect02 = lt_collect02
ep_collect03 = lt_collect03
ep_collect04 = lt_collect04
ep_collect05 = lt_collect05
ep_collect06 = lt_collect06
ep_collect07 = lt_collect07
ep_collect08 = lt_collect08
ep_collect09 = lt_collect09
et_grouplevels = lt_grouplevels_lvc.
ASSIGN lt_collect00->* TO <f_collect00>.
ASSIGN lt_collect01->* TO <f_collect01>.
ASSIGN lt_collect02->* TO <f_collect02>.
ASSIGN lt_collect03->* TO <f_collect03>.
ASSIGN lt_collect04->* TO <f_collect04>.
ASSIGN lt_collect05->* TO <f_collect05>.
ASSIGN lt_collect06->* TO <f_collect06>.
ASSIGN lt_collect07->* TO <f_collect07>.
ASSIGN lt_collect08->* TO <f_collect08>.
ASSIGN lt_collect09->* TO <f_collect09>.
* transfer to KKBLO struct
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = lt_fieldcat_lvc
it_sort_lvc = lt_sort_lvc
it_filter_index_lvc = lt_filter_idx_lvc
it_grouplevels_lvc = lt_grouplevels_lvc
IMPORTING
et_fieldcat_kkblo = lt_fieldcat_kkblo
et_sort_kkblo = lt_sort_kkblo
et_filtered_entries_kkblo = lt_filter_idx_kkblo
et_grouplevels_kkblo = lt_grouplevels_kkblo
TABLES
it_data = <f_alv_tab>
EXCEPTIONS
it_data_missing = 1
it_fieldcat_lvc_missing = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE ex_transfer_kkblo_error.
ENDIF.
CLEAR:
wa_fieldcat_lvc,
lt_fieldcat_lvc,
lt_sort_lvc,
lt_filter_idx_lvc,
lt_grouplevels_lvc.
CLEAR:
lo_grid.
*--------------------------------------------------------------------*
* SESSION 2: SORT, FILTER AND CALCULATE TOTAL / SUBTOTAL
*--------------------------------------------------------------------*
* append subtotal & total line
CREATE DATA lt_excel LIKE <f_alv_tab>.
ASSIGN lt_excel->* TO <f_excel_tab>.
LOOP AT <f_alv_tab> ASSIGNING <f_line>.
l_save_index = sy-tabix.
* filter base on filter index table
READ TABLE lt_filter_idx_kkblo ASSIGNING <f_filter_idx_line>
WITH KEY index = l_save_index
BINARY SEARCH.
IF sy-subrc NE 0.
APPEND <f_line> TO <f_excel_tab>.
ENDIF.
* append subtotal lines
READ TABLE lt_grouplevels_kkblo ASSIGNING <f_grouplevels_line>
WITH KEY index_to = l_save_index
BINARY SEARCH.
IF sy-subrc = 0.
l_tabix = sy-tabix.
DO.
IF <f_grouplevels_line>-subtot EQ 'X' AND
<f_grouplevels_line>-hide_level IS INITIAL AND
<f_grouplevels_line>-cindex_from NE 0.
* dynamic append subtotal line to excel table base on grouplevel table
* ex <f_GROUPLEVELS_line>-level = 1
* then <f_collect_tab> = '<F_COLLECT01>'
l_collect = <f_grouplevels_line>-level.
CONDENSE l_collect.
CONCATENATE '<F_COLLECT0'
l_collect '>'
* '->*'
INTO l_collect.
ASSIGN (l_collect) TO <f_collect_tab>.
* incase there're more than 1 total line of group, at the same level
* for example: subtotal of multi currency
LOOP AT <f_collect_tab> ASSIGNING <f_collect_line>.
IF sy-tabix BETWEEN <f_grouplevels_line>-cindex_from
AND <f_grouplevels_line>-cindex_to.
APPEND <f_collect_line> TO <f_excel_tab>.
* save subtotal lines index
wa_subtot_indexs-index = sy-tabix.
APPEND wa_subtot_indexs TO lt_subtot_indexs.
* append sub total ranges table for format later
ADD 1 TO l_sub_index.
subrangeitem-name = l_sub_index.
CONDENSE subrangeitem-name.
CONCATENATE 'SUBTOT'
subrangeitem-name
INTO subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
APPEND subrangeitem TO subranges.
CLEAR: subrangeitem.
ENDIF.
ENDLOOP.
UNASSIGN: <f_collect_tab>.
UNASSIGN: <f_collect_line>.
CLEAR: l_collect.
ENDIF.
* check next subtotal level of group
UNASSIGN: <f_grouplevels_line>.
ADD 1 TO l_tabix.
READ TABLE lt_grouplevels_kkblo ASSIGNING <f_grouplevels_line>
INDEX l_tabix.
IF sy-subrc NE 0
OR <f_grouplevels_line>-index_to NE l_save_index.
EXIT.
ENDIF.
UNASSIGN:
<f_collect_tab>,
<f_collect_line>.
ENDDO.
ENDIF.
CLEAR:
l_tabix,
l_save_index.
UNASSIGN:
<f_filter_idx_line>,
<f_grouplevels_line>.
ENDLOOP.
* free local data
UNASSIGN:
<f_line>,
<f_collect_tab>,
<f_collect_line>,
<f_fieldcat_line>.
* append grand total line
IF <f_collect00> IS ASSIGNED.
ASSIGN <f_collect00> TO <f_collect_tab>.
IF <f_collect_tab> IS NOT INITIAL.
LOOP AT <f_collect_tab> ASSIGNING <f_collect_line>.
APPEND <f_collect_line> TO <f_excel_tab>.
* save total line index
wa_subtot_indexs-index = sy-tabix.
APPEND wa_subtot_indexs TO lt_subtot_indexs.
* append grand total range (to format)
ADD 1 TO l_sub_index.
subrangeitem-name = l_sub_index.
CONDENSE subrangeitem-name.
CONCATENATE 'TOTAL'
subrangeitem-name
INTO subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
APPEND subrangeitem TO subranges.
ENDLOOP.
ENDIF.
ENDIF.
CLEAR:
subrangeitem,
lt_sort_kkblo,
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>.
UNASSIGN:
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>,
<f_collect_tab>,
<f_collect_line>.
*--------------------------------------------------------------------*
* SESSION 3: MAP DATA TO SEMANTIC TABLE
*--------------------------------------------------------------------*
* get dependent field field: currency and quantity
CREATE DATA wa LIKE LINE OF <f_excel_tab>.
ASSIGN wa->* TO <f_excel_line>.
DESCRIBE FIELD <f_excel_line> TYPE l_typ COMPONENTS l_num.
DO l_num TIMES.
l_save_index = sy-index.
ASSIGN COMPONENT l_save_index OF STRUCTURE <f_excel_line>
TO <f_excel_column>.
IF sy-subrc NE 0.
MESSAGE e801(zabap2xlsx) WITH 'FATAL ERROR' RAISING fatal_error.
ENDIF.
LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WHERE tabname = l_tabname.
ASSIGN COMPONENT <f_fieldcat_line>-fieldname
OF STRUCTURE <f_excel_line> TO <f_fcat_column>.
DESCRIBE DISTANCE BETWEEN <f_excel_column> AND <f_fcat_column>
INTO l_int IN BYTE MODE.
* append column index
* this columns index is of table, not fieldcat
IF l_int = 0.
wa_column_index-fieldname = <f_fieldcat_line>-fieldname.
wa_column_index-tabname = <f_fieldcat_line>-tabname.
wa_column_index-col = l_save_index.
APPEND wa_column_index TO lt_column_index.
ENDIF.
* append dependent fields (currency and quantity unit)
IF <f_fieldcat_line>-cfieldname IS NOT INITIAL.
CLEAR wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-cfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-ctabname.
COLLECT wa_fieldcat_depf INTO lt_fieldcat_depf.
ENDIF.
IF <f_fieldcat_line>-qfieldname IS NOT INITIAL.
CLEAR wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-qfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-qtabname.
COLLECT wa_fieldcat_depf INTO lt_fieldcat_depf.
ENDIF.
* rewrite field data type
IF <f_fieldcat_line>-inttype = 'X'
AND <f_fieldcat_line>-datatype(3) = 'INT'.
<f_fieldcat_line>-inttype = 'I'.
ENDIF.
ENDLOOP.
CLEAR: l_save_index.
UNASSIGN: <f_fieldcat_line>.
ENDDO.
* build semantic tables
l_n_hrz_keys = 1.
* Get keyfigures
LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WHERE tabname = l_tabname
AND tech NE 'X'
AND no_out NE 'X'.
CLEAR wa_sema.
CLEAR wa_hkey.
* Units belong to keyfigures -> display as str
READ TABLE lt_fieldcat_depf INTO wa_fieldcat_depf WITH KEY
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
IF sy-subrc = 0.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
* Keyfigures
ELSE.
CASE <f_fieldcat_line>-datatype.
WHEN 'QUAN'.
wa_sema-col_typ = 'N03'.
IF <f_fieldcat_line>-no_sum NE 'X'.
wa_sema-col_ops = 'ADD'.
ELSE.
wa_sema-col_ops = 'NOP'. " no dependent field
ENDIF.
WHEN 'DATS'.
wa_sema-col_typ = 'DAT'.
wa_sema-col_ops = 'NOP'.
WHEN 'CHAR' OR 'UNIT' OR 'CUKY'. " Added fieldformats UNIT and CUKY - dd. 26-10-2012 Wouter Heuvelmans
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'. " dependent field
* incase numeric, ex '00120' -> display as '12'
WHEN 'NUMC'.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
WHEN OTHERS.
wa_sema-col_typ = 'NUM'.
IF <f_fieldcat_line>-no_sum NE 'X'.
wa_sema-col_ops = 'ADD'.
ELSE.
wa_sema-col_ops = 'NOP'.
ENDIF.
ENDCASE.
ENDIF.
l_counter = l_counter + 1.
l_n_att_cols = l_n_att_cols + 1.
wa_sema-col_no = l_counter.
READ TABLE lt_column_index INTO wa_column_index WITH KEY
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
IF sy-subrc = 0.
wa_sema-col_src = wa_column_index-col.
ELSE.
RAISE fatal_error.
ENDIF.
* columns index of ref currency field in table
IF NOT <f_fieldcat_line>-cfieldname IS INITIAL.
READ TABLE lt_column_index INTO wa_column_index WITH KEY
fieldname = <f_fieldcat_line>-cfieldname
tabname = <f_fieldcat_line>-ctabname.
IF sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
ENDIF.
* quantities fields
* treat as currency when display on excel
ELSEIF NOT <f_fieldcat_line>-qfieldname IS INITIAL.
READ TABLE lt_column_index INTO wa_column_index WITH KEY
fieldname = <f_fieldcat_line>-qfieldname
tabname = <f_fieldcat_line>-qtabname.
IF sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
ENDIF.
ENDIF.
* Treat of fixed currency in the fieldcatalog for column
DATA: l_num_help(2) TYPE n.
IF NOT <f_fieldcat_line>-currency IS INITIAL.
SELECT * FROM tcurx INTO TABLE lt_tcurx.
SORT lt_tcurx.
READ TABLE lt_tcurx INTO wa_tcurx
WITH KEY currkey = <f_fieldcat_line>-currency.
IF sy-subrc = 0.
l_num_help = wa_tcurx-currdec.
CONCATENATE 'N' l_num_help INTO wa_sema-col_typ.
wa_sema-col_cur = sy-tabix * ( -1 ).
ENDIF.
ENDIF.
wa_hkey-col_no = l_n_att_cols.
wa_hkey-row_no = l_n_hrz_keys.
wa_hkey-col_name = <f_fieldcat_line>-reptext.
APPEND wa_hkey TO lt_hkey.
APPEND wa_sema TO lt_sema.
ENDLOOP.
* free local data
CLEAR:
lt_column_index,
wa_column_index,
lt_fieldcat_depf,
wa_fieldcat_depf,
lt_tcurx,
wa_tcurx,
l_num,
l_typ,
wa,
l_int,
l_counter.
UNASSIGN:
<f_fieldcat_line>,
<f_excel_line>,
<f_excel_column>,
<f_fcat_column>.
*--------------------------------------------------------------------*
* SESSION 4: WRITE TO EXCEL
*--------------------------------------------------------------------*
CLEAR: wa_tcurx.
REFRESH: lt_tcurx.
* if spreadsheet dun have proxy yet
IF li_has IS INITIAL.
l_retcode = c_oi_errors=>ret_interface_not_supported.
CALL METHOD c_oi_errors=>create_error_for_retcode
EXPORTING
retcode = l_retcode
no_flush = no_flush
IMPORTING
error = lo_error_w.
EXIT.
ENDIF.
CREATE OBJECT l_error
EXPORTING
object_name = 'OLE_DOCUMENT_PROXY'
method_name = 'get_ranges_names'.
CALL METHOD c_oi_errors=>add_error
EXPORTING
error = l_error.
DESCRIBE TABLE lt_sema LINES datareal.
DESCRIBE TABLE <f_excel_tab> LINES datac.
DESCRIBE TABLE lt_vkey LINES vkeycount.
IF datac = 0.
RAISE inv_data_range.
ENDIF.
IF vkeycount NE l_n_vrt_keys.
RAISE dim_mismatch_vkey.
ENDIF.
all = l_n_vrt_keys + l_n_att_cols.
IF datareal NE all.
RAISE dim_mismatch_sema.
ENDIF.
DATA: decimal TYPE c.
* get decimal separator format ('.', ',', ...) in Office config
CALL METHOD lo_proxy->get_application_property
EXPORTING
property_name = 'INTERNATIONAL'
subproperty_name = 'DECIMAL_SEPARATOR'
CHANGING
retvalue = decimal.
DATA date_format TYPE usr01-datfm.
SELECT SINGLE datfm FROM usr01 INTO date_format WHERE bname = sy-uname.
DATA: comma_elim(4) TYPE c.
FIELD-SYMBOLS <g> TYPE any.
DATA search_item(4) VALUE ' #'.
CONCATENATE ',' decimal '.' decimal INTO comma_elim.
DATA help TYPE i. " table (with subtotal) line number
help = datac.
DATA: rowmax TYPE i VALUE 1. " header row number
DATA: columnmax TYPE i VALUE 0. " header columns number
LOOP AT lt_hkey INTO hkeyitem.
IF hkeyitem-col_no > columnmax.
columnmax = hkeyitem-col_no.
ENDIF.
IF hkeyitem-row_no > rowmax.
rowmax = hkeyitem-row_no.
ENDIF.
ENDLOOP.
DATA: hkeycolumns TYPE i. " header columns no
hkeycolumns = columnmax.
IF hkeycolumns < l_n_att_cols.
hkeycolumns = l_n_att_cols.
ENDIF.
columnmax = 0.
LOOP AT lt_vkey INTO vkeyitem.
IF vkeyitem-col_no > columnmax.
columnmax = vkeyitem-col_no.
ENDIF.
ENDLOOP.
DATA overflow TYPE i VALUE 1.
DATA testname(10) TYPE c.
DATA temp2 TYPE i. " 1st item row position in excel
DATA realmit TYPE i VALUE 1.
DATA realoverflow TYPE i VALUE 1. " row index in content
CALL METHOD lo_spreadsheet->screen_update
EXPORTING
updating = ''.
CALL METHOD lo_spreadsheet->load_lib.
DATA: str(40) TYPE c. " range names of columns range (w/o col header)
DATA: rows TYPE i. " row postion of 1st item line in ecxel
* calculate row position of data table
DESCRIBE TABLE it_listheader LINES li_commentary_rows.
* if grid had title, add 1 empy line between title and table
IF li_commentary_rows NE 0.
ADD 1 TO li_commentary_rows.
ENDIF.
* add top position of block data
li_commentary_rows = li_commentary_rows + i_top - 1.
* write header (commentary rows)
DATA: li_commentary_row_index TYPE i VALUE 1.
DATA: li_content_index TYPE i VALUE 1.
DATA: ls_index(10) TYPE c.
DATA ls_commentary_range(40) TYPE c VALUE 'TITLE'.
DATA: li_font_bold TYPE i.
DATA: li_font_italic TYPE i.
DATA: li_font_size TYPE i.
LOOP AT it_listheader INTO wa_listheader.
li_commentary_row_index = i_top + li_content_index - 1.
ls_index = li_content_index.
CONDENSE ls_index.
CONCATENATE ls_commentary_range(5) ls_index
INTO ls_commentary_range.
CONDENSE ls_commentary_range.
* insert title range
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = ls_commentary_range
top = li_commentary_row_index
left = i_left
rows = 1
columns = 1
no_flush = no_flush.
* format range
CASE wa_listheader-typ.
WHEN 'H'. "title
li_font_size = 16.
li_font_bold = 1.
li_font_italic = -1.
WHEN 'S'. "subtile
li_font_size = -1.
li_font_bold = 1.
li_font_italic = -1.
WHEN OTHERS. "'A' comment
li_font_size = -1.
li_font_bold = -1.
li_font_italic = 1.
ENDCASE.
CALL METHOD lo_spreadsheet->set_font
EXPORTING
rangename = ls_commentary_range
family = ''
size = li_font_size
bold = li_font_bold
italic = li_font_italic
align = 0
no_flush = no_flush.
* title: range content
rangeitem-name = ls_commentary_range.
rangeitem-columns = 1.
rangeitem-rows = 1.
APPEND rangeitem TO ranges.
contentsitem-row = li_content_index.
contentsitem-column = 1.
CONCATENATE wa_listheader-key
wa_listheader-info
INTO contentsitem-value
SEPARATED BY space.
CONDENSE contentsitem-value.
APPEND contentsitem TO contents.
ADD 1 TO li_content_index.
CLEAR:
rangeitem,
contentsitem,
ls_index.
ENDLOOP.
* set range data title
CALL METHOD lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
REFRESH:
ranges,
contents.
rows = rowmax + li_commentary_rows + 1.
all = date_format.
all = all + 3.
LOOP AT lt_sema INTO semaitem.
IF semaitem-col_typ = 'DAT' OR semaitem-col_typ = 'MON' OR
semaitem-col_typ = 'N00' OR semaitem-col_typ = 'N01' OR
semaitem-col_typ = 'N02' OR
semaitem-col_typ = 'N03' OR semaitem-col_typ = 'PCT' OR
semaitem-col_typ = 'STR' OR semaitem-col_typ = 'NUM'.
CLEAR str.
str = semaitem-col_no.
CONDENSE str.
CONCATENATE 'DATA' str INTO str.
mit = semaitem-col_no.
li_col_pos = semaitem-col_no + i_left - 1.
* range from data1 to data(n), for each columns of table
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = str
top = rows
left = li_col_pos
rows = help
columns = 1
no_flush = no_flush.
DATA dec TYPE i VALUE -1.
DATA typeinfo TYPE sydes_typeinfo.
LOOP AT <f_excel_tab> ASSIGNING <line>.
ASSIGN COMPONENT semaitem-col_no OF STRUCTURE <line> TO <item>.
DESCRIBE FIELD <item> INTO td.
READ TABLE td-types INDEX 1 INTO typeinfo.
IF typeinfo-type = 'P'.
dec = typeinfo-decimals.
ELSEIF typeinfo-type = 'I'.
dec = 0.
ENDIF.
DESCRIBE FIELD <line> TYPE typ COMPONENTS count.
mit = 1.
DO count TIMES.
IF mit = semaitem-col_src.
ASSIGN COMPONENT sy-index OF STRUCTURE <line> TO <item>.
DESCRIBE FIELD <item> INTO td.
READ TABLE td-types INDEX 1 INTO typeinfo.
IF typeinfo-type = 'P'.
dec = typeinfo-decimals.
ENDIF.
EXIT.
ENDIF.
mit = mit + 1.
ENDDO.
EXIT.
ENDLOOP.
* format for each columns of table (w/o columns headers)
IF semaitem-col_typ = 'DAT'.
IF semaitem-col_no > vkeycount.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = all
no_flush = no_flush.
ELSE.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
ENDIF.
ELSEIF semaitem-col_typ = 'STR'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'MON'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 10
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N00'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 0
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N01'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 1
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N02'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N03'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 3
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N04'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 4
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'NUM'.
IF dec EQ -1.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
ELSE.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = dec
no_flush = no_flush.
ENDIF.
ELSEIF semaitem-col_typ = 'PCT'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 3
decimals = 0
no_flush = no_flush.
ENDIF.
ENDIF.
ENDLOOP.
* get item contents for set_range_data method
* get currency cell also
mit = 1.
DATA: currcells TYPE soi_cell_table.
DATA: curritem TYPE soi_cell_item.
curritem-rows = 1.
curritem-columns = 1.
curritem-front = -1.
curritem-back = -1.
curritem-font = ''.
curritem-size = -1.
curritem-bold = -1.
curritem-italic = -1.
curritem-align = -1.
curritem-frametyp = -1.
curritem-framecolor = -1.
curritem-currency = ''.
curritem-number = 1.
curritem-input = -1.
DATA: const TYPE i.
* Change for Correction request
* Initial 10000 lines are missing in Excel Export
* if there are only 2 columns in exported List object.
IF datareal GT 2.
const = 20000 / datareal.
ELSE.
const = 20000 / ( datareal + 2 ).
ENDIF.
DATA: lines TYPE i.
DATA: innerlines TYPE i.
DATA: counter TYPE i.
DATA: curritem2 LIKE curritem.
DATA: curritem3 LIKE curritem.
DATA: length TYPE i.
DATA: found.
* append content table (for method set_range_content)
LOOP AT <f_excel_tab> ASSIGNING <line>.
* save line index to compare with lt_subtot_indexs,
* to discover line is a subtotal / totale line or not
* ex use to set 'dun display zero in subtotal / total line'
l_save_index = sy-tabix.
DO datareal TIMES.
READ TABLE lt_sema INTO semaitem WITH KEY col_no = sy-index.
IF semaitem-col_src NE 0.
ASSIGN COMPONENT semaitem-col_src
OF STRUCTURE <line> TO <item>.
ELSE.
ASSIGN COMPONENT sy-index
OF STRUCTURE <line> TO <item>.
ENDIF.
contentsitem-row = realoverflow.
IF sy-subrc = 0.
MOVE semaitem-col_ops TO search_item(3).
SEARCH 'ADD#CNT#MIN#MAX#AVG#NOP#DFT#'
FOR search_item.
IF sy-subrc NE 0.
RAISE error_in_sema.
ENDIF.
MOVE semaitem-col_typ TO search_item(3).
SEARCH 'NUM#N00#N01#N02#N03#N04#PCT#DAT#MON#STR#'
FOR search_item.
IF sy-subrc NE 0.
RAISE error_in_sema.
ENDIF.
contentsitem-column = sy-index.
IF semaitem-col_typ EQ 'DAT' OR semaitem-col_typ EQ 'MON'.
IF semaitem-col_no > vkeycount.
" Hinweis 512418
" EXCEL bezieht Datumsangaben
" auf den 31.12.1899, behandelt
" aber 1900 als ein Schaltjahr
" d.h. ab 1.3.1900 korrekt
" 1.3.1900 als Zahl = 61
DATA: genesis TYPE d VALUE '18991230'.
DATA: number_of_days TYPE p.
* change for date in char format & sema_type = X
DATA: temp_date TYPE d.
IF NOT <item> IS INITIAL AND NOT <item> CO ' ' AND NOT
<item> CO '0'.
* change for date in char format & sema_type = X starts
IF sema_type = 'X'.
DESCRIBE FIELD <item> TYPE typ.
IF typ = 'C'.
temp_date = <item>.
number_of_days = temp_date - genesis.
ELSE.
number_of_days = <item> - genesis.
ENDIF.
ELSE.
number_of_days = <item> - genesis.
ENDIF.
* change for date in char format & sema_type = X ends
IF number_of_days < 61.
number_of_days = number_of_days - 1.
ENDIF.
SET COUNTRY 'DE'.
WRITE number_of_days TO contentsitem-value
NO-GROUPING
LEFT-JUSTIFIED.
SET COUNTRY space.
TRANSLATE contentsitem-value USING comma_elim.
ELSE.
CLEAR contentsitem-value.
ENDIF.
ELSE.
MOVE <item> TO contentsitem-value.
ENDIF.
ELSEIF semaitem-col_typ EQ 'NUM' OR
semaitem-col_typ EQ 'N00' OR
semaitem-col_typ EQ 'N01' OR
semaitem-col_typ EQ 'N02' OR
semaitem-col_typ EQ 'N03' OR
semaitem-col_typ EQ 'N04' OR
semaitem-col_typ EQ 'PCT'.
SET COUNTRY 'DE'.
DESCRIBE FIELD <item> TYPE typ.
IF semaitem-col_cur IS INITIAL.
IF typ NE 'F'.
WRITE <item> TO contentsitem-value NO-GROUPING
NO-SIGN DECIMALS 14.
ELSE.
WRITE <item> TO contentsitem-value NO-GROUPING
NO-SIGN.
ENDIF.
ELSE.
* Treat of fixed curreny for column >>Y9CK007319
IF semaitem-col_cur < 0.
semaitem-col_cur = semaitem-col_cur * ( -1 ).
SELECT * FROM tcurx INTO TABLE lt_tcurx.
SORT lt_tcurx.
READ TABLE lt_tcurx INTO
wa_tcurx INDEX semaitem-col_cur.
IF sy-subrc = 0.
IF typ NE 'F'.
WRITE <item> TO contentsitem-value NO-GROUPING
CURRENCY wa_tcurx-currkey NO-SIGN DECIMALS 14.
ELSE.
WRITE <item> TO contentsitem-value NO-GROUPING
CURRENCY wa_tcurx-currkey NO-SIGN.
ENDIF.
ENDIF.
ELSE.
ASSIGN COMPONENT semaitem-col_cur
OF STRUCTURE <line> TO <g>.
* mit = index of recent row
curritem-top = rowmax + mit + li_commentary_rows.
li_col_pos = sy-index + i_left - 1.
curritem-left = li_col_pos.
* if filed is quantity field (qfieldname ne space)
* or amount field (cfieldname ne space), then format decimal place
* corresponding with config
CLEAR: l_def.
READ TABLE lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WITH KEY tabname = l_tabname
tech = space
no_out = space
col_pos = semaitem-col_no.
IF sy-subrc = 0.
IF <f_fieldcat_line>-cfieldname IS NOT INITIAL.
l_def = 'C'.
ELSE."if <f_fieldcat_line>-qfieldname is not initial.
l_def = 'Q'.
ENDIF.
ENDIF.
* if field is amount field
* exporting of amount field base on currency decimal table: TCURX
IF l_def = 'C'. "field is amount field
SELECT SINGLE * FROM tcurx INTO wa_tcurx
WHERE currkey = <g>.
* if amount ref to un-know currency -> default decimal = 2
IF sy-subrc EQ 0.
curritem-decimals = wa_tcurx-currdec.
ELSE.
curritem-decimals = 2.
ENDIF.
APPEND curritem TO currcells.
IF typ NE 'F'.
WRITE <item> TO contentsitem-value
CURRENCY <g>
NO-SIGN NO-GROUPING.
ELSE.
WRITE <item> TO contentsitem-value
DECIMALS 14 CURRENCY <g>
NO-SIGN NO-GROUPING.
ENDIF.
* if field is quantity field
* exporting of quantity field base on quantity decimal table: T006
ELSE."if l_def = 'Q'. " field is quantity field
CLEAR: wa_t006.
SELECT SINGLE * FROM t006 INTO wa_t006
WHERE msehi = <g>.
* if quantity ref to un-know unit-> default decimal = 2
IF sy-subrc EQ 0.
curritem-decimals = wa_t006-decan.
ELSE.
curritem-decimals = 2.
ENDIF.
APPEND curritem TO currcells.
WRITE <item> TO contentsitem-value
UNIT <g>
NO-SIGN NO-GROUPING.
CONDENSE contentsitem-value.
ENDIF.
ENDIF. "Y9CK007319
ENDIF.
CONDENSE contentsitem-value.
* add function fieldcat-no zero display
LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WHERE tabname = l_tabname
AND tech NE 'X'
AND no_out NE 'X'.
IF <f_fieldcat_line>-col_pos = semaitem-col_no.
IF <f_fieldcat_line>-no_zero = 'X'.
IF <item> = '0'.
CLEAR: contentsitem-value.
ENDIF.
* dun display zero in total/subtotal line too
ELSE.
CLEAR: wa_subtot_indexs.
READ TABLE lt_subtot_indexs INTO wa_subtot_indexs
WITH KEY index = l_save_index.
IF sy-subrc = 0 AND <item> = '0'.
CLEAR: contentsitem-value.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
UNASSIGN: <f_fieldcat_line>.
IF <item> LT 0.
SEARCH contentsitem-value FOR 'E'.
IF sy-fdpos EQ 0.
* use prefix notation for signed numbers
TRANSLATE contentsitem-value USING '- '.
CONDENSE contentsitem-value NO-GAPS.
CONCATENATE '-' contentsitem-value
INTO contentsitem-value.
ELSE.
CONCATENATE '-' contentsitem-value
INTO contentsitem-value.
ENDIF.
ENDIF.
SET COUNTRY space.
* Hier wird nur die korrekte Kommaseparatierung gemacht, wenn die
* Zeichen einer
* Zahl enthalten sind. Das ist für Timestamps, die auch ":" enthalten.
* Für die
* darf keine Kommaseparierung stattfinden.
* Changing for correction request - Y6BK041073
IF contentsitem-value CO '0123456789.,-+E '.
TRANSLATE contentsitem-value USING comma_elim.
ENDIF.
ELSE.
CLEAR contentsitem-value.
* if type is not numeric -> dun display with zero
WRITE <item> TO contentsitem-value NO-ZERO.
SHIFT contentsitem-value LEFT DELETING LEADING space.
ENDIF.
APPEND contentsitem TO contents.
ENDIF.
ENDDO.
realmit = realmit + 1.
realoverflow = realoverflow + 1.
mit = mit + 1.
* overflow = current row index in content table
overflow = overflow + 1.
ENDLOOP.
UNASSIGN: <f_fieldcat_line>.
* set item range for set_range_data method
testname = mit / const.
CONDENSE testname.
CONCATENATE 'TEST' testname INTO testname.
realoverflow = realoverflow - 1.
realmit = realmit - 1.
help = realoverflow.
rangeitem-name = testname.
rangeitem-columns = datareal.
rangeitem-rows = help.
APPEND rangeitem TO ranges.
* insert item range dim
temp2 = rowmax + 1 + li_commentary_rows + realmit - realoverflow.
* items data
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = testname
top = temp2
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* get columns header contents for set_range_data method
* export columns header only if no columns header option = space
DATA: rowcount TYPE i.
DATA: columncount TYPE i.
IF i_columns_header = 'X'.
* append columns header to contents: hkey
rowcount = 1.
DO rowmax TIMES.
columncount = 1.
DO hkeycolumns TIMES.
LOOP AT lt_hkey INTO hkeyitem WHERE col_no = columncount
AND row_no = rowcount.
ENDLOOP.
IF sy-subrc = 0.
str = hkeyitem-col_name.
contentsitem-value = hkeyitem-col_name.
ELSE.
contentsitem-value = str.
ENDIF.
contentsitem-column = columncount.
contentsitem-row = rowcount.
APPEND contentsitem TO contents.
columncount = columncount + 1.
ENDDO.
rowcount = rowcount + 1.
ENDDO.
* incase columns header in multiline
DATA: rowmaxtemp TYPE i.
IF rowmax > 1.
rowmaxtemp = rowmax - 1.
rowcount = 1.
DO rowmaxtemp TIMES.
columncount = 1.
DO columnmax TIMES.
contentsitem-column = columncount.
contentsitem-row = rowcount.
contentsitem-value = ''.
APPEND contentsitem TO contents.
columncount = columncount + 1.
ENDDO.
rowcount = rowcount + 1.
ENDDO.
ENDIF.
* append columns header to contents: vkey
columncount = 1.
DO columnmax TIMES.
LOOP AT lt_vkey INTO vkeyitem WHERE col_no = columncount.
ENDLOOP.
contentsitem-value = vkeyitem-col_name.
contentsitem-row = rowmax.
contentsitem-column = columncount.
APPEND contentsitem TO contents.
columncount = columncount + 1.
ENDDO.
*--------------------------------------------------------------------*
* set header range for method set_range_data
* insert header keys range dim
li_head_top = li_commentary_rows + 1.
li_col_pos = i_left.
* insert range headers
IF hkeycolumns NE 0.
rangeitem-name = 'TESTHKEY'.
rangeitem-rows = rowmax.
rangeitem-columns = hkeycolumns.
APPEND rangeitem TO ranges.
CLEAR: rangeitem.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = 'TESTHKEY'
top = li_head_top
left = li_col_pos
rows = rowmax
columns = hkeycolumns
no_flush = no_flush.
ENDIF.
ENDIF.
* format for columns header + total + subtotal
* ------------------------------------------
help = rowmax + realmit. " table + header lines
DATA: lt_format TYPE soi_format_table.
DATA: wa_format LIKE LINE OF lt_format.
DATA: wa_format_temp LIKE LINE OF lt_format.
FIELD-SYMBOLS: <f_source> TYPE any.
FIELD-SYMBOLS: <f_des> TYPE any.
* columns header format
wa_format-front = -1.
wa_format-back = 15. "grey
wa_format-font = space.
wa_format-size = -1.
wa_format-bold = 1.
wa_format-align = 0.
wa_format-frametyp = -1.
wa_format-framecolor = -1.
* get column header format from input record
* -> map input format
IF i_columns_header = 'X'.
wa_format-name = 'TESTHKEY'.
IF i_format_col_header IS NOT INITIAL.
DESCRIBE FIELD i_format_col_header TYPE l_typ COMPONENTS
li_col_num.
DO li_col_num TIMES.
IF sy-index NE 1. " dun map range name
ASSIGN COMPONENT sy-index OF STRUCTURE i_format_col_header
TO <f_source>.
IF <f_source> IS NOT INITIAL.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format TO <f_des>.
<f_des> = <f_source>.
UNASSIGN: <f_des>.
ENDIF.
UNASSIGN: <f_source>.
ENDIF.
ENDDO.
CLEAR: li_col_num.
ENDIF.
APPEND wa_format TO lt_format.
ENDIF.
* Zusammenfassen der Spalten mit gleicher Nachkommastellenzahl
* collect vertical cells (col) with the same number of decimal places
* to increase perfomance in currency cell format
DESCRIBE TABLE currcells LINES lines.
lines = lines - 1.
DO lines TIMES.
DESCRIBE TABLE currcells LINES innerlines.
innerlines = innerlines - 1.
SORT currcells BY left top.
CLEAR found.
DO innerlines TIMES.
READ TABLE currcells INDEX sy-index INTO curritem.
counter = sy-index + 1.
READ TABLE currcells INDEX counter INTO curritem2.
IF curritem-left EQ curritem2-left.
length = curritem-top + curritem-rows.
IF length EQ curritem2-top AND curritem-decimals EQ curritem2-decimals.
MOVE curritem TO curritem3.
curritem3-rows = curritem3-rows + curritem2-rows.
curritem-left = -1.
MODIFY currcells INDEX sy-index FROM curritem.
curritem2-left = -1.
MODIFY currcells INDEX counter FROM curritem2.
APPEND curritem3 TO currcells.
found = 'X'.
ENDIF.
ENDIF.
ENDDO.
IF found IS INITIAL.
EXIT.
ENDIF.
DELETE currcells WHERE left = -1.
ENDDO.
* Zusammenfassen der Zeilen mit gleicher Nachkommastellenzahl
* collect horizontal cells (row) with the same number of decimal places
* to increase perfomance in currency cell format
DESCRIBE TABLE currcells LINES lines.
lines = lines - 1.
DO lines TIMES.
DESCRIBE TABLE currcells LINES innerlines.
innerlines = innerlines - 1.
SORT currcells BY top left.
CLEAR found.
DO innerlines TIMES.
READ TABLE currcells INDEX sy-index INTO curritem.
counter = sy-index + 1.
READ TABLE currcells INDEX counter INTO curritem2.
IF curritem-top EQ curritem2-top AND curritem-rows EQ
curritem2-rows.
length = curritem-left + curritem-columns.
IF length EQ curritem2-left AND curritem-decimals EQ curritem2-decimals.
MOVE curritem TO curritem3.
curritem3-columns = curritem3-columns + curritem2-columns.
curritem-left = -1.
MODIFY currcells INDEX sy-index FROM curritem.
curritem2-left = -1.
MODIFY currcells INDEX counter FROM curritem2.
APPEND curritem3 TO currcells.
found = 'X'.
ENDIF.
ENDIF.
ENDDO.
IF found IS INITIAL.
EXIT.
ENDIF.
DELETE currcells WHERE left = -1.
ENDDO.
* Ende der Zusammenfassung
* item data: format for currency cell, corresponding with currency
CALL METHOD lo_spreadsheet->cell_format
EXPORTING
cells = currcells
no_flush = no_flush.
* item data: write item table content
CALL METHOD lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
* whole table range to format all table
IF i_columns_header = 'X'.
li_head_top = li_commentary_rows + 1.
ELSE.
li_head_top = li_commentary_rows + 2.
help = help - 1.
ENDIF.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = 'WHOLE_TABLE'
top = li_head_top
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* columns width auto fix
* this parameter = space in case use with exist template
IF i_columns_autofit = 'X'.
CALL METHOD lo_spreadsheet->fit_widest
EXPORTING
name = 'WHOLE_TABLE'
no_flush = no_flush.
ENDIF.
* frame
* The parameter has 8 bits
*0 Left margin
*1 Top marginT
*2 Bottom margin
*3 Right margin
*4 Horizontal line
*5 Vertical line
*6 Thinness
*7 Thickness
* here 127 = 1111111 6-5-4-3-2-1 mean Thin-ver-hor-right-bot-top-left
* ( final DOI method call, set no_flush = space
* equal to call method CL_GUI_CFW=>FLUSH )
CALL METHOD lo_spreadsheet->set_frame
EXPORTING
rangename = 'WHOLE_TABLE'
typ = 127
color = 1
no_flush = space
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
* reformat subtotal / total line after format wholw table
LOOP AT subranges INTO subrangeitem.
l_sub_index = subrangeitem-rows + li_commentary_rows + rowmax.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = subrangeitem-name
left = i_left
top = l_sub_index
rows = 1
columns = datareal
no_flush = no_flush.
wa_format-name = subrangeitem-name.
* default format:
* - clolor: subtotal = light yellow, subtotal = yellow
* - frame: box
IF subrangeitem-name(3) = 'SUB'.
wa_format-back = 36. "subtotal line
wa_format_temp = i_format_subtotal.
ELSE.
wa_format-back = 27. "total line
wa_format_temp = i_format_total.
ENDIF.
wa_format-frametyp = 79.
wa_format-framecolor = 1.
wa_format-number = -1.
wa_format-align = -1.
* get subtoal + total format from intput parameter
* overwrite default format
IF wa_format_temp IS NOT INITIAL.
DESCRIBE FIELD wa_format_temp TYPE l_typ COMPONENTS li_col_num.
DO li_col_num TIMES.
IF sy-index NE 1. " dun map range name
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format_temp
TO <f_source>.
IF <f_source> IS NOT INITIAL.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format TO <f_des>.
<f_des> = <f_source>.
UNASSIGN: <f_des>.
ENDIF.
UNASSIGN: <f_source>.
ENDIF.
ENDDO.
CLEAR: li_col_num.
ENDIF.
APPEND wa_format TO lt_format.
CLEAR: wa_format-name.
CLEAR: l_sub_index.
CLEAR: wa_format_temp.
ENDLOOP.
IF lt_format[] IS NOT INITIAL.
CALL METHOD lo_spreadsheet->set_ranges_format
EXPORTING
formattable = lt_format
no_flush = no_flush.
REFRESH: lt_format.
ENDIF.
*--------------------------------------------------------------------*
CALL METHOD lo_spreadsheet->screen_update
EXPORTING
updating = 'X'.
CALL METHOD c_oi_errors=>flush_errors.
lo_error_w = l_error.
lc_retcode = lo_error_w->error_code.
** catch no_flush -> led to dump ( optional )
* go_error = l_error.
* gc_retcode = go_error->error_code.
* error_doi.
CLEAR:
lt_sema,
wa_sema,
lt_hkey,
wa_hkey,
lt_vkey,
wa_vkey,
l_n_hrz_keys,
l_n_att_cols,
l_n_vrt_keys,
count,
datac,
datareal,
vkeycount,
all,
mit,
li_col_pos,
li_col_num,
ranges,
rangeitem,
contents,
contentsitem,
semaitem,
hkeyitem,
vkeyitem,
li_commentary_rows,
l_retcode,
li_head_top,
<f_excel_tab>.
CLEAR:
lo_error_w.
UNASSIGN:
<line>,
<item>,
<f_excel_tab>.
*--------------------------------------------------------------------*
* SESSION 5: SAVE AND CLOSE FILE
*--------------------------------------------------------------------*
* ex of save path: 'FILE://C:\temp\test.xlsx'
CONCATENATE 'FILE://' i_save_path
INTO ls_path.
CALL METHOD lo_proxy->save_document_to_url
EXPORTING
no_flush = 'X'
url = ls_path
IMPORTING
error = lo_error
retcode = lc_retcode
CHANGING
document_size = li_document_size.
error_doi.
* if save successfully -> raise successful message
MESSAGE i400(zabap2xlsx).
CLEAR:
ls_path,
li_document_size.
close_document.
ENDMETHOD. "BIND_ALV_OLE2
METHOD bind_table.
*--------------------------------------------------------------------*
* issue #230 - Pimp my Code
* - Stefan Schmöcker, (wi p) 2012-12-01
* - ...
* aligning code
* message made to support multilinguality
*--------------------------------------------------------------------*
* issue #237 - Check if overlapping areas exist
* - Alessandro Iannacci 2012-12-01
* changes: - Added raise if overlaps are detected
*--------------------------------------------------------------------*
CONSTANTS:
lc_top_left_column TYPE zexcel_cell_column_alpha VALUE 'A',
lc_top_left_row TYPE zexcel_cell_row VALUE 1.
DATA:
lv_row_int TYPE zexcel_cell_row,
lv_first_row TYPE zexcel_cell_row,
lv_last_row TYPE zexcel_cell_row,
lv_column_int TYPE zexcel_cell_column,
lv_column_alpha TYPE zexcel_cell_column_alpha,
lt_field_catalog TYPE zexcel_t_fieldcatalog,
lv_id TYPE i,
lv_rows TYPE i,
lv_formula TYPE string,
ls_settings TYPE zexcel_s_table_settings,
lo_table TYPE REF TO zcl_excel_table,
lt_column_name_buffer TYPE SORTED TABLE OF string WITH UNIQUE KEY table_line,
lv_value TYPE string,
lv_value_lowercase TYPE string,
lv_syindex TYPE char3,
lv_errormessage TYPE string, "ins issue #237
lv_columns TYPE i,
lt_columns TYPE zexcel_t_fieldcatalog,
lv_maxcol TYPE i,
lv_maxrow TYPE i,
lo_iterator TYPE REF TO cl_object_collection_iterator,
lo_style_cond TYPE REF TO zcl_excel_style_cond,
lo_curtable TYPE REF TO zcl_excel_table.
FIELD-SYMBOLS:
<ls_field_catalog> TYPE zexcel_s_fieldcatalog,
<ls_field_catalog_custom> TYPE zexcel_s_fieldcatalog,
<fs_table_line> TYPE any,
<fs_fldval> TYPE any.
ls_settings = is_table_settings.
IF ls_settings-top_left_column IS INITIAL.
ls_settings-top_left_column = lc_top_left_column.
ENDIF.
IF ls_settings-table_style IS INITIAL.
ls_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ENDIF.
IF ls_settings-top_left_row IS INITIAL.
ls_settings-top_left_row = lc_top_left_row.
ENDIF.
IF it_field_catalog IS NOT SUPPLIED.
lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = ip_table ).
ELSE.
lt_field_catalog = it_field_catalog.
ENDIF.
SORT lt_field_catalog BY position.
*--------------------------------------------------------------------*
* issue #237 Check if overlapping areas exist Start
*--------------------------------------------------------------------*
"Get the number of columns for the current table
lt_columns = lt_field_catalog.
DELETE lt_columns WHERE dynpfld NE abap_true.
DESCRIBE TABLE lt_columns LINES lv_columns.
"Calculate the top left row of the current table
lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ).
lv_row_int = ls_settings-top_left_row.
"Get number of row for the current table
DESCRIBE TABLE ip_table LINES lv_rows.
"Calculate the bottom right row for the current table
lv_maxcol = lv_column_int + lv_columns - 1.
lv_maxrow = lv_row_int + lv_rows - 1.
ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( lv_maxcol ).
ls_settings-bottom_right_row = lv_maxrow.
lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ).
lo_iterator = me->tables->get_iterator( ).
WHILE lo_iterator->has_next( ) EQ abap_true.
lo_curtable ?= lo_iterator->get_next( ).
IF ( ( ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row )
OR
( ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row )
)
AND
( ( lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) )
OR
( lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) )
).
lv_errormessage = 'Table overlaps with previously bound table and will not be added to worksheet.'(400).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
ENDWHILE.
*--------------------------------------------------------------------*
* issue #237 Check if overlapping areas exist End
*--------------------------------------------------------------------*
CREATE OBJECT lo_table.
lo_table->settings = ls_settings.
lo_table->set_data( ir_data = ip_table ).
lv_id = me->excel->get_next_table_id( ).
lo_table->set_id( iv_id = lv_id ).
* lo_table->fieldcat = lt_field_catalog[].
me->tables->add( lo_table ).
* It is better to loop column by column (only visible column)
LOOP AT lt_field_catalog ASSIGNING <ls_field_catalog> WHERE dynpfld EQ abap_true.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
" Due restrinction of new table object we cannot have two column with the same name
" Check if a column with the same name exists, if exists add a counter
" If no medium description is provided we try to use small or long
* lv_value = <ls_field_catalog>-scrtext_m.
FIELD-SYMBOLS: <scrtxt1> TYPE any,
<scrtxt2> TYPE any,
<scrtxt3> TYPE any.
CASE iv_default_descr.
WHEN 'M'.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
WHEN 'S'.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
WHEN 'L'.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt3>.
WHEN OTHERS.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
ENDCASE.
IF <scrtxt1> IS NOT INITIAL.
lv_value = <scrtxt1>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSEIF <scrtxt2> IS NOT INITIAL.
lv_value = <scrtxt2>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSEIF <scrtxt3> IS NOT INITIAL.
lv_value = <scrtxt3>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSE.
lv_value = 'Column'. " default value as Excel does
<ls_field_catalog>-scrtext_l = lv_value.
ENDIF.
WHILE 1 = 1.
lv_value_lowercase = lv_value.
TRANSLATE lv_value_lowercase TO LOWER CASE.
READ TABLE lt_column_name_buffer TRANSPORTING NO FIELDS WITH KEY table_line = lv_value_lowercase BINARY SEARCH.
IF sy-subrc <> 0.
<ls_field_catalog>-scrtext_l = lv_value.
INSERT lv_value_lowercase INTO TABLE lt_column_name_buffer.
EXIT.
ELSE.
lv_syindex = sy-index.
CONCATENATE <ls_field_catalog>-scrtext_l lv_syindex INTO lv_value.
ENDIF.
ENDWHILE.
" First of all write column header
IF <ls_field_catalog>-style_header IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_value
ip_style = <ls_field_catalog>-style_header ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_value ).
ENDIF.
ADD 1 TO lv_row_int.
LOOP AT ip_table ASSIGNING <fs_table_line>.
ASSIGN COMPONENT <ls_field_catalog>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>.
" issue #290 Add formula support in table
IF <ls_field_catalog>-formula EQ abap_true.
IF <ls_field_catalog>-style IS NOT INITIAL.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_abap_type = <ls_field_catalog>-abap_type
ip_style = <ls_field_catalog>-style ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_style = <ls_field_catalog>-style ).
ENDIF.
ELSEIF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_abap_type = <ls_field_catalog>-abap_type ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval> ).
ENDIF.
ELSE.
IF <ls_field_catalog>-style IS NOT INITIAL.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval>
ip_abap_type = <ls_field_catalog>-abap_type
ip_style = <ls_field_catalog>-style ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval>
ip_style = <ls_field_catalog>-style ).
ENDIF.
ELSE.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_abap_type = <ls_field_catalog>-abap_type
ip_value = <fs_fldval> ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval> ).
ENDIF.
ENDIF.
ENDIF.
ADD 1 TO lv_row_int.
ENDLOOP.
IF sy-subrc <> 0 AND iv_no_line_if_empty = abap_false. "create empty row if table has no data
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = space ).
ADD 1 TO lv_row_int.
ENDIF.
*--------------------------------------------------------------------*
" totals
*--------------------------------------------------------------------*
IF <ls_field_catalog>-totals_function IS NOT INITIAL.
lv_formula = lo_table->get_totals_formula( ip_column = <ls_field_catalog>-scrtext_l ip_function = <ls_field_catalog>-totals_function ).
IF <ls_field_catalog>-style_total IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = lv_formula
ip_style = <ls_field_catalog>-style_total ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = lv_formula ).
ENDIF.
ENDIF.
lv_row_int = ls_settings-top_left_row.
ADD 1 TO lv_column_int.
*--------------------------------------------------------------------*
" conditional formatting
*--------------------------------------------------------------------*
IF <ls_field_catalog>-style_cond IS NOT INITIAL.
lv_first_row = ls_settings-top_left_row + 1. " +1 to exclude header
lv_last_row = ls_settings-top_left_row + lv_rows.
lo_style_cond = me->get_style_cond( <ls_field_catalog>-style_cond ).
lo_style_cond->set_range( ip_start_column = lv_column_alpha
ip_start_row = lv_first_row
ip_stop_column = lv_column_alpha
ip_stop_row = lv_last_row ).
ENDIF.
ENDLOOP.
*--------------------------------------------------------------------*
" Set field catalog
*--------------------------------------------------------------------*
lo_table->fieldcat = lt_field_catalog[].
es_table_settings = ls_settings.
es_table_settings-bottom_right_column = lv_column_alpha.
" >> Issue #291
IF ip_table IS INITIAL.
es_table_settings-bottom_right_row = ls_settings-top_left_row + 2. "Last rows
ELSE.
es_table_settings-bottom_right_row = ls_settings-top_left_row + lv_rows + 1. "Last rows
ENDIF.
" << Issue #291
ENDMETHOD. "BIND_TABLE
METHOD calculate_cell_width.
*--------------------------------------------------------------------*
* issue #293 - Roberto Bianco
* - Christian Assig 2014-03-14
*
* changes: - Calculate widths using SAPscript font metrics
* (transaction SE73)
* - Calculate the width of dates
* - Add additional width for auto filter buttons
* - Add cell padding to simulate Excel behavior
*--------------------------------------------------------------------*
CONSTANTS:
lc_default_font_name TYPE zexcel_style_font_name VALUE 'Calibri', "#EC NOTEXT
lc_default_font_height TYPE tdfontsize VALUE '110',
lc_excel_cell_padding TYPE float VALUE '0.75'.
DATA: ld_cell_value TYPE zexcel_cell_value,
ld_current_character TYPE c LENGTH 1,
ld_style_guid TYPE zexcel_cell_style,
ls_stylemapping TYPE zexcel_s_stylemapping,
lo_table_object TYPE REF TO object,
lo_table TYPE REF TO zcl_excel_table,
ld_table_top_left_column TYPE zexcel_cell_column,
ld_table_bottom_right_column TYPE zexcel_cell_column,
ld_flag_contains_auto_filter TYPE abap_bool VALUE abap_false,
ld_flag_bold TYPE abap_bool VALUE abap_false,
ld_flag_italic TYPE abap_bool VALUE abap_false,
ld_date TYPE d,
ld_date_char TYPE c LENGTH 50,
ld_font_height TYPE tdfontsize VALUE lc_default_font_height,
lt_itcfc TYPE STANDARD TABLE OF itcfc,
ld_offset TYPE i,
ld_length TYPE i,
ld_uccp TYPE i,
ls_font_metric TYPE mty_s_font_metric,
ld_width_from_font_metrics TYPE i,
ld_font_family TYPE itcfh-tdfamily,
ld_font_name TYPE zexcel_style_font_name VALUE lc_default_font_name,
lt_font_families LIKE STANDARD TABLE OF ld_font_family,
ls_font_cache TYPE mty_s_font_cache.
FIELD-SYMBOLS: <ls_font_cache> TYPE mty_s_font_cache,
<ls_font_metric> TYPE mty_s_font_metric,
<ls_itcfc> TYPE itcfc.
" Determine cell content and cell style
me->get_cell( EXPORTING ip_column = ip_column
ip_row = ip_row
IMPORTING ep_value = ld_cell_value
ep_guid = ld_style_guid ).
" ABAP2XLSX uses tables to define areas containing headers and
" auto-filters. Find out if the current cell is in the header
" of one of these tables.
LOOP AT me->tables->collection INTO lo_table_object.
" Downcast: OBJECT -> ZCL_EXCEL_TABLE
lo_table ?= lo_table_object.
" Convert column letters to corresponding integer values
ld_table_top_left_column =
zcl_excel_common=>convert_column2int(
lo_table->settings-top_left_column ).
ld_table_bottom_right_column =
zcl_excel_common=>convert_column2int(
lo_table->settings-bottom_right_column ).
" Is the current cell part of the table header?
IF ip_column BETWEEN ld_table_top_left_column AND
ld_table_bottom_right_column AND
ip_row EQ lo_table->settings-top_left_row.
" Current cell is part of the table header
" -> Assume that an auto filter is present and that the font is
" bold
ld_flag_contains_auto_filter = abap_true.
ld_flag_bold = abap_true.
ENDIF.
ENDLOOP.
" If a style GUID is present, read style attributes
IF ld_style_guid IS NOT INITIAL.
TRY.
" Read style attributes
ls_stylemapping = me->excel->get_style_to_guid( ld_style_guid ).
" If the current cell contains the default date format,
" convert the cell value to a date and calculate its length
IF ls_stylemapping-complete_style-number_format-format_code =
zcl_excel_style_number_format=>c_format_date_std.
" Convert excel date to ABAP date
ld_date =
zcl_excel_common=>excel_string_to_date( ld_cell_value ).
" Format ABAP date using user's formatting settings
WRITE ld_date TO ld_date_char.
" Remember the formatted date to calculate the cell size
ld_cell_value = ld_date_char.
ENDIF.
" Read the font size and convert it to the font height
" used by SAPscript (multiplication by 10)
IF ls_stylemapping-complete_stylex-font-size = abap_true.
ld_font_height = ls_stylemapping-complete_style-font-size * 10.
ENDIF.
" If set, remember the font name
IF ls_stylemapping-complete_stylex-font-name = abap_true.
ld_font_name = ls_stylemapping-complete_style-font-name.
ENDIF.
" If set, remember whether font is bold and italic.
IF ls_stylemapping-complete_stylex-font-bold = abap_true.
ld_flag_bold = ls_stylemapping-complete_style-font-bold.
ENDIF.
IF ls_stylemapping-complete_stylex-font-italic = abap_true.
ld_flag_italic = ls_stylemapping-complete_style-font-italic.
ENDIF.
CATCH zcx_excel. "#EC NO_HANDLER
" Style GUID is present, but style was not found
" Continue with default values
ENDTRY.
ENDIF.
" Check if the same font (font name and font attributes) was already
" used before
READ TABLE mth_font_cache
WITH TABLE KEY
font_name = ld_font_name
font_height = ld_font_height
flag_bold = ld_flag_bold
flag_italic = ld_flag_italic
ASSIGNING <ls_font_cache>.
IF sy-subrc <> 0.
" Font is used for the first time
" Add the font to our local font cache
ls_font_cache-font_name = ld_font_name.
ls_font_cache-font_height = ld_font_height.
ls_font_cache-flag_bold = ld_flag_bold.
ls_font_cache-flag_italic = ld_flag_italic.
INSERT ls_font_cache INTO TABLE mth_font_cache
ASSIGNING <ls_font_cache>.
" Determine the SAPscript font family name from the Excel
" font name
SELECT tdfamily
FROM tfo01
INTO TABLE lt_font_families
UP TO 1 ROWS
WHERE tdtext = ld_font_name
ORDER BY PRIMARY KEY.
" Check if a matching font family was found
" Fonts can be uploaded from TTF files using transaction SE73
IF lines( lt_font_families ) > 0.
READ TABLE lt_font_families INDEX 1 INTO ld_font_family.
" Load font metrics (returns a table with the size of each letter
" in the font)
CALL FUNCTION 'LOAD_FONT'
EXPORTING
family = ld_font_family
height = ld_font_height
printer = 'SWIN'
bold = ld_flag_bold
italic = ld_flag_italic
TABLES
metric = lt_itcfc
EXCEPTIONS
font_family = 1
codepage = 2
device_type = 3
OTHERS = 4.
IF sy-subrc <> 0.
CLEAR lt_itcfc.
ENDIF.
" For faster access, convert each character number to the actual
" character, and store the characters and their sizes in a hash
" table
LOOP AT lt_itcfc ASSIGNING <ls_itcfc>.
ld_uccp = <ls_itcfc>-cpcharno.
ls_font_metric-char =
cl_abap_conv_in_ce=>uccpi( ld_uccp ).
ls_font_metric-char_width = <ls_itcfc>-tdcwidths.
INSERT ls_font_metric
INTO TABLE <ls_font_cache>-th_font_metrics.
ENDLOOP.
ENDIF.
ENDIF.
" Calculate the cell width
" If available, use font metrics
IF lines( <ls_font_cache>-th_font_metrics ) = 0.
" Font metrics are not available
" -> Calculate the cell width using only the font size
ld_length = strlen( ld_cell_value ).
ep_width = ld_length * ld_font_height / lc_default_font_height + lc_excel_cell_padding.
ELSE.
" Font metrics are available
" Calculate the size of the text by adding the sizes of each
" letter
ld_length = strlen( ld_cell_value ).
DO ld_length TIMES.
" Subtract 1, because the first character is at offset 0
ld_offset = sy-index - 1.
" Read the current character from the cell value
ld_current_character = ld_cell_value+ld_offset(1).
" Look up the size of the current letter
READ TABLE <ls_font_cache>-th_font_metrics
WITH TABLE KEY char = ld_current_character
ASSIGNING <ls_font_metric>.
IF sy-subrc = 0.
" The size of the letter is known
" -> Add the actual size of the letter
ADD <ls_font_metric>-char_width TO ld_width_from_font_metrics.
ELSE.
" The size of the letter is unknown
" -> Add the font height as the default letter size
ADD ld_font_height TO ld_width_from_font_metrics.
ENDIF.
ENDDO.
" Add cell padding (Excel makes columns a bit wider than the space
" that is needed for the text itself) and convert unit
" (division by 100)
ep_width = ld_width_from_font_metrics / 100 + lc_excel_cell_padding.
ENDIF.
" If the current cell contains an auto filter, make it a bit wider.
" The size used by the auto filter button does not depend on the font
" size.
IF ld_flag_contains_auto_filter = abap_true.
ADD 2 TO ep_width.
ENDIF.
ENDMETHOD. "CALCULATE_CELL_WIDTH
METHOD calculate_column_widths.
TYPES:
BEGIN OF t_auto_size,
col_index TYPE int4,
width TYPE float,
END OF t_auto_size.
TYPES: tt_auto_size TYPE TABLE OF t_auto_size.
DATA: lo_column_iterator TYPE REF TO cl_object_collection_iterator,
lo_column TYPE REF TO zcl_excel_column.
DATA: auto_size TYPE flag.
DATA: auto_sizes TYPE tt_auto_size.
DATA: count TYPE int4.
DATA: highest_row TYPE int4.
DATA: width TYPE float.
FIELD-SYMBOLS: <auto_size> LIKE LINE OF auto_sizes.
lo_column_iterator = me->get_columns_iterator( ).
WHILE lo_column_iterator->has_next( ) = abap_true.
lo_column ?= lo_column_iterator->get_next( ).
auto_size = lo_column->get_auto_size( ).
IF auto_size = abap_true.
APPEND INITIAL LINE TO auto_sizes ASSIGNING <auto_size>.
<auto_size>-col_index = lo_column->get_column_index( ).
<auto_size>-width = -1.
ENDIF.
ENDWHILE.
" There is only something to do if there are some auto-size columns
IF NOT auto_sizes IS INITIAL.
highest_row = me->get_highest_row( ).
LOOP AT auto_sizes ASSIGNING <auto_size>.
count = 1.
WHILE count <= highest_row.
* Do not check merged cells
IF is_cell_merged(
ip_column = <auto_size>-col_index
ip_row = count ) = abap_false.
width = calculate_cell_width( ip_column = <auto_size>-col_index " issue #155 - less restrictive typing for ip_column
ip_row = count ).
IF width > <auto_size>-width.
<auto_size>-width = width.
ENDIF.
ENDIF.
count = count + 1.
ENDWHILE.
lo_column = me->get_column( <auto_size>-col_index ). " issue #155 - less restrictive typing for ip_column
lo_column->set_width( <auto_size>-width ).
ENDLOOP.
ENDIF.
ENDMETHOD. "CALCULATE_COLUMN_WIDTHS
METHOD change_cell_style.
" issue # 139
DATA: stylemapping TYPE zexcel_s_stylemapping,
complete_style TYPE zexcel_s_cstyle_complete,
complete_stylex TYPE zexcel_s_cstylex_complete,
borderx TYPE zexcel_s_cstylex_border,
l_guid TYPE zexcel_cell_style. "issue # 177
* We have a lot of parameters. Use some macros to make the coding more structured
DEFINE clear_initial_colorxfields.
IF &1-rgb IS INITIAL.
CLEAR &2-rgb.
ENDIF.
IF &1-indexed IS INITIAL.
CLEAR &2-indexed.
ENDIF.
IF &1-theme IS INITIAL.
CLEAR &2-theme.
ENDIF.
IF &1-tint IS INITIAL.
CLEAR &2-tint.
ENDIF.
END-OF-DEFINITION.
DEFINE move_supplied_borders.
IF ip_&1 IS SUPPLIED. " only act if parameter was supplied
IF ip_x&1 IS SUPPLIED. "
borderx = ip_x&1. " use supplied x-parameter
ELSE.
CLEAR borderx WITH 'X'.
* clear in a way that would be expected to work easily
IF ip_&1-border_style IS INITIAL.
CLEAR borderx-border_style.
ENDIF.
clear_initial_colorxfields ip_&1-border_color borderx-border_color.
ENDIF.
MOVE-CORRESPONDING ip_&1 TO complete_style-&2.
MOVE-CORRESPONDING borderx TO complete_stylex-&2.
ENDIF.
END-OF-DEFINITION.
* First get current stylsettings
TRY.
me->get_cell( EXPORTING ip_column = ip_column " Cell Column
ip_row = ip_row " Cell Row
IMPORTING ep_guid = l_guid )." Cell Value ). "issue # 177
stylemapping = me->excel->get_style_to_guid( l_guid ). "issue # 177
complete_style = stylemapping-complete_style.
complete_stylex = stylemapping-complete_stylex.
CATCH zcx_excel.
* Error --> use submitted style
ENDTRY.
* move_supplied_multistyles: complete.
IF ip_complete IS SUPPLIED.
IF ip_xcomplete IS NOT SUPPLIED.
zcx_excel=>raise_text( 'Complete styleinfo has to be supplied with corresponding X-field' ).
ENDIF.
MOVE-CORRESPONDING ip_complete TO complete_style.
MOVE-CORRESPONDING ip_xcomplete TO complete_stylex.
ENDIF.
IF ip_font IS SUPPLIED.
DATA: fontx LIKE ip_xfont.
IF ip_xfont IS SUPPLIED.
fontx = ip_xfont.
ELSE.
* Only supplied values should be used - exception: Flags bold and italic strikethrough underline
MOVE 'X' TO: fontx-bold,
fontx-italic,
fontx-strikethrough,
fontx-underline_mode.
CLEAR fontx-color WITH 'X'.
clear_initial_colorxfields ip_font-color fontx-color.
IF ip_font-family IS NOT INITIAL.
fontx-family = 'X'.
ENDIF.
IF ip_font-name IS NOT INITIAL.
fontx-name = 'X'.
ENDIF.
IF ip_font-scheme IS NOT INITIAL.
fontx-scheme = 'X'.
ENDIF.
IF ip_font-size IS NOT INITIAL.
fontx-size = 'X'.
ENDIF.
IF ip_font-underline_mode IS NOT INITIAL.
fontx-underline_mode = 'X'.
ENDIF.
ENDIF.
MOVE-CORRESPONDING ip_font TO complete_style-font.
MOVE-CORRESPONDING fontx TO complete_stylex-font.
* Correction for undeline mode
ENDIF.
IF ip_fill IS SUPPLIED.
DATA: fillx LIKE ip_xfill.
IF ip_xfill IS SUPPLIED.
fillx = ip_xfill.
ELSE.
CLEAR fillx WITH 'X'.
IF ip_fill-filltype IS INITIAL.
CLEAR fillx-filltype.
ENDIF.
clear_initial_colorxfields ip_fill-fgcolor fillx-fgcolor.
clear_initial_colorxfields ip_fill-bgcolor fillx-bgcolor.
ENDIF.
MOVE-CORRESPONDING ip_fill TO complete_style-fill.
MOVE-CORRESPONDING fillx TO complete_stylex-fill.
ENDIF.
IF ip_borders IS SUPPLIED.
DATA: bordersx LIKE ip_xborders.
IF ip_xborders IS SUPPLIED.
bordersx = ip_xborders.
ELSE.
CLEAR bordersx WITH 'X'.
IF ip_borders-allborders-border_style IS INITIAL.
CLEAR bordersx-allborders-border_style.
ENDIF.
IF ip_borders-diagonal-border_style IS INITIAL.
CLEAR bordersx-diagonal-border_style.
ENDIF.
IF ip_borders-down-border_style IS INITIAL.
CLEAR bordersx-down-border_style.
ENDIF.
IF ip_borders-left-border_style IS INITIAL.
CLEAR bordersx-left-border_style.
ENDIF.
IF ip_borders-right-border_style IS INITIAL.
CLEAR bordersx-right-border_style.
ENDIF.
IF ip_borders-top-border_style IS INITIAL.
CLEAR bordersx-top-border_style.
ENDIF.
clear_initial_colorxfields ip_borders-allborders-border_color bordersx-allborders-border_color.
clear_initial_colorxfields ip_borders-diagonal-border_color bordersx-diagonal-border_color.
clear_initial_colorxfields ip_borders-down-border_color bordersx-down-border_color.
clear_initial_colorxfields ip_borders-left-border_color bordersx-left-border_color.
clear_initial_colorxfields ip_borders-right-border_color bordersx-right-border_color.
clear_initial_colorxfields ip_borders-top-border_color bordersx-top-border_color.
ENDIF.
MOVE-CORRESPONDING ip_borders TO complete_style-borders.
MOVE-CORRESPONDING bordersx TO complete_stylex-borders.
ENDIF.
IF ip_alignment IS SUPPLIED.
DATA: alignmentx LIKE ip_xalignment.
IF ip_xalignment IS SUPPLIED.
alignmentx = ip_xalignment.
ELSE.
CLEAR alignmentx WITH 'X'.
IF ip_alignment-horizontal IS INITIAL.
CLEAR alignmentx-horizontal.
ENDIF.
IF ip_alignment-vertical IS INITIAL.
CLEAR alignmentx-vertical.
ENDIF.
ENDIF.
MOVE-CORRESPONDING ip_alignment TO complete_style-alignment.
MOVE-CORRESPONDING alignmentx TO complete_stylex-alignment.
ENDIF.
IF ip_protection IS SUPPLIED.
MOVE-CORRESPONDING ip_protection TO complete_style-protection.
IF ip_xprotection IS SUPPLIED.
MOVE-CORRESPONDING ip_xprotection TO complete_stylex-protection.
ELSE.
IF ip_protection-hidden IS NOT INITIAL.
complete_stylex-protection-hidden = 'X'.
ENDIF.
IF ip_protection-locked IS NOT INITIAL.
complete_stylex-protection-locked = 'X'.
ENDIF.
ENDIF.
ENDIF.
move_supplied_borders : borders_allborders borders-allborders,
borders_diagonal borders-diagonal ,
borders_down borders-down ,
borders_left borders-left ,
borders_right borders-right ,
borders_top borders-top .
DEFINE move_supplied_singlestyles.
IF ip_&1 IS SUPPLIED.
complete_style-&2 = ip_&1.
complete_stylex-&2 = 'X'.
ENDIF.
END-OF-DEFINITION.
move_supplied_singlestyles: number_format_format_code number_format-format_code,
font_bold font-bold,
font_color font-color,
font_color_rgb font-color-rgb,
font_color_indexed font-color-indexed,
font_color_theme font-color-theme,
font_color_tint font-color-tint,
font_family font-family,
font_italic font-italic,
font_name font-name,
font_scheme font-scheme,
font_size font-size,
font_strikethrough font-strikethrough,
font_underline font-underline,
font_underline_mode font-underline_mode,
fill_filltype fill-filltype,
fill_rotation fill-rotation,
fill_fgcolor fill-fgcolor,
fill_fgcolor_rgb fill-fgcolor-rgb,
fill_fgcolor_indexed fill-fgcolor-indexed,
fill_fgcolor_theme fill-fgcolor-theme,
fill_fgcolor_tint fill-fgcolor-tint,
fill_bgcolor fill-bgcolor,
fill_bgcolor_rgb fill-bgcolor-rgb,
fill_bgcolor_indexed fill-bgcolor-indexed,
fill_bgcolor_theme fill-bgcolor-theme,
fill_bgcolor_tint fill-bgcolor-tint,
fill_gradtype_type fill-gradtype-type,
fill_gradtype_degree fill-gradtype-degree,
fill_gradtype_bottom fill-gradtype-bottom,
fill_gradtype_left fill-gradtype-left,
fill_gradtype_top fill-gradtype-top,
fill_gradtype_right fill-gradtype-right,
fill_gradtype_position1 fill-gradtype-position1,
fill_gradtype_position2 fill-gradtype-position2,
fill_gradtype_position3 fill-gradtype-position3,
borders_diagonal_mode borders-diagonal_mode,
alignment_horizontal alignment-horizontal,
alignment_vertical alignment-vertical,
alignment_textrotation alignment-textrotation,
alignment_wraptext alignment-wraptext,
alignment_shrinktofit alignment-shrinktofit,
alignment_indent alignment-indent,
protection_hidden protection-hidden,
protection_locked protection-locked,
borders_allborders_style borders-allborders-border_style,
borders_allborders_color borders-allborders-border_color,
borders_allbo_color_rgb borders-allborders-border_color-rgb,
borders_allbo_color_indexed borders-allborders-border_color-indexed,
borders_allbo_color_theme borders-allborders-border_color-theme,
borders_allbo_color_tint borders-allborders-border_color-tint,
borders_diagonal_style borders-diagonal-border_style,
borders_diagonal_color borders-diagonal-border_color,
borders_diagonal_color_rgb borders-diagonal-border_color-rgb,
borders_diagonal_color_inde borders-diagonal-border_color-indexed,
borders_diagonal_color_them borders-diagonal-border_color-theme,
borders_diagonal_color_tint borders-diagonal-border_color-tint,
borders_down_style borders-down-border_style,
borders_down_color borders-down-border_color,
borders_down_color_rgb borders-down-border_color-rgb,
borders_down_color_indexed borders-down-border_color-indexed,
borders_down_color_theme borders-down-border_color-theme,
borders_down_color_tint borders-down-border_color-tint,
borders_left_style borders-left-border_style,
borders_left_color borders-left-border_color,
borders_left_color_rgb borders-left-border_color-rgb,
borders_left_color_indexed borders-left-border_color-indexed,
borders_left_color_theme borders-left-border_color-theme,
borders_left_color_tint borders-left-border_color-tint,
borders_right_style borders-right-border_style,
borders_right_color borders-right-border_color,
borders_right_color_rgb borders-right-border_color-rgb,
borders_right_color_indexed borders-right-border_color-indexed,
borders_right_color_theme borders-right-border_color-theme,
borders_right_color_tint borders-right-border_color-tint,
borders_top_style borders-top-border_style,
borders_top_color borders-top-border_color,
borders_top_color_rgb borders-top-border_color-rgb,
borders_top_color_indexed borders-top-border_color-indexed,
borders_top_color_theme borders-top-border_color-theme,
borders_top_color_tint borders-top-border_color-tint.
* Now we have a completly filled styles.
* This can be used to get the guid
* Return guid if requested. Might be used if copy&paste of styles is requested
ep_guid = me->excel->get_static_cellstyle_guid( ip_cstyle_complete = complete_style
ip_cstylex_complete = complete_stylex ).
me->set_cell_style( ip_column = ip_column
ip_row = ip_row
ip_style = ep_guid ).
ENDMETHOD. "CHANGE_CELL_STYLE
METHOD constructor.
DATA: lv_title TYPE zexcel_sheet_title.
me->excel = ip_excel.
* CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases
* IMPORTING
* ev_guid_16 = me->guid.
me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call
IF ip_title IS NOT INITIAL.
lv_title = ip_title.
ELSE.
* lv_title = me->guid. " del issue #154 - Names of worksheets
lv_title = me->generate_title( ). " ins issue #154 - Names of worksheets
ENDIF.
me->set_title( ip_title = lv_title ).
CREATE OBJECT sheet_setup.
CREATE OBJECT styles_cond.
CREATE OBJECT data_validations.
CREATE OBJECT tables.
CREATE OBJECT columns.
CREATE OBJECT rows.
CREATE OBJECT ranges. " issue #163
CREATE OBJECT mo_pagebreaks.
CREATE OBJECT drawings
EXPORTING
ip_type = zcl_excel_drawing=>type_image.
CREATE OBJECT charts
EXPORTING
ip_type = zcl_excel_drawing=>type_chart.
me->zif_excel_sheet_protection~initialize( ).
me->zif_excel_sheet_properties~initialize( ).
CREATE OBJECT hyperlinks.
CREATE OBJECT comments. " (+) Issue #180
* initialize active cell coordinates
active_cell-cell_row = 1.
active_cell-cell_column = 1.
* inizialize dimension range
lower_cell-cell_row = 1.
lower_cell-cell_column = 1.
upper_cell-cell_row = 1.
upper_cell-cell_column = 1.
ENDMETHOD. "CONSTRUCTOR
METHOD delete_merge.
DATA: lv_column TYPE i.
*--------------------------------------------------------------------*
* If cell information is passed delete merge including this cell,
* otherwise delete all merges
*--------------------------------------------------------------------*
IF ip_cell_column IS INITIAL
OR ip_cell_row IS INITIAL.
CLEAR me->mt_merged_cells.
ELSE.
lv_column = zcl_excel_common=>convert_column2int( ip_cell_column ).
LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS
WHERE
( row_from <= ip_cell_row AND row_to >= ip_cell_row )
AND
( col_from <= lv_column AND col_to >= lv_column ).
DELETE me->mt_merged_cells.
EXIT.
ENDLOOP.
ENDIF.
ENDMETHOD. "DELETE_MERGE
METHOD delete_row_outline.
DELETE me->mt_row_outlines WHERE row_from = iv_row_from
AND row_to = iv_row_to.
IF sy-subrc <> 0. " didn't find outline that was to be deleted
zcx_excel=>raise_text( 'Row outline to be deleted does not exist' ).
ENDIF.
ENDMETHOD. "DELETE_ROW_OUTLINE
METHOD freeze_panes.
IF ip_num_columns IS NOT SUPPLIED AND ip_num_rows IS NOT SUPPLIED.
zcx_excel=>raise_text( 'Pleas provide number of rows and/or columns to freeze' ).
ENDIF.
IF ip_num_columns IS SUPPLIED AND ip_num_columns <= 0.
zcx_excel=>raise_text( 'Number of columns to freeze should be positive' ).
ENDIF.
IF ip_num_rows IS SUPPLIED AND ip_num_rows <= 0.
zcx_excel=>raise_text( 'Number of rows to freeze should be positive' ).
ENDIF.
freeze_pane_cell_column = ip_num_columns + 1.
freeze_pane_cell_row = ip_num_rows + 1.
ENDMETHOD. "FREEZE_PANES
METHOD generate_title.
DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator,
lo_worksheet TYPE REF TO zcl_excel_worksheet.
DATA: t_titles TYPE HASHED TABLE OF zexcel_sheet_title WITH UNIQUE KEY table_line,
title TYPE zexcel_sheet_title,
sheetnumber TYPE i.
* Get list of currently used titles
lo_worksheets_iterator = me->excel->get_worksheets_iterator( ).
WHILE lo_worksheets_iterator->has_next( ) = abap_true.
lo_worksheet ?= lo_worksheets_iterator->get_next( ).
title = lo_worksheet->get_title( ).
INSERT title INTO TABLE t_titles.
ADD 1 TO sheetnumber.
ENDWHILE.
* Now build sheetnumber. Increase counter until we hit a number that is not used so far
ADD 1 TO sheetnumber. " Start counting with next number
DO.
title = sheetnumber.
SHIFT title LEFT DELETING LEADING space.
CONCATENATE 'Sheet'(001) title INTO ep_title.
INSERT ep_title INTO TABLE t_titles.
IF sy-subrc = 0. " Title not used so far --> take it
EXIT.
ENDIF.
ADD 1 TO sheetnumber.
ENDDO.
ENDMETHOD. "GENERATE_TITLE
METHOD get_active_cell.
DATA: lv_active_column TYPE zexcel_cell_column_alpha,
lv_active_row TYPE string.
lv_active_column = zcl_excel_common=>convert_column2alpha( active_cell-cell_column ).
lv_active_row = active_cell-cell_row.
SHIFT lv_active_row RIGHT DELETING TRAILING space.
SHIFT lv_active_row LEFT DELETING LEADING space.
CONCATENATE lv_active_column lv_active_row INTO ep_active_cell.
ENDMETHOD. "GET_ACTIVE_CELL
METHOD get_cell.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE sheet_content INTO ls_sheet_content WITH TABLE KEY cell_row = ip_row
cell_column = lv_column.
ep_rc = sy-subrc.
ep_value = ls_sheet_content-cell_value.
ep_guid = ls_sheet_content-cell_style. " issue 139 - added this to be used for columnwidth calculation
ep_formula = ls_sheet_content-cell_formula.
" Addition to solve issue #120, contribution by Stefan Schmöcker
DATA: style_iterator TYPE REF TO cl_object_collection_iterator,
style TYPE REF TO zcl_excel_style.
IF ep_style IS REQUESTED.
style_iterator = me->excel->get_styles_iterator( ).
WHILE style_iterator->has_next( ) = 'X'.
style ?= style_iterator->get_next( ).
IF style->get_guid( ) = ls_sheet_content-cell_style.
ep_style = style.
EXIT.
ENDIF.
ENDWHILE.
ENDIF.
ENDMETHOD. "GET_CELL
METHOD get_column.
DATA: lv_column TYPE zexcel_cell_column.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
eo_column = me->columns->get( ip_index = lv_column ).
IF eo_column IS NOT BOUND.
eo_column = me->add_new_column( ip_column ).
ENDIF.
ENDMETHOD. "GET_COLUMN
METHOD get_columns.
eo_columns = me->columns.
ENDMETHOD. "GET_COLUMNS
METHOD get_columns_iterator.
eo_iterator = me->columns->get_iterator( ).
ENDMETHOD. "GET_COLUMNS_ITERATOR
METHOD get_comments.
DATA: lo_comment TYPE REF TO zcl_excel_comment,
lo_iterator TYPE REF TO cl_object_collection_iterator.
CREATE OBJECT r_comments.
lo_iterator = comments->get_iterator( ).
WHILE lo_iterator->has_next( ) = abap_true.
lo_comment ?= lo_iterator->get_next( ).
r_comments->include( lo_comment ).
ENDWHILE.
ENDMETHOD. "get_comments
METHOD get_comments_iterator.
eo_iterator = comments->get_iterator( ).
ENDMETHOD. "get_comments_iterator
METHOD get_data_validations_iterator.
eo_iterator = me->data_validations->get_iterator( ).
ENDMETHOD. "GET_DATA_VALIDATIONS_ITERATOR
METHOD get_data_validations_size.
ep_size = me->data_validations->size( ).
ENDMETHOD. "GET_DATA_VALIDATIONS_SIZE
METHOD get_default_column.
IF me->column_default IS NOT BOUND.
CREATE OBJECT me->column_default
EXPORTING
ip_index = 'A' " ????
ip_worksheet = me
ip_excel = me->excel.
ENDIF.
eo_column = me->column_default.
ENDMETHOD. "GET_DEFAULT_COLUMN
METHOD get_default_excel_date_format.
CONSTANTS: c_lang_e TYPE lang VALUE 'E'.
IF default_excel_date_format IS NOT INITIAL.
ep_default_excel_date_format = default_excel_date_format.
RETURN.
ENDIF.
"try to get defaults
TRY.
cl_abap_datfm=>get_date_format_des( EXPORTING im_langu = c_lang_e
IMPORTING ex_dateformat = default_excel_date_format ).
CATCH cx_abap_datfm_format_unknown.
ENDTRY.
" and fallback to fixed format
IF default_excel_date_format IS INITIAL.
default_excel_date_format = zcl_excel_style_number_format=>c_format_date_ddmmyyyydot.
ENDIF.
ep_default_excel_date_format = default_excel_date_format.
ENDMETHOD. "GET_DEFAULT_EXCEL_DATE_FORMAT
METHOD get_default_excel_time_format.
DATA: l_timefm TYPE xutimefm.
IF default_excel_time_format IS NOT INITIAL.
ep_default_excel_time_format = default_excel_time_format.
RETURN.
ENDIF.
* Let's get default
l_timefm = cl_abap_timefm=>get_environment_timefm( ).
CASE l_timefm.
WHEN 0.
*0 24 Hour Format (Example: 12:05:10)
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6.
WHEN 1.
*1 12 Hour Format (Example: 12:05:10 PM)
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN 2.
*2 12 Hour Format (Example: 12:05:10 pm) for now all the same. no chnage upper lower
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN 3.
*3 Hours from 0 to 11 (Example: 00:05:10 PM) for now all the same. no chnage upper lower
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN 4.
*4 Hours from 0 to 11 (Example: 00:05:10 pm) for now all the same. no chnage upper lower
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN OTHERS.
" and fallback to fixed format
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6.
ENDCASE.
ep_default_excel_time_format = default_excel_time_format.
ENDMETHOD. "GET_DEFAULT_EXCEL_TIME_FORMAT
METHOD get_default_row.
IF me->row_default IS NOT BOUND.
CREATE OBJECT me->row_default.
ENDIF.
eo_row = me->row_default.
ENDMETHOD. "GET_DEFAULT_ROW
METHOD get_dimension_range.
me->update_dimension_range( ).
IF upper_cell EQ lower_cell. "only one cell
" Worksheet not filled
* IF upper_cell-cell_coords = '0'.
IF upper_cell-cell_coords IS INITIAL.
ep_dimension_range = 'A1'.
ELSE.
ep_dimension_range = upper_cell-cell_coords.
ENDIF.
ELSE.
CONCATENATE upper_cell-cell_coords ':' lower_cell-cell_coords INTO ep_dimension_range.
ENDIF.
ENDMETHOD. "GET_DIMENSION_RANGE
METHOD get_drawings.
DATA: lo_drawing TYPE REF TO zcl_excel_drawing,
lo_iterator TYPE REF TO cl_object_collection_iterator.
CASE ip_type.
WHEN zcl_excel_drawing=>type_image.
r_drawings = drawings.
WHEN zcl_excel_drawing=>type_chart.
r_drawings = charts.
WHEN space.
CREATE OBJECT r_drawings
EXPORTING
ip_type = ''.
lo_iterator = drawings->get_iterator( ).
WHILE lo_iterator->has_next( ) = abap_true.
lo_drawing ?= lo_iterator->get_next( ).
r_drawings->include( lo_drawing ).
ENDWHILE.
lo_iterator = charts->get_iterator( ).
WHILE lo_iterator->has_next( ) = abap_true.
lo_drawing ?= lo_iterator->get_next( ).
r_drawings->include( lo_drawing ).
ENDWHILE.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "GET_DRAWINGS
METHOD get_drawings_iterator.
CASE ip_type.
WHEN zcl_excel_drawing=>type_image.
eo_iterator = drawings->get_iterator( ).
WHEN zcl_excel_drawing=>type_chart.
eo_iterator = charts->get_iterator( ).
ENDCASE.
ENDMETHOD. "GET_DRAWINGS_ITERATOR
METHOD get_freeze_cell.
ep_row = me->freeze_pane_cell_row.
ep_column = me->freeze_pane_cell_column.
ENDMETHOD. "GET_FREEZE_CELL
METHOD get_guid.
ep_guid = me->guid.
ENDMETHOD. "GET_GUID
METHOD get_header_footer_drawings.
DATA: ls_odd_header TYPE zexcel_s_worksheet_head_foot,
ls_odd_footer TYPE zexcel_s_worksheet_head_foot,
ls_even_header TYPE zexcel_s_worksheet_head_foot,
ls_even_footer TYPE zexcel_s_worksheet_head_foot,
ls_hd_ft TYPE zexcel_s_worksheet_head_foot.
FIELD-SYMBOLS: <fs_drawings> TYPE zexcel_s_drawings.
me->sheet_setup->get_header_footer( IMPORTING ep_odd_header = ls_odd_header
ep_odd_footer = ls_odd_footer
ep_even_header = ls_even_header
ep_even_footer = ls_even_footer ).
**********************************************************************
*** Odd header
ls_hd_ft = ls_odd_header.
IF ls_hd_ft-left_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-left_image.
ENDIF.
IF ls_hd_ft-right_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-right_image.
ENDIF.
IF ls_hd_ft-center_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-center_image.
ENDIF.
**********************************************************************
*** Odd footer
ls_hd_ft = ls_odd_footer.
IF ls_hd_ft-left_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-left_image.
ENDIF.
IF ls_hd_ft-right_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-right_image.
ENDIF.
IF ls_hd_ft-center_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-center_image.
ENDIF.
**********************************************************************
*** Even header
ls_hd_ft = ls_even_header.
IF ls_hd_ft-left_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-left_image.
ENDIF.
IF ls_hd_ft-right_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-right_image.
ENDIF.
IF ls_hd_ft-center_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-center_image.
ENDIF.
**********************************************************************
*** Even footer
ls_hd_ft = ls_even_footer.
IF ls_hd_ft-left_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-left_image.
ENDIF.
IF ls_hd_ft-right_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-right_image.
ENDIF.
IF ls_hd_ft-center_image IS NOT INITIAL.
APPEND INITIAL LINE TO rt_drawings ASSIGNING <fs_drawings>.
<fs_drawings>-drawing = ls_hd_ft-center_image.
ENDIF.
ENDMETHOD. "get_header_footer_drawings
METHOD get_highest_column.
me->update_dimension_range( ).
r_highest_column = me->lower_cell-cell_column.
ENDMETHOD. "GET_HIGHEST_COLUMN
METHOD get_highest_row.
me->update_dimension_range( ).
r_highest_row = me->lower_cell-cell_row.
ENDMETHOD. "GET_HIGHEST_ROW
METHOD get_hyperlinks_iterator.
eo_iterator = hyperlinks->get_iterator( ).
ENDMETHOD. "GET_HYPERLINKS_ITERATOR
METHOD get_hyperlinks_size.
ep_size = hyperlinks->size( ).
ENDMETHOD. "GET_HYPERLINKS_SIZE
METHOD get_merge.
FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells.
DATA: lv_col_from TYPE string,
lv_col_to TYPE string,
lv_row_from TYPE string,
lv_row_to TYPE string,
lv_merge_range TYPE string.
LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>.
lv_col_from = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_from ).
lv_col_to = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_to ).
lv_row_from = <ls_merged_cell>-row_from.
lv_row_to = <ls_merged_cell>-row_to .
CONCATENATE lv_col_from lv_row_from ':' lv_col_to lv_row_to
INTO lv_merge_range.
CONDENSE lv_merge_range NO-GAPS.
APPEND lv_merge_range TO merge_range.
ENDLOOP.
ENDMETHOD. "GET_MERGE
METHOD get_pagebreaks.
ro_pagebreaks = mo_pagebreaks.
ENDMETHOD. "GET_PAGEBREAKS
METHOD get_ranges_iterator.
eo_iterator = me->ranges->get_iterator( ).
ENDMETHOD. "GET_RANGES_ITERATOR
METHOD get_row.
eo_row = me->rows->get( ip_index = ip_row ).
IF eo_row IS NOT BOUND.
eo_row = me->add_new_row( ip_row ).
ENDIF.
ENDMETHOD. "GET_ROW
METHOD get_rows.
eo_rows = me->rows.
ENDMETHOD. "GET_ROWS
METHOD get_rows_iterator.
eo_iterator = me->rows->get_iterator( ).
ENDMETHOD. "GET_ROWS_ITERATOR
METHOD get_row_outlines.
rt_row_outlines = me->mt_row_outlines.
ENDMETHOD. "GET_ROW_OUTLINES
METHOD get_style_cond.
DATA: lo_style_iterator TYPE REF TO cl_object_collection_iterator,
lo_style_cond TYPE REF TO zcl_excel_style_cond.
lo_style_iterator = me->get_style_cond_iterator( ).
WHILE lo_style_iterator->has_next( ) = abap_true.
lo_style_cond ?= lo_style_iterator->get_next( ).
IF lo_style_cond->get_guid( ) = ip_guid.
eo_style_cond = lo_style_cond.
EXIT.
ENDIF.
ENDWHILE.
ENDMETHOD. "GET_STYLE_COND
METHOD get_style_cond_iterator.
eo_iterator = styles_cond->get_iterator( ).
ENDMETHOD. "GET_STYLE_COND_ITERATOR
METHOD get_tabcolor.
ev_tabcolor = me->tabcolor.
ENDMETHOD. "GET_TABCOLOR
METHOD get_table.
*--------------------------------------------------------------------*
* Comment D. Rauchenstein
* With this method, we get a fully functional Excel Upload, which solves
* a few issues of the other excel upload tools
* ZBCABA_ALSM_EXCEL_UPLOAD_EXT: Reads only up to 50 signs per Cell, Limit
* in row-Numbers. Other have Limitations of Lines, or you are not able
* to ignore filters or choosing the right tab.
*
* To get a fully functional XLSX Upload, you can use it e.g. with method
* CL_EXCEL_READER_2007->ZIF_EXCEL_READER~LOAD_FILE()
*--------------------------------------------------------------------*
FIELD-SYMBOLS: <ls_line> TYPE data.
FIELD-SYMBOLS: <lv_value> TYPE data.
DATA lv_actual_row TYPE int4.
DATA lv_actual_row_string TYPE string.
DATA lv_actual_col TYPE int4.
DATA lv_actual_col_string TYPE string.
DATA lv_errormessage TYPE string.
DATA lv_max_col TYPE zexcel_cell_column.
DATA lv_max_row TYPE int4.
DATA lv_delta_col TYPE int4.
DATA lv_value TYPE zexcel_cell_value.
DATA lv_rc TYPE sysubrc.
DATA lx_conversion_error TYPE REF TO cx_sy_conversion_error.
DATA lv_float TYPE f.
DATA lv_type.
lv_max_col = me->get_highest_column( ).
IF iv_max_col IS SUPPLIED AND iv_max_col < lv_max_col.
lv_max_col = iv_max_col.
ENDIF.
lv_max_row = me->get_highest_row( ).
IF iv_max_row IS SUPPLIED AND iv_max_row < lv_max_row.
lv_max_row = iv_max_row.
ENDIF.
*--------------------------------------------------------------------*
* The row counter begins with 1 and should be corrected with the skips
*--------------------------------------------------------------------*
lv_actual_row = iv_skipped_rows + 1.
lv_actual_col = iv_skipped_cols + 1.
TRY.
*--------------------------------------------------------------------*
* Check if we the basic features are possible with given "any table"
*--------------------------------------------------------------------*
APPEND INITIAL LINE TO et_table ASSIGNING <ls_line>.
IF sy-subrc <> 0 OR <ls_line> IS NOT ASSIGNED.
lv_errormessage = 'Error at inserting new Line to internal Table'(002).
zcx_excel=>raise_text( lv_errormessage ).
ELSE.
lv_delta_col = lv_max_col - iv_skipped_cols.
ASSIGN COMPONENT lv_delta_col OF STRUCTURE <ls_line> TO <lv_value>.
IF sy-subrc <> 0 OR <lv_value> IS NOT ASSIGNED.
lv_errormessage = 'Internal table has less columns than excel'(003).
zcx_excel=>raise_text( lv_errormessage ).
ELSE.
*--------------------------------------------------------------------*
*now we are ready for handle the table data
*--------------------------------------------------------------------*
REFRESH et_table.
*--------------------------------------------------------------------*
* Handle each Row until end on right side
*--------------------------------------------------------------------*
WHILE lv_actual_row <= lv_max_row .
*--------------------------------------------------------------------*
* Handle each Column until end on bottom
* First step is to step back on first column
*--------------------------------------------------------------------*
lv_actual_col = iv_skipped_cols + 1.
UNASSIGN <ls_line>.
APPEND INITIAL LINE TO et_table ASSIGNING <ls_line>.
IF sy-subrc <> 0 OR <ls_line> IS NOT ASSIGNED.
lv_errormessage = 'Error at inserting new Line to internal Table'(002).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
WHILE lv_actual_col <= lv_max_col.
lv_delta_col = lv_actual_col - iv_skipped_cols.
ASSIGN COMPONENT lv_delta_col OF STRUCTURE <ls_line> TO <lv_value>.
IF sy-subrc <> 0.
lv_actual_col_string = lv_actual_col.
lv_actual_row_string = lv_actual_row.
CONCATENATE 'Error at assigning field (Col:'(004) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage.
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
me->get_cell(
EXPORTING
ip_column = lv_actual_col " Cell Column
ip_row = lv_actual_row " Cell Row
IMPORTING
ep_value = lv_value " Cell Value
ep_rc = lv_rc " Return Value of ABAP Statements
).
IF lv_rc <> 0
AND lv_rc <> 4 "No found error means, zero/no value in cell
AND lv_rc <> 8. "rc is 8 when the last row contains cells with zero / no values
lv_actual_col_string = lv_actual_col.
lv_actual_row_string = lv_actual_row.
CONCATENATE 'Error at reading field value (Col:'(007) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage.
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
TRY.
DESCRIBE FIELD <lv_value> TYPE lv_type.
IF lv_type = 'D'.
<lv_value> = zcl_excel_common=>excel_string_to_date( ip_value = lv_value ).
ELSE.
<lv_value> = lv_value. "Will raise exception if data type of <lv_value> is not float (or decfloat16/34) and excel delivers exponential number e.g. -2.9398924194538267E-2
ENDIF.
CATCH cx_sy_conversion_error INTO lx_conversion_error.
"Another try with conversion to float...
IF lv_type = 'P'.
<lv_value> = lv_float = lv_value.
ELSE.
RAISE EXCEPTION lx_conversion_error. "Pass on original exception
ENDIF.
ENDTRY.
* CATCH zcx_excel. "
ADD 1 TO lv_actual_col.
ENDWHILE.
ADD 1 TO lv_actual_row.
ENDWHILE.
ENDIF.
ENDIF.
CATCH cx_sy_assign_cast_illegal_cast.
lv_actual_col_string = lv_actual_col.
lv_actual_row_string = lv_actual_row.
CONCATENATE 'Error at assigning field (Col:'(004) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage.
zcx_excel=>raise_text( lv_errormessage ).
CATCH cx_sy_assign_cast_unknown_type.
lv_actual_col_string = lv_actual_col.
lv_actual_row_string = lv_actual_row.
CONCATENATE 'Error at assigning field (Col:'(004) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage.
zcx_excel=>raise_text( lv_errormessage ).
CATCH cx_sy_assign_out_of_range.
lv_errormessage = 'Internal table has less columns than excel'(003).
zcx_excel=>raise_text( lv_errormessage ).
CATCH cx_sy_conversion_error.
lv_actual_col_string = lv_actual_col.
lv_actual_row_string = lv_actual_row.
CONCATENATE 'Error at converting field value (Col:'(006) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage.
zcx_excel=>raise_text( lv_errormessage ).
ENDTRY.
ENDMETHOD. "get_table
METHOD get_tables_iterator.
eo_iterator = tables->get_iterator( ).
ENDMETHOD. "GET_TABLES_ITERATOR
METHOD get_tables_size.
ep_size = tables->size( ).
ENDMETHOD. "GET_TABLES_SIZE
METHOD get_title.
DATA lv_value TYPE string.
IF ip_escaped EQ abap_true.
lv_value = me->title.
ep_title = zcl_excel_common=>escape_string( lv_value ).
ELSE.
ep_title = me->title.
ENDIF.
ENDMETHOD. "GET_TITLE
METHOD get_value_type.
DATA: lo_addit TYPE REF TO cl_abap_elemdescr,
ls_dfies TYPE dfies,
l_function TYPE funcname,
l_value(50) TYPE c.
ep_value = ip_value.
ep_value_type = cl_abap_typedescr=>typekind_string. " Thats our default if something goes wrong.
TRY.
lo_addit ?= cl_abap_typedescr=>describe_by_data( ip_value ).
CATCH cx_sy_move_cast_error.
CLEAR lo_addit.
ENDTRY.
IF lo_addit IS BOUND.
lo_addit->get_ddic_field( RECEIVING p_flddescr = ls_dfies
EXCEPTIONS not_found = 1
no_ddic_type = 2
OTHERS = 3 ) .
IF sy-subrc = 0.
ep_value_type = ls_dfies-inttype.
IF ls_dfies-convexit IS NOT INITIAL.
* We need to convert with output conversion function
CONCATENATE 'CONVERSION_EXIT_' ls_dfies-convexit '_OUTPUT' INTO l_function.
SELECT SINGLE funcname INTO l_function
FROM tfdir
WHERE funcname = l_function.
IF sy-subrc = 0.
CALL FUNCTION l_function
EXPORTING
input = ip_value
IMPORTING
* LONG_TEXT =
output = l_value
* SHORT_TEXT =
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
TRY.
ep_value = l_value.
CATCH cx_root.
ep_value = ip_value.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
ELSE.
ep_value_type = lo_addit->get_data_type_kind( ip_value ).
ENDIF.
ENDIF.
ENDMETHOD. "GET_VALUE_TYPE
METHOD is_cell_merged.
DATA: lv_column TYPE i.
FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
rp_is_merged = abap_false. " Assume not in merged area
LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>.
IF <ls_merged_cell>-col_from <= lv_column
AND <ls_merged_cell>-col_to >= lv_column
AND <ls_merged_cell>-row_from <= ip_row
AND <ls_merged_cell>-row_to >= ip_row.
rp_is_merged = abap_true. " until we are proven different
RETURN.
ENDIF.
ENDLOOP.
ENDMETHOD. "IS_CELL_MERGED
METHOD print_title_set_range.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmoecker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lo_range_iterator TYPE REF TO cl_object_collection_iterator,
lo_range TYPE REF TO zcl_excel_range,
lv_repeat_range_sheetname TYPE string,
lv_repeat_range_col TYPE string,
lv_row_char_from TYPE char10,
lv_row_char_to TYPE char10,
lv_repeat_range_row TYPE string,
lv_repeat_range TYPE string.
*--------------------------------------------------------------------*
* Get range that represents printarea
* if non-existant, create it
*--------------------------------------------------------------------*
lo_range_iterator = me->get_ranges_iterator( ).
WHILE lo_range_iterator->has_next( ) = abap_true.
lo_range ?= lo_range_iterator->get_next( ).
IF lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name.
EXIT. " Found it
ENDIF.
CLEAR lo_range.
ENDWHILE.
IF me->print_title_col_from IS INITIAL AND
me->print_title_row_from IS INITIAL.
*--------------------------------------------------------------------*
* No print titles are present,
*--------------------------------------------------------------------*
IF lo_range IS BOUND.
me->ranges->remove( lo_range ).
ENDIF.
ELSE.
*--------------------------------------------------------------------*
* Print titles are present,
*--------------------------------------------------------------------*
IF lo_range IS NOT BOUND.
lo_range = me->add_new_range( ).
lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name.
ENDIF.
lv_repeat_range_sheetname = me->get_title( ).
lv_repeat_range_sheetname = zcl_excel_common=>escape_string( lv_repeat_range_sheetname ).
*--------------------------------------------------------------------*
* Repeat-columns
*--------------------------------------------------------------------*
IF me->print_title_col_from IS NOT INITIAL.
CONCATENATE lv_repeat_range_sheetname
'!$' me->print_title_col_from
':$' me->print_title_col_to
INTO lv_repeat_range_col.
ENDIF.
*--------------------------------------------------------------------*
* Repeat-rows
*--------------------------------------------------------------------*
IF me->print_title_row_from IS NOT INITIAL.
lv_row_char_from = me->print_title_row_from.
lv_row_char_to = me->print_title_row_to.
CONCATENATE '!$' lv_row_char_from
':$' lv_row_char_to
INTO lv_repeat_range_row.
CONDENSE lv_repeat_range_row NO-GAPS.
CONCATENATE lv_repeat_range_sheetname
lv_repeat_range_row
INTO lv_repeat_range_row.
ENDIF.
*--------------------------------------------------------------------*
* Concatenate repeat-rows and columns
*--------------------------------------------------------------------*
IF lv_repeat_range_col IS INITIAL.
lv_repeat_range = lv_repeat_range_row.
ELSEIF lv_repeat_range_row IS INITIAL.
lv_repeat_range = lv_repeat_range_col.
ELSE.
CONCATENATE lv_repeat_range_col lv_repeat_range_row
INTO lv_repeat_range SEPARATED BY ','.
ENDIF.
lo_range->set_range_value( lv_repeat_range ).
ENDIF.
ENDMETHOD. "PRINT_TITLE_SET_RANGE
METHOD set_area.
DATA: lv_row TYPE zexcel_cell_row,
lv_row_end TYPE zexcel_cell_row,
lv_column_start TYPE zexcel_cell_column_alpha,
lv_column_end TYPE zexcel_cell_column_alpha,
lv_column_start_int TYPE zexcel_cell_column_alpha,
lv_column_end_int TYPE zexcel_cell_column_alpha.
MOVE: ip_row_to TO lv_row_end,
ip_row TO lv_row.
IF lv_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED.
lv_row_end = lv_row.
ENDIF.
MOVE: ip_column_start TO lv_column_start,
ip_column_end TO lv_column_end.
IF lv_column_end IS INITIAL OR ip_column_end IS NOT SUPPLIED.
lv_column_end = lv_column_start.
ENDIF.
lv_column_start_int = zcl_excel_common=>convert_column2int( lv_column_start ).
lv_column_end_int = zcl_excel_common=>convert_column2int( lv_column_end ).
IF lv_column_start_int > lv_column_end_int OR lv_row > lv_row_end.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Wrong Merging Parameters'.
ENDIF.
IF ip_data_type IS SUPPLIED OR
ip_abap_type IS SUPPLIED.
me->set_cell( ip_column = lv_column_start
ip_row = lv_row
ip_value = ip_value
ip_formula = ip_formula
ip_style = ip_style
ip_hyperlink = ip_hyperlink
ip_data_type = ip_data_type
ip_abap_type = ip_abap_type ).
ELSE.
me->set_cell( ip_column = lv_column_start
ip_row = lv_row
ip_value = ip_value
ip_formula = ip_formula
ip_style = ip_style
ip_hyperlink = ip_hyperlink ).
ENDIF.
IF ip_style IS SUPPLIED.
me->set_area_style( ip_column_start = lv_column_start
ip_column_end = lv_column_end
ip_row = lv_row
ip_row_to = lv_row_end
ip_style = ip_style ).
ENDIF.
IF ip_merge IS SUPPLIED AND ip_merge = abap_true.
me->set_merge( ip_column_start = lv_column_start
ip_column_end = lv_column_end
ip_row = lv_row
ip_row_to = lv_row_end ).
ENDIF.
ENDMETHOD. "set_area
METHOD set_area_formula.
DATA: ld_row TYPE zexcel_cell_row,
ld_row_end TYPE zexcel_cell_row,
ld_column TYPE zexcel_cell_column_alpha,
ld_column_end TYPE zexcel_cell_column_alpha,
ld_column_int TYPE zexcel_cell_column_alpha,
ld_column_end_int TYPE zexcel_cell_column_alpha.
MOVE: ip_row_to TO ld_row_end,
ip_row TO ld_row.
IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED.
ld_row_end = ld_row.
ENDIF.
MOVE: ip_column_start TO ld_column,
ip_column_end TO ld_column_end.
IF ld_column_end IS INITIAL OR ip_column_end IS NOT SUPPLIED.
ld_column_end = ld_column.
ENDIF.
ld_column_int = zcl_excel_common=>convert_column2int( ld_column ).
ld_column_end_int = zcl_excel_common=>convert_column2int( ld_column_end ).
IF ld_column_int > ld_column_end_int OR ld_row > ld_row_end.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Wrong Merging Parameters'.
ENDIF.
me->set_cell_formula( ip_column = ld_column ip_row = ld_row
ip_formula = ip_formula ).
IF ip_merge IS SUPPLIED AND ip_merge = abap_true.
me->set_merge( ip_column_start = ld_column ip_row = ld_row
ip_column_end = ld_column_end ip_row_to = ld_row_end ).
ENDIF.
ENDMETHOD. "set_area_formula
METHOD set_area_style.
DATA: ld_row_start TYPE zexcel_cell_row,
ld_row_end TYPE zexcel_cell_row,
ld_column_start_int TYPE zexcel_cell_column,
ld_column_end_int TYPE zexcel_cell_column,
ld_current_column TYPE zexcel_cell_column_alpha,
ld_current_row TYPE zexcel_cell_row.
MOVE: ip_row_to TO ld_row_end,
ip_row TO ld_row_start.
IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED.
ld_row_end = ld_row_start.
ENDIF.
ld_column_start_int = zcl_excel_common=>convert_column2int( ip_column_start ).
ld_column_end_int = zcl_excel_common=>convert_column2int( ip_column_end ).
IF ld_column_end_int IS INITIAL OR ip_column_end IS NOT SUPPLIED.
ld_column_end_int = ld_column_start_int.
ENDIF.
WHILE ld_column_start_int <= ld_column_end_int.
ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start_int ).
ld_current_row = ld_row_start.
WHILE ld_current_row <= ld_row_end.
me->set_cell_style( ip_row = ld_current_row ip_column = ld_current_column
ip_style = ip_style ).
ADD 1 TO ld_current_row.
ENDWHILE.
ADD 1 TO ld_column_start_int.
ENDWHILE.
IF ip_merge IS SUPPLIED AND ip_merge = abap_true.
me->set_merge( ip_column_start = ip_column_start ip_row = ld_row_start
ip_column_end = ld_current_column ip_row_to = ld_row_end ).
ENDIF.
ENDMETHOD. "SET_AREA_STYLE
METHOD set_area_hyperlink.
DATA: ld_row_start TYPE zexcel_cell_row,
ld_row_end TYPE zexcel_cell_row,
ld_column_start_int TYPE zexcel_cell_column,
ld_column_end_int TYPE zexcel_cell_column,
ld_current_column TYPE zexcel_cell_column_alpha,
ld_current_row TYPE zexcel_cell_row,
ld_value TYPE string.
DATA: lv_column TYPE zexcel_cell_column,
lo_hyperlink TYPE REF TO zcl_excel_hyperlink.
MOVE: ip_row_to TO ld_row_end,
ip_row TO ld_row_start.
IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED.
ld_row_end = ld_row_start.
ENDIF.
ld_column_start_int = zcl_excel_common=>convert_column2int( ip_column_start ).
ld_column_end_int = zcl_excel_common=>convert_column2int( ip_column_end ).
IF ld_column_end_int IS INITIAL OR ip_column_end IS NOT SUPPLIED.
ld_column_end_int = ld_column_start_int.
ENDIF.
WHILE ld_column_start_int <= ld_column_end_int.
ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start_int ).
ld_current_row = ld_row_start.
WHILE ld_current_row <= ld_row_end.
me->get_cell( EXPORTING ip_column = ld_current_column ip_row = ld_current_row
IMPORTING ep_value = ld_value ).
IF ip_is_internal = abap_true.
lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = ip_url ).
ELSE.
lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = ip_url ).
ENDIF.
me->set_cell( ip_column = ld_current_column ip_row = ld_current_row ip_value = ld_value ip_hyperlink = lo_hyperlink ).
ADD 1 TO ld_current_row.
ENDWHILE.
ADD 1 TO ld_column_start_int.
ENDWHILE.
ENDMETHOD. "SET_AREA_HYPERLINK
METHOD set_cell.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data,
lv_row_alpha TYPE string,
lv_col_alpha TYPE zexcel_cell_column_alpha,
lv_value TYPE zexcel_cell_value,
lv_data_type TYPE zexcel_cell_data_type,
lv_value_type TYPE abap_typekind,
lv_style_guid TYPE zexcel_cell_style,
lo_addit TYPE REF TO cl_abap_elemdescr,
lo_value TYPE REF TO data,
lo_value_new TYPE REF TO data.
FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data,
<fs_numeric> TYPE numeric,
<fs_date> TYPE d,
<fs_time> TYPE t,
<fs_value> TYPE simple,
<fs_typekind_int8> TYPE abap_typekind.
IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED.
zcx_excel=>raise_text( 'Please provide the value or formula' ).
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* lv_style_guid = ip_style.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH TABLE KEY cell_row = ip_row " Changed to access via table key , Stefan Schmöcker, 2013-08-03
cell_column = lv_column.
IF sy-subrc = 0.
IF ip_style IS INITIAL.
" If no style is provided as method-parameter and cell is found use cell's current style
lv_style_guid = <fs_sheet_content>-cell_style.
ELSE.
" Style provided as method-parameter --> use this
lv_style_guid = ip_style.
ENDIF.
ELSE.
" No cell found --> use supplied style even if empty
lv_style_guid = ip_style.
ENDIF.
* End of change issue #152 - don't touch exisiting style if only value is passed
IF ip_value IS SUPPLIED.
"if data type is passed just write the value. Otherwise map abap type to excel and perform conversion
"IP_DATA_TYPE is passed by excel reader so source types are preserved
*First we get reference into local var.
CREATE DATA lo_value LIKE ip_value.
ASSIGN lo_value->* TO <fs_value>.
<fs_value> = ip_value.
IF ip_data_type IS SUPPLIED.
IF ip_abap_type IS NOT SUPPLIED.
get_value_type( EXPORTING ip_value = ip_value
IMPORTING ep_value = <fs_value> ) .
ENDIF.
lv_value = <fs_value>.
lv_data_type = ip_data_type.
ELSE.
IF ip_abap_type IS SUPPLIED.
lv_value_type = ip_abap_type.
ELSE.
get_value_type( EXPORTING ip_value = ip_value
IMPORTING ep_value = <fs_value>
ep_value_type = lv_value_type ).
ENDIF.
ASSIGN ('CL_ABAP_TYPEDESCR=>TYPEKIND_INT8') TO <fs_typekind_int8>.
IF sy-subrc <> 0.
ASSIGN space TO <fs_typekind_int8>. "not used as typekind!
ENDIF.
CASE lv_value_type.
WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2
OR <fs_typekind_int8>. "Allow INT8 types columns
lo_addit = cl_abap_elemdescr=>get_i( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_numeric>.
IF sy-subrc = 0.
<fs_numeric> = <fs_value>.
lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ).
ENDIF.
WHEN cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_packed.
lo_addit = cl_abap_elemdescr=>get_f( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_numeric>.
IF sy-subrc = 0.
<fs_numeric> = <fs_value>.
lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ).
ENDIF.
WHEN cl_abap_typedescr=>typekind_char OR cl_abap_typedescr=>typekind_string OR cl_abap_typedescr=>typekind_num OR
cl_abap_typedescr=>typekind_hex.
lv_value = <fs_value>.
lv_data_type = 's'.
WHEN cl_abap_typedescr=>typekind_date.
lo_addit = cl_abap_elemdescr=>get_d( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_date>.
IF sy-subrc = 0.
<fs_date> = <fs_value>.
lv_value = zcl_excel_common=>date_to_excel_string( ip_value = <fs_date> ) .
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* Moved to end of routine - apply date-format even if other styleinformation is passed
* IF ip_style IS NOT SUPPLIED. "get default date format in case parameter is initial
* lo_style = excel->add_new_style( ).
* lo_style->number_format->format_code = get_default_excel_date_format( ).
* lv_style_guid = lo_style->get_guid( ).
* ENDIF.
* End of change issue #152 - don't touch exisiting style if only value is passed
WHEN cl_abap_typedescr=>typekind_time.
lo_addit = cl_abap_elemdescr=>get_t( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_time>.
IF sy-subrc = 0.
<fs_time> = <fs_value>.
lv_value = zcl_excel_common=>time_to_excel_string( ip_value = <fs_time> ).
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* Moved to end of routine - apply time-format even if other styleinformation is passed
* IF ip_style IS NOT SUPPLIED. "get default time format for user in case parameter is initial
* lo_style = excel->add_new_style( ).
* lo_style->number_format->format_code = zcl_excel_style_number_format=>c_format_date_time6.
* lv_style_guid = lo_style->get_guid( ).
* ENDIF.
* End of change issue #152 - don't touch exisiting style if only value is passed
WHEN OTHERS.
zcx_excel=>raise_text( 'Invalid data type of input value' ).
ENDCASE.
ENDIF.
ENDIF.
IF ip_hyperlink IS BOUND.
ip_hyperlink->set_cell_reference( ip_column = ip_column
ip_row = ip_row ).
me->hyperlinks->add( ip_hyperlink ).
ENDIF.
IF lv_value CS '_x'.
" Issue #761 value "_x0041_" rendered as "A".
" "_x...._", where "." is 0-9 a-f or A-F (case insensitive), is an internal value in sharedStrings.xml
" that Excel uses to store special characters, it's interpreted like Unicode character U+....
" for instance "_x0041_" is U+0041 which is "A".
" To not interpret such text, the first underscore is replaced with "_x005f_".
" The value "_x0041_" is to be stored internally "_x005f_x0041_" so that it's rendered like "_x0041_".
" Note that REGEX is time consuming, it's why "CS" is used above to improve the performance.
REPLACE ALL OCCURRENCES OF REGEX '_(x[0-9a-fA-F]{4}_)' IN lv_value WITH '_x005f_$1' RESPECTING CASE.
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* Read table moved up, so that current style may be evaluated
* lv_column = zcl_excel_common=>convert_column2int( ip_column ).
* READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row
* cell_column = lv_column.
*
* IF sy-subrc EQ 0.
IF <fs_sheet_content> IS ASSIGNED.
* End of change issue #152 - don't touch exisiting style if only value is passed
<fs_sheet_content>-cell_value = lv_value.
<fs_sheet_content>-cell_formula = ip_formula.
<fs_sheet_content>-cell_style = lv_style_guid.
<fs_sheet_content>-data_type = lv_data_type.
ELSE.
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column.
ls_sheet_content-cell_value = lv_value.
ls_sheet_content-cell_formula = ip_formula.
ls_sheet_content-cell_style = lv_style_guid.
ls_sheet_content-data_type = lv_data_type.
lv_row_alpha = ip_row.
* SHIFT lv_row_alpha RIGHT DELETING TRAILING space."del #152 - replaced with condense - should be faster
* SHIFT lv_row_alpha LEFT DELETING LEADING space. "del #152 - replaced with condense - should be faster
CONDENSE lv_row_alpha NO-GAPS. "ins #152 - replaced 2 shifts - should be faster
lv_col_alpha = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column
CONCATENATE lv_col_alpha lv_row_alpha INTO ls_sheet_content-cell_coords. " issue #155 - less restrictive typing for ip_column
INSERT ls_sheet_content INTO TABLE sheet_content ASSIGNING <fs_sheet_content>. "ins #152 - Now <fs_sheet_content> always holds the data
* APPEND ls_sheet_content TO sheet_content.
* SORT sheet_content BY cell_row cell_column.
" me->update_dimension_range( ).
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* For Date- or Timefields change the formatcode if nothing is set yet
* Enhancement option: Check if existing formatcode is a date/ or timeformat
* If not, use default
DATA: lo_format_code_datetime TYPE zexcel_number_format.
DATA: stylemapping TYPE zexcel_s_stylemapping.
CASE lv_value_type.
WHEN cl_abap_typedescr=>typekind_date.
TRY.
stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ).
CATCH zcx_excel .
ENDTRY.
IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR
stylemapping-complete_style-number_format-format_code IS INITIAL.
lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_std.
ELSE.
lo_format_code_datetime = stylemapping-complete_style-number_format-format_code.
ENDIF.
me->change_cell_style( ip_column = ip_column
ip_row = ip_row
ip_number_format_format_code = lo_format_code_datetime ).
WHEN cl_abap_typedescr=>typekind_time.
TRY.
stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ).
CATCH zcx_excel .
ENDTRY.
IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR
stylemapping-complete_style-number_format-format_code IS INITIAL.
lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_time6.
ELSE.
lo_format_code_datetime = stylemapping-complete_style-number_format-format_code.
ENDIF.
me->change_cell_style( ip_column = ip_column
ip_row = ip_row
ip_number_format_format_code = lo_format_code_datetime ).
ENDCASE.
* End of change issue #152 - don't touch exisiting style if only value is passed
* Fix issue #162
lv_value = ip_value.
IF lv_value CS cl_abap_char_utilities=>cr_lf.
me->change_cell_style( ip_column = ip_column
ip_row = ip_row
ip_alignment_wraptext = abap_true ).
ENDIF.
* End of Fix issue #162
ENDMETHOD. "SET_CELL
METHOD set_cell_formula.
DATA:
lv_column TYPE zexcel_cell_column,
ls_sheet_content LIKE LINE OF me->sheet_content.
FIELD-SYMBOLS:
<sheet_content> LIKE LINE OF me->sheet_content.
*--------------------------------------------------------------------*
* Get cell to set formula into
*--------------------------------------------------------------------*
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE me->sheet_content ASSIGNING <sheet_content> WITH TABLE KEY cell_row = ip_row
cell_column = lv_column.
IF sy-subrc <> 0. " Create new entry in sheet_content if necessary
CHECK ip_formula IS INITIAL. " no need to create new entry in sheet_content when no formula is passed
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column.
INSERT ls_sheet_content INTO TABLE me->sheet_content ASSIGNING <sheet_content>.
ENDIF.
*--------------------------------------------------------------------*
* Fieldsymbol now holds the relevant cell
*--------------------------------------------------------------------*
<sheet_content>-cell_formula = ip_formula.
ENDMETHOD. "SET_CELL_FORMULA
METHOD set_cell_style.
DATA: lv_column TYPE zexcel_cell_column,
lv_style_guid TYPE zexcel_cell_style.
FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data.
lv_style_guid = ip_style.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row
cell_column = lv_column.
IF sy-subrc EQ 0.
<fs_sheet_content>-cell_style = lv_style_guid.
ELSE.
set_cell( ip_column = ip_column ip_row = ip_row ip_value = '' ip_style = ip_style ).
ENDIF.
ENDMETHOD. "SET_CELL_STYLE
METHOD set_column_width.
DATA: lo_column TYPE REF TO zcl_excel_column.
DATA: width TYPE float.
lo_column = me->get_column( ip_column ).
* if a fix size is supplied use this
IF ip_width_fix IS SUPPLIED.
TRY.
width = ip_width_fix.
IF width <= 0.
zcx_excel=>raise_text( 'Please supply a positive number as column-width' ).
ENDIF.
lo_column->set_width( width ).
EXIT.
CATCH cx_sy_conversion_no_number.
* Strange stuff passed --> raise error
zcx_excel=>raise_text( 'Unable to interpret supplied input as number' ).
ENDTRY.
ENDIF.
* If we get down to here, we have to use whatever is found in autosize.
lo_column->set_auto_size( ip_width_autosize ).
ENDMETHOD. "SET_COLUMN_WIDTH
METHOD set_default_excel_date_format.
IF ip_default_excel_date_format IS INITIAL.
zcx_excel=>raise_text( 'Default date format cannot be blank' ).
ENDIF.
default_excel_date_format = ip_default_excel_date_format.
ENDMETHOD. "SET_DEFAULT_EXCEL_DATE_FORMAT
METHOD set_merge.
DATA: ls_merge TYPE mty_merge,
lv_errormessage TYPE string.
...
"just after variables definition
IF ip_value IS SUPPLIED OR ip_formula IS SUPPLIED.
" if there is a value or formula set the value to the top-left cell
"maybe it is necessary to support other paramters for set_cell
IF ip_value IS SUPPLIED.
me->set_cell( ip_row = ip_row ip_column = ip_column_start
ip_value = ip_value ).
ENDIF.
IF ip_formula IS SUPPLIED.
me->set_cell( ip_row = ip_row ip_column = ip_column_start
ip_value = ip_formula ).
ENDIF.
ENDIF.
"call to set_merge_style to apply the style to all cells at the matrix
IF ip_style IS SUPPLIED.
me->set_merge_style( ip_row = ip_row ip_column_start = ip_column_start
ip_row_to = ip_row_to ip_column_end = ip_column_end
ip_style = ip_style ).
ENDIF.
...
*--------------------------------------------------------------------*
* Build new range area to insert into range table
*--------------------------------------------------------------------*
ls_merge-row_from = ip_row.
IF ip_row IS SUPPLIED AND ip_row IS NOT INITIAL AND ip_row_to IS NOT SUPPLIED.
ls_merge-row_to = ls_merge-row_from.
ELSE.
ls_merge-row_to = ip_row_to.
ENDIF.
IF ls_merge-row_from > ls_merge-row_to.
lv_errormessage = 'Merge: First row larger then last row'(405).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
ls_merge-col_from = zcl_excel_common=>convert_column2int( ip_column_start ).
IF ip_column_start IS SUPPLIED AND ip_column_start IS NOT INITIAL AND ip_column_end IS NOT SUPPLIED.
ls_merge-col_to = ls_merge-col_from.
ELSE.
ls_merge-col_to = zcl_excel_common=>convert_column2int( ip_column_end ).
ENDIF.
IF ls_merge-col_from > ls_merge-col_to.
lv_errormessage = 'Merge: First column larger then last column'(406).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
*--------------------------------------------------------------------*
* Check merge not overlapping with existing merges
*--------------------------------------------------------------------*
LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS WHERE NOT ( row_from > ls_merge-row_to
OR row_to < ls_merge-row_from
OR col_from > ls_merge-col_to
OR col_to < ls_merge-col_from ).
lv_errormessage = 'Overlapping merges'(404).
zcx_excel=>raise_text( lv_errormessage ).
ENDLOOP.
*--------------------------------------------------------------------*
* Everything seems ok --> add to merge table
*--------------------------------------------------------------------*
INSERT ls_merge INTO TABLE me->mt_merged_cells.
ENDMETHOD. "SET_MERGE
METHOD set_merge_style.
DATA: ld_row_start TYPE zexcel_cell_row,
ld_row_end TYPE zexcel_cell_row,
ld_column_start TYPE zexcel_cell_column,
ld_column_end TYPE zexcel_cell_column,
ld_current_column TYPE zexcel_cell_column_alpha,
ld_current_row TYPE zexcel_cell_row.
MOVE: ip_row_to TO ld_row_end,
ip_row TO ld_row_start.
IF ld_row_end IS INITIAL.
ld_row_end = ld_row_start.
ENDIF.
ld_column_start = zcl_excel_common=>convert_column2int( ip_column_start ).
ld_column_end = zcl_excel_common=>convert_column2int( ip_column_end ).
IF ld_column_end IS INITIAL.
ld_column_end = ld_column_start.
ENDIF.
"set the style cell by cell
WHILE ld_column_start <= ld_column_end.
ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start ).
ld_current_row = ld_row_start.
WHILE ld_current_row <= ld_row_end.
me->set_cell_style( ip_row = ld_current_row ip_column = ld_current_column
ip_style = ip_style ).
ADD 1 TO ld_current_row.
ENDWHILE.
ADD 1 TO ld_column_start.
ENDWHILE.
ENDMETHOD. "set_merge_style
METHOD set_print_gridlines.
me->print_gridlines = i_print_gridlines.
ENDMETHOD. "SET_PRINT_GRIDLINES
METHOD set_row_height.
DATA: lo_row TYPE REF TO zcl_excel_row.
DATA: height TYPE float.
lo_row = me->get_row( ip_row ).
* if a fix size is supplied use this
TRY.
height = ip_height_fix.
IF height <= 0.
zcx_excel=>raise_text( 'Please supply a positive number as row-height' ).
ENDIF.
lo_row->set_row_height( height ).
EXIT.
CATCH cx_sy_conversion_no_number.
* Strange stuff passed --> raise error
zcx_excel=>raise_text( 'Unable to interpret supplied input as number' ).
ENDTRY.
ENDMETHOD. "SET_ROW_HEIGHT
METHOD set_row_outline.
DATA: ls_row_outline LIKE LINE OF me->mt_row_outlines.
FIELD-SYMBOLS: <ls_row_outline> LIKE LINE OF me->mt_row_outlines.
READ TABLE me->mt_row_outlines ASSIGNING <ls_row_outline> WITH TABLE KEY row_from = iv_row_from
row_to = iv_row_to.
IF sy-subrc <> 0.
IF iv_row_from <= 0.
zcx_excel=>raise_text( 'First row of outline must be a positive number' ).
ENDIF.
IF iv_row_to < iv_row_from.
zcx_excel=>raise_text( 'Last row of outline may not be less than first line of outline' ).
ENDIF.
ls_row_outline-row_from = iv_row_from.
ls_row_outline-row_to = iv_row_to.
INSERT ls_row_outline INTO TABLE me->mt_row_outlines ASSIGNING <ls_row_outline>.
ENDIF.
CASE iv_collapsed.
WHEN abap_true
OR abap_false.
<ls_row_outline>-collapsed = iv_collapsed.
WHEN OTHERS.
zcx_excel=>raise_text( 'Unknown collapse state' ).
ENDCASE.
ENDMETHOD. "SET_ROW_OUTLINE
METHOD set_show_gridlines.
me->show_gridlines = i_show_gridlines.
ENDMETHOD. "SET_SHOW_GRIDLINES
METHOD set_show_rowcolheaders.
me->show_rowcolheaders = i_show_rowcolheaders.
ENDMETHOD. "SET_SHOW_ROWCOLHEADERS
METHOD set_tabcolor.
me->tabcolor = iv_tabcolor.
ENDMETHOD. "SET_TABCOLOR
METHOD set_table.
DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr,
lr_data TYPE REF TO data,
ls_header TYPE x030l,
lt_dfies TYPE ddfields,
lv_row_int TYPE zexcel_cell_row,
lv_column_int TYPE zexcel_cell_column,
lv_column_alpha TYPE zexcel_cell_column_alpha,
lv_cell_value TYPE zexcel_cell_value.
FIELD-SYMBOLS: <fs_table_line> TYPE any,
<fs_fldval> TYPE any,
<fs_dfies> TYPE dfies.
lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ).
lv_row_int = ip_top_left_row.
CREATE DATA lr_data LIKE LINE OF ip_table.
lo_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).
ls_header = lo_tabdescr->get_ddic_header( ).
lt_dfies = lo_tabdescr->get_ddic_field_list( ).
* It is better to loop column by column
LOOP AT lt_dfies ASSIGNING <fs_dfies>.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
IF ip_no_header = abap_false.
" First of all write column header
lv_cell_value = <fs_dfies>-scrtext_m.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_cell_value
ip_style = ip_hdr_style ).
IF ip_transpose = abap_true.
ADD 1 TO lv_column_int.
ELSE.
ADD 1 TO lv_row_int.
ENDIF.
ENDIF.
LOOP AT ip_table ASSIGNING <fs_table_line>.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
ASSIGN COMPONENT <fs_dfies>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>.
MOVE <fs_fldval> TO lv_cell_value.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval> "lv_cell_value
ip_style = ip_body_style ).
IF ip_transpose = abap_true.
ADD 1 TO lv_column_int.
ELSE.
ADD 1 TO lv_row_int.
ENDIF.
ENDLOOP.
IF ip_transpose = abap_true.
lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ).
ADD 1 TO lv_row_int.
ELSE.
lv_row_int = ip_top_left_row.
ADD 1 TO lv_column_int.
ENDIF.
ENDLOOP.
ENDMETHOD. "SET_TABLE
METHOD set_title.
*--------------------------------------------------------------------*
* ToDos:
* 2do §1 The current coding for replacing a named ranges name
* after renaming a sheet should be checked if it is
* really working if sheetname should be escaped
*--------------------------------------------------------------------*
*--------------------------------------------------------------------*
* issue #230 - Pimp my Code
* - Stefan Schmoecker, (wip ) 2012-12-08
* - ...
* changes: aligning code
* message made to support multilinguality
*--------------------------------------------------------------------*
* issue#243 - ' is not allowed as first character in sheet title
* - Stefan Schmoecker, 2012-12-02
* changes: added additional check for ' as first character
*--------------------------------------------------------------------*
DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
errormessage TYPE string,
lv_rangesheetname_old TYPE string,
lv_rangesheetname_new TYPE string,
lo_ranges_iterator TYPE REF TO cl_object_collection_iterator,
lo_range TYPE REF TO zcl_excel_range,
lv_range_value TYPE zexcel_range_value,
lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class
*--------------------------------------------------------------------*
* Check whether title consists only of allowed characters
* Illegal characters are: / \ [ ] * ? : --> http://msdn.microsoft.com/en-us/library/ff837411.aspx
* Illegal characters not in documentation: ' as first character
*--------------------------------------------------------------------*
IF ip_title CA '/\[]*?:'.
lv_errormessage = 'Found illegal character in sheetname. List of forbidden characters: /\[]*?:'(402).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
IF ip_title IS NOT INITIAL AND ip_title(1) = `'`.
lv_errormessage = 'Sheetname may not start with &'(403). " & used instead of ' to allow fallbacklanguage
REPLACE '&' IN lv_errormessage WITH `'`.
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
*--------------------------------------------------------------------*
* Check whether title is unique in workbook
*--------------------------------------------------------------------*
lo_worksheets_iterator = me->excel->get_worksheets_iterator( ).
WHILE lo_worksheets_iterator->has_next( ) = 'X'.
lo_worksheet ?= lo_worksheets_iterator->get_next( ).
CHECK me->guid <> lo_worksheet->get_guid( ). " Don't check against itself
IF ip_title = lo_worksheet->get_title( ). " Not unique --> raise exception
errormessage = 'Duplicate sheetname &'.
REPLACE '&' IN errormessage WITH ip_title.
zcx_excel=>raise_text( errormessage ).
ENDIF.
ENDWHILE.
*--------------------------------------------------------------------*
* Remember old sheetname and rename sheet to desired name
*--------------------------------------------------------------------*
CONCATENATE me->title '!' INTO lv_rangesheetname_old.
me->title = ip_title.
*--------------------------------------------------------------------*
* After changing this worksheet's title we have to adjust
* all ranges that are referring to this worksheet.
*--------------------------------------------------------------------*
* 2do §1 - Check if the following quickfix is solid
* I fear it isn't - but this implementation is better then
* nothing at all since it handles a supposed majority of cases
*--------------------------------------------------------------------*
CONCATENATE me->title '!' INTO lv_rangesheetname_new.
lo_ranges_iterator = me->excel->get_ranges_iterator( ).
WHILE lo_ranges_iterator->has_next( ) = 'X'.
lo_range ?= lo_ranges_iterator->get_next( ).
lv_range_value = lo_range->get_value( ).
REPLACE ALL OCCURRENCES OF lv_rangesheetname_old IN lv_range_value WITH lv_rangesheetname_new.
IF sy-subrc = 0.
lo_range->set_range_value( lv_range_value ).
ENDIF.
ENDWHILE.
ENDMETHOD. "SET_TITLE
METHOD update_dimension_range.
DATA: ls_sheet_content TYPE zexcel_s_cell_data,
lv_row_alpha TYPE string,
lv_column_alpha TYPE zexcel_cell_column_alpha.
CHECK sheet_content IS NOT INITIAL.
upper_cell-cell_row = zcl_excel_common=>c_excel_sheet_max_row.
upper_cell-cell_column = zcl_excel_common=>c_excel_sheet_max_col.
lower_cell-cell_row = zcl_excel_common=>c_excel_sheet_min_row.
lower_cell-cell_column = zcl_excel_common=>c_excel_sheet_min_col.
LOOP AT sheet_content INTO ls_sheet_content.
IF upper_cell-cell_row > ls_sheet_content-cell_row.
upper_cell-cell_row = ls_sheet_content-cell_row.
ENDIF.
IF upper_cell-cell_column > ls_sheet_content-cell_column.
upper_cell-cell_column = ls_sheet_content-cell_column.
ENDIF.
IF lower_cell-cell_row < ls_sheet_content-cell_row.
lower_cell-cell_row = ls_sheet_content-cell_row.
ENDIF.
IF lower_cell-cell_column < ls_sheet_content-cell_column.
lower_cell-cell_column = ls_sheet_content-cell_column.
ENDIF.
ENDLOOP.
lv_row_alpha = upper_cell-cell_row.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( upper_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO upper_cell-cell_coords.
lv_row_alpha = lower_cell-cell_row.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lower_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO lower_cell-cell_coords.
ENDMETHOD. "UPDATE_DIMENSION_RANGE
METHOD zif_excel_sheet_printsettings~clear_print_repeat_columns.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
CLEAR: me->print_title_col_from,
me->print_title_col_to .
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_COLUMNS
METHOD zif_excel_sheet_printsettings~clear_print_repeat_rows.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
CLEAR: me->print_title_row_from,
me->print_title_row_to .
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_ROWS
METHOD zif_excel_sheet_printsettings~get_print_repeat_columns.
ev_columns_from = me->print_title_col_from.
ev_columns_to = me->print_title_col_to.
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_COLUMNS
METHOD zif_excel_sheet_printsettings~get_print_repeat_rows.
ev_rows_from = me->print_title_row_from.
ev_rows_to = me->print_title_row_to.
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_ROWS
METHOD zif_excel_sheet_printsettings~set_print_repeat_columns.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmöcker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lv_col_from_int TYPE i,
lv_col_to_int TYPE i,
lv_errormessage TYPE string.
lv_col_from_int = zcl_excel_common=>convert_column2int( iv_columns_from ).
lv_col_to_int = zcl_excel_common=>convert_column2int( iv_columns_to ).
*--------------------------------------------------------------------*
* Check if valid range is supplied
*--------------------------------------------------------------------*
IF lv_col_from_int < 1.
lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
IF lv_col_from_int > lv_col_to_int.
lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
me->print_title_col_from = iv_columns_from.
me->print_title_col_to = iv_columns_to.
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_COLUMNS
METHOD zif_excel_sheet_printsettings~set_print_repeat_rows.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmöcker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lv_errormessage TYPE string.
*--------------------------------------------------------------------*
* Check if valid range is supplied
*--------------------------------------------------------------------*
IF iv_rows_from < 1.
lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
IF iv_rows_from > iv_rows_to.
lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
me->print_title_row_from = iv_rows_from.
me->print_title_row_to = iv_rows_to.
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_ROWS
METHOD zif_excel_sheet_properties~get_style.
IF zif_excel_sheet_properties~style IS NOT INITIAL.
ep_style = zif_excel_sheet_properties~style.
ELSE.
ep_style = me->excel->get_default_style( ).
ENDIF.
ENDMETHOD. "ZIF_EXCEL_SHEET_PROPERTIES~GET_STYLE
METHOD zif_excel_sheet_properties~initialize.
zif_excel_sheet_properties~show_zeros = zif_excel_sheet_properties=>c_showzero.
zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_on.
zif_excel_sheet_properties~summaryright = zif_excel_sheet_properties=>c_right_on.
* inizialize zoomscale values
zif_excel_sheet_properties~zoomscale = 100.
zif_excel_sheet_properties~zoomscale_normal = 100.
zif_excel_sheet_properties~zoomscale_pagelayoutview = 100 .
zif_excel_sheet_properties~zoomscale_sheetlayoutview = 100 .
ENDMETHOD. "ZIF_EXCEL_SHEET_PROPERTIES~INITIALIZE
METHOD zif_excel_sheet_properties~set_style.
zif_excel_sheet_properties~style = ip_style.
ENDMETHOD. "ZIF_EXCEL_SHEET_PROPERTIES~SET_STYLE
METHOD zif_excel_sheet_protection~initialize.
me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_unprotected.
CLEAR me->zif_excel_sheet_protection~password.
me->zif_excel_sheet_protection~auto_filter = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~delete_columns = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~delete_rows = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~format_cells = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~format_columns = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~format_rows = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~insert_columns = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~insert_hyperlinks = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~insert_rows = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_noactive.
* me->zif_excel_sheet_protection~password = zif_excel_sheet_protection=>c_noactive. "issue #68
me->zif_excel_sheet_protection~pivot_tables = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~select_locked_cells = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~select_unlocked_cells = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~sort = zif_excel_sheet_protection=>c_noactive.
ENDMETHOD. "ZIF_EXCEL_SHEET_PROTECTION~INITIALIZE
METHOD zif_excel_sheet_vba_project~set_codename.
me->zif_excel_sheet_vba_project~codename = ip_codename.
ENDMETHOD. "ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME
METHOD zif_excel_sheet_vba_project~set_codename_pr.
me->zif_excel_sheet_vba_project~codename_pr = ip_codename_pr.
ENDMETHOD. "ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME_PR
ENDCLASS.
| 36.124655 | 217 | 0.597823 |
c467186d994ba6dd187acd62d686d1a446c1340c
| 9,345 |
abap
|
ABAP
|
src/objects/oo/zcl_abapgit_oo_base.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 2 |
2021-03-20T20:27:04.000Z
|
2021-03-20T20:34:58.000Z
|
src/objects/oo/zcl_abapgit_oo_base.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 37 |
2021-06-01T05:57:18.000Z
|
2022-03-01T05:02:10.000Z
|
src/objects/oo/zcl_abapgit_oo_base.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_oo_base DEFINITION PUBLIC ABSTRACT.
PUBLIC SECTION.
INTERFACES: zif_abapgit_oo_object_fnc.
PROTECTED SECTION.
CLASS-METHODS:
convert_attrib_to_vseoattrib
IMPORTING iv_clsname TYPE seoclsname
it_attributes TYPE zif_abapgit_definitions=>ty_obj_attribute_tt
RETURNING VALUE(rt_vseoattrib) TYPE seoo_attributes_r.
PRIVATE SECTION.
DATA mv_skip_test_classes TYPE abap_bool.
METHODS deserialize_abap_source_old
IMPORTING is_clskey TYPE seoclskey
it_source TYPE zif_abapgit_definitions=>ty_string_tt
RAISING zcx_abapgit_exception.
METHODS deserialize_abap_source_new
IMPORTING is_clskey TYPE seoclskey
it_source TYPE zif_abapgit_definitions=>ty_string_tt
RAISING zcx_abapgit_exception
cx_sy_dyn_call_error.
ENDCLASS.
CLASS zcl_abapgit_oo_base IMPLEMENTATION.
METHOD convert_attrib_to_vseoattrib.
FIELD-SYMBOLS: <ls_attribute> LIKE LINE OF it_attributes,
<ls_vseoattrib> LIKE LINE OF rt_vseoattrib.
LOOP AT it_attributes ASSIGNING <ls_attribute>.
INSERT INITIAL LINE INTO TABLE rt_vseoattrib ASSIGNING <ls_vseoattrib>.
MOVE-CORRESPONDING <ls_attribute> TO <ls_vseoattrib>.
<ls_vseoattrib>-clsname = iv_clsname.
UNASSIGN <ls_vseoattrib>.
ENDLOOP.
UNASSIGN <ls_attribute>.
ENDMETHOD.
METHOD deserialize_abap_source_new.
DATA: lo_factory TYPE REF TO object,
lo_source TYPE REF TO object,
lo_settings TYPE REF TO object,
lr_settings TYPE REF TO data.
FIELD-SYMBOLS <lg_settings> TYPE any.
"Buffer needs to be refreshed,
"otherwise standard SAP CLIF_SOURCE reorder methods alphabetically
CALL FUNCTION 'SEO_BUFFER_INIT'.
CALL FUNCTION 'SEO_BUFFER_REFRESH'
EXPORTING
cifkey = is_clskey
version = seoc_version_inactive.
CALL METHOD ('CL_OO_FACTORY')=>('CREATE_INSTANCE')
RECEIVING
result = lo_factory.
"Enable modification mode to avoid exception CX_OO_ACCESS_PERMISSON when
"dealing with objects in foreign namespaces (namespace role = C)
CALL METHOD lo_factory->('CREATE_SETTINGS')
EXPORTING
modification_mode_enabled = abap_true
RECEIVING
result = lo_settings.
CREATE DATA lr_settings TYPE REF TO ('IF_OO_CLIF_SOURCE_SETTINGS').
ASSIGN lr_settings->* TO <lg_settings>.
<lg_settings> ?= lo_settings.
CALL METHOD lo_factory->('CREATE_CLIF_SOURCE')
EXPORTING
clif_name = is_clskey-clsname
settings = <lg_settings>
RECEIVING
result = lo_source.
TRY.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~LOCK').
CATCH cx_oo_access_permission.
zcx_abapgit_exception=>raise( 'source_new, access permission exception' ).
ENDTRY.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SET_SOURCE')
EXPORTING
source = it_source.
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~SAVE').
CALL METHOD lo_source->('IF_OO_CLIF_SOURCE~UNLOCK').
ENDMETHOD.
METHOD deserialize_abap_source_old.
"for backwards compatability down to 702
DATA: lo_source TYPE REF TO cl_oo_source.
CREATE OBJECT lo_source
EXPORTING
clskey = is_clskey
EXCEPTIONS
class_not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
TRY.
lo_source->access_permission( seok_access_modify ).
lo_source->set_source( it_source ).
lo_source->save( ).
lo_source->access_permission( seok_access_free ).
CATCH cx_oo_access_permission.
zcx_abapgit_exception=>raise( 'permission error' ).
CATCH cx_oo_source_save_failure.
zcx_abapgit_exception=>raise( 'save failure' ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~add_to_activation_list.
zcl_abapgit_objects_activation=>add_item( is_item ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~create.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~create_documentation.
CALL FUNCTION 'DOCU_UPD'
EXPORTING
id = 'CL'
langu = iv_language
object = iv_object_name
no_masterlang = iv_no_masterlang
TABLES
line = it_lines
EXCEPTIONS
ret_code = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~create_sotr.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~delete.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~deserialize_source.
TRY.
deserialize_abap_source_new(
is_clskey = is_key
it_source = it_source ).
CATCH cx_sy_dyn_call_error.
deserialize_abap_source_old(
is_clskey = is_key
it_source = it_source ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~exists.
CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
EXPORTING
clskey = is_object_name
EXCEPTIONS
not_specified = 1
not_existing = 2
is_interface = 3
no_text = 4
inconsistent = 5
OTHERS = 6.
rv_exists = boolc( sy-subrc <> 2 ).
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~generate_locals.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_class_properties.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_includes.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_interface_properties.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~get_skip_test_classes.
rv_skip = mv_skip_test_classes.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~insert_text_pool.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_attributes.
SELECT cmpname attbusobj attkeyfld
FROM seocompodf
INTO CORRESPONDING FIELDS OF TABLE rt_attributes
WHERE clsname = iv_object_name
AND ( attbusobj <> space OR attkeyfld <> space )
AND version = '1'
ORDER BY PRIMARY KEY.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_descriptions.
IF iv_language IS INITIAL.
" load all languages
SELECT * FROM seocompotx INTO TABLE rt_descriptions
WHERE clsname = iv_obejct_name
AND descript <> ''
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
ELSE.
" load main language
SELECT * FROM seocompotx INTO TABLE rt_descriptions
WHERE clsname = iv_obejct_name
AND langu = iv_language
AND descript <> ''
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_documentation.
DATA: lv_state TYPE dokstate,
lv_object TYPE dokhl-object,
lt_lines TYPE tlinetab.
lv_object = iv_class_name.
CALL FUNCTION 'DOCU_GET'
EXPORTING
id = 'CL'
langu = iv_language
object = lv_object
IMPORTING
dokstate = lv_state
TABLES
line = lt_lines
EXCEPTIONS
no_docu_on_screen = 1
no_docu_self_def = 2
no_docu_temp = 3
ret_code = 4
OTHERS = 5.
IF sy-subrc = 0 AND lv_state = 'R'.
rt_lines = lt_lines.
ELSE.
CLEAR rt_lines.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_sotr.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_superclass.
SELECT SINGLE refclsname FROM vseoextend INTO rv_superclass
WHERE clsname = iv_classname.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~read_text_pool.
ASSERT 0 = 1. "Subclass responsibility
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~serialize_abap.
DATA lo_oo_serializer TYPE REF TO zcl_abapgit_oo_serializer.
CREATE OBJECT lo_oo_serializer.
CASE iv_type.
WHEN seop_ext_class_locals_def.
rt_source = lo_oo_serializer->serialize_locals_def( is_class_key ).
WHEN seop_ext_class_locals_imp.
rt_source = lo_oo_serializer->serialize_locals_imp( is_class_key ).
WHEN seop_ext_class_macros.
rt_source = lo_oo_serializer->serialize_macros( is_class_key ).
WHEN seop_ext_class_testclasses.
rt_source = lo_oo_serializer->serialize_testclasses( is_class_key ).
mv_skip_test_classes = lo_oo_serializer->are_test_classes_skipped( ).
WHEN OTHERS.
rt_source = lo_oo_serializer->serialize_abap_clif_source( is_class_key ).
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_oo_object_fnc~update_descriptions.
DELETE FROM seocompotx WHERE clsname = is_key-clsname. "#EC CI_SUBRC
INSERT seocompotx FROM TABLE it_descriptions. "#EC CI_SUBRC
ENDMETHOD.
ENDCLASS.
| 28.490854 | 88 | 0.675655 |
c469fa34bab227613a1a4ce81189e268931e9901
| 14,257 |
abap
|
ABAP
|
src/objects/zcl_abapgit_object_msag.clas.abap
|
D047539/abapGit
|
cbaf3711b4c41e8376144ad7bd848e6a3d3722bb
|
[
"MIT"
] | 797 |
2015-02-06T15:38:41.000Z
|
2020-09-23T02:57:02.000Z
|
src/objects/zcl_abapgit_object_msag.clas.abap
|
larshp/abapGit
|
143f7d4d3b938bdbb418fef5f94665ba1f150fb6
|
[
"MIT"
] | 2,776 |
2015-01-13T03:59:55.000Z
|
2020-09-23T21:46:34.000Z
|
src/objects/zcl_abapgit_object_msag.clas.abap
|
D047539/abapGit
|
cbaf3711b4c41e8376144ad7bd848e6a3d3722bb
|
[
"MIT"
] | 499 |
2015-01-13T03:41:36.000Z
|
2020-09-22T11:50:54.000Z
|
CLASS zcl_abapgit_object_msag 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_t100_text,
sprsl TYPE t100-sprsl,
msgnr TYPE t100-msgnr,
text TYPE t100-text,
END OF ty_t100_text .
TYPES:
ty_t100_texts TYPE STANDARD TABLE OF ty_t100_text .
TYPES:
ty_t100s TYPE STANDARD TABLE OF t100
WITH NON-UNIQUE DEFAULT KEY .
METHODS serialize_texts
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_output
RAISING
zcx_abapgit_exception .
METHODS deserialize_texts
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_input
RAISING
zcx_abapgit_exception .
METHODS serialize_longtexts_msag
IMPORTING
!it_t100 TYPE ty_t100s
!ii_xml TYPE REF TO zif_abapgit_xml_output
RAISING
zcx_abapgit_exception .
METHODS delete_msgid
IMPORTING
!iv_message_id TYPE arbgb .
METHODS free_access_permission
IMPORTING
!iv_message_id TYPE arbgb .
METHODS delete_documentation
IMPORTING
!iv_message_id TYPE arbgb .
ENDCLASS.
CLASS zcl_abapgit_object_msag IMPLEMENTATION.
METHOD delete_documentation.
DATA: lv_key_s TYPE dokhl-object.
CLEAR lv_key_s.
CALL FUNCTION 'DOCU_OBJECT_NAME_CONCATENATE'
EXPORTING
docu_id = 'NA'
element = iv_message_id
addition = ' '
IMPORTING
object = lv_key_s
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'DOKU_DELETE_ALL'
EXPORTING
doku_id = 'NA'
doku_object = lv_key_s
generic_use = 'X'
suppress_authority = space
suppress_enqueue = space
suppress_transport = space
EXCEPTIONS
header_without_text = 01
index_without_header = 02
no_authority_for_devclass_xxxx = 03
no_docu_found = 04
object_is_already_enqueued = 05
object_is_enqueued_by_corr = 06
user_break = 07.
ENDMETHOD.
METHOD delete_msgid.
delete_documentation( iv_message_id ).
DELETE FROM t100a WHERE arbgb = iv_message_id.
IF sy-subrc = 0 OR sy-subrc = 4.
CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT'
EXPORTING
object = iv_message_id
operation = 'DELETE'
program = space
type = 'CN'.
DELETE FROM t100o WHERE arbgb = iv_message_id.
DELETE FROM t100t WHERE arbgb = iv_message_id. "#EC CI_NOFIRST
DELETE FROM t100u WHERE arbgb = iv_message_id.
DELETE FROM t100x WHERE arbgb = iv_message_id.
DELETE FROM t100 WHERE arbgb = iv_message_id.
ENDIF.
ENDMETHOD.
METHOD deserialize_texts.
DATA: lv_msg_id TYPE rglif-message_id,
ls_t100 TYPE t100,
lt_t100t TYPE TABLE OF t100t,
lt_t100_texts TYPE ty_t100_texts,
lt_t100u TYPE TABLE OF t100u.
FIELD-SYMBOLS: <ls_t100_text> TYPE ty_t100_text.
lv_msg_id = ms_item-obj_name.
SELECT * FROM t100u INTO TABLE lt_t100u
WHERE arbgb = lv_msg_id ORDER BY PRIMARY KEY. "#EC CI_GENBUFF
ii_xml->read( EXPORTING iv_name = 'T100_TEXTS'
CHANGING cg_data = lt_t100_texts ).
ii_xml->read( EXPORTING iv_name = 'T100T'
CHANGING cg_data = lt_t100t ).
MODIFY t100t FROM TABLE lt_t100t. "#EC CI_SUBRC
LOOP AT lt_t100_texts ASSIGNING <ls_t100_text>.
"check if message exists
READ TABLE lt_t100u TRANSPORTING NO FIELDS
WITH KEY arbgb = lv_msg_id msgnr = <ls_t100_text>-msgnr BINARY SEARCH.
CHECK sy-subrc = 0. "if original message doesn't exist no translations added
MOVE-CORRESPONDING <ls_t100_text> TO ls_t100.
ls_t100-arbgb = lv_msg_id.
MODIFY t100 FROM ls_t100.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100 modify failed' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD free_access_permission.
CALL FUNCTION 'RS_ACCESS_PERMISSION'
EXPORTING
mode = 'FREE'
object = iv_message_id
object_class = 'T100'.
ENDMETHOD.
METHOD serialize_longtexts_msag.
DATA: lv_doku_object_name TYPE dokhl-object,
lt_doku_object_names TYPE STANDARD TABLE OF dokhl-object
WITH NON-UNIQUE DEFAULT KEY,
lt_dokil TYPE zif_abapgit_definitions=>ty_dokil_tt,
ls_dokil LIKE LINE OF lt_dokil,
lt_language_filter TYPE zif_abapgit_environment=>ty_system_language_filter.
FIELD-SYMBOLS: <ls_t100> TYPE t100.
IF lines( it_t100 ) = 0.
RETURN.
ENDIF.
LOOP AT it_t100 ASSIGNING <ls_t100>.
lv_doku_object_name = <ls_t100>-arbgb && <ls_t100>-msgnr.
INSERT lv_doku_object_name INTO TABLE lt_doku_object_names.
ENDLOOP.
IF ii_xml->i18n_params( )-main_language_only = abap_true.
SELECT * FROM dokil
INTO TABLE lt_dokil
FOR ALL ENTRIES IN lt_doku_object_names
WHERE id = 'NA'
AND object = lt_doku_object_names-table_line
AND masterlang = abap_true
ORDER BY PRIMARY KEY.
ELSE.
lt_language_filter = zcl_abapgit_factory=>get_environment( )->get_system_language_filter( ).
SELECT * FROM dokil
INTO TABLE lt_dokil
FOR ALL ENTRIES IN lt_doku_object_names
WHERE id = 'NA'
AND object = lt_doku_object_names-table_line
AND langu IN lt_language_filter
ORDER BY PRIMARY KEY.
ENDIF.
CLEAR ls_dokil-dokstate.
MODIFY lt_dokil FROM ls_dokil TRANSPORTING dokstate WHERE dokstate IS NOT INITIAL.
IF lines( lt_dokil ) > 0.
serialize_longtexts( ii_xml = ii_xml
it_dokil = lt_dokil ).
ENDIF.
ENDMETHOD.
METHOD serialize_texts.
DATA: lv_msg_id TYPE rglif-message_id,
lt_t100_texts TYPE ty_t100_texts,
lt_t100t TYPE TABLE OF t100t,
lt_i18n_langs TYPE TABLE OF langu,
lt_language_filter TYPE zif_abapgit_environment=>ty_system_language_filter.
lv_msg_id = ms_item-obj_name.
IF ii_xml->i18n_params( )-main_language_only = abap_true.
RETURN. " skip
ENDIF.
" Collect additional languages
" Skip main lang - it has been already serialized and also technical languages
lt_language_filter = zcl_abapgit_factory=>get_environment( )->get_system_language_filter( ).
SELECT DISTINCT sprsl AS langu INTO TABLE lt_i18n_langs
FROM t100t
WHERE arbgb = lv_msg_id
AND sprsl IN lt_language_filter
AND sprsl <> mv_language. "#EC CI_BYPASS "#EC CI_GENBUFF
SORT lt_i18n_langs ASCENDING.
IF lines( lt_i18n_langs ) > 0.
SELECT * FROM t100t INTO CORRESPONDING FIELDS OF TABLE lt_t100t
WHERE sprsl <> mv_language
AND arbgb = lv_msg_id. "#EC CI_GENBUFF
SELECT * FROM t100 INTO CORRESPONDING FIELDS OF TABLE lt_t100_texts
FOR ALL ENTRIES IN lt_i18n_langs
WHERE sprsl = lt_i18n_langs-table_line
AND arbgb = lv_msg_id
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
SORT lt_t100t BY sprsl ASCENDING.
SORT lt_t100_texts BY sprsl msgnr ASCENDING.
ii_xml->add( iv_name = 'I18N_LANGS'
ig_data = lt_i18n_langs ).
ii_xml->add( iv_name = 'T100T'
ig_data = lt_t100t ).
ii_xml->add( iv_name = 'T100_TEXTS'
ig_data = lt_t100_texts ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
SELECT SINGLE lastuser FROM t100a INTO rv_user
WHERE arbgb = ms_item-obj_name. "#EC CI_GENBUFF
IF sy-subrc <> 0 OR rv_user = ''.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: ls_t100a TYPE t100a,
lv_frozen TYPE abap_bool,
lv_message_id TYPE arbgb,
lv_access_granted TYPE abap_bool.
* parameter SUPPRESS_DIALOG doesnt exist in all versions of FM RS_DELETE_MESSAGE_ID
* replaced with a copy
lv_message_id = ms_item-obj_name.
IF ms_item-obj_name = space.
zcx_abapgit_exception=>raise( 'Error from (copy of) RS_DELETE_MESSAGE_ID' )."blank message id
ENDIF.
SELECT SINGLE * FROM t100a INTO ls_t100a WHERE arbgb = ms_item-obj_name.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from (copy of) RS_DELETE_MESSAGE_ID' )."not found
ENDIF.
CLEAR lv_frozen.
CALL FUNCTION 'RS_ACCESS_PERMISSION'
EXPORTING
authority_check = 'X'
global_lock = 'X'
mode = 'MODIFY'
object = lv_message_id
object_class = 'T100'
IMPORTING
frozen = lv_frozen
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0 OR lv_frozen <> space.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lv_access_granted = abap_true.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
global_lock = 'X'
object = lv_message_id
object_class = 'MSAG'
mode = 'D'
suppress_dialog = abap_true
EXCEPTIONS
cancelled = 01
permission_failure = 02.
IF sy-subrc <> 0.
IF lv_access_granted = abap_true.
free_access_permission( lv_message_id ).
ENDIF.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
delete_msgid( lv_message_id ).
IF lv_access_granted = abap_true.
free_access_permission( lv_message_id ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
* fm RPY_MESSAGE_ID_INSERT almost works, but not in older versions
DATA: ls_t100a TYPE t100a,
ls_t100t TYPE t100t,
ls_t100u TYPE t100u,
lt_t100 TYPE TABLE OF t100,
lt_before TYPE TABLE OF t100u.
FIELD-SYMBOLS: <ls_t100> LIKE LINE OF lt_t100.
io_xml->read( EXPORTING iv_name = 'T100A'
CHANGING cg_data = ls_t100a ).
io_xml->read( EXPORTING iv_name = 'T100'
CHANGING cg_data = lt_t100 ).
corr_insert( iv_package ).
SELECT * FROM t100u INTO TABLE lt_before
WHERE arbgb = ls_t100a-arbgb ORDER BY msgnr. "#EC CI_GENBUFF "#EC CI_BYPASS
LOOP AT lt_t100 ASSIGNING <ls_t100>.
DELETE lt_before WHERE msgnr = <ls_t100>-msgnr.
MODIFY t100 FROM <ls_t100>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100 modify failed' ).
ENDIF.
CLEAR ls_t100u.
MOVE-CORRESPONDING <ls_t100> TO ls_t100u ##ENH_OK.
ls_t100u-name = sy-uname.
ls_t100u-datum = sy-datum.
ls_t100u-selfdef = '3'.
MODIFY t100u FROM ls_t100u.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100U modify failed' ).
ENDIF.
ENDLOOP.
ls_t100a-masterlang = mv_language.
ls_t100a-lastuser = sy-uname.
ls_t100a-respuser = sy-uname.
ls_t100a-ldate = sy-datum.
ls_t100a-ltime = sy-uzeit.
MODIFY t100a FROM ls_t100a.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100A modify failed' ).
ENDIF.
ls_t100t-sprsl = mv_language.
ls_t100t-arbgb = ls_t100a-arbgb.
ls_t100t-stext = ls_t100a-stext.
MODIFY t100t FROM ls_t100t.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'MSAG: Table T100T modify failed' ).
ENDIF.
LOOP AT lt_before INTO ls_t100u.
DELETE FROM t100 WHERE arbgb = ls_t100u-arbgb
AND msgnr = ls_t100u-msgnr. "#EC CI_SUBRC
DELETE FROM t100u WHERE arbgb = ls_t100u-arbgb
AND msgnr = ls_t100u-msgnr. "#EC CI_SUBRC
ENDLOOP.
deserialize_longtexts( io_xml ).
deserialize_texts( io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_arbgb TYPE t100a-arbgb.
SELECT SINGLE arbgb FROM t100a INTO lv_arbgb
WHERE arbgb = 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( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA: lv_argument TYPE seqg3-garg.
lv_argument = |{ ms_item-obj_name }|.
OVERLAY lv_argument WITH ' '.
lv_argument = lv_argument && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = |ES_MSGSI|
iv_argument = lv_argument ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_msg_id TYPE rglif-message_id,
ls_inf TYPE t100a,
lt_source TYPE ty_t100s.
lv_msg_id = ms_item-obj_name.
SELECT SINGLE * FROM t100a INTO ls_inf
WHERE arbgb = lv_msg_id. "#EC CI_GENBUFF
IF sy-subrc <> 0.
RETURN.
ENDIF.
CLEAR ls_inf-respuser.
SELECT * FROM t100 INTO TABLE lt_source
WHERE sprsl = mv_language
AND arbgb = lv_msg_id
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
CLEAR: ls_inf-lastuser,
ls_inf-ldate,
ls_inf-ltime.
io_xml->add( iv_name = 'T100A'
ig_data = ls_inf ).
io_xml->add( ig_data = lt_source
iv_name = 'T100' ).
serialize_longtexts_msag( it_t100 = lt_source
ii_xml = io_xml ).
serialize_texts( io_xml ).
ENDMETHOD.
ENDCLASS.
| 28.400398 | 99 | 0.630217 |
c46b67ce3e2d9b068670555cfd9c108679fde390
| 8,255 |
abap
|
ABAP
|
src/zcl_abapgit_tadir.clas.abap
|
stoamandl/abapGit-1.80.0
|
a683f04e6519f6b4257f314ed554fbc1c6bd9631
|
[
"MIT"
] | null | null | null |
src/zcl_abapgit_tadir.clas.abap
|
stoamandl/abapGit-1.80.0
|
a683f04e6519f6b4257f314ed554fbc1c6bd9631
|
[
"MIT"
] | null | null | null |
src/zcl_abapgit_tadir.clas.abap
|
stoamandl/abapGit-1.80.0
|
a683f04e6519f6b4257f314ed554fbc1c6bd9631
|
[
"MIT"
] | null | null | null |
CLASS zcl_abapgit_tadir DEFINITION
PUBLIC
FINAL
CREATE PRIVATE
GLOBAL FRIENDS zcl_abapgit_factory .
PUBLIC SECTION.
INTERFACES zif_abapgit_tadir .
PROTECTED SECTION.
PRIVATE SECTION.
METHODS exists
IMPORTING
!is_item TYPE zif_abapgit_definitions=>ty_item
RETURNING
VALUE(rv_exists) TYPE abap_bool .
METHODS check_exists
IMPORTING
!it_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt
RETURNING
VALUE(rt_tadir) TYPE zif_abapgit_definitions=>ty_tadir_tt
RAISING
zcx_abapgit_exception .
METHODS build
IMPORTING
!iv_package TYPE tadir-devclass
!iv_top TYPE tadir-devclass
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!iv_ignore_subpackages TYPE abap_bool DEFAULT abap_false
!iv_only_local_objects TYPE abap_bool
!io_log TYPE REF TO zcl_abapgit_log OPTIONAL
!io_folder_logic TYPE REF TO zcl_abapgit_folder_logic OPTIONAL
RETURNING
VALUE(rt_tadir) TYPE zif_abapgit_definitions=>ty_tadir_tt
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_TADIR IMPLEMENTATION.
METHOD build.
DATA: lt_tdevc TYPE STANDARD TABLE OF tdevc,
lv_path TYPE string,
lo_skip_objects TYPE REF TO zcl_abapgit_skip_objects,
lt_excludes TYPE RANGE OF trobjtype,
lt_srcsystem TYPE RANGE OF tadir-srcsystem,
ls_srcsystem LIKE LINE OF lt_srcsystem,
ls_exclude LIKE LINE OF lt_excludes,
lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic,
lv_last_package TYPE devclass VALUE cl_abap_char_utilities=>horizontal_tab,
lt_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt.
FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF rt_tadir,
<lv_package> TYPE devclass.
"Determine Packages to Read
IF iv_ignore_subpackages = abap_false.
lt_packages = zcl_abapgit_factory=>get_sap_package( iv_package )->list_subpackages( ).
ENDIF.
INSERT iv_package INTO lt_packages INDEX 1.
ls_exclude-sign = 'I'.
ls_exclude-option = 'EQ'.
ls_exclude-low = 'SOTR'.
APPEND ls_exclude TO lt_excludes.
ls_exclude-low = 'SFB1'.
APPEND ls_exclude TO lt_excludes.
ls_exclude-low = 'SFB2'.
APPEND ls_exclude TO lt_excludes.
ls_exclude-low = 'STOB'. " auto generated by core data services
APPEND ls_exclude TO lt_excludes.
IF iv_only_local_objects = abap_true.
ls_srcsystem-sign = 'I'.
ls_srcsystem-option = 'EQ'.
ls_srcsystem-low = sy-sysid.
APPEND ls_srcsystem TO lt_srcsystem.
ENDIF.
IF lt_packages IS NOT INITIAL.
SELECT * FROM tadir
INTO CORRESPONDING FIELDS OF TABLE rt_tadir
FOR ALL ENTRIES IN lt_packages
WHERE devclass = lt_packages-table_line
AND pgmid = 'R3TR'
AND object NOT IN lt_excludes
AND delflag = abap_false
AND srcsystem IN lt_srcsystem
ORDER BY PRIMARY KEY. "#EC CI_GENBUFF "#EC CI_SUBRC
ENDIF.
SORT rt_tadir BY devclass pgmid object obj_name.
CREATE OBJECT lo_skip_objects.
rt_tadir = lo_skip_objects->skip_sadl_generated_objects(
it_tadir = rt_tadir
io_log = io_log ).
LOOP AT lt_packages ASSIGNING <lv_package>.
" Local packages are not in TADIR, only in TDEVC, act as if they were
IF <lv_package> CP '$*'. " OR <package> CP 'T*' ).
APPEND INITIAL LINE TO rt_tadir ASSIGNING <ls_tadir>.
<ls_tadir>-pgmid = 'R3TR'.
<ls_tadir>-object = 'DEVC'.
<ls_tadir>-obj_name = <lv_package>.
<ls_tadir>-devclass = <lv_package>.
ENDIF.
ENDLOOP.
LOOP AT rt_tadir ASSIGNING <ls_tadir>.
IF lv_last_package <> <ls_tadir>-devclass.
"Change in Package
lv_last_package = <ls_tadir>-devclass.
IF NOT io_dot IS INITIAL.
"Reuse given Folder Logic Instance
IF lo_folder_logic IS NOT BOUND.
"Get Folder Logic Instance
lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ).
ENDIF.
lv_path = lo_folder_logic->package_to_path(
iv_top = iv_top
io_dot = io_dot
iv_package = <ls_tadir>-devclass ).
ENDIF.
ENDIF.
<ls_tadir>-path = lv_path.
CASE <ls_tadir>-object.
WHEN 'SICF'.
* replace the internal GUID with a hash of the path
TRY.
CALL METHOD ('ZCL_ABAPGIT_OBJECT_SICF')=>read_sicf_url
EXPORTING
iv_obj_name = <ls_tadir>-obj_name
RECEIVING
rv_hash = <ls_tadir>-obj_name+15.
CATCH cx_sy_dyn_call_illegal_method.
* SICF might not be supported in some systems, assume this code is not called
ENDTRY.
ENDCASE.
ENDLOOP.
ENDMETHOD.
METHOD check_exists.
DATA: lo_progress TYPE REF TO zcl_abapgit_progress,
ls_item TYPE zif_abapgit_definitions=>ty_item.
FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF it_tadir.
CREATE OBJECT lo_progress
EXPORTING
iv_total = lines( it_tadir ).
* rows from database table TADIR are not removed for
* transportable objects until the transport is released
LOOP AT it_tadir ASSIGNING <ls_tadir>.
IF sy-tabix MOD 200 = 0.
lo_progress->show(
iv_current = sy-tabix
iv_text = |Check object exists { <ls_tadir>-object } { <ls_tadir>-obj_name }| ).
ENDIF.
ls_item-obj_type = <ls_tadir>-object.
ls_item-obj_name = <ls_tadir>-obj_name.
ls_item-devclass = <ls_tadir>-devclass.
IF exists( ls_item ) = abap_true.
APPEND <ls_tadir> TO rt_tadir.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD exists.
IF is_item IS INITIAL.
RETURN.
ENDIF.
IF zcl_abapgit_objects=>is_supported( is_item ) = abap_false.
rv_exists = abap_true.
RETURN.
ENDIF.
rv_exists = zcl_abapgit_objects=>exists( is_item ).
ENDMETHOD.
METHOD zif_abapgit_tadir~get_object_package.
DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir,
ls_item TYPE zif_abapgit_definitions=>ty_item.
ls_tadir = zif_abapgit_tadir~read_single(
iv_pgmid = iv_pgmid
iv_object = iv_object
iv_obj_name = iv_obj_name ).
IF ls_tadir-delflag = 'X'.
RETURN. "Mark for deletion -> return nothing
ENDIF.
ls_item-obj_type = ls_tadir-object.
ls_item-obj_name = ls_tadir-obj_name.
ls_item-devclass = ls_tadir-devclass.
IF exists( ls_item ) = abap_false.
RETURN.
ENDIF.
rv_devclass = ls_tadir-devclass.
ENDMETHOD.
METHOD zif_abapgit_tadir~read.
DATA: li_exit TYPE REF TO zif_abapgit_exit.
* start recursion
* hmm, some problems here, should TADIR also build path?
rt_tadir = build( iv_package = iv_package
iv_top = iv_package
io_dot = io_dot
iv_ignore_subpackages = iv_ignore_subpackages
iv_only_local_objects = iv_only_local_objects
io_log = io_log ).
li_exit = zcl_abapgit_exit=>get_instance( ).
li_exit->change_tadir(
EXPORTING
iv_package = iv_package
io_log = io_log
CHANGING
ct_tadir = rt_tadir ).
rt_tadir = check_exists( rt_tadir ).
ENDMETHOD.
METHOD zif_abapgit_tadir~read_single.
IF iv_object = 'SICF'.
TRY.
CALL METHOD ('ZCL_ABAPGIT_OBJECT_SICF')=>read_tadir
EXPORTING
iv_pgmid = iv_pgmid
iv_obj_name = iv_obj_name
RECEIVING
rs_tadir = rs_tadir.
CATCH cx_sy_dyn_call_illegal_method.
* SICF might not be supported in some systems, assume this code is not called
ENDTRY.
ELSE.
SELECT SINGLE * FROM tadir INTO CORRESPONDING FIELDS OF rs_tadir
WHERE pgmid = iv_pgmid
AND object = iv_object
AND obj_name = iv_obj_name. "#EC CI_SUBRC
ENDIF.
ENDMETHOD.
ENDCLASS.
| 29.801444 | 93 | 0.636584 |
c46ccf5e4d00f5bd104c03f03c1125d6be1bdc8d
| 8,728 |
abap
|
ABAP
|
src/ztest_sorts_and_read.prog.abap
|
sbcgua/benchmarks
|
bf8827665f2caca6d3d5f0d741b558c310f302e5
|
[
"MIT"
] | null | null | null |
src/ztest_sorts_and_read.prog.abap
|
sbcgua/benchmarks
|
bf8827665f2caca6d3d5f0d741b558c310f302e5
|
[
"MIT"
] | null | null | null |
src/ztest_sorts_and_read.prog.abap
|
sbcgua/benchmarks
|
bf8827665f2caca6d3d5f0d741b558c310f302e5
|
[
"MIT"
] | null | null | null |
REPORT ZTEST_SORTS_AND_READ.
include ztest_benchmark.
class lcl_app definition final.
public section.
types:
begin of ty_pair,
key type char80,
val type char80,
end of ty_pair,
tt_pair type standard table of ty_pair with default key,
ts_pair type sorted table of ty_pair with unique key key,
tsnu_pair type sorted table of ty_pair with non-unique key key,
th_pair type hashed table of ty_pair with unique key key.
types:
begin of ty_long,
key1 type char80,
key2 type char80,
key3 type char80,
key4 type char80,
val type char80,
end of ty_long,
tt_long type standard table of ty_long with default key,
ts_long type sorted table of ty_long with unique key key1 key3 key4,
th_long type hashed table of ty_long with unique key key1 key3 key4.
methods prepare.
methods run
importing
iv_method type string.
methods std.
methods std_bin.
methods sorted.
methods sorted_tk.
methods sorted_nu.
methods hashed.
methods hashed_tk.
methods long_std.
methods long_std_bin.
methods long_sorted.
methods long_hashed.
methods long_std_part.
methods long_sorted_part.
methods loop_all.
methods loop_std.
methods loop_sorted.
methods loop_std_starting.
methods loop_sorted_starting.
class-methods main.
data mt_std type tt_pair.
data mt_sorted type ts_pair.
data mt_sorted_nu type tsnu_pair.
data mt_hashed type th_pair.
data mt_lookups type tt_pair.
data mt_long_std type tt_long.
data mt_long_sorted type ts_long.
data mt_long_hashed type th_long.
data mt_long_lookups type tt_long.
data mv_num_rounds type i.
endclass.
class lcl_app implementation.
method prepare.
data val type char80.
field-symbols <i> like line of mt_std.
do 125000 times.
val = sy-index.
append initial line to mt_std assigning <i>.
<i>-key = val.
<i>-val = val.
if val mod 1000 = 0.
append <i> to mt_lookups.
endif.
enddo.
mt_sorted = mt_std.
mt_sorted_nu = mt_std.
mt_hashed = mt_std.
**********************************************************************
data j like line of mt_long_std.
do 50 times.
j-key1 = sy-index.
do 1 times.
j-key2 = sy-index.
do 50 times.
j-key3 = sy-index.
do 50 times.
j-key4 = sy-index.
j-val = sy-index.
append j to mt_long_std.
if j-key1 mod 10 = 0 and j-key3 mod 10 = 0 and j-key4 mod 10 = 0.
append j to mt_long_lookups.
endif.
enddo.
enddo.
enddo.
enddo.
mt_long_sorted = mt_long_std.
mt_long_hashed = mt_Long_std.
endmethod.
method std.
field-symbols <i> like line of mt_lookups.
loop at mt_lookups assigning <i>.
read table mt_std transporting no fields
with key
key = <i>-key.
assert sy-subrc = 0.
endloop.
endmethod.
method std_bin.
field-symbols <i> like line of mt_lookups.
loop at mt_lookups assigning <i>.
read table mt_std transporting no fields
binary search
with key
key = <i>-key.
assert sy-subrc = 0.
endloop.
endmethod.
method sorted.
field-symbols <i> like line of mt_lookups.
loop at mt_lookups assigning <i>.
read table mt_sorted transporting no fields
with key
key = <i>-key.
assert sy-subrc = 0.
endloop.
endmethod.
method sorted_tk.
field-symbols <i> like line of mt_lookups.
loop at mt_lookups assigning <i>.
read table mt_sorted transporting no fields
with table key
key = <i>-key.
assert sy-subrc = 0.
endloop.
endmethod.
method sorted_nu.
field-symbols <i> like line of mt_lookups.
loop at mt_lookups assigning <i>.
read table mt_sorted_nu transporting no fields
with table key
key = <i>-key.
assert sy-subrc = 0.
endloop.
endmethod.
method hashed.
field-symbols <i> like line of mt_lookups.
loop at mt_lookups assigning <i>.
read table mt_hashed transporting no fields
with key
key = <i>-key.
assert sy-subrc = 0.
endloop.
endmethod.
method hashed_tk.
field-symbols <i> like line of mt_lookups.
loop at mt_lookups assigning <i>.
read table mt_hashed transporting no fields
with key
key = <i>-key.
assert sy-subrc = 0.
endloop.
endmethod.
method long_std.
field-symbols <i> like line of mt_long_lookups.
loop at mt_long_lookups assigning <i>.
read table mt_long_std transporting no fields
with key
key1 = <i>-key1
key2 = <i>-key2
key3 = <i>-key3
key4 = <i>-key4.
assert sy-subrc = 0.
endloop.
endmethod.
method long_std_part.
field-symbols <i> like line of mt_long_lookups.
loop at mt_long_lookups assigning <i>.
read table mt_long_std transporting no fields
with key
key1 = <i>-key1.
assert sy-subrc = 0.
endloop.
endmethod.
method long_std_bin.
field-symbols <i> like line of mt_long_lookups.
loop at mt_long_lookups assigning <i>.
read table mt_long_std transporting no fields
binary search
with key
key1 = <i>-key1
key2 = <i>-key2
key3 = <i>-key3
key4 = <i>-key4.
assert sy-subrc = 0.
endloop.
endmethod.
method long_sorted.
field-symbols <i> like line of mt_long_lookups.
loop at mt_long_lookups assigning <i>.
read table mt_long_sorted transporting no fields
with key
key1 = <i>-key1
key2 = <i>-key2
key3 = <i>-key3
key4 = <i>-key4.
assert sy-subrc = 0.
endloop.
endmethod.
method long_sorted_part.
field-symbols <i> like line of mt_long_lookups.
loop at mt_long_lookups assigning <i>.
read table mt_long_sorted transporting no fields
with key
key1 = <i>-key1.
assert sy-subrc = 0.
endloop.
endmethod.
method long_hashed.
field-symbols <i> like line of mt_long_lookups.
loop at mt_long_lookups assigning <i>.
read table mt_long_hashed transporting no fields
with key
key1 = <i>-key1
key2 = <i>-key2
key3 = <i>-key3
key4 = <i>-key4.
assert sy-subrc = 0.
endloop.
endmethod.
method loop_all.
field-symbols <i> like line of mt_long_std.
data ls_a like <i>-key1.
loop at mt_long_std assigning <i>.
ls_a = <i>-key1.
endloop.
endmethod.
method loop_std.
field-symbols <i> like line of mt_long_std.
data ls_a like <i>-key1.
loop at mt_long_std assigning <i> where key1 = '25'.
ls_a = <i>-key1.
endloop.
endmethod.
method loop_sorted.
field-symbols <i> like line of mt_long_sorted.
data ls_a like <i>-key1.
loop at mt_long_sorted assigning <i> where key1 = '25'.
ls_a = <i>-key1.
endloop.
endmethod.
method loop_std_starting.
field-symbols <i> like line of mt_long_std.
data ls_a like <i>-key1.
loop at mt_long_std assigning <i> where key1 cp '2*'.
ls_a = <i>-key1.
endloop.
endmethod.
method loop_sorted_starting.
field-symbols <i> like line of mt_long_sorted.
data ls_a like <i>-key1.
loop at mt_long_sorted assigning <i> where key1 cp '2*'.
ls_a = <i>-key1.
endloop.
endmethod.
method run.
data lo_benchmark type ref to lcl_benchmark.
create object lo_benchmark
exporting
io_object = me
iv_method = iv_method
iv_times = mv_num_rounds.
lo_benchmark->run( ).
lo_benchmark->print( ).
endmethod.
method main.
data lo_app type ref to lcl_app.
create object lo_app.
lo_app->prepare( ).
lo_app->mv_num_rounds = 10.
lo_app->run( 'std' ).
lo_app->run( 'std_bin' ).
lo_app->run( 'sorted' ).
lo_app->run( 'sorted_tk' ).
lo_app->run( 'sorted_nu' ).
lo_app->run( 'hashed' ).
lo_app->run( 'hashed_tk' ).
lo_app->run( 'long_std' ).
lo_app->run( 'long_std_bin' ).
lo_app->run( 'long_sorted' ).
lo_app->run( 'long_hashed' ).
" lo_app->run( 'long_std_part' ).
lo_app->run( 'long_sorted_part' ).
lo_app->run( 'loop_all' ).
lo_app->run( 'loop_std' ).
lo_app->run( 'loop_sorted' ).
lo_app->run( 'loop_std_starting' ).
lo_app->run( 'loop_sorted_starting' ).
endmethod.
endclass.
start-of-selection.
lcl_app=>main( ).
| 22.152284 | 77 | 0.613772 |
c46da5a620392c1bd89eb64fe5e12c79d308b57c
| 2,736 |
abap
|
ABAP
|
src/zevolving_dp_proxy.prog.abap
|
tricktresor/zevolving_design_pattern
|
150fc45e85e8066f2993faca79068fa418f42438
|
[
"MIT"
] | null | null | null |
src/zevolving_dp_proxy.prog.abap
|
tricktresor/zevolving_design_pattern
|
150fc45e85e8066f2993faca79068fa418f42438
|
[
"MIT"
] | null | null | null |
src/zevolving_dp_proxy.prog.abap
|
tricktresor/zevolving_design_pattern
|
150fc45e85e8066f2993faca79068fa418f42438
|
[
"MIT"
] | null | null | null |
REPORT ZEVOLVING_DP_PROXY.
" https://zevolving.com/2012/01/abap-objects-design-patterns-proxy/
INTERFACE lif_data.
DATA: t_t100 TYPE tt_t100.
METHODS: get_data
IMPORTING iv_spras TYPE spras OPTIONAL
CHANGING ct_data TYPE tt_t100.
METHODS: write_data.
ENDINTERFACE. "lif_data
*
CLASS lcl_proxy_data DEFINITION.
PUBLIC SECTION.
INTERFACES: lif_data.
PRIVATE SECTION.
DATA: o_t100_data TYPE REF TO lif_data.
ENDCLASS. "lcl_proxy_Data DEFINITION
*
CLASS lcl_t100_data DEFINITION.
PUBLIC SECTION.
INTERFACES: lif_data.
ENDCLASS. "lcl_t100_Data DEFINITION
*
CLASS lcl_proxy_data IMPLEMENTATION.
METHOD lif_data~get_data.
* validations
IF iv_spras NE sy-langu.
EXIT.
ENDIF.
* Authority check
* some other check
* instantiate "Real" Object
CREATE OBJECT o_t100_data TYPE lcl_t100_data.
o_t100_data->get_data(
EXPORTING
iv_spras = iv_spras
CHANGING
ct_data = ct_data ).
ENDMETHOD. "lif_data~get_data
METHOD lif_data~write_data.
IF o_t100_data IS NOT BOUND.
WRITE:/ 'No data to display'.
ELSE.
o_t100_data->write_data( ).
ENDIF.
ENDMETHOD. "lif_data~write_Data
ENDCLASS. "lcl_proxy_Data IMPLEMENTATION
*
CLASS lcl_t100_data IMPLEMENTATION.
METHOD lif_data~get_data.
* This process takes very long time to
* get the data. You can imagine this happening
* when accessing big tables without index.
SELECT * FROM t100
INTO TABLE lif_data~t_t100
UP TO 20 ROWS
WHERE sprsl = iv_spras.
ct_data = lif_data~t_t100.
ENDMETHOD. "lif_data~get_data
METHOD lif_data~write_data.
DATA: lv_lines TYPE i.
lv_lines = LINES( lif_data~t_t100 ).
WRITE: / 'Total lines',lv_lines.
ENDMETHOD. "lif_data~write_Data
ENDCLASS. "lcl_t100_Data IMPLEMENTATION
*
CLASS lcl_main_app DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: run.
ENDCLASS. "lcl_main_app DEFINITION
*
CLASS lcl_main_app IMPLEMENTATION.
METHOD run.
DATA: lo_proxy TYPE REF TO lif_data.
DATA: lt_data TYPE tt_t100.
*
CREATE OBJECT lo_proxy TYPE lcl_proxy_data.
lo_proxy->get_data( EXPORTING iv_spras = 'x'
CHANGING ct_data = lt_data ).
lo_proxy->write_data( ).
*
CREATE OBJECT lo_proxy TYPE lcl_proxy_data.
lo_proxy->get_data( EXPORTING iv_spras = sy-langu
CHANGING ct_data = lt_data ).
lo_proxy->write_data( ).
ENDMETHOD. "run
ENDCLASS. "lcl_main_app IMPLEMENTATION
*
START-OF-SELECTION.
lcl_main_app=>run( ).
| 27.636364 | 67 | 0.65424 |
c47666eaca90dcdbfa4f605e1b033dadcaa7be6d
| 1,482 |
abap
|
ABAP
|
src/zif_btci_dynpro.intf.abap
|
martinandrewcavanagh/batch-input-helper
|
cff17629c635a1e4e5cc36a7d236f6642f11d361
|
[
"MIT"
] | null | null | null |
src/zif_btci_dynpro.intf.abap
|
martinandrewcavanagh/batch-input-helper
|
cff17629c635a1e4e5cc36a7d236f6642f11d361
|
[
"MIT"
] | null | null | null |
src/zif_btci_dynpro.intf.abap
|
martinandrewcavanagh/batch-input-helper
|
cff17629c635a1e4e5cc36a7d236f6642f11d361
|
[
"MIT"
] | null | null | null |
interface ZIF_BTCI_DYNPRO
public .
DATA program TYPE syrepid READ-ONLY .
DATA dynpro TYPE sydynnr READ-ONLY .
DATA bdc_lines TYPE wdkbdcdata_tty .
METHODS set_field
IMPORTING
!name TYPE c OPTIONAL
!value TYPE simple OPTIONAL
!format_field_automatically TYPE abap_bool DEFAULT abap_true
PREFERRED PARAMETER value
RETURNING
VALUE(fluent_dynpro) TYPE REF TO zif_btci_dynpro .
METHODS append_steploop_field
IMPORTING
!name TYPE c OPTIONAL
!steploop TYPE numeric
!value TYPE simple
RETURNING
VALUE(fluent_dynpro) TYPE REF TO zif_btci_dynpro .
METHODS set_cursor
IMPORTING
!name TYPE c
!steploop_row TYPE i OPTIONAL
RETURNING
VALUE(fluent_dynpro) TYPE REF TO zif_btci_dynpro .
METHODS set_cursor_dobj
IMPORTING
!dobj TYPE any
!steploop_row TYPE i OPTIONAL
RETURNING
VALUE(fluent_dynpro) TYPE REF TO zif_btci_dynpro .
METHODS set_cursor_list
IMPORTING
!row TYPE i
!column TYPE i
RETURNING
VALUE(fluent_dynpro) TYPE REF TO zif_btci_dynpro .
METHODS set_okcode
IMPORTING
!okcode TYPE syucomm
RETURNING
VALUE(fluent_dynpro) TYPE REF TO zif_btci_dynpro .
endinterface.
| 32.217391 | 68 | 0.599865 |
c478316930bff3f244dc21038969d8972e3f9913
| 474 |
abap
|
ABAP
|
src/git/zcl_abapgit_git_pack.clas.locals_imp.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 797 |
2015-02-06T15:38:41.000Z
|
2020-09-23T02:57:02.000Z
|
src/git/zcl_abapgit_git_pack.clas.locals_imp.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 2,776 |
2015-01-13T03:59:55.000Z
|
2020-09-23T21:46:34.000Z
|
src/git/zcl_abapgit_git_pack.clas.locals_imp.abap
|
jeevanrajv1901/ABAPGIT
|
6d2deece76a481da75a04e4bbafae2d286b64834
|
[
"MIT"
] | 499 |
2015-01-13T03:41:36.000Z
|
2020-09-22T11:50:54.000Z
|
*"* use this source file for the definition and implementation of
*"* local helper classes, interface definitions and type
*"* declarations
CLASS lcl_stream IMPLEMENTATION.
METHOD constructor.
mv_data = iv_data.
ENDMETHOD.
METHOD eat_byte.
rv_x = mv_data(1).
mv_data = mv_data+1.
ENDMETHOD.
METHOD get.
rv_data = mv_data.
ENDMETHOD.
METHOD eat_bytes.
rv_x = mv_data(iv_length).
mv_data = mv_data+iv_length.
ENDMETHOD.
ENDCLASS.
| 18.230769 | 65 | 0.706751 |
c47bae8f79094a8fec57dae9243992a5b6cf8307
| 105,228 |
abap
|
ABAP
|
src/legacy/#dmo#cl_flight_data_generat_14.clas.locals_imp.abap
|
SAP-Cloud-Platform/flight14
|
4a89f087f6906c61683be65938dc48265ac70344
|
[
"BSD-Source-Code"
] | 2 |
2020-08-31T12:56:04.000Z
|
2021-04-12T07:36:40.000Z
|
src/legacy/#dmo#cl_flight_data_generat_14.clas.locals_imp.abap
|
SAP-Cloud-Platform/flight14
|
4a89f087f6906c61683be65938dc48265ac70344
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#cl_flight_data_generat_14.clas.locals_imp.abap
|
SAP-Cloud-Platform/flight14
|
4a89f087f6906c61683be65938dc48265ac70344
|
[
"BSD-Source-Code"
] | null | null | null |
INTERFACE lif_data_generator.
CLASS-METHODS:
create
IMPORTING out TYPE REF TO if_oo_adt_classrun_out OPTIONAL.
ENDINTERFACE.
CLASS lcl_agency_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: tt_agency TYPE STANDARD TABLE OF /dmo/agency14 WITH KEY agency_id.
CLASS-METHODS: get_data
RETURNING VALUE(rt_data) TYPE tt_agency.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_agency_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF.
DELETE FROM /dmo/agency14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
DATA(lt_data) = get_data( ).
IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF.
INSERT /dmo/agency14 FROM TABLE @lt_data.
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD get_data.
rt_data = VALUE tt_agency(
( agency_id = '070001'
name = 'Sunshine Travel'
street = '134 West Street '
postal_code = '54323 '
city = 'Rochester '
country_code = 'US '
phone_number = '+1 901-632-5620 '
web_address = 'http://www.sunshine-travel.sap '
email_address = '[email protected] '
)
( agency_id = '070002'
name = 'Fly High'
street = 'Berliner Allee 11 '
postal_code = '40880 '
city = 'Duesseldorf '
country_code = 'DE '
phone_number = '+49 2102 69555 '
web_address = 'http://www.flyhigh.sap '
email_address = '[email protected] '
)
( agency_id = '070003'
name = 'Happy Hopping'
street = 'Calvinstr. 36 '
postal_code = '13467 '
city = 'Berlin '
country_code = 'DE '
phone_number = '+49 30-8853-0 '
web_address = 'http://www.haphop.sap '
email_address = '[email protected] '
)
( agency_id = '070004'
name = 'Pink Panther'
street = 'Auf der Schanz 54 '
postal_code = '65936 '
city = 'Frankfurt '
country_code = 'DE '
phone_number = '+49 69-467653-0 '
web_address = 'http://www.pinkpanther.sap'
email_address = '[email protected] '
)
( agency_id = '070005'
name = 'Your Choice'
street = 'Gustav-Jung-Str. 425 '
postal_code = '90455'
city = 'Nuernberg'
country_code = 'DE'
phone_number = '+49 9256-4548-0'
web_address = 'http://www.yc.sap'
email_address = '[email protected]'
)
( agency_id = '070006'
name = 'Bella Italia'
street = 'Via Marconi 123'
postal_code = '00139'
city = 'Roma'
country_code = 'IT'
phone_number = '+39 6 893546721'
web_address = 'http://www.tours.it/Adventure/'
email_address = '[email protected]/Adventure/'
)
( agency_id = '070007'
name = 'Hot Socks Travel'
street = '224 Balnagask Rd '
postal_code = '8053 '
city = 'Sydney'
country_code = 'AU '
phone_number = '+61 2 2004 5000 '
web_address = 'http://www.hst.co.au'
email_address = '[email protected]'
)
( agency_id = '070008'
name = 'Burns Nuclear'
street = '14 Science Park Drive'
postal_code = '118228'
city = 'Singapore'
country_code = 'SG'
phone_number = '+65 777-5566'
web_address = 'http://www.burns-burns-burns.sg'
email_address = '[email protected]'
)
( agency_id = '070009'
name = 'Honauer Reisen GmbH'
street = 'Baumgarten 8'
postal_code = '4212'
city = 'Neumarkt'
country_code = 'AT'
phone_number = '+43 7941 8903'
web_address = 'http://www.honauer.at'
email_address = '[email protected]'
)
( agency_id = '070010'
name = 'Travel from Walldorf'
street = 'Altonaer Str. 24 '
postal_code = '10557 '
city = 'Berlin '
country_code = 'DE '
phone_number = '+49 30-622860 '
web_address = 'http://www.travel-from-walldorf'
email_address = 'info@travel-from-walldorf'
)
( agency_id = '070011'
name = 'Voyager Enterprises'
street = 'Gustavslundsvaegen 151'
postal_code = '70563 '
city = 'Stockholm '
country_code = 'SE '
phone_number = '+46 8/ 587 70000'
web_address = 'http://www.starfleet.ufp'
email_address = '[email protected]'
)
( agency_id = '070012'
name = 'Ben McCloskey Ltd.'
street = '74 Court Oak Rd'
postal_code = 'B17 9TN'
city = 'Birmingham'
country_code = 'GB'
phone_number = '+44 121 365-2251 '
web_address = 'http://www.ben-mcCloskey.co.uk'
email_address = '[email protected]'
)
( agency_id = '070013'
name = 'Pillepalle Trips'
street = 'Gorki Park 4 '
postal_code = '8008 '
city = 'Zuerich '
country_code = 'CH '
phone_number = '+41 1 345-5321 '
web_address = 'http://www.pi-pa-tri.sap'
email_address = '[email protected]'
)
( agency_id = '070014'
name = 'Kangeroos'
street = 'Lancaster drive 435 '
postal_code = '20001 '
city = 'London '
country_code = 'GB '
phone_number = '+44 171-2937638 '
web_address = 'http://www.hopp.sap '
email_address = '[email protected] '
)
( agency_id = '070015'
name = 'Bavarian Castle'
street = 'Pilnizerstr. 241 '
postal_code = '01069 '
city = 'Dresden '
country_code = 'DE '
phone_number = '+49 98-32832732 '
web_address = 'http://www.neu.schwanstein.sap '
email_address = '[email protected] '
)
( agency_id = '070016'
name = 'Ali''s Bazar'
street = '45, Mac Arthur Boulevard '
postal_code = '19113 '
city = 'Boston '
country_code = 'US '
phone_number = '+1 508-692-5200 '
web_address = 'http://www.ali.sap '
email_address = '[email protected] '
)
( agency_id = '070017'
name = 'Super Agency'
street = '50 Cranworth St'
postal_code = 'G12 8AG'
city = 'Glasgow'
country_code = 'GB'
phone_number = '+44 141 711-5643'
web_address = 'http://www.super.sap'
email_address = '[email protected]'
)
( agency_id = '070018'
name = 'Wang Chong'
street = 'Gagarine Park '
postal_code = '150021 '
city = 'Moscow '
country_code = 'RU '
phone_number = '+7 3287-213321 '
web_address = 'http://www.wang.chong.sap'
email_address = '[email protected]'
)
( agency_id = '070019'
name = 'Around the World'
street = 'An der Breiten Wiese 122 '
postal_code = '30625 '
city = 'Hannover '
country_code = 'DE '
phone_number = '+49 511-347589-0 '
web_address = 'http://www.atw.sap'
email_address = '[email protected]'
)
( agency_id = '070020'
name = 'No Return'
street = 'Wahnheider Str. 57 '
postal_code = '51105 '
city = 'Koeln '
country_code = 'DE '
phone_number = '+49 221-5689-100 '
web_address = 'http://www.bye-bye.sap '
email_address = '[email protected] '
)
( agency_id = '070021'
name = 'Special Agency Peru'
street = 'Triberger Str. 42 '
postal_code = '70569 '
city = 'Stuttgart '
country_code = 'DE '
phone_number = '+49 711-7100 '
web_address = 'http://www.sap.com '
email_address = '[email protected] '
)
( agency_id = '070022'
name = 'Caribian Dreams'
street = 'Deichstrasse 45 '
postal_code = '26721 '
city = 'Emden '
country_code = 'DE '
phone_number = '+49 2670-8560-0 '
web_address = 'http://www.cuba-libre.sap '
email_address = '[email protected] '
)
( agency_id = '070023'
name = 'Asia By Plane'
street = '6-9 Iidabashi 7-chome'
postal_code = '102-0072'
city = 'Tokyo '
country_code = 'JP'
phone_number = '+81 3-3239-3501 '
web_address = 'http://www.asia-by-plane.co.jp'
email_address = '[email protected]'
)
( agency_id = '070024'
name = 'Everywhere'
street = 'Regensburger Platz 23 '
postal_code = '81679 '
city = 'Muenchen '
country_code = 'DE '
phone_number = '+49 89-2499239 '
web_address = 'http://www.everywhere.sap'
email_address = '[email protected]'
)
( agency_id = '070025'
name = 'Happy Holiday'
street = 'Rastenburger Str. 12'
postal_code = '28779 '
city = 'Bremen '
country_code = 'DE '
phone_number = '+49 3266-288817 '
web_address = 'http://www.haphol.sap'
email_address = '[email protected]'
)
( agency_id = '070026'
name = 'No Name'
street = 'Schwalbenweg 43 '
postal_code = '52078 '
city = 'Aachen '
country_code = 'DE '
phone_number = '+49 241-77729 '
web_address = 'http://www.nn.sap'
email_address = '[email protected]'
)
( agency_id = '070027'
name = 'Fly Low'
street = 'Chemnitzer Str. 42 '
postal_code = '01187 '
city = 'Dresden '
country_code = 'DE '
phone_number = '+49 351-5423-00 '
web_address = 'http://www.fly-low.sap'
email_address = '[email protected]'
)
( agency_id = '070028'
name = 'Aussie Travel'
street = 'Queens Road '
postal_code = 'M8 7RYP '
city = 'Manchester '
country_code = 'GB '
phone_number = '+44 161 2052000 '
web_address = 'http://www.down-under.sap'
email_address = '[email protected]'
)
( agency_id = '070029'
name = 'Up ''n'' Away'
street = 'Nackenbergerstr. 92 '
postal_code = '30625 '
city = 'Hannover '
country_code = 'DE '
phone_number = '+49 511 403266-0 '
web_address = 'http://www.una.sap '
email_address = '[email protected] '
)
( agency_id = '070030'
name = 'Trans World Travel'
street = '100 Industrial Drive '
postal_code = '60804 '
city = 'Chicago '
country_code = 'US '
phone_number = '+1 708-454-8723 '
web_address = 'http://www.twt.sap '
email_address = '[email protected] '
)
( agency_id = '070031'
name = 'Bright Side of Life'
street = '340 State Street '
postal_code = '30432 '
city = 'San Francisco '
country_code = 'US '
phone_number = '+1 415-454-9877 '
web_address = 'http://www.ruebennase.sap '
email_address = '[email protected] '
)
( agency_id = '070032'
name = 'Sunny, Sunny, Sunny'
street = '1300 State Street '
postal_code = '19003 '
city = 'Philadelphia '
country_code = 'US '
phone_number = '+1 215-090-7659 '
web_address = 'http://www.s3.sap '
email_address = '[email protected] '
)
( agency_id = '070033'
name = 'Fly & Smile'
street = 'Zeppelinstr. 17 '
postal_code = '60318 '
city = 'Frankfurt '
country_code = 'DE '
phone_number = '+49 69-99-0 '
web_address = 'http://www.fly-and-smile.sap '
email_address = '[email protected] '
)
( agency_id = '070034'
name = 'Supercheap'
street = '1400, Washington Circle '
postal_code = '30439 '
city = 'Los Angeles '
country_code = 'US '
phone_number = '+1 251-369-2510 '
web_address = 'http://www.supercheap.sap '
email_address = '[email protected] '
)
( agency_id = '070035'
name = 'Hitchhiker'
street = '21 Rue de Moselle '
postal_code = '92132 '
city = 'Issy-les-Moulineaux '
country_code = 'FR '
phone_number = '+33 1-405-555-888 '
web_address = 'http://www.42.sap '
email_address = '[email protected] '
)
( agency_id = '070036'
name = 'Fly Now, Pay Later'
street = '100 Madison '
postal_code = '11012 '
city = 'New York '
country_code = 'US '
phone_number = '+1 512 343-8543 '
web_address = 'http://www.fn-pl.sap '
email_address = '[email protected] '
)
( agency_id = '070037'
name = 'Real Weird Vacation'
street = '949 5th Street '
postal_code = 'V6T 1Z4'
city = 'Vancouver'
country_code = 'CA '
phone_number = '+1 604 827-8024'
web_address = 'http://www.reweva.sap '
email_address = '[email protected] '
)
( agency_id = '070038'
name = 'Cap Travels Ltd.'
street = '10 Mandela St'
postal_code = '2128'
city = 'Johannesburg'
country_code = 'ZA'
phone_number = '+27 11 886-8981'
web_address = 'http://www.cap-travels.co.za'
email_address = '[email protected]'
)
( agency_id = '070039'
name = 'Rainy, Stormy, Cloudy'
street = 'Lindenstr. 462 '
postal_code = '70563 '
city = 'Stuttgart '
country_code = 'DE '
phone_number = '+49 711-7992-00 '
web_address = 'http://www.windy.sap/rsc/ '
email_address = '[email protected]/rsc/ '
)
( agency_id = '070040'
name = 'Women only'
street = 'Kirchstr. 53 '
postal_code = '55124 '
city = 'Mainz '
country_code = 'DE '
phone_number = '+49 6131-543-00 '
web_address = 'http://www.women-only.sap '
email_address = '[email protected] '
)
( agency_id = '070041'
name = 'Maxitrip'
street = 'Flugfeld 17'
postal_code = '65128'
city = 'Wiesbaden'
country_code = 'DE'
phone_number = '+49 611-55 66 77'
web_address = 'http://www.maxitrip.sap'
email_address = '[email protected]'
)
( agency_id = '070042'
name = 'The Ultimate Answer'
street = 'Manchester Rd 20 '
postal_code = 'AB1 1SA '
city = 'Avon '
country_code = 'GB '
phone_number = '+44 934-66799 '
web_address = 'http://www.thulan.sap '
email_address = '[email protected] '
)
( agency_id = '070043'
name = 'Intertravel'
street = 'Michigan Ave '
postal_code = '60154 '
city = 'Chicago '
country_code = 'US '
phone_number = '+1 788 798-6555 '
web_address = 'http://www.intertravel.sap '
email_address = '[email protected] '
)
( agency_id = '070044'
name = 'Ultimate Goal'
street = '300 Peach tree street Sou'
postal_code = '01069 '
city = 'Atlanta '
country_code = 'US '
phone_number = '+1 874-654-6686'
web_address = 'http://www.ultimate-goal.sap '
email_address = '[email protected] '
)
( agency_id = '070045'
name = 'Submit and Return'
street = '20890 East Central Ave '
postal_code = '30987 '
city = 'Palo Alto '
country_code = 'US '
phone_number = '+1 652 645-5236 '
web_address = 'http://www.sar.sap '
email_address = '[email protected] '
)
( agency_id = '070046'
name = 'Hendrik''s'
street = '1200 Industrial Drive '
postal_code = '60153 '
city = 'Chicago '
country_code = 'US '
phone_number = '+1 08-924-9884 '
web_address = 'http://www.essen.sap/150596 '
email_address = '[email protected]/150596 '
)
( agency_id = '070047'
name = 'All British Air Planes'
street = '224 Tomato Lane '
postal_code = '08965 '
city = 'Vineland '
country_code = 'US '
phone_number = '+44 609-896-Moore '
web_address = 'http://www.abap.sap '
email_address = '[email protected] '
)
( agency_id = '070048'
name = 'Rocky Horror Tours'
street = '789 Santa Monica Blvd. '
postal_code = '08934 '
city = 'Santa Monica '
country_code = 'US '
phone_number = '+1 64351-6455-654 '
web_address = 'http://www.frank.furter.sap '
email_address = '[email protected] '
)
( agency_id = '070049'
name = 'Miles and More'
street = '777 Arlington Blvd. '
postal_code = '46515 '
city = 'Elkhart '
country_code = 'US '
phone_number = '+1 646 867-6888 '
web_address = 'http://www.mam.sap'
email_address = '[email protected]'
)
( agency_id = '070050'
name = 'Not Only By Bike'
street = 'Saalburgstr. 765 '
postal_code = '60385 '
city = 'Frankfurt '
country_code = 'DE '
phone_number = '+49 69 465789-0'
web_address = 'http://www.nobb.sap'
email_address = '[email protected]'
)
).
ENDMETHOD.
ENDCLASS.
CLASS lcl_airport_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: tt_airport TYPE STANDARD TABLE OF /dmo/airport14 WITH KEY airport_id.
CLASS-METHODS: get_data
RETURNING VALUE(rt_data) TYPE lcl_airport_data_generator=>tt_airport.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_airport_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF.
DELETE FROM /dmo/airport14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
DATA(lt_data) = get_data( ).
IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF.
INSERT /dmo/airport14 FROM TABLE @lt_data.
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD get_data.
rt_data = VALUE tt_airport(
" Europe
( airport_id = 'FRA' name = 'Frankfurt Airport' city = 'Frankfurt/Main' country = 'DE' )
( airport_id = 'HAM' name = 'Hamburg Airport' city = 'Hamburg' country = 'DE' )
( airport_id = 'MUC' name = 'Munich Airport' city = 'Munich' country = 'DE' )
( airport_id = 'SXF' name = 'Berlin Schönefeld Airport' city = 'Berlin' country = 'DE' )
( airport_id = 'THF' name = 'Berlin Tempelhof Airport' city = 'Berlin' country = 'DE' )
( airport_id = 'TXL' name = 'Berlin Tegel Airport' city = 'Berlin' country = 'DE' )
( airport_id = 'CDG' name = 'Charles de Gaulle Airport' city = 'Paris' country = 'FR' )
( airport_id = 'ORY' name = 'Orly Airport' city = 'Paris' country = 'FR' )
( airport_id = 'VIE' name = 'Vienna International Airport' city = 'Vienna' country = 'AT' )
( airport_id = 'ZRH' name = 'Zürich Airport' city = 'Zurich' country = 'CH' )
( airport_id = 'RTM' name = 'Rotterdam The Hague Airport' city = 'Rotterdam' country = 'NL' )
( airport_id = 'FCO' name = 'Leonardo da Vinci–Fiumicino Airport' city = 'Rome' country = 'IT' )
( airport_id = 'VCE' name = 'Venice Marco Polo Airport' city = 'Venice' country = 'IT' )
( airport_id = 'LCY' name = 'London City Airport' city = 'London' country = 'UK' )
( airport_id = 'LGW' name = 'Gatwick Airport' city = 'London' country = 'UK' )
( airport_id = 'LHR' name = 'Heathrow Airport' city = 'London' country = 'UK' )
( airport_id = 'MAD' name = 'Adolfo Suárez Madrid–Barajas Airport' city = 'Madrid' country = 'ES' )
( airport_id = 'VKO' name = 'Vnukovo International Airport' city = 'Moscow' country = 'RU' )
( airport_id = 'SVO' name = 'Sheremetyevo International Airport' city = 'Moscow' country = 'RU' )
" America
( airport_id = 'JFK' name = 'John F. Kennedy International Airport' city = 'New York City, New York' country = 'US' )
( airport_id = 'BNA' name = 'Nashville International Airport' city = 'Nashville, Tennessee' country = 'US' )
( airport_id = 'BOS' name = 'Logan International Airport' city = 'Boston, Massachusetts' country = 'US' )
( airport_id = 'ELP' name = 'El Paso International Airport' city = 'El Paso, Texas' country = 'US' )
( airport_id = 'DEN' name = 'Denver International Airport' city = 'Denver, Colorado' country = 'US' )
( airport_id = 'HOU' name = 'William P. Hobby Airport' city = 'Houston, Texas' country = 'US' )
( airport_id = 'LAS' name = 'McCarran International Airport' city = 'Las Vegas, Nevada' country = 'US' )
( airport_id = 'LAX' name = 'Los Angeles International Airport' city = 'Los Angeles, California' country = 'US' )
( airport_id = 'MCI' name = 'Kansas City International Airport' city = 'Kansas City, Missouri' country = 'US' )
( airport_id = 'MIA' name = 'Miami International Airport' city = 'Miami, Florida' country = 'US' )
( airport_id = 'SFO' name = 'San Francisco International Airport' city = 'San Francisco, California' country = 'US' )
( airport_id = 'EWR' name = 'Newark Liberty International Airport' city = 'Newark, New Jersey' country = 'US' )
( airport_id = 'YOW' name = 'Ottawa Macdonald–Cartier Int. Airport' city = 'Ottawa, Ontario' country = 'CA' )
( airport_id = 'ACA' name = 'General Juan N. Álvarez Int. Airport' city = 'Acapulco, Guerrero' country = 'MX' )
( airport_id = 'GIG' name = 'Rio de Janeiro–Galeão Int. Airport' city = 'Rio de Janeiro' country = 'BR' )
( airport_id = 'HAV' name = 'José Martí International Airport' city = 'Havana' country = 'CU' )
" Australia
( airport_id = 'ASP' name = 'Alice Springs Airport' city = 'Alice Springs, Northern Territory' country = 'AU' )
" Africa
( airport_id = 'ACE' name = 'Lanzarote Airport' city = 'Lanzarote, Canary Islands' country = 'ES' )
( airport_id = 'HRE' name = 'Harare International Airport' city = 'Harare' country = 'ZW' )
( airport_id = 'GCJ' name = 'Grand Central Airport' city = 'Johannesburg' country = 'SA' )
" Asia
( airport_id = 'NRT' name = 'Narita International Airport' city = 'Tokyo, Honshu' country = 'JP' )
( airport_id = 'ITM' name = 'Osaka International Airport' city = 'Osaka, Honshu' country = 'JP' )
( airport_id = 'KIX' name = 'Kansai International Airport' city = 'Osaka, Honshu' country = 'JP' )
( airport_id = 'HIJ' name = 'Hiroshima Airport' city = 'Hiroshima, Honshu' country = 'JP' )
( airport_id = 'SIN' name = 'Singapore Changi Airport' city = 'Singapore' country = 'SG' )
( airport_id = 'KUL' name = 'Kuala Lumpur International Airport' city = 'Kuala Lumpur' country = 'MY' )
( airport_id = 'HKG' name = 'Hong Kong International Airport' city = 'Hongkong' country = 'CN' )
( airport_id = 'BKK' name = 'Suvarnabhumi Airport' city = 'Bangkok' country = 'TH' )
).
ENDMETHOD.
ENDCLASS.
CLASS lcl_carrier_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: tt_carrier TYPE STANDARD TABLE OF /dmo/carrier14 WITH KEY carrier_id.
CLASS-METHODS: get_data
RETURNING
VALUE(rt_data) TYPE tt_carrier.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_carrier_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF.
DELETE FROM /dmo/carrier14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
DATA(lt_data) = get_data( ).
IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF.
INSERT /dmo/carrier14 FROM TABLE @lt_data.
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD get_data.
rt_data = VALUE tt_carrier(
( carrier_id = 'AA' name = 'American Airlines Inc.' currency_code = 'USD' )
( carrier_id = 'AC' name = 'Air Canada' currency_code = 'CAD' )
( carrier_id = 'AF' name = 'Air France' currency_code = 'EUR' )
( carrier_id = 'AZ' name = 'Alitalia Societa Aerea Italiana S.p.A.' currency_code = 'EUR' )
( carrier_id = 'BA' name = 'British Airways p.l.c.' currency_code = 'GBP' )
( carrier_id = 'FJ' name = 'Air Pacific Limited t/a Fiji Airway' currency_code = 'USD' )
( carrier_id = 'CO' name = 'Cobaltair Ltd. dba Cobalt' currency_code = 'USD' )
( carrier_id = 'DL' name = 'Delta Air Lines, Inc.' currency_code = 'USD' )
( carrier_id = 'LH' name = 'Deutsche Lufthansa AG' currency_code = 'EUR' )
( carrier_id = 'NG' name = 'AL-Naser Wings' currency_code = 'EUR' )
( carrier_id = 'JL' name = 'Japan Airlines Co., Ltd.' currency_code = 'JPY' )
( carrier_id = 'QF' name = 'Qantas Airways Ltd.' currency_code = 'AUD' )
( carrier_id = 'SA' name = 'South African Airways' currency_code = 'ZAR' )
( carrier_id = 'SQ' name = 'Singapore Airlines Limited' currency_code = 'SGD' )
( carrier_id = 'SR' name = 'Sundair GmbH' currency_code = 'CHF' )
( carrier_id = 'UA' name = 'United Airlines, Inc.' currency_code = 'USD' )
).
ENDMETHOD.
ENDCLASS.
CLASS lcl_connection_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: tt_connection TYPE STANDARD TABLE OF /dmo/connecti_14 WITH KEY carrier_id connection_id.
TYPES:
"! Structure for additional information for generation. <br/>
"! <em>weekday</em> '1' means Monday, '7' is Sunday
BEGIN OF ty_connection_additional_info.
INCLUDE TYPE /dmo/connecti_14.
TYPES: weekday TYPE i,
END OF ty_connection_additional_info.
TYPES: tt_connection_additional_info TYPE STANDARD TABLE OF ty_connection_additional_info WITH KEY connection_id.
CLASS-METHODS: get_data "provide data public
RETURNING VALUE(rt_data) TYPE tt_connection_additional_info.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_connection_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF.
DELETE FROM /dmo/connecti_14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
DATA(lt_data) = get_data( ).
DATA(lt_data_db) = CORRESPONDING tt_connection( lt_data ).
IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF.
INSERT /dmo/connecti_14 FROM TABLE @lt_data.
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD get_data.
rt_data = VALUE tt_connection_additional_info(
( carrier_id = 'SQ' connection_id = '0001' airport_from_id = 'SFO' airport_to_id = 'SIN' departure_time = '011500' arrival_time = '115000' distance = 13523 distance_unit = 'KM' weekday = 3 ) "1-7
( carrier_id = 'SQ' connection_id = '0002' airport_from_id = 'SIN' airport_to_id = 'SFO' departure_time = '063000' arrival_time = '091500' distance = 13523 distance_unit = 'KM' weekday = 4 ) "1-7
( carrier_id = 'SQ' connection_id = '0011' airport_from_id = 'NRT' airport_to_id = 'SIN' departure_time = '145500' arrival_time = '205000' distance = 5363 distance_unit = 'KM' weekday = 4 ) "1-7
( carrier_id = 'SQ' connection_id = '0012' airport_from_id = 'SIN' airport_to_id = 'NRT' departure_time = '095300' arrival_time = '175400' distance = 5363 distance_unit = 'KM' weekday = 6 ) "1-7
( carrier_id = 'UA' connection_id = '0058' airport_from_id = 'SFO' airport_to_id = 'FRA' departure_time = '134500' arrival_time = '095500' distance = 9608 distance_unit = 'KM' weekday = 1 ) "1-7
( carrier_id = 'UA' connection_id = '0059' airport_from_id = 'FRA' airport_to_id = 'SFO' departure_time = '135500' arrival_time = '163000' distance = 9608 distance_unit = 'KM' weekday = 2 ) "1-7
( carrier_id = 'UA' connection_id = '1537' airport_from_id = 'EWR' airport_to_id = 'MIA' departure_time = '215600' arrival_time = '004700' distance = 1752 distance_unit = 'KM' weekday = 5 ) "1-7
( carrier_id = 'AA' connection_id = '0322' airport_from_id = 'MIA' airport_to_id = 'EWR' departure_time = '201700' arrival_time = '231900' distance = 1752 distance_unit = 'KM' weekday = 7 ) "1-7
( carrier_id = 'AA' connection_id = '0017' airport_from_id = 'MIA' airport_to_id = 'HAV' departure_time = '071900' arrival_time = '080300' distance = 520 distance_unit = 'KM' weekday = 3 ) "1-7
( carrier_id = 'AA' connection_id = '2678' airport_from_id = 'HAV' airport_to_id = 'MIA' departure_time = '061500' arrival_time = '103000' distance = 520 distance_unit = 'KM' weekday = 6 ) "1-7
( carrier_id = 'AA' connection_id = '0015' airport_from_id = 'JFK' airport_to_id = 'SFO' departure_time = '071300' arrival_time = '100400' distance = 4156 distance_unit = 'KM' weekday = 5 ) "1-7
( carrier_id = 'AA' connection_id = '0018' airport_from_id = 'SFO' airport_to_id = 'JFK' departure_time = '064000' arrival_time = '150600' distance = 4156 distance_unit = 'KM' weekday = 4 ) "1-7
( carrier_id = 'LH' connection_id = '0400' airport_from_id = 'FRA' airport_to_id = 'JFK' departure_time = '101000' arrival_time = '113400' distance = 6162 distance_unit = 'KM' weekday = 6 ) "1-7
( carrier_id = 'LH' connection_id = '0401' airport_from_id = 'JFK' airport_to_id = 'FRA' departure_time = '183000' arrival_time = '074500' distance = 6162 distance_unit = 'KM' weekday = 5 ) "1-7
( carrier_id = 'LH' connection_id = '0402' airport_from_id = 'FRA' airport_to_id = 'EWR' departure_time = '133000' arrival_time = '153500' distance = 6217 distance_unit = 'KM' weekday = 1 ) "1-7
( carrier_id = 'LH' connection_id = '0403' airport_from_id = 'EWR' airport_to_id = 'FRA' departure_time = '180900' arrival_time = '073000' distance = 6217 distance_unit = 'KM' weekday = 1 ) "1-7
( carrier_id = 'JL' connection_id = '0407' airport_from_id = 'NRT' airport_to_id = 'FRA' departure_time = '132300' arrival_time = '155600' distance = 9379 distance_unit = 'KM' weekday = 5 ) "1-7
( carrier_id = 'JL' connection_id = '0408' airport_from_id = 'FRA' airport_to_id = 'NRT' departure_time = '202500' arrival_time = '154000' distance = 9379 distance_unit = 'KM' weekday = 6 ) "1-7
( carrier_id = 'AZ' connection_id = '0788' airport_from_id = 'VCE' airport_to_id = 'NRT' departure_time = '132500' arrival_time = '101300' distance = 9595 distance_unit = 'KM' weekday = 6 )
( carrier_id = 'AZ' connection_id = '0789' airport_from_id = 'NRT' airport_to_id = 'VCE' departure_time = '142600' arrival_time = '213100' distance = 9595 distance_unit = 'KM' weekday = 5 )
).
ENDMETHOD.
ENDCLASS.
CLASS lcl_flight_data_generator DEFINITION DEFERRED.
CLASS /dmo/cl_flight_data_generat_14 DEFINITION LOCAL FRIENDS lcl_flight_data_generator.
CLASS lcl_flight_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: tt_flights TYPE STANDARD TABLE OF /dmo/flight14
WITH KEY carrier_id connection_id flight_date
WITH NON-UNIQUE SORTED KEY key_sorted_seats COMPONENTS seats_occupied
WITH NON-UNIQUE SORTED KEY key_sorted_date COMPONENTS connection_id flight_date.
CLASS-METHODS: get_data
RETURNING VALUE(rt_data) TYPE tt_flights.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF ty_plane_type,
id TYPE /dmo/plane_type_id14,
seats_max TYPE /dmo/plane_seats_max14,
long_distance TYPE abap_bool,
index TYPE int1,
END OF ty_plane_type,
BEGIN OF ty_flight_info,
id TYPE /dmo/plane_type_id14,
long_distance TYPE abap_bool,
seats_max TYPE /dmo/plane_seats_max14,
seats_occupied TYPE /dmo/plane_seats_occupied14,
price TYPE /dmo/flight_price14,
END OF ty_flight_info,
BEGIN OF ty_connection_recurrency,
id TYPE /dmo/connection_id14,
recurrency TYPE STANDARD TABLE OF /dmo/flight_date14 WITH EMPTY KEY,
END OF ty_connection_recurrency.
TYPES: tt_plane_type TYPE STANDARD TABLE OF ty_plane_type WITH KEY id,
tt_connection_recurrency TYPE STANDARD TABLE OF ty_connection_recurrency WITH KEY id.
CONSTANTS: cv_random_offset TYPE i VALUE 25,
cv_random_percent TYPE i VALUE 70.
CLASS-DATA: gt_connections TYPE lcl_connection_data_generator=>tt_connection,
gt_carrier TYPE lcl_carrier_data_generator=>tt_carrier,
gt_plane_types TYPE tt_plane_type,
go_random_int_distance_long TYPE REF TO cl_abap_random_int,
go_random_int_distance_short TYPE REF TO cl_abap_random_int,
gv_plane_distance_long TYPE i,
gv_plane_distance_short TYPE i,
gt_connection_recurrency TYPE lcl_flight_data_generator=>tt_connection_recurrency,
gt_flights TYPE lcl_flight_data_generator=>tt_flights,
go_random_seats TYPE REF TO cl_abap_random_int.
CLASS-METHODS: build_dependent_content,
get_flight_info
IMPORTING
iv_connection_id TYPE /dmo/connection_id14
RETURNING
VALUE(rs_plane_info) TYPE ty_flight_info,
build_plane_types
RETURNING
VALUE(rt_data) TYPE lcl_flight_data_generator=>tt_plane_type,
build_connection_recurrency
RETURNING
VALUE(rt_data) TYPE lcl_flight_data_generator=>tt_connection_recurrency,
calc_next_monday
IMPORTING
iv_date TYPE d
RETURNING
VALUE(rv_date) TYPE d.
ENDCLASS.
CLASS lcl_flight_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF.
DELETE FROM /dmo/flight14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Dependent Content.' ). ENDIF.
build_dependent_content( ).
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
get_data( ).
IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF.
INSERT /dmo/flight14 FROM TABLE @gt_flights.
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD get_data.
DATA: lt_flights TYPE tt_flights,
ls_flight TYPE lcl_flight_data_generator=>ty_flight_info.
IF gt_flights IS NOT INITIAL.
rt_data = gt_flights.
EXIT.
ENDIF.
LOOP AT gt_connections INTO DATA(ls_connection).
LOOP AT gt_connection_recurrency[ id = ls_connection-connection_id ]-recurrency INTO DATA(lv_flight_date).
ls_flight = get_flight_info( ls_connection-connection_id ).
APPEND VALUE /dmo/flight14(
carrier_id = ls_connection-carrier_id
connection_id = ls_connection-connection_id
flight_date = lv_flight_date
price = ls_flight-price
currency_code = VALUE /dmo/flight14-currency_code(
gt_carrier[ carrier_id = ls_connection-carrier_id ]-currency_code
DEFAULT 'EUR' )
plane_type_id = ls_flight-id
seats_max = ls_flight-seats_max
seats_occupied = ls_flight-seats_occupied
) TO gt_flights.
ENDLOOP.
rt_data = gt_flights.
ENDLOOP.
ENDMETHOD.
METHOD build_dependent_content.
gt_connections = CORRESPONDING #( lcl_connection_data_generator=>get_data( ) ).
gt_carrier = lcl_carrier_data_generator=>get_data( ).
gt_plane_types = build_plane_types( ).
go_random_seats = cl_abap_random_int=>create(
min = cv_random_percent - cv_random_offset
max = cv_random_percent + cv_random_offset
).
gt_connection_recurrency = build_connection_recurrency( ).
ENDMETHOD.
METHOD get_flight_info.
DATA: lv_count TYPE i,
lo_random TYPE REF TO cl_abap_random_int.
DATA(lt_connections) = lcl_connection_data_generator=>get_data( ).
DATA(lv_is_long_distance) = COND abap_bool( WHEN lt_connections[ connection_id = iv_connection_id ]-distance > 3000
THEN abap_true
ELSE abap_false ).
IF lv_is_long_distance = abap_true.
IF gv_plane_distance_long IS INITIAL.
SELECT COUNT(*) FROM @gt_plane_types AS planes WHERE long_distance = @lv_is_long_distance INTO @gv_plane_distance_long.
ENDIF.
lv_count = gv_plane_distance_long.
IF go_random_int_distance_long IS NOT BOUND.
go_random_int_distance_long = cl_abap_random_int=>create( seed = 1337 min = 1 max = gv_plane_distance_long ).
ENDIF.
lo_random = go_random_int_distance_long.
ELSE.
IF gv_plane_distance_short IS INITIAL.
SELECT COUNT(*) FROM @gt_plane_types AS planes WHERE long_distance = @lv_is_long_distance INTO @gv_plane_distance_short.
ENDIF.
lv_count = gv_plane_distance_short.
IF go_random_int_distance_short IS NOT BOUND.
go_random_int_distance_short = cl_abap_random_int=>create( seed = 1337 min = 1 max = gv_plane_distance_short ).
ENDIF.
lo_random = go_random_int_distance_short.
ENDIF.
DATA(ls_plane_type) = gt_plane_types[
long_distance = lv_is_long_distance
index = lo_random->get_next( )
].
DATA(lv_seats_occupied_percent) = go_random_seats->get_next( ).
rs_plane_info = VALUE ty_flight_info(
id = ls_plane_type-id
long_distance = ls_plane_type-long_distance
seats_max = ls_plane_type-seats_max
seats_occupied = ls_plane_type-seats_max * lv_seats_occupied_percent DIV 100
price = /dmo/cl_flight_data_generat_14=>calculate_flight_price(
iv_seats_occupied_percent = lv_seats_occupied_percent
iv_flight_distance = lt_connections[ connection_id = iv_connection_id ]-distance
)
).
ENDMETHOD.
METHOD build_plane_types.
rt_data = VALUE tt_plane_type(
( id = 'A320-200' seats_max = 130 long_distance = ' ' index = 1 )
( id = 'A321-200' seats_max = 150 long_distance = ' ' index = 2 )
( id = '737-800' seats_max = 140 long_distance = ' ' index = 3 )
( id = 'A319-100' seats_max = 120 long_distance = ' ' index = 4 )
( id = '747-400' seats_max = 385 long_distance = 'X' index = 1 )
( id = '767-200' seats_max = 260 long_distance = 'X' index = 2 )
( id = 'A340-600' seats_max = 330 long_distance = 'X' index = 3 )
( id = 'A380-800' seats_max = 475 long_distance = 'X' index = 4 )
).
ENDMETHOD.
METHOD build_connection_recurrency.
CONSTANTS:
cv_days_between_test TYPE i VALUE 300,
cv_days_between_8weeks TYPE i VALUE 56,
cv_days_between_4weeks TYPE i VALUE 28,
cv_days_between_2weeks TYPE i VALUE 14,
cv_days_between_1weeks TYPE i VALUE 7.
DATA:
flight_date_max TYPE d,
flight_date_min TYPE d.
DATA(lv_days_between) = cv_days_between_test.
GET TIME STAMP FIELD DATA(current_timestamp).
DATA(tmp) = CONV string( current_timestamp ).
DATA lv_datum TYPE d.
lv_datum = tmp(8).
" flight_date_max is a Monday 8 months in the future
flight_date_max = calc_next_monday( CONV /dmo/flight_date14( lv_datum + 217 ) ).
" flight_date_min is a Monday 5 months in the past
flight_date_min = calc_next_monday( CONV /dmo/flight_date14( lv_datum - 148 ) ).
LOOP AT lcl_connection_data_generator=>get_data( ) INTO DATA(ls_connection).
APPEND VALUE ty_connection_recurrency(
id = ls_connection-connection_id
recurrency = VALUE ty_connection_recurrency-recurrency(
FOR flightdate = flight_date_max + ls_connection-weekday - 1
THEN flightdate - lv_days_between
UNTIL flightdate < flight_date_min + ls_connection-weekday - 1
( CONV /dmo/flight_date14( flightdate ) )
)
) TO rt_data.
ENDLOOP.
ENDMETHOD.
METHOD calc_next_monday.
* 01.01.1900 was a Saturday.
DATA(lv_weekday) = iv_date MOD 7.
* Therefore 0 is a Saturday, 1 for Sunday, etc.. and will be mapped to 1 for Monday, 2 for Tuesday, etc..
IF lv_weekday > 1.
lv_weekday = lv_weekday - 1.
ELSE.
lv_weekday = lv_weekday + 6.
ENDIF.
rv_date = iv_date - lv_weekday + 8.
ENDMETHOD.
ENDCLASS.
CLASS lcl_customer_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: BEGIN OF ty_last_name,
last_name TYPE /dmo/last_name14,
END OF ty_last_name.
TYPES: tt_customer TYPE STANDARD TABLE OF /dmo/customer14 WITH KEY customer_id,
tt_last_name TYPE STANDARD TABLE OF ty_last_name WITH KEY last_name.
CLASS-METHODS: get_data
RETURNING VALUE(rt_data) TYPE tt_customer,
build_last_names
RETURNING
VALUE(rt_data) TYPE tt_last_name.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
" Names
BEGIN OF ty_first_name,
first_name TYPE /dmo/first_name14,
gender TYPE c LENGTH 1,
END OF ty_first_name,
BEGIN OF ty_name,
first_name TYPE /dmo/first_name14,
last_name TYPE /dmo/last_name14,
title TYPE /dmo/title14,
END OF ty_name,
" Addresses
BEGIN OF ty_city,
country TYPE land1,
postal_code TYPE /dmo/postal_code14,
city TYPE /dmo/city14,
END OF ty_city,
tt_street_per_country TYPE STANDARD TABLE OF /dmo/street14 WITH EMPTY KEY,
BEGIN OF ty_street,
country TYPE land1,
streets TYPE tt_street_per_country,
END OF ty_street,
BEGIN OF ty_address,
country TYPE land1,
postal_code TYPE /dmo/postal_code14,
city TYPE /dmo/city14,
street TYPE /dmo/street14,
phone_number TYPE /dmo/phone_number14,
email_address TYPE /dmo/email_address14,
END OF ty_address.
TYPES:
" Names
tt_first_name TYPE STANDARD TABLE OF ty_first_name WITH KEY first_name,
tt_name TYPE STANDARD TABLE OF ty_name WITH KEY first_name last_name,
" Addresses
tt_city TYPE STANDARD TABLE OF ty_city WITH KEY country city,
tt_street TYPE STANDARD TABLE OF ty_street WITH KEY country,
tt_address TYPE STANDARD TABLE OF ty_address WITH KEY country city street.
CONSTANTS cv_email_host TYPE string VALUE `flight.example` ##NO_TEXT.
CONSTANTS cv_phone_number_seperator TYPE string VALUE `-` ##NO_TEXT.
CONSTANTS cv_phone_number_min TYPE int8 VALUE 1234567890.
CONSTANTS cv_phone_number_max TYPE int8 VALUE 9999999999.
CLASS-DATA gt_data TYPE lcl_customer_data_generator=>tt_customer.
CLASS-METHODS:
" Names
generate_names
RETURNING
VALUE(rt_data) TYPE tt_name,
build_first_names
RETURNING
VALUE(rt_data) TYPE tt_first_name,
" Adresses
generate_addresses
RETURNING
VALUE(rt_data) TYPE tt_address,
build_city
RETURNING
VALUE(rt_data) TYPE tt_city,
build_street
RETURNING
VALUE(rt_data) TYPE tt_street.
ENDCLASS.
CLASS lcl_customer_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF.
DELETE FROM /dmo/customer14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
DATA(lt_data) = get_data( ).
IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF.
INSERT /dmo/customer14 FROM TABLE @lt_data.
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD build_first_names.
rt_data = VALUE tt_first_name(
( first_name = 'Simon' gender = 'M')
( first_name = 'Harish' gender = 'M')
( first_name = 'Volker' gender = 'M')
( first_name = 'Jasmin' gender = 'F')
( first_name = 'Felix' gender = 'M')
( first_name = 'Kristina' gender = 'F')
( first_name = 'Thilo' gender = 'M')
( first_name = 'Andrej' gender = 'M')
( first_name = 'Anna' gender = 'F')
( first_name = 'Johannes' gender = 'M')
( first_name = 'Johann' gender = 'M')
( first_name = 'Christoph' gender = 'M')
( first_name = 'Andreas' gender = 'M')
( first_name = 'Stephen' gender = 'M')
( first_name = 'Mathilde' gender = 'F')
( first_name = 'August' gender = 'M')
( first_name = 'Illya' gender = 'M')
( first_name = 'Georg' gender = 'M')
( first_name = 'Gisela' gender = 'F')
( first_name = 'Christa' gender = 'F')
( first_name = 'Holm' gender = 'M')
( first_name = 'Irmtraut' gender = 'F')
( first_name = 'Ludwig' gender = 'M')
( first_name = 'Laura' gender = 'F')
( first_name = 'Kurt' gender = 'M')
( first_name = 'Guenther' gender = 'M')
( first_name = 'Horst' gender = 'M')
( first_name = 'Matthias' gender = 'M')
( first_name = 'Amelie' gender = 'F')
( first_name = 'Walter' gender = 'M')
( first_name = 'Sophie' gender = 'F')
( first_name = 'Claire' gender = 'F')
( first_name = 'Chantal' gender = 'F')
( first_name = 'Jean' gender = 'M')
( first_name = 'Cindy' gender = 'F')
( first_name = 'Pierre' gender = 'M')
( first_name = 'Irene' gender = 'F')
( first_name = 'Adam' gender = 'M')
( first_name = 'Fabio' gender = 'M')
( first_name = 'Lothar' gender = 'M')
( first_name = 'Annemarie' gender = 'F')
( first_name = 'Ida' gender = 'F')
( first_name = 'Roland' gender = 'M')
( first_name = 'Achim' gender = 'M')
( first_name = 'Allen' gender = 'M')
( first_name = 'Lee' gender = 'M')
( first_name = 'Guillermo' gender = 'M')
( first_name = 'Florian' gender = 'M')
( first_name = 'Ulla' gender = 'F')
( first_name = 'Juan' gender = 'M')
( first_name = 'Marta' gender = 'F')
( first_name = 'Salvador' gender = 'M')
( first_name = 'Christine' gender = 'F')
( first_name = 'Dominik' gender = 'M')
( first_name = 'Astrid' gender = 'F')
( first_name = 'Ruth' gender = 'F')
( first_name = 'Theresia' gender = 'F')
( first_name = 'Thomas' gender = 'M')
( first_name = 'Friedrich' gender = 'M')
( first_name = 'Anneliese' gender = 'F')
( first_name = 'Peter' gender = 'M')
( first_name = 'Anne-Marie' gender = 'F')
( first_name = 'James' gender = 'M')
( first_name = 'Jean-Luc' gender = 'M')
( first_name = 'Benjamin' gender = 'M')
( first_name = 'Hendrik' gender = 'M')
( first_name = 'Uli' gender = 'F')
( first_name = 'Siegfried' gender = 'M')
( first_name = 'Max' gender = 'M')
).
ENDMETHOD.
METHOD build_last_names.
rt_data = VALUE tt_last_name(
( last_name = 'Buchholm')
( last_name = 'Vrsic')
( last_name = 'Jeremias')
( last_name = 'Gutenberg')
( last_name = 'Fischmann')
( last_name = 'Columbo')
( last_name = 'Neubasler')
( last_name = 'Martin')
( last_name = 'Detemple')
( last_name = 'Barth')
( last_name = 'Benz')
( last_name = 'Hansmann')
( last_name = 'Koslowski')
( last_name = 'Wohl')
( last_name = 'Koller')
( last_name = 'Hoffen')
( last_name = 'Dumbach')
( last_name = 'Goelke')
( last_name = 'Waldmann')
( last_name = 'Mechler')
( last_name = 'Buehler')
( last_name = 'Heller')
( last_name = 'Simonen')
( last_name = 'Henry')
( last_name = 'Marshall')
( last_name = 'Legrand')
( last_name = 'Jacqmain')
( last_name = 'D´Oultrement')
( last_name = 'Hunter')
( last_name = 'Delon')
( last_name = 'Kreiss')
( last_name = 'Trensch')
( last_name = 'Cesari')
( last_name = 'Matthaeus')
( last_name = 'Babilon')
( last_name = 'Zimmermann')
( last_name = 'Kramer')
( last_name = 'Illner')
( last_name = 'Pratt')
( last_name = 'Gahl')
( last_name = 'Benjamin')
( last_name = 'Miguel')
( last_name = 'Weiss')
( last_name = 'Sessler')
( last_name = 'Montero')
( last_name = 'Domenech')
( last_name = 'Moyano')
( last_name = 'Sommer')
( last_name = 'Schneider')
( last_name = 'Eichbaum')
( last_name = 'Gueldenpfennig')
( last_name = 'Sudhoff')
( last_name = 'Lautenbach')
( last_name = 'Ryan')
( last_name = 'Prinz')
( last_name = 'Deichgraeber')
( last_name = 'Pan')
( last_name = 'Lindwurm')
( last_name = 'Kirk')
( last_name = 'Picard')
( last_name = 'Sisko')
( last_name = 'Madeira')
( last_name = 'Meier')
( last_name = 'Rahn')
( last_name = 'Leisert')
( last_name = 'Müller')
( last_name = 'Mustermann')
( last_name = 'Becker')
( last_name = 'Fischer')
).
ENDMETHOD.
METHOD get_data.
IF gt_data IS NOT INITIAL.
rt_data = gt_data.
EXIT.
ENDIF.
DATA(lt_names) = generate_names( ).
DATA(lt_addresses) = generate_addresses( ).
DATA(lo_random_phone_number) = cl_abap_random_int8=>create( min = cv_phone_number_min
max = cv_phone_number_max ).
DATA(lo_random_city) = cl_abap_random_int=>create( min = 1 max = lines( lt_addresses ) ).
DATA(lo_random_street_number) = cl_abap_random_int=>create( min = 1 max = 100 ).
gt_data = VALUE tt_customer(
FOR i = 1 THEN i + 1 WHILE i <= lines( lt_names ) LET j = lo_random_city->get_next( ) IN
(
customer_id = i
first_name = lt_names[ i ]-first_name
last_name = lt_names[ i ]-last_name
title = lt_names[ i ]-title
street = lt_addresses[ j ]-street && ` ` && lo_random_street_number->get_next( )
postal_code = lt_addresses[ j ]-postal_code
city = lt_addresses[ j ]-city
country_code = lt_addresses[ j ]-country
phone_number = '+' && COND string(
WHEN lt_addresses[ j ]-country = 'AT' THEN '43'
WHEN lt_addresses[ j ]-country = 'BE' THEN '32'
WHEN lt_addresses[ j ]-country = 'CH' THEN '41'
WHEN lt_addresses[ j ]-country = 'DE' THEN '49'
WHEN lt_addresses[ j ]-country = 'ES' THEN '34'
WHEN lt_addresses[ j ]-country = 'FR' THEN '33'
WHEN lt_addresses[ j ]-country = 'IT' THEN '39'
WHEN lt_addresses[ j ]-country = 'SI' THEN '386'
WHEN lt_addresses[ j ]-country = 'US' THEN '1'
ELSE '89'
)
&& cv_phone_number_seperator
&& |{ replace( val = lo_random_phone_number->get_next( ) off = 3 len = 1 with = cv_phone_number_seperator ) }|
email_address = to_lower( lt_names[ i ]-first_name && `.` && lt_names[ i ]-last_name && `@` && cv_email_host && `.` && lt_addresses[ j ]-country )
)
).
rt_data = gt_data.
ENDMETHOD.
METHOD generate_names.
DATA: lo_random_counter TYPE REF TO cl_abap_random_int,
lo_random_first_name TYPE REF TO cl_abap_random_int,
lo_random_title TYPE REF TO cl_abap_random_int,
ls_first_name TYPE lcl_customer_data_generator=>ty_first_name.
DATA(lt_first_names) = build_first_names( ).
lo_random_counter = cl_abap_random_int=>create( min = 5 max = 15 ).
lo_random_first_name = cl_abap_random_int=>create( min = 1 max = lines( lt_first_names ) ).
LOOP AT build_last_names( ) INTO DATA(ls_last_name).
DO lo_random_counter->get_next( ) TIMES.
ls_first_name = lt_first_names[ lo_random_first_name->get_next( ) ].
APPEND VALUE ty_name(
first_name = ls_first_name-first_name
last_name = ls_last_name-last_name
title = COND /dmo/title14( WHEN ls_first_name-gender = 'M' THEN 'Mr.'
WHEN ls_first_name-gender = 'F' THEN 'Mrs.'
ELSE 'Martian' )
) TO rt_data.
ENDDO.
ENDLOOP.
ENDMETHOD.
METHOD build_city.
rt_data = VALUE tt_city(
( country = 'DE' postal_code = '23496' city = 'Dielheim')
( country = 'SI' postal_code = '1000' city = 'Ljubljana')
( country = 'DE' postal_code = '86343' city = 'Koenigsbrunn')
( country = 'DE' postal_code = '55128' city = 'Mainz')
( country = 'DE' postal_code = '11111' city = 'Berlin')
( country = 'US' postal_code = '17844' city = 'Washington')
( country = 'AT' postal_code = '4020' city = 'Linz')
( country = 'DE' postal_code = '68723' city = 'Schwetzingen')
( country = 'DE' postal_code = '68789' city = 'St. Leon-Rot')
( country = 'DE' postal_code = '66464' city = 'Homburg')
( country = 'DE' postal_code = '69231' city = 'Rauenberg')
( country = 'DE' postal_code = '69190' city = 'Walldorf')
( country = 'DE' postal_code = '58332' city = 'Schwelm')
( country = 'DE' postal_code = '64342' city = 'Seeheim-Jugenheim')
( country = 'DE' postal_code = '69121' city = 'Heidelberg')
( country = 'DE' postal_code = '63150' city = 'Heusenstamm')
( country = 'DE' postal_code = '64283' city = 'Darmstadt')
( country = 'DE' postal_code = '69207' city = 'Kurt')
( country = 'DE' postal_code = '79104' city = 'Freiburg')
( country = 'DE' postal_code = '79312' city = 'Emmendingen')
( country = 'DE' postal_code = '68753' city = 'Amelie')
( country = 'DE' postal_code = '68163' city = 'Mannheim')
( country = 'DE' postal_code = '67105' city = 'Schifferstadt')
( country = 'DE' postal_code = '68163' city = 'Mannheim-Lindenhof')
( country = 'FR' postal_code = '78140' city = 'Vélizy')
( country = 'CH' postal_code = '1211' city = 'Genève')
( country = 'BE' postal_code = 'B - 1030' city = 'Bruxelles')
( country = 'US' postal_code = '76018' city = 'Arlington')
( country = 'FR' postal_code = '06130' city = 'Grasse')
( country = 'DE' postal_code = '27299' city = 'Langwedel')
( country = 'DE' postal_code = '69483' city = 'Wald-Michelbach')
( country = 'IT' postal_code = '00195' city = 'Roma')
( country = 'DE' postal_code = '81375' city = 'Muenchen')
( country = 'DE' postal_code = '67663' city = 'Kaiserslautern')
( country = 'DE' postal_code = '66386' city = 'St. Ingbert')
( country = 'DE' postal_code = '79761' city = 'Waldshut')
( country = 'DE' postal_code = '76137' city = 'Karlsruhe')
( country = 'US' postal_code = '07666' city = 'Teaneck')
( country = 'US' postal_code = '17758' city = 'N. Massapequa')
( country = 'US' postal_code = '09765' city = 'Boulder')
( country = 'ES' postal_code = '28020' city = 'Madrid')
( country = 'DE' postal_code = '69180' city = 'Wiesloch')
( country = 'ES' postal_code = '08014' city = 'Barcelona')
( country = 'ES' postal_code = '41006' city = 'Sevilla')
( country = 'DE' postal_code = '75305' city = 'Neuenburg')
( country = 'DE' postal_code = '41466' city = 'Neuss')
( country = 'DE' postal_code = '71116' city = 'Gaertringen')
( country = 'US' postal_code = '60657' city = 'Chicago')
( country = 'DE' postal_code = '63263' city = 'Neu-Isenburg')
( country = 'DE' postal_code = '23056' city = 'Buxtehude')
( country = 'DE' postal_code = '16233' city = 'Potsdam')
( country = 'DE' postal_code = '90419' city = 'Nuernberg')
( country = 'US' postal_code = '22334' city = 'San Francisco')
( country = 'FR' postal_code = '75839' city = 'Paris')
( country = 'US' postal_code = '63728' city = 'New Orleans')
( country = 'DE' postal_code = '75757' city = 'Elsenz')
( country = 'DE' postal_code = '70111' city = 'Reutlingen')
( country = 'DE' postal_code = '15344' city = 'Strausberg')
).
ENDMETHOD.
METHOD generate_addresses.
TYPES: BEGIN OF ty_random_street,
country TYPE land1,
random TYPE REF TO cl_abap_random_int,
END OF ty_random_street,
tt_random_street TYPE STANDARD TABLE OF ty_random_street WITH KEY country.
DATA: lo_random_counter TYPE REF TO cl_abap_random_int,
lo_random_city TYPE REF TO cl_abap_random_int,
lt_random_street TYPE tt_random_street,
lo_phone_number TYPE REF TO cl_abap_random_int.
DATA(lt_street) = build_street( ).
lo_random_counter = cl_abap_random_int=>create( min = 5 max = 15 ).
lo_phone_number = cl_abap_random_int=>create( min = 1 max = 100 ).
LOOP AT lt_street INTO DATA(ls_street).
APPEND VALUE ty_random_street(
country = ls_street-country
random = cl_abap_random_int=>create( min = 1 max = lines( ls_street-streets ) )
) TO lt_random_street.
ENDLOOP.
LOOP AT build_city( ) INTO DATA(ls_city).
DO lo_random_counter->get_next( ) TIMES.
APPEND VALUE ty_address(
country = ls_city-country
postal_code = ls_city-postal_code
city = ls_city-city
street = |{ lt_street[
country = ls_city-country
]-streets[
lt_random_street[ country = ls_city-country ]-random->get_next( )
] }|
) TO rt_data.
ENDDO.
ENDLOOP.
ENDMETHOD.
METHOD build_street.
rt_data = VALUE tt_street(
( country = 'AT' streets = VALUE tt_street_per_country( ( 'Hasnerstrasse' ) ) )
( country = 'BE' streets = VALUE tt_street_per_country( ( 'rue Voltaire' ) ) )
( country = 'CH' streets = VALUE tt_street_per_country( ( 'rue de Moillebeau' ) ) )
( country = 'DE' streets = VALUE tt_street_per_country( ( 'Akazienweg' )
( 'Albert-Schweitzer-Str.' )
( 'Alte Reichsstr.' )
( 'Am Deich' )
( 'Arionweg' )
( 'Arndtstrasse' )
( 'Auf dem Huegel' )
( 'Ausfallstr.' )
( 'Ausserhalb' )
( 'Carl-Metz Strasse' )
( 'Caspar-David-Friedrich-Str.' )
( 'Dudweilerstr.' )
( 'Elzstrasse' )
( 'Emil-Heckel-Str.' )
( 'Erlengrund' )
( 'Franz-Marc-Str.' )
( 'Friedensallee' )
( 'Froschstr.' )
( 'Gartenstr.' )
( 'Gemeindestr.' )
( 'Goeckinghofstr.' )
( 'Gruenlingweg' )
( 'Hauptstr.' )
( 'Heidelberger Str.' )
( 'Im Warmet' )
( 'Jacobistrasse' )
( 'Karl-Marx-Allee' )
( 'Karl-Schwaner-Str.' )
( 'Leichhof' )
( 'Lerchenstr.' )
( 'Marktplatz' )
( 'Max-Planck-Str.' )
( 'Meerfeldstr.' )
( 'Melissenstr.' )
( 'Muehltalstr.' )
( 'Mutterstadter Str.' )
( 'N7,' )
( 'Rankestr.' )
( 'Raupelsweg' )
( 'Schillerstr.' )
( 'Stauboernchenstrasse' )
( 'Stiftsbogen' )
( 'Waldmann' )
( 'Wilhelminentr.' )
( 'Zwischergasse' ) ) )
( country = 'ES' streets = VALUE tt_street_per_country( ( 'Camelias' )
( 'Fuenlabrada' )
( 'Piedad' )
( 'Pza. Pablo Ruiz Picasso' ) ) )
( country = 'FR' streets = VALUE tt_street_per_country( ( 'Rue Balzac' )
( 'route de Pégomas' )
( 'rue Nieuport' ) ) )
( country = 'IT' streets = VALUE tt_street_per_country( ( 'Via Giulio Cesare' ) ) )
( country = 'SI' streets = VALUE tt_street_per_country( ( 'Poklukarjeva' ) ) )
( country = 'US' streets = VALUE tt_street_per_country( ( '17th St.' )
( 'Federal Avenue' )
( 'Golden Gate Drive' )
( 'Lake Shore Drive' )
( 'Oak Street' )
( 'Sagamore St.' )
( 'Voodoo Avenue' )
( 'Windstone Drive' ) ) )
).
ENDMETHOD.
ENDCLASS.
CLASS lcl_supplement_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: tt_supplement TYPE STANDARD TABLE OF /dmo/suppleme_14 WITH KEY supplement_id,
tt_supplement_text TYPE STANDARD TABLE OF /dmo/suppl_te_14 WITH KEY supplement_id.
" Merged types
TYPES BEGIN OF ty_supplement_complete.
INCLUDE TYPE /dmo/suppleme_14.
TYPES language_code TYPE spras.
TYPES description TYPE /dmo/description14.
TYPES END OF ty_supplement_complete.
TYPES tt_supplement_complete TYPE STANDARD TABLE OF ty_supplement_complete WITH KEY supplement_id.
CLASS-METHODS: get_data
RETURNING VALUE(rt_data) TYPE tt_supplement_complete.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_supplement_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
IF out IS BOUND. out->write( '--> Delete Content.' ). ENDIF.
DELETE FROM /dmo/suppleme_14. "#EC CI_NOWHERE
DELETE FROM /dmo/suppl_te_14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
DATA(lt_data) = get_data( ).
IF out IS BOUND. out->write( '--> Insert Content.' ). ENDIF.
INSERT /dmo/suppleme_14 FROM TABLE @( CORRESPONDING tt_supplement( lt_data ) ).
INSERT /dmo/suppl_te_14 FROM TABLE @( CORRESPONDING tt_supplement_text( lt_data ) ).
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD get_data.
" BV = beverage
" ML = meal
" LU = luggage
" EX = extra
rt_data = VALUE tt_supplement_complete(
( supplement_id = 'BV-0001' price = '2.30' currency_code = 'EUR' language_code = 'E' description = 'Hot Chocolate' )
( supplement_id = 'BV-0002' price = '7.50' currency_code = 'EUR' language_code = 'E' description = 'Alcohol free Champagne' )
( supplement_id = 'BV-0003' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Cola' )
( supplement_id = 'BV-0004' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Orange Limonade' )
( supplement_id = 'BV-0005' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Apple Juice' )
( supplement_id = 'BV-0006' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Pear Juice' )
( supplement_id = 'BV-0007' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Mango Juice' )
( supplement_id = 'BV-0008' price = '3.50' currency_code = 'EUR' language_code = 'E' description = 'Lemon Limonade' )
( supplement_id = 'BV-0009' price = '4.50' currency_code = 'EUR' language_code = 'E' description = 'Tomato Juice' )
( supplement_id = 'ML-0001' price = '3.00' currency_code = 'EUR' language_code = 'E' description = 'Black Forest Cake' )
( supplement_id = 'ML-0002' price = '2.00' currency_code = 'EUR' language_code = 'E' description = 'Chocolate Cake' )
( supplement_id = 'ML-0003' price = '1.50' currency_code = 'EUR' language_code = 'E' description = 'Apple Pie' )
( supplement_id = 'ML-0004' price = '1.50' currency_code = 'EUR' language_code = 'E' description = 'Pear Pie' )
( supplement_id = 'ML-0005' price = '8.00' currency_code = 'EUR' language_code = 'E' description = 'Nice Salad')
( supplement_id = 'ML-0006' price = '9.00' currency_code = 'EUR' language_code = 'E' description = 'Paris Salad')
( supplement_id = 'ML-0007' price = '12.00' currency_code = 'EUR' language_code = 'E' description = 'Hamburg Salad with Eggs' )
( supplement_id = 'ML-0008' price = '25.00' currency_code = 'EUR' language_code = 'E' description = 'Quail with French Salad and Black Forest Cake')
( supplement_id = 'ML-0009' price = '13.00' currency_code = 'EUR' language_code = 'E' description = 'Duck on Lettuce' )
( supplement_id = 'ML-0010' price = '5.00' currency_code = 'EUR' language_code = 'E' description = 'Carpaccio')
( supplement_id = 'ML-0011' price = '7.00' currency_code = 'EUR' language_code = 'E' description = 'Seasonal Salad')
( supplement_id = 'ML-0012' price = '16.00' currency_code = 'EUR' language_code = 'E' description = 'Hamburg Salad with Fresh Shrimps')
( supplement_id = 'ML-0013' price = '17.00' currency_code = 'EUR' language_code = 'E' description = 'Quail')
( supplement_id = 'ML-0014' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Wiener Schnitzel')
( supplement_id = 'ML-0015' price = '13.00' currency_code = 'EUR' language_code = 'E' description = 'Pork Schnitzel')
( supplement_id = 'ML-0016' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Schnitzel with Pepper Sauce')
( supplement_id = 'ML-0017' price = '11.00' currency_code = 'EUR' language_code = 'E' description = 'Chicken and French Fries')
( supplement_id = 'ML-0018' price = '12.00' currency_code = 'EUR' language_code = 'E' description = 'Turkey Steak')
( supplement_id = 'ML-0019' price = '15.00' currency_code = 'EUR' language_code = 'E' description = 'Bavarian Duck')
( supplement_id = 'ML-0020' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Knuckle of Pork')
( supplement_id = 'ML-0021' price = '22.00' currency_code = 'EUR' language_code = 'E' description = 'Fillet of Beef')
( supplement_id = 'ML-0022' price = '21.00' currency_code = 'EUR' language_code = 'E' description = 'Trout Au Bleu')
( supplement_id = 'ML-0023' price = '20.00' currency_code = 'EUR' language_code = 'E' description = 'Trout Meuniere')
( supplement_id = 'ML-0024' price = '17.00' currency_code = 'EUR' language_code = 'E' description = 'Monkfish')
( supplement_id = 'ML-0025' price = '12.00' currency_code = 'EUR' language_code = 'E' description = 'Sole')
( supplement_id = 'ML-0026' price = '6.00' currency_code = 'EUR' language_code = 'E' description = 'Mini Fried Sole')
( supplement_id = 'ML-0027' price = '14.00' currency_code = 'EUR' language_code = 'E' description = 'Salmon in a Bearnaise Sauce')
( supplement_id = 'ML-0028' price = '15.00' currency_code = 'EUR' language_code = 'E' description = 'Salmon Lasagne')
( supplement_id = 'ML-0029' price = '3.00' currency_code = 'EUR' language_code = 'E' description = 'Chocolate Ice Cream')
( supplement_id = 'ML-0030' price = '2.50' currency_code = 'EUR' language_code = 'E' description = 'Vanilla Ice Cream')
( supplement_id = 'ML-0031' price = '4.50' currency_code = 'EUR' language_code = 'E' description = 'Vanilla Ice Cream with Hot Cherries')
( supplement_id = 'ML-0032' price = '4.50' currency_code = 'EUR' language_code = 'E' description = 'Vanilla Ice Cream with Hot Raspberries')
( supplement_id = 'ML-0033' price = '4.00' currency_code = 'EUR' language_code = 'E' description = 'Apple Strudel')
( supplement_id = 'ML-0034' price = '4.00' currency_code = 'EUR' language_code = 'E' description = 'Raspberry Sorbet')
( supplement_id = 'ML-0035' price = '4.00' currency_code = 'EUR' language_code = 'E' description = 'Strawberry Sorbet')
( supplement_id = 'LU-0001' price = '40.00' currency_code = 'EUR' language_code = 'E' description = 'Extra baggage 5 kgs')
( supplement_id = 'LU-0002' price = '15.00' currency_code = 'EUR' language_code = 'E' description = 'Luggage transfer from airport to hotel')
( supplement_id = 'LU-0003' price = '75.00' currency_code = 'EUR' language_code = 'E' description = 'Luggage pickup from home and return ' )
( supplement_id = 'LU-0004' price = '80.00' currency_code = 'EUR' language_code = 'E' description = 'Bulky goods like sports equipment' )
) .
ENDMETHOD.
ENDCLASS.
CLASS lcl_travel_data_generator DEFINITION DEFERRED.
CLASS /dmo/cl_flight_data_generat_14 DEFINITION LOCAL FRIENDS lcl_travel_data_generator.
CLASS lcl_travel_data_generator DEFINITION CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES: lif_data_generator.
TYPES: tt_travel TYPE STANDARD TABLE OF /dmo/travel14 WITH KEY travel_id,
tt_bookings TYPE STANDARD TABLE OF /dmo/booking14 WITH KEY travel_id booking_id,
tt_booking_supplements TYPE STANDARD TABLE OF /dmo/book_sup_14 WITH KEY travel_id booking_id booking_supplement_id.
" Build nested tables
TYPES BEGIN OF ty_booking_complete.
INCLUDE TYPE /dmo/booking14.
TYPES booking_supplements TYPE tt_booking_supplements.
TYPES END OF ty_booking_complete.
TYPES tt_booking_complete TYPE STANDARD TABLE OF ty_booking_complete WITH KEY travel_id booking_id.
TYPES BEGIN OF ty_travel_complete.
INCLUDE TYPE /dmo/travel14.
TYPES bookings TYPE tt_booking_complete.
TYPES END OF ty_travel_complete.
"! <em>Travel</em> structure <br/>
"! <em>Bookings</em> table <br/>
"! --> <em>Booking</em> structure <br/>
"! --> <em>Booking Supplement</em> table <br/>
"! -----> <em>Booking Supplement</em> structure
TYPES tt_travel_complete TYPE STANDARD TABLE OF ty_travel_complete WITH KEY travel_id.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF ty_countryname,
country TYPE i_countrytext-country,
countryname TYPE i_countrytext-countryname,
END OF ty_countryname.
CONSTANTS: cv_travel_group_amount_max TYPE i VALUE 3,
cv_trip_length_center TYPE i VALUE 3,
cv_trip_length_offset TYPE i VALUE 2,
cv_booking_date_min TYPE i VALUE 0,
cv_booking_date_max TYPE i VALUE 20,
cv_travel_create_dat_befor_min TYPE i VALUE 0,
cv_travel_create_dat_befor_max TYPE i VALUE 40,
cv_travel_change_date_min TYPE i VALUE 0,
cv_travel_change_date_max TYPE i VALUE 10,
cv_booking_supplement_amount TYPE i VALUE 5,
cv_booking_days_before TYPE i VALUE 15.
CLASS-DATA:
go_random_seats TYPE REF TO cl_abap_random_int,
gt_flights_seats_decrease TYPE lcl_flight_data_generator=>tt_flights,
go_ran_travel_group_amount TYPE REF TO cl_abap_random_int,
go_ran_trip_length TYPE REF TO cl_abap_random_int,
go_ran_customer TYPE REF TO cl_abap_random_int,
gt_agency TYPE lcl_agency_data_generator=>tt_agency,
gt_customer TYPE lcl_customer_data_generator=>tt_customer,
gt_flights_final TYPE lcl_flight_data_generator=>tt_flights,
go_ran_booking_date TYPE REF TO cl_abap_random_int,
go_ran_agency TYPE REF TO cl_abap_random_int,
gt_connections TYPE lcl_connection_data_generator=>tt_connection_additional_info,
go_ran_booking_supplement_id TYPE REF TO cl_abap_random_int,
go_ran_booking_supplement_amnt TYPE REF TO cl_abap_random_int,
gt_supplements TYPE lcl_supplement_data_generator=>tt_supplement_complete,
go_ran_travel_description TYPE REF TO cl_abap_random_int,
go_ran_travel_create_dat_befor TYPE REF TO cl_abap_random_int,
go_ran_travel_change_date TYPE REF TO cl_abap_random_int,
go_ran_hour TYPE REF TO cl_abap_random_int,
go_ran_min_sec TYPE REF TO cl_abap_random_int,
gt_airports TYPE lcl_airport_data_generator=>tt_airport,
gt_countryname TYPE STANDARD TABLE OF ty_countryname WITH KEY country,
go_ran_status_description TYPE REF TO cl_abap_random_int,
gt_last_names TYPE lcl_customer_data_generator=>tt_last_name,
go_ran_last_name TYPE REF TO cl_abap_random_int,
go_ran_customer_travel TYPE REF TO cl_abap_random_int,
mv_datum TYPE d.
CLASS-METHODS:
get_data
RETURNING
VALUE(rt_data) TYPE tt_travel_complete,
build_booking
IMPORTING
iv_travel_id TYPE /dmo/booking14-travel_id
RETURNING
VALUE(rt_bookings) TYPE tt_booking_complete,
build_dependend_content,
find_next_fitting_flight
IMPORTING
iv_seats_required TYPE i
is_flight_previous TYPE /dmo/flight14 OPTIONAL
RETURNING
VALUE(rs_flight) TYPE /dmo/flight14,
generate_booking_supplements
IMPORTING
iv_travel_id TYPE /dmo/booking14-travel_id
iv_booking_id TYPE /dmo/booking14-booking_id
RETURNING
VALUE(rt_data) TYPE tt_booking_supplements,
generate_description
IMPORTING
it_bookings TYPE lcl_travel_data_generator=>tt_booking_complete
RETURNING
VALUE(rv_description) TYPE /dmo/travel14-description,
generate_random_time
RETURNING
VALUE(r_result) TYPE i,
calculate_booking_fee
IMPORTING
it_bookings TYPE lcl_travel_data_generator=>tt_booking_complete
RETURNING
VALUE(rv_booking_fee) TYPE /dmo/travel14-booking_fee,
generate_travel_customer_id
IMPORTING
it_bookings TYPE lcl_travel_data_generator=>tt_booking_complete
RETURNING
VALUE(rv_customer_id) TYPE /dmo/travel14-customer_id,
set_today,
calc_days_before_book_or_today
IMPORTING
iv_booking_date TYPE lcl_travel_data_generator=>ty_booking_complete-booking_date
RETURNING
VALUE(rv_travel_create_date_dats) TYPE d
RAISING
cx_parameter_invalid_range
cx_parameter_invalid_type .
ENDCLASS.
CLASS lcl_travel_data_generator IMPLEMENTATION.
METHOD lif_data_generator~create.
DATA: lt_travels TYPE tt_travel,
lt_bookings TYPE tt_bookings,
lt_booking_supplements TYPE tt_booking_supplements.
IF out IS BOUND. out->write( '--> Delete Travel Content.' ). ENDIF.
DELETE FROM /dmo/travel14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Delete Booking Content.' ). ENDIF.
DELETE FROM /dmo/booking14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Delete Booking Supplement Content.' ). ENDIF.
DELETE FROM /dmo/book_sup_14. "#EC CI_NOWHERE
IF out IS BOUND. out->write( '--> Build Content.' ). ENDIF.
DATA(lt_data) = get_data( ).
IF out IS BOUND. out->write( '--> Convert Content to Table Format' ). ENDIF.
LOOP AT lt_data INTO DATA(ls_travel).
APPEND CORRESPONDING /dmo/travel14( ls_travel ) TO lt_travels.
LOOP AT ls_travel-bookings INTO DATA(ls_booking).
APPEND CORRESPONDING /dmo/booking14( ls_booking ) TO lt_bookings.
APPEND LINES OF ls_booking-booking_supplements TO lt_booking_supplements.
ENDLOOP.
ENDLOOP.
IF out IS BOUND. out->write( '--> Insert Travel Content' ). ENDIF.
INSERT /dmo/travel14 FROM TABLE @lt_travels.
IF out IS BOUND. out->write( '--> Insert Booking Content' ). ENDIF.
INSERT /dmo/booking14 FROM TABLE @lt_bookings.
IF out IS BOUND. out->write( '--> Insert Booking Supplement Content' ). ENDIF.
INSERT /dmo/book_sup_14 FROM TABLE @lt_booking_supplements.
IF out IS BOUND. out->write( '--> Done.' ). ENDIF.
ENDMETHOD.
METHOD get_data.
DATA: lv_travel_id TYPE /dmo/booking14-travel_id.
build_dependend_content( ).
set_today( ).
lv_travel_id = 1.
DATA(lt_bookings) = build_booking( lv_travel_id ).
WHILE lt_bookings IS NOT INITIAL.
DATA(lv_travel_create_date_dats) = calc_days_before_book_or_today( lt_bookings[ 1 ]-booking_date ).
DATA(lv_booking_fee) = calculate_booking_fee( lt_bookings ).
DATA(lastchanged_date) = lv_travel_create_date_dats.
lastchanged_date = lastchanged_date + go_ran_travel_change_date->get_next( ).
DATA(lastchangedat_stamp) = CONV timestampl( ( CONV string( lastchanged_date ) * 1000000 ) ).
lastchangedat_stamp = lastchangedat_stamp + generate_random_time( ).
APPEND VALUE ty_travel_complete(
travel_id = lv_travel_id
agency_id = gt_agency[ go_ran_agency->get_next( ) ]-agency_id
customer_id = generate_travel_customer_id( lt_bookings )
begin_date = lt_bookings[ 1 ]-flight_date
end_date = lt_bookings[ lines( lt_bookings ) ]-flight_date
booking_fee = lv_booking_fee
total_price = lv_booking_fee + REDUCE /dmo/travel14-total_price( INIT sum = 0
FOR booking IN lt_bookings
NEXT
sum = sum
+ booking-flight_price
+ REDUCE /dmo/flight_price14( INIT sum_supplement = 0
FOR booking_supplement IN booking-booking_supplements
NEXT sum_supplement = sum_supplement + booking_supplement-price )
)
currency_code = lt_bookings[ 1 ]-currency_code
description = generate_description( lt_bookings )
status = SWITCH /dmo/travel14-status( go_ran_status_description->get_next( )
WHEN 1 OR 2 THEN /dmo/if_flight_legacy14=>travel_status-new
WHEN 3 THEN /dmo/if_flight_legacy14=>travel_status-booked
WHEN 4 THEN /dmo/if_flight_legacy14=>travel_status-planned )
createdby = gt_last_names[ go_ran_last_name->get_next( ) ]-last_name
createdat = CONV timestampl( CONV string( lv_travel_create_date_dats ) * 1000000 + generate_random_time( ) )
lastchangedby = gt_last_names[ go_ran_last_name->get_next( ) ]-last_name
lastchangedat = lastchangedat_stamp
bookings = lt_bookings
) TO rt_data.
lv_travel_id = lv_travel_id + 1.
lt_bookings = build_booking( lv_travel_id ).
ENDWHILE.
ENDMETHOD.
METHOD calc_days_before_book_or_today.
cl_abap_tstmp=>td_add(
EXPORTING
date = COND d( WHEN mv_datum > iv_booking_date
THEN iv_booking_date
ELSE mv_datum )
time = CONV t( 0 )
secs = -86400 * cv_booking_days_before
IMPORTING
res_date = rv_travel_create_date_dats ).
ENDMETHOD.
METHOD set_today.
GET TIME STAMP FIELD DATA(current_timestamp).
DATA(tmp) = CONV string( current_timestamp ).
mv_datum = tmp(8).
mv_datum = mv_datum - 1.
ENDMETHOD.
METHOD generate_random_time.
r_result = go_ran_hour->get_next( ) * 10000 + go_ran_min_sec->get_next( ) * 100 + go_ran_min_sec->get_next( ).
ENDMETHOD.
METHOD build_dependend_content.
go_ran_hour = cl_abap_random_int=>create( min = 0 max = 23 ).
go_ran_min_sec = cl_abap_random_int=>create( min = 0 max = 59 ).
gt_agency = lcl_agency_data_generator=>get_data( ).
go_ran_agency = cl_abap_random_int=>create( min = 1 max = lines( gt_agency ) ).
gt_customer = lcl_customer_data_generator=>get_data( ).
go_ran_customer = cl_abap_random_int=>create( min = 1 max = lines( gt_customer ) ).
gt_last_names = lcl_customer_data_generator=>build_last_names( ).
go_ran_last_name = cl_abap_random_int=>create( min = 1 max = lines( gt_last_names ) ).
go_ran_customer_travel = cl_abap_random_int=>create( min = 1 max = 4 ).
gt_connections = lcl_connection_data_generator=>get_data( ).
gt_airports = lcl_airport_data_generator=>get_data( ).
SELECT FROM i_countrytext FIELDS country, countryname WHERE language = 'E' INTO TABLE @gt_countryname.
gt_flights_final = lcl_flight_data_generator=>get_data( ).
SORT gt_flights_final BY flight_date ASCENDING.
gt_flights_seats_decrease = lcl_flight_data_generator=>get_data( ).
SORT gt_flights_seats_decrease BY flight_date ASCENDING.
go_ran_travel_group_amount = cl_abap_random_int=>create( min = 1 max = cv_travel_group_amount_max ).
go_ran_trip_length = cl_abap_random_int=>create( min = cv_trip_length_center - cv_trip_length_offset max = cv_trip_length_center + cv_trip_length_offset ).
go_ran_booking_date = cl_abap_random_int=>create( min = cv_booking_date_min max = cv_booking_date_max ).
go_ran_travel_create_dat_befor = cl_abap_random_int=>create( min = cv_booking_date_min max = cv_booking_date_max ).
go_ran_travel_change_date = cl_abap_random_int=>create( min = cv_booking_date_min max = cv_booking_date_max ).
gt_supplements = lcl_supplement_data_generator=>get_data( ).
go_ran_booking_supplement_id = cl_abap_random_int=>create( min = 1 max = lines( lcl_supplement_data_generator=>get_data( ) ) ).
go_ran_booking_supplement_amnt = cl_abap_random_int=>create( min = 0 max = cv_booking_supplement_amount ).
go_ran_status_description = cl_abap_random_int=>create( min = 1 max = 4 ).
go_ran_travel_description = cl_abap_random_int=>create( min = 0 max = 9 ).
ENDMETHOD.
METHOD build_booking.
TYPES: tt_customer_id TYPE TABLE OF /dmo/customer14-customer_id WITH EMPTY KEY.
DATA: lv_booking_id TYPE /dmo/booking14-booking_id,
lt_customer_id TYPE tt_customer_id,
lv_customer_amount TYPE i.
DATA(lv_trip_length) = go_ran_trip_length->get_next( ).
lt_customer_id = VALUE tt_customer_id(
FOR i = 1 THEN i + 1 WHILE i <= go_ran_travel_group_amount->get_next( )
LET j = go_ran_customer->get_next( ) IN
( gt_customer[ j ]-customer_id )
).
lt_customer_id = CORRESPONDING tt_customer_id( lt_customer_id DISCARDING DUPLICATES ).
lv_customer_amount = lines( lt_customer_id ).
lv_booking_id = 0.
DATA(ls_flight) = find_next_fitting_flight( iv_seats_required = lv_customer_amount ).
CHECK ls_flight IS NOT INITIAL.
DO lv_trip_length TIMES.
READ TABLE gt_flights_seats_decrease
WITH KEY key_sorted_date
COMPONENTS
carrier_id = ls_flight-carrier_id
connection_id = ls_flight-connection_id
flight_date = ls_flight-flight_date
ASSIGNING FIELD-SYMBOL(<flight>).
DATA(lv_booking_date) = CONV /dmo/booking14-booking_date( <flight>-flight_date - go_ran_booking_date->get_next( ) ).
DATA(lv_price) = /dmo/cl_flight_data_generat_14=>calculate_flight_price(
iv_flight_distance = gt_connections[ carrier_id = <flight>-carrier_id connection_id = <flight>-connection_id ]-distance
iv_seats_occupied_percent = ( gt_flights_final[ KEY primary_key ##PRIMKEY[KEY_SORTED_DATE]
carrier_id = <flight>-carrier_id
connection_id = <flight>-connection_id
flight_date = <flight>-flight_date
]-seats_occupied
- <flight>-seats_occupied
) * 100 DIV <flight>-seats_max
).
<flight>-seats_occupied = <flight>-seats_occupied - lv_customer_amount.
APPEND LINES OF VALUE tt_booking_complete(
FOR i = 1 THEN i + 1 WHILE i <= lines( lt_customer_id )
(
travel_id = iv_travel_id
booking_id = lv_booking_id + i
booking_date = lv_booking_date
customer_id = lt_customer_id[ i ]
carrier_id = <flight>-carrier_id
connection_id = <flight>-connection_id
flight_date = <flight>-flight_date
flight_price = lv_price
currency_code = <flight>-currency_code
booking_supplements = generate_booking_supplements( iv_travel_id = iv_travel_id iv_booking_id = CONV /dmo/booking14-booking_id( lv_booking_id + i ) )
)
) TO rt_bookings.
lv_booking_id = lv_booking_id + lines( lt_customer_id ).
ls_flight = find_next_fitting_flight(
iv_seats_required = lv_customer_amount
is_flight_previous = <flight>
).
IF ls_flight IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDMETHOD.
METHOD find_next_fitting_flight.
DATA(lt_flights_filtered) = FILTER lcl_flight_data_generator=>tt_flights(
gt_flights_seats_decrease
USING KEY key_sorted_seats
WHERE seats_occupied >= iv_seats_required
).
CHECK lt_flights_filtered IS NOT INITIAL.
IF is_flight_previous IS SUPPLIED.
DATA(lv_connection_id_new) = VALUE /dmo/connecti_14-connection_id( gt_connections[
airport_from_id = gt_connections[
connection_id = is_flight_previous-connection_id
]-airport_to_id
]-connection_id
OPTIONAL ).
CHECK lv_connection_id_new IS NOT INITIAL.
DATA(lt_flights_filtered2) = FILTER lcl_flight_data_generator=>tt_flights(
lt_flights_filtered
USING KEY key_sorted_date
WHERE connection_id = lv_connection_id_new
AND flight_date >= is_flight_previous-flight_date
).
CHECK lt_flights_filtered2 IS NOT INITIAL.
rs_flight = lt_flights_filtered2[ 1 ].
ELSE.
rs_flight = lt_flights_filtered[ 1 ].
ENDIF.
ENDMETHOD.
METHOD generate_booking_supplements.
rt_data = VALUE tt_booking_supplements(
FOR i = 1
THEN i + 1
WHILE i <= go_ran_booking_supplement_amnt->get_next( )
LET j = go_ran_booking_supplement_id->get_next( ) IN
( travel_id = iv_travel_id
booking_id = iv_booking_id
booking_supplement_id = i
supplement_id = gt_supplements[ j ]-supplement_id
price = gt_supplements[ j ]-price
currency_code = gt_supplements[ j ]-currency_code )
).
ENDMETHOD.
METHOD generate_description.
TYPES: tt_customers TYPE SORTED TABLE OF /dmo/customer14 WITH UNIQUE KEY customer_id.
rv_description = SWITCH /dmo/travel14-description(
go_ran_travel_description->get_next( )
WHEN 1 THEN `Business Trip for ` &&
REDUCE /dmo/travel14-description(
LET travelers = CORRESPONDING tt_customers( it_bookings DISCARDING DUPLICATES MAPPING customer_id = customer_id ) IN
INIT s = `` i = 1
FOR traveler IN travelers
NEXT s = s && gt_customer[ customer_id = traveler-customer_id ]-first_name
&& COND /dmo/travel14-description( WHEN i < lines( it_bookings ) THEN `, ` )
i = i + 1 )
WHEN 2 THEN `Vacation for ` &&
REDUCE /dmo/travel14-description(
LET travelers2 = CORRESPONDING tt_customers( it_bookings DISCARDING DUPLICATES MAPPING customer_id = customer_id ) IN
INIT s = `` i = 1
FOR traveler IN travelers2
NEXT s = s && gt_customer[ customer_id = traveler-customer_id ]-first_name
&& COND /dmo/travel14-description( WHEN i < lines( it_bookings ) THEN `, ` )
i = i + 1 )
WHEN 3 THEN `Business Trip to ` &&
gt_countryname[
country = gt_airports[
airport_id = gt_connections[
carrier_id = it_bookings[ 1 ]-carrier_id connection_id = it_bookings[ 1 ]-connection_id
]-airport_to_id
]-country
]-countryname
WHEN 4 THEN `Vacation to ` &&
gt_countryname[
country = gt_airports[
airport_id = gt_connections[
carrier_id = it_bookings[ 1 ]-carrier_id connection_id = it_bookings[ 1 ]-connection_id
]-airport_to_id
]-country
]-countryname
WHEN 5 THEN `Sightseeing in ` && gt_airports[
airport_id = gt_connections[
carrier_id = it_bookings[ 1 ]-carrier_id connection_id = it_bookings[ 1 ]-connection_id
]-airport_to_id
]-city
WHEN 6 THEN `Visiting ` && gt_customer[ go_ran_customer->get_next( ) ]-first_name
WHEN 7 THEN `Business Trip`
ELSE `Vacation`
).
ENDMETHOD.
METHOD calculate_booking_fee.
rv_booking_fee = 10 * lines( it_bookings ).
ENDMETHOD.
METHOD generate_travel_customer_id.
rv_customer_id = COND /dmo/travel14-customer_id(
WHEN go_ran_customer_travel->get_next( ) = 1
THEN gt_customer[ go_ran_customer->get_next( ) ]-customer_id
ELSE it_bookings[ 1 ]-customer_id
).
ENDMETHOD.
ENDCLASS.
| 50.396552 | 213 | 0.522646 |
c48454f7e49bc252c9a4164ccb9b25e024b19203
| 1,472 |
abap
|
ABAP
|
src/ycl_advent2020_day24.clas.testclasses.abap
|
g-back/abap-advent-2020
|
95e6015efc25f75c867ceadbac34fabc924c2928
|
[
"MIT"
] | 3 |
2020-12-06T21:10:23.000Z
|
2020-12-18T15:46:34.000Z
|
src/ycl_advent2020_day24.clas.testclasses.abap
|
g-back/abap-advent-2020
|
95e6015efc25f75c867ceadbac34fabc924c2928
|
[
"MIT"
] | null | null | null |
src/ycl_advent2020_day24.clas.testclasses.abap
|
g-back/abap-advent-2020
|
95e6015efc25f75c867ceadbac34fabc924c2928
|
[
"MIT"
] | null | null | null |
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS FINAL.
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO ycl_advent2020_day24.
DATA m_input TYPE string_table.
METHODS setup.
METHODS given_the_example.
METHODS given_the_input.
METHODS part_one_example FOR TESTING.
METHODS part_one_input FOR TESTING.
METHODS part_two_example FOR TESTING.
METHODS part_two_input FOR TESTING.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD setup.
mo_cut = NEW #( ).
ENDMETHOD.
METHOD part_one_example.
given_the_example( ).
DATA(act) = mo_cut->solve_part_one( input = m_input ).
cl_abap_unit_assert=>assert_equals( exp = -1 act = act ).
ENDMETHOD.
METHOD part_one_input.
given_the_input( ).
DATA(act) = mo_cut->solve_part_one( input = m_input ).
cl_abap_unit_assert=>assert_equals( exp = -1 act = act ).
ENDMETHOD.
METHOD part_two_example.
given_the_example( ).
DATA(act) = mo_cut->solve_part_two( input = m_input ).
cl_abap_unit_assert=>assert_equals( exp = -1 act = act ).
ENDMETHOD.
METHOD part_two_input.
given_the_input( ).
DATA(act) = mo_cut->solve_part_two( input = m_input ).
cl_abap_unit_assert=>assert_equals( exp = -1 act = act ).
ENDMETHOD.
METHOD given_the_example.
m_input = VALUE #(
).
ENDMETHOD.
METHOD given_the_input.
m_input = VALUE #(
).
ENDMETHOD.
ENDCLASS.
| 22.30303 | 61 | 0.700408 |
c48a678d548f81bfc5c20ec3c9c216fb2e2679b1
| 6,352 |
abap
|
ABAP
|
src/foundation/y_exemption_of_class.clas.abap
|
steve192/code-pal-for-abap
|
5f701f5239036cbb724756a86e805fdbae377ab7
|
[
"Apache-2.0"
] | null | null | null |
src/foundation/y_exemption_of_class.clas.abap
|
steve192/code-pal-for-abap
|
5f701f5239036cbb724756a86e805fdbae377ab7
|
[
"Apache-2.0"
] | 1 |
2022-02-27T18:48:26.000Z
|
2022-02-27T18:48:26.000Z
|
src/foundation/y_exemption_of_class.clas.abap
|
steve192/code-pal-for-abap
|
5f701f5239036cbb724756a86e805fdbae377ab7
|
[
"Apache-2.0"
] | null | null | null |
CLASS y_exemption_of_class DEFINITION PUBLIC CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES y_if_exemption_of_object.
ALIASES is_exempted FOR y_if_exemption_of_object~is_exempted.
PRIVATE SECTION.
CLASS-DATA class_header_data TYPE seoclassdf.
CLASS-METHODS is_srv_maint_ui_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_odata_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_ecatt_odata_test_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_fin_infotype_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_extensibility_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_shma_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_proxy_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_sadl_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_exit_class RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_exception_class RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_bcp_application RETURNING VALUE(result) TYPE abap_bool.
ENDCLASS.
CLASS y_exemption_of_class IMPLEMENTATION.
METHOD y_if_exemption_of_object~is_exempted.
result = abap_true.
SELECT SINGLE *
FROM seoclassdf
INTO @class_header_data
WHERE clsname = @object_name
AND version = 1.
IF sy-subrc = 0.
result = xsdbool( is_srv_maint_ui_generate( ) = abap_true OR
is_odata_generate( ) = abap_true OR
is_ecatt_odata_test_generate( ) = abap_true OR
is_fin_infotype_generate( ) = abap_true OR
is_extensibility_generate( ) = abap_true OR
is_shma_generate( ) = abap_true OR
is_proxy_generate( ) = abap_true OR
is_sadl_generate( ) = abap_true OR
is_exit_class( ) = abap_true OR
is_exception_class( ) = abap_true OR
is_bcp_application( ) = abap_true ).
ENDIF.
ENDMETHOD.
METHOD is_bcp_application.
DATA it_bsp_classes TYPE STANDARD TABLE OF seoclsname.
it_bsp_classes = VALUE #( ( 'CL_BSP_WD_COMPONENT_CONTROLLER' )
( 'CL_BSP_WD_CONTEXT' )
( 'CL_BSP_WD_CONTEXT_NODE' )
( 'CL_BSP_WD_WINDOW' )
( 'CL_BSP_WD_CUSTOM_CONTROLLER' )
( 'CL_BSP_WD_VIEW_CONTROLLER' )
( 'CL_BSP_WD_ADVSEARCH_CONTROLLER' )
( 'CL_BSP_WD_CONTEXT_NODE_ASP' ) ).
SELECT SINGLE refclsname FROM seometarel
WHERE clsname = @class_header_data-clsname AND refclsname IS NOT NULL
INTO @DATA(inherited_by).
IF sy-subrc <> 0.
RETURN.
ENDIF.
"Multi Inheritance
DO.
IF line_exists( it_bsp_classes[ table_line = inherited_by ] ).
result = abap_true.
RETURN.
ENDIF.
SELECT SINGLE refclsname FROM seometarel
WHERE clsname = @inherited_by AND refclsname IS NOT NULL
INTO @inherited_by.
IF sy-subrc = 4.
RETURN.
ENDIF.
ENDDO.
ENDMETHOD.
METHOD is_ecatt_odata_test_generate.
SELECT SINGLE @abap_true
FROM seoclassdf
INTO @result
WHERE clsname = @class_header_data-clsname
AND author = 'eCATTClassGe'.
ENDMETHOD.
METHOD is_exception_class.
CONSTANTS exception_clase_type LIKE class_header_data-category VALUE '40'.
IF class_header_data-category = exception_clase_type.
result = abap_true.
ENDIF.
ENDMETHOD.
METHOD is_exit_class.
CONSTANTS exit_class_type LIKE class_header_data-category VALUE '01'.
IF class_header_data-category = exit_class_type.
result = abap_true.
ENDIF.
ENDMETHOD.
METHOD is_extensibility_generate.
DATA: lt_interfaces TYPE seor_implementing_keys.
DATA: lv_seoclskey TYPE seoclskey.
lv_seoclskey = class_header_data-clsname.
CALL FUNCTION 'SEO_CLASS_ALL_IMPLEMENTG_GET'
EXPORTING
clskey = lv_seoclskey
IMPORTING
set = lt_interfaces
EXCEPTIONS
not_existing = 1
is_interface = 2
model_only = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
result = xsdbool( line_exists( lt_interfaces[ refclsname = 'IF_CFD_ODATA_MPC_FLX' ] )
OR line_exists( lt_interfaces[ refclsname = 'IF_CFD_ODATA_DPC_FLX' ] ) ).
ENDMETHOD.
METHOD is_fin_infotype_generate.
SELECT SINGLE @abap_true
FROM t777ditclass
INTO @result
WHERE idclass = @class_header_data-clsname
OR cont_db = @class_header_data-clsname
OR bl_class = @class_header_data-clsname.
ENDMETHOD.
METHOD is_odata_generate.
SELECT SINGLE @abap_true
FROM /iwbep/i_sbd_ga
INTO @result
WHERE ( gen_art_type = 'DPCB' OR gen_art_type = 'MPCB' )
AND trobj_type = 'CLAS'
AND trobj_name = @class_header_data-clsname. "#EC CI_NOFIELD
ENDMETHOD.
METHOD is_proxy_generate.
result = xsdbool( class_header_data-clsproxy = abap_true ).
ENDMETHOD.
METHOD is_sadl_generate.
SELECT SINGLE @abap_true
FROM seoclasstx
INTO @result
WHERE clsname = @class_header_data-clsname
AND descript = 'Generated by SADL Generation Toolkit' ##NO_TEXT.
ENDMETHOD.
METHOD is_shma_generate.
SELECT SINGLE @abap_true
FROM tadir
INTO @result
WHERE pgmid = 'R3TR'
AND object = 'SHMA'
AND obj_name = @class_header_data-clsname.
ENDMETHOD.
METHOD is_srv_maint_ui_generate.
DATA: lt_interfaces TYPE seor_implementing_keys.
DATA: lv_seoclskey TYPE seoclskey.
lv_seoclskey = class_header_data-clsname.
CALL FUNCTION 'SEO_CLASS_ALL_IMPLEMENTG_GET'
EXPORTING
clskey = lv_seoclskey
IMPORTING
set = lt_interfaces
EXCEPTIONS
not_existing = 1
is_interface = 2
model_only = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
result = xsdbool( line_exists( lt_interfaces[ refclsname = '/FTI/IF_FTI_MODEL' ] )
OR line_exists( lt_interfaces[ refclsname = '/FTI/IF_NATIVE_SQL_GENERATOR' ] ) ).
ENDMETHOD.
ENDCLASS.
| 30.68599 | 100 | 0.663256 |
c48ab86a40f042cd4b1b745c7d92d4ae5aaf921e
| 5,941 |
abap
|
ABAP
|
ztrcktrsr_alv_autosumme2.prog.abap
|
tricktresor/alv_grid
|
94a7c1f44aad1a7a45c47406dafd8a6f84ccc6ba
|
[
"MIT"
] | 9 |
2018-02-05T10:43:36.000Z
|
2020-02-21T23:52:46.000Z
|
ztrcktrsr_alv_autosumme2.prog.abap
|
tricktresor/alv_grid
|
94a7c1f44aad1a7a45c47406dafd8a6f84ccc6ba
|
[
"MIT"
] | 1 |
2018-01-20T05:19:33.000Z
|
2018-01-20T05:19:33.000Z
|
ztrcktrsr_alv_autosumme2.prog.abap
|
tricktresor/alv_grid
|
94a7c1f44aad1a7a45c47406dafd8a6f84ccc6ba
|
[
"MIT"
] | 3 |
2018-04-19T08:40:34.000Z
|
2021-10-02T12:39:52.000Z
|
*&---------------------------------------------------------------------*
*& Report ZTRCKTRSR_ALV_AUTOSUMME2
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ztrcktrsr_alv_autosumme2.
PARAMETERS p_total TYPE p DECIMALS 2.
CLASS lcl_autosumme DEFINITION.
PUBLIC SECTION.
INTERFACES if_alv_rm_grid_friend .
CLASS-METHODS register IMPORTING ir_grid TYPE REF TO cl_gui_alv_grid.
PROTECTED SECTION.
CLASS-METHODS handle_delayed_selection
FOR EVENT delayed_changed_sel_callback
OF cl_gui_alv_grid
IMPORTING sender.
ENDCLASS.
CLASS lcl_autosumme IMPLEMENTATION.
METHOD register.
"Set handler
SET HANDLER handle_delayed_selection FOR ir_grid.
"set delayed selection time
ir_grid->set_delay_change_selection( time = 100 ). " Time in Milliseconds
"register event for delayed selection
ir_grid->register_delayed_event( ir_grid->mc_evt_delayed_change_select ).
ENDMETHOD.
METHOD handle_delayed_selection.
"Local data
DATA lt_cells TYPE lvc_t_cell.
DATA ls_cell LIKE LINE OF lt_cells.
DATA lv_total TYPE p DECIMALS 2.
DATA lv_val_type TYPE c.
DATA lv_index TYPE n LENGTH 2.
DATA lv_tablename TYPE string.
DATA lt_grouplevels TYPE lvc_t_grpl.
DATA ls_grouplevel LIKE LINE OF lt_grouplevels.
FIELD-SYMBOLS <ref_data> TYPE REF TO data.
FIELD-SYMBOLS <table> TYPE table.
FIELD-SYMBOLS <warea> TYPE any.
FIELD-SYMBOLS <val> TYPE any.
"data references to sub totals tables
DATA ld_ct01 TYPE REF TO data.
DATA ld_ct02 TYPE REF TO data.
DATA ld_ct03 TYPE REF TO data.
DATA ld_ct04 TYPE REF TO data.
DATA ld_ct05 TYPE REF TO data.
DATA ld_ct06 TYPE REF TO data.
DATA ld_ct07 TYPE REF TO data.
DATA ld_ct08 TYPE REF TO data.
DATA ld_ct09 TYPE REF TO data.
"get selected cells (selection via CTRL + Y)
sender->get_selected_cells( IMPORTING et_cell = lt_cells ).
"If there is only one cell selected, we do not need to sum that...
CHECK lines( lt_cells ) > 1.
"Read all cell values
LOOP AT lt_cells INTO ls_cell.
"in case of rowtype (normal cell, total or subtotal) assign correct data table
CASE ls_cell-row_id-rowtype(1).
"Total sum of all
WHEN 'T'.
ASSIGN sender->mt_ct00 TO <ref_data>.
ls_cell-row_id-index = 1.
"subtotals
WHEN 'S'.
sender->get_subtotals( IMPORTING
ep_collect01 = ld_ct01
ep_collect02 = ld_ct02
ep_collect03 = ld_ct03
ep_collect04 = ld_ct04
ep_collect05 = ld_ct05
ep_collect06 = ld_ct06
ep_collect07 = ld_ct07
ep_collect08 = ld_ct08
ep_collect09 = ld_ct09
et_grouplevels = lt_grouplevels ).
lv_index = ls_cell-row_id-rowtype+4(2).
lv_tablename = 'LD_CT' && lv_index.
ASSIGN (lv_tablename) TO <ref_data>.
READ TABLE lt_grouplevels INTO ls_grouplevel INDEX ls_cell-row_id-index.
IF sy-subrc = 0.
ls_cell-row_id-index = ls_grouplevel-cindx_from.
ENDIF.
"Normal cell value
WHEN space.
ASSIGN sender->mt_outtab TO <ref_data>.
ENDCASE.
"assign specified data table
ASSIGN <ref_data>->* TO <table>.
"Only read table line when index changes
AT NEW row_id.
READ TABLE <table> ASSIGNING <warea> INDEX ls_cell-row_id-index.
ENDAT.
"Assign selected fieldname of workarea
ASSIGN COMPONENT ls_cell-col_id OF STRUCTURE <warea> TO <val>.
IF sy-subrc = 0.
"check correct type of field: Only numeric fields will be taken
DESCRIBE FIELD <val> TYPE lv_val_type.
CASE lv_val_type.
WHEN 'P' "Packed
OR 'N' "Numchar
OR 'b' "Integer
OR 'a' "decfloat
OR 'e' "decfloat
OR 'F'. "Float?
"add cell value to total
ADD <val> TO lv_total.
ENDCASE.
ENDIF.
ENDLOOP.
IF lv_total IS NOT INITIAL.
"There were numeric fields selected and therefor we have a total to show:
MESSAGE s000(oo) WITH 'TOTAL:' space lv_total.
p_total = lv_total.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
* INTERFACES if_alv_rm_grid_friend .
METHODS start.
PROTECTED SECTION.
DATA mr_grid TYPE REF TO cl_gui_alv_grid.
DATA mt_data TYPE STANDARD TABLE OF spfli.
DATA mv_data_table TYPE tabname VALUE 'SPFLI'.
DATA mr_dock TYPE REF TO cl_gui_docking_container.
METHODS create_docker.
METHODS create_grid.
METHODS select_data.
METHODS register_autosumme.
ENDCLASS.
CLASS lcl_main IMPLEMENTATION.
METHOD start.
select_data( ).
create_docker( ).
create_grid( ).
register_autosumme( ).
ENDMETHOD.
METHOD create_docker.
"Create Docking container at bottom
CREATE OBJECT mr_dock
EXPORTING
side = cl_gui_docking_container=>dock_at_bottom
ratio = 90
no_autodef_progid_dynnr = abap_false.
ENDMETHOD.
METHOD create_grid.
"Create ALV-Grid
CREATE OBJECT mr_grid
EXPORTING
i_appl_events = abap_true
i_parent = mr_dock.
"and display data
mr_grid->set_table_for_first_display(
EXPORTING
i_structure_name = mv_data_table
CHANGING
it_outtab = mt_data ).
"Set focus on grid so user can directly scroll and select cells via CTRL+Y
cl_gui_container=>set_focus( mr_grid ).
ENDMETHOD.
METHOD select_data.
"Select data
SELECT * FROM (mv_data_table) INTO TABLE mt_data UP TO 100 ROWS.
ENDMETHOD.
METHOD register_autosumme.
lcl_autosumme=>register( mr_grid ).
ENDMETHOD.
ENDCLASS.
INITIALIZATION.
DATA(gr_main) = NEW lcl_main( ).
gr_main->start( ).
| 29.26601 | 84 | 0.641979 |
c48d3b19fcede42182c7a3ad42891e941eed6629
| 1,032 |
abap
|
ABAP
|
src/zcx_timem.clas.abap
|
g-back/abapTimeMachine
|
974655d14ceb57a2097137163a80d12fc5454b69
|
[
"MIT"
] | null | null | null |
src/zcx_timem.clas.abap
|
g-back/abapTimeMachine
|
974655d14ceb57a2097137163a80d12fc5454b69
|
[
"MIT"
] | null | null | null |
src/zcx_timem.clas.abap
|
g-back/abapTimeMachine
|
974655d14ceb57a2097137163a80d12fc5454b69
|
[
"MIT"
] | null | null | null |
"! Exception class for all the ZBLAME classes
class ZCX_TIMEM definition
public
inheriting from CX_STATIC_CHECK
create public .
public section.
interfaces IF_T100_DYN_MSG .
interfaces IF_T100_MESSAGE .
constants:
begin of OBJECT_NOT_FOUND,
msgid type symsgid value 'ZTIMEMACHINE',
msgno type symsgno value '000',
attr1 type scx_attrname value '',
attr2 type scx_attrname value '',
attr3 type scx_attrname value '',
attr4 type scx_attrname value '',
end of OBJECT_NOT_FOUND .
methods CONSTRUCTOR
importing
!TEXTID like IF_T100_MESSAGE=>T100KEY optional
!PREVIOUS like PREVIOUS optional .
protected section.
private section.
ENDCLASS.
CLASS ZCX_TIMEM IMPLEMENTATION.
method CONSTRUCTOR ##ADT_SUPPRESS_GENERATION.
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.
| 21.5 | 60 | 0.747093 |
c492ca2fd49fef2462e8838a23ef22b7812fa4f5
| 333 |
abap
|
ABAP
|
src/legacy/#dmo#flight_travel_api29.fugr.#dmo#flight_travel_save29.abap
|
SAP-Cloud-Platform/flight29
|
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#flight_travel_api29.fugr.#dmo#flight_travel_save29.abap
|
SAP-Cloud-Platform/flight29
|
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
|
[
"BSD-Source-Code"
] | null | null | null |
src/legacy/#dmo#flight_travel_api29.fugr.#dmo#flight_travel_save29.abap
|
SAP-Cloud-Platform/flight29
|
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
|
[
"BSD-Source-Code"
] | null | null | null |
"! API for Saving the Transactional Buffer of the Travel API
"!
FUNCTION /DMO/FLIGHT_TRAVEL_SAVE29.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------
/dmo/cl_flight_legacy29=>get_instance( )->save( ).
ENDFUNCTION.
| 37 | 72 | 0.423423 |
c49589687e01e202dc265d0a3a8181c0a0fba060
| 226 |
abap
|
ABAP
|
objects/CLAS/ZCL_ZAZURE_MONITOR_DPC/METH ZMONITOR_VALUESE_GET_ENTITY.abap
|
abhilashhaa/HCL_Githup
|
454be7f157c72fbb75550dea67c9167e405a4fdb
|
[
"Apache-2.0"
] | null | null | null |
objects/CLAS/ZCL_ZAZURE_MONITOR_DPC/METH ZMONITOR_VALUESE_GET_ENTITY.abap
|
abhilashhaa/HCL_Githup
|
454be7f157c72fbb75550dea67c9167e405a4fdb
|
[
"Apache-2.0"
] | null | null | null |
objects/CLAS/ZCL_ZAZURE_MONITOR_DPC/METH ZMONITOR_VALUESE_GET_ENTITY.abap
|
abhilashhaa/HCL_Githup
|
454be7f157c72fbb75550dea67c9167e405a4fdb
|
[
"Apache-2.0"
] | null | null | null |
method ZMONITOR_VALUESE_GET_ENTITY.
RAISE EXCEPTION TYPE /iwbep/cx_mgw_not_impl_exc
EXPORTING
textid = /iwbep/cx_mgw_not_impl_exc=>method_not_implemented
method = 'ZMONITOR_VALUESE_GET_ENTITY'.
endmethod.
| 37.666667 | 65 | 0.787611 |
c495a443c3bdfaa8ef861bfcaf77254098fdcbf9
| 13,787 |
abap
|
ABAP
|
src/zabapgit_object_sicf.prog.abap
|
christian102094/abapGit
|
b8df5f1e80c3f944f745bdfae61d37931e037e09
|
[
"MIT"
] | null | null | null |
src/zabapgit_object_sicf.prog.abap
|
christian102094/abapGit
|
b8df5f1e80c3f944f745bdfae61d37931e037e09
|
[
"MIT"
] | null | null | null |
src/zabapgit_object_sicf.prog.abap
|
christian102094/abapGit
|
b8df5f1e80c3f944f745bdfae61d37931e037e09
|
[
"MIT"
] | null | null | null |
*&---------------------------------------------------------------------*
*& Include ZABAPGIT_OBJECT_SICF
*&---------------------------------------------------------------------*
*----------------------------------------------------------------------*
* CLASS lcl_object_sicf DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_object_sicf DEFINITION INHERITING FROM lcl_objects_super FINAL.
PUBLIC SECTION.
INTERFACES lif_object.
ALIASES mo_files FOR lif_object~mo_files.
PRIVATE SECTION.
TYPES: ty_icfhandler_tt TYPE STANDARD TABLE OF icfhandler WITH DEFAULT KEY.
TYPES: BEGIN OF ty_sicf_key,
icf_name TYPE icfservice-icf_name,
icfparguid TYPE icfservice-icfparguid,
END OF ty_sicf_key.
METHODS read
IMPORTING iv_clear TYPE abap_bool DEFAULT abap_true
EXPORTING es_icfservice TYPE icfservice
es_icfdocu TYPE icfdocu
et_icfhandler TYPE ty_icfhandler_tt
ev_url TYPE string
RAISING lcx_exception.
METHODS insert_sicf
IMPORTING is_icfservice TYPE icfservice
is_icfdocu TYPE icfdocu
it_icfhandler TYPE ty_icfhandler_tt
iv_package TYPE devclass
iv_url TYPE string
RAISING lcx_exception.
METHODS change_sicf
IMPORTING is_icfservice TYPE icfservice
is_icfdocu TYPE icfdocu
it_icfhandler TYPE ty_icfhandler_tt
iv_package TYPE devclass
iv_parent TYPE icfparguid
RAISING lcx_exception.
METHODS to_icfhndlist
IMPORTING it_list TYPE ty_icfhandler_tt
RETURNING VALUE(rt_list) TYPE icfhndlist.
METHODS find_parent
IMPORTING iv_url TYPE string
RETURNING VALUE(rv_parent) TYPE icfparguid
RAISING lcx_exception.
ENDCLASS. "lcl_object_sicf DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_object_sicf IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_object_sicf IMPLEMENTATION.
METHOD lif_object~has_changed_since.
rv_changed = abap_true.
ENDMETHOD. "lif_object~has_changed_since
METHOD lif_object~changed_by.
DATA: ls_icfservice TYPE icfservice.
read( EXPORTING iv_clear = abap_false
IMPORTING es_icfservice = ls_icfservice ).
rv_user = ls_icfservice-icf_muser.
ENDMETHOD.
METHOD lif_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD. "lif_object~get_metadata
METHOD lif_object~exists.
DATA: ls_icfservice TYPE icfservice.
read( IMPORTING es_icfservice = ls_icfservice ).
rv_bool = boolc( NOT ls_icfservice IS INITIAL ).
ENDMETHOD. "lif_object~exists
METHOD lif_object~serialize.
DATA: ls_icfservice TYPE icfservice,
ls_icfdocu TYPE icfdocu,
lv_url TYPE string,
lt_icfhandler TYPE TABLE OF icfhandler.
read( IMPORTING es_icfservice = ls_icfservice
es_icfdocu = ls_icfdocu
et_icfhandler = lt_icfhandler
ev_url = lv_url ).
IF ls_icfservice IS INITIAL.
RETURN.
ENDIF.
CLEAR ls_icfservice-icfnodguid.
CLEAR ls_icfservice-icfparguid.
CLEAR ls_icfservice-icf_user.
CLEAR ls_icfservice-icf_cclnt.
CLEAR ls_icfservice-icf_mclnt.
io_xml->add( iv_name = 'URL'
ig_data = lv_url ).
io_xml->add( iv_name = 'ICFSERVICE'
ig_data = ls_icfservice ).
io_xml->add( iv_name = 'ICFDOCU'
ig_data = ls_icfdocu ).
io_xml->add( iv_name = 'ICFHANDLER_TABLE'
ig_data = lt_icfhandler ).
ENDMETHOD. "serialize
METHOD read.
DATA: lt_serv_info TYPE icfservtbl,
ls_serv_info LIKE LINE OF lt_serv_info,
ls_key TYPE ty_sicf_key.
FIELD-SYMBOLS: <ls_icfhandler> LIKE LINE OF et_icfhandler.
CLEAR es_icfservice.
CLEAR es_icfdocu.
CLEAR et_icfhandler.
CLEAR ev_url.
ls_key = ms_item-obj_name.
IF ls_key-icfparguid IS INITIAL.
* limitation: name must be unique
SELECT SINGLE icfparguid FROM icfservice
INTO ls_key-icfparguid
WHERE icf_name = ls_key-icf_name
AND icf_cuser <> 'SAP' ##warn_ok.
IF sy-subrc <> 0.
RETURN.
ENDIF.
ENDIF.
cl_icf_tree=>if_icf_tree~get_info_from_serv(
EXPORTING
icf_name = ls_key-icf_name
icfparguid = ls_key-icfparguid
icf_langu = mv_language
IMPORTING
serv_info = lt_serv_info
icfdocu = es_icfdocu
url = ev_url
EXCEPTIONS
wrong_name = 1
wrong_parguid = 2
incorrect_service = 3
no_authority = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from get_info_from_serv' ).
ENDIF.
ASSERT lines( lt_serv_info ) = 1.
READ TABLE lt_serv_info INDEX 1 INTO ls_serv_info.
ASSERT sy-subrc = 0.
MOVE-CORRESPONDING ls_serv_info-service TO es_icfservice.
IF iv_clear = abap_true.
CLEAR es_icfservice-icf_cuser.
CLEAR es_icfservice-icf_cdate.
CLEAR es_icfservice-icf_muser.
CLEAR es_icfservice-icf_mdate.
ENDIF.
CLEAR es_icfdocu-icfparguid.
APPEND LINES OF ls_serv_info-handlertbl TO et_icfhandler.
LOOP AT et_icfhandler ASSIGNING <ls_icfhandler>.
CLEAR <ls_icfhandler>-icfparguid.
ENDLOOP.
ENDMETHOD. "read
METHOD lif_object~deserialize.
DATA: ls_icfservice TYPE icfservice,
ls_read TYPE icfservice,
ls_icfdocu TYPE icfdocu,
lv_url TYPE string,
lt_icfhandler TYPE TABLE OF icfhandler.
io_xml->read( EXPORTING iv_name = 'URL'
CHANGING cg_data = lv_url ).
io_xml->read( EXPORTING iv_name = 'ICFSERVICE'
CHANGING cg_data = ls_icfservice ).
io_xml->read( EXPORTING iv_name = 'ICFDOCU'
CHANGING cg_data = ls_icfdocu ).
io_xml->read( EXPORTING iv_name = 'ICFHANDLER_TABLE'
CHANGING cg_data = lt_icfhandler ).
read( IMPORTING es_icfservice = ls_read ).
IF ls_read IS INITIAL.
insert_sicf( is_icfservice = ls_icfservice
is_icfdocu = ls_icfdocu
it_icfhandler = lt_icfhandler
iv_package = iv_package
iv_url = lv_url ).
ELSE.
change_sicf( is_icfservice = ls_icfservice
is_icfdocu = ls_icfdocu
it_icfhandler = lt_icfhandler
iv_package = iv_package
iv_parent = ls_read-icfparguid ).
ENDIF.
ENDMETHOD. "deserialize
METHOD to_icfhndlist.
FIELD-SYMBOLS: <ls_list> LIKE LINE OF it_list.
* convert to sorted table
LOOP AT it_list ASSIGNING <ls_list>.
INSERT <ls_list>-icfhandler INTO TABLE rt_list.
ENDLOOP.
ENDMETHOD. "to_icfhndlist
METHOD find_parent.
cl_icf_tree=>if_icf_tree~service_from_url(
EXPORTING
url = iv_url
hostnumber = 0
IMPORTING
icfnodguid = rv_parent
EXCEPTIONS
wrong_application = 1
no_application = 2
not_allow_application = 3
wrong_url = 4
no_authority = 5
OTHERS = 6 ).
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from service_from_url' ).
ENDIF.
ENDMETHOD. "find_parent
METHOD insert_sicf.
DATA: lt_icfhndlist TYPE icfhndlist,
ls_icfserdesc TYPE icfserdesc,
ls_icfdocu TYPE icfdocu,
lv_parent TYPE icfparguid.
lt_icfhndlist = to_icfhndlist( it_icfhandler ).
lv_parent = find_parent( iv_url ).
* nice, it seems that the structure should be mistreated
ls_icfdocu = is_icfdocu-icf_docu.
MOVE-CORRESPONDING is_icfservice TO ls_icfserdesc.
cl_icf_tree=>if_icf_tree~insert_node(
EXPORTING
icf_name = is_icfservice-orig_name
icfparguid = lv_parent
icfdocu = ls_icfdocu
doculang = mv_language
icfhandlst = lt_icfhndlist
package = iv_package
application = space
icfserdesc = ls_icfserdesc
icfactive = abap_true
EXCEPTIONS
empty_icf_name = 1
no_new_virtual_host = 2
special_service_error = 3
parent_not_existing = 4
enqueue_error = 5
node_already_existing = 6
empty_docu = 7
doculang_not_installed = 8
security_info_error = 9
user_password_error = 10
password_encryption_error = 11
invalid_url = 12
invalid_otr_concept = 13
formflg401_error = 14
handler_error = 15
transport_error = 16
tadir_error = 17
package_not_found = 18
wrong_application = 19
not_allow_application = 20
no_application = 21
invalid_icfparguid = 22
alt_name_invalid = 23
alternate_name_exist = 24
wrong_icf_name = 25
no_authority = 26
OTHERS = 27 ).
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from insert_node' ).
ENDIF.
ENDMETHOD. "insert_sicf
METHOD change_sicf.
DATA: lt_icfhndlist TYPE icfhndlist,
lt_existing TYPE TABLE OF icfhandler,
ls_icfserdesc TYPE icfserdesc.
FIELD-SYMBOLS: <ls_existing> LIKE LINE OF lt_existing.
lt_icfhndlist = to_icfhndlist( it_icfhandler ).
* Do not add handlers if they already exist, it will make the below
* call to SAP standard code raise an exception
SELECT * FROM icfhandler INTO TABLE lt_existing
WHERE icf_name = is_icfservice-icf_name.
LOOP AT lt_existing ASSIGNING <ls_existing>.
DELETE TABLE lt_icfhndlist FROM <ls_existing>-icfhandler.
ENDLOOP.
MOVE-CORRESPONDING is_icfservice TO ls_icfserdesc.
cl_icf_tree=>if_icf_tree~change_node(
EXPORTING
icf_name = is_icfservice-orig_name
icfparguid = iv_parent
icfdocu = is_icfdocu
doculang = mv_language
icfhandlst = lt_icfhndlist
package = iv_package
application = space
icfserdesc = ls_icfserdesc
icfactive = abap_true
EXCEPTIONS
empty_icf_name = 1
no_new_virtual_host = 2
special_service_error = 3
parent_not_existing = 4
enqueue_error = 5
node_already_existing = 6
empty_docu = 7
doculang_not_installed = 8
security_info_error = 9
user_password_error = 10
password_encryption_error = 11
invalid_url = 12
invalid_otr_concept = 13
formflg401_error = 14
handler_error = 15
transport_error = 16
tadir_error = 17
package_not_found = 18
wrong_application = 19
not_allow_application = 20
no_application = 21
invalid_icfparguid = 22
alt_name_invalid = 23
alternate_name_exist = 24
wrong_icf_name = 25
no_authority = 26
OTHERS = 27 ).
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from change_node' ).
ENDIF.
ENDMETHOD. "change_sicf
METHOD lif_object~delete.
DATA: ls_icfservice TYPE icfservice.
read( IMPORTING es_icfservice = ls_icfservice ).
cl_icf_tree=>if_icf_tree~delete_node(
EXPORTING
icfparguid = ls_icfservice-icfparguid
CHANGING
icf_name = ls_icfservice-icf_name
EXCEPTIONS
no_virtual_host_delete = 1
special_service_error = 2
enqueue_error = 3
node_not_existing = 4
node_has_childs = 5
node_is_aliased = 6
node_not_in_original_system = 7
transport_error = 8
tadir_error = 9
db_error = 10
no_authority = 11
OTHERS = 12 ).
IF sy-subrc <> 0.
lcx_exception=>raise( 'error from delete_node' ).
ENDIF.
ENDMETHOD. "delete
METHOD lif_object~jump.
lcx_exception=>raise( 'todo, SICF, jump' ).
ENDMETHOD. "jump
METHOD lif_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
ENDMETHOD.
ENDCLASS. "lcl_object_sicf IMPLEMENTATION
| 32.062791 | 79 | 0.554435 |
c495d6b30b563588630e72810eb5eded6c603175
| 422 |
abap
|
ABAP
|
src/ui/core/zif_abapgit_gui_services.intf.abap
|
joymike/abapGit
|
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
|
[
"MIT"
] | 1 |
2021-01-21T15:34:26.000Z
|
2021-01-21T15:34:26.000Z
|
src/ui/core/zif_abapgit_gui_services.intf.abap
|
joymike/abapGit
|
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
|
[
"MIT"
] | 1 |
2020-01-05T16:45:32.000Z
|
2020-01-05T16:45:32.000Z
|
src/ui/core/zif_abapgit_gui_services.intf.abap
|
joymike/abapGit
|
e06f22bb22a3c0a3c66eec4da698124c1ec98d65
|
[
"MIT"
] | null | null | null |
INTERFACE zif_abapgit_gui_services
PUBLIC .
METHODS cache_asset
IMPORTING
iv_text TYPE string OPTIONAL
iv_xdata TYPE xstring OPTIONAL
iv_url TYPE w3url OPTIONAL
iv_type TYPE c
iv_subtype TYPE c
RETURNING
VALUE(rv_url) TYPE w3url.
" For future refactoring
" Potentially also: back, go_home, go_page, +some access to page stack
ENDINTERFACE.
| 23.444444 | 72 | 0.670616 |
c49dfd5878c2897915625576065e70a448523ccc
| 4,589 |
abap
|
ABAP
|
src/checks/y_check_db_access_in_ut.clas.abap
|
sb-sap/code-pal-for-abap
|
f8610510ab37d8c03f1552d416541d196bf99e6d
|
[
"Apache-2.0"
] | null | null | null |
src/checks/y_check_db_access_in_ut.clas.abap
|
sb-sap/code-pal-for-abap
|
f8610510ab37d8c03f1552d416541d196bf99e6d
|
[
"Apache-2.0"
] | null | null | null |
src/checks/y_check_db_access_in_ut.clas.abap
|
sb-sap/code-pal-for-abap
|
f8610510ab37d8c03f1552d416541d196bf99e6d
|
[
"Apache-2.0"
] | null | null | null |
CLASS y_check_db_access_in_ut 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.
METHODS is_persistent_object
IMPORTING
!obj_name TYPE string
RETURNING
VALUE(result) TYPE abap_bool .
METHODS check_if_error
IMPORTING
!index TYPE i OPTIONAL
!statement TYPE sstmnt OPTIONAL .
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|.
set_check_message( 'Database access(es) within a Unit-Test should be removed!' ).
ENDMETHOD. "CONSTRUCTOR
METHOD execute_check.
LOOP AT ref_scan_manager->get_structures( ) ASSIGNING FIELD-SYMBOL(<structure>)
WHERE stmnt_type EQ scan_struc_stmnt_type-method.
is_testcode = test_code_detector->is_testcode( <structure> ).
IF is_testcode EQ abap_false.
CONTINUE.
ENDIF.
DATA(index) = <structure>-stmnt_from.
LOOP AT ref_scan_manager->get_statements( ) ASSIGNING FIELD-SYMBOL(<statement>)
FROM <structure>-stmnt_from TO <structure>-stmnt_to.
inspect_tokens( index = index
statement = <statement> ).
index = index + 1.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD inspect_tokens.
DATA(token1) = get_token_abs( statement-from ).
DATA(token2) = get_token_abs( statement-from + 1 ).
DATA(token3) = get_token_abs( statement-from + 2 ).
DATA(has_db_keyword) = xsdbool( token1 = 'COMMIT'
OR token1 = 'ROLLBACK'
OR token1 = 'SELECT'
OR token1 = 'EXEC'
OR token1 = 'ALTER' ).
DATA(is_name_in_token3) = xsdbool( ( token1 = 'INSERT' AND token2 = 'INTO' )
OR ( token1 = 'DELETE' AND token2 = 'FROM' ) ).
DATA(is_name_in_token2) = xsdbool( ( token1 = 'INSERT'
OR token1 = 'UPDATE'
OR token1 = 'MODIFY'
OR token1 = 'DELETE' ) AND token3 = 'FROM' ).
IF has_db_keyword = abap_true
OR ( is_name_in_token3 = abap_true AND is_persistent_object( to_upper( token3 ) ) = abap_true )
OR ( is_name_in_token2 = abap_true AND is_persistent_object( to_upper( token2 ) ) = abap_true ).
check_if_error( index = index
statement = statement ).
ENDIF.
ENDMETHOD.
METHOD is_persistent_object.
TRY.
SELECT SINGLE devclass FROM tadir INTO @DATA(package)
WHERE pgmid = 'R3TR' AND
object = 'TABL' AND
obj_name = @obj_name.
IF sy-subrc NE 0.
result = abap_false.
RETURN.
ENDIF.
DATA(checked_object) = cl_abap_dyn_prg=>check_table_name_str(
val = obj_name
packages = package ).
DATA dynamic_line TYPE REF TO data.
FIELD-SYMBOLS <table_structure> TYPE any.
CREATE DATA dynamic_line TYPE (checked_object).
ASSIGN dynamic_line->* TO <table_structure>.
SELECT SINGLE * FROM (checked_object) INTO <table_structure>.
result = abap_true.
CATCH cx_abap_not_a_table cx_abap_not_in_package cx_sy_dynamic_osql_semantics cx_root.
result = abap_false.
ENDTRY.
ENDMETHOD.
METHOD check_if_error.
DATA check_configuration TYPE y_if_clean_code_manager=>check_configuration.
DATA(key_word) = get_token_abs( statement-from ).
check_configuration = detect_check_configuration( statement ).
IF check_configuration IS INITIAL.
RETURN.
ENDIF.
raise_error( statement_level = statement-level
statement_index = index
statement_from = statement-from
error_priority = check_configuration-prio
parameter_01 = |{ key_word }| ).
ENDMETHOD.
ENDCLASS.
| 31.006757 | 101 | 0.620615 |
c49e3d76bda6dd262b36a89656c3d77f5750926b
| 5,642 |
abap
|
ABAP
|
src/zcl_mqba_pins_ad_mgr.clas.abap
|
MDJoerg/MQBA_PINS
|
93f9378ad3e6f79b94efe31a14a766fb4f900d31
|
[
"MIT"
] | null | null | null |
src/zcl_mqba_pins_ad_mgr.clas.abap
|
MDJoerg/MQBA_PINS
|
93f9378ad3e6f79b94efe31a14a766fb4f900d31
|
[
"MIT"
] | 1 |
2021-06-30T21:02:10.000Z
|
2021-06-30T21:02:10.000Z
|
src/zcl_mqba_pins_ad_mgr.clas.abap
|
MDJoerg/MQBA_PINS
|
93f9378ad3e6f79b94efe31a14a766fb4f900d31
|
[
"MIT"
] | null | null | null |
CLASS zcl_mqba_pins_ad_mgr DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_mqba_pins_ad_mgr .
CLASS-METHODS create
RETURNING
VALUE(rr_mgr) TYPE REF TO zif_mqba_pins_ad_mgr .
PROTECTED SECTION.
DATA mv_adf_type TYPE string .
DATA mv_adf_id TYPE string .
DATA mv_error TYPE string .
DATA mv_result TYPE string .
DATA c_error_invalid TYPE string VALUE 'invalid configuration' ##NO_TEXT.
DATA c_error_exists TYPE string VALUE 'already registered' ##NO_TEXT.
DATA c_error_start TYPE string VALUE 'could not start' ##NO_TEXT.
DATA c_error_stop TYPE string VALUE 'could not stop' ##NO_TEXT.
DATA c_error_not_found TYPE string VALUE 'instance not found' ##NO_TEXT.
DATA c_shm_group TYPE string VALUE 'ZCL_MQBA_PINS_AD_MGR' ##NO_TEXT.
METHODS reset .
METHODS set_guid
IMPORTING
!iv_guid TYPE data OPTIONAL
RETURNING
VALUE(rv_success) TYPE abap_bool .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_MQBA_PINS_AD_MGR IMPLEMENTATION.
METHOD create.
* future use: test double or enhancement concept
rr_mgr = NEW zcl_mqba_pins_ad_mgr( ).
ENDMETHOD.
METHOD reset.
CLEAR: mv_error, mv_result.
ENDMETHOD.
METHOD set_guid.
IF zif_mqba_pins_ad_mgr~is_valid( ) EQ abap_false.
rv_success = abap_false.
RETURN.
ENDIF.
* DATA(lv_memid) = CONV char40( |{ mv_adf_type }:{ mv_adf_id }| ).
*
* IF iv_guid IS NOT INITIAL.
* DATA(lv_guid) = CONV string( iv_guid ).
* EXPORT lv_memid FROM lv_guid TO MEMORY ID lv_memid.
* ELSE.
* FREE MEMORY ID lv_memid.
* ENDIF.
DATA(lr_util) = zcl_mqba_factory=>get_shm_context( ).
lr_util->set_group( mv_adf_type ).
rv_success = lr_util->put(
iv_param = mv_adf_id
iv_value = iv_guid ).
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~get_cmd_result.
rv_result = mv_result.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~get_error.
rv_error = mv_error.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~get_guid.
IF zif_mqba_pins_ad_mgr~is_valid( ) EQ abap_false.
RETURN.
ENDIF.
* DATA(lv_memid) = CONV char40( |{ mv_adf_type }:{ mv_adf_id }| ).
* IMPORT lv_memid TO rv_guid FROM MEMORY ID lv_memid.
DATA(lr_util) = zcl_mqba_factory=>get_shm_context( ).
lr_util->set_group( mv_adf_type ).
rv_guid = lr_util->get( mv_adf_id ).
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~get_id.
rv_id = mv_adf_id.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~get_type.
rv_type = mv_adf_type.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~is_valid.
CHECK mv_adf_id IS NOT INITIAL.
CHECK mv_adf_type IS NOT INITIAL.
rv_valid = abap_true.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~send_cmd.
* ------ check
reset( ).
CHECK zif_mqba_pins_ad_mgr~is_valid( ) EQ abap_true.
* ------ get existing
DATA(lv_guid) = zif_mqba_pins_ad_mgr~get_guid( ).
IF lv_guid IS INITIAL.
mv_error = c_error_not_found.
RETURN.
ENDIF.
TRY.
* ------ create pcp message
DATA(pcp) = cl_ac_message_type_pcp=>create( ).
pcp->set_text( CONV string( iv_cmd ) ).
pcp->set_field(
i_name = 'PAYLOAD'
i_value = CONV string( iv_payload )
).
IF iv_param IS NOT INITIAL.
pcp->set_field(
i_name = 'PARAM'
i_value = CONV string( iv_param )
).
ENDIF.
* ------ send
cl_abap_daemon_client_manager=>attach( i_instance_id = lv_guid )->send( pcp ).
* ------ success
rv_success = abap_true.
* ------ error handling
CATCH cx_abap_daemon_error
cx_ac_message_type_pcp_error
INTO DATA(lx_error).
mv_error = lx_error->get_text( ).
ENDTRY.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~set_id.
mv_adf_id = iv_id.
rr_self = me.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~set_type.
mv_adf_type = iv_type.
rr_self = me.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~start.
* ------ check
reset( ).
CHECK zif_mqba_pins_ad_mgr~is_valid( ) EQ abap_true.
* ------ get existing
DATA(lv_guid) = zif_mqba_pins_ad_mgr~get_guid( ).
IF lv_guid IS NOT INITIAL.
mv_error = c_error_invalid.
RETURN.
ENDIF.
TRY.
* ------ start
cl_abap_daemon_client_manager=>start(
EXPORTING
i_class_name = CONV abap_daemon_class_name( mv_adf_type )
i_name = CONV abap_daemon_name( mv_adf_id )
IMPORTING
e_instance_id = lv_guid ).
IF lv_guid IS INITIAL.
mv_error = c_error_start.
RETURN.
ENDIF.
* ------- save to memory
set_guid( lv_guid ).
rv_success = abap_true.
* ------ error handling
CATCH cx_abap_daemon_error
cx_ac_message_type_pcp_error
INTO DATA(lx_error).
mv_error = lx_error->get_text( ).
ENDTRY.
ENDMETHOD.
METHOD zif_mqba_pins_ad_mgr~stop.
* ------ check
reset( ).
CHECK zif_mqba_pins_ad_mgr~is_valid( ) EQ abap_true.
* ------ get existing
DATA(lv_guid) = zif_mqba_pins_ad_mgr~get_guid( ).
IF lv_guid IS INITIAL.
mv_error = c_error_stop.
RETURN.
ENDIF.
TRY.
* ------ start
cl_abap_daemon_client_manager=>stop(
i_instance_id = lv_guid ).
* ------- save to memory
set_guid( ).
rv_success = abap_true.
* ------ error handling
CATCH cx_abap_daemon_error
cx_ac_message_type_pcp_error
INTO DATA(lx_error).
mv_error = lx_error->get_text( ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
| 22.568 | 86 | 0.644984 |
c4a85d24bb766461310d183cc22159038c9548eb
| 623 |
abap
|
ABAP
|
src/ui/zdbbr_favorite_menu.fugr.saplzdbbr_favorite_menu.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 15 |
2020-02-05T10:38:12.000Z
|
2022-02-11T18:06:17.000Z
|
src/ui/zdbbr_favorite_menu.fugr.saplzdbbr_favorite_menu.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 10 |
2021-01-19T07:45:37.000Z
|
2021-07-15T19:08:54.000Z
|
src/ui/zdbbr_favorite_menu.fugr.saplzdbbr_favorite_menu.abap
|
reichr-dev/abap-db-browser
|
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
|
[
"MIT"
] | 9 |
2020-04-08T19:13:18.000Z
|
2021-10-02T12:53:39.000Z
|
*******************************************************************
* System-defined Include-files. *
*******************************************************************
INCLUDE lzdbbr_favorite_menutop. " Global Data
INCLUDE lzdbbr_favorite_menuuxx. " Function Modules
*******************************************************************
* User-defined Include-files (if necessary). *
*******************************************************************
INCLUDE zuitb_data_cache.
INCLUDE zuitb_screen_util.
INCLUDE lzdbbr_favorite_menus01.
| 44.5 | 67 | 0.354735 |
c4a930b3002740f2cab9316de2e2ce85c140866a
| 12,701 |
abap
|
ABAP
|
src/ui/zcl_abapgit_gui_page_boverview.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 317 |
2020-09-25T19:50:59.000Z
|
2022-03-29T22:59:01.000Z
|
src/ui/zcl_abapgit_gui_page_boverview.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 1,114 |
2020-09-24T07:44:36.000Z
|
2022-03-31T18:01:19.000Z
|
src/ui/zcl_abapgit_gui_page_boverview.clas.abap
|
amit3kumar/ABAP_ALL
|
67822ae13ffda6597a91bb5b39e428c39bc445a3
|
[
"MIT"
] | 167 |
2020-09-24T18:31:37.000Z
|
2022-03-24T10:07:04.000Z
|
CLASS zcl_abapgit_gui_page_boverview DEFINITION
PUBLIC
FINAL
CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING io_repo TYPE REF TO zcl_abapgit_repo_online
RAISING zcx_abapgit_exception,
zif_abapgit_gui_event_handler~on_event REDEFINITION.
PROTECTED SECTION.
METHODS render_content REDEFINITION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_merge,
source TYPE string,
target TYPE string,
END OF ty_merge .
DATA mo_repo TYPE REF TO zcl_abapgit_repo_online .
DATA mv_compress TYPE abap_bool VALUE abap_false ##NO_TEXT.
DATA mt_commits TYPE zif_abapgit_definitions=>ty_commit_tt .
DATA mi_branch_overview TYPE REF TO zif_abapgit_branch_overview .
CONSTANTS:
BEGIN OF c_actions,
uncompress TYPE string VALUE 'uncompress' ##NO_TEXT,
compress TYPE string VALUE 'compress' ##NO_TEXT,
refresh TYPE string VALUE 'refresh' ##NO_TEXT,
merge TYPE string VALUE 'merge' ##NO_TEXT,
END OF c_actions .
METHODS refresh
RAISING
zcx_abapgit_exception .
METHODS body
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS form_select
IMPORTING
!iv_name TYPE string
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html .
METHODS render_merge
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS build_menu
RETURNING
VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar .
METHODS escape_branch
IMPORTING
!iv_string TYPE string
RETURNING
VALUE(rv_string) TYPE string .
METHODS escape_message
IMPORTING
!iv_string TYPE string
RETURNING
VALUE(rv_string) TYPE string .
METHODS render_commit_popups
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_BOVERVIEW IMPLEMENTATION.
METHOD body.
DATA: lv_tag TYPE string,
lv_branch_display_name TYPE string.
FIELD-SYMBOLS: <ls_commit> LIKE LINE OF mt_commits,
<ls_create> LIKE LINE OF <ls_commit>-create.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top(
io_repo = mo_repo
iv_show_package = abap_false
iv_show_branch = abap_false ) ).
ri_html->add( '<br>' ).
ri_html->add( '<br>' ).
ri_html->add( render_merge( ) ).
ri_html->add( '<br>' ).
ri_html->add( build_menu( )->render( ) ).
"CSS gitGraph-scrollWrapper, gitGraph-HTopScroller and gitGraph-Wrapper
" - Used to manage the Horizonal Scroll bar on top of gitGraph Element
ri_html->add( '<div class="gitGraph-scrollWrapper" onscroll="GitGraphScroller()">' ).
"see http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element
ri_html->add( '<div class="gitGraph-HTopScroller"></div>' ).
ri_html->add( '</div>' ).
ri_html->add( '<div class="gitGraph-Wrapper">' ).
ri_html->add( '<canvas id="gitGraph"></canvas>' ).
ri_html->add( '</div>' ).
ri_html->add( '<script type="text/javascript" src="https://cdnjs.' &&
'cloudflare.com/ajax/libs/gitgraph.js/1.14.0/gitgraph.min.js">' &&
'</script>' ).
ri_html->add( '<script type="text/javascript">' ).
ri_html->add( 'var myTemplateConfig = {' ).
ri_html->add( 'colors: [ "#979797", "#008fb5", "#f1c109", "'
&& '#095256", "#087F8C", "#5AAA95", "#86A873", "#BB9F06" ],' ).
ri_html->add( 'branch: {' ).
ri_html->add( ' lineWidth: 8,' ).
ri_html->add( ' spacingX: 50' ).
ri_html->add( '},' ).
ri_html->add( 'commit: {' ).
ri_html->add( ' spacingY: -40,' ).
ri_html->add( ' dot: { size: 12 },' ).
ri_html->add( ' message: { font: "normal 14pt Arial" }' ).
ri_html->add( '}' ).
ri_html->add( '};' ).
ri_html->add( 'var gitgraph = new GitGraph({' ).
ri_html->add( ' template: myTemplateConfig,' ).
ri_html->add( ' orientation: "vertical-reverse"' ).
ri_html->add( '});' ).
ri_html->add( 'var gBranchOveriew = new BranchOverview();' ).
LOOP AT mt_commits ASSIGNING <ls_commit>.
IF sy-tabix = 1.
" assumption: all branches are created from master, todo
ri_html->add( |var {
escape_branch( <ls_commit>-branch ) } = gitgraph.branch("{
<ls_commit>-branch }");| ).
ENDIF.
IF <ls_commit>-branch IS INITIAL.
CONTINUE. " we skip orphaned commits
ENDIF.
IF <ls_commit>-compressed = abap_true.
ri_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{
escape_message( <ls_commit>-message )
}", dotColor: "black", dotSize: 15, messageHashDisplay: false, messageAuthorDisplay: false\});| ).
ELSEIF <ls_commit>-merge IS INITIAL.
" gitgraph doesn't support multiple tags per commit yet.
" Therefore we concatenate them.
" https://github.com/nicoespeon/gitgraph.js/issues/143
lv_tag = concat_lines_of( table = <ls_commit>-tags
sep = ` | ` ).
ri_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{
escape_message( <ls_commit>-message ) }", long: "{ escape_message( concat_lines_of( table = <ls_commit>-body
sep = ` ` ) )
}", author: "{
<ls_commit>-author }", sha1: "{
<ls_commit>-sha1(7) }", tag: "{ lv_tag
}", onClick:gBranchOveriew.onCommitClick.bind(gBranchOveriew)\});| ).
ELSE.
ri_html->add( |{ escape_branch( <ls_commit>-merge ) }.merge({
escape_branch( <ls_commit>-branch ) }, \{message: "{
escape_message( <ls_commit>-message ) }", long: "{ escape_message( concat_lines_of( table = <ls_commit>-body
sep = ` ` ) )
}", author: "{ <ls_commit>-author }", sha1: "{
<ls_commit>-sha1(7) }", onClick:gBranchOveriew.onCommitClick.bind(gBranchOveriew)\});| ).
ENDIF.
LOOP AT <ls_commit>-create ASSIGNING <ls_create>.
IF <ls_create>-name CS zcl_abapgit_branch_overview=>c_deleted_branch_name_prefix.
lv_branch_display_name = ''.
ELSE.
lv_branch_display_name = <ls_create>-name.
ENDIF.
ri_html->add( |var { escape_branch( <ls_create>-name ) } = {
escape_branch( <ls_create>-parent ) }.branch("{
lv_branch_display_name }");| ).
ENDLOOP.
ENDLOOP.
ri_html->add(
|gitGraph.addEventListener( "commit:mouseover", gBranchOveriew.showCommit.bind(gBranchOveriew) );| ).
ri_html->add(
|gitGraph.addEventListener( "commit:mouseout", gBranchOveriew.hideCommit.bind(gBranchOveriew) );| ).
ri_html->add( '</script>' ).
ri_html->add( '<script>' ).
ri_html->add( 'setGitGraphScroller();' ).
ri_html->add( '</script>' ).
ri_html->add( render_commit_popups( ) ).
ENDMETHOD.
METHOD build_menu.
CREATE OBJECT ro_menu.
IF mv_compress = abap_true.
ro_menu->add(
iv_txt = 'Uncompress Graph'
iv_act = c_actions-uncompress ).
ELSE.
ro_menu->add(
iv_txt = 'Compress Graph'
iv_act = c_actions-compress ).
ENDIF.
ro_menu->add( iv_txt = 'Refresh'
iv_act = c_actions-refresh ).
ENDMETHOD.
METHOD constructor.
super->constructor( ).
ms_control-page_title = 'Branch Overview'.
mo_repo = io_repo.
refresh( ).
ENDMETHOD.
METHOD escape_branch.
rv_string = iv_string.
TRANSLATE rv_string USING '-_._#_'.
rv_string = |branch_{ rv_string }|.
ENDMETHOD.
METHOD escape_message.
rv_string = iv_string.
REPLACE ALL OCCURRENCES OF '\' IN rv_string WITH '\\'.
REPLACE ALL OCCURRENCES OF '"' IN rv_string WITH '\"'.
ENDMETHOD.
METHOD form_select.
DATA: lv_name TYPE string,
lt_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt.
FIELD-SYMBOLS: <ls_branch> LIKE LINE OF lt_branches.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
lt_branches = mi_branch_overview->get_branches( ).
ri_html->add( |<select name="{ iv_name }">| ).
LOOP AT lt_branches ASSIGNING <ls_branch>.
lv_name = <ls_branch>-name+11.
ri_html->add( |<option value="{ lv_name }">{ lv_name }</option>| ).
ENDLOOP.
ri_html->add( '</select>' ).
ENDMETHOD.
METHOD refresh.
mi_branch_overview = zcl_abapgit_factory=>get_branch_overview( mo_repo ).
mt_commits = mi_branch_overview->get_commits( ).
IF mv_compress = abap_true.
mt_commits = mi_branch_overview->compress( mt_commits ).
ENDIF.
ENDMETHOD.
METHOD render_commit_popups.
DATA: lv_time TYPE c LENGTH 10,
lv_date TYPE sy-datum,
lv_content TYPE string.
FIELD-SYMBOLS: <ls_commit> LIKE LINE OF mt_commits.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
LOOP AT mt_commits ASSIGNING <ls_commit>.
CLEAR: lv_time, lv_date.
PERFORM p6_to_date_time_tz IN PROGRAM rstr0400
USING <ls_commit>-time
lv_time
lv_date.
lv_content = |<table class="commit">|
&& | <tr>|
&& | <td class="title">Author</td>|
&& | <td>{ <ls_commit>-author }</td>|
&& | </tr>|
&& | <tr>|
&& | <td class="title">SHA1</td>|
&& | <td>{ <ls_commit>-sha1 }</td>|
&& | </tr>|
&& | <tr>|
&& | <td class="title">Date/Time</td>|
&& | <td>{ lv_date DATE = USER }</td>|
&& | </tr>|
&& | <tr>|
&& | <td class="title">Message</td>|
&& | <td>{ <ls_commit>-message }</td>|
&& | </tr>|
&& | <tr>|.
IF <ls_commit>-body IS NOT INITIAL.
lv_content = lv_content
&& |<td class="title">Body</td>|
&& |<td>{ concat_lines_of( table = <ls_commit>-body
sep = |<br/>| ) }</td>|.
ENDIF.
lv_content = lv_content
&& | </tr>|
&& |</table>|.
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_commit_popup(
iv_id = <ls_commit>-sha1(7)
iv_content = lv_content ) ).
ENDLOOP.
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<div id="toc">' ).
ri_html->add( body( ) ).
ri_html->add( '</div>' ).
ENDMETHOD.
METHOD render_merge.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<form id="commit_form" method="post" action="sapevent:merge">' ).
ri_html->add( 'Merge' ).
ri_html->add( form_select( 'source' ) ).
ri_html->add( 'into' ).
ri_html->add( form_select( 'target' ) ).
ri_html->add( '<input type="submit" value="Submit">' ).
ri_html->add( '</form>' ).
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
DATA: ls_merge TYPE ty_merge,
lo_merge TYPE REF TO zcl_abapgit_gui_page_merge.
CASE ii_event->mv_action.
WHEN c_actions-refresh.
refresh( ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_actions-uncompress.
mv_compress = abap_false.
refresh( ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_actions-compress.
mv_compress = abap_true.
refresh( ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_actions-merge.
ls_merge-source = ii_event->form_data( )->get( 'source' ).
ls_merge-target = ii_event->form_data( )->get( 'target' ).
CREATE OBJECT lo_merge
EXPORTING
io_repo = mo_repo
iv_source = ls_merge-source
iv_target = ls_merge-target.
rs_handled-page = lo_merge.
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
WHEN OTHERS.
rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ).
ENDCASE.
ENDMETHOD.
ENDCLASS.
| 30.82767 | 118 | 0.58704 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.