Properties SourceCde
txt
1
*&--------------------------------------------------------------------*
2
*&      Form  VIM_MODIFY_VIEW_ENTRY                                   *
3
*&--------------------------------------------------------------------*
4
* update/insert entry, process all checks                             *
5
*&--------------------------------------------------------------------*
6
FORM vim_modify_view_entry USING value(vmve_exix) TYPE i
7
                                 vmve_rc TYPE i.
8
  DATA: h_ix TYPE i, h_act(1) TYPE c, hact2(1) TYPE c,
9
        fieldname TYPE fnam_____4.
10
  FIELD-SYMBOLS: <guid> TYPE ANY, <old_guid> TYPE ANY,
11
                 <guid_wa> TYPE ANY,
12
                 <extract_val> TYPE ANY, <total_val> TYPE ANY.
13
  CLEAR vmve_rc.
14
  nextline = exind = vmve_exix.
15
* new: transfer of changed entries from EXTRACT into TOTAL via dynps
16
* ... first: handle read-only fields and subset fields
17
  IF x_header-subsetflag NE space OR
18
     x_header-rdonlyflag NE space OR
19
     x_header-adrnbrflag NE space.
20
    IF <xact> NE neuer_eintrag.
21
      READ TABLE total WITH KEY <vim_xextract_key>
22
                       BINARY SEARCH.
23
      h_act = <action>.
24
    ELSE.
25
      h_act = <xact>.
26
    ENDIF.
27
    LOOP AT x_namtab WHERE readonly EQ rdonly
28
                       OR  ( readonly EQ subset AND
29
                             keyflag EQ space ).
30
      ASSIGN COMPONENT x_namtab-viewfield
31
       OF STRUCTURE <vim_extract_struc> TO <extract_val>.
32
      CHECK sy-subrc = 0.
33
      IF <xact> NE neuer_eintrag.
34
        ASSIGN COMPONENT x_namtab-viewfield
35
         OF STRUCTURE <vim_total_struc> TO <total_val>.
36
        IF sy-subrc = 0.
37
          <extract_val> = <total_val>.
38
        ENDIF.
39
*        extract+x_namtab-position(x_namtab-flength) =
40
*            total+x_namtab-position(x_namtab-flength).
41
      ELSE.
42
        ASSIGN COMPONENT x_namtab-viewfield
43
         OF STRUCTURE <initial> TO <total_val>.
44
        IF sy-subrc = 0.
45
          <extract_val> = <total_val>.
46
        ENDIF.
47
*        extract+x_namtab-position(x_namtab-flength) =
48
*            <initial>+x_namtab-position(x_namtab-flength).
49
      ENDIF.
50
    ENDLOOP.
51
    IF sy-subrc EQ 0.
52
      hact2 = <xact>. <xact> = h_act.
53
      MODIFY extract INDEX vmve_exix.
54
      <xact> = hact2.
55
    ENDIF.
56
  ENDIF.
57
  PERFORM move_extract_to_view_wa.
58
* ... second: handle address number and GUID
59
  CLEAR vim_upgr_address_number.
60
  IF x_header-adrnbrflag NE space.
61
    IF x_header-adrnbrflag = 'N'.
62
      vim_upgr_address_number = <address_number>.
63
    ENDIF.
64
    IF <xact> NE neuer_eintrag.
65
      <address_number> = <vim_total_address_number>.
66
    ELSE.
67
      CLEAR <address_number>.
68
    ENDIF.
69
  ENDIF.
70
  IF x_header-guidflag <> space AND <xact> <> neuer_eintrag.
71
* update only, GUID will be set in UPDATE_TAB for new entries
72
    LOOP AT x_namtab WHERE domname IN vim_guid_domain.
73
      CONCATENATE x_header-maintview x_namtab-viewfield
74
       INTO fieldname SEPARATED BY '-'.
75
      ASSIGN COMPONENT x_namtab-viewfield
76
       OF STRUCTURE <vim_extract_struc> TO <guid>.
77
      ASSIGN COMPONENT x_namtab-viewfield
78
       OF STRUCTURE <vim_total_struc> TO <old_guid>.
79
*      ASSIGN extract+x_namtab-position(x_namtab-flength) TO <guid>
80
*       CASTING TYPE (fieldname).
81
*      ASSIGN total+x_namtab-position(x_namtab-flength) TO <old_guid>
82
*       CASTING TYPE (fieldname).
83
      IF <guid> IS INITIAL AND <old_guid> IS INITIAL.
84
* no GUID-value imported from remote system and GUID not yet set in
85
* current entry
86
        PERFORM vim_make_guid USING x_namtab-viewfield.
87
        ASSIGN (fieldname) TO <guid_wa> CASTING TYPE (fieldname).
88
        <guid> = <guid_wa>.
89
* (including event 27)
90
      ELSEIF <guid> IS INITIAL.
91
* use old GUID
92
        <guid> = <old_guid>.
93
        IF x_header-frm_af_uid <> space.
94
          PERFORM (x_header-frm_af_uid) IN PROGRAM (x_header-fpoolname)
95
                                    USING <old_guid>
96
                                    CHANGING <guid>
97
                                             <vim_extract_struc>.
98
        ELSEIF x_header-frm_af_uid <> space.
99
* overwrite old GUID with GUID from remote client... or not?
100
          PERFORM (x_header-frm_af_uid) IN PROGRAM (x_header-fpoolname)
101
                                    USING <old_guid>
102
                                    CHANGING <guid>
103
                                             <vim_extract_struc>.
104
        ENDIF.
105
      ENDIF.
106
    ENDLOOP.
107
  ENDIF.
108
  IF <xact> EQ neuer_eintrag.
109
    status-action = hinzufuegen.
110
    <vim_extract_struc> = <initial>.
111
    IF x_header-bastab NE space AND
112
       x_header-texttbexst NE space.
113
      <vim_xextract_text> = <text_initial_x>.
114
    ENDIF.
115
    <xact> = leer.
116
  ELSE.
117
    status-action = aendern. <xact> = h_act.
118
  ENDIF.
119
  MODIFY extract INDEX vmve_exix.
120
* ...third: call screen a la replace
121
  CASE status-type.
122
    WHEN einstufig.
123
      PERFORM vim_imp_call_screen USING liste.
124
    WHEN zweistufig.
125
      IF <xact> EQ leer.
126
        neuer = 'J'.
127
      ENDIF.
128
      PERFORM process_detail_screen USING 'C'.
129
  ENDCASE.
130
  status-action = <status>-st_action = aendern.
131
  IF ok_code EQ 'IGN '. vmve_rc = 4. CLEAR ok_code. EXIT. ENDIF.
132
  IF function EQ 'ABR '. vmve_rc = 8. CLEAR function. EXIT. ENDIF.
133
ENDFORM.                               "vim_modify_view_entry