Properties SourceCde
txt
1
*---------------------------------------------------------------------*
2
*       FORM REPLACE                                                  *
3
*---------------------------------------------------------------------*
4
*       ........                                                      *
5
*---------------------------------------------------------------------*
6
FORM replace.
7
  DATA: firstline_safe TYPE i.
8
  DESCRIBE TABLE exclude_tab.
9
  IF sy-tfill GT 0.                    "entries in old exclude_tab
10
    PERFORM consider_old_exclude_tab TABLES excl_rpl_tab.
11
  ENDIF.
12
  CALL FUNCTION 'REPLACE_GET_FIELD'
13
       EXPORTING
14
            table                  = x_header-maintview
15
       IMPORTING
16
            name_of_selected_field = sel_field_for_replace
17
       TABLES
18
            exclude_fields         = excl_rpl_tab
19
       EXCEPTIONS
20
            cancelled_by_user      = 0004
21
            no_valid_fields        = 8.
22
  CASE sy-subrc.
23
    WHEN 4.
24
      function = 'ABR '. EXIT.
25
    WHEN 8.
26
      MESSAGE s039(sv) WITH view_name. EXIT.
27
  ENDCASE.
28
  LOOP AT x_namtab WHERE viewfield EQ sel_field_for_replace.
29
    IF x_header-bastab NE space AND x_header-texttbexst NE space
30
                                AND x_namtab-texttabfld NE space.
31
      assign component x_namtab-viewfield of structure
32
                <vim_ext_txt_struc> to <replace_field>.
33
    else.
34
      assign component x_namtab-viewfield of structure
35
                <vim_extract_struc> to <replace_field>.
36
    endif.
37
*    ASSIGN extract+x_namtab-position(x_namtab-flength)
38
*                              TO <replace_field> TYPE x_namtab-inttype.
39
    IF x_header-bastab NE space AND x_header-texttbexst NE space.
40
      MOVE x_namtab-texttabfld TO replace_texttable_field.
41
    ELSE.
42
      CLEAR replace_texttable_field.
43
    ENDIF.
44
  ENDLOOP.
45
  IF replace_texttable_field EQ space. "view or base table field
46
    CONCATENATE x_header-maintview sel_field_for_replace
47
       INTO sel_field_for_replace_l SEPARATED BY '-'.
48
  ELSE.                                "text table field
49
    CONCATENATE x_header-texttab sel_field_for_replace
50
       INTO sel_field_for_replace_l SEPARATED BY '-'.
51
  ENDIF.
52
  IF x_header-frm_bf_rpl NE space.
53
    PERFORM (x_header-frm_bf_rpl) IN PROGRAM (sy-repid).
54
  ENDIF.
55
* SET PF-STATUS 'REPLACE'.
56
  PERFORM set_pf_status USING 'REPLACE'.
57
  replace_mode = 'X'. vim_special_mode = vim_replace.
58
  counter = 0.
59
  firstline_safe = firstline.
60
  LOOP AT extract.
61
    CHECK <xmark> EQ markiert.
62
    nextline = exind = sy-tabix.
63
    IF replace_texttable_field EQ space.  "view or base table field
64
      CALL FUNCTION 'REPLACE_SET_VALUE'
65
           EXPORTING
66
                old_table = <vim_xextract>
67
           IMPORTING
68
                new_table = <table1_x>.
69
      IF x_header-bastab NE space AND x_header-texttbexst NE space.
70
        <table1_xtext> = <vim_xextract_text>.
71
      ENDIF.
72
    ELSE.                              "text table field
73
      MOVE <vim_extract_struc> TO <table1>.
74
      CALL FUNCTION 'REPLACE_SET_VALUE'
75
           EXPORTING
76
                old_table = <vim_xextract_text>
77
           IMPORTING
78
                new_table = <table1_xtext>.
79
    ENDIF.
80
    CASE status-type.
81
      WHEN einstufig.
82
        CALL SCREEN liste.
83
      WHEN zweistufig.
84
        PERFORM process_detail_screen USING 'C'.
85
        <vim_extract_struc> = <table1>.
86
        IF x_header-bastab NE space AND x_header-texttbexst NE space.
87
          <vim_xextract_text> = <table1_xtext>.
88
        ENDIF.
89
    ENDCASE.
90
    CHECK ok_code NE 'IGN '.
91
    IF function EQ 'ABR '.
92
      EXIT.
93
    ENDIF.
94
    counter = counter + 1.
95
    SUBTRACT 1 FROM mark_extract.
96
    SUBTRACT 1 FROM mark_total.
97
  ENDLOOP.
98
  firstline = nextline = firstline_safe.
99
  replace_mode = vim_special_mode = space.
100
  MESSAGE s012(sv) WITH counter.
101
  IF x_header-frm_af_rpl NE space.
102
    PERFORM (x_header-frm_af_rpl) IN PROGRAM (sy-repid).
103
  ENDIF.
104
ENDFORM.