Properties SourceCde
txt
1
*&---------------------------------------------------------------------*
2
*&  Include           ZUTIL_SRC_WITHOUT_INCLUDES                       *
3
*&                                                                     *
4
*&---------------------------------------------------------------------*
5
*&                                                                     *
6
*& This file is part of ZUTIL.                                         *
7
*&                                                                     *
8
*& ZUTIL 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
*& ZUTIL 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 ZUTIL. 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
TYPES:
30
  BEGIN OF st_level,
31
    level TYPE syindex,
32
  END OF st_level,
33
  it_level TYPE STANDARD TABLE OF st_level,
34
  BEGIN OF st_offset,
35
    index  typE syindex,
36
    length typE syindex,
37
  END OF st_offset,
38
  it_offset type standard table of st_offset,
39
  BEGIN OF st_src_include_index,
40
    include   TYPE progname,
41
    line_from TYPE syindex,
42
    line_to   TYPE syindex,
43
    level     TYPE syindex,
44
  END OF st_src_include_index,
45
  it_src_include_index TYPE STANDARD TABLE OF st_src_include_index.
46
 
47
 
48
*-----------------------------------------------------------------------
49
* get_src_without_includes
50
*-----------------------------------------------------------------------
51
FORM get_src_without_includes
52
  USING
53
    it_src TYPE rswsourcet
54
    value(i_src_name) TYPE progname
55
    value(i_check) TYPE flag
56
    value(i_progname) TYPE progname
57
    value(i_replace) TYPE progname
58
  CHANGING
59
    ct_src_no_includes TYPE rswsourcet
60
    ct_index TYPE it_src_include_index.
61
 
62
  DATA BEGIN OF lh_tk OCCURS 5000.
63
         INCLUDE STRUCTURE stokex.
64
  DATA END OF lh_tk.
65
  DATA BEGIN OF stm OCCURS 1000.
66
         INCLUDE STRUCTURE sstmnt.
67
  DATA END OF stm.
68
  DATA BEGIN OF lv OCCURS 100.
69
         INCLUDE STRUCTURE slevel.
70
  DATA END OF lv.
71
 
72
  DATA:
73
    ls_index TYPE st_src_include_index,
74
    ls_index_t TYPE st_src_include_index,
75
    ls_offset type st_offset,
76
    ls_old_level TYPE st_level,
77
    ls_source TYPE abapsource,
78
    lt_include TYPE rswsourcet,
79
    lt_offset type it_offset,
80
    lt_old_level TYPE it_level,
81
    lt_source TYPE STANDARD TABLE OF abapsource,
82
    l_diff_end TYPE syindex,
83
    l_diff_new TYPE syindex,
84
    l_dollar_include TYPE progname,
85
    l_function TYPE flag,
86
    l_function_include TYPE progname,
87
    l_i TYPE syindex,
88
    l_include_count TYPE syindex,
89
    l_include_index TYPE sytabix,
90
    l_include_lines TYPE syindex,
91
    l_index_lines TYPE syindex,
92
    l_index_old_line_to TYPE syindex,
93
    l_level_dif TYPE syindex,
94
    l_level_t TYPE sytabix,
95
    l_lv_level_new TYPE level_levl,
96
    l_lv_level_old TYPE level_levl,
97
    l_msg(256),
98
    l_next TYPE syindex,
99
    l_next_level TYPE syindex,
100
    l_offset_lines TYPE syindex,
101
    l_offset_old_incl_anw TYPE syindex,
102
    l_old_level_lines TYPE sytabix,
103
    l_old_next_level TYPE sytabix,
104
    l_overflow_area(65535),
105
    l_source_lines TYPE syindex,
106
    l_stm_from TYPE stmnt_from,
107
    l_stm_index TYPE sytabix,
108
    l_stm_level TYPE stmnt_levl,
109
    l_str(255),
110
    l_tabix TYPE sytabix.
111
 
112
  FIELD-SYMBOLS:
113
    <l_fs>,
114
    <ls_offset> type st_offset.
115
 
116
 
117
  CALL FUNCTION 'RS_WORKING_AREA_INIT'.
118
  IF i_src_name NE space AND i_progname NE space.
119
    READ REPORT i_progname INTO lt_source.
120
    SCAN ABAP-SOURCE lt_source
121
      TOKENS INTO lh_tk
122
      STATEMENTS INTO stm
123
      LEVELS INTO lv
124
      OVERFLOW INTO l_overflow_area
