Properties SourceCde
txt
1
*&--------------------------------------------------------------------*
2
*&      Form TEMPORAL_DELIMITATION                                    *
3
*&--------------------------------------------------------------------*
4
* process temporal delimitation                                       *
5
*&--------------------------------------------------------------------*
6
FORM temporal_delimitation.
7
  constants: highdate TYPE d VALUE '99991231'.
8
  DATA: entries_exist(1) TYPE c,
9
        enddate_safe TYPE d, act(1) TYPE c, act_txt(1) TYPE c,
10
        hf TYPE i,
11
        date_safe TYPE d,
12
        ok_code_safe LIKE ok_code, function_safe LIKE function,
13
        delim_entr_safe TYPE STANDARD TABLE OF vim_delim_entr_tl
14
         WITH DEFAULT KEY INITIAL SIZE 10,
15
        collapsed_mkeys_safe TYPE STANDARD TABLE
16
         OF vim_collapsed_mkeys_tl WITH DEFAULT KEY INITIAL SIZE 1,
17
        merged_entr_safe TYPE STANDARD TABLE      "merged entries
18
         OF vim_merged_entr_tl WITH DEFAULT KEY INITIAL SIZE 1.
19
 
20
  CHECK x_header-delmdtflag NE space.
21
* check if dates entered properly
22
  IF ( <vim_new_begdate> is initial OR
23
     <vim_enddate_mask> EQ vim_init_date ) AND
24
     status-mode EQ list_bild.         "only on list screen
25
    MESSAGE e127(sv)."Bitte den Gültigkeitsbereich eingrenzen
26
  ENDIF.
27
* process delimitation
28
  IF x_header-clidep NE space.
29
    MOVE sy-mandt TO <client>.
30
  ENDIF.
31
  IF <xact> NE leer AND neuer NE 'J' AND status-delete NE geloescht AND
32
     ( status-action NE kopieren AND vim_special_mode EQ space OR
33
       vim_special_mode EQ vim_delimit ).
34
    READ TABLE total WITH KEY <vim_xextract_key> BINARY SEARCH.
35
    CHECK sy-subrc EQ 0.
36
  ELSE. "entry is new (input, copy, undelete, reset, replace, upgrade)
37
    IF status-mode EQ list_bild.           "only on list screen
38
      IF x_header-delmdtflag EQ 'E' AND    "end date is key field
39
         <vim_new_begdate> GT <vim_enddate_mask>.
40
        MESSAGE e045(sv). "Bitte ein Beginn-Datum angeben, das vor dem
41
      ELSEIF x_header-delmdtflag EQ 'B' AND    "begin date is key field
42
             <vim_new_begdate> LT <vim_enddate_mask>.
43
        MESSAGE e046(sv). "Bitte ein Ende-Datum angeben, das nach dem be
44
      ENDIF.
45
    ENDIF.
46
    LOOP AT total.
47
      CHECK <vim_tot_mkey_beforex> EQ <vim_f1_beforex> AND
48
            ( vim_mkey_after_exists EQ space OR
49
              <vim_tot_mkey_afterx> EQ <vim_f1_afterx> ).
50
*      CHECK <vim_tot_mkey_before> EQ <vim_f1_before> AND
51
*            ( vim_mkey_after_exists EQ space OR
52
*              <vim_tot_mkey_after> EQ <vim_f1_after> ).
53
      MOVE 'X' TO entries_exist.
54
      EXIT.
55
    ENDLOOP.
56
    CHECK entries_exist NE space.
57
    MOVE: <table2_x> TO <vim_xtotal>,
58
          <vim_enddate_mask> TO <vim_enddate>.
59
    IF x_header-delmdtflag EQ 'E'.
60
      MOVE highdate TO <vim_begdate>.
61
    ELSE.
62
      CLEAR <vim_begdate>.
63
    ENDIF.
64
  ENDIF.
65
  CHECK <vim_new_begdate> NE <vim_begdate>.
66
* check allowed keyranges
67
  IF x_header-customauth CO sap_cust_ctrl_classes OR
68
     vim_ale_keyspec_check NE space.
69
    PERFORM check_allowed_keyranges.
70
  ENDIF.
71
  IF x_header-delmdtflag EQ 'E'.       "end date is key field
72
    IF <vim_new_begdate> GT <vim_enddate>.
73
      MESSAGE e045(sv). "Bitte ein Beginn-Datum angeben, das vor dem End
74
    ELSEIF <vim_new_begdate> LT <vim_begdate>.
75
      PERFORM temp_delim_del_overld_entries USING <vim_new_begdate>
76
                                                  <vim_enddate>.
77
    ELSE.
78
      <vim_enddate> = <vim_new_begdate> - 1.
79
      IF x_header-texttbexst NE space AND
80
         x_header-ptfrkyexst EQ space.
81
        PERFORM vim_temp_delim_texttab
82
          USING <vim_enddate_mask> <vim_xextract_key>. "SW Texttransl
83
        IF x_header-bastab NE space.
84
          MOVE: <vim_enddate> TO <vim_text_enddate>,
85
                neuer_eintrag TO <action_text>.
86
        ENDIF.
87
      ENDIF.
88
      READ TABLE total WITH KEY <vim_xtotal_key> BINARY SEARCH
89
                                                TRANSPORTING NO FIELDS.
90
*      READ TABLE total WITH KEY <vim_total_key> BINARY SEARCH
91
*                                                TRANSPORTING NO FIELDS.
92
      IF sy-subrc NE 0.
93
        <action> = neuer_eintrag.
94
        <mark> = nicht_markiert.       "new entries are never marked
95
        INSERT total INDEX sy-tabix.
