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
bd32ff19db95893977e5ace2bebfb17042114501
3,484
abap
ABAP
src/ui/zcl_abapgit_gui_view_tutorial.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_view_tutorial.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_view_tutorial.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_view_tutorial DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. INTERFACES zif_abapgit_gui_page. ALIASES render FOR zif_abapgit_gui_page~render. PRIVATE SECTION. METHODS render_content RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_VIEW_TUTORIAL IMPLEMENTATION. METHOD render_content. CREATE OBJECT ro_html. ro_html->add( '<h1>Tutorial</h1>' ). ro_html->add( '<hr>' ). ro_html->add( '<h2>Adding and cloning repos</h2>' ). ro_html->add( '<p><ul>' ). ro_html->add( `<li>To clone a remote repo (e.g. from github) click ` ). ro_html->add_a( iv_txt = '+ Clone' iv_act = zif_abapgit_definitions=>gc_action-repo_clone ). ro_html->add( ' from the top menu. This will copy a remote repo to your system.</li>' ). ro_html->add( `<li>To add a local package as a repo click ` ). ro_html->add_a( iv_txt = '+ Offline' iv_act = zif_abapgit_definitions=>gc_action-repo_newoffline ). ro_html->add( ' from the top menu. This will track a repo which already exist in' ). ro_html->add( ' the system with abapGit. You''ll be able to attach it to remote origin' ). ro_html->add( ' or just serialize as a zip file</li>' ). ro_html->add( `<li>Go ` ). ro_html->add_a( iv_txt = 'Explore' iv_act = zif_abapgit_definitions=>gc_action-go_explore ). ro_html->add( ' to find projects using abapGit</li>' ). ro_html->add( '</ul></p>' ). ro_html->add( '<h2>Repository list and favorites</h2>' ). ro_html->add( '<p><ul>' ). ro_html->add( |<li>To choose a repo press { zcl_abapgit_html=>icon( 'three-bars/blue' ) } at the favorite bar.</li>| ). ro_html->add( |<li>To favorite a repo click { zcl_abapgit_html=>icon( 'star/darkgrey' ) } icon at repo toolbar.</li>| ). ro_html->add( '</ul></p>' ). ro_html->add( '<h2>abapGit related repositories</h2>' ). ro_html->add( '<p><ul>' ). ro_html->add( '<li>' ). IF zcl_abapgit_services_abapgit=>is_installed( ) = abap_true. ro_html->add( 'abapGit installed in package&nbsp;' ). ro_html->add( zcl_abapgit_services_abapgit=>c_package_abapgit ). ELSE. ro_html->add_a( iv_txt = 'install abapGit repo' iv_act = zif_abapgit_definitions=>gc_action-abapgit_install ). ro_html->add( ' - To keep abapGit up-to-date (or also to contribute) you need to' ). ro_html->add( 'install it as a repository.' ). ENDIF. ro_html->add( '</li>' ). ro_html->add( '<li>' ). IF zcl_abapgit_services_abapgit=>is_installed_pi( ) = abap_true. ro_html->add( 'abapGit plugins installed in package&nbsp;' ). ro_html->add( zcl_abapgit_services_abapgit=>c_package_plugins ). ELSE. ro_html->add_a( iv_txt = 'install abapGit plugins' iv_act = zif_abapgit_definitions=>gc_action-abapgit_install_pi ). ro_html->add( ' - you can also install plugins to extend supported object types' ). ENDIF. ro_html->add( '</li>' ). ro_html->add( '</ul></p>' ). ENDMETHOD. " render_content. METHOD zif_abapgit_gui_page~on_event. ev_state = zif_abapgit_definitions=>gc_event_state-not_handled. ENDMETHOD. " lif_gui_page~on_event. METHOD zif_abapgit_gui_page~render. CREATE OBJECT ro_html. ro_html->add( '<div class="tutorial">' ). ro_html->add( render_content( ) ). ro_html->add( '</div>' ). ENDMETHOD. "lif_gui_page~render ENDCLASS.
37.06383
116
0.659874
bd358436de8a28fced55408202fb7028e779d879
8,250
abap
ABAP
src/ui/zcl_abapgit_gui_page_bkg.clas.abap
qinhanguyun/abapGit
272925fff7625a65a22825b546790948769f1556
[ "MIT" ]
1
2019-05-27T18:50:14.000Z
2019-05-27T18:50:14.000Z
src/ui/zcl_abapgit_gui_page_bkg.clas.abap
qinhanguyun/abapGit
272925fff7625a65a22825b546790948769f1556
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_bkg.clas.abap
qinhanguyun/abapGit
272925fff7625a65a22825b546790948769f1556
[ "MIT" ]
1
2019-12-31T11:44:14.000Z
2019-12-31T11:44:14.000Z
CLASS zcl_abapgit_gui_page_bkg DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_page FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES: zif_abapgit_gui_page_hotkey. METHODS constructor IMPORTING iv_key TYPE zif_abapgit_persistence=>ty_repo-key . METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION . PROTECTED SECTION. METHODS read_persist IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo_online RETURNING VALUE(rs_persist) TYPE zcl_abapgit_persist_background=>ty_background RAISING zcx_abapgit_exception . METHODS render_methods IMPORTING !is_per TYPE zcl_abapgit_persist_background=>ty_background RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html . METHODS render_settings IMPORTING !is_per TYPE zcl_abapgit_persist_background=>ty_background RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html . METHODS build_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . CLASS-METHODS update IMPORTING !is_bg_task TYPE zcl_abapgit_persist_background=>ty_background RAISING zcx_abapgit_exception . METHODS render RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception . METHODS decode IMPORTING !iv_getdata TYPE clike RETURNING VALUE(rs_fields) TYPE zcl_abapgit_persist_background=>ty_background . METHODS render_content REDEFINITION . PRIVATE SECTION. DATA mv_key TYPE zif_abapgit_persistence=>ty_repo-key . ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_BKG IMPLEMENTATION. METHOD build_menu. CREATE OBJECT ro_menu. ro_menu->add( iv_txt = 'Run background logic' iv_act = zif_abapgit_definitions=>c_action-go_background_run ) ##NO_TEXT. ENDMETHOD. METHOD constructor. super->constructor( ). mv_key = iv_key. ms_control-page_title = 'BACKGROUND'. ms_control-page_menu = build_menu( ). ENDMETHOD. METHOD decode. DATA: lt_fields TYPE tihttpnvp. FIELD-SYMBOLS: <ls_setting> LIKE LINE OF rs_fields-settings. rs_fields-key = mv_key. lt_fields = zcl_abapgit_html_action_utils=>parse_fields_upper_case_name( iv_getdata ). zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = 'METHOD' it_field = lt_fields CHANGING cg_field = rs_fields ). IF rs_fields-method IS INITIAL. RETURN. ENDIF. zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = 'USERNAME' it_field = lt_fields CHANGING cg_field = rs_fields ). zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = 'PASSWORD' it_field = lt_fields CHANGING cg_field = rs_fields ). CALL METHOD (rs_fields-method)=>zif_abapgit_background~get_settings CHANGING ct_settings = rs_fields-settings. LOOP AT rs_fields-settings ASSIGNING <ls_setting>. zcl_abapgit_html_action_utils=>get_field( EXPORTING iv_name = <ls_setting>-key it_field = lt_fields CHANGING cg_field = <ls_setting>-value ). ENDLOOP. ASSERT NOT rs_fields IS INITIAL. ENDMETHOD. METHOD read_persist. DATA: lo_per TYPE REF TO zcl_abapgit_persist_background, lt_per TYPE zcl_abapgit_persist_background=>tt_background. CREATE OBJECT lo_per. lt_per = lo_per->list( ). READ TABLE lt_per INTO rs_persist WITH KEY key = io_repo->get_key( ). IF sy-subrc <> 0. CLEAR rs_persist. ENDIF. ENDMETHOD. METHOD render. DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online, ls_per TYPE zcl_abapgit_persist_background=>ty_background. lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( mv_key ). ls_per = read_persist( lo_repo ). CREATE OBJECT ro_html. ro_html->add( '<div id="toc">' ). ro_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( lo_repo ) ). ro_html->add( '<br>' ). ro_html->add( render_methods( ls_per ) ). ro_html->add( '<u>HTTP Authentication, optional</u><br>' ) ##NO_TEXT. ro_html->add( '(password will be saved in clear text)<br>' ) ##NO_TEXT. ro_html->add( '<table>' ). ro_html->add( '<tr>' ). ro_html->add( '<td>Username:</td>' ). ro_html->add( '<td><input type="text" name="username" value="' && ls_per-username && '"></td>' ). ro_html->add( '</tr>' ). ro_html->add( '<tr>' ). ro_html->add( '<td>Password:</td>' ). ro_html->add( '<td><input type="text" name="password" value="' && ls_per-password && '"></td>' ). ro_html->add( '</tr>' ). ro_html->add( '</table>' ). ro_html->add( '<br>' ). ro_html->add( render_settings( ls_per ) ). ro_html->add( '<br>' ). ro_html->add( '<input type="submit" value="Save">' ). ro_html->add( '</form>' ). ro_html->add( '<br>' ). ro_html->add( '</div>' ). ENDMETHOD. METHOD render_content. CREATE OBJECT ro_html. ro_html->add( render( ) ). ENDMETHOD. METHOD render_methods. DATA: lt_methods TYPE zcl_abapgit_background=>ty_methods_tt, ls_method LIKE LINE OF lt_methods, lv_checked TYPE string. CREATE OBJECT ro_html. lt_methods = zcl_abapgit_background=>list_methods( ). ro_html->add( '<u>Method</u><br>' ) ##NO_TEXT. ro_html->add( |<form method="get" action="sapevent:{ zif_abapgit_definitions=>c_action-bg_update }">| ). IF is_per-method IS INITIAL. lv_checked = ' checked' ##NO_TEXT. ENDIF. ro_html->add( '<input type="radio" name="method" value=""' && lv_checked && '>Do nothing<br>' ) ##NO_TEXT. LOOP AT lt_methods INTO ls_method. CLEAR lv_checked. IF is_per-method = ls_method-class. lv_checked = ' checked' ##NO_TEXT. ENDIF. ro_html->add( '<input type="radio" name="method" value="' && ls_method-class && '"' && lv_checked && '>' && ls_method-description && '<br>' ) ##NO_TEXT. ENDLOOP. ro_html->add( '<br>' ). ENDMETHOD. METHOD render_settings. DATA: lt_settings LIKE is_per-settings, ls_setting LIKE LINE OF lt_settings. CREATE OBJECT ro_html. IF is_per-method IS INITIAL. RETURN. ENDIF. lt_settings = is_per-settings. * skip invalid values, from old background logic IF is_per-method <> 'push' AND is_per-method <> 'pull' AND is_per-method <> 'nothing'. CALL METHOD (is_per-method)=>zif_abapgit_background~get_settings CHANGING ct_settings = lt_settings. ENDIF. IF lines( lt_settings ) = 0. RETURN. ENDIF. ro_html->add( '<table>' ). LOOP AT lt_settings INTO ls_setting. ro_html->add( '<tr>' ). ro_html->add( '<td>' && ls_setting-key && ':</td>' ). ro_html->add( '<td><input type="text" name="' && ls_setting-key && '" value="' && ls_setting-value && '"></td>' ). ro_html->add( '</tr>' ). ENDLOOP. ro_html->add( '</table>' ). ENDMETHOD. METHOD update. DATA lo_persistence TYPE REF TO zcl_abapgit_persist_background. CREATE OBJECT lo_persistence. IF is_bg_task-method IS INITIAL. lo_persistence->delete( is_bg_task-key ). ELSE. lo_persistence->modify( is_bg_task ). ENDIF. MESSAGE 'Saved' TYPE 'S' ##NO_TEXT. COMMIT WORK. ENDMETHOD. METHOD zif_abapgit_gui_page_hotkey~get_hotkey_actions. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. CASE iv_action. WHEN zif_abapgit_definitions=>c_action-bg_update. update( decode( iv_getdata ) ). ev_state = zcl_abapgit_gui=>c_event_state-re_render. WHEN OTHERS. super->zif_abapgit_gui_event_handler~on_event( EXPORTING iv_action = iv_action iv_prev_page = iv_prev_page iv_getdata = iv_getdata it_postdata = it_postdata IMPORTING ei_page = ei_page ev_state = ev_state ). ENDCASE. ENDMETHOD. ENDCLASS.
24.553571
108
0.640848
bd3876989445ad305ea050e13f0cc55ee1371cdf
11,596
abap
ABAP
src/zcl_mockup_loader_utils.clas.abap
odjhey/mockup_loader
ac9196004d3a8bfc7aaadc03d563ee22c4530739
[ "MIT" ]
null
null
null
src/zcl_mockup_loader_utils.clas.abap
odjhey/mockup_loader
ac9196004d3a8bfc7aaadc03d563ee22c4530739
[ "MIT" ]
null
null
null
src/zcl_mockup_loader_utils.clas.abap
odjhey/mockup_loader
ac9196004d3a8bfc7aaadc03d563ee22c4530739
[ "MIT" ]
null
null
null
class ZCL_MOCKUP_LOADER_UTILS definition public final create public . public section. types: begin of ty_filter, name type string, valref type ref to data, type type char1, end of ty_filter . types: tt_filter type standard table of ty_filter with key name . types: begin of ty_where, name type string, range type ref to data, end of ty_where . types: tt_where type standard table of ty_where with key name . type-pools ABAP . class-data G_TY_WHERE_ABS_NAME type ABAP_ABSTYPENAME read-only . class-data G_RANGE_KEY type ABAP_KEYDESCR_TAB read-only . class-data G_TY_FILTER_ABS_NAME type ABAP_ABSTYPENAME read-only . class-methods FILTER_TABLE importing !I_FILTER type TT_FILTER optional !I_TAB type ANY TABLE !I_WHERE type ANY optional exporting !E_CONTAINER type ANY raising ZCX_MOCKUP_LOADER_ERROR . class-methods BUILD_FILTER importing !I_WHERE type ANY !I_SINGLE_VALUE type ANY optional returning value(R_FILTER) type TT_FILTER raising ZCX_MOCKUP_LOADER_ERROR . class-methods DOES_LINE_FIT_FILTER importing !I_LINE type ANY !I_FILTER type TT_FILTER returning value(R_YESNO) type ABAP_BOOL . class-methods CLASS_CONSTRUCTOR . protected section. private section. class-methods CONV_TT_WHERE_TO_FILTER importing !I_WHERE type ANY returning value(R_FILTER) type TT_FILTER raising ZCX_MOCKUP_LOADER_ERROR . class-methods CONV_NC_STRUC_TO_FILTER importing !ID_STRUC type ref to CL_ABAP_STRUCTDESCR !I_WHERE type ANY returning value(RT_FILTER) type TT_FILTER raising ZCX_MOCKUP_LOADER_ERROR . class-methods CONV_SINGLE_VAL_TO_FILTER importing !I_WHERE type CSEQUENCE !I_VALUE type ANY returning value(R_FILTER) type TY_FILTER raising ZCX_MOCKUP_LOADER_ERROR . class-methods CONV_STRING_TO_FILTER importing !I_WHERE type CLIKE returning value(R_FILTER) type TY_FILTER raising ZCX_MOCKUP_LOADER_ERROR . class-methods CONV_WHERE_TO_FILTER importing !I_WHERE type TY_WHERE returning value(R_FILTER) type TY_FILTER raising ZCX_MOCKUP_LOADER_ERROR CX_SY_MOVE_CAST_ERROR . ENDCLASS. CLASS ZCL_MOCKUP_LOADER_UTILS IMPLEMENTATION. method BUILD_FILTER. data dy_type type ref to cl_abap_typedescr. data dy_struc type ref to cl_abap_structdescr. data dy_table type ref to cl_abap_tabledescr. data l_filter type ty_filter. data lt_filter type tt_filter. if i_where is initial. return. endif. dy_type = cl_abap_typedescr=>describe_by_data( i_where ). if i_single_value is supplied and not boolc( dy_type->type_kind ca 'Cg' ) = abap_true. " Char or string zcx_mockup_loader_error=>raise( msg = 'I_WHERE must be a parameter name for supplied I_SINGLE_VALUE' code = 'PN' ). "#EC NOTEXT endif. try. case dy_type->type_kind. when cl_abap_typedescr=>typekind_table. " Table -> expect tt_where dy_table ?= dy_type. dy_struc ?= dy_table->get_table_line_type( ). if dy_struc->absolute_name = g_ty_filter_abs_name. r_filter = i_where. return. endif. if dy_struc->absolute_name <> g_ty_where_abs_name. zcx_mockup_loader_error=>raise( msg = |I_WHERE table must be of TT_WHERE type| code = 'WT' ). "#EC NOTEXT endif. lt_filter = conv_tt_where_to_filter( i_where ). when cl_abap_typedescr=>typekind_struct2. " structure can be ty_where or "named components" dy_struc ?= dy_type. if dy_struc->absolute_name = g_ty_where_abs_name. " ty_where l_filter = conv_where_to_filter( i_where ). append l_filter to lt_filter. else. " structure with named components per range lt_filter = conv_nc_struc_to_filter( i_where = i_where id_struc = dy_struc ). endif. when cl_abap_typedescr=>typekind_char or cl_abap_typedescr=>typekind_string. if i_single_value is supplied. l_filter = conv_single_val_to_filter( i_where = i_where i_value = i_single_value ). else. l_filter = conv_string_to_filter( i_where ). endif. append l_filter to lt_filter. when others. zcx_mockup_loader_error=>raise( msg = |Unsupported type { dy_type->absolute_name } of I_WHERE| code = 'UT' ). "#EC NOTEXT endcase. catch cx_sy_move_cast_error. zcx_mockup_loader_error=>raise( msg = |CX_SY_MOVE_CAST_ERROR @BUILD_FILTER()| code = 'CE' ). "#EC NOTEXT endtry. r_filter = lt_filter. endmethod. method class_constructor. data l_dummy_where type ty_where. data l_dummy_filter type ty_filter. data dy_tab type ref to cl_abap_tabledescr. data dy_type type ref to cl_abap_typedescr. data l_dummy_range type range of char1. dy_type = cl_abap_typedescr=>describe_by_data( l_dummy_where ). g_ty_where_abs_name = dy_type->absolute_name. dy_type = cl_abap_typedescr=>describe_by_data( l_dummy_filter ). g_ty_filter_abs_name = dy_type->absolute_name. dy_tab ?= cl_abap_typedescr=>describe_by_data( l_dummy_range ). g_range_key = dy_tab->key. endmethod. method CONV_NC_STRUC_TO_FILTER. data dy_table type ref to cl_abap_tabledescr. data l_filter type ty_filter. data lt_components type cl_abap_structdescr=>component_table. data l_component like line of lt_components. field-symbols <tab> type any table. lt_components = id_struc->get_components( ). loop at lt_components into l_component. if l_component-type->kind <> cl_abap_typedescr=>kind_table. zcx_mockup_loader_error=>raise( msg = |I_WHERE must be a structure of ranges or TY_WHERE| code = 'WS' ). "#EC NOTEXT endif. dy_table ?= l_component-type. if dy_table->key ne g_range_key. " Not range-like structure ? zcx_mockup_loader_error=>raise( msg = |I_WHERE must be a structure of ranges or TY_WHERE| code = 'WS' ). "#EC NOTEXT endif. l_filter-name = l_component-name. l_filter-type = 'R'. " Range assign component l_component-name of structure i_where to <tab>. get reference of <tab> into l_filter-valref. append l_filter to rt_filter. endloop. endmethod. method conv_single_val_to_filter. data dy_data type ref to cl_abap_datadescr. dy_data ?= cl_abap_typedescr=>describe_by_data( i_value ). if dy_data->kind <> cl_abap_typedescr=>kind_elem. zcx_mockup_loader_error=>raise( msg = 'I_VALUE must be of elementary type' code = 'ET' ). "#EC NOTEXT endif. field-symbols <value> type any. create data r_filter-valref type handle dy_data. assign r_filter-valref->* to <value>. r_filter-type = 'V'. " Any value r_filter-name = to_upper( i_where ). <value> = i_value. endmethod. method CONV_STRING_TO_FILTER. field-symbols <value> type string. r_filter-type = 'S'. " String create data r_filter-valref type string. assign r_filter-valref->* to <value>. split i_where at '=' into r_filter-name <value>. shift r_filter-name right deleting trailing space. shift r_filter-name left deleting leading space. shift <value> right deleting trailing space. shift <value> left deleting leading space. translate r_filter-name to upper case. if r_filter-name is initial or <value> is initial. zcx_mockup_loader_error=>raise( msg = |Incorrect I_WHERE string pattern| code = 'SP' ). "#EC NOTEXT endif. endmethod. method CONV_TT_WHERE_TO_FILTER. data l_filter type ty_filter. field-symbols <tab> type any table. field-symbols <where> type ty_where. assign i_where to <tab>. loop at <tab> assigning <where>. l_filter = conv_where_to_filter( <where> ). append l_filter to r_filter. endloop. endmethod. method conv_where_to_filter. data dy_table type ref to cl_abap_tabledescr. r_filter-name = i_where-name. r_filter-valref = i_where-range. r_filter-type = 'R'. " Range dy_table ?= cl_abap_typedescr=>describe_by_data_ref( r_filter-valref ). " Assume table, cast_error otherwise if dy_table->key ne g_range_key. " Not range ? zcx_mockup_loader_error=>raise( msg = |I_WHERE-RANGE must be a range table| code = 'RT' ). "#EC NOTEXT endif. endmethod. method DOES_LINE_FIT_FILTER. data l_filter type ty_filter. field-symbols <field> type any. field-symbols <range> type any table. field-symbols <value> type any. r_yesno = abap_true. loop at i_filter into l_filter. assign component l_filter-name of structure i_line to <field>. check <field> is assigned. " Just skip irrelevant ranges if l_filter-type = 'R'. " Range assign l_filter-valref->* to <range>. if not <field> in <range>. r_yesno = abap_false. endif. else. " String and value assign l_filter-valref->* to <value>. if not <field> = <value>. " cx_sy_conversion_error does not catch that :( r_yesno = abap_false. endif. endif. if r_yesno = abap_false. return. endif. unassign: <field>, <range>, <value>. endloop. endmethod. method FILTER_TABLE. data dy_type2 type ref to cl_abap_typedescr. data dy_struc type ref to cl_abap_structdescr. data dy_stru2 type ref to cl_abap_structdescr. data dy_table type ref to cl_abap_tabledescr. data dy_tabl2 type ref to cl_abap_tabledescr. field-symbols <container_tab> type any table. if boolc( i_filter is supplied ) = boolc( i_where is supplied ). " XOR zcx_mockup_loader_error=>raise( msg = 'i_where or i_filter must be supplied' code = 'OO' ). "#EC NOTEXT endif. data lt_filter like i_filter. if i_where is supplied. lt_filter = build_filter( i_where = i_where ). else. " i_filter is supplied lt_filter = i_filter. endif. clear e_container. " Check proper type dy_type2 = cl_abap_typedescr=>describe_by_data( e_container ). case dy_type2->kind. when cl_abap_typedescr=>kind_table. " Table dy_tabl2 ?= dy_type2. dy_stru2 ?= dy_tabl2->get_table_line_type( ). assign e_container to <container_tab>. when cl_abap_typedescr=>kind_struct. " Structure dy_stru2 ?= dy_type2. when others. " Not a table or structure ? zcx_mockup_loader_error=>raise( msg = 'Table or structure containers only' code = 'WT' ). "#EC NOTEXT endcase. " Check tables have same line time dy_table ?= cl_abap_typedescr=>describe_by_data( i_tab ). dy_struc ?= dy_table->get_table_line_type( ). if dy_struc->absolute_name <> dy_stru2->absolute_name. zcx_mockup_loader_error=>raise( msg = 'Src and dst line types are not similar' code = 'LT' ). "#EC NOTEXT endif. " create line container data ld_record type ref to data. field-symbols <record> type any. create data ld_record type handle dy_struc. assign ld_record->* to <record>. data lv_fit type abap_bool. loop at i_tab assigning <record>. lv_fit = does_line_fit_filter( i_line = <record> i_filter = lt_filter ). if lv_fit = abap_true. if dy_type2->kind = cl_abap_typedescr=>kind_struct. " Structure requested e_container = <record>. exit. " Only first line goes to structure and then exits else. " Table insert <record> into table <container_tab>. endif. endif. endloop. endmethod. ENDCLASS.
30.041451
131
0.69593
bd3fbf2675b8c8cb1af7a9f2175d915c63de1dc5
353
abap
ABAP
src/zwfe_tbl.fugr.tableproc_zwfe_tbl.abap
irodrigob/ABAP_Workflow-Engine
c4e7249df0d7436f8ea0caba15ac71b44ebc769e
[ "Apache-2.0" ]
1
2021-12-17T06:33:10.000Z
2021-12-17T06:33:10.000Z
src/zwfe_tbl.fugr.tableproc_zwfe_tbl.abap
irodrigob/ABAP_Workflow-Engine
c4e7249df0d7436f8ea0caba15ac71b44ebc769e
[ "Apache-2.0" ]
null
null
null
src/zwfe_tbl.fugr.tableproc_zwfe_tbl.abap
irodrigob/ABAP_Workflow-Engine
c4e7249df0d7436f8ea0caba15ac71b44ebc769e
[ "Apache-2.0" ]
null
null
null
*---------------------------------------------------------------------* * program for: TABLEPROC_ZWFE_TBL * generation date: 06.06.2021 at 18:22:56 * view maintenance generator version: #001407# *---------------------------------------------------------------------* FUNCTION TABLEPROC_ZWFE_TBL . PERFORM TABLEPROC. ENDFUNCTION.
32.090909
71
0.419263
bd40692a86f9d763b49dda1f32b71a6227230871
20,066
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_tools.clas.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_tools.clas.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_mia/zcl_gtt_mia_tools.clas.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
CLASS zcl_gtt_mia_tools DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS are_fields_different IMPORTING !ir_data1 TYPE REF TO data !ir_data2 TYPE REF TO data !it_fields TYPE zif_gtt_mia_ef_types=>tt_field_name RETURNING VALUE(rv_result) TYPE zif_gtt_mia_ef_types=>tv_condition RAISING cx_udm_message . CLASS-METHODS are_structures_different IMPORTING !ir_data1 TYPE REF TO data !ir_data2 TYPE REF TO data RETURNING VALUE(rv_result) TYPE zif_gtt_mia_ef_types=>tv_condition RAISING cx_udm_message . CLASS-METHODS convert_datetime_to_utc IMPORTING !iv_datetime TYPE timestamp !iv_timezone TYPE timezone RETURNING VALUE(rv_datetime_utc) TYPE char15 . CLASS-METHODS convert_to_external_amount IMPORTING !iv_currency TYPE waers_curc !iv_internal TYPE any RETURNING VALUE(rv_external) TYPE zif_gtt_mia_ef_types=>tv_currency_amnt . CLASS-METHODS get_field_of_structure IMPORTING !ir_struct_data TYPE REF TO data !iv_field_name TYPE clike RETURNING VALUE(rv_value) TYPE char50 RAISING cx_udm_message . CLASS-METHODS get_errors_log IMPORTING !io_umd_message TYPE REF TO cx_udm_message !iv_appsys TYPE c EXPORTING !es_bapiret TYPE bapiret2 . CLASS-METHODS get_local_timestamp IMPORTING !iv_date TYPE any DEFAULT sy-datum !iv_time TYPE any DEFAULT sy-uzeit RETURNING VALUE(rv_timestamp) TYPE /saptrx/event_exp_datetime . CLASS-METHODS get_logical_system RETURNING VALUE(rv_logsys) TYPE logsys RAISING cx_udm_message. CLASS-METHODS get_max_sequence_id IMPORTING it_expeventdata TYPE zif_gtt_mia_ef_types=>tt_expeventdata RETURNING VALUE(rv_milestonenum) TYPE /saptrx/seq_num. CLASS-METHODS get_next_sequence_id IMPORTING it_expeventdata TYPE zif_gtt_mia_ef_types=>tt_expeventdata RETURNING VALUE(rv_milestonenum) TYPE /saptrx/seq_num. CLASS-METHODS get_pretty_location_id IMPORTING !iv_locid TYPE c !iv_loctype TYPE c RETURNING VALUE(rv_locid) TYPE /saptrx/loc_id_1. CLASS-METHODS get_pretty_value IMPORTING !iv_value TYPE any RETURNING VALUE(rv_pretty) TYPE /saptrx/paramval200 . CLASS-METHODS get_system_time_zone RETURNING VALUE(rv_tzone) TYPE timezone RAISING cx_udm_message . CLASS-METHODS get_system_date_time RETURNING VALUE(rv_datetime) TYPE string RAISING cx_udm_message . CLASS-METHODS get_valid_datetime IMPORTING !iv_timestamp TYPE timestamp RETURNING VALUE(rv_datetime) TYPE char15 . CLASS-METHODS is_date IMPORTING !iv_value TYPE any RETURNING VALUE(rv_result) TYPE abap_bool . CLASS-METHODS is_number IMPORTING !iv_value TYPE any RETURNING VALUE(rv_result) TYPE abap_bool . CLASS-METHODS is_object_changed IMPORTING !is_app_object TYPE trxas_appobj_ctab_wa !io_ef_parameters TYPE REF TO zif_gtt_mia_ef_parameters !it_check_tables TYPE zif_gtt_mia_ef_types=>tt_strucdatadef OPTIONAL !iv_key_field TYPE clike !iv_upd_field TYPE clike !iv_chk_mastertab TYPE abap_bool DEFAULT abap_false RETURNING VALUE(rv_result) TYPE abap_bool RAISING cx_udm_message . CLASS-METHODS is_table IMPORTING !iv_value TYPE any RETURNING VALUE(rv_result) TYPE abap_bool . CLASS-METHODS is_timestamp IMPORTING !iv_value TYPE any RETURNING VALUE(rv_result) TYPE abap_bool . CLASS-METHODS log_exception IMPORTING !io_udm_message TYPE REF TO cx_udm_message !iv_log_name TYPE balnrext OPTIONAL !iv_object TYPE balobj_d !iv_subobject TYPE balsubobj . CLASS-METHODS throw_exception IMPORTING !iv_textid TYPE sotr_conc DEFAULT '' RAISING cx_udm_message . PROTECTED SECTION. PRIVATE SECTION. CLASS-METHODS is_structure_changed IMPORTING !ir_struct TYPE REF TO data !iv_upd_field TYPE clike RETURNING VALUE(rv_result) TYPE abap_bool RAISING cx_udm_message . CLASS-METHODS is_table_changed IMPORTING !ir_table TYPE REF TO data !iv_key_field TYPE clike !iv_upd_field TYPE clike !iv_key_value TYPE any RETURNING VALUE(rv_result) TYPE abap_bool RAISING cx_udm_message . ENDCLASS. CLASS zcl_gtt_mia_tools IMPLEMENTATION. METHOD are_fields_different. FIELD-SYMBOLS: <ls_data1> TYPE any, <ls_data2> TYPE any, <lv_value1> TYPE any, <lv_value2> TYPE any. ASSIGN ir_data1->* TO <ls_data1>. ASSIGN ir_data2->* TO <ls_data2>. rv_result = zif_gtt_mia_ef_constants=>cs_condition-false. LOOP AT it_fields ASSIGNING FIELD-SYMBOL(<lv_field>). ASSIGN COMPONENT <lv_field> OF STRUCTURE <ls_data1> TO <lv_value1>. ASSIGN COMPONENT <lv_field> OF STRUCTURE <ls_data2> TO <lv_value2>. IF <lv_value1> IS ASSIGNED AND <lv_value2> IS ASSIGNED. IF <lv_value1> <> <lv_value2>. rv_result = zif_gtt_mia_ef_constants=>cs_condition-true. EXIT. ENDIF. UNASSIGN: <lv_value1>, <lv_value2>. ELSE. MESSAGE e001(zgtt_mia) WITH <lv_field> '' INTO DATA(lv_dummy). zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDLOOP. ENDMETHOD. METHOD are_structures_different. DATA: lt_fields TYPE cl_abap_structdescr=>component_table, lv_dummy TYPE char100. FIELD-SYMBOLS: <ls_data1> TYPE any, <ls_data2> TYPE any, <lv_value1> TYPE any, <lv_value2> TYPE any. ASSIGN ir_data1->* TO <ls_data1>. ASSIGN ir_data2->* TO <ls_data2>. IF <ls_data1> IS ASSIGNED AND <ls_data2> IS ASSIGNED. lt_fields = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_data( p_data = <ls_data1> ) )->get_components( ). rv_result = zif_gtt_mia_ef_constants=>cs_condition-false. LOOP AT lt_fields ASSIGNING FIELD-SYMBOL(<ls_fields>). ASSIGN COMPONENT <ls_fields>-name OF STRUCTURE <ls_data1> TO <lv_value1>. ASSIGN COMPONENT <ls_fields>-name OF STRUCTURE <ls_data2> TO <lv_value2>. IF <lv_value1> IS ASSIGNED AND <lv_value2> IS ASSIGNED. IF <lv_value1> <> <lv_value2>. rv_result = zif_gtt_mia_ef_constants=>cs_condition-true. EXIT. ENDIF. ELSE. MESSAGE e001(zgtt_mia) WITH <ls_fields>-name '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDLOOP. ELSE. MESSAGE e002(zgtt_mia) WITH '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDMETHOD. METHOD convert_datetime_to_utc. DATA: lv_datetime_utc TYPE timestamp. CALL FUNCTION '/SAPAPO/TIMESTAMP_ZONE_TO_UTC' EXPORTING iv_timezone = iv_timezone iv_timestamp = iv_datetime IMPORTING ev_timestamp = lv_datetime_utc. rv_datetime_utc = get_valid_datetime( iv_timestamp = lv_datetime_utc ). ENDMETHOD. METHOD convert_to_external_amount. DATA: lv_external TYPE bapicurr_d. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL' EXPORTING currency = iv_currency amount_internal = iv_internal IMPORTING amount_external = lv_external. rv_external = round( val = lv_external dec = 2 ). ENDMETHOD. METHOD get_errors_log. es_bapiret-id = io_umd_message->m_msgid. es_bapiret-number = io_umd_message->m_msgno. es_bapiret-type = io_umd_message->m_msgty. es_bapiret-message_v1 = io_umd_message->m_msgv1. es_bapiret-message_v1 = io_umd_message->m_msgv1. es_bapiret-message_v1 = io_umd_message->m_msgv1. es_bapiret-message_v1 = io_umd_message->m_msgv1. es_bapiret-system = iv_appsys. ENDMETHOD. METHOD get_field_of_structure. DATA: lv_dummy TYPE char100. FIELD-SYMBOLS: <ls_struct> TYPE any, <lv_value> TYPE any. ASSIGN ir_struct_data->* TO <ls_struct>. IF <ls_struct> IS ASSIGNED. ASSIGN COMPONENT iv_field_name OF STRUCTURE <ls_struct> TO <lv_value>. IF <lv_value> IS ASSIGNED. rv_value = <lv_value>. ELSE. MESSAGE e001(zgtt_mia) WITH iv_field_name '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ELSE. MESSAGE e002(zgtt_mia) WITH '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDMETHOD. METHOD get_local_timestamp. rv_timestamp = COND #( WHEN iv_date IS NOT INITIAL THEN |0{ iv_date }{ iv_time }| ). ENDMETHOD. METHOD get_logical_system. " Get current logical system CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET' IMPORTING own_logical_system = rv_logsys EXCEPTIONS own_logical_system_not_defined = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE e007(zgtt_mia) INTO DATA(lv_dummy). zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDMETHOD. METHOD get_max_sequence_id. CLEAR: rv_milestonenum. LOOP AT it_expeventdata ASSIGNING FIELD-SYMBOL(<ls_expeventdata>). IF rv_milestonenum < <ls_expeventdata>-milestonenum. rv_milestonenum = <ls_expeventdata>-milestonenum. ENDIF. ENDLOOP. ENDMETHOD. METHOD get_next_sequence_id. rv_milestonenum = get_max_sequence_id( it_expeventdata = it_expeventdata ) + 1. ENDMETHOD. METHOD get_pretty_location_id. rv_locid = SWITCH #( iv_loctype WHEN zif_gtt_mia_ef_constants=>cs_loc_types-customer THEN |{ iv_locid ALPHA = OUT }| WHEN zif_gtt_mia_ef_constants=>cs_loc_types-supplier THEN |{ iv_locid ALPHA = OUT }| ELSE iv_locid ). ENDMETHOD. METHOD get_pretty_value. rv_pretty = COND #( WHEN zcl_gtt_mia_tools=>is_date( iv_value = iv_value ) = abap_true THEN COND #( WHEN iv_value IS NOT INITIAL THEN iv_value ELSE '' ) WHEN zcl_gtt_mia_tools=>is_timestamp( iv_value = iv_value ) = abap_true THEN COND #( WHEN iv_value IS NOT INITIAL THEN get_valid_datetime( iv_timestamp = iv_value ) ELSE '' ) WHEN zcl_gtt_mia_tools=>is_number( iv_value = iv_value ) = abap_true THEN |{ iv_value }| ELSE iv_value ). ENDMETHOD. METHOD get_system_date_time. rv_datetime = |0{ sy-datum }{ sy-uzeit }|. ENDMETHOD. METHOD get_system_time_zone. CALL FUNCTION 'GET_SYSTEM_TIMEZONE' IMPORTING timezone = rv_tzone EXCEPTIONS customizing_missing = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE e003(zgtt_mia) INTO DATA(lv_dummy). zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDMETHOD. METHOD get_valid_datetime. rv_datetime = COND #( WHEN iv_timestamp > 0 THEN |{ CONV char15( iv_timestamp ) ALPHA = IN }| ). ENDMETHOD. METHOD is_date. DATA(lo_type) = cl_abap_typedescr=>describe_by_data( p_data = iv_value ). rv_result = boolc( lo_type->type_kind = cl_abap_typedescr=>typekind_date ). ENDMETHOD. METHOD is_number. DATA(lo_type) = cl_abap_typedescr=>describe_by_data( p_data = iv_value ). rv_result = SWITCH #( lo_type->type_kind WHEN cl_abap_typedescr=>typekind_decfloat OR cl_abap_typedescr=>typekind_decfloat16 OR cl_abap_typedescr=>typekind_decfloat34 OR cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2 OR cl_abap_typedescr=>typekind_int8 OR cl_abap_typedescr=>typekind_num OR cl_abap_typedescr=>typekind_numeric OR cl_abap_typedescr=>typekind_packed THEN abap_true ELSE abap_false ). ENDMETHOD. METHOD is_object_changed. DATA: lv_ebeln TYPE ekko-ebeln, lv_dummy TYPE char255. FIELD-SYMBOLS: <ls_maintab> TYPE any, <lv_key_value> TYPE any. rv_result = abap_false. IF is_app_object-update_indicator IS NOT INITIAL. IF is_structure_changed( ir_struct = is_app_object-maintabref iv_upd_field = iv_upd_field ) = abap_true. rv_result = abap_true. ELSEIF iv_chk_mastertab = abap_true AND is_app_object-mastertabref IS BOUND AND is_structure_changed( ir_struct = is_app_object-mastertabref iv_upd_field = iv_upd_field ) = abap_true. rv_result = abap_true. ELSE. ASSIGN is_app_object-maintabref->* TO <ls_maintab>. IF <ls_maintab> IS ASSIGNED. ASSIGN COMPONENT iv_key_field OF STRUCTURE <ls_maintab> TO <lv_key_value>. IF <lv_key_value> IS ASSIGNED. LOOP AT it_check_tables ASSIGNING FIELD-SYMBOL(<ls_tables>). IF is_table_changed( ir_table = io_ef_parameters->get_appl_table( iv_tabledef = <ls_tables> ) iv_key_field = iv_key_field iv_upd_field = iv_upd_field iv_key_value = <lv_key_value> ) = abap_true. rv_result = abap_true. EXIT. ENDIF. ENDLOOP. ELSE. MESSAGE e001(zgtt_mia) WITH iv_key_field is_app_object-maintabdef INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ELSE. MESSAGE e002(zgtt_mia) WITH '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDIF. ENDIF. ENDMETHOD. METHOD is_structure_changed. DATA: lv_fname TYPE char5, lv_dummy TYPE char100. FIELD-SYMBOLS: <ls_struct> TYPE any, <lv_updkz> TYPE any. rv_result = abap_false. ASSIGN ir_struct->* TO <ls_struct>. IF <ls_struct> IS ASSIGNED. ASSIGN COMPONENT iv_upd_field OF STRUCTURE <ls_struct> TO <lv_updkz>. IF <lv_updkz> IS ASSIGNED. rv_result = boolc( <lv_updkz> IS NOT INITIAL ). ELSE. MESSAGE e001(zgtt_mia) WITH iv_upd_field '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ELSE. MESSAGE e002(zgtt_mia) WITH '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDMETHOD. METHOD is_table. DATA(lo_type) = cl_abap_typedescr=>describe_by_data( p_data = iv_value ). rv_result = boolc( lo_type->type_kind = cl_abap_typedescr=>typekind_table ). ENDMETHOD. METHOD is_table_changed. DATA: lv_fname TYPE char5, lv_dummy TYPE char100. FIELD-SYMBOLS: <lt_table> TYPE ANY TABLE, <ls_table> TYPE any, <lv_key_value> TYPE any, <lv_upd_value> TYPE any. rv_result = abap_false. ASSIGN ir_table->* TO <lt_table>. IF <lt_table> IS ASSIGNED. LOOP AT <lt_table> ASSIGNING <ls_table>. ASSIGN COMPONENT iv_key_field OF STRUCTURE <ls_table> TO <lv_key_value>. ASSIGN COMPONENT iv_upd_field OF STRUCTURE <ls_table> TO <lv_upd_value>. IF <lv_key_value> IS ASSIGNED AND <lv_upd_value> IS ASSIGNED. IF <lv_key_value> = iv_key_value AND <lv_upd_value> IS NOT INITIAL. rv_result = abap_true. EXIT. ENDIF. ELSE. lv_fname = COND #( WHEN <lv_key_value> IS NOT ASSIGNED THEN iv_key_field ELSE iv_upd_field ). MESSAGE e001(zgtt_mia) WITH lv_fname '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDLOOP. ELSE. MESSAGE e002(zgtt_mia) WITH '' INTO lv_dummy. zcl_gtt_mia_tools=>throw_exception( ). ENDIF. ENDMETHOD. METHOD is_timestamp. DATA lo_elem TYPE REF TO cl_abap_elemdescr. DATA(lo_type) = cl_abap_typedescr=>describe_by_data( p_data = iv_value ). IF lo_type IS INSTANCE OF cl_abap_elemdescr. lo_elem ?= lo_type. rv_result = boolc( lo_elem->help_id = zif_gtt_mia_ef_constants=>cs_date_types-timestamp ). ELSE. rv_result = abap_false. ENDIF. ENDMETHOD. METHOD log_exception. DATA: ls_log TYPE bal_s_log, lv_handle TYPE balloghndl, ls_msg TYPE bal_s_msg, lt_handle TYPE bal_t_logh. TRY. cl_reca_guid=>guid_create( IMPORTING ed_guid_22 = DATA(lv_guid) ). " open application log ls_log-object = iv_object. ls_log-subobject = iv_subobject. ls_log-extnumber = lv_handle. ls_log-aldate = sy-datum. ls_log-altime = sy-uzeit. ls_log-aluser = sy-uname. ls_log-altcode = sy-tcode. CALL FUNCTION 'BAL_LOG_CREATE' EXPORTING i_s_log = ls_log IMPORTING e_log_handle = lv_handle EXCEPTIONS log_header_inconsistent = 1 OTHERS = 2. IF sy-subrc <> 0. RETURN. ENDIF. " add message to application log ls_msg = VALUE #( msgty = io_udm_message->m_msgty msgid = io_udm_message->m_msgid msgno = io_udm_message->m_msgno msgv1 = io_udm_message->m_msgv1 msgv2 = io_udm_message->m_msgv2 msgv3 = io_udm_message->m_msgv3 msgv4 = io_udm_message->m_msgv4 ). GET TIME STAMP FIELD ls_msg-time_stmp. CALL FUNCTION 'BAL_LOG_MSG_ADD' EXPORTING i_log_handle = lv_handle i_s_msg = ls_msg EXCEPTIONS log_not_found = 1 msg_inconsistent = 2 log_is_full = 3 OTHERS = 4. IF sy-subrc <> 0. RETURN. ENDIF. " save application log CLEAR lt_handle[]. INSERT lv_handle INTO TABLE lt_handle. CALL FUNCTION 'BAL_DB_SAVE' EXPORTING i_in_update_task = ' ' i_t_log_handle = lt_handle EXCEPTIONS log_not_found = 1 save_not_allowed = 2 numbering_error = 3 OTHERS = 4. IF sy-subrc <> 0. RETURN. ENDIF. CATCH cx_cacs_bal_ex. ENDTRY. ENDMETHOD. METHOD throw_exception. RAISE EXCEPTION TYPE cx_udm_message EXPORTING textid = iv_textid m_msgid = sy-msgid m_msgty = sy-msgty m_msgno = sy-msgno m_msgv1 = sy-msgv1 m_msgv2 = sy-msgv2 m_msgv3 = sy-msgv3 m_msgv4 = sy-msgv4. ENDMETHOD. ENDCLASS.
28.747851
98
0.607944
bd418e9e40390838c35c2db79f67dd656ed8517b
9,304
abap
ABAP
src/ui/zcl_abapgit_gui_page.clas.abap
abapChaoLiu/abapGit
428575fb58840cb98d3f2a04220de8899dbfbd16
[ "MIT" ]
1
2020-04-10T22:21:41.000Z
2020-04-10T22:21:41.000Z
src/ui/zcl_abapgit_gui_page.clas.abap
abapChaoLiu/abapGit
428575fb58840cb98d3f2a04220de8899dbfbd16
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page.clas.abap
abapChaoLiu/abapGit
428575fb58840cb98d3f2a04220de8899dbfbd16
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page DEFINITION PUBLIC ABSTRACT INHERITING FROM zcl_abapgit_gui_component CREATE PUBLIC. PUBLIC SECTION. INTERFACES: zif_abapgit_gui_renderable, zif_abapgit_gui_event_handler, zif_abapgit_gui_error_handler. METHODS: constructor RAISING zcx_abapgit_exception. PROTECTED SECTION. TYPES: BEGIN OF ty_control, page_title TYPE string, page_menu TYPE REF TO zcl_abapgit_html_toolbar, END OF ty_control . DATA ms_control TYPE ty_control . METHODS render_content ABSTRACT RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . PRIVATE SECTION. DATA mo_settings TYPE REF TO zcl_abapgit_settings . DATA mx_error TYPE REF TO zcx_abapgit_exception . DATA mo_exception_viewer TYPE REF TO zcl_abapgit_exception_viewer . METHODS render_deferred_parts IMPORTING !ii_html TYPE REF TO zif_abapgit_html !iv_part_category TYPE string RAISING zcx_abapgit_exception . METHODS html_head RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS title RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS footer RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_link_hints IMPORTING !ii_html TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_command_palettes IMPORTING !ii_html TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_hotkey_overview RETURNING VALUE(ro_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_error_message_box RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS scripts RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE IMPLEMENTATION. METHOD constructor. super->constructor( ). mo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ). ENDMETHOD. METHOD footer. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="footer">' ). ri_html->add( '<table class="w100"><tr>' ). ri_html->add( '<td class="w40"></td>' ). " spacer ri_html->add( '<td class="center">' ). ri_html->add( '<div class="logo">' ). ri_html->add( ri_html->icon( 'git-alt' ) ). ri_html->add( ri_html->icon( 'abapgit' ) ). ri_html->add( '</div>' ). ri_html->add( |<div class="version">{ zif_abapgit_version=>gc_abap_version }</div>| ). ri_html->add( '</td>' ). ri_html->add( '<td id="debug-output" class="w40"></td>' ). ri_html->add( '</tr></table>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD html_head. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<head>' ). ri_html->add( '<meta http-equiv="content-type" content="text/html; charset=utf-8">' ). ri_html->add( '<meta http-equiv="X-UA-Compatible" content="IE=11,10,9,8" />' ). ri_html->add( '<title>abapGit</title>' ). ri_html->add( '<link rel="stylesheet" type="text/css" href="css/common.css">' ). ri_html->add( '<link rel="stylesheet" type="text/css" href="css/ag-icons.css">' ). " Themes ri_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-default.css">' ). " Theme basis CASE mo_settings->get_ui_theme( ). WHEN zcl_abapgit_settings=>c_ui_theme-dark. ri_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-dark.css">' ). WHEN zcl_abapgit_settings=>c_ui_theme-belize. ri_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-belize-blue.css">' ). ENDCASE. ri_html->add( '<script type="text/javascript" src="js/common.js"></script>' ). CASE mo_settings->get_icon_scaling( ). " Enforce icon scaling WHEN mo_settings->c_icon_scaling-large. ri_html->add( '<style>.icon { font-size: 200% }</style>' ). WHEN mo_settings->c_icon_scaling-small. ri_html->add( '<style>.icon.large { font-size: inherit }</style>' ). ENDCASE. ri_html->add( '</head>' ). ENDMETHOD. METHOD render_command_palettes. ii_html->add( 'var gCommandPalette = new CommandPalette(enumerateToolbarActions, {' ). ii_html->add( ' toggleKey: "F1",' ). ii_html->add( ' hotkeyDescription: "Command ..."' ). ii_html->add( '});' ). ENDMETHOD. METHOD render_deferred_parts. DATA lt_parts TYPE zif_abapgit_html=>tty_table_of. DATA li_part LIKE LINE OF lt_parts. lt_parts = gui_services( )->get_html_parts( )->get_parts( iv_part_category ). LOOP AT lt_parts INTO li_part. ii_html->add( li_part ). ENDLOOP. ENDMETHOD. METHOD render_error_message_box. " You should remember that the we have to instantiate ro_html even " it's overwritten further down. Because ADD checks whether it's " bound. CREATE OBJECT ri_html TYPE zcl_abapgit_html. " You should remember that we render the message panel only " if we have an error. IF mx_error IS NOT BOUND. RETURN. ENDIF. ri_html = zcl_abapgit_gui_chunk_lib=>render_error_message_box( mx_error ). " You should remember that the exception viewer dispatches the events of " error message panel CREATE OBJECT mo_exception_viewer EXPORTING ix_error = mx_error. " You should remember that we render the message panel just once " for each exception/error text. CLEAR: mx_error. ENDMETHOD. METHOD render_hotkey_overview. DATA lo_hotkeys_component TYPE REF TO zif_abapgit_gui_renderable. lo_hotkeys_component ?= gui_services( )->get_hotkeys_ctl( ). " Mmmm ... ro_html = lo_hotkeys_component->render( ). ENDMETHOD. METHOD render_link_hints. DATA: lv_link_hint_key TYPE char01. lv_link_hint_key = mo_settings->get_link_hint_key( ). IF mo_settings->get_link_hints_enabled( ) = abap_true AND lv_link_hint_key IS NOT INITIAL. ii_html->add( |activateLinkHints("{ lv_link_hint_key }");| ). ii_html->add( |setInitialFocusWithQuerySelector('a span', true);| ). ii_html->add( |enableArrowListNavigation();| ). ENDIF. ENDMETHOD. METHOD scripts. CREATE OBJECT ro_html. render_deferred_parts( ii_html = ro_html iv_part_category = c_html_parts-scripts ). render_link_hints( ro_html ). render_command_palettes( ro_html ). ENDMETHOD. METHOD title. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="header">' ). ri_html->add( '<div class="logo">' ). ri_html->add( ri_html->icon( 'git-alt' ) ). ri_html->add( ri_html->icon( 'abapgit' ) ). ri_html->add( '</div>' ). ri_html->add( |<div class="page-title"><span class="spacer">&#x25BA;</span>{ ms_control-page_title }</div>| ). IF ms_control-page_menu IS BOUND. ri_html->add( '<div class="float-right">' ). ri_html->add( ms_control-page_menu->render( iv_right = abap_true ) ). ri_html->add( '</div>' ). ENDIF. ri_html->add( '</div>' ). ENDMETHOD. METHOD zif_abapgit_gui_error_handler~handle_error. mx_error = ix_error. rv_handled = abap_true. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. CASE iv_action. WHEN zif_abapgit_definitions=>c_action-goto_source. IF mo_exception_viewer IS BOUND. mo_exception_viewer->goto_source( ). ENDIF. ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-show_callstack. IF mo_exception_viewer IS BOUND. mo_exception_viewer->show_callstack( ). ENDIF. ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-goto_message. IF mo_exception_viewer IS BOUND. mo_exception_viewer->goto_message( ). ENDIF. ev_state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. DATA: li_script TYPE REF TO zif_abapgit_html. gui_services( )->register_event_handler( me ). " Real page CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<!DOCTYPE html>' ). ri_html->add( '<html>' ). ri_html->add( html_head( ) ). ri_html->add( '<body>' ). ri_html->add( title( ) ). ri_html->add( render_content( ) ). " TODO -> render child ri_html->add( render_hotkey_overview( ) ). ri_html->add( render_error_message_box( ) ). render_deferred_parts( ii_html = ri_html iv_part_category = c_html_parts-hidden_forms ). ri_html->add( footer( ) ). ri_html->add( '</body>' ). li_script = scripts( ). IF li_script IS BOUND AND li_script->is_empty( ) = abap_false. ri_html->add( '<script type="text/javascript">' ). ri_html->add( li_script ). ri_html->add( 'confirmInitialized();' ). ri_html->add( '</script>' ). ENDIF. ri_html->add( '</html>' ). ENDMETHOD. ENDCLASS.
26.890173
114
0.663156
bd4324c4cab0bce55be36e491024c161335dacdd
48,148
abap
ABAP
src/objects/zcl_abapgit_objects.clas.abap
JanisB-AT/abapGit
a8517ae26f71ffc6f2bee22a643242cc0c477b99
[ "MIT" ]
2
2021-03-20T20:27:04.000Z
2021-03-20T20:34:58.000Z
src/objects/zcl_abapgit_objects.clas.abap
JanisB-AT/abapGit
a8517ae26f71ffc6f2bee22a643242cc0c477b99
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_objects.clas.abap
JanisB-AT/abapGit
a8517ae26f71ffc6f2bee22a643242cc0c477b99
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_objects DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. TYPES: ty_types_tt TYPE SORTED TABLE OF tadir-object WITH UNIQUE KEY table_line. TYPES: BEGIN OF ty_serialization, files TYPE zif_abapgit_definitions=>ty_files_tt, item TYPE zif_abapgit_definitions=>ty_item, END OF ty_serialization . CLASS-METHODS serialize IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_language TYPE spras !iv_serialize_master_lang_only TYPE abap_bool DEFAULT abap_false !it_translation_langs TYPE zif_abapgit_definitions=>ty_languages OPTIONAL RETURNING VALUE(rs_files_and_item) TYPE ty_serialization RAISING zcx_abapgit_exception . CLASS-METHODS deserialize IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo !is_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks !ii_log TYPE REF TO zif_abapgit_log RETURNING VALUE(rt_accessed_files) TYPE zif_abapgit_definitions=>ty_file_signatures_tt RAISING zcx_abapgit_exception . CLASS-METHODS deserialize_checks IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo RETURNING VALUE(rs_checks) TYPE zif_abapgit_definitions=>ty_deserialize_checks RAISING zcx_abapgit_exception . CLASS-METHODS delete IMPORTING !it_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt !is_checks TYPE zif_abapgit_definitions=>ty_delete_checks OPTIONAL !ii_log TYPE REF TO zif_abapgit_log OPTIONAL RAISING zcx_abapgit_exception . CLASS-METHODS jump IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_line_number TYPE i OPTIONAL !iv_sub_obj_name TYPE zif_abapgit_definitions=>ty_item-obj_name OPTIONAL !iv_sub_obj_type TYPE zif_abapgit_definitions=>ty_item-obj_type OPTIONAL RAISING zcx_abapgit_exception . CLASS-METHODS changed_by IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item RETURNING VALUE(rv_user) TYPE xubname RAISING zcx_abapgit_exception . CLASS-METHODS is_supported IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_native_only TYPE abap_bool DEFAULT abap_false RETURNING VALUE(rv_bool) TYPE abap_bool . CLASS-METHODS exists IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item RETURNING VALUE(rv_bool) TYPE abap_bool . CLASS-METHODS supported_list RETURNING VALUE(rt_types) TYPE ty_types_tt . CLASS-METHODS is_active IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item RETURNING VALUE(rv_active) TYPE abap_bool RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_obj_serializer_item, item TYPE zif_abapgit_definitions=>ty_item, metadata TYPE zif_abapgit_definitions=>ty_metadata, END OF ty_obj_serializer_item . TYPES: ty_obj_serializer_map TYPE SORTED TABLE OF ty_obj_serializer_item WITH UNIQUE KEY item . CLASS-DATA gt_obj_serializer_map TYPE ty_obj_serializer_map . CLASS-DATA gt_supported_obj_types TYPE ty_types_tt . CLASS-METHODS files_to_deserialize 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 check_duplicates IMPORTING !it_files TYPE zif_abapgit_definitions=>ty_files_tt RAISING zcx_abapgit_exception . CLASS-METHODS prioritize_deser IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt . CLASS-METHODS class_name IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item RETURNING VALUE(rv_class_name) TYPE string . CLASS-METHODS warning_overwrite_adjust IMPORTING !it_overwrite TYPE zif_abapgit_definitions=>ty_overwrite_tt CHANGING !ct_results TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception . CLASS-METHODS checks_adjust IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo !is_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks CHANGING !ct_results TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception . CLASS-METHODS warning_overwrite_find IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt RETURNING VALUE(rt_overwrite) TYPE zif_abapgit_definitions=>ty_overwrite_tt . CLASS-METHODS warning_package_adjust IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo !it_overwrite TYPE zif_abapgit_definitions=>ty_overwrite_tt CHANGING !ct_results TYPE zif_abapgit_definitions=>ty_results_tt RAISING zcx_abapgit_exception . CLASS-METHODS warning_package_find IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt !io_repo TYPE REF TO zcl_abapgit_repo RETURNING VALUE(rt_overwrite) TYPE zif_abapgit_definitions=>ty_overwrite_tt RAISING zcx_abapgit_exception . CLASS-METHODS update_package_tree IMPORTING !iv_package TYPE devclass . CLASS-METHODS delete_object IMPORTING !iv_package TYPE devclass !is_item TYPE zif_abapgit_definitions=>ty_item RAISING zcx_abapgit_exception . CLASS-METHODS compare_remote_to_local IMPORTING !ii_object TYPE REF TO zif_abapgit_object !it_remote TYPE zif_abapgit_definitions=>ty_files_tt !is_result TYPE zif_abapgit_definitions=>ty_result !ii_log TYPE REF TO zif_abapgit_log RAISING zcx_abapgit_exception . CLASS-METHODS deserialize_objects IMPORTING !is_step TYPE zif_abapgit_objects=>ty_step_data !ii_log TYPE REF TO zif_abapgit_log CHANGING !ct_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt RAISING zcx_abapgit_exception . CLASS-METHODS check_objects_locked IMPORTING !iv_language TYPE spras !it_items TYPE zif_abapgit_definitions=>ty_items_tt RAISING zcx_abapgit_exception . CLASS-METHODS create_object IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_language TYPE spras !is_metadata TYPE zif_abapgit_definitions=>ty_metadata OPTIONAL !iv_native_only TYPE abap_bool DEFAULT abap_false RETURNING VALUE(ri_obj) TYPE REF TO zif_abapgit_object RAISING zcx_abapgit_exception . CLASS-METHODS map_tadir_to_items IMPORTING !it_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt RETURNING VALUE(rt_items) TYPE zif_abapgit_definitions=>ty_items_tt . CLASS-METHODS map_results_to_items IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt RETURNING VALUE(rt_items) TYPE zif_abapgit_definitions=>ty_items_tt . CLASS-METHODS filter_files_to_deserialize IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt !ii_log TYPE REF TO zif_abapgit_log OPTIONAL RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt . CLASS-METHODS adjust_namespaces IMPORTING !it_results TYPE zif_abapgit_definitions=>ty_results_tt RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt . CLASS-METHODS get_deserialize_steps RETURNING VALUE(rt_steps) TYPE zif_abapgit_objects=>ty_step_data_tt . CLASS-METHODS check_main_package IMPORTING !iv_package TYPE devclass !iv_obj_type TYPE tadir-object RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_OBJECTS IMPLEMENTATION. METHOD adjust_namespaces. FIELD-SYMBOLS: <ls_result> LIKE LINE OF rt_results. rt_results = it_results. LOOP AT rt_results ASSIGNING <ls_result>. REPLACE ALL OCCURRENCES OF '#' IN <ls_result>-obj_name WITH '/'. ENDLOOP. ENDMETHOD. METHOD changed_by. DATA: li_obj TYPE REF TO zif_abapgit_object. IF is_item IS NOT INITIAL. li_obj = create_object( is_item = is_item iv_language = zif_abapgit_definitions=>c_english ). rv_user = li_obj->changed_by( ). ENDIF. IF rv_user IS INITIAL. * eg. ".abapgit.xml" file rv_user = zcl_abapgit_objects_super=>c_user_unknown. ENDIF. ENDMETHOD. METHOD checks_adjust. warning_overwrite_adjust( EXPORTING it_overwrite = is_checks-overwrite CHANGING ct_results = ct_results ). warning_package_adjust( EXPORTING io_repo = io_repo it_overwrite = is_checks-warning_package CHANGING ct_results = ct_results ). ENDMETHOD. METHOD check_duplicates. DATA: lt_files TYPE zif_abapgit_definitions=>ty_files_tt, lv_path TYPE string, lv_filename TYPE string, lt_duplicates TYPE STANDARD TABLE OF string WITH DEFAULT KEY, lv_duplicates LIKE LINE OF lt_duplicates, lv_all_duplicates TYPE string. FIELD-SYMBOLS: <ls_file> LIKE LINE OF it_files. lt_files = it_files. SORT lt_files BY path ASCENDING filename ASCENDING. LOOP AT lt_files ASSIGNING <ls_file>. IF lv_path = <ls_file>-path AND lv_filename = <ls_file>-filename. CONCATENATE <ls_file>-path <ls_file>-filename INTO lv_duplicates. APPEND lv_duplicates TO lt_duplicates. ENDIF. lv_path = <ls_file>-path. lv_filename = <ls_file>-filename. ENDLOOP. IF lt_duplicates IS NOT INITIAL. CONCATENATE LINES OF lt_duplicates INTO lv_all_duplicates SEPARATED BY `, `. zcx_abapgit_exception=>raise( |Duplicates: { lv_all_duplicates }| ). ENDIF. ENDMETHOD. METHOD check_main_package. " check package restrictions, closed package, descriptive or " functional package cl_pak_object_types=>check_object_type( EXPORTING i_working_mode = 'I' i_package_name = iv_package i_pgmid = 'R3TR' i_object_type = iv_obj_type EXCEPTIONS wrong_object_type = 1 package_not_extensible = 2 package_not_loaded = 3 OTHERS = 4 ). CASE sy-subrc. WHEN 0. RETURN. WHEN 2. zcx_abapgit_exception=>raise( |Object type { iv_obj_type } not allowed for package { iv_package }| ). WHEN OTHERS. zcx_abapgit_exception=>raise_t100( ). ENDCASE. ENDMETHOD. METHOD check_objects_locked. DATA: li_obj TYPE REF TO zif_abapgit_object. FIELD-SYMBOLS: <ls_item> LIKE LINE OF it_items. LOOP AT it_items ASSIGNING <ls_item>. " You should remember that we ignore not supported objects here, " because otherwise the process aborts which is not desired IF is_supported( <ls_item> ) = abap_false. CONTINUE. ENDIF. li_obj = create_object( is_item = <ls_item> iv_language = iv_language ). IF li_obj->is_locked( ) = abap_true. zcx_abapgit_exception=>raise( |Object { <ls_item>-obj_type } { <ls_item>-obj_name } | && |is locked. Action not possible.| ). ENDIF. ENDLOOP. ENDMETHOD. METHOD class_name. CONCATENATE 'ZCL_ABAPGIT_OBJECT_' is_item-obj_type INTO rv_class_name. ENDMETHOD. METHOD compare_remote_to_local. * this method is used for comparing local with remote objects * before pull, this is useful eg. when overwriting a TABL object. * only the main XML file is used for comparison DATA: ls_remote_file TYPE zif_abapgit_definitions=>ty_file, li_remote_version TYPE REF TO zif_abapgit_xml_input, lv_count TYPE i, ls_result TYPE zif_abapgit_comparator=>ty_result, lv_answer TYPE string, li_comparator TYPE REF TO zif_abapgit_comparator, lv_gui_is_available TYPE abap_bool, ls_item TYPE zif_abapgit_definitions=>ty_item. FIND ALL OCCURRENCES OF '.' IN is_result-filename MATCH COUNT lv_count. IF is_result-filename CS '.XML' AND lv_count = 2. IF ii_object->exists( ) = abap_false. RETURN. ENDIF. READ TABLE it_remote WITH KEY filename = is_result-filename INTO ls_remote_file. IF sy-subrc <> 0. "if file does not exist in remote, we don't need to validate RETURN. ENDIF. li_comparator = ii_object->get_comparator( ). IF NOT li_comparator IS BOUND. RETURN. ENDIF. CREATE OBJECT li_remote_version TYPE zcl_abapgit_xml_input EXPORTING iv_xml = zcl_abapgit_convert=>xstring_to_string_utf8( ls_remote_file-data ) iv_filename = ls_remote_file-filename. ls_result = li_comparator->compare( ii_remote = li_remote_version ii_log = ii_log ). IF ls_result-text IS INITIAL. RETURN. ENDIF. "log comparison result ls_item-obj_type = is_result-obj_type. ls_item-obj_name = is_result-obj_name. ii_log->add_warning( iv_msg = ls_result-text is_item = ls_item ). "continue or abort? lv_gui_is_available = zcl_abapgit_ui_factory=>get_gui_functions( )->gui_is_available( ). IF lv_gui_is_available = abap_true. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING titlebar = 'Warning' text_question = ls_result-text text_button_1 = 'Abort' icon_button_1 = 'ICON_CANCEL' text_button_2 = 'Pull anyway' icon_button_2 = 'ICON_OKAY' default_button = '2' display_cancel_button = abap_false IMPORTING answer = lv_answer EXCEPTIONS text_not_found = 1 OTHERS = 2. IF sy-subrc <> 0 OR lv_answer = 1. zcx_abapgit_exception=>raise( |Deserialization for object { is_result-obj_name } | & |(type { is_result-obj_type }) aborted by user| ). ENDIF. ELSE. zcx_abapgit_exception=>raise( |Deserialization for object { is_result-obj_name } | & |(type { is_result-obj_type }) aborted, user descision required| ). ENDIF. ENDIF. ENDMETHOD. METHOD create_object. DATA: lv_message TYPE string, lv_class_name TYPE string, ls_obj_serializer_map LIKE LINE OF gt_obj_serializer_map. READ TABLE gt_obj_serializer_map INTO ls_obj_serializer_map WITH KEY item = is_item. IF sy-subrc = 0. lv_class_name = ls_obj_serializer_map-metadata-class. ELSEIF is_metadata IS NOT INITIAL. * Metadata is provided only on serialization * Once this has been triggered, the same serializer shall be used * for subsequent processes. * Thus, buffer the metadata afterwards ls_obj_serializer_map-item = is_item. ls_obj_serializer_map-metadata = is_metadata. INSERT ls_obj_serializer_map INTO TABLE gt_obj_serializer_map. lv_class_name = is_metadata-class. ELSE. lv_class_name = class_name( is_item ). ENDIF. REPLACE FIRST OCCURRENCE OF 'LCL' IN lv_class_name WITH 'ZCL_ABAPGIT'. TRY. CREATE OBJECT ri_obj TYPE (lv_class_name) EXPORTING is_item = is_item iv_language = iv_language. CATCH cx_sy_create_object_error. lv_message = |Object type { is_item-obj_type } not supported, serialize|. IF iv_native_only = abap_false. TRY. " 2nd step, try looking for plugins CREATE OBJECT ri_obj TYPE zcl_abapgit_objects_bridge EXPORTING is_item = is_item. CATCH cx_sy_create_object_error. zcx_abapgit_exception=>raise( lv_message ). ENDTRY. ELSE. " No native support? -> fail zcx_abapgit_exception=>raise( lv_message ). ENDIF. ENDTRY. ENDMETHOD. METHOD delete. DATA: ls_item TYPE zif_abapgit_definitions=>ty_item, li_progress TYPE REF TO zif_abapgit_progress, lt_tadir LIKE it_tadir, lt_deleted LIKE it_tadir, lt_items TYPE zif_abapgit_definitions=>ty_items_tt, lx_error TYPE REF TO zcx_abapgit_exception, lv_count TYPE i. FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF it_tadir. lt_tadir = it_tadir. IF is_checks-transport-required = abap_true. zcl_abapgit_default_transport=>get_instance( )->set( is_checks-transport-transport ). ENDIF. TRY. zcl_abapgit_dependencies=>resolve( CHANGING ct_tadir = lt_tadir ). li_progress = zcl_abapgit_progress=>get_instance( lines( lt_tadir ) ). lt_items = map_tadir_to_items( lt_tadir ). check_objects_locked( iv_language = zif_abapgit_definitions=>c_english it_items = lt_items ). CATCH zcx_abapgit_exception INTO lx_error. zcl_abapgit_default_transport=>get_instance( )->reset( ). RAISE EXCEPTION lx_error. ENDTRY. lv_count = 1. DO. CLEAR lt_deleted. LOOP AT lt_tadir ASSIGNING <ls_tadir>. li_progress->show( iv_current = lv_count iv_text = |Delete { <ls_tadir>-obj_name }| ). CLEAR ls_item. ls_item-obj_type = <ls_tadir>-object. ls_item-obj_name = <ls_tadir>-obj_name. TRY. delete_object( iv_package = <ls_tadir>-devclass is_item = ls_item ). INSERT <ls_tadir> INTO TABLE lt_deleted. DELETE lt_tadir. lv_count = lv_count + 1. " make sure to save object deletions COMMIT WORK. CATCH zcx_abapgit_exception INTO lx_error. IF ii_log IS BOUND. ii_log->add_exception( ix_exc = lx_error is_item = ls_item ). ii_log->add_error( iv_msg = |Deletion of object { ls_item-obj_name } failed| is_item = ls_item ). ENDIF. ENDTRY. ENDLOOP. " Exit if done or nothing else was deleted IF lines( lt_tadir ) = 0 OR lines( lt_deleted ) = 0. EXIT. ENDIF. ENDDO. zcl_abapgit_default_transport=>get_instance( )->reset( ). IF lx_error IS BOUND AND lines( lt_tadir ) > 0. zcx_abapgit_exception=>raise( 'Error during uninstall. Check the log.' ). ENDIF. li_progress->off( ). ENDMETHOD. METHOD delete_object. DATA: li_obj TYPE REF TO zif_abapgit_object. IF is_supported( is_item ) = abap_true. li_obj = create_object( is_item = is_item iv_language = zif_abapgit_definitions=>c_english ). li_obj->delete( iv_package ). IF li_obj->get_metadata( )-delete_tadir = abap_true. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_delete_tadir_entry = abap_true wi_tadir_pgmid = 'R3TR' wi_tadir_object = is_item-obj_type wi_tadir_obj_name = is_item-obj_name wi_test_modus = abap_false EXCEPTIONS OTHERS = 1 ##FM_SUBRC_OK. " We deliberately ignore the subrc, because throwing an exception would " break the deletion of lots of object types. On the other hand we have " to catch the exceptions because otherwise messages would directly be issued " by the function module and change the control flow. Thus breaking the " deletion of TOBJ and other object types. " TODO: This is not very clean and has to be improved in the future. See PR 2741. ENDIF. ENDIF. ENDMETHOD. METHOD deserialize. DATA: ls_item TYPE zif_abapgit_definitions=>ty_item, li_obj TYPE REF TO zif_abapgit_object, lt_remote TYPE zif_abapgit_definitions=>ty_files_tt, lv_package TYPE devclass, lo_files TYPE REF TO zcl_abapgit_objects_files, lo_xml TYPE REF TO zif_abapgit_xml_input, lt_results TYPE zif_abapgit_definitions=>ty_results_tt, li_progress TYPE REF TO zif_abapgit_progress, lv_path TYPE string, lt_items TYPE zif_abapgit_definitions=>ty_items_tt, lt_steps_id TYPE zif_abapgit_definitions=>ty_deserialization_step_tt, lt_steps TYPE zif_abapgit_objects=>ty_step_data_tt, lx_exc TYPE REF TO zcx_abapgit_exception. DATA: lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic. FIELD-SYMBOLS: <ls_result> TYPE zif_abapgit_definitions=>ty_result, <lv_step_id> TYPE LINE OF zif_abapgit_definitions=>ty_deserialization_step_tt, <ls_step> TYPE LINE OF zif_abapgit_objects=>ty_step_data_tt, <ls_deser> TYPE LINE OF zif_abapgit_objects=>ty_deserialization_tt. lt_steps = get_deserialize_steps( ). lv_package = io_repo->get_package( ). IF is_checks-transport-required = abap_true. zcl_abapgit_default_transport=>get_instance( )->set( is_checks-transport-transport ). ENDIF. zcl_abapgit_objects_activation=>clear( ). lt_remote = io_repo->get_files_remote( ). lt_results = files_to_deserialize( io_repo = io_repo ii_log = ii_log ). checks_adjust( EXPORTING io_repo = io_repo is_checks = is_checks CHANGING ct_results = lt_results ). li_progress = zcl_abapgit_progress=>get_instance( lines( lt_results ) ). lt_items = map_results_to_items( lt_results ). check_objects_locked( iv_language = io_repo->get_dot_abapgit( )->get_master_language( ) it_items = lt_items ). lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ). LOOP AT lt_results ASSIGNING <ls_result>. li_progress->show( iv_current = sy-tabix iv_text = |Deserialize { <ls_result>-obj_name }| ). CLEAR ls_item. ls_item-obj_type = <ls_result>-obj_type. ls_item-obj_name = <ls_result>-obj_name. "error handling & logging added TRY. " If package does not exist yet, it will be created with this call lv_package = lo_folder_logic->path_to_package( iv_top = io_repo->get_package( ) io_dot = io_repo->get_dot_abapgit( ) iv_path = <ls_result>-path ). check_main_package( iv_package = lv_package iv_obj_type = ls_item-obj_type ). IF ls_item-obj_type = 'DEVC'. " Packages have the same filename across different folders. The path needs to be supplied " to find the correct file. lv_path = <ls_result>-path. ENDIF. CREATE OBJECT lo_files EXPORTING is_item = ls_item iv_path = lv_path. lo_files->set_files( lt_remote ). "analyze XML in order to instantiate the proper serializer lo_xml = lo_files->read_xml( ). li_obj = create_object( is_item = ls_item iv_language = io_repo->get_dot_abapgit( )->get_master_language( ) is_metadata = lo_xml->get_metadata( ) ). compare_remote_to_local( ii_object = li_obj it_remote = lt_remote is_result = <ls_result> ii_log = ii_log ). li_obj->mo_files = lo_files. "get required steps for deserialize the object lt_steps_id = li_obj->get_deserialize_steps( ). LOOP AT lt_steps_id ASSIGNING <lv_step_id>. READ TABLE lt_steps WITH KEY step_id = <lv_step_id> ASSIGNING <ls_step>. ASSERT sy-subrc = 0. IF <ls_step>-is_ddic = abap_true AND li_obj->get_metadata( )-ddic = abap_false. " DDIC only for DDIC objects zcx_abapgit_exception=>raise( |Step { <lv_step_id> } is only for DDIC objects| ). ENDIF. APPEND INITIAL LINE TO <ls_step>-objects ASSIGNING <ls_deser>. <ls_deser>-item = ls_item. <ls_deser>-obj = li_obj. <ls_deser>-xml = lo_xml. <ls_deser>-package = lv_package. ENDLOOP. CLEAR: lv_path, lv_package. CATCH zcx_abapgit_exception INTO lx_exc. ii_log->add_exception( ix_exc = lx_exc is_item = ls_item ). ii_log->add_error( iv_msg = |Import of object { ls_item-obj_name } failed| is_item = ls_item ). "object should not be part of any deserialization step CONTINUE. ENDTRY. ENDLOOP. "run deserialize for all steps and it's objects SORT lt_steps BY order. LOOP AT lt_steps ASSIGNING <ls_step>. deserialize_objects( EXPORTING is_step = <ls_step> ii_log = ii_log CHANGING ct_files = rt_accessed_files ). ENDLOOP. update_package_tree( io_repo->get_package( ) ). SORT rt_accessed_files BY path ASCENDING filename ASCENDING. DELETE ADJACENT DUPLICATES FROM rt_accessed_files. " Just in case zcl_abapgit_default_transport=>get_instance( )->reset( ). li_progress->off( ). ENDMETHOD. METHOD deserialize_checks. DATA: lt_results TYPE zif_abapgit_definitions=>ty_results_tt, li_package TYPE REF TO zif_abapgit_sap_package. lt_results = files_to_deserialize( io_repo ). rs_checks-overwrite = warning_overwrite_find( lt_results ). rs_checks-warning_package = warning_package_find( io_repo = io_repo it_results = lt_results ). IF lines( lt_results ) > 0. li_package = zcl_abapgit_factory=>get_sap_package( io_repo->get_package( ) ). rs_checks-transport-required = li_package->are_changes_recorded_in_tr_req( ). IF NOT rs_checks-transport-required IS INITIAL. rs_checks-transport-type = li_package->get_transport_type( ). ENDIF. ENDIF. ENDMETHOD. METHOD deserialize_objects. DATA: li_progress TYPE REF TO zif_abapgit_progress, li_exit TYPE REF TO zif_abapgit_exit, lx_exc TYPE REF TO zcx_abapgit_exception. FIELD-SYMBOLS: <ls_obj> LIKE LINE OF is_step-objects. zcl_abapgit_objects_activation=>clear( ). li_progress = zcl_abapgit_progress=>get_instance( lines( is_step-objects ) ). LOOP AT is_step-objects ASSIGNING <ls_obj>. li_progress->show( iv_current = sy-tabix iv_text = |Deserialize { is_step-descr } - { <ls_obj>-item-obj_name }| ). TRY. <ls_obj>-obj->deserialize( iv_package = <ls_obj>-package io_xml = <ls_obj>-xml iv_step = is_step-step_id ii_log = ii_log ). APPEND LINES OF <ls_obj>-obj->mo_files->get_accessed_files( ) TO ct_files. ii_log->add_success( iv_msg = |Object { <ls_obj>-item-obj_name } imported| is_item = <ls_obj>-item ). CATCH zcx_abapgit_exception INTO lx_exc. ii_log->add_exception( ix_exc = lx_exc is_item = <ls_obj>-item ). ii_log->add_error( iv_msg = |Import of object { <ls_obj>-item-obj_name } failed| is_item = <ls_obj>-item ). ENDTRY. ENDLOOP. CASE is_step-step_id. WHEN zif_abapgit_object=>gc_step_id-ddic. zcl_abapgit_objects_activation=>activate( is_step-is_ddic ). WHEN zif_abapgit_object=>gc_step_id-abap. zcl_abapgit_objects_activation=>activate( is_step-is_ddic ). WHEN zif_abapgit_object=>gc_step_id-late. " late can have both DDIC (like TABL with REF TO) and non-DDIC objects zcl_abapgit_objects_activation=>activate( abap_true ). zcl_abapgit_objects_activation=>activate( abap_false ). ENDCASE. * Call postprocessing li_exit = zcl_abapgit_exit=>get_instance( ). li_exit->deserialize_postprocess( is_step = is_step ii_log = ii_log ). ENDMETHOD. METHOD exists. DATA: li_obj TYPE REF TO zif_abapgit_object. TRY. li_obj = create_object( is_item = is_item iv_language = zif_abapgit_definitions=>c_english ). rv_bool = li_obj->exists( ). CATCH zcx_abapgit_exception. * ignore all errors and assume the object exists rv_bool = abap_true. ENDTRY. ENDMETHOD. METHOD files_to_deserialize. rt_results = adjust_namespaces( prioritize_deser( filter_files_to_deserialize( it_results = zcl_abapgit_file_status=>status( io_repo ) ii_log = ii_log ) ) ). ENDMETHOD. METHOD filter_files_to_deserialize. DATA lt_objects LIKE rt_results. DATA lr_object TYPE REF TO zif_abapgit_definitions=>ty_result. DATA ls_item TYPE zif_abapgit_definitions=>ty_item. DATA lv_tabix TYPE sy-tabix. rt_results = it_results. "preparation for object logging, sort all file entries by objects IF ii_log IS BOUND. lt_objects = rt_results. SORT lt_objects BY obj_type obj_name. DELETE ADJACENT DUPLICATES FROM lt_objects COMPARING obj_type obj_name. DELETE lt_objects WHERE obj_type IS INITIAL AND obj_name IS INITIAL. ENDIF. "ignore objects w/o changes DELETE rt_results WHERE match = abap_true. " Full match "log objects w/o changes IF sy-subrc = 0 AND ii_log IS BOUND. SORT rt_results BY obj_type obj_name. LOOP AT lt_objects REFERENCE INTO lr_object. lv_tabix = sy-tabix. READ TABLE rt_results WITH KEY obj_type = lr_object->obj_type obj_name = lr_object->obj_name BINARY SEARCH TRANSPORTING NO FIELDS. IF sy-subrc <> 0. "all parts of the objects have not changed ls_item-devclass = lr_object->package. ls_item-obj_type = lr_object->obj_type. ls_item-obj_name = lr_object->obj_name. ii_log->add_success( iv_msg = |Object { ls_item-obj_name } (type { ls_item-obj_type }) not changed; no import required| is_item = ls_item ). "ignore object for further messages DELETE lt_objects INDEX lv_tabix. ENDIF. ENDLOOP. ENDIF. "ignore objects w/o object type DELETE rt_results WHERE obj_type IS INITIAL. "log objects w/o object type IF sy-subrc = 0 AND ii_log IS BOUND. LOOP AT lt_objects REFERENCE INTO lr_object WHERE obj_type IS INITIAL. CHECK lr_object->obj_name IS NOT INITIAL. ls_item-devclass = lr_object->package. ls_item-obj_type = lr_object->obj_type. ls_item-obj_name = lr_object->obj_name. ii_log->add_warning( iv_msg = |Object type for { ls_item-obj_name } not defined - will be ignored by abapGit| is_item = ls_item ). ENDLOOP. DELETE lt_objects WHERE obj_type IS INITIAL. ENDIF. "ignore objects that exists only local DELETE rt_results WHERE lstate = zif_abapgit_definitions=>c_state-added AND rstate IS INITIAL. "ignore objects that where deleted remotely DELETE rt_results WHERE rstate = zif_abapgit_definitions=>c_state-deleted. "log objects that exists only local or where deleted remotely IF sy-subrc = 0 AND ii_log IS BOUND. SORT rt_results BY obj_type obj_name. LOOP AT lt_objects REFERENCE INTO lr_object. lv_tabix = sy-tabix. READ TABLE rt_results WITH KEY obj_type = lr_object->obj_type obj_name = lr_object->obj_name BINARY SEARCH TRANSPORTING NO FIELDS. IF sy-subrc <> 0. "all parts exists only local "no log message; ignore object for further messages DELETE lt_objects INDEX lv_tabix. ENDIF. ENDLOOP. ENDIF. SORT rt_results BY obj_type ASCENDING obj_name ASCENDING rstate DESCENDING " ensures that non-empty rstate is kept lstate DESCENDING. " ensures that non-empty lstate is kept DELETE ADJACENT DUPLICATES FROM rt_results COMPARING obj_type obj_name. ENDMETHOD. METHOD get_deserialize_steps. FIELD-SYMBOLS: <ls_step> TYPE LINE OF zif_abapgit_objects=>ty_step_data_tt. APPEND INITIAL LINE TO rt_steps ASSIGNING <ls_step>. <ls_step>-step_id = zif_abapgit_object=>gc_step_id-ddic. <ls_step>-descr = 'Import DDIC objects'. <ls_step>-is_ddic = abap_true. <ls_step>-syntax_check = abap_false. <ls_step>-order = 1. APPEND INITIAL LINE TO rt_steps ASSIGNING <ls_step>. <ls_step>-step_id = zif_abapgit_object=>gc_step_id-abap. <ls_step>-descr = 'Import objects main'. <ls_step>-is_ddic = abap_false. <ls_step>-syntax_check = abap_false. <ls_step>-order = 2. APPEND INITIAL LINE TO rt_steps ASSIGNING <ls_step>. <ls_step>-step_id = zif_abapgit_object=>gc_step_id-late. <ls_step>-descr = 'Import late objects'. <ls_step>-is_ddic = abap_false. <ls_step>-syntax_check = abap_true. <ls_step>-order = 3. ENDMETHOD. METHOD is_active. DATA: li_object TYPE REF TO zif_abapgit_object. TRY. li_object = create_object( is_item = is_item iv_language = sy-langu ). rv_active = li_object->is_active( ). CATCH cx_sy_dyn_call_illegal_method cx_sy_ref_is_initial zcx_abapgit_exception. rv_active = abap_true. ENDTRY. ENDMETHOD. METHOD is_supported. TRY. create_object( is_item = is_item iv_language = zif_abapgit_definitions=>c_english iv_native_only = iv_native_only ). rv_bool = abap_true. CATCH zcx_abapgit_exception. rv_bool = abap_false. ENDTRY. ENDMETHOD. METHOD jump. DATA: li_obj TYPE REF TO zif_abapgit_object, lv_adt_jump_enabled TYPE abap_bool. li_obj = create_object( is_item = is_item iv_language = zif_abapgit_definitions=>c_english ). IF li_obj->exists( ) = abap_false. zcx_abapgit_exception=>raise( |Object { is_item-obj_type } { is_item-obj_name } doesn't exist| ). ENDIF. lv_adt_jump_enabled = zcl_abapgit_persist_settings=>get_instance( )->read( )->get_adt_jump_enabled( ). IF lv_adt_jump_enabled = abap_true. TRY. zcl_abapgit_objects_super=>jump_adt( iv_obj_name = is_item-obj_name iv_obj_type = is_item-obj_type iv_sub_obj_name = iv_sub_obj_name iv_sub_obj_type = iv_sub_obj_type iv_line_number = iv_line_number ). CATCH zcx_abapgit_exception. li_obj->jump( ). ENDTRY. ELSEIF iv_line_number IS NOT INITIAL AND iv_sub_obj_type IS NOT INITIAL AND iv_sub_obj_name IS NOT INITIAL. " For the line navigation we have to supply the sub object type (i_sub_obj_type). " If we use is_item-obj_type it navigates only to the object. CALL FUNCTION 'RS_TOOL_ACCESS' EXPORTING operation = 'SHOW' object_name = is_item-obj_name object_type = iv_sub_obj_type include = iv_sub_obj_name position = iv_line_number in_new_window = abap_true EXCEPTIONS not_executed = 1 invalid_object_type = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ELSE. li_obj->jump( ). ENDIF. ENDMETHOD. METHOD map_results_to_items. DATA: ls_item LIKE LINE OF rt_items. FIELD-SYMBOLS: <ls_result> TYPE zif_abapgit_definitions=>ty_result. LOOP AT it_results ASSIGNING <ls_result>. ls_item-devclass = <ls_result>-package. ls_item-obj_type = <ls_result>-obj_type. ls_item-obj_name = <ls_result>-obj_name. INSERT ls_item INTO TABLE rt_items. ENDLOOP. ENDMETHOD. METHOD map_tadir_to_items. DATA: ls_item LIKE LINE OF rt_items. FIELD-SYMBOLS: <ls_tadir> TYPE zif_abapgit_definitions=>ty_tadir. LOOP AT it_tadir ASSIGNING <ls_tadir>. ls_item-devclass = <ls_tadir>-devclass. ls_item-obj_type = <ls_tadir>-object. ls_item-obj_name = <ls_tadir>-obj_name. INSERT ls_item INTO TABLE rt_items. ENDLOOP. ENDMETHOD. METHOD prioritize_deser. * todo, refactor this method FIELD-SYMBOLS: <ls_result> LIKE LINE OF it_results. * WEBI has to be handled before SPRX. LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'WEBI'. APPEND <ls_result> TO rt_results. ENDLOOP. * SPRX has to be handled before depended objects CLAS/INFT/TABL etc. LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'SPRX'. APPEND <ls_result> TO rt_results. ENDLOOP. * XSLT has to be handled before CLAS/PROG LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'XSLT'. APPEND <ls_result> TO rt_results. ENDLOOP. * PROG before internet services, as the services might use the screens LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'PROG'. APPEND <ls_result> TO rt_results. ENDLOOP. * ISAP has to be handled before ISRP LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'IASP'. APPEND <ls_result> TO rt_results. ENDLOOP. * ENHS has to be handled before ENHO LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'ENHS'. APPEND <ls_result> TO rt_results. ENDLOOP. * DDLS has to be handled before DCLS LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'DDLS'. APPEND <ls_result> TO rt_results. ENDLOOP. * IOBJ has to be handled before ODSO LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'IOBJ'. APPEND <ls_result> TO rt_results. ENDLOOP. * TOBJ has to be handled before SCP1 LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'TOBJ'. APPEND <ls_result> TO rt_results. ENDLOOP. * OTGR has to be handled before CHAR LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'OTGR'. APPEND <ls_result> TO rt_results. ENDLOOP. LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type <> 'IASP' AND obj_type <> 'PROG' AND obj_type <> 'XSLT' AND obj_type <> 'PINF' AND obj_type <> 'DEVC' AND obj_type <> 'ENHS' AND obj_type <> 'DDLS' AND obj_type <> 'SPRX' AND obj_type <> 'WEBI' AND obj_type <> 'IOBJ' AND obj_type <> 'TOBJ' AND obj_type <> 'OTGR'. APPEND <ls_result> TO rt_results. ENDLOOP. * PINF after everything as it can expose objects LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'PINF'. APPEND <ls_result> TO rt_results. ENDLOOP. * DEVC after PINF, as it can refer for package interface usage LOOP AT it_results ASSIGNING <ls_result> WHERE obj_type = 'DEVC'. APPEND <ls_result> TO rt_results. ENDLOOP. ENDMETHOD. METHOD serialize. DATA: li_obj TYPE REF TO zif_abapgit_object, li_xml TYPE REF TO zif_abapgit_xml_output, lo_files TYPE REF TO zcl_abapgit_objects_files, ls_i18n_params TYPE zif_abapgit_definitions=>ty_i18n_params. FIELD-SYMBOLS: <ls_file> LIKE LINE OF rs_files_and_item-files. rs_files_and_item-item = is_item. IF is_supported( rs_files_and_item-item ) = abap_false. zcx_abapgit_exception=>raise( |Object type ignored, not supported: { rs_files_and_item-item-obj_type }-{ rs_files_and_item-item-obj_name }| ). ENDIF. CREATE OBJECT lo_files EXPORTING is_item = rs_files_and_item-item. li_obj = create_object( is_item = rs_files_and_item-item iv_language = iv_language ). li_obj->mo_files = lo_files. CREATE OBJECT li_xml TYPE zcl_abapgit_xml_output. ls_i18n_params-main_language = iv_language. ls_i18n_params-main_language_only = iv_serialize_master_lang_only. ls_i18n_params-translation_languages = it_translation_langs. li_xml->i18n_params( ls_i18n_params ). li_obj->serialize( li_xml ). lo_files->add_xml( ii_xml = li_xml is_metadata = li_obj->get_metadata( ) ). rs_files_and_item-files = lo_files->get_files( ). check_duplicates( rs_files_and_item-files ). rs_files_and_item-item-inactive = boolc( li_obj->is_active( ) = abap_false ). LOOP AT rs_files_and_item-files ASSIGNING <ls_file>. <ls_file>-sha1 = zcl_abapgit_hash=>sha1_blob( <ls_file>-data ). ENDLOOP. ENDMETHOD. METHOD supported_list. DATA: lt_objects TYPE STANDARD TABLE OF ko100, ls_item TYPE zif_abapgit_definitions=>ty_item. FIELD-SYMBOLS <ls_object> LIKE LINE OF lt_objects. IF gt_supported_obj_types IS NOT INITIAL. rt_types = gt_supported_obj_types. RETURN. ENDIF. CALL FUNCTION 'TR_OBJECT_TABLE' TABLES wt_object_text = lt_objects EXCEPTIONS OTHERS = 1 ##FM_SUBRC_OK. LOOP AT lt_objects ASSIGNING <ls_object> WHERE pgmid = 'R3TR'. ls_item-obj_type = <ls_object>-object. IF is_supported( ls_item ) = abap_true. INSERT <ls_object>-object INTO TABLE rt_types. ENDIF. ENDLOOP. gt_supported_obj_types = rt_types. ENDMETHOD. METHOD update_package_tree. DATA: lt_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt, lv_package LIKE LINE OF lt_packages, lv_tree TYPE dirtree-tname. lt_packages = zcl_abapgit_factory=>get_sap_package( iv_package )->list_subpackages( ). APPEND iv_package TO lt_packages. LOOP AT lt_packages INTO lv_package. * update package tree for SE80 lv_tree = 'EU_' && lv_package. CALL FUNCTION 'WB_TREE_ACTUALIZE' EXPORTING tree_name = lv_tree without_crossreference = abap_true with_tcode_index = abap_true. ENDLOOP. ENDMETHOD. METHOD warning_overwrite_adjust. DATA: lt_overwrite LIKE it_overwrite, ls_overwrite LIKE LINE OF lt_overwrite. FIELD-SYMBOLS: <ls_overwrite> LIKE LINE OF lt_overwrite. * make sure to get the current status, as something might have changed in the meanwhile lt_overwrite = warning_overwrite_find( ct_results ). LOOP AT lt_overwrite ASSIGNING <ls_overwrite>. READ TABLE it_overwrite INTO ls_overwrite WITH TABLE KEY object_type_and_name COMPONENTS obj_type = <ls_overwrite>-obj_type obj_name = <ls_overwrite>-obj_name. IF sy-subrc <> 0 OR ls_overwrite-decision IS INITIAL. zcx_abapgit_exception=>raise( |Overwrite { <ls_overwrite>-obj_type } { <ls_overwrite>-obj_name } undecided| ). ENDIF. IF ls_overwrite-decision = 'N'. DELETE ct_results WHERE obj_type = <ls_overwrite>-obj_type AND obj_name = <ls_overwrite>-obj_name. ASSERT sy-subrc = 0. ENDIF. ENDLOOP. ENDMETHOD. METHOD warning_overwrite_find. DATA: ls_overwrite LIKE LINE OF rt_overwrite. FIELD-SYMBOLS: <ls_result> LIKE LINE OF it_results. LOOP AT it_results ASSIGNING <ls_result> WHERE NOT obj_type IS INITIAL. IF <ls_result>-lstate IS NOT INITIAL AND NOT ( <ls_result>-lstate = zif_abapgit_definitions=>c_state-added AND <ls_result>-rstate IS INITIAL ) OR ( <ls_result>-lstate IS INITIAL AND <ls_result>-rstate = zif_abapgit_definitions=>c_state-deleted ). " current object has been modified or deleted locally, add to table CLEAR ls_overwrite. MOVE-CORRESPONDING <ls_result> TO ls_overwrite. APPEND ls_overwrite TO rt_overwrite. ENDIF. ENDLOOP. SORT rt_overwrite. DELETE ADJACENT DUPLICATES FROM rt_overwrite. ENDMETHOD. METHOD warning_package_adjust. DATA: lt_overwrite LIKE it_overwrite, ls_overwrite LIKE LINE OF lt_overwrite. FIELD-SYMBOLS: <ls_overwrite> LIKE LINE OF lt_overwrite. * make sure to get the current status, as something might have changed in the meanwhile lt_overwrite = warning_package_find( it_results = ct_results io_repo = io_repo ). LOOP AT lt_overwrite ASSIGNING <ls_overwrite>. READ TABLE it_overwrite INTO ls_overwrite WITH TABLE KEY object_type_and_name COMPONENTS obj_type = <ls_overwrite>-obj_type obj_name = <ls_overwrite>-obj_name. IF sy-subrc <> 0 OR ls_overwrite-decision IS INITIAL. zcx_abapgit_exception=>raise( |Overwrite of package { <ls_overwrite>-obj_type } { <ls_overwrite>-obj_name } undecided| ). ENDIF. IF ls_overwrite-decision = 'N'. DELETE ct_results WHERE obj_type = <ls_overwrite>-obj_type AND obj_name = <ls_overwrite>-obj_name. ASSERT sy-subrc = 0. ENDIF. ENDLOOP. ENDMETHOD. METHOD warning_package_find. DATA: lv_package TYPE devclass, lt_overwrite_unique TYPE HASHED TABLE OF zif_abapgit_definitions=>ty_overwrite WITH UNIQUE KEY obj_type obj_name devclass, ls_overwrite LIKE LINE OF rt_overwrite, ls_tadir TYPE zif_abapgit_definitions=>ty_tadir. DATA: lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic. FIELD-SYMBOLS: <ls_result> LIKE LINE OF it_results. lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ). LOOP AT it_results ASSIGNING <ls_result>. lv_package = lo_folder_logic->path_to_package( iv_top = io_repo->get_package( ) io_dot = io_repo->get_dot_abapgit( ) iv_path = <ls_result>-path iv_create_if_not_exists = abap_false ). ls_tadir = zcl_abapgit_factory=>get_tadir( )->read_single( iv_object = <ls_result>-obj_type iv_obj_name = <ls_result>-obj_name ). IF NOT ls_tadir IS INITIAL AND ls_tadir-devclass <> lv_package. * overwriting object from different package than expected CLEAR ls_overwrite. ls_overwrite-obj_type = <ls_result>-obj_type. ls_overwrite-obj_name = <ls_result>-obj_name. ls_overwrite-devclass = ls_tadir-devclass. INSERT ls_overwrite INTO TABLE lt_overwrite_unique. ENDIF. ENDLOOP. rt_overwrite = lt_overwrite_unique. ENDMETHOD. ENDCLASS.
33.412908
111
0.647192
bd44b5652d55b0a767cf267949b9f9b897354a79
3,289
abap
ABAP
src/checks/zcl_aoc_check_02.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_02.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_02.clas.abap
DennstedtB/abapOpenChecks
551dad876ce09d6b7cca32dd166827f1cdbf33e5
[ "MIT" ]
null
null
null
CLASS zcl_aoc_check_02 DEFINITION PUBLIC INHERITING FROM zcl_aoc_super CREATE PUBLIC. PUBLIC SECTION. METHODS constructor. METHODS check REDEFINITION. METHODS if_ci_test~query_attributes REDEFINITION. METHODS put_attributes REDEFINITION. METHODS get_attributes REDEFINITION. PROTECTED SECTION. DATA mv_check TYPE flag. DATA mv_exit TYPE flag. PRIVATE SECTION. ENDCLASS. CLASS zcl_aoc_check_02 IMPLEMENTATION. METHOD check. * abapOpenChecks * https://github.com/larshp/abapOpenChecks * MIT License DATA: lv_keyword TYPE string, lv_line TYPE token_row, lv_include TYPE program, lv_error TYPE sci_errc, lv_index LIKE sy-tabix. FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements. LOOP AT io_scan->statements ASSIGNING <ls_statement>. lv_index = sy-tabix. lv_keyword = io_scan->statement_keyword( lv_index ). IF lv_keyword = 'EXIT' AND mv_exit = abap_true. lv_error = '001'. ELSEIF lv_keyword = 'CHECK' AND mv_check = abap_true. lv_error = '002'. ELSE. CONTINUE. " current loop ENDIF. LOOP AT io_scan->structures TRANSPORTING NO FIELDS WHERE ( stmnt_type = zcl_aoc_scan=>gc_structure_statement-loop OR stmnt_type = zcl_aoc_scan=>gc_structure_statement-while OR stmnt_type = zcl_aoc_scan=>gc_structure_statement-do OR stmnt_type = zcl_aoc_scan=>gc_structure_statement-select ) AND stmnt_from <= lv_index AND stmnt_to >= lv_index. EXIT. " current loop ENDLOOP. IF sy-subrc <> 0. lv_line = io_scan->statement_row( lv_index ). lv_include = io_scan->get_include( <ls_statement>-level ). inform( p_sub_obj_name = lv_include p_position = lv_index p_line = lv_line p_kind = mv_errty p_test = myname p_code = lv_error ). ENDIF. ENDLOOP. ENDMETHOD. METHOD constructor. super->constructor( ). version = '001'. position = '002'. has_attributes = abap_true. attributes_ok = abap_true. enable_rfc( ). set_uses_checksum( ). mv_check = abap_true. mv_exit = abap_true. insert_scimessage( iv_code = '001' iv_text = 'EXIT outside loop, use RETURN instead'(m01) ). insert_scimessage( iv_code = '002' iv_text = 'CHECK outside of loop'(m02) ). ENDMETHOD. METHOD get_attributes. EXPORT mv_errty = mv_errty mv_check = mv_check mv_exit = mv_exit 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_check 'CHECK' 'C'. "#EC NOTEXT zzaoc_fill_att mv_exit 'EXIT' 'C'. "#EC NOTEXT zzaoc_popup. ENDMETHOD. METHOD put_attributes. IMPORT mv_errty = mv_errty mv_check = mv_check mv_exit = mv_exit FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED ASSERT sy-subrc = 0. ENDMETHOD. ENDCLASS.
22.527397
72
0.619033
bd44ecb71e98b96069e2653764740b353ca2b217
375
abap
ABAP
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZCQSE_DEMO.abap
assessorgeneral/ConQAT
2a462f23f22c22aa9d01a7a204453d1be670ba60
[ "Apache-2.0" ]
null
null
null
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZCQSE_DEMO.abap
assessorgeneral/ConQAT
2a462f23f22c22aa9d01a7a204453d1be670ba60
[ "Apache-2.0" ]
null
null
null
org.conqat.engine.sourcecode/test-data/org.conqat.engine.sourcecode.dataflow.heuristics/abap/ZCQSE_DEMO.abap
assessorgeneral/ConQAT
2a462f23f22c22aa9d01a7a204453d1be670ba60
[ "Apache-2.0" ]
null
null
null
*&---------------------------------------------------------------------* *& Report ZCQSE_DEMO *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT ZCQSE_DEMO. perform hello. FORM hello. if 1 >< 5. write / 'hello world'. endif. endform.
20.833333
73
0.224
bd46269d477bce10f562d51424ca2f989d530ede
2,050
abap
ABAP
src/$txc_service_example/zcl_ztxc_service_examp_mpc.clas.abap
10xcoding/deps
4c07fa63afd465d9bcc4001bd1bf3d610992a2a4
[ "MIT" ]
null
null
null
src/$txc_service_example/zcl_ztxc_service_examp_mpc.clas.abap
10xcoding/deps
4c07fa63afd465d9bcc4001bd1bf3d610992a2a4
[ "MIT" ]
null
null
null
src/$txc_service_example/zcl_ztxc_service_examp_mpc.clas.abap
10xcoding/deps
4c07fa63afd465d9bcc4001bd1bf3d610992a2a4
[ "MIT" ]
null
null
null
CLASS zcl_ztxc_service_examp_mpc DEFINITION PUBLIC INHERITING FROM /iwbep/cl_mgw_push_abs_model CREATE PUBLIC . PUBLIC SECTION. TYPES: ts_customerzstructure TYPE zcustomer_s. . TYPES: tt_customerzstructure TYPE STANDARD TABLE OF ts_customerzstructure. . TYPES: BEGIN OF ts_text_element, artifact_name TYPE c LENGTH 40, " technical name artifact_type TYPE c LENGTH 4, parent_artifact_name TYPE c LENGTH 40, " technical name parent_artifact_type TYPE c LENGTH 4, text_symbol TYPE textpoolky, END OF ts_text_element. . TYPES: tt_text_elements TYPE STANDARD TABLE OF ts_text_element WITH KEY text_symbol. . TYPES: ts_customerztable TYPE zcustomer_t. . TYPES: tt_customerztable TYPE STANDARD TABLE OF ts_customerztable. . TYPES: ts_customersaptable TYPE kna1. . TYPES: tt_customersaptable TYPE STANDARD TABLE OF ts_customersaptable. . TYPES: ts_customersapstructure TYPE e1kna1c. . TYPES: tt_customersapstructure TYPE STANDARD TABLE OF ts_customersapstructure. . CONSTANTS gc_customersapstructure TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_entity_name VALUE 'CustomerSapStructure' ##NO_TEXT. CONSTANTS gc_customersaptable TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_entity_name VALUE 'CustomerSapTable' ##NO_TEXT. CONSTANTS gc_customerzstructure TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_entity_name VALUE 'CustomerZStructure' ##NO_TEXT. CONSTANTS gc_customerztable TYPE /iwbep/if_mgw_med_odata_types=>ty_e_med_entity_name VALUE 'CustomerZTable' ##NO_TEXT. METHODS load_text_elements FINAL RETURNING VALUE(rt_text_elements) TYPE tt_text_elements RAISING /iwbep/cx_mgw_med_exception . METHODS define REDEFINITION . METHODS get_last_modified REDEFINITION . PROTECTED SECTION. ENDCLASS. CLASS zcl_ztxc_service_examp_mpc IMPLEMENTATION. METHOD load_text_elements. ENDMETHOD. ENDCLASS.
36.607143
134
0.742927
bd4698cb9ff9fb5e50bf22e82d79d53cd8de890e
37,411
abap
ABAP
src/ui/tables/zcl_dbbr_selscreen_table.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
null
null
null
src/ui/tables/zcl_dbbr_selscreen_table.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
null
null
null
src/ui/tables/zcl_dbbr_selscreen_table.clas.abap
reichr-dev/abap-db-browser
d513d49692f1f0ee613c8eab2c99e325ef5b78fe
[ "MIT" ]
null
null
null
"! <p class="shorttext synchronized" lang="en">Table controller for data selection</p> CLASS zcl_dbbr_selscreen_table DEFINITION PUBLIC INHERITING FROM zcl_dbbr_base_select_tc CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_uitb_page_scroller . INTERFACES zif_uitb_table . EVENTS aggregation_attr_changed . METHODS aggregation_is_active RETURNING VALUE(result) TYPE abap_bool . METHODS clear . METHODS collapse_all_table_fields IMPORTING !ir_tabfields TYPE REF TO zcl_dbbr_tabfield_list . METHODS constructor IMPORTING !is_selscreen_settings TYPE zdbbr_selscreen_settings OPTIONAL . METHODS delete_aggregations . METHODS determine_loop_lines . METHODS display_lines . METHODS expand_all_hidden_fields . METHODS expand_all_table_fields IMPORTING !ir_tabfields TYPE REF TO zcl_dbbr_tabfield_list . METHODS expand_collapse_table_fields IMPORTING !ir_tabfields TYPE REF TO zcl_dbbr_tabfield_list . METHODS get_col_index IMPORTING !iv_name TYPE screen-name OPTIONAL !iv_group1 TYPE screen-group1 OPTIONAL !iv_group2 TYPE screen-group2 OPTIONAL !iv_group3 TYPE screen-group3 OPTIONAL !iv_group4 TYPE screen-group4 OPTIONAL RETURNING VALUE(rv_index) TYPE sy-index . METHODS get_current_line IMPORTING !if_reset_index TYPE boolean DEFAULT abap_true RETURNING VALUE(rv_index) LIKE sy-tabix . METHODS get_data RETURNING VALUE(result) TYPE zdbbr_selfield_itab . METHODS get_loop_lines RETURNING VALUE(rv_looplines) TYPE sy-loopc . METHODS scroll_to_next_table IMPORTING !it_tablist TYPE zdbbr_entity_info_t . METHODS scroll_to_previous_table IMPORTING !it_tablist TYPE zdbbr_entity_info_t . METHODS scroll_to_next_criteria. METHODS scroll_to_previous_criteria. METHODS search_value IMPORTING !iv_code LIKE sy-ucomm RETURNING VALUE(rf_search_successful) TYPE boolean . "! <p class="shorttext synchronized" lang="en">Set LOWERCASE setting of current field</p> METHODS set_lowercase_setting . "! <p class="shorttext synchronized" lang="en">Selects group by of all fields</p> METHODS select_all_group_by. "! <p class="shorttext synchronized" lang="en">Unselects group by of all fields</p> METHODS unselect_all_group_by. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_fields, system_value_type TYPE string VALUE 'GS_SELFIELDS-SYSTEM_VALUE_TYPE' ##NO_TEXT, high_value TYPE string VALUE 'GS_SELFIELDS-HIGH' ##NO_TEXT, low_value TYPE string VALUE 'GS_SELFIELDS-LOW' ##NO_TEXT, group_by TYPE string VALUE 'GS_SELFIELDS-GROUP_BY' ##NO_TEXT, aggregation TYPE string VALUE 'GS_SELFIELDS-AGGREGATION' ##NO_TEXT, totals TYPE string VALUE 'GS_SELFIELDS-TOTALS' ##NO_TEXT, push TYPE string VALUE 'PUSH' ##NO_TEXT, option TYPE string VALUE 'OPTION' ##NO_TEXT, END OF c_fields . DATA mr_expand_button TYPE REF TO zdbbr_button . DATA mr_global_data TYPE REF TO zdbbr_global_data . DATA mr_option_icon TYPE REF TO zdbbr_button . DATA mr_push_icon TYPE REF TO zdbbr_button . DATA mr_selfields_multi TYPE REF TO zdbbr_selfield_itab . DATA mr_subquery_icon TYPE REF TO zdbbr_button . DATA mr_table_data TYPE REF TO zdbbr_selfield_itab . DATA ms_selscreen_settings TYPE zdbbr_selscreen_settings . DATA mt_selection_fields_hidden TYPE zdbbr_selfield_itab . DATA mv_current_line LIKE sy-tabix . DATA mv_linecount LIKE sy-tabix . DATA mv_looplines TYPE sy-loopc . DATA mr_tableview TYPE REF TO cxtab_control. METHODS check_aggregation_validity . METHODS check_entered_system_value . "! <p class="shorttext synchronized" lang="en">Delete values of current line</p> "! "! @parameter cs_selfields | <p class="shorttext synchronized" lang="en"></p> METHODS delete_line_values CHANGING !cs_selfields TYPE zdbbr_selfield . "! <p class="shorttext synchronized" lang="en">Handle fields in advanced mode</p> "! METHODS handle_advanced_mode . "! <p class="shorttext synchronized" lang="en">Optimize columns</p> "! METHODS handle_column_optimization . "! <p class="shorttext synchronized" lang="en">Expand/Collapse columns</p> "! METHODS handle_expand_column . "! <p class="shorttext synchronized" lang="en">Special handling of a table header row</p> "! METHODS handle_table_header_row . "! <p class="shorttext synchronized" lang="en">Handle option to display tech fields first</p> "! METHODS handle_tech_first_setting . "! <p class="shorttext synchronized" lang="en">Scroll to to first field in the table</p> "! "! @parameter iv_tabname | <p class="shorttext synchronized" lang="en"></p> METHODS scroll_to_first_field_of_table IMPORTING !iv_tabname TYPE tabname . "! <p class="shorttext synchronized" lang="en">Update status for input field</p> "! METHODS update_input_field_status . ENDCLASS. CLASS zcl_dbbr_selscreen_table IMPLEMENTATION. METHOD aggregation_is_active. CLEAR result. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_selfield>) WHERE group_by = abap_true OR totals = abap_true OR aggregation <> space. result = abap_true. RETURN. ENDLOOP. " check hidden fields LOOP AT mt_selection_fields_hidden ASSIGNING <ls_selfield> WHERE group_by = abap_true OR totals = abap_true OR aggregation <> space. result = abap_true. RETURN. ENDLOOP. ENDMETHOD. METHOD check_aggregation_validity. IF mr_selfield_line->group_by = abap_true AND mr_selfield_line->aggregation <> space. MESSAGE e019(zdbbr_info). ENDIF. IF ( mr_selfield_line->aggregation = zif_dbbr_c_aggregation=>average OR mr_selfield_line->aggregation = zif_dbbr_c_aggregation=>sum ) AND mr_selfield_line->is_numeric = abap_false. MESSAGE e020(zdbbr_info) WITH zcl_sat_ddic_repo_access=>get_domain_fix_value_text( mr_selfield_line->aggregation ). ENDIF. ENDMETHOD. METHOD check_entered_system_value. DATA(lv_inttype) = zcl_sat_ddic_repo_access=>get_dtel_inttype( mr_selfield_line->rollname ). IF NOT zcl_dbbr_ddic_util=>check_for_possible_systype( iv_inttype = lv_inttype iv_system_value_type = mr_selfield_line->system_value_type ). MESSAGE e071(zdbbr_info). ELSE. zcl_sat_system_helper=>get_system_value( EXPORTING iv_system_value_type = mr_selfield_line->system_value_type IMPORTING ev_system_value = mr_selfield_line->low ). ENDIF. ENDMETHOD. METHOD clear. CLEAR mr_table_data->*. CLEAR mt_selection_fields_hidden. ENDMETHOD. METHOD collapse_all_table_fields. LOOP AT CAST zdbbr_selfield_itab( mr_table_data )->* ASSIGNING FIELD-SYMBOL(<ls_table_header>) WHERE tree_collapsed = abap_false AND is_table_header = abap_true. " remove rows for table mt_selection_fields_hidden = VALUE #( BASE mt_selection_fields_hidden FOR visible_field IN mr_table_data->* WHERE ( is_table_header = abap_false AND tabname = <ls_table_header>-tabname ) ( visible_field ) ). DELETE mr_table_data->* WHERE is_table_header = abap_false AND tabname = <ls_table_header>-tabname. <ls_table_header>-tree_collapsed = abap_true. ENDLOOP. zif_uitb_page_scroller~scroll_page_top( ). ENDMETHOD. METHOD constructor. super->constructor( ). " init global data references from cache DATA(lr_data_cache) = zcl_uitb_data_cache=>get_instance( zif_dbbr_c_report_id=>main ). mr_tableview = CAST cxtab_control( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_selfields_tc ) ). mr_selfield_line = CAST zdbbr_selfield( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_s_selfields ) ). mr_table_data = CAST zdbbr_selfield_itab( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_t_selection_fields ) ). mr_push_icon = CAST zdbbr_button( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_push ) ). mr_option_icon = CAST zdbbr_button( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_option ) ). mr_global_data = CAST zdbbr_global_data( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_s_data ) ). mr_selfields_multi = CAST zdbbr_selfield_itab( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_t_selection_fields_multi ) ). mr_subquery_icon = CAST #( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_subquery ) ). mr_expand_button = CAST #( lr_data_cache->get_data_ref( zif_dbbr_main_report_var_ids=>c_bt_expand ) ). ms_selscreen_settings = is_selscreen_settings. ENDMETHOD. METHOD delete_aggregations. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_selfield>). CLEAR: <ls_selfield>-group_by, <ls_selfield>-aggregation, <ls_selfield>-totals. ENDLOOP. ENDMETHOD. METHOD delete_line_values. CLEAR: cs_selfields-low, cs_selfields-high, cs_selfields-sign, cs_selfields-push, cs_selfields-option, cs_selfields-system_value_type. IF cs_selfields-is_parameter = abap_true. IF cs_selfields-is_range_param = abap_false. cs_selfields-option = zif_sat_c_options=>equals. ENDIF. TRY. DATA(lr_tabfield) = get_util( )->mo_data->mo_tabfield_list->get_field_ref( iv_tabname_alias = cs_selfields-tabname iv_fieldname = cs_selfields-fieldname ). cs_selfields-low = lr_tabfield->default_low. CATCH cx_sy_itab_line_not_found. ENDTRY. ENDIF. cs_selfields-sign = zif_dbbr_c_global=>c_options-i. ENDMETHOD. METHOD determine_loop_lines. mv_looplines = sy-loopc. ENDMETHOD. METHOD display_lines. *&---------------------------------------------------------------------* *& Description: Performs conversion to external format before entries *& are displayed *&---------------------------------------------------------------------* IF mr_selfield_line->is_parameter = abap_true. zcl_sat_data_converter=>convert_values_to_disp_format( EXPORTING iv_rollname = mr_selfield_line->rollname iv_type = mr_selfield_line->inttype iv_length = CONV #( mr_selfield_line->intlen ) iv_decimals = CONV #( mr_selfield_line->decimals ) CHANGING cv_value1 = mr_selfield_line->low ). ELSE. zcl_sat_data_converter=>convert_selopt_to_disp_format( EXPORTING iv_tabname = mr_selfield_line->tabname iv_fieldname = mr_selfield_line->fieldname CHANGING cv_value1 = mr_selfield_line->low cv_value2 = mr_selfield_line->high ). ENDIF. ENDMETHOD. METHOD expand_all_hidden_fields. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_line>) WHERE tree_collapsed = abap_true. DATA(lv_index) = sy-tabix. " 1st solution, just add the hidden fields back to the selection screen INSERT LINES OF VALUE zdbbr_selfield_itab( FOR hidden_field IN mt_selection_fields_hidden WHERE ( tabname_alias = <ls_line>-tabname_alias ) ( hidden_field ) ) INTO mr_table_data->* INDEX lv_index. DELETE mt_selection_fields_hidden WHERE tabname_alias = <ls_line>-tabname_alias. ENDLOOP. ENDMETHOD. METHOD expand_all_table_fields. LOOP AT CAST zdbbr_selfield_itab( mr_table_data )->* ASSIGNING FIELD-SYMBOL(<ls_table_header>) WHERE tree_collapsed = abap_true AND is_table_header = abap_true. DATA(lv_tabix) = sy-tabix + 1. INSERT LINES OF VALUE zdbbr_selfield_itab( FOR hidden_field IN mt_selection_fields_hidden WHERE ( tabname_alias = <ls_table_header>-tabname_alias ) ( hidden_field ) ) INTO mr_table_data->* INDEX lv_tabix. DELETE mt_selection_fields_hidden WHERE tabname_alias = <ls_table_header>-tabname_alias. <ls_table_header>-tree_collapsed = abap_false. ENDLOOP. IF sy-subrc = 0. zif_uitb_page_scroller~scroll_page_top( ). ENDIF. ENDMETHOD. METHOD expand_collapse_table_fields. DATA(lr_current_line_ref) = zif_uitb_table~get_current_line_ref( ). CHECK lr_current_line_ref IS BOUND. DATA(lv_index) = zif_uitb_table~get_current_line_index( ) + 1. ASSIGN CAST zdbbr_selfield( lr_current_line_ref )->* TO FIELD-SYMBOL(<ls_current_line>). IF <ls_current_line>-tree_collapsed = abap_true. <ls_current_line>-tree_collapsed = abap_false. " 1st solution, just add the hidden fields back to the selection screen INSERT LINES OF VALUE zdbbr_selfield_itab( FOR hidden_field IN mt_selection_fields_hidden WHERE ( tabname_alias = <ls_current_line>-tabname_alias ) ( hidden_field ) ) INTO mr_table_data->* INDEX lv_index. DELETE mt_selection_fields_hidden WHERE tabname_alias = <ls_current_line>-tabname_alias. ELSE. " remove rows for table mt_selection_fields_hidden = VALUE #( BASE mt_selection_fields_hidden FOR visible_field IN mr_table_data->* WHERE ( is_table_header = abap_false AND tabname_alias = <ls_current_line>-tabname_alias ) ( visible_field ) ). DELETE mr_table_data->* WHERE is_table_header = abap_false AND tabname_alias = <ls_current_line>-tabname_alias. <ls_current_line>-tree_collapsed = abap_true. ENDIF. ENDMETHOD. METHOD get_col_index. LOOP AT mr_tableview->cols ASSIGNING FIELD-SYMBOL(<ls_table_column>). IF iv_name IS NOT INITIAL AND <ls_table_column>-screen-name = iv_name. rv_index = <ls_table_column>-index. RETURN. ENDIF. IF iv_group1 IS NOT INITIAL AND <ls_table_column>-screen-group1 = iv_group1. rv_index = <ls_table_column>-index. RETURN. ENDIF. IF iv_group2 IS NOT INITIAL AND <ls_table_column>-screen-group2 = iv_group2. rv_index = <ls_table_column>-index. RETURN. ENDIF. IF iv_group3 IS NOT INITIAL AND <ls_table_column>-screen-group3 = iv_group3. rv_index = <ls_table_column>-index. RETURN. ENDIF. IF iv_group4 IS NOT INITIAL AND <ls_table_column>-screen-group4 = iv_group4. rv_index = <ls_table_column>-index. RETURN. ENDIF. ENDLOOP. ENDMETHOD. METHOD get_current_line. *&---------------------------------------------------------------------* *& Description: Returns the current line index of this table *&---------------------------------------------------------------------* IF if_reset_index = abap_true. zif_uitb_table~determine_current_line( ). ENDIF. rv_index = mv_current_line. ENDMETHOD. METHOD get_data. result = mr_table_data->*. DELETE result WHERE is_table_header = abap_true. result = VALUE #( BASE result ( LINES OF mt_selection_fields_hidden ) ). ENDMETHOD. METHOD get_loop_lines. rv_looplines = mv_looplines. ENDMETHOD. METHOD handle_advanced_mode. IF mr_selfield_line->has_subquery = abap_true. DATA(lv_push_icon_name) = CONV iconname( 'ICON_CHANGE_TEXT' ). DATA(lv_icon_text) = CONV text15( 'Edit' ). LOOP AT SCREEN INTO DATA(ls_screen). IF ls_screen-name = c_fields-low_value OR ls_screen-name = c_fields-high_value OR ls_screen-name = c_fields-system_value_type OR ls_screen-name = c_fields-option OR ls_screen-name = c_fields-push. ls_screen-input = 0. MODIFY SCREEN FROM ls_screen. ENDIF. ENDLOOP. ELSE. lv_push_icon_name = 'ICON_CREATE_TEXT'. lv_icon_text = 'Select'. ENDIF. zcl_dbbr_icon_handler=>create_icon( EXPORTING iv_icon_name = lv_push_icon_name iv_text = lv_icon_text iv_info = |Query { lv_icon_text }| IMPORTING ev_info_text = DATA(lv_icon_info_text) ev_push = mr_subquery_icon->* ). " set new indexes for columns LOOP AT mr_tableview->cols ASSIGNING FIELD-SYMBOL(<ls_table_column>). CASE <ls_table_column>-screen-group3. WHEN 'ADV'. <ls_table_column>-invisible = COND #( WHEN mr_global_data->advanced_mode = abap_true THEN 0 ELSE 1 ). ENDCASE. ENDLOOP. ENDMETHOD. METHOD handle_column_optimization. FIELD-SYMBOLS: <ls_table_column> TYPE scxtab_column. DATA: lv_low_high_width TYPE i VALUE 25, lv_fieldname_width TYPE i VALUE 20, lv_group_by_width TYPE i VALUE 8. IF mr_global_data->selscr_compact_col_widths = abap_true. lv_low_high_width = 17. lv_group_by_width = 5. ENDIF. " try to condense the fields to make more columns visible LOOP AT mr_tableview->cols ASSIGNING <ls_table_column>. CASE <ls_table_column>-screen-name. WHEN 'GS_SELFIELDS-DESCRIPTION'. <ls_table_column>-vislength = 25. WHEN c_fields-low_value. <ls_table_column>-vislength = lv_low_high_width. WHEN c_fields-high_value. <ls_table_column>-vislength = lv_low_high_width. WHEN c_fields-group_by. <ls_table_column>-vislength = lv_group_by_width. WHEN c_fields-totals. <ls_table_column>-vislength = lv_group_by_width. WHEN 'GS_SELFIELDS-FIELDNAME_RAW'. <ls_table_column>-vislength = lv_fieldname_width. ENDCASE. ENDLOOP. ENDMETHOD. METHOD handle_expand_column. ENDMETHOD. METHOD handle_table_header_row. DATA: ls_screen TYPE screen. " mark join table headers IF mr_selfield_line->is_table_header = abap_true. " create correct icon for expansion/compression of table node IF get_util( )->mo_data->is_multi_table_mode( ). IF mr_selfield_line->tree_collapsed = abap_false. DATA(lv_info) = CONV iconquick( 'Collapse Fields' ). DATA(lv_icon) = CONV iconname( 'ICON_COLLAPSE' ). ELSE. lv_info = 'Expand Fields'. lv_icon = 'ICON_EXPAND'. ENDIF. zcl_dbbr_icon_handler=>create_icon( EXPORTING iv_icon_name = lv_icon iv_info = lv_info IMPORTING ev_push = mr_expand_button->* ). ENDIF. LOOP AT SCREEN INTO ls_screen. IF ls_screen-group1 = 'INP' OR ls_screen-group3 = 'ICN' OR ls_screen-name = c_fields-option. ls_screen-active = 0. ENDIF. IF ls_screen-group2 = 'TXT'. ls_screen-intensified = 1. ENDIF. MODIFY SCREEN FROM ls_screen. ENDLOOP. ELSE. LOOP AT SCREEN INTO ls_screen. IF ls_screen-group1 = 'EXP'. ls_screen-active = 0. MODIFY SCREEN FROM ls_screen. ENDIF. ENDLOOP. ENDIF. ENDMETHOD. METHOD handle_tech_first_setting. DATA: lv_temp_index TYPE sy-index. " get current indexes of tech- and normal fieldname columns DATA(lv_tech_fieldname_index) = get_col_index( iv_group4 = 'TEC' ). DATA(lv_fieldname_index) = get_col_index( iv_group4 = 'FLD' ). IF mr_global_data->tech_first = abap_true. IF lv_tech_fieldname_index > lv_fieldname_index. lv_temp_index = lv_tech_fieldname_index. lv_tech_fieldname_index = lv_fieldname_index. lv_fieldname_index = lv_temp_index. ENDIF. ELSE. IF lv_fieldname_index > lv_tech_fieldname_index. lv_temp_index = lv_fieldname_index. lv_fieldname_index = lv_tech_fieldname_index. lv_tech_fieldname_index = lv_temp_index. ENDIF. ENDIF. " set new indexes for columns LOOP AT mr_tableview->cols ASSIGNING FIELD-SYMBOL(<ls_table_column>). CASE <ls_table_column>-screen-group4. WHEN 'TEC'. <ls_table_column>-index = lv_tech_fieldname_index. WHEN 'FLD'. <ls_table_column>-index = lv_fieldname_index. ENDCASE. ENDLOOP. ENDMETHOD. METHOD scroll_to_first_field_of_table. DATA(lt_selfields) = mr_table_data->*. ASSIGN mr_table_data->*[ tabname = iv_tabname ] TO FIELD-SYMBOL(<ls_selfield>). IF sy-subrc = 0. mr_tableview->top_line = sy-tabix. ENDIF. ENDMETHOD. METHOD scroll_to_next_table. CHECK mr_tableview->top_line > 0. DATA(lv_index_of_current_table) = line_index( it_tablist[ tabname = mr_table_data->*[ mr_tableview->top_line ]-tabname ] ). IF lv_index_of_current_table <> 0 AND lv_index_of_current_table <> lines( it_tablist ). scroll_to_first_field_of_table( it_tablist[ lv_index_of_current_table + 1 ]-tabname ). ENDIF. ENDMETHOD. METHOD scroll_to_previous_table. CHECK mr_tableview->top_line > 0. DATA(lv_index_of_current_table) = line_index( it_tablist[ tabname = mr_table_data->*[ mr_tableview->top_line ]-tabname ] ). IF lv_index_of_current_table <> 0 AND lv_index_of_current_table <> 1. scroll_to_first_field_of_table( it_tablist[ lv_index_of_current_table - 1 ]-tabname ). ENDIF. ENDMETHOD. METHOD scroll_to_next_criteria. CHECK mr_tableview->top_line > 0. DATA(lv_current) = mv_current_line. IF lv_current <= 0. lv_current = mr_tableview->top_line. ENDIF. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_table_data>) FROM lv_current + 1 WHERE low IS NOT INITIAL OR high IS NOT INITIAL OR option IS NOT INITIAL OR push IS NOT INITIAL. mr_tableview->top_line = sy-tabix. EXIT. ENDLOOP. ENDMETHOD. METHOD scroll_to_previous_criteria. CHECK mr_tableview->top_line > 1. DATA(lv_current) = mv_current_line. IF lv_current <= 0. lv_current = mr_tableview->top_line. ELSEIF lv_current = mr_tableview->top_line. lv_current = lv_current - 1. ENDIF. WHILE lv_current > 0. ASSIGN mr_table_data->*[ lv_current ] TO FIELD-SYMBOL(<ls_line>). IF sy-subrc = 0. IF <ls_line>-low IS NOT INITIAL OR <ls_line>-high IS NOT INITIAL OR <ls_line>-option IS NOT INITIAL OR <ls_line>-push IS NOT INITIAL. mr_tableview->top_line = lv_current. EXIT. ENDIF. ELSE. EXIT. ENDIF. lv_current = lv_current - 1. ENDWHILE. ENDMETHOD. METHOD search_value. *& Description: Search for a value, that the user enters *&---------------------------------------------------------------------* DATA: lt_table_fields TYPE lty_t_col_selection. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_table_field>) WHERE is_table_header = abap_false. DATA(lv_tabix) = sy-tabix. lt_table_fields = VALUE #( BASE lt_table_fields ( idx = lv_tabix tabname = <ls_table_field>-tabname_alias tech_fieldname = <ls_table_field>-fieldname fieldname = <ls_table_field>-fieldname_raw description = <ls_table_field>-description ) ). ENDLOOP. DATA(lv_chosen_index) = NEW lcl_find_table_field_view( it_col = lt_table_fields if_hide_tabname_field = xsdbool( NOT get_util( )->mo_data->mo_tabfield_list->has_multiple_tables( ) ) )->get_chosen_field_index( ). IF lv_chosen_index <> 0. mr_tableview->top_line = lv_chosen_index. rf_search_successful = abap_true. ENDIF. ENDMETHOD. METHOD set_lowercase_setting. DATA(lr_s_current_line) = CAST zdbbr_selfield( zif_uitb_table~get_current_line_ref( ) ). CHECK lr_s_current_line IS BOUND. IF lr_s_current_line->lowercase = abap_true . lr_s_current_line->lowercase = abap_false. ELSE. lr_s_current_line->lowercase = abap_true. ENDIF. ENDMETHOD. METHOD update_input_field_status. *.. depending on the select option, not all fields are inputable DATA(ls_sel_init) = zcl_dbbr_selopt_util=>get_selopt_control( mr_selfield_line->option ). *.. Deactivate all field input IF ls_sel_init-no_input = abap_true. LOOP AT SCREEN. IF screen-name = c_fields-low_value OR screen-name = c_fields-high_value OR screen-name = c_fields-push OR screen-name = c_fields-system_value_type OR screen-name = c_fields-group_by OR screen-name = c_fields-aggregation. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ELSE. IF ls_sel_init-high <> abap_true. LOOP AT SCREEN. IF screen-name = c_fields-high_value. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF ls_sel_init-low <> abap_true. LOOP AT SCREEN. IF screen-name = c_fields-low_value. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF ls_sel_init-no_multi = abap_true. LOOP AT SCREEN. IF screen-name = c_fields-push OR screen-name = c_fields-system_value_type. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. IF ls_sel_init-no_aggregation = abap_true. LOOP AT SCREEN. IF screen-name = c_fields-group_by OR screen-name = c_fields-aggregation. screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP. ENDIF. ENDIF. IF mr_selfield_line->is_parameter = abap_true. LOOP AT SCREEN. IF screen-name = c_fields-high_value OR screen-name = c_fields-push. IF mr_selfield_line->is_range_param = abap_false. screen-active = 0. MODIFY SCREEN. ENDIF. ELSEIF screen-name = c_fields-group_by OR screen-name = c_fields-aggregation. screen-active = 0. MODIFY SCREEN. ELSEIF screen-name = c_fields-low_value. IF mr_selfield_line->is_range_param = abap_false. screen-required = 2. MODIFY SCREEN. ENDIF. ELSEIF screen-name = c_fields-option. IF mr_selfield_line->is_range_param = abap_false. screen-input = 0. MODIFY SCREEN. ENDIF. ENDIF. ENDLOOP. ENDIF. ENDMETHOD. METHOD zif_uitb_page_scroller~scroll_page_bottom. mr_tableview->top_line = mv_linecount - mv_looplines + 1. IF mr_tableview->top_line < 1. mr_tableview->top_line = 1. ENDIF. ENDMETHOD. METHOD zif_uitb_page_scroller~scroll_page_down. mr_tableview->top_line = mr_tableview->top_line + mv_looplines. IF mr_tableview->top_line >= mv_linecount. mr_tableview->top_line = mv_linecount - mv_looplines + 1. IF mr_tableview->top_line < 1. mr_tableview->top_line = 1. ENDIF. ENDIF. ENDMETHOD. METHOD zif_uitb_page_scroller~scroll_page_top. mr_tableview->top_line = 1. ENDMETHOD. METHOD zif_uitb_page_scroller~scroll_page_up. mr_tableview->top_line = mr_tableview->top_line - mv_looplines. IF mr_tableview->top_line < 1. mr_tableview->top_line = 1. ENDIF. ENDMETHOD. METHOD zif_uitb_table~add_line ##needed. ENDMETHOD. METHOD zif_uitb_table~delete_all. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_selfield>). delete_line_values( CHANGING cs_selfields = <ls_selfield> ). " delete possible multi select data DELETE mr_selfields_multi->* WHERE tabname = <ls_selfield>-tabname AND fieldname = <ls_selfield>-fieldname. ENDLOOP. ENDMETHOD. METHOD zif_uitb_table~delete_current_line. DATA(lv_current_line) = get_current_line( ). ASSIGN mr_table_data->*[ lv_current_line ] TO FIELD-SYMBOL(<ls_current_line>). IF <ls_current_line> IS ASSIGNED. delete_line_values( CHANGING cs_selfields = <ls_current_line> ). DELETE mr_selfields_multi->* WHERE tabname = <ls_current_line>-tabname AND fieldname = <ls_current_line>-fieldname. ENDIF. ENDMETHOD. METHOD zif_uitb_table~determine_current_line. GET CURSOR LINE mv_current_line. mv_current_line = mv_current_line + mr_tableview->top_line - 1. ENDMETHOD. METHOD zif_uitb_table~determine_line_count. mv_linecount = lines( mr_table_data->* ). mr_tableview->lines = mv_linecount. ENDMETHOD. METHOD zif_uitb_table~get_current_line_index. rv_index = mv_current_line. ENDMETHOD. METHOD zif_uitb_table~get_current_line_ref. zif_uitb_table~determine_current_line( ). IF mv_current_line = 0. RETURN. ENDIF. rr_line = REF #( mr_table_data->*[ mv_current_line ] ). ENDMETHOD. METHOD zif_uitb_table~get_current_loop_line. rv_current_loop_line = mv_current_line - mr_tableview->top_line + 1. ENDMETHOD. METHOD zif_uitb_table~pbo. DATA: ls_screen TYPE screen. IF mr_selfield_line->inttype IS NOT INITIAL AND NOT zcl_sat_system_helper=>syst_value_allwd_for_inttyp( mr_selfield_line->inttype ). LOOP AT SCREEN INTO ls_screen. IF ls_screen-name = c_fields-system_value_type. ls_screen-active = 0. MODIFY SCREEN FROM ls_screen. ENDIF. ENDLOOP. ENDIF. IF mr_selfield_line->push = abap_true. DATA(lv_push_icon_name) = CONV iconname( 'ICON_DISPLAY_MORE' ). ELSE. lv_push_icon_name = 'ICON_ENTER_MORE'. ENDIF. zcl_dbbr_icon_handler=>create_icon( EXPORTING iv_icon_name = lv_push_icon_name IMPORTING ev_push = mr_push_icon->* ). mr_option_icon->* = zcl_dbbr_selopt_util=>create_option_icon( iv_option = mr_selfield_line->option iv_sign = mr_selfield_line->sign ). *.. update other field attributes IF mr_selfield_line->system_value_type <> space. LOOP AT SCREEN INTO ls_screen. IF ls_screen-group4 = 'CLD'. ls_screen-input = 0. MODIFY SCREEN FROM ls_screen. ENDIF. ENDLOOP. ENDIF. IF mr_selfield_line->is_numeric = abap_false. LOOP AT SCREEN INTO ls_screen. IF ls_screen-name = c_fields-totals. ls_screen-active = 0. MODIFY SCREEN FROM ls_screen. EXIT. ENDIF. ENDLOOP. ENDIF. update_input_field_status( ). handle_table_header_row( ). " mark key fields as intensified IF mr_selfield_line->key = abap_true. LOOP AT SCREEN. IF screen-group2 = 'TXT'. screen-intensified = 1. ENDIF. MODIFY SCREEN. ENDLOOP. ENDIF. " .check for LCHR or String and do not allow input (more than 1333 character in datatype LCHR) IF mr_selfield_line->datatype = 'LCHR' OR mr_selfield_line->inttype = cl_abap_typedescr=>typekind_string. LOOP AT SCREEN. IF screen-group1 = 'INP'. screen-input = 0. ENDIF. IF screen-group3 = 'OPT' OR screen-group3 = 'ICN'. screen-input = 0. screen-invisible = 1. ENDIF. MODIFY SCREEN. ENDLOOP. ENDIF. " set field to outputlength of current table column field LOOP AT SCREEN. IF screen-name = c_fields-low_value OR screen-name = c_fields-high_value. screen-length = mr_selfield_line->outputlen. ENDIF. MODIFY SCREEN. ENDLOOP. *.. IF table has NO LINES disable ALL INPUT IF mr_tableview->current_line > mv_linecount. LOOP AT SCREEN. screen-input = 0. MODIFY SCREEN. ENDLOOP. ENDIF. ENDMETHOD. METHOD zif_uitb_table~update_fields. *&---------------------------------------------------------------------* *& Description: Updates the internal table from the table control *&---------------------------------------------------------------------* CHECK: iv_function_code <> 'DELETE_ALL', iv_function_code <> 'DELETE'. " get current line to get current field values DATA(ls_selfield_old) = mr_table_data->*[ mr_tableview->current_line ]. *.. Check if uppercase conversion should be performed DATA(lf_no_uppercase_conversion) = is_uppercase_conv_disabled( ). " handle calculated system values at first IF mr_selfield_line->system_value_type <> space. check_entered_system_value( ). ELSE. " normal field input DATA(lv_save_low) = mr_selfield_line->low. DATA(lv_save_high) = mr_selfield_line->high. precheck_selfield_value( EXPORTING is_selfield = mr_selfield_line->* if_no_uppercase_conv = lf_no_uppercase_conversion CHANGING cv_value = mr_selfield_line->low ). precheck_selfield_value( EXPORTING is_selfield = mr_selfield_line->* if_no_uppercase_conv = lf_no_uppercase_conversion CHANGING cv_value = mr_selfield_line->high ). TRY. conv_selfields_to_internal( if_no_uppercase_conversion = lf_no_uppercase_conversion ). CATCH zcx_sat_conversion_exc INTO DATA(lx_conv_error). lx_conv_error->zif_sat_exception_message~print( iv_msg_type = 'E' ). RETURN. ENDTRY. check_interval_validity( iv_save_low = lv_save_low iv_save_high = lv_save_high ). check_aggregation_validity( ). """ check if state of `group by `/ `aggregation` changed since last input IF mr_selfield_line->group_by <> ls_selfield_old-group_by OR mr_selfield_line->aggregation <> ls_selfield_old-aggregation OR mr_selfield_line->totals <> ls_selfield_old-totals. RAISE EVENT aggregation_attr_changed. ENDIF. fill_selopt_sign( ). ENDIF. MODIFY mr_table_data->* FROM mr_selfield_line->* INDEX mr_tableview->current_line. ENDMETHOD. METHOD zif_uitb_table~update_screen_attributes. FIELD-SYMBOLS: <ls_table_column> TYPE scxtab_column. *.. control visibility of table and table tool bar DATA(lf_no_table_data) = xsdbool( mr_table_data->* IS INITIAL ). mr_tableview->invisible = lf_no_table_data. DATA(lo_table_tb) = zcl_dbbr_toolbar_util=>get_selscreen_table_tb( ). IF lo_table_tb IS BOUND. lo_table_tb->set_visible( COND #( WHEN lf_no_table_data = abap_true THEN cl_gui_control=>visible_false ELSE cl_gui_control=>visible_true ) ). ENDIF. handle_column_optimization( ). *.. Handle disabled columns LOOP AT mr_tableview->cols ASSIGNING <ls_table_column>. IF <ls_table_column>-screen-group4 = 'NOD'. <ls_table_column>-invisible = 1. ENDIF. ENDLOOP. *.. if user wants the technical view, display more fields DATA(lv_techview_visibility) = COND #( WHEN mr_global_data->tech_view = abap_true THEN 0 ELSE 1 ). LOOP AT mr_tableview->cols ASSIGNING <ls_table_column>. IF <ls_table_column>-screen-group3 = 'TEC'. <ls_table_column>-invisible = lv_techview_visibility. ENDIF. ENDLOOP. *.. technical fieldname before or after more descriptive fieldname handle_tech_first_setting( ). *.. disable aggrations if not asked for IF get_util( )->mo_data->mr_s_settings->disable_aggregations = abap_true. LOOP AT mr_tableview->cols ASSIGNING <ls_table_column>. IF <ls_table_column>-screen-group4 = 'GRP'. <ls_table_column>-invisible = 1. ENDIF. ENDLOOP. ENDIF. *.. disable intervals IF get_util( )->mo_data->mr_s_settings->disable_interval = abap_true. LOOP AT mr_tableview->cols ASSIGNING <ls_table_column>. IF <ls_table_column>-screen-group3 = 'IVA'. <ls_table_column>-invisible = 1. ENDIF. ENDLOOP. ENDIF. handle_advanced_mode( ). get_util( )->handle_table_pbo( ). ENDMETHOD. METHOD select_all_group_by. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_selfield>). <ls_selfield>-group_by = abap_true. ENDLOOP. ENDMETHOD. METHOD unselect_all_group_by. LOOP AT mr_table_data->* ASSIGNING FIELD-SYMBOL(<ls_selfield>). CLEAR: <ls_selfield>-group_by. ENDLOOP. ENDMETHOD. ENDCLASS.
33.522401
147
0.654059
bd47eaac661b241b471f5fcab95b498b721b5638
603
abap
ABAP
src/adt/zif_sat_ty_adt_types.intf.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
9
2019-11-14T12:27:19.000Z
2022-01-26T16:35:09.000Z
src/adt/zif_sat_ty_adt_types.intf.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
13
2019-12-04T15:02:12.000Z
2021-11-25T16:43:12.000Z
src/adt/zif_sat_ty_adt_types.intf.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
4
2019-11-14T13:59:43.000Z
2020-08-05T09:58:30.000Z
"! <p class="shorttext synchronized" lang="en">Type definitions for ADT plugin</p> INTERFACE zif_sat_ty_adt_types PUBLIC . TYPES: "! Where Used information for a CDS view field BEGIN OF ty_s_field_usage, entityid TYPE ddstrucobjname, rawentityid TYPE ddstrucobjname, fieldname TYPE fieldname, ddlname TYPE ddlname, sourcetype TYPE ddddlsrctype, apistate TYPE string, is_calculated TYPE abap_bool, END OF ty_s_field_usage. TYPES: ty_t_field_usage TYPE STANDARD TABLE OF ty_s_field_usage WITH EMPTY KEY. ENDINTERFACE.
31.736842
82
0.706468
bd4a663654e72cef2e7c922e2fbdae3c38124a6c
11,545
abap
ABAP
src/zcl_excel_style_cond.clas.abap
jrodriguez-rc/abap2xlsx
7b48cd0d90583a27bfa1fc97898b14aff79711fb
[ "Apache-2.0" ]
1
2022-01-20T23:59:28.000Z
2022-01-20T23:59:28.000Z
src/zcl_excel_style_cond.clas.abap
gregorwolf/abap2xlsx
5110f924b435e23f4474381d0e43f0686b9d0421
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_style_cond.clas.abap
gregorwolf/abap2xlsx
5110f924b435e23f4474381d0e43f0686b9d0421
[ "Apache-2.0" ]
1
2021-07-09T02:06:21.000Z
2021-07-09T02:06:21.000Z
class ZCL_EXCEL_STYLE_COND definition public final create public . public section. class ZCL_EXCEL_STYLE_CONDITIONAL definition load . *"* public components of class ZCL_EXCEL_STYLE_COND *"* do not include other source files here!!! types tv_conditional_show_value type c length 1. constants C_CFVO_TYPE_FORMULA type ZEXCEL_CONDITIONAL_TYPE value 'formula'. "#EC NOTEXT constants C_CFVO_TYPE_MAX type ZEXCEL_CONDITIONAL_TYPE value 'max'. "#EC NOTEXT constants C_CFVO_TYPE_MIN type ZEXCEL_CONDITIONAL_TYPE value 'min'. "#EC NOTEXT constants C_CFVO_TYPE_NUMBER type ZEXCEL_CONDITIONAL_TYPE value 'num'. "#EC NOTEXT constants C_CFVO_TYPE_PERCENT type ZEXCEL_CONDITIONAL_TYPE value 'percent'. "#EC NOTEXT constants C_CFVO_TYPE_PERCENTILE type ZEXCEL_CONDITIONAL_TYPE value 'percentile'. "#EC NOTEXT constants C_ICONSET_3ARROWS type ZEXCEL_CONDITION_RULE_ICONSET value '3Arrows'. "#EC NOTEXT constants C_ICONSET_3ARROWSGRAY type ZEXCEL_CONDITION_RULE_ICONSET value '3ArrowsGray'. "#EC NOTEXT constants C_ICONSET_3FLAGS type ZEXCEL_CONDITION_RULE_ICONSET value '3Flags'. "#EC NOTEXT constants C_ICONSET_3SIGNS type ZEXCEL_CONDITION_RULE_ICONSET value '3Signs'. "#EC NOTEXT constants C_ICONSET_3SYMBOLS type ZEXCEL_CONDITION_RULE_ICONSET value '3Symbols'. "#EC NOTEXT constants C_ICONSET_3SYMBOLS2 type ZEXCEL_CONDITION_RULE_ICONSET value '3Symbols2'. "#EC NOTEXT constants C_ICONSET_3TRAFFICLIGHTS type ZEXCEL_CONDITION_RULE_ICONSET value ''. "#EC NOTEXT constants C_ICONSET_3TRAFFICLIGHTS2 type ZEXCEL_CONDITION_RULE_ICONSET value '3TrafficLights2'. "#EC NOTEXT constants C_ICONSET_4ARROWS type ZEXCEL_CONDITION_RULE_ICONSET value '4Arrows'. "#EC NOTEXT constants C_ICONSET_4ARROWSGRAY type ZEXCEL_CONDITION_RULE_ICONSET value '4ArrowsGray'. "#EC NOTEXT constants C_ICONSET_4RATING type ZEXCEL_CONDITION_RULE_ICONSET value '4Rating'. "#EC NOTEXT constants C_ICONSET_4REDTOBLACK type ZEXCEL_CONDITION_RULE_ICONSET value '4RedToBlack'. "#EC NOTEXT constants C_ICONSET_4TRAFFICLIGHTS type ZEXCEL_CONDITION_RULE_ICONSET value '4TrafficLights'. "#EC NOTEXT constants C_ICONSET_5ARROWS type ZEXCEL_CONDITION_RULE_ICONSET value '5Arrows'. "#EC NOTEXT constants C_ICONSET_5ARROWSGRAY type ZEXCEL_CONDITION_RULE_ICONSET value '5ArrowsGray'. "#EC NOTEXT constants C_ICONSET_5QUARTERS type ZEXCEL_CONDITION_RULE_ICONSET value '5Quarters'. "#EC NOTEXT constants C_ICONSET_5RATING type ZEXCEL_CONDITION_RULE_ICONSET value '5Rating'. "#EC NOTEXT constants C_OPERATOR_BEGINSWITH type ZEXCEL_CONDITION_OPERATOR value 'beginsWith'. "#EC NOTEXT constants C_OPERATOR_BETWEEN type ZEXCEL_CONDITION_OPERATOR value 'between'. "#EC NOTEXT constants C_OPERATOR_CONTAINSTEXT type ZEXCEL_CONDITION_OPERATOR value 'containsText'. "#EC NOTEXT constants C_OPERATOR_ENDSWITH type ZEXCEL_CONDITION_OPERATOR value 'endsWith'. "#EC NOTEXT constants C_OPERATOR_EQUAL type ZEXCEL_CONDITION_OPERATOR value 'equal'. "#EC NOTEXT constants C_OPERATOR_GREATERTHAN type ZEXCEL_CONDITION_OPERATOR value 'greaterThan'. "#EC NOTEXT constants C_OPERATOR_GREATERTHANOREQUAL type ZEXCEL_CONDITION_OPERATOR value 'greaterThanOrEqual'. "#EC NOTEXT constants C_OPERATOR_LESSTHAN type ZEXCEL_CONDITION_OPERATOR value 'lessThan'. "#EC NOTEXT constants C_OPERATOR_LESSTHANOREQUAL type ZEXCEL_CONDITION_OPERATOR value 'lessThanOrEqual'. "#EC NOTEXT constants C_OPERATOR_NONE type ZEXCEL_CONDITION_OPERATOR value ''. "#EC NOTEXT constants C_OPERATOR_NOTCONTAINS type ZEXCEL_CONDITION_OPERATOR value 'notContains'. "#EC NOTEXT constants C_OPERATOR_NOTEQUAL type ZEXCEL_CONDITION_OPERATOR value 'notEqual'. "#EC NOTEXT constants C_RULE_CELLIS type ZEXCEL_CONDITION_RULE value 'cellIs'. "#EC NOTEXT constants C_RULE_CONTAINSTEXT type ZEXCEL_CONDITION_RULE value 'containsText'. "#EC NOTEXT constants C_RULE_DATABAR type ZEXCEL_CONDITION_RULE value 'dataBar'. "#EC NOTEXT constants C_RULE_EXPRESSION type ZEXCEL_CONDITION_RULE value 'expression'. "#EC NOTEXT constants C_RULE_ICONSET type ZEXCEL_CONDITION_RULE value 'iconSet'. "#EC NOTEXT constants C_RULE_COLORSCALE type ZEXCEL_CONDITION_RULE value 'colorScale'. "#EC NOTEXT constants C_RULE_NONE type ZEXCEL_CONDITION_RULE value 'none'. "#EC NOTEXT constants C_RULE_TOP10 type ZEXCEL_CONDITION_RULE value 'top10'. "#EC NOTEXT constants C_RULE_ABOVE_AVERAGE type ZEXCEL_CONDITION_RULE value 'aboveAverage'. "#EC NOTEXT constants C_SHOWVALUE_FALSE type TV_CONDITIONAL_SHOW_VALUE value 0. "#EC NOTEXT constants C_SHOWVALUE_TRUE type TV_CONDITIONAL_SHOW_VALUE value 1. "#EC NOTEXT data MODE_CELLIS type ZEXCEL_CONDITIONAL_CELLIS . data MODE_COLORSCALE type ZEXCEL_CONDITIONAL_COLORSCALE . data MODE_DATABAR type ZEXCEL_CONDITIONAL_DATABAR . data MODE_EXPRESSION type ZEXCEL_CONDITIONAL_EXPRESSION . data MODE_ICONSET type ZEXCEL_CONDITIONAL_ICONSET . data MODE_TOP10 type ZEXCEL_CONDITIONAL_TOP10 . data MODE_ABOVE_AVERAGE type ZEXCEL_CONDITIONAL_ABOVE_AVG . data PRIORITY type ZEXCEL_STYLE_PRIORITY value 1. "#EC NOTEXT . . . . . . . . . . . . . . . . . . . . " . data RULE type ZEXCEL_CONDITION_RULE . METHODS constructor IMPORTING !ip_guid TYPE zexcel_cell_style OPTIONAL !ip_dimension_range TYPE string. methods GET_DIMENSION_RANGE returning value(EP_DIMENSION_RANGE) type STRING . methods SET_RANGE importing !IP_START_ROW type ZEXCEL_CELL_ROW !IP_START_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA !IP_STOP_ROW type ZEXCEL_CELL_ROW !IP_STOP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA raising ZCX_EXCEL . methods ADD_RANGE importing !IP_START_ROW type ZEXCEL_CELL_ROW !IP_START_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA !IP_STOP_ROW type ZEXCEL_CELL_ROW !IP_STOP_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA raising ZCX_EXCEL . class-methods FACTORY_COND_STYLE_ICONSET importing !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET !IV_ICON_TYPE type ZEXCEL_CONDITION_RULE_ICONSET default C_ICONSET_3TRAFFICLIGHTS2 !IV_CFVO1_TYPE type ZEXCEL_CONDITIONAL_TYPE default C_CFVO_TYPE_PERCENT !IV_CFVO1_VALUE type ZEXCEL_CONDITIONAL_VALUE optional !IV_CFVO2_TYPE type ZEXCEL_CONDITIONAL_TYPE default C_CFVO_TYPE_PERCENT !IV_CFVO2_VALUE type ZEXCEL_CONDITIONAL_VALUE optional !IV_CFVO3_TYPE type ZEXCEL_CONDITIONAL_TYPE default C_CFVO_TYPE_PERCENT !IV_CFVO3_VALUE type ZEXCEL_CONDITIONAL_VALUE optional !IV_CFVO4_TYPE type ZEXCEL_CONDITIONAL_TYPE default C_CFVO_TYPE_PERCENT !IV_CFVO4_VALUE type ZEXCEL_CONDITIONAL_VALUE optional !IV_CFVO5_TYPE type ZEXCEL_CONDITIONAL_TYPE default C_CFVO_TYPE_PERCENT !IV_CFVO5_VALUE type ZEXCEL_CONDITIONAL_VALUE optional !IV_SHOWVALUE type TV_CONDITIONAL_SHOW_VALUE default ZCL_EXCEL_STYLE_COND=>C_SHOWVALUE_TRUE returning value(EO_STYLE_COND) type ref to ZCL_EXCEL_STYLE_COND . methods GET_GUID returning value(EP_GUID) type ZEXCEL_CELL_STYLE . *"* protected components of class ZABAP_EXCEL_STYLE_FONT *"* do not include other source files here!!! *"* protected components of class ZABAP_EXCEL_STYLE_FONT *"* do not include other source files here!!! protected section. private section. data MV_RULE_RANGE type STRING . data GUID type ZEXCEL_CELL_STYLE . ENDCLASS. CLASS ZCL_EXCEL_STYLE_COND IMPLEMENTATION. METHOD ADD_RANGE. DATA: lv_column TYPE zexcel_cell_column, lv_row_alpha TYPE string, lv_col_alpha TYPE string, lv_coords1 TYPE string, lv_coords2 TYPE string. lv_column = zcl_excel_common=>convert_column2int( ip_start_column ). * me->mv_cell_data-cell_row = 1. * me->mv_cell_data-cell_column = lv_column. * lv_col_alpha = ip_start_column. lv_row_alpha = ip_start_row. SHIFT lv_row_alpha RIGHT DELETING TRAILING space. SHIFT lv_row_alpha LEFT DELETING LEADING space. CONCATENATE lv_col_alpha lv_row_alpha INTO lv_coords1. IF ip_stop_column IS NOT INITIAL. lv_column = zcl_excel_common=>convert_column2int( ip_stop_column ). ELSE. lv_column = zcl_excel_common=>convert_column2int( ip_start_column ). ENDIF. IF ip_stop_row IS NOT INITIAL. " If we don't get explicitly a stop column use start column lv_row_alpha = ip_stop_row. ELSE. lv_row_alpha = ip_start_row. ENDIF. IF ip_stop_column IS NOT INITIAL. " If we don't get explicitly a stop column use start column lv_col_alpha = ip_stop_column. ELSE. lv_col_alpha = ip_start_column. ENDIF. SHIFT lv_row_alpha RIGHT DELETING TRAILING space. SHIFT lv_row_alpha LEFT DELETING LEADING space. CONCATENATE lv_col_alpha lv_row_alpha INTO lv_coords2. IF lv_coords2 IS NOT INITIAL AND lv_coords2 <> lv_coords1. CONCATENATE me->mv_rule_range ` ` lv_coords1 ':' lv_coords2 INTO me->mv_rule_range. ELSE. CONCATENATE me->mv_rule_range ` ` lv_coords1 INTO me->mv_rule_range. ENDIF. SHIFT me->mv_rule_range LEFT DELETING LEADING space. ENDMETHOD. METHOD constructor. DATA: ls_iconset TYPE zexcel_conditional_iconset. ls_iconset-iconset = zcl_excel_style_cond=>c_iconset_3trafficlights. ls_iconset-cfvo1_type = zcl_excel_style_cond=>c_cfvo_type_percent. ls_iconset-cfvo1_value = '0'. ls_iconset-cfvo2_type = zcl_excel_style_cond=>c_cfvo_type_percent. ls_iconset-cfvo2_value = '20'. ls_iconset-cfvo3_type = zcl_excel_style_cond=>c_cfvo_type_percent. ls_iconset-cfvo3_value = '40'. ls_iconset-cfvo4_type = zcl_excel_style_cond=>c_cfvo_type_percent. ls_iconset-cfvo4_value = '60'. ls_iconset-cfvo5_type = zcl_excel_style_cond=>c_cfvo_type_percent. ls_iconset-cfvo5_value = '80'. me->rule = zcl_excel_style_cond=>c_rule_none. * me->iconset->operator = zcl_excel_style_conditional=>c_operator_none. me->mode_iconset = ls_iconset. me->priority = 1. * inizialize dimension range me->mv_rule_range = ip_dimension_range. IF ip_guid IS NOT INITIAL. me->guid = ip_guid. ELSE. me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). ENDIF. ENDMETHOD. METHOD FACTORY_COND_STYLE_ICONSET. *--------------------------------------------------------------------* * Work in progress * Missing: LE or LT may be specified --> extend structure ZEXCEL_CONDITIONAL_ICONSET to hold this information as well *--------------------------------------------------------------------* * DATA: lv_needed_values TYPE i. * CASE icon_type. * * WHEN 'C_ICONSET_3ARROWS' * OR 'C_ICONSET_3ARROWSGRAY' * OR 'C_ICONSET_3FLAGS' * OR 'C_ICONSET_3SIGNS' * OR 'C_ICONSET_3SYMBOLS' * OR 'C_ICONSET_3SYMBOLS2' * OR 'C_ICONSET_3TRAFFICLIGHTS' * OR 'C_ICONSET_3TRAFFICLIGHTS2'. * lv_needed_values = 3. * * WHEN 'C_ICONSET_4ARROWS' * OR 'C_ICONSET_4ARROWSGRAY' * OR 'C_ICONSET_4RATING' * OR 'C_ICONSET_4REDTOBLACK' * OR 'C_ICONSET_4TRAFFICLIGHTS'. * lv_needed_values = 4. * * WHEN 'C_ICONSET_5ARROWS' * OR 'C_ICONSET_5ARROWSGRAY' * OR 'C_ICONSET_5QUARTERS' * OR 'C_ICONSET_5RATING'. * lv_needed_values = 5. * * WHEN OTHERS. * RETURN. * ENDCASE. ENDMETHOD. METHOD GET_DIMENSION_RANGE. ep_dimension_range = me->mv_rule_range. ENDMETHOD. METHOD GET_GUID. ep_guid = me->guid. ENDMETHOD. METHOD SET_RANGE. CLEAR: me->mv_rule_range. me->add_range( ip_start_row = ip_start_row ip_start_column = ip_start_column ip_stop_row = ip_stop_row ip_stop_column = ip_stop_column ). ENDMETHOD. ENDCLASS.
42.759259
126
0.774275
bd4ab56a246d68b4df990960fcae6533f9915dc3
430
abap
ABAP
src/zatt_converter/zif_att_trace_converter.intf.abap
JohannesKonings/abap-trace-tender
18cdefe29c3b4d1fe5f4c5a090cca41d234a7b97
[ "MIT" ]
7
2021-02-14T17:40:37.000Z
2021-03-10T12:23:26.000Z
src/zatt_converter/zif_att_trace_converter.intf.abap
JohannesKonings/abap-trace-tender
18cdefe29c3b4d1fe5f4c5a090cca41d234a7b97
[ "MIT" ]
150
2021-03-01T08:59:24.000Z
2022-03-31T02:08:10.000Z
src/zatt_converter/zif_att_trace_converter.intf.abap
JohannesKonings/abap-trace-tender
18cdefe29c3b4d1fe5f4c5a090cca41d234a7b97
[ "MIT" ]
2
2021-02-14T17:17:24.000Z
2021-12-17T21:50:17.000Z
INTERFACE zif_att_trace_converter PUBLIC. TYPES: BEGIN OF ty_converted_trace, trace_id TYPE sysuuid_c32, json TYPE string, END OF ty_converted_trace. METHODS convert IMPORTING trace TYPE REF TO zcl_att_trace_transaction customizing TYPE REF TO zcl_att_customizing RETURNING VALUE(converted_trace) TYPE ty_converted_trace. ENDINTERFACE.
28.666667
74
0.67907
bd50872fde181240239e5069fc4e980912a25d5f
14,489
abap
ABAP
src/objects/zcl_abapgit_object_w3xx_super.clas.abap
DerGuteWolf/abapGit
5c7baae1abef1da337dc2b4e7df9cd14be9201e4
[ "MIT" ]
1
2021-01-15T12:53:24.000Z
2021-01-15T12:53:24.000Z
src/objects/zcl_abapgit_object_w3xx_super.clas.abap
JustACasual/abapGit
6b36f43052bb6a4a53dcc7e655eb8845153b0476
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_w3xx_super.clas.abap
JustACasual/abapGit
6b36f43052bb6a4a53dcc7e655eb8845153b0476
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_w3xx_super DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super ABSTRACT CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . TYPES: ty_wwwparams_tt TYPE STANDARD TABLE OF wwwparams WITH DEFAULT KEY . CONSTANTS: BEGIN OF c_param_names, version TYPE w3_name VALUE 'version', fileext TYPE w3_name VALUE 'fileextension', filesize TYPE w3_name VALUE 'filesize', filename TYPE w3_name VALUE 'filename', mimetype TYPE w3_name VALUE 'mimetype', END OF c_param_names . METHODS constructor IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_item !iv_language TYPE spras . PROTECTED SECTION. TYPES ty_bdcdata TYPE STANDARD TABLE OF bdcdata WITH NON-UNIQUE DEFAULT KEY. METHODS get_metadata REDEFINITION. METHODS change_bdc_jump_data ABSTRACT CHANGING ct_bdcdata TYPE ty_bdcdata. PRIVATE SECTION. DATA ms_key TYPE wwwdatatab. METHODS get_ext IMPORTING it_params TYPE ty_wwwparams_tt RETURNING VALUE(rv_ext) TYPE string RAISING zcx_abapgit_exception. METHODS normalize_params IMPORTING iv_size TYPE i CHANGING ct_params TYPE ty_wwwparams_tt " Param table to patch RAISING zcx_abapgit_exception. METHODS strip_params CHANGING ct_params TYPE ty_wwwparams_tt RAISING zcx_abapgit_exception. METHODS find_param IMPORTING it_params TYPE ty_wwwparams_tt iv_name TYPE w3_name RETURNING VALUE(rv_value) TYPE string RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_object_w3xx_super IMPLEMENTATION. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). ms_key-relid = ms_item-obj_type+2(2). ms_key-objid = ms_item-obj_name. ENDMETHOD. METHOD find_param. FIELD-SYMBOLS <ls_param> LIKE LINE OF it_params. READ TABLE it_params ASSIGNING <ls_param> WITH KEY name = iv_name. IF sy-subrc > 0. zcx_abapgit_exception=>raise( |W3xx: Cannot find { iv_name } for { ms_key-objid }| ). ENDIF. rv_value = <ls_param>-value. ENDMETHOD. METHOD get_ext. rv_ext = find_param( it_params = it_params iv_name = c_param_names-fileext ). SHIFT rv_ext LEFT DELETING LEADING '.'. ENDMETHOD. METHOD get_metadata. rs_metadata = super->get_metadata( ). rs_metadata-version = 'v2.0.0'. " Serialization v2, separate data file rs_metadata-delete_tadir = abap_true. ENDMETHOD. METHOD normalize_params. FIELD-SYMBOLS <ls_param> LIKE LINE OF ct_params. " Ensure filesize param exists READ TABLE ct_params ASSIGNING <ls_param> WITH KEY name = c_param_names-filesize. IF sy-subrc <> 0. APPEND INITIAL LINE TO ct_params ASSIGNING <ls_param>. <ls_param>-name = c_param_names-filesize. ENDIF. LOOP AT ct_params ASSIGNING <ls_param>. <ls_param>-relid = ms_key-relid. " Ensure param key = object key <ls_param>-objid = ms_key-objid. IF <ls_param>-name = c_param_names-filesize. " Patch filesize = real file size <ls_param>-value = iv_size. CONDENSE <ls_param>-value. ENDIF. ENDLOOP. ENDMETHOD. METHOD strip_params. FIELD-SYMBOLS <ls_param> LIKE LINE OF ct_params. " Remove path from filename find_param( it_params = ct_params iv_name = c_param_names-filename ). " Check exists READ TABLE ct_params ASSIGNING <ls_param> WITH KEY name = c_param_names-filename. <ls_param>-value = zcl_abapgit_path=>get_filename_from_syspath( |{ <ls_param>-value }| ). " Clear version & filesize DELETE ct_params WHERE name = c_param_names-version. DELETE ct_params WHERE name = c_param_names-filesize. ENDMETHOD. METHOD zif_abapgit_object~changed_by. SELECT SINGLE chname INTO rv_user FROM wwwdata WHERE relid = ms_key-relid AND objid = ms_key-objid AND srtf2 = 0. IF sy-subrc IS NOT INITIAL OR rv_user IS INITIAL. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. CALL FUNCTION 'WWWDATA_DELETE' EXPORTING key = ms_key EXCEPTIONS wrong_object_type = 1 delete_error = 2. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot delete W3xx data' ). ENDIF. CALL FUNCTION 'WWWPARAMS_DELETE_ALL' EXPORTING key = ms_key EXCEPTIONS delete_error = 1. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot delete W3xx params' ). ENDIF. corr_insert( iv_package ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA lv_base64str TYPE string. DATA lt_w3params TYPE STANDARD TABLE OF wwwparams. DATA lv_xstring TYPE xstring. DATA lt_w3mime TYPE STANDARD TABLE OF w3mime. DATA lt_w3html TYPE STANDARD TABLE OF w3html. DATA lv_size TYPE i. DATA lv_tadir_obj TYPE tadir-object. io_xml->read( EXPORTING iv_name = 'TEXT' CHANGING cg_data = ms_key-text ). io_xml->read( EXPORTING iv_name = 'PARAMS' CHANGING cg_data = lt_w3params ). CASE io_xml->get_metadata( )-version. WHEN 'v1.0.0'. io_xml->read( EXPORTING iv_name = 'DATA' CHANGING cg_data = lv_base64str ). lv_xstring = cl_http_utility=>decode_x_base64( lv_base64str ). WHEN 'v2.0.0'. lv_xstring = zif_abapgit_object~mo_files->read_raw( iv_extra = 'data' iv_ext = get_ext( lt_w3params ) ). WHEN OTHERS. zcx_abapgit_exception=>raise( 'W3xx: Unknown serializer version' ). ENDCASE. CASE ms_key-relid. WHEN 'MI'. CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING buffer = lv_xstring IMPORTING output_length = lv_size TABLES binary_tab = lt_w3mime. WHEN 'HT'. CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING buffer = lv_xstring IMPORTING output_length = lv_size TABLES binary_tab = lt_w3mime. CALL FUNCTION 'SCMS_BINARY_TO_TEXT' EXPORTING input_length = lv_size IMPORTING output_length = lv_size TABLES binary_tab = lt_w3mime text_tab = lt_w3html EXCEPTIONS failed = 1. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot update W3xx params' ). ENDIF. CLEAR lt_w3mime. WHEN OTHERS. zcx_abapgit_exception=>raise( 'Wrong W3xx type' ). ENDCASE. " Update size of file based on actual data file size, prove param object name normalize_params( EXPORTING iv_size = lv_size CHANGING ct_params = lt_w3params ). CALL FUNCTION 'WWWPARAMS_UPDATE' TABLES params = lt_w3params EXCEPTIONS update_error = 1. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot update W3xx params' ). ENDIF. ms_key-tdate = sy-datum. ms_key-ttime = sy-uzeit. ms_key-chname = sy-uname. ms_key-devclass = iv_package. CALL FUNCTION 'WWWDATA_EXPORT' EXPORTING key = ms_key TABLES mime = lt_w3mime html = lt_w3html EXCEPTIONS wrong_object_type = 1 export_error = 2. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot upload W3xx data' ). ENDIF. CONCATENATE 'W3' ms_key-relid INTO lv_tadir_obj. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_tadir_pgmid = 'R3TR' wi_tadir_object = lv_tadir_obj wi_tadir_devclass = iv_package wi_tadir_obj_name = ms_key-objid wi_test_modus = space EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 99. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot update TADIR for W3xx' ). ENDIF. corr_insert( iv_package ). ENDMETHOD. METHOD zif_abapgit_object~exists. SELECT SINGLE objid INTO ms_key-objid FROM wwwdata WHERE relid = ms_key-relid AND objid = ms_key-objid AND srtf2 = 0. IF sy-subrc IS NOT INITIAL. RETURN. ENDIF. rv_bool = abap_true. ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. DATA: lv_object TYPE eqegraarg. lv_object = |{ ms_item-obj_type+2(2) }{ ms_item-obj_name }|. OVERLAY lv_object WITH ' '. lv_object = lv_object && '*'. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'E_WWW_HTML' iv_argument = lv_object ). ENDMETHOD. METHOD zif_abapgit_object~jump. DATA: ls_bdcdata TYPE bdcdata, lt_bdcdata TYPE ty_bdcdata. ls_bdcdata-program = 'SAPMWWW0'. ls_bdcdata-dynpro = '0100'. ls_bdcdata-dynbegin = 'X'. APPEND ls_bdcdata TO lt_bdcdata. change_bdc_jump_data( CHANGING ct_bdcdata = lt_bdcdata ). CLEAR ls_bdcdata. ls_bdcdata-fnam = 'BDC_OKCODE'. ls_bdcdata-fval = '=CRO1'. APPEND ls_bdcdata TO lt_bdcdata. ls_bdcdata-program = 'RSWWWSHW'. ls_bdcdata-dynpro = '1000'. ls_bdcdata-dynbegin = 'X'. APPEND ls_bdcdata TO lt_bdcdata. CLEAR ls_bdcdata. ls_bdcdata-fnam = 'SO_OBJID-LOW'. ls_bdcdata-fval = ms_item-obj_name. APPEND ls_bdcdata TO lt_bdcdata. CLEAR ls_bdcdata. ls_bdcdata-fnam = 'BDC_OKCODE'. ls_bdcdata-fval = '=ONLI'. APPEND ls_bdcdata TO lt_bdcdata. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SMW0' mode_val = 'E' TABLES using_tab = lt_bdcdata EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, SE35' ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA lt_w3mime TYPE STANDARD TABLE OF w3mime. DATA lt_w3html TYPE STANDARD TABLE OF w3html. DATA lt_w3params TYPE STANDARD TABLE OF wwwparams. DATA lv_xstring TYPE xstring. DATA lv_size TYPE i. SELECT SINGLE * INTO CORRESPONDING FIELDS OF ms_key FROM wwwdata WHERE relid = ms_key-relid AND objid = ms_key-objid AND srtf2 = 0. IF sy-subrc IS NOT INITIAL. RETURN. ENDIF. CALL FUNCTION 'WWWDATA_IMPORT' EXPORTING key = ms_key TABLES mime = lt_w3mime html = lt_w3html EXCEPTIONS wrong_object_type = 1 import_error = 2. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot read W3xx data' ). ENDIF. CALL FUNCTION 'WWWPARAMS_READ_ALL' EXPORTING type = ms_key-relid objid = ms_key-objid TABLES params = lt_w3params EXCEPTIONS entry_not_exists = 1. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot read W3xx data' ). ENDIF. lv_size = find_param( it_params = lt_w3params iv_name = c_param_names-filesize ). " Clean params (remove version, filesize & clear filename from path) strip_params( CHANGING ct_params = lt_w3params ). CASE ms_key-relid. WHEN 'MI'. CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' EXPORTING input_length = lv_size IMPORTING buffer = lv_xstring TABLES binary_tab = lt_w3mime EXCEPTIONS failed = 1. WHEN 'HT'. CALL FUNCTION 'SCMS_TEXT_TO_XSTRING' IMPORTING buffer = lv_xstring TABLES text_tab = lt_w3html EXCEPTIONS failed = 1. WHEN OTHERS. zcx_abapgit_exception=>raise( 'Wrong W3xx type' ). ENDCASE. IF sy-subrc IS NOT INITIAL. zcx_abapgit_exception=>raise( 'Cannot convert W3xx to xstring' ). ENDIF. io_xml->add( iv_name = 'NAME' ig_data = ms_key-objid ). io_xml->add( iv_name = 'TEXT' ig_data = ms_key-text ). io_xml->add( iv_name = 'PARAMS' ig_data = lt_w3params ). " Seriazation v2, separate data file. 'extra' added to prevent conflict with .xml zif_abapgit_object~mo_files->add_raw( iv_data = lv_xstring iv_extra = 'data' iv_ext = get_ext( lt_w3params ) ). ENDMETHOD. ENDCLASS.
27.545627
93
0.615363
bd51d48f38049c2f83533c9adde8515778eb65eb
3,643
abap
ABAP
src/zcl_btci_transaction.clas.abap
sandraros/batch-input-helper
babb0dadb18fc5e85bfa7630e3ca2bfe57049d24
[ "MIT" ]
2
2018-08-25T16:39:13.000Z
2022-01-13T12:06:21.000Z
src/zcl_btci_transaction.clas.abap
sandraros/batch-input-helper
babb0dadb18fc5e85bfa7630e3ca2bfe57049d24
[ "MIT" ]
1
2021-04-28T07:43:36.000Z
2021-04-29T10:36:06.000Z
src/zcl_btci_transaction.clas.abap
sandraros/batch-input-helper
babb0dadb18fc5e85bfa7630e3ca2bfe57049d24
[ "MIT" ]
2
2021-04-29T08:29:57.000Z
2022-01-13T12:11:03.000Z
CLASS zcl_btci_transaction DEFINITION PUBLIC FINAL CREATE PRIVATE GLOBAL FRIENDS zcl_btci . PUBLIC SECTION. TYPES td_display_mode TYPE char01 . TYPES td_update_mode TYPE char01 . TYPES: ty_dynpros TYPE STANDARD TABLE OF REF TO zcl_btci_dynpro WITH DEFAULT KEY . DATA aud_tcode TYPE tcode READ-ONLY . DATA aut_bdcdata TYPE wdkbdcdata_tty READ-ONLY . CONSTANTS: "! Runs the batch input with SY-BATCH unchanged (' ' if interactive, 'X' if background) BEGIN OF c_display, "! Screens are not displayed at all nothing TYPE td_display_mode VALUE 'N' ##NO_TEXT, "! Every screen is displayed, the user must press Enter to reach next screen all_screens TYPE td_display_mode VALUE 'A' ##NO_TEXT, "! Screens are displayed only from the screen where an error occurs, otherwise screens are not displayed if_error TYPE td_display_mode VALUE 'E' ##NO_TEXT, END OF c_display, "! Runs the batch input with SY-BATCH = 'X' (even if runs interactively) BEGIN OF c_display_sybatch, "! Screens are not displayed at all nothing TYPE td_display_mode VALUE 'Q' ##NO_TEXT, "! Every screen is displayed, the user must press Enter to reach next screen all_screens TYPE td_display_mode VALUE 'D' ##NO_TEXT, "! Screens are displayed only from the screen where an error occurs, otherwise screens are not displayed if_error TYPE td_display_mode VALUE 'H' ##NO_TEXT, END OF c_display_sybatch. CONSTANTS: BEGIN OF c_update, asynchronous TYPE td_update_mode VALUE 'A' ##NO_TEXT, synchronous TYPE td_update_mode VALUE 'S' ##NO_TEXT, local TYPE td_update_mode VALUE 'L' ##NO_TEXT, END OF c_update . METHODS constructor IMPORTING !iv_tcode TYPE tcode . METHODS add_dynpro IMPORTING !dynpro TYPE REF TO zcl_btci_dynpro RETURNING VALUE(fluent_transaction) TYPE REF TO zcl_btci_transaction . METHODS add_dynpros IMPORTING !dynpros TYPE ty_dynpros RETURNING VALUE(fluent_transaction) TYPE REF TO zcl_btci_transaction . METHODS call_transaction IMPORTING VALUE(iv_display) TYPE ctu_params-dismode DEFAULT c_display-nothing VALUE(iv_update) TYPE ctu_params-updmode DEFAULT c_update-asynchronous VALUE(is_param) TYPE ctu_params OPTIONAL RETURNING VALUE(eo_result) TYPE REF TO zcl_btci_result . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_btci_transaction IMPLEMENTATION. METHOD add_dynpro. APPEND LINES OF dynpro->aut_bdcdata TO aut_bdcdata. fluent_transaction = me. ENDMETHOD. METHOD add_dynpros. LOOP AT dynpros INTO DATA(dynpro). APPEND LINES OF dynpro->aut_bdcdata TO aut_bdcdata. ENDLOOP. fluent_transaction = me. ENDMETHOD. METHOD call_transaction. DATA: wlt_bdcmsgcoll TYPE ettcd_msg_tabtype. IF is_param-dismode IS INITIAL. is_param-dismode = iv_display. ENDIF. IF is_param-updmode IS INITIAL. is_param-updmode = iv_update. ENDIF. CALL TRANSACTION aud_tcode USING aut_bdcdata OPTIONS FROM is_param MESSAGES INTO wlt_bdcmsgcoll. CREATE OBJECT eo_result EXPORTING iv_subrc = CONV #( sy-subrc ) ##OPERATOR " CONV allows copying SY-SUBRC before call, otherwise it's reset to zero it_bdcmsgcoll = wlt_bdcmsgcoll. ENDMETHOD. METHOD constructor. aud_tcode = iv_tcode. ENDMETHOD. ENDCLASS.
30.107438
126
0.682954
bd5489cac2224d88b2c7631fc2c205ed451df98b
13,123
abap
ABAP
src/ui/core/zcl_abapgit_gui.clas.abap
Heisenberg027/abapGit
cac7cd42fb6aeecc5320a6fde2b646e37893fe6e
[ "MIT" ]
null
null
null
src/ui/core/zcl_abapgit_gui.clas.abap
Heisenberg027/abapGit
cac7cd42fb6aeecc5320a6fde2b646e37893fe6e
[ "MIT" ]
null
null
null
src/ui/core/zcl_abapgit_gui.clas.abap
Heisenberg027/abapGit
cac7cd42fb6aeecc5320a6fde2b646e37893fe6e
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_gui_services . CONSTANTS: BEGIN OF c_event_state, not_handled TYPE i VALUE 0, re_render TYPE i VALUE 1, new_page TYPE i VALUE 2, go_back TYPE i VALUE 3, no_more_act TYPE i VALUE 4, new_page_w_bookmark TYPE i VALUE 5, go_back_to_bookmark TYPE i VALUE 6, new_page_replacing TYPE i VALUE 7, END OF c_event_state . CONSTANTS: BEGIN OF c_action, go_home TYPE string VALUE 'go_home', go_db TYPE string VALUE 'go_db', END OF c_action . METHODS go_home RAISING zcx_abapgit_exception . METHODS go_page IMPORTING !ii_page TYPE REF TO zif_abapgit_gui_renderable !iv_clear_stack TYPE abap_bool DEFAULT abap_true RAISING zcx_abapgit_exception . METHODS back IMPORTING !iv_to_bookmark TYPE abap_bool DEFAULT abap_false RETURNING VALUE(rv_exit) TYPE abap_bool RAISING zcx_abapgit_exception . METHODS on_event FOR EVENT sapevent OF zif_abapgit_html_viewer IMPORTING !action !frame !getdata !postdata !query_table . METHODS constructor IMPORTING !io_component TYPE REF TO object OPTIONAL !ii_asset_man TYPE REF TO zif_abapgit_gui_asset_manager OPTIONAL !ii_hotkey_ctl TYPE REF TO zif_abapgit_gui_hotkey_ctl OPTIONAL !ii_html_processor TYPE REF TO zif_abapgit_gui_html_processor OPTIONAL !iv_rollback_on_error TYPE abap_bool DEFAULT abap_true RAISING zcx_abapgit_exception . METHODS free . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_page_stack, page TYPE REF TO zif_abapgit_gui_renderable, bookmark TYPE abap_bool, END OF ty_page_stack . DATA mv_rollback_on_error TYPE abap_bool . DATA mi_cur_page TYPE REF TO zif_abapgit_gui_renderable . DATA: mt_stack TYPE STANDARD TABLE OF ty_page_stack . DATA: mt_event_handlers TYPE STANDARD TABLE OF REF TO zif_abapgit_gui_event_handler . DATA mi_router TYPE REF TO zif_abapgit_gui_event_handler . DATA mi_asset_man TYPE REF TO zif_abapgit_gui_asset_manager . DATA mi_hotkey_ctl TYPE REF TO zif_abapgit_gui_hotkey_ctl . DATA mi_html_processor TYPE REF TO zif_abapgit_gui_html_processor . DATA mi_html_viewer TYPE REF TO zif_abapgit_html_viewer . DATA mo_html_parts TYPE REF TO zcl_abapgit_html_parts . METHODS cache_html IMPORTING !iv_text TYPE string RETURNING VALUE(rv_url) TYPE w3url . METHODS startup RAISING zcx_abapgit_exception . METHODS render RAISING zcx_abapgit_exception . METHODS call_page IMPORTING !ii_page TYPE REF TO zif_abapgit_gui_renderable !iv_with_bookmark TYPE abap_bool DEFAULT abap_false !iv_replacing TYPE abap_bool DEFAULT abap_false RAISING zcx_abapgit_exception . METHODS handle_action IMPORTING !iv_action TYPE c !iv_getdata TYPE c OPTIONAL !it_postdata TYPE cnht_post_data_tab OPTIONAL . METHODS handle_error IMPORTING !ix_exception TYPE REF TO zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_GUI IMPLEMENTATION. METHOD back. DATA: lv_index TYPE i, ls_stack LIKE LINE OF mt_stack. " If viewer is showing Internet page, then use browser navigation IF mi_html_viewer->get_url( ) CP 'http*'. mi_html_viewer->back( ). RETURN. ENDIF. lv_index = lines( mt_stack ). IF lv_index = 0. rv_exit = abap_true. RETURN. ENDIF. DO lv_index TIMES. READ TABLE mt_stack INDEX lv_index INTO ls_stack. ASSERT sy-subrc = 0. DELETE mt_stack INDEX lv_index. ASSERT sy-subrc = 0. lv_index = lv_index - 1. IF iv_to_bookmark = abap_false OR ls_stack-bookmark = abap_true. EXIT. ENDIF. ENDDO. mi_cur_page = ls_stack-page. " last page always stays render( ). ENDMETHOD. METHOD cache_html. rv_url = zif_abapgit_gui_services~cache_asset( iv_text = iv_text iv_type = 'text' iv_subtype = 'html' ). ENDMETHOD. METHOD call_page. DATA: ls_stack TYPE ty_page_stack. IF iv_replacing = abap_false AND NOT mi_cur_page IS INITIAL. ls_stack-page = mi_cur_page. ls_stack-bookmark = iv_with_bookmark. APPEND ls_stack TO mt_stack. ENDIF. mi_cur_page = ii_page. render( ). ENDMETHOD. METHOD constructor. IF io_component IS BOUND. IF zcl_abapgit_gui_utils=>is_renderable( io_component ) = abap_true. mi_cur_page ?= io_component. " direct page ELSE. IF zcl_abapgit_gui_utils=>is_event_handler( io_component ) = abap_false. zcx_abapgit_exception=>raise( 'Component must be renderable or be an event handler' ). ENDIF. mi_router ?= io_component. ENDIF. ENDIF. CREATE OBJECT mo_html_parts. mv_rollback_on_error = iv_rollback_on_error. mi_asset_man = ii_asset_man. mi_hotkey_ctl = ii_hotkey_ctl. mi_html_processor = ii_html_processor. " Maybe improve to middlewares stack ?? startup( ). ENDMETHOD. METHOD free. SET HANDLER on_event FOR mi_html_viewer ACTIVATION space. mi_html_viewer->close_document( ). mi_html_viewer->free( ). FREE mi_html_viewer. ENDMETHOD. METHOD go_home. DATA: ls_stack LIKE LINE OF mt_stack, lv_mode TYPE tabname. IF mi_router IS BOUND. CLEAR: mt_stack, mt_event_handlers. APPEND mi_router TO mt_event_handlers. " on_event doesn't accept strings directly GET PARAMETER ID 'DBT' FIELD lv_mode. CASE lv_mode. WHEN 'ZABAPGIT'. on_event( action = |{ c_action-go_db }| ). WHEN OTHERS. on_event( action = |{ c_action-go_home }| ). ENDCASE. ELSE. IF lines( mt_stack ) > 0. READ TABLE mt_stack INTO ls_stack INDEX 1. mi_cur_page = ls_stack-page. ENDIF. render( ). ENDIF. ENDMETHOD. METHOD go_page. IF iv_clear_stack = abap_true. CLEAR mt_stack. ENDIF. mi_cur_page = ii_page. render( ). ENDMETHOD. METHOD handle_action. DATA: lx_exception TYPE REF TO zcx_abapgit_exception, li_handler TYPE REF TO zif_abapgit_gui_event_handler, li_event TYPE REF TO zif_abapgit_gui_event, ls_handled TYPE zif_abapgit_gui_event_handler=>ty_handling_result. CREATE OBJECT li_event TYPE zcl_abapgit_gui_event EXPORTING ii_gui_services = me iv_action = iv_action iv_getdata = iv_getdata it_postdata = it_postdata. TRY. LOOP AT mt_event_handlers INTO li_handler. ls_handled = li_handler->on_event( li_event ). IF ls_handled-state IS NOT INITIAL AND ls_handled-state <> c_event_state-not_handled. " is handled EXIT. ENDIF. ENDLOOP. CASE ls_handled-state. WHEN c_event_state-re_render. render( ). WHEN c_event_state-new_page. call_page( ls_handled-page ). WHEN c_event_state-new_page_w_bookmark. call_page( ii_page = ls_handled-page iv_with_bookmark = abap_true ). WHEN c_event_state-new_page_replacing. call_page( ii_page = ls_handled-page iv_replacing = abap_true ). WHEN c_event_state-go_back. back( ). WHEN c_event_state-go_back_to_bookmark. back( abap_true ). WHEN c_event_state-no_more_act. " Do nothing, handling completed WHEN OTHERS. zcx_abapgit_exception=>raise( |Unknown action: { iv_action }| ). ENDCASE. CATCH zcx_abapgit_cancel ##NO_HANDLER. " Do nothing = gc_event_state-no_more_act CATCH zcx_abapgit_exception INTO lx_exception. handle_error( lx_exception ). ENDTRY. ENDMETHOD. METHOD handle_error. DATA: li_gui_error_handler TYPE REF TO zif_abapgit_gui_error_handler, lx_exception TYPE REF TO cx_root. IF mv_rollback_on_error = abap_true. ROLLBACK WORK. ENDIF. TRY. li_gui_error_handler ?= mi_cur_page. IF li_gui_error_handler IS BOUND AND li_gui_error_handler->handle_error( ix_exception ) = abap_true. " We rerender the current page to display the error box render( ). ELSE. MESSAGE ix_exception TYPE 'S' DISPLAY LIKE 'E'. ENDIF. CATCH zcx_abapgit_exception cx_sy_move_cast_error INTO lx_exception. " In case of fire we just fallback to plain old message MESSAGE lx_exception TYPE 'S' DISPLAY LIKE 'E'. ENDTRY. ENDMETHOD. METHOD on_event. handle_action( iv_action = action iv_getdata = getdata it_postdata = postdata ). ENDMETHOD. METHOD render. DATA: lv_url TYPE w3url, lv_html TYPE string, li_html TYPE REF TO zif_abapgit_html. IF mi_cur_page IS NOT BOUND. zcx_abapgit_exception=>raise( 'GUI error: no current page' ). ENDIF. CLEAR mt_event_handlers. mo_html_parts->clear( ). IF mi_router IS BOUND. APPEND mi_router TO mt_event_handlers. ENDIF. IF mi_hotkey_ctl IS BOUND. mi_hotkey_ctl->reset( ). ENDIF. li_html = mi_cur_page->render( ). lv_html = li_html->render( iv_no_indent_jscss = abap_true ). IF mi_html_processor IS BOUND. lv_html = mi_html_processor->process( iv_html = lv_html ii_gui_services = me ). ENDIF. lv_url = cache_html( lv_html ). mi_html_viewer->show_url( lv_url ). ENDMETHOD. METHOD startup. DATA: lt_events TYPE cntl_simple_events, ls_event LIKE LINE OF lt_events, lt_assets TYPE zif_abapgit_gui_asset_manager=>ty_web_assets. FIELD-SYMBOLS <ls_asset> LIKE LINE OF lt_assets. mi_html_viewer = zcl_abapgit_ui_factory=>get_html_viewer( ). IF mi_asset_man IS BOUND. lt_assets = mi_asset_man->get_all_assets( ). LOOP AT lt_assets ASSIGNING <ls_asset> WHERE is_cacheable = abap_true. zif_abapgit_gui_services~cache_asset( iv_xdata = <ls_asset>-content iv_url = <ls_asset>-url iv_type = <ls_asset>-type iv_subtype = <ls_asset>-subtype ). ENDLOOP. ENDIF. ls_event-eventid = mi_html_viewer->m_id_sapevent. ls_event-appl_event = abap_true. APPEND ls_event TO lt_events. mi_html_viewer->set_registered_events( lt_events ). SET HANDLER on_event FOR mi_html_viewer. ENDMETHOD. METHOD zif_abapgit_gui_services~cache_asset. TYPES: ty_hex TYPE x LENGTH 200. DATA: lt_xdata TYPE STANDARD TABLE OF ty_hex WITH DEFAULT KEY, lv_size TYPE i, lt_html TYPE w3htmltab. ASSERT iv_text IS SUPPLIED OR iv_xdata IS SUPPLIED. IF iv_text IS SUPPLIED. " String input zcl_abapgit_convert=>string_to_tab( EXPORTING iv_str = iv_text IMPORTING ev_size = lv_size et_tab = lt_html ). mi_html_viewer->load_data( EXPORTING iv_type = iv_type iv_subtype = iv_subtype iv_size = lv_size iv_url = iv_url IMPORTING ev_assigned_url = rv_url CHANGING ct_data_table = lt_html EXCEPTIONS OTHERS = 1 ). ELSE. " Raw input zcl_abapgit_convert=>xstring_to_bintab( EXPORTING iv_xstr = iv_xdata IMPORTING ev_size = lv_size et_bintab = lt_xdata ). mi_html_viewer->load_data( EXPORTING iv_type = iv_type iv_subtype = iv_subtype iv_size = lv_size iv_url = iv_url IMPORTING ev_assigned_url = rv_url CHANGING ct_data_table = lt_xdata EXCEPTIONS OTHERS = 1 ). ENDIF. ASSERT sy-subrc = 0. " Image data error ENDMETHOD. METHOD zif_abapgit_gui_services~get_current_page_name. IF mi_cur_page IS BOUND. rv_page_name = cl_abap_classdescr=>describe_by_object_ref( mi_cur_page )->get_relative_name( ). ENDIF." ELSE - return is empty => initial page ENDMETHOD. METHOD zif_abapgit_gui_services~get_hotkeys_ctl. ri_hotkey_ctl = mi_hotkey_ctl. ENDMETHOD. METHOD zif_abapgit_gui_services~get_html_parts. ro_parts = mo_html_parts. ENDMETHOD. METHOD zif_abapgit_gui_services~register_event_handler. ASSERT ii_event_handler IS BOUND. INSERT ii_event_handler INTO mt_event_handlers INDEX 1. ENDMETHOD. ENDCLASS.
26.618661
108
0.647108
bd55cce1ebe7262f01e5510981c3615645609797
5,822
abap
ABAP
src/zfi_tcmd_alv.prog.abap
TheWirtschaftsmann/TCMD
c25ff09f99e34bb56fc5c578f85ddad41411fba2
[ "MIT" ]
1
2019-05-19T19:35:27.000Z
2019-05-19T19:35:27.000Z
src/zfi_tcmd_alv.prog.abap
TheWirtschaftsmann/TCMD
c25ff09f99e34bb56fc5c578f85ddad41411fba2
[ "MIT" ]
null
null
null
src/zfi_tcmd_alv.prog.abap
TheWirtschaftsmann/TCMD
c25ff09f99e34bb56fc5c578f85ddad41411fba2
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Include for ALV routines *&---------------------------------------------------------------------* define add_exclude. ls_excluding = &1. append ls_excluding to rt_excluding. end-of-definition. class lcl_view definition inheriting from cl_gui_alv_grid. public section. methods: constructor importing iv_parent type ref to cl_gui_container. methods: setup_alv importing iv_set_mode type abap_bool iv_country type land1 changing ct_data type standard table. private section. constants: c_settings_mode type char1 value 'S'. constants: c_translations_mode type char1 value 'T'. data: av_display_mode type char1. data: av_country type land1. methods: build_fieldcatalog returning value(rt_fieldcat) type lvc_t_fcat. methods: build_layout returning value(rs_layout) type lvc_s_layo. methods: build_variant returning value(rs_variant) type disvariant. methods: exclude_buttons returning value(rt_excluding) type ui_functions. methods: display_tax_code importing iv_mwskz type mwskz raising lcx_exception. methods: handle_double_click for event double_click of cl_gui_alv_grid importing e_row e_column. endclass. class lcl_view implementation. method constructor. call method super->constructor exporting i_parent = iv_parent. endmethod. method setup_alv. data: lt_fieldcat type lvc_t_fcat, ls_layout type lvc_s_layo, ls_variant type disvariant, lt_excluding type ui_functions. av_country = iv_country. " Set display mode if iv_set_mode = abap_true. av_display_mode = c_settings_mode. else. av_display_mode = c_translations_mode. endif. " Prepare technical components of ALV-view ls_layout = me->build_layout( ). ls_variant = me->build_variant( ). lt_fieldcat = me->build_fieldcatalog( ). lt_excluding = me->exclude_buttons( ). " Pass data for ALV-display call method me->set_table_for_first_display exporting i_save = 'A' i_default = 'X' is_layout = ls_layout is_variant = ls_variant it_toolbar_excluding = lt_excluding changing it_outtab = ct_data it_fieldcatalog = lt_fieldcat. set handler me->handle_double_click for me. endmethod. method build_fieldcatalog. constants: lc_tc_name_str type slis_tabname value 'T007S', lc_tc_sets_str type slis_tabname value 'ZFI_TCMD_TC_SETTINGS'. data: lv_structure type slis_tabname, lt_fieldcat type lvc_t_fcat. if av_display_mode = c_settings_mode. lv_structure = lc_tc_sets_str. else. lv_structure = lc_tc_name_str. endif. call function 'LVC_FIELDCATALOG_MERGE' exporting i_structure_name = lv_structure changing ct_fieldcat = lt_fieldcat. rt_fieldcat = lt_fieldcat. endmethod. method build_layout. rs_layout-sel_mode = 'A'. " User can select the lines rs_layout-zebra = 'X'. " Zebra display rs_layout-cwidth_opt = 'X'. " Optimization of columns width rs_layout-ctab_fname = 'COLORCELL'. " Cells coloring endmethod. method build_variant. rs_variant-report = sy-repid. rs_variant-username = sy-uname. endmethod. method exclude_buttons. data: ls_excluding like line of rt_excluding. add_exclude cl_gui_alv_grid=>mc_fc_graph. add_exclude cl_gui_alv_grid=>mc_fc_info. add_exclude cl_gui_alv_grid=>mc_fc_loc_copy. add_exclude cl_gui_alv_grid=>mc_fc_loc_copy_row. add_exclude cl_gui_alv_grid=>mc_fc_loc_cut. add_exclude cl_gui_alv_grid=>mc_fc_loc_delete_row. add_exclude cl_gui_alv_grid=>mc_fc_loc_insert_row. add_exclude cl_gui_alv_grid=>mc_fc_loc_move_row. add_exclude cl_gui_alv_grid=>mc_fc_loc_paste. add_exclude cl_gui_alv_grid=>mc_fc_loc_undo. add_exclude cl_gui_alv_grid=>mc_fc_loc_paste_new_row. add_exclude cl_gui_alv_grid=>mc_fc_loc_append_row. add_exclude cl_gui_alv_grid=>mc_fc_check. add_exclude cl_gui_alv_grid=>mc_fc_refresh. add_exclude cl_gui_alv_grid=>mc_fc_subtot. add_exclude cl_gui_alv_grid=>mc_fc_sum. endmethod. method handle_double_click. data: lv_mwskz type mwskz, lv_msg type string, lo_ex type ref to lcx_exception. field-symbols: <data_table> type standard table, <tc_md> type zfi_tcmd_tc_settings, <tc_names> type t007s. assign me->mt_outtab->* to <data_table>. if sy-subrc is not initial or e_row-rowtype is not initial. return. endif. if av_display_mode = c_settings_mode. read table <data_table> assigning <tc_md> index e_row-index. lv_mwskz = <tc_md>-mwskz. else. read table <data_table> assigning <tc_names> index e_row-index. lv_mwskz = <tc_names>-mwskz. endif. try. me->display_tax_code( lv_mwskz ). catch lcx_exception into lo_ex. message lo_ex->mv_message type 'S'. endtry. endmethod. method display_tax_code. call function 'AUTHORITY_CHECK_TCODE' exporting tcode = 'FTXP' exceptions ok = 0 not_ok = 1 others = 2. if sy-subrc is not initial. raise exception type lcx_exception exporting i_message = 'Missing authorization for transaction FTXP'. endif. set parameter id 'LND' field av_country. set parameter id 'TAX' field iv_mwskz. call transaction 'FTXP' and skip first screen. endmethod. endclass.
31.641304
100
0.666438
bd56c9faf089a2d9e6e9575642e43d94406d327a
10,767
abap
ABAP
src/zcl_abapgit_zip.clas.abap
PeregrinTooc/abapGit
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
[ "MIT" ]
null
null
null
src/zcl_abapgit_zip.clas.abap
PeregrinTooc/abapGit
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
[ "MIT" ]
null
null
null
src/zcl_abapgit_zip.clas.abap
PeregrinTooc/abapGit
8e6fe2c785dd03faed5554d8255a4c4fa8358b2a
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_zip DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS encode_files IMPORTING !it_files TYPE zif_abapgit_definitions=>ty_files_item_tt RETURNING VALUE(rv_xstr) TYPE xstring RAISING zcx_abapgit_exception . CLASS-METHODS export IMPORTING !is_local_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings !iv_package TYPE devclass !io_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit !iv_show_log TYPE abap_bool DEFAULT abap_true !it_filter TYPE zif_abapgit_definitions=>ty_tadir_tt OPTIONAL RETURNING VALUE(rv_xstr) TYPE xstring RAISING zcx_abapgit_exception . CLASS-METHODS export_object RAISING zcx_abapgit_exception . CLASS-METHODS export_package EXPORTING !ev_xstr TYPE xstring !ev_package TYPE devclass RAISING zcx_abapgit_exception . CLASS-METHODS load IMPORTING !iv_xstr TYPE xstring RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt RAISING zcx_abapgit_exception . CLASS-METHODS save_binstring_to_localfile IMPORTING !iv_filename TYPE string !iv_binstring TYPE xstring RAISING zcx_abapgit_exception . PROTECTED SECTION. CLASS-DATA gv_prev TYPE string . PRIVATE SECTION. CLASS-METHODS filename IMPORTING !iv_str TYPE string EXPORTING !ev_path TYPE string !ev_filename TYPE string RAISING zcx_abapgit_exception . CLASS-METHODS normalize_path CHANGING !ct_files TYPE zif_abapgit_definitions=>ty_files_tt RAISING zcx_abapgit_exception . CLASS-METHODS unzip_file IMPORTING !iv_xstr TYPE xstring RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt RAISING zcx_abapgit_exception . ENDCLASS. CLASS ZCL_ABAPGIT_ZIP IMPLEMENTATION. METHOD encode_files. DATA: lo_zip TYPE REF TO cl_abap_zip, lv_filename TYPE string. FIELD-SYMBOLS: <ls_file> LIKE LINE OF it_files. CREATE OBJECT lo_zip. LOOP AT it_files ASSIGNING <ls_file>. CONCATENATE <ls_file>-file-path+1 <ls_file>-file-filename INTO lv_filename. lo_zip->add( name = lv_filename content = <ls_file>-file-data ). ENDLOOP. rv_xstr = lo_zip->save( ). ENDMETHOD. METHOD export. DATA li_log TYPE REF TO zif_abapgit_log. DATA lt_zip TYPE zif_abapgit_definitions=>ty_files_item_tt. DATA lo_serialize TYPE REF TO zcl_abapgit_serialize. CREATE OBJECT li_log TYPE zcl_abapgit_log. li_log->set_title( 'Zip Export Log' ). IF zcl_abapgit_factory=>get_sap_package( iv_package )->exists( ) = abap_false. zcx_abapgit_exception=>raise( |Package { iv_package } doesn't exist| ). ENDIF. CREATE OBJECT lo_serialize EXPORTING iv_serialize_master_lang_only = is_local_settings-serialize_master_lang_only. lt_zip = lo_serialize->files_local( iv_package = iv_package io_dot_abapgit = io_dot_abapgit is_local_settings = is_local_settings ii_log = li_log it_filter = it_filter ). IF li_log->count( ) > 0 AND iv_show_log = abap_true. zcl_abapgit_log_viewer=>show_log( li_log ). ENDIF. rv_xstr = encode_files( lt_zip ). ENDMETHOD. METHOD export_object. DATA: ls_tadir TYPE zif_abapgit_definitions=>ty_tadir, lv_folder TYPE string, lv_fullpath TYPE string, lv_sep TYPE c LENGTH 1, ls_files_item TYPE zcl_abapgit_objects=>ty_serialization. FIELD-SYMBOLS: <ls_file> LIKE LINE OF ls_files_item-files. WHILE ls_tadir IS INITIAL. ls_tadir = zcl_abapgit_ui_factory=>get_popups( )->popup_object( ). IF ls_tadir IS INITIAL. MESSAGE 'Object couldn''t be found' TYPE 'S' DISPLAY LIKE 'E'. ENDIF. ENDWHILE. ls_files_item-item-obj_type = ls_tadir-object. ls_files_item-item-obj_name = ls_tadir-obj_name. ls_files_item = zcl_abapgit_objects=>serialize( is_item = ls_files_item-item iv_language = sy-langu ). IF lines( ls_files_item-files ) = 0. MESSAGE 'Empty' TYPE 'S'. RETURN. ENDIF. cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = gv_prev CHANGING selected_folder = lv_folder ). IF lv_folder IS INITIAL. RETURN. ENDIF. gv_prev = lv_folder. cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_sep ). LOOP AT ls_files_item-files ASSIGNING <ls_file>. CONCATENATE lv_folder lv_sep <ls_file>-filename INTO lv_fullpath. save_binstring_to_localfile( iv_filename = lv_fullpath iv_binstring = <ls_file>-data ). ENDLOOP. ENDMETHOD. METHOD export_package. DATA: ls_local_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings, lo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit, li_popups TYPE REF TO zif_abapgit_popups, lv_folder_logic TYPE string, lv_package TYPE devclass, lv_serialize_master_lang_only TYPE abap_bool. li_popups = zcl_abapgit_ui_factory=>get_popups( ). li_popups->popup_package_export( IMPORTING ev_package = lv_package ev_folder_logic = lv_folder_logic ev_serialize_master_lang_only = lv_serialize_master_lang_only ). IF lv_package IS INITIAL. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. ls_local_settings-serialize_master_lang_only = lv_serialize_master_lang_only. lo_dot_abapgit = zcl_abapgit_dot_abapgit=>build_default( ). lo_dot_abapgit->set_folder_logic( lv_folder_logic ). ev_xstr = export( is_local_settings = ls_local_settings iv_package = lv_package io_dot_abapgit = lo_dot_abapgit ). ev_package = lv_package. ENDMETHOD. METHOD filename. IF iv_str CA '/'. FIND REGEX '(.*/)(.*)' IN iv_str SUBMATCHES ev_path ev_filename. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Malformed path' ). ENDIF. IF ev_path <> '/'. CONCATENATE '/' ev_path INTO ev_path. ENDIF. ELSE. ev_path = '/'. ev_filename = iv_str. ENDIF. TRANSLATE ev_filename TO LOWER CASE. ENDMETHOD. METHOD load. rt_files = unzip_file( iv_xstr ). ENDMETHOD. METHOD normalize_path. * removes first folder from path if needed DATA: lt_split TYPE TABLE OF string, lv_needed TYPE abap_bool, lv_length TYPE i, lv_split LIKE LINE OF lt_split. FIELD-SYMBOLS: <ls_file> LIKE LINE OF ct_files. READ TABLE ct_files INDEX 1 ASSIGNING <ls_file>. IF sy-subrc <> 0. RETURN. ENDIF. SPLIT <ls_file>-path AT '/' INTO TABLE lt_split. IF sy-subrc <> 0. RETURN. ENDIF. READ TABLE lt_split INDEX 2 INTO lv_split. IF sy-subrc <> 0 OR strlen( lv_split ) = 0. RETURN. ENDIF. CONCATENATE '/' lv_split '/*' INTO lv_split. lv_needed = abap_true. LOOP AT ct_files ASSIGNING <ls_file>. IF NOT <ls_file>-path CP lv_split. lv_needed = abap_false. EXIT. " current loop ENDIF. ENDLOOP. IF lv_needed = abap_true. lv_length = strlen( lv_split ) - 2. LOOP AT ct_files ASSIGNING <ls_file>. <ls_file>-path = <ls_file>-path+lv_length. ENDLOOP. ENDIF. ENDMETHOD. METHOD save_binstring_to_localfile. DATA lt_rawdata TYPE solix_tab. lt_rawdata = cl_bcs_convert=>xstring_to_solix( iv_binstring ). cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = xstrlen( iv_binstring ) filename = iv_filename filetype = 'BIN' CHANGING data_tab = lt_rawdata EXCEPTIONS file_write_error = 1 no_batch = 2 gui_refuse_filetransfer = 3 invalid_type = 4 no_authority = 5 unknown_error = 6 header_not_allowed = 7 separator_not_allowed = 8 filesize_not_allowed = 9 header_too_long = 10 dp_error_create = 11 dp_error_send = 12 dp_error_write = 13 unknown_dp_error = 14 access_denied = 15 dp_out_of_memory = 16 disk_full = 17 dp_timeout = 18 file_not_found = 19 dataprovider_exception = 20 control_flush_error = 21 not_supported_by_gui = 22 error_no_gui = 23 OTHERS = 24 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from gui_download' ). ENDIF. ENDMETHOD. METHOD unzip_file. DATA: lo_zip TYPE REF TO cl_abap_zip, lv_data TYPE xstring. FIELD-SYMBOLS: <ls_zipfile> LIKE LINE OF lo_zip->files, <ls_file> LIKE LINE OF rt_files. CREATE OBJECT lo_zip. lo_zip->load( EXPORTING zip = iv_xstr EXCEPTIONS zip_parse_error = 1 OTHERS = 2 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from zip' ). ENDIF. LOOP AT lo_zip->files ASSIGNING <ls_zipfile>. lo_zip->get( EXPORTING name = <ls_zipfile>-name IMPORTING content = lv_data EXCEPTIONS zip_index_error = 1 zip_decompression_error = 2 OTHERS = 3 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from zip get' ). ENDIF. APPEND INITIAL LINE TO rt_files ASSIGNING <ls_file>. filename( EXPORTING iv_str = <ls_zipfile>-name IMPORTING ev_path = <ls_file>-path ev_filename = <ls_file>-filename ). <ls_file>-data = lv_data. <ls_file>-sha1 = zcl_abapgit_hash=>sha1_blob( <ls_file>-data ). ENDLOOP. DELETE rt_files WHERE filename IS INITIAL. normalize_path( CHANGING ct_files = rt_files ). ENDMETHOD. ENDCLASS.
27.258228
93
0.611684
bd57345ad7f0b3fae0edbfcd2efcf5a41351367d
231
abap
ABAP
src/persistence/zcl_rest_source_scarr_dao.clas.abap
s-cbrunn/PlainABAPRestService
b7bb471172105e3219c1c883c33923c0d4243761
[ "Apache-2.0" ]
null
null
null
src/persistence/zcl_rest_source_scarr_dao.clas.abap
s-cbrunn/PlainABAPRestService
b7bb471172105e3219c1c883c33923c0d4243761
[ "Apache-2.0" ]
null
null
null
src/persistence/zcl_rest_source_scarr_dao.clas.abap
s-cbrunn/PlainABAPRestService
b7bb471172105e3219c1c883c33923c0d4243761
[ "Apache-2.0" ]
null
null
null
class ZCL_REST_SOURCE_SCARR_DAO definition public create public . public section. interfaces ZIF_REST_PERSISTENCE . protected section. private section. ENDCLASS. CLASS ZCL_REST_SOURCE_SCARR_DAO IMPLEMENTATION. ENDCLASS.
14.4375
47
0.82684
bd5925ce42fe598590f7322f045d7ffcb6a85a48
570
abap
ABAP
src/zif_abak_consts.intf.abap
abapinho/abaKTravis
ab368aaccc9bb0b018e6cd6208cd4abc934861a0
[ "MIT" ]
null
null
null
src/zif_abak_consts.intf.abap
abapinho/abaKTravis
ab368aaccc9bb0b018e6cd6208cd4abc934861a0
[ "MIT" ]
null
null
null
src/zif_abak_consts.intf.abap
abapinho/abaKTravis
ab368aaccc9bb0b018e6cd6208cd4abc934861a0
[ "MIT" ]
null
null
null
interface ZIF_ABAK_CONSTS public . constants: BEGIN OF content_type, inline TYPE zabak_content_type VALUE 'INLINE', url TYPE zabak_content_type VALUE 'URL', standard_text TYPE zabak_content_type VALUE 'SO10', file TYPE zabak_content_type VALUE 'FILE', END OF content_type . constants: BEGIN OF format_type, database TYPE zabak_format_type VALUE 'DB', xml TYPE zabak_format_type VALUE 'XML', END OF format_type . endinterface.
30
69
0.612281
bd5b059911465b4394b25df9be706fcb5d7bd14c
225
abap
ABAP
src/unmanaged/#dmo#bp_travel_u05.clas.abap
SAP-Cloud-Platform/flight05
f6d16f6deab2c2c5c101ea6391ddcd37d701cfe2
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_travel_u05.clas.abap
SAP-Cloud-Platform/flight05
f6d16f6deab2c2c5c101ea6391ddcd37d701cfe2
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_travel_u05.clas.abap
SAP-Cloud-Platform/flight05
f6d16f6deab2c2c5c101ea6391ddcd37d701cfe2
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/bp_travel_u05 DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF /dmo/i_travel_u05 . PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /dmo/bp_travel_u05 IMPLEMENTATION. ENDCLASS.
14.0625
40
0.764444
bd5bf8ad97a7ee44c8fe3f678681c8dc06de996b
3,887
abap
ABAP
src/http/zcl_abapgit_pr_enum_github.clas.abap
absap/abapGit
5468985b5760da157ee4089bbf872ed5700a74e2
[ "MIT" ]
null
null
null
src/http/zcl_abapgit_pr_enum_github.clas.abap
absap/abapGit
5468985b5760da157ee4089bbf872ed5700a74e2
[ "MIT" ]
null
null
null
src/http/zcl_abapgit_pr_enum_github.clas.abap
absap/abapGit
5468985b5760da157ee4089bbf872ed5700a74e2
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_pr_enum_github DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_pr_enum_provider . METHODS constructor IMPORTING !iv_user_and_repo TYPE string !ii_http_agent TYPE REF TO zif_abapgit_http_agent RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_info, repo_json TYPE REF TO zif_abapgit_ajson_reader, pulls TYPE zif_abapgit_pr_enum_provider=>tty_pulls, END OF ty_info. DATA mi_http_agent TYPE REF TO zif_abapgit_http_agent. DATA mv_repo_url TYPE string. METHODS fetch_repo_by_url IMPORTING iv_repo_url TYPE string RETURNING VALUE(rs_info) TYPE ty_info RAISING zcx_abapgit_exception. METHODS convert_list IMPORTING ii_json TYPE REF TO zif_abapgit_ajson_reader RETURNING VALUE(rt_pulls) TYPE zif_abapgit_pr_enum_provider=>tty_pulls. METHODS clean_url IMPORTING iv_url TYPE string RETURNING VALUE(rv_url) TYPE string. ENDCLASS. CLASS ZCL_ABAPGIT_PR_ENUM_GITHUB IMPLEMENTATION. METHOD clean_url. rv_url = replace( val = iv_url regex = '\{.*\}$' with = '' ). ENDMETHOD. METHOD constructor. mv_repo_url = |https://api.github.com/repos/{ iv_user_and_repo }|. mi_http_agent = ii_http_agent. mi_http_agent->global_headers( )->set( iv_key = 'Accept' iv_val = 'application/vnd.github.v3+json' ). IF zcl_abapgit_login_manager=>get( mv_repo_url ) IS NOT INITIAL. mi_http_agent->global_headers( )->set( iv_key = 'Authorization' iv_val = zcl_abapgit_login_manager=>get( mv_repo_url ) ). ENDIF. ENDMETHOD. METHOD convert_list. DATA lt_items TYPE string_table. DATA lv_i TYPE string. FIELD-SYMBOLS <ls_p> LIKE LINE OF rt_pulls. lt_items = ii_json->members( '/' ). LOOP AT lt_items INTO lv_i. APPEND INITIAL LINE TO rt_pulls ASSIGNING <ls_p>. <ls_p>-base_url = ii_json->get( |/{ lv_i }/base/repo/clone_url| ). <ls_p>-number = ii_json->get( |/{ lv_i }/number| ). <ls_p>-title = ii_json->get( |/{ lv_i }/title| ). <ls_p>-user = ii_json->get( |/{ lv_i }/user/login| ). <ls_p>-head_url = ii_json->get( |/{ lv_i }/head/repo/clone_url| ). <ls_p>-head_branch = ii_json->get( |/{ lv_i }/head/ref| ). <ls_p>-created_at = ii_json->get( |/{ lv_i }/created_at| ). ENDLOOP. ENDMETHOD. METHOD fetch_repo_by_url. DATA li_pulls_json TYPE REF TO zif_abapgit_ajson_reader. DATA lv_pull_url TYPE string. DATA li_response TYPE REF TO zif_abapgit_http_response. li_response = mi_http_agent->request( iv_repo_url ). rs_info-repo_json = li_response->json( ). li_response->headers( ). " for debug lv_pull_url = clean_url( rs_info-repo_json->get( '/pulls_url' ) ). li_pulls_json = mi_http_agent->request( lv_pull_url )->json( ). rs_info-pulls = convert_list( li_pulls_json ). ENDMETHOD. METHOD zif_abapgit_pr_enum_provider~list_pull_requests. DATA lv_repo_url TYPE string. DATA lv_upstream_url TYPE string. DATA ls_repo_info TYPE ty_info. FIELD-SYMBOLS <ls_p> LIKE LINE OF ls_repo_info-pulls. ls_repo_info = fetch_repo_by_url( mv_repo_url ). APPEND LINES OF ls_repo_info-pulls TO rt_pulls. IF ls_repo_info-repo_json->get_boolean( '/fork' ) = abap_true. lv_upstream_url = ls_repo_info-repo_json->get( '/source/url' ). " parent ? ls_repo_info = fetch_repo_by_url( lv_upstream_url ). LOOP AT ls_repo_info-pulls ASSIGNING <ls_p>. <ls_p>-is_for_upstream = abap_true. APPEND <ls_p> TO rt_pulls. ENDLOOP. ENDIF. ENDMETHOD. ENDCLASS.
27.764286
80
0.65912
bd5cb892e1414525d42a84c5685b117d37b84802
445
abap
ABAP
src/foundation/y_if_scan_manager.intf.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
2
2020-06-23T13:27:21.000Z
2020-11-03T12:19:18.000Z
src/foundation/y_if_scan_manager.intf.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
src/foundation/y_if_scan_manager.intf.abap
thomham/code-pal-for-abap
c58c4333f236a17937335871d9261b0897209399
[ "Apache-2.0" ]
null
null
null
INTERFACE y_if_scan_manager PUBLIC . METHODS get_levels RETURNING VALUE(result) TYPE slevel_tab . METHODS get_statements RETURNING VALUE(result) TYPE sstmnt_tab . METHODS get_structures RETURNING VALUE(result) TYPE sstruc_tab . METHODS get_tokens RETURNING VALUE(result) TYPE stokesx_tab . METHODS is_scan_ok RETURNING VALUE(result) TYPE abap_bool . METHODS set_ref_scan IMPORTING !io_ref_scan TYPE REF TO cl_ci_scan . ENDINTERFACE.
49.444444
70
0.820225
bd5e2d7275c0d0933b261c0e8ef7836cccfc412c
15,280
abap
ABAP
src/objects/zcl_abapgit_object_form.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
2
2021-03-20T20:27:04.000Z
2021-03-20T20:34:58.000Z
src/objects/zcl_abapgit_object_form.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
37
2021-06-01T05:57:18.000Z
2022-03-01T05:02:10.000Z
src/objects/zcl_abapgit_object_form.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
1
2021-07-09T02:07:11.000Z
2021-07-09T02:07:11.000Z
CLASS zcl_abapgit_object_form DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. METHODS constructor IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item iv_language TYPE spras. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: c_objectname_form TYPE thead-tdobject VALUE 'FORM' ##NO_TEXT. CONSTANTS: c_objectname_tdlines TYPE thead-tdobject VALUE 'TDLINES' ##NO_TEXT. CONSTANTS: c_extension_xml TYPE string VALUE 'xml' ##NO_TEXT. DATA: mv_form_name TYPE itcta-tdform. TYPES: BEGIN OF ty_s_form_data, form_header TYPE itcta, text_header TYPE thead, orig_language TYPE sy-langu, pages TYPE STANDARD TABLE OF itctg WITH DEFAULT KEY, page_windows TYPE STANDARD TABLE OF itcth WITH DEFAULT KEY, paragraphs TYPE STANDARD TABLE OF itcdp WITH DEFAULT KEY, strings TYPE STANDARD TABLE OF itcds WITH DEFAULT KEY, tabs TYPE STANDARD TABLE OF itcdq WITH DEFAULT KEY, windows TYPE STANDARD TABLE OF itctw WITH DEFAULT KEY, END OF ty_s_form_data, ty_t_form_data TYPE STANDARD TABLE OF ty_s_form_data WITH DEFAULT KEY, ty_t_form_header TYPE STANDARD TABLE OF itcta WITH DEFAULT KEY, ty_s_form_header TYPE LINE OF ty_t_form_header, ty_t_text_header TYPE STANDARD TABLE OF thead WITH DEFAULT KEY, ty_s_text_header TYPE LINE OF ty_t_text_header, ty_t_lines TYPE tline_tab. METHODS get_last_changes IMPORTING iv_form_name TYPE zif_abapgit_definitions=>ty_item-obj_name RETURNING VALUE(rs_last_changed) TYPE ty_s_form_header. METHODS build_extra_from_header IMPORTING is_header TYPE ty_s_form_header RETURNING VALUE(rv_result) TYPE string. METHODS build_extra_from_header_old IMPORTING is_header TYPE ty_s_form_header RETURNING VALUE(rv_result) TYPE string. METHODS _save_form IMPORTING it_lines TYPE ty_t_lines CHANGING cs_form_data TYPE ty_s_form_data. METHODS extract_tdlines IMPORTING is_form_data TYPE ty_s_form_data RETURNING VALUE(rt_lines) TYPE ty_t_lines RAISING zcx_abapgit_exception. METHODS _clear_changed_fields CHANGING cs_form_data TYPE ty_s_form_data. METHODS compress_lines IMPORTING is_form_data TYPE ty_s_form_data it_lines TYPE ty_t_lines RAISING zcx_abapgit_exception. METHODS find_form IMPORTING iv_object_name TYPE zif_abapgit_definitions=>ty_item-obj_name RETURNING VALUE(rt_text_header) TYPE ty_t_text_header. METHODS _read_form IMPORTING is_text_header TYPE ty_s_text_header EXPORTING ev_form_found TYPE abap_bool es_form_data TYPE ty_s_form_data et_lines TYPE ty_t_lines. METHODS _sort_tdlines_by_windows CHANGING ct_form_windows TYPE ty_s_form_data-windows ct_lines TYPE ty_t_lines. METHODS order_check_and_insert RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_FORM IMPLEMENTATION. METHOD build_extra_from_header. DATA: lv_tdspras TYPE laiso. CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT' EXPORTING input = is_header-tdspras IMPORTING output = lv_tdspras. rv_result = c_objectname_tdlines && '_' && lv_tdspras. ENDMETHOD. METHOD build_extra_from_header_old. rv_result = c_objectname_tdlines && '_' && is_header-tdspras. ENDMETHOD. METHOD compress_lines. DATA lv_string TYPE string. DATA li_xml TYPE REF TO zif_abapgit_xml_output. CREATE OBJECT li_xml TYPE zcl_abapgit_xml_output. li_xml->add( iv_name = c_objectname_tdlines ig_data = it_lines ). lv_string = li_xml->render( ). IF lv_string IS NOT INITIAL. mo_files->add_string( iv_extra = build_extra_from_header( is_form_data-form_header ) iv_ext = c_extension_xml iv_string = lv_string ). ENDIF. ENDMETHOD. METHOD constructor. super->constructor( is_item = is_item iv_language = iv_language ). mv_form_name = ms_item-obj_name. ENDMETHOD. METHOD extract_tdlines. DATA lv_string TYPE string. DATA li_xml TYPE REF TO zif_abapgit_xml_input. TRY. lv_string = mo_files->read_string( iv_extra = build_extra_from_header( is_form_data-form_header ) iv_ext = c_extension_xml ). CATCH zcx_abapgit_exception. lv_string = mo_files->read_string( iv_extra = build_extra_from_header_old( is_form_data-form_header ) iv_ext = c_extension_xml ). ENDTRY. CREATE OBJECT li_xml TYPE zcl_abapgit_xml_input EXPORTING iv_xml = lv_string. li_xml->read( EXPORTING iv_name = c_objectname_tdlines CHANGING cg_data = rt_lines ). ENDMETHOD. METHOD find_form. DATA: lv_text_name TYPE thead-tdname. lv_text_name = iv_object_name. CALL FUNCTION 'SELECT_TEXT' EXPORTING database_only = abap_true id = 'TXT' language = '*' name = lv_text_name object = c_objectname_form TABLES selections = rt_text_header EXCEPTIONS OTHERS = 1 ##fm_subrc_ok. "#EC CI_SUBRC ENDMETHOD. METHOD get_last_changes. DATA: lv_form_name TYPE thead-tdform. CLEAR rs_last_changed. lv_form_name = iv_form_name. CALL FUNCTION 'READ_FORM' EXPORTING form = lv_form_name read_only_header = abap_true IMPORTING form_header = rs_last_changed. ENDMETHOD. METHOD order_check_and_insert. DATA: lv_order TYPE e071k-trkorr. CALL FUNCTION 'SAPSCRIPT_ORDER_CHECK' EXPORTING objecttype = ms_item-obj_type form = mv_form_name EXCEPTIONS invalid_input = 1 object_locked = 2 object_not_available = 3 OTHERS = 4. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. CALL FUNCTION 'SAPSCRIPT_ORDER_INSERT' EXPORTING objecttype = ms_item-obj_type form = mv_form_name masterlang = mv_language CHANGING order = lv_order EXCEPTIONS invalid_input = 1 order_canceled = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~changed_by. DATA: ls_last_changed TYPE ty_s_form_header. ls_last_changed = get_last_changes( ms_item-obj_name ). IF ls_last_changed-tdluser IS NOT INITIAL. rv_user = ls_last_changed-tdluser. ELSE. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. CALL FUNCTION 'DELETE_FORM' EXPORTING form = mv_form_name language = '*'. order_check_and_insert( ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lt_form_data TYPE ty_t_form_data. DATA: lt_lines TYPE ty_t_lines. FIELD-SYMBOLS: <ls_form_data> TYPE LINE OF ty_t_form_data. io_xml->read( EXPORTING iv_name = c_objectname_form CHANGING cg_data = lt_form_data ). LOOP AT lt_form_data ASSIGNING <ls_form_data>. lt_lines = extract_tdlines( <ls_form_data> ). _save_form( EXPORTING it_lines = lt_lines CHANGING cs_form_data = <ls_form_data> ). ENDLOOP. CALL FUNCTION 'SAPSCRIPT_DELETE_LOAD' EXPORTING delete = abap_true form = '*' write = space. tadir_insert( iv_package ). order_check_and_insert( ). ENDMETHOD. METHOD zif_abapgit_object~exists. CALL FUNCTION 'READ_FORM' EXPORTING form = mv_form_name read_only_header = abap_true IMPORTING found = rv_bool. ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-delete_tadir = abap_true. ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. DATA: lv_object TYPE seqg3-garg. " example lock entry "'001FORM ZTEST_SAPSCRIPT TXT' lv_object = |{ sy-mandt }{ ms_item-obj_type } { ms_item-obj_name }|. OVERLAY lv_object WITH ' '. lv_object = lv_object && '*'. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESSFORM' iv_argument = lv_object ). ENDMETHOD. METHOD zif_abapgit_object~jump. DATA: lt_bdcdata TYPE TABLE OF bdcdata. FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-program = 'SAPMSSCF'. <ls_bdcdata>-dynpro = '1102'. <ls_bdcdata>-dynbegin = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'BDC_OKCODE'. <ls_bdcdata>-fval = '=SHOW'. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'RSSCF-TDFORM'. <ls_bdcdata>-fval = ms_item-obj_name. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SE71' mode_val = 'E' TABLES using_tab = lt_bdcdata EXCEPTIONS OTHERS = 1 ##fm_subrc_ok. "#EC CI_SUBRC ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lt_form_data TYPE ty_t_form_data. DATA: ls_form_data TYPE ty_s_form_data. DATA: lt_text_header TYPE ty_t_text_header. DATA: lt_lines TYPE ty_t_lines. DATA: lv_form_found TYPE abap_bool. FIELD-SYMBOLS: <ls_text_header> LIKE LINE OF lt_text_header. lt_text_header = find_form( ms_item-obj_name ). LOOP AT lt_text_header ASSIGNING <ls_text_header>. CLEAR lt_lines. CLEAR ls_form_data. _read_form( EXPORTING is_text_header = <ls_text_header> IMPORTING ev_form_found = lv_form_found es_form_data = ls_form_data et_lines = lt_lines ). IF lv_form_found = abap_true. _clear_changed_fields( CHANGING cs_form_data = ls_form_data ). compress_lines( is_form_data = ls_form_data it_lines = lt_lines ). INSERT ls_form_data INTO TABLE lt_form_data. ENDIF. ENDLOOP. IF lt_form_data IS NOT INITIAL. io_xml->add( iv_name = c_objectname_form ig_data = lt_form_data ). ENDIF. ENDMETHOD. METHOD _clear_changed_fields. CLEAR: cs_form_data-form_header-tdfuser, cs_form_data-form_header-tdfdate, cs_form_data-form_header-tdftime, cs_form_data-form_header-tdfreles, cs_form_data-form_header-tdluser, cs_form_data-form_header-tdldate, cs_form_data-form_header-tdltime, cs_form_data-form_header-tdlreles. CLEAR: cs_form_data-text_header-tdfuser, cs_form_data-text_header-tdfdate, cs_form_data-text_header-tdftime, cs_form_data-text_header-tdfreles, cs_form_data-text_header-tdluser, cs_form_data-text_header-tdldate, cs_form_data-text_header-tdltime, cs_form_data-text_header-tdlreles. ENDMETHOD. METHOD _read_form. CLEAR es_form_data. CALL FUNCTION 'READ_FORM' EXPORTING form = is_text_header-tdform language = is_text_header-tdspras status = ' ' IMPORTING form_header = es_form_data-form_header found = ev_form_found header = es_form_data-text_header olanguage = es_form_data-orig_language TABLES form_lines = et_lines pages = es_form_data-pages page_windows = es_form_data-page_windows paragraphs = es_form_data-paragraphs strings = es_form_data-strings tabs = es_form_data-tabs windows = es_form_data-windows. _sort_tdlines_by_windows( CHANGING ct_form_windows = es_form_data-windows ct_lines = et_lines ). es_form_data-form_header-tdversion = '00001'. es_form_data-text_header-tdversion = '00001'. ENDMETHOD. METHOD _save_form. CALL FUNCTION 'SAVE_FORM' EXPORTING form_header = cs_form_data-form_header TABLES form_lines = it_lines pages = cs_form_data-pages page_windows = cs_form_data-page_windows paragraphs = cs_form_data-paragraphs strings = cs_form_data-strings tabs = cs_form_data-tabs windows = cs_form_data-windows. CALL FUNCTION 'SAPSCRIPT_CHANGE_OLANGUAGE' EXPORTING forced = abap_true name = cs_form_data-text_header-tdname object = cs_form_data-text_header-tdobject olanguage = cs_form_data-orig_language EXCEPTIONS OTHERS = 1 ##fm_subrc_ok. "#EC CI_SUBRC ENDMETHOD. METHOD _sort_tdlines_by_windows. DATA lt_lines TYPE ty_t_lines. DATA ls_lines LIKE LINE OF lt_lines. DATA ls_form_windows LIKE LINE OF ct_form_windows. DATA lv_elt_windows TYPE tdformat VALUE '/W'. DATA lv_firstloop TYPE abap_bool. lt_lines = ct_lines. CLEAR ct_lines. SORT ct_form_windows BY tdwindow. LOOP AT ct_form_windows INTO ls_form_windows. lv_firstloop = abap_true. READ TABLE lt_lines INTO ls_lines WITH KEY tdformat = lv_elt_windows tdline = ls_form_windows-tdwindow. IF sy-subrc <> 0. CONTINUE. " current loop ENDIF. LOOP AT lt_lines INTO ls_lines FROM sy-tabix. IF lv_firstloop = abap_false AND ls_lines-tdformat = lv_elt_windows. EXIT. ENDIF. APPEND ls_lines TO ct_lines. lv_firstloop = abap_false. ENDLOOP. ENDLOOP. ENDMETHOD. ENDCLASS.
27.531532
113
0.628141
bd5f58350e0c0977b78b521b20292051e1e5e696
9,599
abap
ABAP
src/objects/zcl_abapgit_oo_class.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
1
2020-01-31T16:40:50.000Z
2020-01-31T16:40:50.000Z
src/objects/zcl_abapgit_oo_class.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_oo_class.clas.abap
RainerWinkler/abapGit
03dca5625f4b99753a33b4b5642bf9558f2c7454
[ "MIT" ]
1
2020-01-31T16:23:43.000Z
2020-01-31T16:23:43.000Z
CLASS zcl_abapgit_oo_class DEFINITION PUBLIC INHERITING FROM zcl_abapgit_oo_base. PUBLIC SECTION. METHODS: zif_abapgit_oo_object_fnc~create REDEFINITION, zif_abapgit_oo_object_fnc~generate_locals REDEFINITION, zif_abapgit_oo_object_fnc~insert_text_pool REDEFINITION, zif_abapgit_oo_object_fnc~create_sotr REDEFINITION, zif_abapgit_oo_object_fnc~get_includes REDEFINITION, zif_abapgit_oo_object_fnc~get_class_properties REDEFINITION, zif_abapgit_oo_object_fnc~read_text_pool REDEFINITION, zif_abapgit_oo_object_fnc~read_sotr REDEFINITION, zif_abapgit_oo_object_fnc~delete REDEFINITION. ENDCLASS. CLASS zcl_abapgit_oo_class IMPLEMENTATION. METHOD zif_abapgit_oo_object_fnc~create. CALL FUNCTION 'SEO_CLASS_CREATE_COMPLETE' EXPORTING devclass = iv_package overwrite = iv_overwrite CHANGING class = is_properties EXCEPTIONS existing = 1 is_interface = 2 db_error = 3 component_error = 4 no_access = 5 other = 6 OTHERS = 7. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SEO_CLASS_CREATE_COMPLETE' ). ENDIF. ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~generate_locals. CALL FUNCTION 'SEO_CLASS_GENERATE_LOCALS' EXPORTING clskey = is_key force = iv_force locals_def = it_local_definitions locals_imp = it_local_implementations locals_mac = it_local_macros locals_testclasses = it_local_test_classes EXCEPTIONS not_existing = 1 model_only = 2 locals_not_generated = 3 locals_not_initialised = 4 OTHERS = 5. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from generate_locals' ). ENDIF. ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~insert_text_pool. DATA: lv_cp TYPE program. lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ). INSERT TEXTPOOL lv_cp FROM it_text_pool LANGUAGE iv_language STATE 'I'. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ). ENDIF. zcl_abapgit_objects_activation=>add( iv_type = 'REPT' iv_name = lv_cp ). ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~create_sotr. DATA: lt_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt, lt_objects TYPE sotr_objects, ls_paket TYPE sotr_pack, lv_object LIKE LINE OF lt_objects. FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF lt_sotr. LOOP AT it_sotr ASSIGNING <ls_sotr>. CALL FUNCTION 'SOTR_OBJECT_GET_OBJECTS' EXPORTING object_vector = <ls_sotr>-header-objid_vec IMPORTING objects = lt_objects EXCEPTIONS object_not_found = 1 OTHERS = 2. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SOTR_OBJECT_GET_OBJECTS' ). ENDIF. READ TABLE lt_objects INDEX 1 INTO lv_object. ASSERT sy-subrc = 0. ls_paket-paket = iv_package. CALL FUNCTION 'SOTR_CREATE_CONCEPT' EXPORTING paket = ls_paket crea_lan = <ls_sotr>-header-crea_lan alias_name = <ls_sotr>-header-alias_name object = lv_object entries = <ls_sotr>-entries concept_default = <ls_sotr>-header-concept EXCEPTIONS package_missing = 1 crea_lan_missing = 2 object_missing = 3 paket_does_not_exist = 4 alias_already_exist = 5 object_type_not_found = 6 langu_missing = 7 identical_context_not_allowed = 8 text_too_long = 9 error_in_update = 10 no_master_langu = 11 error_in_concept_id = 12 alias_not_allowed = 13 tadir_entry_creation_failed = 14 internal_error = 15 error_in_correction = 16 user_cancelled = 17 no_entry_found = 18 OTHERS = 19. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from SOTR_CREATE_CONCEPT' ). ENDIF. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~get_includes. * note: includes returned might not exist * method cl_oo_classname_service=>GET_ALL_CLASS_INCLUDES does not exist in 702 DATA: lv_class_name TYPE seoclsname, lt_methods TYPE seop_methods_w_include. FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods. lv_class_name = iv_object_name. APPEND cl_oo_classname_service=>get_ccdef_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_ccmac_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_ccimp_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_cl_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_ccau_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_pubsec_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_prosec_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_prisec_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_classpool_name( lv_class_name ) TO rt_includes. APPEND cl_oo_classname_service=>get_ct_name( lv_class_name ) TO rt_includes. * skip the CS include, as it is sometimes generated on the fly instead of * when the methods are changed * APPEND cl_oo_classname_service=>get_cs_name( lv_class_name ) TO rt_includes. cl_oo_classname_service=>get_all_method_includes( EXPORTING clsname = lv_class_name RECEIVING result = lt_methods EXCEPTIONS class_not_existing = 1 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Class { lv_class_name } not existing| ). ENDIF. LOOP AT lt_methods ASSIGNING <ls_method>. APPEND <ls_method>-incname TO rt_includes. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~get_class_properties. CALL FUNCTION 'SEO_CLIF_GET' EXPORTING cifkey = is_class_key version = seoc_version_active IMPORTING class = rs_class_properties EXCEPTIONS not_existing = 1 deleted = 2 model_only = 3 OTHERS = 4. IF sy-subrc = 1. RETURN. " in case only inactive version exists ELSEIF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from seo_clif_get' ). ENDIF. ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~read_text_pool. DATA: lv_cp TYPE program. lv_cp = cl_oo_classname_service=>get_classpool_name( iv_class_name ). READ TEXTPOOL lv_cp INTO rt_text_pool LANGUAGE iv_language. "#EC CI_READ_REP ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~read_sotr. DATA: lv_concept TYPE sotr_head-concept, lt_seocompodf TYPE STANDARD TABLE OF seocompodf WITH DEFAULT KEY, ls_header TYPE sotr_head, lt_entries TYPE sotr_text_tt. FIELD-SYMBOLS: <ls_sotr> LIKE LINE OF rt_sotr, <ls_seocompodf> LIKE LINE OF lt_seocompodf, <ls_entry> LIKE LINE OF lt_entries. SELECT * FROM seocompodf INTO TABLE lt_seocompodf WHERE clsname = iv_object_name AND version = '1' AND exposure = '2' AND attdecltyp = '2' AND type = 'SOTR_CONC' ORDER BY PRIMARY KEY. "#EC CI_SUBRC LOOP AT lt_seocompodf ASSIGNING <ls_seocompodf>. lv_concept = translate( val = <ls_seocompodf>-attvalue from = '''' to = '' ). CALL FUNCTION 'SOTR_GET_CONCEPT' EXPORTING concept = lv_concept IMPORTING header = ls_header TABLES entries = lt_entries EXCEPTIONS no_entry_found = 1 OTHERS = 2. IF sy-subrc <> 0. CONTINUE. ENDIF. CLEAR: ls_header-paket, ls_header-crea_name, ls_header-crea_tstut, ls_header-chan_name, ls_header-chan_tstut. LOOP AT lt_entries ASSIGNING <ls_entry>. CLEAR: <ls_entry>-version, <ls_entry>-crea_name, <ls_entry>-crea_tstut, <ls_entry>-chan_name, <ls_entry>-chan_tstut. ENDLOOP. APPEND INITIAL LINE TO rt_sotr ASSIGNING <ls_sotr>. <ls_sotr>-header = ls_header. <ls_sotr>-entries = lt_entries. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_oo_object_fnc~delete. CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE' EXPORTING clskey = is_deletion_key EXCEPTIONS not_existing = 1 is_interface = 2 db_error = 3 no_access = 4 other = 5 OTHERS = 6. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error from SEO_CLASS_DELETE_COMPLETE' ). ENDIF. ENDMETHOD. ENDCLASS.
34.039007
87
0.620377
bd63553d66bec23f9df49e67367a834711549150
772
abap
ABAP
gui/zinfmonitor_gui_appl_evt.prog.abap
rayatus/sapinterfacemonitor
5a1792440e47e78ac37da795204d95887281a4c3
[ "MIT" ]
3
2019-02-10T18:36:12.000Z
2019-12-09T17:37:55.000Z
gui/zinfmonitor_gui_appl_evt.prog.abap
rayatus/sapinterfacemonitor
5a1792440e47e78ac37da795204d95887281a4c3
[ "MIT" ]
3
2018-12-02T12:15:08.000Z
2019-02-17T21:38:02.000Z
gui/zinfmonitor_gui_appl_evt.prog.abap
rayatus/sapinterfacemonitor
5a1792440e47e78ac37da795204d95887281a4c3
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Include ZINFMONITOR_GUI_APPL_EVT *&---------------------------------------------------------------------* *======================================================================= INITIALIZATION. *======================================================================= PERFORM initialization. *======================================================================= START-OF-SELECTION. *======================================================================= PERFORM start_of_selection. *======================================================================= end-OF-SELECTION. *======================================================================= PERFORM end_of_selection.
40.631579
72
0.186528
bd64c5ca866da2d1bafee1ac107889e6d3d87962
974
abap
ABAP
src/rest/if_request.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
1
2020-06-24T22:15:05.000Z
2020-06-24T22:15:05.000Z
src/rest/if_request.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
null
null
null
src/rest/if_request.abap
lezamad/OOP-Library
ae74ea420b1768262b5aee0718e6c613ed06e5fa
[ "Unlicense", "MIT" ]
null
null
null
*"* components of interface /OOP/IF_REQUEST interface /OOP/IF_REQUEST public . methods GET_BODY_BINARY returning value(RETURNING) type XSTRING . methods GET_BODY_TEXT returning value(RETURNING) type STRING . methods GET_CONTENT_TYPE returning value(RETURNING) type STRING . methods GET_HEADER importing !NAME type STRING returning value(RETURNING) type STRING . methods GET_METHOD returning value(RETURNING) type STRING . methods GET_PARAMETER importing !NAME type STRING returning value(RETURNING) type STRING . methods GET_RAW_MESSAGE returning value(RETURNING) type XSTRING . methods GET_REQUESTURI returning value(RETURNING) type STRING . methods LIST_HEADERS returning value(RETURNING) type TIHTTPNVP . methods LIST_PARAMETERS returning value(RETURNING) type TIHTTPNVP . endinterface.
23.756098
44
0.678645
bd70b94b60619df1583b47b8c85188a01c8ec34b
350
abap
ABAP
src/legacy/#dmo#flight_travel_api04.fugr.#dmo#flight_travel_initiali_04.abap
SAP-Cloud-Platform/flight04
8c66bd222a10eac25582da83d0a3347dd41cd55b
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api04.fugr.#dmo#flight_travel_initiali_04.abap
SAP-Cloud-Platform/flight04
8c66bd222a10eac25582da83d0a3347dd41cd55b
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api04.fugr.#dmo#flight_travel_initiali_04.abap
SAP-Cloud-Platform/flight04
8c66bd222a10eac25582da83d0a3347dd41cd55b
[ "BSD-Source-Code" ]
null
null
null
"! API for Initializing the Transactional Buffer of the Travel API "! FUNCTION /DMO/FLIGHT_TRAVEL_INITIALI_04. *"---------------------------------------------------------------------- *"*"Local Interface: *"---------------------------------------------------------------------- /dmo/cl_flight_legacy04=>get_instance( )->initialize( ). ENDFUNCTION.
38.888889
72
0.451429
bd70bff3f8c735d90306707b82c5afdb3c782e4c
6,591
abap
ABAP
src/zcl_xtt_file_oaor.clas.abap
monty79/xtt
fab2320149a42fa9147836d98570b36a9208bd3e
[ "Apache-2.0" ]
null
null
null
src/zcl_xtt_file_oaor.clas.abap
monty79/xtt
fab2320149a42fa9147836d98570b36a9208bd3e
[ "Apache-2.0" ]
null
null
null
src/zcl_xtt_file_oaor.clas.abap
monty79/xtt
fab2320149a42fa9147836d98570b36a9208bd3e
[ "Apache-2.0" ]
null
null
null
class ZCL_XTT_FILE_OAOR definition public create public . public section. type-pools ABAP . type-pools SBDST . interfaces ZIF_XTT_FILE . methods CONSTRUCTOR importing !IV_CLASSNAME type SBDST_CLASSNAME !IV_CLASSTYPE type SBDST_CLASSTYPE default 'OT' !IV_OBJECT_KEY type SBDST_OBJECT_KEY !IV_FILENAME type CSEQUENCE . protected section. PRIVATE SECTION. TYPES: BEGIN OF ts_signature, objid TYPE bapicompo2-objid, file_name TYPE bapicompo2-file_name, doc_ver_no TYPE bapisignat-doc_ver_no, doc_id TYPE bapisignat-doc_id, class TYPE sdok_class, * bds_documenttype TYPE string, * bds_documentclass TYPE string, * created_at TYPE string, * created_by TYPE string, description TYPE string, language TYPE string, * last_changed_at TYPE string, * last_changed_by TYPE string, * state TYPE string, storage_category TYPE text128, END OF ts_signature. DATA ms_signature TYPE ts_signature. ENDCLASS. CLASS ZCL_XTT_FILE_OAOR IMPLEMENTATION. METHOD constructor. DATA: lt_signature TYPE STANDARD TABLE OF ts_signature, ls_signature TYPE REF TO ts_signature, lt_sbdst_signature TYPE sbdst_signature, ls_sbdst_signature TYPE REF TO bapisignat, lt_sbdst_components2 TYPE sbdst_components2, ls_sbdst_components2 TYPE REF TO bapicompo2. * lt_connect TYPE srm_bdsconn_t, * ls_connect TYPE REF TO bapiconnec, * lv_maxver LIKE iv_version, * lv_type TYPE toav0-sap_object, * lv_objid TYPE toav0-object_id, * lt_conn TYPE STANDARD TABLE OF toav0, * ls_conn TYPE REF TO toav0, * lv_cnt TYPE i. FIELD-SYMBOLS: <l_val> TYPE csequence. * " Special case for archive link or GOS(Generic Object Services) * IF iv_archiv_link = abap_true. * lv_type = iv_classname. * lv_objid = iv_object_key. * CALL FUNCTION 'ARCHIV_GET_CONNECTIONS' * EXPORTING * objecttype = lv_type * object_id = lv_objid * TABLES * connections = lt_conn * EXCEPTIONS * OTHERS = 2. * CHECK sy-subrc = 0. * * " Get last one * SORT lt_conn BY ar_date. * lv_cnt = lines( lt_conn ). * READ TABLE lt_conn REFERENCE INTO ls_conn INDEX lv_cnt. * * " Last version by date * IF sy-subrc = 0. * ms_signature-storage_category = ls_conn->archiv_id. * ms_signature-objid = ls_conn->arc_doc_id. * * " TODO only from importing parameter * ms_signature-file_name = iv_filename. * ENDIF. * * RETURN. * ENDIF. ********************************************************************** * To edit files in OAOR -> SM30 -> V_TOADD * DOC application/msword WORD.DOCUMENT.8 * XLS application/vnd.ms-excel EXCEL.SHEET.8 ********************************************************************** " Finding the right documents cl_bds_document_set=>get_info( EXPORTING classname = iv_classname classtype = iv_classtype object_key = iv_object_key IMPORTING extended_components = lt_sbdst_components2 "connections = lt_connect CHANGING signature = lt_sbdst_signature EXCEPTIONS OTHERS = 7 ). IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO sy-msgli. zcx_xtt_exception=>raise_dump( iv_message = sy-msgli ). ENDIF. " lt_sbdst_signature structure is complex LOOP AT lt_sbdst_signature REFERENCE INTO ls_sbdst_signature. AT NEW doc_count. " Create new item APPEND INITIAL LINE TO lt_signature REFERENCE INTO ls_signature. ls_signature->doc_id = ls_sbdst_signature->doc_id. ls_signature->doc_ver_no = ls_sbdst_signature->doc_ver_no. " Concatenate 2 tables READ TABLE lt_sbdst_components2 REFERENCE INTO ls_sbdst_components2 INDEX ls_sbdst_signature->doc_count. ls_signature->objid = ls_sbdst_components2->objid. ls_signature->file_name = ls_sbdst_components2->file_name. ls_signature->class = ls_sbdst_components2->class. ENDAT. " Find field by name UNASSIGN <l_val>. ASSIGN COMPONENT ls_sbdst_signature->prop_name OF STRUCTURE ls_signature->* TO <l_val>. CHECK <l_val> IS ASSIGNED. <l_val> = ls_sbdst_signature->prop_value. ENDLOOP. " Apply filter DELETE lt_signature WHERE file_name <> iv_filename. " Max versions first SORT lt_signature BY doc_id doc_ver_no DESCENDING. " Read the last version READ TABLE lt_signature INTO ms_signature INDEX 1. CHECK sy-subrc <> 0. MESSAGE 'Unable to detect the file'(udf) TYPE 'X'. ENDMETHOD. METHOD zif_xtt_file~get_content. DATA: ls_object_id TYPE sdokobject, lt_info TYPE STANDARD TABLE OF sdokfilaci, ls_info TYPE REF TO sdokfilaci, lt_text TYPE STANDARD TABLE OF sdokcntasc, lt_bin TYPE STANDARD TABLE OF sdokcntbin, lv_file_size TYPE i. FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE. CLEAR: ev_as_string, ev_as_xstring. ls_object_id-class = ms_signature-class. ls_object_id-objid = ms_signature-objid. CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT' EXPORTING object_id = ls_object_id text_as_stream = abap_true TABLES file_access_info = lt_info file_content_ascii = lt_text file_content_binary = lt_bin EXCEPTIONS OTHERS = 5. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO sy-msgli. zcx_xtt_exception=>raise_dump( iv_message = sy-msgli ). ENDIF. READ TABLE lt_info REFERENCE INTO ls_info INDEX 1. CHECK sy-subrc = 0. " Text or binary IF lt_bin[] IS NOT INITIAL. ASSIGN lt_bin TO <lt_table>. ELSE. ASSIGN lt_text TO <lt_table>. ENDIF. " Detect file size lv_file_size = ls_info->file_size. " Result as a xstring IF ev_as_xstring IS REQUESTED. ev_as_xstring = zcl_eui_conv=>binary_to_xstring( it_table = <lt_table> iv_length = lv_file_size ). RETURN. ENDIF. " Result as a string. if ev_as_STRING Is Requested ev_as_string = zcl_eui_conv=>binary_to_string( it_table = <lt_table> iv_length = lv_file_size ). ENDMETHOD. METHOD zif_xtt_file~get_name. rv_name = ms_signature-file_name. ENDMETHOD. ENDCLASS.
29.163717
104
0.657867
bd7558662fb72bc4168b13678dbed4401e64099a
1,389
abap
ABAP
src/alv/zif_uitb_c_alv_colors.intf.abap
stockbal/abap-ui-toolbox
93ee48975deab71aa16e3c898c9863b0c4e6ee19
[ "MIT" ]
3
2021-03-08T13:02:46.000Z
2021-11-30T20:04:44.000Z
src/alv/zif_uitb_c_alv_colors.intf.abap
stockbal/abap-ui-toolbox
93ee48975deab71aa16e3c898c9863b0c4e6ee19
[ "MIT" ]
1
2021-03-31T17:13:50.000Z
2021-03-31T20:05:02.000Z
src/alv/zif_uitb_c_alv_colors.intf.abap
stockbal/abap-ui-toolbox
93ee48975deab71aa16e3c898c9863b0c4e6ee19
[ "MIT" ]
null
null
null
INTERFACE ZIF_UITB_C_ALV_COLORS PUBLIC . CONSTANTS: greyblue(04) TYPE c VALUE 'C100', lightgrey(04) TYPE c VALUE 'C200', yellow(04) TYPE c VALUE 'C300', bluegreen(04) TYPE c VALUE 'C400', green(04) TYPE c VALUE 'C500', red(04) TYPE c VALUE 'C600', violett(04) TYPE c VALUE 'C700', greyblue_int(04) TYPE c VALUE 'C110', lightgrey_int(04) TYPE c VALUE 'C210', yellow_int(04) TYPE c VALUE 'C310', bluegreen_int(04) TYPE c VALUE 'C410', green_int(04) TYPE c VALUE 'C510', red_int(04) TYPE c VALUE 'C610', violett_int(04) TYPE c VALUE 'C710', greyblue_inv(04) TYPE c VALUE 'C101', lightgrey_inv(04) TYPE c VALUE 'C201', yellow_inv(04) TYPE c VALUE 'C301', bluegreen_inv(04) TYPE c VALUE 'C401', green_inv(04) TYPE c VALUE 'C501', red_inv(04) TYPE c VALUE 'C601', violett_inv(04) TYPE c VALUE 'C701', greyblue_int_inv(04) TYPE c VALUE 'C111', lightgrey_int_inv(04) TYPE c VALUE 'C211', yellow_int_inv(04) TYPE c VALUE 'C311', bluegreen_int_inv(04) TYPE c VALUE 'C411', green_int_inv(04) TYPE c VALUE 'C511', red_int_inv(04) TYPE c VALUE 'C611', violett_int_inv(04) TYPE c VALUE 'C711'. ENDINTERFACE.
38.583333
46
0.579554
bd75a0c151ffed9debf07e569ecd360a0353429e
5,566
abap
ABAP
src/zcl_abapgit_factory.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
1
2020-03-28T06:23:11.000Z
2020-03-28T06:23:11.000Z
src/zcl_abapgit_factory.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
null
null
null
src/zcl_abapgit_factory.clas.abap
jeevanrajv1901/ABAPGIT
6d2deece76a481da75a04e4bbafae2d286b64834
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_factory DEFINITION PUBLIC CREATE PRIVATE GLOBAL FRIENDS zcl_abapgit_injector. PUBLIC SECTION. CLASS-METHODS get_tadir RETURNING VALUE(ri_tadir) TYPE REF TO zif_abapgit_tadir . CLASS-METHODS get_sap_package IMPORTING !iv_package TYPE devclass RETURNING VALUE(ri_sap_package) TYPE REF TO zif_abapgit_sap_package . CLASS-METHODS get_code_inspector IMPORTING !iv_package TYPE devclass RETURNING VALUE(ri_code_inspector) TYPE REF TO zif_abapgit_code_inspector RAISING zcx_abapgit_exception . CLASS-METHODS get_branch_overview IMPORTING !io_repo TYPE REF TO zcl_abapgit_repo_online RETURNING VALUE(ri_branch_overview) TYPE REF TO zif_abapgit_branch_overview RAISING zcx_abapgit_exception . CLASS-METHODS get_stage_logic RETURNING VALUE(ri_logic) TYPE REF TO zif_abapgit_stage_logic . CLASS-METHODS get_cts_api RETURNING VALUE(ri_cts_api) TYPE REF TO zif_abapgit_cts_api . CLASS-METHODS get_environment RETURNING VALUE(ri_environment) TYPE REF TO zif_abapgit_environment . CLASS-METHODS get_longtexts IMPORTING iv_longtexts_name TYPE string OPTIONAL RETURNING VALUE(ro_longtexts) TYPE REF TO zcl_abapgit_longtexts. PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_sap_package, package TYPE devclass, instance TYPE REF TO zif_abapgit_sap_package, END OF ty_sap_package . TYPES: tty_sap_package TYPE HASHED TABLE OF ty_sap_package WITH UNIQUE KEY package . TYPES: BEGIN OF ty_code_inspector, package TYPE devclass, instance TYPE REF TO zif_abapgit_code_inspector, END OF ty_code_inspector . TYPES: tty_code_inspector TYPE HASHED TABLE OF ty_code_inspector WITH UNIQUE KEY package . TYPES: BEGIN OF ty_longtexts, longtexts_name TYPE string, instance TYPE REF TO zcl_abapgit_longtexts, END OF ty_longtexts . TYPES: tty_longtexts TYPE HASHED TABLE OF ty_longtexts WITH UNIQUE KEY longtexts_name . CLASS-DATA gi_tadir TYPE REF TO zif_abapgit_tadir . CLASS-DATA gt_sap_package TYPE tty_sap_package . CLASS-DATA gt_code_inspector TYPE tty_code_inspector . CLASS-DATA gi_stage_logic TYPE REF TO zif_abapgit_stage_logic . CLASS-DATA gi_cts_api TYPE REF TO zif_abapgit_cts_api . CLASS-DATA gi_environment TYPE REF TO zif_abapgit_environment . CLASS-DATA gt_longtexts TYPE tty_longtexts. ENDCLASS. CLASS zcl_abapgit_factory IMPLEMENTATION. METHOD get_branch_overview. CREATE OBJECT ri_branch_overview TYPE zcl_abapgit_branch_overview EXPORTING io_repo = io_repo. ENDMETHOD. METHOD get_code_inspector. DATA: ls_code_inspector LIKE LINE OF gt_code_inspector. FIELD-SYMBOLS: <ls_code_inspector> TYPE ty_code_inspector. READ TABLE gt_code_inspector ASSIGNING <ls_code_inspector> WITH TABLE KEY package = iv_package. IF sy-subrc <> 0. ls_code_inspector-package = iv_package. CREATE OBJECT ls_code_inspector-instance TYPE zcl_abapgit_code_inspector EXPORTING iv_package = iv_package. INSERT ls_code_inspector INTO TABLE gt_code_inspector ASSIGNING <ls_code_inspector>. ENDIF. ri_code_inspector = <ls_code_inspector>-instance. ENDMETHOD. METHOD get_cts_api. IF gi_cts_api IS NOT BOUND. CREATE OBJECT gi_cts_api TYPE zcl_abapgit_cts_api. ENDIF. ri_cts_api = gi_cts_api. ENDMETHOD. METHOD get_environment. IF gi_environment IS NOT BOUND. CREATE OBJECT gi_environment TYPE zcl_abapgit_environment. ENDIF. ri_environment = gi_environment. ENDMETHOD. METHOD get_sap_package. DATA: ls_sap_package TYPE ty_sap_package. FIELD-SYMBOLS: <ls_sap_package> TYPE ty_sap_package. READ TABLE gt_sap_package ASSIGNING <ls_sap_package> WITH TABLE KEY package = iv_package. IF sy-subrc <> 0. ls_sap_package-package = iv_package. CREATE OBJECT ls_sap_package-instance TYPE zcl_abapgit_sap_package EXPORTING iv_package = iv_package. INSERT ls_sap_package INTO TABLE gt_sap_package ASSIGNING <ls_sap_package>. ENDIF. ri_sap_package = <ls_sap_package>-instance. ENDMETHOD. METHOD get_stage_logic. IF gi_stage_logic IS INITIAL. CREATE OBJECT gi_stage_logic TYPE zcl_abapgit_stage_logic. ENDIF. ri_logic = gi_stage_logic. ENDMETHOD. METHOD get_tadir. IF gi_tadir IS INITIAL. CREATE OBJECT gi_tadir TYPE zcl_abapgit_tadir. ENDIF. ri_tadir = gi_tadir. ENDMETHOD. METHOD get_longtexts. DATA: ls_longtext TYPE ty_longtexts. FIELD-SYMBOLS: <ls_longtext> TYPE ty_longtexts. READ TABLE gt_longtexts ASSIGNING <ls_longtext> WITH TABLE KEY longtexts_name = iv_longtexts_name. IF sy-subrc <> 0. ls_longtext-longtexts_name = iv_longtexts_name. CREATE OBJECT ls_longtext-instance EXPORTING iv_longtexts_name = iv_longtexts_name. INSERT ls_longtext INTO TABLE gt_longtexts ASSIGNING <ls_longtext>. ENDIF. ro_longtexts = <ls_longtext>-instance. ENDMETHOD. ENDCLASS.
26.504762
78
0.692598
bd78c1ae8275ac2a02f3403aa6bc53bdab2fc16b
624
abap
ABAP
zbugtracker_view/zbugtracker_view_alv/zbt_dynpro.fugr.lzbt_dynprop01.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
3
2019-02-10T22:03:43.000Z
2021-05-26T06:49:55.000Z
zbugtracker_view/zbugtracker_view_alv/zbt_dynpro.fugr.lzbt_dynprop01.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
2
2020-05-06T14:25:17.000Z
2022-01-13T10:06:40.000Z
zbugtracker_view/zbugtracker_view_alv/zbt_dynpro.fugr.lzbt_dynprop01.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
1
2021-05-26T06:49:56.000Z
2021-05-26T06:49:56.000Z
*----------------------------------------------------------------------* ***INCLUDE LZBT_DYNPROP01 . *----------------------------------------------------------------------* *&---------------------------------------------------------------------* *& Class (Implementation) lcl_handler *&---------------------------------------------------------------------* * Text *----------------------------------------------------------------------* CLASS lcl_handler IMPLEMENTATION. METHOD on_comment_added. sender->refresh( ). ENDMETHOD. "on_comment_added ENDCLASS. "lcl_handler
44.571429
72
0.262821
bd81b1f6d8db0871b7d6b5626920a4c3e1031551
4,009
abap
ABAP
src/zcl_sel_var.clas.abap
alaible/abap_base_utils
7ccc334dbf7bb65c58ad1de7a0fcda3727d419f3
[ "MIT" ]
null
null
null
src/zcl_sel_var.clas.abap
alaible/abap_base_utils
7ccc334dbf7bb65c58ad1de7a0fcda3727d419f3
[ "MIT" ]
null
null
null
src/zcl_sel_var.clas.abap
alaible/abap_base_utils
7ccc334dbf7bb65c58ad1de7a0fcda3727d419f3
[ "MIT" ]
null
null
null
CLASS zcl_sel_var DEFINITION PUBLIC ABSTRACT CREATE PROTECTED. PUBLIC SECTION. TYPES: tty_tvarvc TYPE TABLE OF tvarvc WITH EMPTY KEY. METHODS: * get_type ABSTRACT RETURNING VALUE(rv_type) TYPE tvarvc-type, set_type ABSTRACT, constructor IMPORTING iv_name TYPE tvarvc-name, delete_from_name RETURNING VALUE(rv_del_cnt) TYPE i RAISING zcx_data_access_error, enqueue_tvarv IMPORTING iv_lock_mode TYPE c RAISING zcx_enqueue_error, dequeue_tvarv, keep_old_values, get_old_content RETURNING VALUE(rt_cont) TYPE tty_tvarvc, promote_to_write_lock RAISING zcx_enqueue_error, read_current_values. *** Flag, ob Variable neu (-> Keine Werte in der Tabelle tvarvc) DATA: mv_var_new TYPE abap_bool READ-ONLY. *** Bisherige Wert(e) aus der Tabelle tvarc DATA: mt_tvarvc_old TYPE TABLE OF tvarvc READ-ONLY. *** Konstanten für Lock-Type CLASS-DATA: gc_lock_excl TYPE c LENGTH 1 VALUE 'E', gc_lock_shared TYPE c LENGTH 1 VALUE 'S', gc_lock_opt TYPE c LENGTH 1 VALUE 'O', gc_lock_promote TYPE c LENGTH 1 VALUE 'R'. PROTECTED SECTION. *** "Schlüsseldaten" der Selektions-Varaible DATA: mv_name TYPE tvarvc-name, mv_type TYPE tvarvc-type. *** Payload zum Speichern der Variablen in der Tabelle tvarvc DATA: mt_tvarvc TYPE TABLE OF tvarvc. ENDCLASS. CLASS ZCL_SEL_VAR IMPLEMENTATION. METHOD constructor. mv_name = iv_name. ENDMETHOD. METHOD delete_from_name. IF mv_name IS INITIAL. RAISE EXCEPTION TYPE zcx_data_access_error EXPORTING mv_table = 'tvarvc' mv_op = 'delete' mv_info = 'tvarv-name initial'. ENDIF. DELETE FROM tvarvc WHERE name = @mv_name AND type = @mv_type. rv_del_cnt = sy-dbcnt. ENDMETHOD. METHOD dequeue_tvarv. CALL FUNCTION 'DEQUEUE_EZTVARVC' EXPORTING * mode_tvarvc = 'E' " Sperrmodus zur Tabelle TVARVC * mandt = SY-MANDT " 01. Enqueue Argument name = mv_name " 02. Enqueue Argument type = mv_type " 03. Enqueue Argument * numb = " 04. Enqueue Argument * x_name = space " Argument 02 mit Initialwert belegen? * x_type = space " Argument 03 mit Initialwert belegen? * x_numb = space " Argument 04 mit Initialwert belegen? * _scope = '3' * _synchron = space " Synchron entsperren * _collect = ' ' " Sperre zunächst nur Sammeln . ENDMETHOD. METHOD enqueue_tvarv. *** Sperre wird mit Type gesetzt CALL FUNCTION 'ENQUEUE_EZTVARVC' EXPORTING mode_tvarvc = iv_lock_mode name = mv_name type = mv_type * numb = * x_name = space * x_type = space * x_numb = space * _scope = '2' * _wait = space * _collect = ' ' EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_enqueue_error MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDMETHOD. METHOD get_old_content. rt_cont = me->mt_tvarvc_old. ENDMETHOD. METHOD keep_old_values. INSERT LINES OF mt_tvarvc_old INTO mt_tvarvc INDEX 1. ENDMETHOD. METHOD promote_to_write_lock. me->enqueue_tvarv( gc_lock_promote ). * CATCH zcx_enqueue_error. " Fehler beim Setzen einer Sperre (SM12) ENDMETHOD. METHOD read_current_values. SELECT FROM tvarvc FIELDS * WHERE name = @mv_name AND type = @mv_type INTO TABLE @mt_tvarvc_old. *** Flag für Sel-Var neu setzen IF lines( mt_tvarvc_old ) = 0. me->mv_var_new = abap_true. ENDIF. ENDMETHOD. ENDCLASS.
30.142857
88
0.618608
bd81f42d3c3a9d224afc9c593f8726ee2a21c7e1
1,607
abap
ABAP
clean_code_main/clean_code_foundation/y_scan_manager_double.clas.abap
leeroberts67/code-pal-for-abap
26b4d7efd22f5863b825c638ae6128e9331cb924
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_foundation/y_scan_manager_double.clas.abap
leeroberts67/code-pal-for-abap
26b4d7efd22f5863b825c638ae6128e9331cb924
[ "Apache-2.0" ]
null
null
null
clean_code_main/clean_code_foundation/y_scan_manager_double.clas.abap
leeroberts67/code-pal-for-abap
26b4d7efd22f5863b825c638ae6128e9331cb924
[ "Apache-2.0" ]
null
null
null
CLASS y_scan_manager_double DEFINITION PUBLIC INHERITING FROM y_ref_scan_manager. PUBLIC SECTION. TYPES str TYPE c LENGTH 255. TYPES strtab TYPE STANDARD TABLE OF str. METHODS set_ref_scan REDEFINITION. PROTECTED SECTION. METHODS inject_code IMPORTING source TYPE strtab. PRIVATE SECTION. DATA source_code TYPE sci_include. METHODS syntax_check IMPORTING source TYPE strtab. METHODS convert_code IMPORTING source TYPE strtab RETURNING VALUE(result) TYPE sci_include. ENDCLASS. CLASS Y_SCAN_MANAGER_DOUBLE IMPLEMENTATION. METHOD syntax_check. DATA program TYPE string. DATA message TYPE string. DATA line TYPE i. DATA word TYPE string. SYNTAX-CHECK FOR source PROGRAM program MESSAGE message LINE line WORD word. IF sy-subrc = 0. RETURN. ENDIF. cl_abap_unit_assert=>fail( msg = 'Syntax Error' detail = | Message:{ message }, Line:{ line }, Word:{ word } | ). ENDMETHOD. METHOD inject_code. syntax_check( source ). source_code = convert_code( source ). ENDMETHOD. METHOD convert_code. MOVE-CORRESPONDING source TO result. ENDMETHOD. METHOD set_ref_scan. DATA(source_include) = cl_ci_source_include=>feed( source_code ). DATA(ref_scan) = new cl_ci_scan( p_include = source_include p_no_classification = abap_true p_noaunit = abap_true p_no_cache = abap_true ). super->set_ref_scan( ref_scan ). ENDMETHOD. ENDCLASS.
28.192982
96
0.660859
bd8453cb1d5153de4dafd186a06bcd7e50b91d1c
4,139
abap
ABAP
src/ui/zcl_abapgit_gui_page_ex_object.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
2
2021-01-08T21:38:32.000Z
2021-11-17T19:37:14.000Z
src/ui/zcl_abapgit_gui_page_ex_object.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_ex_object.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_ex_object DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_component FINAL CREATE PRIVATE. PUBLIC SECTION. INTERFACES zif_abapgit_gui_event_handler. INTERFACES zif_abapgit_gui_renderable. CLASS-METHODS create RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception. METHODS constructor RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. CONSTANTS: BEGIN OF c_id, object_type TYPE string VALUE 'object_type', object_name TYPE string VALUE 'object_name', END OF c_id. CONSTANTS: BEGIN OF c_event, go_back TYPE string VALUE 'go-back', export TYPE string VALUE 'export', choose_object_type TYPE string VALUE 'choose-object-type', END OF c_event. DATA mo_form TYPE REF TO zcl_abapgit_html_form. DATA mo_form_data TYPE REF TO zcl_abapgit_string_map. DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map. DATA mo_form_util TYPE REF TO zcl_abapgit_html_form_utils. METHODS get_form_schema RETURNING VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form. METHODS export_object RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_gui_page_ex_object IMPLEMENTATION. METHOD constructor. super->constructor( ). mo_validation_log = NEW #( ). mo_form_data = NEW #( ). mo_form = get_form_schema( ). mo_form_util = zcl_abapgit_html_form_utils=>create( mo_form ). ENDMETHOD. METHOD create. DATA lo_component TYPE REF TO zcl_abapgit_gui_page_ex_object. lo_component = NEW #( ). ri_page = zcl_abapgit_gui_page_hoc=>create( iv_page_title = 'Export Object to Files' ii_child_component = lo_component ). ENDMETHOD. METHOD get_form_schema. ro_form = zcl_abapgit_html_form=>create( iv_form_id = 'export-object-to-files' ). ro_form->text( iv_label = 'Object Type' iv_name = c_id-object_type iv_required = abap_true iv_upper_case = abap_true iv_side_action = c_event-choose_object_type )->text( iv_label = 'Object Name' iv_name = c_id-object_name iv_required = abap_true iv_upper_case = abap_true )->command( iv_label = 'Export' iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main iv_action = c_event-export )->command( iv_label = 'Back' iv_action = c_event-go_back ). ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. mo_form_data = mo_form_util->normalize( ii_event->form_data( ) ). CASE ii_event->mv_action. WHEN c_event-go_back. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back. WHEN c_event-export. export_object( ). MESSAGE 'Object successfully exported' TYPE 'S'. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back. WHEN c_event-choose_object_type. mo_form_data->set( iv_key = c_id-object_type iv_val = zcl_abapgit_ui_factory=>get_popups( )->popup_search_help( 'TADIR-OBJECT' ) ). IF mo_form_data->get( c_id-object_type ) IS NOT INITIAL. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ELSE. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDIF. ENDCASE. ENDMETHOD. METHOD export_object. DATA lv_object_type TYPE trobjtype. DATA lv_object_name TYPE sobj_name. lv_object_type = mo_form_data->get( c_id-object_type ). lv_object_name = mo_form_data->get( c_id-object_name ). zcl_abapgit_zip=>export_object( iv_object_type = lv_object_type iv_object_name = lv_object_name ). ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. gui_services( )->register_event_handler( me ). ri_html = NEW zcl_abapgit_html( ). ri_html->add( mo_form->render( io_values = mo_form_data io_validation_log = mo_validation_log ) ). ENDMETHOD. ENDCLASS.
28.544828
96
0.685673
bd84d131dddeb642bbe56e39f557f4d6cbced40f
12,230
abap
ABAP
src/objects/zcl_abapgit_object_wdca.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
1
2018-05-11T09:36:31.000Z
2018-05-11T09:36:31.000Z
src/objects/zcl_abapgit_object_wdca.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_wdca.clas.abap
ed-holland/abapGit
380508d72c02f37f15344165411fc5a145f73e72
[ "MIT" ]
2
2016-12-14T09:31:45.000Z
2018-03-27T12:00:44.000Z
CLASS zcl_abapgit_object_wdca DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_object . PROTECTED SECTION. PRIVATE SECTION. METHODS read EXPORTING !es_outline TYPE wdy_cfg_outline_data !et_data TYPE wdy_cfg_persist_data_appl_tab RAISING zcx_abapgit_exception . METHODS save IMPORTING !is_outline TYPE wdy_cfg_outline_data !it_data TYPE wdy_cfg_persist_data_appl_tab !iv_package TYPE devclass !iv_transport TYPE trkorr RAISING zcx_abapgit_exception . METHODS delete IMPORTING !iv_package TYPE devclass !iv_transport TYPE trkorr RAISING zcx_abapgit_exception . METHODS check IMPORTING !it_messages TYPE cts_messages RAISING zcx_abapgit_exception . ENDCLASS. CLASS zcl_abapgit_object_wdca IMPLEMENTATION. METHOD check. FIELD-SYMBOLS: <ls_message> TYPE LINE OF cts_messages. LOOP AT it_messages ASSIGNING <ls_message> WHERE severity = 'E'. zcx_abapgit_exception=>raise( <ls_message>-text ). ENDLOOP. ENDMETHOD. METHOD delete. DATA: lo_cfg TYPE REF TO cl_wdr_cfg_persistence_appl, lx_err TYPE REF TO cx_wd_configuration, lt_messages TYPE cts_messages, ls_key TYPE wdy_config_key, ls_outline TYPE wdy_cfg_outline_data, lv_operation TYPE i, lv_name TYPE wdy_md_object_name, lv_exists TYPE wdy_boolean. ls_key = ms_item-obj_name. TRY. CREATE OBJECT lo_cfg EXPORTING config_key = ls_key object_name = lv_name. MOVE-CORRESPONDING ls_key TO ls_outline. lo_cfg->check_config_existent( EXPORTING i_outline_data = ls_outline i_only_current_layer = abap_false i_is_original = abap_true IMPORTING e_is_existent = lv_exists ). IF lv_exists = abap_false. RETURN. ENDIF. lo_cfg->set_transport( trkorr = iv_transport devclass = iv_package ). lv_operation = if_wdr_cfg_constants=>c_cts_operation-e_delete. " First call, check, second call, delete DO 2 TIMES. lo_cfg->do_next_step( IMPORTING e_messages = lt_messages CHANGING c_operation = lv_operation ). check( lt_messages ). ENDDO. CATCH cx_wd_configuration INTO lx_err. IF lx_err->textid = cx_wd_configuration=>conf_config_not_exist. RETURN. ELSE. zcx_abapgit_exception=>raise( 'WDCA, delete error:' && lx_err->get_text( ) ). ENDIF. ENDTRY. ENDMETHOD. METHOD read. DATA: lo_cfg TYPE REF TO cl_wdr_cfg_persistence_appl, ls_key TYPE wdy_config_key, lv_exists TYPE abap_bool, lx_err TYPE REF TO cx_wd_configuration, lv_name TYPE wdy_md_object_name. FIELD-SYMBOLS: <ls_data> LIKE LINE OF et_data, <ls_appl_params> LIKE LINE OF <ls_data>-appl_params. CLEAR: es_outline, et_data. ls_key = ms_item-obj_name. TRY. CREATE OBJECT lo_cfg EXPORTING config_key = ls_key object_name = lv_name. MOVE-CORRESPONDING ls_key TO es_outline. lo_cfg->check_config_existent( EXPORTING i_outline_data = es_outline i_only_current_layer = abap_false i_is_original = abap_true IMPORTING e_is_existent = lv_exists ). IF lv_exists = abap_false. RETURN. ENDIF. es_outline = lo_cfg->read_outline_data( ). CLEAR: es_outline-devclass, es_outline-author, es_outline-createdon, es_outline-changedby, es_outline-changedon. et_data = lo_cfg->read_data( ). " Clear descriptions since they are release and language-specific LOOP AT et_data ASSIGNING <ls_data>. LOOP AT <ls_data>-appl_params ASSIGNING <ls_appl_params>. CLEAR <ls_appl_params>-description. ENDLOOP. ENDLOOP. CATCH cx_wd_configuration INTO lx_err. zcx_abapgit_exception=>raise( 'WDCA, read error:' && lx_err->get_text( ) ). ENDTRY. ENDMETHOD. METHOD save. DATA: lo_cfg TYPE REF TO cl_wdr_cfg_persistence_appl, lx_err TYPE REF TO cx_wd_configuration, lt_messages TYPE cts_messages, ls_key TYPE wdy_config_key, ls_data LIKE LINE OF it_data, lv_operation TYPE i, lv_name TYPE wdy_md_object_name, lv_exists TYPE wdy_boolean. MOVE-CORRESPONDING is_outline TO ls_key. TRY. CREATE OBJECT lo_cfg EXPORTING config_key = ls_key object_name = lv_name. READ TABLE it_data INDEX 1 INTO ls_data. ASSERT sy-subrc = 0. lo_cfg->check_config_existent( EXPORTING i_outline_data = is_outline i_only_current_layer = abap_false i_is_original = abap_true IMPORTING e_is_existent = lv_exists ). CATCH cx_wd_configuration ##NO_HANDLER. " Ignore ENDTRY. TRY. lo_cfg->set_transport( trkorr = iv_transport devclass = iv_package ). lo_cfg->set_save_data( ls_data ). lo_cfg->set_config_description( is_outline ). IF lv_exists = abap_false. lv_operation = if_wdr_cfg_constants=>c_cts_operation-e_create. ELSE. lv_operation = if_wdr_cfg_constants=>c_cts_operation-e_save. ENDIF. " First call, check, second call, create/save DO 2 TIMES. lo_cfg->do_next_step( IMPORTING e_messages = lt_messages CHANGING c_operation = lv_operation ). check( lt_messages ). ENDDO. CATCH cx_wd_configuration INTO lx_err. zcx_abapgit_exception=>raise( 'WDCA, save error:' && lx_err->get_text( ) ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~changed_by. DATA ls_key TYPE wdy_config_key. ls_key = ms_item-obj_name. SELECT SINGLE changedby FROM wdy_config_appl INTO rv_user WHERE config_id = ls_key-config_id AND config_type = ls_key-config_type AND config_var = ls_key-config_var. IF sy-subrc <> 0. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. delete( iv_package = iv_package iv_transport = iv_transport ). ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: ls_outline TYPE wdy_cfg_outline_data, lt_data TYPE wdy_cfg_persist_data_appl_tab, lt_config_appt TYPE TABLE OF wdy_config_appt, lv_xml_string TYPE string, lv_xml_xstring TYPE xstring. io_xml->read( EXPORTING iv_name = 'OUTLINE' CHANGING cg_data = ls_outline ). io_xml->read( EXPORTING iv_name = 'DATA' CHANGING cg_data = lt_data ). save( is_outline = ls_outline it_data = lt_data iv_package = iv_package iv_transport = iv_transport ). TRY. lv_xml_string = zif_abapgit_object~mo_files->read_string( iv_extra = 'appl_config' iv_ext = 'xml' ). TRY. lv_xml_string = zcl_abapgit_xml_pretty=>print( iv_xml = lv_xml_string iv_ignore_errors = abap_false iv_unpretty = abap_true ). CATCH zcx_abapgit_exception. zcx_abapgit_exception=>raise( 'Error Un-Pretty Printing WDCA XML Content: ' && ms_item-obj_name ). ENDTRY. REPLACE FIRST OCCURRENCE OF REGEX '<\?xml version="1\.0" encoding="[\w-]+"\?>' IN lv_xml_string WITH '<?xml version="1.0"?>'. ASSERT sy-subrc = 0. lv_xml_xstring = zcl_abapgit_convert=>string_to_xstring( iv_str = lv_xml_string ). UPDATE wdy_config_appl SET xcontent = lv_xml_xstring WHERE config_id = ls_outline-config_id AND config_type = ls_outline-config_type AND config_var = ls_outline-config_var. CATCH zcx_abapgit_exception. " File not found ENDTRY. io_xml->read( EXPORTING iv_name = 'DESCR_LANG' CHANGING cg_data = lt_config_appt ). IF lt_config_appt IS NOT INITIAL. DELETE FROM wdy_config_appt WHERE config_id = ls_outline-config_id AND config_type = ls_outline-config_type AND config_var = ls_outline-config_var. MODIFY wdy_config_appt FROM TABLE lt_config_appt. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Error Updating WDY_CONFIG_APPT for Component Config ' && ms_item-obj_name ). ENDIF. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: ls_wdy_config_appl TYPE wdy_config_appl. DATA: ls_wdy_config_key TYPE wdy_config_key. ls_wdy_config_key = ms_item-obj_name. SELECT SINGLE * FROM wdy_config_appl INTO ls_wdy_config_appl WHERE config_id = ls_wdy_config_key-config_id AND config_type = ls_wdy_config_key-config_type AND config_var = ls_wdy_config_key-config_var. "#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. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. " Covered by ZCL_ABAPGIT_OBJECTS=>JUMP ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: ls_outline TYPE wdy_cfg_outline_data, lt_data TYPE wdy_cfg_persist_data_appl_tab, lt_cc_text TYPE TABLE OF wdy_config_appt, lv_xml_xstring TYPE xstring, lv_xml_string TYPE string. read( IMPORTING es_outline = ls_outline et_data = lt_data ). IF ls_outline IS INITIAL. RETURN. ENDIF. io_xml->add( iv_name = 'OUTLINE' ig_data = ls_outline ). io_xml->add( iv_name = 'DATA' ig_data = lt_data ). SELECT SINGLE xcontent INTO lv_xml_xstring FROM wdy_config_appl WHERE config_id = ls_outline-config_id AND config_type = ls_outline-config_type AND config_var = ls_outline-config_var. lv_xml_string = zcl_abapgit_convert=>xstring_to_string_utf8( iv_data = lv_xml_xstring ). IF lv_xml_string IS NOT INITIAL. TRY. lv_xml_string = zcl_abapgit_xml_pretty=>print( iv_xml = lv_xml_string iv_ignore_errors = abap_false ). CATCH zcx_abapgit_exception. zcx_abapgit_exception=>raise( 'Error Pretty Printing WDCA XML Content: ' && ms_item-obj_name ). ENDTRY. REPLACE FIRST OCCURRENCE OF REGEX '<\?xml version="1\.0" encoding="[\w-]+"\?>' IN lv_xml_string WITH '<?xml version="1.0" encoding="utf-8"?>'. ASSERT sy-subrc = 0. ENDIF. zif_abapgit_object~mo_files->add_string( iv_extra = 'appl_config' iv_ext = 'xml' iv_string = lv_xml_string ). SELECT * FROM wdy_config_appt INTO TABLE lt_cc_text WHERE config_id = ls_outline-config_id AND config_type = ls_outline-config_type AND config_var = ls_outline-config_var ORDER BY PRIMARY KEY. IF lt_cc_text IS NOT INITIAL. io_xml->add( iv_name = 'DESCR_LANG' ig_data = lt_cc_text ). ENDIF. ENDMETHOD. ENDCLASS.
28.244804
115
0.627228
bd87e4a999523a0cc2c9d262438d79a5c4b1fe52
7,931
abap
ABAP
src/objects/zcl_abapgit_object_shma.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
2
2021-01-08T21:38:32.000Z
2021-11-17T19:37:14.000Z
src/objects/zcl_abapgit_object_shma.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_shma.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_shma DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_abapgit_object_shma IMPLEMENTATION. METHOD zif_abapgit_object~changed_by. SELECT SINGLE chg_user FROM shma_attributes INTO rv_user WHERE area_name = ms_item-obj_name. IF sy-subrc <> 0. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. " We can't use FM SHMA_DELETE_AREA because it depends " on the corresponding class, but in abapGit it has its own " lifecycle. Therefore we have to reimplement most of the " FMs logic CONSTANTS: lc_request_delete TYPE i VALUE 4. DATA: lv_request TYPE i, lv_area_name TYPE shm_area_name, lv_order TYPE e070-trkorr, lv_korrnum TYPE tadir-korrnum, lv_objname TYPE tadir-obj_name, lv_task TYPE e070-trkorr, lv_append TYPE abap_bool, ls_tadir TYPE tadir, ls_tdevc TYPE tdevc, lo_cts_if TYPE REF TO object. lv_area_name = ms_item-obj_name. TRY. CALL FUNCTION 'ENQUEUE_E_SHM_AREA' EXPORTING mode_shma_attributes = 'E' area_name = lv_area_name x_area_name = ' ' _scope = '2' _wait = ' ' _collect = ' ' EXCEPTIONS foreign_lock = 1 system_failure = 2 OTHERS = 3. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. CALL METHOD ('\PROGRAM=SAPMSHM_MONITOR\CLASS=LCL_SHMM')=>('FREE_AREA_BY_NAME') EXPORTING area_name = lv_area_name affect_server = cl_shm_area=>affect_all_servers. CREATE OBJECT lo_cts_if TYPE ('\FUNCTION-POOL=SHMA\CLASS=LCL_CTS_INTERFACE') EXPORTING area = lv_area_name. CALL METHOD lo_cts_if->('CHECK_AREA') EXPORTING request = lc_request_delete IMPORTING access_mode = lv_request appendable = lv_append. IF lv_request <> lc_request_delete. zcx_abapgit_exception=>raise( |Error deleting SHMA { ms_item-obj_name }| ). ENDIF. CALL METHOD lo_cts_if->('INSERT_AREA') EXPORTING request = lc_request_delete IMPORTING order = lv_order task = lv_task. DELETE FROM shma_attributes WHERE area_name = lv_area_name. DELETE FROM shma_start WHERE area_name = lv_area_name. lv_korrnum = lv_order. lv_objname = lv_area_name. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_read_only = abap_true wi_tadir_pgmid = 'R3TR' wi_tadir_object = 'SHMA' wi_tadir_obj_name = lv_objname IMPORTING new_tadir_entry = ls_tadir EXCEPTIONS OTHERS = 0. CALL FUNCTION 'TR_DEVCLASS_GET' EXPORTING iv_devclass = ls_tadir-devclass IMPORTING es_tdevc = ls_tdevc EXCEPTIONS OTHERS = 1. IF sy-subrc = 0 AND ls_tdevc-korrflag IS INITIAL. " TADIR entries for local objects must be deleted 'by hand' CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = abap_false wi_delete_tadir_entry = abap_true wi_tadir_pgmid = 'R3TR' wi_tadir_object = 'SHMA' wi_tadir_obj_name = lv_objname wi_tadir_korrnum = lv_korrnum EXCEPTIONS OTHERS = 0. ENDIF. CALL METHOD ('\PROGRAM=SAPLSHMA\CLASS=LCL_SHMA_HELPER')=>('DELETE_RUNTIME_SETTINGS') EXPORTING area_name = lv_area_name. CALL FUNCTION 'DEQUEUE_E_SHM_AREA' EXPORTING mode_shma_attributes = 'E' area_name = lv_area_name x_area_name = ' ' _scope = '3' _synchron = ' ' _collect = ' '. CATCH cx_root. zcx_abapgit_exception=>raise( |Error deleting SHMA { ms_item-obj_name }| ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lv_area_name TYPE shm_area_name, ls_area_attributes TYPE shma_attributes. lv_area_name = ms_item-obj_name. io_xml->read( EXPORTING iv_name = 'AREA_ATTRIBUTES' CHANGING cg_data = ls_area_attributes ). tadir_insert( iv_package ). TRY. CALL METHOD ('\PROGRAM=SAPLSHMA\CLASS=LCL_SHMA_HELPER')=>('INSERT_AREA') EXPORTING area_name = lv_area_name attributes = ls_area_attributes force_overwrite = abap_true no_class_generation = abap_false silent_mode = abap_true. CATCH cx_root. zcx_abapgit_exception=>raise( |Error serializing SHMA { ms_item-obj_name }| ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_area_name TYPE shm_area_name. SELECT SINGLE area_name FROM shma_attributes INTO lv_area_name WHERE area_name = ms_item-obj_name. rv_bool = xsdbool( sy-subrc = 0 ). ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. METHOD zif_abapgit_object~is_active. rv_active = is_active( ). ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = abap_false. ENDMETHOD. METHOD zif_abapgit_object~jump. DATA: ls_bcdata TYPE bdcdata, lt_bcdata TYPE STANDARD TABLE OF bdcdata. ls_bcdata-program = 'SAPLSHMA'. ls_bcdata-dynpro = '0100'. ls_bcdata-dynbegin = 'X'. APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'SHMA_ATTRIBUTES-AREA_NAME'. ls_bcdata-fval = ms_item-obj_name. APPEND ls_bcdata TO lt_bcdata. CLEAR ls_bcdata. ls_bcdata-fnam = 'BDC_OKCODE'. ls_bcdata-fval = '=SHOW'. APPEND ls_bcdata TO lt_bcdata. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SHMA' mode_val = 'E' TABLES using_tab = lt_bcdata EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, SHMA' ). ENDIF. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lv_area_name TYPE shm_area_name, ls_area_attributes TYPE shma_attributes. lv_area_name = ms_item-obj_name. TRY. CALL METHOD ('\PROGRAM=SAPLSHMA\CLASS=LCL_SHMA_HELPER')=>('READ_AREA_ATTRIBUTES_ALL') EXPORTING area_name = lv_area_name IMPORTING area_attributes = ls_area_attributes. CLEAR: ls_area_attributes-chg_user, ls_area_attributes-chg_date, ls_area_attributes-chg_time, ls_area_attributes-cls_gen_user, ls_area_attributes-cls_gen_date, ls_area_attributes-cls_gen_time. io_xml->add( iv_name = 'AREA_ATTRIBUTES' ig_data = ls_area_attributes ). CATCH cx_root. zcx_abapgit_exception=>raise( |Error serializing SHMA { ms_item-obj_name }| ). ENDTRY. ENDMETHOD. ENDCLASS.
26.793919
96
0.599168
bd8826a43fda32e50e595467380a6410201ef1a6
531
abap
ABAP
lbn-gtt-template-tpo/abap/zsrc/zcl_im_pof_gtt_le_shipment.clas.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-tpo/abap/zsrc/zcl_im_pof_gtt_le_shipment.clas.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
lbn-gtt-template-tpo/abap/zsrc/zcl_im_pof_gtt_le_shipment.clas.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
null
null
null
CLASS zcl_im_pof_gtt_le_shipment DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_ex_badi_le_shipment . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_IM_POF_GTT_LE_SHIPMENT IMPLEMENTATION. method IF_EX_BADI_LE_SHIPMENT~AT_SAVE. endmethod. METHOD if_ex_badi_le_shipment~before_update. CALL FUNCTION 'ZPOF_GTT_CTP_SH_TO_DL' EXPORTING is_shipment = im_shipments_before_update. ENDMETHOD. method IF_EX_BADI_LE_SHIPMENT~IN_UPDATE. endmethod. ENDCLASS.
16.59375
49
0.789077
bd8e10de89c71a43e7fe6a5949a9e90592edeb45
4,943
abap
ABAP
src/zodin_multifile.prog.abap
AndreaBorgia-Abo/ODIN
c4047da6b5b8523aa96108cb849316d415725cfc
[ "MIT" ]
11
2021-04-19T07:29:47.000Z
2022-01-06T22:34:26.000Z
src/zodin_multifile.prog.abap
AndreaBorgia-Abo/ODIN
c4047da6b5b8523aa96108cb849316d415725cfc
[ "MIT" ]
4
2021-04-26T07:45:09.000Z
2021-07-26T17:40:22.000Z
src/zodin_multifile.prog.abap
AndreaBorgia-Abo/ODIN
c4047da6b5b8523aa96108cb849316d415725cfc
[ "MIT" ]
5
2021-04-26T11:32:58.000Z
2022-02-09T16:59:19.000Z
*&---------------------------------------------------------------------* *& Report Z_ODIN_MULTIFILE *&---------------------------------------------------------------------* *MIT License * *Copyright (c) 2021 71TECH * *Permission is hereby granted, free of charge, to any person obtaining a copy *of this software and associated documentation files (the "Software"), to deal *in the Software without restriction, including without limitation the rights *to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *copies of the Software, and to permit persons to whom the Software is *furnished to do so, subject to the following conditions: * *The above copyright notice and this permission notice shall be included in all *copies or substantial portions of the Software. * *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE. *&---------------------------------------------------------------------* REPORT zodin_multifile LINE-SIZE 1023. SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-bl1. PARAMETERS: p_srdir TYPE eps2filnam DEFAULT '/location/of/input/files/on/server' LOWER CASE, p_bkdir TYPE string LOWER CASE, p_sfname TYPE string LOWER CASE DEFAULT '*' OBLIGATORY. SELECTION-SCREEN COMMENT /1(70) TEXT-c02. SELECTION-SCREEN COMMENT /1(70) TEXT-c03. SELECTION-SCREEN END OF BLOCK b1. SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE TEXT-bl0. PARAMETERS: p_skprow TYPE i DEFAULT 0. SELECTION-SCREEN COMMENT 50(70) TEXT-c01 FOR FIELD p_skprow. SELECTION-SCREEN END OF BLOCK b0. SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-bl2. PARAMETERS: p_sep(1) DEFAULT ';', p_delim(1) DEFAULT '"', p_1000(1) DEFAULT '.', p_dec(1) DEFAULT ','. SELECTION-SCREEN END OF BLOCK b2. START-OF-SELECTION. WRITE: / 'PROTOCOL'. DATA error TYPE string. DATA files TYPE TABLE OF eps2fili. CALL FUNCTION 'EPS2_GET_DIRECTORY_LISTING' EXPORTING iv_dir_name = p_srdir TABLES dir_list = files EXCEPTIONS invalid_eps_subdir = 1 sapgparam_failed = 2 build_directory_failed = 3 no_authorization = 4 read_directory_failed = 5 too_many_read_errors = 6 empty_directory_list = 7 OTHERS = 8. IF sy-subrc <> 0. CASE sy-subrc. WHEN 1. error = 'invalid_eps_subdir'. WHEN 2. error = 'sapgparam_failed'. WHEN 3. error = 'build_directory_failed'. WHEN 4. error = 'no_authorization'. WHEN 5. error = 'read_directory_failed'. WHEN 6. error = 'too_many_read_errors'. WHEN 7. error = 'empty_directory_list'. WHEN 8. error = 'other_error'. ENDCASE. IF sy-batch IS NOT INITIAL. MESSAGE s006(zodin) WITH error. ELSE. MESSAGE s006(zodin) WITH error DISPLAY LIKE 'E'. LEAVE LIST-PROCESSING. ENDIF. ENDIF. DATA srpath TYPE string. DATA bkpath TYPE string. DATA info TYPE string. LOOP AT files INTO DATA(files_s). DATA(tabix) = sy-tabix. IF files_s-name NP p_sfname. info = |Ignoring { files_s-name } because it doesn't cover pattern { p_sfname }|. IF sy-batch = abap_true. MESSAGE info TYPE 'S'. ELSE. WRITE: / info. ENDIF. CONTINUE. ENDIF. srpath = p_srdir && '/' && files_s-name. bkpath = p_bkdir && '/' && files_s-name. info = |Processing { srpath }...|. MESSAGE info TYPE 'S'. IF sy-batch = abap_false. FORMAT INTENSIFIED ON. WRITE / info. FORMAT INTENSIFIED OFF. ENDIF. TRY. DATA(cl_fin_doc) = NEW zcl_odin_posting( csv_separator = p_sep csv_delimiter = p_delim csv_decimal_separator = p_dec csv_thousands_separator = p_1000 path_server = srpath path_server_backup = bkpath simulation = abap_false skip_rows = p_skprow ). CATCH zcx_odin INTO DATA(cx_odin). info = cx_odin->get_text( ). IF sy-batch = abap_true. MESSAGE info TYPE 'S'. ELSE. WRITE: / info. ENDIF. CONTINUE. ENDTRY. TRY. cl_fin_doc->post( ). CATCH zcx_odin INTO cx_odin. info = cx_odin->get_text( ). IF sy-batch = abap_true. MESSAGE info TYPE 'S'. ELSE. WRITE / info. ENDIF. ENDTRY. cl_fin_doc->display( report = 'ZODIN' pfstatus = 'ALV2' ). ENDLOOP.
34.089655
93
0.620676
bd94a4d8ea66171a2df62ec9539c1603acfdd05f
696
abap
ABAP
src/http/zcx_abapgit_2fa_unsupported.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2020-04-10T22:21:41.000Z
2020-04-10T22:21:41.000Z
src/http/zcx_abapgit_2fa_unsupported.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
null
null
null
src/http/zcx_abapgit_2fa_unsupported.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
null
null
null
class ZCX_ABAPGIT_2FA_UNSUPPORTED definition public inheriting from ZCX_ABAPGIT_2FA_ERROR final create public . public section. methods CONSTRUCTOR importing !TEXTID like TEXTID optional !PREVIOUS like PREVIOUS optional !MV_TEXT type STRING optional . protected section. methods GET_DEFAULT_TEXT redefinition . private section. ENDCLASS. CLASS ZCX_ABAPGIT_2FA_UNSUPPORTED IMPLEMENTATION. method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING TEXTID = TEXTID PREVIOUS = PREVIOUS MV_TEXT = MV_TEXT . endmethod. METHOD get_default_text. rv_text = 'The service is not supported for two factor authentication.' . ENDMETHOD. ENDCLASS.
17.4
77
0.768678
bd977dffc8ccd4eed6a8b9fe334a14c190267b9d
5,554
abap
ABAP
src/checks/y_check_collect.clas.abap
steve192/code-pal-for-abap
5f701f5239036cbb724756a86e805fdbae377ab7
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_collect.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/checks/y_check_collect.clas.abap
steve192/code-pal-for-abap
5f701f5239036cbb724756a86e805fdbae377ab7
[ "Apache-2.0" ]
null
null
null
CLASS y_check_collect DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUBLIC . PUBLIC SECTION. METHODS constructor. PROTECTED SECTION. METHODS inspect_tokens REDEFINITION. PRIVATE SECTION. METHODS extract_itab_name IMPORTING statement TYPE sstmnt RETURNING VALUE(result) TYPE string. METHODS find_itab_declaration IMPORTING structure TYPE sstruc name TYPE string RETURNING VALUE(result) TYPE sstmnt. METHODS extract_itab_type IMPORTING statement TYPE sstmnt RETURNING VALUE(result) TYPE string. METHODS get_table_rtti IMPORTING table_name TYPE string RETURNING VALUE(result) TYPE REF TO cl_abap_tabledescr. ENDCLASS. CLASS Y_CHECK_COLLECT IMPLEMENTATION. METHOD constructor. super->constructor( ). settings-pseudo_comment = '"#EC COLLECT' ##NO_TEXT. settings-disable_threshold_selection = abap_true. settings-threshold = 0. settings-documentation = |{ c_docs_path-checks }collect.md|. set_check_message( 'Only use the statement COLLECT for hashed tables or sorted tables with a unique key!' ). ENDMETHOD. METHOD inspect_tokens. CHECK get_token_abs( statement-from ) = 'COLLECT'. DATA(itab_name) = extract_itab_name( statement ). DATA(itab_declaration) = find_itab_declaration( structure = structure name = itab_name ). " local declaration out of scope IF itab_declaration IS INITIAL. RETURN. ENDIF. DATA(declaration_tokens) = condense_tokens( itab_declaration ). IF declaration_tokens CS 'SORTED TABLE OF' AND declaration_tokens CS 'WITH UNIQUE KEY'. RETURN. ENDIF. IF declaration_tokens CS 'HASHED TABLE OF' AND declaration_tokens CS 'WITH UNIQUE KEY'. RETURN. ENDIF. " global table type (DDIC) IF declaration_tokens NP '*TYPE *TABLE OF*' AND declaration_tokens NP '*LIKE *TABLE OF*'. DATA(itab_type) = extract_itab_type( itab_declaration ). DATA(type_rtti) = get_table_rtti( itab_type ). IF type_rtti IS NOT INITIAL. IF type_rtti->table_kind = cl_abap_tabledescr=>tablekind_sorted AND type_rtti->has_unique_key = abap_true. RETURN. ENDIF. IF type_rtti->table_kind = cl_abap_tabledescr=>tablekind_hashed AND type_rtti->has_unique_key = abap_true. RETURN. ENDIF. ENDIF. ENDIF. DATA(check_configuration) = detect_check_configuration( statement ). raise_error( statement_level = statement-level statement_index = index statement_from = statement-from check_configuration = check_configuration ). ENDMETHOD. METHOD extract_itab_name. LOOP AT ref_scan->tokens ASSIGNING FIELD-SYMBOL(<token>) FROM statement-from TO statement-to. IF <token>-str = 'INTO'. result = get_token_abs( sy-tabix + 1 ). RETURN. ENDIF. ENDLOOP. " Header Line IF statement-to - statement-from = 1. result = get_token_abs( statement-to ). ENDIF. ENDMETHOD. METHOD find_itab_declaration. LOOP AT ref_scan->statements ASSIGNING FIELD-SYMBOL(<statement>) FROM structure-stmnt_from TO structure-stmnt_to. DATA(first_token) = get_token_abs( <statement>-from ). IF first_token <> 'DATA' AND first_token <> 'TYPES' AND first_token <> 'CLASS-DATA'. CONTINUE. ENDIF. DATA(tokens) = condense_tokens( <statement> ). IF tokens NP |DATA { name } TYPE *| AND tokens NP |DATA { name } LIKE *| AND tokens NP |TYPES* { name }* TYPE *| AND tokens NP |TYPES* { name }* LIKE *| AND tokens NP |CLASS-DATA* { name }* TYPE *| AND tokens NP |CLASS-DATA* { name }* LIKE *|. CONTINUE. ENDIF. IF tokens CP '* TABLE OF *'. result = <statement>. RETURN. ENDIF. DATA(local_typed) = find_itab_declaration( structure = structure name = extract_itab_type( <statement> ) ). result = COND #( WHEN local_typed IS NOT INITIAL THEN local_typed ELSE <statement> ). RETURN. ENDLOOP. IF structure-back > 0. result = find_itab_declaration( structure = ref_scan->structures[ structure-back ] name = name ). ENDIF. ENDMETHOD. METHOD extract_itab_type. LOOP AT ref_scan->tokens ASSIGNING FIELD-SYMBOL(<token>) FROM statement-from TO statement-to WHERE str = 'OF'. IF get_token_abs( sy-tabix - 1 ) = 'TABLE'. result = get_token_abs( sy-tabix + 1 ). RETURN. ENDIF. ENDLOOP. LOOP AT ref_scan->tokens ASSIGNING <token> FROM statement-from TO statement-to WHERE str = 'TYPE' OR str = 'LIKE'. result = get_token_abs( sy-tabix + 1 ). RETURN. ENDLOOP. ENDMETHOD. METHOD get_table_rtti. cl_abap_elemdescr=>describe_by_name( EXPORTING p_name = table_name RECEIVING p_descr_ref = DATA(rtti_type) EXCEPTIONS type_not_found = 1 OTHERS = 2 ). IF sy-subrc IS NOT INITIAL. RETURN. ENDIF. TRY. result ?= rtti_type. CATCH cx_sy_move_cast_error. " Not a TableDescr type RETURN. ENDTRY. ENDMETHOD. ENDCLASS.
28.482051
112
0.621354
bd9b01f900c08ef6d2447b9cf555715d2b775238
134
abap
ABAP
src/legacy/#dmo#flight_travel_api12.fugr.#dmo#lflight_travel_api12top.abap
SAP-Cloud-Platform/flight12
f0d19f392ae2ec16cf86d07a41d28c37e7d5ef4c
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api12.fugr.#dmo#lflight_travel_api12top.abap
SAP-Cloud-Platform/flight12
f0d19f392ae2ec16cf86d07a41d28c37e7d5ef4c
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api12.fugr.#dmo#lflight_travel_api12top.abap
SAP-Cloud-Platform/flight12
f0d19f392ae2ec16cf86d07a41d28c37e7d5ef4c
[ "BSD-Source-Code" ]
null
null
null
FUNCTION-POOL /DMO/FLIGHT_TRAVEL_API12. "MESSAGE-ID .. * INCLUDE /DMO/LFLIGHT_TRAVEL_API12D... " Local class definition
33.5
71
0.701493
bda33091aa9c7e3ef9ba1dd82d5820880bc909bb
414
abap
ABAP
src/zbunkai_christian.prog.abap
kamalkorlapati/abapGit_bunkai_Weinheim
b99e94d510018612a4322c926bf73e9168cd352a
[ "MIT" ]
null
null
null
src/zbunkai_christian.prog.abap
kamalkorlapati/abapGit_bunkai_Weinheim
b99e94d510018612a4322c926bf73e9168cd352a
[ "MIT" ]
null
null
null
src/zbunkai_christian.prog.abap
kamalkorlapati/abapGit_bunkai_Weinheim
b99e94d510018612a4322c926bf73e9168cd352a
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Report zbunkai_christian *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT zbunkai_christian. cl_demo_output=>display_html( NEW zmarkdown( )->text( |Hello **abapGit bunkai**!\n\n| && |Hello Weinheim!| ) ).
34.5
72
0.292271
bda4d871bc9b67659cc9274ed8a7c504fb8665c8
9,818
abap
ABAP
src/cts/zcl_abapgit_cts_api.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
2
2016-08-29T02:16:27.000Z
2016-12-01T15:27:01.000Z
src/cts/zcl_abapgit_cts_api.clas.abap
Manny27nyc/abapGit
dc51247e9b8c0c792193aba857ec31df3a82db4a
[ "MIT" ]
45
2021-05-24T08:37:30.000Z
2022-03-25T15:28:27.000Z
src/cts/zcl_abapgit_cts_api.clas.abap
wangdongcheng/abapGit
7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab
[ "MIT" ]
2
2016-05-18T11:24:39.000Z
2018-04-04T05:08:09.000Z
"! Change transport system API CLASS zcl_abapgit_cts_api DEFINITION PUBLIC FINAL CREATE PRIVATE GLOBAL FRIENDS zcl_abapgit_factory. PUBLIC SECTION. INTERFACES: zif_abapgit_cts_api. PROTECTED SECTION. PRIVATE SECTION. "! Returns the transport request / task the object is currently locked in "! @parameter iv_program_id | Program ID "! @parameter iv_object_type | Object type "! @parameter iv_object_name | Object name "! @parameter rv_transport | Transport request / task "! @raising zcx_abapgit_exception | Object is not locked in a transport METHODS get_current_transport_for_obj IMPORTING !iv_program_id TYPE pgmid DEFAULT 'R3TR' !iv_object_type TYPE trobjtype !iv_object_name TYPE sobj_name RETURNING VALUE(rv_transport) TYPE trkorr RAISING zcx_abapgit_exception . "! Returns the transport request / task that includes the object (even if not locked) "! @parameter iv_program_id | Program ID "! @parameter iv_object_type | Object type "! @parameter iv_object_name | Object name "! @parameter rv_transport | Transport request / task "! @raising zcx_abapgit_exception | Object is not locked in a transport METHODS get_current_transport_from_db IMPORTING !iv_program_id TYPE pgmid DEFAULT 'R3TR' !iv_object_type TYPE trobjtype !iv_object_name TYPE sobj_name RETURNING VALUE(rv_transport) TYPE trkorr RAISING zcx_abapgit_exception . "! Check if the object is currently locked in a transport "! @parameter iv_program_id | Program ID "! @parameter iv_object_type | Object type "! @parameter iv_object_name | Object name "! @parameter rv_locked | Object is locked "! @raising zcx_abapgit_exception | Object type is not lockable METHODS is_object_locked_in_transport IMPORTING !iv_program_id TYPE pgmid DEFAULT 'R3TR' !iv_object_type TYPE trobjtype !iv_object_name TYPE sobj_name RETURNING VALUE(rv_locked) TYPE abap_bool RAISING zcx_abapgit_exception . "! Check if the object type is lockable "! @parameter iv_program_id | Program ID "! @parameter iv_object_type | Object type "! @parameter rv_lockable | Lockable METHODS is_object_type_lockable IMPORTING !iv_program_id TYPE pgmid DEFAULT 'R3TR' !iv_object_type TYPE trobjtype RETURNING VALUE(rv_lockable) TYPE abap_bool . "! Check if the object type can be transported "! @parameter iv_program_id | Program ID "! @parameter iv_object_type | Object type "! @parameter rv_transportable | Transportable METHODS is_object_type_transportable IMPORTING !iv_program_id TYPE pgmid DEFAULT 'R3TR' !iv_object_type TYPE trobjtype RETURNING VALUE(rv_transportable) TYPE abap_bool . ENDCLASS. CLASS ZCL_ABAPGIT_CTS_API IMPLEMENTATION. METHOD get_current_transport_for_obj. DATA: lv_object_lockable TYPE abap_bool, lv_locked TYPE abap_bool, lv_transport_request TYPE trkorr, lv_task TYPE trkorr, lv_tr_object_name TYPE trobj_name. lv_tr_object_name = iv_object_name. CALL FUNCTION 'TR_CHECK_OBJECT_LOCK' EXPORTING wi_pgmid = iv_program_id wi_object = iv_object_type wi_objname = lv_tr_object_name IMPORTING we_lockable_object = lv_object_lockable we_locked = lv_locked we_lock_order = lv_transport_request we_lock_task = lv_task EXCEPTIONS empty_key = 1 no_systemname = 2 no_systemtype = 3 unallowed_lock_order = 4 OTHERS = 5. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. IF lv_locked = abap_false. zcx_abapgit_exception=>raise( |Object { iv_program_id }-{ iv_object_type }-{ iv_object_name } is not locked| ). ENDIF. IF lv_object_lockable = abap_false. zcx_abapgit_exception=>raise( |Object type { iv_program_id }-{ iv_object_type } not lockable| ). ENDIF. rv_transport = lv_transport_request. ENDMETHOD. METHOD get_current_transport_from_db. " This method is used for objects that are included in transports but not locked " for example, namespaces (NSPC) SELECT SINGLE a~trkorr FROM e070 AS a JOIN e071 AS b ON a~trkorr = b~trkorr INTO rv_transport WHERE ( a~trstatus = 'D' OR a~trstatus = 'L' ) AND b~pgmid = iv_program_id AND b~object = iv_object_type AND b~obj_name = iv_object_name. ENDMETHOD. METHOD is_object_locked_in_transport. DATA: ls_object_key TYPE e071, lv_type_check_result TYPE c LENGTH 1, ls_lock_key TYPE tlock_int, lv_lock_flag TYPE c LENGTH 1. ls_object_key-pgmid = iv_program_id. ls_object_key-object = iv_object_type. ls_object_key-obj_name = iv_object_name. CALL FUNCTION 'TR_CHECK_TYPE' EXPORTING wi_e071 = ls_object_key IMPORTING pe_result = lv_type_check_result we_lock_key = ls_lock_key. IF lv_type_check_result <> 'L'. zcx_abapgit_exception=>raise( |Object type { iv_program_id }-{ iv_object_type } not lockable| ). ENDIF. CALL FUNCTION 'TRINT_CHECK_LOCKS' EXPORTING wi_lock_key = ls_lock_key IMPORTING we_lockflag = lv_lock_flag EXCEPTIONS empty_key = 1 OTHERS = 2. IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. rv_locked = boolc( lv_lock_flag <> space ). ENDMETHOD. METHOD is_object_type_lockable. DATA: ls_object_key TYPE e071, lv_type_check_result TYPE c LENGTH 1. ls_object_key-pgmid = iv_program_id. ls_object_key-object = iv_object_type. ls_object_key-obj_name = '_'. " Dummy value #2071 CALL FUNCTION 'TR_CHECK_TYPE' EXPORTING wi_e071 = ls_object_key IMPORTING pe_result = lv_type_check_result. rv_lockable = boolc( lv_type_check_result = 'L' ). ENDMETHOD. METHOD is_object_type_transportable. DATA: ls_object_key TYPE e071, lv_type_check_result TYPE c LENGTH 1. ls_object_key-pgmid = iv_program_id. ls_object_key-object = iv_object_type. ls_object_key-obj_name = '_'. " Dummy value #2071 CALL FUNCTION 'TR_CHECK_TYPE' EXPORTING wi_e071 = ls_object_key IMPORTING pe_result = lv_type_check_result. rv_transportable = boolc( lv_type_check_result CA 'RTL' ). ENDMETHOD. METHOD zif_abapgit_cts_api~get_transports_for_list. DATA lv_request TYPE trkorr. DATA lt_tlock TYPE SORTED TABLE OF tlock WITH NON-UNIQUE KEY object hikey. DATA ls_object_key TYPE e071. DATA lv_type_check_result TYPE c LENGTH 1. DATA ls_lock_key TYPE tlock_int. DATA ls_transport LIKE LINE OF rt_transports. FIELD-SYMBOLS <ls_item> LIKE LINE OF it_items. FIELD-SYMBOLS <ls_tlock> LIKE LINE OF lt_tlock. * Workarounds to improve performance, note that IT_ITEMS might * contain 1000s of rows, see standard logic in function module * TR_CHECK_OBJECT_LOCK * avoid database lookups in TLOCK for each item, SELECT * FROM tlock INTO TABLE lt_tlock. IF sy-subrc <> 0. RETURN. ENDIF. LOOP AT it_items ASSIGNING <ls_item>. CLEAR lv_request. ls_object_key-pgmid = 'R3TR'. ls_object_key-object = <ls_item>-obj_type. ls_object_key-obj_name = <ls_item>-obj_name. CALL FUNCTION 'TR_CHECK_TYPE' EXPORTING wi_e071 = ls_object_key IMPORTING we_lock_key = ls_lock_key pe_result = lv_type_check_result. IF lv_type_check_result = 'L'. LOOP AT lt_tlock ASSIGNING <ls_tlock> WHERE object = ls_lock_key-obj AND hikey >= ls_lock_key-low AND lokey <= ls_lock_key-hi. "#EC PORTABLE lv_request = <ls_tlock>-trkorr. EXIT. ENDLOOP. ELSEIF is_object_type_transportable( <ls_item>-obj_type ) = abap_true. lv_request = get_current_transport_from_db( iv_object_type = <ls_item>-obj_type iv_object_name = <ls_item>-obj_name ). ENDIF. IF lv_request IS NOT INITIAL. ls_transport-obj_type = <ls_item>-obj_type. ls_transport-obj_name = <ls_item>-obj_name. ls_transport-trkorr = lv_request. INSERT ls_transport INTO TABLE rt_transports. ENDIF. ENDLOOP. ENDMETHOD. METHOD zif_abapgit_cts_api~get_transport_for_object. IF is_item-obj_type IS NOT INITIAL AND is_item-obj_name IS NOT INITIAL. IF is_object_type_lockable( is_item-obj_type ) = abap_true AND is_object_locked_in_transport( iv_object_type = is_item-obj_type iv_object_name = is_item-obj_name ) = abap_true. rv_transport = get_current_transport_for_obj( iv_object_type = is_item-obj_type iv_object_name = is_item-obj_name ). ELSEIF is_object_type_transportable( is_item-obj_type ) = abap_true. rv_transport = get_current_transport_from_db( iv_object_type = is_item-obj_type iv_object_name = is_item-obj_name ). ENDIF. ENDIF. ENDMETHOD. METHOD zif_abapgit_cts_api~is_chrec_possible_for_package. IF iv_package IS NOT INITIAL. rv_possible = zcl_abapgit_factory=>get_sap_package( iv_package )->are_changes_recorded_in_tr_req( ). ENDIF. ENDMETHOD. ENDCLASS.
31.980456
117
0.668772
bda4eca3761aba9efc1af429e27c01c22ce18dee
2,161
abap
ABAP
lbn-gtt-standard-app/abap/zsrc/zgtt_sts/zgtt_sts.fugr.zgtt_sts_ee_fo_popu_rel.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
3
2021-07-08T07:16:53.000Z
2021-10-18T07:56:18.000Z
lbn-gtt-standard-app/abap/zsrc/zgtt_sts/zgtt_sts.fugr.zgtt_sts_ee_fo_popu_rel.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
null
null
null
lbn-gtt-standard-app/abap/zsrc/zgtt_sts/zgtt_sts.fugr.zgtt_sts_ee_fo_popu_rel.abap
rakshitha-1234/logistics-business-network-gtt-standardapps-samples
3d1e3249046c0112ff33f524d30cde2ac9f38b4c
[ "Apache-2.0" ]
7
2021-06-03T09:47:37.000Z
2022-03-25T12:20:07.000Z
FUNCTION zgtt_sts_ee_fo_popu_rel. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM *" REFERENCE(I_EVENT_TYPES) TYPE /SAPTRX/EVTYPES *" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER *" REFERENCE(I_EVENTTYPE_TAB) TYPE TRXAS_EVENTTYPE_TABS_WA *" REFERENCE(I_EVENT) TYPE TRXAS_EVT_CTAB_WA *" EXPORTING *" VALUE(E_RESULT) LIKE SY-BINPT *" TABLES *" C_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL *" EXCEPTIONS *" PARAMETER_ERROR *" RELEVANCE_DETERM_ERROR *" STOP_PROCESSING *"---------------------------------------------------------------------- TRY. zcl_gtt_sts_actual_event=>get_tor_actual_event_class( i_event )->check_event_relevance( EXPORTING it_all_appl_tables = i_all_appl_tables iv_event_code = /scmtms/if_tor_const=>sc_tor_event-popu is_event = i_event IMPORTING ev_result = e_result ). CATCH cx_udm_message INTO DATA(lo_udm_message). zcl_gtt_sts_tools=>get_errors_log( EXPORTING io_umd_message = lo_udm_message iv_appsys = i_appsys IMPORTING es_bapiret = DATA(ls_bapiret) ). APPEND ls_bapiret TO c_logtable. RAISE stop_processing. ENDTRY. IF e_result = zif_gtt_sts_ef_constants=>cs_condition-false. RETURN. ENDIF. CALL FUNCTION '/SCMTMS/REL_EVT_TOR_POPU' EXPORTING i_appsys = i_appsys i_event_types = i_event_types i_all_appl_tables = i_all_appl_tables i_eventtype_tab = i_eventtype_tab i_event = i_event IMPORTING e_result = e_result TABLES c_logtable = c_logtable EXCEPTIONS parameter_error = 1 relevance_determ_error = 2 stop_processing = 3 OTHERS = 4. CASE sy-subrc. WHEN 1. RAISE parameter_error. WHEN 2. RAISE relevance_determ_error. WHEN 3. RAISE stop_processing. ENDCASE. ENDFUNCTION.
31.318841
93
0.595558
bda90e88ebce161d3997221786299a56a5c64b97
1,179
abap
ABAP
src/zcl_abak_data_normal.clas.abap
abapinho/abaKTravis
ab368aaccc9bb0b018e6cd6208cd4abc934861a0
[ "MIT" ]
null
null
null
src/zcl_abak_data_normal.clas.abap
abapinho/abaKTravis
ab368aaccc9bb0b018e6cd6208cd4abc934861a0
[ "MIT" ]
null
null
null
src/zcl_abak_data_normal.clas.abap
abapinho/abaKTravis
ab368aaccc9bb0b018e6cd6208cd4abc934861a0
[ "MIT" ]
null
null
null
CLASS zcl_abak_data_normal DEFINITION PUBLIC INHERITING FROM zcl_abak_data FINAL CREATE PUBLIC GLOBAL FRIENDS zcl_abak_factory . PUBLIC SECTION. METHODS constructor IMPORTING !io_format TYPE REF TO zif_abak_format !io_content TYPE REF TO zif_abak_content RAISING zcx_abak . PROTECTED SECTION. METHODS load_data_aux REDEFINITION . METHODS invalidate_aux REDEFINITION . PRIVATE SECTION. DATA go_format TYPE REF TO zif_abak_format . DATA go_content TYPE REF TO zif_abak_content . ENDCLASS. CLASS ZCL_ABAK_DATA_NORMAL IMPLEMENTATION. METHOD constructor. super->constructor( ). IF io_format IS NOT BOUND OR io_content IS NOT BOUND. RAISE EXCEPTION TYPE zcx_abak EXPORTING textid = zcx_abak=>invalid_parameters. ENDIF. go_format = io_format. go_content = io_content. ENDMETHOD. METHOD invalidate_aux. go_content->invalidate( ). ENDMETHOD. METHOD load_data_aux. go_format->convert( EXPORTING i_data = go_content->get( ) IMPORTING et_k = et_k e_name = e_name ). ENDMETHOD. ENDCLASS.
18.421875
57
0.685327
bdac80b0b8e5e894309276ed8a516a3931d0777e
246
abap
ABAP
src/cl_abap_math.clas.abap
sbcgua/open-abap
98d939658ec0db2a1ff2bd6979d7c9b52dc9dc5e
[ "MIT" ]
20
2020-10-02T09:37:08.000Z
2022-03-26T15:29:11.000Z
src/cl_abap_math.clas.abap
sbcgua/open-abap
98d939658ec0db2a1ff2bd6979d7c9b52dc9dc5e
[ "MIT" ]
28
2020-12-02T15:19:10.000Z
2022-03-24T06:12:47.000Z
src/cl_abap_math.clas.abap
sbcgua/open-abap
98d939658ec0db2a1ff2bd6979d7c9b52dc9dc5e
[ "MIT" ]
2
2020-11-17T13:21:38.000Z
2021-11-07T14:35:54.000Z
CLASS cl_abap_math DEFINITION PUBLIC. PUBLIC SECTION. CONSTANTS: min_int4 TYPE i VALUE -2147483648, max_int4 TYPE i VALUE 2147483647, round_half_down TYPE i VALUE 4. ENDCLASS. CLASS cl_abap_math IMPLEMENTATION. ENDCLASS.
22.363636
40
0.747967
bdb975ce438d4a791b0e48c881e203978de7a43a
11,316
abap
ABAP
src/ui/zcl_abapgit_services_abapgit.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2020-11-12T17:34:15.000Z
2020-11-12T17:34:15.000Z
src/ui/zcl_abapgit_services_abapgit.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2017-10-27T09:32:58.000Z
2017-10-27T09:32:58.000Z
src/ui/zcl_abapgit_services_abapgit.clas.abap
habrahams/abapGit
1f3abfd8eccf6cc90351320cac80b84d8a94702c
[ "MIT" ]
1
2021-07-09T02:07:11.000Z
2021-07-09T02:07:11.000Z
CLASS zcl_abapgit_services_abapgit DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. CONSTANTS: c_abapgit_repo TYPE string VALUE 'https://github.com/abapGit/abapGit' ##NO_TEXT, c_abapgit_homepage TYPE string VALUE 'https://www.abapgit.org' ##NO_TEXT, c_abapgit_wikipage TYPE string VALUE 'https://docs.abapgit.org' ##NO_TEXT, c_dotabap_homepage TYPE string VALUE 'https://dotabap.org' ##NO_TEXT, c_abapgit_package TYPE devclass VALUE '$ABAPGIT' ##NO_TEXT, c_abapgit_url TYPE string VALUE 'https://github.com/abapGit/abapGit.git' ##NO_TEXT, c_abapgit_class TYPE tcode VALUE `ZCL_ABAPGIT_REPO` ##NO_TEXT. CLASS-METHODS open_abapgit_homepage RAISING zcx_abapgit_exception . CLASS-METHODS open_abapgit_wikipage RAISING zcx_abapgit_exception . CLASS-METHODS open_dotabap_homepage RAISING zcx_abapgit_exception . CLASS-METHODS open_abapgit_changelog RAISING zcx_abapgit_exception . CLASS-METHODS install_abapgit RAISING zcx_abapgit_exception . CLASS-METHODS is_installed RETURNING VALUE(rv_devclass) TYPE tadir-devclass . CLASS-METHODS prepare_gui_startup RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. CLASS-METHODS do_install IMPORTING iv_title TYPE c iv_text TYPE c iv_url TYPE string iv_package TYPE devclass RAISING zcx_abapgit_exception. CLASS-METHODS set_start_repo_from_package IMPORTING iv_package TYPE devclass RAISING zcx_abapgit_exception. CLASS-METHODS get_package_from_adt RETURNING VALUE(rv_package) TYPE devclass. CLASS-METHODS check_sapgui RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_SERVICES_ABAPGIT IMPLEMENTATION. METHOD check_sapgui. CONSTANTS: lc_hide_sapgui_hint TYPE string VALUE '2'. DATA: lv_answer TYPE char1, ls_settings TYPE zif_abapgit_definitions=>ty_s_user_settings, li_user_persistence TYPE REF TO zif_abapgit_persist_user. li_user_persistence = zcl_abapgit_persistence_user=>get_instance( ). ls_settings = li_user_persistence->get_settings( ). IF ls_settings-hide_sapgui_hint = abap_true. RETURN. ENDIF. IF zcl_abapgit_ui_factory=>get_gui_functions( )->is_sapgui_for_java( ) = abap_false. RETURN. ENDIF. lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm( iv_titlebar = 'Not supported SAPGUI' iv_text_question = 'SAPGUI for Java is not supported! There might be some issues.' iv_text_button_1 = 'Got it' iv_icon_button_1 = |{ icon_okay }| iv_text_button_2 = 'Hide' iv_icon_button_2 = |{ icon_set_state }| iv_display_cancel_button = abap_false ). IF lv_answer = lc_hide_sapgui_hint. ls_settings-hide_sapgui_hint = abap_true. li_user_persistence->set_settings( ls_settings ). ENDIF. ENDMETHOD. METHOD do_install. DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online, lv_answer TYPE c LENGTH 1. lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm( iv_titlebar = iv_title iv_text_question = iv_text iv_text_button_1 = 'Continue' iv_text_button_2 = 'Cancel' iv_default_button = '2' iv_display_cancel_button = abap_false ). IF lv_answer <> '1'. RETURN. ENDIF. IF abap_false = zcl_abapgit_repo_srv=>get_instance( )->is_repo_installed( iv_url = iv_url iv_target_package = iv_package ). zcl_abapgit_factory=>get_sap_package( iv_package )->create_local( ). lo_repo = zcl_abapgit_repo_srv=>get_instance( )->new_online( iv_url = iv_url iv_branch_name = zif_abapgit_definitions=>c_git_branch-master iv_package = iv_package ). zcl_abapgit_services_repo=>gui_deserialize( lo_repo ). zcl_abapgit_services_repo=>toggle_favorite( lo_repo->get_key( ) ). ENDIF. COMMIT WORK. ENDMETHOD. METHOD get_package_from_adt. DATA: ls_item TYPE zif_abapgit_definitions=>ty_item, lr_context TYPE REF TO data, lt_fields TYPE tihttpnvp. FIELD-SYMBOLS: <lg_context> TYPE any, <lv_parameters> TYPE string, <ls_field> LIKE LINE OF lt_fields. ls_item-obj_type = 'CLAS'. ls_item-obj_name = 'CL_ADT_GUI_INTEGRATION_CONTEXT'. IF zcl_abapgit_objects=>exists( ls_item ) = abap_false. " ADT is not supported in this NW release RETURN. ENDIF. TRY. CREATE DATA lr_context TYPE ('CL_ADT_GUI_INTEGRATION_CONTEXT=>TY_CONTEXT_INFO'). ASSIGN lr_context->* TO <lg_context>. ASSERT sy-subrc = 0. CALL METHOD ('CL_ADT_GUI_INTEGRATION_CONTEXT')=>read_context RECEIVING result = <lg_context>. ASSIGN COMPONENT 'PARAMETERS' OF STRUCTURE <lg_context> TO <lv_parameters>. ASSERT sy-subrc = 0. lt_fields = cl_http_utility=>string_to_fields( cl_http_utility=>unescape_url( <lv_parameters> ) ). READ TABLE lt_fields ASSIGNING <ls_field> WITH KEY name = 'p_package_name'. IF sy-subrc = 0. rv_package = <ls_field>-value. " We want to open the repo just once. Therefore we delete the parameters " and initialize the ADT context. CLEAR <lv_parameters>. CALL METHOD ('CL_ADT_GUI_INTEGRATION_CONTEXT')=>initialize_instance EXPORTING context_info = <lg_context>. ENDIF. CATCH cx_root. " Some problems with dynamic ADT access. " Let's ignore it for now and fail silently ENDTRY. ENDMETHOD. METHOD install_abapgit. CONSTANTS lc_title TYPE c LENGTH 40 VALUE 'Install abapGit'. DATA lv_text TYPE c LENGTH 100. IF NOT is_installed( ) IS INITIAL. lv_text = 'Seems like abapGit package is already installed. No changes to be done'. zcl_abapgit_ui_factory=>get_popups( )->popup_to_inform( iv_titlebar = lc_title iv_text_message = lv_text ). RETURN. ENDIF. lv_text = |Confirm to install current version of abapGit to package { c_abapgit_package }|. do_install( iv_title = lc_title iv_text = lv_text iv_url = c_abapgit_url iv_package = c_abapgit_package ). ENDMETHOD. METHOD is_installed. SELECT SINGLE devclass FROM tadir INTO rv_devclass WHERE pgmid = 'R3TR' AND object = 'CLAS' AND obj_name = c_abapgit_class. ENDMETHOD. METHOD open_abapgit_changelog. cl_gui_frontend_services=>execute( EXPORTING document = c_abapgit_repo && '/blob/master/changelog.txt' EXCEPTIONS OTHERS = 1 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Opening page in external browser failed.' ). ENDIF. ENDMETHOD. METHOD open_abapgit_homepage. cl_gui_frontend_services=>execute( EXPORTING document = c_abapgit_homepage EXCEPTIONS OTHERS = 1 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Opening page in external browser failed.' ). ENDIF. ENDMETHOD. METHOD open_abapgit_wikipage. cl_gui_frontend_services=>execute( EXPORTING document = c_abapgit_wikipage EXCEPTIONS OTHERS = 1 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Opening page in external browser failed.' ). ENDIF. ENDMETHOD. METHOD open_dotabap_homepage. cl_gui_frontend_services=>execute( EXPORTING document = c_dotabap_homepage EXCEPTIONS OTHERS = 1 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'Opening page in external browser failed.' ). ENDIF. ENDMETHOD. METHOD prepare_gui_startup. DATA: lv_repo_key TYPE zif_abapgit_persistence=>ty_value, lv_package TYPE devclass, lv_package_adt TYPE devclass. check_sapgui( ). IF zcl_abapgit_persist_settings=>get_instance( )->read( )->get_show_default_repo( ) = abap_false. " Don't show the last seen repo at startup zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( || ). ENDIF. " We have three special cases for gui startup " - open a specific repo by repo key " - open a specific repo by package name " - open a specific repo by package name provided by ADT " These overrule the last shown repo GET PARAMETER ID zif_abapgit_definitions=>c_spagpa_param_repo_key FIELD lv_repo_key. GET PARAMETER ID zif_abapgit_definitions=>c_spagpa_param_package FIELD lv_package. lv_package_adt = get_package_from_adt( ). IF lv_repo_key IS NOT INITIAL. SET PARAMETER ID zif_abapgit_definitions=>c_spagpa_param_repo_key FIELD ''. zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lv_repo_key ). ELSEIF lv_package IS NOT INITIAL. SET PARAMETER ID zif_abapgit_definitions=>c_spagpa_param_package FIELD ''. set_start_repo_from_package( lv_package ). ELSEIF lv_package_adt IS NOT INITIAL. set_start_repo_from_package( lv_package_adt ). ENDIF. ENDMETHOD. METHOD set_start_repo_from_package. DATA: lo_repo TYPE REF TO zcl_abapgit_repo, lt_r_package TYPE RANGE OF devclass, ls_r_package LIKE LINE OF lt_r_package, lt_superpackages TYPE zif_abapgit_sap_package=>ty_devclass_tt, li_package TYPE REF TO zif_abapgit_sap_package, lt_repo_list TYPE zif_abapgit_definitions=>ty_repo_ref_tt. FIELD-SYMBOLS: <lo_repo> TYPE LINE OF zif_abapgit_definitions=>ty_repo_ref_tt, <lv_superpackage> LIKE LINE OF lt_superpackages. li_package = zcl_abapgit_factory=>get_sap_package( iv_package ). IF li_package->exists( ) = abap_false. RETURN. ENDIF. ls_r_package-sign = 'I'. ls_r_package-option = 'EQ'. ls_r_package-low = iv_package. INSERT ls_r_package INTO TABLE lt_r_package. " Also consider superpackages. E.g. when some open $abapgit_ui, abapGit repo " should be found via package $abapgit lt_superpackages = li_package->list_superpackages( ). LOOP AT lt_superpackages ASSIGNING <lv_superpackage>. ls_r_package-low = <lv_superpackage>. INSERT ls_r_package INTO TABLE lt_r_package. ENDLOOP. lt_repo_list = zcl_abapgit_repo_srv=>get_instance( )->list( ). LOOP AT lt_repo_list ASSIGNING <lo_repo>. IF <lo_repo>->get_package( ) IN lt_r_package. lo_repo = <lo_repo>. EXIT. ENDIF. ENDLOOP. IF lo_repo IS BOUND. zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lo_repo->get_key( ) ). ENDIF. ENDMETHOD. ENDCLASS.
30.337802
110
0.657476
bdb9908f14de62d6ba66530058284ce300cab77d
2,678
abap
ABAP
Data/ABAP/YSPFL.abap
sapdatasheet/sapdatasheet
fd4430f4d845a7cdba4ebe1a389b494c546f2af3
[ "Apache-2.0" ]
23
2015-05-29T05:55:58.000Z
2021-12-14T09:02:17.000Z
Data/ABAP/YSPFL.abap
sapdatasheet/sapdatasheet
fd4430f4d845a7cdba4ebe1a389b494c546f2af3
[ "Apache-2.0" ]
23
2015-05-07T08:05:09.000Z
2021-12-05T02:45:32.000Z
Data/ABAP/YSPFL.abap
sapdatasheet/sapdatasheet
fd4430f4d845a7cdba4ebe1a389b494c546f2af3
[ "Apache-2.0" ]
7
2020-01-17T08:04:51.000Z
2022-01-19T11:15:10.000Z
*&---------------------------------------------------------------------* *& Report YSPFL *& *&---------------------------------------------------------------------* *& Fill in YSPFL* tables based on CL_SPFL_PROFILE_PARAMETER *&---------------------------------------------------------------------* REPORT yspfl. DATA: lt_metadata TYPE spfl_parameter_metadata_list_t, ls_metadata TYPE LINE OF spfl_parameter_metadata_list_t, lv_rc TYPE i, lt_db_metadata TYPE STANDARD TABLE OF yspflmetadata, ls_db_metadata TYPE yspflmetadata. CALL METHOD cl_spfl_profile_parameter=>get_all_metadata IMPORTING metadata = lt_metadata RECEIVING rc = lv_rc. IF lv_rc NE 0. WRITE: 'Failed to call cl_spfl_profile_parameter=>get_all_metadata'. EXIT. ENDIF. DELETE FROM yspflmetadata. COMMIT WORK. CLEAR ls_db_metadata. CLEAR lt_db_metadata. ls_db_metadata-seq = 0. LOOP AT lt_metadata INTO ls_metadata. ls_db_metadata-seq = ls_db_metadata-seq + 1. MOVE-CORRESPONDING ls_metadata TO ls_db_metadata. APPEND ls_db_metadata TO lt_db_metadata. ENDLOOP. INSERT yspflmetadata FROM TABLE lt_db_metadata. COMMIT WORK. NEW-LINE. WRITE: 'Insert into table YSPFLMETADATA finished'. DATA: lt_p_sub TYPE spfl_parameter_list_t, ls_p_sub TYPE LINE OF spfl_parameter_list_t, lt_p_usub TYPE spfl_parameter_list_t, ls_p_usub TYPE LINE OF spfl_parameter_list_t, lt_db_p_sub TYPE STANDARD TABLE OF yspflparasub, ls_db_p_sub TYPE yspflparasub, lt_db_p_usub TYPE STANDARD TABLE OF yspflparausub, ls_db_p_usub TYPE yspflparausub. CALL METHOD cl_spfl_profile_parameter=>get_all_parameter IMPORTING parameter_sub = lt_p_sub parameter_usub = lt_p_usub RECEIVING rc = lv_rc. IF lv_rc NE 0. WRITE: 'Failed to call cl_spfl_profile_parameter=>get_all_parameter'. EXIT. ENDIF. DELETE FROM yspflparasub. DELETE FROM yspflparausub. COMMIT WORK. CLEAR: lt_db_p_sub, ls_db_p_sub. CLEAR: lt_db_p_usub, ls_db_p_usub. ls_db_p_sub-seq = 0. LOOP AT lt_p_sub INTO ls_p_sub. ls_db_p_sub-seq = ls_db_p_sub-seq + 1. MOVE-CORRESPONDING ls_p_sub TO ls_db_p_sub. APPEND ls_db_p_sub TO lt_db_p_sub. ENDLOOP. ls_db_p_usub-seq = 0. LOOP AT lt_p_usub INTO ls_p_usub. ls_db_p_usub-seq = ls_db_p_usub-seq + 1. MOVE-CORRESPONDING ls_p_usub TO ls_db_p_usub. APPEND ls_db_p_usub TO lt_db_p_usub. ENDLOOP. INSERT yspflparasub FROM TABLE lt_db_p_sub. INSERT yspflparausub FROM TABLE lt_db_p_usub. COMMIT WORK. NEW-LINE. WRITE: 'Insert into table YSPFLPARASUB, YSPFLPARAUSUB finished'.
30.431818
73
0.680358
bdba5fb30f8759b5a3c131446d279f3704560991
13,331
abap
ABAP
src/ydk_cl_placement.clas.abap
DKiyanov/YDK_CL_PLACEMENT
23981fc3c9c3e9c431f615e4c2d12043c3a11ced
[ "MIT" ]
null
null
null
src/ydk_cl_placement.clas.abap
DKiyanov/YDK_CL_PLACEMENT
23981fc3c9c3e9c431f615e4c2d12043c3a11ced
[ "MIT" ]
null
null
null
src/ydk_cl_placement.clas.abap
DKiyanov/YDK_CL_PLACEMENT
23981fc3c9c3e9c431f615e4c2d12043c3a11ced
[ "MIT" ]
null
null
null
class YDK_CL_PLACEMENT definition public final create public . public section. types: * itplacment - это запись порядка действий для создания требуемого размещения контейнеров * каждая строка это действие по вставке CL_GUI_SPLITTER_CONTAINER * после вставки CL_GUI_SPLITTER_CONTAINER к его контейнерам присваются имена * исходного и нового в зависимоти от стороны вставки по отношению к исходному BEGIN OF ty_placment, cname TYPE string, " имя контейнера в который будет встален CL_GUI_EASY_SPLITTER_CONTAINER side TYPE c LENGTH 1, " сторона с которой будет размещён новый контейнер ncname TYPE string, " имя нового контейнера nsize TYPE i, " размер % END OF ty_placment . types: ty_placment_tab TYPE STANDARD TABLE OF ty_placment . types: BEGIN OF ty_cont, cname TYPE string, splitter TYPE REF TO cl_gui_splitter_container, row TYPE i, col TYPE i, container TYPE REF TO cl_gui_container, size TYPE i, END OF ty_cont . types: ty_cont_tab TYPE STANDARD TABLE OF ty_cont . types: BEGIN OF ty_cont_size, cname TYPE string, size TYPE i, END OF ty_cont_size . types: ty_cont_size_tab TYPE STANDARD TABLE OF ty_cont_size . data REPORT type REPID read-only . data HANDLE type YDK_PLACEMENT_VR-HANDLE read-only . data VARIANT type YDK_PLACEMENT_VR-VARIANT read-only . data ITPLACMENT type TY_PLACMENT_TAB read-only . data ITCONT type TY_CONT_TAB read-only . methods CONSTRUCTOR importing value(REPORT) type REPID optional !HANDLE type YDK_PLACEMENT_VR-HANDLE optional . type-pools ABAP . methods LOAD_PLACEMENT importing !ROOT type ref to CL_GUI_CONTAINER !VARIANT type YDK_PLACEMENT_VR-VARIANT !LOAD_SIZES type ABAP_BOOL default ABAP_TRUE . methods CREATE_PLACEMENT importing !ROOT type ref to CL_GUI_CONTAINER !PLACMENT type TY_PLACMENT_TAB . methods SAVE_PLACEMENT importing !PLACMENT type TY_PLACMENT_TAB optional !VARIANT type YDK_PLACEMENT_VR-VARIANT !TEXT type CLIKE . methods SAVE_SIZES importing !FOR_USER type ABAP_BOOL default ABAP_TRUE . methods ADD_CONTAINER importing !CNAME type CLIKE !SIDE type YDK_PLACEMENT_SIDE !NCNAME type CLIKE !NSIZE type I optional returning value(N_CONTAINER) type ref to CL_GUI_CONTAINER . methods LOAD_SIZES . class-methods VARIANT_EXISTS importing value(REPORT) type REPID optional !HANDLE type YDK_PLACEMENT_VR-HANDLE optional !VARIANT type YDK_PLACEMENT_VR-VARIANT returning value(EXISTS) type ABAP_BOOL . type-pools SDYDO . class-methods VARIANT_EDIT importing value(REPORT) type REPID optional !HANDLE type YDK_PLACEMENT_VR-HANDLE optional !VARIANT type YDK_PLACEMENT_VR-VARIANT optional !AREAS_TAB type SDYDO_OPTION_TAB !LEFT type I optional !TOP type I optional !WIDTH type I optional !HEIGHT type I optional returning value(RET_VARIANT) type YDK_PLACEMENT_VR-VARIANT . class-methods VARIANT_DELETE importing value(REPORT) type REPID optional !HANDLE type YDK_PLACEMENT_VR-HANDLE optional !VARIANT type YDK_PLACEMENT_VR-VARIANT optional . class-methods VARIANT_GET_DEFAULT importing value(REPORT) type REPID optional !HANDLE type YDK_PLACEMENT_VR-HANDLE optional returning value(VARIANT) type YDK_PLACEMENT_VR-VARIANT exceptions NOT_FOUND . class-methods VARIANTS_DIALOG importing value(REPORT) type REPID optional !HANDLE type YDK_PLACEMENT_VR-HANDLE optional !AREAS_TAB type SDYDO_OPTION_TAB optional !LEFT type I default 10 !TOP type I default 10 !CAN_SELECT type ABAP_BOOL optional !CAN_CREATE type ABAP_BOOL optional !CAN_EDIT type ABAP_BOOL optional !CAN_DELETE type ABAP_BOOL optional !CAN_SET_DEFAULT_VAR type ABAP_BOOL optional returning value(VARIANT) type YDK_PLACEMENT_VR-VARIANT exceptions CANCEL . protected section. private section. ENDCLASS. CLASS YDK_CL_PLACEMENT IMPLEMENTATION. METHOD add_container. FIELD-SYMBOLS <placment> LIKE LINE OF itplacment. READ TABLE itplacment WITH KEY cname = cname ncname = ncname TRANSPORTING NO FIELDS. IF sy-subrc <> 0. APPEND INITIAL LINE TO itplacment ASSIGNING <placment>. <placment>-cname = cname. <placment>-side = side. <placment>-ncname = ncname. <placment>-nsize = nsize. ENDIF. DATA: n_splitter TYPE REF TO cl_gui_splitter_container. FIELD-SYMBOLS <cont> LIKE LINE OF itcont. IF cname IS INITIAL. " добавляется первый (корневой элемент) READ TABLE itcont ASSIGNING <cont> WITH KEY cname = '@ROOT@'. CHECK sy-subrc = 0. CLEAR <cont>-cname. n_container = <cont>-container. APPEND INITIAL LINE TO itcont ASSIGNING <cont>. <cont>-cname = ncname. <cont>-container = n_container. RETURN. ENDIF. READ TABLE itcont ASSIGNING <cont> WITH KEY cname = cname. CHECK sy-subrc = 0. DATA: o_row TYPE i VALUE 1. DATA: n_row TYPE i VALUE 1. DATA: o_col TYPE i VALUE 1. DATA: n_col TYPE i VALUE 1. CASE side. WHEN 'L'. o_col = 2. WHEN 'R'. n_col = 2. WHEN 'T'. o_row = 2. WHEN 'B'. n_row = 2. ENDCASE. CASE side. WHEN 'L' OR 'R'. CREATE OBJECT n_splitter EXPORTING parent = <cont>-container rows = 1 columns = 2. IF NOT nsize IS INITIAL. CALL METHOD n_splitter->set_column_width EXPORTING id = n_col width = nsize. ENDIF. WHEN 'T' OR 'B'. CREATE OBJECT n_splitter EXPORTING parent = <cont>-container rows = 2 columns = 1. IF NOT nsize IS INITIAL. CALL METHOD n_splitter->set_row_height EXPORTING id = n_row height = nsize. ENDIF. ENDCASE. CALL METHOD n_splitter->set_border EXPORTING border = cl_gui_cfw=>false. CLEAR <cont>-cname. DATA: o_container TYPE REF TO cl_gui_container. CALL METHOD n_splitter->get_container EXPORTING row = o_row column = o_col RECEIVING container = o_container. APPEND INITIAL LINE TO itcont ASSIGNING <cont>. <cont>-cname = cname. <cont>-splitter = n_splitter. <cont>-row = o_row. <cont>-col = o_col. <cont>-container = o_container. CALL METHOD n_splitter->get_container EXPORTING row = n_row column = n_col RECEIVING container = n_container. APPEND INITIAL LINE TO itcont ASSIGNING <cont>. <cont>-cname = ncname. <cont>-splitter = n_splitter. <cont>-row = n_row. <cont>-col = n_col. <cont>-container = n_container. ENDMETHOD. METHOD constructor. me->report = report. IF me->report IS INITIAL. CALL 'AB_GET_CALLER' ID 'PROGRAM' FIELD me->report. "#EC CI_CCALL ENDIF. me->handle = handle. ENDMETHOD. METHOD create_placement. REFRESH: itcont. itplacment = placment. itcont = VALUE #( ( cname = '@ROOT@' container = root ) ). FIELD-SYMBOLS <placment> TYPE ty_placment. LOOP AT itplacment ASSIGNING <placment>. add_container( cname = <placment>-cname side = <placment>-side ncname = <placment>-ncname nsize = <placment>-nsize ). ENDLOOP. ENDMETHOD. METHOD load_placement. DATA: rawdata TYPE ydk_placement_vr-rawdata. SELECT SINGLE rawdata INTO rawdata FROM ydk_placement_vr WHERE report = report AND handle = handle AND variant = variant. CHECK sy-subrc = 0. IMPORT placment TO itplacment FROM DATA BUFFER rawdata. create_placement( root = root placment = itplacment ). me->variant = variant. IF load_sizes = abap_true. load_sizes( ). ENDIF. ENDMETHOD. METHOD load_sizes. DATA: rawdata TYPE ydk_placement_sz-rawdata. DATA: itcs TYPE ty_cont_size_tab. FIELD-SYMBOLS <cs> LIKE LINE OF itcs. SELECT SINGLE rawdata INTO rawdata FROM ydk_placement_sz WHERE report = report AND handle = handle AND variant = variant AND uname = sy-uname. IF sy-subrc <> 0. SELECT SINGLE rawdata INTO rawdata FROM ydk_placement_sz WHERE report = report AND handle = handle AND variant = variant AND uname = ''. ENDIF. CHECK sy-subrc = 0. IMPORT sizes TO itcs FROM DATA BUFFER rawdata. DATA: lv_index TYPE i. LOOP AT itcont ASSIGNING FIELD-SYMBOL(<cont>) WHERE row = 2 OR col = 2. ADD 1 TO lv_index. READ TABLE itcs ASSIGNING <cs> INDEX lv_index. CHECK sy-subrc = 0. CHECK <cs>-cname = <cont>-cname. IF <cont>-row = 2. CALL METHOD <cont>-splitter->set_row_height EXPORTING id = 2 height = <cs>-size. ELSE. CALL METHOD <cont>-splitter->set_column_width EXPORTING id = 2 width = <cs>-size. ENDIF. ENDLOOP. ENDMETHOD. METHOD save_placement. DATA: pvr TYPE ydk_placement_vr. FIELD-SYMBOLS <placment> TYPE ty_placment_tab. IF placment IS SUPPLIED. ASSIGN placment TO <placment>. ELSE. ASSIGN me->itplacment TO <placment>. ENDIF. pvr-report = report. pvr-handle = handle. pvr-variant = variant. pvr-text = text. EXPORT placment FROM <placment> TO DATA BUFFER pvr-rawdata. MODIFY ydk_placement_vr FROM pvr. me->variant = variant. ENDMETHOD. METHOD save_sizes. * report и handle оперделяются при создании объекта * variant определяется при загрузке или при сохранении DATA: itcs TYPE ty_cont_size_tab. FIELD-SYMBOLS <cs> LIKE LINE OF itcs. LOOP AT itcont ASSIGNING FIELD-SYMBOL(<cont>) WHERE row = 2 OR col = 2. APPEND INITIAL LINE TO itcs ASSIGNING <cs>. <cs>-cname = <cont>-cname. IF <cont>-row = 2. CALL METHOD <cont>-splitter->get_row_height EXPORTING id = 2 IMPORTING result = <cs>-size. ELSE. CALL METHOD <cont>-splitter->get_column_width EXPORTING id = 2 IMPORTING result = <cs>-size. ENDIF. cl_gui_cfw=>flush( ). ENDLOOP. DATA: psz TYPE ydk_placement_sz. psz-report = report. psz-handle = handle. psz-variant = variant. IF for_user = abap_true. psz-uname = sy-uname. ENDIF. EXPORT sizes FROM itcs TO DATA BUFFER psz-rawdata. MODIFY ydk_placement_sz FROM psz. ENDMETHOD. METHOD variants_dialog. IF report IS INITIAL. CALL 'AB_GET_CALLER' ID 'PROGRAM' FIELD report. "#EC CI_CCALL ENDIF. CALL FUNCTION 'YDK_PLACEMENT_VARIANTS' EXPORTING report = report handle = handle areas_tab = areas_tab left = left top = top can_select = can_select can_create = can_create can_edit = can_edit can_delete = can_delete can_set_default_var = can_set_default_var IMPORTING variant = variant EXCEPTIONS cancel = 1. IF sy-subrc = 1. RAISE cancel. ENDIF. ENDMETHOD. METHOD variant_delete. IF report IS INITIAL. CALL 'AB_GET_CALLER' ID 'PROGRAM' FIELD report. "#EC CI_CCALL ENDIF. DELETE FROM ydk_placement_vr WHERE report = report AND handle = handle AND variant = variant. DELETE FROM ydk_placement_sz WHERE report = report AND handle = handle AND variant = variant. ENDMETHOD. METHOD variant_edit. IF report IS INITIAL. CALL 'AB_GET_CALLER' ID 'PROGRAM' FIELD report. "#EC CI_CCALL ENDIF. CALL FUNCTION 'YDK_PLACEMENT_EDITOR' EXPORTING report = report handle = handle variant = variant areas_tab = areas_tab left = left top = top width = width height = height IMPORTING ret_variant = ret_variant. ENDMETHOD. METHOD variant_exists. IF report IS INITIAL. CALL 'AB_GET_CALLER' ID 'PROGRAM' FIELD report. "#EC CI_CCALL ENDIF. exists = abap_false. SELECT SINGLE @abap_true INTO @exists FROM ydk_placement_vr WHERE report = @report AND handle = @handle AND variant = @variant. ENDMETHOD. METHOD variant_get_default. IF report IS INITIAL. CALL 'AB_GET_CALLER' ID 'PROGRAM' FIELD report. "#EC CI_CCALL ENDIF. SELECT SINGLE variant INTO variant FROM ydk_placement_vr WHERE report = report AND handle = handle AND isdef = abap_true. IF sy-subrc <> 0. RAISE not_found. ENDIF. ENDMETHOD. ENDCLASS.
26.662
123
0.63026
bdbf45c2827876917a72299ab4685fef806e91d9
15,158
abap
ABAP
src/ui/zcl_abapgit_gui_page_debuginfo.clas.abap
abapGit/downport
01b0d32ffe64edad2ff0250258b232fb7e2f1f1c
[ "MIT" ]
3
2020-05-31T18:55:42.000Z
2021-01-08T21:36:09.000Z
src/ui/zcl_abapgit_gui_page_debuginfo.clas.abap
abapGit/downport
01b0d32ffe64edad2ff0250258b232fb7e2f1f1c
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_debuginfo.clas.abap
abapGit/downport
01b0d32ffe64edad2ff0250258b232fb7e2f1f1c
[ "MIT" ]
2
2021-01-08T21:36:15.000Z
2022-03-29T05:40:00.000Z
CLASS zcl_abapgit_gui_page_debuginfo DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_component FINAL CREATE PRIVATE . PUBLIC SECTION. INTERFACES zif_abapgit_gui_event_handler . INTERFACES zif_abapgit_gui_renderable . CLASS-METHODS create RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception . METHODS constructor RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. CONSTANTS c_exit_standalone TYPE c LENGTH 30 VALUE 'ZABAPGIT_USER_EXIT' ##NO_TEXT. CONSTANTS c_exit_class TYPE c LENGTH 30 VALUE 'ZCL_ABAPGIT_USER_EXIT' ##NO_TEXT. CONSTANTS c_exit_interface TYPE c LENGTH 30 VALUE 'ZIF_ABAPGIT_EXIT' ##NO_TEXT. CONSTANTS: BEGIN OF c_action, save TYPE string VALUE 'save', back TYPE string VALUE 'back', END OF c_action. DATA mv_html TYPE string . CLASS-METHODS build_toolbar RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar. METHODS render_debug_info RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_exit_info RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_exit_info_methods IMPORTING !it_source TYPE string_table RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_supported_object_types RETURNING VALUE(rv_html) TYPE string . METHODS render_scripts RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS get_jump_object IMPORTING !iv_obj_type TYPE csequence DEFAULT 'CLAS' !iv_obj_name TYPE csequence RETURNING VALUE(rv_html) TYPE string . ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_DEBUGINFO IMPLEMENTATION. METHOD build_toolbar. CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-debug'. ro_menu->add( iv_txt = 'Save' iv_act = c_action-save ). ro_menu->add( iv_txt = 'Back' iv_act = c_action-back ). ENDMETHOD. METHOD constructor. super->constructor( ). ENDMETHOD. METHOD create. DATA lo_component TYPE REF TO zcl_abapgit_gui_page_debuginfo. CREATE OBJECT lo_component. ri_page = zcl_abapgit_gui_page_hoc=>create( iv_page_title = 'Debug Info' io_page_menu = build_toolbar( ) ii_child_component = lo_component ). ENDMETHOD. METHOD get_jump_object. DATA lv_encode TYPE string. DATA li_html TYPE REF TO zif_abapgit_html. CREATE OBJECT li_html TYPE zcl_abapgit_html. lv_encode = zcl_abapgit_html_action_utils=>jump_encode( iv_obj_type = |{ iv_obj_type }| iv_obj_name = |{ iv_obj_name }| ). rv_html = li_html->a( iv_txt = |{ iv_obj_name }| iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). ENDMETHOD. METHOD render_debug_info. DATA: lt_ver_tab TYPE filetable, lv_rc TYPE i, ls_release TYPE zif_abapgit_environment=>ty_release_sp, lv_gui_version TYPE string, ls_version LIKE LINE OF lt_ver_tab, lv_devclass TYPE devclass, lo_frontend_serv TYPE REF TO zif_abapgit_frontend_services. lo_frontend_serv = zcl_abapgit_ui_factory=>get_frontend_services( ). TRY. lo_frontend_serv->get_gui_version( CHANGING ct_version_table = lt_ver_tab cv_rc = lv_rc ). CATCH zcx_abapgit_exception ##NO_HANDLER. " Continue rendering even if this fails ENDTRY. READ TABLE lt_ver_tab INTO ls_version INDEX 1. " gui release lv_gui_version = ls_version-filename. READ TABLE lt_ver_tab INTO ls_version INDEX 2. " gui sp lv_gui_version = |{ lv_gui_version }.{ ls_version-filename }|. READ TABLE lt_ver_tab INTO ls_version INDEX 3. " gui patch lv_gui_version = |{ lv_gui_version }.{ ls_version-filename }|. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_true. ri_html->add( '<h2>abapGit - Standalone Version</h2>' ). ri_html->add( '<div>To keep abapGit up-to-date (or also to contribute) you need to' ). ri_html->add( |install it as a repository ({ ri_html->a( iv_txt = 'Developer Version' iv_act = 'https://github.com/abapGit/abapGit' iv_typ = zif_abapgit_html=>c_action_type-url ) }).</div>| ). ELSE. lv_devclass = zcl_abapgit_services_abapgit=>is_installed( ). ri_html->add( '<h2>abapGit - Developer Version</h2>' ). ri_html->add( |<div>abapGit is installed in package { lv_devclass }</div>| ). ENDIF. ri_html->add( '<br><div>' ). ri_html->add_a( iv_txt = 'Contribution guidelines for abapGit' iv_act = 'https://github.com/abapGit/abapGit/blob/main/CONTRIBUTING.md' iv_typ = zif_abapgit_html=>c_action_type-url ). ri_html->add( '</div>' ). ls_release = zcl_abapgit_factory=>get_environment( )->get_basis_release( ). ri_html->add( '<h2>Environment</h2>' ). ri_html->add( |<table>| ). ri_html->add( |<tr><td>abapGit version:</td><td>{ zif_abapgit_version=>c_abap_version }</td></tr>| ). ri_html->add( |<tr><td>XML version: </td><td>{ zif_abapgit_version=>c_xml_version }</td></tr>| ). ri_html->add( |<tr><td>GUI version: </td><td>{ lv_gui_version }</td></tr>| ). ri_html->add( |<tr><td>APACK version: </td><td>{ zcl_abapgit_apack_migration=>c_apack_interface_version }</td></tr>| ). ri_html->add( |<tr><td>LCL_TIME: </td><td>{ zcl_abapgit_time=>get_unix( ) }</td></tr>| ). ri_html->add( |<tr><td>SY time: </td><td>{ sy-datum } { sy-uzeit } { sy-tzone }</td></tr>| ). ri_html->add( |<tr><td>SY release: </td><td>{ ls_release-release } SP { ls_release-sp }</td></tr>| ). ri_html->add( |</table>| ). ri_html->add( |<br>| ). ENDMETHOD. METHOD render_exit_info. DATA lt_source TYPE string_table. DATA ls_class_key TYPE seoclskey. DATA lo_oo_serializer TYPE REF TO zcl_abapgit_oo_serializer. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<h2>User Exits</h2>' ). IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_true. " Standalone version READ REPORT c_exit_standalone INTO lt_source. IF sy-subrc = 0. ri_html->add( |<div>User exits are active (include { get_jump_object( iv_obj_type = 'PROG' iv_obj_name = c_exit_standalone ) } found)</div><br>| ). ri_html->add( render_exit_info_methods( lt_source ) ). ELSE. ri_html->add( |<div>No user exits implemented (include { c_exit_standalone } not found)</div><br>| ). ENDIF. ELSE. " Developer version TRY. ls_class_key-clsname = c_exit_class. CREATE OBJECT lo_oo_serializer. lt_source = lo_oo_serializer->serialize_abap_clif_source( ls_class_key ). ri_html->add( |<div>User exits are active (class { get_jump_object( c_exit_class ) } found)</div><br>| ). ri_html->add( render_exit_info_methods( lt_source ) ). CATCH cx_root. ri_html->add( |<div>No user exits implemented (class { c_exit_class } not found)</div><br>| ). ENDTRY. ENDIF. ENDMETHOD. METHOD render_exit_info_methods. DATA: lo_scanner TYPE REF TO cl_oo_source_scanner_class, lx_exc TYPE REF TO cx_root, lt_methods TYPE cl_oo_source_scanner_class=>type_method_implementations, lv_method LIKE LINE OF lt_methods, lt_source TYPE seop_source_string, lv_source TYPE string, lv_rest TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<table border="1px"><thead><tr>' ). ri_html->add( '<td>Exit</td><td class="center">Implemented?</td>' ). ri_html->add( '</tr></thead><tbody>' ). TRY. lo_scanner = cl_oo_source_scanner_class=>create_class_scanner( clif_name = c_exit_class source = it_source ). lo_scanner->scan( ). lt_methods = lo_scanner->get_method_implementations( ). LOOP AT lt_methods INTO lv_method WHERE table_line CS c_exit_interface. lt_source = lo_scanner->get_method_impl_source( lv_method ). DELETE lt_source INDEX 1. DELETE lt_source INDEX lines( lt_source ). CONCATENATE LINES OF lt_source INTO lv_source. lv_source = to_upper( condense( val = lv_source del = ` ` ) ). SPLIT lv_method AT '~' INTO lv_rest lv_method. ri_html->add( |<tr><td>{ lv_method }</td><td class="center">| ). IF lv_source IS INITIAL OR lv_source = 'RETURN.' OR lv_source = 'EXIT.'. ri_html->add( 'No' ). ELSE. ri_html->add( '<strong>Yes</strong>' ). ENDIF. ri_html->add( |</td></tr>| ). ENDLOOP. CATCH cx_root INTO lx_exc. ri_html->add( |<tr><td colspan="2">{ lx_exc->get_text( ) }</td></tr>| ). ENDTRY. ri_html->add( '</tbody></table>' ). ENDMETHOD. METHOD render_scripts. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ). ri_html->add( 'debugOutput("<table><tr><td>Browser:</td><td>" + navigator.userAgent + ' && '"</td></tr><tr><td>Frontend time:</td><td>" + new Date() + "</td></tr></table>", "debug_info");' ). ENDMETHOD. METHOD render_supported_object_types. DATA: lv_list TYPE string, li_html TYPE REF TO zif_abapgit_html, lt_types TYPE zcl_abapgit_objects=>ty_types_tt, lv_type LIKE LINE OF lt_types, lt_obj TYPE STANDARD TABLE OF ko100 WITH DEFAULT KEY, lv_class TYPE seoclsname, li_object TYPE REF TO zif_abapgit_object, ls_item TYPE zif_abapgit_definitions=>ty_item, ls_metadata TYPE zif_abapgit_definitions=>ty_metadata, lv_step TYPE zif_abapgit_definitions=>ty_deserialization_step, lt_steps TYPE zif_abapgit_definitions=>ty_deserialization_step_tt. FIELD-SYMBOLS: <ls_obj> TYPE ko100. CALL FUNCTION 'TR_OBJECT_TABLE' TABLES wt_object_text = lt_obj. lt_types = zcl_abapgit_objects=>supported_list( ). CREATE OBJECT li_html TYPE zcl_abapgit_html. rv_html = '<h2>Object Types</h2>'. rv_html = rv_html && li_html->a( iv_txt = 'Complete list of object types supported by abapGit' iv_act = 'https://docs.abapgit.org/ref-supported.html' iv_typ = zif_abapgit_html=>c_action_type-url ). rv_html = rv_html && |<br><br>Supported object types in <strong>this</strong> system:<br><br>|. rv_html = rv_html && |<table border="1px"><thead><tr>|. rv_html = rv_html && |<td>Object</td><td>Description</td><td>Class</td><td>Version</td>|. rv_html = rv_html && |<td class="center">DDIC</td>|. rv_html = rv_html && |<td class="center">Delete TADIR</td><td>Steps</td>|. rv_html = rv_html && |</tr></thead><tbody>|. LOOP AT lt_types INTO lv_type. lv_class = 'ZCL_ABAPGIT_OBJECT_' && lv_type. rv_html = rv_html && |<tr>|. rv_html = rv_html && |<td>{ lv_type }</td>|. READ TABLE lt_obj ASSIGNING <ls_obj> WITH KEY pgmid = 'R3TR' object = lv_type. IF sy-subrc = 0. rv_html = rv_html && |<td>{ <ls_obj>-text }</td>|. ELSE. rv_html = rv_html && |<td class="warning">No description</td>|. ENDIF. TRY. ls_item-obj_type = lv_type. ls_item-obj_name = 'TEST'. CREATE OBJECT li_object TYPE (lv_class) EXPORTING is_item = ls_item iv_language = sy-langu. rv_html = rv_html && |<td>{ get_jump_object( lv_class ) }</td>|. CATCH cx_sy_create_object_error. TRY. " 2nd step, try looking for plugins CREATE OBJECT li_object TYPE zcl_abapgit_objects_bridge EXPORTING is_item = ls_item. CATCH cx_sy_create_object_error. rv_html = rv_html && |<td class="error" colspan="5">{ lv_class } - error instantiating class</td>|. CONTINUE. ENDTRY. rv_html = rv_html && |<td>{ get_jump_object( lv_class ) } (Plug-in)</td>|. ENDTRY. ls_metadata = li_object->get_metadata( ). rv_html = rv_html && |<td>{ ls_metadata-version }</td>|. rv_html = rv_html && |<td class="center">{ ls_metadata-ddic }</td>|. rv_html = rv_html && |<td class="center">{ ls_metadata-delete_tadir }</td>|. lt_steps = li_object->get_deserialize_steps( ). CLEAR lv_list. LOOP AT lt_steps INTO lv_step. IF lv_list IS INITIAL. lv_list = lv_step. ELSE. lv_list = lv_list && `, ` && lv_step. ENDIF. ENDLOOP. rv_html = rv_html && |<td>{ lv_list }</td>|. rv_html = rv_html && |</tr>|. ENDLOOP. rv_html = rv_html && |</tbody></table>|. rv_html = rv_html && |<br>|. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA: lv_path TYPE string, lv_filename TYPE string, li_fe_serv TYPE REF TO zif_abapgit_frontend_services. CASE ii_event->mv_action. WHEN c_action-save. CONCATENATE 'abapGit_Debug_Info_' sy-datlo '_' sy-timlo '.html' INTO lv_filename. li_fe_serv = zcl_abapgit_ui_factory=>get_frontend_services( ). lv_path = li_fe_serv->show_file_save_dialog( iv_title = 'abapGit - Debug Info' iv_extension = 'html' iv_default_filename = lv_filename ). li_fe_serv->file_download( iv_path = lv_path iv_xstr = zcl_abapgit_convert=>string_to_xstring_utf8( mv_html ) ). MESSAGE 'abapGit Debug Info successfully saved' TYPE 'S'. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_action-back. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. gui_services( )->register_event_handler( me ). CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="debug_info" class="debug_container">' ). ri_html->add( render_debug_info( ) ). ri_html->add( '</div>' ). ri_html->add( '<div id="exit_info" class="debug_container">' ). ri_html->add( render_exit_info( ) ). ri_html->add( '</div>' ). ri_html->add( '<div id="supported_objects" class="debug_container">' ). ri_html->add( render_supported_object_types( ) ). ri_html->add( '</div>' ). mv_html = '<!DOCTYPE html><html lang="en"><title>abapGit Debug Info</title></head>'. mv_html = |<body>{ ri_html->render( ) }</body></html>|. register_deferred_script( render_scripts( ) ). ENDMETHOD. ENDCLASS.
33.461369
115
0.639662
bdc37b7a0c73186c53c7e556ff4bc2f636c0db95
106
abap
ABAP
src/y_code_pal_version.intf.abap
jan-jezek/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
1
2021-06-08T05:59:39.000Z
2021-06-08T05:59:39.000Z
src/y_code_pal_version.intf.abap
jan-jezek/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
5
2021-05-13T12:49:01.000Z
2021-07-08T18:28:44.000Z
src/y_code_pal_version.intf.abap
lucasborin/code-pal-for-abap
4e1247693457e7687648806b18b63cb8968f927a
[ "Apache-2.0" ]
null
null
null
INTERFACE y_code_pal_version PUBLIC. CONSTANTS abap TYPE string VALUE '1.14.2' ##NO_TEXT. ENDINTERFACE.
26.5
54
0.792453
bdc42a072523282f00d3f074a9e228cc15f36ce4
4,625
abap
ABAP
src/zcas_r_delete_package_i01.prog.abap
mariusraht2/DELETE_PACKAGE
48b46556562ef52bae6556fdd32c0d23a2e3172e
[ "MIT" ]
null
null
null
src/zcas_r_delete_package_i01.prog.abap
mariusraht2/DELETE_PACKAGE
48b46556562ef52bae6556fdd32c0d23a2e3172e
[ "MIT" ]
null
null
null
src/zcas_r_delete_package_i01.prog.abap
mariusraht2/DELETE_PACKAGE
48b46556562ef52bae6556fdd32c0d23a2e3172e
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Include zcas_r_delete_package_i01 *&---------------------------------------------------------------------* CLASS lcl_object DEFINITION ABSTRACT. PUBLIC SECTION. DATA: ms_object TYPE s_object. METHODS constructor IMPORTING !is_object TYPE s_object. METHODS delete ABSTRACT. ENDCLASS. CLASS lcl_object IMPLEMENTATION. METHOD constructor. ms_object = is_object. ENDMETHOD. ENDCLASS. CLASS lcl_object_clas DEFINITION FINAL INHERITING FROM lcl_object. PUBLIC SECTION. METHODS: delete REDEFINITION. PRIVATE SECTION. CONSTANTS: mc_obj_type TYPE trobjtype VALUE 'CLAS'. ENDCLASS. CLASS lcl_object_clas IMPLEMENTATION. METHOD delete. DATA(clskey) = VALUE seoclskey( clsname = ms_object-name ). " SEO_INTERFACE_DELETE_COMPLETE CALL FUNCTION 'SEO_CLASS_DELETE_COMPLETE' EXPORTING clskey = clskey * genflag = space " Generation Flag suppress_commit = abap_true * suppress_corr = " Suppress Corr-Insert and Corr-Check * CHANGING * corrnr = " Request/Task EXCEPTIONS not_existing = 1 is_interface = 2 db_error = 3 no_access = 4 other = 5 OTHERS = 6. ENDMETHOD. ENDCLASS. CLASS lcl_object_intf DEFINITION FINAL INHERITING FROM lcl_object. PUBLIC SECTION. METHODS: delete REDEFINITION. PRIVATE SECTION. CONSTANTS: mc_obj_type TYPE trobjtype VALUE 'INTF'. ENDCLASS. CLASS lcl_object_intf IMPLEMENTATION. METHOD delete. DATA(intkey) = VALUE seoclskey( clsname = ms_object-name ). " SEO_INTERFACE_DELETE_COMPLETE CALL FUNCTION 'SEO_INTERFACE_DELETE_COMPLETE' EXPORTING intkey = intkey * genflag = space " Generation Flag suppress_commit = abap_true * suppress_corr = " Corr-Insert und Corr-Check unterdrücken * suppress_dialog = " X = no user interaction * CHANGING * corrnr = " Request/Task EXCEPTIONS not_existing = 1 is_class = 2 db_error = 3 no_access = 4 other = 5 OTHERS = 6. ENDMETHOD. ENDCLASS. CLASS lcl_object_fugr DEFINITION FINAL INHERITING FROM lcl_object. PUBLIC SECTION. METHODS: delete REDEFINITION. PRIVATE SECTION. CONSTANTS: mc_obj_type TYPE trobjtype VALUE 'FUGR'. ENDCLASS. CLASS lcl_object_fugr IMPLEMENTATION. METHOD delete. DATA(lv_area) = CONV rs38l_area( ms_object-name ). CALL FUNCTION 'RS_FUNCTION_POOL_DELETE' EXPORTING area = lv_area suppress_popups = abap_true skip_progress_ind = abap_true * corrnum = EXCEPTIONS canceled_in_corr = 1 enqueue_system_failure = 2 function_exist = 3 not_executed = 4 no_modify_permission = 5 no_show_permission = 6 permission_failure = 7 pool_not_exist = 8 cancelled = 9 OTHERS = 10. ENDMETHOD. ENDCLASS. CLASS lcl_object_prog DEFINITION FINAL INHERITING FROM lcl_object. PUBLIC SECTION. METHODS: delete REDEFINITION. PRIVATE SECTION. CONSTANTS: mc_obj_type TYPE trobjtype VALUE 'PROG'. ENDCLASS. CLASS lcl_object_prog IMPLEMENTATION. METHOD delete. CALL FUNCTION 'RS_DELETE_PROGRAM' EXPORTING program = ms_object-name suppress_popup = abap_true force_delete_used_includes = abap_true EXCEPTIONS enqueue_lock = 1 object_not_found = 2 permission_failure = 3 reject_deletion = 4 OTHERS = 5. ENDMETHOD. ENDCLASS. CLASS lcl_object_tran DEFINITION FINAL INHERITING FROM lcl_object. PUBLIC SECTION. METHODS: delete REDEFINITION. PRIVATE SECTION. CONSTANTS: mc_obj_type TYPE trobjtype VALUE 'TRAN'. ENDCLASS. CLASS lcl_object_tran IMPLEMENTATION. METHOD delete. DATA(lv_transaction) = CONV tcode( ms_object-name ). CALL FUNCTION 'RPY_TRANSACTION_DELETE' EXPORTING transaction = lv_transaction EXCEPTIONS not_excecuted = 1 object_not_found = 0 OTHERS = 3. ENDMETHOD. ENDCLASS.
23.00995
84
0.589405
bdc8b55ccec96fbc48049165a5fe578b067d37cf
577
abap
ABAP
src/git/zcl_abapgit_git_utils.clas.testclasses.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/git/zcl_abapgit_git_utils.clas.testclasses.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/git/zcl_abapgit_git_utils.clas.testclasses.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
CLASS ltcl_length_utf8 DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA: mo_cut TYPE REF TO zcl_abapgit_git_utils. METHODS: setup, length_utf8_hex FOR TESTING RAISING zcx_abapgit_exception. ENDCLASS. CLASS ltcl_length_utf8 IMPLEMENTATION. METHOD setup. CREATE OBJECT mo_cut. ENDMETHOD. METHOD length_utf8_hex. DATA lv_result TYPE i. lv_result = mo_cut->length_utf8_hex( '30303334' ). cl_abap_unit_assert=>assert_equals( act = lv_result exp = 52 ). ENDMETHOD. ENDCLASS.
17.484848
81
0.717504
bdcbe0aed1e9a22ae9165b8add9c8a07d1a53e79
1,541
abap
ABAP
src/zmr1m_readsoft_invoice.prog.abap
JackGraus/Readsoft-oneline-SAP-connector
1c07dc19a9cbe75788437266c6888fdc75000a02
[ "BSD-2-Clause" ]
2
2020-12-29T05:07:29.000Z
2020-12-29T05:07:37.000Z
src/zmr1m_readsoft_invoice.prog.abap
JackGraus/Readsoft-oneline-SAP-connector
1c07dc19a9cbe75788437266c6888fdc75000a02
[ "BSD-2-Clause" ]
null
null
null
src/zmr1m_readsoft_invoice.prog.abap
JackGraus/Readsoft-oneline-SAP-connector
1c07dc19a9cbe75788437266c6888fdc75000a02
[ "BSD-2-Clause" ]
null
null
null
REPORT zmr1m_readsoft_invoice. SELECTION-SCREEN BEGIN OF BLOCK s01 WITH FRAME TITLE text-s01. PARAMETERS: pa_rfcde TYPE rfcdest OBLIGATORY MATCHCODE OBJECT zcprfcdes_ftp, pa_path TYPE dms_path LOWER CASE. SELECTION-SCREEN END OF BLOCK s01. SELECTION-SCREEN BEGIN OF BLOCK s02 WITH FRAME TITLE text-s02. PARAMETERS: pa_sndls TYPE logsys OBLIGATORY MATCHCODE OBJECT logsys1, pa_mesty TYPE edi_mestyp OBLIGATORY MATCHCODE OBJECT zedi_mestyp_invoic02. SELECTION-SCREEN END OF BLOCK s02. INITIALIZATION. PERFORM init CHANGING pa_rfcde pa_mesty. AT SELECTION-SCREEN OUTPUT. PERFORM hide USING 'PA_PASS'. START-OF-SELECTION. CALL FUNCTION 'Z_MR1M_READSOFT_INVOICE' EXPORTING iv_rfcdest = pa_rfcde iv_path = pa_path iv_sndprn = pa_sndls iv_mestyp = pa_mesty. FORM init CHANGING ev_rfcdest TYPE rfcdest ev_mestyp TYPE edi_mestyp. * Application server SAPFTP RFC destination SELECT rfcdest FROM rfcdes INTO ev_rfcdest UP TO 1 ROWS "#EC CI_GENBUFF WHERE rfctype EQ 'T' AND rfcoptions LIKE '%N=sapftp%' "SAPFTP AND rfcoptions NOT LIKE '%H=%'. "Application server ENDSELECT. * ZINVOIC02 message type SELECT mestyp FROM edimsg INTO ev_mestyp UP TO 1 ROWS WHERE idoctyp EQ 'INVOIC02' AND cimtyp EQ 'ZINVOIC02'. ENDSELECT. ENDFORM. FORM hide USING iv_name TYPE clike. LOOP AT SCREEN. CHECK screen-name EQ iv_name. screen-invisible = '1'. MODIFY SCREEN. ENDLOOP. ENDFORM.
28.537037
76
0.717067
bdd55de0b5900d320fd3ea24bacb32fe325cde88
39,910
abap
ABAP
zbugtracker_core/zbugtracker_persistence/zcl_bug_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
3
2019-02-10T22:03:43.000Z
2021-05-26T06:49:55.000Z
zbugtracker_core/zbugtracker_persistence/zcl_bug_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
2
2020-05-06T14:25:17.000Z
2022-01-13T10:06:40.000Z
zbugtracker_core/zbugtracker_persistence/zcl_bug_persist.clas.abap
rayatus/sapbugtracker
c94439c3bb21908f7945fc5bf3bd88868903e8e8
[ "MIT" ]
1
2021-05-26T06:49:56.000Z
2021-05-26T06:49:56.000Z
class ZCL_BUG_PERSIST definition public final create protected global friends ZCB_BUG_PERSIST . public section. *"* public components of class ZCL_BUG_PERSIST *"* do not include other source files here!!! interfaces IF_OS_STATE . methods GET_AEDAT returning value(RESULT) type ZBT_AEDAT raising CX_OS_OBJECT_NOT_FOUND . methods GET_AENAM returning value(RESULT) type AENAM raising CX_OS_OBJECT_NOT_FOUND . methods GET_ASSIGNED returning value(RESULT) type ZBT_ASSIGNED raising CX_OS_OBJECT_NOT_FOUND . methods GET_BUG_I returning value(RESULT) type ZBT_ID_BUG_I raising CX_OS_OBJECT_NOT_FOUND . methods SET_ASSIGNED importing !I_ASSIGNED type ZBT_ASSIGNED raising CX_OS_OBJECT_NOT_FOUND . methods SET_AENAM importing !I_AENAM type AENAM raising CX_OS_OBJECT_NOT_FOUND . methods SET_AEDAT importing !I_AEDAT type ZBT_AEDAT raising CX_OS_OBJECT_NOT_FOUND . methods SET_BUG_I importing !I_BUG_I type ZBT_ID_BUG_I raising CX_OS_OBJECT_NOT_FOUND . methods SET_TESTER importing !I_TESTER type ZBT_TESTER raising CX_OS_OBJECT_NOT_FOUND . methods SET_RESUMEN importing !I_RESUMEN type ZBT_RESUMEN raising CX_OS_OBJECT_NOT_FOUND . methods SET_REPORTER importing !I_REPORTER type ZBT_REPORTER raising CX_OS_OBJECT_NOT_FOUND . methods SET_HORAS_REA importing !I_HORAS_REA type ZBT_HORAS_REALES raising CX_OS_OBJECT_NOT_FOUND . methods SET_HORAS_EST importing !I_HORAS_EST type ZBT_HORAS_ESTIMADAS raising CX_OS_OBJECT_NOT_FOUND . methods SET_FINALIZADO importing !I_FINALIZADO type ZBT_ENDDAT raising CX_OS_OBJECT_NOT_FOUND . methods SET_ESTADO importing !I_ESTADO type ZBT_ID_ESTADO raising CX_OS_OBJECT_NOT_FOUND . methods SET_DEVELOPER importing !I_DEVELOPER type ZBT_DEVELOPER raising CX_OS_OBJECT_NOT_FOUND . methods SET_DEADLINE importing !I_DEADLINE type ZBT_DEADLINE raising CX_OS_OBJECT_NOT_FOUND . methods SET_CREADO importing !I_CREADO type ZBT_ERDAT raising CX_OS_OBJECT_NOT_FOUND . methods SET_COMPONENTE importing !I_COMPONENTE type ZBT_ID_COMPONENTE raising CX_OS_OBJECT_NOT_FOUND . methods SET_BUGTYPE importing !I_BUGTYPE type ZBT_ID_BUGTYPE raising CX_OS_OBJECT_NOT_FOUND . methods SET_BUGSTYPE importing !I_BUGSTYPE type ZBT_BUGSTYPE raising CX_OS_OBJECT_NOT_FOUND . methods GET_TESTER returning value(RESULT) type ZBT_TESTER raising CX_OS_OBJECT_NOT_FOUND . methods GET_RESUMEN returning value(RESULT) type ZBT_RESUMEN raising CX_OS_OBJECT_NOT_FOUND . methods GET_REPORTER returning value(RESULT) type ZBT_REPORTER raising CX_OS_OBJECT_NOT_FOUND . methods GET_PRODUCTO returning value(RESULT) type ZBT_ID_PRODUCTO raising CX_OS_OBJECT_NOT_FOUND . methods GET_HORAS_REA returning value(RESULT) type ZBT_HORAS_REALES raising CX_OS_OBJECT_NOT_FOUND . methods GET_HORAS_EST returning value(RESULT) type ZBT_HORAS_ESTIMADAS raising CX_OS_OBJECT_NOT_FOUND . methods GET_FINALIZADO returning value(RESULT) type ZBT_ENDDAT raising CX_OS_OBJECT_NOT_FOUND . methods GET_ESTADO returning value(RESULT) type ZBT_ID_ESTADO raising CX_OS_OBJECT_NOT_FOUND . methods GET_DEVELOPER returning value(RESULT) type ZBT_DEVELOPER raising CX_OS_OBJECT_NOT_FOUND . methods GET_DEADLINE returning value(RESULT) type ZBT_DEADLINE raising CX_OS_OBJECT_NOT_FOUND . methods GET_CREADO returning value(RESULT) type ZBT_ERDAT raising CX_OS_OBJECT_NOT_FOUND . methods GET_COMPONENTE returning value(RESULT) type ZBT_ID_COMPONENTE raising CX_OS_OBJECT_NOT_FOUND . methods GET_BUGTYPE returning value(RESULT) type ZBT_ID_BUGTYPE raising CX_OS_OBJECT_NOT_FOUND . methods GET_BUGSTYPE returning value(RESULT) type ZBT_BUGSTYPE raising CX_OS_OBJECT_NOT_FOUND . methods GET_BUG returning value(RESULT) type ZBT_ID_BUG raising CX_OS_OBJECT_NOT_FOUND . class CL_OS_SYSTEM definition load . protected section. *"* protected components of class ZCL_BUG_PERSIST *"* do not include other source files here!!! data AEDAT type ZBT_AEDAT . data AENAM type AENAM . data ASSIGNED type ZBT_ASSIGNED . data BUG type ZBT_ID_BUG . data BUGSTYPE type ZBT_BUGSTYPE . data BUGTYPE type ZBT_ID_BUGTYPE . data BUG_I type ZBT_ID_BUG_I . data COMPONENTE type ZBT_ID_COMPONENTE . data CREADO type ZBT_ERDAT . data DEADLINE type ZBT_DEADLINE . data DEVELOPER type ZBT_DEVELOPER . data ESTADO type ZBT_ID_ESTADO . data FINALIZADO type ZBT_ENDDAT . data HORAS_EST type ZBT_HORAS_ESTIMADAS . data HORAS_REA type ZBT_HORAS_REALES . data PRODUCTO type ZBT_ID_PRODUCTO . data REPORTER type ZBT_REPORTER . data RESUMEN type ZBT_RESUMEN . data TESTER type ZBT_TESTER . private section. *"* private components of class ZCL_BUG_PERSIST *"* do not include other source files here!!! ENDCLASS. CLASS ZCL_BUG_PERSIST IMPLEMENTATION. method GET_AEDAT. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute AEDAT * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = AEDAT. " GET_AEDAT endmethod. method GET_AENAM. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute AENAM * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = AENAM. " GET_AENAM endmethod. method GET_ASSIGNED. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute ASSIGNED * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = ASSIGNED. " GET_ASSIGNED endmethod. method GET_BUG. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute BUG * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = BUG. " GET_BUG endmethod. method GET_BUGSTYPE. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute BUGSTYPE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = BUGSTYPE. " GET_BUGSTYPE endmethod. method GET_BUGTYPE. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute BUGTYPE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = BUGTYPE. " GET_BUGTYPE endmethod. method GET_BUG_I. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute BUG_I * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = BUG_I. " GET_BUG_I endmethod. method GET_COMPONENTE. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute COMPONENTE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = COMPONENTE. " GET_COMPONENTE endmethod. method GET_CREADO. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute CREADO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = CREADO. " GET_CREADO endmethod. method GET_DEADLINE. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute DEADLINE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = DEADLINE. " GET_DEADLINE endmethod. method GET_DEVELOPER. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute DEVELOPER * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = DEVELOPER. " GET_DEVELOPER endmethod. method GET_ESTADO. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute ESTADO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = ESTADO. " GET_ESTADO endmethod. method GET_FINALIZADO. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute FINALIZADO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = FINALIZADO. " GET_FINALIZADO endmethod. method GET_HORAS_EST. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute HORAS_EST * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = HORAS_EST. " GET_HORAS_EST endmethod. method GET_HORAS_REA. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute HORAS_REA * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = HORAS_REA. " GET_HORAS_REA endmethod. method GET_PRODUCTO. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute PRODUCTO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = PRODUCTO. " GET_PRODUCTO endmethod. method GET_REPORTER. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute REPORTER * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = REPORTER. " GET_REPORTER endmethod. method GET_RESUMEN. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute RESUMEN * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = RESUMEN. " GET_RESUMEN endmethod. method GET_TESTER. ***BUILD 090501 " returning RESULT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Get Attribute TESTER * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, result is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions ************************************************************************ * * Inform class agent and handle exceptions state_read_access. result = TESTER. " GET_TESTER endmethod. method IF_OS_STATE~GET. ***BUILD 051401 " returning result type ref to object ************************************************************************ * Purpose : Get state. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * GENERATED: Do not modify ************************************************************************ data: STATE_OBJECT type ref to CL_OS_STATE. create object STATE_OBJECT. call method STATE_OBJECT->SET_STATE_FROM_OBJECT( ME ). result = STATE_OBJECT. endmethod. method IF_OS_STATE~HANDLE_EXCEPTION. ***BUILD 051401 " importing I_EXCEPTION type ref to IF_OS_EXCEPTION_INFO optional " importing I_EX_OS type ref to CX_OS_OBJECT_NOT_FOUND optional ************************************************************************ * Purpose : Handles exceptions during attribute access. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : If an exception is raised during attribut access, * this method is called and the exception is passed * as a paramater. The default is to raise the exception * again, so that the caller can handle the exception. * But it is also possible to handle the exception * here in the callee. * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 * - 2000-08-02 : (SB) OO Exceptions ************************************************************************ * Modify if you like ************************************************************************ if i_ex_os is not initial. raise exception i_ex_os. endif. endmethod. method IF_OS_STATE~INIT. ***BUILD 051401 ************************************************************************ * Purpose : Initialisation of the transient state partition. * * Version : 2.0 * * Precondition : - * * Postcondition : Transient state is initial. * * OO Exceptions : - * * Implementation : Caution!: Avoid Throwing ACCESS Events. * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * Modify if you like ************************************************************************ endmethod. method IF_OS_STATE~INVALIDATE. ***BUILD 051401 ************************************************************************ * Purpose : Do something before all persistent attributes are * cleared. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : - * * Implementation : Whatever you like to do. * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * Modify if you like ************************************************************************ endmethod. method IF_OS_STATE~SET. ***BUILD 051401 " importing I_STATE type ref to object ************************************************************************ * Purpose : Set state. * * Version : 2.0 * * Precondition : - * * Postcondition : - * * OO Exceptions : - * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-07 : (BGR) Initial Version 2.0 ************************************************************************ * GENERATED: Do not modify ************************************************************************ data: STATE_OBJECT type ref to CL_OS_STATE. STATE_OBJECT ?= I_STATE. call method STATE_OBJECT->SET_OBJECT_FROM_STATE( ME ). endmethod. method SET_AEDAT. ***BUILD 090501 " importing I_AEDAT " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute AEDAT * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_AEDAT <> AEDAT ). AEDAT = I_AEDAT. * * Inform class agent and handle exceptions state_changed. endif. "( I_AEDAT <> AEDAT ) " GET_AEDAT endmethod. method SET_AENAM. ***BUILD 090501 " importing I_AENAM " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute AENAM * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_AENAM <> AENAM ). AENAM = I_AENAM. * * Inform class agent and handle exceptions state_changed. endif. "( I_AENAM <> AENAM ) " GET_AENAM endmethod. method SET_ASSIGNED. ***BUILD 090501 " importing I_ASSIGNED " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute ASSIGNED * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_ASSIGNED <> ASSIGNED ). ASSIGNED = I_ASSIGNED. * * Inform class agent and handle exceptions state_changed. endif. "( I_ASSIGNED <> ASSIGNED ) " GET_ASSIGNED endmethod. method SET_BUGSTYPE. ***BUILD 090501 " importing I_BUGSTYPE " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute BUGSTYPE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_BUGSTYPE <> BUGSTYPE ). BUGSTYPE = I_BUGSTYPE. * * Inform class agent and handle exceptions state_changed. endif. "( I_BUGSTYPE <> BUGSTYPE ) " GET_BUGSTYPE endmethod. method SET_BUGTYPE. ***BUILD 090501 " importing I_BUGTYPE " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute BUGTYPE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_BUGTYPE <> BUGTYPE ). BUGTYPE = I_BUGTYPE. * * Inform class agent and handle exceptions state_changed. endif. "( I_BUGTYPE <> BUGTYPE ) " GET_BUGTYPE endmethod. method SET_BUG_I. ***BUILD 090501 " importing I_BUG_I " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute BUG_I * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_BUG_I <> BUG_I ). BUG_I = I_BUG_I. * * Inform class agent and handle exceptions state_changed. endif. "( I_BUG_I <> BUG_I ) " GET_BUG_I endmethod. method SET_COMPONENTE. ***BUILD 090501 " importing I_COMPONENTE " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute COMPONENTE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_COMPONENTE <> COMPONENTE ). COMPONENTE = I_COMPONENTE. * * Inform class agent and handle exceptions state_changed. endif. "( I_COMPONENTE <> COMPONENTE ) " GET_COMPONENTE endmethod. method SET_CREADO. ***BUILD 090501 " importing I_CREADO " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute CREADO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_CREADO <> CREADO ). CREADO = I_CREADO. * * Inform class agent and handle exceptions state_changed. endif. "( I_CREADO <> CREADO ) " GET_CREADO endmethod. method SET_DEADLINE. ***BUILD 090501 " importing I_DEADLINE " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute DEADLINE * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_DEADLINE <> DEADLINE ). DEADLINE = I_DEADLINE. * * Inform class agent and handle exceptions state_changed. endif. "( I_DEADLINE <> DEADLINE ) " GET_DEADLINE endmethod. method SET_DEVELOPER. ***BUILD 090501 " importing I_DEVELOPER " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute DEVELOPER * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_DEVELOPER <> DEVELOPER ). DEVELOPER = I_DEVELOPER. * * Inform class agent and handle exceptions state_changed. endif. "( I_DEVELOPER <> DEVELOPER ) " GET_DEVELOPER endmethod. method SET_ESTADO. ***BUILD 090501 " importing I_ESTADO " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute ESTADO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_ESTADO <> ESTADO ). ESTADO = I_ESTADO. * * Inform class agent and handle exceptions state_changed. endif. "( I_ESTADO <> ESTADO ) " GET_ESTADO endmethod. method SET_FINALIZADO. ***BUILD 090501 " importing I_FINALIZADO " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute FINALIZADO * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_FINALIZADO <> FINALIZADO ). FINALIZADO = I_FINALIZADO. * * Inform class agent and handle exceptions state_changed. endif. "( I_FINALIZADO <> FINALIZADO ) " GET_FINALIZADO endmethod. method SET_HORAS_EST. ***BUILD 090501 " importing I_HORAS_EST " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute HORAS_EST * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_HORAS_EST <> HORAS_EST ). HORAS_EST = I_HORAS_EST. * * Inform class agent and handle exceptions state_changed. endif. "( I_HORAS_EST <> HORAS_EST ) " GET_HORAS_EST endmethod. method SET_HORAS_REA. ***BUILD 090501 " importing I_HORAS_REA " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute HORAS_REA * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_HORAS_REA <> HORAS_REA ). HORAS_REA = I_HORAS_REA. * * Inform class agent and handle exceptions state_changed. endif. "( I_HORAS_REA <> HORAS_REA ) " GET_HORAS_REA endmethod. method SET_REPORTER. ***BUILD 090501 " importing I_REPORTER " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute REPORTER * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_REPORTER <> REPORTER ). REPORTER = I_REPORTER. * * Inform class agent and handle exceptions state_changed. endif. "( I_REPORTER <> REPORTER ) " GET_REPORTER endmethod. method SET_RESUMEN. ***BUILD 090501 " importing I_RESUMEN " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute RESUMEN * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_RESUMEN <> RESUMEN ). RESUMEN = I_RESUMEN. * * Inform class agent and handle exceptions state_changed. endif. "( I_RESUMEN <> RESUMEN ) " GET_RESUMEN endmethod. method SET_TESTER. ***BUILD 090501 " importing I_TESTER " raising CX_OS_OBJECT_NOT_FOUND ************************************************************************ * Purpose : Set attribute TESTER * * Version : 2.0 * * Precondition : - * * Postcondition : The object state is loaded, attribute is set * * OO Exceptions : CX_OS_OBJECT_NOT_FOUND * * Implementation : - * ************************************************************************ * Changelog: * - 2000-03-14 : (BGR) Version 2.0 * - 2000-07-28 : (SB) OO Exceptions * - 2000-10-04 : (SB) Namespaces ************************************************************************ * * Inform class agent and handle exceptions state_write_access. if ( I_TESTER <> TESTER ). TESTER = I_TESTER. * * Inform class agent and handle exceptions state_changed. endif. "( I_TESTER <> TESTER ) " GET_TESTER endmethod. ENDCLASS.
23.955582
72
0.509321
bde17c2fea52f9484731ae32e5c65a795ae3a0cc
4,912
abap
ABAP
src/zcl_adu_email.clas.abap
jrodriguez-rc/abap-dev-tools
6cbbd40e3739db038a878cdd1093dfe0cb9e406f
[ "MIT" ]
35
2020-08-27T10:36:55.000Z
2022-02-14T07:56:52.000Z
src/zcl_adu_email.clas.abap
jrodriguez-rc/abap-dev-tools
6cbbd40e3739db038a878cdd1093dfe0cb9e406f
[ "MIT" ]
2
2020-11-01T09:53:44.000Z
2022-02-10T08:10:53.000Z
src/zcl_adu_email.clas.abap
jrodriguez-rc/abap-dev-tools
6cbbd40e3739db038a878cdd1093dfe0cb9e406f
[ "MIT" ]
6
2020-11-03T08:29:47.000Z
2021-09-11T15:24:05.000Z
"! <p class="shorttext synchronized" lang="en">Email utilities</p> CLASS zcl_adu_email DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_adu_email. CLASS-METHODS get_instance RETURNING VALUE(result) TYPE REF TO zif_adu_email. PROTECTED SECTION. PRIVATE SECTION. METHODS send_email IMPORTING sender TYPE REF TO if_sender_bcs text TYPE soli_tab subject TYPE so_obj_des recipients TYPE bcsy_smtpa attachments TYPE zif_adu_email=>tt_attachment document_type TYPE so_obj_tp DEFAULT zif_adu_email=>document_type-raw commit_work TYPE abap_bool OPTIONAL RETURNING VALUE(result) TYPE abap_bool RAISING cx_send_req_bcs cx_address_bcs cx_document_bcs. METHODS send_from_user IMPORTING username TYPE uname DEFAULT sy-uname text TYPE soli_tab subject TYPE so_obj_des recipients TYPE bcsy_smtpa attachments TYPE zif_adu_email=>tt_attachment document_type TYPE so_obj_tp DEFAULT zif_adu_email=>document_type-raw commit_work TYPE abap_bool OPTIONAL RETURNING VALUE(result) TYPE abap_bool RAISING cx_send_req_bcs cx_address_bcs cx_document_bcs. ENDCLASS. CLASS zcl_adu_email IMPLEMENTATION. METHOD get_instance. result = NEW zcl_adu_email( ). ENDMETHOD. METHOD zif_adu_email~send_email. result = send_from_user( text = text subject = subject recipients = recipients attachments = attachments document_type = document_type commit_work = commit_work ). ENDMETHOD. METHOD zif_adu_email~send_from_user. result = send_from_user( username = username text = text subject = subject recipients = recipients attachments = attachments document_type = document_type commit_work = commit_work ). ENDMETHOD. METHOD zif_adu_email~send_from_smtp_address. result = send_email( sender = cl_cam_address_bcs=>create_internet_address( i_address_string = sender i_address_name = COND #( WHEN sender_name IS INITIAL THEN sender ELSE sender_name ) ) text = text subject = subject recipients = recipients attachments = attachments document_type = document_type commit_work = commit_work ). ENDMETHOD. METHOD zif_adu_email~xstring_to_attachment. result = VALUE zif_adu_email=>ts_attachment( type = type subject = subject size = COND #( WHEN size IS NOT INITIAL THEN size ELSE xstrlen( content ) ) content_hex = cl_document_bcs=>xstring_to_solix( content ) ). ENDMETHOD. METHOD send_from_user. result = send_email( sender = cl_sapuser_bcs=>create( sy-uname ) text = text subject = subject recipients = recipients attachments = attachments document_type = document_type commit_work = commit_work ). ENDMETHOD. METHOD send_email. DATA(lo_send_request) = cl_bcs=>create_persistent( ). lo_send_request->set_sender( sender ). LOOP AT recipients REFERENCE INTO DATA(lr_recipement). DATA(lo_recipient) = cl_cam_address_bcs=>create_internet_address( lr_recipement->* ). lo_send_request->add_recipient( i_recipient = lo_recipient i_express = abap_true ). ENDLOOP. DATA(lo_document) = cl_document_bcs=>create_document( i_type = document_type i_text = text i_subject = subject ). LOOP AT attachments REFERENCE INTO DATA(lr_attachment). lo_document->add_attachment( i_attachment_type = lr_attachment->type i_attachment_subject = lr_attachment->subject i_attachment_size = lr_attachment->size i_att_content_hex = lr_attachment->content_hex ). ENDLOOP. lo_send_request->set_document( lo_document ). result = lo_send_request->send( abap_true ). IF result = abap_true AND commit_work = abap_true. COMMIT WORK. ENDIF. ENDMETHOD. ENDCLASS.
28.068571
91
0.572679
bde33fa71746037551f745b86be3a2fd8606dc56
2,910
abap
ABAP
src/xml/ycl_abapgit_xml_input.clas.testclasses.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/xml/ycl_abapgit_xml_input.clas.testclasses.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
null
null
null
src/xml/ycl_abapgit_xml_input.clas.testclasses.abap
abapGit/y-version
2c3a7e7d0f5abb860e34f8eb44e0c2170a0ccdfc
[ "MIT" ]
2
2019-11-24T20:35:16.000Z
2020-04-16T07:29:33.000Z
CLASS ltcl_xml DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PUBLIC SECTION. METHODS: up FOR TESTING RAISING ycx_abapgit_exception, empty FOR TESTING RAISING ycx_abapgit_exception, down FOR TESTING RAISING ycx_abapgit_exception. TYPES: BEGIN OF st_old, foo TYPE i, bar TYPE c LENGTH 1, END OF st_old. TYPES: BEGIN OF st_new, foo TYPE i, bar TYPE c LENGTH 1, moo TYPE f, END OF st_new. ENDCLASS. CLASS ltcl_xml IMPLEMENTATION. METHOD empty. DATA: ls_old TYPE st_old, ls_new TYPE st_new, lv_xml TYPE string, lo_input TYPE REF TO ycl_abapgit_xml_input, lo_output TYPE REF TO ycl_abapgit_xml_output. CLEAR ls_old. CREATE OBJECT lo_output. lo_output->add( iv_name = 'DATA' ig_data = ls_old ). lv_xml = lo_output->render( ). CREATE OBJECT lo_input EXPORTING iv_xml = lv_xml. lo_input->read( EXPORTING iv_name = 'DATA' CHANGING cg_data = ls_new ). cl_abap_unit_assert=>assert_equals( act = ls_new-foo exp = ls_old-foo ). cl_abap_unit_assert=>assert_equals( act = ls_new-bar exp = ls_old-bar ). ENDMETHOD. METHOD up. DATA: ls_old TYPE st_old, ls_new TYPE st_new, lv_xml TYPE string, lo_input TYPE REF TO ycl_abapgit_xml_input, lo_output TYPE REF TO ycl_abapgit_xml_output. ls_old-foo = 2. ls_old-bar = 'A'. CREATE OBJECT lo_output. lo_output->add( iv_name = 'DATA' ig_data = ls_old ). lv_xml = lo_output->render( ). CREATE OBJECT lo_input EXPORTING iv_xml = lv_xml. lo_input->read( EXPORTING iv_name = 'DATA' CHANGING cg_data = ls_new ). cl_abap_unit_assert=>assert_equals( act = ls_new-foo exp = ls_old-foo ). cl_abap_unit_assert=>assert_equals( act = ls_new-bar exp = ls_old-bar ). ENDMETHOD. METHOD down. DATA: ls_old TYPE st_old, ls_new TYPE st_new, lv_xml TYPE string, lo_input TYPE REF TO ycl_abapgit_xml_input, lo_output TYPE REF TO ycl_abapgit_xml_output. ls_new-foo = 2. ls_new-bar = 'A'. ls_new-moo = 5. CREATE OBJECT lo_output. lo_output->add( iv_name = 'DATA' ig_data = ls_new ). lv_xml = lo_output->render( ). CREATE OBJECT lo_input EXPORTING iv_xml = lv_xml. lo_input->read( EXPORTING iv_name = 'DATA' CHANGING cg_data = ls_old ). cl_abap_unit_assert=>assert_equals( act = ls_old-foo exp = ls_new-foo ). cl_abap_unit_assert=>assert_equals( act = ls_old-bar exp = ls_new-bar ). ENDMETHOD. ENDCLASS.
22.734375
73
0.591753
bde7cd698de001475073347b903fd4b2118d10a7
15,213
abap
ABAP
src/zabapgit_object_tran.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
src/zabapgit_object_tran.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
src/zabapgit_object_tran.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Include ZABAPGIT_OBJECT_TRAN *&---------------------------------------------------------------------* *----------------------------------------------------------------------* * CLASS lcl_object_tran DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_object_tran DEFINITION INHERITING FROM lcl_objects_super FINAL. PUBLIC SECTION. INTERFACES lif_object. ALIASES mo_files FOR lif_object~mo_files. PRIVATE SECTION. CONSTANTS: c_oo_program(9) VALUE '\PROGRAM=', c_oo_class(7) VALUE '\CLASS=', c_oo_method(8) VALUE '\METHOD=', c_oo_tcode TYPE tcode VALUE 'OS_APPLICATION', c_oo_frclass(30) VALUE 'CLASS', c_oo_frmethod(30) VALUE 'METHOD', c_oo_frupdtask(30) VALUE 'UPDATE_MODE', c_oo_synchron VALUE 'S', c_oo_asynchron VALUE 'U', c_true TYPE c VALUE 'X', c_false TYPE c VALUE space. METHODS: split_parameters CHANGING ct_rsparam TYPE s_param cs_rsstcd TYPE rsstcd cs_tstcp TYPE tstcp cs_tstc TYPE tstc, split_parameters_comp IMPORTING iv_type TYPE any iv_param TYPE any CHANGING cg_value TYPE any, serialize_texts IMPORTING io_xml TYPE REF TO lcl_xml_output RAISING lcx_exception, deserialize_texts IMPORTING io_xml TYPE REF TO lcl_xml_input RAISING lcx_exception. ENDCLASS. "lcl_object_TRAN DEFINITION *----------------------------------------------------------------------* * CLASS lcl_object_msag IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_object_tran IMPLEMENTATION. METHOD lif_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. "lif_object~has_changed_since METHOD lif_object~changed_by. rv_user = c_user_unknown. " todo ENDMETHOD. METHOD lif_object~get_metadata. rs_metadata = get_metadata( ). ENDMETHOD. "lif_object~get_metadata METHOD split_parameters_comp. DATA: lv_off TYPE i. IF iv_param CS iv_type. lv_off = sy-fdpos + strlen( iv_type ). cg_value = iv_param+lv_off. IF cg_value CA '\'. CLEAR cg_value+sy-fdpos. ENDIF. ENDIF. ENDMETHOD. "split_parameters_comp METHOD split_parameters. * see subroutine split_parameters in include LSEUKF01 DATA: lv_off TYPE i, lv_param_beg TYPE i, lv_length TYPE i, ls_param LIKE LINE OF ct_rsparam. FIELD-SYMBOLS <lg_f> TYPE any. CLEAR cs_rsstcd-s_vari. IF cs_tstcp-param(1) = '\'. " OO-Transaktion ohne FR split_parameters_comp( EXPORTING iv_type = c_oo_program iv_param = cs_tstcp-param CHANGING cg_value = cs_tstc-pgmna ). split_parameters_comp( EXPORTING iv_type = c_oo_class iv_param = cs_tstcp-param CHANGING cg_value = cs_rsstcd-classname ). split_parameters_comp( EXPORTING iv_type = c_oo_method iv_param = cs_tstcp-param CHANGING cg_value = cs_rsstcd-method ). IF NOT cs_tstc-pgmna IS INITIAL. cs_rsstcd-s_local = c_true. ENDIF. RETURN. ELSEIF cs_tstcp-param(1) = '@'. " Transaktionsvariante cs_rsstcd-s_vari = c_true. IF cs_tstcp-param(2) = '@@'. cs_rsstcd-s_ind_vari = c_true. lv_off = 2. ELSE. CLEAR cs_rsstcd-s_ind_vari. lv_off = 1. ENDIF. sy-fdpos = sy-fdpos - lv_off. IF sy-fdpos > 0. cs_rsstcd-call_tcode = cs_tstcp-param+lv_off(sy-fdpos). sy-fdpos = sy-fdpos + 1 + lv_off. cs_rsstcd-variant = cs_tstcp-param+sy-fdpos. ENDIF. ELSEIF cs_tstcp-param(1) = '/'. cs_rsstcd-st_tcode = c_true. cs_rsstcd-st_prog = space. IF cs_tstcp-param+1(1) = '*'. cs_rsstcd-st_skip_1 = c_true. ELSE. CLEAR cs_rsstcd-st_skip_1. ENDIF. lv_param_beg = sy-fdpos + 1. sy-fdpos = sy-fdpos - 2. IF sy-fdpos > 0. cs_rsstcd-call_tcode = cs_tstcp-param+2(sy-fdpos). ENDIF. SHIFT cs_tstcp-param BY lv_param_beg PLACES. ELSE. cs_rsstcd-st_tcode = space. cs_rsstcd-st_prog = c_true. ENDIF. DO 254 TIMES. IF cs_tstcp-param = space. EXIT. ENDIF. CLEAR ls_param. IF cs_tstcp-param CA '='. CHECK sy-fdpos <> 0. ASSIGN cs_tstcp-param(sy-fdpos) TO <lg_f>. ls_param-field = <lg_f>. IF ls_param-field(1) = space. SHIFT ls_param-field. ENDIF. sy-fdpos = sy-fdpos + 1. SHIFT cs_tstcp-param BY sy-fdpos PLACES. IF cs_tstcp-param CA ';'. IF sy-fdpos <> 0. ASSIGN cs_tstcp-param(sy-fdpos) TO <lg_f>. ls_param-value = <lg_f>. IF ls_param-value(1) = space. SHIFT ls_param-value. ENDIF. ENDIF. sy-fdpos = sy-fdpos + 1. SHIFT cs_tstcp-param BY sy-fdpos PLACES. APPEND ls_param TO ct_rsparam. ELSE. lv_length = strlen( cs_tstcp-param ). CHECK lv_length > 0. ASSIGN cs_tstcp-param(lv_length) TO <lg_f>. ls_param-value = <lg_f>. IF ls_param-value(1) = space. SHIFT ls_param-value. ENDIF. lv_length = lv_length + 1. SHIFT cs_tstcp-param BY lv_length PLACES. APPEND ls_param TO ct_rsparam. ENDIF. ENDIF. ENDDO. * oo-Transaktion mit Framework IF cs_rsstcd-call_tcode = c_oo_tcode. cs_rsstcd-s_trframe = c_true. LOOP AT ct_rsparam INTO ls_param. CASE ls_param-field. WHEN c_oo_frclass. cs_rsstcd-classname = ls_param-value. WHEN c_oo_frmethod. cs_rsstcd-method = ls_param-value. WHEN c_oo_frupdtask. IF ls_param-value = c_oo_synchron. cs_rsstcd-s_upddir = c_true. cs_rsstcd-s_updtask = c_false. cs_rsstcd-s_updlok = c_false. ELSEIF ls_param-value = c_oo_asynchron. cs_rsstcd-s_upddir = c_false. cs_rsstcd-s_updtask = c_true. cs_rsstcd-s_updlok = c_false. ELSE. cs_rsstcd-s_upddir = c_false. cs_rsstcd-s_updtask = c_false. cs_rsstcd-s_updlok = c_true. ENDIF. ENDCASE. ENDLOOP. ENDIF. ENDMETHOD. "split_parameters METHOD lif_object~exists. DATA: lv_tcode TYPE tstc-tcode. SELECT SINGLE tcode FROM tstc INTO lv_tcode WHERE tcode = ms_item-obj_name. "#EC CI_GENBUFF rv_bool = boolc( sy-subrc = 0 ). ENDMETHOD. "lif_object~exists METHOD lif_object~jump. DATA: lt_bdcdata TYPE TABLE OF bdcdata. FIELD-SYMBOLS: <ls_bdcdata> LIKE LINE OF lt_bdcdata. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-program = 'SAPLSEUK'. <ls_bdcdata>-dynpro = '0390'. <ls_bdcdata>-dynbegin = abap_true. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'BDC_OKCODE'. <ls_bdcdata>-fval = '=SHOW'. APPEND INITIAL LINE TO lt_bdcdata ASSIGNING <ls_bdcdata>. <ls_bdcdata>-fnam = 'TSTC-TCODE'. <ls_bdcdata>-fval = ms_item-obj_name. CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'GIT' EXPORTING tcode = 'SE93' mode_val = 'E' TABLES using_tab = lt_bdcdata EXCEPTIONS system_failure = 1 communication_failure = 2 resource_failure = 3 OTHERS = 4 ##fm_subrc_ok. "#EC CI_SUBRC ENDMETHOD. "jump METHOD lif_object~delete. DATA: lv_transaction TYPE tstc-tcode. lv_transaction = ms_item-obj_name. CALL FUNCTION 'RPY_TRANSACTION_DELETE' EXPORTING transaction = lv_transaction EXCEPTIONS not_excecuted = 1 object_not_found = 2 OTHERS = 3. IF sy-subrc <> 0. lcx_exception=>raise( 'Error from RPY_TRANSACTION_DELETE' ). ENDIF. ENDMETHOD. "delete METHOD lif_object~deserialize. CONSTANTS: lc_hex_tra TYPE x VALUE '00', * c_hex_men TYPE x VALUE '01', lc_hex_par TYPE x VALUE '02', lc_hex_rep TYPE x VALUE '80'. * c_hex_rpv TYPE x VALUE '10', * c_hex_obj TYPE x VALUE '08', * c_hex_chk TYPE x VALUE '04', * c_hex_enq TYPE x VALUE '20'. DATA: lv_dynpro TYPE d020s-dnum, ls_tstc TYPE tstc, lv_type TYPE rglif-docutype, ls_tstct TYPE tstct, ls_tstcc TYPE tstcc, ls_tstcp TYPE tstcp, lt_param_values TYPE TABLE OF rsparam, ls_rsstcd TYPE rsstcd. IF lif_object~exists( ) = abap_true. lif_object~delete( ). ENDIF. io_xml->read( EXPORTING iv_name = 'TSTC' CHANGING cg_data = ls_tstc ). io_xml->read( EXPORTING iv_name = 'TSTCC' CHANGING cg_data = ls_tstcc ). io_xml->read( EXPORTING iv_name = 'TSTCT' CHANGING cg_data = ls_tstct ). io_xml->read( EXPORTING iv_name = 'TSTCP' CHANGING cg_data = ls_tstcp ). lv_dynpro = ls_tstc-dypno. CASE ls_tstc-cinfo. WHEN lc_hex_tra. lv_type = ststc_c_type_dialog. WHEN lc_hex_rep. lv_type = ststc_c_type_report. WHEN lc_hex_par. lv_type = ststc_c_type_parameters. * todo, or ststc_c_type_variant? WHEN OTHERS. lcx_exception=>raise( 'Transaction, unknown CINFO' ). ENDCASE. IF ls_tstcp IS NOT INITIAL. split_parameters( CHANGING ct_rsparam = lt_param_values cs_rsstcd = ls_rsstcd cs_tstcp = ls_tstcp cs_tstc = ls_tstc ). ENDIF. CALL FUNCTION 'RPY_TRANSACTION_INSERT' EXPORTING transaction = ls_tstc-tcode program = ls_tstc-pgmna dynpro = lv_dynpro language = mv_language development_class = iv_package transaction_type = lv_type shorttext = ls_tstct-ttext called_transaction = ls_rsstcd-call_tcode called_transaction_skip = ls_rsstcd-st_skip_1 variant = ls_rsstcd-variant cl_independend = ls_rsstcd-s_ind_vari html_enabled = ls_tstcc-s_webgui java_enabled = ls_tstcc-s_platin wingui_enabled = ls_tstcc-s_win32 TABLES param_values = lt_param_values EXCEPTIONS cancelled = 1 already_exist = 2 permission_error = 3 name_not_allowed = 4 name_conflict = 5 illegal_type = 6 object_inconsistent = 7 db_access_error = 8 OTHERS = 9. IF sy-subrc <> 0. lcx_exception=>raise( 'Error from RPY_TRANSACTION_INSERT' ). ENDIF. " Texts deserializing (translations) deserialize_texts( io_xml ). ENDMETHOD. "deserialize METHOD lif_object~serialize. DATA: lv_transaction TYPE tstc-tcode, lt_tcodes TYPE TABLE OF tstc, ls_tcode LIKE LINE OF lt_tcodes, ls_tstct TYPE tstct, ls_tstcp TYPE tstcp, lt_gui_attr TYPE TABLE OF tstcc, ls_gui_attr LIKE LINE OF lt_gui_attr. lv_transaction = ms_item-obj_name. CALL FUNCTION 'RPY_TRANSACTION_READ' EXPORTING transaction = lv_transaction TABLES tcodes = lt_tcodes gui_attributes = lt_gui_attr EXCEPTIONS permission_error = 1 cancelled = 2 not_found = 3 object_not_found = 4 OTHERS = 5. IF sy-subrc = 4 OR sy-subrc = 3. RETURN. ELSEIF sy-subrc <> 0. lcx_exception=>raise( 'Error from RPY_TRANSACTION_READ' ). ENDIF. SELECT SINGLE * FROM tstct INTO ls_tstct WHERE sprsl = mv_language AND tcode = lv_transaction. "#EC CI_SUBRC "#EC CI_GENBUFF SELECT SINGLE * FROM tstcp INTO ls_tstcp WHERE tcode = lv_transaction. "#EC CI_SUBRC "#EC CI_GENBUFF READ TABLE lt_tcodes INDEX 1 INTO ls_tcode. ASSERT sy-subrc = 0. READ TABLE lt_gui_attr INDEX 1 INTO ls_gui_attr. ASSERT sy-subrc = 0. io_xml->add( iv_name = 'TSTC' ig_data = ls_tcode ). io_xml->add( iv_name = 'TSTCC' ig_data = ls_gui_attr ). io_xml->add( iv_name = 'TSTCT' ig_data = ls_tstct ). IF ls_tstcp IS NOT INITIAL. io_xml->add( iv_name = 'TSTCP' ig_data = ls_tstcp ). ENDIF. " Texts serializing (translations) serialize_texts( io_xml ). ENDMETHOD. "serialize METHOD lif_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result. ENDMETHOD. METHOD serialize_texts. DATA lt_tpool_i18n TYPE TABLE OF tstct. " Skip master language - it was already serialized " Don't serialize t-code itself SELECT sprsl ttext INTO CORRESPONDING FIELDS OF TABLE lt_tpool_i18n FROM tstct WHERE sprsl <> mv_language AND tcode = ms_item-obj_name. IF lines( lt_tpool_i18n ) > 0. SORT lt_tpool_i18n BY sprsl ASCENDING. io_xml->add( iv_name = 'I18N_TPOOL' ig_data = lt_tpool_i18n ). ENDIF. ENDMETHOD. "serialize_texts METHOD deserialize_texts. DATA lt_tpool_i18n TYPE TABLE OF tstct. FIELD-SYMBOLS <tpool> LIKE LINE OF lt_tpool_i18n. " Read XML-files data io_xml->read( EXPORTING iv_name = 'I18N_TPOOL' CHANGING cg_data = lt_tpool_i18n ). " Force t-code name (security reasons) LOOP AT lt_tpool_i18n ASSIGNING <tpool>. <tpool>-tcode = ms_item-obj_name. ENDLOOP. IF lines( lt_tpool_i18n ) > 0. MODIFY tstct FROM TABLE lt_tpool_i18n. IF sy-subrc <> 0. lcx_exception=>raise( 'Update of t-code translations failed' ). ENDIF. ENDIF. ENDMETHOD. "deserialize_texts ENDCLASS. "lcl_object_tran IMPLEMENTATION
31.69375
73
0.556498
bdef3d75b4c0c84e893fc4c7074e5002f455a6bc
636
abap
ABAP
objects/CLAS/ZCL_ZGWSO_MPC/METH DEFINE.abap
abhilashhaa/HCL_Githup
454be7f157c72fbb75550dea67c9167e405a4fdb
[ "Apache-2.0" ]
null
null
null
objects/CLAS/ZCL_ZGWSO_MPC/METH DEFINE.abap
abhilashhaa/HCL_Githup
454be7f157c72fbb75550dea67c9167e405a4fdb
[ "Apache-2.0" ]
null
null
null
objects/CLAS/ZCL_ZGWSO_MPC/METH DEFINE.abap
abhilashhaa/HCL_Githup
454be7f157c72fbb75550dea67c9167e405a4fdb
[ "Apache-2.0" ]
null
null
null
method DEFINE. *&---------------------------------------------------------------------* *& Generated code for the MODEL PROVIDER BASE CLASS &* *& &* *& !!!NEVER MODIFY THIS CLASS. IN CASE YOU WANT TO CHANGE THE MODEL &* *& DO THIS IN THE MODEL PROVIDER SUBCLASS!!! &* *& &* *&---------------------------------------------------------------------* model->set_schema_namespace( 'ZGWSO_SRV' ). define_salesorder( ). define_salesorderitem( ). endmethod.
45.428571
73
0.33805
bdf5ca011457dcc955b2d9646db0c92894cb3d5c
1,202
abap
ABAP
yea_unit_test_server.clas.abap
gregorwolf/express.abap
0452ace555304cec6bcb6ce28782291c3a231351
[ "MIT" ]
22
2017-06-10T06:13:33.000Z
2021-11-05T00:52:23.000Z
yea_unit_test_server.clas.abap
gregorwolf/express.abap
0452ace555304cec6bcb6ce28782291c3a231351
[ "MIT" ]
null
null
null
yea_unit_test_server.clas.abap
gregorwolf/express.abap
0452ace555304cec6bcb6ce28782291c3a231351
[ "MIT" ]
6
2018-09-14T12:50:26.000Z
2020-07-31T09:58:57.000Z
class YEA_UNIT_TEST_SERVER definition public final create public . public section. interfaces IF_HTTP_SERVER . aliases REQUEST for IF_HTTP_SERVER~REQUEST . aliases RESPONSE for IF_HTTP_SERVER~RESPONSE . methods CONSTRUCTOR . methods METHOD importing !METHOD type STRING returning value(RETURNING) type ref to YEA_UNIT_TEST_SERVER . methods PATH importing !PATH type STRING returning value(RETURNING) type ref to YEA_UNIT_TEST_SERVER . methods BODY importing !BODY type STRING returning value(RETURNING) type ref to YEA_UNIT_TEST_SERVER . protected section. private section. ENDCLASS. CLASS YEA_UNIT_TEST_SERVER IMPLEMENTATION. method BODY. request->set_cdata( body ). returning = me. endmethod. method constructor. me->if_http_server~request = new yea_unit_test_request( ). me->if_http_server~response = new yea_unit_test_response( ). endmethod. method METHOD. me->request->set_method( method ). returning = me. endmethod. method PATH. me->request->set_header_field( name = '~path' value = path ). returning = me. endmethod. ENDCLASS.
18.212121
64
0.698003
bdfec9eeb22a126121dd3c690aa41295ef7db8ac
614
abap
ABAP
src/z4_00_core_objects/z4_002_abap/z4_002_exception_examples/zcx_4_user_cancelled.clas.abap
cjbungay/ABAPToTheFuture04
756c6defa586cf88a39832605a1dab6ea540a01e
[ "MIT" ]
8
2021-02-10T13:09:54.000Z
2022-03-08T04:51:39.000Z
src/z4_00_core_objects/z4_002_abap/z4_002_exception_examples/zcx_4_user_cancelled.clas.abap
cjbungay/ABAPToTheFuture04
756c6defa586cf88a39832605a1dab6ea540a01e
[ "MIT" ]
6
2021-11-17T05:12:45.000Z
2021-12-07T08:11:46.000Z
src/z4_00_core_objects/z4_002_abap/z4_002_exception_examples/zcx_4_user_cancelled.clas.abap
cjbungay/ABAPToTheFuture04
756c6defa586cf88a39832605a1dab6ea540a01e
[ "MIT" ]
4
2021-07-23T09:53:21.000Z
2022-01-12T23:15:22.000Z
class ZCX_4_USER_CANCELLED definition public inheriting from CX_NO_CHECK create public . public section. constants ZCX_4_USER_CANCELLED type SOTR_CONC value '005056B074C91EDB9EFCBC7E1C59812A' ##NO_TEXT. methods CONSTRUCTOR importing !TEXTID like TEXTID optional !PREVIOUS like PREVIOUS optional . protected section. private section. ENDCLASS. CLASS ZCX_4_USER_CANCELLED IMPLEMENTATION. method CONSTRUCTOR. CALL METHOD SUPER->CONSTRUCTOR EXPORTING TEXTID = TEXTID PREVIOUS = PREVIOUS . IF textid IS INITIAL. me->textid = ZCX_4_USER_CANCELLED . ENDIF. endmethod. ENDCLASS.
18.058824
99
0.781759
da00af5b15731464075ea38be5774d7002ccbe84
32,762
abap
ABAP
src/zcl_ibmc_assistant_v2.clas.abap
khajafareed/Test01
930aee008c984b2d55b4375646c8f459d653eb3c
[ "Apache-2.0" ]
null
null
null
src/zcl_ibmc_assistant_v2.clas.abap
khajafareed/Test01
930aee008c984b2d55b4375646c8f459d653eb3c
[ "Apache-2.0" ]
null
null
null
src/zcl_ibmc_assistant_v2.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>Watson Assistant v2</h1> "! The IBM Watson&trade; Assistant service combines machine learning, natural "! language understanding, and an integrated dialog editor to create conversation "! flows between your apps and your users. "! "! The Assistant v2 API provides runtime methods your client application can use to "! send user input to an assistant and receive a response. <br/> class ZCL_IBMC_ASSISTANT_V2 DEFINITION public inheriting from ZCL_IBMC_SERVICE_EXT create public . public section. types: "! Dialog log message details. begin of T_DIALOG_LOG_MESSAGE, LEVEL type STRING, MESSAGE type STRING, end of T_DIALOG_LOG_MESSAGE. types: "! begin of T_DIALOG_NODES_VISITED, DIALOG_NODE type STRING, TITLE type STRING, CONDITIONS type STRING, end of T_DIALOG_NODES_VISITED. types: "! Additional detailed information about a message response and how it was "! generated. begin of T_MESSAGE_OUTPUT_DEBUG, NODES_VISITED type STANDARD TABLE OF T_DIALOG_NODES_VISITED WITH NON-UNIQUE DEFAULT KEY, LOG_MESSAGES type STANDARD TABLE OF T_DIALOG_LOG_MESSAGE WITH NON-UNIQUE DEFAULT KEY, BRANCH_EXITED type BOOLEAN, BRANCH_EXITED_REASON type STRING, end of T_MESSAGE_OUTPUT_DEBUG. types: "! T_EMPTY_RESPONSE type JSONOBJECT. types: "! begin of T_SESSION_RESPONSE, SESSION_ID type STRING, end of T_SESSION_RESPONSE. types: "! begin of T_RT_ENTTY_INTRPRTTN_SYS_NUM, NUMERIC_VALUE type NUMBER, RANGE_LINK type STRING, SUBTYPE type STRING, end of T_RT_ENTTY_INTRPRTTN_SYS_NUM. types: "! An alternative value for the recognized entity. begin of T_RUNTIME_ENTITY_ALTERNATIVE, VALUE type STRING, CONFIDENCE type NUMBER, end of T_RUNTIME_ENTITY_ALTERNATIVE. types: "! Optional properties that control how the assistant responds. begin of T_MESSAGE_INPUT_OPTIONS, DEBUG type BOOLEAN, RESTART type BOOLEAN, ALTERNATE_INTENTS type BOOLEAN, RETURN_CONTEXT type BOOLEAN, end of T_MESSAGE_INPUT_OPTIONS. types: "! An intent identified in the user input. begin of T_RUNTIME_INTENT, INTENT type STRING, CONFIDENCE type DOUBLE, end of T_RUNTIME_INTENT. types: "! begin of T_CAPTURE_GROUP, GROUP type STRING, LOCATION type STANDARD TABLE OF INTEGER WITH NON-UNIQUE DEFAULT KEY, end of T_CAPTURE_GROUP. types: "! The entity value that was recognized in the user input. begin of T_RUNTIME_ENTITY, ENTITY type STRING, LOCATION type STANDARD TABLE OF INTEGER WITH NON-UNIQUE DEFAULT KEY, VALUE type STRING, CONFIDENCE type NUMBER, METADATA type MAP, GROUPS type STANDARD TABLE OF T_CAPTURE_GROUP WITH NON-UNIQUE DEFAULT KEY, end of T_RUNTIME_ENTITY. types: "! An input object that includes the input text. begin of T_MESSAGE_INPUT, MESSAGE_TYPE type STRING, TEXT type STRING, OPTIONS type T_MESSAGE_INPUT_OPTIONS, INTENTS type STANDARD TABLE OF T_RUNTIME_INTENT WITH NON-UNIQUE DEFAULT KEY, ENTITIES type STANDARD TABLE OF T_RUNTIME_ENTITY WITH NON-UNIQUE DEFAULT KEY, SUGGESTION_ID type STRING, end of T_MESSAGE_INPUT. types: "! An object defining the message input to be sent to the assistant if the user "! selects the corresponding option. begin of T_DIA_ND_OUTPUT_OPT_ELEM_VALUE, INPUT type T_MESSAGE_INPUT, end of T_DIA_ND_OUTPUT_OPT_ELEM_VALUE. types: "! begin of T_DIA_NODE_OUTPUT_OPT_ELEMENT, LABEL type STRING, VALUE type T_DIA_ND_OUTPUT_OPT_ELEM_VALUE, end of T_DIA_NODE_OUTPUT_OPT_ELEMENT. types: "! begin of T_RUNTIME_RESPONSE_TYPE_OPTION, TITLE type STRING, DESCRIPTION type STRING, PREFERENCE type STRING, OPTIONS type STANDARD TABLE OF T_DIA_NODE_OUTPUT_OPT_ELEMENT WITH NON-UNIQUE DEFAULT KEY, end of T_RUNTIME_RESPONSE_TYPE_OPTION. types: "! begin of T_RT_ENTTY_INTRPRTTN_SYS_DATE, CALENDAR_TYPE type STRING, DATETIME_LINK type STRING, FESTIVAL type STRING, GRANULARITY type STRING, RANGE_LINK type STRING, RANGE_MODIFIER type STRING, RELATIVE_DAY type NUMBER, RELATIVE_MONTH type NUMBER, RELATIVE_WEEK type NUMBER, RELATIVE_WEEKEND type NUMBER, RELATIVE_YEAR type NUMBER, SPECIFIC_DAY type NUMBER, SPECIFIC_DAY_OF_WEEK type STRING, SPECIFIC_MONTH type NUMBER, SPECIFIC_QUARTER type NUMBER, SPECIFIC_YEAR type NUMBER, end of T_RT_ENTTY_INTRPRTTN_SYS_DATE. types: "! An object containing segments of text from search results with query-matching "! text highlighted using HTML <em> tags. begin of T_SEARCH_RESULT_HIGHLIGHT, BODY type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, TITLE type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, URL type STANDARD TABLE OF STRING WITH NON-UNIQUE DEFAULT KEY, end of T_SEARCH_RESULT_HIGHLIGHT. types: "! An object defining the message input to be sent to the assistant if the user "! selects the corresponding disambiguation option. begin of T_DIALOG_SUGGESTION_VALUE, INPUT type T_MESSAGE_INPUT, end of T_DIALOG_SUGGESTION_VALUE. types: "! An object containing search result metadata from the Discovery service. begin of T_SEARCH_RESULT_METADATA, CONFIDENCE type DOUBLE, SCORE type DOUBLE, end of T_SEARCH_RESULT_METADATA. types: "! begin of T_SEARCH_RESULT, ID type STRING, RESULT_METADATA type T_SEARCH_RESULT_METADATA, BODY type STRING, TITLE type STRING, URL type STRING, HIGHLIGHT type T_SEARCH_RESULT_HIGHLIGHT, end of T_SEARCH_RESULT. types: "! begin of T_DIALOG_SUGGESTION, LABEL type STRING, VALUE type T_DIALOG_SUGGESTION_VALUE, OUTPUT type MAP, end of T_DIALOG_SUGGESTION. types: "! begin of T_RUNTIME_RESPONSE_GENERIC, RESPONSE_TYPE type STRING, TEXT type STRING, TIME type INTEGER, TYPING type BOOLEAN, SOURCE type STRING, TITLE type STRING, DESCRIPTION type STRING, PREFERENCE type STRING, OPTIONS type STANDARD TABLE OF T_DIA_NODE_OUTPUT_OPT_ELEMENT WITH NON-UNIQUE DEFAULT KEY, MESSAGE_TO_HUMAN_AGENT type STRING, TOPIC type STRING, SUGGESTIONS type STANDARD TABLE OF T_DIALOG_SUGGESTION WITH NON-UNIQUE DEFAULT KEY, HEADER type STRING, RESULTS type STANDARD TABLE OF T_SEARCH_RESULT WITH NON-UNIQUE DEFAULT KEY, end of T_RUNTIME_RESPONSE_GENERIC. types: "! An object describing the role played by a system entity that is specifies the "! beginning or end of a range recognized in the user input. "! "! This property is part of the new system entities, which are a beta feature. begin of T_RUNTIME_ENTITY_ROLE, TYPE type STRING, end of T_RUNTIME_ENTITY_ROLE. types: "! begin of T_ERROR_DETAIL, MESSAGE type STRING, PATH type STRING, end of T_ERROR_DETAIL. types: "! begin of T_ERROR_RESPONSE, ERROR type STRING, ERRORS type STANDARD TABLE OF T_ERROR_DETAIL WITH NON-UNIQUE DEFAULT KEY, CODE type INTEGER, end of T_ERROR_RESPONSE. types: "! begin of T_RT_ENTITY_INTERPRETATION, CALENDAR_TYPE type STRING, DATETIME_LINK type STRING, FESTIVAL type STRING, GRANULARITY type STRING, RANGE_LINK type STRING, RANGE_MODIFIER type STRING, RELATIVE_DAY type NUMBER, RELATIVE_MONTH type NUMBER, RELATIVE_WEEK type NUMBER, RELATIVE_WEEKEND type NUMBER, RELATIVE_YEAR type NUMBER, SPECIFIC_DAY type NUMBER, SPECIFIC_DAY_OF_WEEK type STRING, SPECIFIC_MONTH type NUMBER, SPECIFIC_QUARTER type NUMBER, SPECIFIC_YEAR type NUMBER, NUMERIC_VALUE type NUMBER, SUBTYPE type STRING, PART_OF_DAY type STRING, RELATIVE_HOUR type NUMBER, RELATIVE_MINUTE type NUMBER, RELATIVE_SECOND type NUMBER, SPECIFIC_HOUR type NUMBER, SPECIFIC_MINUTE type NUMBER, SPECIFIC_SECOND type NUMBER, TIMEZONE type STRING, end of T_RT_ENTITY_INTERPRETATION. types: "! begin of T_RUNTIME_RESPONSE_TYPE_IMAGE, SOURCE type STRING, TITLE type STRING, DESCRIPTION type STRING, end of T_RUNTIME_RESPONSE_TYPE_IMAGE. types: "! begin of T_DIALOG_NODE_ACTION, NAME type STRING, TYPE type STRING, PARAMETERS type MAP, RESULT_VARIABLE type STRING, CREDENTIALS type STRING, end of T_DIALOG_NODE_ACTION. types: "! Built-in system properties that apply to all skills used by the assistant. begin of T_MSSG_CONTEXT_GLOBAL_SYSTEM, TIMEZONE type STRING, USER_ID type STRING, TURN_COUNT type INTEGER, end of T_MSSG_CONTEXT_GLOBAL_SYSTEM. types: "! Information that is shared by all skills used by the Assistant. begin of T_MESSAGE_CONTEXT_GLOBAL, SYSTEM type T_MSSG_CONTEXT_GLOBAL_SYSTEM, end of T_MESSAGE_CONTEXT_GLOBAL. types: "! Information specific to particular skills used by the Assistant. "! "! **Note:** Currently, only a single property named `main skill` is supported. "! This object contains variables that apply to the dialog skill used by the "! assistant. T_MESSAGE_CONTEXT_SKILLS type MAP. types: "! begin of T_MESSAGE_CONTEXT, GLOBAL type T_MESSAGE_CONTEXT_GLOBAL, SKILLS type T_MESSAGE_CONTEXT_SKILLS, end of T_MESSAGE_CONTEXT. types: "! Assistant output to be rendered or processed by the client. begin of T_MESSAGE_OUTPUT, GENERIC type STANDARD TABLE OF T_RUNTIME_RESPONSE_GENERIC WITH NON-UNIQUE DEFAULT KEY, INTENTS type STANDARD TABLE OF T_RUNTIME_INTENT WITH NON-UNIQUE DEFAULT KEY, ENTITIES type STANDARD TABLE OF T_RUNTIME_ENTITY WITH NON-UNIQUE DEFAULT KEY, ACTIONS type STANDARD TABLE OF T_DIALOG_NODE_ACTION WITH NON-UNIQUE DEFAULT KEY, DEBUG type T_MESSAGE_OUTPUT_DEBUG, USER_DEFINED type MAP, end of T_MESSAGE_OUTPUT. types: "! A response from the Watson Assistant service. begin of T_MESSAGE_RESPONSE, OUTPUT type T_MESSAGE_OUTPUT, CONTEXT type T_MESSAGE_CONTEXT, end of T_MESSAGE_RESPONSE. types: "! begin of T_RUNTIME_RESPONSE_TYPE_TEXT, TEXT type STRING, end of T_RUNTIME_RESPONSE_TYPE_TEXT. types: "! begin of T_RT_ENTTY_INTRPRTTN_SYS_TIME, DATETIME_LINK type STRING, GRANULARITY type STRING, PART_OF_DAY type STRING, RANGE_LINK type STRING, RELATIVE_HOUR type NUMBER, RELATIVE_MINUTE type NUMBER, RELATIVE_SECOND type NUMBER, SPECIFIC_HOUR type NUMBER, SPECIFIC_MINUTE type NUMBER, SPECIFIC_SECOND type NUMBER, TIMEZONE type STRING, end of T_RT_ENTTY_INTRPRTTN_SYS_TIME. types: "! begin of T_RUNTIME_RESPONSE_TYPE_PAUSE, TIME type INTEGER, TYPING type BOOLEAN, end of T_RUNTIME_RESPONSE_TYPE_PAUSE. types: "! begin of T_RUNTIME_RESPONSE_TYPE_SEARCH, HEADER type STRING, RESULTS type STANDARD TABLE OF T_SEARCH_RESULT WITH NON-UNIQUE DEFAULT KEY, end of T_RUNTIME_RESPONSE_TYPE_SEARCH. types: "! begin of T_RT_RESPONSE_TYPE_SUGGESTION, TITLE type STRING, SUGGESTIONS type STANDARD TABLE OF T_DIALOG_SUGGESTION WITH NON-UNIQUE DEFAULT KEY, end of T_RT_RESPONSE_TYPE_SUGGESTION. types: "! Contains information specific to a particular skill used by the Assistant. begin of T_MESSAGE_CONTEXT_SKILL, USER_DEFINED type MAP, end of T_MESSAGE_CONTEXT_SKILL. types: "! begin of T_RT_RESP_TYP_CONNECT_TO_AGENT, MESSAGE_TO_HUMAN_AGENT type STRING, TOPIC type STRING, end of T_RT_RESP_TYP_CONNECT_TO_AGENT. types: "! A request formatted for the Watson Assistant service. begin of T_MESSAGE_REQUEST, INPUT type T_MESSAGE_INPUT, CONTEXT type T_MESSAGE_CONTEXT, end of T_MESSAGE_REQUEST. constants: begin of C_REQUIRED_FIELDS, T_DIALOG_LOG_MESSAGE type string value '|LEVEL|MESSAGE|', T_DIALOG_NODES_VISITED type string value '|', T_MESSAGE_OUTPUT_DEBUG type string value '|', T_SESSION_RESPONSE type string value '|SESSION_ID|', T_RT_ENTTY_INTRPRTTN_SYS_NUM type string value '|', T_RUNTIME_ENTITY_ALTERNATIVE type string value '|', T_MESSAGE_INPUT_OPTIONS type string value '|', T_RUNTIME_INTENT type string value '|INTENT|CONFIDENCE|', T_CAPTURE_GROUP type string value '|GROUP|', T_RUNTIME_ENTITY type string value '|ENTITY|LOCATION|VALUE|', T_MESSAGE_INPUT type string value '|', T_DIA_ND_OUTPUT_OPT_ELEM_VALUE type string value '|', T_DIA_NODE_OUTPUT_OPT_ELEMENT type string value '|LABEL|VALUE|', T_RUNTIME_RESPONSE_TYPE_OPTION type string value '|', T_RT_ENTTY_INTRPRTTN_SYS_DATE type string value '|', T_SEARCH_RESULT_HIGHLIGHT type string value '|', T_DIALOG_SUGGESTION_VALUE type string value '|', T_SEARCH_RESULT_METADATA type string value '|', T_SEARCH_RESULT type string value '|ID|RESULT_METADATA|', T_DIALOG_SUGGESTION type string value '|LABEL|VALUE|', T_RUNTIME_RESPONSE_GENERIC type string value '|RESPONSE_TYPE|', T_RUNTIME_ENTITY_ROLE type string value '|', T_ERROR_DETAIL type string value '|MESSAGE|', T_ERROR_RESPONSE type string value '|ERROR|CODE|', T_RT_ENTITY_INTERPRETATION type string value '|', T_RUNTIME_RESPONSE_TYPE_IMAGE type string value '|', T_DIALOG_NODE_ACTION type string value '|NAME|RESULT_VARIABLE|', T_MSSG_CONTEXT_GLOBAL_SYSTEM type string value '|', T_MESSAGE_CONTEXT_GLOBAL type string value '|', T_MESSAGE_CONTEXT type string value '|', T_MESSAGE_OUTPUT type string value '|', T_MESSAGE_RESPONSE type string value '|OUTPUT|', T_RUNTIME_RESPONSE_TYPE_TEXT type string value '|', T_RT_ENTTY_INTRPRTTN_SYS_TIME type string value '|', T_RUNTIME_RESPONSE_TYPE_PAUSE type string value '|', T_RUNTIME_RESPONSE_TYPE_SEARCH type string value '|', T_RT_RESPONSE_TYPE_SUGGESTION type string value '|', T_MESSAGE_CONTEXT_SKILL type string value '|', T_RT_RESP_TYP_CONNECT_TO_AGENT type string value '|', T_MESSAGE_REQUEST type string value '|', __DUMMY type string value SPACE, end of C_REQUIRED_FIELDS . constants: begin of C_ABAPNAME_DICTIONARY, DEBUG type string value 'debug', RESTART type string value 'restart', ALTERNATE_INTENTS type string value 'alternate_intents', RETURN_CONTEXT type string value 'return_context', INTENT type string value 'intent', CONFIDENCE type string value 'confidence', ENTITY type string value 'entity', LOCATION type string value 'location', VALUE type string value 'value', METADATA type string value 'metadata', INNER type string value 'inner', GROUPS type string value 'groups', CALENDAR_TYPE type string value 'calendar_type', DATETIME_LINK type string value 'datetime_link', FESTIVAL type string value 'festival', GRANULARITY type string value 'granularity', RANGE_LINK type string value 'range_link', RANGE_MODIFIER type string value 'range_modifier', RELATIVE_DAY type string value 'relative_day', RELATIVE_MONTH type string value 'relative_month', RELATIVE_WEEK type string value 'relative_week', RELATIVE_WEEKEND type string value 'relative_weekend', RELATIVE_YEAR type string value 'relative_year', SPECIFIC_DAY type string value 'specific_day', SPECIFIC_DAY_OF_WEEK type string value 'specific_day_of_week', SPECIFIC_MONTH type string value 'specific_month', SPECIFIC_QUARTER type string value 'specific_quarter', SPECIFIC_YEAR type string value 'specific_year', NUMERIC_VALUE type string value 'numeric_value', SUBTYPE type string value 'subtype', PART_OF_DAY type string value 'part_of_day', RELATIVE_HOUR type string value 'relative_hour', RELATIVE_MINUTE type string value 'relative_minute', RELATIVE_SECOND type string value 'relative_second', SPECIFIC_HOUR type string value 'specific_hour', SPECIFIC_MINUTE type string value 'specific_minute', SPECIFIC_SECOND type string value 'specific_second', TIMEZONE type string value 'timezone', TYPE type string value 'type', MESSAGE_TYPE type string value 'message_type', TEXT type string value 'text', OPTIONS type string value 'options', INTENTS type string value 'intents', ENTITIES type string value 'entities', SUGGESTION_ID type string value 'suggestion_id', USER_ID type string value 'user_id', TURN_COUNT type string value 'turn_count', SYSTEM type string value 'system', USER_DEFINED type string value 'user_defined', GLOBAL type string value 'global', SKILLS type string value 'skills', INPUT type string value 'input', CONTEXT type string value 'context', LEVEL type string value 'level', MESSAGE type string value 'message', TIME type string value 'time', TYPING type string value 'typing', SOURCE type string value 'source', TITLE type string value 'title', DESCRIPTION type string value 'description', LABEL type string value 'label', PREFERENCE type string value 'preference', MESSAGE_TO_HUMAN_AGENT type string value 'message_to_human_agent', TOPIC type string value 'topic', SUGGESTIONS type string value 'suggestions', OUTPUT type string value 'output', RESPONSE_TYPE type string value 'response_type', HEADER type string value 'header', RESULTS type string value 'results', NAME type string value 'name', PARAMETERS type string value 'parameters', RESULT_VARIABLE type string value 'result_variable', CREDENTIALS type string value 'credentials', NODES_VISITED type string value 'nodes_visited', NODESVISITED type string value 'nodesVisited', LOG_MESSAGES type string value 'log_messages', LOGMESSAGES type string value 'logMessages', BRANCH_EXITED type string value 'branch_exited', BRANCH_EXITED_REASON type string value 'branch_exited_reason', GENERIC type string value 'generic', ACTIONS type string value 'actions', PATH type string value 'path', ERROR type string value 'error', ERRORS type string value 'errors', CODE type string value 'code', BODY type string value 'body', URL type string value 'url', SCORE type string value 'score', ID type string value 'id', RESULT_METADATA type string value 'result_metadata', HIGHLIGHT type string value 'highlight', SESSION_ID type string value 'session_id', GROUP type string value 'group', DIALOG_NODE type string value 'dialog_node', CONDITIONS type string value 'conditions', end of C_ABAPNAME_DICTIONARY . methods GET_APPNAME redefinition . methods GET_REQUEST_PROP redefinition . methods GET_SDK_VERSION_DATE redefinition . "! Create a session. "! "! @parameter I_assistant_id | "! Unique identifier of the assistant. To find the assistant ID in the Watson "! Assistant user interface, open the assistant settings and click **API "! Details**. For information about creating assistants, see the "! [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-a "! ssistant-add#assistant-add-task). "! "! **Note:** Currently, the v2 API does not support creating assistants. "! @parameter E_RESPONSE | "! Service return value of type T_SESSION_RESPONSE "! methods CREATE_SESSION importing !I_assistant_id type STRING !I_accept type string default 'application/json' exporting !E_RESPONSE type T_SESSION_RESPONSE raising ZCX_IBMC_SERVICE_EXCEPTION . "! Delete session. "! "! @parameter I_assistant_id | "! Unique identifier of the assistant. To find the assistant ID in the Watson "! Assistant user interface, open the assistant settings and click **API "! Details**. For information about creating assistants, see the "! [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-a "! ssistant-add#assistant-add-task). "! "! **Note:** Currently, the v2 API does not support creating assistants. "! @parameter I_session_id | "! Unique identifier of the session. "! methods DELETE_SESSION importing !I_assistant_id type STRING !I_session_id type STRING !I_accept type string default 'application/json' raising ZCX_IBMC_SERVICE_EXCEPTION . "! Send user input to assistant. "! "! @parameter I_assistant_id | "! Unique identifier of the assistant. To find the assistant ID in the Watson "! Assistant user interface, open the assistant settings and click **API "! Details**. For information about creating assistants, see the "! [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-a "! ssistant-add#assistant-add-task). "! "! **Note:** Currently, the v2 API does not support creating assistants. "! @parameter I_session_id | "! Unique identifier of the session. "! @parameter I_request | "! The message to be sent. This includes the user's input, along with optional "! content such as intents and entities. "! @parameter E_RESPONSE | "! Service return value of type T_MESSAGE_RESPONSE "! methods MESSAGE importing !I_assistant_id type STRING !I_session_id type STRING !I_request type T_MESSAGE_REQUEST optional !I_contenttype type string default 'application/json' !I_accept type string default 'application/json' exporting !E_RESPONSE type T_MESSAGE_RESPONSE raising ZCX_IBMC_SERVICE_EXCEPTION . protected section. private section. methods SET_DEFAULT_QUERY_PARAMETERS changing !C_URL type TS_URL . ENDCLASS. class ZCL_IBMC_ASSISTANT_V2 IMPLEMENTATION. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method ZCL_IBMC_ASSISTANT_V2->GET_APPNAME * +-------------------------------------------------------------------------------------------------+ * | [<-()] E_APPNAME TYPE STRING * +--------------------------------------------------------------------------------------</SIGNATURE> method GET_APPNAME. e_appname = 'Watson Assistant v2'. endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Protected Method ZCL_IBMC_ASSISTANT_V2->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 = '/assistant/api'. endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method ZCL_IBMC_ASSISTANT_V2->GET_SDK_VERSION_DATE * +-------------------------------------------------------------------------------------------------+ * | [<-()] E_SDK_VERSION_DATE TYPE STRING * +--------------------------------------------------------------------------------------</SIGNATURE> method get_sdk_version_date. e_sdk_version_date = '20191002122836'. endmethod. * <SIGNATURE>---------------------------------------------------------------------------------------+ * | Instance Public Method ZCL_IBMC_ASSISTANT_V2->CREATE_SESSION * +-------------------------------------------------------------------------------------------------+ * | [--->] I_assistant_id TYPE STRING * | [--->] I_accept TYPE string (default ='application/json') * | [<---] E_RESPONSE TYPE T_SESSION_RESPONSE * | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION * +--------------------------------------------------------------------------------------</SIGNATURE> method CREATE_SESSION. 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 = '/v2/assistants/{assistant_id}/sessions'. replace all occurrences of `{assistant_id}` in ls_request_prop-url-path with i_assistant_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 ). " 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_ASSISTANT_V2->DELETE_SESSION * +-------------------------------------------------------------------------------------------------+ * | [--->] I_assistant_id TYPE STRING * | [--->] I_session_id TYPE STRING * | [--->] I_accept TYPE string (default ='application/json') * | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION * +--------------------------------------------------------------------------------------</SIGNATURE> method DELETE_SESSION. 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 = '/v2/assistants/{assistant_id}/sessions/{session_id}'. replace all occurrences of `{assistant_id}` in ls_request_prop-url-path with i_assistant_id ignoring case. replace all occurrences of `{session_id}` in ls_request_prop-url-path with i_session_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_ASSISTANT_V2->MESSAGE * +-------------------------------------------------------------------------------------------------+ * | [--->] I_assistant_id TYPE STRING * | [--->] I_session_id TYPE STRING * | [--->] I_request TYPE T_MESSAGE_REQUEST(optional) * | [--->] I_contenttype TYPE string (default ='application/json') * | [--->] I_accept TYPE string (default ='application/json') * | [<---] E_RESPONSE TYPE T_MESSAGE_RESPONSE * | [!CX!] ZCX_IBMC_SERVICE_EXCEPTION * +--------------------------------------------------------------------------------------</SIGNATURE> method MESSAGE. 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 = '/v2/assistants/{assistant_id}/sessions/{session_id}/message'. replace all occurrences of `{assistant_id}` in ls_request_prop-url-path with i_assistant_id ignoring case. replace all occurrences of `{session_id}` in ls_request_prop-url-path with i_session_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 = ''. if not i_request is initial. lv_datatype = get_datatype( i_request ). 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_request i_dictionary = c_abapname_dictionary i_required_fields = c_required_fields ). else. lv_bodyparam = abap_to_json( i_name = 'request' i_value = i_request ). endif. lv_body = lv_body && lv_separator && lv_bodyparam. else. assign i_request to <lv_text>. lv_bodyparam = <lv_text>. concatenate lv_body lv_bodyparam into lv_body. endif. 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 Private Method ZCL_IBMC_ASSISTANT_V2->SET_DEFAULT_QUERY_PARAMETERS * +-------------------------------------------------------------------------------------------------+ * | [<-->] C_URL TYPE TS_URL * +--------------------------------------------------------------------------------------</SIGNATURE> method set_default_query_parameters. if not p_version is initial. add_query_parameter( exporting i_parameter = `version` i_value = p_version changing c_url = c_url ). endif. endmethod. ENDCLASS.
37.356899
134
0.664306
da052a473a7ec997959e52044777a07c450fc7d7
2,006
abap
ABAP
src/zdemo_excel44.prog.abap
bizhuka/abap2xlsx
d69d4d6fdfb4090c50991b56b16809cf1c092001
[ "Apache-2.0" ]
251
2019-02-23T03:36:38.000Z
2021-12-10T21:39:23.000Z
src/demos/zdemo_excel44.prog.abap
gregorwolf/abap2xlsx
5110f924b435e23f4474381d0e43f0686b9d0421
[ "Apache-2.0" ]
278
2019-02-17T10:42:59.000Z
2021-12-10T20:24:56.000Z
src/demos/zdemo_excel44.prog.abap
gregorwolf/abap2xlsx
5110f924b435e23f4474381d0e43f0686b9d0421
[ "Apache-2.0" ]
130
2019-02-20T13:25:30.000Z
2021-12-09T03:20:31.000Z
*&---------------------------------------------------------------------* *& Report ZDEMO_EXCEL44 *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* REPORT zdemo_excel44. DATA: lo_excel_no_line_if_empty TYPE REF TO zcl_excel, lo_excel TYPE REF TO zcl_excel, lo_worksheet_no_line_if_empty TYPE REF TO zcl_excel_worksheet, lo_worksheet TYPE REF TO zcl_excel_worksheet. DATA: lt_field_catalog TYPE zexcel_t_fieldcatalog. DATA: gc_save_file_name TYPE string VALUE '44_iTabEmpty.csv'. INCLUDE zdemo_excel_outputopt_incl. SELECTION-SCREEN BEGIN OF BLOCK b44 WITH FRAME TITLE txt_b44. * No line if internal table is empty DATA: p_mtyfil TYPE flag VALUE abap_true. SELECTION-SCREEN END OF BLOCK b44. INITIALIZATION. txt_b44 = 'Testing empty file option'(b44). START-OF-SELECTION. " Creates active sheet CREATE OBJECT lo_excel_no_line_if_empty. CREATE OBJECT lo_excel. " Get active sheet lo_worksheet_no_line_if_empty = lo_excel_no_line_if_empty->get_active_worksheet( ). lo_worksheet = lo_excel->get_active_worksheet( ). lo_worksheet_no_line_if_empty->set_title( 'Internal table' ). lo_worksheet->set_title( 'Internal table' ). DATA lt_test TYPE TABLE OF sflight. lo_worksheet_no_line_if_empty->bind_table( ip_table = lt_test iv_no_line_if_empty = p_mtyfil ). p_mtyfil = abap_false. lo_worksheet->bind_table( ip_table = lt_test iv_no_line_if_empty = p_mtyfil ). *** Create output lcl_output=>output( EXPORTING cl_excel = lo_excel_no_line_if_empty iv_writerclass_name = 'ZCL_EXCEL_WRITER_CSV' ). gc_save_file_name = '44_iTabNotEmpty.csv'. lcl_output=>output( EXPORTING cl_excel = lo_excel iv_writerclass_name = 'ZCL_EXCEL_WRITER_CSV' ).
34
85
0.62014
da071e03b9c4004e4d461499d0c1a5fbdb1f5b56
227
abap
ABAP
src/unmanaged/#dmo#bp_booking_u29.clas.abap
SAP-Cloud-Platform/flight29
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u29.clas.abap
SAP-Cloud-Platform/flight29
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u29.clas.abap
SAP-Cloud-Platform/flight29
3d46b3e6ceaea78afbc3c0a0836ca62eaf2e709b
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/bp_booking_u29 DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF /dmo/i_travel_u29 . PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /dmo/bp_booking_u29 IMPLEMENTATION. ENDCLASS.
14.1875
41
0.76652
da0bd680fae8ff372863f430bbd21183e6a89bce
9,758
abap
ABAP
src/utils/zcl_abapgit_diff.clas.testclasses.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
src/utils/zcl_abapgit_diff.clas.testclasses.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
15
2021-12-01T05:03:57.000Z
2022-03-01T05:04:02.000Z
src/utils/zcl_abapgit_diff.clas.testclasses.abap
boy0korea/abapGit
0168ae74a87f3102901f33016c027653f62b15a6
[ "MIT" ]
null
null
null
CLASS ltcl_diff DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA: mt_new TYPE TABLE OF string, mt_old TYPE TABLE OF string, mt_expected TYPE zif_abapgit_definitions=>ty_diffs_tt. METHODS: add_new IMPORTING iv_new TYPE string, add_old IMPORTING iv_old TYPE string, add_expected IMPORTING iv_new_num TYPE zif_abapgit_definitions=>ty_diff-new_num iv_new TYPE zif_abapgit_definitions=>ty_diff-new iv_result TYPE zif_abapgit_definitions=>ty_diff-result iv_old_num TYPE zif_abapgit_definitions=>ty_diff-old_num iv_old TYPE zif_abapgit_definitions=>ty_diff-old. METHODS: setup. METHODS: test IMPORTING !iv_ignore_indentation TYPE abap_bool DEFAULT abap_false !iv_ignore_comments TYPE abap_bool DEFAULT abap_false !iv_ignore_case TYPE abap_bool DEFAULT abap_false. METHODS: diff01 FOR TESTING, diff02 FOR TESTING, diff03 FOR TESTING, diff04 FOR TESTING, diff05 FOR TESTING, diff06 FOR TESTING, diff07 FOR TESTING, diff08 FOR TESTING, diff09 FOR TESTING. ENDCLASS. CLASS ltcl_diff IMPLEMENTATION. METHOD add_new. DATA lv_new LIKE LINE OF mt_new. lv_new = iv_new. APPEND lv_new TO mt_new. ENDMETHOD. METHOD add_old. DATA lv_old LIKE LINE OF mt_old. lv_old = iv_old. APPEND lv_old TO mt_old. ENDMETHOD. METHOD add_expected. DATA ls_expected LIKE LINE OF mt_expected. ls_expected-new_num = iv_new_num. ls_expected-new = iv_new. ls_expected-result = iv_result. ls_expected-old_num = iv_old_num. ls_expected-old = iv_old. ls_expected-beacon = zcl_abapgit_diff=>co_starting_beacon. APPEND ls_expected TO mt_expected. ENDMETHOD. METHOD setup. CLEAR mt_new. CLEAR mt_old. CLEAR mt_expected. ENDMETHOD. METHOD test. DATA: lv_new TYPE string, lv_xnew TYPE xstring, lv_old TYPE string, lv_xold TYPE xstring, lo_diff TYPE REF TO zcl_abapgit_diff, lt_diff TYPE zif_abapgit_definitions=>ty_diffs_tt. FIELD-SYMBOLS: <ls_diff> LIKE LINE OF lt_diff. CONCATENATE LINES OF mt_new INTO lv_new SEPARATED BY zif_abapgit_definitions=>c_newline. CONCATENATE LINES OF mt_old INTO lv_old SEPARATED BY zif_abapgit_definitions=>c_newline. lv_xnew = zcl_abapgit_convert=>string_to_xstring_utf8( lv_new ). lv_xold = zcl_abapgit_convert=>string_to_xstring_utf8( lv_old ). CREATE OBJECT lo_diff EXPORTING iv_new = lv_xnew iv_old = lv_xold iv_ignore_indentation = iv_ignore_indentation iv_ignore_comments = iv_ignore_comments iv_ignore_case = iv_ignore_case. lt_diff = lo_diff->get( ). LOOP AT lt_diff ASSIGNING <ls_diff>. CLEAR <ls_diff>-short. ENDLOOP. cl_abap_unit_assert=>assert_equals( act = lt_diff exp = mt_expected ). ENDMETHOD. METHOD diff01. "insert add_new( iv_new = 'A' ). add_expected( iv_new_num = ' 1' iv_new = 'A' iv_result = zif_abapgit_definitions=>c_diff-insert iv_old_num = '' iv_old = '' ). test( ). ENDMETHOD. METHOD diff02. " identical add_new( iv_new = 'A' ). add_old( iv_old = 'A' ). add_expected( iv_new_num = ' 1' iv_new = 'A' iv_result = '' iv_old_num = ' 1' iv_old = 'A' ). test( ). ENDMETHOD. METHOD diff03. " delete add_old( iv_old = 'A' ). add_expected( iv_new_num = '' iv_new = '' iv_result = zif_abapgit_definitions=>c_diff-delete iv_old_num = ' 1' iv_old = 'A' ). test( ). ENDMETHOD. METHOD diff04. " update add_new( iv_new = 'A+' ). add_old( iv_old = 'A' ). add_expected( iv_new_num = ' 1' iv_new = 'A+' iv_result = zif_abapgit_definitions=>c_diff-update iv_old_num = ' 1' iv_old = 'A' ). test( ). ENDMETHOD. METHOD diff05. " identical add_new( iv_new = 'A' ). add_new( iv_new = 'B' ). add_old( iv_old = 'A' ). add_old( iv_old = 'B' ). add_expected( iv_new_num = ' 1' iv_new = 'A' iv_result = '' iv_old_num = ' 1' iv_old = 'A' ). add_expected( iv_new_num = ' 2' iv_new = 'B' iv_result = '' iv_old_num = ' 2' iv_old = 'B' ). test( ). ENDMETHOD. METHOD diff06. " mixed add_new( iv_new = 'A' ). add_new( iv_new = 'B' ). add_new( iv_new = 'inserted' ). add_new( iv_new = 'C' ). add_new( iv_new = 'D update' ). add_old( iv_old = 'A' ). add_old( iv_old = 'B' ). add_old( iv_old = 'C' ). add_old( iv_old = 'D' ). add_expected( iv_new_num = ' 1' iv_new = 'A' iv_result = '' iv_old_num = ' 1' iv_old = 'A' ). add_expected( iv_new_num = ' 2' iv_new = 'B' iv_result = '' iv_old_num = ' 2' iv_old = 'B' ). add_expected( iv_new_num = ' 3' iv_new = 'inserted' iv_result = zif_abapgit_definitions=>c_diff-insert iv_old_num = '' iv_old = '' ). add_expected( iv_new_num = ' 4' iv_new = 'C' iv_result = '' iv_old_num = ' 3' iv_old = 'C' ). add_expected( iv_new_num = ' 5' iv_new = 'D update' iv_result = zif_abapgit_definitions=>c_diff-update iv_old_num = ' 4' iv_old = 'D' ). test( ). ENDMETHOD. METHOD diff07. " ignore indentation add_new( iv_new = 'A' ). add_new( iv_new = ' B' ). " changed indent add_new( iv_new = 'C' ). add_new( iv_new = ' D' ). " changed indent add_old( iv_old = 'A' ). add_old( iv_old = 'B' ). add_old( iv_old = 'C' ). add_old( iv_old = 'D' ). add_expected( iv_new_num = ' 1' iv_new = 'A' iv_result = '' iv_old_num = ' 1' iv_old = 'A' ). add_expected( iv_new_num = ' 2' iv_new = ' B' iv_result = '' " no diff! iv_old_num = ' 2' iv_old = 'B' ). add_expected( iv_new_num = ' 3' iv_new = 'C' iv_result = '' iv_old_num = ' 3' iv_old = 'C' ). add_expected( iv_new_num = ' 4' iv_new = ' D' iv_result = '' " no diff! iv_old_num = ' 4' iv_old = 'D' ). test( iv_ignore_indentation = abap_true ). ENDMETHOD. METHOD diff08. " ignore comments add_new( iv_new = 'A' ). add_new( iv_new = '* X' ). " changed comment add_new( iv_new = 'C' ). add_new( iv_new = 'D " new' ). " changed comment add_old( iv_old = 'A' ). add_old( iv_old = '* B' ). add_old( iv_old = 'C' ). add_old( iv_old = 'D " old' ). add_expected( iv_new_num = ' 1' iv_new = 'A' iv_result = '' iv_old_num = ' 1' iv_old = 'A' ). add_expected( iv_new_num = ' 2' iv_new = '* X' iv_result = '' " no diff! iv_old_num = ' 2' iv_old = '* B' ). add_expected( iv_new_num = ' 3' iv_new = 'C' iv_result = '' iv_old_num = ' 3' iv_old = 'C' ). add_expected( iv_new_num = ' 4' iv_new = 'D " new' iv_result = '' " no diff! iv_old_num = ' 4' iv_old = 'D " old' ). test( iv_ignore_comments = abap_true ). ENDMETHOD. METHOD diff09. " ignore case add_new( iv_new = 'A' ). add_new( iv_new = 'b' ). " changed case add_new( iv_new = 'c' ). add_new( iv_new = 'D' ). " changed case add_old( iv_old = 'A' ). add_old( iv_old = 'B' ). add_old( iv_old = 'c' ). add_old( iv_old = 'd' ). add_expected( iv_new_num = ' 1' iv_new = 'A' iv_result = '' iv_old_num = ' 1' iv_old = 'A' ). add_expected( iv_new_num = ' 2' iv_new = 'b' iv_result = '' " no diff! iv_old_num = ' 2' iv_old = 'B' ). add_expected( iv_new_num = ' 3' iv_new = 'c' iv_result = '' iv_old_num = ' 3' iv_old = 'c' ). add_expected( iv_new_num = ' 4' iv_new = 'D' iv_result = '' " no diff! iv_old_num = ' 4' iv_old = 'd' ). test( iv_ignore_case = abap_true ). ENDMETHOD. ENDCLASS.
27.564972
92
0.484833
da0f8835723abc079238aa21a5b10ae1b7493dcb
333
abap
ABAP
src/legacy/#dmo#flight_travel_api00.fugr.#dmo#flight_travel_save00.abap
SAP-Cloud-Platform/flight00
c89c60323f6b3098ae078930265dd0cea6ec424e
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api00.fugr.#dmo#flight_travel_save00.abap
SAP-Cloud-Platform/flight00
c89c60323f6b3098ae078930265dd0cea6ec424e
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#flight_travel_api00.fugr.#dmo#flight_travel_save00.abap
SAP-Cloud-Platform/flight00
c89c60323f6b3098ae078930265dd0cea6ec424e
[ "BSD-Source-Code" ]
null
null
null
"! API for Saving the Transactional Buffer of the Travel API "! FUNCTION /DMO/FLIGHT_TRAVEL_SAVE00. *"---------------------------------------------------------------------- *"*"Local Interface: *"---------------------------------------------------------------------- /dmo/cl_flight_legacy00=>get_instance( )->save( ). ENDFUNCTION.
37
72
0.423423
da1134fe884adb86f71ed48606c2982928467eaa
169,621
abap
ABAP
src/zcl_excel_reader_2007.clas.abap
egorovantony/abap2xlsx
6356cad9f34610d5959573232cd675780233ccaf
[ "Apache-2.0" ]
1
2021-04-30T19:32:09.000Z
2021-04-30T19:32:09.000Z
src/zcl_excel_reader_2007.clas.abap
egorovantony/abap2xlsx
6356cad9f34610d5959573232cd675780233ccaf
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_reader_2007.clas.abap
egorovantony/abap2xlsx
6356cad9f34610d5959573232cd675780233ccaf
[ "Apache-2.0" ]
null
null
null
class ZCL_EXCEL_READER_2007 definition public create public . public section. *"* public components of class ZCL_EXCEL_READER_2007 *"* do not include other source files here!!! type-pools IXML . interfaces ZIF_EXCEL_READER . class-methods FILL_STRUCT_FROM_ATTRIBUTES importing !IP_ELEMENT type ref to IF_IXML_ELEMENT changing !CP_STRUCTURE type ANY . protected section. types: *"* protected components of class ZCL_EXCEL_READER_2007 *"* do not include other source files here!!! BEGIN OF t_relationship, id TYPE string, type TYPE string, target TYPE string, targetmode TYPE string, worksheet TYPE REF TO zcl_excel_worksheet, sheetid TYPE string, "ins #235 - repeat rows/cols - needed to identify correct sheet END OF t_relationship . types: BEGIN OF t_fileversion, appname TYPE string, lastedited TYPE string, lowestedited TYPE string, rupbuild TYPE string, codename TYPE string, END OF t_fileversion . types: BEGIN OF t_sheet, name TYPE string, sheetid TYPE string, id TYPE string, state TYPE string, END OF t_sheet . types: BEGIN OF t_workbookpr, codename TYPE string, defaultthemeversion TYPE string, END OF t_workbookpr . types: BEGIN OF t_sheetpr, codename TYPE string, END OF t_sheetpr . types: BEGIN OF t_range, name TYPE string, hidden TYPE string, "inserted with issue #235 because Autofilters didn't passthrough localsheetid TYPE string, " issue #163 END OF t_range . types: t_fills TYPE STANDARD TABLE OF REF TO zcl_excel_style_fill WITH NON-UNIQUE DEFAULT KEY . types: t_borders TYPE STANDARD TABLE OF REF TO zcl_excel_style_borders WITH NON-UNIQUE DEFAULT KEY . types: t_fonts TYPE STANDARD TABLE OF REF TO zcl_excel_style_font WITH NON-UNIQUE DEFAULT KEY . types: t_style_refs TYPE STANDARD TABLE OF REF TO zcl_excel_style WITH NON-UNIQUE DEFAULT KEY . types: BEGIN OF t_color, indexed TYPE string, rgb TYPE string, theme TYPE string, tint TYPE string, END OF t_color . types: BEGIN OF t_rel_drawing, id TYPE string, content TYPE xstring, file_ext TYPE string, content_xml TYPE REF TO if_ixml_document, END OF t_rel_drawing . types: t_rel_drawings TYPE STANDARD TABLE OF t_rel_drawing WITH NON-UNIQUE DEFAULT KEY . types: BEGIN OF gts_external_hyperlink, id TYPE string, target TYPE string, END OF gts_external_hyperlink . types: gtt_external_hyperlinks TYPE HASHED TABLE OF gts_external_hyperlink WITH UNIQUE KEY id . types: BEGIN OF ty_ref_formulae, sheet TYPE REF TO zcl_excel_worksheet, row TYPE i, column TYPE i, si TYPE i, ref TYPE string, formula TYPE string, END OF ty_ref_formulae . types: tyt_ref_formulae TYPE HASHED TABLE OF ty_ref_formulae WITH UNIQUE KEY sheet row column . data SHARED_STRINGS type STRINGTAB . data STYLES type T_STYLE_REFS . data MT_REF_FORMULAE type TYT_REF_FORMULAE . data MT_DXF_STYLES type ZEXCEL_T_STYLES_COND_MAPPING . methods FILL_ROW_OUTLINES importing !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . methods GET_FROM_ZIP_ARCHIVE importing !I_FILENAME type STRING returning value(R_CONTENT) type XSTRING raising ZCX_EXCEL . methods GET_IXML_FROM_ZIP_ARCHIVE importing !I_FILENAME type STRING !IS_NORMALIZING type BOOLEAN default 'X' returning value(R_IXML) type ref to IF_IXML_DOCUMENT raising ZCX_EXCEL . methods LOAD_DRAWING_ANCHOR importing !IO_ANCHOR_ELEMENT type ref to IF_IXML_ELEMENT !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET !IT_RELATED_DRAWINGS type T_REL_DRAWINGS . methods LOAD_SHARED_STRINGS importing !IP_PATH type STRING raising ZCX_EXCEL . methods LOAD_STYLES importing !IP_PATH type STRING !IP_EXCEL type ref to ZCL_EXCEL raising ZCX_EXCEL . methods LOAD_DXF_STYLES importing !IV_PATH type STRING !IO_EXCEL type ref to ZCL_EXCEL raising ZCX_EXCEL . methods LOAD_STYLE_BORDERS importing !IP_XML type ref to IF_IXML_DOCUMENT returning value(EP_BORDERS) type T_BORDERS . methods LOAD_STYLE_FILLS importing !IP_XML type ref to IF_IXML_DOCUMENT returning value(EP_FILLS) type T_FILLS . methods LOAD_STYLE_FONTS importing !IP_XML type ref to IF_IXML_DOCUMENT returning value(EP_FONTS) type T_FONTS . methods LOAD_STYLE_NUM_FORMATS importing !IP_XML type ref to IF_IXML_DOCUMENT returning value(EP_NUM_FORMATS) type ZCL_EXCEL_STYLE_NUMBER_FORMAT=>T_NUM_FORMATS . methods LOAD_WORKBOOK importing !IV_WORKBOOK_FULL_FILENAME type STRING !IO_EXCEL type ref to ZCL_EXCEL raising ZCX_EXCEL . methods LOAD_WORKSHEET importing !IP_PATH type STRING !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . methods LOAD_WORKSHEET_COND_FORMAT importing !IO_IXML_WORKSHEET type ref to IF_IXML_DOCUMENT !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . methods LOAD_WORKSHEET_COND_FORMAT_AA importing !IO_IXML_RULE type ref to IF_IXML_ELEMENT !IO_STYLE_CONDITIONAL type ref to ZCL_EXCEL_STYLE_CONDITIONAL . methods LOAD_WORKSHEET_COND_FORMAT_CI importing !IO_IXML_RULE type ref to IF_IXML_ELEMENT !IO_STYLE_CONDITIONAL type ref to ZCL_EXCEL_STYLE_CONDITIONAL . methods LOAD_WORKSHEET_COND_FORMAT_CS importing !IO_IXML_RULE type ref to IF_IXML_ELEMENT !IO_STYLE_CONDITIONAL type ref to ZCL_EXCEL_STYLE_CONDITIONAL . methods LOAD_WORKSHEET_COND_FORMAT_EX importing !IO_IXML_RULE type ref to IF_IXML_ELEMENT !IO_STYLE_CONDITIONAL type ref to ZCL_EXCEL_STYLE_CONDITIONAL . methods LOAD_WORKSHEET_COND_FORMAT_IS importing !IO_IXML_RULE type ref to IF_IXML_ELEMENT !IO_STYLE_CONDITIONAL type ref to ZCL_EXCEL_STYLE_CONDITIONAL . methods LOAD_WORKSHEET_COND_FORMAT_DB importing !IO_IXML_RULE type ref to IF_IXML_ELEMENT !IO_STYLE_CONDITIONAL type ref to ZCL_EXCEL_STYLE_CONDITIONAL . methods LOAD_WORKSHEET_COND_FORMAT_T10 importing !IO_IXML_RULE type ref to IF_IXML_ELEMENT !IO_STYLE_CONDITIONAL type ref to ZCL_EXCEL_STYLE_CONDITIONAL . methods LOAD_WORKSHEET_DRAWING importing !IP_PATH type STRING !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . methods LOAD_WORKSHEET_HYPERLINKS importing !IO_IXML_WORKSHEET type ref to IF_IXML_DOCUMENT !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET !IT_EXTERNAL_HYPERLINKS type GTT_EXTERNAL_HYPERLINKS raising ZCX_EXCEL . methods LOAD_WORKSHEET_PAGEBREAKS importing !IO_IXML_WORKSHEET type ref to IF_IXML_DOCUMENT !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . methods LOAD_WORKSHEET_PAGEMARGINS importing !IO_IXML_WORKSHEET type ref to IF_IXML_DOCUMENT !IO_WORKSHEET type ref to ZCL_EXCEL_WORKSHEET raising ZCX_EXCEL . class-methods RESOLVE_PATH importing !IP_PATH type STRING returning value(RP_RESULT) type STRING . methods RESOLVE_REFERENCED_FORMULAE . methods GET_DXF_STYLE_GUID importing !IO_IXML_DXF type ref to IF_IXML_ELEMENT !IO_EXCEL type ref to ZCL_EXCEL returning value(RV_STYLE_GUID) type ZEXCEL_CELL_STYLE . methods LOAD_THEME importing value(IV_PATH) type STRING !IP_EXCEL type ref to ZCL_EXCEL . private section. data ZIP type ref to LCL_ZIP_ARCHIVE . methods CREATE_ZIP_ARCHIVE importing !I_XLSX_BINARY type XSTRING !I_USE_ALTERNATE_ZIP type SEOCLSNAME optional returning value(E_ZIP) type ref to LCL_ZIP_ARCHIVE raising ZCX_EXCEL . methods READ_FROM_APPLSERVER importing !I_FILENAME type CSEQUENCE returning value(R_EXCEL_DATA) type XSTRING . methods READ_FROM_LOCAL_FILE importing !I_FILENAME type CSEQUENCE returning value(R_EXCEL_DATA) type XSTRING raising ZCX_EXCEL . ENDCLASS. CLASS ZCL_EXCEL_READER_2007 IMPLEMENTATION. METHOD create_zip_archive. CASE i_use_alternate_zip. WHEN space. e_zip = lcl_abap_zip_archive=>create( i_xlsx_binary ). WHEN OTHERS. e_zip = lcl_alternate_zip_archive=>create( i_data = i_xlsx_binary i_alternate_zip_class = i_use_alternate_zip ). ENDCASE. ENDMETHOD. METHOD fill_row_outlines. TYPES: BEGIN OF lts_row_data, row TYPE i, outline_level TYPE i, END OF lts_row_data, ltt_row_data TYPE SORTED TABLE OF lts_row_data WITH UNIQUE KEY row. DATA: lt_row_dimensions TYPE zexcel_t_worksheet_rowdimensio, lt_row_data TYPE ltt_row_data, ls_row_data LIKE LINE OF lt_row_data, lt_collapse_rows TYPE HASHED TABLE OF i WITH UNIQUE KEY table_line, lv_collapsed TYPE abap_bool, lv_outline_level TYPE i, lv_next_consecutive_row TYPE i, lt_outline_rows TYPE zcl_excel_worksheet=>mty_ts_outlines_row, ls_outline_row LIKE LINE OF lt_outline_rows, lv_row_offset TYPE i, lv_row_collapse_flag TYPE i. FIELD-SYMBOLS: <ls_row_dimension> LIKE LINE OF lt_row_dimensions, <ls_row_data> LIKE LINE OF lt_row_data. * First collect information about outlines ( outline leven and collapsed state ) lt_row_dimensions = io_worksheet->get_row_dimensions( ). LOOP AT lt_row_dimensions ASSIGNING <ls_row_dimension>. ls_row_data-row = <ls_row_dimension>-row. ls_row_data-outline_level = <ls_row_dimension>-row_dimension->get_outline_level( ). IF ls_row_data-outline_level IS NOT INITIAL. INSERT ls_row_data INTO TABLE lt_row_data. ENDIF. lv_collapsed = <ls_row_dimension>-row_dimension->get_collapsed( ). IF lv_collapsed = abap_true. INSERT <ls_row_dimension>-row INTO TABLE lt_collapse_rows. ENDIF. ENDLOOP. * Now parse this information - we need consecutive rows - any gap will create a new outline DO 7 TIMES. " max number of outlines allowed lv_outline_level = sy-index. CLEAR lv_next_consecutive_row. CLEAR ls_outline_row. LOOP AT lt_row_data ASSIGNING <ls_row_data> WHERE outline_level >= lv_outline_level. IF lv_next_consecutive_row <> <ls_row_data>-row " A gap --> close all open outlines AND lv_next_consecutive_row IS NOT INITIAL. " First time in loop. INSERT ls_outline_row INTO TABLE lt_outline_rows. CLEAR: ls_outline_row. ENDIF. IF ls_outline_row-row_from IS INITIAL. ls_outline_row-row_from = <ls_row_data>-row. ENDIF. ls_outline_row-row_to = <ls_row_data>-row. lv_next_consecutive_row = <ls_row_data>-row + 1. ENDLOOP. IF ls_outline_row-row_from IS NOT INITIAL. INSERT ls_outline_row INTO TABLE lt_outline_rows. ENDIF. ENDDO. * lt_outline_rows holds all outline information * we now need to determine whether the outline is collapsed or not LOOP AT lt_outline_rows INTO ls_outline_row. IF io_worksheet->zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_off. lv_row_collapse_flag = ls_outline_row-row_from - 1. ELSE. lv_row_collapse_flag = ls_outline_row-row_to + 1. ENDIF. READ TABLE lt_collapse_rows TRANSPORTING NO FIELDS WITH TABLE KEY table_line = lv_row_collapse_flag. IF sy-subrc = 0. ls_outline_row-collapsed = abap_true. ENDIF. io_worksheet->set_row_outline( iv_row_from = ls_outline_row-row_from iv_row_to = ls_outline_row-row_to iv_collapsed = ls_outline_row-collapsed ). ENDLOOP. * Finally purge outline information ( collapsed state, outline leve) from row_dimensions, since we want to keep these in the outline-table LOOP AT lt_row_dimensions ASSIGNING <ls_row_dimension>. <ls_row_dimension>-row_dimension->set_outline_level( 0 ). <ls_row_dimension>-row_dimension->set_collapsed( abap_false ). ENDLOOP. ENDMETHOD. method fill_struct_from_attributes. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-07 * - ... * changes: renaming variables to naming conventions * aligning code * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* data: lv_name type string, lo_attributes type ref to if_ixml_named_node_map, lo_attribute type ref to if_ixml_attribute, lo_iterator type ref to if_ixml_node_iterator. field-symbols: <component> type any. *--------------------------------------------------------------------* * The values of named attributes of a tag are being read and moved into corresponding * fields of given structure * Behaves like move-corresonding tag to structure * Example: * <Relationship Target="docProps/app.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Id="rId3"/> * Here the attributes are Target, Type and Id. Thus if the passed * structure has fieldnames Id and Target these would be filled with * "rId3" and "docProps/app.xml" respectively *--------------------------------------------------------------------* clear cp_structure. lo_attributes = ip_element->get_attributes( ). lo_iterator = lo_attributes->create_iterator( ). lo_attribute ?= lo_iterator->get_next( ). while lo_attribute is bound. lv_name = lo_attribute->get_name( ). translate lv_name to upper case. assign component lv_name of structure cp_structure to <component>. if sy-subrc = 0. <component> = lo_attribute->get_value( ). endif. lo_attribute ?= lo_iterator->get_next( ). endwhile. endmethod. METHOD get_dxf_style_guid. DATA: lo_ixml_dxf_children TYPE REF TO if_ixml_node_list, lo_ixml_iterator_dxf_children TYPE REF TO if_ixml_node_iterator, lo_ixml_dxf_child TYPE REF TO if_ixml_element, lv_dxf_child_type TYPE string, lo_ixml_element TYPE REF TO if_ixml_element, lo_ixml_element2 TYPE REF TO if_ixml_element, lv_val TYPE string. DATA: ls_cstyle TYPE zexcel_s_cstyle_complete, ls_cstylex TYPE zexcel_s_cstylex_complete. lo_ixml_dxf_children = io_ixml_dxf->get_children( ). lo_ixml_iterator_dxf_children = lo_ixml_dxf_children->create_iterator( ). lo_ixml_dxf_child ?= lo_ixml_iterator_dxf_children->get_next( ). WHILE lo_ixml_dxf_child IS BOUND. lv_dxf_child_type = lo_ixml_dxf_child->get_name( ). CASE lv_dxf_child_type. WHEN 'font'. *--------------------------------------------------------------------* * italic *--------------------------------------------------------------------* lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'i' ). IF lo_ixml_element IS BOUND. CLEAR lv_val. lv_val = lo_ixml_element->get_attribute_ns( 'val' ). IF lv_val <> '0'. ls_cstyle-font-italic = 'X'. ls_cstylex-font-italic = 'X'. ENDIF. ENDIF. *--------------------------------------------------------------------* * bold *--------------------------------------------------------------------* lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'b' ). IF lo_ixml_element IS BOUND. CLEAR lv_val. lv_val = lo_ixml_element->get_attribute_ns( 'val' ). IF lv_val <> '0'. ls_cstyle-font-bold = 'X'. ls_cstylex-font-bold = 'X'. ENDIF. ENDIF. *--------------------------------------------------------------------* * strikethrough *--------------------------------------------------------------------* lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'strike' ). IF lo_ixml_element IS BOUND. CLEAR lv_val. lv_val = lo_ixml_element->get_attribute_ns( 'val' ). IF lv_val <> '0'. ls_cstyle-font-strikethrough = 'X'. ls_cstylex-font-strikethrough = 'X'. ENDIF. ENDIF. *--------------------------------------------------------------------* * color *--------------------------------------------------------------------* lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'color' ). IF lo_ixml_element IS BOUND. CLEAR lv_val. lv_val = lo_ixml_element->get_attribute_ns( 'rgb' ). ls_cstyle-font-color-rgb = lv_val. ls_cstylex-font-color-rgb = 'X'. ENDIF. WHEN 'fill'. lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'patternFill' ). IF lo_ixml_element IS BOUND. lo_ixml_element2 = lo_ixml_element->find_from_name( 'bgColor' ). IF lo_ixml_element2 IS BOUND. CLEAR lv_val. lv_val = lo_ixml_element2->get_attribute_ns( 'rgb' ). IF lv_val IS NOT INITIAL. ls_cstyle-fill-filltype = zcl_excel_style_fill=>c_fill_solid. ls_cstyle-fill-bgcolor-rgb = lv_val. ls_cstylex-fill-filltype = 'X'. ls_cstylex-fill-bgcolor-rgb = 'X'. ENDIF. ENDIF. CLEAR lv_val. lv_val = lo_ixml_element2->get_attribute_ns( 'theme' ). IF lv_val IS NOT INITIAL. ls_cstyle-fill-filltype = zcl_excel_style_fill=>c_fill_solid. ls_cstyle-fill-bgcolor-theme = lv_val. ls_cstylex-fill-filltype = 'X'. ls_cstylex-fill-bgcolor-theme = 'X'. ENDIF. ENDIF. * 2do - borders into dxf-styles. Here and in writerclass * WHEN 'border'. * lo_ixml_element = lo_ixml_dxf_child->find_from_name( 'left' ). * IF lo_ixml_element IS BOUND. * CLEAR lv_val. * lv_val = lo_ixml_element2->get_attribute_ns( 'style' ). * IF lv_val IS NOT INITIAL. * ls_cstyle-borders-left-border_style = lv_val. * ls_cstylex-borders-left-border_style = 'X'. * ENDIF. * ENDIF. ENDCASE. lo_ixml_dxf_child ?= lo_ixml_iterator_dxf_children->get_next( ). ENDWHILE. rv_style_guid = io_excel->get_static_cellstyle_guid( ip_cstyle_complete = ls_cstyle ip_cstylex_complete = ls_cstylex ). ENDMETHOD. METHOD get_from_zip_archive. ASSERT zip IS BOUND. " zip object has to exist at this point r_content = zip->read( i_filename ). ENDMETHOD. METHOD get_ixml_from_zip_archive. DATA: lv_content TYPE xstring, lo_ixml TYPE REF TO if_ixml, lo_streamfactory TYPE REF TO if_ixml_stream_factory, lo_istream TYPE REF TO if_ixml_istream, lo_parser TYPE REF TO if_ixml_parser. *--------------------------------------------------------------------* * Load XML file from archive into an input stream, * and parse that stream into an ixml object *--------------------------------------------------------------------* lv_content = me->get_from_zip_archive( i_filename ). lo_ixml = cl_ixml=>create( ). lo_streamfactory = lo_ixml->create_stream_factory( ). lo_istream = lo_streamfactory->create_istream_xstring( lv_content ). r_ixml = lo_ixml->create_document( ). lo_parser = lo_ixml->create_parser( stream_factory = lo_streamfactory istream = lo_istream document = r_ixml ). lo_parser->set_normalizing( is_normalizing ). lo_parser->set_validating( mode = if_ixml_parser=>co_no_validation ). lo_parser->parse( ). ENDMETHOD. METHOD load_drawing_anchor. TYPES: BEGIN OF t_c_nv_pr, name TYPE string, id TYPE string, END OF t_c_nv_pr. TYPES: BEGIN OF t_blip, cstate TYPE string, embed TYPE string, END OF t_blip. TYPES: BEGIN OF t_chart, id TYPE string, END OF t_chart. TYPES: BEGIN OF t_ext, cx TYPE string, cy TYPE string, END OF t_ext. CONSTANTS: lc_xml_attr_true TYPE string VALUE 'true', lc_xml_attr_true_int TYPE string VALUE '1'. CONSTANTS: lc_rel_chart TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', lc_rel_image TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'. DATA: lo_drawing TYPE REF TO zcl_excel_drawing, node TYPE REF TO if_ixml_element, node2 TYPE REF TO if_ixml_element, node3 TYPE REF TO if_ixml_element, node4 TYPE REF TO if_ixml_element, ls_upper TYPE zexcel_drawing_location, ls_lower TYPE zexcel_drawing_location, ls_size TYPE zexcel_drawing_size, ext TYPE t_ext, lv_content TYPE xstring, lv_relation_id TYPE string, lv_title TYPE string, cnvpr TYPE t_c_nv_pr, blip TYPE t_blip, chart TYPE t_chart, drawing_type TYPE zexcel_drawing_type, rel_drawing TYPE t_rel_drawing. node ?= io_anchor_element->find_from_name( name = 'from' namespace = 'xdr' ). CHECK node IS NOT INITIAL. node2 ?= node->find_from_name( name = 'col' namespace = 'xdr' ). ls_upper-col = node2->get_value( ). node2 ?= node->find_from_name( name = 'row' namespace = 'xdr' ). ls_upper-row = node2->get_value( ). node2 ?= node->find_from_name( name = 'colOff' namespace = 'xdr' ). ls_upper-col_offset = node2->get_value( ). node2 ?= node->find_from_name( name = 'rowOff' namespace = 'xdr' ). ls_upper-row_offset = node2->get_value( ). node ?= io_anchor_element->find_from_name( name = 'ext' namespace = 'xdr' ). IF node IS INITIAL. CLEAR ls_size. ELSE. me->fill_struct_from_attributes( EXPORTING ip_element = node CHANGING cp_structure = ext ). ls_size-width = ext-cx. ls_size-height = ext-cy. TRY. ls_size-width = zcl_excel_drawing=>emu2pixel( ls_size-width ). CATCH cx_root. ENDTRY. TRY. ls_size-height = zcl_excel_drawing=>emu2pixel( ls_size-height ). CATCH cx_root. ENDTRY. ENDIF. node ?= io_anchor_element->find_from_name( name = 'to' namespace = 'xdr' ). IF node IS INITIAL. CLEAR ls_lower. ELSE. node2 ?= node->find_from_name( name = 'col' namespace = 'xdr' ). ls_lower-col = node2->get_value( ). node2 ?= node->find_from_name( name = 'row' namespace = 'xdr' ). ls_lower-row = node2->get_value( ). node2 ?= node->find_from_name( name = 'colOff' namespace = 'xdr' ). ls_lower-col_offset = node2->get_value( ). node2 ?= node->find_from_name( name = 'rowOff' namespace = 'xdr' ). ls_lower-row_offset = node2->get_value( ). ENDIF. node ?= io_anchor_element->find_from_name( name = 'pic' namespace = 'xdr' ). IF node IS NOT INITIAL. node2 ?= node->find_from_name( name = 'nvPicPr' namespace = 'xdr' ). CHECK node2 IS NOT INITIAL. node3 ?= node2->find_from_name( name = 'cNvPr' namespace = 'xdr' ). CHECK node3 IS NOT INITIAL. me->fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = cnvpr ). lv_title = cnvpr-name. node2 ?= node->find_from_name( name = 'blipFill' namespace = 'xdr' ). CHECK node2 IS NOT INITIAL. node3 ?= node2->find_from_name( name = 'blip' namespace = 'a' ). CHECK node3 IS NOT INITIAL. me->fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = blip ). lv_relation_id = blip-embed. drawing_type = zcl_excel_drawing=>type_image. ENDIF. node ?= io_anchor_element->find_from_name( name = 'graphicFrame' namespace = 'xdr' ). IF node IS NOT INITIAL. node2 ?= node->find_from_name( name = 'nvGraphicFramePr' namespace = 'xdr' ). CHECK node2 IS NOT INITIAL. node3 ?= node2->find_from_name( name = 'cNvPr' namespace = 'xdr' ). CHECK node3 IS NOT INITIAL. me->fill_struct_from_attributes( EXPORTING ip_element = node3 CHANGING cp_structure = cnvpr ). lv_title = cnvpr-name. node2 ?= node->find_from_name( name = 'graphic' namespace = 'a' ). CHECK node2 IS NOT INITIAL. node3 ?= node2->find_from_name( name = 'graphicData' namespace = 'a' ). CHECK node3 IS NOT INITIAL. node4 ?= node2->find_from_name( name = 'chart' namespace = 'c' ). CHECK node4 IS NOT INITIAL. me->fill_struct_from_attributes( EXPORTING ip_element = node4 CHANGING cp_structure = chart ). lv_relation_id = chart-id. drawing_type = zcl_excel_drawing=>type_chart. ENDIF. lo_drawing = io_worksheet->excel->add_new_drawing( ip_type = drawing_type ip_title = lv_title ). io_worksheet->add_drawing( lo_drawing ). lo_drawing->set_position2( EXPORTING ip_from = ls_upper ip_to = ls_lower ). READ TABLE it_related_drawings INTO rel_drawing WITH KEY id = lv_relation_id. lo_drawing->set_media( EXPORTING ip_media = rel_drawing-content ip_media_type = rel_drawing-file_ext ip_width = ls_size-width ip_height = ls_size-height ). IF drawing_type = zcl_excel_drawing=>type_chart. "-------------Added by Alessandro Iannacci - Should load chart attributes lo_drawing->load_chart_attributes( rel_drawing-content_xml ). ENDIF. ENDMETHOD. METHOD load_dxf_styles. DATA: lo_styles_xml TYPE REF TO if_ixml_document, lo_node_dxfs TYPE REF TO if_ixml_element, lo_nodes_dxf TYPE REF TO if_ixml_node_collection, lo_iterator_dxf TYPE REF TO if_ixml_node_iterator, lo_node_dxf TYPE REF TO if_ixml_element, lv_dxf_count TYPE i. FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF mt_dxf_styles. *--------------------------------------------------------------------* * Look for dxfs-node *--------------------------------------------------------------------* lo_styles_xml = me->get_ixml_from_zip_archive( iv_path ). lo_node_dxfs = lo_styles_xml->find_from_name( 'dxfs' ). CHECK lo_node_dxfs IS BOUND. *--------------------------------------------------------------------* * loop through all dxf-nodes and create style for each *--------------------------------------------------------------------* lo_nodes_dxf ?= lo_node_dxfs->get_elements_by_tag_name( 'dxf' ). lo_iterator_dxf = lo_nodes_dxf->create_iterator( ). lo_node_dxf ?= lo_iterator_dxf->get_next( ). WHILE lo_node_dxf IS BOUND. APPEND INITIAL LINE TO mt_dxf_styles ASSIGNING <ls_dxf_style>. <ls_dxf_style>-dxf = lv_dxf_count. " We start counting at 0 ADD 1 TO lv_dxf_count. " prepare next entry <ls_dxf_style>-guid = get_dxf_style_guid( io_ixml_dxf = lo_node_dxf io_excel = io_excel ). lo_node_dxf ?= lo_iterator_dxf->get_next( ). ENDWHILE. ENDMETHOD. method LOAD_SHARED_STRINGS. *--------------------------------------------------------------------* * ToDos: * 2do§1 Support partial formatting of strings in cells *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-11 * - ... * changes: renaming variables to naming conventions * renaming variables to indicate what they are used for * aligning code * adding comments to explain what we are trying to achieve * rewriting code for better readibility *--------------------------------------------------------------------* DATA: lo_shared_strings_xml TYPE REF TO if_ixml_document, lo_node_si TYPE REF TO if_ixml_element, lo_node_si_child TYPE REF TO if_ixml_element, lo_node_r_child_t TYPE REF TO if_ixml_element, lv_tag_name TYPE string, lv_node_value TYPE string. FIELD-SYMBOLS: <lv_shared_string> LIKE LINE OF me->shared_strings. *--------------------------------------------------------------------* * §1 Parse shared strings file and get into internal table * So far I have encountered 2 ways how a string can be represented in the shared strings file * §1.1 - "simple" strings * §1.2 - rich text formatted strings * Following is an example how this file could be set up; 2 strings in simple formatting, 3rd string rich textformatted * <?xml version="1.0" encoding="UTF-8" standalone="true"?> * <sst uniqueCount="6" count="6" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> * <si> * <t>This is a teststring 1</t> * </si> * <si> * <t>This is a teststring 2</t> * </si> * <si> * <r> * <t>T</t> * </r> * <r> * <rPr> * <sz val="11"/> * <color rgb="FFFF0000"/> * <rFont val="Calibri"/> * <family val="2"/> * <scheme val="minor"/> * </rPr> * <t xml:space="preserve">his is a </t> * </r> * <r> * <rPr> * <sz val="11"/> * <color theme="1"/> * <rFont val="Calibri"/> * <family val="2"/> * <scheme val="minor"/> * </rPr> * <t>teststring 3</t> * </r> * </si> * </sst> *--------------------------------------------------------------------* lo_shared_strings_xml = me->get_ixml_from_zip_archive( i_filename = ip_path is_normalizing = space ). " NO!!! normalizing - otherwise leading blanks will be omitted and that is not really desired for the stringtable lo_node_si ?= lo_shared_strings_xml->find_from_name( 'si' ). WHILE lo_node_si IS BOUND. APPEND INITIAL LINE TO me->shared_strings ASSIGNING <lv_shared_string>. " Each <si>-entry in the xml-file must lead to an entry in our stringtable lo_node_si_child ?= lo_node_si->get_first_child( ). IF lo_node_si_child IS BOUND. lv_tag_name = lo_node_si_child->get_name( ). IF lv_tag_name = 't'. *--------------------------------------------------------------------* * §1.1 - "simple" strings * Example: see above *--------------------------------------------------------------------* <lv_shared_string> = lo_node_si_child->get_value( ). ELSE. *--------------------------------------------------------------------* * §1.2 - rich text formatted strings * it is sufficient to strip the <t>...</t> tag from each <r>-tag and concatenate these * as long as rich text formatting is not supported (2do§1) ignore all info about formatting * Example: see above *--------------------------------------------------------------------* WHILE lo_node_si_child IS BOUND. " actually these children of <si> are <r>-tags lo_node_r_child_t ?= lo_node_si_child->find_from_name( 't' ). " extract the <t>...</t> part of each <r>-tag IF lo_node_r_child_t IS BOUND. lv_node_value = lo_node_r_child_t->get_value( ). CONCATENATE <lv_shared_string> lv_node_value INTO <lv_shared_string> RESPECTING BLANKS. ENDIF. lo_node_si_child ?= lo_node_si_child->get_next( ). ENDWHILE. ENDIF. ENDIF. lo_node_si ?= lo_node_si->get_next( ). ENDWHILE. endmethod. METHOD load_styles. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (wip ) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* TYPES: BEGIN OF lty_xf, applyalignment TYPE string, applyborder TYPE string, applyfill TYPE string, applyfont TYPE string, applynumberformat TYPE string, applyprotection TYPE string, borderid TYPE string, fillid TYPE string, fontid TYPE string, numfmtid TYPE string, pivotbutton TYPE string, quoteprefix TYPE string, xfid TYPE string, END OF lty_xf. TYPES: BEGIN OF lty_alignment, horizontal TYPE string, indent TYPE string, justifylastline TYPE string, readingorder TYPE string, relativeindent TYPE string, shrinktofit TYPE string, textrotation TYPE string, vertical TYPE string, wraptext TYPE string, END OF lty_alignment. TYPES: BEGIN OF lty_protection, hidden TYPE string, locked TYPE string, END OF lty_protection. DATA: lo_styles_xml TYPE REF TO if_ixml_document, lo_style TYPE REF TO zcl_excel_style, lt_num_formats TYPE zcl_excel_style_number_format=>t_num_formats, lt_fills TYPE t_fills, lt_borders TYPE t_borders, lt_fonts TYPE t_fonts, ls_num_format TYPE zcl_excel_style_number_format=>t_num_format , ls_fill TYPE REF TO zcl_excel_style_fill, ls_cell_border TYPE REF TO zcl_excel_style_borders, ls_font TYPE REF TO zcl_excel_style_font, lo_node_cellxfs TYPE REF TO if_ixml_element, lo_node_cellxfs_xf TYPE REF TO if_ixml_element, lo_node_cellxfs_xf_alignment TYPE REF TO if_ixml_element, lo_node_cellxfs_xf_protection TYPE REF TO if_ixml_element, lo_nodes_xf TYPE REF TO if_ixml_node_collection, lo_iterator_cellxfs TYPE REF TO if_ixml_node_iterator, ls_xf TYPE lty_xf, ls_alignment TYPE lty_alignment, ls_protection TYPE lty_protection, lv_index TYPE i. *--------------------------------------------------------------------* * To build a complete style that fully describes how a cell looks like * we need the various parts * §1 - Numberformat * §2 - Fillstyle * §3 - Borders * §4 - Font * §5 - Alignment * §6 - Protection * Following is an example how this part of a file could be set up * ... * parts with various formatinformation - see §1,§2,§3,§4 * ... * <cellXfs count="26"> * <xf numFmtId="0" borderId="0" fillId="0" fontId="0" xfId="0"/> * <xf numFmtId="0" borderId="0" fillId="2" fontId="0" xfId="0" applyFill="1"/> * <xf numFmtId="0" borderId="1" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> * <xf numFmtId="0" borderId="2" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> * <xf numFmtId="0" borderId="3" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> * <xf numFmtId="0" borderId="4" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> * <xf numFmtId="0" borderId="0" fillId="3" fontId="0" xfId="0" applyFill="1" applyBorder="1"/> * ... * </cellXfs> *--------------------------------------------------------------------* lo_styles_xml = me->get_ixml_from_zip_archive( ip_path ). *--------------------------------------------------------------------* * The styles are build up from * §1 number formats * §2 fill styles * §3 border styles * §4 fonts * These need to be read before we can try to build up a complete * style that describes the look of a cell *--------------------------------------------------------------------* lt_num_formats = load_style_num_formats( lo_styles_xml ). " §1 lt_fills = load_style_fills( lo_styles_xml ). " §2 lt_borders = load_style_borders( lo_styles_xml ). " §3 lt_fonts = load_style_fonts( lo_styles_xml ). " §4 *--------------------------------------------------------------------* * Now everything is prepared to build a "full" style *--------------------------------------------------------------------* lo_node_cellxfs = lo_styles_xml->find_from_name( name = 'cellXfs' ). IF lo_node_cellxfs IS BOUND. lo_nodes_xf = lo_node_cellxfs->get_elements_by_tag_name( name = 'xf' ). lo_iterator_cellxfs = lo_nodes_xf->create_iterator( ). lo_node_cellxfs_xf ?= lo_iterator_cellxfs->get_next( ). WHILE lo_node_cellxfs_xf IS BOUND. lo_style = ip_excel->add_new_style( ). fill_struct_from_attributes( EXPORTING ip_element = lo_node_cellxfs_xf CHANGING cp_structure = ls_xf ). *--------------------------------------------------------------------* * §2 fill style *--------------------------------------------------------------------* IF ls_xf-applyfill = '1' AND ls_xf-fillid IS NOT INITIAL. lv_index = ls_xf-fillid + 1. READ TABLE lt_fills INTO ls_fill INDEX lv_index. IF sy-subrc = 0. lo_style->fill = ls_fill. ENDIF. ENDIF. *--------------------------------------------------------------------* * §1 number format *--------------------------------------------------------------------* IF ls_xf-numfmtid IS NOT INITIAL. READ TABLE lt_num_formats INTO ls_num_format WITH TABLE KEY id = ls_xf-numfmtid. IF sy-subrc = 0. lo_style->number_format = ls_num_format-format. ENDIF. ENDIF. *--------------------------------------------------------------------* * §3 border style *--------------------------------------------------------------------* IF ls_xf-applyborder = '1' AND ls_xf-borderid IS NOT INITIAL. lv_index = ls_xf-borderid + 1. READ TABLE lt_borders INTO ls_cell_border INDEX lv_index. IF sy-subrc = 0. lo_style->borders = ls_cell_border. ENDIF. ENDIF. *--------------------------------------------------------------------* * §4 font *--------------------------------------------------------------------* IF ls_xf-applyfont = '1' AND ls_xf-fontid IS NOT INITIAL. lv_index = ls_xf-fontid + 1. READ TABLE lt_fonts INTO ls_font INDEX lv_index. IF sy-subrc = 0. lo_style->font = ls_font. ENDIF. ENDIF. *--------------------------------------------------------------------* * §5 - Alignment *--------------------------------------------------------------------* lo_node_cellxfs_xf_alignment ?= lo_node_cellxfs_xf->find_from_name( 'alignment' ). IF lo_node_cellxfs_xf_alignment IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_cellxfs_xf_alignment CHANGING cp_structure = ls_alignment ). IF ls_alignment-horizontal IS NOT INITIAL. lo_style->alignment->horizontal = ls_alignment-horizontal. ENDIF. IF ls_alignment-vertical IS NOT INITIAL. lo_style->alignment->vertical = ls_alignment-vertical. ENDIF. IF ls_alignment-textrotation IS NOT INITIAL. lo_style->alignment->textrotation = ls_alignment-textrotation. ENDIF. IF ls_alignment-wraptext = '1' OR ls_alignment-wraptext = 'true'. lo_style->alignment->wraptext = abap_true. ENDIF. IF ls_alignment-shrinktofit = '1' OR ls_alignment-shrinktofit = 'true'. lo_style->alignment->shrinktofit = abap_true. ENDIF. IF ls_alignment-indent IS NOT INITIAL. lo_style->alignment->indent = ls_alignment-indent. ENDIF. ENDIF. *--------------------------------------------------------------------* * §6 - Protection *--------------------------------------------------------------------* lo_node_cellxfs_xf_protection ?= lo_node_cellxfs_xf->find_from_name( 'protection' ). IF lo_node_cellxfs_xf_protection IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_cellxfs_xf_protection CHANGING cp_structure = ls_protection ). IF ls_protection-locked = '1' OR ls_protection-locked = 'true'. lo_style->protection->locked = zcl_excel_style_protection=>c_protection_locked. ELSE. lo_style->protection->locked = zcl_excel_style_protection=>c_protection_unlocked. ENDIF. IF ls_protection-hidden = '1' OR ls_protection-hidden = 'true'. lo_style->protection->hidden = zcl_excel_style_protection=>c_protection_hidden. ELSE. lo_style->protection->hidden = zcl_excel_style_protection=>c_protection_unhidden. ENDIF. ENDIF. INSERT lo_style INTO TABLE me->styles. lo_node_cellxfs_xf ?= lo_iterator_cellxfs->get_next( ). ENDWHILE. ENDIF. ENDMETHOD. method LOAD_STYLE_BORDERS. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code * renaming variables to indicate what they are used for * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* DATA: lo_node_border TYPE REF TO if_ixml_element, lo_node_bordertype TYPE REF TO if_ixml_element, lo_node_bordercolor TYPE REF TO if_ixml_element, lo_cell_border TYPE REF TO zcl_excel_style_borders, lo_border TYPE REF TO zcl_excel_style_border, ls_color TYPE t_color. *--------------------------------------------------------------------* * We need a table of used borderformats to build up our styles * §1 A cell has 4 outer borders and 2 diagonal "borders" * These borders can be formatted separately but the diagonal borders * are always being formatted the same * We'll parse through the <border>-tag for each of the bordertypes * §2 and read the corresponding formatting information * Following is an example how this part of a file could be set up * <border diagonalDown="1"> * <left style="mediumDashDotDot"> * <color rgb="FFFF0000"/> * </left> * <right/> * <top style="thick"> * <color rgb="FFFF0000"/> * </top> * <bottom style="thick"> * <color rgb="FFFF0000"/> * </bottom> * <diagonal style="thick"> * <color rgb="FFFF0000"/> * </diagonal> * </border> *--------------------------------------------------------------------* lo_node_border ?= ip_xml->find_from_name( 'border' ). WHILE lo_node_border IS BOUND. CREATE OBJECT lo_cell_border. *--------------------------------------------------------------------* * Diagonal borderlines are formatted the equally. Determine what kind of diagonal borders are present if any *--------------------------------------------------------------------* * DiagonalNone = 0 * DiagonalUp = 1 * DiagonalDown = 2 * DiagonalBoth = 3 *--------------------------------------------------------------------* IF lo_node_border->get_attribute( 'diagonalDown' ) IS NOT INITIAL. add zcl_excel_style_borders=>c_diagonal_down to lo_cell_border->diagonal_mode. ENDIF. IF lo_node_border->get_attribute( 'diagonalUp' ) IS NOT INITIAL. add zcl_excel_style_borders=>c_diagonal_up to lo_cell_border->diagonal_mode. ENDIF. lo_node_bordertype ?= lo_node_border->get_first_child( ). WHILE lo_node_bordertype IS BOUND. *--------------------------------------------------------------------* * §1 Determine what kind of border we are talking about *--------------------------------------------------------------------* * Up, down, left, right, diagonal *--------------------------------------------------------------------* CREATE OBJECT lo_border. CASE lo_node_bordertype->get_name( ). WHEN 'left'. lo_cell_border->left = lo_border. WHEN 'right'. lo_cell_border->right = lo_border. WHEN 'top'. lo_cell_border->top = lo_border. WHEN 'bottom'. lo_cell_border->down = lo_border. WHEN 'diagonal'. lo_cell_border->diagonal = lo_border. ENDCASE. *--------------------------------------------------------------------* * §2 Read the border-formatting *--------------------------------------------------------------------* lo_border->border_style = lo_node_bordertype->get_attribute( 'style' ). lo_node_bordercolor ?= lo_node_bordertype->find_from_name( 'color' ). IF lo_node_bordercolor IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_bordercolor CHANGING cp_structure = ls_color ). lo_border->border_color-rgb = ls_color-rgb. IF ls_color-indexed IS NOT INITIAL. lo_border->border_color-indexed = ls_color-indexed. ENDIF. IF ls_color-theme IS NOT INITIAL. lo_border->border_color-theme = ls_color-theme. ENDIF. lo_border->border_color-tint = ls_color-tint. ENDIF. lo_node_bordertype ?= lo_node_bordertype->get_next( ). ENDWHILE. INSERT lo_cell_border INTO TABLE ep_borders. lo_node_border ?= lo_node_border->get_next( ). ENDWHILE. endmethod. method LOAD_STYLE_FILLS. *--------------------------------------------------------------------* * ToDos: * 2do§1 Support gradientFill *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code * commenting on problems/future enhancements/todos we already know of or should decide upon * adding comments to explain what we are trying to achieve * renaming variables to indicate what they are used for *--------------------------------------------------------------------* DATA: lv_value TYPE string, lo_node_fill TYPE REF TO if_ixml_element, lo_node_fill_child TYPE REF TO if_ixml_element, lo_node_bgcolor TYPE REF TO if_ixml_element, lo_node_fgcolor TYPE REF TO if_ixml_element, lo_node_stop TYPE REF TO if_ixml_element, lo_fill TYPE REF TO zcl_excel_style_fill, ls_color TYPE t_color. *--------------------------------------------------------------------* * We need a table of used fillformats to build up our styles * Following is an example how this part of a file could be set up * <fill> * <patternFill patternType="gray125"/> * </fill> * <fill> * <patternFill patternType="solid"> * <fgColor rgb="FFFFFF00"/> * <bgColor indexed="64"/> * </patternFill> * </fill> *--------------------------------------------------------------------* lo_node_fill ?= ip_xml->find_from_name( 'fill' ). WHILE lo_node_fill IS BOUND. CREATE OBJECT lo_fill. lo_node_fill_child ?= lo_node_fill->get_first_child( ). lv_value = lo_node_fill_child->get_name( ). CASE lv_value. *--------------------------------------------------------------------* * Patternfill *--------------------------------------------------------------------* WHEN 'patternFill'. lo_fill->filltype = lo_node_fill_child->get_attribute( 'patternType' ). *--------------------------------------------------------------------* * Patternfill - background color *--------------------------------------------------------------------* lo_node_bgcolor = lo_node_fill_child->find_from_name( 'bgColor' ). IF lo_node_bgcolor IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_bgcolor CHANGING cp_structure = ls_color ). lo_fill->bgcolor-rgb = ls_color-rgb. IF ls_color-indexed IS NOT INITIAL. lo_fill->bgcolor-indexed = ls_color-indexed. ENDIF. IF ls_color-theme IS NOT INITIAL. lo_fill->bgcolor-theme = ls_color-theme. ENDIF. lo_fill->bgcolor-tint = ls_color-tint. ENDIF. *--------------------------------------------------------------------* * Patternfill - foreground color *--------------------------------------------------------------------* lo_node_fgcolor = lo_node_fill->find_from_name( 'fgColor' ). IF lo_node_fgcolor IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_fgcolor CHANGING cp_structure = ls_color ). lo_fill->fgcolor-rgb = ls_color-rgb. IF ls_color-indexed IS NOT INITIAL. lo_fill->fgcolor-indexed = ls_color-indexed. ENDIF. IF ls_color-theme IS NOT INITIAL. lo_fill->fgcolor-theme = ls_color-theme. ENDIF. lo_fill->fgcolor-tint = ls_color-tint. ENDIF. *--------------------------------------------------------------------* * gradientFill *--------------------------------------------------------------------* WHEN 'gradientFill'. lo_fill->gradtype-type = lo_node_fill_child->get_attribute( 'type' ). lo_fill->gradtype-top = lo_node_fill_child->get_attribute( 'top' ). lo_fill->gradtype-left = lo_node_fill_child->get_attribute( 'left' ). lo_fill->gradtype-right = lo_node_fill_child->get_attribute( 'right' ). lo_fill->gradtype-bottom = lo_node_fill_child->get_attribute( 'bottom' ). lo_fill->gradtype-degree = lo_node_fill_child->get_attribute( 'degree' ). free lo_node_stop. lo_node_stop ?= lo_node_fill_child->find_from_name( 'stop' ). while lo_node_stop is bound. if lo_fill->gradtype-position1 is initial. lo_fill->gradtype-position1 = lo_node_stop->get_attribute( 'position' ). lo_node_bgcolor = lo_node_stop->find_from_name( 'color' ). IF lo_node_bgcolor IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_bgcolor CHANGING cp_structure = ls_color ). lo_fill->bgcolor-rgb = ls_color-rgb. IF ls_color-indexed IS NOT INITIAL. lo_fill->bgcolor-indexed = ls_color-indexed. ENDIF. IF ls_color-theme IS NOT INITIAL. lo_fill->bgcolor-theme = ls_color-theme. ENDIF. lo_fill->bgcolor-tint = ls_color-tint. ENDIF. elseif lo_fill->gradtype-position2 is initial. lo_fill->gradtype-position2 = lo_node_stop->get_attribute( 'position' ). lo_node_fgcolor = lo_node_stop->find_from_name( 'color' ). IF lo_node_fgcolor IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node_fgcolor CHANGING cp_structure = ls_color ). lo_fill->fgcolor-rgb = ls_color-rgb. IF ls_color-indexed IS NOT INITIAL. lo_fill->fgcolor-indexed = ls_color-indexed. ENDIF. IF ls_color-theme IS NOT INITIAL. lo_fill->fgcolor-theme = ls_color-theme. ENDIF. lo_fill->fgcolor-tint = ls_color-tint. ENDIF. elseif lo_fill->gradtype-position3 is initial. lo_fill->gradtype-position3 = lo_node_stop->get_attribute( 'position' ). "BGColor is filled already with position 1 no need to check again endif. lo_node_stop ?= lo_node_stop->get_next( ). ENDWHILE. WHEN OTHERS. ENDCASE. INSERT lo_fill INTO TABLE ep_fills. lo_node_fill ?= lo_node_fill->get_next( ). ENDWHILE. endmethod. METHOD load_style_fonts. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * aligning code * removing unused variables * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* DATA: lo_node_font TYPE REF TO if_ixml_element, lo_node2 TYPE REF TO if_ixml_element, lo_font TYPE REF TO zcl_excel_style_font, ls_color TYPE t_color. *--------------------------------------------------------------------* * We need a table of used fonts to build up our styles * Following is an example how this part of a file could be set up * <font> * <sz val="11"/> * <color theme="1"/> * <name val="Calibri"/> * <family val="2"/> * <scheme val="minor"/> * </font> *--------------------------------------------------------------------* lo_node_font ?= ip_xml->find_from_name( 'font' ). WHILE lo_node_font IS BOUND. CREATE OBJECT lo_font. *--------------------------------------------------------------------* * Bold *--------------------------------------------------------------------* IF lo_node_font->find_from_name( 'b' ) IS BOUND. lo_font->bold = abap_true. ENDIF. *--------------------------------------------------------------------* * Italic *--------------------------------------------------------------------* IF lo_node_font->find_from_name( 'i' ) IS BOUND. lo_font->italic = abap_true. ENDIF. *--------------------------------------------------------------------* * Underline *--------------------------------------------------------------------* lo_node2 = lo_node_font->find_from_name( 'u' ). IF lo_node2 IS BOUND. lo_font->underline = abap_true. lo_font->underline_mode = lo_node2->get_attribute( 'val' ). ENDIF. *--------------------------------------------------------------------* * StrikeThrough *--------------------------------------------------------------------* IF lo_node_font->find_from_name( 'strike' ) IS BOUND. lo_font->strikethrough = abap_true. ENDIF. *--------------------------------------------------------------------* * Fontsize *--------------------------------------------------------------------* lo_node2 = lo_node_font->find_from_name( 'sz' ). IF lo_node2 IS BOUND. lo_font->size = lo_node2->get_attribute( 'val' ). ENDIF. *--------------------------------------------------------------------* * Fontname *--------------------------------------------------------------------* lo_node2 = lo_node_font->find_from_name( 'name' ). IF lo_node2 IS BOUND. lo_font->name = lo_node2->get_attribute( 'val' ). ENDIF. *--------------------------------------------------------------------* * Fontfamily *--------------------------------------------------------------------* lo_node2 = lo_node_font->find_from_name( 'family' ). IF lo_node2 IS BOUND. lo_font->family = lo_node2->get_attribute( 'val' ). ENDIF. *--------------------------------------------------------------------* * Fontscheme *--------------------------------------------------------------------* lo_node2 = lo_node_font->find_from_name( 'scheme' ). IF lo_node2 IS BOUND. lo_font->scheme = lo_node2->get_attribute( 'val' ). ELSE. CLEAR lo_font->scheme. ENDIF. *--------------------------------------------------------------------* * Fontcolor *--------------------------------------------------------------------* lo_node2 = lo_node_font->find_from_name( 'color' ). IF lo_node2 IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node2 CHANGING cp_structure = ls_color ). lo_font->color-rgb = ls_color-rgb. IF ls_color-indexed IS NOT INITIAL. lo_font->color-indexed = ls_color-indexed. ENDIF. IF ls_color-theme IS NOT INITIAL. lo_font->color-theme = ls_color-theme. ENDIF. lo_font->color-tint = ls_color-tint. ENDIF. INSERT lo_font INTO TABLE ep_fonts. lo_node_font ?= lo_node_font->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_style_num_formats. *--------------------------------------------------------------------* * ToDos: * 2do§1 Explain gaps in predefined formats *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-25 * - ... * changes: renaming variables and types to naming conventions * adding comments to explain what we are trying to achieve * aligning code *--------------------------------------------------------------------* DATA: lo_node_numfmt TYPE REF TO if_ixml_element, ls_num_format TYPE ZCL_EXCEL_STYLE_NUMBER_FORMAT=>T_NUM_FORMAT . *--------------------------------------------------------------------* * We need a table of used numberformats to build up our styles * there are two kinds of numberformats * §1 built-in numberformats * §2 and those that have been explicitly added by the createor of the excel-file *--------------------------------------------------------------------* *--------------------------------------------------------------------* * §1 built-in numberformats *--------------------------------------------------------------------* ep_num_formats = ZCL_EXCEL_STYLE_NUMBER_FORMAT=>mt_built_in_num_formats. *--------------------------------------------------------------------* * §2 Get non-internal numberformats that are found in the file explicitly * Following is an example how this part of a file could be set up * <numFmts count="1"> * <numFmt formatCode="#,###,###,###,##0.00" numFmtId="164"/> * </numFmts> *--------------------------------------------------------------------* lo_node_numfmt ?= ip_xml->find_from_name( 'numFmt' ). WHILE lo_node_numfmt IS BOUND. CLEAR ls_num_format. CREATE OBJECT ls_num_format-format. ls_num_format-format->format_code = lo_node_numfmt->get_attribute( 'formatCode' ). ls_num_format-id = lo_node_numfmt->get_attribute( 'numFmtId' ). INSERT ls_num_format INTO TABLE ep_num_formats. lo_node_numfmt ?= lo_node_numfmt->get_next( ). ENDWHILE. ENDMETHOD. method load_theme. data theme type ref to zcl_excel_theme. data: lo_theme_xml type ref to if_ixml_document. create object theme. lo_theme_xml = me->get_ixml_from_zip_archive( iv_path ). theme->read_theme( io_theme_xml = lo_theme_xml ). ip_excel->set_theme( io_theme = theme ). endmethod. method LOAD_WORKBOOK. *--------------------------------------------------------------------* * ToDos: * 2do§1 Move macro-reading from zcl_excel_reader_xlsm to this class * autodetect existance of macro/vba content * Allow inputparameter to explicitly tell reader to ignore vba-content *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-10 * - ... * changes: renaming variables to naming conventions * aligning code * removing unused variables * adding me-> where possible * renaming variables to indicate what they are used for * adding comments to explain what we are trying to achieve * renaming i/o parameters: previous input-parameter ip_path holds a (full) filename and not a path --> rename to iv_workbook_full_filename * ip_excel renamed while being at it --> rename to io_excel *--------------------------------------------------------------------* * issue #232 - Read worksheetstate hidden/veryHidden * - Stefan Schmoecker, 2012-11-11 *--------------------------------------------------------------------* * issue#235 - repeat rows/columns * - Stefan Schmoecker, 2012-12-02 * changes: correction in named ranges to correctly attach * sheetlocal names/ranges to the correct sheet *--------------------------------------------------------------------* * issue#284 - Copied formulae ignored when reading excelfile * - Stefan Schmoecker, 2013-08-02 * changes: initialize area to hold referenced formulaedata * after all worksheets have been read resolve formuae *--------------------------------------------------------------------* CONSTANTS: lcv_shared_strings TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings', lcv_worksheet TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet', lcv_styles TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', lcv_vba_project TYPE string VALUE 'http://schemas.microsoft.com/office/2006/relationships/vbaProject', "#EC NEEDED for future incorporation of XLSM-reader lcv_theme TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', *--------------------------------------------------------------------* * #232: Read worksheetstate hidden/veryHidden - begin data declarations *--------------------------------------------------------------------* lcv_worksheet_state_hidden TYPE string VALUE 'hidden', lcv_worksheet_state_veryhidden TYPE string VALUE 'veryHidden'. *--------------------------------------------------------------------* * #232: Read worksheetstate hidden/veryHidden - end data declarations *--------------------------------------------------------------------* DATA: lv_path TYPE string, lv_filename TYPE chkfile, lv_full_filename TYPE string, lo_rels_workbook TYPE REF TO if_ixml_document, lt_worksheets TYPE STANDARD TABLE OF t_relationship WITH NON-UNIQUE DEFAULT KEY, lo_workbook TYPE REF TO if_ixml_document, lv_workbook_index TYPE i, lv_worksheet_path TYPE string, ls_sheet TYPE t_sheet, lo_node TYPE REF TO if_ixml_element, ls_relationship TYPE t_relationship, lo_worksheet TYPE REF TO zcl_excel_worksheet, lo_range TYPE REF TO zcl_excel_range, lv_worksheet_title TYPE zexcel_sheet_title, lv_tabix TYPE sytabix, " #235 - repeat rows/cols. Needed to link defined name to correct worksheet ls_range TYPE t_range, lv_range_value TYPE zexcel_range_value, *--------------------------------------------------------------------* * #229: Set active worksheet - begin data declarations *--------------------------------------------------------------------* lv_active_sheet_string TYPE string, lv_zexcel_active_worksheet TYPE zexcel_active_worksheet, *--------------------------------------------------------------------* * issue#235 - repeat rows/columns - added autofilter support while changing this section lo_autofilter TYPE REF TO zcl_excel_autofilter, ls_area TYPE zexcel_s_autofilter_area, lv_col_start_alpha TYPE zexcel_cell_column_alpha, lv_col_end_alpha TYPE zexcel_cell_column_alpha, lv_row_start TYPE zexcel_cell_row, lv_row_end TYPE zexcel_cell_row , lv_regex TYPE string, lv_range_value_1 TYPE zexcel_range_value, lv_range_value_2 TYPE zexcel_range_value. *--------------------------------------------------------------------* * #229: Set active worksheet - end data declarations *--------------------------------------------------------------------* FIELD-SYMBOLS: <worksheet> TYPE t_relationship. *--------------------------------------------------------------------* * §1 Get the position of files related to this workbook * Usually this will be <root>/xl/workbook.xml * Thus the workbookroot will be <root>/xl/ * The position of all related files will be given in file * <workbookroot>/_rels/<workbookfilename>.rels and their positions * be be given relative to the workbookroot * Following is an example how this file could be set up * <?xml version="1.0" encoding="UTF-8" standalone="true"?> * <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> * <Relationship Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Id="rId6"/> * <Relationship Target="theme/theme1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Id="rId5"/> * <Relationship Target="worksheets/sheet1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId1"/> * <Relationship Target="worksheets/sheet2.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId2"/> * <Relationship Target="worksheets/sheet3.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId3"/> * <Relationship Target="worksheets/sheet4.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Id="rId4"/> * <Relationship Target="sharedStrings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Id="rId7"/> * </Relationships> * * §2 Load data that is relevant to the complete workbook * Currently supported is: * §2.1 Shared strings - This holds all strings that are used in all worksheets * §2.2 Styles - This holds all styles that are used in all worksheets * §2.3 Worksheets - For each worksheet in the workbook one entry appears here to point to the file that holds the content of this worksheet * §2.4 [Themes] - not supported * §2.5 [VBA (Macro)] - supported in class zcl_excel_reader_xlsm but should be moved here and autodetect * ... * * §3 Some information is held in the workbookfile as well * §3.1 Names and order of of worksheets * §3.2 Active worksheet * §3.3 Defined names * ... * Following is an example how this file could be set up * <?xml version="1.0" encoding="UTF-8" standalone="true"?> * <workbook xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> * <fileVersion rupBuild="4506" lowestEdited="4" lastEdited="4" appName="xl"/> * <workbookPr defaultThemeVersion="124226"/> * <bookViews> * <workbookView activeTab="1" windowHeight="8445" windowWidth="19035" yWindow="120" xWindow="120"/> * </bookViews> * <sheets> * <sheet r:id="rId1" sheetId="1" name="Sheet1"/> * <sheet r:id="rId2" sheetId="2" name="Sheet2"/> * <sheet r:id="rId3" sheetId="3" name="Sheet3" state="hidden"/> * <sheet r:id="rId4" sheetId="4" name="Sheet4"/> * </sheets> * <definedNames/> * <calcPr calcId="125725"/> * </workbook> *--------------------------------------------------------------------* CLEAR me->mt_ref_formulae. " ins issue#284 *--------------------------------------------------------------------* * §1 Get the position of files related to this workbook * Entry into this method is with the filename of the workbook *--------------------------------------------------------------------* CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' EXPORTING full_name = iv_workbook_full_filename IMPORTING stripped_name = lv_filename file_path = lv_path. CONCATENATE lv_path '_rels/' lv_filename '.rels' INTO lv_full_filename. lo_rels_workbook = me->get_ixml_from_zip_archive( lv_full_filename ). lo_node ?= lo_rels_workbook->find_from_name( 'Relationship' ). "#EC NOTEXT WHILE lo_node IS BOUND. me->fill_struct_from_attributes( EXPORTING ip_element = lo_node CHANGING cp_structure = ls_relationship ). CASE ls_relationship-type. *--------------------------------------------------------------------* * §2.1 Shared strings - This holds all strings that are used in all worksheets *--------------------------------------------------------------------* WHEN lcv_shared_strings. CONCATENATE lv_path ls_relationship-target INTO lv_full_filename. me->load_shared_strings( lv_full_filename ). *--------------------------------------------------------------------* * §2.3 Worksheets * For each worksheet in the workbook one entry appears here to point to the file that holds the content of this worksheet * Shared strings and styles have to be present before we can start with creating the worksheets * thus we only store this information for use when parsing the workbookfile for sheetinformations *--------------------------------------------------------------------* WHEN lcv_worksheet. APPEND ls_relationship TO lt_worksheets. *--------------------------------------------------------------------* * §2.2 Styles - This holds the styles that are used in all worksheets *--------------------------------------------------------------------* WHEN lcv_styles. CONCATENATE lv_path ls_relationship-target INTO lv_full_filename. me->load_styles( ip_path = lv_full_filename ip_excel = io_excel ). me->load_dxf_styles( iv_path = lv_full_filename io_excel = io_excel ). when lcv_theme. CONCATENATE lv_path ls_relationship-target INTO lv_full_filename. me->load_theme( exporting iv_path = lv_full_filename ip_excel = io_excel " Excel creator ). WHEN OTHERS. ENDCASE. lo_node ?= lo_node->get_next( ). ENDWHILE. *--------------------------------------------------------------------* * §3 Some information held in the workbookfile *--------------------------------------------------------------------* lo_workbook = me->get_ixml_from_zip_archive( iv_workbook_full_filename ). *--------------------------------------------------------------------* * §3.1 Names and order of of worksheets *--------------------------------------------------------------------* lo_node ?= lo_workbook->find_from_name( 'sheet' ). lv_workbook_index = 1. WHILE lo_node IS BOUND. me->fill_struct_from_attributes( EXPORTING ip_element = lo_node CHANGING cp_structure = ls_sheet ). *--------------------------------------------------------------------* * Create new worksheet in workbook with correct name *--------------------------------------------------------------------* lv_worksheet_title = ls_sheet-name. IF lv_workbook_index = 1. " First sheet has been added automatically by creating io_excel lo_worksheet = io_excel->get_active_worksheet( ). lo_worksheet->set_title( lv_worksheet_title ). ELSE. lo_worksheet = io_excel->add_new_worksheet( lv_worksheet_title ). ENDIF. *--------------------------------------------------------------------* * #232 - Read worksheetstate hidden/veryHidden - begin of coding * Set status hidden if necessary *--------------------------------------------------------------------* CASE ls_sheet-state. WHEN lcv_worksheet_state_hidden. lo_worksheet->zif_excel_sheet_properties~hidden = zif_excel_sheet_properties=>c_hidden. WHEN lcv_worksheet_state_veryhidden. lo_worksheet->zif_excel_sheet_properties~hidden = zif_excel_sheet_properties=>c_veryhidden. ENDCASE. *--------------------------------------------------------------------* * #232 - Read worksheetstate hidden/veryHidden - end of coding *--------------------------------------------------------------------* *--------------------------------------------------------------------* * Load worksheetdata *--------------------------------------------------------------------* READ TABLE lt_worksheets ASSIGNING <worksheet> WITH KEY id = ls_sheet-id. IF sy-subrc = 0. <worksheet>-sheetid = ls_sheet-sheetid. "ins #235 - repeat rows/cols - needed to identify correct sheet CONCATENATE lv_path <worksheet>-target INTO lv_worksheet_path. me->load_worksheet( ip_path = lv_worksheet_path io_worksheet = lo_worksheet ). <worksheet>-worksheet = lo_worksheet. ENDIF. lo_node ?= lo_node->get_next( ). ADD 1 TO lv_workbook_index. ENDWHILE. SORT lt_worksheets BY sheetid. " needed for localSheetid -referencing *--------------------------------------------------------------------* * #284: Set active worksheet - Resolve referenced formulae to * explicit formulae those cells *--------------------------------------------------------------------* me->resolve_referenced_formulae( ). " ins issue#284 *--------------------------------------------------------------------* * #229: Set active worksheet - begin coding * §3.2 Active worksheet *--------------------------------------------------------------------* lv_zexcel_active_worksheet = 1. " First sheet = active sheet if nothing else specified. lo_node ?= lo_workbook->find_from_name( 'workbookView' ). IF lo_node IS BOUND. lv_active_sheet_string = lo_node->get_attribute( 'activeTab' ). TRY. lv_zexcel_active_worksheet = lv_active_sheet_string + 1. " EXCEL numbers the sheets from 0 onwards --> index into worksheettable is increased by one CATCH cx_sy_conversion_error. "#EC NO_HANDLER - error here --> just use the default 1st sheet ENDTRY. ENDIF. io_excel->set_active_sheet_index( lv_zexcel_active_worksheet ). *--------------------------------------------------------------------* * #229: Set active worksheet - end coding *--------------------------------------------------------------------* *--------------------------------------------------------------------* * §3.3 Defined names * So far I have encountered these * - named ranges - sheetlocal * - named ranges - workbookglobal * - autofilters - sheetlocal ( special range ) * - repeat rows/cols - sheetlocal ( special range ) * *--------------------------------------------------------------------* lo_node ?= lo_workbook->find_from_name( 'definedName' ). WHILE lo_node IS BOUND. CLEAR lo_range. "ins issue #235 - repeat rows/cols me->fill_struct_from_attributes( EXPORTING ip_element = lo_node CHANGING cp_structure = ls_range ). lv_range_value = lo_node->get_value( ). IF ls_range-localsheetid IS NOT INITIAL. " issue #163+ * READ TABLE lt_worksheets ASSIGNING <worksheet> WITH KEY id = ls_range-localsheetid. "del issue #235 - repeat rows/cols " issue #163+ * lo_range = <worksheet>-worksheet->add_new_range( ). "del issue #235 - repeat rows/cols " issue #163+ *--------------------------------------------------------------------* * issue#235 - repeat rows/columns - begin *--------------------------------------------------------------------* lv_tabix = ls_range-localsheetid + 1. READ TABLE lt_worksheets ASSIGNING <worksheet> INDEX lv_tabix. IF sy-subrc = 0. CASE ls_range-name. *--------------------------------------------------------------------* * insert autofilters *--------------------------------------------------------------------* WHEN zcl_excel_autofilters=>c_autofilter. lo_autofilter = io_excel->add_new_autofilter( io_sheet = <worksheet>-worksheet ) . zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value IMPORTING e_column_start = lv_col_start_alpha e_column_end = lv_col_end_alpha e_row_start = ls_area-row_start e_row_end = ls_area-row_end ). ls_area-col_start = zcl_excel_common=>convert_column2int( lv_col_start_alpha ). ls_area-col_end = zcl_excel_common=>convert_column2int( lv_col_end_alpha ). lo_autofilter->set_filter_area( is_area = ls_area ). *--------------------------------------------------------------------* * repeat print rows/columns *--------------------------------------------------------------------* WHEN zif_excel_sheet_printsettings=>gcv_print_title_name. lo_range = <worksheet>-worksheet->add_new_range( ). *--------------------------------------------------------------------* * This might be a temporary solution. Maybe ranges get be reworked * to support areas consisting of multiple rectangles * But for now just split the range into row and columnpart *--------------------------------------------------------------------* CLEAR:lv_range_value_1, lv_range_value_2. IF lv_range_value IS INITIAL. * Empty --> nothing to do ELSE. IF lv_range_value(1) = `'`. " Escaped lv_regex = `^('[^']*')+![^,]*,`. ELSE. lv_regex = `^[^!]*![^,]*,`. ENDIF. * Split into two ranges if necessary FIND REGEX lv_regex IN lv_range_value MATCH LENGTH sy-fdpos. IF sy-subrc = 0 AND sy-fdpos > 0. lv_range_value_2 = lv_range_value+sy-fdpos. SUBTRACT 1 FROM sy-fdpos. lv_range_value_1 = lv_range_value(sy-fdpos). ELSE. lv_range_value_1 = lv_range_value. ENDIF. ENDIF. * 1st range zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value_1 IMPORTING e_column_start = lv_col_start_alpha e_column_end = lv_col_end_alpha e_row_start = lv_row_start e_row_end = lv_row_end ). IF lv_col_start_alpha IS NOT INITIAL. <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_columns( iv_columns_from = lv_col_start_alpha iv_columns_to = lv_col_end_alpha ). ENDIF. IF lv_row_start IS NOT INITIAL. <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_rows( iv_rows_from = lv_row_start iv_rows_to = lv_row_end ). ENDIF. * 2nd range zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_range_value_2 IMPORTING e_column_start = lv_col_start_alpha e_column_end = lv_col_end_alpha e_row_start = lv_row_start e_row_end = lv_row_end ). IF lv_col_start_alpha IS NOT INITIAL. <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_columns( iv_columns_from = lv_col_start_alpha iv_columns_to = lv_col_end_alpha ). ENDIF. IF lv_row_start IS NOT INITIAL. <worksheet>-worksheet->zif_excel_sheet_printsettings~set_print_repeat_rows( iv_rows_from = lv_row_start iv_rows_to = lv_row_end ). ENDIF. WHEN OTHERS. ENDCASE. ENDIF. *--------------------------------------------------------------------* * issue#235 - repeat rows/columns - end *--------------------------------------------------------------------* ELSE. " issue #163+ lo_range = io_excel->add_new_range( ). " issue #163+ ENDIF. " issue #163+ * lo_range = ip_excel->add_new_range( ). " issue #163- IF lo_range IS BOUND. "ins issue #235 - repeat rows/cols lo_range->name = ls_range-name. lo_range->set_range_value( lv_range_value ). ENDIF. "ins issue #235 - repeat rows/cols lo_node ?= lo_node->get_next( ). ENDWHILE. endmethod. METHOD load_worksheet. *--------------------------------------------------------------------* * ToDos: * 2do§1 Header/footer * * Please don't just delete these ToDos if they are not * needed but leave a comment that states this *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, * - ... * changes: renaming variables to naming conventions * aligning code (started) * add a list of open ToDos here * adding comments to explain what we are trying to achieve (started) *--------------------------------------------------------------------* * issue #345 - Dump on small pagemargins * Took the chance to modularize this very long method * by extracting the code that needed correction into * own method ( load_worksheet_pagemargins ) *--------------------------------------------------------------------* TYPES: BEGIN OF lty_cell, r TYPE string, t TYPE string, s TYPE string, END OF lty_cell. TYPES: BEGIN OF lty_column, min TYPE string, max TYPE string, width TYPE float, customwidth TYPE string, style TYPE string, bestfit TYPE string, collapsed TYPE string, hidden TYPE string, outlinelevel TYPE string, END OF lty_column. TYPES: BEGIN OF lty_sheetview, showgridlines TYPE zexcel_show_gridlines, tabselected TYPE string, zoomscalenormal TYPE string, workbookviewid TYPE string, showrowcolheaders TYPE string, END OF lty_sheetview. TYPES: BEGIN OF lty_mergecell, ref TYPE string, END OF lty_mergecell. TYPES: BEGIN OF lty_row, r TYPE string, customheight TYPE string, ht TYPE float, spans TYPE string, thickbot TYPE string, customformat TYPE string, thicktop TYPE string, collapsed TYPE string, hidden TYPE string, outlinelevel TYPE string, END OF lty_row. TYPES: BEGIN OF lty_page_setup, id TYPE string, orientation TYPE string, scale TYPE string, fittoheight TYPE string, fittowidth TYPE string, END OF lty_page_setup. TYPES: BEGIN OF lty_sheetformatpr, customheight TYPE string, defaultrowheight TYPE string, customwidth TYPE string, defaultcolwidth TYPE string, END OF lty_sheetformatpr. TYPES: BEGIN OF lty_headerfooter, alignwithmargins TYPE string, differentoddeven TYPE string, END OF lty_headerfooter. TYPES: BEGIN OF lty_tabcolor, rgb TYPE string, theme TYPE string, END OF lty_tabcolor. TYPES: BEGIN OF lty_datavalidation, type TYPE zexcel_data_val_type, allowblank TYPE flag, showinputmessage TYPE flag, showerrormessage TYPE flag, showdropdown TYPE flag, operator TYPE zexcel_data_val_operator, formula1 TYPE zexcel_validation_formula1, formula2 TYPE zexcel_validation_formula1, sqref TYPE string, cell_column TYPE zexcel_cell_column_alpha, cell_column_to TYPE zexcel_cell_column_alpha, cell_row TYPE zexcel_cell_row, cell_row_to TYPE zexcel_cell_row, error TYPE string, errortitle TYPE string, prompt TYPE string, prompttitle TYPE string, errorstyle TYPE zexcel_data_val_error_style, END OF lty_datavalidation. CONSTANTS: lc_xml_attr_true TYPE string VALUE 'true', lc_xml_attr_true_int TYPE string VALUE '1', lc_rel_drawing TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing', lc_rel_hyperlink TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink', lc_rel_printer TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings'. DATA: lo_ixml_worksheet TYPE REF TO if_ixml_document, lo_ixml_cells TYPE REF TO if_ixml_node_collection, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml_iterator2 TYPE REF TO if_ixml_node_iterator, lo_ixml_row_elem TYPE REF TO if_ixml_element, lo_ixml_cell_elem TYPE REF TO if_ixml_element, ls_cell TYPE lty_cell, lv_index TYPE i, lo_ixml_value_elem TYPE REF TO if_ixml_element, lo_ixml_formula_elem TYPE REF TO if_ixml_element, lv_cell_value TYPE zexcel_cell_value, lv_cell_formula TYPE zexcel_cell_formula, lv_cell_column TYPE zexcel_cell_column_alpha, lv_cell_row TYPE zexcel_cell_row, lo_excel_style TYPE REF TO zcl_excel_style, lv_style_guid TYPE zexcel_cell_style, lo_ixml_imension_elem TYPE REF TO if_ixml_element, "#+234 lv_dimension_range TYPE string, "#+234 lo_ixml_sheetview_elem TYPE REF TO if_ixml_element, ls_sheetview TYPE lty_sheetview, lo_ixml_pane_elem TYPE REF TO if_ixml_element, ls_excel_pane TYPE zexcel_pane, lv_pane_cell_row TYPE zexcel_cell_row, lv_pane_cell_col_a TYPE zexcel_cell_column_alpha, lv_pane_cell_col TYPE zexcel_cell_column, lo_ixml_mergecells TYPE REF TO if_ixml_node_collection, lo_ixml_mergecell_elem TYPE REF TO if_ixml_element, ls_mergecell TYPE lty_mergecell, lv_merge_column_start TYPE zexcel_cell_column_alpha, lv_merge_column_end TYPE zexcel_cell_column_alpha, lv_merge_row_start TYPE zexcel_cell_row, lv_merge_row_end TYPE zexcel_cell_row, lo_ixml_sheetformatpr_elem TYPE REF TO if_ixml_element, ls_sheetformatpr TYPE lty_sheetformatpr, lv_height TYPE float, lo_ixml_headerfooter_elem TYPE REF TO if_ixml_element, ls_headerfooter TYPE lty_headerfooter, 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, lo_ixml_hf_value_elem TYPE REF TO if_ixml_element, lo_ixml_pagesetup_elem TYPE REF TO if_ixml_element, lo_ixml_sheetpr TYPE REF TO if_ixml_element, lv_fit_to_page TYPE string, ls_pagesetup TYPE lty_page_setup, lo_ixml_columns TYPE REF TO if_ixml_node_collection, lo_ixml_column_elem TYPE REF TO if_ixml_element, ls_column TYPE lty_column, lv_column_alpha TYPE zexcel_cell_column_alpha, lo_column_dimension TYPE REF TO zcl_excel_worksheet_columndime, lv_outline_level TYPE int4, lo_ixml_tabcolor TYPE REF TO if_ixml_element, ls_tabcolor TYPE lty_tabcolor, ls_excel_s_tabcolor TYPE zexcel_s_tabcolor, lo_ixml_rows TYPE REF TO if_ixml_node_collection, ls_row TYPE lty_row, lv_max_col TYPE i, "for use with SPANS element * lv_min_col TYPE i, "for use with SPANS element " not in use currently lv_max_col_s TYPE char10, "for use with SPANS element lv_min_col_s TYPE char10, "for use with SPANS element lo_row_dimension TYPE REF TO zcl_excel_worksheet_rowdimensi, *--- End of current code aligning ------------------------------------------------------------------- lv_path TYPE string, lo_ixml_node TYPE REF TO if_ixml_element, ls_relationship TYPE t_relationship, lo_ixml_rels_worksheet TYPE REF TO if_ixml_document, lv_rels_worksheet_path TYPE string, lv_stripped_name TYPE chkfile, lv_dirname TYPE string, lt_external_hyperlinks TYPE gtt_external_hyperlinks, ls_external_hyperlink LIKE LINE OF lt_external_hyperlinks, lo_ixml_datavalidations TYPE REF TO if_ixml_node_collection, lo_ixml_datavalidation_elem TYPE REF TO if_ixml_element, ls_datavalidation TYPE lty_datavalidation, lo_data_validation TYPE REF TO zcl_excel_data_validation, lv_datavalidation_range TYPE string, lt_datavalidation_range TYPE TABLE OF string. *--------------------------------------------------------------------* * §2 We need to read the the file "\\_rels\.rels" because it tells * us where in this folder structure the data for the workbook * is located in the xlsx zip-archive * * The xlsx Zip-archive has generally the following folder structure: * <root> | * |--> _rels * |--> doc_Props * |--> xl | * |--> _rels * |--> theme * |--> worksheets *--------------------------------------------------------------------* " Read Workbook Relationships CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' EXPORTING full_name = ip_path IMPORTING stripped_name = lv_stripped_name file_path = lv_dirname. CONCATENATE lv_dirname '_rels/' lv_stripped_name '.rels' INTO lv_rels_worksheet_path. TRY. " +#222 _rels/xxx.rels might not be present. If not found there can be no drawings --> just ignore this section lo_ixml_rels_worksheet = me->get_ixml_from_zip_archive( lv_rels_worksheet_path ). lo_ixml_node ?= lo_ixml_rels_worksheet->find_from_name( 'Relationship' ). CATCH zcx_excel. "#EC NO_HANDLER +#222 " +#222 No errorhandling necessary - node will be unbound if error occurs ENDTRY. " +#222 WHILE lo_ixml_node IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_node CHANGING cp_structure = ls_relationship ). CONCATENATE lv_dirname ls_relationship-target INTO lv_path. lv_path = resolve_path( lv_path ). CASE ls_relationship-type. WHEN lc_rel_drawing. " Read Drawings * Issue # 339 Not all drawings are in the path mentioned below. * Some Excel elements like textfields (which we don't support ) have a drawing-part in the relationsships * but no "xl/drawings/_rels/drawing____.xml.rels" part. * Since we don't support these there is no need to read them. Catching exceptions thrown * in the "load_worksheet_drawing" shouldn't lead to an abortion of the reading TRY. me->load_worksheet_drawing( ip_path = lv_path io_worksheet = io_worksheet ). CATCH zcx_excel. "--> then ignore it ENDTRY. WHEN lc_rel_printer. " Read Printer settings WHEN lc_rel_hyperlink. MOVE-CORRESPONDING ls_relationship TO ls_external_hyperlink. INSERT ls_external_hyperlink INTO TABLE lt_external_hyperlinks. WHEN OTHERS. ENDCASE. lo_ixml_node ?= lo_ixml_node->get_next( ). ENDWHILE. lo_ixml_worksheet = me->get_ixml_from_zip_archive( ip_path ). lo_ixml_tabcolor ?= lo_ixml_worksheet->find_from_name( 'tabColor' ). IF lo_ixml_tabcolor IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_tabcolor CHANGING cp_structure = ls_tabcolor ). * Theme not supported yet IF ls_tabcolor-rgb IS NOT INITIAL. ls_excel_s_tabcolor-rgb = ls_tabcolor-rgb. io_worksheet->set_tabcolor( ls_excel_s_tabcolor ). ENDIF. ENDIF. lo_ixml_rows = lo_ixml_worksheet->get_elements_by_tag_name( name = 'row' ). lo_ixml_iterator = lo_ixml_rows->create_iterator( ). lo_ixml_row_elem ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml_row_elem IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_row_elem CHANGING cp_structure = ls_row ). SPLIT ls_row-spans AT ':' INTO lv_min_col_s lv_max_col_s. lv_index = lv_max_col_s. IF lv_index > lv_max_col. lv_max_col = lv_index. ENDIF. lv_cell_row = ls_row-r. IF ls_row-customheight = '1' OR ls_row-collapsed = lc_xml_attr_true OR ls_row-collapsed = lc_xml_attr_true_int OR ls_row-hidden = lc_xml_attr_true OR ls_row-hidden = lc_xml_attr_true_int OR ls_row-outlinelevel > '0'. lo_row_dimension = io_worksheet->get_row_dimension( lv_cell_row ). IF ls_row-customheight = '1'. lo_row_dimension->set_row_height( ls_row-ht ). ENDIF. IF ls_row-collapsed = lc_xml_attr_true OR ls_row-collapsed = lc_xml_attr_true_int. lo_row_dimension->set_collapsed( abap_true ). ENDIF. IF ls_row-hidden = lc_xml_attr_true OR ls_row-hidden = lc_xml_attr_true_int. lo_row_dimension->set_visible( abap_false ). ENDIF. IF ls_row-outlinelevel > ''. * outline_level = condense( row-outlineLevel ). "For basis 7.02 and higher CONDENSE ls_row-outlinelevel. lv_outline_level = ls_row-outlinelevel. IF lv_outline_level > 0. lo_row_dimension->set_outline_level( lv_outline_level ). ENDIF. ENDIF. ENDIF. lo_ixml_cells = lo_ixml_row_elem->get_elements_by_tag_name( name = 'c' ). lo_ixml_iterator2 = lo_ixml_cells->create_iterator( ). lo_ixml_cell_elem ?= lo_ixml_iterator2->get_next( ). WHILE lo_ixml_cell_elem IS BOUND. CLEAR: lv_cell_value, lv_cell_formula, lv_style_guid. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_cell_elem CHANGING cp_structure = ls_cell ). lo_ixml_value_elem = lo_ixml_cell_elem->find_from_name( name = 'v' ). CASE ls_cell-t. WHEN 's'. " String values are stored as index in shared string table lv_index = lo_ixml_value_elem->get_value( ) + 1. READ TABLE shared_strings INTO lv_cell_value INDEX lv_index. WHEN 'inlineStr'. " inlineStr values are kept in special node lo_ixml_value_elem = lo_ixml_cell_elem->find_from_name( name = 'is' ). IF lo_ixml_value_elem IS BOUND. lv_cell_value = lo_ixml_value_elem->get_value( ). ENDIF. WHEN OTHERS. "other types are stored directly IF lo_ixml_value_elem IS BOUND. lv_cell_value = lo_ixml_value_elem->get_value( ). ENDIF. ENDCASE. CLEAR lv_style_guid. "read style based on index IF ls_cell-s IS NOT INITIAL. lv_index = ls_cell-s + 1. READ TABLE styles INTO lo_excel_style INDEX lv_index. IF sy-subrc = 0. lv_style_guid = lo_excel_style->get_guid( ). ENDIF. ENDIF. lo_ixml_formula_elem = lo_ixml_cell_elem->find_from_name( name = 'f' ). IF lo_ixml_formula_elem IS BOUND. lv_cell_formula = lo_ixml_formula_elem->get_value( ). *--------------------------------------------------------------------* * Begin of insertion issue#284 - Copied formulae not *--------------------------------------------------------------------* DATA: BEGIN OF ls_formula_attributes, ref TYPE string, si TYPE i, t TYPE string, END OF ls_formula_attributes, ls_ref_formula TYPE ty_ref_formulae. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_formula_elem CHANGING cp_structure = ls_formula_attributes ). IF ls_formula_attributes-t = 'shared'. zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING i_columnrow = ls_cell-r IMPORTING e_column = lv_cell_column e_row = lv_cell_row ). TRY. CLEAR ls_ref_formula. ls_ref_formula-sheet = io_worksheet. ls_ref_formula-row = lv_cell_row. ls_ref_formula-column = zcl_excel_common=>convert_column2int( lv_cell_column ). ls_ref_formula-si = ls_formula_attributes-si. ls_ref_formula-ref = ls_formula_attributes-ref. ls_ref_formula-formula = lv_cell_formula. INSERT ls_ref_formula INTO TABLE me->mt_ref_formulae. CATCH cx_root. BREAK-POINT. ENDTRY. ENDIF. *--------------------------------------------------------------------* * End of insertion issue#284 - Copied formulae not *--------------------------------------------------------------------* ENDIF. IF lv_cell_value IS NOT INITIAL OR lv_cell_formula IS NOT INITIAL OR lv_style_guid IS NOT INITIAL. zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING i_columnrow = ls_cell-r IMPORTING e_column = lv_cell_column e_row = lv_cell_row ). io_worksheet->set_cell( ip_column = lv_cell_column " cell_elem Column ip_row = lv_cell_row " cell_elem row_elem ip_value = lv_cell_value " cell_elem Value ip_formula = lv_cell_formula ip_data_type = ls_cell-t ip_style = lv_style_guid ). ENDIF. lo_ixml_cell_elem ?= lo_ixml_iterator2->get_next( ). ENDWHILE. lo_ixml_row_elem ?= lo_ixml_iterator->get_next( ). ENDWHILE. *--------------------------------------------------------------------* *#234 - column width not read correctly - begin of coding * reason - libre office doesn't use SPAN in row - definitions *--------------------------------------------------------------------* IF lv_max_col = 0. lo_ixml_imension_elem = lo_ixml_worksheet->find_from_name( name = 'dimension' ). IF lo_ixml_imension_elem IS BOUND. lv_dimension_range = lo_ixml_imension_elem->get_attribute( 'ref' ). IF lv_dimension_range CS ':'. REPLACE REGEX '\D+\d+:(\D+)\d+' IN lv_dimension_range WITH '$1'. " Get max column ELSE. REPLACE REGEX '(\D+)\d+' IN lv_dimension_range WITH '$1'. " Get max column ENDIF. lv_max_col = zcl_excel_common=>convert_column2int( lv_dimension_range ). ENDIF. ENDIF. *--------------------------------------------------------------------* *#234 - column width not read correctly - end of coding *--------------------------------------------------------------------* "Get the customized column width lo_ixml_columns = lo_ixml_worksheet->get_elements_by_tag_name( name = 'col' ). lo_ixml_iterator = lo_ixml_columns->create_iterator( ). lo_ixml_column_elem ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml_column_elem IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_column_elem CHANGING cp_structure = ls_column ). lo_ixml_column_elem ?= lo_ixml_iterator->get_next( ). IF ls_column-customwidth = lc_xml_attr_true OR ls_column-customwidth = lc_xml_attr_true_int OR ls_column-bestfit = lc_xml_attr_true OR ls_column-bestfit = lc_xml_attr_true_int OR ls_column-collapsed = lc_xml_attr_true OR ls_column-collapsed = lc_xml_attr_true_int OR ls_column-hidden = lc_xml_attr_true OR ls_column-hidden = lc_xml_attr_true_int OR ls_column-outlinelevel > '' OR ls_column-style > ''. lv_index = ls_column-min. WHILE lv_index <= ls_column-max AND lv_index <= lv_max_col. lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_index ). lo_column_dimension = io_worksheet->get_column_dimension( lv_column_alpha ). IF ls_column-customwidth = lc_xml_attr_true OR ls_column-customwidth = lc_xml_attr_true_int OR ls_column-width IS NOT INITIAL. "+#234 lo_column_dimension->set_width( ls_column-width ). ENDIF. IF ls_column-bestfit = lc_xml_attr_true OR ls_column-bestfit = lc_xml_attr_true_int. lo_column_dimension->set_auto_size( abap_true ). ENDIF. IF ls_column-collapsed = lc_xml_attr_true OR ls_column-collapsed = lc_xml_attr_true_int. lo_column_dimension->set_collapsed( abap_true ). ENDIF. IF ls_column-hidden = lc_xml_attr_true OR ls_column-hidden = lc_xml_attr_true_int. lo_column_dimension->set_visible( abap_false ). ENDIF. IF ls_column-outlinelevel > ''. * outline_level = condense( column-outlineLevel ). CONDENSE ls_column-outlinelevel. lv_outline_level = ls_column-outlinelevel. IF lv_outline_level > 0. lo_column_dimension->set_outline_level( lv_outline_level ). ENDIF. ENDIF. IF ls_column-style > ''. sy-index = ls_column-style + 1. READ TABLE styles INTO lo_excel_style INDEX sy-index. DATA: dummy_zexcel_cell_style TYPE zexcel_cell_style. dummy_zexcel_cell_style = lo_excel_style->get_guid( ). lo_column_dimension->set_column_style_by_guid( dummy_zexcel_cell_style ). ENDIF. ADD 1 TO lv_index. ENDWHILE. ENDIF. * issue #367 - hide columns from IF ls_column-max = zcl_excel_common=>c_excel_sheet_max_col. " Max = very right column IF ls_column-hidden = 1 " all hidden AND ls_column-min > 0. io_worksheet->zif_excel_sheet_properties~hide_columns_from = zcl_excel_common=>convert_column2alpha( ls_column-min ). ELSEIF ls_column-style > ''. sy-index = ls_column-style + 1. READ TABLE styles INTO lo_excel_style INDEX sy-index. dummy_zexcel_cell_style = lo_excel_style->get_guid( ). * Set style for remaining columns io_worksheet->zif_excel_sheet_properties~set_style( dummy_zexcel_cell_style ). ENDIF. ENDIF. ENDWHILE. "Now we need to get information from the sheetView node lo_ixml_sheetview_elem = lo_ixml_worksheet->find_from_name( name = 'sheetView' ). fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_sheetview_elem CHANGING cp_structure = ls_sheetview ). IF ls_sheetview-showgridlines IS INITIAL OR ls_sheetview-showgridlines = lc_xml_attr_true OR ls_sheetview-showgridlines = lc_xml_attr_true_int. "If the attribute is not specified or set to true, we will show grid lines ls_sheetview-showgridlines = abap_true. ELSE. ls_sheetview-showgridlines = abap_false. ENDIF. io_worksheet->set_show_gridlines( ls_sheetview-showgridlines ). "Add merge cell information lo_ixml_mergecells = lo_ixml_worksheet->get_elements_by_tag_name( name = 'mergeCell' ). lo_ixml_iterator = lo_ixml_mergecells->create_iterator( ). lo_ixml_mergecell_elem ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml_mergecell_elem IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_mergecell_elem CHANGING cp_structure = ls_mergecell ). zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = ls_mergecell-ref IMPORTING e_column_start = lv_merge_column_start e_column_end = lv_merge_column_end e_row_start = lv_merge_row_start e_row_end = lv_merge_row_end ). lo_ixml_mergecell_elem ?= lo_ixml_iterator->get_next( ). io_worksheet->set_merge( EXPORTING ip_column_start = lv_merge_column_start ip_column_end = lv_merge_column_end ip_row = lv_merge_row_start ip_row_to = lv_merge_row_end ). ENDWHILE. " read sheet format properties lo_ixml_sheetformatpr_elem = lo_ixml_worksheet->find_from_name( 'sheetFormatPr' ). IF lo_ixml_sheetformatpr_elem IS NOT INITIAL. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_sheetformatpr_elem CHANGING cp_structure = ls_sheetformatpr ). IF ls_sheetformatpr-customheight = '1'. lv_height = ls_sheetformatpr-defaultrowheight. lo_row_dimension = io_worksheet->get_default_row_dimension( ). lo_row_dimension->set_row_height( lv_height ). ENDIF. " TODO... column ENDIF. " Read in page margins me->load_worksheet_pagemargins( EXPORTING io_ixml_worksheet = lo_ixml_worksheet io_worksheet = io_worksheet ). * FitToPage lo_ixml_sheetpr ?= lo_ixml_worksheet->find_from_name( 'pageSetUpPr' ). IF lo_ixml_sheetpr IS BOUND. lv_fit_to_page = lo_ixml_sheetpr->get_attribute_ns( 'fitToPage' ). IF lv_fit_to_page IS NOT INITIAL. io_worksheet->sheet_setup->fit_to_page = 'X'. ENDIF. ENDIF. " Read in page setup lo_ixml_pagesetup_elem = lo_ixml_worksheet->find_from_name( 'pageSetup' ). IF lo_ixml_pagesetup_elem IS NOT INITIAL. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_pagesetup_elem CHANGING cp_structure = ls_pagesetup ). io_worksheet->sheet_setup->orientation = ls_pagesetup-orientation. io_worksheet->sheet_setup->scale = ls_pagesetup-scale. IF io_worksheet->sheet_setup->fit_to_page = 'X'. IF ls_pagesetup-fittowidth IS NOT INITIAL. io_worksheet->sheet_setup->fit_to_width = ls_pagesetup-fittowidth. ELSE. io_worksheet->sheet_setup->fit_to_width = 1. " Default if not given - Excel doesn't write this to xml ENDIF. IF ls_pagesetup-fittoheight IS NOT INITIAL. io_worksheet->sheet_setup->fit_to_height = ls_pagesetup-fittoheight. ELSE. io_worksheet->sheet_setup->fit_to_height = 1. " Default if not given - Excel doesn't write this to xml ENDIF. ENDIF. ENDIF. " Read header footer lo_ixml_headerfooter_elem = lo_ixml_worksheet->find_from_name( 'headerFooter' ). IF lo_ixml_headerfooter_elem IS NOT INITIAL. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_headerfooter_elem CHANGING cp_structure = ls_headerfooter ). io_worksheet->sheet_setup->diff_oddeven_headerfooter = ls_headerfooter-differentoddeven. lo_ixml_hf_value_elem = lo_ixml_headerfooter_elem->find_from_name( 'oddFooter' ). IF lo_ixml_hf_value_elem IS NOT INITIAL. ls_odd_footer-left_value = lo_ixml_hf_value_elem->get_value( ). ENDIF. * 2do§1 Header/footer " TODO.. get the rest. io_worksheet->sheet_setup->set_header_footer( ip_odd_header = ls_odd_header ip_odd_footer = ls_odd_footer ip_even_header = ls_even_header ip_even_footer = ls_even_footer ). ENDIF. " Start fix 194 Read attributes HIDDEN, OUTLINELEVEL, COLLAPSED in ZCL_EXCEL_READER_2007 " Read pane lo_ixml_pane_elem = lo_ixml_sheetview_elem->find_from_name( name = 'pane' ). IF lo_ixml_pane_elem IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_pane_elem CHANGING cp_structure = ls_excel_pane ). " Issue #194 " Replace REGEX with method from the common class zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING i_columnrow = ls_excel_pane-topleftcell IMPORTING e_column = lv_pane_cell_col_a " Cell Column e_row = lv_pane_cell_row ). " Natural number lv_pane_cell_col = zcl_excel_common=>convert_column2int( lv_pane_cell_col_a ). SUBTRACT 1 FROM: lv_pane_cell_col, lv_pane_cell_row. IF lv_pane_cell_col > 0 AND lv_pane_cell_row > 0. io_worksheet->freeze_panes( ip_num_rows = lv_pane_cell_row ip_num_columns = lv_pane_cell_col ). ELSEIF lv_pane_cell_row > 0. io_worksheet->freeze_panes( ip_num_rows = lv_pane_cell_row ). ELSE. io_worksheet->freeze_panes( ip_num_columns = lv_pane_cell_col ). ENDIF. ENDIF. " End fix 194 Read attributes HIDDEN, OUTLINELEVEL, COLLAPSED in ZCL_EXCEL_READER_2007 " Start fix 276 Read data validations lo_ixml_datavalidations = lo_ixml_worksheet->get_elements_by_tag_name( name = 'dataValidation' ). lo_ixml_iterator = lo_ixml_datavalidations->create_iterator( ). lo_ixml_datavalidation_elem ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml_datavalidation_elem IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_datavalidation_elem CHANGING cp_structure = ls_datavalidation ). CLEAR lo_ixml_formula_elem. lo_ixml_formula_elem = lo_ixml_datavalidation_elem->find_from_name( name = 'formula1' ). IF lo_ixml_formula_elem IS BOUND. ls_datavalidation-formula1 = lo_ixml_formula_elem->get_value( ). ENDIF. CLEAR lo_ixml_formula_elem. lo_ixml_formula_elem = lo_ixml_datavalidation_elem->find_from_name( name = 'formula2' ). IF lo_ixml_formula_elem IS BOUND. ls_datavalidation-formula2 = lo_ixml_formula_elem->get_value( ). ENDIF. SPLIT ls_datavalidation-sqref AT space INTO TABLE lt_datavalidation_range. LOOP AT lt_datavalidation_range INTO lv_datavalidation_range. zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_datavalidation_range IMPORTING e_column_start = ls_datavalidation-cell_column e_column_end = ls_datavalidation-cell_column_to e_row_start = ls_datavalidation-cell_row e_row_end = ls_datavalidation-cell_row_to ). lo_data_validation = io_worksheet->add_new_data_validation( ). lo_data_validation->type = ls_datavalidation-type. lo_data_validation->allowblank = ls_datavalidation-allowblank. IF ls_datavalidation-showinputmessage IS INITIAL. lo_data_validation->showinputmessage = abap_false. ELSE. lo_data_validation->showinputmessage = abap_true. ENDIF. IF ls_datavalidation-showerrormessage IS INITIAL. lo_data_validation->showerrormessage = abap_false. ELSE. lo_data_validation->showerrormessage = abap_true. ENDIF. IF ls_datavalidation-showdropdown IS INITIAL. lo_data_validation->showdropdown = abap_false. ELSE. lo_data_validation->showdropdown = abap_true. ENDIF. lo_data_validation->operator = ls_datavalidation-operator. lo_data_validation->formula1 = ls_datavalidation-formula1. lo_data_validation->formula2 = ls_datavalidation-formula2. lo_data_validation->prompttitle = ls_datavalidation-prompttitle. lo_data_validation->prompt = ls_datavalidation-prompt. lo_data_validation->errortitle = ls_datavalidation-errortitle. lo_data_validation->error = ls_datavalidation-error. lo_data_validation->errorstyle = ls_datavalidation-errorstyle. lo_data_validation->cell_row = ls_datavalidation-cell_row. lo_data_validation->cell_row_to = ls_datavalidation-cell_row_to. lo_data_validation->cell_column = ls_datavalidation-cell_column. lo_data_validation->cell_column_to = ls_datavalidation-cell_column_to. ENDLOOP. lo_ixml_datavalidation_elem ?= lo_ixml_iterator->get_next( ). ENDWHILE. " End fix 276 Read data validations " Read hyperlinks TRY. me->load_worksheet_hyperlinks( io_ixml_worksheet = lo_ixml_worksheet io_worksheet = io_worksheet it_external_hyperlinks = lt_external_hyperlinks ). CATCH zcx_excel. " Ignore Hyperlink reading errors - pass everything we were able to identify ENDTRY. TRY. me->fill_row_outlines( io_worksheet = io_worksheet ). CATCH zcx_excel. " Ignore Hyperlink reading errors - pass everything we were able to identify ENDTRY. " Issue #366 - conditional formatting TRY. me->load_worksheet_cond_format( io_ixml_worksheet = lo_ixml_worksheet io_worksheet = io_worksheet ). CATCH zcx_excel. " Ignore Hyperlink reading errors - pass everything we were able to identify ENDTRY. " Issue #377 - pagebreaks TRY. me->load_worksheet_pagebreaks( io_ixml_worksheet = lo_ixml_worksheet io_worksheet = io_worksheet ). CATCH zcx_excel. " Ignore pagebreak reading errors - pass everything we were able to identify ENDTRY. ENDMETHOD. METHOD load_worksheet_cond_format. DATA: lo_ixml_cond_formats TYPE REF TO if_ixml_node_collection, lo_ixml_cond_format TYPE REF TO if_ixml_element, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml_rules TYPE REF TO if_ixml_node_collection, lo_ixml_rule TYPE REF TO if_ixml_element, lo_ixml_iterator2 TYPE REF TO if_ixml_node_iterator, lo_style_conditional TYPE REF TO zcl_excel_style_conditional, lo_style_conditional2 TYPE REF TO zcl_excel_style_conditional. DATA: lv_area TYPE string, lt_areas TYPE STANDARD TABLE OF string WITH NON-UNIQUE DEFAULT KEY, lv_area_start_row TYPE zexcel_cell_row, lv_area_end_row TYPE zexcel_cell_row, lv_area_start_col TYPE zexcel_cell_column_alpha, lv_area_end_col TYPE zexcel_cell_column_alpha, lv_rule TYPE zexcel_condition_rule. * FIELD-SYMBOLS: <ls_external_hyperlink> LIKE LINE OF it_external_hyperlinks. lo_ixml_cond_formats = io_ixml_worksheet->get_elements_by_tag_name( name = 'conditionalFormatting' ). lo_ixml_iterator = lo_ixml_cond_formats->create_iterator( ). lo_ixml_cond_format ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml_cond_format IS BOUND. CLEAR: lv_area, lo_ixml_rule, lo_style_conditional. *--------------------------------------------------------------------* * Get type of rule *--------------------------------------------------------------------* lo_ixml_rules = io_ixml_worksheet->get_elements_by_tag_name( name = 'cfRule' ). lo_ixml_iterator2 = lo_ixml_rules->create_iterator( ). lo_ixml_rule ?= lo_ixml_iterator2->get_next( ). * IF lo_ixml_rule IS BOUND. WHILE lo_ixml_rule IS BOUND. lv_rule = lo_ixml_rule->get_attribute_ns( 'type' ). CLEAR lo_style_conditional. *--------------------------------------------------------------------* * Depending on ruletype get additional information *--------------------------------------------------------------------* CASE lv_rule. WHEN zcl_excel_style_conditional=>c_rule_cellis. lo_style_conditional = io_worksheet->add_new_conditional_style( ). load_worksheet_cond_format_ci( io_ixml_rule = lo_ixml_rule io_style_conditional = lo_style_conditional ). * WHEN zcl_excel_style_conditional=>c_rule_containstext. * WHEN zcl_excel_style_conditional=>c_rule_databar. lo_style_conditional = io_worksheet->add_new_conditional_style( ). load_worksheet_cond_format_db( io_ixml_rule = lo_ixml_rule io_style_conditional = lo_style_conditional ). WHEN zcl_excel_style_conditional=>c_rule_expression. lo_style_conditional = io_worksheet->add_new_conditional_style( ). load_worksheet_cond_format_ex( io_ixml_rule = lo_ixml_rule io_style_conditional = lo_style_conditional ). WHEN zcl_excel_style_conditional=>c_rule_iconset. lo_style_conditional = io_worksheet->add_new_conditional_style( ). load_worksheet_cond_format_is( io_ixml_rule = lo_ixml_rule io_style_conditional = lo_style_conditional ). WHEN zcl_excel_style_conditional=>c_rule_colorscale. lo_style_conditional = io_worksheet->add_new_conditional_style( ). load_worksheet_cond_format_cs( io_ixml_rule = lo_ixml_rule io_style_conditional = lo_style_conditional ). WHEN zcl_excel_style_conditional=>c_rule_top10. lo_style_conditional = io_worksheet->add_new_conditional_style( ). load_worksheet_cond_format_t10( io_ixml_rule = lo_ixml_rule io_style_conditional = lo_style_conditional ). WHEN zcl_excel_style_conditional=>c_rule_above_average. lo_style_conditional = io_worksheet->add_new_conditional_style( ). load_worksheet_cond_format_aa( io_ixml_rule = lo_ixml_rule io_style_conditional = lo_style_conditional ). * WHEN zcl_excel_style_conditional=>c_rule_none. * WHEN OTHERS. ENDCASE. * ENDIF. IF lo_style_conditional IS BOUND. lo_style_conditional->rule = lv_rule. lo_style_conditional->priority = lo_ixml_rule->get_attribute_ns( 'priority' ). *--------------------------------------------------------------------* * Set area to which conditional formatting belongs *--------------------------------------------------------------------* lv_area = lo_ixml_cond_format->get_attribute_ns( 'sqref' ). SPLIT lv_area AT space INTO TABLE lt_areas. DELETE lt_areas WHERE table_line IS INITIAL. LOOP AT lt_areas INTO lv_area. * IF sy-tabix = 1. " Add futher style for next area * lo_style_conditional2 = lo_style_conditional. * ELSE. * lo_style_conditional2 = io_worksheet->add_new_conditional_style( ). * lo_style_conditional2->mode_cellis = lo_style_conditional->mode_cellis . * lo_style_conditional2->mode_colorscale = lo_style_conditional->mode_colorscale . * lo_style_conditional2->mode_databar = lo_style_conditional->mode_databar . * lo_style_conditional2->mode_expression = lo_style_conditional->mode_expression . * lo_style_conditional2->mode_iconset = lo_style_conditional->mode_iconset . * lo_style_conditional2->mode_top10 = lo_style_conditional->mode_top10 . * lo_style_conditional2->mode_above_average = lo_style_conditional->mode_above_average. * lo_style_conditional2->priority = lo_style_conditional->priority . * lo_style_conditional2->rule = lo_style_conditional->rule . * ENDIF. zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = lv_area IMPORTING e_column_start = lv_area_start_col e_column_end = lv_area_end_col e_row_start = lv_area_start_row e_row_end = lv_area_end_row ). * lo_style_conditional2->set_range( ip_start_column = lv_area_start_col * ip_stop_column = lv_area_end_col * ip_start_row = lv_area_start_row * ip_stop_row = lv_area_end_row ). lo_style_conditional->add_range( ip_start_column = lv_area_start_col ip_stop_column = lv_area_end_col ip_start_row = lv_area_start_row ip_stop_row = lv_area_end_row ). ENDLOOP. ENDIF. lo_ixml_rule ?= lo_ixml_iterator2->get_next( ). ENDWHILE. lo_ixml_cond_format ?= lo_ixml_iterator->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_worksheet_cond_format_aa. DATA: lv_dxf_style_index TYPE i, val TYPE string. FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. *--------------------------------------------------------------------* * above or below average *--------------------------------------------------------------------* val = io_ixml_rule->get_attribute_ns( 'aboveAverage' ). IF val = '0'. " 0 = below average io_style_conditional->mode_above_average-above_average = space. ELSE. io_style_conditional->mode_above_average-above_average = 'X'. " Not present or <> 0 --> we use above average ENDIF. *--------------------------------------------------------------------* * Equal average also? *--------------------------------------------------------------------* CLEAR val. val = io_ixml_rule->get_attribute_ns( 'equalAverage' ). IF val = '1'. " 0 = below average io_style_conditional->mode_above_average-equal_average = 'X'. ELSE. io_style_conditional->mode_above_average-equal_average = ' '. " Not present or <> 1 --> we use not equal average ENDIF. *--------------------------------------------------------------------* * Standard deviation instead of value ( 2nd stddev, 3rd stdev ) *--------------------------------------------------------------------* CLEAR val. val = io_ixml_rule->get_attribute_ns( 'stdDev' ). CASE val. WHEN 1 OR 2 OR 3. " These seem to be supported by excel - don't try anything more io_style_conditional->mode_above_average-standard_deviation = val. ENDCASE. *--------------------------------------------------------------------* * Cell formatting for top10 *--------------------------------------------------------------------* lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. IF sy-subrc = 0. io_style_conditional->mode_above_average-cell_style = <ls_dxf_style>-guid. ENDIF. ENDMETHOD. METHOD load_worksheet_cond_format_ci. DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml TYPE REF TO if_ixml_element, lv_dxf_style_index TYPE i, lo_excel_style LIKE LINE OF me->styles. FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. io_style_conditional->mode_cellis-operator = io_ixml_rule->get_attribute_ns( 'operator' ). lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. IF sy-subrc = 0. io_style_conditional->mode_cellis-cell_style = <ls_dxf_style>-guid. ENDIF. lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'formula' ). lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). lo_ixml ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml IS BOUND. CASE sy-index. WHEN 1. io_style_conditional->mode_cellis-formula = lo_ixml->get_value( ). WHEN 2. io_style_conditional->mode_cellis-formula2 = lo_ixml->get_value( ). WHEN OTHERS. EXIT. ENDCASE. lo_ixml ?= lo_ixml_iterator->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_worksheet_cond_format_cs. DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml TYPE REF TO if_ixml_element. lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'cfvo' ). lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). lo_ixml ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml IS BOUND. CASE sy-index. WHEN 1. io_style_conditional->mode_colorscale-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_colorscale-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ). WHEN 2. io_style_conditional->mode_colorscale-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_colorscale-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). WHEN 3. io_style_conditional->mode_colorscale-cfvo3_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_colorscale-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). WHEN OTHERS. EXIT. ENDCASE. lo_ixml ?= lo_ixml_iterator->get_next( ). ENDWHILE. lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'color' ). lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). lo_ixml ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml IS BOUND. CASE sy-index. WHEN 1. io_style_conditional->mode_colorscale-colorrgb1 = lo_ixml->get_attribute_ns( 'rgb' ). WHEN 2. io_style_conditional->mode_colorscale-colorrgb2 = lo_ixml->get_attribute_ns( 'rgb' ). WHEN 3. io_style_conditional->mode_colorscale-colorrgb3 = lo_ixml->get_attribute_ns( 'rgb' ). WHEN OTHERS. EXIT. ENDCASE. lo_ixml ?= lo_ixml_iterator->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_worksheet_cond_format_db. DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml TYPE REF TO if_ixml_element. lo_ixml ?= io_ixml_rule->find_from_name( 'color' ). IF lo_ixml IS BOUND. io_style_conditional->mode_databar-colorrgb = lo_ixml->get_attribute_ns( 'rgb' ). ENDIF. lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'cfvo' ). lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). lo_ixml ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml IS BOUND. CASE sy-index. WHEN 1. io_style_conditional->mode_databar-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_databar-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ). WHEN 2. io_style_conditional->mode_databar-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_databar-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). WHEN OTHERS. EXIT. ENDCASE. lo_ixml ?= lo_ixml_iterator->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_worksheet_cond_format_ex. DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml TYPE REF TO if_ixml_element, lv_dxf_style_index TYPE i, lo_excel_style LIKE LINE OF me->styles. FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. IF sy-subrc = 0. io_style_conditional->mode_expression-cell_style = <ls_dxf_style>-guid. ENDIF. lo_ixml_nodes ?= io_ixml_rule->get_elements_by_tag_name( 'formula' ). lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). lo_ixml ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml IS BOUND. CASE sy-index. WHEN 1. io_style_conditional->mode_expression-formula = lo_ixml->get_value( ). WHEN OTHERS. EXIT. ENDCASE. lo_ixml ?= lo_ixml_iterator->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_worksheet_cond_format_is. DATA: lo_ixml_nodes TYPE REF TO if_ixml_node_collection, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml TYPE REF TO if_ixml_element, lo_ixml_rule_iconset TYPE REF TO if_ixml_element. lo_ixml_rule_iconset ?= io_ixml_rule->get_first_child( ). io_style_conditional->mode_iconset-iconset = lo_ixml_rule_iconset->get_attribute_ns( 'iconSet' ). io_style_conditional->mode_iconset-showvalue = lo_ixml_rule_iconset->get_attribute_ns( 'showValue' ). lo_ixml_nodes ?= lo_ixml_rule_iconset->get_elements_by_tag_name( 'cfvo' ). lo_ixml_iterator = lo_ixml_nodes->create_iterator( ). lo_ixml ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml IS BOUND. CASE sy-index. WHEN 1. io_style_conditional->mode_iconset-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_iconset-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ). WHEN 2. io_style_conditional->mode_iconset-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_iconset-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ). WHEN 3. io_style_conditional->mode_iconset-cfvo3_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_iconset-cfvo3_value = lo_ixml->get_attribute_ns( 'val' ). WHEN 4. io_style_conditional->mode_iconset-cfvo4_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_iconset-cfvo4_value = lo_ixml->get_attribute_ns( 'val' ). WHEN 5. io_style_conditional->mode_iconset-cfvo5_type = lo_ixml->get_attribute_ns( 'type' ). io_style_conditional->mode_iconset-cfvo5_value = lo_ixml->get_attribute_ns( 'val' ). WHEN OTHERS. EXIT. ENDCASE. lo_ixml ?= lo_ixml_iterator->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_worksheet_cond_format_t10. DATA: lv_dxf_style_index TYPE i. FIELD-SYMBOLS: <ls_dxf_style> LIKE LINE OF me->mt_dxf_styles. io_style_conditional->mode_top10-topxx_count = io_ixml_rule->get_attribute_ns( 'rank' ). " Top10, Top20, Top 50... io_style_conditional->mode_top10-percent = io_ixml_rule->get_attribute_ns( 'percent' ). " Top10 percent instead of Top10 values if io_style_conditional->mode_top10-percent = '1'. io_style_conditional->mode_top10-percent = 'X'. else. io_style_conditional->mode_top10-percent = ' '. endif. io_style_conditional->mode_top10-bottom = io_ixml_rule->get_attribute_ns( 'bottom' ). " Bottom10 instead of Top10 if io_style_conditional->mode_top10-bottom = '1'. io_style_conditional->mode_top10-bottom = 'X'. else. io_style_conditional->mode_top10-bottom = ' '. endif. *--------------------------------------------------------------------* * Cell formatting for top10 *--------------------------------------------------------------------* lv_dxf_style_index = io_ixml_rule->get_attribute_ns( 'dxfId' ). READ TABLE me->mt_dxf_styles ASSIGNING <ls_dxf_style> WITH KEY dxf = lv_dxf_style_index. IF sy-subrc = 0. io_style_conditional->mode_top10-cell_style = <ls_dxf_style>-guid. ENDIF. ENDMETHOD. method LOAD_WORKSHEET_DRAWING. TYPES: BEGIN OF t_c_nv_pr, name TYPE string, id TYPE string, END OF t_c_nv_pr. TYPES: BEGIN OF t_blip, cstate TYPE string, embed TYPE string, END OF t_blip. TYPES: BEGIN OF t_chart, id TYPE string, END OF t_chart. CONSTANTS: lc_xml_attr_true TYPE string VALUE 'true', lc_xml_attr_true_int TYPE string VALUE '1'. CONSTANTS: lc_rel_chart TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', lc_rel_image TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image'. DATA: drawing TYPE REF TO if_ixml_document, anchors TYPE REF TO if_ixml_node_collection, node TYPE REF TO if_ixml_element, coll_length TYPE i, iterator TYPE REF TO if_ixml_node_iterator, anchor_elem TYPE REF TO if_ixml_element, relationship TYPE t_relationship, rel_drawings TYPE t_rel_drawings, rel_drawing TYPE t_rel_drawing, rels_drawing TYPE REF TO if_ixml_document, rels_drawing_path TYPE string, stripped_name TYPE chkfile, dirname TYPE string, path TYPE string, path2 TYPE text255, file_ext2 TYPE char10. " Read Workbook Relationships CALL FUNCTION 'TRINT_SPLIT_FILE_AND_PATH' EXPORTING full_name = ip_path IMPORTING stripped_name = stripped_name file_path = dirname. CONCATENATE dirname '_rels/' stripped_name '.rels' INTO rels_drawing_path. rels_drawing_path = resolve_path( rels_drawing_path ). rels_drawing = me->get_ixml_from_zip_archive( rels_drawing_path ). node ?= rels_drawing->find_from_name( 'Relationship' ). WHILE node IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = node CHANGING cp_structure = relationship ). rel_drawing-id = relationship-id. CONCATENATE dirname relationship-target INTO path. path = resolve_path( path ). rel_drawing-content = me->get_from_zip_archive( path ). "------------> This is for template usage path2 = path. zcl_excel_common=>split_file( EXPORTING ip_file = path2 IMPORTING ep_extension = file_ext2 ). rel_drawing-file_ext = file_ext2. "-------------Added by Alessandro Iannacci - Should load graph xml CASE relationship-type. WHEN lc_rel_chart. "Read chart xml rel_drawing-content_xml = me->get_ixml_from_zip_archive( path ). WHEN OTHERS. ENDCASE. "---------------------------- APPEND rel_drawing TO rel_drawings. node ?= node->get_next( ). ENDWHILE. drawing = me->get_ixml_from_zip_archive( ip_path ). * one-cell anchor ************** anchors = drawing->get_elements_by_tag_name( name = 'oneCellAnchor' namespace = 'xdr' ). coll_length = anchors->get_length( ). iterator = anchors->create_iterator( ). DO coll_length TIMES. anchor_elem ?= iterator->get_next( ). CALL METHOD me->load_drawing_anchor EXPORTING io_anchor_element = anchor_elem io_worksheet = io_worksheet it_related_drawings = rel_drawings. ENDDO. * two-cell anchor ****************** anchors = drawing->get_elements_by_tag_name( name = 'twoCellAnchor' namespace = 'xdr' ). coll_length = anchors->get_length( ). iterator = anchors->create_iterator( ). DO coll_length TIMES. anchor_elem ?= iterator->get_next( ). CALL METHOD me->load_drawing_anchor EXPORTING io_anchor_element = anchor_elem io_worksheet = io_worksheet it_related_drawings = rel_drawings. ENDDO. endmethod. METHOD load_worksheet_hyperlinks. DATA: lo_ixml_hyperlinks TYPE REF TO if_ixml_node_collection, lo_ixml_hyperlink TYPE REF TO if_ixml_element, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lv_row TYPE zexcel_cell_row, lv_column TYPE zexcel_cell_column_alpha, lo_hyperlink TYPE REF TO zcl_excel_hyperlink, lv_value TYPE zexcel_cell_value. DATA: BEGIN OF ls_hyperlink, ref TYPE string, display TYPE string, location TYPE string, tooltip TYPE string, r_id TYPE string, END OF ls_hyperlink. FIELD-SYMBOLS: <ls_external_hyperlink> LIKE LINE OF it_external_hyperlinks. lo_ixml_hyperlinks = io_ixml_worksheet->get_elements_by_tag_name( name = 'hyperlink' ). lo_ixml_iterator = lo_ixml_hyperlinks->create_iterator( ). lo_ixml_hyperlink ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml_hyperlink IS BOUND. CLEAR ls_hyperlink. CLEAR lo_hyperlink. ls_hyperlink-ref = lo_ixml_hyperlink->get_attribute_ns( 'ref' ). ls_hyperlink-display = lo_ixml_hyperlink->get_attribute_ns( 'display' ). ls_hyperlink-location = lo_ixml_hyperlink->get_attribute_ns( 'location' ). ls_hyperlink-tooltip = lo_ixml_hyperlink->get_attribute_ns( 'tooltip' ). ls_hyperlink-r_id = lo_ixml_hyperlink->get_attribute( name = 'id' namespace = 'r' ). IF ls_hyperlink-r_id IS INITIAL. " Internal link lo_hyperlink = zcl_excel_hyperlink=>create_internal_link( iv_location = ls_hyperlink-location ). ELSE. " External link READ TABLE it_external_hyperlinks ASSIGNING <ls_external_hyperlink> WITH TABLE KEY id = ls_hyperlink-r_id. IF sy-subrc = 0. lo_hyperlink = zcl_excel_hyperlink=>create_external_link( iv_url = <ls_external_hyperlink>-target ). ENDIF. ENDIF. IF lo_hyperlink IS BOUND. " because of unsupported external links zcl_excel_common=>convert_columnrow2column_a_row( EXPORTING i_columnrow = ls_hyperlink-ref IMPORTING e_row = lv_row e_column = lv_column ). * Currently it is not allowed to pass a hyperlink w/o text, but text has already been read. * So just reread it and be done with it io_worksheet->get_cell( EXPORTING ip_column = lv_column ip_row = lv_row IMPORTING ep_value = lv_value ). io_worksheet->set_cell( ip_column = lv_column ip_row = lv_row ip_value = lv_value ip_hyperlink = lo_hyperlink ). ENDIF. lo_ixml_hyperlink ?= lo_ixml_iterator->get_next( ). ENDWHILE. ENDMETHOD. METHOD load_worksheet_pagebreaks. DATA: lo_node TYPE REF TO if_ixml_element, lo_ixml_rowbreaks TYPE REF TO if_ixml_node_collection, lo_ixml_colbreaks TYPE REF TO if_ixml_node_collection, lo_ixml_iterator TYPE REF TO if_ixml_node_iterator, lo_ixml_rowbreak TYPE REF TO if_ixml_element, lo_ixml_colbreak TYPE REF TO if_ixml_element, lo_style_conditional TYPE REF TO zcl_excel_style_conditional, lv_count TYPE i. DATA: lt_pagebreaks TYPE STANDARD TABLE OF zcl_excel_worksheet_pagebreaks=>ts_pagebreak_at, lo_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks. FIELD-SYMBOLS: <ls_pagebreak_row> LIKE LINE OF lt_pagebreaks. FIELD-SYMBOLS: <ls_pagebreak_col> LIKE LINE OF lt_pagebreaks. *--------------------------------------------------------------------* * Get minimal number of cells where to add pagebreaks * Since rows and columns are handled in separate nodes * Build table to identify these cells *--------------------------------------------------------------------* lo_node ?= io_ixml_worksheet->find_from_name( 'rowBreaks' ). check lo_node is bound. lo_ixml_rowbreaks = lo_node->get_elements_by_tag_name( name = 'brk' ). lo_ixml_iterator = lo_ixml_rowbreaks->create_iterator( ). lo_ixml_rowbreak ?= lo_ixml_iterator->get_next( ). WHILE lo_ixml_rowbreak IS BOUND. APPEND INITIAL LINE TO lt_pagebreaks ASSIGNING <ls_pagebreak_row>. <ls_pagebreak_row>-cell_row = lo_ixml_rowbreak->get_attribute_ns( 'id' ). lo_ixml_rowbreak ?= lo_ixml_iterator->get_next( ). ENDWHILE. CHECK <ls_pagebreak_row> IS ASSIGNED. lo_node ?= io_ixml_worksheet->find_from_name( 'colBreaks' ). check lo_node is bound. lo_ixml_colbreaks = lo_node->get_elements_by_tag_name( name = 'brk' ). lo_ixml_iterator = lo_ixml_colbreaks->create_iterator( ). lo_ixml_colbreak ?= lo_ixml_iterator->get_next( ). CLEAR lv_count. WHILE lo_ixml_colbreak IS BOUND. ADD 1 TO lv_count. READ TABLE lt_pagebreaks INDEX lv_count ASSIGNING <ls_pagebreak_col>. IF sy-subrc <> 0. APPEND INITIAL LINE TO lt_pagebreaks ASSIGNING <ls_pagebreak_col>. <ls_pagebreak_col>-cell_row = <ls_pagebreak_row>-cell_row. ENDIF. <ls_pagebreak_col>-cell_column = lo_ixml_colbreak->get_attribute_ns( 'id' ). lo_ixml_colbreak ?= lo_ixml_iterator->get_next( ). ENDWHILE. *--------------------------------------------------------------------* * Finally add each pagebreak *--------------------------------------------------------------------* lo_pagebreaks = io_worksheet->get_pagebreaks( ). LOOP AT lt_pagebreaks ASSIGNING <ls_pagebreak_row>. lo_pagebreaks->add_pagebreak( ip_column = <ls_pagebreak_row>-cell_column ip_row = <ls_pagebreak_row>-cell_row ). ENDLOOP. ENDMETHOD. METHOD load_worksheet_pagemargins. TYPES: BEGIN OF lty_page_margins, footer TYPE string, header TYPE string, bottom TYPE string, top TYPE string, right TYPE string, left TYPE string, END OF lty_page_margins. DATA:lo_ixml_pagemargins_elem TYPE REF TO if_ixml_element, ls_pagemargins TYPE lty_page_margins. lo_ixml_pagemargins_elem = io_ixml_worksheet->find_from_name( 'pageMargins' ). IF lo_ixml_pagemargins_elem IS NOT INITIAL. fill_struct_from_attributes( EXPORTING ip_element = lo_ixml_pagemargins_elem CHANGING cp_structure = ls_pagemargins ). io_worksheet->sheet_setup->margin_bottom = zcl_excel_common=>excel_string_to_number( ls_pagemargins-bottom ). io_worksheet->sheet_setup->margin_footer = zcl_excel_common=>excel_string_to_number( ls_pagemargins-footer ). io_worksheet->sheet_setup->margin_header = zcl_excel_common=>excel_string_to_number( ls_pagemargins-header ). io_worksheet->sheet_setup->margin_left = zcl_excel_common=>excel_string_to_number( ls_pagemargins-left ). io_worksheet->sheet_setup->margin_right = zcl_excel_common=>excel_string_to_number( ls_pagemargins-right ). io_worksheet->sheet_setup->margin_top = zcl_excel_common=>excel_string_to_number( ls_pagemargins-top ). ENDIF. ENDMETHOD. METHOD read_from_applserver. DATA: lv_filelength TYPE i, lt_binary_data TYPE STANDARD TABLE OF x255 WITH NON-UNIQUE DEFAULT KEY, ls_binary_data LIKE LINE OF lt_binary_data, lv_filename TYPE string, lv_max_length_line TYPE i, lv_actual_length_line TYPE i, lv_errormessage TYPE string. MOVE i_filename TO lv_filename. DESCRIBE FIELD ls_binary_data LENGTH lv_max_length_line IN BYTE MODE. OPEN DATASET lv_filename FOR INPUT IN BINARY MODE. IF sy-subrc <> 0. lv_errormessage = 'A problem occured when reading the file'(001). RAISE EXCEPTION TYPE zcx_excel EXPORTING error = lv_errormessage. ENDIF. WHILE sy-subrc = 0. READ DATASET lv_filename INTO ls_binary_data MAXIMUM LENGTH lv_max_length_line ACTUAL LENGTH lv_actual_length_line. APPEND ls_binary_data TO lt_binary_data. lv_filelength = lv_filelength + lv_actual_length_line. ENDWHILE. CLOSE DATASET lv_filename. *--------------------------------------------------------------------* * Binary data needs to be provided as XSTRING for further processing *--------------------------------------------------------------------* CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' EXPORTING input_length = lv_filelength IMPORTING buffer = r_excel_data TABLES binary_tab = lt_binary_data. ENDMETHOD. METHOD read_from_local_file. DATA: lv_filelength TYPE i, lt_binary_data TYPE STANDARD TABLE OF x255 WITH NON-UNIQUE DEFAULT KEY, ls_binary_data LIKE LINE OF lt_binary_data, lv_filename TYPE string, lv_errormessage TYPE string. MOVE i_filename TO lv_filename. cl_gui_frontend_services=>gui_upload( EXPORTING filename = lv_filename filetype = 'BIN' " We are basically working with zipped directories --> force binary read IMPORTING filelength = lv_filelength CHANGING data_tab = lt_binary_data EXCEPTIONS file_open_error = 1 file_read_error = 2 no_batch = 3 gui_refuse_filetransfer = 4 invalid_type = 5 no_authority = 6 unknown_error = 7 bad_data_format = 8 header_not_allowed = 9 separator_not_allowed = 10 header_too_long = 11 unknown_dp_error = 12 access_denied = 13 dp_out_of_memory = 14 disk_full = 15 dp_timeout = 16 not_supported_by_gui = 17 error_no_gui = 18 OTHERS = 19 ). IF sy-subrc <> 0. lv_errormessage = 'A problem occured when reading the file'(001). RAISE EXCEPTION TYPE zcx_excel EXPORTING error = lv_errormessage. ENDIF. *--------------------------------------------------------------------* * Binary data needs to be provided as XSTRING for further processing *--------------------------------------------------------------------* CALL FUNCTION 'SCMS_BINARY_TO_XSTRING' EXPORTING input_length = lv_filelength IMPORTING buffer = r_excel_data TABLES binary_tab = lt_binary_data. ENDMETHOD. method RESOLVE_PATH. *--------------------------------------------------------------------* * ToDos: * 2do§1 Determine whether the replacement should be done * iterative to allow /../../.. or something alike * 2do§2 Determine whether /./ has to be supported as well * 2do§3 Create unit-test for this method * * Please don't just delete these ToDos if they are not * needed but leave a comment that states this *--------------------------------------------------------------------* *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmoecker, (done) 2012-11-11 * - ... * changes: replaced previous coding by regular expression * adding comments to explain what we are trying to achieve *--------------------------------------------------------------------* *--------------------------------------------------------------------* * §1 This routine will receive a path, that may have a relative pathname (/../) included somewhere * The output should be a resolved path without relative references * Example: Input xl/worksheets/../drawings/drawing1.xml * Output xl/drawings/drawing1.xml *--------------------------------------------------------------------* rp_result = ip_path. *--------------------------------------------------------------------* * §1 Remove relative pathnames *--------------------------------------------------------------------* * Regular expression [^/]*/\.\./ * [^/]* --> any number of characters other than / * followed by /\.\./ --> the sequence /../ * ==> worksheets/../ will be found in the example *--------------------------------------------------------------------* REPLACE REGEX '[^/]*/\.\./' IN rp_result WITH ``. endmethod. method RESOLVE_REFERENCED_FORMULAE. TYPES: BEGIN OF ty_referenced_cells, sheet TYPE REF TO zcl_excel_worksheet, si TYPE i, row_from TYPE i, row_to TYPE i, col_from TYPE i, col_to TYPE i, formula TYPE string, ref_cell TYPE char10, END OF ty_referenced_cells. DATA: ls_ref_formula LIKE LINE OF me->mt_ref_formulae, lts_referenced_cells TYPE SORTED TABLE OF ty_referenced_cells WITH NON-UNIQUE KEY sheet si row_from row_to col_from col_to, ls_referenced_cell LIKE LINE OF lts_referenced_cells, lv_col_from TYPE zexcel_cell_column_alpha, lv_col_to TYPE zexcel_cell_column_alpha, lv_resulting_formula TYPE string, lv_current_cell TYPE char10. me->mt_ref_formulae = me->mt_ref_formulae. *--------------------------------------------------------------------* * Get referenced Cells, Build ranges for easy lookup *--------------------------------------------------------------------* LOOP AT me->mt_ref_formulae INTO ls_ref_formula WHERE ref <> space. CLEAR ls_referenced_cell. ls_referenced_cell-sheet = ls_ref_formula-sheet. ls_referenced_cell-si = ls_ref_formula-si. ls_referenced_cell-formula = ls_ref_formula-formula. TRY. zcl_excel_common=>convert_range2column_a_row( EXPORTING i_range = ls_ref_formula-ref IMPORTING e_column_start = lv_col_from e_column_end = lv_col_to e_row_start = ls_referenced_cell-row_from e_row_end = ls_referenced_cell-row_to ). ls_referenced_cell-col_from = zcl_excel_common=>convert_column2int( lv_col_from ). ls_referenced_cell-col_to = zcl_excel_common=>convert_column2int( lv_col_to ). CLEAR ls_referenced_cell-ref_cell. TRY. ls_referenced_cell-ref_cell(3) = zcl_excel_common=>convert_column2alpha( ls_ref_formula-column ). ls_referenced_cell-ref_cell+3 = ls_ref_formula-row. CONDENSE ls_referenced_cell-ref_cell NO-GAPS. CATCH zcx_excel. ENDTRY. INSERT ls_referenced_cell INTO TABLE lts_referenced_cells. CATCH zcx_excel. ENDTRY. ENDLOOP. * break x0009004. *--------------------------------------------------------------------* * For each referencing cell determine the referenced cell * and resolve the formula *--------------------------------------------------------------------* LOOP AT me->mt_ref_formulae INTO ls_ref_formula WHERE ref = space. CLEAR lv_current_cell. TRY. lv_current_cell(3) = zcl_excel_common=>convert_column2alpha( ls_ref_formula-column ). lv_current_cell+3 = ls_ref_formula-row. CONDENSE lv_current_cell NO-GAPS. CATCH zcx_excel. ENDTRY. LOOP AT lts_referenced_cells INTO ls_referenced_cell WHERE sheet = ls_ref_formula-sheet AND si = ls_ref_formula-si AND row_from <= ls_ref_formula-row AND row_to >= ls_ref_formula-row AND col_from <= ls_ref_formula-column AND col_to >= ls_ref_formula-column. TRY. lv_resulting_formula = zcl_excel_common=>determine_resulting_formula( iv_reference_cell = ls_referenced_cell-ref_cell iv_reference_formula = ls_referenced_cell-formula iv_current_cell = lv_current_cell ). ls_referenced_cell-sheet->set_cell_formula( ip_column = ls_ref_formula-column ip_row = ls_ref_formula-row ip_formula = lv_resulting_formula ). CATCH zcx_excel. ENDTRY. EXIT. ENDLOOP. ENDLOOP. endmethod. method ZIF_EXCEL_READER~CAN_READ_FILE. *--------------------------------------------------------------------* * issue #230 - Pimp my Code * - Stefan Schmöcker, (done) 2012-11-07 * - ... * changes: nothing done in code * but started discussion about killing this method *--------------------------------------------------------------------* * For now always Unknown r_readable = abap_undefined. endmethod. METHOD zif_excel_reader~load. *--------------------------------------------------------------------* * ToDos: * 2do§1 Map Document Properties to ZCL_EXCEL *--------------------------------------------------------------------* CONSTANTS: lcv_core_properties TYPE string VALUE 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties', lcv_office_document TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument'. DATA: lo_rels TYPE REF TO if_ixml_document, lo_node TYPE REF TO if_ixml_element, ls_relationship TYPE t_relationship. *--------------------------------------------------------------------* * §1 Create EXCEL-Object we want to return to caller * §2 We need to read the the file "\\_rels\.rels" because it tells * us where in this folder structure the data for the workbook * is located in the xlsx zip-archive * * The xlsx Zip-archive has generally the following folder structure: * <root> | * |--> _rels * |--> doc_Props * |--> xl | * |--> _rels * |--> theme * |--> worksheets * §3 Extracting from this the path&file where the workbook is located * Following is an example how this file could be set up * <?xml version="1.0" encoding="UTF-8" standalone="true"?> * <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> * <Relationship Target="docProps/app.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Id="rId3"/> * <Relationship Target="docProps/core.xml" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Id="rId2"/> * <Relationship Target="xl/workbook.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Id="rId1"/> * </Relationships> *--------------------------------------------------------------------* *--------------------------------------------------------------------* * §1 Create EXCEL-Object we want to return to caller *--------------------------------------------------------------------* IF iv_zcl_excel_classname IS INITIAL. CREATE OBJECT r_excel. ELSE. CREATE OBJECT r_excel TYPE (iv_zcl_excel_classname). ENDIF. zip = create_zip_archive( i_xlsx_binary = i_excel2007 i_use_alternate_zip = i_use_alternate_zip ). *--------------------------------------------------------------------* * §2 Get file in folderstructure *--------------------------------------------------------------------* lo_rels = get_ixml_from_zip_archive( '_rels/.rels' ). *--------------------------------------------------------------------* * §3 Cycle through the Relationship Tags and use the ones we need *--------------------------------------------------------------------* lo_node ?= lo_rels->find_from_name( 'Relationship' ). "#EC NOTEXT WHILE lo_node IS BOUND. fill_struct_from_attributes( EXPORTING ip_element = lo_node CHANGING cp_structure = ls_relationship ). CASE ls_relationship-type. WHEN lcv_office_document. *--------------------------------------------------------------------* * Parse workbook - main part here *--------------------------------------------------------------------* load_workbook( iv_workbook_full_filename = ls_relationship-target io_excel = r_excel ). WHEN lcv_core_properties. " 2do§1 Map Document Properties to ZCL_EXCEL WHEN OTHERS. ENDCASE. lo_node ?= lo_node->get_next( ). ENDWHILE. ENDMETHOD. METHOD zif_excel_reader~load_file. DATA: lv_excel_data TYPE xstring. *--------------------------------------------------------------------* * Read file into binary string *--------------------------------------------------------------------* IF i_from_applserver = abap_true. lv_excel_data = read_from_applserver( i_filename ). ELSE. lv_excel_data = read_from_local_file( i_filename ). ENDIF. *--------------------------------------------------------------------* * Parse Excel data into ZCL_EXCEL object from binary string *--------------------------------------------------------------------* r_excel = zif_excel_reader~load( i_excel2007 = lv_excel_data i_use_alternate_zip = i_use_alternate_zip iv_zcl_excel_classname = iv_zcl_excel_classname ). ENDMETHOD. ENDCLASS.
43.007353
197
0.55318
da115914e9262f1db3058a8cf487a264704d57e0
22,360
abap
ABAP
src/v6/zcl_expimp_v6_importer.clas.locals_imp.abap
sandraros/export-import-vx
a818910f825f6a19105bb1f6ad3563e93a477c38
[ "MIT" ]
1
2021-07-18T19:47:43.000Z
2021-07-18T19:47:43.000Z
src/v6/zcl_expimp_v6_importer.clas.locals_imp.abap
sandraros/export-import-vx
a818910f825f6a19105bb1f6ad3563e93a477c38
[ "MIT" ]
null
null
null
src/v6/zcl_expimp_v6_importer.clas.locals_imp.abap
sandraros/export-import-vx
a818910f825f6a19105bb1f6ad3563e93a477c38
[ "MIT" ]
null
null
null
*"* use this source file for the definition and implementation of *"* local helper classes, interface definitions and type *"* declarations CLASS lcl_tool DEFINITION. PUBLIC SECTION. CLASS-METHODS get_byte_or_char_length IMPORTING type TYPE zif_expimp_vx=>ty_ityp length TYPE i RETURNING VALUE(result) TYPE i. CONSTANTS: c_ityp LIKE zif_expimp_vx=>c_ityp VALUE zif_expimp_vx=>c_ityp. ENDCLASS. CLASS lcl_dd_table DEFINITION INHERITING FROM lcl_dd. PUBLIC SECTION. METHODS read REDEFINITION. METHODS get_rtti REDEFINITION. METHODS get_dump REDEFINITION. DATA: line_type TYPE REF TO lcl_dd. PRIVATE SECTION. DATA: components TYPE TABLE OF REF TO lcl_dd, data_description_end TYPE zif_expimp_v6=>ty_data_description. ENDCLASS. CLASS lcl_dd_elementary DEFINITION ABSTRACT INHERITING FROM lcl_dd. PUBLIC SECTION. METHODS get_rtti REDEFINITION. DATA: type TYPE zif_expimp_vx=>ty_ityp, flen LIKE data_description-flen, decs LIKE data_description-decs. ENDCLASS. CLASS lcl_dd_from_header DEFINITION INHERITING FROM lcl_dd_elementary. PUBLIC SECTION. METHODS read REDEFINITION. METHODS get_type REDEFINITION. METHODS get_length REDEFINITION. ENDCLASS. CLASS lcl_dd_structure DEFINITION INHERITING FROM lcl_dd. PUBLIC SECTION. TYPES: ty_components TYPE STANDARD TABLE OF REF TO lcl_dd WITH EMPTY KEY. METHODS read REDEFINITION. METHODS get_rtti REDEFINITION. DATA: components TYPE TABLE OF REF TO lcl_dd. ENDCLASS. CLASS lcl_dd_simple DEFINITION INHERITING FROM lcl_dd_elementary. PUBLIC SECTION. METHODS read REDEFINITION. ENDCLASS. CLASS lcl_dd_filler DEFINITION INHERITING FROM lcl_dd. PUBLIC SECTION. METHODS read REDEFINITION. METHODS: get_rtti REDEFINITION. ENDCLASS. CLASS lcl_dv_string_xstring DEFINITION INHERITING FROM lcl_dv. PUBLIC SECTION. METHODS read REDEFINITION. METHODS get_value REDEFINITION. DATA: c_x_string_position TYPE i READ-ONLY, " number of characters or number of bytes c_x_string_length TYPE i READ-ONLY. ENDCLASS. CLASS lcl_dv_simple DEFINITION INHERITING FROM lcl_dv. PUBLIC SECTION. METHODS read REDEFINITION. METHODS get_value REDEFINITION. ENDCLASS. CLASS lcl_dv_table DEFINITION INHERITING FROM lcl_dv. PUBLIC SECTION. METHODS read REDEFINITION. METHODS get_value REDEFINITION. METHODS get_dump REDEFINITION. DATA: lines TYPE TABLE OF REF TO lcl_dv. PRIVATE SECTION. DATA: table_header TYPE zif_expimp_v6=>ty_data_value_table, data_value_end TYPE zif_expimp_v6=>ty_data_value_end. ENDCLASS. CLASS lcl_dv_interval DEFINITION INHERITING FROM lcl_dv. PUBLIC SECTION. METHODS read REDEFINITION. METHODS get_value REDEFINITION. DATA: interval_position TYPE i READ-ONLY, " number of bytes interval_length TYPE i READ-ONLY. ENDCLASS. CLASS lcl_tool IMPLEMENTATION. METHOD get_byte_or_char_length. result = SWITCH #( type WHEN c_ityp-char OR c_ityp-date OR c_ityp-num OR c_ityp-string OR c_ityp-time THEN length / cl_abap_char_utilities=>charsize ELSE length ). ENDMETHOD. ENDCLASS. CLASS lcl_dump DEFINITION. PUBLIC SECTION. METHODS constructor IMPORTING importer TYPE REF TO zcl_expimp_v6_importer. METHODS get RETURNING VALUE(result) TYPE string_table RAISING zcx_expimp_vx. DATA: importer TYPE REF TO zcl_expimp_v6_importer READ-ONLY, reader TYPE REF TO zcl_expimp_vx_reader READ-ONLY. CLASS-METHODS get_object_id IMPORTING object_id TYPE zif_expimp_vx=>ty_object_id RETURNING VALUE(result) TYPE string. CLASS-METHODS get_dd_id IMPORTING dd_id TYPE zif_expimp_vx=>ty_dd_id RETURNING VALUE(result) TYPE string. CLASS-METHODS get_dv_id IMPORTING dv_id TYPE zif_expimp_vx=>ty_dv_id RETURNING VALUE(result) TYPE string. CLASS-METHODS get_type IMPORTING type TYPE zif_expimp_vx=>ty_ityp RETURNING VALUE(result) TYPE string. PRIVATE SECTION. CONSTANTS: c_object_id LIKE zif_expimp_vx=>c_object_id VALUE zif_expimp_vx=>c_object_id, c_dd_id LIKE zif_expimp_vx=>c_dd_id VALUE zif_expimp_vx=>c_dd_id, c_dv_id LIKE zif_expimp_vx=>c_dv_id VALUE zif_expimp_vx=>c_dv_id, c_ityp LIKE zif_expimp_vx=>c_ityp VALUE zif_expimp_vx=>c_ityp. ENDCLASS. CLASS lcl_dd IMPLEMENTATION. METHOD constructor. me->do = do. me->reader = do->reader. me->position = reader->get_position( ). ENDMETHOD. METHOD create. DATA(reader) = do->reader. DATA(id) = reader->get_current_byte( ). CASE id. WHEN c_dd_id-structure_include-start. * get_dd_structure_include( ). WHEN c_dd_id-boxed_component-start. * get_dd_boxed_component( ). WHEN c_dd_id-filler. result = NEW lcl_dd_filler( do ). WHEN c_dd_id-primitive. result = NEW lcl_dd_simple( do ). WHEN c_dd_id-structure-start. result = NEW lcl_dd_structure( do ). WHEN c_dd_id-table-start. result = NEW lcl_dd_table( do ). WHEN OTHERS. " The current byte is either a byte for "start of data value" or "end of data" " Data description is optional) result = NEW lcl_dd_from_header( do ). ENDCASE. ENDMETHOD. METHOD read. reader->read_structure( IMPORTING data = data_description ). start_id = data_description-id. result = me. ENDMETHOD. METHOD get_type. result = data_description-type. ENDMETHOD. METHOD get_length. result = lcl_tool=>get_byte_or_char_length( type = data_description-type length = CONV #( data_description-flen ) ). ENDMETHOD. METHOD get_dump. IF me IS INSTANCE OF lcl_dd_from_header. result = VALUE #( ( | NO DATA DESCRIPTION - the one from the object header is used| ) ). ELSE. result = get_dump_data_description( data_description ). ENDIF. ENDMETHOD. METHOD get_dump_data_description. result = VALUE #( ( | DATA DESCRIPTION:| ) ( | { i_data_description-id } { lcl_dump=>get_dd_id( i_data_description-id ) }| ) ( | { i_data_description-type } { lcl_dump=>get_type( i_data_description-type ) }| ) ( | { i_data_description-decs } decimals| ) ( | { i_data_description-flen } length| ) ). ENDMETHOD. ENDCLASS. CLASS lcl_dd_from_header IMPLEMENTATION. METHOD read. type = do->object_header-ityp. flen = do->object_header-leng. decs = do->object_header-decs. result = me. ENDMETHOD. METHOD get_type. result = type. ENDMETHOD. METHOD get_length. result = lcl_tool=>get_byte_or_char_length( type = type length = CONV #( flen ) ). ENDMETHOD. ENDCLASS. CLASS lcl_dd_elementary IMPLEMENTATION. METHOD get_rtti. TRY. CASE type. WHEN c_ityp-char. result = cl_abap_elemdescr=>get_c( SWITCH #( reader->get_encoding( ) WHEN '4102' OR '4103' THEN flen / 2 ELSE flen ) ). WHEN c_ityp-date. result = cl_abap_elemdescr=>get_d( ). WHEN c_ityp-decfloat16. result = cl_abap_elemdescr=>get_decfloat16( ). WHEN c_ityp-decfloat34. result = cl_abap_elemdescr=>get_decfloat34( ). WHEN c_ityp-float. result = cl_abap_elemdescr=>get_f( ). WHEN c_ityp-hex. result = cl_abap_elemdescr=>get_x( CONV #( flen ) ). WHEN c_ityp-int. result = cl_abap_elemdescr=>get_i( ). WHEN c_ityp-int1. result = cl_abap_elemdescr=>get_int1( ). WHEN c_ityp-int2. result = cl_abap_elemdescr=>get_int2( ). WHEN c_ityp-int8. result = cl_abap_elemdescr=>get_int8( ). WHEN c_ityp-num. result = cl_abap_elemdescr=>get_n( SWITCH #( reader->get_encoding( ) WHEN '4102' OR '4103' THEN flen / 2 ELSE flen ) ). WHEN c_ityp-packed. result = cl_abap_elemdescr=>get_p( p_length = CONV #( flen ) p_decimals = CONV #( decs ) ). WHEN c_ityp-string. result = cl_abap_elemdescr=>get_string( ). WHEN c_ityp-time. result = cl_abap_elemdescr=>get_t( ). WHEN c_ityp-xstring. result = cl_abap_elemdescr=>get_xstring( ). WHEN OTHERS. RAISE EXCEPTION TYPE zcx_expimp_vx. ENDCASE. CATCH cx_parameter_invalid_range INTO DATA(lx). " error has occurred at GET_C, GET_N, GET_P or GET_X. RAISE EXCEPTION TYPE zcx_expimp_vx EXPORTING previous = lx. ENDTRY. ENDMETHOD. ENDCLASS. CLASS lcl_dd_table IMPLEMENTATION. METHOD read. super->read( ). components = VALUE #( ). WHILE reader->get_current_byte( ) <> c_dd_id-table-end. CASE reader->get_current_byte( ). WHEN c_dd_id-primitive. APPEND NEW lcl_dd_simple( do )->read( ) TO components. * line_type = NEW lcl_dd_simple( do )->read( ). WHEN c_dd_id-filler. APPEND NEW lcl_dd_filler( do )->read( ) TO components. * line_type = NEW lcl_dd_filler( do )->read( ). WHEN OTHERS. RAISE EXCEPTION TYPE zcx_expimp_vx EXPORTING textid = zcx_expimp_vx=>invalid_dd_id. ENDCASE. ENDWHILE. reader->read_structure( IMPORTING data = data_description_end ). * line_type = NEW lcl_dd_structure( do ). result = me. ENDMETHOD. METHOD get_rtti. DATA(rtti_components) = VALUE abap_component_tab( FOR <component> IN components INDEX INTO i ( name = |CMP{ i WIDTH = 4 ALIGN = RIGHT PAD = '0' }| type = <component>->get_rtti( ) ) ). DATA(rtti_structure) = cl_abap_structdescr=>get( p_components = rtti_components ). result = cl_abap_tabledescr=>get( p_line_type = rtti_structure ). ENDMETHOD. METHOD get_dump. result = VALUE #( ( LINES OF super->get_dump( ) ) ( LINES OF VALUE #( FOR component IN components ( LINES OF component->get_dump( ) ) ( LINES OF get_dump_data_description( data_description_end ) ) ) ) ). ENDMETHOD. ENDCLASS. CLASS lcl_dd_structure IMPLEMENTATION. METHOD read. DATA: data_description_end TYPE zif_expimp_v6=>ty_data_description. super->read( ). WHILE reader->get_current_byte( ) <> c_dd_id-structure-end. APPEND lcl_dd=>create( do )->read( ) TO components. ENDWHILE. reader->read_structure( IMPORTING data = data_description_end ). IF data_description_end-id <> c_dd_id-structure-end. RAISE EXCEPTION TYPE zcx_expimp_vx. ENDIF. result = me. ENDMETHOD. METHOD get_rtti. DATA(rtti_components) = VALUE abap_component_tab( FOR <component> IN components INDEX INTO i ( name = |CMP{ i WIDTH = 4 ALIGN = RIGHT PAD = '0' }| type = <component>->get_rtti( ) ) ). result = cl_abap_structdescr=>get( p_components = rtti_components ). ENDMETHOD. ENDCLASS. CLASS lcl_dd_simple IMPLEMENTATION. METHOD read. super->read( ). type = data_description-type. flen = data_description-flen. decs = data_description-decs. result = me. ENDMETHOD. ENDCLASS. CLASS lcl_dd_filler IMPLEMENTATION. METHOD get_rtti. ENDMETHOD. METHOD read. super->read( ). result = me. ENDMETHOD. ENDCLASS. CLASS lcl_dv IMPLEMENTATION. METHOD create. CASE do->reader->get_current_byte( ). WHEN c_dv_id-single. RAISE EXCEPTION TYPE zcx_expimp_vx. * result = NEW lcl_dv_single( reader ). WHEN c_dv_id-boxed_component-start. RAISE EXCEPTION TYPE zcx_expimp_vx. WHEN c_dv_id-string_xstring-start. result = NEW lcl_dv_string_xstring( do ). WHEN c_dv_id-interval-start. result = NEW lcl_dv_interval( do ). WHEN c_dv_id-table-start. result = NEW lcl_dv_table( do ). WHEN OTHERS. RAISE EXCEPTION TYPE zcx_expimp_vx. ENDCASE. ENDMETHOD. METHOD constructor. me->do = do. me->reader = do->reader. ENDMETHOD. METHOD read. reader->read_structure( IMPORTING data = data_value ). position = reader->get_position( ). length = lcl_tool=>get_byte_or_char_length( type = do->dd->get_type( ) length = CONV #( data_value-len ) ). result = me. ENDMETHOD. METHOD get_structure. DATA(dd_struct) = CAST lcl_dd_structure( do->dd ). LOOP AT dd_struct->components INTO DATA(dd_component). ASSIGN COMPONENT sy-tabix OF STRUCTURE structure TO FIELD-SYMBOL(<component>). reader->read( EXPORTING n = dd_component->get_length( ) IMPORTING data = <component> ). ENDLOOP. ENDMETHOD. METHOD get_dump. result = VALUE #( ( | { data_value-id } { lcl_dump=>get_dv_id( data_value-id ) }| ) ( | { data_value-len } length ({ CONV i( data_value-len ) })| ) ). ENDMETHOD. ENDCLASS. CLASS lcl_dv_simple IMPLEMENTATION. METHOD read. ENDMETHOD. METHOD get_value. ENDMETHOD. ENDCLASS. CLASS lcl_dv_string_xstring IMPLEMENTATION. METHOD read. super->read( ). position = reader->get_position( ). length = lcl_tool=>get_byte_or_char_length( type = do->dd->get_type( ) length = CONV #( data_value-len ) ). reader->skip_x( CONV #( data_value-len ) ). reader->skip_given_byte( c_dv_id-string_xstring-end ). result = me. ENDMETHOD. METHOD get_value. IF do->dd IS INSTANCE OF lcl_dd_structure. get_structure( IMPORTING structure = value ). ELSE. reader->reposition( position ). reader->read( EXPORTING n = length IMPORTING data = value ). ENDIF. ENDMETHOD. ENDCLASS. CLASS lcl_dv_table IMPLEMENTATION. METHOD read. super->read( ). reader->read_structure( IMPORTING data = table_header ). WHILE reader->get_current_byte( ) <> c_dv_id-table-end. APPEND lcl_dv=>create( do )->read( ) TO lines. ENDWHILE. reader->read_structure( IMPORTING data = data_value_end ). IF data_value_end-id <> c_dv_id-table-end. RAISE EXCEPTION TYPE zcx_expimp_vx. ENDIF. result = me. ENDMETHOD. METHOD get_value. FIELD-SYMBOLS: <target_table> TYPE table. ASSIGN value TO <target_table>. LOOP AT lines INTO DATA(source_line). APPEND INITIAL LINE TO <target_table> ASSIGNING FIELD-SYMBOL(<target_line>). source_line->get_value( CHANGING value = <target_line> ). ENDLOOP. ENDMETHOD. METHOD get_dump. result = value #( ( lines of super->get_dump( ) ) ( | { table_header-lines } number of lines ({ conv i( table_header-lines ) })| ) ( | { data_value_end-id } { lcl_dump=>get_dv_id( data_value_end-id ) }| ) ). ENDMETHOD. ENDCLASS. CLASS lcl_dv_interval IMPLEMENTATION. METHOD get_value. reader->reposition( interval_position ). IF do->dd IS INSTANCE OF lcl_dd_structure. get_structure( IMPORTING structure = value ). ELSE. reader->read( EXPORTING n = interval_length IMPORTING data = value ). ENDIF. ENDMETHOD. METHOD read. interval_position = reader->get_position( ). interval_length = data_value-len. reader->skip_x( interval_length ). reader->skip_given_byte( c_dv_id-interval-end ). result = me. ENDMETHOD. ENDCLASS. CLASS lcl_do IMPLEMENTATION. METHOD read. DATA(start_position) = reader->get_position( ). IF reader->get_current_byte( ) = c_object_id-end_of_data. reader->skip_x( 1 ). IF reader->get_position( ) <> reader->length. RAISE EXCEPTION TYPE zcx_expimp_vx. ENDIF. RAISE EXCEPTION TYPE zcx_expimp_vx EXPORTING textid = zcx_expimp_vx=>end_of_data_objects. ENDIF. reader->read_structure( IMPORTING data = object_header ). reader->read( EXPORTING n = CONV #( object_header-nlen ) IMPORTING data = data_object_name_hex ). reader->skip_x( - object_header-nlen ). reader->read( EXPORTING n = CONV #( object_header-nlen ) IMPORTING data = data_object_name ). DATA(position_last_byte_of_data_obj) = start_position + object_header-next - 1. dd = lcl_dd=>create( me )->read( ). WHILE reader->get_position( ) <= position_last_byte_of_data_obj. APPEND lcl_dv=>create( me )->read( ) TO dvs. ENDWHILE. result = me. ENDMETHOD. METHOD create. result = NEW lcl_do( ). result->reader = reader. ENDMETHOD. METHOD get_dump. result = VALUE #( ( |DATA OBJECT:| ) ( | HEADER:| ) ( | { object_header-id } { lcl_dump=>get_object_id( object_header-id ) }| ) ( | { object_header-ityp } { lcl_dump=>get_type( object_header-ityp ) }| ) ( | { object_header-decs } decimals| ) ( | { object_header-leng } length| ) ( | { object_header-next } next data object| ) ( | { object_header-nlen } name length| ) ( | { object_header-thash } thash| ) ( | { object_header-typid } typid| ) ( | NAME:| ) ( | { data_object_name }| ) ( LINES OF dd->get_dump( ) ) ( LINES OF COND #( WHEN dvs IS INITIAL THEN VALUE #( ( | NO DATA VALUE| ) ) ELSE VALUE #( FOR dv IN dvs ( | DATA VALUE:| ) ( LINES OF dv->get_dump( ) ) ) ) ) ). ENDMETHOD. ENDCLASS. CLASS lcl_dump IMPLEMENTATION. METHOD constructor. me->importer = importer. me->reader = importer->reader. ENDMETHOD. METHOD get. DATA: data_objects TYPE TABLE OF REF TO lcl_do. TRY. WHILE reader->get_current_byte( ) <> zif_expimp_vx=>c_object_id-end_of_data. APPEND lcl_do=>create( reader )->read( ) TO data_objects. ENDWHILE. CATCH zcx_expimp_vx INTO DATA(error). ASSERT 1 = 1. " debug helper ENDTRY. result = VALUE #( ( |HEADER:| ) ( | { importer->transport_header-id } always| ) ( | { importer->transport_header-version } version| ) ( | { importer->transport_header-intformat } integer endianness : 01=big, 02=little| ) ( | { importer->transport_header-floatformat } float endianness : 01=big, 02=little| ) ( | { importer->transport_header-compress } compressed : 01=no, 02=yes| ) ( | { importer->transport_header-datadescription } "data description" ??| ) ( | { importer->transport_header-unused1 } unused| ) ( | { importer->transport_header-codepage } Code page US-ASCII ({ reader->encoding })| ) ( | { importer->transport_header-unused2 } unused| ) ( LINES OF VALUE #( FOR do IN data_objects ( LINES OF do->get_dump( ) ) ) ) ). ENDMETHOD. METHOD get_object_id. result = SWITCH #( object_id WHEN c_object_id-deep_structure THEN 'deep structure' WHEN c_object_id-deep_table THEN 'deep table' WHEN c_object_id-end_of_data THEN 'end_of_data' WHEN c_object_id-flat_structure THEN 'flat structure' WHEN c_object_id-flat_table THEN 'flat table' WHEN c_object_id-primitive THEN 'primitive' WHEN c_object_id-string THEN 'string' ELSE 'bug ??' ). ENDMETHOD. METHOD get_type. result = SWITCH #( type WHEN c_ityp-char THEN 'char ' WHEN c_ityp-date THEN 'date ' WHEN c_ityp-decfloat16 THEN 'decfloat16' WHEN c_ityp-decfloat34 THEN 'decfloat34' WHEN c_ityp-float THEN 'float ' WHEN c_ityp-fref THEN 'fref ' WHEN c_ityp-hex THEN 'hex ' WHEN c_ityp-int THEN 'int ' WHEN c_ityp-int1 THEN 'int1 ' WHEN c_ityp-int2 THEN 'int2 ' WHEN c_ityp-int8 THEN 'int8 ' WHEN c_ityp-iref THEN 'iref ' WHEN c_ityp-num THEN 'num ' WHEN c_ityp-obj1 THEN 'obj1 ' WHEN c_ityp-obj2 THEN 'obj2 ' WHEN c_ityp-packed THEN 'packed ' WHEN c_ityp-ref THEN 'ref ' WHEN c_ityp-string THEN 'string ' WHEN c_ityp-struct1 THEN 'struct1 ' WHEN c_ityp-struct2 THEN 'struct2 ' WHEN c_ityp-table THEN 'table ' WHEN c_ityp-time THEN 'time ' WHEN c_ityp-u1 THEN 'u1 ' WHEN c_ityp-u2 THEN 'u2 ' WHEN c_ityp-unknown1 THEN 'unknown1 ' WHEN c_ityp-unknown2 THEN 'unknown2 ' WHEN c_ityp-w THEN 'w ' WHEN c_ityp-xstring THEN 'xstring ' ELSE 'bug ??' ). ENDMETHOD. METHOD get_dd_id. result = SWITCH #( dd_id WHEN c_dd_id-boxed_component-start THEN 'start of boxed component' WHEN c_dd_id-boxed_component-end THEN 'end of boxed component' WHEN c_dd_id-filler THEN 'filler' WHEN c_dd_id-primitive THEN 'primitive' WHEN c_dd_id-structure-start THEN 'start of structure' WHEN c_dd_id-structure-end THEN 'end of structure' WHEN c_dd_id-structure_include-start THEN 'start of structure include' WHEN c_dd_id-structure_include-end THEN 'end of structure include' WHEN c_dd_id-table-start THEN 'start of table' WHEN c_dd_id-table-end THEN 'end of table' ELSE 'bug ??' ). ENDMETHOD. METHOD get_dv_id. result = SWITCH #( dv_id WHEN c_dv_id-boxed_component-start THEN 'start of boxed component' WHEN c_dv_id-boxed_component-end THEN 'end of boxed component' WHEN c_dv_id-interval-start THEN 'start of interval' WHEN c_dv_id-interval-end THEN 'end of interval' WHEN c_dv_id-single THEN 'single' WHEN c_dv_id-string_xstring-start THEN 'start of string/xstring' WHEN c_dv_id-string_xstring-end THEN 'end of string/xstring' WHEN c_dv_id-table-start THEN 'start of table' WHEN c_dv_id-table-end THEN 'end of table' ELSE 'bug ??' ). ENDMETHOD. ENDCLASS.
26.650775
131
0.640385
da135ba257796dd91a2650026c5bd2a202fcc15f
7,159
abap
ABAP
src/zabapgit_ci_job_scheduler.prog.abap
gregorwolf/CI
52492c67b74b6aff2fc73fefff212db200f7be83
[ "MIT" ]
null
null
null
src/zabapgit_ci_job_scheduler.prog.abap
gregorwolf/CI
52492c67b74b6aff2fc73fefff212db200f7be83
[ "MIT" ]
null
null
null
src/zabapgit_ci_job_scheduler.prog.abap
gregorwolf/CI
52492c67b74b6aff2fc73fefff212db200f7be83
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Report zabapgit_ci_submit_job_queue *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT zabapgit_ci_job_scheduler. TABLES: sscrfields. SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE TEXT-000. SELECTION-SCREEN COMMENT: 1(79) comm1, /1(79) comm2, /1(79) comm3, /1(79) comm4. SELECTION-SCREEN SKIP. SELECTION-SCREEN COMMENT: /1(79) comm5. SELECTION-SCREEN SKIP. SELECTION-SCREEN END OF BLOCK b0. SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(30) cvar1. PARAMETERS: p_var1 TYPE raldb-variant. SELECTION-SCREEN PUSHBUTTON 50(25) but1 USER-COMMAND cli1. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(30) cvar2. PARAMETERS: p_var2 TYPE raldb-variant. SELECTION-SCREEN PUSHBUTTON 50(25) but2 USER-COMMAND cli2. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(30) cvar3. PARAMETERS: p_var3 TYPE raldb-variant. SELECTION-SCREEN PUSHBUTTON 50(25) but3 USER-COMMAND cli3. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK b1. CLASS lcl_controller DEFINITION. PUBLIC SECTION. CLASS-METHODS: program_variant_f4 IMPORTING iv_program TYPE sy-repid CHANGING cv_variant TYPE raldb-variant, at_selection_screen, check_variant IMPORTING iv_variant TYPE raldb-variant iv_report TYPE rsvar-report RAISING zcx_abapgit_exception. METHODS: start RAISING zcx_abapgit_exception. PRIVATE SECTION. METHODS: call_job_overview. ENDCLASS. CLASS lcl_controller IMPLEMENTATION. METHOD start. NEW zcl_abapgit_ci_job_scheduler( iv_variant_update_abapgit = p_var1 iv_variant_update_abapgit_ci = p_var2 iv_variant_run_abapgit_ci = p_var3 )->schedule_jobs( ). MESSAGE |Job scheduled successfully| TYPE 'S'. IF zcl_abapgit_ui_factory=>get_gui_functions( )->gui_is_available( ). call_job_overview( ). ENDIF. ENDMETHOD. METHOD program_variant_f4. CALL FUNCTION 'RS_VARIANT_CATALOG' EXPORTING report = iv_program IMPORTING sel_variant = cv_variant EXCEPTIONS no_report = 1 report_not_existent = 2 report_not_supplied = 3 no_variants = 4 no_variant_selected = 5 variant_not_existent = 6 OTHERS = 7. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno DISPLAY LIKE sy-msgty WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDMETHOD. METHOD at_selection_screen. DATA: lv_report TYPE rsvar-report, lv_variant TYPE rsvar-variant. CASE sscrfields-ucomm. WHEN 'CLI1'. lv_report = zcl_abapgit_ci_job_scheduler=>co_report-update_abapgit. lv_variant = p_var1. WHEN 'CLI2'. lv_report = zcl_abapgit_ci_job_scheduler=>co_report-update_abapgit_ci. lv_variant = p_var2. WHEN 'CLI3'. lv_report = zcl_abapgit_ci_job_scheduler=>co_report-run_abapgit_ci. lv_variant = p_var3. WHEN OTHERS. RETURN. ENDCASE. CALL FUNCTION 'RS_VARIANT_SCREEN' EXPORTING report = lv_report variant = p_var1 IMPORTING variant = p_var1. ENDMETHOD. METHOD call_job_overview. DATA: ls_jobsel_params TYPE btcselect. ls_jobsel_params-abapname = |*ZABAPGIT_CI*|. ls_jobsel_params-jobname = |*ABAPGIT*CI*|. ls_jobsel_params-username = sy-uname. ls_jobsel_params-from_date = sy-datum. ls_jobsel_params-to_date = sy-datum + 1. ls_jobsel_params-from_time = sy-uzeit - 30. ls_jobsel_params-to_time = |235959|. ls_jobsel_params-prelim = abap_true. ls_jobsel_params-schedul = abap_true. ls_jobsel_params-ready = abap_true. ls_jobsel_params-running = abap_true. ls_jobsel_params-finished = abap_true. ls_jobsel_params-aborted = abap_true. CALL FUNCTION 'BP_JOB_MAINTENANCE_SM37B' EXPORTING o_jobsel_params = ls_jobsel_params EXCEPTIONS unknown_selection_error = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno DISPLAY LIKE sy-msgty WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDMETHOD. METHOD check_variant. DATA: lv_rc TYPE sy-subrc. IF iv_variant IS INITIAL. RETURN. ENDIF. CALL FUNCTION 'RS_VARIANT_EXISTS' EXPORTING report = iv_report variant = iv_variant IMPORTING r_c = lv_rc EXCEPTIONS not_authorized = 1 no_report = 2 report_not_existent = 3 report_not_supplied = 4 OTHERS = 5. IF sy-subrc <> 0 OR lv_rc > 0. MESSAGE |Variant { iv_variant } doesn't exist for report { iv_report }| TYPE 'E'. ENDIF. ENDMETHOD. ENDCLASS. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var1. lcl_controller=>program_variant_f4( EXPORTING iv_program = zcl_abapgit_ci_job_scheduler=>co_report-update_abapgit CHANGING cv_variant = p_var1 ). AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var2. lcl_controller=>program_variant_f4( EXPORTING iv_program = zcl_abapgit_ci_job_scheduler=>co_report-update_abapgit_ci CHANGING cv_variant = p_var2 ). AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_var3. lcl_controller=>program_variant_f4( EXPORTING iv_program = zcl_abapgit_ci_job_scheduler=>co_report-run_abapgit_ci CHANGING cv_variant = p_var3 ). AT SELECTION-SCREEN ON p_var1. lcl_controller=>check_variant( iv_report = zcl_abapgit_ci_job_scheduler=>co_report-update_abapgit iv_variant = p_var1 ). AT SELECTION-SCREEN ON p_var2. lcl_controller=>check_variant( iv_report = zcl_abapgit_ci_job_scheduler=>co_report-update_abapgit_ci iv_variant = p_var2 ). AT SELECTION-SCREEN ON p_var3. lcl_controller=>check_variant( iv_report = zcl_abapgit_ci_job_scheduler=>co_report-run_abapgit_ci iv_variant = p_var3 ). AT SELECTION-SCREEN. lcl_controller=>at_selection_screen( ). INITIALIZATION. comm1 = TEXT-c01. comm2 = TEXT-c02. comm3 = TEXT-c03. comm4 = TEXT-c04. comm5 = TEXT-c05. cvar1 = TEXT-v01. cvar2 = TEXT-v02. cvar3 = TEXT-v03. but1 = |{ icon_change } { TEXT-b01 }|. but2 = |{ icon_change } { TEXT-b01 }|. but3 = |{ icon_change } { TEXT-b01 }|. START-OF-SELECTION. TRY. NEW lcl_controller( )->start( ). CATCH zcx_abapgit_exception INTO DATA(lx_error). MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'. ENDTRY.
26.032727
103
0.637519
da16568118d053e34f26b79afeefd109d25ac65b
2,980
abap
ABAP
src/zfg_bc009_trreq.fugr.z_bc009_tms_tp_import.abap
OlegBash599/ZCTS_BROWSER
9056099a072f6ec9f020dd84fca7ec92c05694bb
[ "MIT" ]
12
2019-11-02T22:17:58.000Z
2020-12-21T18:34:25.000Z
src/zfg_bc009_trreq.fugr.z_bc009_tms_tp_import.abap
OlegBash599/ZCTS_BROWSER
9056099a072f6ec9f020dd84fca7ec92c05694bb
[ "MIT" ]
2
2019-08-31T21:07:42.000Z
2019-09-02T11:33:40.000Z
src/zfg_bc009_trreq.fugr.z_bc009_tms_tp_import.abap
OlegBash599/ZCTS_BROWSER
9056099a072f6ec9f020dd84fca7ec92c05694bb
[ "MIT" ]
5
2019-09-02T06:23:54.000Z
2020-12-20T13:45:33.000Z
FUNCTION z_bc009_tms_tp_import. *"---------------------------------------------------------------------- *"*"Local Interface: *" IMPORTING *" VALUE(IV_SYSTEM_NAME) TYPE STPA-SYSNAME *" VALUE(IV_REQUEST) TYPE STPA-TRKORR *" VALUE(IV_VERS_IGNORE) TYPE TRPARFLAG DEFAULT 'Y' *" EXPORTING *" VALUE(EV_TP_CMD_STRG) LIKE STPA-CMDSTRING *" VALUE(EV_TP_RET_CODE) LIKE STPA-RETCODE *" VALUE(EV_TP_MESSAGE) LIKE STPA-MESSAGE *" VALUE(EV_TP_VERSION) LIKE STPA-VERSION *" VALUE(EV_TP_ALOG) LIKE STPA-FILE *" VALUE(EV_TP_SLOG) LIKE STPA-FILE *" VALUE(EV_TP_PID) LIKE STPA-PID *" VALUE(EV_TPSTAT_KEY) LIKE STPA-TIMESTAMP *" TABLES *" TT_REQUEST STRUCTURE TPREQUEST OPTIONAL *" TT_PROJECT STRUCTURE TPPROJECT OPTIONAL *" TT_CLIENT STRUCTURE T000 OPTIONAL *" TT_STDOUT STRUCTURE TPSTDOUT OPTIONAL *" TT_LOGPTR STRUCTURE TPLOGPTR OPTIONAL *"---------------------------------------------------------------------- DATA lv_symandt TYPE symandt. """"""""""""""""""""""""""""""""""""""""""""' DATA lv_vers_ignore TYPE trparflag VALUE 'Y'. DATA lv_rc152 TYPE trparflag VALUE 'X'. """"""""""""""""""""""""""""""""""""""""""""' lv_symandt = sy-mandt. IF iv_vers_ignore IS SUPPLIED. lv_vers_ignore = iv_vers_ignore. ENDIF. CALL FUNCTION 'TMS_TP_IMPORT' EXPORTING iv_system_name = iv_system_name iv_request = iv_request iv_client = lv_symandt * IV_CTC_UI = * IV_CTC_ACTIVE = * IV_UMODES = * IV_TP_OPTIONS = * IV_IGN_PREDEC = iv_ign_cvers = lv_vers_ignore iv_ign_rc152 = lv_rc152 * IV_OFFLINE = * IV_FEEDBACK = * IV_PRID_TEXT = * IV_PRID_MIN = 0 * IV_PRID_MAX = 100 * IV_TEST_IMPORT = * IV_CMD_IMPORT = * IV_NO_DELIVERY = * IV_OWN_REQUEST = * IV_SUBSET = * IV_SIMULATE = GC_CI_SIMU_OFF * IV_BATCHID = * IT_TRPROJECT = * IT_SUCCESSOR = * IT_TARFILTER = IMPORTING ev_tp_cmd_strg = ev_tp_cmd_strg ev_tp_ret_code = ev_tp_ret_code ev_tp_message = ev_tp_message ev_tp_version = ev_tp_version ev_tp_alog = ev_tp_alog ev_tp_slog = ev_tp_slog ev_tp_pid = ev_tp_pid ev_tpstat_key = ev_tpstat_key TABLES tt_request = tt_request tt_project = tt_project tt_client = tt_client tt_stdout = tt_stdout tt_logptr = tt_logptr EXCEPTIONS permission_denied = 1 import_not_allowed = 2 enqueue_failed = 3 tp_call_failed = 4 tp_interface_error = 5 tp_reported_error = 6 tp_reported_info = 7 OTHERS = 8. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. ENDFUNCTION.
30.721649
72
0.555705
da17dce0fd25e4a9bf444c17a889a0521a608138
15,036
abap
ABAP
src/syntax/zcl_abapgit_syntax_abap.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
797
2015-02-06T15:38:41.000Z
2020-09-23T02:57:02.000Z
src/syntax/zcl_abapgit_syntax_abap.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
2,776
2015-01-13T03:59:55.000Z
2020-09-23T21:46:34.000Z
src/syntax/zcl_abapgit_syntax_abap.clas.abap
amit3kumar/ABAP_ALL
67822ae13ffda6597a91bb5b39e428c39bc445a3
[ "MIT" ]
499
2015-01-13T03:41:36.000Z
2020-09-22T11:50:54.000Z
CLASS zcl_abapgit_syntax_abap DEFINITION PUBLIC INHERITING FROM zcl_abapgit_syntax_highlighter CREATE PUBLIC . PUBLIC SECTION. CLASS-METHODS class_constructor. METHODS constructor. CONSTANTS: BEGIN OF c_css, keyword TYPE string VALUE 'keyword', text TYPE string VALUE 'text', comment TYPE string VALUE 'comment', END OF c_css, BEGIN OF c_token, keyword TYPE c VALUE 'K', text TYPE c VALUE 'T', comment TYPE c VALUE 'C', END OF c_token, BEGIN OF c_regex, comment TYPE string VALUE '##|"|^\*', text TYPE string VALUE '`|''|\||\{|\}', keyword TYPE string VALUE '&&|\b[-_a-z0-9]+\b', END OF c_regex. PROTECTED SECTION. CLASS-DATA gt_keywords TYPE HASHED TABLE OF string WITH UNIQUE KEY table_line. CLASS-METHODS init_keywords. CLASS-METHODS is_keyword IMPORTING iv_chunk TYPE string RETURNING VALUE(rv_yes) TYPE abap_bool. METHODS order_matches REDEFINITION. METHODS parse_line REDEFINITION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_ABAPGIT_SYNTAX_ABAP IMPLEMENTATION. METHOD class_constructor. init_keywords( ). ENDMETHOD. METHOD constructor. super->constructor( ). " Initialize instances of regular expression add_rule( iv_regex = c_regex-keyword iv_token = c_token-keyword iv_style = c_css-keyword ). add_rule( iv_regex = c_regex-comment iv_token = c_token-comment iv_style = c_css-comment ). add_rule( iv_regex = c_regex-text iv_token = c_token-text iv_style = c_css-text ). ENDMETHOD. METHOD init_keywords. DATA: lv_keywords TYPE string, lt_keywords TYPE STANDARD TABLE OF string. lv_keywords = '&&|?TO|ABAP-SOURCE|ABBREVIATED|ABS|ABSTRACT|ACCEPT|ACCEPTING' && '|ACCORDING|ACOS|ACTIVATION|ACTUAL|ADD|ADD-CORRESPONDING|ADJACENT|AFTER|ALIAS' && '|ALIASES|ALIGN|ALL|ALLOCATE|ALPHA|ANALYSIS|ANALYZER|AND|ANY|APPEND|APPENDAGE' && '|APPENDING|APPLICATION|ARCHIVE|AREA|ARITHMETIC|AS|ASCENDING|ASIN|ASPECT|ASSERT' && '|ASSIGN|ASSIGNED|ASSIGNING|ASSOCIATION|ASYNCHRONOUS|AT|ATAN|ATTRIBUTES|AUTHORITY' && '|AUTHORITY-CHECK|AVG|BACK|BACKGROUND|BACKUP|BACKWARD|BADI|BASE|BEFORE|BEGIN' && '|BETWEEN|BIG|BINARY|BIT|BIT-AND|BIT-NOT|BIT-OR|BIT-XOR|BLACK|BLANK' && '|BLANKS|BLOB|BLOCK|BLOCKS|BLUE|BOUND|BOUNDARIES|BOUNDS|BOXED|BREAK-POINT|BT' && '|BUFFER|BY|BYPASSING|BYTE|BYTE-CA|BYTE-CN|BYTE-CO|BYTE-CS|BYTE-NA|BYTE-NS' && '|BYTE-ORDER|C|CA|CALL|CALLING|CASE|CAST|CASTING|CATCH|CEIL|CENTER|CENTERED' && '|CHAIN|CHAIN-INPUT|CHAIN-REQUEST|CHANGE|CHANGING|CHANNELS|CHARACTER|CHARLEN' && '|CHAR-TO-HEX|CHECK|CHECKBOX|CI_|CIRCULAR|CLASS|CLASS-CODING|CLASS-DATA' && '|CLASS-EVENTS|CLASS-METHODS|CLASS-POOL|CLEANUP|CLEAR|CLIENT|CLOB|CLOCK|CLOSE' && '|CN|CO|COALESCE|CODE|CODING|COL_BACKGROUND|COL_GROUP|COL_HEADING|COL_KEY' && '|COL_NEGATIVE|COL_NORMAL|COL_POSITIVE|COL_TOTAL|COLLECT|COLOR|COLUMN|COLUMNS' && '|COMMENT|COMMENTS|COMMIT|COMMON|COMMUNICATION|COMPARING|COMPONENT|COMPONENTS' && '|COMPRESSION|COMPUTE|CONCAT|CONCATENATE|COND|CONDENSE|CONDITION|CONNECT' && '|CONNECTION|CONSTANTS|CONTEXT|CONTEXTS|CONTINUE|CONTROL|CONTROLS|CONV|CONVERSION' && '|CONVERT|COPIES|COPY|CORRESPONDING|COS|COSH|COUNT|COUNTRY|COVER|CP|CPI|CREATE' && '|CREATING|CRITICAL|CS|CURRENCY|CURRENCY_CONVERSION|CURRENT|CURSOR|CURSOR-SELECTION' && '|CUSTOMER|CUSTOMER-FUNCTION|DANGEROUS|DATA|DATABASE|DATAINFO|DATASET|DATE' && '|DAYLIGHT|DBMAXLEN|DD/MM/YY|DD/MM/YYYY|DDMMYY|DEALLOCATE|DECIMAL_SHIFT|DECIMALS' && '|DECLARATIONS|DEEP|DEFAULT|DEFERRED|DEFINE|DEFINING|DEFINITION|DELETE|DELETING' && '|DEMAND|DEPARTMENT|DESCENDING|DESCRIBE|DESTINATION|DETAIL|DIALOG|DIRECTORY' && '|DISCONNECT|DISPLAY|DISPLAY-MODE|DISTANCE|DISTINCT|DIV|DIVIDE|DIVIDE-CORRESPONDING' && '|DIVISION|DO|DUMMY|DUPLICATE|DUPLICATES|DURATION|DURING|DYNAMIC|DYNPRO' && '|EDIT|EDITOR-CALL|ELSE|ELSEIF|EMPTY|ENABLED|ENABLING|ENCODING|END|ENDAT|ENDCASE' && '|ENDCATCH|ENDCHAIN|ENDCLASS|ENDDO|ENDENHANCEMENT|END-ENHANCEMENT-SECTION' && '|ENDEXEC|ENDFORM|ENDFUNCTION|ENDIAN|ENDIF|ENDING|ENDINTERFACE' && '|END-LINES|ENDLOOP|ENDMETHOD|ENDMODULE|END-OF-DEFINITION|END-OF-FILE' && '|END-OF-PAGE|END-OF-SELECTION|ENDON|ENDPROVIDE|ENDSELECT|ENDTRY|ENDWHILE' && '|ENGINEERING|ENHANCEMENT|ENHANCEMENT-POINT|ENHANCEMENTS|ENHANCEMENT-SECTION' && '|ENTRIES|ENTRY|ENVIRONMENT|EQ|EQUIV|ERRORMESSAGE|ERRORS|ESCAPE|ESCAPING' && '|EVENT|EVENTS|EXACT|EXCEPT|EXCEPTION|EXCEPTIONS|EXCEPTION-TABLE|EXCLUDE|EXCLUDING' && '|EXEC|EXECUTE|EXISTS|EXIT|EXIT-COMMAND|EXP|EXPAND|EXPANDING|EXPIRATION|EXPLICIT' && '|EXPONENT|EXPORT|EXPORTING|EXTEND|EXTENDED|EXTENSION|EXTRACT|FAIL|FETCH|FIELD' && '|FIELD-GROUPS|FIELDS|FIELD-SYMBOL|FIELD-SYMBOLS|FILE|FILTER|FILTERS|FILTER-TABLE' && '|FINAL|FIND|FIRST|FIRST-LINE|FIXED-POINT|FKEQ|FKGE|FLOOR|FLUSH|FONT|FOR|FORM' && '|FORMAT|FORWARD|FOUND|FRAC|FRAME|FRAMES|FREE|FRIENDS|FROM|FUNCTION|FUNCTIONALITY' && '|FUNCTION-POOL|FURTHER|GAPS|GE|GENERATE|GET|GIVING|GKEQ|GKGE|GLOBAL|GRANT' && '|GREEN|GROUP|GROUPS|GT|HANDLE|HANDLER|HARMLESS|HASHED|HAVING|HDB|HEADER|HEADERS' && '|HEADING|HEAD-LINES|HELP-ID|HELP-REQUEST|HIDE|HIGH|HINT|HOLD|HOTSPOT|I|ICON|ID' && '|IDENTIFICATION|IDENTIFIER|IDS|IF|IGNORE|IGNORING|IMMEDIATELY|IMPLEMENTATION' && '|IMPLEMENTATIONS|IMPLEMENTED|IMPLICIT|IMPORT|IMPORTING|IN|INACTIVE|INCL|INCLUDE' && '|INCLUDES|INCLUDING|INCREMENT|INDEX|INDEX-LINE|INFOTYPES|INHERITING|INIT|INITIAL' && '|INITIALIZATION|INNER|INOUT|INPUT|INSERT|INSTANCES|INTENSIFIED|INTERFACE' && '|INTERFACE-POOL|INTERFACES|INTERNAL|INTERVALS|INTO|INVERSE|INVERTED-DATE|IS' && '|ISO|JOB|JOIN|KEEP|KEEPING|KERNEL|KEY|KEYS|KEYWORDS|KIND' && '|LANGUAGE|LAST|LATE|LAYOUT|LE|LEADING|LEAVE|LEFT|LEFT-JUSTIFIED|LEFTPLUS' && '|LEFTSPACE|LEGACY|LENGTH|LET|LEVEL|LEVELS|LIKE|LINE|LINE-COUNT|LINEFEED' && '|LINES|LINE-SELECTION|LINE-SIZE|LIST|LISTBOX|LIST-PROCESSING|LITTLE|LLANG' && '|LOAD|LOAD-OF-PROGRAM|LOB|LOCAL|LOCALE|LOCATOR|LOG|LOG10|LOGFILE|LOGICAL' && '|LOG-POINT|LONG|LOOP|LOW|LOWER|LPAD|LPI|LT|M|MAIL|MAIN|MAJOR-ID|MAPPING|MARGIN' && '|MARK|MASK|MATCH|MATCHCODE|MAX|MAXIMUM|MEDIUM|MEMBERS|MEMORY|MESH|MESSAGE' && '|MESSAGE-ID|MESSAGES|MESSAGING|METHOD|METHODS|MIN|MINIMUM|MINOR-ID|MM/DD/YY' && '|MM/DD/YYYY|MMDDYY|MOD|MODE|MODIF|MODIFIER|MODIFY|MODULE|MOVE|MOVE-CORRESPONDING' && '|MULTIPLY|MULTIPLY-CORRESPONDING|NA|NAME|NAMETAB|NATIVE|NB|NE|NESTED|NESTING' && '|NEW|NEW-LINE|NEW-PAGE|NEW-SECTION|NEXT|NO|NODE|NODES|NO-DISPLAY' && '|NO-EXTENSION|NO-GAP|NO-GAPS|NO-GROUPING|NO-HEADING|NON-UNICODE|NON-UNIQUE' && '|NO-SCROLLING|NO-SIGN|NOT|NO-TITLE|NO-TOPOFPAGE|NO-ZERO|NP|NS|NULL|NUMBER' && '|NUMOFCHAR|O|OBJECT|OBJECTS|OBLIGATORY|OCCURRENCE|OCCURRENCES|OCCURS|OF|OFF' && '|OFFSET|OLE|ON|ONLY|OPEN|OPTION|OPTIONAL|OPTIONS|OR|ORDER|OTHER|OTHERS|OUT' && '|OUTER|OUTPUT|OUTPUT-LENGTH|OVERFLOW|OVERLAY|PACK|PACKAGE|PAD|PADDING|PAGE' && '|PAGES|PARAMETER|PARAMETERS|PARAMETER-TABLE|PART|PARTIALLY|PATTERN|PERCENTAGE' && '|PERFORM|PERFORMING|PERSON|PF1|PF2|PF3|PF4|PF5|PF6|PF7|PF8|PF9|PF10|PF11|PF12' && '|PF13|PF14|PF15|PF-STATUS|PINK|PLACES|POOL|POS_HIGH|POS_LOW' && '|POSITION|PRAGMAS|PRECOMPILED|PREFERRED|PRESERVING|PRIMARY|PRINT|PRINT-CONTROL' && '|PRIORITY|PRIVATE|PROCEDURE|PROCESS|PROGRAM|PROPERTY|PROTECTED|PROVIDE|PUBLIC' && '|PUSHBUTTON|PUT|QUEUE-ONLY|QUICKINFO|RADIOBUTTON|RAISE|RAISING|RANGE|RANGES' && '|RAW|READ|READER|READ-ONLY|RECEIVE|RECEIVED|RECEIVER|RECEIVING|RED|REDEFINITION' && '|REDUCE|REDUCED|REF|REFERENCE|REFRESH|REGEX|REJECT|REMOTE|RENAMING|REPLACE' && '|REPLACEMENT|REPLACING|REPORT|REQUEST|REQUESTED|RESERVE|RESET|RESOLUTION' && '|RESPECTING|RESPONSIBLE|RESULT|RESULTS|RESUMABLE|RESUME|RETRY|RETURN|RETURNCODE' && '|RETURNING|RIGHT|RIGHT-JUSTIFIED|RIGHTPLUS|RIGHTSPACE|RISK|RMC_COMMUNICATION_FAILURE' && '|RMC_INVALID_STATUS|RMC_SYSTEM_FAILURE|ROLE|ROLLBACK|ROUND|ROWS|RUN|SAP' && '|SAP-SPOOL|SAVING|SCALE_PRESERVING|SCALE_PRESERVING_SCIENTIFIC|SCAN|SCIENTIFIC' && '|SCIENTIFIC_WITH_LEADING_ZERO|SCREEN|SCROLL|SCROLL-BOUNDARY|SCROLLING|SEARCH' && '|SECONDARY|SECONDS|SECTION|SELECT|SELECTION|SELECTIONS|SELECTION-SCREEN|SELECTION-SET' && '|SELECTION-SETS|SELECTION-TABLE|SELECT-OPTIONS|SEND|SEPARATE|SEPARATED|SET' && '|SHARED|SHIFT|SHORT|SHORTDUMP-ID|SIGN|SIGN_AS_POSTFIX|SIMPLE|SIN|SINGLE|SINH|SIZE' && '|SKIP|SKIPPING|SMART|SOME|SORT|SORTABLE|SORTED|SOURCE|SPACE|SPECIFIED|SPLIT|SPOOL' && '|SPOTS|SQL|SQLSCRIPT|SQRT|STABLE|STAMP|STANDARD|STARTING|START-OF-SELECTION|STATE' && '|STATEMENT|STATEMENTS|STATIC|STATICS|STATUSINFO|STEP-LOOP|STOP|STRLEN|STRUCTURE' && '|STRUCTURES|STYLE|SUBKEY|SUBMATCHES|SUBMIT|SUBROUTINE|SUBSCREEN|SUBSTRING|SUBTRACT' && '|SUBTRACT-CORRESPONDING|SUFFIX|SUM|SUMMARY|SUMMING|SUPPLIED|SUPPLY|SUPPRESS|SWITCH' && '|SWITCHSTATES|SYMBOL|SYNCPOINTS|SYNTAX|SYNTAX-CHECK|SYNTAX-TRACE' && '|SYSTEM-CALL|SYSTEM-EXCEPTIONS|SYSTEM-EXIT|TAB|TABBED|TABLE|TABLES|TABLEVIEW|TABSTRIP' && '|TAN|TANH|TARGET|TASK|TASKS|TEST|TESTING|TEXT|TEXTPOOL|THEN|THROW|TIME|TIMES|TIMESTAMP' && '|TIMEZONE|TITLE|TITLEBAR|TITLE-LINES|TO|TOKENIZATION|TOKENS|TOP-LINES|TOP-OF-PAGE' && '|TRACE-FILE|TRACE-TABLE|TRAILING|TRANSACTION|TRANSFER|TRANSFORMATION|TRANSLATE' && '|TRANSPORTING|TRMAC|TRUNC|TRUNCATE|TRUNCATION|TRY|TYPE|TYPE-POOL|TYPE-POOLS|TYPES' && '|ULINE|UNASSIGN|UNDER|UNICODE|UNION|UNIQUE|UNIT|UNIT_CONVERSION|UNIX|UNPACK|UNTIL' && '|UNWIND|UP|UPDATE|UPPER|USER|USER-COMMAND|USING|UTF-8|VALID|VALUE|VALUE-REQUEST|VALUES' && '|VARY|VARYING|VERIFICATION-MESSAGE|VERSION|VIA|VIEW|VISIBLE|WAIT|WARNING|WHEN|WHENEVER' && '|WHERE|WHILE|WIDTH|WINDOW|WINDOWS|WITH|WITH-HEADING|WITHOUT|WITH-TITLE|WORD|WORK' && '|WRITE|WRITER|X|XML|XSD|XSTRLEN|YELLOW|YES|YYMMDD|Z|ZERO|ZONE' && '|BINTOHEX|CHAR|CLNT|CONCAT_WITH_SPACE|CURR|DATS|DATS_ADD_DAYS|DATS_ADD_MONTHS' && '|DATS_DAYS_BETWEEN|DATS_IS_VALID|DEC|END-OF-EDITING|END-TEST-INJECTION|END-TEST-SEAM' && '|ENDWITH|ENUM|HEXTOBIN|INSTANCE|INSTR|LANG|LTRIM|NUMC|PUSH' && '|QUAN|RETURNS|RPAD|RTRIM|SSTRING|START-OF-EDITING|TEST-INJECTION|TEST-SEAM|TIMS' && '|TIMS_IS_VALID|TSTMP_ADD_SECONDS|TSTMP_CURRENT_UTCTIMESTAMP|TSTMP_IS_VALID' && '|TSTMP_SECONDS_BETWEEN|B|D|DECFLOAT16|DECFLOAT34|F|INT8|N|P|S|STRING|T|UTCLONG|XSTRING' && '|ABAP_BOOL|ACCP|CUKY|DF16_DEC|DF16_RAW|DF34_DEC|DF34_RAW|FLTP' && '|INT1|INT2|INT4|LCHR|LRAW|RAWSTRING|DF16_SCL|DF34_SCL' && '|PREC|VARC|CLIKE|CSEQUENCE|DECFLOAT|NUMERIC|XSEQUENCE|ME|SYST|SY' && '|BIT-SET|BOOLC|BOOLX|CHAR_OFF|CMAX|CMIN|CONCAT_LINES_OF|CONTAINS|CONTAINS_ANY_NOT_OF' && '|CONTAINS_ANY_OF|COUNT_ANY_NOT_OF|COUNT_ANY_OF|FIND_ANY_NOT_OF|FIND_ANY_OF|FIND_END' && '|FROM_MIXED|IPOW|LINE_EXISTS|LINE_INDEX|MATCHES|NMAX|NMIN|REPEAT|RESCALE|REVERSE' && '|SEGMENT|SHIFT_LEFT|SHIFT_RIGHT|SUBSTRING_AFTER|SUBSTRING_BEFORE|SUBSTRING_FROM|SUBSTRING_TO' && '|TO_LOWER|TO_MIXED|TO_UPPER|UTCLONG_ADD|UTCLONG_CURRENT|UTCLONG_DIFF|XSDBOOL'. SPLIT lv_keywords AT '|' INTO TABLE lt_keywords. " remove duplicates to avoid dumps when converting to a hash table SORT lt_keywords BY table_line ASCENDING. DELETE ADJACENT DUPLICATES FROM lt_keywords. gt_keywords = lt_keywords. " Hash table ENDMETHOD. METHOD is_keyword. DATA lv_str TYPE string. lv_str = to_upper( iv_chunk ). READ TABLE gt_keywords WITH KEY table_line = lv_str TRANSPORTING NO FIELDS. rv_yes = boolc( sy-subrc = 0 ). ENDMETHOD. METHOD order_matches. DATA: lv_index TYPE sy-tabix, lv_line_len TYPE i, lv_prev_token TYPE c. FIELD-SYMBOLS: <ls_prev> TYPE ty_match, <ls_match> TYPE ty_match. SORT ct_matches BY offset. lv_line_len = strlen( iv_line ). LOOP AT ct_matches ASSIGNING <ls_match>. lv_index = sy-tabix. " Delete matches after open text match IF lv_prev_token = c_token-text AND <ls_match>-token <> c_token-text. DELETE ct_matches INDEX lv_index. CONTINUE. ENDIF. CASE <ls_match>-token. WHEN c_token-keyword. IF <ls_match>-offset > 0 AND substring( val = iv_line off = ( <ls_match>-offset - 1 ) len = 1 ) CA '-<'. " Delete match if keyword is part of structure or field symbol DELETE ct_matches INDEX lv_index. CONTINUE. ENDIF. WHEN c_token-comment. <ls_match>-length = lv_line_len - <ls_match>-offset. DELETE ct_matches FROM lv_index + 1. CONTINUE. WHEN c_token-text. <ls_match>-text_tag = substring( val = iv_line off = <ls_match>-offset len = <ls_match>-length ). IF lv_prev_token = c_token-text. IF <ls_match>-text_tag = <ls_prev>-text_tag. <ls_prev>-length = <ls_match>-offset + <ls_match>-length - <ls_prev>-offset. CLEAR lv_prev_token. ELSEIF <ls_prev>-text_tag = '}' AND <ls_match>-text_tag = '{'. <ls_prev>-length = <ls_match>-offset - <ls_prev>-offset - 1. " Shift } out of scope <ls_prev>-offset = <ls_prev>-offset + 1. " Shift { out of scope CLEAR lv_prev_token. ELSEIF <ls_match>-text_tag = '{'. <ls_prev>-length = <ls_match>-offset - <ls_prev>-offset. CLEAR lv_prev_token. ELSEIF <ls_prev>-text_tag = '}'. <ls_prev>-length = <ls_match>-offset - <ls_prev>-offset. <ls_prev>-offset = <ls_prev>-offset + 1. " Shift } out of scope CLEAR lv_prev_token. ENDIF. DELETE ct_matches INDEX lv_index. CONTINUE. ENDIF. ENDCASE. lv_prev_token = <ls_match>-token. ASSIGN <ls_match> TO <ls_prev>. ENDLOOP. ENDMETHOD. METHOD parse_line. "REDEFINITION DATA lv_index TYPE i. FIELD-SYMBOLS <ls_match> LIKE LINE OF rt_matches. rt_matches = super->parse_line( iv_line ). " Remove non-keywords LOOP AT rt_matches ASSIGNING <ls_match> WHERE token = c_token-keyword. lv_index = sy-tabix. IF abap_false = is_keyword( substring( val = iv_line off = <ls_match>-offset len = <ls_match>-length ) ). DELETE rt_matches INDEX lv_index. ENDIF. ENDLOOP. ENDMETHOD. ENDCLASS.
48.977199
103
0.688481
da18908a8a3ac7be05d05dc5b68cefcda7ab1c00
288
abap
ABAP
src/sxml/if_sxml.intf.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
src/sxml/if_sxml.intf.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
src/sxml/if_sxml.intf.abap
mbtools/open-abap
13274b1536752ec96edb68460ccdea7fe68625d9
[ "MIT" ]
null
null
null
INTERFACE if_sxml PUBLIC. TYPES xml_stream_type TYPE i. CONSTANTS co_xt_xml10 TYPE xml_stream_type VALUE 1. CONSTANTS co_xt_binary TYPE xml_stream_type VALUE 2. CONSTANTS co_xt_xop TYPE xml_stream_type VALUE 3. CONSTANTS co_xt_json TYPE xml_stream_type VALUE 4. ENDINTERFACE.
28.8
54
0.822917
da18d14b7a7fff30db880ffc9ae47e2945c76e5c
1,492
abap
ABAP
exercises/practice/kindergarten-garden/.meta/zcl_kindergarten_garden.clas.abap
marianfoo/abap
b4d427d16955fe873ce5f349d4e253a8878186cf
[ "MIT" ]
23
2021-10-01T12:48:00.000Z
2022-03-31T08:34:36.000Z
exercises/practice/kindergarten-garden/.meta/zcl_kindergarten_garden.clas.abap
mbtools/abap
f806df9956254e7edd4848c927ca366c447a46b1
[ "MIT" ]
54
2021-09-30T15:14:04.000Z
2022-03-31T17:30:50.000Z
exercises/practice/kindergarten-garden/.meta/zcl_kindergarten_garden.clas.abap
mbtools/abap
f806df9956254e7edd4848c927ca366c447a46b1
[ "MIT" ]
13
2021-10-01T20:46:24.000Z
2022-03-29T16:49:42.000Z
CLASS zcl_kindergarten_garden DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS constructor. METHODS plants IMPORTING diagram TYPE string student TYPE string RETURNING VALUE(results) TYPE string_table. PROTECTED SECTION. PRIVATE SECTION. DATA students TYPE string_table. ENDCLASS. CLASS zcl_kindergarten_garden IMPLEMENTATION. METHOD constructor. students = VALUE #( ( |Alice| ) ( |Bob| ) ( |Charlie| ) ( |David| ) ( |Eve| ) ( |Fred| ) ( |Ginny| ) ( |Harriet| ) ( |Ileana| ) ( |Joseph| ) ( |Kincaid| ) ( |Larry| ) ). ENDMETHOD. METHOD plants. SPLIT diagram AT '\n' INTO TABLE DATA(rows). LOOP AT students ASSIGNING FIELD-SYMBOL(<student>). IF <student> = student. DATA(column1) = ( sy-tabix * 2 ) - 2. DATA(column2) = ( sy-tabix * 2 ) - 1. ENDIF. ENDLOOP. DATA(row1) = rows[ 1 ]. DATA(row2) = rows[ 2 ]. APPEND row1+column1(1) TO results. APPEND row1+column2(1) TO results. APPEND row2+column1(1) TO results. APPEND row2+column2(1) TO results. LOOP AT results ASSIGNING FIELD-SYMBOL(<plant>). IF <plant> = 'R'. <plant> = 'radishes'. ENDIF. IF <plant> = 'C'. <plant> = 'clover'. ENDIF. IF <plant> = 'G'. <plant> = 'grass'. ENDIF. IF <plant> = 'V'. <plant> = 'violets'. ENDIF. ENDLOOP. ENDMETHOD. ENDCLASS.
24.459016
104
0.564343
da1b849066d0134bd9d432f85b81054699cc14fc
1,109
abap
ABAP
src/adt/vh/zcl_sat_adt_res_class_categ_vh.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
9
2019-11-14T12:27:19.000Z
2022-01-26T16:35:09.000Z
src/adt/vh/zcl_sat_adt_res_class_categ_vh.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
13
2019-12-04T15:02:12.000Z
2021-11-25T16:43:12.000Z
src/adt/vh/zcl_sat_adt_res_class_categ_vh.clas.abap
christianguenter2/abap-search-tools
b8486d0f43886b0657ecbe6afc6b844e5b12d10e
[ "Apache-2.0" ]
4
2019-11-14T13:59:43.000Z
2020-08-05T09:58:30.000Z
"! <p class="shorttext synchronized" lang="en">Resource for reading ABAP OO Class category</p> CLASS zcl_sat_adt_res_class_categ_vh DEFINITION PUBLIC INHERITING FROM cl_adt_res_named_items FINAL CREATE PUBLIC . PUBLIC SECTION. PROTECTED SECTION. METHODS get_named_items REDEFINITION. PRIVATE SECTION. ENDCLASS. CLASS zcl_sat_adt_res_class_categ_vh IMPLEMENTATION. METHOD get_named_items. DATA(lt_categories) = zcl_sat_clif_search_param_util=>get_categories( ). LOOP AT lt_categories INTO DATA(lv_category). TRY. zcl_sat_clif_search_param_util=>convert_category_to_ext( EXPORTING iv_internal = CONV #( lv_category ) IMPORTING ev_external = DATA(lv_external) ev_description = DATA(lv_description) ). CATCH zcx_sat_conversion_exc. CONTINUE. ENDTRY. p_named_item_list-items = VALUE #( BASE p_named_item_list-items ( name = lv_external description = lv_description ) ). ENDLOOP. p_filter_already_applied = abap_true. ENDMETHOD. ENDCLASS.
27.04878
94
0.701533
da1c4574de4fedd37786c450efb48b8b45b79df8
18,334
abap
ABAP
src/zsaplink_tables.clas.abap
pokrakam/SAPLink-Git
b300d6b5d93282cdcde3a7aba217501e90cc5b6c
[ "Apache-2.0" ]
9
2018-11-07T12:19:59.000Z
2022-02-05T15:37:14.000Z
src/zsaplink_tables.clas.abap
pokrakam/SAPlink-Git
b300d6b5d93282cdcde3a7aba217501e90cc5b6c
[ "Apache-2.0" ]
null
null
null
src/zsaplink_tables.clas.abap
pokrakam/SAPlink-Git
b300d6b5d93282cdcde3a7aba217501e90cc5b6c
[ "Apache-2.0" ]
null
null
null
class ZSAPLINK_TABLES definition public inheriting from ZSAPLINK final create public . public section. methods CHECKEXISTS redefinition . methods CREATEIXMLDOCFROMOBJECT redefinition . methods CREATEOBJECTFROMIXMLDOC redefinition . protected section. methods DELETEOBJECT redefinition . methods GETOBJECTTYPE redefinition . private section. ENDCLASS. CLASS ZSAPLINK_TABLES IMPLEMENTATION. METHOD checkexists. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| The code of this project is provided to you under the current | *| version of the SAP Code Exchange Terms of Use. You can find the | *| text on the SAP Code Exchange webpage at http://www.sdn.sap.com | *| | *| SAPlink is provided to you AS IS with no guarantee, warranty or | *| support. | *\---------------------------------------------------------------------/ * Plugin created by: * Thomas Jung * [email protected] DATA: l_name TYPE ddobjname, dd02v_wa TYPE dd02v. l_name = objname. CALL FUNCTION 'DDIF_TABL_GET' EXPORTING name = l_name IMPORTING dd02v_wa = dd02v_wa EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc = 0 AND dd02v_wa-tabname IS NOT INITIAL. exists = 'X'. ENDIF. ENDMETHOD. METHOD createixmldocfromobject. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| The code of this project is provided to you under the current | *| version of the SAP Code Exchange Terms of Use. You can find the | *| text on the SAP Code Exchange webpage at http://www.sdn.sap.com | *| | *| SAPlink is provided to you AS IS with no guarantee, warranty or | *| support. | *\---------------------------------------------------------------------/ * Plugin created by: * Thomas Jung * [email protected] DATA: gotstate TYPE ddgotstate, dd02v_wa TYPE dd02v, dd09l_wa TYPE dd09v, dd03p_tab TYPE STANDARD TABLE OF dd03p, dd03p_wa LIKE LINE OF dd03p_tab, dd05m_tab TYPE STANDARD TABLE OF dd05m, dd05m_wa LIKE LINE OF dd05m_tab, dd08v_tab TYPE STANDARD TABLE OF dd08v, dd08v_wa LIKE LINE OF dd08v_tab, dd12v_tab TYPE STANDARD TABLE OF dd12v, dd12v_wa LIKE LINE OF dd12v_tab, dd17v_tab TYPE STANDARD TABLE OF dd17v, dd17v_wa LIKE LINE OF dd17v_tab, dd35v_tab TYPE STANDARD TABLE OF dd35v, dd35v_wa LIKE LINE OF dd35v_tab, dd36m_tab TYPE STANDARD TABLE OF dd36m, dd36m_wa LIKE LINE OF dd36m_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd09l_node TYPE REF TO if_ixml_element. DATA dd03p_node TYPE REF TO if_ixml_element. DATA dd05m_node TYPE REF TO if_ixml_element. DATA dd08v_node TYPE REF TO if_ixml_element. DATA dd12v_node TYPE REF TO if_ixml_element. DATA dd17v_node TYPE REF TO if_ixml_element. DATA dd35v_node TYPE REF TO if_ixml_element. DATA dd36m_node TYPE REF TO if_ixml_element. DATA rc TYPE sysubrc. DATA _tablname TYPE ddobjname. _tablname = objname. CALL FUNCTION 'DDIF_TABL_GET' EXPORTING name = _tablname langu = sy-langu IMPORTING gotstate = gotstate dd02v_wa = dd02v_wa dd09l_wa = dd09l_wa TABLES dd03p_tab = dd03p_tab dd05m_tab = dd05m_tab dd08v_tab = dd08v_tab dd12v_tab = dd12v_tab dd17v_tab = dd17v_tab dd35v_tab = dd35v_tab dd36m_tab = dd36m_tab EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0 OR dd02v_wa-tabname IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found. ENDIF. * Create parent node DATA _objtype TYPE string. _objtype = getobjecttype( ). rootnode = xmldoc->create_element( _objtype ). setattributesfromstructure( node = rootnode structure = dd02v_wa ). dd09l_node = xmldoc->create_element( 'dd09l' ). setattributesfromstructure( node = dd09l_node structure = dd09l_wa ). rc = rootnode->append_child( dd09l_node ). LOOP AT dd03p_tab INTO dd03p_wa. dd03p_node = xmldoc->create_element( 'dd03p' ). setattributesfromstructure( node = dd03p_node structure = dd03p_wa ). rc = rootnode->append_child( dd03p_node ). ENDLOOP. LOOP AT dd05m_tab INTO dd05m_wa. dd05m_node = xmldoc->create_element( 'dd05m' ). setattributesfromstructure( node = dd05m_node structure = dd05m_wa ). rc = rootnode->append_child( dd05m_node ). ENDLOOP. LOOP AT dd08v_tab INTO dd08v_wa. dd08v_node = xmldoc->create_element( 'dd08v' ). setattributesfromstructure( node = dd08v_node structure = dd08v_wa ). rc = rootnode->append_child( dd08v_node ). ENDLOOP. LOOP AT dd12v_tab INTO dd12v_wa. dd12v_node = xmldoc->create_element( 'dd12v' ). setattributesfromstructure( node = dd12v_node structure = dd12v_wa ). rc = rootnode->append_child( dd12v_node ). ENDLOOP. LOOP AT dd17v_tab INTO dd17v_wa. dd17v_node = xmldoc->create_element( 'dd17v' ). setattributesfromstructure( node = dd17v_node structure = dd17v_wa ). rc = rootnode->append_child( dd17v_node ). ENDLOOP. LOOP AT dd35v_tab INTO dd35v_wa. dd35v_node = xmldoc->create_element( 'dd35v' ). setattributesfromstructure( node = dd35v_node structure = dd35v_wa ). rc = rootnode->append_child( dd35v_node ). ENDLOOP. LOOP AT dd36m_tab INTO dd36m_wa. dd36m_node = xmldoc->create_element( 'dd36m' ). setattributesfromstructure( node = dd36m_node structure = dd36m_wa ). rc = rootnode->append_child( dd36m_node ). ENDLOOP. *\--------------------------------------------------------------------/ rc = xmldoc->append_child( rootnode ). ixmldocument = xmldoc. ENDMETHOD. METHOD createobjectfromixmldoc. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| The code of this project is provided to you under the current | *| version of the SAP Code Exchange Terms of Use. You can find the | *| text on the SAP Code Exchange webpage at http://www.sdn.sap.com | *| | *| SAPlink is provided to you AS IS with no guarantee, warranty or | *| support. | *\---------------------------------------------------------------------/ * Plugin created by: * Thomas Jung * [email protected] DATA: gotstate TYPE ddgotstate, dd02v_wa TYPE dd02v, dd09l_wa TYPE dd09v, dd03p_tab TYPE STANDARD TABLE OF dd03p, dd03p_wa LIKE LINE OF dd03p_tab, dd05m_tab TYPE STANDARD TABLE OF dd05m, dd05m_wa LIKE LINE OF dd05m_tab, dd08v_tab TYPE STANDARD TABLE OF dd08v, dd08v_wa LIKE LINE OF dd08v_tab, dd12v_tab TYPE STANDARD TABLE OF dd12v, dd12v_wa LIKE LINE OF dd12v_tab, dd17v_tab TYPE STANDARD TABLE OF dd17v, dd17v_wa LIKE LINE OF dd17v_tab, dd35v_tab TYPE STANDARD TABLE OF dd35v, dd35v_wa LIKE LINE OF dd35v_tab, dd36m_tab TYPE STANDARD TABLE OF dd36m, dd36m_wa LIKE LINE OF dd36m_tab. *xml nodes DATA rootnode TYPE REF TO if_ixml_element. DATA dd09l_node TYPE REF TO if_ixml_element. DATA dd03p_node TYPE REF TO if_ixml_element. DATA dd05m_node TYPE REF TO if_ixml_element. DATA dd08v_node TYPE REF TO if_ixml_element. DATA dd12v_node TYPE REF TO if_ixml_element. DATA dd17v_node TYPE REF TO if_ixml_element. DATA dd35v_node TYPE REF TO if_ixml_element. DATA dd36m_node TYPE REF TO if_ixml_element. DATA node TYPE REF TO if_ixml_element. DATA filter TYPE REF TO if_ixml_node_filter. DATA iterator TYPE REF TO if_ixml_node_iterator. DATA rc TYPE sysubrc. DATA _tablname TYPE ddobjname. DATA _devclass TYPE devclass. DATA checkexists TYPE flag. DATA _objtype TYPE string. DATA _objname TYPE string. _devclass = devclass. _objtype = getobjecttype( ). xmldoc = ixmldocument. rootnode = xmldoc->find_from_name( _objtype ). CALL METHOD getstructurefromattributes EXPORTING node = rootnode CHANGING structure = dd02v_wa. objname = dd02v_wa-tabname. checkexists = checkexists( ). IF checkexists IS NOT INITIAL. IF overwrite IS INITIAL. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>existing. ELSE. * delete object for new install deleteobject( ). ENDIF. ENDIF. dd09l_node = xmldoc->find_from_name( 'dd09l' ). CALL METHOD getstructurefromattributes EXPORTING node = dd09l_node CHANGING structure = dd09l_wa. * retrieve Tabl details FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd03p' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd03p_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd03p_wa. APPEND dd03p_wa TO dd03p_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd05m' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd05m_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd05m_wa. APPEND dd05m_wa TO dd05m_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd08v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd08v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd08v_wa. APPEND dd08v_wa TO dd08v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd12v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd12v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd12v_wa. APPEND dd12v_wa TO dd12v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd17v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd17v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd17v_wa. APPEND dd17v_wa TO dd17v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd35v' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd35v_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd35v_wa. APPEND dd35v_wa TO dd35v_tab. node ?= iterator->get_next( ). ENDWHILE. FREE: filter, iterator, node. filter = xmldoc->create_filter_name( 'dd36m' ). iterator = xmldoc->create_iterator_filtered( filter ). node ?= iterator->get_next( ). WHILE node IS NOT INITIAL. CLEAR dd36m_node. CALL METHOD getstructurefromattributes EXPORTING node = node CHANGING structure = dd36m_wa. APPEND dd36m_wa TO dd36m_tab. node ?= iterator->get_next( ). ENDWHILE. DATA : l_pgmid TYPE tadir-pgmid, l_object TYPE tadir-object, l_obj_name TYPE tadir-obj_name, l_dd_objname TYPE ddobjname, l_srcsystem TYPE tadir-srcsystem, l_author TYPE tadir-author, l_devclass TYPE tadir-devclass, l_masterlang TYPE tadir-masterlang. l_pgmid = 'R3TR'. l_object = _objtype. l_obj_name = objname. l_dd_objname = objname. l_srcsystem = sy-sysid. l_author = sy-uname. l_devclass = _devclass. l_masterlang = sy-langu. DATA: itadir TYPE tadir. itadir-pgmid = l_pgmid. itadir-object = l_object. itadir-obj_name = l_obj_name. itadir-srcsystem = l_srcsystem. itadir-author = l_author. itadir-devclass = l_devclass. itadir-masterlang = l_masterlang. MODIFY tadir FROM itadir. CALL FUNCTION 'TR_TADIR_INTERFACE' EXPORTING wi_test_modus = ' ' wi_delete_tadir_entry = 'X' wi_tadir_pgmid = l_pgmid wi_tadir_object = l_object wi_tadir_obj_name = l_obj_name wi_tadir_srcsystem = l_srcsystem wi_tadir_author = l_author wi_tadir_devclass = l_devclass wi_tadir_masterlang = l_masterlang iv_set_edtflag = '' EXCEPTIONS tadir_entry_not_existing = 1 tadir_entry_ill_type = 2 no_systemname = 3 no_systemtype = 4 original_system_conflict = 5 object_reserved_for_devclass = 6 object_exists_global = 7 object_exists_local = 8 object_is_distributed = 9 obj_specification_not_unique = 10 no_authorization_to_delete = 11 devclass_not_existing = 12 simultanious_set_remove_repair = 13 order_missing = 14 no_modification_of_head_syst = 15 pgmid_object_not_allowed = 16 masterlanguage_not_specified = 17 devclass_not_specified = 18 specify_owner_unique = 19 loc_priv_objs_no_repair = 20 gtadir_not_reached = 21 object_locked_for_order = 22 change_of_class_not_allowed = 23 no_change_from_sap_to_tmp = 24 OTHERS = 25. IF sy-subrc NE 0. CASE sy-subrc. WHEN 1 OR 9 OR 7 OR 8. "OK! - Doesn't exist yet WHEN 11 OR 23 OR 24. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_authorized. WHEN 22. _objname = l_obj_name. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>locked object = _objname. WHEN OTHERS. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDCASE. ENDIF. CALL FUNCTION 'DDIF_TABL_PUT' EXPORTING name = l_dd_objname dd02v_wa = dd02v_wa dd09l_wa = dd09l_wa TABLES dd03p_tab = dd03p_tab dd05m_tab = dd05m_tab dd08v_tab = dd08v_tab dd35v_tab = dd35v_tab dd36m_tab = dd36m_tab EXCEPTIONS tabl_not_found = 1 name_inconsistent = 2 tabl_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>system_error. ENDIF. DATA: trobjtype TYPE trobjtype, trobj_name TYPE trobj_name. trobjtype = l_object. trobj_name = l_obj_name. CALL FUNCTION 'RS_INSERT_INTO_WORKING_AREA' EXPORTING object = trobjtype obj_name = trobj_name EXCEPTIONS wrong_object_name = 1. name = objname. ENDMETHOD. method DELETEOBJECT. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| The code of this project is provided to you under the current | *| version of the SAP Code Exchange Terms of Use. You can find the | *| text on the SAP Code Exchange webpage at http://www.sdn.sap.com | *| | *| SAPlink is provided to you AS IS with no guarantee, warranty or | *| support. | *\---------------------------------------------------------------------/ * Plugin created by: * Thomas Jung * [email protected] endmethod. method GETOBJECTTYPE. */---------------------------------------------------------------------\ *| This file is part of SAPlink. | *| | *| The code of this project is provided to you under the current | *| version of the SAP Code Exchange Terms of Use. You can find the | *| text on the SAP Code Exchange webpage at http://www.sdn.sap.com | *| | *| SAPlink is provided to you AS IS with no guarantee, warranty or | *| support. | *\---------------------------------------------------------------------/ * Plugin created by: * Thomas Jung * [email protected] objecttype = 'TABL'. "Tables and Structures endmethod. ENDCLASS.
33.334545
73
0.583833
da1e41554e49c800389032540243ead9722ae953
27,214
abap
ABAP
src/ui/zcl_abapgit_gui_router.clas.abap
mkaesemann/abapG
467d8d367ceab1fc8acfdb4e96490e59fe3387b8
[ "MIT" ]
1
2020-11-12T17:34:15.000Z
2020-11-12T17:34:15.000Z
src/ui/zcl_abapgit_gui_router.clas.abap
Anjague/abapGit
95e427b9700ca0a9de0704fd84ccc6e5d3a8d1f8
[ "MIT" ]
1
2017-10-27T09:32:58.000Z
2017-10-27T09:32:58.000Z
src/ui/zcl_abapgit_gui_router.clas.abap
Anjague/abapGit
95e427b9700ca0a9de0704fd84ccc6e5d3a8d1f8
[ "MIT" ]
1
2021-07-09T02:07:11.000Z
2021-07-09T02:07:11.000Z
CLASS zcl_abapgit_gui_router DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_abapgit_gui_event_handler. PROTECTED SECTION. PRIVATE SECTION. METHODS general_page_routing IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS abapgit_services_actions IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS db_actions IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. CLASS-METHODS file_download IMPORTING !iv_package TYPE devclass !iv_xstr TYPE xstring RAISING zcx_abapgit_exception . METHODS git_services IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS remote_origin_manipulations IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS sap_gui_actions IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS other_utilities IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS zip_services IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS repository_services IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(rs_handled) TYPE zif_abapgit_gui_event_handler=>ty_handling_result RAISING zcx_abapgit_exception. METHODS get_page_diff IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception . METHODS get_page_branch_overview IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception . METHODS get_page_stage IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception . METHODS get_page_background IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception . CLASS-METHODS jump_display_transport IMPORTING !iv_transport TYPE trkorr RAISING zcx_abapgit_exception . CLASS-METHODS jump_display_user IMPORTING !iv_username TYPE xubname RAISING zcx_abapgit_exception . METHODS call_browser IMPORTING !iv_url TYPE csequence RAISING zcx_abapgit_exception. ENDCLASS. CLASS zcl_abapgit_gui_router IMPLEMENTATION. METHOD abapgit_services_actions. DATA: li_main_page TYPE REF TO zcl_abapgit_gui_page_main. CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-abapgit_home. CREATE OBJECT li_main_page. rs_handled-page = li_main_page. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-abapgit_install. " Install abapGit zcl_abapgit_services_abapgit=>install_abapgit( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDCASE. ENDMETHOD. METHOD call_browser. cl_gui_frontend_services=>execute( EXPORTING document = |{ iv_url }| EXCEPTIONS cntl_error = 1 error_no_gui = 2 bad_parameter = 3 file_not_found = 4 path_not_found = 5 file_extension_unknown = 6 error_execute_failed = 7 synchronous_failed = 8 not_supported_by_gui = 9 OTHERS = 10 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise_t100( ). ENDIF. ENDMETHOD. METHOD db_actions. DATA ls_db_key TYPE zif_abapgit_persistence=>ty_content. DATA lo_query TYPE REF TO zcl_abapgit_string_map. lo_query = ii_event->query( ). CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-db_edit. lo_query->to_abap( CHANGING cs_container = ls_db_key ). CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_db_edit EXPORTING is_key = ls_db_key. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. IF ii_event->mi_gui_services->get_current_page_name( ) = 'ZCL_ABAPGIT_GUI_PAGE_DB_DIS'. " TODO refactor rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing. ENDIF. WHEN zif_abapgit_definitions=>c_action-db_display. lo_query->to_abap( CHANGING cs_container = ls_db_key ). CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_db_dis EXPORTING is_key = ls_db_key. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. ENDCASE. ENDMETHOD. METHOD file_download. DATA: lv_path TYPE string, lv_default TYPE string, li_fe_serv TYPE REF TO zif_abapgit_frontend_services, lv_package TYPE devclass. lv_package = iv_package. TRANSLATE lv_package USING '/#'. CONCATENATE lv_package '_' sy-datlo '_' sy-timlo INTO lv_default. li_fe_serv = zcl_abapgit_ui_factory=>get_frontend_services( ). lv_path = li_fe_serv->show_file_save_dialog( iv_title = 'Export ZIP' iv_extension = 'zip' iv_default_filename = lv_default ). li_fe_serv->file_download( iv_path = lv_path iv_xstr = iv_xstr ). ENDMETHOD. METHOD general_page_routing. DATA: lv_key TYPE zif_abapgit_persistence=>ty_repo-key, lv_last_repo_key TYPE zif_abapgit_persistence=>ty_repo-key, lt_repo_list TYPE zif_abapgit_definitions=>ty_repo_ref_tt. lv_key = ii_event->query( )->get( 'KEY' ). CASE ii_event->mv_action. WHEN zcl_abapgit_gui=>c_action-go_home. lv_last_repo_key = zcl_abapgit_persistence_user=>get_instance( )->get_repo_show( ). lt_repo_list = zcl_abapgit_repo_srv=>get_instance( )->list( ). IF lv_last_repo_key IS NOT INITIAL. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_repo_view EXPORTING iv_key = lv_last_repo_key. ELSEIF lt_repo_list IS NOT INITIAL. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_main. ELSE. rs_handled-page = zcl_abapgit_gui_page_tutorial=>create( ). ENDIF. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-go_db. " Go DB util page CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_db. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-go_debuginfo. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_debuginfo. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-go_settings. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_settings. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-go_background_run. " Go background run page CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_bkg_run. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-go_background. " Go Background page rs_handled-page = get_page_background( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-go_diff. " Go Diff page rs_handled-page = get_page_diff( ii_event ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_w_bookmark. WHEN zif_abapgit_definitions=>c_action-go_stage. " Go Staging page rs_handled-page = get_page_stage( ii_event ). IF ii_event->mi_gui_services->get_current_page_name( ) = 'ZCL_ABAPGIT_GUI_PAGE_DIFF'. " TODO refactor rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. ELSE. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_w_bookmark. ENDIF. WHEN zif_abapgit_definitions=>c_action-go_branch_overview. " Go repo branch overview rs_handled-page = get_page_branch_overview( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-go_tutorial. " Go to tutorial rs_handled-page = zcl_abapgit_gui_page_tutorial=>create( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-documentation. " abapGit docs zcl_abapgit_services_abapgit=>open_abapgit_wikipage( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-go_explore. " dotabap zcl_abapgit_services_abapgit=>open_dotabap_homepage( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-changelog. " abapGit full changelog zcl_abapgit_services_abapgit=>open_abapgit_changelog( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. METHOD get_page_background. CREATE OBJECT ri_page TYPE zcl_abapgit_gui_page_bkg EXPORTING iv_key = iv_key. ENDMETHOD. METHOD get_page_branch_overview. DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online, lo_page TYPE REF TO zcl_abapgit_gui_page_boverview. lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). CREATE OBJECT lo_page EXPORTING io_repo = lo_repo. ri_page = lo_page. ENDMETHOD. METHOD get_page_diff. DATA: ls_file TYPE zif_abapgit_definitions=>ty_file, ls_object TYPE zif_abapgit_definitions=>ty_item, lo_page TYPE REF TO zcl_abapgit_gui_page_diff, lv_key TYPE zif_abapgit_persistence=>ty_repo-key. lv_key = ii_event->query( )->get( 'KEY' ). ls_file-path = ii_event->query( )->get( 'PATH' ). ls_file-filename = ii_event->query( )->get( 'FILENAME' ). " unescape ? ls_object-obj_type = ii_event->query( )->get( 'OBJ_TYPE' ). ls_object-obj_name = ii_event->query( )->get( 'OBJ_NAME' ). " unescape ? CREATE OBJECT lo_page EXPORTING iv_key = lv_key is_file = ls_file is_object = ls_object. ri_page = lo_page. ENDMETHOD. METHOD get_page_stage. DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online, lv_key TYPE zif_abapgit_persistence=>ty_repo-key, lv_seed TYPE string, lo_stage_page TYPE REF TO zcl_abapgit_gui_page_stage, lo_code_inspector_page TYPE REF TO zcl_abapgit_gui_page_code_insp. lv_key = ii_event->query( )->get( 'KEY' ). lv_seed = ii_event->query( )->get( 'SEED' ). lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). IF lo_repo->get_local_settings( )-code_inspector_check_variant IS NOT INITIAL. CREATE OBJECT lo_code_inspector_page EXPORTING io_repo = lo_repo. ri_page = lo_code_inspector_page. ELSE. " force refresh on stage, to make sure the latest local and remote files are used lo_repo->refresh( ). CREATE OBJECT lo_stage_page EXPORTING io_repo = lo_repo iv_seed = lv_seed. ri_page = lo_stage_page. ENDIF. ENDMETHOD. METHOD git_services. DATA lv_key TYPE zif_abapgit_persistence=>ty_repo-key. lv_key = ii_event->query( )->get( 'KEY' ). CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-git_pull. " GIT Pull zcl_abapgit_services_git=>pull( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-git_reset. " GIT Reset zcl_abapgit_services_git=>reset( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-git_checkout_commit. " GIT Checkout commit zcl_abapgit_services_git=>checkout_commit( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-git_branch_create. " GIT Create new branch zcl_abapgit_services_git=>create_branch( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-git_branch_delete. " GIT Delete remote branch zcl_abapgit_services_git=>delete_branch( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-git_branch_switch. " GIT Switch branch zcl_abapgit_services_git=>switch_branch( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-go_tag_overview. " GIT Tag overview zcl_abapgit_services_git=>tag_overview( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-git_tag_create. " GIT Tag create CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_tag EXPORTING io_repo = zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-git_tag_delete. " GIT Tag create zcl_abapgit_services_git=>delete_tag( lv_key ). zcl_abapgit_services_repo=>refresh( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-git_tag_switch. " GIT Switch Tag zcl_abapgit_services_git=>switch_tag( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDCASE. ENDMETHOD. METHOD jump_display_transport. DATA: lv_transport_adt_uri TYPE string, lv_adt_link TYPE string, lv_adt_jump_enabled TYPE abap_bool. lv_adt_jump_enabled = zcl_abapgit_persist_settings=>get_instance( )->read( )->get_adt_jump_enabled( ). IF lv_adt_jump_enabled = abap_true. TRY. CALL METHOD ('CL_CTS_ADT_TM_URI_BUILDER')=>('CREATE_ADT_URI') EXPORTING trnumber = iv_transport RECEIVING result = lv_transport_adt_uri. lv_adt_link = |adt://{ sy-sysid }{ lv_transport_adt_uri }|. cl_gui_frontend_services=>execute( EXPORTING document = lv_adt_link EXCEPTIONS OTHERS = 1 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( 'ADT Jump Error' ). ENDIF. CATCH cx_root. CALL FUNCTION 'TR_DISPLAY_REQUEST' EXPORTING i_trkorr = iv_transport. ENDTRY. ELSE. CALL FUNCTION 'TR_DISPLAY_REQUEST' EXPORTING i_trkorr = iv_transport. ENDIF. ENDMETHOD. METHOD jump_display_user. " todo, user display in ADT CALL FUNCTION 'BAPI_USER_DISPLAY' EXPORTING username = iv_username. ENDMETHOD. METHOD other_utilities. CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-changed_by. zcl_abapgit_services_basis=>test_changed_by( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-performance_test. zcl_abapgit_services_basis=>run_performance_test( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-ie_devtools. zcl_abapgit_services_basis=>open_ie_devtools( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. METHOD remote_origin_manipulations. DATA lv_key TYPE zif_abapgit_persistence=>ty_repo-key. lv_key = ii_event->query( )->get( 'KEY' ). CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-repo_remote_attach. " Remote attach zcl_abapgit_services_repo=>remote_attach( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_remote_detach. " Remote detach zcl_abapgit_services_repo=>remote_detach( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_remote_change. " Remote change zcl_abapgit_services_repo=>remote_change( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDCASE. ENDMETHOD. METHOD repository_services. DATA: lv_key TYPE zif_abapgit_persistence=>ty_repo-key, li_log TYPE REF TO zif_abapgit_log. lv_key = ii_event->query( )->get( 'KEY' ). CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-repo_newoffline. " New offline repo rs_handled-page = zcl_abapgit_gui_page_addofflin=>create( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-repo_add_all_obj_to_trans_req. zcl_abapgit_transport=>add_all_objects_to_trans_req( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_refresh. " Repo refresh zcl_abapgit_services_repo=>refresh( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_syntax_check. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_syntax EXPORTING io_repo = zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-repo_code_inspector. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_code_insp EXPORTING io_repo = zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-repo_purge. " Repo remove & purge all objects zcl_abapgit_services_repo=>purge( lv_key ). CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_main. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing. WHEN zif_abapgit_definitions=>c_action-repo_remove. " Repo remove zcl_abapgit_services_repo=>remove( lv_key ). CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_main. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing. WHEN zif_abapgit_definitions=>c_action-repo_newonline. rs_handled-page = zcl_abapgit_gui_page_addonline=>create( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-repo_refresh_checksums. " Rebuild local checksums zcl_abapgit_services_repo=>refresh_local_checksums( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_toggle_fav. " Toggle repo as favorite zcl_abapgit_services_repo=>toggle_favorite( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_transport_to_branch. zcl_abapgit_services_repo=>transport_to_branch( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_settings. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_repo_sett EXPORTING io_repo = zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN zif_abapgit_definitions=>c_action-repo_log. li_log = zcl_abapgit_repo_srv=>get_instance( )->get( lv_key )->get_log( ). zcl_abapgit_log_viewer=>show_log( ii_log = li_log iv_header_text = li_log->get_title( ) ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. METHOD sap_gui_actions. DATA: ls_item TYPE zif_abapgit_definitions=>ty_item. CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-jump. " Open object editor ls_item-obj_type = ii_event->query( )->get( 'TYPE' ). ls_item-obj_name = ii_event->query( )->get( 'NAME' ). zcl_abapgit_objects=>jump( ls_item ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-jump_transport. jump_display_transport( |{ ii_event->query( )->get( 'TRANSPORT' ) }| ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-jump_user. jump_display_user( |{ ii_event->query( )->get( 'USER' ) }| ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-url. call_browser( ii_event->query( )->get( 'URL' ) ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. rs_handled = general_page_routing( ii_event ). IF rs_handled-state IS INITIAL. rs_handled = repository_services( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled = git_services( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled = zip_services( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled = db_actions( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled = abapgit_services_actions( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled = remote_origin_manipulations( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled = sap_gui_actions( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled = other_utilities( ii_event ). ENDIF. IF rs_handled-state IS INITIAL. rs_handled-state = zcl_abapgit_gui=>c_event_state-not_handled. ENDIF. ENDMETHOD. METHOD zip_services. DATA: lv_key TYPE zif_abapgit_persistence=>ty_repo-key, lo_repo TYPE REF TO zcl_abapgit_repo, lv_package TYPE devclass, lv_path TYPE string, lv_xstr TYPE xstring. " TODO refactor CONSTANTS: BEGIN OF lc_page, main_view TYPE string VALUE 'ZCL_ABAPGIT_GUI_PAGE_MAIN', repo_view TYPE string VALUE 'ZCL_ABAPGIT_GUI_PAGE_REPO_VIEW', END OF lc_page. lv_key = ii_event->query( )->get( 'KEY' ). CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-zip_import. " Import repo from ZIP lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). lv_path = zcl_abapgit_ui_factory=>get_frontend_services( )->show_file_open_dialog( iv_title = 'Import ZIP' iv_extension = 'zip' iv_default_filename = '*.zip' ). lv_xstr = zcl_abapgit_ui_factory=>get_frontend_services( )->file_upload( lv_path ). lo_repo->set_files_remote( zcl_abapgit_zip=>load( lv_xstr ) ). zcl_abapgit_services_repo=>refresh( lv_key ). " TODO refactor how current page name is determined CASE ii_event->mi_gui_services->get_current_page_name( ). WHEN lc_page-repo_view. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN lc_page-main_view. CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_repo_view EXPORTING iv_key = lo_repo->get_key( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN OTHERS. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. WHEN zif_abapgit_definitions=>c_action-zip_export. " Export repo as ZIP lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). lv_xstr = zcl_abapgit_zip=>export( lo_repo ). file_download( iv_package = lo_repo->get_package( ) iv_xstr = lv_xstr ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-zip_package. " Export package as ZIP zcl_abapgit_zip=>export_package( IMPORTING ev_xstr = lv_xstr ev_package = lv_package ). file_download( iv_package = lv_package iv_xstr = lv_xstr ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-zip_transport. " Export transports as ZIP zcl_abapgit_transport_mass=>run( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-zip_object. " Export object as ZIP zcl_abapgit_zip=>export_object( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. ENDCLASS.
38.601418
111
0.68248
da1e9a9418b5cf0b9e30c5e64abe20257683a334
2,145
abap
ABAP
src/zdbgl_getter.clas.locals_imp.abap
germanysources/regression_test
41bca2f67036fbf89b56a0cc83ec5fcb41d95edc
[ "MIT" ]
6
2019-12-09T16:47:39.000Z
2022-02-23T15:16:05.000Z
src/zdbgl_getter.clas.locals_imp.abap
germanysources/regression_test
41bca2f67036fbf89b56a0cc83ec5fcb41d95edc
[ "MIT" ]
2
2020-01-14T17:50:27.000Z
2020-11-10T12:21:24.000Z
src/zdbgl_getter.clas.locals_imp.abap
germanysources/regression_test
41bca2f67036fbf89b56a0cc83ec5fcb41d95edc
[ "MIT" ]
2
2021-01-05T11:38:44.000Z
2021-12-10T10:33:30.000Z
DEFINE attribute_handler. IF node_open_element->if_sxml_named~qname-name = 'array' AND node_for_table_pending = abap_true. RAISE EXCEPTION TYPE zcx_dbgl_testcase EXPORTING textid = zcx_dbgl_testcase=>table_line_type_not_supported program = program linetype = cl_abap_typedescr=>typekind_struct2. ENDIF. LOOP AT node_open_element->get_attributes( ) INTO attribute. IF attribute->qname-name = 'name' AND attribute->get_value( ) = name AND node_open_element->if_sxml_named~qname-name = 'array' AND object_level = 1. node_for_table_pending = abap_true. ELSEIF attribute->qname-name = 'name'. object_element_name = attribute->get_value( ). ENDIF. ENDLOOP. IF node_open_element->if_sxml_named~qname-name = 'object'. ADD 1 TO object_level. ENDIF. END-OF-DEFINITION. DEFINE prepare_table_line. IF node_for_table_pending = abap_true. IF node_open_element->if_sxml_named~qname-name = 'object' AND line_has_simple_type( <line> ) = abap_false. " new line starts CLEAR: <line>. ENDIF. IF node_open_element->if_sxml_named~qname-name = 'str' AND line_has_simple_type( <line> ) = abap_false. " structured component ASSIGN COMPONENT object_element_name OF STRUCTURE <line> TO <line_element>. ELSEIF node_open_element->if_sxml_named~qname-name = 'str'. ASSIGN line->* TO <line_element>. ENDIF. ENDIF. END-OF-DEFINITION. DEFINE close_element_handler. CASE CAST if_sxml_close_element( node )->if_sxml_named~qname-name. WHEN 'array'. IF node_for_table_pending = abap_true. " parsing finished RETURN. ENDIF. WHEN 'object'. IF node_for_table_pending = abap_true. " line parsing finished for structured type INSERT <line> INTO TABLE value. ENDIF. object_level = object_level - 1. WHEN 'str'. IF line_has_simple_type( <line> ) = abap_true AND node_for_table_pending = abap_true. " line parsing finished for simple type INSERT <line> INTO TABLE value. ENDIF. ENDCASE. END-OF-DEFINITION.
28.986486
81
0.691841
da1f4c388608938dacd5c73137b0284353599aa0
17,353
abap
ABAP
src/ui/zcl_abapgit_gui_page_merge_res.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
2
2021-01-08T21:38:32.000Z
2021-11-17T19:37:14.000Z
src/ui/zcl_abapgit_gui_page_merge_res.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
src/ui/zcl_abapgit_gui_page_merge_res.clas.abap
abapGit/upport
322935c225756b5107d7c835e6ccc13ba3dcbe4a
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_gui_page_merge_res DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_page FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS constructor IMPORTING io_repo TYPE REF TO zcl_abapgit_repo_online io_merge_page TYPE REF TO zcl_abapgit_gui_page_merge io_merge TYPE REF TO zif_abapgit_merge RAISING zcx_abapgit_exception. METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION . PROTECTED SECTION. METHODS render_content REDEFINITION. PRIVATE SECTION. TYPES: BEGIN OF ty_file_diff, path TYPE string, filename TYPE string, lstate TYPE char1, rstate TYPE char1, fstate TYPE char1, " FILE state - Abstraction for shorter ifs o_diff TYPE REF TO zcl_abapgit_diff, changed_by TYPE xubname, type TYPE string, END OF ty_file_diff . CONSTANTS: BEGIN OF c_actions, toggle_mode TYPE string VALUE 'toggle_mode' ##NO_TEXT, apply_merge TYPE string VALUE 'apply_merge' ##NO_TEXT, apply_source TYPE string VALUE 'apply_source' ##NO_TEXT, apply_target TYPE string VALUE 'apply_target' ##NO_TEXT, cancel TYPE string VALUE 'cancel' ##NO_TEXT, END OF c_actions . CONSTANTS: BEGIN OF c_merge_mode, selection TYPE string VALUE 'selection' ##NO_TEXT, merge TYPE string VALUE 'merge' ##NO_TEXT, END OF c_merge_mode . DATA mo_merge TYPE REF TO zif_abapgit_merge . DATA mo_merge_page TYPE REF TO zcl_abapgit_gui_page_merge . DATA mo_repo TYPE REF TO zcl_abapgit_repo_online . DATA ms_diff_file TYPE ty_file_diff . DATA mv_current_conflict_index TYPE sy-tabix . DATA mv_merge_mode TYPE string . DATA mt_conflicts TYPE zif_abapgit_merge=>ty_merge_conflict_tt . METHODS apply_merged_content IMPORTING !ii_event TYPE REF TO zif_abapgit_gui_event RAISING zcx_abapgit_exception . METHODS build_menu RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . METHODS is_binary IMPORTING !iv_d1 TYPE xstring !iv_d2 TYPE xstring RETURNING VALUE(rv_yes) TYPE abap_bool . METHODS render_beacon IMPORTING !is_diff_line TYPE zif_abapgit_definitions=>ty_diff !is_diff TYPE ty_file_diff RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_diff IMPORTING !is_diff TYPE ty_file_diff RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_diff_head IMPORTING !is_diff TYPE ty_file_diff RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_lines IMPORTING !is_diff TYPE ty_file_diff RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_line_split IMPORTING !is_diff_line TYPE zif_abapgit_definitions=>ty_diff RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_table_head RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS resolve_diff RAISING zcx_abapgit_exception . METHODS toggle_merge_mode . ENDCLASS. CLASS zcl_abapgit_gui_page_merge_res IMPLEMENTATION. METHOD apply_merged_content. DATA: lv_merge_content TYPE string, lv_new_file_content TYPE xstring. FIELD-SYMBOLS: <ls_conflict> TYPE zif_abapgit_merge=>ty_merge_conflict. lv_merge_content = ii_event->form_data( )->get( 'MERGE_CONTENT' ). REPLACE ALL OCCURRENCES OF zif_abapgit_definitions=>c_crlf IN lv_merge_content WITH zif_abapgit_definitions=>c_newline. lv_new_file_content = zcl_abapgit_convert=>string_to_xstring_utf8( lv_merge_content ). READ TABLE mt_conflicts ASSIGNING <ls_conflict> INDEX mv_current_conflict_index. <ls_conflict>-result_sha1 = zcl_abapgit_hash=>sha1_blob( lv_new_file_content ). <ls_conflict>-result_data = lv_new_file_content. mo_merge->resolve_conflict( <ls_conflict> ). ENDMETHOD. METHOD build_menu. ro_menu = NEW #( ). ro_menu->add( iv_txt = 'Toggle merge mode' iv_act = c_actions-toggle_mode ). ro_menu->add( iv_txt = 'Cancel' iv_act = c_actions-cancel ). ENDMETHOD. METHOD constructor. super->constructor( ). mo_repo = io_repo. ms_control-page_title = 'Resolve Conflicts'. ms_control-page_menu = build_menu( ). mo_merge_page = io_merge_page. mo_merge = io_merge. mv_merge_mode = c_merge_mode-selection. mv_current_conflict_index = 1. mt_conflicts = io_merge->get_conflicts( ). ENDMETHOD. METHOD is_binary. FIELD-SYMBOLS <lv_data> LIKE iv_d1. IF iv_d1 IS NOT INITIAL. " One of them might be new and so empty ASSIGN iv_d1 TO <lv_data>. ELSE. ASSIGN iv_d2 TO <lv_data>. ENDIF. rv_yes = zcl_abapgit_utils=>is_binary( <lv_data> ). ENDMETHOD. METHOD render_beacon. DATA: lv_beacon TYPE string, lt_beacons TYPE zif_abapgit_definitions=>ty_string_tt. ri_html = NEW zcl_abapgit_html( ). IF is_diff_line-beacon > 0. lt_beacons = is_diff-o_diff->get_beacons( ). READ TABLE lt_beacons INTO lv_beacon INDEX is_diff_line-beacon. ELSE. lv_beacon = '---'. ENDIF. ri_html->add( '<thead class="nav_line">' ). ri_html->add( '<tr>' ). ri_html->add( '<th class="num"></th>' ). ri_html->add( |<th colspan="3">@@ { is_diff_line-new_num } @@ { lv_beacon }</th>| ). ri_html->add( '</tr>' ). ri_html->add( '</thead>' ). ENDMETHOD. METHOD render_content. resolve_diff( ). IF ms_diff_file IS INITIAL. zcx_abapgit_exception=>raise( 'no conflict found' ). ENDIF. ri_html = NEW zcl_abapgit_html( ). ri_html->add( |<div id="diff-list" data-repo-key="{ mo_repo->get_key( ) }">| ). ri_html->add( render_diff( ms_diff_file ) ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_diff. DATA: lv_target_content TYPE string. FIELD-SYMBOLS: <ls_conflict> TYPE zif_abapgit_merge=>ty_merge_conflict. ri_html = NEW zcl_abapgit_html( ). ri_html->add( |<div class="diff" data-type="{ is_diff-type }" data-changed-by="{ is_diff-changed_by }" data-file="{ is_diff-path && is_diff-filename }">| ). ri_html->add( render_diff_head( is_diff ) ). " Content IF is_diff-type <> 'binary'. IF mv_merge_mode = c_merge_mode-selection. ri_html->add( '<div class="diff_content">' ). ri_html->add( '<table class="diff_tab syntax-hl">' ). ri_html->add( render_table_head( ) ). ri_html->add( render_lines( is_diff ) ). ri_html->add( '</table>' ). ri_html->add( '</div>' ). ELSE. "Table for Div-Table and textarea ri_html->add( '<div class="diff_content">' ). ri_html->add( '<table class="w100">' ). ri_html->add( '<thead class="header">' ). ri_html->add( '<tr>' ). ri_html->add( '<th>Code</th>' ). ri_html->add( '<th>Merge - ' ). ri_html->add_a( iv_act = 'submitFormById(''merge_form'');' iv_txt = 'Apply' iv_typ = zif_abapgit_html=>c_action_type-onclick iv_opt = zif_abapgit_html=>c_html_opt-strong ). ri_html->add( '</th> ' ). ri_html->add( '</tr>' ). ri_html->add( '</thead>' ). ri_html->add( '<td>' ). "Diff-Table of source and target file ri_html->add( '<table class="diff_tab syntax-hl">' ). ri_html->add( render_table_head( ) ). ri_html->add( render_lines( is_diff ) ). ri_html->add( '</table>' ). READ TABLE mt_conflicts ASSIGNING <ls_conflict> INDEX mv_current_conflict_index. IF sy-subrc = 0. lv_target_content = zcl_abapgit_convert=>xstring_to_string_utf8( <ls_conflict>-target_data ). lv_target_content = escape( val = lv_target_content format = cl_abap_format=>e_html_text ). ENDIF. ri_html->add( '</td>' ). ri_html->add( '<td>' ). ri_html->add( '<div class="form-container">' ). ri_html->add( |<form id="merge_form" class="aligned-form w100" accept-charset="UTF-8"| ). ri_html->add( |method="post" action="sapevent:apply_merge">| ). ri_html->add( |<textarea id="merge_content" name="merge_content" class="w100" | ). ri_html->add( |rows="{ lines( is_diff-o_diff->get( ) ) }">{ lv_target_content }</textarea>| ). ri_html->add( '<input type="submit" class="hidden-submit">' ). ri_html->add( '</form>' ). ri_html->add( '</div>' ). ri_html->add( '</td>' ). ri_html->add( '</table>' ). ri_html->add( '</div>' ). ENDIF. ELSE. ri_html->add( '<div class="diff_content paddings center grey">' ). ri_html->add( 'The content seems to be binary.' ). ri_html->add( 'Cannot display as diff.' ). ri_html->add( '</div>' ). ENDIF. ri_html->add( '</div>' ). ENDMETHOD. METHOD render_diff_head. DATA: ls_stats TYPE zif_abapgit_definitions=>ty_count. ri_html = NEW zcl_abapgit_html( ). ri_html->add( '<div class="diff_head">' ). IF is_diff-type <> 'binary' AND is_diff-o_diff IS NOT INITIAL. ls_stats = is_diff-o_diff->stats( ). ri_html->add( |<span class="diff_banner diff_ins">+ { ls_stats-insert }</span>| ). ri_html->add( |<span class="diff_banner diff_del">- { ls_stats-delete }</span>| ). ri_html->add( |<span class="diff_banner diff_upd">~ { ls_stats-update }</span>| ). ENDIF. ri_html->add( |<span class="diff_name">{ is_diff-filename }</span>| ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_lines. DATA: lo_highlighter TYPE REF TO zcl_abapgit_syntax_highlighter, lt_diffs TYPE zif_abapgit_definitions=>ty_diffs_tt, lv_insert_nav TYPE abap_bool. FIELD-SYMBOLS <ls_diff> LIKE LINE OF lt_diffs. lo_highlighter = zcl_abapgit_syntax_factory=>create( is_diff-filename ). ri_html = NEW zcl_abapgit_html( ). lt_diffs = is_diff-o_diff->get( ). LOOP AT lt_diffs ASSIGNING <ls_diff>. IF <ls_diff>-short = abap_false. lv_insert_nav = abap_true. CONTINUE. ENDIF. IF lv_insert_nav = abap_true. " Insert separator line with navigation ri_html->add( render_beacon( is_diff_line = <ls_diff> is_diff = is_diff ) ). lv_insert_nav = abap_false. ENDIF. IF lo_highlighter IS BOUND. <ls_diff>-new = lo_highlighter->process_line( <ls_diff>-new ). <ls_diff>-old = lo_highlighter->process_line( <ls_diff>-old ). ELSE. <ls_diff>-new = escape( val = <ls_diff>-new format = cl_abap_format=>e_html_attr ). <ls_diff>-old = escape( val = <ls_diff>-old format = cl_abap_format=>e_html_attr ). ENDIF. CONDENSE <ls_diff>-new_num. "get rid of leading spaces CONDENSE <ls_diff>-old_num. ri_html->add( render_line_split( <ls_diff> ) ). ENDLOOP. ENDMETHOD. METHOD render_line_split. DATA: lv_new TYPE string, lv_old TYPE string, lv_mark TYPE string, lv_bg TYPE string. ri_html = NEW zcl_abapgit_html( ). " New line lv_mark = ` `. IF is_diff_line-result = zif_abapgit_definitions=>c_diff-update. lv_bg = ' diff_upd'. lv_mark = `~`. ELSEIF is_diff_line-result = zif_abapgit_definitions=>c_diff-insert. lv_bg = ' diff_ins'. lv_mark = `+`. ENDIF. lv_new = |<td class="num" line-num="{ is_diff_line-new_num }"></td>| && |<td class="code{ lv_bg }">{ lv_mark }{ is_diff_line-new }</td>|. " Old line CLEAR lv_bg. lv_mark = ` `. IF is_diff_line-result = zif_abapgit_definitions=>c_diff-update. lv_bg = ' diff_upd'. lv_mark = `~`. ELSEIF is_diff_line-result = zif_abapgit_definitions=>c_diff-delete. lv_bg = ' diff_del'. lv_mark = `-`. ENDIF. lv_old = |<td class="num" line-num="{ is_diff_line-old_num }"></td>| && |<td class="code{ lv_bg }">{ lv_mark }{ is_diff_line-old }</td>|. " render line, inverse sides if remote is newer ri_html->add( '<tr>' ). ri_html->add( lv_old ). " Target ri_html->add( lv_new ). " Source ri_html->add( '</tr>' ). ENDMETHOD. METHOD render_table_head. ri_html = NEW zcl_abapgit_html( ). ri_html->add( '<thead class="header">' ). ri_html->add( '<tr>' ). ri_html->add( '<th class="num"></th>' ). IF mv_merge_mode = c_merge_mode-selection. ri_html->add( '<form id="target_form" method="post" action="sapevent:apply_target">' ). ri_html->add( '<th>Target - ' && mo_repo->get_selected_branch( ) && ' - ' ). ri_html->add_a( iv_act = 'submitFormById(''target_form'');' iv_txt = 'Apply' iv_typ = zif_abapgit_html=>c_action_type-onclick iv_opt = zif_abapgit_html=>c_html_opt-strong ). ri_html->add( '</th> ' ). ri_html->add( '</form>' ). ri_html->add( '<th class="num"></th>' ). ri_html->add( '<form id="source_form" method="post" action="sapevent:apply_source">' ). ri_html->add( '<th>Source - ' && mo_merge->get_source_branch( ) && ' - ' ). ri_html->add_a( iv_act = 'submitFormById(''source_form'');' iv_txt = 'Apply' iv_typ = zif_abapgit_html=>c_action_type-onclick iv_opt = zif_abapgit_html=>c_html_opt-strong ). ri_html->add( '</th> ' ). ri_html->add( '</form>' ). ELSE. ri_html->add( '<th>Target - ' && mo_repo->get_selected_branch( ) && '</th> ' ). ri_html->add( '<th class="num"></th>' ). ri_html->add( '<th>Source - ' && mo_merge->get_source_branch( ) && '</th> ' ). ENDIF. ri_html->add( '</tr>' ). ri_html->add( '</thead>' ). ENDMETHOD. METHOD resolve_diff. DATA: lv_offs TYPE i. FIELD-SYMBOLS: <ls_conflict> TYPE zif_abapgit_merge=>ty_merge_conflict. CLEAR ms_diff_file. READ TABLE mt_conflicts ASSIGNING <ls_conflict> INDEX mv_current_conflict_index. IF sy-subrc <> 0. RETURN. ENDIF. ms_diff_file-path = <ls_conflict>-path. ms_diff_file-filename = <ls_conflict>-filename. ms_diff_file-type = reverse( <ls_conflict>-filename ). FIND FIRST OCCURRENCE OF '.' IN ms_diff_file-type MATCH OFFSET lv_offs. ms_diff_file-type = reverse( substring( val = ms_diff_file-type len = lv_offs ) ). IF ms_diff_file-type <> 'xml' AND ms_diff_file-type <> 'abap'. ms_diff_file-type = 'other'. ENDIF. IF ms_diff_file-type = 'other' AND is_binary( iv_d1 = <ls_conflict>-source_data iv_d2 = <ls_conflict>-target_data ) = abap_true. ms_diff_file-type = 'binary'. ENDIF. IF ms_diff_file-type <> 'binary'. ms_diff_file-o_diff = NEW #( iv_new = <ls_conflict>-source_data iv_old = <ls_conflict>-target_data ). ENDIF. ENDMETHOD. METHOD toggle_merge_mode. IF mv_merge_mode = c_merge_mode-selection. mv_merge_mode = c_merge_mode-merge. ELSE. mv_merge_mode = c_merge_mode-selection. ENDIF. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. FIELD-SYMBOLS: <ls_conflict> TYPE zif_abapgit_merge=>ty_merge_conflict. CASE ii_event->mv_action. WHEN c_actions-apply_merge OR c_actions-apply_source OR c_actions-apply_target OR c_actions-cancel. CASE ii_event->mv_action. WHEN c_actions-apply_merge. apply_merged_content( ii_event ). WHEN c_actions-apply_source. READ TABLE mt_conflicts ASSIGNING <ls_conflict> INDEX mv_current_conflict_index. <ls_conflict>-result_sha1 = <ls_conflict>-source_sha1. <ls_conflict>-result_data = <ls_conflict>-source_data. mo_merge->resolve_conflict( <ls_conflict> ). WHEN c_actions-apply_target. READ TABLE mt_conflicts ASSIGNING <ls_conflict> INDEX mv_current_conflict_index. <ls_conflict>-result_sha1 = <ls_conflict>-target_sha1. <ls_conflict>-result_data = <ls_conflict>-target_data. mo_merge->resolve_conflict( <ls_conflict> ). ENDCASE. mv_current_conflict_index = mv_current_conflict_index + 1. IF mv_current_conflict_index > lines( mt_conflicts ). CLEAR mv_current_conflict_index. ENDIF. IF mv_current_conflict_index IS NOT INITIAL. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ELSE. rs_handled-page = mo_merge_page. rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back. ENDIF. WHEN c_actions-toggle_mode. toggle_merge_mode( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDCASE. ENDMETHOD. ENDCLASS.
31.840367
103
0.626347
da1f6a52b53d1729740cff62b20929ebf17c418a
2,593
abap
ABAP
src/zcl_excel_converter_result_ex.clas.abap
gabrielros/abap2xlsx_ES
3f913357547d18a28f09aae122e5464079458ff7
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_converter_result_ex.clas.abap
gabrielros/abap2xlsx_ES
3f913357547d18a28f09aae122e5464079458ff7
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_converter_result_ex.clas.abap
gabrielros/abap2xlsx_ES
3f913357547d18a28f09aae122e5464079458ff7
[ "Apache-2.0" ]
null
null
null
class ZCL_EXCEL_CONVERTER_RESULT_EX definition public inheriting from ZCL_EXCEL_CONVERTER_RESULT final create public . *"* public components of class ZCL_EXCEL_CONVERTER_RESULT_EX *"* do not include other source files here!!! public section. methods ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT redefinition . methods ZIF_EXCEL_CONVERTER~CREATE_FIELDCATALOG redefinition . *"* protected components of class ZCL_EXCEL_CONVERTER_RESULT_EX *"* do not include other source files here!!! *"* protected components of class ZCL_EXCEL_CONVERTER_RESULT_EX *"* do not include other source files here!!! protected section. *"* private components of class ZCL_EXCEL_CONVERTER_EX_RESULT *"* do not include other source files here!!! private section. ENDCLASS. CLASS ZCL_EXCEL_CONVERTER_RESULT_EX IMPLEMENTATION. METHOD ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT. DATA: lo_result TYPE REF TO cl_salv_ex_result_data_table. TRY. lo_result ?= io_object. CATCH cx_sy_move_cast_error . RAISE EXCEPTION TYPE zcx_excel. ENDTRY. ENDMETHOD. METHOD zif_excel_converter~create_fieldcatalog. DATA: lo_result TYPE REF TO cl_salv_ex_result_data_table, lo_ex_cm TYPE REF TO cl_salv_ex_cm, lo_data TYPE REF TO data. FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE. zif_excel_converter~can_convert_object( io_object = io_object ). ws_option = is_option. lo_result ?= io_object. CLEAR: es_layout, et_fieldcatalog. IF lo_result IS BOUND. lo_data = get_table( io_object = lo_result->r_model->r_data ). IF lo_data IS BOUND. ASSIGN lo_data->* TO <fs_table> . lo_ex_cm ?= lo_result->r_model->r_model. ws_layo = lo_ex_cm->s_layo. * T_DRDN Instance Attribute Public Type LVC_T_DROP wt_fcat = lo_ex_cm->t_fcat. wt_filt = lo_ex_cm->t_filt. * T_HYPE Instance Attribute Public Type LVC_T_HYPE * T_SELECTED_CELLS Instance Attribute Public Type LVC_T_CELL * T_SELECTED_COLUMNS Instance Attribute Public Type LVC_T_COL wt_sort = lo_ex_cm->t_sort. apply_sort( EXPORTING it_table = <fs_table> IMPORTING eo_table = eo_table ) . get_color( EXPORTING io_table = eo_table IMPORTING et_colors = et_colors ) . get_filter( IMPORTING et_filter = et_filter CHANGING xo_table = eo_table ) . update_catalog( CHANGING cs_layout = es_layout ct_fieldcatalog = et_fieldcatalog ). else. * We have a problem and should stop here. ENDIF. ENDIF. ENDMETHOD. ENDCLASS.
28.494505
68
0.721558
da2843e46870829c01a865244863e4fced6bc7e8
57
abap
ABAP
src/z4_02_applications/z4_022_monster_simulator/zif_4_monster_logger.intf.abap
cjbungay/ABAPToTheFuture04
756c6defa586cf88a39832605a1dab6ea540a01e
[ "MIT" ]
8
2021-02-10T13:09:54.000Z
2022-03-08T04:51:39.000Z
src/z4_02_applications/z4_022_monster_simulator/zif_4_monster_logger.intf.abap
cjbungay/ABAPToTheFuture04
756c6defa586cf88a39832605a1dab6ea540a01e
[ "MIT" ]
6
2021-11-17T05:12:45.000Z
2021-12-07T08:11:46.000Z
src/z4_02_applications/z4_022_monster_simulator/zif_4_monster_logger.intf.abap
cjbungay/ABAPToTheFuture04
756c6defa586cf88a39832605a1dab6ea540a01e
[ "MIT" ]
4
2021-07-23T09:53:21.000Z
2022-01-12T23:15:22.000Z
interface ZIF_4_MONSTER_LOGGER public . endinterface.
11.4
30
0.824561
da2b5426ac32535c373b671e4e62c4e8904ea5d4
18,380
abap
ABAP
#gal#dropdown_helper.clas.abap
galileo-group/galileo-abap-lib
a013885096af9bc461d6000ad27b91789f150d00
[ "MIT" ]
2
2017-11-02T12:33:44.000Z
2019-10-14T10:10:13.000Z
#gal#dropdown_helper.clas.abap
galileo-group/galileo-abap-lib
a013885096af9bc461d6000ad27b91789f150d00
[ "MIT" ]
1
2017-11-05T19:36:27.000Z
2020-10-23T14:35:47.000Z
#gal#dropdown_helper.clas.abap
galileo-group/galileo-abap-lib
a013885096af9bc461d6000ad27b91789f150d00
[ "MIT" ]
null
null
null
class /GAL/DROPDOWN_HELPER definition public create public . *"* public components of class /GAL/DROPDOWN_HELPER *"* do not include other source files here!!! public section. type-pools ABAP . type-pools VRM . class-methods INIT_BY_FIELD importing !FIELD_NAME type STRING !FIELD type ANY optional !SORT_BY_KEY type ABAP_BOOL optional !SORT_BY_VALUE type ABAP_BOOL optional !LANGUAGE_VECTOR type STRING optional !SET_DEFAULT_VALUE type ABAP_BOOL optional returning value(DROPDOWN_VALUES) type VRM_VALUES raising /GAL/CX_DD_HELPER_EXCEPTION . class-methods INIT_BY_DATA_ELEMENT importing !FIELD_NAME type STRING !DATA_ELEMENT type ROLLNAME !SORT_BY_KEY type ABAP_BOOL optional !SORT_BY_VALUE type ABAP_BOOL optional !LANGUAGE_VECTOR type STRING optional !SET_DEFAULT_VALUE type ABAP_BOOL optional returning value(DROPDOWN_VALUES) type VRM_VALUES raising /GAL/CX_DD_HELPER_EXCEPTION . class-methods INIT_BY_DOMAIN importing !FIELD_NAME type STRING !DOMAIN type DOMNAME !SORT_BY_KEY type ABAP_BOOL optional !SORT_BY_VALUE type ABAP_BOOL optional !LANGUAGE_VECTOR type STRING optional !SET_DEFAULT_VALUE type ABAP_BOOL optional returning value(DROPDOWN_VALUES) type VRM_VALUES raising /GAL/CX_DD_HELPER_EXCEPTION . class-methods INIT_BY_VALUE_TABLE importing !FIELD_NAME type STRING !VALUE_TABLE type ANY TABLE !KEY_FIELD type STRING optional !VALUE_FIELD type STRING optional !LANGUAGE_FIELD type STRING optional !TEXT_FIELD type STRING optional !SORT_BY_KEY type ABAP_BOOL optional !SORT_BY_VALUE type ABAP_BOOL optional !LANGUAGE_VECTOR type STRING optional !SET_DEFAULT_VALUE type ABAP_BOOL optional returning value(DROPDOWN_VALUES) type VRM_VALUES raising /GAL/CX_DD_HELPER_EXCEPTION . protected section. *"* protected components of class /GAL/DROPDOWN_HELPER *"* do not include other source files here!!! private section. *"* private components of class /GAL/DROPDOWN_HELPER *"* do not include other source files here!!! ENDCLASS. CLASS /GAL/DROPDOWN_HELPER IMPLEMENTATION. METHOD init_by_data_element. DATA l_domain TYPE domname. DATA l_variable1 TYPE string. * Determind domain SELECT SINGLE domname FROM dd04l INTO l_domain WHERE rollname = data_element AND as4local = 'A' AND as4vers = '0000'. IF NOT sy-subrc = 0. l_variable1 = data_element. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>cannot_determine_domain var1 = l_variable1. ENDIF. * Initialize dropdown field IF NOT dropdown_values IS REQUESTED. init_by_domain( field_name = field_name domain = l_domain sort_by_key = sort_by_key sort_by_value = sort_by_value language_vector = language_vector set_default_value = set_default_value ). ELSE. dropdown_values = init_by_domain( field_name = field_name domain = l_domain sort_by_key = sort_by_key sort_by_value = sort_by_value language_vector = language_vector set_default_value = set_default_value ). ENDIF. ENDMETHOD. METHOD init_by_domain. TYPES BEGIN OF lt_text_tab. TYPES langu TYPE langu. TYPES text TYPE val_text. TYPES END OF lt_text_tab. DATA BEGIN OF l_wa_value_tab. DATA valpos TYPE valpos. DATA value TYPE domvalue_l. DATA texts TYPE STANDARD TABLE OF lt_text_tab. DATA END OF l_wa_value_tab. DATA l_value_tab LIKE STANDARD TABLE OF l_wa_value_tab. DATA l_value_db_tab TYPE entitytab. DATA l_value_db_tab_txt TYPE tabname. DATA l_value_db_key_txt TYPE fieldname. DATA l_field_table TYPE STANDARD TABLE OF string. DATA l_field_table_txt TYPE STANDARD TABLE OF string. DATA l_where TYPE string. DATA l_wa_field_table TYPE string. DATA l_field_infos TYPE STANDARD TABLE OF dfies. DATA l_variable1 TYPE string. DATA l_variable2 TYPE string. FIELD-SYMBOLS <l_field_info> TYPE dfies. * Read domain info SELECT SINGLE entitytab FROM dd01l INTO l_value_db_tab WHERE domname = domain AND as4local = 'A' AND as4vers = '0000'. "#EC CI_SUBRC IF NOT l_value_db_tab IS INITIAL. * Read checktables CALL FUNCTION 'DDIF_FIELDINFO_GET' EXPORTING tabname = l_value_db_tab TABLES dfies_tab = l_field_infos EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. l_variable1 = l_value_db_tab. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>error_analyzing_checktable var1 = l_variable1. ENDIF. READ TABLE l_field_infos WITH KEY keyflag = 'X' domname = domain ASSIGNING <l_field_info>. IF sy-subrc <> 0. l_variable1 = l_value_db_tab. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>error_analyzing_checktable var1 = l_variable1. ELSEIF <l_field_info>-leng > 10. l_variable1 = l_value_db_tab. l_variable2 = <l_field_info>-fieldname. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>field_exceeds_maximum_length var1 = l_variable1 var2 = l_variable2. ENDIF. l_wa_field_table = <l_field_info>-fieldname. INSERT l_wa_field_table INTO TABLE l_field_table. CALL FUNCTION 'DDUT_TEXTTABLE_GET' EXPORTING tabname = l_value_db_tab IMPORTING texttable = l_value_db_tab_txt checkfield = l_value_db_key_txt. IF NOT l_value_db_tab_txt IS INITIAL. CALL FUNCTION 'DDIF_FIELDINFO_GET' EXPORTING tabname = l_value_db_tab_txt TABLES dfies_tab = l_field_infos EXCEPTIONS OTHERS = 1. IF sy-subrc = 0. READ TABLE l_field_infos WITH KEY keyflag = 'X' datatype = 'LANG' ASSIGNING <l_field_info>. ENDIF. IF sy-subrc = 0. l_wa_field_table = <l_field_info>-fieldname. INSERT l_wa_field_table INTO TABLE l_field_table_txt. READ TABLE l_field_infos WITH KEY keyflag = space inttype = 'C' ASSIGNING <l_field_info>. ENDIF. IF sy-subrc = 0. l_wa_field_table = <l_field_info>-fieldname. INSERT l_wa_field_table INTO TABLE l_field_table_txt. ELSE. CLEAR l_value_db_tab_txt. ENDIF. ENDIF. SELECT (l_field_table) FROM (l_value_db_tab) INTO l_wa_value_tab-value ORDER BY (l_field_table). "#EC CI_DYNTAB IF NOT l_value_db_tab_txt IS INITIAL. CONCATENATE l_value_db_key_txt ' = ''' l_wa_value_tab-value '''' INTO l_where. SELECT (l_field_table_txt) FROM (l_value_db_tab_txt) INTO TABLE l_wa_value_tab-texts "#EC CI_DYNWHERE WHERE (l_where) "#EC CI_DYNTAB ORDER BY (l_field_table_txt). "#EC CI_SUBRC ENDIF. INSERT l_wa_value_tab INTO TABLE l_value_tab. ENDSELECT. "#EC CI_SUBRC ELSE. * Read domain fixed values SELECT valpos domvalue_l FROM dd07l INTO (l_wa_value_tab-valpos, l_wa_value_tab-value) WHERE domname = domain AND as4local = 'A' AND as4vers = '0000'. SELECT ddlanguage ddtext FROM dd07t INTO TABLE l_wa_value_tab-texts WHERE domname = domain AND as4local = 'A' AND as4vers = '0000' "#EC CI_GENBUFF AND domvalue_l = l_wa_value_tab-value. "#EC CI_SUBRC SORT l_wa_value_tab-texts BY langu. INSERT l_wa_value_tab INTO TABLE l_value_tab. ENDSELECT. "#EC CI_SUBRC SORT l_value_tab BY valpos. IF sy-subrc <> 0. l_variable1 = domain. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>no_fixed_values_defined var1 = l_variable1. ENDIF. ENDIF. * Initialize dropdown field IF NOT dropdown_values IS REQUESTED. init_by_value_table( field_name = field_name value_table = l_value_tab key_field = `VALUE` value_field = `TEXTS` sort_by_key = sort_by_key sort_by_value = sort_by_value language_vector = language_vector set_default_value = set_default_value ). ELSE. dropdown_values = init_by_value_table( field_name = field_name value_table = l_value_tab key_field = `VALUE` value_field = `TEXTS` sort_by_key = sort_by_key sort_by_value = sort_by_value language_vector = language_vector set_default_value = set_default_value ). ENDIF. ENDMETHOD. METHOD init_by_field. DATA l_type_descr TYPE REF TO cl_abap_typedescr. DATA l_data_element TYPE rollname. DATA l_field_name TYPE string. DATA l_callstack TYPE sys_callst. FIELD-SYMBOLS <l_callstack> LIKE LINE OF l_callstack. FIELD-SYMBOLS <l_field> TYPE any. * Determine data element IF field IS SUPPLIED. ASSIGN field TO <l_field>. ELSE. CALL FUNCTION 'SYSTEM_CALLSTACK' IMPORTING et_callstack = l_callstack. LOOP AT l_callstack ASSIGNING <l_callstack> WHERE NOT progname = sy-repid. CONCATENATE '(' <l_callstack>-progname ')' field_name INTO l_field_name. ASSIGN (l_field_name) TO <l_field>. CHECK sy-subrc = 0. EXIT. ENDLOOP. IF <l_field> IS NOT ASSIGNED. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>cannot_access_field var1 = l_field_name. ENDIF. ENDIF. l_type_descr = cl_abap_typedescr=>describe_by_data( <l_field> ). * Try to determine data element and domain IF l_type_descr->absolute_name CP '\TYPE=*' AND l_type_descr->absolute_name+6 CN '\'. l_data_element = l_type_descr->absolute_name+6. ELSE. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>cannot_determine_data_element var1 = field_name. ENDIF. * Initialize dropdown field IF NOT dropdown_values IS REQUESTED. init_by_data_element( field_name = field_name data_element = l_data_element sort_by_key = sort_by_key sort_by_value = sort_by_value language_vector = language_vector set_default_value = set_default_value ). ELSE. dropdown_values = init_by_data_element( field_name = field_name data_element = l_data_element sort_by_key = sort_by_key sort_by_value = sort_by_value language_vector = language_vector set_default_value = set_default_value ). ENDIF. ENDMETHOD. METHOD init_by_value_table. DATA l_field_name TYPE vrm_id. DATA l_field_name_ext TYPE string. DATA l_type TYPE c. DATA l_wa_values LIKE LINE OF dropdown_values. DATA l_language_vector LIKE language_vector. DATA l_callstack TYPE sys_callst. FIELD-SYMBOLS <l_key_value_pair> TYPE any. FIELD-SYMBOLS <l_key> TYPE any. FIELD-SYMBOLS <l_value> TYPE any. FIELD-SYMBOLS <l_value_tab> TYPE ANY TABLE. FIELD-SYMBOLS <l_langu_text_pair> TYPE any. FIELD-SYMBOLS <l_langu> TYPE any. FIELD-SYMBOLS <l_text> TYPE any. FIELD-SYMBOLS <l_field> TYPE any. FIELD-SYMBOLS <l_callstack> LIKE LINE OF l_callstack. FIELD-SYMBOLS <l_dropdown_values> LIKE LINE OF dropdown_values. * Convert value table LOOP AT value_table ASSIGNING <l_key_value_pair>. * Determine key field UNASSIGN <l_key>. IF NOT key_field IS INITIAL. ASSIGN COMPONENT key_field OF STRUCTURE <l_key_value_pair> TO <l_key>. ELSE. ASSIGN COMPONENT 1 OF STRUCTURE <l_key_value_pair> TO <l_key>. IF sy-subrc <> 0. ASSIGN <l_key_value_pair> TO <l_key>. " Support internal tables without structure ENDIF. ENDIF. IF <l_key> IS NOT ASSIGNED. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>cannot_determine_key_field. ENDIF. * Determine text field UNASSIGN <l_value>. IF NOT value_field IS INITIAL. ASSIGN COMPONENT value_field OF STRUCTURE <l_key_value_pair> TO <l_value>. ELSE. ASSIGN COMPONENT 2 OF STRUCTURE <l_key_value_pair> TO <l_value>. ENDIF. * Support tables with multi-lingual texts IF <l_value> IS ASSIGNED. DESCRIBE FIELD <l_value> TYPE l_type. IF l_type = 'h'. ASSIGN <l_value> TO <l_value_tab>. UNASSIGN <l_value>. * Initialize language vector IF language_vector IS INITIAL. CONCATENATE sy-langu '*' INTO l_language_vector. ELSE. l_language_vector = language_vector. ENDIF. WHILE NOT l_language_vector IS INITIAL AND NOT <l_value> IS ASSIGNED. LOOP AT <l_value_tab> ASSIGNING <l_langu_text_pair>. * Determine language field IF NOT language_field IS INITIAL. ASSIGN COMPONENT language_field OF STRUCTURE <l_langu_text_pair> TO <l_langu>. ELSE. ASSIGN COMPONENT 1 OF STRUCTURE <l_langu_text_pair> TO <l_langu>. ENDIF. IF NOT sy-subrc = 0. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>cannot_determine_lang_field. ENDIF. * Determine text field IF NOT text_field IS INITIAL. ASSIGN COMPONENT text_field OF STRUCTURE <l_langu_text_pair> TO <l_text>. ELSE. ASSIGN COMPONENT 2 OF STRUCTURE <l_langu_text_pair> TO <l_text>. ENDIF. IF NOT sy-subrc = 0. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>cannot_determine_text_field. ENDIF. * Check language IF l_language_vector(1) = <l_langu> OR l_language_vector(1) = '*'. ASSIGN <l_text> TO <l_value>. EXIT. ENDIF. ENDLOOP. SHIFT l_language_vector LEFT. ENDWHILE. ENDIF. ENDIF. * Fallback: Use key as text IF NOT <l_value> IS ASSIGNED. ASSIGN <l_key> TO <l_value>. ENDIF. * Create record in value table l_wa_values-key = <l_key>. l_wa_values-text = <l_value>. INSERT l_wa_values INTO TABLE dropdown_values. ENDLOOP. * Sort value table (if necessary) IF NOT sort_by_key IS INITIAL. SORT dropdown_values BY key. ENDIF. IF NOT sort_by_value IS INITIAL. SORT dropdown_values STABLE BY text. ENDIF. * Initialize dropdown and set default values IF NOT dropdown_values IS REQUESTED. l_field_name = field_name. CALL FUNCTION 'VRM_SET_VALUES' EXPORTING id = l_field_name values = dropdown_values EXCEPTIONS OTHERS = 1. IF NOT sy-subrc = 0. RAISE EXCEPTION TYPE /gal/cx_dd_helper_exception EXPORTING textid = /gal/cx_dd_helper_exception=>error_calling_vrm_set_values. ENDIF. IF set_default_value <> abap_false. CALL FUNCTION 'SYSTEM_CALLSTACK' IMPORTING et_callstack = l_callstack. LOOP AT l_callstack ASSIGNING <l_callstack> WHERE NOT progname = sy-repid. CONCATENATE '(' <l_callstack>-progname ')' field_name INTO l_field_name_ext. ASSIGN (l_field_name_ext) TO <l_field>. CHECK sy-subrc = 0. EXIT. ENDLOOP. IF <l_field> IS ASSIGNED. READ TABLE dropdown_values WITH KEY key = <l_field> TRANSPORTING NO FIELDS. IF sy-subrc <> 0. IF set_default_value = '1'. DESCRIBE TABLE dropdown_values LINES sy-tfill. IF sy-tfill = 1. READ TABLE dropdown_values INDEX 1 ASSIGNING <l_dropdown_values>. ENDIF. ELSE. READ TABLE dropdown_values INDEX 1 ASSIGNING <l_dropdown_values>. ENDIF. IF <l_dropdown_values> IS ASSIGNED. TRY. <l_field> = <l_dropdown_values>-key. CATCH cx_root. "#EC NO_HANDLER "#EC CATCH_ALL ENDTRY. ENDIF. ENDIF. ENDIF. ENDIF. ENDIF. ENDMETHOD. ENDCLASS.
30.890756
89
0.605713
da3178294258d26437082db82ad11f1d3830196f
1,739
abap
ABAP
src/zcl_ooa1_sip_yarat.clas.abap
keremkoseoglu/MAR2022
1761a16ce4d180e9102d78b70859f69e56aeef04
[ "MIT" ]
null
null
null
src/zcl_ooa1_sip_yarat.clas.abap
keremkoseoglu/MAR2022
1761a16ce4d180e9102d78b70859f69e56aeef04
[ "MIT" ]
null
null
null
src/zcl_ooa1_sip_yarat.clas.abap
keremkoseoglu/MAR2022
1761a16ce4d180e9102d78b70859f69e56aeef04
[ "MIT" ]
null
null
null
CLASS zcl_ooa1_sip_yarat DEFINITION PUBLIC CREATE PUBLIC . ##todo. " aşağıdaki işleri temizle " programı yaz PUBLIC SECTION. TYPES: BEGIN OF sip_input_dict, tarih TYPE dats, dummy TYPE char1, END OF sip_input_dict. TYPES: BEGIN OF sonuc_dict, basarili TYPE abap_bool, hata TYPE string, END OF sonuc_Dict. METHODS siparis_simulasyon IMPORTING !input TYPE sip_input_Dict EXPORTING !kontrol_sonucu TYPE sonuc_dict. METHODS siparis_yarat IMPORTING !input TYPE sip_input_Dict EXPORTING !kontrol_sonucu TYPE sonuc_dict. PROTECTED SECTION. PRIVATE SECTION. METHODS veri_kontrolu IMPORTING !input TYPE sip_input_Dict !yetkiye_bak TYPE abap_bool RETURNING VALUE(result) TYPE sonuc_dict. ENDCLASS. CLASS zcl_ooa1_sip_yarat IMPLEMENTATION. METHOD siparis_simulasyon. kontrol_sonucu = veri_kontrolu( input = input yetkiye_bak = abap_false ). IF kontrol_Sonucu-basarili = abap_False. RETURN. ENDIF. write:/ 'Sim OK'. ##todo. " BAPI çağırıp simülasyon yap ENDMETHOD. METHOD siparis_yarat. kontrol_sonucu = veri_kontrolu( input = input yetkiye_bak = abap_true ). IF kontrol_Sonucu-basarili = abap_False. RETURN. ENDIF. write:/ 'Sip OK'. ##todo. " BAPI çağırıp kayıt yarat " log sınıfı açıp logla " VBAK-ZZXX alanını unutma ENDMETHOD. METHOD veri_kontrolu. ##todo. " yetki kontrolü yapılacak " lock kontrolü yapılacak result-basarili = abap_true. ENDMETHOD. ENDCLASS.
22.584416
63
0.630822
da3270f7ba110d89e7c6705796a189437e5af4a0
3,638
abap
ABAP
src/checks/zcl_aoc_check_02.clas.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_02.clas.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
null
null
null
src/checks/zcl_aoc_check_02.clas.abap
oliver-huetkoeper/abapOpenChecks
e639f3a331046426d550f87618547d652722a63b
[ "MIT" ]
null
null
null
CLASS zcl_aoc_check_02 DEFINITION PUBLIC INHERITING FROM zcl_aoc_super CREATE PUBLIC. PUBLIC SECTION. METHODS constructor. METHODS check REDEFINITION. METHODS get_message_text REDEFINITION. METHODS if_ci_test~query_attributes REDEFINITION. METHODS put_attributes REDEFINITION. METHODS get_attributes REDEFINITION. PROTECTED SECTION. DATA mv_check TYPE flag. DATA mv_exit TYPE flag. PRIVATE SECTION. ENDCLASS. CLASS ZCL_AOC_CHECK_02 IMPLEMENTATION. METHOD check. * abapOpenChecks * https://github.com/larshp/abapOpenChecks * MIT License DATA: lv_keyword TYPE string, lv_line TYPE token_row, lv_include TYPE program, lv_error TYPE sci_errc, lv_index LIKE sy-tabix. FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements. LOOP AT io_scan->statements ASSIGNING <ls_statement>. lv_index = sy-tabix. lv_keyword = io_scan->statement_keyword( lv_index ). IF lv_keyword = 'EXIT' AND mv_exit = abap_true. lv_error = '001'. ELSEIF lv_keyword = 'CHECK' AND mv_check = abap_true. lv_error = '002'. ELSE. CONTINUE. " current loop ENDIF. LOOP AT io_scan->structures TRANSPORTING NO FIELDS WHERE ( stmnt_type = zcl_aoc_scan=>gc_structure_statement-loop OR stmnt_type = zcl_aoc_scan=>gc_structure_statement-while OR stmnt_type = zcl_aoc_scan=>gc_structure_statement-do OR stmnt_type = zcl_aoc_scan=>gc_structure_statement-select ) AND stmnt_from <= lv_index AND stmnt_to >= lv_index. EXIT. " current loop ENDLOOP. IF sy-subrc <> 0. lv_line = io_scan->statement_row( lv_index ). lv_include = io_scan->get_include( <ls_statement>-level ). inform( p_sub_obj_name = lv_include p_position = lv_index p_line = lv_line p_kind = mv_errty p_test = myname p_code = lv_error ). ENDIF. ENDLOOP. ENDMETHOD. METHOD constructor. super->constructor( ). version = '001'. position = '002'. has_attributes = abap_true. attributes_ok = abap_true. enable_rfc( ). set_uses_checksum( ). mv_check = abap_true. mv_exit = abap_true. ENDMETHOD. METHOD get_attributes. EXPORT mv_errty = mv_errty mv_check = mv_check mv_exit = mv_exit TO DATA BUFFER p_attributes. ENDMETHOD. METHOD get_message_text. CLEAR p_text. CASE p_code. WHEN '001'. p_text = 'EXIT outside loop, use RETURN instead'. "#EC NOTEXT WHEN '002'. p_text = 'CHECK outside of loop'. "#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 METHOD if_ci_test~query_attributes. zzaoc_top. zzaoc_fill_att mv_errty 'Error Type' ''. "#EC NOTEXT zzaoc_fill_att mv_check 'CHECK' 'C'. "#EC NOTEXT zzaoc_fill_att mv_exit 'EXIT' 'C'. "#EC NOTEXT zzaoc_popup. ENDMETHOD. METHOD put_attributes. IMPORT mv_errty = mv_errty mv_check = mv_check mv_exit = mv_exit FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED ASSERT sy-subrc = 0. ENDMETHOD. ENDCLASS.
22.880503
72
0.604453
da349b0ddc9aa98a0568c727ed4fc2e02c21d8cc
2,928
abap
ABAP
#ensx#cl_xslt_sbo_jsn_renderer.clas.abap
jbrabandt/abapxslt
aa3615fb5549ffb406da28887e31e2515ea64e1c
[ "CC0-1.0" ]
null
null
null
#ensx#cl_xslt_sbo_jsn_renderer.clas.abap
jbrabandt/abapxslt
aa3615fb5549ffb406da28887e31e2515ea64e1c
[ "CC0-1.0" ]
null
null
null
#ensx#cl_xslt_sbo_jsn_renderer.clas.abap
jbrabandt/abapxslt
aa3615fb5549ffb406da28887e31e2515ea64e1c
[ "CC0-1.0" ]
null
null
null
class /ENSX/CL_XSLT_SBO_JSN_RENDERER definition public inheriting from /ENSX/CL_XSLT_JSON_RENDERER create public . public section. data GO_FRIENDLYFIELDS type ref to /ENSX/CL_OBJECT_FLD_MAP . methods _GET_FRIEMDLY_FIELDNAME importing !FIELDNAME type STRING !PATH type STRING returning value(FRIENDLYNAME) type STRING . methods CONSTRUCTOR importing !BUS_OBJ type /ENSX/BUSOBJ_TYP . methods _GET_ELEMENT_NAME redefinition . methods __CHECK_FLATTEN_CONDITION redefinition . protected section. private section. ENDCLASS. CLASS /ENSX/CL_XSLT_SBO_JSN_RENDERER IMPLEMENTATION. METHOD constructor. DATA i_clienttype TYPE /ensx/clienttype. DATA i_cid TYPE /ensx/firmenid. super->constructor( ). CREATE OBJECT go_friendlyfields EXPORTING i_objtype = bus_obj * i_clienttype = i_clienttype i_cid = i_cid. m_objname = bus_obj. ENDMETHOD. METHOD _get_element_name. DATA: flddescr TYPE dfies. DATA: elemdescr TYPE REF TO cl_abap_elemdescr. DATA: l_name TYPE string. DATA: no_mixed TYPE boole_d. TRY. super->_get_element_name( EXPORTING typedescr = typedescr path = path RECEIVING name = name ). l_name = me->_get_friemdly_fieldname( fieldname = name path = path ). IF l_name IS NOT INITIAL. name = l_name. no_mixed = abap_true. ELSEIF typedescr->is_ddic_type( ) = abap_true AND is_table_line = abap_true. elemdescr ?= typedescr. flddescr = elemdescr->get_ddic_field( ). IF flddescr-scrtext_l IS NOT INITIAL. name = flddescr-scrtext_l. ENDIF. ENDIF. name = /ensx/cl_abap_string_functions=>_replace_special_chars( in = name ). IF name(1) CA '1234567890'. CONCATENATE 't' name INTO name. ENDIF. TRANSLATE name USING ' _'. IF name CS '_' or no_mixed = abap_false. name = /ensx/cl_abap_string_functions=>_to_mixed( in = name ). ENDIF. CONDENSE name NO-GAPS. CATCH /ensx/cx_xslt . ENDTRY. ENDMETHOD. METHOD _get_friemdly_fieldname. DATA: base TYPE string. DATA: recordset TYPE string. DATA: record TYPE string. SPLIT path AT '.' INTO base recordset record. friendlyname = go_friendlyfields->/ensx/if_object_fldmap~get_friendly_fieldname( i_recordset = recordset i_record = record i_field = fieldname ). ENDMETHOD. METHOD __check_flatten_condition. IF flatten = abap_true and ( name = 'HEADER' OR name = 'ADDRESS' OR name = 'SEARCHRESULT' ). do_flatten = abap_true. ENDIF. ENDMETHOD. ENDCLASS.
25.911504
96
0.619194
da3500d519eed11cbdbf57c1fe05e8d90cce087d
2,371
abap
ABAP
zcl_glds_demo_test_cfg.clas.abap
tricktresor/gladius
a052ff7a6bac5b4186e3ee3586e4883f34b17873
[ "MIT" ]
11
2018-06-26T07:58:31.000Z
2021-02-02T09:27:50.000Z
zcl_glds_demo_test_cfg.clas.abap
tricktresor/gladius
a052ff7a6bac5b4186e3ee3586e4883f34b17873
[ "MIT" ]
2
2018-09-04T19:56:30.000Z
2020-08-11T19:38:52.000Z
zcl_glds_demo_test_cfg.clas.abap
tricktresor/gladius
a052ff7a6bac5b4186e3ee3586e4883f34b17873
[ "MIT" ]
2
2018-08-13T16:07:21.000Z
2018-10-24T15:09:40.000Z
CLASS zcl_glds_demo_test_cfg DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES zif_glds_demo_command_list . INTERFACES zif_glds_demo_description . INTERFACES zif_glds_demo_test_interface . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS ZCL_GLDS_DEMO_TEST_CFG IMPLEMENTATION. METHOD zif_glds_demo_command_list~get_black_list. "Blacklist commands = VALUE #( ( `->` ) ( `=>` ) ). ENDMETHOD. METHOD zif_glds_demo_command_list~get_white_list. "Whitelist commands = VALUE #( ( `FIELD-SYMBOLS` ) ( `CHECK` ) ( `EXIT` ) ( `RETURN` ) ( `DO` ) ( `ENDDO` ) ( `WHILE` ) ( `ENDWHILE` ) ( `CASE` ) ( `WHEN` ) ( `ENDCASE` ) ( `IF` ) ( `ELSEIF` ) ( `ELSE` ) ( `ENDIF` ) ( `MOVE-CORRESPONDING` ) ( `ASSIGN` ) ( `UNASSIGN` ) ( `CLEAR` ) ( `FREE` ) ( `FIND` ) ( `REPLACE` ) ( `APPEND` ) ( `INSERT` ) ( `MODIFY` ) ( `DELETE` ) ( `COLLECT` ) ( `READ` ) ( `LOOP` ) ( `ENDLOOP` ) ( `SORT` ) ). ENDMETHOD. METHOD zif_glds_demo_description~get. CONCATENATE `This is a challenge.` `Try to find out what formula is used for computing the result.` INTO text SEPARATED BY cl_abap_char_utilities=>cr_lf. "Signature DATA(signature_description) = zcl_glds_demo_helper=>get_signature_description( me ). IF signature_description IS NOT INITIAL. CONCATENATE text cl_abap_char_utilities=>cr_lf signature_description cl_abap_char_utilities=>cr_lf INTO text. ENDIF. ENDMETHOD. METHOD zif_glds_demo_test_interface~get_interface. rv_interface = 'ZIF_GLDS_DEMO_TEST'. ENDMETHOD. METHOD zif_glds_demo_test_interface~get_template. rv_template = 'ZGLDS_DEMO_TEST_TEMPLATE'. ENDMETHOD. ENDCLASS.
23.245098
88
0.490932
da37310a2a333b402cb2f82a76accb79e53ff07c
1,058
abap
ABAP
src/day09/zcl_advent2020_day09_hvam.clas.testclasses.abap
larshp/abap-advent-2020
a6e4be7646e2f4c7f619418a99207731a61faa29
[ "Unlicense" ]
8
2020-12-01T10:05:34.000Z
2021-12-01T15:43:47.000Z
src/day09/zcl_advent2020_day09_hvam.clas.testclasses.abap
larshp/abap-advent-2020
a6e4be7646e2f4c7f619418a99207731a61faa29
[ "Unlicense" ]
2
2020-12-07T07:28:43.000Z
2020-12-09T06:19:31.000Z
src/day09/zcl_advent2020_day09_hvam.clas.testclasses.abap
larshp/abap-advent-2020
a6e4be7646e2f4c7f619418a99207731a61faa29
[ "Unlicense" ]
null
null
null
CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL. PRIVATE SECTION. DATA mo_cut TYPE REF TO zcl_advent2020_day09_hvam. DATA mv_input TYPE string. METHODS setup. METHODS part1 FOR TESTING. METHODS part2 FOR TESTING. ENDCLASS. CLASS ltcl_test IMPLEMENTATION. METHOD setup. mo_cut = NEW #( ). mo_cut->preamble = 5. mv_input = |35\n| & |20\n| & |15\n| & |25\n| & |47\n| & |40\n| & |62\n| & |55\n| & |65\n| & |95\n| & |102\n| & |117\n| & |150\n| & |182\n| & |127\n| & |219\n| & |299\n| & |277\n| & |309\n| & |576|. ENDMETHOD. METHOD part1. DATA(lv_result) = mo_cut->part1( mv_input ). cl_abap_unit_assert=>assert_equals( act = lv_result exp = |127| ). ENDMETHOD. METHOD part2. DATA(lv_result) = mo_cut->part2( mv_input ). cl_abap_unit_assert=>assert_equals( act = lv_result exp = |62| ). ENDMETHOD. ENDCLASS.
16.030303
80
0.541588
da3799483e87d6f2979a8c64e538b39460abf59c
7,904
abap
ABAP
src/zabapgit_object_view.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
src/zabapgit_object_view.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
src/zabapgit_object_view.prog.abap
ashokdeveloper61/SAP-ABAP-Sample-code
b1935930f2af85da5e4751ab4e6c8c9a6e4bd223
[ "MIT" ]
null
null
null
*&---------------------------------------------------------------------* *& Include ZABAPGIT_OBJECT_VIEW *&---------------------------------------------------------------------* *----------------------------------------------------------------------* * CLASS lcl_object_view DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_object_view DEFINITION INHERITING FROM lcl_objects_super FINAL. PUBLIC SECTION. INTERFACES lif_object. ALIASES mo_files FOR lif_object~mo_files. ENDCLASS. "lcl_object_dtel DEFINITION *----------------------------------------------------------------------* * CLASS lcl_object_view IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_object_view IMPLEMENTATION. METHOD lif_object~has_changed_since. DATA: lv_date TYPE dats, lv_time TYPE tims, lv_ts TYPE timestamp. SELECT SINGLE as4date as4time FROM dd25l " View INTO (lv_date, lv_time) WHERE viewname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. _object_check_timestamp lv_date lv_time. SELECT SINGLE as4date as4time FROM dd09l " Table tech settings INTO (lv_date, lv_time) WHERE tabname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. _object_check_timestamp lv_date lv_time. ENDMETHOD. "lif_object~has_changed_since METHOD lif_object~changed_by. SELECT SINGLE as4user FROM dd25l INTO rv_user WHERE viewname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. IF sy-subrc <> 0. rv_user = c_user_unknown. ENDIF. ENDMETHOD. "lif_object~changed_by METHOD lif_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-ddic = abap_true. ENDMETHOD. "lif_object~get_metadata METHOD lif_object~exists. DATA: lv_viewname TYPE dd25l-viewname, lv_ddl_view TYPE abap_bool. SELECT SINGLE viewname FROM dd25l INTO lv_viewname WHERE viewname = ms_item-obj_name AND as4local = 'A' AND as4vers = '0000'. rv_bool = boolc( sy-subrc = 0 ). IF rv_bool = abap_true. TRY. CALL METHOD ('CL_DD_DDL_UTILITIES')=>('CHECK_FOR_DDL_VIEW') EXPORTING objname = lv_viewname RECEIVING is_ddl_view = lv_ddl_view. IF lv_ddl_view = abap_true. rv_bool = abap_false. ENDIF. CATCH cx_root. ENDTRY. ENDIF. ENDMETHOD. "lif_object~exists METHOD lif_object~jump. jump_se11( iv_radio = 'RSRD1-VIMA' iv_field = 'RSRD1-VIMA_VAL' ). ENDMETHOD. "jump METHOD lif_object~delete. DATA: lv_objname TYPE rsedd0-ddobjname. lv_objname = ms_item-obj_name. CALL FUNCTION 'RS_DD_DELETE_OBJ' EXPORTING no_ask = abap_true objname = lv_objname objtype = 'V' EXCEPTIONS not_executed = 1 object_not_found = 2 object_not_specified = 3 permission_failure = 4. IF sy-subrc <> 0. lcx_exception=>raise( 'error from RS_DD_DELETE_OBJ, VIEW' ). ENDIF. ENDMETHOD. "delete METHOD lif_object~serialize. DATA: lv_name TYPE ddobjname, ls_dd25v TYPE dd25v, ls_dd09l TYPE dd09l, lt_dd26v TYPE TABLE OF dd26v, lt_dd27p TYPE TABLE OF dd27p, lt_dd28j TYPE TABLE OF dd28j, lt_dd28v TYPE TABLE OF dd28v. FIELD-SYMBOLS: <ls_dd27p> LIKE LINE OF lt_dd27p. lv_name = ms_item-obj_name. CALL FUNCTION 'DDIF_VIEW_GET' EXPORTING name = lv_name state = 'A' langu = mv_language IMPORTING dd25v_wa = ls_dd25v dd09l_wa = ls_dd09l TABLES dd26v_tab = lt_dd26v dd27p_tab = lt_dd27p dd28j_tab = lt_dd28j dd28v_tab = lt_dd28v EXCEPTIONS illegal_input = 1 OTHERS = 2. IF sy-subrc <> 0. lcx_exception=>raise( 'error from DDIF_VIEW_GET' ). ENDIF. IF ls_dd25v IS INITIAL. RETURN. " does not exist in system ENDIF. CLEAR: ls_dd25v-as4user, ls_dd25v-as4date, ls_dd25v-as4time. CLEAR: ls_dd09l-as4user, ls_dd09l-as4date, ls_dd09l-as4time. LOOP AT lt_dd27p ASSIGNING <ls_dd27p>. CLEAR: <ls_dd27p>-ddtext, <ls_dd27p>-reptext, <ls_dd27p>-scrtext_s, <ls_dd27p>-scrtext_m, <ls_dd27p>-scrtext_l, <ls_dd27p>-outputlen, <ls_dd27p>-decimals, <ls_dd27p>-lowercase, <ls_dd27p>-convexit, <ls_dd27p>-signflag, <ls_dd27p>-flength, <ls_dd27p>-domname, <ls_dd27p>-datatype, <ls_dd27p>-entitytab, <ls_dd27p>-inttype, <ls_dd27p>-intlen, <ls_dd27p>-headlen, <ls_dd27p>-scrlen1, <ls_dd27p>-scrlen2, <ls_dd27p>-scrlen3, <ls_dd27p>-memoryid. ENDLOOP. io_xml->add( iv_name = 'DD25V' ig_data = ls_dd25v ). io_xml->add( iv_name = 'DD09L' ig_data = ls_dd09l ). io_xml->add( ig_data = lt_dd26v iv_name = 'DD26V_TABLE' ). io_xml->add( ig_data = lt_dd27p iv_name = 'DD27P_TABLE' ). io_xml->add( ig_data = lt_dd28j iv_name = 'DD28J_TABLE' ). io_xml->add( ig_data = lt_dd28v iv_name = 'DD28V_TABLE' ). ENDMETHOD. "serialize METHOD lif_object~deserialize. DATA: lv_name TYPE ddobjname, ls_dd25v TYPE dd25v, ls_dd09l TYPE dd09l, lt_dd26v TYPE TABLE OF dd26v, lt_dd27p TYPE TABLE OF dd27p, lt_dd28j TYPE TABLE OF dd28j, lt_dd28v TYPE TABLE OF dd28v. io_xml->read( EXPORTING iv_name = 'DD25V' CHANGING cg_data = ls_dd25v ). io_xml->read( EXPORTING iv_name = 'DD09L' CHANGING cg_data = ls_dd09l ). io_xml->read( EXPORTING iv_name = 'DD26V_TABLE' CHANGING cg_data = lt_dd26v ). io_xml->read( EXPORTING iv_name = 'DD27P_TABLE' CHANGING cg_data = lt_dd27p ). io_xml->read( EXPORTING iv_name = 'DD28J_TABLE' CHANGING cg_data = lt_dd28j ). io_xml->read( EXPORTING iv_name = 'DD28V_TABLE' CHANGING cg_data = lt_dd28v ). corr_insert( iv_package ). lv_name = ms_item-obj_name. " type conversion CALL FUNCTION 'DDIF_VIEW_PUT' EXPORTING name = lv_name dd25v_wa = ls_dd25v dd09l_wa = ls_dd09l TABLES dd26v_tab = lt_dd26v dd27p_tab = lt_dd27p dd28j_tab = lt_dd28j dd28v_tab = lt_dd28v EXCEPTIONS view_not_found = 1 name_inconsistent = 2 view_inconsistent = 3 put_failure = 4 put_refused = 5 OTHERS = 6. IF sy-subrc <> 0. lcx_exception=>raise( 'error from DDIF_VIEW_PUT' ). ENDIF. lcl_objects_activation=>add_item( ms_item ). ENDMETHOD. "deserialize METHOD lif_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result. ENDMETHOD. "lif_object~compare_to_remote_version ENDCLASS. "lcl_object_view IMPLEMENTATION
29.492537
73
0.535552
da37a4d381b9064735e6492b29a98e181f689223
227
abap
ABAP
src/unmanaged/#dmo#bp_booking_u11.clas.abap
SAP-Cloud-Platform/flight11
8b5d70046bc3f7619f2d33cc90b3a53b0809cc54
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u11.clas.abap
SAP-Cloud-Platform/flight11
8b5d70046bc3f7619f2d33cc90b3a53b0809cc54
[ "BSD-Source-Code" ]
null
null
null
src/unmanaged/#dmo#bp_booking_u11.clas.abap
SAP-Cloud-Platform/flight11
8b5d70046bc3f7619f2d33cc90b3a53b0809cc54
[ "BSD-Source-Code" ]
null
null
null
CLASS /dmo/bp_booking_u11 DEFINITION PUBLIC ABSTRACT FINAL FOR BEHAVIOR OF /dmo/i_travel_u11 . PUBLIC SECTION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS /dmo/bp_booking_u11 IMPLEMENTATION. ENDCLASS.
14.1875
41
0.76652
da3a13874fe81a21d3f935fa1606552dd340e050
9,207
abap
ABAP
src/zcl_abapgit_code_inspector.clas.abap
markstuppacher/abapGit
c8c9a3726f53240ad322dc31e47e2352aae04d0a
[ "MIT" ]
null
null
null
src/zcl_abapgit_code_inspector.clas.abap
markstuppacher/abapGit
c8c9a3726f53240ad322dc31e47e2352aae04d0a
[ "MIT" ]
17
2021-06-01T05:55:28.000Z
2021-08-22T17:48:23.000Z
src/zcl_abapgit_code_inspector.clas.abap
markstuppacher/abapGit
c8c9a3726f53240ad322dc31e47e2352aae04d0a
[ "MIT" ]
1
2021-08-18T07:58:26.000Z
2021-08-18T07:58:26.000Z
CLASS zcl_abapgit_code_inspector DEFINITION PUBLIC CREATE PROTECTED GLOBAL FRIENDS zcl_abapgit_factory . PUBLIC SECTION. INTERFACES zif_abapgit_code_inspector . METHODS constructor IMPORTING !iv_package TYPE devclass RAISING zcx_abapgit_exception . CLASS-METHODS validate_check_variant IMPORTING !iv_check_variant_name TYPE sci_chkv RAISING zcx_abapgit_exception . PROTECTED SECTION. DATA mv_package TYPE devclass . METHODS create_variant IMPORTING !iv_variant TYPE sci_chkv RETURNING VALUE(ro_variant) TYPE REF TO cl_ci_checkvariant RAISING zcx_abapgit_exception . METHODS cleanup IMPORTING !io_set TYPE REF TO cl_ci_objectset RAISING zcx_abapgit_exception . METHODS skip_object IMPORTING !is_obj TYPE scir_objs RETURNING VALUE(rv_skip) TYPE abap_bool. PRIVATE SECTION. DATA mv_success TYPE abap_bool . TYPES: ty_run_mode TYPE c LENGTH 1. CONSTANTS: BEGIN OF co_run_mode, run_with_popup TYPE ty_run_mode VALUE 'P', run_after_popup TYPE ty_run_mode VALUE 'A', run_via_rfc TYPE ty_run_mode VALUE 'R', run_in_batch TYPE ty_run_mode VALUE 'B', run_loc_parallel TYPE ty_run_mode VALUE 'L', run_direct TYPE ty_run_mode VALUE 'L', END OF co_run_mode . DATA mo_inspection TYPE REF TO cl_ci_inspection . DATA mv_name TYPE sci_objs . DATA mv_run_mode TYPE c LENGTH 1 . METHODS create_objectset RETURNING VALUE(ro_set) TYPE REF TO cl_ci_objectset . METHODS run_inspection IMPORTING !io_inspection TYPE REF TO cl_ci_inspection RETURNING VALUE(rt_list) TYPE scit_alvlist RAISING zcx_abapgit_exception . METHODS create_inspection IMPORTING io_set TYPE REF TO cl_ci_objectset io_variant TYPE REF TO cl_ci_checkvariant RETURNING VALUE(ro_inspection) TYPE REF TO cl_ci_inspection RAISING zcx_abapgit_exception . METHODS decide_run_mode RETURNING VALUE(rv_run_mode) TYPE ty_run_mode. ENDCLASS. CLASS ZCL_ABAPGIT_CODE_INSPECTOR IMPLEMENTATION. METHOD cleanup. IF mo_inspection IS BOUND. mo_inspection->delete( EXCEPTIONS locked = 1 error_in_enqueue = 2 not_authorized = 3 exceptn_appl_exists = 4 OTHERS = 5 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Couldn't delete inspection. Subrc = { sy-subrc }| ). ENDIF. ENDIF. io_set->delete( EXCEPTIONS exists_in_insp = 1 locked = 2 error_in_enqueue = 3 not_authorized = 4 exists_in_objs = 5 OTHERS = 6 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Couldn't delete objectset. Subrc = { sy-subrc }| ). ENDIF. ENDMETHOD. METHOD constructor. IF iv_package IS INITIAL. zcx_abapgit_exception=>raise( |Please supply package| ). ENDIF. mv_package = iv_package. " We create the inspection and objectset with dummy names. " Because we want to persist them so we can run it in parallel. " Both are deleted afterwards. mv_name = |{ sy-uname }_{ sy-datum }_{ sy-uzeit }|. mv_run_mode = decide_run_mode( ). ENDMETHOD. METHOD create_inspection. cl_ci_inspection=>create( EXPORTING p_user = sy-uname p_name = mv_name RECEIVING p_ref = ro_inspection EXCEPTIONS locked = 1 error_in_enqueue = 2 not_authorized = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Failed to create inspection. Subrc = { sy-subrc }| ). ENDIF. ro_inspection->set( p_chkv = io_variant p_objs = io_set ). ro_inspection->save( EXCEPTIONS missing_information = 1 insp_no_name = 2 not_enqueued = 3 OTHERS = 4 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Failed to save inspection. Subrc = { sy-subrc }| ). ENDIF. ENDMETHOD. METHOD create_objectset. DATA: lt_objs TYPE scit_objs, ls_obj TYPE scir_objs, lt_objs_check TYPE scit_objs, ls_item TYPE zif_abapgit_definitions=>ty_item, lt_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt. lt_packages = zcl_abapgit_factory=>get_sap_package( mv_package )->list_subpackages( ). INSERT mv_package INTO TABLE lt_packages. SELECT object AS objtype obj_name AS objname FROM tadir INTO CORRESPONDING FIELDS OF TABLE lt_objs FOR ALL ENTRIES IN lt_packages WHERE devclass = lt_packages-table_line AND delflag = abap_false AND pgmid = 'R3TR' ##TOO_MANY_ITAB_FIELDS. "#EC CI_GENBUFF LOOP AT lt_objs INTO ls_obj. IF skip_object( ls_obj ) = abap_true. CONTINUE. ENDIF. ls_item-obj_type = ls_obj-objtype. ls_item-obj_name = ls_obj-objname. IF zcl_abapgit_objects=>exists( ls_item ) = abap_false. CONTINUE. ENDIF. INSERT ls_obj INTO TABLE lt_objs_check. ENDLOOP. ro_set = cl_ci_objectset=>save_from_list( p_name = mv_name p_objects = lt_objs_check ). ENDMETHOD. METHOD create_variant. IF iv_variant IS INITIAL. zcx_abapgit_exception=>raise( |No check variant supplied.| ). ENDIF. cl_ci_checkvariant=>get_ref( EXPORTING p_user = '' p_name = iv_variant RECEIVING p_ref = ro_variant EXCEPTIONS chkv_not_exists = 1 missing_parameter = 2 OTHERS = 3 ). CASE sy-subrc. WHEN 1. zcx_abapgit_exception=>raise( |Check variant { iv_variant } doesn't exist| ). WHEN 2. zcx_abapgit_exception=>raise( |Parameter missing for check variant { iv_variant }| ). ENDCASE. ENDMETHOD. METHOD decide_run_mode. DATA lo_settings TYPE REF TO zcl_abapgit_settings. lo_settings = zcl_abapgit_persist_factory=>get_settings( )->read( ). IF sy-batch = abap_true. " We have to disable parallelization in batch because of lock errors. rv_run_mode = co_run_mode-run_via_rfc. ELSEIF lo_settings->get_parallel_proc_disabled( ) = abap_false. rv_run_mode = co_run_mode-run_loc_parallel. ELSE. rv_run_mode = co_run_mode-run_via_rfc. ENDIF. ENDMETHOD. METHOD run_inspection. io_inspection->run( EXPORTING p_howtorun = mv_run_mode EXCEPTIONS invalid_check_version = 1 OTHERS = 2 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |Code inspector run failed. Subrc = { sy-subrc }| ). ENDIF. io_inspection->plain_list( IMPORTING p_list = rt_list ). SORT rt_list BY objtype objname test code sobjtype sobjname line col. DELETE ADJACENT DUPLICATES FROM rt_list. ENDMETHOD. METHOD skip_object. DATA ls_program_type TYPE subc. CASE is_obj-objtype. WHEN 'PROG'. SELECT SINGLE subc INTO ls_program_type FROM trdir WHERE name = is_obj-objname. rv_skip = boolc( ls_program_type = 'I' ). " Include program. WHEN OTHERS. rv_skip = abap_false. ENDCASE. ENDMETHOD. METHOD validate_check_variant. cl_ci_checkvariant=>get_ref( EXPORTING p_user = '' p_name = iv_check_variant_name EXCEPTIONS chkv_not_exists = 1 missing_parameter = 2 OTHERS = 3 ). IF sy-subrc <> 0. zcx_abapgit_exception=>raise( |No valid check variant { iv_check_variant_name }| ). ENDIF. ENDMETHOD. METHOD zif_abapgit_code_inspector~is_successful. rv_success = mv_success. ENDMETHOD. METHOD zif_abapgit_code_inspector~run. DATA: lo_set TYPE REF TO cl_ci_objectset, lo_variant TYPE REF TO cl_ci_checkvariant, lx_error TYPE REF TO zcx_abapgit_exception. TRY. lo_set = create_objectset( ). IF lines( lo_set->iobjlst-objects ) = 0. " no objects, nothing to check RETURN. ENDIF. lo_variant = create_variant( iv_variant ). mo_inspection = create_inspection( io_set = lo_set io_variant = lo_variant ). rt_list = run_inspection( mo_inspection ). cleanup( lo_set ). IF iv_save = abap_true. READ TABLE rt_list TRANSPORTING NO FIELDS WITH KEY kind = 'E'. mv_success = boolc( sy-subrc <> 0 ). ENDIF. CATCH zcx_abapgit_exception INTO lx_error. " ensure cleanup cleanup( lo_set ). zcx_abapgit_exception=>raise_with_text( lx_error ). ENDTRY. ENDMETHOD. ENDCLASS.
24.816712
93
0.619311
da3b86ca8507dc473b5c52cbd2deb8d18b2389e1
5,811
abap
ABAP
lbn-gtt-template-tso/abap/zsrc/zgtt_sof.fugr.zgtt_sof_ee_shp_load_end.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
12
2020-09-25T07:54:40.000Z
2021-09-27T12:29:34.000Z
lbn-gtt-template-tso/abap/zsrc/zgtt_sof.fugr.zgtt_sof_ee_shp_load_end.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
2
2020-10-15T05:20:41.000Z
2022-02-14T09:28:02.000Z
lbn-gtt-template-tso/abap/zsrc/zgtt_sof.fugr.zgtt_sof_ee_shp_load_end.abap
C5310110/logistics-business-network-gtt-samples
dddcbb5e50f67af627588448c0349cd5f92a1360
[ "Apache-2.0" ]
50
2020-09-29T03:06:01.000Z
2022-03-28T16:04:45.000Z
FUNCTION ZGTT_SOF_EE_SHP_LOAD_END . *"---------------------------------------------------------------------- *"*"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, lv_cnt TYPE /saptrx/evtcnt, lv_evtcnt TYPE /saptrx/evtcnt, * BAPI structure for Event Handler control parameters ls_parameters type /SAPTRX/BAPI_EVM_PARAMETERS. FIELD-SYMBOLS: * Shipment Header <ls_xvttk> TYPE vttkvb. * <1> Fill general data for all control data records * Login Language ls_trackingheader-language = sy-langu. * * <2> 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>. * * Load start Code Set ls_trackingheader-trxcod = 'SHIPMENT_ORDER'. * Shipment order Id ls_trackingheader-trxid = <ls_xvttk>-tknum. * < Load End > * 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 = 'LOAD_END'. * Event Date ls_trackingheader-evtdat = <ls_xvttk>-dalen. * Event Time ls_trackingheader-evttim = <ls_xvttk>-ualen. * 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. * Actual Technical Datetime & Time zone CLEAR ls_parameters. ls_parameters-evtcnt = lv_cnt. ls_parameters-param_name = gc_cp_yn_acttec_timezone."ACTUAL_TECHNICAL_TIMEZONE ls_parameters-param_value = ls_trackingheader-evtzon. APPEND ls_parameters TO ct_trackparameters. CLEAR ls_parameters. ls_parameters-evtcnt = lv_cnt. ls_parameters-param_name = gc_cp_yn_acttec_datetime."ACTUAL_TECHNICAL_DATETIME CONCATENATE '0' sy-datum sy-uzeit INTO ls_parameters-param_value. APPEND ls_parameters TO ct_trackparameters. ENDLOOP. ENDFUNCTION.
36.778481
82
0.675271
da3bdaf9de362a0a0e9ea98deea539a4a4e3f156
12,397
abap
ABAP
src/objects/zcl_abapgit_object_ddls.clas.abap
davidvela/abapGit
a4c25cf545e267e4bc7319c85372590bfca53d5c
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_ddls.clas.abap
davidvela/abapGit
a4c25cf545e267e4bc7319c85372590bfca53d5c
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_ddls.clas.abap
davidvela/abapGit
a4c25cf545e267e4bc7319c85372590bfca53d5c
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_ddls 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. METHODS open_adt_stob IMPORTING iv_ddls_name TYPE tadir-obj_name RAISING zcx_abapgit_exception. PRIVATE SECTION. METHODS is_baseinfo_supported RETURNING VALUE(rv_supported) TYPE abap_bool . METHODS read_baseinfo RETURNING VALUE(rv_baseinfo_string) TYPE string. ENDCLASS. CLASS ZCL_ABAPGIT_OBJECT_DDLS IMPLEMENTATION. METHOD is_baseinfo_supported. DATA: lr_data_baseinfo TYPE REF TO data, lx_error TYPE REF TO cx_root. TRY. CREATE DATA lr_data_baseinfo TYPE ('IF_DD_DDL_TYPES=>TY_S_BASEINFO_STRING_SAVE'). rv_supported = abap_true. CATCH cx_root INTO lx_error. rv_supported = abap_false. ENDTRY. ENDMETHOD. METHOD open_adt_stob. DATA: lr_data TYPE REF TO data, lo_ddl TYPE REF TO object, lx_error TYPE REF TO cx_root. FIELD-SYMBOLS: <lt_ddnames> TYPE STANDARD TABLE. FIELD-SYMBOLS: <lt_entity_view> TYPE STANDARD TABLE. FIELD-SYMBOLS: <lg_ddnames> TYPE any. FIELD-SYMBOLS: <lg_entity_view> TYPE any. FIELD-SYMBOLS: <lg_ddname> TYPE any. FIELD-SYMBOLS: <lg_ddlname> TYPE any. TRY. CREATE DATA lr_data TYPE ('IF_DD_DDL_TYPES=>TY_T_DDOBJ'). ASSIGN lr_data->* TO <lt_ddnames>. CREATE DATA lr_data LIKE LINE OF <lt_ddnames>. ASSIGN lr_data->* TO <lg_ddnames>. CREATE DATA lr_data TYPE ('IF_DD_DDL_TYPES=>TY_T_ENTITY_OF_VIEW'). ASSIGN lr_data->* TO <lt_entity_view>. CREATE DATA lr_data LIKE LINE OF <lt_entity_view>. ASSIGN lr_data->* TO <lg_entity_view>. CLEAR <lt_ddnames>. ASSIGN COMPONENT 'NAME' OF STRUCTURE <lg_ddnames> TO <lg_ddname>. <lg_ddname> = iv_ddls_name. INSERT <lg_ddnames> INTO TABLE <lt_ddnames>. CALL METHOD ('CL_DD_DDL_HANDLER_FACTORY')=>('CREATE') RECEIVING handler = lo_ddl. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~GET_VIEWNAME_FROM_ENTITYNAME') EXPORTING ddnames = <lt_ddnames> IMPORTING view_of_entity = <lt_entity_view>. READ TABLE <lt_entity_view> ASSIGNING <lg_entity_view> INDEX 1. IF sy-subrc = 0. ASSIGN COMPONENT 'DDLNAME' OF STRUCTURE <lg_entity_view> TO <lg_ddlname>. jump_adt( iv_obj_name = <lg_ddlname> iv_obj_type = 'DDLS' ). ENDIF. 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~changed_by. DATA: lo_ddl TYPE REF TO object, lr_data TYPE REF TO data, lx_error TYPE REF TO cx_root. FIELD-SYMBOLS: <lg_data> TYPE any, <lg_field> TYPE any. CREATE DATA lr_data TYPE ('DDDDLSRCV'). ASSIGN lr_data->* TO <lg_data>. CALL METHOD ('CL_DD_DDL_HANDLER_FACTORY')=>('CREATE') RECEIVING handler = lo_ddl. TRY. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~READ') EXPORTING name = ms_item-obj_name get_state = 'A' IMPORTING ddddlsrcv_wa = <lg_data>. ASSIGN COMPONENT 'AS4USER' OF STRUCTURE <lg_data> TO <lg_field>. IF sy-subrc = 0. rv_user = <lg_field>. ENDIF. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. IF rv_user IS INITIAL. rv_user = c_user_unknown. ENDIF. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lo_ddl TYPE REF TO object, lx_error TYPE REF TO cx_root. CALL METHOD ('CL_DD_DDL_HANDLER_FACTORY')=>('CREATE') RECEIVING handler = lo_ddl. TRY. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~DELETE') EXPORTING name = ms_item-obj_name. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = |DDLS, { ms_item-obj_name } { lx_error->get_text( ) }| ix_previous = lx_error ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~deserialize. DATA: lo_ddl TYPE REF TO object, lr_data TYPE REF TO data, lr_data_baseinfo TYPE REF TO data, lx_error TYPE REF TO cx_root. FIELD-SYMBOLS: <lg_data> TYPE any, <lg_data_baseinfo> TYPE any, <lg_source> TYPE any, <lg_baseinfo_string> TYPE any, <lg_baseinfo_ddlname> TYPE any. TRY. CREATE DATA lr_data TYPE ('DDDDLSRCV'). ASSIGN lr_data->* TO <lg_data>. io_xml->read( EXPORTING iv_name = 'DDLS' CHANGING cg_data = <lg_data> ). ASSIGN COMPONENT 'SOURCE' OF STRUCTURE <lg_data> TO <lg_source>. ASSERT sy-subrc = 0. <lg_source> = mo_files->read_string( 'asddls' ). CALL METHOD ('CL_DD_DDL_HANDLER_FACTORY')=>('CREATE') RECEIVING handler = lo_ddl. IF is_baseinfo_supported( ) = abap_true. CREATE DATA lr_data_baseinfo TYPE ('IF_DD_DDL_TYPES=>TY_S_BASEINFO_STRING_SAVE'). ASSIGN lr_data_baseinfo->* TO <lg_data_baseinfo>. ASSIGN COMPONENT 'BASEINFO_STRING' OF STRUCTURE <lg_data_baseinfo> TO <lg_baseinfo_string>. ASSERT sy-subrc = 0. <lg_baseinfo_string> = read_baseinfo( ). ASSIGN COMPONENT 'DDLNAME' OF STRUCTURE <lg_data_baseinfo> TO <lg_baseinfo_ddlname>. ASSERT sy-subrc = 0. <lg_baseinfo_ddlname> = ms_item-obj_name. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~SAVE') EXPORTING name = ms_item-obj_name put_state = 'N' ddddlsrcv_wa = <lg_data> baseinfo_string = <lg_data_baseinfo>. ELSE. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~SAVE') EXPORTING name = ms_item-obj_name put_state = 'N' ddddlsrcv_wa = <lg_data>. ENDIF. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~WRITE_TADIR') EXPORTING objectname = ms_item-obj_name devclass = iv_package prid = 0. corr_insert( iv_package ). CATCH cx_root INTO lx_error. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~DELETE') EXPORTING name = ms_item-obj_name prid = 0. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. zcl_abapgit_objects_activation=>add_item( ms_item ). ENDMETHOD. METHOD zif_abapgit_object~exists. DATA: lv_state TYPE objstate, lo_ddl TYPE REF TO object. CALL METHOD ('CL_DD_DDL_HANDLER_FACTORY')=>('CREATE') RECEIVING handler = lo_ddl. TRY. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~READ') EXPORTING name = ms_item-obj_name get_state = 'A' IMPORTING got_state = lv_state. rv_bool = boolc( NOT ( lv_state IS INITIAL ) ). CATCH cx_root. rv_bool = abap_false. ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~get_comparator. RETURN. ENDMETHOD. METHOD zif_abapgit_object~get_deserialize_steps. APPEND zif_abapgit_object=>gc_step_id-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 = 'ESDICT' iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. DATA: lv_typename TYPE typename. DATA: lv_ddtypekind TYPE ddtypekind. lv_typename = ms_item-obj_name. CALL FUNCTION 'DDIF_TYPEINFO_GET' EXPORTING typename = lv_typename IMPORTING typekind = lv_ddtypekind. CASE lv_ddtypekind. WHEN 'STOB'. me->open_adt_stob( ms_item-obj_name ). WHEN OTHERS. zcx_abapgit_exception=>raise( 'DDLS Jump Error' ). ENDCASE. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lo_ddl TYPE REF TO object, lr_data TYPE REF TO data, lr_data_baseinfo TYPE REF TO data, lt_clr_comps TYPE STANDARD TABLE OF fieldname WITH DEFAULT KEY, lx_error TYPE REF TO cx_root. FIELD-SYMBOLS: <lg_data> TYPE any, <lg_field> TYPE any, <lv_comp> LIKE LINE OF lt_clr_comps, <lt_data_baseinfo> TYPE ANY TABLE, <lg_data_baseinfo> TYPE any, <lg_ddlname> TYPE any, <lg_as4local> TYPE any. TRY. CREATE DATA lr_data TYPE ('DDDDLSRCV'). ASSIGN lr_data->* TO <lg_data>. CALL METHOD ('CL_DD_DDL_HANDLER_FACTORY')=>('CREATE') RECEIVING handler = lo_ddl. IF is_baseinfo_supported( ) = abap_true. CREATE DATA lr_data_baseinfo TYPE ('IF_DD_DDL_TYPES=>TY_T_BASEINFO_STRING'). ASSIGN lr_data_baseinfo->* TO <lt_data_baseinfo>. ASSIGN lr_data_baseinfo->* TO <lg_data_baseinfo>. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~READ') EXPORTING name = ms_item-obj_name get_state = 'A' IMPORTING ddddlsrcv_wa = <lg_data> baseinfo_string = <lt_data_baseinfo>. LOOP AT <lt_data_baseinfo> ASSIGNING <lg_data_baseinfo>. ASSIGN COMPONENT 'DDLNAME' OF STRUCTURE <lg_data_baseinfo> TO <lg_ddlname>. ASSERT sy-subrc = 0. ASSIGN COMPONENT 'AS4LOCAL' OF STRUCTURE <lg_data_baseinfo> TO <lg_as4local>. ASSERT sy-subrc = 0. IF <lg_ddlname> = ms_item-obj_name AND <lg_as4local> = 'A'. ASSIGN COMPONENT 'BASEINFO_STRING' OF STRUCTURE <lg_data_baseinfo> TO <lg_field>. ASSERT sy-subrc = 0. mo_files->add_string( iv_ext = 'baseinfo' iv_string = <lg_field> ). EXIT. ENDIF. ENDLOOP. ELSE. CALL METHOD lo_ddl->('IF_DD_DDL_HANDLER~READ') EXPORTING name = ms_item-obj_name get_state = 'A' IMPORTING ddddlsrcv_wa = <lg_data>. ENDIF. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. APPEND 'AS4USER' TO lt_clr_comps. APPEND 'AS4DATE' TO lt_clr_comps. APPEND 'AS4TIME' TO lt_clr_comps. APPEND 'ACTFLAG' TO lt_clr_comps. APPEND 'CHGFLAG' TO lt_clr_comps. APPEND 'ABAP_LANGUAGE_VERSION' TO lt_clr_comps. LOOP AT lt_clr_comps ASSIGNING <lv_comp>. ASSIGN COMPONENT <lv_comp> OF STRUCTURE <lg_data> TO <lg_field>. IF sy-subrc = 0. CLEAR <lg_field>. ENDIF. ENDLOOP. ASSIGN COMPONENT 'SOURCE' OF STRUCTURE <lg_data> TO <lg_field>. ASSERT sy-subrc = 0. mo_files->add_string( iv_ext = 'asddls' iv_string = <lg_field> ). CLEAR <lg_field>. io_xml->add( iv_name = 'DDLS' ig_data = <lg_data> ). ENDMETHOD. METHOD read_baseinfo. TRY. rv_baseinfo_string = mo_files->read_string( 'baseinfo' ). CATCH zcx_abapgit_exception. " File not found. That's ok, as the object could have been created in a " system where baseinfo wasn't supported. RETURN. ENDTRY. ENDMETHOD. ENDCLASS.
28.564516
106
0.599258
da40e91790b634f50596e96d70629ca7cd3a0043
3,120
abap
ABAP
abap/src/app_pretty_printer_rules/app_pretty_printer_rules_abap/zcl_app_rule_abap_dummy.clas.abap
fmabap/AMDP_Pretty_Printer
0afc70d932770baf310b157ebf6a9026a02a51a0
[ "MIT" ]
5
2022-03-21T09:39:43.000Z
2022-03-22T09:05:08.000Z
abap/src/app_pretty_printer_rules/app_pretty_printer_rules_abap/zcl_app_rule_abap_dummy.clas.abap
fmabap/AMDP_Pretty_Printer
0afc70d932770baf310b157ebf6a9026a02a51a0
[ "MIT" ]
1
2022-03-20T14:19:02.000Z
2022-03-21T12:08:16.000Z
abap/src/app_pretty_printer_rules/app_pretty_printer_rules_abap/zcl_app_rule_abap_dummy.clas.abap
fmabap/AMDP_Pretty_Printer
0afc70d932770baf310b157ebf6a9026a02a51a0
[ "MIT" ]
null
null
null
CLASS zcl_app_rule_abap_dummy DEFINITION PUBLIC INHERITING FROM zcl_app_base_rule FINAL CREATE PUBLIC . PUBLIC SECTION. METHODS zif_app_rule~get_cur_offset_start REDEFINITION. METHODS zif_app_rule~get_cur_row REDEFINITION. METHODS zif_app_rule~get_text REDEFINITION. METHODS zif_app_rule~init REDEFINITION. METHODS zif_app_rule~finalize_init REDEFINITION. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_app_rule_abap_dummy IMPLEMENTATION. METHOD zif_app_rule~get_cur_offset_start. rv_result = mr_token_ext->col. ENDMETHOD. METHOD zif_app_rule~get_cur_row. DATA lr_token_ext_prev TYPE REF TO zapp_s_stokesx_ext. IF mr_prev_rule IS INITIAL. rv_result = mr_token_ext->row. RETURN. ENDIF. lr_token_ext_prev = mr_prev_rule->get_token_ext( ). IF zcl_app_utilities=>is_abap_token( lr_token_ext_prev->sqlscript ) = abap_true. rv_result = mr_prev_rule->get_end_row( ). ELSE. IF mr_prev_rule->has_multline_delimiter( ) = abap_true. rv_result = mr_prev_rule->get_end_row( ). ELSE. rv_result = mr_prev_rule->get_end_row( ) + 1. ENDIF. ENDIF. ENDMETHOD. METHOD zif_app_rule~get_text. DATA lr_delimiter TYPE REF TO string. DATA lr_result TYPE REF TO string. IF mr_token_ext->delimiter_org IS INITIAL. INSERT mr_token_ext->str_org INTO TABLE rt_result. RETURN. ENDIF. LOOP AT mr_token_ext->delimiter_org REFERENCE INTO lr_delimiter. INSERT INITIAL LINE INTO TABLE rt_result REFERENCE INTO lr_result. IF sy-tabix = 1. CONCATENATE mr_token_ext->str_org lr_delimiter->* INTO lr_result->*. ELSE. lr_result->* = lr_delimiter->*. ENDIF. ENDLOOP. ENDMETHOD. METHOD zif_app_rule~init. IF zcl_app_utilities=>is_abap_token( ir_token_ext->sqlscript ) = abap_false. RAISE EXCEPTION TYPE zcx_app_exception MESSAGE ID 'ZAPP_MC_PRETTY_PRINT' TYPE 'E' NUMBER '009' WITH ir_rule_data->rule_name. ENDIF. super->zif_app_rule~init( EXPORTING ir_token_ext = ir_token_ext ir_t_source = ir_t_source ir_t_statement = ir_t_statement ir_t_structure = ir_t_structure ir_rule_data = ir_rule_data ir_context_rule = ir_context_rule ir_hl_context_rule = ir_hl_context_rule ir_prev_rule = ir_prev_rule ir_settings = ir_settings ). ENDMETHOD. METHOD zif_app_rule~finalize_init. DATA lr_delimiter TYPE REF TO string. IF mr_token_ext->sqlscript = zcl_app_scanner_sqlscript=>cos_sqlscript-end_of_pending AND lines( mr_token_ext->delimiter_org ) > 1. READ TABLE mr_token_ext->delimiter_org REFERENCE INTO lr_delimiter INDEX ( lines( mr_token_ext->delimiter_org ) ). IF sy-subrc = 0. IF lr_delimiter->* IS INITIAL OR lr_delimiter->* CO ` `. CLEAR lr_delimiter->*. ELSE. INSERT INITIAL LINE INTO TABLE mr_token_ext->delimiter_org. ENDIF. ENDIF. ENDIF. ENDMETHOD. ENDCLASS.
28.888889
88
0.694551
da40eed002ba5a8ef9ac94cd9c6064297545228f
1,271
abap
ABAP
src/ytaddict_class.fugr.saplytaddict_class.abap
keremkoseoglu/addict
f33dc426aee267eb70c02ce8f4c3030ca99500e4
[ "Apache-2.0" ]
8
2020-10-30T13:19:02.000Z
2022-01-04T19:28:37.000Z
src/ytaddict_class.fugr.saplytaddict_class.abap
aufaraditya/addict
4f2e19ea1d2ffbf228bfd5cc0231cd17b792b372
[ "Apache-2.0" ]
22
2020-10-19T13:35:53.000Z
2022-02-10T12:55:54.000Z
src/ytaddict_class.fugr.saplytaddict_class.abap
aufaraditya/addict
4f2e19ea1d2ffbf228bfd5cc0231cd17b792b372
[ "Apache-2.0" ]
6
2020-11-03T21:39:50.000Z
2022-03-10T02:21:41.000Z
* regenerated at 06.12.2020 12:24:20 ******************************************************************* * System-defined Include-files. * ******************************************************************* INCLUDE LYTADDICT_CLASSTOP. " Global Declarations INCLUDE LYTADDICT_CLASSUXX. " Function Modules ******************************************************************* * User-defined Include-files (if necessary). * ******************************************************************* * INCLUDE LYTADDICT_CLASSF... " Subroutines * INCLUDE LYTADDICT_CLASSO... " PBO-Modules * INCLUDE LYTADDICT_CLASSI... " PAI-Modules * INCLUDE LYTADDICT_CLASSE... " Events * INCLUDE LYTADDICT_CLASSP... " Local class implement. * INCLUDE LYTADDICT_CLASST99. " ABAP Unit tests INCLUDE LYTADDICT_CLASSF00 . " subprograms INCLUDE LYTADDICT_CLASSI00 . " PAI modules INCLUDE LSVIMFXX . " subprograms INCLUDE LSVIMOXX . " PBO modules INCLUDE LSVIMIXX . " PAI modules
57.772727
69
0.413061
da413dbf8cadea13a3985006b03536ed2f1e9855
9,473
abap
ABAP
src/checks/y_check_deprecated_classes.clas.testclasses.abap
jrodriguez-rc/code-pal-for-abap
3f6ed019f33941a226575b7239c60596c8305b45
[ "Apache-2.0" ]
2
2020-06-23T13:27:21.000Z
2020-11-03T12:19:18.000Z
src/checks/y_check_deprecated_classes.clas.testclasses.abap
jrodriguez-rc/code-pal-for-abap
3f6ed019f33941a226575b7239c60596c8305b45
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_deprecated_classes.clas.testclasses.abap
jrodriguez-rc/code-pal-for-abap
3f6ed019f33941a226575b7239c60596c8305b45
[ "Apache-2.0" ]
null
null
null
CLASS ltc_data DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_data IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_deprecated_classes( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' DATA aunit TYPE REF TO cl_aunit_assert.' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' DATA aunit TYPE REF TO cl_abap_unit_assert.' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' DATA aunit TYPE REF TO cl_aunit_assert. "#EC DEPRECATED_CLAS' ) ). ENDMETHOD. ENDCLASS. CLASS ltc_field_symbol DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_field_symbol IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_deprecated_classes( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' FIELD-SYMBOLS <aunit> TYPE REF TO cl_aunit_assert.' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' FIELD-SYMBOLS <aunit> TYPE REF TO cl_abap_unit_assert.' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' FIELD-SYMBOLS <aunit> TYPE REF TO cl_aunit_assert. "#EC DEPRECATED_CLAS' ) ). ENDMETHOD. ENDCLASS. CLASS ltc_types DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_types IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_deprecated_classes( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' TYPES: BEGIN OF type,' ) ( ' aunit TYPE REF TO cl_aunit_assert,' ) ( ' END OF type.' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' TYPES: BEGIN OF type,' ) ( ' aunit TYPE REF TO cl_abap_unit_assert,' ) ( ' END OF type.' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' TYPES: BEGIN OF type,' ) ( ' aunit TYPE REF TO cl_aunit_assert, "#EC DEPRECATED_CLAS' ) ( ' END OF type.' ) ). ENDMETHOD. ENDCLASS. CLASS ltc_static_attribute DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_static_attribute IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_deprecated_classes( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT test.' ) ( ' INTERFACE example. ') ( ' CLASS-DATA aunit TYPE REF TO cl_aunit_assert.' ) ( ' ENDINTERFACE.') ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' INTERFACE example. ') ( ' CLASS-DATA aunit TYPE REF TO cl_abap_unit_assert.' ) ( ' ENDINTERFACE.') ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT test.' ) ( ' INTERFACE example. ') ( ' CLASS-DATA aunit TYPE REF TO cl_aunit_assert. "#EC DEPRECATED_CLAS' ) ( ' ENDINTERFACE.') ). ENDMETHOD. ENDCLASS. CLASS ltc_instance_attribute DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_instance_attribute IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_deprecated_classes( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT test.' ) ( ' CLASS example DEFINITION. ') ( ' PROTECTED SECTION. ') ( ' DATA aunit TYPE REF TO cl_aunit_assert.' ) ( ' ENDCLASS.') ( ' CLASS example IMPLEMENTATION. ') ( ' ENDCLASS.') ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' CLASS example DEFINITION. ') ( ' PROTECTED SECTION. ') ( ' DATA aunit TYPE REF TO cl_abap_unit_assert.' ) ( ' ENDCLASS.') ( ' CLASS example IMPLEMENTATION. ') ( ' ENDCLASS.') ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT test.' ) ( ' CLASS example DEFINITION. ') ( ' PROTECTED SECTION. ') ( ' DATA aunit TYPE REF TO cl_aunit_assert. "#EC DEPRECATED_CLAS' ) ( ' ENDCLASS.') ( ' CLASS example IMPLEMENTATION. ') ( ' ENDCLASS.') ). ENDMETHOD. ENDCLASS. CLASS ltc_parameter DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_parameter IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_deprecated_classes( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT test.' ) ( ' CLASS example DEFINITION. ') ( ' PROTECTED SECTION. ') ( ' METHODS example IMPORTING aunit TYPE REF TO cl_aunit_assert.' ) ( ' ENDCLASS.') ( ' CLASS example IMPLEMENTATION. ') ( ' METHOD example.') ( ' ENDMETHOD.') ( ' ENDCLASS.') ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' CLASS example DEFINITION. ') ( ' PROTECTED SECTION. ') ( ' METHODS example IMPORTING aunit TYPE REF TO cl_abap_unit_assert.' ) ( ' ENDCLASS.') ( ' CLASS example IMPLEMENTATION. ') ( ' METHOD example.') ( ' ENDMETHOD.') ( ' ENDCLASS.') ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT test.' ) ( ' CLASS example DEFINITION. ') ( ' PROTECTED SECTION. ') ( ' METHODS example IMPORTING aunit TYPE REF TO cl_aunit_assert. "#EC DEPRECATED_CLAS' ) ( ' ENDCLASS.') ( ' CLASS example IMPLEMENTATION. ') ( ' METHOD example.') ( ' ENDMETHOD.') ( ' ENDCLASS.') ). ENDMETHOD. ENDCLASS. CLASS ltc_variable DEFINITION INHERITING FROM ltc_data FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_code_without_issue REDEFINITION. ENDCLASS. CLASS ltc_variable IMPLEMENTATION. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' DATA cl_aunit_assert TYPE REF TO cl_abap_unit_assert.' ) ). ENDMETHOD. ENDCLASS. CLASS ltc_multiple_times DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_expected_count REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS ltc_multiple_times IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_deprecated_classes( ). ENDMETHOD. METHOD get_expected_count. result = 2. ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' DATA aunit TYPE REF TO cl_aunit_assert.' ) ( ' DATA const TYPE REF TO if_aunit_constants.' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' DATA aunit TYPE REF TO cl_abap_unit_assert.' ) ( ' DATA const TYPE REF TO if_abap_unit_constant.' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( ' REPORT test.' ) ( ' START-OF-SELECTION. ' ) ( ' DATA aunit TYPE REF TO cl_aunit_assert. "#EC DEPRECATED_CLAS' ) ( ' DATA const TYPE REF TO if_aunit_constants. "#EC DEPRECATED_CLAS' ) ). ENDMETHOD. ENDCLASS.
25.811989
120
0.647736
da44127a25d5d6355efb0b357c8c8f6a0c415642
7,440
abap
ABAP
src/objects/zcl_abapgit_object_ddlx.clas.abap
JohannesKonings/abapGit
8b1cbd4b89bb43eb987e28766145e764762aa12d
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_ddlx.clas.abap
JohannesKonings/abapGit
8b1cbd4b89bb43eb987e28766145e764762aa12d
[ "MIT" ]
null
null
null
src/objects/zcl_abapgit_object_ddlx.clas.abap
JohannesKonings/abapGit
8b1cbd4b89bb43eb987e28766145e764762aa12d
[ "MIT" ]
null
null
null
CLASS zcl_abapgit_object_ddlx DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL. PUBLIC SECTION. INTERFACES zif_abapgit_object. ALIASES mo_files FOR zif_abapgit_object~mo_files. DATA: mo_persistence TYPE REF TO if_wb_object_persist. PRIVATE SECTION. METHODS: get_persistence RETURNING VALUE(ri_persistence) TYPE REF TO if_wb_object_persist RAISING zcx_abapgit_exception, clear_fields CHANGING cs_data TYPE any, clear_field IMPORTING iv_fieldname TYPE csequence CHANGING cs_metadata TYPE any. ENDCLASS. CLASS zcl_abapgit_object_ddlx IMPLEMENTATION. METHOD clear_field. FIELD-SYMBOLS: <lg_field> TYPE data. ASSIGN COMPONENT iv_fieldname OF STRUCTURE cs_metadata TO <lg_field>. ASSERT sy-subrc = 0. CLEAR: <lg_field>. ENDMETHOD. METHOD clear_fields. FIELD-SYMBOLS: <lg_metadata> TYPE any. ASSIGN COMPONENT 'METADATA' OF STRUCTURE cs_data TO <lg_metadata>. ASSERT sy-subrc = 0. clear_field( EXPORTING iv_fieldname = 'CHANGED_AT' CHANGING cs_metadata = <lg_metadata> ). clear_field( EXPORTING iv_fieldname = 'CHANGED_BY' CHANGING cs_metadata = <lg_metadata> ). clear_field( EXPORTING iv_fieldname = 'CREATED_AT' CHANGING cs_metadata = <lg_metadata> ). clear_field( EXPORTING iv_fieldname = 'CREATED_BY' CHANGING cs_metadata = <lg_metadata> ). clear_field( EXPORTING iv_fieldname = 'RESPONSIBLE' CHANGING cs_metadata = <lg_metadata> ). clear_field( EXPORTING iv_fieldname = 'PACKAGE_REF-NAME' CHANGING cs_metadata = <lg_metadata> ). clear_field( EXPORTING iv_fieldname = 'CONTAINER_REF-PACKAGE_NAME' CHANGING cs_metadata = <lg_metadata> ). ENDMETHOD. METHOD get_persistence. DATA: lx_error TYPE REF TO cx_root. TRY. IF mo_persistence IS NOT BOUND. CREATE OBJECT mo_persistence TYPE ('CL_DDLX_ADT_OBJECT_PERSIST'). ENDIF. CATCH cx_root INTO lx_error. zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( ) ix_previous = lx_error ). ENDTRY. ri_persistence = mo_persistence. ENDMETHOD. METHOD zif_abapgit_object~changed_by. rv_user = c_user_unknown. ENDMETHOD. METHOD zif_abapgit_object~compare_to_remote_version. CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null. ENDMETHOD. METHOD zif_abapgit_object~delete. DATA: lv_object_key TYPE seu_objkey, li_data_model TYPE REF TO if_wb_object_data_model, lx_error TYPE REF TO cx_root. lv_object_key = ms_item-obj_name. TRY. CREATE OBJECT li_data_model TYPE ('CL_DDLX_WB_OBJECT_DATA'). get_persistence( )->delete( p_object_key = lv_object_key p_version = swbm_version_active ). 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_data_model TYPE REF TO if_wb_object_data_model, lr_data TYPE REF TO data, lx_error TYPE REF TO cx_root. FIELD-SYMBOLS: <lg_data> TYPE any, <lg_field> TYPE data. TRY. CREATE DATA lr_data TYPE ('CL_DDLX_WB_OBJECT_DATA=>TY_OBJECT_DATA'). ASSIGN lr_data->* TO <lg_data>. io_xml->read( EXPORTING iv_name = 'DDLX' CHANGING cg_data = <lg_data> ). ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <lg_data> TO <lg_field>. ASSERT sy-subrc = 0. TRY. " If the file doesn't exist that's ok, because previously " the source code was stored in the xml. We are downward compatible. <lg_field> = mo_files->read_string( 'asddlxs' ) ##no_text. CATCH zcx_abapgit_exception. ENDTRY. CREATE OBJECT li_data_model TYPE ('CL_DDLX_WB_OBJECT_DATA'). li_data_model->set_data( <lg_data> ). get_persistence( )->save( li_data_model ). 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. DATA: lv_object_key TYPE seu_objkey. lv_object_key = ms_item-obj_name. rv_bool = abap_true. TRY. get_persistence( )->get( p_object_key = lv_object_key p_version = swbm_version_active p_existence_check_only = abap_true ). CATCH cx_swb_exception. rv_bool = abap_false. ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~get_metadata. rs_metadata = get_metadata( ). rs_metadata-ddic = abap_true. ENDMETHOD. METHOD zif_abapgit_object~has_changed_since. rv_changed = abap_true. ENDMETHOD. METHOD zif_abapgit_object~is_locked. rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESDICT' iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ). ENDMETHOD. METHOD zif_abapgit_object~jump. TRY. jump_adt( i_obj_name = ms_item-obj_name i_obj_type = ms_item-obj_type ). CATCH zcx_abapgit_exception. zcx_abapgit_exception=>raise( 'DDLX Jump Error' ). ENDTRY. ENDMETHOD. METHOD zif_abapgit_object~serialize. DATA: lv_object_key TYPE seu_objkey, li_data_model TYPE REF TO if_wb_object_data_model, li_persistence TYPE REF TO if_wb_object_persist, lr_data TYPE REF TO data, lx_error TYPE REF TO cx_root. FIELD-SYMBOLS: <lg_data> TYPE any, <lg_field> TYPE data. lv_object_key = ms_item-obj_name. TRY. CREATE DATA lr_data TYPE ('CL_DDLX_WB_OBJECT_DATA=>TY_OBJECT_DATA'). ASSIGN lr_data->* TO <lg_data>. CREATE OBJECT li_data_model TYPE ('CL_DDLX_WB_OBJECT_DATA'). li_persistence = get_persistence( ). li_persistence->get( EXPORTING p_object_key = lv_object_key p_version = swbm_version_active CHANGING p_object_data = li_data_model ). li_data_model->get_data( IMPORTING p_data = <lg_data> ). clear_fields( CHANGING cs_data = <lg_data> ). ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <lg_data> TO <lg_field>. ASSERT sy-subrc = 0. mo_files->add_string( iv_ext = 'asddlxs' iv_string = <lg_field> ). CLEAR <lg_field>. io_xml->add( iv_name = 'DDLX' ig_data = <lg_data> ). 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~is_active. rv_active = is_active( ). ENDMETHOD. ENDCLASS.
25.56701
106
0.617204
da45131e111f531418561d3ac93726a02db9b875
2,349
abap
ABAP
src/checks/y_check_sub_assign_read_table.clas.testclasses.abap
sb-sap/code-pal-for-abap
f8610510ab37d8c03f1552d416541d196bf99e6d
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_sub_assign_read_table.clas.testclasses.abap
sb-sap/code-pal-for-abap
f8610510ab37d8c03f1552d416541d196bf99e6d
[ "Apache-2.0" ]
null
null
null
src/checks/y_check_sub_assign_read_table.clas.testclasses.abap
sb-sap/code-pal-for-abap
f8610510ab37d8c03f1552d416541d196bf99e6d
[ "Apache-2.0" ]
null
null
null
CLASS local_test_class DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT. PROTECTED SECTION. METHODS get_cut REDEFINITION. METHODS get_code_with_issue REDEFINITION. METHODS get_code_without_issue REDEFINITION. METHODS get_code_with_exemption REDEFINITION. ENDCLASS. CLASS local_test_class IMPLEMENTATION. METHOD get_cut. result ?= NEW y_check_sub_assign_read_table( ). ENDMETHOD. METHOD get_code_with_issue. result = VALUE #( ( 'REPORT y_example. ' ) ( ' CLASS y_example_class DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' PROTECTED SECTION. ' ) ( ' METHODS test. ' ) ( ' ENDCLASS. ' ) ( ' CLASS y_example_class IMPLEMENTATION. ' ) ( ' METHOD test. ' ) ( ' DATA clients TYPE TABLE OF t000. ') ( ' READ TABLE clients ASSIGNING FIELD-SYMBOL(<client>) INDEX 1. ' ) ( ' DATA(i) = 1. ' ) ( ' READ TABLE clients ASSIGNING <client> INDEX 2. ' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. METHOD get_code_without_issue. result = VALUE #( ( 'REPORT y_example. ' ) ( ' CLASS y_example_class DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' PROTECTED SECTION. ' ) ( ' METHODS test. ' ) ( ' ENDCLASS. ' ) ( ' CLASS y_example_class IMPLEMENTATION. ' ) ( ' METHOD test. ' ) ( ' DATA clients TYPE TABLE OF t000. ') ( ' READ TABLE clients INTO DATA(client) INDEX 1. ' ) ( ' READ TABLE clients ASSIGNING FIELD-SYMBOL(<client>) INDEX 1. ' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. METHOD get_code_with_exemption. result = VALUE #( ( 'REPORT y_example. ' ) ( ' CLASS y_example_class DEFINITION. ' ) ( ' PUBLIC SECTION. ' ) ( ' PROTECTED SECTION. ' ) ( ' METHODS test. ' ) ( ' ENDCLASS. ' ) ( ' CLASS y_example_class IMPLEMENTATION. ' ) ( ' METHOD test. ' ) ( ' DATA clients TYPE TABLE OF t000. ') ( ' READ TABLE clients ASSIGNING FIELD-SYMBOL(<client>) INDEX 1. ' ) ( ' DATA(i) = 1. ' ) ( ' READ TABLE clients ASSIGNING <client> INDEX 2. "#EC SUB_ASSIGN' ) ( ' ENDMETHOD. ' ) ( ' ENDCLASS. ' ) ). ENDMETHOD. ENDCLASS.
31.32
114
0.568327
da4561beb93041306443a1a2a86f70fc8deaad54
105,228
abap
ABAP
src/legacy/#dmo#cl_flight_data_generat_18.clas.locals_imp.abap
SAP-Cloud-Platform/flight18
8e20ebbb832f8a27465c5a191fd45e773b3efee2
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#cl_flight_data_generat_18.clas.locals_imp.abap
SAP-Cloud-Platform/flight18
8e20ebbb832f8a27465c5a191fd45e773b3efee2
[ "BSD-Source-Code" ]
null
null
null
src/legacy/#dmo#cl_flight_data_generat_18.clas.locals_imp.abap
SAP-Cloud-Platform/flight18
8e20ebbb832f8a27465c5a191fd45e773b3efee2
[ "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/agency18 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/agency18. "#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/agency18 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/airport18 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/airport18. "#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/airport18 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/carrier18 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/carrier18. "#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/carrier18 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_18 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_18. 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_18. "#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_18 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_18 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/flight18 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_id18, seats_max TYPE /dmo/plane_seats_max18, long_distance TYPE abap_bool, index TYPE int1, END OF ty_plane_type, BEGIN OF ty_flight_info, id TYPE /dmo/plane_type_id18, long_distance TYPE abap_bool, seats_max TYPE /dmo/plane_seats_max18, seats_occupied TYPE /dmo/plane_seats_occupied18, price TYPE /dmo/flight_price18, END OF ty_flight_info, BEGIN OF ty_connection_recurrency, id TYPE /dmo/connection_id18, recurrency TYPE STANDARD TABLE OF /dmo/flight_date18 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_id18 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/flight18. "#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/flight18 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/flight18( 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/flight18-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_18=>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_date18( lv_datum + 217 ) ). " flight_date_min is a Monday 5 months in the past flight_date_min = calc_next_monday( CONV /dmo/flight_date18( 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_date18( 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_name18, END OF ty_last_name. TYPES: tt_customer TYPE STANDARD TABLE OF /dmo/customer18 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_name18, gender TYPE c LENGTH 1, END OF ty_first_name, BEGIN OF ty_name, first_name TYPE /dmo/first_name18, last_name TYPE /dmo/last_name18, title TYPE /dmo/title18, END OF ty_name, " Addresses BEGIN OF ty_city, country TYPE land1, postal_code TYPE /dmo/postal_code18, city TYPE /dmo/city18, END OF ty_city, tt_street_per_country TYPE STANDARD TABLE OF /dmo/street18 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_code18, city TYPE /dmo/city18, street TYPE /dmo/street18, phone_number TYPE /dmo/phone_number18, email_address TYPE /dmo/email_address18, 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/customer18. "#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/customer18 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/title18( 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_18 WITH KEY supplement_id, tt_supplement_text TYPE STANDARD TABLE OF /dmo/suppl_te_18 WITH KEY supplement_id. " Merged types TYPES BEGIN OF ty_supplement_complete. INCLUDE TYPE /dmo/suppleme_18. TYPES language_code TYPE spras. TYPES description TYPE /dmo/description18. 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_18. "#EC CI_NOWHERE DELETE FROM /dmo/suppl_te_18. "#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_18 FROM TABLE @( CORRESPONDING tt_supplement( lt_data ) ). INSERT /dmo/suppl_te_18 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_18 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/travel18 WITH KEY travel_id, tt_bookings TYPE STANDARD TABLE OF /dmo/booking18 WITH KEY travel_id booking_id, tt_booking_supplements TYPE STANDARD TABLE OF /dmo/book_sup_18 WITH KEY travel_id booking_id booking_supplement_id. " Build nested tables TYPES BEGIN OF ty_booking_complete. INCLUDE TYPE /dmo/booking18. 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/travel18. 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/booking18-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/flight18 OPTIONAL RETURNING VALUE(rs_flight) TYPE /dmo/flight18, generate_booking_supplements IMPORTING iv_travel_id TYPE /dmo/booking18-travel_id iv_booking_id TYPE /dmo/booking18-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/travel18-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/travel18-booking_fee, generate_travel_customer_id IMPORTING it_bookings TYPE lcl_travel_data_generator=>tt_booking_complete RETURNING VALUE(rv_customer_id) TYPE /dmo/travel18-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/travel18. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Delete Booking Content.' ). ENDIF. DELETE FROM /dmo/booking18. "#EC CI_NOWHERE IF out IS BOUND. out->write( '--> Delete Booking Supplement Content.' ). ENDIF. DELETE FROM /dmo/book_sup_18. "#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/travel18( ls_travel ) TO lt_travels. LOOP AT ls_travel-bookings INTO DATA(ls_booking). APPEND CORRESPONDING /dmo/booking18( 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/travel18 FROM TABLE @lt_travels. IF out IS BOUND. out->write( '--> Insert Booking Content' ). ENDIF. INSERT /dmo/booking18 FROM TABLE @lt_bookings. IF out IS BOUND. out->write( '--> Insert Booking Supplement Content' ). ENDIF. INSERT /dmo/book_sup_18 FROM TABLE @lt_booking_supplements. IF out IS BOUND. out->write( '--> Done.' ). ENDIF. ENDMETHOD. METHOD get_data. DATA: lv_travel_id TYPE /dmo/booking18-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/travel18-total_price( INIT sum = 0 FOR booking IN lt_bookings NEXT sum = sum + booking-flight_price + REDUCE /dmo/flight_price18( 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/travel18-status( go_ran_status_description->get_next( ) WHEN 1 OR 2 THEN /dmo/if_flight_legacy18=>travel_status-new WHEN 3 THEN /dmo/if_flight_legacy18=>travel_status-booked WHEN 4 THEN /dmo/if_flight_legacy18=>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/customer18-customer_id WITH EMPTY KEY. DATA: lv_booking_id TYPE /dmo/booking18-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/booking18-booking_date( <flight>-flight_date - go_ran_booking_date->get_next( ) ). DATA(lv_price) = /dmo/cl_flight_data_generat_18=>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/booking18-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_18-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/customer18 WITH UNIQUE KEY customer_id. rv_description = SWITCH /dmo/travel18-description( go_ran_travel_description->get_next( ) WHEN 1 THEN `Business Trip for ` && REDUCE /dmo/travel18-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/travel18-description( WHEN i < lines( it_bookings ) THEN `, ` ) i = i + 1 ) WHEN 2 THEN `Vacation for ` && REDUCE /dmo/travel18-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/travel18-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/travel18-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
da48beb5ddae738054226dce176755a7dc5e89ec
203,992
abap
ABAP
src/zcl_excel_worksheet.clas.abap
AtomKrieg/abap2xlsx
06e52f3041c1e87ca97b000ac8cb688fac34926c
[ "Apache-2.0" ]
1
2022-01-13T10:54:36.000Z
2022-01-13T10:54:36.000Z
src/zcl_excel_worksheet.clas.abap
AtomKrieg/abap2xlsx
06e52f3041c1e87ca97b000ac8cb688fac34926c
[ "Apache-2.0" ]
null
null
null
src/zcl_excel_worksheet.clas.abap
AtomKrieg/abap2xlsx
06e52f3041c1e87ca97b000ac8cb688fac34926c
[ "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 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 uuid . METHODS get_highest_column RETURNING value(r_highest_column) TYPE zexcel_cell_column RAISING zcx_excel . METHODS get_highest_row RETURNING value(r_highest_row) TYPE int4 RAISING zcx_excel . METHODS get_hyperlinks_iterator RETURNING value(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_hyperlinks_size RETURNING value(ep_size) TYPE i . METHODS get_merge RETURNING value(merge_range) TYPE string_table RAISING zcx_excel . METHODS get_pagebreaks RETURNING value(ro_pagebreaks) TYPE REF TO zcl_excel_worksheet_pagebreaks RAISING zcx_excel . METHODS get_ranges_iterator RETURNING value(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_row IMPORTING !ip_row TYPE int4 RETURNING value(eo_row) TYPE REF TO zcl_excel_row . METHODS get_rows RETURNING value(eo_rows) TYPE REF TO zcl_excel_rows . METHODS get_rows_iterator RETURNING value(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_row_outlines RETURNING value(rt_row_outlines) TYPE mty_ts_outlines_row . METHODS get_style_cond IMPORTING !ip_guid TYPE zexcel_cell_style RETURNING value(eo_style_cond) TYPE REF TO zcl_excel_style_cond . METHODS get_tabcolor RETURNING value(ev_tabcolor) TYPE zexcel_s_tabcolor . METHODS get_tables_iterator RETURNING value(eo_iterator) TYPE REF TO cl_object_collection_iterator . METHODS get_tables_size RETURNING value(ep_size) TYPE i . METHODS get_title IMPORTING !ip_escaped TYPE flag DEFAULT '' RETURNING value(ep_title) TYPE zexcel_sheet_title . METHODS is_cell_merged IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row RETURNING value(rp_is_merged) TYPE abap_bool RAISING zcx_excel . METHODS set_cell IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row !ip_value TYPE simple OPTIONAL !ip_formula TYPE zexcel_cell_formula OPTIONAL !ip_style TYPE zexcel_cell_style OPTIONAL !ip_hyperlink TYPE REF TO zcl_excel_hyperlink OPTIONAL !ip_data_type TYPE zexcel_cell_data_type OPTIONAL !ip_abap_type TYPE abap_typekind OPTIONAL RAISING zcx_excel . METHODS set_cell_formula IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row !ip_formula TYPE zexcel_cell_formula RAISING zcx_excel . METHODS set_cell_style IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row !ip_style TYPE zexcel_cell_style RAISING zcx_excel . METHODS set_column_width IMPORTING !ip_column TYPE simple !ip_width_fix TYPE simple DEFAULT 0 !ip_width_autosize TYPE flag DEFAULT 'X' RAISING zcx_excel . METHODS set_default_excel_date_format IMPORTING !ip_default_excel_date_format TYPE zexcel_number_format RAISING zcx_excel . METHODS set_merge IMPORTING !ip_column_start TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_min_col !ip_column_end TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_max_col !ip_row TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_min_row !ip_row_to TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_max_row !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 xfeld OPTIONAL !ip_no_header TYPE xfeld 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 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 . 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 uuid . DATA hyperlinks TYPE REF TO cl_object_collection . DATA lower_cell TYPE zexcel_s_cell_data . DATA mo_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks . CLASS-DATA mth_font_cache TYPE mty_th_font_cache . DATA mt_merged_cells TYPE mty_ts_merge . DATA mt_row_outlines TYPE mty_ts_outlines_row . DATA print_title_col_from TYPE zexcel_cell_column_alpha . DATA print_title_col_to TYPE zexcel_cell_column_alpha . DATA print_title_row_from TYPE zexcel_cell_row . DATA print_title_row_to TYPE zexcel_cell_row . DATA ranges TYPE REF TO zcl_excel_ranges . DATA rows TYPE REF TO zcl_excel_rows . DATA tables TYPE REF TO cl_object_collection . DATA title TYPE zexcel_sheet_title VALUE 'Worksheet'. "#EC NOTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . " . DATA upper_cell TYPE zexcel_s_cell_data . METHODS calculate_cell_width IMPORTING !ip_column TYPE simple !ip_row TYPE zexcel_cell_row RETURNING value(ep_width) TYPE float RAISING zcx_excel . METHODS generate_title RETURNING value(ep_title) TYPE zexcel_sheet_title . METHODS get_value_type IMPORTING !ip_value TYPE simple EXPORTING !ep_value TYPE simple !ep_value_type TYPE abap_typekind . METHODS print_title_set_range . METHODS update_dimension_range RAISING zcx_excel . ENDCLASS. CLASS ZCL_EXCEL_WORKSHEET IMPLEMENTATION. METHOD add_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. 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 e059(0k) WITH 'FATAL ERROR' RAISING fatal_error. ENDIF. LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line> WHERE tabname = l_tabname. ASSIGN COMPONENT <f_fieldcat_line>-fieldname OF STRUCTURE <f_excel_line> TO <f_fcat_column>. DESCRIBE DISTANCE BETWEEN <f_excel_column> AND <f_fcat_column> INTO l_int IN BYTE MODE. * append column index * this columns index is of table, not fieldcat IF l_int = 0. wa_column_index-fieldname = <f_fieldcat_line>-fieldname. wa_column_index-tabname = <f_fieldcat_line>-tabname. wa_column_index-col = l_save_index. APPEND wa_column_index TO lt_column_index. ENDIF. * append dependent fields (currency and quantity unit) IF <f_fieldcat_line>-cfieldname IS NOT INITIAL. CLEAR wa_fieldcat_depf. wa_fieldcat_depf-fieldname = <f_fieldcat_line>-cfieldname. wa_fieldcat_depf-tabname = <f_fieldcat_line>-ctabname. COLLECT wa_fieldcat_depf INTO lt_fieldcat_depf. ENDIF. IF <f_fieldcat_line>-qfieldname IS NOT INITIAL. CLEAR wa_fieldcat_depf. wa_fieldcat_depf-fieldname = <f_fieldcat_line>-qfieldname. wa_fieldcat_depf-tabname = <f_fieldcat_line>-qtabname. COLLECT wa_fieldcat_depf INTO lt_fieldcat_depf. ENDIF. * rewrite field data type IF <f_fieldcat_line>-inttype = 'X' AND <f_fieldcat_line>-datatype(3) = 'INT'. <f_fieldcat_line>-inttype = 'I'. ENDIF. ENDLOOP. CLEAR: l_save_index. UNASSIGN: <f_fieldcat_line>. ENDDO. * build semantic tables l_n_hrz_keys = 1. * Get keyfigures LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line> WHERE tabname = l_tabname AND tech NE 'X' AND no_out NE 'X'. CLEAR wa_sema. CLEAR wa_hkey. * Units belong to keyfigures -> display as str READ TABLE lt_fieldcat_depf INTO wa_fieldcat_depf WITH KEY fieldname = <f_fieldcat_line>-fieldname tabname = <f_fieldcat_line>-tabname. IF sy-subrc = 0. wa_sema-col_typ = 'STR'. wa_sema-col_ops = 'DFT'. * Keyfigures ELSE. CASE <f_fieldcat_line>-datatype. WHEN 'QUAN'. wa_sema-col_typ = 'N03'. IF <f_fieldcat_line>-no_sum NE 'X'. wa_sema-col_ops = 'ADD'. ELSE. wa_sema-col_ops = 'NOP'. " no dependent field ENDIF. WHEN 'DATS'. wa_sema-col_typ = 'DAT'. wa_sema-col_ops = 'NOP'. WHEN 'CHAR' OR 'UNIT' OR 'CUKY'. " Added fieldformats UNIT and CUKY - dd. 26-10-2012 Wouter Heuvelmans wa_sema-col_typ = 'STR'. wa_sema-col_ops = 'DFT'. " dependent field * incase numeric, ex '00120' -> display as '12' WHEN 'NUMC'. wa_sema-col_typ = 'STR'. wa_sema-col_ops = 'DFT'. WHEN OTHERS. wa_sema-col_typ = 'NUM'. IF <f_fieldcat_line>-no_sum NE 'X'. wa_sema-col_ops = 'ADD'. ELSE. wa_sema-col_ops = 'NOP'. ENDIF. ENDCASE. ENDIF. l_counter = l_counter + 1. l_n_att_cols = l_n_att_cols + 1. wa_sema-col_no = l_counter. READ TABLE lt_column_index INTO wa_column_index WITH KEY fieldname = <f_fieldcat_line>-fieldname tabname = <f_fieldcat_line>-tabname. IF sy-subrc = 0. wa_sema-col_src = wa_column_index-col. ELSE. RAISE fatal_error. ENDIF. * columns index of ref currency field in table IF NOT <f_fieldcat_line>-cfieldname IS INITIAL. READ TABLE lt_column_index INTO wa_column_index WITH KEY fieldname = <f_fieldcat_line>-cfieldname tabname = <f_fieldcat_line>-ctabname. IF sy-subrc = 0. wa_sema-col_cur = wa_column_index-col. ENDIF. * quantities fields * treat as currency when display on excel ELSEIF NOT <f_fieldcat_line>-qfieldname IS INITIAL. READ TABLE lt_column_index INTO wa_column_index WITH KEY fieldname = <f_fieldcat_line>-qfieldname tabname = <f_fieldcat_line>-qtabname. IF sy-subrc = 0. wa_sema-col_cur = wa_column_index-col. ENDIF. ENDIF. * Treat of fixed currency in the fieldcatalog for column DATA: l_num_help(2) TYPE n. IF NOT <f_fieldcat_line>-currency IS INITIAL. SELECT * FROM tcurx INTO TABLE lt_tcurx. SORT lt_tcurx. READ TABLE lt_tcurx INTO wa_tcurx WITH KEY currkey = <f_fieldcat_line>-currency. IF sy-subrc = 0. l_num_help = wa_tcurx-currdec. CONCATENATE 'N' l_num_help INTO wa_sema-col_typ. wa_sema-col_cur = sy-tabix * ( -1 ). ENDIF. ENDIF. wa_hkey-col_no = l_n_att_cols. wa_hkey-row_no = l_n_hrz_keys. wa_hkey-col_name = <f_fieldcat_line>-reptext. APPEND wa_hkey TO lt_hkey. APPEND wa_sema TO lt_sema. ENDLOOP. * free local data CLEAR: lt_column_index, wa_column_index, lt_fieldcat_depf, wa_fieldcat_depf, lt_tcurx, wa_tcurx, l_num, l_typ, wa, l_int, l_counter. UNASSIGN: <f_fieldcat_line>, <f_excel_line>, <f_excel_column>, <f_fcat_column>. *--------------------------------------------------------------------* * SESSION 4: WRITE TO EXCEL *--------------------------------------------------------------------* CLEAR: wa_tcurx. REFRESH: lt_tcurx. * if spreadsheet dun have proxy yet IF li_has IS INITIAL. l_retcode = c_oi_errors=>ret_interface_not_supported. CALL METHOD c_oi_errors=>create_error_for_retcode EXPORTING retcode = l_retcode no_flush = no_flush IMPORTING error = lo_error_w. EXIT. ENDIF. CREATE OBJECT l_error EXPORTING object_name = 'OLE_DOCUMENT_PROXY' method_name = 'get_ranges_names'. CALL METHOD c_oi_errors=>add_error EXPORTING error = l_error. DESCRIBE TABLE lt_sema LINES datareal. DESCRIBE TABLE <f_excel_tab> LINES datac. DESCRIBE TABLE lt_vkey LINES vkeycount. IF datac = 0. RAISE inv_data_range. ENDIF. IF vkeycount NE l_n_vrt_keys. RAISE dim_mismatch_vkey. ENDIF. all = l_n_vrt_keys + l_n_att_cols. IF datareal NE all. RAISE dim_mismatch_sema. ENDIF. DATA: decimal TYPE c. * get decimal separator format ('.', ',', ...) in Office config CALL METHOD lo_proxy->get_application_property EXPORTING property_name = 'INTERNATIONAL' subproperty_name = 'DECIMAL_SEPARATOR' CHANGING retvalue = decimal. DATA: wa_usr TYPE usr01. SELECT * FROM usr01 INTO wa_usr WHERE bname = sy-uname. ENDSELECT. DATA: comma_elim(4) TYPE c. FIELD-SYMBOLS <g> TYPE any. DATA search_item(4) VALUE ' #'. CONCATENATE ',' decimal '.' decimal INTO comma_elim. DATA help TYPE i. " table (with subtotal) line number help = datac. DATA: rowmax TYPE i VALUE 1. " header row number DATA: columnmax TYPE i VALUE 0. " header columns number LOOP AT lt_hkey INTO hkeyitem. IF hkeyitem-col_no > columnmax. columnmax = hkeyitem-col_no. ENDIF. IF hkeyitem-row_no > rowmax. rowmax = hkeyitem-row_no. ENDIF. ENDLOOP. DATA: hkeycolumns TYPE i. " header columns no hkeycolumns = columnmax. IF hkeycolumns < l_n_att_cols. hkeycolumns = l_n_att_cols. ENDIF. columnmax = 0. LOOP AT lt_vkey INTO vkeyitem. IF vkeyitem-col_no > columnmax. columnmax = vkeyitem-col_no. ENDIF. ENDLOOP. DATA overflow TYPE i VALUE 1. DATA testname(10) TYPE c. DATA temp2 TYPE i. " 1st item row position in excel DATA realmit TYPE i VALUE 1. DATA realoverflow TYPE i VALUE 1. " row index in content CALL METHOD lo_spreadsheet->screen_update EXPORTING updating = ''. CALL METHOD lo_spreadsheet->load_lib. DATA: str(40) TYPE c. " range names of columns range (w/o col header) DATA: rows TYPE i. " row postion of 1st item line in ecxel * calculate row position of data table DESCRIBE TABLE it_listheader LINES li_commentary_rows. * if grid had title, add 1 empy line between title and table IF li_commentary_rows NE 0. ADD 1 TO li_commentary_rows. ENDIF. * add top position of block data li_commentary_rows = li_commentary_rows + i_top - 1. * write header (commentary rows) DATA: li_commentary_row_index TYPE i VALUE 1. DATA: li_content_index TYPE i VALUE 1. DATA: ls_index(10) TYPE c. DATA ls_commentary_range(40) TYPE c VALUE 'TITLE'. DATA: li_font_bold TYPE i. DATA: li_font_italic TYPE i. DATA: li_font_size TYPE i. LOOP AT it_listheader INTO wa_listheader. li_commentary_row_index = i_top + li_content_index - 1. ls_index = li_content_index. CONDENSE ls_index. CONCATENATE ls_commentary_range(5) ls_index INTO ls_commentary_range. CONDENSE ls_commentary_range. * insert title range CALL METHOD lo_spreadsheet->insert_range_dim EXPORTING name = ls_commentary_range top = li_commentary_row_index left = i_left rows = 1 columns = 1 no_flush = no_flush. * format range CASE wa_listheader-typ. WHEN 'H'. "title li_font_size = 16. li_font_bold = 1. li_font_italic = -1. WHEN 'S'. "subtile li_font_size = -1. li_font_bold = 1. li_font_italic = -1. WHEN OTHERS. "'A' comment li_font_size = -1. li_font_bold = -1. li_font_italic = 1. ENDCASE. CALL METHOD lo_spreadsheet->set_font EXPORTING rangename = ls_commentary_range family = '' size = li_font_size bold = li_font_bold italic = li_font_italic align = 0 no_flush = no_flush. * title: range content rangeitem-name = ls_commentary_range. rangeitem-columns = 1. rangeitem-rows = 1. APPEND rangeitem TO ranges. contentsitem-row = li_content_index. contentsitem-column = 1. CONCATENATE wa_listheader-key wa_listheader-info INTO contentsitem-value SEPARATED BY space. CONDENSE contentsitem-value. APPEND contentsitem TO contents. ADD 1 TO li_content_index. CLEAR: rangeitem, contentsitem, ls_index. ENDLOOP. * set range data title CALL METHOD lo_spreadsheet->set_ranges_data EXPORTING ranges = ranges contents = contents no_flush = no_flush. REFRESH: ranges, contents. rows = rowmax + li_commentary_rows + 1. all = wa_usr-datfm. all = all + 3. LOOP AT lt_sema INTO semaitem. IF semaitem-col_typ = 'DAT' OR semaitem-col_typ = 'MON' OR semaitem-col_typ = 'N00' OR semaitem-col_typ = 'N01' OR semaitem-col_typ = 'N01' OR semaitem-col_typ = 'N02' OR semaitem-col_typ = 'N03' OR semaitem-col_typ = 'PCT' OR semaitem-col_typ = 'STR' OR semaitem-col_typ = 'NUM'. CLEAR str. str = semaitem-col_no. CONDENSE str. CONCATENATE 'DATA' str INTO str. mit = semaitem-col_no. li_col_pos = semaitem-col_no + i_left - 1. * range from data1 to data(n), for each columns of table CALL METHOD lo_spreadsheet->insert_range_dim EXPORTING name = str top = rows left = li_col_pos rows = help columns = 1 no_flush = no_flush. DATA dec TYPE i VALUE -1. DATA typeinfo TYPE sydes_typeinfo. LOOP AT <f_excel_tab> ASSIGNING <line>. ASSIGN COMPONENT semaitem-col_no OF STRUCTURE <line> TO <item>. DESCRIBE FIELD <item> INTO td. READ TABLE td-types INDEX 1 INTO typeinfo. IF typeinfo-type = 'P'. dec = typeinfo-decimals. ELSEIF typeinfo-type = 'I'. dec = 0. ENDIF. DESCRIBE FIELD <line> TYPE typ COMPONENTS count. mit = 1. DO count TIMES. IF mit = semaitem-col_src. ASSIGN COMPONENT sy-index OF STRUCTURE <line> TO <item>. DESCRIBE FIELD <item> INTO td. READ TABLE td-types INDEX 1 INTO typeinfo. IF typeinfo-type = 'P'. dec = typeinfo-decimals. ENDIF. EXIT. ENDIF. mit = mit + 1. ENDDO. EXIT. ENDLOOP. * format for each columns of table (w/o columns headers) IF semaitem-col_typ = 'DAT'. IF semaitem-col_no > vkeycount. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = all no_flush = no_flush. ELSE. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 0 no_flush = no_flush. ENDIF. ELSEIF semaitem-col_typ = 'STR'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 0 no_flush = no_flush. ELSEIF semaitem-col_typ = 'MON'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 10 no_flush = no_flush. ELSEIF semaitem-col_typ = 'N00'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 1 decimals = 0 no_flush = no_flush. ELSEIF semaitem-col_typ = 'N01'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 1 decimals = 1 no_flush = no_flush. ELSEIF semaitem-col_typ = 'N02'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 1 decimals = 2 no_flush = no_flush. ELSEIF semaitem-col_typ = 'N03'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 1 decimals = 3 no_flush = no_flush. ELSEIF semaitem-col_typ = 'N04'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 1 decimals = 4 no_flush = no_flush. ELSEIF semaitem-col_typ = 'NUM'. IF dec EQ -1. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 1 decimals = 2 no_flush = no_flush. ELSE. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 1 decimals = dec no_flush = no_flush. ENDIF. ELSEIF semaitem-col_typ = 'PCT'. CALL METHOD lo_spreadsheet->set_format EXPORTING rangename = str currency = '' typ = 3 decimals = 0 no_flush = no_flush. ENDIF. ENDIF. ENDLOOP. * get item contents for set_range_data method * get currency cell also mit = 1. DATA: currcells TYPE soi_cell_table. DATA: curritem TYPE soi_cell_item. curritem-rows = 1. curritem-columns = 1. curritem-front = -1. curritem-back = -1. curritem-font = ''. curritem-size = -1. curritem-bold = -1. curritem-italic = -1. curritem-align = -1. curritem-frametyp = -1. curritem-framecolor = -1. curritem-currency = ''. curritem-number = 1. curritem-input = -1. DATA: const TYPE i. * Change for Correction request * Initial 10000 lines are missing in Excel Export * if there are only 2 columns in exported List object. IF datareal GT 2. const = 20000 / datareal. ELSE. const = 20000 / ( datareal + 2 ). ENDIF. DATA: lines TYPE i. DATA: innerlines TYPE i. DATA: counter TYPE i. DATA: curritem2 LIKE curritem. DATA: curritem3 LIKE curritem. DATA: length TYPE i. DATA: found. * append content table (for method set_range_content) LOOP AT <f_excel_tab> ASSIGNING <line>. * save line index to compare with lt_subtot_indexs, * to discover line is a subtotal / totale line or not * ex use to set 'dun display zero in subtotal / total line' l_save_index = sy-tabix. DO datareal TIMES. READ TABLE lt_sema INTO semaitem WITH KEY col_no = sy-index. IF semaitem-col_src NE 0. ASSIGN COMPONENT semaitem-col_src OF STRUCTURE <line> TO <item>. ELSE. ASSIGN COMPONENT sy-index OF STRUCTURE <line> TO <item>. ENDIF. contentsitem-row = realoverflow. IF sy-subrc = 0. MOVE semaitem-col_ops TO search_item(3). SEARCH 'ADD#CNT#MIN#MAX#AVG#NOP#DFT#' FOR search_item. IF sy-subrc NE 0. RAISE error_in_sema. ENDIF. MOVE semaitem-col_typ TO search_item(3). SEARCH 'NUM#N00#N01#N02#N03#N04#PCT#DAT#MON#STR#' FOR search_item. IF sy-subrc NE 0. RAISE error_in_sema. ENDIF. contentsitem-column = sy-index. IF semaitem-col_typ EQ 'DAT' OR semaitem-col_typ EQ 'MON'. IF semaitem-col_no > vkeycount. " Hinweis 512418 " EXCEL bezieht Datumsangaben " auf den 31.12.1899, behandelt " aber 1900 als ein Schaltjahr " d.h. ab 1.3.1900 korrekt " 1.3.1900 als Zahl = 61 DATA: genesis TYPE d VALUE '18991230'. DATA: number_of_days TYPE p. * change for date in char format & sema_type = X DATA: temp_date TYPE d. IF NOT <item> IS INITIAL AND NOT <item> CO ' ' AND NOT <item> CO '0'. * change for date in char format & sema_type = X starts IF sema_type = 'X'. DESCRIBE FIELD <item> TYPE typ. IF typ = 'C'. temp_date = <item>. number_of_days = temp_date - genesis. ELSE. number_of_days = <item> - genesis. ENDIF. ELSE. number_of_days = <item> - genesis. ENDIF. * change for date in char format & sema_type = X ends IF number_of_days < 61. number_of_days = number_of_days - 1. ENDIF. SET COUNTRY 'DE'. WRITE number_of_days TO contentsitem-value NO-GROUPING LEFT-JUSTIFIED. SET COUNTRY space. TRANSLATE contentsitem-value USING comma_elim. ELSE. CLEAR contentsitem-value. ENDIF. ELSE. MOVE <item> TO contentsitem-value. ENDIF. ELSEIF semaitem-col_typ EQ 'NUM' OR semaitem-col_typ EQ 'N00' OR semaitem-col_typ EQ 'N01' OR semaitem-col_typ EQ 'N02' OR semaitem-col_typ EQ 'N03' OR semaitem-col_typ EQ 'N04' OR semaitem-col_typ EQ 'PCT'. SET COUNTRY 'DE'. DESCRIBE FIELD <item> TYPE typ. IF semaitem-col_cur IS INITIAL. IF typ NE 'F'. WRITE <item> TO contentsitem-value NO-GROUPING NO-SIGN DECIMALS 14. ELSE. WRITE <item> TO contentsitem-value NO-GROUPING NO-SIGN. ENDIF. ELSE. * Treat of fixed curreny for column >>Y9CK007319 IF semaitem-col_cur < 0. semaitem-col_cur = semaitem-col_cur * ( -1 ). SELECT * FROM tcurx INTO TABLE lt_tcurx. SORT lt_tcurx. READ TABLE lt_tcurx INTO wa_tcurx INDEX semaitem-col_cur. IF sy-subrc = 0. IF typ NE 'F'. WRITE <item> TO contentsitem-value NO-GROUPING CURRENCY wa_tcurx-currkey NO-SIGN DECIMALS 14. ELSE. WRITE <item> TO contentsitem-value NO-GROUPING CURRENCY wa_tcurx-currkey NO-SIGN. ENDIF. ENDIF. ELSE. ASSIGN COMPONENT semaitem-col_cur OF STRUCTURE <line> TO <g>. * mit = index of recent row curritem-top = rowmax + mit + li_commentary_rows. li_col_pos = sy-index + i_left - 1. curritem-left = li_col_pos. * if filed is quantity field (qfieldname ne space) * or amount field (cfieldname ne space), then format decimal place * corresponding with config CLEAR: l_def. READ TABLE lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line> WITH KEY tabname = l_tabname tech = space no_out = space col_pos = semaitem-col_no. IF sy-subrc = 0. IF <f_fieldcat_line>-cfieldname IS NOT INITIAL. l_def = 'C'. ELSE."if <f_fieldcat_line>-qfieldname is not initial. l_def = 'Q'. ENDIF. ENDIF. * if field is amount field * exporting of amount field base on currency decimal table: TCURX IF l_def = 'C'. "field is amount field SELECT SINGLE * FROM tcurx INTO wa_tcurx WHERE currkey = <g>. * if amount ref to un-know currency -> default decimal = 2 IF sy-subrc EQ 0. curritem-decimals = wa_tcurx-currdec. ELSE. curritem-decimals = 2. ENDIF. APPEND curritem TO currcells. IF typ NE 'F'. WRITE <item> TO contentsitem-value CURRENCY <g> NO-SIGN NO-GROUPING. ELSE. WRITE <item> TO contentsitem-value DECIMALS 14 CURRENCY <g> NO-SIGN NO-GROUPING. ENDIF. * if field is quantity field * exporting of quantity field base on quantity decimal table: T006 ELSE."if l_def = 'Q'. " field is quantity field CLEAR: wa_t006. SELECT SINGLE * FROM t006 INTO wa_t006 WHERE msehi = <g>. * if quantity ref to un-know unit-> default decimal = 2 IF sy-subrc EQ 0. curritem-decimals = wa_t006-decan. ELSE. curritem-decimals = 2. ENDIF. APPEND curritem TO currcells. WRITE <item> TO contentsitem-value UNIT <g> NO-SIGN NO-GROUPING. CONDENSE contentsitem-value. ENDIF. ENDIF. "Y9CK007319 ENDIF. CONDENSE contentsitem-value. * add function fieldcat-no zero display LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line> WHERE tabname = l_tabname AND tech NE 'X' AND no_out NE 'X'. IF <f_fieldcat_line>-col_pos = semaitem-col_no. IF <f_fieldcat_line>-no_zero = 'X'. IF <item> = '0'. CLEAR: contentsitem-value. ENDIF. * dun display zero in total/subtotal line too ELSE. CLEAR: wa_subtot_indexs. READ TABLE lt_subtot_indexs INTO wa_subtot_indexs WITH KEY index = l_save_index. IF sy-subrc = 0 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 i499(sy) with 'Document is Exported to ' p_path. MESSAGE i499(sy) WITH 'Data has been exported successfully'. CLEAR: ls_path, li_document_size. close_document. ENDMETHOD. "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->if_object_collection~get_iterator( ). WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true. lo_curtable ?= lo_iterator->if_object_collection_iterator~get_next( ). IF ( ( ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row ) OR ( ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row ) ) AND ( ( lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) ) OR ( lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) ) ). lv_errormessage = 'Table overlaps with previously bound table and will not be added to worksheet.'(400). 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( ). lv_max_row = me->get_highest_row( ). *--------------------------------------------------------------------* * 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. <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 CATCH cx_sy_conversion_error INTO lx_conversion_error. "Another try with conversion to float... DESCRIBE FIELD <lv_value> TYPE lv_type. 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->if_object_collection~get_iterator( ). ENDMETHOD. "GET_TABLES_ITERATOR METHOD get_tables_size. ep_size = tables->if_object_collection~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_cell. DATA: lv_column TYPE zexcel_cell_column, ls_sheet_content TYPE zexcel_s_cell_data, lv_row_alpha TYPE string, lv_col_alpha TYPE zexcel_cell_column_alpha, lv_value TYPE zexcel_cell_value, lv_data_type TYPE zexcel_cell_data_type, lv_value_type TYPE abap_typekind, lv_style_guid TYPE zexcel_cell_style, lo_addit TYPE REF TO cl_abap_elemdescr, lo_value TYPE REF TO data, lo_value_new TYPE REF TO data. FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data, <fs_numeric> TYPE numeric, <fs_date> TYPE d, <fs_time> TYPE t, <fs_value> TYPE simple. IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED. 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. CASE lv_value_type. WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2 OR cl_abap_typedescr=>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. * 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.
35.750438
217
0.6017