125
      PROGRAM FROM i_progname
126
      MESSAGE INTO l_msg
127
      WITH INCLUDES
128
      WITHOUT TRMAC
129
      WITH ANALYSIS.
130
  ELSE.
131
    lt_source[] = it_src[].
132
    SCAN ABAP-SOURCE lt_source
133
      TOKENS INTO lh_tk
134
      STATEMENTS INTO stm
135
      LEVELS INTO lv
136
      OVERFLOW INTO l_overflow_area
137
      PROGRAM FROM i_src_name
138
      MESSAGE INTO l_msg
139
      WITH INCLUDES
140
      WITHOUT TRMAC
141
      WITH ANALYSIS.
142
  ENDIF.
143
  CLEAR:
144
    l_lv_level_new,
145
    l_lv_level_old.
146
  DESCRIBE TABLE lt_source LINES l_source_lines.
147
  l_tabix = 1.
148
  DO.     "LOOP AT stm.
149
    READ TABLE stm INDEX l_tabix.
150
    IF sy-subrc NE 0.
151
      EXIT.
152
    ENDIF.
153
    l_stm_index = l_tabix.
154
    l_tabix = l_tabix + 1.
155
    l_stm_from = stm-from.
156
    l_stm_level = stm-level.
157
    CLEAR:
158
      l_diff_new,
159
      l_diff_end.
160
    READ TABLE lh_tk INDEX l_stm_from.
161
    IF  sy-subrc = 0
162
    AND ( lh_tk-str = 'INCLUDE' OR lh_tk-str = 'FUNCTION' ).
163
      IF lh_tk-str = 'FUNCTION'.
164
        l_function = abap_true.
165
        l_function_include = ls_index-include.
166
        l_dollar_include = ls_index-include.
167
        l_i = strlen( l_dollar_include ) - 3.
168
        ASSIGN l_dollar_include+l_i(1) TO <l_fs>.
169
        IF <l_fs> = 'U'.
170
          <l_fs> = '$'.
171
        ELSE.
172
          l_function = abap_false.
173
          CLEAR l_dollar_include.
174
        ENDIF.
175
      ELSE.
176
        l_function = abap_false.
177
      ENDIF.
178
      l_next = l_stm_from + 1.
179
      READ TABLE lh_tk INDEX l_next.
180
      IF  sy-subrc = 0
181
      AND lh_tk-str NE 'STRUCTURE'
182
      AND lh_tk-str NE 'TYPE'
183
      AND lh_tk-str NE '='
184
      AND lh_tk-str NE '$$UNIT$$'.
185
        IF l_function = abap_true.
186
          ls_index-include = l_dollar_include.
187
        ELSE.
188
          CASE lh_tk-ovfl.
189
            WHEN space.
190
              ASSIGN lh_tk-str TO <l_fs>.
191
            WHEN 'X'.
192
              ASSIGN l_overflow_area TO <l_fs>.
193
            WHEN 'O'.
194
*            MESSAGE S116.
195
              EXIT.
196
          ENDCASE.
197
          IF lh_tk-len1 > 0.
198
            ASSIGN <l_fs>+lh_tk-off1(lh_tk-len1) TO <l_fs>.
199
          ENDIF.
200
          l_str = <l_fs>.
201
          IF l_str(1) = ''''.
202
            SHIFT l_str BY 1 PLACES.
203
          ENDIF.
204
          ls_index-include = l_str.
205
        ENDIF.
206
        IF  i_src_name NE space
207
        AND i_src_name =  l_function_include
208
        AND l_function =  abap_true.
209
          CONTINUE.
210
        ENDIF.
211
        IF ls_index-include = i_replace.
212
          CONTINUE.
213
        ENDIF.
214
        IF l_stm_level NE 0.
215
          READ TABLE lv INDEX l_stm_level.
216
          l_lv_level_new = lv-level + 1.
217
          DESCRIBE TABLE ct_index LINES l_index_lines.
218
          IF lv-level = 0 AND l_index_lines = 0.
219
            IF lv-stmnt = 0.
220
            ELSE.
221
              READ TABLE stm INDEX lv-stmnt.
222
            ENDIF.
223
            READ TABLE lh_tk INDEX stm-from.
224
            DESCRIBE TABLE ct_index LINES l_index_lines.
225
            IF i_src_name NE space AND
226
               i_src_name = ls_index-include AND
227
               i_progname NE i_src_name.
228
              lt_include[] = it_src[].
229
            ELSE.
230
              READ REPORT ls_index-include INTO lt_include.
231
            ENDIF.
232
            DESCRIBE TABLE lt_include LINES l_include_lines.
233
            DESCRIBE TABLE lt_source LINES l_source_lines.
234
            IF stm-level = 1 AND l_index_lines = 0..
235
              IF i_src_name NE space.
236
                ls_index_t-include = i_progname.
237
              ELSE.
238
                ls_index_t-include = i_src_name.
239
              ENDIF.
240
              ls_index_t-line_to = l_include_lines
241
                                   + l_source_lines - 1.
242
              ls_index_t-line_from = 1.
243
              ls_index_t-level = 0.
244
              APPEND ls_index_t TO ct_index.
245
              ls_index-level = lv-level + 1.
246
              ls_index-line_to = l_include_lines + lh_tk-row - 1.
247
              ls_index-line_from = lh_tk-row.
248
              ls_offset-index = lh_tk-row.
249
              ls_offset-length = l_source_lines.
250
              APPEND ls_offset to lt_offset.
251
              l_offset_old_incl_anw = lh_tk-row.
252
            ELSEIF stm-level > 1 AND l_index_lines = 0.
253
              IF i_src_name NE space.
254
                ls_index_t-include = i_progname.
255
              ELSE.
256
                ls_index_t-include = i_src_name.
257
              ENDIF.
258
              ls_index_t-line_to = ls_index-line_to + lh_tk-row..
259
              ls_index_t-line_from = 1.
260
              ls_index_t-level = 0.
261
              APPEND ls_index_t TO ct_index.
262
              ls_index-level = lv-level + 1.
263
              ls_index-line_to = ls_index-line_to + lh_tk-row.
264
              ls_index-line_from = ls_index-line_from + lh_tk-row.
265
              l_offset_old_incl_anw = lh_tk-row.
266
            ELSE.
267
              ls_index-level = lv-level + 1.
268
              IF l_lv_level_new < l_lv_level_old.
269
                READ TABLE lt_offset into ls_offset
270
                  INDEX l_lv_level_new.
271
                l_next_level = l_lv_level_new - 1.
272
                l_diff_end = ls_offset-length
273
                           - ls_offset-index - 1.
274
                READ TABLE lt_offset into ls_offset
275
                  INDEX l_next_level.
276
                l_offset_old_incl_anw = ls_offset-index.
277
                l_diff_new = lh_tk-row - l_offset_old_incl_anw.
278
 
279
                l_index_old_line_to = ls_index-line_to.
280
                ls_index-line_to = ls_index-line_to
281
                                 + l_include_lines + l_diff_new
282
                                 + l_diff_end - 1 .
283
                LOOP AT ct_index INTO ls_index_t.
284
                  IF ls_index_t-level < l_lv_level_new.
285
                    ls_index_t-line_to = ls_index_t-line_to
286
                             + l_include_lines
287
                             + l_diff_new
288
                             + l_diff_end.
289
                    MODIFY ct_index FROM ls_index_t .
290
                  ENDIF.
291
                ENDLOOP.
292
              ELSE.
293
                l_next_level = l_lv_level_new.
294
                READ TABLE lt_offset assigning <ls_offset>
295
                  INDEX l_next_level.
296
                IF sy-subrc = 0.
297
                  <ls_offset>-index = lh_tk-row.
298
                ENDIF.
299
                l_index_old_line_to = ls_index-line_to.
300
                ls_index-line_to = ls_index-line_to
301
                                 + lh_tk-row
302
                                 + l_include_lines.
303
                ls_index-line_from = ls_index-line_from + lh_tk-row.
304
                LOOP AT ct_index INTO ls_index_t.
305
                  IF ls_index_t-level < l_lv_level_new.
306
                    ls_index_t-line_to = ls_index_t-line_to
307
                                       + l_include_lines
308
                                       + lh_tk-row.
309
                    MODIFY ct_index FROM ls_index_t .
310
                  ENDIF.
311
                ENDLOOP.
312
              ENDIF.
313
              IF l_lv_level_new > l_lv_level_old.
314
                ls_index-line_from = ls_index-line_from
315
                                   + lh_tk-row.
316
              ELSEIF l_lv_level_new < l_lv_level_old.
317
                ls_index-line_from = l_index_old_line_to
318
                                   + l_diff_new
319
                                   + l_diff_end.
320
              ELSE.
321
                l_diff_new = lh_tk-row - l_offset_old_incl_anw.
322
                l_offset_old_incl_anw = lh_tk-row.
323
                ls_index-line_from = l_index_old_line_to
324
                                   + l_diff_new.
325
              ENDIF.
326
            ENDIF.
327
            IF lv-stmnt = 0.
328
              READ TABLE stm INDEX l_stm_index.
329
            ELSE.
330
              READ TABLE stm INDEX lv-stmnt.
331
            ENDIF.
332
            READ TABLE lh_tk INDEX stm-from.
333
            IF lh_tk-str = 'INCLUDE'.
334
              IF lv-stmnt = 0.
335
                l_include_index = lh_tk-row.
336
              ELSE.
337
                l_include_index = ls_index-line_from
338
                                + lh_tk-row - 1.
339
              ENDIF.
340
              DELETE lt_source INDEX l_include_index.
341
              INSERT LINES OF lt_include INTO lt_source
342
                     INDEX l_include_index.
343
            ENDIF.
344
            l_lv_level_old = l_lv_level_new.
345
          ELSE.
346
 
347
            ls_index-level = lv-level + 1.
348
            IF l_lv_level_new > l_lv_level_old.
349
              l_source_lines = l_include_lines.
350
            ENDIF.
351
            IF i_src_name NE space AND
352
               i_src_name = ls_index-include AND
353
               i_progname NE i_src_name.
354
              lt_include[] = it_src[].
355
            ELSE.
356
              READ REPORT ls_index-include INTO lt_include.
357
            ENDIF.
358
            DESCRIBE TABLE lt_include LINES l_include_lines.
359
            READ TABLE lh_tk INDEX l_stm_from.
360
 
361
            IF l_lv_level_new > l_lv_level_old.
362
              l_next_level = l_lv_level_new.
363
              READ TABLE lt_offset assigning <ls_offset>
364
                INDEX l_next_level.
365
              IF sy-subrc = 0.
366
                l_offset_old_incl_anw = lh_tk-row.
367
                <ls_offset>-index = l_offset_old_incl_anw.
368
                <ls_offset>-length = l_source_lines.
369
              ELSE.
370
                DESCRIBE TABLE lt_offset LINES l_offset_lines.
371
                l_level_dif = l_next_level - l_offset_lines - 1.
372
                IF l_level_dif > 0.
373
                  CLEAR ls_offset.  "and/or lt_offset ???
374
                  WHILE l_level_dif > 0.
375
                    APPEND ls_offset to lt_offset.
376
                    SUBTRACT 1 FROM l_level_dif.
377
                  ENDWHILE.
378
                ENDIF.
379
                l_offset_old_incl_anw = lh_tk-row.
380
                ls_offset-index = l_offset_old_incl_anw.
381
                ls_offset-length = l_source_lines.
382
                APPEND ls_offset to lt_offset.
383
              ENDIF.
384
              ls_index-line_to = ls_index-line_from
385
                               + l_include_lines
386
                               + lh_tk-row - 2.
387
              SORT ct_index BY line_from DESCENDING line_to ASCENDING.
388
              REFRESH lt_old_level.
389
              CLEAR l_old_level_lines.
390
              LOOP AT ct_index INTO ls_index_t.
391
                CLEAR ls_old_level.
392
                IF ls_index_t-level < l_lv_level_new.
393
                  IF l_old_level_lines > 0.
394
                    READ TABLE lt_old_level INTO ls_old_level
395
                      WITH KEY level = ls_index_t-level.
396
                    IF sy-subrc NE 0.
397
                      ls_old_level-level = ls_index_t-level.
398
                      APPEND ls_old_level TO lt_old_level.
399
                      l_old_level_lines = l_old_level_lines + 1.
400
                      ls_index_t-line_to = ls_index_t-line_to
401
                           + l_include_lines - 1.     " + tk-row.
402
                      MODIFY ct_index FROM ls_index_t.
403
                    ENDIF.
404
                  ELSE.
405
                    ls_old_level-level = ls_index_t-level.
406
                    APPEND ls_old_level TO lt_old_level.
407
                    l_old_level_lines = l_old_level_lines + 1.
408
                    ls_index_t-line_to = ls_index_t-line_to
409
                                       + l_include_lines - 1.
410
                    MODIFY ct_index FROM ls_index_t.
411
                  ENDIF.
412
                ENDIF.
413
              ENDLOOP.
414
              SORT ct_index BY line_from ASCENDING line_to DESCENDING.
415
            ELSEIF l_lv_level_new < l_lv_level_old.
416
              READ TABLE lh_tk INDEX l_stm_from.
417
              CLEAR ls_offset.
418
              READ TABLE lt_offset into ls_offset
419
                INDEX l_lv_level_old.
420
 
421
              CLEAR:
422
                l_diff_end,
423
                l_diff_new.
424
              l_next_level = l_lv_level_old.
425
              WHILE l_next_level > l_lv_level_new.
426
                l_old_next_level = l_next_level.
427
                l_next_level = l_next_level - 1.
428
                l_diff_end = l_diff_end
429
                           + ls_offset-length
430
                           - ls_offset-index.
431
                CLEAR ls_offset.
432
                MODIFY lt_offset from ls_offset
433
                  INDEX l_old_next_level.
434
                READ TABLE lt_offset into ls_offset
435
                  INDEX l_next_level.
436
                IF sy-subrc = 0.
437
                  l_offset_old_incl_anw = ls_offset-index.
438
                ELSE.
439
                  CLEAR ls_offset.
440
                ENDIF.
441
              ENDWHILE.
442
              READ TABLE lt_offset assigning <ls_offset>
443
                INDEX l_next_level.
444
              IF sy-subrc = 0.
445
                <ls_offset>-index = lh_tk-row.
446
              ENDIF.
447
              l_diff_new = l_diff_new + lh_tk-row
448
                         - l_offset_old_incl_anw.
449
              l_offset_old_incl_anw = lh_tk-row.
450
              l_index_old_line_to = ls_index-line_to.
451
              ls_index-line_to = ls_index-line_to
452
                               + l_include_lines
453
                               + l_diff_new
454
                               + l_diff_end - 1.
455
              SORT ct_index BY line_from DESCENDING.
456
              REFRESH lt_old_level.
457
              CLEAR l_old_level_lines.
458
              READ TABLE stm INDEX lv-stmnt.
459
              LOOP AT ct_index INTO ls_index_t.
460
                IF ls_index_t-level < l_lv_level_new.
461
                  IF l_old_level_lines > 0.
462
                    READ TABLE lt_old_level INTO ls_old_level
463
                      WITH KEY level = ls_index_t-level.
464
                    IF sy-subrc NE 0.
465
                      ls_old_level-level = ls_index_t-level.
466
                      APPEND ls_old_level TO lt_old_level.
467
                      ADD 1 TO l_old_level_lines.
468
                      ls_index_t-line_to = ls_index_t-line_to
469
                                         + l_include_lines  - 1.
470
                      MODIFY ct_index FROM ls_index_t .
471
                    ENDIF.
472
                  ELSE.
473
                    IF ls_index_t-level < l_lv_level_new.
474
                      ls_old_level-level = ls_index_t-level.
475
                      APPEND ls_old_level TO lt_old_level.
476
                      l_old_level_lines = l_old_level_lines + 1.
477
                      ls_index_t-line_to = ls_index_t-line_to
478
                                         + l_include_lines  - 1.
479
                    ELSE.
480
                      ls_old_level-level = ls_index_t-level.
481
                      APPEND ls_old_level TO lt_old_level.
482
                      l_old_level_lines = l_old_level_lines + 1.
483
                      ls_index_t-line_to = ls_index_t-line_to.
484
                    ENDIF.
485
                    MODIFY ct_index FROM ls_index_t .
486
                  ENDIF.
487
                ENDIF.
488
              ENDLOOP.
489
              SORT ct_index BY line_from ASCENDING.
490
            ELSE.
491
              READ TABLE lh_tk INDEX l_stm_from.
492
              l_diff_new = lh_tk-row - l_offset_old_incl_anw.
493
              l_offset_old_incl_anw = lh_tk-row.
494
              l_next_level = l_lv_level_new.
495
              READ TABLE lt_offset assigning <ls_offset>
496
                INDEX l_next_level.
497
              IF sy-subrc = 0.
498
                <ls_offset>-index = lh_tk-row.
499
              ENDIF.
500
              l_index_old_line_to = ls_index-line_to.
501
              ls_index-line_to = ls_index-line_to
502
                               + l_include_lines
503
                               + l_diff_new - 1.
504
              SORT ct_index BY line_from DESCENDING.
505
              REFRESH lt_old_level.
506
              CLEAR l_old_level_lines.
507
              LOOP AT ct_index INTO ls_index_t.
508
                l_level_t = l_lv_level_new - 1.
509
                IF ls_index_t-level = l_level_t.
510
                  IF ls_index_t-level < l_lv_level_new.
511
                    IF l_old_level_lines > 0.
512
                      READ TABLE lt_old_level INTO ls_old_level
513
                        WITH KEY level = ls_index_t-level.
514
                      IF sy-subrc NE 0.
515
                        ls_old_level-level = ls_index_t-level.
516
                        APPEND ls_old_level TO lt_old_level.
517
                        ADD 1 TO l_old_level_lines.
518
                        ls_index_t-line_to = ls_index_t-line_to
519
                                           + l_include_lines - 1.
520
                        MODIFY ct_index FROM ls_index_t .
521
                      ENDIF.
522
                    ELSE.
523
                      ls_old_level-level = ls_index_t-level.
524
                      APPEND ls_old_level TO lt_old_level.
525
                      ADD 1 TO l_old_level_lines.
526
                      ls_index_t-line_to = ls_index_t-line_to
527
                              + l_include_lines - 1.
528
                      MODIFY ct_index FROM ls_index_t .
529
                    ENDIF.
530
                  ENDIF.
531
                ELSE.
532
                  IF ls_index_t-level < l_lv_level_new.
533
                    IF l_old_level_lines > 0.
534
                      READ TABLE lt_old_level INTO ls_old_level
535
                        WITH KEY level = ls_index_t-level.
536
                      IF sy-subrc NE 0.
537
                        ls_old_level-level = ls_index_t-level.
538
                        APPEND ls_old_level TO lt_old_level.
539
                        ADD 1 TO l_old_level_lines.
540
                        ls_index_t-line_to = ls_index_t-line_to
541
                              + l_include_lines - 1.
542
                        MODIFY ct_index FROM ls_index_t .
543
                      ENDIF.
544
                    ELSE.
545
                      ls_old_level-level = ls_index_t-level.
546
                      APPEND ls_old_level TO lt_old_level.
547
                      ADD 1 TO l_old_level_lines.
548
                      ls_index_t-line_to = ls_index_t-line_to
549
                                         + l_include_lines - 1.
550
                      MODIFY ct_index FROM ls_index_t .
551
                    ENDIF.
552
                  ENDIF.
553
                ENDIF.
554
              ENDLOOP.
555
              SORT ct_index BY line_from ASCENDING.
556
            ENDIF.
557
            IF l_lv_level_new > l_lv_level_old.
558
              ls_index-line_from = ls_index-line_from
559
                                 + lh_tk-row - 1.
560
            ELSEIF l_lv_level_new < l_lv_level_old.
561
              ls_index-line_from = l_index_old_line_to
562
                                 + l_diff_new
563
                                 + l_diff_end.
564
            ELSE.
565
              l_offset_old_incl_anw = lh_tk-row.
566
              ls_index-line_from = l_index_old_line_to
567
                                 + l_diff_new.
568
            ENDIF.
569
            READ TABLE lh_tk INDEX stm-from.
570
            IF lh_tk-str = 'INCLUDE'
571
            OR lh_tk-str = 'FUNCTION'.
572
              l_include_index = ls_index-line_from.
573
              READ TABLE lt_source INTO ls_source INDEX l_include_index.
574
              IF sy-subrc = 0.
575
                IF ( ls_source-line CS 'INCLUDE'
576
                    AND ls_source-line CS ls_index-include )
577
                OR ( ls_source-line CS 'FUNCTION'
578
                    AND ls_source-line NS '$$UNIT$$' ).
579
                  DELETE lt_source INDEX l_include_index.
580
                  INSERT LINES OF lt_include INTO lt_source INDEX
581
                                 l_include_index.
582
*                ELSE.
583
*                  WRITE: 'Auflösungsfehler'(011). EXIT.
584
                ENDIF.
585
              ENDIF.
586
            ENDIF.
587
            l_lv_level_old = l_lv_level_new.
588
          ENDIF.
589
        ELSE.
590
          READ TABLE lh_tk INDEX l_stm_from.
591
          ls_index-line_from = lh_tk-row.
592
        ENDIF.
593
        APPEND ls_index TO ct_index.
594
      ENDIF.
595
    ENDIF.
596
  ENDDO.
597
  SORT ct_index BY line_from ASCENDING line_to DESCENDING.
598
  ct_src_no_includes[] = lt_source[].
599
 
600
 
601
ENDFORM.                    "get_src_without_includes