Eigenschaften | Quelltext
Titel | map keys |
Originalsprache | DE | Deutsch
Erstellt | 05.02.2001 |  | SAP |
Letzte Änderung | 23.06.2003 |  | SAP |
Status | aktiv |
Attribute
Typ | Include-Programm |
Status | Testprogramm |
Anwendung | Basis (System) |
Paket | SVIM | Basis Viewmaintenance
| Editorsperre
txt
    1
    *&---------------------------------------------------------------------*
    2
    *&  Include           LSVIMF61
    3
    **&---------------------------------------------------------------------
    4
    *
    5
    *&---------------------------------------------------------------------*
    6
    *&      Form  MAP_TEXTTABKEY_TO_VIEWKEY
    7
    *&---------------------------------------------------------------------*
    8
    * Texttabellen-Schlüssel aus Transportauftrag in zugehörigen
    9
    * View-/Primärtabellenschlüssel transformieren
    10
    *----------------------------------------------------------------------*
    11
    * --> NAMTAB
    12
    * --> HEADER
    13
    * --> TEXTTABKEY     Importschlüssel der Texttabelle
    14
    *$$$ Release 5.0: included in HEADER $$$
    15
    * --> SPRASFDPOS     Offset des Sprachenschlüssels
    16
    *$$$
    17
    * --> TEXTTAB_KEYLEN Länge des zu berücksichtigenden Schlüsselteils
    18
    *                    (i.A. tatsächliche Schlüssellänge,
    19
    *                    bei generischem Transport: nichtgen. Schlüsselteil)
    20
    * --> IS_GENERIC_KEY 'X' => Texttabellen-Schlüssel is generisch
    21
    *
    22
    * <-- VIEWKEY        View/Primärtabellenschlüssel
    23
    * <-- MAP_ERROR      'X' -> Fehler bei der Abb., VIEWKEY nicht gefüllt
    24
    *                    (nur bei GENKEY = 'X' relevant)
    25
    *----------------------------------------------------------------------*
    26
    FORM map_texttabkey_to_viewkey TABLES namtab STRUCTURE vimnamtab
    27
                                   USING  header TYPE vimdesc
    28
                                          texttabkey TYPE x
    29
                                          texttab_keylen TYPE syfleng
    30
                                          is_generic_key TYPE xfeld
    31
                                   CHANGING viewkey TYPE x
    32
                                            map_error.
    33
      DATA: o1 TYPE i, o2 TYPE i,
    34
            t_keylen TYPE i, l TYPE i, h_viewkey TYPE tabl8000.
    35
      FIELD-SYMBOLS: <namtab> TYPE vimnamtab,
    36
                     <texttab_struc> TYPE ANY,
    37
                     <texttab_fld> TYPE ANY,
    38
                     <txt_struc> TYPE ANY,
    39
                     <viewfld> TYPE ANY.
    40
    41
      CLEAR: map_error, viewkey.
    42
    43
      ASSIGN: texttabkey TO <texttab_struc> CASTING TYPE (header-texttab),
    44
              h_viewkey TO <txt_struc> CASTING TYPE (header-maintview).
    45
      MOVE viewkey TO h_viewkey.
    46
      IF is_generic_key = space.
    47
    *  IF is_generic_key = space.
    48
        LOOP AT namtab ASSIGNING <namtab>
    49
          WHERE keyflag <> space AND txttabfldn <> space.
    50
          ASSIGN: COMPONENT <namtab>-viewfield OF STRUCTURE <txt_struc>
    51
                   TO <viewfld>,
    52
                  COMPONENT <namtab>-txttabfldn
    53
                   OF STRUCTURE <texttab_struc> TO <texttab_fld>.
    54
          <viewfld> = <texttab_fld>.
    55
        ENDLOOP.
    56
      ELSE.
    57
        IF header-sprasfdpos < texttab_keylen.
    58
    * Sprache im nichtgen. Teil
    59
          t_keylen = texttab_keylen - vim_spras_length.
    60
        ELSE.
    61
          t_keylen = texttab_keylen.
    62
        ENDIF.
    63
        LOOP AT namtab ASSIGNING <namtab>
    64
    *      WHERE keyflag = space AND texttabfld = 'X'.
    65
          WHERE keyflag <> space AND txttabfldn <> space.
    66
          o1 = <namtab>-position + <namtab>-flength.
    67
          o2 = <namtab>-texttabpos + <namtab>-flength.
    68
          ASSIGN: COMPONENT <namtab>-viewfield OF STRUCTURE <txt_struc>
    69
                   TO <viewfld>,
    70
                  COMPONENT <namtab>-txttabfldn
    71
                   OF STRUCTURE <texttab_struc> TO <texttab_fld>.
    72
          IF o1 <= t_keylen AND o2 <= texttab_keylen.
    73
            <viewfld> = <texttab_fld>.
    74
          ELSEIF o1 > t_keylen AND o2 > texttab_keylen. "gen. Teil
    75
            IF <namtab>-position < t_keylen
    76
             AND <namtab>-texttabpos < texttab_keylen
    77
             AND 'CNDT' CS <namtab>-inttype.
    78
              l = ( texttab_keylen - <namtab>-texttabpos )
    79
                  DIV cl_abap_char_utilities=>charsize.
    80
              <viewfld>(l) = <texttab_fld>(l).
    81
            ENDIF.
    82
          ELSE.
    83
            map_error = 'X'. EXIT.
    84
          ENDIF.
    85
        ENDLOOP.
    86
      ENDIF.
    87
      MOVE h_viewkey TO viewkey.
    88
    *  LOOP AT namtab WHERE keyflag = 'X' AND txttabfldn <> space.
    89
    *    IF is_generic_key = space.
    90
    *      viewkey+namtab-position(namtab-flength) =
    91
    *         texttabkey+namtab-texttabpos(namtab-flength).
    92
    *    ELSE.
    93
    *      IF sprasfdpos < texttab_keylen.   "Sprache im nichtgen. Teil
    94
    *        t_keylen = texttab_keylen - vim_spras_length.
    95
    *      ELSE.
    96
    *        t_keylen = texttab_keylen.
    97
    *      ENDIF.
    98
    *      o1 = namtab-position + namtab-flength.
    99
    *      o2 = namtab-texttabpos + namtab-flength.
    100
    *      IF o1 <= t_keylen AND o2 <= texttab_keylen.
    101
    *        viewkey+namtab-position(namtab-flength) =
    102
    *          texttabkey+namtab-texttabpos(namtab-flength).
    103
    *      ELSEIF o1 > t_keylen AND o2 > texttab_keylen. "gen. Teil
    104
    *        IF namtab-position < t_keylen AND
    105
    *           namtab-texttabpos < texttab_keylen.
    106
    *          l = texttab_keylen - namtab-texttabpos.
    107
    *          viewkey+namtab-position(l) = texttabkey+namtab-texttabpos(l).
    108
    *        ENDIF.
    109
    *      ELSE.
    110
    *        map_error = 'X'. EXIT.
    111
    *      ENDIF.
    112
    *    ENDIF.
    113
    *  ENDLOOP.
    114
    ENDFORM.                    " MAP_TEXTTABKEY_TO_VIEWKEY
    115
    116
    *&--------------------------------------------------------------------*
    117
    *&      Form  MAP_VIEWKEY_TO_TEXTTABKEY                               *
    118
    *&--------------------------------------------------------------------*
    119
    * Schlüssel von Texttabelle anhand des View-/Tabellenschlüssels und
    120
    * der Sprache zusammensetzen
    121
    *&--------------------------------------------------------------------*
    122
    * --> X_NAMTAB
    123
    * --> VIEW_WA  WA of view                                             *
    124
    * --> SPRAS    Sprachschlüssel                                        *
    125
    * <-- TEXT_WA  Key of text table                                      *
    126
    *&--------------------------------------------------------------------*
    127
    FORM map_viewkey_to_texttabkey TABLES namtab STRUCTURE vimnamtab
    128
                                    USING header TYPE vimdesc
    129
                                          spras LIKE t002-spras
    130
                                          view_wa TYPE x
    131
                                 CHANGING text_wa TYPE x.
    132
    133
      DATA: align type f,
    134
            h_view_wa type tabl8000,
    135
            h_texttab_wa TYPE tabl8000.
    136
    137
      FIELD-SYMBOLS: <namtab> TYPE vimnamtab,
    138
                     <texttab_struc> TYPE ANY,
    139
                     <texttab_fld> TYPE ANY,
    140
                     <view_struc> TYPE ANY,
    141
                     <viewfld> TYPE ANY.
    142
    143
      ASSIGN h_texttab_wa TO <texttab_struc> CASTING TYPE (header-texttab).
    144
      MOVE: text_wa TO h_texttab_wa,
    145
            view_wa to h_view_wa.
    146
    * Sprachschlüssel
    147
      ASSIGN COMPONENT header-sprasfield OF STRUCTURE <texttab_struc>
    148
       TO <texttab_fld>.
    149
      <texttab_fld> = spras.
    150
    *  text_wa+spras_pos(vim_spras_length) = spras.
    151
    * Schlüsselfelder der Text-Tabelle
    152
      ASSIGN: h_view_wa(header-tablen) TO <view_struc>
    153
                 CASTING TYPE (header-maintview).
    154
      LOOP AT namtab ASSIGNING <namtab>
    155
        WHERE txttabfldn <> space AND keyflag <> space.
    156
        ASSIGN: COMPONENT <namtab>-viewfield OF STRUCTURE <view_struc>
    157
                 TO <viewfld>,
    158
                COMPONENT <namtab>-txttabfldn
    159
                 OF STRUCTURE <texttab_struc> TO <texttab_fld>.
    160
        <texttab_fld> = <viewfld>.
    161
      ENDLOOP.
    162
      MOVE h_texttab_wa TO text_wa.
    163
    *  LOOP AT namtab WHERE txttabfldn <> space AND keyflag <> space.
    164
    *    text_wa+namtab-texttabpos(namtab-flength) =
    165
    *         view_wa+namtab-position(namtab-flength).
    166
    *  ENDLOOP.
    167
    ENDFORM.                               " MAP_VIEWKEY_TO_TEXTTABKEY