From 44fa9a65585a87f5a6b6f3268205393f85d7f09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Schm=C3=B6cker?= Date: Sat, 10 Aug 2013 21:32:38 +0000 Subject: [PATCH] Preparations to advance #268 Adding messageclass to enable multilingual exceptions and messages and better cross-referencing. Enhancing ZCX_EXCEL to have a substitute for non-classbased "message .... raising" and to enable unittests that are independant of logonlanguage when checking exceptions raised this way. git-svn-id: https://subversion.assembla.com/svn/abap2xlsx/trunk@427 b7d68dce-7c3c-4a99-8ce0-9ea847f5d049 --- ZA2X/CLAS/ZCX_EXCEL.slnk | 87 ++++++++++++++++++--------------------- ZA2X/MSAG/ZABAP2XLSX.slnk | 19 +++++++++ 2 files changed, 59 insertions(+), 47 deletions(-) create mode 100644 ZA2X/MSAG/ZABAP2XLSX.slnk diff --git a/ZA2X/CLAS/ZCX_EXCEL.slnk b/ZA2X/CLAS/ZCX_EXCEL.slnk index 4969668..4bf2cbe 100644 --- a/ZA2X/CLAS/ZCX_EXCEL.slnk +++ b/ZA2X/CLAS/ZCX_EXCEL.slnk @@ -1,32 +1,5 @@ - - class ZCX_EXCEL definition - public - inheriting from CX_STATIC_CHECK - final - create public . - -*"* public components of class ZCX_EXCEL -*"* do not include other source files here!!! -public section. - - constants ZCX_EXCEL type SOTR_CONC value 'E21BC660E7235AF1B7380050568C0F65'. "#EC NOTEXT - data ERROR type STRING . - - methods CONSTRUCTOR - importing - !TEXTID like TEXTID optional - !PREVIOUS like PREVIOUS optional - !ERROR type STRING optional . - - methods IF_MESSAGE~GET_TEXT - redefinition . - *"* protected components of class ZCX_EXCEL -*"* do not include other source files here!!! -protected section. - *"* private components of class ZCX_EXCEL -*"* 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 @@ -36,39 +9,59 @@ private section. *"* use this source file for any macro definitions you need *"* in the implementation part of the class - + + + + + METHOD if_message~get_longtext. + + IF me->error IS NOT INITIAL + OR me->syst_at_raise IS NOT INITIAL. +*--------------------------------------------------------------------* +* If message was supplied explicitly use this as longtext as well +*--------------------------------------------------------------------* + result = me->get_text( ). + ELSE. +*--------------------------------------------------------------------* +* otherwise use standard method to derive text +*--------------------------------------------------------------------* + super->if_message~get_longtext( EXPORTING + preserve_newlines = preserve_newlines + RECEIVING + result = result ). + ENDIF. +ENDMETHOD. + METHOD if_message~get_text. - IF me->ERROR IS NOT INITIAL. - result = me->ERROR . + + IF me->error IS NOT INITIAL. +*--------------------------------------------------------------------* +* If message was supplied explicitly use this +*--------------------------------------------------------------------* + result = me->error . + ELSEIF me->syst_at_raise IS NOT INITIAL. +*--------------------------------------------------------------------* +* If message was supplied by syst create messagetext now +*--------------------------------------------------------------------* + MESSAGE ID syst_at_raise-msgid TYPE syst_at_raise-msgty NUMBER syst_at_raise-msgno + WITH syst_at_raise-msgv1 syst_at_raise-msgv2 syst_at_raise-msgv3 syst_at_raise-msgv4 + INTO result. ELSE. +*--------------------------------------------------------------------* +* otherwise use standard method to derive text +*--------------------------------------------------------------------* CALL METHOD super->if_message~get_text RECEIVING result = result. ENDIF. ENDMETHOD. - - - - - method CONSTRUCTOR. -CALL METHOD SUPER->CONSTRUCTOR -EXPORTING -TEXTID = TEXTID -PREVIOUS = PREVIOUS -. - IF textid IS INITIAL. - me->textid = ZCX_EXCEL . - ENDIF. -me->ERROR = ERROR . -endmethod. - diff --git a/ZA2X/MSAG/ZABAP2XLSX.slnk b/ZA2X/MSAG/ZABAP2XLSX.slnk new file mode 100644 index 0000000..4d06230 --- /dev/null +++ b/ZA2X/MSAG/ZABAP2XLSX.slnk @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + +