Properties | SourceCde
Title | SoftCopy - csv tools |
Original language | DE | Englisch
Created | 03.01.2013 |  | CREYTZ |
Last changed by | 23.02.2021 |  | CREYTZ |
Status | Active |
Attributes
Type | INCLUDE program |
Status | Customer production program |
Application |  |
Authorization Group |  |
Package | ZSOFTCOPY | SoftCopy
| Editor lock
txt
    1
    *&---------------------------------------------------------------------*
    2
    *&  Include           ZSOFTCOPY_CSV_TOOLS                              *
    3
    *&                                                                     *
    4
    *&---------------------------------------------------------------------*
    5
    *&                                                                     *
    6
    *& This file is part of ZSOFTCOPY.                                     *
    7
    *&                                                                     *
    8
    *& ZSOFTCOPY is free software: you can redistribute it and/or modify   *
    9
    *& it under the terms of the GNU General Public License as published   *
    10
    *& by the Free Software Foundation, either version 3 of the License,   *
    11
    *& or any later version.                                               *
    12
    *&                                                                     *
    13
    *& ZSOFTCOPY is distributed in the hope that it will be useful,        *
    14
    *& but WITHOUT ANY WARRANTY; without even the implied warranty of      *
    15
    *& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       *
    16
    *& GNU General Public License for more details.                        *
    17
    *&                                                                     *
    18
    *& You should have received a copy of the GNU General Public License   *
    19
    *& along with ZDOWNLOAD. If not, see <http://www.gnu.org/licenses/>.   *
    20
    *&                                                                     *
    21
    *&---------------------------------------------------------------------*
    22
    *&                                                                     *
    23
    *&  Author:     Ruediger von Creytz     ruediger.creytz@globalbit.net  *
    24
    *&  Copyright:  globalBIT, LLC          http://www.globalbit.net       *
    25
    *&                                                                     *
    26
    *&---------------------------------------------------------------------*
    27
    28
    29
    *-----------------------------------------------------------------------
    30
    * csv_tools
    31
    *-----------------------------------------------------------------------
    32
    FORM csv_tools.
    33
      PERFORM csv_tools_text_elements.
    34
      PERFORM text_tools.
    35
    36
      PERFORM csv_tools_table_structure.
    37
      PERFORM csv_tools_tabstrip.
    38
      PERFORM csv_tools_varid_broken.
    39
    ENDFORM.                    "csv_tools
    40
    41
    42
    *-----------------------------------------------------------------------
    43
    * csv_tools_table_structure
    44
    *-----------------------------------------------------------------------
    45
    FORM csv_tools_table_structure.
    46
      DATA:
    47
      lt_csv TYPE it_string,
    48
      lt_row TYPE it_string,
    49
      ls_row TYPE string,
    50
      ls_table TYPE st_table_structure.
    51
    52
      FIELD-SYMBOLS:
    53
      <ls_csv> TYPE string,
    54
      <l_fs> TYPE ANY.
    55
    56
      REFRESH gt_table_structure.
    57
    58
      PERFORM csv_table_structure CHANGING lt_csv.
    59
    60
      LOOP AT lt_csv ASSIGNING <ls_csv>.
    61
        SPLIT <ls_csv> AT '|' INTO TABLE lt_row.
    62
        LOOP AT lt_row INTO ls_row.
    63
          IF NOT ls_row IS INITIAL.
    64
            CLEAR ls_table.
    65
            SPLIT ls_row AT ';' INTO
    66
                ls_table-id
    67
                ls_table-row_nr
    68
                ls_table-fieldname
    69
                ls_table-title_elem
    70
                ls_table-link_row
    71
                ls_table-row_def
    72
                ls_table-colored_row
    73
                ls_table-comparator
    74
                ls_table-comp_value.
    75
            IF NOT ls_table-title_elem IS INITIAL.
    76
              ASSIGN (ls_table-title_elem) TO <l_fs>.
    77
              ls_table-title = <l_fs>.
    78
              UNASSIGN <l_fs>.
    79
            ENDIF.
    80
            APPEND ls_table TO gt_table_structure.
    81
          ENDIF.
    82
        ENDLOOP.
    83
      ENDLOOP.
    84
    ENDFORM.                    "csv_tools_table_structure
    85
    86
    87
    *-----------------------------------------------------------------------
    88
    * csv_tools_tabstrip
    89
    *-----------------------------------------------------------------------
    90
    FORM csv_tools_tabstrip.
    91
      DATA:
    92
      lt_csv TYPE it_string,
    93
      lt_row TYPE it_string,
    94
      ls_row TYPE string,
    95
      ls_tabstrip TYPE st_tabstrip.
    96
    97
      FIELD-SYMBOLS:
    98
      <ls_csv> TYPE string,
    99
      <l_fs> TYPE ANY.
    100
    101
      REFRESH gt_tabstrip.
    102
    103
      PERFORM csv_tabstrip CHANGING lt_csv.
    104
    105
      LOOP AT lt_csv ASSIGNING <ls_csv>.
    106
        SPLIT <ls_csv> AT '|' INTO TABLE lt_row.
    107
        LOOP AT lt_row INTO ls_row.
    108
          IF NOT ls_row IS INITIAL.
    109
            CLEAR ls_tabstrip.
    110
            SPLIT ls_row AT ';' INTO
    111
                ls_tabstrip-form
    112
                ls_tabstrip-id
    113
                ls_tabstrip-parent_id
    114
                ls_tabstrip-tab_nr
    115
                ls_tabstrip-firstrow
    116
                ls_tabstrip-active_order
    117
                ls_tabstrip-text_elem
    118
                ls_tabstrip-comparator
    119
                ls_tabstrip-comp_value.
    120
            IF NOT ls_tabstrip-text_elem IS INITIAL.
    121
              ASSIGN (ls_tabstrip-text_elem) TO <l_fs>.
    122
              ls_tabstrip-text = <l_fs>.
    123
              UNASSIGN <l_fs>.
    124
            ENDIF.
    125
            APPEND ls_tabstrip TO gt_tabstrip.
    126
          ENDIF.
    127
        ENDLOOP.
    128
      ENDLOOP.
    129
    ENDFORM.                    "csv_tools_tabstrip
    130
    131
    132
    *-----------------------------------------------------------------------
    133
    * csv_tools_text_elements
    134
    *-----------------------------------------------------------------------
    135
    FORM csv_tools_text_elements.
    136
      DATA:
    137
      lt_csv TYPE it_string,
    138
      lt_row TYPE it_string,
    139
      ls_row TYPE string,
    140
      ls_text_element TYPE st_text_element,
    141
      ls_text_element_t TYPE st_text_element_t.
    142
    143
      FIELD-SYMBOLS:
    144
      <ls_csv> TYPE string.
    145
    146
    *txt
    147
      REFRESH gt_text_element.
    148
    149
      PERFORM csv_text_elements_1 CHANGING lt_csv.
    150
    151
      LOOP AT lt_csv ASSIGNING <ls_csv>.
    152
        SPLIT <ls_csv> AT '|' INTO TABLE lt_row.
    153
        LOOP AT lt_row INTO ls_row.
    154
          IF NOT ls_row IS INITIAL.
    155
            SPLIT ls_row AT ';' INTO
    156
              ls_text_element-fieldname
    157
              ls_text_element-txt_prefix
    158
              ls_text_element-dtel_rollname
    159
              ls_text_element-dtel_field
    160
              ls_text_element-domname
    161
              ls_text_element-domvalue
    162
              ls_text_element-icon_id
    163
              ls_text_element-icon_field
    164
              ls_text_element-conc_v1
    165
              ls_text_element-conc_copula
    166
              ls_text_element-conc_v2
    167
              ls_text_element-conc_sep_space
    168
              ls_text_element-msg_id
    169
              ls_text_element-msg_nr
    170
              ls_text_element-msg_v1
    171
              ls_text_element-msg_v2
    172
              ls_text_element-msg_v3
    173
              ls_text_element-msg_v4.
    174
            APPEND ls_text_element TO gt_text_element.
    175
          ENDIF.
    176
        ENDLOOP.
    177
      ENDLOOP.
    178
    179
    *txtt
    180
      REFRESH gt_text_element_t.
    181
    182
      PERFORM csv_text_elements_2 CHANGING lt_csv.
    183
    184
      LOOP AT lt_csv ASSIGNING <ls_csv>.
    185
        SPLIT <ls_csv> AT '|' INTO TABLE lt_row.
    186
        LOOP AT lt_row INTO ls_row.
    187
          IF NOT ls_row IS INITIAL.
    188
            SPLIT ls_row AT ';' INTO
    189
              ls_text_element_t-fieldname
    190
              ls_text_element_t-spras
    191
              ls_text_element_t-text.
    192
            APPEND ls_text_element_t TO gt_text_element_t.
    193
          ENDIF.
    194
        ENDLOOP.
    195
      ENDLOOP.
    196
    ENDFORM.                    "csv_tools_text_elements
    197
    198
    199
    *-----------------------------------------------------------------------
    200
    * csv_tools_varid_broken
    201
    *-----------------------------------------------------------------------
    202
    FORM csv_tools_varid_broken.
    203
      DATA:
    204
      lt_csv TYPE it_string,
    205
      lt_row TYPE it_string,
    206
      ls_row TYPE string,
    207
      ls_varid TYPE st_varid.
    208
    209
      FIELD-SYMBOLS:
    210
      <ls_csv> TYPE string.
    211
    212
      REFRESH gt_varid_broken.
    213
    214
      PERFORM csv_varid_broken CHANGING lt_csv.
    215
    216
      LOOP AT lt_csv ASSIGNING <ls_csv>.
    217
        SPLIT <ls_csv> AT '|' INTO TABLE lt_row.
    218
        LOOP AT lt_row INTO ls_row.
    219
          IF NOT ls_row IS INITIAL.
    220
            SPLIT ls_row AT ';' INTO ls_varid-report ls_varid-vari.
    221
            APPEND ls_varid TO gt_varid_broken.
    222
          ENDIF.
    223
        ENDLOOP.
    224
      ENDLOOP.
    225
    ENDFORM.                    "csv_tools_varid_broken