content
stringlengths 4
1.04M
| input_ids
sequencelengths 2
1.02k
| attention_mask
sequencelengths 2
1.02k
|
---|---|---|
CLASS ycl_addict_dol_obj_prog DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES yif_addict_dol_obj .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ycl_addict_dol_obj_prog IMPLEMENTATION.
METHOD yif_addict_dol_obj~get_ddtext.
SELECT SINGLE text FROM trdirt
WHERE name = @obj_name AND
sprsl = @sy-langu
INTO @output.
ENDMETHOD.
METHOD yif_addict_dol_obj~get_object_txt.
output = TEXT-452.
ENDMETHOD.
METHOD yif_addict_dol_obj~is_deleted.
SELECT SINGLE name FROM trdir
WHERE name = @obj_name
INTO @data(dummy).
output = boolc( sy-subrc <> 0 ).
ENDMETHOD.
ENDCLASS.
| [
31631,
331,
565,
62,
2860,
713,
62,
67,
349,
62,
26801,
62,
1676,
70,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
331,
361,
62,
2860,
713,
62,
67,
349,
62,
26801,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
331,
565,
62,
2860,
713,
62,
67,
349,
62,
26801,
62,
1676,
70,
30023,
2538,
10979,
6234,
13,
198,
220,
337,
36252,
331,
361,
62,
2860,
713,
62,
67,
349,
62,
26801,
93,
1136,
62,
1860,
5239,
13,
198,
220,
220,
220,
33493,
311,
2751,
2538,
2420,
16034,
491,
67,
2265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33411,
1438,
220,
796,
2488,
26801,
62,
3672,
5357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
599,
3808,
75,
796,
2488,
1837,
12,
75,
2303,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
39319,
2488,
22915,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
331,
361,
62,
2860,
713,
62,
67,
349,
62,
26801,
93,
1136,
62,
15252,
62,
14116,
13,
198,
220,
220,
220,
5072,
796,
40383,
12,
37730,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
331,
361,
62,
2860,
713,
62,
67,
349,
62,
26801,
93,
271,
62,
2934,
33342,
13,
198,
220,
220,
220,
33493,
311,
2751,
2538,
1438,
16034,
491,
15908,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33411,
1438,
796,
2488,
26801,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
39319,
2488,
7890,
7,
67,
13513,
737,
628,
220,
220,
220,
5072,
796,
20512,
66,
7,
827,
12,
7266,
6015,
1279,
29,
657,
6739,
198,
220,
23578,
49273,
13,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_gui_page_data DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_page
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception .
METHODS zif_abapgit_gui_event_handler~on_event
REDEFINITION .
PROTECTED SECTION.
CONSTANTS:
BEGIN OF c_event,
add TYPE string VALUE 'add',
update TYPE string VALUE 'update',
remove TYPE string VALUE 'remove',
END OF c_event .
CONSTANTS:
BEGIN OF c_id,
table TYPE string VALUE 'table',
where TYPE string VALUE 'where',
END OF c_id .
DATA mi_config TYPE REF TO zif_abapgit_data_config .
METHODS render_content
REDEFINITION .
PRIVATE SECTION.
DATA mo_repo TYPE REF TO zcl_abapgit_repo .
METHODS build_where
IMPORTING
!io_map TYPE REF TO zcl_abapgit_string_map
RETURNING
VALUE(rt_where) TYPE string_table .
METHODS render_add
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS render_existing
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS event_add
IMPORTING
!ii_event TYPE REF TO zif_abapgit_gui_event
RAISING
zcx_abapgit_exception .
METHODS event_remove
IMPORTING
!ii_event TYPE REF TO zif_abapgit_gui_event
RAISING
zcx_abapgit_exception .
METHODS event_update
IMPORTING
!ii_event TYPE REF TO zif_abapgit_gui_event
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_DATA IMPLEMENTATION.
METHOD build_where.
DATA lv_where LIKE LINE OF rt_where.
SPLIT io_map->get( c_id-where ) AT |\n| INTO TABLE rt_where.
DELETE rt_where WHERE table_line IS INITIAL.
LOOP AT rt_where INTO lv_where.
IF strlen( lv_where ) <= 2.
DELETE rt_where INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
ms_control-page_title = 'Data'.
mo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
mi_config = mo_repo->get_data_config( ).
ENDMETHOD.
METHOD event_add.
DATA lo_map TYPE REF TO zcl_abapgit_string_map.
DATA ls_config TYPE zif_abapgit_data_config=>ty_config.
lo_map = ii_event->form_data( ).
ls_config-type = zif_abapgit_data_config=>c_data_type-tabu.
ls_config-name = to_upper( lo_map->get( c_id-table ) ).
ls_config-where = build_where( lo_map ).
mi_config->add_config( ls_config ).
ENDMETHOD.
METHOD event_remove.
DATA lo_map TYPE REF TO zcl_abapgit_string_map.
DATA ls_config TYPE zif_abapgit_data_config=>ty_config.
lo_map = ii_event->form_data( ).
ls_config-type = zif_abapgit_data_config=>c_data_type-tabu.
ls_config-name = to_upper( lo_map->get( c_id-table ) ).
mi_config->remove_config( ls_config ).
ENDMETHOD.
METHOD event_update.
DATA lo_map TYPE REF TO zcl_abapgit_string_map.
DATA ls_config TYPE zif_abapgit_data_config=>ty_config.
lo_map = ii_event->form_data( ).
ls_config-type = zif_abapgit_data_config=>c_data_type-tabu.
ls_config-name = to_upper( lo_map->get( c_id-table ) ).
ls_config-where = build_where( lo_map ).
mi_config->update_config( ls_config ).
ENDMETHOD.
METHOD render_add.
DATA lo_form TYPE REF TO zcl_abapgit_html_form.
DATA lo_form_data TYPE REF TO zcl_abapgit_string_map.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
CREATE OBJECT lo_form_data.
lo_form = zcl_abapgit_html_form=>create( ).
lo_form->text(
iv_label = 'Table'
iv_name = c_id-table
iv_required = abap_true ).
lo_form->textarea(
iv_label = 'Where'
iv_placeholder = 'Conditions separated by newline'
iv_name = c_id-where ).
lo_form->command(
iv_label = 'Add'
iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main
iv_action = c_event-add ).
ri_html->add( lo_form->render( lo_form_data ) ).
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( render_add( ) ).
ri_html->add( render_existing( ) ).
ENDMETHOD.
METHOD render_existing.
DATA lo_form TYPE REF TO zcl_abapgit_html_form.
DATA lo_form_data TYPE REF TO zcl_abapgit_string_map.
DATA lt_configs TYPE zif_abapgit_data_config=>ty_config_tt.
DATA ls_config LIKE LINE OF lt_configs.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
CREATE OBJECT lo_form_data.
lt_configs = mi_config->get_configs( ).
LOOP AT lt_configs INTO ls_config.
lo_form = zcl_abapgit_html_form=>create( ).
CREATE OBJECT lo_form_data.
lo_form_data->set(
iv_key = c_id-table
iv_val = |{ ls_config-name }| ).
lo_form->text(
iv_label = 'Table'
iv_name = c_id-table
iv_readonly = abap_true ).
lo_form_data->set(
iv_key = c_id-where
iv_val = concat_lines_of( table = ls_config-where sep = |\n| ) ).
lo_form->textarea(
iv_label = 'Where'
iv_placeholder = 'Conditions separated by newline'
iv_name = c_id-where ).
lo_form->command(
iv_label = 'Update'
iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main
iv_action = c_event-update ).
lo_form->command(
iv_label = 'Remove'
iv_action = c_event-remove ).
ri_html->add( lo_form->render( lo_form_data ) ).
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
CASE ii_event->mv_action.
WHEN c_event-add.
event_add( ii_event ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_event-update.
event_update( ii_event ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_event-remove.
event_remove( ii_event ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ENDCASE.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
7890,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
628,
220,
220,
220,
337,
36252,
50,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
15596,
62,
30281,
93,
261,
62,
15596,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
628,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
269,
62,
15596,
11,
198,
220,
220,
220,
220,
220,
220,
220,
751,
220,
220,
220,
41876,
4731,
26173,
8924,
705,
2860,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
4296,
41876,
4731,
26173,
8924,
705,
19119,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
4781,
41876,
4731,
26173,
8924,
705,
28956,
3256,
198,
220,
220,
220,
220,
220,
23578,
3963,
269,
62,
15596,
764,
628,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
269,
62,
312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3084,
41876,
4731,
26173,
8924,
705,
11487,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
810,
41876,
4731,
26173,
8924,
705,
3003,
3256,
198,
220,
220,
220,
220,
220,
23578,
3963,
269,
62,
312,
764,
628,
220,
220,
220,
42865,
21504,
62,
11250,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
7890,
62,
11250,
764,
628,
220,
220,
220,
337,
36252,
50,
8543,
62,
11299,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42865,
6941,
62,
260,
7501,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
260,
7501,
764,
628,
220,
220,
220,
337,
36252,
50,
1382,
62,
3003,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
8899,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
8841,
62,
8899,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
3003,
8,
41876,
4731,
62,
11487,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
2860,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
380,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
6494,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
25687,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
380,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
6494,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1785,
62,
2860,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
4178,
62,
15596,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
15596,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1785,
62,
28956,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
4178,
62,
15596,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
15596,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1785,
62,
19119,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
4178,
62,
15596,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
15596,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
40156,
62,
4537,
8264,
62,
26947,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1382,
62,
3003,
13,
628,
220,
220,
220,
42865,
300,
85,
62,
3003,
34178,
48920,
3963,
374,
83,
62,
3003,
13,
628,
220,
220,
220,
46341,
2043,
33245,
62,
8899,
3784,
1136,
7,
269,
62,
312,
12,
3003,
1267,
5161,
930,
59,
77,
91,
39319,
43679,
374,
83,
62,
3003,
13,
628,
220,
220,
220,
5550,
2538,
9328,
374,
83,
62,
3003,
33411,
3084,
62,
1370,
3180,
3268,
2043,
12576,
13,
628,
220,
220,
220,
17579,
3185,
5161,
374,
83,
62,
3003,
39319,
300,
85,
62,
3003,
13,
198,
220,
220,
220,
220,
220,
16876,
965,
11925,
7,
300,
85,
62,
3003,
1267,
19841,
362,
13,
198,
220,
220,
220,
220,
220,
220,
220,
5550,
2538,
9328,
374,
83,
62,
3003,
24413,
6369,
827,
12,
8658,
844,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
23578,
21982,
3185,
13,
628,
220,
23578,
49273
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_advent2020_day07_schmelto DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_advent2020_schmelto .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_advent2020_day07_schmelto IMPLEMENTATION.
METHOD zif_advent2020_schmelto~solve.
output = 'todo'.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
324,
1151,
42334,
62,
820,
2998,
62,
20601,
17694,
1462,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
324,
1151,
42334,
62,
20601,
17694,
1462,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
324,
1151,
42334,
62,
820,
2998,
62,
20601,
17694,
1462,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
324,
1151,
42334,
62,
20601,
17694,
1462,
93,
82,
6442,
13,
628,
220,
220,
220,
5072,
796,
705,
83,
24313,
4458,
628,
220,
23578,
49273,
13,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
REPORT zhello_world.
PARAMETERS:
p_nicknm(15) TYPE c.
WRITE / 'Hello World!'.
WRITE / 'This is one of my first programs and we are always learning.'.
WRITE: / 'Regards' , p_nicknm.
| [
2200,
15490,
1976,
31373,
62,
6894,
13,
198,
198,
27082,
2390,
2767,
4877,
25,
198,
220,
279,
62,
17172,
21533,
7,
1314,
8,
41876,
269,
13,
198,
18564,
12709,
1220,
705,
15496,
2159,
0,
4458,
198,
18564,
12709,
1220,
705,
1212,
318,
530,
286,
616,
717,
4056,
290,
356,
389,
1464,
4673,
2637,
13,
198,
18564,
12709,
25,
1220,
705,
8081,
1371,
6,
837,
279,
62,
17172,
21533,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class ZCX_ENQUEUE_ERROR definition
public
inheriting from CX_STATIC_CHECK
create public .
public section.
interfaces IF_T100_DYN_MSG .
interfaces IF_T100_MESSAGE .
methods CONSTRUCTOR
importing
!TEXTID like IF_T100_MESSAGE=>T100KEY optional
!PREVIOUS like PREVIOUS optional .
protected section.
private section.
ENDCLASS.
CLASS ZCX_ENQUEUE_ERROR IMPLEMENTATION.
method CONSTRUCTOR.
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
PREVIOUS = PREVIOUS
.
clear me->textid.
if textid is initial.
IF_T100_MESSAGE~T100KEY = IF_T100_MESSAGE=>DEFAULT_TEXTID.
else.
IF_T100_MESSAGE~T100KEY = TEXTID.
endif.
endmethod.
ENDCLASS.
| [
4871,
1168,
34,
55,
62,
1677,
48,
8924,
8924,
62,
24908,
6770,
198,
220,
1171,
198,
220,
10639,
1780,
422,
327,
55,
62,
35744,
2149,
62,
50084,
198,
220,
2251,
1171,
764,
198,
198,
11377,
2665,
13,
628,
220,
20314,
16876,
62,
51,
3064,
62,
35,
40760,
62,
5653,
38,
764,
198,
220,
20314,
16876,
62,
51,
3064,
62,
44,
1546,
4090,
8264,
764,
628,
220,
5050,
7102,
46126,
1581,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
32541,
2389,
588,
16876,
62,
51,
3064,
62,
44,
1546,
4090,
8264,
14804,
51,
3064,
20373,
11902,
198,
220,
220,
220,
220,
220,
5145,
46437,
12861,
20958,
588,
22814,
12861,
20958,
11902,
764,
198,
24326,
2665,
13,
198,
19734,
2665,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
34,
55,
62,
1677,
48,
8924,
8924,
62,
24908,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
2446,
7102,
46126,
1581,
13,
198,
34,
7036,
337,
36252,
33088,
3784,
10943,
46126,
1581,
198,
6369,
15490,
2751,
198,
46437,
12861,
20958,
796,
22814,
12861,
20958,
198,
13,
198,
20063,
502,
3784,
5239,
312,
13,
198,
361,
2420,
312,
318,
4238,
13,
198,
220,
16876,
62,
51,
3064,
62,
44,
1546,
4090,
8264,
93,
51,
3064,
20373,
796,
16876,
62,
51,
3064,
62,
44,
1546,
4090,
8264,
14804,
7206,
38865,
62,
32541,
2389,
13,
198,
17772,
13,
198,
220,
16876,
62,
51,
3064,
62,
44,
1546,
4090,
8264,
93,
51,
3064,
20373,
796,
40383,
2389,
13,
198,
32088,
13,
198,
220,
886,
24396,
13,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class ZCL_EXCEL_WORKSHEET definition
public
create public .
public section.
*"* public components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
type-pools ABAP .
interfaces ZIF_EXCEL_SHEET_PRINTSETTINGS .
interfaces ZIF_EXCEL_SHEET_PROPERTIES .
interfaces ZIF_EXCEL_SHEET_PROTECTION .
interfaces ZIF_EXCEL_SHEET_VBA_PROJECT .
types:
begin of MTY_S_OUTLINE_ROW,
row_from type i,
row_to type i,
collapsed type abap_bool,
end of mty_s_outline_row .
types:
MTY_TS_OUTLINES_ROW type sorted table of MTY_S_OUTLINE_ROW with unique key row_from row_to .
constants C_BREAK_COLUMN type ZEXCEL_BREAK value 2. "#EC NOTEXT
constants C_BREAK_NONE type ZEXCEL_BREAK value 0. "#EC NOTEXT
constants C_BREAK_ROW type ZEXCEL_BREAK value 1. "#EC NOTEXT
data EXCEL type ref to ZCL_EXCEL read-only .
data PRINT_GRIDLINES type ZEXCEL_PRINT_GRIDLINES read-only value ABAP_FALSE. "#EC NOTEXT . " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
data SHEET_CONTENT type ZEXCEL_T_CELL_DATA .
data SHEET_SETUP type ref to ZCL_EXCEL_SHEET_SETUP .
data SHOW_GRIDLINES type ZEXCEL_SHOW_GRIDLINES read-only value ABAP_TRUE. "#EC NOTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
data SHOW_ROWCOLHEADERS type ZEXCEL_SHOW_GRIDLINES read-only value ABAP_TRUE. "#EC NOTEXT . " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
data STYLES type ZEXCEL_T_SHEET_STYLE .
data TABCOLOR type ZEXCEL_S_TABCOLOR read-only .
methods ADD_DRAWING
importing
!IP_DRAWING type ref to ZCL_EXCEL_DRAWING .
methods ADD_NEW_COLUMN
importing
!IP_COLUMN type SIMPLE
returning
value(EO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods ADD_NEW_STYLE_COND
returning
value(EO_STYLE_COND) type ref to ZCL_EXCEL_STYLE_COND .
methods ADD_NEW_DATA_VALIDATION
returning
value(EO_DATA_VALIDATION) type ref to ZCL_EXCEL_DATA_VALIDATION .
methods ADD_NEW_RANGE
returning
value(EO_RANGE) type ref to ZCL_EXCEL_RANGE .
methods ADD_NEW_ROW
importing
!IP_ROW type SIMPLE
returning
value(EO_ROW) type ref to ZCL_EXCEL_ROW .
methods BIND_ALV
importing
!IO_ALV type ref to OBJECT
!IT_TABLE type STANDARD TABLE
!I_TOP type I default 1
!I_LEFT type I default 1
!TABLE_STYLE type ZEXCEL_TABLE_STYLE optional
!I_TABLE type ABAP_BOOL default ABAP_TRUE
raising
ZCX_EXCEL .
type-pools SLIS .
type-pools SOI .
methods BIND_ALV_OLE2
importing
!I_DOCUMENT_URL type CHAR255 default SPACE
!I_XLS type C default SPACE
!I_SAVE_PATH type STRING
!IO_ALV type ref to CL_GUI_ALV_GRID
!IT_LISTHEADER type SLIS_T_LISTHEADER optional
!I_TOP type I default 1
!I_LEFT type I default 1
!I_COLUMNS_HEADER type C default 'X'
!I_COLUMNS_AUTOFIT type C default 'X'
!I_FORMAT_COL_HEADER type SOI_FORMAT_ITEM optional
!I_FORMAT_SUBTOTAL type SOI_FORMAT_ITEM optional
!I_FORMAT_TOTAL type SOI_FORMAT_ITEM optional
exceptions
MISS_GUIDE
EX_TRANSFER_KKBLO_ERROR
FATAL_ERROR
INV_DATA_RANGE
DIM_MISMATCH_VKEY
DIM_MISMATCH_SEMA
ERROR_IN_SEMA .
methods BIND_TABLE
importing
!IP_TABLE type STANDARD TABLE
!IT_FIELD_CATALOG type ZEXCEL_T_FIELDCATALOG optional
!IS_TABLE_SETTINGS type ZEXCEL_S_TABLE_SETTINGS optional
value(IV_DEFAULT_DESCR) type C optional
exporting
!ES_TABLE_SETTINGS type ZEXCEL_S_TABLE_SETTINGS
raising
ZCX_EXCEL .
methods CALCULATE_COLUMN_WIDTHS
raising
ZCX_EXCEL .
methods CHANGE_CELL_STYLE
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
!IP_COMPLETE type ZEXCEL_S_CSTYLE_COMPLETE optional
!IP_XCOMPLETE type ZEXCEL_S_CSTYLEX_COMPLETE optional
!IP_FONT type ZEXCEL_S_CSTYLE_FONT optional
!IP_XFONT type ZEXCEL_S_CSTYLEX_FONT optional
!IP_FILL type ZEXCEL_S_CSTYLE_FILL optional
!IP_XFILL type ZEXCEL_S_CSTYLEX_FILL optional
!IP_BORDERS type ZEXCEL_S_CSTYLE_BORDERS optional
!IP_XBORDERS type ZEXCEL_S_CSTYLEX_BORDERS optional
!IP_ALIGNMENT type ZEXCEL_S_CSTYLE_ALIGNMENT optional
!IP_XALIGNMENT type ZEXCEL_S_CSTYLEX_ALIGNMENT optional
!IP_NUMBER_FORMAT_FORMAT_CODE type ZEXCEL_NUMBER_FORMAT optional
!IP_PROTECTION type ZEXCEL_S_CSTYLE_PROTECTION optional
!IP_XPROTECTION type ZEXCEL_S_CSTYLEX_PROTECTION optional
!IP_FONT_BOLD type FLAG optional
!IP_FONT_COLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_FONT_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_FONT_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_FONT_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_FONT_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_FONT_FAMILY type ZEXCEL_STYLE_FONT_FAMILY optional
!IP_FONT_ITALIC type FLAG optional
!IP_FONT_NAME type ZEXCEL_STYLE_FONT_NAME optional
!IP_FONT_SCHEME type ZEXCEL_STYLE_FONT_SCHEME optional
!IP_FONT_SIZE type ZEXCEL_STYLE_FONT_SIZE optional
!IP_FONT_STRIKETHROUGH type FLAG optional
!IP_FONT_UNDERLINE type FLAG optional
!IP_FONT_UNDERLINE_MODE type ZEXCEL_STYLE_FONT_UNDERLINE optional
!IP_FILL_FILLTYPE type ZEXCEL_FILL_TYPE optional
!IP_FILL_ROTATION type ZEXCEL_ROTATION optional
!IP_FILL_FGCOLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_FILL_FGCOLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_FILL_FGCOLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_FILL_FGCOLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_FILL_FGCOLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_FILL_BGCOLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_FILL_BGCOLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_FILL_BGCOLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_FILL_BGCOLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_FILL_BGCOLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_BORDERS_ALLBORDERS type ZEXCEL_S_CSTYLE_BORDER optional
!IP_FILL_GRADTYPE_TYPE type ZEXCEL_S_GRADIENT_TYPE-TYPE optional
!IP_FILL_GRADTYPE_DEGREE type ZEXCEL_S_GRADIENT_TYPE-DEGREE optional
!IP_XBORDERS_ALLBORDERS type ZEXCEL_S_CSTYLEX_BORDER optional
!IP_BORDERS_DIAGONAL type ZEXCEL_S_CSTYLE_BORDER optional
!IP_FILL_GRADTYPE_BOTTOM type ZEXCEL_S_GRADIENT_TYPE-BOTTOM optional
!IP_FILL_GRADTYPE_TOP type ZEXCEL_S_GRADIENT_TYPE-TOP optional
!IP_XBORDERS_DIAGONAL type ZEXCEL_S_CSTYLEX_BORDER optional
!IP_BORDERS_DIAGONAL_MODE type ZEXCEL_DIAGONAL optional
!IP_FILL_GRADTYPE_RIGHT type ZEXCEL_S_GRADIENT_TYPE-RIGHT optional
!IP_BORDERS_DOWN type ZEXCEL_S_CSTYLE_BORDER optional
!IP_FILL_GRADTYPE_LEFT type ZEXCEL_S_GRADIENT_TYPE-LEFT optional
!IP_FILL_GRADTYPE_POSITION1 type ZEXCEL_S_GRADIENT_TYPE-POSITION1 optional
!IP_XBORDERS_DOWN type ZEXCEL_S_CSTYLEX_BORDER optional
!IP_BORDERS_LEFT type ZEXCEL_S_CSTYLE_BORDER optional
!IP_FILL_GRADTYPE_POSITION2 type ZEXCEL_S_GRADIENT_TYPE-POSITION2 optional
!IP_FILL_GRADTYPE_POSITION3 type ZEXCEL_S_GRADIENT_TYPE-POSITION3 optional
!IP_XBORDERS_LEFT type ZEXCEL_S_CSTYLEX_BORDER optional
!IP_BORDERS_RIGHT type ZEXCEL_S_CSTYLE_BORDER optional
!IP_XBORDERS_RIGHT type ZEXCEL_S_CSTYLEX_BORDER optional
!IP_BORDERS_TOP type ZEXCEL_S_CSTYLE_BORDER optional
!IP_XBORDERS_TOP type ZEXCEL_S_CSTYLEX_BORDER optional
!IP_ALIGNMENT_HORIZONTAL type ZEXCEL_ALIGNMENT optional
!IP_ALIGNMENT_VERTICAL type ZEXCEL_ALIGNMENT optional
!IP_ALIGNMENT_TEXTROTATION type ZEXCEL_TEXT_ROTATION optional
!IP_ALIGNMENT_WRAPTEXT type FLAG optional
!IP_ALIGNMENT_SHRINKTOFIT type FLAG optional
!IP_ALIGNMENT_INDENT type ZEXCEL_INDENT optional
!IP_PROTECTION_HIDDEN type ZEXCEL_CELL_PROTECTION optional
!IP_PROTECTION_LOCKED type ZEXCEL_CELL_PROTECTION optional
!IP_BORDERS_ALLBORDERS_STYLE type ZEXCEL_BORDER optional
!IP_BORDERS_ALLBORDERS_COLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_BORDERS_ALLBO_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_BORDERS_ALLBO_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_BORDERS_ALLBO_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_BORDERS_ALLBO_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_BORDERS_DIAGONAL_STYLE type ZEXCEL_BORDER optional
!IP_BORDERS_DIAGONAL_COLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_BORDERS_DIAGONAL_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_BORDERS_DIAGONAL_COLOR_INDE type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_BORDERS_DIAGONAL_COLOR_THEM type ZEXCEL_STYLE_COLOR_THEME optional
!IP_BORDERS_DIAGONAL_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_BORDERS_DOWN_STYLE type ZEXCEL_BORDER optional
!IP_BORDERS_DOWN_COLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_BORDERS_DOWN_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_BORDERS_DOWN_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_BORDERS_DOWN_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_BORDERS_DOWN_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_BORDERS_LEFT_STYLE type ZEXCEL_BORDER optional
!IP_BORDERS_LEFT_COLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_BORDERS_LEFT_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_BORDERS_LEFT_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_BORDERS_LEFT_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_BORDERS_LEFT_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_BORDERS_RIGHT_STYLE type ZEXCEL_BORDER optional
!IP_BORDERS_RIGHT_COLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_BORDERS_RIGHT_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_BORDERS_RIGHT_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_BORDERS_RIGHT_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_BORDERS_RIGHT_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
!IP_BORDERS_TOP_STYLE type ZEXCEL_BORDER optional
!IP_BORDERS_TOP_COLOR type ZEXCEL_S_STYLE_COLOR optional
!IP_BORDERS_TOP_COLOR_RGB type ZEXCEL_STYLE_COLOR_ARGB optional
!IP_BORDERS_TOP_COLOR_INDEXED type ZEXCEL_STYLE_COLOR_INDEXED optional
!IP_BORDERS_TOP_COLOR_THEME type ZEXCEL_STYLE_COLOR_THEME optional
!IP_BORDERS_TOP_COLOR_TINT type ZEXCEL_STYLE_COLOR_TINT optional
returning
value(EP_GUID) type ZEXCEL_CELL_STYLE
raising
ZCX_EXCEL .
methods CONSTRUCTOR
importing
!IP_EXCEL type ref to ZCL_EXCEL
!IP_TITLE type ZEXCEL_SHEET_TITLE optional
raising
ZCX_EXCEL .
methods DELETE_MERGE
importing
!IP_CELL_COLUMN type SIMPLE optional
!IP_CELL_ROW type ZEXCEL_CELL_ROW optional .
methods DELETE_ROW_OUTLINE
importing
!IV_ROW_FROM type I
!IV_ROW_TO type I
raising
ZCX_EXCEL .
methods FREEZE_PANES
importing
!IP_NUM_COLUMNS type I optional
!IP_NUM_ROWS type I optional
raising
ZCX_EXCEL .
methods GET_ACTIVE_CELL
returning
value(EP_ACTIVE_CELL) type STRING
raising
ZCX_EXCEL .
methods GET_CELL
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
exporting
!EP_VALUE type ZEXCEL_CELL_VALUE
!EP_RC type SYSUBRC
!EP_STYLE type ref to ZCL_EXCEL_STYLE
!EP_GUID type ZEXCEL_CELL_STYLE
!EP_FORMULA type ZEXCEL_CELL_FORMULA
raising
ZCX_EXCEL .
methods GET_COLUMN
importing
!IP_COLUMN type SIMPLE
returning
value(EO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods GET_COLUMNS
returning
value(EO_COLUMNS) type ref to ZCL_EXCEL_COLUMNS .
methods GET_COLUMNS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_STYLE_COND_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_DATA_VALIDATIONS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_DATA_VALIDATIONS_SIZE
returning
value(EP_SIZE) type I .
methods GET_DEFAULT_COLUMN
returning
value(EO_COLUMN) type ref to ZCL_EXCEL_COLUMN .
methods GET_DEFAULT_EXCEL_DATE_FORMAT
returning
value(EP_DEFAULT_EXCEL_DATE_FORMAT) type ZEXCEL_NUMBER_FORMAT .
methods GET_DEFAULT_EXCEL_TIME_FORMAT
returning
value(EP_DEFAULT_EXCEL_TIME_FORMAT) type ZEXCEL_NUMBER_FORMAT .
methods GET_DEFAULT_ROW
returning
value(EO_ROW) type ref to ZCL_EXCEL_ROW .
methods GET_DIMENSION_RANGE
returning
value(EP_DIMENSION_RANGE) type STRING
raising
ZCX_EXCEL .
methods GET_DRAWINGS
importing
!IP_TYPE type ZEXCEL_DRAWING_TYPE optional
returning
value(R_DRAWINGS) type ref to ZCL_EXCEL_DRAWINGS .
methods GET_DRAWINGS_ITERATOR
importing
!IP_TYPE type ZEXCEL_DRAWING_TYPE
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_FREEZE_CELL
exporting
!EP_ROW type ZEXCEL_CELL_ROW
!EP_COLUMN type ZEXCEL_CELL_COLUMN .
methods GET_GUID
returning
value(EP_GUID) type UUID .
methods GET_HIGHEST_COLUMN
returning
value(R_HIGHEST_COLUMN) type ZEXCEL_CELL_COLUMN
raising
ZCX_EXCEL .
methods GET_HIGHEST_ROW
returning
value(R_HIGHEST_ROW) type INT4
raising
ZCX_EXCEL .
methods GET_HYPERLINKS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_HYPERLINKS_SIZE
returning
value(EP_SIZE) type I .
methods GET_MERGE
returning
value(MERGE_RANGE) type STRING_TABLE
raising
ZCX_EXCEL .
methods GET_PAGEBREAKS
returning
value(RO_PAGEBREAKS) type ref to ZCL_EXCEL_WORKSHEET_PAGEBREAKS
raising
ZCX_EXCEL .
methods GET_RANGES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_ROW
importing
!IP_ROW type INT4
returning
value(EO_ROW) type ref to ZCL_EXCEL_ROW .
methods GET_ROWS
returning
value(EO_ROWS) type ref to ZCL_EXCEL_ROWS .
methods GET_ROWS_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_ROW_OUTLINES
returning
value(RT_ROW_OUTLINES) type MTY_TS_OUTLINES_ROW .
methods GET_STYLE_COND
importing
!IP_GUID type ZEXCEL_CELL_STYLE
returning
value(EO_STYLE_COND) type ref to ZCL_EXCEL_STYLE_COND .
methods GET_TABCOLOR
returning
value(EV_TABCOLOR) type ZEXCEL_S_TABCOLOR .
methods GET_TABLES_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods GET_TABLES_SIZE
returning
value(EP_SIZE) type I .
methods GET_TITLE
importing
!IP_ESCAPED type FLAG default ''
returning
value(EP_TITLE) type ZEXCEL_SHEET_TITLE .
methods IS_CELL_MERGED
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
returning
value(RP_IS_MERGED) type ABAP_BOOL
raising
ZCX_EXCEL .
methods SET_CELL
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
!IP_VALUE type SIMPLE optional
!IP_FORMULA type ZEXCEL_CELL_FORMULA optional
!IP_STYLE type ZEXCEL_CELL_STYLE optional
!IP_HYPERLINK type ref to ZCL_EXCEL_HYPERLINK optional
!IP_DATA_TYPE type ZEXCEL_CELL_DATA_TYPE optional
!IP_ABAP_TYPE type ABAP_TYPEKIND optional
raising
ZCX_EXCEL .
methods SET_CELL_FORMULA
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
!IP_FORMULA type ZEXCEL_CELL_FORMULA
raising
ZCX_EXCEL .
methods SET_CELL_STYLE
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
!IP_STYLE type ZEXCEL_CELL_STYLE
raising
ZCX_EXCEL .
methods SET_COLUMN_WIDTH
importing
!IP_COLUMN type SIMPLE
!IP_WIDTH_FIX type SIMPLE default 0
!IP_WIDTH_AUTOSIZE type FLAG default 'X'
raising
ZCX_EXCEL .
methods SET_DEFAULT_EXCEL_DATE_FORMAT
importing
!IP_DEFAULT_EXCEL_DATE_FORMAT type ZEXCEL_NUMBER_FORMAT
raising
ZCX_EXCEL .
methods SET_MERGE
importing
!IP_COLUMN_START type SIMPLE default ZCL_EXCEL_COMMON=>C_EXCEL_SHEET_MIN_COL
!IP_COLUMN_END type SIMPLE default ZCL_EXCEL_COMMON=>C_EXCEL_SHEET_MAX_COL
!IP_ROW type ZEXCEL_CELL_ROW default ZCL_EXCEL_COMMON=>C_EXCEL_SHEET_MIN_ROW
!IP_ROW_TO type ZEXCEL_CELL_ROW default ZCL_EXCEL_COMMON=>C_EXCEL_SHEET_MAX_ROW
raising
ZCX_EXCEL .
methods SET_PRINT_GRIDLINES
importing
!I_PRINT_GRIDLINES type ZEXCEL_PRINT_GRIDLINES .
methods SET_ROW_HEIGHT
importing
!IP_ROW type SIMPLE
!IP_HEIGHT_FIX type SIMPLE
raising
ZCX_EXCEL .
methods SET_ROW_OUTLINE
importing
!IV_ROW_FROM type I
!IV_ROW_TO type I
!IV_COLLAPSED type ABAP_BOOL
raising
ZCX_EXCEL .
methods SET_SHOW_GRIDLINES
importing
!I_SHOW_GRIDLINES type ZEXCEL_SHOW_GRIDLINES .
methods SET_SHOW_ROWCOLHEADERS
importing
!I_SHOW_ROWCOLHEADERS type ZEXCEL_SHOW_ROWCOLHEADER .
methods SET_TABCOLOR
importing
!IV_TABCOLOR type ZEXCEL_S_TABCOLOR .
methods SET_TABLE
importing
!IP_TABLE type STANDARD TABLE
!IP_HDR_STYLE type ZEXCEL_CELL_STYLE optional
!IP_BODY_STYLE type ZEXCEL_CELL_STYLE optional
!IP_TABLE_TITLE type STRING
!IP_TOP_LEFT_COLUMN type ZEXCEL_CELL_COLUMN_ALPHA default 'B'
!IP_TOP_LEFT_ROW type ZEXCEL_CELL_ROW default 3
!IP_TRANSPOSE type XFELD optional
!IP_NO_HEADER type XFELD optional
raising
ZCX_EXCEL .
methods SET_TITLE
importing
!IP_TITLE type ZEXCEL_SHEET_TITLE
raising
ZCX_EXCEL .
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.
*"* 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!!!
protected section.
private section.
types:
BEGIN OF mty_s_font_metric,
char TYPE c LENGTH 1,
char_width TYPE tdcwidths,
END OF mty_s_font_metric .
types:
mty_th_font_metrics
TYPE HASHED TABLE OF mty_s_font_metric
WITH UNIQUE KEY char .
types:
BEGIN OF mty_s_font_cache,
font_name TYPE zexcel_style_font_name,
font_height TYPE tdfontsize,
flag_bold TYPE abap_bool,
flag_italic TYPE abap_bool,
th_font_metrics TYPE mty_th_font_metrics,
END OF mty_s_font_cache .
types:
mty_th_font_cache
TYPE HASHED TABLE OF mty_s_font_cache
WITH UNIQUE KEY font_name font_height flag_bold flag_italic .
types:
* types:
* mty_ts_row_dimension TYPE SORTED TABLE OF zexcel_s_worksheet_rowdimensio WITH UNIQUE KEY row .
BEGIN OF mty_merge,
row_from TYPE i,
row_to TYPE i,
col_from TYPE i,
col_to TYPE i,
END OF mty_merge .
types:
mty_ts_merge TYPE SORTED TABLE OF mty_merge WITH UNIQUE KEY table_line .
*"* private components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
data ACTIVE_CELL type ZEXCEL_S_CELL_DATA .
data CHARTS type ref to ZCL_EXCEL_DRAWINGS .
data COLUMNS type ref to ZCL_EXCEL_COLUMNS .
data ROW_DEFAULT type ref to ZCL_EXCEL_ROW .
data COLUMN_DEFAULT type ref to ZCL_EXCEL_COLUMN .
data STYLES_COND type ref to ZCL_EXCEL_STYLES_COND .
data DATA_VALIDATIONS type ref to ZCL_EXCEL_DATA_VALIDATIONS .
data DEFAULT_EXCEL_DATE_FORMAT type ZEXCEL_NUMBER_FORMAT .
data DEFAULT_EXCEL_TIME_FORMAT type ZEXCEL_NUMBER_FORMAT .
data DRAWINGS type ref to ZCL_EXCEL_DRAWINGS .
data FREEZE_PANE_CELL_COLUMN type ZEXCEL_CELL_COLUMN .
data FREEZE_PANE_CELL_ROW type ZEXCEL_CELL_ROW .
data GUID type UUID .
data HYPERLINKS type ref to CL_OBJECT_COLLECTION .
data LOWER_CELL type ZEXCEL_S_CELL_DATA .
data MO_PAGEBREAKS type ref to ZCL_EXCEL_WORKSHEET_PAGEBREAKS .
class-data MTH_FONT_CACHE type MTY_TH_FONT_CACHE .
data MT_MERGED_CELLS type MTY_TS_MERGE .
data MT_ROW_OUTLINES type MTY_TS_OUTLINES_ROW .
data PRINT_TITLE_COL_FROM type ZEXCEL_CELL_COLUMN_ALPHA .
data PRINT_TITLE_COL_TO type ZEXCEL_CELL_COLUMN_ALPHA .
data PRINT_TITLE_ROW_FROM type ZEXCEL_CELL_ROW .
data PRINT_TITLE_ROW_TO type ZEXCEL_CELL_ROW .
data RANGES type ref to ZCL_EXCEL_RANGES .
data ROWS type ref to ZCL_EXCEL_ROWS .
data TABLES type ref to CL_OBJECT_COLLECTION .
data TITLE type ZEXCEL_SHEET_TITLE value 'Worksheet'. "#EC NOTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . " .
data UPPER_CELL type ZEXCEL_S_CELL_DATA .
methods CALCULATE_CELL_WIDTH
importing
!IP_COLUMN type SIMPLE
!IP_ROW type ZEXCEL_CELL_ROW
returning
value(EP_WIDTH) type FLOAT
raising
ZCX_EXCEL .
methods GENERATE_TITLE
returning
value(EP_TITLE) type ZEXCEL_SHEET_TITLE .
methods GET_VALUE_TYPE
importing
!IP_VALUE type SIMPLE
exporting
!EP_VALUE type SIMPLE
!EP_VALUE_TYPE type ABAP_TYPEKIND .
methods PRINT_TITLE_SET_RANGE .
methods UPDATE_DIMENSION_RANGE
raising
ZCX_EXCEL .
ENDCLASS.
CLASS ZCL_EXCEL_WORKSHEET IMPLEMENTATION.
method ADD_DRAWING.
CASE ip_drawing->get_type( ).
WHEN zcl_excel_drawing=>type_image.
drawings->include( ip_drawing ).
WHEN zcl_excel_drawing=>type_chart.
charts->include( ip_drawing ).
ENDCASE.
endmethod.
METHOD add_new_column.
DATA: lv_column_alpha TYPE zexcel_cell_column_alpha.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( ip_column ).
CREATE OBJECT eo_column
EXPORTING
ip_index = lv_column_alpha
ip_excel = me->excel
ip_worksheet = me.
columns->add( eo_column ).
ENDMETHOD.
method ADD_NEW_DATA_VALIDATION.
CREATE OBJECT eo_data_validation.
data_validations->add( eo_data_validation ).
endmethod.
METHOD add_new_range.
* Create default blank range
CREATE OBJECT eo_range.
ranges->add( eo_range ).
ENDMETHOD.
METHOD add_new_row.
CREATE OBJECT eo_row
EXPORTING
ip_index = ip_row.
rows->add( eo_row ).
ENDMETHOD.
METHOD add_new_style_cond.
CREATE OBJECT eo_style_cond.
styles_cond->add( eo_style_cond ).
ENDMETHOD.
method BIND_ALV.
data: lo_converter type ref to zcl_excel_converter.
create object lo_converter.
try.
lo_converter->convert(
exporting
io_alv = io_alv
it_table = it_table
i_row_int = i_top
i_column_int = i_left
i_table = i_table
i_style_table = table_style
io_worksheet = me
changing
co_excel = excel ).
catch zcx_excel .
endtry.
endmethod.
method BIND_ALV_OLE2.
*--------------------------------------------------------------------*
* Method description:
* Method use to export a CL_GUI_ALV_GRID object to xlsx/xls file
* with list header and characteristics of ALV field catalog such as:
* + Total, group's subtotal
* + Quantity fields, amount fields (dependent fields)
* + No_out, no_zero, ...
* Technique use in method:
* SAP Desktop Office Integration (DOI)
*--------------------------------------------------------------------*
* Data for session 0: DOI constructor
* ------------------------------------------
data: lo_control type ref to I_OI_CONTAINER_CONTROL.
data: lo_proxy type ref to I_OI_DOCUMENT_PROXY.
data: lo_spreadsheet type ref to I_OI_SPREADSHEET.
data: lo_error type ref to I_OI_ERROR.
data: lc_retcode type SOI_RET_STRING.
data: li_has type i. "Proxy has spreadsheet interface?
data: l_is_closed type i.
* Data for session 1: Get LVC data from ALV object
* ------------------------------------------
data: l_has_activex,
l_doctype_excel_sheet(11) type c.
* LVC
data: lt_fieldcat_lvc type LVC_T_FCAT.
data: wa_fieldcat_lvc type lvc_s_fcat.
data: lt_sort_lvc type LVC_T_SORT.
data: lt_filter_idx_lvc type LVC_T_FIDX.
data: lt_GROUPLEVELS_LVC type LVC_T_GRPL.
* KKBLO
DATA: LT_FIELDCAT_KKBLO Type KKBLO_T_FIELDCAT.
DATA: LT_SORT_KKBLO Type KKBLO_T_SORTINFO.
DATA: LT_GROUPLEVELS_KKBLO Type KKBLO_T_GROUPLEVELS.
DATA: LT_FILTER_IDX_KKBLO Type KKBLO_T_SFINFO.
data: wa_listheader like line of it_listheader.
* Subtotal
data: lt_collect00 type ref to data.
data: lt_collect01 type ref to data.
data: lt_collect02 type ref to data.
data: lt_collect03 type ref to data.
data: lt_collect04 type ref to data.
data: lt_collect05 type ref to data.
data: lt_collect06 type ref to data.
data: lt_collect07 type ref to data.
data: lt_collect08 type ref to data.
data: lt_collect09 type ref to data.
* data table name
data: l_tabname type kkblo_tabname.
* local object
data: lo_grid type ref to lcl_gui_alv_grid.
* data table get from ALV
data: lt_alv type ref to data.
* total / subtotal data
field-symbols: <f_collect00> type standard table.
field-symbols: <f_collect01> type standard table.
field-symbols: <f_collect02> type standard table.
field-symbols: <f_collect03> type standard table.
field-symbols: <f_collect04> type standard table.
field-symbols: <f_collect05> type standard table.
field-symbols: <f_collect06> type standard table.
field-symbols: <f_collect07> type standard table.
field-symbols: <f_collect08> type standard table.
field-symbols: <f_collect09> type standard table.
* table before append subtotal lines
field-symbols: <f_alv_tab> type standard table.
* data for session 2: sort, filter and calculate total/subtotal
* ------------------------------------------
* table to save index of subotal / total line in excel tanle
* this ideal to control index of subtotal / total line later
* for ex, when get subtotal / total line to format
types: begin of st_subtot_indexs,
index type i,
end of st_subtot_indexs.
data: lt_subtot_indexs type table of st_subtot_indexs.
data: wa_subtot_indexs like line of lt_subtot_indexs.
* data table after append subtotal
data: lt_excel type ref to data.
data: l_tabix type i.
data: l_save_index type i.
* dyn subtotal table name
data: l_collect type string.
* subtotal range, to format subtotal (and total)
data: subranges type soi_range_list.
data: subrangeitem type soi_range_item.
data: l_sub_index type i.
* table after append subtotal lines
field-symbols: <f_excel_tab> type standard table.
field-symbols: <f_excel_line> type any.
* dyn subtotal tables
field-symbols: <f_collect_tab> type standard table.
field-symbols: <f_collect_line> type any.
field-symbols: <f_filter_idx_line> like line of LT_FILTER_IDX_KKBLO.
field-symbols: <f_fieldcat_line> like line of LT_FIELDCAT_KKBLO.
field-symbols: <f_grouplevels_line> like line of LT_GROUPLEVELS_KKBLO.
field-symbols: <f_line> type any.
* Data for session 3: map data to semantic table
* ------------------------------------------
types: begin of st_column_index,
fieldname type kkblo_fieldname,
tabname type kkblo_tabname,
col like sy-index,
end of st_column_index.
* columns index
data: lt_column_index type table of st_column_index.
data: wa_column_index like line of lt_column_index.
* table of dependent field ( currency and quantity unit field)
data: lt_fieldcat_depf type kkblo_t_fieldcat.
data: wa_fieldcat_depf type kkblo_fieldcat.
* XXL interface:
* -XXL: contain exporting columns characteristic
data: lt_sema type table of gxxlt_s initial size 0.
data: wa_sema like line of lt_sema.
* -XXL interface: header
data: lt_hkey type table of gxxlt_h initial size 0.
data: wa_hkey like line of lt_hkey.
* -XXL interface: header keys
data: lt_vkey type table of gxxlt_v initial size 0.
data: wa_vkey like line of lt_vkey.
* Number of H Keys: number of key columns
data: l_n_hrz_keys type i.
* Number of data columns in the list object: non-key columns no
data: l_n_att_cols type i.
* Number of V Keys: number of header row
data: l_n_vrt_keys type i.
* curency to format amount
data: lt_tcurx type table of tcurx.
data: wa_tcurx like line of lt_tcurx.
data: l_def type flag. " currency / quantity flag
data: wa_t006 type t006. " decimal place of unit
data: l_num type i. " table columns number
data: l_typ type c. " table type
data: wa type ref to data.
data: l_int type i.
data: l_counter type i.
field-symbols: <f_excel_column> type any.
field-symbols: <f_fcat_column> type any.
* Data for session 4: write to excel
* ------------------------------------------
data: sema_type type c.
data l_error type ref to c_oi_proxy_error.
data count type i.
data datac type i.
data datareal type i. " exporting column number
data vkeycount type i.
data all type i.
data mit type i value 1. " index of recent row?
data li_col_pos type i value 1. " column position
data li_col_num type i. " table columns number
field-symbols: <line> type any.
field-symbols: <item> type any.
data td type sydes_desc.
data: typ.
data: ranges type soi_range_list.
data: rangeitem type soi_range_item.
data: contents type soi_generic_table.
data: contentsitem type soi_generic_item.
data: semaitem type gxxlt_s.
data: hkeyitem type gxxlt_h.
data: vkeyitem type gxxlt_v.
data: li_commentary_rows type i. "row number of title lines + 1
data: lo_error_w type ref to i_oi_error.
data: l_retcode type soi_ret_string.
data: no_flush type c value 'X'.
data: li_head_top type i. "header rows position
* Data for session 5: Save and clode document
* ------------------------------------------
data: li_document_size type i.
data: ls_path type RLGRAP-FILENAME.
* MACRO: Close_document
*-------------------------------------------
DEFINE close_document.
clear: l_is_closed.
IF lo_proxy is not initial.
* check proxy detroyed adi
call method lo_proxy->is_destroyed
IMPORTING
ret_value = l_is_closed.
* if dun detroyed yet: close -> release proxy
IF l_is_closed is initial.
call method lo_proxy->close_document
* EXPORTING
* do_save = do_save
IMPORTING
error = lo_error
retcode = lc_retcode.
ENDIF.
call method lo_proxy->release_document
IMPORTING
error = lo_error
retcode = lC_retcode.
else.
lc_retcode = c_oi_errors=>ret_document_not_open.
ENDIF.
* Detroy control container
IF lo_control is not initial.
CALL METHOD lo_control->destroy_control.
ENDIF.
clear:
lo_spreadsheet,
lo_proxy,
lo_control.
* free local
clear: l_is_closed.
END-OF-DEFINITION.
* Macro to catch DOI error
*-------------------------------------------
DEFINE error_doi.
if lc_retcode ne c_oi_errors=>ret_ok.
close_document.
call method lo_error->raise_message
EXPORTING
type = 'E'.
clear: lo_error.
endif.
END-OF-DEFINITION.
*--------------------------------------------------------------------*
* SESSION 0: DOI CONSTRUCTOR
*--------------------------------------------------------------------*
* check active windown
call function 'GUI_HAS_ACTIVEX'
IMPORTING
return = l_has_activex.
if l_has_activex is initial.
raise MISS_GUIDE.
endif.
* Get Container Object of Screen
call method c_oi_container_control_creator=>get_container_control
IMPORTING
control = lo_control
retcode = lC_retcode.
error_doi.
* Initialize Container control
CALL METHOD lo_control->init_control
EXPORTING
parent = CL_GUI_CONTAINER=>DEFAULT_SCREEN
r3_application_name = ''
inplace_enabled = 'X'
no_flush = 'X'
register_on_close_event = 'X'
register_on_custom_event = 'X'
IMPORTING
error = lO_ERROR
retcode = lc_retcode.
error_doi.
* Get Proxy Document:
* check exist of document proxy, if exist -> close first
if not lo_proxy is initial.
close_document.
endif.
IF i_xls is not initial.
* xls format, doctype = soi_doctype_excel97_sheet
l_doctype_excel_sheet = 'Excel.Sheet.8'.
else.
* xlsx format, doctype = soi_doctype_excel_sheet
l_doctype_excel_sheet = 'Excel.Sheet'.
ENDIF.
CALL METHOD lo_control->get_document_proxy
EXPORTING
document_type = l_doctype_excel_sheet
register_container = 'X'
IMPORTING
document_proxy = lo_proxy
error = lO_ERROR
retcode = lc_retcode.
error_doi.
IF I_DOCUMENT_URL is initial.
* create new excel document
call method lo_proxy->create_document
EXPORTING
create_view_data = 'X'
open_inplace = 'X'
no_flush = 'X'
IMPORTING
ERROR = lO_ERROR
retcode = lc_retcode.
error_doi.
else.
* Read excel template for i_DOCUMENT_URL
* this excel template can be store in local or server
CALL METHOD lo_proxy->open_document
EXPORTING
document_url = i_document_url
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
endif.
* Check Spreadsheet Interface of Document Proxy
CALL METHOD lo_proxy->has_spreadsheet_interface
IMPORTING
is_available = li_has
error = lO_ERROR
retcode = lc_retcode.
error_doi.
* create Spreadsheet object
CHECK li_has IS NOT INITIAL.
CALL METHOD lo_proxy->get_spreadsheet_interface
IMPORTING
sheet_interface = lo_spreadsheet
error = lO_ERROR
retcode = lc_retcode.
error_doi.
*--------------------------------------------------------------------*
* SESSION 1: GET LVC DATA FROM ALV OBJECT
*--------------------------------------------------------------------*
* data table
create object lo_grid
EXPORTING
i_parent = CL_GUI_CONTAINER=>SCREEN0.
call method lo_grid->get_alv_attributes
EXPORTING
io_grid = io_alv
IMPORTING
Et_table = lt_alv.
assign lt_alv->* to <f_alv_tab>.
* fieldcat
CALL METHOD iO_alv->GET_FRONTEND_FIELDCATALOG
IMPORTING
ET_FIELDCATALOG = lt_fieldcat_LVC.
* table name
loop at lt_fieldcat_LVC into wa_fieldcat_lvc
where not tabname is initial.
l_tabname = wa_fieldcat_lvc-tabname.
exit.
endloop.
if sy-subrc ne 0.
l_tabname = '1'.
endif.
clear: wa_fieldcat_lvc.
* sort table
CALL METHOD IO_ALV->GET_SORT_CRITERIA
IMPORTING
ET_SORT = lt_sort_lvc.
* filter index
CALL METHOD IO_ALV->GET_FILTERED_ENTRIES
IMPORTING
ET_FILTERED_ENTRIES = lt_filter_idx_lvc.
* group level + subtotal
CALL METHOD IO_ALV->GET_SUBTOTALS
IMPORTING
EP_COLLECT00 = lt_collect00
EP_COLLECT01 = lt_collect01
EP_COLLECT02 = lt_collect02
EP_COLLECT03 = lt_collect03
EP_COLLECT04 = lt_collect04
EP_COLLECT05 = lt_collect05
EP_COLLECT06 = lt_collect06
EP_COLLECT07 = lt_collect07
EP_COLLECT08 = lt_collect08
EP_COLLECT09 = lt_collect09
ET_GROUPLEVELS = lt_GROUPLEVELS_LVC.
assign lt_collect00->* to <f_collect00>.
assign lt_collect01->* to <f_collect01>.
assign lt_collect02->* to <f_collect02>.
assign lt_collect03->* to <f_collect03>.
assign lt_collect04->* to <f_collect04>.
assign lt_collect05->* to <f_collect05>.
assign lt_collect06->* to <f_collect06>.
assign lt_collect07->* to <f_collect07>.
assign lt_collect08->* to <f_collect08>.
assign lt_collect09->* to <f_collect09>.
* transfer to KKBLO struct
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
IT_FIELDCAT_LVC = lt_fieldcat_lvc
IT_SORT_LVC = lt_sort_lvc
IT_FILTER_INDEX_LVC = lt_filter_idx_lvc
IT_GROUPLEVELS_LVC = lt_grouplevels_lvc
IMPORTING
ET_FIELDCAT_KKBLO = lt_fieldcat_kkblo
ET_SORT_KKBLO = lt_sort_kkblo
ET_FILTERED_ENTRIES_KKBLO = lt_filter_idx_kkblo
ET_GROUPLEVELS_KKBLO = lt_grouplevels_kkblo
TABLES
IT_DATA = <f_alv_tab>
EXCEPTIONS
IT_DATA_MISSING = 1
IT_FIELDCAT_LVC_MISSING = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
raise ex_transfer_KKBLO_ERROR.
ENDIF.
clear:
wa_fieldcat_lvc,
lt_fieldcat_lvc,
lt_sort_lvc,
lt_filter_idx_lvc,
lt_GROUPLEVELS_LVC.
clear:
lo_grid.
*--------------------------------------------------------------------*
* SESSION 2: SORT, FILTER AND CALCULATE TOTAL / SUBTOTAL
*--------------------------------------------------------------------*
* append subtotal & total line
create data lt_excel like <f_ALV_TAB>.
assign lt_excel->* to <f_excel_tab>.
loop at <f_alv_tab> assigning <f_line>.
l_save_index = sy-tabix.
* filter base on filter index table
read table LT_FILTER_IDX_KKBLO assigning <f_filter_idx_line>
with key index = l_save_index
binary search.
if sy-subrc ne 0.
append <f_line> to <f_excel_tab>.
endif.
* append subtotal lines
read table LT_GROUPLEVELS_KKBLO assigning <f_grouplevels_line>
with key index_to = l_save_index
binary search.
if sy-subrc = 0.
l_tabix = sy-tabix.
do.
if <f_grouplevels_line>-subtot eq 'X' and
<f_grouplevels_line>-hide_level is initial and
<f_grouplevels_line>-cindex_from ne 0.
* dynamic append subtotal line to excel table base on grouplevel table
* ex <f_GROUPLEVELS_line>-level = 1
* then <f_collect_tab> = '<F_COLLECT01>'
l_collect = <f_grouplevels_line>-level.
condense l_collect.
concatenate '<F_COLLECT0'
l_collect '>'
* '->*'
into l_collect.
assign (l_collect) to <f_collect_tab>.
* incase there're more than 1 total line of group, at the same level
* for example: subtotal of multi currency
LOOP AT <f_collect_tab> assigning <f_collect_line>.
IF sy-tabix between <f_grouplevels_line>-cindex_from
and <f_grouplevels_line>-cindex_to.
append <f_collect_line> to <f_excel_tab>.
* save subtotal lines index
wa_subtot_indexs-index = sy-tabix.
append wa_subtot_indexs to lt_subtot_indexs.
* append sub total ranges table for format later
add 1 to l_sub_index.
subrangeitem-name = l_sub_index.
condense subrangeitem-name.
concatenate 'SUBTOT'
subrangeitem-name
into subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
append subrangeitem to subranges.
clear: subrangeitem.
ENDIF.
ENDLOOP.
unassign: <f_collect_tab>.
unassign: <f_collect_line>.
clear: l_collect.
endif.
* check next subtotal level of group
unassign: <f_grouplevels_line>.
add 1 to l_tabix.
read table LT_GROUPLEVELS_KKBLO assigning <f_grouplevels_line>
index l_tabix.
if sy-subrc ne 0
or <f_grouplevels_line>-index_to ne l_save_index.
exit.
endif.
unassign:
<f_collect_tab>,
<f_collect_line>.
enddo.
endif.
clear:
l_tabix,
l_save_index.
unassign:
<f_filter_idx_line>,
<f_grouplevels_line>.
endloop.
* free local data
unassign:
<f_line>,
<f_collect_tab>,
<f_collect_line>,
<f_fieldcat_line>.
* append grand total line
IF <f_collect00> is assigned.
assign <f_collect00> to <f_collect_tab>.
if <f_collect_tab> is not initial.
LOOP AT <f_collect_tab> assigning <f_collect_line>.
append <f_collect_line> to <f_excel_tab>.
* save total line index
wa_subtot_indexs-index = sy-tabix.
append wa_subtot_indexs to lt_subtot_indexs.
* append grand total range (to format)
add 1 to l_sub_index.
subrangeitem-name = l_sub_index.
condense subrangeitem-name.
concatenate 'TOTAL'
subrangeitem-name
into subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
append subrangeitem to subranges.
ENDLOOP.
endif.
ENDIF.
clear:
subrangeitem,
LT_SORT_KKBLO,
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>.
unassign:
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>,
<f_collect_tab>,
<f_collect_line>.
*--------------------------------------------------------------------*
* SESSION 3: MAP DATA TO SEMANTIC TABLE
*--------------------------------------------------------------------*
* get dependent field field: currency and quantity
create data wa like line of <f_excel_tab>.
assign wa->* to <f_excel_line>.
describe field <f_excel_line> type l_typ components l_num.
do l_num times.
l_save_index = sy-index.
assign component l_save_index of structure <f_excel_line>
to <f_excel_column>.
if sy-subrc ne 0.
message e059(0k) with 'FATAL ERROR' raising fatal_error.
endif.
loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
where tabname = l_tabname.
assign component <f_fieldcat_line>-fieldname
of structure <f_excel_line> to <f_fcat_column>.
describe distance between <f_excel_column> and <f_fcat_column>
into l_int in byte mode.
* append column index
* this columns index is of table, not fieldcat
if l_int = 0.
wa_column_index-fieldname = <f_fieldcat_line>-fieldname.
wa_column_index-tabname = <f_fieldcat_line>-tabname.
wa_column_index-col = l_save_index.
append wa_column_index to lt_column_index.
endif.
* append dependent fields (currency and quantity unit)
if <f_fieldcat_line>-cfieldname is not initial.
clear wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-cfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-ctabname.
collect wa_fieldcat_depf into lt_fieldcat_depf.
endif.
if <f_fieldcat_line>-qfieldname is not initial.
clear wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-qfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-qtabname.
collect wa_fieldcat_depf into lt_fieldcat_depf.
endif.
* rewrite field data type
if <f_fieldcat_line>-inttype = 'X'
and <f_fieldcat_line>-datatype(3) = 'INT'.
<f_fieldcat_line>-inttype = 'I'.
endif.
endloop.
clear: l_save_index.
unassign: <f_fieldcat_line>.
enddo.
* build semantic tables
l_n_hrz_keys = 1.
* Get keyfigures
loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
where tabname = l_tabname
and tech ne 'X'
and no_out ne 'X'.
clear wa_sema.
clear wa_hkey.
* Units belong to keyfigures -> display as str
read table lt_fieldcat_depf into wa_fieldcat_depf with key
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
if sy-subrc = 0.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
* Keyfigures
else.
case <f_fieldcat_line>-datatype.
when 'QUAN'.
wa_sema-col_typ = 'N03'.
if <f_fieldcat_line>-no_sum ne 'X'.
wa_sema-col_ops = 'ADD'.
else.
wa_sema-col_ops = 'NOP'. " no dependent field
endif.
when 'DATS'.
wa_sema-col_typ = 'DAT'.
wa_sema-col_ops = 'NOP'.
when 'CHAR' OR 'UNIT' OR 'CUKY'. " Added fieldformats UNIT and CUKY - dd. 26-10-2012 Wouter Heuvelmans
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'. " dependent field
* incase numeric, ex '00120' -> display as '12'
when 'NUMC'.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
when others.
wa_sema-col_typ = 'NUM'.
if <f_fieldcat_line>-no_sum ne 'X'.
wa_sema-col_ops = 'ADD'.
else.
wa_sema-col_ops = 'NOP'.
endif.
endcase.
endif.
l_counter = l_counter + 1.
l_n_att_cols = l_n_att_cols + 1.
wa_sema-col_no = l_counter.
read table lt_column_index into wa_column_index with key
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
if sy-subrc = 0.
wa_sema-col_src = wa_column_index-col.
else.
raise fatal_error.
endif.
* columns index of ref currency field in table
if not <f_fieldcat_line>-cfieldname is initial.
read table lt_column_index into wa_column_index with key
fieldname = <f_fieldcat_line>-cfieldname
tabname = <f_fieldcat_line>-ctabname.
if sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
endif.
* quantities fields
* treat as currency when display on excel
elseif not <f_fieldcat_line>-qfieldname is initial.
read table lt_column_index into wa_column_index with key
fieldname = <f_fieldcat_line>-qfieldname
tabname = <f_fieldcat_line>-qtabname.
if sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
endif.
endif.
* Treat of fixed currency in the fieldcatalog for column
data: l_num_help(2) type n.
if not <f_fieldcat_line>-currency is initial.
select * from tcurx into table lt_tcurx.
sort lt_tcurx.
read table lt_tcurx into wa_tcurx
with key currkey = <f_fieldcat_line>-currency.
if sy-subrc = 0.
l_num_help = wa_tcurx-currdec.
concatenate 'N' l_num_help into wa_sema-col_typ.
wa_sema-col_cur = sy-tabix * ( -1 ).
endif.
endif.
wa_hkey-col_no = l_n_att_cols.
wa_hkey-row_no = l_n_hrz_keys.
wa_hkey-col_name = <f_fieldcat_line>-reptext.
append wa_hkey to lt_hkey.
append wa_sema to lt_sema.
endloop.
* free local data
clear:
lt_column_index,
wa_column_index,
lt_fieldcat_depf,
wa_fieldcat_depf,
lt_tcurx,
wa_tcurx,
l_num,
l_typ,
wa,
l_int,
l_counter.
unassign:
<f_fieldcat_line>,
<f_excel_line>,
<f_excel_column>,
<f_fcat_column>.
*--------------------------------------------------------------------*
* SESSION 4: WRITE TO EXCEL
*--------------------------------------------------------------------*
clear: wa_tcurx.
refresh: lt_tcurx.
* if spreadsheet dun have proxy yet
if li_has is initial.
l_retcode = c_oi_errors=>ret_interface_not_supported.
call method c_oi_errors=>create_error_for_retcode
EXPORTING
retcode = l_retcode
no_flush = no_flush
IMPORTING
error = lo_error_w.
exit.
endif.
create object l_error
EXPORTING
object_name = 'OLE_DOCUMENT_PROXY'
method_name = 'get_ranges_names'.
call method c_oi_errors=>add_error
EXPORTING
error = l_error.
describe table lt_sema lines datareal.
describe table <f_excel_tab> lines datac.
describe table lt_vkey lines vkeycount.
if datac = 0.
raise inv_data_range.
endif.
if vkeycount ne l_n_vrt_keys.
raise dim_mismatch_vkey.
endif.
all = l_n_vrt_keys + l_n_att_cols.
if datareal ne all.
raise dim_mismatch_sema.
endif.
data: decimal type c.
* get decimal separator format ('.', ',', ...) in Office config
call method lo_proxy->get_application_property
EXPORTING
property_name = 'INTERNATIONAL'
subproperty_name = 'DECIMAL_SEPARATOR'
CHANGING
retvalue = decimal.
data: wa_usr type usr01.
select * from usr01 into wa_usr where bname = sy-uname.
endselect.
data: comma_elim(4) type c.
field-symbols <g> type any.
data search_item(4) value ' #'.
concatenate ',' decimal '.' decimal into comma_elim.
data help type i. " table (with subtotal) line number
help = datac.
data: rowmax type i value 1. " header row number
data: columnmax type i value 0. " header columns number
loop at lt_hkey into hkeyitem.
if hkeyitem-col_no > columnmax.
columnmax = hkeyitem-col_no.
endif.
if hkeyitem-row_no > rowmax.
rowmax = hkeyitem-row_no.
endif.
endloop.
data: hkeycolumns type i. " header columns no
hkeycolumns = columnmax.
if hkeycolumns < l_n_att_cols.
hkeycolumns = l_n_att_cols.
endif.
columnmax = 0.
loop at lt_vkey into vkeyitem.
if vkeyitem-col_no > columnmax.
columnmax = vkeyitem-col_no.
endif.
endloop.
data overflow type i value 1.
data testname(10) type c.
data temp2 type i. " 1st item row position in excel
data realmit type i value 1.
data realoverflow type i value 1. " row index in content
call method lo_spreadsheet->screen_update
EXPORTING
updating = ''.
call method lo_spreadsheet->load_lib.
data: str(40) type c. " range names of columns range (w/o col header)
data: rows type i. " row postion of 1st item line in ecxel
* calculate row position of data table
describe table iT_LISTHEADER lines li_commentary_rows.
* if grid had title, add 1 empy line between title and table
if li_commentary_rows ne 0.
add 1 to li_commentary_rows.
endif.
* add top position of block data
li_commentary_rows = li_commentary_rows + i_top - 1.
* write header (commentary rows)
data: li_commentary_row_index type i value 1.
data: li_content_index type i value 1.
data: ls_index(10) type c.
data ls_commentary_range(40) type c value 'TITLE'.
data: li_font_bold type i.
data: li_font_italic type i.
data: li_font_size type i.
loop at iT_LISTHEADER into wa_listheader.
li_commentary_row_index = i_top + li_content_index - 1.
ls_index = li_content_index.
condense ls_index.
concatenate ls_commentary_range(5) ls_index
into ls_commentary_range.
condense ls_commentary_range.
* insert title range
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = ls_commentary_range
top = li_commentary_row_index
left = i_left
rows = 1
columns = 1
no_flush = no_flush.
* format range
case wa_listheader-typ.
when 'H'. "title
li_font_size = 16.
li_font_bold = 1.
li_font_italic = -1.
when 'S'. "subtile
li_font_size = -1.
li_font_bold = 1.
li_font_italic = -1.
when others. "'A' comment
li_font_size = -1.
li_font_bold = -1.
li_font_italic = 1.
endcase.
call method lo_spreadsheet->set_font
EXPORTING
rangename = ls_commentary_range
family = ''
size = li_font_size
bold = li_font_bold
italic = li_font_italic
align = 0
no_flush = no_flush.
* title: range content
rangeitem-name = ls_commentary_range.
rangeitem-columns = 1.
rangeitem-rows = 1.
append rangeitem to ranges.
contentsitem-row = li_content_index.
contentsitem-column = 1.
concatenate wa_listheader-key
wa_listheader-info
into contentsitem-value
separated by space.
condense contentsitem-value.
append contentsitem to contents.
add 1 to li_content_index.
clear:
rangeitem,
contentsitem,
ls_index.
endloop.
* set range data title
call method lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
refresh:
ranges,
contents.
rows = rowmax + li_commentary_rows + 1.
all = wa_usr-datfm.
all = all + 3.
loop at lt_sema into semaitem.
if semaitem-col_typ = 'DAT' or semaitem-col_typ = 'MON' or
semaitem-col_typ = 'N00' or semaitem-col_typ = 'N01' or
semaitem-col_typ = 'N01' or semaitem-col_typ = 'N02' or
semaitem-col_typ = 'N03' or semaitem-col_typ = 'PCT' or
semaitem-col_typ = 'STR' or semaitem-col_typ = 'NUM'.
clear str.
str = semaitem-col_no.
condense str.
concatenate 'DATA' str into str.
mit = semaitem-col_no.
li_col_pos = semaitem-col_no + i_left - 1.
* range from data1 to data(n), for each columns of table
call method lo_spreadsheet->insert_range_dim
EXPORTING
name = str
top = rows
left = li_col_pos
rows = help
columns = 1
no_flush = no_flush.
data dec type i value -1.
data typeinfo type sydes_typeinfo.
loop at <f_excel_tab> assigning <line>.
assign component semaitem-col_no of structure <line> to <item>.
describe field <item> into td.
read table td-types index 1 into typeinfo.
if typeinfo-type = 'P'.
dec = typeinfo-decimals.
elseif typeinfo-type = 'I'.
dec = 0.
endif.
describe field <line> type typ components count.
mit = 1.
do count times.
if mit = semaitem-col_src.
assign component sy-index of structure <line> to <item>.
describe field <item> into td.
read table td-types index 1 into typeinfo.
if typeinfo-type = 'P'.
dec = typeinfo-decimals.
endif.
exit.
endif.
mit = mit + 1.
enddo.
exit.
endloop.
* format for each columns of table (w/o columns headers)
if semaitem-col_typ = 'DAT'.
if semaitem-col_no > vkeycount.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = all
no_flush = no_flush.
else.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
endif.
elseif semaitem-col_typ = 'STR'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
elseif semaitem-col_typ = 'MON'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 10
no_flush = no_flush.
elseif semaitem-col_typ = 'N00'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 0
no_flush = no_flush.
elseif semaitem-col_typ = 'N01'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 1
no_flush = no_flush.
elseif semaitem-col_typ = 'N02'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
elseif semaitem-col_typ = 'N03'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 3
no_flush = no_flush.
elseif semaitem-col_typ = 'N04'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 4
no_flush = no_flush.
elseif semaitem-col_typ = 'NUM'.
if dec eq -1.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
else.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = dec
no_flush = no_flush.
endif.
elseif semaitem-col_typ = 'PCT'.
call method lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 3
decimals = 0
no_flush = no_flush.
endif.
endif.
endloop.
* get item contents for set_range_data method
* get currency cell also
mit = 1.
data: currcells type soi_cell_table.
data: curritem type soi_cell_item.
curritem-rows = 1.
curritem-columns = 1.
curritem-front = -1.
curritem-back = -1.
curritem-font = ''.
curritem-size = -1.
curritem-bold = -1.
curritem-italic = -1.
curritem-align = -1.
curritem-frametyp = -1.
curritem-framecolor = -1.
curritem-currency = ''.
curritem-number = 1.
curritem-input = -1.
data: const type i.
* Change for Correction request
* Initial 10000 lines are missing in Excel Export
* if there are only 2 columns in exported List object.
if datareal gt 2.
const = 20000 / datareal.
else.
const = 20000 / ( datareal + 2 ).
endif.
data: lines type i.
data: innerlines type i.
data: counter type i.
data: curritem2 like curritem.
data: curritem3 like curritem.
data: length type i.
data: found.
* append content table (for method set_range_content)
loop at <f_excel_tab> assigning <line>.
* save line index to compare with lt_subtot_indexs,
* to discover line is a subtotal / totale line or not
* ex use to set 'dun display zero in subtotal / total line'
l_save_index = sy-tabix.
do datareal times.
read table lt_sema into semaitem with key col_no = sy-index.
if semaitem-col_src ne 0.
assign component semaitem-col_src
of structure <line> to <item>.
else.
assign component sy-index
of structure <line> to <item>.
endif.
contentsitem-row = realoverflow.
if sy-subrc = 0.
move semaitem-col_ops to search_item(3).
search 'ADD#CNT#MIN#MAX#AVG#NOP#DFT#'
for search_item.
if sy-subrc ne 0.
raise error_in_sema.
endif.
move semaitem-col_typ to search_item(3).
search 'NUM#N00#N01#N02#N03#N04#PCT#DAT#MON#STR#'
for search_item.
if sy-subrc ne 0.
raise error_in_sema.
endif.
contentsitem-column = sy-index.
if semaitem-col_typ eq 'DAT' or semaitem-col_typ eq 'MON'.
if semaitem-col_no > vkeycount.
" Hinweis 512418
" EXCEL bezieht Datumsangaben
" auf den 31.12.1899, behandelt
" aber 1900 als ein Schaltjahr
" d.h. ab 1.3.1900 korrekt
" 1.3.1900 als Zahl = 61
data: genesis type d value '18991230'.
data: number_of_days type p.
* change for date in char format & sema_type = X
data: temp_date type d.
if not <item> is initial and not <item> co ' ' and not
<item> co '0'.
* change for date in char format & sema_type = X starts
if sema_type = 'X'.
describe field <item> type typ.
if typ = 'C'.
temp_date = <item>.
number_of_days = temp_date - genesis.
else.
number_of_days = <item> - genesis.
endif.
else.
number_of_days = <item> - genesis.
endif.
* change for date in char format & sema_type = X ends
if number_of_days < 61.
number_of_days = number_of_days - 1.
endif.
set country 'DE'.
write number_of_days to contentsitem-value
no-grouping
left-justified.
set country space.
translate contentsitem-value using comma_elim.
else.
clear contentsitem-value.
endif.
else.
move <item> to contentsitem-value.
endif.
elseif semaitem-col_typ eq 'NUM' or
semaitem-col_typ eq 'N00' or
semaitem-col_typ eq 'N01' or
semaitem-col_typ eq 'N02' or
semaitem-col_typ eq 'N03' or
semaitem-col_typ eq 'N04' or
semaitem-col_typ eq 'PCT'.
set country 'DE'.
describe field <item> type typ.
if semaitem-col_cur is initial.
if typ ne 'F'.
write <item> to contentsitem-value no-grouping
no-sign decimals 14.
else.
write <item> to contentsitem-value no-grouping
no-sign.
endif.
else.
* Treat of fixed curreny for column >>Y9CK007319
if semaitem-col_cur < 0.
semaitem-col_cur = semaitem-col_cur * ( -1 ).
select * from tcurx into table lt_tcurx.
sort lt_tcurx.
read table lt_tcurx into
wa_tcurx index semaitem-col_cur.
if sy-subrc = 0.
if typ ne 'F'.
write <item> to contentsitem-value no-grouping
currency wa_tcurx-currkey no-sign decimals 14.
else.
write <item> to contentsitem-value no-grouping
currency wa_tcurx-currkey no-sign.
endif.
endif.
else.
assign component semaitem-col_cur
of structure <line> to <g>.
* mit = index of recent row
curritem-top = rowmax + mit + li_commentary_rows.
li_col_pos = sy-index + i_left - 1.
curritem-left = li_col_pos.
* if filed is quantity field (qfieldname ne space)
* or amount field (cfieldname ne space), then format decimal place
* corresponding with config
clear: l_def.
read table LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
with key tabname = l_tabname
tech = space
no_out = space
col_pos = semaitem-col_no.
IF sy-subrc = 0.
IF <f_fieldcat_line>-cfieldname is not initial.
l_def = 'C'.
else."if <f_fieldcat_line>-qfieldname is not initial.
l_def = 'Q'.
ENDIF.
ENDIF.
* if field is amount field
* exporting of amount field base on currency decimal table: TCURX
IF l_def = 'C'. "field is amount field
select single * from tcurx into wa_tcurx
where currkey = <g>.
* if amount ref to un-know currency -> default decimal = 2
if sy-subrc eq 0.
curritem-decimals = wa_tcurx-currdec.
else.
curritem-decimals = 2.
endif.
append curritem to currcells.
if typ ne 'F'.
write <item> to contentsitem-value
currency <g>
no-sign no-grouping.
else.
write <item> to contentsitem-value
decimals 14 currency <g>
no-sign no-grouping.
endif.
* if field is quantity field
* exporting of quantity field base on quantity decimal table: T006
else."if l_def = 'Q'. " field is quantity field
clear: wa_t006.
select single * from t006 into wa_t006
where MSEHI = <g>.
* if quantity ref to un-know unit-> default decimal = 2
if sy-subrc eq 0.
curritem-decimals = wa_t006-decan.
else.
curritem-decimals = 2.
endif.
append curritem to currcells.
write <item> to contentsitem-value
unit <g>
no-sign no-grouping.
condense contentsitem-value.
ENDIF.
endif. "Y9CK007319
endif.
condense contentsitem-value.
* add function fieldcat-no zero display
loop at LT_FIELDCAT_KKBLO assigning <f_fieldcat_line>
where tabname = l_tabname
and tech ne 'X'
and no_out ne 'X'.
if <f_fieldcat_line>-col_pos = semaitem-col_no.
if <f_fieldcat_line>-no_zero = 'X'.
if <item> = '0'.
clear: contentsitem-value.
endif.
* dun display zero in total/subtotal line too
else.
clear: wa_subtot_indexs.
read table lt_subtot_indexs into wa_subtot_indexs
with key index = l_save_index.
IF sy-subrc = 0 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.
METHOD bind_table.
*--------------------------------------------------------------------*
* issue #230 - Pimp my Code
* - Stefan Schmöcker, (wi p) 2012-12-01
* - ...
* aligning code
* message made to support multilinguality
*--------------------------------------------------------------------*
* issue #237 - Check if overlapping areas exist
* - Alessandro Iannacci 2012-12-01
* changes: - Added raise if overlaps are detected
*--------------------------------------------------------------------*
CONSTANTS:
lc_top_left_column TYPE zexcel_cell_column_alpha VALUE 'A',
lc_top_left_row TYPE zexcel_cell_row VALUE 1.
DATA:
lv_row_int TYPE zexcel_cell_row,
lv_first_row TYPE zexcel_cell_row,
lv_last_row TYPE zexcel_cell_row,
lv_column_int TYPE zexcel_cell_column,
lv_column_alpha TYPE zexcel_cell_column_alpha,
lt_field_catalog TYPE zexcel_t_fieldcatalog,
lv_id TYPE i,
lv_rows TYPE i,
lv_formula TYPE string,
ls_settings TYPE zexcel_s_table_settings,
lo_table TYPE REF TO zcl_excel_table,
lt_column_name_buffer TYPE SORTED TABLE OF string WITH UNIQUE KEY table_line,
lv_value TYPE string,
lv_value_lowercase TYPE string,
lv_syindex TYPE char3,
lv_errormessage TYPE string, "ins issue #237
lv_columns TYPE i,
lt_columns TYPE zexcel_t_fieldcatalog,
lv_maxcol TYPE i,
lv_maxrow TYPE i,
lo_iterator TYPE REF TO cl_object_collection_iterator,
lo_style_cond TYPE REF TO zcl_excel_style_cond,
lo_curtable TYPE REF TO zcl_excel_table.
FIELD-SYMBOLS:
<ls_field_catalog> TYPE zexcel_s_fieldcatalog,
<ls_field_catalog_custom> TYPE zexcel_s_fieldcatalog,
<fs_table_line> TYPE any,
<fs_fldval> TYPE any.
ls_settings = is_table_settings.
IF ls_settings-top_left_column IS INITIAL.
ls_settings-top_left_column = lc_top_left_column.
ENDIF.
IF ls_settings-table_style IS INITIAL.
ls_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ENDIF.
IF ls_settings-top_left_row IS INITIAL.
ls_settings-top_left_row = lc_top_left_row.
ENDIF.
IF it_field_catalog IS NOT SUPPLIED.
lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = ip_table ).
ELSE.
lt_field_catalog = it_field_catalog.
ENDIF.
SORT lt_field_catalog BY position.
*--------------------------------------------------------------------*
* issue #237 Check if overlapping areas exist Start
*--------------------------------------------------------------------*
"Get the number of columns for the current table
lt_columns = lt_field_catalog.
DELETE lt_columns WHERE dynpfld NE abap_true.
DESCRIBE TABLE lt_columns LINES lv_columns.
"Calculate the top left row of the current table
lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ).
lv_row_int = ls_settings-top_left_row.
"Get number of row for the current table
DESCRIBE TABLE ip_table LINES lv_rows.
"Calculate the bottom right row for the current table
lv_maxcol = lv_column_int + lv_columns - 1.
lv_maxrow = lv_row_int + lv_rows - 1.
ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( lv_maxcol ).
ls_settings-bottom_right_row = lv_maxrow.
lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ).
lo_iterator = me->tables->if_object_collection~get_iterator( ).
WHILE lo_iterator->if_object_collection_iterator~has_next( ) EQ abap_true.
lo_curtable ?= lo_iterator->if_object_collection_iterator~get_next( ).
IF ( ( ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row )
OR
( ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row )
)
AND
( ( lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) )
OR
( lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) )
).
lv_errormessage = 'Table overlaps with previously bound table and will not be added to worksheet.'(400).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
ENDWHILE.
*--------------------------------------------------------------------*
* issue #237 Check if overlapping areas exist End
*--------------------------------------------------------------------*
CREATE OBJECT lo_table.
lo_table->settings = ls_settings.
lo_table->set_data( ir_data = ip_table ).
lv_id = me->excel->get_next_table_id( ).
lo_table->set_id( iv_id = lv_id ).
* lo_table->fieldcat = lt_field_catalog[].
me->tables->add( lo_table ).
* It is better to loop column by column (only visible column)
LOOP AT lt_field_catalog ASSIGNING <ls_field_catalog> WHERE dynpfld EQ abap_true.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
" Due restrinction of new table object we cannot have two column with the same name
" Check if a column with the same name exists, if exists add a counter
" If no medium description is provided we try to use small or long
* lv_value = <ls_field_catalog>-scrtext_m.
FIELD-SYMBOLS: <scrtxt1> TYPE any,
<scrtxt2> TYPE any,
<scrtxt3> TYPE any.
CASE iv_default_descr.
WHEN 'M'.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
WHEN 'S'.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
WHEN 'L'.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt3>.
WHEN OTHERS.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
ENDCASE.
IF <scrtxt1> IS NOT INITIAL.
lv_value = <scrtxt1>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSEIF <scrtxt2> IS NOT INITIAL.
lv_value = <scrtxt2>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSEIF <scrtxt3> IS NOT INITIAL.
lv_value = <scrtxt3>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSE.
lv_value = 'Column'. " default value as Excel does
<ls_field_catalog>-scrtext_l = lv_value.
ENDIF.
WHILE 1 = 1.
lv_value_lowercase = lv_value.
TRANSLATE lv_value_lowercase TO LOWER CASE.
READ TABLE lt_column_name_buffer TRANSPORTING NO FIELDS WITH KEY table_line = lv_value_lowercase BINARY SEARCH.
IF sy-subrc <> 0.
<ls_field_catalog>-scrtext_l = lv_value.
INSERT lv_value_lowercase INTO TABLE lt_column_name_buffer.
EXIT.
ELSE.
lv_syindex = sy-index.
CONCATENATE <ls_field_catalog>-scrtext_l lv_syindex INTO lv_value.
ENDIF.
ENDWHILE.
" First of all write column header
IF <ls_field_catalog>-style_header IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_value
ip_style = <ls_field_catalog>-style_header ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_value ).
ENDIF.
ADD 1 TO lv_row_int.
LOOP AT ip_table ASSIGNING <fs_table_line>.
ASSIGN COMPONENT <ls_field_catalog>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>.
" issue #290 Add formula support in table
IF <ls_field_catalog>-formula EQ abap_true.
IF <ls_field_catalog>-style IS NOT INITIAL.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_abap_type = <ls_field_catalog>-abap_type
ip_style = <ls_field_catalog>-style ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_style = <ls_field_catalog>-style ).
ENDIF.
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. "create empty row if table has no data
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = space ).
ADD 1 TO lv_row_int.
ENDIF.
*--------------------------------------------------------------------*
" totals
*--------------------------------------------------------------------*
IF <ls_field_catalog>-totals_function IS NOT INITIAL.
lv_formula = lo_table->get_totals_formula( ip_column = <ls_field_catalog>-scrtext_l ip_function = <ls_field_catalog>-totals_function ).
IF <ls_field_catalog>-style_total IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = lv_formula
ip_style = <ls_field_catalog>-style_total ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = lv_formula ).
ENDIF.
ENDIF.
lv_row_int = ls_settings-top_left_row.
ADD 1 TO lv_column_int.
*--------------------------------------------------------------------*
" conditional formatting
*--------------------------------------------------------------------*
IF <ls_field_catalog>-style_cond IS NOT INITIAL.
lv_first_row = ls_settings-top_left_row + 1. " +1 to exclude header
lv_last_row = ls_settings-top_left_row + lv_rows.
lo_style_cond = me->get_style_cond( <ls_field_catalog>-style_cond ).
lo_style_cond->set_range( ip_start_column = lv_column_alpha
ip_start_row = lv_first_row
ip_stop_column = lv_column_alpha
ip_stop_row = lv_last_row ).
ENDIF.
ENDLOOP.
*--------------------------------------------------------------------*
" Set field catalog
*--------------------------------------------------------------------*
lo_table->fieldcat = lt_field_catalog[].
es_table_settings = ls_settings.
es_table_settings-bottom_right_column = lv_column_alpha.
" >> Issue #291
IF ip_table IS INITIAL.
es_table_settings-bottom_right_row = ls_settings-top_left_row + 2. "Last rows
ELSE.
es_table_settings-bottom_right_row = ls_settings-top_left_row + lv_rows + 1. "Last rows
ENDIF.
" << Issue #291
ENDMETHOD.
METHOD calculate_cell_width.
*--------------------------------------------------------------------*
* issue #293 - Roberto Bianco
* - Christian Assig 2014-03-14
*
* changes: - Calculate widths using SAPscript font metrics
* (transaction SE73)
* - Calculate the width of dates
* - Add additional width for auto filter buttons
* - Add cell padding to simulate Excel behavior
*--------------------------------------------------------------------*
CONSTANTS:
lc_default_font_name TYPE zexcel_style_font_name VALUE 'Calibri', "#EC NOTEXT
lc_default_font_height TYPE tdfontsize VALUE '110',
lc_excel_cell_padding TYPE float VALUE '0.75'.
DATA: ld_cell_value TYPE zexcel_cell_value,
ld_current_character TYPE c LENGTH 1,
ld_style_guid TYPE zexcel_cell_style,
ls_stylemapping TYPE zexcel_s_stylemapping,
lo_table_object TYPE REF TO object,
lo_table TYPE REF TO zcl_excel_table,
ld_table_top_left_column TYPE zexcel_cell_column,
ld_table_bottom_right_column TYPE zexcel_cell_column,
ld_flag_contains_auto_filter TYPE abap_bool VALUE abap_false,
ld_flag_bold TYPE abap_bool VALUE abap_false,
ld_flag_italic TYPE abap_bool VALUE abap_false,
ld_date TYPE d,
ld_date_char TYPE c LENGTH 50,
ld_font_height TYPE tdfontsize VALUE lc_default_font_height,
lt_itcfc TYPE STANDARD TABLE OF itcfc,
ld_offset TYPE i,
ld_length TYPE i,
ld_uccp TYPE i,
ls_font_metric TYPE mty_s_font_metric,
ld_width_from_font_metrics TYPE i,
ld_font_family TYPE itcfh-tdfamily,
ld_font_name TYPE zexcel_style_font_name VALUE lc_default_font_name,
lt_font_families LIKE STANDARD TABLE OF ld_font_family,
ls_font_cache TYPE mty_s_font_cache.
FIELD-SYMBOLS: <ls_font_cache> TYPE mty_s_font_cache,
<ls_font_metric> TYPE mty_s_font_metric,
<ls_itcfc> TYPE itcfc.
" Determine cell content and cell style
me->get_cell( EXPORTING ip_column = ip_column
ip_row = ip_row
IMPORTING ep_value = ld_cell_value
ep_guid = ld_style_guid ).
" ABAP2XLSX uses tables to define areas containing headers and
" auto-filters. Find out if the current cell is in the header
" of one of these tables.
LOOP AT me->tables->collection INTO lo_table_object.
" Downcast: OBJECT -> ZCL_EXCEL_TABLE
lo_table ?= lo_table_object.
" Convert column letters to corresponding integer values
ld_table_top_left_column =
zcl_excel_common=>convert_column2int(
lo_table->settings-top_left_column ).
ld_table_bottom_right_column =
zcl_excel_common=>convert_column2int(
lo_table->settings-bottom_right_column ).
" Is the current cell part of the table header?
IF ip_column BETWEEN ld_table_top_left_column AND
ld_table_bottom_right_column AND
ip_row EQ lo_table->settings-top_left_row.
" Current cell is part of the table header
" -> Assume that an auto filter is present and that the font is
" bold
ld_flag_contains_auto_filter = abap_true.
ld_flag_bold = abap_true.
ENDIF.
ENDLOOP.
" If a style GUID is present, read style attributes
IF ld_style_guid IS NOT INITIAL.
TRY.
" Read style attributes
ls_stylemapping = me->excel->get_style_to_guid( ld_style_guid ).
" If the current cell contains the default date format,
" convert the cell value to a date and calculate its length
IF ls_stylemapping-complete_style-number_format-format_code =
zcl_excel_style_number_format=>c_format_date_std.
" Convert excel date to ABAP date
ld_date =
zcl_excel_common=>excel_string_to_date( ld_cell_value ).
" Format ABAP date using user's formatting settings
WRITE ld_date TO ld_date_char.
" Remember the formatted date to calculate the cell size
ld_cell_value = ld_date_char.
ENDIF.
" Read the font size and convert it to the font height
" used by SAPscript (multiplication by 10)
IF ls_stylemapping-complete_stylex-font-size = abap_true.
ld_font_height = ls_stylemapping-complete_style-font-size * 10.
ENDIF.
" If set, remember the font name
IF ls_stylemapping-complete_stylex-font-name = abap_true.
ld_font_name = ls_stylemapping-complete_style-font-name.
ENDIF.
" If set, remember whether font is bold and italic.
IF ls_stylemapping-complete_stylex-font-bold = abap_true.
ld_flag_bold = ls_stylemapping-complete_style-font-bold.
ENDIF.
IF ls_stylemapping-complete_stylex-font-italic = abap_true.
ld_flag_italic = ls_stylemapping-complete_style-font-italic.
ENDIF.
CATCH zcx_excel. "#EC NO_HANDLER
" Style GUID is present, but style was not found
" Continue with default values
ENDTRY.
ENDIF.
" Check if the same font (font name and font attributes) was already
" used before
READ TABLE mth_font_cache
WITH TABLE KEY
font_name = ld_font_name
font_height = ld_font_height
flag_bold = ld_flag_bold
flag_italic = ld_flag_italic
ASSIGNING <ls_font_cache>.
IF sy-subrc <> 0.
" Font is used for the first time
" Add the font to our local font cache
ls_font_cache-font_name = ld_font_name.
ls_font_cache-font_height = ld_font_height.
ls_font_cache-flag_bold = ld_flag_bold.
ls_font_cache-flag_italic = ld_flag_italic.
INSERT ls_font_cache INTO TABLE mth_font_cache
ASSIGNING <ls_font_cache>.
" Determine the SAPscript font family name from the Excel
" font name
SELECT tdfamily
FROM tfo01
INTO TABLE lt_font_families
UP TO 1 ROWS
WHERE tdtext = ld_font_name
ORDER BY PRIMARY KEY.
" Check if a matching font family was found
" Fonts can be uploaded from TTF files using transaction SE73
IF lines( lt_font_families ) > 0.
READ TABLE lt_font_families INDEX 1 INTO ld_font_family.
" Load font metrics (returns a table with the size of each letter
" in the font)
CALL FUNCTION 'LOAD_FONT'
EXPORTING
family = ld_font_family
height = ld_font_height
printer = 'SWIN'
bold = ld_flag_bold
italic = ld_flag_italic
TABLES
metric = lt_itcfc
EXCEPTIONS
font_family = 1
codepage = 2
device_type = 3
OTHERS = 4.
IF sy-subrc <> 0.
CLEAR lt_itcfc.
ENDIF.
" For faster access, convert each character number to the actual
" character, and store the characters and their sizes in a hash
" table
LOOP AT lt_itcfc ASSIGNING <ls_itcfc>.
ld_uccp = <ls_itcfc>-cpcharno.
ls_font_metric-char =
cl_abap_conv_in_ce=>uccpi( ld_uccp ).
ls_font_metric-char_width = <ls_itcfc>-tdcwidths.
INSERT ls_font_metric
INTO TABLE <ls_font_cache>-th_font_metrics.
ENDLOOP.
ENDIF.
ENDIF.
" Calculate the cell width
" If available, use font metrics
IF lines( <ls_font_cache>-th_font_metrics ) = 0.
" Font metrics are not available
" -> Calculate the cell width using only the font size
ld_length = strlen( ld_cell_value ).
ep_width = ld_length * ld_font_height / lc_default_font_height + lc_excel_cell_padding.
ELSE.
" Font metrics are available
" Calculate the size of the text by adding the sizes of each
" letter
ld_length = strlen( ld_cell_value ).
DO ld_length TIMES.
" Subtract 1, because the first character is at offset 0
ld_offset = sy-index - 1.
" Read the current character from the cell value
ld_current_character = ld_cell_value+ld_offset(1).
" Look up the size of the current letter
READ TABLE <ls_font_cache>-th_font_metrics
WITH TABLE KEY char = ld_current_character
ASSIGNING <ls_font_metric>.
IF sy-subrc = 0.
" The size of the letter is known
" -> Add the actual size of the letter
ADD <ls_font_metric>-char_width TO ld_width_from_font_metrics.
ELSE.
" The size of the letter is unknown
" -> Add the font height as the default letter size
ADD ld_font_height TO ld_width_from_font_metrics.
ENDIF.
ENDDO.
" Add cell padding (Excel makes columns a bit wider than the space
" that is needed for the text itself) and convert unit
" (division by 100)
ep_width = ld_width_from_font_metrics / 100 + lc_excel_cell_padding.
ENDIF.
" If the current cell contains an auto filter, make it a bit wider.
" The size used by the auto filter button does not depend on the font
" size.
IF ld_flag_contains_auto_filter = abap_true.
ADD 2 TO ep_width.
ENDIF.
ENDMETHOD.
METHOD calculate_column_widths.
TYPES:
BEGIN OF t_auto_size,
col_index TYPE int4,
width TYPE float,
END OF t_auto_size.
TYPES: tt_auto_size TYPE TABLE OF t_auto_size.
DATA: lo_column_iterator TYPE REF TO cl_object_collection_iterator,
lo_column TYPE REF TO zcl_excel_column.
DATA: auto_size TYPE flag.
DATA: auto_sizes TYPE tt_auto_size.
DATA: count TYPE int4.
DATA: highest_row TYPE int4.
DATA: width TYPE float.
FIELD-SYMBOLS: <auto_size> LIKE LINE OF auto_sizes.
lo_column_iterator = me->get_columns_iterator( ).
WHILE lo_column_iterator->has_next( ) = abap_true.
lo_column ?= lo_column_iterator->get_next( ).
auto_size = lo_column->get_auto_size( ).
IF auto_size = abap_true.
APPEND INITIAL LINE TO auto_sizes ASSIGNING <auto_size>.
<auto_size>-col_index = lo_column->get_column_index( ).
<auto_size>-width = -1.
ENDIF.
ENDWHILE.
" There is only something to do if there are some auto-size columns
IF NOT auto_sizes IS INITIAL.
highest_row = me->get_highest_row( ).
LOOP AT auto_sizes ASSIGNING <auto_size>.
count = 1.
WHILE count <= highest_row.
* Do not check merged cells
IF is_cell_merged(
ip_column = <auto_size>-col_index
ip_row = count ) = abap_false.
width = calculate_cell_width( ip_column = <auto_size>-col_index " issue #155 - less restrictive typing for ip_column
ip_row = count ).
IF width > <auto_size>-width.
<auto_size>-width = width.
ENDIF.
ENDIF.
count = count + 1.
ENDWHILE.
lo_column = me->get_column( <auto_size>-col_index ). " issue #155 - less restrictive typing for ip_column
lo_column->set_width( <auto_size>-width ).
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD change_cell_style.
" issue # 139
DATA: stylemapping TYPE zexcel_s_stylemapping,
complete_style TYPE zexcel_s_cstyle_complete,
complete_stylex TYPE zexcel_s_cstylex_complete,
borderx TYPE zexcel_s_cstylex_border,
l_guid TYPE zexcel_cell_style. "issue # 177
* We have a lot of parameters. Use some macros to make the coding more structured
DEFINE clear_initial_colorxfields.
if &1-rgb is initial.
clear &2-rgb.
endif.
if &1-indexed is initial.
clear &2-indexed.
endif.
if &1-theme is initial.
clear &2-theme.
endif.
if &1-tint is initial.
clear &2-tint.
endif.
END-OF-DEFINITION.
DEFINE move_supplied_borders.
if ip_&1 is supplied. " only act if parameter was supplied
if ip_x&1 is supplied. "
borderx = ip_x&1. " use supplied x-parameter
else.
clear borderx with 'X'.
* clear in a way that would be expected to work easily
if ip_&1-border_style is initial.
clear borderx-border_style.
endif.
clear_initial_colorxfields ip_&1-border_color borderx-border_color.
endif.
move-corresponding ip_&1 to complete_style-&2.
move-corresponding borderx to complete_stylex-&2.
endif.
END-OF-DEFINITION.
* First get current stylsettings
TRY.
me->get_cell( EXPORTING ip_column = ip_column " Cell Column
ip_row = ip_row " Cell Row
IMPORTING ep_guid = l_guid )." Cell Value ). "issue # 177
stylemapping = me->excel->get_style_to_guid( l_guid ). "issue # 177
complete_style = stylemapping-complete_style.
complete_stylex = stylemapping-complete_stylex.
CATCH zcx_excel.
* Error --> use submitted style
ENDTRY.
* move_supplied_multistyles: complete.
IF ip_complete IS SUPPLIED.
IF ip_xcomplete IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Complete styleinfo has to be supplied with corresponding X-field'.
ENDIF.
MOVE-CORRESPONDING ip_complete TO complete_style.
MOVE-CORRESPONDING ip_xcomplete TO complete_stylex.
ENDIF.
IF ip_font IS SUPPLIED.
DATA: fontx LIKE ip_xfont.
IF ip_xfont IS SUPPLIED.
fontx = ip_xfont.
ELSE.
* Only supplied values should be used - exception: Flags bold and italic strikethrough underline
MOVE 'X' TO: fontx-bold,
fontx-italic,
fontx-strikethrough,
fontx-underline_mode.
CLEAR fontx-color WITH 'X'.
clear_initial_colorxfields ip_font-color fontx-color.
IF ip_font-family IS NOT INITIAL.
fontx-family = 'X'.
ENDIF.
IF ip_font-name IS NOT INITIAL.
fontx-name = 'X'.
ENDIF.
IF ip_font-scheme IS NOT INITIAL.
fontx-scheme = 'X'.
ENDIF.
IF ip_font-size IS NOT INITIAL.
fontx-size = 'X'.
ENDIF.
IF ip_font-underline_mode IS NOT INITIAL.
fontx-underline_mode = 'X'.
ENDIF.
ENDIF.
MOVE-CORRESPONDING ip_font TO complete_style-font.
MOVE-CORRESPONDING fontx TO complete_stylex-font.
* Correction for undeline mode
ENDIF.
IF ip_fill IS SUPPLIED.
DATA: fillx LIKE ip_xfill.
IF ip_xfill IS SUPPLIED.
fillx = ip_xfill.
ELSE.
CLEAR fillx WITH 'X'.
IF ip_fill-filltype IS INITIAL.
CLEAR fillx-filltype.
ENDIF.
clear_initial_colorxfields ip_fill-fgcolor fillx-fgcolor.
clear_initial_colorxfields ip_fill-bgcolor fillx-bgcolor.
ENDIF.
MOVE-CORRESPONDING ip_fill TO complete_style-fill.
MOVE-CORRESPONDING fillx TO complete_stylex-fill.
ENDIF.
IF ip_borders IS SUPPLIED.
DATA: bordersx LIKE ip_xborders.
IF ip_xborders IS SUPPLIED.
bordersx = ip_xborders.
ELSE.
CLEAR bordersx WITH 'X'.
IF ip_borders-allborders-border_style IS INITIAL.
CLEAR bordersx-allborders-border_style.
ENDIF.
IF ip_borders-diagonal-border_style IS INITIAL.
CLEAR bordersx-diagonal-border_style.
ENDIF.
IF ip_borders-down-border_style IS INITIAL.
CLEAR bordersx-down-border_style.
ENDIF.
IF ip_borders-left-border_style IS INITIAL.
CLEAR bordersx-left-border_style.
ENDIF.
IF ip_borders-right-border_style IS INITIAL.
CLEAR bordersx-right-border_style.
ENDIF.
IF ip_borders-top-border_style IS INITIAL.
CLEAR bordersx-top-border_style.
ENDIF.
clear_initial_colorxfields ip_borders-allborders-border_color bordersx-allborders-border_color.
clear_initial_colorxfields ip_borders-diagonal-border_color bordersx-diagonal-border_color.
clear_initial_colorxfields ip_borders-down-border_color bordersx-down-border_color.
clear_initial_colorxfields ip_borders-left-border_color bordersx-left-border_color.
clear_initial_colorxfields ip_borders-right-border_color bordersx-right-border_color.
clear_initial_colorxfields ip_borders-top-border_color bordersx-top-border_color.
ENDIF.
MOVE-CORRESPONDING ip_borders TO complete_style-borders.
MOVE-CORRESPONDING bordersx TO complete_stylex-borders.
ENDIF.
IF ip_alignment IS SUPPLIED.
DATA: alignmentx LIKE ip_xalignment.
IF ip_xalignment IS SUPPLIED.
alignmentx = ip_xalignment.
ELSE.
CLEAR alignmentx WITH 'X'.
IF ip_alignment-horizontal IS INITIAL.
CLEAR alignmentx-horizontal.
ENDIF.
IF ip_alignment-vertical IS INITIAL.
CLEAR alignmentx-vertical.
ENDIF.
ENDIF.
MOVE-CORRESPONDING ip_alignment TO complete_style-alignment.
MOVE-CORRESPONDING alignmentx TO complete_stylex-alignment.
ENDIF.
IF ip_protection IS SUPPLIED.
MOVE-CORRESPONDING ip_protection TO complete_style-protection.
IF ip_xprotection IS SUPPLIED.
MOVE-CORRESPONDING ip_xprotection TO complete_stylex-protection.
ELSE.
IF ip_protection-hidden IS NOT INITIAL.
complete_stylex-protection-hidden = 'X'.
ENDIF.
IF ip_protection-locked IS NOT INITIAL.
complete_stylex-protection-locked = 'X'.
ENDIF.
ENDIF.
ENDIF.
move_supplied_borders : borders_allborders borders-allborders,
borders_diagonal borders-diagonal ,
borders_down borders-down ,
borders_left borders-left ,
borders_right borders-right ,
borders_top borders-top .
DEFINE move_supplied_singlestyles.
if ip_&1 is supplied.
complete_style-&2 = ip_&1.
complete_stylex-&2 = 'X'.
endif.
END-OF-DEFINITION.
move_supplied_singlestyles: number_format_format_code number_format-format_code,
font_bold font-bold,
font_color font-color,
font_color_rgb font-color-rgb,
font_color_indexed font-color-indexed,
font_color_theme font-color-theme,
font_color_tint font-color-tint,
font_family font-family,
font_italic font-italic,
font_name font-name,
font_scheme font-scheme,
font_size font-size,
font_strikethrough font-strikethrough,
font_underline font-underline,
font_underline_mode font-underline_mode,
fill_filltype fill-filltype,
fill_rotation fill-rotation,
fill_fgcolor fill-fgcolor,
fill_fgcolor_rgb fill-fgcolor-rgb,
fill_fgcolor_indexed fill-fgcolor-indexed,
fill_fgcolor_theme fill-fgcolor-theme,
fill_fgcolor_tint fill-fgcolor-tint,
fill_bgcolor fill-bgcolor,
fill_bgcolor_rgb fill-bgcolor-rgb,
fill_bgcolor_indexed fill-bgcolor-indexed,
fill_bgcolor_theme fill-bgcolor-theme,
fill_bgcolor_tint fill-bgcolor-tint,
fill_gradtype_type fill-gradtype-TYPE,
fill_gradtype_degree fill-gradtype-DEGREE,
fill_gradtype_bottom fill-gradtype-BOTTOM,
fill_gradtype_left fill-gradtype-LEFT,
fill_gradtype_top fill-gradtype-TOP,
fill_gradtype_right fill-gradtype-RIGHT,
fill_gradtype_position1 fill-gradtype-POSITION1,
fill_gradtype_position2 fill-gradtype-POSITION2,
fill_gradtype_position3 fill-gradtype-POSITION3,
borders_diagonal_mode borders-diagonal_mode,
alignment_horizontal alignment-horizontal,
alignment_vertical alignment-vertical,
alignment_textrotation alignment-textrotation,
alignment_wraptext alignment-wraptext,
alignment_shrinktofit alignment-shrinktofit,
alignment_indent alignment-indent,
protection_hidden protection-hidden,
protection_locked protection-locked,
borders_allborders_style borders-allborders-border_style,
borders_allborders_color borders-allborders-border_color,
borders_allbo_color_rgb borders-allborders-border_color-rgb,
borders_allbo_color_indexed borders-allborders-border_color-indexed,
borders_allbo_color_theme borders-allborders-border_color-theme,
borders_allbo_color_tint borders-allborders-border_color-tint,
borders_diagonal_style borders-diagonal-border_style,
borders_diagonal_color borders-diagonal-border_color,
borders_diagonal_color_rgb borders-diagonal-border_color-rgb,
borders_diagonal_color_inde borders-diagonal-border_color-indexed,
borders_diagonal_color_them borders-diagonal-border_color-theme,
borders_diagonal_color_tint borders-diagonal-border_color-tint,
borders_down_style borders-down-border_style,
borders_down_color borders-down-border_color,
borders_down_color_rgb borders-down-border_color-rgb,
borders_down_color_indexed borders-down-border_color-indexed,
borders_down_color_theme borders-down-border_color-theme,
borders_down_color_tint borders-down-border_color-tint,
borders_left_style borders-left-border_style,
borders_left_color borders-left-border_color,
borders_left_color_rgb borders-left-border_color-rgb,
borders_left_color_indexed borders-left-border_color-indexed,
borders_left_color_theme borders-left-border_color-theme,
borders_left_color_tint borders-left-border_color-tint,
borders_right_style borders-right-border_style,
borders_right_color borders-right-border_color,
borders_right_color_rgb borders-right-border_color-rgb,
borders_right_color_indexed borders-right-border_color-indexed,
borders_right_color_theme borders-right-border_color-theme,
borders_right_color_tint borders-right-border_color-tint,
borders_top_style borders-top-border_style,
borders_top_color borders-top-border_color,
borders_top_color_rgb borders-top-border_color-rgb,
borders_top_color_indexed borders-top-border_color-indexed,
borders_top_color_theme borders-top-border_color-theme,
borders_top_color_tint borders-top-border_color-tint.
* Now we have a completly filled styles.
* This can be used to get the guid
* Return guid if requested. Might be used if copy&paste of styles is requested
ep_guid = me->excel->get_static_cellstyle_guid( ip_cstyle_complete = complete_style
ip_cstylex_complete = complete_stylex ).
me->set_cell_style( ip_column = ip_column
ip_row = ip_row
ip_style = ep_guid ).
ENDMETHOD.
METHOD constructor.
DATA: lv_title TYPE zexcel_sheet_title.
me->excel = ip_excel.
* CALL FUNCTION 'GUID_CREATE' " del issue #379 - function is outdated in newer releases
* IMPORTING
* ev_guid_16 = me->guid.
me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ). " ins issue #379 - replacement for outdated function call
IF ip_title IS NOT INITIAL.
lv_title = ip_title.
ELSE.
* lv_title = me->guid. " del issue #154 - Names of worksheets
lv_title = me->generate_title( ). " ins issue #154 - Names of worksheets
ENDIF.
me->set_title( ip_title = lv_title ).
CREATE OBJECT sheet_setup.
CREATE OBJECT styles_cond.
CREATE OBJECT data_validations.
CREATE OBJECT tables.
CREATE OBJECT columns.
CREATE OBJECT rows.
CREATE OBJECT ranges. " issue #163
CREATE OBJECT mo_pagebreaks.
CREATE OBJECT drawings
EXPORTING
ip_type = zcl_excel_drawing=>type_image.
CREATE OBJECT charts
EXPORTING
ip_type = zcl_excel_drawing=>type_chart.
me->zif_excel_sheet_protection~initialize( ).
me->zif_excel_sheet_properties~initialize( ).
CREATE OBJECT hyperlinks.
* initialize active cell coordinates
active_cell-cell_row = 1.
active_cell-cell_column = 1.
* inizialize dimension range
lower_cell-cell_row = 1.
lower_cell-cell_column = 1.
upper_cell-cell_row = 1.
upper_cell-cell_column = 1.
ENDMETHOD.
METHOD delete_merge.
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.
METHOD delete_row_outline.
DELETE me->mt_row_outlines WHERE row_from = iv_row_from
AND row_to = iv_row_to.
IF sy-subrc <> 0. " didn't find outline that was to be deleted
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Row outline to be deleted does not exist'.
ENDIF.
ENDMETHOD.
method FREEZE_PANES.
IF ip_num_columns IS NOT SUPPLIED AND ip_num_rows IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Pleas provide number of rows and/or columns to freeze'.
ENDIF.
IF ip_num_columns IS SUPPLIED AND ip_num_columns <= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Number of columns to freeze should be positive'.
ENDIF.
IF ip_num_rows IS SUPPLIED AND ip_num_rows <= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Number of rows to freeze should be positive'.
ENDIF.
freeze_pane_cell_column = ip_num_columns + 1.
freeze_pane_cell_row = ip_num_rows + 1.
endmethod.
method GENERATE_TITLE.
DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator,
lo_worksheet TYPE REF TO zcl_excel_worksheet.
DATA: t_titles TYPE HASHED TABLE OF zexcel_sheet_title WITH UNIQUE KEY table_line,
title TYPE zexcel_sheet_title,
sheetnumber TYPE i.
* Get list of currently used titles
lo_worksheets_iterator = me->excel->get_worksheets_iterator( ).
WHILE lo_worksheets_iterator->has_next( ) = abap_true.
lo_worksheet ?= lo_worksheets_iterator->get_next( ).
title = lo_worksheet->get_title( ).
INSERT title INTO TABLE t_titles.
ADD 1 TO sheetnumber.
ENDWHILE.
* Now build sheetnumber. Increase counter until we hit a number that is not used so far
ADD 1 TO sheetnumber. " Start counting with next number
DO.
title = sheetnumber.
SHIFT title LEFT DELETING LEADING space.
CONCATENATE 'Sheet'(001) title INTO ep_title.
INSERT ep_title INTO TABLE t_titles.
IF sy-subrc = 0. " Title not used so far --> take it
EXIT.
ENDIF.
ADD 1 TO sheetnumber.
ENDDO.
endmethod.
method GET_ACTIVE_CELL.
DATA: lv_active_column TYPE zexcel_cell_column_alpha,
lv_active_row TYPE string.
lv_active_column = zcl_excel_common=>convert_column2alpha( active_cell-cell_column ).
lv_active_row = active_cell-cell_row.
SHIFT lv_active_row RIGHT DELETING TRAILING space.
SHIFT lv_active_row LEFT DELETING LEADING space.
CONCATENATE lv_active_column lv_active_row INTO ep_active_cell.
endmethod.
METHOD get_cell.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE sheet_content INTO ls_sheet_content WITH TABLE KEY cell_row = ip_row
cell_column = lv_column.
ep_rc = sy-subrc.
ep_value = ls_sheet_content-cell_value.
ep_guid = ls_sheet_content-cell_style. " issue 139 - added this to be used for columnwidth calculation
ep_formula = ls_sheet_content-cell_formula.
" Addition to solve issue #120, contribution by Stefan Schmöcker
DATA: style_iterator TYPE REF TO cl_object_collection_iterator,
style TYPE REF TO zcl_excel_style.
IF ep_style IS REQUESTED.
style_iterator = me->excel->get_styles_iterator( ).
WHILE style_iterator->has_next( ) = 'X'.
style ?= style_iterator->get_next( ).
IF style->get_guid( ) = ls_sheet_content-cell_style.
ep_style = style.
EXIT.
ENDIF.
ENDWHILE.
ENDIF.
ENDMETHOD.
METHOD get_column.
DATA: lo_column_iterator TYPE REF TO cl_object_collection_iterator,
lo_column TYPE REF TO zcl_excel_column,
lv_column TYPE zexcel_cell_column.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
lo_column_iterator = me->get_columns_iterator( ).
WHILE lo_column_iterator->has_next( ) = abap_true.
lo_column ?= lo_column_iterator->get_next( ).
IF lo_column->get_column_index( ) = lv_column.
eo_column = lo_column.
EXIT.
ENDIF.
ENDWHILE.
IF eo_column IS NOT BOUND.
eo_column = me->add_new_column( ip_column ).
ENDIF.
ENDMETHOD.
METHOD get_columns.
eo_columns = me->columns.
ENDMETHOD.
METHOD GET_COLUMNS_ITERATOR.
eo_iterator = me->columns->get_iterator( ).
ENDMETHOD.
method GET_DATA_VALIDATIONS_ITERATOR.
eo_iterator = me->data_validations->get_iterator( ).
endmethod.
method GET_DATA_VALIDATIONS_SIZE.
ep_size = me->data_validations->size( ).
endmethod.
METHOD GET_DEFAULT_COLUMN.
IF me->column_default IS NOT BOUND.
CREATE OBJECT me->column_default
EXPORTING
ip_index = 'A' " ????
ip_worksheet = me
ip_excel = me->excel.
ENDIF.
eo_column = me->column_default.
ENDMETHOD.
method GET_DEFAULT_EXCEL_DATE_FORMAT.
CONSTANTS: c_lang_e TYPE lang VALUE 'E'.
IF default_excel_date_format IS NOT INITIAL.
ep_default_excel_date_format = default_excel_date_format.
RETURN.
ENDIF.
"try to get defaults
TRY.
cl_abap_datfm=>get_date_format_des( EXPORTING im_langu = c_lang_e
IMPORTING ex_dateformat = default_excel_date_format ).
CATCH cx_abap_datfm_format_unknown.
ENDTRY.
" and fallback to fixed format
IF default_excel_date_format IS INITIAL.
default_excel_date_format = zcl_excel_style_number_format=>c_format_date_ddmmyyyydot.
ENDIF.
ep_default_excel_date_format = default_excel_date_format.
endmethod.
method GET_DEFAULT_EXCEL_TIME_FORMAT.
DATA: l_timefm TYPE xutimefm.
IF default_excel_time_format IS NOT INITIAL.
ep_default_excel_time_format = default_excel_time_format.
RETURN.
ENDIF.
* Let's get default
l_timefm = cl_abap_timefm=>get_environment_timefm( ).
CASE l_timefm.
WHEN 0.
*0 24 Hour Format (Example: 12:05:10)
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6.
WHEN 1.
*1 12 Hour Format (Example: 12:05:10 PM)
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN 2.
*2 12 Hour Format (Example: 12:05:10 pm) for now all the same. no chnage upper lower
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN 3.
*3 Hours from 0 to 11 (Example: 00:05:10 PM) for now all the same. no chnage upper lower
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN 4.
*4 Hours from 0 to 11 (Example: 00:05:10 pm) for now all the same. no chnage upper lower
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time2.
WHEN OTHERS.
" and fallback to fixed format
default_excel_time_format = zcl_excel_style_number_format=>c_format_date_time6.
ENDCASE.
ep_default_excel_time_format = default_excel_time_format.
endmethod.
METHOD get_default_row.
IF me->row_default IS NOT BOUND.
CREATE OBJECT me->row_default.
ENDIF.
eo_row = me->row_default.
ENDMETHOD.
method GET_DIMENSION_RANGE.
me->update_dimension_range( ).
IF upper_cell EQ lower_cell. "only one cell
" Worksheet not filled
* IF upper_cell-cell_coords = '0'.
IF upper_cell-cell_coords IS INITIAL.
ep_dimension_range = 'A1'.
ELSE.
ep_dimension_range = upper_cell-cell_coords.
ENDIF.
ELSE.
CONCATENATE upper_cell-cell_coords ':' lower_cell-cell_coords INTO ep_dimension_range.
ENDIF.
endmethod.
method GET_DRAWINGS.
DATA: lo_drawing TYPE REF TO zcl_excel_drawing,
lo_iterator TYPE REF TO cl_object_collection_iterator.
CASE ip_type.
WHEN zcl_excel_drawing=>type_image.
r_drawings = drawings.
WHEN zcl_excel_drawing=>type_chart.
r_drawings = charts.
WHEN space.
CREATE OBJECT r_drawings
EXPORTING
ip_type = ''.
lo_iterator = drawings->get_iterator( ).
WHILE lo_iterator->has_next( ) = abap_true.
lo_drawing ?= lo_iterator->get_next( ).
r_drawings->include( lo_drawing ).
ENDWHILE.
lo_iterator = charts->get_iterator( ).
WHILE lo_iterator->has_next( ) = abap_true.
lo_drawing ?= lo_iterator->get_next( ).
r_drawings->include( lo_drawing ).
ENDWHILE.
WHEN OTHERS.
ENDCASE.
endmethod.
method GET_DRAWINGS_ITERATOR.
CASE ip_type.
WHEN zcl_excel_drawing=>type_image.
eo_iterator = drawings->get_iterator( ).
WHEN zcl_excel_drawing=>type_chart.
eo_iterator = charts->get_iterator( ).
ENDCASE.
endmethod.
method GET_FREEZE_CELL.
ep_row = me->freeze_pane_cell_row.
ep_column = me->freeze_pane_cell_column.
endmethod.
METHOD get_guid.
ep_guid = me->guid.
ENDMETHOD.
method GET_HIGHEST_COLUMN.
me->update_dimension_range( ).
r_highest_column = me->lower_cell-cell_column.
endmethod.
METHOD get_highest_row.
me->update_dimension_range( ).
r_highest_row = me->lower_cell-cell_row.
ENDMETHOD.
method GET_HYPERLINKS_ITERATOR.
eo_iterator = hyperlinks->get_iterator( ).
endmethod.
method GET_HYPERLINKS_SIZE.
ep_size = hyperlinks->size( ).
endmethod.
METHOD get_merge.
FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells.
DATA: lv_col_from TYPE string,
lv_col_to TYPE string,
lv_row_from TYPE string,
lv_row_to TYPE string,
lv_merge_range TYPE string.
LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>.
lv_col_from = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_from ).
lv_col_to = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_to ).
lv_row_from = <ls_merged_cell>-row_from.
lv_row_to = <ls_merged_cell>-row_to .
CONCATENATE lv_col_from lv_row_from ':' lv_col_to lv_row_to
INTO lv_merge_range.
CONDENSE lv_merge_range NO-GAPS.
APPEND lv_merge_range TO merge_range.
ENDLOOP.
ENDMETHOD.
method GET_PAGEBREAKS.
ro_pagebreaks = mo_pagebreaks.
endmethod.
method GET_RANGES_ITERATOR.
eo_iterator = me->ranges->get_iterator( ).
endmethod.
METHOD get_row.
DATA: lo_row_iterator TYPE REF TO cl_object_collection_iterator,
lo_row TYPE REF TO zcl_excel_row.
lo_row_iterator = me->get_rows_iterator( ).
WHILE lo_row_iterator->has_next( ) = abap_true.
lo_row ?= lo_row_iterator->get_next( ).
IF lo_row->get_row_index( ) = ip_row.
eo_row = lo_row.
EXIT.
ENDIF.
ENDWHILE.
IF eo_row IS NOT BOUND.
eo_row = me->add_new_row( ip_row ).
ENDIF.
ENDMETHOD.
METHOD GET_ROWS.
eo_rows = me->rows.
ENDMETHOD.
METHOD get_rows_iterator.
eo_iterator = me->rows->get_iterator( ).
ENDMETHOD.
METHOD get_row_outlines.
rt_row_outlines = me->mt_row_outlines.
ENDMETHOD.
METHOD get_style_cond.
DATA: lo_style_iterator TYPE REF TO cl_object_collection_iterator,
lo_style_cond TYPE REF TO zcl_excel_style_cond.
lo_style_iterator = me->get_style_cond_iterator( ).
WHILE lo_style_iterator->has_next( ) = abap_true.
lo_style_cond ?= lo_style_iterator->get_next( ).
IF lo_style_cond->get_guid( ) = ip_guid.
eo_style_cond = lo_style_cond.
EXIT.
ENDIF.
ENDWHILE.
ENDMETHOD.
METHOD get_style_cond_iterator.
eo_iterator = styles_cond->get_iterator( ).
ENDMETHOD.
method GET_TABCOLOR.
ev_tabcolor = me->tabcolor.
endmethod.
METHOD get_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_col TYPE int4.
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.
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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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_errormessage = |{ 'Error at assigning field (Col:'(004) } { lv_actual_col } { ' Row:'(005) } { lv_actual_row }|.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 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
lv_errormessage = |{ 'Error at reading field value (Col:'(007) } { lv_actual_col } { ' Row:'(005) } { lv_actual_row }|.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
<lv_value> = lv_value.
* 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_errormessage = |{ 'Error at assigning field (Col:'(004) } { lv_actual_col } { ' Row:'(005) } { lv_actual_row }|.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
CATCH cx_sy_assign_cast_unknown_type.
lv_errormessage = |{ 'Error at assigning field (Col:'(004) } { lv_actual_col } { ' Row:'(005) } { lv_actual_row }|.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
CATCH cx_sy_assign_out_of_range.
lv_errormessage = 'Internal table has less columns than excel'(003).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
CATCH cx_sy_conversion_error.
lv_errormessage = |{ 'Error at converting field value (Col:'(006) } { lv_actual_col } { ' Row:'(005) } { lv_actual_row }|.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDTRY.
ENDMETHOD.
method GET_TABLES_ITERATOR.
eo_iterator = tables->if_object_collection~get_iterator( ).
endmethod.
method GET_TABLES_SIZE.
ep_size = tables->if_object_collection~size( ).
endmethod.
method GET_TITLE.
DATA lv_value TYPE string.
IF ip_escaped EQ abap_true.
lv_value = me->title.
ep_title = zcl_excel_common=>escape_string( lv_value ).
ELSE.
ep_title = me->title.
ENDIF.
endmethod.
METHOD get_value_type.
DATA: lo_addit TYPE REF TO cl_abap_elemdescr,
ls_dfies TYPE dfies,
l_function TYPE funcname,
l_value(50) TYPE c.
ep_value = ip_value.
ep_value_type = cl_abap_typedescr=>typekind_string. " Thats our default if something goes wrong.
TRY.
lo_addit ?= cl_abap_typedescr=>describe_by_data( ip_value ).
CATCH cx_sy_move_cast_error.
CLEAR lo_addit.
ENDTRY.
IF lo_addit IS BOUND.
lo_addit->get_ddic_field( RECEIVING p_flddescr = ls_dfies
EXCEPTIONS not_found = 1
no_ddic_type = 2
OTHERS = 3 ) .
IF sy-subrc = 0.
ep_value_type = ls_dfies-inttype.
IF ls_dfies-convexit IS NOT INITIAL.
* We need to convert with output conversion function
CONCATENATE 'CONVERSION_EXIT_' ls_dfies-convexit '_OUTPUT' INTO l_function.
SELECT SINGLE funcname INTO l_function
FROM tfdir
WHERE funcname = l_function.
IF sy-subrc = 0.
CALL FUNCTION l_function
EXPORTING
input = ip_value
IMPORTING
* LONG_TEXT =
output = l_value
* SHORT_TEXT =
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
TRY.
ep_value = l_value.
CATCH cx_root.
ep_value = ip_value.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
ELSE.
ep_value_type = lo_addit->get_data_type_kind( ip_value ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD is_cell_merged.
DATA: lv_column TYPE i.
FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
rp_is_merged = abap_false. " Assume not in merged area
LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>.
IF <ls_merged_cell>-col_from <= lv_column
AND <ls_merged_cell>-col_to >= lv_column
AND <ls_merged_cell>-row_from <= ip_row
AND <ls_merged_cell>-row_to >= ip_row.
rp_is_merged = abap_true. " until we are proven different
RETURN.
ENDIF.
ENDLOOP.
ENDMETHOD.
method PRINT_TITLE_SET_RANGE.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmoecker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lo_range_iterator TYPE REF TO cl_object_collection_iterator,
lo_range TYPE REF TO zcl_excel_range,
lv_repeat_range_sheetname TYPE string,
lv_repeat_range_col TYPE string,
lv_row_char_from TYPE char10,
lv_row_char_to TYPE char10,
lv_repeat_range_row TYPE string,
lv_repeat_range TYPE string.
*--------------------------------------------------------------------*
* Get range that represents printarea
* if non-existant, create it
*--------------------------------------------------------------------*
lo_range_iterator = me->get_ranges_iterator( ).
WHILE lo_range_iterator->has_next( ) = abap_true.
lo_range ?= lo_range_iterator->get_next( ).
IF lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name.
EXIT. " Found it
ENDIF.
CLEAR lo_range.
ENDWHILE.
IF me->print_title_col_from IS INITIAL AND
me->print_title_row_from IS INITIAL.
*--------------------------------------------------------------------*
* No print titles are present,
*--------------------------------------------------------------------*
IF lo_range IS BOUND.
me->ranges->remove( lo_range ).
ENDIF.
ELSE.
*--------------------------------------------------------------------*
* Print titles are present,
*--------------------------------------------------------------------*
IF lo_range IS NOT BOUND.
lo_range = me->add_new_range( ).
lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name.
ENDIF.
lv_repeat_range_sheetname = me->get_title( ).
lv_repeat_range_sheetname = zcl_excel_common=>escape_string( lv_repeat_range_sheetname ).
*--------------------------------------------------------------------*
* Repeat-columns
*--------------------------------------------------------------------*
IF me->print_title_col_from IS NOT INITIAL.
CONCATENATE lv_repeat_range_sheetname
'!$' me->print_title_col_from
':$' me->print_title_col_to
INTO lv_repeat_range_col.
ENDIF.
*--------------------------------------------------------------------*
* Repeat-rows
*--------------------------------------------------------------------*
IF me->print_title_row_from IS NOT INITIAL.
lv_row_char_from = me->print_title_row_from.
lv_row_char_to = me->print_title_row_to.
CONCATENATE '!$' lv_row_char_from
':$' lv_row_char_to
INTO lv_repeat_range_row.
CONDENSE lv_repeat_range_row NO-GAPS.
CONCATENATE lv_repeat_range_sheetname
lv_repeat_range_row
INTO lv_repeat_range_row.
ENDIF.
*--------------------------------------------------------------------*
* Concatenate repeat-rows and columns
*--------------------------------------------------------------------*
IF lv_repeat_range_col IS INITIAL.
lv_repeat_range = lv_repeat_range_row.
ELSEIF lv_repeat_range_row IS INITIAL.
lv_repeat_range = lv_repeat_range_col.
ELSE.
CONCATENATE lv_repeat_range_col lv_repeat_range_row
INTO lv_repeat_range SEPARATED BY ','.
ENDIF.
lo_range->set_range_value( lv_repeat_range ).
ENDIF.
endmethod.
method SET_CELL.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data,
lv_row_alpha TYPE string,
lv_col_alpha TYPE zexcel_cell_column_alpha,
lv_value TYPE zexcel_cell_value,
lv_data_type TYPE zexcel_cell_data_type,
lv_value_type TYPE abap_typekind,
lv_style_guid TYPE zexcel_cell_style,
lo_addit TYPE REF TO cl_abap_elemdescr,
lo_value TYPE REF TO data,
lo_value_new TYPE REF TO data.
FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data,
<fs_numeric> TYPE numeric,
<fs_date> TYPE d,
<fs_time> TYPE t,
<fs_value> TYPE simple.
IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Please provide the value or formula'.
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* lv_style_guid = ip_style.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH TABLE KEY cell_row = ip_row " Changed to access via table key , Stefan Schmöcker, 2013-08-03
cell_column = lv_column.
IF sy-subrc = 0.
IF ip_style IS INITIAL.
" If no style is provided as method-parameter and cell is found use cell's current style
lv_style_guid = <fs_sheet_content>-cell_style.
ELSE.
" Style provided as method-parameter --> use this
lv_style_guid = ip_style.
ENDIF.
ELSE.
" No cell found --> use supplied style even if empty
lv_style_guid = ip_style.
ENDIF.
* End of change issue #152 - don't touch exisiting style if only value is passed
IF ip_value IS SUPPLIED.
"if data type is passed just write the value. Otherwise map abap type to excel and perform conversion
"IP_DATA_TYPE is passed by excel reader so source types are preserved
*First we get reference into local var.
CREATE DATA lo_value LIKE ip_value.
ASSIGN lo_value->* TO <fs_value>.
<fs_value> = ip_value.
IF ip_data_type IS SUPPLIED.
IF ip_abap_type IS NOT SUPPLIED.
get_value_type( EXPORTING ip_value = ip_value
IMPORTING ep_value = <fs_value> ) .
ENDIF.
lv_value = <fs_value>.
lv_data_type = ip_data_type.
ELSE.
IF ip_abap_type IS SUPPLIED.
lv_value_type = ip_abap_type.
ELSE.
get_value_type( EXPORTING ip_value = ip_value
IMPORTING ep_value = <fs_value>
ep_value_type = lv_value_type ).
ENDIF.
CASE lv_value_type.
WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2.
lo_addit = cl_abap_elemdescr=>get_i( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_numeric>.
IF sy-subrc = 0.
<fs_numeric> = <fs_value>.
lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ).
ENDIF.
WHEN cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_packed.
lo_addit = cl_abap_elemdescr=>get_f( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_numeric>.
IF sy-subrc = 0.
<fs_numeric> = <fs_value>.
lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ).
ENDIF.
WHEN cl_abap_typedescr=>typekind_char OR cl_abap_typedescr=>typekind_string OR cl_abap_typedescr=>typekind_num OR
cl_abap_typedescr=>typekind_hex.
lv_value = <fs_value>.
lv_data_type = 's'.
WHEN cl_abap_typedescr=>typekind_date.
lo_addit = cl_abap_elemdescr=>get_d( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_date>.
IF sy-subrc = 0.
<fs_date> = <fs_value>.
lv_value = zcl_excel_common=>date_to_excel_string( ip_value = <fs_date> ) .
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* Moved to end of routine - apply date-format even if other styleinformation is passed
* IF ip_style IS NOT SUPPLIED. "get default date format in case parameter is initial
* lo_style = excel->add_new_style( ).
* lo_style->number_format->format_code = get_default_excel_date_format( ).
* lv_style_guid = lo_style->get_guid( ).
* ENDIF.
* End of change issue #152 - don't touch exisiting style if only value is passed
WHEN cl_abap_typedescr=>typekind_time.
lo_addit = cl_abap_elemdescr=>get_t( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_time>.
IF sy-subrc = 0.
<fs_time> = <fs_value>.
lv_value = zcl_excel_common=>time_to_excel_string( ip_value = <fs_time> ).
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* Moved to end of routine - apply time-format even if other styleinformation is passed
* IF ip_style IS NOT SUPPLIED. "get default time format for user in case parameter is initial
* lo_style = excel->add_new_style( ).
* lo_style->number_format->format_code = zcl_excel_style_number_format=>c_format_date_time6.
* lv_style_guid = lo_style->get_guid( ).
* ENDIF.
* End of change issue #152 - don't touch exisiting style if only value is passed
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Invalid data type of input value'.
ENDCASE.
ENDIF.
ENDIF.
IF ip_hyperlink IS BOUND.
ip_hyperlink->set_cell_reference( ip_column = ip_column
ip_row = ip_row ).
me->hyperlinks->add( ip_hyperlink ).
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* Read table moved up, so that current style may be evaluated
* lv_column = zcl_excel_common=>convert_column2int( ip_column ).
* READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row
* cell_column = lv_column.
*
* IF sy-subrc EQ 0.
IF <fs_sheet_content> IS ASSIGNED.
* End of change issue #152 - don't touch exisiting style if only value is passed
<fs_sheet_content>-cell_value = lv_value.
<fs_sheet_content>-cell_formula = ip_formula.
<fs_sheet_content>-cell_style = lv_style_guid.
<fs_sheet_content>-data_type = lv_data_type.
ELSE.
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column.
ls_sheet_content-cell_value = lv_value.
ls_sheet_content-cell_formula = ip_formula.
ls_sheet_content-cell_style = lv_style_guid.
ls_sheet_content-data_type = lv_data_type.
lv_row_alpha = ip_row.
* SHIFT lv_row_alpha RIGHT DELETING TRAILING space."del #152 - replaced with condense - should be faster
* SHIFT lv_row_alpha LEFT DELETING LEADING space. "del #152 - replaced with condense - should be faster
CONDENSE lv_row_alpha NO-GAPS. "ins #152 - replaced 2 shifts - should be faster
lv_col_alpha = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column
CONCATENATE lv_col_alpha lv_row_alpha INTO ls_sheet_content-cell_coords. " issue #155 - less restrictive typing for ip_column
INSERT ls_sheet_content INTO TABLE sheet_content ASSIGNING <fs_sheet_content>. "ins #152 - Now <fs_sheet_content> always holds the data
* APPEND ls_sheet_content TO sheet_content.
* SORT sheet_content BY cell_row cell_column.
" me->update_dimension_range( ).
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* For Date- or Timefields change the formatcode if nothing is set yet
* Enhancement option: Check if existing formatcode is a date/ or timeformat
* If not, use default
DATA: lo_format_code_datetime TYPE zexcel_number_format.
DATA: stylemapping TYPE zexcel_s_stylemapping.
CASE lv_value_type.
WHEN cl_abap_typedescr=>typekind_date.
TRY.
stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ).
CATCH zcx_excel .
ENDTRY.
IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR
stylemapping-complete_style-number_format-format_code IS INITIAL.
lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_std.
ELSE.
lo_format_code_datetime = stylemapping-complete_style-number_format-format_code.
ENDIF.
me->change_cell_style( ip_column = ip_column
ip_row = ip_row
ip_number_format_format_code = lo_format_code_datetime ).
WHEN cl_abap_typedescr=>typekind_time.
TRY.
stylemapping = me->excel->get_style_to_guid( <fs_sheet_content>-cell_style ).
CATCH zcx_excel .
ENDTRY.
IF stylemapping-complete_stylex-number_format-format_code IS INITIAL OR
stylemapping-complete_style-number_format-format_code IS INITIAL.
lo_format_code_datetime = zcl_excel_style_number_format=>c_format_date_time6.
ELSE.
lo_format_code_datetime = stylemapping-complete_style-number_format-format_code.
ENDIF.
me->change_cell_style( ip_column = ip_column
ip_row = ip_row
ip_number_format_format_code = lo_format_code_datetime ).
ENDCASE.
* End of change issue #152 - don't touch exisiting style if only value is passed
* Fix issue #162
lv_value = ip_value.
IF lv_value CS cl_abap_char_utilities=>cr_lf.
me->change_cell_style( ip_column = ip_column
ip_row = ip_row
ip_alignment_wraptext = abap_true ).
ENDIF.
* End of Fix issue #162
endmethod.
method SET_CELL_FORMULA.
DATA:
lv_column TYPE zexcel_cell_column,
ls_sheet_content LIKE LINE OF me->sheet_content.
FIELD-SYMBOLS:
<sheet_content> LIKE LINE OF me->sheet_content.
*--------------------------------------------------------------------*
* Get cell to set formula into
*--------------------------------------------------------------------*
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE me->sheet_content ASSIGNING <sheet_content> WITH TABLE KEY cell_row = ip_row
cell_column = lv_column.
IF sy-subrc <> 0. " Create new entry in sheet_content if necessary
CHECK ip_formula IS INITIAL. " no need to create new entry in sheet_content when no formula is passed
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column.
INSERT ls_sheet_content INTO TABLE me->sheet_content ASSIGNING <sheet_content>.
ENDIF.
*--------------------------------------------------------------------*
* Fieldsymbol now holds the relevant cell
*--------------------------------------------------------------------*
<sheet_content>-cell_formula = ip_formula.
endmethod.
METHOD set_cell_style.
DATA: lv_column TYPE zexcel_cell_column,
lv_style_guid TYPE zexcel_cell_style.
FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data.
lv_style_guid = ip_style.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH KEY cell_row = ip_row
cell_column = lv_column.
IF sy-subrc EQ 0.
<fs_sheet_content>-cell_style = lv_style_guid.
ELSE.
set_cell( ip_column = ip_column ip_row = ip_row ip_value = '' ip_style = ip_style ).
ENDIF.
ENDMETHOD.
method SET_COLUMN_WIDTH.
DATA: lo_column TYPE REF TO zcl_excel_column.
DATA: width TYPE float.
lo_column = me->get_column( ip_column ).
* if a fix size is supplied use this
IF ip_width_fix IS SUPPLIED.
TRY.
width = ip_width_fix.
IF width <= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Please supply a positive number as column-width'.
ENDIF.
lo_column->set_width( width ).
EXIT.
CATCH cx_sy_conversion_no_number.
* Strange stuff passed --> raise error
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Unable to interpret supplied input as number'.
ENDTRY.
ENDIF.
* If we get down to here, we have to use whatever is found in autosize.
lo_column->set_auto_size( ip_width_autosize ).
endmethod.
method SET_DEFAULT_EXCEL_DATE_FORMAT.
IF ip_default_excel_date_format IS INITIAL.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Default date format cannot be blank'.
ENDIF.
default_excel_date_format = ip_default_excel_date_format.
endmethod.
METHOD set_merge.
DATA: ls_merge TYPE mty_merge,
lv_errormessage TYPE string.
*--------------------------------------------------------------------*
* Build new range area to insert into range table
*--------------------------------------------------------------------*
ls_merge-row_from = ip_row.
IF ip_row IS SUPPLIED AND ip_row IS NOT INITIAL AND ip_row_to IS NOT SUPPLIED.
ls_merge-row_to = ls_merge-row_from.
ELSE.
ls_merge-row_to = ip_row_to.
ENDIF.
IF ls_merge-row_from > ls_merge-row_to.
lv_errormessage = 'Merge: First row larger then last row'(405).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
ls_merge-col_from = zcl_excel_common=>convert_column2int( ip_column_start ).
IF ip_column_start IS SUPPLIED AND ip_column_start IS NOT INITIAL AND ip_column_end IS NOT SUPPLIED.
ls_merge-col_to = ls_merge-col_from.
ELSE.
ls_merge-col_to = zcl_excel_common=>convert_column2int( ip_column_end ).
ENDIF.
IF ls_merge-col_from > ls_merge-col_to.
lv_errormessage = 'Merge: First column larger then last column'(406).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
*--------------------------------------------------------------------*
* Check merge not overlapping with existing merges
*--------------------------------------------------------------------*
LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS WHERE NOT ( row_from > ls_merge-row_to
OR row_to < ls_merge-row_from
OR col_from > ls_merge-col_to
OR col_to < ls_merge-col_from ).
lv_errormessage = 'Overlapping merges'(404).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDLOOP.
*--------------------------------------------------------------------*
* Everything seems ok --> add to merge table
*--------------------------------------------------------------------*
INSERT ls_merge INTO TABLE me->mt_merged_cells.
ENDMETHOD.
method SET_PRINT_GRIDLINES.
me->print_gridlines = i_print_gridlines.
endmethod.
METHOD set_row_height.
DATA: lo_row TYPE REF TO zcl_excel_row.
DATA: height TYPE float.
lo_row = me->get_row( ip_row ).
* if a fix size is supplied use this
TRY.
height = ip_height_fix.
IF height <= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Please supply a positive number as row-height'.
ENDIF.
lo_row->set_row_height( height ).
EXIT.
CATCH cx_sy_conversion_no_number.
* Strange stuff passed --> raise error
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Unable to interpret supplied input as number'.
ENDTRY.
ENDMETHOD.
METHOD set_row_outline.
DATA: ls_row_outline LIKE LINE OF me->mt_row_outlines.
FIELD-SYMBOLS: <ls_row_outline> LIKE LINE OF me->mt_row_outlines.
READ TABLE me->mt_row_outlines ASSIGNING <ls_row_outline> WITH TABLE KEY row_from = iv_row_from
row_to = iv_row_to.
IF sy-subrc <> 0.
IF iv_row_from <= 0.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'First row of outline must be a positive number'.
ENDIF.
IF iv_row_to < iv_row_from.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Last row of outline may not be less than first line of outline'.
ENDIF.
ls_row_outline-row_from = iv_row_from.
ls_row_outline-row_to = iv_row_to.
INSERT ls_row_outline INTO TABLE me->mt_row_outlines ASSIGNING <ls_row_outline>.
ENDIF.
CASE iv_collapsed.
WHEN abap_true
OR abap_false.
<ls_row_outline>-collapsed = iv_collapsed.
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Unknown collapse state'.
ENDCASE.
ENDMETHOD.
method SET_SHOW_GRIDLINES.
me->show_gridlines = i_show_gridlines.
endmethod.
method SET_SHOW_ROWCOLHEADERS.
me->show_rowcolheaders = i_show_rowcolheaders.
endmethod.
method SET_TABCOLOR.
me->tabcolor = iv_tabcolor.
endmethod.
method SET_TABLE.
DATA: lo_tabdescr TYPE REF TO cl_abap_structdescr,
lr_data TYPE REF TO data,
ls_header TYPE x030l,
lt_dfies TYPE ddfields,
lv_row_int TYPE zexcel_cell_row,
lv_column_int TYPE zexcel_cell_column,
lv_column_alpha TYPE zexcel_cell_column_alpha,
lv_cell_value TYPE zexcel_cell_value.
FIELD-SYMBOLS: <fs_table_line> TYPE ANY,
<fs_fldval> TYPE ANY,
<fs_dfies> TYPE dfies.
lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ).
lv_row_int = ip_top_left_row.
CREATE DATA lr_data LIKE LINE OF ip_table.
lo_tabdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ).
ls_header = lo_tabdescr->get_ddic_header( ).
lt_dfies = lo_tabdescr->get_ddic_field_list( ).
* It is better to loop column by column
LOOP AT lt_dfies ASSIGNING <fs_dfies>.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
IF ip_no_header = abap_false.
" First of all write column header
lv_cell_value = <fs_dfies>-scrtext_m.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_cell_value
ip_style = ip_hdr_style ).
IF ip_transpose = abap_true.
ADD 1 TO lv_column_int.
ELSE.
ADD 1 TO lv_row_int.
ENDIF.
ENDIF.
LOOP AT ip_table ASSIGNING <fs_table_line>.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
ASSIGN COMPONENT <fs_dfies>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>.
MOVE <fs_fldval> TO lv_cell_value.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval> "lv_cell_value
ip_style = ip_body_style ).
IF ip_transpose = abap_true.
ADD 1 TO lv_column_int.
ELSE.
ADD 1 TO lv_row_int.
ENDIF.
ENDLOOP.
IF ip_transpose = abap_true.
lv_column_int = zcl_excel_common=>convert_column2int( ip_top_left_column ).
ADD 1 TO lv_row_int.
ELSE.
lv_row_int = ip_top_left_row.
ADD 1 TO lv_column_int.
ENDIF.
ENDLOOP.
endmethod.
method SET_TITLE.
*--------------------------------------------------------------------*
* ToDos:
* 2do §1 The current coding for replacing a named ranges name
* after renaming a sheet should be checked if it is
* really working if sheetname should be escaped
*--------------------------------------------------------------------*
*--------------------------------------------------------------------*
* issue #230 - Pimp my Code
* - Stefan Schmoecker, (wip ) 2012-12-08
* - ...
* changes: aligning code
* message made to support multilinguality
*--------------------------------------------------------------------*
* issue#243 - ' is not allowed as first character in sheet title
* - Stefan Schmoecker, 2012-12-02
* changes: added additional check for ' as first character
*--------------------------------------------------------------------*
DATA: lo_worksheets_iterator TYPE REF TO cl_object_collection_iterator,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
errormessage TYPE string,
lv_rangesheetname_old TYPE string,
lv_rangesheetname_new TYPE string,
lo_ranges_iterator TYPE REF TO cl_object_collection_iterator,
lo_range TYPE REF TO zcl_excel_range,
lv_range_value TYPE zexcel_range_value,
lv_errormessage TYPE string. " Can't pass '...'(abc) to exception-class
*--------------------------------------------------------------------*
* Check whether title consists only of allowed characters
* Illegal characters are: / \ [ ] * ? : --> http://msdn.microsoft.com/en-us/library/ff837411.aspx
* Illegal characters not in documentation: ' as first character
*--------------------------------------------------------------------*
IF ip_title CA '/\[]*?:'.
lv_errormessage = 'Found illegal character in sheetname. List of forbidden characters: /\[]*?:'(402).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
IF ip_title IS NOT INITIAL AND ip_title(1) = `'`.
lv_errormessage = 'Sheetname may not start with &'(403). " & used instead of ' to allow fallbacklanguage
REPLACE '&' IN lv_errormessage WITH `'`.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
*--------------------------------------------------------------------*
* Check whether title is unique in workbook
*--------------------------------------------------------------------*
lo_worksheets_iterator = me->excel->get_worksheets_iterator( ).
WHILE lo_worksheets_iterator->has_next( ) = 'X'.
lo_worksheet ?= lo_worksheets_iterator->get_next( ).
CHECK me->guid <> lo_worksheet->get_guid( ). " Don't check against itself
IF ip_title = lo_worksheet->get_title( ). " Not unique --> raise exception
errormessage = 'Duplicate sheetname &'.
REPLACE '&' IN errormessage WITH ip_title.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = errormessage.
ENDIF.
ENDWHILE.
*--------------------------------------------------------------------*
* Remember old sheetname and rename sheet to desired name
*--------------------------------------------------------------------*
CONCATENATE me->title '!' INTO lv_rangesheetname_old.
me->title = ip_title.
*--------------------------------------------------------------------*
* After changing this worksheet's title we have to adjust
* all ranges that are referring to this worksheet.
*--------------------------------------------------------------------*
* 2do §1 - Check if the following quickfix is solid
* I fear it isn't - but this implementation is better then
* nothing at all since it handles a supposed majority of cases
*--------------------------------------------------------------------*
CONCATENATE me->title '!' INTO lv_rangesheetname_new.
lo_ranges_iterator = me->excel->get_ranges_iterator( ).
WHILE lo_ranges_iterator->has_next( ) = 'X'.
lo_range ?= lo_ranges_iterator->get_next( ).
lv_range_value = lo_range->get_value( ).
REPLACE ALL OCCURRENCES OF lv_rangesheetname_old IN lv_range_value WITH lv_rangesheetname_new.
IF sy-subrc = 0.
lo_range->set_range_value( lv_range_value ).
ENDIF.
ENDWHILE.
endmethod.
METHOD update_dimension_range.
DATA: ls_sheet_content TYPE zexcel_s_cell_data,
lt_sheet_content TYPE zexcel_t_cell_data_unsorted,
lv_row_alpha TYPE string,
lv_column_alpha TYPE zexcel_cell_column_alpha.
CHECK sheet_content IS NOT INITIAL.
* update dimension range
lt_sheet_content = sheet_content.
"upper left corner
SORT lt_sheet_content BY cell_row.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
upper_cell-cell_row = ls_sheet_content-cell_row.
SORT lt_sheet_content BY cell_column.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
upper_cell-cell_column = ls_sheet_content-cell_column.
lv_row_alpha = upper_cell-cell_row.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( upper_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO upper_cell-cell_coords.
"bottom right corner
SORT lt_sheet_content BY cell_row DESCENDING.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
lower_cell-cell_row = ls_sheet_content-cell_row.
SORT lt_sheet_content BY cell_column DESCENDING.
READ TABLE lt_sheet_content INDEX 1 INTO ls_sheet_content.
lower_cell-cell_column = ls_sheet_content-cell_column.
lv_row_alpha = lower_cell-cell_row.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lower_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO lower_cell-cell_coords.
ENDMETHOD.
method ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_COLUMNS.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
CLEAR: me->print_title_col_from,
me->print_title_col_to .
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
endmethod.
method ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_ROWS.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
CLEAR: me->print_title_row_from,
me->print_title_row_to .
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
endmethod.
method ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_COLUMNS.
ev_columns_from = me->print_title_col_from.
ev_columns_to = me->print_title_col_to.
endmethod.
method ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_ROWS.
ev_rows_from = me->print_title_row_from.
ev_rows_to = me->print_title_row_to.
endmethod.
method ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_COLUMNS.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmöcker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lv_col_from_int TYPE i,
lv_col_to_int TYPE i,
lv_errormessage TYPE string.
lv_col_from_int = zcl_excel_common=>convert_column2int( iv_columns_from ).
lv_col_to_int = zcl_excel_common=>convert_column2int( iv_columns_to ).
*--------------------------------------------------------------------*
* Check if valid range is supplied
*--------------------------------------------------------------------*
IF lv_col_from_int < 1.
lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
IF lv_col_from_int > lv_col_to_int.
lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
me->print_title_col_from = iv_columns_from.
me->print_title_col_to = iv_columns_to.
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
endmethod.
method ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_ROWS.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmöcker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lv_errormessage TYPE string.
*--------------------------------------------------------------------*
* Check if valid range is supplied
*--------------------------------------------------------------------*
IF iv_rows_from < 1.
lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
IF iv_rows_from > iv_rows_to.
lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401).
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = lv_errormessage.
ENDIF.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
me->print_title_row_from = iv_rows_from.
me->print_title_row_to = iv_rows_to.
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
endmethod.
method ZIF_EXCEL_SHEET_PROPERTIES~GET_STYLE.
IF zif_excel_sheet_properties~style IS NOT INITIAL.
ep_style = zif_excel_sheet_properties~style.
ELSE.
ep_style = me->excel->get_default_style( ).
ENDIF.
endmethod.
method ZIF_EXCEL_SHEET_PROPERTIES~INITIALIZE.
zif_excel_sheet_properties~show_zeros = zif_excel_sheet_properties=>c_showzero.
zif_excel_sheet_properties~summarybelow = zif_excel_sheet_properties=>c_below_on.
zif_excel_sheet_properties~summaryright = zif_excel_sheet_properties=>c_right_on.
* inizialize zoomscale values
ZIF_EXCEL_SHEET_PROPERTIES~zoomscale = 100.
ZIF_EXCEL_SHEET_PROPERTIES~zoomscale_normal = 100.
ZIF_EXCEL_SHEET_PROPERTIES~zoomscale_pagelayoutview = 100 .
ZIF_EXCEL_SHEET_PROPERTIES~zoomscale_sheetlayoutview = 100 .
endmethod.
method ZIF_EXCEL_SHEET_PROPERTIES~SET_STYLE.
zif_excel_sheet_properties~style = ip_style.
endmethod.
method ZIF_EXCEL_SHEET_PROTECTION~INITIALIZE.
me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_unprotected.
CLEAR me->zif_excel_sheet_protection~password.
me->zif_excel_sheet_protection~auto_filter = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~delete_columns = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~delete_rows = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~format_cells = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~format_columns = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~format_rows = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~insert_columns = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~insert_hyperlinks = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~insert_rows = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~objects = zif_excel_sheet_protection=>c_noactive.
* me->zif_excel_sheet_protection~password = zif_excel_sheet_protection=>c_noactive. "issue #68
me->zif_excel_sheet_protection~pivot_tables = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~protected = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~scenarios = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~select_locked_cells = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~select_unlocked_cells = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~sheet = zif_excel_sheet_protection=>c_noactive.
me->zif_excel_sheet_protection~sort = zif_excel_sheet_protection=>c_noactive.
endmethod.
method ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME.
me->zif_excel_sheet_vba_project~codename = ip_codename.
endmethod.
method ZIF_EXCEL_SHEET_VBA_PROJECT~SET_CODENAME_PR.
me->zif_excel_sheet_vba_project~codename_pr = ip_codename_pr.
endmethod.
ENDCLASS.
| [
4871,
1168,
5097,
62,
6369,
34,
3698,
62,
33249,
9693,
36,
2767,
6770,
198,
220,
1171,
198,
220,
2251,
1171,
764,
198,
198,
11377,
2665,
13,
198,
9,
1,
9,
1171,
6805,
286,
1398,
1168,
5097,
62,
6369,
34,
3698,
62,
33249,
9693,
36,
2767,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
2099,
12,
7742,
82,
9564,
2969,
764,
628,
220,
20314,
1168,
5064,
62,
6369,
34,
3698,
62,
9693,
36,
2767,
62,
4805,
1268,
4694,
2767,
51,
20754,
764,
198,
220,
20314,
1168,
5064,
62,
6369,
34,
3698,
62,
9693,
36,
2767,
62,
4805,
3185,
17395,
11015,
764,
198,
220,
20314,
1168,
5064,
62,
6369,
34,
3698,
62,
9693,
36,
2767,
62,
4805,
2394,
24565,
764,
198,
220,
20314,
1168,
5064,
62,
6369,
34,
3698,
62,
9693,
36,
2767,
62,
53,
4339,
62,
31190,
23680,
764,
628,
220,
3858,
25,
198,
220,
220,
220,
2221,
286,
220,
337,
9936,
62,
50,
62,
12425,
24027,
62,
49,
3913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
62,
6738,
220,
2099,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
62,
1462,
220,
220,
220,
2099,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14707,
2099,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
220,
220,
886,
286,
285,
774,
62,
82,
62,
448,
1370,
62,
808,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
337,
9936,
62,
4694,
62,
12425,
34509,
1546,
62,
49,
3913,
2099,
23243,
3084,
286,
337,
9936,
62,
50,
62,
12425,
24027,
62,
49,
3913,
351,
3748,
1994,
5752,
62,
6738,
5752,
62,
1462,
764,
628,
220,
38491,
327,
62,
40438,
10206,
62,
25154,
5883,
45,
2099,
1168,
6369,
34,
3698,
62,
40438,
10206,
1988,
362,
13,
25113,
2943,
5626,
13918,
198,
220,
38491,
327,
62,
40438,
10206,
62,
45,
11651,
2099,
1168,
6369,
34,
3698,
62,
40438,
10206,
1988,
657,
13,
25113,
2943,
5626,
13918,
198,
220,
38491,
327,
62,
40438,
10206,
62,
49,
3913,
2099,
1168,
6369,
34,
3698,
62,
40438,
10206,
1988,
352,
13,
25113,
2943,
5626,
13918,
198,
220,
1366,
7788,
34,
3698,
2099,
1006,
284,
1168,
5097,
62,
6369,
34,
3698,
1100,
12,
8807,
764,
198,
220,
1366,
4810,
12394,
62,
10761,
2389,
34509,
1546,
2099,
1168,
6369,
34,
3698,
62,
4805,
12394,
62,
10761,
2389,
34509,
1546,
1100,
12,
8807,
1988,
9564,
2969,
62,
37,
23719,
13,
25113,
2943,
5626,
13918,
764,
366,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
198,
220,
1366,
48052,
2767,
62,
37815,
3525,
2099,
1168,
6369,
34,
3698,
62,
51,
62,
5222,
3069,
62,
26947,
764,
198,
220,
1366,
48052,
2767,
62,
28480,
8577,
2099,
1006,
284,
1168,
5097,
62,
6369,
34,
3698,
62,
9693,
36,
2767,
62,
28480,
8577,
764,
198,
220,
1366,
37041,
62,
10761,
2389,
34509,
1546,
2099,
1168,
6369,
34,
3698,
62,
9693,
3913,
62,
10761,
2389,
34509,
1546,
1100,
12,
8807,
1988,
9564,
2969,
62,
5446,
8924,
13,
25113,
2943,
5626,
13918,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
198,
220,
1366,
37041,
62,
49,
3913,
25154,
37682,
4877,
2099,
1168,
6369,
34,
3698,
62,
9693,
3913,
62,
10761,
2389,
34509,
1546,
1100,
12,
8807,
1988,
9564,
2969,
62,
5446,
8924,
13,
25113,
2943,
5626,
13918,
764,
366,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
220,
764,
198,
220,
1366,
3563,
56,
28378,
2099,
1168,
6369,
34,
3698,
62,
51,
62,
9693,
36,
2767,
62,
2257,
56,
2538,
764,
198,
220,
1366,
21664,
2749,
3535,
1581,
2099,
1168,
6369,
34,
3698,
62,
50,
62,
5603,
2749,
3535,
1581,
1100,
12,
8807,
764,
628,
220,
5050,
27841,
62,
35,
20530,
2751,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
4061,
62,
35,
20530,
2751,
2099,
1006,
284,
1168,
5097,
62,
6369,
34,
3698,
62,
35,
20530,
2751,
764,
198,
220,
5050,
27841,
62,
13965,
62,
25154,
5883,
45,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
4061,
62,
25154,
5883,
45,
2099,
23749,
16437,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_services_git DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS pull
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS reset
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS create_branch
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS switch_branch
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS delete_branch
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS delete_tag
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS switch_tag
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS tag_overview
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS commit
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo_online
!is_commit TYPE zif_abapgit_services_git=>ty_commit_fields
!io_stage TYPE REF TO zcl_abapgit_stage
RAISING
zcx_abapgit_exception.
CLASS-METHODS checkout_commit
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
PROTECTED SECTION.
TYPES: BEGIN OF ty_commit_value_tab,
sha1 TYPE zif_abapgit_definitions=>ty_sha1,
message TYPE c LENGTH 50,
datetime TYPE c LENGTH 20,
END OF ty_commit_value_tab.
TYPES: ty_commit_value_tab_tt TYPE STANDARD TABLE OF ty_commit_value_tab WITH DEFAULT KEY .
CLASS-METHODS get_unnecessary_local_objs
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
RETURNING
VALUE(rt_unnecessary_local_objects) TYPE zif_abapgit_definitions=>ty_tadir_tt
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
CLASS-METHODS checkout_commit_build_list
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo_online
EXPORTING
et_value_tab TYPE ty_commit_value_tab_tt
et_commits TYPE zif_abapgit_definitions=>ty_commit_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS checkout_commit_build_popup
IMPORTING
!it_commits TYPE zif_abapgit_definitions=>ty_commit_tt
!it_value_tab TYPE ty_commit_value_tab_tt
RETURNING
VALUE(rs_selected_commit) TYPE zif_abapgit_definitions=>ty_commit
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_services_git IMPLEMENTATION.
METHOD checkout_commit.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
lt_value_tab TYPE ty_commit_value_tab_tt,
lt_commits TYPE zif_abapgit_definitions=>ty_commit_tt,
ls_selected_commit TYPE zif_abapgit_definitions=>ty_commit.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
IF lo_repo->get_local_settings( )-write_protected = abap_true.
zcx_abapgit_exception=>raise( 'Cannot checkout. Local code is write-protected by repo config.' ).
ENDIF.
checkout_commit_build_list(
EXPORTING
io_repo = lo_repo
IMPORTING
et_value_tab = lt_value_tab
et_commits = lt_commits ).
ls_selected_commit = checkout_commit_build_popup( it_commits = lt_commits
it_value_tab = lt_value_tab ).
lo_repo->select_commit( ls_selected_commit-sha1 ).
COMMIT WORK AND WAIT.
ENDMETHOD.
METHOD checkout_commit_build_list.
DATA: lv_unix_time TYPE zcl_abapgit_time=>ty_unixtime,
lv_date TYPE sy-datum,
lv_date_string TYPE c LENGTH 12,
lv_time TYPE sy-uzeit,
lv_time_string TYPE c LENGTH 10.
FIELD-SYMBOLS: <ls_commit> TYPE zif_abapgit_definitions=>ty_commit,
<ls_value_tab> TYPE ty_commit_value_tab.
CLEAR: et_commits, et_value_tab.
et_commits = zcl_abapgit_git_commit=>get_by_branch( iv_branch_name = io_repo->get_selected_branch( )
iv_repo_url = io_repo->get_url( )
iv_deepen_level = 99 )-commits.
DELETE et_commits WHERE sha1 = io_repo->get_selected_commit( ).
SORT et_commits BY time DESCENDING.
IF et_commits IS INITIAL.
zcx_abapgit_exception=>raise( |No commits are available in this branch.| ).
ENDIF.
LOOP AT et_commits ASSIGNING <ls_commit>.
APPEND INITIAL LINE TO et_value_tab ASSIGNING <ls_value_tab>.
<ls_value_tab>-sha1 = <ls_commit>-sha1.
<ls_value_tab>-message = <ls_commit>-message.
lv_unix_time = <ls_commit>-time.
zcl_abapgit_time=>get_utc(
EXPORTING
iv_unix = lv_unix_time
IMPORTING
ev_time = lv_time
ev_date = lv_date ).
WRITE: lv_date TO lv_date_string,
lv_time TO lv_time_string.
<ls_value_tab>-datetime = |{ lv_date_string }, | &&
|{ lv_time_string }|.
ENDLOOP.
ENDMETHOD.
METHOD checkout_commit_build_popup.
DATA: lt_columns TYPE zif_abapgit_definitions=>ty_alv_column_tt,
li_popups TYPE REF TO zif_abapgit_popups,
lt_selected_values TYPE ty_commit_value_tab_tt.
FIELD-SYMBOLS: <ls_value_tab> TYPE ty_commit_value_tab,
<ls_column> TYPE zif_abapgit_definitions=>ty_alv_column.
APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>.
<ls_column>-name = 'SHA1'.
<ls_column>-text = 'Hash'.
<ls_column>-length = 8.
APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>.
<ls_column>-name = 'MESSAGE'.
<ls_column>-text = 'Message'.
APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>.
<ls_column>-name = 'DATETIME'.
<ls_column>-text = 'Datetime'.
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->popup_to_select_from_list(
EXPORTING
it_list = it_value_tab
iv_title = |Checkout Commit|
iv_end_column = 83
iv_striped_pattern = abap_true
iv_optimize_col_width = abap_false
iv_selection_mode = if_salv_c_selection_mode=>single
it_columns_to_display = lt_columns
IMPORTING
et_list = lt_selected_values ).
IF lt_selected_values IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
READ TABLE lt_selected_values
ASSIGNING <ls_value_tab>
INDEX 1.
IF <ls_value_tab> IS NOT ASSIGNED.
zcx_abapgit_exception=>raise( |Though result set of popup wasn't empty selected value couldn't retrieved.| ).
ENDIF.
READ TABLE it_commits
INTO rs_selected_commit
WITH KEY sha1 = <ls_value_tab>-sha1.
ENDMETHOD.
METHOD commit.
DATA: ls_comment TYPE zif_abapgit_definitions=>ty_comment,
li_user TYPE REF TO zif_abapgit_persist_user.
li_user = zcl_abapgit_persistence_user=>get_instance( ).
li_user->set_repo_git_user_name( iv_url = io_repo->get_url( )
iv_username = is_commit-committer_name ).
li_user->set_repo_git_user_email( iv_url = io_repo->get_url( )
iv_email = is_commit-committer_email ).
IF is_commit-committer_name IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: Committer name empty' ).
ELSEIF is_commit-committer_email IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: Committer email empty' ).
ELSEIF is_commit-author_email IS NOT INITIAL AND is_commit-author_name IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: Author name empty' ). " Opposite should be OK ?
ELSEIF is_commit-comment IS INITIAL.
zcx_abapgit_exception=>raise( 'Commit: empty comment' ).
ENDIF.
ls_comment-committer-name = is_commit-committer_name.
ls_comment-committer-email = is_commit-committer_email.
ls_comment-author-name = is_commit-author_name.
ls_comment-author-email = is_commit-author_email.
ls_comment-comment = is_commit-comment.
IF NOT is_commit-body IS INITIAL.
CONCATENATE ls_comment-comment '' is_commit-body
INTO ls_comment-comment SEPARATED BY zif_abapgit_definitions=>c_newline.
ENDIF.
io_repo->push( is_comment = ls_comment
io_stage = io_stage ).
COMMIT WORK.
ENDMETHOD.
METHOD create_branch.
DATA: lv_name TYPE string,
lv_cancel TYPE abap_bool,
lo_repo TYPE REF TO zcl_abapgit_repo_online,
lv_msg TYPE string,
li_popups TYPE REF TO zif_abapgit_popups,
lv_source_branch_name TYPE string.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
lv_source_branch_name = lo_repo->get_selected_branch( ).
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->create_branch_popup(
EXPORTING
iv_source_branch_name = lv_source_branch_name
IMPORTING
ev_name = lv_name
ev_cancel = lv_cancel ).
IF lv_cancel = abap_true.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
lo_repo->create_branch( lv_name ).
lv_msg = |Branch switched from { zcl_abapgit_git_branch_list=>get_display_name( lv_source_branch_name )
} to new branch { zcl_abapgit_git_branch_list=>get_display_name( lv_name ) }|.
MESSAGE lv_msg TYPE 'S'.
ENDMETHOD.
METHOD delete_branch.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_branch TYPE zif_abapgit_definitions=>ty_git_branch,
lv_msg TYPE string,
li_popups TYPE REF TO zif_abapgit_popups.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
ls_branch = li_popups->branch_list_popup( iv_url = lo_repo->get_url( )
iv_hide_branch = lo_repo->get_selected_branch( )
iv_hide_head = abap_true ).
IF ls_branch IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
zcl_abapgit_git_porcelain=>delete_branch(
iv_url = lo_repo->get_url( )
is_branch = ls_branch ).
lv_msg = |Branch { ls_branch-display_name } deleted|.
MESSAGE lv_msg TYPE 'S'.
ENDMETHOD.
METHOD delete_tag.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_tag TYPE zif_abapgit_definitions=>ty_git_tag,
lv_text TYPE string.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
ls_tag = zcl_abapgit_ui_factory=>get_tag_popups( )->tag_select_popup( lo_repo ).
IF ls_tag IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
zcl_abapgit_git_porcelain=>delete_tag(
iv_url = lo_repo->get_url( )
is_tag = ls_tag ).
lv_text = |Tag { zcl_abapgit_git_tag=>remove_tag_prefix( ls_tag-name ) } deleted|.
MESSAGE lv_text TYPE 'S'.
ENDMETHOD.
METHOD get_unnecessary_local_objs.
DATA: lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt,
lt_tadir_unique TYPE HASHED TABLE OF zif_abapgit_definitions=>ty_tadir
WITH UNIQUE KEY pgmid object obj_name,
lt_status TYPE zif_abapgit_definitions=>ty_results_tt,
lv_package TYPE zif_abapgit_persistence=>ty_repo-package.
FIELD-SYMBOLS: <ls_status> TYPE zif_abapgit_definitions=>ty_result,
<ls_tadir> TYPE zif_abapgit_definitions=>ty_tadir.
" delete objects which are added locally but are not in remote repo
lt_status = io_repo->status( ).
lv_package = io_repo->get_package( ).
lt_tadir = zcl_abapgit_factory=>get_tadir( )->read( lv_package ).
SORT lt_tadir BY pgmid ASCENDING object ASCENDING obj_name ASCENDING devclass ASCENDING.
LOOP AT lt_status ASSIGNING <ls_status>
WHERE lstate = zif_abapgit_definitions=>c_state-added
OR rstate = zif_abapgit_definitions=>c_state-deleted.
READ TABLE lt_tadir ASSIGNING <ls_tadir>
WITH KEY pgmid = 'R3TR'
object = <ls_status>-obj_type
obj_name = <ls_status>-obj_name
devclass = <ls_status>-package
BINARY SEARCH.
IF sy-subrc <> 0.
* skip objects that does not exist locally
CONTINUE.
ENDIF.
INSERT <ls_tadir> INTO TABLE lt_tadir_unique.
ENDLOOP.
rt_unnecessary_local_objects = lt_tadir_unique.
ENDMETHOD.
METHOD pull.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo.
lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
lo_repo->refresh( ).
zcl_abapgit_services_repo=>gui_deserialize( lo_repo ).
COMMIT WORK.
ENDMETHOD.
METHOD reset.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo,
lv_answer TYPE c LENGTH 1,
lt_unnecessary_local_objs TYPE zif_abapgit_definitions=>ty_tadir_tt,
lt_selected LIKE lt_unnecessary_local_objs,
lt_columns TYPE zif_abapgit_definitions=>ty_alv_column_tt,
ls_checks TYPE zif_abapgit_definitions=>ty_delete_checks,
li_popups TYPE REF TO zif_abapgit_popups.
FIELD-SYMBOLS: <ls_column> TYPE zif_abapgit_definitions=>ty_alv_column.
lo_repo = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
IF lo_repo->get_local_settings( )-write_protected = abap_true.
zcx_abapgit_exception=>raise( 'Cannot reset. Local code is write-protected by repo config' ).
ENDIF.
* todo, separate UI and logic
lv_answer = zcl_abapgit_ui_factory=>get_popups( )->popup_to_confirm(
iv_titlebar = 'Warning'
iv_text_question = 'Reset local objects?'
iv_text_button_1 = 'Ok'
iv_icon_button_1 = 'ICON_OKAY'
iv_text_button_2 = 'Cancel'
iv_icon_button_2 = 'ICON_CANCEL'
iv_default_button = '2'
iv_display_cancel_button = abap_false ).
IF lv_answer = '2'.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
lt_unnecessary_local_objs = get_unnecessary_local_objs( lo_repo ).
IF lines( lt_unnecessary_local_objs ) > 0.
APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>.
<ls_column>-name = 'OBJECT'.
APPEND INITIAL LINE TO lt_columns ASSIGNING <ls_column>.
<ls_column>-name = 'OBJ_NAME'.
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->popup_to_select_from_list(
EXPORTING
it_list = lt_unnecessary_local_objs
iv_header_text = |Which unnecessary objects should be deleted?|
iv_select_column_text = 'Delete?'
it_columns_to_display = lt_columns
IMPORTING
et_list = lt_selected ).
IF lines( lt_selected ) > 0.
ls_checks = lo_repo->delete_checks( ).
IF ls_checks-transport-required = abap_true.
ls_checks-transport-transport = zcl_abapgit_ui_factory=>get_popups(
)->popup_transport_request( ls_checks-transport-type ).
ENDIF.
zcl_abapgit_objects=>delete( it_tadir = lt_selected
is_checks = ls_checks ).
lo_repo->refresh( ).
ENDIF.
ENDIF.
zcl_abapgit_services_repo=>gui_deserialize( lo_repo ).
ENDMETHOD.
METHOD switch_branch.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_branch TYPE zif_abapgit_definitions=>ty_git_branch.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
IF lo_repo->get_local_settings( )-write_protected = abap_true.
zcx_abapgit_exception=>raise( 'Cannot switch branch. Local code is write-protected by repo config' ).
ENDIF.
ls_branch = zcl_abapgit_ui_factory=>get_popups( )->branch_list_popup(
iv_url = lo_repo->get_url( )
iv_default_branch = lo_repo->get_selected_branch( )
iv_show_new_option = abap_true ).
IF ls_branch IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
IF ls_branch-name = zif_abapgit_popups=>c_new_branch_label.
create_branch( iv_key ).
RETURN.
ENDIF.
lo_repo->select_commit( space ).
lo_repo->select_branch( ls_branch-name ).
COMMIT WORK AND WAIT.
ENDMETHOD.
METHOD switch_tag.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
ls_tag TYPE zif_abapgit_definitions=>ty_git_tag.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
ls_tag = zcl_abapgit_ui_factory=>get_tag_popups( )->tag_select_popup( lo_repo ).
IF ls_tag IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
lo_repo->select_branch( ls_tag-name ).
COMMIT WORK AND WAIT.
ENDMETHOD.
METHOD tag_overview.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
zcl_abapgit_ui_factory=>get_tag_popups( )->tag_list_popup( lo_repo ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
30416,
62,
18300,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
2834,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
13259,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
2251,
62,
1671,
3702,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
5078,
62,
1671,
3702,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
12233,
62,
1671,
3702,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
12233,
62,
12985,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
5078,
62,
12985,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
7621,
62,
2502,
1177,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
4589,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
260,
7501,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
260,
7501,
62,
25119,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
41509,
41876,
1976,
361,
62,
397,
499,
18300,
62,
30416,
62,
18300,
14804,
774,
62,
41509,
62,
25747,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
14247,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
14247,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
28006,
62,
41509,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2539,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
260,
7501,
12,
2539,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
41509,
62,
8367,
62,
8658,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
427,
64,
16,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
26270,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3275,
220,
41876,
269,
406,
49494,
2026,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4818,
8079,
41876,
269,
406,
49494,
1160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
41509,
62,
8367,
62,
8658,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
1259,
62,
41509,
62,
8367,
62,
8658,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
41509,
62,
8367,
62,
8658,
13315,
5550,
38865,
35374,
764,
628,
220,
220,
220,
42715,
12,
49273,
50,
651,
62,
403
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*"* use this source file for your ABAP unit test classes
CONSTANTS:
c_test_app1 TYPE o2applname VALUE 'BSP_APP',
c_test_app2 TYPE o2applname VALUE 'BSP_APP2'.
TYPES:
BEGIN OF ty_repo_content,
file TYPE string,
content TYPE string_table,
END OF ty_repo_content,
BEGIN OF ty_repo,
name TYPE o2applname,
files TYPE TABLE OF ty_repo_content WITH EMPTY KEY,
map_entries TYPE /ui5/ui5_rep_path_map_t,
END OF ty_repo,
ty_repos TYPE STANDARD TABLE OF ty_repo WITH EMPTY KEY.
CLASS lcl_repo_reader DEFINITION.
PUBLIC SECTION.
INTERFACES:
zif_i18nchk_repo_reader.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_repo_reader IMPLEMENTATION.
METHOD zif_i18nchk_repo_reader~read.
DATA: bsp_apps TYPE TABLE OF o2applname.
bsp_apps = VALUE #( ( c_test_app1 ) ( c_test_app2 ) ).
result = VALUE #( FOR bsp_app IN bsp_apps WHERE ( table_line IN bsp_name_range ) ( bsp_name = bsp_app ) ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_repo_access DEFINITION.
PUBLIC SECTION.
INTERFACES:
zif_i18nchk_rep_access.
METHODS:
constructor
IMPORTING
repo TYPE ty_repo.
PROTECTED SECTION.
PRIVATE SECTION.
DATA:
repo TYPE ty_repo.
ENDCLASS.
CLASS lcl_repo_access IMPLEMENTATION.
METHOD constructor.
me->repo = repo.
ENDMETHOD.
METHOD zif_i18nchk_rep_access~get_bsp_description ##NEEDED.
ENDMETHOD.
METHOD zif_i18nchk_rep_access~get_file_content.
result = VALUE #( repo-files[ file = map_entry-path ]-content OPTIONAL ).
ENDMETHOD.
METHOD zif_i18nchk_rep_access~get_ui5_app_map_entries.
result = repo-map_entries.
ENDMETHOD.
ENDCLASS.
CLASS lcl_repo_access_factory DEFINITION.
PUBLIC SECTION.
INTERFACES:
zif_i18nchk_rep_access_factory.
METHODS:
constructor
IMPORTING
repos TYPE ty_repos.
PROTECTED SECTION.
PRIVATE SECTION.
DATA:
repos TYPE ty_repos.
ENDCLASS.
CLASS lcl_repo_access_factory IMPLEMENTATION.
METHOD constructor.
me->repos = repos.
ENDMETHOD.
METHOD zif_i18nchk_rep_access_factory~create_repo_access.
result = NEW lcl_repo_access( repo = VALUE #( repos[ name = bsp_name ] OPTIONAL ) ).
ENDMETHOD.
ENDCLASS.
CLASS ltcl_abap_unit DEFINITION DEFERRED.
CLASS zcl_i18nchk_checker DEFINITION LOCAL FRIENDS ltcl_abap_unit.
CLASS ltcl_abap_unit DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PUBLIC SECTION.
METHODS:
constructor.
PRIVATE SECTION.
DATA:
test_data TYPE ty_repos,
test_data2 TYPE ty_repos,
test_data3 TYPE ty_repos,
test_data4 TYPE ty_repos,
cut TYPE REF TO zcl_i18nchk_checker,
ignored_entries_double type ref to zif_i18nchk_ign_entry_reader.
METHODS: setup,
test_missing_file FOR TESTING,
test_missing_default_file FOR TESTING,
test_missing_key FOR TESTING,
test_same_key_value FOR TESTING.
ENDCLASS.
CLASS ltcl_abap_unit IMPLEMENTATION.
METHOD constructor.
test_data = VALUE #(
( name = c_test_app1
map_entries = VALUE #(
( internal_rep = 'B' path = 'i18n/i18n.properties' )
( internal_rep = 'B' path = 'i18n/i18n_en.properties' ) )
files = VALUE #(
( file = 'manifest.json' )
( file = 'i18n/i18n.properties' )
( file = 'i18n/i18n_en.properties' ) ) ) ).
test_data2 = VALUE #(
( name = c_test_app1
map_entries = VALUE #(
( internal_rep = 'B' path = 'i18n/i18n_en.properties' ) )
files = VALUE #(
( file = 'manifest.json' )
( file = 'i18n/i18n_en.properties' ) ) ) ).
test_data3 = VALUE #(
( name = c_test_app1
map_entries = VALUE #(
( internal_rep = 'B' path = 'i18n/i18n.properties' )
( internal_rep = 'B' path = 'i18n/i18n_en.properties' )
( internal_rep = 'B' path = 'i18n/i18n_de.properties' ) )
files = VALUE #(
( file = 'manifest.json' )
( file = 'i18n/i18n.properties'
content = VALUE #(
( |dialog_title = Warning| ) ) )
( file = 'i18n/i18n_en.properties'
content = VALUE #(
( |dialog_title = Warning| ) ) )
( file = 'i18n/i18n_de.properties' ) ) ) ).
test_data4 = VALUE #(
( name = c_test_app1
map_entries = VALUE #(
( internal_rep = 'B' path = 'i18n/i18n.properties' )
( internal_rep = 'B' path = 'i18n/i18n_de.properties' ) )
files = VALUE #(
( file = 'manifest.json' )
( file = 'i18n/i18n.properties'
content = VALUE #(
( |button = Click| ) ) )
( file = 'i18n/i18n_de.properties'
content = VALUE #(
( |button = Click| ) ) ) ) ) ).
ENDMETHOD.
METHOD setup.
ignored_entries_double ?= cl_abap_testdouble=>create( object_name = 'ZIF_I18NCHK_IGN_ENTRY_READER' ).
ENDMETHOD.
METHOD test_missing_file.
TRY.
cut = NEW zcl_i18nchk_checker(
bsp_name_range = VALUE #( ( sign = 'I' option = 'EQ' low = c_test_app1 ) )
target_languages = VALUE #( ( `de` ) ) ).
CATCH zcx_i18nchk_error INTO DATA(error).
ENDTRY.
cl_abap_unit_assert=>assert_not_bound( act = error ).
cut->repo_access_factory = NEW lcl_repo_access_factory( test_data ).
cut->repo_reader = NEW lcl_repo_reader( ).
cut->ignored_entries_reader = ignored_entries_double.
cut->check_translations( ).
DATA(check_results) = cut->get_check_result( ).
cl_abap_unit_assert=>assert_not_initial( act = check_results ).
cl_abap_unit_assert=>assert_true( act = xsdbool(
line_exists( check_results[
bsp_name = c_test_app1 ]-i18n_results[ message_type = zif_i18nchk_c_msg_types=>missing_i18n_file ] ) ) ).
ENDMETHOD.
METHOD test_missing_default_file.
TRY.
cut = NEW zcl_i18nchk_checker(
bsp_name_range = VALUE #( ( sign = 'I' option = 'EQ' low = c_test_app1 ) )
target_languages = VALUE #( ( `en` ) ) ).
CATCH zcx_i18nchk_error INTO DATA(error).
ENDTRY.
cl_abap_unit_assert=>assert_not_bound( act = error ).
cut->repo_access_factory = NEW lcl_repo_access_factory( test_data2 ).
cut->repo_reader = NEW lcl_repo_reader( ).
cut->ignored_entries_reader = ignored_entries_double.
cut->check_translations( ).
DATA(check_results) = cut->get_check_result( ).
cl_abap_unit_assert=>assert_not_initial( act = check_results ).
cl_abap_unit_assert=>assert_true( act = xsdbool(
line_exists( check_results[
bsp_name = c_test_app1 ]-i18n_results[ message_type = zif_i18nchk_c_msg_types=>missing_default_i18n_file ] ) ) ).
ENDMETHOD.
METHOD test_missing_key.
TRY.
cut = NEW zcl_i18nchk_checker(
bsp_name_range = VALUE #( ( sign = 'I' option = 'EQ' low = c_test_app1 ) )
target_languages = VALUE #( ( `de` ) ) ).
CATCH zcx_i18nchk_error INTO DATA(error).
ENDTRY.
cl_abap_unit_assert=>assert_not_bound( act = error ).
cut->repo_access_factory = NEW lcl_repo_access_factory( test_data3 ).
cut->repo_reader = NEW lcl_repo_reader( ).
cut->ignored_entries_reader = ignored_entries_double.
cut->check_translations( ).
DATA(check_results) = cut->get_check_result( ).
cl_abap_unit_assert=>assert_not_initial( act = check_results ).
cl_abap_unit_assert=>assert_true( act = xsdbool(
line_exists( check_results[
bsp_name = c_test_app1 ]-i18n_results[ message_type = zif_i18nchk_c_msg_types=>missing_i18n_key ] ) ) ).
ENDMETHOD.
METHOD test_same_key_value.
TRY.
cut = NEW zcl_i18nchk_checker(
bsp_name_range = VALUE #( ( sign = 'I' option = 'EQ' low = c_test_app1 ) )
target_languages = VALUE #( ( `de` ) ) ).
CATCH zcx_i18nchk_error INTO DATA(error).
ENDTRY.
cl_abap_unit_assert=>assert_not_bound( act = error ).
cut->repo_access_factory = NEW lcl_repo_access_factory( test_data4 ).
cut->repo_reader = NEW lcl_repo_reader( ).
cut->ignored_entries_reader = ignored_entries_double.
cut->check_translations( ).
DATA(check_results) = cut->get_check_result( ).
cl_abap_unit_assert=>assert_not_initial( act = check_results ).
cl_abap_unit_assert=>assert_true( act = xsdbool(
line_exists( check_results[
bsp_name = c_test_app1 ]-i18n_results[ message_type = zif_i18nchk_c_msg_types=>i18n_key_with_same_value ] ) ) ).
ENDMETHOD.
ENDCLASS.
| [
9,
1,
9,
779,
428,
2723,
2393,
329,
534,
9564,
2969,
4326,
1332,
6097,
198,
10943,
2257,
1565,
4694,
25,
198,
220,
269,
62,
9288,
62,
1324,
16,
41876,
267,
17,
1324,
75,
3672,
26173,
8924,
705,
33,
4303,
62,
24805,
3256,
198,
220,
269,
62,
9288,
62,
1324,
17,
41876,
267,
17,
1324,
75,
3672,
26173,
8924,
705,
33,
4303,
62,
24805,
17,
4458,
198,
198,
9936,
47,
1546,
25,
198,
220,
347,
43312,
3963,
1259,
62,
260,
7501,
62,
11299,
11,
198,
220,
220,
220,
2393,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
2695,
41876,
4731,
62,
11487,
11,
198,
220,
23578,
3963,
1259,
62,
260,
7501,
62,
11299,
11,
628,
220,
347,
43312,
3963,
1259,
62,
260,
7501,
11,
198,
220,
220,
220,
1438,
220,
220,
220,
220,
220,
220,
220,
41876,
267,
17,
1324,
75,
3672,
11,
198,
220,
220,
220,
3696,
220,
220,
220,
220,
220,
220,
41876,
43679,
3963,
1259,
62,
260,
7501,
62,
11299,
13315,
38144,
9936,
35374,
11,
198,
220,
220,
220,
3975,
62,
298,
1678,
41876,
1220,
9019,
20,
14,
9019,
20,
62,
7856,
62,
6978,
62,
8899,
62,
83,
11,
198,
220,
23578,
3963,
1259,
62,
260,
7501,
11,
628,
220,
1259,
62,
260,
1930,
41876,
49053,
9795,
43679,
3963,
1259,
62,
260,
7501,
13315,
38144,
9936,
35374,
13,
628,
198,
31631,
300,
565,
62,
260,
7501,
62,
46862,
5550,
20032,
17941,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
25,
198,
220,
220,
220,
220,
220,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
260,
7501,
62,
46862,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
198,
10619,
31631,
13,
198,
198,
31631,
300,
565,
62,
260,
7501,
62,
46862,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
260,
7501,
62,
46862,
93,
961,
13,
198,
220,
220,
220,
42865,
25,
275,
2777,
62,
18211,
41876,
43679,
3963,
267,
17,
1324,
75,
3672,
13,
628,
220,
220,
220,
275,
2777,
62,
18211,
796,
26173,
8924,
1303,
7,
357,
269,
62,
9288,
62,
1324,
16,
1267,
357,
269,
62,
9288,
62,
1324,
17,
1267,
6739,
628,
220,
220,
220,
1255,
796,
26173,
8924,
1303,
7,
7473,
275,
2777,
62,
1324,
3268,
275,
2777,
62,
18211,
33411,
357,
3084,
62,
1370,
3268,
275,
2777,
62,
3672,
62,
9521,
1267,
357,
275,
2777,
62,
3672,
796,
275,
2777,
62,
1324,
1267,
6739,
198,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
628,
198,
31631,
300,
565,
62,
260,
7501,
62,
15526,
5550,
20032,
17941,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
25,
198,
220,
220,
220,
220,
220,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
7856,
62,
15526,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
23772,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29924,
41876,
1259,
62,
260,
7501,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
29924,
41876,
1259,
62,
260,
7501,
13,
198,
10619,
31631,
13,
198,
198,
31631,
300,
565,
62,
260,
7501,
62,
15526,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
23772,
13,
198,
220,
220,
220,
502,
3784,
260,
7501,
796,
29924,
13,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
7856,
62,
15526,
93,
1136,
62,
24145,
62,
11213,
22492,
12161,
1961,
1961,
13,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
7856,
62,
15526,
93,
1136,
62,
7753,
62,
11299,
13,
198,
220,
220,
220,
1255,
796,
26173,
8924,
1303,
7,
29924,
12,
16624,
58,
2393,
796,
3975,
62,
13000,
12,
6978,
2361,
12,
11299,
39852,
2849,
1847,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
7856,
62,
15526,
93,
1136,
62,
9019,
20,
62,
1324,
62,
8899,
62,
298,
1678,
13,
198,
220,
220,
220,
1255,
796,
29924,
12,
8899,
62,
298,
1678,
13,
198,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198,
198,
31631,
300,
565,
62,
260,
7501,
62,
15526,
62,
69,
9548,
5550,
20032,
17941,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
25,
198,
220,
220,
220,
220,
220,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
7856,
62,
15526,
62,
69,
9548,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
23772,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1128,
418,
41876,
1259,
62,
260,
1930,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
1128,
418,
41876,
1259,
62,
260,
1930,
13,
198,
10619,
31631,
13,
198,
198,
31631,
300,
565,
62,
260,
7501,
62,
15526,
62,
69,
9548,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
23772,
13,
198,
220,
220,
220,
502,
3784,
260,
1930,
796,
1128,
418,
13,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1976,
361,
62,
72,
1507,
77,
354,
74,
62,
7856,
62,
15526,
62,
69,
9548,
93,
17953,
62,
260,
7501,
62,
15526,
13,
198,
220,
220,
220,
1255,
796,
12682,
300,
565,
62,
260,
7501,
62,
15526,
7,
29924,
796,
26173,
8924,
1303,
7,
1128,
418,
58,
1438,
796,
275,
2777,
62,
3672,
2361,
39852,
2849,
1847,
1267,
6739,
198,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198,
198,
31631,
300,
83,
565,
62,
397,
499,
62,
20850,
5550,
20032,
17941,
23449,
1137,
22083,
13,
198,
31631,
1976,
565,
62,
72,
1507,
77,
354,
74,
62,
9122,
263,
5550,
20032,
17941,
37347,
1847,
48167,
1677,
5258,
300,
83,
565,
62
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*----------------------------------------------------------------------*
* CLASS ZCL_PADDING_UTILITY_PKCS_5 DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS zcl_padding_utility_pkcs_5 DEFINITION
PUBLIC
INHERITING FROM zcl_padding_utility_pkcs_7
CREATE PUBLIC .
PUBLIC SECTION.
CONSTANTS mc_block_size_in_byte TYPE int4 VALUE 8. "#EC NOTEXT
METHODS add_padding
REDEFINITION .
METHODS remove_padding
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_PADDING_UTILITY_PKCS_5 IMPLEMENTATION.
METHOD add_padding.
super->add_padding(
EXPORTING
i_data = i_data
i_block_length_in_byte = mc_block_size_in_byte
IMPORTING
e_padding_length_in_byte = e_padding_length_in_byte
e_padding = e_padding
e_data = e_data ).
ENDMETHOD. "add_padding
METHOD remove_padding.
super->remove_padding(
EXPORTING
i_data = i_data
i_block_length_in_byte = mc_block_size_in_byte
IMPORTING
e_padding_length_in_byte = e_padding_length_in_byte
e_padding = e_padding
e_data = e_data ).
ENDMETHOD. "remove_padding
ENDCLASS.
| [
9,
10097,
23031,
9,
198,
9,
220,
220,
220,
220,
220,
220,
42715,
1168,
5097,
62,
47,
29266,
2751,
62,
3843,
4146,
9050,
62,
40492,
7902,
62,
20,
5550,
20032,
17941,
198,
9,
10097,
23031,
9,
198,
9,
198,
9,
10097,
23031,
9,
198,
31631,
1976,
565,
62,
39231,
62,
315,
879,
62,
79,
74,
6359,
62,
20,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
39231,
62,
315,
879,
62,
79,
74,
6359,
62,
22,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
7102,
2257,
1565,
4694,
36650,
62,
9967,
62,
7857,
62,
259,
62,
26327,
41876,
493,
19,
26173,
8924,
807,
13,
220,
220,
220,
220,
220,
25113,
2943,
5626,
13918,
628,
220,
220,
220,
337,
36252,
50,
751,
62,
39231,
198,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
220,
220,
337,
36252,
50,
4781,
62,
39231,
198,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
47,
29266,
2751,
62,
3843,
4146,
9050,
62,
40492,
7902,
62,
20,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
751,
62,
39231,
13,
628,
220,
220,
220,
2208,
3784,
2860,
62,
39231,
7,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
7890,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
1312,
62,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
9967,
62,
13664,
62,
259,
62,
26327,
220,
220,
220,
796,
36650,
62,
9967,
62,
7857,
62,
259,
62,
26327,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
39231,
62,
13664,
62,
259,
62,
26327,
220,
796,
304,
62,
39231,
62,
13664,
62,
259,
62,
26327,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
39231,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
304,
62,
39231,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
7890,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
304,
62,
7890,
6739,
628,
220,
23578,
49273,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2860,
62,
39231,
628,
198,
220,
337,
36252,
4781,
62,
39231,
13,
628,
220,
220,
220,
2208,
3784,
28956,
62,
39231,
7,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
7890,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
1312,
62,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
9967,
62,
13664,
62,
259,
62,
26327,
220,
220,
220,
796,
36650,
62,
9967,
62,
7857,
62,
259,
62,
26327,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
39231,
62,
13664,
62,
259,
62,
26327,
220,
796,
304,
62,
39231,
62,
13664,
62,
259,
62,
26327,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
39231,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
304,
62,
39231,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
7890,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
304,
62,
7890,
6739,
628,
220,
23578,
49273,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
28956,
62,
39231,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_gui_page_settings DEFINITION
PUBLIC
FINAL
CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page.
PUBLIC SECTION.
INTERFACES: zif_abapgit_gui_page_hotkey.
CONSTANTS:
BEGIN OF c_action,
save_settings TYPE string VALUE 'save_settings',
END OF c_action.
METHODS constructor.
METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION.
PROTECTED SECTION.
METHODS render_content REDEFINITION.
PRIVATE SECTION.
DATA mo_settings TYPE REF TO zcl_abapgit_settings .
DATA mv_error TYPE abap_bool .
DATA mt_post_fields TYPE tihttpnvp .
METHODS post_commit_msg .
METHODS post_development_internals .
METHODS post_hotkeys .
METHODS render_proxy
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_development_internals
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_form_begin
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_form_end
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_max_lines
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_icon_scaling
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_adt_jump_enabled
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_commit_msg
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS post_proxy .
METHODS post
IMPORTING
!it_post_fields TYPE tihttpnvp .
METHODS validate_settings .
METHODS parse_post
IMPORTING
!it_postdata TYPE cnht_post_data_tab
RETURNING
VALUE(rt_post_fields) TYPE tihttpnvp .
METHODS persist_settings
RAISING
zcx_abapgit_exception .
METHODS read_settings .
METHODS render_section_begin
IMPORTING
!iv_header TYPE csequence
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_section_end
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_start_up
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
METHODS render_link_hints
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS render_hotkeys
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS get_possible_hotkey_actions
RETURNING
VALUE(rt_hotkey_actions) TYPE zif_abapgit_gui_page_hotkey=>tty_hotkey_action
RAISING
zcx_abapgit_exception .
METHODS get_default_hotkeys
RETURNING
VALUE(rt_default_hotkeys) TYPE zif_abapgit_definitions=>tty_hotkey
RAISING
zcx_abapgit_exception .
METHODS is_post_field_checked
IMPORTING
iv_name TYPE string
RETURNING
VALUE(rv_return) TYPE abap_bool .
METHODS render_parallel_proc
RETURNING
VALUE(ro_html) TYPE REF TO zcl_abapgit_html .
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_SETTINGS IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
ms_control-page_title = 'SETTINGS'.
ENDMETHOD.
METHOD get_default_hotkeys.
DATA: lt_actions TYPE zif_abapgit_gui_page_hotkey=>tty_hotkey_action,
ls_hotkey LIKE LINE OF rt_default_hotkeys.
FIELD-SYMBOLS: <ls_action> LIKE LINE OF lt_actions.
lt_actions = zcl_abapgit_hotkeys=>get_default_hotkeys_from_pages( ).
LOOP AT lt_actions ASSIGNING <ls_action>.
ls_hotkey-action = <ls_action>-action.
ls_hotkey-sequence = <ls_action>-default_hotkey.
INSERT ls_hotkey INTO TABLE rt_default_hotkeys.
ENDLOOP.
ENDMETHOD.
METHOD get_possible_hotkey_actions.
DATA: ls_hotkey_action LIKE LINE OF rt_hotkey_actions.
rt_hotkey_actions = zcl_abapgit_hotkeys=>get_default_hotkeys_from_pages( ).
" insert empty row at the beginning, so that we can unset a hotkey
INSERT ls_hotkey_action INTO rt_hotkey_actions INDEX 1.
ENDMETHOD.
METHOD is_post_field_checked.
FIELD-SYMBOLS: <ls_post_field> TYPE ihttpnvp.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = iv_name.
IF sy-subrc = 0
AND ( <ls_post_field>-value = abap_true "HTML value when using standard netweaver GUI
OR <ls_post_field>-value = 'on' ). "HTML value when using Netweaver Java GUI
rv_return = abap_true.
ENDIF.
ENDMETHOD.
METHOD parse_post.
DATA lv_serialized_post_data TYPE string.
CONCATENATE LINES OF it_postdata INTO lv_serialized_post_data.
rt_post_fields = zcl_abapgit_html_action_utils=>parse_fields( lv_serialized_post_data ).
ENDMETHOD.
METHOD persist_settings.
DATA lo_settings_persistence TYPE REF TO zcl_abapgit_persist_settings.
lo_settings_persistence = zcl_abapgit_persist_settings=>get_instance( ).
lo_settings_persistence->modify( mo_settings ).
MESSAGE 'Settings succesfully saved' TYPE 'S'.
ENDMETHOD.
METHOD post.
DATA lv_i_param_value TYPE i.
DATA lv_c_param_value TYPE c.
FIELD-SYMBOLS: <ls_post_field> TYPE ihttpnvp.
CREATE OBJECT mo_settings.
mt_post_fields = it_post_fields.
post_proxy( ).
post_commit_msg( ).
post_development_internals( ).
* todo, refactor to private POST_* methods
IF is_post_field_checked( 'show_default_repo' ) = abap_true.
mo_settings->set_show_default_repo( abap_true ).
ELSE.
mo_settings->set_show_default_repo( abap_false ).
ENDIF.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'max_lines'.
IF sy-subrc = 0.
lv_i_param_value = <ls_post_field>-value.
mo_settings->set_max_lines( lv_i_param_value ).
ELSE.
mo_settings->set_max_lines( 0 ).
ENDIF.
IF is_post_field_checked( 'adt_jump_enabled' ) = abap_true.
mo_settings->set_adt_jump_enanbled( abap_true ).
ELSE.
mo_settings->set_adt_jump_enanbled( abap_false ).
ENDIF.
IF is_post_field_checked( 'link_hints_enabled' ) = abap_true.
mo_settings->set_link_hints_enabled( abap_true ).
ELSE.
mo_settings->set_link_hints_enabled( abap_false ).
ENDIF.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'link_hint_key'.
IF sy-subrc = 0.
mo_settings->set_link_hint_key( |{ <ls_post_field>-value }| ).
ENDIF.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'link_hint_background_color'.
IF sy-subrc = 0.
mo_settings->set_link_hint_background_color( |{ <ls_post_field>-value }| ).
ENDIF.
IF is_post_field_checked( 'parallel_proc_disabled' ) = abap_true.
mo_settings->set_parallel_proc_disabled( abap_true ).
ELSE.
mo_settings->set_parallel_proc_disabled( abap_false ).
ENDIF.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'icon_scaling'.
IF sy-subrc = 0.
lv_c_param_value = <ls_post_field>-value.
mo_settings->set_icon_scaling( lv_c_param_value ).
ELSE.
mo_settings->set_icon_scaling( '' ).
ENDIF.
post_hotkeys( ).
ENDMETHOD.
METHOD post_commit_msg.
DATA: lv_i_param_value TYPE i.
FIELD-SYMBOLS: <ls_post_field> TYPE ihttpnvp.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'comment_length'.
IF sy-subrc = 0.
lv_i_param_value = <ls_post_field>-value.
IF lv_i_param_value < zcl_abapgit_settings=>c_commitmsg_comment_length_dft.
lv_i_param_value = zcl_abapgit_settings=>c_commitmsg_comment_length_dft.
ENDIF.
mo_settings->set_commitmsg_comment_length( lv_i_param_value ).
ELSE.
mo_settings->set_commitmsg_comment_length( zcl_abapgit_settings=>c_commitmsg_comment_length_dft ).
ENDIF.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'body_size'.
IF sy-subrc = 0.
lv_i_param_value = <ls_post_field>-value.
IF lv_i_param_value < zcl_abapgit_settings=>c_commitmsg_body_size_dft.
lv_i_param_value = zcl_abapgit_settings=>c_commitmsg_body_size_dft.
ENDIF.
mo_settings->set_commitmsg_body_size( lv_i_param_value ).
ELSE.
mo_settings->set_commitmsg_body_size( zcl_abapgit_settings=>c_commitmsg_body_size_dft ).
ENDIF.
ENDMETHOD.
METHOD post_development_internals.
IF is_post_field_checked( 'critical_tests' ) = abap_true.
mo_settings->set_run_critical_tests( abap_true ).
ELSE.
mo_settings->set_run_critical_tests( abap_false ).
ENDIF.
IF is_post_field_checked( 'experimental_features' ) = abap_true.
mo_settings->set_experimental_features( abap_true ).
ELSE.
mo_settings->set_experimental_features( abap_false ).
ENDIF.
ENDMETHOD.
METHOD post_hotkeys.
DATA: lv_column TYPE string,
lt_key_bindings TYPE zif_abapgit_definitions=>tty_hotkey.
FIELD-SYMBOLS: <ls_post_field> TYPE ihttpnvp,
<ls_key_binding> TYPE zif_abapgit_definitions=>ty_hotkey.
LOOP AT mt_post_fields ASSIGNING <ls_post_field> WHERE name CP 'key*'.
FIND FIRST OCCURRENCE OF REGEX `key_(.*)_`
IN <ls_post_field>-name
SUBMATCHES lv_column.
INSERT INITIAL LINE INTO TABLE lt_key_bindings ASSIGNING <ls_key_binding>.
CASE lv_column.
WHEN 'sequence'.
<ls_key_binding>-sequence = <ls_post_field>-value.
WHEN 'action'.
<ls_key_binding>-action = <ls_post_field>-value.
ENDCASE.
ENDLOOP.
DELETE lt_key_bindings WHERE sequence IS INITIAL
OR action IS INITIAL.
mo_settings->set_hotkeys( lt_key_bindings ).
ENDMETHOD.
METHOD post_proxy.
FIELD-SYMBOLS: <ls_post_field> TYPE ihttpnvp.
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'proxy_url'.
IF sy-subrc <> 0.
mv_error = abap_true.
ENDIF.
mo_settings->set_proxy_url( <ls_post_field>-value ).
READ TABLE mt_post_fields ASSIGNING <ls_post_field> WITH KEY name = 'proxy_port'.
IF sy-subrc <> 0.
mv_error = abap_true.
ENDIF.
mo_settings->set_proxy_port( <ls_post_field>-value ).
IF is_post_field_checked( 'proxy_auth' ) = abap_true.
mo_settings->set_proxy_authentication( abap_true ).
ELSE.
mo_settings->set_proxy_authentication( abap_false ).
ENDIF.
ENDMETHOD.
METHOD read_settings.
DATA lo_settings_persistence TYPE REF TO zcl_abapgit_persist_settings.
lo_settings_persistence = zcl_abapgit_persist_settings=>get_instance( ).
mo_settings = lo_settings_persistence->read( ).
ENDMETHOD.
METHOD render_adt_jump_enabled.
DATA lv_checked TYPE string.
IF mo_settings->get_adt_jump_enabled( ) = abap_true.
lv_checked = 'checked'.
ENDIF.
CREATE OBJECT ro_html.
ro_html->add( |<h2>ABAP Development Tools (ADT)</h2>| ).
ro_html->add( `<input type="checkbox" name="adt_jump_enabled" value="X" `
&& lv_checked && ` > Enable jump to ADT first` ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_commit_msg.
CREATE OBJECT ro_html.
ro_html->add( |<h2>Commit Message</h2>| ).
ro_html->add( |<label for="comment_length">Max. length of comment (recommendation 50)</label>| ).
ro_html->add( |<br>| ).
ro_html->add( |<input name="comment_length" type="number" step="10" size="3" maxlength="3" min="50"| &&
| value="{ mo_settings->get_commitmsg_comment_length( ) }">| ).
ro_html->add( |<br>| ).
ro_html->add( |<label for="body_size">Max. line size of body (recommendation 72)</label>| ).
ro_html->add( |<br>| ).
ro_html->add( |<input name="body_size" type="number" size="3" maxlength="3" min="50"| &&
| value="{ mo_settings->get_commitmsg_body_size( ) }">| ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ro_html.
read_settings( ).
ro_html->add( render_form_begin( ) ).
ro_html->add( render_section_begin( |Global settings| ) ).
ro_html->add( render_proxy( ) ).
ro_html->add( |<hr>| ).
ro_html->add( render_commit_msg( ) ).
ro_html->add( |<hr>| ).
ro_html->add( render_development_internals( ) ).
ro_html->add( render_section_end( ) ).
ro_html->add( render_section_begin( |User specific settings| ) ).
ro_html->add( render_start_up( ) ).
ro_html->add( render_max_lines( ) ).
ro_html->add( render_icon_scaling( ) ).
ro_html->add( |<hr>| ).
ro_html->add( render_adt_jump_enabled( ) ).
ro_html->add( |<hr>| ).
ro_html->add( render_parallel_proc( ) ).
ro_html->add( |<hr>| ).
ro_html->add( render_link_hints( ) ).
ro_html->add( |<hr>| ).
ro_html->add( render_hotkeys( ) ).
ro_html->add( render_section_end( ) ).
ro_html->add( render_form_end( ) ).
ENDMETHOD.
METHOD render_development_internals.
DATA: lv_critical_tests TYPE string,
lv_experimental TYPE string.
IF mo_settings->get_run_critical_tests( ) = abap_true.
lv_critical_tests = 'checked'.
ENDIF.
IF mo_settings->get_experimental_features( ) = abap_true.
lv_experimental = 'checked'.
ENDIF.
CREATE OBJECT ro_html.
ro_html->add( |<h2>abapGit Development Internals settings</h2>| ).
ro_html->add( `<input type="checkbox" name="critical_tests" `
&& lv_critical_tests && ` > Enable critical unit tests (see LTCL_DANGEROUS)` ).
ro_html->add( |<br>| ).
ro_html->add( `<input type="checkbox" name="experimental_features" `
&& lv_experimental && ` > Enable experimental features` ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_form_begin.
CREATE OBJECT ro_html.
ro_html->add( '<div class="settings_container">' ).
ro_html->add( `<form id="settings_form" method="post" action="sapevent:` && c_action-save_settings && `">` ).
ENDMETHOD.
METHOD render_form_end.
CREATE OBJECT ro_html.
ro_html->add( '<input type="submit" value="Save" class="floating-button blue-set emphasis">' ).
ro_html->add( '</form>' ).
ro_html->add( '</div>' ).
ENDMETHOD.
METHOD render_hotkeys.
DATA: lv_index TYPE i,
lt_hotkeys TYPE zif_abapgit_definitions=>tty_hotkey,
lv_selected TYPE string,
lt_actions TYPE zif_abapgit_gui_page_hotkey=>tty_hotkey_action.
FIELD-SYMBOLS: <ls_key_binding> LIKE LINE OF lt_hotkeys,
<ls_action> LIKE LINE OF lt_actions.
lt_hotkeys = mo_settings->get_hotkeys( ).
IF lines( lt_hotkeys ) = 0.
lt_hotkeys = get_default_hotkeys( ).
ENDIF.
DO 3 TIMES.
APPEND INITIAL LINE TO lt_hotkeys.
ENDDO.
CREATE OBJECT ro_html.
ro_html->add( |<h2>Hotkeys</h2>| ).
ro_html->add( |(Only available with installed abapGit repo)| ).
ro_html->add( |<br/>| ).
ro_html->add( |<br/>| ).
ro_html->add( '<table class="repo_tab" id="key_bindings" style="max-width: 300px;">' ).
ro_html->add( '<tr><th>key</th><th>action</th></tr>' ).
lt_actions = get_possible_hotkey_actions( ).
LOOP AT lt_hotkeys ASSIGNING <ls_key_binding>.
lv_index = sy-tabix.
ro_html->add( '<tr>' ).
ro_html->add( |<td><input name="key_sequence_{ lv_index }" maxlength=1 type="text" | &&
|value="{ <ls_key_binding>-sequence }"></td>| ).
ro_html->add( |<td><select name="key_action_{ lv_index }">| ).
LOOP AT lt_actions ASSIGNING <ls_action>.
IF <ls_key_binding>-action = <ls_action>-action.
lv_selected = 'selected'.
ELSE.
CLEAR: lv_selected.
ENDIF.
ro_html->add( |<option value="{ <ls_action>-action }" |
&& |{ lv_selected }>|
&& |{ <ls_action>-name }</option>| ).
ENDLOOP.
ro_html->add( '</select></td>' ).
ro_html->add( '</tr>' ).
ENDLOOP.
ro_html->add( '</select></td>' ).
ro_html->add( '</tr>' ).
ro_html->add( '</table>' ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_icon_scaling.
DATA:
BEGIN OF ls_sel,
auto TYPE string,
large TYPE string,
small TYPE string,
END OF ls_sel.
CASE mo_settings->get_icon_scaling( ).
WHEN zcl_abapgit_settings=>c_icon_scaling-large.
ls_sel-large = ' selected'.
WHEN zcl_abapgit_settings=>c_icon_scaling-small.
ls_sel-small = ' selected'.
WHEN OTHERS.
ls_sel-auto = ' selected'.
ENDCASE.
CREATE OBJECT ro_html.
ro_html->add( |<h2>UI Icon scaling</h2>| ).
ro_html->add( |<label for="icon_scaling">High DPI icon scaling</label>| ).
ro_html->add( |<br>| ).
ro_html->add( |<select name="icon_scaling" size="3">| ).
ro_html->add( |<option value=""{ ls_sel-auto }>Auto</option>| ).
ro_html->add( |<option value="{ zcl_abapgit_settings=>c_icon_scaling-large }"{ ls_sel-large }>Large</option>| ).
ro_html->add( |<option value="{ zcl_abapgit_settings=>c_icon_scaling-small }"{ ls_sel-small }>Small</option>| ).
ro_html->add( |</select>| ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_link_hints.
DATA: lv_checked TYPE string,
lv_link_hint_key TYPE char01,
lv_link_background_color TYPE string.
IF mo_settings->get_link_hints_enabled( ) = abap_true.
lv_checked = 'checked'.
ENDIF.
lv_link_hint_key = mo_settings->get_link_hint_key( ).
lv_link_background_color = mo_settings->get_link_hint_background_color( ).
CREATE OBJECT ro_html.
ro_html->add( |<h2>Vimium like link hints</h2>| ).
ro_html->add( `<input type="checkbox" name="link_hints_enabled" value="X" `
&& lv_checked && ` > Enable Vimium like link hints` ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ro_html->add( |<input type="text" name="link_hint_key" size="1" maxlength="1" value="{ lv_link_hint_key }" |
&& |> Single key to activate links| ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ro_html->add( |<input type="text" name="link_hint_background_color" size="20" maxlength="20"|
&& | value="{ lv_link_background_color }"|
&& |> Background Color (HTML colors e.g. lightgreen or #42f47a)| ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_max_lines.
CREATE OBJECT ro_html.
ro_html->add( |<h2>List size</h2>| ).
ro_html->add( |<label for="max_lines">Max. # of objects listed (0 = all)</label>| ).
ro_html->add( |<br>| ).
ro_html->add( `<input name="max_lines" type="text" size="5" value="` && mo_settings->get_max_lines( ) && `">` ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_parallel_proc.
DATA lv_checked TYPE string.
IF mo_settings->get_parallel_proc_disabled( ) = abap_true.
lv_checked = 'checked'.
ENDIF.
CREATE OBJECT ro_html.
ro_html->add( |<h2>Parallel processing</h2>| ).
ro_html->add( `<input type="checkbox" name="parallel_proc_disabled" value="X" `
&& lv_checked && ` > Disable parallel processing` ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_proxy.
CREATE OBJECT ro_html.
ro_html->add( |<h2>Proxy</h2>| ).
ro_html->add( |<label for="proxy_url">Proxy URL</label>| ).
ro_html->add( |<br>| ).
ro_html->add( `<input name="proxy_url" type="text" size="50" value="` &&
mo_settings->get_proxy_url( ) && `">` ).
ro_html->add( |<br>| ).
ro_html->add( |<label for="proxy_port">Proxy Port</label>| ).
ro_html->add( |<br>| ).
ro_html->add( `<input name="proxy_port" type="text" size="5" value="` &&
mo_settings->get_proxy_port( ) && `">` ).
ro_html->add( |<br>| ).
ro_html->add( |<label for="proxy_auth">Proxy Authentication</label>| ).
IF mo_settings->get_proxy_authentication( ) = abap_true.
ro_html->add( `<input name="proxy_auth" type="checkbox" checked>` ).
ELSE.
ro_html->add( `<input name="proxy_auth" type="checkbox">` ).
ENDIF.
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD render_section_begin.
CREATE OBJECT ro_html.
ro_html->add( |<h1>{ iv_header }</h1>| ).
ro_html->add( |<div class="settings_section">| ).
ENDMETHOD.
METHOD render_section_end.
CREATE OBJECT ro_html.
ro_html->add( |</div>| ).
ENDMETHOD.
METHOD render_start_up.
DATA lv_checked TYPE string.
IF mo_settings->get_show_default_repo( ) = abap_true.
lv_checked = 'checked'.
ENDIF.
CREATE OBJECT ro_html.
ro_html->add( |<h2>Start up</h2>| ).
ro_html->add( `<input type="checkbox" name="show_default_repo" value="X" `
&& lv_checked && ` > Show last repo` ).
ro_html->add( |<br>| ).
ro_html->add( |<br>| ).
ENDMETHOD.
METHOD validate_settings.
IF ( mo_settings->get_proxy_url( ) IS NOT INITIAL AND mo_settings->get_proxy_port( ) IS INITIAL ) OR
( mo_settings->get_proxy_url( ) IS INITIAL AND mo_settings->get_proxy_port( ) IS NOT INITIAL ).
MESSAGE 'If specifying proxy, specify both URL and port' TYPE 'W'.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
* todo, check input values eg INT
DATA:
lt_post_fields TYPE tihttpnvp.
CASE iv_action.
WHEN c_action-save_settings.
lt_post_fields = parse_post( it_postdata ).
post( lt_post_fields ).
validate_settings( ).
IF mv_error = abap_true.
MESSAGE 'Error when saving settings. Open an issue at https://github.com/larshp/abapGit' TYPE 'E'.
ELSE.
persist_settings( ).
ENDIF.
ev_state = zcl_abapgit_gui=>c_event_state-go_back.
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_gui_page_hotkey~get_hotkey_actions.
RETURN.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
33692,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
25,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
8940,
2539,
13,
628,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
269,
62,
2673,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3613,
62,
33692,
41876,
4731,
26173,
8924,
705,
21928,
62,
33692,
3256,
198,
220,
220,
220,
220,
220,
23578,
3963,
269,
62,
2673,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
13,
198,
220,
220,
220,
337,
36252,
50,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
15596,
62,
30281,
93,
261,
62,
15596,
23848,
36,
20032,
17941,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
11299,
23848,
36,
20032,
17941,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42865,
6941,
62,
33692,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
33692,
764,
198,
220,
220,
220,
42865,
285,
85,
62,
18224,
41876,
450,
499,
62,
30388,
764,
198,
220,
220,
220,
42865,
45079,
62,
7353,
62,
25747,
41876,
46668,
4023,
77,
36133,
764,
628,
220,
220,
220,
337,
36252,
50,
1281,
62,
41509,
62,
19662,
764,
198,
220,
220,
220,
337,
36252,
50,
1281,
62,
31267,
62,
23124,
874,
764,
198,
220,
220,
220,
337,
36252,
50,
1281,
62,
8940,
13083,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
36436,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
31267,
62,
23124,
874,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
687,
62,
27471,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
687,
62,
437,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
9806,
62,
6615,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
4749,
62,
1416,
4272,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
324,
83,
62,
43327,
62,
25616,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
41509,
62,
19662,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
1281,
62,
36436,
764,
198,
220,
220,
220,
337,
36252,
50,
1281,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
7353,
62,
25747,
41876,
46668,
4023,
77,
36133,
764,
198,
220,
220,
220,
337,
36252,
50,
26571,
62,
33692,
764,
198,
220,
220,
220,
337,
36252,
50,
21136,
62,
7353,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
7353,
7890,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
269,
77,
4352,
62,
7353,
62,
7890,
62,
8658,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
7353,
62,
25747,
8,
41876,
46668,
4023,
77,
36133,
764,
198,
220,
220,
220,
337,
36252,
50,
21160,
62,
33692,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1100,
62,
33692,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
5458,
62,
27471,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
25677,
220,
220,
220,
220,
41876,
269,
43167,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
5458,
62,
437,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
764,
198,
220,
220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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class /GAL/CX_REST_CLIENT_EXCEPTION definition
public
inheriting from /GAL/CX_EXCEPTION
final
create public .
public section.
type-pools ABAP .
constants /GAL/CX_REST_CLIENT_EXCEPTION type SOTR_CONC value '00155D0122031ED680C71EBF5260B6A8'. "#EC NOTEXT
constants CANNOT_CREATE_HTTP_CLIENT type SOTR_CONC value '00155D0122031ED680C71FD33E8DF6A8'. "#EC NOTEXT
constants ERROR_SENDING_HTTP_REQUEST type SOTR_CONC value '00155D0122031ED680C756EBB7B356A8'. "#EC NOTEXT
constants ERROR_RECEIVING_HTTP_RESPONSE type SOTR_CONC value '00155D0122031ED680C756EBB7B376A8'. "#EC NOTEXT
constants NO_STATUS_CODE_RECEIVED type SOTR_CONC value '00155D0122031ED680C83DC6DFE116A8'. "#EC NOTEXT
constants HTTP_ERROR type SOTR_CONC value '00155D0122031ED680C87D13292996A8'. "#EC NOTEXT
constants MISSING_PARAMETERS type SOTR_CONC value '00155D0122031ED680C89772155D16A8'. "#EC NOTEXT
constants UNKNOWN_PROTOCOL type SOTR_CONC value '00155D0122031ED680E0A11D065F1160'. "#EC NOTEXT
methods CONSTRUCTOR
importing
!TEXTID like TEXTID optional
!PREVIOUS like PREVIOUS optional
!VAR1 type STRING optional
!VAR2 type STRING optional
!VAR3 type STRING optional
!VAR4 type STRING optional
!VAR5 type STRING optional
!VAR6 type STRING optional
!VAR7 type STRING optional
!VAR8 type STRING optional
!VAR9 type STRING optional .
protected section.
private section.
ENDCLASS.
CLASS /GAL/CX_REST_CLIENT_EXCEPTION IMPLEMENTATION.
method CONSTRUCTOR.
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
TEXTID = TEXTID
PREVIOUS = PREVIOUS
VAR1 = VAR1
VAR2 = VAR2
VAR3 = VAR3
VAR4 = VAR4
VAR5 = VAR5
VAR6 = VAR6
VAR7 = VAR7
VAR8 = VAR8
VAR9 = VAR9
.
IF textid IS INITIAL.
me->textid = /GAL/CX_REST_CLIENT_EXCEPTION .
ENDIF.
endmethod.
ENDCLASS.
| [
4871,
1220,
38,
1847,
14,
34,
55,
62,
49,
6465,
62,
5097,
28495,
62,
6369,
42006,
2849,
6770,
198,
220,
1171,
198,
220,
10639,
1780,
422,
1220,
38,
1847,
14,
34,
55,
62,
6369,
42006,
2849,
198,
220,
2457,
198,
220,
2251,
1171,
764,
198,
198,
11377,
2665,
13,
198,
220,
2099,
12,
7742,
82,
9564,
2969,
764,
628,
220,
38491,
1220,
38,
1847,
14,
34,
55,
62,
49,
6465,
62,
5097,
28495,
62,
6369,
42006,
2849,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
34,
4869,
36,
29499,
4309,
1899,
33,
21,
32,
23,
4458,
25113,
2943,
5626,
13918,
198,
220,
38491,
15628,
11929,
62,
43387,
6158,
62,
40717,
62,
5097,
28495,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
34,
4869,
26009,
2091,
36,
23,
8068,
21,
32,
23,
4458,
25113,
2943,
5626,
13918,
198,
220,
38491,
33854,
62,
50,
10619,
2751,
62,
40717,
62,
2200,
35780,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
34,
38219,
36,
15199,
22,
33,
32066,
32,
23,
4458,
25113,
2943,
5626,
13918,
198,
220,
38491,
33854,
62,
2200,
5222,
3824,
2751,
62,
40717,
62,
19535,
47,
1340,
5188,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
34,
38219,
36,
15199,
22,
33,
32128,
32,
23,
4458,
25113,
2943,
5626,
13918,
198,
220,
38491,
8005,
62,
35744,
2937,
62,
34,
16820,
62,
2200,
5222,
3824,
1961,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
34,
5999,
9697,
21,
8068,
36,
18298,
32,
23,
4458,
25113,
2943,
5626,
13918,
198,
220,
38491,
14626,
62,
24908,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
34,
5774,
35,
1485,
1959,
1959,
4846,
32,
23,
4458,
25113,
2943,
5626,
13918,
198,
220,
38491,
49684,
2751,
62,
27082,
2390,
2767,
4877,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
34,
4531,
43571,
18742,
35,
1433,
32,
23,
4458,
25113,
2943,
5626,
13918,
198,
220,
38491,
4725,
44706,
62,
4805,
2394,
4503,
3535,
2099,
311,
2394,
49,
62,
10943,
34,
1988,
705,
405,
18742,
35,
486,
17572,
3132,
1961,
37397,
36,
15,
32,
1157,
35,
15,
2996,
37,
1157,
1899,
4458,
25113,
2943,
5626,
13918,
628,
220,
5050,
7102,
46126,
1581,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
32541,
2389,
588,
40383,
2389,
11902,
198,
220,
220,
220,
220,
220,
5145,
46437,
12861,
20958,
588,
22814,
12861,
20958,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
16,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
17,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
18,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
19,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
20,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
21,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
22,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
23,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
24,
2099,
19269,
2751,
11902,
764,
198,
24326,
2665,
13,
198,
19734,
2665,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1220,
38,
1847,
14,
34,
55,
62,
49,
6465,
62,
5097,
28495,
62,
6369,
42006,
2849,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
2446,
7102,
46126,
1581,
13,
198,
34,
7036,
337,
36252,
33088,
3784,
10943,
46126,
1581,
198,
6369,
15490,
2751,
198,
32541,
2389,
796,
40383,
2389,
198,
46437,
12861,
20958,
796,
22814,
12861,
20958,
198,
53,
1503,
16,
796,
569,
1503,
16,
198,
53,
1503,
17,
796,
569,
1503,
17,
198,
53,
1503,
18,
796,
569,
1503,
18,
198,
53,
1503,
19,
796,
569,
1503,
19,
198,
53,
1503,
20,
796,
569,
1503,
20,
198,
53,
1503,
21,
796,
569,
1503,
21,
198,
53,
1503,
22,
796,
569,
1503,
22,
198,
53,
1503,
23,
796,
569,
1503,
23,
198,
53,
1503,
24,
796,
569,
1503,
24,
198,
13,
198,
16876,
2420,
312,
3180,
3268,
2043,
12576,
13,
198,
220,
220,
502,
3784,
5239,
312,
796,
1220,
38,
1847,
14,
34,
55,
62,
49,
6465,
62,
5097,
28495,
62,
6369,
42006,
2849,
764,
198,
23578,
5064,
13,
198,
220,
886,
24396,
13,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1
] |
CLASS zcl_abapgit_file_status DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS status
IMPORTING io_repo TYPE REF TO zcl_abapgit_repo
ii_log TYPE REF TO zif_abapgit_log OPTIONAL
RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
RAISING zcx_abapgit_exception.
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS:
calculate_status
IMPORTING iv_devclass TYPE devclass
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
it_remote TYPE zif_abapgit_definitions=>ty_files_tt
it_cur_state TYPE zif_abapgit_definitions=>ty_file_signatures_tt
RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
RAISING zcx_abapgit_exception,
run_checks
IMPORTING ii_log TYPE REF TO zif_abapgit_log
it_results TYPE zif_abapgit_definitions=>ty_results_tt
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
iv_top TYPE devclass
RAISING zcx_abapgit_exception,
build_existing
IMPORTING is_local TYPE zif_abapgit_definitions=>ty_file_item
is_remote TYPE zif_abapgit_definitions=>ty_file
it_state TYPE zif_abapgit_definitions=>ty_file_signatures_ts
RETURNING VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result,
build_new_local
IMPORTING is_local TYPE zif_abapgit_definitions=>ty_file_item
RETURNING VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result,
build_new_remote
IMPORTING iv_devclass TYPE devclass
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
is_remote TYPE zif_abapgit_definitions=>ty_file
it_items TYPE zif_abapgit_definitions=>ty_items_ts
it_state TYPE zif_abapgit_definitions=>ty_file_signatures_ts
RETURNING VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result
RAISING zcx_abapgit_exception,
identify_object
IMPORTING iv_filename TYPE string
iv_path TYPE string
iv_devclass TYPE devclass
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
EXPORTING es_item TYPE zif_abapgit_definitions=>ty_item
ev_is_xml TYPE abap_bool
RAISING zcx_abapgit_exception,
get_object_package
IMPORTING
iv_object TYPE tadir-object
iv_obj_name TYPE tadir-obj_name
RETURNING
VALUE(rv_devclass) TYPE devclass
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_file_status IMPLEMENTATION.
METHOD build_existing.
DATA: ls_file_sig LIKE LINE OF it_state.
" Item
rs_result-obj_type = is_local-item-obj_type.
rs_result-obj_name = is_local-item-obj_name.
rs_result-package = is_local-item-devclass.
" File
rs_result-path = is_local-file-path.
rs_result-filename = is_local-file-filename.
IF is_local-file-sha1 = is_remote-sha1.
rs_result-match = abap_true.
RETURN.
ENDIF.
" Match against current state
READ TABLE it_state INTO ls_file_sig
WITH KEY path = is_local-file-path
filename = is_local-file-filename
BINARY SEARCH.
IF sy-subrc = 0.
IF ls_file_sig-sha1 <> is_local-file-sha1.
rs_result-lstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
IF ls_file_sig-sha1 <> is_remote-sha1.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
rs_result-match = boolc( rs_result-lstate IS INITIAL
AND rs_result-rstate IS INITIAL ).
ELSE.
" This is a strange situation. As both local and remote exist
" the state should also be present. Maybe this is a first run of the code.
" In this case just compare hashes directly and mark both changed
" the user will presumably decide what to do after checking the actual diff
rs_result-match = boolc( is_local-file-sha1 = is_remote-sha1 ).
IF rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-modified.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD build_new_local.
" Item
rs_result-obj_type = is_local-item-obj_type.
rs_result-obj_name = is_local-item-obj_name.
rs_result-package = is_local-item-devclass.
" File
rs_result-path = is_local-file-path.
rs_result-filename = is_local-file-filename.
" Match
rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-added.
ENDMETHOD.
METHOD build_new_remote.
DATA: ls_item LIKE LINE OF it_items,
ls_file_sig LIKE LINE OF it_state.
" Common and default part
rs_result-path = is_remote-path.
rs_result-filename = is_remote-filename.
rs_result-match = abap_false.
rs_result-rstate = zif_abapgit_definitions=>c_state-added.
identify_object( EXPORTING iv_filename = is_remote-filename
iv_path = is_remote-path
iv_devclass = iv_devclass
io_dot = io_dot
IMPORTING es_item = ls_item ).
" Check if in item index + get package
READ TABLE it_items INTO ls_item
WITH KEY obj_type = ls_item-obj_type obj_name = ls_item-obj_name
BINARY SEARCH.
IF sy-subrc = 0.
" Completely new (xml, abap) and new file in an existing object
rs_result-obj_type = ls_item-obj_type.
rs_result-obj_name = ls_item-obj_name.
rs_result-package = ls_item-devclass.
READ TABLE it_state INTO ls_file_sig
WITH KEY path = is_remote-path filename = is_remote-filename
BINARY SEARCH.
" Existing file but from another package
" was not added during local file proc as was not in tadir for repo package
IF sy-subrc = 0.
IF ls_file_sig-sha1 = is_remote-sha1.
rs_result-match = abap_true.
CLEAR rs_result-rstate.
ELSE.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
" Item is in state and in cache but with no package - it was deleted
" OR devclass is the same as repo package (see #532)
IF ls_item-devclass IS INITIAL OR ls_item-devclass = iv_devclass.
rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ELSE. " Completely unknown file, probably non-abapgit
ASSERT 1 = 1. " No action, just follow defaults
ENDIF.
ENDMETHOD.
METHOD calculate_status.
DATA: lt_remote LIKE it_remote,
lt_items TYPE zif_abapgit_definitions=>ty_items_tt,
ls_item LIKE LINE OF lt_items,
lv_is_xml TYPE abap_bool,
lv_sub_fetched TYPE abap_bool,
lt_sub_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt,
lt_items_idx TYPE zif_abapgit_definitions=>ty_items_ts,
lt_state_idx TYPE zif_abapgit_definitions=>ty_file_signatures_ts. " Sorted by path+filename
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF it_remote,
<ls_result> LIKE LINE OF rt_results,
<ls_state> LIKE LINE OF it_cur_state,
<ls_local> LIKE LINE OF it_local.
lt_state_idx = it_cur_state. " Force sort it
lt_remote = it_remote.
SORT lt_remote BY path filename.
" Process local files and new local files
LOOP AT it_local ASSIGNING <ls_local>.
APPEND INITIAL LINE TO rt_results ASSIGNING <ls_result>.
IF <ls_local>-item IS NOT INITIAL.
APPEND <ls_local>-item TO lt_items. " Collect for item index
ENDIF.
READ TABLE lt_remote ASSIGNING <ls_remote>
WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename
BINARY SEARCH.
IF sy-subrc = 0. " Exist local and remote
<ls_result> = build_existing(
is_local = <ls_local>
is_remote = <ls_remote>
it_state = lt_state_idx ).
ASSERT <ls_remote>-sha1 IS NOT INITIAL.
CLEAR <ls_remote>-sha1. " Mark as processed
ELSE. " Only L exists
<ls_result> = build_new_local( <ls_local> ).
" Check if same file exists in different location
READ TABLE lt_remote ASSIGNING <ls_remote>
WITH KEY filename = <ls_local>-file-filename.
IF sy-subrc = 0 AND <ls_local>-file-sha1 = <ls_remote>-sha1.
<ls_result>-packmove = abap_true.
CLEAR <ls_remote>-sha1. " Mark as processed
ELSEIF sy-subrc = 4.
" Check if file existed before and was deleted remotely
READ TABLE lt_state_idx ASSIGNING <ls_state>
WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename
BINARY SEARCH.
IF sy-subrc = 0.
IF <ls_local>-file-sha1 = <ls_state>-sha1.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-unchanged.
ELSE.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
<ls_result>-rstate = zif_abapgit_definitions=>c_state-deleted.
CLEAR <ls_remote>-sha1. " Mark as processed
ENDIF.
ENDIF.
ENDIF.
<ls_result>-inactive = <ls_local>-item-inactive.
ENDLOOP.
" Complete item index for unmarked remote files
LOOP AT lt_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL.
identify_object( EXPORTING iv_filename = <ls_remote>-filename
iv_path = <ls_remote>-path
io_dot = io_dot
iv_devclass = iv_devclass
IMPORTING es_item = ls_item
ev_is_xml = lv_is_xml ).
CHECK lv_is_xml = abap_true. " Skip all but obj definitions
ls_item-devclass = get_object_package(
iv_object = ls_item-obj_type
iv_obj_name = ls_item-obj_name ).
IF NOT ls_item-devclass IS INITIAL AND iv_devclass <> ls_item-devclass.
IF lv_sub_fetched = abap_false.
lt_sub_packages = zcl_abapgit_factory=>get_sap_package( iv_devclass )->list_subpackages( ).
lv_sub_fetched = abap_true.
SORT lt_sub_packages BY table_line. "Optimize Read Access
ENDIF.
" Make sure the package is under the repo main package
READ TABLE lt_sub_packages TRANSPORTING NO FIELDS
WITH KEY table_line = ls_item-devclass
BINARY SEARCH.
IF sy-subrc <> 0.
CLEAR ls_item-devclass.
ENDIF.
ENDIF.
APPEND ls_item TO lt_items.
ENDLOOP.
SORT lt_items DESCENDING. " Default key - type, name, pkg, inactive
DELETE ADJACENT DUPLICATES FROM lt_items COMPARING obj_type obj_name devclass.
lt_items_idx = lt_items. " Self protection + UNIQUE records assertion
" Process new remote files (marked above with empty SHA1)
LOOP AT lt_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL.
APPEND INITIAL LINE TO rt_results ASSIGNING <ls_result>.
<ls_result> = build_new_remote( iv_devclass = iv_devclass
io_dot = io_dot
is_remote = <ls_remote>
it_items = lt_items_idx
it_state = lt_state_idx ).
" Check if same file exists in different location
READ TABLE it_local ASSIGNING <ls_local>
WITH KEY file-filename = <ls_remote>-filename.
IF sy-subrc = 0 AND <ls_local>-file-sha1 = <ls_remote>-sha1.
<ls_result>-packmove = abap_true.
ELSEIF sy-subrc = 4.
" Check if file existed before and was deleted locally
READ TABLE lt_state_idx ASSIGNING <ls_state>
WITH KEY path = <ls_remote>-path filename = <ls_remote>-filename
BINARY SEARCH.
IF sy-subrc = 0.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ENDLOOP.
SORT rt_results BY
obj_type ASCENDING
obj_name ASCENDING
filename ASCENDING.
ENDMETHOD.
METHOD get_object_package.
DATA: lv_name TYPE devclass,
li_package TYPE REF TO zif_abapgit_sap_package.
rv_devclass = zcl_abapgit_factory=>get_tadir( )->get_object_package(
iv_object = iv_object
iv_obj_name = iv_obj_name ).
IF rv_devclass IS INITIAL AND iv_object = 'DEVC' AND iv_obj_name(1) = '$'.
" local packages usually have no tadir entry
lv_name = iv_obj_name.
li_package = zcl_abapgit_factory=>get_sap_package( lv_name ).
IF li_package->exists( ) = abap_true.
rv_devclass = lv_name.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD identify_object.
DATA: lv_name TYPE string,
lv_type TYPE string,
lv_ext TYPE string.
" Guess object type and name
SPLIT to_upper( iv_filename ) AT '.' INTO lv_name lv_type lv_ext.
" Handle namespaces
REPLACE ALL OCCURRENCES OF '#' IN lv_name WITH '/'.
REPLACE ALL OCCURRENCES OF '#' IN lv_type WITH '/'.
REPLACE ALL OCCURRENCES OF '#' IN lv_ext WITH '/'.
" The counter part to this logic must be maintained in ZCL_ABAPGIT_OBJECTS_FILES->FILENAME
IF lv_type = 'DEVC'.
" Try to get a unique package name for DEVC by using the path
ASSERT lv_name = 'PACKAGE'.
lv_name = zcl_abapgit_folder_logic=>get_instance( )->path_to_package(
iv_top = iv_devclass
io_dot = io_dot
iv_create_if_not_exists = abap_false
iv_path = iv_path ).
ELSE.
" Get original object name
lv_name = cl_http_utility=>unescape_url( lv_name ).
ENDIF.
CLEAR es_item.
es_item-obj_type = lv_type.
es_item-obj_name = lv_name.
ev_is_xml = boolc( lv_ext = 'XML' AND strlen( lv_type ) = 4 ).
ENDMETHOD.
METHOD run_checks.
DATA: lv_path TYPE string,
ls_item TYPE zif_abapgit_definitions=>ty_item,
ls_file TYPE zif_abapgit_definitions=>ty_file_signature,
lt_res_sort LIKE it_results,
lt_item_idx LIKE it_results,
lt_move_idx LIKE it_results,
lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic.
FIELD-SYMBOLS: <ls_res1> LIKE LINE OF it_results,
<ls_res2> LIKE LINE OF it_results.
" This method just adds messages to the log. No log, nothing to do here
IF ii_log IS INITIAL.
RETURN.
ENDIF.
" Find all objects which were assigned to a different package
LOOP AT it_results ASSIGNING <ls_res1>
WHERE lstate = zif_abapgit_definitions=>c_state-added AND packmove = abap_true.
READ TABLE lt_move_idx TRANSPORTING NO FIELDS
WITH KEY obj_type = <ls_res1>-obj_type obj_name = <ls_res1>-obj_name
BINARY SEARCH. " Sorted since it_result is sorted
IF sy-subrc <> 0.
ii_log->add( iv_msg = |Changed package assignment for object { <ls_res1>-obj_type } { <ls_res1>-obj_name }|
iv_type = 'W'
iv_rc = '5' ).
APPEND INITIAL LINE TO lt_move_idx ASSIGNING <ls_res2>.
<ls_res2>-obj_type = <ls_res1>-obj_type.
<ls_res2>-obj_name = <ls_res1>-obj_name.
<ls_res2>-path = <ls_res1>-path.
ENDIF.
ENDLOOP.
" Collect object indexe
lt_res_sort = it_results.
SORT lt_res_sort BY obj_type ASCENDING obj_name ASCENDING.
LOOP AT it_results ASSIGNING <ls_res1> WHERE NOT obj_type IS INITIAL AND packmove = abap_false.
IF NOT ( <ls_res1>-obj_type = ls_item-obj_type
AND <ls_res1>-obj_name = ls_item-obj_name ).
APPEND INITIAL LINE TO lt_item_idx ASSIGNING <ls_res2>.
<ls_res2>-obj_type = <ls_res1>-obj_type.
<ls_res2>-obj_name = <ls_res1>-obj_name.
<ls_res2>-path = <ls_res1>-path.
MOVE-CORRESPONDING <ls_res1> TO ls_item.
ENDIF.
ENDLOOP.
" Check files for one object is in the same folder
LOOP AT it_results ASSIGNING <ls_res1>
WHERE NOT obj_type IS INITIAL AND obj_type <> 'DEVC' AND packmove = abap_false.
READ TABLE lt_item_idx ASSIGNING <ls_res2>
WITH KEY obj_type = <ls_res1>-obj_type obj_name = <ls_res1>-obj_name
BINARY SEARCH. " Sorted above
IF sy-subrc <> 0 OR <ls_res1>-path <> <ls_res2>-path. " All paths are same
ii_log->add( iv_msg = |Files for object { <ls_res1>-obj_type } {
<ls_res1>-obj_name } are not placed in the same folder|
iv_type = 'W'
iv_rc = '1' ).
ENDIF.
ENDLOOP.
" Check that objects are created in package corresponding to folder
lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ).
LOOP AT it_results ASSIGNING <ls_res1>
WHERE NOT package IS INITIAL AND NOT path IS INITIAL AND packmove = abap_false.
lv_path = lo_folder_logic->package_to_path(
iv_top = iv_top
io_dot = io_dot
iv_package = <ls_res1>-package ).
IF lv_path <> <ls_res1>-path.
ii_log->add( iv_msg = |Package and path does not match for object, {
<ls_res1>-obj_type } { <ls_res1>-obj_name }|
iv_type = 'W'
iv_rc = '2' ).
ENDIF.
ENDLOOP.
" Check for multiple files with same filename
SORT lt_res_sort BY filename ASCENDING.
LOOP AT lt_res_sort ASSIGNING <ls_res1> WHERE obj_type <> 'DEVC' AND packmove = abap_false.
IF <ls_res1>-filename IS NOT INITIAL AND <ls_res1>-filename = ls_file-filename.
ii_log->add( iv_msg = |Multiple files with same filename, { <ls_res1>-filename }|
iv_type = 'W'
iv_rc = '3' ).
ENDIF.
IF <ls_res1>-filename IS INITIAL.
ii_log->add( iv_msg = |Filename is empty for object { <ls_res1>-obj_type } { <ls_res1>-obj_name }|
iv_type = 'W'
iv_rc = '4' ).
ENDIF.
MOVE-CORRESPONDING <ls_res1> TO ls_file.
ENDLOOP.
ENDMETHOD.
METHOD status.
DATA: lv_index LIKE sy-tabix,
lo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit,
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt.
FIELD-SYMBOLS: <ls_result> LIKE LINE OF rt_results.
lt_local = io_repo->get_files_local( ii_log = ii_log ).
IF lines( lt_local ) <= 2.
" Less equal two means that we have only the .abapgit.xml and the package in
" our local repository. In this case we have to update our local .abapgit.xml
" from the remote one. Otherwise we get errors when e.g. the folder starting
" folder is different.
io_repo->find_remote_dot_abapgit( ).
ENDIF.
rt_results = calculate_status(
iv_devclass = io_repo->get_package( )
io_dot = io_repo->get_dot_abapgit( )
it_local = io_repo->get_files_local( ii_log = ii_log )
it_remote = io_repo->get_files_remote( )
it_cur_state = io_repo->get_local_checksums_per_file( ) ).
lo_dot_abapgit = io_repo->get_dot_abapgit( ).
" Remove ignored files, fix .abapgit
LOOP AT rt_results ASSIGNING <ls_result>.
lv_index = sy-tabix.
IF lo_dot_abapgit->is_ignored(
iv_path = <ls_result>-path
iv_filename = <ls_result>-filename ) = abap_true.
DELETE rt_results INDEX lv_index.
ENDIF.
ENDLOOP.
run_checks(
ii_log = ii_log
it_results = rt_results
io_dot = lo_dot_abapgit
iv_top = io_repo->get_package( ) ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
7753,
62,
13376,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
3722,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
33245,
62,
260,
7501,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
260,
7501,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21065,
62,
6404,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
6404,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
17034,
62,
43420,
8,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
43420,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
25,
198,
220,
220,
220,
220,
220,
15284,
62,
13376,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
7959,
4871,
220,
220,
220,
220,
220,
220,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
26518,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
26518,
62,
397,
499,
18300,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
16624,
62,
9186,
62,
926,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
47960,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
16624,
62,
926,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
22019,
62,
5219,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
7753,
62,
12683,
6691,
62,
926,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
17034,
62,
43420,
8,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
43420,
62,
926,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
220,
220,
1057,
62,
42116,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21065,
62,
6404,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
6404,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
43420,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
43420,
62,
926,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
26518,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
26518,
62,
397,
499,
18300,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
4852,
220,
220,
220,
220,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
220,
220,
1382,
62,
25687,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
318,
62,
12001,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
7753,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
47960,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
7753,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
5219,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
7753,
62,
12683,
6691,
62,
912,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
3808,
62,
20274,
8,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
20274,
11,
198,
220,
220,
220,
220,
220,
1382,
62,
3605,
62,
12001,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
318,
62,
12001,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
7753,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
3808,
62,
20274,
8,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
20274,
11,
198,
220,
220,
220,
220,
220,
1382,
62,
3605,
62,
47960,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
7959,
4871,
220,
220,
220,
220,
220,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
26518,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
26518,
62,
397,
499,
18300,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
47960,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
7753,
198,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
"! <p class="shorttext synchronized" lang="en">Helper for table joins</p>
CLASS zcl_sat_join_helper DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
TYPES:
"! <p class="shorttext synchronized" lang="en">Join Condition Type</p>
"! Internal type for Join Condition which is used for building the
"! FROM clause
BEGIN OF ty_join_condition,
join_operator TYPE string,
open_bracket TYPE string,
value TYPE string,
closing_bracket TYPE string,
END OF ty_join_condition .
TYPES:
tt_join_conditions TYPE STANDARD TABLE OF ty_join_condition WITH EMPTY KEY .
"! <p class="shorttext synchronized" lang="en">Builds FROM SQL clause for join definition</p>
CLASS-METHODS build_from_clause_for_join_def
IMPORTING
!is_join_def TYPE zif_sat_ty_global=>ty_s_join_def OPTIONAL
if_use_ddl_for_select TYPE abap_bool OPTIONAL
!it_table_alias_map TYPE zsat_table_to_alias_map_itab OPTIONAL
RETURNING
VALUE(rt_from_clause) TYPE string_table .
"! <p class="shorttext synchronized" lang="en">Builds where clause for given conditions</p>
CLASS-METHODS build_where_for_conditions
IMPORTING
it_conditions TYPE tt_join_conditions
RETURNING
VALUE(rt_where) TYPE string_table .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_join_table,
join_type TYPE string,
table TYPE string,
conditions TYPE tt_join_conditions,
END OF ty_join_table .
TYPES:
tt_join_table TYPE STANDARD TABLE OF ty_join_table WITH EMPTY KEY .
TYPES:
BEGIN OF ty_join,
primary_table TYPE string,
tables TYPE tt_join_table,
END OF ty_join .
"! <p class="shorttext synchronized" lang="en">Fills missing operators, etc.</p>
CLASS-METHODS repair_join_definition
IMPORTING
!is_join_def TYPE zif_sat_ty_global=>ty_s_join_def
if_use_ddl_for_select TYPE abap_bool OPTIONAL
RETURNING
VALUE(rs_join_def) TYPE zif_sat_ty_global=>ty_s_join_def .
"! <p class="shorttext synchronized" lang="en">Prepares join table definitions for building FROM Strings</p>
CLASS-METHODS prepare_tables
IMPORTING
!is_join_def TYPE zif_sat_ty_global=>ty_s_join_def
RETURNING
VALUE(rs_join) TYPE ty_join .
"! <p class="shorttext synchronized" lang="en">Append parameters string to table clause</p>
CLASS-METHODS append_params_to_table_string
IMPORTING
it_parameters TYPE zsat_table_parameter_t
CHANGING
cv_table_part TYPE string.
ENDCLASS.
CLASS zcl_sat_join_helper IMPLEMENTATION.
METHOD build_from_clause_for_join_def.
DATA(ls_join_def) = repair_join_definition(
if_use_ddl_for_select = if_use_ddl_for_select
is_join_def = is_join_def
).
*.. parse join definition for building the FROM Clause string
DATA(ls_join_enriched) = prepare_tables(
is_join_def = ls_join_def
).
rt_from_clause = VALUE #(
( ls_join_enriched-primary_table )
).
LOOP AT ls_join_enriched-tables ASSIGNING FIELD-SYMBOL(<ls_table>).
rt_from_clause = VALUE #( BASE rt_from_clause
( |{ <ls_table>-join_type }{ <ls_table>-table }| )
).
LOOP AT <ls_table>-conditions ASSIGNING FIELD-SYMBOL(<ls_cond>).
rt_from_clause = VALUE #( BASE rt_from_clause
( |{ <ls_cond>-join_operator }{ <ls_cond>-open_bracket }{ <ls_cond>-value }{ <ls_cond>-closing_bracket }| )
).
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD build_where_for_conditions.
LOOP AT it_conditions ASSIGNING FIELD-SYMBOL(<ls_cond>).
rt_where = VALUE #( BASE rt_where
( |{ <ls_cond>-join_operator }{ <ls_cond>-open_bracket }{ <ls_cond>-value }{ <ls_cond>-closing_bracket }| )
).
ENDLOOP.
ENDMETHOD.
METHOD prepare_tables.
DATA: lv_on_string TYPE string,
lv_and_string TYPE string,
lv_or_string TYPE string,
lf_parenthesis_opened TYPE abap_bool,
lv_parenthesis_open TYPE string,
lv_parenthesis_closed TYPE string,
lv_reference_alias TYPE string,
ls_new_condition TYPE ty_join_condition,
lv_index TYPE sy-tabix,
lv_previous_join_cond TYPE string.
FIELD-SYMBOLS: <ls_last_condition> TYPE ty_join_condition.
*... prefill some needed join condition operator strings
lv_on_string = | { zif_sat_c_selection_condition=>on ALIGN = RIGHT WIDTH = 5 } |.
lv_and_string = | { zif_sat_c_selection_condition=>and ALIGN = RIGHT WIDTH = 5 } |.
lv_or_string = | { zif_sat_c_selection_condition=>or ALIGN = RIGHT WIDTH = 5 } |.
rs_join-primary_table = is_join_def-primary_table.
IF is_join_def-parameters IS NOT INITIAL.
append_params_to_table_string(
EXPORTING it_parameters = is_join_def-parameters
CHANGING cv_table_part = rs_join-primary_table
).
ENDIF.
rs_join-primary_table = rs_join-primary_table && | AS | &&
COND #( WHEN is_join_def-primary_table_alias IS NOT INITIAL THEN
is_join_def-primary_table_alias
).
*... build joins for defined join tables
LOOP AT is_join_def-tables ASSIGNING FIELD-SYMBOL(<ls_join_table>) WHERE is_virtual = abap_false.
DATA(lv_join_table_alias) = COND #( WHEN <ls_join_table>-add_table_alias IS NOT INITIAL THEN
<ls_join_table>-add_table_alias ).
DATA(lv_join_type_text) = SWITCH string(
<ls_join_table>-join_type
WHEN zif_sat_c_join_types=>inner_join THEN |INNER JOIN |
WHEN zif_sat_c_join_types=>left_outer_join THEN |LEFT OUTER JOIN |
WHEN zif_sat_c_join_types=>right_outer_join THEN |RIGHT OUTER JOIN |
).
DATA(ls_parsed_table) = VALUE ty_join_table(
join_type = lv_join_type_text
table = |{ <ls_join_table>-add_table }|
).
IF <ls_join_table>-parameters IS NOT INITIAL.
append_params_to_table_string(
EXPORTING it_parameters = <ls_join_table>-parameters
CHANGING cv_table_part = ls_parsed_table-table
).
ENDIF.
ls_parsed_table-table = |{ ls_parsed_table-table } AS { lv_join_table_alias }|.
*.... parse the conditions
LOOP AT <ls_join_table>-conditions INTO DATA(ls_cond).
lv_index = sy-tabix.
*...... Determine the alias of the reference field
IF ls_cond-type = zif_sat_c_join_cond_type=>field.
lv_reference_alias = COND #( WHEN ls_cond-ref_table_alias IS NOT INITIAL THEN
ls_cond-ref_table_alias
WHEN ls_cond-ref_table = is_join_def-primary_table THEN
is_join_def-primary_table_alias
ELSE
is_join_def-tables[ add_table = ls_cond-ref_table ]-add_table_alias ).
ELSE.
lv_reference_alias = COND #( WHEN ls_cond-tabname_alias IS NOT INITIAL THEN
ls_cond-tabname_alias
WHEN ls_cond-tabname = is_join_def-primary_table THEN
is_join_def-primary_table_alias
WHEN ls_cond-tabname IS NOT INITIAL THEN
is_join_def-tables[ add_table = ls_cond-tabname ]-add_table_alias ).
ENDIF.
*...... check for need of possible open parenthesis
IF ls_cond-and_or = zif_sat_c_selection_condition=>or.
IF lf_parenthesis_opened = abap_false.
lv_parenthesis_open = |( |.
lf_parenthesis_opened = abap_true.
ENDIF.
ELSE.
IF lf_parenthesis_opened = abap_true.
lv_parenthesis_closed = | )|.
lf_parenthesis_opened = abap_false.
ENDIF.
ENDIF.
IF ls_cond-type = zif_sat_c_join_cond_type=>field.
ls_parsed_table-conditions = VALUE #( BASE ls_parsed_table-conditions
( open_bracket = lv_parenthesis_open
join_operator = COND #( WHEN lv_index = 1 THEN lv_on_string ELSE lv_previous_join_cond )
value = |{ lv_join_table_alias }~{ ls_cond-field } { ls_cond-operator } | &&
|{ lv_reference_alias }~{ ls_cond-ref_field }|
closing_bracket = lv_parenthesis_closed )
).
ELSE.
DATA(lv_value1) = |{ ls_cond-value }|.
DATA(lv_value2) = ||.
*........ handle LIKE and NOT LIKE operator
IF ( ls_cond-operator = zif_sat_c_operator=>like OR
ls_cond-operator = zif_sat_c_operator=>not_like ) AND
ls_cond-value_type <> zif_sat_c_join_cond_val_type=>system_value_input.
*** ls_filter_cond-value = replace( val = ls_filter_cond-value sub = '*' with = '%' occ = 0 ).
*.......... Use proper SAP to SQL conversion for pattern
zcl_sat_like_pattern_convrter=>conv_sap_to_sql_pattern(
EXPORTING iv_sap_pattern = lv_value1
IMPORTING ev_sql_pattern = lv_value1
ef_escape_needed = DATA(lf_escape_needed)
EXCEPTIONS OTHERS = 1
).
lv_value1 = cl_abap_dyn_prg=>quote( lv_value1 ).
IF lf_escape_needed = abap_true.
lv_value1 = |{ lv_value1 } ESCAPE '#' |.
ENDIF.
CLEAR ls_cond-value2.
ELSE.
IF ls_cond-value_type = zif_sat_c_join_cond_val_type=>system_value_input.
IF lv_value1 = 'SY-LANGU'.
lv_value1 = cl_abap_dyn_prg=>quote( zcl_sat_system_helper=>get_system_language( ) ).
ELSE.
lv_value1 = |@{ lv_value1 }|.
ENDIF.
ELSE.
lv_value1 = cl_abap_dyn_prg=>quote( lv_value1 ).
ENDIF.
ENDIF.
IF ls_cond-operator = 'BETWEEN'.
lv_value2 = COND #(
WHEN ls_cond-value_type = zif_sat_c_join_cond_val_type=>system_value_input THEN
|@{ ls_cond-value2 }|
ELSE
cl_abap_dyn_prg=>quote( ls_cond-value2 )
).
lv_value2 = | { zif_sat_c_selection_condition=>and } { lv_value2 }|.
ENDIF.
ls_parsed_table-conditions = VALUE #( BASE ls_parsed_table-conditions
( open_bracket = lv_parenthesis_open
join_operator = COND #( WHEN lv_index = 1 THEN lv_on_string ELSE lv_previous_join_cond )
value = |{ lv_reference_alias }~{ ls_cond-field }| &&
| { ls_cond-operator } | &&
|{ lv_value1 }{ lv_value2 }|
closing_bracket = lv_parenthesis_closed )
).
ENDIF.
lv_previous_join_cond = COND #( WHEN ls_cond-and_or = zif_sat_c_selection_condition=>or THEN lv_or_string ELSE lv_and_string ).
CLEAR: lv_parenthesis_closed,
lv_parenthesis_open.
IF lf_parenthesis_opened = abap_true.
lv_parenthesis_open = | |.
ENDIF.
ENDLOOP.
rs_join-tables = VALUE #( BASE rs_join-tables ( ls_parsed_table ) ).
ENDLOOP.
ENDMETHOD.
METHOD repair_join_definition.
FIELD-SYMBOLS: <ls_condition> TYPE zsat_join_condition_data.
rs_join_def = is_join_def.
IF is_join_def-primary_table_entity_type = zif_sat_c_entity_type=>cds_view AND
( if_use_ddl_for_select = abap_true OR sy-saprl < 750 ).
rs_join_def-primary_table = zcl_sat_cds_view_factory=>read_ddl_ddic_view_for_entity( is_join_def-primary_table ).
ENDIF.
LOOP AT rs_join_def-tables ASSIGNING FIELD-SYMBOL(<ls_table>).
*.... fill unified condition table
IF <ls_table>-conditions IS INITIAL.
*....... First the field conditions are added
LOOP AT <ls_table>-field_conditions ASSIGNING FIELD-SYMBOL(<ls_field_cond>).
APPEND INITIAL LINE TO <ls_table>-conditions ASSIGNING <ls_condition>.
<ls_condition> = CORRESPONDING #( <ls_field_cond> ).
<ls_condition>-type = zif_sat_c_join_cond_type=>field.
<ls_condition>-and_or = zif_sat_c_selection_condition=>and.
ENDLOOP.
*........ and then the filter conditions
LOOP AT <ls_table>-filter_conditions ASSIGNING FIELD-SYMBOL(<ls_filter_cond>).
APPEND INITIAL LINE TO <ls_table>-conditions ASSIGNING <ls_condition>.
<ls_condition> = CORRESPONDING #( <ls_filter_cond> MAPPING field = fieldname ).
<ls_condition>-type = zif_sat_c_join_cond_type=>filter.
ENDLOOP.
*...... remove the last condition operator
IF <ls_table>-conditions IS NOT INITIAL.
<ls_table>-conditions[ lines( <ls_table>-conditions ) ]-and_or = space.
ENDIF.
ENDIF.
IF <ls_table>-entity_type = zif_sat_c_entity_type=>cds_view AND
( if_use_ddl_for_select = abap_true OR sy-saprl < 750 ).
<ls_table>-add_table = zcl_sat_cds_view_factory=>read_ddl_ddic_view_for_entity( <ls_table>-add_table ).
ENDIF.
IF <ls_table>-join_type IS INITIAL.
<ls_table>-join_type = zif_sat_c_join_types=>inner_join.
ENDIF.
LOOP AT <ls_table>-conditions ASSIGNING <ls_condition>.
IF <ls_condition>-type IS INITIAL.
<ls_condition>-type = zif_sat_c_join_cond_type=>field.
ENDIF.
IF <ls_condition>-operator IS INITIAL.
<ls_condition>-operator = zif_sat_c_operator=>equals.
ENDIF.
*...... Not quite sure if this can't still result in an erroneous select
IF <ls_condition>-tabname IS INITIAL AND <ls_condition>-tabname_alias IS INITIAL.
<ls_condition>-tabname = <ls_table>-table_name.
ENDIF.
IF <ls_condition>-value_type IS INITIAL.
<ls_condition>-value_type = zif_sat_c_join_cond_val_type=>typed_input.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD append_params_to_table_string.
cv_table_part = REDUCE string(
INIT value = |{ cv_table_part }( | sep = ``
FOR param IN it_parameters
NEXT value = |{ value }{ sep }{ param-param_name } = { cl_abap_dyn_prg=>quote( param-param_value ) }| sep = `, `
) && | )|.
ENDMETHOD.
ENDCLASS.
| [
40484,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
47429,
329,
3084,
15449,
3556,
79,
29,
198,
31631,
1976,
565,
62,
49720,
62,
22179,
62,
2978,
525,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
18234,
24295,
5994,
3556,
79,
29,
198,
220,
220,
220,
220,
220,
366,
0,
18628,
2099,
329,
15251,
24295,
543,
318,
973,
329,
2615,
262,
198,
220,
220,
220,
220,
220,
366,
0,
16034,
13444,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
22179,
62,
31448,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4654,
62,
46616,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1280,
62,
1671,
8317,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
9605,
62,
1671,
8317,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
22179,
62,
31448,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
256,
83,
62,
22179,
62,
17561,
1756,
41876,
49053,
9795,
43679,
3963,
1259,
62,
22179,
62,
31448,
13315,
38144,
9936,
35374,
764,
628,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
15580,
82,
16034,
16363,
13444,
329,
4654,
6770,
3556,
79,
29,
198,
220,
220,
220,
42715,
12,
49273,
50,
1382,
62,
6738,
62,
565,
682,
62,
1640,
62,
22179,
62,
4299,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
22179,
62,
4299,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
49720,
62,
774,
62,
20541,
14804,
774,
62,
82,
62,
22179,
62,
4299,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
611,
62,
1904,
62,
1860,
75,
62,
1640,
62,
19738,
41876,
450,
499,
62,
30388,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
11487,
62,
26011,
62,
8899,
220,
220,
41876,
1976,
49720,
62,
11487,
62,
1462,
62,
26011,
62,
8899,
62,
270,
397,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
6738,
62,
565,
682,
8,
41876,
4731,
62,
11487,
764,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
15580,
82,
810,
13444,
329,
1813,
3403,
3556,
79,
29,
198,
220,
220,
220,
42715,
12,
49273,
50,
1382,
62,
3003,
62,
1640,
62,
17561,
1756,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
17561,
1756,
220,
220,
41876,
256,
83,
62,
22179,
62,
17561,
1756,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
3003,
8,
41876,
4731,
62,
11487,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
22179,
62,
11487,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4654,
62,
4906,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3084,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3403,
41876,
256,
83,
62,
22179,
62,
17561,
1756,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
22179,
62,
11487,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
256,
83,
62,
22179,
62,
11487,
41876,
49053,
9795,
43679,
3963,
1259,
62,
22179,
62,
11487,
13315,
38144,
9936,
35374,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
22179,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4165,
62,
11487,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
8893,
220,
220,
220,
220,
220,
220,
220,
41876,
256,
83,
62,
22179,
62,
11487,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
22179,
764,
628,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
37,
2171,
4814,
12879,
11,
3503,
25970,
79,
29,
198,
220,
220,
220,
42715,
12,
49273,
50,
9185,
62,
22179,
62,
46758,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
22179,
62,
4299,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
49720,
62,
774,
62,
20541,
14804,
774,
62,
82,
62,
22179,
62,
4299,
198,
220,
220,
220,
220,
220,
220,
220,
611,
62,
1904,
62,
1860,
75,
62,
1640,
62,
19738,
41876,
450,
499,
62,
30388,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
3808,
62,
22179,
62,
4299,
8,
220,
220,
220,
41876,
1976,
361,
62,
49720,
62,
774,
62,
20541,
14804,
774,
62,
82,
62,
22179,
62,
4299,
764,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
37534,
3565,
4654,
3084,
17336,
329,
2615,
16034,
4285,
654,
3556,
79,
29,
198,
220,
220,
220,
42715,
12,
49273,
50,
8335,
62,
83,
2977,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
22179,
62,
4299,
220,
220,
41876,
1976,
361,
62,
49720,
62,
774,
62,
20541,
14804,
774,
62,
82,
62,
22179,
62,
4299,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
3808,
62,
22179,
8,
41876
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_object_pers DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
METHODS:
constructor
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
iv_language TYPE spras.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_personalization_object,
pers_reg TYPE spers_reg,
pers_reg_text TYPE spers_regt,
END OF ty_personalization_object.
DATA:
mv_pers_key TYPE spers_key.
METHODS:
get_personalization_object
IMPORTING
iv_create TYPE abap_bool OPTIONAL
iv_view_only TYPE abap_bool OPTIONAL
RETURNING
VALUE(ro_personalization_object) TYPE REF TO cl_pers_reg
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_object_pers IMPLEMENTATION.
METHOD constructor.
super->constructor( is_item = is_item
iv_language = iv_language ).
mv_pers_key = ms_item-obj_name.
ENDMETHOD.
METHOD get_personalization_object.
CREATE OBJECT ro_personalization_object
EXPORTING
p_create = iv_create
p_pers_key = mv_pers_key
p_view_only = iv_view_only
EXCEPTIONS
pers_key_already_exists = 1
pers_key_does_not_exist = 2
transport_view_only = 3
transport_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lo_personalization_object TYPE REF TO cl_pers_reg.
lo_personalization_object = get_personalization_object( ).
lo_personalization_object->delete(
EXPORTING
p_no_confirm = abap_true
EXCEPTIONS
deletion_canceled = 1
deletion_failed = 2
transport_canceled = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA:
ls_personalization_object TYPE ty_personalization_object,
lo_personalization_object TYPE REF TO cl_pers_reg.
io_xml->read(
EXPORTING
iv_name = 'PERS'
CHANGING
cg_data = ls_personalization_object ).
tadir_insert( iv_package ).
lo_personalization_object = get_personalization_object( iv_create = abap_true ).
lo_personalization_object->set_reg_data(
p_pers_reg = ls_personalization_object-pers_reg
p_pers_reg_text = ls_personalization_object-pers_reg_text ).
lo_personalization_object->save(
EXPORTING
no_check = abap_true
EXCEPTIONS
data_not_saved = 1
transport_canceled = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
cl_pers_reg=>exists(
EXPORTING
p_pers_key = mv_pers_key
EXCEPTIONS
pers_key_does_not_exist = 1
OTHERS = 2 ).
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-late TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
" There's no object specific locking. Just a global one.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'E_SPERSREG' ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: ls_bcdata TYPE bdcdata,
lt_bcdata TYPE STANDARD TABLE OF bdcdata.
ls_bcdata-program = 'SAPLSPERS_REG_DIALOG'.
ls_bcdata-dynpro = '0100'.
ls_bcdata-dynbegin = 'X'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'SPERS_REG-PERS_KEY'.
ls_bcdata-fval = ms_item-obj_name.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'BDC_OKCODE'.
ls_bcdata-fval = '=PERSDISPLAY'.
APPEND ls_bcdata TO lt_bcdata.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'PERSREG'
mode_val = 'E'
TABLES
using_tab = lt_bcdata
EXCEPTIONS
call_transaction_denied = 1
tcode_invalid = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |error from ABAP4_CALL_TRANSACTION, PERSREG. SUBRC= { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA:
lo_personalization_object TYPE REF TO cl_pers_reg,
ls_personalization_object TYPE ty_personalization_object.
lo_personalization_object = get_personalization_object( iv_view_only = abap_true ).
lo_personalization_object->get_reg_data(
IMPORTING
p_pers_reg = ls_personalization_object-pers_reg
p_pers_reg_text = ls_personalization_object-pers_reg_text ).
CLEAR:
ls_personalization_object-pers_reg-author,
ls_personalization_object-pers_reg-fdate,
ls_personalization_object-pers_reg-ftime.
io_xml->add( iv_name = 'PERS'
ig_data = ls_personalization_object ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
19276,
5550,
20032,
17941,
44731,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
16668,
25261,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
15252,
13,
198,
220,
220,
220,
8355,
43429,
1546,
6941,
62,
16624,
7473,
1976,
361,
62,
397,
499,
18300,
62,
15252,
93,
5908,
62,
16624,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
23772,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
9186,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
16129,
41876,
7500,
292,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
22682,
1634,
62,
15252,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2774,
62,
2301,
220,
220,
220,
220,
220,
41876,
599,
364,
62,
2301,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2774,
62,
2301,
62,
5239,
41876,
599,
364,
62,
2301,
83,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
22682,
1634,
62,
15252,
13,
628,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
285,
85,
62,
19276,
62,
2539,
41876,
599,
364,
62,
2539,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
651,
62,
22682,
1634,
62,
15252,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
17953,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
30388,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
1177,
62,
8807,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
30388,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
22682,
1634,
62,
15252,
8,
41876,
4526,
37,
5390,
537,
62,
19276,
62,
2301,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
19276,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
23772,
13,
628,
220,
220,
220,
2208,
3784,
41571,
273,
7,
318,
62,
9186,
220,
220,
220,
220,
796,
318,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
16129,
796,
21628,
62,
16129,
6739,
628,
198,
220,
220,
220,
285,
85,
62,
19276,
62,
2539,
796,
13845,
62,
9186,
12,
26801,
62,
3672,
13,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
651,
62,
22682,
1634,
62,
15252,
13,
628,
220,
220,
220,
29244,
6158,
25334,
23680,
686,
62,
22682,
1634,
62,
15252,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
17953,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
21628,
62,
17953,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
19276,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
285,
85,
62,
19276,
62,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
1177,
62,
8807,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
21628,
62,
1177,
62,
8807,
198,
220,
220,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
220,
220,
2774,
62,
2539,
62,
282,
1493,
62,
1069,
1023,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2774,
62,
2539,
62,
22437,
62,
1662,
62,
38476,
796,
362,
198,
220,
220,
220,
220,
220,
220,
220,
4839,
62,
1177,
62,
8807,
220,
220,
220,
220,
796,
513,
198,
220,
220,
220,
220,
220,
220,
220,
4839,
62,
66,
590,
992,
220,
220,
220,
220,
220,
796,
604,
198,
220,
220,
220,
220,
220,
220,
220,
440,
4221,
4877,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
642,
13,
628,
220,
220,
220,
16876,
827,
12,
7266,
6015,
1279,
29,
657,
13,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
62,
83,
3064,
7,
6739,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
397,
499,
18300,
62,
15252,
93,
40985,
62,
1525,
13,
198,
220,
220,
220,
374,
85,
62,
7220,
796,
269,
62,
7220,
62,
34680,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
397,
499,
18300,
62,
15252,
93,
33678,
13,
628,
220,
220,
220,
42865,
25,
2376,
62,
22682,
1634,
62,
15252,
41876,
4526,
37,
5390,
537,
62,
19276,
62,
2301,
13,
628,
220,
220,
220,
2376,
62,
22682,
1634,
62,
15252,
796,
651,
62,
22682,
1634,
62,
15252,
7,
6739,
628,
220,
220,
220,
2376,
62,
22682,
1634,
62,
15252,
3784,
33678,
7,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
3919,
62,
10414,
2533,
220,
220,
220,
220,
220,
220,
796,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
220,
220,
39948,
62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,
1
] |
CLASS /dmo/cl_flight_amdp18 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
CLASS-METHODS convert_currency IMPORTING VALUE(iv_amount) TYPE /dmo/total_price18
VALUE(iv_currency_code_source) TYPE /dmo/currency_code18
VALUE(iv_currency_code_target) TYPE /dmo/currency_code18
VALUE(iv_exchange_rate_date) TYPE d
EXPORTING VALUE(ev_amount) TYPE /dmo/total_price18.
ENDCLASS.
CLASS /dmo/cl_flight_amdp18 IMPLEMENTATION.
METHOD convert_currency BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY .
tab = SELECT CONVERT_CURRENCY( amount => :iv_amount,
source_unit => :iv_currency_code_source,
target_unit => :iv_currency_code_target,
reference_date => :iv_exchange_rate_date,
schema => CURRENT_SCHEMA,
error_handling => 'set to null',
steps => 'shift,convert,shift_back',
client => SESSION_CONTEXT( 'CLIENT' )
) AS target_value
FROM dummy ;
ev_amount = :tab.target_value[1];
ENDMETHOD.
ENDCLASS.
| [
31631,
1220,
67,
5908,
14,
565,
62,
22560,
62,
321,
26059,
1507,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
611,
62,
321,
26059,
62,
4102,
263,
62,
71,
9945,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
10385,
62,
34415,
30023,
9863,
2751,
26173,
8924,
7,
452,
62,
17287,
8,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1220,
67,
5908,
14,
23350,
62,
20888,
1507,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
452,
62,
34415,
62,
8189,
62,
10459,
8,
41876,
1220,
67,
5908,
14,
34415,
62,
8189,
1507,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
452,
62,
34415,
62,
8189,
62,
16793,
8,
41876,
1220,
67,
5908,
14,
34415,
62,
8189,
1507,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
452,
62,
1069,
3803,
62,
4873,
62,
4475,
8,
220,
220,
41876,
288,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7788,
15490,
2751,
26173,
8924,
7,
1990,
62,
17287,
8,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1220,
67,
5908,
14,
23350,
62,
20888,
1507,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1220,
67,
5908,
14,
565,
62,
22560,
62,
321,
26059,
1507,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
10385,
62,
34415,
11050,
360,
1404,
6242,
11159,
41755,
1961,
11335,
7473,
5572,
33,
406,
15567,
52,
11879,
16363,
6173,
46023,
39852,
11053,
20832,
12,
1340,
11319,
764,
198,
220,
220,
220,
7400,
796,
33493,
7102,
15858,
62,
34,
31302,
45155,
7,
2033,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
452,
62,
17287,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2723,
62,
20850,
220,
220,
220,
5218,
1058,
452,
62,
34415,
62,
8189,
62,
10459,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2496,
62,
20850,
220,
220,
220,
5218,
1058,
452,
62,
34415,
62,
8189,
62,
16793,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4941,
62,
4475,
5218,
1058,
452,
62,
1069,
3803,
62,
4873,
62,
4475,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32815,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
327,
39237,
62,
50,
3398,
27630,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4049,
62,
4993,
1359,
5218,
705,
2617,
284,
9242,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4831,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
705,
30846,
11,
1102,
1851,
11,
30846,
62,
1891,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5456,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
311,
47621,
62,
10943,
32541,
7,
705,
5097,
28495,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
7054,
2496,
62,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16034,
31548,
2162,
198,
220,
220,
220,
819,
62,
17287,
796,
1058,
8658,
13,
16793,
62,
8367,
58,
16,
11208,
198,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1
] |
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS FINAL.
PRIVATE SECTION.
DATA:
mi_cut TYPE REF TO zif_mqtt_packet.
METHODS:
setup,
test FOR TESTING.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD setup.
mi_cut = NEW zcl_mqtt_packet_pingreq( ).
ENDMETHOD.
METHOD test.
DATA(lv_hex) = mi_cut->encode( )->get_hex( ).
cl_abap_unit_assert=>assert_equals(
act = lv_hex
exp = 'C000' ).
ENDMETHOD.
ENDCLASS.
| [
198,
31631,
300,
83,
565,
62,
9288,
5550,
20032,
17941,
7473,
43001,
2751,
198,
220,
360,
4261,
6234,
6006,
9863,
198,
220,
45698,
42,
49277,
43638,
5805,
7597,
25261,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
21504,
62,
8968,
41876,
4526,
37,
5390,
1976,
361,
62,
76,
80,
926,
62,
8002,
316,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
9058,
11,
198,
220,
220,
220,
220,
220,
1332,
7473,
43001,
2751,
13,
198,
10619,
31631,
13,
628,
198,
31631,
300,
83,
565,
62,
9288,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
9058,
13,
198,
220,
220,
220,
21504,
62,
8968,
796,
12682,
1976,
565,
62,
76,
80,
926,
62,
8002,
316,
62,
13886,
42180,
7,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1332,
13,
628,
220,
220,
220,
42865,
7,
6780,
62,
33095,
8,
796,
21504,
62,
8968,
3784,
268,
8189,
7,
1267,
3784,
1136,
62,
33095,
7,
6739,
628,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
4853,
874,
7,
198,
220,
220,
220,
220,
220,
719,
796,
300,
85,
62,
33095,
198,
220,
220,
220,
220,
220,
1033,
796,
705,
34,
830,
6,
6739,
628,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
"! <p class="shorttext synchronized" lang="en">Reads element information for a CDS view</p>
CLASS zcl_sat_adt_cds_elinfo_reader DEFINITION
PUBLIC
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES zif_sat_adt_elinfo_reader.
"! <p class="shorttext synchronized" lang="en">Create ADT Object reference for AMDP class</p>
CLASS-METHODS create_amdp_object_ref
IMPORTING
iv_entity_id TYPE zsat_entity_id
RETURNING
VALUE(r_result) TYPE sadt_object_reference.
"! <p class="shorttext synchronized" lang="en">CONSTRUCTOR</p>
METHODS constructor
IMPORTING
io_request TYPE REF TO if_adt_rest_request
iv_cds_view_name TYPE zsat_cds_view_name.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF ty_s_association.
INCLUDE TYPE zsat_cds_association.
TYPES:
ddlname TYPE ddlname,
source_type TYPE char1,
api_state TYPE string.
TYPES: END OF ty_s_association.
TYPES: ty_t_association TYPE STANDARD TABLE OF ty_s_association WITH EMPTY KEY.
DATA mo_request TYPE REF TO if_adt_rest_request.
DATA mv_cds_view_name TYPE zsat_cds_view_name.
DATA ms_element_info TYPE zsat_adt_cds_info.
DATA mf_show_association_name TYPE abap_bool VALUE abap_true.
DATA mv_ddl_view TYPE zsat_cds_view_header-ddlname.
"! <p class="shorttext synchronized" lang="en">Retrieve association of cds view (with ddlnames)</p>
METHODS get_cds_associations
IMPORTING
io_cds_view TYPE REF TO zcl_sat_cds_view
RETURNING
VALUE(rt_association) TYPE ty_t_association.
"! <p class="shorttext synchronized" lang="en">Retrieve API state and text for CDS view</p>
METHODS get_api_state
IMPORTING
io_cds_view TYPE REF TO zcl_sat_cds_view
RETURNING
VALUE(rv_api_state) TYPE string.
"! <p class="shorttext synchronized" lang="en">Fills Base table element information</p>
METHODS fill_base_table_infos
IMPORTING
it_base_tables TYPE zsat_cds_view_base_table_t .
"! <p class="shorttext synchronized" lang="en">Fills association element information </p>
METHODS fill_association_infos
IMPORTING
it_association TYPE ty_t_association.
"! <p class="shorttext synchronized" lang="en">Read additional request parameters</p>
METHODS get_parameters
RAISING
cx_adt_rest.
"! <p class="shorttext synchronized" lang="en">Returns 'X' if this view is an analytics query</p>
METHODS is_analytics_query
IMPORTING
io_cds_view TYPE REF TO zcl_sat_cds_view
RETURNING
VALUE(rv_is_query) TYPE string.
ENDCLASS.
CLASS zcl_sat_adt_cds_elinfo_reader IMPLEMENTATION.
METHOD create_amdp_object_ref.
SELECT
SINGLE
FROM ddtbfuncdep
FIELDS amdp_name
WHERE strucobjn = @iv_entity_id
INTO @DATA(lv_amdp).
CHECK sy-subrc = 0.
SPLIT lv_amdp AT '=>' INTO DATA(lv_class) DATA(lv_method).
SELECT
SINGLE
FROM seoclasstx
FIELDS descript
WHERE clsname = @lv_class
AND langu = @sy-langu
INTO @DATA(lv_description).
*.. TODO: use cl_src_adt_res_obj_struc to read the object structure to be able
*........ to get the ADT URI for the specific AMDP method
r_result = zcl_sat_adt_util=>create_adt_uri(
iv_tadir_type = 'CLAS'
iv_name = CONV #( lv_class )
).
r_result-description = lv_description.
ENDMETHOD.
METHOD constructor.
mo_request = io_request.
mv_cds_view_name = iv_cds_view_name.
ENDMETHOD.
METHOD zif_sat_adt_elinfo_reader~read_element_information.
TRY.
get_parameters( ).
DATA(lo_cds_view) = zcl_sat_cds_view_factory=>read_cds_view( iv_cds_view = mv_cds_view_name ).
DATA(lt_associations) = get_cds_associations( lo_cds_view ).
DATA(lt_base_entities) = lo_cds_view->get_base_tables( ). " get_base_tables( lo_cds_view ).
DATA(ls_header) = lo_cds_view->get_header( ).
mv_ddl_view = ls_header-ddlname.
DATA(ls_tadir_props) = lo_cds_view->get_tadir_info( ).
IF ls_header-source_type = zif_sat_c_cds_view_type=>table_function.
*........ retrieve AMDP class from table
DATA(ls_amdp_ref) = create_amdp_object_ref( iv_entity_id = mv_cds_view_name ).
ENDIF.
ms_element_info = VALUE #(
name = lo_cds_view->mv_view_name
raw_name = ls_header-entityname_raw
is_query = is_analytics_query( lo_cds_view )
amdp_ref = ls_amdp_ref
properties = VALUE #(
package = ls_tadir_props-devclass
owner = ls_tadir_props-created_by
created_date = ls_tadir_props-created_date
changed_date = ls_header-chgdate
*** api_state = get_api_state( lo_cds_view )
)
).
fill_base_table_infos( lt_base_entities ).
fill_association_infos( lt_associations ).
io_rest_response->set_body_data(
content_handler = zcl_sat_adt_ch_factory=>create_cds_elem_info_res_ch( )
data = ms_element_info
).
CATCH zcx_sat_data_read_error INTO DATA(lx_read_error).
RAISE EXCEPTION TYPE zcx_sat_adt_element_info
EXPORTING
textid = cx_adt_rest=>create_textid_from_exc_text( exception = lx_read_error ).
CATCH cx_adt_rest INTO DATA(lx_rest).
RAISE EXCEPTION TYPE zcx_sat_adt_element_info
EXPORTING
textid = cx_adt_rest=>create_textid_from_exc_text( exception = lx_rest ).
ENDTRY.
ENDMETHOD.
METHOD get_parameters.
mf_show_association_name = zcl_sat_adt_res_util=>get_boolean_req_param(
iv_param_name = zif_sat_c_adt_utils=>c_cds_elem_info_parameter-show_association_name
io_request = mo_request
).
ENDMETHOD.
METHOD get_cds_associations.
DATA: lt_entity_range TYPE RANGE OF zsat_entity_id.
CHECK io_cds_view->has_associations( ).
rt_association = CORRESPONDING #( io_cds_view->get_associations( ) ).
lt_entity_range = VALUE #( FOR ref_cds IN rt_association WHERE ( ref_cds_view <> space )
( sign = 'I' option = 'EQ' low = ref_cds-ref_cds_view ) ).
IF mf_show_association_name = abap_false.
SORT rt_association BY ref_cds_view.
DELETE ADJACENT DUPLICATES FROM rt_association COMPARING ref_cds_view.
LOOP AT rt_association ASSIGNING FIELD-SYMBOL(<ls_assoc>).
CLEAR: <ls_assoc>-name,
<ls_assoc>-raw_name.
ENDLOOP.
ENDIF.
IF lt_entity_range IS NOT INITIAL.
SELECT ddlname,
entityid,
sourcetype,
\_apistate-apistate AS apistate
FROM zsat_i_cdsentity
WHERE entityid IN @lt_entity_range
INTO TABLE @DATA(lt_ddlname_map).
ENDIF.
LOOP AT lt_ddlname_map ASSIGNING FIELD-SYMBOL(<ls_ddl_map>).
LOOP AT rt_association ASSIGNING <ls_assoc> WHERE ref_cds_view = <ls_ddl_map>-entityid.
<ls_assoc>-ddlname = <ls_ddl_map>-ddlname.
<ls_assoc>-source_type = <ls_ddl_map>-sourcetype.
<ls_assoc>-api_state = <ls_ddl_map>-apistate.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD get_api_state.
DATA(lt_api_state_fix_vals) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( VALUE zsat_cds_api_state( ) ) )->get_ddic_fixed_values( ).
DATA(lt_api_states) = io_cds_view->get_api_states( ).
CHECK lt_api_states IS NOT INITIAL.
rv_api_state = VALUE #( lt_api_state_fix_vals[ low = lt_api_states[ 1 ] ]-ddtext OPTIONAL ).
ENDMETHOD.
METHOD fill_association_infos.
LOOP AT it_association ASSIGNING FIELD-SYMBOL(<ls_assoc>).
APPEND INITIAL LINE TO ms_element_info-associations ASSIGNING FIELD-SYMBOL(<ls_assoc_line>).
<ls_assoc_line>-name = <ls_assoc>-name.
<ls_assoc_line>-raw_name = <ls_assoc>-raw_name.
<ls_assoc_line>-object = VALUE #(
name = <ls_assoc>-ref_cds_view
raw_name = <ls_assoc>-ref_cds_view_raw
source_type = <ls_assoc>-source_type
api_state = <ls_assoc>-api_state
object_type = <ls_assoc>-entity_type
description = <ls_assoc>-ddtext
).
DATA(ls_object_ref) = zcl_sat_adt_util=>create_adt_uri(
iv_type = <ls_assoc>-entity_type
iv_name = <ls_assoc>-ref_cds_view
iv_name2 = CONV #( <ls_assoc>-ddlname )
).
<ls_assoc_line>-object-uri = ls_object_ref-uri.
<ls_assoc_line>-object-adt_type = ls_object_ref-type.
ENDLOOP.
ENDMETHOD.
METHOD fill_base_table_infos.
LOOP AT it_base_tables ASSIGNING FIELD-SYMBOL(<ls_base_entity>).
APPEND INITIAL LINE TO ms_element_info-select_from ASSIGNING FIELD-SYMBOL(<ls_select_from>).
<ls_select_from> = VALUE #(
name = <ls_base_entity>-entityname
raw_name = <ls_base_entity>-entityname_raw
object_type = <ls_base_entity>-table_kind
source_type = <ls_base_entity>-source_type
api_state = <ls_base_entity>-api_state
description = <ls_base_entity>-description
).
DATA(ls_object_ref) = zcl_sat_adt_util=>create_adt_uri(
iv_type = <ls_base_entity>-table_kind
iv_name = <ls_base_entity>-entityname
iv_name2 = <ls_base_entity>-secondary_entity_id
).
<ls_select_from>-uri = ls_object_ref-uri.
<ls_select_from>-adt_type = ls_object_ref-type.
ENDLOOP.
ENDMETHOD.
METHOD is_analytics_query.
rv_is_query = 'false'.
CHECK io_cds_view IS BOUND.
IF io_cds_view->is_analytics_query( ).
rv_is_query = 'true'.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
40484,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
5569,
82,
5002,
1321,
329,
257,
327,
5258,
1570,
3556,
79,
29,
198,
31631,
1976,
565,
62,
49720,
62,
324,
83,
62,
66,
9310,
62,
417,
10951,
62,
46862,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
49720,
62,
324,
83,
62,
417,
10951,
62,
46862,
13,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
16447,
5984,
51,
9515,
4941,
329,
3001,
6322,
1398,
3556,
79,
29,
198,
220,
220,
220,
42715,
12,
49273,
50,
2251,
62,
321,
26059,
62,
15252,
62,
5420,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26858,
62,
312,
220,
220,
220,
41876,
1976,
49720,
62,
26858,
62,
312,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
62,
20274,
8,
41876,
6507,
83,
62,
15252,
62,
35790,
13,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
10943,
46126,
1581,
3556,
79,
29,
198,
220,
220,
220,
337,
36252,
50,
23772,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
25927,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
611,
62,
324,
83,
62,
2118,
62,
25927,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
66,
9310,
62,
1177,
62,
3672,
41876,
1976,
49720,
62,
66,
9310,
62,
1177,
62,
3672,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
82,
62,
562,
41003,
13,
198,
220,
220,
220,
220,
220,
220,
220,
3268,
5097,
52,
7206,
41876,
1976,
49720,
62,
66,
9310,
62,
562,
41003,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
288,
25404,
3672,
220,
220,
220,
220,
41876,
288,
25404,
3672,
11,
198,
220,
220,
220,
220,
220,
2723,
62,
4906,
41876,
1149,
16,
11,
198,
220,
220,
220,
220,
220,
40391,
62,
5219,
220,
220,
41876,
4731,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
23578,
3963,
1259,
62,
82,
62,
562,
41003,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
1259,
62,
83,
62,
562,
41003,
41876,
49053,
9795,
43679,
3963,
1259,
62,
82,
62,
562,
41003,
13315,
38144,
9936,
35374,
13,
628,
220,
220,
220,
42865,
6941,
62,
25927,
41876,
4526,
37,
5390,
611,
62,
324,
83,
62,
2118,
62,
25927,
13,
198,
220,
220,
220,
42865,
285,
85,
62,
66,
9310,
62,
1177,
62,
3672,
41876,
1976,
49720,
62,
66,
9310,
62,
1177,
62,
3672,
13,
198,
220,
220,
220,
42865,
13845,
62,
30854,
62,
10951,
41876,
1976,
49720,
62,
324,
83,
62,
66,
9310,
62,
10951,
13,
198,
220,
220,
220,
42865,
285,
69,
62,
12860,
62,
562,
41003,
62,
3672,
41876,
450,
499,
62,
30388,
26173,
8924,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
42865,
285,
85,
62,
1860,
75,
62,
1177,
41876,
1976,
49720,
62,
66,
9310,
62,
1177,
62,
25677,
12,
1860,
75,
3672,
13,
628,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
9781,
30227,
8112,
286,
269,
9310,
1570,
357,
4480,
288,
25404,
14933,
36475,
79,
29,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
66,
9310,
62,
562,
1733,
602,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
66,
9310,
62,
1177,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
49720,
62,
66,
9310,
62,
1177,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
562,
41003,
8,
41876,
1259,
62,
83,
62,
562,
41003,
13,
628,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
9781,
30227,
7824,
1181,
290,
2420,
329,
327,
5258,
1570,
3556,
79,
29,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
15042,
62,
5219,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
66,
9310,
62,
1177,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
49720,
62,
66,
9310,
62,
1177,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
15042,
62,
5219,
8,
41876,
4731,
13,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
37,
2171,
7308,
3084,
5002,
1321,
3556,
79,
29,
198,
220,
220,
220,
337,
36252,
50,
6070,
62,
8692,
62,
11487,
62,
10745,
418,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
8692,
62,
83,
2977,
41876,
1976,
49720,
62,
66,
9310,
62,
1177,
62,
8692,
62,
11487,
62,
83,
764,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
37,
2171,
8112,
5002,
1321,
7359,
79,
29,
198,
220,
220,
220,
337,
36252,
50,
6070,
62,
562,
41003,
62,
10745,
418,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
562,
41003,
41876,
1259,
62,
83,
62,
562,
41003,
13,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
5569,
3224,
2581,
10007,
3556,
79,
29,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
17143,
7307,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
43213,
62,
324,
83,
62,
2118,
13,
198,
220,
220,
220,
366,
0,
1279,
79,
1398
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_mp_web02 DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_http_service_extension .
METHODS constructor.
PROTECTED SECTION.
PRIVATE SECTION.
DATA: html TYPE REF TO lcl_html,
form_data TYPE if_web_http_request=>name_value_pairs,
random TYPE REF TO cl_abap_random_int.
METHODS generate_page_body.
METHODS generate_new_question.
METHODS check_answer.
METHODS show_gif
RETURNING
VALUE(r_result) TYPE abap_bool.
ENDCLASS.
CLASS zcl_mp_web02 IMPLEMENTATION.
METHOD constructor.
random = cl_abap_random_int=>create( min = 0 max = 10 seed = cl_abap_random=>seed( ) ).
ENDMETHOD.
METHOD if_http_service_extension~handle_request.
html = NEW lcl_html( ).
html->initialize( ).
TRY.
form_data = request->get_form_fields( ).
generate_page_body( ).
CATCH cx_web_message_error INTO DATA(error).
html->add( error->get_text( ) ).
ENDTRY.
html->add_closing_tags( ).
response->set_text( html->render( ) ).
ENDMETHOD.
METHOD generate_page_body.
DATA(answer) = VALUE #( form_data[ name = `answer` ]-value OPTIONAL ).
IF answer IS INITIAL.
generate_new_question( ).
ELSE.
check_answer( ).
ENDIF.
ENDMETHOD.
METHOD generate_new_question.
DATA(n1) = random->get_next( ).
DATA(n2) = random->get_next( ).
html->add( `<form method="get">` ).
html->add( `<table><tr>` ).
html->add( |<input type=number name=n1 value={ n1 } hidden=true>| ).
html->add( |<input type=number name=n2 value={ n2 } hidden=true>| ).
html->add( |<td>What is { n1 } * { n2 }?</td>| ).
html->add( |<td><input type=number name=answer></td>| ).
html->add( |<td><input type="submit" value="Submit"></td>| ).
html->add( `</tr></table>` ).
html->add( `</form>` ).
ENDMETHOD.
METHOD check_answer.
DATA(n1) = VALUE i( form_data[ name = `n1` ]-value OPTIONAL ).
DATA(n2) = VALUE i( form_data[ name = `n2` ]-value OPTIONAL ).
html->add( |<table>| ).
IF n1 * n2 = VALUE i( form_data[ name = `answer` ]-value ).
html->add_row( |Yay!! \\(ˆ˚ˆ)/| ).
IF show_gif( ).
html->add_row( |<image src=https://media.giphy.com/media/fsULJFFGv8X3G/giphy.gif>| ).
ENDIF.
ELSE.
IF show_gif( ).
html->add_row( |Close, but not quite close enough, { n1 } * { n2 } is { n1 * n2 }| ).
html->add_row( |<image src=https://media.giphy.com/media/LYd7VuYqXokv20CaEG/giphy.gif>| ).
ELSE.
html->add_row( |Not quite, { n1 } * { n2 } is { n1 * n2 }| ).
ENDIF.
ENDIF.
html->add( '<form method="get">' ).
html->add_row( |<input type="submit" value="Try another">| ).
html->add( `</form>` ).
html->add( |</table>| ).
ENDMETHOD.
METHOD show_gif.
IF random->get_next( ) < 3.
r_result = abap_true.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
3149,
62,
12384,
2999,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
611,
62,
4023,
62,
15271,
62,
2302,
3004,
764,
198,
220,
220,
220,
337,
36252,
50,
23772,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
25,
27711,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
300,
565,
62,
6494,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1296,
62,
7890,
41876,
611,
62,
12384,
62,
4023,
62,
25927,
14804,
3672,
62,
8367,
62,
79,
3468,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4738,
220,
220,
220,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
25120,
62,
600,
13,
198,
220,
220,
220,
337,
36252,
50,
7716,
62,
7700,
62,
2618,
13,
198,
220,
220,
220,
337,
36252,
50,
7716,
62,
3605,
62,
25652,
13,
198,
220,
220,
220,
337,
36252,
50,
2198,
62,
41484,
13,
198,
220,
220,
220,
337,
36252,
50,
905,
62,
27908,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
62,
20274,
8,
41876,
450,
499,
62,
30388,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
3149,
62,
12384,
2999,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
23772,
13,
198,
220,
220,
220,
4738,
796,
537,
62,
397,
499,
62,
25120,
62,
600,
14804,
17953,
7,
949,
796,
657,
3509,
796,
838,
9403,
796,
537,
62,
397,
499,
62,
25120,
14804,
28826,
7,
1267,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
611,
62,
4023,
62,
15271,
62,
2302,
3004,
93,
28144,
62,
25927,
13,
198,
220,
220,
220,
27711,
796,
12682,
300,
565,
62,
6494,
7,
6739,
198,
220,
220,
220,
27711,
3784,
36733,
1096,
7,
6739,
198,
220,
220,
220,
7579,
56,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1296,
62,
7890,
796,
2581,
3784,
1136,
62,
687,
62,
25747,
7,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
7716,
62,
7700,
62,
2618,
7,
6739,
628,
220,
220,
220,
220,
220,
327,
11417,
43213,
62,
12384,
62,
20500,
62,
18224,
39319,
42865,
7,
18224,
737,
198,
220,
220,
220,
220,
220,
220,
220,
27711,
3784,
2860,
7,
4049,
3784,
1136,
62,
5239,
7,
1267,
6739,
198,
220,
220,
220,
23578,
40405,
13,
628,
220,
220,
220,
27711,
3784,
2860,
62,
565,
2752,
62,
31499,
7,
6739,
198,
220,
220,
220,
2882,
3784,
2617,
62,
5239,
7,
220,
27711,
3784,
13287,
7,
1267,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
7716,
62,
7700,
62,
2618,
13,
198,
220,
220,
220,
42865,
7,
41484,
8,
796,
26173,
8924,
1303,
7,
1296,
62,
7890,
58,
1438,
796,
4600,
41484,
63,
2361,
12,
8367,
39852,
2849,
1847,
6739,
628,
220,
220,
220,
16876,
3280,
3180,
3268,
2043,
12576,
13,
198,
220,
220,
220,
220,
220,
7716,
62,
3605,
62,
25652,
7,
6739,
198,
220,
220,
220,
17852,
5188,
13,
198,
220,
220,
220,
220,
220,
2198,
62,
41484,
7,
6739,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
7716,
62,
3605,
62,
25652,
13,
198,
220,
220,
220,
42865,
7,
77,
16,
8,
796,
4738,
3784,
1136,
62,
19545,
7,
6739,
198,
220,
220,
220,
42865,
7,
77,
17,
8,
796,
4738,
3784,
1136,
62,
19545,
7,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
4600,
27,
687,
2446,
2625,
1136,
5320,
63,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
4600,
27,
11487,
6927,
2213,
29,
63,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
930,
27,
15414,
2099,
28,
17618,
1438,
28,
77,
16,
1988,
34758,
299,
16,
1782,
7104,
28,
7942,
29,
91,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
930,
27,
15414,
2099,
28,
17618,
1438,
28,
77,
17,
1988,
34758,
299,
17,
1782,
7104,
28,
7942,
29,
91,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
930,
27,
8671,
29,
2061,
318,
1391,
299,
16,
1782,
1635,
1391,
299,
17,
1782,
30,
3556,
8671,
29,
91,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
930,
27,
8671,
6927,
15414,
2099,
28,
17618,
1438,
28,
41484,
12240,
8671,
29,
91,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
930,
27,
8671,
6927,
15414,
2099,
2625,
46002,
1,
1988,
2625,
45135,
23984,
8671,
29,
91,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
4600,
3556,
2213,
12240,
11487,
29,
63,
6739,
198,
220,
220,
220,
27711,
3784,
2860,
7,
4600,
3556,
687,
29,
63,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
2198,
62,
41484,
13,
198,
220,
220,
220,
42865,
7,
77,
16,
8,
796,
26173,
8924,
1312,
7,
1296,
62,
7890,
58,
1438,
796,
4600,
77,
16,
63,
2361,
12,
8367,
39852,
2849,
1847,
6739,
198,
220,
220,
220,
42865,
7,
77,
17,
8,
796,
26173,
8924,
1312,
7,
1296,
62,
7890,
58,
1438,
796,
4600,
77,
17,
63,
2361,
12,
8367,
39852,
2849,
1847,
6739,
628,
220,
220,
220,
27711,
3784,
2860,
7,
930,
27,
11487,
29,
91,
6739,
628,
220,
220,
220,
16876,
299,
16,
1635,
299,
17,
796,
26173,
8924,
1312,
7,
1296,
62,
7890,
58,
1438,
796,
4600,
41484,
63,
2361,
12,
8367,
6739,
198,
220,
220,
220,
220,
220,
27711,
3784,
2860,
62,
808,
7,
930,
56,
323,
3228,
26867,
7,
135,
228,
135,
248,
135,
228,
20679,
91,
6739,
198,
220,
220,
220,
220,
220,
16876,
905,
62,
27908,
7,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
27711,
3784,
2860,
62,
808,
7,
930,
27,
9060,
12351,
28,
5450,
1378,
11431,
13,
70,
541,
12114,
13,
785,
14,
11431,
14,
9501,
6239,
41,
5777,
38,
85,
23,
55,
18,
38,
14,
70,
541,
12114,
13,
27908,
29,
91,
6739,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
17852,
5188,
13,
198,
220,
220,
220,
220,
220,
16876,
905,
62,
27908,
7,
6739,
198,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_objects_files DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
!is_item TYPE zif_abapgit_definitions=>ty_item
!iv_path TYPE string OPTIONAL .
METHODS add_string
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
!iv_string TYPE string
RAISING
zcx_abapgit_exception .
METHODS read_string
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
RETURNING
VALUE(rv_string) TYPE string
RAISING
zcx_abapgit_exception .
METHODS add_xml
IMPORTING
!iv_extra TYPE clike OPTIONAL
!io_xml TYPE REF TO zcl_abapgit_xml_output
!iv_normalize TYPE abap_bool DEFAULT abap_true
!is_metadata TYPE zif_abapgit_definitions=>ty_metadata OPTIONAL
RAISING
zcx_abapgit_exception .
METHODS read_xml
IMPORTING
!iv_extra TYPE clike OPTIONAL
RETURNING
VALUE(ro_xml) TYPE REF TO zcl_abapgit_xml_input
RAISING
zcx_abapgit_exception .
METHODS read_abap
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_error TYPE abap_bool DEFAULT abap_true
RETURNING
VALUE(rt_abap) TYPE abaptxt255_tab
RAISING
zcx_abapgit_exception .
METHODS add_abap
IMPORTING
!iv_extra TYPE clike OPTIONAL
!it_abap TYPE STANDARD TABLE
RAISING
zcx_abapgit_exception .
METHODS add
IMPORTING
!is_file TYPE zif_abapgit_definitions=>ty_file .
METHODS add_raw
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
!iv_data TYPE xstring
RAISING
zcx_abapgit_exception .
METHODS read_raw
IMPORTING
!iv_extra TYPE clike OPTIONAL
!iv_ext TYPE string
RETURNING
VALUE(rv_data) TYPE xstring
RAISING
zcx_abapgit_exception .
METHODS get_files
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt .
METHODS set_files
IMPORTING
!it_files TYPE zif_abapgit_definitions=>ty_files_tt .
METHODS get_accessed_files
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_file_signatures_tt .
PROTECTED SECTION.
PRIVATE SECTION.
DATA: ms_item TYPE zif_abapgit_definitions=>ty_item,
mt_accessed_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
mt_files TYPE zif_abapgit_definitions=>ty_files_tt,
mv_path TYPE string.
METHODS:
read_file
IMPORTING iv_filename TYPE string
iv_error TYPE abap_bool DEFAULT abap_true
EXPORTING ev_data TYPE xstring
RAISING zcx_abapgit_exception,
filename
IMPORTING iv_extra TYPE clike OPTIONAL
iv_ext TYPE string
RETURNING VALUE(rv_filename) TYPE string.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECTS_FILES IMPLEMENTATION.
METHOD add.
APPEND is_file TO mt_files.
ENDMETHOD.
METHOD add_abap.
DATA: lv_source TYPE string,
ls_file TYPE zif_abapgit_definitions=>ty_file.
CONCATENATE LINES OF it_abap INTO lv_source SEPARATED BY zif_abapgit_definitions=>c_newline.
* when editing files via eg. GitHub web interface it adds a newline at end of file
lv_source = lv_source && zif_abapgit_definitions=>c_newline.
ls_file-path = '/'.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = 'abap' ). "#EC NOTEXT
ls_file-data = zcl_abapgit_convert=>string_to_xstring_utf8( lv_source ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD add_raw.
DATA: ls_file TYPE zif_abapgit_definitions=>ty_file.
ls_file-path = '/'.
ls_file-data = iv_data.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD add_string.
DATA: ls_file TYPE zif_abapgit_definitions=>ty_file.
ls_file-path = '/'.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ). "#EC NOTEXT
ls_file-data = zcl_abapgit_convert=>string_to_xstring_utf8( iv_string ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD add_xml.
DATA: lv_xml TYPE string,
ls_file TYPE zif_abapgit_definitions=>ty_file.
lv_xml = io_xml->render( iv_normalize = iv_normalize
is_metadata = is_metadata ).
ls_file-path = '/'.
ls_file-filename = filename( iv_extra = iv_extra
iv_ext = 'xml' ). "#EC NOTEXT
REPLACE FIRST OCCURRENCE
OF REGEX '<\?xml version="1\.0" encoding="[\w-]+"\?>'
IN lv_xml
WITH '<?xml version="1.0" encoding="utf-8"?>'.
ASSERT sy-subrc = 0.
ls_file-data = zcl_abapgit_convert=>string_to_xstring_utf8( lv_xml ).
APPEND ls_file TO mt_files.
ENDMETHOD.
METHOD constructor.
ms_item = is_item.
mv_path = iv_path.
ENDMETHOD.
METHOD filename.
DATA: lv_obj_name TYPE string.
lv_obj_name = ms_item-obj_name.
IF ms_item-obj_type = 'DEVC'.
" Packages have a fixed filename so that the repository can be installed to a different
" package(-hierarchy) on the client and not show up as a different package in the repo.
lv_obj_name = 'package'.
ENDIF.
IF iv_extra IS INITIAL.
CONCATENATE lv_obj_name '.' ms_item-obj_type
INTO rv_filename. "#EC NOTEXT
ELSE.
CONCATENATE lv_obj_name '.' ms_item-obj_type '.' iv_extra
INTO rv_filename. "#EC NOTEXT
ENDIF.
IF iv_ext IS NOT INITIAL.
CONCATENATE rv_filename '.' iv_ext
INTO rv_filename.
ENDIF.
* handle namespaces
REPLACE ALL OCCURRENCES OF '/' IN rv_filename WITH '#'.
TRANSLATE rv_filename TO LOWER CASE.
ENDMETHOD.
METHOD get_accessed_files.
rt_files = mt_accessed_files.
ENDMETHOD.
METHOD get_files.
rt_files = mt_files.
ENDMETHOD.
METHOD read_abap.
DATA: lv_filename TYPE string,
lv_data TYPE xstring,
lv_abap TYPE string.
lv_filename = filename( iv_extra = iv_extra
iv_ext = 'abap' ). "#EC NOTEXT
read_file( EXPORTING iv_filename = lv_filename
iv_error = iv_error
IMPORTING ev_data = lv_data ).
IF lv_data IS INITIAL. " Post-handling of iv_error = false
RETURN.
ENDIF.
lv_abap = zcl_abapgit_convert=>xstring_to_string_utf8( lv_data ).
SPLIT lv_abap AT zif_abapgit_definitions=>c_newline INTO TABLE rt_abap.
ENDMETHOD.
METHOD read_file.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF mt_files,
<ls_accessed> LIKE LINE OF mt_accessed_files.
CLEAR ev_data.
IF mv_path IS NOT INITIAL.
READ TABLE mt_files ASSIGNING <ls_file> WITH KEY path = mv_path
filename = iv_filename.
ELSE.
READ TABLE mt_files ASSIGNING <ls_file> WITH KEY filename = iv_filename.
ENDIF.
IF sy-subrc <> 0.
IF iv_error = abap_true.
zcx_abapgit_exception=>raise( |File not found: { iv_filename }| ).
ELSE.
RETURN.
ENDIF.
ENDIF.
" Update access table
READ TABLE mt_accessed_files TRANSPORTING NO FIELDS
WITH KEY path = <ls_file>-path filename = <ls_file>-filename.
IF sy-subrc > 0. " Not found ? -> Add
APPEND INITIAL LINE TO mt_accessed_files ASSIGNING <ls_accessed>.
MOVE-CORRESPONDING <ls_file> TO <ls_accessed>.
ENDIF.
ev_data = <ls_file>-data.
ENDMETHOD.
METHOD read_raw.
DATA: lv_filename TYPE string.
lv_filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ).
read_file( EXPORTING iv_filename = lv_filename
IMPORTING ev_data = rv_data ).
ENDMETHOD.
METHOD read_string.
DATA: lv_filename TYPE string,
lv_data TYPE xstring.
lv_filename = filename( iv_extra = iv_extra
iv_ext = iv_ext ). "#EC NOTEXT
read_file( EXPORTING iv_filename = lv_filename
IMPORTING ev_data = lv_data ).
rv_string = zcl_abapgit_convert=>xstring_to_string_utf8( lv_data ).
ENDMETHOD.
METHOD read_xml.
DATA: lv_filename TYPE string,
lv_data TYPE xstring,
lv_xml TYPE string.
lv_filename = filename( iv_extra = iv_extra
iv_ext = 'xml' ). "#EC NOTEXT
read_file( EXPORTING iv_filename = lv_filename
IMPORTING ev_data = lv_data ).
lv_xml = zcl_abapgit_convert=>xstring_to_string_utf8( lv_data ).
CREATE OBJECT ro_xml
EXPORTING
iv_xml = lv_xml.
ENDMETHOD.
METHOD set_files.
mt_files = it_files.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
16624,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
9186,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
6978,
41876,
4731,
39852,
2849,
1847,
764,
198,
220,
220,
220,
337,
36252,
50,
751,
62,
8841,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
220,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2302,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
8841,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1100,
62,
8841,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
220,
220,
220,
220,
220,
220,
220,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2302,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
8841,
8,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
751,
62,
19875,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
220,
220,
220,
220,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
19875,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
19875,
62,
22915,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
11265,
1096,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
38993,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
38993,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1100,
62,
19875,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
220,
220,
220,
220,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
19875,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
19875,
62,
15414,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1100,
62,
397,
499,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
220,
220,
220,
220,
220,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
18224,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
397,
499,
8,
41876,
450,
2373,
742,
13381,
62,
8658,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
751,
62,
397,
499,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
397,
499,
220,
41876,
49053,
9795,
43679,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
751,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
7753,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
7753,
764,
198,
220,
220,
220,
337,
36252,
50,
751,
62,
1831,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2302,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
7890,
220,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1100,
62,
1831,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26086,
220,
220,
220,
220,
220,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2302,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
7890,
8,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
17926
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS ycl_abapgit_zlib DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
TYPES:
BEGIN OF ty_decompress,
raw TYPE xstring,
compressed_len TYPE i,
END OF ty_decompress .
CLASS-METHODS decompress
IMPORTING
!iv_compressed TYPE xsequence
RETURNING
VALUE(rs_data) TYPE ty_decompress .
PRIVATE SECTION.
CONSTANTS: c_maxdcodes TYPE i VALUE 30.
CLASS-DATA: gv_out TYPE xstring,
go_lencode TYPE REF TO ycl_abapgit_zlib_huffman,
go_distcode TYPE REF TO ycl_abapgit_zlib_huffman,
go_stream TYPE REF TO ycl_abapgit_zlib_stream.
TYPES: BEGIN OF ty_pair,
length TYPE i,
distance TYPE i,
END OF ty_pair.
CLASS-METHODS:
decode
IMPORTING io_huffman TYPE REF TO ycl_abapgit_zlib_huffman
RETURNING VALUE(rv_symbol) TYPE i,
map_length
IMPORTING iv_code TYPE i
RETURNING VALUE(rv_length) TYPE i,
map_distance
IMPORTING iv_code TYPE i
RETURNING VALUE(rv_distance) TYPE i,
dynamic,
fixed,
read_pair
IMPORTING iv_length TYPE i
RETURNING VALUE(rs_pair) TYPE ty_pair,
copy_out
IMPORTING is_pair TYPE ty_pair.
ENDCLASS.
CLASS YCL_ABAPGIT_ZLIB IMPLEMENTATION.
METHOD copy_out.
* copy one byte at a time, it is not possible to copy using
* string offsets, as it might copy data that does not exist
* in mv_out yet
DATA: lv_distance TYPE i,
lv_index TYPE i,
lv_x TYPE x LENGTH 1.
lv_distance = xstrlen( gv_out ) - is_pair-distance.
DO is_pair-length TIMES.
lv_index = sy-index - 1 + lv_distance.
lv_x = gv_out+lv_index(1).
CONCATENATE gv_out lv_x INTO gv_out IN BYTE MODE.
ENDDO.
ENDMETHOD.
METHOD decode.
DATA: lv_bit TYPE c LENGTH 1,
lv_len TYPE i,
lv_count TYPE i,
lv_code TYPE i,
lv_index TYPE i,
lv_first TYPE i,
lv_bits TYPE string.
DO ycl_abapgit_zlib_huffman=>c_maxbits TIMES.
lv_len = sy-index.
lv_bit = go_stream->take_bits( 1 ).
CONCATENATE lv_bits lv_bit INTO lv_bits.
lv_code = ycl_abapgit_zlib_convert=>bits_to_int( lv_bits ).
lv_count = io_huffman->get_count( lv_len ).
IF lv_code - lv_count < lv_first.
rv_symbol = io_huffman->get_symbol( lv_index + lv_code - lv_first + 1 ).
RETURN.
ENDIF.
lv_index = lv_index + lv_count.
lv_first = lv_first + lv_count.
lv_first = lv_first * 2.
ENDDO.
ENDMETHOD.
METHOD decompress.
DATA: lv_x TYPE x LENGTH 1,
lv_symbol TYPE i,
lv_bfinal TYPE c LENGTH 1,
lv_btype TYPE c LENGTH 2.
IF iv_compressed IS INITIAL.
RETURN.
ENDIF.
CLEAR gv_out.
CREATE OBJECT go_stream
EXPORTING
iv_data = iv_compressed.
DO.
lv_bfinal = go_stream->take_bits( 1 ).
lv_btype = go_stream->take_bits( 2 ).
CASE lv_btype.
WHEN '01'.
fixed( ).
WHEN '10'.
dynamic( ).
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
DO.
lv_symbol = decode( go_lencode ).
IF lv_symbol < 256.
lv_x = ycl_abapgit_zlib_convert=>int_to_hex( lv_symbol ).
CONCATENATE gv_out lv_x INTO gv_out IN BYTE MODE.
ELSEIF lv_symbol = 256.
EXIT.
ELSE.
copy_out( read_pair( lv_symbol ) ).
ENDIF.
ENDDO.
IF lv_bfinal = '1'.
EXIT.
ENDIF.
ENDDO.
rs_data-raw = gv_out.
rs_data-compressed_len = xstrlen( iv_compressed ) - go_stream->remaining( ).
ENDMETHOD.
METHOD dynamic.
DATA: lv_nlen TYPE i,
lv_ndist TYPE i,
lv_ncode TYPE i,
lv_index TYPE i,
lv_length TYPE i,
lv_symbol TYPE i,
lt_order TYPE TABLE OF i,
lt_lengths TYPE ycl_abapgit_zlib_huffman=>ty_lengths,
lt_dists TYPE ycl_abapgit_zlib_huffman=>ty_lengths.
FIELD-SYMBOLS: <lv_length> LIKE LINE OF lt_lengths.
APPEND 16 TO lt_order.
APPEND 17 TO lt_order.
APPEND 18 TO lt_order.
APPEND 0 TO lt_order.
APPEND 8 TO lt_order.
APPEND 7 TO lt_order.
APPEND 9 TO lt_order.
APPEND 6 TO lt_order.
APPEND 10 TO lt_order.
APPEND 5 TO lt_order.
APPEND 11 TO lt_order.
APPEND 4 TO lt_order.
APPEND 12 TO lt_order.
APPEND 3 TO lt_order.
APPEND 13 TO lt_order.
APPEND 2 TO lt_order.
APPEND 14 TO lt_order.
APPEND 1 TO lt_order.
APPEND 15 TO lt_order.
lv_nlen = go_stream->take_int( 5 ) + 257.
lv_ndist = go_stream->take_int( 5 ) + 1.
lv_ncode = go_stream->take_int( 4 ) + 4.
DO 19 TIMES.
APPEND 0 TO lt_lengths.
ENDDO.
DO lv_ncode TIMES.
READ TABLE lt_order INDEX sy-index INTO lv_index.
ASSERT sy-subrc = 0.
lv_index = lv_index + 1.
READ TABLE lt_lengths INDEX lv_index ASSIGNING <lv_length>.
ASSERT sy-subrc = 0.
<lv_length> = go_stream->take_int( 3 ).
ENDDO.
CREATE OBJECT go_lencode
EXPORTING
it_lengths = lt_lengths.
CLEAR lt_lengths.
WHILE lines( lt_lengths ) < lv_nlen + lv_ndist.
lv_symbol = decode( go_lencode ).
IF lv_symbol < 16.
APPEND lv_symbol TO lt_lengths.
ELSE.
lv_length = 0.
IF lv_symbol = 16.
READ TABLE lt_lengths INDEX lines( lt_lengths ) INTO lv_length.
ASSERT sy-subrc = 0.
lv_symbol = go_stream->take_int( 2 ) + 3.
ELSEIF lv_symbol = 17.
lv_symbol = go_stream->take_int( 3 ) + 3.
ELSE.
lv_symbol = go_stream->take_int( 7 ) + 11.
ENDIF.
DO lv_symbol TIMES.
APPEND lv_length TO lt_lengths.
ENDDO.
ENDIF.
ENDWHILE.
lt_dists = lt_lengths.
DELETE lt_lengths FROM lv_nlen + 1.
DELETE lt_dists TO lv_nlen.
CREATE OBJECT go_lencode
EXPORTING
it_lengths = lt_lengths.
CREATE OBJECT go_distcode
EXPORTING
it_lengths = lt_dists.
ENDMETHOD.
METHOD fixed.
DATA: lt_lengths TYPE ycl_abapgit_zlib_huffman=>ty_lengths.
DO 144 TIMES.
APPEND 8 TO lt_lengths.
ENDDO.
DO 112 TIMES.
APPEND 9 TO lt_lengths.
ENDDO.
DO 24 TIMES.
APPEND 7 TO lt_lengths.
ENDDO.
DO 8 TIMES.
APPEND 8 TO lt_lengths.
ENDDO.
CREATE OBJECT go_lencode
EXPORTING
it_lengths = lt_lengths.
CLEAR lt_lengths.
DO c_maxdcodes TIMES.
APPEND 5 TO lt_lengths.
ENDDO.
CREATE OBJECT go_distcode
EXPORTING
it_lengths = lt_lengths.
ENDMETHOD.
METHOD map_distance.
DEFINE _distance.
rv_distance = go_stream->take_int( &1 ).
rv_distance = rv_distance + &2.
END-OF-DEFINITION.
CASE iv_code.
WHEN 0.
_distance 0 1.
WHEN 1.
_distance 0 2.
WHEN 2.
_distance 0 3.
WHEN 3.
_distance 0 4.
WHEN 4.
_distance 1 5.
WHEN 5.
_distance 1 7.
WHEN 6.
_distance 2 9.
WHEN 7.
_distance 2 13.
WHEN 8.
_distance 3 17.
WHEN 9.
_distance 3 25.
WHEN 10.
_distance 4 33.
WHEN 11.
_distance 4 49.
WHEN 12.
_distance 5 65.
WHEN 13.
_distance 5 97.
WHEN 14.
_distance 6 129.
WHEN 15.
_distance 6 193.
WHEN 16.
_distance 7 257.
WHEN 17.
_distance 7 385.
WHEN 18.
_distance 8 513.
WHEN 19.
_distance 8 769.
WHEN 20.
_distance 9 1025.
WHEN 21.
_distance 9 1537.
WHEN 22.
_distance 10 2049.
WHEN 23.
_distance 10 3073.
WHEN 24.
_distance 11 4097.
WHEN 25.
_distance 11 6145.
WHEN 26.
_distance 12 8193.
WHEN 27.
_distance 12 12289.
WHEN 28.
_distance 13 16385.
WHEN 29.
_distance 13 24577.
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
ENDMETHOD.
METHOD map_length.
DEFINE _length.
rv_length = go_stream->take_int( &1 ).
rv_length = rv_length + &2.
END-OF-DEFINITION.
CASE iv_code.
WHEN 257.
_length 0 3.
WHEN 258.
_length 0 4.
WHEN 259.
_length 0 5.
WHEN 260.
_length 0 6.
WHEN 261.
_length 0 7.
WHEN 262.
_length 0 8.
WHEN 263.
_length 0 9.
WHEN 264.
_length 0 10.
WHEN 265.
_length 1 11.
WHEN 266.
_length 1 13.
WHEN 267.
_length 1 15.
WHEN 268.
_length 1 17.
WHEN 269.
_length 2 19.
WHEN 270.
_length 2 23.
WHEN 271.
_length 2 27.
WHEN 272.
_length 2 31.
WHEN 273.
_length 3 35.
WHEN 274.
_length 3 43.
WHEN 275.
_length 3 51.
WHEN 276.
_length 3 59.
WHEN 277.
_length 4 67.
WHEN 278.
_length 4 83.
WHEN 279.
_length 4 99.
WHEN 280.
_length 4 115.
WHEN 281.
_length 5 131.
WHEN 282.
_length 5 163.
WHEN 283.
_length 5 195.
WHEN 284.
_length 5 227.
WHEN 285.
_length 0 258.
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
ENDMETHOD.
METHOD read_pair.
DATA: lv_symbol TYPE i.
rs_pair-length = map_length( iv_length ).
lv_symbol = decode( go_distcode ).
rs_pair-distance = map_distance( lv_symbol ).
ENDMETHOD.
ENDCLASS.
| [
31631,
331,
565,
62,
397,
499,
18300,
62,
89,
8019,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
12501,
3361,
601,
11,
198,
220,
220,
220,
220,
220,
220,
220,
8246,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
8841,
11,
198,
220,
220,
220,
220,
220,
220,
220,
25388,
62,
11925,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
12501,
3361,
601,
764,
628,
220,
220,
220,
42715,
12,
49273,
50,
38237,
601,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
5589,
2790,
41876,
2124,
43167,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
3808,
62,
7890,
8,
41876,
1259,
62,
12501,
3361,
601,
764,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
269,
62,
9806,
17896,
4147,
41876,
1312,
26173,
8924,
1542,
13,
628,
220,
220,
220,
42715,
12,
26947,
25,
308,
85,
62,
448,
220,
220,
220,
220,
220,
41876,
2124,
8841,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
467,
62,
11925,
8189,
220,
41876,
4526,
37,
5390,
331,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
71,
1648,
805,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
467,
62,
17080,
8189,
41876,
4526,
37,
5390,
331,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
71,
1648,
805,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
467,
62,
5532,
220,
220,
41876,
4526,
37,
5390,
331,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
5532,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
24874,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5253,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
24874,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
25,
198,
220,
220,
220,
220,
220,
36899,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
33245,
62,
71,
1648,
805,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
331,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
71,
1648,
805,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
1837,
23650,
8,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
3975,
62,
13664,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
8189,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
13664,
8,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
3975,
62,
30246,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
8189,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
30246,
8,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
8925,
11,
198,
220,
220,
220,
220,
220,
5969,
11,
198,
220,
220,
220,
220,
220,
1100,
62,
24874,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
13664,
220,
220,
220,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
3808,
62,
24874,
8,
41876,
1259,
62,
24874,
11,
198,
220,
220,
220,
220,
220,
4866,
62,
448,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
318,
62,
24874,
41876,
1259,
62,
24874,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
575,
5097,
62,
6242,
2969,
38,
2043,
62,
57,
40347,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
4866,
62,
448,
13,
198,
198,
9,
4866,
530,
18022,
379,
257,
640,
11,
340,
318,
407,
1744,
284,
4866,
1262,
198,
9,
4731,
49005,
11,
355,
340,
1244,
4866,
1366,
326,
857,
407,
2152,
198,
9,
287,
285,
85,
62,
448,
1865,
628,
220,
220,
220,
42865,
25,
300,
85,
62,
30246,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
9630,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
87,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
406,
49494,
352,
13,
628,
198,
220,
220,
220,
300,
85,
62,
30246,
796,
2124,
2536,
11925,
7,
308,
85,
62,
448,
1267,
532,
318,
62,
24874,
12,
30246,
13,
198,
220,
220,
220,
8410,
318,
62,
24874,
12,
13664,
31742,
1546,
13,
198,
220,
220,
220,
220,
220,
300,
85,
62,
9630,
796,
827,
12,
9630,
532,
352,
1343,
300,
85,
62,
30246,
13,
198,
220,
220,
220,
220,
220,
300,
85,
62,
87,
796,
308,
85,
62,
448,
10,
6780,
62,
9630,
7,
16,
737,
198,
220,
220,
220,
220,
220,
39962,
1404,
1677,
6158,
308,
85,
62,
448,
300,
85,
62,
87,
39319,
308,
85,
62,
448,
3268,
11050,
9328,
337,
16820,
13,
198,
220,
220,
220,
23578,
18227,
13,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
36899,
13,
628,
220,
220,
220,
42865,
25,
300,
85,
62,
2545,
220,
220,
41876,
269,
406,
49494,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
11925,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
9127,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
8189,
220,
41876,
1312,
11,
198,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_objects_program DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super.
PUBLIC SECTION.
TYPES: BEGIN OF ty_progdir,
name TYPE progdir-name,
state TYPE progdir-state,
sqlx TYPE progdir-sqlx,
edtx TYPE progdir-edtx,
varcl TYPE progdir-varcl,
dbapl TYPE progdir-dbapl,
dbna TYPE progdir-dbna,
clas TYPE progdir-clas,
type TYPE progdir-type,
occurs TYPE progdir-occurs,
subc TYPE progdir-subc,
appl TYPE progdir-appl,
secu TYPE progdir-secu,
cnam TYPE progdir-cnam,
cdat TYPE progdir-cdat,
unam TYPE progdir-unam,
udat TYPE progdir-udat,
vern TYPE progdir-vern,
levl TYPE progdir-levl,
rstat TYPE progdir-rstat,
rmand TYPE progdir-rmand,
rload TYPE progdir-rload,
fixpt TYPE progdir-fixpt,
sset TYPE progdir-sset,
sdate TYPE progdir-sdate,
stime TYPE progdir-stime,
idate TYPE progdir-idate,
itime TYPE progdir-itime,
ldbname TYPE progdir-ldbname,
uccheck TYPE progdir-uccheck,
END OF ty_progdir.
METHODS serialize_program
IMPORTING io_xml TYPE REF TO zif_abapgit_xml_output OPTIONAL
is_item TYPE zif_abapgit_definitions=>ty_item
io_files TYPE REF TO zcl_abapgit_objects_files
iv_program TYPE programm OPTIONAL
iv_extra TYPE clike OPTIONAL
RAISING zcx_abapgit_exception.
METHODS read_progdir
IMPORTING iv_program TYPE programm
RETURNING VALUE(rs_progdir) TYPE ty_progdir.
METHODS deserialize_program
IMPORTING is_progdir TYPE ty_progdir
it_source TYPE abaptxt255_tab
it_tpool TYPE textpool_table
iv_package TYPE devclass
RAISING zcx_abapgit_exception.
PROTECTED SECTION.
TYPES:
ty_spaces_tt TYPE STANDARD TABLE OF i WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_dynpro,
header TYPE rpy_dyhead,
containers TYPE dycatt_tab,
fields TYPE dyfatc_tab,
flow_logic TYPE swydyflow,
spaces TYPE ty_spaces_tt,
END OF ty_dynpro .
TYPES:
ty_dynpro_tt TYPE STANDARD TABLE OF ty_dynpro WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_cua,
adm TYPE rsmpe_adm,
sta TYPE STANDARD TABLE OF rsmpe_stat WITH DEFAULT KEY,
fun TYPE STANDARD TABLE OF rsmpe_funt WITH DEFAULT KEY,
men TYPE STANDARD TABLE OF rsmpe_men WITH DEFAULT KEY,
mtx TYPE STANDARD TABLE OF rsmpe_mnlt WITH DEFAULT KEY,
act TYPE STANDARD TABLE OF rsmpe_act WITH DEFAULT KEY,
but TYPE STANDARD TABLE OF rsmpe_but WITH DEFAULT KEY,
pfk TYPE STANDARD TABLE OF rsmpe_pfk WITH DEFAULT KEY,
set TYPE STANDARD TABLE OF rsmpe_staf WITH DEFAULT KEY,
doc TYPE STANDARD TABLE OF rsmpe_atrt WITH DEFAULT KEY,
tit TYPE STANDARD TABLE OF rsmpe_titt WITH DEFAULT KEY,
biv TYPE STANDARD TABLE OF rsmpe_buts WITH DEFAULT KEY,
END OF ty_cua .
METHODS serialize_dynpros
IMPORTING
!iv_program_name TYPE programm
RETURNING
VALUE(rt_dynpro) TYPE ty_dynpro_tt
RAISING
zcx_abapgit_exception .
METHODS serialize_cua
IMPORTING
!iv_program_name TYPE programm
RETURNING
VALUE(rs_cua) TYPE ty_cua
RAISING
zcx_abapgit_exception .
METHODS deserialize_dynpros
IMPORTING
!it_dynpros TYPE ty_dynpro_tt
RAISING
zcx_abapgit_exception .
METHODS deserialize_textpool
IMPORTING
!iv_program TYPE programm
!it_tpool TYPE textpool_table
!iv_language TYPE sy-langu OPTIONAL
!iv_is_include TYPE abap_bool DEFAULT abap_false
RAISING
zcx_abapgit_exception .
METHODS deserialize_cua
IMPORTING
!iv_program_name TYPE programm
!is_cua TYPE ty_cua
RAISING
zcx_abapgit_exception .
METHODS is_any_dynpro_locked
IMPORTING
!iv_program TYPE programm
RETURNING
VALUE(rv_is_any_dynpro_locked) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS is_cua_locked
IMPORTING
!iv_program TYPE programm
RETURNING
VALUE(rv_is_cua_locked) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS is_text_locked
IMPORTING
!iv_program TYPE programm
RETURNING
VALUE(rv_is_text_locked) TYPE abap_bool
RAISING
zcx_abapgit_exception .
CLASS-METHODS add_tpool
IMPORTING
!it_tpool TYPE textpool_table
RETURNING
VALUE(rt_tpool) TYPE zif_abapgit_definitions=>ty_tpool_tt .
CLASS-METHODS read_tpool
IMPORTING
!it_tpool TYPE zif_abapgit_definitions=>ty_tpool_tt
RETURNING
VALUE(rt_tpool) TYPE zif_abapgit_definitions=>ty_tpool_tt .
PRIVATE SECTION.
METHODS:
uncondense_flow
IMPORTING it_flow TYPE swydyflow
it_spaces TYPE ty_spaces_tt
RETURNING VALUE(rt_flow) TYPE swydyflow.
CLASS-METHODS auto_correct_cua_adm
IMPORTING
is_cua TYPE ty_cua
CHANGING
cs_adm TYPE rsmpe_adm.
METHODS get_program_title
IMPORTING
!it_tpool TYPE textpool_table
RETURNING
VALUE(rv_title) TYPE repti .
METHODS insert_program
IMPORTING
!is_progdir TYPE ty_progdir
!it_source TYPE abaptxt255_tab
!iv_title TYPE repti
!iv_package TYPE devclass
RAISING
zcx_abapgit_exception .
METHODS update_program
IMPORTING
!is_progdir TYPE ty_progdir
!it_source TYPE abaptxt255_tab
!iv_title TYPE repti
RAISING
zcx_abapgit_exception .
METHODS update_progdir
IMPORTING
!is_progdir TYPE ty_progdir
RAISING
zcx_abapgit_exception .
METHODS insert_tpool
IMPORTING
!is_progdir TYPE ty_progdir
!it_tpool TYPE textpool_table
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_objects_program IMPLEMENTATION.
METHOD add_tpool.
FIELD-SYMBOLS: <ls_tpool_in> LIKE LINE OF it_tpool,
<ls_tpool_out> LIKE LINE OF rt_tpool.
LOOP AT it_tpool ASSIGNING <ls_tpool_in>.
APPEND INITIAL LINE TO rt_tpool ASSIGNING <ls_tpool_out>.
MOVE-CORRESPONDING <ls_tpool_in> TO <ls_tpool_out>.
IF <ls_tpool_out>-id = 'S'.
<ls_tpool_out>-split = <ls_tpool_out>-entry.
<ls_tpool_out>-entry = <ls_tpool_out>-entry+8.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD auto_correct_cua_adm.
" issue #1807 automatic correction of CUA interfaces saved incorrectly in the past (ADM was not saved in the XML)
CONSTANTS:
lc_num_n_space TYPE string VALUE ' 0123456789',
lc_num_only TYPE string VALUE '0123456789'.
FIELD-SYMBOLS:
<ls_pfk> TYPE rsmpe_pfk,
<ls_act> TYPE rsmpe_act,
<ls_men> TYPE rsmpe_men.
IF cs_adm IS NOT INITIAL
AND cs_adm-actcode CO lc_num_n_space
AND cs_adm-mencode CO lc_num_n_space
AND cs_adm-pfkcode CO lc_num_n_space. "Check performed in form check_adm of include LSMPIF03
RETURN.
ENDIF.
LOOP AT is_cua-act ASSIGNING <ls_act>.
IF <ls_act>-code+6(14) IS INITIAL AND <ls_act>-code(6) CO lc_num_only.
cs_adm-actcode = <ls_act>-code.
ENDIF.
ENDLOOP.
LOOP AT is_cua-men ASSIGNING <ls_men>.
IF <ls_men>-code+6(14) IS INITIAL AND <ls_men>-code(6) CO lc_num_only.
cs_adm-mencode = <ls_men>-code.
ENDIF.
ENDLOOP.
LOOP AT is_cua-pfk ASSIGNING <ls_pfk>.
IF <ls_pfk>-code+6(14) IS INITIAL AND <ls_pfk>-code(6) CO lc_num_only.
cs_adm-pfkcode = <ls_pfk>-code.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD deserialize_cua.
DATA: ls_tr_key TYPE trkey,
ls_adm TYPE rsmpe_adm.
IF lines( is_cua-sta ) = 0
AND lines( is_cua-fun ) = 0
AND lines( is_cua-men ) = 0
AND lines( is_cua-mtx ) = 0
AND lines( is_cua-act ) = 0
AND lines( is_cua-but ) = 0
AND lines( is_cua-pfk ) = 0
AND lines( is_cua-set ) = 0
AND lines( is_cua-doc ) = 0
AND lines( is_cua-tit ) = 0
AND lines( is_cua-biv ) = 0.
RETURN.
ENDIF.
SELECT SINGLE devclass INTO ls_tr_key-devclass
FROM tadir
WHERE pgmid = 'R3TR'
AND object = ms_item-obj_type
AND obj_name = ms_item-obj_name. "#EC CI_GENBUFF
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'not found in tadir' ).
ENDIF.
ls_tr_key-obj_type = ms_item-obj_type.
ls_tr_key-obj_name = ms_item-obj_name.
ls_tr_key-sub_type = 'CUAD'.
ls_tr_key-sub_name = iv_program_name.
ls_adm = is_cua-adm.
auto_correct_cua_adm( EXPORTING is_cua = is_cua CHANGING cs_adm = ls_adm ).
sy-tcode = 'SE41' ##write_ok. " evil hack, workaround to handle fixes in note 2159455
CALL FUNCTION 'RS_CUA_INTERNAL_WRITE'
EXPORTING
program = iv_program_name
language = mv_language
tr_key = ls_tr_key
adm = ls_adm
state = 'I'
TABLES
sta = is_cua-sta
fun = is_cua-fun
men = is_cua-men
mtx = is_cua-mtx
act = is_cua-act
but = is_cua-but
pfk = is_cua-pfk
set = is_cua-set
doc = is_cua-doc
tit = is_cua-tit
biv = is_cua-biv
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* if moving code from SAPlink, see https://github.com/abapGit/abapGit/issues/562
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
zcl_abapgit_objects_activation=>add(
iv_type = 'CUAD'
iv_name = iv_program_name ).
ENDMETHOD.
METHOD deserialize_dynpros.
CONSTANTS lc_rpyty_force_off TYPE c LENGTH 1 VALUE '/'.
DATA: lv_name TYPE dwinactiv-obj_name,
ls_dynpro LIKE LINE OF it_dynpros.
FIELD-SYMBOLS: <ls_field> TYPE rpy_dyfatc.
* ls_dynpro is changed by the function module, a field-symbol will cause
* the program to dump since it_dynpros cannot be changed
LOOP AT it_dynpros INTO ls_dynpro.
" todo: kept for compatibility, remove after grace period #3680
ls_dynpro-flow_logic = uncondense_flow(
it_flow = ls_dynpro-flow_logic
it_spaces = ls_dynpro-spaces ).
LOOP AT ls_dynpro-fields ASSIGNING <ls_field>.
* if the DDIC element has a PARAMETER_ID and the flag "from_dict" is active
* the import will enable the SET-/GET_PARAM flag. In this case: "force off"
IF <ls_field>-param_id IS NOT INITIAL
AND <ls_field>-from_dict = abap_true.
IF <ls_field>-set_param IS INITIAL.
<ls_field>-set_param = lc_rpyty_force_off.
ENDIF.
IF <ls_field>-get_param IS INITIAL.
<ls_field>-get_param = lc_rpyty_force_off.
ENDIF.
ENDIF.
* If the previous conditions are met the value 'F' will be taken over
* during de-serialization potentially overlapping other fields in the screen,
* we set the tag to the correct value 'X'
IF <ls_field>-type = 'CHECK'
AND <ls_field>-from_dict = abap_true
AND <ls_field>-text IS INITIAL
AND <ls_field>-modific IS INITIAL.
<ls_field>-modific = 'X'.
ENDIF.
"fix for issue #2747:
IF <ls_field>-foreignkey IS INITIAL.
<ls_field>-foreignkey = lc_rpyty_force_off.
ENDIF.
ENDLOOP.
CALL FUNCTION 'RPY_DYNPRO_INSERT'
EXPORTING
header = ls_dynpro-header
suppress_exist_checks = abap_true
TABLES
containers = ls_dynpro-containers
fields_to_containers = ls_dynpro-fields
flow_logic = ls_dynpro-flow_logic
EXCEPTIONS
cancelled = 1
already_exists = 2
program_not_exists = 3
not_executed = 4
missing_required_field = 5
illegal_field_value = 6
field_not_allowed = 7
not_generated = 8
illegal_field_position = 9
OTHERS = 10.
IF sy-subrc <> 2 AND sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
* todo, RPY_DYNPRO_UPDATE?
CONCATENATE ls_dynpro-header-program ls_dynpro-header-screen
INTO lv_name RESPECTING BLANKS.
ASSERT NOT lv_name IS INITIAL.
zcl_abapgit_objects_activation=>add(
iv_type = 'DYNP'
iv_name = lv_name ).
ENDLOOP.
ENDMETHOD.
METHOD deserialize_program.
DATA:
lv_progname TYPE reposrc-progname,
lv_title TYPE rglif-title.
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
object = is_progdir-name
object_class = 'ABAP'
devclass = iv_package
master_language = mv_language
mode = 'I'
suppress_dialog = abap_true
EXCEPTIONS
cancelled = 1
permission_failure = 2
unknown_objectclass = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lv_title = get_program_title( it_tpool ).
" Check if program already exists
SELECT SINGLE progname FROM reposrc INTO lv_progname
WHERE progname = is_progdir-name
AND r3state = 'A'.
IF sy-subrc = 0.
update_program(
is_progdir = is_progdir
it_source = it_source
iv_title = lv_title ).
ELSE.
insert_program(
is_progdir = is_progdir
it_source = it_source
iv_title = lv_title
iv_package = iv_package ).
ENDIF.
insert_tpool(
is_progdir = is_progdir
it_tpool = it_tpool ).
update_progdir( is_progdir ).
zcl_abapgit_objects_activation=>add(
iv_type = 'REPS'
iv_name = is_progdir-name ).
ENDMETHOD.
METHOD deserialize_textpool.
DATA lv_language TYPE sy-langu.
DATA lv_state TYPE c.
DATA lv_delete TYPE abap_bool.
IF iv_language IS INITIAL.
lv_language = mv_language.
ELSE.
lv_language = iv_language.
ENDIF.
IF lv_language = mv_language.
lv_state = 'I'. "Textpool in main language needs to be activated
ELSE.
lv_state = 'A'. "Translations are always active
ENDIF.
IF it_tpool IS INITIAL.
IF iv_is_include = abap_false OR lv_state = 'A'.
DELETE TEXTPOOL iv_program "Remove initial description from textpool if
LANGUAGE lv_language "original program does not have a textpool
STATE lv_state.
lv_delete = abap_true.
ELSE.
INSERT TEXTPOOL iv_program "In case of includes: Deletion of textpool in
FROM it_tpool "main language cannot be activated because
LANGUAGE lv_language "this woul activate the deletion of the textpool
STATE lv_state. "of the mail program -> insert empty textpool
ENDIF.
ELSE.
IF lines( it_tpool ) = 1 AND lv_language = mv_language.
READ TABLE it_tpool WITH KEY id = 'R' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
RETURN. "No action because description in main language is already there
ENDIF.
ENDIF.
INSERT TEXTPOOL iv_program
FROM it_tpool
LANGUAGE lv_language
STATE lv_state.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
IF lv_state = 'I'. "Textpool in main language needs to be activated
zcl_abapgit_objects_activation=>add(
iv_type = 'REPT'
iv_name = iv_program
iv_delete = lv_delete ).
ENDIF.
ENDMETHOD.
METHOD get_program_title.
DATA ls_tpool LIKE LINE OF it_tpool.
FIELD-SYMBOLS <lg_any> TYPE any.
READ TABLE it_tpool INTO ls_tpool WITH KEY id = 'R'.
IF sy-subrc = 0.
" there is a bug in RPY_PROGRAM_UPDATE, the header line of TTAB is not
" cleared, so the title length might be inherited from a different program.
ASSIGN ('(SAPLSIFP)TTAB') TO <lg_any>.
IF sy-subrc = 0.
CLEAR <lg_any>.
ENDIF.
rv_title = ls_tpool-entry.
ENDIF.
ENDMETHOD.
METHOD insert_program.
CALL FUNCTION 'RPY_PROGRAM_INSERT'
EXPORTING
development_class = iv_package
program_name = is_progdir-name
program_type = is_progdir-subc
title_string = iv_title
save_inactive = 'I'
suppress_dialog = abap_true
TABLES
source_extended = it_source
EXCEPTIONS
already_exists = 1
cancelled = 2
name_not_allowed = 3
permission_error = 4
OTHERS = 5.
IF sy-subrc = 3.
" For cases that standard function does not handle (like FUGR),
" we save active and inactive version of source with the given PROGRAM TYPE.
" Without the active version, the code will not be visible in case of activation errors.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'A'
PROGRAM TYPE is_progdir-subc.
INSERT REPORT is_progdir-name
FROM it_source
STATE 'I'
PROGRAM TYPE is_progdir-subc.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from INSERT REPORT .. PROGRAM TYPE' ).
ENDIF.
ELSEIF sy-subrc > 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD insert_tpool.
IF NOT it_tpool[] IS INITIAL.
INSERT TEXTPOOL is_progdir-name
FROM it_tpool
LANGUAGE mv_language
STATE 'I'.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from INSERT TEXTPOOL' ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD is_any_dynpro_locked.
DATA: lt_dynpros TYPE ty_dynpro_tt,
lv_object TYPE seqg3-garg.
FIELD-SYMBOLS: <ls_dynpro> TYPE ty_dynpro.
lt_dynpros = serialize_dynpros( iv_program ).
LOOP AT lt_dynpros ASSIGNING <ls_dynpro>.
lv_object = |{ <ls_dynpro>-header-screen }{ <ls_dynpro>-header-program }|.
IF exists_a_lock_entry_for( iv_lock_object = 'ESCRP'
iv_argument = lv_object ) = abap_true.
rv_is_any_dynpro_locked = abap_true.
EXIT.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD is_cua_locked.
DATA: lv_object TYPE eqegraarg.
lv_object = |CU{ iv_program }|.
OVERLAY lv_object WITH ' '.
lv_object = lv_object && '*'.
rv_is_cua_locked = exists_a_lock_entry_for( iv_lock_object = 'ESCUAPAINT'
iv_argument = lv_object ).
ENDMETHOD.
METHOD is_text_locked.
DATA: lv_object TYPE eqegraarg.
lv_object = |*{ iv_program }|.
rv_is_text_locked = exists_a_lock_entry_for( iv_lock_object = 'EABAPTEXTE'
iv_argument = lv_object ).
ENDMETHOD.
METHOD read_progdir.
DATA: ls_sapdir TYPE progdir.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = iv_program
i_state = 'A'
IMPORTING
e_progdir = ls_sapdir.
MOVE-CORRESPONDING ls_sapdir TO rs_progdir.
CLEAR: rs_progdir-edtx,
rs_progdir-cnam,
rs_progdir-cdat,
rs_progdir-unam,
rs_progdir-udat,
rs_progdir-levl,
rs_progdir-vern,
rs_progdir-rmand,
rs_progdir-sdate,
rs_progdir-stime,
rs_progdir-idate,
rs_progdir-itime,
rs_progdir-varcl,
rs_progdir-state.
ENDMETHOD.
METHOD read_tpool.
FIELD-SYMBOLS: <ls_tpool_in> LIKE LINE OF it_tpool,
<ls_tpool_out> LIKE LINE OF rt_tpool.
LOOP AT it_tpool ASSIGNING <ls_tpool_in>.
APPEND INITIAL LINE TO rt_tpool ASSIGNING <ls_tpool_out>.
MOVE-CORRESPONDING <ls_tpool_in> TO <ls_tpool_out>.
IF <ls_tpool_out>-id = 'S'.
CONCATENATE <ls_tpool_in>-split <ls_tpool_in>-entry
INTO <ls_tpool_out>-entry
RESPECTING BLANKS.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD serialize_cua.
CALL FUNCTION 'RS_CUA_INTERNAL_FETCH'
EXPORTING
program = iv_program_name
language = mv_language
state = 'A'
IMPORTING
adm = rs_cua-adm
TABLES
sta = rs_cua-sta
fun = rs_cua-fun
men = rs_cua-men
mtx = rs_cua-mtx
act = rs_cua-act
but = rs_cua-but
pfk = rs_cua-pfk
set = rs_cua-set
doc = rs_cua-doc
tit = rs_cua-tit
biv = rs_cua-biv
EXCEPTIONS
not_found = 1
unknown_version = 2
OTHERS = 3.
IF sy-subrc > 1.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD serialize_dynpros.
DATA: ls_header TYPE rpy_dyhead,
lt_containers TYPE dycatt_tab,
lt_fields_to_containers TYPE dyfatc_tab,
lt_flow_logic TYPE swydyflow,
lt_d020s TYPE TABLE OF d020s,
lt_fieldlist_int TYPE TABLE OF d021s. "internal format
FIELD-SYMBOLS: <ls_d020s> LIKE LINE OF lt_d020s,
<lv_outputstyle> TYPE scrpostyle,
<ls_container> LIKE LINE OF lt_containers,
<ls_field> LIKE LINE OF lt_fields_to_containers,
<ls_dynpro> LIKE LINE OF rt_dynpro,
<ls_field_int> LIKE LINE OF lt_fieldlist_int.
"#2746: relevant flag values (taken from include MSEUSBIT)
CONSTANTS: lc_flg1ddf TYPE x VALUE '20',
lc_flg3fku TYPE x VALUE '08',
lc_flg3for TYPE x VALUE '04',
lc_flg3fdu TYPE x VALUE '02'.
CALL FUNCTION 'RS_SCREEN_LIST'
EXPORTING
dynnr = ''
progname = iv_program_name
TABLES
dynpros = lt_d020s
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 2.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
SORT lt_d020s BY dnum ASCENDING.
* loop dynpros and skip generated selection screens
LOOP AT lt_d020s ASSIGNING <ls_d020s>
WHERE type <> 'S' AND type <> 'W' AND type <> 'J'
AND NOT dnum IS INITIAL.
CALL FUNCTION 'RPY_DYNPRO_READ'
EXPORTING
progname = iv_program_name
dynnr = <ls_d020s>-dnum
IMPORTING
header = ls_header
TABLES
containers = lt_containers
fields_to_containers = lt_fields_to_containers
flow_logic = lt_flow_logic
EXCEPTIONS
cancelled = 1
not_found = 2
permission_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
"#2746: we need the dynpro fields in internal format:
FREE lt_fieldlist_int.
CALL FUNCTION 'RPY_DYNPRO_READ_NATIVE'
EXPORTING
progname = iv_program_name
dynnr = <ls_d020s>-dnum
TABLES
fieldlist = lt_fieldlist_int.
LOOP AT lt_fields_to_containers ASSIGNING <ls_field>.
* output style is a NUMC field, the XML conversion will fail if it contains invalid value
* field does not exist in all versions
ASSIGN COMPONENT 'OUTPUTSTYLE' OF STRUCTURE <ls_field> TO <lv_outputstyle>.
IF sy-subrc = 0 AND <lv_outputstyle> = ' '.
CLEAR <lv_outputstyle>.
ENDIF.
"2746: we apply the same logic as in SAPLWBSCREEN
"for setting or unsetting the foreignkey field:
UNASSIGN <ls_field_int>.
READ TABLE lt_fieldlist_int ASSIGNING <ls_field_int> WITH KEY fnam = <ls_field>-name.
IF <ls_field_int> IS ASSIGNED.
IF <ls_field_int>-flg1 O lc_flg1ddf AND
<ls_field_int>-flg3 O lc_flg3for AND
<ls_field_int>-flg3 Z lc_flg3fdu AND
<ls_field_int>-flg3 Z lc_flg3fku.
<ls_field>-foreignkey = 'X'.
ELSE.
CLEAR <ls_field>-foreignkey.
ENDIF.
ENDIF.
IF <ls_field>-from_dict = abap_true AND
<ls_field>-modific <> 'F' AND
<ls_field>-modific <> 'X'.
CLEAR <ls_field>-text.
ENDIF.
ENDLOOP.
LOOP AT lt_containers ASSIGNING <ls_container>.
IF <ls_container>-c_resize_v = abap_false.
CLEAR <ls_container>-c_line_min.
ENDIF.
IF <ls_container>-c_resize_h = abap_false.
CLEAR <ls_container>-c_coln_min.
ENDIF.
ENDLOOP.
APPEND INITIAL LINE TO rt_dynpro ASSIGNING <ls_dynpro>.
<ls_dynpro>-header = ls_header.
<ls_dynpro>-containers = lt_containers.
<ls_dynpro>-fields = lt_fields_to_containers.
<ls_dynpro>-flow_logic = lt_flow_logic.
ENDLOOP.
ENDMETHOD.
METHOD serialize_program.
DATA: ls_progdir TYPE ty_progdir,
lv_program_name TYPE programm,
lt_dynpros TYPE ty_dynpro_tt,
ls_cua TYPE ty_cua,
lt_source TYPE TABLE OF abaptxt255,
lt_tpool TYPE textpool_table,
ls_tpool LIKE LINE OF lt_tpool,
li_xml TYPE REF TO zif_abapgit_xml_output.
IF iv_program IS INITIAL.
lv_program_name = is_item-obj_name.
ELSE.
lv_program_name = iv_program.
ENDIF.
zcl_abapgit_language=>set_current_language( mv_language ).
CALL FUNCTION 'RPY_PROGRAM_READ'
EXPORTING
program_name = lv_program_name
with_includelist = abap_false
with_lowercase = abap_true
TABLES
source_extended = lt_source
textelements = lt_tpool
EXCEPTIONS
cancelled = 1
not_found = 2
permission_error = 3
OTHERS = 4.
IF sy-subrc = 2.
zcl_abapgit_language=>restore_login_language( ).
RETURN.
ELSEIF sy-subrc <> 0.
zcl_abapgit_language=>restore_login_language( ).
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
zcl_abapgit_language=>restore_login_language( ).
ls_progdir = read_progdir( lv_program_name ).
IF io_xml IS BOUND.
li_xml = io_xml.
ELSE.
CREATE OBJECT li_xml TYPE zcl_abapgit_xml_output.
ENDIF.
li_xml->add( iv_name = 'PROGDIR'
ig_data = ls_progdir ).
IF ls_progdir-subc = '1' OR ls_progdir-subc = 'M'.
lt_dynpros = serialize_dynpros( lv_program_name ).
li_xml->add( iv_name = 'DYNPROS'
ig_data = lt_dynpros ).
ls_cua = serialize_cua( lv_program_name ).
IF NOT ls_cua IS INITIAL.
li_xml->add( iv_name = 'CUA'
ig_data = ls_cua ).
ENDIF.
ENDIF.
READ TABLE lt_tpool WITH KEY id = 'R' INTO ls_tpool.
IF sy-subrc = 0 AND ls_tpool-key = '' AND ls_tpool-length = 0.
DELETE lt_tpool INDEX sy-tabix.
ENDIF.
li_xml->add( iv_name = 'TPOOL'
ig_data = add_tpool( lt_tpool ) ).
IF NOT io_xml IS BOUND.
io_files->add_xml( iv_extra = iv_extra
ii_xml = li_xml ).
ENDIF.
io_files->add_abap( iv_extra = iv_extra
it_abap = lt_source ).
ENDMETHOD.
METHOD uncondense_flow.
DATA: lv_spaces LIKE LINE OF it_spaces.
FIELD-SYMBOLS: <ls_flow> LIKE LINE OF it_flow,
<ls_output> LIKE LINE OF rt_flow.
LOOP AT it_flow ASSIGNING <ls_flow>.
APPEND INITIAL LINE TO rt_flow ASSIGNING <ls_output>.
<ls_output>-line = <ls_flow>-line.
READ TABLE it_spaces INDEX sy-tabix INTO lv_spaces.
IF sy-subrc = 0.
SHIFT <ls_output>-line RIGHT BY lv_spaces PLACES IN CHARACTER MODE.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD update_progdir.
DATA ls_progdir_new TYPE progdir.
CALL FUNCTION 'READ_PROGDIR'
EXPORTING
i_progname = is_progdir-name
i_state = 'I'
IMPORTING
e_progdir = ls_progdir_new
EXCEPTIONS
not_exists = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error reading program directory' ).
ENDIF.
ls_progdir_new-ldbname = is_progdir-ldbname.
ls_progdir_new-dbna = is_progdir-dbna.
ls_progdir_new-dbapl = is_progdir-dbapl.
ls_progdir_new-rload = is_progdir-rload.
ls_progdir_new-fixpt = is_progdir-fixpt.
ls_progdir_new-varcl = is_progdir-varcl.
ls_progdir_new-appl = is_progdir-appl.
ls_progdir_new-rstat = is_progdir-rstat.
ls_progdir_new-sqlx = is_progdir-sqlx.
ls_progdir_new-uccheck = is_progdir-uccheck.
ls_progdir_new-clas = is_progdir-clas.
CALL FUNCTION 'UPDATE_PROGDIR'
EXPORTING
i_progdir = ls_progdir_new
i_progname = ls_progdir_new-name
i_state = ls_progdir_new-state
EXCEPTIONS
not_executed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error updating program directory' ).
ENDIF.
" function UPDATE_PROGDIR does not update VARCL, so we do it here
SELECT SINGLE * FROM progdir INTO ls_progdir_new
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state.
IF sy-subrc = 0 AND is_progdir-varcl <> ls_progdir_new-varcl.
UPDATE progdir SET varcl = is_progdir-varcl
WHERE name = ls_progdir_new-name
AND state = ls_progdir_new-state. "#EC CI_SUBRC
ENDIF.
ENDMETHOD.
METHOD update_program.
zcl_abapgit_language=>set_current_language( mv_language ).
CALL FUNCTION 'RPY_PROGRAM_UPDATE'
EXPORTING
program_name = is_progdir-name
title_string = iv_title
save_inactive = 'I'
TABLES
source_extended = it_source
EXCEPTIONS
cancelled = 1
permission_error = 2
not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcl_abapgit_language=>restore_login_language( ).
IF sy-msgid = 'EU' AND sy-msgno = '510'.
zcx_abapgit_exception=>raise( 'User is currently editing program' ).
ELSEIF sy-msgid = 'EU' AND sy-msgno = '522'.
" for generated table maintenance function groups, the author is set to SAP* instead of the user which
" generates the function group. This hits some standard checks, pulling new code again sets the author
" to the current user which avoids the check
zcx_abapgit_exception=>raise( |Delete function group and pull again, { is_progdir-name } (EU522)| ).
ELSE.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
zcl_abapgit_language=>restore_login_language( ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
23065,
5550,
20032,
17941,
44731,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
16668,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
1676,
70,
15908,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
220,
220,
220,
41876,
1172,
15908,
12,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1181,
220,
220,
41876,
1172,
15908,
12,
5219,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44161,
87,
220,
220,
220,
41876,
1172,
15908,
12,
25410,
87,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1225,
17602,
220,
220,
220,
41876,
1172,
15908,
12,
276,
17602,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1401,
565,
220,
220,
41876,
1172,
15908,
12,
7785,
565,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
7012,
489,
220,
220,
41876,
1172,
15908,
12,
67,
7012,
489,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20613,
2616,
220,
220,
220,
41876,
1172,
15908,
12,
9945,
2616,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
537,
292,
220,
220,
220,
41876,
1172,
15908,
12,
565,
292,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2099,
220,
220,
220,
41876,
1172,
15908,
12,
4906,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8833,
220,
41876,
1172,
15908,
12,
13966,
1834,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
850,
66,
220,
220,
220,
41876,
1172,
15908,
12,
7266,
66,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3680,
220,
220,
220,
41876,
1172,
15908,
12,
1324,
75,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
792,
84,
220,
220,
220,
41876,
1172,
15908,
12,
2363,
84,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
7402,
220,
220,
220,
41876,
1172,
15908,
12,
66,
7402,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
19608,
220,
220,
220,
41876,
1172,
15908,
12,
10210,
265,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
555,
321,
220,
220,
220,
41876,
1172,
15908,
12,
403,
321,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
19608,
220,
220,
220,
41876,
1172,
15908,
12,
463,
265,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
933,
220,
220,
220,
41876,
1172,
15908,
12,
933,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
443,
19279,
220,
220,
220,
41876,
1172,
15908,
12,
2768,
75,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
14269,
220,
220,
41876,
1172,
15908,
12,
81,
14269,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
22249,
220,
220,
41876,
1172,
15908,
12,
81,
22249,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
2220,
220,
220,
41876,
1172,
15908,
12,
81,
2220,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4259,
457,
220,
220,
41876,
1172,
15908,
12,
13049,
457,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
2617,
220,
220,
220,
41876,
1172,
15908,
12,
824,
316,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
4475,
220,
220,
41876,
1172,
15908,
12,
82,
4475,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
336,
524,
220,
220,
41876,
1172,
15908,
12,
301,
524,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
378,
220,
220,
41876,
1172,
15908,
12,
20540,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
524,
220,
220,
41876,
1172,
15908,
12,
22552,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
9945,
3672,
41876,
1172,
15908,
12,
335,
65,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
535,
258,
694,
41876,
1172,
15908,
12,
18863,
258,
694,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
1676,
70,
15908,
13,
628,
220,
220,
220,
337,
36252,
50,
11389,
1096,
62,
23065,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
33245,
62,
19875,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
19875,
62,
22915,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
9186,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
16624,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
16624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
23065,
41876,
1430,
76,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26086,
220,
220,
41876,
537,
522,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
1100,
62,
1676,
70,
15908,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
23065,
220,
220,
220,
220,
220,
220,
220,
41876,
1430,
76,
198,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& Report
*&---------------------------------------------------------------------*
*& This is the demo program written for book:
*& ALV grid in nutshell by Łukasz Pęgiel
*&---------------------------------------------------------------------*
REPORT zdemo_ain_cl42.
INCLUDE zdemo_ain_include_screen.
PARAMETERS: p_domnam TYPE lvc_s_fcat-domname.
START-OF-SELECTION.
SELECT * UP TO 50 ROWS FROM spfli
INTO TABLE @DATA(flights).
DATA(grid) = NEW cl_gui_alv_grid(
i_parent = NEW cl_gui_custom_container( container_name = 'CC' )
).
DATA(fcat) = VALUE lvc_t_fcat(
( fieldname = 'CARRID' )
( fieldname = 'CONNID' )
( fieldname = 'COUNTRYFR' )
( fieldname = 'CITYFROM' domname = p_domnam )
( fieldname = 'AIRPFROM' )
( fieldname = 'COUNTRYTO' )
( fieldname = 'CITYTO' )
( fieldname = 'FLTIME' )
( fieldname = 'DEPTIME' )
( fieldname = 'FLTYPE' )
).
grid->set_table_for_first_display(
EXPORTING
is_layout = VALUE #( col_opt = abap_false edit = abap_true )
CHANGING
it_fieldcatalog = fcat
it_outtab = flights
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
).
IF sy-subrc EQ 0.
CALL SCREEN 0100.
ENDIF.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
6358,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
770,
318,
262,
13605,
1430,
3194,
329,
1492,
25,
198,
9,
5,
8355,
53,
10706,
287,
43875,
416,
25370,
223,
2724,
292,
89,
350,
128,
247,
70,
8207,
198,
9,
5,
10097,
30934,
9,
198,
2200,
15490,
1976,
9536,
78,
62,
391,
62,
565,
3682,
13,
198,
198,
1268,
5097,
52,
7206,
1976,
9536,
78,
62,
391,
62,
17256,
62,
9612,
13,
198,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
3438,
7402,
41876,
300,
28435,
62,
82,
62,
69,
9246,
12,
3438,
3672,
13,
198,
198,
2257,
7227,
12,
19238,
12,
46506,
2849,
13,
628,
220,
33493,
1635,
15958,
5390,
2026,
371,
22845,
16034,
599,
2704,
72,
198,
39319,
43679,
2488,
26947,
7,
2704,
2337,
737,
628,
220,
42865,
7,
25928,
8,
796,
12682,
537,
62,
48317,
62,
282,
85,
62,
25928,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
8000,
796,
12682,
537,
62,
48317,
62,
23144,
62,
34924,
7,
9290,
62,
3672,
796,
705,
4093,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6739,
198,
220,
42865,
7,
69,
9246,
8,
796,
26173,
8924,
300,
28435,
62,
83,
62,
69,
9246,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
20034,
49,
2389,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
10943,
45,
2389,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
19385,
40405,
10913,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
9050,
10913,
2662,
6,
2401,
3672,
796,
279,
62,
3438,
7402,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
42149,
47,
10913,
2662,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
19385,
40405,
10468,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
9050,
10468,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
3697,
34694,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
7206,
11571,
12789,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
3697,
25216,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6739,
628,
220,
10706,
3784,
2617,
62,
11487,
62,
1640,
62,
11085,
62,
13812,
7,
198,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
39786,
796,
26173,
8924,
1303,
7,
951,
62,
8738,
796,
450,
499,
62,
9562,
4370,
796,
450,
499,
62,
7942,
1267,
198,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
340,
62,
3245,
9246,
11794,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
277,
9246,
198,
220,
220,
220,
220,
220,
340,
62,
448,
8658,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
13956,
198,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
12515,
62,
17143,
2357,
62,
24011,
1883,
796,
352,
198,
220,
220,
220,
220,
220,
1430,
62,
18224,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
362,
198,
220,
220,
220,
220,
220,
1165,
62,
21834,
62,
6615,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
513,
198,
220,
220,
220,
220,
220,
440,
4221,
4877,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
604,
198,
220,
6739,
198,
220,
16876,
827,
12,
7266,
6015,
36529,
657,
13,
198,
220,
220,
220,
42815,
6374,
2200,
1677,
5534,
405,
13,
198,
220,
23578,
5064,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& Include ZFI_CUSTOMER_RECEIPT_FORM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form fetch_data
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM process_data USING VALUE(p_commit) CHANGING gw_line TYPE ty_input.
DATA line_cnt TYPE n VALUE 1.
DATA header_txt TYPE bktxt.
DATA lv_paobjnr TYPE acdoca-paobjnr.
DATA lv_hkont TYPE hkont.
DATA lv_mwskz TYPE mwskz.
DATA lv_kostl TYPE kostl.
DATA lv_kunnr TYPE kunnr.
DATA lv_name1 TYPE kna1-name1.
DATA lv_prctr TYPE prctr.
DATA lv_tabix TYPE sy-tabix.
DATA lv_tabii TYPE sy-tabix.
CONSTANTS: lc_strctrnm1 TYPE te_struc VALUE 'POSTING_KEY',
lc_strctrnm2 TYPE te_struc VALUE 'PSG_SEG',
lc_pstky TYPE valuepart VALUE '15',
lc_docty TYPE valuepart VALUE 'DZ'.
DATA lt_item LIKE gt_item.
DATA lt_head LIKE gt_head.
lt_head = gt_head.
lt_item = gt_item.
* 7/2
IF gw_line IS NOT INITIAL.
IF gw_line-field_1 EQ gc_ph.
DELETE lt_head WHERE doc_number NE gw_line-field_7.
DELETE lt_item WHERE doc_number NE gw_line-field_7.
ENDIF.
IF gw_line-field_1 EQ gc_pd.
DELETE lt_head WHERE doc_number NE gw_line-field_2.
DELETE lt_item WHERE doc_number NE gw_line-field_2.
ENDIF.
ENDIF.
CLEAR: gw_head, gw_item.
SORT lt_head BY doc_number DESCENDING.
LOOP AT lt_head INTO gw_head.
lv_tabii = sy-tabix.
SORT lt_item BY doc_number DESCENDING.
LOOP AT lt_item INTO gw_item WHERE doc_number = gw_head-doc_number.
lv_tabix = sy-tabix.
AT NEW doc_number. " @will only be Entered once for all now line items. [START AT]
CLEAR: gw_header, line_cnt, gw_acdoca.
line_cnt = 1.
REFRESH: gt_accountgl,
gt_accountrcv,
gt_accounttax,
gt_currencyamount,
gt_criteria,
gt_extension2,
gt_return.
READ TABLE gt_item INTO gw_item INDEX lv_tabix.
READ TABLE gt_head INTO gw_head INDEX lv_tabii.
PERFORM get_iban_details USING gw_head-iban CHANGING gw_zarvatobank.
PERFORM convert_to_internal USING gw_zarvatobank-discount_gl gw_zarvatobank-discount_gl.
PERFORM convert_to_internal USING gw_zarvatobank-incm_gl gw_zarvatobank-incm_gl.
IF gw_zarvatobank IS NOT INITIAL.
PERFORM get_gl_account USING gw_zarvatobank-bukrs gw_zarvatobank-bankn gw_zarvatobank-hktid CHANGING lv_hkont.
PERFORM get_customer USING gw_head-doc_number gw_head-kunnr CHANGING lv_kunnr lv_name1.
IF gw_head-tax_amt NE 0.
PERFORM get_origin_doc_data USING gw_head-doc_number gw_zarvatobank-bukrs gw_item-xblnr CHANGING gw_acdoca.
lv_mwskz = gw_acdoca-mwskz.
lv_prctr = gw_acdoca-prctr.
lv_paobjnr = gw_acdoca-paobjnr.
IF lv_prctr IS INITIAL
AND gw_zarvatobank-prctr IS NOT INITIAL.
MOVE gw_zarvatobank-prctr TO lv_prctr.
ENDIF.
ENDIF.
PERFORM get_costcenter USING gw_zarvatobank-bukrs gw_zarvatobank-discount_gl lv_prctr CHANGING lv_kostl.
ENDIF.
CONCATENATE gw_head-blart gw_item-xblnr gw_head-kunnr INTO header_txt.
PERFORM validation USING gw_head gw_item gw_zarvatobank.
PERFORM convert_to_internal USING lv_kunnr lv_kunnr.
**************************************
** HEADER ENTRY
**************************************
********* Set Document Header
PERFORM set_doc_headr USING gw_zarvatobank-bukrs "Company Code
lc_docty "Document Type
gw_head-budat "Document Date
header_txt "Header Text
gw_item-xblnr. "Arvato Document Number
**************************************
** ITEM ENTRY
**************************************
**************************************
** Line Item 1 Entry
**************************************
********** Set Document Items
IF gw_item-xblnr IS INITIAL.
MOVE gw_zarvatobank-prctr TO lv_prctr.
ENDIF.
PERFORM set_gl USING line_cnt "Item number
gw_zarvatobank-incm_gl "GL Account
gw_zarvatobank-bukrs "Company code
lc_docty "Document Type
space "Tax Code
lv_name1 "Item Text
lv_prctr "profit center
space. "Cost Center
********** Set Document Currency
PERFORM set_currency USING line_cnt "Item Number
gw_head-waers "Currency
gw_item-pay_amt "Payment amount
space. "Base Amount
ENDAT. " @will only be Entered once for all now line items. [END AT]
**************************************
** Line Item 2 Entry if Discount
**************************************
IF gw_item-cash_disc IS NOT INITIAL.
IF gw_item-xblnr IS INITIAL.
MOVE gw_zarvatobank-prctr TO lv_prctr.
ENDIF.
PERFORM get_origin_doc_data USING gw_head-doc_number gw_zarvatobank-bukrs gw_item-xblnr CHANGING gw_acdoca.
lv_mwskz = gw_acdoca-mwskz.
lv_prctr = gw_acdoca-prctr.
lv_paobjnr = gw_acdoca-paobjnr.
line_cnt = line_cnt + 1.
********** Set Document Items
PERFORM set_gl USING line_cnt "Item number
gw_zarvatobank-discount_gl "GL Account
gw_zarvatobank-bukrs "Company code
lc_docty "Document Type
lv_mwskz "Tax Code
lv_name1 "Item Text
lv_prctr "profit center
space. "Cost Center
********** Copy Profitibility Segment
PERFORM set_extensions USING lc_strctrnm2 "Structure Name
line_cnt "Value Part 1
lv_paobjnr "Value Part 2
space "Value Part 3
space. "Value Part 4
********** Set Document Currency
PERFORM set_currency USING line_cnt "Item Number
gw_head-waers "Currency
gw_item-cash_disc "Discount amount
space. "Base Amount
********************************** LACC9F20
PERFORM get_set_psg USING:
line_cnt 'KNDNR' gw_acdoca-kunnr,
line_cnt 'ARTNR' gw_acdoca-matnr_pa,
line_cnt 'KUNWE' gw_acdoca-kunwe,
line_cnt 'FKART' gw_acdoca-fkart,
line_cnt 'KAUFN' gw_acdoca-kdauf,
line_cnt 'KDPOS' gw_acdoca-kdpos,
line_cnt 'COUNC' gw_acdoca-rbukrs,
line_cnt 'WERKS' gw_acdoca-werks,
line_cnt 'SEGMENT' gw_acdoca-segment,
line_cnt 'VKORG' gw_acdoca-vkorg,
line_cnt 'VTWEG' gw_acdoca-vtweg,
line_cnt 'SPART' gw_acdoca-spart,
line_cnt 'PRCTR' gw_acdoca-prctr,
line_cnt 'KMLAND' gw_acdoca-kmland_pa,
line_cnt 'KMMAKL' gw_acdoca-kmmakl_pa,
line_cnt 'VKGRP' gw_acdoca-kmvkgr_pa,
line_cnt 'PARTNER' gw_acdoca-partner_pa,
line_cnt 'PRODH' gw_acdoca-prodh_pa,
line_cnt 'CRMCSTY' gw_acdoca-crmcsty_pa,
line_cnt 'CRMELEM' gw_acdoca-crmelem_pa,
line_cnt 'CITYC' gw_acdoca-cityc_pa,
line_cnt 'COUNC' gw_acdoca-counc_pa,
line_cnt 'KTOKD' gw_acdoca-ktokd_pa,
line_cnt 'MTART' gw_acdoca-mtart_pa,
line_cnt 'PAPH1' gw_acdoca-paph1_pa,
line_cnt 'PAPH2' gw_acdoca-paph2_pa,
line_cnt 'PAPH3' gw_acdoca-paph3_pa,
line_cnt 'XCPDK' gw_acdoca-xcpdk_pa,
line_cnt 'MATNR' gw_acdoca-matnr_pa,
line_cnt 'PAPH1' gw_acdoca-paph4_pa,
line_cnt 'PAPH5' gw_acdoca-paph5_pa,
line_cnt 'MVGR1' gw_acdoca-mvgr1_pa,
line_cnt 'MVGR2' gw_acdoca-mvgr2_pa,
line_cnt 'MVGR3' gw_acdoca-mvgr3_pa,
line_cnt 'MVGR4' gw_acdoca-mvgr4_pa,
line_cnt 'MVGR5' gw_acdoca-mvgr5_pa,
line_cnt 'WWCOU' gw_acdoca-wwcou_pa,
line_cnt 'WWDDC' gw_acdoca-wwddc_pa,
line_cnt 'ZZSEM' gw_acdoca-zzsem_pa.
ENDIF.
**************************************
** Line Item 3 Entry if Discount
** Line Item 2 Entry if no Discount
**************************************
line_cnt = line_cnt + 1.
********** Set Account Recievable
DATA lv_gl_ind TYPE umskz.
DATA lvp_mwskz TYPE mwskz.
****************** Add Special GL for Advance or Not NUZ Account
IF gw_item-xblnr IS INITIAL AND gw_zarvatobank-nuz_acc IS INITIAL.
lv_gl_ind = gw_zarvatobank-special_gl.
MOVE gw_zarvatobank-prctr TO lv_prctr.
ELSE.
****************** Else Remove It.
lv_gl_ind = space.
ENDIF.
IF gw_item-cash_disc IS INITIAL.
lvp_mwskz = space.
ELSE.
lvp_mwskz = lv_mwskz.
ENDIF.
PERFORM set_accountrcv USING line_cnt "Item Number
lv_kunnr "Customer
gw_zarvatobank-bukrs "Company Code
lvp_mwskz "Tax Code
lv_name1 "Item Text
gw_item-xblnr "Assignment Number
lv_gl_ind. "Special GL Indicator
gw_item-inv_amt = gw_item-inv_amt * -1.
********** Set Document Currency
PERFORM set_currency USING line_cnt "Item Number
gw_head-waers "Currency
gw_item-inv_amt "Invoice amount
space. "Base Amount
********** Extension to Set Posting Key to 15
IF gw_item-xblnr IS NOT INITIAL.
PERFORM set_extensions USING lc_strctrnm1 "Structure Name
line_cnt "Value Part 1
lc_pstky "Value Part 2
space "Value Part 3
space. "Value Part 4
ENDIF.
**************************************
** Line Item 4 Entry if Discount
**************************************
IF gw_item-cash_disc IS NOT INITIAL.
line_cnt = line_cnt + 1.
********* Calculate Tax
PERFORM calculate_tax USING gw_zarvatobank-bukrs "Company code
gw_head-waers "Currency
gw_item-cash_disc "Amount "#EC CI_FLDEXT_OK[2610650]
lv_mwskz "Tax Code
CHANGING gw_mwdat.
PERFORM set_tax USING line_cnt "Item Numner
gw_mwdat-hkont "GL Account
gw_mwdat-ktosl "Account Key
gw_mwdat-kschl "Condition Key
lv_mwskz. "Tax Code
********** Set Document Currency
PERFORM set_currency USING line_cnt "Item Number
gw_head-waers "Currency "#EC CI_FLDEXT_OK[2610650]
gw_mwdat-wmwst "Invoice amount "#EC CI_FLDEXT_OK[2610650]
gw_mwdat-kawrt. "Base Amount
ENDIF.
AT END OF doc_number.
IF p_commit NE abap_true.
*** Check the parking document
PERFORM check_document USING: gw_header
gt_accountgl "#EC CI_FLDEXT_OK
gt_accountrcv
gt_accounttax
gt_currencyamount
gt_criteria
gt_extension2
CHANGING gt_return.
IF gw_line IS NOT INITIAL.
EXIT.
ENDIF.
***** Build error output
PERFORM build_msg USING abap_true
gw_head-doc_number
space
space
space
space
space
space.
CLEAR gw_error.
IF gt_error IS NOT INITIAL.
READ TABLE gt_error INTO gw_error WITH KEY type = 'S'.
IF gw_error IS NOT INITIAL.
"Success
PERFORM set_document_processing_status USING 'S' gw_item-doc_number.
ENDIF.
CLEAR gw_error.
READ TABLE gt_error INTO gw_error WITH KEY type = 'E'.
IF gw_error IS NOT INITIAL.
"Set Error
PERFORM set_document_processing_status USING 'E' gw_item-doc_number.
ENDIF.
CLEAR gw_error.
ENDIF.
PERFORM set_document_company_code USING gw_item-doc_number gw_zarvatobank-bukrs.
PERFORM set_document_tax_code USING gw_item-doc_number lv_mwskz.
ELSE.
*** Park Document with Commit
PERFORM park_document USING: gw_header
gt_accountgl "#EC CI_FLDEXT_OK
gt_accountrcv
gt_accounttax
gt_currencyamount
gt_criteria
gt_extension2
CHANGING gt_return.
ENDIF.
ENDAT.
CLEAR: gw_item.
ENDLOOP.
CLEAR: gw_head.
ENDLOOP.
* Leave the program once he file is commited to park.
IF p_commit EQ abap_true.
IF sy-subrc <> 0.
MESSAGE e005(zfiac) DISPLAY LIKE 'E'.
ELSE.
MESSAGE s004(zfiac) DISPLAY LIKE 'I' WITH gv_total_doc.
CALL TRANSACTION sy-tcode.
* LEAVE TO SCREEN 1000.
LEAVE PROGRAM.
* LEAVE TO LIST-PROCESSING.
ENDIF.
ENDIF.
ENDFORM.
*&-gw_--------------------------------------------------------------------*
*& Form alv_fcat
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM alv_fcat .
PERFORM build_catalog USING:
'ICON' space space 'Status',
'BUKRS' space space 'Company Code',
'MWSKZ' space space 'Tax Code',
'FIELD_1' space space 'Header/Details',
'FIELD_2' space space 'Date/Doc No.',
'FIELD_3' space space 'Customer/Inv.Ref.No',
'FIELD_4' space space 'Payment Amount',
'FIELD_5' space space 'Currency/Ex.Rate',
'FIELD_6' space space 'IBAN Account',
'FIELD_7' space space 'Doc No./Cash Disc.',
'FIELD_8' space space 'Doc Type/Calc. Info',
'FIELD_9' space space 'Ex.Rate',
'FIELD_10' space space 'Base Amount',
'FIELD_11' space space 'Bank Fee',
'FIELD_12' space space 'Bank Fee EUR',
'FIELD_13' space space 'Tax Amount'.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form build_structure
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM data_split .
IF gt_input[] IS NOT INITIAL.
CLEAR: gw_input.
LOOP AT gt_input INTO gw_input.
CASE gw_input-field_1.
WHEN gc_ph.
MOVE gw_input-field_1 TO gw_head-hheader.
MOVE gw_input-field_2 TO gw_head-budat.
MOVE gw_input-field_3 TO gw_head-kunnr.
MOVE gw_input-field_4 TO gw_head-amount.
MOVE gw_input-field_5 TO gw_head-waers.
MOVE gw_input-field_6 TO gw_head-iban.
MOVE gw_input-field_7 TO gw_head-doc_number.
MOVE gw_input-field_8 TO gw_head-blart.
MOVE gw_input-field_9 TO gw_head-kursf.
MOVE gw_input-field_10 TO gw_head-base_amt.
MOVE gw_input-field_11 TO gw_head-bank_fee.
MOVE gw_input-field_12 TO gw_head-bank_free_eu.
MOVE gw_input-field_13 TO gw_head-tax_amt.
APPEND gw_head TO gt_head.
CLEAR gw_head.
WHEN gc_pd.
MOVE gw_input-field_1 TO gw_item-iheader.
MOVE gw_input-field_2 TO gw_item-doc_number.
MOVE gw_input-field_3 TO gw_item-xblnr. "#EC CI_FLDEXT_OK[2610650]
MOVE gw_input-field_4 TO gw_item-pay_amt. "#EC CI_FLDEXT_OK[2610650]
MOVE gw_input-field_5 TO gw_item-kursf_inv.
MOVE gw_input-field_6 TO gw_item-inv_amt. "#EC CI_FLDEXT_OK[2610650]
MOVE gw_input-field_7 TO gw_item-cash_disc. "#EC CI_FLDEXT_OK[2610650]
MOVE gw_input-field_8 TO gw_item-cal_info. "#EC CI_FLDEXT_OK[2610650]
APPEND gw_item TO gt_item.
CLEAR gw_item.
ENDCASE.
CLEAR: gw_input.
ENDLOOP.
ENDIF.
ENDFORM.
FORM top_of_page.
REFRESH: gt_ttop.
DATA: lv_total_doc(5) TYPE c.
DATA: lv_total_err(5) TYPE c VALUE 0.
DATA: lv_msg1 TYPE slis_entry.
DATA: lv_msg2 TYPE slis_entry.
DATA: lv_msg3 TYPE slis_entry.
DATA lt_input LIKE gt_input.
DATA lt_error LIKE gt_error.
lt_input = gt_input.
lt_error = gt_error.
************ Get total document count
DELETE lt_input WHERE field_1 EQ gc_pd.
DESCRIBE TABLE lt_input LINES lv_total_doc.
CONCATENATE 'Total Documents:' lv_total_doc INTO lv_msg1 SEPARATED BY space.
gv_total_doc = lv_total_doc.
************ Get total error count
DELETE lt_error WHERE type EQ 'S'.
IF lt_error IS NOT INITIAL.
SORT lt_error BY message.
DELETE ADJACENT DUPLICATES FROM lt_error COMPARING message.
DESCRIBE TABLE lt_error LINES lv_total_err.
CONCATENATE 'Error Found:' lv_total_err INTO lv_msg2 SEPARATED BY space.
lv_msg3 = 'Posting Not Possible'.
ELSE.
CONCATENATE 'Error Found:' lv_total_err INTO lv_msg2 SEPARATED BY space.
lv_msg3 = 'Posting Possible'.
ENDIF.
************ Get total count
PERFORM build_top_of_page USING:
'H' 'Arvato Customer Payment',
'S' lv_msg1,
'S' lv_msg2,
'S' lv_msg3.
ENDFORM.
*----------------------------------------------------------*
* FORM HANDLE_USER_COMMAND *
*----------------------------------------------------------*
* --> R_UCOMM *
* --> RS_SELFIELD *
*----------------------------------------------------------*
FORM handle_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
** Check function code
CASE r_ucomm.
WHEN '&PARK'.
CLEAR gw_error.
READ TABLE gt_error INTO gw_error WITH KEY type = 'E'.
IF gw_error IS INITIAL.
CLEAR gw_line.
PERFORM process_data USING abap_true CHANGING gw_line .
ENDIF.
WHEN '&IC1'.
CLEAR: gw_input.
READ TABLE gt_input INTO gw_input INDEX rs_selfield-tabindex.
IF gw_input IS NOT INITIAL.
PERFORM pop_list_display USING gw_input.
ENDIF.
CLEAR: gw_input.
ENDCASE.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form validation
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM validation USING gw_head TYPE ty_header
gw_item TYPE ty_item
gw_zarvatobank TYPE zarvatobank.
IF gw_head-iban IS INITIAL.
***** Build error output
PERFORM build_msg USING space
gw_head-doc_number
'E'
TEXT-001
space
space
space
space.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form set_document_processing_status
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM set_document_processing_status USING VALUE(p_status)
VALUE(p_doc).
CLEAR gw_input.
LOOP AT gt_input INTO gw_input WHERE field_1 EQ gc_ph
AND field_7 EQ p_doc.
CASE p_status.
WHEN 'S'.
gw_input-icon = gc_green.
WHEN 'E'.
gw_input-icon = gc_red.
ENDCASE.
MODIFY gt_input FROM gw_input TRANSPORTING icon.
CLEAR gw_input.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form set_document_company_code
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> GE_HEADER
*&---------------------------------------------------------------------*
FORM set_document_company_code USING VALUE(p_doc) VALUE(p_company).
CLEAR gw_input.
LOOP AT gt_input INTO gw_input WHERE field_1 EQ gc_ph
AND field_7 EQ p_doc.
gw_input-bukrs = p_company.
MODIFY gt_input FROM gw_input TRANSPORTING bukrs.
CLEAR gw_input.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form set_document_tax_code
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> GE_HEADER
*&---------------------------------------------------------------------*
FORM set_document_tax_code USING VALUE(p_doc) VALUE(p_txcod).
CLEAR gw_input.
LOOP AT gt_input INTO gw_input WHERE field_1 EQ gc_ph
AND field_7 EQ p_doc.
gw_input-mwskz = p_txcod.
MODIFY gt_input FROM gw_input TRANSPORTING mwskz.
CLEAR gw_input.
ENDLOOP.
ENDFORM.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
40348,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1168,
11674,
62,
34,
7759,
2662,
1137,
62,
2200,
5222,
4061,
51,
62,
21389,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
5178,
21207,
62,
7890,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
2420,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
14610,
220,
279,
16,
220,
220,
220,
220,
220,
220,
220,
2420,
198,
9,
5,
1279,
438,
220,
279,
17,
220,
220,
220,
220,
220,
220,
220,
2420,
198,
9,
5,
10097,
30934,
9,
198,
21389,
1429,
62,
7890,
1294,
2751,
26173,
8924,
7,
79,
62,
41509,
8,
5870,
15567,
2751,
308,
86,
62,
1370,
41876,
1259,
62,
15414,
13,
198,
220,
42865,
1627,
62,
66,
429,
41876,
299,
26173,
8924,
352,
13,
198,
220,
42865,
13639,
62,
14116,
41876,
275,
74,
14116,
13,
198,
220,
42865,
300,
85,
62,
8957,
26801,
48624,
41876,
936,
67,
11216,
12,
8957,
26801,
48624,
13,
198,
220,
42865,
300,
85,
62,
71,
74,
756,
41876,
289,
74,
756,
13,
198,
220,
42865,
300,
85,
62,
76,
86,
8135,
89,
41876,
285,
86,
8135,
89,
13,
198,
220,
42865,
300,
85,
62,
74,
455,
75,
41876,
479,
455,
75,
13,
198,
220,
42865,
300,
85,
62,
74,
20935,
81,
41876,
479,
20935,
81,
13,
198,
220,
42865,
300,
85,
62,
3672,
16,
41876,
638,
64,
16,
12,
3672,
16,
13,
198,
220,
42865,
300,
85,
62,
1050,
24087,
41876,
778,
24087,
13,
198,
220,
42865,
300,
85,
62,
8658,
844,
41876,
827,
12,
8658,
844,
13,
198,
220,
42865,
300,
85,
62,
8658,
4178,
41876,
827,
12,
8658,
844,
13,
628,
220,
7102,
2257,
1565,
4694,
25,
300,
66,
62,
2536,
24087,
21533,
16,
41876,
573,
62,
19554,
66,
26173,
8924,
705,
32782,
2751,
62,
20373,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
66,
62,
2536,
24087,
21533,
17,
41876,
573,
62,
19554,
66,
26173,
8924,
705,
3705,
38,
62,
5188,
38,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
66,
62,
79,
301,
2584,
220,
220,
220,
220,
41876,
1988,
3911,
26173,
8924,
705,
1314,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
66,
62,
4598,
310,
88,
220,
220,
220,
220,
41876,
1988,
3911,
26173,
8924,
705,
35,
57,
4458,
628,
220,
42865,
300,
83,
62,
9186,
34178,
308,
83,
62,
9186,
13,
198,
220,
42865,
300,
83,
62,
2256,
34178,
308,
83,
62,
2256,
13,
628,
220,
300,
83,
62,
2256,
796,
308,
83,
62,
2256,
13,
198,
220,
300,
83,
62,
9186,
796,
308,
83,
62,
9186,
13,
198,
198,
9,
220,
767,
14,
17,
198,
220,
16876,
308,
86,
62,
1370,
3180,
5626,
3268,
2043,
12576,
13,
198,
220,
220,
220,
16876,
308,
86,
62,
1370,
12,
3245,
62,
16,
36529,
308,
66,
62,
746,
13,
198,
220,
220,
220,
220,
220,
5550,
2538,
9328,
300,
83,
62,
2256,
33411,
2205,
62,
17618,
10635,
308,
86,
62,
1370,
12,
3245,
62,
22,
13,
198,
220,
220,
220,
220,
220,
5550,
2538,
9328,
300,
83,
62,
9186,
33411,
2205,
62,
17618,
10635,
308,
86,
62,
1370,
12,
3245,
62,
22,
13,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
16876,
308,
86,
62,
1370,
12,
3245,
62,
16,
36529,
308,
66,
62,
30094,
13,
198,
220,
220,
220,
220,
220,
5550,
2538,
9328,
300,
83,
62,
2256,
33411,
2205,
62,
17618,
10635,
308,
86,
62,
1370,
12,
3245,
62,
17,
13,
198,
220,
220,
220,
220,
220,
5550,
2538,
9328,
300,
83,
62,
9186,
33411,
2205,
62,
17618,
10635,
308,
86,
62,
1370,
12,
3245,
62,
17,
13,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
23578,
5064,
13,
628,
220,
30301,
1503,
25,
308,
86,
62,
2256,
11,
308,
86,
62,
9186,
13,
198,
220,
311,
9863,
300,
83,
62,
2256,
11050,
2205,
62,
17618,
22196,
34,
10619,
2751,
13,
198,
220,
17579,
3185,
5161,
300,
83,
62,
2256,
39319,
308,
86,
62,
2256,
13,
198,
220,
220,
220,
300,
85,
62,
8658,
4178,
796,
827,
12,
8658,
844,
13,
198,
220,
220,
220,
311,
9863,
300,
83,
62,
9186,
11050,
2205,
62,
17618,
22196,
34,
10619,
2751,
13,
198,
220,
220,
220,
17579,
3185,
5161,
300,
83,
62,
9186,
39319,
308,
86,
62,
9186,
33411,
2205,
62,
17618,
796,
308,
86,
62,
2256,
12,
15390,
62,
17618,
13,
198,
220,
220,
220,
220,
220,
300,
85,
62,
8658,
844,
796,
827,
12,
8658,
844,
13,
198,
220,
220,
220,
220,
220,
5161,
12682,
2205,
62,
17618,
13,
366,
2488,
10594,
691,
307,
22542,
1752,
329,
477,
783,
1627,
3709,
13,
685,
2257,
7227,
5161,
60,
628,
220,
220,
220,
220,
220,
220,
220,
30301,
1503,
25,
308,
86,
62,
25677,
11,
1627,
62,
66,
429,
11,
308,
86,
62,
330,
67,
11216,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1627,
62,
66,
429,
796,
352,
13,
198,
220,
220,
220,
220,
220,
220,
220,
4526,
10913,
44011,
25,
308,
83,
62,
23317,
4743,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
83,
62,
23317,
6015,
85,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
83,
62,
23317,
19290,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
83,
62,
34415,
17287,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
83,
62,
22213,
5142,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
83,
62,
2302,
3004,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
83,
62,
7783,
13,
628,
220,
220,
220,
220,
220,
220,
220,
20832,
43679,
308,
83,
62,
9186,
39319,
308,
86,
62,
9186,
24413,
6369
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*"* use this source file for your ABAP unit test classes
CLASS ltcl_project DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA: project TYPE REF TO zcl_project,
task TYPE REF TO zcl_project_task.
METHODS:
setup,
assert_project_status_is IMPORTING i_status TYPE i,
status_of_inital_project_is_0 FOR TESTING RAISING cx_static_check,
status_of_done_project_is_100 FOR TESTING RAISING cx_static_check,
status_with_half_tasks_done_50 FOR TESTING RAISING cx_static_check,
project_done_closes_subtasks FOR TESTING RAISING cx_static_check,
add_new_task_to_project
RETURNING
VALUE(r_task) TYPE REF TO zcl_project_task.
ENDCLASS.
CLASS ltcl_project IMPLEMENTATION.
METHOD setup.
CLEAR task.
CREATE OBJECT project
EXPORTING
i_title = 'My Project'.
ENDMETHOD.
METHOD assert_project_status_is.
cl_abap_unit_assert=>assert_equals( exp = i_status act = project->calculate_status( ) ).
ENDMETHOD.
METHOD status_of_inital_project_is_0.
assert_project_status_is( 0 ).
ENDMETHOD.
METHOD status_of_done_project_is_100.
project->mark_as_done( ).
assert_project_status_is( 100 ).
ENDMETHOD.
METHOD status_with_half_tasks_done_50.
add_new_task_to_project( ).
task = add_new_task_to_project( ).
task->mark_as_done( ).
assert_project_status_is( 50 ).
ENDMETHOD.
METHOD add_new_task_to_project.
CREATE OBJECT r_task
EXPORTING
i_title = 'Some Task'.
project->add( r_task ).
ENDMETHOD.
METHOD project_done_closes_subtasks.
task = add_new_task_to_project( ).
project->mark_as_done( ).
cl_abap_unit_assert=>assert_equals( exp = 100 act = task->calculate_status( ) ).
ENDMETHOD.
ENDCLASS.
| [
9,
1,
9,
779,
428,
2723,
2393,
329,
534,
9564,
2969,
4326,
1332,
6097,
198,
31631,
300,
83,
565,
62,
16302,
5550,
20032,
17941,
25261,
7473,
43001,
2751,
198,
220,
360,
4261,
6234,
6006,
9863,
198,
220,
45698,
42,
49277,
43638,
5805,
7597,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
25,
1628,
41876,
4526,
37,
5390,
1976,
565,
62,
16302,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4876,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
16302,
62,
35943,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
9058,
11,
198,
220,
220,
220,
220,
220,
6818,
62,
16302,
62,
13376,
62,
271,
30023,
9863,
2751,
1312,
62,
13376,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
3722,
62,
1659,
62,
259,
1287,
62,
16302,
62,
271,
62,
15,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
11,
198,
220,
220,
220,
220,
220,
3722,
62,
1659,
62,
28060,
62,
16302,
62,
271,
62,
3064,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
11,
198,
220,
220,
220,
220,
220,
3722,
62,
4480,
62,
13959,
62,
83,
6791,
62,
28060,
62,
1120,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
11,
198,
220,
220,
220,
220,
220,
1628,
62,
28060,
62,
565,
4629,
62,
7266,
83,
6791,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
11,
198,
220,
220,
220,
220,
220,
751,
62,
3605,
62,
35943,
62,
1462,
62,
16302,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
62,
35943,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
16302,
62,
35943,
13,
198,
10619,
31631,
13,
628,
198,
31631,
300,
83,
565,
62,
16302,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
9058,
13,
198,
220,
220,
220,
30301,
1503,
4876,
13,
198,
220,
220,
220,
29244,
6158,
25334,
23680,
1628,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
7839,
796,
705,
3666,
4935,
4458,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
6818,
62,
16302,
62,
13376,
62,
271,
13,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
4853,
874,
7,
1033,
796,
1312,
62,
13376,
719,
796,
1628,
3784,
9948,
3129,
378,
62,
13376,
7,
1267,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
3722,
62,
1659,
62,
259,
1287,
62,
16302,
62,
271,
62,
15,
13,
198,
220,
220,
220,
6818,
62,
16302,
62,
13376,
62,
271,
7,
657,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
3722,
62,
1659,
62,
28060,
62,
16302,
62,
271,
62,
3064,
13,
198,
220,
220,
220,
1628,
3784,
4102,
62,
292,
62,
28060,
7,
6739,
198,
220,
220,
220,
6818,
62,
16302,
62,
13376,
62,
271,
7,
1802,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
3722,
62,
4480,
62,
13959,
62,
83,
6791,
62,
28060,
62,
1120,
13,
198,
220,
220,
220,
751,
62,
3605,
62,
35943,
62,
1462,
62,
16302,
7,
6739,
198,
220,
220,
220,
4876,
796,
751,
62,
3605,
62,
35943,
62,
1462,
62,
16302,
7,
6739,
198,
220,
220,
220,
4876,
3784,
4102,
62,
292,
62,
28060,
7,
6739,
198,
220,
220,
220,
6818,
62,
16302,
62,
13376,
62,
271,
7,
2026,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
751,
62,
3605,
62,
35943,
62,
1462,
62,
16302,
13,
198,
220,
220,
220,
29244,
6158,
25334,
23680,
374,
62,
35943,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
7839,
796,
705,
4366,
15941,
4458,
198,
220,
220,
220,
1628,
3784,
2860,
7,
374,
62,
35943,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1628,
62,
28060,
62,
565,
4629,
62,
7266,
83,
6791,
13,
198,
220,
220,
220,
4876,
796,
751,
62,
3605,
62,
35943,
62,
1462,
62,
16302,
7,
6739,
198,
220,
220,
220,
1628,
3784,
4102,
62,
292,
62,
28060,
7,
6739,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
4853,
874,
7,
1033,
796,
1802,
719,
796,
4876,
3784,
9948,
3129,
378,
62,
13376,
7,
1267,
6739,
198,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_ioc_container DEFINITION
PUBLIC
CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS:
get_instance
RETURNING
VALUE(instance) TYPE REF TO zcl_ioc_container.
METHODS:
register
IMPORTING
!interface_name TYPE string
!class_name TYPE string
RAISING
zcx_ioc_container,
deregister
IMPORTING
!interface_name TYPE string OPTIONAL,
register_instance
IMPORTING
!interface_name TYPE string
!instance TYPE REF TO object,
deregister_instance
IMPORTING
!interface_name TYPE string OPTIONAL,
resolve
IMPORTING
!interface_name TYPE string
RETURNING
VALUE(new_object) TYPE REF TO object.
PRIVATE SECTION.
TYPES:
BEGIN OF ts_mapping_table.
TYPES interface_name TYPE string.
TYPES class_name TYPE string.
TYPES END OF ts_mapping_table.
TYPES:
tt_mapping_table TYPE HASHED TABLE OF ts_mapping_table
WITH UNIQUE KEY interface_name.
TYPES:
BEGIN OF ts_instance_mapping_table.
TYPES interface_name TYPE string.
TYPES object_reference TYPE REF TO object.
TYPES END OF ts_instance_mapping_table.
TYPES:
tt_instance_mapping_table TYPE HASHED TABLE OF ts_instance_mapping_table
WITH UNIQUE KEY interface_name.
CONSTANTS:
constructor_name TYPE string VALUE `CONSTRUCTOR`,
ioc_container_name TYPE string VALUE `ZCL_IOC_CONTAINER`.
CLASS-DATA:
container TYPE REF TO zcl_ioc_container.
DATA:
mapping_table TYPE tt_mapping_table,
instance_mapping_table TYPE tt_instance_mapping_table.
METHODS:
assert_creation_possible
IMPORTING
!class_name TYPE string
RETURNING
VALUE(object_descriptor) TYPE REF TO cl_abap_objectdescr
RAISING
zcx_ioc_container,
assert_obj_creation_possible
IMPORTING
!type_descriptor TYPE REF TO cl_abap_typedescr
RETURNING
VALUE(object_descriptor) TYPE REF TO cl_abap_objectdescr
RAISING
zcx_ioc_container,
check_create_private
IMPORTING
!type_descriptor TYPE REF TO cl_abap_typedescr
RAISING
zcx_ioc_container,
check_not_instantiatable
IMPORTING
!object_descriptor TYPE REF TO cl_abap_objectdescr
RAISING
zcx_ioc_container,
get_parameter_descriptor
IMPORTING
!object_descriptor TYPE REF TO cl_abap_objectdescr
!parameter_name TYPE abap_parmname
RETURNING
VALUE(parameter_descriptor) TYPE REF TO cl_abap_datadescr,
get_parameter_type_name
IMPORTING
!parameter_descriptor TYPE REF TO cl_abap_datadescr
RETURNING
VALUE(parameter_type_name) TYPE string,
get_registered_mapping
IMPORTING
!interface_name TYPE string
RETURNING
VALUE(class_name) TYPE string,
get_registered_object
IMPORTING
!interface_name TYPE string
RETURNING
VALUE(registered_object) TYPE REF TO object,
get_type_descriptor
IMPORTING
!class_name TYPE string
RETURNING
VALUE(type_descriptor) TYPE REF TO cl_abap_typedescr.
ENDCLASS.
CLASS ZCL_IOC_CONTAINER IMPLEMENTATION.
METHOD assert_creation_possible.
DATA(type_descriptor) = get_type_descriptor( class_name ).
IF type_descriptor IS NOT BOUND.
RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>error_in_type_determination ).
ENDIF.
object_descriptor = assert_obj_creation_possible( type_descriptor ).
ENDMETHOD.
METHOD assert_obj_creation_possible.
check_create_private( type_descriptor ).
object_descriptor = CAST cl_abap_objectdescr( type_descriptor ).
check_not_instantiatable( object_descriptor ).
ENDMETHOD.
METHOD check_create_private.
DATA(class_descriptor) = CAST cl_abap_classdescr( type_descriptor ).
IF class_descriptor->create_visibility NE cl_abap_objectdescr=>public.
DATA(friends) = class_descriptor->get_friend_types( ).
LOOP AT friends ASSIGNING FIELD-SYMBOL(<friend>).
IF <friend>->get_relative_name( ) EQ ioc_container_name.
RETURN.
ENDIF.
ENDLOOP.
RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>class_is_create_private ).
ENDIF.
ENDMETHOD.
METHOD check_not_instantiatable.
IF object_descriptor->is_instantiatable( ) NE abap_true.
RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>object_is_not_instantiatable ).
ENDIF.
ENDMETHOD.
METHOD deregister.
IF interface_name IS SUPPLIED.
DELETE TABLE mapping_table
WITH TABLE KEY interface_name = to_upper( interface_name ).
ELSE.
CLEAR mapping_table[].
ENDIF.
ENDMETHOD.
METHOD deregister_instance.
IF interface_name IS SUPPLIED.
DELETE TABLE instance_mapping_table
WITH TABLE KEY interface_name = to_upper( interface_name ).
ELSE.
CLEAR instance_mapping_table[].
ENDIF.
ENDMETHOD.
METHOD get_instance.
IF container IS NOT BOUND.
container = NEW #( ).
ENDIF.
instance = container.
ENDMETHOD.
METHOD get_parameter_descriptor.
object_descriptor->get_method_parameter_type(
EXPORTING
p_method_name = constructor_name
p_parameter_name = parameter_name
RECEIVING
p_descr_ref = parameter_descriptor
EXCEPTIONS
OTHERS = 1
).
IF sy-subrc IS NOT INITIAL.
" This should not happen as the method and parameter names
" are returned from the object descriptor
CLEAR parameter_descriptor.
ENDIF.
ENDMETHOD.
METHOD get_parameter_type_name.
IF parameter_descriptor->kind EQ cl_abap_typedescr=>kind_ref.
DATA(reference_descriptor) = CAST cl_abap_refdescr( parameter_descriptor ).
DATA(referenced_type) = reference_descriptor->get_referenced_type( ).
IF referenced_type->kind EQ cl_abap_typedescr=>kind_class.
DATA(parameter_obj_descriptor) = CAST cl_abap_objectdescr( referenced_type ).
parameter_type_name = parameter_obj_descriptor->get_relative_name( ).
ELSEIF referenced_type->kind EQ cl_abap_typedescr=>kind_intf.
DATA(interface_descriptor) = CAST cl_abap_intfdescr( referenced_type ).
parameter_type_name = interface_descriptor->get_relative_name( ).
ENDIF.
ELSE.
parameter_type_name = parameter_descriptor->get_relative_name( ).
ENDIF.
ENDMETHOD.
METHOD get_registered_mapping.
class_name = VALUE #(
mapping_table[
interface_name = to_upper( interface_name )
]-class_name DEFAULT to_upper( interface_name ) ).
ENDMETHOD.
METHOD get_registered_object.
registered_object = VALUE #( instance_mapping_table[
interface_name = to_upper( interface_name )
]-object_reference OPTIONAL ).
ENDMETHOD.
METHOD get_type_descriptor.
cl_abap_classdescr=>describe_by_name(
EXPORTING
p_name = to_upper( class_name )
RECEIVING
p_descr_ref = type_descriptor
EXCEPTIONS
OTHERS = 1
).
IF sy-subrc IS NOT INITIAL.
CLEAR type_descriptor.
ENDIF.
ENDMETHOD.
METHOD register.
assert_creation_possible( to_upper( class_name ) ).
ASSIGN mapping_table[ interface_name = to_upper( interface_name ) ]
TO FIELD-SYMBOL(<mapping>).
IF <mapping> IS ASSIGNED.
<mapping>-class_name = to_upper( class_name ).
ELSE.
INSERT VALUE #(
interface_name = to_upper( interface_name )
class_name = to_upper( class_name )
) INTO TABLE mapping_table.
ENDIF.
ENDMETHOD.
METHOD register_instance.
ASSIGN instance_mapping_table[ interface_name = to_upper( interface_name ) ]
TO FIELD-SYMBOL(<instance_mapping>).
IF <instance_mapping> IS ASSIGNED.
<instance_mapping>-object_reference = instance.
ELSE.
INSERT VALUE #(
interface_name = to_upper( interface_name )
object_reference = instance
) INTO TABLE instance_mapping_table.
ENDIF.
ENDMETHOD.
METHOD resolve.
CHECK interface_name IS NOT INITIAL.
new_object = get_registered_object( interface_name ).
IF new_object IS BOUND.
RETURN.
ENDIF.
DATA(class_name) = get_registered_mapping( interface_name ).
DATA(type_descriptor) = get_type_descriptor( class_name ).
IF type_descriptor IS NOT BOUND
OR type_descriptor->kind NE cl_abap_typedescr=>kind_class.
RETURN.
ENDIF.
TRY.
DATA(object_descriptor) = assert_obj_creation_possible( type_descriptor ).
CATCH zcx_ioc_container.
RETURN.
ENDTRY.
DATA(constructor) = VALUE #( object_descriptor->methods[
name = constructor_name
] OPTIONAL ).
IF lines( constructor-parameters ) GT 0.
DATA: ref TYPE REF TO data.
FIELD-SYMBOLS: <fs> TYPE any.
DATA(parameter_tab) = VALUE abap_parmbind_tab( ).
LOOP AT constructor-parameters INTO DATA(constructor_parameter).
UNASSIGN <fs>.
DATA(parameter_descriptor) = get_parameter_descriptor(
object_descriptor = object_descriptor
parameter_name = constructor_parameter-name
).
IF parameter_descriptor IS NOT BOUND.
" This should not happen as the method and parameter names
" are returned from the object descriptor
CONTINUE.
ENDIF.
DATA(parameter_type_name) = get_parameter_type_name( parameter_descriptor ).
IF constructor_parameter-type_kind EQ cl_abap_typedescr=>typekind_oref.
CREATE DATA ref TYPE REF TO (parameter_type_name).
ASSIGN ref->* TO <fs>.
<fs> ?= resolve( parameter_type_name ).
ELSE.
CREATE DATA ref TYPE (parameter_type_name).
ASSIGN ref->* TO <fs>.
ENDIF.
IF constructor_parameter-is_optional EQ abap_true
AND ( <fs> IS NOT ASSIGNED OR <fs> IS INITIAL ).
" Optional parameters that are "null" can be skipped
CONTINUE.
ENDIF.
INSERT VALUE #(
name = constructor_parameter-name
kind = cl_abap_objectdescr=>exporting
value = REF #( <fs> )
) INTO TABLE parameter_tab.
ENDLOOP.
CREATE OBJECT new_object
TYPE (class_name)
PARAMETER-TABLE parameter_tab.
ELSE.
CREATE OBJECT new_object
TYPE (class_name).
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
72,
420,
62,
34924,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
4810,
3824,
6158,
13,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
25,
198,
220,
220,
220,
220,
220,
651,
62,
39098,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
39098,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
72,
420,
62,
34924,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
7881,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
39994,
62,
3672,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
4871,
62,
3672,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
72,
420,
62,
34924,
11,
198,
220,
220,
220,
220,
220,
390,
30238,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
39994,
62,
3672,
41876,
4731,
39852,
2849,
1847,
11,
198,
220,
220,
220,
220,
220,
7881,
62,
39098,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
39994,
62,
3672,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
39098,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
2134,
11,
198,
220,
220,
220,
220,
220,
390,
30238,
62,
39098,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
39994,
62,
3672,
41876,
4731,
39852,
2849,
1847,
11,
198,
220,
220,
220,
220,
220,
10568,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
39994,
62,
3672,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
3605,
62,
15252,
8,
41876,
4526,
37,
5390,
2134,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
40379,
62,
76,
5912,
62,
11487,
13,
198,
220,
220,
220,
24412,
47,
1546,
220,
220,
7071,
62,
3672,
220,
41876,
4731,
13,
198,
220,
220,
220,
24412,
47,
1546,
220,
220,
1398,
62,
3672,
220,
220,
220,
220,
220,
41876,
4731,
13,
198,
220,
220,
220,
24412,
47,
1546,
23578,
3963,
40379,
62,
76,
5912,
62,
11487,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
256,
83,
62,
76,
5912,
62,
11487,
41876,
367,
11211,
1961,
43679,
3963,
40379,
62,
76,
5912,
62,
11487,
198,
220,
220,
220,
220,
220,
220,
220,
13315,
4725,
33866,
8924,
35374,
7071,
62,
3672,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
40379,
62,
39098,
62,
76,
5912,
62,
11487,
13,
198,
220,
220,
220,
24412,
47,
1546,
220,
220,
7071,
62,
3672,
220,
220,
220,
41876,
4731,
13,
198,
220,
220,
220,
24412,
47,
1546,
220,
220,
2134,
62,
35790,
220,
41876,
4526,
37,
5390,
2134,
13,
198,
220,
220,
220,
24412,
47,
1546,
23578,
3963,
40379,
62,
39098,
62,
76,
5912,
62,
11487,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
256,
83,
62,
39098,
62,
76,
5912,
62,
11487,
41876,
367,
11211,
1961,
43679,
3963,
40379,
62,
39098,
62,
76,
5912,
62,
11487,
198,
220,
220,
220,
220,
220,
220,
220,
13315,
4725,
33866,
8924,
35374,
7071,
62,
3672,
13,
628,
198,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
198,
220,
220,
220,
220,
220,
23772,
62,
3672,
220,
220,
41876,
4731,
26173,
8924,
4600,
10943,
46126,
1581,
47671,
198,
220,
220,
220,
220,
220,
1312,
420,
62,
34924,
62,
3672,
41876,
4731,
26173,
8924,
4600,
57,
5097,
62,
40,
4503,
62,
10943,
30339,
1137,
44646,
628,
220,
220,
220,
42715,
12,
26947,
25,
198,
220,
220,
220,
220,
220,
9290,
41876,
4526,
37,
5390,
1976,
565,
62,
72,
420,
62,
34924,
13,
628,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
16855,
62,
11487,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
256,
83,
62,
76,
5912,
62,
11487,
11,
198,
220,
220,
220,
220,
220,
4554,
62,
76,
5912,
62,
11487,
41876,
256,
83,
62,
39098,
62,
76,
5912,
62,
11487,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
6818,
62,
38793,
62,
79,
4733,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
4871,
62,
3672,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
15252,
62,
20147,
1968,
273,
8,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
15252,
20147,
81,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
72,
420,
62,
34924,
11,
628,
220,
220,
220,
220,
220,
6818,
62,
26801,
62,
38793,
62,
79,
4733,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
4906,
62,
20147,
1968,
273,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
774,
9124,
3798,
81,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
15252,
62,
20147,
1968,
273,
8,
41876,
4526,
37,
5390,
537,
62,
397
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class ZCL_EXCEL_ROWS definition
public
final
create public .
*"* public components of class ZCL_EXCEL_ROWS
*"* do not include other source files here!!!
*"* protected components of class ZABAP_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
public section.
types:
begin of MTY_S_HASHED_ROW,
ROW_INDEX type INT4,
ROW type ref to ZCL_EXCEL_ROW,
end of MTY_S_HASHED_ROW ,
MTY_TS_HASEHD_ROW type hashed table of MTY_S_HASHED_ROW with unique key ROW_INDEX.
methods ADD
importing
!IO_ROW type ref to ZCL_EXCEL_ROW .
methods CLEAR .
methods CONSTRUCTOR .
methods GET
importing
!IP_INDEX type I
returning
value(EO_ROW) type ref to ZCL_EXCEL_ROW .
methods GET_ITERATOR
returning
value(EO_ITERATOR) type ref to CL_OBJECT_COLLECTION_ITERATOR .
methods IS_EMPTY
returning
value(IS_EMPTY) type FLAG .
methods REMOVE
importing
!IO_ROW type ref to ZCL_EXCEL_ROW .
methods SIZE
returning
value(EP_SIZE) type I .
protected section.
*"* private components of class ZABAP_EXCEL_RANGES
*"* do not include other source files here!!!
private section.
data ROWS type ref to CL_OBJECT_COLLECTION .
data ROWS_HASEHD type MTY_TS_HASEHD_ROW .
ENDCLASS.
CLASS ZCL_EXCEL_ROWS IMPLEMENTATION.
method ADD.
data: LS_HASHED_ROW type MTY_S_HASHED_ROW.
LS_HASHED_ROW-ROW_INDEX = IO_ROW->GET_ROW_INDEX( ).
LS_HASHED_ROW-ROW = IO_ROW.
insert LS_HASHED_ROW into table ROWS_HASEHD.
ROWS->ADD( IO_ROW ).
endmethod. "ADD
method CLEAR.
clear ROWS_HASEHD.
ROWS->CLEAR( ).
endmethod. "CLEAR
method CONSTRUCTOR.
create object ROWS.
endmethod. "CONSTRUCTOR
method GET.
field-symbols: <LS_HASHED_ROW> type MTY_S_HASHED_ROW.
read table ROWS_HASEHD with key ROW_INDEX = IP_INDEX assigning <LS_HASHED_ROW>.
if SY-SUBRC = 0.
EO_ROW = <LS_HASHED_ROW>-ROW.
endif.
endmethod. "GET
method GET_ITERATOR.
EO_ITERATOR ?= ROWS->IF_OBJECT_COLLECTION~GET_ITERATOR( ).
endmethod. "GET_ITERATOR
method IS_EMPTY.
IS_EMPTY = ROWS->IF_OBJECT_COLLECTION~IS_EMPTY( ).
endmethod. "IS_EMPTY
method REMOVE.
delete table ROWS_HASEHD with table key ROW_INDEX = IO_ROW->GET_ROW_INDEX( ) .
ROWS->REMOVE( IO_ROW ).
endmethod. "REMOVE
method SIZE.
EP_SIZE = ROWS->IF_OBJECT_COLLECTION~SIZE( ).
endmethod. "SIZE
ENDCLASS.
| [
4871,
1168,
5097,
62,
6369,
34,
3698,
62,
49,
22845,
6770,
198,
220,
1171,
198,
220,
2457,
198,
220,
2251,
1171,
764,
198,
198,
9,
1,
9,
1171,
6805,
286,
1398,
1168,
5097,
62,
6369,
34,
3698,
62,
49,
22845,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
9,
1,
9,
6861,
6805,
286,
1398,
1168,
6242,
2969,
62,
6369,
34,
3698,
62,
33249,
9693,
36,
32716,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
1171,
2665,
13,
198,
220,
220,
220,
3858,
25,
198,
220,
220,
220,
220,
220,
2221,
286,
337,
9936,
62,
50,
62,
39,
11211,
1961,
62,
49,
3913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
371,
3913,
62,
12115,
6369,
2099,
17828,
19,
11,
198,
220,
220,
220,
220,
220,
220,
220,
371,
3913,
220,
220,
220,
220,
220,
220,
2099,
1006,
284,
1168,
5097,
62,
6369,
34,
3698,
62,
49,
3913,
11,
198,
220,
220,
220,
220,
220,
886,
286,
337,
9936,
62,
50,
62,
39,
11211,
1961,
62,
49,
3913,
837,
198,
220,
220,
220,
220,
220,
337,
9936,
62,
4694,
62,
39,
11159,
10227,
62,
49,
3913,
2099,
468,
704,
3084,
286,
337,
9936,
62,
50,
62,
39,
11211,
1961,
62,
49,
3913,
351,
3748,
1994,
371,
3913,
62,
12115,
6369,
13,
628,
220,
220,
220,
5050,
27841,
198,
220,
220,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
9399,
62,
49,
3913,
2099,
1006,
284,
1168,
5097,
62,
6369,
34,
3698,
62,
49,
3913,
764,
198,
220,
220,
220,
5050,
30301,
1503,
764,
198,
220,
220,
220,
5050,
7102,
46126,
1581,
764,
198,
220,
220,
220,
5050,
17151,
198,
220,
220,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
4061,
62,
12115,
6369,
220,
220,
220,
220,
2099,
314,
198,
220,
220,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
7,
4720,
62,
49,
3913,
8,
2099,
1006,
284,
1168,
5097,
62,
6369,
34,
3698,
62,
49,
3913,
764,
198,
220,
220,
220,
5050,
17151,
62,
2043,
1137,
25633,
198,
220,
220,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
7,
4720,
62,
2043,
1137,
25633,
8,
2099,
1006,
284,
7852,
62,
9864,
23680,
62,
25154,
16779,
2849,
62,
2043,
1137,
25633,
764,
198,
220,
220,
220,
5050,
3180,
62,
39494,
9936,
198,
220,
220,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
7,
1797,
62,
39494,
9936,
8,
2099,
9977,
4760,
764,
198,
220,
220,
220,
5050,
22657,
46,
6089,
198,
220,
220,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
9399,
62,
49,
3913,
2099,
1006,
284,
1168,
5097,
62,
6369,
34,
3698,
62,
49,
3913,
764,
198,
220,
220,
220,
5050,
311,
35400,
198,
220,
220,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
7,
8905,
62,
33489,
8,
2099,
314,
764,
198,
220,
6861,
2665,
13,
198,
9,
1,
9,
2839,
6805,
286,
1398,
1168,
6242,
2969,
62,
6369,
34,
3698,
62,
49,
15567,
1546,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
2839,
2665,
13,
628,
220,
220,
220,
1366,
371,
22845,
2099,
1006,
284,
7852,
62,
9864,
23680,
62,
25154,
16779,
2849,
764,
198,
220,
220,
220,
1366,
371,
22845,
62,
39,
11159,
10227,
2099,
337,
9936,
62,
4694,
62,
39,
11159,
10227,
62,
49,
3913,
764,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6369,
34,
3698,
62,
49,
22845,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
2446,
27841,
13,
198,
220,
220,
220,
1366,
25,
30948,
62,
39,
11211,
1961,
62,
49,
3913,
2099,
337,
9936,
62,
50,
62,
39,
11211,
1961,
62,
49,
3913,
13,
628,
220,
220,
220,
30948,
62,
39,
11211,
1961,
62,
49,
3913,
12,
49,
3913,
62,
12115,
6369,
796,
24418,
62,
49,
3913,
3784,
18851,
62,
49,
3913,
62,
12115,
6369,
7,
6739,
198,
220,
220,
220,
30948,
62,
39,
11211,
1961,
62,
49,
3913,
12,
49,
3913,
796,
24418,
62,
49,
3913,
13,
628,
220,
220,
220,
7550,
30948,
62,
39,
11211,
1961,
62,
49,
3913,
656,
3084,
371,
22845,
62,
39,
11159,
10227,
13,
628,
220,
220,
220,
371,
22845,
3784,
29266,
7,
24418,
62,
49,
3913,
6739,
198,
220,
886,
24396,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
29266,
628,
198,
220,
2446,
30301,
1503,
13,
198,
220,
220,
220,
1598,
371,
22845,
62,
39,
11159,
10227,
13,
198,
220,
220,
220,
371,
22845,
3784,
29931,
1503,
7,
6739,
198,
220,
886,
24396,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
29931,
1503,
628,
198,
220,
2446,
7102,
46126,
1581,
13,
628,
220,
220,
220,
2251,
2134,
371,
22845,
13,
628,
220,
886,
24396,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
10943,
46126,
1581,
628,
198,
220,
2446,
17151,
13,
198,
220,
220,
220,
2214,
12,
1837,
2022,
10220,
25,
1279,
6561,
62,
39,
11211,
1961,
62,
49,
3913,
29,
2099,
337,
9936,
62,
50,
62,
39,
11211,
1961,
62,
49,
3913,
13,
628,
220,
220,
220,
1100,
3084,
371,
22845,
62,
39,
11159,
10227,
351,
1994,
371,
3913,
62,
12115,
6369,
796,
6101,
62,
12115,
6369,
38875,
1279,
6561,
62,
39,
11211,
1961,
62,
49,
3913,
28401,
198,
220,
220,
220,
611,
19704,
12,
50,
10526,
7397,
796,
657,
13,
198,
220,
220,
220,
220,
220,
412,
46,
62,
49,
3913,
796,
1279,
6561,
62,
39,
11211,
1961,
62,
49,
3913,
29,
12,
49,
3913,
13,
198,
220,
220,
220,
45762,
13,
198,
220,
886,
24396,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18851,
628,
198,
220,
2446,
17151,
62,
2043,
1137,
25633,
13,
198,
220,
220,
220,
412,
46,
62,
2043,
1137
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
program ztest.
class my_name_factory definition final.
public section.
class-methods get_greeting
importing
name type string
returning
value(rv_greeting) type string.
DATA mv_counter TYPE i.
endclass.
class my_name_factory implementation.
method get_greeting.
add 1 to mv_counter.
rv_greeting = |Hello { name }|.
endmethod.
endclass.
start-of-selection.
data lv_greeting type string.
lv_greeting = my_name_factory=>get_greeting( 'Abaper' ). " this is very long string
write: / lv_greeting.
| [
23065,
1976,
9288,
13,
198,
198,
4871,
616,
62,
3672,
62,
69,
9548,
6770,
2457,
13,
198,
220,
1171,
2665,
13,
198,
220,
220,
220,
1398,
12,
24396,
82,
651,
62,
70,
2871,
278,
198,
220,
220,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
2099,
4731,
198,
220,
220,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
7,
81,
85,
62,
70,
2871,
278,
8,
2099,
4731,
13,
198,
220,
220,
220,
42865,
285,
85,
62,
24588,
41876,
1312,
13,
198,
437,
4871,
13,
198,
4871,
616,
62,
3672,
62,
69,
9548,
7822,
13,
198,
220,
2446,
651,
62,
70,
2871,
278,
13,
198,
220,
220,
751,
352,
284,
285,
85,
62,
24588,
13,
198,
220,
220,
374,
85,
62,
70,
2871,
278,
796,
930,
15496,
1391,
1438,
1782,
91,
13,
198,
220,
886,
24396,
13,
198,
437,
4871,
13,
198,
198,
9688,
12,
1659,
12,
49283,
13,
198,
220,
1366,
300,
85,
62,
70,
2871,
278,
2099,
4731,
13,
198,
220,
300,
85,
62,
70,
2871,
278,
796,
616,
62,
3672,
62,
69,
9548,
14804,
1136,
62,
70,
2871,
278,
7,
705,
4826,
2136,
6,
6739,
366,
428,
318,
845,
890,
4731,
198,
220,
3551,
25,
1220,
300,
85,
62,
70,
2871,
278,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
"! <h1>API for Deleting a Travel</h1>
"!
"! <p>
"! Function module to delete a single Travel instance.
"! It will also delete all related subnodes of Booking and Booking Supplement.
"! </p>
"!
"! @parameter iv_travel_id | ID of the Travel to be deleted
"! @parameter et_messages | Table of occurred messages
"!
FUNCTION /DMO/FLIGHT_TRAVEL_DELETE00.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_TRAVEL_ID) TYPE /DMO/TRAVEL_ID00
*" EXPORTING
*" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY00=>TT_MESSAGE
*"----------------------------------------------------------------------
CLEAR et_messages.
/dmo/cl_flight_legacy00=>get_instance( )->delete_travel( EXPORTING iv_travel_id = iv_travel_id
IMPORTING et_messages = DATA(lt_messages) ).
/dmo/cl_flight_legacy00=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages
IMPORTING et_messages = et_messages ).
ENDFUNCTION.
| [
40484,
1279,
71,
16,
29,
17614,
329,
42226,
889,
257,
13524,
3556,
71,
16,
29,
198,
40484,
198,
40484,
1279,
79,
29,
198,
40484,
15553,
8265,
284,
12233,
257,
2060,
13524,
4554,
13,
198,
40484,
632,
481,
635,
12233,
477,
3519,
850,
77,
4147,
286,
4897,
278,
290,
4897,
278,
23150,
13,
198,
40484,
7359,
79,
29,
198,
40484,
198,
40484,
2488,
17143,
2357,
21628,
62,
35927,
62,
312,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
4522,
286,
262,
13524,
284,
307,
13140,
198,
40484,
2488,
17143,
2357,
2123,
62,
37348,
1095,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
8655,
286,
5091,
6218,
198,
40484,
198,
42296,
4177,
2849,
1220,
35,
11770,
14,
3697,
9947,
62,
51,
3861,
18697,
62,
7206,
2538,
9328,
405,
13,
198,
9,
1,
10097,
23031,
198,
9,
1,
9,
1,
14565,
26491,
25,
198,
9,
1,
220,
30023,
9863,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
3824,
62,
51,
3861,
18697,
62,
2389,
8,
41876,
220,
1220,
35,
11770,
14,
51,
3861,
18697,
62,
2389,
405,
198,
9,
1,
220,
7788,
15490,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
2767,
62,
44,
1546,
4090,
48075,
8,
41876,
220,
1220,
35,
11770,
14,
5064,
62,
3697,
9947,
62,
2538,
38,
43300,
405,
14804,
15751,
62,
44,
1546,
4090,
8264,
198,
9,
1,
10097,
23031,
198,
220,
30301,
1503,
2123,
62,
37348,
1095,
13,
628,
220,
1220,
67,
5908,
14,
565,
62,
22560,
62,
1455,
1590,
405,
14804,
1136,
62,
39098,
7,
1267,
3784,
33678,
62,
35927,
7,
7788,
15490,
2751,
21628,
62,
35927,
62,
312,
796,
21628,
62,
35927,
62,
312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
2123,
62,
37348,
1095,
220,
796,
42865,
7,
2528,
62,
37348,
1095,
8,
6739,
628,
220,
1220,
67,
5908,
14,
565,
62,
22560,
62,
1455,
1590,
405,
14804,
1136,
62,
39098,
7,
1267,
3784,
1102,
1851,
62,
37348,
1095,
7,
7788,
15490,
2751,
340,
62,
37348,
1095,
796,
300,
83,
62,
37348,
1095,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
2123,
62,
37348,
1095,
796,
2123,
62,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_object_fugr DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_program FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PRIVATE SECTION.
TYPES: ty_rs38l_incl_tt TYPE STANDARD TABLE OF rs38l_incl WITH DEFAULT KEY.
TYPES: BEGIN OF ty_function,
funcname TYPE rs38l_fnam,
global_flag TYPE rs38l-global,
remote_call TYPE rs38l-remote,
update_task TYPE rs38l-utask,
short_text TYPE tftit-stext,
remote_basxml TYPE rs38l-basxml_enabled,
import TYPE STANDARD TABLE OF rsimp WITH DEFAULT KEY,
changing TYPE STANDARD TABLE OF rscha WITH DEFAULT KEY,
export TYPE STANDARD TABLE OF rsexp WITH DEFAULT KEY,
tables TYPE STANDARD TABLE OF rstbl WITH DEFAULT KEY,
exception TYPE STANDARD TABLE OF rsexc WITH DEFAULT KEY,
documentation TYPE STANDARD TABLE OF rsfdo WITH DEFAULT KEY,
exception_classes TYPE abap_bool,
END OF ty_function.
TYPES: ty_function_tt TYPE STANDARD TABLE OF ty_function WITH DEFAULT KEY.
METHODS main_name
RETURNING VALUE(rv_program) TYPE program
RAISING zcx_abapgit_exception.
METHODS functions
RETURNING VALUE(rt_functab) TYPE ty_rs38l_incl_tt
RAISING zcx_abapgit_exception.
METHODS includes
RETURNING VALUE(rt_includes) TYPE rso_t_objnm
RAISING zcx_abapgit_exception.
METHODS serialize_functions
RETURNING VALUE(rt_functions) TYPE ty_function_tt
RAISING zcx_abapgit_exception.
METHODS deserialize_functions
IMPORTING it_functions TYPE ty_function_tt
RAISING zcx_abapgit_exception.
METHODS serialize_xml
IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_output
RAISING zcx_abapgit_exception.
METHODS deserialize_xml
IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_input
iv_package TYPE devclass
RAISING zcx_abapgit_exception.
METHODS serialize_includes
RAISING zcx_abapgit_exception.
METHODS deserialize_includes
IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_input
iv_package TYPE devclass
RAISING zcx_abapgit_exception.
METHODS are_exceptions_class_based
IMPORTING iv_function_name TYPE rs38l_fnam
RETURNING VALUE(rv_return) TYPE abap_bool
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_FUGR IMPLEMENTATION.
METHOD are_exceptions_class_based.
DATA:
lt_dokumentation TYPE TABLE OF funct,
lt_exception_list TYPE TABLE OF rsexc,
lt_export_parameter TYPE TABLE OF rsexp,
lt_import_parameter TYPE TABLE OF rsimp,
lt_tables_parameter TYPE TABLE OF rstbl.
CALL FUNCTION 'FUNCTION_IMPORT_DOKU'
EXPORTING
funcname = iv_function_name
IMPORTING
exception_class = rv_return
TABLES
dokumentation = lt_dokumentation
exception_list = lt_exception_list
export_parameter = lt_export_parameter
import_parameter = lt_import_parameter
tables_parameter = lt_tables_parameter
EXCEPTIONS
error_message = 1
function_not_found = 2
invalid_name = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from FUNCTION_IMPORT_DOKU' ).
ENDIF.
ENDMETHOD.
METHOD deserialize_functions.
DATA: lv_include TYPE rs38l-include,
lv_area TYPE rs38l-area,
lv_group TYPE rs38l-area,
lv_namespace TYPE rs38l-namespace,
lt_source TYPE TABLE OF abaptxt255.
FIELD-SYMBOLS: <ls_func> LIKE LINE OF it_functions.
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from FUNCTION_INCLUDE_SPLIT' ).
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from FUNCTION_DELETE' ).
ENDIF.
ENDIF.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_group
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
update_task = <ls_func>-update_task
exception_class = <ls_func>-exception_classes
namespace = lv_namespace
remote_basxml_supported = <ls_func>-remote_basxml
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |error from RS_FUNCTIONMODULE_INSERT: {
sy-subrc } { sy-msgid }{ sy-msgno }| ).
ENDIF.
INSERT REPORT lv_include FROM lt_source.
ENDLOOP.
ENDMETHOD. "deserialize_functions
METHOD deserialize_includes.
DATA: lo_xml TYPE REF TO zcl_abapgit_xml_input,
ls_progdir TYPE ty_progdir,
lt_includes TYPE rso_t_objnm,
lt_tpool TYPE textpool_table,
lt_tpool_ext TYPE zif_abapgit_definitions=>ty_tpool_tt,
lt_source TYPE TABLE OF abaptxt255.
FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes.
tadir_insert( iv_package ).
io_xml->read( EXPORTING iv_name = 'INCLUDES'
CHANGING cg_data = lt_includes ).
LOOP AT lt_includes ASSIGNING <lv_include>.
lt_source = mo_files->read_abap( iv_extra = <lv_include> ).
lo_xml = mo_files->read_xml( <lv_include> ).
lo_xml->read( EXPORTING iv_name = 'PROGDIR'
CHANGING cg_data = ls_progdir ).
lo_xml->read( EXPORTING iv_name = 'TPOOL'
CHANGING cg_data = lt_tpool_ext ).
lt_tpool = read_tpool( lt_tpool_ext ).
deserialize_program( is_progdir = ls_progdir
it_source = lt_source
it_tpool = lt_tpool
iv_package = iv_package ).
deserialize_textpool( iv_program = <lv_include>
it_tpool = lt_tpool
iv_is_include = abap_true ).
ENDLOOP.
ENDMETHOD. "deserialize_includes
METHOD deserialize_xml.
DATA: lv_complete TYPE rs38l-area,
lv_namespace TYPE rs38l-namespace,
lv_areat TYPE tlibt-areat,
lv_stext TYPE tftit-stext,
lv_group TYPE rs38l-area.
lv_complete = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_complete
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
include_not_exists = 1
group_not_exists = 2
no_selections = 3
no_function_include = 4
no_function_pool = 5
delimiter_wrong_position = 6
no_customer_function_group = 7
no_customer_function_include = 8
reserved_name_customer = 9
namespace_too_long = 10
area_length_error = 11
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from FUNCTION_INCLUDE_SPLIT' ).
ENDIF.
io_xml->read( EXPORTING iv_name = 'AREAT'
CHANGING cg_data = lv_areat ).
lv_stext = lv_areat.
CALL FUNCTION 'RS_FUNCTION_POOL_INSERT'
EXPORTING
function_pool = lv_group
short_text = lv_stext
namespace = lv_namespace
devclass = iv_package
EXCEPTIONS
name_already_exists = 1
name_not_correct = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
undefined_error = 11
OTHERS = 12.
IF sy-subrc <> 0 AND sy-subrc <> 1 AND sy-subrc <> 3.
* todo, change description
zcx_abapgit_exception=>raise( 'error from RS_FUNCTION_POOL_INSERT' ).
ENDIF.
ENDMETHOD. "deserialize_xml
METHOD functions.
DATA: lv_area TYPE rs38l-area.
lv_area = ms_item-obj_name.
CALL FUNCTION 'RS_FUNCTION_POOL_CONTENTS'
EXPORTING
function_pool = lv_area
TABLES
functab = rt_functab
EXCEPTIONS
function_pool_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RS_FUNCTION_POOL_CONTENTS' ).
ENDIF.
SORT rt_functab BY funcname ASCENDING.
DELETE ADJACENT DUPLICATES FROM rt_functab COMPARING funcname.
ENDMETHOD. "functions
METHOD includes.
TYPES: BEGIN OF ty_reposrc,
progname TYPE reposrc-progname,
cnam TYPE reposrc-cnam,
END OF ty_reposrc.
DATA: lt_reposrc TYPE STANDARD TABLE OF ty_reposrc WITH DEFAULT KEY,
ls_reposrc LIKE LINE OF lt_reposrc,
lv_program TYPE program,
lv_offset_ns TYPE i,
lv_tabix LIKE sy-tabix,
lt_functab TYPE ty_rs38l_incl_tt.
FIELD-SYMBOLS: <lv_include> LIKE LINE OF rt_includes,
<ls_func> LIKE LINE OF lt_functab.
lv_program = main_name( ).
lt_functab = functions( ).
CALL FUNCTION 'RS_GET_ALL_INCLUDES'
EXPORTING
program = lv_program
* WITH_RESERVED_INCLUDES =
* WITH_CLASS_INCLUDES = ' ' hmm, todo
TABLES
includetab = rt_includes
EXCEPTIONS
not_existent = 1
no_program = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RS_GET_ALL_INCLUDES' ).
ENDIF.
LOOP AT lt_functab ASSIGNING <ls_func>.
DELETE TABLE rt_includes FROM <ls_func>-include.
ENDLOOP.
* handle generated maintenance views
APPEND INITIAL LINE TO rt_includes ASSIGNING <lv_include>.
IF ms_item-obj_name(1) <> '/'.
"FGroup name does not contain a namespace
<lv_include> = |L{ ms_item-obj_name }T00|.
ELSE.
"FGroup name contains a namespace
lv_offset_ns = find( val = ms_item-obj_name+1 sub = '/' ).
lv_offset_ns = lv_offset_ns + 2.
<lv_include> = |{ ms_item-obj_name(lv_offset_ns) }L{ ms_item-obj_name+lv_offset_ns }T00|.
ENDIF.
IF lines( rt_includes ) > 0.
SELECT progname cnam FROM reposrc
INTO TABLE lt_reposrc
FOR ALL ENTRIES IN rt_includes
WHERE progname = rt_includes-table_line
AND r3state = 'A'.
SORT lt_reposrc BY progname ASCENDING.
ENDIF.
LOOP AT rt_includes ASSIGNING <lv_include>.
lv_tabix = sy-tabix.
* skip SAP standard includes and also make sure the include exists
READ TABLE lt_reposrc INTO ls_reposrc
WITH KEY progname = <lv_include> BINARY SEARCH.
IF sy-subrc <> 0 OR ls_reposrc-cnam = 'SAP'.
DELETE rt_includes INDEX lv_tabix.
ENDIF.
ENDLOOP.
APPEND lv_program TO rt_includes.
ENDMETHOD. "includes
METHOD main_name.
DATA: lv_area TYPE rs38l-area,
lv_namespace TYPE rs38l-namespace,
lv_group TYPE rs38l-area.
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
include_not_exists = 1
group_not_exists = 2
no_selections = 3
no_function_include = 4
no_function_pool = 5
delimiter_wrong_position = 6
no_customer_function_group = 7
no_customer_function_include = 8
reserved_name_customer = 9
namespace_too_long = 10
area_length_error = 11
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from FUNCTION_INCLUDE_SPLIT' ).
ENDIF.
CONCATENATE lv_namespace 'SAPL' lv_group INTO rv_program.
ENDMETHOD. "main_name
METHOD serialize_functions.
DATA:
lt_source TYPE TABLE OF rssource,
lt_functab TYPE ty_rs38l_incl_tt,
lt_new_source TYPE rsfb_source,
ls_function LIKE LINE OF rt_functions.
FIELD-SYMBOLS: <ls_func> LIKE LINE OF lt_functab.
lt_functab = functions( ).
LOOP AT lt_functab ASSIGNING <ls_func>.
* fm RPY_FUNCTIONMODULE_READ does not support source code
* lines longer than 72 characters
CLEAR ls_function.
MOVE-CORRESPONDING <ls_func> TO ls_function.
CLEAR lt_new_source.
CLEAR lt_source.
CALL FUNCTION 'RPY_FUNCTIONMODULE_READ_NEW'
EXPORTING
functionname = <ls_func>-funcname
IMPORTING
global_flag = ls_function-global_flag
remote_call = ls_function-remote_call
update_task = ls_function-update_task
short_text = ls_function-short_text
remote_basxml_supported = ls_function-remote_basxml
TABLES
import_parameter = ls_function-import
changing_parameter = ls_function-changing
export_parameter = ls_function-export
tables_parameter = ls_function-tables
exception_list = ls_function-exception
documentation = ls_function-documentation
source = lt_source
CHANGING
new_source = lt_new_source
EXCEPTIONS
error_message = 1
function_not_found = 2
invalid_name = 3
OTHERS = 4.
IF sy-subrc = 2.
CONTINUE.
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RPY_FUNCTIONMODULE_READ_NEW' ).
ENDIF.
ls_function-exception_classes = are_exceptions_class_based( <ls_func>-funcname ).
APPEND ls_function TO rt_functions.
IF NOT lt_new_source IS INITIAL.
mo_files->add_abap( iv_extra = <ls_func>-funcname
it_abap = lt_new_source ).
ELSE.
mo_files->add_abap( iv_extra = <ls_func>-funcname
it_abap = lt_source ).
ENDIF.
ENDLOOP.
ENDMETHOD. "serialize_functions
METHOD serialize_includes.
DATA: lt_includes TYPE rso_t_objnm.
FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes.
lt_includes = includes( ).
LOOP AT lt_includes ASSIGNING <lv_include>.
* todo, filename is not correct, a include can be used in several programs
serialize_program( is_item = ms_item
io_files = mo_files
iv_program = <lv_include>
iv_extra = <lv_include> ).
ENDLOOP.
ENDMETHOD. "serialize_includes
METHOD serialize_xml.
DATA: lt_includes TYPE rso_t_objnm,
lv_areat TYPE tlibt-areat.
SELECT SINGLE areat INTO lv_areat
FROM tlibt
WHERE spras = mv_language
AND area = ms_item-obj_name. "#EC CI_GENBUFF "#EC CI_SUBRC
lt_includes = includes( ).
io_xml->add( iv_name = 'AREAT'
ig_data = lv_areat ).
io_xml->add( iv_name = 'INCLUDES'
ig_data = lt_includes ).
ENDMETHOD. "serialize_xml
METHOD zif_abapgit_object~changed_by.
TYPES: BEGIN OF ty_stamps,
user TYPE xubname,
date TYPE d,
time TYPE t,
END OF ty_stamps.
DATA: lt_stamps TYPE STANDARD TABLE OF ty_stamps WITH DEFAULT KEY,
lv_program TYPE program,
lt_includes TYPE rso_t_objnm.
FIELD-SYMBOLS: <ls_stamp> LIKE LINE OF lt_stamps,
<lv_include> LIKE LINE OF lt_includes.
lv_program = main_name( ).
CALL FUNCTION 'RS_GET_ALL_INCLUDES'
EXPORTING
program = lv_program
TABLES
includetab = lt_includes
EXCEPTIONS
not_existent = 1
no_program = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RS_GET_ALL_INCLUDES' ).
ENDIF.
SELECT unam AS user udat AS date utime AS time FROM reposrc
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
WHERE progname = lv_program
AND r3state = 'A'. "#EC CI_SUBRC
LOOP AT lt_includes ASSIGNING <lv_include>.
SELECT unam AS user udat AS date utime AS time FROM reposrc
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
WHERE progname = <lv_include>
AND r3state = 'A'. "#EC CI_SUBRC
ENDLOOP.
SELECT unam AS user udat AS date utime AS time FROM repotext " Program text pool
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
WHERE progname = lv_program
AND r3state = 'A'. "#EC CI_SUBRC
SELECT vautor AS user vdatum AS date vzeit AS time FROM eudb " GUI
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
WHERE relid = 'CU'
AND name = lv_program
AND srtf2 = 0 ##TOO_MANY_ITAB_FIELDS.
* Screens: username not stored in D020S database table
SORT lt_stamps BY date DESCENDING time DESCENDING.
READ TABLE lt_stamps INDEX 1 ASSIGNING <ls_stamp>.
IF sy-subrc = 0.
rv_user = <ls_stamp>-user.
ELSE.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~compare_to_remote_version.
CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_area TYPE rs38l-area.
lv_area = ms_item-obj_name.
CALL FUNCTION 'RS_FUNCTION_POOL_DELETE'
EXPORTING
area = lv_area
suppress_popups = abap_true
skip_progress_ind = abap_true
EXCEPTIONS
canceled_in_corr = 1
enqueue_system_failure = 2
function_exist = 3
not_executed = 4
no_modify_permission = 5
no_show_permission = 6
permission_failure = 7
pool_not_exist = 8
cancelled = 9
OTHERS = 10.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from RS_FUNCTION_POOL_DELETE' ).
ENDIF.
ENDMETHOD. "delete
METHOD zif_abapgit_object~deserialize.
DATA: lv_program_name TYPE programm,
lt_functions TYPE ty_function_tt,
lt_dynpros TYPE ty_dynpro_tt,
ls_cua TYPE ty_cua.
deserialize_xml(
io_xml = io_xml
iv_package = iv_package ).
io_xml->read( EXPORTING iv_name = 'FUNCTIONS'
CHANGING cg_data = lt_functions ).
deserialize_functions( lt_functions ).
deserialize_includes(
io_xml = io_xml
iv_package = iv_package ).
lv_program_name = main_name( ).
io_xml->read( EXPORTING iv_name = 'DYNPROS'
CHANGING cg_data = lt_dynpros ).
deserialize_dynpros( it_dynpros = lt_dynpros ).
io_xml->read( EXPORTING iv_name = 'CUA'
CHANGING cg_data = ls_cua ).
deserialize_cua( iv_program_name = lv_program_name
is_cua = ls_cua ).
ENDMETHOD. "deserialize
METHOD zif_abapgit_object~exists.
DATA: lv_pool TYPE tlibg-area.
lv_pool = ms_item-obj_name.
CALL FUNCTION 'RS_FUNCTION_POOL_EXISTS'
EXPORTING
function_pool = lv_pool
EXCEPTIONS
pool_not_exists = 1.
rv_bool = boolc( sy-subrc <> 1 ).
ENDMETHOD. "zif_abapgit_object~exists
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD. "zif_abapgit_object~get_metadata
METHOD zif_abapgit_object~has_changed_since.
DATA: lt_functab TYPE ty_rs38l_incl_tt,
lt_includes TYPE rso_t_objnm.
FIELD-SYMBOLS: <ls_func> LIKE LINE OF lt_functab,
<lv_include_name> LIKE LINE OF lt_includes.
lt_includes = includes( ). " Main prog also included here
LOOP AT lt_includes ASSIGNING <lv_include_name>.
rv_changed = check_prog_changed_since(
iv_program = <lv_include_name>
iv_timestamp = iv_timestamp ).
IF rv_changed = abap_true.
RETURN.
ENDIF.
ENDLOOP.
lt_functab = functions( ).
LOOP AT lt_functab ASSIGNING <ls_func>.
rv_changed = check_prog_changed_since(
iv_program = <ls_func>-include
iv_timestamp = iv_timestamp ).
IF rv_changed = abap_true.
RETURN.
ENDIF.
ENDLOOP.
ENDMETHOD. "zif_abapgit_object~has_changed_since
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW'
object_name = ms_item-obj_name
object_type = 'FUGR'
in_new_window = abap_true.
ENDMETHOD. "jump
METHOD zif_abapgit_object~serialize.
* function group SEUF
* function group SIFP
* function group SUNI
DATA: lt_functions TYPE ty_function_tt,
ls_progdir TYPE ty_progdir,
lv_program_name TYPE programm,
lt_dynpros TYPE ty_dynpro_tt,
ls_cua TYPE ty_cua.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
serialize_xml( io_xml ).
lt_functions = serialize_functions( ).
io_xml->add( iv_name = 'FUNCTIONS'
ig_data = lt_functions ).
serialize_includes( ).
lv_program_name = main_name( ).
ls_progdir = read_progdir( lv_program_name ).
IF ls_progdir-subc = 'F'.
lt_dynpros = serialize_dynpros( lv_program_name ).
io_xml->add( iv_name = 'DYNPROS'
ig_data = lt_dynpros ).
ls_cua = serialize_cua( lv_program_name ).
io_xml->add( iv_name = 'CUA'
ig_data = ls_cua ).
ENDIF.
ENDMETHOD. "serialize
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
69,
1018,
81,
5550,
20032,
17941,
44731,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
23065,
25261,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
15252,
13,
198,
220,
220,
220,
8355,
43429,
1546,
6941,
62,
16624,
7473,
1976,
361,
62,
397,
499,
18300,
62,
15252,
93,
5908,
62,
16624,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
1259,
62,
3808,
2548,
75,
62,
259,
565,
62,
926,
41876,
49053,
9795,
43679,
3963,
44608,
2548,
75,
62,
259,
565,
13315,
5550,
38865,
35374,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
8818,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25439,
3672,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
62,
69,
7402,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3298,
62,
32109,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
20541,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6569,
62,
13345,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
47960,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4296,
62,
35943,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
315,
2093,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1790,
62,
5239,
220,
220,
220,
220,
220,
220,
220,
41876,
256,
701,
270,
12,
301,
2302,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6569,
62,
12093,
19875,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
12093,
19875,
62,
25616,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1330,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
44608,
11011,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5609,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
44608,
11693,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10784,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
8044,
79,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8893,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
301,
2436,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6631,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
8044,
66,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10314,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
28202,
4598,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6631,
62,
37724,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
8818,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
1259,
62,
8818,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
8818,
13315,
5550,
38865,
35374,
13,
628,
220,
220,
220,
337,
36252,
50,
1388,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
23065,
8,
41876,
1430,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
5499,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
17034,
62,
12543,
310,
397,
8,
41876,
1259,
62,
3808,
2548,
75,
62,
259,
565,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
3407,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
17034,
62,
42813,
8,
41876,
374,
568,
62,
83,
62,
26801,
21533,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
11389,
1096,
62,
12543,
2733,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
17034,
62,
12543,
2733,
8,
41876,
1259,
62,
8818,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
748,
48499,
1096,
62,
12543,
2733,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
340,
62,
12543,
2733,
41876,
1259,
62,
8818,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
11389,
1096,
62,
19875,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
33245,
62,
19875,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
19875,
62,
22915,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
748,
48499,
1096,
62,
19875,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
33245,
62,
19875,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
19875,
62,
15414,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26495,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& Report z_generate_json_schema
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_generate_json_schema.
CLASS lcl_generator_helper DEFINITION
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
CLASS-METHODS: generate
IMPORTING generate_schema TYPE abap_bool
interface_name TYPE tadir-obj_name
type_name TYPE tadir-obj_name
RETURNING VALUE(result) TYPE string
RAISING zcx_aff_tools.
PRIVATE SECTION.
CLASS-METHODS get_format_version
IMPORTING interface_name TYPE tadir-obj_name
RETURNING VALUE(result) TYPE i.
CLASS-METHODS get_object_type_path
IMPORTING interface_name TYPE tadir-obj_name
RETURNING VALUE(path) TYPE string.
ENDCLASS.
CLASS lcl_generator_helper IMPLEMENTATION.
METHOD generate.
DATA(absolute_name) = |\\INTERFACE={ interface_name }\\TYPE={ type_name }|.
cl_abap_typedescr=>describe_by_name( EXPORTING p_name = absolute_name RECEIVING p_descr_ref = DATA(type_description) EXCEPTIONS type_not_found = 1 ).
IF sy-subrc = 1.
RAISE EXCEPTION NEW zcx_aff_tools( ).
ENDIF.
DATA element_description TYPE REF TO cl_abap_structdescr.
element_description ?= type_description.
DATA field TYPE REF TO data.
FIELD-SYMBOLS <field> TYPE any.
CREATE DATA field TYPE HANDLE element_description.
ASSIGN field->* TO <field>.
DATA my_type TYPE REF TO data.
GET REFERENCE OF <field> INTO my_type.
ASSIGN my_type->* TO <field>.
DATA(format_version) = get_format_version( interface_name ).
DATA(object_type_path) = get_object_type_path( interface_name ).
DATA(schema_id) = |https://github.com/SAP/abap-file-formats/blob/main/file-formats/{ object_type_path }-v{ format_version }.json| ##NO_TEXT.
DATA writer TYPE REF TO zcl_aff_writer.
" set up the writer
IF generate_schema = abap_true.
writer = NEW zcl_aff_writer_json_schema( schema_id = schema_id format_version = format_version ).
ELSE.
writer = NEW zcl_aff_writer_xslt( ).
ENDIF.
DATA(generator) = NEW zcl_aff_generator( writer ).
DATA(result_table) = generator->generate_type( <field> ).
CONCATENATE LINES OF result_table INTO result SEPARATED BY cl_abap_char_utilities=>newline.
ENDMETHOD.
METHOD get_format_version.
DATA format_version TYPE string.
SPLIT interface_name AT '_' INTO TABLE DATA(splitted_intfname).
DATA(last) = splitted_intfname[ lines( splitted_intfname ) ].
REPLACE ALL OCCURRENCES OF 'V' IN last WITH ''.
TRY.
DATA(regx) = '[[:alpha:]]+'.
* check if the token only contains digits
DATA(contains_chars) = xsdbool( count( val = last regex = regx ) > 0 ) ##REGEX_POSIX.
DATA(default_format_version) = 1.
IF contains_chars = abap_false.
format_version = last.
ELSE.
format_version = default_format_version.
ENDIF.
CATCH cx_sy_conversion_no_number.
format_version = default_format_version.
ENDTRY.
result = CONV #( format_version ).
ENDMETHOD.
METHOD get_object_type_path.
SPLIT interface_name AT '_' INTO TABLE DATA(splitted_intfname).
DATA(object_type) = splitted_intfname[ lines( splitted_intfname ) - 1 ].
DATA(main_object_type) = object_type.
IF object_type = 'REPS' OR object_type = 'FUNC'.
main_object_type = 'FUGR'.
ENDIF.
path = |{ to_lower( main_object_type ) }/{ to_lower( object_type ) }|.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
PARAMETERS:
p_schema TYPE c RADIOBUTTON GROUP sel USER-COMMAND upd DEFAULT 'X',
p_xslt TYPE c RADIOBUTTON GROUP sel ##NEEDED,
p_intf TYPE tadir-obj_name,
p_type TYPE tadir-obj_name DEFAULT 'ty_main'.
TRY.
DATA(xslt_content) = lcl_generator_helper=>generate( generate_schema = p_schema interface_name = to_upper( p_intf ) type_name = to_upper( p_type ) ).
cl_demo_output=>display( xslt_content ).
CATCH zcx_aff_tools INTO DATA(exception).
cl_demo_output=>display( exception->get_text( ) ).
ENDTRY.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
6358,
1976,
62,
8612,
378,
62,
17752,
62,
15952,
2611,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
198,
9,
5,
10097,
30934,
9,
198,
2200,
15490,
1976,
62,
8612,
378,
62,
17752,
62,
15952,
2611,
13,
198,
31631,
300,
565,
62,
8612,
1352,
62,
2978,
525,
5550,
20032,
17941,
198,
25261,
198,
29244,
6158,
44731,
13,
198,
220,
44731,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
25,
7716,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
7716,
62,
15952,
2611,
41876,
450,
499,
62,
30388,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7071,
62,
3672,
220,
41876,
36264,
343,
12,
26801,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2099,
62,
3672,
220,
220,
220,
220,
220,
220,
41876,
36264,
343,
12,
26801,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
20274,
8,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
2001,
62,
31391,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
651,
62,
18982,
62,
9641,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
7071,
62,
3672,
41876,
36264,
343,
12,
26801,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
20274,
8,
220,
41876,
1312,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
651,
62,
15252,
62,
4906,
62,
6978,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
7071,
62,
3672,
41876,
36264,
343,
12,
26801,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
6978,
8,
220,
220,
220,
41876,
4731,
13,
198,
198,
10619,
31631,
13,
198,
198,
31631,
300,
565,
62,
8612,
1352,
62,
2978,
525,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
7716,
13,
198,
220,
220,
220,
42865,
7,
48546,
62,
3672,
8,
796,
930,
6852,
41358,
49836,
34758,
7071,
62,
3672,
1782,
6852,
25216,
34758,
2099,
62,
3672,
1782,
91,
13,
628,
220,
220,
220,
537,
62,
397,
499,
62,
774,
9124,
3798,
81,
14804,
20147,
4892,
62,
1525,
62,
3672,
7,
7788,
15490,
2751,
279,
62,
3672,
796,
4112,
62,
3672,
19644,
36,
3824,
2751,
279,
62,
20147,
81,
62,
5420,
796,
42865,
7,
4906,
62,
11213,
8,
7788,
42006,
11053,
2099,
62,
1662,
62,
9275,
796,
352,
6739,
198,
220,
220,
220,
16876,
827,
12,
7266,
6015,
796,
352,
13,
198,
220,
220,
220,
220,
220,
17926,
24352,
7788,
42006,
2849,
12682,
1976,
66,
87,
62,
2001,
62,
31391,
7,
6739,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
42865,
5002,
62,
11213,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
7249,
20147,
81,
13,
198,
220,
220,
220,
5002,
62,
11213,
5633,
28,
2099,
62,
11213,
13,
198,
220,
220,
220,
42865,
2214,
41876,
4526,
37,
5390,
1366,
13,
198,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
1279,
3245,
29,
41876,
597,
13,
198,
220,
220,
220,
29244,
6158,
42865,
2214,
41876,
367,
6981,
2538,
5002,
62,
11213,
13,
198,
220,
220,
220,
24994,
16284,
2214,
3784,
9,
5390,
1279,
3245,
28401,
198,
220,
220,
220,
42865,
616,
62,
4906,
41876,
4526,
37,
5390,
1366,
13,
198,
220,
220,
220,
17151,
4526,
24302,
18310,
3963,
1279,
3245,
29,
39319,
616,
62,
4906,
13,
628,
220,
220,
220,
24994,
16284,
616,
62,
4906,
3784,
9,
5390,
1279,
3245,
28401,
628,
220,
220,
220,
42865,
7,
18982,
62,
9641,
8,
796,
651,
62,
18982,
62,
9641,
7,
7071,
62,
3672,
6739,
198,
220,
220,
220,
42865,
7,
15252,
62,
4906,
62,
6978,
8,
796,
651,
62,
15252,
62,
4906,
62,
6978,
7,
7071,
62,
3672,
6739,
198,
220,
220,
220,
42865,
7,
15952,
2611,
62,
312,
8,
796,
930,
5450,
1378,
12567,
13,
785,
14,
50,
2969,
14,
397,
499,
12,
7753,
12,
687,
1381,
14,
2436,
672,
14,
12417,
14,
7753,
12,
687,
1381,
14,
90,
2134,
62,
4906,
62,
6978,
1782,
12,
85,
90,
5794,
62,
9641,
1782,
13,
17752,
91,
22492,
15285,
62,
32541,
13,
628,
198,
220,
220,
220,
42865,
6260,
41876,
4526,
37,
5390,
1976,
565,
62,
2001,
62,
16002,
13,
198,
220,
220,
220,
366,
900,
510,
262,
6260,
198,
220,
220,
220,
16876,
7716,
62,
15952,
2611,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
220,
220,
6260,
796,
12682,
1976,
565,
62,
2001,
62,
16002,
62,
17752,
62,
15952,
2611,
7,
32815,
62,
312,
796,
32815,
62,
312,
5794,
62,
9641,
796,
5794,
62,
9641,
6739,
198,
220,
220,
220,
17852,
5188,
13,
198,
220,
220,
220,
220,
220,
6260,
796,
12682,
1976,
565,
62,
2001,
62,
16002,
62,
34223,
2528,
7,
6739,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
42865,
7,
8612,
1352,
8,
796,
12682,
1976,
565,
62,
2001,
62,
8612,
1352,
7,
6260,
6739,
198,
220,
220,
220,
42865,
7,
20274,
62,
11487,
8,
796,
17301,
3784,
8612,
378,
62,
4906,
7,
1279,
3245,
29,
6739,
198,
220,
220,
220,
39962,
1404,
1677,
6158,
43277,
1546,
3963,
1255,
62,
11487,
39319,
1255,
7946,
27082,
11617,
11050,
537,
62,
397,
499,
62,
10641,
62,
315,
2410,
14804,
3605,
1370,
13,
628,
220,
23578,
49273,
13,
628,
220,
337,
36252,
651,
62,
18982,
62,
9641,
13,
198,
220,
220,
220,
42865,
5794,
62,
9641,
41876,
4731,
13,
198,
220,
220,
220,
46341,
2043,
7071,
62,
3672,
220,
5161,
705,
62,
6,
39319,
43679,
42865,
7,
22018,
2175,
62,
600,
69,
3672,
737,
198,
220,
220,
220,
42865,
7,
12957,
8,
796,
4328,
2175,
62,
600,
69,
3672,
58,
3951,
7,
4328,
2175,
62,
600,
69,
3672,
1267,
20740,
198,
220,
220,
220,
45285,
11598,
11096,
440,
4093,
31302,
24181,
1546,
3963,
705,
53,
6,
3268,
938,
13315,
705,
4458,
198,
220,
220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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
interface ZIF_UITB_EXCEPTION_MESSAGE
public .
methods PRINT
importing
!IV_MSG_TYPE type SY-MSGTY default 'S'
!IV_DISPLAY_TYPE type SY-MSGTY default 'E'
!IF_TO_SCREEN type ABAP_BOOL default ABAP_TRUE
returning
value(RV_MESSAGE) type STRING .
methods GET_MESSAGE
returning
value(RESULT) type STRING .
endinterface.
| [
39994,
1168,
5064,
62,
52,
2043,
33,
62,
6369,
42006,
2849,
62,
44,
1546,
4090,
8264,
198,
220,
1171,
764,
628,
198,
220,
5050,
4810,
12394,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
5653,
38,
62,
25216,
2099,
19704,
12,
5653,
38,
9936,
4277,
705,
50,
6,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
26288,
31519,
62,
25216,
2099,
19704,
12,
5653,
38,
9936,
4277,
705,
36,
6,
198,
220,
220,
220,
220,
220,
5145,
5064,
62,
10468,
62,
6173,
2200,
1677,
2099,
9564,
2969,
62,
8202,
3535,
4277,
9564,
2969,
62,
5446,
8924,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
49,
53,
62,
44,
1546,
4090,
8264,
8,
2099,
19269,
2751,
764,
198,
220,
5050,
17151,
62,
44,
1546,
4090,
8264,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
19535,
16724,
8,
2099,
19269,
2751,
764,
198,
437,
39994,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
REPORT yp_docking.
CLASS lcl_events DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
on_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive,
on_after_user_command FOR EVENT after_user_command OF cl_gui_alv_grid
IMPORTING e_ucomm,
on_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column es_row_no.
ENDCLASS.
TYPES: gvt_rowcolor TYPE c LENGTH 4,
BEGIN OF gst_list.
INCLUDE TYPE bkpf.
TYPES: rowcolor TYPE gvt_rowcolor,
END OF gst_list.
CONSTANTS c_selected_row TYPE gvt_rowcolor VALUE 'C600'.
TABLES: bkpf, bseg, t001.
DATA: gt_list TYPE TABLE OF gst_list,
go_dock TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE TEXT-s01.
SELECT-OPTIONS s_budat FOR bkpf-budat.
SELECTION-SCREEN END OF BLOCK b01.
INITIALIZATION.
PERFORM initialize.
START-OF-SELECTION.
PERFORM retrieve_data.
END-OF-SELECTION.
CALL SCREEN 0001.
FORM initialize.
* SELECT 'I' AS sign, 'EQ' AS option, MAX( budat ) AS low "7.40
* FROM bkpf INTO TABLE @s_budat. "7.40
SELECT MAX( budat ) FROM bkpf INTO s_budat-low. "7.02
s_budat-sign = 'I'. "7.02
s_budat-option = 'EQ'. "7.02
APPEND s_budat. "7.02
ENDFORM.
FORM retrieve_data.
SELECT * FROM bkpf INTO TABLE gt_list
WHERE budat IN s_budat.
ENDFORM.
MODULE pbo OUTPUT.
* DATA(title) = sy-title. "7.40
DATA title TYPE sy-title. "7.02
title = sy-title. "7.02
SET TITLEBAR 'TITLE' WITH title.
SET PF-STATUS 'STATUS'.
PERFORM display_grid.
ENDMODULE.
MODULE pai INPUT.
CASE sy-ucomm.
WHEN 'BACK'. SET SCREEN 0.
WHEN 'EXIT'. LEAVE PROGRAM.
WHEN 'CANC'. LEAVE PROGRAM.
WHEN 'PREV'. PERFORM change_selection USING '-'.
WHEN 'NEXT'. PERFORM change_selection USING '+'.
ENDCASE.
ENDMODULE.
FORM display_grid.
DATA lt_fcat TYPE lvc_t_fcat.
IF go_grid IS NOT BOUND.
CREATE OBJECT go_dock
EXPORTING
side = cl_gui_docking_container=>dock_at_bottom
extension = 150
lifetime = cl_gui_control=>lifetime_dynpro
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
CREATE OBJECT go_grid
EXPORTING
i_lifetime = cl_gui_control=>lifetime_dynpro
i_parent = go_dock
i_appl_events = abap_true "Triggers PAI/PBO on alv events
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
PERFORM build_fcat USING gt_list CHANGING lt_fcat.
PERFORM change_fcat CHANGING lt_fcat.
SET HANDLER lcl_events=>on_toolbar FOR go_grid.
SET HANDLER lcl_events=>on_after_user_command FOR go_grid.
SET HANDLER lcl_events=>on_double_click FOR go_grid.
DATA ls_layo TYPE lvc_s_layo. "7.02
ls_layo-cwidth_opt = abap_true. "7.02
ls_layo-sel_mode = ''. "7.02
ls_layo-info_fname = 'ROWCOLOR'. "7.02
go_grid->set_table_for_first_display(
EXPORTING
* is_layout = VALUE #( cwidth_opt = abap_true "7.40
* sel_mode = '' "7.40
* info_fname = 'ROWCOLOR' ) "7.40
is_layout = ls_layo "7.02
CHANGING
it_outtab = gt_list
it_fieldcatalog = lt_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 ).
ELSE.
DATA ls_stbl TYPE lvc_s_stbl. "7.02
ls_stbl-row = abap_true. "7.02
ls_stbl-col = abap_true. "7.02
go_grid->refresh_table_display(
EXPORTING
* is_stable = VALUE #( row = abap_true col = abap_true ) "7.40
is_stable = ls_stbl "7.02
EXCEPTIONS
finished = 1
OTHERS = 2 ).
ENDIF.
ENDFORM.
FORM build_fcat USING it_list TYPE ANY TABLE
CHANGING ct_fcat TYPE lvc_t_fcat.
DATA lo_salv TYPE REF TO cl_salv_table. "7.02
cl_salv_table=>factory(
IMPORTING
* r_salv_table = DATA(lo_salv) "7.40
r_salv_table = lo_salv "7.02
CHANGING
t_table = it_list ).
ct_fcat = cl_salv_controller_metadata=>get_lvc_fieldcatalog(
r_columns = lo_salv->get_columns( )
r_aggregations = lo_salv->get_aggregations( ) ).
FIELD-SYMBOLS <ls_fcat> LIKE LINE OF ct_fcat. "7.02
* LOOP AT ct_fcat ASSIGNING FIELD-SYMBOL(<ls_fcat>). "7.40
LOOP AT ct_fcat ASSIGNING <ls_fcat>. "7.02
<ls_fcat>-no_sign = abap_false.
ENDLOOP.
ENDFORM.
FORM change_fcat CHANGING ct_fcat TYPE lvc_t_fcat.
DEFINE change_text.
<ls_fcat>-scrtext_s = <ls_fcat>-scrtext_m = <ls_fcat>-scrtext_l = <ls_fcat>-reptext = &1.
END-OF-DEFINITION.
FIELD-SYMBOLS <ls_fcat> LIKE LINE OF ct_fcat. "7.02
* LOOP AT ct_fcat ASSIGNING FIELD-SYMBOL(<ls_fcat>). "7.40
LOOP AT ct_fcat ASSIGNING <ls_fcat>. "7.02
CASE <ls_fcat>-fieldname.
WHEN 'MANDT'. <ls_fcat>-tech = abap_true.
WHEN 'GJAHR'. change_text 'Year'(c01).
ENDCASE.
ENDLOOP.
ENDFORM.
CLASS lcl_events IMPLEMENTATION.
METHOD on_toolbar.
PERFORM add_buttons USING e_object e_interactive.
ENDMETHOD.
METHOD on_after_user_command.
CASE e_ucomm.
WHEN 'FILT'. PERFORM set_filter.
WHEN 'CLFL'. PERFORM clear_filter.
ENDCASE.
ENDMETHOD.
METHOD on_double_click.
PERFORM color_line USING es_row_no-row_id.
PERFORM retrieve_detail USING es_row_no-row_id.
ENDMETHOD.
ENDCLASS.
FORM add_buttons USING io_object TYPE REF TO cl_alv_event_toolbar_set
ip_interactive TYPE char01.
* APPEND VALUE #( function = 'FILT' "7.40
* butn_type = 0 "7.40
* icon = icon_filter "7.40
* quickinfo = 'Quick filter'(t01) "7.40
* text = 'Quick filter'(t01) ) TO io_object->mt_toolbar. "7.40
* APPEND VALUE #( function = 'CLFL' "7.40
* butn_type = 0 "7.40
* icon = icon_filter_undo "7.40
* quickinfo = 'Clear filter'(t02) "7.40
* text = 'Clear filter'(t02) ) TO io_object->mt_toolbar. "7.40
DATA ls_toolbar LIKE LINE OF io_object->mt_toolbar. "7.02
ls_toolbar-function = 'FILT'. "7.02
ls_toolbar-butn_type = 0. "7.02
ls_toolbar-icon = icon_filter. "7.02
ls_toolbar-quickinfo = 'Quick filter'(t01). "7.02
ls_toolbar-function = 'Quick filter'(t01). "7.02
APPEND ls_toolbar TO io_object->mt_toolbar. "7.02
ls_toolbar-function = 'CLFL'. "7.02
ls_toolbar-butn_type = 0. "7.02
ls_toolbar-icon = icon_filter_undo. "7.02
ls_toolbar-quickinfo = 'Clear filter'(t02). "7.02
ls_toolbar-function = 'Clear filter'(t02). "7.02
APPEND ls_toolbar TO io_object->mt_toolbar. "7.02
ENDFORM.
FORM set_filter.
DATA: lt_fields TYPE TABLE OF sval,
lv_rc TYPE c LENGTH 1,
lt_filt TYPE lvc_t_filt.
* lt_fields = VALUE #( ( tabname = 'BKPF' fieldname = 'BKTXT' ) ). "7.40
DATA ls_field LIKE LINE OF lt_fields. "7.02
ls_field-tabname = 'BKPF'. "7.02
ls_field-fieldname = 'BKTXT'. "7.02
APPEND ls_field TO lt_fields. "7.02
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
popup_title = TEXT-t01
IMPORTING
returncode = lv_rc
TABLES
fields = lt_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 2.
IF lv_rc = 'A'.
RETURN.
ENDIF.
FIELD-SYMBOLS <ls_field> LIKE LINE OF lt_fields. "7.02
DATA ls_filt LIKE LINE OF lt_filt. "7.02
* LOOP AT lt_fields ASSIGNING FIELD-SYMBOL(<ls_field>). "7.40
LOOP AT lt_fields ASSIGNING <ls_field>. "7.02
CHECK <ls_field>-value IS NOT INITIAL.
* APPEND VALUE #( fieldname = <ls_field>-fieldname "7.40
* sign = 'I' "7.40
* option = 'CP' "7.40
* low = |*{ <ls_field>-value }*| ) TO lt_filt. "7.40
ls_filt-fieldname = <ls_field>-fieldname. "7.02
ls_filt-sign = 'I'. "7.02
ls_filt-option = 'CP'. "7.02
ls_filt-low = |*{ <ls_field>-value }*|. "7.02
APPEND ls_filt TO lt_filt. "7.02
ENDLOOP.
go_grid->set_filter_criteria(
EXPORTING
it_filter = lt_filt
EXCEPTIONS
no_fieldcatalog_available = 1
OTHERS = 2 ).
go_grid->refresh_table_display(
EXCEPTIONS
finished = 1
OTHERS = 2 ).
ENDFORM.
FORM clear_filter.
DATA lt_filt TYPE lvc_t_filt.
go_grid->set_filter_criteria(
EXPORTING
it_filter = lt_filt
EXCEPTIONS
no_fieldcatalog_available = 1
OTHERS = 2 ).
go_grid->refresh_table_display(
EXCEPTIONS
finished = 1
OTHERS = 2 ).
ENDFORM.
FORM change_selection USING ip_direction.
* DATA(lv_tabix) = line_index( gt_list[ rowcolor = c_selected_row ] ). "7.40
DATA lv_tabix TYPE sy-tabix. "7.02
READ TABLE gt_list TRANSPORTING NO FIELDS WITH KEY rowcolor = c_selected_row. "7.02
lv_tabix = sy-tabix. "7.02
CASE ip_direction.
WHEN '-'.
IF lv_tabix = 1.
RETURN.
ENDIF.
SUBTRACT 1 FROM lv_tabix.
WHEN '+'.
IF lv_tabix = lines( gt_list ).
RETURN.
ENDIF.
ADD 1 TO lv_tabix.
ENDCASE.
PERFORM color_line USING lv_tabix.
PERFORM retrieve_detail USING lv_tabix.
ENDFORM.
FORM color_line USING ip_tabix.
DATA ls_list LIKE LINE OF gt_list.
MODIFY gt_list FROM ls_list TRANSPORTING rowcolor WHERE rowcolor IS NOT INITIAL.
ls_list-rowcolor = c_selected_row.
MODIFY gt_list FROM ls_list INDEX ip_tabix TRANSPORTING rowcolor.
DATA ls_stbl TYPE lvc_s_stbl. "7.02
ls_stbl-row = abap_true. "7.02
ls_stbl-col = abap_true. "7.02
go_grid->refresh_table_display(
EXPORTING
* is_stable = VALUE #( row = abap_true col = abap_true ) "7.40
is_stable = ls_stbl "7.02
EXCEPTIONS
finished = 1
OTHERS = 2 ).
ENDFORM.
FORM retrieve_detail USING ip_tabix.
DATA ls_bseg TYPE bseg.
CLEAR: bkpf, bseg, t001.
* ASSIGN gt_list[ ip_tabix ] TO FIELD-SYMBOL(<ls_list>). "7.40
FIELD-SYMBOLS <ls_list> LIKE LINE OF gt_list. "7.02
READ TABLE gt_list ASSIGNING <ls_list> INDEX ip_tabix. "7.02
SELECT dmbtr wrbtr
FROM bseg INTO CORRESPONDING FIELDS OF ls_bseg
WHERE bukrs = <ls_list>-bukrs
AND belnr = <ls_list>-belnr
AND gjahr = <ls_list>-gjahr
AND shkzg = 'S'.
ADD ls_bseg-wrbtr TO bseg-wrbtr.
ADD ls_bseg-dmbtr TO bseg-dmbtr.
ENDSELECT.
SELECT SINGLE bkpf~waers t001~waers
FROM bkpf
JOIN t001 ON t001~bukrs = bkpf~bukrs
INTO (bkpf-waers,t001-waers)
WHERE bkpf~bukrs = <ls_list>-bukrs
AND bkpf~belnr = <ls_list>-belnr
AND bkpf~gjahr = <ls_list>-gjahr.
ENDFORM.
| [
2200,
15490,
331,
79,
62,
67,
8629,
13,
198,
198,
31631,
300,
565,
62,
31534,
5550,
20032,
17941,
13,
198,
220,
44731,
44513,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
25,
198,
220,
220,
220,
220,
220,
319,
62,
25981,
5657,
7473,
49261,
50149,
3963,
537,
62,
48317,
62,
282,
85,
62,
25928,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
304,
62,
15252,
304,
62,
3849,
5275,
11,
198,
220,
220,
220,
220,
220,
319,
62,
8499,
62,
7220,
62,
21812,
7473,
49261,
706,
62,
7220,
62,
21812,
3963,
537,
62,
48317,
62,
282,
85,
62,
25928,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
304,
62,
84,
9503,
11,
198,
220,
220,
220,
220,
220,
319,
62,
23352,
62,
12976,
7473,
49261,
4274,
62,
12976,
3963,
537,
62,
48317,
62,
282,
85,
62,
25928,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
304,
62,
808,
304,
62,
28665,
1658,
62,
808,
62,
3919,
13,
198,
10619,
31631,
13,
198,
198,
9936,
47,
1546,
25,
308,
36540,
62,
808,
8043,
41876,
269,
406,
49494,
604,
11,
198,
220,
220,
220,
220,
220,
220,
347,
43312,
3963,
308,
301,
62,
4868,
13,
198,
220,
220,
220,
3268,
5097,
52,
7206,
41876,
275,
74,
79,
69,
13,
198,
9936,
47,
1546,
25,
5752,
8043,
41876,
308,
36540,
62,
808,
8043,
11,
198,
220,
220,
220,
220,
220,
220,
23578,
3963,
308,
301,
62,
4868,
13,
198,
198,
10943,
2257,
1565,
4694,
269,
62,
34213,
62,
808,
41876,
308,
36540,
62,
808,
8043,
26173,
8924,
705,
34,
8054,
4458,
198,
198,
5603,
9148,
1546,
25,
275,
74,
79,
69,
11,
275,
325,
70,
11,
256,
8298,
13,
198,
198,
26947,
25,
308,
83,
62,
4868,
41876,
43679,
3963,
308,
301,
62,
4868,
11,
198,
220,
220,
220,
220,
220,
467,
62,
67,
735,
41876,
4526,
37,
5390,
537,
62,
48317,
62,
67,
8629,
62,
34924,
11,
198,
220,
220,
220,
220,
220,
467,
62,
25928,
41876,
4526,
37,
5390,
537,
62,
48317,
62,
282,
85,
62,
25928,
13,
198,
198,
46506,
2849,
12,
6173,
2200,
1677,
347,
43312,
3963,
9878,
11290,
275,
486,
13315,
8782,
10067,
37977,
2538,
40383,
12,
82,
486,
13,
198,
46506,
12,
3185,
51,
11053,
264,
62,
65,
463,
265,
7473,
275,
74,
79,
69,
12,
65,
463,
265,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
23578,
3963,
9878,
11290,
275,
486,
13,
198,
198,
1268,
2043,
12576,
14887,
6234,
13,
198,
220,
19878,
21389,
41216,
13,
198,
198,
2257,
7227,
12,
19238,
12,
46506,
2849,
13,
198,
220,
19878,
21389,
19818,
62,
7890,
13,
198,
198,
10619,
12,
19238,
12,
46506,
2849,
13,
198,
220,
42815,
6374,
2200,
1677,
3571,
486,
13,
198,
198,
21389,
41216,
13,
198,
9,
220,
33493,
705,
40,
6,
7054,
1051,
11,
705,
36,
48,
6,
7054,
3038,
11,
25882,
7,
3600,
265,
1267,
7054,
1877,
366,
22,
13,
1821,
198,
9,
220,
220,
220,
16034,
275,
74,
79,
69,
39319,
43679,
2488,
82,
62,
65,
463,
265,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
22,
13,
1821,
198,
220,
33493,
25882,
7,
3600,
265,
1267,
16034,
220,
275,
74,
79,
69,
39319,
264,
62,
65,
463,
265,
12,
9319,
13,
220,
220,
220,
220,
220,
220,
220,
220,
366,
22,
13,
2999,
198,
220,
264,
62,
65,
463,
265,
12,
12683,
220,
220,
796,
705,
40,
4458,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
22,
13,
2999,
198,
220,
264,
62,
65,
463,
265,
12,
18076,
796,
705,
36,
48,
4458,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
22,
13,
2999,
198,
220,
43504,
10619,
264,
62,
65,
463,
265,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
22,
13,
2999,
198,
1677,
8068,
1581,
44,
13,
198,
198,
21389,
19818,
62,
7890,
13,
628,
220,
33493,
1635,
16034,
220,
275,
74,
79,
69,
39319,
43679,
308,
83,
62,
4868,
198,
220,
220,
220,
220,
220,
220,
220,
220,
33411,
220,
3600,
265,
3268,
264,
62,
65,
463,
265,
13,
198,
198,
1677,
8068,
1581,
44,
13,
198,
198,
33365,
24212,
279,
2127,
16289,
30076,
13,
198,
9,
220,
42865,
7,
7839,
8,
796,
827,
12,
7839,
13,
220,
366,
22,
13,
1821,
198,
220,
42865,
3670,
41876,
827,
12,
7839,
13,
366,
22,
13,
2999,
198,
220,
3670,
796,
827,
12,
7839,
13,
220,
220,
220,
220,
220,
220,
220,
220,
366,
22,
13,
2999,
198,
220,
25823,
37977,
2538,
33,
1503,
705,
49560,
2538,
6,
13315,
3670,
13,
198,
220,
25823,
28223,
12,
35744,
2937,
705,
35744,
2937,
4458,
198,
220,
19878,
21389,
3359,
62,
25928,
13,
198,
10619,
33365,
24212,
13,
198,
198,
33365,
24212,
279,
1872,
3268,
30076,
13,
198,
220,
42001,
827,
12,
84,
9503,
13,
198,
220,
220,
220,
42099,
705,
31098,
4458,
25823,
6374,
2200,
1677,
657,
13,
198,
220,
220,
220,
42099,
705,
6369,
2043,
4458,
12509,
32,
6089,
46805,
13,
198,
220,
220,
220,
42099,
705,
34,
20940,
4458,
12509,
32,
6089,
46805,
13,
198,
220,
220,
220,
42099,
705,
46437,
53,
4458,
19878,
21389,
1487,
62,
49283,
1294,
2751,
705,
12,
4458,
198,
220,
220,
220,
42099,
705,
45,
13918,
4458,
19878,
21389,
1487,
62,
49283,
1294,
2751,
705,
10,
4458,
198,
220,
23578,
34,
11159,
13,
198,
10619,
33365,
24212,
13,
198,
198,
21389,
3359,
62,
25928,
13,
628,
220,
42865,
300,
83,
62,
69,
9246,
41876,
300,
28435,
62,
83,
62,
69,
9246,
13,
628,
220,
16876,
467,
62,
25928,
3180
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_default_transport DEFINITION
PUBLIC
CREATE PRIVATE .
PUBLIC SECTION.
CLASS-METHODS:
get_instance
RETURNING
VALUE(ro_instance) TYPE REF TO zcl_abapgit_default_transport
RAISING
zcx_abapgit_exception.
METHODS:
constructor
RAISING
zcx_abapgit_exception,
set
IMPORTING
iv_transport TYPE trkorr
RAISING
zcx_abapgit_exception,
reset
RAISING
zcx_abapgit_exception,
get
RETURNING
VALUE(rs_default_task) TYPE e070use
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-DATA go_instance TYPE REF TO zcl_abapgit_default_transport .
DATA mv_is_set_by_abapgit TYPE abap_bool .
DATA ms_save TYPE e070use .
METHODS store
RAISING
zcx_abapgit_exception .
METHODS restore
RAISING
zcx_abapgit_exception .
METHODS set_internal
IMPORTING
!iv_transport TYPE trkorr
RAISING
zcx_abapgit_exception .
METHODS clear
IMPORTING
!is_default_task TYPE e070use
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_DEFAULT_TRANSPORT IMPLEMENTATION.
METHOD clear.
CALL FUNCTION 'TR_TASK_RESET'
EXPORTING
iv_username = is_default_task-username
iv_order = is_default_task-ordernum
iv_task = is_default_task-tasknum
iv_dialog = abap_false
EXCEPTIONS
invalid_username = 1
invalid_order = 2
invalid_task = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from TR_TASK_RESET. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD constructor.
store( ).
ENDMETHOD.
METHOD get.
DATA: lt_e070use TYPE STANDARD TABLE OF e070use.
CALL FUNCTION 'TR_TASK_GET'
TABLES
tt_e070use = lt_e070use
EXCEPTIONS
invalid_username = 1
invalid_category = 2
invalid_client = 3
OTHERS = 4.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from TR_TASK_GET. Subrc = { sy-subrc }| ).
ENDIF.
READ TABLE lt_e070use INTO rs_default_task
INDEX 1.
ENDMETHOD.
METHOD get_instance.
IF go_instance IS NOT BOUND.
CREATE OBJECT go_instance.
ENDIF.
ro_instance = go_instance.
ENDMETHOD.
METHOD reset.
DATA: ls_default_task TYPE e070use.
IF mv_is_set_by_abapgit = abap_false.
" if the default transport request task isn't set
" by us there is nothing to do.
RETURN.
ENDIF.
CLEAR mv_is_set_by_abapgit.
ls_default_task = get( ).
IF ls_default_task IS NOT INITIAL.
clear( ls_default_task ).
ENDIF.
restore( ).
ENDMETHOD.
METHOD restore.
IF ms_save IS INITIAL.
" There wasn't a default transport request before
" so we needn't restore anything.
RETURN.
ENDIF.
CALL FUNCTION 'TR_TASK_SET'
EXPORTING
iv_order = ms_save-ordernum
iv_task = ms_save-tasknum
EXCEPTIONS
invalid_username = 1
invalid_category = 2
invalid_client = 3
invalid_validdays = 4
invalid_order = 5
invalid_task = 6
OTHERS = 7.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from TR_TASK_SET. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD set.
" checks whether object changes of the package are rerorded in transport
" requests. If true then we set the default task, so that no annoying
" transport request popups are shown while deserializing.
IF mv_is_set_by_abapgit = abap_true.
" the default transport request task is already set by us
" -> no reason to do it again.
RETURN.
ENDIF.
IF iv_transport IS INITIAL.
zcx_abapgit_exception=>raise( |No transport request was supplied| ).
ENDIF.
set_internal( iv_transport ).
mv_is_set_by_abapgit = abap_true.
ENDMETHOD.
METHOD set_internal.
CALL FUNCTION 'TR_TASK_SET'
EXPORTING
iv_order = iv_transport
EXCEPTIONS
invalid_username = 1
invalid_category = 2
invalid_client = 3
invalid_validdays = 4
invalid_order = 5
invalid_task = 6
OTHERS = 7.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from TR_TASK_SET. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD store.
ms_save = get( ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
12286,
62,
7645,
634,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
4810,
3824,
6158,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
25,
198,
220,
220,
220,
220,
220,
651,
62,
39098,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
39098,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
12286,
62,
7645,
634,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
23772,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
628,
220,
220,
220,
220,
220,
900,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
7645,
634,
41876,
491,
74,
38890,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
628,
220,
220,
220,
220,
220,
13259,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
220,
220,
651,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
3808,
62,
12286,
62,
35943,
8,
41876,
304,
43509,
1904,
198,
220,
220,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
628,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42715,
12,
26947,
467,
62,
39098,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
12286,
62,
7645,
634,
764,
198,
220,
220,
220,
42865,
285,
85,
62,
271,
62,
2617,
62,
1525,
62,
397,
499,
18300,
41876,
450,
499,
62,
30388,
764,
198,
220,
220,
220,
42865,
13845,
62,
21928,
41876,
304,
43509,
1904,
764,
628,
220,
220,
220,
337,
36252,
50,
3650,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
11169,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
900,
62,
32538,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
7645,
634,
41876,
491,
74,
38890,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
1598,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
12286,
62,
35943,
41876,
304,
43509,
1904,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
7206,
38865,
62,
5446,
1565,
4303,
9863,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1598,
13,
628,
220,
220,
220,
42815,
29397,
4177,
2849,
705,
5446,
62,
51,
1921,
42,
62,
19535,
2767,
6,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
29460,
220,
220,
220,
220,
220,
796,
318,
62,
12286,
62,
35943,
12,
29460,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2875,
220,
220,
220,
220,
220,
220,
220,
220,
796,
318,
62,
12286,
62,
35943,
12,
585,
1142,
388,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
35943,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
318,
62,
12286,
62,
35943,
12,
35943,
22510,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
38969,
519,
220,
220,
220,
220,
220,
220,
220,
796,
450,
499,
62,
9562,
198,
220,
220,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
220,
220,
12515,
62,
29460,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
12515,
62,
2875,
220,
220,
220,
796,
362,
198,
220,
220,
220,
220,
220,
220,
220,
12515,
62,
35943,
220,
220,
220,
220,
796,
513,
198,
220,
220,
220,
220,
220,
220,
220,
440,
4221,
4877,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
604,
13,
628,
220,
220,
220,
16876,
827,
12,
7266,
6015,
1279,
29,
657,
13,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
7,
930,
12331,
422,
7579,
62,
51,
1921,
42,
62,
19535,
2767,
13,
3834,
6015,
796,
1391,
827,
12,
7266,
6015,
1782,
91,
6739,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
23772,
13,
628,
220,
220,
220,
3650,
7,
6739,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
651,
13,
628,
220,
220,
220,
42865,
25,
300,
83,
62,
68,
43509,
1904,
41876,
49053,
9795,
43679,
3963,
304,
43509,
1904,
13,
628,
220,
220,
220,
42815,
29397,
4177,
2849,
705,
5446,
62,
51,
1921,
42,
62,
18851,
6,
198,
220,
220,
220,
220,
220,
309,
6242,
28378,
198,
220,
220,
220,
220,
220,
220,
220,
256,
83
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& ABAP TEXT2TAB PARSER
*& project homepage: https://github.com/sbcgua/text2tab
*&---------------------------------------------------------------------*
report ztext2tab_example.
start-of-selection.
types:
begin of ty_my,
num type i,
word type char8,
end of ty_my,
tt_my type standard table of ty_my.
data lt_container type tt_my.
data lv_text type string.
lv_text = 'NUM\tWORD\n1\tHello\n2\tWorld'.
replace all occurrences of '\t' in lv_text with cl_abap_char_utilities=>horizontal_tab.
replace all occurrences of '\n' in lv_text with cl_abap_char_utilities=>cr_lf.
zcl_text2tab_parser=>create(
i_pattern = lt_container
i_amount_format = ''
)->parse(
exporting
i_data = lv_text
i_strict = abap_true
i_has_head = abap_true
importing
e_container = lt_container ).
field-symbols <i> like line of lt_container.
loop at lt_container assigning <i>.
write: / <i>-num, <i>-word.
endloop.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
9564,
2969,
40383,
17,
5603,
33,
350,
27415,
1137,
198,
9,
5,
220,
220,
1628,
34940,
25,
3740,
1378,
12567,
13,
785,
14,
82,
15630,
5162,
64,
14,
5239,
17,
8658,
198,
9,
5,
10097,
30934,
9,
198,
198,
13116,
1976,
5239,
17,
8658,
62,
20688,
13,
198,
198,
9688,
12,
1659,
12,
49283,
13,
628,
220,
3858,
25,
198,
220,
220,
220,
2221,
286,
1259,
62,
1820,
11,
198,
220,
220,
220,
220,
220,
997,
220,
2099,
1312,
11,
198,
220,
220,
220,
220,
220,
1573,
2099,
1149,
23,
11,
198,
220,
220,
220,
886,
286,
1259,
62,
1820,
11,
198,
220,
220,
220,
256,
83,
62,
1820,
2099,
3210,
3084,
286,
1259,
62,
1820,
13,
628,
220,
1366,
300,
83,
62,
34924,
2099,
256,
83,
62,
1820,
13,
198,
220,
1366,
300,
85,
62,
5239,
2099,
4731,
13,
628,
220,
300,
85,
62,
5239,
796,
705,
41359,
59,
83,
54,
12532,
59,
77,
16,
59,
83,
15496,
59,
77,
17,
59,
83,
10603,
4458,
198,
220,
6330,
477,
40279,
286,
705,
59,
83,
6,
287,
300,
85,
62,
5239,
351,
537,
62,
397,
499,
62,
10641,
62,
315,
2410,
14804,
17899,
38342,
62,
8658,
13,
198,
220,
6330,
477,
40279,
286,
705,
59,
77,
6,
287,
300,
85,
62,
5239,
351,
537,
62,
397,
499,
62,
10641,
62,
315,
2410,
14804,
6098,
62,
1652,
13,
628,
220,
1976,
565,
62,
5239,
17,
8658,
62,
48610,
14804,
17953,
7,
198,
220,
220,
220,
1312,
62,
33279,
220,
220,
220,
220,
220,
220,
796,
300,
83,
62,
34924,
198,
220,
220,
220,
1312,
62,
17287,
62,
18982,
796,
10148,
198,
220,
1267,
3784,
29572,
7,
198,
220,
220,
220,
39133,
198,
220,
220,
220,
220,
220,
1312,
62,
7890,
220,
220,
220,
220,
220,
796,
300,
85,
62,
5239,
198,
220,
220,
220,
220,
220,
1312,
62,
301,
2012,
220,
220,
220,
796,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
1312,
62,
10134,
62,
2256,
220,
796,
450,
499,
62,
7942,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
304,
62,
34924,
796,
300,
83,
62,
34924,
6739,
628,
220,
2214,
12,
1837,
2022,
10220,
1279,
72,
29,
588,
1627,
286,
300,
83,
62,
34924,
13,
198,
220,
9052,
379,
300,
83,
62,
34924,
38875,
1279,
72,
28401,
198,
220,
220,
220,
3551,
25,
1220,
1279,
72,
29,
12,
22510,
11,
1279,
72,
29,
12,
4775,
13,
198,
220,
886,
26268,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
FUNCTION zfm_aqo_usage_exit.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCT
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" REFERENCE(SHLP) TYPE SHLP_DESCR
*" REFERENCE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
*"--------------------------------------------------------------------
DATA:
lt_usage TYPE zcl_aqo_helper=>tt_usage.
" Return all fields
IF zcl_aqo_helper=>is_in_editor( ) = abap_true.
" TODO When ?
callcontrol-retallflds = abap_true.
ENDIF.
" Only for data selection
CHECK callcontrol-step = 'SELECT'.
" All usage
lt_usage = zcl_aqo_helper=>get_usage( ).
" Write back
f4ut_results_map lt_usage.
" Just display
callcontrol-step = 'DISP'.
ENDFUNCTION.
| [
42296,
4177,
2849,
1976,
38353,
62,
30188,
78,
62,
26060,
62,
37023,
13,
198,
9,
1,
10097,
650,
198,
9,
1,
9,
1,
14565,
26491,
25,
198,
9,
1,
220,
309,
6242,
28378,
198,
9,
1,
220,
220,
220,
220,
220,
6006,
19930,
62,
5603,
33,
41876,
220,
6006,
19930,
62,
30910,
4177,
198,
9,
1,
220,
220,
220,
220,
220,
19644,
12532,
62,
5603,
33,
19269,
18415,
11335,
220,
41067,
6581,
48296,
198,
9,
1,
220,
5870,
15567,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
50,
6581,
47,
8,
41876,
220,
6006,
19930,
62,
30910,
9419,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
34,
1847,
5639,
1340,
5446,
3535,
8,
34178,
220,
360,
5258,
29567,
19,
4177,
7836,
19269,
18415,
11335,
220,
360,
5258,
29567,
19,
4177,
7836,
198,
9,
1,
10097,
650,
198,
220,
42865,
25,
198,
220,
220,
220,
300,
83,
62,
26060,
41876,
1976,
565,
62,
30188,
78,
62,
2978,
525,
14804,
926,
62,
26060,
13,
628,
220,
366,
8229,
477,
7032,
198,
220,
16876,
1976,
565,
62,
30188,
78,
62,
2978,
525,
14804,
271,
62,
259,
62,
35352,
7,
1267,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
366,
16926,
46,
1649,
5633,
198,
220,
220,
220,
869,
13716,
12,
1186,
439,
69,
335,
82,
796,
450,
499,
62,
7942,
13,
198,
220,
23578,
5064,
13,
628,
220,
366,
5514,
329,
1366,
6356,
198,
220,
5870,
25171,
869,
13716,
12,
9662,
796,
705,
46506,
4458,
628,
220,
366,
1439,
8748,
198,
220,
300,
83,
62,
26060,
796,
1976,
565,
62,
30188,
78,
62,
2978,
525,
14804,
1136,
62,
26060,
7,
6739,
628,
220,
366,
19430,
736,
198,
220,
277,
19,
315,
62,
43420,
62,
8899,
300,
83,
62,
26060,
13,
628,
220,
366,
2329,
3359,
198,
220,
869,
13716,
12,
9662,
796,
705,
26288,
47,
4458,
198,
1677,
8068,
4944,
4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PE abap_encoding VALUE '4102',
c_utf16le TYPE abap_encoding VALUE '4103'.
PARAMETERS: p_obj TYPE tadir-object OBLIGATORY,
p_nam TYPE tadir-obj_name OBLIGATORY,
p_days TYPE i DEFAULT 100 OBLIGATORY.
TYPES: BEGIN OF ty_output,
object TYPE tadir-object,
obj_name TYPE tadir-obj_name,
logdate TYPE dbtablog-logdate,
logtime TYPE dbtablog-logtime,
username TYPE dbtablog-username,
devclass TYPE tadir-devclass,
END OF ty_output.
DATA: gt_output TYPE STANDARD TABLE OF ty_output WITH DEFAULT KEY.
START-OF-SELECTION.
PERFORM run.
FORM run RAISING cx_salv_msg.
DATA: lt_objects TYPE stprt_h_tablist,
ls_object LIKE LINE OF lt_objects,
lv_from TYPE d,
lt_keys TYPE stprsokey,
lv_string TYPE string,
ls_key LIKE LINE OF lt_keys,
lt_log TYPE stprt_log_stable_type.
lv_from = sy-datum - p_days.
ls_object-tab = 'TADIR'.
INSERT ls_object INTO TABLE lt_objects.
ls_key-sign = 'I'.
ls_key-option = 'EQ'.
CONCATENATE 'R3TR' p_obj p_nam INTO ls_key-low.
INSERT ls_key INTO TABLE lt_keys.
CALL FUNCTION 'DBLOG_READ_TABLE'
EXPORTING
from_day = lv_from
to_day = sy-datum
obj_list = lt_objects
log_keys = lt_keys
CHANGING
log_list = lt_log
EXCEPTIONS
archive_access_error = 1
no_archives_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: / 'Error,', sy-subrc.
RETURN.
ENDIF.
LOOP AT lt_log ASSIGNING FIELD-SYMBOL(<ls_log>).
DATA(loc_conv) = cl_abap_conv_in_ce=>create(
input = <ls_log>-logdata
encoding = c_utf16be
replacement = '?'
ignore_cerr = abap_true ).
TRY.
loc_conv->read( IMPORTING data = lv_string ).
CATCH cx_sy_conversion_codepage
cx_sy_codepage_converter_init
cx_parameter_invalid_type
cx_parameter_invalid_range.
BREAK-POINT.
ENDTRY.
APPEND VALUE #(
object = p_obj
obj_name = p_nam
logdate = <ls_log>-logdate
logtime = <ls_log>-logtime
username = <ls_log>-username
devclass = lv_string+81(30) ) TO gt_output.
ENDLOOP.
SELECT SINGLE devclass
FROM tadir INTO @DATA(lv_current)
WHERE pgmid = 'R3TR'
AND object = @p_obj
AND obj_name = @p_nam.
APPEND VALUE #(
devclass = lv_current ) TO gt_output.
PERFORM show.
ENDFORM.
FORM show RAISING cx_salv_msg.
cl_salv_table=>factory(
IMPORTING
r_salv_table = DATA(lo_alv)
CHANGING
t_table = gt_output ).
lo_alv->get_columns( )->set_optimize( ).
lo_alv->get_functions( )->set_all( ).
lo_alv->display( ).
ENDFORM.
| [
2200,
15490,
1976,
64,
420,
62,
83,
324,
343,
62,
36653,
13,
198,
9,
905,
508,
14,
12518,
5301,
373,
3421,
329,
281,
2134,
198,
198,
10943,
2257,
1565,
4694,
25,
269,
62,
40477,
1433,
1350,
41876,
450,
499,
62,
12685,
7656,
26173,
8924,
705,
19,
15377,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
62,
40477,
1433,
293,
41876,
450,
499,
62,
12685,
7656,
26173,
8924,
705,
19,
15197,
4458,
198,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
26801,
220,
41876,
36264,
343,
12,
15252,
440,
9148,
3528,
1404,
15513,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
7402,
220,
41876,
36264,
343,
12,
26801,
62,
3672,
440,
9148,
3528,
1404,
15513,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
12545,
41876,
1312,
5550,
38865,
1802,
440,
9148,
3528,
1404,
15513,
13,
198,
198,
9936,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
22915,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
2134,
220,
220,
41876,
36264,
343,
12,
15252,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
26181,
62,
3672,
41876,
36264,
343,
12,
26801,
62,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
2604,
4475,
220,
41876,
20613,
8658,
6404,
12,
6404,
4475,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
2604,
2435,
220,
41876,
20613,
8658,
6404,
12,
6404,
2435,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
20579,
41876,
20613,
8658,
6404,
12,
29460,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1614,
4871,
41876,
36264,
343,
12,
7959,
4871,
11,
198,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
22915,
13,
198,
198,
26947,
25,
308,
83,
62,
22915,
41876,
49053,
9795,
43679,
3963,
1259,
62,
22915,
13315,
5550,
38865,
35374,
13,
198,
198,
2257,
7227,
12,
19238,
12,
46506,
2849,
13,
198,
220,
19878,
21389,
1057,
13,
198,
198,
21389,
1057,
17926,
1797,
2751,
43213,
62,
21680,
85,
62,
19662,
13,
628,
220,
42865,
25,
300,
83,
62,
48205,
41876,
336,
1050,
83,
62,
71,
62,
8658,
4868,
11,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
15252,
220,
34178,
48920,
3963,
300,
83,
62,
48205,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
6738,
220,
220,
220,
41876,
288,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
13083,
220,
220,
220,
41876,
336,
1050,
568,
2539,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
8841,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
2539,
220,
220,
220,
220,
34178,
48920,
3963,
300,
83,
62,
13083,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
6404,
220,
220,
220,
220,
41876,
336,
1050,
83,
62,
6404,
62,
31284,
62,
4906,
13,
628,
198,
220,
300,
85,
62,
6738,
796,
827,
12,
19608,
388,
532,
279,
62,
12545,
13,
628,
220,
43979,
62,
15252,
12,
8658,
796,
705,
51,
2885,
4663,
4458,
198,
220,
29194,
17395,
43979,
62,
15252,
39319,
43679,
300,
83,
62,
48205,
13,
628,
220,
43979,
62,
2539,
12,
12683,
220,
220,
796,
705,
40,
4458,
198,
220,
43979,
62,
2539,
12,
18076,
796,
705,
36,
48,
4458,
198,
220,
39962,
1404,
1677,
6158,
705,
49,
18,
5446,
6,
279,
62,
26801,
279,
62,
7402,
39319,
43979,
62,
2539,
12,
9319,
13,
198,
220,
29194,
17395,
43979,
62,
2539,
39319,
43679,
300,
83,
62,
13083,
13,
628,
220,
42815,
29397,
4177,
2849,
705,
35,
9148,
7730,
62,
15675,
62,
38148,
6,
198,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
422,
62,
820,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
85,
62,
6738,
198,
220,
220,
220,
220,
220,
284,
62,
820,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
827,
12,
19608,
388,
198,
220,
220,
220,
220,
220,
26181,
62,
4868,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
83,
62,
48205,
198,
220,
220,
220,
220,
220,
2604,
62,
13083,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
83,
62,
13083,
198,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
2604,
62,
4868,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
83,
62,
6404,
198,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
15424,
62,
15526,
62,
18224,
796,
352,
198,
220,
220,
220,
220,
220,
645,
62,
48814,
62,
9275,
220,
220,
220,
796,
362,
198,
220,
220,
220,
220,
220,
440,
4221,
4877,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
513,
13,
198,
220,
16876,
827,
12,
7266,
6015,
1279,
29,
657,
13,
198,
220,
220,
220,
44423,
25,
1220,
705,
12331,
11,
3256,
827,
12,
7266,
6015,
13,
198,
220,
220,
220,
30826,
27064,
13,
198,
220,
23578,
5064,
13,
628,
220,
17579,
3185,
5161,
300,
83,
62,
6404,
24994,
3528,
15871,
18930,
24639,
12,
23060,
10744,
3535,
7,
27,
7278,
62,
6404,
29,
737,
628,
220,
220,
220,
42865,
7,
17946,
62,
42946,
8,
796,
537,
62,
397,
499,
62,
42946,
62,
259,
62,
344,
14804,
17953,
7,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
220,
220,
220,
220,
220,
220,
796,
1279,
7278,
62,
6404,
29,
12,
6404,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
21004,
220,
220,
220,
796,
269,
62,
40477,
1433,
1350,
198,
220,
220,
220,
220,
220,
220,
220,
9014,
796,
705,
8348,
198,
220,
220,
220,
220,
220,
220,
220,
8856,
62,
2189,
81,
796,
450,
499,
62,
7942,
6739,
628,
220,
220,
220,
7579,
56,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1179,
62,
42946,
3784,
961,
7,
30023,
9863,
2751,
1366,
796,
300,
85,
62,
8841,
6739,
198,
220,
220,
220,
220,
220,
327,
11417,
43213,
62,
1837,
62,
1102,
9641,
62,
19815,
538
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*----------------------------------------------------------------------*
* 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 .
TYPES:
BEGIN OF mty_s_column_formula,
id TYPE i,
column TYPE zexcel_cell_column,
formula TYPE string,
table_top_left_row TYPE zexcel_cell_row,
table_bottom_right_row TYPE zexcel_cell_row,
table_left_column_int TYPE zexcel_cell_column,
table_right_column_int TYPE zexcel_cell_column,
END OF mty_s_column_formula .
TYPES:
mty_th_column_formula
TYPE HASHED TABLE OF mty_s_column_formula
WITH UNIQUE KEY id .
TYPES:
BEGIN OF mty_s_ignored_errors,
"! Cell reference (e.g. "A1") or list like "A1 A2" or range "A1:G1"
cell_coords TYPE zexcel_cell_coords,
"! Ignore errors when cells contain formulas that result in an error.
eval_error TYPE abap_bool,
"! Ignore errors when formulas contain text formatted cells with years represented as 2 digits.
two_digit_text_year TYPE abap_bool,
"! Ignore errors when numbers are formatted as text or are preceded by an apostrophe.
number_stored_as_text TYPE abap_bool,
"! Ignore errors when a formula in a region of your WorkSheet differs from other formulas in the same region.
formula TYPE abap_bool,
"! Ignore errors when formulas omit certain cells in a region.
formula_range TYPE abap_bool,
"! Ignore errors when unlocked cells contain formulas.
unlocked_formula TYPE abap_bool,
"! Ignore errors when formulas refer to empty cells.
empty_cell_reference TYPE abap_bool,
"! Ignore errors when a cell's value in a Table does not comply with the Data Validation rules specified.
list_data_validation TYPE abap_bool,
"! Ignore errors when cells contain a value different from a calculated column formula.
"! In other words, for a calculated column, a cell in that column is considered to have an error
"! if its formula is different from the calculated column formula, or doesn't contain a formula at all.
calculated_column TYPE abap_bool,
END OF mty_s_ignored_errors,
mty_th_ignored_errors TYPE HASHED TABLE OF mty_s_ignored_errors WITH UNIQUE KEY cell_coords.
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 .
DATA column_formulas TYPE mty_th_column_formula READ-ONLY .
CLASS-DATA: BEGIN OF c_messages READ-ONLY,
formula_id_only_is_possible TYPE string,
column_formula_id_not_found TYPE string,
formula_not_in_this_table TYPE string,
formula_in_other_column TYPE string,
END OF c_messages.
CLASS-METHODS class_constructor.
METHODS add_comment
IMPORTING
!ip_comment TYPE REF TO zcl_excel_comment .
METHODS add_drawing
IMPORTING
!ip_drawing TYPE REF TO zcl_excel_drawing .
METHODS add_new_column
IMPORTING
!ip_column TYPE simple
RETURNING
VALUE(eo_column) TYPE REF TO zcl_excel_column .
METHODS add_new_style_cond
IMPORTING
!ip_dimension_range TYPE string DEFAULT 'A1'
RETURNING
VALUE(eo_style_cond) TYPE REF TO zcl_excel_style_cond.
METHODS add_new_data_validation
RETURNING
VALUE(eo_data_validation) TYPE REF TO zcl_excel_data_validation .
METHODS add_new_range
RETURNING
VALUE(eo_range) TYPE REF TO zcl_excel_range .
METHODS add_new_row
IMPORTING
!ip_row TYPE simple
RETURNING
VALUE(eo_row) TYPE REF TO zcl_excel_row .
METHODS bind_alv
IMPORTING
!io_alv TYPE REF TO object
!it_table TYPE STANDARD TABLE
!i_top TYPE i DEFAULT 1
!i_left TYPE i DEFAULT 1
!table_style TYPE zexcel_table_style OPTIONAL
!i_table TYPE abap_bool DEFAULT abap_true
RAISING
zcx_excel .
METHODS bind_alv_ole2
IMPORTING
!i_document_url TYPE char255 DEFAULT space
!i_xls TYPE c DEFAULT space
!i_save_path TYPE string
!io_alv TYPE REF TO cl_gui_alv_grid
!it_listheader TYPE slis_t_listheader OPTIONAL
!i_top TYPE i DEFAULT 1
!i_left TYPE i DEFAULT 1
!i_columns_header TYPE c DEFAULT 'X'
!i_columns_autofit TYPE c DEFAULT 'X'
!i_format_col_header TYPE soi_format_item OPTIONAL
!i_format_subtotal TYPE soi_format_item OPTIONAL
!i_format_total TYPE soi_format_item OPTIONAL
EXCEPTIONS
miss_guide
ex_transfer_kkblo_error
fatal_error
inv_data_range
dim_mismatch_vkey
dim_mismatch_sema
error_in_sema .
METHODS bind_table
IMPORTING
!ip_table TYPE STANDARD TABLE
!it_field_catalog TYPE zexcel_t_fieldcatalog OPTIONAL
!is_table_settings TYPE zexcel_s_table_settings OPTIONAL
VALUE(iv_default_descr) TYPE c OPTIONAL
!iv_no_line_if_empty TYPE abap_bool DEFAULT abap_false
EXPORTING
!es_table_settings TYPE zexcel_s_table_settings
RAISING
zcx_excel .
METHODS calculate_column_widths
RAISING
zcx_excel .
METHODS change_cell_style
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_complete TYPE zexcel_s_cstyle_complete OPTIONAL
!ip_xcomplete TYPE zexcel_s_cstylex_complete OPTIONAL
!ip_font TYPE zexcel_s_cstyle_font OPTIONAL
!ip_xfont TYPE zexcel_s_cstylex_font OPTIONAL
!ip_fill TYPE zexcel_s_cstyle_fill OPTIONAL
!ip_xfill TYPE zexcel_s_cstylex_fill OPTIONAL
!ip_borders TYPE zexcel_s_cstyle_borders OPTIONAL
!ip_xborders TYPE zexcel_s_cstylex_borders OPTIONAL
!ip_alignment TYPE zexcel_s_cstyle_alignment OPTIONAL
!ip_xalignment TYPE zexcel_s_cstylex_alignment OPTIONAL
!ip_number_format_format_code TYPE zexcel_number_format OPTIONAL
!ip_protection TYPE zexcel_s_cstyle_protection OPTIONAL
!ip_xprotection TYPE zexcel_s_cstylex_protection OPTIONAL
!ip_font_bold TYPE flag OPTIONAL
!ip_font_color TYPE zexcel_s_style_color OPTIONAL
!ip_font_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_font_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_font_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_font_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_font_family TYPE zexcel_style_font_family OPTIONAL
!ip_font_italic TYPE flag OPTIONAL
!ip_font_name TYPE zexcel_style_font_name OPTIONAL
!ip_font_scheme TYPE zexcel_style_font_scheme OPTIONAL
!ip_font_size TYPE zexcel_style_font_size OPTIONAL
!ip_font_strikethrough TYPE flag OPTIONAL
!ip_font_underline TYPE flag OPTIONAL
!ip_font_underline_mode TYPE zexcel_style_font_underline OPTIONAL
!ip_fill_filltype TYPE zexcel_fill_type OPTIONAL
!ip_fill_rotation TYPE zexcel_rotation OPTIONAL
!ip_fill_fgcolor TYPE zexcel_s_style_color OPTIONAL
!ip_fill_fgcolor_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_fill_fgcolor_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_fill_fgcolor_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_fill_fgcolor_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_fill_bgcolor TYPE zexcel_s_style_color OPTIONAL
!ip_fill_bgcolor_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_fill_bgcolor_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_fill_bgcolor_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_fill_bgcolor_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_allborders TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_type TYPE zexcel_s_gradient_type-type OPTIONAL
!ip_fill_gradtype_degree TYPE zexcel_s_gradient_type-degree OPTIONAL
!ip_xborders_allborders TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_diagonal TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_bottom TYPE zexcel_s_gradient_type-bottom OPTIONAL
!ip_fill_gradtype_top TYPE zexcel_s_gradient_type-top OPTIONAL
!ip_xborders_diagonal TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_diagonal_mode TYPE zexcel_diagonal OPTIONAL
!ip_fill_gradtype_right TYPE zexcel_s_gradient_type-right OPTIONAL
!ip_borders_down TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_left TYPE zexcel_s_gradient_type-left OPTIONAL
!ip_fill_gradtype_position1 TYPE zexcel_s_gradient_type-position1 OPTIONAL
!ip_xborders_down TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_left TYPE zexcel_s_cstyle_border OPTIONAL
!ip_fill_gradtype_position2 TYPE zexcel_s_gradient_type-position2 OPTIONAL
!ip_fill_gradtype_position3 TYPE zexcel_s_gradient_type-position3 OPTIONAL
!ip_xborders_left TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_right TYPE zexcel_s_cstyle_border OPTIONAL
!ip_xborders_right TYPE zexcel_s_cstylex_border OPTIONAL
!ip_borders_top TYPE zexcel_s_cstyle_border OPTIONAL
!ip_xborders_top TYPE zexcel_s_cstylex_border OPTIONAL
!ip_alignment_horizontal TYPE zexcel_alignment OPTIONAL
!ip_alignment_vertical TYPE zexcel_alignment OPTIONAL
!ip_alignment_textrotation TYPE zexcel_text_rotation OPTIONAL
!ip_alignment_wraptext TYPE flag OPTIONAL
!ip_alignment_shrinktofit TYPE flag OPTIONAL
!ip_alignment_indent TYPE zexcel_indent OPTIONAL
!ip_protection_hidden TYPE zexcel_cell_protection OPTIONAL
!ip_protection_locked TYPE zexcel_cell_protection OPTIONAL
!ip_borders_allborders_style TYPE zexcel_border OPTIONAL
!ip_borders_allborders_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_allbo_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_allbo_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_allbo_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_allbo_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_diagonal_style TYPE zexcel_border OPTIONAL
!ip_borders_diagonal_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_diagonal_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_diagonal_color_inde TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_diagonal_color_them TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_diagonal_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_down_style TYPE zexcel_border OPTIONAL
!ip_borders_down_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_down_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_down_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_down_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_down_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_left_style TYPE zexcel_border OPTIONAL
!ip_borders_left_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_left_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_left_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_left_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_left_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_right_style TYPE zexcel_border OPTIONAL
!ip_borders_right_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_right_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_right_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_right_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_right_color_tint TYPE zexcel_style_color_tint OPTIONAL
!ip_borders_top_style TYPE zexcel_border OPTIONAL
!ip_borders_top_color TYPE zexcel_s_style_color OPTIONAL
!ip_borders_top_color_rgb TYPE zexcel_style_color_argb OPTIONAL
!ip_borders_top_color_indexed TYPE zexcel_style_color_indexed OPTIONAL
!ip_borders_top_color_theme TYPE zexcel_style_color_theme OPTIONAL
!ip_borders_top_color_tint TYPE zexcel_style_color_tint OPTIONAL
RETURNING
VALUE(ep_guid) TYPE zexcel_cell_style
RAISING
zcx_excel .
METHODS constructor
IMPORTING
!ip_excel TYPE REF TO zcl_excel
!ip_title TYPE zexcel_sheet_title OPTIONAL
RAISING
zcx_excel .
METHODS delete_merge
IMPORTING
!ip_cell_column TYPE simple OPTIONAL
!ip_cell_row TYPE zexcel_cell_row OPTIONAL
RAISING
zcx_excel .
METHODS delete_row_outline
IMPORTING
!iv_row_from TYPE i
!iv_row_to TYPE i
RAISING
zcx_excel .
METHODS freeze_panes
IMPORTING
!ip_num_columns TYPE i OPTIONAL
!ip_num_rows TYPE i OPTIONAL
RAISING
zcx_excel .
METHODS get_active_cell
RETURNING
VALUE(ep_active_cell) TYPE string
RAISING
zcx_excel .
METHODS get_cell
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
EXPORTING
!ep_value TYPE zexcel_cell_value
!ep_rc TYPE sysubrc
!ep_style TYPE REF TO zcl_excel_style
!ep_guid TYPE zexcel_cell_style
!ep_formula TYPE zexcel_cell_formula
RAISING
zcx_excel .
METHODS get_column
IMPORTING
!ip_column TYPE simple
RETURNING
VALUE(eo_column) TYPE REF TO zcl_excel_column .
METHODS get_columns
RETURNING
VALUE(eo_columns) TYPE REF TO zcl_excel_columns .
METHODS get_columns_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_style_cond_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_data_validations_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_data_validations_size
RETURNING
VALUE(ep_size) TYPE i .
METHODS get_default_column
RETURNING
VALUE(eo_column) TYPE REF TO zcl_excel_column .
METHODS get_default_excel_date_format
RETURNING
VALUE(ep_default_excel_date_format) TYPE zexcel_number_format .
METHODS get_default_excel_time_format
RETURNING
VALUE(ep_default_excel_time_format) TYPE zexcel_number_format .
METHODS get_default_row
RETURNING
VALUE(eo_row) TYPE REF TO zcl_excel_row .
METHODS get_dimension_range
RETURNING
VALUE(ep_dimension_range) TYPE string
RAISING
zcx_excel .
METHODS get_comments
RETURNING
VALUE(r_comments) TYPE REF TO zcl_excel_comments .
METHODS get_drawings
IMPORTING
!ip_type TYPE zexcel_drawing_type OPTIONAL
RETURNING
VALUE(r_drawings) TYPE REF TO zcl_excel_drawings .
METHODS get_comments_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_drawings_iterator
IMPORTING
!ip_type TYPE zexcel_drawing_type
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_freeze_cell
EXPORTING
!ep_row TYPE zexcel_cell_row
!ep_column TYPE zexcel_cell_column .
METHODS get_guid
RETURNING
VALUE(ep_guid) TYPE sysuuid_x16 .
METHODS get_highest_column
RETURNING
VALUE(r_highest_column) TYPE zexcel_cell_column
RAISING
zcx_excel .
METHODS get_highest_row
RETURNING
VALUE(r_highest_row) TYPE int4
RAISING
zcx_excel .
METHODS get_hyperlinks_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_hyperlinks_size
RETURNING
VALUE(ep_size) TYPE i .
METHODS get_merge
RETURNING
VALUE(merge_range) TYPE string_table
RAISING
zcx_excel .
METHODS get_pagebreaks
RETURNING
VALUE(ro_pagebreaks) TYPE REF TO zcl_excel_worksheet_pagebreaks
RAISING
zcx_excel .
METHODS get_ranges_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_row
IMPORTING
!ip_row TYPE int4
RETURNING
VALUE(eo_row) TYPE REF TO zcl_excel_row .
METHODS get_rows
RETURNING
VALUE(eo_rows) TYPE REF TO zcl_excel_rows .
METHODS get_rows_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_row_outlines
RETURNING
VALUE(rt_row_outlines) TYPE mty_ts_outlines_row .
METHODS get_style_cond
IMPORTING
!ip_guid TYPE zexcel_cell_style
RETURNING
VALUE(eo_style_cond) TYPE REF TO zcl_excel_style_cond .
METHODS get_tabcolor
RETURNING
VALUE(ev_tabcolor) TYPE zexcel_s_tabcolor .
METHODS get_tables_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS get_tables_size
RETURNING
VALUE(ep_size) TYPE i .
METHODS get_title
IMPORTING
!ip_escaped TYPE flag DEFAULT ''
RETURNING
VALUE(ep_title) TYPE zexcel_sheet_title .
METHODS is_cell_merged
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
RETURNING
VALUE(rp_is_merged) TYPE abap_bool
RAISING
zcx_excel .
METHODS set_cell
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_value TYPE simple OPTIONAL
!ip_formula TYPE zexcel_cell_formula OPTIONAL
!ip_style TYPE zexcel_cell_style OPTIONAL
!ip_hyperlink TYPE REF TO zcl_excel_hyperlink OPTIONAL
!ip_data_type TYPE zexcel_cell_data_type OPTIONAL
!ip_abap_type TYPE abap_typekind OPTIONAL
!ip_column_formula_id TYPE mty_s_column_formula-id OPTIONAL
!is_ignored_errors TYPE mty_s_ignored_errors OPTIONAL
RAISING
zcx_excel .
METHODS set_cell_formula
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_formula TYPE zexcel_cell_formula
RAISING
zcx_excel .
METHODS set_cell_style
IMPORTING
!ip_column TYPE simple
!ip_row TYPE zexcel_cell_row
!ip_style TYPE zexcel_cell_style
RAISING
zcx_excel .
METHODS set_column_width
IMPORTING
!ip_column TYPE simple
!ip_width_fix TYPE simple DEFAULT 0
!ip_width_autosize TYPE flag DEFAULT 'X'
RAISING
zcx_excel .
METHODS set_default_excel_date_format
IMPORTING
!ip_default_excel_date_format TYPE zexcel_number_format
RAISING
zcx_excel .
METHODS set_merge
IMPORTING
!ip_column_start TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_min_col
!ip_column_end TYPE simple DEFAULT zcl_excel_common=>c_excel_sheet_max_col
!ip_row TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_min_row
!ip_row_to TYPE zexcel_cell_row DEFAULT zcl_excel_common=>c_excel_sheet_max_row
!ip_style TYPE zexcel_cell_style OPTIONAL "added parameter
!ip_value TYPE simple OPTIONAL "added parameter
!ip_formula TYPE zexcel_cell_formula OPTIONAL "added parameter
RAISING
zcx_excel .
METHODS set_print_gridlines
IMPORTING
!i_print_gridlines TYPE zexcel_print_gridlines .
METHODS set_row_height
IMPORTING
!ip_row TYPE simple
!ip_height_fix TYPE simple
RAISING
zcx_excel .
METHODS set_row_outline
IMPORTING
!iv_row_from TYPE i
!iv_row_to TYPE i
!iv_collapsed TYPE abap_bool
RAISING
zcx_excel .
METHODS set_show_gridlines
IMPORTING
!i_show_gridlines TYPE zexcel_show_gridlines .
METHODS set_show_rowcolheaders
IMPORTING
!i_show_rowcolheaders TYPE zexcel_show_rowcolheader .
METHODS set_tabcolor
IMPORTING
!iv_tabcolor TYPE zexcel_s_tabcolor .
METHODS set_table
IMPORTING
!ip_table TYPE STANDARD TABLE
!ip_hdr_style TYPE zexcel_cell_style OPTIONAL
!ip_body_style TYPE zexcel_cell_style OPTIONAL
!ip_table_title TYPE string
!ip_top_left_column TYPE zexcel_cell_column_alpha DEFAULT 'B'
!ip_top_left_row TYPE zexcel_cell_row DEFAULT 3
!ip_transpose TYPE abap_bool OPTIONAL
!ip_no_header TYPE abap_bool OPTIONAL
RAISING
zcx_excel .
METHODS set_title
IMPORTING
!ip_title TYPE zexcel_sheet_title
RAISING
zcx_excel .
METHODS get_table
IMPORTING
!iv_skipped_rows TYPE int4 DEFAULT 0
!iv_skipped_cols TYPE int4 DEFAULT 0
!iv_max_col TYPE int4 OPTIONAL
!iv_max_row TYPE int4 OPTIONAL
EXPORTING
!et_table TYPE STANDARD TABLE
RAISING
zcx_excel .
METHODS set_merge_style
IMPORTING
!ip_column_start TYPE simple OPTIONAL
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row OPTIONAL
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_style TYPE zexcel_cell_style OPTIONAL .
METHODS set_area_formula
IMPORTING
!ip_column_start TYPE simple
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_formula TYPE zexcel_cell_formula
!ip_merge TYPE abap_bool OPTIONAL
RAISING
zcx_excel .
METHODS set_area_style
IMPORTING
!ip_column_start TYPE simple
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_style TYPE zexcel_cell_style
!ip_merge TYPE abap_bool OPTIONAL .
METHODS set_area
IMPORTING
!ip_column_start TYPE simple
!ip_column_end TYPE simple OPTIONAL
!ip_row TYPE zexcel_cell_row
!ip_row_to TYPE zexcel_cell_row OPTIONAL
!ip_value TYPE simple OPTIONAL
!ip_formula TYPE zexcel_cell_formula OPTIONAL
!ip_style TYPE zexcel_cell_style OPTIONAL
!ip_hyperlink TYPE REF TO zcl_excel_hyperlink OPTIONAL
!ip_data_type TYPE zexcel_cell_data_type OPTIONAL
!ip_abap_type TYPE abap_typekind OPTIONAL
!ip_merge TYPE abap_bool OPTIONAL
RAISING
zcx_excel .
METHODS get_header_footer_drawings
RETURNING
VALUE(rt_drawings) TYPE zexcel_t_drawings .
"! <p class="shorttext synchronized" lang="en">Ignore errors on given cells, only last call is retained.</p>
"! @parameter it_ignored_errors | <p class="shorttext synchronized" lang="en">List of errors to be ignored</p>
METHODS set_ignored_errors
IMPORTING
it_ignored_errors TYPE mty_th_ignored_errors.
METHODS get_ignored_errors
RETURNING
VALUE(rt_ignored_errors) TYPE mty_th_ignored_errors.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF mty_s_font_metric,
char TYPE c LENGTH 1,
char_width TYPE tdcwidths,
END OF mty_s_font_metric .
TYPES:
mty_th_font_metrics
TYPE HASHED TABLE OF mty_s_font_metric
WITH UNIQUE KEY char .
TYPES:
BEGIN OF mty_s_font_cache,
font_name TYPE zexcel_style_font_name,
font_height TYPE tdfontsize,
flag_bold TYPE abap_bool,
flag_italic TYPE abap_bool,
th_font_metrics TYPE mty_th_font_metrics,
END OF mty_s_font_cache .
TYPES:
mty_th_font_cache
TYPE HASHED TABLE OF mty_s_font_cache
WITH UNIQUE KEY font_name font_height flag_bold flag_italic .
TYPES:
* types:
* mty_ts_row_dimension TYPE SORTED TABLE OF zexcel_s_worksheet_rowdimensio WITH UNIQUE KEY row .
BEGIN OF mty_merge,
row_from TYPE i,
row_to TYPE i,
col_from TYPE i,
col_to TYPE i,
END OF mty_merge .
TYPES:
mty_ts_merge TYPE SORTED TABLE OF mty_merge WITH UNIQUE KEY table_line .
*"* private components of class ZCL_EXCEL_WORKSHEET
*"* do not include other source files here!!!
DATA active_cell TYPE zexcel_s_cell_data .
DATA charts TYPE REF TO zcl_excel_drawings .
DATA columns TYPE REF TO zcl_excel_columns .
DATA row_default TYPE REF TO zcl_excel_row .
DATA column_default TYPE REF TO zcl_excel_column .
DATA styles_cond TYPE REF TO zcl_excel_styles_cond .
DATA data_validations TYPE REF TO zcl_excel_data_validations .
DATA default_excel_date_format TYPE zexcel_number_format .
DATA default_excel_time_format TYPE zexcel_number_format .
DATA comments TYPE REF TO zcl_excel_comments .
DATA drawings TYPE REF TO zcl_excel_drawings .
DATA freeze_pane_cell_column TYPE zexcel_cell_column .
DATA freeze_pane_cell_row TYPE zexcel_cell_row .
DATA guid TYPE sysuuid_x16 .
DATA hyperlinks TYPE REF TO cl_object_collection .
DATA lower_cell TYPE zexcel_s_cell_data .
DATA mo_pagebreaks TYPE REF TO zcl_excel_worksheet_pagebreaks .
CLASS-DATA mth_font_cache TYPE mty_th_font_cache .
DATA mt_merged_cells TYPE mty_ts_merge .
DATA mt_row_outlines TYPE mty_ts_outlines_row .
DATA print_title_col_from TYPE zexcel_cell_column_alpha .
DATA print_title_col_to TYPE zexcel_cell_column_alpha .
DATA print_title_row_from TYPE zexcel_cell_row .
DATA print_title_row_to TYPE zexcel_cell_row .
DATA ranges TYPE REF TO zcl_excel_ranges .
DATA rows TYPE REF TO zcl_excel_rows .
DATA tables TYPE REF TO cl_object_collection .
DATA title TYPE zexcel_sheet_title VALUE 'Worksheet'. "#EC NOTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . " .
DATA upper_cell TYPE zexcel_s_cell_data .
DATA mt_ignored_errors TYPE mty_th_ignored_errors.
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 .
CLASS-METHODS check_cell_column_formula
IMPORTING
it_column_formulas TYPE mty_th_column_formula
ip_column_formula_id TYPE mty_s_column_formula-id
ip_formula TYPE zexcel_cell_formula
ip_value TYPE simple
ip_row TYPE zexcel_cell_row
ip_column TYPE zexcel_cell_column
RAISING
zcx_excel.
ENDCLASS.
CLASS zcl_excel_worksheet IMPLEMENTATION.
METHOD add_comment.
comments->include( ip_comment ).
ENDMETHOD. "add_comment
METHOD add_drawing.
CASE ip_drawing->get_type( ).
WHEN zcl_excel_drawing=>type_image.
drawings->include( ip_drawing ).
WHEN zcl_excel_drawing=>type_chart.
charts->include( ip_drawing ).
ENDCASE.
ENDMETHOD. "ADD_DRAWING
METHOD add_new_column.
DATA: lv_column_alpha TYPE zexcel_cell_column_alpha.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( ip_column ).
CREATE OBJECT eo_column
EXPORTING
ip_index = lv_column_alpha
ip_excel = me->excel
ip_worksheet = me.
columns->add( eo_column ).
ENDMETHOD. "ADD_NEW_COLUMN
METHOD add_new_data_validation.
CREATE OBJECT eo_data_validation.
data_validations->add( eo_data_validation ).
ENDMETHOD. "ADD_NEW_DATA_VALIDATION
METHOD add_new_range.
* Create default blank range
CREATE OBJECT eo_range.
ranges->add( eo_range ).
ENDMETHOD. "ADD_NEW_RANGE
METHOD add_new_row.
CREATE OBJECT eo_row
EXPORTING
ip_index = ip_row.
rows->add( eo_row ).
ENDMETHOD. "ADD_NEW_ROW
METHOD add_new_style_cond.
CREATE OBJECT eo_style_cond EXPORTING ip_dimension_range = ip_dimension_range.
styles_cond->add( eo_style_cond ).
ENDMETHOD. "ADD_NEW_STYLE_COND
METHOD bind_alv.
DATA: lo_converter TYPE REF TO zcl_excel_converter.
CREATE OBJECT lo_converter.
TRY.
lo_converter->convert(
EXPORTING
io_alv = io_alv
it_table = it_table
i_row_int = i_top
i_column_int = i_left
i_table = i_table
i_style_table = table_style
io_worksheet = me
CHANGING
co_excel = excel ).
CATCH zcx_excel .
ENDTRY.
ENDMETHOD. "BIND_ALV
METHOD bind_alv_ole2.
*--------------------------------------------------------------------*
* Method description:
* Method use to export a CL_GUI_ALV_GRID object to xlsx/xls file
* with list header and characteristics of ALV field catalog such as:
* + Total, group's subtotal
* + Quantity fields, amount fields (dependent fields)
* + No_out, no_zero, ...
* Technique use in method:
* SAP Desktop Office Integration (DOI)
*--------------------------------------------------------------------*
* Data for session 0: DOI constructor
* ------------------------------------------
DATA: lo_control TYPE REF TO i_oi_container_control.
DATA: lo_proxy TYPE REF TO i_oi_document_proxy.
DATA: lo_spreadsheet TYPE REF TO i_oi_spreadsheet.
DATA: lo_error TYPE REF TO i_oi_error.
DATA: lc_retcode TYPE soi_ret_string.
DATA: li_has TYPE i. "Proxy has spreadsheet interface?
DATA: l_is_closed TYPE i.
* Data for session 1: Get LVC data from ALV object
* ------------------------------------------
DATA: l_has_activex,
l_doctype_excel_sheet(11) TYPE c.
* LVC
DATA: lt_fieldcat_lvc TYPE lvc_t_fcat.
DATA: wa_fieldcat_lvc TYPE lvc_s_fcat.
DATA: lt_sort_lvc TYPE lvc_t_sort.
DATA: lt_filter_idx_lvc TYPE lvc_t_fidx.
DATA: lt_grouplevels_lvc TYPE lvc_t_grpl.
* KKBLO
DATA: lt_fieldcat_kkblo TYPE kkblo_t_fieldcat.
DATA: lt_sort_kkblo TYPE kkblo_t_sortinfo.
DATA: lt_grouplevels_kkblo TYPE kkblo_t_grouplevels.
DATA: lt_filter_idx_kkblo TYPE kkblo_t_sfinfo.
DATA: wa_listheader LIKE LINE OF it_listheader.
* Subtotal
DATA: lt_collect00 TYPE REF TO data.
DATA: lt_collect01 TYPE REF TO data.
DATA: lt_collect02 TYPE REF TO data.
DATA: lt_collect03 TYPE REF TO data.
DATA: lt_collect04 TYPE REF TO data.
DATA: lt_collect05 TYPE REF TO data.
DATA: lt_collect06 TYPE REF TO data.
DATA: lt_collect07 TYPE REF TO data.
DATA: lt_collect08 TYPE REF TO data.
DATA: lt_collect09 TYPE REF TO data.
* data table name
DATA: l_tabname TYPE kkblo_tabname.
* local object
DATA: lo_grid TYPE REF TO lcl_gui_alv_grid.
* data table get from ALV
DATA: lt_alv TYPE REF TO data.
* total / subtotal data
FIELD-SYMBOLS: <f_collect00> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect01> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect02> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect03> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect04> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect05> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect06> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect07> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect08> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect09> TYPE STANDARD TABLE.
* table before append subtotal lines
FIELD-SYMBOLS: <f_alv_tab> TYPE STANDARD TABLE.
* data for session 2: sort, filter and calculate total/subtotal
* ------------------------------------------
* table to save index of subotal / total line in excel tanle
* this ideal to control index of subtotal / total line later
* for ex, when get subtotal / total line to format
TYPES: BEGIN OF st_subtot_indexs,
index TYPE i,
END OF st_subtot_indexs.
DATA: lt_subtot_indexs TYPE TABLE OF st_subtot_indexs.
DATA: wa_subtot_indexs LIKE LINE OF lt_subtot_indexs.
* data table after append subtotal
DATA: lt_excel TYPE REF TO data.
DATA: l_tabix TYPE i.
DATA: l_save_index TYPE i.
* dyn subtotal table name
DATA: l_collect TYPE string.
* subtotal range, to format subtotal (and total)
DATA: subranges TYPE soi_range_list.
DATA: subrangeitem TYPE soi_range_item.
DATA: l_sub_index TYPE i.
* table after append subtotal lines
FIELD-SYMBOLS: <f_excel_tab> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_excel_line> TYPE any.
* dyn subtotal tables
FIELD-SYMBOLS: <f_collect_tab> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <f_collect_line> TYPE any.
FIELD-SYMBOLS: <f_filter_idx_line> LIKE LINE OF lt_filter_idx_kkblo.
FIELD-SYMBOLS: <f_fieldcat_line> LIKE LINE OF lt_fieldcat_kkblo.
FIELD-SYMBOLS: <f_grouplevels_line> LIKE LINE OF lt_grouplevels_kkblo.
FIELD-SYMBOLS: <f_line> TYPE any.
* Data for session 3: map data to semantic table
* ------------------------------------------
TYPES: BEGIN OF st_column_index,
fieldname TYPE kkblo_fieldname,
tabname TYPE kkblo_tabname,
col LIKE sy-index,
END OF st_column_index.
* columns index
DATA: lt_column_index TYPE TABLE OF st_column_index.
DATA: wa_column_index LIKE LINE OF lt_column_index.
* table of dependent field ( currency and quantity unit field)
DATA: lt_fieldcat_depf TYPE kkblo_t_fieldcat.
DATA: wa_fieldcat_depf TYPE kkblo_fieldcat.
* XXL interface:
* -XXL: contain exporting columns characteristic
DATA: lt_sema TYPE TABLE OF gxxlt_s INITIAL SIZE 0.
DATA: wa_sema LIKE LINE OF lt_sema.
* -XXL interface: header
DATA: lt_hkey TYPE TABLE OF gxxlt_h INITIAL SIZE 0.
DATA: wa_hkey LIKE LINE OF lt_hkey.
* -XXL interface: header keys
DATA: lt_vkey TYPE TABLE OF gxxlt_v INITIAL SIZE 0.
DATA: wa_vkey LIKE LINE OF lt_vkey.
* Number of H Keys: number of key columns
DATA: l_n_hrz_keys TYPE i.
* Number of data columns in the list object: non-key columns no
DATA: l_n_att_cols TYPE i.
* Number of V Keys: number of header row
DATA: l_n_vrt_keys TYPE i.
* curency to format amount
DATA: lt_tcurx TYPE TABLE OF tcurx.
DATA: wa_tcurx LIKE LINE OF lt_tcurx.
DATA: l_def TYPE flag. " currency / quantity flag
DATA: wa_t006 TYPE t006. " decimal place of unit
DATA: l_num TYPE i. " table columns number
DATA: l_typ TYPE c. " table type
DATA: wa TYPE REF TO data.
DATA: l_int TYPE i.
DATA: l_counter TYPE i.
FIELD-SYMBOLS: <f_excel_column> TYPE any.
FIELD-SYMBOLS: <f_fcat_column> TYPE any.
* Data for session 4: write to excel
* ------------------------------------------
DATA: sema_type TYPE c.
DATA l_error TYPE REF TO c_oi_proxy_error.
DATA count TYPE i.
DATA datac TYPE i.
DATA datareal TYPE i. " exporting column number
DATA vkeycount TYPE i.
DATA all TYPE i.
DATA mit TYPE i VALUE 1. " index of recent row?
DATA li_col_pos TYPE i VALUE 1. " column position
DATA li_col_num TYPE i. " table columns number
FIELD-SYMBOLS: <line> TYPE any.
FIELD-SYMBOLS: <item> TYPE any.
DATA td TYPE sydes_desc.
DATA: typ.
DATA: ranges TYPE soi_range_list.
DATA: rangeitem TYPE soi_range_item.
DATA: contents TYPE soi_generic_table.
DATA: contentsitem TYPE soi_generic_item.
DATA: semaitem TYPE gxxlt_s.
DATA: hkeyitem TYPE gxxlt_h.
DATA: vkeyitem TYPE gxxlt_v.
DATA: li_commentary_rows TYPE i. "row number of title lines + 1
DATA: lo_error_w TYPE REF TO i_oi_error.
DATA: l_retcode TYPE soi_ret_string.
DATA: no_flush TYPE c VALUE 'X'.
DATA: li_head_top TYPE i. "header rows position
* Data for session 5: Save and clode document
* ------------------------------------------
DATA: li_document_size TYPE i.
DATA: ls_path TYPE rlgrap-filename.
* MACRO: Close_document
*-------------------------------------------
DEFINE close_document.
clear: l_is_closed.
if lo_proxy is not initial.
* check proxy detroyed adi
call method lo_proxy->is_destroyed
importing
ret_value = l_is_closed.
* if dun detroyed yet: close -> release proxy
if l_is_closed is initial.
call method lo_proxy->close_document
* EXPORTING
* do_save = do_save
importing
error = lo_error
retcode = lc_retcode.
endif.
call method lo_proxy->release_document
importing
error = lo_error
retcode = lc_retcode.
else.
lc_retcode = c_oi_errors=>ret_document_not_open.
endif.
* Detroy control container
if lo_control is not initial.
call method lo_control->destroy_control.
endif.
clear:
lo_spreadsheet,
lo_proxy,
lo_control.
* free local
clear: l_is_closed.
END-OF-DEFINITION.
* Macro to catch DOI error
*-------------------------------------------
DEFINE error_doi.
if lc_retcode ne c_oi_errors=>ret_ok.
close_document.
call method lo_error->raise_message
exporting
type = 'E'.
clear: lo_error.
endif.
END-OF-DEFINITION.
*--------------------------------------------------------------------*
* SESSION 0: DOI CONSTRUCTOR
*--------------------------------------------------------------------*
* check active windown
CALL FUNCTION 'GUI_HAS_ACTIVEX'
IMPORTING
return = l_has_activex.
IF l_has_activex IS INITIAL.
RAISE miss_guide.
ENDIF.
* Get Container Object of Screen
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = lo_control
retcode = lc_retcode.
error_doi.
* Initialize Container control
CALL METHOD lo_control->init_control
EXPORTING
parent = cl_gui_container=>default_screen
r3_application_name = ''
inplace_enabled = 'X'
no_flush = 'X'
register_on_close_event = 'X'
register_on_custom_event = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
* Get Proxy Document:
* check exist of document proxy, if exist -> close first
IF NOT lo_proxy IS INITIAL.
close_document.
ENDIF.
IF i_xls IS NOT INITIAL.
* xls format, doctype = soi_doctype_excel97_sheet
l_doctype_excel_sheet = 'Excel.Sheet.8'.
ELSE.
* xlsx format, doctype = soi_doctype_excel_sheet
l_doctype_excel_sheet = 'Excel.Sheet'.
ENDIF.
CALL METHOD lo_control->get_document_proxy
EXPORTING
document_type = l_doctype_excel_sheet
register_container = 'X'
IMPORTING
document_proxy = lo_proxy
error = lo_error
retcode = lc_retcode.
error_doi.
IF i_document_url IS INITIAL.
* create new excel document
CALL METHOD lo_proxy->create_document
EXPORTING
create_view_data = 'X'
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
ELSE.
* Read excel template for i_DOCUMENT_URL
* this excel template can be store in local or server
CALL METHOD lo_proxy->open_document
EXPORTING
document_url = i_document_url
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
ENDIF.
* Check Spreadsheet Interface of Document Proxy
CALL METHOD lo_proxy->has_spreadsheet_interface
IMPORTING
is_available = li_has
error = lo_error
retcode = lc_retcode.
error_doi.
* create Spreadsheet object
CHECK li_has IS NOT INITIAL.
CALL METHOD lo_proxy->get_spreadsheet_interface
IMPORTING
sheet_interface = lo_spreadsheet
error = lo_error
retcode = lc_retcode.
error_doi.
*--------------------------------------------------------------------*
* SESSION 1: GET LVC DATA FROM ALV OBJECT
*--------------------------------------------------------------------*
* data table
CREATE OBJECT lo_grid
EXPORTING
i_parent = cl_gui_container=>screen0.
CALL METHOD lo_grid->get_alv_attributes
EXPORTING
io_grid = io_alv
IMPORTING
et_table = lt_alv.
ASSIGN lt_alv->* TO <f_alv_tab>.
* fieldcat
CALL METHOD io_alv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fieldcat_lvc.
* table name
LOOP AT lt_fieldcat_lvc INTO wa_fieldcat_lvc
WHERE NOT tabname IS INITIAL.
l_tabname = wa_fieldcat_lvc-tabname.
EXIT.
ENDLOOP.
IF sy-subrc NE 0.
l_tabname = '1'.
ENDIF.
CLEAR: wa_fieldcat_lvc.
* sort table
CALL METHOD io_alv->get_sort_criteria
IMPORTING
et_sort = lt_sort_lvc.
* filter index
CALL METHOD io_alv->get_filtered_entries
IMPORTING
et_filtered_entries = lt_filter_idx_lvc.
* group level + subtotal
CALL METHOD io_alv->get_subtotals
IMPORTING
ep_collect00 = lt_collect00
ep_collect01 = lt_collect01
ep_collect02 = lt_collect02
ep_collect03 = lt_collect03
ep_collect04 = lt_collect04
ep_collect05 = lt_collect05
ep_collect06 = lt_collect06
ep_collect07 = lt_collect07
ep_collect08 = lt_collect08
ep_collect09 = lt_collect09
et_grouplevels = lt_grouplevels_lvc.
ASSIGN lt_collect00->* TO <f_collect00>.
ASSIGN lt_collect01->* TO <f_collect01>.
ASSIGN lt_collect02->* TO <f_collect02>.
ASSIGN lt_collect03->* TO <f_collect03>.
ASSIGN lt_collect04->* TO <f_collect04>.
ASSIGN lt_collect05->* TO <f_collect05>.
ASSIGN lt_collect06->* TO <f_collect06>.
ASSIGN lt_collect07->* TO <f_collect07>.
ASSIGN lt_collect08->* TO <f_collect08>.
ASSIGN lt_collect09->* TO <f_collect09>.
* transfer to KKBLO struct
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = lt_fieldcat_lvc
it_sort_lvc = lt_sort_lvc
it_filter_index_lvc = lt_filter_idx_lvc
it_grouplevels_lvc = lt_grouplevels_lvc
IMPORTING
et_fieldcat_kkblo = lt_fieldcat_kkblo
et_sort_kkblo = lt_sort_kkblo
et_filtered_entries_kkblo = lt_filter_idx_kkblo
et_grouplevels_kkblo = lt_grouplevels_kkblo
TABLES
it_data = <f_alv_tab>
EXCEPTIONS
it_data_missing = 1
it_fieldcat_lvc_missing = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE ex_transfer_kkblo_error.
ENDIF.
CLEAR:
wa_fieldcat_lvc,
lt_fieldcat_lvc,
lt_sort_lvc,
lt_filter_idx_lvc,
lt_grouplevels_lvc.
CLEAR:
lo_grid.
*--------------------------------------------------------------------*
* SESSION 2: SORT, FILTER AND CALCULATE TOTAL / SUBTOTAL
*--------------------------------------------------------------------*
* append subtotal & total line
CREATE DATA lt_excel LIKE <f_alv_tab>.
ASSIGN lt_excel->* TO <f_excel_tab>.
LOOP AT <f_alv_tab> ASSIGNING <f_line>.
l_save_index = sy-tabix.
* filter base on filter index table
READ TABLE lt_filter_idx_kkblo ASSIGNING <f_filter_idx_line>
WITH KEY index = l_save_index
BINARY SEARCH.
IF sy-subrc NE 0.
APPEND <f_line> TO <f_excel_tab>.
ENDIF.
* append subtotal lines
READ TABLE lt_grouplevels_kkblo ASSIGNING <f_grouplevels_line>
WITH KEY index_to = l_save_index
BINARY SEARCH.
IF sy-subrc = 0.
l_tabix = sy-tabix.
DO.
IF <f_grouplevels_line>-subtot EQ 'X' AND
<f_grouplevels_line>-hide_level IS INITIAL AND
<f_grouplevels_line>-cindex_from NE 0.
* dynamic append subtotal line to excel table base on grouplevel table
* ex <f_GROUPLEVELS_line>-level = 1
* then <f_collect_tab> = '<F_COLLECT01>'
l_collect = <f_grouplevels_line>-level.
CONDENSE l_collect.
CONCATENATE '<F_COLLECT0'
l_collect '>'
* '->*'
INTO l_collect.
ASSIGN (l_collect) TO <f_collect_tab>.
* incase there're more than 1 total line of group, at the same level
* for example: subtotal of multi currency
LOOP AT <f_collect_tab> ASSIGNING <f_collect_line>.
IF sy-tabix BETWEEN <f_grouplevels_line>-cindex_from
AND <f_grouplevels_line>-cindex_to.
APPEND <f_collect_line> TO <f_excel_tab>.
* save subtotal lines index
wa_subtot_indexs-index = sy-tabix.
APPEND wa_subtot_indexs TO lt_subtot_indexs.
* append sub total ranges table for format later
ADD 1 TO l_sub_index.
subrangeitem-name = l_sub_index.
CONDENSE subrangeitem-name.
CONCATENATE 'SUBTOT'
subrangeitem-name
INTO subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
APPEND subrangeitem TO subranges.
CLEAR: subrangeitem.
ENDIF.
ENDLOOP.
UNASSIGN: <f_collect_tab>.
UNASSIGN: <f_collect_line>.
CLEAR: l_collect.
ENDIF.
* check next subtotal level of group
UNASSIGN: <f_grouplevels_line>.
ADD 1 TO l_tabix.
READ TABLE lt_grouplevels_kkblo ASSIGNING <f_grouplevels_line>
INDEX l_tabix.
IF sy-subrc NE 0
OR <f_grouplevels_line>-index_to NE l_save_index.
EXIT.
ENDIF.
UNASSIGN:
<f_collect_tab>,
<f_collect_line>.
ENDDO.
ENDIF.
CLEAR:
l_tabix,
l_save_index.
UNASSIGN:
<f_filter_idx_line>,
<f_grouplevels_line>.
ENDLOOP.
* free local data
UNASSIGN:
<f_line>,
<f_collect_tab>,
<f_collect_line>,
<f_fieldcat_line>.
* append grand total line
IF <f_collect00> IS ASSIGNED.
ASSIGN <f_collect00> TO <f_collect_tab>.
IF <f_collect_tab> IS NOT INITIAL.
LOOP AT <f_collect_tab> ASSIGNING <f_collect_line>.
APPEND <f_collect_line> TO <f_excel_tab>.
* save total line index
wa_subtot_indexs-index = sy-tabix.
APPEND wa_subtot_indexs TO lt_subtot_indexs.
* append grand total range (to format)
ADD 1 TO l_sub_index.
subrangeitem-name = l_sub_index.
CONDENSE subrangeitem-name.
CONCATENATE 'TOTAL'
subrangeitem-name
INTO subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
APPEND subrangeitem TO subranges.
ENDLOOP.
ENDIF.
ENDIF.
CLEAR:
subrangeitem,
lt_sort_kkblo,
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>.
UNASSIGN:
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>,
<f_collect_tab>,
<f_collect_line>.
*--------------------------------------------------------------------*
* SESSION 3: MAP DATA TO SEMANTIC TABLE
*--------------------------------------------------------------------*
* get dependent field field: currency and quantity
CREATE DATA wa LIKE LINE OF <f_excel_tab>.
ASSIGN wa->* TO <f_excel_line>.
DESCRIBE FIELD <f_excel_line> TYPE l_typ COMPONENTS l_num.
DO l_num TIMES.
l_save_index = sy-index.
ASSIGN COMPONENT l_save_index OF STRUCTURE <f_excel_line>
TO <f_excel_column>.
IF sy-subrc NE 0.
MESSAGE 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 date_format TYPE usr01-datfm.
SELECT SINGLE datfm FROM usr01 INTO date_format WHERE bname = sy-uname.
DATA: comma_elim(4) TYPE c.
FIELD-SYMBOLS <g> TYPE any.
DATA search_item(4) VALUE ' #'.
CONCATENATE ',' decimal '.' decimal INTO comma_elim.
DATA help TYPE i. " table (with subtotal) line number
help = datac.
DATA: rowmax TYPE i VALUE 1. " header row number
DATA: columnmax TYPE i VALUE 0. " header columns number
LOOP AT lt_hkey INTO hkeyitem.
IF hkeyitem-col_no > columnmax.
columnmax = hkeyitem-col_no.
ENDIF.
IF hkeyitem-row_no > rowmax.
rowmax = hkeyitem-row_no.
ENDIF.
ENDLOOP.
DATA: hkeycolumns TYPE i. " header columns no
hkeycolumns = columnmax.
IF hkeycolumns < l_n_att_cols.
hkeycolumns = l_n_att_cols.
ENDIF.
columnmax = 0.
LOOP AT lt_vkey INTO vkeyitem.
IF vkeyitem-col_no > columnmax.
columnmax = vkeyitem-col_no.
ENDIF.
ENDLOOP.
DATA overflow TYPE i VALUE 1.
DATA testname(10) TYPE c.
DATA temp2 TYPE i. " 1st item row position in excel
DATA realmit TYPE i VALUE 1.
DATA realoverflow TYPE i VALUE 1. " row index in content
CALL METHOD lo_spreadsheet->screen_update
EXPORTING
updating = ''.
CALL METHOD lo_spreadsheet->load_lib.
DATA: str(40) TYPE c. " range names of columns range (w/o col header)
DATA: rows TYPE i. " row postion of 1st item line in ecxel
* calculate row position of data table
DESCRIBE TABLE it_listheader LINES li_commentary_rows.
* if grid had title, add 1 empy line between title and table
IF li_commentary_rows NE 0.
ADD 1 TO li_commentary_rows.
ENDIF.
* add top position of block data
li_commentary_rows = li_commentary_rows + i_top - 1.
* write header (commentary rows)
DATA: li_commentary_row_index TYPE i VALUE 1.
DATA: li_content_index TYPE i VALUE 1.
DATA: ls_index(10) TYPE c.
DATA ls_commentary_range(40) TYPE c VALUE 'TITLE'.
DATA: li_font_bold TYPE i.
DATA: li_font_italic TYPE i.
DATA: li_font_size TYPE i.
LOOP AT it_listheader INTO wa_listheader.
li_commentary_row_index = i_top + li_content_index - 1.
ls_index = li_content_index.
CONDENSE ls_index.
CONCATENATE ls_commentary_range(5) ls_index
INTO ls_commentary_range.
CONDENSE ls_commentary_range.
* insert title range
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = ls_commentary_range
top = li_commentary_row_index
left = i_left
rows = 1
columns = 1
no_flush = no_flush.
* format range
CASE wa_listheader-typ.
WHEN 'H'. "title
li_font_size = 16.
li_font_bold = 1.
li_font_italic = -1.
WHEN 'S'. "subtile
li_font_size = -1.
li_font_bold = 1.
li_font_italic = -1.
WHEN OTHERS. "'A' comment
li_font_size = -1.
li_font_bold = -1.
li_font_italic = 1.
ENDCASE.
CALL METHOD lo_spreadsheet->set_font
EXPORTING
rangename = ls_commentary_range
family = ''
size = li_font_size
bold = li_font_bold
italic = li_font_italic
align = 0
no_flush = no_flush.
* title: range content
rangeitem-name = ls_commentary_range.
rangeitem-columns = 1.
rangeitem-rows = 1.
APPEND rangeitem TO ranges.
contentsitem-row = li_content_index.
contentsitem-column = 1.
CONCATENATE wa_listheader-key
wa_listheader-info
INTO contentsitem-value
SEPARATED BY space.
CONDENSE contentsitem-value.
APPEND contentsitem TO contents.
ADD 1 TO li_content_index.
CLEAR:
rangeitem,
contentsitem,
ls_index.
ENDLOOP.
* set range data title
CALL METHOD lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
REFRESH:
ranges,
contents.
rows = rowmax + li_commentary_rows + 1.
all = date_format.
all = all + 3.
LOOP AT lt_sema INTO semaitem.
IF semaitem-col_typ = 'DAT' OR semaitem-col_typ = 'MON' OR
semaitem-col_typ = 'N00' OR semaitem-col_typ = 'N01' OR
semaitem-col_typ = 'N02' OR
semaitem-col_typ = 'N03' OR semaitem-col_typ = 'PCT' OR
semaitem-col_typ = 'STR' OR semaitem-col_typ = 'NUM'.
CLEAR str.
str = semaitem-col_no.
CONDENSE str.
CONCATENATE 'DATA' str INTO str.
mit = semaitem-col_no.
li_col_pos = semaitem-col_no + i_left - 1.
* range from data1 to data(n), for each columns of table
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = str
top = rows
left = li_col_pos
rows = help
columns = 1
no_flush = no_flush.
DATA dec TYPE i VALUE -1.
DATA typeinfo TYPE sydes_typeinfo.
LOOP AT <f_excel_tab> ASSIGNING <line>.
ASSIGN COMPONENT semaitem-col_no OF STRUCTURE <line> TO <item>.
DESCRIBE FIELD <item> INTO td.
READ TABLE td-types INDEX 1 INTO typeinfo.
IF typeinfo-type = 'P'.
dec = typeinfo-decimals.
ELSEIF typeinfo-type = 'I'.
dec = 0.
ENDIF.
DESCRIBE FIELD <line> TYPE typ COMPONENTS count.
mit = 1.
DO count TIMES.
IF mit = semaitem-col_src.
ASSIGN COMPONENT sy-index OF STRUCTURE <line> TO <item>.
DESCRIBE FIELD <item> INTO td.
READ TABLE td-types INDEX 1 INTO typeinfo.
IF typeinfo-type = 'P'.
dec = typeinfo-decimals.
ENDIF.
EXIT.
ENDIF.
mit = mit + 1.
ENDDO.
EXIT.
ENDLOOP.
* format for each columns of table (w/o columns headers)
IF semaitem-col_typ = 'DAT'.
IF semaitem-col_no > vkeycount.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = all
no_flush = no_flush.
ELSE.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
ENDIF.
ELSEIF semaitem-col_typ = 'STR'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'MON'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 10
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N00'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 0
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N01'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 1
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N02'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N03'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 3
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N04'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 4
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'NUM'.
IF dec EQ -1.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
ELSE.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = dec
no_flush = no_flush.
ENDIF.
ELSEIF semaitem-col_typ = 'PCT'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 3
decimals = 0
no_flush = no_flush.
ENDIF.
ENDIF.
ENDLOOP.
* get item contents for set_range_data method
* get currency cell also
mit = 1.
DATA: currcells TYPE soi_cell_table.
DATA: curritem TYPE soi_cell_item.
curritem-rows = 1.
curritem-columns = 1.
curritem-front = -1.
curritem-back = -1.
curritem-font = ''.
curritem-size = -1.
curritem-bold = -1.
curritem-italic = -1.
curritem-align = -1.
curritem-frametyp = -1.
curritem-framecolor = -1.
curritem-currency = ''.
curritem-number = 1.
curritem-input = -1.
DATA: const TYPE i.
* Change for Correction request
* Initial 10000 lines are missing in Excel Export
* if there are only 2 columns in exported List object.
IF datareal GT 2.
const = 20000 / datareal.
ELSE.
const = 20000 / ( datareal + 2 ).
ENDIF.
DATA: lines TYPE i.
DATA: innerlines TYPE i.
DATA: counter TYPE i.
DATA: curritem2 LIKE curritem.
DATA: curritem3 LIKE curritem.
DATA: length TYPE i.
DATA: found.
* append content table (for method set_range_content)
LOOP AT <f_excel_tab> ASSIGNING <line>.
* save line index to compare with lt_subtot_indexs,
* to discover line is a subtotal / totale line or not
* ex use to set 'dun display zero in subtotal / total line'
l_save_index = sy-tabix.
DO datareal TIMES.
READ TABLE lt_sema INTO semaitem WITH KEY col_no = sy-index.
IF semaitem-col_src NE 0.
ASSIGN COMPONENT semaitem-col_src
OF STRUCTURE <line> TO <item>.
ELSE.
ASSIGN COMPONENT sy-index
OF STRUCTURE <line> TO <item>.
ENDIF.
contentsitem-row = realoverflow.
IF sy-subrc = 0.
MOVE semaitem-col_ops TO search_item(3).
SEARCH 'ADD#CNT#MIN#MAX#AVG#NOP#DFT#'
FOR search_item.
IF sy-subrc NE 0.
RAISE error_in_sema.
ENDIF.
MOVE semaitem-col_typ TO search_item(3).
SEARCH 'NUM#N00#N01#N02#N03#N04#PCT#DAT#MON#STR#'
FOR search_item.
IF sy-subrc NE 0.
RAISE error_in_sema.
ENDIF.
contentsitem-column = sy-index.
IF semaitem-col_typ EQ 'DAT' OR semaitem-col_typ EQ 'MON'.
IF semaitem-col_no > vkeycount.
" Hinweis 512418
" EXCEL bezieht Datumsangaben
" auf den 31.12.1899, behandelt
" aber 1900 als ein Schaltjahr
" d.h. ab 1.3.1900 korrekt
" 1.3.1900 als Zahl = 61
DATA: genesis TYPE d VALUE '18991230'.
DATA: number_of_days TYPE p.
* change for date in char format & sema_type = X
DATA: temp_date TYPE d.
IF NOT <item> IS INITIAL AND NOT <item> CO ' ' AND NOT
<item> CO '0'.
* change for date in char format & sema_type = X starts
IF sema_type = 'X'.
DESCRIBE FIELD <item> TYPE typ.
IF typ = 'C'.
temp_date = <item>.
number_of_days = temp_date - genesis.
ELSE.
number_of_days = <item> - genesis.
ENDIF.
ELSE.
number_of_days = <item> - genesis.
ENDIF.
* change for date in char format & sema_type = X ends
IF number_of_days < 61.
number_of_days = number_of_days - 1.
ENDIF.
SET COUNTRY 'DE'.
WRITE number_of_days TO contentsitem-value
NO-GROUPING
LEFT-JUSTIFIED.
SET COUNTRY space.
TRANSLATE contentsitem-value USING comma_elim.
ELSE.
CLEAR contentsitem-value.
ENDIF.
ELSE.
MOVE <item> TO contentsitem-value.
ENDIF.
ELSEIF semaitem-col_typ EQ 'NUM' OR
semaitem-col_typ EQ 'N00' OR
semaitem-col_typ EQ 'N01' OR
semaitem-col_typ EQ 'N02' OR
semaitem-col_typ EQ 'N03' OR
semaitem-col_typ EQ 'N04' OR
semaitem-col_typ EQ 'PCT'.
SET COUNTRY 'DE'.
DESCRIBE FIELD <item> TYPE typ.
IF semaitem-col_cur IS INITIAL.
IF typ NE 'F'.
WRITE <item> TO contentsitem-value NO-GROUPING
NO-SIGN DECIMALS 14.
ELSE.
WRITE <item> TO contentsitem-value NO-GROUPING
NO-SIGN.
ENDIF.
ELSE.
* Treat of fixed curreny for column >>Y9CK007319
IF semaitem-col_cur < 0.
semaitem-col_cur = semaitem-col_cur * ( -1 ).
SELECT * FROM tcurx INTO TABLE lt_tcurx.
SORT lt_tcurx.
READ TABLE lt_tcurx INTO
wa_tcurx INDEX semaitem-col_cur.
IF sy-subrc = 0.
IF typ NE 'F'.
WRITE <item> TO contentsitem-value NO-GROUPING
CURRENCY wa_tcurx-currkey NO-SIGN DECIMALS 14.
ELSE.
WRITE <item> TO contentsitem-value NO-GROUPING
CURRENCY wa_tcurx-currkey NO-SIGN.
ENDIF.
ENDIF.
ELSE.
ASSIGN COMPONENT semaitem-col_cur
OF STRUCTURE <line> TO <g>.
* mit = index of recent row
curritem-top = rowmax + mit + li_commentary_rows.
li_col_pos = sy-index + i_left - 1.
curritem-left = li_col_pos.
* if filed is quantity field (qfieldname ne space)
* or amount field (cfieldname ne space), then format decimal place
* corresponding with config
CLEAR: l_def.
READ TABLE lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WITH KEY tabname = l_tabname
tech = space
no_out = space
col_pos = semaitem-col_no.
IF sy-subrc = 0.
IF <f_fieldcat_line>-cfieldname IS NOT INITIAL.
l_def = 'C'.
ELSE."if <f_fieldcat_line>-qfieldname is not initial.
l_def = 'Q'.
ENDIF.
ENDIF.
* if field is amount field
* exporting of amount field base on currency decimal table: TCURX
IF l_def = 'C'. "field is amount field
SELECT SINGLE * FROM tcurx INTO wa_tcurx
WHERE currkey = <g>.
* if amount ref to un-know currency -> default decimal = 2
IF sy-subrc EQ 0.
curritem-decimals = wa_tcurx-currdec.
ELSE.
curritem-decimals = 2.
ENDIF.
APPEND curritem TO currcells.
IF typ NE 'F'.
WRITE <item> TO contentsitem-value
CURRENCY <g>
NO-SIGN NO-GROUPING.
ELSE.
WRITE <item> TO contentsitem-value
DECIMALS 14 CURRENCY <g>
NO-SIGN NO-GROUPING.
ENDIF.
* if field is quantity field
* exporting of quantity field base on quantity decimal table: T006
ELSE."if l_def = 'Q'. " field is quantity field
CLEAR: wa_t006.
SELECT SINGLE * FROM t006 INTO wa_t006
WHERE msehi = <g>.
* if quantity ref to un-know unit-> default decimal = 2
IF sy-subrc EQ 0.
curritem-decimals = wa_t006-decan.
ELSE.
curritem-decimals = 2.
ENDIF.
APPEND curritem TO currcells.
WRITE <item> TO contentsitem-value
UNIT <g>
NO-SIGN NO-GROUPING.
CONDENSE contentsitem-value.
ENDIF.
ENDIF. "Y9CK007319
ENDIF.
CONDENSE contentsitem-value.
* add function fieldcat-no zero display
LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WHERE tabname = l_tabname
AND tech NE 'X'
AND no_out NE 'X'.
IF <f_fieldcat_line>-col_pos = semaitem-col_no.
IF <f_fieldcat_line>-no_zero = 'X'.
IF <item> = '0'.
CLEAR: contentsitem-value.
ENDIF.
* dun display zero in total/subtotal line too
ELSE.
CLEAR: wa_subtot_indexs.
READ TABLE lt_subtot_indexs INTO wa_subtot_indexs
WITH KEY index = l_save_index.
IF sy-subrc = 0 AND <item> = '0'.
CLEAR: contentsitem-value.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
UNASSIGN: <f_fieldcat_line>.
IF <item> LT 0.
SEARCH contentsitem-value FOR 'E'.
IF sy-fdpos EQ 0.
* use prefix notation for signed numbers
TRANSLATE contentsitem-value USING '- '.
CONDENSE contentsitem-value NO-GAPS.
CONCATENATE '-' contentsitem-value
INTO contentsitem-value.
ELSE.
CONCATENATE '-' contentsitem-value
INTO contentsitem-value.
ENDIF.
ENDIF.
SET COUNTRY space.
* Hier wird nur die korrekte Kommaseparatierung gemacht, wenn die
* Zeichen einer
* Zahl enthalten sind. Das ist für Timestamps, die auch ":" enthalten.
* Für die
* darf keine Kommaseparierung stattfinden.
* Changing for correction request - Y6BK041073
IF contentsitem-value CO '0123456789.,-+E '.
TRANSLATE contentsitem-value USING comma_elim.
ENDIF.
ELSE.
CLEAR contentsitem-value.
* if type is not numeric -> dun display with zero
WRITE <item> TO contentsitem-value NO-ZERO.
SHIFT contentsitem-value LEFT DELETING LEADING space.
ENDIF.
APPEND contentsitem TO contents.
ENDIF.
ENDDO.
realmit = realmit + 1.
realoverflow = realoverflow + 1.
mit = mit + 1.
* overflow = current row index in content table
overflow = overflow + 1.
ENDLOOP.
UNASSIGN: <f_fieldcat_line>.
* set item range for set_range_data method
testname = mit / const.
CONDENSE testname.
CONCATENATE 'TEST' testname INTO testname.
realoverflow = realoverflow - 1.
realmit = realmit - 1.
help = realoverflow.
rangeitem-name = testname.
rangeitem-columns = datareal.
rangeitem-rows = help.
APPEND rangeitem TO ranges.
* insert item range dim
temp2 = rowmax + 1 + li_commentary_rows + realmit - realoverflow.
* items data
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = testname
top = temp2
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* get columns header contents for set_range_data method
* export columns header only if no columns header option = space
DATA: rowcount TYPE i.
DATA: columncount TYPE i.
IF i_columns_header = 'X'.
* append columns header to contents: hkey
rowcount = 1.
DO rowmax TIMES.
columncount = 1.
DO hkeycolumns TIMES.
LOOP AT lt_hkey INTO hkeyitem WHERE col_no = columncount
AND row_no = rowcount.
ENDLOOP.
IF sy-subrc = 0.
str = hkeyitem-col_name.
contentsitem-value = hkeyitem-col_name.
ELSE.
contentsitem-value = str.
ENDIF.
contentsitem-column = columncount.
contentsitem-row = rowcount.
APPEND contentsitem TO contents.
columncount = columncount + 1.
ENDDO.
rowcount = rowcount + 1.
ENDDO.
* incase columns header in multiline
DATA: rowmaxtemp TYPE i.
IF rowmax > 1.
rowmaxtemp = rowmax - 1.
rowcount = 1.
DO rowmaxtemp TIMES.
columncount = 1.
DO columnmax TIMES.
contentsitem-column = columncount.
contentsitem-row = rowcount.
contentsitem-value = ''.
APPEND contentsitem TO contents.
columncount = columncount + 1.
ENDDO.
rowcount = rowcount + 1.
ENDDO.
ENDIF.
* append columns header to contents: vkey
columncount = 1.
DO columnmax TIMES.
LOOP AT lt_vkey INTO vkeyitem WHERE col_no = columncount.
ENDLOOP.
contentsitem-value = vkeyitem-col_name.
contentsitem-row = rowmax.
contentsitem-column = columncount.
APPEND contentsitem TO contents.
columncount = columncount + 1.
ENDDO.
*--------------------------------------------------------------------*
* set header range for method set_range_data
* insert header keys range dim
li_head_top = li_commentary_rows + 1.
li_col_pos = i_left.
* insert range headers
IF hkeycolumns NE 0.
rangeitem-name = 'TESTHKEY'.
rangeitem-rows = rowmax.
rangeitem-columns = hkeycolumns.
APPEND rangeitem TO ranges.
CLEAR: rangeitem.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = 'TESTHKEY'
top = li_head_top
left = li_col_pos
rows = rowmax
columns = hkeycolumns
no_flush = no_flush.
ENDIF.
ENDIF.
* format for columns header + total + subtotal
* ------------------------------------------
help = rowmax + realmit. " table + header lines
DATA: lt_format TYPE soi_format_table.
DATA: wa_format LIKE LINE OF lt_format.
DATA: wa_format_temp LIKE LINE OF lt_format.
FIELD-SYMBOLS: <f_source> TYPE any.
FIELD-SYMBOLS: <f_des> TYPE any.
* columns header format
wa_format-front = -1.
wa_format-back = 15. "grey
wa_format-font = space.
wa_format-size = -1.
wa_format-bold = 1.
wa_format-align = 0.
wa_format-frametyp = -1.
wa_format-framecolor = -1.
* get column header format from input record
* -> map input format
IF i_columns_header = 'X'.
wa_format-name = 'TESTHKEY'.
IF i_format_col_header IS NOT INITIAL.
DESCRIBE FIELD i_format_col_header TYPE l_typ COMPONENTS
li_col_num.
DO li_col_num TIMES.
IF sy-index NE 1. " dun map range name
ASSIGN COMPONENT sy-index OF STRUCTURE i_format_col_header
TO <f_source>.
IF <f_source> IS NOT INITIAL.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format TO <f_des>.
<f_des> = <f_source>.
UNASSIGN: <f_des>.
ENDIF.
UNASSIGN: <f_source>.
ENDIF.
ENDDO.
CLEAR: li_col_num.
ENDIF.
APPEND wa_format TO lt_format.
ENDIF.
* Zusammenfassen der Spalten mit gleicher Nachkommastellenzahl
* collect vertical cells (col) with the same number of decimal places
* to increase perfomance in currency cell format
DESCRIBE TABLE currcells LINES lines.
lines = lines - 1.
DO lines TIMES.
DESCRIBE TABLE currcells LINES innerlines.
innerlines = innerlines - 1.
SORT currcells BY left top.
CLEAR found.
DO innerlines TIMES.
READ TABLE currcells INDEX sy-index INTO curritem.
counter = sy-index + 1.
READ TABLE currcells INDEX counter INTO curritem2.
IF curritem-left EQ curritem2-left.
length = curritem-top + curritem-rows.
IF length EQ curritem2-top AND curritem-decimals EQ curritem2-decimals.
MOVE curritem TO curritem3.
curritem3-rows = curritem3-rows + curritem2-rows.
curritem-left = -1.
MODIFY currcells INDEX sy-index FROM curritem.
curritem2-left = -1.
MODIFY currcells INDEX counter FROM curritem2.
APPEND curritem3 TO currcells.
found = 'X'.
ENDIF.
ENDIF.
ENDDO.
IF found IS INITIAL.
EXIT.
ENDIF.
DELETE currcells WHERE left = -1.
ENDDO.
* Zusammenfassen der Zeilen mit gleicher Nachkommastellenzahl
* collect horizontal cells (row) with the same number of decimal places
* to increase perfomance in currency cell format
DESCRIBE TABLE currcells LINES lines.
lines = lines - 1.
DO lines TIMES.
DESCRIBE TABLE currcells LINES innerlines.
innerlines = innerlines - 1.
SORT currcells BY top left.
CLEAR found.
DO innerlines TIMES.
READ TABLE currcells INDEX sy-index INTO curritem.
counter = sy-index + 1.
READ TABLE currcells INDEX counter INTO curritem2.
IF curritem-top EQ curritem2-top AND curritem-rows EQ
curritem2-rows.
length = curritem-left + curritem-columns.
IF length EQ curritem2-left AND curritem-decimals EQ curritem2-decimals.
MOVE curritem TO curritem3.
curritem3-columns = curritem3-columns + curritem2-columns.
curritem-left = -1.
MODIFY currcells INDEX sy-index FROM curritem.
curritem2-left = -1.
MODIFY currcells INDEX counter FROM curritem2.
APPEND curritem3 TO currcells.
found = 'X'.
ENDIF.
ENDIF.
ENDDO.
IF found IS INITIAL.
EXIT.
ENDIF.
DELETE currcells WHERE left = -1.
ENDDO.
* Ende der Zusammenfassung
* item data: format for currency cell, corresponding with currency
CALL METHOD lo_spreadsheet->cell_format
EXPORTING
cells = currcells
no_flush = no_flush.
* item data: write item table content
CALL METHOD lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
* whole table range to format all table
IF i_columns_header = 'X'.
li_head_top = li_commentary_rows + 1.
ELSE.
li_head_top = li_commentary_rows + 2.
help = help - 1.
ENDIF.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = 'WHOLE_TABLE'
top = li_head_top
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* columns width auto fix
* this parameter = space in case use with exist template
IF i_columns_autofit = 'X'.
CALL METHOD lo_spreadsheet->fit_widest
EXPORTING
name = 'WHOLE_TABLE'
no_flush = no_flush.
ENDIF.
* frame
* The parameter has 8 bits
*0 Left margin
*1 Top marginT
*2 Bottom margin
*3 Right margin
*4 Horizontal line
*5 Vertical line
*6 Thinness
*7 Thickness
* here 127 = 1111111 6-5-4-3-2-1 mean Thin-ver-hor-right-bot-top-left
* ( final DOI method call, set no_flush = space
* equal to call method CL_GUI_CFW=>FLUSH )
CALL METHOD lo_spreadsheet->set_frame
EXPORTING
rangename = 'WHOLE_TABLE'
typ = 127
color = 1
no_flush = space
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi.
* reformat subtotal / total line after format wholw table
LOOP AT subranges INTO subrangeitem.
l_sub_index = subrangeitem-rows + li_commentary_rows + rowmax.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = subrangeitem-name
left = i_left
top = l_sub_index
rows = 1
columns = datareal
no_flush = no_flush.
wa_format-name = subrangeitem-name.
* default format:
* - clolor: subtotal = light yellow, subtotal = yellow
* - frame: box
IF subrangeitem-name(3) = 'SUB'.
wa_format-back = 36. "subtotal line
wa_format_temp = i_format_subtotal.
ELSE.
wa_format-back = 27. "total line
wa_format_temp = i_format_total.
ENDIF.
wa_format-frametyp = 79.
wa_format-framecolor = 1.
wa_format-number = -1.
wa_format-align = -1.
* get subtoal + total format from intput parameter
* overwrite default format
IF wa_format_temp IS NOT INITIAL.
DESCRIBE FIELD wa_format_temp TYPE l_typ COMPONENTS li_col_num.
DO li_col_num TIMES.
IF sy-index NE 1. " dun map range name
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format_temp
TO <f_source>.
IF <f_source> IS NOT INITIAL.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format TO <f_des>.
<f_des> = <f_source>.
UNASSIGN: <f_des>.
ENDIF.
UNASSIGN: <f_source>.
ENDIF.
ENDDO.
CLEAR: li_col_num.
ENDIF.
APPEND wa_format TO lt_format.
CLEAR: wa_format-name.
CLEAR: l_sub_index.
CLEAR: wa_format_temp.
ENDLOOP.
IF lt_format[] IS NOT INITIAL.
CALL METHOD lo_spreadsheet->set_ranges_format
EXPORTING
formattable = lt_format
no_flush = no_flush.
REFRESH: lt_format.
ENDIF.
*--------------------------------------------------------------------*
CALL METHOD lo_spreadsheet->screen_update
EXPORTING
updating = 'X'.
CALL METHOD c_oi_errors=>flush_errors.
lo_error_w = l_error.
lc_retcode = lo_error_w->error_code.
** catch no_flush -> led to dump ( optional )
* go_error = l_error.
* gc_retcode = go_error->error_code.
* error_doi.
CLEAR:
lt_sema,
wa_sema,
lt_hkey,
wa_hkey,
lt_vkey,
wa_vkey,
l_n_hrz_keys,
l_n_att_cols,
l_n_vrt_keys,
count,
datac,
datareal,
vkeycount,
all,
mit,
li_col_pos,
li_col_num,
ranges,
rangeitem,
contents,
contentsitem,
semaitem,
hkeyitem,
vkeyitem,
li_commentary_rows,
l_retcode,
li_head_top,
<f_excel_tab>.
CLEAR:
lo_error_w.
UNASSIGN:
<line>,
<item>,
<f_excel_tab>.
*--------------------------------------------------------------------*
* SESSION 5: SAVE AND CLOSE FILE
*--------------------------------------------------------------------*
* ex of save path: 'FILE://C:\temp\test.xlsx'
CONCATENATE 'FILE://' i_save_path
INTO ls_path.
CALL METHOD lo_proxy->save_document_to_url
EXPORTING
no_flush = 'X'
url = ls_path
IMPORTING
error = lo_error
retcode = lc_retcode
CHANGING
document_size = li_document_size.
error_doi.
* if save successfully -> raise successful message
* message 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,
ls_column_formula TYPE zcl_excel_worksheet=>mty_s_column_formula,
lv_mincol TYPE i.
FIELD-SYMBOLS:
<ls_field_catalog> TYPE zexcel_s_fieldcatalog,
<ls_field_catalog_custom> TYPE zexcel_s_fieldcatalog,
<fs_table_line> TYPE any,
<fs_fldval> TYPE any.
ls_settings = is_table_settings.
IF ls_settings-top_left_column IS INITIAL.
ls_settings-top_left_column = lc_top_left_column.
ENDIF.
IF ls_settings-table_style IS INITIAL.
ls_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ENDIF.
IF ls_settings-top_left_row IS INITIAL.
ls_settings-top_left_row = lc_top_left_row.
ENDIF.
IF it_field_catalog IS NOT SUPPLIED.
lt_field_catalog = zcl_excel_common=>get_fieldcatalog( ip_table = ip_table ).
ELSE.
lt_field_catalog = it_field_catalog.
ENDIF.
SORT lt_field_catalog BY position.
*--------------------------------------------------------------------*
* issue #237 Check if overlapping areas exist Start
*--------------------------------------------------------------------*
"Get the number of columns for the current table
lt_columns = lt_field_catalog.
DELETE lt_columns WHERE dynpfld NE abap_true.
DESCRIBE TABLE lt_columns LINES lv_columns.
"Calculate the top left row of the current table
lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ).
lv_row_int = ls_settings-top_left_row.
"Get number of row for the current table
DESCRIBE TABLE ip_table LINES lv_rows.
"Calculate the bottom right row for the current table
lv_maxcol = lv_column_int + lv_columns - 1.
lv_maxrow = lv_row_int + lv_rows - 1.
ls_settings-bottom_right_column = zcl_excel_common=>convert_column2alpha( lv_maxcol ).
ls_settings-bottom_right_row = lv_maxrow.
lv_column_int = zcl_excel_common=>convert_column2int( ls_settings-top_left_column ).
lv_mincol = lv_column_int.
lo_iterator = me->tables->get_iterator( ).
WHILE lo_iterator->has_next( ) EQ abap_true.
lo_curtable ?= lo_iterator->get_next( ).
IF ( ( ls_settings-top_left_row GE lo_curtable->settings-top_left_row AND ls_settings-top_left_row LE lo_curtable->settings-bottom_right_row )
OR
( ls_settings-bottom_right_row GE lo_curtable->settings-top_left_row AND ls_settings-bottom_right_row LE lo_curtable->settings-bottom_right_row )
)
AND
( ( lv_column_int GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_column_int LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) )
OR
( lv_maxcol GE zcl_excel_common=>convert_column2int( lo_curtable->settings-top_left_column ) AND lv_maxcol LE zcl_excel_common=>convert_column2int( lo_curtable->settings-bottom_right_column ) )
).
lv_errormessage = 'Table overlaps with previously bound table and will not be added to worksheet.'(400).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
ENDWHILE.
*--------------------------------------------------------------------*
* issue #237 Check if overlapping areas exist End
*--------------------------------------------------------------------*
CREATE OBJECT lo_table.
lo_table->settings = ls_settings.
lo_table->set_data( ir_data = ip_table ).
lv_id = me->excel->get_next_table_id( ).
lo_table->set_id( iv_id = lv_id ).
* lo_table->fieldcat = lt_field_catalog[].
me->tables->add( lo_table ).
* It is better to loop column by column (only visible column)
LOOP AT lt_field_catalog ASSIGNING <ls_field_catalog> WHERE dynpfld EQ abap_true.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lv_column_int ).
" Due restrinction of new table object we cannot have two column with the same name
" Check if a column with the same name exists, if exists add a counter
" If no medium description is provided we try to use small or long
* lv_value = <ls_field_catalog>-scrtext_m.
FIELD-SYMBOLS: <scrtxt1> TYPE any,
<scrtxt2> TYPE any,
<scrtxt3> TYPE any.
CASE iv_default_descr.
WHEN 'M'.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
WHEN 'S'.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
WHEN 'L'.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt3>.
WHEN OTHERS.
ASSIGN <ls_field_catalog>-scrtext_m TO <scrtxt1>.
ASSIGN <ls_field_catalog>-scrtext_s TO <scrtxt2>.
ASSIGN <ls_field_catalog>-scrtext_l TO <scrtxt3>.
ENDCASE.
IF <scrtxt1> IS NOT INITIAL.
lv_value = <scrtxt1>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSEIF <scrtxt2> IS NOT INITIAL.
lv_value = <scrtxt2>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSEIF <scrtxt3> IS NOT INITIAL.
lv_value = <scrtxt3>.
<ls_field_catalog>-scrtext_l = lv_value.
ELSE.
lv_value = 'Column'. " default value as Excel does
<ls_field_catalog>-scrtext_l = lv_value.
ENDIF.
WHILE 1 = 1.
lv_value_lowercase = lv_value.
TRANSLATE lv_value_lowercase TO LOWER CASE.
READ TABLE lt_column_name_buffer TRANSPORTING NO FIELDS WITH KEY table_line = lv_value_lowercase BINARY SEARCH.
IF sy-subrc <> 0.
<ls_field_catalog>-scrtext_l = lv_value.
INSERT lv_value_lowercase INTO TABLE lt_column_name_buffer.
EXIT.
ELSE.
lv_syindex = sy-index.
CONCATENATE <ls_field_catalog>-scrtext_l lv_syindex INTO lv_value.
ENDIF.
ENDWHILE.
" First of all write column header
IF <ls_field_catalog>-style_header IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_value
ip_style = <ls_field_catalog>-style_header ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = lv_value ).
ENDIF.
IF <ls_field_catalog>-column_formula IS NOT INITIAL.
ls_column_formula-id = lines( column_formulas ) + 1.
ls_column_formula-column = lv_column_int.
ls_column_formula-formula = <ls_field_catalog>-column_formula.
ls_column_formula-table_top_left_row = lo_table->settings-top_left_row.
ls_column_formula-table_bottom_right_row = lo_table->settings-bottom_right_row.
ls_column_formula-table_left_column_int = lv_mincol.
ls_column_formula-table_right_column_int = lv_maxcol.
INSERT ls_column_formula INTO TABLE column_formulas.
ENDIF.
ADD 1 TO lv_row_int.
LOOP AT ip_table ASSIGNING <fs_table_line>.
ASSIGN COMPONENT <ls_field_catalog>-fieldname OF STRUCTURE <fs_table_line> TO <fs_fldval>.
" issue #290 Add formula support in table
IF <ls_field_catalog>-formula EQ abap_true.
IF <ls_field_catalog>-style IS NOT INITIAL.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_abap_type = <ls_field_catalog>-abap_type
ip_style = <ls_field_catalog>-style ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_style = <ls_field_catalog>-style ).
ENDIF.
ELSEIF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval>
ip_abap_type = <ls_field_catalog>-abap_type ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = <fs_fldval> ).
ENDIF.
ELSEIF <ls_field_catalog>-column_formula IS NOT INITIAL.
" Column formulas
IF <ls_field_catalog>-style IS NOT INITIAL.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_column_formula_id = ls_column_formula-id
ip_abap_type = <ls_field_catalog>-abap_type
ip_style = <ls_field_catalog>-style ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_column_formula_id = ls_column_formula-id
ip_style = <ls_field_catalog>-style ).
ENDIF.
ELSEIF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_column_formula_id = ls_column_formula-id
ip_abap_type = <ls_field_catalog>-abap_type ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_column_formula_id = ls_column_formula-id ).
ENDIF.
ELSE.
IF <ls_field_catalog>-style IS NOT INITIAL.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval>
ip_abap_type = <ls_field_catalog>-abap_type
ip_style = <ls_field_catalog>-style ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval>
ip_style = <ls_field_catalog>-style ).
ENDIF.
ELSE.
IF <ls_field_catalog>-abap_type IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_abap_type = <ls_field_catalog>-abap_type
ip_value = <fs_fldval> ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = <fs_fldval> ).
ENDIF.
ENDIF.
ENDIF.
ADD 1 TO lv_row_int.
ENDLOOP.
IF sy-subrc <> 0 AND iv_no_line_if_empty = abap_false. "create empty row if table has no data
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_value = space ).
ADD 1 TO lv_row_int.
ENDIF.
*--------------------------------------------------------------------*
" totals
*--------------------------------------------------------------------*
IF <ls_field_catalog>-totals_function IS NOT INITIAL.
lv_formula = lo_table->get_totals_formula( ip_column = <ls_field_catalog>-scrtext_l ip_function = <ls_field_catalog>-totals_function ).
IF <ls_field_catalog>-style_total IS NOT INITIAL.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = lv_formula
ip_style = <ls_field_catalog>-style_total ).
ELSE.
me->set_cell( ip_column = lv_column_alpha
ip_row = lv_row_int
ip_formula = lv_formula ).
ENDIF.
ENDIF.
lv_row_int = ls_settings-top_left_row.
ADD 1 TO lv_column_int.
*--------------------------------------------------------------------*
" conditional formatting
*--------------------------------------------------------------------*
IF <ls_field_catalog>-style_cond IS NOT INITIAL.
lv_first_row = ls_settings-top_left_row + 1. " +1 to exclude header
lv_last_row = ls_settings-top_left_row + lv_rows.
lo_style_cond = me->get_style_cond( <ls_field_catalog>-style_cond ).
lo_style_cond->set_range( ip_start_column = lv_column_alpha
ip_start_row = lv_first_row
ip_stop_column = lv_column_alpha
ip_stop_row = lv_last_row ).
ENDIF.
ENDLOOP.
*--------------------------------------------------------------------*
" Set field catalog
*--------------------------------------------------------------------*
lo_table->fieldcat = lt_field_catalog[].
es_table_settings = ls_settings.
es_table_settings-bottom_right_column = lv_column_alpha.
" >> Issue #291
IF ip_table IS INITIAL.
es_table_settings-bottom_right_row = ls_settings-top_left_row + 2. "Last rows
ELSE.
es_table_settings-bottom_right_row = ls_settings-top_left_row + lv_rows + 1. "Last rows
ENDIF.
" << Issue #291
ENDMETHOD. "BIND_TABLE
METHOD calculate_cell_width.
*--------------------------------------------------------------------*
* issue #293 - Roberto Bianco
* - Christian Assig 2014-03-14
*
* changes: - Calculate widths using SAPscript font metrics
* (transaction SE73)
* - Calculate the width of dates
* - Add additional width for auto filter buttons
* - Add cell padding to simulate Excel behavior
*--------------------------------------------------------------------*
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 check_cell_column_formula.
FIELD-SYMBOLS <fs_column_formula> TYPE zcl_excel_worksheet=>mty_s_column_formula.
IF ip_value IS NOT INITIAL OR ip_formula IS NOT INITIAL.
zcx_excel=>raise_text( c_messages-formula_id_only_is_possible ).
ENDIF.
READ TABLE it_column_formulas WITH TABLE KEY id = ip_column_formula_id ASSIGNING <fs_column_formula>.
IF sy-subrc <> 0.
zcx_excel=>raise_text( c_messages-column_formula_id_not_found ).
ENDIF.
IF ip_row < <fs_column_formula>-table_top_left_row + 1
OR ip_row > <fs_column_formula>-table_bottom_right_row + 1
OR ip_column < <fs_column_formula>-table_left_column_int
OR ip_column > <fs_column_formula>-table_right_column_int.
zcx_excel=>raise_text( c_messages-formula_not_in_this_table ).
ENDIF.
IF ip_column <> <fs_column_formula>-column.
zcx_excel=>raise_text( c_messages-formula_in_other_column ).
ENDIF.
ENDMETHOD.
METHOD 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_ignored_errors.
rt_ignored_errors = mt_ignored_errors.
ENDMETHOD.
METHOD get_merge.
FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells.
DATA: lv_col_from TYPE string,
lv_col_to TYPE string,
lv_row_from TYPE string,
lv_row_to TYPE string,
lv_merge_range TYPE string.
LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>.
lv_col_from = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_from ).
lv_col_to = zcl_excel_common=>convert_column2alpha( <ls_merged_cell>-col_to ).
lv_row_from = <ls_merged_cell>-row_from.
lv_row_to = <ls_merged_cell>-row_to .
CONCATENATE lv_col_from lv_row_from ':' lv_col_to lv_row_to
INTO lv_merge_range.
CONDENSE lv_merge_range NO-GAPS.
APPEND lv_merge_range TO merge_range.
ENDLOOP.
ENDMETHOD. "GET_MERGE
METHOD get_pagebreaks.
ro_pagebreaks = mo_pagebreaks.
ENDMETHOD. "GET_PAGEBREAKS
METHOD get_ranges_iterator.
eo_iterator = me->ranges->get_iterator( ).
ENDMETHOD. "GET_RANGES_ITERATOR
METHOD get_row.
eo_row = me->rows->get( ip_index = ip_row ).
IF eo_row IS NOT BOUND.
eo_row = me->add_new_row( ip_row ).
ENDIF.
ENDMETHOD. "GET_ROW
METHOD get_rows.
eo_rows = me->rows.
ENDMETHOD. "GET_ROWS
METHOD get_rows_iterator.
eo_iterator = me->rows->get_iterator( ).
ENDMETHOD. "GET_ROWS_ITERATOR
METHOD get_row_outlines.
rt_row_outlines = me->mt_row_outlines.
ENDMETHOD. "GET_ROW_OUTLINES
METHOD get_style_cond.
DATA: lo_style_iterator TYPE REF TO cl_object_collection_iterator,
lo_style_cond TYPE REF TO zcl_excel_style_cond.
lo_style_iterator = me->get_style_cond_iterator( ).
WHILE lo_style_iterator->has_next( ) = abap_true.
lo_style_cond ?= lo_style_iterator->get_next( ).
IF lo_style_cond->get_guid( ) = ip_guid.
eo_style_cond = lo_style_cond.
EXIT.
ENDIF.
ENDWHILE.
ENDMETHOD. "GET_STYLE_COND
METHOD get_style_cond_iterator.
eo_iterator = styles_cond->get_iterator( ).
ENDMETHOD. "GET_STYLE_COND_ITERATOR
METHOD get_tabcolor.
ev_tabcolor = me->tabcolor.
ENDMETHOD. "GET_TABCOLOR
METHOD get_table.
*--------------------------------------------------------------------*
* Comment D. Rauchenstein
* With this method, we get a fully functional Excel Upload, which solves
* a few issues of the other excel upload tools
* ZBCABA_ALSM_EXCEL_UPLOAD_EXT: Reads only up to 50 signs per Cell, Limit
* in row-Numbers. Other have Limitations of Lines, or you are not able
* to ignore filters or choosing the right tab.
*
* To get a fully functional XLSX Upload, you can use it e.g. with method
* CL_EXCEL_READER_2007->ZIF_EXCEL_READER~LOAD_FILE()
*--------------------------------------------------------------------*
FIELD-SYMBOLS: <ls_line> TYPE data.
FIELD-SYMBOLS: <lv_value> TYPE data.
DATA lv_actual_row TYPE int4.
DATA lv_actual_row_string TYPE string.
DATA lv_actual_col TYPE int4.
DATA lv_actual_col_string TYPE string.
DATA lv_errormessage TYPE string.
DATA lv_max_col TYPE zexcel_cell_column.
DATA lv_max_row TYPE int4.
DATA lv_delta_col TYPE int4.
DATA lv_value TYPE zexcel_cell_value.
DATA lv_rc TYPE sysubrc.
DATA lx_conversion_error TYPE REF TO cx_sy_conversion_error.
DATA lv_float TYPE f.
DATA lv_type.
lv_max_col = me->get_highest_column( ).
IF iv_max_col IS SUPPLIED AND iv_max_col < lv_max_col.
lv_max_col = iv_max_col.
ENDIF.
lv_max_row = me->get_highest_row( ).
IF iv_max_row IS SUPPLIED AND iv_max_row < lv_max_row.
lv_max_row = iv_max_row.
ENDIF.
*--------------------------------------------------------------------*
* The row counter begins with 1 and should be corrected with the skips
*--------------------------------------------------------------------*
lv_actual_row = iv_skipped_rows + 1.
lv_actual_col = iv_skipped_cols + 1.
TRY.
*--------------------------------------------------------------------*
* Check if we the basic features are possible with given "any table"
*--------------------------------------------------------------------*
APPEND INITIAL LINE TO et_table ASSIGNING <ls_line>.
IF sy-subrc <> 0 OR <ls_line> IS NOT ASSIGNED.
lv_errormessage = 'Error at inserting new Line to internal Table'(002).
zcx_excel=>raise_text( lv_errormessage ).
ELSE.
lv_delta_col = lv_max_col - iv_skipped_cols.
ASSIGN COMPONENT lv_delta_col OF STRUCTURE <ls_line> TO <lv_value>.
IF sy-subrc <> 0 OR <lv_value> IS NOT ASSIGNED.
lv_errormessage = 'Internal table has less columns than excel'(003).
zcx_excel=>raise_text( lv_errormessage ).
ELSE.
*--------------------------------------------------------------------*
*now we are ready for handle the table data
*--------------------------------------------------------------------*
REFRESH et_table.
*--------------------------------------------------------------------*
* Handle each Row until end on right side
*--------------------------------------------------------------------*
WHILE lv_actual_row <= lv_max_row .
*--------------------------------------------------------------------*
* Handle each Column until end on bottom
* First step is to step back on first column
*--------------------------------------------------------------------*
lv_actual_col = iv_skipped_cols + 1.
UNASSIGN <ls_line>.
APPEND INITIAL LINE TO et_table ASSIGNING <ls_line>.
IF sy-subrc <> 0 OR <ls_line> IS NOT ASSIGNED.
lv_errormessage = 'Error at inserting new Line to internal Table'(002).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
WHILE lv_actual_col <= lv_max_col.
lv_delta_col = lv_actual_col - iv_skipped_cols.
ASSIGN COMPONENT lv_delta_col OF STRUCTURE <ls_line> TO <lv_value>.
IF sy-subrc <> 0.
lv_actual_col_string = lv_actual_col.
lv_actual_row_string = lv_actual_row.
CONCATENATE 'Error at assigning field (Col:'(004) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage.
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
me->get_cell(
EXPORTING
ip_column = lv_actual_col " Cell Column
ip_row = lv_actual_row " Cell Row
IMPORTING
ep_value = lv_value " Cell Value
ep_rc = lv_rc " Return Value of ABAP Statements
).
IF lv_rc <> 0
AND lv_rc <> 4 "No found error means, zero/no value in cell
AND lv_rc <> 8. "rc is 8 when the last row contains cells with zero / no values
lv_actual_col_string = lv_actual_col.
lv_actual_row_string = lv_actual_row.
CONCATENATE 'Error at reading field value (Col:'(007) lv_actual_col_string ' Row:'(005) lv_actual_row_string INTO lv_errormessage.
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
TRY.
<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->get_iterator( ).
ENDMETHOD. "GET_TABLES_ITERATOR
METHOD get_tables_size.
ep_size = tables->size( ).
ENDMETHOD. "GET_TABLES_SIZE
METHOD get_title.
DATA lv_value TYPE string.
IF ip_escaped EQ abap_true.
lv_value = me->title.
ep_title = zcl_excel_common=>escape_string( lv_value ).
ELSE.
ep_title = me->title.
ENDIF.
ENDMETHOD. "GET_TITLE
METHOD get_value_type.
DATA: lo_addit TYPE REF TO cl_abap_elemdescr,
ls_dfies TYPE dfies,
l_function TYPE funcname,
l_value(50) TYPE c.
ep_value = ip_value.
ep_value_type = cl_abap_typedescr=>typekind_string. " Thats our default if something goes wrong.
TRY.
lo_addit ?= cl_abap_typedescr=>describe_by_data( ip_value ).
CATCH cx_sy_move_cast_error.
CLEAR lo_addit.
ENDTRY.
IF lo_addit IS BOUND.
lo_addit->get_ddic_field( RECEIVING p_flddescr = ls_dfies
EXCEPTIONS not_found = 1
no_ddic_type = 2
OTHERS = 3 ) .
IF sy-subrc = 0.
ep_value_type = ls_dfies-inttype.
IF ls_dfies-convexit IS NOT INITIAL.
* We need to convert with output conversion function
CONCATENATE 'CONVERSION_EXIT_' ls_dfies-convexit '_OUTPUT' INTO l_function.
SELECT SINGLE funcname INTO l_function
FROM tfdir
WHERE funcname = l_function.
IF sy-subrc = 0.
CALL FUNCTION l_function
EXPORTING
input = ip_value
IMPORTING
* LONG_TEXT =
output = l_value
* SHORT_TEXT =
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
TRY.
ep_value = l_value.
CATCH cx_root.
ep_value = ip_value.
ENDTRY.
ENDIF.
ENDIF.
ENDIF.
ELSE.
ep_value_type = lo_addit->get_data_type_kind( ip_value ).
ENDIF.
ENDIF.
ENDMETHOD. "GET_VALUE_TYPE
METHOD is_cell_merged.
DATA: lv_column TYPE i.
FIELD-SYMBOLS: <ls_merged_cell> LIKE LINE OF me->mt_merged_cells.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
rp_is_merged = abap_false. " Assume not in merged area
LOOP AT me->mt_merged_cells ASSIGNING <ls_merged_cell>.
IF <ls_merged_cell>-col_from <= lv_column
AND <ls_merged_cell>-col_to >= lv_column
AND <ls_merged_cell>-row_from <= ip_row
AND <ls_merged_cell>-row_to >= ip_row.
rp_is_merged = abap_true. " until we are proven different
RETURN.
ENDIF.
ENDLOOP.
ENDMETHOD. "IS_CELL_MERGED
METHOD print_title_set_range.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmoecker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lo_range_iterator TYPE REF TO cl_object_collection_iterator,
lo_range TYPE REF TO zcl_excel_range,
lv_repeat_range_sheetname TYPE string,
lv_repeat_range_col TYPE string,
lv_row_char_from TYPE char10,
lv_row_char_to TYPE char10,
lv_repeat_range_row TYPE string,
lv_repeat_range TYPE string.
*--------------------------------------------------------------------*
* Get range that represents printarea
* if non-existant, create it
*--------------------------------------------------------------------*
lo_range_iterator = me->get_ranges_iterator( ).
WHILE lo_range_iterator->has_next( ) = abap_true.
lo_range ?= lo_range_iterator->get_next( ).
IF lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name.
EXIT. " Found it
ENDIF.
CLEAR lo_range.
ENDWHILE.
IF me->print_title_col_from IS INITIAL AND
me->print_title_row_from IS INITIAL.
*--------------------------------------------------------------------*
* No print titles are present,
*--------------------------------------------------------------------*
IF lo_range IS BOUND.
me->ranges->remove( lo_range ).
ENDIF.
ELSE.
*--------------------------------------------------------------------*
* Print titles are present,
*--------------------------------------------------------------------*
IF lo_range IS NOT BOUND.
lo_range = me->add_new_range( ).
lo_range->name = zif_excel_sheet_printsettings=>gcv_print_title_name.
ENDIF.
lv_repeat_range_sheetname = me->get_title( ).
lv_repeat_range_sheetname = zcl_excel_common=>escape_string( lv_repeat_range_sheetname ).
*--------------------------------------------------------------------*
* Repeat-columns
*--------------------------------------------------------------------*
IF me->print_title_col_from IS NOT INITIAL.
CONCATENATE lv_repeat_range_sheetname
'!$' me->print_title_col_from
':$' me->print_title_col_to
INTO lv_repeat_range_col.
ENDIF.
*--------------------------------------------------------------------*
* Repeat-rows
*--------------------------------------------------------------------*
IF me->print_title_row_from IS NOT INITIAL.
lv_row_char_from = me->print_title_row_from.
lv_row_char_to = me->print_title_row_to.
CONCATENATE '!$' lv_row_char_from
':$' lv_row_char_to
INTO lv_repeat_range_row.
CONDENSE lv_repeat_range_row NO-GAPS.
CONCATENATE lv_repeat_range_sheetname
lv_repeat_range_row
INTO lv_repeat_range_row.
ENDIF.
*--------------------------------------------------------------------*
* Concatenate repeat-rows and columns
*--------------------------------------------------------------------*
IF lv_repeat_range_col IS INITIAL.
lv_repeat_range = lv_repeat_range_row.
ELSEIF lv_repeat_range_row IS INITIAL.
lv_repeat_range = lv_repeat_range_col.
ELSE.
CONCATENATE lv_repeat_range_col lv_repeat_range_row
INTO lv_repeat_range SEPARATED BY ','.
ENDIF.
lo_range->set_range_value( lv_repeat_range ).
ENDIF.
ENDMETHOD. "PRINT_TITLE_SET_RANGE
METHOD set_area.
DATA: lv_row TYPE zexcel_cell_row,
lv_row_end TYPE zexcel_cell_row,
lv_column_start TYPE zexcel_cell_column_alpha,
lv_column_end TYPE zexcel_cell_column_alpha,
lv_column_start_int TYPE zexcel_cell_column_alpha,
lv_column_end_int TYPE zexcel_cell_column_alpha.
MOVE: ip_row_to TO lv_row_end,
ip_row TO lv_row.
IF lv_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED.
lv_row_end = lv_row.
ENDIF.
MOVE: ip_column_start TO lv_column_start,
ip_column_end TO lv_column_end.
IF lv_column_end IS INITIAL OR ip_column_end IS NOT SUPPLIED.
lv_column_end = lv_column_start.
ENDIF.
lv_column_start_int = zcl_excel_common=>convert_column2int( lv_column_start ).
lv_column_end_int = zcl_excel_common=>convert_column2int( lv_column_end ).
IF lv_column_start_int > lv_column_end_int OR lv_row > lv_row_end.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Wrong Merging Parameters'.
ENDIF.
IF ip_data_type IS SUPPLIED OR
ip_abap_type IS SUPPLIED.
me->set_cell( ip_column = lv_column_start
ip_row = lv_row
ip_value = ip_value
ip_formula = ip_formula
ip_style = ip_style
ip_hyperlink = ip_hyperlink
ip_data_type = ip_data_type
ip_abap_type = ip_abap_type ).
ELSE.
me->set_cell( ip_column = lv_column_start
ip_row = lv_row
ip_value = ip_value
ip_formula = ip_formula
ip_style = ip_style
ip_hyperlink = ip_hyperlink ).
ENDIF.
IF ip_style IS SUPPLIED.
me->set_area_style( ip_column_start = lv_column_start
ip_column_end = lv_column_end
ip_row = lv_row
ip_row_to = lv_row_end
ip_style = ip_style ).
ENDIF.
IF ip_merge IS SUPPLIED AND ip_merge = abap_true.
me->set_merge( ip_column_start = lv_column_start
ip_column_end = lv_column_end
ip_row = lv_row
ip_row_to = lv_row_end ).
ENDIF.
ENDMETHOD. "set_area
METHOD set_area_formula.
DATA: ld_row TYPE zexcel_cell_row,
ld_row_end TYPE zexcel_cell_row,
ld_column TYPE zexcel_cell_column_alpha,
ld_column_end TYPE zexcel_cell_column_alpha,
ld_column_int TYPE zexcel_cell_column_alpha,
ld_column_end_int TYPE zexcel_cell_column_alpha.
MOVE: ip_row_to TO ld_row_end,
ip_row TO ld_row.
IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED.
ld_row_end = ld_row.
ENDIF.
MOVE: ip_column_start TO ld_column,
ip_column_end TO ld_column_end.
IF ld_column_end IS INITIAL OR ip_column_end IS NOT SUPPLIED.
ld_column_end = ld_column.
ENDIF.
ld_column_int = zcl_excel_common=>convert_column2int( ld_column ).
ld_column_end_int = zcl_excel_common=>convert_column2int( ld_column_end ).
IF ld_column_int > ld_column_end_int OR ld_row > ld_row_end.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
error = 'Wrong Merging Parameters'.
ENDIF.
me->set_cell_formula( ip_column = ld_column ip_row = ld_row
ip_formula = ip_formula ).
IF ip_merge IS SUPPLIED AND ip_merge = abap_true.
me->set_merge( ip_column_start = ld_column ip_row = ld_row
ip_column_end = ld_column_end ip_row_to = ld_row_end ).
ENDIF.
ENDMETHOD. "set_area_formula
METHOD set_area_style.
DATA: ld_row_start TYPE zexcel_cell_row,
ld_row_end TYPE zexcel_cell_row,
ld_column_start_int TYPE zexcel_cell_column,
ld_column_end_int TYPE zexcel_cell_column,
ld_current_column TYPE zexcel_cell_column_alpha,
ld_current_row TYPE zexcel_cell_row.
MOVE: ip_row_to TO ld_row_end,
ip_row TO ld_row_start.
IF ld_row_end IS INITIAL OR ip_row_to IS NOT SUPPLIED.
ld_row_end = ld_row_start.
ENDIF.
ld_column_start_int = zcl_excel_common=>convert_column2int( ip_column_start ).
ld_column_end_int = zcl_excel_common=>convert_column2int( ip_column_end ).
IF ld_column_end_int IS INITIAL OR ip_column_end IS NOT SUPPLIED.
ld_column_end_int = ld_column_start_int.
ENDIF.
WHILE ld_column_start_int <= ld_column_end_int.
ld_current_column = zcl_excel_common=>convert_column2alpha( ld_column_start_int ).
ld_current_row = ld_row_start.
WHILE ld_current_row <= ld_row_end.
me->set_cell_style( ip_row = ld_current_row ip_column = ld_current_column
ip_style = ip_style ).
ADD 1 TO ld_current_row.
ENDWHILE.
ADD 1 TO ld_column_start_int.
ENDWHILE.
IF ip_merge IS SUPPLIED AND ip_merge = abap_true.
me->set_merge( ip_column_start = ip_column_start ip_row = ld_row_start
ip_column_end = ld_current_column ip_row_to = ld_row_end ).
ENDIF.
ENDMETHOD. "SET_AREA_STYLE
METHOD set_cell.
DATA: lv_column TYPE zexcel_cell_column,
ls_sheet_content TYPE zexcel_s_cell_data,
lv_row_alpha TYPE string,
lv_col_alpha TYPE zexcel_cell_column_alpha,
lv_value TYPE zexcel_cell_value,
lv_data_type TYPE zexcel_cell_data_type,
lv_value_type TYPE abap_typekind,
lv_style_guid TYPE zexcel_cell_style,
lo_addit TYPE REF TO cl_abap_elemdescr,
lo_value TYPE REF TO data,
lo_value_new TYPE REF TO data.
FIELD-SYMBOLS: <fs_sheet_content> TYPE zexcel_s_cell_data,
<fs_numeric> TYPE numeric,
<fs_date> TYPE d,
<fs_time> TYPE t,
<fs_value> TYPE simple,
<fs_typekind_int8> TYPE abap_typekind,
<fs_column_formula> TYPE mty_s_column_formula.
IF ip_value IS NOT SUPPLIED AND ip_formula IS NOT SUPPLIED AND ip_column_formula_id = 0.
zcx_excel=>raise_text( 'Please provide the value or formula' ).
ENDIF.
* Begin of change issue #152 - don't touch exisiting style if only value is passed
* lv_style_guid = ip_style.
lv_column = zcl_excel_common=>convert_column2int( ip_column ).
IF ip_column_formula_id <> 0.
check_cell_column_formula(
it_column_formulas = column_formulas
ip_column_formula_id = ip_column_formula_id
ip_formula = ip_formula
ip_value = ip_value
ip_row = ip_row
ip_column = lv_column ).
ENDIF.
READ TABLE sheet_content ASSIGNING <fs_sheet_content> WITH TABLE KEY cell_row = ip_row " Changed to access via table key , Stefan Schmöcker, 2013-08-03
cell_column = lv_column.
IF sy-subrc = 0.
IF ip_style IS INITIAL.
" If no style is provided as method-parameter and cell is found use cell's current style
lv_style_guid = <fs_sheet_content>-cell_style.
ELSE.
" Style provided as method-parameter --> use this
lv_style_guid = ip_style.
ENDIF.
ELSE.
" No cell found --> use supplied style even if empty
lv_style_guid = ip_style.
ENDIF.
* End of change issue #152 - don't touch exisiting style if only value is passed
IF ip_value IS SUPPLIED.
"if data type is passed just write the value. Otherwise map abap type to excel and perform conversion
"IP_DATA_TYPE is passed by excel reader so source types are preserved
*First we get reference into local var.
CREATE DATA lo_value LIKE ip_value.
ASSIGN lo_value->* TO <fs_value>.
<fs_value> = ip_value.
IF ip_data_type IS SUPPLIED.
IF ip_abap_type IS NOT SUPPLIED.
get_value_type( EXPORTING ip_value = ip_value
IMPORTING ep_value = <fs_value> ) .
ENDIF.
lv_value = <fs_value>.
lv_data_type = ip_data_type.
ELSE.
IF ip_abap_type IS SUPPLIED.
lv_value_type = ip_abap_type.
ELSE.
get_value_type( EXPORTING ip_value = ip_value
IMPORTING ep_value = <fs_value>
ep_value_type = lv_value_type ).
ENDIF.
ASSIGN ('CL_ABAP_TYPEDESCR=>TYPEKIND_INT8') TO <fs_typekind_int8>.
IF sy-subrc <> 0.
ASSIGN space TO <fs_typekind_int8>. "not used as typekind!
ENDIF.
CASE lv_value_type.
WHEN cl_abap_typedescr=>typekind_int OR cl_abap_typedescr=>typekind_int1 OR cl_abap_typedescr=>typekind_int2
OR <fs_typekind_int8>. "Allow INT8 types columns
lo_addit = cl_abap_elemdescr=>get_i( ).
CREATE DATA lo_value_new TYPE HANDLE lo_addit.
ASSIGN lo_value_new->* TO <fs_numeric>.
IF sy-subrc = 0.
<fs_numeric> = <fs_value>.
lv_value = zcl_excel_common=>number_to_excel_string( ip_value = <fs_numeric> ).
ENDIF.
WHEN cl_abap_typedescr=>typekind_float OR cl_abap_typedescr=>typekind_packed.
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>-column_formula_id = ip_column_formula_id.
<fs_sheet_content>-cell_style = lv_style_guid.
<fs_sheet_content>-data_type = lv_data_type.
ELSE.
ls_sheet_content-cell_row = ip_row.
ls_sheet_content-cell_column = lv_column.
ls_sheet_content-cell_value = lv_value.
ls_sheet_content-cell_formula = ip_formula.
ls_sheet_content-column_formula_id = ip_column_formula_id.
ls_sheet_content-cell_style = lv_style_guid.
ls_sheet_content-data_type = lv_data_type.
lv_row_alpha = ip_row.
* SHIFT lv_row_alpha RIGHT DELETING TRAILING space."del #152 - replaced with condense - should be faster
* SHIFT lv_row_alpha LEFT DELETING LEADING space. "del #152 - replaced with condense - should be faster
CONDENSE lv_row_alpha NO-GAPS. "ins #152 - replaced 2 shifts - should be faster
lv_col_alpha = zcl_excel_common=>convert_column2alpha( ip_column ). " issue #155 - less restrictive typing for ip_column
CONCATENATE lv_col_alpha lv_row_alpha INTO ls_sheet_content-cell_coords. " issue #155 - less restrictive typing for ip_column
INSERT ls_sheet_content INTO TABLE sheet_content ASSIGNING <fs_sheet_content>. "ins #152 - Now <fs_sheet_content> always holds the data
* APPEND ls_sheet_content TO sheet_content.
* SORT sheet_content BY cell_row cell_column.
" me->update_dimension_range( ).
ENDIF.
* 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_ignored_errors.
mt_ignored_errors = it_ignored_errors.
ENDMETHOD.
METHOD set_merge.
DATA: ls_merge TYPE mty_merge,
lv_errormessage TYPE string.
...
"just after variables definition
IF ip_value IS SUPPLIED OR ip_formula IS SUPPLIED.
" if there is a value or formula set the value to the top-left cell
"maybe it is necessary to support other paramters for set_cell
IF ip_value IS SUPPLIED.
me->set_cell( ip_row = ip_row ip_column = ip_column_start
ip_value = ip_value ).
ENDIF.
IF ip_formula IS SUPPLIED.
me->set_cell( ip_row = ip_row ip_column = ip_column_start
ip_value = ip_formula ).
ENDIF.
ENDIF.
"call to set_merge_style to apply the style to all cells at the matrix
IF ip_style IS SUPPLIED.
me->set_merge_style( ip_row = ip_row ip_column_start = ip_column_start
ip_row_to = ip_row_to ip_column_end = ip_column_end
ip_style = ip_style ).
ENDIF.
...
*--------------------------------------------------------------------*
* Build new range area to insert into range table
*--------------------------------------------------------------------*
ls_merge-row_from = ip_row.
IF ip_row IS SUPPLIED AND ip_row IS NOT INITIAL AND ip_row_to IS NOT SUPPLIED.
ls_merge-row_to = ls_merge-row_from.
ELSE.
ls_merge-row_to = ip_row_to.
ENDIF.
IF ls_merge-row_from > ls_merge-row_to.
lv_errormessage = 'Merge: First row larger then last row'(405).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
ls_merge-col_from = zcl_excel_common=>convert_column2int( ip_column_start ).
IF ip_column_start IS SUPPLIED AND ip_column_start IS NOT INITIAL AND ip_column_end IS NOT SUPPLIED.
ls_merge-col_to = ls_merge-col_from.
ELSE.
ls_merge-col_to = zcl_excel_common=>convert_column2int( ip_column_end ).
ENDIF.
IF ls_merge-col_from > ls_merge-col_to.
lv_errormessage = 'Merge: First column larger then last column'(406).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
*--------------------------------------------------------------------*
* Check merge not overlapping with existing merges
*--------------------------------------------------------------------*
LOOP AT me->mt_merged_cells TRANSPORTING NO FIELDS WHERE NOT ( row_from > ls_merge-row_to
OR row_to < ls_merge-row_from
OR col_from > ls_merge-col_to
OR col_to < ls_merge-col_from ).
lv_errormessage = 'Overlapping merges'(404).
zcx_excel=>raise_text( lv_errormessage ).
ENDLOOP.
*--------------------------------------------------------------------*
* Everything seems ok --> add to merge table
*--------------------------------------------------------------------*
INSERT ls_merge INTO TABLE me->mt_merged_cells.
ENDMETHOD. "SET_MERGE
METHOD set_merge_style.
DATA: ld_row_start TYPE zexcel_cell_row,
ld_row_end TYPE zexcel_cell_row,
ld_column_start TYPE zexcel_cell_column,
ld_column_end TYPE zexcel_cell_column,
ld_current_column TYPE zexcel_cell_column_alpha,
ld_current_row TYPE zexcel_cell_row.
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 = rows->get_min_index( ).
IF upper_cell-cell_row = 0.
upper_cell-cell_row = zcl_excel_common=>c_excel_sheet_max_row.
ENDIF.
upper_cell-cell_column = zcl_excel_common=>c_excel_sheet_max_col.
lower_cell-cell_row = rows->get_max_index( ).
IF lower_cell-cell_row = 0.
lower_cell-cell_row = zcl_excel_common=>c_excel_sheet_min_row.
ENDIF.
lower_cell-cell_column = zcl_excel_common=>c_excel_sheet_min_col.
LOOP AT sheet_content INTO ls_sheet_content.
IF upper_cell-cell_row > ls_sheet_content-cell_row.
upper_cell-cell_row = ls_sheet_content-cell_row.
ENDIF.
IF upper_cell-cell_column > ls_sheet_content-cell_column.
upper_cell-cell_column = ls_sheet_content-cell_column.
ENDIF.
IF lower_cell-cell_row < ls_sheet_content-cell_row.
lower_cell-cell_row = ls_sheet_content-cell_row.
ENDIF.
IF lower_cell-cell_column < ls_sheet_content-cell_column.
lower_cell-cell_column = ls_sheet_content-cell_column.
ENDIF.
ENDLOOP.
lv_row_alpha = upper_cell-cell_row.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( upper_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO upper_cell-cell_coords.
lv_row_alpha = lower_cell-cell_row.
lv_column_alpha = zcl_excel_common=>convert_column2alpha( lower_cell-cell_column ).
SHIFT lv_row_alpha RIGHT DELETING TRAILING space.
SHIFT lv_row_alpha LEFT DELETING LEADING space.
CONCATENATE lv_column_alpha lv_row_alpha INTO lower_cell-cell_coords.
ENDMETHOD. "UPDATE_DIMENSION_RANGE
METHOD zif_excel_sheet_printsettings~clear_print_repeat_columns.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
CLEAR: me->print_title_col_from,
me->print_title_col_to .
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_COLUMNS
METHOD zif_excel_sheet_printsettings~clear_print_repeat_rows.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
CLEAR: me->print_title_row_from,
me->print_title_row_to .
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~CLEAR_PRINT_REPEAT_ROWS
METHOD zif_excel_sheet_printsettings~get_print_repeat_columns.
ev_columns_from = me->print_title_col_from.
ev_columns_to = me->print_title_col_to.
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_COLUMNS
METHOD zif_excel_sheet_printsettings~get_print_repeat_rows.
ev_rows_from = me->print_title_row_from.
ev_rows_to = me->print_title_row_to.
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~GET_PRINT_REPEAT_ROWS
METHOD zif_excel_sheet_printsettings~set_print_repeat_columns.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmöcker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lv_col_from_int TYPE i,
lv_col_to_int TYPE i,
lv_errormessage TYPE string.
lv_col_from_int = zcl_excel_common=>convert_column2int( iv_columns_from ).
lv_col_to_int = zcl_excel_common=>convert_column2int( iv_columns_to ).
*--------------------------------------------------------------------*
* Check if valid range is supplied
*--------------------------------------------------------------------*
IF lv_col_from_int < 1.
lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
IF lv_col_from_int > lv_col_to_int.
lv_errormessage = 'Invalid range supplied for print-title repeatable columns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
me->print_title_col_from = iv_columns_from.
me->print_title_col_to = iv_columns_to.
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_COLUMNS
METHOD zif_excel_sheet_printsettings~set_print_repeat_rows.
*--------------------------------------------------------------------*
* issue#235 - repeat rows/columns
* - Stefan Schmöcker, 2012-12-02
*--------------------------------------------------------------------*
DATA: lv_errormessage TYPE string.
*--------------------------------------------------------------------*
* Check if valid range is supplied
*--------------------------------------------------------------------*
IF iv_rows_from < 1.
lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
IF iv_rows_from > iv_rows_to.
lv_errormessage = 'Invalid range supplied for print-title repeatable rowumns'(401).
zcx_excel=>raise_text( lv_errormessage ).
ENDIF.
*--------------------------------------------------------------------*
* adjust internal representation
*--------------------------------------------------------------------*
me->print_title_row_from = iv_rows_from.
me->print_title_row_to = iv_rows_to.
*--------------------------------------------------------------------*
* adjust corresponding range
*--------------------------------------------------------------------*
me->print_title_set_range( ).
ENDMETHOD. "ZIF_EXCEL_SHEET_PRINTSETTINGS~SET_PRINT_REPEAT_ROWS
METHOD zif_excel_sheet_properties~get_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
METHOD class_constructor.
c_messages-formula_id_only_is_possible = |{ 'If Formula ID is used, value and formula must be empty'(008) }|.
c_messages-column_formula_id_not_found = |{ 'The Column Formula does not exist'(009) }|.
c_messages-formula_not_in_this_table = |{ 'The cell uses a Column Formula which should be part of the same table'(010) }|.
c_messages-formula_in_other_column = |{ 'The cell uses a Column Formula which is in a different column'(011) }|.
ENDMETHOD.
ENDCLASS.
| [
9,
10097,
23031,
9,
198,
9,
220,
220,
220,
220,
220,
220,
42715,
1168,
5097,
62,
6369,
34,
3698,
62,
33249,
9693,
36,
2767,
5550,
20032,
17941,
198,
9,
10097,
23031,
9,
198,
9,
198,
9,
10097,
23031,
9,
198,
31631,
1976,
565,
62,
1069,
5276,
62,
5225,
25473,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
9,
1,
9,
1171,
6805,
286,
1398,
1168,
5097,
62,
6369,
34,
3698,
62,
33249,
9693,
36,
2767,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
9,
1,
9,
6861,
6805,
286,
1398,
1168,
5097,
62,
6369,
34,
3698,
62,
33249,
9693,
36,
2767,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
9,
1,
9,
6861,
6805,
286,
1398,
1168,
5097,
62,
6369,
34,
3698,
62,
33249,
9693,
36,
2767,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
220,
220,
41876,
12,
16402,
3535,
50,
450,
499,
764,
198,
220,
220,
220,
41876,
12,
16402,
3535,
50,
1017,
271,
764,
198,
220,
220,
220,
41876,
12,
16402,
3535,
50,
523,
72,
764,
628,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
1069,
5276,
62,
21760,
62,
4798,
33692,
764,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
1069,
5276,
62,
21760,
62,
48310,
764,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
1069,
5276,
62,
21760,
62,
42846,
764,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
1069,
5276,
62,
21760,
62,
85,
7012,
62,
16302,
764,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
220,
285,
774,
62,
82,
62,
448,
1370,
62,
808,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
62,
6738,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
62,
1462,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
14707,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
285,
774,
62,
82,
62,
448,
1370,
62,
808,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
285,
774,
62,
912,
62,
448,
6615,
62,
808,
41876,
311,
9863,
1961,
43679,
3963,
285,
774,
62,
82,
62,
448,
1370,
62,
808,
13315,
4725,
33866,
8924,
35374,
5752,
62,
6738,
5752,
62,
1462,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
285,
774,
62,
82,
62,
28665,
62,
687,
4712,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5721,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
1069,
5276,
62,
3846,
62,
28665,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10451,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3084,
62,
4852,
62,
9464,
62,
808,
220,
220,
220,
220,
41876,
1976,
1069,
5276,
62,
3846,
62,
808,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3084,
62,
22487,
62,
3506,
62,
808,
41876,
1976,
1069,
5276,
62,
3846,
62,
808,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3084,
62,
9464,
62,
28665,
62,
600,
220,
41876,
1976,
1069,
5276,
62,
3846,
62,
28665,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3084,
62,
3506,
62,
28665,
62,
600,
41876,
1976,
1069,
5276,
62,
3846,
62,
28665,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
285,
774,
62,
82,
62,
28665,
62,
687,
4712,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
285,
774,
62,
400,
62,
28665,
62,
687,
4712,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
367,
11211,
1961,
43679,
3963,
285,
774,
62,
82,
62,
28665,
62,
687,
4712,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13315,
4725,
33866,
8924,
35374,
4686,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
285,
774,
62,
82,
62,
570,
1850,
62,
48277,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
0,
12440,
4941,
357,
68,
13,
70,
13,
366,
32,
16,
4943,
393,
1351,
588,
366,
32,
16,
317,
17,
1,
393,
2837,
366,
32,
16,
25,
38,
16,
1,
198,
220,
220,
220,
220,
220,
220,
220,
2685,
62,
1073,
3669,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
1069,
5276,
62,
3846,
62,
1073,
3669,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
0,
41032,
8563,
618,
4778,
3994,
32126,
326,
1255,
287,
281,
4049,
13,
198,
220,
220,
220,
220,
220,
220,
220,
5418,
62,
18224,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
0,
41032,
8563,
618,
32126,
3994,
2420,
39559,
4778,
351,
812,
7997,
355,
362,
19561,
13,
198,
220,
220,
220,
220,
220,
220,
220,
734,
62,
27003,
62,
5239,
62,
1941,
220,
220,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
0,
41032,
8563,
618,
3146,
389,
39559,
355,
2420,
393,
389,
27165,
416,
281,
18584,
22599,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1271,
62,
301,
1850,
62,
292,
62,
5239,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
0,
41032,
8563,
618,
257,
10451,
287,
257,
3814,
286,
534,
5521,
3347,
316,
24242,
422,
584,
32126,
287,
262,
976,
3814,
13,
198,
220,
220,
220,
220,
220,
220,
220,
10451,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
"! <p class="shorttext synchronized" lang="en">Database column character string reader</p>
CLASS zcl_io_db_c_reader DEFINITION
PUBLIC
INHERITING FROM zcl_io_c_reader
FINAL
CREATE PUBLIC
GLOBAL FRIENDS zcl_io_c_reader.
PUBLIC SECTION.
*"* public components of class CL_ABAP_DB_C_READER
*"* do not include other source files here!!!
INTERFACES if_abap_db_reader .
INTERFACES if_abap_db_clob_handle .
INTERFACES if_abap_db_lob_handle .
ALIASES get_statement_handle
FOR if_abap_db_reader~get_statement_handle .
METHODS constructor
IMPORTING
std_reader TYPE REF TO cl_abap_db_c_reader.
METHODS: zif_io_reader~is_auto_close_enabled REDEFINITION.
PROTECTED SECTION.
*"* protected components of class CL_ABAP_DB_C_READER
*"* do not include other source files here!!!
PRIVATE SECTION.
*"* private components of class CL_ABAP_DB_C_READER
*"* do not include other source files here!!!
METHODS close_internal "#EC WARNOK
RAISING
cx_lob_sql_error .
METHODS data_available_internal "#EC WARNOK
RETURNING
VALUE(available) TYPE abap_bool
RAISING
zcx_io_resource_already_closed.
METHODS read_internal "#EC WARNOK
IMPORTING
!length TYPE abap_msize
RETURNING
VALUE(result) TYPE string
RAISING
cx_lob_sql_error
zcx_io_resource_already_closed.
METHODS is_closed_internal "#EC WARNOK
RETURNING
VALUE(closed) TYPE abap_bool .
DATA: std_reader TYPE REF TO cl_abap_db_c_reader,
closed_internally TYPE abap_bool.
ENDCLASS.
CLASS zcl_io_db_c_reader IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
me->std_reader = std_reader.
close_managed_internally = abap_true.
ENDMETHOD.
METHOD close_internal.
closed_internally = abap_true.
std_reader->close( ).
ENDMETHOD.
METHOD data_available_internal.
IF closed_internally = abap_true.
RAISE EXCEPTION TYPE zcx_io_resource_already_closed.
ELSEIF is_closed( ) = abap_true.
available = abap_false.
ELSE.
available = std_reader->data_available( ).
ENDIF.
ENDMETHOD.
METHOD is_closed_internal.
closed = std_reader->is_closed( ).
ENDMETHOD.
METHOD read_internal.
IF closed_internally = abap_true.
" will produce an error
std_reader->read( length ).
ELSEIF is_closed( ) = abap_true.
result = ``.
ELSE.
result = std_reader->read( length ).
ENDIF.
ENDMETHOD.
METHOD if_abap_db_reader~get_statement_handle.
hdl = std_reader->get_statement_handle( ).
ENDMETHOD.
METHOD if_abap_close_resource~close.
closed_internally = abap_true.
std_reader->close( ).
ENDMETHOD.
METHOD if_abap_reader~data_available.
available = std_reader->data_available( ).
ENDMETHOD.
METHOD if_abap_reader~delete_mark.
std_reader->delete_mark( ).
ENDMETHOD.
METHOD if_abap_close_resource~is_closed.
closed = std_reader->is_closed( ).
ENDMETHOD.
METHOD if_abap_reader~is_mark_supported.
res = std_reader->is_mark_supported( ).
ENDMETHOD.
METHOD if_abap_reader~is_reset_supported.
result = std_reader->is_reset_supported( ).
ENDMETHOD.
METHOD if_abap_reader~is_x_reader.
result = std_reader->is_x_reader( ).
ENDMETHOD.
METHOD if_abap_reader~read.
read_data = std_reader->read( length ).
ENDMETHOD.
METHOD if_abap_reader~reset.
std_reader->reset( ).
ENDMETHOD.
METHOD if_abap_reader~reset_to_mark.
std_reader->reset_to_mark( ).
ENDMETHOD.
METHOD if_abap_reader~set_mark.
std_reader->set_mark( ).
ENDMETHOD.
METHOD if_abap_reader~skip.
std_reader->skip( length ).
ENDMETHOD.
METHOD zif_io_reader~is_auto_close_enabled.
result = abap_true.
ENDMETHOD.
ENDCLASS.
| [
40484,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
38105,
5721,
2095,
4731,
9173,
3556,
79,
29,
198,
31631,
1976,
565,
62,
952,
62,
9945,
62,
66,
62,
46862,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
952,
62,
66,
62,
46862,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
628,
220,
10188,
9864,
1847,
48167,
1677,
5258,
1976,
565,
62,
952,
62,
66,
62,
46862,
13,
628,
220,
44731,
44513,
13,
198,
198,
9,
1,
9,
1171,
6805,
286,
1398,
7852,
62,
6242,
2969,
62,
11012,
62,
34,
62,
15675,
1137,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
220,
220,
23255,
37,
2246,
1546,
611,
62,
397,
499,
62,
9945,
62,
46862,
764,
198,
220,
220,
220,
23255,
37,
2246,
1546,
611,
62,
397,
499,
62,
9945,
62,
565,
672,
62,
28144,
764,
198,
220,
220,
220,
23255,
37,
2246,
1546,
611,
62,
397,
499,
62,
9945,
62,
75,
672,
62,
28144,
764,
198,
220,
220,
220,
8355,
43429,
1546,
651,
62,
26090,
62,
28144,
198,
220,
220,
220,
220,
220,
7473,
611,
62,
397,
499,
62,
9945,
62,
46862,
93,
1136,
62,
26090,
62,
28144,
764,
628,
220,
220,
220,
337,
36252,
50,
23772,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
14367,
62,
46862,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
9945,
62,
66,
62,
46862,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
1976,
361,
62,
952,
62,
46862,
93,
271,
62,
23736,
62,
19836,
62,
25616,
23848,
36,
20032,
17941,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
9,
1,
9,
6861,
6805,
286,
1398,
7852,
62,
6242,
2969,
62,
11012,
62,
34,
62,
15675,
1137,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
9,
1,
9,
2839,
6805,
286,
1398,
7852,
62,
6242,
2969,
62,
11012,
62,
34,
62,
15675,
1137,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
628,
220,
220,
220,
337,
36252,
50,
1969,
62,
32538,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25113,
2943,
42660,
11380,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
43213,
62,
75,
672,
62,
25410,
62,
18224,
764,
198,
220,
220,
220,
337,
36252,
50,
1366,
62,
15182,
62,
32538,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25113,
2943,
42660,
11380,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
15182,
8,
41876,
450,
499,
62,
30388,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
952,
62,
31092,
62,
282,
1493,
62,
20225,
13,
198,
220,
220,
220,
337,
36252,
50,
1100,
62,
32538,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25113,
2943,
42660,
11380,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
13664,
220,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
907,
1096,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
20274,
8,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
43213,
62,
75,
672,
62,
25410,
62,
18224,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
952,
62,
31092,
62,
282,
1493,
62,
20225,
13,
198,
220,
220,
220,
337,
36252,
50,
318,
62,
20225,
62,
32538,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25113,
2943,
42660,
11380,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
20225,
8,
41876,
450,
499,
62,
30388,
764,
628,
220,
220,
220,
42865,
25,
14367,
62,
46862,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
9945,
62,
66,
62,
46862,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4838,
62,
23124,
453,
41876,
450,
499,
62,
30388,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
952,
62,
9945,
62,
66,
62,
46862,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
23772,
13,
198,
220,
220,
220,
2208,
3784,
41571,
273,
7,
6739,
198,
220,
220,
220,
502,
3784,
19282,
62,
46862,
796,
14367,
62,
46862,
13,
198,
220,
220,
220,
1969,
62,
39935,
62,
23124,
453,
796,
450,
499,
62,
7942,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1969,
62,
32538,
13,
198,
220,
220,
220,
4838,
62,
23124,
453,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
14367,
62,
46862,
3784,
19836,
7,
6739,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1366,
62,
15182,
62,
32538,
13,
198,
220,
220,
220,
16876,
4838,
62,
23124,
453,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
220,
220,
17926,
24352,
7788,
42006,
2849,
41876,
1976,
66,
87,
62,
952,
62,
31092,
62,
282,
1493,
62,
20225,
13,
198,
220,
220,
220,
17852,
5188,
5064,
318,
62,
20225,
7,
1267,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
220,
220,
1695,
796,
450,
499,
62,
9562,
13,
198,
220,
220,
220,
17852,
5188,
13,
198,
220,
220,
220,
220,
220,
1695,
796,
14367,
62,
46862,
3784,
7890,
62,
15182,
7,
6739,
198,
220,
220,
220,
23578,
5064,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class zcx_aps_jobs_aborted definition
public
inheriting from cx_static_check
final
create public.
public section.
interfaces:
if_t100_dyn_msg,
if_t100_message.
constants:
begin of zcx_aps_jobs_aborted,
msgid type symsgid value 'ZAPS_TASK',
msgno type symsgno value '011',
attr1 type scx_attrname value '',
attr2 type scx_attrname value '',
attr3 type scx_attrname value '',
attr4 type scx_attrname value '',
end of zcx_aps_jobs_aborted.
methods:
constructor
importing
i_textid type scx_t100key default zcx_aps_jobs_aborted
i_previous type ref to cx_root optional.
protected section.
private section.
endclass.
class zcx_aps_jobs_aborted implementation.
method constructor ##ADT_SUPPRESS_GENERATION.
super->constructor( previous = i_previous ).
clear textid.
if_t100_message~t100key = i_textid.
endmethod.
endclass.
| [
4871,
1976,
66,
87,
62,
1686,
62,
43863,
62,
397,
9741,
6770,
198,
220,
1171,
198,
220,
10639,
1780,
422,
43213,
62,
12708,
62,
9122,
198,
220,
2457,
198,
220,
2251,
1171,
13,
628,
220,
1171,
2665,
13,
628,
220,
220,
220,
20314,
25,
198,
220,
220,
220,
220,
220,
611,
62,
83,
3064,
62,
67,
2047,
62,
19662,
11,
198,
220,
220,
220,
220,
220,
611,
62,
83,
3064,
62,
20500,
13,
628,
220,
220,
220,
38491,
25,
198,
220,
220,
220,
220,
220,
2221,
286,
1976,
66,
87,
62,
1686,
62,
43863,
62,
397,
9741,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31456,
312,
2099,
827,
19662,
312,
1988,
705,
57,
44580,
62,
51,
1921,
42,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
31456,
3919,
2099,
827,
19662,
3919,
1988,
705,
28555,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
708,
81,
16,
2099,
629,
87,
62,
35226,
3672,
1988,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
708,
81,
17,
2099,
629,
87,
62,
35226,
3672,
1988,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
708,
81,
18,
2099,
629,
87,
62,
35226,
3672,
1988,
705,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
708,
81,
19,
2099,
629,
87,
62,
35226,
3672,
1988,
705,
3256,
198,
220,
220,
220,
220,
220,
886,
286,
1976,
66,
87,
62,
1686,
62,
43863,
62,
397,
9741,
13,
628,
220,
220,
220,
5050,
25,
198,
220,
220,
220,
220,
220,
23772,
198,
220,
220,
220,
220,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
5239,
312,
220,
220,
2099,
629,
87,
62,
83,
3064,
2539,
4277,
1976,
66,
87,
62,
1686,
62,
43863,
62,
397,
9741,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
3866,
1442,
2099,
1006,
284,
43213,
62,
15763,
11902,
13,
198,
220,
6861,
2665,
13,
198,
220,
2839,
2665,
13,
198,
437,
4871,
13,
628,
198,
198,
4871,
1976,
66,
87,
62,
1686,
62,
43863,
62,
397,
9741,
7822,
13,
628,
198,
220,
2446,
23772,
22492,
2885,
51,
62,
40331,
32761,
62,
35353,
1137,
6234,
13,
198,
220,
220,
220,
2208,
3784,
41571,
273,
7,
2180,
796,
1312,
62,
3866,
1442,
6739,
198,
220,
220,
220,
1598,
2420,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_popups DEFINITION
PUBLIC
FINAL
CREATE PRIVATE
GLOBAL FRIENDS zcl_abapgit_ui_factory.
PUBLIC SECTION.
INTERFACES: zif_abapgit_popups.
ALIASES:
popup_package_export FOR zif_abapgit_popups~popup_package_export,
popup_folder_logic FOR zif_abapgit_popups~popup_folder_logic,
popup_object FOR zif_abapgit_popups~popup_object,
create_branch_popup FOR zif_abapgit_popups~create_branch_popup,
repo_new_offline FOR zif_abapgit_popups~repo_new_offline,
branch_list_popup FOR zif_abapgit_popups~branch_list_popup,
repo_popup FOR zif_abapgit_popups~repo_popup,
popup_to_confirm FOR zif_abapgit_popups~popup_to_confirm,
popup_to_inform FOR zif_abapgit_popups~popup_to_inform,
popup_to_create_package FOR zif_abapgit_popups~popup_to_create_package,
popup_to_create_transp_branch FOR zif_abapgit_popups~popup_to_create_transp_branch,
popup_to_select_transports FOR zif_abapgit_popups~popup_to_select_transports,
popup_to_select_from_list FOR zif_abapgit_popups~popup_to_select_from_list,
branch_popup_callback FOR zif_abapgit_popups~branch_popup_callback,
package_popup_callback FOR zif_abapgit_popups~package_popup_callback,
popup_transport_request FOR zif_abapgit_popups~popup_transport_request,
popup_proxy_bypass FOR zif_abapgit_popups~popup_proxy_bypass.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
ty_sval_tt TYPE STANDARD TABLE OF sval WITH DEFAULT KEY.
CONSTANTS c_fieldname_selected TYPE lvc_fname VALUE `SELECTED` ##NO_TEXT.
CONSTANTS c_answer_cancel TYPE c LENGTH 1 VALUE 'A' ##NO_TEXT.
DATA mo_select_list_popup TYPE REF TO cl_salv_table .
DATA mr_table TYPE REF TO data .
DATA mv_cancel TYPE abap_bool VALUE abap_false.
DATA mo_table_descr TYPE REF TO cl_abap_tabledescr .
METHODS add_field
IMPORTING
!iv_tabname TYPE sval-tabname
!iv_fieldname TYPE sval-fieldname
!iv_fieldtext TYPE sval-fieldtext
!iv_value TYPE clike DEFAULT ''
!iv_field_attr TYPE sval-field_attr DEFAULT ''
!iv_obligatory TYPE spo_obl OPTIONAL
CHANGING
!ct_fields TYPE ty_sval_tt .
METHODS create_new_table
IMPORTING
!it_list TYPE STANDARD TABLE .
METHODS get_selected_rows
EXPORTING
!et_list TYPE INDEX TABLE .
METHODS on_select_list_link_click
FOR EVENT link_click OF cl_salv_events_table
IMPORTING
!row
!column .
METHODS on_select_list_function_click
FOR EVENT added_function OF cl_salv_events_table
IMPORTING
!e_salv_function .
METHODS on_double_click
FOR EVENT double_click OF cl_salv_events_table
IMPORTING
!row
!column .
METHODS extract_field_values
IMPORTING
it_fields TYPE ty_sval_tt
EXPORTING
ev_url TYPE abaptxt255-line
ev_package TYPE tdevc-devclass
ev_branch TYPE textl-line
ev_display_name TYPE trm255-text
ev_folder_logic TYPE string
ev_ign_subpkg TYPE abap_bool
ev_master_lang_only TYPE abap_bool.
TYPES:
ty_lt_fields TYPE STANDARD TABLE OF sval WITH DEFAULT KEY.
METHODS _popup_3_get_values
IMPORTING iv_popup_title TYPE string
iv_no_value_check TYPE abap_bool DEFAULT abap_false
EXPORTING ev_value_1 TYPE spo_value
ev_value_2 TYPE spo_value
ev_value_3 TYPE spo_value
CHANGING ct_fields TYPE ty_lt_fields
RAISING zcx_abapgit_exception.
METHODS validate_folder_logic
IMPORTING
iv_folder_logic TYPE string
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_POPUPS IMPLEMENTATION.
METHOD add_field.
FIELD-SYMBOLS: <ls_field> LIKE LINE OF ct_fields.
APPEND INITIAL LINE TO ct_fields ASSIGNING <ls_field>.
<ls_field>-tabname = iv_tabname.
<ls_field>-fieldname = iv_fieldname.
<ls_field>-fieldtext = iv_fieldtext.
<ls_field>-value = iv_value.
<ls_field>-field_attr = iv_field_attr.
<ls_field>-field_obl = iv_obligatory.
ENDMETHOD.
METHOD create_new_table.
" create and populate a table on the fly derived from
" it_data with a select column
DATA: lr_struct TYPE REF TO data,
lt_components TYPE cl_abap_structdescr=>component_table,
lo_struct_descr TYPE REF TO cl_abap_structdescr,
lo_struct_descr2 TYPE REF TO cl_abap_structdescr.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<ls_component> TYPE abap_componentdescr,
<lg_line> TYPE data,
<lg_data> TYPE any.
mo_table_descr ?= cl_abap_tabledescr=>describe_by_data( it_list ).
lo_struct_descr ?= mo_table_descr->get_table_line_type( ).
lt_components = lo_struct_descr->get_components( ).
INSERT INITIAL LINE INTO lt_components ASSIGNING <ls_component> INDEX 1.
ASSERT sy-subrc = 0.
<ls_component>-name = c_fieldname_selected.
<ls_component>-type ?= cl_abap_datadescr=>describe_by_name( 'FLAG' ).
lo_struct_descr2 = cl_abap_structdescr=>create( lt_components ).
mo_table_descr = cl_abap_tabledescr=>create( lo_struct_descr2 ).
CREATE DATA mr_table TYPE HANDLE mo_table_descr.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
CREATE DATA lr_struct TYPE HANDLE lo_struct_descr2.
ASSIGN lr_struct->* TO <lg_line>.
ASSERT sy-subrc = 0.
LOOP AT it_list ASSIGNING <lg_data>.
CLEAR <lg_line>.
MOVE-CORRESPONDING <lg_data> TO <lg_line>.
INSERT <lg_line> INTO TABLE <lt_table>.
ENDLOOP.
ENDMETHOD.
METHOD extract_field_values.
FIELD-SYMBOLS: <ls_field> LIKE LINE OF it_fields.
CLEAR: ev_url,
ev_package,
ev_branch,
ev_display_name,
ev_folder_logic,
ev_ign_subpkg.
READ TABLE it_fields INDEX 1 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_url = <ls_field>-value.
READ TABLE it_fields INDEX 2 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_package = <ls_field>-value.
TRANSLATE ev_package TO UPPER CASE.
READ TABLE it_fields INDEX 3 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_branch = <ls_field>-value.
READ TABLE it_fields INDEX 4 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_display_name = <ls_field>-value.
READ TABLE it_fields INDEX 5 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_folder_logic = <ls_field>-value.
TRANSLATE ev_folder_logic TO UPPER CASE.
READ TABLE it_fields INDEX 6 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_ign_subpkg = <ls_field>-value.
TRANSLATE ev_ign_subpkg TO UPPER CASE.
READ TABLE it_fields INDEX 7 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_master_lang_only = <ls_field>-value.
ENDMETHOD.
METHOD get_selected_rows.
DATA: lv_condition TYPE string,
lr_exporting TYPE REF TO data.
FIELD-SYMBOLS: <lg_exporting> TYPE any,
<lt_table> TYPE STANDARD TABLE,
<lg_line> TYPE any,
<lv_selected> TYPE abap_bool,
<lv_selected_row> TYPE LINE OF salv_t_row.
DATA: lo_selections TYPE REF TO cl_salv_selections,
lt_selected_rows TYPE salv_t_row.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
lo_selections = mo_select_list_popup->get_selections( ).
IF lo_selections->get_selection_mode( ) = if_salv_c_selection_mode=>single.
lt_selected_rows = lo_selections->get_selected_rows( ).
LOOP AT lt_selected_rows ASSIGNING <lv_selected_row>.
READ TABLE <lt_table>
ASSIGNING <lg_line>
INDEX <lv_selected_row>.
CHECK <lv_selected_row> IS ASSIGNED.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
CHECK <lv_selected> IS ASSIGNED.
<lv_selected> = abap_true.
ENDLOOP.
ENDIF.
lv_condition = |{ c_fieldname_selected } = ABAP_TRUE|.
CREATE DATA lr_exporting LIKE LINE OF et_list.
ASSIGN lr_exporting->* TO <lg_exporting>.
LOOP AT <lt_table> ASSIGNING <lg_line> WHERE (lv_condition).
CLEAR <lg_exporting>.
MOVE-CORRESPONDING <lg_line> TO <lg_exporting>.
APPEND <lg_exporting> TO et_list.
ENDLOOP.
ENDMETHOD.
METHOD on_double_click.
DATA: lo_selections TYPE REF TO cl_salv_selections.
lo_selections = mo_select_list_popup->get_selections( ).
IF lo_selections->get_selection_mode( ) = if_salv_c_selection_mode=>single.
mo_select_list_popup->close_screen( ).
ENDIF.
ENDMETHOD.
METHOD on_select_list_function_click.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<lg_line> TYPE any,
<lv_selected> TYPE abap_bool.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
CASE e_salv_function.
WHEN 'O.K.'.
mv_cancel = abap_false.
mo_select_list_popup->close_screen( ).
WHEN 'ABR'.
"Canceled: clear list to overwrite nothing
CLEAR <lt_table>.
mv_cancel = abap_true.
mo_select_list_popup->close_screen( ).
WHEN 'SALL'.
LOOP AT <lt_table> ASSIGNING <lg_line>.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
ASSERT sy-subrc = 0.
<lv_selected> = abap_true.
ENDLOOP.
mo_select_list_popup->refresh( ).
WHEN 'DSEL'.
LOOP AT <lt_table> ASSIGNING <lg_line>.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
ASSERT sy-subrc = 0.
<lv_selected> = abap_false.
ENDLOOP.
mo_select_list_popup->refresh( ).
WHEN OTHERS.
CLEAR <lt_table>.
mo_select_list_popup->close_screen( ).
ENDCASE.
ENDMETHOD.
METHOD on_select_list_link_click.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<lg_line> TYPE any,
<lv_selected> TYPE abap_bool.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
READ TABLE <lt_table> ASSIGNING <lg_line> INDEX row.
IF sy-subrc = 0.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
ASSERT sy-subrc = 0.
IF <lv_selected> = abap_true.
<lv_selected> = abap_false.
ELSE.
<lv_selected> = abap_true.
ENDIF.
ENDIF.
mo_select_list_popup->refresh( ).
ENDMETHOD.
METHOD validate_folder_logic.
IF iv_folder_logic <> zif_abapgit_dot_abapgit=>c_folder_logic-prefix
AND iv_folder_logic <> zif_abapgit_dot_abapgit=>c_folder_logic-full.
zcx_abapgit_exception=>raise( |Invalid folder logic { iv_folder_logic }. |
&& |Choose either { zif_abapgit_dot_abapgit=>c_folder_logic-prefix } |
&& |or { zif_abapgit_dot_abapgit=>c_folder_logic-full } | ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~branch_list_popup.
DATA: lo_branches TYPE REF TO zcl_abapgit_git_branch_list,
lt_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt,
lv_answer TYPE c LENGTH 1,
lv_default TYPE i,
lv_head_suffix TYPE string,
lv_head_symref TYPE string,
lt_selection TYPE TABLE OF spopli.
FIELD-SYMBOLS: <ls_sel> LIKE LINE OF lt_selection,
<ls_branch> LIKE LINE OF lt_branches.
lo_branches = zcl_abapgit_git_transport=>branches( iv_url ).
lt_branches = lo_branches->get_branches_only( ).
lv_head_suffix = | ({ zif_abapgit_definitions=>c_head_name })|.
lv_head_symref = lo_branches->get_head_symref( ).
IF iv_hide_branch IS NOT INITIAL.
DELETE lt_branches WHERE name = iv_hide_branch.
ENDIF.
IF iv_hide_head IS NOT INITIAL.
DELETE lt_branches WHERE name = zif_abapgit_definitions=>c_head_name
OR is_head = abap_true.
ENDIF.
IF lt_branches IS INITIAL.
zcx_abapgit_exception=>raise( 'No branch to select' ).
ENDIF.
LOOP AT lt_branches ASSIGNING <ls_branch>.
CHECK <ls_branch>-name IS NOT INITIAL. " To ensure some below ifs
IF <ls_branch>-is_head = abap_true.
IF <ls_branch>-name = zif_abapgit_definitions=>c_head_name. " HEAD
IF <ls_branch>-name <> lv_head_symref AND lv_head_symref IS NOT INITIAL.
" HEAD but other HEAD symref exists - ignore
CONTINUE.
ELSE.
INSERT INITIAL LINE INTO lt_selection INDEX 1 ASSIGNING <ls_sel>.
<ls_sel>-varoption = <ls_branch>-name.
ENDIF.
ELSE.
INSERT INITIAL LINE INTO lt_selection INDEX 1 ASSIGNING <ls_sel>.
<ls_sel>-varoption = <ls_branch>-display_name && lv_head_suffix.
ENDIF.
IF lv_default > 0. " Shift down default if set
lv_default = lv_default + 1.
ENDIF.
ELSE.
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
<ls_sel>-varoption = <ls_branch>-display_name.
ENDIF.
IF <ls_branch>-name = iv_default_branch.
IF <ls_branch>-is_head = abap_true.
lv_default = 1.
ELSE.
lv_default = sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
IF iv_show_new_option = abap_true.
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
<ls_sel>-varoption = zif_abapgit_popups=>c_new_branch_label.
ENDIF.
CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
EXPORTING
textline1 = 'Select branch'
titel = 'Select branch'
start_col = 30
start_row = 5
cursorline = lv_default
IMPORTING
answer = lv_answer
TABLES
t_spopli = lt_selection
EXCEPTIONS
OTHERS = 1. "#EC NOTEXT
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from POPUP_TO_DECIDE_LIST' ).
ENDIF.
IF lv_answer = c_answer_cancel.
RETURN.
ENDIF.
READ TABLE lt_selection ASSIGNING <ls_sel> WITH KEY selflag = abap_true.
ASSERT sy-subrc = 0.
IF iv_show_new_option = abap_true AND <ls_sel>-varoption = zif_abapgit_popups=>c_new_branch_label.
rs_branch-name = zif_abapgit_popups=>c_new_branch_label.
ELSE.
REPLACE FIRST OCCURRENCE OF lv_head_suffix IN <ls_sel>-varoption WITH ''.
READ TABLE lt_branches WITH KEY display_name = <ls_sel>-varoption ASSIGNING <ls_branch>.
IF sy-subrc <> 0.
* branch name longer than 65 characters
LOOP AT lt_branches ASSIGNING <ls_branch> WHERE display_name CS <ls_sel>-varoption.
EXIT. " current loop
ENDLOOP.
ENDIF.
ASSERT <ls_branch> IS ASSIGNED.
rs_branch = lo_branches->find_by_name( <ls_branch>-name ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~branch_popup_callback.
DATA: lv_url TYPE string,
ls_package_data TYPE scompkdtln,
ls_branch TYPE zif_abapgit_definitions=>ty_git_branch,
lv_create TYPE abap_bool,
lv_text TYPE string.
FIELD-SYMBOLS: <ls_furl> LIKE LINE OF ct_fields,
<ls_fbranch> LIKE LINE OF ct_fields,
<ls_fpackage> LIKE LINE OF ct_fields.
CLEAR cs_error.
IF iv_code = 'COD1'.
cv_show_popup = abap_true.
READ TABLE ct_fields ASSIGNING <ls_furl> WITH KEY tabname = 'ABAPTXT255'.
IF sy-subrc <> 0 OR <ls_furl>-value IS INITIAL.
MESSAGE 'Fill URL' TYPE 'S' DISPLAY LIKE 'E'. "#EC NOTEXT
RETURN.
ENDIF.
lv_url = <ls_furl>-value.
ls_branch = branch_list_popup( lv_url ).
IF ls_branch IS INITIAL.
RETURN.
ENDIF.
READ TABLE ct_fields ASSIGNING <ls_fbranch> WITH KEY tabname = 'TEXTL'.
ASSERT sy-subrc = 0.
<ls_fbranch>-value = ls_branch-name.
ELSEIF iv_code = 'COD2'.
cv_show_popup = abap_true.
READ TABLE ct_fields ASSIGNING <ls_fpackage> WITH KEY fieldname = 'DEVCLASS'.
ASSERT sy-subrc = 0.
ls_package_data-devclass = <ls_fpackage>-value.
IF zcl_abapgit_factory=>get_sap_package( ls_package_data-devclass )->exists( ) = abap_true.
lv_text = |Package { ls_package_data-devclass } already exists|.
MESSAGE lv_text TYPE 'I' DISPLAY LIKE 'E'.
RETURN.
ENDIF.
popup_to_create_package(
IMPORTING
es_package_data = ls_package_data
ev_create = lv_create ).
IF lv_create = abap_false.
RETURN.
ENDIF.
zcl_abapgit_factory=>get_sap_package( ls_package_data-devclass )->create( ls_package_data ).
COMMIT WORK.
<ls_fpackage>-value = ls_package_data-devclass.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~create_branch_popup.
DATA: lt_fields TYPE TABLE OF sval.
DATA: lv_name TYPE spo_value.
CLEAR: ev_name, ev_cancel.
add_field( EXPORTING iv_tabname = 'TEXTL'
iv_fieldname = 'LINE'
iv_fieldtext = 'Name'
iv_value = 'new-branch-name'
CHANGING ct_fields = lt_fields ).
TRY.
_popup_3_get_values( EXPORTING iv_popup_title = 'Create branch' "#EC NOTEXT
IMPORTING ev_value_1 = lv_name
CHANGING ct_fields = lt_fields ).
ev_name = zcl_abapgit_git_branch_list=>complete_heads_branch_name(
zcl_abapgit_git_branch_list=>normalize_branch_name( lv_name ) ).
CATCH zcx_abapgit_cancel.
ev_cancel = abap_true.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_popups~package_popup_callback.
DATA: ls_package_data TYPE scompkdtln,
lv_create TYPE abap_bool.
FIELD-SYMBOLS: <ls_fpackage> LIKE LINE OF ct_fields.
CLEAR cs_error.
IF iv_code = 'COD1'.
cv_show_popup = abap_true.
READ TABLE ct_fields ASSIGNING <ls_fpackage> WITH KEY fieldname = 'DEVCLASS'.
ASSERT sy-subrc = 0.
ls_package_data-devclass = <ls_fpackage>-value.
popup_to_create_package( IMPORTING es_package_data = ls_package_data
ev_create = lv_create ).
IF lv_create = abap_false.
RETURN.
ENDIF.
zcl_abapgit_factory=>get_sap_package( ls_package_data-devclass )->create( ls_package_data ).
COMMIT WORK.
<ls_fpackage>-value = ls_package_data-devclass.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_folder_logic.
DATA: lt_fields TYPE TABLE OF sval.
DATA: lv_folder_logic TYPE spo_value.
CLEAR: rv_folder_logic.
add_field( EXPORTING iv_tabname = 'TDEVC'
iv_fieldname = 'INTSYS'
iv_fieldtext = 'Folder logic'
iv_value = 'PREFIX'
CHANGING ct_fields = lt_fields ).
TRY.
_popup_3_get_values( EXPORTING iv_popup_title = 'Export package' "#EC NOTEXT
iv_no_value_check = abap_true
IMPORTING ev_value_1 = lv_folder_logic
CHANGING ct_fields = lt_fields ).
rv_folder_logic = to_upper( lv_folder_logic ).
CATCH zcx_abapgit_cancel.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_object.
DATA: lt_fields TYPE TABLE OF sval.
DATA: lv_object_type TYPE spo_value.
DATA: lv_object_name TYPE spo_value.
CLEAR: rs_tadir-object, rs_tadir-obj_name.
add_field( EXPORTING iv_tabname = 'TADIR'
iv_fieldname = 'OBJECT'
iv_fieldtext = 'Type'
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TADIR'
iv_fieldname = 'OBJ_NAME'
iv_fieldtext = 'Name'
CHANGING ct_fields = lt_fields ).
_popup_3_get_values( EXPORTING iv_popup_title = 'Object' "#EC NOTEXT
iv_no_value_check = abap_true
IMPORTING ev_value_1 = lv_object_type
ev_value_2 = lv_object_name
CHANGING ct_fields = lt_fields ).
rs_tadir = zcl_abapgit_factory=>get_tadir( )->read_single(
iv_object = to_upper( lv_object_type )
iv_obj_name = to_upper( lv_object_name ) ).
ENDMETHOD.
METHOD zif_abapgit_popups~popup_package_export.
DATA: lt_fields TYPE TABLE OF sval.
DATA: lv_package TYPE spo_value.
DATA: lv_folder_logic TYPE spo_value.
DATA: lv_serialize_master_lang_only TYPE spo_value.
add_field( EXPORTING iv_tabname = 'TDEVC'
iv_fieldname = 'DEVCLASS'
iv_fieldtext = 'Package'
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TDEVC'
iv_fieldname = 'INTSYS'
iv_fieldtext = 'Folder logic'
iv_value = 'PREFIX'
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TVDIR'
iv_fieldname = 'FLAG'
iv_fieldtext = 'Master lang only'
CHANGING ct_fields = lt_fields ).
TRY.
_popup_3_get_values( EXPORTING iv_popup_title = 'Export package' "#EC NOTEXT
iv_no_value_check = abap_true
IMPORTING ev_value_1 = lv_package
ev_value_2 = lv_folder_logic
ev_value_3 = lv_serialize_master_lang_only
CHANGING ct_fields = lt_fields ).
ev_package = to_upper( lv_package ).
ev_folder_logic = to_upper( lv_folder_logic ).
ev_serialize_master_lang_only = boolc( lv_serialize_master_lang_only IS NOT INITIAL ).
CATCH zcx_abapgit_cancel.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_proxy_bypass.
rt_proxy_bypass = it_proxy_bypass.
CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
EXPORTING
title = 'Bypass proxy settings for these Hosts & Domains'
signed = abap_false
lower_case = abap_true
no_interval_check = abap_true
TABLES
range = rt_proxy_bypass
EXCEPTIONS
no_range_tab = 1
cancelled = 2
internal_error = 3
invalid_fieldname = 4
OTHERS = 5.
CASE sy-subrc.
WHEN 0.
WHEN 2.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
WHEN OTHERS.
zcx_abapgit_exception=>raise( 'Error from COMPLEX_SELECTIONS_DIALOG' ).
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_search_help.
DATA lt_ret TYPE TABLE OF ddshretval.
DATA ls_ret LIKE LINE OF lt_ret.
DATA lv_tabname TYPE dfies-tabname.
DATA lv_fieldname TYPE dfies-fieldname.
SPLIT iv_tab_field AT '-' INTO lv_tabname lv_fieldname.
lv_tabname = to_upper( lv_tabname ).
lv_fieldname = to_upper( lv_fieldname ).
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = lv_tabname
fieldname = lv_fieldname
TABLES
return_tab = lt_ret
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |F4IF_FIELD_VALUE_REQUEST error [{ iv_tab_field }]| ).
ENDIF.
IF lines( lt_ret ) > 0.
READ TABLE lt_ret INDEX 1 INTO ls_ret.
ASSERT sy-subrc = 0.
rv_value = ls_ret-fieldval.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_confirm.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = iv_titlebar
text_question = iv_text_question
text_button_1 = iv_text_button_1
icon_button_1 = iv_icon_button_1
text_button_2 = iv_text_button_2
icon_button_2 = iv_icon_button_2
default_button = iv_default_button
display_cancel_button = iv_display_cancel_button
IMPORTING
answer = rv_answer
EXCEPTIONS
text_not_found = 1
OTHERS = 2. "#EC NOTEXT
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from POPUP_TO_CONFIRM' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_create_package.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = 'PB_POPUP_PACKAGE_CREATE'
EXCEPTIONS
function_not_exist = 1
OTHERS = 2.
IF sy-subrc = 1.
* looks like the function module used does not exist on all
* versions since 702, so show an error
zcx_abapgit_exception=>raise( 'Your system does not support automatic creation of packages.' &&
'Please, create the package manually.' ).
ENDIF.
CALL FUNCTION 'PB_POPUP_PACKAGE_CREATE'
CHANGING
p_object_data = es_package_data
EXCEPTIONS
action_cancelled = 1.
IF sy-subrc = 0.
ev_create = abap_true.
ELSE.
ev_create = abap_false.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_create_transp_branch.
DATA: lt_fields TYPE TABLE OF sval,
lv_transports_as_text TYPE string,
lv_desc_as_text TYPE string,
ls_transport_header LIKE LINE OF it_transport_headers.
DATA: lv_branch_name TYPE spo_value.
DATA: lv_commit_text TYPE spo_value.
CLEAR: rs_transport_branch-branch_name, rs_transport_branch-commit_text.
" If we only have one transport selected set branch name to Transport
" name and commit description to transport description.
IF lines( it_transport_headers ) = 1.
READ TABLE it_transport_headers INDEX 1 INTO ls_transport_header.
lv_transports_as_text = ls_transport_header-trkorr.
SELECT SINGLE as4text FROM e07t INTO lv_desc_as_text WHERE
trkorr = ls_transport_header-trkorr AND
langu = sy-langu.
ELSE. " Else set branch name and commit message to 'Transport(s)_TRXXXXXX_TRXXXXX'
lv_transports_as_text = 'Transport(s)'.
LOOP AT it_transport_headers INTO ls_transport_header.
CONCATENATE lv_transports_as_text '_' ls_transport_header-trkorr INTO lv_transports_as_text.
ENDLOOP.
lv_desc_as_text = lv_transports_as_text.
ENDIF.
add_field( EXPORTING iv_tabname = 'TEXTL'
iv_fieldname = 'LINE'
iv_fieldtext = 'Branch name'
iv_value = lv_transports_as_text
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'ABAPTXT255'
iv_fieldname = 'LINE'
iv_fieldtext = 'Commit text'
iv_value = lv_desc_as_text
CHANGING ct_fields = lt_fields ).
_popup_3_get_values( EXPORTING iv_popup_title = 'Transport to new Branch' "#EC NOTEXT
IMPORTING ev_value_1 = lv_branch_name
ev_value_2 = lv_commit_text
CHANGING ct_fields = lt_fields ).
rs_transport_branch-branch_name = lv_branch_name.
rs_transport_branch-commit_text = lv_commit_text.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_inform.
DATA: lv_line1 TYPE c LENGTH 70,
lv_line2 TYPE c LENGTH 70.
lv_line1 = iv_text_message.
IF strlen( iv_text_message ) > 70.
lv_line2 = iv_text_message+70.
ENDIF.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = iv_titlebar
txt1 = lv_line1
txt2 = lv_line2.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_select_from_list.
DATA: lv_pfstatus TYPE sypfkey,
lo_events TYPE REF TO cl_salv_events_table,
lo_functions TYPE REF TO cl_salv_functions_list,
lo_columns TYPE REF TO cl_salv_columns_table,
lt_columns TYPE salv_t_column_ref,
ls_column TYPE salv_s_column_ref,
lo_column TYPE REF TO cl_salv_column_list,
lo_table_header TYPE REF TO cl_salv_form_text.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<ls_column_to_display> TYPE zif_abapgit_definitions=>ty_alv_column.
CLEAR: et_list.
create_new_table( it_list ).
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = mo_select_list_popup
CHANGING t_table = <lt_table> ).
CASE iv_selection_mode.
WHEN if_salv_c_selection_mode=>single.
lv_pfstatus = '110'.
WHEN OTHERS.
lv_pfstatus = '102'.
ENDCASE.
mo_select_list_popup->set_screen_status( pfstatus = lv_pfstatus
report = 'SAPMSVIM' ).
mo_select_list_popup->set_screen_popup( start_column = iv_start_column
end_column = iv_end_column
start_line = iv_start_line
end_line = iv_end_line ).
lo_events = mo_select_list_popup->get_event( ).
SET HANDLER on_select_list_link_click FOR lo_events.
SET HANDLER on_select_list_function_click FOR lo_events.
SET HANDLER on_double_click FOR lo_events.
IF iv_title CN ' _0'.
mo_select_list_popup->get_display_settings( )->set_list_header( iv_title ).
ENDIF.
IF iv_header_text CN ' _0'.
CREATE OBJECT lo_table_header
EXPORTING
text = iv_header_text.
mo_select_list_popup->set_top_of_list( lo_table_header ).
ENDIF.
mo_select_list_popup->get_display_settings( )->set_striped_pattern( iv_striped_pattern ).
mo_select_list_popup->get_selections( )->set_selection_mode( iv_selection_mode ).
lo_columns = mo_select_list_popup->get_columns( ).
lt_columns = lo_columns->get( ).
lo_columns->set_optimize( iv_optimize_col_width ).
LOOP AT lt_columns INTO ls_column.
lo_column ?= ls_column-r_column.
IF iv_selection_mode = if_salv_c_selection_mode=>multiple
AND ls_column-columnname = c_fieldname_selected.
lo_column->set_cell_type( if_salv_c_cell_type=>checkbox_hotspot ).
lo_column->set_output_length( 20 ).
lo_column->set_short_text( |{ iv_select_column_text }| ).
lo_column->set_medium_text( |{ iv_select_column_text }| ).
lo_column->set_long_text( |{ iv_select_column_text }| ).
CONTINUE.
ENDIF.
READ TABLE it_columns_to_display
ASSIGNING <ls_column_to_display>
WITH KEY name = ls_column-columnname.
CASE sy-subrc.
WHEN 0.
IF <ls_column_to_display>-text CN ' _0'.
lo_column->set_short_text( |{ <ls_column_to_display>-text }| ).
lo_column->set_medium_text( |{ <ls_column_to_display>-text }| ).
lo_column->set_long_text( |{ <ls_column_to_display>-text }| ).
ENDIF.
IF <ls_column_to_display>-length > 0.
lo_column->set_output_length( <ls_column_to_display>-length ).
ENDIF.
WHEN OTHERS.
" Hide column
lo_column->set_technical( abap_true ).
ENDCASE.
ENDLOOP.
mo_select_list_popup->display( ).
CATCH cx_salv_msg.
zcx_abapgit_exception=>raise( 'Error from POPUP_TO_SELECT_FROM_LIST' ).
ENDTRY.
IF mv_cancel = abap_true.
mv_cancel = abap_false.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
get_selected_rows( IMPORTING et_list = et_list ).
CLEAR: mo_select_list_popup,
mr_table,
mo_table_descr.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_select_transports.
* todo, method to be renamed, it only returns one transport
DATA: lv_trkorr TYPE e070-trkorr,
ls_trkorr LIKE LINE OF rt_trkorr.
CALL FUNCTION 'TR_F4_REQUESTS'
IMPORTING
ev_selected_request = lv_trkorr.
IF NOT lv_trkorr IS INITIAL.
ls_trkorr-trkorr = lv_trkorr.
APPEND ls_trkorr TO rt_trkorr.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_transport_request.
DATA: lt_e071 TYPE STANDARD TABLE OF e071,
lt_e071k TYPE STANDARD TABLE OF e071k.
CALL FUNCTION 'TRINT_ORDER_CHOICE'
EXPORTING
wi_order_type = is_transport_type-request
wi_task_type = is_transport_type-task
IMPORTING
we_order = rv_transport
TABLES
wt_e071 = lt_e071
wt_e071k = lt_e071k
EXCEPTIONS
no_correction_selected = 1
display_mode = 2
object_append_error = 3
recursive_call = 4
wrong_order_type = 5
OTHERS = 6.
IF sy-subrc = 1.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ELSEIF sy-subrc > 1.
zcx_abapgit_exception=>raise( |Error from TRINT_ORDER_CHOICE { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~repo_new_offline.
DATA: lv_returncode TYPE c,
lt_fields TYPE TABLE OF sval,
lv_icon_ok TYPE icon-name,
lv_button1 TYPE svalbutton-buttontext,
lv_icon1 TYPE icon-name,
lv_finished TYPE abap_bool,
lx_error TYPE REF TO zcx_abapgit_exception.
FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
add_field( EXPORTING iv_tabname = 'ABAPTXT255'
iv_fieldname = 'LINE'
iv_fieldtext = 'Name'
iv_obligatory = abap_true
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TDEVC'
iv_fieldname = 'DEVCLASS'
iv_fieldtext = 'Package'
iv_obligatory = abap_true
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'ZABAPGIT'
iv_fieldname = 'VALUE'
iv_fieldtext = 'Folder logic'
iv_obligatory = abap_true
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'DOKIL'
iv_fieldname = 'MASTERLANG'
iv_fieldtext = 'Master language only'
iv_value = abap_true
CHANGING ct_fields = lt_fields ).
WHILE lv_finished = abap_false.
lv_icon_ok = icon_okay.
lv_button1 = 'Create package' ##NO_TEXT.
lv_icon1 = icon_folder.
CALL FUNCTION 'POPUP_GET_VALUES_USER_BUTTONS'
EXPORTING
popup_title = 'New Offline Project'
programname = sy-cprog
formname = 'PACKAGE_POPUP'
ok_pushbuttontext = 'OK'
icon_ok_push = lv_icon_ok
first_pushbutton = lv_button1
icon_button_1 = lv_icon1
second_pushbutton = ''
icon_button_2 = ''
IMPORTING
returncode = lv_returncode
TABLES
fields = lt_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from POPUP_GET_VALUES' ).
ENDIF.
IF lv_returncode = c_answer_cancel.
rs_popup-cancel = abap_true.
RETURN.
ENDIF.
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
rs_popup-url = <ls_field>-value.
READ TABLE lt_fields INDEX 2 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
TRANSLATE <ls_field>-value TO UPPER CASE.
rs_popup-package = <ls_field>-value.
READ TABLE lt_fields INDEX 3 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
TRANSLATE <ls_field>-value TO UPPER CASE.
rs_popup-folder_logic = <ls_field>-value.
READ TABLE lt_fields INDEX 4 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
rs_popup-master_lang_only = <ls_field>-value.
lv_finished = abap_true.
TRY.
zcl_abapgit_repo_srv=>get_instance( )->validate_package( iv_package = rs_popup-package
iv_chk_exists = abap_false ).
validate_folder_logic( rs_popup-folder_logic ).
CATCH zcx_abapgit_exception INTO lx_error.
" in case of validation errors we display the popup again
MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'.
CLEAR lv_finished.
ENDTRY.
ENDWHILE.
ENDMETHOD.
METHOD zif_abapgit_popups~repo_popup.
DATA: lv_returncode TYPE c,
lv_icon_ok TYPE icon-name,
lv_icon_br TYPE icon-name,
lt_fields TYPE TABLE OF sval,
lv_uattr TYPE spo_fattr,
lv_pattr TYPE spo_fattr,
lv_button2 TYPE svalbutton-buttontext,
lv_icon2 TYPE icon-name,
lv_package TYPE tdevc-devclass,
lv_url TYPE abaptxt255-line,
lv_branch TYPE textl-line,
lv_display_name TYPE trm255-text,
lv_folder_logic TYPE string,
lv_ign_subpkg TYPE abap_bool,
lv_finished TYPE abap_bool,
lv_master_lang_only TYPE abap_bool,
lx_error TYPE REF TO zcx_abapgit_exception.
IF iv_freeze_url = abap_true.
lv_uattr = '05'.
ENDIF.
IF iv_freeze_package = abap_true.
lv_pattr = '05'.
ENDIF.
IF iv_package IS INITIAL. " Empty package -> can be created
lv_button2 = 'Create package' ##NO_TEXT.
lv_icon2 = icon_folder.
ENDIF.
lv_display_name = iv_display_name.
lv_package = iv_package.
lv_url = iv_url.
lv_branch = iv_branch.
WHILE lv_finished = abap_false.
CLEAR: lt_fields.
add_field( EXPORTING iv_tabname = 'ABAPTXT255'
iv_fieldname = 'LINE'
iv_fieldtext = 'Git clone URL'
iv_value = lv_url
iv_field_attr = lv_uattr
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TDEVC'
iv_fieldname = 'DEVCLASS'
iv_fieldtext = 'Package'
iv_value = lv_package
iv_field_attr = lv_pattr
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TEXTL'
iv_fieldname = 'LINE'
iv_fieldtext = 'Branch'
iv_value = lv_branch
iv_field_attr = '05'
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TRM255'
iv_fieldname = 'TEXT'
iv_fieldtext = 'Display name (opt.)'
iv_value = lv_display_name
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TADIR'
iv_fieldname = 'AUTHOR'
iv_fieldtext = 'Folder logic'
iv_obligatory = abap_true
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'TDEVC'
iv_fieldname = 'IS_ENHANCEABLE'
iv_fieldtext = 'Ignore subpackages'
iv_value = abap_false
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'DOKIL'
iv_fieldname = 'MASTERLANG'
iv_fieldtext = 'Master language only'
iv_value = abap_true
CHANGING ct_fields = lt_fields ).
lv_icon_ok = icon_okay.
lv_icon_br = icon_workflow_fork.
CALL FUNCTION 'POPUP_GET_VALUES_USER_BUTTONS'
EXPORTING
popup_title = iv_title
programname = sy-cprog
formname = 'BRANCH_POPUP'
ok_pushbuttontext = 'OK'
icon_ok_push = lv_icon_ok
first_pushbutton = 'Select branch'
icon_button_1 = lv_icon_br
second_pushbutton = lv_button2
icon_button_2 = lv_icon2
IMPORTING
returncode = lv_returncode
TABLES
fields = lt_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 2. "#EC NOTEXT
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from POPUP_GET_VALUES' ).
ENDIF.
IF lv_returncode = c_answer_cancel.
rs_popup-cancel = abap_true.
RETURN.
ENDIF.
extract_field_values(
EXPORTING
it_fields = lt_fields
IMPORTING
ev_url = lv_url
ev_package = lv_package
ev_branch = lv_branch
ev_display_name = lv_display_name
ev_folder_logic = lv_folder_logic
ev_ign_subpkg = lv_ign_subpkg
ev_master_lang_only = lv_master_lang_only ).
lv_finished = abap_true.
TRY.
IF iv_freeze_url = abap_false.
zcl_abapgit_url=>validate( |{ lv_url }| ).
ENDIF.
IF iv_freeze_package = abap_false.
zcl_abapgit_repo_srv=>get_instance( )->validate_package( iv_package = lv_package
iv_ign_subpkg = lv_ign_subpkg
iv_chk_exists = abap_false ).
ENDIF.
validate_folder_logic( lv_folder_logic ).
CATCH zcx_abapgit_exception INTO lx_error.
MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'.
" in case of validation errors we display the popup again
CLEAR lv_finished.
ENDTRY.
ENDWHILE.
rs_popup-url = lv_url.
rs_popup-package = lv_package.
rs_popup-branch_name = lv_branch.
rs_popup-display_name = lv_display_name.
rs_popup-folder_logic = lv_folder_logic.
rs_popup-ign_subpkg = lv_ign_subpkg.
rs_popup-master_lang_only = lv_master_lang_only.
ENDMETHOD.
METHOD _popup_3_get_values.
DATA lv_answer TYPE c LENGTH 1.
FIELD-SYMBOLS: <ls_field> TYPE sval.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
no_value_check = iv_no_value_check
popup_title = iv_popup_title
IMPORTING
returncode = lv_answer
TABLES
fields = ct_fields
EXCEPTIONS
OTHERS = 1 ##NO_TEXT.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from POPUP_GET_VALUES' ).
ENDIF.
IF lv_answer = c_answer_cancel.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
IF ev_value_1 IS SUPPLIED.
READ TABLE ct_fields INDEX 1 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_value_1 = <ls_field>-value.
ENDIF.
IF ev_value_2 IS SUPPLIED.
READ TABLE ct_fields INDEX 2 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_value_2 = <ls_field>-value.
ENDIF.
IF ev_value_3 IS SUPPLIED.
READ TABLE ct_fields INDEX 3 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_value_3 = <ls_field>-value.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
12924,
4739,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
4810,
3824,
6158,
198,
220,
10188,
9864,
1847,
48167,
1677,
5258,
1976,
565,
62,
397,
499,
18300,
62,
9019,
62,
69,
9548,
13,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
23255,
37,
2246,
1546,
25,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
13,
198,
220,
220,
220,
8355,
43429,
1546,
25,
198,
220,
220,
220,
220,
220,
46207,
62,
26495,
62,
39344,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
26495,
62,
39344,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
43551,
62,
6404,
291,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
43551,
62,
6404,
291,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
15252,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
15252,
11,
198,
220,
220,
220,
220,
220,
2251,
62,
1671,
3702,
62,
12924,
929,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
17953,
62,
1671,
3702,
62,
12924,
929,
11,
198,
220,
220,
220,
220,
220,
29924,
62,
3605,
62,
2364,
1370,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
260,
7501,
62,
3605,
62,
2364,
1370,
11,
198,
220,
220,
220,
220,
220,
8478,
62,
4868,
62,
12924,
929,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
1671,
3702,
62,
4868,
62,
12924,
929,
11,
198,
220,
220,
220,
220,
220,
29924,
62,
12924,
929,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
260,
7501,
62,
12924,
929,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
1462,
62,
10414,
2533,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
1462,
62,
10414,
2533,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
1462,
62,
259,
687,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
1462,
62,
259,
687,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
1462,
62,
17953,
62,
26495,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
1462,
62,
17953,
62,
26495,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
1462,
62,
17953,
62,
7645,
79,
62,
1671,
3702,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
1462,
62,
17953,
62,
7645,
79,
62,
1671,
3702,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
1462,
62,
19738,
62,
7645,
3742,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
1462,
62,
19738,
62,
7645,
3742,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
1462,
62,
19738,
62,
6738,
62,
4868,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
1462,
62,
19738,
62,
6738,
62,
4868,
11,
198,
220,
220,
220,
220,
220,
8478,
62,
12924,
929,
62,
47423,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
1671,
3702,
62,
12924,
929,
62,
47423,
11,
198,
220,
220,
220,
220,
220,
5301,
62,
12924,
929,
62,
47423,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
26495,
62,
12924,
929,
62,
47423,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
7645,
634,
62,
25927,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
7645,
634,
62,
25927,
11,
198,
220,
220,
220,
220,
220,
46207,
62,
36436,
62,
1525,
6603,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7473,
1976,
361,
62,
397,
499,
18300,
62,
12924,
4739,
93,
12924,
929,
62,
36436,
62,
1525,
6603,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
82,
2100,
62,
926,
41876,
49053,
9795,
43679,
3963,
264,
2100,
13315,
5550,
38865,
35374,
13,
628,
220,
220,
220,
7102,
2257,
1565,
4694,
269,
62,
3245,
3672,
62,
34213,
41876,
300,
28435,
62,
69,
3672,
26173,
8924,
4600,
46506,
1961,
63,
22492,
15285,
62,
32541,
13,
198,
220,
220,
220,
7102,
2257,
1565,
4694,
269,
62,
41484,
62,
66,
21130,
220,
220,
220,
220,
220,
41876,
269,
406,
49494,
352,
26173,
8924,
705,
32,
6,
22492,
15285,
62,
32541,
13,
628,
220,
220,
220,
42865,
6941,
62,
19738,
62,
4868,
62,
12924,
929,
41876,
4526,
37,
5390,
537,
62,
21680,
85,
62,
11487,
764,
198,
220,
220,
220,
42865,
285,
81,
62,
11487,
41876,
4526,
37,
5390,
1366,
764,
198,
220,
220,
220,
42865,
285,
85,
62,
66,
21130,
41876,
450,
499,
62,
30388,
26173,
8924,
450,
499,
62,
9562,
13,
198,
220,
220,
220,
42865,
6941,
62,
11487,
62,
20147,
81,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
83,
4510,
3798,
81,
764,
628,
220,
220,
220,
337,
36252,
50,
751,
62,
3245,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
8658,
3672,
220,
220,
220,
41876,
264,
2100,
12,
8658,
3672,
198,
220,
220,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_excel_ole DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES ty_doc_url TYPE c LENGTH 255.
CLASS-METHODS bind_alv_ole2
IMPORTING
!i_document_url TYPE ty_doc_url DEFAULT space
!i_xls TYPE c DEFAULT space
!i_save_path TYPE string
!io_alv TYPE REF TO cl_gui_alv_grid
!it_listheader TYPE slis_t_listheader OPTIONAL
!i_top TYPE i DEFAULT 1
!i_left TYPE i DEFAULT 1
!i_columns_header TYPE c DEFAULT 'X'
!i_columns_autofit TYPE c DEFAULT 'X'
!i_format_col_header TYPE soi_format_item OPTIONAL
!i_format_subtotal TYPE soi_format_item OPTIONAL
!i_format_total TYPE soi_format_item OPTIONAL
EXCEPTIONS
miss_guide
ex_transfer_kkblo_error
fatal_error
inv_data_range
dim_mismatch_vkey
dim_mismatch_sema
error_in_sema .
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS close_document.
CLASS-METHODS error_doi.
CLASS-DATA: lo_spreadsheet TYPE REF TO i_oi_spreadsheet,
lo_control TYPE REF TO i_oi_container_control,
lo_proxy TYPE REF TO i_oi_document_proxy,
lo_error TYPE REF TO i_oi_error,
lc_retcode TYPE soi_ret_string.
ENDCLASS.
CLASS zcl_excel_ole IMPLEMENTATION.
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: li_has TYPE i. "Proxy has spreadsheet interface?
* 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.
*--------------------------------------------------------------------*
* SESSION 0: DOI CONSTRUCTOR
*--------------------------------------------------------------------*
* check active windown
CALL FUNCTION 'GUI_HAS_ACTIVEX'
IMPORTING
return = l_has_activex.
IF l_has_activex IS INITIAL.
RAISE miss_guide.
ENDIF.
* Get Container Object of Screen
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = lo_control
retcode = lc_retcode.
error_doi( ).
* Initialize Container control
CALL METHOD lo_control->init_control
EXPORTING
parent = cl_gui_container=>default_screen
r3_application_name = ''
inplace_enabled = 'X'
no_flush = 'X'
register_on_close_event = 'X'
register_on_custom_event = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi( ).
* Get Proxy Document:
* check exist of document proxy, if exist -> close first
IF NOT lo_proxy IS INITIAL.
close_document( ).
ENDIF.
IF i_xls IS NOT INITIAL.
* xls format, doctype = soi_doctype_excel97_sheet
l_doctype_excel_sheet = 'Excel.Sheet.8'.
ELSE.
* xlsx format, doctype = soi_doctype_excel_sheet
l_doctype_excel_sheet = 'Excel.Sheet'.
ENDIF.
CALL METHOD lo_control->get_document_proxy
EXPORTING
document_type = l_doctype_excel_sheet
register_container = 'X'
IMPORTING
document_proxy = lo_proxy
error = lo_error
retcode = lc_retcode.
error_doi( ).
IF i_document_url IS INITIAL.
* create new excel document
CALL METHOD lo_proxy->create_document
EXPORTING
create_view_data = 'X'
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi( ).
ELSE.
* Read excel template for i_DOCUMENT_URL
* this excel template can be store in local or server
CALL METHOD lo_proxy->open_document
EXPORTING
document_url = i_document_url
open_inplace = 'X'
no_flush = 'X'
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi( ).
ENDIF.
* Check Spreadsheet Interface of Document Proxy
CALL METHOD lo_proxy->has_spreadsheet_interface
IMPORTING
is_available = li_has
error = lo_error
retcode = lc_retcode.
error_doi( ).
* create Spreadsheet object
CHECK li_has IS NOT INITIAL.
CALL METHOD lo_proxy->get_spreadsheet_interface
IMPORTING
sheet_interface = lo_spreadsheet
error = lo_error
retcode = lc_retcode.
error_doi( ).
*--------------------------------------------------------------------*
* SESSION 1: GET LVC DATA FROM ALV OBJECT
*--------------------------------------------------------------------*
* data table
CREATE OBJECT lo_grid
EXPORTING
i_parent = cl_gui_container=>screen0.
CALL METHOD lo_grid->get_alv_attributes
EXPORTING
io_grid = io_alv
IMPORTING
et_table = lt_alv.
ASSIGN lt_alv->* TO <f_alv_tab>.
* fieldcat
CALL METHOD io_alv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fieldcat_lvc.
* table name
LOOP AT lt_fieldcat_lvc INTO wa_fieldcat_lvc
WHERE NOT tabname IS INITIAL.
l_tabname = wa_fieldcat_lvc-tabname.
EXIT.
ENDLOOP.
IF sy-subrc NE 0.
l_tabname = '1'.
ENDIF.
CLEAR: wa_fieldcat_lvc.
* sort table
CALL METHOD io_alv->get_sort_criteria
IMPORTING
et_sort = lt_sort_lvc.
* filter index
CALL METHOD io_alv->get_filtered_entries
IMPORTING
et_filtered_entries = lt_filter_idx_lvc.
* group level + subtotal
CALL METHOD io_alv->get_subtotals
IMPORTING
ep_collect00 = lt_collect00
ep_collect01 = lt_collect01
ep_collect02 = lt_collect02
ep_collect03 = lt_collect03
ep_collect04 = lt_collect04
ep_collect05 = lt_collect05
ep_collect06 = lt_collect06
ep_collect07 = lt_collect07
ep_collect08 = lt_collect08
ep_collect09 = lt_collect09
et_grouplevels = lt_grouplevels_lvc.
ASSIGN lt_collect00->* TO <f_collect00>.
ASSIGN lt_collect01->* TO <f_collect01>.
ASSIGN lt_collect02->* TO <f_collect02>.
ASSIGN lt_collect03->* TO <f_collect03>.
ASSIGN lt_collect04->* TO <f_collect04>.
ASSIGN lt_collect05->* TO <f_collect05>.
ASSIGN lt_collect06->* TO <f_collect06>.
ASSIGN lt_collect07->* TO <f_collect07>.
ASSIGN lt_collect08->* TO <f_collect08>.
ASSIGN lt_collect09->* TO <f_collect09>.
* transfer to KKBLO struct
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
it_fieldcat_lvc = lt_fieldcat_lvc
it_sort_lvc = lt_sort_lvc
it_filter_index_lvc = lt_filter_idx_lvc
it_grouplevels_lvc = lt_grouplevels_lvc
IMPORTING
et_fieldcat_kkblo = lt_fieldcat_kkblo
et_sort_kkblo = lt_sort_kkblo
et_filtered_entries_kkblo = lt_filter_idx_kkblo
et_grouplevels_kkblo = lt_grouplevels_kkblo
TABLES
it_data = <f_alv_tab>
EXCEPTIONS
it_data_missing = 1
it_fieldcat_lvc_missing = 2
OTHERS = 3.
IF sy-subrc <> 0.
RAISE ex_transfer_kkblo_error.
ENDIF.
CLEAR:
wa_fieldcat_lvc,
lt_fieldcat_lvc,
lt_sort_lvc,
lt_filter_idx_lvc,
lt_grouplevels_lvc.
CLEAR:
lo_grid.
*--------------------------------------------------------------------*
* SESSION 2: SORT, FILTER AND CALCULATE TOTAL / SUBTOTAL
*--------------------------------------------------------------------*
* append subtotal & total line
CREATE DATA lt_excel LIKE <f_alv_tab>.
ASSIGN lt_excel->* TO <f_excel_tab>.
LOOP AT <f_alv_tab> ASSIGNING <f_line>.
l_save_index = sy-tabix.
* filter base on filter index table
READ TABLE lt_filter_idx_kkblo ASSIGNING <f_filter_idx_line>
WITH KEY index = l_save_index
BINARY SEARCH.
IF sy-subrc NE 0.
APPEND <f_line> TO <f_excel_tab>.
ENDIF.
* append subtotal lines
READ TABLE lt_grouplevels_kkblo ASSIGNING <f_grouplevels_line>
WITH KEY index_to = l_save_index
BINARY SEARCH.
IF sy-subrc = 0.
l_tabix = sy-tabix.
DO.
IF <f_grouplevels_line>-subtot EQ 'X' AND
<f_grouplevels_line>-hide_level IS INITIAL AND
<f_grouplevels_line>-cindex_from NE 0.
* dynamic append subtotal line to excel table base on grouplevel table
* ex <f_GROUPLEVELS_line>-level = 1
* then <f_collect_tab> = '<F_COLLECT01>'
l_collect = <f_grouplevels_line>-level.
CONDENSE l_collect.
CONCATENATE '<F_COLLECT0'
l_collect '>'
* '->*'
INTO l_collect.
ASSIGN (l_collect) TO <f_collect_tab>.
* incase there're more than 1 total line of group, at the same level
* for example: subtotal of multi currency
LOOP AT <f_collect_tab> ASSIGNING <f_collect_line>.
IF sy-tabix BETWEEN <f_grouplevels_line>-cindex_from
AND <f_grouplevels_line>-cindex_to.
APPEND <f_collect_line> TO <f_excel_tab>.
* save subtotal lines index
wa_subtot_indexs-index = sy-tabix.
APPEND wa_subtot_indexs TO lt_subtot_indexs.
* append sub total ranges table for format later
ADD 1 TO l_sub_index.
subrangeitem-name = l_sub_index.
CONDENSE subrangeitem-name.
CONCATENATE 'SUBTOT'
subrangeitem-name
INTO subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
APPEND subrangeitem TO subranges.
CLEAR: subrangeitem.
ENDIF.
ENDLOOP.
UNASSIGN: <f_collect_tab>.
UNASSIGN: <f_collect_line>.
CLEAR: l_collect.
ENDIF.
* check next subtotal level of group
UNASSIGN: <f_grouplevels_line>.
ADD 1 TO l_tabix.
READ TABLE lt_grouplevels_kkblo ASSIGNING <f_grouplevels_line>
INDEX l_tabix.
IF sy-subrc NE 0
OR <f_grouplevels_line>-index_to NE l_save_index.
EXIT.
ENDIF.
UNASSIGN:
<f_collect_tab>,
<f_collect_line>.
ENDDO.
ENDIF.
CLEAR:
l_tabix,
l_save_index.
UNASSIGN:
<f_filter_idx_line>,
<f_grouplevels_line>.
ENDLOOP.
* free local data
UNASSIGN:
<f_line>,
<f_collect_tab>,
<f_collect_line>,
<f_fieldcat_line>.
* append grand total line
IF <f_collect00> IS ASSIGNED.
ASSIGN <f_collect00> TO <f_collect_tab>.
IF <f_collect_tab> IS NOT INITIAL.
LOOP AT <f_collect_tab> ASSIGNING <f_collect_line>.
APPEND <f_collect_line> TO <f_excel_tab>.
* save total line index
wa_subtot_indexs-index = sy-tabix.
APPEND wa_subtot_indexs TO lt_subtot_indexs.
* append grand total range (to format)
ADD 1 TO l_sub_index.
subrangeitem-name = l_sub_index.
CONDENSE subrangeitem-name.
CONCATENATE 'TOTAL'
subrangeitem-name
INTO subrangeitem-name.
subrangeitem-rows = wa_subtot_indexs-index.
subrangeitem-columns = 1. " start col
APPEND subrangeitem TO subranges.
ENDLOOP.
ENDIF.
ENDIF.
CLEAR:
subrangeitem,
lt_sort_kkblo,
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>.
UNASSIGN:
<f_collect00>,
<f_collect01>,
<f_collect02>,
<f_collect03>,
<f_collect04>,
<f_collect05>,
<f_collect06>,
<f_collect07>,
<f_collect08>,
<f_collect09>,
<f_collect_tab>,
<f_collect_line>.
*--------------------------------------------------------------------*
* SESSION 3: MAP DATA TO SEMANTIC TABLE
*--------------------------------------------------------------------*
* get dependent field field: currency and quantity
CREATE DATA wa LIKE LINE OF <f_excel_tab>.
ASSIGN wa->* TO <f_excel_line>.
DESCRIBE FIELD <f_excel_line> TYPE l_typ COMPONENTS l_num.
DO l_num TIMES.
l_save_index = sy-index.
ASSIGN COMPONENT l_save_index OF STRUCTURE <f_excel_line>
TO <f_excel_column>.
IF sy-subrc NE 0.
MESSAGE e801(zabap2xlsx) WITH 'FATAL ERROR' RAISING fatal_error.
ENDIF.
LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WHERE tabname = l_tabname.
ASSIGN COMPONENT <f_fieldcat_line>-fieldname
OF STRUCTURE <f_excel_line> TO <f_fcat_column>.
DESCRIBE DISTANCE BETWEEN <f_excel_column> AND <f_fcat_column>
INTO l_int IN BYTE MODE.
* append column index
* this columns index is of table, not fieldcat
IF l_int = 0.
wa_column_index-fieldname = <f_fieldcat_line>-fieldname.
wa_column_index-tabname = <f_fieldcat_line>-tabname.
wa_column_index-col = l_save_index.
APPEND wa_column_index TO lt_column_index.
ENDIF.
* append dependent fields (currency and quantity unit)
IF <f_fieldcat_line>-cfieldname IS NOT INITIAL.
CLEAR wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-cfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-ctabname.
COLLECT wa_fieldcat_depf INTO lt_fieldcat_depf.
ENDIF.
IF <f_fieldcat_line>-qfieldname IS NOT INITIAL.
CLEAR wa_fieldcat_depf.
wa_fieldcat_depf-fieldname = <f_fieldcat_line>-qfieldname.
wa_fieldcat_depf-tabname = <f_fieldcat_line>-qtabname.
COLLECT wa_fieldcat_depf INTO lt_fieldcat_depf.
ENDIF.
* rewrite field data type
IF <f_fieldcat_line>-inttype = 'X'
AND <f_fieldcat_line>-datatype(3) = 'INT'.
<f_fieldcat_line>-inttype = 'I'.
ENDIF.
ENDLOOP.
CLEAR: l_save_index.
UNASSIGN: <f_fieldcat_line>.
ENDDO.
* build semantic tables
l_n_hrz_keys = 1.
* Get keyfigures
LOOP AT lt_fieldcat_kkblo ASSIGNING <f_fieldcat_line>
WHERE tabname = l_tabname
AND tech NE 'X'
AND no_out NE 'X'.
CLEAR wa_sema.
CLEAR wa_hkey.
* Units belong to keyfigures -> display as str
READ TABLE lt_fieldcat_depf INTO wa_fieldcat_depf WITH KEY
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
IF sy-subrc = 0.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
* Keyfigures
ELSE.
CASE <f_fieldcat_line>-datatype.
WHEN 'QUAN'.
wa_sema-col_typ = 'N03'.
IF <f_fieldcat_line>-no_sum NE 'X'.
wa_sema-col_ops = 'ADD'.
ELSE.
wa_sema-col_ops = 'NOP'. " no dependent field
ENDIF.
WHEN 'DATS'.
wa_sema-col_typ = 'DAT'.
wa_sema-col_ops = 'NOP'.
WHEN 'CHAR' OR 'UNIT' OR 'CUKY'. " Added fieldformats UNIT and CUKY - dd. 26-10-2012 Wouter Heuvelmans
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'. " dependent field
* incase numeric, ex '00120' -> display as '12'
WHEN 'NUMC'.
wa_sema-col_typ = 'STR'.
wa_sema-col_ops = 'DFT'.
WHEN OTHERS.
wa_sema-col_typ = 'NUM'.
IF <f_fieldcat_line>-no_sum NE 'X'.
wa_sema-col_ops = 'ADD'.
ELSE.
wa_sema-col_ops = 'NOP'.
ENDIF.
ENDCASE.
ENDIF.
l_counter = l_counter + 1.
l_n_att_cols = l_n_att_cols + 1.
wa_sema-col_no = l_counter.
READ TABLE lt_column_index INTO wa_column_index WITH KEY
fieldname = <f_fieldcat_line>-fieldname
tabname = <f_fieldcat_line>-tabname.
IF sy-subrc = 0.
wa_sema-col_src = wa_column_index-col.
ELSE.
RAISE fatal_error.
ENDIF.
* columns index of ref currency field in table
IF NOT <f_fieldcat_line>-cfieldname IS INITIAL.
READ TABLE lt_column_index INTO wa_column_index WITH KEY
fieldname = <f_fieldcat_line>-cfieldname
tabname = <f_fieldcat_line>-ctabname.
IF sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
ENDIF.
* quantities fields
* treat as currency when display on excel
ELSEIF NOT <f_fieldcat_line>-qfieldname IS INITIAL.
READ TABLE lt_column_index INTO wa_column_index WITH KEY
fieldname = <f_fieldcat_line>-qfieldname
tabname = <f_fieldcat_line>-qtabname.
IF sy-subrc = 0.
wa_sema-col_cur = wa_column_index-col.
ENDIF.
ENDIF.
* Treat of fixed currency in the fieldcatalog for column
DATA: l_num_help(2) TYPE n.
IF NOT <f_fieldcat_line>-currency IS INITIAL.
SELECT * FROM tcurx INTO TABLE lt_tcurx.
SORT lt_tcurx.
READ TABLE lt_tcurx INTO wa_tcurx
WITH KEY currkey = <f_fieldcat_line>-currency.
IF sy-subrc = 0.
l_num_help = wa_tcurx-currdec.
CONCATENATE 'N' l_num_help INTO wa_sema-col_typ.
wa_sema-col_cur = sy-tabix * ( -1 ).
ENDIF.
ENDIF.
wa_hkey-col_no = l_n_att_cols.
wa_hkey-row_no = l_n_hrz_keys.
wa_hkey-col_name = <f_fieldcat_line>-reptext.
APPEND wa_hkey TO lt_hkey.
APPEND wa_sema TO lt_sema.
ENDLOOP.
* free local data
CLEAR:
lt_column_index,
wa_column_index,
lt_fieldcat_depf,
wa_fieldcat_depf,
lt_tcurx,
wa_tcurx,
l_num,
l_typ,
wa,
l_int,
l_counter.
UNASSIGN:
<f_fieldcat_line>,
<f_excel_line>,
<f_excel_column>,
<f_fcat_column>.
*--------------------------------------------------------------------*
* SESSION 4: WRITE TO EXCEL
*--------------------------------------------------------------------*
CLEAR: wa_tcurx.
REFRESH: lt_tcurx.
* if spreadsheet dun have proxy yet
IF li_has IS INITIAL.
l_retcode = c_oi_errors=>ret_interface_not_supported.
CALL METHOD c_oi_errors=>create_error_for_retcode
EXPORTING
retcode = l_retcode
no_flush = no_flush
IMPORTING
error = lo_error_w.
RETURN.
ENDIF.
CREATE OBJECT l_error
EXPORTING
object_name = 'OLE_DOCUMENT_PROXY'
method_name = 'get_ranges_names'.
CALL METHOD c_oi_errors=>add_error
EXPORTING
error = l_error.
DESCRIBE TABLE lt_sema LINES datareal.
DESCRIBE TABLE <f_excel_tab> LINES datac.
DESCRIBE TABLE lt_vkey LINES vkeycount.
IF datac = 0.
RAISE inv_data_range.
ENDIF.
IF vkeycount NE l_n_vrt_keys.
RAISE dim_mismatch_vkey.
ENDIF.
all = l_n_vrt_keys + l_n_att_cols.
IF datareal NE all.
RAISE dim_mismatch_sema.
ENDIF.
DATA: decimal TYPE c.
* get decimal separator format ('.', ',', ...) in Office config
CALL METHOD lo_proxy->get_application_property
EXPORTING
property_name = 'INTERNATIONAL'
subproperty_name = 'DECIMAL_SEPARATOR'
CHANGING
retvalue = decimal.
DATA date_format TYPE usr01-datfm.
SELECT SINGLE datfm FROM usr01 INTO date_format WHERE bname = sy-uname.
DATA: comma_elim(4) TYPE c.
FIELD-SYMBOLS <g> TYPE any.
DATA search_item(4) VALUE ' #'.
CONCATENATE ',' decimal '.' decimal INTO comma_elim.
DATA help TYPE i. " table (with subtotal) line number
help = datac.
DATA: rowmax TYPE i VALUE 1. " header row number
DATA: columnmax TYPE i VALUE 0. " header columns number
LOOP AT lt_hkey INTO hkeyitem.
IF hkeyitem-col_no > columnmax.
columnmax = hkeyitem-col_no.
ENDIF.
IF hkeyitem-row_no > rowmax.
rowmax = hkeyitem-row_no.
ENDIF.
ENDLOOP.
DATA: hkeycolumns TYPE i. " header columns no
hkeycolumns = columnmax.
IF hkeycolumns < l_n_att_cols.
hkeycolumns = l_n_att_cols.
ENDIF.
columnmax = 0.
LOOP AT lt_vkey INTO vkeyitem.
IF vkeyitem-col_no > columnmax.
columnmax = vkeyitem-col_no.
ENDIF.
ENDLOOP.
DATA overflow TYPE i VALUE 1.
DATA testname(10) TYPE c.
DATA temp2 TYPE i. " 1st item row position in excel
DATA realmit TYPE i VALUE 1.
DATA realoverflow TYPE i VALUE 1. " row index in content
CALL METHOD lo_spreadsheet->screen_update
EXPORTING
updating = ''.
CALL METHOD lo_spreadsheet->load_lib.
DATA: str(40) TYPE c. " range names of columns range (w/o col header)
DATA: rows TYPE i. " row postion of 1st item line in ecxel
* calculate row position of data table
DESCRIBE TABLE it_listheader LINES li_commentary_rows.
* if grid had title, add 1 empy line between title and table
IF li_commentary_rows NE 0.
ADD 1 TO li_commentary_rows.
ENDIF.
* add top position of block data
li_commentary_rows = li_commentary_rows + i_top - 1.
* write header (commentary rows)
DATA: li_commentary_row_index TYPE i VALUE 1.
DATA: li_content_index TYPE i VALUE 1.
DATA: ls_index(10) TYPE c.
DATA ls_commentary_range(40) TYPE c VALUE 'TITLE'.
DATA: li_font_bold TYPE i.
DATA: li_font_italic TYPE i.
DATA: li_font_size TYPE i.
LOOP AT it_listheader INTO wa_listheader.
li_commentary_row_index = i_top + li_content_index - 1.
ls_index = li_content_index.
CONDENSE ls_index.
CONCATENATE ls_commentary_range(5) ls_index
INTO ls_commentary_range.
CONDENSE ls_commentary_range.
* insert title range
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = ls_commentary_range
top = li_commentary_row_index
left = i_left
rows = 1
columns = 1
no_flush = no_flush.
* format range
CASE wa_listheader-typ.
WHEN 'H'. "title
li_font_size = 16.
li_font_bold = 1.
li_font_italic = -1.
WHEN 'S'. "subtile
li_font_size = -1.
li_font_bold = 1.
li_font_italic = -1.
WHEN OTHERS. "'A' comment
li_font_size = -1.
li_font_bold = -1.
li_font_italic = 1.
ENDCASE.
CALL METHOD lo_spreadsheet->set_font
EXPORTING
rangename = ls_commentary_range
family = ''
size = li_font_size
bold = li_font_bold
italic = li_font_italic
align = 0
no_flush = no_flush.
* title: range content
rangeitem-name = ls_commentary_range.
rangeitem-columns = 1.
rangeitem-rows = 1.
APPEND rangeitem TO ranges.
contentsitem-row = li_content_index.
contentsitem-column = 1.
CONCATENATE wa_listheader-key
wa_listheader-info
INTO contentsitem-value
SEPARATED BY space.
CONDENSE contentsitem-value.
APPEND contentsitem TO contents.
ADD 1 TO li_content_index.
CLEAR:
rangeitem,
contentsitem,
ls_index.
ENDLOOP.
* set range data title
CALL METHOD lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
REFRESH:
ranges,
contents.
rows = rowmax + li_commentary_rows + 1.
all = date_format.
all = all + 3.
LOOP AT lt_sema INTO semaitem.
IF semaitem-col_typ = 'DAT' OR semaitem-col_typ = 'MON' OR
semaitem-col_typ = 'N00' OR semaitem-col_typ = 'N01' OR
semaitem-col_typ = 'N02' OR
semaitem-col_typ = 'N03' OR semaitem-col_typ = 'PCT' OR
semaitem-col_typ = 'STR' OR semaitem-col_typ = 'NUM'.
CLEAR str.
str = semaitem-col_no.
CONDENSE str.
CONCATENATE 'DATA' str INTO str.
mit = semaitem-col_no.
li_col_pos = semaitem-col_no + i_left - 1.
* range from data1 to data(n), for each columns of table
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = str
top = rows
left = li_col_pos
rows = help
columns = 1
no_flush = no_flush.
DATA dec TYPE i VALUE -1.
DATA typeinfo TYPE sydes_typeinfo.
LOOP AT <f_excel_tab> ASSIGNING <line>.
ASSIGN COMPONENT semaitem-col_no OF STRUCTURE <line> TO <item>.
DESCRIBE FIELD <item> INTO td.
READ TABLE td-types INDEX 1 INTO typeinfo.
IF typeinfo-type = 'P'.
dec = typeinfo-decimals.
ELSEIF typeinfo-type = 'I'.
dec = 0.
ENDIF.
DESCRIBE FIELD <line> TYPE typ COMPONENTS count.
mit = 1.
DO count TIMES.
IF mit = semaitem-col_src.
ASSIGN COMPONENT sy-index OF STRUCTURE <line> TO <item>.
DESCRIBE FIELD <item> INTO td.
READ TABLE td-types INDEX 1 INTO typeinfo.
IF typeinfo-type = 'P'.
dec = typeinfo-decimals.
ENDIF.
EXIT.
ENDIF.
mit = mit + 1.
ENDDO.
EXIT.
ENDLOOP.
* format for each columns of table (w/o columns headers)
IF semaitem-col_typ = 'DAT'.
IF semaitem-col_no > vkeycount.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = all
no_flush = no_flush.
ELSE.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
ENDIF.
ELSEIF semaitem-col_typ = 'STR'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 0
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'MON'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 10
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N00'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 0
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N01'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 1
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N02'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N03'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 3
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'N04'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 4
no_flush = no_flush.
ELSEIF semaitem-col_typ = 'NUM'.
IF dec EQ -1.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = 2
no_flush = no_flush.
ELSE.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 1
decimals = dec
no_flush = no_flush.
ENDIF.
ELSEIF semaitem-col_typ = 'PCT'.
CALL METHOD lo_spreadsheet->set_format
EXPORTING
rangename = str
currency = ''
typ = 3
decimals = 0
no_flush = no_flush.
ENDIF.
ENDIF.
ENDLOOP.
* get item contents for set_range_data method
* get currency cell also
mit = 1.
DATA: currcells TYPE soi_cell_table.
DATA: curritem TYPE soi_cell_item.
curritem-rows = 1.
curritem-columns = 1.
curritem-front = -1.
curritem-back = -1.
curritem-font = ''.
curritem-size = -1.
curritem-bold = -1.
curritem-italic = -1.
curritem-align = -1.
curritem-frametyp = -1.
curritem-framecolor = -1.
curritem-currency = ''.
curritem-number = 1.
curritem-input = -1.
DATA: const TYPE i.
* Change for Correction request
* Initial 10000 lines are missing in Excel Export
* if there are only 2 columns in exported List object.
IF datareal GT 2.
const = 20000 / datareal.
ELSE.
const = 20000 / ( datareal + 2 ).
ENDIF.
DATA: lines TYPE i.
DATA: innerlines TYPE i.
DATA: counter TYPE i.
DATA: curritem2 LIKE curritem.
DATA: curritem3 LIKE curritem.
DATA: length TYPE i.
DATA: found.
* append content table (for method set_range_content)
LOOP AT <f_excel_tab> ASSIGNING <line>.
* save line index to compare with lt_subtot_indexs,
* to discover line is a subtotal / totale line or not
* ex use to set 'dun display zero in subtotal / total line'
l_save_index = sy-tabix.
DO datareal TIMES.
READ TABLE lt_sema INTO semaitem WITH KEY col_no = sy-index.
IF semaitem-col_src NE 0.
ASSIGN COMPONENT semaitem-col_src
OF STRUCTURE <line> TO <item>.
ELSE.
ASSIGN COMPONENT sy-index
OF STRUCTURE <line> TO <item>.
ENDIF.
contentsitem-row = realoverflow.
IF sy-subrc = 0.
search_item(3) = semaitem-col_ops.
SEARCH 'ADD#CNT#MIN#MAX#AVG#NOP#DFT#'
FOR search_item.
IF sy-subrc NE 0.
RAISE error_in_sema.
ENDIF.
search_item(3) = semaitem-col_typ.
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.
contentsitem-value = <item>.
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.
curritem3 = curritem.
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.
curritem3 = curritem.
curritem3-columns = curritem3-columns + curritem2-columns.
curritem-left = -1.
MODIFY currcells INDEX sy-index FROM curritem.
curritem2-left = -1.
MODIFY currcells INDEX counter FROM curritem2.
APPEND curritem3 TO currcells.
found = 'X'.
ENDIF.
ENDIF.
ENDDO.
IF found IS INITIAL.
EXIT.
ENDIF.
DELETE currcells WHERE left = -1.
ENDDO.
* Ende der Zusammenfassung
* item data: format for currency cell, corresponding with currency
CALL METHOD lo_spreadsheet->cell_format
EXPORTING
cells = currcells
no_flush = no_flush.
* item data: write item table content
CALL METHOD lo_spreadsheet->set_ranges_data
EXPORTING
ranges = ranges
contents = contents
no_flush = no_flush.
* whole table range to format all table
IF i_columns_header = 'X'.
li_head_top = li_commentary_rows + 1.
ELSE.
li_head_top = li_commentary_rows + 2.
help = help - 1.
ENDIF.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = 'WHOLE_TABLE'
top = li_head_top
left = i_left
rows = help
columns = datareal
no_flush = no_flush.
* columns width auto fix
* this parameter = space in case use with exist template
IF i_columns_autofit = 'X'.
CALL METHOD lo_spreadsheet->fit_widest
EXPORTING
name = 'WHOLE_TABLE'
no_flush = no_flush.
ENDIF.
* frame
* The parameter has 8 bits
*0 Left margin
*1 Top marginT
*2 Bottom margin
*3 Right margin
*4 Horizontal line
*5 Vertical line
*6 Thinness
*7 Thickness
* here 127 = 1111111 6-5-4-3-2-1 mean Thin-ver-hor-right-bot-top-left
* ( final DOI method call, set no_flush = space
* equal to call method CL_GUI_CFW=>FLUSH )
CALL METHOD lo_spreadsheet->set_frame
EXPORTING
rangename = 'WHOLE_TABLE'
typ = 127
color = 1
no_flush = space
IMPORTING
error = lo_error
retcode = lc_retcode.
error_doi( ).
* reformat subtotal / total line after format wholw table
LOOP AT subranges INTO subrangeitem.
l_sub_index = subrangeitem-rows + li_commentary_rows + rowmax.
CALL METHOD lo_spreadsheet->insert_range_dim
EXPORTING
name = subrangeitem-name
left = i_left
top = l_sub_index
rows = 1
columns = datareal
no_flush = no_flush.
wa_format-name = subrangeitem-name.
* default format:
* - clolor: subtotal = light yellow, subtotal = yellow
* - frame: box
IF subrangeitem-name(3) = 'SUB'.
wa_format-back = 36. "subtotal line
wa_format_temp = i_format_subtotal.
ELSE.
wa_format-back = 27. "total line
wa_format_temp = i_format_total.
ENDIF.
wa_format-frametyp = 79.
wa_format-framecolor = 1.
wa_format-number = -1.
wa_format-align = -1.
* get subtoal + total format from intput parameter
* overwrite default format
IF wa_format_temp IS NOT INITIAL.
DESCRIBE FIELD wa_format_temp TYPE l_typ COMPONENTS li_col_num.
DO li_col_num TIMES.
IF sy-index NE 1. " dun map range name
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format_temp
TO <f_source>.
IF <f_source> IS NOT INITIAL.
ASSIGN COMPONENT sy-index OF STRUCTURE wa_format TO <f_des>.
<f_des> = <f_source>.
UNASSIGN: <f_des>.
ENDIF.
UNASSIGN: <f_source>.
ENDIF.
ENDDO.
CLEAR: li_col_num.
ENDIF.
APPEND wa_format TO lt_format.
CLEAR: wa_format-name.
CLEAR: l_sub_index.
CLEAR: wa_format_temp.
ENDLOOP.
IF lt_format[] IS NOT INITIAL.
CALL METHOD lo_spreadsheet->set_ranges_format
EXPORTING
formattable = lt_format
no_flush = no_flush.
REFRESH: lt_format.
ENDIF.
*--------------------------------------------------------------------*
CALL METHOD lo_spreadsheet->screen_update
EXPORTING
updating = 'X'.
CALL METHOD c_oi_errors=>flush_errors.
lo_error_w = l_error.
lc_retcode = lo_error_w->error_code.
** catch no_flush -> led to dump ( optional )
* go_error = l_error.
* gc_retcode = go_error->error_code.
* error_doi.
CLEAR:
lt_sema,
wa_sema,
lt_hkey,
wa_hkey,
lt_vkey,
wa_vkey,
l_n_hrz_keys,
l_n_att_cols,
l_n_vrt_keys,
count,
datac,
datareal,
vkeycount,
all,
mit,
li_col_pos,
li_col_num,
ranges,
rangeitem,
contents,
contentsitem,
semaitem,
hkeyitem,
vkeyitem,
li_commentary_rows,
l_retcode,
li_head_top,
<f_excel_tab>.
CLEAR:
lo_error_w.
UNASSIGN:
<line>,
<item>,
<f_excel_tab>.
*--------------------------------------------------------------------*
* SESSION 5: SAVE AND CLOSE FILE
*--------------------------------------------------------------------*
* ex of save path: 'FILE://C:\temp\test.xlsx'
CONCATENATE 'FILE://' i_save_path
INTO ls_path.
CALL METHOD lo_proxy->save_document_to_url
EXPORTING
no_flush = 'X'
url = ls_path
IMPORTING
error = lo_error
retcode = lc_retcode
CHANGING
document_size = li_document_size.
error_doi( ).
* if save successfully -> raise successful message
MESSAGE i400(zabap2xlsx).
CLEAR:
ls_path,
li_document_size.
close_document( ).
ENDMETHOD. "BIND_ALV_OLE2
METHOD close_document.
DATA: l_is_closed TYPE i.
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.
ENDMETHOD.
METHOD 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.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
1069,
5276,
62,
2305,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
1259,
62,
15390,
62,
6371,
41876,
269,
406,
49494,
14280,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
11007,
62,
282,
85,
62,
2305,
17,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
22897,
62,
6371,
220,
220,
220,
220,
220,
41876,
1259,
62,
15390,
62,
6371,
5550,
38865,
2272,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
87,
7278,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
269,
5550,
38865,
2272,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
21928,
62,
6978,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
282,
85,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
537,
62,
48317,
62,
282,
85,
62,
25928,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
4868,
25677,
220,
220,
220,
220,
220,
220,
41876,
1017,
271,
62,
83,
62,
4868,
25677,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
4852,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
5550,
38865,
352,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
9464,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
5550,
38865,
352,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
28665,
82,
62,
25677,
220,
220,
220,
41876,
269,
5550,
38865,
705,
55,
6,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
28665,
82,
62,
2306,
1659,
270,
220,
220,
41876,
269,
5550,
38865,
705,
55,
6,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
18982,
62,
4033,
62,
25677,
41876,
523,
72,
62,
18982,
62,
9186,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
18982,
62,
7266,
23350,
220,
220,
41876,
523,
72,
62,
18982,
62,
9186,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
72,
62,
18982,
62,
23350,
220,
220,
220,
220,
220,
41876,
523,
72,
62,
18982,
62,
9186,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
220,
220,
2051,
62,
41311,
198,
220,
220,
220,
220,
220,
220,
220,
409,
62,
39437,
62,
28747,
2436,
78,
62,
18224,
198,
220,
220,
220,
220,
220,
220,
220,
10800,
62,
18224,
198,
220,
220,
220,
220,
220,
220,
220,
800,
62,
7890,
62,
9521,
198,
220,
220,
220,
220,
220,
220,
220,
5391,
62,
76,
1042,
963,
62,
85,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
5391,
62,
76,
1042,
963,
62,
325,
2611,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
62,
259,
62,
325,
2611,
764,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
1969,
62,
22897,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
4049,
62,
34023,
13,
628,
220,
220,
220,
42715,
12,
26947,
25,
2376,
62,
43639,
21760,
41876,
4526,
37,
5390,
1312,
62,
23013,
62,
43639,
21760,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2376,
62,
13716,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1312,
62,
23013,
62,
34924,
62,
13716,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2376,
62,
36436,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1312,
62,
23013,
62,
22897,
62,
36436,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2376,
62,
18224,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1312,
62,
23013,
62,
18224,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
66,
62,
1186,
8189,
220,
220,
220,
220,
41876,
220,
220,
220,
220,
220,
220,
220,
523,
72,
62,
1186,
62,
8841,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
1069,
5276,
62,
2305,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
11007,
62,
282,
85,
62,
2305,
17,
13,
198,
9,
10097,
650,
9,
198,
9,
11789,
6764,
25,
198,
9,
220,
220,
11789,
779,
284,
10784,
257,
7852,
62,
40156,
62,
1847,
53,
62,
10761,
2389,
2134,
284,
2124,
7278,
87,
14,
87,
7278,
2393,
198,
9,
220,
220,
351,
1351,
13639,
290,
220,
9695,
286,
8355,
53,
2214,
18388,
884,
355,
25,
198,
9,
220,
220,
220,
220,
1343,
7472,
11,
1448,
338,
13284,
4997,
198,
9,
220,
220,
220,
220,
1343,
39789,
7032,
11,
2033,
7032,
357,
21186,
7032,
8,
198,
9,
220,
220,
220,
220,
1343,
1400,
62,
448,
11,
645,
62,
22570,
11,
2644,
198,
9,
41317,
779,
287,
2446,
25,
198,
9,
220,
220,
48323,
27850,
4452,
38410,
357,
18227,
40,
8,
198,
9,
10097,
650,
9,
198,
198,
9,
6060,
329,
6246,
657,
25,
40722,
23772,
198,
9,
20368,
35937,
628,
220,
220,
220,
42865,
25,
7649,
62,
10134,
220,
220,
220,
220,
220,
41876,
1312,
13,
366,
44148,
468,
30117,
7071,
30,
198,
198,
9,
6060,
329,
6246,
352,
25,
3497,
406,
15922,
1366,
422,
8355,
53,
2134,
198,
9,
20368,
35937,
628,
220,
220,
220,
42865,
25,
300,
62,
10134,
62,
5275,
87,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
62,
4598,
310,
2981,
62,
1069,
5276,
62,
21760,
7,
1157,
8,
41876,
269,
13,
198,
198,
9,
406,
15922,
198,
220,
220,
220,
42865,
25,
300,
83,
62,
3245,
9246,
62,
6780,
66,
220,
220,
220,
220,
220,
220,
41876,
300,
28435,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS cl_abap_unit_assert DEFINITION PUBLIC.
PUBLIC SECTION.
CLASS-METHODS
assert_equals
IMPORTING
act TYPE any
exp TYPE any
msg TYPE string OPTIONAL
tol TYPE f OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_differs
IMPORTING
act TYPE string
exp TYPE string
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_number_between
IMPORTING
lower TYPE i
upper TYPE i
number TYPE i
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_not_initial
IMPORTING
act TYPE any
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_initial
IMPORTING
act TYPE any
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
fail
IMPORTING
msg TYPE csequence OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL
PREFERRED PARAMETER msg.
CLASS-METHODS
assert_subrc
IMPORTING
exp TYPE i DEFAULT 0
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_true
IMPORTING
act TYPE abap_bool
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_false
IMPORTING
act TYPE abap_bool
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_char_cp
IMPORTING
act TYPE clike
exp TYPE clike
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_bound
IMPORTING
act TYPE string
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
CLASS-METHODS
assert_not_bound
IMPORTING
act TYPE string
msg TYPE string OPTIONAL
quit TYPE i OPTIONAL
level TYPE i OPTIONAL.
ENDCLASS.
CLASS cl_abap_unit_assert IMPLEMENTATION.
METHOD assert_bound.
ASSERT act IS BOUND.
ENDMETHOD.
METHOD assert_not_bound.
ASSERT act IS NOT BOUND.
ENDMETHOD.
METHOD assert_char_cp.
ASSERT act CP exp.
ENDMETHOD.
METHOD fail.
ASSERT 1 = 2.
ENDMETHOD.
METHOD assert_differs.
ASSERT act <> exp.
ENDMETHOD.
METHOD assert_true.
ASSERT act = abap_true.
ENDMETHOD.
METHOD assert_false.
ASSERT act = abap_false.
ENDMETHOD.
METHOD assert_equals.
DATA type1 TYPE c LENGTH 1.
DATA type2 TYPE c LENGTH 1.
DATA index TYPE i.
DATA diff TYPE f.
FIELD-SYMBOLS <tab1> TYPE INDEX TABLE.
FIELD-SYMBOLS <row1> TYPE any.
FIELD-SYMBOLS <tab2> TYPE INDEX TABLE.
FIELD-SYMBOLS <row2> TYPE any.
DESCRIBE FIELD act TYPE type1.
DESCRIBE FIELD exp TYPE type2.
* WRITE '@KERNEL console.dir(type1.get());'.
* WRITE '@KERNEL console.dir(type2.get());'.
IF type1 CA 'CgyIFPDTX'. " basic types
IF NOT type2 IS INITIAL.
ASSERT type2 CA 'CgyIFPDTX'.
ENDIF.
ELSEIF NOT type1 IS INITIAL AND NOT type2 IS INITIAL.
ASSERT type1 = type2.
ENDIF.
IF type1 = 'h'.
ASSERT lines( act ) = lines( exp ).
ASSIGN act TO <tab1>.
ASSIGN exp TO <tab2>.
DO lines( act ) TIMES.
index = sy-index.
READ TABLE <tab1> INDEX index ASSIGNING <row1>.
ASSERT sy-subrc = 0.
READ TABLE <tab2> INDEX index ASSIGNING <row2>.
ASSERT sy-subrc = 0.
assert_equals( act = <row1>
exp = <row2> ).
ENDDO.
ELSEIF tol IS SUPPLIED.
diff = exp - act.
* WRITE '@KERNEL console.dir(tol);'.
* WRITE '@KERNEL console.dir(diff);'.
ASSERT diff < tol.
ELSE.
ASSERT act = exp.
ENDIF.
ENDMETHOD.
METHOD assert_not_initial.
ASSERT NOT act IS INITIAL.
ENDMETHOD.
METHOD assert_initial.
ASSERT act IS INITIAL.
ENDMETHOD.
METHOD assert_subrc.
ASSERT sy-subrc = exp.
ENDMETHOD.
METHOD assert_number_between.
ASSERT number >= lower.
ASSERT number <= upper.
ENDMETHOD.
ENDCLASS. | [
31631,
537,
62,
397,
499,
62,
20850,
62,
30493,
5550,
20032,
17941,
44731,
13,
198,
220,
44731,
44513,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
4853,
874,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
220,
220,
41876,
597,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
220,
220,
41876,
597,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
220,
220,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
284,
75,
220,
220,
41876,
277,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
220,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
26069,
364,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
17618,
62,
23395,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2793,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6727,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1271,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
220,
220,
220,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
220,
220,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
220,
220,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
1662,
62,
36733,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
41876,
597,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
36733,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
41876,
597,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
2038,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
269,
43167,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
22814,
24302,
22083,
29463,
2390,
2767,
1137,
31456,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
7266,
6015,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
41876,
1312,
5550,
38865,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
41876,
450,
499,
62,
30388,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
9562,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
41876,
450,
499,
62,
30388,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
41876,
1312,
39852,
2849,
1847,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
198,
220,
220,
220,
220,
220,
6818,
62,
10641,
62,
13155,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
41876,
537,
522,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
41876,
537,
522,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11238,
41876,
1312,
39852,
2849,
1847
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
INTERFACE zif_abapgit_oo_object_fnc PUBLIC.
TYPES: BEGIN OF ty_includes,
programm TYPE programm,
END OF ty_includes,
ty_includes_tt TYPE STANDARD TABLE OF ty_includes WITH DEFAULT KEY.
METHODS:
create
IMPORTING
iv_package TYPE devclass
iv_overwrite TYPE abap_bool DEFAULT abap_true
it_attributes TYPE zif_abapgit_definitions=>ty_obj_attribute_tt OPTIONAL
CHANGING
cg_properties TYPE any
RAISING
zcx_abapgit_exception,
generate_locals
IMPORTING
is_key TYPE seoclskey
iv_force TYPE abap_bool DEFAULT abap_true
it_local_definitions TYPE seop_source_string OPTIONAL
it_local_implementations TYPE seop_source_string OPTIONAL
it_local_macros TYPE seop_source_string OPTIONAL
it_local_test_classes TYPE seop_source_string OPTIONAL
RAISING
zcx_abapgit_exception,
deserialize_source
IMPORTING
is_key TYPE seoclskey
it_source TYPE zif_abapgit_definitions=>ty_string_tt
RAISING
zcx_abapgit_exception
cx_sy_dyn_call_error,
insert_text_pool
IMPORTING
iv_class_name TYPE seoclsname
it_text_pool TYPE textpool_table
iv_language TYPE spras
iv_state TYPE c DEFAULT 'I'
RAISING
zcx_abapgit_exception,
update_descriptions
IMPORTING
is_key TYPE seoclskey
it_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
add_to_activation_list
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
RAISING
zcx_abapgit_exception,
create_sotr
IMPORTING
iv_package TYPE devclass
it_sotr TYPE zif_abapgit_definitions=>ty_sotr_tt
RAISING
zcx_abapgit_exception,
create_documentation
IMPORTING
it_lines TYPE tlinetab
iv_object_name TYPE dokhl-object
iv_language TYPE spras
iv_no_masterlang TYPE abap_bool OPTIONAL
RAISING
zcx_abapgit_exception,
get_includes
IMPORTING
iv_object_name TYPE sobj_name
RETURNING
VALUE(rt_includes) TYPE ty_includes_tt
RAISING
zcx_abapgit_exception,
exists
IMPORTING
is_object_name TYPE seoclskey
RETURNING
VALUE(rv_exists) TYPE abap_bool,
serialize_abap
IMPORTING
is_class_key TYPE seoclskey
iv_type TYPE seop_include_ext_app OPTIONAL
RETURNING
VALUE(rt_source) TYPE zif_abapgit_definitions=>ty_string_tt
RAISING
zcx_abapgit_exception
cx_sy_dyn_call_error,
get_skip_test_classes
RETURNING
VALUE(rv_skip) TYPE abap_bool,
get_class_properties
IMPORTING
is_class_key TYPE seoclskey
RETURNING
VALUE(rs_class_properties) TYPE vseoclass
RAISING
zcx_abapgit_exception,
get_interface_properties
IMPORTING
is_interface_key TYPE seoclskey
RETURNING
VALUE(rs_interface_properties) TYPE vseointerf
RAISING
zcx_abapgit_exception,
read_text_pool
IMPORTING
iv_class_name TYPE seoclsname
iv_language TYPE spras
RETURNING
VALUE(rt_text_pool) TYPE textpool_table,
read_documentation
IMPORTING
iv_class_name TYPE seoclsname
iv_language TYPE spras
RETURNING
VALUE(rt_lines) TYPE tlinetab,
read_sotr
IMPORTING
iv_object_name TYPE sobj_name
RETURNING
VALUE(rt_sotr) TYPE zif_abapgit_definitions=>ty_sotr_tt
RAISING
zcx_abapgit_exception,
read_descriptions
IMPORTING
iv_obejct_name TYPE seoclsname
RETURNING
VALUE(rt_descriptions) TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
delete
IMPORTING
is_deletion_key TYPE seoclskey
RAISING
zcx_abapgit_exception,
read_superclass
IMPORTING
iv_classname TYPE seoclsname
RETURNING
VALUE(rv_superclass) TYPE seoclsname,
read_attributes
IMPORTING
iv_object_name TYPE seoclsname
RETURNING
VALUE(rt_attributes) TYPE zif_abapgit_definitions=>ty_obj_attribute_tt.
ENDINTERFACE.
| [
41358,
49836,
1976,
361,
62,
397,
499,
18300,
62,
2238,
62,
15252,
62,
69,
10782,
44731,
13,
628,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
42813,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1430,
76,
41876,
1430,
76,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
42813,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1259,
62,
42813,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
42813,
13315,
5550,
38865,
35374,
13,
628,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
2251,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26495,
220,
220,
220,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2502,
13564,
220,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
1078,
7657,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
26801,
62,
42348,
62,
926,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
269,
70,
62,
48310,
41876,
597,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
7716,
62,
17946,
874,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
420,
7278,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
3174,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
4299,
50101,
220,
220,
220,
220,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
320,
26908,
602,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
20285,
4951,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
9288,
62,
37724,
220,
220,
220,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
748,
48499,
1096,
62,
10459,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
2539,
220,
220,
220,
41876,
384,
420,
7278,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
10459,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
8841,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
198,
220,
220,
220,
220,
220,
220,
220,
43213,
62,
1837,
62,
67,
2047,
62,
13345,
62,
18224,
11,
198,
220,
220,
220,
7550,
62,
5239,
62,
7742,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
4871,
62,
3672,
41876,
384,
420,
7278,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
5239,
62,
7742,
220,
41876,
2420,
7742,
62,
11487,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
16129,
220,
220,
41876,
7500,
292,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
5219,
220,
220,
220,
220,
220,
41876,
269,
5550,
38865,
705,
40,
6,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
4296,
62,
20147,
1968,
507,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
420,
7278,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
20147,
1968,
507,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
325,
420,
3361,
313,
87,
62,
926,
11,
198,
220,
220,
220,
751,
62,
1462,
62,
48545,
62,
4868,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
9186,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
2251,
62,
82,
313,
81,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26495,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
82,
313,
81,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
82,
313,
81,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
2251,
62,
22897,
341,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
6615,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
256,
2815,
316,
397,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
15252,
62,
3672,
220,
220,
41876,
466,
14636,
75,
12,
15252,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
16129,
220,
220,
220,
220,
220,
41876,
7500,
292,
198,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*----------------------------------------------------------------------*
* SEMP TCL *
*----------------------------------------------------------------------*
* Consultoria: MGS Consulting *
* Autor......: Gustavo Oliveira *
* Data.......: 16/09/2017 *
* Descrição : Picking sem OT *
* Transação..: ZWM005 *
*----------------------------------------------------------------------*
* Histórico das modificações *
*----------------------------------------------------------------------*
* Consultoria: Data: XX/XX/XXXX *
* Autor......: *
* Observações: *
*----------------------------------------------------------------------*
INCLUDE ZWMR_SEPARACAO_GRUPO_TOPC.
*INCLUDE ZWMR_SEPARACAO_GRUPO_TOP.
*INCLUDE zwmr_picking_sem_ot_top.
INCLUDE ZWMR_SEPARACAO_GRUPO_TVARVC.
*INCLUDE ZWMR_SEPARACAO_GRUPO_TVARV.
*INCLUDE zseleciona_tvarv.
INCLUDE ZWMR_SEPARACAO_GRUPO_F01C.
*INCLUDE ZWMR_SEPARACAO_GRUPO_F01.
*INCLUDE zwmr_picking_sem_ot_f01.
INCLUDE ZWMR_SEPARACAO_GRUPO_O01C.
*INCLUDE ZWMR_SEPARACAO_GRUPO_O01.
*INCLUDE zwmr_picking_sem_ot_o01.
INCLUDE ZWMR_SEPARACAO_GRUPO_I01C.
*INCLUDE ZWMR_SEPARACAO_GRUPO_I01.
*INCLUDE zwmr_picking_sem_ot_i01.
| [
9,
10097,
23031,
9,
198,
9,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
311,
39494,
309,
5097,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
10097,
23031,
9,
198,
9,
21651,
7661,
25,
337,
14313,
41005,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
5231,
273,
16317,
25,
43715,
78,
30012,
8704,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
6060,
25780,
25,
1467,
14,
2931,
14,
5539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
39373,
380,
16175,
28749,
220,
1058,
350,
7958,
5026,
21676,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5624,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
3602,
64,
16175,
28749,
492,
25,
1168,
22117,
22544,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
10097,
23031,
9,
198,
9,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5590,
10205,
1173,
78,
288,
292,
953,
811,
64,
16175,
127,
113,
274,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
10097,
23031,
9,
198,
9,
21651,
7661,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6060,
25,
21044,
14,
8051,
14,
24376,
220,
1635,
198,
9,
5231,
273,
16317,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
19243,
64,
16175,
127,
113,
274,
25,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
9,
10097,
23031,
9,
198,
198,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
35222,
34,
13,
198,
9,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
35222,
13,
198,
9,
1268,
5097,
52,
7206,
1976,
26377,
81,
62,
48864,
62,
43616,
62,
313,
62,
4852,
13,
198,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
6849,
1503,
15922,
13,
198,
9,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
6849,
1503,
53,
13,
198,
9,
1268,
5097,
52,
7206,
1976,
325,
293,
66,
32792,
62,
83,
7785,
85,
13,
198,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
37,
486,
34,
13,
198,
9,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
37,
486,
13,
198,
9,
1268,
5097,
52,
7206,
1976,
26377,
81,
62,
48864,
62,
43616,
62,
313,
62,
69,
486,
13,
198,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
46,
486,
34,
13,
198,
9,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
46,
486,
13,
198,
9,
1268,
5097,
52,
7206,
1976,
26377,
81,
62,
48864,
62,
43616,
62,
313,
62,
78,
486,
13,
198,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
40,
486,
34,
13,
198,
9,
1268,
5097,
52,
7206,
1168,
54,
13599,
62,
5188,
27082,
26576,
46,
62,
10761,
8577,
46,
62,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_transport_mass DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_transport
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS run .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ABAPGIT_TRANSPORT_MASS IMPLEMENTATION.
METHOD run.
DATA:
lt_trkorr TYPE trwbo_request_headers,
lo_transport_zipper TYPE REF TO lcl_transport_zipper,
lo_except TYPE REF TO cx_root,
lv_folder TYPE string,
lv_text TYPE string.
TRY.
lt_trkorr = lcl_gui=>select_tr_requests( ).
IF lt_trkorr[] IS NOT INITIAL.
lv_folder = lcl_gui=>f4_folder( ).
IF lv_folder IS INITIAL.
* Empty folder
zcx_abapgit_exception=>raise( 'Empty destination folder' ).
ENDIF.
* Instantiate transport zipper object that will also create the timestamped output folder
CREATE OBJECT lo_transport_zipper TYPE lcl_transport_zipper
EXPORTING
iv_folder = lv_folder.
* Generate the local zip files from the given list of transport requests
lo_transport_zipper->generate_files(
it_trkorr = lt_trkorr
iv_logic = zcl_abapgit_ui_factory=>get_popups( )->popup_folder_logic( ) ).
* Open output folder if user asked it
lcl_gui=>open_folder_frontend( lo_transport_zipper->get_folder( ) ).
ELSE.
* No data found for the provided selection criterias
zcx_abapgit_exception=>raise( 'No transport requests selected' ).
ENDIF.
CATCH zcx_abapgit_exception INTO lo_except.
lv_text = lo_except->get_text( ).
MESSAGE lv_text TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
7645,
634,
62,
22208,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
7645,
634,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
1057,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
5446,
1565,
4303,
9863,
62,
44,
10705,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1057,
13,
628,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
300,
83,
62,
2213,
74,
38890,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
491,
86,
2127,
62,
25927,
62,
50145,
11,
198,
220,
220,
220,
220,
220,
2376,
62,
7645,
634,
62,
89,
14710,
41876,
4526,
37,
5390,
300,
565,
62,
7645,
634,
62,
89,
14710,
11,
198,
220,
220,
220,
220,
220,
2376,
62,
16341,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
43213,
62,
15763,
11,
198,
220,
220,
220,
220,
220,
300,
85,
62,
43551,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
300,
85,
62,
5239,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
13,
628,
220,
220,
220,
7579,
56,
13,
628,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
2213,
74,
38890,
796,
300,
565,
62,
48317,
14804,
19738,
62,
2213,
62,
8897,
3558,
7,
6739,
628,
220,
220,
220,
220,
220,
220,
220,
16876,
300,
83,
62,
2213,
74,
38890,
21737,
3180,
5626,
3268,
2043,
12576,
13,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
43551,
796,
300,
565,
62,
48317,
14804,
69,
19,
62,
43551,
7,
6739,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16876,
300,
85,
62,
43551,
3180,
3268,
2043,
12576,
13,
198,
9,
33523,
9483,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
7,
705,
40613,
10965,
9483,
6,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
198,
9,
24470,
9386,
4839,
48992,
2134,
326,
481,
635,
2251,
262,
4628,
395,
13322,
5072,
9483,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29244,
6158,
25334,
23680,
2376,
62,
7645,
634,
62,
89,
14710,
41876,
300,
565,
62,
7645,
634,
62,
89,
14710,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
43551,
796,
300,
85,
62,
43551,
13,
198,
198,
9,
2980,
378,
262,
1957,
19974,
3696,
422,
262,
1813,
1351,
286,
4839,
7007,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2376,
62,
7645,
634,
62,
89,
14710,
3784,
8612,
378,
62,
16624,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
2213,
74,
38890,
796,
300,
83,
62,
2213,
74,
38890,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
6404,
291,
220,
796,
1976,
565,
62,
397,
499,
18300,
62,
9019,
62,
69,
9548,
14804,
1136,
62,
12924,
4739,
7,
1267,
3784,
12924,
929,
62,
43551,
62,
6404,
291,
7,
1267,
6739,
198,
198,
9,
4946,
5072,
9483,
611,
2836,
1965,
340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
565,
62,
48317,
14804,
9654,
62,
43551,
62,
8534,
437,
7,
2376,
62,
7645,
634,
62,
89,
14710,
3784,
1136,
62,
43551,
7,
1267,
6739,
628,
220,
220,
220,
220,
220,
220,
220,
17852,
5188,
13,
198,
9,
1400,
1366,
1043,
329,
262,
2810,
6356,
1955,
263,
4448,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
7,
705,
2949,
4839,
7007,
6163,
6,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
220,
220,
327,
11417,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
39319,
2376,
62,
16341,
13,
628,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
5239,
796,
2376,
62,
16341,
3784,
1136,
62,
5239,
7,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
337,
1546,
4090,
8264,
300,
85,
62,
5239,
41876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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_bc_q_request_auth DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES /bobf/if_frw_authority_query .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_bc_q_request_auth IMPLEMENTATION.
METHOD /bobf/if_frw_authority_query~check_authority.
ENDMETHOD.
METHOD /bobf/if_frw_authority_query~get_authority_profile_reader.
ENDMETHOD.
METHOD /bobf/if_frw_authority_query~get_query_condition_provider.
ENDMETHOD.
METHOD /bobf/if_frw_authority_query~is_privileged.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
15630,
62,
80,
62,
25927,
62,
18439,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
23255,
37,
2246,
1546,
1220,
65,
672,
69,
14,
361,
62,
8310,
86,
62,
9800,
414,
62,
22766,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
15630,
62,
80,
62,
25927,
62,
18439,
30023,
2538,
10979,
6234,
13,
198,
220,
337,
36252,
1220,
65,
672,
69,
14,
361,
62,
8310,
86,
62,
9800,
414,
62,
22766,
93,
9122,
62,
9800,
414,
13,
628,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1220,
65,
672,
69,
14,
361,
62,
8310,
86,
62,
9800,
414,
62,
22766,
93,
1136,
62,
9800,
414,
62,
13317,
62,
46862,
13,
628,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1220,
65,
672,
69,
14,
361,
62,
8310,
86,
62,
9800,
414,
62,
22766,
93,
1136,
62,
22766,
62,
31448,
62,
15234,
1304,
13,
628,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1220,
65,
672,
69,
14,
361,
62,
8310,
86,
62,
9800,
414,
62,
22766,
93,
271,
62,
13776,
48446,
13,
198,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
FUNCTION CONVERSION_EXIT_YDK30_OUTPUT .
*"--------------------------------------------------------------------
*"*"Локальный интерфейс:
*" IMPORTING
*" REFERENCE(INPUT)
*" EXPORTING
*" REFERENCE(OUTPUT)
*"--------------------------------------------------------------------
* see FM YDK_CONVERSION_EXIT_REGISTER
PERFORM output USING '30' input CHANGING output.
ENDFUNCTION.
| [
42296,
4177,
2849,
7102,
43717,
62,
6369,
2043,
62,
35755,
42,
1270,
62,
2606,
7250,
3843,
764,
198,
9,
1,
10097,
650,
198,
9,
1,
9,
1,
140,
249,
25443,
118,
16142,
30143,
45367,
22177,
45035,
140,
117,
12466,
116,
22177,
20375,
16843,
21169,
141,
226,
16843,
140,
117,
21727,
25,
198,
9,
1,
220,
30023,
9863,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
1268,
30076,
8,
198,
9,
1,
220,
7788,
15490,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
2606,
7250,
3843,
8,
198,
9,
1,
10097,
650,
198,
9,
766,
18695,
575,
48510,
62,
10943,
43717,
62,
6369,
2043,
62,
31553,
41517,
198,
220,
19878,
21389,
5072,
1294,
2751,
705,
1270,
6,
5128,
5870,
15567,
2751,
5072,
13,
198,
1677,
8068,
4944,
4177,
2849,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
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_COND type ref to ZCL_EXCEL_STYLE_COND.
methods LOAD_WORKSHEET_COND_FORMAT_CI
importing
!IO_IXML_RULE type ref to IF_IXML_ELEMENT
!IO_STYLE_COND type ref to ZCL_EXCEL_STYLE_COND .
methods LOAD_WORKSHEET_COND_FORMAT_CS
importing
!IO_IXML_RULE type ref to IF_IXML_ELEMENT
!IO_STYLE_COND type ref to ZCL_EXCEL_STYLE_COND .
methods LOAD_WORKSHEET_COND_FORMAT_EX
importing
!IO_IXML_RULE type ref to IF_IXML_ELEMENT
!IO_STYLE_COND type ref to ZCL_EXCEL_STYLE_COND .
methods LOAD_WORKSHEET_COND_FORMAT_IS
importing
!IO_IXML_RULE type ref to IF_IXML_ELEMENT
!IO_STYLE_COND type ref to ZCL_EXCEL_STYLE_COND .
methods LOAD_WORKSHEET_COND_FORMAT_DB
importing
!IO_IXML_RULE type ref to IF_IXML_ELEMENT
!IO_STYLE_COND type ref to ZCL_EXCEL_STYLE_COND .
methods LOAD_WORKSHEET_COND_FORMAT_T10
importing
!IO_IXML_RULE type ref to IF_IXML_ELEMENT
!IO_STYLE_COND type ref to ZCL_EXCEL_STYLE_COND .
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
raising
ZCX_EXCEL.
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_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,
lo_row TYPE REF TO zcl_excel_row,
lo_row_iterator TYPE REF TO cl_object_collection_iterator,
lv_row_offset TYPE i,
lv_row_collapse_flag TYPE i.
FIELD-SYMBOLS: <ls_row_data> LIKE LINE OF lt_row_data.
* First collect information about outlines ( outline leven and collapsed state )
lo_row_iterator = io_worksheet->get_rows_iterator( ).
WHILE lo_row_iterator->has_next( ) = abap_true.
lo_row ?= lo_row_iterator->get_next( ).
ls_row_data-row = lo_row->get_row_index( ).
ls_row_data-outline_level = lo_row->get_outline_level( ).
IF ls_row_data-outline_level IS NOT INITIAL.
INSERT ls_row_data INTO TABLE lt_row_data.
ENDIF.
lv_collapsed = lo_row->get_collapsed( ).
IF lv_collapsed = abap_true.
INSERT lo_row->get_row_index( ) INTO TABLE lt_collapse_rows.
ENDIF.
ENDWHILE.
* 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
lo_row_iterator = io_worksheet->get_rows_iterator( ).
WHILE lo_row_iterator->has_next( ) = abap_true.
lo_row ?= lo_row_iterator->get_next( ).
lo_row->set_outline_level( 0 ).
lo_row->set_collapsed( abap_false ).
ENDWHILE.
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.
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.
CLEAR lv_val.
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.
* Begin fix for Issue #551
DATA: lo_tmp_node_2 TYPE REF TO if_ixml_element.
lo_tmp_node_2 ?= rel_drawing-content_xml->find_from_name( name = 'pieChart' namespace = 'c' ).
if lo_tmp_node_2 is not initial.
lo_drawing->graph_type = zcl_excel_drawing=>c_graph_pie.
else.
lo_tmp_node_2 ?= rel_drawing-content_xml->find_from_name( name = 'barChart' namespace = 'c' ).
if lo_tmp_node_2 is not initial.
lo_drawing->graph_type = zcl_excel_drawing=>c_graph_bars.
else.
lo_tmp_node_2 ?= rel_drawing-content_xml->find_from_name( name = 'lineChart' namespace = 'c' ).
if lo_tmp_node_2 is not initial.
lo_drawing->graph_type = zcl_excel_drawing=>c_graph_line.
endif.
endif.
endif.
* End fix for issue #551
"-------------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.
" begin Dennis Schaaf
TRY.
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 = io_excel->add_new_autofilter( io_sheet = <worksheet>-worksheet ) .
lo_autofilter->set_filter_area( is_area = ls_area ).
CATCH zcx_excel.
" we expected a range but it was not usable, so just ignore it
ENDTRY.
" end Dennis Schaaf
*--------------------------------------------------------------------*
* 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,
papersize 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 TYPE REF TO zcl_excel_column,
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 TYPE REF TO zcl_excel_row,
*--- 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,
ex TYPE REF TO cx_root.
*--------------------------------------------------------------------*
* §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 = io_worksheet->get_row( lv_cell_row ).
IF ls_row-customheight = '1'.
lo_row->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->set_collapsed( abap_true ).
ENDIF.
IF ls_row-hidden = lc_xml_attr_true
OR ls_row-hidden = lc_xml_attr_true_int.
lo_row->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->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 INTO ex.
RAISE EXCEPTION TYPE zcx_excel
EXPORTING
previous = ex.
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 = io_worksheet->get_column( 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->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->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->set_collapsed( abap_true ).
ENDIF.
IF ls_column-hidden = lc_xml_attr_true
OR ls_column-hidden = lc_xml_attr_true_int.
lo_column->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->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->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 = io_worksheet->get_default_row( ).
lo_row->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.
io_worksheet->sheet_setup->paper_size = ls_pagesetup-papersize.
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_cond TYPE REF TO zcl_excel_style_cond,
lo_style_cond2 TYPE REF TO zcl_excel_style_cond.
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_cond.
*--------------------------------------------------------------------*
* 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( ).
WHILE lo_ixml_rule IS BOUND.
lv_rule = lo_ixml_rule->get_attribute_ns( 'type' ).
CLEAR lo_style_cond.
*--------------------------------------------------------------------*
* Depending on ruletype get additional information
*--------------------------------------------------------------------*
CASE lv_rule.
WHEN zcl_excel_style_cond=>c_rule_cellis.
lo_style_cond = io_worksheet->add_new_style_cond( ).
load_worksheet_cond_format_ci( io_ixml_rule = lo_ixml_rule
io_style_cond = lo_style_cond ).
WHEN zcl_excel_style_cond=>c_rule_databar.
lo_style_cond = io_worksheet->add_new_style_cond( ).
load_worksheet_cond_format_db( io_ixml_rule = lo_ixml_rule
io_style_cond = lo_style_cond ).
WHEN zcl_excel_style_cond=>c_rule_expression.
lo_style_cond = io_worksheet->add_new_style_cond( ).
load_worksheet_cond_format_ex( io_ixml_rule = lo_ixml_rule
io_style_cond = lo_style_cond ).
WHEN zcl_excel_style_cond=>c_rule_iconset.
lo_style_cond = io_worksheet->add_new_style_cond( ).
load_worksheet_cond_format_is( io_ixml_rule = lo_ixml_rule
io_style_cond = lo_style_cond ).
WHEN zcl_excel_style_cond=>c_rule_colorscale.
lo_style_cond = io_worksheet->add_new_style_cond( ).
load_worksheet_cond_format_cs( io_ixml_rule = lo_ixml_rule
io_style_cond = lo_style_cond ).
WHEN zcl_excel_style_cond=>c_rule_top10.
lo_style_cond = io_worksheet->add_new_style_cond( ).
load_worksheet_cond_format_t10( io_ixml_rule = lo_ixml_rule
io_style_cond = lo_style_cond ).
WHEN zcl_excel_style_cond=>c_rule_above_average.
lo_style_cond = io_worksheet->add_new_style_cond( ).
load_worksheet_cond_format_aa( io_ixml_rule = lo_ixml_rule
io_style_cond = lo_style_cond ).
WHEN OTHERS.
ENDCASE.
IF lo_style_cond IS BOUND.
lo_style_cond->rule = lv_rule.
lo_style_cond->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.
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_cond->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_cond->mode_above_average-above_average = space.
ELSE.
io_style_cond->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_cond->mode_above_average-equal_average = 'X'.
ELSE.
io_style_cond->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_cond->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_cond->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_cond->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_cond->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_cond->mode_cellis-formula = lo_ixml->get_value( ).
WHEN 2.
io_style_cond->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_cond->mode_colorscale-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->mode_colorscale-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ).
WHEN 2.
io_style_cond->mode_colorscale-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->mode_colorscale-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ).
WHEN 3.
io_style_cond->mode_colorscale-cfvo3_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->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_cond->mode_colorscale-colorrgb1 = lo_ixml->get_attribute_ns( 'rgb' ).
WHEN 2.
io_style_cond->mode_colorscale-colorrgb2 = lo_ixml->get_attribute_ns( 'rgb' ).
WHEN 3.
io_style_cond->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_cond->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_cond->mode_databar-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->mode_databar-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ).
WHEN 2.
io_style_cond->mode_databar-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->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_cond->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_cond->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_cond->mode_iconset-iconset = lo_ixml_rule_iconset->get_attribute_ns( 'iconSet' ).
io_style_cond->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_cond->mode_iconset-cfvo1_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->mode_iconset-cfvo1_value = lo_ixml->get_attribute_ns( 'val' ).
WHEN 2.
io_style_cond->mode_iconset-cfvo2_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->mode_iconset-cfvo2_value = lo_ixml->get_attribute_ns( 'val' ).
WHEN 3.
io_style_cond->mode_iconset-cfvo3_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->mode_iconset-cfvo3_value = lo_ixml->get_attribute_ns( 'val' ).
WHEN 4.
io_style_cond->mode_iconset-cfvo4_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->mode_iconset-cfvo4_value = lo_ixml->get_attribute_ns( 'val' ).
WHEN 5.
io_style_cond->mode_iconset-cfvo5_type = lo_ixml->get_attribute_ns( 'type' ).
io_style_cond->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_cond->mode_top10-topxx_count = io_ixml_rule->get_attribute_ns( 'rank' ). " Top10, Top20, Top 50...
io_style_cond->mode_top10-percent = io_ixml_rule->get_attribute_ns( 'percent' ). " Top10 percent instead of Top10 values
IF io_style_cond->mode_top10-percent = '1'.
io_style_cond->mode_top10-percent = 'X'.
ELSE.
io_style_cond->mode_top10-percent = ' '.
ENDIF.
io_style_cond->mode_top10-bottom = io_ixml_rule->get_attribute_ns( 'bottom' ). " Bottom10 instead of Top10
IF io_style_cond->mode_top10-bottom = '1'.
io_style_cond->mode_top10-bottom = 'X'.
ELSE.
io_style_cond->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_cond->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_cond TYPE REF TO zcl_excel_style_cond,
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).
zcx_excel=>raise_text( 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).
zcx_excel=>raise_text( 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~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.
| [
4871,
1168,
5097,
62,
6369,
34,
3698,
62,
15675,
1137,
62,
12726,
6770,
198,
220,
1171,
198,
220,
2251,
1171,
764,
198,
198,
11377,
2665,
13,
198,
9,
1,
9,
1171,
6805,
286,
1398,
1168,
5097,
62,
6369,
34,
3698,
62,
15675,
1137,
62,
12726,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
2099,
12,
7742,
82,
22631,
5805,
764,
628,
220,
20314,
1168,
5064,
62,
6369,
34,
3698,
62,
15675,
1137,
764,
628,
220,
1398,
12,
24396,
82,
376,
8267,
62,
46126,
62,
10913,
2662,
62,
1404,
5446,
9865,
3843,
1546,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
4061,
62,
36,
2538,
10979,
2099,
1006,
284,
16876,
62,
10426,
5805,
62,
36,
2538,
10979,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
8697,
62,
46126,
11335,
2099,
15529,
764,
198,
24326,
2665,
13,
628,
220,
3858,
25,
198,
9,
1,
9,
6861,
6805,
286,
1398,
1168,
5097,
62,
6369,
34,
3698,
62,
15675,
1137,
62,
12726,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
39468,
1056,
11,
198,
220,
220,
220,
220,
220,
4686,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
2099,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
2496,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
2496,
14171,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
2499,
25473,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
62,
5225,
25473,
11,
198,
220,
220,
220,
220,
220,
9629,
312,
220,
220,
220,
41876,
4731,
11,
220,
220,
220,
220,
366,
1040,
1303,
22370,
532,
9585,
15274,
14,
4033,
82,
532,
2622,
284,
5911,
3376,
9629,
198,
220,
220,
220,
23578,
3963,
256,
62,
39468,
1056,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
7753,
9641,
11,
198,
220,
220,
220,
220,
220,
598,
3672,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
15436,
863,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
1877,
7287,
863,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
374,
929,
11249,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
14873,
12453,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
23578,
3963,
256,
62,
7753,
9641,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
21760,
11,
198,
220,
220,
220,
220,
220,
1438,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
9629,
312,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
4686,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
1181,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
23578,
3963,
256,
62,
21760,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
1818,
2070,
1050,
11,
198,
220,
220,
220,
220,
220,
14873,
12453,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
4277,
43810,
9641,
41876,
4731,
11,
198,
220,
220,
220,
23578,
3963,
256,
62,
1818,
2070,
1050,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
21760,
1050,
11,
198,
220,
220,
220,
220,
220,
14873,
12453,
41876,
4731,
11,
198,
220,
220,
220,
23578,
3963,
256,
62,
21760,
1050,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
9521,
11,
198,
220,
220,
220,
220,
220,
1438,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
7104,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
220,
220,
220,
220,
220,
220,
366,
28463,
276,
351,
2071,
1303,
22370,
780,
5231,
1659,
346,
1010,
1422,
470,
38836,
48476,
740,
198,
220,
220,
220,
220,
220,
17205,
25473,
312,
41876,
4731,
11,
220,
220,
220,
220,
220,
220,
366,
2071,
1303,
24136,
198,
220,
220,
220,
23578,
3963,
256,
62,
9521,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
256,
62,
69,
2171,
220,
220,
41876,
49053,
9795,
43679,
3963,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
62,
7635,
62,
20797,
13315,
44521,
12,
4944,
33866,
8924,
5550,
38865,
35374,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
256,
62,
65,
6361,
41876,
49053,
9795,
43679,
3963,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
62,
7635,
62,
65,
6361,
13315,
44521,
12,
4944,
33866,
8924,
5550,
38865,
35374,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
256,
62,
10331,
82,
220,
220,
41876,
49053,
9795,
43679,
3963,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
62,
7635,
62,
10331,
13315,
44521,
12,
4944,
33866,
8924,
5550,
38865,
35374,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
256,
62,
7635,
62,
5420,
82,
41876,
49053,
9795,
43679,
3963,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
62,
7635,
13315,
44521,
12,
4944,
33866,
8924,
5550,
38865,
35374,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
8043,
11,
198,
220,
220,
220,
220,
220,
41497,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
46140,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
7505,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
34791,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
23578,
3963,
256,
62,
8043,
764,
198,
220,
3858,
25,
198,
220,
220,
220,
347,
43312,
3963,
256,
62,
2411,
62,
19334,
278,
11,
198,
220,
220,
220,
220,
220,
4686,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
2695,
220,
220,
220,
220,
41876,
2124,
8841,
11,
198,
220,
220,
220,
220,
220,
2393,
62,
2302,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
2695,
62,
19875,
41876,
4526,
37,
5390,
611,
62,
844,
4029,
62,
22897,
11
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_object_intf DEFINITION PUBLIC FINAL INHERITING FROM zcl_abapgit_objects_program.
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.
METHODS deserialize_proxy
IMPORTING
!iv_transport TYPE trkorr
RAISING
zcx_abapgit_exception .
METHODS deserialize_abap
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_input
!iv_package TYPE devclass
RAISING
zcx_abapgit_exception .
METHODS deserialize_docu
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_input
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
DATA mi_object_oriented_object_fct TYPE REF TO zif_abapgit_oo_object_fnc .
METHODS serialize_xml
IMPORTING
!io_xml TYPE REF TO zif_abapgit_xml_output
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_object_intf IMPLEMENTATION.
METHOD constructor.
super->constructor(
is_item = is_item
iv_language = iv_language ).
mi_object_oriented_object_fct = zcl_abapgit_oo_factory=>make( ms_item-obj_type ).
ENDMETHOD.
METHOD deserialize_abap.
DATA: ls_vseointerf TYPE vseointerf,
lt_source TYPE seop_source_string,
lt_descriptions TYPE zif_abapgit_oo_object_fnc=>ty_seocompotx_tt,
ls_clskey TYPE seoclskey.
ls_clskey-clsname = ms_item-obj_name.
lt_source = mo_files->read_abap( ).
ii_xml->read( EXPORTING iv_name = 'VSEOINTERF'
CHANGING cg_data = ls_vseointerf ).
mi_object_oriented_object_fct->create(
EXPORTING
iv_package = iv_package
CHANGING
cg_properties = ls_vseointerf ).
mi_object_oriented_object_fct->deserialize_source(
is_key = ls_clskey
it_source = lt_source ).
ii_xml->read( EXPORTING iv_name = 'DESCRIPTIONS'
CHANGING cg_data = lt_descriptions ).
mi_object_oriented_object_fct->update_descriptions(
is_key = ls_clskey
it_descriptions = lt_descriptions ).
mi_object_oriented_object_fct->add_to_activation_list( ms_item ).
ENDMETHOD.
METHOD deserialize_docu.
DATA: lt_lines TYPE tlinetab,
lv_object TYPE dokhl-object.
ii_xml->read( EXPORTING iv_name = 'LINES'
CHANGING cg_data = lt_lines ).
lv_object = ms_item-obj_name.
IF lines( lt_lines ) = 0.
mi_object_oriented_object_fct->delete_documentation(
iv_object_name = lv_object
iv_language = mv_language ).
RETURN.
ENDIF.
mi_object_oriented_object_fct->create_documentation(
it_lines = lt_lines
iv_object_name = lv_object
iv_language = mv_language ).
ENDMETHOD.
METHOD deserialize_proxy.
DATA: lv_transport TYPE trkorr,
li_proxy_object TYPE REF TO if_px_main,
lv_name TYPE prx_r3name,
lx_proxy_fault TYPE REF TO cx_proxy_fault.
lv_name = ms_item-obj_name.
lv_transport = iv_transport.
TRY.
li_proxy_object = cl_pxn_factory=>create(
application = 'PROXY_UI'
display_only = abap_false
saveable = abap_true
)->if_pxn_factory~load_by_abap_name(
object = ms_item-obj_type
obj_name = lv_name ).
li_proxy_object->activate(
EXPORTING
activate_all = abap_true
CHANGING
transport_number = lv_transport ).
li_proxy_object->dequeue( ).
CATCH cx_proxy_fault INTO lx_proxy_fault.
zcx_abapgit_exception=>raise_with_text( lx_proxy_fault ).
ENDTRY.
ENDMETHOD.
METHOD serialize_xml.
DATA:
lt_descriptions TYPE zif_abapgit_oo_object_fnc=>ty_seocompotx_tt,
ls_vseointerf TYPE vseointerf,
ls_clskey TYPE seoclskey,
lt_lines TYPE tlinetab,
lv_language TYPE spras.
ls_clskey-clsname = ms_item-obj_name.
ls_vseointerf = mi_object_oriented_object_fct->get_interface_properties( ls_clskey ).
CLEAR: ls_vseointerf-uuid,
ls_vseointerf-author,
ls_vseointerf-createdon,
ls_vseointerf-changedby,
ls_vseointerf-changedon,
ls_vseointerf-chgdanyby,
ls_vseointerf-chgdanyon,
ls_vseointerf-r3release,
ls_vseointerf-version.
io_xml->add( iv_name = 'VSEOINTERF'
ig_data = ls_vseointerf ).
lt_lines = mi_object_oriented_object_fct->read_documentation(
iv_class_name = ls_clskey-clsname
iv_language = mv_language ).
IF lines( lt_lines ) > 0.
io_xml->add( iv_name = 'LINES'
ig_data = lt_lines ).
ENDIF.
IF io_xml->i18n_params( )-main_language_only = abap_true.
lv_language = mv_language.
ENDIF.
lt_descriptions = mi_object_oriented_object_fct->read_descriptions(
iv_obejct_name = ls_clskey-clsname
iv_language = lv_language ).
IF lines( lt_descriptions ) > 0.
io_xml->add( iv_name = 'DESCRIPTIONS'
ig_data = lt_descriptions ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
TYPES: BEGIN OF ty_includes,
programm TYPE programm,
END OF ty_includes.
TYPES: BEGIN OF ty_reposrc,
unam TYPE reposrc-unam,
udat TYPE reposrc-udat,
utime TYPE reposrc-utime,
END OF ty_reposrc.
DATA: lt_reposrc TYPE STANDARD TABLE OF ty_reposrc,
ls_reposrc LIKE LINE OF lt_reposrc,
lt_includes TYPE STANDARD TABLE OF ty_includes.
lt_includes = mi_object_oriented_object_fct->get_includes( ms_item-obj_name ).
ASSERT lines( lt_includes ) > 0.
SELECT unam udat utime FROM reposrc
INTO TABLE lt_reposrc
FOR ALL ENTRIES IN lt_includes
WHERE progname = lt_includes-programm
AND r3state = 'A'.
IF sy-subrc <> 0.
rv_user = c_user_unknown.
ELSE.
SORT lt_reposrc BY udat DESCENDING utime DESCENDING.
READ TABLE lt_reposrc INDEX 1 INTO ls_reposrc.
ASSERT sy-subrc = 0.
rv_user = ls_reposrc-unam.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: ls_clskey TYPE seoclskey,
ls_vseointerf TYPE vseointerf.
ls_clskey-clsname = ms_item-obj_name.
ls_vseointerf = mi_object_oriented_object_fct->get_interface_properties( ls_clskey ).
IF ls_vseointerf-clsproxy = abap_true.
" Proxy interfaces are managed via SPRX
RETURN.
ENDIF.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
mi_object_oriented_object_fct->delete( ls_clskey ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: ls_vseointerf TYPE vseointerf.
io_xml->read( EXPORTING iv_name = 'VSEOINTERF'
CHANGING cg_data = ls_vseointerf ).
IF ls_vseointerf-clsproxy = abap_true.
" Proxy interfaces are managed via SPRX
deserialize_proxy( iv_transport ).
RETURN.
ENDIF.
deserialize_abap( ii_xml = io_xml
iv_package = iv_package ).
deserialize_docu( io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: ls_class_key TYPE seoclskey,
lv_category TYPE seoclassdf-category.
ls_class_key-clsname = ms_item-obj_name.
rv_bool = mi_object_oriented_object_fct->exists( ls_class_key ).
IF rv_bool = abap_true.
SELECT SINGLE category FROM seoclassdf INTO lv_category
WHERE clsname = ls_class_key-clsname
AND ( version = '1'
OR version = '0' ) ##warn_ok. "#EC CI_GENBUFF
IF sy-subrc = 0 AND lv_category = seoc_category_webdynpro_class.
rv_bool = abap_false.
ENDIF.
ENDIF.
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_name }|.
OVERLAY lv_object WITH '==============================P'.
lv_object = lv_object && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESEOCLASS'
iv_argument = lv_object ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lt_source TYPE seop_source_string,
ls_interface_key TYPE seoclskey.
ls_interface_key-clsname = ms_item-obj_name.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
CALL FUNCTION 'SEO_BUFFER_REFRESH'
EXPORTING
version = seoc_version_active
force = abap_true.
CALL FUNCTION 'SEO_BUFFER_REFRESH'
EXPORTING
version = seoc_version_inactive
force = abap_true.
lt_source = mi_object_oriented_object_fct->serialize_abap( ls_interface_key ).
mo_files->add_abap( lt_source ).
serialize_xml( io_xml ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
600,
69,
5550,
20032,
17941,
44731,
25261,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
23065,
13,
198,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
15252,
13,
198,
220,
220,
220,
8355,
43429,
1546,
6941,
62,
16624,
7473,
1976,
361,
62,
397,
499,
18300,
62,
15252,
93,
5908,
62,
16624,
13,
198,
220,
220,
220,
337,
36252,
50,
23772,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
9186,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
16129,
41876,
7500,
292,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
748,
48499,
1096,
62,
36436,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
7645,
634,
41876,
491,
74,
38890,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
748,
48499,
1096,
62,
397,
499,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
4178,
62,
19875,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
19875,
62,
15414,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
26495,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
748,
48499,
1096,
62,
15390,
84,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
4178,
62,
19875,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
19875,
62,
15414,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42865,
21504,
62,
15252,
62,
17107,
62,
15252,
62,
69,
310,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
2238,
62,
15252,
62,
69,
10782,
764,
628,
220,
220,
220,
337,
36252,
50,
11389,
1096,
62,
19875,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
19875,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
19875,
62,
22915,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
600,
69,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
23772,
13,
198,
220,
220,
220,
2208,
3784,
41571,
273,
7,
198,
220,
220,
220,
220,
220,
318,
62,
9186,
220,
220,
220,
220,
796,
318,
62,
9186,
198,
220,
220,
220,
220,
220,
21628,
62,
16129,
796,
21628,
62,
16129,
6739,
198,
220,
220,
220,
21504,
62,
15252,
62,
17107,
62,
15252,
62,
69,
310,
796,
1976,
565,
62,
397,
499,
18300,
62,
2238,
62,
69,
9548,
14804,
15883,
7,
13845,
62,
9186,
12,
26801,
62,
4906,
6739,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
748,
48499,
1096,
62,
397,
499,
13,
198,
220,
220,
220,
42865,
25,
43979,
62,
85,
325,
78,
3849,
69,
220,
220,
41876,
410,
325,
78,
3849,
69,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
10459,
220,
220,
220,
220,
220,
220,
41876,
384,
404,
62,
10459,
62,
8841,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
20147,
1968,
507,
41876,
1976,
361,
62,
397,
499,
18300,
62,
2238,
62,
15252,
62,
69,
10782,
14804,
774,
62,
325,
420,
3361,
313,
87,
62,
926,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
565,
82,
2539,
220,
220,
220,
220,
220,
220,
41876,
384,
420,
7278,
2539,
13,
628,
198,
220,
220,
220,
43979,
62,
565,
82,
2539,
12,
565,
82,
3672,
796,
13845,
62,
9186,
12,
26801,
62,
3672,
13,
198,
220,
220,
220,
300,
83,
62,
10459,
796,
6941,
62,
16624,
3784,
961,
62,
397,
499,
7,
6739,
198,
220,
220,
220,
21065,
62,
19875,
3784,
961,
7,
7788,
15490,
2751,
21628,
62,
3672,
796,
705,
20304,
4720,
41358,
37,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5870,
15567,
2751,
269,
70,
62,
7890,
796,
43979,
62,
85,
325,
78,
3849,
69,
6739,
628,
220,
220,
220,
21504,
62,
15252,
62,
17107,
62,
15252,
62,
69,
310,
3784,
17953,
7,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26495,
220,
220,
220,
796,
21628,
62,
26495,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
269,
70,
62,
48310,
796,
43979,
62,
85,
325,
78,
3849,
69,
6739,
628,
220,
220,
220,
21504,
62,
15252,
62,
17107,
62,
15252,
62,
69,
310,
3784,
8906,
48499,
1096,
62,
10459,
7,
198,
220,
220,
220,
220,
220,
318,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
43979,
62,
565,
82,
2539,
198,
220,
220,
220,
220,
220,
340,
62,
10459,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
83,
62,
10459,
6739,
628,
220,
220,
220,
21065,
62,
19875,
3784,
961,
7,
7788,
15490,
2751,
21628,
62,
3672,
796,
705,
30910,
36584,
51,
11053,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
"! <p class="shorttext synchronized" lang="en">UTF-16</p>
"!
CLASS zcl_csr_utf_16 DEFINITION
PUBLIC
ABSTRACT
INHERITING FROM zcl_csr_unicode
CREATE PUBLIC .
PUBLIC SECTION.
METHODS get_name
REDEFINITION .
METHODS get_language
REDEFINITION .
METHODS match
REDEFINITION .
PROTECTED SECTION.
TYPES ty_utf16_char TYPE x LENGTH 2.
METHODS get_char ABSTRACT
IMPORTING
det TYPE REF TO zcl_csr_input_text
offset TYPE i
RETURNING
VALUE(char) TYPE ty_utf16_char.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_csr_utf_16 IMPLEMENTATION.
METHOD get_language.
ENDMETHOD.
METHOD get_name.
ENDMETHOD.
METHOD match.
IF xstrlen( det->f_raw_input ) < 4 OR xstrlen( det->f_raw_input ) MOD 4 <> 0.
result = 0.
RETURN.
ENDIF.
DATA(has_bom) = abap_false.
IF get_char( det = det offset = 0 ) = '0000FEFF'.
has_bom = abap_true.
ENDIF.
DATA(i) = 4.
DATA(num_invalid) = 0.
DATA(num_valid) = 0.
WHILE i < xstrlen( det->f_raw_input ).
DATA(ch) = get_char( det = det offset = i ).
IF ch < 0 OR ch > '0010FFFF' OR ch BETWEEN '0000D800' AND '0000DFFF'.
ADD 1 TO num_invalid.
ELSE.
ADD 1 TO num_valid.
ENDIF.
ADD 4 TO i.
ENDWHILE.
IF has_bom = abap_true AND num_invalid = 0.
result = 100.
ELSEIF has_bom = abap_true AND num_valid > num_invalid * 10.
result = 80.
ELSEIF num_valid > 3 AND num_invalid = 0.
result = 100.
ELSEIF num_valid > 0 AND num_invalid = 0.
result = 80.
ELSEIF num_valid > num_invalid * 10.
" Probably corruput UTF-32BE data. Valid sequences aren't likely by chance.
result = 25.
ELSE.
result = 0.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
40484,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
48504,
12,
1433,
3556,
79,
29,
198,
40484,
198,
31631,
1976,
565,
62,
6359,
81,
62,
40477,
62,
1433,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
9564,
18601,
10659,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
6359,
81,
62,
46903,
1098,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
651,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
16129,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
220,
220,
337,
36252,
50,
2872,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
1259,
62,
40477,
1433,
62,
10641,
41876,
2124,
406,
49494,
362,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
10641,
9564,
18601,
10659,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1062,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
6359,
81,
62,
15414,
62,
5239,
198,
220,
220,
220,
220,
220,
220,
220,
11677,
220,
220,
220,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
10641,
8,
41876,
1259,
62,
40477,
1433,
62,
10641,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
6359,
81,
62,
40477,
62,
1433,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
651,
62,
16129,
13,
628,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
651,
62,
3672,
13,
628,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
2872,
13,
628,
220,
220,
220,
16876,
2124,
2536,
11925,
7,
1062,
3784,
69,
62,
1831,
62,
15414,
1267,
1279,
604,
6375,
2124,
2536,
11925,
7,
1062,
3784,
69,
62,
1831,
62,
15414,
1267,
19164,
604,
1279,
29,
657,
13,
198,
220,
220,
220,
220,
220,
1255,
796,
657,
13,
198,
220,
220,
220,
220,
220,
30826,
27064,
13,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
42865,
7,
10134,
62,
65,
296,
8,
796,
450,
499,
62,
9562,
13,
198,
220,
220,
220,
16876,
651,
62,
10641,
7,
1062,
796,
1062,
11677,
796,
657,
1267,
796,
705,
2388,
15112,
5777,
4458,
198,
220,
220,
220,
220,
220,
468,
62,
65,
296,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
42865,
7,
72,
8,
796,
604,
13,
198,
220,
220,
220,
42865,
7,
22510,
62,
259,
12102,
8,
796,
657,
13,
198,
220,
220,
220,
42865,
7,
22510,
62,
12102,
8,
796,
657,
13,
198,
220,
220,
220,
7655,
41119,
1312,
1279,
2124,
2536,
11925,
7,
1062,
3784,
69,
62,
1831,
62,
15414,
6739,
198,
220,
220,
220,
220,
220,
42865,
7,
354,
8,
796,
651,
62,
10641,
7,
1062,
796,
1062,
11677,
796,
1312,
6739,
198,
220,
220,
220,
220,
220,
16876,
442,
1279,
657,
6375,
442,
1875,
705,
37187,
29312,
6,
6375,
442,
38651,
8845,
1677,
705,
2388,
35,
7410,
6,
5357,
705,
2388,
35,
5777,
37,
4458,
198,
220,
220,
220,
220,
220,
220,
220,
27841,
352,
5390,
997,
62,
259,
12102,
13,
198,
220,
220,
220,
220,
220,
17852,
5188,
13,
198,
220,
220,
220,
220,
220,
220,
220,
27841,
352,
5390,
997,
62,
12102,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
220,
220,
27841,
604,
5390,
1312,
13,
198,
220,
220,
220,
23578,
12418,
41119,
13,
628,
220,
220,
220,
16876,
468,
62,
65,
296,
796,
450,
499,
62,
7942,
5357,
997,
62,
259,
12102,
796,
657,
13,
198,
220,
220,
220,
220,
220,
1255,
796,
1802,
13,
198,
220,
220,
220,
17852,
5188,
5064,
468,
62,
65,
296,
796,
450,
499,
62,
7942,
5357,
997,
62,
12102,
1875,
997,
62,
259,
12102,
1635,
838,
13,
198,
220,
220,
220,
220,
220,
1255,
796,
4019,
13,
198,
220,
220,
220,
17852,
5188,
5064,
997,
62,
12102,
1875,
513,
5357,
997,
62,
259,
12102,
796,
657,
13,
198,
220,
220,
220,
220,
220,
1255,
796,
1802,
13,
198,
220,
220,
220,
17852,
5188,
5064,
997,
62,
12102,
1875,
657,
5357,
997,
62,
259,
12102,
796,
657,
13,
198,
220,
220,
220,
220,
220,
1255,
796,
4019,
13,
198,
220,
220,
220,
17852,
5188,
5064,
997,
62,
12102,
1875,
997,
62,
259,
12102,
1635,
838,
13,
198,
220,
220,
220,
220,
220,
366,
18578,
1162,
622,
1996,
41002,
12,
2624,
12473,
1366,
13,
220,
48951,
16311,
3588,
470,
1884,
416,
2863,
13,
198,
220,
220,
220,
220,
220,
1255,
796,
1679,
13,
198,
220,
220,
220,
17852,
5188,
13,
198,
220,
220,
220,
220,
220,
1255,
796,
657,
13,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
23578,
49273,
13,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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ABAP_EXPORT
*&
*&---------------------------------------------------------------------*
*& This is a template for exporting ABAP code.
*& Uncomment the variant to use for ABAP export
*& set file_name and method parameters
*&---------------------------------------------------------------------*
REPORT zcqse_abap_export.
TYPE-POOLS: abap.
DATA:
file_name TYPE string,
object_patterns TYPE string_table,
package_patterns TYPE string_table,
package_names TYPE trdevclasses1,
test type string.
* TODO (CP): Provide selection screen for parameters.
test = 'Das ist ein � dummy text soll code inspector finden'.
PERFORM main.
*&---------------------------------------------------------------------*
*& Form main
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM main.
DATA:
exporter TYPE REF TO zcl_cqse_abap_exporter.
CREATE OBJECT exporter
EXPORTING
file_name = 'D:\svn_local\conqat-cqse\engine\eu.cqse.conqat.engine.abap\test-abap-sources\zy_all.zip'.
* exporter->is_toplevel_dir_by_progtype = abap_true.
exporter->add_ci_variant(
variant_user = 'BCUSER'
variant = 'TQE_RULESET'
).
exporter->add_by_name_pattern(
pattern = 'Z%'
).
exporter->add_by_name_pattern(
pattern = 'Y%'
).
exporter->save( ).
ENDFORM. "main | [
9,
5,
10097,
30934,
9,
201,
198,
9,
5,
6358,
220,
1168,
34,
48,
5188,
62,
6242,
2969,
62,
6369,
15490,
201,
198,
9,
5,
201,
198,
9,
5,
10097,
30934,
9,
201,
198,
9,
5,
770,
318,
257,
11055,
329,
39133,
9564,
2969,
2438,
13,
201,
198,
9,
5,
791,
23893,
262,
15304,
284,
779,
329,
9564,
2969,
10784,
201,
198,
9,
5,
900,
2393,
62,
3672,
290,
2446,
10007,
201,
198,
9,
5,
10097,
30934,
9,
201,
198,
201,
198,
2200,
15490,
220,
1976,
66,
80,
325,
62,
397,
499,
62,
39344,
13,
201,
198,
201,
198,
25216,
12,
16402,
3535,
50,
25,
450,
499,
13,
201,
198,
201,
198,
26947,
25,
201,
198,
220,
220,
220,
220,
220,
2393,
62,
3672,
41876,
4731,
11,
201,
198,
220,
220,
220,
220,
220,
2134,
62,
33279,
82,
41876,
4731,
62,
11487,
11,
201,
198,
220,
220,
220,
220,
220,
5301,
62,
33279,
82,
41876,
4731,
62,
11487,
11,
201,
198,
220,
220,
220,
220,
220,
5301,
62,
14933,
41876,
491,
7959,
37724,
16,
11,
201,
198,
220,
220,
220,
220,
220,
1332,
2099,
4731,
13,
201,
198,
201,
198,
9,
16926,
46,
357,
8697,
2599,
44290,
6356,
3159,
329,
10007,
13,
201,
198,
201,
198,
9288,
796,
705,
35,
292,
318,
83,
304,
259,
1222,
2,
15,
26,
31548,
2420,
523,
297,
2438,
24110,
1064,
268,
4458,
201,
198,
201,
198,
18973,
21389,
1388,
13,
201,
198,
201,
198,
9,
5,
10097,
30934,
9,
201,
198,
9,
5,
220,
220,
220,
220,
220,
5178,
220,
1388,
201,
198,
9,
5,
10097,
30934,
9,
201,
198,
9,
220,
220,
220,
220,
220,
220,
2420,
201,
198,
9,
10097,
23031,
9,
201,
198,
21389,
1388,
13,
201,
198,
220,
42865,
25,
201,
198,
220,
220,
220,
220,
220,
220,
220,
1033,
4337,
41876,
4526,
37,
5390,
1976,
565,
62,
66,
80,
325,
62,
397,
499,
62,
1069,
26634,
13,
201,
198,
201,
198,
201,
198,
220,
29244,
6158,
25334,
23680,
1033,
4337,
201,
198,
220,
220,
220,
7788,
15490,
2751,
201,
198,
220,
220,
220,
220,
220,
2393,
62,
3672,
796,
705,
35,
7479,
21370,
77,
62,
12001,
59,
1102,
80,
265,
12,
66,
80,
325,
59,
18392,
59,
12496,
13,
66,
80,
325,
13,
1102,
80,
265,
13,
18392,
13,
397,
499,
59,
9288,
12,
397,
499,
12,
82,
2203,
59,
7357,
62,
439,
13,
13344,
4458,
201,
198,
201,
198,
9,
1033,
4337,
3784,
271,
62,
83,
643,
626,
62,
15908,
62,
1525,
62,
1676,
70,
4906,
796,
450,
499,
62,
7942,
13,
201,
198,
201,
198,
220,
1033,
4337,
3784,
2860,
62,
979,
62,
25641,
415,
7,
201,
198,
220,
220,
220,
220,
220,
15304,
62,
7220,
796,
705,
2749,
29904,
6,
201,
198,
220,
220,
220,
220,
220,
15304,
220,
220,
220,
220,
220,
796,
705,
51,
48,
36,
62,
49,
6239,
1546,
2767,
6,
201,
198,
220,
6739,
201,
198,
201,
198,
220,
1033,
4337,
3784,
2860,
62,
1525,
62,
3672,
62,
33279,
7,
201,
198,
220,
220,
220,
3912,
796,
705,
57,
4,
6,
201,
198,
220,
220,
220,
6739,
201,
198,
220,
1033,
4337,
3784,
2860,
62,
1525,
62,
3672,
62,
33279,
7,
201,
198,
220,
220,
220,
3912,
796,
705,
56,
4,
6,
201,
198,
220,
220,
220,
6739,
201,
198,
201,
198,
220,
1033,
4337,
3784,
21928,
7,
6739,
201,
198,
201,
198,
201,
198,
1677,
8068,
1581,
44,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12417
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_object_fugr DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_program FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
ty_rs38l_incl_tt TYPE STANDARD TABLE OF rs38l_incl WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_function,
funcname TYPE rs38l_fnam,
global_flag TYPE rs38l-global,
remote_call TYPE rs38l-remote,
update_task TYPE rs38l-utask,
short_text TYPE tftit-stext,
remote_basxml TYPE rs38l-basxml_enabled,
import TYPE STANDARD TABLE OF rsimp WITH DEFAULT KEY,
changing TYPE STANDARD TABLE OF rscha WITH DEFAULT KEY,
export TYPE STANDARD TABLE OF rsexp WITH DEFAULT KEY,
tables TYPE STANDARD TABLE OF rstbl WITH DEFAULT KEY,
exception TYPE STANDARD TABLE OF rsexc WITH DEFAULT KEY,
documentation TYPE STANDARD TABLE OF rsfdo WITH DEFAULT KEY,
exception_classes TYPE abap_bool,
END OF ty_function .
TYPES:
ty_function_tt TYPE STANDARD TABLE OF ty_function WITH DEFAULT KEY .
TYPES:
ty_sobj_name_tt TYPE STANDARD TABLE OF sobj_name WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_tpool_i18n,
language TYPE langu,
textpool TYPE zif_abapgit_definitions=>ty_tpool_tt,
END OF ty_tpool_i18n .
TYPES:
ty_tpools_i18n TYPE STANDARD TABLE OF ty_tpool_i18n .
DATA mt_includes_cache TYPE ty_sobj_name_tt .
DATA mt_includes_all TYPE ty_sobj_name_tt .
METHODS check_rfc_parameters
IMPORTING
!is_function TYPE ty_function
RAISING
zcx_abapgit_exception .
METHODS update_where_used
IMPORTING
!it_includes TYPE ty_sobj_name_tt .
METHODS main_name
RETURNING
VALUE(rv_program) TYPE program
RAISING
zcx_abapgit_exception .
METHODS functions
RETURNING
VALUE(rt_functab) TYPE ty_rs38l_incl_tt
RAISING
zcx_abapgit_exception .
METHODS includes
RETURNING
VALUE(rt_includes) TYPE ty_sobj_name_tt
RAISING
zcx_abapgit_exception .
METHODS serialize_functions
RETURNING
VALUE(rt_functions) TYPE ty_function_tt
RAISING
zcx_abapgit_exception .
METHODS deserialize_functions
IMPORTING
!it_functions TYPE ty_function_tt
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
METHODS serialize_xml
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_output
RAISING
zcx_abapgit_exception .
METHODS deserialize_xml
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_input
!iv_package TYPE devclass
RAISING
zcx_abapgit_exception .
METHODS serialize_includes
RAISING
zcx_abapgit_exception .
METHODS deserialize_includes
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_input
!iv_package TYPE devclass
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
METHODS is_function_group_locked
RETURNING
VALUE(rv_is_functions_group_locked) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS is_any_include_locked
RETURNING
VALUE(rv_is_any_include_locked) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS is_any_function_module_locked
RETURNING
VALUE(rv_any_function_module_locked) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS get_abap_version
IMPORTING
!ii_xml TYPE REF TO zif_abapgit_xml_input
RETURNING
VALUE(rv_abap_version) TYPE progdir-uccheck
RAISING
zcx_abapgit_exception .
METHODS update_func_group_short_text
IMPORTING
!iv_group TYPE rs38l-area
!iv_short_text TYPE tftit-stext .
METHODS serialize_texts
IMPORTING
!iv_prog_name TYPE programm
!ii_xml TYPE REF TO zif_abapgit_xml_output
RAISING
zcx_abapgit_exception .
METHODS deserialize_texts
IMPORTING
!iv_prog_name TYPE programm
!ii_xml TYPE REF TO zif_abapgit_xml_input
RAISING
zcx_abapgit_exception .
METHODS belongs_incl_to_other_fugr
IMPORTING
!iv_include TYPE sobj_name
RETURNING
VALUE(rv_belongs_to_other_fugr) TYPE abap_bool.
ENDCLASS.
CLASS zcl_abapgit_object_fugr IMPLEMENTATION.
METHOD check_rfc_parameters.
* function module RS_FUNCTIONMODULE_INSERT does the same deep down, but the right error
* message is not returned to the user, this is a workaround to give a proper error
* message to the user
DATA: ls_parameter TYPE rsfbpara,
lt_fupa TYPE rsfb_param,
ls_fupa LIKE LINE OF lt_fupa.
IF is_function-remote_call = 'R'.
cl_fb_parameter_conversion=>convert_parameter_old_to_fupa(
EXPORTING
functionname = is_function-funcname
import = is_function-import
export = is_function-export
change = is_function-changing
tables = is_function-tables
except = is_function-exception
IMPORTING
fupararef = lt_fupa ).
LOOP AT lt_fupa INTO ls_fupa WHERE paramtype = 'I' OR paramtype = 'E' OR paramtype = 'C' OR paramtype = 'T'.
cl_fb_parameter_conversion=>convert_intern_to_extern(
EXPORTING
parameter_db = ls_fupa
IMPORTING
parameter_vis = ls_parameter ).
CALL FUNCTION 'RS_FB_CHECK_PARAMETER_REMOTE'
EXPORTING
parameter = ls_parameter
basxml_enabled = is_function-remote_basxml
EXCEPTIONS
not_remote_compatible = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD deserialize_functions.
DATA: lv_include TYPE rs38l-include,
lv_area TYPE rs38l-area,
lv_group TYPE rs38l-area,
lv_namespace TYPE rs38l-namespace,
lt_source TYPE TABLE OF abaptxt255,
lv_msg TYPE string,
lx_error TYPE REF TO zcx_abapgit_exception,
lv_corrnum TYPE e070use-ordernum.
FIELD-SYMBOLS: <ls_func> LIKE LINE OF it_functions.
lv_corrnum = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum.
LOOP AT it_functions ASSIGNING <ls_func>.
lt_source = mo_files->read_abap( iv_extra = <ls_func>-funcname ).
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
OTHERS = 12.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = <ls_func>-funcname
IMPORTING
include = lv_include
EXCEPTIONS
function_not_exist = 1.
IF sy-subrc = 0.
* delete the function module to make sure the parameters are updated
* havent found a nice way to update the paramters
CALL FUNCTION 'FUNCTION_DELETE'
EXPORTING
funcname = <ls_func>-funcname
suppress_success_message = abap_true
EXCEPTIONS
error_message = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
ENDIF.
TRY.
check_rfc_parameters( <ls_func> ).
CATCH zcx_abapgit_exception INTO lx_error.
ii_log->add_error(
iv_msg = |Function module { <ls_func>-funcname }: { lx_error->get_text( ) }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDTRY.
CALL FUNCTION 'RS_FUNCTIONMODULE_INSERT'
EXPORTING
funcname = <ls_func>-funcname
function_pool = lv_group
interface_global = <ls_func>-global_flag
remote_call = <ls_func>-remote_call
short_text = <ls_func>-short_text
update_task = <ls_func>-update_task
exception_class = <ls_func>-exception_classes
namespace = lv_namespace
remote_basxml_supported = <ls_func>-remote_basxml
corrnum = lv_corrnum
IMPORTING
function_include = lv_include
TABLES
import_parameter = <ls_func>-import
export_parameter = <ls_func>-export
tables_parameter = <ls_func>-tables
changing_parameter = <ls_func>-changing
exception_list = <ls_func>-exception
parameter_docu = <ls_func>-documentation
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_msg.
ii_log->add_error( iv_msg = |Function module { <ls_func>-funcname }: { lv_msg }|
is_item = ms_item ).
CONTINUE. "with next function module
ENDIF.
INSERT REPORT lv_include FROM lt_source.
ii_log->add_success( iv_msg = |Function module { <ls_func>-funcname } imported|
is_item = ms_item ).
ENDLOOP.
ENDMETHOD.
METHOD deserialize_includes.
DATA: lo_xml TYPE REF TO zif_abapgit_xml_input,
ls_progdir TYPE ty_progdir,
lt_includes TYPE ty_sobj_name_tt,
lt_tpool TYPE textpool_table,
lt_tpool_ext TYPE zif_abapgit_definitions=>ty_tpool_tt,
lt_source TYPE TABLE OF abaptxt255,
lx_exc TYPE REF TO zcx_abapgit_exception.
FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes.
tadir_insert( iv_package ).
ii_xml->read( EXPORTING iv_name = 'INCLUDES'
CHANGING cg_data = lt_includes ).
LOOP AT lt_includes ASSIGNING <lv_include>.
"ignore simple transformation includes (as long as they remain in existing repositories)
IF strlen( <lv_include> ) = 33 AND <lv_include>+30(3) = 'XTI'.
ii_log->add_warning( iv_msg = |Simple Transformation include { <lv_include> } ignored|
is_item = ms_item ).
CONTINUE.
ENDIF.
TRY.
lt_source = mo_files->read_abap( iv_extra = <lv_include> ).
lo_xml = mo_files->read_xml( <lv_include> ).
lo_xml->read( EXPORTING iv_name = 'PROGDIR'
CHANGING cg_data = ls_progdir ).
lo_xml->read( EXPORTING iv_name = 'TPOOL'
CHANGING cg_data = lt_tpool_ext ).
lt_tpool = read_tpool( lt_tpool_ext ).
deserialize_program( is_progdir = ls_progdir
it_source = lt_source
it_tpool = lt_tpool
iv_package = iv_package ).
deserialize_textpool( iv_program = <lv_include>
it_tpool = lt_tpool
iv_is_include = abap_true ).
ii_log->add_success( iv_msg = |Include { ls_progdir-name } imported|
is_item = ms_item ).
CATCH zcx_abapgit_exception INTO lx_exc.
ii_log->add_exception( ix_exc = lx_exc
is_item = ms_item ).
CONTINUE.
ENDTRY.
ENDLOOP.
ENDMETHOD.
METHOD deserialize_texts.
DATA: lt_tpool_i18n TYPE ty_tpools_i18n,
lt_tpool TYPE textpool_table.
FIELD-SYMBOLS <ls_tpool> LIKE LINE OF lt_tpool_i18n.
ii_xml->read( EXPORTING iv_name = 'I18N_TPOOL'
CHANGING cg_data = lt_tpool_i18n ).
LOOP AT lt_tpool_i18n ASSIGNING <ls_tpool>.
lt_tpool = read_tpool( <ls_tpool>-textpool ).
deserialize_textpool( iv_program = iv_prog_name
iv_language = <ls_tpool>-language
it_tpool = lt_tpool ).
ENDLOOP.
ENDMETHOD.
METHOD deserialize_xml.
DATA: lv_complete TYPE rs38l-area,
lv_namespace TYPE rs38l-namespace,
lv_areat TYPE tlibt-areat,
lv_stext TYPE tftit-stext,
lv_group TYPE rs38l-area,
lv_abap_version TYPE trdir-uccheck,
lv_corrnum TYPE e070use-ordernum.
lv_abap_version = get_abap_version( ii_xml ).
lv_complete = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_complete
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
include_not_exists = 1
group_not_exists = 2
no_selections = 3
no_function_include = 4
no_function_pool = 5
delimiter_wrong_position = 6
no_customer_function_group = 7
no_customer_function_include = 8
reserved_name_customer = 9
namespace_too_long = 10
area_length_error = 11
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ii_xml->read( EXPORTING iv_name = 'AREAT'
CHANGING cg_data = lv_areat ).
lv_stext = lv_areat.
lv_corrnum = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum.
CALL FUNCTION 'RS_FUNCTION_POOL_INSERT'
EXPORTING
function_pool = lv_group
short_text = lv_stext
namespace = lv_namespace
devclass = iv_package
unicode_checks = lv_abap_version
corrnum = lv_corrnum
suppress_corr_check = abap_false
EXCEPTIONS
name_already_exists = 1
name_not_correct = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
no_modify_permission = 7
no_show_permission = 8
enqueue_system_failure = 9
canceled_in_corr = 10
undefined_error = 11
OTHERS = 12.
CASE sy-subrc.
WHEN 0.
" Everything is ok
WHEN 1 OR 3.
" If the function group exists we need to manually update the short text
update_func_group_short_text( iv_group = lv_group
iv_short_text = lv_stext ).
WHEN OTHERS.
zcx_abapgit_exception=>raise_t100( ).
ENDCASE.
ENDMETHOD.
METHOD functions.
DATA: lv_area TYPE rs38l-area.
FIELD-SYMBOLS: <ls_functab> TYPE LINE OF ty_rs38l_incl_tt.
lv_area = ms_item-obj_name.
CALL FUNCTION 'RS_FUNCTION_POOL_CONTENTS'
EXPORTING
function_pool = lv_area
TABLES
functab = rt_functab
EXCEPTIONS
function_pool_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
* The result can also contain function which are lowercase.
LOOP AT rt_functab ASSIGNING <ls_functab>.
TRANSLATE <ls_functab> TO UPPER CASE.
ENDLOOP.
SORT rt_functab BY funcname ASCENDING.
DELETE ADJACENT DUPLICATES FROM rt_functab COMPARING funcname.
ENDMETHOD.
METHOD get_abap_version.
DATA: lt_includes TYPE ty_sobj_name_tt,
ls_progdir TYPE ty_progdir,
lo_xml TYPE REF TO zif_abapgit_xml_input.
FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes.
ii_xml->read( EXPORTING iv_name = 'INCLUDES'
CHANGING cg_data = lt_includes ).
LOOP AT lt_includes ASSIGNING <lv_include>.
lo_xml = mo_files->read_xml( <lv_include> ).
lo_xml->read( EXPORTING iv_name = 'PROGDIR'
CHANGING cg_data = ls_progdir ).
IF ls_progdir-uccheck IS INITIAL.
CONTINUE.
ELSEIF rv_abap_version IS INITIAL.
rv_abap_version = ls_progdir-uccheck.
CONTINUE.
ELSEIF rv_abap_version <> ls_progdir-uccheck.
*** All includes need to have the same ABAP language version
zcx_abapgit_exception=>raise( 'different ABAP Language Versions' ).
ENDIF.
ENDLOOP.
IF rv_abap_version IS INITIAL.
rv_abap_version = 'X'.
ENDIF.
ENDMETHOD.
METHOD includes.
TYPES: BEGIN OF ty_reposrc,
progname TYPE reposrc-progname,
END OF ty_reposrc.
DATA: lt_reposrc TYPE STANDARD TABLE OF ty_reposrc WITH DEFAULT KEY,
ls_reposrc LIKE LINE OF lt_reposrc,
lv_program TYPE program,
lv_maintviewname LIKE LINE OF rt_includes,
lv_offset_ns TYPE i,
lv_tabix LIKE sy-tabix,
lt_functab TYPE ty_rs38l_incl_tt,
lt_tadir_includes TYPE HASHED TABLE OF objname WITH UNIQUE KEY table_line.
FIELD-SYMBOLS: <lv_include> LIKE LINE OF rt_includes,
<ls_func> LIKE LINE OF lt_functab.
IF lines( mt_includes_cache ) > 0.
rt_includes = mt_includes_cache.
RETURN.
ENDIF.
lv_program = main_name( ).
lt_functab = functions( ).
CALL FUNCTION 'RS_GET_ALL_INCLUDES'
EXPORTING
program = lv_program
TABLES
includetab = rt_includes
EXCEPTIONS
not_existent = 1
no_program = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RS_GET_ALL_INCLUDES' ).
ENDIF.
LOOP AT lt_functab ASSIGNING <ls_func>.
DELETE TABLE rt_includes FROM <ls_func>-include.
ENDLOOP.
* handle generated maintenance views
IF ms_item-obj_name(1) <> '/'.
"FGroup name does not contain a namespace
lv_maintviewname = |L{ ms_item-obj_name }T00|.
ELSE.
"FGroup name contains a namespace
lv_offset_ns = find( val = ms_item-obj_name+1
sub = '/' ).
lv_offset_ns = lv_offset_ns + 2.
lv_maintviewname = |{ ms_item-obj_name(lv_offset_ns) }L{ ms_item-obj_name+lv_offset_ns }T00|.
ENDIF.
READ TABLE rt_includes WITH KEY table_line = lv_maintviewname TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
APPEND lv_maintviewname TO rt_includes.
ENDIF.
IF lines( rt_includes ) > 0.
" check which includes have their own tadir entry
" these includes might reside in a different package or might be shared between multiple function groups
" or other programs and are hence no part of the to serialized FUGR object
" they will be handled as individual objects when serializing their package
" in addition, referenced XTI includes referencing (simple) transformations must be ignored
SELECT obj_name
INTO TABLE lt_tadir_includes
FROM tadir
FOR ALL ENTRIES IN rt_includes
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = rt_includes-table_line.
LOOP AT rt_includes ASSIGNING <lv_include>.
" skip autogenerated includes from Table Maintenance Generator
IF <lv_include> CP 'LSVIM*'.
DELETE rt_includes INDEX sy-tabix.
CONTINUE.
ENDIF.
READ TABLE lt_tadir_includes WITH KEY table_line = <lv_include> TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
DELETE rt_includes.
CONTINUE.
ENDIF.
IF strlen( <lv_include> ) = 33 AND <lv_include>+30(3) = 'XTI'.
"ignore referenced (simple) transformation includes
DELETE rt_includes.
CONTINUE.
ENDIF.
ENDLOOP.
IF lines( rt_includes ) > 0.
SELECT progname FROM reposrc
INTO TABLE lt_reposrc
FOR ALL ENTRIES IN rt_includes
WHERE progname = rt_includes-table_line
AND r3state = 'A'.
ENDIF.
SORT lt_reposrc BY progname ASCENDING.
ENDIF.
LOOP AT rt_includes ASSIGNING <lv_include>.
lv_tabix = sy-tabix.
* make sure the include exists
READ TABLE lt_reposrc INTO ls_reposrc
WITH KEY progname = <lv_include> BINARY SEARCH.
IF sy-subrc <> 0.
DELETE rt_includes INDEX lv_tabix.
CONTINUE.
ENDIF.
"Make sure that the include does not belong to another function group
IF belongs_incl_to_other_fugr( iv_include = <lv_include> ) = abap_true.
DELETE rt_includes.
ENDIF.
ENDLOOP.
APPEND lv_program TO rt_includes.
mt_includes_cache = rt_includes.
ENDMETHOD.
METHOD is_any_function_module_locked.
DATA: lt_functions TYPE ty_rs38l_incl_tt.
FIELD-SYMBOLS: <ls_function> TYPE rs38l_incl.
TRY.
lt_functions = functions( ).
CATCH zcx_abapgit_exception.
RETURN.
ENDTRY.
LOOP AT lt_functions ASSIGNING <ls_function>.
IF exists_a_lock_entry_for( iv_lock_object = 'ESFUNCTION'
iv_argument = |{ <ls_function>-funcname }| ) = abap_true.
rv_any_function_module_locked = abap_true.
EXIT.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD is_any_include_locked.
DATA: lt_includes TYPE ty_sobj_name_tt.
FIELD-SYMBOLS: <lv_include> TYPE sobj_name.
TRY.
lt_includes = includes( ).
CATCH zcx_abapgit_exception.
RETURN.
ENDTRY.
LOOP AT lt_includes ASSIGNING <lv_include>.
IF exists_a_lock_entry_for( iv_lock_object = 'ESRDIRE'
iv_argument = |{ <lv_include> }| ) = abap_true.
rv_is_any_include_locked = abap_true.
EXIT.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD is_function_group_locked.
DATA: lv_object TYPE eqegraarg.
lv_object = |FG{ ms_item-obj_name }|.
OVERLAY lv_object WITH ' '.
lv_object = lv_object && '*'.
rv_is_functions_group_locked = exists_a_lock_entry_for( iv_lock_object = 'EEUDB'
iv_argument = lv_object ).
ENDMETHOD.
METHOD main_name.
DATA: lv_area TYPE rs38l-area,
lv_namespace TYPE rs38l-namespace,
lv_group TYPE rs38l-area.
lv_area = ms_item-obj_name.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
complete_area = lv_area
IMPORTING
namespace = lv_namespace
group = lv_group
EXCEPTIONS
include_not_exists = 1
group_not_exists = 2
no_selections = 3
no_function_include = 4
no_function_pool = 5
delimiter_wrong_position = 6
no_customer_function_group = 7
no_customer_function_include = 8
reserved_name_customer = 9
namespace_too_long = 10
area_length_error = 11
OTHERS = 12.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CONCATENATE lv_namespace 'SAPL' lv_group INTO rv_program.
ENDMETHOD.
METHOD serialize_functions.
DATA:
lt_source TYPE TABLE OF rssource,
lt_functab TYPE ty_rs38l_incl_tt,
lt_new_source TYPE rsfb_source,
ls_function LIKE LINE OF rt_functions.
FIELD-SYMBOLS: <ls_func> LIKE LINE OF lt_functab,
<ls_documentation> TYPE LINE OF ty_function-documentation.
lt_functab = functions( ).
LOOP AT lt_functab ASSIGNING <ls_func>.
* fm RPY_FUNCTIONMODULE_READ does not support source code
* lines longer than 72 characters
CLEAR ls_function.
MOVE-CORRESPONDING <ls_func> TO ls_function.
CLEAR lt_new_source.
CLEAR lt_source.
CALL FUNCTION 'RPY_FUNCTIONMODULE_READ_NEW'
EXPORTING
functionname = <ls_func>-funcname
IMPORTING
global_flag = ls_function-global_flag
remote_call = ls_function-remote_call
update_task = ls_function-update_task
short_text = ls_function-short_text
remote_basxml_supported = ls_function-remote_basxml
TABLES
import_parameter = ls_function-import
changing_parameter = ls_function-changing
export_parameter = ls_function-export
tables_parameter = ls_function-tables
exception_list = ls_function-exception
documentation = ls_function-documentation
source = lt_source
CHANGING
new_source = lt_new_source
EXCEPTIONS
error_message = 1
function_not_found = 2
invalid_name = 3
OTHERS = 4.
IF sy-subrc = 2.
CONTINUE.
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RPY_FUNCTIONMODULE_READ_NEW' ).
ENDIF.
LOOP AT ls_function-documentation ASSIGNING <ls_documentation>.
CLEAR <ls_documentation>-index.
ENDLOOP.
SELECT SINGLE exten3 INTO ls_function-exception_classes FROM enlfdir
WHERE funcname = <ls_func>-funcname. "#EC CI_SUBRC
APPEND ls_function TO rt_functions.
IF NOT lt_new_source IS INITIAL.
mo_files->add_abap( iv_extra = <ls_func>-funcname
it_abap = lt_new_source ).
ELSE.
mo_files->add_abap( iv_extra = <ls_func>-funcname
it_abap = lt_source ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD serialize_includes.
DATA: lt_includes TYPE ty_sobj_name_tt.
FIELD-SYMBOLS: <lv_include> LIKE LINE OF lt_includes.
lt_includes = includes( ).
LOOP AT lt_includes ASSIGNING <lv_include>.
* todo, filename is not correct, a include can be used in several programs
serialize_program( is_item = ms_item
io_files = mo_files
iv_program = <lv_include>
iv_extra = <lv_include> ).
ENDLOOP.
ENDMETHOD.
METHOD serialize_texts.
DATA: lt_tpool_i18n TYPE ty_tpools_i18n,
lt_tpool TYPE textpool_table.
FIELD-SYMBOLS <ls_tpool> LIKE LINE OF lt_tpool_i18n.
IF ii_xml->i18n_params( )-main_language_only = abap_true.
RETURN.
ENDIF.
" Table d010tinf stores info. on languages in which program is maintained
" Select all active translations of program texts
" Skip main language - it was already serialized
SELECT DISTINCT language
INTO CORRESPONDING FIELDS OF TABLE lt_tpool_i18n
FROM d010tinf
WHERE r3state = 'A'
AND prog = iv_prog_name
AND language <> mv_language ##TOO_MANY_ITAB_FIELDS.
SORT lt_tpool_i18n BY language ASCENDING.
LOOP AT lt_tpool_i18n ASSIGNING <ls_tpool>.
READ TEXTPOOL iv_prog_name
LANGUAGE <ls_tpool>-language
INTO lt_tpool.
<ls_tpool>-textpool = add_tpool( lt_tpool ).
ENDLOOP.
IF lines( lt_tpool_i18n ) > 0.
ii_xml->add( iv_name = 'I18N_TPOOL'
ig_data = lt_tpool_i18n ).
ENDIF.
ENDMETHOD.
METHOD serialize_xml.
DATA: lt_includes TYPE ty_sobj_name_tt,
lv_areat TYPE tlibt-areat.
SELECT SINGLE areat INTO lv_areat
FROM tlibt
WHERE spras = mv_language
AND area = ms_item-obj_name. "#EC CI_GENBUFF "#EC CI_SUBRC
lt_includes = includes( ).
ii_xml->add( iv_name = 'AREAT'
ig_data = lv_areat ).
ii_xml->add( iv_name = 'INCLUDES'
ig_data = lt_includes ).
ENDMETHOD.
METHOD update_func_group_short_text.
" We update the short text directly.
" SE80 does the same in
" Program SAPLSEUF / LSEUFF07
" FORM GROUP_CHANGE
UPDATE tlibt SET areat = iv_short_text
WHERE spras = mv_language
AND area = iv_group.
ENDMETHOD.
METHOD update_where_used.
* make extra sure the where-used list is updated after deletion
* Experienced some problems with the T00 include
* this method just tries to update everything
DATA: lv_include LIKE LINE OF it_includes,
lo_cross TYPE REF TO cl_wb_crossreference.
LOOP AT it_includes INTO lv_include.
lo_cross = NEW #( p_name = lv_include
p_include = lv_include ).
lo_cross->index_actualize( ).
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
TYPES: BEGIN OF ty_stamps,
user TYPE xubname,
date TYPE d,
time TYPE t,
END OF ty_stamps.
DATA: lt_stamps TYPE STANDARD TABLE OF ty_stamps WITH DEFAULT KEY,
lv_program TYPE program.
FIELD-SYMBOLS: <ls_stamp> LIKE LINE OF lt_stamps.
lv_program = main_name( ).
IF mt_includes_all IS INITIAL.
CALL FUNCTION 'RS_GET_ALL_INCLUDES'
EXPORTING
program = lv_program
TABLES
includetab = mt_includes_all
EXCEPTIONS
not_existent = 1
no_program = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from RS_GET_ALL_INCLUDES' ).
ENDIF.
ENDIF.
SELECT unam AS user udat AS date utime AS time FROM reposrc
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
WHERE progname = lv_program
AND r3state = 'A'. "#EC CI_SUBRC
IF mt_includes_all IS NOT INITIAL.
SELECT unam AS user udat AS date utime AS time FROM reposrc
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
FOR ALL ENTRIES IN mt_includes_all
WHERE progname = mt_includes_all-table_line
AND r3state = 'A'. "#EC CI_SUBRC
ENDIF.
SELECT unam AS user udat AS date utime AS time FROM repotext " Program text pool
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
WHERE progname = lv_program
AND r3state = 'A'. "#EC CI_SUBRC
SELECT vautor AS user vdatum AS date vzeit AS time FROM eudb " GUI
APPENDING CORRESPONDING FIELDS OF TABLE lt_stamps
WHERE relid = 'CU'
AND name = lv_program
AND srtf2 = 0 ##TOO_MANY_ITAB_FIELDS.
* Screens: username not stored in D020S database table
SORT lt_stamps BY date DESCENDING time DESCENDING.
READ TABLE lt_stamps INDEX 1 ASSIGNING <ls_stamp>.
IF sy-subrc = 0.
rv_user = <ls_stamp>-user.
ELSE.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_area TYPE rs38l-area,
lt_includes TYPE ty_sobj_name_tt,
lv_corrnum TYPE e070use-ordernum.
lt_includes = includes( ).
lv_area = ms_item-obj_name.
lv_corrnum = zcl_abapgit_default_transport=>get_instance( )->get( )-ordernum.
CALL FUNCTION 'RS_FUNCTION_POOL_DELETE'
EXPORTING
area = lv_area
suppress_popups = abap_true
skip_progress_ind = abap_true
corrnum = lv_corrnum
EXCEPTIONS
canceled_in_corr = 1
enqueue_system_failure = 2
function_exist = 3
not_executed = 4
no_modify_permission = 5
no_show_permission = 6
permission_failure = 7
pool_not_exist = 8
cancelled = 9
OTHERS = 10.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
update_where_used( lt_includes ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_program_name TYPE programm,
lt_functions TYPE ty_function_tt,
lt_dynpros TYPE ty_dynpro_tt,
ls_cua TYPE ty_cua.
deserialize_xml(
ii_xml = io_xml
iv_package = iv_package ).
io_xml->read( EXPORTING iv_name = 'FUNCTIONS'
CHANGING cg_data = lt_functions ).
deserialize_functions(
it_functions = lt_functions
ii_log = ii_log ).
deserialize_includes(
ii_xml = io_xml
iv_package = iv_package
ii_log = ii_log ).
lv_program_name = main_name( ).
deserialize_texts( iv_prog_name = lv_program_name
ii_xml = io_xml ).
deserialize_lxe_texts( io_xml ).
io_xml->read( EXPORTING iv_name = 'DYNPROS'
CHANGING cg_data = lt_dynpros ).
deserialize_dynpros( lt_dynpros ).
io_xml->read( EXPORTING iv_name = 'CUA'
CHANGING cg_data = ls_cua ).
deserialize_cua( iv_program_name = lv_program_name
is_cua = ls_cua ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_pool TYPE tlibg-area.
lv_pool = ms_item-obj_name.
CALL FUNCTION 'RS_FUNCTION_POOL_EXISTS'
EXPORTING
function_pool = lv_pool
EXCEPTIONS
pool_not_exists = 1.
rv_bool = xsdbool( sy-subrc <> 1 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA: lv_program TYPE program.
lv_program = main_name( ).
IF is_function_group_locked( ) = abap_true
OR is_any_include_locked( ) = abap_true
OR is_any_function_module_locked( ) = abap_true
OR is_any_dynpro_locked( lv_program ) = abap_true
OR is_cua_locked( lv_program ) = abap_true
OR is_text_locked( lv_program ) = abap_true.
rv_is_locked = abap_true.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
* function group SEUF
* function group SIFP
* function group SUNI
DATA: lt_functions TYPE ty_function_tt,
ls_progdir TYPE ty_progdir,
lv_program_name TYPE programm,
lt_dynpros TYPE ty_dynpro_tt,
ls_cua TYPE ty_cua.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
serialize_xml( io_xml ).
lt_functions = serialize_functions( ).
io_xml->add( iv_name = 'FUNCTIONS'
ig_data = lt_functions ).
serialize_includes( ).
lv_program_name = main_name( ).
ls_progdir = read_progdir( lv_program_name ).
IF io_xml->i18n_params( )-translation_languages IS INITIAL.
" Old I18N option
serialize_texts( iv_prog_name = lv_program_name
ii_xml = io_xml ).
ELSE.
" New LXE option
serialize_lxe_texts( io_xml ).
ENDIF.
IF ls_progdir-subc = 'F'.
lt_dynpros = serialize_dynpros( lv_program_name ).
io_xml->add( iv_name = 'DYNPROS'
ig_data = lt_dynpros ).
ls_cua = serialize_cua( lv_program_name ).
io_xml->add( iv_name = 'CUA'
ig_data = ls_cua ).
ENDIF.
ENDMETHOD.
METHOD belongs_incl_to_other_fugr.
" make sure that the include belongs to the function group
" like in LSEAPFAP Form TADIR_MAINTENANCE
DATA ls_tadir TYPE tadir.
DATA lv_namespace TYPE rs38l-namespace.
DATA lv_area TYPE rs38l-area.
DATA lv_include TYPE rs38l-include.
rv_belongs_to_other_fugr = abap_false.
IF iv_include(1) = 'L' OR iv_include+1 CS '/L'.
lv_include = iv_include.
ls_tadir-object = 'FUGR'.
CALL FUNCTION 'FUNCTION_INCLUDE_SPLIT'
IMPORTING
namespace = lv_namespace
group = lv_area
CHANGING
include = lv_include
EXCEPTIONS
OTHERS = 1.
IF lv_area(1) = 'X'. " "EXIT"-function-module
ls_tadir-object = 'FUGS'.
ENDIF.
IF sy-subrc = 0.
CONCATENATE lv_namespace lv_area INTO ls_tadir-obj_name.
IF ls_tadir-obj_name <> ms_item-obj_name.
rv_belongs_to_other_fugr = abap_true.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
69,
1018,
81,
5550,
20032,
17941,
44731,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
23065,
25261,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
15252,
13,
198,
220,
220,
220,
8355,
43429,
1546,
6941,
62,
16624,
7473,
1976,
361,
62,
397,
499,
18300,
62,
15252,
93,
5908,
62,
16624,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
3808,
2548,
75,
62,
259,
565,
62,
926,
41876,
49053,
9795,
43679,
3963,
44608,
2548,
75,
62,
259,
565,
13315,
5550,
38865,
35374,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
8818,
11,
198,
220,
220,
220,
220,
220,
220,
220,
25439,
3672,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
62,
69,
7402,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
62,
32109,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
20541,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6569,
62,
13345,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
47960,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4296,
62,
35943,
220,
220,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
315,
2093,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1790,
62,
5239,
220,
220,
220,
220,
220,
220,
220,
41876,
256,
701,
270,
12,
301,
2302,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6569,
62,
12093,
19875,
220,
220,
220,
220,
41876,
44608,
2548,
75,
12,
12093,
19875,
62,
25616,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1330,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
44608,
11011,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5609,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
44608,
11693,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10784,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
8044,
79,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
8893,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
301,
2436,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6631,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
8044,
66,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10314,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
374,
28202,
4598,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6631,
62,
37724,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
8818,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
8818,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
8818,
13315,
5550,
38865,
35374,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
568,
50007,
62,
3672,
62,
926,
41876,
49053,
9795,
43679,
3963,
27355,
73,
62,
3672,
220,
13315,
5550,
38865,
35374,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
83,
7742,
62,
72,
1507,
77,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3303,
41876,
2786,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2420,
7742,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
83,
7742,
62,
926,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
83,
7742,
62,
72,
1507,
77,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
83,
7742,
82,
62,
72,
1507,
77,
41876,
49053,
9795,
43679,
3963,
1259,
62,
83,
7742,
62,
72,
1507,
77,
764,
628,
220,
220,
220,
42865,
45079,
62,
42813,
62,
23870,
41876,
1259,
62,
568,
50007,
62,
3672,
62,
926,
764,
198,
220,
220,
220,
42865,
45079,
62,
42813,
62,
439,
41876,
1259,
62,
568,
50007,
62,
3672,
62,
926,
764,
628,
220,
220,
220,
337,
36252,
50,
2198,
62,
81,
16072,
62,
17143,
7307,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
8818,
41876,
1259,
62,
8818,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
4296,
62,
3003,
62,
1484,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
42813,
41876,
1259,
62,
568,
50007,
62,
3672,
62,
926,
764,
198,
220,
220,
220,
337,
36252,
50,
1388,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
23065,
8,
41876,
1430,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
5499,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
12543,
310,
397,
8,
41876,
1259,
62,
3808,
2548,
75,
62,
259,
565,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
3407,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
protected section.
data mo_injection type ref to /IWBEP/IF_SB_GEN_DPC_INJECTION .
methods ZPURCHASE_REQ_HE_CREATE_ENTITY
importing
!IV_ENTITY_NAME type STRING
!IV_ENTITY_SET_NAME type STRING
!IV_SOURCE_NAME type STRING
!IT_KEY_TAB type /IWBEP/T_MGW_NAME_VALUE_PAIR
!IO_TECH_REQUEST_CONTEXT type ref to /IWBEP/IF_MGW_REQ_ENTITY_C optional
!IT_NAVIGATION_PATH type /IWBEP/T_MGW_NAVIGATION_PATH
!IO_DATA_PROVIDER type ref to /IWBEP/IF_MGW_ENTRY_PROVIDER optional
exporting
!ER_ENTITY type ZCL_ZODATA_PURCHASE_BO_MPC=>TS_ZPURCHASE_REQ_HEAD
raising
/IWBEP/CX_MGW_BUSI_EXCEPTION
/IWBEP/CX_MGW_TECH_EXCEPTION .
methods ZPURCHASE_REQ_HE_DELETE_ENTITY
importing
!IV_ENTITY_NAME type STRING
!IV_ENTITY_SET_NAME type STRING
!IV_SOURCE_NAME type STRING
!IT_KEY_TAB type /IWBEP/T_MGW_NAME_VALUE_PAIR
!IO_TECH_REQUEST_CONTEXT type ref to /IWBEP/IF_MGW_REQ_ENTITY_D optional
!IT_NAVIGATION_PATH type /IWBEP/T_MGW_NAVIGATION_PATH
raising
/IWBEP/CX_MGW_BUSI_EXCEPTION
/IWBEP/CX_MGW_TECH_EXCEPTION .
methods ZPURCHASE_REQ_HE_GET_ENTITY
importing
!IV_ENTITY_NAME type STRING
!IV_ENTITY_SET_NAME type STRING
!IV_SOURCE_NAME type STRING
!IT_KEY_TAB type /IWBEP/T_MGW_NAME_VALUE_PAIR
!IO_REQUEST_OBJECT type ref to /IWBEP/IF_MGW_REQ_ENTITY optional
!IO_TECH_REQUEST_CONTEXT type ref to /IWBEP/IF_MGW_REQ_ENTITY optional
!IT_NAVIGATION_PATH type /IWBEP/T_MGW_NAVIGATION_PATH
exporting
!ER_ENTITY type ZCL_ZODATA_PURCHASE_BO_MPC=>TS_ZPURCHASE_REQ_HEAD
!ES_RESPONSE_CONTEXT type /IWBEP/IF_MGW_APPL_SRV_RUNTIME=>TY_S_MGW_RESPONSE_ENTITY_CNTXT
raising
/IWBEP/CX_MGW_BUSI_EXCEPTION
/IWBEP/CX_MGW_TECH_EXCEPTION .
methods ZPURCHASE_REQ_HE_GET_ENTITYSET
importing
!IV_ENTITY_NAME type STRING
!IV_ENTITY_SET_NAME type STRING
!IV_SOURCE_NAME type STRING
!IT_FILTER_SELECT_OPTIONS type /IWBEP/T_MGW_SELECT_OPTION
!IS_PAGING type /IWBEP/S_MGW_PAGING
!IT_KEY_TAB type /IWBEP/T_MGW_NAME_VALUE_PAIR
!IT_NAVIGATION_PATH type /IWBEP/T_MGW_NAVIGATION_PATH
!IT_ORDER type /IWBEP/T_MGW_SORTING_ORDER
!IV_FILTER_STRING type STRING
!IV_SEARCH_STRING type STRING
!IO_TECH_REQUEST_CONTEXT type ref to /IWBEP/IF_MGW_REQ_ENTITYSET optional
exporting
!ET_ENTITYSET type ZCL_ZODATA_PURCHASE_BO_MPC=>TT_ZPURCHASE_REQ_HEAD
!ES_RESPONSE_CONTEXT type /IWBEP/IF_MGW_APPL_SRV_RUNTIME=>TY_S_MGW_RESPONSE_CONTEXT
raising
/IWBEP/CX_MGW_BUSI_EXCEPTION
/IWBEP/CX_MGW_TECH_EXCEPTION .
methods ZPURCHASE_REQ_HE_UPDATE_ENTITY
importing
!IV_ENTITY_NAME type STRING
!IV_ENTITY_SET_NAME type STRING
!IV_SOURCE_NAME type STRING
!IT_KEY_TAB type /IWBEP/T_MGW_NAME_VALUE_PAIR
!IO_TECH_REQUEST_CONTEXT type ref to /IWBEP/IF_MGW_REQ_ENTITY_U optional
!IT_NAVIGATION_PATH type /IWBEP/T_MGW_NAVIGATION_PATH
!IO_DATA_PROVIDER type ref to /IWBEP/IF_MGW_ENTRY_PROVIDER optional
exporting
!ER_ENTITY type ZCL_ZODATA_PURCHASE_BO_MPC=>TS_ZPURCHASE_REQ_HEAD
raising
/IWBEP/CX_MGW_BUSI_EXCEPTION
/IWBEP/CX_MGW_TECH_EXCEPTION .
methods CHECK_SUBSCRIPTION_AUTHORITY
redefinition . | [
24326,
2665,
13,
628,
220,
1366,
6941,
62,
259,
29192,
2099,
1006,
284,
1220,
40,
45607,
8905,
14,
5064,
62,
16811,
62,
35353,
62,
35,
5662,
62,
1268,
23680,
2849,
764,
628,
220,
5050,
1168,
47,
4261,
3398,
11159,
62,
2200,
48,
62,
13909,
62,
43387,
6158,
62,
3525,
9050,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
28480,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
47690,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
2043,
62,
20373,
62,
5603,
33,
2099,
1220,
40,
45607,
8905,
14,
51,
62,
20474,
54,
62,
20608,
62,
39488,
62,
4537,
4663,
198,
220,
220,
220,
220,
220,
5145,
9399,
62,
51,
25994,
62,
2200,
35780,
62,
10943,
32541,
2099,
1006,
284,
1220,
40,
45607,
8905,
14,
5064,
62,
20474,
54,
62,
2200,
48,
62,
3525,
9050,
62,
34,
11902,
198,
220,
220,
220,
220,
220,
5145,
2043,
62,
4535,
53,
3528,
6234,
62,
34219,
2099,
1220,
40,
45607,
8905,
14,
51,
62,
20474,
54,
62,
4535,
53,
3528,
6234,
62,
34219,
198,
220,
220,
220,
220,
220,
5145,
9399,
62,
26947,
62,
41283,
41237,
2099,
1006,
284,
1220,
40,
45607,
8905,
14,
5064,
62,
20474,
54,
62,
3525,
18276,
62,
41283,
41237,
11902,
198,
220,
220,
220,
39133,
198,
220,
220,
220,
220,
220,
5145,
1137,
62,
3525,
9050,
2099,
1168,
5097,
62,
57,
3727,
13563,
62,
47,
4261,
3398,
11159,
62,
8202,
62,
44,
5662,
14804,
4694,
62,
57,
47,
4261,
3398,
11159,
62,
2200,
48,
62,
37682,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1220,
40,
45607,
8905,
14,
34,
55,
62,
20474,
54,
62,
45346,
40,
62,
6369,
42006,
2849,
198,
220,
220,
220,
220,
220,
1220,
40,
45607,
8905,
14,
34,
55,
62,
20474,
54,
62,
51,
25994,
62,
6369,
42006,
2849,
764,
198,
220,
5050,
1168,
47,
4261,
3398,
11159,
62,
2200,
48,
62,
13909,
62,
7206,
2538,
9328,
62,
3525,
9050,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
28480,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
47690,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
2043,
62,
20373,
62,
5603,
33,
2099,
1220,
40,
45607,
8905,
14,
51,
62,
20474,
54,
62,
20608,
62,
39488,
62,
4537,
4663,
198,
220,
220,
220,
220,
220,
5145,
9399,
62,
51,
25994,
62,
2200,
35780,
62,
10943,
32541,
2099,
1006,
284,
1220,
40,
45607,
8905,
14,
5064,
62,
20474,
54,
62,
2200,
48,
62,
3525,
9050,
62,
35,
11902,
198,
220,
220,
220,
220,
220,
5145,
2043,
62,
4535,
53,
3528,
6234,
62,
34219,
2099,
1220,
40,
45607,
8905,
14,
51,
62,
20474,
54,
62,
4535,
53,
3528,
6234,
62,
34219,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1220,
40,
45607,
8905,
14,
34,
55,
62,
20474,
54,
62,
45346,
40,
62,
6369,
42006,
2849,
198,
220,
220,
220,
220,
220,
1220,
40,
45607,
8905,
14,
34,
55,
62,
20474,
54,
62,
51,
25994,
62,
6369,
42006,
2849,
764,
198,
220,
5050,
1168,
47,
4261,
3398,
11159,
62,
2200,
48,
62,
13909,
62,
18851,
62,
3525,
9050,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
28480,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
47690,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
2043,
62,
20373,
62,
5603,
33,
2099,
1220,
40,
45607,
8905,
14,
51,
62,
20474,
54,
62,
20608,
62,
39488,
62,
4537,
4663,
198,
220,
220,
220,
220,
220,
5145,
9399,
62,
2200,
35780,
62,
9864,
23680,
2099,
1006,
284,
1220,
40,
45607,
8905,
14,
5064,
62,
20474,
54,
62,
2200,
48,
62,
3525,
9050,
11902,
198,
220,
220,
220,
220,
220,
5145,
9399,
62,
51,
25994,
62,
2200,
35780,
62,
10943,
32541,
2099,
1006,
284,
1220,
40,
45607,
8905,
14,
5064,
62,
20474,
54,
62,
2200,
48,
62,
3525,
9050,
11902,
198,
220,
220,
220,
220,
220,
5145,
2043,
62,
4535,
53,
3528,
6234,
62,
34219,
2099,
1220,
40,
45607,
8905,
14,
51,
62,
20474,
54,
62,
4535,
53,
3528,
6234,
62,
34219,
198,
220,
220,
220,
39133,
198,
220,
220,
220,
220,
220,
5145,
1137,
62,
3525,
9050,
2099,
1168,
5097,
62,
57,
3727,
13563,
62,
47,
4261,
3398,
11159,
62,
8202,
62,
44,
5662,
14804,
4694,
62,
57,
47,
4261,
3398,
11159,
62,
2200,
48,
62,
37682,
198,
220,
220,
220,
220,
220,
5145,
1546,
62,
19535,
47,
1340,
5188,
62,
10943,
32541,
2099,
1220,
40,
45607,
8905,
14,
5064,
62,
20474,
54,
62,
2969,
6489,
62,
12562,
53,
62,
49,
4944,
34694,
14804,
9936,
62,
50,
62,
20474,
54,
62,
19535,
47,
1340,
5188,
62,
3525,
9050,
62,
34,
11251,
25010,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1220,
40,
45607,
8905,
14,
34,
55,
62,
20474,
54,
62,
45346,
40,
62,
6369,
42006,
2849,
198,
220,
220,
220,
220,
220,
1220,
40,
45607,
8905,
14,
34,
55,
62,
20474,
54,
62,
51,
25994,
62,
6369,
42006,
2849,
764,
198,
220,
5050,
1168,
47,
4261,
3398,
11159,
62,
2200,
48,
62,
13909,
62,
18851,
62,
3525,
9050,
28480,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
3525,
9050,
62,
28480,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
3824,
62,
47690,
62,
20608,
2099,
19269,
2751,
198,
220,
220,
220,
220,
220,
5145,
2043,
62,
46700,
5781,
62,
46506,
62,
3185,
51,
11053,
2099,
1220,
40,
45607,
8905,
14,
51,
62,
20474,
54,
62,
46506,
62,
3185,
24131,
198,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS /dmo/tc_flight_travel_api28 DEFINITION
PUBLIC
ABSTRACT
CREATE PUBLIC
FOR TESTING
DURATION MEDIUM
RISK LEVEL HARMLESS .
PUBLIC SECTION.
PROTECTED SECTION.
METHODS cuerd_travel FOR TESTING RAISING cx_static_check.
PRIVATE SECTION.
CLASS-DATA gv_agency_id_1 TYPE /dmo/agency_id28.
CLASS-DATA gv_agency_id_2 TYPE /dmo/agency_id28.
CLASS-DATA gv_agency_id_unknown TYPE /dmo/agency_id28.
CLASS-DATA gv_customer_id_1 TYPE /dmo/customer_id28.
CLASS-DATA gv_customer_id_2 TYPE /dmo/customer_id28.
CLASS-DATA gv_customer_id_unknown TYPE /dmo/customer_id28.
CLASS-METHODS class_setup.
ENDCLASS.
CLASS /dmo/tc_flight_travel_api28 IMPLEMENTATION.
METHOD class_setup.
DATA lt_agency_id TYPE SORTED TABLE OF /dmo/agency_id28 WITH UNIQUE KEY table_line.
SELECT DISTINCT agency_id FROM /dmo/agency28 ORDER BY agency_id DESCENDING INTO TABLE @lt_agency_id .
DATA lt_customer_id TYPE SORTED TABLE OF /dmo/customer_id28 WITH UNIQUE KEY table_line.
SELECT DISTINCT customer_id FROM /dmo/customer28 ORDER BY customer_id DESCENDING INTO TABLE @lt_customer_id .
" Select 2 known agency IDs
IF lines( lt_agency_id ) < 2.
cl_abap_unit_assert=>abort( msg = 'No agency data!' ).
ENDIF.
gv_agency_id_1 = lt_agency_id[ 1 ].
gv_agency_id_2 = lt_agency_id[ 2 ].
cl_abap_unit_assert=>assert_differs( act = gv_agency_id_1 exp = gv_agency_id_2 )." To be totally sure
" Select 2 known customer IDs
IF lines( lt_customer_id ) < 2.
cl_abap_unit_assert=>abort( msg = 'No customer data!' ).
ENDIF.
gv_customer_id_1 = lt_customer_id[ 1 ].
gv_customer_id_2 = lt_customer_id[ 2 ].
cl_abap_unit_assert=>assert_differs( act = gv_customer_id_1 exp = gv_customer_id_2 )." To be totally sure
" Determine an unknown agency ID
gv_agency_id_unknown = lt_agency_id[ 1 ].
DO.
gv_agency_id_unknown = gv_agency_id_unknown + 1.
READ TABLE lt_agency_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = gv_agency_id_unknown.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
" Determine an unknown customer ID
gv_customer_id_unknown = lt_customer_id[ 1 ].
DO.
gv_customer_id_unknown = gv_customer_id_unknown + 1.
READ TABLE lt_customer_id TRANSPORTING NO FIELDS WITH TABLE KEY table_line = gv_customer_id_unknown.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
ENDMETHOD.
METHOD cuerd_travel.
DATA ls_travel_in TYPE /dmo/if_flight_legacy28=>ts_travel_in.
DATA ls_travel_inx TYPE /dmo/if_flight_legacy28=>ts_travel_inx.
DATA ls_travel TYPE /dmo/travel28.
DATA lt_messages TYPE /dmo/if_flight_legacy28=>tt_message.
" Create Travel and Commit
ls_travel_in-agency_id = gv_agency_id_1.
ls_travel_in-customer_id = gv_customer_id_1.
ls_travel_in-begin_date = '20180101'.
ls_travel_in-end_date = '20180201'.
ls_travel_in-description = 'My Test'.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_CREATE28'
EXPORTING
is_travel = ls_travel_in
IMPORTING
es_travel = ls_travel
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
DATA(lv_travel_id) = ls_travel-travel_id.
cl_abap_unit_assert=>assert_not_initial( lv_travel_id ).
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_SAVE28'.
" DB Check
SELECT SINGLE agency_id, customer_id, description FROM /dmo/travel28 WHERE travel_id = @lv_travel_id INTO ( @DATA(lv_agency_id), @DATA(lv_customer_id), @DATA(lv_description) ).
cl_abap_unit_assert=>assert_subrc( ).
cl_abap_unit_assert=>assert_equals( act = lv_agency_id exp = gv_agency_id_1 ).
cl_abap_unit_assert=>assert_equals( act = lv_customer_id exp = gv_customer_id_1 ).
cl_abap_unit_assert=>assert_equals( act = lv_description exp = 'My Test' ).
" Update
CLEAR ls_travel_in.
ls_travel_in-travel_id = lv_travel_id.
ls_travel_in-agency_id = gv_agency_id_2.
ls_travel_in-customer_id = gv_customer_id_2.
ls_travel_in-description = 'My New Test'.
ls_travel_inx-travel_id = lv_travel_id.
ls_travel_inx-agency_id = abap_true.
ls_travel_inx-customer_id = abap_true.
ls_travel_inx-description = abap_true.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_UPDATE28'
EXPORTING
is_travel = ls_travel_in
is_travelx = ls_travel_inx
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
" Action
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_SET_BOOK_28'
EXPORTING
iv_travel_id = lv_travel_id
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
" Faulty Update - All or Nothing -> Nothing
CLEAR ls_travel_in.
ls_travel_in-travel_id = lv_travel_id.
ls_travel_in-agency_id = gv_agency_id_unknown.
ls_travel_in-customer_id = gv_customer_id_1.
ls_travel_inx-travel_id = lv_travel_id.
ls_travel_inx-agency_id = abap_true.
ls_travel_inx-customer_id = abap_true.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_UPDATE28'
EXPORTING
is_travel = ls_travel_in
is_travelx = ls_travel_inx
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_not_initial( lt_messages ).
" Faulty Update - All or Nothing -> Nothing
CLEAR lt_messages.
CLEAR ls_travel_in.
ls_travel_in-travel_id = lv_travel_id.
ls_travel_in-agency_id = gv_agency_id_1.
ls_travel_in-customer_id = gv_customer_id_unknown.
ls_travel_inx-travel_id = lv_travel_id.
ls_travel_inx-agency_id = abap_true.
ls_travel_inx-customer_id = abap_true.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_UPDATE28'
EXPORTING
is_travel = ls_travel_in
is_travelx = ls_travel_inx
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_not_initial( lt_messages ).
" Read DB only
CLEAR ls_travel.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_READ28'
EXPORTING
iv_travel_id = lv_travel_id
iv_include_buffer = abap_false
IMPORTING
es_travel = ls_travel
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-travel_id exp = lv_travel_id ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-agency_id exp = gv_agency_id_1 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-customer_id exp = gv_customer_id_1 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-status exp = CONV /dmo/travel_status28( /dmo/if_flight_legacy28=>travel_status-new ) ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-description exp = 'My Test' ).
" Read with buffer
CLEAR ls_travel.
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_READ28'
EXPORTING
iv_travel_id = lv_travel_id
iv_include_buffer = abap_true
IMPORTING
es_travel = ls_travel
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-travel_id exp = lv_travel_id ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-agency_id exp = gv_agency_id_2 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-customer_id exp = gv_customer_id_2 ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-status exp = CONV /dmo/travel_status28( /dmo/if_flight_legacy28=>travel_status-booked ) ).
cl_abap_unit_assert=>assert_equals( act = ls_travel-description exp = 'My New Test' ).
" Delete
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_DELETE28'
EXPORTING
iv_travel_id = lv_travel_id
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_initial( lt_messages ).
" Delete again -> Error
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_DELETE28'
EXPORTING
iv_travel_id = lv_travel_id
IMPORTING
et_messages = lt_messages.
cl_abap_unit_assert=>assert_not_initial( lt_messages ).
CALL FUNCTION '/DMO/FLIGHT_TRAVEL_SAVE28'.
ENDMETHOD.
ENDCLASS.
| [
31631,
1220,
67,
5908,
14,
23047,
62,
22560,
62,
35927,
62,
15042,
2078,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
9564,
18601,
10659,
198,
220,
29244,
6158,
44731,
198,
220,
7473,
43001,
2751,
198,
220,
360,
4261,
6234,
26112,
41796,
198,
220,
45698,
42,
49277,
43638,
5805,
7597,
764,
628,
220,
44731,
44513,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
269,
15573,
67,
62,
35927,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42715,
12,
26947,
308,
85,
62,
40955,
62,
312,
62,
16,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1220,
67,
5908,
14,
40955,
62,
312,
2078,
13,
198,
220,
220,
220,
42715,
12,
26947,
308,
85,
62,
40955,
62,
312,
62,
17,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1220,
67,
5908,
14,
40955,
62,
312,
2078,
13,
198,
220,
220,
220,
42715,
12,
26947,
308,
85,
62,
40955,
62,
312,
62,
34680,
220,
220,
41876,
1220,
67,
5908,
14,
40955,
62,
312,
2078,
13,
628,
220,
220,
220,
42715,
12,
26947,
308,
85,
62,
23144,
263,
62,
312,
62,
16,
220,
220,
220,
220,
220,
220,
41876,
1220,
67,
5908,
14,
23144,
263,
62,
312,
2078,
13,
198,
220,
220,
220,
42715,
12,
26947,
308,
85,
62,
23144,
263,
62,
312,
62,
17,
220,
220,
220,
220,
220,
220,
41876,
1220,
67,
5908,
14,
23144,
263,
62,
312,
2078,
13,
198,
220,
220,
220,
42715,
12,
26947,
308,
85,
62,
23144,
263,
62,
312,
62,
34680,
41876,
1220,
67,
5908,
14,
23144,
263,
62,
312,
2078,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
1398,
62,
40406,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1220,
67,
5908,
14,
23047,
62,
22560,
62,
35927,
62,
15042,
2078,
30023,
2538,
10979,
6234,
13,
198,
220,
337,
36252,
1398,
62,
40406,
13,
198,
220,
220,
220,
42865,
300,
83,
62,
40955,
62,
312,
41876,
311,
9863,
1961,
43679,
3963,
1220,
67,
5908,
14,
40955,
62,
312,
2078,
220,
220,
220,
220,
13315,
4725,
33866,
8924,
35374,
3084,
62,
1370,
13,
198,
220,
220,
220,
33493,
360,
8808,
1268,
4177,
4086,
62,
312,
16034,
1220,
67,
5908,
14,
40955,
2078,
220,
220,
220,
220,
38678,
11050,
4086,
62,
312,
220,
220,
22196,
34,
10619,
2751,
39319,
43679,
2488,
2528,
62,
40955,
62,
312,
764,
628,
220,
220,
220,
42865,
300,
83,
62,
23144,
263,
62,
312,
41876,
311,
9863,
1961,
43679,
3963,
1220,
67,
5908,
14,
23144,
263,
62,
312,
2078,
13315,
4725,
33866,
8924,
35374,
3084,
62,
1370,
13,
198,
220,
220,
220,
33493,
360,
8808,
1268,
4177,
6491,
62,
312,
16034,
1220,
67,
5908,
14,
23144,
263,
2078,
38678,
11050,
6491,
62,
312,
22196,
34,
10619,
2751,
39319,
43679,
2488,
2528,
62,
23144,
263,
62,
312,
764,
628,
220,
220,
220,
366,
9683,
362,
1900,
4086,
32373,
198,
220,
220,
220,
16876,
3951,
7,
300,
83,
62,
40955,
62,
312,
1267,
1279,
362,
13,
198,
220,
220,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
397,
419,
7,
31456,
796,
705,
2949,
4086,
1366,
13679,
220,
220,
6739,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
308,
85,
62,
40955,
62,
312,
62,
16,
796,
300,
83,
62,
40955,
62,
312,
58,
352,
20740,
198,
220,
220,
220,
308,
85,
62,
40955,
62,
312,
62,
17,
796,
300,
83,
62,
40955,
62,
312,
58,
362,
20740,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
26069,
364,
7,
719,
796,
308,
85,
62,
40955,
62,
312,
62,
16,
220,
1033,
796,
308,
85,
62,
40955,
62,
312,
62,
17,
1267,
526,
1675,
307,
6635,
1654,
628,
220,
220,
220,
366,
9683,
362,
1900,
6491,
32373,
198,
220,
220,
220,
16876,
3951,
7,
300,
83,
62,
23144,
263,
62,
312,
1267,
1279,
362,
13,
198,
220,
220,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
397,
419,
7,
31456,
796,
705,
2949,
6491,
1366,
13679,
6739,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
308,
85,
62,
23144,
263,
62,
312,
62,
16,
796,
300,
83,
62,
23144,
263,
62,
312,
58,
352,
20740,
198,
220,
220,
220,
308,
85,
62,
23144,
263,
62,
312,
62,
17,
796,
300,
83,
62,
23144,
263,
62,
312,
58,
362,
20740,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
26069,
364,
7,
719,
796,
308,
85,
62,
23144,
263,
62,
312,
62,
16,
220,
1033,
796,
308,
85,
62,
23144,
263,
62,
312,
62,
17,
1267,
526,
1675,
307,
6635,
1654,
628,
220,
220,
220,
366,
45559,
3810,
281,
6439,
4086,
4522,
198,
220,
220,
220,
308,
85,
62,
40955,
62,
312,
62,
34680,
796,
300,
83,
62,
40955,
62,
312,
58,
352,
20740,
198,
220,
220,
220,
8410,
13,
198,
220,
220,
220,
220,
220,
308,
85,
62,
40955,
62,
312,
62,
34680,
796,
308,
85,
62,
40955,
62,
312,
62,
34680,
1343,
352,
13,
198,
220,
220,
220,
220,
220,
20832,
43679,
300,
83,
62,
40955,
62,
312,
220,
220,
48213,
4303,
9863,
2751,
8005,
18930,
3698,
5258,
13315,
43679,
35374,
3084,
62,
1370,
796,
308,
85,
62,
40955,
62,
312,
62,
34680,
13,
198,
220,
220,
220,
220,
220,
16876,
827,
12,
7266,
6015,
1279,
29,
657,
13,
198,
220,
220,
220,
220,
220,
220,
220,
7788,
2043,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
23578,
18227,
13,
628,
220,
220,
220,
366,
45559,
3810,
281,
6439,
6491,
4522,
198,
220,
220,
220,
308,
85,
62,
23144,
263,
62,
312,
62,
34680,
796,
300,
83,
62,
23144,
263,
62,
312,
58,
352,
20740,
198,
220,
220,
220,
8410,
13,
198,
220,
220,
220,
220,
220,
308,
85,
62,
23144,
263,
62,
312,
62,
34680,
796,
308,
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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& Report ZOO_TUTORIAL_PROG_2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zoo_tutorial_prog_6a.
START-OF-SELECTION.
DATA l_price TYPE zif_oo_tutorial_6=>t_cost.
DATA l_sflight TYPE sflight.
TYPES tr_flight TYPE REF TO zif_oo_tutorial_6. "zcl_oo_tutorial_6_base. "zif_oo_tutorial_6. "zcl_oo_tutorial_6_base.
DATA lt_flight TYPE STANDARD TABLE OF tr_flight.
DATA wa_flight LIKE LINE OF lt_flight.
FIELD-SYMBOLS <wa_flight> LIKE LINE OF lt_flight.
DATA lr_exception TYPE REF TO zcx_oo_tutorial_5.
DATA it_source TYPE STANDARD TABLE OF sflight.
FIELD-SYMBOLS <wa_source> LIKE LINE OF it_source.
SELECT * FROM sflight INTO TABLE it_source.
LOOP AT it_source ASSIGNING <wa_source>.
TRY.
CLEAR wa_flight.
* create object wa_flight.
wa_flight = zcl_oo_tutorial_6_base=>get_flight_object(
i_carrid = <wa_source>-carrid
i_connid = <wa_source>-connid
i_fldate = <wa_source>-fldate ).
APPEND wa_flight TO lt_flight.
CATCH zcx_oo_tutorial_5 INTO lr_exception.
WRITE: / 'Invalid Input for', lr_exception->carrid.
ENDTRY.
ENDLOOP.
DATA lr_747 TYPE REF TO zcl_oo_tutorial_6_747.
DATA i_movies TYPE zcl_oo_tutorial_6_747=>tt_movies.
FIELD-SYMBOLS <wa_movie> LIKE LINE OF i_movies.
LOOP AT lt_flight ASSIGNING <wa_flight>.
l_sflight = <wa_flight>->get_flight_details( ).
WRITE: / l_sflight-carrid, l_sflight-connid, l_sflight-fldate, l_sflight-planetype.
l_price = <wa_flight>->calculate_flight_price( ).
WRITE: / 'Flight Price: ', l_price-price CURRENCY l_price-currency, l_price-currency.
* <wa_flight>->get_flight_object( ).
IF l_sflight-planetype CS zcl_oo_tutorial_6_base=>e_planetype-b747.
lr_747 ?= <wa_flight>.
* <wa_flight>->get_inflight_movies( IMPORTING e_movies = i_movies ).
lr_747->get_inflight_movies( IMPORTING e_movies = i_movies ).
WRITE: / 'Movies:'.
LOOP AT i_movies ASSIGNING <wa_movie>.
WRITE: / <wa_movie>-movie_title, <wa_movie>-running_time.
ENDLOOP.
ENDIF.
SKIP.
ENDLOOP.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
6358,
220,
1168,
6684,
62,
51,
3843,
1581,
12576,
62,
4805,
7730,
62,
17,
198,
9,
5,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
198,
9,
5,
198,
9,
5,
10097,
30934,
9,
198,
198,
2200,
15490,
220,
26626,
62,
83,
44917,
62,
1676,
70,
62,
21,
64,
13,
628,
198,
2257,
7227,
12,
19238,
12,
46506,
2849,
13,
628,
220,
42865,
300,
62,
20888,
41876,
1976,
361,
62,
2238,
62,
83,
44917,
62,
21,
14804,
83,
62,
15805,
13,
198,
220,
42865,
300,
62,
82,
22560,
41876,
264,
22560,
13,
198,
220,
24412,
47,
1546,
491,
62,
22560,
41876,
4526,
37,
5390,
1976,
361,
62,
2238,
62,
83,
44917,
62,
21,
13,
366,
89,
565,
62,
2238,
62,
83,
44917,
62,
21,
62,
8692,
13,
366,
89,
361,
62,
2238,
62,
83,
44917,
62,
21,
13,
366,
89,
565,
62,
2238,
62,
83,
44917,
62,
21,
62,
8692,
13,
198,
220,
42865,
300,
83,
62,
22560,
41876,
49053,
9795,
43679,
3963,
491,
62,
22560,
13,
198,
220,
42865,
2082,
62,
22560,
34178,
48920,
3963,
300,
83,
62,
22560,
13,
198,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
1279,
10247,
62,
22560,
29,
34178,
48920,
3963,
300,
83,
62,
22560,
13,
198,
220,
42865,
300,
81,
62,
1069,
4516,
41876,
4526,
37,
5390,
1976,
66,
87,
62,
2238,
62,
83,
44917,
62,
20,
13,
628,
220,
42865,
340,
62,
10459,
41876,
49053,
9795,
43679,
3963,
264,
22560,
13,
198,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
1279,
10247,
62,
10459,
29,
34178,
48920,
3963,
340,
62,
10459,
13,
628,
220,
33493,
1635,
16034,
264,
22560,
39319,
43679,
340,
62,
10459,
13,
198,
220,
17579,
3185,
5161,
340,
62,
10459,
24994,
3528,
15871,
1279,
10247,
62,
10459,
28401,
198,
220,
220,
220,
7579,
56,
13,
198,
220,
220,
220,
220,
220,
220,
220,
30301,
1503,
2082,
62,
22560,
13,
198,
9,
220,
220,
220,
220,
220,
220,
220,
2251,
2134,
2082,
62,
22560,
13,
198,
220,
220,
220,
220,
220,
220,
220,
2082,
62,
22560,
796,
220,
1976,
565,
62,
2238,
62,
83,
44917,
62,
21,
62,
8692,
14804,
1136,
62,
22560,
62,
15252,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
66,
3258,
312,
796,
1279,
10247,
62,
10459,
29,
12,
66,
3258,
312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
37043,
312,
796,
1279,
10247,
62,
10459,
29,
12,
37043,
312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
69,
335,
378,
796,
1279,
10247,
62,
10459,
29,
12,
69,
335,
378,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
43504,
10619,
2082,
62,
22560,
5390,
300,
83,
62,
22560,
13,
198,
220,
220,
220,
220,
220,
327,
11417,
1976,
66,
87,
62,
2238,
62,
83,
44917,
62,
20,
39319,
300,
81,
62,
1069,
4516,
13,
198,
220,
220,
220,
220,
220,
220,
220,
44423,
25,
1220,
705,
44651,
23412,
329,
3256,
300,
81,
62,
1069,
4516,
3784,
66,
3258,
312,
13,
198,
220,
220,
220,
23578,
40405,
13,
198,
220,
23578,
21982,
3185,
13,
628,
198,
220,
42865,
300,
81,
62,
48882,
41876,
4526,
37,
5390,
1976,
565,
62,
2238,
62,
83,
44917,
62,
21,
62,
48882,
13,
198,
220,
42865,
1312,
62,
76,
20526,
41876,
1976,
565,
62,
2238,
62,
83,
44917,
62,
21,
62,
48882,
14804,
926,
62,
76,
20526,
13,
198,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
1279,
10247,
62,
41364,
29,
34178,
48920,
3963,
1312,
62,
76,
20526,
13,
198,
220,
17579,
3185,
5161,
300,
83,
62,
22560,
24994,
3528,
15871,
1279,
10247,
62,
22560,
28401,
198,
220,
220,
220,
300,
62,
82,
22560,
796,
1279,
10247,
62,
22560,
29,
3784,
1136,
62,
22560,
62,
36604,
7,
6739,
198,
220,
220,
220,
44423,
25,
1220,
300,
62,
82,
22560,
12,
66,
3258,
312,
11,
300,
62,
82,
22560,
12,
37043,
312,
11,
300,
62,
82,
22560,
12,
69,
335,
378,
11,
300,
62,
82,
22560,
12,
11578,
2963,
431,
13,
198,
220,
220,
220,
300,
62,
20888,
796,
1279,
10247,
62,
22560,
29,
3784,
9948,
3129,
378,
62,
22560,
62,
20888,
7,
6739,
198,
220,
220,
220,
44423,
25,
1220,
705,
43069,
7886,
25,
46083,
300,
62,
20888,
12,
20888,
327,
31302,
45155,
300,
62,
20888,
12,
34415,
11,
300,
62,
20888,
12,
34415,
13,
198,
9,
220,
220,
1279,
10247,
62,
22560,
29,
3784,
1136,
62,
22560,
62,
15252,
7,
6739,
628,
220,
220,
220,
16876,
300,
62,
82,
22560,
12,
11578,
2963,
431,
9429,
1976,
565,
62,
2238,
62,
83,
44917,
62,
21,
62,
8692,
14804,
68,
62,
11578,
2963,
431,
12,
65,
48882,
13,
198,
220,
220,
220,
220,
220,
300,
81,
62,
48882,
5633,
28,
1279,
10247,
62,
22560,
28401,
198,
9,
220,
220,
220,
1279,
10247,
62,
22560,
29,
3784,
1136,
62,
259,
22560,
62,
76,
20526,
7,
30023,
9863,
2751,
304,
62,
76,
20526,
796,
1312,
62,
76,
20526,
6739,
198,
220,
220,
220,
220,
220,
300,
81,
62,
48882,
3784,
1136,
62,
259,
22560,
62,
76,
20526,
7,
30023,
9863,
2751,
304,
62,
76,
20526,
796,
1312,
62,
76,
20526,
6739,
198,
220,
220,
220,
220,
220,
44423,
25,
1220,
705,
44,
20526,
25,
4458,
198,
220,
220,
220,
220,
220,
17579,
3185,
5161,
1312,
62,
76,
20526,
24994,
3528,
15871,
1279,
10247,
62,
41364,
28401,
198,
220,
220,
220,
220,
220,
220,
220,
44423,
25,
1220,
1279,
10247,
62,
41364,
29,
12,
41364,
62,
7839,
11,
1279,
10247,
62,
41364,
29,
12,
20270,
62,
2435,
13,
198,
220,
220,
220,
220,
220,
23578,
21982,
3185,
13,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
14277,
4061,
13,
198,
220,
23578,
21982,
3185,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
FORM add_dynamic_data.
TYPES: BEGIN OF lst_ausp,
matnr TYPE mara-matnr,
atinn TYPE ausp-atinn,
atwrt TYPE ausp-atwrt,
END OF lst_ausp.
DATA: lv_objek TYPE c LENGTH 18,
lv_max TYPE i,
lt_ausp TYPE TABLE OF lst_ausp,
lr_itab TYPE REF TO data,
lv_count TYPE n LENGTH 2,
lt_ausp_sorted TYPE SORTED TABLE OF lst_ausp WITH NON-UNIQUE KEY matnr.
LOOP AT gt_itab.
SELECT SINGLE cuobj FROM inob
WHERE klart = '026'
AND objek = @gt_itab-matnr
INTO @DATA(lv_cuobj).
IF sy-subrc = 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_cuobj
IMPORTING
output = lv_objek.
SELECT @gt_itab-matnr, atinn, atwrt FROM ausp
WHERE objek = @lv_objek
AND klart = '026'
APPENDING TABLE @lt_ausp.
IF sy-subrc = 0.
IF sy-dbcnt > lv_max.
lv_max = sy-dbcnt.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
DATA(lt_comp) = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_data( gt_itab ) )->get_components( ).
DATA(lt_fcat) = gt_fieldcat[].
SORT lt_fcat BY col_pos DESCENDING.
READ TABLE lt_fcat INTO DATA(ls_fcat) INDEX 1.
FREE lt_fcat.
DO lv_max TIMES.
lv_count = sy-index.
APPEND INITIAL LINE TO lt_comp ASSIGNING FIELD-SYMBOL(<ls_comp>).
<ls_comp>-name = 'ATINN' && lv_count.
<ls_comp>-type ?= cl_abap_elemdescr=>describe_by_name( 'ATINN' ).
APPEND INITIAL LINE TO gt_fieldcat ASSIGNING FIELD-SYMBOL(<ls_fcat>).
<ls_fcat>-fieldname = <ls_comp>-name.
<ls_fcat>-tabname = ls_fcat-tabname.
ADD 1 TO ls_fcat-col_pos.
<ls_fcat>-col_pos = ls_fcat-col_pos.
<ls_fcat>-no_out = abap_true.
<ls_fcat>-seltext_m = <ls_fcat>-seltext_l = <ls_fcat>-reptext_ddic = |{ TEXT-c01 } { lv_count }|.
<ls_fcat>-seltext_s = |{ TEXT-c02 } { lv_count }|.
<ls_fcat>-rollname = 'ATINN'.
<ls_fcat>-ref_tabname = 'AUSP'.
<ls_fcat>-ref_fieldname = 'ATINN'.
<ls_fcat>-no_out = abap_true.
APPEND INITIAL LINE TO lt_comp ASSIGNING <ls_comp>.
<ls_comp>-name = 'ATBEZ' && lv_count.
<ls_comp>-type ?= cl_abap_elemdescr=>describe_by_name( 'ATBEZ' ).
APPEND INITIAL LINE TO gt_fieldcat ASSIGNING <ls_fcat>.
<ls_fcat>-fieldname = <ls_comp>-name.
<ls_fcat>-tabname = ls_fcat-tabname.
ADD 1 TO ls_fcat-col_pos.
<ls_fcat>-col_pos = ls_fcat-col_pos.
<ls_fcat>-seltext_m = <ls_fcat>-seltext_l = <ls_fcat>-reptext_ddic = |{ TEXT-c03 } { lv_count }|.
<ls_fcat>-seltext_s = |{ TEXT-c04 } { lv_count }|.
<ls_fcat>-rollname = 'ATBEZ'.
<ls_fcat>-ref_tabname = 'CABNT'.
<ls_fcat>-ref_fieldname = 'ATBEZ'.
APPEND INITIAL LINE TO lt_comp ASSIGNING <ls_comp>.
<ls_comp>-name = 'ATWRT' && lv_count.
<ls_comp>-type ?= cl_abap_elemdescr=>describe_by_name( 'ATWRT' ).
APPEND INITIAL LINE TO gt_fieldcat ASSIGNING <ls_fcat>.
<ls_fcat>-tabname = ls_fcat-tabname.
<ls_fcat>-fieldname = <ls_comp>-name.
ADD 1 TO ls_fcat-col_pos.
<ls_fcat>-col_pos = ls_fcat-col_pos.
<ls_fcat>-seltext_m = <ls_fcat>-seltext_l = <ls_fcat>-reptext_ddic = |{ TEXT-c05 } { lv_count }|.
<ls_fcat>-seltext_s = |{ TEXT-c06 } { lv_count }|.
<ls_fcat>-rollname = 'ATWRT'.
<ls_fcat>-ref_tabname = 'AUSP'.
<ls_fcat>-ref_fieldname = 'ATWRT'.
ENDDO.
DATA(lo_tabledescr) = cl_abap_tabledescr=>create( cl_abap_structdescr=>create( lt_comp ) ).
CREATE DATA lr_itab TYPE HANDLE lo_tabledescr.
ASSIGN lr_itab->* TO <gt_itab>.
SORT lt_ausp BY matnr atinn.
lt_ausp_sorted = lt_ausp.
SORT lt_ausp BY atinn.
DELETE ADJACENT DUPLICATES FROM lt_ausp COMPARING atinn.
IF lt_ausp IS NOT INITIAL.
SELECT atinn, atbez FROM cabnt
FOR ALL ENTRIES IN @lt_ausp
WHERE atinn = @lt_ausp-atinn
AND spras = @p_spras
AND adzhl = @space
INTO TABLE @DATA(lt_cabnt).
SORT lt_cabnt BY atinn.
ENDIF.
FREE lt_ausp.
LOOP AT gt_itab.
APPEND INITIAL LINE TO <gt_itab> ASSIGNING FIELD-SYMBOL(<ls_itab>).
MOVE-CORRESPONDING gt_itab TO <ls_itab>.
lv_count = '00'.
LOOP AT lt_ausp_sorted ASSIGNING FIELD-SYMBOL(<ls_ausp>) WHERE matnr = gt_itab-matnr.
ADD 1 TO lv_count.
ASSIGN COMPONENT |ATINN{ lv_count }| OF STRUCTURE <ls_itab> TO FIELD-SYMBOL(<lv_field>).
<lv_field> = <ls_ausp>-atinn.
ASSIGN COMPONENT |ATWRT{ lv_count }| OF STRUCTURE <ls_itab> TO <lv_field>.
<lv_field> = <ls_ausp>-atwrt.
READ TABLE lt_cabnt ASSIGNING FIELD-SYMBOL(<ls_cabnt>) WITH KEY atinn = <ls_ausp>-atinn BINARY SEARCH.
IF sy-subrc = 0.
ASSIGN COMPONENT |ATBEZ{ lv_count }| OF STRUCTURE <ls_itab> TO <lv_field>.
<lv_field> = <ls_cabnt>-atbez.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM. | [
21389,
751,
62,
67,
28995,
62,
7890,
13,
628,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
300,
301,
62,
8717,
79,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2603,
48624,
41876,
1667,
64,
12,
6759,
48624,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
379,
3732,
41876,
45062,
12,
265,
3732,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
379,
86,
17034,
41876,
45062,
12,
265,
86,
17034,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
300,
301,
62,
8717,
79,
13,
628,
220,
42865,
25,
300,
85,
62,
26801,
988,
220,
220,
220,
220,
220,
220,
41876,
269,
406,
49494,
1248,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
9806,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
8717,
79,
220,
220,
220,
220,
220,
220,
220,
41876,
43679,
3963,
300,
301,
62,
8717,
79,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
81,
62,
270,
397,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1366,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
9127,
220,
220,
220,
220,
220,
220,
41876,
299,
406,
49494,
362,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
8717,
79,
62,
82,
9741,
41876,
311,
9863,
1961,
43679,
3963,
300,
301,
62,
8717,
79,
13315,
44521,
12,
4944,
33866,
8924,
35374,
2603,
48624,
13,
628,
220,
17579,
3185,
5161,
308,
83,
62,
270,
397,
13,
198,
220,
220,
220,
33493,
311,
2751,
2538,
18912,
26801,
16034,
220,
287,
672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33411,
220,
479,
75,
433,
220,
796,
705,
45987,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
220,
220,
220,
26181,
988,
220,
796,
2488,
13655,
62,
270,
397,
12,
6759,
48624,
198,
220,
220,
220,
220,
220,
220,
39319,
2488,
26947,
7,
6780,
62,
27399,
26801,
737,
198,
220,
220,
220,
16876,
827,
12,
7266,
6015,
796,
657,
13,
198,
220,
220,
220,
220,
220,
42815,
29397,
4177,
2849,
705,
10943,
43717,
62,
6369,
2043,
62,
1847,
47,
7801,
62,
1268,
30076,
6,
198,
220,
220,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5128,
220,
796,
300,
85,
62,
27399,
26801,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5072,
796,
300,
85,
62,
26801,
988,
13,
198,
220,
220,
220,
220,
220,
33493,
2488,
13655,
62,
270,
397,
12,
6759,
48624,
11,
379,
3732,
11,
379,
86,
17034,
16034,
220,
45062,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33411,
220,
26181,
988,
220,
796,
2488,
6780,
62,
26801,
988,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
220,
220,
220,
479,
75,
433,
220,
796,
705,
45987,
6,
198,
220,
220,
220,
220,
220,
220,
220,
43504,
10619,
2751,
43679,
2488,
2528,
62,
8717,
79,
13,
198,
220,
220,
220,
220,
220,
16876,
827,
12,
7266,
6015,
796,
657,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16876,
827,
12,
9945,
66,
429,
1875,
300,
85,
62,
9806,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
9806,
796,
827,
12,
9945,
66,
429,
13,
198,
220,
220,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
23578,
21982,
3185,
13,
628,
220,
42865,
7,
2528,
62,
5589,
8,
796,
327,
11262,
537,
62,
397,
499,
62,
7249,
20147,
81,
7,
537,
62,
397,
499,
62,
7249,
20147,
81,
14804,
20147,
4892,
62,
1525,
62,
7890,
7,
308,
83,
62,
270,
397,
1267,
1267,
3784,
1136,
62,
5589,
3906,
7,
6739,
628,
220,
42865,
7,
2528,
62,
69,
9246,
8,
796,
308,
83,
62,
3245,
9246,
58,
4083,
198,
220,
311,
9863,
300,
83,
62,
69,
9246,
11050,
951,
62,
1930,
22196,
34,
10619,
2751,
13,
198,
220,
20832,
43679,
300,
83,
62,
69,
9246,
39319,
42865,
7,
7278,
62,
69,
9246,
8,
24413,
6369,
352,
13,
198,
220,
17189,
300,
83,
62,
69,
9246,
13,
628,
220,
8410,
300,
85,
62,
9806,
31742,
1546,
13,
198,
220,
220,
220,
300,
85,
62,
9127,
796,
827,
12,
9630,
13,
198,
220,
220,
220,
43504,
10619,
3268,
2043,
12576,
48920,
5390,
300,
83,
62,
5589,
24994,
3528,
15871,
18930,
24639,
12,
23060,
10744,
3535,
7,
27,
7278,
62,
5589,
29,
737,
198,
220,
220,
220,
1279,
7278,
62,
5589,
29,
12,
3672,
796,
705,
1404,
1268,
45,
6,
11405,
300,
85,
62,
9127,
13,
198,
220,
220,
220,
1279,
7278,
62,
5589,
29,
12,
4906,
5633,
28,
537,
62,
397,
499,
62,
11129,
9132,
3798,
81,
14804,
20147,
4892,
62,
1525,
62,
3672,
7,
705,
1404,
1268,
45,
6,
6739,
198,
220,
220,
220,
43504,
10619,
3268,
2043,
12576,
48920,
5390,
308,
83,
62,
3245,
9246,
24994,
3528,
15871,
18930,
24639,
12,
23060,
10744,
3535,
7,
27,
7278,
62,
69,
9246,
29,
737,
198,
220,
220,
220,
1279,
7278,
62,
69,
9246,
29,
12,
3245,
3672,
796,
1279,
7278,
62,
5589,
29,
12,
3672,
13,
198,
220,
220,
220,
1279,
7278,
62,
69,
9246,
29,
12,
8658,
3672,
220,
220,
796,
43979,
62,
69,
9246,
12,
8658,
3672,
13,
198,
220,
220,
220,
27841,
352,
5390,
43979,
62,
69,
9246,
12,
4033,
62,
1930,
13,
198,
220,
220,
220,
1279,
7278,
62,
69,
9246,
29,
12,
4033,
62,
1930,
796,
43979,
62,
69,
9246,
12,
4033,
62,
1930,
13,
198,
220,
220,
220,
1279,
7278,
62,
69,
9246,
29,
12,
3919,
62,
448,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
1279,
7278,
62,
69,
9246,
29,
12,
741,
5239,
62,
76,
796,
1279,
7278,
62,
69,
9246,
29,
12,
741,
5239,
62,
75,
796,
1279,
7278,
62,
69,
9246,
29
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_adf_service_graph DEFINITION
PUBLIC
INHERITING FROM zcl_adf_service
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_adf_service_graph.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ADF_SERVICE_GRAPH IMPLEMENTATION.
METHOD zif_adf_service_graph~create_calendar_event.
DATA: lo_response TYPE REF TO if_rest_entity,
lo_request TYPE REF TO if_rest_entity,
lv_expiry TYPE string,
lv_sas_token TYPE string,
lv_msg TYPE string,
lv_path_prefix TYPE string,
lcx_adf_service TYPE REF TO zcx_adf_service,
lv_host TYPE rfcdisplay-rfchost,
lv_host_s TYPE string,
lv_http_events TYPE i,
lv_result_calendar_event TYPE zif_adf_service_graph~calendar_event,
lv_body_xstring TYPE xstring.
IF go_rest_api IS BOUND.
DATA(lv_calendar_event) = iv_calendar_event.
" Get id for user
lv_path_prefix = |/users/{ iv_calendar_event-organizer-emailaddress-address }/calendar/events|.
go_rest_api->zif_rest_framework~set_uri( lv_path_prefix ).
lv_host_s = gv_host.
**Add header attributes in REST call.
add_request_header( iv_name = 'Content-Type' iv_value = 'application/json; charset=utf-8' ).
add_request_header( iv_name = 'Host' iv_value = lv_host_s ).
add_request_header( iv_name = 'Authorization' iv_value = |Bearer | && iv_aad_token ).
DATA(lv_body_json) = /ui2/cl_json=>serialize( data = iv_calendar_event compress = abap_true pretty_name = /ui2/cl_json=>pretty_mode-camel_case ).
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lv_body_json
IMPORTING
buffer = lv_body_xstring.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
go_rest_api->zif_rest_framework~set_binary_body( lv_body_xstring ).
**Rest API call to get response from Azure Destination
lo_response = go_rest_api->zif_rest_framework~execute(
io_entity = lo_request
async = gv_asynchronous
is_retry = gv_is_try
).
ev_http_status = go_rest_api->get_status( ).
IF lo_response IS BOUND.
DATA(lo_response_string) = lo_response->get_string_data( ).
/ui2/cl_json=>deserialize(
EXPORTING
json = lo_response_string " Data to serialize
pretty_name = abap_true " Pretty Print property names
CHANGING
data = lv_result_calendar_event
).
response = lv_result_calendar_event.
ELSE.
RAISE EXCEPTION TYPE zcx_adf_service
EXPORTING
textid = zcx_adf_service=>restapi_response_not_found
interface_id = gv_interface_id.
ENDIF.
IF ev_http_status <> 201. " Created
DATA(lt_errors) = json_to_http_fields( iv_response_data = lo_response_string ).
READ TABLE lt_errors ASSIGNING FIELD-SYMBOL(<fs_error>) INDEX 1.
RAISE EXCEPTION TYPE zcx_adf_service_graph
EXPORTING
textid = zcx_adf_service_graph=>general_exception
error_response = <fs_error>-value.
ENDIF.
go_rest_api->close( ).
ENDIF.
ENDMETHOD.
METHOD zif_adf_service_graph~get_events.
TYPES: BEGIN OF response,
value TYPE zif_adf_service_graph~calendar_events,
END OF response.
DATA: lo_response TYPE REF TO if_rest_entity,
lo_request TYPE REF TO if_rest_entity,
lv_path_prefix TYPE string,
lv_host_s TYPE string,
lt_calendar_events TYPE zif_adf_service_graph~calendar_events,
lt_response TYPE response.
IF go_rest_api IS BOUND.
lv_path_prefix = |/users/{ iv_userprincipaltoken }/calendar/events|.
IF NOT lv_path_prefix IS INITIAL.
go_rest_api->zif_rest_framework~set_uri( lv_path_prefix ).
ENDIF.
lv_host_s = gv_host.
**Add header attributes in REST call.
add_request_header( iv_name = 'Content-Type' iv_value = 'application/json; charset=utf-8' ).
add_request_header( iv_name = 'Host' iv_value = lv_host_s ).
add_request_header( iv_name = 'Authorization' iv_value = |Bearer | && iv_aad_token ).
**Rest API call to get response from Azure Destination
lo_response = go_rest_api->zif_rest_framework~execute(
io_entity = lo_request
async = gv_asynchronous
is_retry = gv_is_try
).
ev_http_status = go_rest_api->get_status( ).
IF lo_response IS BOUND.
DATA(response) = lo_response->get_string_data( ).
/ui2/cl_json=>deserialize(
EXPORTING
json = response " Data to serialize
" pretty_name = abap_true " Pretty Print property names
CHANGING
data = lt_response
).
rt_calendar_events = lt_response-value.
ELSE.
RAISE EXCEPTION TYPE zcx_adf_service
EXPORTING
textid = zcx_adf_service=>restapi_response_not_found
interface_id = gv_interface_id.
ENDIF.
go_rest_api->close( ).
ENDIF.
ENDMETHOD.
METHOD zif_adf_service_graph~get_users.
TYPES: BEGIN OF response,
value TYPE zif_adf_service_graph~users,
END OF response.
DATA: lo_response TYPE REF TO if_rest_entity,
lo_request TYPE REF TO if_rest_entity,
lv_path_prefix TYPE string,
lv_host_s TYPE string,
ls_response TYPE response.
IF go_rest_api IS BOUND.
lv_path_prefix = '/users'.
IF NOT lv_path_prefix IS INITIAL.
go_rest_api->zif_rest_framework~set_uri( lv_path_prefix ).
ENDIF.
lv_host_s = gv_host.
**Add header attributes in REST call.
add_request_header( iv_name = 'Content-Type' iv_value = 'application/json; charset=utf-8' ).
add_request_header( iv_name = 'Host' iv_value = lv_host_s ).
add_request_header( iv_name = 'Authorization' iv_value = |Bearer | && iv_aad_token ).
**Rest API call to get response from Azure Destination
lo_response = go_rest_api->zif_rest_framework~execute(
io_entity = lo_request
async = gv_asynchronous
is_retry = gv_is_try
).
ev_http_status = go_rest_api->get_status( ).
IF lo_response IS BOUND.
DATA(response) = lo_response->get_string_data( ).
IF ev_http_status = 400.
RAISE EXCEPTION TYPE zcx_adf_service_graph
EXPORTING
textid = zcx_adf_service_graph=>general_exception
error_response = response.
ELSE.
/ui2/cl_json=>deserialize(
EXPORTING
json = response " Data to serialize
" pretty_name = abap_true " Pretty Print property names
CHANGING
data = ls_response
).
rt_users = ls_response-value.
ENDIF.
ELSE.
RAISE EXCEPTION TYPE zcx_adf_service
EXPORTING
textid = zcx_adf_service=>restapi_response_not_found
interface_id = gv_interface_id.
ENDIF.
go_rest_api->close( ).
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
324,
69,
62,
15271,
62,
34960,
5550,
20032,
17941,
628,
220,
44731,
628,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
324,
69,
62,
15271,
628,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
324,
69,
62,
15271,
62,
34960,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
2885,
37,
62,
35009,
27389,
62,
10761,
31300,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
324,
69,
62,
15271,
62,
34960,
93,
17953,
62,
9948,
9239,
62,
15596,
13,
198,
220,
220,
220,
42865,
25,
2376,
62,
26209,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
611,
62,
2118,
62,
26858,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2376,
62,
25927,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
611,
62,
2118,
62,
26858,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
1069,
4063,
88,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
82,
292,
62,
30001,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
19662,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
6978,
62,
40290,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
66,
87,
62,
324,
69,
62,
15271,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
66,
87,
62,
324,
69,
62,
15271,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
4774,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
374,
16072,
13812,
12,
41871,
354,
455,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
4774,
62,
82,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
4023,
62,
31534,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
20274,
62,
9948,
9239,
62,
15596,
41876,
220,
1976,
361,
62,
324,
69,
62,
15271,
62,
34960,
93,
9948,
9239,
62,
15596,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
2618,
62,
87,
8841,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
8841,
13,
628,
220,
220,
220,
16876,
467,
62,
2118,
62,
15042,
3180,
347,
15919,
13,
628,
220,
220,
220,
220,
220,
42865,
7,
6780,
62,
9948,
9239,
62,
15596,
8,
796,
21628,
62,
9948,
9239,
62,
15596,
13,
628,
220,
220,
220,
220,
220,
366,
3497,
4686,
329,
2836,
198,
220,
220,
220,
220,
220,
300,
85,
62,
6978,
62,
40290,
796,
930,
14,
18417,
14,
90,
21628,
62,
9948,
9239,
62,
15596,
12,
9971,
7509,
12,
12888,
21975,
12,
21975,
1782,
14,
9948,
9239,
14,
31534,
91,
13,
628,
198,
220,
220,
220,
220,
220,
467,
62,
2118,
62,
15042,
3784,
89,
361,
62,
2118,
62,
30604,
93,
2617,
62,
9900,
7,
300,
85,
62,
6978,
62,
40290,
6739,
628,
220,
220,
220,
220,
220,
300,
85,
62,
4774,
62,
82,
796,
308,
85,
62,
4774,
13,
198,
1174,
4550,
13639,
12608,
287,
30617,
869,
13,
198,
220,
220,
220,
220,
220,
751,
62,
25927,
62,
25677,
7,
21628,
62,
3672,
796,
705,
19746,
12,
6030,
6,
21628,
62,
8367,
796,
705,
31438,
14,
17752,
26,
34534,
316,
28,
40477,
12,
23,
6,
6739,
198,
220,
220,
220,
220,
220,
751,
62,
25927,
62,
25677,
7,
21628,
62,
3672,
796,
705,
17932,
6,
21628,
62,
8367,
796,
300,
85,
62,
4774,
62,
82,
6739,
198,
220,
220,
220,
220,
220,
751,
62,
25927,
62,
25677,
7,
21628,
62,
3672,
796,
705,
13838,
1634,
6,
21628,
62,
8367,
796,
930,
3856,
11258,
930,
11405,
21628,
62,
64,
324,
62,
30001,
6739,
628,
220,
220,
220,
220,
220,
42865,
7,
6780,
62,
2618,
62,
17752,
8,
796,
1220,
9019,
17,
14,
565,
62,
17752,
14804,
46911,
1096,
7,
1366,
796,
21628,
62,
9948,
9239,
62,
15596,
27413,
796,
450,
499,
62,
7942,
2495,
62,
3672,
796,
1220,
9019,
17,
14,
565,
62,
17752,
14804,
37784,
62,
14171,
12,
66,
17983,
62,
7442,
6739,
628,
220,
220,
220,
220,
220,
42815,
29397,
4177,
2849,
705,
6173,
5653,
62,
18601,
2751,
62,
10468,
62,
55,
18601,
2751,
6,
198,
220,
220,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2420,
220,
220,
796,
300,
85,
62,
2618,
62,
17752,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11876,
796,
300,
85,
62,
2618,
62,
87,
8841,
13,
198,
220,
220,
220,
220,
220,
16876,
827,
12,
7266,
6015,
1279,
29,
657,
13,
198,
9,
337,
1546,
4090,
8264,
4522,
827,
12,
19662,
312,
41876,
827,
12,
19662,
774,
36871,
13246,
827,
12,
19662,
3919,
198,
9,
220,
220,
13315,
827,
12,
19662,
85,
16,
827,
12,
19662,
85,
17,
827,
12,
19662,
85,
18,
827,
12,
19662,
85,
19,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
220,
220,
467,
62,
2118,
62,
15042,
3784,
89,
361,
62,
2118,
62,
30604,
93,
2617,
62,
39491,
62,
2618,
7,
300,
85,
62
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_sap_package DEFINITION
PUBLIC CREATE PRIVATE
GLOBAL FRIENDS zcl_abapgit_factory.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING iv_package TYPE devclass.
INTERFACES: zif_abapgit_sap_package.
PRIVATE SECTION.
DATA: mv_package TYPE devclass.
ALIASES:
create FOR zif_abapgit_sap_package~create,
create_local FOR zif_abapgit_sap_package~create_local.
ENDCLASS.
CLASS ZCL_ABAPGIT_SAP_PACKAGE IMPLEMENTATION.
METHOD constructor.
mv_package = iv_package.
ENDMETHOD.
METHOD zif_abapgit_sap_package~are_changes_recorded_in_tr_req.
DATA: li_package TYPE REF TO if_package.
cl_package_factory=>load_package(
EXPORTING
i_package_name = mv_package
IMPORTING
e_package = li_package
EXCEPTIONS
object_not_existing = 1
unexpected_error = 2
intern_err = 3
no_access = 4
object_locked_and_modified = 5
OTHERS = 6 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from CL_PACKAGE_FACTORY=>LOAD_PACKAGE { sy-subrc }| ).
ENDIF.
rv_are_changes_rec_in_tr_req = li_package->wbo_korr_flag.
ENDMETHOD.
METHOD zif_abapgit_sap_package~create.
DATA: lv_err TYPE string,
li_package TYPE REF TO if_package,
ls_package LIKE is_package.
ASSERT NOT is_package-devclass IS INITIAL.
cl_package_factory=>load_package(
EXPORTING
i_package_name = is_package-devclass
EXCEPTIONS
object_not_existing = 1
unexpected_error = 2
intern_err = 3
no_access = 4
object_locked_and_modified = 5 ).
IF sy-subrc = 0.
" Package already exists. We assume this is fine. Its properties might be changed later at
" DEVC deserialization.
RETURN.
ENDIF.
ls_package = is_package.
" Set software component to 'HOME' if none is set at this point.
" Otherwise SOFTWARE_COMPONENT_INVALID will be raised.
IF ls_package-dlvunit IS INITIAL.
ls_package-dlvunit = 'HOME'.
ENDIF.
cl_package_factory=>create_new_package(
EXPORTING
i_reuse_deleted_object = abap_true
* i_suppress_dialog = abap_true " does not exist in 730
IMPORTING
e_package = li_package
CHANGING
c_package_data = ls_package
EXCEPTIONS
object_already_existing = 1
object_just_created = 2
not_authorized = 3
wrong_name_prefix = 4
undefined_name = 5
reserved_local_name = 6
invalid_package_name = 7
short_text_missing = 8
software_component_invalid = 9
layer_invalid = 10
author_not_existing = 11
component_not_existing = 12
component_missing = 13
prefix_in_use = 14
unexpected_error = 15
intern_err = 16
no_access = 17
* invalid_translation_depth = 18
* wrong_mainpack_value = 19
* superpackage_invalid = 20
* error_in_cts_checks = 21
OTHERS = 18 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Package { is_package-devclass } could not be created| ).
ENDIF.
li_package->save(
* EXPORTING
* i_suppress_dialog = abap_true " Controls whether popups can be transmitted
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
cancelled_in_corr = 3
permission_failure = 4
unexpected_error = 5
intern_err = 6
OTHERS = 7 ).
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_err.
" Here we have to delete the package,
" otherwise it would remain in the memory
" and cannot created again in this session.
li_package->delete(
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
intern_err = 4
OTHERS = 5 ).
zcx_abapgit_exception=>raise( lv_err ).
ENDIF.
li_package->set_changeable( abap_false ).
ENDMETHOD.
METHOD zif_abapgit_sap_package~create_child.
DATA: li_parent TYPE REF TO if_package,
ls_child TYPE scompkdtln.
cl_package_factory=>load_package(
EXPORTING
i_package_name = mv_package
IMPORTING
e_package = li_parent
EXCEPTIONS
object_not_existing = 1
unexpected_error = 2
intern_err = 3
no_access = 4
object_locked_and_modified = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error reading parent package' ).
ENDIF.
ls_child-devclass = iv_child.
ls_child-dlvunit = li_parent->software_component.
ls_child-component = li_parent->application_component.
ls_child-ctext = iv_child.
ls_child-parentcl = mv_package.
ls_child-pdevclass = li_parent->transport_layer.
ls_child-as4user = sy-uname.
create( ls_child ).
ENDMETHOD.
METHOD zif_abapgit_sap_package~create_local.
DATA: ls_package TYPE scompkdtln.
ls_package-devclass = mv_package.
ls_package-ctext = mv_package.
ls_package-parentcl = '$TMP'.
ls_package-dlvunit = 'LOCAL'.
ls_package-as4user = sy-uname.
create( ls_package ).
ENDMETHOD.
METHOD zif_abapgit_sap_package~exists.
cl_package_factory=>load_package(
EXPORTING
i_package_name = mv_package
EXCEPTIONS
object_not_existing = 1
unexpected_error = 2
intern_err = 3
no_access = 4
object_locked_and_modified = 5 ).
rv_bool = boolc( sy-subrc <> 1 ).
ENDMETHOD.
METHOD zif_abapgit_sap_package~get_transport_type.
DATA: lv_err_prefix TYPE string,
lv_pkg_name TYPE e071-obj_name.
lv_err_prefix = |TRINT_GET_REQUEST_TYPE(R3TR, DEVC, { mv_package })|.
lv_pkg_name = mv_package.
CALL FUNCTION 'TRINT_GET_REQUEST_TYPE'
EXPORTING
iv_pgmid = 'R3TR'
iv_object = 'DEVC'
iv_obj_name = lv_pkg_name
IMPORTING
ev_request_type = rs_transport_type-request
ev_task_type = rs_transport_type-task
EXCEPTIONS
no_request_needed = 1
internal_error = 2
cts_initialization_failure = 3.
CASE sy-subrc.
WHEN 0.
" OK!
WHEN 1.
zcx_abapgit_exception=>raise( |{ lv_err_prefix }: transport is not needed| ).
WHEN 2.
zcx_abapgit_exception=>raise( |{ lv_err_prefix }: internal error| ).
WHEN 3.
zcx_abapgit_exception=>raise( |{ lv_err_prefix }: failed to initialized CTS| ).
WHEN OTHERS.
zcx_abapgit_exception=>raise( |{ lv_err_prefix }: unrecognized return code| ).
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_sap_package~list_subpackages.
DATA: lt_list LIKE rt_list.
SELECT devclass FROM tdevc
INTO TABLE lt_list
WHERE parentcl = mv_package
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
rt_list = lt_list.
WHILE lines( lt_list ) > 0.
SELECT devclass FROM tdevc
INTO TABLE lt_list
FOR ALL ENTRIES IN lt_list
WHERE parentcl = lt_list-table_line
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
APPEND LINES OF lt_list TO rt_list.
ENDWHILE.
ENDMETHOD.
METHOD zif_abapgit_sap_package~list_superpackages.
DATA: lt_list LIKE rt_list,
lv_parent TYPE tdevc-parentcl.
APPEND mv_package TO rt_list.
lv_parent = zif_abapgit_sap_package~read_parent( ).
IF sy-subrc = 0 AND NOT lv_parent IS INITIAL.
lt_list = zcl_abapgit_factory=>get_sap_package( lv_parent )->list_superpackages( ).
APPEND LINES OF lt_list TO rt_list.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_sap_package~read_parent.
SELECT SINGLE parentcl FROM tdevc INTO rv_parentcl
WHERE devclass = mv_package. "#EC CI_SUBRC "#EC CI_GENBUFF
ASSERT sy-subrc = 0.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
82,
499,
62,
26495,
5550,
20032,
17941,
198,
220,
220,
220,
44731,
29244,
6158,
4810,
3824,
6158,
198,
220,
220,
220,
10188,
9864,
1847,
48167,
1677,
5258,
1976,
565,
62,
397,
499,
18300,
62,
69,
9548,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
220,
220,
23772,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
26495,
41876,
1614,
4871,
13,
628,
220,
220,
220,
23255,
37,
2246,
1546,
25,
1976,
361,
62,
397,
499,
18300,
62,
82,
499,
62,
26495,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
25,
285,
85,
62,
26495,
41876,
1614,
4871,
13,
628,
220,
220,
220,
8355,
43429,
1546,
25,
198,
220,
220,
220,
220,
220,
2251,
7473,
1976,
361,
62,
397,
499,
18300,
62,
82,
499,
62,
26495,
93,
17953,
11,
198,
220,
220,
220,
220,
220,
2251,
62,
12001,
7473,
1976,
361,
62,
397,
499,
18300,
62,
82,
499,
62,
26495,
93,
17953,
62,
12001,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
50,
2969,
62,
47,
8120,
11879,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
23772,
13,
198,
220,
220,
220,
285,
85,
62,
26495,
796,
21628,
62,
26495,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
397,
499,
18300,
62,
82,
499,
62,
26495,
93,
533,
62,
36653,
62,
47398,
62,
259,
62,
2213,
62,
42180,
13,
628,
220,
220,
220,
42865,
25,
7649,
62,
26495,
41876,
4526,
37,
5390,
611,
62,
26495,
13,
628,
220,
220,
220,
537,
62,
26495,
62,
69,
9548,
14804,
2220,
62,
26495,
7,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
26495,
62,
3672,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
285,
85,
62,
26495,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
26495,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
7649,
62,
26495,
198,
220,
220,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
220,
220,
2134,
62,
1662,
62,
25687,
220,
220,
220,
220,
220,
220,
220,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
10059,
62,
18224,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
362,
198,
220,
220,
220,
220,
220,
220,
220,
1788,
62,
8056,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
513,
198,
220,
220,
220,
220,
220,
220,
220,
645,
62,
15526,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
604,
198,
220,
220,
220,
220,
220,
220,
220,
2134,
62,
24162,
62,
392,
62,
41771,
796,
642,
198,
220,
220,
220,
220,
220,
220,
220,
440,
4221,
4877,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
718,
6739,
628,
220,
220,
220,
16876,
827,
12,
7266,
6015,
1279,
29,
657,
13,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
7,
930,
12331,
422,
7852,
62,
47,
8120,
11879,
62,
37,
10659,
15513,
14804,
35613,
62,
47,
8120,
11879,
1391,
827,
12,
7266,
6015,
1782,
91,
6739,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
374,
85,
62,
533,
62,
36653,
62,
8344,
62,
259,
62,
2213,
62,
42180,
796,
7649,
62,
26495,
3784,
86,
2127,
62,
74,
38890,
62,
32109,
13,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
397,
499,
18300,
62,
82,
499,
62,
26495,
93,
17953,
13,
628,
220,
220,
220,
42865,
25,
300,
85,
62,
8056,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7649,
62,
26495,
41876,
4526,
37,
5390,
611,
62,
26495,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
26495,
34178,
318,
62,
26495,
13,
628,
198,
220,
220,
220,
24994,
17395,
5626,
318,
62,
26495,
12,
7959,
4871,
3180,
3268,
2043,
12576,
13,
628,
220,
220,
220,
537,
62,
26495,
62,
69,
9548,
14804,
2220,
62,
26495,
7,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
26495,
62,
3672,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
318,
62,
26495,
12,
7959,
4871,
198,
220,
220,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
220,
220,
2134,
62,
1662,
62,
25687,
220,
220,
220,
220,
220,
220,
220,
796,
352,
198,
220,
220,
220,
220,
220,
220,
220,
10059,
62,
18224,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
362,
198,
220,
220,
220,
220,
220,
220,
220,
1788,
62,
8056,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
513,
198,
220,
220,
220,
220,
220,
220,
220,
645,
62,
15526,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
604,
198,
220,
220,
220,
220,
220,
220,
220,
2134,
62,
24162,
62,
392,
62,
41771,
796,
642,
6739,
198,
220,
220,
220,
16876,
827,
12,
7266,
6015,
796,
657,
13,
198,
220,
220,
220,
220,
220,
366,
15717,
1541,
7160,
13,
775,
7048,
428,
318,
3734,
13,
6363,
6608,
1244,
307,
3421,
1568,
379,
198,
220,
220,
220,
220,
220,
366,
5550,
15922,
748,
48499,
1634,
13,
198,
220,
220,
220,
220,
220,
30826,
27064,
13,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
43979,
62,
26495,
796,
318,
62,
26495,
13,
628,
220,
220,
220,
366,
5345,
3788,
7515,
284,
705,
39069,
6,
611,
4844,
318,
900,
379,
428,
966,
13,
198,
220,
220,
220,
366,
15323
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_object_w3super DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super ABSTRACT.
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 tty_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 tty_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_W3SUPER 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. "Redefinition
rs_metadata = super->get_metadata( ).
rs_metadata-version = 'v2.0.0'. " Seriazation v2, separate data file
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.
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 int4.
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.
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 tty_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 int4.
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.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
86,
18,
16668,
5550,
20032,
17941,
44731,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
16668,
9564,
18601,
10659,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
15252,
13,
628,
220,
220,
220,
24412,
47,
1546,
1259,
62,
2503,
37266,
62,
926,
41876,
49053,
9795,
43679,
3963,
7324,
37266,
13315,
5550,
38865,
35374,
13,
628,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
347,
43312,
3963,
269,
62,
17143,
62,
14933,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2196,
220,
41876,
266,
18,
62,
3672,
26173,
8924,
705,
9641,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
2302,
220,
41876,
266,
18,
62,
3672,
26173,
8924,
705,
7753,
2302,
3004,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3696,
1096,
41876,
266,
18,
62,
3672,
26173,
8924,
705,
16624,
1096,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29472,
41876,
266,
18,
62,
3672,
26173,
8924,
705,
34345,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17007,
2963,
431,
41876,
266,
18,
62,
3672,
26173,
8924,
705,
76,
320,
2963,
431,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
269,
62,
17143,
62,
14933,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
9186,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
16129,
41876,
7500,
292,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
256,
774,
62,
17457,
66,
7890,
41876,
49053,
9795,
43679,
3963,
275,
17896,
7890,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13315,
44521,
12,
4944,
33866,
8924,
5550,
38865,
35374,
13,
628,
220,
220,
220,
337,
36252,
50,
651,
62,
38993,
23848,
36,
20032,
17941,
13,
628,
220,
220,
220,
337,
36252,
50,
1487,
62,
17457,
66,
62,
43327,
62,
7890,
9564,
18601,
10659,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
269,
83,
62,
17457,
66,
7890,
41876,
256,
774,
62,
17457,
66,
7890,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42865,
13845,
62,
2539,
41876,
7324,
19608,
265,
397,
13,
628,
220,
220,
220,
337,
36252,
50,
651,
62,
2302,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
340,
62,
37266,
220,
220,
220,
220,
41876,
1259,
62,
2503,
37266,
62,
926,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
2302,
8,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
3487,
1096,
62,
37266,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
7857,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
220,
269,
83,
62,
37266,
41876,
1259,
62,
2503,
37266,
62,
926,
220,
366,
25139,
3084,
284,
8529,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
10283,
62,
37266,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
269,
83,
62,
37266,
41876,
1259,
62,
2503,
37266,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
337,
36252,
50,
1064,
62,
17143,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
340,
62,
37266,
220,
220,
220,
220,
220,
220,
41876,
1259,
62,
2503,
37266,
62,
926,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
3672,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
266,
18,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
8367,
8,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
9864,
23680,
62,
54,
18,
40331,
1137,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
23772,
13,
198,
220,
220,
220,
2208,
3784,
41571,
273,
7,
318,
62,
9186,
796,
318,
62,
9186,
21628,
62,
16129,
796,
21628,
62,
16129,
6739,
198,
220,
220,
220,
13845,
62,
2539,
12,
2411,
312,
796,
13845,
62,
9186,
12,
26801,
62,
4906,
10,
17,
7,
17,
737,
198,
220,
220,
220,
13845,
62,
2539,
12,
26801,
312,
796,
13845,
62,
9186,
12,
26801,
62,
3672,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1064,
62,
17143,
13,
628,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
1279,
7278,
62,
17143,
29,
34178,
48920,
3963,
340,
62,
37266,
13,
628,
198,
220,
220,
220,
20832,
43679,
340,
62,
37266,
24994,
3528,
15871,
1279,
7278,
62,
17143,
29,
13315,
35374,
1438,
796,
21628,
62,
3672,
13,
198,
220,
220,
220,
16876,
827,
12,
7266,
6015,
1875,
657,
13,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
7,
930,
54,
18,
5324,
25,
26003,
1064,
1391,
21628,
62,
3672,
1782,
329,
1391,
13845,
62,
2539,
12,
26801,
312,
1782,
91,
6739,
198,
220,
220,
220,
23578,
5064,
13,
628,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_gui_view_tutorial DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES zif_abapgit_gui_renderable.
INTERFACES zif_abapgit_gui_event_handler.
INTERFACES zif_abapgit_gui_page_hotkey.
ALIASES render FOR zif_abapgit_gui_renderable~render.
PROTECTED SECTION.
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.
DATA: lv_devclass TYPE tadir-devclass.
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 = '+ Online' iv_act = zif_abapgit_definitions=>c_action-repo_newonline ).
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=>c_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=>c_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( '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 repository</h2>' ).
ro_html->add( '<p><ul>' ).
ro_html->add( '<li>' ).
lv_devclass = zcl_abapgit_services_abapgit=>is_installed( ).
IF NOT lv_devclass IS INITIAL.
ro_html->add( 'abapGit installed in package ' ).
ro_html->add( lv_devclass ).
ELSE.
ro_html->add_a( iv_txt = 'install abapGit repo' iv_act = zif_abapgit_definitions=>c_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( '</ul></p>' ).
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
ev_state = zcl_abapgit_gui=>c_event_state-not_handled.
ENDMETHOD.
METHOD zif_abapgit_gui_page_hotkey~get_hotkey_actions.
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
CREATE OBJECT ro_html TYPE zcl_abapgit_html.
ro_html->add( '<div class="tutorial">' ).
ro_html->add( render_content( ) ).
ro_html->add( '</div>' ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
1177,
62,
83,
44917,
5550,
20032,
17941,
44731,
25261,
29244,
6158,
44731,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
13287,
540,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
15596,
62,
30281,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
8940,
2539,
13,
198,
220,
220,
220,
8355,
43429,
1546,
8543,
7473,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
13287,
540,
93,
13287,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
8543,
62,
11299,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
305,
62,
6494,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
40156,
62,
28206,
62,
51,
3843,
1581,
12576,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
8543,
62,
11299,
13,
628,
220,
220,
220,
42865,
25,
300,
85,
62,
7959,
4871,
41876,
36264,
343,
12,
7959,
4871,
13,
628,
220,
220,
220,
29244,
6158,
25334,
23680,
686,
62,
6494,
13,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
71,
16,
29,
51,
44917,
3556,
71,
16,
29,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
11840,
29,
6,
6739,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
71,
17,
29,
32901,
290,
45973,
1128,
418,
3556,
71,
17,
29,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
79,
6927,
377,
29,
6,
6739,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
4600,
27,
4528,
29,
2514,
17271,
257,
6569,
29924,
357,
68,
13,
70,
13,
422,
33084,
8,
3904,
4600,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
62,
64,
7,
21628,
62,
14116,
796,
705,
10,
7467,
6,
21628,
62,
529,
796,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
66,
62,
2673,
12,
260,
7501,
62,
3605,
25119,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
422,
262,
1353,
6859,
13,
770,
481,
4866,
257,
6569,
29924,
284,
534,
1080,
25970,
4528,
29,
6,
6739,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
4600,
27,
4528,
29,
2514,
751,
257,
1957,
5301,
355,
257,
29924,
3904,
4600,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
62,
64,
7,
21628,
62,
14116,
796,
705,
10,
49749,
6,
21628,
62,
529,
796,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
66,
62,
2673,
12,
260,
7501,
62,
3605,
2364,
1370,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
422,
262,
1353,
6859,
13,
770,
481,
2610,
257,
29924,
543,
1541,
2152,
287,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
262,
1080,
351,
450,
499,
38,
270,
13,
921,
7061,
297,
307,
1498,
284,
10199,
340,
284,
6569,
8159,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
393,
655,
11389,
1096,
355,
257,
19974,
2393,
3556,
4528,
29,
6,
6739,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
4600,
27,
4528,
29,
5247,
4600,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
62,
64,
7,
21628,
62,
14116,
796,
705,
35433,
6,
21628,
62,
529,
796,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
66,
62,
2673,
12,
2188,
62,
20676,
382,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
284,
1064,
4493,
1262,
450,
499,
38,
270,
3556,
4528,
29,
6,
6739,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
3556,
377,
12240,
79,
29,
6,
6739,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
71,
17,
29,
6207,
13264,
1351,
290,
18852,
3556,
71,
17,
29,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
79,
6927,
377,
29,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
930,
27,
4528,
29,
2514,
3853,
257,
29924,
1803,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
565,
62,
397,
499,
18300,
62,
6494,
14804,
4749,
7,
705,
34046,
14,
17585,
6,
1267,
1782,
379,
262,
4004,
2318,
25970,
4528,
29,
91,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
930,
27,
4528,
29,
2514,
4004,
257,
29924,
3904,
1391,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
565,
62,
397,
499,
18300,
62,
6494,
14804,
4749,
7,
705,
7364,
14,
21953,
49502,
6,
1267,
1782,
7196,
379,
29924,
50149,
25970,
4528,
29,
91,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
3556,
377,
12240,
79,
29,
6,
6739,
628,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
71,
17,
29,
397,
499,
38,
270,
16099,
3556,
71,
17,
29,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
79,
6927,
377,
29,
6,
6739,
198,
220,
220,
220,
686,
62,
6494,
3784,
2860,
7,
705,
27,
4528,
29,
6,
6739,
628,
220,
220,
220,
300,
85,
62,
7959,
4871,
796,
1976,
565,
62,
397,
499,
18300,
62,
30416,
62,
397,
499,
18300,
14804,
271,
62,
37050,
7,
6739,
198,
220,
220,
220,
16876,
5626,
300,
85,
62,
7959,
4871,
3180,
3268,
2043,
12576,
13,
198,
220,
220,
220,
220,
220,
686,
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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
"! <p class="shorttext synchronized" lang="en">Output field configuration</p>
INTERFACE zif_qdrt_output_field_config
PUBLIC .
TYPES:
BEGIN OF ty_output_field,
field_name TYPE fieldname,
function TYPE string,
index TYPE i,
visible TYPE abap_bool,
END OF ty_output_field,
ty_output_fields TYPE STANDARD TABLE OF ty_output_field WITH EMPTY KEY.
METHODS:
"! <p class="shorttext synchronized" lang="en">Returns the select clause</p>
get_select_clause
RETURNING
VALUE(result) TYPE string_table,
"! <p class="shorttext synchronized" lang="en">Returns 'X' if field is an output field</p>
is_output_field
IMPORTING
fieldname TYPE fieldname
RETURNING
VALUE(result) TYPE abap_bool,
"! <p class="shorttext synchronized" lang="en">Sets value for 'Use count field'</p>
"! If flag 'Use count field' is active an additional COUNT field is added to
"! the select clause.
set_use_count_field
IMPORTING
value TYPE abap_bool DEFAULT abap_true,
"! <p class="shorttext synchronized" lang="en">Sets value for 'Select only specified'</p>
"! If flag 'Select only specified' is active only the specified fields will
"! be added to the select clause
set_select_only_specified
IMPORTING
value TYPE abap_bool,
"! <p class="shorttext synchronized" lang="en">Returns 'X' if aggregation function are used</p>
has_aggr_fields
RETURNING
VALUE(result) TYPE abap_bool.
ENDINTERFACE.
| [
40484,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
26410,
2214,
8398,
3556,
79,
29,
198,
41358,
49836,
1976,
361,
62,
80,
7109,
83,
62,
22915,
62,
3245,
62,
11250,
198,
220,
44731,
764,
628,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
347,
43312,
3963,
1259,
62,
22915,
62,
3245,
11,
198,
220,
220,
220,
220,
220,
2214,
62,
3672,
41876,
2214,
3672,
11,
198,
220,
220,
220,
220,
220,
2163,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
6376,
220,
220,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
7424,
220,
220,
220,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
23578,
3963,
1259,
62,
22915,
62,
3245,
11,
628,
220,
220,
220,
1259,
62,
22915,
62,
25747,
41876,
49053,
9795,
43679,
3963,
1259,
62,
22915,
62,
3245,
13315,
38144,
9936,
35374,
13,
628,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
35561,
262,
2922,
13444,
3556,
79,
29,
198,
220,
220,
220,
651,
62,
19738,
62,
565,
682,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
20274,
8,
41876,
4731,
62,
11487,
11,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
35561,
705,
55,
6,
611,
2214,
318,
281,
5072,
2214,
3556,
79,
29,
198,
220,
220,
220,
318,
62,
22915,
62,
3245,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
2214,
3672,
220,
220,
220,
220,
41876,
2214,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
20274,
8,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
50,
1039,
1988,
329,
705,
11041,
954,
2214,
6,
3556,
79,
29,
198,
220,
220,
220,
366,
0,
1002,
6056,
705,
11041,
954,
2214,
6,
318,
4075,
281,
3224,
327,
28270,
2214,
318,
2087,
284,
198,
220,
220,
220,
366,
0,
262,
2922,
13444,
13,
198,
220,
220,
220,
900,
62,
1904,
62,
9127,
62,
3245,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
11,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
50,
1039,
1988,
329,
705,
17563,
691,
7368,
6,
3556,
79,
29,
198,
220,
220,
220,
366,
0,
1002,
6056,
705,
17563,
691,
7368,
6,
318,
4075,
691,
262,
7368,
7032,
481,
198,
220,
220,
220,
366,
0,
307,
2087,
284,
262,
2922,
13444,
198,
220,
220,
220,
900,
62,
19738,
62,
8807,
62,
23599,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
366,
0,
1279,
79,
1398,
2625,
19509,
5239,
47192,
1,
42392,
2625,
268,
5320,
35561,
705,
55,
6,
611,
46500,
2163,
389,
973,
3556,
79,
29,
198,
220,
220,
220,
468,
62,
363,
2164,
62,
25747,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
20274,
8,
41876,
450,
499,
62,
30388,
13,
198,
10619,
41358,
49836,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
TYPES: BEGIN OF t_input,
row TYPE string,
END OF t_input.
* Input declaration
DATA: lv_input TYPE TABLE OF t_input,
wa_input LIKE LINE OF lv_input.
* Assign with the puzzle input.
lv_input = VALUE #(
( row = 'acc +15' )
( row = 'jmp +461' )
( row = 'acc +6' )
( row = 'nop +445' )
( row = 'jmp +324' )
( row = 'jmp +253' )
( row = 'acc -4' )
( row = 'acc +22' )
( row = 'acc +11' )
( row = 'jmp +471' )
( row = 'jmp +145' )
( row = 'acc +19' )
( row = 'jmp -7' )
( row = 'jmp +431' )
( row = 'nop +66' )
( row = 'acc +48' )
( row = 'jmp +409' )
( row = 'jmp +514' )
( row = 'jmp +1' )
( row = 'acc +32' )
( row = 'jmp +552' )
( row = 'acc +21' )
( row = 'jmp +317' )
( row = 'nop +488' )
( row = 'jmp +500' )
( row = 'jmp +214' )
( row = 'acc +41' )
( row = 'jmp +17' )
( row = 'acc +19' )
( row = 'jmp +1' )
( row = 'acc +28' )
( row = 'jmp +74' )
( row = 'acc +37' )
( row = 'acc +46' )
( row = 'acc -10' )
( row = 'jmp +455' )
( row = 'acc +33' )
( row = 'jmp +585' )
( row = 'acc -13' )
( row = 'acc +18' )
( row = 'jmp +19' )
( row = 'jmp +601' )
( row = 'acc +30' )
( row = 'jmp +272' )
( row = 'acc +18' )
( row = 'acc +50' )
( row = 'acc +1' )
( row = 'acc +29' )
( row = 'jmp +50' )
( row = 'nop +573' )
( row = 'jmp +562' )
( row = 'nop +274' )
( row = 'jmp +1' )
( row = 'acc +6' )
( row = 'jmp +1' )
( row = 'jmp +64' )
( row = 'jmp +1' )
( row = 'acc +37' )
( row = 'jmp +161' )
( row = 'nop +549' )
( row = 'acc +21' )
( row = 'jmp +1' )
( row = 'nop +325' )
( row = 'jmp +331' )
( row = 'acc +0' )
( row = 'acc +25' )
( row = 'jmp +431' )
( row = 'nop +349' )
( row = 'jmp +45' )
( row = 'acc +37' )
( row = 'acc +9' )
( row = 'jmp +354' )
( row = 'jmp +132' )
( row = 'jmp +307' )
( row = 'jmp +1' )
( row = 'nop +465' )
( row = 'jmp +386' )
( row = 'acc +13' )
( row = 'acc +20' )
( row = 'jmp -20' )
( row = 'acc -15' )
( row = 'nop +158' )
( row = 'jmp +415' )
( row = 'acc +33' )
( row = 'acc +40' )
( row = 'acc +38' )
( row = 'acc -2' )
( row = 'jmp +81' )
( row = 'acc +44' )
( row = 'acc +9' )
( row = 'acc +15' )
( row = 'nop +139' )
( row = 'jmp -18' )
( row = 'nop +187' )
( row = 'acc +47' )
( row = 'acc +45' )
( row = 'acc +40' )
( row = 'jmp +456' )
( row = 'acc +48' )
( row = 'jmp +1' )
( row = 'jmp -75' )
( row = 'acc +11' )
( row = 'acc -13' )
( row = 'nop +222' )
( row = 'jmp +202' )
( row = 'acc +38' )
( row = 'acc +31' )
( row = 'acc -11' )
( row = 'acc +1' )
( row = 'jmp +431' )
( row = 'acc +37' )
( row = 'nop +195' )
( row = 'jmp +118' )
( row = 'acc -8' )
( row = 'jmp +1' )
( row = 'jmp +154' )
( row = 'acc +7' )
( row = 'acc +13' )
( row = 'jmp +43' )
( row = 'jmp +507' )
( row = 'acc -2' )
( row = 'acc +11' )
( row = 'jmp +465' )
( row = 'acc -12' )
( row = 'nop -103' )
( row = 'jmp +50' )
( row = 'acc +2' )
( row = 'nop +4' )
( row = 'acc +46' )
( row = 'acc +17' )
( row = 'jmp +100' )
( row = 'nop +149' )
( row = 'jmp +397' )
( row = 'nop -28' )
( row = 'jmp +236' )
( row = 'acc +0' )
( row = 'nop +465' )
( row = 'acc +19' )
( row = 'acc -5' )
( row = 'jmp +91' )
( row = 'jmp +118' )
( row = 'acc -3' )
( row = 'nop +176' )
( row = 'acc +8' )
( row = 'jmp +24' )
( row = 'jmp +235' )
( row = 'acc -7' )
( row = 'nop -1' )
( row = 'nop +347' )
( row = 'acc +33' )
( row = 'jmp +165' )
( row = 'acc -18' )
( row = 'acc +9' )
( row = 'acc -8' )
( row = 'jmp +179' )
( row = 'acc -3' )
( row = 'acc +40' )
( row = 'jmp +1' )
( row = 'acc +5' )
( row = 'jmp +475' )
( row = 'jmp +70' )
( row = 'acc +50' )
( row = 'acc -1' )
( row = 'acc -11' )
( row = 'acc +43' )
( row = 'jmp +283' )
( row = 'nop +114' )
( row = 'jmp +161' )
( row = 'acc -19' )
( row = 'acc +50' )
( row = 'acc +47' )
( row = 'acc +49' )
( row = 'jmp +381' )
( row = 'jmp +1' )
( row = 'jmp -94' )
( row = 'nop +373' )
( row = 'acc +26' )
( row = 'acc +7' )
( row = 'jmp +41' )
( row = 'acc -7' )
( row = 'jmp +264' )
( row = 'nop -40' )
( row = 'acc +23' )
( row = 'jmp -60' )
( row = 'acc +15' )
( row = 'acc +19' )
( row = 'acc +39' )
( row = 'acc -16' )
( row = 'jmp +283' )
( row = 'acc +4' )
( row = 'jmp +258' )
( row = 'acc +0' )
( row = 'acc +38' )
( row = 'acc -6' )
( row = 'jmp +32' )
( row = 'acc +33' )
( row = 'jmp +1' )
( row = 'acc -4' )
( row = 'acc +17' )
( row = 'jmp +149' )
( row = 'acc -17' )
( row = 'acc +39' )
( row = 'nop +75' )
( row = 'jmp -136' )
( row = 'acc +6' )
( row = 'acc +10' )
( row = 'jmp +1' )
( row = 'acc +9' )
( row = 'jmp +390' )
( row = 'jmp +363' )
( row = 'acc +32' )
( row = 'jmp +95' )
( row = 'jmp -71' )
( row = 'acc +12' )
( row = 'jmp +86' )
( row = 'acc +49' )
( row = 'acc +2' )
( row = 'acc +0' )
( row = 'jmp +139' )
( row = 'nop +363' )
( row = 'acc +21' )
( row = 'jmp +366' )
( row = 'jmp +1' )
( row = 'acc +16' )
( row = 'acc -13' )
( row = 'jmp +55' )
( row = 'jmp -159' )
( row = 'acc +46' )
( row = 'acc +50' )
( row = 'jmp +266' )
( row = 'acc +2' )
( row = 'jmp -180' )
( row = 'jmp -181' )
( row = 'acc +41' )
( row = 'acc -3' )
( row = 'nop -176' )
( row = 'jmp +121' )
( row = 'acc +23' )
( row = 'jmp +281' )
( row = 'acc +5' )
( row = 'acc +14' )
( row = 'acc -8' )
( row = 'jmp +128' )
( row = 'jmp +281' )
( row = 'nop +81' )
( row = 'jmp +1' )
( row = 'acc +36' )
( row = 'acc +34' )
( row = 'jmp -176' )
( row = 'acc +8' )
( row = 'jmp +309' )
( row = 'acc +11' )
( row = 'nop -77' )
( row = 'jmp -40' )
( row = 'acc +0' )
( row = 'acc +8' )
( row = 'acc +14' )
( row = 'jmp +296' )
( row = 'nop +197' )
( row = 'nop -124' )
( row = 'acc +38' )
( row = 'acc +9' )
( row = 'jmp +310' )
( row = 'jmp -183' )
( row = 'jmp +353' )
( row = 'acc +28' )
( row = 'acc -18' )
( row = 'nop +120' )
( row = 'jmp -217' )
( row = 'acc +49' )
( row = 'acc +38' )
( row = 'jmp -243' )
( row = 'nop -68' )
( row = 'acc +9' )
( row = 'acc +15' )
( row = 'nop +43' )
( row = 'jmp -46' )
( row = 'acc -4' )
( row = 'jmp +262' )
( row = 'jmp +176' )
( row = 'nop -139' )
( row = 'acc +38' )
( row = 'acc +35' )
( row = 'acc -8' )
( row = 'jmp -225' )
( row = 'acc +37' )
( row = 'acc +49' )
( row = 'acc +42' )
( row = 'nop +278' )
( row = 'jmp +264' )
( row = 'acc -11' )
( row = 'nop +291' )
( row = 'acc +21' )
( row = 'nop -221' )
( row = 'jmp +80' )
( row = 'acc +15' )
( row = 'acc +13' )
( row = 'acc +2' )
( row = 'nop -40' )
( row = 'jmp +309' )
( row = 'acc -18' )
( row = 'acc -5' )
( row = 'acc +24' )
( row = 'jmp -70' )
( row = 'acc +12' )
( row = 'jmp -261' )
( row = 'acc +4' )
( row = 'acc -2' )
( row = 'acc +3' )
( row = 'jmp +1' )
( row = 'jmp +302' )
( row = 'acc -7' )
( row = 'jmp +1' )
( row = 'acc +39' )
( row = 'jmp +73' )
( row = 'jmp +18' )
( row = 'acc +3' )
( row = 'jmp +277' )
( row = 'acc +4' )
( row = 'nop +125' )
( row = 'nop -284' )
( row = 'acc +41' )
( row = 'jmp -312' )
( row = 'acc +13' )
( row = 'jmp -183' )
( row = 'nop -35' )
( row = 'jmp -137' )
( row = 'jmp -76' )
( row = 'acc +1' )
( row = 'acc +31' )
( row = 'acc +39' )
( row = 'jmp +56' )
( row = 'jmp +290' )
( row = 'jmp +1' )
( row = 'acc +12' )
( row = 'nop +71' )
( row = 'acc +43' )
( row = 'jmp -296' )
( row = 'jmp +68' )
( row = 'acc -14' )
( row = 'acc +35' )
( row = 'nop -290' )
( row = 'jmp -24' )
( row = 'acc +39' )
( row = 'acc -8' )
( row = 'nop +110' )
( row = 'jmp +1' )
( row = 'jmp +78' )
( row = 'acc +11' )
( row = 'acc +9' )
( row = 'acc -11' )
( row = 'acc +50' )
( row = 'jmp +167' )
( row = 'acc +50' )
( row = 'acc +19' )
( row = 'acc +0' )
( row = 'jmp -221' )
( row = 'acc -4' )
( row = 'acc -6' )
( row = 'nop +11' )
( row = 'acc +49' )
( row = 'jmp -348' )
( row = 'nop +197' )
( row = 'acc +6' )
( row = 'jmp -196' )
( row = 'nop -155' )
( row = 'jmp -76' )
( row = 'acc +50' )
( row = 'acc -8' )
( row = 'jmp -89' )
( row = 'acc +9' )
( row = 'jmp +255' )
( row = 'acc +25' )
( row = 'jmp +199' )
( row = 'jmp -35' )
( row = 'acc +46' )
( row = 'acc +25' )
( row = 'jmp +1' )
( row = 'acc +32' )
( row = 'jmp -31' )
( row = 'acc -3' )
( row = 'acc -5' )
( row = 'jmp +73' )
( row = 'acc +7' )
( row = 'acc +22' )
( row = 'acc -15' )
( row = 'jmp +145' )
( row = 'nop -97' )
( row = 'acc +47' )
( row = 'acc +22' )
( row = 'jmp -110' )
( row = 'acc +44' )
( row = 'acc +4' )
( row = 'jmp -383' )
( row = 'acc +34' )
( row = 'jmp +1' )
( row = 'jmp +16' )
( row = 'nop -128' )
( row = 'acc +43' )
( row = 'jmp -34' )
( row = 'nop +95' )
( row = 'acc +3' )
( row = 'jmp +4' )
( row = 'acc +13' )
( row = 'acc -2' )
( row = 'jmp -90' )
( row = 'acc +39' )
( row = 'jmp +187' )
( row = 'acc +24' )
( row = 'acc +23' )
( row = 'acc +42' )
( row = 'jmp -11' )
( row = 'jmp -281' )
( row = 'jmp +1' )
( row = 'acc +25' )
( row = 'jmp -157' )
( row = 'acc +3' )
( row = 'acc -3' )
( row = 'nop -24' )
( row = 'acc -13' )
( row = 'jmp -46' )
( row = 'acc +10' )
( row = 'acc +16' )
( row = 'nop -7' )
( row = 'jmp -289' )
( row = 'nop -408' )
( row = 'acc -5' )
( row = 'acc +23' )
( row = 'nop +91' )
( row = 'jmp -234' )
( row = 'acc +0' )
( row = 'acc +4' )
( row = 'acc +15' )
( row = 'acc -15' )
( row = 'jmp -367' )
( row = 'acc +32' )
( row = 'acc -9' )
( row = 'acc +13' )
( row = 'jmp -194' )
( row = 'acc +38' )
( row = 'nop +126' )
( row = 'acc +1' )
( row = 'nop +124' )
( row = 'jmp -275' )
( row = 'acc -14' )
( row = 'acc +26' )
( row = 'jmp +55' )
( row = 'jmp -388' )
( row = 'acc +3' )
( row = 'acc +8' )
( row = 'acc +31' )
( row = 'acc +34' )
( row = 'jmp -372' )
( row = 'acc +45' )
( row = 'jmp -115' )
( row = 'acc -6' )
( row = 'acc +47' )
( row = 'acc -17' )
( row = 'acc +29' )
( row = 'jmp -438' )
( row = 'acc +33' )
( row = 'jmp -113' )
( row = 'jmp -301' )
( row = 'jmp -396' )
( row = 'acc +46' )
( row = 'jmp -284' )
( row = 'acc -14' )
( row = 'acc +11' )
( row = 'acc +20' )
( row = 'nop -356' )
( row = 'jmp -445' )
( row = 'acc +20' )
( row = 'acc -6' )
( row = 'acc -8' )
( row = 'jmp +134' )
( row = 'nop +54' )
( row = 'acc +33' )
( row = 'jmp +1' )
( row = 'acc +3' )
( row = 'jmp +108' )
( row = 'acc +14' )
( row = 'nop +67' )
( row = 'nop -66' )
( row = 'acc +45' )
( row = 'jmp +117' )
( row = 'acc +45' )
( row = 'acc +42' )
( row = 'acc +25' )
( row = 'acc -18' )
( row = 'jmp -354' )
( row = 'acc +8' )
( row = 'jmp -240' )
( row = 'nop -373' )
( row = 'acc -8' )
( row = 'jmp +72' )
( row = 'jmp -95' )
( row = 'jmp -350' )
( row = 'jmp -62' )
( row = 'acc +6' )
( row = 'acc -18' )
( row = 'jmp +108' )
( row = 'acc +14' )
( row = 'acc +11' )
( row = 'nop -164' )
( row = 'acc +4' )
( row = 'jmp +6' )
( row = 'acc +24' )
( row = 'acc +11' )
( row = 'acc -7' )
( row = 'acc +27' )
( row = 'jmp -171' )
( row = 'acc +23' )
( row = 'acc +36' )
( row = 'acc +20' )
( row = 'acc +42' )
( row = 'jmp -51' )
( row = 'acc +28' )
( row = 'acc +10' )
( row = 'jmp -218' )
( row = 'nop +63' )
( row = 'jmp -294' )
( row = 'acc -10' )
( row = 'nop +44' )
( row = 'jmp +43' )
( row = 'jmp -444' )
( row = 'acc +20' )
( row = 'acc +39' )
( row = 'acc +29' )
( row = 'jmp -507' )
( row = 'jmp -265' )
( row = 'jmp -471' )
( row = 'nop +17' )
( row = 'acc +39' )
( row = 'acc +4' )
( row = 'jmp -54' )
( row = 'acc +1' )
( row = 'nop -448' )
( row = 'acc -18' )
( row = 'acc +3' )
( row = 'jmp -495' )
( row = 'acc +17' )
( row = 'acc +16' )
( row = 'jmp +6' )
( row = 'acc +6' )
( row = 'acc +0' )
( row = 'jmp +1' )
( row = 'acc -15' )
( row = 'jmp -317' )
( row = 'jmp -77' )
( row = 'acc +4' )
( row = 'acc +30' )
( row = 'acc -3' )
( row = 'jmp -187' )
( row = 'acc -11' )
( row = 'nop -189' )
( row = 'nop -488' )
( row = 'jmp -140' )
( row = 'acc +50' )
( row = 'jmp -142' )
( row = 'nop -211' )
( row = 'jmp -166' )
( row = 'acc -12' )
( row = 'acc +7' )
( row = 'acc +32' )
( row = 'acc +40' )
( row = 'jmp -384' )
( row = 'jmp -186' )
( row = 'nop -261' )
( row = 'acc +32' )
( row = 'acc +19' )
( row = 'acc +44' )
( row = 'jmp +16' )
( row = 'acc +15' )
( row = 'acc +30' )
( row = 'nop -476' )
( row = 'acc +9' )
( row = 'jmp -299' )
( row = 'acc -17' )
( row = 'acc -17' )
( row = 'acc -4' )
( row = 'acc +44' )
( row = 'jmp -133' )
( row = 'jmp -58' )
( row = 'acc +21' )
( row = 'acc +4' )
( row = 'acc -19' )
( row = 'jmp -170' )
( row = 'acc +32' )
( row = 'acc -3' )
( row = 'jmp -363' )
( row = 'acc +48' )
( row = 'acc +9' )
( row = 'acc +48' )
( row = 'jmp +5' )
( row = 'acc +30' )
( row = 'acc +40' )
( row = 'jmp -450' )
( row = 'jmp -282' )
( row = 'jmp -388' )
( row = 'acc +12' )
( row = 'jmp -361' )
( row = 'acc -6' )
( row = 'jmp -237' )
( row = 'acc +27' )
( row = 'acc +16' )
( row = 'acc -19' )
( row = 'acc -5' )
( row = 'jmp -145' )
( row = 'acc +38' )
( row = 'jmp -565' )
( row = 'nop -341' )
( row = 'jmp +11' )
( row = 'acc +22' )
( row = 'nop -219' )
( row = 'jmp -597' )
( row = 'acc +33' )
( row = 'jmp -572' )
( row = 'jmp -292' )
( row = 'acc +7' )
( row = 'acc -14' )
( row = 'acc +33' )
( row = 'jmp -432' )
( row = 'acc +47' )
( row = 'jmp -41' )
( row = 'nop -306' )
( row = 'jmp -85' )
( row = 'jmp +1' )
( row = 'nop -215' )
( row = 'acc +30' )
( row = 'acc +9' )
( row = 'jmp -71' )
( row = 'acc +42' )
( row = 'acc +49' )
( row = 'jmp -553' )
( row = 'acc +28' )
( row = 'acc +43' )
( row = 'jmp +1' )
( row = 'jmp -147' )
( row = 'acc +44' )
( row = 'acc +26' )
( row = 'nop -176' )
( row = 'jmp -582' )
( row = 'acc +7' )
( row = 'acc -14' )
( row = 'acc +16' )
( row = 'acc +34' )
( row = 'jmp +1' ) ).
TYPES: BEGIN OF t_checklist,
instruction_index TYPE i,
END OF t_checklist.
DATA: lv_cur_position TYPE i VALUE 1,
lv_accumulator TYPE i VALUE 0,
lt_checklist TYPE TABLE OF t_checklist,
lv_prefix TYPE string,
wa_checklist LIKE LINE OF lt_checklist.
DO.
READ TABLE lv_input INTO wa_input INDEX lv_cur_position.
IF line_exists( lt_checklist[ instruction_index = lv_cur_position ] ).
EXIT.
ELSE. " Store the instruction as executed.
wa_checklist-instruction_index = lv_cur_position.
APPEND wa_checklist TO lt_checklist.
ENDIF.
SPLIT wa_input-row AT ' ' INTO TABLE DATA(lv_instruction).
READ TABLE lv_instruction INTO DATA(lv_operation) INDEX 1.
READ TABLE lv_instruction INTO DATA(lv_argument) INDEX 2.
CASE lv_operation.
WHEN 'jmp'. " Jump to a position
lv_prefix = lv_argument+0(1).
REPLACE '+' WITH '' INTO lv_argument.
REPLACE '-' WITH '' INTO lv_argument.
CONDENSE lv_argument NO-GAPS.
CASE lv_prefix.
WHEN '+'.
lv_cur_position = lv_cur_position + lv_argument. " Adds the argument number
WHEN '-'.
lv_cur_position = lv_cur_position - lv_argument. " Subs the argument number
ENDCASE.
WHEN 'acc'. " Add / Sub value to the accumulator and goes to the next line
lv_prefix = lv_argument+0(1).
REPLACE '+' WITH '' INTO lv_argument.
REPLACE '-' WITH '' INTO lv_argument.
CONDENSE lv_argument NO-GAPS.
CASE lv_prefix.
WHEN '+'.
lv_accumulator = lv_accumulator + lv_argument. " Adds the argument number
WHEN '-'.
lv_accumulator = lv_accumulator - lv_argument. " Subs the argument number
ENDCASE.
lv_cur_position = lv_cur_position + 1.
WHEN 'nop'. " No Operation, just go to the next line.
lv_cur_position = lv_cur_position + 1.
ENDCASE.
ENDDO.
WRITE: 'Result accumulator: ' && lv_accumulator.
| [
9936,
47,
1546,
25,
347,
43312,
3963,
256,
62,
15414,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
5752,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
23578,
3963,
256,
62,
15414,
13,
198,
198,
9,
23412,
14305,
198,
26947,
25,
300,
85,
62,
15414,
41876,
43679,
3963,
256,
62,
15414,
11,
198,
220,
220,
220,
220,
220,
2082,
62,
15414,
34178,
48920,
3963,
300,
85,
62,
15414,
13,
198,
198,
9,
2195,
570,
351,
262,
15027,
5128,
13,
198,
6780,
62,
15414,
796,
26173,
8924,
1303,
7,
198,
357,
5752,
796,
705,
4134,
1343,
1314,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
40652,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
21,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
43489,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
33916,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
28592,
6,
1267,
198,
357,
5752,
796,
705,
4134,
532,
19,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1828,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1157,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
38339,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
18781,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1129,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
532,
22,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
50080,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
2791,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2780,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
29416,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
47396,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2624,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
40427,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2481,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
34125,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
33646,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
4059,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
22291,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
3901,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
1558,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1129,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2078,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
4524,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2718,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
3510,
6,
1267,
198,
357,
5752,
796,
705,
4134,
532,
940,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
30505,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2091,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
38905,
6,
1267,
198,
357,
5752,
796,
705,
4134,
532,
1485,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1507,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
1129,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
41706,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1270,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
29807,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1507,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1120,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1959,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
1120,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
48638,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
43918,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
28857,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
21,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
2414,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2718,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
25948,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
44966,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2481,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
26582,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
31697,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
15,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1495,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
50080,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
27371,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
2231,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2718,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
24,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
32182,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
19924,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
22996,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
16,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
42018,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
21734,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1485,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1238,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
532,
1238,
6,
1267,
198,
357,
5752,
796,
705,
4134,
532,
1314,
6,
1267,
198,
357,
5752,
796,
705,
77,
404,
1343,
21273,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
35038,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2091,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
1821,
6,
1267,
198,
357,
5752,
796,
705,
4134,
1343,
2548,
6,
1267,
198,
357,
5752,
796,
705,
4134,
532,
17,
6,
1267,
198,
357,
5752,
796,
705,
73,
3149,
1343,
6659,
6,
1267,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
"! <h1>API for Getting a Travel</h1>
"!
"! <p>
"! Function module to get a single Travel instance with all related Bookings and
"! Booking Supplements related to the importing Travel ID.
"! </p>
"!
"!
"! @parameter iv_travel_id | Travel ID
"! @parameter iv_include_buffer | Include any changes that have not yet been committed
"! @parameter es_travel | Travel Data like /DMO/TRAVEL28 related to the importing Travel ID
"! @parameter et_booking | Table of Bookings like /DMO/BOOKING28 related to the importing Travel ID
"! @parameter et_booking_supplement | Table of Booking Supplements like /DMO/BOOK_SUP_28 related to the importing Travel ID
"! @parameter et_messages | Table of occurred messages
"!
FUNCTION /DMO/FLIGHT_TRAVEL_READ28.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_TRAVEL_ID) TYPE /DMO/TRAVEL_ID28
*" REFERENCE(IV_INCLUDE_BUFFER) TYPE ABAP_BOOLEAN DEFAULT
*" ABAP_TRUE
*" EXPORTING
*" REFERENCE(ES_TRAVEL) TYPE /DMO/TRAVEL28
*" REFERENCE(ET_BOOKING) TYPE /DMO/IF_FLIGHT_LEGACY28=>TT_BOOKING
*" REFERENCE(ET_BOOKING_SUPPLEMENT) TYPE
*" /DMO/IF_FLIGHT_LEGACY28=>TT_BOOKING_SUPPLEMENT
*" REFERENCE(ET_MESSAGES) TYPE /DMO/IF_FLIGHT_LEGACY28=>TT_MESSAGE
*"----------------------------------------------------------------------
CLEAR es_travel.
CLEAR et_booking.
CLEAR et_booking_supplement.
CLEAR et_messages.
/dmo/cl_flight_legacy28=>get_instance( )->get_travel( EXPORTING iv_travel_id = iv_travel_id
iv_include_buffer = iv_include_buffer
IMPORTING es_travel = es_travel
et_booking = et_booking
et_booking_supplement = et_booking_supplement
et_messages = DATA(lt_messages) ).
/dmo/cl_flight_legacy28=>get_instance( )->convert_messages( EXPORTING it_messages = lt_messages
IMPORTING et_messages = et_messages ).
ENDFUNCTION.
| [
40484,
1279,
71,
16,
29,
17614,
329,
18067,
257,
13524,
3556,
71,
16,
29,
198,
40484,
198,
40484,
1279,
79,
29,
198,
40484,
15553,
8265,
284,
651,
257,
2060,
13524,
4554,
351,
477,
3519,
4897,
654,
290,
198,
40484,
4897,
278,
8105,
3639,
3519,
284,
262,
33332,
13524,
4522,
13,
198,
40484,
7359,
79,
29,
198,
40484,
198,
40484,
198,
40484,
2488,
17143,
2357,
21628,
62,
35927,
62,
312,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
13524,
4522,
198,
40484,
2488,
17143,
2357,
21628,
62,
17256,
62,
22252,
220,
220,
220,
220,
930,
40348,
597,
2458,
326,
423,
407,
1865,
587,
5364,
198,
40484,
2488,
17143,
2357,
1658,
62,
35927,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
13524,
6060,
588,
1220,
35,
11770,
14,
51,
3861,
18697,
2078,
3519,
284,
262,
33332,
13524,
4522,
198,
40484,
2488,
17143,
2357,
2123,
62,
2070,
278,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
8655,
286,
4897,
654,
588,
1220,
35,
11770,
14,
39453,
2751,
2078,
3519,
284,
262,
33332,
13524,
4522,
198,
40484,
2488,
17143,
2357,
2123,
62,
2070,
278,
62,
18608,
1732,
930,
8655,
286,
4897,
278,
8105,
3639,
588,
1220,
35,
11770,
14,
39453,
62,
40331,
62,
2078,
3519,
284,
262,
33332,
13524,
4522,
198,
40484,
2488,
17143,
2357,
2123,
62,
37348,
1095,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
8655,
286,
5091,
6218,
198,
40484,
198,
42296,
4177,
2849,
1220,
35,
11770,
14,
3697,
9947,
62,
51,
3861,
18697,
62,
15675,
2078,
13,
198,
9,
1,
10097,
23031,
198,
9,
1,
9,
1,
14565,
26491,
25,
198,
9,
1,
220,
30023,
9863,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
3824,
62,
51,
3861,
18697,
62,
2389,
8,
41876,
220,
1220,
35,
11770,
14,
51,
3861,
18697,
62,
2389,
2078,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
3824,
62,
1268,
5097,
52,
7206,
62,
19499,
45746,
8,
41876,
220,
9564,
2969,
62,
33,
6684,
2538,
1565,
5550,
38865,
198,
9,
1,
220,
220,
220,
220,
220,
220,
9564,
2969,
62,
5446,
8924,
198,
9,
1,
220,
7788,
15490,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
1546,
62,
51,
3861,
18697,
8,
41876,
220,
1220,
35,
11770,
14,
51,
3861,
18697,
2078,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
2767,
62,
39453,
2751,
8,
41876,
220,
1220,
35,
11770,
14,
5064,
62,
3697,
9947,
62,
2538,
38,
43300,
2078,
14804,
15751,
62,
39453,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
2767,
62,
39453,
2751,
62,
40331,
16437,
10979,
8,
41876,
198,
9,
1,
220,
220,
220,
220,
220,
220,
220,
1220,
35,
11770,
14,
5064,
62,
3697,
9947,
62,
2538,
38,
43300,
2078,
14804,
15751,
62,
39453,
2751,
62,
40331,
16437,
10979,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
2767,
62,
44,
1546,
4090,
48075,
8,
41876,
220,
1220,
35,
11770,
14,
5064,
62,
3697,
9947,
62,
2538,
38,
43300,
2078,
14804,
15751,
62,
44,
1546,
4090,
8264,
198,
9,
1,
10097,
23031,
198,
220,
30301,
1503,
1658,
62,
35927,
13,
198,
220,
30301,
1503,
2123,
62,
2070,
278,
13,
198,
220,
30301,
1503,
2123,
62,
2070,
278,
62,
18608,
1732,
13,
198,
220,
30301,
1503,
2123,
62,
37348,
1095,
13,
628,
220,
1220,
67,
5908,
14,
565,
62,
22560,
62,
1455,
1590,
2078,
14804,
1136,
62,
39098,
7,
1267,
3784,
1136,
62,
35927,
7,
7788,
15490,
2751,
21628,
62,
35927,
62,
312,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
21628,
62,
35927,
62,
312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
17256,
62,
22252,
220,
220,
220,
220,
796,
21628,
62,
17256,
62,
22252,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
1658,
62,
35927,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
1658,
62,
35927,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2123,
62,
2070,
278,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
2123,
62,
2070,
278,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2123,
62,
2070,
278,
62,
18608,
1732,
796,
2123,
62,
2070,
278,
62,
18608,
1732,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2123,
62,
37348,
1095,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
42865,
7,
2528,
62,
37348,
1095,
8,
6739,
628,
220,
1220,
67,
5908,
14,
565,
62
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& Report zdemo_ain_cl33
*&---------------------------------------------------------------------*
*& This is the demo program written for book:
*& ALV grid in nutshell by Łukasz Pęgiel
*&---------------------------------------------------------------------*
REPORT zdemo_ain_cl33.
INCLUDE zdemo_ain_include_screen.
PARAMETERS: p_seltxt TYPE lvc_s_fcat-seltext LOWER CASE.
START-OF-SELECTION.
SELECT * UP TO 50 ROWS FROM spfli
INTO TABLE @DATA(flights).
DATA(grid) = NEW cl_gui_alv_grid(
i_parent = NEW cl_gui_custom_container( container_name = 'CC' )
).
DATA(fcat) = VALUE lvc_t_fcat(
( fieldname = 'CARRID' )
( fieldname = 'CONNID' seltext = p_seltxt )
( fieldname = 'COUNTRYFR' )
( fieldname = 'CITYFROM' )
( fieldname = 'AIRPFROM' )
( fieldname = 'COUNTRYTO' )
( fieldname = 'CITYTO' )
( fieldname = 'FLTIME' )
( fieldname = 'DEPTIME' )
( fieldname = 'FLTYPE' )
).
grid->set_table_for_first_display(
EXPORTING
is_layout = VALUE #( col_opt = abap_true )
CHANGING
it_fieldcatalog = fcat
it_outtab = flights
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
).
IF sy-subrc EQ 0.
CALL SCREEN 0100.
ENDIF.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
6358,
1976,
9536,
78,
62,
391,
62,
565,
2091,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
770,
318,
262,
13605,
1430,
3194,
329,
1492,
25,
198,
9,
5,
8355,
53,
10706,
287,
43875,
416,
25370,
223,
2724,
292,
89,
350,
128,
247,
70,
8207,
198,
9,
5,
10097,
30934,
9,
198,
2200,
15490,
1976,
9536,
78,
62,
391,
62,
565,
2091,
13,
198,
198,
1268,
5097,
52,
7206,
1976,
9536,
78,
62,
391,
62,
17256,
62,
9612,
13,
198,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
741,
14116,
41876,
300,
28435,
62,
82,
62,
69,
9246,
12,
741,
5239,
406,
36048,
42001,
13,
198,
198,
2257,
7227,
12,
19238,
12,
46506,
2849,
13,
628,
220,
33493,
1635,
15958,
5390,
2026,
371,
22845,
16034,
599,
2704,
72,
198,
220,
220,
220,
39319,
43679,
2488,
26947,
7,
2704,
2337,
737,
628,
220,
42865,
7,
25928,
8,
796,
12682,
537,
62,
48317,
62,
282,
85,
62,
25928,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
8000,
796,
12682,
537,
62,
48317,
62,
23144,
62,
34924,
7,
9290,
62,
3672,
796,
705,
4093,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6739,
198,
220,
42865,
7,
69,
9246,
8,
796,
26173,
8924,
300,
28435,
62,
83,
62,
69,
9246,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
20034,
49,
2389,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
10943,
45,
2389,
6,
384,
75,
5239,
796,
279,
62,
741,
14116,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
19385,
40405,
10913,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
9050,
10913,
2662,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
42149,
47,
10913,
2662,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
19385,
40405,
10468,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
34,
9050,
10468,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
3697,
34694,
6,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
7206,
11571,
12789,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
2214,
3672,
796,
705,
3697,
25216,
6,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6739,
198,
220,
10706,
3784,
2617,
62,
11487,
62,
1640,
62,
11085,
62,
13812,
7,
198,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
39786,
796,
26173,
8924,
1303,
7,
951,
62,
8738,
796,
450,
499,
62,
7942,
1267,
198,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
340,
62,
3245,
9246,
11794,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
277,
9246,
198,
220,
220,
220,
220,
220,
340,
62,
448,
8658,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
13956,
198,
220,
220,
220,
7788,
42006,
11053,
198,
220,
220,
220,
220,
220,
12515,
62,
17143,
2357,
62,
24011,
1883,
796,
352,
198,
220,
220,
220,
220,
220,
1430,
62,
18224,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
362,
198,
220,
220,
220,
220,
220,
1165,
62,
21834,
62,
6615,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
513,
198,
220,
220,
220,
220,
220,
440,
4221,
4877,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
604,
198,
220,
6739,
198,
220,
16876,
827,
12,
7266,
6015,
36529,
657,
13,
198,
220,
220,
220,
42815,
6374,
2200,
1677,
5534,
405,
13,
198,
220,
23578,
5064,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*"* use this source file for the definition and implementation of
*"* local helper classes, interface definitions and type
*"* declarations
CLASS lcl_data_receiver IMPLEMENTATION.
METHOD zif_abapgit_ci_view~display.
mt_result = ct_result.
ENDMETHOD.
ENDCLASS.
| [
9,
1,
9,
779,
428,
2723,
2393,
329,
262,
6770,
290,
7822,
286,
198,
9,
1,
9,
1957,
31904,
6097,
11,
7071,
17336,
290,
2099,
198,
9,
1,
9,
31713,
198,
198,
31631,
300,
565,
62,
7890,
62,
260,
39729,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
1976,
361,
62,
397,
499,
18300,
62,
979,
62,
1177,
93,
13812,
13,
628,
220,
220,
220,
45079,
62,
20274,
796,
269,
83,
62,
20274,
13,
628,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class ZSAPLINK_WD_APPLICATION definition
public
inheriting from ZSAPLINK
final
create public .
public section.
type-pools WDYN .
type-pools WDYWB .
methods CONSTRUCTOR
importing
!NAME type STRING .
methods CHECKEXISTS
redefinition .
methods CREATEIXMLDOCFROMOBJECT
redefinition .
methods CREATEOBJECTFROMIXMLDOC
redefinition .
protected section.
methods DELETEOBJECT
redefinition .
methods GETOBJECTTYPE
redefinition .
private section.
methods GET_APPLICATION
returning
value(APPLICATION) type ref to IF_WDY_MD_APPLICATION
raising
CX_WDY_MD_NOT_EXISTING
CX_WDY_MD_PERMISSION_FAILURE .
ENDCLASS.
CLASS ZSAPLINK_WD_APPLICATION IMPLEMENTATION.
method CHECKEXISTS.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
exists = abap_true.
DATA: application_name TYPE wdy_application_name.
data: application type wdy_application.
application_name = objname.
TRANSLATE application_name TO UPPER CASE.
SELECT SINGLE * FROM wdy_application INTO application
WHERE application_name = application_name.
IF sy-subrc NE 0.
CLEAR exists.
ENDIF.
endmethod.
METHOD constructor.
CALL METHOD super->constructor
EXPORTING
name = name.
nugget_level = 99. " WD Application should load last
ENDMETHOD.
method CREATEIXMLDOCFROMOBJECT.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
*xml nodes
DATA rootnode TYPE REF TO if_ixml_element.
DATA help_desc_node TYPE REF TO if_ixml_element.
DATA wdy_applicationt_node TYPE REF TO if_ixml_element.
DATA wdy_app_prop_node TYPE REF TO if_ixml_element.
DATA rc TYPE sysubrc.
DATA: application TYPE REF TO if_wdy_md_application.
TRY.
application = me->get_application( ).
CATCH cx_wdy_md_not_existing.
RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found.
RETURN.
CATCH cx_wdy_md_permission_failure.
RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found.
RETURN.
ENDTRY.
DATA definition TYPE wdy_application.
application->if_wdy_md_object~get_definition(
IMPORTING
definition = definition ).
* Create parent node
DATA _objtype TYPE string.
_objtype = getobjecttype( ).
rootnode = xmldoc->create_element( _objtype ).
setattributesfromstructure( node = rootnode structure = definition ).
DATA help_desc TYPE wdy_md_translatable_text.
help_desc = application->get_help_description( ).
rc = rootnode->set_attribute( name = 'help_desc_txt' value = help_desc ).
* copy wdy_applicationt
DATA wdy_applicationt_table TYPE STANDARD TABLE OF wdy_applicationt.
FIELD-SYMBOLS: <wdy_applicationt> TYPE wdy_applicationt.
SELECT * FROM wdy_applicationt INTO TABLE wdy_applicationt_table
WHERE application_name = definition-application_name.
LOOP AT wdy_applicationt_table ASSIGNING <wdy_applicationt>.
wdy_applicationt_node = xmldoc->create_element( 'wdy_applicationt' ).
setattributesfromstructure( node = wdy_applicationt_node structure = <wdy_applicationt> ).
rc = rootnode->append_child( wdy_applicationt_node ).
ENDLOOP.
* Application Properties
DATA itab_wdy_app_property TYPE wdy_app_property_table.
DATA prop TYPE REF TO if_wdy_md_application_property.
FIELD-SYMBOLS: <wdy_app_prop> TYPE wdy_app_property.
SELECT * FROM wdy_app_property INTO TABLE itab_wdy_app_property
WHERE application_name = definition-application_name.
LOOP AT itab_wdy_app_property ASSIGNING <wdy_app_prop>.
wdy_app_prop_node = xmldoc->create_element( 'wdy_app_prop' ).
setattributesfromstructure( node = wdy_app_prop_node structure = <wdy_app_prop> ).
rc = rootnode->append_child( wdy_app_prop_node ).
ENDLOOP.
*\--------------------------------------------------------------------/
rc = xmldoc->append_child( rootnode ).
ixmldocument = xmldoc.
endmethod.
method CREATEOBJECTFROMIXMLDOC.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
*
*
*xml nodes
DATA rootnode TYPE REF TO if_ixml_element.
* DATA wdy_application TYPE wdy_application.
DATA wdy_applicationt_node TYPE REF TO if_ixml_element.
DATA wdy_app_prop_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 _devclass TYPE devclass.
DATA checkexists TYPE flag.
DATA _objtype TYPE string.
DATA definition TYPE wdy_application.
DATA: application TYPE REF TO if_wdy_md_application.
_devclass = devclass.
_objtype = getobjecttype( ).
xmldoc = ixmldocument.
rootnode = xmldoc->find_from_name( _objtype ).
CALL METHOD getstructurefromattributes
EXPORTING
node = rootnode
preserveversion = abap_true
CHANGING
structure = definition.
objname = definition-application_name.
DATA help_desc TYPE wdy_md_translatable_text.
help_desc = rootnode->get_attribute( 'help_desc_txt' ).
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.
application = cl_wdy_md_application=>create(
name = definition-application_name
devclass = _devclass ).
* copy relevant parts of wdy_application
DATA component TYPE REF TO if_wdy_md_component.
CALL METHOD cl_wdy_md_component=>get_object_by_key
EXPORTING
name = definition-component
RECEIVING
component = component.
application->set_component( component ).
application->set_help_description( help_desc ).
application->set_help_link( definition-help_link ).
application->set_message_display_mode( definition-msg_disp_mode ).
DATA startup_plug TYPE REF TO if_wdy_md_inbound_plug.
DATA startup_view TYPE REF TO if_wdy_md_abstract_view.
startup_view = cl_wdy_md_view=>get_object_by_key(
component_name = definition-component
view_name = definition-startup_view ).
startup_plug = startup_view->get_inbound_plug( definition-startup_plug ).
application->set_startup_plug( startup_plug ).
application->save_to_database( ).
application->unlock( ).
application->reload( ).
* copy wdy_applicationt
DATA wdy_applicationt_table TYPE STANDARD TABLE OF wdy_applicationt.
DATA wdy_applicationt TYPE wdy_applicationt.
FREE: filter, iterator, node.
filter = xmldoc->create_filter_name( 'wdy_applicationt' ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node = node
preserveversion = abap_true
CHANGING
structure = wdy_applicationt.
APPEND wdy_applicationt TO wdy_applicationt_table.
node ?= iterator->get_next( ).
ENDWHILE.
MODIFY wdy_applicationt FROM TABLE wdy_applicationt_table.
* copy wdy_app_property
DATA wdy_app_property_table TYPE STANDARD TABLE OF wdy_app_property.
DATA wdy_app_property TYPE wdy_app_property.
FREE: filter, iterator, node.
filter = xmldoc->create_filter_name( 'wdy_app_prop' ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node = node
preserveversion = abap_true
CHANGING
structure = wdy_app_property.
APPEND wdy_app_property TO wdy_app_property_table.
node ?= iterator->get_next( ).
ENDWHILE.
MODIFY wdy_app_property FROM TABLE wdy_app_property_table.
cl_wdy_md_application=>generate_sicf(
EXPORTING
p_applname = definition-display_name
p_devclass = _devclass
EXCEPTIONS
invalid_name = 1
parent_not_existing = 2
enqueue_error = 3
node_already_existing = 4
transport_error = 5
tadir_error = 6
package_not_found = 7
alternate_name_exist = 8
error_occured = 9 ).
IF sy-subrc <> 0.
ENDIF.
COMMIT WORK.
name = objname.
endmethod.
method DELETEOBJECT.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
DATA: application TYPE REF TO if_wdy_md_application.
TRY.
DATA: application_name TYPE wdy_application_name.
application_name = objname.
TRANSLATE application_name TO UPPER CASE.
application = me->get_application( ).
CATCH cx_wdy_md_not_existing.
RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found.
RETURN.
CATCH cx_wdy_md_permission_failure.
RAISE EXCEPTION TYPE zcx_saplink EXPORTING textid = zcx_saplink=>not_found.
RETURN.
ENDTRY.
application->if_wdy_md_lockable_object~lock( ).
application->if_wdy_md_object~delete( ).
* cl_wdy_md_application=>delete_sicf( p_applname = application_name ).
application->if_wdy_md_lockable_object~save_to_database( ).
application->if_wdy_md_lockable_object~unlock( ).
endmethod.
method GETOBJECTTYPE.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
objecttype = wdyn_r3tr_application. "Web Dynpro Application
endmethod.
method GET_APPLICATION.
DATA: application_name TYPE wdy_application_name.
application_name = objname.
TRANSLATE application_name TO UPPER CASE.
DATA: tr_objtype TYPE trobjtype,
inactive_vers TYPE char1,
working_item TYPE char1,
l_obj_key TYPE e071-obj_name.
DATA: version TYPE r3state.
CALL FUNCTION 'RS_WORKING_AREA_INIT'.
tr_objtype = wdyn_r3tr_application.
l_obj_key = application_name.
TRANSLATE l_obj_key TO UPPER CASE. "#EC SYNTCHAR
CALL FUNCTION 'RS_OBJECT_IN_WORKING_AREA'
EXPORTING
object = tr_objtype
obj_name = l_obj_key
* GLOBAL_CHECK = ' '
mode = 'S' "Display
IMPORTING
object_is_work_item = working_item
object_inactive_version = inactive_vers.
IF working_item IS INITIAL.
version = wdywb_version_active.
ELSE.
version = wdywb_version_inactive.
ENDIF.
TRY.
CALL METHOD cl_wdy_md_application=>get_object_by_key
EXPORTING
name = application_name
version = version
RECEIVING
application = application.
CATCH cx_wdy_md_not_existing.
IF version = wdywb_version_active.
version = wdywb_version_inactive.
ELSE.
version = wdywb_version_active.
ENDIF.
TRY.
CALL METHOD cl_wdy_md_application=>get_object_by_key
EXPORTING
name = application_name
version = version
RECEIVING
application = application.
ENDTRY.
ENDTRY.
endmethod.
ENDCLASS.
| [
4871,
1168,
50,
2969,
43,
17248,
62,
22332,
62,
2969,
31484,
6234,
6770,
198,
220,
1171,
198,
220,
10639,
1780,
422,
1168,
50,
2969,
43,
17248,
198,
220,
2457,
198,
220,
2251,
1171,
764,
198,
198,
11377,
2665,
13,
198,
220,
2099,
12,
7742,
82,
48963,
40760,
764,
198,
220,
2099,
12,
7742,
82,
48963,
56,
45607,
764,
628,
220,
5050,
7102,
46126,
1581,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
20608,
2099,
19269,
2751,
764,
628,
220,
5050,
5870,
25171,
6369,
1797,
4694,
198,
220,
220,
220,
34087,
17750,
764,
198,
220,
5050,
29244,
6158,
10426,
5805,
38715,
10913,
2662,
9864,
23680,
198,
220,
220,
220,
34087,
17750,
764,
198,
220,
5050,
29244,
1404,
4720,
33,
23680,
10913,
2662,
10426,
5805,
38715,
198,
220,
220,
220,
34087,
17750,
764,
198,
24326,
2665,
13,
628,
220,
5050,
5550,
28882,
4720,
33,
23680,
198,
220,
220,
220,
34087,
17750,
764,
198,
220,
5050,
17151,
9864,
23680,
25216,
198,
220,
220,
220,
34087,
17750,
764,
198,
19734,
2665,
13,
628,
220,
5050,
17151,
62,
2969,
31484,
6234,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
2969,
31484,
6234,
8,
2099,
1006,
284,
16876,
62,
22332,
56,
62,
12740,
62,
2969,
31484,
6234,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
327,
55,
62,
22332,
56,
62,
12740,
62,
11929,
62,
6369,
8808,
2751,
198,
220,
220,
220,
220,
220,
327,
55,
62,
22332,
56,
62,
12740,
62,
18973,
44,
40373,
62,
7708,
4146,
11335,
764,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
50,
2969,
43,
17248,
62,
22332,
62,
2969,
31484,
6234,
30023,
2538,
10979,
6234,
13,
628,
198,
24396,
5870,
25171,
6369,
1797,
4694,
13,
198,
16208,
10097,
30934,
59,
198,
9,
91,
220,
220,
770,
2393,
318,
636,
286,
48323,
8726,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
48323,
8726,
318,
1479,
3788,
26,
345,
460,
17678,
4163,
340,
290,
14,
273,
13096,
220,
220,
930,
198,
9,
91,
220,
220,
340,
739,
262,
2846,
286,
262,
22961,
3611,
5094,
13789,
355,
3199,
930,
198,
9,
91,
220,
220,
416,
262,
3232,
10442,
5693,
26,
2035,
2196,
362,
286,
262,
13789,
11,
930,
198,
9,
91,
220,
220,
393,
357,
265,
534,
3038,
8,
597,
1568,
2196,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
48323,
8726,
318,
9387,
287,
262,
2911,
326,
340,
481,
307,
4465,
11,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
475,
42881,
15529,
34764,
56,
26,
1231,
772,
262,
17142,
18215,
286,
220,
220,
220,
930,
198,
9,
91,
220,
220,
34482,
3398,
1565,
5603,
25382,
393,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
13,
220,
4091,
262,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
22961,
3611,
5094,
13789,
329,
517,
3307,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
921,
815,
423,
2722,
257,
4866,
286,
262,
22961,
3611,
5094,
13789,
930,
198,
9,
91,
220,
220,
1863,
351,
48323,
8726,
26,
611,
407,
11,
3551,
284,
262,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
3232,
10442,
5693,
11,
3457,
1539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
91,
220,
220,
6885,
14021,
520,
11,
19383,
22343,
11,
6182,
11,
8779,
220,
657,
2481,
940,
12,
1485,
486,
220,
4916,
220,
220,
220,
220,
220,
220,
220,
220,
220,
930,
198,
9,
59,
10097,
30934,
14,
628,
628,
220,
7160,
796,
450,
499,
62,
7942,
13,
628,
220,
42865,
25,
3586,
62,
3672,
41876,
266,
9892,
62,
31438,
62,
3672,
13,
198,
220,
1366,
25,
3586,
2099,
266,
9892,
62,
31438,
13,
198,
220,
3586,
62,
3672,
796,
26181,
3672,
13,
198,
220,
48213,
8634,
6158,
3586,
62,
3672,
5390,
471,
10246,
1137,
42001,
13,
628,
220,
33493,
311,
2751,
2538,
1635,
16034,
266,
9892,
62,
31438,
39319,
3586,
198,
220,
220,
220,
33411,
3586,
62,
3672,
796,
3586,
62,
3672,
13,
198,
220,
16876,
827,
12,
7266,
6015,
10635,
657,
13,
198,
220,
220,
220,
30301,
1503,
7160,
13
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
INTERFACE zif_abapgit_oo_object_fnc PUBLIC.
TYPES: BEGIN OF ty_includes,
programm TYPE programm,
END OF ty_includes,
ty_includes_tt TYPE STANDARD TABLE OF ty_includes WITH DEFAULT KEY.
METHODS:
create
IMPORTING
iv_package TYPE devclass
iv_overwrite TYPE abap_bool DEFAULT abap_true
it_attributes TYPE zif_abapgit_definitions=>ty_obj_attribute_tt OPTIONAL
CHANGING
cg_properties TYPE any
RAISING
zcx_abapgit_exception,
generate_locals
IMPORTING
is_key TYPE seoclskey
iv_force TYPE abap_bool DEFAULT abap_true
it_local_definitions TYPE seop_source_string OPTIONAL
it_local_implementations TYPE seop_source_string OPTIONAL
it_local_macros TYPE seop_source_string OPTIONAL
it_local_test_classes TYPE seop_source_string OPTIONAL
RAISING
zcx_abapgit_exception,
deserialize_source
IMPORTING
is_key TYPE seoclskey
it_source TYPE zif_abapgit_definitions=>ty_string_tt
RAISING
zcx_abapgit_exception
cx_sy_dyn_call_error,
insert_text_pool
IMPORTING
iv_class_name TYPE seoclsname
it_text_pool TYPE textpool_table
iv_language TYPE spras
iv_state TYPE c DEFAULT 'I'
RAISING
zcx_abapgit_exception,
update_descriptions
IMPORTING
is_key TYPE seoclskey
it_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
add_to_activation_list
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
RAISING
zcx_abapgit_exception,
create_sotr
IMPORTING
iv_object_name TYPE sobj_name
iv_package TYPE devclass
ii_xml TYPE REF TO zif_abapgit_xml_input
RAISING
zcx_abapgit_exception,
create_documentation
IMPORTING
it_lines TYPE tlinetab
iv_object_name TYPE dokhl-object
iv_language TYPE spras
iv_no_masterlang TYPE abap_bool OPTIONAL
RAISING
zcx_abapgit_exception,
get_includes
IMPORTING
iv_object_name TYPE sobj_name
RETURNING
VALUE(rt_includes) TYPE ty_includes_tt
RAISING
zcx_abapgit_exception,
exists
IMPORTING
is_object_name TYPE seoclskey
RETURNING
VALUE(rv_exists) TYPE abap_bool,
serialize_abap
IMPORTING
is_class_key TYPE seoclskey
iv_type TYPE seop_include_ext_app OPTIONAL
RETURNING
VALUE(rt_source) TYPE zif_abapgit_definitions=>ty_string_tt
RAISING
zcx_abapgit_exception
cx_sy_dyn_call_error,
get_skip_test_classes
RETURNING
VALUE(rv_skip) TYPE abap_bool,
get_class_properties
IMPORTING
is_class_key TYPE seoclskey
RETURNING
VALUE(rs_class_properties) TYPE vseoclass
RAISING
zcx_abapgit_exception,
get_interface_properties
IMPORTING
is_interface_key TYPE seoclskey
RETURNING
VALUE(rs_interface_properties) TYPE vseointerf
RAISING
zcx_abapgit_exception,
read_text_pool
IMPORTING
iv_class_name TYPE seoclsname
iv_language TYPE spras
RETURNING
VALUE(rt_text_pool) TYPE textpool_table,
read_documentation
IMPORTING
iv_class_name TYPE seoclsname
iv_language TYPE spras
RETURNING
VALUE(rt_lines) TYPE tlinetab,
read_sotr
IMPORTING
iv_object_name TYPE sobj_name
ii_xml TYPE REF TO zif_abapgit_xml_output
RAISING
zcx_abapgit_exception,
read_descriptions
IMPORTING
iv_obejct_name TYPE seoclsname
iv_language TYPE spras OPTIONAL
RETURNING
VALUE(rt_descriptions) TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
delete
IMPORTING
is_deletion_key TYPE seoclskey
RAISING
zcx_abapgit_exception,
read_superclass
IMPORTING
iv_classname TYPE seoclsname
RETURNING
VALUE(rv_superclass) TYPE seoclsname,
read_attributes
IMPORTING
iv_object_name TYPE seoclsname
RETURNING
VALUE(rt_attributes) TYPE zif_abapgit_definitions=>ty_obj_attribute_tt.
ENDINTERFACE.
| [
41358,
49836,
1976,
361,
62,
397,
499,
18300,
62,
2238,
62,
15252,
62,
69,
10782,
44731,
13,
628,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
42813,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1430,
76,
41876,
1430,
76,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
42813,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1259,
62,
42813,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
42813,
13315,
5550,
38865,
35374,
13,
628,
220,
337,
36252,
50,
25,
198,
220,
220,
220,
2251,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26495,
220,
220,
220,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2502,
13564,
220,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
1078,
7657,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
26801,
62,
42348,
62,
926,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
269,
70,
62,
48310,
41876,
597,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
7716,
62,
17946,
874,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
420,
7278,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
3174,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
4299,
50101,
220,
220,
220,
220,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
320,
26908,
602,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
20285,
4951,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
12001,
62,
9288,
62,
37724,
220,
220,
220,
41876,
384,
404,
62,
10459,
62,
8841,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
748,
48499,
1096,
62,
10459,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
2539,
220,
220,
220,
41876,
384,
420,
7278,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
10459,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
8841,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
198,
220,
220,
220,
220,
220,
220,
220,
43213,
62,
1837,
62,
67,
2047,
62,
13345,
62,
18224,
11,
198,
220,
220,
220,
7550,
62,
5239,
62,
7742,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
4871,
62,
3672,
41876,
384,
420,
7278,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
5239,
62,
7742,
220,
41876,
2420,
7742,
62,
11487,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
16129,
220,
220,
41876,
7500,
292,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
5219,
220,
220,
220,
220,
220,
41876,
269,
5550,
38865,
705,
40,
6,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
4296,
62,
20147,
1968,
507,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
420,
7278,
2539,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
20147,
1968,
507,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
325,
420,
3361,
313,
87,
62,
926,
11,
198,
220,
220,
220,
751,
62,
1462,
62,
48545,
62,
4868,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
318,
62,
9186,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
2251,
62,
82,
313,
81,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
15252,
62,
3672,
41876,
27355,
73,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26495,
220,
220,
220,
220,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
220,
220,
21065,
62,
19875,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
19875,
62,
15414,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
11,
198,
220,
220,
220,
2251,
62,
22897,
341,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
6615,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
256,
2815,
316,
397,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
15252,
62,
3672,
220,
220,
41876,
466,
14636,
75,
12,
15252
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS cx_salv_error DEFINITION PUBLIC INHERITING FROM cx_static_check.
PUBLIC SECTION.
DATA object TYPE string.
DATA key TYPE string.
ENDCLASS.
CLASS cx_salv_error IMPLEMENTATION.
ENDCLASS. | [
31631,
43213,
62,
21680,
85,
62,
18224,
5550,
20032,
17941,
44731,
3268,
16879,
2043,
2751,
16034,
43213,
62,
12708,
62,
9122,
13,
198,
220,
44731,
44513,
13,
198,
220,
220,
220,
42865,
2134,
41876,
4731,
13,
198,
220,
220,
220,
42865,
1994,
41876,
4731,
13,
198,
10619,
31631,
13,
198,
198,
31631,
43213,
62,
21680,
85,
62,
18224,
30023,
2538,
10979,
6234,
13,
198,
198,
10619,
31631,
13
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
FUNCTION zsst_gtt_ote_fo_hdr_rel .
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_APPSYS) TYPE /SAPTRX/APPLSYSTEM
*" REFERENCE(I_APP_OBJ_TYPES) TYPE /SAPTRX/AOTYPES
*" REFERENCE(I_ALL_APPL_TABLES) TYPE TRXAS_TABCONTAINER
*" REFERENCE(I_APPTYPE_TAB) TYPE TRXAS_APPTYPE_TABS_WA
*" REFERENCE(I_APP_OBJECT) TYPE TRXAS_APPOBJ_CTAB_WA
*" EXPORTING
*" VALUE(E_RESULT) LIKE SY-BINPT
*" TABLES
*" C_LOGTABLE STRUCTURE BAPIRET2 OPTIONAL
*" EXCEPTIONS
*" PARAMETER_ERROR
*" RELEVANCE_DETERM_ERROR
*" STOP_PROCESSING
*"----------------------------------------------------------------------
DATA: lt_app_objects TYPE trxas_appobj_ctabs,
lo_udm_message TYPE REF TO cx_udm_message,
ls_bapiret TYPE bapiret2.
lt_app_objects = VALUE #( ( i_app_object ) ).
TRY.
e_result = lcl_ef_performer=>check_relevance(
is_definition = VALUE #( maintab = lif_sst_constants=>cs_tabledef-fo_header_new )
io_bo_factory = NEW lcl_tor_factory( )
iv_appsys = i_appsys
is_app_obj_types = i_app_obj_types
it_all_appl_tables = i_all_appl_tables
it_app_objects = lt_app_objects ).
CATCH cx_udm_message INTO lo_udm_message.
lcl_tools=>get_errors_log(
EXPORTING
io_umd_message = lo_udm_message
iv_appsys = i_appsys
IMPORTING
es_bapiret = ls_bapiret ).
APPEND ls_bapiret TO c_logtable.
CASE lo_udm_message->textid.
WHEN lif_ef_constants=>cs_errors-stop_processing.
RAISE stop_processing.
WHEN lif_ef_constants=>cs_errors-table_determination.
RAISE parameter_error.
ENDCASE.
ENDTRY.
ENDFUNCTION.
| [
42296,
4177,
2849,
1976,
82,
301,
62,
70,
926,
62,
1258,
62,
6513,
62,
71,
7109,
62,
2411,
764,
198,
9,
1,
10097,
23031,
198,
9,
1,
9,
1,
14565,
26491,
25,
198,
9,
1,
220,
30023,
9863,
2751,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
40,
62,
2969,
3705,
16309,
8,
41876,
220,
1220,
50,
2969,
5446,
55,
14,
2969,
6489,
23060,
25361,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
40,
62,
24805,
62,
9864,
41,
62,
9936,
47,
1546,
8,
41876,
220,
1220,
50,
2969,
5446,
55,
14,
32,
2394,
48232,
1546,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
40,
62,
7036,
62,
2969,
6489,
62,
5603,
9148,
1546,
8,
41876,
220,
7579,
55,
1921,
62,
5603,
2749,
1340,
30339,
1137,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
40,
62,
24805,
25216,
62,
5603,
33,
8,
41876,
220,
7579,
55,
1921,
62,
24805,
25216,
62,
5603,
4462,
62,
15543,
198,
9,
1,
220,
220,
220,
220,
4526,
24302,
18310,
7,
40,
62,
24805,
62,
9864,
23680,
8,
41876,
220,
7579,
55,
1921,
62,
24805,
9864,
41,
62,
4177,
6242,
62,
15543,
198,
9,
1,
220,
7788,
15490,
2751,
198,
9,
1,
220,
220,
220,
220,
26173,
8924,
7,
36,
62,
19535,
16724,
8,
34178,
220,
19704,
12,
33,
1268,
11571,
198,
9,
1,
220,
309,
6242,
28378,
198,
9,
1,
220,
220,
220,
220,
220,
327,
62,
25294,
38148,
19269,
18415,
11335,
220,
347,
17614,
26087,
17,
39852,
2849,
1847,
198,
9,
1,
220,
7788,
42006,
11053,
198,
9,
1,
220,
220,
220,
220,
220,
29463,
2390,
2767,
1137,
62,
24908,
198,
9,
1,
220,
220,
220,
220,
220,
49968,
53,
19240,
62,
35,
2767,
1137,
44,
62,
24908,
198,
9,
1,
220,
220,
220,
220,
220,
44934,
62,
4805,
4503,
7597,
2751,
198,
9,
1,
10097,
23031,
198,
220,
42865,
25,
300,
83,
62,
1324,
62,
48205,
41876,
491,
87,
292,
62,
1324,
26801,
62,
310,
8937,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2376,
62,
463,
76,
62,
20500,
41876,
4526,
37,
5390,
43213,
62,
463,
76,
62,
20500,
11,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
65,
499,
557,
83,
220,
220,
220,
220,
41876,
275,
499,
557,
83,
17,
13,
628,
220,
300,
83,
62,
1324,
62,
48205,
220,
796,
26173,
8924,
1303,
7,
357,
1312,
62,
1324,
62,
15252,
1267,
6739,
628,
220,
7579,
56,
13,
198,
220,
220,
220,
220,
220,
304,
62,
20274,
796,
300,
565,
62,
891,
62,
525,
16354,
14804,
9122,
62,
260,
2768,
590,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
46758,
220,
220,
220,
220,
220,
796,
26173,
8924,
1303,
7,
1388,
8658,
796,
3868,
62,
82,
301,
62,
9979,
1187,
14804,
6359,
62,
83,
4510,
891,
12,
6513,
62,
25677,
62,
3605,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
2127,
62,
69,
9548,
220,
220,
220,
220,
220,
796,
12682,
300,
565,
62,
13165,
62,
69,
9548,
7,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
1324,
17597,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
1312,
62,
1324,
17597,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
1324,
62,
26801,
62,
19199,
220,
220,
796,
1312,
62,
1324,
62,
26801,
62,
19199,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
439,
62,
1324,
75,
62,
83,
2977,
796,
1312,
62,
439,
62,
1324,
75,
62,
83,
2977,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
1324,
62,
48205,
220,
220,
220,
220,
796,
300,
83,
62,
1324,
62,
48205,
6739,
628,
220,
220,
220,
327,
11417,
43213,
62,
463,
76,
62,
20500,
39319,
2376,
62,
463,
76,
62,
20500,
13,
198,
220,
220,
220,
220,
220,
300,
565,
62,
31391,
14804,
1136,
62,
48277,
62,
6404,
7,
198,
220,
220,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
388,
67,
62,
20500,
796,
2376,
62,
463,
76,
62,
20500,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
1324,
17597,
220,
220,
220,
220,
220,
796,
1312,
62,
1324,
17597,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1658,
62,
65,
499,
557,
83,
220,
220,
220,
220,
796,
43979,
62,
65,
499,
557,
83,
6739,
628,
220,
220,
220,
220,
220,
43504,
10619,
43979,
62,
65,
499,
557,
83,
5390,
269,
62,
6404,
11487,
13,
198,
220,
220,
220,
220,
220,
42001,
2376,
62,
463,
76,
62,
20500,
3784,
5239,
312,
13,
198,
220,
220,
220,
220,
220,
220,
220,
42099,
3868,
62,
891,
62,
9979,
1187,
14804,
6359,
62,
48277,
12,
11338,
62,
36948,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17926,
24352,
2245,
62,
36948,
13,
198,
220,
220,
220,
220,
220,
220,
220,
42099,
3868,
62,
891,
62,
9979,
1187,
14804,
6359,
62,
48277,
12,
11487,
62,
40869,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17926,
24352,
11507,
62,
18224,
13,
198,
220,
220,
220,
220,
220,
23578,
34,
11159,
13,
198,
220,
23578,
40405,
13,
198,
1677,
8068,
4944,
4177,
2849,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_object_scp1 DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
TYPES:
BEGIN OF ty_scp1,
scprattr TYPE scprattr,
scprtext TYPE STANDARD TABLE OF scprtext WITH DEFAULT KEY,
scprvals TYPE STANDARD TABLE OF scprvals WITH DEFAULT KEY,
scprvall TYPE STANDARD TABLE OF scprvall WITH DEFAULT KEY,
scprreca TYPE STANDARD TABLE OF scprreca WITH DEFAULT KEY,
scprfldv TYPE STANDARD TABLE OF scprfldv WITH DEFAULT KEY,
subprofs TYPE STANDARD TABLE OF scprpprl WITH DEFAULT KEY,
END OF ty_scp1 .
METHODS dequeue .
METHODS enqueue
RAISING
zcx_abapgit_exception .
METHODS save
IMPORTING
!is_scp1 TYPE ty_scp1
RAISING
zcx_abapgit_exception .
METHODS save_hier
IMPORTING
!is_scp1 TYPE ty_scp1
RAISING
zcx_abapgit_exception .
METHODS adjust_inbound
CHANGING
!cs_scp1 TYPE ty_scp1 .
METHODS adjust_outbound
CHANGING
!cs_scp1 TYPE ty_scp1 .
METHODS load
CHANGING
!cs_scp1 TYPE ty_scp1 .
METHODS load_hier
CHANGING
!cs_scp1 TYPE ty_scp1 .
METHODS call_delete_fms
IMPORTING
!iv_profile_id TYPE scpr_id
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ABAPGIT_OBJECT_SCP1 IMPLEMENTATION.
METHOD adjust_inbound.
FIELD-SYMBOLS: <ls_scprvals> TYPE scprvals,
<ls_scprreca> TYPE scprreca,
<ls_scprvall> TYPE scprvall.
* back to internal format
LOOP AT cs_scp1-scprvals ASSIGNING <ls_scprvals>.
SHIFT <ls_scprvals>-recnumber RIGHT DELETING TRAILING space.
ENDLOOP.
LOOP AT cs_scp1-scprreca ASSIGNING <ls_scprreca>.
SHIFT <ls_scprreca>-recnumber RIGHT DELETING TRAILING space.
ENDLOOP.
LOOP AT cs_scp1-scprvall ASSIGNING <ls_scprvall>.
SHIFT <ls_scprvall>-recnumber RIGHT DELETING TRAILING space.
ENDLOOP.
ENDMETHOD.
METHOD adjust_outbound.
FIELD-SYMBOLS: <ls_scprvals> TYPE scprvals,
<ls_scprreca> TYPE scprreca,
<ls_scprvall> TYPE scprvall.
* normalize the XML
LOOP AT cs_scp1-scprvals ASSIGNING <ls_scprvals>.
CONDENSE <ls_scprvals>-recnumber.
ENDLOOP.
LOOP AT cs_scp1-scprreca ASSIGNING <ls_scprreca>.
CONDENSE <ls_scprreca>-recnumber.
ENDLOOP.
LOOP AT cs_scp1-scprvall ASSIGNING <ls_scprvall>.
CONDENSE <ls_scprvall>-recnumber.
ENDLOOP.
ENDMETHOD.
METHOD call_delete_fms.
CONSTANTS:
lc_version_new TYPE c VALUE 'N', "Include SCPRINTCONST version_new
lc_operation_delete TYPE c VALUE 'D'.
DATA:
lv_profile_type TYPE scprattr-type,
lt_fatherprofiles TYPE STANDARD TABLE OF scproprof WITH DEFAULT KEY,
ls_fatherprofile TYPE scproprof.
CALL FUNCTION 'SCPR_DB_ATTR_GET_DETAIL'
EXPORTING
profid = iv_profile_id
version = lc_version_new
IMPORTING
proftype = lv_profile_type
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'SCPR_PRSET_DB_USED_IN'
EXPORTING
profid = iv_profile_id
version = lc_version_new
TABLES
profiles = lt_fatherprofiles.
ls_fatherprofile-id = iv_profile_id.
APPEND ls_fatherprofile TO lt_fatherprofiles.
CALL FUNCTION 'SCPR_CT_TRANSPORT_ENTRIES'
TABLES
profids = lt_fatherprofiles
EXCEPTIONS
error_in_transport_layer = 1
user_abort = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |error while deleting SCP1 - TRANSPORT, { sy-subrc }| ).
ENDIF.
CALL FUNCTION 'SCPR_PRSET_DB_DELETE_ALL'
EXPORTING
profid = iv_profile_id
proftype = lv_profile_type
TABLES
fatherprofs = lt_fatherprofiles
EXCEPTIONS
user_abort = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |error while deleting SCP1 - DB_DELETE, { sy-subrc }| ).
ENDIF.
CALL FUNCTION 'SCPR_MEM_SCPR_ACTIONS_ADD'
EXPORTING
bcset_id = iv_profile_id
operation = lc_operation_delete.
ENDMETHOD.
METHOD dequeue.
DATA: lv_id TYPE scpr_id.
lv_id = ms_item-obj_name.
CALL FUNCTION 'SCPR_SV_DEQUEUE_BCSET'
EXPORTING
bcset_id = lv_id.
ENDMETHOD.
METHOD enqueue.
DATA: lv_id TYPE scpr_id.
lv_id = ms_item-obj_name.
CALL FUNCTION 'SCPR_SV_ENQUEUE_BCSET'
EXPORTING
bcset_id = lv_id
EXCEPTIONS
is_already_locked = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |SCP1 locking error| ).
ENDIF.
ENDMETHOD.
METHOD load.
CALL FUNCTION 'SCPR_TEMPL_DB_VALS_GET_DETAIL'
EXPORTING
profid = cs_scp1-scprattr-id
category = cs_scp1-scprattr-category
TABLES
values = cs_scp1-scprvals
valuesl = cs_scp1-scprvall
recattr = cs_scp1-scprreca.
CALL FUNCTION 'SCPR_TEMPL_DB_FLDTXTVAR_GET'
EXPORTING
bcset_id = cs_scp1-scprattr-id
category = cs_scp1-scprattr-category
TABLES
it_fldv = cs_scp1-scprfldv.
ENDMETHOD.
METHOD load_hier.
CALL FUNCTION 'SCPR_PRSET_DB_SUBP_GET_DETAIL'
EXPORTING
profid = cs_scp1-scprattr-id
category = cs_scp1-scprattr-category
TABLES
subprofs = cs_scp1-subprofs.
ENDMETHOD.
METHOD save.
DATA: ls_scp1 TYPE ty_scp1,
ls_text TYPE scprtext.
* copy everything to local, the function module changes the values
ls_scp1 = is_scp1.
READ TABLE ls_scp1-scprtext INTO ls_text WITH KEY langu = mv_language. "#EC CI_SUBRC
CALL FUNCTION 'SCPR_TEMPL_MN_TEMPLATE_SAVE'
EXPORTING
profid = ls_scp1-scprattr-id
proftext = ls_text-text
category = ls_scp1-scprattr-category
cli_dep = ls_scp1-scprattr-cli_dep
cli_cas = ls_scp1-scprattr-cli_cas
reftype = ls_scp1-scprattr-reftype
refname = ls_scp1-scprattr-refname
orgid = ls_scp1-scprattr-orgid
component = ls_scp1-scprattr-component
minrelease = ls_scp1-scprattr-minrelease
maxrelease = ls_scp1-scprattr-maxrelease
act_info = ls_scp1-scprattr-act_info
bcset_type = ls_scp1-scprattr-type
fldtxtvar_supplied = 'YES'
with_transp_insert = abap_false
with_progress_indicator = abap_false
remove_denied_data = abap_true
ask_for_cont_after_remove = abap_true
TABLES
values = ls_scp1-scprvals
valuesl = ls_scp1-scprvall
recattr = ls_scp1-scprreca
it_fldv = ls_scp1-scprfldv
texts = ls_scp1-scprtext
EXCEPTIONS
user_abort = 1
error_in_transport_layer = 2
inconsistent_data = 3
database_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error saving SCP1, { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD save_hier.
DATA: ls_scp1 TYPE ty_scp1,
ls_profs LIKE LINE OF ls_scp1-subprofs,
lt_sub TYPE STANDARD TABLE OF scproprof WITH DEFAULT KEY,
ls_sub LIKE LINE OF lt_sub,
ls_text TYPE scprtext.
* copy everything to local, the function module changes the values
ls_scp1 = is_scp1.
READ TABLE ls_scp1-scprtext INTO ls_text WITH KEY langu = mv_language. "#EC CI_SUBRC
* see fm SCPR_PRSET_DB_STORE, only this field and sequence is used
LOOP AT ls_scp1-subprofs INTO ls_profs.
ls_sub-id = ls_profs-subprofile.
APPEND ls_sub TO lt_sub.
ENDLOOP.
CALL FUNCTION 'SCPR_PRSET_MN_BCSET_SAVE'
EXPORTING
profid = ls_scp1-scprattr-id
proftext = ls_text-text
category = ls_scp1-scprattr-category
cli_dep = ls_scp1-scprattr-cli_dep
cli_cas = ls_scp1-scprattr-cli_cas
reftype = ls_scp1-scprattr-reftype
refname = ls_scp1-scprattr-refname
orgid = ls_scp1-scprattr-orgid
component = ls_scp1-scprattr-component
minrelease = ls_scp1-scprattr-minrelease
maxrelease = ls_scp1-scprattr-maxrelease
act_info = ls_scp1-scprattr-act_info
with_transp_insert = abap_false
with_progress_indicator = abap_false
TABLES
subprofs = lt_sub
texts = ls_scp1-scprtext
EXCEPTIONS
user_abort = 1
error_in_transport_layer = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error saving SCP1, { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
SELECT SINGLE modifier INTO rv_user FROM scprattr
WHERE id = ms_item-obj_name
AND version = 'N'.
IF sy-subrc <> 0 OR rv_user IS INITIAL.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_profile_id TYPE scpr_id.
lv_profile_id = ms_item-obj_name.
enqueue( ).
call_delete_fms( lv_profile_id ).
dequeue( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: ls_scp1 TYPE ty_scp1.
io_xml->read(
EXPORTING iv_name = 'SCP1'
CHANGING cg_data = ls_scp1 ).
adjust_inbound( CHANGING cs_scp1 = ls_scp1 ).
IF ls_scp1-scprattr-type = 'TMP'.
save_hier( ls_scp1 ).
ELSE.
save( ls_scp1 ).
ENDIF.
dequeue( ).
tadir_insert( iv_package ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_rc TYPE sy-subrc,
lv_profid TYPE scprattr-id.
lv_profid = ms_item-obj_name.
CALL FUNCTION 'SCPR_BCSET_EXISTS'
EXPORTING
profid = lv_profid
IMPORTING
rc = lv_rc.
rv_bool = boolc( lv_rc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-late TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: lv_display_only TYPE scpr_txt20,
lv_bcset_id TYPE scpr_id.
lv_display_only = abap_false.
lv_bcset_id = ms_item-obj_name.
EXPORT scpr3_display_only = lv_display_only
scpr3_bcset_id = lv_bcset_id
TO MEMORY ID 'SCPR3_PARAMETER'.
SUBMIT scpr3 AND RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_scp1 TYPE ty_scp1.
ls_scp1-scprattr-id = ms_item-obj_name.
CALL FUNCTION 'SCPR_DB_ATTR_GET_DETAIL'
EXPORTING
profid = ls_scp1-scprattr-id
IMPORTING
proftype = ls_scp1-scprattr-type
cli_dep = ls_scp1-scprattr-cli_dep
cli_cas = ls_scp1-scprattr-cli_cas
reftype = ls_scp1-scprattr-reftype
refname = ls_scp1-scprattr-refname
component = ls_scp1-scprattr-component
minrelease = ls_scp1-scprattr-minrelease
maxrelease = ls_scp1-scprattr-maxrelease
orgid = ls_scp1-scprattr-orgid
act_info = ls_scp1-scprattr-act_info.
CALL FUNCTION 'SCPR_TEXT_GET'
EXPORTING
profid = ls_scp1-scprattr-id
category = ls_scp1-scprattr-category
TABLES
texts = ls_scp1-scprtext
EXCEPTIONS
no_text_found = 1.
IF ls_scp1-scprattr-type = 'TMP'.
load_hier( CHANGING cs_scp1 = ls_scp1 ).
ELSE.
load( CHANGING cs_scp1 = ls_scp1 ).
ENDIF.
adjust_outbound( CHANGING cs_scp1 = ls_scp1 ).
io_xml->add(
iv_name = 'SCP1'
ig_data = ls_scp1 ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
15252,
62,
1416,
79,
16,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48205,
62,
16668,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
15252,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
1416,
79,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
629,
1050,
35226,
41876,
629,
1050,
35226,
11,
198,
220,
220,
220,
220,
220,
220,
220,
629,
1050,
5239,
41876,
49053,
9795,
43679,
3963,
629,
1050,
5239,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
629,
1050,
12786,
41876,
49053,
9795,
43679,
3963,
629,
1050,
12786,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
629,
1050,
85,
439,
41876,
49053,
9795,
43679,
3963,
629,
1050,
85,
439,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
629,
1050,
260,
6888,
41876,
49053,
9795,
43679,
3963,
629,
1050,
260,
6888,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
629,
1050,
69,
335,
85,
41876,
49053,
9795,
43679,
3963,
629,
1050,
69,
335,
85,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
220,
220,
850,
5577,
82,
41876,
49053,
9795,
43679,
3963,
629,
1050,
381,
45895,
13315,
5550,
38865,
35374,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
1416,
79,
16,
764,
628,
220,
220,
220,
337,
36252,
50,
390,
36560,
764,
198,
220,
220,
220,
337,
36252,
50,
551,
36560,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
3613,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
1416,
79,
16,
41876,
1259,
62,
1416,
79,
16,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
3613,
62,
71,
959,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
1416,
79,
16,
41876,
1259,
62,
1416,
79,
16,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
4532,
62,
259,
7784,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
6359,
62,
1416,
79,
16,
41876,
1259,
62,
1416,
79,
16,
764,
198,
220,
220,
220,
337,
36252,
50,
4532,
62,
448,
7784,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
6359,
62,
1416,
79,
16,
41876,
1259,
62,
1416,
79,
16,
764,
198,
220,
220,
220,
337,
36252,
50,
3440,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
6359,
62,
1416,
79,
16,
41876,
1259,
62,
1416,
79,
16,
764,
198,
220,
220,
220,
337,
36252,
50,
3440,
62,
71,
959,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
6359,
62,
1416,
79,
16,
41876,
1259,
62,
1416,
79,
16,
764,
198,
220,
220,
220,
337,
36252,
50,
869,
62,
33678,
62,
69,
907,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
13317,
62,
312,
41876,
629,
1050,
62,
312,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
9864,
23680,
62,
48956,
16,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
4532,
62,
259,
7784,
13,
628,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
25,
1279,
7278,
62,
1416,
1050,
12786,
29,
41876,
629,
1050,
12786,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1279,
7278,
62,
1416,
1050,
260,
6888,
29,
41876,
629,
1050,
260,
6888,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1279,
7278,
62,
1416,
1050,
85,
439,
29,
41876,
629,
1050,
85,
439,
13,
198,
198,
9,
736,
284,
5387,
5794,
198,
220,
220,
220,
17579,
3185,
5161,
50115,
62,
1416,
79,
16,
12,
1416,
1050,
12786,
24994,
3528,
15871,
1279,
7278,
62,
1416,
1050,
12786,
28401,
198,
220,
220,
220,
220,
220,
6006,
32297,
1279,
7278,
62,
1416,
1050,
12786,
29,
12,
8344,
17618,
33621,
5550,
28882,
2751,
29125,
4146,
2751,
2272,
13,
198,
220,
220,
220,
23578,
21982,
3185,
13,
198,
220,
220,
220,
17579,
3185,
5161,
50115,
62,
1416,
79,
16,
12,
1416,
1050,
260,
6888,
24994,
3528,
15871,
1279,
7278,
62,
1416,
1050,
260,
6888,
28401,
198,
220,
220,
220,
220,
220,
6006,
32297,
1279,
7278,
62,
1416,
1050,
260,
6888,
29,
12,
8344,
17618,
33621,
5550,
28882,
2751,
29125,
4146,
2751,
2272,
13,
198,
220,
220,
220,
23578,
21982,
3185,
13,
198,
220,
220,
220,
17579,
3185,
5161,
50115,
62,
1416,
79,
16,
12,
1416,
1050,
85,
439,
24994,
3528,
15871,
1279,
7278,
62,
1416,
1050,
85,
439,
28401,
198,
220,
220,
220,
220,
220,
6006,
32297,
1279,
7278,
62,
1416,
1050,
85,
439,
29,
12,
8344,
17618,
33621,
5550,
28882,
2751,
29125,
4146,
2751,
2272,
13,
198,
220,
220,
220,
23578,
21982,
3185,
13,
628,
220,
23578,
49273,
13,
628,
198,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
INTERFACE zif_mqtt_packet PUBLIC .
TYPES ty_qos TYPE i .
TYPES:
ty_packet_identifier TYPE x LENGTH 2 .
TYPES ty_topic TYPE string .
TYPES:
BEGIN OF ty_message,
topic TYPE ty_topic,
message TYPE xstring,
END OF ty_message .
TYPES:
ty_topics_tt TYPE STANDARD TABLE OF ty_topic WITH EMPTY KEY .
CONSTANTS:
BEGIN OF gc_qos,
at_most_once TYPE ty_qos VALUE 0,
at_least_once TYPE ty_qos VALUE 1,
exactly_once TYPE ty_qos VALUE 2,
END OF gc_qos .
METHODS get_type
RETURNING
VALUE(rv_value) TYPE i .
METHODS encode
RETURNING
VALUE(ro_stream) TYPE REF TO zcl_mqtt_stream .
METHODS decode
IMPORTING
!io_stream TYPE REF TO zcl_mqtt_stream .
ENDINTERFACE.
| [
41358,
49836,
1976,
361,
62,
76,
80,
926,
62,
8002,
316,
44731,
764,
628,
220,
24412,
47,
1546,
1259,
62,
80,
418,
41876,
1312,
764,
198,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
1259,
62,
8002,
316,
62,
738,
7483,
41876,
2124,
406,
49494,
362,
764,
198,
220,
24412,
47,
1546,
1259,
62,
26652,
41876,
4731,
764,
198,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
347,
43312,
3963,
1259,
62,
20500,
11,
198,
220,
220,
220,
220,
220,
7243,
220,
220,
41876,
1259,
62,
26652,
11,
198,
220,
220,
220,
220,
220,
3275,
41876,
2124,
8841,
11,
198,
220,
220,
220,
23578,
3963,
1259,
62,
20500,
764,
198,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
1259,
62,
4852,
873,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
26652,
13315,
38144,
9936,
35374,
764,
628,
220,
7102,
2257,
1565,
4694,
25,
198,
220,
220,
220,
347,
43312,
3963,
308,
66,
62,
80,
418,
11,
198,
220,
220,
220,
220,
220,
379,
62,
1712,
62,
27078,
220,
41876,
1259,
62,
80,
418,
26173,
8924,
657,
11,
198,
220,
220,
220,
220,
220,
379,
62,
293,
459,
62,
27078,
41876,
1259,
62,
80,
418,
26173,
8924,
352,
11,
198,
220,
220,
220,
220,
220,
3446,
62,
27078,
220,
41876,
1259,
62,
80,
418,
26173,
8924,
362,
11,
198,
220,
220,
220,
23578,
3963,
308,
66,
62,
80,
418,
764,
628,
220,
337,
36252,
50,
651,
62,
4906,
198,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
8367,
8,
41876,
1312,
764,
198,
220,
337,
36252,
50,
37773,
198,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
5532,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
76,
80,
926,
62,
5532,
764,
198,
220,
337,
36252,
50,
36899,
198,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
5145,
952,
62,
5532,
41876,
4526,
37,
5390,
1976,
565,
62,
76,
80,
926,
62,
5532,
764,
198,
10619,
41358,
49836,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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check~is_valid.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_ADV_IMEI_CHECK IMPLEMENTATION.
METHOD zif_adv_check~is_valid.
DATA: imei_index TYPE i,
sum TYPE i.
DATA(imei_string) = CONV string( data ).
IF NOT contains( val = imei_string regex = '^\d{15}$' ).
RETURN.
ENDIF.
*https://en.wikipedia.org/wiki/Luhn_algorithm
DO strlen( imei_string ) TIMES.
DATA(digit) = CONV int4( imei_string+imei_index(1) ).
IF imei_index MOD 2 = 1.
digit = digit * 2.
ENDIF.
IF digit > 9.
digit = digit - 9.
ENDIF.
sum = sum + digit.
imei_index = imei_index + 1.
ENDDO.
IF sum MOD 10 = 0.
valid = abap_true.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
32225,
62,
45519,
62,
9122,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
25,
1976,
361,
62,
32225,
62,
9122,
13,
198,
220,
220,
220,
8355,
43429,
1546,
25,
318,
62,
12102,
7473,
1976,
361,
62,
32225,
62,
9122,
93,
271,
62,
12102,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
2885,
53,
62,
12789,
40,
62,
50084,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
32225,
62,
9122,
93,
271,
62,
12102,
13,
628,
220,
220,
220,
42865,
25,
220,
45519,
62,
9630,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2160,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
13,
628,
220,
220,
220,
42865,
7,
45519,
62,
8841,
8,
796,
7102,
53,
4731,
7,
1366,
6739,
628,
220,
220,
220,
16876,
5626,
4909,
7,
1188,
796,
220,
45519,
62,
8841,
40364,
796,
705,
61,
59,
67,
90,
1314,
92,
3,
6,
6739,
198,
220,
220,
220,
220,
220,
30826,
27064,
13,
198,
220,
220,
220,
23578,
5064,
13,
198,
198,
9,
5450,
1378,
268,
13,
31266,
13,
2398,
14,
15466,
14,
43,
7456,
77,
62,
282,
42289,
198,
220,
220,
220,
8410,
965,
11925,
7,
220,
45519,
62,
8841,
1267,
31742,
1546,
13,
198,
220,
220,
220,
220,
220,
42865,
7,
27003,
8,
220,
796,
7102,
53,
493,
19,
7,
220,
45519,
62,
8841,
10,
45519,
62,
9630,
7,
16,
8,
6739,
198,
220,
220,
220,
220,
220,
16876,
220,
45519,
62,
9630,
19164,
362,
796,
352,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16839,
796,
16839,
1635,
362,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
220,
220,
16876,
16839,
1875,
860,
13,
198,
220,
220,
220,
220,
220,
220,
220,
16839,
796,
16839,
532,
860,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
220,
220,
2160,
796,
2160,
1343,
16839,
13,
198,
220,
220,
220,
220,
220,
220,
45519,
62,
9630,
796,
220,
45519,
62,
9630,
1343,
352,
13,
198,
220,
220,
220,
23578,
18227,
13,
628,
220,
220,
220,
16876,
2160,
19164,
838,
796,
657,
13,
198,
220,
220,
220,
220,
220,
4938,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
23578,
49273,
13,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class ZCL_JSON_HANDLER definition
public
create public .
public section.
type-pools ABAP .
type-pools JS .
*"* public components of class ZCL_JSON_HANDLER
*"* do not include other source files here!!!
interfaces IF_HTTP_EXTENSION .
constants XNL type ABAP_CHAR1 value %_NEWLINE ##NO_TEXT.
constants XCRLF type ABAP_CR_LF value %_CR_LF ##NO_TEXT.
data MY_SERVICE type STRING .
data MY_URL type STRING .
class-methods ABAP2JSON
importing
!ABAP_DATA type DATA
!NAME type STRING optional
!UPCASE type XFELD optional
!CAMELCASE type XFELD optional
!CAMELCASE_NAMES type STRINGTAB optional
returning
value(JSON_STRING) type STRING
exceptions
ERROR_IN_DATA_DESCRIPTION .
class-methods ABAP2PERL
importing
!ABAP_DATA type DATA
!NAME type STRING optional
!UPCASE type XFELD optional
returning
value(PERL_STRING) type STRING
exceptions
ERROR_IN_DATA_DESCRIPTION .
class-methods ABAP2XML
importing
!ABAP_DATA type DATA
!NAME type STRING optional
!WITH_XML_HEADER type ABAP_BOOL default ABAP_FALSE
!UPCASE type XFELD optional
!NAME_ATR type STRING optional
returning
value(XML_STRING) type STRING .
class-methods ABAP2YAML
importing
!ABAP_DATA type DATA
!NAME type STRING optional
!UPCASE type XFELD optional
!Y_LEVEL type I default 0
!S_INDEX type I default 0
!FIRST_ROW type XFELD optional
!DONT_INDENT type XFELD optional
returning
value(YAML_STRING) type STRING
exceptions
ERROR_IN_DATA_DESCRIPTION .
class-methods BUILD_PARAMS
importing
!FUNCTION_NAME type RS38L_FNAM
exporting
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
!EXCEPTAB type ABAP_FUNC_EXCPBIND_TAB
!PARAMS type ANY
exceptions
INVALID_FUNCTION
UNSUPPORTED_PARAM_TYPE .
class-methods JSON2ABAP
importing
!JSON_STRING type STRING optional
!VAR_NAME type STRING optional
!PROPERTY_PATH type STRING default 'json_obj'
exporting
value(PROPERTY_TABLE) type JS_PROPERTY_TAB
changing
!JS_OBJECT type ref to CL_JAVA_SCRIPT optional
value(ABAP_DATA) type ANY optional
raising
ZCX_JSON .
class-methods JSON_DESERIALIZE
importing
!JSON type STRING
changing
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
raising
ZCX_JSON .
methods NOTES
returning
value(TEXT) type STRING .
class-methods SERIALIZE_JSON
importing
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
!PARAMS type ANY optional
!EXCEPTAB type ABAP_FUNC_EXCPBIND_TAB optional
!SHOW_IMPP type ABAP_BOOL optional
!JSONP type STRING optional
!LOWERCASE type ABAP_BOOL default ABAP_TRUE
!CAMELCASE type ABAP_BOOL default ABAP_FALSE
!CAMELCASE_NAMES type STRINGTAB optional
exporting
!O_STRING type STRING .
class-methods SERIALIZE_PERL
importing
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
!PARAMS type ANY optional
!EXCEPTAB type ABAP_FUNC_EXCPBIND_TAB optional
!SHOW_IMPP type ABAP_BOOL optional
!JSONP type STRING optional
!LOWERCASE type ABAP_BOOL default ABAP_FALSE
!FUNCNAME type RS38L_FNAM
exporting
!PERL_STRING type STRING .
class-methods SERIALIZE_XML
importing
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
!PARAMS type ANY optional
!EXCEPTAB type ABAP_FUNC_EXCPBIND_TAB optional
!SHOW_IMPP type ABAP_BOOL optional
!JSONP type STRING optional
!FUNCNAME type RS38L_FNAM
!LOWERCASE type ABAP_BOOL default ABAP_FALSE
!FORMAT type STRING optional
exporting
!O_STRING type STRING .
class-methods SERIALIZE_YAML
importing
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
!PARAMS type ANY optional
!EXCEPTAB type ABAP_FUNC_EXCPBIND_TAB optional
!SHOW_IMPP type ABAP_BOOL optional
!JSONP type STRING optional
!LOWERCASE type ABAP_BOOL default ABAP_FALSE
exporting
!YAML_STRING type STRING .
class-methods DESERIALIZE_ID
importing
!JSON type STRING
changing
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
raising
ZCX_JSON .
class-methods SERIALIZE_ID
importing
!PARAMTAB type ABAP_FUNC_PARMBIND_TAB
!PARAMS type ANY optional
!EXCEPTAB type ABAP_FUNC_EXCPBIND_TAB optional
!SHOW_IMPP type ABAP_BOOL optional
!JSONP type STRING optional
!LOWERCASE type ABAP_BOOL default ABAP_FALSE
!FORMAT type STRING default 'JSON'
!FUNCNAME type RS38L_FNAM optional
!CAMELCASE type ABAP_BOOL default ABAP_FALSE
exporting
!O_STRING type STRING
raising
ZCX_JSON .
protected section.
*"* protected components of class ZCL_JSON_HANDLER
*"* do not include other source files here!!!
private section.
*"* private components of class ZCL_JSON_HANDLER
*"* do not include other source files here!!!
ENDCLASS.
CLASS ZCL_JSON_HANDLER IMPLEMENTATION.
method abap2json.
*/**********************************************/*
*/ This method takes any ABAP data variable and /*
*/ returns a string representing its value in /*
*/ JSON format. /*
*/ ABAP references are always de-referenced and /*
*/ treated as normal variables. /*
*/**********************************************/*
type-pools: abap.
constants:
c_comma type c value ',',
c_colon type c value ':',
c_quote type c value '"'.
data:
dont_quote type xfeld,
json_fragments type table of string,
rec_json_string type string,
l_type type c,
s_type type c,
l_comps type i,
l_lines type i,
l_index type i,
l_value type string,
l_name type string,
l_strudescr type ref to cl_abap_structdescr.
field-symbols:
<abap_data> type any,
<itab> type any table,
<stru> type any table,
<comp> type any,
<abapcomp> type abap_compdescr.
data my_camelcase type xfeld.
my_camelcase = camelcase.
define get_scalar_value.
" &1 : assigned var
" &2 : abap data
" &3 : abap type
&1 = &2.
****************************************************
* Adapt some basic ABAP types (pending inclusion of all basic abap types?)
* Feel free to customize this for your needs
case &3.
* 1. ABAP numeric types
when 'I'. " Integer
condense &1.
if sign( &1 ) < 0.
shift &1 by 1 places right circular.
endif.
dont_quote = 'X'.
when 'F'. " Float
condense &1.
dont_quote = 'X'.
when 'P'. " Packed number (used in quantities or currency, for example)
condense &1.
if sign( &1 ) < 0.
shift &1 by 1 places right circular.
endif.
dont_quote = 'X'.
when 'X'. " Hexadecimal
condense &1.
concatenate '0x' &1 into &1.
* dont_quote = 'X'.
* "Quote it, as JSON doesn't support Hex or Octal as native types.
* 2. ABAP char types
when 'D'. " Date type
CONCATENATE &1(4) '-' &1+4(2) '-' &1+6(2) INTO &1.
when 'T'. " Time representation
CONCATENATE &1(2) ':' &1+2(2) ':' &1+4(2) INTO &1.
when 'N'. " Numeric text field
* condense &1.
when 'C' or 'g'. " Char sequences and Strings
* Put safe chars
replace all occurrences of '\' in &1 with '\\' .
replace all occurrences of '"' in &1 with '\"' .
replace all occurrences of cl_abap_char_utilities=>cr_lf in &1 with '\r\n' .
replace all occurrences of cl_abap_char_utilities=>newline in &1 with '\n' .
replace all occurrences of cl_abap_char_utilities=>horizontal_tab in &1 with '\t' .
replace all occurrences of cl_abap_char_utilities=>backspace in &1 with '\b' .
replace all occurrences of cl_abap_char_utilities=>form_feed in &1 with '\f' .
when 'y'. " XSTRING
* Put the XSTRING in Base64
&1 = cl_http_utility=>ENCODE_X_BASE64( &2 ).
when others.
* Don't hesitate to add and modify scalar abap types to suit your taste.
endcase.
** End of scalar data preparing.
* Enclose value in quotes (or not)
if dont_quote ne 'X'.
concatenate c_quote &1 c_quote into &1.
endif.
clear dont_quote.
end-of-definition.
***************************************************
* Prepare field names, JSON does quote names!! *
* You must be strict in what you produce. *
***************************************************
if name is not initial.
concatenate c_quote name c_quote c_colon into rec_json_string.
append rec_json_string to json_fragments.
clear rec_json_string.
endif.
**
* Get ABAP data type
describe field abap_data type l_type components l_comps.
***************************************************
* Get rid of data references
***************************************************
if l_type eq cl_abap_typedescr=>typekind_dref.
assign abap_data->* to <abap_data>.
if sy-subrc ne 0.
append '{}' to json_fragments.
concatenate lines of json_fragments into json_string.
exit.
endif.
else.
assign abap_data to <abap_data>.
endif.
* Get ABAP data type again and start
describe field <abap_data> type l_type components l_comps.
***************************************************
* Tables
***************************************************
if l_type eq cl_abap_typedescr=>typekind_table.
* '[' JSON table opening bracket
append '[' to json_fragments.
assign <abap_data> to <itab>.
l_lines = lines( <itab> ).
loop at <itab> assigning <comp>.
add 1 to l_index.
*> Recursive call for each table row:
rec_json_string = abap2json( abap_data = <comp> upcase = upcase camelcase = my_camelcase camelcase_names = camelcase_names ).
append rec_json_string to json_fragments.
clear rec_json_string.
if l_index < l_lines.
append c_comma to json_fragments.
endif.
endloop.
append ']' to json_fragments.
* ']' JSON table closing bracket
***************************************************
* Structures
***************************************************
else.
if l_comps is not initial.
* '{' JSON object opening curly brace
append '{' to json_fragments.
l_strudescr ?= cl_abap_typedescr=>describe_by_data( <abap_data> ).
loop at l_strudescr->components assigning <abapcomp>.
l_index = sy-tabix .
assign component <abapcomp>-name of structure <abap_data> to <comp>.
l_name = <abapcomp>-name.
** ABAP names are usually in caps, set upcase to avoid the conversion to lower case.
if upcase ne 'X'.
" translate l_name to lower case.
l_name = to_lower( l_name ).
endif.
if camelcase eq 'X'.
l_name = to_mixed( val = l_name case = 'a' ).
else.
read table camelcase_names from l_name transporting no fields.
if sy-subrc eq 0.
l_name = to_mixed( val = l_name case = 'a' ).
my_camelcase = 'X'.
else.
my_camelcase = abap_false.
endif.
endif.
describe field <comp> type s_type.
if s_type eq cl_abap_typedescr=>typekind_table or s_type eq cl_abap_typedescr=>typekind_dref or
s_type eq cl_abap_typedescr=>typekind_struct1 or s_type eq cl_abap_typedescr=>typekind_struct2.
*> Recursive call for non-scalars:
rec_json_string = abap2json( abap_data = <comp> name = l_name upcase = upcase camelcase = my_camelcase camelcase_names = camelcase_names ).
else.
if s_type eq cl_abap_typedescr=>typekind_oref or s_type eq cl_abap_typedescr=>typekind_iref.
rec_json_string = '"REF UNSUPPORTED"'.
else.
get_scalar_value rec_json_string <comp> s_type.
endif.
concatenate c_quote l_name c_quote c_colon rec_json_string into rec_json_string.
endif.
append rec_json_string to json_fragments.
clear rec_json_string. clear l_name.
if l_index < l_comps.
append c_comma to json_fragments.
endif.
endloop.
append '}' to json_fragments.
* '}' JSON object closing curly brace
****************************************************
* - Scalars - *
****************************************************
else.
get_scalar_value l_value <abap_data> l_type.
append l_value to json_fragments.
endif.
* End of structure/scalar IF block.
***********************************
endif.
* End of main IF block.
**********************
* Use a loop in older releases that don't support concatenate lines.
concatenate lines of json_fragments into json_string.
endmethod.
method ABAP2PERL.
*/**********************************************/*
*/ This method takes any ABAP data variable and /*
*/ returns a string representing its value in /*
*/ Perl Data::Dumper format, ready to be evaled /*
*/ in a Perl program. /*
*/**********************************************/*
type-pools: abap.
constants:
c_comma type c value ',',
c_colon type c value ':',
c_quote type c value ''''.
data:
perl_hash_assign type string,
dont_quote type xfeld,
perl_fragments type table of string,
rec_perl_string type string,
l_type type c,
s_type type c,
l_comps type i,
l_lines type i,
l_index type i,
l_value type string,
l_name type string,
l_typedescr type ref to cl_abap_structdescr.
field-symbols:
<abap_data> type any,
<itab> type any table,
<stru> type any table,
<comp> type any,
<abapcomp> type abap_compdescr.
concatenate space '=>' space into perl_hash_assign respecting blanks.
define get_scalar_value.
" &1 : assigned var
" &2 : abap data
" &3 : abap type
&1 = &2.
****************************************************
* Adapt some basic ABAP types (pending inclusion of all basic abap types?)
* Feel free to customize this for your needs
case &3.
* 1. ABAP numeric types
when 'I'. " Integer
condense &1.
if sign( &1 ) < 0.
shift &1 by 1 places right circular.
endif.
dont_quote = 'X'.
when 'F'. " Float
condense &1.
dont_quote = 'X'.
when 'P'. " Packed number (used in quantities, for example)
condense &1.
if sign( &1 ) < 0.
shift &1 by 1 places right circular.
endif.
dont_quote = 'X'.
when 'X'. " Hexadecimal
condense &1.
concatenate '0x' &1 into &1.
dont_quote = 'X'.
* 2. ABAP char types
when 'D'. " Date type
CONCATENATE &1(4) '-' &1+4(2) '-' &1+6(2) INTO &1.
when 'T'. " Time representation
CONCATENATE &1(2) ':' &1+2(2) ':' &1+4(2) INTO &1.
when 'N'. " Numeric text field
* condense &1.
when 'C' or 'g'. " Char sequences and Strings
* Put safe chars
replace all occurrences of '''' in &1 with '\''' .
when 'y'. " XSTRING
* Put the XSTRING in Base64
&1 = cl_http_utility=>ENCODE_X_BASE64( &2 ).
when others.
* Don't hesitate to add and modify abap types to suit your taste.
endcase.
** End of scalar data preparing.
* Enclose value in quotes (or not)
if dont_quote ne 'X'.
concatenate c_quote &1 c_quote into &1.
endif.
clear dont_quote.
end-of-definition.
***************************************************
* Prepare field names, we use single quotes. *
* You must be strict in what you produce. *
***************************************************
if name is not initial.
concatenate c_quote name c_quote perl_hash_assign into rec_perl_string respecting blanks.
append rec_perl_string to perl_fragments.
clear rec_perl_string.
endif.
**
* Get ABAP data type
describe field abap_data type l_type components l_comps.
***************************************************
* Get rid of data references
***************************************************
if l_type eq cl_abap_typedescr=>typekind_dref.
assign abap_data->* to <abap_data>.
if sy-subrc ne 0.
append '{}' to perl_fragments.
concatenate lines of perl_fragments into perl_string.
exit.
endif.
else.
assign abap_data to <abap_data>.
endif.
* Get ABAP data type again and start
describe field <abap_data> type l_type components l_comps.
***************************************************
* Tables
***************************************************
if l_type eq cl_abap_typedescr=>typekind_table.
* '[' Table opening bracket
append '[' to perl_fragments.
assign <abap_data> to <itab>.
l_lines = lines( <itab> ).
loop at <itab> assigning <comp>.
add 1 to l_index.
*> Recursive call here
rec_perl_string = abap2perl( abap_data = <comp> upcase = upcase ).
append rec_perl_string to perl_fragments.
clear rec_perl_string.
if l_index < l_lines.
append c_comma to perl_fragments.
endif.
endloop.
append ']' to perl_fragments.
* ']' Table closing bracket
***************************************************
* Structures
***************************************************
else .
if l_comps is not initial.
* '{' Object opening curly brace
append '{' to perl_fragments .
l_typedescr ?= cl_abap_typedescr=>describe_by_data( <abap_data> ) .
loop at l_typedescr->components assigning <abapcomp> .
l_index = sy-tabix .
assign component <abapcomp>-name of structure <abap_data> to <comp>.
l_name = <abapcomp>-name.
** ABAP names are usually in caps, set upcase to avoid the conversion to lower case.
if upcase ne 'X'.
translate l_name to lower case.
endif.
describe field <comp> type s_type.
if s_type eq cl_abap_typedescr=>typekind_table or s_type eq cl_abap_typedescr=>typekind_dref or
s_type eq cl_abap_typedescr=>typekind_struct1 or s_type eq cl_abap_typedescr=>typekind_struct2.
*> Recursive call for non-scalars:
rec_perl_string = abap2perl( abap_data = <comp> name = l_name upcase = upcase ).
else.
if s_type eq cl_abap_typedescr=>TYPEKIND_OREF or s_type eq cl_abap_typedescr=>TYPEKIND_IREF.
rec_perl_string = '"REF UNSUPPORTED"'.
else.
get_scalar_value rec_perl_string <comp> s_type.
endif.
concatenate c_quote l_name c_quote perl_hash_assign rec_perl_string into rec_perl_string.
endif.
append rec_perl_string to perl_fragments.
clear rec_perl_string.
if l_index < l_comps.
append c_comma to perl_fragments.
endif.
endloop.
append '}' to perl_fragments.
* '}' Object closing curly brace
****************************************************
* - Scalars - *
****************************************************
else.
get_scalar_value l_value <abap_data> l_type.
append l_value to perl_fragments.
endif.
* End of structure/scalar IF block.
***********************************
endif.
* End of main IF block.
**********************
* Use a loop in older releases that don't support concatenate lines.
concatenate lines of perl_fragments into perl_string.
endmethod.
method ABAP2XML.
*
*/ Look at method serialize_id for a new way of doing XML.
type-pools: abap.
constants:
xml_head type string value '<?xml version="1.0" encoding="utf-8"?>',
item_atr type string value 'idx="#"'.
data:
xml_fragments type table of string,
rec_xml_string type string,
l_type type c,
s_type type c,
l_comps type i,
l_value type string,
t_string type string,
l_item_atr type string,
l_item_str type string,
l_name type string,
l_idx type string,
l_typedescr type ref to cl_abap_structdescr,
l_linedescr type ref to cl_abap_datadescr,
l_tabledescr type ref to cl_abap_tabledescr.
field-symbols:
<abap_data> type any,
<itab> type any table,
<stru> type any table,
<comp> type any,
<abapcomp> type abap_compdescr.
define get_scalar_value.
" &1 : assigned var
" &2 : abap data
" &3 : abap type
&1 = &2.
****************************************************
* Adapt some basic ABAP types (pending inclusion of all basic abap types?)
* Feel free to customize this for your needs
case &3.
* 1. ABAP numeric types
when 'I'. " Integer
condense &1.
if sign( &1 ) < 0.
shift &1 by 1 places right circular.
endif.
when 'F'. " Float
condense &1.
when 'P'. " Packed number (used in quantities, for example)
condense &1.
if sign( &1 ) < 0.
shift &1 by 1 places right circular.
endif.
when 'X'. " Hexadecimal
condense &1.
concatenate '0x' &1 into &1.
* 2. ABAP char types
when 'D'. " Date type
CONCATENATE &1(4) '-' &1+4(2) '-' &1+6(2) INTO &1.
when 'T'. " Time representation
CONCATENATE &1(2) ':' &1+2(2) ':' &1+4(2) INTO &1.
when 'N'. " Numeric text field
* condense &1.
when 'C' or 'g'. " Char sequences and Strings
* Put safe chars
t_string = &2.
&1 = cl_http_utility=>escape_html( t_string ).
when 'y'. " XSTRING
* Put the XSTRING in Base64
&1 = cl_http_utility=>ENCODE_X_BASE64( &2 ).
when others.
* Don't hesitate to add and modify abap types to suit your taste.
endcase.
** End of scalar data preparing.
end-of-definition.
*******************************
* Put XML header if requested *
*******************************
if with_xml_header eq abap_true.
append xml_head to xml_fragments.
endif.
***************************************************
* Open XML tag *
* < > *
***************************************************
if name is not initial.
l_name = name.
if name_atr is not initial.
concatenate name name_atr into l_name separated by space.
endif.
concatenate '<' l_name '>' into rec_xml_string.
append rec_xml_string to xml_fragments.
clear rec_xml_string.
endif.
**
* Get ABAP data type
describe field abap_data type l_type components l_comps .
***************************************************
* Get rid of data references
***************************************************
if l_type eq cl_abap_typedescr=>typekind_dref.
assign abap_data->* to <abap_data>.
if sy-subrc ne 0.
if name is not initial.
concatenate '<' name '/>' into xml_string.
else.
clear xml_string.
endif.
exit.
endif.
else.
assign abap_data to <abap_data>.
endif.
* Get ABAP data type again and start
describe field <abap_data> type l_type components l_comps.
***************************************************
* Tables
***************************************************
if l_type eq cl_abap_typedescr=>typekind_table.
l_tabledescr ?= cl_abap_typedescr=>describe_by_data( <abap_data> ).
l_linedescr = l_tabledescr->get_table_line_type( ).
l_item_str = l_linedescr->get_relative_name( ).
assign <abap_data> to <itab>.
loop at <itab> assigning <comp>.
l_idx = sy-tabix.
condense l_idx.
l_item_atr = item_atr.
replace '#' in l_item_atr with l_idx.
if upcase ne 'X'.
translate l_item_str to lower case.
endif.
*> Recursive call for line items here:
rec_xml_string = abap2xml( abap_data = <comp> upcase = upcase name = l_item_str name_atr = l_item_atr ).
append rec_xml_string to xml_fragments.
clear rec_xml_string.
endloop.
***************************************************
* Structures
***************************************************
else .
if l_comps is not initial.
l_typedescr ?= cl_abap_typedescr=>describe_by_data( <abap_data> ).
loop at l_typedescr->components assigning <abapcomp> .
assign component <abapcomp>-name of structure <abap_data> to <comp>.
l_name = <abapcomp>-name. " l_value justs holds the name here.
** ABAP names are usually in caps, set upcase to avoid the conversion to lower case.
if upcase ne 'X'.
translate l_name to lower case.
endif.
describe field <comp> type s_type.
if s_type eq cl_abap_typedescr=>typekind_table or s_type eq cl_abap_typedescr=>typekind_dref or
s_type eq cl_abap_typedescr=>typekind_struct1 or s_type eq cl_abap_typedescr=>typekind_struct2.
*> Recursive call for non-scalars:
rec_xml_string = abap2xml( abap_data = <comp> name = l_name upcase = upcase ).
else.
if s_type eq cl_abap_typedescr=>TYPEKIND_OREF or s_type eq cl_abap_typedescr=>TYPEKIND_IREF.
rec_xml_string = 'REF UNSUPPORTED'.
else.
get_scalar_value rec_xml_string <comp> s_type.
endif.
concatenate '<' l_name '>' rec_xml_string '</' l_name '>' into rec_xml_string.
endif.
append rec_xml_string to xml_fragments.
clear rec_xml_string.
endloop.
****************************************************
* - Scalars - *
****************************************************
else.
get_scalar_value l_value <abap_data> l_type.
append l_value to xml_fragments.
endif.
* End of structure/scalar IF block.
***********************************
endif.
* End of main IF block.
**********************
*****************
* Close XML tag *
*****************
if name is not initial.
concatenate '</' name '>' into rec_xml_string.
append rec_xml_string to xml_fragments.
clear rec_xml_string.
endif.
* Use a loop in older releases that don't support concatenate lines.
concatenate lines of xml_fragments into xml_string.
endmethod.
method ABAP2YAML.
*********************
* ABAP goes to YAML *
*********************
type-pools: abap.
constants:
c_comma type c value ',',
c_space type c value ' ',
c_colon type c value ':',
c_quote type c value '"',
c_squot type c value '''',
c_colo2(2) type c value ': ',
c_indt2 type i value 2,
c_hyph type c value '-'.
data:
ly_level type i,
l_dont_indent type xfeld,
dec_level type i value 0,
dont_quote type xfeld,
yaml_fragments type table of string,
rec_yaml_string type string,
l_type type c ,
l_comps type i ,
l_lines type i ,
l_index type i ,
l_value type string,
l_name type string.
field-symbols:
<abap_data> type any,
<itab> type any table,
<stru> type any table,
<comp> type any.
data l_typedescr type ref to cl_abap_structdescr .
field-symbols <abapcomp> type abap_compdescr .
ly_level = y_level.
**
* Get ABAP data type
describe field abap_data type l_type components l_comps .
***************************************************
* First of all, get rid of data references
***************************************************
if l_type eq cl_abap_typedescr=>typekind_dref.
assign abap_data->* to <abap_data>.
if sy-subrc ne 0.
yaml_string = space. " pasamos de poner nada si falla...
exit.
endif.
else.
assign abap_data to <abap_data>.
endif.
* Get ABAP data type again and start
describe field <abap_data> type l_type components l_comps.
***************************************************
* Prepare field names, YAML does not quote names *
***************************************************
* Put hyphens...
if name is initial and y_level gt 0.
concatenate c_hyph space into rec_yaml_string respecting blanks.
l_dont_indent = 'X'.
endif.
if name is not initial.
concatenate name c_colon c_space into rec_yaml_string respecting blanks.
endif.
* do indent
if dont_indent ne 'X'.
do ly_level times.
shift rec_yaml_string right by c_indt2 places.
enddo.
endif.
append rec_yaml_string to yaml_fragments.
clear rec_yaml_string.
***************************************************
* Tables
***************************************************
if l_type eq cl_abap_typedescr=>TYPEKIND_TABLE.
assign <abap_data> to <itab>.
l_lines = lines( <itab> ).
clear l_index.
if l_lines eq 0.
move '[]' to rec_yaml_string.
append rec_yaml_string to yaml_fragments.
clear rec_yaml_string.
append xnl to yaml_fragments.
else.
if name is not initial.
append xnl to yaml_fragments.
endif.
add 1 to ly_level.
loop at <itab> assigning <comp>.
add 1 to l_index.
*> Recursive call here
rec_yaml_string = abap2yaml( abap_data = <comp> upcase = upcase y_level = ly_level s_index = l_index ).
append rec_yaml_string to yaml_fragments.
clear rec_yaml_string.
endloop.
endif.
* YAML table ends *
*******************
***************************************************
* Structures
***************************************************
else .
if l_comps is not initial.
if name is not initial.
append xnl to yaml_fragments.
endif.
add 1 to ly_level.
* Loop for structure elements
l_typedescr ?= cl_abap_typedescr=>describe_by_data( <abap_data> ) .
clear l_index.
loop at l_typedescr->components assigning <abapcomp>.
add 1 to l_index.
assign component <abapcomp>-name of structure <abap_data> to <comp>.
l_name = <abapcomp>-name.
** ABAP names are usually in caps, set upcase to avoid the conversion to lower case.
if upcase ne 'X'.
translate l_name to lower case.
endif.
*> Recursive call here
rec_yaml_string = abap2yaml( abap_data = <comp> name = l_name upcase = upcase y_level = ly_level s_index = l_index dont_indent = l_dont_indent ).
clear l_dont_indent. " it is only used once
append rec_yaml_string to yaml_fragments.
clear rec_yaml_string.
endloop.
* YAML structure ends *
***********************
***************************************************
* Scalars and others...
***************************************************
else.
if l_type eq cl_abap_typedescr=>TYPEKIND_OREF or l_type eq cl_abap_typedescr=>TYPEKIND_IREF.
l_value = 'REF UNSUPPORTED'.
else.
l_value = <abap_data>.
endif.
* Adapt some basic ABAP types (pending inclusion of all basic abap types)
* Feel free to customize this for your needs
case l_type.
* 1. ABAP numeric types
when 'I'. " Integer
condense l_value.
if sign( l_value ) < 0.
shift l_value by 1 places right circular.
endif.
dont_quote = 'X'.
when 'F'. " Float
condense l_value.
dont_quote = 'X'.
when 'P'. " Packed number (used in quantities, for example)
condense l_value.
if sign( l_value ) < 0.
shift l_value by 1 places right circular.
endif.
dont_quote = 'X'.
when 'X'. " Hexadecimal
condense l_value.
concatenate '0x' l_value into l_value.
dont_quote = 'X'.
* 2. ABAP char types
when 'D'. " Date type
CONCATENATE l_value(4) '-' l_value+4(2) '-' l_value+6(2) INTO l_value.
when 'T'. " Time representation
CONCATENATE l_value(2) ':' l_value+2(2) ':' l_value+4(2) INTO l_value.
when 'N'. " Numeric text field
* condense l_value.
when 'C' or 'g'. " Chars and Strings
* Put safe chars
replace all occurrences of '\' in l_value with '\\' .
replace all occurrences of '"' in l_value with '\"' .
replace all occurrences of cl_abap_char_utilities=>cr_lf in l_value with '\r\n' .
replace all occurrences of cl_abap_char_utilities=>newline in l_value with '\n' .
replace all occurrences of cl_abap_char_utilities=>horizontal_tab in l_value with '\t' .
replace all occurrences of cl_abap_char_utilities=>backspace in l_value with '\b' .
replace all occurrences of cl_abap_char_utilities=>form_feed in l_value with '\f' .
when 'y'. " XSTRING
* Put the XSTRING in Base64
* l_value = cl_http_utility=>ENCODE_X_BASE64( <abap_data> ).
l_value = 'XSTRING not supported in YAML yet!'.
when others.
* Don't hesitate to add and modify abap types to suit your taste.
endcase.
* We use YAML scalars double quoted
if dont_quote ne 'X'.
concatenate c_quote l_value c_quote into l_value.
else.
clear dont_quote.
endif.
append l_value to yaml_fragments.
append xnl to yaml_fragments.
endif. " is structure or scalar
endif. " main typekind sentence
* Use a loop in older releases that don't support concatenate lines.
concatenate lines of yaml_fragments into yaml_string respecting blanks.
endmethod.
method BUILD_PARAMS.
type-pools: ABAP.
data defval type RS38L_DEFO.
data dataname type string.
data waref type ref to data.
field-symbols:
<wa> type any,
<temp> type any.
data len type i.
data excnt type i value 1.
data paramline type line of ABAP_FUNC_PARMBIND_TAB.
data exceptline type line of ABAP_FUNC_EXCPBIND_TAB.
data t_params_p type table of RFC_FINT_P.
data params_p type RFC_FINT_P.
define remove_enclosing_quotes.
" Remove enclosing single quotes
if &2 gt 1.
subtract 1 from &2.
if &1+&2 eq ''''.
&1+&2 = space.
endif.
if &1(1) eq ''''.
shift &1 left.
endif.
&2 = strlen( &1 ).
endif.
end-of-definition.
* do we have the rfc name?
call function 'RFC_GET_FUNCTION_INTERFACE_P'
EXPORTING
funcname = function_name
language = 'E' "'D' "sy-langu
TABLES
params_p = t_params_p
EXCEPTIONS
fu_not_found = 1
nametab_fault = 2
others = 3.
if sy-subrc <> 0.
raise INVALID_FUNCTION.
endif.
* Build params table
loop at t_params_p into params_p.
unassign <wa>.
unassign <temp>.
clear paramline.
case params_p-paramclass.
when 'I' or 'E' or 'C'.
paramline-name = params_p-parameter.
if params_p-paramclass = 'E'.
paramline-kind = ABAP_FUNC_IMPORTING.
elseif params_p-paramclass = 'I'.
paramline-kind = ABAP_FUNC_EXPORTING.
else.
paramline-kind = ABAP_FUNC_CHANGING.
endif.
if params_p-fieldname is initial.
dataname = params_p-tabname.
else.
concatenate params_p-tabname params_p-fieldname into
dataname separated by '-'.
endif.
* Assign default values
defval = params_p-default.
if dataname is initial.
dataname = 'STRING'. " use a STRING for this cases (see CONVERT_DATE_TO_EXTERNAL).
endif.
create data waref type (dataname).
assign waref->* to <wa>.
len = strlen( defval ).
remove_enclosing_quotes defval len.
if defval = 'SPACE'.
<wa> = space.
elseif len > 3 and defval+0(3) = 'SY-'.
assign (defval) to <temp>.
<wa> = <temp>.
unassign <temp>.
else.
if defval is not initial.
<wa> = defval.
endif.
endif.
unassign <wa>.
paramline-value = waref.
insert paramline into table paramtab.
when 'T'.
paramline-name = params_p-parameter.
paramline-kind = ABAP_FUNC_TABLES.
if params_p-exid eq 'h'.
create data waref type (params_p-tabname).
else.
create data waref type standard table of (params_p-tabname).
endif.
paramline-value = waref.
insert paramline into table paramtab.
when 'X'.
exceptline-name = params_p-parameter.
exceptline-value = excnt.
data messg type ref to data.
create data messg type string.
assign messg->* to <temp>.
<temp> = params_p-paramtext.
exceptline-message = messg.
insert exceptline into table exceptab.
add 1 to excnt.
when others.
raise UNSUPPORTED_PARAM_TYPE.
endcase.
endloop.
* add in the catch all exception
exceptline-name = 'OTHERS'.
exceptline-value = excnt.
insert exceptline into table exceptab.
* return
params = t_params_p.
*********************************
******* Remaining from 2006 *****
******* end of build_params *****
*********************************
endmethod.
method DESERIALIZE_ID.
*/***********************************************************/*
*/ New method using the built-in transformation /*
*/ included in releases 7.02 and 7.03/7.31 (Kernelpatch 116) /*
*/***********************************************************/*
type-pools: ABAP.
** Remember function parameter types
**constants:
** abap_func_exporting type abap_func_parmbind-kind value 10,
** abap_func_importing type abap_func_parmbind-kind value 20,
** abap_func_tables type abap_func_parmbind-kind value 30,
** abap_func_changing type abap_func_parmbind-kind value 40.
data:
rtab type ABAP_TRANS_RESBIND_TAB,
rlin type abap_trans_resbind,
oexcp type ref to cx_root,
etext type string,
json_xtext type xstring.
field-symbols <parm> type abap_func_parmbind.
if json is initial. exit. endif. " exit method if there is nothing to parse
" build rtab table for transformation id
loop at paramtab assigning <parm>.
if <parm>-kind eq abap_func_importing. "" va al revés, cuidado!!!
continue.
endif.
rlin-name = <parm>-name.
rlin-value = <parm>-value.
append rlin to rtab.
endloop.
" Convert input JSON variable names to uppercase
json_xtext = cl_abap_codepage=>convert_to( json ).
data(reader) = cl_sxml_string_reader=>create( json_xtext ).
data(writer) = cast if_sxml_writer( cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ) ).
do.
data(node) = reader->read_next_node( ).
if node is initial.
exit.
endif.
if node->type = if_sxml_node=>co_nt_element_open.
data(attributes) = cast if_sxml_open_element( node )->get_attributes( ).
loop at attributes assigning field-symbol(<attribute>).
if <attribute>->qname-name = 'name'.
<attribute>->set_value(
to_upper( <attribute>->get_value( ) ) ).
endif.
endloop.
endif.
writer->write_node( node ).
enddo.
json_xtext = cast cl_sxml_string_writer( writer )->get_output( ) .
try.
CALL TRANSFORMATION id SOURCE XML json_xtext
RESULT (rtab).
catch cx_root into oexcp.
etext = oexcp->if_message~get_text( ).
RAISE EXCEPTION type zcx_json
EXPORTING
message = etext.
endtry.
endmethod.
method IF_HTTP_EXTENSION~HANDLE_REQUEST.
*/*************************************************************************/
*/ Assign this handler to a service in ICF. This allows any ABAP function */
*/ module to be called directly by URL and exchange data in JSON format. */
*/ --
*/ This code is distributed under the terms of Apache License Version 2.0 */
*/ (see http://www.apache.org/licenses/LICENSE-2.0.html) */
*/ --
*/ (C) César Martín <[email protected]> */
*/ Many thanks to Juan Díez for his ideas, help, and support. */
*/ --
*/*************************************************************************/
*/ If you want to use the SAP standard provided transformation for JSON */
*/ and XML, uncomment the lines calling serialize_id and deserialize_id */
*/*************************************************************************/
type-pools abap.
data: show_import_params type abap_bool value abap_false,
upcase type abap_bool value abap_false,
lowercase type abap_bool value abap_true,
camelcase type abap_bool value abap_false,
path_info type string,
p_info_tab type table of string,
format type string,
accept type string,
action type string,
request_method type string,
jsonp_callback type string,
i_content_type type string,
i_cdata type string,
o_cdata type string,
exceptheader type string,
etext type string,
etext2 type string,
str_item type string,
host type string,
port type string,
proto type string,
http_code type i,
http_status type string,
camelcase_names type stringtab,
funcname type rs38l_fnam,
funcname2 type string,
dparam type abap_parmname,
t_params_p type standard table of rfc_fint_p,
paramtab type abap_func_parmbind_tab,
exceptab type abap_func_excpbind_tab,
exception type line of abap_func_excpbind_tab,
funcrc type sy-subrc,
oexcp type ref to cx_root,
qs_nvp type tihttpnvp,
l_lines type i,
l_idx type i.
field-symbols <qs_nvp> type ihttpnvp.
field-symbols <fm_param> type abap_func_parmbind.
field-symbols <fm_value_str> type string.
field-symbols <fm_value_i> type i.
field-symbols <fm_int_handler> type ZICF_HANDLER_DATA.
define http_error.
" &1 http status code
" &2 status text
" &3 error message
server->response->set_header_field( name = 'Content-Type' value = 'application/json' ).
http_code = &1.
server->response->set_status( code = http_code reason = &2 ).
concatenate '{"ERROR_CODE":"' &1 '","ERROR_MESSAGE":"' &3 '","INFO_LINK":"' me->my_url me->my_service '?action=notes"}' into etext.
server->response->set_cdata( etext ).
exit.
end-of-definition.
* Get Server Info:
server->get_location( importing host = host port = port out_protocol = proto ).
concatenate proto '://' host ':' port into me->my_url.
** Get all client Info:
*data clnt_hfields type TIHTTPNVP.
*server->request->get_header_fields( changing fields = clnt_hfields ).
* GET and POST and other methods are allowed.
* Uncomment or extend this if you want alternative actions following
* request methods, in order to define a REST style behaviour
* or, better, check an alternative approach on a way to do that
* inside the FM (search for _ICF_DATA below).
* if request_method <> 'POST'.
**** http_error 405 'Method not allowed' 'Method not allowed.'.
* endif.
* Get form and header fields
me->my_service = server->request->get_header_field( name = '~script_name' ).
request_method = server->request->get_header_field( name = '~request_method' ).
i_content_type = server->request->get_header_field( name = 'content-type' ).
show_import_params = server->request->get_form_field( 'show_import_params' ).
action = server->request->get_form_field( 'action' ).
jsonp_callback = server->request->get_form_field( 'callback' ).
format = server->request->get_form_field( 'format' ).
accept = server->request->get_header_field( name = 'Accept' ).
* the case with CASE and forgive the mess.
* Now, it is lowercase by default.
lowercase = server->request->get_form_field( 'lowercase' ).
upcase = server->request->get_form_field( 'upcase' ).
camelcase = server->request->get_form_field( 'camelcase' ).
if upcase ne abap_true. " only upcase matters.
lowercase = abap_true.
endif.
* Try "$" equivalents:
if format is initial.
format = server->request->get_form_field( '$format' ).
endif.
if jsonp_callback is initial.
jsonp_callback = server->request->get_form_field( '$callback' ).
endif.
* Get function name from PATH_INFO
path_info = server->request->get_header_field( name = '~path_info' ).
split path_info at '/' into table p_info_tab.
read table p_info_tab index 2 into funcname.
read table p_info_tab index 3 into funcname2.
if sy-subrc eq 0.
concatenate '/' funcname '/' funcname2 into funcname.
condense funcname.
endif.
translate funcname to upper case.
if funcname is initial and action is initial.
http_error '404' 'Not Found' 'Empty request.' .
endif.
* Get the desired response format from "Accept" header (as in RFC 2616 sec 14.1)
* See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html. Thanks Uwe!!
if accept is not initial and format is initial.
translate accept to lower case.
if accept cs '/json'.
format = 'json'.
elseif accept cs '/yaml'.
format = 'yaml'.
elseif accept cs '/xml'.
format = 'xml'.
elseif accept cs '/perl'.
format = 'perl'.
elseif accept cs '*/*'.
clear format. " for the moment, ignore quality levels in Accept, send default format (json).
else.
http_error '406' 'Not Acceptable' 'The server cannot send a response which is acceptable according to the combined Accept field value'.
endif.
endif.
translate format to upper case.
translate action to upper case.
if show_import_params is not initial.
show_import_params = abap_true.
endif.
***************************
* Do alternative actions...
case action.
when 'NOTES'.
server->response->set_header_field( name = 'Content-Type' value = 'text/html' ).
server->response->set_status( code = 200 reason = 'OK' ).
o_cdata = me->notes( ).
server->response->set_cdata( o_cdata ).
exit.
* when 'TEST'.
****** TEST *****
* etext = me->test( i_cdata ).
* http_error '200' 'Ok' etext.
* exit.
****** Investigate further... *****
when 'START_SESSION'.
** server->stateful = 1.
server->set_session_stateful( stateful = server->co_enabled ).
when 'END_SESSION'.
** server->stateful = 0.
server->set_session_stateful( stateful = server->co_disabled ).
when others.
" just go on
endcase.
* Check Authorization. Create the relevant auth object in SU21 and assign
* the authorized functions to the user. Uncomment to implement security.
authority-check object 'Z_JSON'
id 'FMNAME' field funcname.
if sy-subrc ne 0.
http_error '403' 'Not authorized' 'You are not authorized to invoke this function module.'.
endif.
*****************************************************************************
* check CORS
* see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS *
*****************************************************************************
******************
* get input data *
******************
clear i_cdata.
i_cdata = server->request->get_cdata( ).
server->request->get_form_fields_cs( changing fields = qs_nvp ).
* We map the query string to a simple JSON input. Handy for REST style queries.
* The query string may come from GET requests in the url and content data in
* POST request in x-www-form-urlencoded. ICF handles this perfectly and mixes both!! Great!!
if ( qs_nvp is not initial and i_cdata is initial ) or
i_content_type cs 'application/x-www-form-urlencoded'.
l_lines = lines( qs_nvp ).
clear l_idx.
move '{' to i_cdata.
loop at qs_nvp assigning <qs_nvp>.
add 1 to l_idx.
translate <qs_nvp>-name to upper case. " ABAP is upper case internally anyway.
concatenate i_cdata '"' <qs_nvp>-name '":"' <qs_nvp>-value '"' into i_cdata
respecting blanks.
if l_idx < l_lines.
concatenate i_cdata ',' into i_cdata respecting blanks.
endif.
endloop.
concatenate i_cdata '}' into i_cdata.
endif.
* Prepare params to call function
CALL METHOD zcl_json_handler=>build_params
EXPORTING
function_name = funcname
IMPORTING
params = t_params_p
paramtab = paramtab
exceptab = exceptab
EXCEPTIONS
invalid_function = 1
others = 2.
if sy-subrc <> 0.
concatenate 'Invalid Function. ' sy-msgid sy-msgty sy-msgno ': '
sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
into etext separated by '-'.
http_error '500' 'Server Error' etext.
endif.
**********************
* Process input data *
**********************
try.
CALL METHOD me->json_deserialize " The classic method using JavaScript (JSON only)
* CALL METHOD me->deserialize_id " The new method using transformation id. This method accepts both JSON and XML input!!! Great!!
EXPORTING
json = i_cdata
CHANGING
paramtab = paramtab.
catch cx_root into oexcp.
etext = oexcp->if_message~get_text( ).
http_error '500' 'Internal Server Error' etext.
endtry.
*/**********************************/*
*/**********************************/*
*/************************************************/*
*/ Pass some request info to function module /*
*/ for FMs implementing a REST model or whatever /*
*/************************************************/*
read table paramtab with key name = '_ICF_DATA' assigning <fm_param>.
if sy-subrc eq 0.
create data <fm_param>-value type ZICF_HANDLER_DATA.
assign <fm_param>-value->* to <fm_int_handler>.
<fm_int_handler>-request_method = request_method.
<fm_int_handler>-icf_url = me->my_url.
<fm_int_handler>-icf_service = me->my_service.
<fm_int_handler>-path_info = path_info.
<fm_int_handler>-qs_tab = qs_nvp.
<fm_int_handler>-i_json_data = i_cdata.
<fm_int_handler>-camelcase_names = camelcase_names.
append '_ICF_DATA' to <fm_int_handler>-delete_params.
<fm_int_handler>-server = server. " Beware!
endif.
****************************
* Call the function module *
****************************
try.
CALL FUNCTION funcname
parameter-table
paramtab
exception-table
exceptab.
catch cx_root into oexcp.
etext = oexcp->if_message~get_longtext( preserve_newlines = abap_true ).
http_error '500' 'Internal Server Error' etext.
endtry.
* Remove unused exceptions
funcrc = sy-subrc.
delete exceptab where value ne funcrc.
read table exceptab into exception with key value = funcrc.
if sy-subrc eq 0.
exceptheader = exception-name.
CALL METHOD server->response->set_header_field(
name = 'X-SAPRFC-Exception'
value = exceptheader ).
endif.
*/*******************************************************************/*
*/ Read specific FM parameters for REST type interfaces /*
*/ I need to find a way on how to operate with some http codes: /*
*/ 201 Created - URI of resource created is set in Location header /*
*/ 202 Accepted - Response contains status information
*/ 203 Non-Authoritative Information
*/ 204 No Content - NO CONTENT is sent, nothing, nada
*/ 205 Reset Content - NO CONTENT is sent, nothing, nada
*/ 206 Partial Content - probably will not implement this
*/ Codes 3xx, 4xx should also be handled.
*/***********************************/*
if <fm_int_handler> is assigned.
if <fm_int_handler>-http_code is not initial.
server->response->set_status( code = <fm_int_handler>-http_code reason = <fm_int_handler>-http_status ).
case <fm_int_handler>-http_code.
when 204 or 205.
exit.
when others. " many to add?
endcase.
endif.
if <fm_int_handler>-error_message is not initial.
str_item = <fm_int_handler>-http_code. condense str_item.
http_error str_item <fm_int_handler>-http_status <fm_int_handler>-error_message.
endif.
* read camelcase_names
camelcase_names = <fm_int_handler>-camelcase_names.
* Delete indicated params for not showing them in the response
loop at <fm_int_handler>-delete_params into dparam.
delete paramtab where name eq dparam.
endloop.
endif.
* Prepare response. Serialize to output format stream.
case format.
when 'YAML'.
CALL METHOD me->serialize_yaml
EXPORTING
paramtab = paramtab
exceptab = exceptab
params = t_params_p
jsonp = jsonp_callback
show_impp = show_import_params
lowercase = lowercase
IMPORTING
yaml_string = o_cdata.
server->response->set_header_field( name = 'Content-Type' value = 'text/plain' ).
when 'PERL'.
CALL METHOD me->serialize_perl
EXPORTING
paramtab = paramtab
exceptab = exceptab
params = t_params_p
jsonp = jsonp_callback
show_impp = show_import_params
funcname = funcname
lowercase = lowercase
IMPORTING
perl_string = o_cdata.
server->response->set_header_field( name = 'Content-Type' value = 'text/plain' ).
when 'XML'.
CALL METHOD me->serialize_xml
* CALL METHOD me->serialize_id
EXPORTING
paramtab = paramtab
exceptab = exceptab
params = t_params_p
jsonp = jsonp_callback
show_impp = show_import_params
funcname = funcname
lowercase = lowercase
format = format
IMPORTING
o_string = o_cdata.
server->response->set_header_field( name = 'Content-Type' value = 'application/xml' ).
when others. " the others default to JSON.
format = 'JSON'.
CALL METHOD me->serialize_json
* CALL METHOD me->serialize_id
EXPORTING
paramtab = paramtab
exceptab = exceptab
params = t_params_p
jsonp = jsonp_callback
show_impp = show_import_params
lowercase = lowercase
camelcase = camelcase
camelcase_names = camelcase_names
* format = format
IMPORTING
o_string = o_cdata.
server->response->set_header_field( name = 'Content-Type' value = 'application/json' ).
if jsonp_callback is not initial.
server->response->set_header_field( name = 'Content-Type' value = 'application/javascript' ).
endif.
endcase.
* Set response:
server->response->set_header_field( name = 'X-Data-Format' value = format ). "
* Activate compression (will compress when size>1kb if requested by client in Accept-Encoding: gzip. Very nice.).
server->response->set_compression( ).
* if <fm_int_handler>-alt_response is not initial.
* o_cdata = <fm_int_handler>-alt_response.
* endif.
server->response->set_cdata( data = o_cdata ).
*******************************************
*******************************************
********** * * *********
********* * * **********
******** * * ***********
*******************************************
*******************************************
endmethod.
method JSON2ABAP.
*/************************************************/*
*/ Input any abap data and this method tries to /*
*/ fill it with the data in the JSON string. /*
*/ Thanks to Juan Diaz for helping here!! /*
*/************************************************/*
type-pools: abap, js.
data:
js_script type string,
js_started type i value 0,
l_json_string type string,
js_property_table type js_property_tab,
js_property type line of js_property_tab,
l_property_path type string,
compname type string,
item_path type string.
data:
l_type type c,
l_value type string,
linetype type string,
l_comp type line of ABAP_COMPDESCR_TAB.
data:
datadesc type ref to CL_ABAP_TYPEDESCR,
drefdesc type ref to CL_ABAP_TYPEDESCR,
linedesc type ref to CL_ABAP_TYPEDESCR,
strudesc type ref to CL_ABAP_STRUCTDESCR,
tabldesc type ref to CL_ABAP_TABLEDESCR.
data newline type ref to data.
field-symbols:
<abap_data> type any,
<itab> type any table,
<comp> type any,
<jsprop> type line of js_property_tab,
<abapcomp> type abap_compdescr.
define assign_scalar_value.
" &1 <abap_data>
" &2 js_property-value
describe field &1 type l_type.
l_value = &2.
* convert or adapt scalar values to ABAP.
case l_type.
when 'D'. " date type
if l_value cs '-'.
replace all occurrences of '-' in l_value with space.
condense l_value no-gaps.
endif.
when 'T'. " time type
if l_value cs ':'.
replace all occurrences of ':' in l_value with space.
condense l_value no-gaps.
endif.
when others.
" may be other conversions or checks could be implemented here.
endcase.
&1 = l_value.
end-of-definition.
if js_object is not bound.
if json_string is initial. exit. endif. " exit method if there is nothing to parse
l_json_string = json_string.
" js_object = cl_java_script=>create( STACKSIZE = 16384 ).
js_object = cl_java_script=>create( STACKSIZE = 16384 HEAPSIZE = 960000 ).
***************************************************
* Parse JSON using JavaScript *
***************************************************
js_object->bind( exporting name_obj = 'abap_data' name_prop = 'json_string' changing data = l_json_string ).
js_object->bind( exporting name_obj = 'abap_data' name_prop = 'script_started' changing data = js_started ).
* We use the JavaScript engine included in ABAP to read the JSON string.
* We simply use the recommended way to eval a JSON string as specified
* in RFC 4627 (http://www.ietf.org/rfc/rfc4627.txt).
*
* Security considerations:
*
* Generally there are security issues with scripting languages. JSON
* is a subset of JavaScript, but it is a safe subset that excludes
* assignment and invocation.
*
* A JSON text can be safely passed into JavaScript's eval() function
* (which compiles and executes a string) if all the characters not
* enclosed in strings are in the set of characters that form JSON
* tokens. This can be quickly determined in JavaScript with two
* regular expressions and calls to the test and replace methods.
*
* var my_JSON_object = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
* text.replace(/"(\\.|[^"\\])*"/g, ''))) &&
* eval('(' + text + ')');
concatenate
'var json_obj; '
'var json_text; '
'function start() { '
' if(abap_data.script_started) { return; } '
' json_text = abap_data.json_string;'
' json_obj = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test( '
' json_text.replace(/"(\\.|[^"\\])*"/g, ''''))) && '
' eval(''('' + json_text + '')''); '
' abap_data.script_started = 1; '
'} '
'if(!abap_data.script_started) start(); '
into js_script respecting blanks separated by xnl.
js_object->compile( script_name = 'json_parser' script = js_script ).
js_object->execute( script_name = 'json_parser' ).
if js_object->last_error_message is not initial.
RAISE EXCEPTION type zcx_json
EXPORTING
message = js_object->last_error_message.
endif.
endif.
** End of JS processing.
**
if var_name is not initial.
concatenate property_path var_name into l_property_path separated by '.'.
else.
l_property_path = property_path.
endif.
**
**
js_property_table = js_object->get_properties_scope_global( property_path = l_property_path ).
property_table = js_property_table.
* Exit if abap_data is not supplied, normally when called
* from json_deserialize to get top level properties
if abap_data is not supplied.
exit.
endif. "***
*
* Get ABAP data type, dereference if necessary and start
datadesc = cl_abap_typedescr=>DESCRIBE_BY_DATA( abap_data ).
if datadesc->kind eq cl_abap_typedescr=>kind_ref.
assign abap_data->* to <abap_data>.
else.
assign abap_data to <abap_data>.
endif.
datadesc = cl_abap_typedescr=>DESCRIBE_BY_DATA( <abap_data> ).
case datadesc->kind.
when cl_abap_typedescr=>kind_elem.
* Scalar: process ABAP elements. Assume no type conversions for the moment.
if var_name is initial.
RAISE EXCEPTION type zcx_json
EXPORTING
message = 'VAR_NAME is required for scalar values.'.
endif.
js_property_table = js_object->get_properties_scope_global( property_path = property_path ).
read table js_property_table with key name = var_name into js_property.
if sy-subrc eq 0.
assign_scalar_value <abap_data> js_property-value.
endif.
when cl_abap_typedescr=>kind_struct.
* Process ABAP structures
strudesc ?= datadesc.
loop at js_property_table assigning <jsprop>.
compname = <jsprop>-name.
translate compname to upper case.
read table strudesc->COMPONENTS with key name = compname into l_comp.
if sy-subrc eq 0.
assign component l_comp-name of structure <abap_data> to <comp>.
case l_comp-type_kind.
when cl_abap_typedescr=>TYPEKIND_STRUCT1 " 'v'
or cl_abap_typedescr=>TYPEKIND_STRUCT2 " 'u'
or cl_abap_typedescr=>TYPEKIND_TABLE. " 'h' (may need a different treatment one day)
concatenate l_property_path <jsprop>-name into item_path separated by '.'.
*> Recursive call here
json2abap( exporting property_path = item_path changing abap_data = <comp> js_object = js_object ).
when others.
* Process scalars in structures (same as the kind_elem above)
assign_scalar_value <comp> <jsprop>-value.
endcase.
endif.
endloop.
when cl_abap_typedescr=>kind_table.
* Process ABAP tables
if js_property_table is not initial.
tabldesc ?= datadesc.
linedesc = tabldesc->get_table_line_type( ).
linetype = linedesc->get_relative_name( ).
assign <abap_data> to <itab>.
loop at js_property_table into js_property where name NE 'length'. " the JS object length
create data newline type (linetype).
assign newline->* to <comp>.
case js_property-kind.
when 'O'.
concatenate l_property_path js_property-name into item_path separated by '.'.
condense item_path.
*> Recursive call here
json2abap( exporting property_path = item_path changing abap_data = newline js_object = js_object ).
when others. " Assume scalars, 'S', 'I', or other JS types
" Process scalars in plain table components(same as the kind_elem above)
assign_scalar_value <comp> js_property-value.
endcase.
insert <comp> into table <itab>.
free newline.
endloop.
endif.
when others. " kind_class, kind_intf
" forget it.
endcase.
endmethod.
method JSON_DESERIALIZE.
type-pools: ABAP, JS.
** Remember function parameter types
**constants:
** abap_func_exporting type abap_func_parmbind-kind value 10,
** abap_func_importing type abap_func_parmbind-kind value 20,
** abap_func_tables type abap_func_parmbind-kind value 30,
** abap_func_changing type abap_func_parmbind-kind value 40.
data paramname type string.
data js_obj type ref to cl_java_script.
data js_prop_tab type js_property_tab.
field-symbols <js_prop> type line of js_property_tab.
field-symbols <parm> type abap_func_parmbind.
if json is initial. exit. endif.
json2abap( exporting json_string = json importing property_table = js_prop_tab changing js_object = js_obj ).
loop at js_prop_tab assigning <js_prop>.
paramname = <js_prop>-name.
translate paramname to upper case.
read table paramtab with key name = paramname assigning <parm>.
if sy-subrc eq 0.
if <parm>-kind ne abap_func_importing. "" va al revés, cuidado!!!
json2abap( exporting var_name = <js_prop>-name changing abap_data = <parm>-value js_object = js_obj ).
endif.
endif.
endloop.
endmethod.
method NOTES.
data location type string.
concatenate me->my_url me->my_service '/RFC_SYSTEM_INFO' into location.
concatenate
'<html><head><title>JSON (NEW) handler notes</title></head><body>'
'<h4>About this service...</h4>'
'This is the ABAP implementation of a conversion program that'
' tranforms ABAP data into a <a href="http://www.json.org">JSON</a> representation.'
'<p>'
'It provides a user interface in the form of a ICF service that '
'allows web invocation of ABAP function modules. It doesn''t matter if they are RFC enabled or not.'
'<p>In this system this service has '
'been assigned to ICF service <a href="' me->my_url me->my_service '">' me->my_service '</a>.'
'<p>'
'In order to invoke a function module, just put its name in the PATH_INFO '
'of the service URL, as is shown in the following examples.'
'<p>Try the following link to do the default call in JSON format:<pre><a href="' location '?format=json">'
location
'?format=json</a></pre>'
'<p>A simple syntax allows to get the output in different formats.<p>'
'The following gets the output in <a href="http://yaml.org">YAML</a> format:'
'<pre><a href="' location '?format=yaml">'
location
'?format=yaml</a></pre>'
''
'<p>And this will get the output in a basic XML representation: <pre><a href="' location '?format=xml">'
location
'?format=xml</a></pre>'
'<p>And, just for fun, getting it into Perl format could be handy: <pre><a href="' location '?format=perl">'
location
'?format=perl</a></pre>'
'<p>Finnally, you can add a callback to get the JSON response enclosed in a javascript function call,'
' in order to allow a <a href="http://en.wikipedia.org/wiki/JSONP">JSONP</a> style response: '
'<pre><a href="'
location '?format=json&callback=callMe">'
location '?format=json&callback=callMe</a></pre>'
'<hr><h4>WARNING</h4>This is work in progress and may not be suitable for use in productive '
'systems. The interface is somewhat unstable. Please feel free to test it and report '
'any bug and improvement you may find.'
'<p>Use it at your own risk!'
'<p>For more information: <a href="https://cw.sdn.sap.com/cw/groups/json-adapter-for-abap-function-modules">'
'https://cw.sdn.sap.com/cw/groups/json-adapter-for-abap-function-modules</a>'
'<p>'
'If you have any questions, please contact me at <a href="mailto:[email protected]">'
'[email protected]</a>'
'<p>'
'<hr></body></html>'
into text RESPECTING BLANKS.
endmethod.
method SERIALIZE_ID.
*/***********************************************************/*
*/ New method using the built-in transformation /*
*/ included in releases 7.02 and 7.03/7.31 (Kernelpatch 116) /*
*/ Generates both JSON and XML formats!!
*/***********************************************************/*
*/
** Remember function parameter types
**constants:
** abap_func_exporting type abap_func_parmbind-kind value 10,
** abap_func_importing type abap_func_parmbind-kind value 20,
** abap_func_tables type abap_func_parmbind-kind value 30,
** abap_func_changing type abap_func_parmbind-kind value 40.
type-pools: ABAP.
data:
stab type ABAP_TRANS_SRCBIND_TAB,
slin type ABAP_TRANS_SRCBIND,
oexcp type ref to cx_root,
etext type string,
adata type ref to data,
json_writer type ref to cl_sxml_string_writer.
field-symbols <parm> type abap_func_parmbind.
* field-symbols <excep> type abap_func_excpbind.
loop at paramtab assigning <parm>.
if show_impp ne 'X'
and <parm>-kind eq abap_func_exporting. "" va al revés, cuidado!!!
continue.
endif.
slin-name = <parm>-name.
slin-value = <parm>-value.
append slin to stab. clear slin.
endloop.
if exceptab is not initial.
slin-name = 'EXCEPTION'.
get reference of exceptab into adata.
slin-value = adata.
append slin to stab. clear slin.
endif.
json_writer = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
try.
case format.
when 'XML'.
call transformation id options data_refs = 'embedded'
initial_components = 'include'
source (stab)
result xml o_string.
when others.
call transformation id options data_refs = 'embedded'
initial_components = 'include'
source (stab)
result xml json_writer.
o_string = cl_abap_codepage=>convert_from( json_writer->get_output( ) ).
* json_string = json_writer->get_output( ).
if jsonp is not initial.
concatenate jsonp '(' o_string ');' into o_string.
endif.
endcase.
catch cx_root into oexcp.
etext = oexcp->if_message~get_text( ).
RAISE EXCEPTION type zcx_json
EXPORTING
message = etext.
endtry.
endmethod.
method serialize_json.
* ABAP based JSON serializer for function modules (January 2013).
type-pools: abap.
** Remember function parameter types
**constants:
** abap_func_exporting type abap_func_parmbind-kind value 10,
** abap_func_importing type abap_func_parmbind-kind value 20,
** abap_func_tables type abap_func_parmbind-kind value 30,
** abap_func_changing type abap_func_parmbind-kind value 40.
data json_fragments type table of string.
data rec_json_string type string.
data paramname type string.
data l_lines type i.
data l_index type i.
data upcase type xfeld value abap_true.
data my_camelcase type xfeld.
my_camelcase = camelcase.
field-symbols <parm> type abap_func_parmbind.
field-symbols <excep> type abap_func_excpbind.
if jsonp is not initial.
append jsonp to json_fragments.
append '(' to json_fragments.
endif.
rec_json_string = '{'.
append rec_json_string to json_fragments.
clear rec_json_string.
clear l_index.
l_lines = lines( paramtab ).
loop at paramtab assigning <parm>.
if show_impp ne 'X'
and <parm>-kind eq abap_func_exporting. "" va al revés, cuidado!!!
subtract 1 from l_lines.
continue.
endif.
add 1 to l_index.
paramname = <parm>-name.
if lowercase eq abap_true.
translate paramname to lower case.
" paramname = to_lower( paramname ).
upcase = space.
endif.
if camelcase eq abap_true.
paramname = to_mixed( val = paramname case = 'a').
else.
read table camelcase_names from paramname transporting no fields.
if sy-subrc eq 0.
paramname = to_mixed( val = paramname case = 'a' ).
my_camelcase = abap_true.
else.
my_camelcase = abap_false.
endif.
endif.
rec_json_string = abap2json( abap_data = <parm>-value name = paramname upcase = upcase camelcase = my_camelcase camelcase_names = camelcase_names ).
append rec_json_string to json_fragments.
clear rec_json_string.
if l_index < l_lines.
append ',' to json_fragments .
endif .
endloop.
if exceptab is not initial.
if l_lines gt 0.
append ',' to json_fragments.
endif.
rec_json_string = abap2json( abap_data = exceptab upcase = 'X' name = 'EXCEPTION').
append rec_json_string to json_fragments.
clear rec_json_string.
endif.
rec_json_string = '}'.
append rec_json_string to json_fragments.
clear rec_json_string.
if jsonp is not initial.
append ');' to json_fragments.
endif.
concatenate lines of json_fragments into o_string.
endmethod.
method SERIALIZE_PERL.
* Just for fun, generate data in Perl Data::Dumper format.
type-pools: ABAP.
**Remember function parameter types
**constants:
** abap_func_exporting type abap_func_parmbind-kind value 10,
** abap_func_importing type abap_func_parmbind-kind value 20,
** abap_func_tables type abap_func_parmbind-kind value 30,
** abap_func_changing type abap_func_parmbind-kind value 40.
data perl_fragments type table of string.
data rec_perl_string type string.
data paramname type string.
data l_lines type i.
data l_index type i.
data upcase type xfeld value 'X'.
data perl_var type string.
field-symbols <parm> type abap_func_parmbind.
field-symbols <excep> type abap_func_excpbind.
if jsonp is not initial.
perl_var = jsonp.
else.
perl_var = funcname.
endif.
concatenate '$' perl_var ' = {' into rec_perl_string.
append rec_perl_string to perl_fragments.
clear rec_perl_string.
clear l_index.
l_lines = lines( paramtab ).
loop at paramtab assigning <parm>.
if show_impp ne 'X'
and <parm>-kind eq abap_func_exporting. "" va al revés, cuidado!!!
subtract 1 from l_lines.
continue.
endif.
add 1 to l_index.
paramname = <parm>-name.
if lowercase eq abap_true.
translate paramname to lower case.
upcase = space.
endif.
rec_perl_string = abap2perl( abap_data = <parm>-value name = paramname upcase = upcase ).
append rec_perl_string to perl_fragments.
clear rec_perl_string.
if l_index < l_lines.
append ',' to perl_fragments .
endif .
endloop.
if exceptab is not initial.
if l_lines gt 0.
append ',' to perl_fragments.
endif.
rec_perl_string = abap2perl( abap_data = exceptab upcase = 'X' name = 'EXCEPTION').
append rec_perl_string to perl_fragments.
clear rec_perl_string.
endif.
rec_perl_string = '};'.
append rec_perl_string to perl_fragments.
clear rec_perl_string.
concatenate lines of perl_fragments into perl_string.
endmethod.
method SERIALIZE_XML.
* Serialize function data into simple XML
*/ Look at method serialize_id for a new way of doing XML.
type-pools: ABAP.
** Remember function parameter types
***constants:
*** abap_func_exporting type abap_func_parmbind-kind value 10,
*** abap_func_importing type abap_func_parmbind-kind value 20,
*** abap_func_tables type abap_func_parmbind-kind value 30,
*** abap_func_changing type abap_func_parmbind-kind value 40.
data rec_xml_string type string.
data xml_fragments type table of string.
data l_funcname type string.
data paramname type string.
field-symbols <parm> type abap_func_parmbind.
field-symbols <excep> type abap_func_excpbind.
data upcase type xfeld value 'X'.
constants:
xml_head type string value '<?xml version="1.0" encoding="utf-8"?>'.
append xml_head to xml_fragments.
l_funcname = funcname.
if lowercase eq abap_true.
translate l_funcname to lower case.
upcase = space.
endif.
concatenate '<' l_funcname '>' into rec_xml_string.
append rec_xml_string to xml_fragments.
loop at paramtab assigning <parm>.
if show_impp ne 'X'
and <parm>-kind eq abap_func_exporting. "" va al revés, cuidado!!!
continue.
endif.
paramname = <parm>-name.
if lowercase eq abap_true.
translate paramname to lower case.
endif.
rec_xml_string = abap2xml( name = paramname abap_data = <parm>-value upcase = upcase ).
append rec_xml_string to xml_fragments.
endloop.
if exceptab is not initial.
rec_xml_string = abap2xml( name = 'EXCEPTION' abap_data = exceptab upcase = upcase ).
append rec_xml_string to xml_fragments.
endif.
concatenate '</' l_funcname '>' into rec_xml_string.
append rec_xml_string to xml_fragments.
concatenate lines of xml_fragments into o_string.
endmethod.
method SERIALIZE_YAML.
* Now, go and represent function data in YAML (http://yaml.org)
type-pools: ABAP.
** Remember function parameter types
**constants:
** abap_func_exporting type abap_func_parmbind-kind value 10,
** abap_func_importing type abap_func_parmbind-kind value 20,
** abap_func_tables type abap_func_parmbind-kind value 30,
** abap_func_changing type abap_func_parmbind-kind value 40.
data yaml_fragments type table of string.
data rec_yaml_string type string.
data rec_yaml_table type table of string.
data paramname type string.
field-symbols <parm> type abap_func_parmbind.
field-symbols <excep> type abap_func_excpbind.
data upcase type xfeld value 'X'.
data yaml_head type string value '--- #YAML:1.0'.
concatenate yaml_head xnl into rec_yaml_string.
append rec_yaml_string to yaml_fragments.
clear rec_yaml_string.
loop at paramtab assigning <parm>.
if show_impp ne 'X'
and <parm>-kind eq abap_func_exporting. "" va al revés, cuidado!!!
continue.
endif.
paramname = <parm>-name.
if lowercase eq abap_true.
translate paramname to lower case.
upcase = space.
endif.
rec_yaml_string = abap2yaml( abap_data = <parm>-value name = paramname upcase = upcase ).
append rec_yaml_string to yaml_fragments.
clear rec_yaml_string.
endloop.
if exceptab is not initial.
rec_yaml_string = abap2yaml( abap_data = exceptab name = 'EXCEPTION' upcase = 'X' ).
append rec_yaml_string to yaml_fragments.
clear rec_yaml_string.
endif.
* append xnl to yaml_fragments.
concatenate lines of yaml_fragments into yaml_string.
* if jsonp is not initial.
* concatenate jsonp '(' yaml_string ');' into yaml_string.
* endif.
endmethod.
ENDCLASS.
| [
4871,
1168,
5097,
62,
40386,
62,
39,
6981,
39878,
6770,
198,
220,
1171,
198,
220,
2251,
1171,
764,
198,
198,
11377,
2665,
13,
198,
220,
2099,
12,
7742,
82,
9564,
2969,
764,
198,
220,
2099,
12,
7742,
82,
26755,
764,
198,
198,
9,
1,
9,
1171,
6805,
286,
1398,
1168,
5097,
62,
40386,
62,
39,
6981,
39878,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
198,
220,
20314,
16876,
62,
40717,
62,
13918,
16938,
2849,
764,
628,
220,
38491,
1395,
32572,
2099,
9564,
2969,
62,
38019,
16,
1988,
4064,
62,
13965,
24027,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
1395,
34,
7836,
37,
2099,
9564,
2969,
62,
9419,
62,
43,
37,
1988,
4064,
62,
9419,
62,
43,
37,
22492,
15285,
62,
32541,
13,
198,
220,
1366,
17615,
62,
35009,
27389,
2099,
19269,
2751,
764,
198,
220,
1366,
17615,
62,
21886,
2099,
19269,
2751,
764,
628,
220,
1398,
12,
24396,
82,
9564,
2969,
17,
40386,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
6242,
2969,
62,
26947,
2099,
42865,
198,
220,
220,
220,
220,
220,
5145,
20608,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
52,
5662,
11159,
2099,
1395,
37,
24639,
11902,
198,
220,
220,
220,
220,
220,
5145,
34,
2390,
3698,
34,
11159,
2099,
1395,
37,
24639,
11902,
198,
220,
220,
220,
220,
220,
5145,
34,
2390,
3698,
34,
11159,
62,
45,
29559,
2099,
19269,
2751,
5603,
33,
11902,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
40386,
62,
18601,
2751,
8,
2099,
19269,
2751,
198,
220,
220,
220,
13269,
198,
220,
220,
220,
220,
220,
33854,
62,
1268,
62,
26947,
62,
30910,
40165,
764,
198,
220,
1398,
12,
24396,
82,
9564,
2969,
17,
18973,
43,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
6242,
2969,
62,
26947,
2099,
42865,
198,
220,
220,
220,
220,
220,
5145,
20608,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
52,
5662,
11159,
2099,
1395,
37,
24639,
11902,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
18973,
43,
62,
18601,
2751,
8,
2099,
19269,
2751,
198,
220,
220,
220,
13269,
198,
220,
220,
220,
220,
220,
33854,
62,
1268,
62,
26947,
62,
30910,
40165,
764,
198,
220,
1398,
12,
24396,
82,
9564,
2969,
17,
55,
5805,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
6242,
2969,
62,
26947,
2099,
42865,
198,
220,
220,
220,
220,
220,
5145,
20608,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
54,
10554,
62,
55,
5805,
62,
37682,
1137,
2099,
9564,
2969,
62,
8202,
3535,
4277,
9564,
2969,
62,
37,
23719,
198,
220,
220,
220,
220,
220,
5145,
52,
5662,
11159,
2099,
1395,
37,
24639,
11902,
198,
220,
220,
220,
220,
220,
5145,
20608,
62,
1404,
49,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
55,
5805,
62,
18601,
2751,
8,
2099,
19269,
2751,
764,
198,
220,
1398,
12,
24396,
82,
9564,
2969,
17,
56,
2390,
43,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
6242,
2969,
62,
26947,
2099,
42865,
198,
220,
220,
220,
220,
220,
5145,
20608,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
52,
5662,
11159,
2099,
1395,
37,
24639,
11902,
198,
220,
220,
220,
220,
220,
5145,
56,
62,
2538,
18697,
2099,
314,
4277,
657,
198,
220,
220,
220,
220,
220,
5145,
50,
62,
12115,
6369,
2099,
314,
4277,
657,
198,
220,
220,
220,
220,
220,
5145,
39776,
2257,
62,
49,
3913,
2099,
1395,
37,
24639,
11902,
198,
220,
220,
220,
220,
220,
5145,
35,
35830,
62,
12115,
3525,
2099,
1395,
37,
24639,
11902,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
56,
2390,
43,
62,
18601,
2751,
8,
2099,
19269,
2751,
198,
220,
220,
220,
13269,
198,
220,
220,
220,
220,
220,
33854,
62,
1268,
62,
26947,
62,
30910,
40165,
764,
198,
220,
1398,
12,
24396,
82,
20571,
26761,
62,
27082,
40834,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
42296,
4177,
2849,
62,
20608,
2099,
19340,
2548,
43,
62,
43221,
2390,
198,
220,
220,
220,
39133,
198,
220,
220,
220,
220,
220,
5145,
27082,
2390,
5603,
33,
2099,
9564,
2969,
62,
42296,
34,
62,
27082,
10744,
12115,
62,
5603,
33,
198,
220,
220,
220,
220,
220,
5145,
6369,
5222,
47,
5603,
33,
2099,
9564,
2969,
62,
42296,
34,
62,
6369,
8697,
33,
12115,
62,
5603,
33,
198,
220,
220,
220,
220,
220,
5145,
27082,
40834,
2099,
15529,
198,
220,
220,
220,
13269,
198,
220,
220,
220,
220,
220,
3268,
23428,
2389,
62,
42296,
4177,
2849,
198,
220,
220,
220,
220,
220,
4725,
40331,
15490,
1961,
62,
27082,
2390,
62,
25216,
764,
198,
220,
1398,
12,
24396,
82,
19449,
17,
6242,
2969,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
40386,
62,
18601,
2751,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
53,
1503,
62,
20608,
2099,
19269,
2751,
11902,
198,
220,
220,
220,
220,
220,
5145,
4805,
31054,
9936,
62,
34219,
2099,
19269,
2751,
4277,
705,
17752,
62,
26801,
6,
198,
220,
220,
220,
39133,
198,
220,
220,
220,
220,
220,
1988,
7,
4805,
31054,
9936,
62,
38148,
8,
2099,
26755,
62,
4805,
31054,
9936,
62,
5603,
33,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
20120,
62,
9864,
23680,
2099,
1006,
284,
7852,
62,
41,
10116,
32,
62,
6173,
46023,
11902,
198,
220,
220,
220,
220,
220,
1988,
7,
6242,
2969,
62,
26947,
8,
2099,
15529,
11902,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
40386,
764,
198,
220,
1398,
12,
24396,
82,
19449,
62,
30910,
1137,
12576,
35400,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
40386,
2099,
19269,
2751,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
27082,
2390,
5603,
33,
2099,
9564,
2969,
62,
42296,
34,
62,
27082,
10744,
12115,
62,
5603,
33,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT Z_GCTSUNIT.
write 'Unit test pass'. | [
9,
5,
10097,
30934,
9,
198,
9,
5,
6358,
1168,
62,
38,
4177,
50,
4944,
2043,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
198,
9,
5,
10097,
30934,
9,
198,
2200,
15490,
1168,
62,
38,
4177,
50,
4944,
2043,
13,
198,
13564,
705,
26453,
1332,
1208,
4458
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS ltc_check_cell_column_formula DEFINITION DEFERRED.
CLASS zcl_excel_worksheet DEFINITION LOCAL FRIENDS
ltc_check_cell_column_formula.
CLASS lcl_excel_worksheet_test DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
* ================
DATA:
f_cut TYPE REF TO zcl_excel_worksheet. "class under test
CLASS-METHODS: class_setup.
CLASS-METHODS: class_teardown.
METHODS: setup.
METHODS: teardown.
METHODS: set_merge FOR TESTING RAISING cx_static_check.
METHODS: delete_merge FOR TESTING RAISING cx_static_check.
METHODS: get_dimension_range FOR TESTING RAISING cx_static_check.
ENDCLASS. "lcl_Excel_Worksheet_Test
CLASS ltc_check_cell_column_formula DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
METHODS: success FOR TESTING RAISING cx_static_check.
METHODS: fails_both_formula_id_value FOR TESTING RAISING cx_static_check.
METHODS: fails_both_formula_id_formula FOR TESTING RAISING cx_static_check.
METHODS: formula_id_not_found FOR TESTING RAISING cx_static_check.
METHODS: outside_table_fails__above FOR TESTING RAISING cx_static_check.
METHODS: outside_table_fails__below FOR TESTING RAISING cx_static_check.
METHODS: outside_table_fails__left FOR TESTING RAISING cx_static_check.
METHODS: outside_table_fails__right FOR TESTING RAISING cx_static_check.
METHODS: must_be_in_same_column FOR TESTING RAISING cx_static_check.
METHODS: setup.
METHODS: should_fail
IMPORTING
ip_formula_id TYPE zexcel_s_cell_data-column_formula_id
ip_formula TYPE zexcel_s_cell_data-cell_formula OPTIONAL
ip_value TYPE zexcel_s_cell_data-cell_value OPTIONAL
ip_row TYPE zexcel_s_cell_data-cell_row
ip_column TYPE zexcel_s_cell_data-cell_column
ip_exp TYPE string
RAISING
zcx_excel.
DATA: mt_column_formulas TYPE zcl_excel_worksheet=>mty_th_column_formula,
c_messages LIKE zcl_excel_worksheet=>c_messages.
ENDCLASS.
CLASS lcl_excel_worksheet_test IMPLEMENTATION.
* ==============================================
METHOD class_setup.
* ===================
ENDMETHOD. "class_Setup
METHOD class_teardown.
* ======================
ENDMETHOD. "class_Teardown
METHOD setup.
* =============
DATA lo_excel TYPE REF TO zcl_excel.
CREATE OBJECT lo_excel.
TRY.
CREATE OBJECT f_cut
EXPORTING
ip_excel = lo_excel.
CATCH zcx_excel.
cl_abap_unit_assert=>fail( 'Could not create instance' ).
ENDTRY.
ENDMETHOD. "setup
METHOD teardown.
* ================
ENDMETHOD. "teardown
METHOD set_merge.
* ====================
DATA lt_merge TYPE string_table.
DATA lv_merge TYPE string.
DATA lv_size TYPE i.
DATA lv_size_next TYPE i.
* Test 1. Simple test for initial value
lt_merge = f_cut->get_merge( ).
lv_size = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size
exp = 0
msg = 'Initial state of merge table is not empty'
level = if_aunit_constants=>critical
).
* Test 2. Add merge
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
lt_merge = f_cut->get_merge( ).
lv_size_next = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size_next - lv_size
exp = 1
msg = 'Expect add 1 table line when 1 merge added'
level = if_aunit_constants=>critical
).
* Test 2. Add same merge
lv_size = lv_size_next.
TRY.
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
CATCH zcx_excel.
ENDTRY.
lt_merge = f_cut->get_merge( ).
lv_size_next = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size_next - lv_size
exp = 0
msg = 'Expect no change when add same merge'
level = if_aunit_constants=>critical
).
* Test 3. Add one different merge
lv_size = lv_size_next.
f_cut->set_merge(
ip_column_start = 4
ip_column_end = 5
ip_row = 2
ip_row_to = 3
).
lt_merge = f_cut->get_merge( ).
lv_size_next = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size_next - lv_size
exp = 1
msg = 'Expect 1 change when add different merge'
level = if_aunit_constants=>critical
).
* Test 4. Merge added with concrete value #1
f_cut->delete_merge( ).
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
lt_merge = f_cut->get_merge( ).
READ TABLE lt_merge INTO lv_merge INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lv_merge
exp = 'B2:C3'
msg = 'Expect B2:C3'
level = if_aunit_constants=>critical
).
* Test 5. Merge added with concrete value #2
f_cut->delete_merge( ).
f_cut->set_merge(
ip_column_start = 4
ip_column_end = 5
ip_row = 4
ip_row_to = 5
).
lt_merge = f_cut->get_merge( ).
READ TABLE lt_merge INTO lv_merge INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lv_merge
exp = 'D4:E5'
msg = 'Expect D4:E5'
level = if_aunit_constants=>critical
).
ENDMETHOD.
METHOD delete_merge.
* ====================
DATA lt_merge TYPE string_table.
DATA lv_merge TYPE string.
DATA lv_size TYPE i.
DATA lv_index TYPE i.
* Test 1. Simple test delete all merges
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
f_cut->delete_merge( ).
lt_merge = f_cut->get_merge( ).
lv_size = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size
exp = 0
msg = 'Expect merge table with 1 line fully cleared'
level = if_aunit_constants=>critical
).
* Test 2. Simple test delete all merges
DO 10 TIMES.
f_cut->set_merge(
ip_column_start = 2 + sy-index * 2
ip_column_end = 3 + sy-index * 2
ip_row = 2 + sy-index * 2
ip_row_to = 3 + sy-index * 2
).
ENDDO.
f_cut->delete_merge( ).
lt_merge = f_cut->get_merge( ).
lv_size = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size
exp = 0
msg = 'Expect merge table with few lines fully cleared'
level = if_aunit_constants=>critical
).
* Test 3. Delete concrete merge with success
DO 4 TIMES.
lv_index = sy-index.
f_cut->delete_merge( ).
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
CASE lv_index.
WHEN 1. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 2 ).
WHEN 2. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 3 ).
WHEN 3. f_cut->delete_merge( ip_cell_column = 3 ip_cell_row = 2 ).
WHEN 4. f_cut->delete_merge( ip_cell_column = 3 ip_cell_row = 3 ).
ENDCASE.
lt_merge = f_cut->get_merge( ).
lv_size = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size
exp = 0
msg = 'Expect merge table with 1 line fully cleared'
level = if_aunit_constants=>critical
).
ENDDO.
* Test 4. Delete concrete merge with fail
DO 4 TIMES.
lv_index = sy-index.
f_cut->delete_merge( ).
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
CASE lv_index.
WHEN 1. f_cut->delete_merge( ip_cell_column = 1 ip_cell_row = 2 ).
WHEN 2. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 1 ).
WHEN 3. f_cut->delete_merge( ip_cell_column = 4 ip_cell_row = 2 ).
WHEN 4. f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 4 ).
ENDCASE.
lt_merge = f_cut->get_merge( ).
lv_size = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size
exp = 1
msg = 'Expect no merge were deleted'
level = if_aunit_constants=>critical
).
ENDDO.
* Test 5. Delete concrete merge #1
f_cut->delete_merge( ).
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
f_cut->set_merge(
ip_column_start = 4
ip_column_end = 5
ip_row = 4
ip_row_to = 5
).
f_cut->delete_merge( ip_cell_column = 2 ip_cell_row = 2 ).
lt_merge = f_cut->get_merge( ).
lv_size = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size
exp = 1
msg = 'Expect we have the one merge'
level = if_aunit_constants=>critical
).
READ TABLE lt_merge INTO lv_merge INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lv_merge
exp = 'D4:E5'
msg = 'Expect delete B2:C3 merge'
level = if_aunit_constants=>critical
).
* Test 6. Delete concrete merge #2
f_cut->delete_merge( ).
f_cut->set_merge(
ip_column_start = 2
ip_column_end = 3
ip_row = 2
ip_row_to = 3
).
f_cut->set_merge(
ip_column_start = 4
ip_column_end = 5
ip_row = 4
ip_row_to = 5
).
f_cut->delete_merge( ip_cell_column = 4 ip_cell_row = 4 ).
lt_merge = f_cut->get_merge( ).
lv_size = lines( lt_merge ).
cl_abap_unit_assert=>assert_equals(
act = lv_size
exp = 1
msg = 'Expect we have the one merge'
level = if_aunit_constants=>critical
).
READ TABLE lt_merge INTO lv_merge INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lv_merge
exp = 'B2:C3'
msg = 'Expect delete D4:E5 merge'
level = if_aunit_constants=>critical
).
ENDMETHOD. "delete_Merge
METHOD get_dimension_range.
cl_abap_unit_assert=>assert_equals(
act = f_cut->get_dimension_range( )
exp = 'A1'
msg = 'get_dimension_range inital value'
level = if_aunit_constants=>critical
).
f_cut->set_cell(
ip_row = 2
ip_column = 3
ip_value = 'Dummy'
).
f_cut->set_cell(
ip_row = 5
ip_column = 6
ip_value = 'Dummy'
).
cl_abap_unit_assert=>assert_equals(
act = f_cut->get_dimension_range( )
exp = 'C2:F5'
msg = 'get_dimension_range'
level = if_aunit_constants=>critical
).
ENDMETHOD.
ENDCLASS. "lcl_Excel_Worksheet_Test
CLASS ltc_check_cell_column_formula IMPLEMENTATION.
METHOD setup.
DATA: ls_column_formula TYPE zcl_excel_worksheet=>mty_s_column_formula.
c_messages = zcl_excel_worksheet=>c_messages.
" Column Formula in table A1:B4 (for unknown reason, bottom_right_row is last actual row minus 1)
CLEAR ls_column_formula.
ls_column_formula-id = 1.
ls_column_formula-column = 1.
ls_column_formula-table_top_left_row = 1.
ls_column_formula-table_bottom_right_row = 3.
ls_column_formula-table_left_column_int = 1.
ls_column_formula-table_right_column_int = 2.
INSERT ls_column_formula INTO TABLE mt_column_formulas.
" Column Formula in table D1:E4 (for unknown reason, bottom_right_row is last actual row minus 1)
CLEAR ls_column_formula.
ls_column_formula-id = 2.
ls_column_formula-column = 4.
ls_column_formula-table_top_left_row = 1.
ls_column_formula-table_bottom_right_row = 3.
ls_column_formula-table_left_column_int = 4.
ls_column_formula-table_right_column_int = 5.
INSERT ls_column_formula INTO TABLE mt_column_formulas.
ENDMETHOD.
METHOD success.
zcl_excel_worksheet=>check_cell_column_formula(
it_column_formulas = mt_column_formulas
ip_column_formula_id = 1
ip_formula = ''
ip_value = ''
ip_row = 2
ip_column = 1 ).
ENDMETHOD.
METHOD fails_both_formula_id_value.
should_fail( ip_formula_id = 1 ip_formula = '' ip_value = '3.14' ip_row = 2 ip_column = 1 ip_exp = c_messages-formula_id_only_is_possible ).
ENDMETHOD.
METHOD fails_both_formula_id_formula.
should_fail( ip_formula_id = 1 ip_formula = 'A2' ip_value = '' ip_row = 2 ip_column = 1 ip_exp = c_messages-formula_id_only_is_possible ).
ENDMETHOD.
METHOD formula_id_not_found.
should_fail( ip_formula_id = 3 ip_row = 1 ip_column = 1 ip_exp = c_messages-column_formula_id_not_found ).
ENDMETHOD.
METHOD outside_table_fails__above.
should_fail( ip_formula_id = 2 ip_row = 1 ip_column = 1 ip_exp = c_messages-formula_not_in_this_table ).
ENDMETHOD.
METHOD outside_table_fails__below.
should_fail( ip_formula_id = 2 ip_row = 5 ip_column = 1 ip_exp = c_messages-formula_not_in_this_table ).
ENDMETHOD.
METHOD outside_table_fails__left.
should_fail( ip_formula_id = 2 ip_row = 2 ip_column = 0 ip_exp = c_messages-formula_not_in_this_table ).
ENDMETHOD.
METHOD outside_table_fails__right.
should_fail( ip_formula_id = 2 ip_row = 2 ip_column = 3 ip_exp = c_messages-formula_not_in_this_table ).
ENDMETHOD.
METHOD must_be_in_same_column.
should_fail( ip_formula_id = 1 ip_row = 2 ip_column = 2 ip_exp = c_messages-formula_in_other_column ).
ENDMETHOD.
METHOD should_fail.
DATA: lo_exception TYPE REF TO zcx_excel.
TRY.
zcl_excel_worksheet=>check_cell_column_formula(
EXPORTING
it_column_formulas = mt_column_formulas
ip_column_formula_id = ip_formula_id
ip_formula = ip_formula
ip_value = ip_value
ip_row = ip_row
ip_column = ip_column ).
cl_abap_unit_assert=>fail( msg = |Should have failed with error "{ ip_exp }"| ).
CATCH zcx_excel INTO lo_exception.
cl_abap_unit_assert=>assert_equals( act = lo_exception->get_text( ) exp = ip_exp msg = ip_exp ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
| [
31631,
300,
23047,
62,
9122,
62,
3846,
62,
28665,
62,
687,
4712,
5550,
20032,
17941,
23449,
1137,
22083,
13,
198,
31631,
1976,
565,
62,
1069,
5276,
62,
5225,
25473,
5550,
20032,
17941,
37347,
1847,
48167,
1677,
5258,
198,
220,
220,
220,
300,
23047,
62,
9122,
62,
3846,
62,
28665,
62,
687,
4712,
13,
198,
198,
31631,
300,
565,
62,
1069,
5276,
62,
5225,
25473,
62,
9288,
5550,
20032,
17941,
7473,
43001,
2751,
198,
220,
220,
220,
45698,
42,
49277,
43638,
5805,
7597,
198,
220,
220,
220,
360,
4261,
6234,
6006,
9863,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
9,
796,
25609,
18604,
198,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
277,
62,
8968,
41876,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
62,
5225,
25473,
13,
220,
366,
4871,
739,
1332,
628,
220,
220,
220,
42715,
12,
49273,
50,
25,
1398,
62,
40406,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
25,
1398,
62,
660,
446,
593,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
9058,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
573,
446,
593,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
900,
62,
647,
469,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
12233,
62,
647,
469,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
651,
62,
46156,
62,
9521,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
10619,
31631,
13,
220,
220,
220,
220,
220,
220,
366,
75,
565,
62,
3109,
5276,
62,
23044,
25473,
62,
14402,
628,
198,
31631,
300,
23047,
62,
9122,
62,
3846,
62,
28665,
62,
687,
4712,
5550,
20032,
17941,
7473,
43001,
2751,
198,
220,
220,
220,
45698,
42,
49277,
43638,
5805,
7597,
198,
220,
220,
220,
360,
4261,
6234,
6006,
9863,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
1943,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
10143,
62,
16885,
62,
687,
4712,
62,
312,
62,
8367,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
10143,
62,
16885,
62,
687,
4712,
62,
312,
62,
687,
4712,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
10451,
62,
312,
62,
1662,
62,
9275,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
2354,
62,
11487,
62,
69,
1768,
834,
29370,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
2354,
62,
11487,
62,
69,
1768,
834,
35993,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
2354,
62,
11487,
62,
69,
1768,
834,
9464,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
2354,
62,
11487,
62,
69,
1768,
834,
3506,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
1276,
62,
1350,
62,
259,
62,
31642,
62,
28665,
7473,
43001,
2751,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
9058,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
815,
62,
32165,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
20966,
62,
687,
4712,
62,
312,
41876,
1976,
1069,
5276,
62,
82,
62,
3846,
62,
7890,
12,
28665,
62,
687,
4712,
62,
312,
198,
220,
220,
220,
220,
220,
220,
220,
20966,
62,
687,
4712,
220,
220,
220,
41876,
1976,
1069,
5276,
62,
82,
62,
3846,
62,
7890,
12,
3846,
62,
687,
4712,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
20966,
62,
8367,
220,
220,
220,
220,
220,
41876,
1976,
1069,
5276,
62,
82,
62,
3846,
62,
7890,
12,
3846,
62,
8367,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
20966,
62,
808,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
1069,
5276,
62,
82,
62,
3846,
62,
7890,
12,
3846,
62,
808,
198,
220,
220,
220,
220,
220,
220,
220,
20966,
62,
28665,
220,
220,
220,
220,
41876,
1976,
1069,
5276,
62,
82,
62,
3846,
62,
7890,
12,
3846,
62,
28665,
198,
220,
220,
220,
220,
220,
220,
220,
20966,
62,
11201,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
1069,
5276,
13,
628,
220,
220,
220,
42865,
25,
45079,
62,
28665,
62,
687,
25283,
41876,
1976,
565,
62,
1069,
5276,
62,
5225,
25473,
14804,
76,
774,
62,
400,
62,
28665,
62,
687,
4712,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
62,
37348,
1095,
220,
220,
220,
220,
220,
220,
220,
220,
34178,
1976,
565,
62,
1069,
5276,
62,
5225,
25473,
14804,
66,
62,
37348,
1095,
13,
198,
198,
10619,
31631,
13,
628,
198,
31631,
300,
565,
62,
1069,
5276,
62,
5225,
25473,
62,
9288,
30023,
2538,
10979,
6234,
13,
198,
9,
46111,
25609,
28,
628,
220,
337,
36252,
1398,
62,
40406,
13,
198,
9,
36658,
855,
628,
220,
23578,
49273,
13,
220,
220,
220,
220,
220,
220,
366,
4871,
62,
40786,
628,
198,
220,
337,
36252,
1398,
62,
660,
446,
593,
13,
198,
9,
36658,
1421,
28,
628,
198,
220,
23578,
49273,
13,
220,
220,
220,
220,
220,
220,
366,
4871,
62,
6767,
446,
593,
628,
198,
220,
337,
36252,
9058,
13,
198,
9,
796,
25609,
628,
220,
220,
220,
42865,
2376,
62,
1069,
5276,
41876,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
13,
628,
220,
220,
220,
29244,
6158,
25334,
23680,
2376,
62,
1069,
5276,
13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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_aoc_check_79 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS check
REDEFINITION .
METHODS get_message_text
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_method,
clsname TYPE seoclsname,
cpdname TYPE seocpdname,
include TYPE programm,
END OF ty_method .
TYPES:
ty_methods_tt TYPE STANDARD TABLE OF ty_method WITH DEFAULT KEY .
DATA mt_compiler TYPE scr_refs .
DATA mt_statements TYPE zcl_aoc_scan=>ty_statements .
METHODS check_local
IMPORTING
!is_method TYPE ty_method
!is_local TYPE scr_ref
RETURNING
VALUE(rv_error) TYPE abap_bool .
METHODS find_writes
IMPORTING
!is_method TYPE ty_method
!is_local TYPE scr_ref
RETURNING
VALUE(rt_writes) TYPE scr_refs .
METHODS initialize
IMPORTING
!io_scan TYPE REF TO zcl_aoc_scan .
METHODS find_locals
IMPORTING
!is_method TYPE ty_method
RETURNING
VALUE(rt_locals) TYPE scr_refs .
METHODS find_methods
IMPORTING
!it_levels TYPE slevel_tab
RETURNING
VALUE(rt_methods) TYPE ty_methods_tt .
ENDCLASS.
CLASS ZCL_AOC_CHECK_79 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lt_methods TYPE ty_methods_tt,
lt_locals TYPE scr_refs,
lv_error TYPE abap_bool,
ls_local LIKE LINE OF lt_locals,
ls_method LIKE LINE OF lt_methods.
* Only consider local variables in global methods
IF object_type <> 'CLAS'.
RETURN.
ENDIF.
initialize( io_scan ).
lt_methods = find_methods( io_scan->levels ).
LOOP AT lt_methods INTO ls_method.
lt_locals = find_locals( ls_method ).
LOOP AT lt_locals INTO ls_local.
lv_error = check_local(
is_method = ls_method
is_local = ls_local ).
IF lv_error = abap_true.
inform( p_sub_obj_name = ls_method-include
p_line = ls_local-line
p_kind = mv_errty
p_test = myname
p_param_1 = ls_local-name
p_code = '001' ).
ENDIF.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD check_local.
DATA: lt_writes TYPE scr_refs,
ls_statement LIKE LINE OF mt_statements,
ls_first LIKE LINE OF lt_writes.
lt_writes = find_writes( is_method = is_method
is_local = is_local ).
READ TABLE lt_writes INDEX 1 INTO ls_first.
IF sy-subrc <> 0.
RETURN.
ENDIF.
* assumption: max one statement per line
READ TABLE mt_statements INTO ls_statement WITH KEY
include = is_method-include
start-row = ls_first-statement->start_line.
* note that for changed statements it might not find the correct STR, but this is okay
IF sy-subrc <> 0 OR ( ls_statement-str NP 'CLEAR *'
AND ls_statement-str NP 'REFRESH *'
AND ls_statement-str NP 'FREE *' ).
RETURN.
ENDIF.
LOOP AT mt_statements INTO ls_statement WHERE include = is_method-include
AND start-row < ls_first-line.
IF ls_statement-str CP 'SELECT SINGLE *'
OR ls_statement-str CP 'SELECT * INTO TABLE *'
OR ls_statement-str CP 'SELECT * INTO CORRESPONDING FIELDS OF TABLE *'
OR ls_statement-str CP 'SELECT * APPENDING TABLE *'
OR ls_statement-str CP 'SELECT * APPENDING CORRESPONDING FIELDS OF TABLE *'.
CONTINUE.
ENDIF.
IF ls_statement-str CP 'LOOP AT *'
OR ls_statement-str CP 'WHILE *'
OR ls_statement-str CP 'SELECT *'
OR ls_statement-str CP 'DO *'
OR ls_statement-str = 'DO'.
RETURN.
ENDIF.
ENDLOOP.
rv_error = abap_true.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '079'.
has_attributes = abap_true.
attributes_ok = abap_true.
ENDMETHOD.
METHOD find_locals.
rt_locals = mt_compiler.
DELETE rt_locals WHERE grade <> cl_abap_compiler=>grade_definition
OR mode2 <> '2'
OR statement->source_info->name <> is_method-include.
ENDMETHOD.
METHOD find_methods.
DATA: ls_mtdkey TYPE seocpdkey,
ls_method LIKE LINE OF rt_methods,
ls_level LIKE LINE OF it_levels.
LOOP AT it_levels INTO ls_level.
cl_oo_classname_service=>get_method_by_include(
EXPORTING
incname = ls_level-name
RECEIVING
mtdkey = ls_mtdkey
EXCEPTIONS
class_not_existing = 1
method_not_existing = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
CLEAR ls_method.
MOVE-CORRESPONDING ls_mtdkey TO ls_method.
ls_method-include = ls_level-name.
APPEND ls_method TO rt_methods.
ENDLOOP.
ENDMETHOD.
METHOD find_writes.
rt_writes = mt_compiler.
DELETE rt_writes WHERE statement->source_info->name <> is_method-include.
DELETE rt_writes WHERE full_name <> is_local-full_name.
DELETE rt_writes WHERE mode2 <> '6' AND mode2 <> '9' AND mode2 <> 'D'.
ENDMETHOD.
METHOD get_message_text.
CLEAR p_text.
CASE p_code.
WHEN '001'.
p_text = 'CLEAR as first of variable, &1'. "#EC NOTEXT
WHEN OTHERS.
super->get_message_text( EXPORTING p_test = p_test
p_code = p_code
IMPORTING p_text = p_text ).
ENDCASE.
ENDMETHOD.
METHOD initialize.
mt_compiler = zcl_aoc_compiler=>get_instance(
iv_object_type = object_type
iv_object_name = object_name )->get_result( ).
mt_statements = io_scan->build_statements( ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
64,
420,
62,
9122,
62,
3720,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
64,
420,
62,
16668,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
764,
628,
220,
220,
220,
337,
36252,
50,
2198,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
20500,
62,
5239,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
24396,
11,
198,
220,
220,
220,
220,
220,
220,
220,
537,
82,
3672,
41876,
384,
420,
7278,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
269,
30094,
3672,
41876,
384,
420,
30094,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2291,
41876,
1430,
76,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
24396,
764,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
24396,
82,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
24396,
13315,
5550,
38865,
35374,
764,
628,
220,
220,
220,
42865,
45079,
62,
5589,
5329,
41876,
6040,
62,
5420,
82,
764,
198,
220,
220,
220,
42865,
45079,
62,
14269,
3196,
41876,
1976,
565,
62,
64,
420,
62,
35836,
14804,
774,
62,
14269,
3196,
764,
628,
220,
220,
220,
337,
36252,
50,
2198,
62,
12001,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
24396,
220,
220,
220,
220,
220,
41876,
1259,
62,
24396,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
12001,
220,
220,
220,
220,
220,
220,
41876,
6040,
62,
5420,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
18224,
8,
41876,
450,
499,
62,
30388,
764,
198,
220,
220,
220,
337,
36252,
50,
1064,
62,
8933,
274,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
24396,
220,
220,
220,
220,
220,
220,
41876,
1259,
62,
24396,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
12001,
220,
220,
220,
220,
220,
220,
220,
41876,
6040,
62,
5420,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
8933,
274,
8,
41876,
6040,
62,
5420,
82,
764,
198,
220,
220,
220,
337,
36252,
50,
41216,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
35836,
41876,
4526,
37,
5390,
1976,
565,
62,
64,
420,
62,
35836,
764,
198,
220,
220,
220,
337,
36252,
50,
1064,
62,
17946,
874,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
24396,
220,
220,
220,
220,
220,
220,
41876,
1259,
62,
24396,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
17946,
874,
8,
41876,
6040,
62,
5420,
82,
764,
198,
220,
220,
220,
337,
36252,
50,
1064,
62,
24396,
82,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
46170,
220,
220,
220,
220,
220,
220,
220,
41876,
3133,
626,
62,
8658,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
24396,
82,
8,
41876,
1259,
62,
24396,
82,
62,
926,
764,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
32,
4503,
62,
50084,
62,
3720,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
2198,
13,
198,
198,
9,
450,
499,
11505,
7376,
4657,
198,
9,
3740,
1378,
12567,
13,
785,
14,
75,
5406,
79,
14,
397,
499,
11505,
7376,
4657,
198,
9,
17168,
13789,
628,
220,
220,
220,
42865,
25,
300,
83,
62,
24396,
82,
41876,
1259,
62,
24396,
82,
62,
926,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
17946,
874,
220,
41876,
6040,
62,
5420,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
18224,
220,
220,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
12001,
220,
220,
34178,
48920,
3963,
300,
83,
62,
17946,
874,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
24396,
220,
34178,
48920,
3963,
300,
83,
62,
24396,
82,
13,
628,
198,
9,
5514,
2074,
1957,
9633,
287,
3298,
5050,
198,
220,
220,
220,
16876,
2134,
62,
4906,
1279,
29,
705,
5097,
1921,
4458,
198,
220,
220,
220,
220,
220,
30826,
27064,
13,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
41216,
7,
33245,
62,
35836,
6739,
628,
220,
220,
220,
300,
83,
62,
24396,
82,
796,
1064,
62,
24396,
82,
7,
33245,
62,
35836,
3784,
46170,
6739,
628,
220,
220,
220,
17579,
3185,
5161,
300,
83,
62,
24396,
82,
39319,
43979,
62,
24396,
13,
198,
220,
220,
220,
220,
220,
300,
83,
62,
17946,
874,
796,
1064,
62,
17946,
874,
7,
43979,
62,
24396,
6739,
628,
220,
220,
220,
220,
220,
17579,
3185,
5161,
300,
83,
62,
17946,
874,
39319,
43979,
62,
12001,
13,
198,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
18224,
796,
2198,
62,
12001,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
24396,
796,
43979,
62,
24396,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
12001,
220,
796,
43979,
62,
12001,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
16876,
300,
85,
62,
18224,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4175,
7,
279,
62,
7266
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*----------------------------------------------------------------------*
***INCLUDE ZBOOK_TICKET_OVERVIEW_PBO .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS100'.
SET TITLEBAR 'TITLE100'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module OUTPUT OUTPUT
*&---------------------------------------------------------------------*
MODULE output OUTPUT.
IF p_docker = abap_true.
IF gr_custom_cont IS NOT BOUND.
CREATE OBJECT gr_custom_cont
EXPORTING
container_name = 'CCONT'.
ENDIF.
IF gr_dock_cont IS NOT BOUND.
CREATE OBJECT gr_dock_cont
EXPORTING
repid = sy-repid
dynnr = '0100'
side = cl_gui_docking_container=>dock_at_left
extension = '370'.
ENDIF.
gr_team_tree = zcl_book_team=>get_instance( ir_cont = gr_dock_cont
id_expand = 'X' ).
ENDIF.
gr_book_ticket = zcl_book_ticket_overview=>get_instance( ir_cont = gr_custom_cont
is_selection = gs_selection ).
ENDMODULE. " OUTPUT OUTPUT
| [
9,
10097,
23031,
9,
198,
8162,
1268,
5097,
52,
7206,
1168,
39453,
62,
51,
11860,
2767,
62,
41983,
28206,
62,
47,
8202,
764,
198,
9,
10097,
23031,
9,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
220,
220,
220,
220,
220,
19937,
220,
15486,
2937,
62,
39103,
220,
16289,
30076,
198,
9,
5,
10097,
30934,
9,
198,
9,
220,
220,
220,
220,
220,
220,
2420,
198,
9,
10097,
23031,
9,
198,
33365,
24212,
3722,
62,
39103,
16289,
30076,
13,
198,
220,
25823,
28223,
12,
35744,
2937,
705,
35744,
2937,
3064,
4458,
198,
220,
25823,
37977,
2538,
33,
1503,
220,
705,
49560,
2538,
3064,
4458,
198,
10619,
33365,
24212,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
15486,
2937,
62,
39103,
220,
16289,
30076,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
220,
220,
220,
220,
220,
19937,
220,
16289,
30076,
220,
16289,
30076,
198,
9,
5,
10097,
30934,
9,
198,
33365,
24212,
5072,
16289,
30076,
13,
628,
220,
16876,
279,
62,
45986,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
16876,
1036,
62,
23144,
62,
3642,
3180,
5626,
347,
15919,
13,
198,
220,
220,
220,
220,
220,
29244,
6158,
25334,
23680,
1036,
62,
23144,
62,
3642,
198,
220,
220,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9290,
62,
3672,
796,
705,
4093,
35830,
4458,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
16876,
1036,
62,
67,
735,
62,
3642,
3180,
5626,
347,
15919,
13,
198,
220,
220,
220,
220,
220,
29244,
6158,
25334,
23680,
1036,
62,
67,
735,
62,
3642,
198,
220,
220,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1128,
312,
220,
220,
220,
220,
796,
827,
12,
7856,
312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
37860,
48624,
220,
220,
220,
220,
796,
705,
39103,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1735,
220,
220,
220,
220,
220,
796,
537,
62,
48317,
62,
67,
8629,
62,
34924,
14804,
67,
735,
62,
265,
62,
9464,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7552,
796,
705,
20167,
4458,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
1036,
62,
15097,
62,
21048,
796,
1976,
565,
62,
2070,
62,
15097,
14804,
1136,
62,
39098,
7,
4173,
62,
3642,
220,
220,
796,
1036,
62,
67,
735,
62,
3642,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
62,
11201,
392,
796,
705,
55,
6,
6739,
198,
220,
23578,
5064,
13,
628,
220,
1036,
62,
2070,
62,
43350,
796,
1976,
565,
62,
2070,
62,
43350,
62,
2502,
1177,
14804,
1136,
62,
39098,
7,
4173,
62,
3642,
220,
220,
220,
220,
220,
796,
1036,
62,
23144,
62,
3642,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
62,
49283,
796,
308,
82,
62,
49283,
6739,
198,
198,
10619,
33365,
24212,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
16289,
30076,
220,
16289,
30076,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& Include MZFLIFM_SETTING_T01
*&---------------------------------------------------------------------*
TYPE-POOLS: icon.
*----------------------------------------------------------------------*
* TABLES
*----------------------------------------------------------------------*
TABLES: zflifmt_setting.
*----------------------------------------------------------------------*
* GLOBAL DATA
*----------------------------------------------------------------------*
DATA: gv_okcode TYPE sy-ucomm,
g_okcode type sy-ucomm.
DATA: gv_init TYPE c.
DATA: gv_cursor_field(60) TYPE c,
gv_cursor_line(60) TYPE c.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
220,
40348,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
57,
3697,
5064,
44,
62,
28480,
48996,
62,
51,
486,
198,
9,
5,
10097,
30934,
9,
198,
198,
25216,
12,
16402,
3535,
50,
25,
7196,
13,
198,
198,
9,
10097,
23031,
9,
198,
9,
309,
6242,
28378,
198,
9,
10097,
23031,
9,
198,
5603,
9148,
1546,
25,
1976,
2704,
361,
16762,
62,
33990,
13,
198,
198,
9,
10097,
23031,
9,
198,
9,
10188,
9864,
1847,
42865,
198,
9,
10097,
23031,
9,
198,
26947,
25,
308,
85,
62,
482,
8189,
41876,
220,
827,
12,
84,
9503,
11,
198,
220,
220,
220,
220,
220,
308,
62,
482,
8189,
2099,
827,
12,
84,
9503,
13,
198,
198,
26947,
25,
308,
85,
62,
15003,
41876,
269,
13,
198,
198,
26947,
25,
308,
85,
62,
66,
21471,
62,
3245,
7,
1899,
8,
41876,
269,
11,
198,
220,
220,
220,
220,
220,
308,
85,
62,
66,
21471,
62,
1370,
7,
1899,
8,
41876,
269,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_zip DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS export
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
!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 .
PROTECTED SECTION.
PRIVATE 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 filename
IMPORTING
!iv_str TYPE string
EXPORTING
!ev_path TYPE string
!ev_filename TYPE string
RAISING
zcx_abapgit_exception .
CLASS-METHODS normalize_path
CHANGING
!ct_files TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS unzip_file
IMPORTING
!iv_xstr TYPE xstring
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_ZIP IMPLEMENTATION.
METHOD encode_files.
DATA: lo_zip TYPE REF TO cl_abap_zip,
lv_filename TYPE string.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF it_files.
CREATE OBJECT lo_zip.
LOOP AT it_files ASSIGNING <ls_file>.
CONCATENATE <ls_file>-file-path+1 <ls_file>-file-filename INTO lv_filename.
lo_zip->add( name = lv_filename
content = <ls_file>-file-data ).
ENDLOOP.
rv_xstr = lo_zip->save( ).
ENDMETHOD.
METHOD export.
DATA: li_log TYPE REF TO zif_abapgit_log,
lt_zip TYPE zif_abapgit_definitions=>ty_files_item_tt,
lv_package TYPE devclass.
CREATE OBJECT li_log TYPE zcl_abapgit_log.
lv_package = io_repo->get_package( ).
IF zcl_abapgit_factory=>get_sap_package( lv_package )->exists( ) = abap_false.
zcx_abapgit_exception=>raise( |Package { lv_package } doesn't exist| ).
ENDIF.
lt_zip = io_repo->get_files_local( ii_log = li_log
it_filter = it_filter ).
IF li_log->count( ) > 0.
li_log->show( ).
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,
lt_rawdata TYPE solix_tab,
lv_sep TYPE c LENGTH 1,
ls_files_item TYPE zcl_abapgit_objects=>ty_serialization.
STATICS: sv_prev TYPE string.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF ls_files_item-files.
ls_tadir = zcl_abapgit_ui_factory=>get_popups( )->popup_object( ).
IF ls_tadir IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
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 = sv_prev
CHANGING
selected_folder = lv_folder ).
IF lv_folder IS INITIAL.
RETURN.
ENDIF.
sv_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.
lt_rawdata = cl_bcs_convert=>xstring_to_solix( <ls_file>-data ).
cl_gui_frontend_services=>gui_download(
EXPORTING
bin_filesize = xstrlen( <ls_file>-data )
filename = lv_fullpath
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.
ENDLOOP.
ENDMETHOD.
METHOD export_package.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_offline,
ls_data TYPE zif_abapgit_persistence=>ty_repo,
li_popups TYPE REF TO zif_abapgit_popups.
ls_data-key = 'DUMMY'.
ls_data-dot_abapgit = zcl_abapgit_dot_abapgit=>build_default( )->get_data( ).
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->popup_package_export(
IMPORTING
ev_package = ls_data-package
ev_folder_logic = ls_data-dot_abapgit-folder_logic ).
IF ls_data-package IS INITIAL.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
CREATE OBJECT lo_repo
EXPORTING
is_data = ls_data.
ev_xstr = export( lo_repo ).
ev_package = ls_data-package.
ENDMETHOD.
METHOD filename.
IF iv_str CA '/'.
FIND REGEX '(.*/)(.*)' IN iv_str
SUBMATCHES ev_path ev_filename.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Malformed path' ).
ENDIF.
IF ev_path <> '/'.
CONCATENATE '/' ev_path INTO ev_path.
ENDIF.
ELSE.
ev_path = '/'.
ev_filename = iv_str.
ENDIF.
TRANSLATE ev_filename TO LOWER CASE.
ENDMETHOD.
METHOD load.
rt_files = unzip_file( iv_xstr ).
ENDMETHOD.
METHOD normalize_path.
* removes first folder from path if needed
DATA: lt_split TYPE TABLE OF string,
lv_needed TYPE abap_bool,
lv_length TYPE i,
lv_split LIKE LINE OF lt_split.
FIELD-SYMBOLS: <ls_file> LIKE LINE OF ct_files.
READ TABLE ct_files INDEX 1 ASSIGNING <ls_file>.
IF sy-subrc <> 0.
RETURN.
ENDIF.
SPLIT <ls_file>-path AT '/' INTO TABLE lt_split.
IF sy-subrc <> 0.
RETURN.
ENDIF.
READ TABLE lt_split INDEX 2 INTO lv_split.
IF sy-subrc <> 0 OR strlen( lv_split ) = 0.
RETURN.
ENDIF.
CONCATENATE '/' lv_split '/*' INTO lv_split.
lv_needed = abap_true.
LOOP AT ct_files ASSIGNING <ls_file>.
IF NOT <ls_file>-path CP lv_split.
lv_needed = abap_false.
EXIT. " current loop
ENDIF.
ENDLOOP.
IF lv_needed = abap_true.
lv_length = strlen( lv_split ) - 2.
LOOP AT ct_files ASSIGNING <ls_file>.
<ls_file>-path = <ls_file>-path+lv_length.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD unzip_file.
DATA: lo_zip TYPE REF TO cl_abap_zip,
lv_data TYPE xstring.
FIELD-SYMBOLS: <ls_zipfile> LIKE LINE OF lo_zip->files,
<ls_file> LIKE LINE OF rt_files.
CREATE OBJECT lo_zip.
lo_zip->load( EXPORTING
zip = iv_xstr
EXCEPTIONS
zip_parse_error = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from zip' ).
ENDIF.
LOOP AT lo_zip->files ASSIGNING <ls_zipfile>.
lo_zip->get(
EXPORTING
name = <ls_zipfile>-name
IMPORTING
content = lv_data
EXCEPTIONS
zip_index_error = 1
zip_decompression_error = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from zip get' ).
ENDIF.
APPEND INITIAL LINE TO rt_files ASSIGNING <ls_file>.
filename(
EXPORTING
iv_str = <ls_zipfile>-name
IMPORTING
ev_path = <ls_file>-path
ev_filename = <ls_file>-filename ).
<ls_file>-data = lv_data.
<ls_file>-sha1 = zcl_abapgit_hash=>sha1( iv_type = zif_abapgit_definitions=>c_type-blob
iv_data = <ls_file>-data ).
ENDLOOP.
DELETE rt_files WHERE filename IS INITIAL.
normalize_path( CHANGING ct_files = rt_files ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
13344,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
10784,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
952,
62,
260,
7501,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
260,
7501,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
24455,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
83,
324,
343,
62,
926,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
87,
2536,
8,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
42715,
12,
49273,
50,
10784,
62,
15252,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
10784,
62,
26495,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
1990,
62,
87,
2536,
220,
220,
220,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
1990,
62,
26495,
41876,
1614,
4871,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
3440,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
87,
2536,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
16624,
8,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
16624,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
37773,
62,
16624,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
16624,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
16624,
62,
9186,
62,
926,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
87,
2536,
8,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
42715,
12,
49273,
50,
29472,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2536,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
1990,
62,
6978,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
1990,
62,
34345,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
42715,
12,
49273,
50,
3487,
1096,
62,
6978,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
310,
62,
16624,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
16624,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
42715,
12,
49273,
50,
555,
13344,
62,
7753,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
87,
2536,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
16624,
8,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
16624,
62,
926,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
57,
4061,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
37773,
62,
16624,
13,
628,
220,
220,
220,
42865,
25,
2376,
62,
13344,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
537,
62,
397,
499,
62,
13344,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
34345,
41876,
4731,
13,
628,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
25,
1279,
7278,
62,
7753,
29,
34178,
48920,
3963,
340,
62,
16624,
13,
628,
198,
220,
220,
220,
29244,
6158,
25334,
23680,
2376,
62,
13344,
13,
628,
220,
220,
220,
17579,
3185,
5161,
340,
62,
16624,
24994,
3528,
15871,
1279,
7278,
62,
7753,
28401,
198,
220,
220,
220,
220,
220,
39962,
1404,
1677,
6158,
1279,
7278,
62,
7753,
29,
12,
7753,
12,
6978,
10,
16,
1279,
7278,
62,
7753,
29,
12,
7753,
12,
34345,
39319,
300,
85,
62,
34345,
13,
198,
220,
220,
220,
220,
220,
2376,
62,
13344,
3784,
2860,
7,
1438,
220,
220,
220,
796,
300,
85,
62,
34345,
198,
220,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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*&---------------------------------------------------------------------*
*& Report ZDOCX_GET_TYPES
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
report zdocx_get_types.
types
: tt_text type table of text80 with empty key
.
data
: gv_data_model_xml type string
.
parameters: p_fpath type string obligatory lower case.
parameters: p_normal radiobutton group rad1 default 'X'
, p_other radiobutton group rad1
.
at selection-screen on value-request for p_fpath. " Обробщик події F4
perform get_file_path changing p_fpath. " Вызов подпрограммы с передачей параметра f_path
start-of-selection.
perform get_data_model.
perform show_data_model.
*&---------------------------------------------------------------------*
*& Form Get_file_path
*&---------------------------------------------------------------------*
form get_file_path changing cv_path type string.
clear cv_path.
data:
lv_rc type i,
lv_user_action type i,
lt_file_table type filetable,
ls_file_table like line of lt_file_table.
cl_gui_frontend_services=>file_open_dialog(
exporting
window_title = 'select template docx'
multiselection = ''
default_extension = '*.docx'
file_filter = 'Text file (*.docx)|*.docx|All (*.*)|*.*'
changing
file_table = lt_file_table
rc = lv_rc
user_action = lv_user_action
exceptions
others = 1
).
if sy-subrc = 0.
if lv_user_action = cl_gui_frontend_services=>action_ok.
if lt_file_table is not initial.
read table lt_file_table into ls_file_table index 1.
if sy-subrc = 0.
cv_path = ls_file_table-filename.
endif.
endif.
endif.
endif.
endform. " Get_file_path
*&---------------------------------------------------------------------*
*& Form GET_DATA_MODEL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form get_data_model .
data(lt_file_data) = value solix_tab( ).
cl_gui_frontend_services=>gui_upload(
exporting
filename = p_fpath " Name of file
filetype = 'BIN' " File Type (ASCII, Binary)
importing
filelength = data(lv_filelength) " File Length
changing
data_tab = lt_file_data " Transfer table for file contents
exceptions
file_open_error = 1 " File does not exist and cannot be opened
file_read_error = 2 " Error when reading file
no_batch = 3 " Cannot execute front-end function in background
gui_refuse_filetransfer = 4 " Incorrect front end or error on front end
invalid_type = 5 " Incorrect parameter FILETYPE
no_authority = 6 " No upload authorization
unknown_error = 7 " Unknown error
bad_data_format = 8 " Cannot Interpret Data in File
header_not_allowed = 9 " Invalid header
separator_not_allowed = 10 " Invalid separator
header_too_long = 11 " Header information currently restricted to 1023 bytes
unknown_dp_error = 12 " Error when calling data provider
access_denied = 13 " Access to File Denied
dp_out_of_memory = 14 " Not enough memory in data provider
disk_full = 15 " Storage medium is full.
dp_timeout = 16 " Data provider timeout
not_supported_by_gui = 17 " GUI does not support this
error_no_gui = 18 " GUI not available
others = 19 ).
data
: lv_bin_content type xstring
.
lv_bin_content = cl_bcs_convert=>solix_to_xstring(
exporting
it_solix = lt_file_data " Input data
iv_size = lv_filelength ).
data
: lo_zip type ref to cl_abap_zip
.
create object lo_zip.
lo_zip->load( lv_bin_content ).
data
: lv_content type xstring
.
lo_zip->get( exporting name = 'word/document.xml'
importing content = lv_content ).
data
: lv_data_model_xml type string
.
call transformation zdocx_data_model
source xml lv_content
result xml gv_data_model_xml.
endform.
form show_data_model.
data
: ro_ixml type ref to if_ixml_document
.
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
*--------------------------------------------------------------------*
lo_ixml = cl_ixml=>create( ).
lo_streamfactory = lo_ixml->create_stream_factory( ).
lo_istream = lo_streamfactory->create_istream_string( gv_data_model_xml ).
ro_ixml = lo_ixml->create_document( ).
lo_parser = lo_ixml->create_parser( stream_factory = lo_streamfactory
istream = lo_istream
document = ro_ixml ).
* lo_parser->set_normalizing( 'X' ).
lo_parser->set_validating( mode = if_ixml_parser=>co_no_validation ).
lo_parser->parse( ).
data
: lt_source type tt_text
, lr_node type ref to if_ixml_node
, nodes type ref to if_ixml_node_list
.
lr_node = ro_ixml.
nodes = lr_node->get_children( ).
lr_node = nodes->get_item( 0 ).
perform parse_tree using lr_node 'data' changing lt_source.
if p_normal is not initial.
insert initial line into lt_source assigning field-symbol(<ls_source>) index 1.
<ls_source> = 'TYPES:'.
data
: lv_lines type i
.
lv_lines = lines( lt_source ) - 2.
read table lt_source assigning <ls_source> index lv_lines.
replace all occurrences of ',' in <ls_source> with '.'.
else.
append initial line to lt_source assigning <ls_source>.
<ls_source> = '.'.
read table lt_source assigning <ls_source> index 1.
replace all occurrences of ',' in <ls_source> with ':'.
insert initial line into lt_source assigning <ls_source> index 1.
<ls_source> = 'TYPES'.
endif.
cl_demo_output=>new( 'TEXT'
)->display( lt_source ).
endform.
form parse_tree using ir_node type ref to if_ixml_node name type string changing source type tt_text.
data
: lv_node_name type string
, lv_flag_no_add type c
.
data: nodes type ref to if_ixml_node_list,
child type ref to if_ixml_node,
index type i,
child_count type i.
lv_node_name = ir_node->get_name( ).
nodes = ir_node->get_children( ).
data
: tmp_source type tt_text
.
append initial line to tmp_source assigning field-symbol(<fs_source>).
if p_normal is not initial.
<fs_source> = | begin of t_{ name },|.
else.
<fs_source> = |, begin of t_{ name }|.
endif.
while index < nodes->get_length( ).
child = nodes->get_item( index ).
lv_node_name = child->get_name( ).
translate lv_node_name to upper case.
if lv_node_name = 'ITEM' .
lv_flag_no_add = 'X'.
perform parse_tree using child name changing source.
else.
data
: child_of_child type ref to if_ixml_node_list
.
child_of_child = child->get_children( ).
child_count = child_of_child->get_length( ).
append initial line to tmp_source assigning <fs_source>.
if child_count = 0.
if p_normal is not initial.
<fs_source> = | { lv_node_name } type string,|.
else.
<fs_source> = |, { lv_node_name } type string |.
endif.
else.
if p_normal is not initial.
<fs_source> = | { lv_node_name } type tt_{ lv_node_name }, |.
else.
<fs_source> = |, { lv_node_name } type tt_{ lv_node_name } |.
endif.
perform parse_tree using child lv_node_name changing source.
endif.
endif.
index = index + 1.
endwhile.
append initial line to tmp_source assigning <fs_source>.
if p_normal is not initial.
<fs_source> = | end of t_{ name },|.
else.
<fs_source> = |, end of t_{ name }|.
endif.
append initial line to tmp_source assigning <fs_source>.
append initial line to tmp_source assigning <fs_source>.
if p_normal is not initial.
<fs_source> = | tt_{ name } type table of t_{ name } with empty key,|.
else.
<fs_source> = |, tt_{ name } type table of t_{ name } with empty key|.
endif.
append initial line to tmp_source assigning <fs_source>.
append initial line to tmp_source assigning <fs_source>.
if lv_flag_no_add is initial.
append lines of tmp_source to source.
endif.
endform.
| [
9,
5,
10097,
30934,
9,
198,
9,
5,
6358,
1168,
38715,
55,
62,
18851,
62,
9936,
47,
1546,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
198,
9,
5,
10097,
30934,
9,
198,
13116,
1976,
15390,
87,
62,
1136,
62,
19199,
13,
198,
198,
19199,
198,
25,
256,
83,
62,
5239,
2099,
3084,
286,
2420,
1795,
351,
6565,
1994,
198,
13,
198,
198,
7890,
198,
220,
220,
220,
220,
220,
1058,
308,
85,
62,
7890,
62,
19849,
62,
19875,
2099,
4731,
198,
220,
220,
220,
220,
220,
764,
198,
198,
17143,
7307,
25,
279,
62,
69,
6978,
2099,
4731,
44609,
2793,
1339,
13,
198,
198,
17143,
7307,
25,
279,
62,
11265,
19772,
672,
21115,
1448,
2511,
16,
4277,
705,
55,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
837,
279,
62,
847,
19772,
672,
21115,
1448,
2511,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
764,
198,
198,
265,
6356,
12,
9612,
319,
1988,
12,
25927,
329,
279,
62,
69,
6978,
13,
220,
366,
12466,
252,
140,
109,
21169,
25443,
109,
141,
231,
18849,
31583,
12466,
123,
25443,
112,
141,
244,
141,
245,
376,
19,
198,
220,
1620,
651,
62,
7753,
62,
6978,
5609,
279,
62,
69,
6978,
13,
366,
12466,
240,
45035,
140,
115,
25443,
110,
12466,
123,
25443,
112,
140,
123,
21169,
25443,
111,
21169,
16142,
43108,
43108,
45035,
220,
21727,
12466,
123,
16843,
21169,
16843,
43666,
16142,
141,
229,
16843,
140,
117,
12466,
123,
16142,
21169,
16142,
43108,
16843,
20375,
21169,
16142,
277,
62,
6978,
198,
198,
9688,
12,
1659,
12,
49283,
13,
628,
220,
1620,
651,
62,
7890,
62,
19849,
13,
198,
220,
1620,
905,
62,
7890,
62,
19849,
13,
628,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
220,
220,
220,
220,
220,
5178,
220,
3497,
62,
7753,
62,
6978,
198,
9,
5,
10097,
30934,
9,
198,
687,
651,
62,
7753,
62,
6978,
5609,
269,
85,
62,
6978,
2099,
4731,
13,
198,
220,
1598,
269,
85,
62,
6978,
13,
628,
220,
1366,
25,
198,
220,
220,
220,
300,
85,
62,
6015,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2099,
220,
1312,
11,
198,
220,
220,
220,
300,
85,
62,
7220,
62,
2673,
2099,
220,
1312,
11,
198,
220,
220,
220,
300,
83,
62,
7753,
62,
11487,
220,
2099,
220,
2393,
11487,
11,
198,
220,
220,
220,
43979,
62,
7753,
62,
11487,
220,
588,
1627,
286,
300,
83,
62,
7753,
62,
11487,
13,
628,
220,
537,
62,
48317,
62,
8534,
437,
62,
30416,
14804,
7753,
62,
9654,
62,
38969,
519,
7,
198,
220,
39133,
198,
220,
220,
220,
4324,
62,
7839,
220,
220,
220,
220,
220,
220,
220,
796,
705,
19738,
11055,
220,
2205,
87,
6,
198,
220,
220,
220,
1963,
786,
1564,
220,
220,
220,
220,
220,
796,
10148,
198,
220,
220,
220,
4277,
62,
2302,
3004,
220,
220,
796,
705,
24620,
15390,
87,
6,
198,
220,
220,
220,
2393,
62,
24455,
220,
220,
220,
220,
220,
220,
220,
220,
796,
705,
8206,
2393,
20789,
13,
15390,
87,
14726,
24620,
15390,
87,
91,
3237,
20789,
15885,
14726,
9,
15885,
6,
198,
220,
5609,
198,
220,
220,
220,
2393,
62,
11487,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
83,
62,
7753,
62,
11487,
198,
220,
220,
220,
48321,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
85,
62,
6015,
198,
220,
220,
220,
2836,
62,
2673,
220,
220,
220,
220,
220,
220,
220,
220,
796,
300,
85,
62,
7220,
62,
2673,
198,
220,
13269,
198,
220,
220,
220,
1854,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
352,
198,
220,
220,
220,
6739,
198,
220,
611,
827,
12,
7266,
6015,
796,
657,
13,
198,
220,
220,
220,
611,
300,
85,
62,
7220,
62,
2673,
796,
537,
62,
48317,
62,
8534,
437,
62,
30416,
14804,
2673,
62,
482,
13,
198,
220,
220,
220,
220,
220,
611,
300,
83,
62,
7753,
62,
11487,
318,
407,
4238,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1100,
3084,
300,
83,
62,
7753,
62,
11487,
656,
43979,
62,
7753,
62,
11487,
6376,
352,
13,
198,
220,
220,
220,
220,
220,
220,
220,
611,
827,
12,
7266,
6015,
796,
657,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
85,
62,
6978,
796,
43979,
62,
7753,
62,
11487,
12,
34345,
13,
198,
220,
220,
220,
220,
220,
220,
220,
45762,
13,
198,
220,
220,
220,
220,
220,
45762,
13,
198,
220,
220,
220,
45762,
13,
198,
220,
45762,
13,
198,
437,
687,
13,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
3497,
62,
7753,
62,
6978,
198,
9,
5,
10097,
30934,
9,
198,
9,
5,
220,
220,
220,
220,
220,
5178,
220,
17151,
62,
26947,
62,
33365,
3698,
198,
9,
5,
10097,
30934,
9,
198,
9,
220,
220,
220,
220,
220,
220,
2420,
198,
9,
10097,
23031,
9,
198,
9,
220,
14610,
220,
279,
16,
220,
220,
220,
220,
220,
220,
220,
2420,
198,
9,
220,
1279,
438,
220,
279,
17,
220,
220,
220,
220,
220,
220,
220,
2420,
198,
9,
10097,
23031,
9,
198,
687,
651,
62,
7890,
62,
19849,
764,
628,
198,
220,
1366,
7,
2528,
62,
7753,
62,
7890,
8,
796,
1988,
1540,
844,
62,
8658,
7,
6739,
198,
220,
537,
62,
48317,
62,
8534,
437,
62,
30416,
14804,
48317,
62,
25850,
7,
198,
220,
220,
220,
39133,
198,
220,
220,
220,
220,
220,
29472,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
279,
62,
69,
6978,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
6530,
286,
2393,
198,
220,
220,
220,
220,
220,
2393,
4906,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
705,
33,
1268,
6,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
9220,
5994,
357,
42643,
3978,
11,
45755,
8,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
2393,
13664,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class ZCL_BUG_CONTROLLER definition
public
create public
global friends ZCL_PRODUCTO_CONTROLLER .
public section.
*"* public components of class ZCL_BUG_CONTROLLER
*"* do not include other source files here!!!
class-methods CREATE
importing
!BUG type ref to ZCL_BUG
raising
ZCX_CREATE_EXCEPTION
ZCX_VALIDATE_EXCEPTION .
class-methods DELETE
importing
!BUG type ref to ZCL_BUG
raising
ZCX_DELETE_EXCEPTION .
class-methods ENTITY_TO_STRUCTURE
importing
!ENTITY type ref to ZCL_BUG
returning
value(STRUCTURE) type ZBT_BUG .
class-methods EXIST
importing
!BUG type ref to ZCL_BUG
returning
value(RETURN) type FLAG .
class-methods FIND_BY_KEY
importing
!ID type ZBT_ID_BUG
!PRODUCTO type ref to ZCL_PRODUCTO
returning
value(BUG) type ref to ZCL_BUG
raising
ZCX_NOT_FOUND_EXCEPTION .
class-methods NEXT_ID
importing
!PRODUCTO type ref to ZCL_PRODUCTO
!BUGTYPE type ref to ZCL_BUGTYPE optional
returning
value(RETURN) type ZBT_BUG-BUG .
class-methods UPDATE
importing
!BUG type ref to ZCL_BUG
raising
ZCX_UPDATE_EXCEPTION
ZCX_VALIDATE_EXCEPTION .
class-methods VALIDATE_ON_CREATE
importing
!BUG type ref to ZCL_BUG
raising
ZCX_VALIDATE_EXCEPTION .
class-methods VALIDATE_ON_DELETE
importing
!BUG type ref to ZCL_BUG
raising
ZCX_VALIDATE_EXCEPTION .
class-methods VALIDATE_ON_UPDATE
importing
!BUG type ref to ZCL_BUG
raising
ZCX_VALIDATE_EXCEPTION .
class-methods STRUCTURE_TO_ENTITY
importing
!STRUCTURE type ZBT_BUG
changing
value(ENTITY) type ref to ZCL_BUG .
class-methods LOCK
importing
!BUG type ref to ZCL_BUG .
class-methods UNLOCK
importing
!BUG type ref to ZCL_BUG .
class-methods EQUAL
importing
!BUG1 type ref to ZCL_BUG
!BUG2 type ref to ZCL_BUG
returning
value(EQUAL) type FLAG .
class-methods SEARCH
importing
!BUG type ZBT_BUG_RANGE optional
!BUG_I type ZBT_BUG_I_RANGE optional
!BUGSTYPE type ZBT_BUGSTYPE_RANGE optional
!BUGTYPE type ZBT_BUGTYPE_RANGE optional
!COMPONENTE type ZBT_COMPONENTE_RANGE optional
!DEADLINE type ZBT_DATS_RANGE optional
!ESTADO type ZBT_ESTADO_RANGE optional
!HORAS_ESTIMADAS type ZBT_HORAS_RANGE optional
!HORAS_REALES type ZBT_HORAS_RANGE optional
!PRODUCTO type ZBT_PRODUCTO_RANGE optional
!RESUMEN type ZBT_TEXT_RANGE optional
!CREADO type ZBT_TIMESTAMP_RANGE optional
!REPORTER type ZBT_USER_RANGE optional
!DEVELOPER type ZBT_USER_RANGE optional
!ASSIGNED type ZBT_USER_RANGE optional
!TESTER type ZBT_USER_RANGE optional
!FINALIZADO type ZBT_TIMESTAMP_RANGE optional
!AEDAT type ZBT_TIMESTAMP_RANGE optional
!AENAM type ZBT_USER_RANGE optional
value(MAX_ROWS) type I optional
returning
value(RETURN) type ZBT_BUGS .
protected section.
*"* protected components of class ZCL_BUG_CONTROLLER
*"* do not include other source files here!!!
class-methods ENTITY_TO_PERSIST
importing
!ENTITY type ref to ZCL_BUG
changing
value(PERSIST) type ref to ZCL_BUG_PERSIST .
class-methods FIND_NEXT_BUGS
importing
!BUG type ref to ZCL_BUG
returning
value(RESULT) type ZBT_BUGS .
class-methods FIND_PREV_BUGS
importing
!BUG type ref to ZCL_BUG
returning
value(RESULT) type ZBT_BUGS .
class-methods PERSIST_TO_ENTITY
importing
!PERSIST type ref to ZCL_BUG_PERSIST
returning
value(ENTITY) type ref to ZCL_BUG .
private section.
*"* private components of class ZCL_BUG_CONTROLLER
*"* do not include other source files here!!!
class-data BUGS_BUFFER type ZBT_BUGS .
class-methods EQUAL_TAGS
importing
!BUG1 type ref to ZCL_BUG
!BUG2 type ref to ZCL_BUG
returning
value(EQUAL) type FLAG .
ENDCLASS.
CLASS ZCL_BUG_CONTROLLER IMPLEMENTATION.
METHOD create.
DATA: lo_bug_persist TYPE REF TO zcl_bug_persist,
l_timestamp TYPE timestamp,
l_creado TYPE zbt_bug-creado,
l_aedat TYPE zbt_bug-aedat,
lo_producto TYPE REF TO zcl_producto,
lo_bugtype TYPE REF TO zcl_bugtype,
l_str_bug TYPE zbt_bug,
lt_attachements TYPE zbt_attachements,
lt_comentarios TYPE zbt_comentarios,
lt_sections TYPE zbt_bugsections,
lo_usuario TYPE REF TO zcl_usuario,
lt_transportes TYPE zbt_transport_tbl,
lo_transaccion TYPE REF TO zcl_transaction_service,
lo_validate_exception TYPE REF TO zcx_validate_exception,
lt_tags TYPE zbt_bug_tag_tbl,
lt_wrklogs TYPE zbt_bugwrklogs,
lo_exception TYPE REF TO cx_root.
FIELD-SYMBOLS: <attachement> TYPE LINE OF zbt_attachements,
<comentario> TYPE LINE OF zbt_comentarios,
<section> TYPE LINE OF zbt_bugsections,
<transporte> TYPE LINE OF zbt_transport_tbl,
<tag> TYPE LINE OF zbt_bug_tag_tbl,
<wrklog> LIKE LINE OF lt_wrklogs.
* On create, get next Id
l_str_bug-bug = bug->get_id( ). l_str_bug-bug_i = bug->get_id_i( ).
IF l_str_bug-bug IS INITIAL.
lo_producto = bug->get_producto( ).
lo_bugtype = bug->get_bug_type( ).
l_str_bug-bug = zcl_bug_controller=>next_id( producto = lo_producto
bugtype = lo_bugtype ).
bug->set_id( l_str_bug-bug ).
bug->set_id_i( l_str_bug-bug_i ).
ENDIF.
* Set CreateTime
IF l_str_bug-creado IS INITIAL.
GET TIME STAMP FIELD l_timestamp.
l_creado = l_timestamp.
bug->set_creado( l_creado ).
ENDIF.
* Antes de crear procedemos a validar
validate_on_create( bug ).
l_str_bug = entity_to_structure( bug ).
TRY.
CREATE OBJECT lo_transaccion.
lo_transaccion->start( ).
CALL METHOD zca_bug_persist=>agent->create_persistent
EXPORTING
i_bug = l_str_bug-bug
i_bug_i = l_str_bug-bug_i
i_bugstype = l_str_bug-bugstype
i_bugtype = l_str_bug-bugtype
i_componente = l_str_bug-componente
i_creado = l_str_bug-creado
i_deadline = l_str_bug-deadline
i_developer = l_str_bug-developer
i_estado = l_str_bug-estado
i_finalizado = l_str_bug-finalizado
i_horas_est = l_str_bug-horas_est
i_horas_rea = l_str_bug-horas_rea
i_producto = l_str_bug-producto
i_reporter = l_str_bug-reporter
i_resumen = l_str_bug-resumen
i_tester = l_str_bug-tester
i_assigned = l_str_bug-assigned
RECEIVING
result = lo_bug_persist.
* Creamos los attachements
lt_attachements[] = bug->get_attachements( ).
LOOP AT lt_attachements ASSIGNING <attachement>.
zcl_attachement_controller=>create( <attachement> ).
ENDLOOP.
* Creamos los comentarios
lt_comentarios[] = bug->get_comentarios( no_section_comments = 'X' ).
LOOP AT lt_comentarios ASSIGNING <comentario>.
zcl_comment_controller=>create( <comentario>-oref ).
ENDLOOP.
* Creamos las secciones
lt_sections[] = bug->get_sections( ) .
LOOP AT lt_sections ASSIGNING <section>.
zcl_bugsection_controller=>create( <section>-oref ).
ENDLOOP.
* Creamos los transportes
lt_transportes[] = bug->get_transports( ).
LOOP AT lt_transportes ASSIGNING <transporte>.
zcl_transport_controller=>create( <transporte>-oref ).
ENDLOOP.
* Creamos los Tags
lt_tags[] = bug->get_tags( ).
LOOP AT lt_tags ASSIGNING <tag>.
zcl_bug_tag_controller=>create( <tag>-oref ).
ENDLOOP.
* Creates WorkLog
lt_wrklogs = bug->get_wrklogs( ).
LOOP AT lt_wrklogs ASSIGNING <wrklog>.
zcl_bug_wrklog_controller=>create( <wrklog>-oref ).
ENDLOOP.
* Set ModifyDate
GET TIME STAMP FIELD l_timestamp.
l_aedat = l_aedat.
bug->set_aedat( l_aedat ).
* Set ModifyUser
lo_usuario = zcl_usuario_controller=>find_by_key( ).
bug->set_aenam( lo_usuario ).
lo_transaccion->end( ).
CATCH cx_os_object_existing INTO lo_exception.
RAISE EXCEPTION TYPE zcx_create_exception
EXPORTING
textid = zcx_create_exception=>zcx_create_exception
previous = lo_exception.
ENDTRY.
ENDMETHOD.
METHOD delete.
DATA: lo_bug_persist TYPE REF TO zcl_bug_persist,
lo_producto TYPE REF TO zcl_producto,
l_id_bug TYPE zbt_bug-bug,
l_id_bug_i TYPE zbt_bug-bug_i,
l_id_producto TYPE zbt_producto-producto,
lt_attachements TYPE zbt_attachements,
lt_comentarios TYPE zbt_comentarios,
lt_sections TYPE zbt_bugsections,
lt_transportes TYPE ZBT_TRANSPORT_TBL,
lo_transaccion TYPE REF TO zcl_transaction_service,
lt_tags TYPE zbt_bug_tag_tbl,
lo_exception TYPE REF TO cx_root.
FIELD-SYMBOLS: <attachement> TYPE LINE OF zbt_attachements,
<comentario> TYPE LINE OF zbt_comentarios,
<section> TYPE LINE OF zbt_bugsections,
<tag> TYPE LINE OF zbt_bug_tag_tbl,
<transporte> TYPE LINE OF ZBT_TRANSPORT_TBL.
validate_on_delete( bug ).
l_id_bug = bug->get_id( ).
l_id_bug_i = bug->get_id_i( ).
lo_producto = bug->get_producto( ).
l_id_producto = lo_producto->get_id( ).
CREATE OBJECT lo_transaccion.
lo_transaccion->start( ).
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Borramos el resto de objetos
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Borramos los attachements
lt_attachements[] = bug->get_attachements( ).
LOOP AT lt_attachements ASSIGNING <attachement>.
zcl_attachement_controller=>delete( <attachement> ).
ENDLOOP.
* Borramos los comentarios
lt_comentarios[] = bug->get_comentarios( NO_SECTION_COMMENTS = space ).
LOOP AT lt_comentarios ASSIGNING <comentario>.
zcl_comment_controller=>delete( <comentario>-oref ).
ENDLOOP.
* Borramos las secciones
lt_sections[] = bug->get_sections( ) .
LOOP AT lt_sections ASSIGNING <section>.
zcl_bugsection_controller=>delete( <section>-oref ).
ENDLOOP.
* Borramos los transportes
lt_transportes[] = bug->get_transports( ).
LOOP AT lt_transportes ASSIGNING <transporte>.
zcl_transport_controller=>delete( <transporte>-oref ).
ENDLOOP.
* Borramos los tags
lt_tags[] = bug->get_tags( ).
LOOP AT lt_tags ASSIGNING <tag>.
zcl_bug_tag_controller=>delete( <tag>-oref ).
ENDLOOP.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Borramos de la persistencia
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zca_bug_persist=>agent->delete_persistent(
i_bug = l_id_bug
* i_bug_i = l_id_bug_i
i_producto = l_id_producto
).
lo_transaccion->end( ).
ENDMETHOD.
METHOD entity_to_persist.
DATA: l_structure TYPE zbt_bug.
l_structure = entity_to_structure( entity ).
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Las clave de un objeto de persistencia NO se pueden cambiar
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* persist->set_bug( l_structure-bug ).
* persist->set_producto( l_structure-producto ).
persist->set_bugstype( l_structure-bugstype ).
persist->set_bugtype( l_structure-bugtype ).
persist->set_componente( l_structure-componente ).
persist->set_creado( l_structure-creado ).
persist->set_deadline( l_structure-deadline ).
persist->set_developer( l_structure-developer ).
persist->set_assigned( l_structure-assigned ).
persist->set_estado( l_structure-estado ).
persist->set_finalizado( l_structure-finalizado ).
persist->set_horas_est( l_structure-horas_est ).
persist->set_horas_rea( l_structure-horas_rea ).
persist->set_reporter( l_structure-reporter ).
persist->set_resumen( l_structure-resumen ).
persist->set_tester( l_structure-tester ).
persist->set_aedat( l_structure-aedat ).
persist->set_aenam( l_structure-aenam ).
persist->set_bug_i( l_structure-bug_i ).
ENDMETHOD.
METHOD entity_to_structure.
DATA: lo_producto TYPE REF TO zcl_producto,
lo_usuario TYPE REF TO zcl_usuario,
lo_componente TYPE REF TO zcl_componente,
lo_bugtype TYPE REF TO zcl_bugtype,
lo_bugstype TYPE REF TO zcl_bugstype,
lo_estado TYPE REF TO zcl_estado.
structure-bug = entity->get_id( ).
structure-bug_i = entity->get_id_i( ).
lo_producto = entity->get_producto( ).
structure-producto = lo_producto->get_id( ).
structure-creado = entity->get_creado( ).
structure-finalizado = entity->get_finalizado( ).
structure-deadline = entity->get_deadline( ).
structure-aedat = entity->get_aedat( ).
lo_usuario = entity->get_aenam( ).
IF lo_usuario IS BOUND.
structure-aenam = lo_usuario->get_id( ).
ENDIF.
CLEAR lo_usuario.
lo_usuario = entity->get_reporter( ).
IF lo_usuario IS BOUND.
structure-reporter = lo_usuario->get_id( ).
ENDIF.
CLEAR lo_usuario.
lo_usuario = entity->get_developer( ).
IF lo_usuario IS BOUND.
structure-developer = lo_usuario->get_id( ).
ENDIF.
CLEAR lo_usuario.
lo_usuario = entity->get_assigned( ).
IF lo_usuario IS BOUND.
structure-assigned = lo_usuario->get_id( ).
ENDIF.
CLEAR lo_usuario.
lo_usuario = entity->get_tester( ).
IF lo_usuario IS BOUND.
structure-tester = lo_usuario->get_id( ).
ENDIF.
CLEAR lo_usuario.
structure-resumen = entity->get_resumen( ).
lo_estado = entity->get_estado( ).
IF lo_estado IS BOUND.
structure-estado = lo_estado->get_id( ).
ENDIF.
structure-horas_est = entity->get_horas_estimadas( ).
structure-horas_rea = entity->get_horas_reales( ).
lo_componente = entity->get_componente( ).
IF lo_componente IS BOUND.
structure-componente = lo_componente->get_id( ).
ENDIF.
lo_bugtype = entity->get_bug_type( ).
IF lo_bugtype IS BOUND.
structure-bugtype = lo_bugtype->get_id( ).
ENDIF.
lo_bugstype = entity->get_bug_subtype( ).
IF lo_bugstype IS BOUND.
structure-bugstype = lo_bugstype->get_id( ).
ENDIF.
ENDMETHOD.
METHOD equal.
IF bug1->get_hash( ) = bug2->get_hash( ).
equal = abap_true.
ELSE.
equal = abap_false.
ENDIF.
ENDMETHOD.
METHOD equal_tags.
DATA: l_counter1 TYPE i,
l_counter2 TYPE i,
lt_tags1 TYPE zbt_bug_tag_tbl,
lt_tags2 TYPE zbt_bug_tag_tbl,
l_tag1 TYPE LINE OF zbt_bug_tag_tbl,
l_tag2 TYPE LINE OF zbt_bug_tag_tbl.
lt_tags1 = bug1->get_tags( ).
lt_tags2 = bug2->get_tags( ).
SORT: lt_tags1, lt_tags2.
DESCRIBE TABLE lt_tags1 LINES l_counter1.
DESCRIBE TABLE lt_tags2 LINES l_counter2.
IF l_counter1 <> l_counter2.
equal = abap_false.
ELSE.
CLEAR l_counter2.
DO l_counter1 TIMES.
ADD 1 TO l_counter2.
READ TABLE lt_tags1 INDEX l_counter2 INTO l_tag1.
READ TABLE lt_tags2 INDEX l_counter2 INTO l_tag2.
IF zcl_bug_tag_controller=>equal( tag1 = l_tag1-oref
tag2 = l_tag2-oref ) = abap_false.
equal = abap_false.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDMETHOD.
method EXIST.
DATA: l_id TYPE zbt_bug-bug,
l_id_i TYPE zbt_bug-bug_i,
lo_producto TYPE REF TO zcl_producto.
TRY .
l_id = bug->get_id( ).
l_id_i = bug->get_id_i( ).
lo_producto = bug->get_producto( ).
zcl_bug_controller=>find_by_key( id = l_id
* id_i = l_id_i
producto = lo_producto ).
return = 'X'.
CATCH cx_root.
return = space.
ENDTRY.
endmethod.
method FIND_BY_KEY.
DATA: lo_bug_agent TYPE REF TO zca_bug_persist,
lo_bug_persist TYPE REF TO zcl_bug_persist,
lo_exception TYPE REF TO cx_root,
l_id_producto TYPE zbt_producto-producto.
l_id_producto = producto->get_id( ).
TRY.
* Buscamos el objeto en la capa de persistencia
lo_bug_agent = zca_bug_persist=>agent.
CALL METHOD lo_bug_agent->get_persistent
EXPORTING
i_bug = id
i_producto = l_id_producto
RECEIVING
result = lo_bug_persist.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Mapeamos contra un Entity
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bug = persist_to_entity( lo_bug_persist ).
CATCH cx_root INTO lo_exception.
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
textid = zcx_not_found_exception=>zcx_not_found_exception
previous = lo_exception.
ENDTRY.
endmethod.
METHOD find_next_bugs.
DATA: lo_qm TYPE REF TO if_os_query_manager,
lo_q TYPE REF TO if_os_query,
lo_producto TYPE REF TO zcl_producto,
lo_bug TYPE REF TO zcl_bug,
l_id_producto TYPE zbt_producto-producto,
l_id_bug TYPE zbt_id_bug,
l_id_bug_i TYPE zbt_id_bug_i,
l_result TYPE LINE OF zbt_bugs,
lt_bughier_persist TYPE osreftab,
l_bug_buffer TYPE LINE OF zbt_bugs,
lo_bughier_persist TYPE REF TO zcl_bughier_persist.
FIELD-SYMBOLS: <osref> TYPE osref.
l_id_bug = bug->get_id( ).
l_id_bug_i = bug->get_id_i( ).
lo_producto = bug->get_producto( ).
l_id_producto = lo_producto->get_id( ).
READ TABLE bugs_buffer WITH TABLE KEY producto_id = l_id_producto
bug_id = l_id_bug
INTO l_bug_buffer.
IF NOT sy-subrc IS INITIAL.
l_bug_buffer-oref = bug.
l_bug_buffer-producto_id = l_id_producto.
l_bug_buffer-bug_id = l_id_bug.
INSERT l_bug_buffer INTO TABLE bugs_buffer.
ENDIF.
* Montamos una query para obtener los siguientes bugs al indicado
lo_qm = cl_os_system=>get_query_manager( ).
lo_q = lo_qm->create_query( i_filter = 'PRODUCTO = PAR1 AND BUG = PAR2 ' ).
lt_bughier_persist[] = zca_bughier_persist=>agent->if_os_ca_persistency~get_persistent_by_query(
i_query = lo_q
i_par1 = l_id_producto
i_par2 = l_id_bug ).
LOOP AT lt_bughier_persist ASSIGNING <osref>.
lo_bughier_persist ?= <osref>.
l_bug_buffer-bug_id = l_result-bug_id = lo_bughier_persist->get_next_bug( ).
l_bug_buffer-producto_id = l_result-producto_id = l_id_producto.
READ TABLE bugs_buffer WITH TABLE KEY producto_id = l_result-producto_id
bug_id = l_result-bug_id
INTO l_bug_buffer.
IF sy-subrc IS INITIAL.
l_result-oref = l_bug_buffer-oref.
ELSE.
l_bug_buffer-oref = l_result-oref =
zcl_bug_controller=>find_by_key( id = l_result-bug_id
producto = lo_producto ).
INSERT l_bug_buffer INTO TABLE bugs_buffer[].
ENDIF.
INSERT l_result INTO TABLE result[].
ENDLOOP.
ENDMETHOD.
METHOD find_prev_bugs.
DATA: lo_qm TYPE REF TO if_os_query_manager,
lo_q TYPE REF TO if_os_query,
lo_producto TYPE REF TO zcl_producto,
lo_bug TYPE REF TO zcl_bug,
l_id_producto TYPE zbt_producto-producto,
l_id_bug TYPE zbt_id_bug,
l_id_bug_i TYPE zbt_id_bug_i,
l_result TYPE LINE OF zbt_bugs,
lt_bughier_persist TYPE osreftab,
l_bug_buffer TYPE LINE OF zbt_bugs,
lo_bughier_persist TYPE REF TO zcl_bughier_persist.
FIELD-SYMBOLS: <osref> TYPE osref.
l_id_bug = bug->get_id( ).
lo_producto = bug->get_producto( ).
l_id_producto = lo_producto->get_id( ).
READ TABLE bugs_buffer WITH TABLE KEY producto_id = l_id_producto
bug_id = l_id_bug
INTO l_bug_buffer.
IF NOT sy-subrc IS INITIAL.
l_bug_buffer-oref = bug.
l_bug_buffer-producto_id = l_id_producto.
l_bug_buffer-bug_id = l_id_bug.
INSERT l_bug_buffer INTO TABLE bugs_buffer.
ENDIF.
* Montamos una query para obtener los bugs anteriores al indicado
lo_qm = cl_os_system=>get_query_manager( ).
lo_q = lo_qm->create_query( i_filter = 'PRODUCTO = PAR1 AND NEXT_BUG = PAR2 ' ).
lt_bughier_persist[] = zca_bughier_persist=>agent->if_os_ca_persistency~get_persistent_by_query(
i_query = lo_q
i_par1 = l_id_producto
i_par2 = l_id_bug ).
LOOP AT lt_bughier_persist ASSIGNING <osref>.
lo_bughier_persist ?= <osref>.
l_bug_buffer-bug_id = l_result-bug_id = lo_bughier_persist->get_bug( ).
l_bug_buffer-producto_id = l_result-producto_id = l_id_producto.
READ TABLE bugs_buffer WITH TABLE KEY producto_id = l_result-producto_id
bug_id = l_result-bug_id
INTO l_bug_buffer.
IF sy-subrc IS INITIAL.
l_result-oref = l_bug_buffer-oref.
ELSE.
l_bug_buffer-oref = l_result-oref =
zcl_bug_controller=>find_by_key( id = l_result-bug_id
producto = lo_producto ).
INSERT l_bug_buffer INTO TABLE bugs_buffer[].
ENDIF.
INSERT l_result INTO TABLE result[].
ENDLOOP.
ENDMETHOD.
method LOCK.
endmethod.
method NEXT_ID.
DATA: l_number_range TYPE tnro-object.
l_number_range = producto->get_bug_number_range( ).
IF l_number_range IS INITIAL.
l_number_range = 'ZBT_BUGID'. "Default Number Range
ENDIF.
IF bugtype IS SUPPLIED AND bugtype->get_nrobj( ) IS NOT INITIAL.
l_number_range = bugtype->get_nrobj( ).
ENDIF.
CALL FUNCTION 'NUMBER_GET_NEXT'
EXPORTING
nr_range_nr = '1'
object = l_number_range
quantity = '1'
* TOYEAR = '0000'
IMPORTING
number = return
* QUANTITY =
* RETURNCODE =
* EXCEPTIONS
* INTERVAL_NOT_FOUND = 1
* NUMBER_RANGE_NOT_INTERN = 2
* OBJECT_NOT_FOUND = 3
* QUANTITY_IS_0 = 4
* QUANTITY_IS_NOT_1 = 5
* INTERVAL_OVERFLOW = 6
* BUFFER_OVERFLOW = 7
* OTHERS = 8
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmethod.
METHOD persist_to_entity.
DATA: l_usuario TYPE xubname,
l_id_estado TYPE zbt_id_estado,
l_id_bugtype TYPE zbt_id_bugtype,
l_id_bugstype TYPE zbt_bugstype,
l_id_bug TYPE zbt_bug-bug,
l_id_bug_i TYPE zbt_bug-bug_i,
l_id_producto TYPE zbt_producto-producto,
l_id_componente TYPE zbt_id_componente,
l_resumen TYPE zbt_resumen,
lo_bugstype TYPE REF TO zcl_bugstype,
lo_bugtype TYPE REF TO zcl_bugtype,
lo_producto TYPE REF TO zcl_producto,
lo_usuario TYPE REF TO zcl_usuario,
lo_componente TYPE REF TO zcl_componente,
lo_estado TYPE REF TO zcl_estado,
l_timestamp TYPE zbt_erdat,
l_dats TYPE sy-datum,
l_horas TYPE zbt_horas_reales,
lt_bugs TYPE zbt_bugs,
lt_sections TYPE zbt_bugsections,
lt_transportes TYPE zbt_transport_tbl,
lt_attachements TYPE zbt_attachements,
lt_comments TYPE zbt_comentarios,
lt_tags TYPE zbt_bug_tag_tbl.
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Mapeamos contra un entity
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
l_id_bug = persist->get_bug( ).
l_id_producto = persist->get_producto( ).
l_id_componente = persist->get_componente( ).
lo_producto = zcl_producto_controller=>find_by_key( l_id_producto ).
lo_componente = zcl_componente_controller=>find_by_key( producto = lo_producto
id = l_id_componente ).
CREATE OBJECT entity
EXPORTING
id = l_id_bug
producto = lo_producto
componente = lo_componente.
l_usuario = persist->get_developer( ).
IF NOT l_usuario IS INITIAL.
lo_usuario = zcl_usuario_controller=>find_by_key( l_usuario ).
entity->set_developer( lo_usuario ).
ENDIF.
l_usuario = persist->get_assigned( ).
IF NOT l_usuario IS INITIAL.
lo_usuario = zcl_usuario_controller=>find_by_key( l_usuario ).
entity->set_assigned( lo_usuario ).
ENDIF.
l_usuario = persist->get_tester( ).
IF NOT l_usuario IS INITIAL.
lo_usuario = zcl_usuario_controller=>find_by_key( l_usuario ).
entity->set_tester( lo_usuario ).
ENDIF.
l_usuario = persist->get_reporter( ).
IF NOT l_usuario IS INITIAL.
lo_usuario = zcl_usuario_controller=>find_by_key( l_usuario ).
entity->set_reporter( lo_usuario ).
ENDIF.
l_usuario = persist->get_aenam( ).
IF NOT l_usuario IS INITIAL.
lo_usuario = zcl_usuario_controller=>find_by_key( l_usuario ).
entity->set_aenam( lo_usuario ).
ENDIF.
l_id_componente = persist->get_componente( ).
IF NOT l_id_componente IS INITIAL.
lo_componente = zcl_componente_controller=>find_by_key(
id = l_id_componente
producto = lo_producto ).
entity->set_componente( lo_componente ).
ENDIF.
l_id_estado = persist->get_estado( ).
IF NOT l_id_estado IS INITIAL.
lo_estado = zcl_estado_controller=>find_by_key( l_id_estado ).
entity->set_estado( lo_estado ).
ENDIF.
l_id_bugtype = persist->get_bugtype( ).
IF NOT l_id_bugtype IS INITIAL.
lo_bugtype = zcl_bugtype_controller=>find_by_key( l_id_bugtype ).
entity->set_bug_type( lo_bugtype ).
ENDIF.
l_id_bugstype = persist->get_bugstype( ).
IF NOT l_id_bugstype IS INITIAL.
lo_bugstype = zcl_bug_subtype_controller=>find_by_key( bugtype = lo_bugtype
id = l_id_bugstype ).
entity->set_bug_subtype( lo_bugstype ).
ENDIF.
l_resumen = persist->get_resumen( ).
entity->set_resumen( l_resumen ).
l_timestamp = persist->get_creado( ).
entity->set_creado( l_timestamp ).
l_id_bug_i = persist->get_bug_i( ).
entity->SET_ID_I( l_id_bug_i ).
l_timestamp = persist->get_aedat( ).
entity->set_aedat( l_timestamp ).
l_dats = persist->get_deadline( ).
entity->set_deadline( l_dats ).
l_timestamp = persist->get_finalizado( ).
entity->set_finalizado( l_timestamp ).
l_horas = persist->get_horas_est( ).
entity->set_horas_estimadas( l_horas ).
l_horas = persist->get_horas_rea( ).
entity->set_horas_reales( l_horas ).
lt_bugs[] = find_next_bugs( entity ).
entity->set_next_bugs( lt_bugs ).
lt_bugs[] = find_prev_bugs( entity ).
entity->set_prev_bugs( lt_bugs ).
lt_attachements[] = zcl_attachement_controller=>find_all_bug_attachements( entity ).
entity->set_attachements( lt_attachements[] ).
lt_comments[] = zcl_comment_controller=>find_all_bug_comments( bug = entity
no_section_comments = 'X' ).
entity->set_comentarios( lt_comments[] ).
lt_sections[] = zcl_bugsection_controller=>find_all_bug_sections( entity ).
entity->set_sections( lt_sections[] ).
lt_transportes[] = zcl_transport_controller=>find_all_bug_transports( entity ).
entity->set_transports( lt_transportes[] ).
lt_tags[] = zcl_bug_tag_controller=>find_bug_tags( entity ).
entity->set_tags( lt_tags[] ).
ENDMETHOD.
METHOD search.
DATA: lt_bugs TYPE STANDARD TABLE OF zbt_bug,
l_bug TYPE zbt_bug,
lo_producto TYPE REF TO zcl_producto,
l_return TYPE LINE OF zbt_bugs.
SELECT * FROM zbt_bug INTO TABLE lt_bugs
up to max_rows ROWS
WHERE bug IN bug[]
and bug_i IN bug_i[]
AND producto IN producto[]
AND componente IN componente[]
AND developer IN developer[]
AND assigned IN assigned[]
AND tester IN tester[]
AND reporter IN reporter[]
AND creado IN creado[]
AND estado IN estado[]
AND bugtype IN bugtype[]
AND bugstype IN bugstype[]
AND finalizado IN finalizado[]
AND deadline IN deadline[]
and aedat in aedat[]
and aenam in aenam[].
LOOP AT lt_bugs INTO l_bug.
l_return-bug_id = l_bug-bug.
l_return-producto_id = l_bug-producto.
lo_producto = zcl_producto_controller=>find_by_key( l_return-producto_id ).
l_return-oref = zcl_bug_controller=>find_by_key( id = l_return-bug_id
producto = lo_producto ).
INSERT l_return INTO TABLE return.
ENDLOOP.
ENDMETHOD.
METHOD structure_to_entity.
DATA: lo_producto TYPE REF TO zcl_producto,
lo_usuario TYPE REF TO zcl_usuario,
lo_componente TYPE REF TO zcl_componente,
lo_bugtype TYPE REF TO zcl_bugtype,
lo_bugstype TYPE REF TO zcl_bugstype,
lo_estado TYPE REF TO zcl_estado.
* entity->set_id( structure-bug ).
lo_producto = zcl_producto_controller=>find_by_key( structure-producto ).
lo_componente = zcl_componente_controller=>find_by_key( id = structure-componente
producto = lo_producto ).
entity->set_producto( lo_producto ).
entity->set_componente( lo_componente ).
entity->set_creado( structure-creado ).
entity->set_finalizado( structure-finalizado ).
entity->set_deadline( structure-deadline ).
TRY.
lo_usuario = zcl_usuario_controller=>find_by_key( structure-reporter ).
entity->set_reporter( lo_usuario ).
CATCH zcx_not_found_exception.
ENDTRY.
CLEAR lo_usuario.
TRY .
lo_usuario = zcl_usuario_controller=>find_by_key( structure-developer ).
entity->set_developer( lo_usuario ).
CATCH zcx_not_found_exception.
ENDTRY.
CLEAR lo_usuario.
TRY .
lo_usuario = zcl_usuario_controller=>find_by_key( structure-assigned ).
entity->set_assigned( lo_usuario ).
CATCH zcx_not_found_exception.
ENDTRY.
CLEAR lo_usuario.
TRY.
lo_usuario = zcl_usuario_controller=>find_by_key( structure-tester ).
entity->set_tester( lo_usuario ).
CATCH zcx_not_found_exception.
ENDTRY.
CLEAR lo_usuario.
entity->set_resumen( structure-resumen ).
lo_estado = zcl_estado_controller=>find_by_key( structure-estado ).
IF lo_estado IS BOUND.
entity->set_estado( lo_estado ).
ENDIF.
entity->set_horas_estimadas( structure-horas_est ).
entity->set_horas_reales( structure-horas_rea ).
entity->set_componente( lo_componente ).
lo_bugtype = zcl_bugtype_controller=>find_by_key( structure-bugtype ).
entity->set_bug_type( lo_bugtype ).
lo_bugstype = zcl_bug_subtype_controller=>find_by_key( id = structure-bugstype
bugtype = lo_bugtype ).
IF NOT lo_bugstype IS BOUND.
* If after having changed BugType we found that there's no subtype with same subtype id
* for the newly selected bugType, we try to obtain default subtype value
lo_bugstype = zcl_bug_subtype_controller=>find_by_key( id = 0
bugtype = lo_bugtype ).
ENDIF.
entity->set_bug_subtype( lo_bugstype ).
ENDMETHOD.
method UNLOCK.
endmethod.
METHOD update.
DATA: lo_bug_persist TYPE REF TO zcl_bug_persist,
lo_producto TYPE REF TO zcl_producto,
l_timestamp TYPE timestamp,
l_aedat TYPE zbt_bug-aedat,
l_id_bug TYPE zbt_bug-bug,
l_id_bug_i TYPE zbt_bug-bug_i,
l_id_producto TYPE zbt_producto-producto,
lt_attachements TYPE zbt_attachements,
lt_comentarios TYPE zbt_comentarios,
lt_sections TYPE zbt_bugsections,
lt_transportes TYPE zbt_transport_tbl,
lo_usuario TYPE REF TO zcl_usuario,
lo_transaccion TYPE REF TO zcl_transaction_service,
lt_tags TYPE zbt_bug_tag_tbl,
lt_wrklogs TYPE ZBT_BUGWRKLOGS,
lo_exception TYPE REF TO cx_root.
FIELD-SYMBOLS: <attachement> TYPE LINE OF zbt_attachements,
<comentario> TYPE LINE OF zbt_comentarios,
<section> TYPE LINE OF zbt_bugsections,
<tag> TYPE LINE OF zbt_bug_tag_tbl,
<transporte> TYPE LINE OF zbt_transport_tbl,
<wrklog> like LINE OF lt_wrklogs.
validate_on_update( bug ).
l_id_bug = bug->get_id( ).
* l_id_bug_i = bug->get_id_i( ).
lo_producto = bug->get_producto( ).
l_id_producto = lo_producto->get_id( ).
TRY .
* We look first at what is now the persistence layer
lo_bug_persist = zca_bug_persist=>agent->get_persistent( i_bug = l_id_bug
i_producto = l_id_producto ).
CATCH cx_os_object_not_found INTO lo_exception.
* In order to update it must exist
RAISE EXCEPTION TYPE zcx_update_exception
EXPORTING
textid = zcx_update_exception=>zcx_update_exception
previous = lo_exception.
ENDTRY.
CREATE OBJECT lo_transaccion.
lo_transaccion->start( ).
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* We proceed to update the rest of the objects
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TRY .
* Update Attachments
lt_attachements[] = bug->get_attachements( ).
LOOP AT lt_attachements ASSIGNING <attachement>.
* IF zcl_attachement_controller=>exist( <attachement>-oref ) = abap_true.
zcl_attachement_controller=>update( <attachement> ).
* ELSE.
zcl_attachement_controller=>update( <attachement> ).
* ENDIF.
ENDLOOP.
* Update comments
lt_comentarios[] = bug->get_comentarios( no_section_comments = space ).
LOOP AT lt_comentarios ASSIGNING <comentario>.
IF zcl_comment_controller=>exist( <comentario>-oref ) = abap_true.
zcl_comment_controller=>update( <comentario>-oref ).
ELSE.
zcl_comment_controller=>create( <comentario>-oref ).
ENDIF.
ENDLOOP.
* Update Sections
lt_sections[] = bug->get_sections( ) .
LOOP AT lt_sections ASSIGNING <section>.
IF zcl_bugsection_controller=>exist( <section>-oref ) = abap_true.
zcl_bugsection_controller=>update( <section>-oref ).
ELSE.
zcl_bugsection_controller=>create( <section>-oref ).
ENDIF.
ENDLOOP.
* Update Transports
lt_transportes[] = bug->get_transports( ).
LOOP AT lt_transportes ASSIGNING <transporte>.
IF zcl_transport_controller=>exist( <transporte>-oref ) = abap_true.
zcl_transport_controller=>update( <transporte>-oref ).
ELSE.
zcl_transport_controller=>create( <transporte>-oref ).
ENDIF.
ENDLOOP.
* Update Tags
lt_tags[] = bug->get_tags( ).
LOOP AT lt_tags ASSIGNING <tag>.
IF zcl_bug_tag_controller=>exist( <tag>-oref ) = abap_true.
zcl_bug_tag_controller=>update( <tag>-oref ).
ELSE.
zcl_bug_tag_controller=>create( <tag>-oref ).
ENDIF.
ENDLOOP.
lt_tags[] = bug->get_deleted_tags( ).
LOOP AT lt_tags ASSIGNING <tag>.
zcl_bug_tag_controller=>delete( <tag>-oref ).
ENDLOOP.
* Update WorkLog
lt_wrklogs = bug->get_wrklogs( ).
LOOP AT lt_wrklogs ASSIGNING <wrklog>.
IF zcl_bug_wrklog_controller=>exists( <wrklog>-oref ) = abap_true.
zcl_bug_wrklog_controller=>update( <wrklog>-oref ).
ELSE.
zcl_bug_wrklog_controller=>create( <wrklog>-oref ).
ENDIF.
ENDLOOP.
* Set ModifyDate
GET TIME STAMP FIELD l_timestamp.
l_aedat = l_timestamp.
bug->set_aedat( l_aedat ).
* Set ModifyUser
lo_usuario = zcl_usuario_controller=>find_by_key( ).
bug->set_aenam( lo_usuario ).
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Mapeamos contra el objeto de persistencia
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
entity_to_persist(
EXPORTING
entity = bug
CHANGING
persist = lo_bug_persist ).
lo_transaccion->end( ).
CATCH zcx_create_exception INTO lo_exception.
RAISE EXCEPTION TYPE zcx_update_exception
EXPORTING
previous = lo_exception.
ENDTRY.
ENDMETHOD.
METHOD validate_on_create.
DATA: l_str_bug TYPE zbt_bug,
lt_sections TYPE zbt_bugsections,
l_section TYPE LINE OF zbt_bugsections,
l_section_ok TYPE i,
l_comment_id TYPE zbt_bugcomment-comentario,
l_seccion_id TYPE zbt_bugseccion-seccion,
lo_estado TYPE REF TO zcl_estado,
lo_producto TYPE REF TO zcl_producto,
lo_usuario TYPE REF TO zcl_usuario,
lo_bugtype TYPE REF TO zcl_bugtype,
lo_subtype TYPE REF TO zcl_bugstype,
lo_componente TYPE REF TO zcl_componente,
l_field TYPE string,
lo_not_found TYPE REF TO zcx_not_found_exception.
l_str_bug = entity_to_structure( bug ).
TRY .
* Campos clave obligatorios!
IF l_str_bug-bug IS INITIAL.
l_field = 'Bug Id'(001).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
IF l_str_bug-bug_i IS INITIAL.
l_field = 'internal Bug Id'(018).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
IF l_str_bug-producto IS INITIAL.
l_field = 'Product Id'(002).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
* Producto debe existir
lo_producto = bug->get_producto( ).
IF zcl_producto_controller=>exist( lo_producto ) IS INITIAL.
l_field = 'Product'(003).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
* Si se indica un componente éste debe existir
IF NOT l_str_bug-componente IS INITIAL.
lo_componente = bug->get_componente( ).
IF zcl_componente_controller=>exist( lo_componente ) IS INITIAL.
l_field = 'Component'(004).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* Necesario la persona que da de alta el Bug!
IF l_str_bug-reporter IS INITIAL.
l_field = 'Reporter'(005).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ELSE.
* Reporter debe existir
lo_usuario = bug->get_reporter( ).
IF zcl_usuario_controller=>exist( lo_usuario ) IS INITIAL.
l_field = 'Reporter'(005).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* Si se indica un desarrollador éste debe existir
IF NOT l_str_bug-developer IS INITIAL.
* Developer debe existir
lo_usuario = bug->get_developer( ).
IF zcl_usuario_controller=>exist( lo_usuario ) IS INITIAL.
l_field = 'Developer'(006).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* does the assigned user exist?
IF NOT l_str_bug-assigned IS INITIAL.
* does the assigned user exist
lo_usuario = bug->get_assigned( ).
IF zcl_usuario_controller=>exist( lo_usuario ) IS INITIAL.
l_field = 'Assigned'(017).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* Si se indica un tester éste debe existir
IF NOT l_str_bug-tester IS INITIAL.
* Tester debe existir
lo_usuario = bug->get_tester( ).
IF zcl_usuario_controller=>exist( lo_usuario ) IS INITIAL.
l_field = 'Tester'(007).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* Necesario un estado
IF l_str_bug-estado IS INITIAL.
RAISE EXCEPTION TYPE zcx_validate_exception.
ELSE.
* Estado debe existir
lo_estado = bug->get_estado( ).
IF zcl_estado_controller=>exist( lo_estado ) IS INITIAL.
l_field = 'Status'(008).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
ENDIF.
* Necesario un resumen
IF l_str_bug-resumen IS INITIAL.
l_field = 'Short Text'(009).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
* Necesario un tipo
IF l_str_bug-bugtype IS INITIAL.
l_field = 'Bug Type'(010).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ELSE.
* Tipo debe existir
lo_bugtype = bug->get_bug_type( ).
IF zcl_bugtype_controller=>exist( lo_bugtype ) IS INITIAL.
l_field = 'Bug Type'(010).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* Necesaria una fecha de creación
IF l_str_bug-creado IS INITIAL.
l_field = 'Create Time'(011).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
lt_sections = bug->get_sections( ).
CASE l_str_bug-bugtype.
WHEN zcl_bugtype_controller=>bugtype_issue.
* Si se trata de una incidencia, necesaria una estimación de la importancia
IF l_str_bug-bugstype IS INITIAL.
l_field = 'Bug SubType'(012).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ELSE.
* Subtype Debe existir
lo_subtype = bug->get_bug_subtype( ).
IF zcl_bug_subtype_controller=>exist( lo_subtype ) IS INITIAL.
l_field = 'Bug SubType'(012).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* Necesario haber rellenado las secciones de "Problema detectado" y "Pasos para reproducirlo"
LOOP AT lt_sections INTO l_section.
l_seccion_id = l_section-oref->get_id( ).
IF l_seccion_id = zcl_bugsection_controller=>bugsection_problem
OR l_seccion_id = zcl_bugsection_controller=>bugsection_steps_reproduce.
ADD 1 TO l_section_ok.
ENDIF.
ENDLOOP.
IF l_section_ok <> 2.
l_field = 'Description and Steps to reproduce'(013).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
WHEN zcl_bugtype_controller=>bugtype_enhancement.
* Wenn dies ein Verbesserung ist, eine Eingabe des Verbesserungtypes is nötig
* Verhinderung des 0er Statuses
IF l_str_bug-bugstype IS INITIAL.
l_field = 'Bug SubType'(012).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ELSE.
* Subtype Debe existir, existiert der Subtype?
lo_subtype = bug->get_bug_subtype( ).
IF zcl_bug_subtype_controller=>exist( lo_subtype ) IS INITIAL.
l_field = 'Bug SubType'(012).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
* Si se trata de una mejora, necesaria una estimación inicial de horas
* Wenn es eine Verbesserung ist, ist eine erste Einschätzung der erforderlichen Stunden
IF l_str_bug-horas_est IS INITIAL.
l_field = 'Estimated Time'(014).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
* Necesario la sección InfoAdicional
* Erforderliche InfoAdicional Abschnitt
LOOP AT lt_sections INTO l_section.
l_seccion_id = l_section-oref->get_id( ).
IF l_seccion_id = zcl_bugsection_controller=>bugsection_more_info.
ADD 1 TO l_section_ok.
ENDIF.
ENDLOOP.
IF l_section_ok <> 1.
l_field = 'Additional Info'(015).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ENDIF.
WHEN zcl_bugtype_controller=>bugtype_note.
* Wenn dies ein Hinweis ist, eine Eingabe zur Schwere ist erforderlich
* Verhinderung des 0er Statuses
IF l_str_bug-bugstype IS INITIAL.
l_field = 'Bug SubType'(012).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
ELSE.
* Subtype Debe existir, existiert der Subtype?
lo_subtype = bug->get_bug_subtype( ).
IF zcl_bug_subtype_controller=>exist( lo_subtype ) IS INITIAL.
l_field = 'Bug SubType'(012).
RAISE EXCEPTION TYPE zcx_not_found_exception
EXPORTING
object = l_field.
ENDIF.
ENDIF.
ENDCASE.
CATCH zcx_not_found_exception INTO lo_not_found.
RAISE EXCEPTION TYPE zcx_validate_exception
EXPORTING
textid = zcx_validate_exception=>zcx_validate_exception
previous = lo_not_found.
ENDTRY.
ENDMETHOD.
METHOD validate_on_delete.
* Debe existir
IF exist( bug ) = space.
RAISE EXCEPTION TYPE zcx_validate_exception.
ENDIF.
ENDMETHOD.
METHOD validate_on_update.
DATA: l_str_bug TYPE zbt_bug,
l_field TYPE string,
lo_estado TYPE REF TO zcl_estado.
validate_on_create( bug ).
l_str_bug = entity_to_structure( bug ).
lo_estado = bug->get_estado( ).
* Si estado = cerrado -> tiene que tener fecha de cierre
IF lo_estado->get_type( ) = zcl_estado_controller=>status_finished
AND l_str_bug-finalizado IS INITIAL.
l_field = 'End Date'(016).
RAISE EXCEPTION TYPE zcx_mandatory_emptyfield
EXPORTING
field = l_field.
* A la inversa también
ELSEIF l_str_bug-finalizado IS NOT INITIAL
AND lo_estado->get_type( ) <> zcl_estado_controller=>status_finished.
RAISE EXCEPTION TYPE zcx_validate_exception.
ENDIF.
* Si estado = cerrado Y bug = mejora -> tiene que tener horas REALES
IF lo_estado->get_type( ) = zcl_estado_controller=>status_finished
AND l_str_bug-bugtype = zcl_bugtype_controller=>bugtype_enhancement
AND l_str_bug-horas_rea IS INITIAL.
RAISE EXCEPTION TYPE zcx_validate_exception.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
4871,
1168,
5097,
62,
12953,
62,
10943,
5446,
46,
3069,
1137,
6770,
198,
220,
1171,
198,
220,
2251,
1171,
628,
220,
3298,
2460,
1168,
5097,
62,
4805,
28644,
46,
62,
10943,
5446,
46,
3069,
1137,
764,
198,
198,
11377,
2665,
13,
198,
9,
1,
9,
1171,
6805,
286,
1398,
1168,
5097,
62,
12953,
62,
10943,
5446,
46,
3069,
1137,
198,
9,
1,
9,
466,
407,
2291,
584,
2723,
3696,
994,
10185,
628,
220,
1398,
12,
24396,
82,
29244,
6158,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
43387,
6158,
62,
6369,
42006,
2849,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
23428,
2389,
6158,
62,
6369,
42006,
2849,
764,
198,
220,
1398,
12,
24396,
82,
5550,
2538,
9328,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
7206,
2538,
9328,
62,
6369,
42006,
2849,
764,
198,
220,
1398,
12,
24396,
82,
47353,
9050,
62,
10468,
62,
46126,
11335,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
3525,
9050,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
46126,
11335,
8,
2099,
1168,
19313,
62,
12953,
764,
198,
220,
1398,
12,
24396,
82,
7788,
8808,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
26087,
27064,
8,
2099,
9977,
4760,
764,
198,
220,
1398,
12,
24396,
82,
376,
12115,
62,
17513,
62,
20373,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
2389,
2099,
1168,
19313,
62,
2389,
62,
12953,
198,
220,
220,
220,
220,
220,
5145,
4805,
28644,
46,
2099,
1006,
284,
1168,
5097,
62,
4805,
28644,
46,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
12953,
8,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
11929,
62,
37,
15919,
62,
6369,
42006,
2849,
764,
198,
220,
1398,
12,
24396,
82,
39726,
62,
2389,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
4805,
28644,
46,
2099,
1006,
284,
1168,
5097,
62,
4805,
28644,
46,
198,
220,
220,
220,
220,
220,
5145,
12953,
25216,
2099,
1006,
284,
1168,
5097,
62,
12953,
25216,
11902,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
26087,
27064,
8,
2099,
1168,
19313,
62,
12953,
12,
12953,
764,
198,
220,
1398,
12,
24396,
82,
35717,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
16977,
62,
6369,
42006,
2849,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
23428,
2389,
6158,
62,
6369,
42006,
2849,
764,
198,
220,
1398,
12,
24396,
82,
26173,
2389,
6158,
62,
1340,
62,
43387,
6158,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
23428,
2389,
6158,
62,
6369,
42006,
2849,
764,
198,
220,
1398,
12,
24396,
82,
26173,
2389,
6158,
62,
1340,
62,
7206,
2538,
9328,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
23428,
2389,
6158,
62,
6369,
42006,
2849,
764,
198,
220,
1398,
12,
24396,
82,
26173,
2389,
6158,
62,
1340,
62,
16977,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
23428,
2389,
6158,
62,
6369,
42006,
2849,
764,
198,
220,
1398,
12,
24396,
82,
19269,
18415,
11335,
62,
10468,
62,
3525,
9050,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
46126,
11335,
2099,
1168,
19313,
62,
12953,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
1988,
7,
3525,
9050,
8,
2099,
1006,
284,
1168,
5097,
62,
12953,
764,
198,
220,
1398,
12,
24396,
82,
406,
11290,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
764,
198,
220,
1398,
12,
24396,
82,
4725,
36840,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1006,
284,
1168,
5097,
62,
12953,
764,
198,
220,
1398,
12,
24396,
82,
46886,
1847,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
16,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
220,
220,
5145,
12953,
17,
2099,
1006,
284,
1168,
5097,
62,
12953,
198,
220,
220,
220,
8024,
198,
220,
220,
220,
220,
220,
1988,
7,
36,
10917,
1847,
8,
2099,
9977,
4760,
764,
198,
220,
1398,
12,
24396,
82,
7946,
31315,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
12953,
2099,
1168,
19313,
62,
12953,
62,
49,
27746,
11902,
198,
220,
220,
220,
220,
220,
5145,
12953,
62,
40,
2099,
1168,
19313,
62,
12953,
62,
40,
62,
49,
27746,
11902,
198,
220,
220,
220,
220,
220,
5145,
12953,
2257,
56,
11401,
2099,
1168,
19313,
62,
12953,
2257,
56,
11401,
62,
49,
27746,
11902,
198,
220,
220,
220,
220,
220,
5145,
12953,
25216,
2099,
1168,
19313,
62,
12953,
25216,
62,
49,
27746,
11902,
198,
220,
220,
220,
220,
220,
5145,
9858,
47,
1340,
3525,
36,
2099,
1168,
19313,
62,
9858,
47,
1340,
3525,
36,
62,
49,
27746,
11902,
198,
220,
220,
220,
220,
220,
5145,
7206,
2885,
24027,
2099,
1168,
19313,
62,
35,
33586,
62,
49,
27746,
11902,
198,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_aoc_check_43 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
METHODS get_message_text
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_call,
class TYPE seoclsname,
method TYPE string,
start_line TYPE i,
start_column TYPE token_col,
end_line TYPE i,
end_column TYPE token_col,
program TYPE programm,
level TYPE stmnt_levl,
END OF ty_call.
TYPES:
ty_call_tt TYPE SORTED TABLE OF ty_call WITH NON-UNIQUE KEY level start_line.
TYPES:
BEGIN OF ty_seosubcodf,
clsname TYPE seosubcodf-clsname,
cmpname TYPE seosubcodf-cmpname,
sconame TYPE seosubcodf-sconame,
version TYPE seosubcodf-version,
paroptionl TYPE seosubcodf-paroptionl,
parvalue TYPE seosubcodf-parvalue,
parpreferd TYPE seosubcodf-parpreferd,
END OF ty_seosubcodf.
TYPES:
ty_seosubcodf_tt TYPE STANDARD TABLE OF ty_seosubcodf WITH DEFAULT KEY.
METHODS read_parameters
IMPORTING
!iv_class TYPE seoclsname
!iv_method TYPE string
RETURNING
VALUE(rt_parameters) TYPE ty_seosubcodf_tt.
METHODS check_parameters
IMPORTING
!is_call TYPE ty_call
!iv_code TYPE string.
METHODS get_calls
IMPORTING
!it_levels TYPE slevel_tab
RETURNING
VALUE(rt_calls) TYPE ty_call_tt.
ENDCLASS.
CLASS ZCL_AOC_CHECK_43 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lt_calls TYPE ty_call_tt,
lv_index TYPE i,
lv_foobar TYPE string, "#EC NEEDED
lv_str TYPE string.
FIELD-SYMBOLS: <ls_top> LIKE LINE OF it_tokens,
<ls_token> LIKE LINE OF it_tokens,
<ls_call> LIKE LINE OF lt_calls,
<ls_statement> LIKE LINE OF it_statements.
lt_calls = get_calls( it_levels ).
IF lt_calls IS INITIAL.
RETURN.
ENDIF.
LOOP AT it_statements ASSIGNING <ls_statement>.
LOOP AT it_tokens ASSIGNING <ls_top> FROM <ls_statement>-from TO <ls_statement>-to.
lv_index = sy-tabix.
LOOP AT lt_calls ASSIGNING <ls_call>
WHERE level = <ls_statement>-level
AND start_line = <ls_top>-row
AND start_column = <ls_top>-col.
CLEAR lv_str.
LOOP AT it_tokens ASSIGNING <ls_token> FROM lv_index TO <ls_statement>-to.
IF <ls_token>-row > <ls_call>-end_line
OR ( <ls_token>-row = <ls_call>-end_line
AND <ls_token>-col + strlen( <ls_token>-str ) >= <ls_call>-end_column ).
EXIT.
ENDIF.
IF lv_str IS INITIAL.
lv_str = <ls_token>-str.
ELSE.
CONCATENATE lv_str <ls_token>-str INTO lv_str SEPARATED BY space.
ENDIF.
ENDLOOP.
SPLIT lv_str AT '(' INTO lv_foobar lv_str.
IF lv_str <> ''.
check_parameters(
is_call = <ls_call>
iv_code = lv_str ).
ENDIF.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD check_parameters.
TYPES: BEGIN OF ty_seosubcodf,
clsname TYPE seosubcodf-clsname,
cmpname TYPE seosubcodf-cmpname,
sconame TYPE seosubcodf-sconame,
version TYPE seosubcodf-version,
paroptionl TYPE seosubcodf-paroptionl,
parvalue TYPE seosubcodf-parvalue,
parpreferd TYPE seosubcodf-parpreferd,
END OF ty_seosubcodf.
DATA: lv_parameter TYPE seosubcodf-sconame,
lt_parameters TYPE TABLE OF ty_seosubcodf,
lv_foobar TYPE string, "#EC NEEDED
lv_post TYPE string.
SPLIT iv_code AT '=' INTO lv_parameter lv_post.
WHILE lv_post CA '('.
REPLACE FIRST OCCURRENCE OF '(' IN lv_post WITH space.
REPLACE FIRST OCCURRENCE OF ')' IN lv_post WITH space.
ENDWHILE.
SPLIT lv_post AT ')' INTO lv_post lv_foobar.
IF lv_post IS INITIAL OR lv_post CA '='.
RETURN.
ENDIF.
CONDENSE lv_parameter.
lt_parameters = read_parameters(
iv_class = is_call-class
iv_method = is_call-method ).
* in case there are multiple parameters filter out the optional
* if there is one importing parameter it is okay to be optional
IF lines( lt_parameters ) > 1.
DELETE lt_parameters WHERE ( paroptionl = abap_true OR parvalue <> '' )
AND parpreferd = abap_false.
ENDIF.
IF lines( lt_parameters ) <> 1.
RETURN.
ENDIF.
READ TABLE lt_parameters WITH KEY sconame = lv_parameter
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
inform( p_sub_obj_type = c_type_include
p_sub_obj_name = is_call-program
p_line = is_call-start_line
p_kind = mv_errty
p_test = myname
p_code = '001'
p_param_1 = lv_parameter ).
ENDIF.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
description = 'Parameter name can be omitted'. "#EC NOTEXT
category = 'ZCL_AOC_CATEGORY'.
version = '001'.
position = '043'.
has_attributes = abap_true.
attributes_ok = abap_true.
mv_errty = c_error.
ENDMETHOD. "CONSTRUCTOR
METHOD get_calls.
DATA: lt_result TYPE scr_refs,
lv_foobar TYPE string, "#EC NEEDED
ls_call LIKE LINE OF rt_calls.
FIELD-SYMBOLS: <ls_result> LIKE LINE OF lt_result.
lt_result = get_compiler( ).
DELETE lt_result WHERE tag <> cl_abap_compiler=>tag_method.
LOOP AT lt_result ASSIGNING <ls_result>.
CLEAR ls_call.
<ls_result>-full_name = <ls_result>-full_name+4.
SPLIT <ls_result>-full_name AT '\ME:' INTO <ls_result>-full_name lv_foobar.
IF <ls_result>-full_name CP '*\IN:*'.
SPLIT <ls_result>-full_name AT '\IN:' INTO lv_foobar ls_call-class.
ELSE.
ls_call-class = <ls_result>-full_name.
ENDIF.
ls_call-method = <ls_result>-name.
ls_call-start_line = <ls_result>-statement->start_line.
ls_call-start_column = <ls_result>-statement->start_column.
ls_call-end_line = <ls_result>-statement->end_line.
ls_call-end_column = <ls_result>-statement->end_column.
ls_call-program = <ls_result>-statement->source_info->name.
READ TABLE it_levels WITH KEY name = ls_call-program TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
ls_call-level = sy-tabix.
INSERT ls_call INTO TABLE rt_calls.
ENDLOOP.
ENDMETHOD.
METHOD get_message_text.
CLEAR p_text.
CASE p_code.
WHEN '001'.
p_text = 'Parameter name &1 can be omitted'. "#EC NOTEXT
WHEN OTHERS.
super->get_message_text( EXPORTING p_test = p_test
p_code = p_code
IMPORTING p_text = p_text ).
ENDCASE.
ENDMETHOD.
METHOD read_parameters.
DATA: lv_super TYPE seometarel-refclsname.
SELECT * FROM seosubcodf
INTO CORRESPONDING FIELDS OF TABLE rt_parameters
WHERE clsname = iv_class
AND cmpname = iv_method
AND pardecltyp = '0'
AND type <> ''. "#EC CI_ALL_FIELDS_NEEDED
IF sy-subrc <> 0.
SELECT SINGLE refclsname
FROM seometarel
INTO lv_super
WHERE clsname = iv_class
AND version <> seoc_version_inactive
AND reltype = seor_reltype_inheritance ##WARN_OK.
IF sy-subrc = 0 AND NOT lv_super IS INITIAL.
* try looking in super class
rt_parameters = read_parameters(
iv_class = lv_super
iv_method = iv_method ).
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
64,
420,
62,
9122,
62,
3559,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
64,
420,
62,
16668,
198,
220,
29244,
6158,
44731,
13,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
13,
628,
220,
220,
220,
337,
36252,
50,
2198,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
20500,
62,
5239,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
13345,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1398,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
420,
7278,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2446,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
923,
62,
1370,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
923,
62,
28665,
41876,
11241,
62,
4033,
11,
198,
220,
220,
220,
220,
220,
220,
220,
886,
62,
1370,
220,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
886,
62,
28665,
220,
220,
41876,
11241,
62,
4033,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1430,
220,
220,
220,
220,
220,
41876,
1430,
76,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1241,
220,
220,
220,
220,
220,
220,
220,
41876,
336,
76,
429,
62,
2768,
75,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
13345,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
13345,
62,
926,
41876,
311,
9863,
1961,
43679,
3963,
1259,
62,
13345,
13315,
44521,
12,
4944,
33866,
8924,
35374,
1241,
923,
62,
1370,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
325,
418,
549,
19815,
69,
11,
198,
220,
220,
220,
220,
220,
220,
220,
537,
82,
3672,
220,
220,
220,
41876,
384,
418,
549,
19815,
69,
12,
565,
82,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
269,
3149,
3672,
220,
220,
220,
41876,
384,
418,
549,
19815,
69,
12,
48991,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
629,
261,
480,
220,
220,
220,
41876,
384,
418,
549,
19815,
69,
12,
82,
1102,
480,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2196,
220,
220,
220,
41876,
384,
418,
549,
19815,
69,
12,
9641,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1582,
18076,
75,
41876,
384,
418,
549,
19815,
69,
12,
1845,
18076,
75,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1582,
8367,
220,
220,
41876,
384,
418,
549,
19815,
69,
12,
1845,
8367,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1582,
3866,
2232,
67,
41876,
384,
418,
549,
19815,
69,
12,
1845,
3866,
2232,
67,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
325,
418,
549,
19815,
69,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
1259,
62,
325,
418,
549,
19815,
69,
62,
926,
41876,
49053,
9795,
43679,
3963,
1259,
62,
325,
418,
549,
19815,
69,
13315,
5550,
38865,
35374,
13,
628,
220,
220,
220,
337,
36252,
50,
1100,
62,
17143,
7307,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
4871,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
384,
420,
7278,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
24396,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
17143,
7307,
8,
41876,
1259,
62,
325,
418,
549,
19815,
69,
62,
926,
13,
198,
220,
220,
220,
337,
36252,
50,
2198,
62,
17143,
7307,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
271,
62,
13345,
41876,
1259,
62,
13345,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
8189,
41876,
4731,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
66,
5691,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
270,
62,
46170,
220,
220,
220,
220,
220,
41876,
3133,
626,
62,
8658,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
17034,
62,
66,
5691,
8,
41876,
1259,
62,
13345,
62,
926,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
32,
4503,
62,
50084,
62,
3559,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
2198,
13,
198,
198,
9,
450,
499,
11505,
7376,
4657,
198,
9,
3740,
1378,
12567,
13,
785,
14,
75,
5406,
79,
14,
397,
499,
11505,
7376,
4657,
198,
9,
17168,
13789,
628,
220,
220,
220,
42865,
25,
300,
83,
62,
66,
5691,
220,
41876,
1259,
62,
13345,
62,
926,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
9630,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
6513,
30973,
41876,
4731,
11,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
25113,
2943,
36465,
1961,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
2536,
220,
220,
220,
41876,
4731,
13,
628,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
25,
1279,
7278,
62,
4852,
29,
220,
220,
220,
220,
220,
220,
34178,
48920,
3963,
340,
62,
83,
482,
641,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
interface ZIF_EXCEL_BOOK_VBA_PROJECT
public .
data VBAPROJECT type XSTRING read-only .
data CODENAME type STRING read-only .
data CODENAME_PR type STRING read-only .
methods SET_VBAPROJECT
importing
!IP_VBAPROJECT type XSTRING .
methods SET_CODENAME
importing
!IP_CODENAME type STRING .
methods SET_CODENAME_PR
importing
!IP_CODENAME_PR type STRING .
endinterface.
| [
39994,
1168,
5064,
62,
6369,
34,
3698,
62,
39453,
62,
53,
4339,
62,
31190,
23680,
198,
220,
1171,
764,
628,
198,
220,
1366,
569,
33,
2969,
13252,
23680,
2099,
1395,
18601,
2751,
1100,
12,
8807,
764,
198,
220,
1366,
327,
3727,
1677,
10067,
2099,
19269,
2751,
1100,
12,
8807,
764,
198,
220,
1366,
327,
3727,
1677,
10067,
62,
4805,
2099,
19269,
2751,
1100,
12,
8807,
764,
628,
220,
5050,
25823,
62,
44526,
2969,
13252,
23680,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
4061,
62,
44526,
2969,
13252,
23680,
2099,
1395,
18601,
2751,
764,
198,
220,
5050,
25823,
62,
34,
3727,
1677,
10067,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
4061,
62,
34,
3727,
1677,
10067,
2099,
19269,
2751,
764,
198,
220,
5050,
25823,
62,
34,
3727,
1677,
10067,
62,
4805,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
4061,
62,
34,
3727,
1677,
10067,
62,
4805,
2099,
19269,
2751,
764,
198,
437,
39994,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_aoc_check_23 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
METHODS get_message_text
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_23 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA: lv_code TYPE sci_errc,
lt_statements LIKE io_scan->statements,
lv_include TYPE program.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements,
<ls_token> LIKE LINE OF io_scan->tokens.
lt_statements = io_scan->statements.
LOOP AT lt_statements ASSIGNING <ls_statement>
WHERE coloncol <> 0
AND type <> io_scan->gc_statement-pragma.
CLEAR lv_code.
READ TABLE io_scan->tokens ASSIGNING <ls_token> INDEX <ls_statement>-from.
IF sy-subrc <> 0.
CONTINUE.
ENDIF.
IF <ls_token>-str <> 'TYPES'
AND <ls_token>-str <> 'DATA'
AND <ls_token>-str <> 'CLASS-DATA'
AND <ls_token>-str <> 'STATICS'
AND <ls_token>-str <> 'WRITE'
AND <ls_token>-str <> 'MOVE' " anyhow obsolete
AND <ls_token>-str <> 'RANGES' " anyhow obsolete
AND <ls_token>-str <> 'METHODS'
AND <ls_token>-str <> 'CLEAR'
AND <ls_token>-str <> 'PERFORM'
AND <ls_token>-str <> 'REFRESH'
AND <ls_token>-str <> 'UNASSIGN'
AND <ls_token>-str <> 'FREE'
AND <ls_token>-str <> 'CONSTANTS'
AND <ls_token>-str <> 'TABLES'
AND <ls_token>-str <> 'PARAMETERS'
AND <ls_token>-str <> 'PARAMETER'
AND <ls_token>-str <> 'INTERFACES'
AND <ls_token>-str <> 'SELECT-OPTIONS'
AND <ls_token>-str <> 'SELECTION-SCREEN'
AND <ls_token>-str <> 'ALIASES'
AND <ls_token>-str <> 'INCLUDE'
AND <ls_token>-str <> 'TYPE-POOLS'
AND <ls_token>-str <> 'CLASS-METHODS'
AND <ls_token>-str <> 'FIELD-SYMBOLS'.
lv_code = '001'.
ENDIF.
IF lv_code IS INITIAL
AND strlen( <ls_token>-str ) + <ls_token>-col <> <ls_statement>-coloncol
AND <ls_token>-str <> 'PERFORM'.
lv_code = '002'.
ENDIF.
IF lv_code IS INITIAL.
LOOP AT io_scan->tokens ASSIGNING <ls_token>
FROM <ls_statement>-from TO <ls_statement>-to
WHERE row = <ls_statement>-colonrow.
IF <ls_token>-col = <ls_statement>-coloncol + 1.
lv_code = '003'.
EXIT. " current loop
ENDIF.
ENDLOOP.
ENDIF.
IF NOT lv_code IS INITIAL.
lv_include = io_scan->get_include( <ls_statement>-level ).
inform( p_sub_obj_name = lv_include
p_line = <ls_token>-row
p_kind = mv_errty
p_test = myname
p_code = lv_code ).
* do not report multiple errors for the same chanined statement
DELETE lt_statements
WHERE level = <ls_statement>-level
AND colonrow = <ls_statement>-colonrow
AND coloncol = <ls_statement>-coloncol.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '023'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
ENDMETHOD.
METHOD get_message_text.
CLEAR p_text.
CASE p_code.
WHEN '001'.
p_text = 'Use chained statements mainly for declarations'. "#EC NOTEXT
WHEN '002'.
p_text = 'Space before colon'. "#EC NOTEXT
WHEN '003'.
p_text = 'Missing space after colon'. "#EC NOTEXT
WHEN OTHERS.
super->get_message_text( EXPORTING p_test = p_test
p_code = p_code
IMPORTING p_text = p_text ).
ENDCASE.
ENDMETHOD. "GET_MESSAGE_TEXT
ENDCLASS.
| [
31631,
1976,
565,
62,
64,
420,
62,
9122,
62,
1954,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
64,
420,
62,
16668,
198,
220,
29244,
6158,
44731,
13,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
13,
628,
220,
220,
220,
337,
36252,
50,
2198,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
20500,
62,
5239,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
32,
4503,
62,
50084,
62,
1954,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
2198,
13,
198,
198,
9,
450,
499,
11505,
7376,
4657,
198,
9,
3740,
1378,
12567,
13,
785,
14,
75,
5406,
79,
14,
397,
499,
11505,
7376,
4657,
198,
9,
17168,
13789,
628,
220,
220,
220,
42865,
25,
300,
85,
62,
8189,
220,
220,
220,
220,
220,
220,
41876,
20681,
62,
263,
6015,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
14269,
3196,
34178,
33245,
62,
35836,
3784,
14269,
3196,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
17256,
220,
220,
220,
41876,
1430,
13,
628,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
25,
1279,
7278,
62,
26090,
29,
34178,
48920,
3963,
33245,
62,
35836,
3784,
14269,
3196,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1279,
7278,
62,
30001,
29,
220,
220,
220,
220,
34178,
48920,
3963,
33245,
62,
35836,
3784,
83,
482,
641,
13,
628,
198,
220,
220,
220,
300,
83,
62,
14269,
3196,
796,
33245,
62,
35836,
3784,
14269,
3196,
13,
628,
220,
220,
220,
17579,
3185,
5161,
300,
83,
62,
14269,
3196,
24994,
3528,
15871,
1279,
7278,
62,
26090,
29,
198,
220,
220,
220,
220,
220,
220,
220,
33411,
7633,
4033,
1279,
29,
657,
198,
220,
220,
220,
220,
220,
220,
220,
5357,
2099,
1279,
29,
33245,
62,
35836,
3784,
36484,
62,
26090,
12,
1050,
363,
2611,
13,
628,
220,
220,
220,
220,
220,
30301,
1503,
300,
85,
62,
8189,
13,
628,
220,
220,
220,
220,
220,
20832,
43679,
33245,
62,
35836,
3784,
83,
482,
641,
24994,
3528,
15871,
1279,
7278,
62,
30001,
29,
24413,
6369,
1279,
7278,
62,
26090,
29,
12,
6738,
13,
198,
220,
220,
220,
220,
220,
16876,
827,
12,
7266,
6015,
1279,
29,
657,
13,
198,
220,
220,
220,
220,
220,
220,
220,
43659,
8924,
13,
198,
220,
220,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
220,
220,
16876,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
9936,
47,
1546,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
26947,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
31631,
12,
26947,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
35744,
19505,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
18564,
12709,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
11770,
6089,
6,
220,
366,
597,
4919,
26533,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
49,
15567,
1546,
6,
366,
597,
4919,
26533,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
49273,
50,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
29931,
1503,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
18973,
21389,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
2200,
10913,
44011,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
4944,
10705,
16284,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
39274,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
10943,
2257,
1565,
4694,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
5603,
9148,
1546,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
27082,
2390,
2767,
4877,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
27082,
2390,
2767,
1137,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
41358,
37,
2246,
1546,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
46506,
12,
3185,
51,
11053,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
46506,
2849,
12,
6173,
2200,
1677,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
1847,
43429,
1546,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5357,
1279,
7278,
62,
30001,
29,
12,
2536,
1279,
29,
705,
1268,
5097,
52,
7206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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_uitb_abap_code_viewer DEFINITION
PUBLIC
INHERITING FROM zcl_uitb_gui_dialog
CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS show_code
IMPORTING
iv_title TYPE string
iv_theme TYPE zuitb_code_viewer_theme DEFAULT zif_uitb_c_code_viewer_themes=>default
it_code TYPE string_table OPTIONAL
iv_code TYPE string OPTIONAL
iv_width TYPE i DEFAULT 1400
iv_height TYPE i DEFAULT 900.
METHODS zif_uitb_gui_command_handler~execute_command
REDEFINITION.
PROTECTED SECTION.
METHODS create_content
REDEFINITION.
PRIVATE SECTION.
DATA mv_code TYPE string.
data mv_theme type zuitb_code_viewer_theme.
DATA mt_code TYPE string_table.
DATA mo_code_view TYPE REF TO zcl_uitb_abap_code_view.
ENDCLASS.
CLASS zcl_uitb_abap_code_viewer IMPLEMENTATION.
METHOD show_code.
zcl_uitb_screen_util=>show_progress( iv_progress = 1 iv_text = |{ 'Source Code is being prepared...'(002) }| ).
DATA(lr_code_viewer) = NEW zcl_uitb_abap_code_viewer(
iv_title = iv_title
).
lr_code_viewer->mt_code = it_code.
lr_code_viewer->mv_code = iv_code.
lr_code_viewer->mv_theme = iv_theme.
lr_code_viewer->show(
iv_width = iv_width
iv_height = iv_height
).
ENDMETHOD.
METHOD zif_uitb_gui_command_handler~execute_command.
RETURN.
ENDMETHOD.
METHOD create_content.
mo_code_view = NEW zcl_uitb_abap_code_view(
io_parent_container = io_container
iv_theme = mv_theme
).
mo_code_view->show_document(
it_code = mt_code
iv_code = mv_code
).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
5013,
65,
62,
397,
499,
62,
8189,
62,
1177,
263,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
5013,
65,
62,
48317,
62,
38969,
519,
198,
220,
29244,
6158,
4810,
3824,
6158,
13,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
905,
62,
8189,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
7839,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
43810,
220,
41876,
1976,
5013,
65,
62,
8189,
62,
1177,
263,
62,
43810,
5550,
38865,
1976,
361,
62,
5013,
65,
62,
66,
62,
8189,
62,
1177,
263,
62,
1169,
6880,
14804,
12286,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
8189,
220,
220,
41876,
4731,
62,
11487,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
8189,
220,
220,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
10394,
220,
41876,
1312,
5550,
38865,
36641,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
17015,
41876,
1312,
5550,
38865,
15897,
13,
198,
220,
220,
220,
337,
36252,
50,
1976,
361,
62,
5013,
65,
62,
48317,
62,
21812,
62,
30281,
93,
41049,
62,
21812,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
2251,
62,
11299,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
285,
85,
62,
8189,
41876,
4731,
13,
198,
220,
220,
220,
1366,
285,
85,
62,
43810,
2099,
1976,
5013,
65,
62,
8189,
62,
1177,
263,
62,
43810,
13,
198,
220,
220,
220,
42865,
45079,
62,
8189,
41876,
4731,
62,
11487,
13,
198,
220,
220,
220,
42865,
6941,
62,
8189,
62,
1177,
41876,
4526,
37,
5390,
1976,
565,
62,
5013,
65,
62,
397,
499,
62,
8189,
62,
1177,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
5013,
65,
62,
397,
499,
62,
8189,
62,
1177,
263,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
905,
62,
8189,
13,
198,
220,
220,
220,
1976,
565,
62,
5013,
65,
62,
9612,
62,
22602,
14804,
12860,
62,
33723,
7,
21628,
62,
33723,
796,
352,
21628,
62,
5239,
796,
930,
90,
705,
7416,
6127,
318,
852,
5597,
986,
6,
7,
21601,
8,
1782,
91,
6739,
628,
220,
220,
220,
42865,
7,
14050,
62,
8189,
62,
1177,
263,
8,
796,
12682,
1976,
565,
62,
5013,
65,
62,
397,
499,
62,
8189,
62,
1177,
263,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
7839,
796,
21628,
62,
7839,
198,
220,
220,
220,
6739,
198,
220,
220,
220,
300,
81,
62,
8189,
62,
1177,
263,
3784,
16762,
62,
8189,
796,
340,
62,
8189,
13,
198,
220,
220,
220,
300,
81,
62,
8189,
62,
1177,
263,
3784,
76,
85,
62,
8189,
796,
21628,
62,
8189,
13,
198,
220,
220,
220,
300,
81,
62,
8189,
62,
1177,
263,
3784,
76,
85,
62,
43810,
796,
21628,
62,
43810,
13,
628,
220,
220,
220,
300,
81,
62,
8189,
62,
1177,
263,
3784,
12860,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
10394,
220,
796,
21628,
62,
10394,
198,
220,
220,
220,
220,
220,
21628,
62,
17015,
796,
21628,
62,
17015,
198,
220,
220,
220,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1976,
361,
62,
5013,
65,
62,
48317,
62,
21812,
62,
30281,
93,
41049,
62,
21812,
13,
198,
220,
220,
220,
30826,
27064,
13,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
2251,
62,
11299,
13,
198,
220,
220,
220,
6941,
62,
8189,
62,
1177,
796,
12682,
1976,
565,
62,
5013,
65,
62,
397,
499,
62,
8189,
62,
1177,
7,
198,
220,
220,
220,
220,
220,
33245,
62,
8000,
62,
34924,
796,
33245,
62,
34924,
198,
220,
220,
220,
220,
220,
21628,
62,
43810,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
285,
85,
62,
43810,
198,
220,
220,
220,
6739,
628,
220,
220,
220,
6941,
62,
8189,
62,
1177,
3784,
12860,
62,
22897,
7,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
8189,
796,
45079,
62,
8189,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
8189,
796,
285,
85,
62,
8189,
198,
220,
220,
220,
6739,
198,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_string_map DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES:
BEGIN OF ty_entry,
k TYPE string,
v TYPE string,
END OF ty_entry.
TYPES:
tty_entries TYPE STANDARD TABLE OF ty_entry WITH KEY k.
TYPES:
tts_entries TYPE SORTED TABLE OF ty_entry WITH UNIQUE KEY k.
CLASS-METHODS create
RETURNING
VALUE(ro_instance) TYPE REF TO zcl_abapgit_string_map.
METHODS get
IMPORTING
iv_key TYPE string
RETURNING
VALUE(rv_val) TYPE string.
METHODS has
IMPORTING
iv_key TYPE string
RETURNING
VALUE(rv_has) TYPE abap_bool.
METHODS set
IMPORTING
iv_key TYPE string
iv_val TYPE string OPTIONAL
RETURNING
VALUE(ro_map) TYPE REF TO zcl_abapgit_string_map
RAISING
zcx_abapgit_exception.
METHODS size
RETURNING
VALUE(rv_size) TYPE i.
METHODS is_empty
RETURNING
VALUE(rv_yes) TYPE abap_bool.
METHODS delete
IMPORTING
iv_key TYPE string
RAISING
zcx_abapgit_exception.
METHODS clear
RAISING
zcx_abapgit_exception.
METHODS to_abap
CHANGING
!cs_container TYPE any
RAISING
zcx_abapgit_exception.
METHODS freeze.
DATA mt_entries TYPE tts_entries READ-ONLY.
PROTECTED SECTION.
PRIVATE SECTION.
DATA mv_read_only TYPE abap_bool.
ENDCLASS.
CLASS ZCL_ABAPGIT_STRING_MAP IMPLEMENTATION.
METHOD clear.
IF mv_read_only = abap_true.
zcx_abapgit_exception=>raise( 'Cannot clear. This string map is immutable' ).
ENDIF.
CLEAR mt_entries.
ENDMETHOD.
METHOD create.
CREATE OBJECT ro_instance.
ENDMETHOD.
METHOD delete.
IF mv_read_only = abap_true.
zcx_abapgit_exception=>raise( 'Cannot delete. This string map is immutable' ).
ENDIF.
DELETE mt_entries WHERE k = iv_key.
ENDMETHOD.
METHOD freeze.
mv_read_only = abap_true.
ENDMETHOD.
METHOD get.
FIELD-SYMBOLS <ls_entry> LIKE LINE OF mt_entries.
READ TABLE mt_entries ASSIGNING <ls_entry> WITH KEY k = iv_key.
IF sy-subrc IS INITIAL.
rv_val = <ls_entry>-v.
ENDIF.
ENDMETHOD.
METHOD has.
READ TABLE mt_entries TRANSPORTING NO FIELDS WITH KEY k = iv_key.
rv_has = boolc( sy-subrc IS INITIAL ).
ENDMETHOD.
METHOD is_empty.
rv_yes = boolc( lines( mt_entries ) = 0 ).
ENDMETHOD.
METHOD set.
DATA ls_entry LIKE LINE OF mt_entries.
FIELD-SYMBOLS <ls_entry> LIKE LINE OF mt_entries.
IF mv_read_only = abap_true.
zcx_abapgit_exception=>raise( 'Cannot set. This string map is immutable' ).
ENDIF.
READ TABLE mt_entries ASSIGNING <ls_entry> WITH KEY k = iv_key.
IF sy-subrc IS INITIAL.
<ls_entry>-v = iv_val.
ELSE.
ls_entry-k = iv_key.
ls_entry-v = iv_val.
INSERT ls_entry INTO TABLE mt_entries.
ENDIF.
ro_map = me.
ENDMETHOD.
METHOD size.
rv_size = lines( mt_entries ).
ENDMETHOD.
METHOD to_abap.
DATA lo_type TYPE REF TO cl_abap_typedescr.
DATA lo_struc TYPE REF TO cl_abap_structdescr.
DATA lv_field TYPE string.
FIELD-SYMBOLS <ls_entry> LIKE LINE OF mt_entries.
FIELD-SYMBOLS <lv_val> TYPE any.
lo_type = cl_abap_typedescr=>describe_by_data( cs_container ).
IF lo_type->type_kind <> cl_abap_typedescr=>typekind_struct1
AND lo_type->type_kind <> cl_abap_typedescr=>typekind_struct2.
zcx_abapgit_exception=>raise( 'Only structures supported' ).
ENDIF.
lo_struc ?= lo_type.
LOOP AT mt_entries ASSIGNING <ls_entry>.
lv_field = to_upper( <ls_entry>-k ).
ASSIGN COMPONENT lv_field OF STRUCTURE cs_container TO <lv_val>.
IF sy-subrc = 0.
" TODO check target type ?
<lv_val> = <ls_entry>-v.
ELSE.
zcx_abapgit_exception=>raise( |Component { lv_field } not found in target| ).
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
8841,
62,
8899,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
13000,
11,
198,
220,
220,
220,
220,
220,
220,
220,
479,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
410,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
13000,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
256,
774,
62,
298,
1678,
41876,
49053,
9795,
43679,
3963,
1259,
62,
13000,
13315,
35374,
479,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
256,
912,
62,
298,
1678,
41876,
311,
9863,
1961,
43679,
3963,
1259,
62,
13000,
13315,
4725,
33866,
8924,
35374,
479,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
2251,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
39098,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
8841,
62,
8899,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
2100,
8,
41876,
4731,
13,
198,
220,
220,
220,
337,
36252,
50,
468,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2539,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
10134,
8,
41876,
450,
499,
62,
30388,
13,
198,
220,
220,
220,
337,
36252,
50,
900,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2539,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2100,
41876,
4731,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
8899,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
8841,
62,
8899,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
337,
36252,
50,
2546,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
7857,
8,
41876,
1312,
13,
198,
220,
220,
220,
337,
36252,
50,
318,
62,
28920,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
8505,
8,
41876,
450,
499,
62,
30388,
13,
198,
220,
220,
220,
337,
36252,
50,
12233,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
2539,
41876,
4731,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
337,
36252,
50,
1598,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
337,
36252,
50,
284,
62,
397,
499,
198,
220,
220,
220,
220,
220,
5870,
15567,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
6359,
62,
34924,
41876,
597,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
220,
220,
337,
36252,
50,
16611,
13,
628,
220,
220,
220,
42865,
45079,
62,
298,
1678,
41876,
256,
912,
62,
298,
1678,
20832,
12,
1340,
11319,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
285,
85,
62,
961,
62,
8807,
41876,
450,
499,
62,
30388,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
18601,
2751,
62,
33767,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1598,
13,
198,
220,
220,
220,
16876,
285,
85,
62,
961,
62,
8807,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
7,
705,
34,
34574,
1598,
13,
770,
4731,
3975,
318,
40139,
6,
6739,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
30301,
1503,
45079,
62,
298,
1678,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
2251,
13,
198,
220,
220,
220,
29244,
6158,
25334,
23680,
686,
62,
39098,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
12233,
13,
628,
220,
220,
220,
16876,
285,
85,
62,
961,
62,
8807,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
14804,
40225,
7,
705,
34,
34574,
12233,
13,
770,
4731,
3975,
318,
40139,
6,
6739,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
5550,
2538,
9328,
45079,
62,
298,
1678,
33411,
479,
796,
21628,
62,
2539,
13,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
16611,
13,
198,
220,
220,
220,
285,
85,
62,
961,
62,
8807,
796,
450,
499,
62,
7942,
13,
198,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
651,
13,
628,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
1279,
7278,
62,
13000,
29,
34178,
48920,
3963,
45079,
62,
298,
1678,
13,
198,
220,
220,
220,
20832,
43679,
45079,
62,
298,
1678,
24994,
3528
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
class ZSAPLINK_INTERFACE definition
public
inheriting from ZSAPLINK
create public .
public section.
type-pools ABAP .
type-pools SEOR .
type-pools SEOS .
type-pools SEOT .
methods CHECKEXISTS
redefinition .
methods CREATEIXMLDOCFROMOBJECT
redefinition .
methods CREATEOBJECTFROMIXMLDOC
redefinition .
protected section.
methods DELETEOBJECT
redefinition .
methods GETOBJECTTYPE
redefinition .
private section.
constants XML_KEY_METHOD type STRING value 'method' ##NO_TEXT.
constants XML_KEY_PARAMETER type STRING value 'parameter' ##NO_TEXT.
constants XML_KEY_EXCEPTION type STRING value 'exception' ##NO_TEXT.
constants XML_KEY_EVENTS type STRING value 'events' ##NO_TEXT.
constants XML_KEY_ATTRIBUTE type STRING value 'attribute' ##NO_TEXT.
constants XML_KEY_TYPEUSAGE type STRING value 'typeUsage' ##NO_TEXT.
constants XML_KEY_TYPES type STRING value 'types' ##NO_TEXT.
constants XML_KEY_INCLUDE type STRING value 'include' ##NO_TEXT.
methods EXPORT_INTERFACES
importing
!CLASSKEY type SEOCLSKEY
exporting
!RC type SYSUBRC
changing
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods IMPORT_METHODS
changing
!CH_METHODS type SEOO_METHODS_R
!CH_PARAMETERS type SEOS_PARAMETERS_R
!CH_EXCEPS type SEOS_EXCEPTIONS_R .
methods IMPORT_ATTRIBUTES
changing
!CH_ATTRIBUTES type SEOO_ATTRIBUTES_R
raising
ZCX_SAPLINK .
methods IMPORT_INTERFACES
changing
!CH_COMPRISINGS type SEOR_COMPRISINGS_R .
methods IMPORT_TYPES
changing
!CH_TYPEUSAGES type SEOT_TYPEPUSAGES_R
!CH_TYPES type SEOO_TYPES_R .
methods IMPORT_EVENTS
changing
!CH_EVENTS type SEOO_EVENTS_R
!CH_PARAMETERS type SEOS_PARAMETERS_R .
methods EXPORT_METHODS
importing
!INTFDESCR type ref to CL_ABAP_INTFDESCR
!CLASSNAME type SEOCLSNAME
changing
!RC type SYSUBRC
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods EXPORT_EVENTS
importing
!CLASSKEY type SEOCLSKEY
changing
!RC type SYSUBRC
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods EXPORT_ATTRIBUTES
importing
!INTFDESCR type ref to CL_ABAP_INTFDESCR
changing
!RC type SYSUBRC
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods EXPORT_TYPES
importing
!CLASSKEY type SEOCLSKEY
changing
!RC type SYSUBRC
!ROOTNODE type ref to IF_IXML_ELEMENT .
methods EXPORT_TYPEGROUPS
importing
!CLASSKEY type SEOCLSKEY
changing
!RC type SYSUBRC
!ROOTNODE type ref to IF_IXML_ELEMENT .
ENDCLASS.
CLASS ZSAPLINK_INTERFACE 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data intkey type SEOCLSKEY.
data not_active TYPE char1.
intkey-clsName = objname.
CALL FUNCTION 'SEO_INTERFACE_EXISTENCE_CHECK'
EXPORTING
intkey = intkey
IMPORTING
not_active = not_active
EXCEPTIONS
* NOT_SPECIFIED = 1
NOT_EXISTING = 2
* IS_CLASS = 3
* NO_TEXT = 4
* INCONSISTENT = 5
* OTHERS = 6
.
IF sy-subrc <> 2.
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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data intfsection type ref to if_ixml_element.
data rootnode type ref to if_ixml_element.
data _classname type seoclsname.
data rc type sysubrc.
data intfdescr type ref to cl_abap_intfdescr.
data typedescr type ref to cl_abap_typedescr.
data classkey type seoclskey.
data intproperties type vseointerf.
data _objtype type string.
_classname = objname.
classkey-clsname = objname.
_objtype = getobjecttype( ).
rootnode = xmldoc->create_element( _objtype ).
call function 'SEO_INTERFACE_GET'
EXPORTING
intkey = classkey
version = '1'
IMPORTING
interface = intproperties
EXCEPTIONS
not_existing = 1
deleted = 2
is_class = 3
model_only = 4
others = 5.
if sy-subrc <> 0.
case sy-subrc.
when 1.
raise exception type zcx_SAPlink
exporting textid = zcx_SAPlink=>not_found.
when 2.
raise exception type zcx_SAPlink
exporting
textid = zcx_SAPlink=>error_message
msg = 'interface deleted'.
when 3.
raise exception type zcx_SAPlink
exporting
textid = zcx_SAPlink=>error_message
msg = 'classes not supported'.
when 4.
raise exception type zcx_SAPlink
exporting
textid = zcx_SAPlink=>error_message
msg = 'interface is modeled only'.
endcase.
endif.
setattributesfromstructure( node = rootnode
structure = intproperties ).
try.
call method cl_abap_intfdescr=>describe_by_name
EXPORTING
p_name = objname
RECEIVING
p_descr_ref = typedescr
EXCEPTIONS
type_not_found = 1.
if sy-subrc = 0.
intfdescr ?= typedescr.
endif.
catch cx_root.
raise exception type zcx_SAPlink
exporting textid = zcx_SAPlink=>system_error.
endtry.
*Add included interfaces to the xml document
CALL METHOD ME->EXPORT_INTERFACES
EXPORTING
CLASSKEY = classkey
IMPORTING
RC = rc
CHANGING
ROOTNODE = rootnode.
*Add types to the xml document
CALL METHOD me->EXPORT_TYPES
EXPORTING
CLASSKEY = classkey
CHANGING
RC = rc
ROOTNODE = rootnode.
*Add typegroups to the xml document
CALL METHOD me->EXPORT_TYPEGROUPS
EXPORTING
CLASSKEY = classkey
CHANGING
RC = rc
ROOTNODE = rootnode.
*Add events to the xml document
CALL METHOD me->EXPORT_EVENTS
EXPORTING
CLASSKEY = classkey
CHANGING
RC = rc
ROOTNODE = rootnode.
*Add attributes to the xml document
CALL METHOD me->EXPORT_ATTRIBUTES
EXPORTING
INTFDESCR = intfdescr
CHANGING
RC = rc
ROOTNODE = rootnode.
*Add methods to the xml document
CALL METHOD me->EXPORT_METHODS
EXPORTING
INTFDESCR = intfdescr
CLASSNAME = _CLASSNAME
CHANGING
RC = rc
ROOTNODE = rootnode.
* append root node to xmldoc
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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data rootnode type ref to if_ixml_element.
data classkey type seoclskey.
data not_active type boolean.
data _devclass type devclass.
data _objtype type string.
data checkexists type flag.
data: e_corrnr type TRKORR,
e_devclass type DEVCLASS,
e_version type SEOVERSION,
e_genflag type GENFLAG,
e_authority_check type SEOX_BOOLEAN,
e_overwrite type SEOX_BOOLEAN.
data: i_korrnr type trkorr.
data: ch_interface type VSEOINTERF,
ch_comprisings type SEOR_COMPRISINGS_R,
ch_attributes type SEOO_ATTRIBUTES_R,
ch_methods type SEOO_METHODS_R,
ch_events type SEOO_EVENTS_R,
ch_parameters type SEOS_PARAMETERS_R,
ch_exceps type SEOS_EXCEPTIONS_R,
ch_typeusages type SEOT_TYPEPUSAGES_R,
ch_types type SEOO_TYPES_R.
call function 'SEO_BUFFER_INIT'.
e_devclass = devclass.
_objtype = getobjecttype( ).
e_overwrite = overwrite.
_devclass = devclass.
_objtype = getobjecttype( ).
xmldoc = ixmldocument.
rootnode = xmldoc->find_from_name( _objtype ).
call method getstructurefromattributes
EXPORTING
node = rootnode
CHANGING
structure = ch_interface.
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.
if sy-subrc <> 0.
case sy-subrc.
when 1.
raise exception type zcx_SAPlink
exporting textid = zcx_SAPlink=>not_authorized.
when others.
raise exception type zcx_SAPlink
exporting textid = zcx_SAPlink=>system_error.
endcase.
endif.
*Add attributes to new interface
call method import_attributes
CHANGING
ch_attributes = ch_attributes.
*Add includes
call method import_interfaces
CHANGING
ch_comprisings = ch_comprisings.
*Add types and type groups
call method import_types
CHANGING
ch_types = ch_types
ch_typeusages = ch_typeusages.
*Add events and event parameters
call method import_events
CHANGING
ch_events = ch_events
ch_parameters = ch_parameters.
*Add methods, method parameters and method exceptions
call method import_methods
CHANGING
ch_methods = ch_methods
ch_parameters = ch_parameters
ch_exceps = ch_exceps.
*Create the interface
CALL FUNCTION 'SEO_INTERFACE_CREATE_COMPLETE'
EXPORTING
CORRNR = e_corrnr
DEVCLASS = e_devclass
VERSION = e_version
GENFLAG = e_genflag
AUTHORITY_CHECK = e_authority_check
OVERWRITE = e_overwrite
* SUPPRESS_REFACTORING_SUPPORT = SEOX_TRUE
IMPORTING
KORRNR = i_korrnr
* TABLES
* CLASS_DESCRIPTIONS =
* COMPONENT_DESCRIPTIONS =
* SUBCOMPONENT_DESCRIPTIONS =
CHANGING
INTERFACE = ch_interface
COMPRISINGS = ch_comprisings
ATTRIBUTES = ch_attributes
METHODS = ch_methods
EVENTS = ch_events
PARAMETERS = ch_parameters
EXCEPS = ch_exceps
* ALIASES =
TYPEPUSAGES = ch_typeusages
* CLSDEFERRDS =
* INTDEFERRDS =
TYPES = ch_types
EXCEPTIONS
EXISTING = 1
IS_CLASS = 2
DB_ERROR = 3
COMPONENT_ERROR = 4
NO_ACCESS = 5
OTHER = 6
OTHERS = 7.
case sy-subrc.
when '0'.
** i guess if we made it this far, we will assume
** successful install
name = objname.
when '1'.
RAISE EXCEPTION TYPE zcx_SAPlink
EXPORTING textid = zcx_SAPlink=>existing.
when others.
raise exception type zcx_SAPlink
exporting textid = zcx_SAPlink=>system_error.
endcase.
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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
DATA clskey TYPE seoclskey.
clskey-clsname = objname.
CALL FUNCTION 'SEO_INTERFACE_GET'
EXPORTING
INTKEY = clskey
VERSION = SEOC_VERSION_INACTIVE
STATE = '0'
EXCEPTIONS
NOT_EXISTING = 1
DELETED = 2
IS_CLASS = 3
MODEL_ONLY = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
RAISE EXCEPTION TYPE zcx_SAPlink
EXPORTING
textid = zcx_SAPlink=>error_message
msg = 'interface not deleted'.
ENDIF.
CALL FUNCTION 'SEO_INTERFACE_DELETE_W_DEPS'
EXPORTING
intkey = clskey
save = ' '
EXCEPTIONS
not_existing = 1
is_class = 2
not_deleted = 3
db_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
RAISE EXCEPTION TYPE zcx_SAPlink
EXPORTING textid = zcx_SAPlink=>not_found.
WHEN 2.
RAISE EXCEPTION TYPE zcx_SAPlink
EXPORTING
textid = zcx_SAPlink=>error_message
msg = 'class not supported'.
WHEN 3.
RAISE EXCEPTION TYPE zcx_SAPlink
EXPORTING
textid = zcx_SAPlink=>error_message
msg = 'interface not deleted'.
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_SAPlink
EXPORTING textid = zcx_SAPlink=>system_error.
ENDCASE.
ENDIF.
CALL FUNCTION 'SEO_CLIF_SAVE_ALL'
EXPORTING
CIFKEY = clskey
* CHANGING
* CORRNR = corrnr
EXCEPTIONS
NOT_EXISTING = 1
NOTHING_TO_DO = 2
ACCESS_ERROR = 3
DB_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endmethod.
method EXPORT_ATTRIBUTES.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: attribkey type seocmpkey,
attribdescr type abap_attrdescr,
attribnode type ref to if_ixml_element,
attribproperties type vseoattrib,
_otrguid type sotr_conc,
otrnode type ref to if_ixml_element.
attribkey-clsname = objname.
loop at intfdescr->attributes into attribdescr where is_inherited =
abap_false.
attribnode = xmldoc->create_element( XML_KEY_ATTRIBUTE ).
attribkey-cmpname = attribdescr-name.
call function 'SEO_ATTRIBUTE_GET'
EXPORTING
attkey = attribkey
IMPORTING
attribute = attribproperties.
* include OTR if necessary (for exception classes)
if attribproperties-type = 'SOTR_CONC' and attribproperties-attvalue
is not initial.
_otrguid = attribproperties-attvalue+1(32).
otrnode = createnodefromotr( _otrguid ).
if otrnode is bound.
rc = attribnode->append_child( otrnode ).
endif.
endif.
* append attribute node to parent node
setattributesfromstructure( node = attribnode structure =
attribproperties ).
rc = rootnode->append_child( attribnode ).
endloop.
endmethod.
method EXPORT_EVENTS.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
DATA: events TYPE SEOO_EVENTS_R,
wa_event LIKE LINE OF events,
eventkey type SEOCMPKEY,
eventparams type seos_parameters_r,
wa_params type seos_parameter_r,
event_node TYPE REF TO if_ixml_element,
parameternode type ref to if_ixml_element.
CALL FUNCTION 'SEO_EVENT_READ_ALL'
EXPORTING
cifkey = classkey
version = 1
IMPORTING
events = events
EXCEPTIONS
clif_not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
LOOP AT events INTO wa_event.
eventkey-clsname = wa_event-clsname.
eventkey-cmpname = wa_event-CMPNAME.
event_node = xmldoc->create_element( XML_KEY_EVENTS ).
setattributesfromstructure( node = event_node structure =
wa_event ).
CALL FUNCTION 'SEO_EVENT_SIGNATURE_GET'
EXPORTING
EVTKEY = eventkey
IMPORTING
PARAMETERS = eventparams.
* event parameters
loop at eventParams into wa_params.
parameternode = xmldoc->create_element( XML_KEY_PARAMETER ).
setattributesfromstructure( node = parameternode
structure = wa_params ).
rc = event_node->append_child( parameternode ).
ENDLOOP.
rc = rootnode->append_child( event_node ).
ENDLOOP.
endmethod.
method EXPORT_INTERFACES.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
DATA: it_vseocompri type table of VSEOCOMPRI,
wa_vseocompri like line of it_vseocompri,
implementingNode TYPE REF TO if_ixml_element,
objname type VRSD-OBJNAME.
objname = classkey.
CALL FUNCTION 'SVRS_GET_VERSION_INTF_40'
EXPORTING
* DESTINATION =
OBJECT_NAME = objname
VERSNO = '00000'
* IV_NO_RELEASE_TRANSFORMATION =
* IMPORTING
* INFO_LINE =
TABLES
* VSMODISRC =
* PSEOALIASES =
* PVSEOATTRIB =
PVSEOCOMPRI = it_vseocompri
* PVSEOEVENT =
* PVSEOEXCEP =
* PVSEOINTERF =
* PSMODILOG =
* PVSEOMETHOD =
* PVSEOPARAM =
* PPOOL_SOURCE =
* PSOURCE =
* PTRDIR =
* TYPE_TAB =
* PSEOTYPEPLS =
EXCEPTIONS
NO_VERSION = 1
SYSTEM_FAILURE = 2
COMMUNICATION_FAILURE = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT it_vseocompri INTO wa_vseocompri.
implementingNode = xmldoc->create_element( XML_KEY_INCLUDE ).
setattributesfromstructure( node = implementingNode structure =
wa_vseocompri ).
rc = rootnode->append_child( implementingNode ).
ENDLOOP.
endmethod.
method EXPORT_METHODS.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: methoddescr type abap_methdescr,
methodkey type seocpdkey,
clsmethkey type seocmpkey,
methodproperties type vseomethod,
paramdescr type abap_parmdescr,
paramproperties type vseoparam,
paramkey type seoscokey,
exceptionlist type seos_exceptions_r,
anexception type vseoexcep,
exceptionnode type ref to if_ixml_element,
parameternode type ref to if_ixml_element,
methodnode type ref to if_ixml_element.
loop at intfdescr->methods into methoddescr where
not ( is_inherited = 'X' and is_redefined is initial ).
methodkey-clsname = classname.
methodkey-cpdname = methoddescr-name.
clsmethkey-clsname = classname.
clsmethkey-cmpname = methoddescr-name.
clear methodproperties.
call function 'SEO_METHOD_GET'
EXPORTING
mtdkey = clsmethkey
IMPORTING
method = methodproperties
EXCEPTIONS
not_existing = 1.
if sy-subrc = 0.
methodnode = xmldoc->create_element( XML_KEY_METHOD ).
setattributesfromstructure( node = methodnode structure =
methodproperties ).
*add method parameters only when not an alias
if methoddescr-alias_for eq ''.
loop at methoddescr-parameters into paramdescr.
clear paramproperties.
parameternode = xmldoc->create_element( XML_KEY_PARAMETER ).
paramkey-cmpname = clsmethkey-cmpname.
paramkey-sconame = paramdescr-name.
paramkey-clsname = objname.
call function 'SEO_PARAMETER_GET'
EXPORTING
parkey = paramkey
version = '1'
IMPORTING
parameter = paramproperties.
setattributesfromstructure( node = parameternode
structure = paramproperties ).
rc = methodnode->append_child( parameternode ).
endloop.
endif.
*add method exceptions
call function 'SEO_METHOD_SIGNATURE_GET'
EXPORTING
mtdkey = clsmethkey
version = '1'
IMPORTING
exceps = exceptionlist.
loop at exceptionlist into anexception.
exceptionnode = xmldoc->create_element( XML_KEY_EXCEPTION ).
setattributesfromstructure( node = exceptionnode
structure = anexception ).
rc = methodnode->append_child( exceptionnode ).
endloop.
endif. "method found
rc = rootnode->append_child( methodnode ).
endloop.
endmethod.
method EXPORT_TYPEGROUPS.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: forwarddeclarationlist type seot_typepusages_r,
forwarddeclaration type ref to if_ixml_element,
forwarddeclarationrow type seot_typepusage_r.
call function 'SEO_TYPEPUSAGE_READ_ALL'
EXPORTING
cifkey = classkey
version = '1'
IMPORTING
typepusages = forwarddeclarationlist.
*comment rrq old way....forwardDeclarations the only attribute
*set was the "TypeGroup"
*the new way....the entire structure is passed as in node typeUsage
LOOP AT forwarddeclarationlist INTO forwarddeclarationrow.
forwarddeclaration = xmldoc->create_element( XML_KEY_TYPEUSAGE ).
setattributesfromstructure( node = forwarddeclaration structure =
forwarddeclarationrow ).
rc = rootnode->append_child( forwarddeclaration ).
ENDLOOP.
endmethod.
method EXPORT_TYPES.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: types type seoo_types_r,
wa_type like line of types,
types_node type ref to if_ixml_element.
call function 'SEO_TYPE_READ_ALL'
EXPORTING
cifkey = classkey
version = 1
IMPORTING
types = types
EXCEPTIONS
clif_not_existing = 1
others = 2.
if sy-subrc <> 0.
endif.
loop at types into wa_type.
types_node = xmldoc->create_element( XML_KEY_TYPES ).
setattributesfromstructure( node = types_node structure =
wa_type ).
rc = rootnode->append_child( types_node ).
endloop.
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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
objecttype = 'INTF'. "Interface
endmethod.
method IMPORT_ATTRIBUTES.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: otrConcept type SOTR_TEXT-CONCEPT,
wa_attributes like line of ch_attributes,
filter type ref to if_ixml_node_filter,
iterator type ref to if_ixml_node_iterator,
node type ref to if_ixml_element,
otrnode type ref to if_ixml_element.
filter = xmldoc->create_filter_name( XML_KEY_ATTRIBUTE ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
* create OTR texts if necessary (for exception classes)
clear otrConcept.
otrnode = node->find_from_name( 'sotr' ).
IF otrnode IS NOT INITIAL.
me->createotrfromnode(
exporting node = otrnode
importing concept = otrConcept ).
ENDIF.
clear wa_attributes.
* create attribute
CALL METHOD getstructurefromattributes
EXPORTING
node = node
CHANGING
structure = wa_attributes.
wa_attributes-version = '0'.
* ewH:issue33-->6.40 and above, must create new concept
if otrConcept is not initial.
concatenate `'` otrConcept `'` into wa_attributes-attvalue.
endif.
append wa_attributes to ch_attributes.
node ?= iterator->get_next( ).
ENDWHILE.
endmethod.
method IMPORT_EVENTS.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: event_filter type ref to if_ixml_node_filter,
parameter_filter type ref to if_ixml_node_filter,
event_iterator type ref to if_ixml_node_iterator,
parameter_iterator type ref to if_ixml_node_iterator,
event_node type ref to if_ixml_element,
parameter_node type ref to if_ixml_element,
wa_events like line of ch_events,
wa_parameters like line of ch_parameters.
event_filter = xmldoc->create_filter_name( XML_KEY_EVENTS ).
event_iterator = xmldoc->create_iterator_filtered( event_filter ).
event_node ?= event_iterator->get_next( ).
WHILE event_node IS NOT INITIAL.
CLEAR wa_events.
CALL METHOD getstructurefromattributes
EXPORTING
node = event_node
CHANGING
structure = wa_events.
append wa_events to ch_events.
parameter_filter = event_node->create_filter_name( XML_KEY_PARAMETER ).
parameter_iterator = event_node->create_iterator_filtered( parameter_filter ).
parameter_node ?= parameter_iterator->get_next( ).
WHILE parameter_node IS NOT INITIAL.
CLEAR wa_parameters.
CALL METHOD getstructurefromattributes
EXPORTING
node = parameter_node
CHANGING
structure = wa_parameters.
append wa_parameters to ch_parameters.
parameter_node ?= parameter_iterator->get_next( ).
endwhile.
event_node ?= event_iterator->get_next( ).
ENDWHILE.
endmethod.
method IMPORT_INTERFACES.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: filter type ref to if_ixml_node_filter,
iterator type ref to if_ixml_node_iterator,
node type ref to if_ixml_element,
wa_comprisings like line of ch_comprisings.
filter = xmldoc->create_filter_name( XML_KEY_INCLUDE ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CLEAR wa_comprisings.
CALL METHOD getstructurefromattributes
EXPORTING
node = node
CHANGING
structure = wa_comprisings.
wa_comprisings-version = '0'.
append wa_comprisings to ch_comprisings.
node ?= iterator->get_next( ).
ENDWHILE.
endmethod.
method IMPORT_METHODS.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: filter type ref to if_ixml_node_filter,
filter2 type ref to if_ixml_node_filter,
iterator type ref to if_ixml_node_iterator,
iterator2 type ref to if_ixml_node_iterator,
node type ref to if_ixml_element,
node2 type ref to if_ixml_element,
wa_parameters like line of ch_parameters,
wa_methods like line of ch_methods,
wa_exceps like line of ch_exceps.
*Add methods to new interface
filter = xmldoc->create_filter_name( XML_KEY_METHOD ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CLEAR wa_methods.
CALL METHOD getstructurefromattributes
EXPORTING
node = node
CHANGING
structure = wa_methods.
*Add parameters
filter2 = node->create_filter_name( XML_KEY_PARAMETER ).
iterator2 = node->create_iterator_filtered( filter2 ).
node2 ?= iterator2->get_next( ).
WHILE node2 IS NOT INITIAL.
CLEAR wa_parameters.
CALL METHOD getstructurefromattributes
EXPORTING
node = node2
CHANGING
structure = wa_parameters.
append wa_parameters to ch_parameters.
node2 ?= iterator2->get_next( ).
ENDWHILE.
*Add exceptions
filter2 = node->create_filter_name( XML_KEY_EXCEPTION ).
iterator2 = node->create_iterator_filtered( filter2 ).
node2 ?= iterator2->get_next( ).
WHILE node2 IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node = node2
CHANGING
structure = wa_exceps.
append wa_exceps to ch_exceps.
node2 ?= iterator2->get_next( ).
ENDWHILE.
append wa_methods to ch_methods.
node ?= iterator->get_next( ).
endwhile.
endmethod.
method IMPORT_TYPES.
*/---------------------------------------------------------------------\
*| 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 Ritter
*Based on work done by: Michael Yakovlev, Edward Herrmann
*and other SAPlink contributors
data: filter type ref to if_ixml_node_filter,
iterator type ref to if_ixml_node_iterator,
node type ref to if_ixml_element,
wa_types like line of ch_types,
wa_typeusages like line of ch_typeusages.
filter = xmldoc->create_filter_name( XML_KEY_TYPES ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CLEAR wa_types.
CALL METHOD getstructurefromattributes
EXPORTING
node = node
CHANGING
structure = wa_types.
wa_types-version = '0'.
append wa_types to ch_types.
node ?= iterator->get_next( ).
ENDWHILE.
*ewH: for version 0.1.3, we will continue to generate both nodes
* in order for upgradeability of SAPlink itself. For version
* 2.0, forwardDeclaration node generations will be deprecated.
filter = xmldoc->create_filter_name( XML_KEY_TYPEUSAGE ).
iterator = xmldoc->create_iterator_filtered( filter ).
node ?= iterator->get_next( ).
WHILE node IS NOT INITIAL.
CALL METHOD getstructurefromattributes
EXPORTING
node = node
CHANGING
structure = wa_typeUsages.
APPEND wa_typeusages TO ch_typeusages.
node ?= iterator->get_next( ).
ENDWHILE.
endmethod.
ENDCLASS.
| [
4871,
1168,
50,
2969,
43,
17248,
62,
41358,
49836,
6770,
198,
220,
1171,
198,
220,
10639,
1780,
422,
1168,
50,
2969,
43,
17248,
198,
220,
2251,
1171,
764,
198,
198,
11377,
2665,
13,
198,
220,
2099,
12,
7742,
82,
9564,
2969,
764,
198,
220,
2099,
12,
7742,
82,
7946,
1581,
764,
198,
220,
2099,
12,
7742,
82,
7946,
2640,
764,
198,
220,
2099,
12,
7742,
82,
7946,
2394,
764,
628,
220,
5050,
5870,
25171,
6369,
1797,
4694,
198,
220,
220,
220,
34087,
17750,
764,
198,
220,
5050,
29244,
6158,
10426,
5805,
38715,
10913,
2662,
9864,
23680,
198,
220,
220,
220,
34087,
17750,
764,
198,
220,
5050,
29244,
1404,
4720,
33,
23680,
10913,
2662,
10426,
5805,
38715,
198,
220,
220,
220,
34087,
17750,
764,
198,
24326,
2665,
13,
628,
220,
5050,
5550,
28882,
4720,
33,
23680,
198,
220,
220,
220,
34087,
17750,
764,
198,
220,
5050,
17151,
9864,
23680,
25216,
198,
220,
220,
220,
34087,
17750,
764,
198,
19734,
2665,
13,
628,
220,
38491,
23735,
62,
20373,
62,
49273,
2099,
19269,
2751,
1988,
705,
24396,
6,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
23735,
62,
20373,
62,
27082,
2390,
2767,
1137,
2099,
19269,
2751,
1988,
705,
17143,
2357,
6,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
23735,
62,
20373,
62,
6369,
42006,
2849,
2099,
19269,
2751,
1988,
705,
1069,
4516,
6,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
23735,
62,
20373,
62,
20114,
15365,
2099,
19269,
2751,
1988,
705,
31534,
6,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
23735,
62,
20373,
62,
1404,
5446,
9865,
37780,
2099,
19269,
2751,
1988,
705,
42348,
6,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
23735,
62,
20373,
62,
25216,
2937,
11879,
2099,
19269,
2751,
1988,
705,
4906,
28350,
6,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
23735,
62,
20373,
62,
9936,
47,
1546,
2099,
19269,
2751,
1988,
705,
19199,
6,
22492,
15285,
62,
32541,
13,
198,
220,
38491,
23735,
62,
20373,
62,
1268,
5097,
52,
7206,
2099,
19269,
2751,
1988,
705,
17256,
6,
22492,
15285,
62,
32541,
13,
628,
220,
5050,
7788,
15490,
62,
41358,
37,
2246,
1546,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
31631,
20373,
2099,
7946,
4503,
6561,
20373,
198,
220,
220,
220,
39133,
198,
220,
220,
220,
220,
220,
5145,
7397,
2099,
311,
16309,
10526,
7397,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
13252,
2394,
45,
16820,
2099,
1006,
284,
16876,
62,
10426,
5805,
62,
36,
2538,
10979,
764,
198,
220,
5050,
30023,
9863,
62,
49273,
50,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
49273,
50,
2099,
30850,
46,
62,
49273,
50,
62,
49,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
27082,
2390,
2767,
4877,
2099,
7946,
2640,
62,
27082,
2390,
2767,
4877,
62,
49,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
6369,
5222,
3705,
2099,
7946,
2640,
62,
6369,
42006,
11053,
62,
49,
764,
198,
220,
5050,
30023,
9863,
62,
1404,
5446,
9865,
3843,
1546,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
1404,
5446,
9865,
3843,
1546,
2099,
30850,
46,
62,
1404,
5446,
9865,
3843,
1546,
62,
49,
198,
220,
220,
220,
8620,
198,
220,
220,
220,
220,
220,
1168,
34,
55,
62,
50,
2969,
43,
17248,
764,
198,
220,
5050,
30023,
9863,
62,
41358,
37,
2246,
1546,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
9858,
4805,
1797,
20754,
2099,
7946,
1581,
62,
9858,
4805,
1797,
20754,
62,
49,
764,
198,
220,
5050,
30023,
9863,
62,
9936,
47,
1546,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
25216,
2937,
25552,
2099,
7946,
2394,
62,
9936,
47,
8905,
2937,
25552,
62,
49,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
9936,
47,
1546,
2099,
30850,
46,
62,
9936,
47,
1546,
62,
49,
764,
198,
220,
5050,
30023,
9863,
62,
20114,
15365,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
20114,
15365,
2099,
30850,
46,
62,
20114,
15365,
62,
49,
198,
220,
220,
220,
220,
220,
5145,
3398,
62,
27082,
2390,
2767,
4877,
2099,
7946,
2640,
62,
27082,
2390,
2767,
4877,
62,
49,
764,
198,
220,
5050,
7788,
15490,
62,
49273,
50,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
1268,
10234,
30910,
9419,
2099,
1006,
284,
7852,
62,
6242,
2969,
62,
1268,
10234,
30910,
9419,
198,
220,
220,
220,
220,
220,
5145,
31631,
20608,
2099,
7946,
4503,
6561,
20608,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
7397,
2099,
311,
16309,
10526,
7397,
198,
220,
220,
220,
220,
220,
5145,
13252,
2394,
45,
16820,
2099,
1006,
284,
16876,
62,
10426,
5805,
62,
36,
2538,
10979,
764,
198,
220,
5050,
7788,
15490,
62,
20114,
15365,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
31631,
20373,
2099,
7946,
4503,
6561,
20373,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
7397,
2099,
311,
16309,
10526,
7397,
198,
220,
220,
220,
220,
220,
5145,
13252,
2394,
45,
16820,
2099,
1006,
284,
16876,
62,
10426,
5805,
62,
36,
2538,
10979,
764,
198,
220,
5050,
7788,
15490,
62,
1404,
5446,
9865,
3843,
1546,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
1268,
10234,
30910,
9419,
2099,
1006,
284,
7852,
62,
6242,
2969,
62,
1268,
10234,
30910,
9419,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
7397,
2099,
311,
16309,
10526,
7397,
198,
220,
220,
220,
220,
220,
5145,
13252,
2394,
45,
16820,
2099,
1006,
284,
16876,
62,
10426,
5805,
62,
36,
2538,
10979,
764,
198,
220,
5050,
7788,
15490,
62,
9936,
47,
1546,
198,
220,
220,
220,
33332,
198,
220,
220,
220,
220,
220,
5145,
31631,
20373,
2099,
7946,
4503,
6561,
20373,
198,
220,
220,
220,
5609,
198,
220,
220,
220,
220,
220,
5145,
7397,
2099,
311,
16309,
10526,
7397,
198,
220,
220,
220,
220,
220,
5145,
13252,
2394,
45,
16820,
2099,
1006,
284,
16876,
62,
10426,
5805,
62,
36,
2538,
10979,
764,
198,
220,
5050,
7788,
15490,
62,
9936,
47,
7156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,
1,
1
] |
REPORT zdemo_excel37.
DATA: excel TYPE REF TO zcl_excel,
reader TYPE REF TO zif_excel_reader,
go_error TYPE REF TO cx_root,
gv_memid_gr8 TYPE text255,
gv_message TYPE string,
lv_extension TYPE string,
gv_error_program_name TYPE syrepid,
gv_error_include_name TYPE syrepid,
gv_error_line TYPE i.
DATA: gc_save_file_name TYPE string VALUE '37- Read template and output.&'.
SELECTION-SCREEN BEGIN OF BLOCK blx WITH FRAME.
PARAMETERS: p_upfile TYPE string LOWER CASE MEMORY ID gr8.
PARAMETERS: p_applse AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK blx.
INCLUDE zdemo_excel_outputopt_incl.
SELECTION-SCREEN BEGIN OF BLOCK cls WITH FRAME TITLE TEXT-cls.
PARAMETERS: lb_read TYPE seoclsname AS LISTBOX VISIBLE LENGTH 40 LOWER CASE OBLIGATORY DEFAULT 'Autodetect'(001).
PARAMETERS: lb_write TYPE seoclsname AS LISTBOX VISIBLE LENGTH 40 LOWER CASE OBLIGATORY DEFAULT 'Autodetect'(001).
SELECTION-SCREEN END OF BLOCK cls.
SELECTION-SCREEN BEGIN OF BLOCK bl_err WITH FRAME TITLE TEXT-err.
PARAMETERS: cb_errl AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: cb_dump AS CHECKBOX DEFAULT space.
SELECTION-SCREEN COMMENT (60) cmt_dump FOR FIELD cb_dump.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK bl_err.
INITIALIZATION.
PERFORM setup_listboxes.
cmt_dump = TEXT-dum.
GET PARAMETER ID 'GR8' FIELD gv_memid_gr8.
p_upfile = gv_memid_gr8.
IF p_upfile IS INITIAL.
p_upfile = 'c:\temp\whatever.xlsx'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_upfile.
PERFORM f4_p_upfile CHANGING p_upfile.
START-OF-SELECTION.
IF cb_dump IS INITIAL.
TRY.
PERFORM read_template.
PERFORM write_template.
*** Create output
CATCH cx_root INTO go_error.
MESSAGE 'Error reading excelfile' TYPE 'I'.
gv_message = go_error->get_text( ).
IF cb_errl = ' '.
IF gv_message IS NOT INITIAL.
MESSAGE gv_message TYPE 'I'.
ENDIF.
ELSE.
go_error->get_source_position( IMPORTING program_name = gv_error_program_name
include_name = gv_error_include_name
source_line = gv_error_line ).
WRITE:/ 'Errormessage:' ,gv_message.
WRITE:/ 'Errorposition:',
AT /10 'Program:' ,gv_error_program_name,
AT /10 'include_name:' ,gv_error_include_name,
AT /10 'source_line:' ,gv_error_line.
ENDIF.
ENDTRY.
ELSE. " This will dump if an error occurs. In some cases the information given in cx_root is not helpful - this will show exactly where the problem is
PERFORM read_template.
PERFORM write_template.
ENDIF.
*&---------------------------------------------------------------------*
*& Form F4_P_UPFILE
*&---------------------------------------------------------------------*
FORM f4_p_upfile CHANGING p_upfile TYPE string.
DATA: lv_repid TYPE syrepid,
lt_fields TYPE dynpread_tabtype,
ls_field LIKE LINE OF lt_fields,
lt_files TYPE filetable,
lv_rc TYPE i,
lv_file_filter TYPE string.
lv_repid = sy-repid.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = lv_repid
dynumb = '1000'
request = 'A'
TABLES
dynpfields = lt_fields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
READ TABLE lt_fields INTO ls_field WITH KEY fieldname = 'P_UPFILE'.
p_upfile = ls_field-fieldvalue.
lv_file_filter = 'Excel Files (*.XLSX;*.XLSM)|*.XLSX;*.XLSM'.
cl_gui_frontend_services=>file_open_dialog( EXPORTING
default_filename = p_upfile
file_filter = lv_file_filter
CHANGING
file_table = lt_files
rc = lv_rc
EXCEPTIONS
OTHERS = 1 ).
READ TABLE lt_files INDEX 1 INTO p_upfile.
ENDFORM. " F4_P_UPFILE
*&---------------------------------------------------------------------*
*& Form SETUP_LISTBOXES
*&---------------------------------------------------------------------*
FORM setup_listboxes .
DATA: lv_id TYPE vrm_id,
lt_values TYPE vrm_values,
lt_implementing_classes TYPE seo_relkeys.
FIELD-SYMBOLS: <ls_implementing_class> LIKE LINE OF lt_implementing_classes,
<ls_value> LIKE LINE OF lt_values.
*--------------------------------------------------------------------*
* Possible READER-Classes
*--------------------------------------------------------------------*
lv_id = 'LB_READ'.
APPEND INITIAL LINE TO lt_values ASSIGNING <ls_value>.
<ls_value>-key = 'Autodetect'(001).
<ls_value>-text = 'Autodetect'(001).
PERFORM get_implementing_classds USING 'ZIF_EXCEL_READER'
CHANGING lt_implementing_classes.
CLEAR lt_values.
LOOP AT lt_implementing_classes ASSIGNING <ls_implementing_class>.
APPEND INITIAL LINE TO lt_values ASSIGNING <ls_value>.
<ls_value>-key = <ls_implementing_class>-clsname.
<ls_value>-text = <ls_implementing_class>-clsname.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = lv_id
values = lt_values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
*--------------------------------------------------------------------*
* Possible WRITER-Classes
*--------------------------------------------------------------------*
lv_id = 'LB_WRITE'.
APPEND INITIAL LINE TO lt_values ASSIGNING <ls_value>.
<ls_value>-key = 'Autodetect'(001).
<ls_value>-text = 'Autodetect'(001).
PERFORM get_implementing_classds USING 'ZIF_EXCEL_WRITER'
CHANGING lt_implementing_classes.
CLEAR lt_values.
LOOP AT lt_implementing_classes ASSIGNING <ls_implementing_class>.
APPEND INITIAL LINE TO lt_values ASSIGNING <ls_value>.
<ls_value>-key = <ls_implementing_class>-clsname.
<ls_value>-text = <ls_implementing_class>-clsname.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = lv_id
values = lt_values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
ENDFORM. " SETUP_LISTBOXES
*&---------------------------------------------------------------------*
*& Form GET_IMPLEMENTING_CLASSDS
*&---------------------------------------------------------------------*
FORM get_implementing_classds USING iv_interface_name TYPE clike
CHANGING ct_implementing_classes TYPE seo_relkeys.
DATA: lo_oo_interface TYPE REF TO cl_oo_interface,
lo_oo_class TYPE REF TO cl_oo_class,
lt_implementing_subclasses TYPE seo_relkeys.
FIELD-SYMBOLS: <ls_implementing_class> LIKE LINE OF ct_implementing_classes.
TRY.
lo_oo_interface ?= cl_oo_interface=>get_instance( iv_interface_name ).
CATCH cx_class_not_existent.
RETURN.
ENDTRY.
ct_implementing_classes = lo_oo_interface->get_implementing_classes( ).
LOOP AT ct_implementing_classes ASSIGNING <ls_implementing_class>.
TRY.
lo_oo_class ?= cl_oo_class=>get_instance( <ls_implementing_class>-clsname ).
lt_implementing_subclasses = lo_oo_class->get_subclasses( ).
APPEND LINES OF lt_implementing_subclasses TO ct_implementing_classes.
CATCH cx_class_not_existent.
ENDTRY.
ENDLOOP.
ENDFORM. " GET_IMPLEMENTING_CLASSDS
*&---------------------------------------------------------------------*
*& Form READ_TEMPLATE
*&---------------------------------------------------------------------*
FORM read_template RAISING zcx_excel .
CASE lb_read.
WHEN 'Autodetect'(001).
FIND REGEX '(\.xlsx|\.xlsm)\s*$' IN p_upfile SUBMATCHES lv_extension.
TRANSLATE lv_extension TO UPPER CASE.
CASE lv_extension.
WHEN '.XLSX'.
CREATE OBJECT reader TYPE zcl_excel_reader_2007.
excel = reader->load_file( i_filename = p_upfile i_from_applserver = p_applse ).
"Use template for charts
excel->use_template = abap_true.
WHEN '.XLSM'.
CREATE OBJECT reader TYPE zcl_excel_reader_xlsm.
excel = reader->load_file( i_filename = p_upfile i_from_applserver = p_applse ).
"Use template for charts
excel->use_template = abap_true.
WHEN OTHERS.
MESSAGE 'Unsupported filetype' TYPE 'I'.
RETURN.
ENDCASE.
WHEN OTHERS.
CREATE OBJECT reader TYPE (lb_read).
excel = reader->load_file( i_filename = p_upfile i_from_applserver = p_applse ).
"Use template for charts
excel->use_template = abap_true.
ENDCASE.
ENDFORM. " READ_TEMPLATE
*&---------------------------------------------------------------------*
*& Form WRITE_TEMPLATE
*&---------------------------------------------------------------------*
FORM write_template RAISING zcx_excel.
CASE lb_write.
WHEN 'Autodetect'(001).
FIND REGEX '(\.xlsx|\.xlsm)\s*$' IN p_upfile SUBMATCHES lv_extension.
TRANSLATE lv_extension TO UPPER CASE.
CASE lv_extension.
WHEN '.XLSX'.
REPLACE '&' IN gc_save_file_name WITH 'xlsx'. " Pass extension for standard writer
lcl_output=>output( excel ).
WHEN '.XLSM'.
REPLACE '&' IN gc_save_file_name WITH 'xlsm'. " Pass extension for macro-writer
lcl_output=>output( cl_excel = excel
iv_writerclass_name = 'ZCL_EXCEL_WRITER_XLSM' ).
WHEN OTHERS.
MESSAGE 'Unsupported filetype' TYPE 'I'.
RETURN.
ENDCASE.
WHEN OTHERS.
lcl_output=>output( cl_excel = excel
iv_writerclass_name = lb_write ).
ENDCASE.
ENDFORM. " WRITE_TEMPLATE
| [
2200,
15490,
1976,
9536,
78,
62,
1069,
5276,
2718,
13,
198,
198,
26947,
25,
27336,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
1069,
5276,
11,
198,
220,
220,
220,
220,
220,
9173,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
361,
62,
1069,
5276,
62,
46862,
11,
198,
220,
220,
220,
220,
220,
467,
62,
18224,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
43213,
62,
15763,
11,
198,
220,
220,
220,
220,
220,
308,
85,
62,
11883,
312,
62,
2164,
23,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
2420,
13381,
11,
198,
220,
220,
220,
220,
220,
308,
85,
62,
20500,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
300,
85,
62,
2302,
3004,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
308,
85,
62,
18224,
62,
23065,
62,
3672,
41876,
827,
7856,
312,
11,
198,
220,
220,
220,
220,
220,
308,
85,
62,
18224,
62,
17256,
62,
3672,
41876,
827,
7856,
312,
11,
198,
220,
220,
220,
220,
220,
308,
85,
62,
18224,
62,
1370,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
13,
198,
198,
26947,
25,
308,
66,
62,
21928,
62,
7753,
62,
3672,
41876,
4731,
26173,
8924,
705,
2718,
12,
4149,
11055,
290,
5072,
13,
5,
4458,
198,
198,
46506,
2849,
12,
6173,
2200,
1677,
347,
43312,
3963,
9878,
11290,
698,
87,
13315,
8782,
10067,
13,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
929,
7753,
41876,
4731,
406,
36048,
42001,
35153,
15513,
4522,
1036,
23,
13,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
1324,
75,
325,
7054,
5870,
25171,
39758,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
23578,
3963,
9878,
11290,
698,
87,
13,
198,
198,
1268,
5097,
52,
7206,
1976,
9536,
78,
62,
1069,
5276,
62,
22915,
8738,
62,
259,
565,
13,
198,
198,
46506,
2849,
12,
6173,
2200,
1677,
347,
43312,
3963,
9878,
11290,
537,
82,
13315,
8782,
10067,
37977,
2538,
40383,
12,
565,
82,
13,
198,
27082,
2390,
2767,
4877,
25,
18360,
62,
961,
220,
220,
41876,
384,
420,
7278,
3672,
7054,
39498,
39758,
50035,
34563,
406,
49494,
2319,
406,
36048,
42001,
440,
9148,
3528,
1404,
15513,
5550,
38865,
705,
16541,
375,
316,
478,
6,
7,
8298,
737,
198,
27082,
2390,
2767,
4877,
25,
18360,
62,
13564,
220,
41876,
384,
420,
7278,
3672,
7054,
39498,
39758,
50035,
34563,
406,
49494,
2319,
406,
36048,
42001,
440,
9148,
3528,
1404,
15513,
5550,
38865,
705,
16541,
375,
316,
478,
6,
7,
8298,
737,
198,
46506,
2849,
12,
6173,
2200,
1677,
23578,
3963,
9878,
11290,
537,
82,
13,
198,
198,
46506,
2849,
12,
6173,
2200,
1677,
347,
43312,
3963,
9878,
11290,
698,
62,
8056,
13315,
8782,
10067,
37977,
2538,
40383,
12,
8056,
13,
198,
27082,
2390,
2767,
4877,
25,
269,
65,
62,
8056,
75,
7054,
5870,
25171,
39758,
5550,
38865,
705,
55,
4458,
198,
46506,
2849,
12,
6173,
2200,
1677,
347,
43312,
3963,
48920,
13,
198,
27082,
2390,
2767,
4877,
25,
269,
65,
62,
39455,
7054,
5870,
25171,
39758,
5550,
38865,
2272,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
9440,
10979,
357,
1899,
8,
12067,
83,
62,
39455,
7473,
18930,
24639,
269,
65,
62,
39455,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
23578,
3963,
48920,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
23578,
3963,
9878,
11290,
698,
62,
8056,
13,
198,
198,
1268,
2043,
12576,
14887,
6234,
13,
198,
220,
19878,
21389,
9058,
62,
4868,
29305,
13,
198,
220,
12067,
83,
62,
39455,
796,
40383,
12,
67,
388,
13,
198,
220,
17151,
29463,
2390,
2767,
1137,
4522,
705,
10761,
23,
6,
18930,
24639,
308,
85,
62,
11883,
312,
62,
2164,
23,
13,
198,
220,
279,
62,
929,
7753,
796,
308,
85,
62,
11883,
312,
62,
2164,
23,
13,
628,
220,
16876,
279,
62,
929,
7753,
3180,
3268,
2043,
12576,
13,
198,
220,
220,
220,
279,
62,
929,
7753,
796,
705,
66,
7479,
29510,
59,
39664,
13,
87,
7278,
87,
4458,
198,
220,
23578,
5064,
13,
198,
198,
1404,
33493,
2849,
12,
6173,
2200,
1677,
6177,
26173,
8924,
12,
2200,
35780,
7473,
279,
62,
929,
7753,
13,
198,
220,
19878,
21389,
277,
19,
62,
79,
62,
929,
7753,
5870,
15567,
2751,
279,
62,
929,
7753,
13,
628,
198,
2257,
7227,
12,
19238,
12,
46506,
2849,
13,
198,
220,
16876,
269,
65,
62,
39455,
3180,
3268,
2043,
12576,
13,
198,
220,
220,
220,
7579,
56,
13,
198,
220,
220,
220,
220,
220,
220,
220,
19878,
21389,
1100,
62,
28243,
13,
198,
220,
220,
220,
220,
220,
220,
220,
19878,
21389,
3551,
62,
28243,
13,
198,
8162,
13610,
5072,
198,
220,
220,
220,
220,
220,
327,
11417,
43213,
62,
15763,
39319,
467,
62,
18224,
13,
198,
220,
220,
220,
220,
220,
220,
220,
337,
1546,
4090,
8264,
705,
12331,
3555,
43748,
1652,
576,
6,
41876,
705,
40,
4458,
198,
220,
220,
220,
220,
220,
220,
220,
308,
85,
62,
20500,
796,
467,
62,
18224,
3784,
1136,
62,
5239,
7,
6739,
198,
220,
220,
220,
220,
220,
220,
220,
16876,
269,
65,
62,
8056,
75,
796,
705,
45302,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16876,
308,
85,
62,
20500,
3180,
5626,
3268,
2043,
12576,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
1546,
4090,
8264,
308,
85,
62,
20500,
41876,
705,
40,
4458,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
220,
220,
220,
220,
17852,
5188,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
467,
62,
18224,
3784,
1136,
62,
10459,
62,
9150,
7,
30023,
9863,
2751,
1430,
62,
3672,
796,
308,
85,
62,
18224,
62,
23065,
62,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
**********************************************************************
* UTILS
**********************************************************************
CLASS lcl_utils DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS normalize_path
IMPORTING
iv_path TYPE string
RETURNING
VALUE(rv_path) TYPE string.
CLASS-METHODS split_path
IMPORTING
iv_path TYPE string
RETURNING
VALUE(rv_path_name) TYPE zif_abapgit_ajson=>ty_path_name.
CLASS-METHODS validate_array_index
IMPORTING
iv_path TYPE string
iv_index TYPE string
RETURNING
VALUE(rv_index) TYPE i
RAISING
zcx_abapgit_ajson_error.
ENDCLASS.
CLASS lcl_utils IMPLEMENTATION.
METHOD validate_array_index.
IF NOT iv_index CO '0123456789'.
zcx_abapgit_ajson_error=>raise( |Cannot add non-numeric key [{ iv_index }] to array [{ iv_path }]| ).
ENDIF.
rv_index = iv_index.
IF rv_index = 0.
zcx_abapgit_ajson_error=>raise( |Cannot add zero key to array [{ iv_path }]| ).
ENDIF.
ENDMETHOD.
METHOD normalize_path.
rv_path = iv_path.
IF strlen( rv_path ) = 0.
rv_path = '/'.
ENDIF.
IF rv_path+0(1) <> '/'.
rv_path = '/' && rv_path.
ENDIF.
IF substring( val = rv_path
off = strlen( rv_path ) - 1 ) <> '/'.
rv_path = rv_path && '/'.
ENDIF.
ENDMETHOD.
METHOD split_path.
DATA lv_offs TYPE i.
DATA lv_len TYPE i.
DATA lv_trim_slash TYPE i.
lv_len = strlen( iv_path ).
IF lv_len = 0 OR iv_path = '/'.
RETURN. " empty path is the alias for root item = '' + ''
ENDIF.
IF substring( val = iv_path
off = lv_len - 1 ) = '/'.
lv_trim_slash = 1. " ignore last '/'
ENDIF.
lv_offs = find( val = reverse( iv_path )
sub = '/'
off = lv_trim_slash ).
IF lv_offs = -1.
lv_offs = lv_len. " treat whole string as the 'name' part
ENDIF.
lv_offs = lv_len - lv_offs.
rv_path_name-path = normalize_path( substring( val = iv_path
len = lv_offs ) ).
rv_path_name-name = substring( val = iv_path
off = lv_offs
len = lv_len - lv_offs - lv_trim_slash ).
ENDMETHOD.
ENDCLASS.
**********************************************************************
* PARSER
**********************************************************************
CLASS lcl_json_parser DEFINITION FINAL.
PUBLIC SECTION.
METHODS parse
IMPORTING
iv_json TYPE string
RETURNING
VALUE(rt_json_tree) TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
PRIVATE SECTION.
TYPES:
ty_stack_tt TYPE STANDARD TABLE OF REF TO zif_abapgit_ajson=>ty_node.
DATA mt_stack TYPE ty_stack_tt.
CLASS-METHODS join_path
IMPORTING
it_stack TYPE ty_stack_tt
RETURNING
VALUE(rv_path) TYPE string.
METHODS raise
IMPORTING
iv_error TYPE string
RAISING
zcx_abapgit_ajson_error.
METHODS _parse
IMPORTING
iv_json TYPE string
RETURNING
VALUE(rt_json_tree) TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error cx_sxml_error.
METHODS _get_location
IMPORTING
iv_json TYPE string
iv_offset TYPE i
RETURNING
VALUE(rv_location) TYPE string.
ENDCLASS.
CLASS lcl_json_parser IMPLEMENTATION.
METHOD parse.
DATA lx_sxml_parse TYPE REF TO cx_sxml_parse_error.
DATA lx_sxml TYPE REF TO cx_sxml_error.
DATA lv_location TYPE string.
TRY.
rt_json_tree = _parse( iv_json ).
CATCH cx_sxml_parse_error INTO lx_sxml_parse.
lv_location = _get_location(
iv_json = iv_json
iv_offset = lx_sxml_parse->xml_offset ).
zcx_abapgit_ajson_error=>raise(
iv_msg = |Json parsing error (SXML): { lx_sxml_parse->get_text( ) }|
iv_location = lv_location ).
CATCH cx_sxml_error INTO lx_sxml.
zcx_abapgit_ajson_error=>raise(
iv_msg = |Json parsing error (SXML): { lx_sxml->get_text( ) }|
iv_location = '@PARSER' ).
ENDTRY.
ENDMETHOD.
METHOD _get_location.
DATA lv_json TYPE string.
DATA lv_offset TYPE i.
DATA lt_text TYPE TABLE OF string.
DATA lv_text TYPE string.
DATA lv_line TYPE i.
DATA lv_pos TYPE i.
lv_offset = iv_offset.
IF lv_offset < 0.
lv_offset = 0.
ENDIF.
IF lv_offset > strlen( iv_json ).
lv_offset = strlen( iv_json ).
ENDIF.
lv_json = iv_json(lv_offset).
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf
IN lv_json WITH cl_abap_char_utilities=>newline.
SPLIT lv_json AT cl_abap_char_utilities=>newline INTO TABLE lt_text.
lv_line = lines( lt_text ).
IF lv_line = 0.
lv_line = 1.
lv_pos = 1.
ELSE.
READ TABLE lt_text INDEX lv_line INTO lv_text.
lv_pos = strlen( lv_text ) + 1.
ENDIF.
rv_location = |Line { lv_line }, Offset { lv_pos }|.
ENDMETHOD.
METHOD _parse.
DATA lo_reader TYPE REF TO if_sxml_reader.
DATA lr_stack_top LIKE LINE OF mt_stack.
DATA lo_node TYPE REF TO if_sxml_node.
FIELD-SYMBOLS <item> LIKE LINE OF rt_json_tree.
CLEAR mt_stack.
IF iv_json IS INITIAL.
RETURN.
ENDIF.
lo_reader = cl_sxml_string_reader=>create( cl_abap_codepage=>convert_to( iv_json ) ).
" TODO: self protection, check non-empty, check starting from object ...
DO.
lo_node = lo_reader->read_next_node( ).
IF lo_node IS NOT BOUND.
EXIT.
ENDIF.
CASE lo_node->type.
WHEN if_sxml_node=>co_nt_element_open.
DATA lt_attributes TYPE if_sxml_attribute=>attributes.
DATA lo_attr LIKE LINE OF lt_attributes.
DATA lo_open TYPE REF TO if_sxml_open_element.
lo_open ?= lo_node.
APPEND INITIAL LINE TO rt_json_tree ASSIGNING <item>.
<item>-type = to_lower( lo_open->qname-name ).
READ TABLE mt_stack INDEX 1 INTO lr_stack_top.
IF sy-subrc = 0.
<item>-path = join_path( mt_stack ).
lr_stack_top->children = lr_stack_top->children + 1.
IF lr_stack_top->type = 'array'.
<item>-name = |{ lr_stack_top->children }|.
<item>-index = lr_stack_top->children.
ELSE.
lt_attributes = lo_open->get_attributes( ).
LOOP AT lt_attributes INTO lo_attr.
IF lo_attr->qname-name = 'name' AND lo_attr->value_type = if_sxml_value=>co_vt_text.
<item>-name = lo_attr->get_value( ).
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
GET REFERENCE OF <item> INTO lr_stack_top.
INSERT lr_stack_top INTO mt_stack INDEX 1.
WHEN if_sxml_node=>co_nt_element_close.
DATA lo_close TYPE REF TO if_sxml_close_element.
lo_close ?= lo_node.
READ TABLE mt_stack INDEX 1 INTO lr_stack_top.
DELETE mt_stack INDEX 1.
IF lo_close->qname-name <> lr_stack_top->type.
raise( 'Unexpected closing node type' ).
ENDIF.
WHEN if_sxml_node=>co_nt_value.
DATA lo_value TYPE REF TO if_sxml_value_node.
lo_value ?= lo_node.
<item>-value = lo_value->get_value( ).
WHEN OTHERS.
raise( 'Unexpected node type' ).
ENDCASE.
ENDDO.
IF lines( mt_stack ) > 0.
raise( 'Unexpected end of data' ).
ENDIF.
ENDMETHOD.
METHOD join_path.
FIELD-SYMBOLS <ref> LIKE LINE OF it_stack.
LOOP AT it_stack ASSIGNING <ref>.
rv_path = <ref>->name && '/' && rv_path.
ENDLOOP.
ENDMETHOD.
METHOD raise.
zcx_abapgit_ajson_error=>raise(
iv_location = join_path( mt_stack )
iv_msg = |JSON PARSER: { iv_error } @ { join_path( mt_stack ) }| ).
ENDMETHOD.
ENDCLASS.
**********************************************************************
* SERIALIZER
**********************************************************************
CLASS lcl_json_serializer DEFINITION FINAL CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS stringify
IMPORTING
it_json_tree TYPE zif_abapgit_ajson=>ty_nodes_ts
iv_indent TYPE i DEFAULT 0
iv_keep_item_order TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(rv_json_string) TYPE string
RAISING
zcx_abapgit_ajson_error.
CLASS-METHODS class_constructor.
PRIVATE SECTION.
CLASS-DATA gv_comma_with_lf TYPE string.
DATA mt_json_tree TYPE zif_abapgit_ajson=>ty_nodes_ts.
DATA mv_keep_item_order TYPE abap_bool.
DATA mt_buffer TYPE string_table.
DATA mv_indent_step TYPE i.
DATA mv_level TYPE i.
CLASS-METHODS escape
IMPORTING
iv_unescaped TYPE string
RETURNING
VALUE(rv_escaped) TYPE string.
METHODS _stringify
RETURNING
VALUE(rv_json_string) TYPE string
RAISING
zcx_abapgit_ajson_error.
METHODS stringify_node
IMPORTING
is_node TYPE zif_abapgit_ajson=>ty_node
RAISING
zcx_abapgit_ajson_error.
METHODS stringify_set
IMPORTING
iv_parent_path TYPE string
iv_array TYPE abap_bool
RAISING
zcx_abapgit_ajson_error.
ENDCLASS.
CLASS lcl_json_serializer IMPLEMENTATION.
METHOD class_constructor.
gv_comma_with_lf = ',' && cl_abap_char_utilities=>newline.
ENDMETHOD.
METHOD stringify.
DATA lo TYPE REF TO lcl_json_serializer.
CREATE OBJECT lo.
lo->mt_json_tree = it_json_tree.
lo->mv_indent_step = iv_indent.
lo->mv_keep_item_order = iv_keep_item_order.
rv_json_string = lo->_stringify( ).
ENDMETHOD.
METHOD _stringify.
FIELD-SYMBOLS <n> LIKE LINE OF mt_json_tree.
READ TABLE mt_json_tree ASSIGNING <n>
WITH KEY
path = ''
name = ''. " Root
IF sy-subrc <> 0.
RETURN.
ENDIF.
stringify_node( <n> ).
rv_json_string = concat_lines_of( table = mt_buffer ).
ENDMETHOD.
METHOD stringify_node.
DATA lv_item TYPE string.
DATA lv_indent_prefix TYPE string.
IF mv_indent_step > 0.
lv_indent_prefix = repeat( val = ` `
occ = mv_indent_step * mv_level ).
lv_item = lv_indent_prefix.
ENDIF.
IF is_node-name IS NOT INITIAL AND is_node-index IS INITIAL. " Not root, not array item
IF mv_indent_step > 0.
lv_item = lv_item && |"{ is_node-name }": |.
ELSE.
lv_item = |"{ is_node-name }":|.
ENDIF.
ENDIF.
CASE is_node-type.
WHEN zif_abapgit_ajson=>node_type-array.
lv_item = lv_item && '['.
WHEN zif_abapgit_ajson=>node_type-object.
lv_item = lv_item && '{'.
WHEN zif_abapgit_ajson=>node_type-string.
lv_item = lv_item && |"{ escape( is_node-value ) }"|.
WHEN zif_abapgit_ajson=>node_type-boolean OR zif_abapgit_ajson=>node_type-number.
lv_item = lv_item && is_node-value.
WHEN zif_abapgit_ajson=>node_type-null.
lv_item = lv_item && 'null'.
WHEN OTHERS.
zcx_abapgit_ajson_error=>raise(
iv_msg = |Unexpected type [{ is_node-type }]|
iv_location = is_node-path && is_node-name ).
ENDCASE.
IF mv_indent_step > 0
AND ( is_node-type = zif_abapgit_ajson=>node_type-array OR is_node-type = zif_abapgit_ajson=>node_type-object )
AND is_node-children > 0.
mv_level = mv_level + 1.
lv_item = lv_item && cl_abap_char_utilities=>newline.
ENDIF.
APPEND lv_item TO mt_buffer.
" finish complex item
IF is_node-type = zif_abapgit_ajson=>node_type-array OR is_node-type = zif_abapgit_ajson=>node_type-object.
DATA lv_children_path TYPE string.
DATA lv_tail TYPE string.
lv_children_path = is_node-path && is_node-name && '/'. " for root: path = '' and name = '', so result is '/'
CASE is_node-type.
WHEN zif_abapgit_ajson=>node_type-array.
IF is_node-children > 0.
stringify_set(
iv_parent_path = lv_children_path
iv_array = abap_true ).
ENDIF.
lv_tail = ']'.
WHEN zif_abapgit_ajson=>node_type-object.
IF is_node-children > 0.
stringify_set(
iv_parent_path = lv_children_path
iv_array = abap_false ).
ENDIF.
lv_tail = '}'.
ENDCASE.
IF mv_indent_step > 0 AND is_node-children > 0.
lv_tail = lv_indent_prefix && lv_tail.
mv_level = mv_level - 1.
ENDIF.
APPEND lv_tail TO mt_buffer.
ENDIF.
ENDMETHOD.
METHOD stringify_set.
DATA lv_tab_key TYPE string.
DATA lv_first_done TYPE abap_bool.
FIELD-SYMBOLS <n> LIKE LINE OF mt_json_tree.
IF iv_array = abap_true.
lv_tab_key = 'array_index'. " path + index
ELSEIF mv_keep_item_order = abap_true.
lv_tab_key = 'item_order'. " path + order
ELSE.
lv_tab_key = 'primary_key'. " path + name
ENDIF.
LOOP AT mt_json_tree ASSIGNING <n> USING KEY (lv_tab_key) WHERE path = iv_parent_path.
IF lv_first_done = abap_false.
lv_first_done = abap_true.
ELSEIF mv_indent_step > 0.
APPEND gv_comma_with_lf TO mt_buffer.
ELSE.
APPEND ',' TO mt_buffer.
ENDIF.
stringify_node( <n> ).
ENDLOOP.
IF mv_indent_step > 0 AND lv_first_done = abap_true. " only of items were in the list
APPEND cl_abap_char_utilities=>newline TO mt_buffer.
ENDIF.
ENDMETHOD.
METHOD escape.
rv_escaped = iv_unescaped.
IF rv_escaped CA |"\\\t\n\r|.
" TODO consider performance ...
" see also https://www.json.org/json-en.html
rv_escaped = replace(
val = rv_escaped
sub = '\'
with = '\\'
occ = 0 ).
rv_escaped = replace(
val = rv_escaped
sub = |\n|
with = '\n'
occ = 0 ).
rv_escaped = replace(
val = rv_escaped
sub = |\r|
with = '\r'
occ = 0 ).
rv_escaped = replace(
val = rv_escaped
sub = |\t|
with = '\t'
occ = 0 ).
rv_escaped = replace(
val = rv_escaped
sub = '"'
with = '\"'
occ = 0 ).
ENDIF.
ENDMETHOD.
ENDCLASS.
**********************************************************************
* JSON_TO_ABAP
**********************************************************************
CLASS lcl_json_to_abap DEFINITION FINAL.
PUBLIC SECTION.
METHODS constructor
IMPORTING
!ii_custom_mapping TYPE REF TO zif_abapgit_ajson_mapping OPTIONAL.
METHODS to_abap
IMPORTING
it_nodes TYPE zif_abapgit_ajson=>ty_nodes_ts
CHANGING
c_container TYPE any
RAISING
zcx_abapgit_ajson_error.
METHODS to_timestamp
IMPORTING
iv_value TYPE zif_abapgit_ajson=>ty_node-value
RETURNING
VALUE(rv_result) TYPE timestamp
RAISING
zcx_abapgit_ajson_error.
METHODS to_date
IMPORTING
iv_value TYPE zif_abapgit_ajson=>ty_node-value
RETURNING
VALUE(rv_result) TYPE d
RAISING
zcx_abapgit_ajson_error.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_type_cache,
type_path TYPE string,
target_field_name TYPE string,
dd TYPE REF TO cl_abap_datadescr,
type_kind LIKE cl_abap_typedescr=>typekind_any,
tab_item_buf TYPE REF TO data,
END OF ty_type_cache.
DATA mt_node_type_cache TYPE HASHED TABLE OF ty_type_cache WITH UNIQUE KEY type_path.
DATA mr_nodes TYPE REF TO zif_abapgit_ajson=>ty_nodes_ts.
DATA mi_custom_mapping TYPE REF TO zif_abapgit_ajson_mapping.
METHODS any_to_abap
IMPORTING
iv_path TYPE string
is_parent_type TYPE ty_type_cache OPTIONAL
i_container_ref TYPE REF TO data
RAISING
zcx_abapgit_ajson_error.
METHODS value_to_abap
IMPORTING
is_node TYPE zif_abapgit_ajson=>ty_node
is_node_type TYPE ty_type_cache
i_container_ref TYPE REF TO data
RAISING
zcx_abapgit_ajson_error
cx_sy_conversion_no_number.
METHODS get_node_type
IMPORTING
is_node TYPE zif_abapgit_ajson=>ty_node OPTIONAL " Empty for root
is_parent_type TYPE ty_type_cache OPTIONAL
i_container_ref TYPE REF TO data OPTIONAL
RETURNING
VALUE(rs_node_type) TYPE ty_type_cache
RAISING
zcx_abapgit_ajson_error.
ENDCLASS.
CLASS lcl_json_to_abap IMPLEMENTATION.
METHOD constructor.
mi_custom_mapping = ii_custom_mapping.
ENDMETHOD.
METHOD to_abap.
DATA lr_ref TYPE REF TO data.
CLEAR c_container. " what about data/obj refs ?
CLEAR mt_node_type_cache.
GET REFERENCE OF c_container INTO lr_ref.
GET REFERENCE OF it_nodes INTO mr_nodes.
get_node_type( i_container_ref = lr_ref ). " Pre-cache root node type
any_to_abap(
iv_path = ''
i_container_ref = lr_ref ).
ENDMETHOD.
METHOD get_node_type.
DATA lv_node_type_path TYPE string.
DATA lo_sdescr TYPE REF TO cl_abap_structdescr.
DATA lo_tdescr TYPE REF TO cl_abap_tabledescr.
DATA lo_ddescr TYPE REF TO cl_abap_datadescr.
" Calculate type path
IF is_parent_type-type_kind = cl_abap_typedescr=>typekind_table.
lv_node_type_path = is_parent_type-type_path && '/-'. " table item type
ELSEIF is_parent_type-type_kind IS NOT INITIAL.
lv_node_type_path = is_parent_type-type_path && '/' && is_node-name.
ENDIF. " For root node lv_node_type_path remains ''
" Get or create cached
READ TABLE mt_node_type_cache INTO rs_node_type WITH KEY type_path = lv_node_type_path.
IF sy-subrc <> 0.
rs_node_type-type_path = lv_node_type_path.
IF mi_custom_mapping IS BOUND.
rs_node_type-target_field_name = to_upper( mi_custom_mapping->to_abap(
iv_path = is_node-path
iv_name = is_node-name ) ).
IF rs_node_type-target_field_name IS INITIAL.
rs_node_type-target_field_name = to_upper( is_node-name ).
ENDIF.
ELSE.
rs_node_type-target_field_name = to_upper( is_node-name ).
ENDIF.
CASE is_parent_type-type_kind.
WHEN 'h'. " Table
lo_tdescr ?= is_parent_type-dd.
rs_node_type-dd = lo_tdescr->get_table_line_type( ).
WHEN 'u' OR 'v'. " Structure
lo_sdescr ?= is_parent_type-dd.
lo_sdescr->get_component_type(
EXPORTING
p_name = rs_node_type-target_field_name
RECEIVING
p_descr_ref = rs_node_type-dd
EXCEPTIONS
component_not_found = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_ajson_error=>raise( |Path not found| ).
ENDIF.
WHEN ''. " Root node
rs_node_type-dd ?= cl_abap_typedescr=>describe_by_data_ref( i_container_ref ).
WHEN OTHERS.
zcx_abapgit_ajson_error=>raise( |Unexpected parent type| ).
ENDCASE.
rs_node_type-type_kind = rs_node_type-dd->type_kind. " for caching and cleaner unintialized access
IF rs_node_type-type_kind = 'h'. " Table
lo_tdescr ?= rs_node_type-dd.
IF lo_tdescr->table_kind <> 'S'. " standard
lo_ddescr = lo_tdescr->get_table_line_type( ).
CREATE DATA rs_node_type-tab_item_buf TYPE HANDLE lo_ddescr.
ENDIF.
ENDIF.
INSERT rs_node_type INTO TABLE mt_node_type_cache.
ENDIF.
ENDMETHOD.
METHOD any_to_abap.
DATA ls_node_type LIKE LINE OF mt_node_type_cache.
DATA lx_ajson TYPE REF TO zcx_abapgit_ajson_error.
DATA lx_root TYPE REF TO cx_root.
DATA lr_target_field TYPE REF TO data.
FIELD-SYMBOLS <n> TYPE zif_abapgit_ajson=>ty_node.
FIELD-SYMBOLS <parent_stdtab> TYPE STANDARD TABLE.
FIELD-SYMBOLS <parent_anytab> TYPE ANY TABLE.
FIELD-SYMBOLS <parent_struc> TYPE any.
FIELD-SYMBOLS <tab_item> TYPE any.
" Assign container
CASE is_parent_type-type_kind.
WHEN 'h'. " Table
IF is_parent_type-tab_item_buf IS BOUND. " Indirect hint that table was sorted/hashed, see get_node_type.
ASSIGN i_container_ref->* TO <parent_anytab>.
ASSERT sy-subrc = 0.
lr_target_field = is_parent_type-tab_item_buf. " For hashed/sorted table - same buffer for all children
ASSIGN is_parent_type-tab_item_buf->* TO <tab_item>.
ASSERT sy-subrc = 0.
ELSE.
ASSIGN i_container_ref->* TO <parent_stdtab>.
ASSERT sy-subrc = 0.
ENDIF.
WHEN 'u' OR 'v'. " Structure
ASSIGN i_container_ref->* TO <parent_struc>.
ASSERT sy-subrc = 0.
ENDCASE.
TRY.
" array_index because stringified index goes in wrong order [1, 10, 2 ...]
LOOP AT mr_nodes->* ASSIGNING <n> USING KEY array_index WHERE path = iv_path.
" Get or create type cache record
IF is_parent_type-type_kind <> 'h' OR ls_node_type-type_kind IS INITIAL.
" table records are the same, no need to refetch twice
ls_node_type = get_node_type(
is_node = <n>
is_parent_type = is_parent_type ).
ENDIF.
" Validate node type
IF ls_node_type-type_kind CA 'lr'. " data/obj ref
" TODO maybe in future
zcx_abapgit_ajson_error=>raise( 'Cannot assign to ref' ).
ENDIF.
" Find target field reference
CASE is_parent_type-type_kind.
WHEN 'h'. " Table
IF NOT ls_node_type-target_field_name CO '0123456789'.
" Does not affect anything actually but for integrity
zcx_abapgit_ajson_error=>raise( 'Need index to access tables' ).
ENDIF.
IF is_parent_type-tab_item_buf IS NOT BOUND. " Indirect hint that table was srt/hsh, see get_node_type
APPEND INITIAL LINE TO <parent_stdtab> REFERENCE INTO lr_target_field.
ASSERT sy-subrc = 0.
ENDIF.
WHEN 'u' OR 'v'.
FIELD-SYMBOLS <field> TYPE any.
ASSIGN COMPONENT ls_node_type-target_field_name OF STRUCTURE <parent_struc> TO <field>.
ASSERT sy-subrc = 0.
GET REFERENCE OF <field> INTO lr_target_field.
WHEN ''. " Root node
lr_target_field = i_container_ref.
WHEN OTHERS.
zcx_abapgit_ajson_error=>raise( 'Unexpected parent type' ).
ENDCASE.
" Process value assignment
CASE <n>-type.
WHEN zif_abapgit_ajson=>node_type-object.
IF NOT ls_node_type-type_kind CO 'uv'.
zcx_abapgit_ajson_error=>raise( 'Expected structure' ).
ENDIF.
any_to_abap(
iv_path = <n>-path && <n>-name && '/'
is_parent_type = ls_node_type
i_container_ref = lr_target_field ).
WHEN zif_abapgit_ajson=>node_type-array.
IF NOT ls_node_type-type_kind = 'h'.
zcx_abapgit_ajson_error=>raise( 'Expected table' ).
ENDIF.
any_to_abap(
iv_path = <n>-path && <n>-name && '/'
is_parent_type = ls_node_type
i_container_ref = lr_target_field ).
WHEN OTHERS.
value_to_abap(
is_node = <n>
is_node_type = ls_node_type
i_container_ref = lr_target_field ).
ENDCASE.
IF is_parent_type-tab_item_buf IS BOUND. " Indirect hint that table was sorted/hashed, see get_node_type.
TRY.
INSERT <tab_item> INTO TABLE <parent_anytab>.
CATCH cx_sy_itab_duplicate_key.
sy-subrc = 4.
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_ajson_error=>raise( 'Duplicate insertion' ).
ENDIF.
ENDIF.
ENDLOOP.
CATCH zcx_abapgit_ajson_error INTO lx_ajson.
IF lx_ajson->location IS INITIAL.
lx_ajson->set_location( <n>-path && <n>-name ).
ENDIF.
RAISE EXCEPTION lx_ajson.
CATCH cx_sy_conversion_no_number.
zcx_abapgit_ajson_error=>raise(
iv_msg = 'Source is not a number'
iv_location = <n>-path && <n>-name ).
CATCH cx_root INTO lx_root.
zcx_abapgit_ajson_error=>raise(
iv_msg = lx_root->get_text( )
iv_location = <n>-path && <n>-name ).
ENDTRY.
ENDMETHOD.
METHOD value_to_abap.
FIELD-SYMBOLS <container> TYPE any.
IF is_node_type-type_kind CA 'lruvh'. " refs, table, strucs
zcx_abapgit_ajson_error=>raise( |Unsupported target for value [{ is_node_type-type_kind }]| ).
ENDIF.
ASSIGN i_container_ref->* TO <container>.
ASSERT sy-subrc = 0.
CASE is_node-type.
WHEN zif_abapgit_ajson=>node_type-null.
" Do nothing
WHEN zif_abapgit_ajson=>node_type-boolean.
" TODO: check type ?
<container> = boolc( is_node-value = 'true' ).
WHEN zif_abapgit_ajson=>node_type-number.
" TODO: check type ?
<container> = is_node-value.
WHEN zif_abapgit_ajson=>node_type-string.
" TODO: check type ?
IF is_node_type-type_kind = 'D' AND is_node-value IS NOT INITIAL.
<container> = to_date( is_node-value ).
ELSEIF is_node_type-type_kind = 'P' AND is_node-value IS NOT INITIAL.
<container> = to_timestamp( is_node-value ).
ELSE.
<container> = is_node-value.
ENDIF.
WHEN OTHERS.
zcx_abapgit_ajson_error=>raise( |Unexpected JSON type [{ is_node-type }]| ).
ENDCASE.
ENDMETHOD.
METHOD to_date.
DATA lv_y TYPE c LENGTH 4.
DATA lv_m TYPE c LENGTH 2.
DATA lv_d TYPE c LENGTH 2.
FIND FIRST OCCURRENCE OF REGEX '^(\d{4})-(\d{2})-(\d{2})(T|$)'
IN iv_value
SUBMATCHES lv_y lv_m lv_d.
IF sy-subrc <> 0.
zcx_abapgit_ajson_error=>raise( 'Unexpected date format' ).
ENDIF.
CONCATENATE lv_y lv_m lv_d INTO rv_result.
ENDMETHOD.
METHOD to_timestamp.
CONSTANTS lc_utc TYPE c LENGTH 6 VALUE 'UTC'.
CONSTANTS lc_regex_ts_with_hour TYPE string
VALUE `^(\d{4})-(\d{2})-(\d{2})(T)(\d{2}):(\d{2}):(\d{2})(\+)(\d{2}):(\d{2})`.
CONSTANTS lc_regex_ts_utc TYPE string
VALUE `^(\d{4})-(\d{2})-(\d{2})(T)(\d{2}):(\d{2}):(\d{2})(Z|$)`.
DATA:
BEGIN OF ls_timestamp,
year TYPE c LENGTH 4,
month TYPE c LENGTH 2,
day TYPE c LENGTH 2,
t TYPE c LENGTH 1,
hour TYPE c LENGTH 2,
minute TYPE c LENGTH 2,
second TYPE c LENGTH 2,
local_sign TYPE c LENGTH 1,
local_hour TYPE c LENGTH 2,
local_minute TYPE c LENGTH 2,
END OF ls_timestamp.
DATA lv_date TYPE d.
DATA lv_time TYPE t.
DATA lv_seconds_conv TYPE i.
DATA lv_timestamp TYPE timestampl.
FIND FIRST OCCURRENCE OF REGEX lc_regex_ts_with_hour
IN iv_value SUBMATCHES
ls_timestamp-year ls_timestamp-month ls_timestamp-day ls_timestamp-t
ls_timestamp-hour ls_timestamp-minute ls_timestamp-second
ls_timestamp-local_sign ls_timestamp-local_hour ls_timestamp-local_minute.
IF sy-subrc = 0.
lv_seconds_conv = ( ls_timestamp-local_hour * 3600 ) + ( ls_timestamp-local_minute * 60 ).
ELSE.
FIND FIRST OCCURRENCE OF REGEX lc_regex_ts_utc
IN iv_value SUBMATCHES
ls_timestamp-year ls_timestamp-month ls_timestamp-day ls_timestamp-t
ls_timestamp-hour ls_timestamp-minute ls_timestamp-second.
IF sy-subrc <> 0.
zcx_abapgit_ajson_error=>raise( 'Unexpected timestamp format' ).
ENDIF.
ENDIF.
CONCATENATE ls_timestamp-year ls_timestamp-month ls_timestamp-day INTO lv_date.
CONCATENATE ls_timestamp-hour ls_timestamp-minute ls_timestamp-second INTO lv_time.
CONVERT DATE lv_date TIME lv_time INTO TIME STAMP lv_timestamp TIME ZONE lc_utc.
TRY.
CASE ls_timestamp-local_sign.
WHEN '-'.
lv_timestamp = cl_abap_tstmp=>add(
tstmp = lv_timestamp
secs = lv_seconds_conv ).
WHEN '+'.
lv_timestamp = cl_abap_tstmp=>subtractsecs(
tstmp = lv_timestamp
secs = lv_seconds_conv ).
ENDCASE.
CATCH cx_parameter_invalid_range cx_parameter_invalid_type.
zcx_abapgit_ajson_error=>raise( 'Unexpected error calculating timestamp' ).
ENDTRY.
cl_abap_tstmp=>move(
EXPORTING
tstmp_src = lv_timestamp
IMPORTING
tstmp_tgt = rv_result ).
ENDMETHOD.
ENDCLASS.
**********************************************************************
* ABAP_TO_JSON
**********************************************************************
CLASS lcl_abap_to_json DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS convert
IMPORTING
iv_data TYPE any
is_prefix TYPE zif_abapgit_ajson=>ty_path_name OPTIONAL
iv_array_index TYPE i DEFAULT 0
ii_custom_mapping TYPE REF TO zif_abapgit_ajson_mapping OPTIONAL
iv_keep_item_order TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(rt_nodes) TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
CLASS-METHODS insert_with_type
IMPORTING
iv_data TYPE any
iv_type TYPE string
is_prefix TYPE zif_abapgit_ajson=>ty_path_name OPTIONAL
iv_array_index TYPE i DEFAULT 0
ii_custom_mapping TYPE REF TO zif_abapgit_ajson_mapping OPTIONAL
iv_keep_item_order TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(rt_nodes) TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
CLASS-METHODS class_constructor.
PRIVATE SECTION.
CLASS-DATA gv_ajson_absolute_type_name TYPE string.
DATA mi_custom_mapping TYPE REF TO zif_abapgit_ajson_mapping.
DATA mv_keep_item_order TYPE abap_bool.
METHODS convert_any
IMPORTING
iv_data TYPE any
io_type TYPE REF TO cl_abap_typedescr
is_prefix TYPE zif_abapgit_ajson=>ty_path_name
iv_index TYPE i DEFAULT 0
iv_item_order TYPE i DEFAULT 0
CHANGING
ct_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
METHODS convert_ajson
IMPORTING
io_json TYPE REF TO zcl_abapgit_ajson
is_prefix TYPE zif_abapgit_ajson=>ty_path_name
iv_index TYPE i DEFAULT 0
CHANGING
ct_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
METHODS convert_value
IMPORTING
iv_data TYPE any
io_type TYPE REF TO cl_abap_typedescr
is_prefix TYPE zif_abapgit_ajson=>ty_path_name
iv_index TYPE i DEFAULT 0
iv_item_order TYPE i DEFAULT 0
CHANGING
ct_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
METHODS convert_ref
IMPORTING
iv_data TYPE any
is_prefix TYPE zif_abapgit_ajson=>ty_path_name
iv_index TYPE i DEFAULT 0
iv_item_order TYPE i DEFAULT 0
CHANGING
ct_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
METHODS convert_struc
IMPORTING
iv_data TYPE any
io_type TYPE REF TO cl_abap_typedescr
is_prefix TYPE zif_abapgit_ajson=>ty_path_name
iv_index TYPE i DEFAULT 0
iv_item_order TYPE i DEFAULT 0
CHANGING
ct_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt
cs_root TYPE zif_abapgit_ajson=>ty_node OPTIONAL
RAISING
zcx_abapgit_ajson_error.
METHODS convert_table
IMPORTING
iv_data TYPE any
io_type TYPE REF TO cl_abap_typedescr
is_prefix TYPE zif_abapgit_ajson=>ty_path_name
iv_index TYPE i DEFAULT 0
iv_item_order TYPE i DEFAULT 0
CHANGING
ct_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
METHODS insert_value_with_type
IMPORTING
iv_data TYPE any
iv_type TYPE string
io_type TYPE REF TO cl_abap_typedescr
is_prefix TYPE zif_abapgit_ajson=>ty_path_name
iv_index TYPE i DEFAULT 0
iv_item_order TYPE i DEFAULT 0
CHANGING
ct_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt
RAISING
zcx_abapgit_ajson_error.
ENDCLASS.
CLASS lcl_abap_to_json IMPLEMENTATION.
METHOD class_constructor.
DATA lo_dummy TYPE REF TO zcl_abapgit_ajson.
DATA lo_type TYPE REF TO cl_abap_refdescr.
lo_type ?= cl_abap_typedescr=>describe_by_data( lo_dummy ).
gv_ajson_absolute_type_name = lo_type->get_referenced_type( )->absolute_name.
ENDMETHOD.
METHOD convert.
DATA lo_type TYPE REF TO cl_abap_typedescr.
DATA lo_converter TYPE REF TO lcl_abap_to_json.
lo_type = cl_abap_typedescr=>describe_by_data( iv_data ).
CREATE OBJECT lo_converter.
lo_converter->mi_custom_mapping = ii_custom_mapping.
lo_converter->mv_keep_item_order = iv_keep_item_order.
lo_converter->convert_any(
EXPORTING
iv_data = iv_data
io_type = lo_type
is_prefix = is_prefix
iv_index = iv_array_index
CHANGING
ct_nodes = rt_nodes ).
ENDMETHOD.
METHOD convert_any.
CASE io_type->kind.
WHEN cl_abap_typedescr=>kind_elem.
convert_value(
EXPORTING
iv_data = iv_data
io_type = io_type
is_prefix = is_prefix
iv_index = iv_index
iv_item_order = iv_item_order
CHANGING
ct_nodes = ct_nodes ).
WHEN cl_abap_typedescr=>kind_struct.
convert_struc(
EXPORTING
iv_data = iv_data
io_type = io_type
is_prefix = is_prefix
iv_index = iv_index
iv_item_order = iv_item_order
CHANGING
ct_nodes = ct_nodes ).
WHEN cl_abap_typedescr=>kind_table.
convert_table(
EXPORTING
iv_data = iv_data
io_type = io_type
is_prefix = is_prefix
iv_index = iv_index
iv_item_order = iv_item_order
CHANGING
ct_nodes = ct_nodes ).
WHEN OTHERS.
IF io_type->type_kind = cl_abap_typedescr=>typekind_dref.
convert_ref(
EXPORTING
iv_data = iv_data
is_prefix = is_prefix
iv_index = iv_index
iv_item_order = iv_item_order
CHANGING
ct_nodes = ct_nodes ).
ELSEIF io_type->type_kind = cl_abap_typedescr=>typekind_oref
AND cl_abap_typedescr=>describe_by_object_ref( iv_data )->absolute_name = gv_ajson_absolute_type_name.
convert_ajson(
EXPORTING
io_json = iv_data
is_prefix = is_prefix
iv_index = iv_index
CHANGING
ct_nodes = ct_nodes ).
ELSE.
zcx_abapgit_ajson_error=>raise( |Unsupported type [{ io_type->type_kind
}] @{ is_prefix-path && is_prefix-name }| ).
ENDIF.
ENDCASE.
ENDMETHOD.
METHOD convert_ajson.
FIELD-SYMBOLS <src> LIKE LINE OF ct_nodes.
FIELD-SYMBOLS <dst> LIKE LINE OF ct_nodes.
IF io_json IS NOT BOUND.
RETURN.
ENDIF.
LOOP AT io_json->mt_json_tree ASSIGNING <src>.
APPEND <src> TO ct_nodes ASSIGNING <dst>.
IF <dst>-path IS INITIAL AND <dst>-name IS INITIAL. " root node
<dst>-path = is_prefix-path.
<dst>-name = is_prefix-name.
<dst>-index = iv_index.
ELSE.
<dst>-path = is_prefix-path && is_prefix-name && <dst>-path.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD convert_value.
DATA ls_node LIKE LINE OF ct_nodes.
ls_node-path = is_prefix-path.
ls_node-name = is_prefix-name.
ls_node-index = iv_index.
ls_node-order = iv_item_order.
IF mi_custom_mapping IS BOUND.
ls_node-name = mi_custom_mapping->to_json(
iv_path = is_prefix-path
iv_name = is_prefix-name ).
ENDIF.
IF ls_node-name IS INITIAL.
ls_node-name = is_prefix-name.
ENDIF.
IF io_type->absolute_name = '\TYPE-POOL=ABAP\TYPE=ABAP_BOOL'
OR io_type->absolute_name = '\TYPE=ABAP_BOOLEAN'
OR io_type->absolute_name = '\TYPE=XSDBOOLEAN'
OR io_type->absolute_name = '\TYPE=FLAG'
OR io_type->absolute_name = '\TYPE=XFELD'.
ls_node-type = zif_abapgit_ajson=>node_type-boolean.
IF iv_data IS NOT INITIAL.
ls_node-value = 'true'.
ELSE.
ls_node-value = 'false'.
ENDIF.
ELSEIF io_type->type_kind CO 'CNgXyDT'. " Char like, date/time, xstring
ls_node-type = zif_abapgit_ajson=>node_type-string.
ls_node-value = |{ iv_data }|.
ELSEIF io_type->type_kind CO 'bsI8PaeF'. " Numeric
ls_node-type = zif_abapgit_ajson=>node_type-number.
ls_node-value = |{ iv_data }|.
ELSE.
zcx_abapgit_ajson_error=>raise( |Unexpected elementary type [{
io_type->type_kind }] @{ is_prefix-path && is_prefix-name }| ).
ENDIF.
APPEND ls_node TO ct_nodes.
ENDMETHOD.
METHOD convert_ref.
DATA ls_node LIKE LINE OF ct_nodes.
ls_node-path = is_prefix-path.
ls_node-name = is_prefix-name.
ls_node-index = iv_index.
ls_node-order = iv_item_order.
IF mi_custom_mapping IS BOUND.
ls_node-name = mi_custom_mapping->to_json(
iv_path = is_prefix-path
iv_name = is_prefix-name ).
ENDIF.
IF ls_node-name IS INITIAL.
ls_node-name = is_prefix-name.
ENDIF.
IF iv_data IS INITIAL.
ls_node-type = zif_abapgit_ajson=>node_type-null.
ls_node-value = 'null'.
ELSE.
" TODO support data references
zcx_abapgit_ajson_error=>raise( |Unexpected reference @{ is_prefix-path && is_prefix-name }| ).
ENDIF.
APPEND ls_node TO ct_nodes.
ENDMETHOD.
METHOD convert_struc.
DATA lo_struc TYPE REF TO cl_abap_structdescr.
DATA lt_comps TYPE cl_abap_structdescr=>component_table.
DATA ls_next_prefix LIKE is_prefix.
DATA lv_item_order TYPE i.
DATA ls_root LIKE LINE OF ct_nodes.
FIELD-SYMBOLS <root> LIKE ls_root.
FIELD-SYMBOLS <c> LIKE LINE OF lt_comps.
FIELD-SYMBOLS <val> TYPE any.
" Object root
IF cs_root IS SUPPLIED. " call for include structure
ASSIGN cs_root TO <root>.
ELSE. " First call
ls_root-path = is_prefix-path.
ls_root-name = is_prefix-name.
ls_root-type = zif_abapgit_ajson=>node_type-object.
ls_root-index = iv_index.
IF mi_custom_mapping IS BOUND.
ls_root-name = mi_custom_mapping->to_json(
iv_path = is_prefix-path
iv_name = is_prefix-name ).
ENDIF.
IF ls_root-name IS INITIAL.
ls_root-name = is_prefix-name.
ENDIF.
ls_root-order = iv_item_order.
APPEND ls_root TO ct_nodes ASSIGNING <root>.
ENDIF.
" Object attributes
lo_struc ?= io_type.
lt_comps = lo_struc->get_components( ).
" get_components is potentially much slower than lo_struc->components
" but ! we still need it to identify booleans
" and rtti seems to cache type descriptions really well (https://github.com/sbcgua/benchmarks.git)
" the structures will be repeated in real life
ls_next_prefix-path = is_prefix-path && is_prefix-name && '/'.
LOOP AT lt_comps ASSIGNING <c>.
IF <c>-as_include = abap_true.
convert_struc(
EXPORTING
iv_data = iv_data
io_type = <c>-type
is_prefix = is_prefix
CHANGING
cs_root = <root>
ct_nodes = ct_nodes ).
ELSE.
<root>-children = <root>-children + 1.
ls_next_prefix-name = to_lower( <c>-name ).
ASSIGN COMPONENT <c>-name OF STRUCTURE iv_data TO <val>.
ASSERT sy-subrc = 0.
IF mv_keep_item_order = abap_true.
lv_item_order = <root>-children.
ENDIF.
convert_any(
EXPORTING
iv_data = <val>
io_type = <c>-type
is_prefix = ls_next_prefix
iv_item_order = lv_item_order
CHANGING
ct_nodes = ct_nodes ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD convert_table.
DATA lo_table TYPE REF TO cl_abap_tabledescr.
DATA lo_ltype TYPE REF TO cl_abap_typedescr.
DATA ls_next_prefix LIKE is_prefix.
DATA lv_tabix TYPE sy-tabix.
DATA ls_root LIKE LINE OF ct_nodes.
FIELD-SYMBOLS <root> LIKE ls_root.
FIELD-SYMBOLS <tab> TYPE ANY TABLE.
FIELD-SYMBOLS <val> TYPE any.
" Array root
ls_root-path = is_prefix-path.
ls_root-name = is_prefix-name.
ls_root-type = zif_abapgit_ajson=>node_type-array.
ls_root-index = iv_index.
ls_root-order = iv_item_order.
IF mi_custom_mapping IS BOUND.
ls_root-name = mi_custom_mapping->to_json(
iv_path = is_prefix-path
iv_name = is_prefix-name ).
ENDIF.
IF ls_root-name IS INITIAL.
ls_root-name = is_prefix-name.
ENDIF.
APPEND ls_root TO ct_nodes ASSIGNING <root>.
" Array items
lo_table ?= io_type.
lo_ltype = lo_table->get_table_line_type( ).
ls_next_prefix-path = is_prefix-path && is_prefix-name && '/'.
ASSIGN iv_data TO <tab>.
lv_tabix = 1.
LOOP AT <tab> ASSIGNING <val>.
ls_next_prefix-name = to_lower( |{ lv_tabix }| ).
convert_any(
EXPORTING
iv_data = <val>
io_type = lo_ltype
is_prefix = ls_next_prefix
iv_index = <root>-children + 1
CHANGING
ct_nodes = ct_nodes ).
<root>-children = <root>-children + 1.
lv_tabix = lv_tabix + 1.
ENDLOOP.
ENDMETHOD.
METHOD insert_with_type.
DATA lo_type TYPE REF TO cl_abap_typedescr.
DATA lo_converter TYPE REF TO lcl_abap_to_json.
lo_type = cl_abap_typedescr=>describe_by_data( iv_data ).
CREATE OBJECT lo_converter.
lo_converter->mi_custom_mapping = ii_custom_mapping.
lo_converter->mv_keep_item_order = iv_keep_item_order.
lo_converter->insert_value_with_type(
EXPORTING
iv_data = iv_data
iv_type = iv_type
io_type = lo_type
is_prefix = is_prefix
iv_index = iv_array_index
CHANGING
ct_nodes = rt_nodes ).
ENDMETHOD.
METHOD insert_value_with_type.
DATA lv_prefix TYPE string.
DATA ls_node LIKE LINE OF ct_nodes.
lv_prefix = is_prefix-path && is_prefix-name.
IF io_type->type_kind CO 'CNgXyDT'. " Char like, date/time, xstring
IF iv_type = zif_abapgit_ajson=>node_type-boolean AND iv_data <> 'true' AND iv_data <> 'false'.
zcx_abapgit_ajson_error=>raise( |Unexpected boolean value [{ iv_data }] @{ lv_prefix }| ).
ELSEIF iv_type = zif_abapgit_ajson=>node_type-null AND iv_data IS NOT INITIAL.
zcx_abapgit_ajson_error=>raise( |Unexpected null value [{ iv_data }] @{ lv_prefix }| ).
ELSEIF iv_type = zif_abapgit_ajson=>node_type-number AND iv_data CN '0123456789. E+-'.
zcx_abapgit_ajson_error=>raise( |Unexpected numeric value [{ iv_data }] @{ lv_prefix }| ).
ELSEIF iv_type <> zif_abapgit_ajson=>node_type-string AND iv_type <> zif_abapgit_ajson=>node_type-boolean
AND iv_type <> zif_abapgit_ajson=>node_type-null AND iv_type <> zif_abapgit_ajson=>node_type-number.
zcx_abapgit_ajson_error=>raise( |Unexpected type for value [{ iv_type },{ iv_data }] @{ lv_prefix }| ).
ENDIF.
ELSEIF io_type->type_kind CO 'bsI8PaeF'. " Numeric
IF iv_type <> zif_abapgit_ajson=>node_type-number.
zcx_abapgit_ajson_error=>raise( |Unexpected value for numeric [{ iv_data }] @{ lv_prefix }| ).
ENDIF.
ELSE.
zcx_abapgit_ajson_error=>raise( |Unexpected type [{ io_type->type_kind }] @{ lv_prefix }| ).
ENDIF.
ls_node-path = is_prefix-path.
ls_node-name = is_prefix-name.
ls_node-index = iv_index.
ls_node-value = iv_data.
ls_node-type = iv_type.
ls_node-order = iv_item_order.
IF mi_custom_mapping IS BOUND.
ls_node-name = mi_custom_mapping->to_json(
iv_path = is_prefix-path
iv_name = is_prefix-name ).
ENDIF.
IF ls_node-name IS INITIAL.
ls_node-name = is_prefix-name.
ENDIF.
APPEND ls_node TO ct_nodes.
ENDMETHOD.
ENDCLASS.
**********************************************************************
* FILTER RUNNER
**********************************************************************
CLASS lcl_filter_runner DEFINITION FINAL.
PUBLIC SECTION.
METHODS run
IMPORTING
ii_filter TYPE REF TO zif_abapgit_ajson_filter
it_source_tree TYPE zif_abapgit_ajson=>ty_nodes_ts
CHANGING
ct_dest_tree TYPE zif_abapgit_ajson=>ty_nodes_ts
RAISING
zcx_abapgit_ajson_error.
PRIVATE SECTION.
DATA mi_filter TYPE REF TO zif_abapgit_ajson_filter.
DATA mr_source_tree TYPE REF TO zif_abapgit_ajson=>ty_nodes_ts.
DATA mr_dest_tree TYPE REF TO zif_abapgit_ajson=>ty_nodes_ts.
METHODS walk
IMPORTING
iv_path TYPE string
CHANGING
cs_parent TYPE zif_abapgit_ajson=>ty_node OPTIONAL
RAISING
zcx_abapgit_ajson_error.
ENDCLASS.
CLASS lcl_filter_runner IMPLEMENTATION.
METHOD run.
ASSERT ii_filter IS BOUND.
mi_filter = ii_filter.
CLEAR ct_dest_tree.
GET REFERENCE OF it_source_tree INTO mr_source_tree.
GET REFERENCE OF ct_dest_tree INTO mr_dest_tree.
walk( iv_path = '' ).
ENDMETHOD.
METHOD walk.
DATA ls_node TYPE zif_abapgit_ajson=>ty_node.
LOOP AT mr_source_tree->* INTO ls_node WHERE path = iv_path.
CASE ls_node-type.
WHEN zif_abapgit_ajson=>node_type-boolean OR zif_abapgit_ajson=>node_type-null
OR zif_abapgit_ajson=>node_type-number OR zif_abapgit_ajson=>node_type-string.
IF mi_filter->keep_node( ls_node ) = abap_false.
CONTINUE.
ENDIF.
WHEN zif_abapgit_ajson=>node_type-array OR zif_abapgit_ajson=>node_type-object.
IF mi_filter->keep_node(
is_node = ls_node
iv_visit = zif_abapgit_ajson_filter=>visit_type-open ) = abap_false.
CONTINUE.
ENDIF.
" Intentionally clear AFTER "open"
CLEAR ls_node-children.
walk(
EXPORTING
iv_path = iv_path && ls_node-name && `/`
CHANGING
cs_parent = ls_node ).
IF mi_filter->keep_node(
is_node = ls_node
iv_visit = zif_abapgit_ajson_filter=>visit_type-close ) = abap_false.
CONTINUE.
ENDIF.
WHEN OTHERS.
zcx_abapgit_ajson_error=>raise( |Unexpected node type { ls_node-type }| ).
ENDCASE.
IF cs_parent IS SUPPLIED.
cs_parent-children = cs_parent-children + 1.
IF cs_parent-type = zif_abapgit_ajson=>node_type-array.
ls_node-name = |{ cs_parent-children }|.
ls_node-index = cs_parent-children.
ENDIF.
ENDIF.
INSERT ls_node INTO TABLE mr_dest_tree->*.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
| [
17174,
17174,
2466,
1174,
198,
9,
19255,
45484,
198,
17174,
17174,
2466,
1174,
198,
198,
31631,
300,
565,
62,
26791,
5550,
20032,
17941,
25261,
13,
198,
220,
44731,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
3487,
1096,
62,
6978,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
6978,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
6978,
8,
41876,
4731,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
6626,
62,
6978,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
6978,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
6978,
62,
3672,
8,
41876,
1976,
361,
62,
397,
499,
18300,
62,
1228,
1559,
14804,
774,
62,
6978,
62,
3672,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
26571,
62,
18747,
62,
9630,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
6978,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
9630,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
9630,
8,
41876,
1312,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1228,
1559,
62,
18224,
13,
198,
198,
10619,
31631,
13,
198,
198,
31631,
300,
565,
62,
26791,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
26571,
62,
18747,
62,
9630,
13,
628,
220,
220,
220,
16876,
5626,
21628,
62,
9630,
7375,
705,
486,
1954,
2231,
3134,
4531,
4458,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1228,
1559,
62,
18224,
14804,
40225,
7,
930,
34,
34574,
751,
1729,
12,
77,
39223,
1994,
685,
90,
21628,
62,
9630,
1782,
60,
284,
7177,
685,
90,
21628,
62,
6978,
1782,
60,
91,
6739,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
374,
85,
62,
9630,
796,
21628,
62,
9630,
13,
198,
220,
220,
220,
16876,
374,
85,
62,
9630,
796,
657,
13,
198,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1228,
1559,
62,
18224,
14804,
40225,
7,
930,
34,
34574,
751,
6632,
1994,
284,
7177,
685,
90,
21628,
62,
6978,
1782,
60,
91,
6739,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
23578,
49273,
13,
628,
220,
337,
36252,
3487,
1096,
62,
6978,
13,
628,
220,
220,
220,
374,
85,
62,
6978,
796,
21628,
62,
6978,
13,
198,
220,
220,
220,
16876,
965,
11925,
7,
374,
85,
62,
6978,
1267,
796,
657,
13,
198,
220,
220,
220,
220,
220,
374,
85,
62,
6978,
796,
31051,
4458,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
16876,
374,
85,
62,
6978,
10,
15,
7,
16,
8,
1279,
29,
31051,
4458,
198,
220,
220,
220,
220,
220,
374,
85,
62,
6978,
796,
31051,
6,
11405,
374,
85,
62,
6978,
13,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
16876,
3293,
1806,
7,
1188,
796,
374,
85,
62,
6978,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
572,
796,
965,
11925,
7,
374,
85,
62,
6978,
1267,
532,
352,
1267,
1279,
29,
31051,
4458,
198,
220,
220,
220,
220,
220,
374,
85,
62,
6978,
796,
374,
85,
62,
6978,
11405,
31051,
4458,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
23578,
49273,
13,
628,
220,
337,
36252,
6626,
62,
6978,
13,
628,
220,
220,
220,
42865,
300,
85,
62,
8210,
41876,
1312,
13,
198,
220,
220,
220,
42865,
300,
85,
62,
11925,
41876,
1312,
13,
198,
220,
220,
220,
42865,
300,
85,
62,
2213,
320,
62,
6649,
1077,
41876,
1312,
13,
628,
220,
220,
220,
300,
85,
62,
11925,
796,
965,
11925,
7,
21628,
62,
6978,
6739,
198,
220,
220,
220,
16876,
300,
85,
62,
11925,
796,
657,
6375,
21628,
62,
6978,
796,
31051,
4458,
198,
220,
220,
220,
220,
220,
30826,
27064,
13,
366,
6565,
3108,
318,
262,
16144,
329,
6808,
2378,
796,
10148,
1343,
10148,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
16876,
3293,
1806,
7,
1188,
796,
21628,
62,
6978,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
572,
796,
300,
85,
62,
11925,
532,
352,
1267,
796,
31051,
4458,
198,
220,
220,
220,
220,
220,
300,
85,
62,
2213,
320,
62,
6649,
1077,
796,
352,
13,
366,
8856,
938,
31051,
6,
198,
220,
220,
220,
23578,
5064,
13,
628,
220,
220,
220,
300,
85,
62,
8210,
796,
1064,
7,
1188,
796,
9575,
7,
21628,
62,
6978,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
850,
796,
31051,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
572,
796,
300,
85,
62,
2213,
320,
62,
6649,
1077,
6739,
198,
220,
220,
220,
16876,
300,
85,
62,
8210,
796,
532,
16,
13,
198,
220,
220,
220,
220,
220,
300,
85,
62,
8210,
220,
796,
300,
85,
62,
11925,
13,
366,
2190,
2187,
4731,
355,
262,
705,
3672,
6,
636,
198,
220,
220,
220,
23578,
5064,
13,
198,
220,
220,
220,
300,
85,
62,
8210,
796,
300,
85,
62,
11925,
532,
300,
85,
62,
8210,
13,
628,
220,
220,
220,
374,
85,
62,
6978,
62,
3672,
12,
6978,
796,
3487,
1096,
62,
6978,
7,
3293,
1806,
7,
1188,
796,
21628,
62,
6978,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_aoc_check_89 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
METHODS get_attributes
REDEFINITION.
METHODS if_ci_test~query_attributes
REDEFINITION.
METHODS put_attributes
REDEFINITION.
PROTECTED SECTION.
DATA mv_minlength TYPE i.
PRIVATE SECTION.
METHODS get_lines_of_documentation
IMPORTING
iv_obj_type TYPE trobjtype
iv_obj_name TYPE sobj_name
RETURNING
VALUE(rv_result) TYPE i.
METHODS get_content
IMPORTING
iv_obj_type TYPE trobjtype
iv_obj_name TYPE sobj_name
RETURNING
VALUE(rv_result) TYPE xstring.
ENDCLASS.
CLASS zcl_aoc_check_89 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
* https://github.com/larshp/abapOpenChecks
* MIT License
DATA lv_actual_length TYPE i.
DATA lv_text TYPE string.
FIELD-SYMBOLS <ls_level> TYPE slevel.
lv_actual_length = get_lines_of_documentation(
iv_obj_type = object_type
iv_obj_name = object_name ).
IF lv_actual_length < mv_minlength.
READ TABLE it_levels
WITH KEY level = 0
ASSIGNING <ls_level>.
inform( p_sub_obj_type = c_type_include
p_sub_obj_name = <ls_level>-name
p_kind = mv_errty
p_test = myname
p_code = '001'
p_param_1 = |{ lv_actual_length } < { mv_minlength }| ).
ENDIF.
ENDMETHOD.
METHOD constructor.
DATA ls_scimessage TYPE scimessage.
super->constructor( ).
version = '001'.
position = '089'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
mv_errty = c_error.
mv_minlength = 10.
ls_scimessage-test = myname.
ls_scimessage-code = '001'.
ls_scimessage-kind = c_error.
ls_scimessage-text = 'Minimum lines of documentation not reached: &1'(m01).
ls_scimessage-pcom = ''.
ls_scimessage-pcom_alt = ''.
INSERT ls_scimessage INTO TABLE scimessages.
ENDMETHOD. "CONSTRUCTOR
METHOD get_attributes.
EXPORT
mv_errty = mv_errty
mv_minlength = mv_minlength
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_minlength 'Minimum lines' ''. "#EC NOTEXT
zzaoc_popup.
ENDMETHOD.
METHOD put_attributes.
IMPORT
mv_errty = mv_errty
mv_minlength = mv_minlength
FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD get_lines_of_documentation.
DATA lv_objname TYPE lxeobjname.
DATA lv_objtype TYPE lxeobjtype.
DATA lo_conv TYPE REF TO cl_abap_conv_in_ce.
DATA lv_len TYPE i.
DATA lv_str TYPE string.
DATA lv_count_lines TYPE i.
DATA lv_count_chapters_u1 TYPE i.
DATA lv_count_chapters_u2 TYPE i.
DATA lv_count_empty TYPE i.
DATA lv_content TYPE xstring.
lv_objname = iv_obj_name.
lv_objtype = iv_obj_type(2).
lv_content = get_content(
iv_obj_type = iv_obj_type
iv_obj_name = iv_obj_name ).
IF lv_content IS INITIAL.
RETURN.
ENDIF.
TRY.
lo_conv = cl_abap_conv_in_ce=>create(
input = lv_content ).
lv_len = xstrlen( lv_content ).
lo_conv->read(
IMPORTING
data = lv_str ).
CATCH cx_sy_conversion_codepage.
CATCH cx_sy_codepage_converter_init.
CATCH cx_parameter_invalid_type.
CATCH cx_parameter_invalid_range.
ENDTRY.
FIND ALL OCCURRENCES OF '<itf:p ' IN lv_str MATCH COUNT lv_count_lines.
FIND ALL OCCURRENCES OF '<itf:p name="U1">' IN lv_str MATCH COUNT lv_count_chapters_u1. "ignore chapter headers
FIND ALL OCCURRENCES OF '<itf:p name="U2">' IN lv_str MATCH COUNT lv_count_chapters_u2. "ignore chapter headers
"ignore empty lines (first line in chapter)
FIND ALL OCCURRENCES OF '<itf:p name="AS"/>' IN lv_str MATCH COUNT lv_count_empty.
rv_result = lv_count_lines - lv_count_chapters_u1 - lv_count_chapters_u2 - lv_count_empty.
ENDMETHOD.
METHOD get_content.
DATA lv_destination TYPE rfcdest.
DATA lv_objname TYPE lxeobjname.
DATA lv_objtype TYPE lxeobjtype.
lv_destination = get_destination( ).
lv_objname = iv_obj_name.
lv_objtype = iv_obj_type(2).
IF lv_objtype = 'PR'. "PROG -> REPO
lv_objtype = 'RE'.
ENDIF.
"function module already exists in 7.02 -> should work on every satellite system
CALL FUNCTION 'LXE_OBJ_DOKU_GET_XSTRING_RFC'
DESTINATION lv_destination
EXPORTING
lang = sy-langu
objtype = lv_objtype
objname = lv_objname
IMPORTING
content = rv_result.
"not found in logon language try with English and German
IF rv_result IS INITIAL
AND sy-langu <> 'E'.
CALL FUNCTION 'LXE_OBJ_DOKU_GET_XSTRING_RFC'
DESTINATION lv_destination
EXPORTING
lang = 'E'
objtype = lv_objtype
objname = lv_objname
IMPORTING
content = rv_result.
ENDIF.
IF rv_result IS INITIAL
AND sy-langu <> 'D'.
CALL FUNCTION 'LXE_OBJ_DOKU_GET_XSTRING_RFC'
DESTINATION lv_destination
EXPORTING
lang = 'D'
objtype = lv_objtype
objname = lv_objname
IMPORTING
content = rv_result.
ENDIF.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
64,
420,
62,
9122,
62,
4531,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
64,
420,
62,
16668,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
23772,
13,
628,
220,
220,
220,
337,
36252,
50,
2198,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
1078,
7657,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
220,
220,
337,
36252,
50,
611,
62,
979,
62,
9288,
93,
22766,
62,
1078,
7657,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
198,
220,
220,
220,
337,
36252,
50,
1234,
62,
1078,
7657,
198,
220,
220,
220,
220,
220,
220,
220,
23848,
36,
20032,
17941,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
220,
220,
42865,
285,
85,
62,
1084,
13664,
41876,
1312,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
6615,
62,
1659,
62,
22897,
341,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26801,
62,
4906,
220,
220,
220,
220,
220,
41876,
4161,
50007,
4906,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26801,
62,
3672,
220,
220,
220,
220,
220,
41876,
27355,
73,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
20274,
8,
41876,
1312,
13,
198,
220,
220,
220,
337,
36252,
50,
651,
62,
11299,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26801,
62,
4906,
220,
220,
220,
220,
220,
41876,
4161,
50007,
4906,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26801,
62,
3672,
220,
220,
220,
220,
220,
41876,
27355,
73,
62,
3672,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
81,
85,
62,
20274,
8,
41876,
2124,
8841,
13,
198,
10619,
31631,
13,
198,
198,
31631,
1976,
565,
62,
64,
420,
62,
9122,
62,
4531,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
2198,
13,
198,
198,
9,
450,
499,
11505,
7376,
4657,
198,
9,
3740,
1378,
12567,
13,
785,
14,
75,
5406,
79,
14,
397,
499,
11505,
7376,
4657,
198,
9,
17168,
13789,
628,
220,
220,
220,
42865,
300,
85,
62,
50039,
62,
13664,
41876,
1312,
13,
198,
220,
220,
220,
42865,
300,
85,
62,
5239,
41876,
4731,
13,
198,
220,
220,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
1279,
7278,
62,
5715,
29,
41876,
3133,
626,
13,
628,
220,
220,
220,
300,
85,
62,
50039,
62,
13664,
796,
651,
62,
6615,
62,
1659,
62,
22897,
341,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26801,
62,
4906,
796,
2134,
62,
4906,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
26801,
62,
3672,
796,
2134,
62,
3672,
6739,
628,
220,
220,
220,
16876,
300,
85,
62,
50039,
62,
13664,
1279,
285,
85,
62,
1084,
13664,
13,
628,
220,
220,
220,
220,
220,
20832,
43679,
340,
62,
46170,
198,
220,
220,
220,
220,
220,
220,
220,
13315,
35374,
1241,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
24994,
3528,
15871,
1279,
7278,
62,
5715,
28401,
628,
220,
220,
220,
220,
220,
4175,
7,
279,
62,
7266,
62,
26801,
62,
4906,
796,
269,
62,
4906,
62,
17256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
7266,
62,
26801,
62,
3672,
796,
1279,
7278,
62,
5715,
29,
12,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
11031,
220,
220,
220,
220,
220,
220,
220,
220,
796,
285,
85,
62,
8056,
774,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
9288,
220,
220,
220,
220,
220,
220,
220,
220,
796,
616,
3672,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
8189,
220,
220,
220,
220,
220,
220,
220,
220,
796,
705,
8298,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
17143,
62,
16,
220,
796,
930,
90,
300,
85,
62,
50039,
62,
13664,
1782,
1279,
1391,
285,
85,
62,
1084,
13664,
1782,
91,
6739,
628,
220,
220,
220,
23578,
5064,
13,
628,
220,
23578,
49273,
13,
628,
220,
337,
36252,
23772,
13,
628,
220,
220,
220,
42865,
43979,
62,
1416,
320,
7589,
41876,
629,
320,
7589,
13,
198,
220,
220,
220,
2208,
3784,
41571,
273,
7,
6739,
628,
220,
220,
220,
2196,
220,
220,
220,
220,
220,
220,
220,
796,
705,
8298,
4458,
198,
220,
220,
220,
2292,
220,
220,
220,
220,
220,
220,
796,
705,
49352,
4458,
628,
220,
220,
220,
468,
62,
1078,
7657,
796,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
12608,
62,
482,
220,
796,
450,
499,
62,
7942,
13,
628,
220,
220,
220,
7139,
62,
81,
16072,
7,
6739,
628,
220,
220,
220,
285,
85,
62,
8056,
774,
796,
269,
62,
18224,
13,
198,
220,
220,
220,
285,
85,
62,
1084,
13664,
796,
838,
13,
628,
220,
220,
220,
43979,
62,
1416,
320,
7589,
12,
9288,
796,
616,
3672,
13,
198,
220,
220,
220,
43979,
62,
1416,
320,
7589,
12,
8189,
796,
705,
8298,
4458,
198,
220,
220,
220,
43979,
62,
1416,
320,
7589,
12,
11031,
796,
269,
62,
18224,
13,
198,
220,
220,
220,
43979,
62,
1416,
320,
7589,
12,
5239,
796,
705,
44046,
3951,
286,
10314,
407,
4251,
25,
1222,
16,
6,
7,
76,
486,
737,
198,
220,
220,
220,
43979,
62,
1416,
320,
7589,
12,
79,
785,
796,
705,
4458,
198,
220,
220,
220,
43979,
62,
1416,
320,
7589,
12,
79
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_gui_page_repo_over DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_component
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_gui_renderable .
DATA mv_order_by TYPE string READ-ONLY .
DATA mv_only_favorites TYPE abap_bool READ-ONLY.
METHODS constructor
IMPORTING iv_only_favorites TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS set_order_by
IMPORTING
!iv_order_by TYPE string .
METHODS set_order_direction
IMPORTING
!iv_order_descending TYPE abap_bool .
METHODS set_filter
IMPORTING
it_postdata TYPE zif_abapgit_html_viewer=>ty_post_data .
METHODS set_only_favorites
IMPORTING
iv_only_favorites TYPE abap_bool.
METHODS
get_only_favorites RETURNING VALUE(rv_result) TYPE abap_bool.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_overview,
favorite TYPE string,
"! True for offline, false for online repo
type TYPE string,
key TYPE zif_abapgit_persistence=>ty_value,
name TYPE string,
url TYPE string,
package TYPE devclass,
branch TYPE string,
created_by TYPE xubname,
created_at TYPE string,
deserialized_by TYPE xubname,
deserialized_at TYPE string,
write_protected TYPE abap_bool,
END OF ty_overview,
ty_overviews TYPE STANDARD TABLE OF ty_overview
WITH NON-UNIQUE DEFAULT KEY.
CONSTANTS:
BEGIN OF c_action,
select TYPE string VALUE 'select',
apply_filter TYPE string VALUE 'apply_filter',
END OF c_action .
DATA: mv_order_descending TYPE abap_bool,
mv_filter TYPE string,
mv_time_zone TYPE timezone,
mt_col_spec TYPE zif_abapgit_definitions=>ty_col_spec_tt,
mt_overview TYPE ty_overviews.
METHODS: render_text_input
IMPORTING iv_name TYPE string
iv_label TYPE string
iv_value TYPE string OPTIONAL
iv_max_length TYPE string OPTIONAL
!iv_autofocus TYPE abap_bool DEFAULT abap_false
RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html,
apply_filter
CHANGING
ct_overview TYPE ty_overviews,
map_repo_list_to_overview
RETURNING
VALUE(rt_overview) TYPE ty_overviews
RAISING
zcx_abapgit_exception,
render_table_header
IMPORTING
ii_html TYPE REF TO zif_abapgit_html,
render_table
IMPORTING
ii_html TYPE REF TO zif_abapgit_html
it_overview TYPE ty_overviews
RAISING
zcx_abapgit_exception,
render_table_body
IMPORTING
ii_html TYPE REF TO zif_abapgit_html
it_repo_list TYPE ty_overviews
RAISING
zcx_abapgit_exception,
render_header_bar
IMPORTING
ii_html TYPE REF TO zif_abapgit_html,
apply_order_by
CHANGING ct_overview TYPE ty_overviews,
_add_column
IMPORTING
iv_tech_name TYPE string OPTIONAL
iv_display_name TYPE string OPTIONAL
iv_css_class TYPE string OPTIONAL
iv_add_tz TYPE abap_bool OPTIONAL
iv_title TYPE string OPTIONAL
iv_allow_order_by TYPE any OPTIONAL.
METHODS render_scripts
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception.
METHODS shorten_repo_url
IMPORTING iv_full_url TYPE string
iv_max_length TYPE i DEFAULT 60
RETURNING VALUE(rv_shortened) TYPE string.
METHODS render_actions
IMPORTING ii_html TYPE REF TO zif_abapgit_html.
METHODS column
IMPORTING iv_content TYPE string OPTIONAL
iv_css_class TYPE string OPTIONAL
RETURNING VALUE(rv_html) TYPE string.
METHODS action_link
IMPORTING iv_content TYPE string
RETURNING VALUE(rv_html) TYPE string.
ENDCLASS.
CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
METHOD apply_filter.
IF mv_filter IS NOT INITIAL.
DELETE ct_overview WHERE key NS mv_filter
AND name NS mv_filter
AND url NS mv_filter
AND package NS mv_filter
AND branch NS mv_filter
AND created_by NS mv_filter
AND created_at NS mv_filter
AND deserialized_by NS mv_filter
AND deserialized_at NS mv_filter.
ENDIF.
ENDMETHOD.
METHOD apply_order_by.
DATA:
lt_sort TYPE abap_sortorder_tab,
ls_sort LIKE LINE OF lt_sort.
ls_sort-name = 'FAVORITE'.
ls_sort-descending = abap_true.
ls_sort-astext = abap_true.
INSERT ls_sort INTO TABLE lt_sort.
IF mv_order_by IS NOT INITIAL.
ls_sort-name = mv_order_by.
ls_sort-descending = mv_order_descending.
ls_sort-astext = abap_true.
INSERT ls_sort INTO TABLE lt_sort.
ENDIF.
SORT ct_overview BY (lt_sort).
ENDMETHOD.
METHOD constructor.
super->constructor( ).
mv_order_by = |NAME|.
mv_only_favorites = iv_only_favorites.
CALL FUNCTION 'GET_SYSTEM_TIMEZONE'
IMPORTING
timezone = mv_time_zone
EXCEPTIONS
customizing_missing = 1
OTHERS = 2.
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD map_repo_list_to_overview.
DATA: ls_overview LIKE LINE OF rt_overview,
lv_date TYPE d,
lv_time TYPE t,
lt_repo_obj_list TYPE zif_abapgit_repo_srv=>ty_repo_list.
FIELD-SYMBOLS <ls_repo> LIKE LINE OF lt_repo_obj_list.
IF mv_only_favorites = abap_true.
lt_repo_obj_list = zcl_abapgit_repo_srv=>get_instance( )->list_favorites( ).
ELSE.
lt_repo_obj_list = zcl_abapgit_repo_srv=>get_instance( )->list( ).
ENDIF.
LOOP AT lt_repo_obj_list ASSIGNING <ls_repo>.
CLEAR: ls_overview.
ls_overview-favorite = zcl_abapgit_persistence_user=>get_instance(
)->is_favorite_repo( <ls_repo>->ms_data-key ).
ls_overview-type = <ls_repo>->ms_data-offline.
ls_overview-key = <ls_repo>->ms_data-key.
ls_overview-name = <ls_repo>->get_name( ).
ls_overview-url = <ls_repo>->ms_data-url.
ls_overview-package = <ls_repo>->ms_data-package.
ls_overview-branch = <ls_repo>->ms_data-branch_name.
ls_overview-created_by = <ls_repo>->ms_data-created_by.
ls_overview-write_protected = <ls_repo>->ms_data-local_settings-write_protected.
IF <ls_repo>->ms_data-created_at IS NOT INITIAL.
CONVERT TIME STAMP <ls_repo>->ms_data-created_at
TIME ZONE mv_time_zone
INTO DATE lv_date
TIME lv_time.
ls_overview-created_at = |{ lv_date DATE = USER } { lv_time TIME = USER }|.
ENDIF.
ls_overview-deserialized_by = <ls_repo>->ms_data-deserialized_by.
IF <ls_repo>->ms_data-deserialized_at IS NOT INITIAL.
CONVERT TIME STAMP <ls_repo>->ms_data-deserialized_at
TIME ZONE mv_time_zone
INTO DATE lv_date
TIME lv_time.
ls_overview-deserialized_at = |{ lv_date DATE = USER } { lv_time TIME = USER }|.
ENDIF.
INSERT ls_overview INTO TABLE rt_overview.
ENDLOOP.
ENDMETHOD.
METHOD render_header_bar.
DATA: lv_new_toggle_favorites TYPE abap_bool,
lv_icon_class TYPE string.
ii_html->add( |<div class="form-container">| ).
ii_html->add( |<form class="inline" method="post" action="sapevent:{ c_action-apply_filter }">| ).
ii_html->add( render_text_input(
iv_name = |filter|
iv_label = |Filter: |
iv_value = mv_filter
iv_autofocus = abap_true ) ).
ii_html->add( |<input type="submit" class="hidden-submit">| ).
ii_html->add( |</form>| ).
lv_new_toggle_favorites = boolc( NOT mv_only_favorites = abap_true ).
" render icon for current state but filter value for new state
IF mv_only_favorites = abap_true.
lv_icon_class = `blue`.
ELSE.
lv_icon_class = `grey`.
ENDIF.
ii_html->add( ii_html->a(
iv_txt = |<i id="icon-filter-favorite" class="icon icon-check { lv_icon_class }"></i> Only Favorites|
iv_act = |{ zif_abapgit_definitions=>c_action-toggle_favorites }?favorites={ lv_new_toggle_favorites }| ) ).
ii_html->add( `<span class="separator">|</span>` ).
ii_html->add( ii_html->a(
iv_txt = '<i id="icon-filter-detail" class="icon icon-check"></i> Detail'
iv_act = |gHelper.toggleRepoListDetail()|
iv_typ = zif_abapgit_html=>c_action_type-onclick ) ).
render_actions( ii_html = ii_html ).
ii_html->add( |</div>| ).
ENDMETHOD.
METHOD render_scripts.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ).
ri_html->add( 'setInitialFocus("filter");' ).
ri_html->add( 'var gHelper = new RepoOverViewHelper();' ).
ENDMETHOD.
METHOD render_table.
ii_html->add( |<div class="db_list repo-overview">| ).
ii_html->add( |<table class="db_tab">| ).
render_table_header( ii_html ).
render_table_body( ii_html = ii_html
it_repo_list = it_overview ).
ii_html->add( |</table>| ).
ii_html->add( |</div>| ).
ENDMETHOD.
METHOD render_table_body.
DATA:
lv_type_icon TYPE string,
lv_favorite_icon TYPE string,
lv_favorite_class TYPE string,
lv_text TYPE string,
lv_lock TYPE string,
lv_toggle_favorite_link TYPE string,
lv_repo_go_link TYPE string,
lv_remote_icon_link TYPE string.
FIELD-SYMBOLS: <ls_repo> LIKE LINE OF it_repo_list.
ii_html->add( '<tbody>' ).
LOOP AT it_repo_list ASSIGNING <ls_repo>.
IF <ls_repo>-type = abap_true.
lv_type_icon = 'plug/darkgrey'.
ELSE.
lv_type_icon = 'cloud-upload-alt/darkgrey'.
ENDIF.
IF <ls_repo>-favorite = abap_true.
lv_favorite_icon = 'star/blue'.
lv_favorite_class = 'favorite'.
ELSE.
lv_favorite_icon = 'star/grey'.
lv_favorite_class = ''.
ENDIF.
ii_html->add(
|<tr class="repo { lv_favorite_class }" data-key="{ <ls_repo>-key }" data-offline="{ <ls_repo>-type }">| ).
lv_toggle_favorite_link = ii_html->a(
iv_act = |{ zif_abapgit_definitions=>c_action-repo_toggle_fav }?key={ <ls_repo>-key }|
iv_txt = ii_html->icon( iv_name = lv_favorite_icon
iv_class = 'pad-sides'
iv_hint = 'Click to toggle favorite' ) ).
ii_html->add(
column( iv_content = lv_toggle_favorite_link
iv_css_class = 'wmin' ) ).
CLEAR lv_lock.
IF <ls_repo>-write_protected = abap_true.
lv_lock = ii_html->icon( iv_name = 'lock/grey70'
iv_class = 'm-em5-sides'
iv_hint = 'Locked from pulls' ).
ENDIF.
ii_html->add(
column( iv_content = ii_html->icon( lv_type_icon )
iv_css_class = 'wmin' ) ).
ii_html->add(
column( iv_content = ii_html->a( iv_txt = <ls_repo>-name
iv_act = |{ c_action-select }?key={ <ls_repo>-key }| ) && lv_lock ) ).
ii_html->add(
column( iv_content = zcl_abapgit_gui_chunk_lib=>render_package_name(
iv_package = <ls_repo>-package
iv_suppress_title = boolc( NOT mv_only_favorites = abap_true ) )->render( ) ) ).
IF <ls_repo>-type = abap_false.
lv_remote_icon_link = ii_html->a(
iv_txt = ii_html->icon( iv_name = 'edit-solid'
iv_class = 'pad-sides'
iv_hint = 'Change remote' )
iv_act = |{ zif_abapgit_definitions=>c_action-repo_remote_settings }?| &&
|key={ <ls_repo>-key }|
iv_class = |remote_repo| ).
lv_text = shorten_repo_url( <ls_repo>-url ) && lv_remote_icon_link.
ii_html->add( column( iv_content = |{ ii_html->a(
iv_txt = lv_text
iv_title = <ls_repo>-url
iv_act = |{ zif_abapgit_definitions=>c_action-url }?url={ <ls_repo>-url }| ) }| ) ).
ELSE.
ii_html->add( column( ) ).
ENDIF.
IF <ls_repo>-branch IS INITIAL.
ii_html->add( column( iv_content = | | ) ).
ELSE.
ii_html->add(
column( iv_content = zcl_abapgit_gui_chunk_lib=>render_branch_name(
iv_branch = <ls_repo>-branch
iv_repo_key = <ls_repo>-key )->render( ) ) ).
ENDIF.
ii_html->add(
column( iv_content = zcl_abapgit_gui_chunk_lib=>render_user_name(
iv_username = <ls_repo>-deserialized_by
iv_suppress_title = boolc( NOT mv_only_favorites = abap_true ) )->render( )
iv_css_class = 'ro-detail' ) ).
ii_html->add(
column( iv_content = <ls_repo>-deserialized_at
iv_css_class = 'ro-detail' ) ).
ii_html->add(
column( iv_content = zcl_abapgit_gui_chunk_lib=>render_user_name(
iv_username = <ls_repo>-created_by
iv_suppress_title = boolc( NOT mv_only_favorites = abap_true ) )->render( )
iv_css_class = 'ro-detail' ) ).
ii_html->add(
column( iv_content = <ls_repo>-created_at
iv_css_class = 'ro-detail' ) ).
ii_html->add(
column( iv_content = |{ <ls_repo>-key }|
iv_css_class = 'ro-detail' ) ).
" the link is clicked in javascript
lv_repo_go_link = ii_html->a(
iv_txt = ``
iv_act = |{ c_action-select }?key={ <ls_repo>-key }|
iv_class = 'hidden' ).
ii_html->add( column(
iv_content = |<span class="link" title="Open">›{ lv_repo_go_link }</span>|
iv_css_class = 'ro-go' ) ).
ii_html->add( `</tr>` ).
ENDLOOP.
ii_html->add( |</tbody>| ).
IF mv_only_favorites = abap_true.
ii_html->add( `<tfoot><tr><td colspan="5">` ).
ii_html->add( `(Only favorites are shown. ` ).
ii_html->add( ii_html->a(
iv_txt = |Show All|
iv_act = |{ zif_abapgit_definitions=>c_action-toggle_favorites }?favorites={ abap_false }| ) ).
ii_html->add( `)</td></tr></tfoot>` ).
ENDIF.
ENDMETHOD.
METHOD render_actions.
CONSTANTS:
lc_separator TYPE string VALUE `<span class="separator">|</span>`,
lc_dummy_key TYPE string VALUE `?key=#`,
lc_offline_class TYPE string VALUE `action_offline_repo`,
lc_online_class TYPE string VALUE `action_online_repo`,
lc_action_class TYPE string VALUE `action_link`.
DATA:
lv_settings_link TYPE string,
lv_check_link TYPE string,
lv_stage_link TYPE string,
lv_patch_link TYPE string,
lv_diff_link TYPE string,
lv_pull_link TYPE string.
DATA:
lv_zip_import_link TYPE string,
lv_zip_export_link TYPE string.
ii_html->add( |<div class="float-right">| ).
lv_pull_link = ii_html->a(
iv_txt = |Pull|
iv_act = |{ zif_abapgit_definitions=>c_action-git_reset }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }| ).
ii_html->add( action_link( lv_pull_link && lc_separator ) ).
lv_stage_link = ii_html->a(
iv_txt = |Stage|
iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class } | ).
ii_html->add( action_link( lv_stage_link && lc_separator ) ).
lv_patch_link = ii_html->a(
iv_txt = |Patch|
iv_act = |{ zif_abapgit_definitions=>c_action-go_patch }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class } | ).
ii_html->add( action_link( lv_patch_link && lc_separator ) ).
lv_diff_link = ii_html->a(
iv_txt = |Diff|
iv_act = |{ zif_abapgit_definitions=>c_action-go_repo_diff }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }| ).
ii_html->add( action_link( lv_diff_link && lc_separator ) ).
lv_check_link = ii_html->a(
iv_txt = |Check|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_code_inspector }{ lc_dummy_key }|
iv_class = |{ lc_action_class }| ).
ii_html->add( action_link( lv_check_link && lc_separator ) ).
lv_zip_import_link = ii_html->a(
iv_txt = |Import|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_import }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }| ).
ii_html->add( action_link( lv_zip_import_link && lc_separator ) ).
lv_zip_export_link = ii_html->a(
iv_txt = |Export|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_export }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }| ).
ii_html->add( action_link( lv_zip_export_link && lc_separator ) ).
lv_settings_link = ii_html->a(
iv_txt = |Settings|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_settings }{ lc_dummy_key }|
iv_class = |{ lc_action_class }| ).
ii_html->add( action_link( lv_settings_link ) ).
ii_html->add( |</div>| ).
ENDMETHOD.
METHOD shorten_repo_url.
DATA lv_new_length TYPE i.
DATA lv_length_to_truncate_to TYPE i.
rv_shortened = iv_full_url.
REPLACE FIRST OCCURRENCE OF 'https://' IN rv_shortened WITH ''.
REPLACE FIRST OCCURRENCE OF 'http://' IN rv_shortened WITH ''.
IF rv_shortened CP '*.git'.
lv_new_length = strlen( rv_shortened ) - 4.
rv_shortened = rv_shortened(lv_new_length).
ENDIF.
IF strlen( rv_shortened ) > iv_max_length.
lv_length_to_truncate_to = iv_max_length - 3.
rv_shortened = rv_shortened(lv_length_to_truncate_to) && `...`.
ENDIF.
ENDMETHOD.
METHOD render_table_header.
CLEAR mt_col_spec.
_add_column(
iv_tech_name = 'FAVORITE'
iv_css_class = 'wmin'
iv_allow_order_by = abap_false ).
_add_column(
iv_tech_name = 'TYPE'
iv_css_class = 'wmin'
iv_allow_order_by = abap_false ).
_add_column(
iv_tech_name = 'NAME'
iv_display_name = 'Name'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'PACKAGE'
iv_display_name = 'Package'
iv_css_class = 'package'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'URL'
iv_display_name = 'Remote'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'BRANCH'
iv_display_name = 'Branch'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'DESERIALIZED_BY'
iv_display_name = 'Deserialized by'
iv_css_class = 'ro-detail'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'DESERIALIZED_AT'
iv_display_name = 'Deserialized at'
iv_css_class = 'ro-detail'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'CREATED_BY'
iv_display_name = 'Created by'
iv_css_class = 'ro-detail'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'CREATED_AT'
iv_display_name = 'Created at'
iv_css_class = 'ro-detail'
iv_add_tz = abap_true
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'KEY'
iv_display_name = 'Key'
iv_css_class = 'ro-detail'
iv_allow_order_by = abap_true ).
_add_column(
iv_tech_name = 'GO'
iv_css_class = 'ro-go'
iv_allow_order_by = abap_false ).
ii_html->add( |<thead>| ).
ii_html->add( |<tr>| ).
ii_html->add( zcl_abapgit_gui_chunk_lib=>render_order_by_header_cells(
it_col_spec = mt_col_spec
iv_order_by = mv_order_by
iv_order_descending = mv_order_descending ) ).
ii_html->add( '</tr>' ).
ii_html->add( '</thead>' ).
ENDMETHOD.
METHOD render_text_input.
DATA lv_attrs TYPE string.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
IF iv_value IS NOT INITIAL.
lv_attrs = | value="{ iv_value }"|.
ENDIF.
IF iv_max_length IS NOT INITIAL.
lv_attrs = lv_attrs && | maxlength="{ iv_max_length }"|.
ENDIF.
IF iv_autofocus = abap_true.
lv_attrs = lv_attrs && | autofocus|.
ENDIF.
ri_html->add( |<label for="{ iv_name }">{ iv_label }</label>| ).
ri_html->add( |<input id="{ iv_name }" name="{ iv_name }" type="text"{ lv_attrs }>| ).
ENDMETHOD.
METHOD set_filter.
FIELD-SYMBOLS: <lv_postdata> LIKE LINE OF it_postdata.
READ TABLE it_postdata ASSIGNING <lv_postdata>
INDEX 1.
IF sy-subrc = 0.
FIND FIRST OCCURRENCE OF REGEX `filter=(.*)`
IN <lv_postdata>
SUBMATCHES mv_filter.
ENDIF.
mv_filter = condense( mv_filter ).
ENDMETHOD.
METHOD set_order_by.
mv_order_by = iv_order_by.
ENDMETHOD.
METHOD set_order_direction.
mv_order_descending = iv_order_descending.
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
mt_overview = map_repo_list_to_overview( ).
apply_order_by( CHANGING ct_overview = mt_overview ).
apply_filter( CHANGING ct_overview = mt_overview ).
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
render_header_bar( ri_html ).
zcl_abapgit_exit=>get_instance( )->wall_message_list( ri_html ).
render_table( ii_html = ri_html
it_overview = mt_overview ).
register_deferred_script( render_scripts( ) ).
ENDMETHOD.
METHOD _add_column.
FIELD-SYMBOLS <ls_col> LIKE LINE OF mt_col_spec.
APPEND INITIAL LINE TO mt_col_spec ASSIGNING <ls_col>.
<ls_col>-display_name = iv_display_name.
<ls_col>-tech_name = iv_tech_name.
<ls_col>-title = iv_title.
<ls_col>-css_class = iv_css_class.
<ls_col>-add_tz = iv_add_tz.
<ls_col>-allow_order_by = iv_allow_order_by.
ENDMETHOD.
METHOD column.
IF iv_css_class IS NOT INITIAL.
rv_html = |<td class="{ iv_css_class }">| && iv_content && |</td>|.
ELSE.
rv_html = |<td>| && iv_content && |</td>|.
ENDIF.
ENDMETHOD.
METHOD action_link.
rv_html = |<span class="action_link">| && iv_content && |</span>|.
ENDMETHOD.
METHOD set_only_favorites.
mv_only_favorites = iv_only_favorites.
ENDMETHOD.
METHOD get_only_favorites.
rv_result = mv_only_favorites.
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
260,
7501,
62,
2502,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
42895,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
13287,
540,
764,
628,
220,
220,
220,
42865,
285,
85,
62,
2875,
62,
1525,
41876,
4731,
20832,
12,
1340,
11319,
764,
198,
220,
220,
220,
42865,
285,
85,
62,
8807,
62,
69,
5570,
2737,
220,
220,
41876,
450,
499,
62,
30388,
20832,
12,
1340,
11319,
13,
628,
220,
220,
220,
337,
36252,
50,
23772,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
8807,
62,
69,
5570,
2737,
41876,
450,
499,
62,
30388,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
764,
198,
220,
220,
220,
337,
36252,
50,
900,
62,
2875,
62,
1525,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2875,
62,
1525,
41876,
4731,
764,
198,
220,
220,
220,
337,
36252,
50,
900,
62,
2875,
62,
37295,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
2875,
62,
20147,
1571,
41876,
450,
499,
62,
30388,
764,
198,
220,
220,
220,
337,
36252,
50,
900,
62,
24455,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
340,
62,
7353,
7890,
41876,
1976,
361,
62,
397,
499,
18300,
62,
6494,
62,
1177,
263,
14804,
774,
62,
7353,
62,
7890,
764,
198,
220,
220,
220,
337,
36252,
50,
900,
62,
8807,
62,
69,
5570,
2737,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
8807,
62,
69,
5570,
2737,
41876,
450,
499,
62,
30388,
13,
198,
220,
220,
220,
337,
36252,
50,
198,
220,
220,
220,
220,
220,
651,
62,
8807,
62,
69,
5570,
2737,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
20274,
8,
41876,
450,
499,
62,
30388,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
628,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
2502,
1177,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4004,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
366,
0,
6407,
329,
18043,
11,
3991,
329,
2691,
29924,
198,
220,
220,
220,
220,
220,
220,
220,
2099,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1994,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
19276,
13274,
14804,
774,
62,
8367,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
19016,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5301,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1614,
4871,
11,
198,
220,
220,
220,
220,
220,
220,
220,
8478,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2727,
62,
1525,
220,
220,
220,
220,
220,
41876,
2124,
549,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2727,
62,
265,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
748,
48499,
1143,
62,
1525,
41876,
2124,
549,
3672,
11,
198,
220,
220,
220,
220,
220,
220,
220,
748,
48499,
1143,
62,
265,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3551,
62,
24326,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
2502,
1177,
11,
198,
220,
220,
220,
220,
220,
1259,
62,
2502,
33571,
41876,
49053,
9795,
43679,
3963,
1259,
62,
2502,
1177,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13315,
44521,
12,
4944,
33866,
8924,
5550,
38865,
35374,
13,
198,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
269,
62,
2673,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2922,
220,
220,
220,
220,
220,
220,
41876,
4731,
26173,
8924,
705,
19738,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
4174,
62,
24455,
41876,
4731,
26173,
8924,
705,
39014,
62,
24455,
3256,
198,
220,
220,
220,
220,
220,
23578,
3963,
269,
62,
2673,
764,
628,
220,
220,
220,
42865,
25,
285,
85,
62,
2875,
62,
20147,
1571,
41876,
450,
499,
62,
30388,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
85,
62,
24455,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
85,
62,
2435,
62,
11340,
220,
220,
220,
220,
220,
220,
220,
41876,
640,
11340,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45079,
62,
4033,
62,
16684,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
4033,
62,
16684,
62,
926,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45079,
62,
2502,
1177,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1259,
62,
2502,
33571,
13,
628,
220,
220,
220,
337,
36252,
50,
25,
8543,
62,
5239,
62,
15414,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
3672,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
*---------------------------------------------------------------------*
* view related data declarations
* generation date: 09.01.2021 at 16:42:55
* view maintenance generator version: #001407#
*---------------------------------------------------------------------*
*...processing: ZAMPV_CONFIG_PRO................................*
TABLES: ZAMPV_CONFIG_PRO, *ZAMPV_CONFIG_PRO. "view work areas
CONTROLS: TCTRL_ZAMPV_CONFIG_PRO
TYPE TABLEVIEW USING SCREEN '0002'.
DATA: BEGIN OF STATUS_ZAMPV_CONFIG_PRO. "state vector
INCLUDE STRUCTURE VIMSTATUS.
DATA: END OF STATUS_ZAMPV_CONFIG_PRO.
* Table for entries selected to show on screen
DATA: BEGIN OF ZAMPV_CONFIG_PRO_EXTRACT OCCURS 0010.
INCLUDE STRUCTURE ZAMPV_CONFIG_PRO.
INCLUDE STRUCTURE VIMFLAGTAB.
DATA: END OF ZAMPV_CONFIG_PRO_EXTRACT.
* Table for all entries loaded from database
DATA: BEGIN OF ZAMPV_CONFIG_PRO_TOTAL OCCURS 0010.
INCLUDE STRUCTURE ZAMPV_CONFIG_PRO.
INCLUDE STRUCTURE VIMFLAGTAB.
DATA: END OF ZAMPV_CONFIG_PRO_TOTAL.
*...processing: ZAMPV_CONFIG_SCE................................*
TABLES: ZAMPV_CONFIG_SCE, *ZAMPV_CONFIG_SCE. "view work areas
CONTROLS: TCTRL_ZAMPV_CONFIG_SCE
TYPE TABLEVIEW USING SCREEN '0001'.
DATA: BEGIN OF STATUS_ZAMPV_CONFIG_SCE. "state vector
INCLUDE STRUCTURE VIMSTATUS.
DATA: END OF STATUS_ZAMPV_CONFIG_SCE.
* Table for entries selected to show on screen
DATA: BEGIN OF ZAMPV_CONFIG_SCE_EXTRACT OCCURS 0010.
INCLUDE STRUCTURE ZAMPV_CONFIG_SCE.
INCLUDE STRUCTURE VIMFLAGTAB.
DATA: END OF ZAMPV_CONFIG_SCE_EXTRACT.
* Table for all entries loaded from database
DATA: BEGIN OF ZAMPV_CONFIG_SCE_TOTAL OCCURS 0010.
INCLUDE STRUCTURE ZAMPV_CONFIG_SCE.
INCLUDE STRUCTURE VIMFLAGTAB.
DATA: END OF ZAMPV_CONFIG_SCE_TOTAL.
*.........table declarations:.................................*
TABLES: ZAMP_CONFIG_PROV .
TABLES: ZAMP_CONFIG_SCEN .
| [
9,
10097,
30934,
9,
198,
9,
220,
220,
220,
1570,
3519,
1366,
31713,
198,
9,
220,
220,
5270,
3128,
25,
7769,
13,
486,
13,
1238,
2481,
379,
1467,
25,
3682,
25,
2816,
198,
9,
220,
220,
1570,
9262,
17301,
2196,
25,
1303,
405,
1415,
2998,
2,
198,
9,
10097,
30934,
9,
198,
9,
986,
36948,
25,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
8864,
9,
198,
5603,
9148,
1546,
25,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
11,
1635,
57,
23518,
53,
62,
10943,
16254,
62,
31190,
13,
366,
1177,
670,
3006,
198,
10943,
5446,
3535,
50,
25,
309,
4177,
7836,
62,
57,
23518,
53,
62,
10943,
16254,
62,
31190,
198,
25216,
43679,
28206,
1294,
2751,
6374,
2200,
1677,
705,
34215,
4458,
198,
26947,
25,
347,
43312,
3963,
15486,
2937,
62,
57,
23518,
53,
62,
10943,
16254,
62,
31190,
13,
366,
5219,
15879,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3268,
5097,
52,
7206,
19269,
18415,
11335,
569,
3955,
35744,
2937,
13,
198,
26947,
25,
23578,
3963,
15486,
2937,
62,
57,
23518,
53,
62,
10943,
16254,
62,
31190,
13,
198,
9,
8655,
329,
12784,
6163,
284,
905,
319,
3159,
198,
26947,
25,
347,
43312,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
62,
6369,
5446,
10659,
440,
4093,
4261,
50,
3571,
940,
13,
198,
1268,
5097,
52,
7206,
19269,
18415,
11335,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3268,
5097,
52,
7206,
19269,
18415,
11335,
569,
3955,
38948,
5603,
33,
13,
198,
26947,
25,
23578,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
62,
6369,
5446,
10659,
13,
198,
9,
8655,
329,
477,
12784,
9639,
422,
6831,
198,
26947,
25,
347,
43312,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
62,
51,
27510,
440,
4093,
4261,
50,
3571,
940,
13,
198,
1268,
5097,
52,
7206,
19269,
18415,
11335,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3268,
5097,
52,
7206,
19269,
18415,
11335,
569,
3955,
38948,
5603,
33,
13,
198,
26947,
25,
23578,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
31190,
62,
51,
27510,
13,
198,
198,
9,
986,
36948,
25,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
8864,
9,
198,
5603,
9148,
1546,
25,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
11,
1635,
57,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
13,
366,
1177,
670,
3006,
198,
10943,
5446,
3535,
50,
25,
309,
4177,
7836,
62,
57,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
198,
25216,
43679,
28206,
1294,
2751,
6374,
2200,
1677,
705,
18005,
4458,
198,
26947,
25,
347,
43312,
3963,
15486,
2937,
62,
57,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
13,
366,
5219,
15879,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3268,
5097,
52,
7206,
19269,
18415,
11335,
569,
3955,
35744,
2937,
13,
198,
26947,
25,
23578,
3963,
15486,
2937,
62,
57,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
13,
198,
9,
8655,
329,
12784,
6163,
284,
905,
319,
3159,
198,
26947,
25,
347,
43312,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
62,
6369,
5446,
10659,
440,
4093,
4261,
50,
3571,
940,
13,
198,
1268,
5097,
52,
7206,
19269,
18415,
11335,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3268,
5097,
52,
7206,
19269,
18415,
11335,
569,
3955,
38948,
5603,
33,
13,
198,
26947,
25,
23578,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
62,
6369,
5446,
10659,
13,
198,
9,
8655,
329,
477,
12784,
9639,
422,
6831,
198,
26947,
25,
347,
43312,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
62,
51,
27510,
440,
4093,
4261,
50,
3571,
940,
13,
198,
1268,
5097,
52,
7206,
19269,
18415,
11335,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3268,
5097,
52,
7206,
19269,
18415,
11335,
569,
3955,
38948,
5603,
33,
13,
198,
26947,
25,
23578,
3963,
1168,
23518,
53,
62,
10943,
16254,
62,
50,
5222,
62,
51,
27510,
13,
198,
198,
9,
34617,
11487,
31713,
25,
27754,
34617,
9,
198,
5603,
9148,
1546,
25,
1168,
23518,
62,
10943,
16254,
62,
41283,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
764,
198,
5603,
9148,
1546,
25,
1168,
23518,
62,
10943,
16254,
62,
6173,
1677,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
764,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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_identity(
iv_data = 'A'
iv_type = zif_abappgp_constants=>c_sub_type-policy_uri ).
ENDMETHOD.
ENDCLASS.
| [
31631,
300,
83,
565,
62,
9288,
5550,
20032,
17941,
7473,
43001,
2751,
360,
4261,
6234,
6006,
9863,
45698,
42,
49277,
43638,
5805,
7597,
25261,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
337,
36252,
50,
25,
1332,
7473,
43001,
2751,
13,
198,
198,
10619,
31631,
13,
220,
220,
220,
220,
220,
220,
366,
2528,
565,
62,
14402,
198,
198,
31631,
300,
83,
565,
62,
9288,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
1332,
13,
628,
220,
220,
220,
1976,
565,
62,
397,
1324,
31197,
62,
20850,
62,
9288,
14804,
7266,
8002,
316,
62,
738,
414,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
7890,
796,
705,
32,
6,
198,
220,
220,
220,
220,
220,
21628,
62,
4906,
796,
1976,
361,
62,
397,
1324,
31197,
62,
9979,
1187,
14804,
66,
62,
7266,
62,
4906,
12,
30586,
62,
9900,
6739,
628,
220,
23578,
49273,
13,
198,
198,
10619,
31631,
13,
198
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS FINAL.
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
DATA mo_cut TYPE REF TO ycl_advent2020_day01.
DATA m_input TYPE string_table.
METHODS setup.
METHODS given_the_example.
METHODS given_the_input.
METHODS part_one_example FOR TESTING.
METHODS part_one_input FOR TESTING.
METHODS part_two_example FOR TESTING.
METHODS part_two_input FOR TESTING.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD setup.
mo_cut = NEW #( ).
ENDMETHOD.
METHOD part_one_example.
given_the_example( ).
DATA(act) = mo_cut->solve_part_one( m_input ).
cl_abap_unit_assert=>assert_equals( exp = 514579
act = act ).
ENDMETHOD.
METHOD part_one_input.
given_the_input( ).
DATA(act) = mo_cut->solve_part_one( m_input ).
cl_abap_unit_assert=>assert_equals( exp = 55776
act = act ).
ENDMETHOD.
METHOD part_two_example.
given_the_example( ).
DATA(act) = mo_cut->solve_part_two( m_input ).
cl_abap_unit_assert=>assert_equals( exp = 241861950
act = act ).
ENDMETHOD.
METHOD part_two_input.
given_the_input( ).
DATA(act) = mo_cut->solve_part_two( m_input ).
cl_abap_unit_assert=>assert_equals( exp = 223162626
act = act ).
ENDMETHOD.
METHOD given_the_example.
m_input = VALUE #(
( |1721| )
( |979| )
( |366| )
( |299| )
( |675| )
( |1456| ) ).
ENDMETHOD.
METHOD given_the_input.
m_input = VALUE #(
( |1645| )
( |1995| )
( |1658| )
( |1062| )
( |1472| )
( |1710| )
( |1424| )
( |1823| )
( |1518| )
( |1656| )
( |1811| )
( |1511| )
( |1320| )
( |1521| )
( |1395| )
( |1996| )
( |1724| )
( |1666| )
( |1637| )
( |1504| )
( |1766| )
( |534| )
( |1738| )
( |1791| )
( |1372| )
( |1225| )
( |1690| )
( |1949| )
( |1495| )
( |1436| )
( |1166| )
( |1686| )
( |1861| )
( |1889| )
( |1887| )
( |997| )
( |1202| )
( |1478| )
( |833| )
( |1497| )
( |1459| )
( |1717| )
( |1272| )
( |1047| )
( |1751| )
( |1549| )
( |1204| )
( |1230| )
( |1260| )
( |1611| )
( |1506| )
( |1648| )
( |1354| )
( |1415| )
( |1615| )
( |1327| )
( |1622| )
( |1592| )
( |1807| )
( |1601| )
( |1026| )
( |1757| )
( |1376| )
( |1707| )
( |1514| )
( |1905| )
( |1660| )
( |1578| )
( |1963| )
( |1292| )
( |390| )
( |1898| )
( |1019| )
( |1580| )
( |1499| )
( |1830| )
( |1801| )
( |1881| )
( |1764| )
( |1442| )
( |1838| )
( |1088| )
( |1087| )
( |1040| )
( |1349| )
( |1644| )
( |1908| )
( |1697| )
( |1115| )
( |1178| )
( |1224| )
( |1810| )
( |1445| )
( |1594| )
( |1894| )
( |1287| )
( |1676| )
( |1435| )
( |1294| )
( |1796| )
( |1350| )
( |1685| )
( |1118| )
( |1488| )
( |1726| )
( |1696| )
( |1190| )
( |1538| )
( |1780| )
( |1806| )
( |1207| )
( |1346| )
( |1705| )
( |983| )
( |1249| )
( |1455| )
( |2002| )
( |1466| )
( |1723| )
( |1227| )
( |1390| )
( |1281| )
( |1715| )
( |1603| )
( |1862| )
( |1744| )
( |1774| )
( |1385| )
( |1312| )
( |1654| )
( |1872| )
( |1142| )
( |1273| )
( |1508| )
( |1639| )
( |1827| )
( |1461| )
( |1795| )
( |1533| )
( |1304| )
( |1417| )
( |1984| )
( |28| )
( |1693| )
( |1951| )
( |1391| )
( |1931| )
( |1179| )
( |1278| )
( |1400| )
( |1361| )
( |1369| )
( |1343| )
( |1416| )
( |1426| )
( |314| )
( |1510| )
( |1933| )
( |1239| )
( |1218| )
( |1918| )
( |1797| )
( |1255| )
( |1399| )
( |1229| )
( |723| )
( |1992| )
( |1595| )
( |1191| )
( |1916| )
( |1525| )
( |1605| )
( |1524| )
( |1869| )
( |1652| )
( |1874| )
( |1756| )
( |1246| )
( |1310| )
( |1219| )
( |1482| )
( |1429| )
( |1244| )
( |1554| )
( |1575| )
( |1123| )
( |1194| )
( |1408| )
( |1917| )
( |1613| )
( |1773| )
( |1809| )
( |1987| )
( |1733| )
( |1844| )
( |1423| )
( |1718| )
( |1714| )
( |1923| )
( |1503| ) ).
ENDMETHOD.
ENDCLASS.
| [
31631,
300,
83,
565,
62,
9288,
5550,
20032,
17941,
7473,
43001,
2751,
198,
220,
360,
4261,
6234,
6006,
9863,
198,
220,
45698,
42,
49277,
43638,
5805,
7597,
25261,
13,
628,
220,
44731,
44513,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
42865,
6941,
62,
8968,
41876,
4526,
37,
5390,
331,
565,
62,
324,
1151,
42334,
62,
820,
486,
13,
198,
220,
220,
220,
42865,
285,
62,
15414,
41876,
4731,
62,
11487,
13,
628,
220,
220,
220,
337,
36252,
50,
9058,
13,
198,
220,
220,
220,
337,
36252,
50,
1813,
62,
1169,
62,
20688,
13,
198,
220,
220,
220,
337,
36252,
50,
1813,
62,
1169,
62,
15414,
13,
628,
220,
220,
220,
337,
36252,
50,
636,
62,
505,
62,
20688,
7473,
43001,
2751,
13,
198,
220,
220,
220,
337,
36252,
50,
636,
62,
505,
62,
15414,
7473,
43001,
2751,
13,
628,
220,
220,
220,
337,
36252,
50,
636,
62,
11545,
62,
20688,
7473,
43001,
2751,
13,
198,
220,
220,
220,
337,
36252,
50,
636,
62,
11545,
62,
15414,
7473,
43001,
2751,
13,
198,
198,
10619,
31631,
13,
198,
198,
31631,
300,
83,
565,
62,
9288,
30023,
2538,
10979,
6234,
13,
628,
220,
337,
36252,
9058,
13,
198,
220,
220,
220,
6941,
62,
8968,
796,
12682,
1303,
7,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
636,
62,
505,
62,
20688,
13,
198,
220,
220,
220,
1813,
62,
1169,
62,
20688,
7,
6739,
198,
220,
220,
220,
42865,
7,
529,
8,
796,
6941,
62,
8968,
3784,
82,
6442,
62,
3911,
62,
505,
7,
285,
62,
15414,
6739,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
4853,
874,
7,
1033,
796,
642,
1415,
41734,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
796,
719,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
636,
62,
505,
62,
15414,
13,
198,
220,
220,
220,
1813,
62,
1169,
62,
15414,
7,
6739,
198,
220,
220,
220,
42865,
7,
529,
8,
796,
6941,
62,
8968,
3784,
82,
6442,
62,
3911,
62,
505,
7,
285,
62,
15414,
6739,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
4853,
874,
7,
1033,
796,
5996,
39509,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
796,
719,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
636,
62,
11545,
62,
20688,
13,
198,
220,
220,
220,
1813,
62,
1169,
62,
20688,
7,
6739,
628,
220,
220,
220,
42865,
7,
529,
8,
796,
6941,
62,
8968,
3784,
82,
6442,
62,
3911,
62,
11545,
7,
285,
62,
15414,
6739,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
4853,
874,
7,
1033,
796,
1987,
25096,
42751,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
796,
719,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
636,
62,
11545,
62,
15414,
13,
198,
220,
220,
220,
1813,
62,
1169,
62,
15414,
7,
6739,
198,
220,
220,
220,
42865,
7,
529,
8,
796,
6941,
62,
8968,
3784,
82,
6442,
62,
3911,
62,
11545,
7,
285,
62,
15414,
6739,
198,
220,
220,
220,
537,
62,
397,
499,
62,
20850,
62,
30493,
14804,
30493,
62,
4853,
874,
7,
1033,
796,
30299,
1433,
2075,
2075,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
719,
796,
719,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1813,
62,
1169,
62,
20688,
13,
198,
220,
220,
220,
285,
62,
15414,
796,
26173,
8924,
1303,
7,
198,
220,
220,
220,
220,
220,
357,
930,
1558,
2481,
91,
1267,
198,
220,
220,
220,
220,
220,
357,
930,
24,
3720,
91,
1267,
198,
220,
220,
220,
220,
220,
357,
930,
32459,
91,
1267,
198,
220,
220,
220,
220,
220,
357,
930,
22579,
91,
1267,
198,
220,
220,
220,
220,
220,
357,
930,
42444,
91,
1267,
198,
220,
220,
220,
220,
220,
357,
930,
1415,
3980,
91,
1267,
6739,
198,
220,
23578,
49273,
13,
628,
220,
337,
36252,
1813,
62,
1169,
62,
15414,
13,
198,
220,
220,
220,
285,
62,
15414,
796,
26173,
8924,
1303,
7,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1433,
2231,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
21908,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1433,
3365,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
940,
5237,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1415,
4761,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1558,
940,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1415,
1731,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1507,
1954,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1314,
1507,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1433,
3980,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1507,
1157,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1314,
1157,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1485,
1238,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1314,
2481,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
1485,
3865,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357,
930,
22288,
91,
1267,
198,
220,
220,
220,
220,
220,
220,
357
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_gui_page_tutorial DEFINITION
PUBLIC
FINAL
INHERITING FROM zcl_abapgit_gui_component
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES zif_abapgit_gui_renderable.
CLASS-METHODS create
RETURNING
VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable
RAISING
zcx_abapgit_exception.
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS build_main_menu
RETURNING
VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_TUTORIAL IMPLEMENTATION.
METHOD build_main_menu.
CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-main'.
ro_menu->add(
iv_txt = zcl_abapgit_gui_buttons=>repo_list( )
iv_act = zif_abapgit_definitions=>c_action-abapgit_home
)->add(
iv_txt = zcl_abapgit_gui_buttons=>new_online( )
iv_act = zif_abapgit_definitions=>c_action-repo_newonline
)->add(
iv_txt = zcl_abapgit_gui_buttons=>new_offline( )
iv_act = zif_abapgit_definitions=>c_action-repo_newoffline
)->add(
iv_txt = zcl_abapgit_gui_buttons=>settings( )
iv_act = zif_abapgit_definitions=>c_action-go_settings
)->add(
iv_txt = zcl_abapgit_gui_buttons=>advanced( )
iv_title = 'Utilities'
io_sub = zcl_abapgit_gui_chunk_lib=>advanced_submenu( )
)->add(
iv_txt = zcl_abapgit_gui_buttons=>help( )
iv_title = 'Help'
io_sub = zcl_abapgit_gui_chunk_lib=>help_submenu( ) ).
ENDMETHOD.
METHOD create.
DATA lo_component TYPE REF TO zcl_abapgit_gui_page_tutorial.
CREATE OBJECT lo_component.
ri_page = zcl_abapgit_gui_page_hoc=>create(
iv_page_title = 'Tutorial'
io_page_menu = build_main_menu( )
ii_child_component = lo_component ).
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<div class="tutorial">' ).
ri_html->add( '<h1>Tutorial</h1>' ).
ri_html->add( '<hr>' ).
ri_html->add( '<h2>Online repositories</h2>' ).
ri_html->add( '<p><ul>' ).
ri_html->add( `<li>To clone a remote repository (e.g. from github) click ` ).
ri_html->add_a( iv_txt = zcl_abapgit_gui_buttons=>new_online( )
iv_act = zif_abapgit_definitions=>c_action-repo_newonline ).
ri_html->add( ' from the top menu. This will link a remote repository with a package on your system.</li>' ).
ri_html->add( '<li>Use the pull button to retrieve and activate the remote objects.</li>' ).
ri_html->add( '<li>If the remote repository is updated,' ).
ri_html->add( ' you will see the changes and can pull to apply the updates.</li>' ).
ri_html->add( '</ul></p>' ).
ri_html->add( '<h2>Offline repositories</h2>' ).
ri_html->add( '<p><ul>' ).
ri_html->add( `<li>To add a package as an offline repository, click ` ).
ri_html->add_a( iv_txt = zcl_abapgit_gui_buttons=>new_offline( )
iv_act = zif_abapgit_definitions=>c_action-repo_newoffline ).
ri_html->add( ' from the top menu.' ).
ri_html->add( '<li>abapGit will start tracking changes for the package ' ).
ri_html->add( 'without linking it to an online git repository.</li>' ).
ri_html->add( '<li>You can link the package later or just export the package content as a ZIP file.</li>' ).
ri_html->add( '</ul></p>' ).
ri_html->add( '</ul></p>' ).
ri_html->add( '<h2>Repository list and favorites</h2>' ).
ri_html->add( '<p><ul>' ).
ri_html->add( |<li>To favorite a repository, use the {
ri_html->icon( 'star/darkgrey' ) } icon in the repository list.</li>| ).
ri_html->add( |<li>To go to a repository, click on the repository name.</li>| ).
ri_html->add( |<li>To go back to your favorites, use the| ).
ri_html->add_a(
iv_txt = zcl_abapgit_gui_buttons=>repo_list( )
iv_act = zif_abapgit_definitions=>c_action-abapgit_home ).
ri_html->add( |</li>| ).
ri_html->add( `<li>` ).
ri_html->add_a( iv_txt = 'Explore'
iv_act = zif_abapgit_definitions=>c_action-go_explore ).
ri_html->add( ' to find projects using abapGit</li>' ).
ri_html->add( '</ul></p>' ).
ri_html->add( '</div>' ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
83,
44917,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
3268,
16879,
2043,
2751,
16034,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
42895,
198,
220,
29244,
6158,
44731,
13,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
13287,
540,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
2251,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
380,
62,
7700,
8,
41876,
4526,
37,
5390,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
13287,
540,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
48006,
9782,
1961,
44513,
13,
628,
220,
4810,
3824,
6158,
44513,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
1382,
62,
12417,
62,
26272,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
305,
62,
26272,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
6494,
62,
25981,
5657,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
40156,
62,
4537,
8264,
62,
51,
3843,
1581,
12576,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
1382,
62,
12417,
62,
26272,
13,
628,
220,
220,
220,
29244,
6158,
25334,
23680,
686,
62,
26272,
7788,
15490,
2751,
21628,
62,
312,
796,
705,
25981,
5657,
12,
12417,
4458,
628,
220,
220,
220,
686,
62,
26272,
3784,
2860,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
14116,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
4360,
27288,
14804,
260,
7501,
62,
4868,
7,
1267,
198,
220,
220,
220,
220,
220,
21628,
62,
529,
796,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
66,
62,
2673,
12,
397,
499,
18300,
62,
11195,
198,
220,
220,
220,
1267,
3784,
2860,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
14116,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
4360,
27288,
14804,
3605,
62,
25119,
7,
1267,
198,
220,
220,
220,
220,
220,
21628,
62,
529,
796,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
66,
62,
2673,
12,
260,
7501,
62,
3605,
25119,
198,
220,
220,
220,
1267,
3784,
2860,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
14116,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
4360,
27288,
14804,
3605,
62,
2364,
1370,
7,
1267,
198,
220,
220,
220,
220,
220,
21628,
62,
529,
796,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
66,
62,
2673,
12,
260,
7501,
62,
3605,
2364,
1370,
198,
220,
220,
220,
1267,
3784,
2860,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
14116,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
4360,
27288,
14804,
33692,
7,
1267,
198,
220,
220,
220,
220,
220,
21628,
62,
529,
796,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
66,
62,
2673,
12,
2188,
62,
33692,
198,
220,
220,
220,
1267,
3784,
2860,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
14116,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
4360,
27288,
14804,
32225,
2903,
7,
1267,
198,
220,
220,
220,
220,
220,
21628,
62,
7839,
796,
705,
18274,
2410,
6,
198,
220,
220,
220,
220,
220,
33245,
62,
7266,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
354,
2954,
62,
8019,
14804,
32225,
2903,
62,
7266,
26272,
7,
1267,
198,
220,
220,
220,
1267,
3784,
2860,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
14116,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
4360,
27288,
14804,
16794,
7,
1267,
198,
220,
220,
220,
220,
220,
21628,
62,
7839,
796,
705,
22087,
6,
198,
220,
220,
220,
220,
220,
33245,
62,
7266,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
354,
2954,
62,
8019,
14804,
16794,
62,
7266,
26272,
7,
1267,
6739,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
2251,
13,
628,
220,
220,
220,
42865,
2376,
62,
42895,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
83,
44917,
13,
628,
220,
220,
220,
29244,
6158,
25334,
23680,
2376,
62,
42895,
13,
628,
220,
220,
220,
374,
72,
62,
7700,
796,
1976,
565,
62,
397,
499,
18300,
62,
48317,
62,
7700,
62,
71,
420,
14804,
17953,
7,
198,
220,
220,
220,
220,
220,
21628,
62,
7700,
62,
7839,
220,
220,
220,
220,
220,
796,
705,
51,
44917,
6,
198,
220,
220,
220,
220,
220,
33245,
62,
7700,
62,
26272,
220,
220,
220,
220,
220,
220,
796,
1382,
62,
12417,
62,
26272,
7,
1267,
198,
220,
220,
220,
220,
220,
21065,
62,
9410,
62,
42895,
796,
2376,
62,
42895,
6739,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
1976,
361,
62,
397,
499,
18300,
62,
48317,
62,
13287,
540,
93,
13287,
13,
628,
220,
220,
220,
29244,
6158,
25334,
23680,
374,
72,
62,
6494,
41876,
1976,
565,
62,
397,
499,
18300,
62,
6494,
13,
628,
220,
220,
220,
374,
72,
62,
6494,
3784,
2860,
7,
705,
27,
7146,
1398,
2625,
83,
44917,
5320,
6,
6739,
628,
220,
220,
220,
374,
72,
62,
6494,
3784,
2860,
7,
705,
27,
71,
16,
29,
51,
44917,
3556,
71,
16,
29,
6,
6739,
198,
220,
220,
220,
374,
72,
62,
6494,
3784,
2860,
7,
705,
27,
11840,
29,
6,
6739,
628,
220,
220,
220,
374,
72,
62,
6494,
3784,
2860,
7,
705,
27,
71,
17,
29,
14439,
38072,
3556,
71,
17,
29,
6,
6739,
198,
220,
220,
220,
374,
72,
62,
6494,
3784,
2860,
7,
705,
27,
79,
6927,
377,
29,
6,
6739,
628,
220,
220,
220,
374,
72,
62,
6494,
3784,
2860,
7,
4600,
27,
4528,
29,
2514,
17271,
257,
6569,
16099,
357,
68,
13,
70,
13,
422,
33084,
8,
3904,
4600,
6739,
198,
220,
220,
220,
374,
72,
62,
6494,
3784,
2860,
62,
64
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_git_transport DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
* remote to local
CLASS-METHODS upload_pack
IMPORTING iv_url TYPE string
iv_branch_name TYPE string
iv_deepen TYPE abap_bool DEFAULT abap_true
it_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt OPTIONAL
EXPORTING et_objects TYPE zif_abapgit_definitions=>ty_objects_tt
ev_branch TYPE zif_abapgit_definitions=>ty_sha1
eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list
RAISING zcx_abapgit_exception.
* local to remote
CLASS-METHODS receive_pack
IMPORTING iv_url TYPE string
iv_old TYPE zif_abapgit_definitions=>ty_sha1
iv_new TYPE zif_abapgit_definitions=>ty_sha1
iv_branch_name TYPE string
iv_pack TYPE xstring
RAISING zcx_abapgit_exception.
CLASS-METHODS branches
IMPORTING iv_url TYPE string
RETURNING VALUE(ro_branch_list) TYPE REF TO zcl_abapgit_git_branch_list
RAISING zcx_abapgit_exception.
PRIVATE SECTION.
CONSTANTS: BEGIN OF c_service,
receive TYPE string VALUE 'receive', "#EC NOTEXT
upload TYPE string VALUE 'upload', "#EC NOTEXT
END OF c_service.
CONSTANTS: BEGIN OF c_smart_response_check,
BEGIN OF get_refs,
content_regex TYPE string VALUE '^[0-9a-f]{4}#',
content_type TYPE string VALUE 'application/x-git-<service>-pack-advertisement',
END OF get_refs,
END OF c_smart_response_check.
CLASS-METHODS branch_list
IMPORTING iv_url TYPE string
iv_service TYPE string
EXPORTING eo_client TYPE REF TO zcl_abapgit_http_client
eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list
RAISING zcx_abapgit_exception.
CLASS-METHODS find_branch
IMPORTING iv_url TYPE string
iv_service TYPE string
iv_branch_name TYPE string
EXPORTING eo_client TYPE REF TO zcl_abapgit_http_client
ev_branch TYPE zif_abapgit_definitions=>ty_sha1
eo_branch_list TYPE REF TO zcl_abapgit_git_branch_list
RAISING zcx_abapgit_exception.
CLASS-METHODS parse
EXPORTING ev_pack TYPE xstring
CHANGING cv_data TYPE xstring
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_git_transport IMPLEMENTATION.
METHOD branches.
DATA: lo_client TYPE REF TO zcl_abapgit_http_client.
branch_list(
EXPORTING
iv_url = iv_url
iv_service = c_service-upload
IMPORTING
eo_client = lo_client
eo_branch_list = ro_branch_list ).
lo_client->close( ).
ENDMETHOD.
METHOD branch_list.
DATA: lv_data TYPE string.
DATA: lv_expected_content_type TYPE string.
eo_client = zcl_abapgit_http=>create_by_url(
iv_url = iv_url
iv_service = iv_service ).
lv_expected_content_type = c_smart_response_check-get_refs-content_type.
REPLACE '<service>' IN lv_expected_content_type WITH iv_service.
eo_client->check_smart_response(
iv_expected_content_type = lv_expected_content_type
iv_content_regex = c_smart_response_check-get_refs-content_regex ).
lv_data = eo_client->get_cdata( ).
CREATE OBJECT eo_branch_list
EXPORTING
iv_data = lv_data.
ENDMETHOD.
METHOD find_branch.
branch_list(
EXPORTING
iv_url = iv_url
iv_service = iv_service
IMPORTING
eo_client = eo_client
eo_branch_list = eo_branch_list ).
IF ev_branch IS SUPPLIED.
ev_branch = eo_branch_list->find_by_name( iv_branch_name )-sha1.
ENDIF.
ENDMETHOD.
METHOD parse.
CONSTANTS: lc_band1 TYPE x VALUE '01'.
DATA: lv_len TYPE i,
lv_contents TYPE xstring,
lv_pack TYPE xstring.
WHILE xstrlen( cv_data ) >= 4.
lv_len = zcl_abapgit_git_utils=>length_utf8_hex( cv_data ).
IF lv_len > xstrlen( cv_data ).
zcx_abapgit_exception=>raise( 'parse, string length too large' ).
ENDIF.
lv_contents = cv_data(lv_len).
IF lv_len = 0.
cv_data = cv_data+4.
CONTINUE.
ELSE.
cv_data = cv_data+lv_len.
ENDIF.
lv_contents = lv_contents+4.
IF xstrlen( lv_contents ) > 1 AND lv_contents(1) = lc_band1.
CONCATENATE lv_pack lv_contents+1 INTO lv_pack IN BYTE MODE.
ENDIF.
ENDWHILE.
ev_pack = lv_pack.
ENDMETHOD.
METHOD receive_pack.
DATA: lo_client TYPE REF TO zcl_abapgit_http_client,
lv_cmd_pkt TYPE string,
lv_line TYPE string,
lv_tmp TYPE xstring,
lv_xstring TYPE xstring,
lv_string TYPE string,
lv_cap_list TYPE string,
lv_buffer TYPE string.
find_branch(
EXPORTING
iv_url = iv_url
iv_service = c_service-receive
iv_branch_name = iv_branch_name
IMPORTING
eo_client = lo_client ).
lo_client->set_headers(
iv_url = iv_url
iv_service = c_service-receive ).
lv_cap_list = 'report-status' ##NO_TEXT.
lv_line = iv_old &&
` ` &&
iv_new &&
` ` &&
iv_branch_name &&
zcl_abapgit_git_utils=>get_null( ) &&
` ` &&
lv_cap_list &&
zif_abapgit_definitions=>c_newline. "#EC NOTEXT
lv_cmd_pkt = zcl_abapgit_git_utils=>pkt_string( lv_line ).
lv_buffer = lv_cmd_pkt && '0000'.
lv_tmp = zcl_abapgit_convert=>string_to_xstring_utf8( lv_buffer ).
CONCATENATE lv_tmp iv_pack INTO lv_xstring IN BYTE MODE.
lv_xstring = lo_client->send_receive_close( lv_xstring ).
* todo, this part should be changed, instead of looking at texts
* parse the reply and look for the "ng" not good indicator
lv_string = zcl_abapgit_convert=>xstring_to_string_utf8( lv_xstring ).
IF NOT lv_string CP '*unpack ok*'.
zcx_abapgit_exception=>raise( 'unpack not ok' ).
ELSEIF lv_string CP '*pre-receive hook declined*'.
zcx_abapgit_exception=>raise( 'pre-receive hook declined' ).
ELSEIF lv_string CP '*push declined due to email privacy*'.
zcx_abapgit_exception=>raise( 'push declined due to email privacy' ).
ELSEIF lv_string CP '*funny refname*'.
zcx_abapgit_exception=>raise( 'funny refname' ).
ELSEIF lv_string CP '*failed to update ref*'.
zcx_abapgit_exception=>raise( 'failed to update ref' ).
ELSEIF lv_string CP '*missing necessary objects*'.
zcx_abapgit_exception=>raise( 'missing necessary objects' ).
ENDIF.
ENDMETHOD.
METHOD upload_pack.
DATA: lo_client TYPE REF TO zcl_abapgit_http_client,
lv_buffer TYPE string,
lv_xstring TYPE xstring,
lv_line TYPE string,
lv_pack TYPE xstring,
lt_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt,
lv_capa TYPE string.
FIELD-SYMBOLS: <ls_branch> LIKE LINE OF lt_branches.
CLEAR: et_objects,
ev_branch,
eo_branch_list.
find_branch(
EXPORTING
iv_url = iv_url
iv_service = c_service-upload
iv_branch_name = iv_branch_name
IMPORTING
eo_client = lo_client
eo_branch_list = eo_branch_list
ev_branch = ev_branch ).
IF it_branches IS INITIAL.
APPEND INITIAL LINE TO lt_branches ASSIGNING <ls_branch>.
<ls_branch>-sha1 = ev_branch.
ELSE.
lt_branches = it_branches.
ENDIF.
lo_client->set_headers( iv_url = iv_url
iv_service = c_service-upload ).
LOOP AT lt_branches FROM 1 ASSIGNING <ls_branch>.
IF sy-tabix = 1.
lv_capa = 'side-band-64k no-progress multi_ack' ##NO_TEXT.
lv_line = 'want' && ` ` && <ls_branch>-sha1
&& ` ` && lv_capa && zif_abapgit_definitions=>c_newline. "#EC NOTEXT
ELSE.
lv_line = 'want' && ` ` && <ls_branch>-sha1
&& zif_abapgit_definitions=>c_newline. "#EC NOTEXT
ENDIF.
lv_buffer = lv_buffer && zcl_abapgit_git_utils=>pkt_string( lv_line ).
ENDLOOP.
IF iv_deepen = abap_true.
lv_buffer = lv_buffer && zcl_abapgit_git_utils=>pkt_string( 'deepen 1'
&& zif_abapgit_definitions=>c_newline ). "#EC NOTEXT
ENDIF.
lv_buffer = lv_buffer
&& '0000'
&& '0009done' && zif_abapgit_definitions=>c_newline.
lv_xstring = lo_client->send_receive_close(
zcl_abapgit_convert=>string_to_xstring_utf8( lv_buffer ) ).
parse( IMPORTING ev_pack = lv_pack
CHANGING cv_data = lv_xstring ).
IF lv_pack IS INITIAL.
zcx_abapgit_exception=>raise( 'empty pack' ).
ENDIF.
et_objects = zcl_abapgit_git_pack=>decode( lv_pack ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
18300,
62,
7645,
634,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
9,
6569,
284,
1957,
198,
220,
220,
220,
42715,
12,
49273,
50,
9516,
62,
8002,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
6371,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
1671,
3702,
62,
3672,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
22089,
268,
220,
220,
220,
220,
220,
41876,
450,
499,
62,
30388,
5550,
38865,
450,
499,
62,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
62,
1671,
12140,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
18300,
62,
1671,
3702,
62,
4868,
62,
926,
39852,
2849,
1847,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
2123,
62,
48205,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
48205,
62,
926,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
819,
62,
1671,
3702,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
26270,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
78,
62,
1671,
3702,
62,
4868,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
18300,
62,
1671,
3702,
62,
4868,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
198,
9,
1957,
284,
6569,
198,
220,
220,
220,
42715,
12,
49273,
50,
3328,
62,
8002,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
6371,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
727,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
26270,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
3605,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
26270,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
1671,
3702,
62,
3672,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
8002,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
8841,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
13737,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
6371,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
305,
62,
1671,
3702,
62,
4868,
8,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
18300,
62,
1671,
3702,
62,
4868,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
220,
220,
1976,
66,
87,
62,
397,
499,
18300,
62,
1069,
4516,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
347,
43312,
3963,
269,
62,
15271,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3328,
41876,
4731,
26173,
8924,
705,
260,
15164,
3256,
220,
220,
220,
220,
220,
220,
25113,
2943,
5626,
13918,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9516,
220,
41876,
4731,
26173,
8924,
705,
25850,
3256,
220,
220,
220,
220,
220,
220,
220,
25113,
2943,
5626,
13918,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
269,
62,
15271,
13,
198,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
347,
43312,
3963,
269,
62,
27004,
62,
26209,
62,
9122,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
43312,
3963,
651,
62,
5420,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
260,
25636,
41876,
4731,
26173,
8924,
705,
61,
58,
15,
12,
24,
64,
12,
69,
60,
90,
19,
92,
2,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2695,
62,
4906,
220,
41876,
4731,
26173,
8924,
705,
31438,
14,
87,
12,
18300,
12,
27,
15271,
29,
12,
8002,
12,
45876,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
651,
62,
5420,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
269,
62,
27004,
62,
26209,
62,
9122,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
8478,
62,
4868,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
6371,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
15271,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
304,
78,
62,
16366,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
4023,
62,
16366,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
78,
62,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
REPORT zabaplint_run_sci NO STANDARD PAGE HEADING.
* This report depends on the cross reference generated automatically in SAP
*
* In case it you think there is an issue, run these reports in background:
* - SAPRSEUB for SAP objects
* - SAPRSEUC for Customer objects (Y*/Z*)
*
* Also to ensure that the repository is kept clean, run the abap SAPRSEUJ
* it schedules the jobs required
*
* OSS # 2752795 - Environment analysis progams and classes - use of BAdI definitions
* OSS # 2243139 - REPOSITORY_ENVIRONMENT_ALL - too few hits for enhancement implementations
*
* Note: GPA $RC is used to return status to caller
TABLES: tdevc, tadir.
PARAMETERS: p_chkv TYPE sci_chkv OBLIGATORY.
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_obje RADIOBUTTON GROUP g2.
PARAMETERS: p_type TYPE tadir-object,
p_name TYPE tadir-obj_name.
PARAMETERS: p_devc RADIOBUTTON GROUP g2.
SELECT-OPTIONS: s_devc FOR tdevc-devclass.
PARAMETERS: p_korr RADIOBUTTON GROUP g2.
SELECT-OPTIONS: s_korr FOR tadir-korrnum.
SELECTION-SCREEN: END OF BLOCK b1.
START-OF-SELECTION.
PERFORM run.
FORM run RAISING cx_static_check.
DATA: li_code_inspector TYPE REF TO zif_abaplint_code_inspector.
DATA: lt_result TYPE scit_alvlist.
DATA: lt_items_sel TYPE zif_abapgit_definitions=>ty_items_tt,
ls_item TYPE zif_abapgit_definitions=>ty_item,
lv_succ TYPE bool,
lv_error TYPE string.
DATA: lt_packages TYPE tr_devclasses,
lt_korr TYPE STANDARD TABLE OF trkorr_old,
lt_e071 TYPE TABLE OF e071,
ls_tadir TYPE tadir.
FIELD-SYMBOLS: <devc> LIKE tdevc-devclass,
<korr> TYPE trkorr_old,
<line> TYPE LINE OF scit_alvlist.
TABLES: e071.
* Validate Check Variant
zcl_abaplint_code_inspector=>validate_check_variant( p_chkv ).
CASE abap_true.
WHEN p_obje.
CLEAR ls_item.
ls_item-obj_type = p_type.
ls_item-obj_name = p_name.
APPEND ls_item TO lt_items_sel.
WHEN p_devc.
SELECT devclass FROM tdevc INTO TABLE lt_packages WHERE devclass IN s_devc.
LOOP AT lt_packages ASSIGNING <devc>.
CLEAR ls_item.
ls_item-obj_type = 'DEVC'.
ls_item-obj_name = <devc>.
APPEND ls_item TO lt_items_sel.
ENDLOOP.
WHEN p_korr.
SELECT trkorr FROM e070 INTO TABLE lt_korr WHERE trkorr IN s_korr.
IF sy-subrc <> 0.
WRITE: /,/ 'No Transport Requests found'.
RETURN.
ENDIF.
CLEAR ls_item.
LOOP AT lt_korr ASSIGNING <korr>.
SELECT * FROM e071 INTO TABLE lt_e071 WHERE trkorr = <korr>.
LOOP AT lt_e071 INTO e071.
"Convert to main objects
CALL FUNCTION 'TR_CHECK_TYPE'
EXPORTING
wi_e071 = e071
iv_translate_objname = 'X'
IMPORTING
we_tadir = ls_tadir.
IF ls_tadir-object IS NOT INITIAL AND ls_tadir-obj_name IS NOT INITIAL.
CLEAR ls_item.
ls_item-obj_type = ls_tadir-object.
ls_item-obj_name = ls_tadir-obj_name.
APPEND ls_item TO lt_items_sel.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDCASE.
* Process Code Inspector
IF lt_items_sel IS NOT INITIAL.
"remove duplicates
SORT lt_items_sel BY obj_type obj_name.
DELETE ADJACENT DUPLICATES FROM lt_items_sel.
li_code_inspector = zcl_abaplint_factory=>get_code_inspector( lt_items_sel ).
lt_result = li_code_inspector->run(
iv_variant = |{ p_chkv }|
iv_save = abap_true ).
SUMMARY.
ULINE.
WRITE: / 'Errors found by Code Inspector'.
ULINE.
DETAIL.
SET PARAMETER ID '$RC' FIELD '0'.
lv_succ = li_code_inspector->is_successful( ).
IF lv_succ = abap_true.
WRITE: /,/ 'No Errors found'.
ELSE.
LOOP AT lt_result ASSIGNING <line>.
CONCATENATE
<line>-description '-'
<line>-objname ' Line'
<line>-line ':'
<line>-text
INTO lv_error SEPARATED BY space.
WRITE: / lv_error.
ENDLOOP.
SUMMARY.
SKIP.
DATA lv_lines TYPE i.
lv_lines = lines( lt_result ).
WRITE: / 'Total errors found', lv_lines.
SET PARAMETER ID '$RC' FIELD '4'.
ENDIF.
"Show objects
SKIP.
SUMMARY.
ULINE.
WRITE: / 'Objects selected for processing'.
ULINE.
DETAIL.
LOOP AT lt_items_sel INTO ls_item.
WRITE: / ls_item-obj_type, ls_item-obj_name.
ENDLOOP.
ELSE.
SUMMARY.
WRITE: /,/ 'No objects found to process'.
ENDIF.
ENDFORM.
| [
2200,
15490,
1976,
15498,
489,
600,
62,
5143,
62,
36216,
8005,
49053,
9795,
48488,
39837,
2751,
13,
198,
9,
770,
989,
8338,
319,
262,
3272,
4941,
7560,
6338,
287,
48323,
198,
9,
198,
9,
554,
1339,
340,
345,
892,
612,
318,
281,
2071,
11,
1057,
777,
3136,
287,
4469,
25,
198,
9,
532,
48323,
49,
5188,
10526,
329,
48323,
5563,
198,
9,
532,
48323,
49,
5188,
9598,
329,
22092,
5563,
357,
56,
16208,
57,
28104,
198,
9,
198,
9,
4418,
284,
4155,
326,
262,
16099,
318,
4030,
3424,
11,
1057,
262,
450,
499,
48323,
49,
5188,
52,
41,
198,
9,
340,
24025,
262,
3946,
2672,
198,
9,
198,
9,
440,
5432,
1303,
25829,
1983,
3865,
532,
9344,
3781,
1172,
4105,
290,
6097,
532,
779,
286,
347,
2782,
40,
17336,
198,
9,
440,
5432,
1303,
26063,
18,
20219,
532,
4526,
37997,
2043,
15513,
62,
1677,
53,
4663,
1340,
10979,
62,
7036,
532,
1165,
1178,
7127,
329,
28554,
25504,
198,
9,
198,
9,
5740,
25,
45283,
720,
7397,
318,
973,
284,
1441,
3722,
284,
24955,
198,
198,
5603,
9148,
1546,
25,
256,
7959,
66,
11,
36264,
343,
13,
198,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
354,
74,
85,
41876,
20681,
62,
354,
74,
85,
440,
9148,
3528,
1404,
15513,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
25,
14277,
4061,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
25,
347,
43312,
3963,
9878,
11290,
275,
16,
13315,
8782,
10067,
37977,
2538,
40383,
12,
8298,
13,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
672,
18015,
33540,
9399,
47526,
11357,
44441,
308,
17,
13,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
4906,
41876,
36264,
343,
12,
15252,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
62,
3672,
41876,
36264,
343,
12,
26801,
62,
3672,
13,
198,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
7959,
66,
33540,
9399,
47526,
11357,
44441,
308,
17,
13,
198,
46506,
12,
3185,
51,
11053,
25,
264,
62,
7959,
66,
7473,
256,
7959,
66,
12,
7959,
4871,
13,
198,
198,
27082,
2390,
2767,
4877,
25,
279,
62,
74,
38890,
33540,
9399,
47526,
11357,
44441,
308,
17,
13,
198,
46506,
12,
3185,
51,
11053,
25,
264,
62,
74,
38890,
7473,
36264,
343,
12,
74,
38890,
22510,
13,
198,
46506,
2849,
12,
6173,
2200,
1677,
25,
23578,
3963,
9878,
11290,
275,
16,
13,
198,
198,
2257,
7227,
12,
19238,
12,
46506,
2849,
13,
198,
220,
19878,
21389,
1057,
13,
198,
198,
21389,
1057,
17926,
1797,
2751,
43213,
62,
12708,
62,
9122,
13,
628,
220,
42865,
25,
7649,
62,
8189,
62,
1040,
806,
273,
41876,
4526,
37,
5390,
1976,
361,
62,
15498,
489,
600,
62,
8189,
62,
1040,
806,
273,
13,
198,
220,
42865,
25,
300,
83,
62,
20274,
220,
220,
220,
220,
41876,
629,
270,
62,
282,
85,
4868,
13,
628,
220,
42865,
25,
300,
83,
62,
23814,
62,
741,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
23814,
62,
926,
11,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
9186,
220,
220,
220,
220,
220,
41876,
1976,
361,
62,
397,
499,
18300,
62,
4299,
50101,
14804,
774,
62,
9186,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
2385,
535,
220,
220,
220,
220,
220,
41876,
20512,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
18224,
220,
220,
220,
220,
41876,
4731,
13,
628,
220,
42865,
25,
300,
83,
62,
43789,
41876,
491,
62,
7959,
37724,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
74,
38890,
220,
220,
220,
220,
41876,
49053,
9795,
43679,
3963,
491,
74,
38890,
62,
727,
11,
198,
220,
220,
220,
220,
220,
220,
220,
300,
83,
62,
68,
2998,
16,
220,
220,
220,
220,
41876,
43679,
3963,
304,
2998,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
83,
324,
343,
220,
220,
220,
41876,
36264,
343,
13,
628,
220,
18930,
24639,
12,
23060,
10744,
3535,
50,
25,
1279,
7959,
66,
29,
34178,
256,
7959,
66,
12,
7959,
4871,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1279,
74,
38890,
29,
41876,
491,
74,
38890,
62,
727,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1279,
1370,
29,
41876,
48920,
3963,
629,
270,
62,
282,
85,
4868,
13,
628,
220,
309,
6242,
28378,
25,
304,
2998,
16,
13,
198,
198,
9,
3254,
20540,
6822,
38215,
198,
220,
1976,
565,
62,
15498,
489,
600,
62,
8189,
62,
1040,
806,
273,
14804,
12102,
378,
62,
9122,
62,
25641,
415,
7,
279,
62,
354,
74,
85,
6739,
628,
220,
42001,
450,
499,
62,
7942,
13,
198,
220,
220,
220,
42099,
279,
62,
672,
18015,
13,
198,
220,
220,
220,
220,
220,
30301,
1503,
43979,
62,
9186,
13,
198,
220,
220,
220,
220,
220,
43979,
62,
9186,
12,
26801,
62,
4906,
796,
279,
62,
4906,
13,
198,
220,
220,
220,
220,
220,
43979,
62,
9186,
12,
26801,
62,
3672,
796,
279,
62,
3672,
13,
198,
220,
220,
220,
220,
220,
43504,
10619,
43979,
62,
9186,
5390,
300,
83,
62,
23814,
62,
741,
13,
198,
220,
220,
220,
42099,
279,
62,
7959,
66,
13,
198,
220,
220,
220,
220,
220,
33493,
1614,
4871,
16034,
256,
7959,
66,
39319,
43679,
300,
83,
62,
43789,
33411,
1614,
4871,
3268,
264,
62,
7959,
66,
13,
198,
220,
220,
220,
220,
220,
17579,
3185,
5161,
300,
83,
62,
43789,
24994,
3528,
15871,
1279,
7959,
66,
28401,
198,
220,
220,
220,
220,
220,
220,
220,
30301,
1503,
43979,
62,
9186,
13,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
9186,
12,
26801,
62,
4906,
796,
705,
7206,
15922,
4458,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
62,
9186,
12,
26801,
62,
3672,
796,
1279,
7959,
66,
28401,
198,
220,
220,
220,
220,
220,
220,
220,
43504,
10619,
43979,
62,
9186,
5390,
300,
83,
62,
23814,
62,
741,
13,
198,
220,
220,
220,
220,
220,
23578,
21982,
3185,
13,
198,
220,
220,
220,
42099,
279,
62,
74,
38890,
13,
198,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS cl_apc_tcp_client_manager DEFINITION PUBLIC.
PUBLIC SECTION.
CLASS-METHODS create
IMPORTING
i_host TYPE string
i_port TYPE string
i_frame TYPE if_abap_channel_types=>ty_apc_tcp_frame
i_event_handler TYPE REF TO if_apc_wsp_event_handler
RETURNING
VALUE(ri_client) TYPE REF TO if_apc_wsp_client
RAISING
cx_apc_error.
ENDCLASS.
CLASS cl_apc_tcp_client_manager IMPLEMENTATION.
METHOD create.
CREATE OBJECT ri_client TYPE lcl_client
EXPORTING
iv_host = i_host
iv_port = i_port
io_handler = i_event_handler.
ENDMETHOD.
ENDCLASS. | [
31631,
537,
62,
499,
66,
62,
83,
13155,
62,
16366,
62,
37153,
5550,
20032,
17941,
44731,
13,
198,
220,
44731,
44513,
13,
198,
220,
220,
220,
42715,
12,
49273,
50,
2251,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
4774,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
634,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
14535,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
611,
62,
397,
499,
62,
17620,
62,
19199,
14804,
774,
62,
499,
66,
62,
83,
13155,
62,
14535,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
15596,
62,
30281,
41876,
4526,
37,
5390,
611,
62,
499,
66,
62,
86,
2777,
62,
15596,
62,
30281,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
380,
62,
16366,
8,
41876,
4526,
37,
5390,
611,
62,
499,
66,
62,
86,
2777,
62,
16366,
198,
220,
220,
220,
220,
220,
17926,
1797,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
43213,
62,
499,
66,
62,
18224,
13,
198,
10619,
31631,
13,
198,
198,
31631,
537,
62,
499,
66,
62,
83,
13155,
62,
16366,
62,
37153,
30023,
2538,
10979,
6234,
13,
198,
220,
337,
36252,
2251,
13,
198,
220,
220,
220,
29244,
6158,
25334,
23680,
374,
72,
62,
16366,
41876,
300,
565,
62,
16366,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
4774,
220,
220,
220,
796,
1312,
62,
4774,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
634,
220,
220,
220,
796,
1312,
62,
634,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
62,
30281,
796,
1312,
62,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1,
1,
1,
1
] |
CLASS zcl_create_actions DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_create_actions IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
DATA:
lt_properties TYPE cmis_t_client_property,
ls_property LIKE LINE OF lt_properties,
ls_user TYPE string,
lo_cmis_client TYPE REF TO if_cmis_client,
ls_value LIKE LINE OF ls_property-values,
ls_content TYPE cmis_s_content_raw,
lv_print TYPE string.
**********************************************************************
* Get the CMIS Client *
**********************************************************************
lo_cmis_client = z_cl_get_cmis_client=>get_client( ).
out->write( '*-----------------------------------------------------') .
out->write( '* Executing create') .
out->write( '*-----------------------------------------------------') .
**********************************************************************
*Get the repository *
**********************************************************************
CALL METHOD lo_cmis_client->get_repository_info
EXPORTING
iv_repository_id = 'Test_Repo' "pass the id of the created repository
IMPORTING
es_repository_info = DATA(ls_repository).
**********************************************************************
*Create a folder *
**********************************************************************
ls_property-id = cl_cmis_property_ids=>object_type_id.
ls_value-string_value = cl_cmis_constants=>base_type_id-cmis_folder. "specify the type as cmis:folder
APPEND ls_value TO ls_property-values.
APPEND ls_property TO lt_properties.
CLEAR: ls_property, ls_value.
ls_property-id = cl_cmis_property_ids=>name. "specify the name of the file
ls_value-string_value = |Test{ cl_abap_context_info=>get_system_date( ) }{ cl_abap_context_info=>get_system_time( ) }|.
APPEND ls_value TO ls_property-values.
APPEND ls_property TO lt_properties.
"call create_folder
CALL METHOD lo_cmis_client->create_folder
EXPORTING
iv_repository_id = ls_repository-id
it_properties = lt_properties
iv_folder_id = ls_repository-root_folder_id
IMPORTING
es_object = DATA(ls_cmis_object).
out->write('Folder created successfully.').
out->write( '-----------------------------------------------------') .
**********************************************************************
* Create a document *
**********************************************************************
CLEAR: ls_property, ls_value.
ls_property-id = cl_cmis_property_ids=>object_type_id.
ls_value-string_value = cl_cmis_constants=>base_type_id-cmis_document. "specify the type as cmis:document
APPEND ls_value TO ls_property-values.
APPEND ls_property TO lt_properties.
CLEAR: ls_property, ls_value.
ls_property-id = cl_cmis_property_ids=>name. "specify the name
ls_value-string_value = |Doc{ cl_abap_context_info=>get_system_date( ) }{ cl_abap_context_info=>get_system_time( ) }.txt|.
APPEND ls_value TO ls_property-values.
APPEND ls_property TO lt_properties.
"specify the content-stream details
ls_content-filename = 'content'.
ls_content-mime_type = 'text/plain'.
lv_print = ' This is a file'.
ls_content-stream = cl_abap_conv_codepage=>create_out(
codepage = `UTF-8`)->convert( source = lv_print ).
"Call create_document
CALL METHOD lo_cmis_client->create_document(
EXPORTING
iv_repository_id = ls_repository-id
it_properties = lt_properties
is_content = ls_content
iv_folder_id = ls_repository-root_folder_id
IMPORTING
es_object = ls_cmis_object ).
out->write('Document created successfully.').
out->write( '-----------------------------------------------------') .
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
17953,
62,
4658,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
25261,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
198,
220,
220,
220,
23255,
37,
2246,
1546,
611,
62,
2238,
62,
324,
83,
62,
4871,
5143,
13,
198,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1976,
565,
62,
17953,
62,
4658,
30023,
2538,
10979,
6234,
13,
198,
220,
337,
36252,
611,
62,
2238,
62,
324,
83,
62,
4871,
5143,
93,
12417,
13,
198,
220,
220,
220,
42865,
25,
198,
220,
220,
220,
220,
220,
300,
83,
62,
48310,
220,
41876,
12067,
271,
62,
83,
62,
16366,
62,
26745,
11,
198,
220,
220,
220,
220,
220,
43979,
62,
26745,
220,
220,
220,
34178,
48920,
3963,
300,
83,
62,
48310,
11,
198,
220,
220,
220,
220,
220,
43979,
62,
7220,
220,
220,
220,
220,
220,
220,
220,
41876,
4731,
11,
198,
220,
220,
220,
220,
220,
2376,
62,
11215,
271,
62,
16366,
41876,
4526,
37,
5390,
611,
62,
11215,
271,
62,
16366,
11,
198,
220,
220,
220,
220,
220,
43979,
62,
8367,
220,
220,
220,
220,
220,
220,
34178,
48920,
3963,
43979,
62,
26745,
12,
27160,
11,
198,
220,
220,
220,
220,
220,
43979,
62,
11299,
220,
220,
220,
220,
41876,
12067,
271,
62,
82,
62,
11299,
62,
1831,
11,
198,
220,
220,
220,
220,
220,
300,
85,
62,
4798,
220,
220,
220,
220,
220,
220,
41876,
4731,
13,
198,
198,
17174,
17174,
2466,
1174,
198,
9,
3497,
262,
16477,
1797,
20985,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
17174,
17174,
2466,
1174,
198,
220,
220,
220,
2376,
62,
11215,
271,
62,
16366,
796,
1976,
62,
565,
62,
1136,
62,
11215,
271,
62,
16366,
14804,
1136,
62,
16366,
7,
220,
6739,
628,
220,
220,
220,
503,
3784,
13564,
7,
705,
9,
3880,
19351,
12,
11537,
764,
198,
220,
220,
220,
503,
3784,
13564,
7,
705,
9,
8393,
15129,
2251,
11537,
764,
198,
220,
220,
220,
503,
3784,
13564,
7,
705,
9,
3880,
19351,
12,
11537,
764,
198,
198,
17174,
17174,
2466,
1174,
198,
9,
3855,
262,
16099,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
17174,
17174,
2466,
1174,
198,
220,
220,
220,
42815,
337,
36252,
2376,
62,
11215,
271,
62,
16366,
3784,
1136,
62,
260,
1930,
37765,
62,
10951,
198,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
21628,
62,
260,
1930,
37765,
62,
312,
796,
705,
14402,
62,
6207,
78,
6,
366,
6603,
262,
4686,
286,
262,
2727,
16099,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
1658,
62,
260,
1930,
37765,
62,
10951,
796,
42865,
7,
7278,
62,
260,
1930,
37765,
737,
198,
198,
17174,
17174,
2466,
1174,
198,
9,
16447,
257,
9483,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1635,
198,
17174,
17174,
2466,
1174,
198,
220,
220,
220,
43979,
62,
26745,
12,
312,
220,
220,
220,
220,
220,
220,
220,
796,
537,
62,
11215,
271,
62,
26745,
62,
2340,
14804,
15252,
62,
4906,
62,
312,
13,
198,
220,
220,
220,
43979,
62,
8367,
12,
8841,
62,
8367,
796,
537,
62,
11215,
271,
62,
9979,
1187,
14804,
8692,
62,
4906,
62,
312,
12,
11215,
271,
62,
43551,
13,
366,
16684,
1958,
262,
2099,
355,
12067,
271,
25,
43551,
198,
220,
220,
220,
43504,
10619,
43979,
62,
8367,
5390,
43979,
62,
26745,
12,
27160,
13,
198,
220,
220,
220,
43504,
10619,
43979,
62,
26745,
5390,
300,
83,
62,
48310,
13,
628,
220,
220,
220,
30301,
1503,
25,
43979,
62,
26745,
11,
220,
43979,
62,
8367,
13,
628,
220,
220,
220,
43979,
62,
26745,
12,
312,
220,
220,
220,
220,
220,
220,
220,
796,
537,
62,
11215,
271,
62,
26745,
62,
2340,
14804,
3672,
13,
366,
16684,
1958,
262,
1438,
286,
262,
2393,
198,
220,
220,
220,
43979,
62,
8367,
12,
8841,
62,
8367,
796,
930,
14402,
90,
220,
537,
62,
397,
499,
62,
22866,
62,
10951,
14804,
1136,
62,
10057,
62,
4475,
7,
1267,
1782,
90,
537,
62,
397,
499,
62,
22866,
62,
10951,
14804,
1136,
62,
10057,
62,
2435,
7,
1267,
1782,
91,
13,
198,
220,
220,
220,
43504,
10619,
43979,
62,
8367,
5390,
43979,
62,
26745,
12,
27160,
13,
198,
220,
220,
220,
43504,
10619,
43979,
62,
26745,
5390,
300,
83,
62,
48310,
13,
628,
220,
220,
220,
366,
13345,
2251,
62,
43551,
198,
220,
220,
220,
42815,
337,
36252,
2376,
62,
11215,
271,
62,
16366,
3784,
17953,
62,
43551,
198,
220,
220,
220,
220,
220,
7788,
15490,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
21628,
62,
260,
1930,
37765,
62,
312,
796,
43979,
62,
260,
1930,
37765
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] |
CLASS zcl_abapgit_zlib DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
TYPES:
BEGIN OF ty_decompress,
raw TYPE xstring,
compressed_len TYPE i,
END OF ty_decompress .
CLASS-METHODS decompress
IMPORTING
!iv_compressed TYPE xsequence
RETURNING
VALUE(rs_data) TYPE ty_decompress .
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS: c_maxdcodes TYPE i VALUE 30.
CLASS-DATA: gv_out TYPE xstring,
go_lencode TYPE REF TO zcl_abapgit_zlib_huffman,
go_distcode TYPE REF TO zcl_abapgit_zlib_huffman,
go_stream TYPE REF TO zcl_abapgit_zlib_stream.
TYPES: BEGIN OF ty_pair,
length TYPE i,
distance TYPE i,
END OF ty_pair.
CLASS-METHODS:
decode
IMPORTING io_huffman TYPE REF TO zcl_abapgit_zlib_huffman
RETURNING VALUE(rv_symbol) TYPE i,
map_length
IMPORTING iv_code TYPE i
RETURNING VALUE(rv_length) TYPE i,
map_distance
IMPORTING iv_code TYPE i
RETURNING VALUE(rv_distance) TYPE i,
dynamic,
fixed,
not_compressed,
decode_loop,
read_pair
IMPORTING iv_length TYPE i
RETURNING VALUE(rs_pair) TYPE ty_pair,
copy_out
IMPORTING is_pair TYPE ty_pair.
ENDCLASS.
CLASS ZCL_ABAPGIT_ZLIB IMPLEMENTATION.
METHOD copy_out.
* copy one byte at a time, it is not possible to copy using
* string offsets, as it might copy data that does not exist
* in mv_out yet
DATA: lv_distance TYPE i,
lv_index TYPE i,
lv_x TYPE x LENGTH 1.
lv_distance = xstrlen( gv_out ) - is_pair-distance.
DO is_pair-length TIMES.
lv_index = sy-index - 1 + lv_distance.
lv_x = gv_out+lv_index(1).
CONCATENATE gv_out lv_x INTO gv_out IN BYTE MODE.
ENDDO.
ENDMETHOD.
METHOD decode.
DATA: lv_bit TYPE c LENGTH 1,
lv_len TYPE i,
lv_count TYPE i,
lv_code TYPE i,
lv_index TYPE i,
lv_first TYPE i,
lv_bits TYPE string.
DO zcl_abapgit_zlib_huffman=>c_maxbits TIMES.
lv_len = sy-index.
lv_bit = go_stream->take_bits( 1 ).
CONCATENATE lv_bits lv_bit INTO lv_bits.
lv_code = zcl_abapgit_zlib_convert=>bits_to_int( lv_bits ).
lv_count = io_huffman->get_count( lv_len ).
IF lv_code - lv_count < lv_first.
rv_symbol = io_huffman->get_symbol( lv_index + lv_code - lv_first + 1 ).
RETURN.
ENDIF.
lv_index = lv_index + lv_count.
lv_first = lv_first + lv_count.
lv_first = lv_first * 2.
ENDDO.
ENDMETHOD.
METHOD decode_loop.
DATA lv_x TYPE x.
DATA lv_symbol TYPE i.
DO.
lv_symbol = decode( go_lencode ).
IF lv_symbol < 256.
lv_x = zcl_abapgit_zlib_convert=>int_to_hex( lv_symbol ).
CONCATENATE gv_out lv_x INTO gv_out IN BYTE MODE.
ELSEIF lv_symbol = 256.
EXIT.
ELSE.
copy_out( read_pair( lv_symbol ) ).
ENDIF.
ENDDO.
ENDMETHOD.
METHOD decompress.
DATA: lv_bfinal TYPE c LENGTH 1,
lv_btype TYPE c LENGTH 2.
IF iv_compressed IS INITIAL.
RETURN.
ENDIF.
CLEAR gv_out.
go_stream = NEW #( iv_data = iv_compressed ).
DO.
lv_bfinal = go_stream->take_bits( 1 ).
lv_btype = go_stream->take_bits( 2 ).
CASE lv_btype.
WHEN '00'.
not_compressed( ).
EXIT.
WHEN '01'.
fixed( ).
decode_loop( ).
WHEN '10'.
dynamic( ).
decode_loop( ).
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
IF lv_bfinal = '1'.
EXIT.
ENDIF.
ENDDO.
rs_data-raw = gv_out.
rs_data-compressed_len = xstrlen( iv_compressed ) - go_stream->remaining( ).
ENDMETHOD.
METHOD dynamic.
DATA: lv_nlen TYPE i,
lv_ndist TYPE i,
lv_ncode TYPE i,
lv_index TYPE i,
lv_length TYPE i,
lv_symbol TYPE i,
lt_order TYPE TABLE OF i,
lt_lengths TYPE zcl_abapgit_zlib_huffman=>ty_lengths,
lt_dists TYPE zcl_abapgit_zlib_huffman=>ty_lengths.
FIELD-SYMBOLS: <lv_length> LIKE LINE OF lt_lengths.
APPEND 16 TO lt_order.
APPEND 17 TO lt_order.
APPEND 18 TO lt_order.
APPEND 0 TO lt_order.
APPEND 8 TO lt_order.
APPEND 7 TO lt_order.
APPEND 9 TO lt_order.
APPEND 6 TO lt_order.
APPEND 10 TO lt_order.
APPEND 5 TO lt_order.
APPEND 11 TO lt_order.
APPEND 4 TO lt_order.
APPEND 12 TO lt_order.
APPEND 3 TO lt_order.
APPEND 13 TO lt_order.
APPEND 2 TO lt_order.
APPEND 14 TO lt_order.
APPEND 1 TO lt_order.
APPEND 15 TO lt_order.
lv_nlen = go_stream->take_int( 5 ) + 257.
lv_ndist = go_stream->take_int( 5 ) + 1.
lv_ncode = go_stream->take_int( 4 ) + 4.
DO 19 TIMES.
APPEND 0 TO lt_lengths.
ENDDO.
DO lv_ncode TIMES.
READ TABLE lt_order INDEX sy-index INTO lv_index.
ASSERT sy-subrc = 0.
lv_index = lv_index + 1.
READ TABLE lt_lengths INDEX lv_index ASSIGNING <lv_length>.
ASSERT sy-subrc = 0.
<lv_length> = go_stream->take_int( 3 ).
ENDDO.
go_lencode = NEW #( it_lengths = lt_lengths ).
CLEAR lt_lengths.
WHILE lines( lt_lengths ) < lv_nlen + lv_ndist.
lv_symbol = decode( go_lencode ).
IF lv_symbol < 16.
APPEND lv_symbol TO lt_lengths.
ELSE.
lv_length = 0.
IF lv_symbol = 16.
READ TABLE lt_lengths INDEX lines( lt_lengths ) INTO lv_length.
ASSERT sy-subrc = 0.
lv_symbol = go_stream->take_int( 2 ) + 3.
ELSEIF lv_symbol = 17.
lv_symbol = go_stream->take_int( 3 ) + 3.
ELSE.
lv_symbol = go_stream->take_int( 7 ) + 11.
ENDIF.
DO lv_symbol TIMES.
APPEND lv_length TO lt_lengths.
ENDDO.
ENDIF.
ENDWHILE.
lt_dists = lt_lengths.
DELETE lt_lengths FROM lv_nlen + 1.
DELETE lt_dists TO lv_nlen.
go_lencode = NEW #( it_lengths = lt_lengths ).
go_distcode = NEW #( it_lengths = lt_dists ).
ENDMETHOD.
METHOD fixed.
DATA: lt_lengths TYPE zcl_abapgit_zlib_huffman=>ty_lengths.
DO 144 TIMES.
APPEND 8 TO lt_lengths.
ENDDO.
DO 112 TIMES.
APPEND 9 TO lt_lengths.
ENDDO.
DO 24 TIMES.
APPEND 7 TO lt_lengths.
ENDDO.
DO 8 TIMES.
APPEND 8 TO lt_lengths.
ENDDO.
go_lencode = NEW #( it_lengths = lt_lengths ).
CLEAR lt_lengths.
DO c_maxdcodes TIMES.
APPEND 5 TO lt_lengths.
ENDDO.
go_distcode = NEW #( it_lengths = lt_lengths ).
ENDMETHOD.
METHOD map_distance.
CASE iv_code.
WHEN 0.
rv_distance = go_stream->take_int( 0 ) + 1.
WHEN 1.
rv_distance = go_stream->take_int( 0 ) + 2.
WHEN 2.
rv_distance = go_stream->take_int( 0 ) + 3.
WHEN 3.
rv_distance = go_stream->take_int( 0 ) + 4.
WHEN 4.
rv_distance = go_stream->take_int( 1 ) + 5.
WHEN 5.
rv_distance = go_stream->take_int( 1 ) + 7.
WHEN 6.
rv_distance = go_stream->take_int( 2 ) + 9.
WHEN 7.
rv_distance = go_stream->take_int( 2 ) + 13.
WHEN 8.
rv_distance = go_stream->take_int( 3 ) + 17.
WHEN 9.
rv_distance = go_stream->take_int( 3 ) + 25.
WHEN 10.
rv_distance = go_stream->take_int( 4 ) + 33.
WHEN 11.
rv_distance = go_stream->take_int( 4 ) + 49.
WHEN 12.
rv_distance = go_stream->take_int( 5 ) + 65.
WHEN 13.
rv_distance = go_stream->take_int( 5 ) + 97.
WHEN 14.
rv_distance = go_stream->take_int( 6 ) + 129.
WHEN 15.
rv_distance = go_stream->take_int( 6 ) + 193.
WHEN 16.
rv_distance = go_stream->take_int( 7 ) + 257.
WHEN 17.
rv_distance = go_stream->take_int( 7 ) + 385.
WHEN 18.
rv_distance = go_stream->take_int( 8 ) + 513.
WHEN 19.
rv_distance = go_stream->take_int( 8 ) + 769.
WHEN 20.
rv_distance = go_stream->take_int( 9 ) + 1025.
WHEN 21.
rv_distance = go_stream->take_int( 9 ) + 1537.
WHEN 22.
rv_distance = go_stream->take_int( 10 ) + 2049.
WHEN 23.
rv_distance = go_stream->take_int( 10 ) + 3073.
WHEN 24.
rv_distance = go_stream->take_int( 11 ) + 4097.
WHEN 25.
rv_distance = go_stream->take_int( 11 ) + 6145.
WHEN 26.
rv_distance = go_stream->take_int( 12 ) + 8193.
WHEN 27.
rv_distance = go_stream->take_int( 12 ) + 12289.
WHEN 28.
rv_distance = go_stream->take_int( 13 ) + 16385.
WHEN 29.
rv_distance = go_stream->take_int( 13 ) + 24577.
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
ENDMETHOD.
METHOD map_length.
CASE iv_code.
WHEN 257.
rv_length = go_stream->take_int( 0 ) + 3.
WHEN 258.
rv_length = go_stream->take_int( 0 ) + 4.
WHEN 259.
rv_length = go_stream->take_int( 0 ) + 5.
WHEN 260.
rv_length = go_stream->take_int( 0 ) + 6.
WHEN 261.
rv_length = go_stream->take_int( 0 ) + 7.
WHEN 262.
rv_length = go_stream->take_int( 0 ) + 8.
WHEN 263.
rv_length = go_stream->take_int( 0 ) + 9.
WHEN 264.
rv_length = go_stream->take_int( 0 ) + 10.
WHEN 265.
rv_length = go_stream->take_int( 1 ) + 11.
WHEN 266.
rv_length = go_stream->take_int( 1 ) + 13.
WHEN 267.
rv_length = go_stream->take_int( 1 ) + 15.
WHEN 268.
rv_length = go_stream->take_int( 1 ) + 17.
WHEN 269.
rv_length = go_stream->take_int( 2 ) + 19.
WHEN 270.
rv_length = go_stream->take_int( 2 ) + 23.
WHEN 271.
rv_length = go_stream->take_int( 2 ) + 27.
WHEN 272.
rv_length = go_stream->take_int( 2 ) + 31.
WHEN 273.
rv_length = go_stream->take_int( 3 ) + 35.
WHEN 274.
rv_length = go_stream->take_int( 3 ) + 43.
WHEN 275.
rv_length = go_stream->take_int( 3 ) + 51.
WHEN 276.
rv_length = go_stream->take_int( 3 ) + 59.
WHEN 277.
rv_length = go_stream->take_int( 4 ) + 67.
WHEN 278.
rv_length = go_stream->take_int( 4 ) + 83.
WHEN 279.
rv_length = go_stream->take_int( 4 ) + 99.
WHEN 280.
rv_length = go_stream->take_int( 4 ) + 115.
WHEN 281.
rv_length = go_stream->take_int( 5 ) + 131.
WHEN 282.
rv_length = go_stream->take_int( 5 ) + 163.
WHEN 283.
rv_length = go_stream->take_int( 5 ) + 195.
WHEN 284.
rv_length = go_stream->take_int( 5 ) + 227.
WHEN 285.
rv_length = go_stream->take_int( 0 ) + 258.
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
ENDMETHOD.
METHOD not_compressed.
DATA: lv_len TYPE i,
lv_nlen TYPE i ##NEEDED.
go_stream->take_bits( 5 ).
lv_len = go_stream->take_int( 16 ).
lv_nlen = go_stream->take_int( 16 ).
gv_out = go_stream->take_bytes( lv_len ).
ENDMETHOD.
METHOD read_pair.
DATA: lv_symbol TYPE i.
rs_pair-length = map_length( iv_length ).
lv_symbol = decode( go_distcode ).
rs_pair-distance = map_distance( lv_symbol ).
ENDMETHOD.
ENDCLASS.
| [
31631,
1976,
565,
62,
397,
499,
18300,
62,
89,
8019,
5550,
20032,
17941,
198,
220,
44731,
198,
220,
29244,
6158,
44731,
764,
628,
220,
44731,
44513,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
198,
220,
220,
220,
220,
220,
347,
43312,
3963,
1259,
62,
12501,
3361,
601,
11,
198,
220,
220,
220,
220,
220,
220,
220,
8246,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
8841,
11,
198,
220,
220,
220,
220,
220,
220,
220,
25388,
62,
11925,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
12501,
3361,
601,
764,
628,
220,
220,
220,
42715,
12,
49273,
50,
38237,
601,
198,
220,
220,
220,
220,
220,
30023,
9863,
2751,
198,
220,
220,
220,
220,
220,
220,
220,
5145,
452,
62,
5589,
2790,
41876,
2124,
43167,
198,
220,
220,
220,
220,
220,
30826,
4261,
15871,
198,
220,
220,
220,
220,
220,
220,
220,
26173,
8924,
7,
3808,
62,
7890,
8,
41876,
1259,
62,
12501,
3361,
601,
764,
628,
220,
48006,
9782,
1961,
44513,
13,
198,
220,
4810,
3824,
6158,
44513,
13,
198,
220,
220,
220,
7102,
2257,
1565,
4694,
25,
269,
62,
9806,
17896,
4147,
41876,
1312,
26173,
8924,
1542,
13,
628,
220,
220,
220,
42715,
12,
26947,
25,
308,
85,
62,
448,
220,
220,
220,
220,
220,
41876,
2124,
8841,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
467,
62,
11925,
8189,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
71,
1648,
805,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
467,
62,
17080,
8189,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
71,
1648,
805,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
467,
62,
5532,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
5532,
13,
628,
220,
220,
220,
24412,
47,
1546,
25,
347,
43312,
3963,
1259,
62,
24874,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5253,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23578,
3963,
1259,
62,
24874,
13,
628,
220,
220,
220,
42715,
12,
49273,
50,
25,
198,
220,
220,
220,
220,
220,
36899,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
33245,
62,
71,
1648,
805,
220,
220,
220,
220,
220,
220,
41876,
4526,
37,
5390,
1976,
565,
62,
397,
499,
18300,
62,
89,
8019,
62,
71,
1648,
805,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
1837,
23650,
8,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
3975,
62,
13664,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
8189,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
13664,
8,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
3975,
62,
30246,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
8189,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
81,
85,
62,
30246,
8,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
8925,
11,
198,
220,
220,
220,
220,
220,
5969,
11,
198,
220,
220,
220,
220,
220,
407,
62,
5589,
2790,
11,
198,
220,
220,
220,
220,
220,
36899,
62,
26268,
11,
198,
220,
220,
220,
220,
220,
1100,
62,
24874,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
21628,
62,
13664,
220,
220,
220,
220,
220,
41876,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
30826,
4261,
15871,
26173,
8924,
7,
3808,
62,
24874,
8,
41876,
1259,
62,
24874,
11,
198,
220,
220,
220,
220,
220,
4866,
62,
448,
198,
220,
220,
220,
220,
220,
220,
220,
30023,
9863,
2751,
318,
62,
24874,
41876,
1259,
62,
24874,
13,
198,
198,
10619,
31631,
13,
628,
198,
198,
31631,
1168,
5097,
62,
6242,
2969,
38,
2043,
62,
57,
40347,
30023,
2538,
10979,
6234,
13,
628,
198,
220,
337,
36252,
4866,
62,
448,
13,
198,
198,
9,
4866,
530,
18022,
379,
257,
640,
11,
340,
318,
407,
1744,
284,
4866,
1262,
198,
9,
4731,
49005,
11,
355,
340,
1244,
4866,
1366,
326,
857,
407,
2152,
198,
9,
287,
285,
85,
62,
448,
1865,
628,
220,
220,
220,
42865,
25,
300,
85,
62,
30246,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
9630,
220,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
87,
220,
220,
220,
220,
220,
220,
220,
41876,
2124,
406,
49494,
352,
13,
628,
198,
220,
220,
220,
300,
85,
62,
30246,
796,
2124,
2536,
11925,
7,
308,
85,
62,
448,
1267,
532,
318,
62,
24874,
12,
30246,
13,
198,
220,
220,
220,
8410,
318,
62,
24874,
12,
13664,
31742,
1546,
13,
198,
220,
220,
220,
220,
220,
300,
85,
62,
9630,
796,
827,
12,
9630,
532,
352,
1343,
300,
85,
62,
30246,
13,
198,
220,
220,
220,
220,
220,
300,
85,
62,
87,
796,
308,
85,
62,
448,
10,
6780,
62,
9630,
7,
16,
737,
198,
220,
220,
220,
220,
220,
39962,
1404,
1677,
6158,
308,
85,
62,
448,
300,
85,
62,
87,
39319,
308,
85,
62,
448,
3268,
11050,
9328,
337,
16820,
13,
198,
220,
220,
220,
23578,
18227,
13,
628,
220,
23578,
49273,
13,
628,
198,
220,
337,
36252,
36899,
13,
628,
220,
220,
220,
42865,
25,
300,
85,
62,
2545,
220,
220,
41876,
269,
406,
49494,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
85,
62,
11925,
220,
220,
41876,
1312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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