Properties SourceCde
txt
1
*&--------------------------------------------------------------------*
2
*&      Form  TEMP_DELIM_DEL_OVERLED_ENTRIES                          *
3
*&--------------------------------------------------------------------*
4
* delete entries with overlaying time ranges                          *
5
*---------------------------------------------------------------------*
6
* BEGDATE ---> E: new begin date /B: new end date                     *
7
* ENDDATE ---> E: end date /B: begin date                             *
8
*&--------------------------------------------------------------------*
9
FORM temp_delim_del_overld_entries USING value(begdate) TYPE d
10
                                         value(enddate) TYPE d.
11
  LOCAL: extract, <table1>.
12
  DATA: first(1) TYPE c VALUE 'X', overlayed(1) TYPE c, cur_ix TYPE i,
13
        date_increment TYPE i, enddate_safe(8) TYPE c, new_ix TYPE i,
14
        trans_pattern(6) TYPE c, act_safe, mark_safe, act_txt_safe,
15
        enddate_safe2(8) TYPE c, act, act_txt, hf TYPE i,
16
        key_safe LIKE vim_merged_entries-new_key, date_safe TYPE d,
17
*        old_key TYPE vim_line_ul,
18
        old_keyx type VRSDAT1000.
19
 
20
  IF vim_temp_delim_alr_checked NE space.
21
    CLEAR first.
22
  ENDIF.
23
  LOOP AT total.
24
    CHECK <vim_tot_mkey_beforex> EQ <vim_f1_beforex> AND
25
          ( vim_mkey_after_exists EQ space OR
26
            <vim_tot_mkey_afterx> EQ <vim_f1_afterx> ).
27
    IF vim_special_mode NE vim_upgrade AND
28
       vim_special_mode NE vim_reset AND
29
       vim_special_mode NE vim_replace.
30
      CHECK <vim_enddate> NE enddate.
31
    ENDIF.
32
    CHECK <action> NE geloescht AND
33
          <action> NE neuer_geloescht AND
34
          <action> NE update_geloescht.
35
    CLEAR overlayed.
36
    IF x_header-delmdtflag EQ 'E'.     "end date is key field
37
      CHECK <vim_enddate> GE begdate AND <vim_begdate> LE enddate.
38
      IF <vim_begdate> GE begdate AND <vim_enddate> LT enddate.
39
        MOVE 'F' TO overlayed. "whole old entry is overlayed by new one
40
      ELSEIF <vim_begdate> LT begdate AND <vim_enddate> GT enddate.
41
        MOVE 'M' TO overlayed. "middle of old entry is overl. by new one
42
      ELSEIF <vim_begdate> LE enddate AND <vim_enddate> GT enddate.
43
        MOVE 'P' TO overlayed. "part of old entry is overlayed by new on
44
      ELSEIF <vim_begdate> EQ begdate AND <vim_enddate> EQ enddate.
45
        temporal_delimitation_happened = 'N'. EXIT. "no delim required
46
      ELSEIF <vim_enddate> EQ enddate.
47
        MOVE 'E' TO overlayed. "end of old entry is overlayed by new one
48
      ENDIF.
49
      MOVE -1 TO date_increment.
50
    ELSE.                              "begin date is key field
51
      CHECK <vim_enddate> LE begdate AND <vim_begdate> GE enddate. "entr
52
      IF <vim_begdate> LE begdate AND <vim_enddate> GT enddate.
53
        MOVE 'F' TO overlayed. "whole old entry is overlayed by new one
54
      ELSEIF <vim_enddate> LT enddate AND <vim_begdate> GT begdate.
55
        MOVE 'M' TO overlayed. "middle of old entry is overl. by new one
56
      ELSEIF <vim_enddate> LE enddate AND <vim_begdate> GT enddate.
57
        MOVE 'P' TO overlayed. "part of old entry is overlayed by new on
58
      ELSEIF <vim_begdate> EQ begdate AND <vim_enddate> EQ enddate.
59
        temporal_delimitation_happened = 'N'. EXIT. "no delim required
60
      ELSEIF <vim_enddate> EQ enddate.
61
        MOVE 'E' TO overlayed. "begin of old entry is overlayed by new o
62
      ENDIF.
63
      MOVE 1 TO date_increment.
64
    ENDIF.                             "x_header-delmdtflag eq 'E'
65
    IF first NE space.
66
      IF vim_special_mode NE vim_reset.
67
        MESSAGE w047(sv). "Überlagerte Sätze werden gelöscht
68
      ELSE.
69
        MESSAGE i047(sv). "Überlagerte Sätze werden gelöscht
70
      ENDIF.
71
      CLEAR first.
72
    ENDIF.
73
    cur_ix = sy-tabix.
74
    CLEAR vim_delim_entries.
75
    READ TABLE extract WITH KEY <vim_xtotal_key>.
76
*    READ TABLE extract WITH KEY total.
77
    IF sy-subrc EQ 0.
78
      MOVE sy-tabix TO vim_delim_entries-index3.
79
      IF overlayed NE 'P' AND overlayed NE 'M' AND overlayed NE 'E'.
80
        APPEND vim_delim_entries.
81
      ENDIF.
82
    ENDIF.
