Properties SourceCde
txt
1
*----------------------------------------------------------------------*
2
***INCLUDE LSVIMF63 .
3
*----------------------------------------------------------------------*
4
*&---------------------------------------------------------------------*
5
*&      Form  vim_comp_roottabkey
6
*&---------------------------------------------------------------------*
7
*       Check if view and root table have identical keys.
8
*----------------------------------------------------------------------*
9
*      -->P_HEADER  text
10
*      -->P_NAMTAB  text
11
*      <--P_KEYS_IDENTICAL  text
12
*      <--P_RC  text
13
*----------------------------------------------------------------------*
14
FORM vim_comp_roottabkey  USING    p_header TYPE vimdesc
15
                                   p_namtab TYPE vimnamtab_type
16
                          CHANGING p_keys_identical TYPE xfeld
17
                                   p_rc TYPE sy-subrc.
18
  TYPES: BEGIN OF flagstruc_type,
19
          viewname TYPE viewname,
20
          keys_ident,
21
         END OF flagstruc_type.
22
 
23
  STATICS: flagtab TYPE HASHED TABLE OF flagstruc_type
24
           WITH UNIQUE KEY viewname.
25
  DATA: w_flagtab TYPE flagstruc_type,
26
        x031l_tab TYPE TABLE OF x031l.
27
  FIELD-SYMBOLS: <namtab> TYPE vimnamtab,
28
                 <x031l> TYPE x031l.
29
 
30
  CLEAR p_rc.
31
  READ TABLE flagtab WITH TABLE KEY viewname = p_header-viewname
32
   INTO w_flagtab.
33
  IF sy-subrc <> 0.
34
    w_flagtab-viewname = p_header-viewname.
35
    w_flagtab-keys_ident = 'X'.
36
    CALL FUNCTION 'DDIF_NAMETAB_GET'
37
      EXPORTING
38
        tabname   = p_header-roottab
39
      TABLES
40
        x031l_tab = x031l_tab
41
      EXCEPTIONS
42
        OTHERS    = 2.
43
    IF sy-subrc <> 0.
44
      p_rc = sy-subrc.
45
    ENDIF.
46
    LOOP AT p_namtab ASSIGNING <namtab> WHERE keyflag = 'X'.
47
      IF <namtab>-bastabname <> p_header-roottab.
48
        sy-subrc = 4.
49
      ELSE.
50
        READ TABLE x031l_tab INDEX sy-tabix ASSIGNING <x031l>.
51
      ENDIF.
52
      IF sy-subrc <> 0 OR <x031l>-fieldname <> <namtab>-bastabfld.
53
        clear w_flagtab-keys_ident.
54
        exit.
55
      ENDIF.
56
    ENDLOOP.
57
    INSERT w_flagtab INTO TABLE flagtab.
58
  ENDIF.
59
  p_keys_identical = w_flagtab-keys_ident.
60
ENDFORM.                    " vim_comp_roottabkey