1 |
2 |
3 |
4 | * |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | * |
22 |
23 |
24 |
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 |
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 |
59 | t_keylen = texttab_keylen - vim_spras_length. |
60 | ELSE. |
61 | t_keylen = texttab_keylen. |
62 | ENDIF. |
63 | LOOP AT namtab ASSIGNING <namtab> |
64 |
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 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | ENDFORM. " MAP_TEXTTABKEY_TO_VIEWKEY |
115 | |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
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 |
147 | ASSIGN COMPONENT header-sprasfield OF STRUCTURE <texttab_struc> |
148 | TO <texttab_fld>. |
149 | <texttab_fld> = spras. |
150 |
151 |
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 |
164 |
165 |
166 |
167 | ENDFORM. " MAP_VIEWKEY_TO_TEXTTABKEY |