1 |
2 |
3 |
4 |
5 |
6 | FORM f4_positionieren USING value(tabname) TYPE tabname |
7 | value(fieldname) TYPE fieldname |
8 | value(display) |
9 | CHANGING returncode |
10 | value TYPE any. |
11 | STATICS: field_tab TYPE TABLE OF dfies INITIAL SIZE 20. |
12 | |
13 | DATA: tabval(132) TYPE c, |
14 | v_tab LIKE TABLE OF tabval INITIAL SIZE 500, |
15 | w_dfies TYPE dfies, |
16 | return_tab TYPE TABLE OF ddshretval INITIAL SIZE 1, |
17 | BEGIN OF out_conv_function, |
18 | prefix(16) TYPE c VALUE 'CONVERSION_EXIT_', |
19 | exit LIKE vimnamtab-convexit, |
20 | suffix(7) TYPE c VALUE '_OUTPUT', |
21 | END OF out_conv_function, |
22 | f4_length TYPE i. "total length of to be displayed fields |
23 | FIELD-SYMBOLS: <hf1>, <dfies> TYPE dfies, <retval> TYPE ddshretval. |
24 | |
25 | READ TABLE field_tab INDEX 1 ASSIGNING <dfies>. |
26 | IF sy-subrc <> 0 OR <dfies>-tabname <> x_header-maintview. |
27 | REFRESH field_tab. |
28 | |
29 |
30 |
31 | f4_length = 0. |
32 | IF x_header-tablen > 1000. |
33 | LOOP AT x_namtab. |
34 | IF x_header-clidep NE space. "ignore client field |
35 | CHECK sy-tabix NE 1. |
36 | ENDIF. |
37 | IF x_namtab-keyflag NE space OR "all key fields or |
38 | x_namtab-datatype EQ 'CHAR' AND "all possibly text fields |
39 | x_namtab-flength GE 10 AND |
40 | x_namtab-lowercase NE space. |
41 | |
42 | f4_length = f4_length + x_namtab-outputlen. |
43 | ENDIF. |
44 | ENDLOOP. |
45 | ENDIF. |
46 | |
47 | IF f4_length < 1000. "check the fields length |
48 |
49 | LOOP AT x_namtab. |
50 | IF x_header-clidep NE space. "ignore client field |
51 | CHECK sy-tabix NE 1. |
52 | ENDIF. |
53 | CHECK x_namtab-readonly <> vim_hidden. "Subviews |
54 | IF x_header-bastab NE space AND x_header-texttbexst NE space. |
55 | CHECK x_namtab-keyflag NE space AND "all entity keyfields |
56 | x_namtab-texttabfld EQ space OR "or |
57 | x_namtab-keyflag EQ space AND "all texttab function fields |
58 | x_namtab-texttabfld NE space. |
59 | ELSE. |
60 | CHECK x_namtab-keyflag NE space OR "all key fields or |
61 | x_namtab-datatype EQ 'CHAR' AND "all possibly text fields |
62 | x_namtab-flength GE 10 AND |
63 | x_namtab-lowercase NE space. |
64 | ENDIF. |
65 | IF x_namtab-texttabfld NE space. |
66 | w_dfies-tabname = x_header-texttab. |
67 | ELSE. |
68 | w_dfies-tabname = x_header-maintview. "Subviews |
69 | ENDIF. |
70 | w_dfies-fieldname = x_namtab-viewfield. |
71 | APPEND w_dfies TO field_tab. |
72 | ENDLOOP. |
73 | ELSE. |
74 |
75 | MESSAGE I810(SV) WITH x_header-viewname. |
76 |
77 |
78 | LOOP AT x_namtab. |
79 | IF x_header-clidep NE space. "ignore client field |
80 | CHECK sy-tabix NE 1. |
81 | ENDIF. |
82 | CHECK x_namtab-readonly <> vim_hidden. "Subviews |
83 | IF x_header-bastab NE space AND x_header-texttbexst NE space. |
84 | CHECK x_namtab-keyflag NE space AND "all entity keyfields |
85 | x_namtab-texttabfld EQ space OR "or |
86 | x_namtab-keyflag EQ space AND "all texttab function fields |
87 | x_namtab-texttabfld NE space. |
88 | ELSE. |
89 | CHECK x_namtab-keyflag NE space. "all key fields |
90 | ENDIF. |
91 | IF x_namtab-texttabfld NE space. |
92 | w_dfies-tabname = x_header-texttab. |
93 | ELSE. |
94 | w_dfies-tabname = x_header-maintview. "Subviews |
95 | ENDIF. |
96 | w_dfies-fieldname = x_namtab-viewfield. |
97 | append w_dfies to field_tab. |
98 | ENDLOOP. |
99 |
100 | ENDIF. |
101 | ENDIF. |
102 | |
103 | |
104 | LOOP AT extract. |
105 | LOOP AT field_tab ASSIGNING <dfies>. |
106 | READ TABLE x_namtab WITH KEY viewfield = <dfies>-fieldname. |
107 | IF x_header-bastab NE space AND x_header-texttbexst NE space. |
108 | IF x_namtab-keyflag EQ space AND x_namtab-texttabfld NE space. |
109 |
110 | ASSIGN COMPONENT x_namtab-viewfield |
111 | OF STRUCTURE <vim_ext_txt_struc> TO <hf1>. |
112 | ELSEIF x_namtab-keyflag NE space |
113 | AND x_namtab-texttabfld EQ space. |
114 |
115 | ASSIGN COMPONENT x_namtab-viewfield |
116 | OF STRUCTURE <vim_extract_struc> TO <hf1>. |
117 | ENDIF. |
118 | ELSE. |
119 |
120 | ASSIGN COMPONENT x_namtab-viewfield |
121 | OF STRUCTURE <vim_extract_struc> TO <hf1>. |
122 | ENDIF. |
123 | CHECK <hf1> IS ASSIGNED. |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | WRITE <hf1> TO tabval(x_namtab-outputlen). |
133 | APPEND tabval TO v_tab. |
134 | CLEAR tabval. |
135 | ENDLOOP. |
136 | ENDLOOP. |
137 | CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' |
138 | EXPORTING |
139 |
140 | retfield = fieldname |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | display = display |
151 |
152 |
153 |
154 | TABLES |
155 | value_tab = v_tab |
156 | field_tab = field_tab |
157 | return_tab = return_tab |
158 |
159 | EXCEPTIONS |
160 | parameter_error = 1 |
161 | no_values_found = 2 |
162 | OTHERS = 3. |
163 | IF sy-subrc = 0. |
164 | READ TABLE return_tab INDEX 1 ASSIGNING <retval>. |
165 | IF sy-subrc = 0. |
166 | value = <retval>-fieldval. |
167 | ENDIF. |
168 | ELSE. |
169 | MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno |
170 | WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. |
171 | ENDIF. |
172 | |
173 | ENDFORM. "f4_positionieren |