96
      ELSE.
97
* entry MUST be a deleted one
98
        MESSAGE w121(sv). "Gelöschter Eintrag wird zurückgeholt und ggf.
99
        PERFORM temp_delim_determine_action USING sy-tabix act act_txt.
100
        <action> = act.
101
        IF x_header-bastab NE space AND x_header-texttbexst NE space.
102
          <action_text> = act_txt.
103
        ENDIF.
104
        MODIFY total INDEX sy-tabix.
105
      ENDIF.
106
    ENDIF.
107
  ELSE.                                "begin date is key field
108
    IF <vim_new_begdate> LT <vim_enddate>.
109
      MESSAGE e046(sv). "Bitte ein Ende-Datum angeben, das nach dem begi
110
    ELSEIF <vim_new_begdate> GT <vim_begdate>.
111
      PERFORM temp_delim_del_overld_entries USING <vim_new_begdate>
112
                                                  <vim_enddate>.
113
    ELSE.
114
      <vim_begdate> = <vim_new_begdate>.
115
      IF x_header-bastab NE space AND x_header-texttbexst NE space AND
116
         x_header-ptfrkyexst EQ space.
117
        IF <action_text> EQ original.
118
          MOVE aendern   TO <action_text>.
119
        ENDIF.
120
      ENDIF.
121
      IF <action> EQ original.
122
        <action> = aendern.
123
      ENDIF.
124
      MODIFY total INDEX sy-tabix.
125
      total = extract.
126
      <vim_enddate> = <vim_new_begdate> + 1.
127
      <action> = <xact> = neuer_eintrag.
128
      IF x_header-bastab NE space AND x_header-texttbexst NE space AND
129
         x_header-ptfrkyexst EQ space.
130
        MOVE: <vim_enddate> TO <vim_text_enddate>,
131
              neuer_eintrag TO <action_text>,
132
              neuer_eintrag TO <xact_text>.
133
      ENDIF.
134
      anz_pages = sy-tabix + 1.
135
      INSERT total INDEX anz_pages.
136
    ENDIF.
137
  ENDIF.                               "x_header-delmdtflag eq 'E'
138
  IF temporal_delimitation_happened EQ 'N'.
139
    CLEAR temporal_delimitation_happened. EXIT.
140
  ENDIF.
141
  IF temporal_delimitation_happened NE 'G'.
142
    MOVE sy-tabix TO anz_pages.
143
    LOOP AT vim_delim_entries WHERE index1 GE anz_pages.
144
      ADD 1 TO vim_delim_entries-index1.
145
      MODIFY vim_delim_entries.
146
    ENDLOOP.
147
    MOVE: anz_pages TO vim_delim_entries-index1,
148
          nextline  TO vim_delim_entries-index2,
149
          space     TO vim_delim_entries-index3.
150
    APPEND vim_delim_entries.
151
    MOVE 'X' TO temporal_delimitation_happened.
152
  ENDIF.
153
  IF <xact> NE leer AND neuer NE 'J' AND status-delete NE geloescht AND
154
     ( status-action NE kopieren AND vim_special_mode EQ space OR
155
       vim_special_mode EQ vim_delimit ).
156
    IF x_header-adrnbrflag NE space.
157
* if entry contains address number: ask if new address is wanted
158
      CALL FUNCTION 'POPUP_TO_DECIDE'
159
           EXPORTING
160
                defaultoption = '1'
161
                titel         = svim_text_037
162
                textline1     = svim_text_038
163
                textline2     = svim_text_039
164
                textline3     = svim_text_040
165
                text_option1  = svim_text_041
166
                text_option2  = svim_text_042
167
           IMPORTING
168
                answer        = answer.
169
      CASE answer.
170
        WHEN 'A'. EXIT.
171
        WHEN '2'.                      "clear old address number
172
          CLEAR <address_number>.
173
        WHEN OTHERS.                   "copy old address
174
* not yet possible
175
      ENDCASE.
176
    ENDIF.
177
    IF x_header-guidflag <> space.
178
      PERFORM vim_make_guid USING space.
179
    ENDIF.
180
* if user exit for hidden fields exists: perform exit routine
181
    IF x_header-frm_h_flds NE space.
182
      PERFORM (x_header-frm_h_flds) IN PROGRAM.
183
    ENDIF.
184
* if user exit for new entries exists: perform exit routine
185
    IF x_header-frm_on_new NE space.
186
      PERFORM (x_header-frm_on_new) IN PROGRAM.
187
    ENDIF.
188
* if entry contains address number: call address maintain
189
    IF x_header-adrnbrflag NE space AND answer EQ '2'.
190
      PERFORM address_maintain.
191
    ENDIF.
192
* if user exit after delimitation exists: perform exit routine
193
    IF x_header-frm_af_dlm NE space.
194
      delim_entr_safe = vim_delim_entries[].
195
      collapsed_mkeys_safe = vim_collapsed_mainkeys[].
196
      merged_entr_safe = vim_merged_entries[].
197
      IF status-mode EQ detail_bild.
198
        ok_code_safe = ok_code. function_safe = function.
199
      ENDIF.
200
      PERFORM (x_header-frm_af_dlm) IN PROGRAM.
201
      MOVE delim_entr_safe TO vim_delim_entries[].
202
      MOVE collapsed_mkeys_safe TO vim_collapsed_mainkeys[].
203
      MOVE merged_entr_safe TO vim_merged_entries[].
204
      IF status-mode EQ detail_bild.
205
        MOVE: ok_code_safe TO ok_code, function_safe TO function.
206
      ENDIF.
207
    ENDIF.
208
  ENDIF.
209
ENDFORM.                               "temp_delimitation