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 |
27 | |
28 | |
29 |
30 |
31 |
32 | FORM download |
33 | USING |
34 | it_html TYPE it_string |
35 | value(i_pgmid) |
36 | value(i_object) |
37 | value(i_filename) |
38 | value(i_extension) |
39 | value(i_do_count). |
40 | |
41 | DATA: |
42 | l_infoline TYPE syucomm, |
43 | l_uri TYPE string, |
44 | l_sub_uri TYPE char255, |
45 |
46 |
47 |
48 | l_txt TYPE string, |
49 | l_message TYPE string, |
50 | l_codepage(20) TYPE c. |
51 | |
52 | PERFORM download_get_params |
53 | USING |
54 | i_pgmid |
55 | i_object |
56 | i_filename |
57 | i_extension |
58 | i_do_count |
59 | CHANGING |
60 | l_uri |
61 | l_sub_uri |
62 | l_infoline. |
63 | |
64 | PERFORM download_replace_wildcards |
65 | USING |
66 | l_sub_uri |
67 | CHANGING |
68 | it_html. |
69 | |
70 |
71 |
72 |
73 | * |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | * |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | |
110 | IF NOT i_extension = gc_extension_htm |
111 | AND NOT i_extension = gc_extension_xml. |
112 | l_codepage = '4110'. "UTF-8 |
113 | ENDIF. |
114 | |
115 | IF g_has_download_status = abap_true. |
116 | CALL FUNCTION 'GUI_DOWNLOAD' |
117 | EXPORTING |
118 | filename = l_uri |
119 | codepage = l_codepage |
120 | show_transfer_status = abap_false |
121 | TABLES |
122 | data_tab = it_html |
123 | EXCEPTIONS |
124 | OTHERS = 1. |
125 | ELSE. |
126 | CALL FUNCTION 'GUI_DOWNLOAD' |
127 | EXPORTING |
128 | filename = l_uri |
129 | codepage = l_codepage |
130 | TABLES |
131 | data_tab = it_html |
132 | EXCEPTIONS |
133 | OTHERS = 1. |
134 | ENDIF. |
135 | IF sy-subrc <> 0. |
136 | CLEAR l_message. |
137 | l_txt = sy-subrc. |
138 | CONDENSE l_txt. |
139 | CONCATENATE 'RC=' l_txt ',' INTO l_txt. |
140 | PERFORM get_message_text USING 'MEREP_00' '245' |
141 | l_txt space space space |
142 | CHANGING l_message. |
143 | CONCATENATE l_message l_uri INTO l_message SEPARATED BY space. |
144 | WRITE / l_message. |
145 | ELSE. |
146 | CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' |
147 | EXPORTING |
148 | text = l_infoline. |
149 | ENDIF. |
150 | |
151 | ENDFORM. "download |
152 | |
153 | |
154 |
155 |
156 |
157 | FORM download_binary |
158 | USING |
159 | it_content TYPE it_o2content_binary |
160 | value(i_bin_filesize) TYPE i |
161 | value(i_pgmid) |
162 | value(i_object) |
163 | value(i_filename) |
164 | value(i_extension) |
165 | value(i_do_count). |
166 | |
167 | DATA: |
168 | l_infoline TYPE syucomm, |
169 | l_uri TYPE string, |
170 | l_sub_uri TYPE char255, |
171 | l_txt TYPE string, |
172 | l_message TYPE string. |
173 | |
174 | PERFORM download_get_params |
175 | USING |
176 | i_pgmid |
177 | i_object |
178 | i_filename |
179 | i_extension |
180 | i_do_count |
181 | CHANGING |
182 | l_uri |
183 | l_sub_uri |
184 | l_infoline. |
185 | |
186 | IF g_has_download_status = abap_true. |
187 | CALL FUNCTION 'GUI_DOWNLOAD' |
188 | EXPORTING |
189 | bin_filesize = i_bin_filesize |
190 | filename = l_uri |
191 | filetype = 'BIN' |
192 | show_transfer_status = abap_false |
193 | TABLES |
194 | data_tab = it_content |
195 | EXCEPTIONS |
196 | OTHERS = 2. |
197 | ELSE. |
198 | CALL FUNCTION 'GUI_DOWNLOAD' |
199 | EXPORTING |
200 | bin_filesize = i_bin_filesize |
201 | filename = l_uri |
202 | filetype = 'BIN' |
203 | TABLES |
204 | data_tab = it_content |
205 | EXCEPTIONS |
206 | OTHERS = 2. |
207 | ENDIF. |
208 | IF sy-subrc <> 0. |
209 | CLEAR l_message. |
210 | l_txt = sy-subrc. |
211 | CONDENSE l_txt. |
212 | CONCATENATE 'RC=' l_txt ',' INTO l_txt. |
213 | PERFORM get_message_text USING 'MEREP_00' '245' |
214 | l_txt space space space |
215 | CHANGING l_message. |
216 | CONCATENATE l_message l_uri INTO l_message SEPARATED BY space. |
217 | WRITE / l_message. |
218 | ELSE. |
219 | CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' |
220 | EXPORTING |
221 | text = l_infoline. |
222 | ENDIF. |
223 | |
224 | ENDFORM. "download_binary |
225 | |
226 | |
227 |
228 |
229 |
230 | FORM download_get_params |
231 | USING |
232 | value(i_pgmid) |
233 | value(i_object) |
234 | value(i_filename) |
235 | value(i_extension) |
236 | value(i_do_count) |
237 | CHANGING |
238 | c_uri TYPE string |
239 | c_sub_uri TYPE char255 |
240 | c_infoline TYPE syucomm. |
241 | |
242 | DATA: |
243 | l_cnt_downloads TYPE string, |
244 | l_cnt_elems TYPE string, |
245 | l_txt TYPE string, |
246 | l_message TYPE string, |
247 | l_codepage(20) TYPE c. |
248 | |
249 | CLEAR: |
250 | c_uri, |
251 | c_sub_uri, |
252 | c_infoline. |
253 | |
254 | IF i_do_count = abap_true. |
255 | g_cnt_downloads = g_cnt_downloads + 1. |
256 | ENDIF. |
257 | |
258 |
259 | l_cnt_downloads = g_cnt_downloads. |
260 | CONDENSE l_cnt_downloads. |
261 | l_cnt_elems = g_cnt_elems. |
262 | CONDENSE l_cnt_elems. |
263 | PERFORM get_message_text USING 'DSVAS' '226' |
264 | i_filename space space space |
265 | CHANGING l_message. |
266 | CONCATENATE |
267 | l_cnt_downloads '/' l_cnt_elems '|' |
268 | l_message INTO c_infoline |
269 | SEPARATED BY space. |
270 | |
271 | |
272 | |
273 |
274 | IF NOT i_pgmid IS INITIAL AND NOT i_object IS INITIAL. |
275 | CONCATENATE c_uri i_pgmid '_' i_object gc_delimiter INTO c_uri. |
276 | ENDIF. |
277 | CONCATENATE c_uri i_filename INTO c_uri. |
278 | IF NOT i_extension IS INITIAL. |
279 | CONCATENATE c_uri '.' i_extension INTO c_uri. |
280 | ENDIF. |
281 | |
282 | PERFORM download_make_plain_uri CHANGING c_uri. |
283 | |
284 | c_sub_uri = c_uri. |
285 | IF c_sub_uri+0(1) = gc_delimiter. |
286 | c_sub_uri = c_sub_uri+1. |
287 | ENDIF. |
288 | c_uri = c_sub_uri. |
289 | |
290 |
291 | CONCATENATE g_folder gc_delimiter g_pack gc_delimiter c_uri |
292 | INTO c_uri. |
293 | PERFORM download_make_plain_uri CHANGING c_uri. |
294 | |
295 | ENDFORM. "download_get_params |
296 | |
297 | |
298 |
299 |
300 |
301 | FORM download_make_plain_uri |
302 | CHANGING |
303 | c_uri TYPE string. |
304 | |
305 | DATA: |
306 | l_dbl_delimiter TYPE string. |
307 | |
308 | CONCATENATE gc_delimiter gc_delimiter INTO l_dbl_delimiter. |
309 | PERFORM replace_all |
310 | USING '/' gc_delimiter |
311 | CHANGING c_uri. |
312 | PERFORM replace_all |
313 | USING '<' '-' |
314 | CHANGING c_uri. |
315 | PERFORM replace_all |
316 | USING '>' '-' |
317 | CHANGING c_uri. |
318 | WHILE c_uri CS l_dbl_delimiter. |
319 | PERFORM replace_all |
320 | USING l_dbl_delimiter gc_delimiter |
321 | CHANGING c_uri. |
322 | ENDWHILE. |
323 | |
324 | ENDFORM. "download_replace_wildcards |
325 | |
326 | |
327 |
328 |
329 |
330 | FORM download_replace_wildcards |
331 | USING |
332 | value(i_sub_uri) TYPE char255 |
333 | CHANGING |
334 | ct_html TYPE it_string. |
335 | |
336 | DATA: |
337 | l_index_htm TYPE char255, |
338 | l_cnt TYPE i, |
339 | l_len TYPE i. |
340 | |
341 | CONSTANTS: |
342 | lc_replacements TYPE i VALUE 2. |
343 | |
344 | FIELD-SYMBOLS: |
345 | <ls_html> TYPE string. |
346 | |
347 | l_len = strlen( i_sub_uri ). |
348 | |
349 |
350 | CONCATENATE 'index.' gc_extension_htm |
351 | INTO l_index_htm. |
352 | DO l_len TIMES. |
353 | IF i_sub_uri+l_cnt(1) = gc_delimiter. |
354 | CONCATENATE '../' l_index_htm INTO l_index_htm. |
355 | ENDIF. |
356 | ADD 1 TO l_cnt. |
357 | ENDDO. |
358 | |
359 |
360 | CLEAR l_cnt. |
361 | LOOP AT ct_html ASSIGNING <ls_html>. |
362 | IF <ls_html> CS '../index.htm'. |
363 | PERFORM replace_all |
364 | USING |
365 | '##INDEX_HTM##' |
366 | l_index_htm |
367 | CHANGING |
368 | <ls_html>. |
369 | ADD 1 TO l_cnt. |
370 | ENDIF. |
371 | IF l_cnt = lc_replacements. |
372 | EXIT. |
373 | ENDIF. |
374 | ENDLOOP. |
375 | |
376 | ENDFORM. "download_replace_wildcards |