Properties SourceCde
txt
1
*---------------------------------------------------------------------*
2
*       FORM KOPIERE_EINTRAG                                          *
3
*---------------------------------------------------------------------*
4
*       ........                                                      *
5
*---------------------------------------------------------------------*
6
*  -->  ORIGIN                                                        *
7
*---------------------------------------------------------------------*
8
FORM kopiere_eintrag USING origin.
9
  DATA: ke_index LIKE sy-tabix, ke_rc LIKE sy-subrc, ke_hf TYPE i.
10
  field-symbols: <x_origin> type x.
11
 
12
  IF status-mode EQ list_bild AND function NE 'KOPF' AND "scrolling &
13
     <status>-upd_flag EQ space.       "no changes
14
    EXIT.
15
  ENDIF.
16
  assign origin to <x_origin> casting.
17
  IF vim_special_mode NE vim_delimit.
18
    IF x_header-guidflag <> space.
19
      PERFORM vim_make_guid using space.
20
    ENDIF.
21
    IF x_header-frm_on_new NE space.
22
      IF replace_mode NE space.
23
        <status>-mk_to = mark_total.
24
        <status>-mk_xt = mark_extract.
25
        vim_next_screen = 0. vim_leave_screen = 'X'.
26
        EXIT.
27
      ENDIF.
28
      PERFORM (x_header-frm_on_new) IN PROGRAM (sy-repid).
29
    ENDIF.
30
    IF <f1_x> EQ <x_origin>.
31
      PERFORM set_pf_status USING 'ERROR'.
32
      MESSAGE e015(sv).
33
      EXIT.
34
    ELSE.
35
      neuer = 'J'.
36
      PERFORM check_key.
37
      neuer = 'N'.
38
      CHECK sy-subrc NE 0.
39
      MOVE: sy-subrc TO ke_rc,
40
            sy-tabix TO ke_index.
41
    ENDIF.
42
  ELSE.
43
    READ TABLE total WITH KEY <f1_x> BINARY SEARCH.
44
    MOVE: sy-subrc TO ke_rc,
45
          sy-tabix TO ke_index.
46
  ENDIF.
47
* gültiger Eintrag.
48
  IF vim_special_mode NE vim_delimit.  "copy mode
49
    IF x_header-bastab NE space AND x_header-texttbexst NE space AND
50
       <status>-upd_flag EQ 'E'.
51
      PERFORM (vim_frm_text_upd_flag) IN PROGRAM.
52
    ENDIF.
53
    IF x_header-adrnbrflag NE space.
54
      PERFORM address_maintain.
55
    ENDIF.
56
    IF x_header-texttbexst <> space.   "SW Textcopy
57
      PERFORM vim_copy_texttab_entry USING <f1_x> <vim_xextract_key>.
58
    ENDIF.
59
    IF vim_called_by_cluster NE space.
60
      PERFORM vim_store_state_info.
61
      CALL FUNCTION 'VIEWCLUSTER_COPY_DEPENDENT'
62
           EXPORTING
63
                view_name   = x_header-viewname
64
                maintview   = x_header-maintview
65
                status_mode = status-mode
66
                workarea    = extract
67
                new_entry   = <table1>
68
                no_dialog   = vim_external_mode.
69
      PERFORM vim_restore_state_info.
70
    ENDIF.
71
  ENDIF.
72
  IF vim_special_mode NE vim_delimit OR ke_rc NE 0.
73
    <action> = neuer_eintrag.
74
    <mark> = nicht_markiert.
75
  ELSE.                                "delimit mode and existing entry
76
    IF <action> EQ original. <action> = aendern. ENDIF.
77
  ENDIF.
78
  ADD 1 TO counter.
79
*  MOVE <table1> TO total(x_header-tablen).
80
  MOVE <table1> TO <vim_total_struc>.
81
  IF x_header-bastab NE space AND x_header-texttbexst NE space AND
82
     <status>-upd_flag EQ 'X' OR <status>-upd_flag EQ 'T'.
83
    MOVE <table1_xtext> TO <vim_xtotal_text>.
84
    IF vim_special_mode NE vim_delimit OR ke_rc NE 0.
85
      MOVE neuer_eintrag TO <action_text>.
86
    ELSE.
87
      IF <action_text> EQ original. <action_text> = aendern. ENDIF.
88
    ENDIF.
89
  ENDIF.
90
  vim_copied_indices-ex_ix = nextline.
91
  vim_copied_indices-level = vim_copy_call_level.
92
  CASE ke_rc.
93
    WHEN 0.
94
      MODIFY total INDEX ke_index.
95
      READ TABLE vim_copied_indices WITH KEY ix = ke_index
96
                                    BINARY SEARCH
97
                                    TRANSPORTING NO FIELDS.
98
      IF sy-subrc NE 0.
99
        vim_copied_indices-ix = ke_index.
100
        INSERT vim_copied_indices INDEX sy-tabix.
101
      ENDIF.
102
    WHEN 4.
103
      INSERT total INDEX ke_index.
104
      READ TABLE vim_copied_indices WITH KEY ix = ke_index
105
                                    BINARY SEARCH
106
                                    TRANSPORTING NO FIELDS.
107
      vim_copied_indices-ix = ke_index.
108
      INSERT vim_copied_indices INDEX sy-tabix.
109
      ke_hf = sy-tabix + 1.
110
      LOOP AT vim_copied_indices FROM ke_hf.
111
        ADD 1 TO vim_copied_indices-ix.
112
        MODIFY vim_copied_indices.
113
      ENDLOOP.
114
    WHEN 8.
115
      APPEND total.
116
      vim_copied_indices-ix = ke_index.
117
      APPEND vim_copied_indices.
118
  ENDCASE.
119
  neuer = 'N'.
120
  <status>-upd_flag = space.
121
  READ TABLE total WITH KEY <x_origin> BINARY SEARCH.
122
  IF sy-subrc = 0 AND <mark> EQ markiert.
123
    <mark> = nicht_markiert.
124
    SUBTRACT 1 FROM mark_total.
125
    MODIFY total INDEX sy-tabix.
126
  ENDIF.
127
  IF status-mode EQ detail_bild.
128
    vim_next_screen = 0. vim_leave_screen = 'X'.
129
  ENDIF.
130
ENDFORM.