83
    IF overlayed EQ space OR overlayed EQ 'F'.
84
* delete old entry which is overlayed
85
      MOVE: original TO trans_pattern, geloescht TO trans_pattern+1(1),
86
            aendern  TO trans_pattern+2(1), update_geloescht
87
                                                 TO trans_pattern+3(1),
88
            neuer_eintrag TO trans_pattern+4(1), neuer_geloescht
89
                                                 TO trans_pattern+5(1).
90
      TRANSLATE <action> USING trans_pattern.
91
      IF x_header-bastab NE space AND x_header-texttbexst NE space AND
92
         x_header-ptfrkyexst EQ space.
93
        TRANSLATE <action_text> USING trans_pattern.
94
      ENDIF.
95
      IF <mark> EQ markiert.
96
        <mark> = nicht_markiert.
97
        SUBTRACT 1 FROM mark_total.
98
      ENDIF.
99
      MODIFY total.
100
    ENDIF. "overlayed eq space or overlayed eq 'F'
101
    IF overlayed EQ space OR overlayed EQ 'M' OR overlayed EQ 'E'.
102
* create new entry due to delimitation
103
      IF overlayed EQ 'M'.
104
        MOVE: <vim_enddate> TO enddate_safe, <action> TO act_safe,
105
              <mark> TO mark_safe.
106
        IF x_header-bastab NE space AND x_header-texttbexst NE space.
107
          MOVE <action_text> TO act_txt_safe.
108
        ENDIF.
109
      ENDIF.
110
      CLEAR hf.
111
      old_keyx = <vim_xtotal_key>.                 "SW Texttransl
112
*      old_key = total.
113
      <vim_enddate> = begdate + date_increment.
114
      CHECK <vim_enddate> GE <vim_begdate>.                 "aro 070798
115
      <action> = neuer_eintrag.
116
      <mark> = nicht_markiert.
117
      IF x_header-texttbexst NE space AND
118
         x_header-ptfrkyexst EQ space.
119
        PERFORM vim_temp_delim_texttab
120
                 USING enddate old_keyx.  "SW Texttransl
121
        IF x_header-bastab NE space.
122
          MOVE: <vim_enddate> TO <vim_text_enddate>,
123
                neuer_eintrag TO <action_text>.
124
        ENDIF.
125
      ENDIF.
126
      IF vim_special_mode NE space.    "special mode
127
        PERFORM temp_delim_undelete USING <vim_enddate_mask>
128
                                          <vim_begdate>
129
                                          act act_txt new_ix.
130
        IF new_ix NE 0.
131
          MOVE act TO <action>.
132
          IF x_header-bastab NE space AND x_header-texttbexst NE space.
133
            MOVE act_txt TO <action_text>.
134
          ENDIF.
135
          MODIFY total INDEX new_ix.
136
        ENDIF.
137
      ENDIF.                           "special mode
138
      IF vim_special_mode EQ space OR sy-subrc NE 0.
139
        IF x_header-delmdtflag EQ 'E'. "end date is key field
140
          new_ix = cur_ix. INSERT total.
141
        ELSE.                          "begin date is key field
142
          new_ix = cur_ix + 1. INSERT total INDEX new_ix.
143
        ENDIF.                         "x_header-delmdtflag eq 'E'
144
      ENDIF.
145
      IF vim_special_mode NE vim_undelete AND
146
         vim_delim_entries-index3 NE 0.
147
        vim_delim_entries-index1 = new_ix.
148
        vim_delim_entries-index2 = vim_delim_entries-index3.
149
        sy-fdpos = vim_delim_entries-index3.
150
        CLEAR vim_delim_entries-index3.
151
        APPEND vim_delim_entries.
152
        vim_delim_entries-index3 = sy-fdpos.
153
      ENDIF.                           "no undelete mode
154
    ENDIF. "overlayed eq space or overlayed eq 'M'
155
    IF overlayed EQ 'P' OR overlayed EQ 'M'.
156
      IF overlayed EQ 'M'.
157
        MOVE: enddate_safe TO <vim_enddate>, act_safe TO <action>,
158
              mark_safe TO <mark>.
159
        IF x_header-bastab NE space AND x_header-texttbexst NE space.
160
          MOVE act_txt_safe TO <action_text>.
161
        ENDIF.
162
      ENDIF.
163
      CLEAR hf.
164
      <vim_begdate> = enddate - date_increment.
165
      MOVE: original TO trans_pattern, aendern TO trans_pattern+1(1).
166
      TRANSLATE <action> USING trans_pattern.
167
      IF <mark> EQ markiert.
168
        <mark> = nicht_markiert.
169
        SUBTRACT 1 FROM mark_total.
170
      ENDIF.
171
      MODIFY total.
172
      IF vim_delim_entries-index3 NE 0.
173
        vim_delim_entries-index1 = cur_ix.
174
        vim_delim_entries-index2 = vim_delim_entries-index3.
175
        APPEND vim_delim_entries.
176
      ENDIF.
177
    ENDIF. "overlayed eq 'P' or overlayed eq 'M'
178
  ENDLOOP.
179
  MOVE 'G' TO temporal_delimitation_happened.
180
ENDFORM.                               "temp_delim_del_overled_entries