Properties SourceCde
txt
1
*----------------------------------------------------------------------*
2
*   INCLUDE LSVIMF5E                                                   *
3
*----------------------------------------------------------------------*
4
*&---------------------------------------------------------------------*
5
*&      Form  vim_make_guid
6
*&---------------------------------------------------------------------*
7
*       Sets GUID values in a dataset. Only used if a new entry is
8
*       created. If p_viewfield is set, only one GUID is filled.
9
*----------------------------------------------------------------------*
10
*  -->  p_viewfield   Name of GUID field in table/view
11
*  <--  p2        text
12
*----------------------------------------------------------------------*
13
FORM vim_make_guid USING p_viewfield TYPE viewfield.
14
 
15
  DATA: fieldname TYPE fnam_____4,
16
        old_guid TYPE REF TO data.
17
  FIELD-SYMBOLS: <x_namtab> TYPE vimnamtab, <guid> TYPE ANY,
18
                 <old_guid> TYPE ANY, <work_area> TYPE ANY.
19
 
20
  IF p_viewfield = space.
21
* set all GUIDs in structure
22
    LOOP AT x_namtab ASSIGNING <x_namtab> WHERE keyflag = space
23
     AND bastabname <> x_header-texttab AND domname IN vim_guid_domain.
24
* non-key and non-textfields only
25
      CONCATENATE x_header-maintview <x_namtab>-viewfield
26
       INTO fieldname SEPARATED BY '-'.
27
      ASSIGN (fieldname) TO <guid> CASTING TYPE (fieldname).
28
      IF <status>-prof_found = vim_pr_into_view
29
* importing BC-set manually
30
       OR vim_import_profile <> space
31
* importing BC-set in background
32
       OR vim_special_mode = vim_upgrade.
33
* importing from remote system/client
34
        CHECK <guid> IS INITIAL.
35
      ENDIF.
36
      CREATE DATA old_guid TYPE (fieldname).
37
      ASSIGN old_guid->* TO <old_guid>.
38
      CASE <x_namtab>-domname.
39
        WHEN 'SYSUUID'.
40
          ASSIGN (fieldname) TO <guid> CASTING TYPE guid_16.
41
          MOVE <guid> TO <old_guid>.
42
          CALL FUNCTION 'GUID_CREATE'
43
               IMPORTING
44
                    ev_guid_16 = <guid>.
45
        WHEN 'SYSUUID_C'.
46
          ASSIGN (fieldname) TO <guid> CASTING TYPE guid_32.
47
          MOVE <guid> TO <old_guid>.
48
          CALL FUNCTION 'GUID_CREATE'
49
               IMPORTING
50
                    ev_guid_32 = <guid>.
51
        WHEN 'SYSUUID_22'.
52
          ASSIGN (fieldname) TO <guid> CASTING TYPE guid_22.
53
          MOVE <guid> TO <old_guid>.
54
          CALL FUNCTION 'GUID_CREATE'
55
               IMPORTING
56
                    ev_guid_22 = <guid>.
57
        WHEN 'SYSUUID_25'.
58
          ASSIGN (fieldname) TO <guid> CASTING TYPE rssguid25.
59
          MOVE <guid> TO <old_guid>.
60
          CALL FUNCTION 'RSS_SYSTEM_GET_UNIQUE_ID'
61
               IMPORTING
62
                    e_uni_idc25 = <guid>.
63
      ENDCASE.
64
      IF x_header-frm_af_uid <> space.
65
        ASSIGN (x_header-maintview) TO <work_area>
66
         CASTING TYPE (x_header-maintview).
67
        PERFORM (x_header-frm_af_uid) IN PROGRAM (x_header-fpoolname)
68
                                      USING <old_guid>
69
                                      CHANGING <guid>
70
                                               <work_area>.
71
      ENDIF.
72
    ENDLOOP.
73
  ELSE.
74
* set GUID for p_viewfield only
75
    READ TABLE x_namtab ASSIGNING <x_namtab>
76
     WITH KEY viewfield = p_viewfield.
77
    CHECK sy-subrc = 0 AND <x_namtab>-domname IN vim_guid_domain.
78
* non-key and non-textfields only
79
    CONCATENATE x_header-maintview <x_namtab>-viewfield
80
     INTO fieldname SEPARATED BY '-'.
81
    ASSIGN (fieldname) TO <guid> CASTING TYPE (fieldname).
82
    IF <status>-prof_found = vim_pr_into_view
83
* importing BC-set manually
84
     OR vim_import_profile <> space
85
* importing BC-set in background
86
     OR vim_special_mode = vim_upgrade.
87
* importing from remote system/client
88
      CHECK <guid> IS INITIAL.
89
    ENDIF.
90
    CREATE DATA old_guid TYPE (fieldname).
91
    ASSIGN old_guid->* TO <old_guid>.
92
    CASE <x_namtab>-domname.
93
      WHEN 'SYSUUID'.
94
        ASSIGN (fieldname) TO <guid> CASTING TYPE guid_16.
95
        MOVE <guid> TO <old_guid>.
96
        CALL FUNCTION 'GUID_CREATE'
97
             IMPORTING
98
                  ev_guid_16 = <guid>.
99
      WHEN 'SYSUUID_C'.
100
        ASSIGN (fieldname) TO <guid> CASTING TYPE guid_32.
101
        MOVE <guid> TO <old_guid>.
102
        CALL FUNCTION 'GUID_CREATE'
103
             IMPORTING
104
                  ev_guid_32 = <guid>.
105
      WHEN 'SYSUUID_22'.
106
        ASSIGN (fieldname) TO <guid> CASTING TYPE guid_22.
107
        MOVE <guid> TO <old_guid>.
108
        CALL FUNCTION 'GUID_CREATE'
109
             IMPORTING
110
                  ev_guid_22 = <guid>.
111
      WHEN 'SYSUUID_25'.
112
        ASSIGN (fieldname) TO <guid> CASTING TYPE rssguid25.
113
        MOVE <guid> TO <old_guid>.
114
        CALL FUNCTION 'RSS_SYSTEM_GET_UNIQUE_ID'
115
             IMPORTING
116
                  e_uni_idc25 = <guid>.
117
    ENDCASE.
118
    IF x_header-frm_af_uid <> space.
119
      ASSIGN (x_header-maintview) TO <work_area>
120
       CASTING TYPE (x_header-maintview).
121
      PERFORM (x_header-frm_af_uid) IN PROGRAM (x_header-fpoolname)
122
                                    USING <old_guid>
123
                                    CHANGING <guid>
124
                                             <work_area>.
125
    ENDIF.
126
  ENDIF.
127
ENDFORM.                               " vim_make_guid