From af00a56683cda592ccaed2af8b1df7976d16863a Mon Sep 17 00:00:00 2001 From: StefanSchmoecker Date: Tue, 16 Jun 2015 16:03:05 +0200 Subject: [PATCH] Issue #379 - obsolete function modules Added new class/method to wrap obsolete function GUID_CREATE and use replacement class SAP provides. Old function call still found in wrapper class commented out for use in older releases, which don't have the new methods from SAP yet ( 7.01 does not have it for example ) Replaced calls to function by calls to wrapper-method Changed calculation of last date in month in ZDEMO_CALENDAR since it was calling an obsoleted function as well. --- ZA2X/CLAS/ZCL_EXCEL.slnk | 22 +++++---- ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk | 13 +++--- ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk | 52 +++++++++++++++++++++ ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk | 13 +++--- ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk | 7 +-- ZA2X/PROG/ZDEMO_CALENDAR.slnk | 16 ++++--- 6 files changed, 92 insertions(+), 31 deletions(-) create mode 100644 ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk diff --git a/ZA2X/CLAS/ZCL_EXCEL.slnk b/ZA2X/CLAS/ZCL_EXCEL.slnk index b81d22b..ced9521 100644 --- a/ZA2X/CLAS/ZCL_EXCEL.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL.slnk @@ -170,13 +170,14 @@ ENDMETHOD. me->zif_excel_book_vba_project~vbaproject = ip_vbaproject. endmethod. - + - method ADD_NEW_AUTOFILTER. + + METHOD add_new_autofilter. * Check for autofilter reference: new or overwrite; only one per sheet - ro_autofilter = autofilters->add( io_sheet = io_sheet ) . - endmethod. + ro_autofilter = autofilters->add( io_sheet ) . +ENDMETHOD. @@ -431,8 +432,8 @@ ENDMETHOD. - method GET_STATIC_CELLSTYLE_GUID. -" # issue 139 + METHOD get_static_cellstyle_guid. + " # issue 139 DATA: style LIKE LINE OF me->t_stylemapping1. READ TABLE me->t_stylemapping1 INTO style @@ -442,16 +443,17 @@ ENDMETHOD. IF sy-subrc <> 0. style-complete_style = ip_cstyle_complete. style-complete_stylex = ip_cstylex_complete. - CALL FUNCTION 'GUID_CREATE' - IMPORTING - ev_guid_16 = style-guid. +* CALL FUNCTION 'GUID_CREATE' +* IMPORTING +* ev_guid_16 = style-guid. + style-guid = zcl_excel_obsolete_func_wrap=>guid_create( ). INSERT style INTO TABLE me->t_stylemapping1. INSERT style INTO TABLE me->t_stylemapping2. ENDIF. ep_guid = style-guid. - endmethod. +ENDMETHOD. diff --git a/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk b/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk index 6ba6b3d..8e292bf 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_DRAWING.slnk @@ -1,5 +1,5 @@ - + *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -45,11 +45,12 @@ - method CONSTRUCTOR. + METHOD constructor. - CALL FUNCTION 'GUID_CREATE' - IMPORTING - ev_guid_16 = me->guid. +* 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. title = ip_title. @@ -63,7 +64,7 @@ anchor = anchor_one_cell. from_loc-col = 1. from_loc-row = 1. - endmethod. +ENDMETHOD. diff --git a/ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk b/ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk new file mode 100644 index 0000000..c959881 --- /dev/null +++ b/ZA2X/CLAS/ZCL_EXCEL_OBSOLETE_FUNC_WRAP.slnk @@ -0,0 +1,52 @@ + + + *"* use this source file for the definition and implementation of +*"* local helper classes, interface definitions and type +*"* declarations + *"* use this source file for any type of declarations (class +*"* definitions, interfaces or type declarations) you need for +*"* components in the private section + *"* use this source file for any macro definitions you need +*"* in the implementation part of the class + + + + + + + + + + + + + + + + + + + + + + METHOD guid_create. + + TRY. + rv_guid_16 = cl_system_uuid=>if_system_uuid_static~create_uuid_x16( ). + CATCH cx_uuid_error. + ENDTRY. + +*--------------------------------------------------------------------* +* If you are on a release that does not yet have the class cl_system_uuid +* please use the following coding instead which is using the function +* call that was used before but which has been flagged as obsolete +* in newer SAP releases +*--------------------------------------------------------------------* +* +* CALL FUNCTION 'GUID_CREATE' +* IMPORTING +* ev_guid_16 = rv_guid_16. + +ENDMETHOD. + + diff --git a/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk b/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk index 69b0366..b57481e 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_STYLE.slnk @@ -1,5 +1,5 @@ - + *"* local class implementation for public class *"* use this source file for the implementation part of *"* local helper classes @@ -17,7 +17,7 @@ - method CONSTRUCTOR. + METHOD constructor. CREATE OBJECT font. @@ -32,14 +32,15 @@ me->guid = ip_guid. ELSE. * End of insertion # issue 139 - Dateretention of cellstyles - CALL FUNCTION 'GUID_CREATE' - IMPORTING - ev_guid_16 = me->guid. +* 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 * Start of insertion # issue 139 - Dateretention of cellstyles ENDIF. * End of insertion # issue 139 - Dateretention of cellstyles - endmethod. +ENDMETHOD. diff --git a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk index 5c975fc..005a500 100644 --- a/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk +++ b/ZA2X/CLAS/ZCL_EXCEL_WORKSHEET.slnk @@ -3661,9 +3661,10 @@ ENDMETHOD. me->excel = ip_excel. - CALL FUNCTION 'GUID_CREATE' - IMPORTING - ev_guid_16 = me->guid. +* 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. diff --git a/ZA2X/PROG/ZDEMO_CALENDAR.slnk b/ZA2X/PROG/ZDEMO_CALENDAR.slnk index e7cd72c..21647be 100644 --- a/ZA2X/PROG/ZDEMO_CALENDAR.slnk +++ b/ZA2X/PROG/ZDEMO_CALENDAR.slnk @@ -43,7 +43,7 @@ *& 450 pixel height. They must also be saved in the Export Directory. *& In my tests I've discovered a limit of 20 MB in the *& cl_gui_frontend_services=>gui_download method. So keep your images -*& smaller or chnage to a server export using OPEN DATASET. +*& smaller or change to a server export using OPEN DATASET. *&---------------------------------------------------------------------* REPORT zdemo_calendar. @@ -368,11 +368,15 @@ START-OF-SELECTION. ENDIF. " Add Calendar - CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH' - EXPORTING - day_in = date_from - IMPORTING - last_day_of_month = date_to. +* CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH' +* EXPORTING +* day_in = date_from +* IMPORTING +* last_day_of_month = date_to. + date_to = date_from. + date_to+6(2) = '01'. " First of month + add 31 to date_to. " Somewhere in following month + date_to = date_to - date_to+6(2). " Last of month IF p_portr = abap_true. zcl_helper=>add_calendar( EXPORTING