diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk index 4c67087..8f95e16 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk @@ -1,5 +1,5 @@ - + + @@ -108,7 +109,9 @@ TYPES: BEGIN OF ts_color_styles, + + @@ -120,7 +123,99 @@ TYPES: BEGIN OF ts_color_styles, - + + + + METHOD ask_option. + DATA: ls_sval TYPE sval, + lt_sval TYPE STANDARD TABLE OF sval, + l_returncode TYPE string, + lt_fields TYPE ddfields, + ls_fields TYPE dfies. + + FIELD-SYMBOLS: <fs> TYPE ANY. + + rs_option = ws_option. + + CALL FUNCTION 'DDIF_FIELDINFO_GET' + EXPORTING + tabname = 'ZEXCEL_S_CONVERTER_OPTION' +* FIELDNAME = ' ' +* LANGU = sy-langu +* LFIELDNAME = ' ' +* ALL_TYPES = ' ' +* GROUP_NAMES = ' ' +* UCLEN = +* IMPORTING +* X030L_WA = +* DDOBJTYPE = +* DFIES_WA = +* LINES_DESCR = + TABLES + dfies_tab = lt_fields +* FIXED_VALUES = + EXCEPTIONS + not_found = 1 + internal_error = 2 + OTHERS = 3 + . + IF sy-subrc <> 0. +* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO +* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. + ENDIF. + + LOOP AT lt_fields INTO ls_fields. + ASSIGN COMPONENT ls_fields-fieldname OF STRUCTURE ws_option TO <fs>. + IF sy-subrc = 0. + CLEAR ls_sval. + ls_sval-tabname = ls_fields-tabname. + ls_sval-fieldname = ls_fields-fieldname. + ls_sval-value = <fs>. + ls_sval-field_attr = space. + ls_sval-field_obl = space. + ls_sval-comp_code = space. + ls_sval-fieldtext = ls_fields-scrtext_m. + ls_sval-comp_tab = space. + ls_sval-comp_field = space. + ls_sval-novaluehlp = space. + INSERT ls_sval INTO TABLE lt_sval. + ENDIF. + ENDLOOP. + + CALL FUNCTION 'POPUP_GET_VALUES' + EXPORTING +* NO_VALUE_CHECK = space + popup_title = 'Excel creation options'(008) +* START_COLUMN = '5' +* START_ROW = '5' + IMPORTING + returncode = l_returncode + TABLES + fields = lt_sval + EXCEPTIONS + error_in_fields = 1 + OTHERS = 2 + . + IF sy-subrc <> 0. +* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO +* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. + ELSE. + IF l_returncode = 'A'. + RAISE EXCEPTION TYPE zcx_excel. + ELSE. + LOOP AT lt_sval INTO ls_sval. + ASSIGN COMPONENT ls_sval-fieldname OF STRUCTURE ws_option TO <fs>. + IF sy-subrc = 0. + <fs> = ls_sval-value. + ENDIF. + ENDLOOP. + set_option( is_option = ws_option ) . + rs_option = ws_option. + ENDIF. + ENDIF. +ENDMETHOD. + + method BIND_CELLS. @@ -137,7 +232,7 @@ TYPES: BEGIN OF ts_color_styles, endmethod. - + @@ -204,8 +299,15 @@ endmethod. endmethod. - method CLASS_CONSTRUCTOR. + METHOD class_constructor. DATA: ls_objects TYPE ts_alv_types. + DATA: ls_option TYPE zexcel_s_converter_option, + l_uname TYPE sy-uname. + + GET PARAMETER ID 'ZUS' FIELD l_uname. + IF l_uname IS INITIAL OR l_uname = space. + l_uname = sy-uname. + ENDIF. * Object CL_GUI_ALV_GRID ls_objects-seoclass = 'CL_GUI_ALV_GRID'. @@ -226,9 +328,19 @@ endmethod. ls_objects-clsname = 'ZCL_EXCEL_CONVERTER_RESULT_WD'. INSERT ls_objects INTO TABLE wt_objects. -endmethod. + CONCATENATE 'EXCEL_' sy-uname INTO ws_indx-srtfd. + + IMPORT p1 = ls_option FROM DATABASE indx(xl) TO ws_indx ID ws_indx-srtfd. + + IF sy-subrc = 0. + ws_option = ls_option. + ELSE. + init_option( ) . + ENDIF. + +ENDMETHOD. - + method CLEAN_FIELDCATALOG. DATA: l_position TYPE int1. @@ -265,60 +377,73 @@ endmethod. endmethod. - - - - - - - - - + + + + + + + + + + - method CONVERT. + METHOD convert. - try. + IF is_option IS SUPPLIED. + ws_option = is_option. + ENDIF. + + TRY. execute_converter( EXPORTING io_object = io_alv it_table = it_table ) . - endtry. + ENDTRY. - if io_worksheet is supplied and io_worksheet is bound. + IF io_worksheet IS SUPPLIED AND io_worksheet IS BOUND. wo_worksheet = io_worksheet. - endif. - if co_excel is supplied. - if co_excel is not bound. - create object co_excel. + ENDIF. + IF co_excel IS SUPPLIED. + IF co_excel IS NOT BOUND. + CREATE OBJECT co_excel. co_excel->zif_excel_book_properties~creator = sy-uname. - endif. + ENDIF. wo_excel = co_excel. - endif. + ENDIF. * Move table to data object and clean it up - if wt_fieldcatalog is not initial. + IF wt_fieldcatalog IS NOT INITIAL. create_table( ). - else. + ELSE. wo_data = wo_table . - endif. + ENDIF. - if wo_excel is not bound. - create object wo_excel. + IF wo_excel IS NOT BOUND. + CREATE OBJECT wo_excel. wo_excel->zif_excel_book_properties~creator = sy-uname. - endif. - if wo_worksheet is not bound. + ENDIF. + IF wo_worksheet IS NOT BOUND. " Get active sheet wo_worksheet = wo_excel->get_active_worksheet( ). wo_worksheet->set_title( ip_title = 'Sheet1'(001) ). - endif. + ENDIF. - w_row_int = i_row_int. - w_col_int = i_column_int. + IF i_row_int <= 0. + w_row_int = 1. + ELSE. + w_row_int = i_row_int. + ENDIF. + IF i_column_int <= 0. + w_col_int = 1. + ELSE. + w_col_int = i_column_int. + ENDIF. create_worksheet( i_table = i_table i_style_table = i_style_table ) . -endmethod. +ENDMETHOD. - + @@ -343,7 +468,7 @@ endmethod. ENDIF. endmethod. - + @@ -361,7 +486,7 @@ endmethod. concatenate 'SUBTOTAL(' l_func_num ',' i_column l_row_alpha_start ':' i_column l_row_alpha_end ')' into r_formula. endmethod. - + @@ -376,7 +501,7 @@ endmethod. concatenate i_totals_function '(' i_column l_row_alpha ':' i_column l_row_e_alpha ')' into r_formula. endmethod. - + method CREATE_PATH. DATA: l_sep TYPE c , @@ -433,7 +558,7 @@ endmethod. endmethod. - + method CREATE_STYLE_HDR. @@ -450,7 +575,7 @@ endmethod. ro_style = lo_style . endmethod. - + @@ -481,7 +606,7 @@ endmethod. ENDIF. endmethod. - + @@ -507,7 +632,7 @@ endmethod. endmethod. - + @@ -534,7 +659,7 @@ endmethod. endmethod. - + @@ -577,7 +702,7 @@ endmethod. endmethod. - + method CREATE_TABLE. TYPES: BEGIN OF ts_output, fieldname TYPE fieldname, @@ -645,40 +770,42 @@ endmethod. endmethod. - + - method CREATE_TEXT_SUBTOTAL. - data: l_string type string, - l_func type string. + METHOD create_text_subtotal. + DATA: l_string(256) TYPE c, + l_func TYPE string. - case i_totals_function. - when zcl_excel_table=>totals_function_sum. " Total + CASE i_totals_function. + WHEN zcl_excel_table=>totals_function_sum. " Total l_func = 'Total'(003). - when zcl_excel_table=>totals_function_min. " Minimum + WHEN zcl_excel_table=>totals_function_min. " Minimum l_func = 'Minimum'(004). - when zcl_excel_table=>totals_function_max. " Maximum + WHEN zcl_excel_table=>totals_function_max. " Maximum l_func = 'Maximum'(005). - when zcl_excel_table=>totals_function_average. " Mean Value + WHEN zcl_excel_table=>totals_function_average. " Mean Value l_func = 'Average'(006). - when zcl_excel_table=>totals_function_count. " Count + WHEN zcl_excel_table=>totals_function_count. " Count l_func = 'Count'(007). - when others. - clear l_func. - endcase. - l_string = i_value. + WHEN OTHERS. + CLEAR l_func. + ENDCASE. - concatenate l_string l_func into r_text separated by space. + WRITE i_value TO l_string. -endmethod. + CONCATENATE l_string l_func INTO r_text SEPARATED BY space. + +ENDMETHOD. - + method CREATE_WORKSHEET. DATA: l_freeze_col TYPE i. + DATA: l_guid TYPE oltpguid16. IF wo_data IS BOUND AND wo_worksheet IS BOUND. @@ -716,7 +843,7 @@ endmethod. endmethod. - + @@ -741,6 +868,7 @@ endmethod. TRY. lo_if->create_fieldcatalog( EXPORTING + is_option = ws_option io_object = io_object it_table = it_table IMPORTING @@ -765,7 +893,7 @@ endmethod. endmethod. - + @@ -827,7 +955,7 @@ endmethod. endmethod. - + @@ -867,7 +995,7 @@ endmethod. endmethod. - + method GET_FUNCTION_NUMBER. @@ -900,7 +1028,15 @@ endmethod. endcase. endmethod. - + + + METHOD get_option. + + rs_option = ws_option. + +ENDMETHOD. + + @@ -952,12 +1088,21 @@ endmethod. ENDIF. endmethod. - + + METHOD init_option. + + ws_option-filter = abap_true. + ws_option-hidenc = abap_true. + ws_option-subtot = abap_true. + +ENDMETHOD. + + - method LOOP_NORMAL. + METHOD loop_normal. DATA: lo_data TYPE REF TO data, l_row_header TYPE zexcel_cell_row VALUE '2', l_col_header TYPE zexcel_cell_column_alpha VALUE 'B', @@ -994,19 +1139,24 @@ endmethod. l_row_int = i_row_int. l_col_int = i_col_int + <fs_sfcat>-position - 1. -* Freeze panes +* Freeze panes IF <fs_sfcat>-fix_column = abap_true. ADD 1 TO r_freeze_col. ENDIF. l_s_color = abap_true. + l_col_alpha = zcl_excel_common=>convert_column2alpha( l_col_int ). - " First of all write column header - l_cell_value = <fs_sfcat>-scrtext_m. - wo_worksheet->set_cell( ip_column = l_col_alpha - ip_row = l_row_int - ip_value = l_cell_value - ip_style = <fs_sfcat>-style_hdr ). - ADD 1 TO l_row_int. + +* Only if the Header is required create it. + IF ws_option-hidehd IS INITIAL. + " First of all write column header + l_cell_value = <fs_sfcat>-scrtext_m. + wo_worksheet->set_cell( ip_column = l_col_alpha + ip_row = l_row_int + ip_value = l_cell_value + ip_style = <fs_sfcat>-style_hdr ). + ADD 1 TO l_row_int. + ENDIF. LOOP AT <fs_tab> ASSIGNING <fs_stab>. l_table_row = sy-tabix. * Now the cell values @@ -1067,9 +1217,9 @@ endmethod. ip_style = <fs_sfcat>-style_total ). ENDIF. ENDLOOP. -endmethod. +ENDMETHOD. - + @@ -1418,7 +1568,7 @@ endmethod. endmethod. - + method OPEN_FILE. data: l_bytecount type i, lt_file type solix_tab, @@ -1472,7 +1622,7 @@ endmethod. endmethod. - + method SET_AUTOFILTER_AREA. DATA: ls_area TYPE zexcel_s_autofilter_area, l_lines TYPE i, @@ -1498,7 +1648,7 @@ endmethod. endmethod. - + @@ -1525,8 +1675,8 @@ endmethod. endmethod. - - method SET_FIELDCATALOG. + + METHOD set_fieldcatalog. DATA: lr_data TYPE REF TO data, lo_structdescr TYPE REF TO cl_abap_structdescr, @@ -1553,9 +1703,29 @@ endmethod. clean_fieldcatalog( ). -endmethod. +ENDMETHOD. - + + + METHOD set_option. + + IF ws_indx-begdt IS INITIAL. + ws_indx-begdt = sy-datum. + ENDIF. + + ws_indx-aedat = sy-datum. + ws_indx-usera = sy-uname. + ws_indx-pgmid = sy-cprog. + + EXPORT p1 = is_option TO DATABASE indx(xl) FROM ws_indx ID ws_indx-srtfd. + + IF sy-subrc = 0. + ws_option = is_option. + ENDIF. + +ENDMETHOD. + + method WRITE_FILE. data: l_bytecount type i, diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV.slnk index e4bd5de..a230d03 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV.slnk @@ -1,54 +1,6 @@ - class ZCL_EXCEL_CONVERTER_ALV definition - public - abstract - create public . - -*"* public components of class ZCL_EXCEL_CONVERTER_ALV -*"* do not include other source files here!!! -public section. - type-pools ABAP . - type-pools KKBLO . - - interfaces ZIF_EXCEL_CONVERTER - all methods abstract . - - class-methods CLASS_CONSTRUCTOR . - *"* protected components of class ZCL_EXCEL_CONVERTER_ALV -*"* do not include other source files here!!! -protected section. - - data WT_SORT type LVC_T_SORT . - data WT_FILT type LVC_T_FILT . - data WT_FCAT type LVC_T_FCAT . - data WS_LAYO type LVC_S_LAYO . - - methods UPDATE_CATALOG - changing - !CS_LAYOUT type ZEXCEL_S_CONVERTER_LAYO - !CT_FIELDCATALOG type ZEXCEL_T_CONVERTER_FCAT . - methods APPLY_SORT - importing - !IT_TABLE type STANDARD TABLE - exporting - !EO_TABLE type ref to DATA . - methods GET_COLOR - importing - !IO_TABLE type ref to DATA - exporting - !ET_COLORS type ZEXCEL_T_CONVERTER_COL . - methods GET_FILTER - importing - !IO_TABLE type ref to DATA - exporting - !ET_FILTER type ZEXCEL_T_CONVERTER_FIL . - *"* private components of class ZCL_EXCEL_CONVERTER_ALV -*"* do not include other source files here!!! -private section. - - class-data WT_COLORS type TT_COL_CONVERTER . *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -70,15 +22,16 @@ TYPES: BEGIN OF ts_col_converter, ABAP KKBLO - - - - - - - - - method APPLY_SORT. + + + + + + + + + + METHOD apply_sort. DATA: lt_otab TYPE abap_sortorder_tab, ls_otab TYPE abap_sortorder. @@ -90,7 +43,7 @@ TYPES: BEGIN OF ts_col_converter, <fs_table> = it_table. - sort wt_sort by spos. + SORT wt_sort BY spos. LOOP AT wt_sort ASSIGNING <fs_sort>. IF <fs_sort>-up = abap_true. ls_otab-name = <fs_sort>-fieldname. @@ -108,9 +61,10 @@ TYPES: BEGIN OF ts_col_converter, IF lt_otab IS NOT INITIAL. SORT <fs_table> BY (lt_otab). ENDIF. -endmethod. + +ENDMETHOD. - + method CLASS_CONSTRUCTOR. * let's fill the color conversion routines. DATA: ls_color TYPE ts_col_converter. @@ -319,9 +273,9 @@ endmethod. endmethod. - - - + + + METHOD get_color. DATA: ls_con_col TYPE zexcel_s_converter_col, ls_color TYPE ts_col_converter, @@ -388,9 +342,9 @@ endmethod. ENDIF. ENDMETHOD. - - - + + + METHOD get_filter. DATA: ls_filt TYPE lvc_s_filt, l_line TYPE i, @@ -400,17 +354,27 @@ ENDMETHOD. ls_components TYPE abap_componentdescr, lo_table TYPE REF TO cl_abap_tabledescr, lo_struc TYPE REF TO cl_abap_structdescr, - lo_tdata TYPE REF TO data, - lo_sdata TYPE REF TO data. + lo_trange TYPE REF TO data, + lo_srange TYPE REF TO data, + lo_ltabdata TYPE REF TO data. - FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE, + FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE, + <fs_ltab> TYPE STANDARD TABLE, <fs_stab> TYPE ANY, <fs> TYPE ANY, <fs1> TYPE ANY, <fs_srange> TYPE ANY, <fs_trange> TYPE STANDARD TABLE. - ASSIGN io_table->* TO <fs_tab>. + IF ws_option-filter = abap_false. + REFRESH et_filter. + RETURN. + ENDIF. + + ASSIGN xo_table->* TO <fs_tab>. + + CREATE DATA lo_ltabdata LIKE <fs_tab>. + ASSIGN lo_ltabdata->* TO <fs_ltab>. LOOP AT wt_filt INTO ls_filt. LOOP AT <fs_tab> ASSIGNING <fs_stab>. @@ -444,11 +408,11 @@ ENDMETHOD. ENDTRY. lo_table = cl_abap_tabledescr=>create( lo_struc ). - CREATE DATA lo_tdata TYPE HANDLE lo_table. - CREATE DATA lo_sdata TYPE HANDLE lo_struc. + CREATE DATA lo_trange TYPE HANDLE lo_table. + CREATE DATA lo_srange TYPE HANDLE lo_struc. - ASSIGN lo_tdata->* TO <fs_trange>. - ASSIGN lo_sdata->* TO <fs_srange>. + ASSIGN lo_trange->* TO <fs_trange>. + ASSIGN lo_srange->* TO <fs_srange>. ENDIF. REFRESH <fs_trange>. ASSIGN COMPONENT 'SIGN' OF STRUCTURE <fs_srange> TO <fs1>. @@ -461,19 +425,27 @@ ENDMETHOD. <fs1> = ls_filt-high. INSERT <fs_srange> INTO TABLE <fs_trange>. IF <fs> IN <fs_trange>. - ls_filter-rownumber = l_line. - ls_filter-columnname = ls_filt-fieldname. - INSERT ls_filter INTO TABLE et_filter. + IF ws_option-filter = abap_true. + ls_filter-rownumber = l_line. + ls_filter-columnname = ls_filt-fieldname. + INSERT ls_filter INTO TABLE et_filter. + ELSE. + INSERT <fs_stab> INTO TABLE <fs_ltab>. + ENDIF. ENDIF. ENDIF. ENDLOOP. + IF ws_option-filter = abap_undefined. + <fs_tab> = <fs_ltab>. + REFRESH <fs_ltab>. + ENDIF. ENDLOOP. ENDMETHOD. - - - + + + METHOD update_catalog. DATA: ls_fieldcatalog TYPE zexcel_s_converter_fcat, ls_ref TYPE salv_s_ddic_reference, @@ -494,7 +466,17 @@ ENDMETHOD. LOOP AT wt_fcat INTO ls_fcat. CLEAR: ls_fieldcatalog, l_decimals. - IF ls_fcat-tech = abap_false AND ls_fcat-no_out IS INITIAL. + CASE ws_option-hidenc. + WHEN abap_false. " We make hiden columns visible + CLEAR ls_fcat-no_out. + WHEN abap_true. +* We convert column and hide it. + WHEN abap_undefined. "We don't convert hiden columns + IF ls_fcat-no_out = abap_true. + ls_fcat-tech = abap_true. + ENDIF. + ENDCASE. + IF ls_fcat-tech = abap_false. ls_fieldcatalog-tabname = ls_fcat-tabname. ls_fieldcatalog-fieldname = ls_fcat-fieldname . ls_fieldcatalog-columnname = ls_fcat-fieldname . @@ -511,6 +493,14 @@ ENDMETHOD. ELSE. ls_fieldcatalog-decimals = ls_fcat-decimals . ENDIF. + CASE ws_option-subtot. + WHEN abap_false. " We ignore subtotals + CLEAR ls_fcat-do_sum. + WHEN abap_true. " We convert subtotals and detail + + WHEN abap_undefined. " We should only take subtotals and displayed detail +* for now abap_true + ENDCASE. CASE ls_fcat-do_sum. WHEN abap_true. ls_fieldcatalog-totals_function = zcl_excel_table=>totals_function_sum. @@ -548,7 +538,7 @@ ENDMETHOD. ENDCASE. * Check for subtotals. READ TABLE wt_sort INTO ls_sort WITH KEY fieldname = ls_fcat-fieldname. - IF sy-subrc = 0. + IF sy-subrc = 0 AND ws_option-subtot <> abap_false. ls_fieldcatalog-sort_level = 0 . * IF ls_fieldcatalog-totals_function IS INITIAL. " Not clear why not * CLEAR ls_fieldcatalog-is_subtotalled. diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV_GRID.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV_GRID.slnk index d569ce3..71bb2b1 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV_GRID.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_ALV_GRID.slnk @@ -1,25 +1,5 @@ - class ZCL_EXCEL_CONVERTER_ALV_GRID definition - public - inheriting from ZCL_EXCEL_CONVERTER_ALV - final - create public . - -public section. -*"* public components of class ZCL_EXCEL_CONVERTER_ALV_GRID -*"* do not include other source files here!!! - - methods ZIF_EXCEL_CONVERTER~CREATE_FIELDCATALOG - redefinition . - methods ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT - redefinition . - protected section. -*"* protected components of class ZCL_EXCEL_CONVERTER_ALV_GRID -*"* do not include other source files here!!! - *"* private components of class ZCL_EXCEL_CONVERTER_ALV_GRID -*"* do not include other source files here!!! -private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -52,6 +32,8 @@ endmethod. zif_excel_converter~can_convert_object( io_object = io_object ). ENDTRY. + ws_option = is_option. + lo_alv ?= io_object. CLEAR: es_layout, @@ -69,8 +51,8 @@ endmethod. get_color( EXPORTING io_table = eo_table IMPORTING et_colors = et_colors ) . - get_filter( EXPORTING io_table = eo_table - IMPORTING et_filter = et_filter ) . + get_filter( IMPORTING et_filter = et_filter + CHANGING xo_table = eo_table ) . update_catalog( CHANGING cs_layout = es_layout ct_fieldcatalog = et_fieldcatalog ). diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT.slnk index 9a7a27c..e1d7816 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT.slnk @@ -1,26 +1,5 @@ - class ZCL_EXCEL_CONVERTER_RESULT definition - public - inheriting from ZCL_EXCEL_CONVERTER_ALV - abstract - create public . - -*"* public components of class ZCL_EXCEL_CONVERTER_RESULT -*"* do not include other source files here!!! -public section. - *"* protected components of class ZCL_EXCEL_CONVERTER_RESULT -*"* do not include other source files here!!! -protected section. - - methods GET_TABLE - importing - !IO_OBJECT type ref to OBJECT - returning - value(RO_DATA) type ref to DATA . - *"* private components of class ZCL_EXCEL_CONVERTER_RESULT -*"* do not include other source files here!!! -private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_EX.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_EX.slnk index 39b991a..a6a7ca6 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_EX.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_EX.slnk @@ -1,25 +1,5 @@ - class ZCL_EXCEL_CONVERTER_RESULT_EX definition - public - inheriting from ZCL_EXCEL_CONVERTER_RESULT - final - create public . - -*"* public components of class ZCL_EXCEL_CONVERTER_RESULT_EX -*"* do not include other source files here!!! -public section. - - methods ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT - redefinition . - methods ZIF_EXCEL_CONVERTER~CREATE_FIELDCATALOG - redefinition . - *"* protected components of class ZCL_EXCEL_CONVERTER_RESULT_EX -*"* do not include other source files here!!! -protected section. - *"* private components of class ZCL_EXCEL_CONVERTER_EX_RESULT -*"* do not include other source files here!!! -private section. *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -57,6 +37,8 @@ ENDMETHOD. zif_excel_converter~can_convert_object( io_object = io_object ). ENDTRY. + ws_option = is_option. + lo_result ?= io_object. CLEAR: es_layout, @@ -83,8 +65,8 @@ ENDMETHOD. get_color( EXPORTING io_table = eo_table IMPORTING et_colors = et_colors ) . - get_filter( EXPORTING io_table = eo_table - IMPORTING et_filter = et_filter ) . + get_filter( IMPORTING et_filter = et_filter + CHANGING xo_table = eo_table ) . update_catalog( CHANGING cs_layout = es_layout ct_fieldcatalog = et_fieldcatalog ). diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_WD.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_WD.slnk index baa95a9..d3cc338 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_WD.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_RESULT_WD.slnk @@ -1,41 +1,5 @@ - class ZCL_EXCEL_CONVERTER_RESULT_WD definition - public - inheriting from ZCL_EXCEL_CONVERTER_RESULT - final - create public . - -*"* public components of class ZCL_EXCEL_CONVERTER_RESULT_WD -*"* do not include other source files here!!! -public section. - - methods ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT - redefinition . - methods ZIF_EXCEL_CONVERTER~CREATE_FIELDCATALOG - redefinition . - *"* protected components of class ZCL_EXCEL_CONVERTER_RESULT_WD -*"* do not include other source files here!!! -protected section. - *"* private components of class ZCL_EXCEL_CONVERTER_RESULT_WD -*"* do not include other source files here!!! -private section. - - data WO_CONFIG type ref to CL_SALV_WD_CONFIG_TABLE . - data WT_FIELDS type SALV_WD_T_FIELD_REF . - data WT_COLUMNS type SALV_WD_T_COLUMN_REF . - - methods GET_COLUMNS_INFO - changing - !XS_FCAT type LVC_S_FCAT . - methods GET_FIELDS_INFO - changing - !XS_FCAT type LVC_S_FCAT . - methods CREATE_WT_SORT . - methods CREATE_WT_FILT . - methods CREATE_WT_FCAT - importing - !IO_TABLE type ref to DATA . *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -75,6 +39,8 @@ ENDMETHOD. zif_excel_converter~can_convert_object( io_object = io_object ). ENDTRY. + ws_option = is_option. + lo_result ?= io_object. CLEAR: es_layout, @@ -104,8 +70,8 @@ ENDMETHOD. * get_color( EXPORTING io_table = eo_table * IMPORTING et_colors = et_colors ) . - get_filter( EXPORTING io_table = eo_table - IMPORTING et_filter = et_filter ) . + get_filter( IMPORTING et_filter = et_filter + CHANGING xo_table = eo_table ) . update_catalog( CHANGING cs_layout = es_layout ct_fieldcatalog = et_fieldcatalog ). @@ -119,33 +85,23 @@ ENDMETHOD. METHOD create_wt_fcat. DATA: lr_data TYPE REF TO data, - lo_structdescr TYPE REF TO cl_abap_structdescr, - lo_elemdescr TYPE REF TO cl_abap_elemdescr, - lt_dfies TYPE ddfields, - ls_dfies TYPE dfies, - lv_sytabix TYPE sytabix, - lt_components TYPE abap_component_tab, - ls_component LIKE LINE OF lt_components. + lo_structdescr TYPE REF TO cl_abap_structdescr, + lt_dfies TYPE ddfields, + ls_dfies TYPE dfies, + lv_sytabix TYPE sytabix. DATA: ls_fcat TYPE lvc_s_fcat. - DATA: lt_filters TYPE salv_wd_t_filter_rule_ref, - ls_filt TYPE lvc_s_filt. - - FIELD-SYMBOLS: <fs_filter> TYPE salv_wd_s_filter_rule_ref. FIELD-SYMBOLS: <fs_tab> TYPE ANY TABLE. ASSIGN io_table->* TO <fs_tab> . - CREATE DATA lr_data LIKE LINE OF <fs_tab>. lo_structdescr ?= cl_abap_structdescr=>describe_by_data_ref( lr_data ). - "for DDIC structure get the info directly - IF lo_structdescr->is_ddic_type( ) = abap_true. - lt_dfies = lo_structdescr->get_ddic_field_list( ). + lt_dfies = zcl_excel_common=>describe_structure( io_struct = lo_structdescr ). - LOOP AT lt_dfies INTO ls_dfies. + loop at lt_dfies into ls_dfies. MOVE-CORRESPONDING ls_dfies TO ls_fcat. * ls_fcat-columnname = ls_dfies-fieldname. ls_fcat-col_pos = ls_dfies-position. @@ -157,32 +113,7 @@ ENDMETHOD. get_columns_info( CHANGING xs_fcat = ls_fcat ) . INSERT ls_fcat INTO TABLE wt_fcat. - ENDLOOP. - ELSE. - "if structure is not DDIC check components - lt_components = lo_structdescr->get_components( ). - LOOP AT lt_components INTO ls_component. - lv_sytabix = sy-tabix. - CLEAR ls_fcat. - lo_elemdescr ?= ls_component-type. - "component is DDIC - IF lo_elemdescr->is_ddic_type( ) = abap_true. - ls_dfies = lo_elemdescr->get_ddic_field( ). - MOVE-CORRESPONDING ls_dfies TO ls_fcat. -* ls_fcat-columnname = ls_component-name. - ELSE. - "component is not DDIC -> return minimum information required - ls_fcat-fieldname = ls_component-name. -* ls_fcat-columnname = ls_component-name. - ls_fcat-scrtext_m = ls_component-name. - ENDIF. - ls_fcat-col_opt = abap_true. - ls_fcat-col_pos = lv_sytabix. - get_fields_info( CHANGING xs_fcat = ls_fcat ) . - - INSERT ls_fcat INTO TABLE wt_fcat. - ENDLOOP. - ENDIF. + endloop. ENDMETHOD. diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_SALV_TABLE.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_SALV_TABLE.slnk index 4173e94..50e92e4 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_SALV_TABLE.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER_SALV_TABLE.slnk @@ -1,30 +1,5 @@ - class ZCL_EXCEL_CONVERTER_SALV_TABLE definition - public - inheriting from ZCL_EXCEL_CONVERTER_ALV - final - create public . - -*"* public components of class ZCL_EXCEL_CONVERTER_SALV_TABLE -*"* do not include other source files here!!! -public section. - - methods ZIF_EXCEL_CONVERTER~CAN_CONVERT_OBJECT - redefinition . - methods ZIF_EXCEL_CONVERTER~CREATE_FIELDCATALOG - redefinition . - *"* protected components of class ZCL_EXCEL_CONVERTER_SALV_TABLE -*"* do not include other source files here!!! -protected section. - *"* private components of class ZCL_EXCEL_CONVERTER_SALV_TABLE -*"* do not include other source files here!!! -private section. - - methods LOAD_DATA - importing - !IO_SALV type ref to CL_SALV_TABLE - !IT_TABLE type STANDARD TABLE . *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -58,6 +33,8 @@ ENDMETHOD. zif_excel_converter~can_convert_object( io_object = io_object ). ENDTRY. + ws_option = is_option. + lo_salv ?= io_object. CLEAR: es_layout, @@ -73,8 +50,8 @@ ENDMETHOD. get_color( EXPORTING io_table = eo_table IMPORTING et_colors = et_colors ) . - get_filter( EXPORTING io_table = eo_table - IMPORTING et_filter = et_filter ) . + get_filter( IMPORTING et_filter = et_filter + CHANGING xo_table = eo_table ) . update_catalog( CHANGING cs_layout = es_layout ct_fieldcatalog = et_fieldcatalog ). diff --git a/ZA2X/DOMA/ZEXCEL_CONVERTER_OPTION.slnk b/ZA2X/DOMA/ZEXCEL_CONVERTER_OPTION.slnk new file mode 100644 index 0000000..9dbe0e3 --- /dev/null +++ b/ZA2X/DOMA/ZEXCEL_CONVERTER_OPTION.slnk @@ -0,0 +1,6 @@ + + + + + + diff --git a/ZA2X/DTEL/DTEL_ZEXCEL_CONVERTER_OPTION_HIDEHD.slnk b/ZA2X/DTEL/DTEL_ZEXCEL_CONVERTER_OPTION_HIDEHD.slnk new file mode 100644 index 0000000..4123dfd --- /dev/null +++ b/ZA2X/DTEL/DTEL_ZEXCEL_CONVERTER_OPTION_HIDEHD.slnk @@ -0,0 +1,4 @@ + + + + diff --git a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_FILTER.slnk b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_FILTER.slnk new file mode 100644 index 0000000..f652647 --- /dev/null +++ b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_FILTER.slnk @@ -0,0 +1,4 @@ + + + + diff --git a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDENC.slnk b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDENC.slnk new file mode 100644 index 0000000..efe0099 --- /dev/null +++ b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_HIDENC.slnk @@ -0,0 +1,4 @@ + + + + diff --git a/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_SUBTOT.slnk b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_SUBTOT.slnk new file mode 100644 index 0000000..ad69df5 --- /dev/null +++ b/ZA2X/DTEL/ZEXCEL_CONVERTER_OPTION_SUBTOT.slnk @@ -0,0 +1,4 @@ + + + + diff --git a/ZA2X/INTF/ZIF_EXCEL_CONVERTER.slnk b/ZA2X/INTF/ZIF_EXCEL_CONVERTER.slnk index 52d12e8..b5b71d1 100644 --- a/ZA2X/INTF/ZIF_EXCEL_CONVERTER.slnk +++ b/ZA2X/INTF/ZIF_EXCEL_CONVERTER.slnk @@ -5,13 +5,14 @@ - - - - - - - + + + + + + + + diff --git a/ZA2X/TABL/ZEXCEL_S_CONVERTER_OPTION.slnk b/ZA2X/TABL/ZEXCEL_S_CONVERTER_OPTION.slnk new file mode 100644 index 0000000..19df6d8 --- /dev/null +++ b/ZA2X/TABL/ZEXCEL_S_CONVERTER_OPTION.slnk @@ -0,0 +1,8 @@ + + + + + + + +