*&---------------------------------------------------------------------* *& Include ZSOFTCOPY_TEXT_TOOLS * *& * *&---------------------------------------------------------------------* *& * *& This file is part of ZSOFTCOPY. * *& * *& ZSOFTCOPY 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 3 of the License, * *& or any later version. * *& * *& ZSOFTCOPY 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 ZDOWNLOAD. If not, see . * *& * *&---------------------------------------------------------------------* *& * *& Author: Ruediger von Creytz ruediger.creytz@globalbit.net * *& Copyright: globalBIT, LLC http://www.globalbit.net * *& * *&---------------------------------------------------------------------* *----------------------------------------------------------------------- * text_tools *----------------------------------------------------------------------- FORM text_tools. PERFORM text_tools_text_elements. PERFORM text_tools_text_concatenated. PERFORM text_tools_text_message. *tables are not needed any more: REFRESH: gt_text_element, gt_text_element_t. ENDFORM. "text_tools *----------------------------------------------------------------------- * text_tools_text_concatenated *----------------------------------------------------------------------- FORM text_tools_text_concatenated. DATA: l_text TYPE string, l_str1 TYPE string, l_str2 TYPE string. FIELD-SYMBOLS: TYPE st_text_element, TYPE ANY, TYPE ANY, TYPE ANY. LOOP AT gt_text_element ASSIGNING WHERE is_set = abap_false AND ( NOT conc_v1 IS INITIAL or NOT conc_copula IS INITIAL OR NOT conc_v2 IS INITIAL ). CLEAR l_str1. CLEAR l_str2. CLEAR l_text. IF NOT -conc_v1 IS INITIAL. ASSIGN (-conc_v1) TO . l_str1 = . UNASSIGN . ENDIF. IF NOT -conc_v2 IS INITIAL. ASSIGN (-conc_v2) TO . l_str2 = . UNASSIGN . ENDIF. IF -conc_sep_space = abap_false. CONCATENATE l_str1 -conc_copula l_str2 INTO l_text. ELSE. CONCATENATE l_str1 -conc_copula l_str2 INTO l_text SEPARATED BY space. ENDIF. *Set text IF NOT l_text IS INITIAL. -is_set = abap_true. ASSIGN (-fieldname) TO . = l_text. UNASSIGN . ENDIF. ENDLOOP. ENDFORM. "text_tools_text_concatenated *----------------------------------------------------------------------- * text_tools_text_elements *----------------------------------------------------------------------- FORM text_tools_text_elements. DATA: l_text TYPE string, l_val_text TYPE val_text, l_str TYPE string. FIELD-SYMBOLS: TYPE st_text_element, TYPE st_text_element_t, TYPE ANY. LOOP AT gt_text_element ASSIGNING . CLEAR: l_text, l_str. *Text from CSV READ TABLE gt_text_element_t ASSIGNING WITH KEY fieldname = -fieldname spras = sy-langu. IF sy-subrc = 0 AND NOT -text IS INITIAL. -is_set = abap_true. l_text = -text. ELSE. *Default text in English from CSV READ TABLE gt_text_element_t ASSIGNING WITH KEY fieldname = -fieldname spras = 'E'. IF sy-subrc = 0. l_text = -text. ENDIF. ENDIF. UNASSIGN . *Text from data element IF -is_set = abap_false AND NOT -dtel_rollname IS INITIAL. PERFORM get_dtel_text USING -dtel_rollname -dtel_field CHANGING l_str. IF NOT l_str IS INITIAL. -is_set = abap_true. l_text = l_str. ENDIF. ENDIF. *Text from domain value IF -is_set = abap_false AND NOT -domname IS INITIAL. PERFORM get_dom_value_text USING -domname -domvalue CHANGING l_val_text. IF NOT l_val_text IS INITIAL. -is_set = abap_true. l_text = l_val_text. ENDIF. ENDIF. *Text from icon IF -is_set = abap_false AND NOT -icon_id IS INITIAL. PERFORM get_icon_text USING -icon_id -icon_field CHANGING l_str. IF NOT l_str IS INITIAL. -is_set = abap_true. l_text = l_str. ENDIF. ENDIF. *Set text IF NOT l_text IS INITIAL. ASSIGN (-fieldname) TO . = l_text. UNASSIGN . ENDIF. ENDLOOP. ENDFORM. "text_tools_text_elements *----------------------------------------------------------------------- * text_tools_text_message *----------------------------------------------------------------------- FORM text_tools_text_message. DATA: l_text TYPE string, l_str1 TYPE string, l_str2 TYPE string, l_str3 TYPE string, l_str4 TYPE string. FIELD-SYMBOLS: TYPE st_text_element, TYPE ANY, TYPE ANY, TYPE ANY, TYPE ANY, TYPE ANY. LOOP AT gt_text_element ASSIGNING WHERE is_set = abap_false AND NOT msg_id IS INITIAL. CLEAR: l_str1, l_str2, l_str3, l_str4, l_text. IF NOT -msg_v1 IS INITIAL. ASSIGN (-msg_v1) TO . IF IS ASSIGNED. l_str1 = . ENDIF. UNASSIGN . ENDIF. IF NOT -msg_v2 IS INITIAL. ASSIGN (-msg_v2) TO . IF IS ASSIGNED. l_str2 = . ENDIF. UNASSIGN . ENDIF. IF NOT -msg_v3 IS INITIAL. ASSIGN (-msg_v3) TO . IF IS ASSIGNED. l_str3 = . ENDIF. UNASSIGN . ENDIF. IF NOT -msg_v4 IS INITIAL. ASSIGN (-msg_v4) TO . IF IS ASSIGNED. l_str4 = . ENDIF. UNASSIGN . ENDIF. PERFORM get_message_text USING -msg_id -msg_nr l_str1 l_str2 l_str3 l_str4 CHANGING l_text. *Set text IF NOT l_text IS INITIAL. -is_set = abap_true. ASSIGN (-fieldname) TO . = l_text. UNASSIGN . ENDIF. ENDLOOP. ENDFORM. "text_tools_text_message