diff --git a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk index ff69a87..6ebfc47 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_COMMON.slnk @@ -1,4 +1,4 @@ - + class ZCL_EXCEL_COMMON definition public @@ -842,22 +842,22 @@ CLASS lcl_excel_common_test IMPLEMENTATION. ENDCLASS. "lcl_Excel_Common_Test ABAP - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + method ASSERT_DIFFERS. DATA: ls_seoclass TYPE seoclass. @@ -900,15 +900,15 @@ ENDCLASS. "lcl_Excel_Common_Test ENDIF. endmethod. - - - - - - - - - + + + + + + + + + method ASSERT_EQUALS. DATA: ls_seoclass TYPE seoclass. @@ -953,9 +953,9 @@ endmethod. ENDIF. endmethod. - - - + + + method CHAR2HEX. IF o_conv IS NOT BOUND. @@ -970,10 +970,10 @@ endmethod. endmethod. - - - - + + + + method CONVERT_COLUMN2ALPHA. DATA: lo_conv TYPE REF TO cl_abap_conv_in_ce, @@ -1000,10 +1000,10 @@ endmethod. endmethod. - - - - + + + + method CONVERT_COLUMN2INT. DATA: lv_uccpi TYPE i, @@ -1091,10 +1091,10 @@ endmethod. endmethod. - - - - + + + + method CONVERT_COLUMNROW2COLUMN_A_ROW. DATA: width TYPE i, col_width TYPE i, @@ -1113,13 +1113,13 @@ endmethod. e_row = row_str. endmethod. - - - - - - - + + + + + + + method CONVERT_RANGE2COLUMN_A_ROW. DATA: sheet TYPE string, @@ -1158,9 +1158,9 @@ endmethod. ). endmethod. - - - + + + method DATE_TO_EXCEL_STRING. DATA: lv_date_diff TYPE i. @@ -1189,8 +1189,8 @@ endmethod. l_position TYPE tabfdpos. "for DDIC structure get the info directly - IF lo_struct->is_ddic_type( ) = abap_true. - rt_dfies = lo_struct->get_ddic_field_list( ). + IF io_struct->is_ddic_type( ) = abap_true. + rt_dfies = io_struct->get_ddic_field_list( ). ELSE. lt_components = io_struct->get_components( ). @@ -1230,9 +1230,9 @@ endmethod. method DESCRIBE_TABLE. endmethod. - - - + + + method ENCRYPT_PASSWORD. DATA lv_curr_offset TYPE i. @@ -1272,9 +1272,9 @@ endmethod. endmethod. - - - + + + method ESCAPE_STRING. DATA lv_value TYPE string. @@ -1290,10 +1290,10 @@ endmethod. endmethod. - - - - + + + + method EXCEL_STRING_TO_DATE. DATA: lv_date_int TYPE i. @@ -1313,10 +1313,10 @@ endmethod. ENDTRY. endmethod. - - - - + + + + method EXCEL_STRING_TO_TIME. DATA: lv_seconds_in_day TYPE i, lv_day_fraction TYPE f, @@ -1336,11 +1336,11 @@ endmethod. ENDTRY. endmethod. - - - - - + + + + + method FAIL. DATA: ls_seoclass TYPE seoclass. @@ -1376,85 +1376,34 @@ endmethod. endmethod. - - - + + + method GET_FIELDCATALOG. + data: lr_data type ref to data, + lo_structdescr type ref to cl_abap_structdescr, + lt_dfies type ddfields, + ls_dfies type dfies, + ls_fieldcatalog type zexcel_s_fieldcatalog. -* it causes a short dump running DEMO_EXCEL3 -* rein vert to old implementation -* -* DATA: lr_data TYPE REF TO data, -* lo_structdescr TYPE REF TO cl_abap_structdescr, -* lt_dfies TYPE ddfields, -* ls_dfies TYPE dfies, -* ls_fieldcatalog TYPE zexcel_s_fieldcatalog. -* -* CREATE DATA lr_data LIKE LINE OF ip_table. -* -* lo_structdescr ?= cl_abap_structdescr=>describe_by_data( lr_data ). -* -* lt_dfies = describe_structure( io_struct = lo_structdescr ). -* -* LOOP AT lt_dfies INTO ls_dfies. -* CLEAR ls_fieldcatalog. -* MOVE-CORRESPONDING ls_dfies TO ls_fieldcatalog. -* APPEND ls_fieldcatalog TO ep_fieldcatalog. -* ENDLOOP. - - 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, - ls_fieldcatalog TYPE zexcel_s_fieldcatalog, - lt_components TYPE abap_component_tab, - ls_component LIKE LINE OF lt_components. - - CREATE DATA lr_data LIKE LINE OF ip_table. + create data lr_data like line of ip_table. 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( ). - - LOOP AT lt_dfies INTO ls_dfies. - CLEAR ls_fieldcatalog. - MOVE-CORRESPONDING ls_dfies TO ls_fieldcatalog. - APPEND ls_fieldcatalog TO ep_fieldcatalog. - 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_fieldcatalog. - 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_fieldcatalog. - ls_fieldcatalog-fieldname = ls_component-name. - ELSE. - "component is not DDIC -> return minimum information required - ls_fieldcatalog-fieldname = ls_component-name. - ls_fieldcatalog-dynpfld = abap_true. - ls_fieldcatalog-scrtext_m = ls_component-name. - ENDIF. - ls_fieldcatalog-position = lv_sytabix. - APPEND ls_fieldcatalog TO ep_fieldcatalog. - ENDLOOP. - ENDIF. + lt_dfies = describe_structure( io_struct = lo_structdescr ). + loop at lt_dfies into ls_dfies. + clear ls_fieldcatalog. + move-corresponding ls_dfies to ls_fieldcatalog. + append ls_fieldcatalog to ep_fieldcatalog. + endloop. endmethod. - - - + + + method NUMBER_TO_EXCEL_STRING. DATA: lv_value_c TYPE c LENGTH 100. @@ -1471,10 +1420,10 @@ endmethod. ENDIF. endmethod. - - - - + + + + method RECURSIVE_CLASS_TO_STRUCT. " # issue 139 * is working for me - but after looking through this coding I guess @@ -1530,10 +1479,10 @@ endmethod. endmethod. - - - - + + + + method RECURSIVE_STRUCT_TO_CLASS. " # issue 139 * is working for me - but after looking through this coding I guess @@ -1590,9 +1539,9 @@ endmethod. endmethod. - - - + + + method SHL01. DATA: @@ -1610,9 +1559,9 @@ endmethod. endmethod. - - - + + + method SHR14. DATA: @@ -1676,9 +1625,9 @@ endmethod. endmethod. - - - + + + method TIME_TO_EXCEL_STRING. DATA: lv_seconds_in_day TYPE i, lv_day_fraction TYPE f, diff --git a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk index 5044f31..b4a39e8 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_CONVERTER.slnk @@ -1762,18 +1762,14 @@ endmethod. endmethod. - method SET_FIELDCATALOG. + METHOD set_fieldcatalog. + 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. - - DATA: ls_fcat TYPE zexcel_s_converter_fcat. - + ls_fieldcatalog TYPE zexcel_s_fieldcatalog. + DATA: ls_fcat TYPE zexcel_s_converter_fcat. FIELD-SYMBOLS: <fs_tab> TYPE ANY TABLE. @@ -1783,41 +1779,17 @@ endmethod. 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. - MOVE-CORRESPONDING ls_dfies TO ls_fcat. - ls_fcat-columnname = ls_dfies-fieldname. - INSERT ls_fcat INTO TABLE wt_fieldcatalog. - 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-position = lv_sytabix. - INSERT ls_fcat INTO TABLE wt_fieldcatalog. - ENDLOOP. - ENDIF. + LOOP AT lt_dfies INTO ls_dfies. + MOVE-CORRESPONDING ls_dfies TO ls_fcat. + ls_fcat-columnname = ls_dfies-fieldname. + INSERT ls_fcat INTO TABLE wt_fieldcatalog. + ENDLOOP. clean_fieldcatalog( ). -endmethod. +ENDMETHOD.