1 *&---------------------------------------------------------------------*
2 *& Report ZEXPORT
3 *&
4 *&---------------------------------------------------------------------*
5 *&TEDK900341
6 *&
7 *&---------------------------------------------------------------------*
8
9 REPORT zdaochu.
10 *REPORT zcqbtest_1.
11 *======================================================================================================================
12 * Direct Download Enterprise version 1.3.1.
13 *
14 * THIS SOFTWARE IS FOR PERSONAL USE ONLY.
15 * THIS PROGRAM IS FREEWARE AND IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND.
16 * THE PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY
17 * OR FITNESS FOR A PARTICULAR PURPOSE.
18 *
19 * IN NO EVENT SHALL THE PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES, EVEN IF PROVIDER
20 * HAS BEEN ADVISED BY CLIENT OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE.
21 * CLIENT AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND EXPENSES. BY
22 * INSTALLING OR RUNNING THIS PROGRAM YOU ARE AGREEING TO THE TERMS AND CONDITONS STATED ABOVE.
23 *
24 *----------------------------------------------------------------------------------------------------------------------
25 * PROGRAM DESCRIPTION & USE
26 * Allows a user to download programs, Functions, DD definitions, etc to the presentation server. This version searches
27 * recursively for nested includes and function modules, and allows you to download the resulting code as standard text
28 * or HTML web pages within a suitable directory structure.
29 *
30 * You can either search by object name, using wildcards if you wish, or a combination of Author and object name. If
31 * you want all objects returned for a particular author then select the author name and choose the most suitable
32 * radiobutton. All objects will be returned if the fields to the right hand side of the radiobutton are left completely
33 * blank.
34 *
35 * Compatible with R/3 Enterprise only, for older versions of SAP you will need Direct Download version 5.xx.
36 * This version removes the programming limitations imposed by developing across SAP releases 3 to 4.6.
37 *
38 * In order to be able to download files to the SAP server you must first set up a logical filepath within transaction
39 * 'FILE', or use an existing one. You must also create a external operating system command in SM69 called ZMKDIR. This
40 * will then be used to create any directories needed on the SAP server
41
42 * This program is intended to allow a person to keep a visual representation of a program for backup purposes only as
43 * has not been designed to allow programs to be uploaded to SAP systems.
44 *----------------------------------------------------------------------------------------------------------------------
45 *
46 * author : E.G.Mellodew
47 *
48 *
49 * program contact : [email protected]
50 * www.dalestech.com
51 *
52 *----------------------------------------------------------------------------------------------------------------------
53
54 *----------------------------------------------------------------------------------------------------------------------
55 * SAP Tables
56 *----------------------------------------------------------------------------------------------------------------------
57 TABLES: trdir, seoclass, tfdir, enlfdir, dd02l.
58
59 *----------------------------------------------------------------------------------------------------------------------
60 * Types
61 *----------------------------------------------------------------------------------------------------------------------
62 * text element structure
63 TYPES: ttexttable LIKE textpool.
64 * GUI titles
65 TYPES: tguititle LIKE d347t.
66
67 * Message classes
68 TYPES: BEGIN OF tmessage,
69 arbgb LIKE t100-arbgb,
70 stext LIKE t100a-stext,
71 msgnr LIKE t100-msgnr,
72 text LIKE t100-text,
73 END OF tmessage.
74
75 * Screen flow.
76 TYPES: BEGIN OF tscreenflow,
77 screen LIKE d020s-dnum,
78 code LIKE d022s-line,
79 END OF tscreenflow.
80
81 * Holds a table\structure definition
82 TYPES: BEGIN OF tdicttablestructure,
83 fieldname LIKE dd03l-fieldname,
84 position LIKE dd03l-position,
85 keyflag LIKE dd03l-keyflag,
86 rollname LIKE dd03l-rollname,
87 domname LIKE dd03l-domname,
88 datatype LIKE dd03l-datatype,
89 leng LIKE dd03l-leng,
90 ddtext LIKE dd04t-ddtext,
91 END OF tdicttablestructure.
92
93 * Holds a tables attributes + its definition
94 TYPES: BEGIN OF tdicttable,
95 tablename LIKE dd03l-tabname,
96 tabletitle LIKE dd02t-ddtext,
97 istructure TYPE tdicttablestructure OCCURS 0,
98 END OF tdicttable.
99
100 * Include program names
101 TYPES: BEGIN OF tinclude,
102 includename LIKE trdir-name,
103 includetitle LIKE tftit-stext,
104 END OF tinclude.
105
106 * Exception class texts
107 TYPES: BEGIN OF tconcept,
108 constname TYPE string,
109 concept TYPE sotr_conc,
110 END OF tconcept.
111
112 * Method
113 TYPES: BEGIN OF tmethod,
114 cmpname LIKE vseomethod-cmpname,
115 descript LIKE vseomethod-descript,
116 exposure LIKE vseomethod-exposure,
117 methodkey TYPE string,
118 END OF tmethod.
119
120 * Class
121 TYPES: BEGIN OF tclass,
122 scanned(1),
123 clsname LIKE vseoclass-clsname,
124 descript LIKE vseoclass-descript,
125 msg_id LIKE vseoclass-msg_id,
126 exposure LIKE vseoclass-exposure,
127 state LIKE vseoclass-state,
128 clsfinal LIKE vseoclass-clsfinal,
129 r3release LIKE vseoclass-r3release,
130 imethods TYPE tmethod OCCURS 0,
131 idictstruct TYPE tdicttable OCCURS 0,
132 itextelements TYPE ttexttable OCCURS 0,
133 imessages TYPE tmessage OCCURS 0,
134 iconcepts TYPE tconcept OCCURS 0,
135 textelementkey TYPE string,
136 publicclasskey TYPE string,
137 privateclasskey TYPE string,
138 protectedclasskey TYPE string,
139 typesclasskey TYPE string,
140 exceptionclass TYPE i,
141 END OF tclass.
142
143 * function modules
144 TYPES: BEGIN OF tfunction,
145 functionname LIKE tfdir-funcname,
146 functiongroup LIKE enlfdir-area,
147 includenumber LIKE tfdir-include,
148 functionmaininclude LIKE tfdir-funcname,
149 functiontitle LIKE tftit-stext,
150 topincludename LIKE tfdir-funcname,
151 progname LIKE tfdir-pname,
152 programlinkname LIKE tfdir-pname,
153 messageclass LIKE t100-arbgb,
154 itextelements TYPE ttexttable OCCURS 0,
155 iselectiontexts TYPE ttexttable OCCURS 0,
156 imessages TYPE tmessage OCCURS 0,
157 iincludes TYPE tinclude OCCURS 0,
158 idictstruct TYPE tdicttable OCCURS 0,
159 iguititle TYPE tguititle OCCURS 0,
160 iscreenflow TYPE tscreenflow OCCURS 0,
161 END OF tfunction.
162
163 TYPES: BEGIN OF tprogram,
164 progname LIKE trdir-name,
165 programtitle LIKE tftit-stext,
166 subc LIKE trdir-subc,
167 messageclass LIKE t100-arbgb,
168 imessages TYPE tmessage OCCURS 0,
169 itextelements TYPE ttexttable OCCURS 0,
170 iselectiontexts TYPE ttexttable OCCURS 0,
171 iguititle TYPE tguititle OCCURS 0,
172 iscreenflow TYPE tscreenflow OCCURS 0,
173 iincludes TYPE tinclude OCCURS 0,
174 idictstruct TYPE tdicttable OCCURS 0,
175 END OF tprogram.
176
177 *----------------------------------------------------------------------------------------------------------------------
178 * Internal tables
179 *----------------------------------------------------------------------------------------------------------------------
180 * Dictionary object
181 DATA: idictionary TYPE STANDARD TABLE OF tdicttable WITH HEADER LINE.
182 * Function modules.
183 DATA: ifunctions TYPE STANDARD TABLE OF tfunction WITH HEADER LINE.
184 * Tree display structure.
185 DATA: itreedisplay TYPE STANDARD TABLE OF snodetext WITH HEADER LINE.
186 * Message class data
187 DATA: imessages TYPE STANDARD TABLE OF tmessage WITH HEADER LINE.
188 * Holds a single message class an all of its messages
189 DATA: isinglemessageclass TYPE STANDARD TABLE OF tmessage WITH HEADER LINE.
190 * Holds program related data
191 DATA: iprograms TYPE STANDARD TABLE OF tprogram WITH HEADER LINE.
192 * Classes
193 DATA: iclasses TYPE STANDARD TABLE OF tclass WITH HEADER LINE.
194 * Table of paths created on the SAP server
195 DATA: iserverpaths TYPE STANDARD TABLE OF string WITH HEADER LINE.
196
197 *----------------------------------------------------------------------------------------------------------------------
198 * Table prototypes
199 *----------------------------------------------------------------------------------------------------------------------
200 DATA: dumidictstructure TYPE STANDARD TABLE OF tdicttablestructure.
201 DATA: dumitexttab TYPE STANDARD TABLE OF ttexttable.
202 DATA: dumiincludes TYPE STANDARD TABLE OF tinclude.
203 DATA: dumihtml TYPE STANDARD TABLE OF string.
204 DATA: dumiheader TYPE STANDARD TABLE OF string .
205 DATA: dumiscreen TYPE STANDARD TABLE OF tscreenflow .
206 DATA: dumiguititle TYPE STANDARD TABLE OF tguititle.
207 DATA: dumimethods TYPE STANDARD TABLE OF tmethod.
208 DATA: dumiconcepts TYPE STANDARD TABLE OF tconcept.
209
210 *----------------------------------------------------------------------------------------------------------------------
211 * Global objects
212 *----------------------------------------------------------------------------------------------------------------------
213 DATA: objfile TYPE REF TO cl_gui_frontend_services.
214 DATA: objruntimeerror TYPE REF TO cx_root.
215
216 *----------------------------------------------------------------------------------------------------------------------
217 * Constants
218 *----------------------------------------------------------------------------------------------------------------------
219 CONSTANTS: versionno TYPE string VALUE '1.3.1'.
220 CONSTANTS: tables TYPE string VALUE 'TABLES'.
221 CONSTANTS: table TYPE string VALUE 'TABLE'.
222 CONSTANTS: like TYPE string VALUE 'LIKE'.
223 CONSTANTS: type TYPE string VALUE 'TYPE'.
224 CONSTANTS: typerefto TYPE string VALUE 'TYPE REF TO'.
225 CONSTANTS: structure TYPE string VALUE 'STRUCTURE'.
226 CONSTANTS: lowstructure TYPE string VALUE 'structure'.
227 CONSTANTS: occurs TYPE string VALUE 'OCCURS'.
228 CONSTANTS: function TYPE string VALUE 'FUNCTION'.
229 CONSTANTS: callfunction TYPE string VALUE ' CALL FUNCTION'.
230 CONSTANTS: message TYPE string VALUE 'MESSAGE'.
231 CONSTANTS: include TYPE string VALUE 'INCLUDE'.
232 CONSTANTS: lowinclude TYPE string VALUE 'include'.
233 CONSTANTS: destination TYPE string VALUE 'DESTINATION'.
234 CONSTANTS: is_table TYPE string VALUE 'T'.
235 CONSTANTS: is_program TYPE string VALUE 'P'.
236 CONSTANTS: is_screen TYPE string VALUE 'S'.
237 CONSTANTS: is_guititle TYPE string VALUE 'G'.
238 CONSTANTS: is_documentation TYPE string VALUE 'D'.
239 CONSTANTS: is_messageclass TYPE string VALUE 'MC'.
240 CONSTANTS: is_function TYPE string VALUE 'F'.
241 CONSTANTS: is_class TYPE string VALUE 'C'.
242 CONSTANTS: is_method TYPE string VALUE 'M'.
243 CONSTANTS: asterix TYPE string VALUE '*'.
244 CONSTANTS: comma TYPE string VALUE ','.
245 CONSTANTS: period TYPE string VALUE '.'.
246 CONSTANTS: dash TYPE string VALUE '-'.
247 CONSTANTS: true TYPE i VALUE 1.
248 CONSTANTS: false TYPE i VALUE 0.
249 CONSTANTS: lt TYPE string VALUE '<'.
250 CONSTANTS: gt TYPE string VALUE '>'.
251 CONSTANTS: unix TYPE string VALUE 'UNIX'.
252 CONSTANTS: non_unix TYPE string VALUE 'not UNIX'.
253 CONSTANTS: background_colour TYPE string VALUE '#FFFFE0'.
254 CONSTANTS: colour_white TYPE string VALUE '#FFFFFF'.
255 CONSTANTS: colour_black TYPE string VALUE '#000000'.
256 CONSTANTS: colour_yellow TYPE string VALUE '#FFFF00'.
257 CONSTANTS: comment_colour TYPE string VALUE '#0000FF'.
258 CONSTANTS: htmlextension TYPE string VALUE 'html'.
259 CONSTANTS: textextension TYPE string VALUE 'txt'.
260
261 *----------------------------------------------------------------------------------------------------------------------
262 * Global variables
263 *----------------------------------------------------------------------------------------------------------------------
264 DATA: statusbarmessage(100).
265 DATA: forcedexit TYPE i VALUE 0.
266 DATA: starttime LIKE sy-uzeit.
267 DATA: runtime LIKE sy-uzeit.
268 DATA: downloadfileextension TYPE string.
269 DATA: downloadfolder TYPE string.
270 DATA: serverslashseparator TYPE string.
271 DATA: frontendslashseparator TYPE string.
272 DATA: slashseparatortouse TYPE string.
273 DATA: serverfilesystem TYPE filesys_d.
274 DATA: serverfolder TYPE string.
275 DATA: frontendopsystem TYPE string.
276 DATA: serveropsystem TYPE string.
277 DATA: customernamespace TYPE string.
278 RANGES: soprogramname FOR trdir-name.
279 RANGES: soauthor FOR usr02-bname.
280 RANGES: sotablenames FOR dd02l-tabname.
281 RANGES: sofunctionname FOR tfdir-funcname.
282 RANGES: soclassname FOR vseoclass-clsname.
283 RANGES: sofunctiongroup FOR enlfdir-area.
284 FIELD-SYMBOLS: <wadictstruct> TYPE tdicttable.
285
286 *----------------------------------------------------------------------------------------------------------------------
287 * Selection screen declaration
288 *----------------------------------------------------------------------------------------------------------------------
289 * Author
290 SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE tblock1.
291 SELECTION-SCREEN BEGIN OF LINE.
292 SELECTION-SCREEN COMMENT 5(23) tauth.
293 PARAMETERS: pauth LIKE usr02-bname MEMORY ID mauth.
294 SELECTION-SCREEN END OF LINE.
295
296 SELECTION-SCREEN BEGIN OF LINE.
297 SELECTION-SCREEN COMMENT 5(36) tpmod.
298 PARAMETERS: pmod AS CHECKBOX.
299 SELECTION-SCREEN END OF LINE.
300
301 * Local objects
302 SELECTION-SCREEN BEGIN OF LINE.
303 SELECTION-SCREEN COMMENT 5(36) t$tmp.
304 PARAMETERS: p$tmp AS CHECKBOX DEFAULT ''.
305 SELECTION-SCREEN END OF LINE.
306 SELECTION-SCREEN: END OF BLOCK b1.
307
308 SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE tblock2.
309 * Tables
310 SELECTION-SCREEN BEGIN OF LINE.
311 PARAMETERS: rtable RADIOBUTTON GROUP r1.
312 SELECTION-SCREEN COMMENT 5(15) trtable.
313 SELECTION-SCREEN END OF LINE.
314
315 SELECTION-SCREEN BEGIN OF LINE.
316 SELECTION-SCREEN COMMENT 10(15) tptable.
317 SELECT-OPTIONS: sotable FOR dd02l-tabname.
318 SELECTION-SCREEN END OF LINE.
319
320 SELECTION-SCREEN BEGIN OF LINE.
321 SELECTION-SCREEN COMMENT 10(79) ttnote.
322 SELECTION-SCREEN END OF LINE.
323
324 * Message classes
325 SELECTION-SCREEN BEGIN OF LINE.
326 PARAMETERS: rmess RADIOBUTTON GROUP r1.
327 SELECTION-SCREEN COMMENT 5(18) tpmes.
328 SELECTION-SCREEN END OF LINE.
329
330 SELECTION-SCREEN BEGIN OF LINE.
331 SELECTION-SCREEN COMMENT 10(18) tmname.
332 PARAMETERS: pmname LIKE t100-arbgb MEMORY ID mmname.
333 SELECTION-SCREEN END OF LINE.
334
335 * Function modules
336 SELECTION-SCREEN BEGIN OF LINE.
337 PARAMETERS: rfunc RADIOBUTTON GROUP r1.
338 SELECTION-SCREEN COMMENT 5(30) trfunc.
339 SELECTION-SCREEN END OF LINE.
340
341 SELECTION-SCREEN BEGIN OF LINE.
342 SELECTION-SCREEN COMMENT 10(15) tpfname.
343 SELECT-OPTIONS: sofname FOR tfdir-funcname.
344 SELECTION-SCREEN END OF LINE.
345
346 SELECTION-SCREEN BEGIN OF LINE.
347 SELECTION-SCREEN COMMENT 10(15) tfgroup.
348 SELECT-OPTIONS: sofgroup FOR enlfdir-area.
349 SELECTION-SCREEN END OF LINE.
350
351 * Classes
352 SELECTION-SCREEN BEGIN OF LINE.
353 PARAMETERS: rclass RADIOBUTTON GROUP r1.
354 SELECTION-SCREEN COMMENT 5(30) trclass.
355 SELECTION-SCREEN END OF LINE.
356
357 SELECTION-SCREEN BEGIN OF LINE.
358 SELECTION-SCREEN COMMENT 10(15) tpcname.
359 SELECT-OPTIONS: soclass FOR seoclass-clsname.
360 SELECTION-SCREEN END OF LINE.
361
362 * Programs / includes
363 SELECTION-SCREEN BEGIN OF LINE.
364 PARAMETERS: rprog RADIOBUTTON GROUP r1 DEFAULT 'X'.
365 SELECTION-SCREEN COMMENT 5(18) tprog.
366 SELECTION-SCREEN END OF LINE.
367
368 SELECTION-SCREEN BEGIN OF LINE.
369 SELECTION-SCREEN COMMENT 10(15) trpname.
370 SELECT-OPTIONS: soprog FOR trdir-name.
371 SELECTION-SCREEN END OF LINE.
372
373 SELECTION-SCREEN SKIP.
374 * Language
375 SELECTION-SCREEN BEGIN OF LINE.
376 SELECTION-SCREEN COMMENT 1(18) tmlang.
377 PARAMETERS: pmlang LIKE t100-sprsl DEFAULT 'EN'.
378 SELECTION-SCREEN END OF LINE.
379
380 * Package
381 SELECTION-SCREEN BEGIN OF LINE.
382 SELECTION-SCREEN COMMENT 1(18) tpack.
383 PARAMETERS: ppack LIKE tadiv-devclass MEMORY ID mpack.
384 SELECTION-SCREEN END OF LINE.
385
386 * Customer objects
387 SELECTION-SCREEN BEGIN OF LINE.
388 SELECTION-SCREEN COMMENT 1(27) tcust.
389 PARAMETERS: pcust AS CHECKBOX DEFAULT 'X'.
390 SELECTION-SCREEN COMMENT 32(25) tnrange.
391 PARAMETERS: pcname TYPE namespace MEMORY ID mnamespace.
392 SELECTION-SCREEN END OF LINE.
393 SELECTION-SCREEN: END OF BLOCK b2.
394
395 * Additional things to download.
396 SELECTION-SCREEN: BEGIN OF BLOCK b3 WITH FRAME TITLE tblock3.
397 SELECTION-SCREEN BEGIN OF LINE.
398 SELECTION-SCREEN COMMENT 1(33) tptext.
399 PARAMETERS: ptext AS CHECKBOX DEFAULT 'X' MEMORY ID mtext.
400 SELECTION-SCREEN END OF LINE.
401
402 SELECTION-SCREEN BEGIN OF LINE.
403 SELECTION-SCREEN COMMENT 1(33) tmess.
404 PARAMETERS: pmess AS CHECKBOX DEFAULT 'X' MEMORY ID mmess.
405 SELECTION-SCREEN END OF LINE.
406
407 SELECTION-SCREEN BEGIN OF LINE.
408 SELECTION-SCREEN COMMENT 1(33) tpinc.
409 PARAMETERS: pinc AS CHECKBOX DEFAULT 'X' MEMORY ID minc.
410 SELECTION-SCREEN COMMENT 40(20) trecc.
411 PARAMETERS: preci AS CHECKBOX DEFAULT 'X' MEMORY ID mreci.
412 SELECTION-SCREEN END OF LINE.
413
414 SELECTION-SCREEN BEGIN OF LINE.
415 SELECTION-SCREEN COMMENT 1(33) tpfunc.
416 PARAMETERS: pfunc AS CHECKBOX DEFAULT 'X' MEMORY ID mfunc.
417 SELECTION-SCREEN COMMENT 40(20) trecf.
418 PARAMETERS: precf AS CHECKBOX DEFAULT 'X' MEMORY ID mrecf.
419 SELECTION-SCREEN END OF LINE.
420
421 SELECTION-SCREEN BEGIN OF LINE.
422 SELECTION-SCREEN COMMENT 1(33) tdoc.
423 PARAMETERS: pdoc AS CHECKBOX DEFAULT 'X' MEMORY ID mdoc.
424 SELECTION-SCREEN END OF LINE.
425
426 SELECTION-SCREEN BEGIN OF LINE.
427 SELECTION-SCREEN COMMENT 1(33) tpscr.
428 PARAMETERS: pscr AS CHECKBOX DEFAULT 'X' MEMORY ID mscr.
429 SELECTION-SCREEN END OF LINE.
430
431 SELECTION-SCREEN BEGIN OF LINE.
432 SELECTION-SCREEN COMMENT 1(33) tpdict.
433 PARAMETERS: pdict AS CHECKBOX DEFAULT 'X' MEMORY ID mdict.
434 SELECTION-SCREEN END OF LINE.
435
436 SELECTION-SCREEN BEGIN OF LINE.
437 SELECTION-SCREEN COMMENT 1(33) tsortt.
438 PARAMETERS: psortt AS CHECKBOX DEFAULT ' ' MEMORY ID msortt.
439 SELECTION-SCREEN END OF LINE.
440 SELECTION-SCREEN: END OF BLOCK b3.
441
442 * File details
443 SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE tblock4.
444 SELECTION-SCREEN BEGIN OF LINE.
445 SELECTION-SCREEN COMMENT 1(20) tphtml.
446 PARAMETERS: phtml RADIOBUTTON GROUP g1 DEFAULT 'X'.
447 SELECTION-SCREEN END OF LINE.
448
449 SELECTION-SCREEN BEGIN OF LINE.
450 SELECTION-SCREEN COMMENT 5(29) tcomm.
451 PARAMETERS: pcomm AS CHECKBOX DEFAULT 'X'.
452 SELECTION-SCREEN END OF LINE.
453
454 SELECTION-SCREEN BEGIN OF LINE.
455 SELECTION-SCREEN COMMENT 5(29) tback.
456 PARAMETERS: pback AS CHECKBOX DEFAULT 'X'.
457 SELECTION-SCREEN END OF LINE.
458
459 SELECTION-SCREEN BEGIN OF LINE.
460 SELECTION-SCREEN COMMENT 1(20) tptxt.
461 PARAMETERS: ptxt RADIOBUTTON GROUP g1.
462 SELECTION-SCREEN END OF LINE.
463
464 SELECTION-SCREEN SKIP.
465
466 * Download to SAP server
467 SELECTION-SCREEN BEGIN OF LINE.
468 SELECTION-SCREEN COMMENT 1(25) tserv.
469 PARAMETERS: pserv RADIOBUTTON GROUP g2.
470 SELECTION-SCREEN END OF LINE.
471 SELECTION-SCREEN BEGIN OF LINE.
472 SELECTION-SCREEN COMMENT 8(20) tspath.
473 PARAMETERS: plogical LIKE filename-fileintern MEMORY ID mlogical.
474 SELECTION-SCREEN END OF LINE.
475 SELECTION-SCREEN COMMENT /28(60) tsdpath.
476
477 * Download to PC
478 SELECTION-SCREEN BEGIN OF LINE.
479 SELECTION-SCREEN COMMENT 1(25) tpc.
480 PARAMETERS: ppc RADIOBUTTON GROUP g2 DEFAULT 'X'.
481 SELECTION-SCREEN END OF LINE.
482 SELECTION-SCREEN BEGIN OF LINE.
483 SELECTION-SCREEN COMMENT 8(20) tppath.
484 PARAMETERS: pfolder LIKE rlgrap-filename MEMORY ID mfolder.
485 SELECTION-SCREEN END OF LINE.
486 SELECTION-SCREEN: END OF BLOCK b4.
487
488 * Display options
489 SELECTION-SCREEN: BEGIN OF BLOCK b5 WITH FRAME TITLE tblock5.
490 * Display final report
491 SELECTION-SCREEN BEGIN OF LINE.
492 SELECTION-SCREEN COMMENT 1(33) trep.
493 PARAMETERS: prep AS CHECKBOX DEFAULT 'X'.
494 SELECTION-SCREEN END OF LINE.
495 * Display progress messages
496 SELECTION-SCREEN BEGIN OF LINE.
497 SELECTION-SCREEN COMMENT 1(33) tpromess.
498 PARAMETERS: ppromess AS CHECKBOX DEFAULT 'X'.
499 SELECTION-SCREEN END OF LINE.
500 SELECTION-SCREEN: END OF BLOCK b5.
501
502 *----------------------------------------------------------------------------------------------------------------------
503 * Display a directory picker window
504 *----------------------------------------------------------------------------------------------------------------------
505 AT SELECTION-SCREEN ON VALUE-REQUEST FOR pfolder.
506
507 DATA: objfile TYPE REF TO cl_gui_frontend_services.
508 DATA: pickedfolder TYPE string.
509 DATA: initialfolder TYPE string.
510
511 IF sy-batch IS INITIAL.
512 CREATE OBJECT objfile.
513
514 IF NOT pfolder IS INITIAL.
515 initialfolder = pfolder.
516 ELSE.
517 objfile->get_temp_directory( CHANGING temp_dir = initialfolder
518 EXCEPTIONS cntl_error = 1
519 error_no_gui = 2
520 not_supported_by_gui = 3 ).
521 ENDIF.
522
523 objfile->directory_browse( EXPORTING initial_folder = initialfolder
524 CHANGING selected_folder = pickedfolder
525 EXCEPTIONS cntl_error = 1
526 error_no_gui = 2
527 not_supported_by_gui = 3 ).
528
529 IF sy-subrc = 0.
530 pfolder = pickedfolder.
531 ELSE.
532 WRITE: / 'An error has occured picking a folder'.
533 ENDIF.
534 ENDIF.
535
536 *----------------------------------------------------------------------------------------------------------------------
537 AT SELECTION-SCREEN.
538 *----------------------------------------------------------------------------------------------------------------------
539 CASE 'X'.
540 WHEN ppc.
541 IF pfolder IS INITIAL.
542 * User must enter a path to save to
543 MESSAGE e000(oo) WITH 'You must enter a file path'.
544 ENDIF.
545
546 WHEN pserv.
547 IF plogical IS INITIAL.
548 * User must enter a logical path to save to
549 MESSAGE e000(oo) WITH 'You must enter a logical file name'.
550 ENDIF.
551 ENDCASE.
552
553 *----------------------------------------------------------------------------------------------------------------------
554 AT SELECTION-SCREEN ON plogical.
555 *----------------------------------------------------------------------------------------------------------------------
556
557 IF NOT pserv IS INITIAL.
558 CALL FUNCTION 'FILE_GET_NAME'
559 EXPORTING
560 logical_filename = plogical
561 IMPORTING
562 file_name = serverfolder
563 EXCEPTIONS
564 file_not_found = 1
565 OTHERS = 2.
566 IF sy-subrc = 0.
567 IF serverfolder IS INITIAL.
568 MESSAGE e000(oo) WITH 'No file path returned from logical filename'.
569 ELSE.
570 * Path to display on the selection screen
571 tsdpath = serverfolder.
572 * Remove the trailing slash off the path as the subroutine buildFilename will add an extra one
573 SHIFT serverfolder RIGHT DELETING TRAILING serverslashseparator.
574 SHIFT serverfolder LEFT DELETING LEADING space.
575 ENDIF.
576 ELSE.
577 MESSAGE e000(oo) WITH 'Logical filename does not exist'.
578 ENDIF.
579 ENDIF.
580
581 * ---------------------------------------------------------------------------------------------------------------------
582 AT SELECTION-SCREEN ON VALUE-REQUEST FOR soprog-low.
583 * ---------------------------------------------------------------------------------------------------------------------
584 CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
585 EXPORTING
586 object_type = 'PROG'
587 object_name = soprog-low
588 suppress_selection = 'X'
589 use_alv_grid = ''
590 without_personal_list = ''
591 IMPORTING
592 object_name_selected = soprog-low
593 EXCEPTIONS
594 cancel = 1.
595
596 * ---------------------------------------------------------------------------------------------------------------------
597 AT SELECTION-SCREEN ON VALUE-REQUEST FOR soprog-high.
598 * ---------------------------------------------------------------------------------------------------------------------
599 CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
600 EXPORTING
601 object_type = 'PROG'
602 object_name = soprog-high
603 suppress_selection = 'X'
604 use_alv_grid = ''
605 without_personal_list = ''
606 IMPORTING
607 object_name_selected = soprog-high
608 EXCEPTIONS
609 cancel = 1.
610
611 * ---------------------------------------------------------------------------------------------------------------------
612 AT SELECTION-SCREEN ON VALUE-REQUEST FOR soclass-low.
613 * ---------------------------------------------------------------------------------------------------------------------
614 CALL FUNCTION 'F4_DD_ALLTYPES'
615 EXPORTING
616 object = soclass-low
617 suppress_selection = 'X'
618 display_only = ''
619 only_types_for_clifs = 'X'
620 IMPORTING
621 result = soclass-low.
622
623 * ---------------------------------------------------------------------------------------------------------------------
624 AT SELECTION-SCREEN ON VALUE-REQUEST FOR soclass-high.
625 * ---------------------------------------------------------------------------------------------------------------------
626 CALL FUNCTION 'F4_DD_ALLTYPES'
627 EXPORTING
628 object = soclass-high
629 suppress_selection = 'X'
630 display_only = ''
631 only_types_for_clifs = 'X'
632 IMPORTING
633 result = soclass-high.
634
635 * ---------------------------------------------------------------------------------------------------------------------
636 AT SELECTION-SCREEN ON VALUE-REQUEST FOR sofname-low.
637 * ---------------------------------------------------------------------------------------------------------------------
638 CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
639 EXPORTING
640 object_type = 'FUNC'
641 object_name = sofname-low
642 suppress_selection = 'X'
643 use_alv_grid = ''
644 without_personal_list = ''
645 IMPORTING
646 object_name_selected = sofname-low
647 EXCEPTIONS
648 cancel = 1.
649
650 * ---------------------------------------------------------------------------------------------------------------------
651 AT SELECTION-SCREEN ON VALUE-REQUEST FOR sofname-high.
652 * ---------------------------------------------------------------------------------------------------------------------
653 CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
654 EXPORTING
655 object_type = 'FUNC'
656 object_name = sofname-high
657 suppress_selection = 'X'
658 use_alv_grid = ''
659 without_personal_list = ''
660 IMPORTING
661 object_name_selected = sofname-high
662 EXCEPTIONS
663 cancel = 1.
664
665 * ---------------------------------------------------------------------------------------------------------------------
666 AT SELECTION-SCREEN ON VALUE-REQUEST FOR sofgroup-low.
667 * ---------------------------------------------------------------------------------------------------------------------
668 CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
669 EXPORTING
670 object_type = 'FUGR'
671 object_name = sofgroup-low
672 suppress_selection = 'X'
673 use_alv_grid = ''
674 without_personal_list = ''
675 IMPORTING
676 object_name_selected = sofgroup-low
677 EXCEPTIONS
678 cancel = 1.
679
680 * ---------------------------------------------------------------------------------------------------------------------
681 AT SELECTION-SCREEN ON VALUE-REQUEST FOR sofgroup-high.
682 * ---------------------------------------------------------------------------------------------------------------------
683 CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
684 EXPORTING
685 object_type = 'FUGR'
686 object_name = sofgroup-high
687 suppress_selection = 'X'
688 use_alv_grid = ''
689 without_personal_list = ''
690 IMPORTING
691 object_name_selected = sofgroup-high
692 EXCEPTIONS
693 cancel = 1.
694
695 *----------------------------------------------------------------------------------------------------------------------
696 * initialisation
697 *----------------------------------------------------------------------------------------------------------------------
698 INITIALIZATION.
699 * Parameter screen texts.
700 tblock1 = 'Author (Optional)'.
701 t$tmp = 'Programs only: include local objects'.
702 tblock2 = 'Objects to download'.
703 tblock3 = 'Additional downloads for programs, function modules and classes'.
704 tblock4 = 'Download parameters'.
705 tblock5 = 'Display options'.
706 tauth = 'Author name'.
707 tpmod = 'Include programs modified by author'.
708 tcust = 'Only customer objects'.
709 tnrange = 'Alt customer name range'.
710 trtable = 'Tables / Structures'.
711 tptable = 'Table name'.
712 ttnote = 'Note: tables are stored under the username of the last person who modified them'.
713 trfunc = 'Function modules'.
714 tpfname = 'Function name'.
715 tfgroup = 'Function group'.
716 trclass = 'Classes'.
717 tpcname = 'Class name'.
718 tmess = 'Message class'.
719 tmname = 'Class name'.
720 tmlang = 'Language'.
721 tprog = 'Programs'.
722 trpname = 'Program name'.
723 tpack = 'Package'.
724 tptxt = 'Text document'.
725 tphtml = 'HTML document'.
726 tcomm = 'Highlight comments'.
727 tback = 'Include background colour'.
728 tptext = 'Text elements'.
729 tpinc = 'Include programs'.
730 trecc = 'Recursive search'.
731 tppath = 'File path'.
732 tspath = 'Logical file name'.
733 tpmes = 'Message classes'.
734 tpfunc = 'Function modules'.
735 tdoc = 'Function module documentation'.
736 trecf = 'Recursive search'.
737 tpscr = 'Screens'.
738 tpdict = 'Dictionary structures'.
739 tsortt = 'Sort table fields alphabetically'.
740 tserv = 'Download to server'.
741 tpc = 'Download to PC'.
742 trep = 'Display download report'.
743 tpromess = 'Display progress messages'.
744
745 * Determine the frontend operating system type.
746 IF sy-batch IS INITIAL.
747 PERFORM determinefrontendopsystem USING frontendslashseparator frontendopsystem.
748 ENDIF.
749 PERFORM determineserveropsystem USING serverslashseparator serverfilesystem serveropsystem.
750
751 * Determine if the external command exists. If it doesn't then disable the server input field
752 PERFORM findexternalcommand.
753
754 *----------------------------------------------------------------------------------------------------------------------
755 * start-of-selection.
756 *----------------------------------------------------------------------------------------------------------------------
757 START-OF-SELECTION.
758
759 PERFORM checkcomboboxes.
760 PERFORM fillselectionranges.
761 starttime = sy-uzeit.
762
763 * Don't display status messages if we are running in the background
764 IF NOT sy-batch IS INITIAL.
765 ppromess = ''.
766 ENDIF.
767
768 * Fool the HTML routines to stop them hyperlinking anything with a space in them
769 IF pcname IS INITIAL.
770 customernamespace = '^'.
771 ELSE.
772 customernamespace = pcname.
773 ENDIF.
774
775 * Determine which operating slash and download directory to use
776 CASE 'X'.
777 WHEN ppc.
778 slashseparatortouse = frontendslashseparator.
779 downloadfolder = pfolder.
780 WHEN pserv.
781 slashseparatortouse = serverslashseparator.
782 downloadfolder = serverfolder.
783 ENDCASE.
784
785 * Main program flow.
786 CASE 'X'.
787 * Select tables
788 WHEN rtable.
789 PERFORM retrievetables USING idictionary[]
790 sotablenames[]
791 soauthor[].
792
793 * Select message classes tables
794 WHEN rmess.
795 PERFORM retrievemessageclass USING imessages[]
796 soauthor[] "Author
797 pmname "Message class name
798 pmlang "Message class language
799 pmod. "Modified by author
800
801 * Select function modules
802 WHEN rfunc.
803 PERFORM retrievefunctions USING sofunctionname[] "Function name
804 sofunctiongroup[] "Function group
805 ifunctions[] "Found functions
806 soauthor[] "Author
807 ptext "Get text elements
808 pscr "Get screens
809 pcust "Customer data only
810 customernamespace. "Customer name range
811
812
813 LOOP AT ifunctions.
814 * Find Dict structures, messages, functions, includes etc.
815 PERFORM scanforadditionalfuncstuff USING ifunctions[]
816 preci "Search for includes recursively
817 precf "Search for functions recursively
818 pinc "Search for includes
819 pfunc "Search for functions
820 pdict "search for dictionary objects
821 pmess "Search for messages
822 pcust "Customer data only
823 customernamespace. "Customer name range
824 ENDLOOP.
825
826 * Select Classes
827 WHEN rclass.
828 PERFORM retrieveclasses USING iclasses[]
829 ifunctions[]
830 soclassname[] "Class name
831 soauthor[] "Author
832 customernamespace "Customer name range
833 pmod "Also modified by author
834 pcust "Customer object only
835 pmess "Find messages
836 ptext "Text Elements
837 pdict "Dictionary structures
838 pfunc "Get functions
839 pinc "Get includes
840 precf "Search recursively for functions
841 preci "Search recursively for includes
842 'X' "Search recursively for classes
843 pmlang. "Language
844
845 LOOP AT ifunctions.
846 * Find Dict structures, messages, functions, includes etc.
847 PERFORM scanforadditionalfuncstuff USING ifunctions[]
848 preci "Search for includes recursively
849 precf "Search for functions recursively
850 pinc "Search for includes
851 pfunc "Search for functions
852 pdict "search for dictionary objects
853 pmess "Search for messages
854 pcust "Customer data only
855 customernamespace. "Customer name range
856 ENDLOOP.
857
858 * Select programs
859 WHEN rprog.
860 PERFORM retrieveprograms USING iprograms[]
861 ifunctions[]
862 soprogramname[] "Program name
863 soauthor[] "Author
864 customernamespace "Customer name range
865 pmod "Also modified by author
866 pcust "Customer object only
867 pmess "Find messages
868 ptext "Text Elements
869 pdict "Dictionay structures
870 pfunc "Get functions
871 pinc "Get includes
872 pscr "Get screens
873 precf "Search recursively for functions
874 preci "Search recursively for includes
875 p$tmp "local objects
876 ppack. "Package
877 ENDCASE.
878
879 *----------------------------------------------------------------------------------------------------------------------
880 * end-of-selection
881 *----------------------------------------------------------------------------------------------------------------------
882 END-OF-SELECTION.
883
884 IF forcedexit = 0.
885 * Set the file extension and output type of the file
886 IF ptxt IS INITIAL.
887 downloadfileextension = htmlextension.
888 ELSE.
889 downloadfileextension = textextension.
890 ENDIF.
891
892 * Decide what to download
893 CASE 'X'.
894 * Download tables
895 WHEN rtable.
896 IF NOT ( idictionary[] IS INITIAL ).
897 PERFORM downloadddstructures USING idictionary[]
898 downloadfolder
899 htmlextension
900 space
901 psortt
902 slashseparatortouse
903 pserv
904 ppromess.
905
906 * Free up any memory used for caching HTML versions of tables
907 LOOP AT idictionary.
908 FREE MEMORY ID idictionary-tablename.
909 ENDLOOP.
910
911 * Display donwload report
912 IF NOT prep IS INITIAL.
913 GET TIME.
914 runtime = sy-uzeit - starttime.
915 PERFORM filltreenodetables USING idictionary[]
916 itreedisplay[]
917 runtime.
918 ENDIF.
919
920 CLEAR idictionary[].
921 ENDIF.
922
923 * Download message class
924 WHEN rmess.
925 IF NOT ( imessages[] IS INITIAL ).
926 SORT imessages ASCENDING BY arbgb msgnr.
927 LOOP AT imessages.
928 APPEND imessages TO isinglemessageclass.
929 AT END OF arbgb.
930 PERFORM downloadmessageclass USING isinglemessageclass[]
931 imessages-arbgb
932 downloadfolder
933 downloadfileextension
934 phtml
935 space
936 pcomm
937 customernamespace
938 pinc
939 pdict
940 pmess
941 slashseparatortouse
942 pserv
943 ppromess.
944 CLEAR isinglemessageclass[].
945 ENDAT.
946 ENDLOOP.
947
948 * Display download report
949 IF NOT prep IS INITIAL.
950 GET TIME.
951 runtime = sy-uzeit - starttime.
952 PERFORM filltreenodemessages USING imessages[]
953 itreedisplay[]
954 runtime.
955 ENDIF.
956
957 CLEAR imessages[].
958 ENDIF.
959
960 * Download functions
961 WHEN rfunc.
962 IF NOT ( ifunctions[] IS INITIAL ).
963 PERFORM downloadfunctions USING ifunctions[]
964 downloadfolder
965 downloadfileextension
966 space
967 pdoc
968 phtml
969 pcomm
970 customernamespace
971 pinc
972 pdict
973 textextension
974 htmlextension
975 psortt
976 slashseparatortouse
977 pserv
978 ppromess.
979
980 * Free up any memory used for caching HTML versions of tables
981 LOOP AT ifunctions.
982 LOOP AT ifunctions-idictstruct ASSIGNING <wadictstruct>.
983 FREE MEMORY ID <wadictstruct>-tablename.
984 ENDLOOP.
985 ENDLOOP.
986
987 * Display donwload report
988 IF NOT prep IS INITIAL.
989 GET TIME.
990 runtime = sy-uzeit - starttime.
991 PERFORM filltreenodefunctions USING ifunctions[]
992 itreedisplay[]
993 runtime.
994 ENDIF.
995
996 CLEAR ifunctions[].
997 ENDIF.
998
999 * Download Classes
1000 WHEN rclass.
1001 IF NOT ( iclasses[] IS INITIAL ).
1002 PERFORM downloadclasses USING iclasses[]
1003 ifunctions[]
1004 downloadfolder
1005 downloadfileextension
1006 htmlextension
1007 textextension
1008 phtml
1009 pcomm
1010 customernamespace
1011 pinc
1012 pdict
1013 pdoc
1014 psortt
1015 slashseparatortouse
1016 pserv
1017 ppromess.
1018
1019 * Free up any memory used for caching HTML versions of tables
1020 LOOP AT ifunctions.
1021 LOOP AT ifunctions-idictstruct ASSIGNING <wadictstruct>.
1022 FREE MEMORY ID <wadictstruct>-tablename.
1023 ENDLOOP.
1024 ENDLOOP.
1025
1026 * Free up any memory used for caching HTML versions of tables
1027 LOOP AT iprograms.
1028 LOOP AT iprograms-idictstruct ASSIGNING <wadictstruct>.
1029 FREE MEMORY ID <wadictstruct>-tablename.
1030 ENDLOOP.
1031 ENDLOOP.
1032
1033 * Display donwload report
1034 IF NOT prep IS INITIAL.
1035 GET TIME.
1036 runtime = sy-uzeit - starttime.
1037 PERFORM filltreenodeclasses USING iclasses[]
1038 ifunctions[]
1039 itreedisplay[]
1040 runtime.
1041 ENDIF.
1042
1043 CLEAR iclasses[].
1044 CLEAR ifunctions[].
1045 ENDIF.
1046
1047 * Download programs
1048 WHEN rprog.
1049 IF NOT ( iprograms[] IS INITIAL ).
1050 PERFORM downloadprograms USING iprograms[]
1051 ifunctions[]
1052 downloadfolder
1053 downloadfileextension
1054 htmlextension
1055 textextension
1056 phtml
1057 pcomm
1058 customernamespace
1059 pinc
1060 pdict
1061 pdoc
1062 psortt
1063 slashseparatortouse
1064 pserv
1065 ppromess.
1066
1067 * Free up any memory used for caching HTML versions of tables
1068 LOOP AT ifunctions.
1069 LOOP AT ifunctions-idictstruct ASSIGNING <wadictstruct>.
1070 FREE MEMORY ID <wadictstruct>-tablename.
1071 ENDLOOP.
1072 ENDLOOP.
1073
1074 * Free up any memory used for caching HTML versions of tables
1075 LOOP AT iprograms.
1076 LOOP AT iprograms-idictstruct ASSIGNING <wadictstruct>.
1077 FREE MEMORY ID <wadictstruct>-tablename.
1078 ENDLOOP.
1079 ENDLOOP.
1080
1081 * Display donwload report
1082 IF NOT prep IS INITIAL.
1083 GET TIME.
1084 runtime = sy-uzeit - starttime.
1085 PERFORM filltreenodeprograms USING iprograms[]
1086 ifunctions[]
1087 itreedisplay[]
1088 runtime.
1089 ENDIF.
1090
1091 CLEAR iprograms[].
1092 CLEAR ifunctions[].
1093 ENDIF.
1094 ENDCASE.
1095
1096 IF NOT prep IS INITIAL.
1097 IF NOT ( itreedisplay[] IS INITIAL ).
1098 PERFORM displaytree USING itreedisplay[].
1099 ELSE.
1100 statusbarmessage = 'No items found matching selection criteria'.
1101 PERFORM displaystatus USING statusbarmessage 2.
1102 ENDIF.
1103 ENDIF.
1104 ENDIF.
1105
1106 *--- Memory IDs
1107 * User name
1108 SET PARAMETER ID 'MAUTH' FIELD pauth.
1109 * Message class
1110 SET PARAMETER ID 'MMNAME' FIELD pmname.
1111 * Customer namespace
1112 SET PARAMETER ID 'MNAMESPACE' FIELD pcname.
1113 * Folder
1114 SET PARAMETER ID 'MFOLDER' FIELD pfolder.
1115 * Logical filepath
1116 SET PARAMETER ID 'MLOGICAL' FIELD plogical.
1117 * Package
1118 SET PARAMETER ID 'MPACK' FIELD ppack.
1119 * Text element checkbox
1120 SET PARAMETER ID 'MTEXT' FIELD ptext.
1121 * Messages checkbox
1122 SET PARAMETER ID 'MMESS' FIELD pmess.
1123 * Includes checkbox
1124 SET PARAMETER ID 'MINC' FIELD pinc.
1125 * Recursive includes checkbox.
1126 SET PARAMETER ID 'MRECI' FIELD preci.
1127 * Functions checkbox
1128 SET PARAMETER ID 'MFUNC' FIELD pfunc.
1129 * Recursive functions checkbox
1130 SET PARAMETER ID 'MRECF' FIELD precf.
1131 * Function module documntation checkbox
1132 SET PARAMETER ID 'MDOC' FIELD pdoc.
1133 * Screens checkbox
1134 SET PARAMETER ID 'MSCR' FIELD pscr.
1135 * Dictionary checkbox
1136 SET PARAMETER ID 'MDICT' FIELD pdict.
1137 * Sort table ascending checkBox
1138 SET PARAMETER ID 'MSORTT' FIELD psortt.
1139
1140 ***********************************************************************************************************************
1141 ***************************************************SUBROUTINES*********************************************************
1142 ***********************************************************************************************************************
1143
1144 *----------------------------------------------------------------------------------------------------------------------
1145 * checkComboBoxes... Check input parameters
1146 *----------------------------------------------------------------------------------------------------------------------
1147 FORM checkcomboboxes.
1148
1149 IF pauth IS INITIAL.
1150 CASE 'X'.
1151 WHEN rtable.
1152 IF sotable[] IS INITIAL.
1153 statusbarmessage = 'You must enter either a table name or author.'.
1154 ENDIF.
1155 WHEN rfunc.
1156 IF ( sofname[] IS INITIAL ) AND ( sofgroup[] IS INITIAL ).
1157 IF sofname[] IS INITIAL.
1158 statusbarmessage = 'You must enter either a function name or author.'.
1159 ELSE.
1160 IF sofgroup[] IS INITIAL.
1161 statusbarmessage = 'You must enter either a function group, or an author name.'.
1162 ENDIF.
1163 ENDIF.
1164 ENDIF.
1165 WHEN rprog.
1166 IF soprog[] IS INITIAL.
1167 statusbarmessage = 'You must enter either a program name or author name.'.
1168 ENDIF.
1169 ENDCASE.
1170 ELSE.
1171 * Check the user name of the person objects are to be downloaded for
1172 IF pauth = 'SAP*' OR pauth = 'SAP'.
1173 statusbarmessage = 'Sorry cannot download all objects for SAP standard user'.
1174 ENDIF.
1175 ENDIF.
1176
1177 IF NOT statusbarmessage IS INITIAL.
1178 PERFORM displaystatus USING statusbarmessage 3.
1179 forcedexit = 1.
1180 STOP.
1181 ENDIF.
1182 ENDFORM. "checkComboBoxes
1183
1184 *----------------------------------------------------------------------------------------------------------------------
1185 * fillSelectionRanges... for selection routines
1186 *----------------------------------------------------------------------------------------------------------------------
1187 FORM fillselectionranges.
1188
1189 DATA: strlength TYPE i.
1190
1191 strlength = strlen( pcname ).
1192
1193 IF NOT pauth IS INITIAL.
1194 soauthor-sign = 'I'.
1195 soauthor-option = 'EQ'.
1196 soauthor-low = pauth.
1197 APPEND soauthor.
1198 ENDIF.
1199
1200 * Tables
1201 IF NOT sotable IS INITIAL.
1202 sotablenames[] = sotable[].
1203 * Add in the customer namespace if we need to
1204 IF NOT pcname IS INITIAL.
1205 LOOP AT sotablenames.
1206 IF sotablenames-low+0(strlength) <> pcname.
1207 CONCATENATE pcname sotablenames-low INTO sotablenames-low.
1208 ENDIF.
1209
1210 IF sotablenames-high+0(strlength) <> pcname.
1211 CONCATENATE pcname sotablenames-high INTO sotablenames-high.
1212 ENDIF.
1213
1214 MODIFY sotablenames.
1215 ENDLOOP.
1216 ENDIF.
1217 ENDIF.
1218
1219 * Function names
1220 IF NOT sofname IS INITIAL.
1221 sofunctionname[] = sofname[].
1222 * Add in the customer namespace if we need to
1223 IF NOT pcname IS INITIAL.
1224 LOOP AT sofunctionname.
1225 IF sofunctionname-low+0(strlength) <> pcname.
1226 CONCATENATE pcname sofunctionname-low INTO sofunctionname-low.
1227 ENDIF.
1228
1229 IF sofunctionname-high+0(strlength) <> pcname.
1230 CONCATENATE pcname sofunctionname-high INTO sofunctionname-high.
1231 ENDIF.
1232
1233 MODIFY sofunctionname.
1234 ENDLOOP.
1235 ENDIF.
1236 ENDIF.
1237
1238 * Function group
1239 IF NOT sofgroup IS INITIAL.
1240 sofunctiongroup[] = sofgroup[].
1241 * Add in the customer namespace if we need to
1242 IF NOT pcname IS INITIAL.
1243 LOOP AT sofunctionname.
1244 IF sofunctiongroup-low+0(strlength) <> pcname.
1245 CONCATENATE pcname sofunctiongroup-low INTO sofunctiongroup-low.
1246 ENDIF.
1247
1248 IF sofunctiongroup-high+0(strlength) <> pcname.
1249 CONCATENATE pcname sofunctiongroup-high INTO sofunctiongroup-high.
1250 ENDIF.
1251
1252 MODIFY sofunctiongroup.
1253 ENDLOOP.
1254 ENDIF.
1255 ENDIF.
1256
1257 * Class names
1258 IF NOT soclass IS INITIAL.
1259 soclassname[] = soclass[].
1260 * Add in the customer namespace if we need to
1261 IF NOT pcname IS INITIAL.
1262 LOOP AT soclassname.
1263 IF soclassname-low+0(strlength) <> pcname.
1264 CONCATENATE pcname soclassname-low INTO soclassname-low.
1265 ENDIF.
1266
1267 IF soclassname-high+0(strlength) <> pcname.
1268 CONCATENATE pcname soclassname-high INTO soclassname-high.
1269 ENDIF.
1270
1271 MODIFY soclassname.
1272 ENDLOOP.
1273 ENDIF.
1274 ENDIF.
1275
1276 * Program names
1277 IF NOT soprog IS INITIAL.
1278 soprogramname[] = soprog[].
1279 * Add in the customer namespace if we need to
1280 IF NOT pcname IS INITIAL.
1281 LOOP AT soprogramname.
1282 IF soprogramname-low+0(strlength) <> pcname.
1283 CONCATENATE pcname soprogramname-low INTO soprogramname-low.
1284 ENDIF.
1285
1286 IF soprogramname-high+0(strlength) <> pcname.
1287 CONCATENATE pcname soprogramname-high INTO soprogramname-high.
1288 ENDIF.
1289
1290 MODIFY soprogramname.
1291 ENDLOOP.
1292 ENDIF.
1293 ENDIF.
1294 ENDFORM. " fillSelectionRanges
1295
1296 *----------------------------------------------------------------------------------------------------------------------
1297 * retrieveTables... Search for tables in dictionary
1298 *----------------------------------------------------------------------------------------------------------------------
1299 FORM retrievetables USING ilocdictstructure LIKE idictionary[]
1300 sotable LIKE sotable[]
1301 soauthor LIKE soauthor[].
1302
1303 DATA: wadictstructure TYPE tdicttable.
1304
1305 SELECT tabname
1306 FROM dd02l
1307 INTO wadictstructure-tablename
1308 WHERE tabname IN sotable
1309 AND tabclass <> 'CLUSTER'
1310 AND tabclass <> 'POOL'
1311 AND tabclass <> 'VIEW'
1312 AND as4user IN soauthor
1313 AND as4local = 'A'.
1314
1315 PERFORM findtabledescription USING wadictstructure-tablename
1316 wadictstructure-tabletitle.
1317
1318 PERFORM findtabledefinition USING wadictstructure-tablename
1319 wadictstructure-istructure[].
1320
1321 APPEND wadictstructure TO ilocdictstructure.
1322 CLEAR wadictstructure.
1323 ENDSELECT.
1324 ENDFORM. "retrieveTables
1325
1326 *----------------------------------------------------------------------------------------------------------------------
1327 * findTableDescription... Search for table description in dictionary
1328 *----------------------------------------------------------------------------------------------------------------------
1329 FORM findtabledescription USING VALUE(tablename)
1330 tabledescription.
1331
1332 SELECT SINGLE ddtext
1333 FROM dd02t
1334 INTO tabledescription
1335 WHERE tabname = tablename
1336 AND ddlanguage = sy-langu.
1337 ENDFORM. "findTableDescription
1338
1339 *----------------------------------------------------------------------------------------------------------------------
1340 * findTableDefinition... Find the structure of a table from the SAP database.
1341 *----------------------------------------------------------------------------------------------------------------------
1342 FORM findtabledefinition USING VALUE(tablename)
1343 idictstruct LIKE dumidictstructure[].
1344
1345 DATA gotstate LIKE dcobjif-gotstate.
1346 DATA: definition TYPE STANDARD TABLE OF dd03p WITH HEADER LINE.
1347 DATA: wadictstruct TYPE tdicttablestructure.
1348
1349 CALL FUNCTION 'DDIF_TABL_GET'
1350 EXPORTING
1351 name = tablename
1352 state = 'A'
1353 langu = sy-langu
1354 IMPORTING
1355 gotstate = gotstate
1356 TABLES
1357 dd03p_tab = definition
1358 EXCEPTIONS
1359 illegal_input = 1
1360 OTHERS = 2.
1361
1362 IF sy-subrc = 0 AND gotstate = 'A'.
1363 LOOP AT definition.
1364 MOVE-CORRESPONDING definition TO wadictstruct.
1365 PERFORM removeleadingzeros CHANGING wadictstruct-position.
1366 PERFORM removeleadingzeros CHANGING wadictstruct-leng.
1367 APPEND wadictstruct TO idictstruct.
1368 ENDLOOP.
1369 ENDIF.
1370 ENDFORM. "findTableDefinition
1371
1372 *----------------------------------------------------------------------------------------------------------------------
1373 * retrieveMessageClass... Retrieve a message class from the SAP database
1374 *----------------------------------------------------------------------------------------------------------------------
1375 FORM retrievemessageclass USING ilocmessages LIKE imessages[]
1376 rangeauthor LIKE soauthor[]
1377 VALUE(messageclassname)
1378 VALUE(messageclasslang)
1379 VALUE(modifiedby).
1380
1381 DATA: wamessage TYPE tmessage.
1382
1383 IF NOT messageclassname IS INITIAL.
1384 SELECT * FROM t100
1385 APPENDING CORRESPONDING FIELDS OF TABLE ilocmessages
1386 WHERE sprsl = messageclasslang
1387 AND arbgb = messageclassname.
1388
1389 LOOP AT ilocmessages INTO wamessage.
1390 SELECT SINGLE stext
1391 FROM t100a "#EC CI_BUFFJOIN
1392 INTO wamessage-stext
1393 WHERE arbgb = wamessage-arbgb.
1394 MODIFY ilocmessages FROM wamessage INDEX sy-tabix.
1395 ENDLOOP.
1396 ELSE.
1397 IF modifiedby IS INITIAL.
1398 * Select by author
1399 SELECT t100~arbgb "#EC CI_BUFFJOIN
1400 t100~msgnr
1401 t100~text
1402 t100a~stext
1403 APPENDING CORRESPONDING FIELDS OF TABLE ilocmessages
1404 FROM t100
1405 INNER JOIN t100a ON t100a~arbgb = t100~arbgb
1406 WHERE t100a~masterlang = messageclasslang
1407 AND t100a~respuser IN rangeauthor[].
1408 ELSE.
1409 * Select also by the last person who modified the message class
1410 SELECT t100~arbgb "#EC CI_BUFFJOIN
1411 t100~msgnr
1412 t100~text
1413 t100a~stext
1414 APPENDING CORRESPONDING FIELDS OF TABLE ilocmessages
1415 FROM t100
1416 INNER JOIN t100a ON t100a~arbgb = t100~arbgb
1417 WHERE t100a~masterlang = messageclasslang
1418 AND t100a~respuser IN rangeauthor[]
1419 AND t100a~lastuser IN rangeauthor[].
1420 ENDIF.
1421 ENDIF.
1422 ENDFORM. "retrieveMessageClass
1423
1424 *----------------------------------------------------------------------------------------------------------------------
1425 * retrieveFunctions... Retrieve function modules from SAP DB. May be called in one of two ways
1426 *----------------------------------------------------------------------------------------------------------------------
1427 FORM retrievefunctions USING sofname LIKE sofunctionname[]
1428 sofgroup LIKE sofunctiongroup[]
1429 ilocfunctionnames LIKE ifunctions[]
1430 VALUE(solocauthor) LIKE soauthor[]
1431 VALUE(gettextelements)
1432 VALUE(getscreens)
1433 VALUE(customeronly)
1434 VALUE(customernamerange).
1435
1436 RANGES: rangefuncname FOR tfdir-funcname.
1437 RANGES: rangefuncgroup FOR enlfdir-area.
1438 DATA: wafunctionname TYPE tfunction.
1439 DATA: nogroupsfound TYPE i VALUE true.
1440 DATA: previousfg TYPE v_fdir-area.
1441
1442 rangefuncname[] = sofname[].
1443 rangefuncgroup[] = sofgroup[].
1444
1445 IF NOT solocauthor[] IS INITIAL.
1446 *-- Need to select all function groups by author
1447 SELECT area
1448 FROM tlibv
1449 INTO rangefuncgroup-low
1450 WHERE uname IN solocauthor
1451 AND area IN sofgroup[].
1452
1453 rangefuncgroup-sign = 'I'.
1454 rangefuncgroup-option = 'EQ'.
1455 APPEND rangefuncgroup.
1456 nogroupsfound = false.
1457 ENDSELECT.
1458 ELSE.
1459 nogroupsfound = false.
1460 ENDIF.
1461
1462 IF nogroupsfound = false.
1463 * select by function name and/or function group.
1464 SELECT funcname area
1465 FROM v_fdir
1466 INTO (wafunctionname-functionname,
1467 wafunctionname-functiongroup)
1468 WHERE funcname IN rangefuncname
1469 AND area IN rangefuncgroup
1470 AND generated = ''
1471 ORDER BY area.
1472
1473 APPEND wafunctionname TO ilocfunctionnames.
1474 ENDSELECT.
1475 ENDIF.
1476
1477 LOOP AT ilocfunctionnames INTO wafunctionname.
1478 PERFORM retrievefunctiondetail USING wafunctionname-functionname
1479 wafunctionname-progname
1480 wafunctionname-includenumber
1481 wafunctionname-functiontitle.
1482
1483 PERFORM findmainfunctioninclude USING wafunctionname-progname
1484 wafunctionname-includenumber
1485 wafunctionname-functionmaininclude.
1486
1487 PERFORM findfunctiontopinclude USING wafunctionname-progname
1488 wafunctionname-topincludename.
1489
1490 * Find all user defined includes within the function group
1491 PERFORM scanforfunctionincludes USING wafunctionname-progname
1492 customeronly
1493 customernamerange
1494 wafunctionname-iincludes[].
1495 * Find main message class
1496 PERFORM findmainmessageclass USING wafunctionname-progname
1497 wafunctionname-messageclass.
1498
1499 * Find any screens declared within the main include
1500 IF NOT getscreens IS INITIAL.
1501 IF previousfg IS INITIAL OR previousfg <> wafunctionname-functiongroup.
1502 PERFORM findfunctionscreenflow USING wafunctionname.
1503
1504 * Search for any GUI texts
1505 PERFORM retrieveguititles USING wafunctionname-iguititle[]
1506 wafunctionname-progname.
1507 ENDIF.
1508 ENDIF.
1509
1510 IF NOT gettextelements IS INITIAL.
1511 * Find the program texts from out of the database.
1512 PERFORM retrieveprogramtexts USING wafunctionname-iselectiontexts[]
1513 wafunctionname-itextelements[]
1514 wafunctionname-progname.
1515 ENDIF.
1516
1517 previousfg = wafunctionname-functiongroup.
1518 MODIFY ilocfunctionnames FROM wafunctionname.
1519 ENDLOOP.
1520 ENDFORM. "retrieveFunctions
1521
1522 *----------------------------------------------------------------------------------------------------------------------
1523 * retrieveFunctionDetail... Retrieve function module details from SAP DB.
1524 *----------------------------------------------------------------------------------------------------------------------
1525 FORM retrievefunctiondetail USING VALUE(functionname)
1526 progname
1527 includename
1528 titletext.
1529
1530 SELECT SINGLE pname
1531 include
1532 FROM tfdir
1533 INTO (progname, includename)
1534 WHERE funcname = functionname.
1535
1536 IF sy-subrc = 0.
1537 SELECT SINGLE stext
1538 FROM tftit
1539 INTO titletext
1540 WHERE spras = sy-langu
1541 AND funcname = functionname.
1542 ENDIF.
1543 ENDFORM. "retrieveFunctionDetail
1544
1545 *----------------------------------------------------------------------------------------------------------------------
1546 * findMainFunctionInclude... Find the main include that contains the source code
1547 *----------------------------------------------------------------------------------------------------------------------
1548 FORM findmainfunctioninclude USING VALUE(programname)
1549 VALUE(includeno)
1550 internalincludename.
1551 DATA: newincludenumber TYPE string.
1552
1553 CONCATENATE '%U' includeno INTO newincludenumber.
1554 SELECT SINGLE include
1555 FROM d010inc
1556 INTO internalincludename
1557 WHERE master = programname
1558 AND include LIKE newincludenumber.
1559 ENDFORM. "findMainFunctionInclude
1560
1561 *----------------------------------------------------------------------------------------------------------------------
1562 * findFunctionTopInclude... Find the top include for the function group
1563 *----------------------------------------------------------------------------------------------------------------------
1564 FORM findfunctiontopinclude USING VALUE(programname)
1565 topincludename.
1566
1567 SELECT SINGLE include
1568 FROM d010inc
1569 INTO topincludename
1570 WHERE master = programname
1571 AND include LIKE '%TOP'.
1572 ENDFORM. "findFunctionTopInclude
1573
1574 *----------------------------------------------------------------------------------------------------------------------
1575 * scanForAdditionalFuncStuff... Search for additional things relating to functions
1576 *----------------------------------------------------------------------------------------------------------------------
1577 FORM scanforadditionalfuncstuff USING ilocfunctions LIKE ifunctions[]
1578 VALUE(recursiveincludes)
1579 VALUE(recursivefunctions)
1580 VALUE(searchforincludes)
1581 VALUE(searchforfunctions)
1582 VALUE(searchfordictionary)
1583 VALUE(searchformessages)
1584 VALUE(customeronly)
1585 VALUE(customernamerange).
1586
1587 DATA: wafunction TYPE tfunction.
1588 DATA: wainclude TYPE tinclude.
1589
1590 LOOP AT ilocfunctions INTO wafunction.
1591 IF NOT searchforincludes IS INITIAL.
1592 * Search in the main include
1593 PERFORM scanforincludeprograms USING wafunction-functionmaininclude
1594 recursiveincludes
1595 customeronly
1596 customernamerange
1597 wafunction-iincludes[].
1598
1599 * Search in the top include
1600 PERFORM scanforincludeprograms USING wafunction-topincludename
1601 recursiveincludes
1602 customeronly
1603 customernamerange
1604 wafunction-iincludes[].
1605 ENDIF.
1606
1607 IF NOT searchforfunctions IS INITIAL.
1608 PERFORM scanforfunctions USING wafunction-functionmaininclude
1609 wafunction-programlinkname
1610 recursiveincludes
1611 recursivefunctions
1612 customeronly
1613 customernamerange
1614 ilocfunctions[].
1615 ENDIF.
1616
1617 MODIFY ilocfunctions FROM wafunction.
1618 ENDLOOP.
1619
1620 * Now we have everthing perhaps we had better find all the dictionary structures
1621 IF NOT searchfordictionary IS INITIAL.
1622 LOOP AT ilocfunctions INTO wafunction.
1623 PERFORM scanfortables USING wafunction-progname
1624 customeronly
1625 customernamerange
1626 wafunction-idictstruct[].
1627
1628 PERFORM scanforlikeortype USING wafunction-progname
1629 customeronly
1630 customernamerange
1631 wafunction-idictstruct[].
1632
1633 LOOP AT wafunction-iincludes INTO wainclude.
1634 PERFORM scanfortables USING wainclude-includename
1635 customeronly
1636 customernamerange
1637 wafunction-idictstruct[].
1638
1639 PERFORM scanforlikeortype USING wainclude-includename
1640 customeronly
1641 customernamerange
1642 wafunction-idictstruct[].
1643 ENDLOOP.
1644
1645 MODIFY ilocfunctions FROM wafunction.
1646 ENDLOOP.
1647 ENDIF.
1648
1649 * Now search for all messages
1650 IF NOT searchformessages IS INITIAL.
1651 LOOP AT ilocfunctions INTO wafunction.
1652 PERFORM scanformessages USING wafunction-progname
1653 wafunction-messageclass
1654 wafunction-imessages[].
1655 MODIFY ilocfunctions FROM wafunction.
1656 ENDLOOP.
1657 ENDIF.
1658 ENDFORM. "scanForAdditionalFuncStuff
1659
1660 *----------------------------------------------------------------------------------------------------------------------
1661 * scanForClasses... Search each class or method for other classes
1662 *----------------------------------------------------------------------------------------------------------------------
1663 FORM scanforclasses USING VALUE(classname)
1664 VALUE(classlinkname)
1665 VALUE(customeronly)
1666 VALUE(customernamerange)
1667 ilocclasses LIKE iclasses[].
1668
1669 DATA ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
1670 DATA: head TYPE string.
1671 DATA: tail TYPE string.
1672 DATA: linelength TYPE i VALUE 0.
1673 DATA: waline TYPE string.
1674 DATA: waclass TYPE tclass.
1675 DATA: castclassname TYPE program.
1676 DATA: exceptioncustomernamerange TYPE string.
1677
1678 * Build the name of the possible cusotmer exception classes
1679 CONCATENATE customernamerange 'CX_' INTO exceptioncustomernamerange.
1680
1681 * Read the program code from the textpool.
1682 castclassname = classname.
1683 READ REPORT castclassname INTO ilines.
1684
1685 LOOP AT ilines INTO waline.
1686 * Find custom tables.
1687 linelength = strlen( waline ).
1688 IF linelength > 0.
1689 IF waline(1) = asterix.
1690 CONTINUE.
1691 ENDIF.
1692
1693 TRANSLATE waline TO UPPER CASE.
1694
1695 FIND typerefto IN waline IGNORING CASE.
1696 IF sy-subrc = 0.
1697 * Have found a reference to another class
1698 SPLIT waline AT type INTO head tail.
1699 SHIFT tail LEFT DELETING LEADING space.
1700 SPLIT tail AT 'REF' INTO head tail.
1701 SHIFT tail LEFT DELETING LEADING space.
1702 SPLIT tail AT 'TO' INTO head tail.
1703 SHIFT tail LEFT DELETING LEADING space.
1704 IF tail CS period.
1705 SPLIT tail AT period INTO head tail.
1706 ELSE.
1707 IF tail CS comma.
1708 SPLIT tail AT comma INTO head tail.
1709 ENDIF.
1710 ENDIF.
1711 ELSE.
1712 * Try and find classes which are only referenced through static mehods
1713 FIND '=>' IN waline MATCH OFFSET sy-fdpos.
1714 IF sy-subrc = 0.
1715 head = waline+0(sy-fdpos).
1716 SHIFT head LEFT DELETING LEADING space.
1717 CONDENSE head.
1718 FIND 'call method' IN head IGNORING CASE.
1719 IF sy-subrc = 0.
1720 SHIFT head LEFT DELETING LEADING space.
1721 SPLIT head AT space INTO head tail.
1722 SPLIT tail AT space INTO head tail.
1723 * Should have the class name here
1724 head = tail.
1725 ELSE.
1726 * Still have a class name even though it does not have the words call method in front
1727 IF waline CS '='.
1728 SPLIT waline AT '=' INTO tail head.
1729 SHIFT head LEFT DELETING LEADING space.
1730 SPLIT head AT '=' INTO head tail.
1731 ENDIF.
1732 sy-subrc = 0.
1733 ENDIF.
1734 ENDIF.
1735 ENDIF.
1736
1737 IF sy-subrc = 0.
1738 TRY.
1739 IF head+0(1) = 'Y' OR head+0(1) = 'Z' OR head CS customernamerange.
1740 * We have found a class best append it to our class table if we do not already have it.
1741 READ TABLE ilocclasses INTO waclass WITH KEY clsname = head.
1742 IF sy-subrc <> 0.
1743 IF head+0(3) = 'CX_'
1744 OR head+0(4) = 'ZCX_'
1745 OR head+0(4) = 'YCX_'
1746 OR head CS exceptioncustomernamerange.
1747
1748 waclass-exceptionclass = true.
1749 ENDIF.
1750
1751 waclass-clsname = head.
1752 APPEND waclass TO ilocclasses.
1753 ENDIF.
1754 ENDIF.
1755 CATCH cx_sy_range_out_of_bounds.
1756 ENDTRY.
1757 ENDIF.
1758 ENDIF.
1759 ENDLOOP.
1760 ENDFORM. "scanForClasses
1761
1762 *----------------------------------------------------------------------------------------------------------------------
1763 * scanForIncludePrograms... Search each program for include programs
1764 *----------------------------------------------------------------------------------------------------------------------
1765 FORM scanforincludeprograms USING VALUE(programname)
1766 VALUE(recursiveincludes)
1767 VALUE(customeronly)
1768 VALUE(customernamerange)
1769 ilocincludes LIKE dumiincludes[].
1770
1771 DATA: iincludelines TYPE STANDARD TABLE OF string WITH HEADER LINE.
1772 DATA: itokens TYPE STANDARD TABLE OF stokes WITH HEADER LINE.
1773 DATA: ikeywords TYPE STANDARD TABLE OF text20 WITH HEADER LINE.
1774 DATA: istatements TYPE STANDARD TABLE OF sstmnt WITH HEADER LINE.
1775 DATA: watokens TYPE stokes.
1776 DATA: wainclude TYPE tinclude.
1777 DATA: waincludeexists TYPE tinclude.
1778 DATA: maxlines TYPE i.
1779 DATA: nextline TYPE i.
1780 DATA: castprogramname TYPE program.
1781
1782 * Read the program code from the textpool.
1783 castprogramname = programname.
1784 READ REPORT castprogramname INTO iincludelines.
1785
1786 APPEND include TO ikeywords.
1787 SCAN ABAP-SOURCE iincludelines TOKENS INTO itokens WITH INCLUDES STATEMENTS INTO istatements KEYWORDS FROM ikeywords.
1788
1789 CLEAR iincludelines[].
1790
1791 maxlines = lines( itokens ).
1792 LOOP AT itokens WHERE str = include AND type = 'I'.
1793 nextline = sy-tabix + 1.
1794 IF nextline <= maxlines.
1795 READ TABLE itokens INDEX nextline INTO watokens.
1796
1797 * Are we only to find customer includes?
1798 IF NOT customeronly IS INITIAL.
1799 TRY.
1800 IF watokens-str+0(1) = 'Y' OR watokens-str+0(1) = 'Z' OR watokens-str CS customernamerange
1801 OR watokens-str+0(2) = 'MZ' OR watokens-str+0(2) = 'MY'.
1802
1803 ELSE.
1804 CONTINUE.
1805 ENDIF.
1806 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
1807 ENDTRY.
1808 ENDIF.
1809
1810 wainclude-includename = watokens-str.
1811
1812 * Best find the program title text as well.
1813 PERFORM findprogramorincludetitle USING wainclude-includename
1814 wainclude-includetitle.
1815
1816 * Don't append the include if we already have it listed
1817 READ TABLE ilocincludes INTO waincludeexists WITH KEY includename = wainclude-includename.
1818 IF sy-subrc <> 0.
1819 APPEND wainclude TO ilocincludes.
1820
1821 IF NOT recursiveincludes IS INITIAL.
1822 * Do a recursive search for other includes
1823 PERFORM scanforincludeprograms USING wainclude-includename
1824 recursiveincludes
1825 customeronly
1826 customernamerange
1827 ilocincludes[].
1828 ENDIF.
1829 ENDIF.
1830 ENDIF.
1831 ENDLOOP.
1832 ENDFORM. "scanForIncludePrograms
1833
1834 *----------------------------------------------------------------------------------------------------------------------
1835 * scanForFunctions... Search each program for function modules
1836 *----------------------------------------------------------------------------------------------------------------------
1837 FORM scanforfunctions USING VALUE(programname)
1838 VALUE(programlinkname)
1839 VALUE(recursiveincludes)
1840 VALUE(recursivefunctions)
1841 VALUE(customeronly)
1842 VALUE(customernamerange)
1843 ilocfunctions LIKE ifunctions[].
1844
1845 DATA: iincludelines TYPE STANDARD TABLE OF string WITH HEADER LINE.
1846 DATA: itokens TYPE STANDARD TABLE OF stokes WITH HEADER LINE.
1847 DATA: istatements TYPE STANDARD TABLE OF sstmnt WITH HEADER LINE.
1848 DATA: watokens TYPE stokes.
1849 DATA: wafunction TYPE tfunction.
1850 DATA: wafunctioncomparison TYPE tfunction.
1851 DATA: maxlines TYPE i.
1852 DATA: nextline TYPE i.
1853 DATA: castprogramname TYPE program.
1854 DATA: skipthisloop TYPE i.
1855
1856 * Read the program code from the textpool.
1857 castprogramname = programname.
1858 READ REPORT castprogramname INTO iincludelines.
1859 SCAN ABAP-SOURCE iincludelines TOKENS INTO itokens WITH INCLUDES STATEMENTS INTO istatements.
1860 CLEAR iincludelines[].
1861
1862 maxlines = lines( itokens ).
1863 LOOP AT itokens WHERE str = function AND type = 'I'.
1864
1865 nextline = sy-tabix + 1.
1866 IF nextline <= maxlines.
1867 READ TABLE itokens INDEX nextline INTO watokens.
1868
1869 * Are we only to find customer functions
1870 skipthisloop = false.
1871 IF NOT customeronly IS INITIAL.
1872 TRY.
1873 IF watokens-str+1(1) = 'Y' OR watokens-str+1(1) = 'Z' OR watokens-str CS customernamerange.
1874 ELSE.
1875 skipthisloop = true.
1876 ENDIF.
1877 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
1878 CLEANUP.
1879 skipthisloop = true.
1880 ENDTRY.
1881 ENDIF.
1882
1883 IF skipthisloop = false.
1884 wafunction-functionname = watokens-str.
1885 REPLACE ALL OCCURRENCES OF '''' IN wafunction-functionname WITH ' '.
1886 CONDENSE wafunction-functionname.
1887
1888 * Don't add a function if we alread have it listed.
1889 READ TABLE ilocfunctions WITH KEY functionname = wafunction-functionname INTO wafunctioncomparison.
1890 IF sy-subrc <> 0.
1891 * Add in the link name if the function is linked to a program
1892 wafunction-programlinkname = programlinkname.
1893
1894 * Don't download functions which are called through an RFC destination
1895 nextline = sy-tabix + 2.
1896 READ TABLE itokens INDEX nextline INTO watokens.
1897 IF watokens-str <> destination.
1898
1899 * Find the function group
1900 SELECT SINGLE area FROM v_fdir INTO wafunction-functiongroup WHERE funcname = wafunction-functionname.
1901
1902 IF sy-subrc = 0.
1903 * Best find the function number as well.
1904 PERFORM retrievefunctiondetail USING wafunction-functionname
1905 wafunction-progname
1906 wafunction-includenumber
1907 wafunction-functiontitle.
1908
1909 PERFORM findmainfunctioninclude USING wafunction-progname
1910 wafunction-includenumber
1911 wafunction-functionmaininclude.
1912
1913 PERFORM findfunctiontopinclude USING wafunction-progname
1914 wafunction-topincludename.
1915
1916 * Find main message class
1917 PERFORM findmainmessageclass USING wafunction-progname
1918 wafunction-messageclass.
1919
1920 APPEND wafunction TO ilocfunctions.
1921
1922 * Now lets search a little bit deeper and do a recursive search for other includes
1923 IF NOT recursiveincludes IS INITIAL.
1924 PERFORM scanforincludeprograms USING wafunction-functionmaininclude
1925 recursiveincludes
1926 customeronly
1927 customernamerange
1928 wafunction-iincludes[].
1929 ENDIF.
1930
1931 * Now lets search a little bit deeper and do a recursive search for other functions
1932 IF NOT recursivefunctions IS INITIAL.
1933 PERFORM scanforfunctions USING wafunction-functionmaininclude
1934 space
1935 recursiveincludes
1936 recursivefunctions
1937 customeronly
1938 customernamerange
1939 ilocfunctions[].
1940 ENDIF.
1941 CLEAR wafunction.
1942 ENDIF.
1943 ENDIF.
1944 ENDIF.
1945
1946 CLEAR wafunction.
1947 ENDIF.
1948 ENDIF.
1949 ENDLOOP.
1950 ENDFORM. "scanForFunctions
1951
1952 *----------------------------------------------------------------------------------------------------------------------
1953 * scanForFunctionIncludes... Find all user defined includes within the function group
1954 *----------------------------------------------------------------------------------------------------------------------
1955 FORM scanforfunctionincludes USING poolname
1956 VALUE(customeronly)
1957 VALUE(customernamerange)
1958 ilocincludes LIKE dumiincludes[].
1959
1960 DATA: iincludelines TYPE STANDARD TABLE OF string WITH HEADER LINE.
1961 DATA: itokens TYPE STANDARD TABLE OF stokes WITH HEADER LINE.
1962 DATA: ikeywords TYPE STANDARD TABLE OF text20 WITH HEADER LINE.
1963 DATA: istatements TYPE STANDARD TABLE OF sstmnt WITH HEADER LINE.
1964 DATA: watokens TYPE stokes.
1965 DATA: wainclude TYPE tinclude.
1966 DATA: waincludeexists TYPE tinclude.
1967 DATA: maxlines TYPE i.
1968 DATA: nextline TYPE i.
1969 DATA: castprogramname TYPE program.
1970
1971 * Read the program code from the textpool.
1972 castprogramname = poolname.
1973 READ REPORT castprogramname INTO iincludelines.
1974
1975 APPEND include TO ikeywords.
1976 SCAN ABAP-SOURCE iincludelines TOKENS INTO itokens WITH INCLUDES STATEMENTS INTO istatements KEYWORDS FROM ikeywords.
1977
1978 CLEAR iincludelines[].
1979
1980 maxlines = lines( itokens ).
1981 LOOP AT itokens WHERE str = include AND type = 'I'.
1982 nextline = sy-tabix + 1.
1983 IF nextline <= maxlines.
1984 READ TABLE itokens INDEX nextline INTO watokens.
1985
1986 IF watokens-str CP '*F++'.
1987 * Are we only to find customer includes?
1988 IF NOT customeronly IS INITIAL.
1989 TRY.
1990 IF watokens-str+0(2) = 'LY' OR watokens-str+0(2) = 'LZ' OR watokens-str CS customernamerange.
1991 ELSE.
1992 CONTINUE.
1993 ENDIF.
1994 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
1995 ENDTRY.
1996 ENDIF.
1997
1998 wainclude-includename = watokens-str.
1999
2000 * Best find the program title text as well.
2001 PERFORM findprogramorincludetitle USING wainclude-includename
2002 wainclude-includetitle.
2003
2004 * Don't append the include if we already have it listed
2005 READ TABLE ilocincludes INTO waincludeexists WITH KEY includename = wainclude-includename.
2006 IF sy-subrc <> 0.
2007 APPEND wainclude TO ilocincludes.
2008 ENDIF.
2009 ENDIF.
2010 ENDIF.
2011 ENDLOOP.
2012 ENDFORM. "scanForFunctionIncludes
2013
2014 *----------------------------------------------------------------------------------------------------------------------
2015 * findProgramOrIncludeTitle... Finds the title text of a program.
2016 *----------------------------------------------------------------------------------------------------------------------
2017 FORM findprogramorincludetitle USING VALUE(programname)
2018 titletext.
2019
2020 SELECT SINGLE text
2021 FROM trdirt
2022 INTO titletext
2023 WHERE name = programname
2024 AND sprsl = sy-langu.
2025 ENDFORM. "findProgramOrIncludeTitle
2026
2027 *----------------------------------------------------------------------------------------------------------------------
2028 * retrievePrograms... find programs and sub objects from SAP DB
2029 *----------------------------------------------------------------------------------------------------------------------
2030 FORM retrieveprograms USING ilocprogram LIKE iprograms[]
2031 ilocfunctions LIKE ifunctions[]
2032 rangeprogram LIKE soprogramname[]
2033 rangeauthor LIKE soauthor[]
2034 VALUE(custnamerange)
2035 VALUE(alsomodifiedbyauthor)
2036 VALUE(customerprogsonly)
2037 VALUE(getmessages)
2038 VALUE(gettextelements)
2039 VALUE(getcustdictstructures)
2040 VALUE(getfunctions)
2041 VALUE(getincludes)
2042 VALUE(getscreens)
2043 VALUE(recursivefuncsearch)
2044 VALUE(recursiveincludesearch)
2045 VALUE(getlocalobjects)
2046 VALUE(package).
2047
2048 DATA: warangeprogram LIKE LINE OF rangeprogram.
2049
2050 IF rangeprogram[] IS INITIAL.
2051 * We are finding all programs by an author
2052 PERFORM findallprogramsforauthor USING ilocprogram[]
2053 rangeprogram[]
2054 rangeauthor[]
2055 custnamerange
2056 alsomodifiedbyauthor
2057 customerprogsonly
2058 getlocalobjects
2059 package.
2060 ELSE.
2061 READ TABLE rangeprogram INDEX 1 INTO warangeprogram.
2062 IF warangeprogram-low CS asterix.
2063 PERFORM findprogramsbywildcard USING ilocprogram[]
2064 rangeprogram[]
2065 rangeauthor[]
2066 custnamerange
2067 customerprogsonly
2068 getlocalobjects
2069 package.
2070 ELSE.
2071 PERFORM checkprogramdoesexist USING ilocprogram[]
2072 rangeprogram[].
2073 ENDIF.
2074 ENDIF.
2075
2076 * Find extra items
2077 PERFORM scanforadditionalprogstuff USING ilocprogram[]
2078 ilocfunctions[]
2079 gettextelements
2080 getmessages
2081 getscreens
2082 getcustdictstructures
2083 getfunctions
2084 getincludes
2085 customerprogsonly
2086 custnamerange
2087 recursiveincludesearch
2088 recursivefuncsearch.
2089 ENDFORM. "retrievePrograms
2090
2091 *-------------------------------------------------------------------------------------------------------
2092 * scanForAdditionalProgStuff...
2093 *-------------------------------------------------------------------------------------------------------
2094 FORM scanforadditionalprogstuff USING ilocprogram LIKE iprograms[]
2095 ilocfunctions LIKE ifunctions[]
2096 VALUE(gettextelements)
2097 VALUE(getmessages)
2098 VALUE(getscreens)
2099 VALUE(getcustdictstructures)
2100 VALUE(getfunctions)
2101 VALUE(getincludes)
2102 VALUE(customeronly)
2103 VALUE(customernamerange)
2104 VALUE(recursiveincludesearch)
2105 VALUE(recursivefuncsearch).
2106
2107 DATA: waprogram TYPE tprogram.
2108 DATA: wainclude TYPE tinclude.
2109 DATA: mytabix TYPE sytabix.
2110
2111 * Best to find all the includes used in a program first
2112 IF NOT getincludes IS INITIAL.
2113 LOOP AT ilocprogram INTO waprogram.
2114 mytabix = sy-tabix.
2115 PERFORM scanforincludeprograms USING waprogram-progname
2116 recursiveincludesearch
2117 customeronly
2118 customernamerange
2119 waprogram-iincludes[].
2120
2121 MODIFY ilocprogram FROM waprogram INDEX mytabix.
2122 ENDLOOP.
2123 ENDIF.
2124
2125 * Once we have a list of all the includes we need to loop round them an select all the other objects
2126 LOOP AT ilocprogram INTO waprogram.
2127 mytabix = sy-tabix.
2128 PERFORM findprogramdetails USING waprogram-progname
2129 waprogram-subc
2130 waprogram-programtitle
2131 waprogram
2132 gettextelements
2133 getmessages
2134 getscreens
2135 getcustdictstructures
2136 customeronly
2137 customernamerange.
2138
2139 * Find any screens
2140 IF NOT getscreens IS INITIAL.
2141 PERFORM findprogramscreenflow USING waprogram.
2142 ENDIF.
2143
2144 LOOP AT waprogram-iincludes INTO wainclude.
2145 PERFORM findprogramdetails USING wainclude-includename
2146 'I'
2147 wainclude-includetitle
2148 waprogram
2149 gettextelements
2150 getmessages
2151 getscreens
2152 getcustdictstructures
2153 customeronly
2154 customernamerange.
2155 ENDLOOP.
2156
2157 MODIFY ilocprogram FROM waprogram INDEX mytabix.
2158 ENDLOOP.
2159
2160 * Now we have all the program includes and details we need to find extra functions
2161 IF NOT getfunctions IS INITIAL.
2162 LOOP AT ilocprogram INTO waprogram.
2163 * Find any functions defined in the code
2164 PERFORM scanforfunctions USING waprogram-progname
2165 waprogram-progname
2166 space
2167 space
2168 customeronly
2169 customernamerange
2170 ilocfunctions[].
2171 ENDLOOP.
2172 ENDIF.
2173
2174 * We have a list of all the functions so lets go and find details and other function calls
2175 PERFORM scanforadditionalfuncstuff USING ilocfunctions[]
2176 recursiveincludesearch
2177 recursivefuncsearch
2178 getincludes
2179 getfunctions
2180 getcustdictstructures
2181 getmessages
2182 customeronly
2183 customernamerange.
2184 ENDFORM. "scanForAdditionalProgStuff
2185
2186 *-------------------------------------------------------------------------------------------------------
2187 * findProgramDetails...
2188 *-------------------------------------------------------------------------------------------------------
2189 FORM findprogramdetails USING VALUE(programname)
2190 VALUE(programtype)
2191 programtitle
2192 waprogram TYPE tprogram
2193 VALUE(gettextelements)
2194 VALUE(getmessages)
2195 VALUE(getscreens)
2196 VALUE(getcustdictstructures)
2197 VALUE(customeronly)
2198 VALUE(customernamerange).
2199
2200 PERFORM findprogramorincludetitle USING programname
2201 programtitle.
2202
2203 IF NOT gettextelements IS INITIAL.
2204 * Find the program texts from out of the database.
2205 PERFORM retrieveprogramtexts USING waprogram-iselectiontexts[]
2206 waprogram-itextelements[]
2207 programname.
2208 ENDIF.
2209
2210 * Search for any GUI texts
2211 IF NOT getscreens IS INITIAL AND ( programtype = 'M' OR programtype = '1' ).
2212 PERFORM retrieveguititles USING waprogram-iguititle[]
2213 programname.
2214 ENDIF.
2215
2216 * Find individual messages
2217 IF NOT getmessages IS INITIAL.
2218 IF programtype = 'M' OR programtype = '1'.
2219 PERFORM findmainmessageclass USING programname
2220 waprogram-messageclass.
2221 ENDIF.
2222
2223 PERFORM scanformessages USING programname
2224 waprogram-messageclass
2225 waprogram-imessages[].
2226 ENDIF.
2227
2228 IF NOT getcustdictstructures IS INITIAL.
2229 PERFORM scanfortables USING programname
2230 customeronly
2231 customernamerange
2232 waprogram-idictstruct[].
2233
2234 PERFORM scanforlikeortype USING programname
2235 customeronly
2236 customernamerange
2237 waprogram-idictstruct[].
2238 ENDIF.
2239 ENDFORM. "findProgramDetails
2240
2241 *-------------------------------------------------------------------------------------------------------
2242 * findAllProgramsForAuthor...
2243 *-------------------------------------------------------------------------------------------------------
2244 FORM findallprogramsforauthor USING ilocprogram LIKE iprograms[]
2245 rangeprogram LIKE soprogramname[]
2246 rangeauthor LIKE soauthor[]
2247 VALUE(custnamerange)
2248 VALUE(alsomodifiedbyauthor)
2249 VALUE(customerprogsonly)
2250 VALUE(getlocalobjects)
2251 VALUE(package).
2252
2253 DATA: altcustomernamerange TYPE string.
2254 FIELD-SYMBOLS: <waprogram> TYPE tprogram.
2255 DATA: genflag TYPE genflag.
2256
2257 * build up the customer name range used for select statements
2258 CONCATENATE custnamerange '%' INTO altcustomernamerange.
2259
2260 * select by name and author
2261 IF NOT alsomodifiedbyauthor IS INITIAL.
2262 * Programs modified by author
2263 * Program to search for is an executable program
2264 IF customerprogsonly IS INITIAL.
2265 * Select all programs
2266 SELECT progname
2267 subc
2268 FROM reposrc
2269 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2270 WHERE progname IN rangeprogram
2271 AND cnam IN rangeauthor
2272 AND ( subc = '1' OR subc = 'M' OR subc = 'S' ).
2273
2274 ELSE.
2275 * Select only customer specific programs
2276 SELECT progname
2277 subc
2278 FROM reposrc
2279 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2280 WHERE progname IN rangeprogram
2281 AND ( progname LIKE altcustomernamerange
2282 OR progname LIKE 'Z%'
2283 OR progname LIKE 'Y%'
2284 OR progname LIKE 'SAPMZ%'
2285 OR progname LIKE 'SAPMY%')
2286 AND cnam IN rangeauthor
2287 AND ( subc = '1' OR subc = 'M' OR subc = 'S' ).
2288 ENDIF.
2289 ELSE.
2290
2291 * Programs created by author
2292 IF customerprogsonly IS INITIAL.
2293 * Select all programs
2294 SELECT progname
2295 subc
2296 FROM reposrc
2297 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2298 WHERE progname IN rangeprogram
2299 AND ( subc = '1' OR subc = 'M' OR subc = 'S' )
2300 AND ( cnam IN rangeauthor OR unam IN rangeauthor ).
2301 ELSE.
2302 * Select only customer specific programs
2303 SELECT progname
2304 subc
2305 FROM reposrc
2306 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2307 WHERE progname IN rangeprogram
2308 AND ( progname LIKE altcustomernamerange
2309 OR progname LIKE 'Z%'
2310 OR progname LIKE 'Y%'
2311 OR progname LIKE 'SAPMZ%'
2312 OR progname LIKE 'SAPMY%')
2313 AND ( subc = '1' OR subc = 'M' OR subc = 'S' )
2314 AND ( cnam IN rangeauthor OR unam IN rangeauthor ).
2315 ENDIF.
2316 ENDIF.
2317
2318 * Delete any programs which are local objects
2319 IF getlocalobjects IS INITIAL.
2320 LOOP AT ilocprogram ASSIGNING <waprogram>.
2321 SELECT SINGLE genflag
2322 FROM tadiv
2323 INTO genflag
2324 WHERE pgmid = 'R3TR'
2325 AND object = 'PROG'
2326 AND obj_name = <waprogram>-progname
2327 AND devclass = '$TMP'.
2328 IF sy-subrc = 0.
2329 DELETE ilocprogram.
2330 ENDIF.
2331 ENDLOOP.
2332 ENDIF.
2333
2334 * Delete any programs which are not in the specified package
2335 IF NOT package IS INITIAL.
2336 IF package CS '*'.
2337 TRANSLATE package USING '*%'.
2338 ENDIF.
2339
2340 LOOP AT ilocprogram ASSIGNING <waprogram>.
2341 SELECT SINGLE genflag
2342 FROM tadiv
2343 INTO genflag
2344 WHERE pgmid = 'R3TR'
2345 AND object = 'PROG'
2346 AND obj_name = <waprogram>-progname
2347 AND devclass LIKE package.
2348 IF sy-subrc <> 0.
2349 DELETE ilocprogram.
2350 ENDIF.
2351 ENDLOOP.
2352 ENDIF.
2353 ENDFORM. "findAllProgramsForAuthor
2354
2355 *-------------------------------------------------------------------------------------------------------
2356 * checkProgramDoesExist...
2357 *-------------------------------------------------------------------------------------------------------
2358 FORM checkprogramdoesexist USING ilocprogram LIKE iprograms[]
2359 rangeprogram LIKE soprogramname[].
2360
2361 DATA: waprogram TYPE tprogram.
2362
2363 * Check to see if the program is an executable program
2364 SELECT SINGLE progname
2365 subc
2366 INTO (waprogram-progname, waprogram-subc)
2367 FROM reposrc
2368 WHERE progname IN rangeprogram
2369 AND ( subc = '1' OR
2370 subc = 'I' OR
2371 subc = 'M' OR
2372 subc = 'S' ).
2373
2374 IF NOT waprogram-progname IS INITIAL.
2375 APPEND waprogram TO ilocprogram.
2376 ENDIF.
2377 ENDFORM. "checkProgramDoesExist
2378
2379 *-------------------------------------------------------------------------------------------------------
2380 * findProgramsByWildcard.. Search in the system for programs
2381 *-------------------------------------------------------------------------------------------------------
2382 FORM findprogramsbywildcard USING ilocprogram LIKE iprograms[]
2383 VALUE(rangeprogram) LIKE soprogramname[]
2384 VALUE(rangeauthor) LIKE soauthor[]
2385 VALUE(custnamerange)
2386 VALUE(customerprogsonly)
2387 VALUE(getlocalobjects)
2388 VALUE(package).
2389
2390 DATA: altcustomernamerange TYPE string.
2391 FIELD-SYMBOLS: <waprogram> TYPE tprogram.
2392 DATA: genflag TYPE genflag.
2393
2394 IF customerprogsonly IS INITIAL.
2395 * build up the customer name range used for select statements
2396 IF custnamerange <> '^'.
2397 CONCATENATE custnamerange '%' INTO altcustomernamerange.
2398
2399 SELECT progname
2400 subc
2401 FROM reposrc
2402 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2403 WHERE progname IN rangeprogram
2404 AND progname LIKE altcustomernamerange
2405 AND ( subc = '1' OR subc = 'M' OR subc = 'S' )
2406 AND ( cnam IN rangeauthor OR unam IN rangeauthor ).
2407 ELSE.
2408 SELECT progname
2409 subc
2410 FROM reposrc
2411 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2412 WHERE progname IN rangeprogram
2413 AND ( subc = '1' OR subc = 'M' OR subc = 'S' )
2414 AND ( cnam IN rangeauthor OR unam IN rangeauthor ).
2415 ENDIF.
2416 ELSE.
2417 * Only customer programs
2418 IF custnamerange <> '^'.
2419 CONCATENATE custnamerange '%' INTO altcustomernamerange.
2420
2421 SELECT progname
2422 subc
2423 FROM reposrc
2424 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2425 WHERE progname IN rangeprogram
2426 AND ( progname LIKE altcustomernamerange
2427 OR progname LIKE 'Z%'
2428 OR progname LIKE 'Y%'
2429 OR progname LIKE 'SAPMZ%'
2430 OR progname LIKE 'SAPMY%')
2431 AND ( subc = '1' OR subc = 'M' OR subc = 'S' )
2432 AND ( cnam IN rangeauthor OR unam IN rangeauthor ).
2433 ELSE.
2434 SELECT progname
2435 subc
2436 FROM reposrc
2437 APPENDING CORRESPONDING FIELDS OF TABLE ilocprogram
2438 WHERE progname IN rangeprogram
2439 AND ( progname LIKE 'Z%'
2440 OR progname LIKE 'Y%'
2441 OR progname LIKE 'SAPMZ%'
2442 OR progname LIKE 'SAPMY%')
2443 AND ( subc = '1' OR subc = 'M' OR subc = 'S' )
2444 AND ( cnam IN rangeauthor OR unam IN rangeauthor ).
2445 ENDIF.
2446 ENDIF.
2447
2448 * Delete any programs which are local objects
2449 IF getlocalobjects IS INITIAL.
2450 LOOP AT ilocprogram ASSIGNING <waprogram>.
2451 SELECT SINGLE genflag
2452 FROM tadiv
2453 INTO genflag
2454 WHERE pgmid = 'R3TR'
2455 AND object = 'PROG'
2456 AND obj_name = <waprogram>-progname
2457 AND devclass = '$TMP'.
2458 IF sy-subrc = 0.
2459 DELETE ilocprogram.
2460 ENDIF.
2461 ENDLOOP.
2462 ENDIF.
2463
2464 * Delete any programs which are not in the specified package
2465 IF NOT package IS INITIAL.
2466 LOOP AT ilocprogram ASSIGNING <waprogram>.
2467 SELECT SINGLE genflag
2468 FROM tadiv
2469 INTO genflag
2470 WHERE pgmid = 'R3TR'
2471 AND object = 'PROG'
2472 AND obj_name = <waprogram>-progname
2473 AND devclass <> package.
2474 IF sy-subrc = 0.
2475 DELETE ilocprogram.
2476 ENDIF.
2477 ENDLOOP.
2478 ENDIF.
2479 ENDFORM. "findProgramsByWildcard
2480
2481 *-------------------------------------------------------------------------------------------------------
2482 * retrieveProgramTexts... Find the text elements and selection texts for a program
2483 *-------------------------------------------------------------------------------------------------------
2484 FORM retrieveprogramtexts USING ilocselectiontexts LIKE dumitexttab[]
2485 iloctextelements LIKE dumitexttab[]
2486 VALUE(programname).
2487
2488 DATA: itexttable TYPE STANDARD TABLE OF ttexttable WITH HEADER LINE.
2489 DATA: watexts TYPE ttexttable.
2490 DATA: castprogramname(50).
2491
2492 MOVE programname TO castprogramname.
2493
2494 READ TEXTPOOL castprogramname INTO itexttable LANGUAGE sy-langu.
2495 DELETE itexttable WHERE key = 'R'.
2496
2497 * Selection texts.
2498 LOOP AT itexttable WHERE id = 'S'.
2499 MOVE itexttable-key TO watexts-key.
2500 MOVE itexttable-entry TO watexts-entry.
2501 APPEND watexts TO ilocselectiontexts.
2502 CLEAR watexts.
2503 ENDLOOP.
2504
2505 * Text elements.
2506 DELETE itexttable WHERE key = 'S'.
2507 LOOP AT itexttable WHERE id = 'I'.
2508 MOVE itexttable-key TO watexts-key.
2509 MOVE itexttable-entry TO watexts-entry.
2510 APPEND watexts TO iloctextelements.
2511 ENDLOOP.
2512 ENDFORM. "retrieveProgramTexts
2513
2514 *-------------------------------------------------------------------------------------------------------
2515 * retrieveGUITitles... Search for any GUI texts
2516 *-------------------------------------------------------------------------------------------------------
2517 FORM retrieveguititles USING ilocguititle LIKE dumiguititle[]
2518 VALUE(programname).
2519
2520 SELECT obj_code
2521 text
2522 FROM d347t
2523 APPENDING CORRESPONDING FIELDS OF TABLE ilocguititle
2524 WHERE progname = programname.
2525 ENDFORM. "retrieveGUITitles
2526
2527 *-------------------------------------------------------------------------------------------------------
2528 * findMainMessageClass... find the message class stated at the top of program.
2529 *-------------------------------------------------------------------------------------------------------
2530 FORM findmainmessageclass USING VALUE(programname)
2531 messageclass.
2532
2533 SELECT SINGLE msgid
2534 FROM trdire INTO messageclass
2535 WHERE report = programname.
2536 ENDFORM. "findMainMessageClass
2537
2538 *-------------------------------------------------------------------------------------------------------
2539 * retrieveClasses... find classes and sub objects from SAP DB
2540 *-------------------------------------------------------------------------------------------------------
2541 FORM retrieveclasses USING ilocclasses LIKE iclasses[]
2542 ilocfunctions LIKE ifunctions[]
2543 rangeclass LIKE soclassname[]
2544 rangeauthor LIKE soauthor[]
2545 VALUE(custnamerange)
2546 VALUE(alsomodifiedbyauthor)
2547 VALUE(customerprogsonly)
2548 VALUE(getmessages)
2549 VALUE(gettextelements)
2550 VALUE(getcustdictstructures)
2551 VALUE(getfunctions)
2552 VALUE(getincludes)
2553 VALUE(recursivefuncsearch)
2554 VALUE(recursiveincludesearch)
2555 VALUE(recursiveclasssearch)
2556 VALUE(language).
2557
2558 DATA: warangeclass LIKE LINE OF rangeclass.
2559
2560 IF rangeclass[] IS INITIAL.
2561 * We are finding all programs by an author
2562 PERFORM findallclassesforauthor USING ilocclasses[]
2563 rangeclass[]
2564 rangeauthor[]
2565 custnamerange
2566 alsomodifiedbyauthor
2567 customerprogsonly
2568 language.
2569 ELSE.
2570 READ TABLE rangeclass INDEX 1 INTO warangeclass.
2571 IF warangeclass-low CS asterix.
2572 PERFORM findclassesbywildcard USING ilocclasses[]
2573 rangeclass[]
2574 rangeauthor[]
2575 custnamerange
2576 customerprogsonly
2577 language.
2578 ELSE.
2579 PERFORM checkclassdoesexist USING ilocclasses[]
2580 rangeclass[].
2581 ENDIF.
2582 ENDIF.
2583
2584 * Find extra items
2585 IF NOT ilocclasses[] IS INITIAL.
2586 PERFORM scanforadditionalclassstuff USING ilocclasses[]
2587 ilocfunctions[]
2588 gettextelements
2589 getmessages
2590 getcustdictstructures
2591 getfunctions
2592 getincludes
2593 customerprogsonly
2594 custnamerange
2595 recursiveincludesearch
2596 recursivefuncsearch
2597 recursiveclasssearch.
2598 ENDIF.
2599 ENDFORM. "retrieveClasses
2600
2601 *-------------------------------------------------------------------------------------------------------
2602 * findAllClassesForAuthor...
2603 *-------------------------------------------------------------------------------------------------------
2604 FORM findallclassesforauthor USING ilocclass LIKE iclasses[]
2605 rangeclass LIKE soclassname[]
2606 rangeauthor LIKE soauthor[]
2607 VALUE(custnamerange)
2608 VALUE(alsomodifiedbyauthor)
2609 VALUE(customerclassesonly)
2610 VALUE(language).
2611
2612 DATA: altcustomernamerange(2).
2613
2614 * build up the customer name range used for select statements
2615 CONCATENATE custnamerange '%' INTO altcustomernamerange.
2616
2617 * select by name and author
2618 IF NOT alsomodifiedbyauthor IS INITIAL.
2619 * Classes modified by author
2620 IF customerclassesonly IS INITIAL.
2621 * Select all classes
2622 SELECT clsname descript msg_id
2623 FROM vseoclass
2624 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2625 WHERE clsname IN rangeclass
2626 AND langu = language
2627 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2628 AND version = '1'
2629 AND ( state = '0' OR state = '1' ).
2630
2631 IF sy-subrc <> 0.
2632 SELECT clsname descript msg_id
2633 FROM vseoclass
2634 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2635 WHERE clsname IN rangeclass
2636 AND langu = language
2637 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2638 AND version = '0'
2639 AND ( state = '0' OR state = '1' ).
2640 ENDIF.
2641 ELSE.
2642 * Select only customer specific classes
2643 SELECT clsname descript msg_id
2644 FROM vseoclass
2645 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2646 WHERE clsname IN rangeclass
2647 AND ( clsname LIKE altcustomernamerange
2648 OR clsname LIKE 'Z%'
2649 OR clsname LIKE 'Y%')
2650 AND langu = language
2651 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2652 AND version = '1'
2653 AND ( state = '0' OR state = '1' ).
2654
2655 IF sy-subrc <> 0.
2656 SELECT clsname descript msg_id
2657 FROM vseoclass
2658 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2659 WHERE clsname IN rangeclass
2660 AND ( clsname LIKE altcustomernamerange
2661 OR clsname LIKE 'Z%'
2662 OR clsname LIKE 'Y%')
2663 AND langu = language
2664 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2665 AND version = '0'
2666 AND ( state = '0' OR state = '1' ).
2667 ENDIF.
2668 ENDIF.
2669 ELSE.
2670 * Programs created by author
2671 IF customerclassesonly IS INITIAL.
2672 * Select all classes
2673 SELECT clsname descript msg_id
2674 FROM vseoclass
2675 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2676 WHERE clsname IN rangeclass
2677 AND langu = language
2678 AND author IN rangeauthor
2679 AND version = '1'
2680 AND ( state = '0' OR state = '1' ).
2681
2682 IF sy-subrc <> 0.
2683 SELECT clsname descript msg_id
2684 FROM vseoclass
2685 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2686 WHERE clsname IN rangeclass
2687 AND langu = language
2688 AND author IN rangeauthor
2689 AND version = '0'
2690 AND ( state = '0' OR state = '1' ).
2691 ENDIF.
2692 ELSE.
2693 * Select only customer specific classes
2694 SELECT clsname descript msg_id
2695 FROM vseoclass
2696 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2697 WHERE clsname IN rangeclass
2698 AND ( clsname LIKE altcustomernamerange
2699 OR clsname LIKE 'Z%'
2700 OR clsname LIKE 'Y%')
2701 AND langu = language
2702 AND author IN rangeauthor
2703 AND version = '1'
2704 AND ( state = '0' OR state = '1' ).
2705
2706 IF sy-subrc <> 0.
2707 SELECT clsname descript msg_id
2708 FROM vseoclass
2709 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2710 WHERE clsname IN rangeclass
2711 AND ( clsname LIKE altcustomernamerange
2712 OR clsname LIKE 'Z%'
2713 OR clsname LIKE 'Y%')
2714 AND langu = language
2715 AND author IN rangeauthor
2716 AND version = '0'
2717 AND ( state = '0' OR state = '1' ).
2718 ENDIF.
2719 ENDIF.
2720 ENDIF.
2721 ENDFORM. "findAllClassesForAuthor
2722
2723 *-------------------------------------------------------------------------------------------------------
2724 * findClassesByWildcard... Find classes using a wildcard search
2725 *-------------------------------------------------------------------------------------------------------
2726 FORM findclassesbywildcard USING ilocclass LIKE iclasses[]
2727 rangeclass LIKE soclassname[]
2728 VALUE(rangeauthor) LIKE soauthor[]
2729 VALUE(custnamerange)
2730 VALUE(customerclassesonly)
2731 VALUE(language).
2732
2733 DATA: altcustomernamerange(2).
2734
2735 IF customerclassesonly IS INITIAL.
2736 * Searching for customer and SAP classes
2737 IF custnamerange <> '^'.
2738 * build up the customer name range used for select statements
2739 CONCATENATE custnamerange '%' INTO altcustomernamerange.
2740
2741 SELECT clsname descript msg_id
2742 FROM vseoclass
2743 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2744 WHERE clsname IN rangeclass
2745 AND clsname LIKE custnamerange
2746 AND langu = language
2747 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2748 AND version = '1'
2749 AND ( state = '0' OR state = '1' ).
2750 IF sy-subrc <> 0.
2751 SELECT clsname descript msg_id
2752 FROM vseoclass
2753 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2754 WHERE clsname IN rangeclass
2755 AND clsname LIKE custnamerange
2756 AND langu = language
2757 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2758 AND version = '0'
2759 AND ( state = '0' OR state = '1' ).
2760 ENDIF.
2761 ELSE.
2762 * Searching using normal name ranges
2763 SELECT clsname descript msg_id
2764 FROM vseoclass
2765 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2766 WHERE clsname IN rangeclass
2767 AND langu = language
2768 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2769 AND version = '1'
2770 AND ( state = '0' OR state = '1' ).
2771 IF sy-subrc <> 0.
2772 SELECT clsname descript msg_id
2773 FROM vseoclass
2774 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2775 WHERE clsname IN rangeclass
2776 AND langu = language
2777 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2778 AND version = '0'
2779 AND ( state = '0' OR state = '1' ).
2780 ENDIF.
2781 ENDIF.
2782 ELSE.
2783 * searching for only customer classes
2784 IF custnamerange <> '^'.
2785 * build up the customer name range used for select statements
2786 CONCATENATE custnamerange '%' INTO altcustomernamerange.
2787
2788 SELECT clsname descript msg_id
2789 FROM vseoclass
2790 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2791 WHERE clsname IN rangeclass
2792 AND clsname LIKE custnamerange
2793 AND langu = language
2794 AND ( clsname LIKE 'ZC%' OR clsname LIKE 'YC%' )
2795 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2796 AND version = '1'
2797 AND ( state = '0' OR state = '1' ).
2798 IF sy-subrc <> 0.
2799 SELECT clsname descript msg_id
2800 FROM vseoclass
2801 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2802 WHERE clsname IN rangeclass
2803 AND langu = language
2804 AND ( clsname LIKE 'ZC%' OR clsname LIKE 'YC%' )
2805 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2806 AND version = '0'
2807 AND ( state = '0' OR state = '1' ).
2808 ENDIF.
2809 ELSE.
2810 * Searching using normal name ranges
2811 SELECT clsname descript msg_id
2812 FROM vseoclass
2813 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2814 WHERE clsname IN rangeclass
2815 AND ( clsname LIKE 'ZC%' OR clsname LIKE 'YC%' )
2816 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2817 AND version = '1'
2818 AND ( state = '0' OR state = '1' ).
2819 IF sy-subrc <> 0.
2820 SELECT clsname descript msg_id
2821 FROM vseoclass
2822 APPENDING CORRESPONDING FIELDS OF TABLE ilocclass
2823 WHERE clsname IN rangeclass
2824 AND ( clsname LIKE 'ZC%' OR clsname LIKE 'YC%' )
2825 AND ( author IN rangeauthor OR changedby IN rangeauthor )
2826 AND version = '0'
2827 AND ( state = '0' OR state = '1' ).
2828 ENDIF.
2829 ENDIF.
2830 ENDIF.
2831 ENDFORM. "findClassesByWildcard
2832
2833 *-------------------------------------------------------------------------------------------------------
2834 * checkClassDoesExist...
2835 *-------------------------------------------------------------------------------------------------------
2836 FORM checkclassdoesexist USING ilocclass LIKE iclasses[]
2837 rangeclass LIKE soclassname[].
2838
2839 DATA: waclass TYPE tclass.
2840
2841 SELECT SINGLE clsname descript msg_id
2842 FROM vseoclass
2843 INTO CORRESPONDING FIELDS OF waclass
2844 WHERE clsname IN rangeclass
2845 AND version = '1'
2846 AND ( state = '0' OR state = '1' ).
2847
2848 IF sy-subrc <> 0.
2849 SELECT SINGLE clsname descript msg_id
2850 FROM vseoclass
2851 INTO CORRESPONDING FIELDS OF waclass
2852 WHERE clsname IN rangeclass
2853 AND version = '0'
2854 AND ( state = '0' OR state = '1' ).
2855 ENDIF.
2856
2857 IF NOT waclass-clsname IS INITIAL.
2858 APPEND waclass TO ilocclass.
2859 ENDIF.
2860 ENDFORM. "checkClassDoesExist
2861
2862 *-------------------------------------------------------------------------------------------------------
2863 * scanForAdditionalClassStuff...
2864 *-------------------------------------------------------------------------------------------------------
2865 FORM scanforadditionalclassstuff USING ilocclasses LIKE iclasses[]
2866 ilocfunctions LIKE ifunctions[]
2867 VALUE(gettextelements)
2868 VALUE(getmessages)
2869 VALUE(getcustdictstructures)
2870 VALUE(getfunctions)
2871 VALUE(getincludes)
2872 VALUE(customeronly)
2873 VALUE(customernamerange)
2874 VALUE(recursiveincludesearch)
2875 VALUE(recursivefuncsearch)
2876 VALUE(recursiveclasssearch).
2877
2878 DATA: waclass TYPE tclass.
2879 DATA: wamethod TYPE tmethod.
2880 DATA: mytabix TYPE sytabix.
2881 DATA: scanningforclasses TYPE i VALUE false.
2882 DATA: classnewlines TYPE i VALUE 0.
2883 DATA: classcurrentlines TYPE i VALUE 0.
2884
2885 LOOP AT ilocclasses INTO waclass WHERE scanned IS INITIAL.
2886 * Once we have a list of all the classes we need to loop round them an select all the other objects
2887 mytabix = sy-tabix.
2888 PERFORM findclassdetails USING waclass-clsname
2889 waclass
2890 ilocfunctions[]
2891 gettextelements
2892 getmessages
2893 getfunctions
2894 getcustdictstructures
2895 customeronly
2896 customernamerange.
2897
2898 * Set the scanned class so we do not check them again when running recursively.
2899 waclass-scanned = 'X'.
2900 MODIFY ilocclasses FROM waclass INDEX mytabix.
2901 ENDLOOP.
2902
2903 * Now we have all the classes and details we need to find extra classes
2904 IF NOT recursiveclasssearch IS INITIAL.
2905 classcurrentlines = lines( ilocclasses ).
2906 LOOP AT ilocclasses INTO waclass.
2907 * Don't try and find any other details for an exception class
2908 IF ( waclass-clsname NS 'ZCX_' OR waclass-clsname NS 'CX_' ).
2909 * Find any classes defined in the main class definition
2910 PERFORM scanforclasses USING waclass-privateclasskey
2911 waclass-clsname
2912 customeronly
2913 customernamerange
2914 ilocclasses[].
2915
2916 PERFORM scanforclasses USING waclass-publicclasskey
2917 waclass-clsname
2918 customeronly
2919 customernamerange
2920 ilocclasses[].
2921
2922 PERFORM scanforclasses USING waclass-protectedclasskey
2923 waclass-clsname
2924 customeronly
2925 customernamerange
2926 ilocclasses[].
2927
2928 LOOP AT waclass-imethods INTO wamethod.
2929 * Find any classes defined in any of the methods
2930 PERFORM scanforclasses USING wamethod-methodkey
2931 waclass-clsname
2932 customeronly
2933 customernamerange
2934 ilocclasses[].
2935 ENDLOOP.
2936 ENDIF.
2937 ENDLOOP.
2938
2939 * We have a list of all the classes so lets go and find their details
2940 classnewlines = lines( ilocclasses ).
2941 IF classnewlines > classcurrentlines.
2942 PERFORM scanforadditionalclassstuff USING ilocclasses[]
2943 ilocfunctions[]
2944 gettextelements
2945 getmessages
2946 getcustdictstructures
2947 getfunctions
2948 getincludes
2949 customeronly
2950 customernamerange
2951 recursiveincludesearch
2952 recursivefuncsearch
2953 recursiveclasssearch.
2954 ENDIF.
2955 ENDIF.
2956 ENDFORM. "scanForAdditionalClassStuff
2957
2958 *-------------------------------------------------------------------------------------------------------
2959 * findClassDetails...
2960 *-------------------------------------------------------------------------------------------------------
2961 FORM findclassdetails USING VALUE(classname)
2962 waclass TYPE tclass
2963 ilocfunctions LIKE ifunctions[]
2964 VALUE(gettextelements)
2965 VALUE(getmessages)
2966 VALUE(getfunctions)
2967 VALUE(getcustdictstructures)
2968 VALUE(customeronly)
2969 VALUE(customernamerange).
2970
2971 DATA: iemptyselectiontexts TYPE STANDARD TABLE OF ttexttable.
2972 DATA: mytabix TYPE sytabix.
2973 DATA: wamethod TYPE tmethod.
2974
2975 * Build up the keys we will use for finding data
2976 PERFORM buildclasskeys USING waclass.
2977
2978 IF waclass-descript IS INITIAL.
2979 PERFORM findclassdescription USING classname
2980 waclass-descript.
2981 ENDIF.
2982
2983 * Find the class attributes.
2984 SELECT SINGLE exposure msg_id state clsfinal r3release
2985 FROM vseoclass
2986 INTO (waclass-exposure, waclass-msg_id, waclass-state,
2987 waclass-clsfinal, waclass-r3release)
2988 WHERE clsname = waclass-clsname.
2989
2990 * Don't try and find any other details for an exception class
2991 IF ( waclass-clsname CS 'ZCX_' OR waclass-clsname CS 'CX_' ).
2992 * Exception texts
2993 PERFORM findexceptiontexts USING waclass-publicclasskey
2994 waclass-iconcepts[].
2995 waclass-scanned = 'X'.
2996 ELSE.
2997 IF NOT gettextelements IS INITIAL.
2998 * Find the class texts from out of the database.
2999 PERFORM retrieveprogramtexts USING iemptyselectiontexts[]
3000 waclass-itextelements[]
3001 waclass-textelementkey.
3002 ENDIF.
3003
3004 * Find any declared dictionary structures
3005 IF NOT getcustdictstructures IS INITIAL.
3006 PERFORM scanfortables USING waclass-privateclasskey
3007 customeronly
3008 customernamerange
3009 waclass-idictstruct[].
3010
3011 PERFORM scanfortables USING waclass-publicclasskey
3012 customeronly
3013 customernamerange
3014 waclass-idictstruct[].
3015
3016 PERFORM scanfortables USING waclass-protectedclasskey
3017 customeronly
3018 customernamerange
3019 waclass-idictstruct[].
3020
3021 PERFORM scanfortables USING waclass-typesclasskey
3022 customeronly
3023 customernamerange
3024 waclass-idictstruct[].
3025
3026 PERFORM scanforlikeortype USING waclass-privateclasskey
3027 customeronly
3028 customernamerange
3029 waclass-idictstruct[].
3030
3031 PERFORM scanforlikeortype USING waclass-publicclasskey
3032 customeronly
3033 customernamerange
3034 waclass-idictstruct[].
3035
3036 PERFORM scanforlikeortype USING waclass-protectedclasskey
3037 customeronly
3038 customernamerange
3039 waclass-idictstruct[].
3040
3041 PERFORM scanforlikeortype USING waclass-typesclasskey
3042 customeronly
3043 customernamerange
3044 waclass-idictstruct[].
3045 ENDIF.
3046
3047
3048 * Methods
3049 * Find all the methods for this class
3050 PERFORM findclassmethods USING classname
3051 waclass-imethods[].
3052
3053 LOOP AT waclass-imethods[] INTO wamethod.
3054 mytabix = sy-tabix.
3055 * Find individual messages
3056 IF NOT getmessages IS INITIAL.
3057 PERFORM scanformessages USING wamethod-methodkey
3058 waclass-msg_id
3059 waclass-imessages[].
3060 ENDIF.
3061
3062 IF NOT getcustdictstructures IS INITIAL.
3063 * Find any declared dictionary structures
3064 PERFORM scanfortables USING wamethod-methodkey
3065 customeronly
3066 customernamerange
3067 waclass-idictstruct[].
3068
3069 PERFORM scanforlikeortype USING wamethod-methodkey
3070 customeronly
3071 customernamerange
3072 waclass-idictstruct[].
3073 ENDIF.
3074
3075 IF NOT getfunctions IS INITIAL.
3076 PERFORM scanforfunctions USING wamethod-methodkey
3077 waclass-clsname
3078 space
3079 space
3080 customeronly
3081 customernamerange
3082 ilocfunctions[].
3083 ENDIF.
3084
3085 MODIFY waclass-imethods FROM wamethod INDEX mytabix.
3086 ENDLOOP.
3087 ENDIF.
3088 ENDFORM. "findClassDetails
3089
3090 *-------------------------------------------------------------------------------------------------------
3091 * buildClassKeys... Finds the title text of a class.
3092 *-------------------------------------------------------------------------------------------------------
3093 FORM buildclasskeys USING waclass TYPE tclass.
3094
3095 DATA: classnamelength TYPE i.
3096 DATA: loops TYPE i.
3097
3098 classnamelength = strlen( waclass-clsname ).
3099
3100 cl_oo_classname_service=>get_pubsec_name( EXPORTING clsname = waclass-clsname
3101 RECEIVING result = waclass-publicclasskey ).
3102
3103 cl_oo_classname_service=>get_prisec_name( EXPORTING clsname = waclass-clsname
3104 RECEIVING result = waclass-privateclasskey ).
3105
3106 cl_oo_classname_service=>get_prosec_name( EXPORTING clsname = waclass-clsname
3107 RECEIVING result = waclass-protectedclasskey ).
3108
3109
3110 * Text element key - length of text element key has to be 32 characters.
3111 loops = 30 - classnamelength.
3112 waclass-textelementkey = waclass-clsname.
3113 DO loops TIMES.
3114 CONCATENATE waclass-textelementkey '=' INTO waclass-textelementkey.
3115 ENDDO.
3116 * Save this for later.
3117 CONCATENATE waclass-textelementkey 'CP' INTO waclass-textelementkey.
3118
3119 * Types Class key - length of class name has to be 32 characters.
3120 loops = 30 - classnamelength.
3121 waclass-typesclasskey = waclass-clsname.
3122 DO loops TIMES.
3123 CONCATENATE waclass-typesclasskey '=' INTO waclass-typesclasskey.
3124 ENDDO.
3125 * Save this for later
3126 CONCATENATE waclass-typesclasskey 'CT' INTO waclass-typesclasskey.
3127 ENDFORM. "buildClassKeys
3128
3129 *-------------------------------------------------------------------------------------------------------
3130 * findClassDescription... Finds the title text of a class.
3131 *-------------------------------------------------------------------------------------------------------
3132 FORM findclassdescription USING VALUE(classname)
3133 titletext.
3134
3135 SELECT SINGLE descript
3136 FROM vseoclass
3137 INTO titletext
3138 WHERE clsname = classname
3139 AND langu = sy-langu.
3140 IF sy-subrc <> 0.
3141 SELECT SINGLE descript
3142 FROM vseoclass
3143 INTO titletext
3144 WHERE clsname = classname.
3145 ENDIF.
3146 ENDFORM. "findClassDescription
3147
3148 *-------------------------------------------------------------------------------------------------------
3149 * findExceptionTexts... Fiond the texts of an exception class.
3150 *-------------------------------------------------------------------------------------------------------
3151 FORM findexceptiontexts USING publicclasskey
3152 iconcepts LIKE dumiconcepts[].
3153
3154 DATA: castclassname TYPE program.
3155 DATA: itemplines TYPE STANDARD TABLE OF string WITH HEADER LINE.
3156 DATA: itokens TYPE STANDARD TABLE OF stokes WITH HEADER LINE.
3157 DATA: ikeywords TYPE STANDARD TABLE OF text20 WITH HEADER LINE.
3158 DATA: istatements TYPE STANDARD TABLE OF sstmnt WITH HEADER LINE.
3159 DATA: watokens TYPE stokes.
3160 DATA: wacurrenttoken TYPE stokes.
3161 DATA: waconcept LIKE LINE OF iconcepts.
3162 DATA: tokenlength TYPE i.
3163 DATA: myrow TYPE i.
3164
3165 castclassname = publicclasskey.
3166 READ REPORT castclassname INTO itemplines.
3167
3168 APPEND 'CONSTANTS' TO ikeywords.
3169 SCAN ABAP-SOURCE itemplines TOKENS INTO itokens STATEMENTS INTO istatements KEYWORDS FROM ikeywords.
3170
3171 DELETE itokens WHERE str = 'CONSTANTS'.
3172 DELETE itokens WHERE str = 'VALUE'.
3173 DELETE itokens WHERE str = 'TYPE'.
3174
3175 LOOP AT itokens INTO watokens WHERE str = 'SOTR_CONC'.
3176 * The loop before holds the constant name
3177 myrow = sy-tabix - 1.
3178 READ TABLE itokens INDEX myrow INTO wacurrenttoken.
3179 waconcept-constname = wacurrenttoken-str.
3180
3181 * The loop after holds the constant name
3182 myrow = myrow + 2.
3183 READ TABLE itokens INDEX myrow INTO wacurrenttoken.
3184 tokenlength = strlen( wacurrenttoken-str ).
3185 IF tokenlength = 34.
3186 * Most likely an exception text.
3187 REPLACE ALL OCCURRENCES OF '''' IN wacurrenttoken-str WITH ' ' .
3188 waconcept-concept = wacurrenttoken-str.
3189 APPEND waconcept TO iconcepts.
3190 ENDIF.
3191 ENDLOOP.
3192 ENDFORM. "findExceptionTexts
3193
3194 *-------------------------------------------------------------------------------------------------------
3195 * findClassMethods... Finds the methods of a class.
3196 *-------------------------------------------------------------------------------------------------------
3197 FORM findclassmethods USING VALUE(classname)
3198 ilocmethods LIKE dumimethods[].
3199
3200 DATA: imethods TYPE STANDARD TABLE OF tmethod WITH HEADER LINE.
3201
3202 SELECT cmpname descript exposure
3203 FROM vseomethod
3204 INTO CORRESPONDING FIELDS OF TABLE imethods
3205 WHERE clsname = classname
3206 AND version = '1'
3207 AND langu = sy-langu
3208 AND ( state = '0' OR state = '1' ).
3209
3210 IF sy-subrc <> 0.
3211 SELECT cmpname descript exposure
3212 FROM vseomethod
3213 INTO CORRESPONDING FIELDS OF TABLE imethods
3214 WHERE clsname = classname
3215 AND version = '0'
3216 AND langu = sy-langu
3217 AND ( state = '0' OR state = '1' ).
3218 ENDIF.
3219
3220 * Find the method key so that we can acces the source code later
3221 LOOP AT imethods.
3222 PERFORM findmethodkey USING classname
3223 imethods-cmpname
3224 imethods-methodkey.
3225 MODIFY imethods.
3226 ENDLOOP.
3227
3228 ilocmethods[] = imethods[].
3229 ENDFORM. "findClassMethods
3230
3231 *-------------------------------------------------------------------------------------------------------
3232 * findMethodKey... find the unique key which identifes this method
3233 *-------------------------------------------------------------------------------------------------------
3234 FORM findmethodkey USING VALUE(classname)
3235 VALUE(methodname)
3236 methodkey.
3237
3238 DATA: methodid TYPE seocpdkey.
3239 DATA: locmethodkey TYPE program.
3240
3241 methodid-clsname = classname.
3242 methodid-cpdname = methodname.
3243
3244 cl_oo_classname_service=>get_method_include( EXPORTING mtdkey = methodid
3245 RECEIVING result = locmethodkey
3246 EXCEPTIONS class_not_existing = 1
3247 method_not_existing = 2 ).
3248
3249 methodkey = locmethodkey.
3250 ENDFORM. "findMethodKey
3251
3252 *-------------------------------------------------------------------------------------------------------
3253 * scanForMessages... Search each program for messages
3254 *-------------------------------------------------------------------------------------------------------
3255 FORM scanformessages USING VALUE(programname)
3256 VALUE(mainmessageclass)
3257 ilocmessages LIKE imessages[].
3258
3259 DATA: iincludelines TYPE STANDARD TABLE OF string WITH HEADER LINE.
3260 DATA: itokens TYPE STANDARD TABLE OF stokes WITH HEADER LINE.
3261 DATA: istatements TYPE STANDARD TABLE OF sstmnt WITH HEADER LINE.
3262 DATA: ikeywords TYPE STANDARD TABLE OF text20 WITH HEADER LINE.
3263 DATA: wamessage TYPE tmessage.
3264 DATA: wamessagecomparison TYPE tmessage.
3265 DATA: watokens TYPE stokes.
3266 DATA: nextline TYPE i.
3267 DATA: stringlength TYPE i VALUE 0.
3268 DATA: workingonmessage TYPE i VALUE false.
3269 DATA: castprogramname TYPE program.
3270
3271 * Read the program code from the textpool.
3272 castprogramname = programname.
3273 READ REPORT castprogramname INTO iincludelines.
3274
3275 APPEND message TO ikeywords.
3276 SCAN ABAP-SOURCE iincludelines TOKENS INTO itokens WITH INCLUDES STATEMENTS INTO istatements KEYWORDS FROM ikeywords.
3277
3278 CLEAR iincludelines[].
3279
3280 LOOP AT itokens.
3281 IF itokens-str = message.
3282 workingonmessage = true.
3283 CONTINUE.
3284 ENDIF.
3285
3286 IF workingonmessage = true.
3287 stringlength = strlen( itokens-str ).
3288
3289 * Message declaration 1
3290 IF stringlength = 4 AND itokens-str+0(1) CA sy-abcde.
3291 wamessage-msgnr = itokens-str+1(3).
3292 wamessage-arbgb = mainmessageclass.
3293 ELSE.
3294 IF itokens-str CS '''' OR itokens-str CS '`'.
3295 * Message declaration 2
3296 TRANSLATE itokens-str USING ''' '.
3297 TRANSLATE itokens-str USING '` '.
3298 CONDENSE itokens-str.
3299 SHIFT itokens-str LEFT DELETING LEADING space.
3300 wamessage-text = itokens-str.
3301 wamessage-arbgb = 'Hard coded'.
3302 ELSE.
3303 IF itokens-str = 'ID'.
3304 * Message declaration 3
3305 nextline = sy-tabix + 1.
3306 READ TABLE itokens INDEX nextline INTO watokens.
3307 TRANSLATE watokens-str USING ''' '.
3308 CONDENSE itokens-str.
3309 SHIFT watokens-str LEFT DELETING LEADING space.
3310 IF NOT watokens-str = 'SY-MSGID'.
3311 wamessage-arbgb = watokens-str.
3312
3313 nextline = nextline + 4.
3314 READ TABLE itokens INDEX nextline INTO watokens.
3315 TRANSLATE watokens-str USING ''' '.
3316 CONDENSE watokens-str.
3317 SHIFT watokens-str LEFT DELETING LEADING space.
3318 wamessage-msgnr = watokens-str.
3319 ELSE.
3320 workingonmessage = false.
3321 ENDIF.
3322 ELSE.
3323 IF stringlength >= 5 AND itokens-str+4(1) = '('.
3324 * Message declaration 4
3325 wamessage-msgnr = itokens-str+1(3).
3326 SHIFT itokens-str LEFT UP TO '('.
3327 REPLACE '(' INTO itokens-str WITH space.
3328 REPLACE ')' INTO itokens-str WITH space.
3329 CONDENSE itokens-str.
3330 wamessage-arbgb = itokens-str.
3331 ENDIF.
3332 ENDIF.
3333 ENDIF.
3334 ENDIF.
3335
3336 * find the message text
3337 IF NOT wamessage-arbgb IS INITIAL AND NOT wamessage-msgnr IS INITIAL AND wamessage-text IS INITIAL.
3338 SELECT SINGLE text
3339 FROM t100
3340 INTO wamessage-text
3341 WHERE sprsl = sy-langu
3342 AND arbgb = wamessage-arbgb
3343 AND msgnr = wamessage-msgnr.
3344 ENDIF.
3345
3346 * Append the message
3347 IF NOT wamessage IS INITIAL.
3348 * Don't append the message if we already have it listed
3349 READ TABLE ilocmessages WITH KEY arbgb = wamessage-arbgb
3350 msgnr = wamessage-msgnr
3351 INTO wamessagecomparison.
3352 IF sy-subrc <> 0.
3353 APPEND wamessage TO ilocmessages.
3354 ENDIF.
3355 CLEAR wamessage.
3356 workingonmessage = false.
3357 ENDIF.
3358 ENDIF.
3359 ENDLOOP.
3360 ENDFORM. "scanForMessages
3361
3362 *-------------------------------------------------------------------------------------------------------
3363 * scanForTables... Search each program for dictionary tables
3364 *-------------------------------------------------------------------------------------------------------
3365 FORM scanfortables USING VALUE(programname)
3366 VALUE(customeronly)
3367 VALUE(customernamerange)
3368 ilocdictionary LIKE idictionary[].
3369
3370 DATA: iincludelines TYPE STANDARD TABLE OF string WITH HEADER LINE.
3371 DATA: itokens TYPE STANDARD TABLE OF stokes WITH HEADER LINE.
3372 DATA: istatements TYPE STANDARD TABLE OF sstmnt WITH HEADER LINE.
3373 DATA: ikeywords TYPE STANDARD TABLE OF text20 WITH HEADER LINE.
3374 DATA: wadictionary TYPE tdicttable.
3375 DATA: wadictionarycomparison TYPE tdicttable.
3376 DATA: castprogramname TYPE program.
3377
3378 * Read the program code from the textpool.
3379 castprogramname = programname.
3380 READ REPORT castprogramname INTO iincludelines.
3381
3382 APPEND tables TO ikeywords.
3383
3384 SCAN ABAP-SOURCE iincludelines TOKENS INTO itokens WITH INCLUDES STATEMENTS INTO istatements KEYWORDS FROM ikeywords.
3385 CLEAR iincludelines[].
3386
3387 SORT itokens ASCENDING BY str.
3388 DELETE itokens WHERE str = tables.
3389
3390 LOOP AT itokens.
3391 IF NOT customeronly IS INITIAL.
3392 TRY.
3393 IF ( itokens-str+0(1) <> 'Y' OR itokens-str+0(1) <> 'Z' OR itokens-str NS customernamerange ).
3394 CONTINUE.
3395 ENDIF.
3396 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
3397 ENDTRY.
3398 ENDIF.
3399
3400 wadictionary-tablename = itokens-str.
3401 * Don't append the object if we already have it listed
3402 READ TABLE ilocdictionary INTO wadictionarycomparison WITH KEY tablename = wadictionary-tablename.
3403 IF sy-subrc <> 0.
3404 PERFORM findtabledescription USING wadictionary-tablename
3405 wadictionary-tabletitle.
3406
3407 PERFORM findtabledefinition USING wadictionary-tablename
3408 wadictionary-istructure[].
3409
3410 APPEND wadictionary TO ilocdictionary.
3411 ENDIF.
3412 ENDLOOP.
3413 ENDFORM. "scanForTables
3414
3415 *-------------------------------------------------------------------------------------------------------
3416 * findProgramScreenFlow...
3417 *-------------------------------------------------------------------------------------------------------
3418 FORM findprogramscreenflow USING waprogram TYPE tprogram.
3419
3420 DATA: iflow TYPE STANDARD TABLE OF tscreenflow WITH HEADER LINE.
3421
3422 CALL FUNCTION 'DYNPRO_PROCESSINGLOGIC'
3423 EXPORTING
3424 rep_name = waprogram-progname
3425 TABLES
3426 scr_logic = iflow.
3427
3428 SORT iflow ASCENDING BY screen.
3429 DELETE ADJACENT DUPLICATES FROM iflow COMPARING screen.
3430 IF waprogram-subc <> 'M'.
3431 DELETE iflow WHERE screen >= '1000' AND screen <= '1099'.
3432 ENDIF.
3433
3434 LOOP AT iflow.
3435 APPEND iflow TO waprogram-iscreenflow.
3436 ENDLOOP.
3437 ENDFORM. "findProgramScreenFlow
3438
3439 *-------------------------------------------------------------------------------------------------------
3440 * findFunctionScreenFlow...
3441 *-------------------------------------------------------------------------------------------------------
3442 FORM findfunctionscreenflow USING wafunction TYPE tfunction.
3443
3444 DATA: iflow TYPE STANDARD TABLE OF tscreenflow WITH HEADER LINE.
3445
3446 CALL FUNCTION 'DYNPRO_PROCESSINGLOGIC'
3447 EXPORTING
3448 rep_name = wafunction-progname
3449 TABLES
3450 scr_logic = iflow.
3451
3452 SORT iflow ASCENDING BY screen.
3453 DELETE ADJACENT DUPLICATES FROM iflow COMPARING screen.
3454
3455 LOOP AT iflow.
3456 APPEND iflow TO wafunction-iscreenflow.
3457 ENDLOOP.
3458 ENDFORM. "findFunctionScreenFlow
3459
3460 *-------------------------------------------------------------------------------------------------------
3461 * scanForLikeOrType... Look for any dictionary objects referenced by a like or type statement
3462 *-------------------------------------------------------------------------------------------------------
3463 FORM scanforlikeortype USING VALUE(programname)
3464 VALUE(customeronly)
3465 VALUE(customernamerange)
3466 ilocdictionary LIKE idictionary[].
3467
3468 DATA ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
3469 DATA: head TYPE string.
3470 DATA: tail TYPE string.
3471 DATA: junk TYPE string.
3472 DATA: linetype TYPE string.
3473 DATA: linelength TYPE i VALUE 0.
3474 DATA: endofline TYPE i VALUE true.
3475 DATA: wadictionary TYPE tdicttable.
3476 DATA: wadictionarycomparison TYPE tdicttable.
3477 DATA: waline TYPE string.
3478 DATA: castprogramname TYPE program.
3479
3480 * Read the program code from the textpool.
3481 castprogramname = programname.
3482 READ REPORT castprogramname INTO ilines.
3483
3484 LOOP AT ilines INTO waline.
3485 * Find custom tables.
3486 linelength = strlen( waline ).
3487 IF linelength > 0.
3488 IF waline(1) = asterix.
3489 CONTINUE.
3490 ENDIF.
3491
3492 TRANSLATE waline TO UPPER CASE.
3493
3494 * Determine the lineType.
3495 IF endofline = true.
3496 SHIFT waline UP TO like.
3497 IF sy-subrc = 0.
3498 linetype = like.
3499 ELSE.
3500 SHIFT waline UP TO type.
3501 IF sy-subrc = 0.
3502 FIND 'BEGIN OF' IN waline.
3503 IF sy-subrc <> 0.
3504 FIND 'END OF' IN waline.
3505 IF sy-subrc <> 0.
3506 FIND 'VALUE' IN waline.
3507 IF sy-subrc <> 0.
3508 linetype = type.
3509 ENDIF.
3510 ENDIF.
3511 ENDIF.
3512 ELSE.
3513 SHIFT waline UP TO include.
3514 IF sy-subrc = 0.
3515 SPLIT waline AT space INTO junk ilines.
3516 ENDIF.
3517
3518 SHIFT waline UP TO structure.
3519 IF sy-subrc = 0.
3520 linetype = structure.
3521 ELSE.
3522 CONTINUE.
3523 ENDIF.
3524 ENDIF.
3525 ENDIF.
3526 ELSE.
3527 linetype = comma.
3528 ENDIF.
3529
3530 CASE linetype.
3531 WHEN like OR type OR structure.
3532 * Work on the appropriate lineType
3533 SHIFT waline UP TO space.
3534 SHIFT waline LEFT DELETING LEADING space.
3535 IF waline CS table.
3536 SPLIT waline AT table INTO head tail.
3537 SPLIT tail AT 'OF' INTO head tail.
3538 waline = tail.
3539 SHIFT waline LEFT DELETING LEADING space.
3540 ENDIF.
3541
3542 * Are we only to download SAP dictionary structures.
3543 IF NOT customeronly IS INITIAL.
3544 TRY.
3545 IF waline+0(1) = 'Y' OR waline+0(1) = 'Z' OR waline CS customernamerange.
3546 ELSE.
3547 linetype = ''.
3548 CONTINUE.
3549 ENDIF.
3550 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
3551 ENDTRY.
3552 ENDIF.
3553
3554 IF waline CS comma.
3555 SPLIT waline AT comma INTO head tail.
3556 IF waline CS dash.
3557 SPLIT head AT dash INTO head tail.
3558 ENDIF.
3559 IF waline CS occurs.
3560 SPLIT waline AT space INTO head tail.
3561 ENDIF.
3562 ELSE.
3563 IF waline CS period.
3564 SPLIT waline AT period INTO head tail.
3565 IF waline CS dash.
3566 SPLIT head AT dash INTO head tail.
3567 ENDIF.
3568 IF waline CS occurs.
3569 SPLIT waline AT space INTO head tail.
3570 ENDIF.
3571 ELSE.
3572 SPLIT waline AT space INTO head tail.
3573 IF waline CS dash.
3574 SPLIT head AT dash INTO head tail.
3575 ENDIF.
3576 ENDIF.
3577 ENDIF.
3578
3579 IF NOT head IS INITIAL.
3580 wadictionary-tablename = head.
3581 * Don't append the object if we already have it listed
3582 READ TABLE ilocdictionary INTO wadictionarycomparison
3583 WITH KEY tablename = wadictionary-tablename.
3584 IF sy-subrc <> 0.
3585 PERFORM findtabledescription USING wadictionary-tablename
3586 wadictionary-tabletitle.
3587
3588 PERFORM findtabledefinition USING wadictionary-tablename
3589 wadictionary-istructure[].
3590
3591 * Only append if the item is a table and not a structure or data element
3592 IF NOT wadictionary-istructure[] IS INITIAL.
3593 APPEND wadictionary TO ilocdictionary.
3594 ENDIF.
3595 ENDIF.
3596 CLEAR wadictionary.
3597 ENDIF.
3598
3599 linetype = ''.
3600 ENDCASE.
3601 ENDIF.
3602 ENDLOOP.
3603 ENDFORM. "scanForLikeOrType
3604
3605 *-------------------------------------------------------------------------------------------------------
3606 * displayStatus...
3607 *-------------------------------------------------------------------------------------------------------
3608 FORM displaystatus USING VALUE(message)
3609 VALUE(delay).
3610
3611 CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
3612 EXPORTING
3613 percentage = 0
3614 text = message
3615 EXCEPTIONS
3616 OTHERS = 1.
3617
3618 IF delay > 0.
3619 WAIT UP TO delay SECONDS.
3620 ENDIF.
3621 ENDFORM. "displayStatus
3622
3623 *-------------------------------------------------------------------------------------------------------
3624 * removeLeadingZeros...
3625 *-------------------------------------------------------------------------------------------------------
3626 FORM removeleadingzeros CHANGING myvalue.
3627
3628 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
3629 EXPORTING
3630 input = myvalue
3631 IMPORTING
3632 output = myvalue
3633 EXCEPTIONS
3634 OTHERS = 1.
3635 ENDFORM. "removeLeadingZeros
3636
3637 *-------------------------------------------------------------------------------------------------------
3638 * determineFrontendOPSystem.... Determine the frontend operating system type.
3639 *-------------------------------------------------------------------------------------------------------
3640 FORM determinefrontendopsystem USING separator
3641 operatingsystem.
3642
3643 DATA: platformid TYPE i VALUE 0.
3644
3645 CREATE OBJECT objfile.
3646
3647 CALL METHOD objfile->get_platform
3648 RECEIVING
3649 platform = platformid
3650 EXCEPTIONS
3651 cntl_error = 1
3652 error_no_gui = 2
3653 not_supported_by_gui = 3.
3654 CASE platformid.
3655 WHEN objfile->platform_windows95
3656 OR objfile->platform_windows98
3657 OR objfile->platform_nt351
3658 OR objfile->platform_nt40
3659 OR objfile->platform_nt50
3660 OR objfile->platform_mac
3661 OR objfile->platform_os2
3662 OR 14. "XP
3663 separator = '\'.
3664 operatingsystem = non_unix.
3665 WHEN OTHERS.
3666 separator = '/'.
3667 operatingsystem = unix.
3668 ENDCASE.
3669 ENDFORM. "determineFrontendOpSystem
3670
3671 *-------------------------------------------------------------------------------------------------------
3672 * determineServerOPSystem.... Determine the server operating system type.
3673 *-------------------------------------------------------------------------------------------------------
3674 FORM determineserveropsystem USING separator
3675 serverfilesystem
3676 serveropsystem.
3677
3678 * Find the file system
3679 SELECT SINGLE filesys
3680 FROM opsystem
3681 INTO serverfilesystem
3682 WHERE opsys = sy-opsys.
3683
3684 FIND 'WINDOWS' IN serverfilesystem IGNORING CASE.
3685 IF sy-subrc = 0.
3686 separator = '\'.
3687 serveropsystem = non_unix.
3688 ELSE.
3689 FIND 'DOS' IN serverfilesystem IGNORING CASE.
3690 IF sy-subrc = 0.
3691 separator = '\'.
3692 serveropsystem = non_unix.
3693 ELSE.
3694 separator = '/'.
3695 serveropsystem = unix.
3696 ENDIF.
3697 ENDIF.
3698 ENDFORM. "determineServerOpSystem
3699
3700 *-------------------------------------------------------------------------------------------------------
3701 * findExternalCommand.... Determine if the external command exists. If it doesn't then disable the
3702 * server input field
3703 *-------------------------------------------------------------------------------------------------------
3704 FORM findexternalcommand.
3705
3706 CALL FUNCTION 'SXPG_COMMAND_CHECK'
3707 EXPORTING
3708 commandname = 'ZMKDIR'
3709 operatingsystem = sy-opsys
3710 EXCEPTIONS
3711 command_not_found = 1
3712 OTHERS = 0.
3713
3714 IF sy-subrc <> 0.
3715 LOOP AT SCREEN.
3716 IF screen-name = 'PLOGICAL'.
3717 screen-input = 0.
3718 MODIFY SCREEN.
3719 ENDIF.
3720
3721 IF screen-name = 'PSERV'.
3722 screen-input = 0.
3723 MODIFY SCREEN.
3724 ENDIF.
3725
3726 IF screen-name = 'PPC'.
3727 screen-input = 0.
3728 MODIFY SCREEN.
3729 ENDIF.
3730 ENDLOOP.
3731
3732 MESSAGE s000(oo) WITH 'Download to server disabled,' 'external command ZMKDIR not defined.'.
3733 ENDIF.
3734 ENDFORM. "findExternalCommand
3735
3736 ********************************************************************************************************
3737 *****************************************DOWNLOAD ROUTINES**********************************************
3738 ********************************************************************************************************
3739
3740 *-------------------------------------------------------------------------------------------------------
3741 * downloadDDStructures... download database objects to file
3742 *-------------------------------------------------------------------------------------------------------
3743 FORM downloadddstructures USING ilocdictionary LIKE idictionary[]
3744 VALUE(pathname)
3745 VALUE(htmlfileextension)
3746 VALUE(subdir)
3747 VALUE(sorttablesasc)
3748 VALUE(slashseparator)
3749 VALUE(savetoserver)
3750 VALUE(displayprogressmessage).
3751
3752 FIELD-SYMBOLS: <wadictionary> TYPE tdicttable.
3753 DATA: tablefilename TYPE string.
3754 DATA: tablefilenamewithpath TYPE string.
3755 DATA: ihtmltable TYPE STANDARD TABLE OF string WITH HEADER LINE.
3756 DATA: newsubdirectory TYPE string.
3757 DATA: completesavepath TYPE string.
3758
3759 LOOP AT ilocdictionary ASSIGNING <wadictionary>.
3760 PERFORM buildfilename USING pathname
3761 subdir
3762 <wadictionary>-tablename
3763 space
3764 space
3765 htmlfileextension
3766 is_table
3767 savetoserver
3768 slashseparator
3769 tablefilenamewithpath
3770 tablefilename
3771 newsubdirectory
3772 completesavepath.
3773
3774 * Try and import a converted table to memory as it will be much quicker than converting it again
3775 IMPORT ihtmltable FROM MEMORY ID <wadictionary>-tablename.
3776 IF sy-subrc <> 0.
3777 CONCATENATE 'Converting table' <wadictionary>-tablename 'to html' INTO statusbarmessage SEPARATED BY space.
3778 PERFORM displaystatus USING statusbarmessage 0.
3779
3780 PERFORM convertddtohtml USING <wadictionary>-istructure[]
3781 ihtmltable[]
3782 <wadictionary>-tablename
3783 <wadictionary>-tabletitle
3784 sorttablesasc.
3785
3786 EXPORT ihtmltable TO MEMORY ID <wadictionary>-tablename.
3787 ENDIF.
3788
3789 IF savetoserver IS INITIAL.
3790 PERFORM savefiletopc USING ihtmltable[]
3791 tablefilenamewithpath
3792 tablefilename
3793 space
3794 space
3795 displayprogressmessage.
3796 ELSE.
3797 PERFORM savefiletoserver USING ihtmltable[]
3798 tablefilenamewithpath
3799 tablefilename
3800 completesavepath
3801 displayprogressmessage.
3802 ENDIF.
3803
3804 CLEAR ihtmltable[].
3805 ENDLOOP.
3806 ENDFORM. "downloadDDStructures
3807
3808 *-------------------------------------------------------------------------------------------------------
3809 * downloadMessageClass...
3810 *-------------------------------------------------------------------------------------------------------
3811 FORM downloadmessageclass USING ilocmessages LIKE imessages[]
3812 VALUE(messageclassname)
3813 VALUE(userfilepath)
3814 VALUE(fileextension)
3815 VALUE(htmlfileflag)
3816 subdir
3817 VALUE(syntaxhighlightcomments)
3818 VALUE(customernamerange)
3819 VALUE(getincludes)
3820 VALUE(getdictstructures)
3821 VALUE(userhasselectedmessageclasses)
3822 VALUE(slashseparator)
3823 VALUE(savetoserver)
3824 VALUE(displayprogressmessage).
3825
3826 DATA: htmlpagename TYPE string.
3827 DATA: newfilenameonly TYPE string.
3828 DATA: newfilenamewithpath TYPE string.
3829 DATA: ihtmltable TYPE STANDARD TABLE OF string WITH HEADER LINE.
3830 DATA: newsubdirectory TYPE string.
3831 DATA: completesavepath TYPE string.
3832
3833 PERFORM appendmessagestofile USING ilocmessages[]
3834 ihtmltable[]
3835 userhasselectedmessageclasses.
3836
3837
3838 CONCATENATE `message class ` messageclassname INTO htmlpagename.
3839
3840 IF htmlfileflag IS INITIAL.
3841 APPEND '' TO ihtmltable.
3842 APPEND '----------------------------------------------------------------------------------' TO ihtmltable.
3843
3844 PERFORM buildfootermessage USING 'TEXT'
3845 ihtmltable.
3846 APPEND ihtmltable.
3847 ELSE.
3848 PERFORM convertcodetohtml USING ihtmltable[]
3849 htmlpagename
3850 space
3851 is_messageclass
3852 ''
3853 false
3854 syntaxhighlightcomments
3855 fileextension
3856 customernamerange
3857 getincludes
3858 getdictstructures.
3859 ENDIF.
3860
3861 PERFORM buildfilename USING userfilepath
3862 subdir
3863 messageclassname
3864 space
3865 space
3866 fileextension
3867 is_messageclass
3868 savetoserver
3869 slashseparator
3870 newfilenamewithpath
3871 newfilenameonly
3872 newsubdirectory
3873 completesavepath.
3874
3875 IF savetoserver IS INITIAL.
3876 PERFORM savefiletopc USING ihtmltable[]
3877 newfilenamewithpath
3878 newfilenameonly
3879 space
3880 space
3881 displayprogressmessage.
3882 ELSE.
3883 * Save the file to the SAP server
3884 PERFORM savefiletoserver USING ihtmltable[]
3885 newfilenamewithpath
3886 newfilenameonly
3887 completesavepath
3888 displayprogressmessage.
3889 ENDIF.
3890 ENDFORM. "downloadMessageClass
3891
3892 *-------------------------------------------------------------------------------------------------------
3893 * appendMessagesToFile
3894 *-------------------------------------------------------------------------------------------------------
3895 FORM appendmessagestofile USING ilocmessages LIKE imessages[]
3896 ilochtml LIKE dumihtml[]
3897 VALUE(userhasselectedmessageclasses).
3898
3899 DATA: previousmessageid LIKE imessages-arbgb.
3900 FIELD-SYMBOLS: <wamessage> TYPE tmessage.
3901 DATA: wahtml TYPE string.
3902
3903 SORT ilocmessages ASCENDING BY arbgb msgnr.
3904
3905 IF NOT ilocmessages[] IS INITIAL.
3906 IF userhasselectedmessageclasses IS INITIAL.
3907 * Only add these extra lines if we are actually appending them to the end of some program code
3908 APPEND wahtml TO ilochtml.
3909 APPEND wahtml TO ilochtml.
3910
3911 APPEND '*Messages' TO ilochtml.
3912 APPEND '*----------------------------------------------------------' TO ilochtml.
3913 ENDIF.
3914
3915 LOOP AT ilocmessages ASSIGNING <wamessage>.
3916 IF ( <wamessage>-arbgb <> previousmessageid ).
3917
3918 IF userhasselectedmessageclasses IS INITIAL.
3919 * Only add this extra lines if we are actually appending them to the end of some program code
3920 APPEND '*' TO ilochtml.
3921 CONCATENATE `* Message class: ` <wamessage>-arbgb INTO wahtml.
3922 APPEND wahtml TO ilochtml.
3923 ENDIF.
3924
3925 previousmessageid = <wamessage>-arbgb.
3926 CLEAR wahtml.
3927 ENDIF.
3928
3929 IF userhasselectedmessageclasses IS INITIAL.
3930 * Only add this extra lines if we are actually appending them to the end of some program code
3931 CONCATENATE '*' <wamessage>-msgnr ` ` <wamessage>-text INTO wahtml.
3932 ELSE.
3933 CONCATENATE <wamessage>-msgnr ` ` <wamessage>-text INTO wahtml.
3934 ENDIF.
3935
3936 APPEND wahtml TO ilochtml.
3937 ENDLOOP.
3938 ENDIF.
3939 ENDFORM. "appendMessagesToFile
3940
3941 *-------------------------------------------------------------------------------------------------------
3942 * downloadFunctions... Download function modules to file.
3943 *-------------------------------------------------------------------------------------------------------
3944 FORM downloadfunctions USING ilocfunctions LIKE ifunctions[]
3945 VALUE(userfilepath)
3946 VALUE(fileextension)
3947 VALUE(subdir)
3948 VALUE(downloaddocumentation)
3949 VALUE(converttohtml)
3950 VALUE(syntaxhighlightcomments)
3951 VALUE(customernamerange)
3952 VALUE(getincludes)
3953 VALUE(getdictstruct)
3954 VALUE(textfileextension)
3955 VALUE(htmlfileextension)
3956 VALUE(sorttablesasc)
3957 VALUE(slashseparator)
3958 VALUE(savetoserver)
3959 VALUE(displayprogressmessage).
3960
3961 DATA: mainsubdir TYPE string.
3962 DATA: incsubdir TYPE string.
3963 FIELD-SYMBOLS: <wafunction> TYPE tfunction.
3964 FIELD-SYMBOLS: <wainclude> TYPE tinclude.
3965 DATA: iemptytextelements TYPE STANDARD TABLE OF ttexttable.
3966 DATA: iemptyselectiontexts TYPE STANDARD TABLE OF ttexttable.
3967 DATA: iemptymessages TYPE STANDARD TABLE OF tmessage.
3968 DATA: iemptyguititles TYPE STANDARD TABLE OF tguititle.
3969 DATA: functiondocumentationexists TYPE i VALUE false.
3970
3971 LOOP AT ilocfunctions ASSIGNING <wafunction>.
3972 IF subdir IS INITIAL.
3973 incsubdir = <wafunction>-functionname.
3974 mainsubdir = ''.
3975 ELSE.
3976 CONCATENATE subdir <wafunction>-functionname INTO incsubdir SEPARATED BY slashseparator.
3977 mainsubdir = subdir.
3978 ENDIF.
3979
3980 IF NOT downloaddocumentation IS INITIAL.
3981 PERFORM downloadfunctiondocs USING <wafunction>-functionname
3982 <wafunction>-functiontitle
3983 userfilepath
3984 fileextension
3985 converttohtml
3986 slashseparator
3987 savetoserver
3988 displayprogressmessage
3989 mainsubdir
3990 functiondocumentationexists.
3991 ENDIF.
3992
3993 * Download main source code
3994 PERFORM readfunctionanddownload USING <wafunction>-itextelements[]
3995 <wafunction>-iselectiontexts[]
3996 <wafunction>-imessages[]
3997 <wafunction>-functionname
3998 <wafunction>-functionmaininclude
3999 <wafunction>-functiontitle
4000 userfilepath
4001 fileextension
4002 mainsubdir
4003 converttohtml
4004 functiondocumentationexists
4005 syntaxhighlightcomments
4006 customernamerange
4007 getincludes
4008 getdictstruct
4009 slashseparator
4010 savetoserver
4011 displayprogressmessage.
4012
4013 * Download top include
4014 PERFORM readincludeanddownload USING iemptytextelements[]
4015 iemptyselectiontexts[]
4016 iemptymessages[]
4017 iemptyguititles[]
4018 <wafunction>-topincludename
4019 <wafunction>-functionname
4020 <wafunction>-functiontitle
4021 is_function
4022 userfilepath
4023 fileextension
4024 mainsubdir
4025 converttohtml
4026 syntaxhighlightcomments
4027 customernamerange
4028 getincludes
4029 getdictstruct
4030 slashseparator
4031 savetoserver
4032 displayprogressmessage.
4033
4034 * Download screens.
4035 IF NOT <wafunction>-iscreenflow[] IS INITIAL.
4036 PERFORM downloadscreens USING <wafunction>-iscreenflow[]
4037 <wafunction>-progname
4038 userfilepath
4039 textfileextension
4040 mainsubdir
4041 slashseparator
4042 savetoserver
4043 displayprogressmessage.
4044 ENDIF.
4045
4046 * Download GUI titles
4047 IF NOT <wafunction>-iguititle[] IS INITIAL.
4048 PERFORM downloadguititles USING <wafunction>-iguititle
4049 userfilepath
4050 textfileextension
4051 mainsubdir
4052 slashseparator
4053 savetoserver
4054 displayprogressmessage.
4055 ENDIF.
4056
4057 * Download all other includes
4058 LOOP AT <wafunction>-iincludes ASSIGNING <wainclude>.
4059 PERFORM readincludeanddownload USING iemptytextelements[]
4060 iemptyselectiontexts[]
4061 iemptymessages[]
4062 iemptyguititles[]
4063 <wainclude>-includename
4064 space
4065 <wainclude>-includetitle
4066 is_program
4067 userfilepath
4068 fileextension
4069 incsubdir
4070 converttohtml
4071 syntaxhighlightcomments
4072 customernamerange
4073 getincludes
4074 getdictstruct
4075 slashseparator
4076 savetoserver
4077 displayprogressmessage.
4078
4079 ENDLOOP.
4080
4081 * Download all dictionary structures
4082 IF NOT <wafunction>-idictstruct[] IS INITIAL.
4083 PERFORM downloadddstructures USING <wafunction>-idictstruct[]
4084 userfilepath
4085 htmlfileextension
4086 incsubdir
4087 sorttablesasc
4088 slashseparator
4089 savetoserver
4090 displayprogressmessage.
4091 ENDIF.
4092 ENDLOOP.
4093 ENDFORM. "downloadFunctions
4094
4095 *-------------------------------------------------------------------------------------------------------
4096 * readIcludeAndDownload...
4097 *-------------------------------------------------------------------------------------------------------
4098 FORM readincludeanddownload USING iloctextelements LIKE dumitexttab[]
4099 ilocselectiontexts LIKE dumitexttab[]
4100 ilocmessages LIKE imessages[]
4101 ilocguititles LIKE dumiguititle[]
4102 VALUE(programname)
4103 VALUE(functionname)
4104 VALUE(shorttext)
4105 VALUE(overideprogtype)
4106 VALUE(userfilepath)
4107 VALUE(fileextension)
4108 VALUE(additionalsubdir)
4109 VALUE(converttohtml)
4110 VALUE(syntaxhighlightcomments)
4111 VALUE(customernamerange)
4112 VALUE(getincludes)
4113 VALUE(getdictstructures)
4114 VALUE(slashseparator)
4115 VALUE(savetoserver)
4116 VALUE(displayprogressmessage).
4117
4118 DATA: ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
4119 DATA: localfilenamewithpath TYPE string.
4120 DATA: localfilenameonly TYPE string.
4121 DATA: newsubdirectory TYPE string.
4122 DATA: objectname TYPE string.
4123 DATA: completesavepath TYPE string.
4124
4125 READ REPORT programname INTO ilines.
4126
4127 * Download GUI titles for main program
4128 IF NOT ilocguititles[] IS INITIAL.
4129 PERFORM appendguititles USING ilocguititles[]
4130 ilines[].
4131 ENDIF.
4132
4133 * Download text elements for main program
4134 IF NOT iloctextelements[] IS INITIAL.
4135 PERFORM appendtextelements USING iloctextelements[]
4136 ilines[].
4137 ENDIF.
4138
4139 * Download selection texts for main program
4140 IF NOT ilocselectiontexts[] IS INITIAL.
4141 PERFORM appendselectiontexts USING ilocselectiontexts[]
4142 ilines[].
4143 ENDIF.
4144
4145 * Download messages classes for main program.
4146 IF NOT ilocmessages[] IS INITIAL.
4147 PERFORM appendmessagestofile USING ilocmessages[]
4148 ilines[]
4149 space.
4150 ENDIF.
4151
4152 IF converttohtml IS INITIAL.
4153 APPEND '' TO ilines.
4154 APPEND '----------------------------------------------------------------------------------' TO ilines.
4155 PERFORM buildfootermessage USING 'TEXT'
4156 ilines.
4157 APPEND ilines.
4158 ELSE.
4159 PERFORM convertcodetohtml USING ilines[]
4160 programname
4161 shorttext
4162 overideprogtype
4163 space
4164 space
4165 syntaxhighlightcomments
4166 fileextension
4167 customernamerange
4168 getincludes
4169 getdictstructures.
4170 ENDIF.
4171
4172 IF functionname IS INITIAL.
4173 objectname = programname.
4174 ELSE.
4175 objectname = functionname.
4176 ENDIF.
4177
4178 PERFORM buildfilename USING userfilepath
4179 additionalsubdir
4180 objectname
4181 space
4182 programname
4183 fileextension
4184 overideprogtype
4185 savetoserver
4186 slashseparator
4187 localfilenamewithpath
4188 localfilenameonly
4189 newsubdirectory
4190 completesavepath.
4191
4192 IF savetoserver IS INITIAL.
4193 PERFORM savefiletopc USING ilines[]
4194 localfilenamewithpath
4195 localfilenameonly
4196 space
4197 space
4198 displayprogressmessage.
4199 ELSE.
4200 PERFORM savefiletoserver USING ilines[]
4201 localfilenamewithpath
4202 localfilenameonly
4203 completesavepath
4204 displayprogressmessage.
4205 ENDIF.
4206 ENDFORM. "readIncludeAndDownload
4207
4208 *-------------------------------------------------------------------------------------------------------
4209 * readClassAndDownload...
4210 *-------------------------------------------------------------------------------------------------------
4211 FORM readclassanddownload USING walocclass TYPE tclass
4212 VALUE(classname)
4213 VALUE(functionname)
4214 VALUE(overideprogtype)
4215 VALUE(userfilepath)
4216 VALUE(fileextension)
4217 VALUE(additionalsubdir)
4218 VALUE(converttohtml)
4219 VALUE(syntaxhighlightcomments)
4220 VALUE(customernamerange)
4221 VALUE(getincludes)
4222 VALUE(getdictstructures)
4223 VALUE(slashseparator)
4224 VALUE(savetoserver)
4225 VALUE(displayprogressmessage).
4226
4227 DATA: itemplines TYPE STANDARD TABLE OF string WITH HEADER LINE.
4228 DATA: ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
4229 DATA: localfilenamewithpath TYPE string.
4230 DATA: localfilenameonly TYPE string.
4231 DATA: newsubdirectory TYPE string.
4232 DATA: objectname TYPE string.
4233 DATA: castclassname TYPE program.
4234 DATA: completesavepath TYPE string.
4235
4236 * Build up attribute comments
4237 APPEND '**************************************************************************' TO ilines.
4238 APPEND '* Class attributes. *' TO ilines.
4239 APPEND '**************************************************************************' TO ilines.
4240 CASE walocclass-exposure.
4241 WHEN 0.
4242 APPEND `Instantiation: Private` TO ilines.
4243 WHEN 1.
4244 APPEND `Instantiation: Protected` TO ilines.
4245 WHEN 2.
4246 APPEND `Instantiation: Public` TO ilines.
4247 ENDCASE.
4248 CONCATENATE `Message class: ` walocclass-msg_id INTO ilines.
4249 APPEND ilines.
4250 CASE walocclass-state.
4251 WHEN 0.
4252 APPEND `State: Only Modelled` TO ilines.
4253 WHEN 1.
4254 APPEND `State: Implemented` TO ilines.
4255 ENDCASE.
4256 CONCATENATE `Final Indicator: ` walocclass-clsfinal INTO ilines.
4257 APPEND ilines.
4258 CONCATENATE `R/3 Release: ` walocclass-r3release INTO ilines.
4259 APPEND ilines.
4260 CLEAR ilines.
4261 APPEND ilines.
4262
4263 castclassname = walocclass-publicclasskey.
4264 READ REPORT castclassname INTO itemplines.
4265 IF sy-subrc = 0.
4266 PERFORM reformatclasscode USING itemplines[].
4267
4268 APPEND '**************************************************************************' TO ilines.
4269 APPEND '* Public section of class. *' TO ilines.
4270 APPEND '**************************************************************************' TO ilines.
4271 LOOP AT itemplines.
4272 APPEND itemplines TO ilines.
4273 ENDLOOP.
4274 ENDIF.
4275
4276 castclassname = walocclass-privateclasskey.
4277 READ REPORT castclassname INTO itemplines.
4278 IF sy-subrc = 0.
4279 PERFORM reformatclasscode USING itemplines[].
4280
4281 APPEND ilines.
4282 APPEND '**************************************************************************' TO ilines.
4283 APPEND '* Private section of class. *' TO ilines.
4284 APPEND '**************************************************************************' TO ilines.
4285 LOOP AT itemplines.
4286 APPEND itemplines TO ilines.
4287 ENDLOOP.
4288 ENDIF.
4289
4290 castclassname = walocclass-protectedclasskey.
4291 READ REPORT castclassname INTO itemplines.
4292 IF sy-subrc = 0.
4293 PERFORM reformatclasscode USING itemplines[].
4294
4295 APPEND ilines.
4296 APPEND '**************************************************************************' TO ilines.
4297 APPEND '* Protected section of class. *' TO ilines.
4298 APPEND '**************************************************************************' TO ilines.
4299 LOOP AT itemplines.
4300 APPEND itemplines TO ilines.
4301 ENDLOOP.
4302 ENDIF.
4303
4304 castclassname = walocclass-typesclasskey.
4305 READ REPORT castclassname INTO itemplines.
4306 IF sy-subrc = 0.
4307 APPEND ilines.
4308 APPEND '**************************************************************************' TO ilines.
4309 APPEND '* Types section of class. *' TO ilines.
4310 APPEND '**************************************************************************' TO ilines.
4311 LOOP AT itemplines.
4312 APPEND itemplines TO ilines.
4313 ENDLOOP.
4314 ENDIF.
4315
4316 * Download text elements for this class
4317 IF NOT walocclass-itextelements[] IS INITIAL.
4318 PERFORM appendtextelements USING walocclass-itextelements[]
4319 ilines[].
4320 ENDIF.
4321
4322 * Download messages classes for this class.
4323 IF NOT walocclass-imessages[] IS INITIAL.
4324 PERFORM appendmessagestofile USING walocclass-imessages[]
4325 ilines[]
4326 space.
4327 ENDIF.
4328
4329 * Download exception texts for this class
4330 IF NOT walocclass-iconcepts[] IS INITIAL.
4331 PERFORM appendexceptiontexts USING walocclass-iconcepts[]
4332 ilines[].
4333 ENDIF.
4334
4335
4336 IF converttohtml IS INITIAL.
4337 APPEND '' TO ilines.
4338 APPEND '----------------------------------------------------------------------------------' TO ilines.
4339 PERFORM buildfootermessage USING 'TEXT'
4340 ilines.
4341 APPEND ilines.
4342 ELSE.
4343 PERFORM convertclasstohtml USING ilines[]
4344 classname
4345 walocclass-descript
4346 overideprogtype
4347 syntaxhighlightcomments
4348 fileextension
4349 customernamerange
4350 getdictstructures.
4351 ENDIF.
4352
4353 IF functionname IS INITIAL.
4354 objectname = classname.
4355 ELSE.
4356 objectname = functionname.
4357 ENDIF.
4358
4359 PERFORM buildfilename USING userfilepath
4360 additionalsubdir
4361 objectname
4362 space
4363 classname
4364 fileextension
4365 overideprogtype
4366 savetoserver
4367 slashseparator
4368 localfilenamewithpath
4369 localfilenameonly
4370 newsubdirectory
4371 completesavepath.
4372
4373 IF savetoserver IS INITIAL.
4374 PERFORM savefiletopc USING ilines[]
4375 localfilenamewithpath
4376 localfilenameonly
4377 space
4378 space
4379 displayprogressmessage.
4380 ELSE.
4381 PERFORM savefiletoserver USING ilines[]
4382 localfilenamewithpath
4383 localfilenameonly
4384 completesavepath
4385 displayprogressmessage.
4386 ENDIF.
4387 ENDFORM. "readClassAndDownload
4388
4389 *-------------------------------------------------------------------------------------------------------
4390 * readMethodAndDownload...
4391 *-------------------------------------------------------------------------------------------------------
4392 FORM readmethodanddownload USING walocmethod TYPE tmethod
4393 VALUE(methodname)
4394 VALUE(methodkey)
4395 VALUE(functionname)
4396 VALUE(overideprogtype)
4397 VALUE(userfilepath)
4398 VALUE(fileextension)
4399 VALUE(additionalsubdir)
4400 VALUE(converttohtml)
4401 VALUE(syntaxhighlightcomments)
4402 VALUE(customernamerange)
4403 VALUE(getincludes)
4404 VALUE(getdictstructures)
4405 VALUE(slashseparator)
4406 VALUE(savetoserver)
4407 VALUE(displayprogressmessage).
4408
4409 DATA: ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
4410 DATA: itemplines TYPE STANDARD TABLE OF string WITH HEADER LINE.
4411 DATA: localfilenamewithpath TYPE string.
4412 DATA: localfilenameonly TYPE string.
4413 DATA: newsubdirectory TYPE string.
4414 DATA: objectname TYPE string.
4415 DATA: castmethodkey TYPE program.
4416 DATA: completesavepath TYPE string.
4417
4418 * Add the method scope to the downloaded file
4419 APPEND '**************************************************************************' TO ilines.
4420 APPEND '* Method attributes. *' TO ilines.
4421 APPEND '**************************************************************************' TO ilines.
4422 CASE walocmethod-exposure.
4423 WHEN 0.
4424 APPEND `Instantiation: Private` TO ilines.
4425 WHEN 1.
4426 APPEND `Instantiation: Protected` TO ilines.
4427 WHEN 2.
4428 APPEND `Instantiation: Public` TO ilines.
4429 ENDCASE.
4430 APPEND '**************************************************************************' TO ilines.
4431 APPEND '' TO ilines.
4432
4433 castmethodkey = walocmethod-methodkey.
4434 READ REPORT castmethodkey INTO itemplines.
4435 LOOP AT itemplines.
4436 APPEND itemplines TO ilines.
4437 ENDLOOP.
4438
4439 IF converttohtml IS INITIAL.
4440 APPEND '' TO ilines.
4441 APPEND '----------------------------------------------------------------------------------' TO ilines.
4442 PERFORM buildfootermessage USING 'TEXT'
4443 ilines.
4444 APPEND ilines.
4445 ELSE.
4446 PERFORM convertcodetohtml USING ilines[]
4447 methodname
4448 walocmethod-descript
4449 overideprogtype
4450 space
4451 space
4452 syntaxhighlightcomments
4453 fileextension
4454 customernamerange
4455 getincludes
4456
4457 getdictstructures.
4458 ENDIF.
4459
4460 IF functionname IS INITIAL.
4461 objectname = methodname.
4462 ELSE.
4463 objectname = functionname.
4464 ENDIF.
4465
4466 PERFORM buildfilename USING userfilepath
4467 additionalsubdir
4468 objectname
4469 space
4470 methodname
4471 fileextension
4472 overideprogtype
4473 savetoserver
4474 slashseparator
4475 localfilenamewithpath
4476 localfilenameonly
4477 newsubdirectory
4478 completesavepath.
4479
4480 IF savetoserver IS INITIAL.
4481 PERFORM savefiletopc USING ilines[]
4482 localfilenamewithpath
4483 localfilenameonly
4484 space
4485 space
4486 displayprogressmessage.
4487 ELSE.
4488 PERFORM savefiletoserver USING ilines[]
4489 localfilenamewithpath
4490 localfilenameonly
4491 completesavepath
4492 displayprogressmessage.
4493 ENDIF.
4494 ENDFORM. "readMethodAndDownload
4495
4496 *-------------------------------------------------------------------------------------------------------
4497 * readFunctionAndDownload...
4498 *-------------------------------------------------------------------------------------------------------
4499 FORM readfunctionanddownload USING iloctextelements LIKE dumitexttab[]
4500 ilocselectiontexts LIKE dumitexttab[]
4501 ilocmessages LIKE imessages[]
4502 VALUE(functionname)
4503 VALUE(functioninternalname)
4504 VALUE(shorttext)
4505 VALUE(userfilepath)
4506 VALUE(fileextension)
4507 VALUE(subdir)
4508 VALUE(converttohtml)
4509 VALUE(functiondocumentationexists)
4510 VALUE(syntaxhighlightcomments)
4511 VALUE(customernamerange)
4512 VALUE(getincludes)
4513 VALUE(getdictstructures)
4514 VALUE(slashseparator)
4515 VALUE(savetoserver)
4516 VALUE(displayprogressmessage).
4517
4518 DATA: ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
4519 DATA: localfilenamewithpath TYPE string.
4520 DATA: localfilenameonly TYPE string.
4521 DATA: newsubdirectory TYPE string.
4522 DATA: completesavepath TYPE string.
4523
4524 READ REPORT functioninternalname INTO ilines.
4525
4526 * If we found any text elements for this function then we ought to append them to the main include.
4527 IF NOT iloctextelements[] IS INITIAL.
4528 PERFORM appendtextelements USING iloctextelements[]
4529 ilines[].
4530 ENDIF.
4531
4532 * If we found any message classes for this function then we ought to append them to the main include.
4533 IF NOT ilocmessages[] IS INITIAL.
4534 PERFORM appendmessagestofile USING ilocmessages[]
4535 ilines[]
4536 space.
4537 ENDIF.
4538
4539 IF converttohtml IS INITIAL.
4540 APPEND '' TO ilines.
4541 APPEND '----------------------------------------------------------------------------------' TO ilines.
4542 PERFORM buildfootermessage USING 'TEXT'
4543 ilines.
4544 APPEND ilines.
4545 ELSE.
4546 PERFORM convertfunctiontohtml USING ilines[]
4547 functionname
4548 shorttext
4549 is_function
4550 functiondocumentationexists
4551 true
4552 syntaxhighlightcomments
4553 fileextension
4554 customernamerange
4555 getincludes
4556 getdictstructures.
4557 ENDIF.
4558
4559 PERFORM buildfilename USING userfilepath
4560 subdir
4561 functionname
4562 space
4563 space
4564 fileextension
4565 is_function
4566 savetoserver
4567 slashseparator
4568 localfilenamewithpath
4569 localfilenameonly
4570 newsubdirectory
4571 completesavepath.
4572
4573 IF savetoserver IS INITIAL.
4574 PERFORM savefiletopc USING ilines[]
4575 localfilenamewithpath
4576 localfilenameonly
4577 space
4578 space
4579 displayprogressmessage.
4580 ELSE.
4581 PERFORM savefiletoserver USING ilines[]
4582 localfilenamewithpath
4583 localfilenameonly
4584 completesavepath
4585 displayprogressmessage.
4586 ENDIF.
4587 ENDFORM. "readFunctionAndDownload
4588
4589 *-------------------------------------------------------------------------------------------------------
4590 * buildFilename...
4591 *-------------------------------------------------------------------------------------------------------
4592 FORM buildfilename USING VALUE(userpath)
4593 VALUE(additionalsubdirectory)
4594 VALUE(objectname)
4595 VALUE(mainfunctionno)
4596 VALUE(includename)
4597 VALUE(fileextension)
4598 VALUE(downloadtype)
4599 VALUE(downloadtoserver)
4600 VALUE(slashseparator)
4601 newfilenamewithpath
4602 newfilenameonly
4603 newsubdirectory
4604 completepath.
4605
4606 * If we are running on a non UNIX environment we will need to remove forward slashes from the additional path.
4607 IF downloadtoserver IS INITIAL.
4608 IF frontendopsystem = non_unix.
4609 IF NOT additionalsubdirectory IS INITIAL.
4610 TRANSLATE additionalsubdirectory USING '/_'.
4611 IF additionalsubdirectory+0(1) = '_'.
4612 SHIFT additionalsubdirectory LEFT BY 1 PLACES.
4613 ENDIF.
4614 ENDIF.
4615 ENDIF.
4616 ELSE.
4617 IF serveropsystem = non_unix.
4618 IF NOT additionalsubdirectory IS INITIAL.
4619 TRANSLATE additionalsubdirectory USING '/_'.
4620 IF additionalsubdirectory+0(1) = '_'.
4621 SHIFT additionalsubdirectory LEFT BY 1 PLACES.
4622 ENDIF.
4623 ENDIF.
4624 ENDIF.
4625 ENDIF.
4626
4627 CASE downloadtype.
4628 * Programs
4629 WHEN is_program.
4630 IF additionalsubdirectory IS INITIAL.
4631 CONCATENATE userpath slashseparator objectname period fileextension INTO newfilenamewithpath.
4632 CONCATENATE userpath slashseparator INTO completepath.
4633 ELSE.
4634 CONCATENATE userpath slashseparator additionalsubdirectory
4635 slashseparator objectname period fileextension INTO newfilenamewithpath.
4636 CONCATENATE userpath slashseparator additionalsubdirectory INTO completepath.
4637 ENDIF.
4638
4639 * Function Modules
4640 WHEN is_function.
4641 IF additionalsubdirectory IS INITIAL.
4642 FIND 'top' IN includename IGNORING CASE.
4643 IF sy-subrc = 0.
4644 CONCATENATE userpath slashseparator objectname
4645 slashseparator 'Global-' objectname
4646 period fileextension
4647 INTO newfilenamewithpath.
4648 ELSE.
4649 IF includename CS mainfunctionno AND NOT mainfunctionno IS INITIAL.
4650 CONCATENATE userpath slashseparator objectname
4651 slashseparator objectname
4652 period fileextension
4653 INTO newfilenamewithpath.
4654 ELSE.
4655 CONCATENATE userpath slashseparator objectname
4656 slashseparator objectname
4657 period fileextension
4658 INTO newfilenamewithpath.
4659 ENDIF.
4660 ENDIF.
4661 newsubdirectory = objectname.
4662 CONCATENATE userpath slashseparator INTO completepath.
4663 ELSE.
4664 FIND 'top' IN includename IGNORING CASE.
4665 IF sy-subrc = 0.
4666 CONCATENATE userpath slashseparator additionalsubdirectory
4667 slashseparator objectname
4668 slashseparator 'Global-' objectname
4669 period fileextension
4670 INTO newfilenamewithpath.
4671 ELSE.
4672 IF includename CS mainfunctionno AND NOT mainfunctionno IS INITIAL.
4673 CONCATENATE userpath slashseparator additionalsubdirectory
4674 slashseparator objectname
4675 slashseparator objectname
4676 period fileextension
4677 INTO newfilenamewithpath.
4678 ELSE.
4679 CONCATENATE userpath slashseparator additionalsubdirectory
4680 slashseparator objectname
4681 slashseparator objectname
4682 period fileextension
4683 INTO newfilenamewithpath.
4684 ENDIF.
4685 ENDIF.
4686 CONCATENATE additionalsubdirectory slashseparator objectname INTO newsubdirectory.
4687 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO completepath.
4688 ENDIF.
4689
4690 * Table definition
4691 WHEN is_table.
4692 IF additionalsubdirectory IS INITIAL.
4693 CONCATENATE userpath slashseparator objectname
4694 slashseparator 'Dictionary-'
4695 objectname period fileextension
4696 INTO newfilenamewithpath.
4697
4698 CONCATENATE userpath slashseparator objectname INTO newsubdirectory.
4699 CONCATENATE userpath slashseparator objectname INTO completepath.
4700 ELSE.
4701 CONCATENATE userpath slashseparator additionalsubdirectory
4702 slashseparator objectname
4703 slashseparator 'Dictionary-'
4704 objectname period fileextension
4705 INTO newfilenamewithpath.
4706
4707 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO newsubdirectory.
4708 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO completepath.
4709 ENDIF.
4710
4711 * Program & Function documentation
4712 WHEN is_documentation.
4713 IF additionalsubdirectory IS INITIAL.
4714 CONCATENATE userpath slashseparator objectname
4715 slashseparator 'Docs-'
4716 objectname period
4717 fileextension
4718 INTO newfilenamewithpath.
4719
4720 CONCATENATE userpath slashseparator objectname INTO newsubdirectory.
4721 CONCATENATE userpath slashseparator objectname INTO completepath.
4722 ELSE.
4723 CONCATENATE userpath slashseparator additionalsubdirectory
4724 slashseparator objectname
4725 slashseparator 'Docs-'
4726 objectname period fileextension
4727 INTO newfilenamewithpath.
4728
4729 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO newsubdirectory.
4730 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO completepath.
4731 ENDIF.
4732
4733 * Screens
4734 WHEN is_screen.
4735 IF additionalsubdirectory IS INITIAL.
4736 CONCATENATE userpath slashseparator 'Screens'
4737 slashseparator 'screen_'
4738 objectname period
4739 fileextension INTO newfilenamewithpath.
4740
4741 CONCATENATE userpath slashseparator 'screens' INTO newsubdirectory.
4742 CONCATENATE userpath slashseparator 'screens' INTO completepath.
4743
4744 ELSE.
4745 CONCATENATE userpath slashseparator additionalsubdirectory
4746 slashseparator 'Screens'
4747 slashseparator 'screen_'
4748 objectname period
4749 fileextension INTO newfilenamewithpath.
4750
4751 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator 'screens' INTO newsubdirectory.
4752 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator 'screens' INTO completepath.
4753 ENDIF.
4754
4755 * GUI title
4756 WHEN is_guititle.
4757 IF additionalsubdirectory IS INITIAL.
4758 CONCATENATE userpath slashseparator 'Screens'
4759 slashseparator 'gui_title_'
4760 objectname period
4761 fileextension INTO newfilenamewithpath.
4762
4763 CONCATENATE userpath slashseparator 'screens' INTO newsubdirectory.
4764 CONCATENATE userpath slashseparator 'screens' INTO completepath.
4765 ELSE.
4766 CONCATENATE userpath slashseparator additionalsubdirectory
4767 slashseparator 'Screens'
4768 slashseparator 'gui_title_'
4769 objectname period
4770 fileextension INTO newfilenamewithpath.
4771
4772 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator 'Screens' INTO newsubdirectory.
4773 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator 'Screens' INTO completepath.
4774 ENDIF.
4775
4776 * Message Class
4777 WHEN is_messageclass.
4778 IF additionalsubdirectory IS INITIAL.
4779 CONCATENATE userpath slashseparator objectname
4780 slashseparator 'Message class-'
4781 objectname period
4782 fileextension
4783 INTO newfilenamewithpath.
4784
4785 CONCATENATE userpath slashseparator objectname INTO newsubdirectory.
4786 CONCATENATE userpath slashseparator objectname INTO completepath.
4787 ELSE.
4788 CONCATENATE userpath slashseparator additionalsubdirectory
4789 slashseparator objectname
4790 slashseparator 'Message class-'
4791 objectname period fileextension
4792 INTO newfilenamewithpath.
4793
4794 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO newsubdirectory.
4795 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO completepath.
4796 ENDIF.
4797
4798 * Class definition
4799 WHEN is_class.
4800 IF additionalsubdirectory IS INITIAL.
4801 CONCATENATE userpath slashseparator objectname
4802 slashseparator 'Class-'
4803 objectname period fileextension
4804 INTO newfilenamewithpath.
4805
4806 CONCATENATE userpath slashseparator objectname INTO newsubdirectory.
4807 CONCATENATE userpath slashseparator objectname INTO completepath.
4808 ELSE.
4809 CONCATENATE userpath slashseparator additionalsubdirectory
4810 slashseparator objectname
4811 slashseparator 'Class-'
4812 objectname period fileextension
4813 INTO newfilenamewithpath.
4814
4815 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO newsubdirectory.
4816 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO completepath.
4817 ENDIF.
4818
4819 * Class definition
4820 WHEN is_method.
4821 IF additionalsubdirectory IS INITIAL.
4822 CONCATENATE userpath slashseparator 'Method-'
4823 objectname period fileextension
4824 INTO newfilenamewithpath.
4825
4826 CONCATENATE userpath slashseparator objectname INTO newsubdirectory.
4827 CONCATENATE userpath slashseparator objectname INTO completepath.
4828 ELSE.
4829 CONCATENATE userpath slashseparator additionalsubdirectory
4830 slashseparator 'Method-'
4831 objectname period fileextension
4832 INTO newfilenamewithpath.
4833
4834 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO newsubdirectory.
4835 CONCATENATE userpath slashseparator additionalsubdirectory slashseparator objectname INTO completepath.
4836 ENDIF.
4837 ENDCASE.
4838
4839 TRANSLATE completepath TO LOWER CASE.
4840 CONCATENATE objectname period fileextension INTO newfilenameonly.
4841 TRANSLATE newfilenameonly TO LOWER CASE.
4842 TRANSLATE newfilenamewithpath TO LOWER CASE.
4843 TRANSLATE newsubdirectory TO LOWER CASE.
4844
4845 * If we are running on a non UNIX environment we will need to remove incorrect characters from the filename.
4846 IF downloadtoserver IS INITIAL.
4847 IF frontendopsystem = non_unix.
4848 TRANSLATE newfilenameonly USING '/_'.
4849 TRANSLATE newfilenamewithpath USING '/_'.
4850 TRANSLATE newfilenameonly USING '< '.
4851 TRANSLATE newfilenamewithpath USING '< '.
4852 TRANSLATE newfilenameonly USING '> '.
4853 TRANSLATE newfilenamewithpath USING '> '.
4854 TRANSLATE newfilenameonly USING '? '.
4855 TRANSLATE newfilenamewithpath USING '? '.
4856 TRANSLATE newfilenameonly USING '| '.
4857 TRANSLATE newfilenamewithpath USING '| '.
4858 CONDENSE newfilenameonly NO-GAPS.
4859 CONDENSE newfilenamewithpath NO-GAPS.
4860 ENDIF.
4861 ELSE.
4862 IF serveropsystem = non_unix.
4863 TRANSLATE newfilenameonly USING '/_'.
4864 TRANSLATE newfilenamewithpath USING '/_'.
4865 TRANSLATE newfilenameonly USING '< '.
4866 TRANSLATE newfilenamewithpath USING '< '.
4867 TRANSLATE newfilenameonly USING '> '.
4868 TRANSLATE newfilenamewithpath USING '> '.
4869 TRANSLATE newfilenameonly USING '? '.
4870 TRANSLATE newfilenamewithpath USING '? '.
4871 TRANSLATE newfilenameonly USING '| '.
4872 TRANSLATE newfilenamewithpath USING '| '.
4873 CONDENSE newfilenameonly NO-GAPS.
4874 CONDENSE newfilenamewithpath NO-GAPS.
4875 ENDIF.
4876 ENDIF.
4877 ENDFORM. "buildFilename
4878
4879 *-------------------------------------------------------------------------------------------------------
4880 * saveFileToPc... write an internal table to a file on the local PC
4881 *-------------------------------------------------------------------------------------------------------
4882 FORM savefiletopc USING idownload TYPE STANDARD TABLE
4883 VALUE(filenamewithpath)
4884 VALUE(filename)
4885 VALUE(writefieldseparator)
4886 VALUE(truncatetrailingblanks)
4887 VALUE(displayprogressmessage).
4888
4889 DATA: statusmessage TYPE string.
4890 DATA: objfile TYPE REF TO cl_gui_frontend_services.
4891 DATA: strsubrc TYPE string.
4892
4893 IF NOT displayprogressmessage IS INITIAL.
4894 CONCATENATE `Downloading: ` filename INTO statusmessage.
4895 PERFORM displaystatus USING statusmessage 0.
4896 ENDIF.
4897
4898 CREATE OBJECT objfile.
4899 CALL METHOD objfile->gui_download
4900 EXPORTING
4901 filename = filenamewithpath
4902 filetype = 'ASC'
4903 write_field_separator = writefieldseparator
4904 trunc_trailing_blanks = truncatetrailingblanks
4905 CHANGING
4906 data_tab = idownload[]
4907 EXCEPTIONS
4908 file_write_error = 1
4909 no_batch = 2
4910 gui_refuse_filetransfer = 3
4911 invalid_type = 4
4912 no_authority = 5
4913 unknown_error = 6
4914 header_not_allowed = 7
4915 separator_not_allowed = 8
4916 filesize_not_allowed = 9
4917 header_too_long = 10
4918 dp_error_create = 11
4919 dp_error_send = 12
4920 dp_error_write = 13
4921 unknown_dp_error = 14
4922 access_denied = 15
4923 dp_out_of_memory = 16
4924 disk_full = 17
4925 dp_timeout = 18
4926 file_not_found = 19
4927 dataprovider_exception = 20
4928 control_flush_error = 21
4929 not_supported_by_gui = 22
4930 error_no_gui = 23.
4931
4932 IF sy-subrc <> 0.
4933 strsubrc = sy-subrc.
4934 CONCATENATE `File save error: ` filename ` sy-subrc: ` strsubrc INTO statusmessage.
4935 PERFORM displaystatus USING statusmessage 3.
4936 ENDIF.
4937 ENDFORM. "saveFileToPc
4938
4939 *----------------------------------------------------------------------------------------------------------------------
4940 * saveFileToServer... write an internal table to a file on the SAP server
4941 *----------------------------------------------------------------------------------------------------------------------
4942 FORM savefiletoserver USING idownload TYPE STANDARD TABLE
4943 VALUE(filenamewithpath)
4944 VALUE(filename)
4945 VALUE(path)
4946 VALUE(displayprogressmessage).
4947
4948 DATA: wadownload TYPE string.
4949 DATA: statusmessage TYPE string.
4950
4951 IF NOT displayprogressmessage IS INITIAL.
4952 CONCATENATE `Downloading: ` filename INTO statusmessage.
4953 PERFORM displaystatus USING statusmessage 0.
4954 ENDIF.
4955
4956 READ TABLE iserverpaths WITH KEY table_line = path.
4957 IF sy-subrc <> 0.
4958 PERFORM createserverdirectory USING path.
4959 APPEND path TO iserverpaths.
4960 ENDIF.
4961
4962 OPEN DATASET filenamewithpath FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
4963 IF sy-subrc = 0.
4964 LOOP AT idownload INTO wadownload.
4965 TRANSFER wadownload TO filenamewithpath.
4966 IF sy-subrc <> 0.
4967 MESSAGE e000(oo) WITH 'Error transferring data to file'.
4968 ENDIF.
4969 ENDLOOP.
4970
4971 CLOSE DATASET filenamewithpath.
4972 IF sy-subrc <> 0.
4973 MESSAGE e000(oo) WITH 'Error closing file'.
4974 ENDIF.
4975 ELSE.
4976 * Unable to create a file
4977 MESSAGE e000(oo) WITH 'Error creating file on SAP server' 'check permissions'.
4978 ENDIF.
4979 ENDFORM. "saveFileToServer
4980
4981 *----------------------------------------------------------------------------------------------------------------------
4982 * createServerDirectory...
4983 *----------------------------------------------------------------------------------------------------------------------
4984 FORM createserverdirectory USING VALUE(path).
4985
4986 * Parameters for remove command.
4987 DATA: param1 TYPE sxpgcolist-parameters.
4988 * Return status
4989 DATA: funcstatus TYPE extcmdexex-status.
4990 * Command line listing returned by the function
4991 DATA: iserveroutput TYPE STANDARD TABLE OF btcxpm.
4992 DATA: waserveroutput TYPE btcxpm.
4993 * Targetsystem type conversion variable.
4994 DATA: target TYPE rfcdisplay-rfchost.
4995 * Operating system
4996 DATA: operatingsystem TYPE sxpgcolist-opsystem.
4997 * Head for split command.
4998 DATA: head TYPE string..
4999 DATA: tail TYPE string.
5000
5001 param1 = path.
5002 target = sy-host.
5003 operatingsystem = sy-opsys.
5004
5005 CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
5006 EXPORTING
5007 commandname = 'ZMKDIR'
5008 additional_parameters = param1
5009 operatingsystem = operatingsystem
5010 targetsystem = target
5011 stdout = 'X'
5012 stderr = 'X'
5013 terminationwait = 'X'
5014 IMPORTING
5015 status = funcstatus
5016 TABLES
5017 exec_protocol = iserveroutput[]
5018 EXCEPTIONS
5019 no_permission = 1
5020 command_not_found = 2
5021 parameters_too_long = 3
5022 security_risk = 4
5023 wrong_check_call_interface = 5
5024 program_start_error = 6
5025 program_termination_error = 7
5026 x_error = 8
5027 parameter_expected = 9
5028 too_many_parameters = 10
5029 illegal_command = 11
5030 wrong_asynchronous_parameters = 12
5031 cant_enq_tbtco_entry = 13
5032 jobcount_generation_error = 14
5033 OTHERS = 15.
5034
5035 IF sy-subrc = 0.
5036 * Although the function succeded did the external command actually work
5037 IF funcstatus = 'E'.
5038 * External command returned with an error
5039 IF sy-opsys CS 'Windows NT'.
5040 READ TABLE iserveroutput INDEX 1 INTO waserveroutput.
5041 IF waserveroutput-message NS 'already exists'.
5042 * An error occurred creating the directory on the server
5043 MESSAGE e000(oo) WITH 'An error occurred creating a directory'.
5044 ENDIF.
5045 ELSE.
5046 READ TABLE iserveroutput INDEX 2 INTO waserveroutput.
5047 SPLIT waserveroutput-message AT space INTO head tail.
5048 SHIFT tail LEFT DELETING LEADING space.
5049 IF tail <> 'Do not specify an existing file.'.
5050 * An error occurred creating the directory on the server
5051 MESSAGE e000(oo) WITH 'An error occurred creating a directory'.
5052 ENDIF.
5053 ENDIF.
5054 ENDIF.
5055 ELSE.
5056 CASE sy-subrc.
5057 WHEN 1.
5058 * No permissions to run the command
5059 MESSAGE e000(oo) WITH 'No permissions to run external command ZMKDIR'.
5060 WHEN 2.
5061 * External command not found
5062 MESSAGE e000(oo) WITH 'External comand ZMKDIR not found'.
5063
5064 WHEN OTHERS.
5065 * Unable to create the directory
5066 MESSAGE e000(oo) WITH 'An error occurred creating a directory'
5067 ', subrc:'
5068 sy-subrc.
5069 ENDCASE.
5070 ENDIF.
5071 ENDFORM. "createServerDirectory
5072
5073 *----------------------------------------------------------------------------------------------------------------------
5074 * appendTextElements...
5075 *----------------------------------------------------------------------------------------------------------------------
5076 FORM appendtextelements USING iloctextelements LIKE dumitexttab[]
5077 iloclines LIKE dumihtml[].
5078
5079 FIELD-SYMBOLS: <watextelement> TYPE ttexttable.
5080 DATA: waline TYPE string.
5081
5082 IF lines( iloctextelements ) > 0.
5083 APPEND '' TO iloclines.
5084
5085 APPEND '*Text elements' TO iloclines.
5086 APPEND '*----------------------------------------------------------' TO iloclines.
5087 LOOP AT iloctextelements ASSIGNING <watextelement>.
5088 CONCATENATE '* ' <watextelement>-key <watextelement>-entry INTO waline SEPARATED BY space.
5089 APPEND waline TO iloclines.
5090 ENDLOOP.
5091 ENDIF.
5092 ENDFORM. "appendTextElements
5093
5094 *----------------------------------------------------------------------------------------------------------------------
5095 * appendGUITitles...
5096 *----------------------------------------------------------------------------------------------------------------------
5097 FORM appendguititles USING ilocguititles LIKE dumiguititle[]
5098 iloclines LIKE dumihtml[].
5099
5100 FIELD-SYMBOLS: <waguititle> TYPE tguititle.
5101 DATA: waline TYPE string.
5102
5103 IF lines( ilocguititles ) > 0.
5104 APPEND '' TO iloclines.
5105
5106 APPEND '*GUI Texts' TO iloclines.
5107 APPEND '*----------------------------------------------------------' TO iloclines.
5108 LOOP AT ilocguititles ASSIGNING <waguititle>.
5109 CONCATENATE '* ' <waguititle>-obj_code '-->' <waguititle>-text INTO waline SEPARATED BY space.
5110 APPEND waline TO iloclines.
5111 ENDLOOP.
5112 ENDIF.
5113 ENDFORM. "appendGUITitles
5114
5115 *----------------------------------------------------------------------------------------------------------------------
5116 * appendSelectionTexts...
5117 *----------------------------------------------------------------------------------------------------------------------
5118 FORM appendselectiontexts USING ilocselectiontexts LIKE dumitexttab[]
5119 iloclines LIKE dumihtml[].
5120
5121 FIELD-SYMBOLS: <waselectiontext> TYPE ttexttable.
5122 DATA: waline TYPE string.
5123
5124 IF lines( ilocselectiontexts ) > 0.
5125 APPEND '' TO iloclines.
5126 APPEND '' TO iloclines.
5127
5128 APPEND '*Selection texts' TO iloclines.
5129 APPEND '*----------------------------------------------------------' TO iloclines.
5130 LOOP AT ilocselectiontexts ASSIGNING <waselectiontext>.
5131 CONCATENATE '* ' <waselectiontext>-key <waselectiontext>-entry INTO waline SEPARATED BY space.
5132 APPEND waline TO iloclines.
5133 ENDLOOP.
5134 ENDIF.
5135 ENDFORM. "appendSelectionTexts
5136
5137 *----------------------------------------------------------------------------------------------------------------------
5138 * appendExceptionTexts...
5139 *----------------------------------------------------------------------------------------------------------------------
5140 FORM appendexceptiontexts USING iconcepts LIKE dumiconcepts[]
5141 iloclines LIKE dumihtml[].
5142
5143 FIELD-SYMBOLS: <waconcept> TYPE tconcept.
5144 DATA: waline TYPE string.
5145 DATA: concepttext TYPE sotr_txt.
5146
5147 IF lines( iconcepts ) > 0.
5148 APPEND '' TO iloclines.
5149
5150 APPEND '*Exception texts' TO iloclines.
5151 APPEND '*----------------------------------------------------------' TO iloclines.
5152 LOOP AT iconcepts ASSIGNING <waconcept>.
5153 * Find the text for this concept
5154 CALL FUNCTION 'SOTR_GET_TEXT_KEY'
5155 EXPORTING
5156 concept = <waconcept>-concept
5157 langu = sy-langu
5158 search_in_second_langu = 'X'
5159 * second_langu = 'DE'
5160 IMPORTING
5161 e_text = concepttext
5162 EXCEPTIONS
5163 no_entry_found = 1
5164 parameter_error = 2
5165 OTHERS = 3.
5166
5167 IF sy-subrc = 0.
5168 CONCATENATE '* ' <waconcept>-constname '-' concepttext INTO waline SEPARATED BY space.
5169 APPEND waline TO iloclines.
5170 ENDIF.
5171 ENDLOOP.
5172 ENDIF.
5173 ENDFORM. "appendExceptionTexts
5174
5175 *----------------------------------------------------------------------------------------------------------------------
5176 * downloadFunctionDocs...
5177 *----------------------------------------------------------------------------------------------------------------------
5178 FORM downloadfunctiondocs USING VALUE(functionname)
5179 VALUE(functiondescription)
5180 VALUE(userfilepath)
5181 VALUE(fileextension)
5182 VALUE(converttohtml)
5183 VALUE(slashseparator)
5184 VALUE(savetoserver)
5185 VALUE(displayprogressmessage)
5186 subdir
5187 documentationdownloaded.
5188
5189 DATA: ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
5190 DATA: idocumentation TYPE STANDARD TABLE OF funct WITH HEADER LINE.
5191 DATA: iexceptions TYPE STANDARD TABLE OF rsexc WITH HEADER LINE.
5192 DATA: iexport TYPE STANDARD TABLE OF rsexp WITH HEADER LINE.
5193 DATA: iparameter TYPE STANDARD TABLE OF rsimp WITH HEADER LINE.
5194 DATA: itables TYPE STANDARD TABLE OF rstbl WITH HEADER LINE.
5195 DATA: iscriptlines TYPE STANDARD TABLE OF tline WITH HEADER LINE.
5196 DATA: htmlpagename TYPE string.
5197 DATA: newfilenamewithpath TYPE string.
5198 DATA: newfilenameonly TYPE string.
5199 DATA: object LIKE dokhl-object.
5200 DATA: stringlength TYPE i VALUE 0.
5201 DATA: newsubdirectory TYPE string.
5202 DATA: waline(255).
5203 DATA: completesavepath TYPE string.
5204
5205 documentationdownloaded = false.
5206 object = functionname.
5207
5208 CALL FUNCTION 'FUNCTION_IMPORT_DOKU'
5209 EXPORTING
5210 funcname = functionname
5211 TABLES
5212 dokumentation = idocumentation
5213 exception_list = iexceptions
5214 export_parameter = iexport
5215 import_parameter = iparameter
5216 tables_parameter = itables
5217 EXCEPTIONS
5218 error_message = 1
5219 function_not_found = 2
5220 invalid_name = 3
5221 OTHERS = 4.
5222
5223 CALL FUNCTION 'DOCU_GET'
5224 EXPORTING
5225 id = 'FU'
5226 langu = sy-langu
5227 object = object
5228 typ = 'T'
5229 version_active_or_last = 'L'
5230 TABLES
5231 line = iscriptlines
5232 EXCEPTIONS
5233 no_docu_on_screen = 1
5234 no_docu_self_def = 2
5235 no_docu_temp = 3
5236 ret_code = 4
5237 OTHERS = 5.
5238
5239 IF sy-subrc = 0 AND NOT ( iscriptlines[] IS INITIAL ).
5240 APPEND 'SHORT TEXT' TO ilines.
5241 CONCATENATE space functiondescription INTO functiondescription SEPARATED BY space.
5242 APPEND functiondescription TO ilines.
5243 APPEND space TO ilines.
5244 LOOP AT iscriptlines.
5245 MOVE iscriptlines-tdline TO ilines.
5246 CONCATENATE space ilines INTO ilines SEPARATED BY space.
5247 WHILE ilines CP '&*' OR ilines CP '*&'.
5248 REPLACE '&' INTO ilines WITH space.
5249 SHIFT ilines LEFT DELETING LEADING space.
5250 ENDWHILE.
5251 APPEND ilines.
5252 ENDLOOP.
5253
5254 CLEAR ilines.
5255 IF NOT ( idocumentation[] IS INITIAL ).
5256 APPEND ilines.
5257 APPEND 'PARAMETER DOCUMENTATION' TO ilines.
5258 APPEND '-----------------------' TO ilines.
5259 APPEND ilines.
5260
5261 DESCRIBE FIELD idocumentation-parameter LENGTH stringlength IN CHARACTER MODE.
5262 stringlength = stringlength + 3.
5263 LOOP AT idocumentation.
5264 MOVE idocumentation-parameter TO waline.
5265 MOVE idocumentation-stext TO waline+stringlength.
5266 APPEND waline TO ilines.
5267 ENDLOOP.
5268 ENDIF.
5269
5270 CONCATENATE `Documentation - ` functionname INTO htmlpagename.
5271
5272 IF converttohtml IS INITIAL.
5273 APPEND ilines.
5274 APPEND '----------------------------------------------------------------------------------' TO ilines.
5275 APPEND ilines.
5276 PERFORM buildfootermessage USING 'TEXT'
5277 ilines.
5278 APPEND ilines.
5279 ELSE.
5280 PERFORM convertcodetohtml USING ilines[]
5281 htmlpagename
5282 space
5283 is_documentation
5284 true
5285 space
5286 space
5287 space
5288 space
5289 space
5290 space.
5291 ENDIF.
5292
5293 PERFORM buildfilename USING userfilepath
5294 subdir
5295 functionname
5296 space
5297 space
5298 fileextension
5299 is_documentation
5300 savetoserver
5301 slashseparator
5302 newfilenamewithpath
5303 newfilenameonly
5304 newsubdirectory
5305 completesavepath.
5306
5307 IF savetoserver IS INITIAL.
5308 PERFORM savefiletopc USING ilines[]
5309 newfilenamewithpath
5310 newfilenameonly
5311 space
5312 space
5313 displayprogressmessage.
5314 ELSE.
5315 PERFORM savefiletoserver USING ilines[]
5316 newfilenamewithpath
5317 newfilenameonly
5318 completesavepath
5319 displayprogressmessage.
5320 ENDIF.
5321
5322 documentationdownloaded = true.
5323 ENDIF.
5324 ENDFORM. "downloadFunctionDocs
5325
5326 *----------------------------------------------------------------------------------------------------------------------
5327 * downloadScreens...
5328 *----------------------------------------------------------------------------------------------------------------------
5329 FORM downloadscreens USING ilocscreenflow LIKE dumiscreen[]
5330 VALUE(programname)
5331 VALUE(userfilepath)
5332 VALUE(textfileextension)
5333 VALUE(subdir)
5334 VALUE(slashseparator)
5335 VALUE(savetoserver)
5336 VALUE(displayprogressmessage).
5337
5338
5339 TABLES: d020t.
5340 DATA: header LIKE d020s.
5341 DATA: ifields TYPE STANDARD TABLE OF d021s WITH HEADER LINE.
5342 DATA: iflowlogic TYPE STANDARD TABLE OF d022s WITH HEADER LINE.
5343 FIELD-SYMBOLS <wascreen> TYPE tscreenflow.
5344 DATA: wacharheader TYPE scr_chhead.
5345 DATA: iscreenchar TYPE STANDARD TABLE OF scr_chfld WITH HEADER LINE.
5346 DATA: ifieldschar TYPE STANDARD TABLE OF scr_chfld WITH HEADER LINE.
5347 DATA: stars TYPE string VALUE '****************************************************************'.
5348 DATA: comment1 TYPE string VALUE '* This file was generated by Direct Download Enterprise. *'.
5349 DATA: comment2 TYPE string VALUE '* Please do not change it manually. *'.
5350 DATA: dynprotext TYPE string VALUE '%_DYNPRO'.
5351 DATA: headertext TYPE string VALUE '%_HEADER'.
5352 DATA: paramstext TYPE string VALUE '%_PARAMS'.
5353 DATA: descriptiontext TYPE string VALUE '%_DESCRIPTION'.
5354 DATA: fieldstext TYPE string VALUE '%_FIELDS'.
5355 DATA: flowlogictext TYPE string VALUE '%_FLOWLOGIC'.
5356 DATA: programlength TYPE string.
5357 DATA: newsubdirectory TYPE string.
5358 DATA: newfilenamewithpath TYPE string.
5359 DATA: newfilenameonly TYPE string.
5360 DATA: completesavepath TYPE string.
5361
5362 LOOP AT ilocscreenflow ASSIGNING <wascreen>.
5363 CALL FUNCTION 'RS_IMPORT_DYNPRO'
5364 EXPORTING
5365 dylang = sy-langu
5366 dyname = programname
5367 dynumb = <wascreen>-screen
5368 IMPORTING
5369 header = header
5370 TABLES
5371 ftab = ifields
5372 pltab = iflowlogic.
5373
5374 CALL FUNCTION 'RS_SCRP_HEADER_RAW_TO_CHAR'
5375 EXPORTING
5376 header_int = header
5377 IMPORTING
5378 header_char = wacharheader
5379 EXCEPTIONS
5380 OTHERS = 1.
5381
5382 * Add in the top comments for the file
5383 APPEND stars TO iscreenchar .
5384 APPEND comment1 TO iscreenchar.
5385 APPEND comment2 TO iscreenchar.
5386 APPEND stars TO iscreenchar.
5387
5388 * Screen identification
5389 APPEND dynprotext TO iscreenchar.
5390 APPEND wacharheader-prog TO iscreenchar.
5391 APPEND wacharheader-dnum TO iscreenchar.
5392 APPEND sy-saprl TO iscreenchar.
5393 DESCRIBE FIELD d020t-prog LENGTH programlength IN CHARACTER MODE.
5394 CONCATENATE ` ` programlength INTO iscreenchar.
5395 APPEND iscreenchar.
5396
5397 * Header
5398 APPEND headertext TO iscreenchar.
5399 APPEND wacharheader TO iscreenchar.
5400
5401 * Description text
5402 APPEND descriptiontext TO iscreenchar.
5403 SELECT SINGLE dtxt FROM d020t INTO iscreenchar
5404 WHERE prog = programname
5405 AND dynr = <wascreen>-screen
5406 AND lang = sy-langu.
5407 APPEND iscreenchar.
5408
5409 * Fieldlist text
5410 APPEND fieldstext TO iscreenchar.
5411
5412 CALL FUNCTION 'RS_SCRP_FIELDS_RAW_TO_CHAR'
5413 TABLES
5414 fields_int = ifields[]
5415 fields_char = ifieldschar[]
5416 EXCEPTIONS
5417 OTHERS = 1.
5418
5419 LOOP AT ifieldschar.
5420 MOVE-CORRESPONDING ifieldschar TO iscreenchar.
5421 APPEND iscreenchar.
5422 ENDLOOP.
5423
5424 * Flowlogic text
5425 APPEND flowlogictext TO iscreenchar.
5426 * Flow logic.
5427 LOOP AT iflowlogic.
5428 APPEND iflowlogic TO iscreenchar.
5429 ENDLOOP.
5430
5431 PERFORM buildfilename USING userfilepath
5432 subdir
5433 wacharheader-dnum
5434 space
5435 space
5436 textfileextension
5437 is_screen
5438 savetoserver
5439 slashseparator
5440 newfilenamewithpath
5441 newfilenameonly
5442 newsubdirectory
5443 completesavepath.
5444
5445 IF savetoserver IS INITIAL.
5446 * Save the screen to the local computer
5447 PERFORM savefiletopc USING iscreenchar[]
5448 newfilenamewithpath
5449 newfilenameonly
5450 'X'
5451 'X'
5452 displayprogressmessage.
5453 ELSE.
5454 * Save the screen to the SAP server
5455 PERFORM savefiletoserver USING iscreenchar[]
5456 newfilenamewithpath
5457 newfilenameonly
5458 completesavepath
5459 displayprogressmessage.
5460 ENDIF.
5461
5462 CLEAR header. CLEAR wacharheader.
5463 CLEAR iscreenchar[].
5464 CLEAR ifieldschar[].
5465 CLEAR ifields[].
5466 CLEAR iflowlogic[].
5467 ENDLOOP.
5468 ENDFORM. "downloadScreens
5469
5470 *----------------------------------------------------------------------------------------------------------------------
5471 * downloadGUITitles..
5472 *----------------------------------------------------------------------------------------------------------------------
5473 FORM downloadguititles USING ilocguititles LIKE dumiguititle[]
5474 VALUE(userfilepath)
5475 VALUE(textfileextension)
5476 VALUE(subdir)
5477 VALUE(slashseparator)
5478 VALUE(savetoserver)
5479 VALUE(displayprogressmessage).
5480
5481 DATA: ilines TYPE STANDARD TABLE OF string WITH HEADER LINE.
5482 FIELD-SYMBOLS: <waguititle> TYPE tguititle.
5483 DATA: newsubdirectory TYPE string.
5484 DATA: newfilenamewithpath TYPE string.
5485 DATA: newfilenameonly TYPE string.
5486 DATA: completesavepath TYPE string.
5487
5488 LOOP AT ilocguititles ASSIGNING <waguititle>.
5489 APPEND <waguititle>-text TO ilines.
5490
5491 PERFORM buildfilename USING userfilepath
5492 subdir
5493 <waguititle>-obj_code
5494 space
5495 space
5496 textfileextension
5497 is_guititle
5498 savetoserver
5499 slashseparator
5500 newfilenamewithpath
5501 newfilenameonly
5502 newsubdirectory
5503 completesavepath.
5504
5505 IF savetoserver IS INITIAL.
5506 PERFORM savefiletopc USING ilines[]
5507 newfilenamewithpath
5508 newfilenameonly
5509 space
5510 space
5511 displayprogressmessage.
5512 ELSE.
5513 PERFORM savefiletoserver USING ilines[]
5514 newfilenamewithpath
5515 newfilenameonly
5516 completesavepath
5517 displayprogressmessage.
5518 ENDIF.
5519
5520 CLEAR ilines[].
5521 ENDLOOP.
5522 ENDFORM. "downloadGUITitles
5523
5524 *----------------------------------------------------------------------------------------------------------------------
5525 * downloadPrograms..
5526 *----------------------------------------------------------------------------------------------------------------------
5527 FORM downloadprograms USING ilocprogram LIKE iprograms[]
5528 ilocfunctions LIKE ifunctions[]
5529 VALUE(userfilepath)
5530 VALUE(fileextension)
5531 VALUE(htmlfileextension)
5532 VALUE(textfileextension)
5533 VALUE(converttohtml)
5534 VALUE(syntaxhighlightcomments)
5535 VALUE(customernamerange)
5536 VALUE(getincludes)
5537 VALUE(getdictstruct)
5538 VALUE(downloaddocumentation)
5539 VALUE(sorttablesasc)
5540 VALUE(slashseparator)
5541 VALUE(savetoserver)
5542 VALUE(displayprogressmessage).
5543
5544
5545 DATA: iprogfunctions TYPE STANDARD TABLE OF tfunction WITH HEADER LINE.
5546 FIELD-SYMBOLS: <waprogram> TYPE tprogram.
5547 FIELD-SYMBOLS: <wainclude> TYPE tinclude.
5548 DATA: iemptytextelements TYPE STANDARD TABLE OF ttexttable.
5549 DATA: iemptyselectiontexts TYPE STANDARD TABLE OF ttexttable.
5550 DATA: iemptymessages TYPE STANDARD TABLE OF tmessage.
5551 DATA: iemptyguititles TYPE STANDARD TABLE OF tguititle.
5552 DATA: locconverttohtml(1).
5553 DATA: locfileextension TYPE string.
5554
5555 SORT ilocprogram ASCENDING BY progname.
5556
5557 LOOP AT ilocprogram ASSIGNING <waprogram>.
5558 * if the program to download is this program then always download as text otherwise you will get a rubbish file
5559 IF <waprogram>-progname = sy-cprog.
5560 locconverttohtml = ''.
5561 locfileextension = textextension.
5562 ELSE.
5563 locconverttohtml = converttohtml.
5564 locfileextension = fileextension.
5565 ENDIF.
5566
5567 * Download the main program
5568 PERFORM readincludeanddownload USING <waprogram>-itextelements[]
5569 <waprogram>-iselectiontexts[]
5570 <waprogram>-imessages[]
5571 <waprogram>-iguititle[]
5572 <waprogram>-progname
5573 space
5574 <waprogram>-programtitle
5575 is_program
5576 userfilepath
5577 locfileextension
5578 <waprogram>-progname
5579 locconverttohtml
5580 syntaxhighlightcomments
5581 customernamerange
5582 getincludes
5583 getdictstruct
5584 slashseparator
5585 savetoserver
5586 displayprogressmessage.
5587
5588 * Download screens.
5589 IF NOT <waprogram>-iscreenflow[] IS INITIAL.
5590 PERFORM downloadscreens USING <waprogram>-iscreenflow[]
5591 <waprogram>-progname
5592 userfilepath
5593 textfileextension
5594 <waprogram>-progname
5595 slashseparator
5596 savetoserver
5597 displayprogressmessage.
5598 ENDIF.
5599
5600 * Download GUI titles
5601 IF NOT <waprogram>-iguititle[] IS INITIAL.
5602 PERFORM downloadguititles USING <waprogram>-iguititle
5603 userfilepath
5604 textfileextension
5605 <waprogram>-progname
5606 slashseparator
5607 savetoserver
5608 displayprogressmessage.
5609 ENDIF.
5610
5611 * Download all other includes
5612 LOOP AT <waprogram>-iincludes ASSIGNING <wainclude>.
5613 PERFORM readincludeanddownload USING iemptytextelements[]
5614 iemptyselectiontexts[]
5615 iemptymessages[]
5616 iemptyguititles[]
5617 <wainclude>-includename
5618 space
5619 <wainclude>-includetitle
5620 is_program
5621 userfilepath
5622 fileextension
5623 <waprogram>-progname
5624 converttohtml
5625 syntaxhighlightcomments
5626 customernamerange
5627 getincludes
5628 getdictstruct
5629 slashseparator
5630 savetoserver
5631 displayprogressmessage.
5632
5633 ENDLOOP.
5634
5635 * Download all dictionary structures
5636 IF NOT <waprogram>-idictstruct[] IS INITIAL.
5637 PERFORM downloadddstructures USING <waprogram>-idictstruct[]
5638 userfilepath
5639 htmlfileextension
5640 <waprogram>-progname
5641 sorttablesasc
5642 slashseparator
5643 savetoserver
5644 displayprogressmessage.
5645 ENDIF.
5646
5647 * Download any functions used by these programs
5648 LOOP AT ilocfunctions INTO iprogfunctions WHERE programlinkname = <waprogram>-progname.
5649 APPEND iprogfunctions.
5650 ENDLOOP.
5651
5652 IF NOT iprogfunctions[] IS INITIAL.
5653 PERFORM downloadfunctions USING iprogfunctions[]
5654 userfilepath
5655 fileextension
5656 <waprogram>-progname
5657 downloaddocumentation
5658 converttohtml
5659 syntaxhighlightcomments
5660 customernamerange
5661 getincludes
5662 getdictstruct
5663 textfileextension
5664 htmlfileextension
5665 sorttablesasc
5666 slashseparator
5667 savetoserver
5668 displayprogressmessage.
5669 CLEAR iprogfunctions[].
5670 ENDIF.
5671 ENDLOOP.
5672 ENDFORM. "downloadPrograms
5673
5674 *----------------------------------------------------------------------------------------------------------------------
5675 * downloadClasses..
5676 *----------------------------------------------------------------------------------------------------------------------
5677 FORM downloadclasses USING ilocclasses LIKE iclasses[]
5678 ilocfunctions LIKE ifunctions[]
5679 VALUE(userfilepath)
5680 VALUE(fileextension)
5681 VALUE(htmlfileextension)
5682 VALUE(textfileextension)
5683 VALUE(converttohtml)
5684 VALUE(syntaxhighlightcomments)
5685 VALUE(customernamerange)
5686 VALUE(getincludes)
5687 VALUE(getdictstruct)
5688 VALUE(downloaddocumentation)
5689 VALUE(sorttablesasc)
5690 VALUE(slashseparator)
5691 VALUE(savetoserver)
5692 VALUE(displayprogressmessage).
5693
5694
5695 DATA: iclassfunctions TYPE STANDARD TABLE OF tfunction WITH HEADER LINE.
5696 FIELD-SYMBOLS: <waclass> TYPE tclass.
5697 FIELD-SYMBOLS: <wamethod> TYPE tmethod.
5698
5699 SORT ilocclasses ASCENDING BY clsname.
5700
5701 LOOP AT ilocclasses ASSIGNING <waclass>.
5702 * Download the class
5703 PERFORM readclassanddownload USING <waclass>
5704 <waclass>-clsname
5705 space
5706 is_class
5707 userfilepath
5708 fileextension
5709 space
5710 converttohtml
5711 syntaxhighlightcomments
5712 customernamerange
5713 getincludes
5714 getdictstruct
5715 slashseparator
5716 savetoserver
5717 displayprogressmessage.
5718
5719
5720 * Download all of the methods
5721 LOOP AT <waclass>-imethods ASSIGNING <wamethod>.
5722 PERFORM readmethodanddownload USING <wamethod>
5723 <wamethod>-cmpname
5724 <wamethod>-methodkey
5725 space
5726 is_method
5727 userfilepath
5728 fileextension
5729 <waclass>-clsname
5730 converttohtml
5731 syntaxhighlightcomments
5732 customernamerange
5733 getincludes
5734 getdictstruct
5735 slashseparator
5736 savetoserver
5737 displayprogressmessage.
5738
5739 ENDLOOP.
5740
5741 * Download all dictionary structures
5742 IF NOT <waclass>-idictstruct[] IS INITIAL.
5743 PERFORM downloadddstructures USING <waclass>-idictstruct[]
5744 userfilepath
5745 htmlfileextension
5746 <waclass>-clsname
5747 sorttablesasc
5748 slashseparator
5749 savetoserver
5750 displayprogressmessage.
5751 ENDIF.
5752
5753 * Download any functions used by these programs
5754 LOOP AT ilocfunctions INTO iclassfunctions WHERE programlinkname = <waclass>-clsname.
5755 APPEND iclassfunctions.
5756 ENDLOOP.
5757
5758 IF NOT iclassfunctions[] IS INITIAL.
5759 PERFORM downloadfunctions USING iclassfunctions[]
5760 userfilepath
5761 fileextension
5762 <waclass>-clsname
5763 downloaddocumentation
5764 converttohtml
5765 syntaxhighlightcomments
5766 customernamerange
5767 getincludes
5768 getdictstruct
5769 textfileextension
5770 htmlfileextension
5771 sorttablesasc
5772 slashseparator
5773 savetoserver
5774 displayprogressmessage.
5775 CLEAR iclassfunctions[].
5776 ENDIF.
5777 ENDLOOP.
5778 ENDFORM. "downloadClasses
5779
5780 *----------------------------------------------------------------------------------------------------------------------
5781 * reFormatClassCode... Expand a classes public, private and protected section from the 72 characters that the class
5782 * builder sets it to back to the wide editor mode
5783 *----------------------------------------------------------------------------------------------------------------------
5784 FORM reformatclasscode USING itemplines LIKE dumihtml[].
5785
5786 FIELD-SYMBOLS: <waline> TYPE string.
5787 DATA: newline TYPE string.
5788 DATA: inewtable TYPE STANDARD TABLE OF string.
5789 DATA: foundone TYPE i VALUE false.
5790
5791 LOOP AT itemplines ASSIGNING <waline>.
5792 IF NOT <waline> IS INITIAL.
5793 IF foundone = false.
5794 FIND 'data' IN <waline> RESPECTING CASE.
5795 IF sy-subrc = 0.
5796 foundone = true.
5797 ENDIF.
5798
5799 FIND 'constants' IN <waline> RESPECTING CASE.
5800 IF sy-subrc = 0.
5801 foundone = true.
5802 ENDIF.
5803
5804 IF foundone = true.
5805 newline = <waline>.
5806
5807 IF ( newline CS '.' OR newline CS '*' ).
5808 REPLACE '!' IN <waline> WITH ''.
5809 APPEND newline TO inewtable.
5810 CLEAR newline.
5811 foundone = false.
5812 ENDIF.
5813 ELSE.
5814 REPLACE '!' IN <waline> WITH ''.
5815 APPEND <waline> TO inewtable.
5816 ENDIF.
5817 ELSE.
5818 CONCATENATE newline <waline> INTO newline SEPARATED BY space.
5819 IF ( newline CS '.' OR newline CS '*' ).
5820 APPEND newline TO inewtable.
5821 CLEAR newline.
5822 foundone = false.
5823 ENDIF.
5824 ENDIF.
5825 ELSE.
5826 REPLACE '!' IN <waline> WITH ''.
5827 APPEND <waline> TO inewtable[].
5828 ENDIF.
5829 ENDLOOP.
5830
5831 itemplines[] = inewtable[].
5832 ENDFORM. "reFormatClassCode
5833
5834 ***********************************************************************************************************************
5835 **********************************************HTML ROUTINES************************************************************
5836 ***********************************************************************************************************************
5837
5838 *----------------------------------------------------------------------------------------------------------------------
5839 * convertDDToHTML... Convert text description to HTML
5840 *----------------------------------------------------------------------------------------------------------------------
5841 FORM convertddtohtml USING ilocdictstructure LIKE dumidictstructure[]
5842 ilochtml LIKE dumihtml[]
5843 VALUE(tablename)
5844 VALUE(tabletitle)
5845 VALUE(sorttablesasc).
5846
5847 DATA: icolumncaptions TYPE STANDARD TABLE OF string WITH HEADER LINE.
5848 DATA: wadictionary TYPE tdicttablestructure.
5849 DATA: wahtml TYPE string.
5850 DATA: title TYPE string.
5851
5852 PERFORM buildcolumnheaders USING icolumncaptions[].
5853
5854 * Add a html header to the table
5855 CONCATENATE 'Dictionary object-' tablename INTO title SEPARATED BY space.
5856 PERFORM addhtmlheader USING ilochtml[]
5857 title.
5858
5859 CONCATENATE '<h2>' tablename '</h2>' INTO wahtml.
5860 APPEND wahtml TO ilochtml.
5861 APPEND '' TO ilochtml.
5862
5863 CONCATENATE '<h3>' tabletitle '</h3>' INTO wahtml.
5864 APPEND wahtml TO ilochtml.
5865 APPEND '' TO ilochtml.
5866
5867 * Do we need to sort the fields into alphabetical order
5868 IF NOT sorttablesasc IS INITIAL.
5869 SORT ilocdictstructure ASCENDING BY fieldname.
5870 ENDIF.
5871
5872 PERFORM convertitabtohtml USING icolumncaptions[]
5873 ilocdictstructure[]
5874 ilochtml
5875 'X'
5876 colour_black
5877 ''
5878 colour_yellow
5879 ''
5880 background_colour
5881 'Arial'
5882 'green'
5883 '1'
5884 '1'.
5885
5886 * Add a html footer to the table
5887 APPEND '<br>' TO ilochtml.
5888 PERFORM addhtmlfooter USING ilochtml[].
5889 ENDFORM. "convertDDToHTML
5890
5891 *----------------------------------------------------------------------------------------------------------------------
5892 * convertITABtoHtml... produces a html table from an internal table
5893 *----------------------------------------------------------------------------------------------------------------------
5894 FORM convertitabtohtml USING ilocheader LIKE dumiheader[]
5895 ilocdictstructure LIKE dumidictstructure[]
5896 ilochtml LIKE dumihtml[]
5897 VALUE(includerowcount)
5898 headingbackcolour
5899 headingfontname
5900 headingfontcolour
5901 headingfontsize
5902 bodybackcolour
5903 bodyfontname
5904 bodyfontcolour
5905 bodyfontsize
5906 bordersize.
5907
5908 * Holds one cell from the internal table
5909 FIELD-SYMBOLS: <fsfield>.
5910 * The value of one cell form the internal table
5911 DATA: wtextcell TYPE string.
5912 * work area for putting the CSV value into
5913 DATA: wacsvtable TYPE string.
5914 * Have we used any font tags in the html code
5915 DATA: usedafontattribute TYPE i VALUE 0.
5916 * Work area for HTML table
5917 DATA: wahtml TYPE string.
5918 * Loop counter for adding row numbers onto the output table
5919 DATA: loopcounter TYPE string.
5920 * Work area for header table
5921 FIELD-SYMBOLS: <waheader> TYPE string.
5922 FIELD-SYMBOLS: <ilocdictstructure> TYPE tdicttablestructure.
5923
5924 CONCATENATE '<table border="' bordersize '">' INTO wahtml.
5925 APPEND wahtml TO ilochtml.
5926
5927 IF NOT ilocheader[] IS INITIAL.
5928 APPEND '<tr>' TO ilochtml.
5929 ENDIF.
5930
5931 LOOP AT ilocheader ASSIGNING <waheader>.
5932 IF headingbackcolour IS INITIAL.
5933 wahtml = '<th>'.
5934 ELSE.
5935 CONCATENATE '<th bgcolor="' headingbackcolour '">' INTO wahtml.
5936 ENDIF.
5937
5938 IF NOT headingfontname IS INITIAL OR NOT headingfontcolour IS INITIAL OR NOT headingfontsize IS INITIAL.
5939 CONCATENATE wahtml '<font' INTO wahtml.
5940
5941 * Add the font name
5942 IF NOT headingfontname IS INITIAL.
5943 CONCATENATE wahtml ' face ="' INTO wahtml.
5944 CONCATENATE wahtml headingfontname '"' INTO wahtml.
5945 ENDIF.
5946
5947 * Add the font colour
5948 IF NOT headingfontcolour IS INITIAL.
5949 CONCATENATE wahtml ' color ="' INTO wahtml.
5950 CONCATENATE wahtml headingfontcolour '"' INTO wahtml.
5951 ENDIF.
5952
5953 * Add the fontsize
5954 IF NOT headingfontsize IS INITIAL.
5955 CONCATENATE wahtml' size ="' INTO wahtml.
5956 CONCATENATE wahtml headingfontsize '"' INTO wahtml.
5957 ENDIF.
5958
5959 CONCATENATE wahtml '>' INTO wahtml.
5960 usedafontattribute = true.
5961 ENDIF.
5962
5963 * Add the caption name
5964 CONCATENATE wahtml <waheader> INTO wahtml.
5965
5966 IF usedafontattribute = true.
5967 CONCATENATE wahtml '</font>' INTO wahtml.
5968 usedafontattribute = false.
5969 ENDIF.
5970
5971 CONCATENATE wahtml '</th>' INTO wahtml.
5972 APPEND wahtml TO ilochtml.
5973 ENDLOOP.
5974
5975 APPEND '</tr>' TO ilochtml.
5976 FREE ilocheader.
5977
5978
5979 * Line item data
5980 LOOP AT ilocdictstructure ASSIGNING <ilocdictstructure>.
5981
5982 loopcounter = sy-tabix.
5983
5984 APPEND '' TO ilochtml.
5985 APPEND '<tr>' TO ilochtml.
5986
5987 * Add the row count
5988 IF NOT includerowcount IS INITIAL.
5989 IF bodybackcolour IS INITIAL.
5990 wahtml = '<td>'.
5991 ELSE.
5992 CONCATENATE '<td bgcolor="' bodybackcolour '">' INTO wahtml.
5993 ENDIF.
5994
5995 IF NOT bodyfontname IS INITIAL OR NOT bodyfontcolour IS INITIAL OR NOT bodyfontsize IS INITIAL.
5996 CONCATENATE wahtml '<font' INTO wahtml.
5997
5998 * Add the font name
5999 IF NOT bodyfontname IS INITIAL.
6000 CONCATENATE wahtml ' face ="' INTO wahtml.
6001 CONCATENATE wahtml bodyfontname '"' INTO wahtml.
6002 ENDIF.
6003
6004 * Add the font colour
6005 IF NOT bodyfontcolour IS INITIAL.
6006 CONCATENATE wahtml ' color ="' INTO wahtml.
6007 CONCATENATE wahtml bodyfontcolour '"' INTO wahtml.
6008 ENDIF.
6009
6010 * Add the fontsize
6011 IF NOT bodyfontsize IS INITIAL.
6012 CONCATENATE wahtml ' size ="' INTO wahtml.
6013 CONCATENATE wahtml bodyfontsize '"' INTO wahtml.
6014 ENDIF.
6015
6016 CONCATENATE wahtml '>' INTO wahtml.
6017 usedafontattribute = true.
6018 ENDIF.
6019
6020 * Add the row number into the table
6021 CONCATENATE wahtml loopcounter INTO wahtml.
6022
6023
6024 IF usedafontattribute = true.
6025 CONCATENATE wahtml '</font>' INTO wahtml.
6026 usedafontattribute = false.
6027 ENDIF.
6028
6029 CONCATENATE wahtml '</td>' INTO wahtml.
6030 APPEND wahtml TO ilochtml.
6031 ENDIF.
6032
6033 DO.
6034 * Assign each field in the table to the field symbol
6035 ASSIGN COMPONENT sy-index OF STRUCTURE <ilocdictstructure> TO <fsfield>.
6036 IF sy-subrc = 0.
6037 MOVE <fsfield> TO wtextcell.
6038
6039 * Cell data processing
6040 IF bodybackcolour IS INITIAL.
6041 wahtml = '<td>'.
6042 ELSE.
6043 CONCATENATE '<td bgcolor="' bodybackcolour '">' INTO wahtml.
6044 ENDIF.
6045
6046 IF NOT bodyfontname IS INITIAL OR NOT bodyfontcolour IS INITIAL OR NOT bodyfontsize IS INITIAL.
6047 CONCATENATE wahtml '<font' INTO wahtml.
6048
6049 * Add the font name
6050 IF NOT bodyfontname IS INITIAL.
6051 CONCATENATE wahtml ' face ="' INTO wahtml.
6052 CONCATENATE wahtml bodyfontname '"' INTO wahtml.
6053 ENDIF.
6054
6055 * Add the font colour
6056 IF NOT bodyfontcolour IS INITIAL.
6057 CONCATENATE wahtml ' color ="' INTO wahtml.
6058 CONCATENATE wahtml bodyfontcolour '"' INTO wahtml.
6059 ENDIF.
6060
6061 * Add the fontsize
6062 IF NOT bodyfontsize IS INITIAL.
6063 CONCATENATE wahtml ' size ="' INTO wahtml.
6064 CONCATENATE wahtml bodyfontsize '"' INTO wahtml.
6065 ENDIF.
6066
6067 CONCATENATE wahtml '>' INTO wahtml.
6068 usedafontattribute = true.
6069 ENDIF.
6070
6071 * Add the caption name
6072 IF wtextcell IS INITIAL.
6073 CONCATENATE wahtml ' ' INTO wahtml.
6074 ELSE.
6075 CONCATENATE wahtml wtextcell INTO wahtml.
6076 ENDIF.
6077
6078 IF usedafontattribute = true.
6079 CONCATENATE wahtml '</font>' INTO wahtml.
6080 usedafontattribute = false.
6081 ENDIF.
6082
6083 CONCATENATE wahtml '</td>' INTO wahtml.
6084 APPEND wahtml TO ilochtml.
6085 ELSE.
6086 EXIT.
6087 ENDIF.
6088 ENDDO.
6089
6090 APPEND '</tr>' TO ilochtml.
6091 ENDLOOP.
6092
6093 APPEND '</table>' TO ilochtml.
6094 ENDFORM. "convertITABtoHtml
6095
6096 *----------------------------------------------------------------------------------------------------------------------
6097 * convertCodeToHtml... Builds an HTML table based upon a text table.
6098 *----------------------------------------------------------------------------------------------------------------------
6099 FORM convertcodetohtml USING icontents LIKE dumihtml[]
6100 VALUE(programname)
6101 VALUE(shortdescription)
6102 VALUE(sourcecodetype)
6103 VALUE(functiondocumentationexists)
6104 VALUE(ismainfunctioninclude)
6105 VALUE(syntaxhighlightcomments)
6106 VALUE(htmlextension)
6107 VALUE(customernamerange)
6108 VALUE(getincludes)
6109 VALUE(getdictstructures).
6110
6111 DATA: htmltable TYPE STANDARD TABLE OF string WITH HEADER LINE.
6112 DATA: listingname TYPE string VALUE 'Code listing for:'.
6113 DATA: descriptionname TYPE string VALUE `Description: `.
6114 DATA: head(255).
6115 DATA: tail(255).
6116 DATA: mytabix TYPE sytabix.
6117 DATA: nextline TYPE sytabix.
6118 DATA: hyperlinkname TYPE string.
6119 DATA: copyofcurrentline TYPE string.
6120 DATA: currentlinelength TYPE i VALUE 0.
6121 DATA: copylinelength TYPE i VALUE 0.
6122 DATA: ignorefuturelines TYPE i VALUE false.
6123 DATA: foundasterix TYPE i VALUE false.
6124 DATA: lowercaselink TYPE string.
6125 DATA: wanextline TYPE string.
6126 DATA: wacontent(255).
6127
6128 * Add a html header to the table
6129 PERFORM addhtmlheader USING htmltable[]
6130 programname.
6131
6132 CONCATENATE listingname programname INTO listingname SEPARATED BY space.
6133 CONCATENATE '<font size="3" face = "Arial" color="' colour_black '"><b>' listingname '</b></font>' INTO htmltable.
6134 APPEND htmltable.
6135
6136 IF NOT shortdescription IS INITIAL.
6137 APPEND '<br>' TO htmltable.
6138 CONCATENATE descriptionname shortdescription INTO descriptionname SEPARATED BY space.
6139 CONCATENATE '<font size="3" face = "Arial" color="' colour_black '"><b>' descriptionname '</b></font>' INTO htmltable.
6140 APPEND htmltable.
6141 ENDIF.
6142
6143 htmltable = '<hr>'.
6144 APPEND htmltable.
6145
6146 htmltable = '<pre width="100">'.
6147 APPEND htmltable.
6148
6149 LOOP AT icontents INTO wacontent.
6150 mytabix = sy-tabix.
6151
6152 IF NOT ( icontents IS INITIAL ).
6153 WHILE ( wacontent CS '<' OR wacontent CS '>' ).
6154 REPLACE '<' IN wacontent WITH lt.
6155 REPLACE '>' IN wacontent WITH gt.
6156 ENDWHILE.
6157
6158 IF wacontent+0(1) <> asterix.
6159 currentlinelength = strlen( wacontent ).
6160 copyofcurrentline = wacontent.
6161
6162 * Don't hyperlink anything for files of type documentation
6163 IF sourcecodetype <> is_documentation.
6164 * Check for any functions to highlight
6165 IF ( wacontent CS callfunction ) AND ( wacontent <> 'DESTINATION' ).
6166 nextline = mytabix + 1.
6167 READ TABLE icontents INTO wanextline INDEX nextline.
6168 TRANSLATE wanextline TO UPPER CASE.
6169 IF wanextline NS 'DESTINATION'.
6170 SHIFT copyofcurrentline LEFT DELETING LEADING space.
6171
6172 copylinelength = strlen( copyofcurrentline ).
6173
6174 SPLIT copyofcurrentline AT space INTO head tail.
6175 SPLIT tail AT space INTO head tail.
6176 SPLIT tail AT space INTO head tail.
6177 * Function name is now in head
6178 TRANSLATE head USING ''' '.
6179 SHIFT head LEFT DELETING LEADING space.
6180
6181 TRY.
6182 IF head+0(1) = 'Y' OR head+0(1) = 'Z' OR head+0(1) = 'y' OR head+0(1) = 'z' OR head CS customernamerange.
6183 * Definately a customer function module
6184 hyperlinkname = head.
6185
6186 IF sourcecodetype = is_function.
6187 copyofcurrentline = 'call function <a href ="../'.
6188 ELSE.
6189 copyofcurrentline = 'call function <a href ="'.
6190 ENDIF.
6191
6192 lowercaselink = hyperlinkname.
6193 TRANSLATE lowercaselink TO LOWER CASE.
6194 * If we are running on a non UNIX environment we will need to remove forward slashes
6195 IF frontendopsystem = non_unix.
6196 TRANSLATE lowercaselink USING '/_'.
6197 ENDIF.
6198
6199 CONCATENATE copyofcurrentline
6200 lowercaselink "hyperlinkName
6201 '/'
6202 lowercaselink "hyperlinkName
6203 period htmlextension '">'
6204 ''''
6205 hyperlinkname
6206 ''''
6207 '</a>'
6208 tail INTO copyofcurrentline.
6209
6210 * Pad the string back out with spaces
6211 WHILE copylinelength < currentlinelength.
6212 SHIFT copyofcurrentline RIGHT BY 1 PLACES.
6213 copylinelength = copylinelength + 1.
6214 ENDWHILE.
6215
6216 wacontent = copyofcurrentline.
6217 ENDIF.
6218 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
6219 ENDTRY.
6220 ENDIF.
6221 ENDIF.
6222 ENDIF.
6223
6224 * Check for any customer includes to hyperlink
6225 IF wacontent CS include OR wacontent CS lowinclude.
6226 SHIFT copyofcurrentline LEFT DELETING LEADING space.
6227 copylinelength = strlen( copyofcurrentline ).
6228
6229 SPLIT copyofcurrentline AT space INTO head tail.
6230 SHIFT tail LEFT DELETING LEADING space.
6231
6232 TRY.
6233 IF ( tail+0(1) = 'Y' OR tail+0(1) = 'Z' OR tail+0(1) = 'y' OR tail+0(1) = 'z' OR tail CS customernamerange OR tail+0(2) = 'mz' OR tail+0(2) = 'MZ' )
6234 AND NOT getincludes IS INITIAL AND tail NS structure AND tail NS lowstructure.
6235
6236 * Hyperlink for program includes
6237 CLEAR wacontent.
6238 SHIFT tail LEFT DELETING LEADING space.
6239 SPLIT tail AT period INTO hyperlinkname tail.
6240 copyofcurrentline = 'include <a href ="'.
6241
6242 lowercaselink = hyperlinkname.
6243 TRANSLATE lowercaselink TO LOWER CASE.
6244
6245 * If we are running on a non UNIX environment we will need to remove forward slashes
6246 IF frontendopsystem = non_unix.
6247 TRANSLATE lowercaselink USING '/_'.
6248 ENDIF.
6249
6250 CONCATENATE copyofcurrentline
6251 lowercaselink "hyperlinkName
6252 period htmlextension '">'
6253 hyperlinkname
6254 '</a>'
6255 period tail INTO copyofcurrentline.
6256
6257 * Pad the string back out with spaces
6258 WHILE copylinelength < currentlinelength.
6259 SHIFT copyofcurrentline RIGHT BY 1 PLACES.
6260 copylinelength = copylinelength + 1.
6261 ENDWHILE.
6262 wacontent = copyofcurrentline.
6263 ELSE.
6264 IF NOT getdictstructures IS INITIAL.
6265 * Hyperlink for structure include e.g. "include structure zfred."
6266 copylinelength = strlen( copyofcurrentline ).
6267 SPLIT copyofcurrentline AT space INTO head tail.
6268 SHIFT tail LEFT DELETING LEADING space.
6269 SPLIT tail AT space INTO head tail.
6270
6271 TRY.
6272 IF tail+0(1) = 'Y' OR tail+0(1) = 'Z' OR tail+0(1) = 'y' OR tail+0(1) = 'z' OR tail CS customernamerange.
6273 CLEAR wacontent.
6274 SHIFT tail LEFT DELETING LEADING space.
6275 SPLIT tail AT period INTO hyperlinkname tail.
6276 copyofcurrentline = 'include structure <a href ='.
6277
6278 lowercaselink = hyperlinkname.
6279 TRANSLATE lowercaselink TO LOWER CASE.
6280 * If we are running on a non UNIX environment we will need to remove forward slashes
6281 IF frontendopsystem = non_unix.
6282 TRANSLATE lowercaselink USING '/_'.
6283 ENDIF.
6284
6285 CONCATENATE copyofcurrentline
6286 '"'
6287 lowercaselink "hyperlinkName
6288 '/'
6289 'dictionary-'
6290 lowercaselink "hyperlinkName
6291 period htmlextension
6292 '">'
6293 hyperlinkname
6294 '</a>'
6295 period tail INTO copyofcurrentline.
6296
6297 * Pad the string back out with spaces
6298 WHILE copylinelength < currentlinelength.
6299 SHIFT copyofcurrentline RIGHT BY 1 PLACES.
6300 copylinelength = copylinelength + 1.
6301 ENDWHILE.
6302 wacontent = copyofcurrentline.
6303 ENDIF.
6304 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
6305 ENDTRY.
6306 ENDIF.
6307 ENDIF.
6308 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
6309 ENDTRY.
6310 ENDIF.
6311 ELSE.
6312 IF NOT syntaxhighlightcomments IS INITIAL AND wacontent+0(1) = asterix.
6313 CONCATENATE '<font color ="' comment_colour '">' INTO head.
6314 CONCATENATE head wacontent '</font>' INTO tail.
6315 wacontent = tail.
6316 ENDIF.
6317 ENDIF.
6318
6319 htmltable = wacontent.
6320
6321 ELSE.
6322 htmltable = ''.
6323 ENDIF.
6324 APPEND htmltable.
6325 ENDLOOP.
6326
6327 htmltable = '</pre>'.
6328 APPEND htmltable.
6329
6330 * Add a html footer to the table
6331 PERFORM addhtmlfooter USING htmltable[].
6332
6333 icontents[] = htmltable[].
6334 ENDFORM. "convertCodeToHtml
6335
6336 *----------------------------------------------------------------------------------------------------------------------
6337 * convertClassToHtml... Builds an HTML table based upon a text table.
6338 *----------------------------------------------------------------------------------------------------------------------
6339 FORM convertclasstohtml USING icontents LIKE dumihtml[]
6340 VALUE(classname)
6341 VALUE(shortdescription)
6342 VALUE(sourcecodetype)
6343 VALUE(syntaxhighlightcomments)
6344 VALUE(htmlextension)
6345 VALUE(customernamerange)
6346 VALUE(getdictstructures).
6347
6348 DATA: htmltable TYPE STANDARD TABLE OF string WITH HEADER LINE.
6349 DATA: listingname TYPE string VALUE 'Code listing for class:'.
6350 DATA: descriptionname TYPE string VALUE `Description: `.
6351 DATA: mytabix TYPE sytabix.
6352 DATA: wacontent(255).
6353 DATA: head TYPE string.
6354 DATA: tail TYPE string.
6355 DATA: hyperlinkname TYPE string.
6356 DATA: lowercaselink TYPE string.
6357 DATA: copyofcurrentline TYPE string.
6358 DATA: currentlinelength TYPE i VALUE 0.
6359 DATA: copylinelength TYPE i VALUE 0.
6360
6361 * Add a html header to the table
6362 PERFORM addhtmlheader USING htmltable[]
6363 classname.
6364
6365 CONCATENATE listingname classname INTO listingname SEPARATED BY space.
6366 CONCATENATE '<font size="3" face = "Arial" color="' colour_black '"><b>' listingname '</b></font>' INTO htmltable.
6367 APPEND htmltable.
6368
6369 IF NOT shortdescription IS INITIAL.
6370 APPEND '<br>' TO htmltable.
6371 CONCATENATE descriptionname shortdescription INTO descriptionname SEPARATED BY space.
6372 CONCATENATE '<font size="3" face = "Arial" color="' colour_black '"><b>' descriptionname '</b></font>' INTO htmltable.
6373 APPEND htmltable.
6374 ENDIF.
6375
6376 htmltable = '<hr>'.
6377 APPEND htmltable.
6378
6379 htmltable = '<pre width="100">'.
6380 APPEND htmltable.
6381
6382 LOOP AT icontents INTO wacontent.
6383 mytabix = sy-tabix.
6384
6385 * Comments
6386 IF NOT syntaxhighlightcomments IS INITIAL AND wacontent+0(1) = asterix.
6387 CONCATENATE '<font color ="' comment_colour '">' INTO head.
6388 CONCATENATE head wacontent '</font>' INTO wacontent.
6389 htmltable = wacontent.
6390 ELSE.
6391 * Smaller than, greater than signs
6392 IF NOT ( icontents IS INITIAL ).
6393 WHILE ( wacontent CS '<' OR wacontent CS '>' ).
6394 REPLACE '<' IN wacontent WITH lt.
6395 REPLACE '>' IN wacontent WITH gt.
6396 ENDWHILE.
6397
6398 * Dictionary structures
6399 IF NOT getdictstructures IS INITIAL.
6400 FIND 'class' IN wacontent IGNORING CASE.
6401 IF sy-subrc <> 0.
6402 * Hyperlink for dictionary/structure include
6403 copylinelength = strlen( wacontent ).
6404 copyofcurrentline = wacontent.
6405 SPLIT copyofcurrentline AT space INTO head tail.
6406 SHIFT tail LEFT DELETING LEADING space.
6407 SPLIT tail AT space INTO head tail.
6408
6409 TRY.
6410 IF tail+0(1) = 'Y' OR tail+0(1) = 'Z' OR tail+0(1) = 'y' OR tail+0(1) = 'z' OR tail CS customernamerange.
6411 CLEAR wacontent.
6412 SHIFT tail LEFT DELETING LEADING space.
6413 SPLIT tail AT period INTO hyperlinkname tail.
6414 copyofcurrentline = 'include structure <a href ='.
6415
6416 lowercaselink = hyperlinkname.
6417 TRANSLATE lowercaselink TO LOWER CASE.
6418 * If we are running on a non UNIX environment we will need to remove forward slashes
6419 IF frontendopsystem = non_unix.
6420 TRANSLATE lowercaselink USING '/_'.
6421 ENDIF.
6422
6423 CONCATENATE copyofcurrentline
6424 '"'
6425 lowercaselink "hyperlinkName
6426 '/'
6427 'dictionary-'
6428 lowercaselink "hyperlinkName
6429 period htmlextension
6430 '">'
6431 hyperlinkname
6432 '</a>'
6433 period tail INTO copyofcurrentline.
6434
6435 * Pad the string back out with spaces
6436 WHILE copylinelength < currentlinelength.
6437 SHIFT copyofcurrentline RIGHT BY 1 PLACES.
6438 copylinelength = copylinelength + 1.
6439 ENDWHILE.
6440 wacontent = copyofcurrentline.
6441 ENDIF.
6442 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
6443 ENDTRY.
6444 ENDIF.
6445 ENDIF.
6446
6447 htmltable = wacontent.
6448 ELSE.
6449 htmltable = ''.
6450 ENDIF.
6451 ENDIF.
6452
6453 APPEND htmltable.
6454 ENDLOOP.
6455
6456 htmltable = '</pre>'.
6457 APPEND htmltable.
6458
6459 * Add a html footer to the table
6460 PERFORM addhtmlfooter USING htmltable[].
6461
6462 icontents[] = htmltable[].
6463 ENDFORM. "convertClassToHtml
6464
6465 *----------------------------------------------------------------------------------------------------------------------
6466 * convertFunctionToHtml... Builds an HTML table based upon a text table.
6467 *----------------------------------------------------------------------------------------------------------------------
6468 FORM convertfunctiontohtml USING icontents LIKE dumihtml[]
6469 VALUE(functionname)
6470 VALUE(shortdescription)
6471 VALUE(sourcecodetype)
6472 VALUE(functiondocumentationexists)
6473 VALUE(ismainfunctioninclude)
6474 VALUE(syntaxhighlightcomments)
6475 VALUE(htmlextension)
6476 VALUE(customernamerange)
6477 VALUE(getincludes)
6478 VALUE(getdictstructures).
6479
6480 DATA: htmltable TYPE STANDARD TABLE OF string WITH HEADER LINE.
6481 DATA: listingname TYPE string VALUE 'Code listing for function:'.
6482 DATA: descriptionname TYPE string VALUE `Description: `.
6483 DATA: head(255).
6484 DATA: tail(255).
6485 DATA: mytabix TYPE sytabix.
6486 DATA: nextline TYPE sytabix.
6487 DATA: hyperlinkname TYPE string.
6488 DATA: copyofcurrentline TYPE string.
6489 DATA: currentlinelength TYPE i VALUE 0.
6490 DATA: copylinelength TYPE i VALUE 0.
6491 DATA: ignorefuturelines TYPE i VALUE false.
6492 DATA: foundasterix TYPE i VALUE false.
6493 DATA: lowercaselink TYPE string.
6494 DATA: wanextline TYPE string.
6495 DATA: wacontent(255).
6496
6497 * Add a html header to the table
6498 PERFORM addhtmlheader USING htmltable[]
6499 functionname.
6500
6501 CONCATENATE listingname functionname INTO listingname SEPARATED BY space.
6502 CONCATENATE '<font size="3" face = "Arial" color="' colour_black '"><b>' listingname '</b></font>' INTO htmltable.
6503 APPEND htmltable.
6504
6505 IF NOT shortdescription IS INITIAL.
6506 APPEND '<br>' TO htmltable.
6507 CONCATENATE descriptionname shortdescription INTO descriptionname SEPARATED BY space.
6508 CONCATENATE '<font size="3" face = "Arial" color="' colour_black '"><b>' descriptionname '</b></font>' INTO htmltable.
6509 APPEND htmltable.
6510 ENDIF.
6511
6512 htmltable = '<hr>'.
6513 APPEND htmltable.
6514
6515 htmltable = '<pre width="100">'.
6516 APPEND htmltable.
6517
6518 LOOP AT icontents INTO wacontent.
6519 mytabix = sy-tabix.
6520
6521 * Extra code for adding global and doc hyperlinks to functions
6522 IF sourcecodetype = is_function AND ismainfunctioninclude = true.
6523 IF sy-tabix > 1.
6524 IF wacontent+0(1) = asterix AND ignorefuturelines = false.
6525 foundasterix = true.
6526 ELSE.
6527 IF foundasterix = true.
6528 * Lets add our extra HTML lines in here
6529 APPEND '' TO htmltable.
6530
6531 * Global data hyperlink
6532 IF NOT syntaxhighlightcomments IS INITIAL.
6533 CONCATENATE '<font color ="' comment_colour '">' INTO copyofcurrentline.
6534 ENDIF.
6535
6536 CONCATENATE copyofcurrentline '* <a href ="' INTO copyofcurrentline.
6537 lowercaselink = functionname.
6538 TRANSLATE lowercaselink TO LOWER CASE.
6539 * If we are running on a non UNIX environment we will need to remove forward slashes
6540 IF frontendopsystem = non_unix.
6541 TRANSLATE lowercaselink USING '/_'.
6542 ENDIF.
6543
6544 CONCATENATE copyofcurrentline 'global-' lowercaselink "functionName
6545 period htmlextension '">' 'Global data declarations' '</a>' INTO copyofcurrentline.
6546
6547 IF NOT syntaxhighlightcomments IS INITIAL.
6548 CONCATENATE copyofcurrentline '</font>' INTO copyofcurrentline.
6549 ENDIF.
6550
6551 APPEND copyofcurrentline TO htmltable.
6552
6553 * Documentation hyperlink.
6554 IF functiondocumentationexists = true.
6555 IF NOT syntaxhighlightcomments IS INITIAL.
6556 CONCATENATE '<font color ="' comment_colour '">' INTO copyofcurrentline.
6557 ENDIF.
6558
6559 CONCATENATE copyofcurrentline '* <a href ="' INTO copyofcurrentline.
6560
6561 lowercaselink = functionname.
6562 TRANSLATE lowercaselink TO LOWER CASE.
6563 * If we are running on a non UNIX environment we will need to remove forward slashes
6564 IF frontendopsystem = non_unix.
6565 TRANSLATE lowercaselink USING '/_'.
6566 ENDIF.
6567
6568 CONCATENATE copyofcurrentline
6569 'docs-'
6570 lowercaselink "functionName
6571 period htmlextension '">'
6572 'Function module documentation'
6573 '</a>'
6574 INTO copyofcurrentline.
6575
6576 IF NOT pcomm IS INITIAL.
6577 CONCATENATE copyofcurrentline '</font>' INTO copyofcurrentline.
6578 ENDIF.
6579 APPEND copyofcurrentline TO htmltable.
6580 ENDIF.
6581
6582 foundasterix = false.
6583 ignorefuturelines = true.
6584 ENDIF.
6585 ENDIF.
6586 ENDIF.
6587 ENDIF.
6588
6589 * Carry on as normal
6590 IF NOT ( icontents IS INITIAL ).
6591 WHILE ( wacontent CS '<' OR wacontent CS '>' ).
6592 REPLACE '<' IN wacontent WITH lt.
6593 REPLACE '>' IN wacontent WITH gt.
6594 ENDWHILE.
6595
6596 IF wacontent+0(1) <> asterix.
6597 currentlinelength = strlen( wacontent ).
6598
6599 * Don't hyperlink anything for files of type documentation
6600 IF sourcecodetype <> is_documentation.
6601 * Check for any functions to highlight
6602 IF ( wacontent CS callfunction ) AND ( wacontent <> 'DESTINATION' ).
6603 nextline = mytabix + 1.
6604 READ TABLE icontents INTO wanextline INDEX nextline.
6605 TRANSLATE wanextline TO UPPER CASE.
6606 IF wanextline NS 'DESTINATION'.
6607 copyofcurrentline = wacontent.
6608 SHIFT copyofcurrentline LEFT DELETING LEADING space.
6609
6610 copylinelength = strlen( copyofcurrentline ).
6611
6612 SPLIT copyofcurrentline AT space INTO head tail.
6613 SPLIT tail AT space INTO head tail.
6614 SPLIT tail AT space INTO head tail.
6615 * Function name is now in head
6616 TRANSLATE head USING ''' '.
6617 SHIFT head LEFT DELETING LEADING space.
6618
6619 TRY.
6620 IF head+0(1) = 'Y' OR head+0(1) = 'Z' OR head+0(1) = 'y' OR head+0(1) = 'z' OR head CS customernamerange.
6621
6622 * Definately a customer function module
6623 hyperlinkname = head.
6624
6625 IF sourcecodetype = is_function.
6626 copyofcurrentline = 'call function <a href ="../'.
6627 ELSE.
6628 copyofcurrentline = 'call function <a href ="'.
6629 ENDIF.
6630
6631 lowercaselink = hyperlinkname.
6632 TRANSLATE lowercaselink TO LOWER CASE.
6633 * If we are running on a non UNIX environment we will need to remove forward slashes
6634 IF frontendopsystem = non_unix.
6635 TRANSLATE lowercaselink USING '/_'.
6636 ENDIF.
6637
6638 CONCATENATE copyofcurrentline
6639 lowercaselink "hyperlinkName
6640 '/'
6641 lowercaselink "hyperlinkName
6642 period htmlextension '">'
6643 ''''
6644 hyperlinkname
6645 ''''
6646 '</a>'
6647 tail INTO copyofcurrentline.
6648
6649 * Pad the string back out with spaces
6650 WHILE copylinelength < currentlinelength.
6651 SHIFT copyofcurrentline RIGHT BY 1 PLACES.
6652 copylinelength = copylinelength + 1.
6653 ENDWHILE.
6654
6655 wacontent = copyofcurrentline.
6656 ENDIF.
6657 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
6658 ENDTRY.
6659 ENDIF.
6660 ENDIF.
6661 ENDIF.
6662
6663 * Check for any customer includes to hyperlink
6664 IF wacontent CS include OR wacontent CS lowinclude.
6665 copyofcurrentline = wacontent.
6666
6667 SHIFT copyofcurrentline LEFT DELETING LEADING space.
6668 copylinelength = strlen( copyofcurrentline ).
6669
6670 SPLIT copyofcurrentline AT space INTO head tail.
6671 SHIFT tail LEFT DELETING LEADING space.
6672
6673 TRY.
6674 IF ( tail+0(1) = 'Y' OR tail+0(1) = 'Z' OR tail+0(1) = 'y' OR tail+0(1) = 'z'
6675 OR tail CS customernamerange OR tail+0(2) = 'mz' OR tail+0(2) = 'MZ' ) AND NOT getincludes IS INITIAL.
6676
6677 * Hyperlink for program includes
6678 CLEAR wacontent.
6679 SHIFT tail LEFT DELETING LEADING space.
6680 SPLIT tail AT period INTO hyperlinkname tail.
6681 copyofcurrentline = 'include <a href ="'.
6682
6683 lowercaselink = hyperlinkname.
6684 TRANSLATE lowercaselink TO LOWER CASE.
6685 * If we are running on a non UNIX environment we will need to remove forward slashes
6686 IF frontendopsystem = non_unix.
6687 TRANSLATE lowercaselink USING '/_'.
6688 ENDIF.
6689
6690 CONCATENATE copyofcurrentline
6691 lowercaselink "hyperlinkName
6692 period htmlextension '">'
6693 hyperlinkname
6694 '</a>'
6695 period tail INTO copyofcurrentline.
6696
6697 * Pad the string back out with spaces
6698 WHILE copylinelength < currentlinelength.
6699 SHIFT copyofcurrentline RIGHT BY 1 PLACES.
6700 copylinelength = copylinelength + 1.
6701 ENDWHILE.
6702 wacontent = copyofcurrentline.
6703 ELSE.
6704 IF NOT getdictstructures IS INITIAL.
6705 * Hyperlink for structure include
6706 copylinelength = strlen( copyofcurrentline ).
6707 SPLIT copyofcurrentline AT space INTO head tail.
6708 SHIFT tail LEFT DELETING LEADING space.
6709 SPLIT tail AT space INTO head tail.
6710
6711 TRY.
6712 IF tail+0(1) = 'Y' OR tail+0(1) = 'Z' OR tail+0(1) = 'y' OR tail+0(1) = 'z' OR tail CS customernamerange.
6713 CLEAR wacontent.
6714 SHIFT tail LEFT DELETING LEADING space.
6715 SPLIT tail AT period INTO hyperlinkname tail.
6716 copyofcurrentline = 'include structure <a href ='.
6717
6718 lowercaselink = hyperlinkname.
6719 TRANSLATE lowercaselink TO LOWER CASE.
6720 * If we are running on a non UNIX environment we will need to remove forward slashes
6721 IF frontendopsystem = non_unix.
6722 TRANSLATE lowercaselink USING '/_'.
6723 ENDIF.
6724
6725 CONCATENATE copyofcurrentline
6726 '"'
6727 lowercaselink "hyperlinkName
6728 '/'
6729 'dictionary-'
6730 lowercaselink "hyperlinkName
6731 period htmlextension
6732 '">'
6733 hyperlinkname
6734 '</a>'
6735 period tail INTO copyofcurrentline.
6736
6737 * Pad the string back out with spaces
6738 WHILE copylinelength < currentlinelength.
6739 SHIFT copyofcurrentline RIGHT BY 1 PLACES.
6740 copylinelength = copylinelength + 1.
6741 ENDWHILE.
6742 wacontent = copyofcurrentline.
6743 ENDIF.
6744 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
6745 ENDTRY.
6746 ENDIF.
6747 ENDIF.
6748 CATCH cx_sy_range_out_of_bounds INTO objruntimeerror.
6749 ENDTRY.
6750 ENDIF.
6751 ELSE.
6752 IF NOT syntaxhighlightcomments IS INITIAL AND wacontent+0(1) = asterix.
6753 CONCATENATE '<font color ="' comment_colour '">' INTO head.
6754 CONCATENATE head wacontent '</font>' INTO tail.
6755 wacontent = tail.
6756 ENDIF.
6757 ENDIF.
6758
6759 htmltable = wacontent.
6760
6761 ELSE.
6762 htmltable = ''.
6763 ENDIF.
6764 APPEND htmltable.
6765 ENDLOOP.
6766
6767 htmltable = '</pre>'.
6768 APPEND htmltable.
6769
6770 * Add a html footer to the table
6771 PERFORM addhtmlfooter USING htmltable[].
6772
6773 icontents[] = htmltable[].
6774 ENDFORM. "convertFunctionToHtml
6775
6776 *----------------------------------------------------------------------------------------------------------------------
6777 * buildColumnHeaders... build table column names
6778 *----------------------------------------------------------------------------------------------------------------------
6779 FORM buildcolumnheaders USING iloccolumncaptions LIKE dumihtml[].
6780
6781 APPEND 'Row' TO iloccolumncaptions.
6782 APPEND 'Field name' TO iloccolumncaptions.
6783 APPEND 'Position' TO iloccolumncaptions.
6784 APPEND 'Key' TO iloccolumncaptions.
6785 APPEND 'Data element' TO iloccolumncaptions.
6786 APPEND 'Domain' TO iloccolumncaptions.
6787 APPEND 'Datatype' TO iloccolumncaptions.
6788 APPEND 'Length' TO iloccolumncaptions.
6789 APPEND 'Domain text' TO iloccolumncaptions.
6790 ENDFORM. "buildColumnHeaders
6791
6792 *----------------------------------------------------------------------------------------------------------------------
6793 * addHTMLHeader... add a html formatted header to our output table
6794 *----------------------------------------------------------------------------------------------------------------------
6795 FORM addhtmlheader USING ilocheader LIKE dumihtml[]
6796 VALUE(title).
6797
6798 DATA: waheader TYPE string.
6799
6800 APPEND '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">' TO ilocheader.
6801 APPEND '<html>' TO ilocheader.
6802 APPEND '<head>' TO ilocheader.
6803
6804 CONCATENATE '<title>' title '</title>' INTO waheader.
6805 APPEND waheader TO ilocheader.
6806
6807 APPEND '</head>' TO ilocheader.
6808
6809 IF NOT pback IS INITIAL.
6810 CONCATENATE '<body bgcolor="' background_colour '">' INTO waheader.
6811 ELSE.
6812 CONCATENATE '<body bgcolor="' colour_white '">' INTO waheader.
6813 ENDIF.
6814
6815 APPEND waheader TO ilocheader.
6816 ENDFORM. "addHTMLHeader
6817
6818 *----------------------------------------------------------------------------------------------------------------------
6819 * addHTMLFooter... add a html formatted footer to our output table
6820 *----------------------------------------------------------------------------------------------------------------------
6821 FORM addhtmlfooter USING ilocfooter LIKE dumihtml[].
6822
6823 DATA: footermessage TYPE string.
6824 DATA: wafooter TYPE string.
6825
6826 PERFORM buildfootermessage USING 'HTML'
6827 footermessage.
6828
6829 APPEND '<hr>' TO ilocfooter.
6830 CONCATENATE '<font size="2" face = "Sans Serif">' footermessage INTO wafooter.
6831 APPEND wafooter TO ilocfooter.
6832 APPEND '</font>' TO ilocfooter.
6833 APPEND '</body>' TO ilocfooter.
6834 APPEND '</html>' TO ilocfooter.
6835 ENDFORM. "addHTMLFooter
6836
6837 *----------------------------------------------------------------------------------------------------------------------
6838 * buildFooterMessage...Returns a footer message based on the output file type.
6839 *----------------------------------------------------------------------------------------------------------------------
6840 FORM buildfootermessage USING filetype
6841 returnmessage.
6842
6843 IF filetype = 'HTML'.
6844 CONCATENATE `Extracted by Direct Download Enterprise version `
6845 versionno ` - E.G.Mellodew. 1998-2005 UK. Sap Release ` sy-saprl
6846 INTO returnmessage.
6847 ELSE.
6848 CONCATENATE `Extracted by Direct Download Enterprise version `
6849 versionno ` - E.G.Mellodew. 1998-2005 UK. Sap Release ` sy-saprl
6850 INTO returnmessage.
6851 ENDIF.
6852 ENDFORM. "buildFooterMessage
6853
6854 ***********************************************************************************************************************
6855 ********************************************DISPLAY ROUTINES***********************************************************
6856 ***********************************************************************************************************************
6857
6858 *----------------------------------------------------------------------------------------------------------------------
6859 * fillTreeNodeTables...
6860 *----------------------------------------------------------------------------------------------------------------------
6861 FORM filltreenodetables USING ilocdictionary LIKE idictionary[]
6862 iloctreedisplay LIKE itreedisplay[]
6863 VALUE(runtime).
6864
6865 DATA: tablelines TYPE i.
6866 DATA: watreedisplay LIKE snodetext.
6867 FIELD-SYMBOLS: <wadictionary> TYPE tdicttable.
6868 DATA: tablelinesstring TYPE string.
6869 DATA: runtimechar(10).
6870 DATA: sublevel TYPE string.
6871
6872 tablelines = lines( ilocdictionary ).
6873 tablelinesstring = tablelines.
6874
6875 IF tablelines = 1.
6876 CONCATENATE tablelinesstring 'table downloaded' INTO watreedisplay-text2 SEPARATED BY space.
6877 ELSE.
6878 CONCATENATE tablelinesstring 'tables downloaded' INTO watreedisplay-text2 SEPARATED BY space.
6879 ENDIF.
6880
6881 WRITE runtime TO runtimechar.
6882 CONCATENATE watreedisplay-text2 '- runtime' runtimechar INTO watreedisplay-text2 SEPARATED BY space.
6883
6884 * include header display record.
6885 watreedisplay-tlevel = '1'.
6886 watreedisplay-tlength2 = 60.
6887 watreedisplay-tcolor2 = 1.
6888 APPEND watreedisplay TO iloctreedisplay.
6889
6890 LOOP AT ilocdictionary ASSIGNING <wadictionary>.
6891 watreedisplay-tlevel = '2'.
6892 watreedisplay-text2 = <wadictionary>-tablename.
6893 watreedisplay-tcolor2 = 3.
6894 watreedisplay-tlength3 = 80.
6895 watreedisplay-tcolor3 = 3.
6896 watreedisplay-tpos3 = 60.
6897 CONCATENATE 'Dictionary:' <wadictionary>-tabletitle INTO watreedisplay-text3 SEPARATED BY space.
6898
6899 APPEND watreedisplay TO iloctreedisplay.
6900 ENDLOOP.
6901 ENDFORM. "fillTreeNodeTables
6902
6903 *----------------------------------------------------------------------------------------------------------------------
6904 * fillTreeNodeMessages...
6905 *----------------------------------------------------------------------------------------------------------------------
6906 FORM filltreenodemessages USING ilocmessages LIKE imessages[]
6907 iloctreedisplay LIKE itreedisplay[]
6908 VALUE(runtime).
6909
6910 DATA: tablelines TYPE i.
6911 DATA: watreedisplay LIKE snodetext.
6912 FIELD-SYMBOLS: <wamessage> TYPE tmessage.
6913 DATA: tablelinesstring TYPE string.
6914 DATA: runtimechar(10).
6915
6916 SORT ilocmessages ASCENDING BY arbgb.
6917
6918 LOOP AT ilocmessages ASSIGNING <wamessage>.
6919 AT NEW arbgb.
6920 tablelines = tablelines + 1.
6921 ENDAT.
6922 ENDLOOP.
6923 tablelinesstring = tablelines.
6924
6925 IF tablelines = 1.
6926 CONCATENATE tablelinesstring 'message class downloaded' INTO watreedisplay-text2 SEPARATED BY space.
6927 ELSE.
6928 CONCATENATE tablelinesstring 'message classes downloaded' INTO watreedisplay-text2 SEPARATED BY space.
6929 ENDIF.
6930
6931 WRITE runtime TO runtimechar.
6932 CONCATENATE watreedisplay-text2 '- runtime' runtimechar INTO watreedisplay-text2 SEPARATED BY space.
6933
6934 * include header display record.
6935 watreedisplay-tlevel = '1'.
6936 watreedisplay-tlength2 = 60.
6937 watreedisplay-tcolor2 = 1.
6938 APPEND watreedisplay TO iloctreedisplay.
6939
6940 LOOP AT ilocmessages ASSIGNING <wamessage>.
6941 AT NEW arbgb.
6942 watreedisplay-tlevel = '2'.
6943 watreedisplay-text2 = <wamessage>-arbgb.
6944 watreedisplay-tcolor2 = 5.
6945 watreedisplay-tlength3 = 80.
6946 watreedisplay-tcolor3 = 5.
6947 watreedisplay-tpos3 = 60.
6948 watreedisplay-text3 = <wamessage>-stext.
6949 CONCATENATE 'Message class:' watreedisplay-text3 INTO watreedisplay-text3 SEPARATED BY space.
6950 APPEND watreedisplay TO iloctreedisplay.
6951 ENDAT.
6952 ENDLOOP.
6953 ENDFORM. "fillTreeNodeMessages
6954
6955 *----------------------------------------------------------------------------------------------------------------------
6956 * fillTreeNodeFunctions...
6957 *----------------------------------------------------------------------------------------------------------------------
6958 FORM filltreenodefunctions USING ilocfunctions LIKE ifunctions[]
6959 iloctreedisplay LIKE itreedisplay[]
6960 VALUE(runtime).
6961
6962 DATA: tablelines TYPE i.
6963 DATA: watreedisplay LIKE snodetext.
6964 FIELD-SYMBOLS: <wafunction> TYPE tfunction.
6965 FIELD-SYMBOLS: <wascreen> TYPE tscreenflow.
6966 FIELD-SYMBOLS: <waguititle> TYPE tguititle.
6967 FIELD-SYMBOLS: <wadictionary> TYPE tdicttable.
6968 FIELD-SYMBOLS: <wainclude> TYPE tinclude.
6969 FIELD-SYMBOLS: <wamessage> TYPE tmessage.
6970 DATA: tablelinesstring TYPE string.
6971 DATA: runtimechar(10).
6972
6973 SORT ilocfunctions ASCENDING BY functionname.
6974
6975 tablelines = lines( ilocfunctions ).
6976 tablelinesstring = tablelines.
6977
6978 IF tablelines = 1.
6979 CONCATENATE tablelinesstring ` function downloaded` INTO watreedisplay-text2.
6980 ELSE.
6981 CONCATENATE tablelinesstring ` functions downloaded` INTO watreedisplay-text2.
6982 ENDIF.
6983
6984 WRITE runtime TO runtimechar.
6985
6986 CONCATENATE watreedisplay-text2 ` - runtime ` runtimechar INTO watreedisplay-text2.
6987 * include header display record.
6988 watreedisplay-tlevel = '1'.
6989 watreedisplay-tlength2 = 60.
6990 watreedisplay-tcolor2 = 1.
6991 APPEND watreedisplay TO iloctreedisplay.
6992
6993 * Lets fill the detail in
6994 LOOP AT ilocfunctions ASSIGNING <wafunction>.
6995 watreedisplay-tlevel = 2.
6996 watreedisplay-text2 = <wafunction>-functionname.
6997 watreedisplay-tcolor2 = 7.
6998 watreedisplay-tlength3 = 80.
6999 watreedisplay-tcolor3 = 7.
7000 watreedisplay-tpos3 = 60.
7001 CONCATENATE `Function: ` <wafunction>-functionname INTO watreedisplay-text3.
7002 APPEND watreedisplay TO iloctreedisplay.
7003
7004 * Screens.
7005 LOOP AT <wafunction>-iscreenflow ASSIGNING <wascreen>.
7006 watreedisplay-tlevel = '2'.
7007 watreedisplay-text2 = <wascreen>-screen.
7008 watreedisplay-tcolor2 = 6.
7009 watreedisplay-tlength3 = 80.
7010 watreedisplay-tcolor3 = 6.
7011 watreedisplay-tpos3 = 60.
7012 watreedisplay-text3 = 'Screen'.
7013 APPEND watreedisplay TO itreedisplay.
7014 ENDLOOP.
7015
7016 * GUI Title.
7017 LOOP AT <wafunction>-iguititle ASSIGNING <waguititle>.
7018 watreedisplay-tlevel = '2'.
7019 watreedisplay-text2 = <waguititle>-obj_code.
7020 watreedisplay-tcolor2 = 6.
7021 watreedisplay-tlength3 = 80.
7022 watreedisplay-tcolor3 = 6.
7023 watreedisplay-tpos3 = 60.
7024 watreedisplay-text3 = 'GUI Title'.
7025 APPEND watreedisplay TO itreedisplay.
7026 ENDLOOP.
7027
7028 * Fill in the tree with include information
7029 LOOP AT <wafunction>-iincludes ASSIGNING <wainclude>.
7030 watreedisplay-tlevel = 3.
7031 watreedisplay-text2 = <wainclude>-includename.
7032 watreedisplay-tcolor2 = 4.
7033 watreedisplay-tlength3 = 80.
7034 watreedisplay-tcolor3 = 4.
7035 watreedisplay-tpos3 = 60.
7036 CONCATENATE `Include: ` <wainclude>-includetitle INTO watreedisplay-text3.
7037 APPEND watreedisplay TO iloctreedisplay.
7038 ENDLOOP.
7039
7040 * fill in the tree with dictionary information
7041 LOOP AT <wafunction>-idictstruct ASSIGNING <wadictionary>.
7042 watreedisplay-tlevel = 3.
7043 watreedisplay-text2 = <wadictionary>-tablename.
7044 watreedisplay-tcolor2 = 3.
7045 watreedisplay-tlength3 = 80.
7046 watreedisplay-tcolor3 = 3.
7047 watreedisplay-tpos3 = 60.
7048 CONCATENATE `Dictionary:` <wadictionary>-tabletitle INTO watreedisplay-text3.
7049 APPEND watreedisplay TO iloctreedisplay.
7050 ENDLOOP.
7051
7052 * fill in the tree with message information
7053 SORT <wafunction>-imessages[] ASCENDING BY arbgb.
7054 LOOP AT <wafunction>-imessages ASSIGNING <wamessage>.
7055 AT NEW arbgb.
7056 watreedisplay-tlevel = 3.
7057 watreedisplay-text2 = <wamessage>-arbgb.
7058 watreedisplay-tcolor2 = 5.
7059 watreedisplay-tlength3 = 80.
7060 watreedisplay-tcolor3 = 5.
7061 watreedisplay-tpos3 = 60.
7062
7063 * Select the message class text if we do not have it already
7064 IF <wamessage>-stext IS INITIAL.
7065 SELECT SINGLE stext FROM t100a
7066 INTO <wamessage>-stext
7067 WHERE arbgb = <wamessage>-arbgb.
7068 ENDIF.
7069
7070 watreedisplay-text3 = <wamessage>-stext.
7071 CONCATENATE `Message class: ` watreedisplay-text3 INTO watreedisplay-text3.
7072 APPEND watreedisplay TO iloctreedisplay.
7073 ENDAT.
7074 ENDLOOP.
7075 ENDLOOP.
7076 ENDFORM. "fillTreeNodeFunctions
7077
7078 *----------------------------------------------------------------------------------------------------------------------
7079 * fillTreeNodePrograms
7080 *----------------------------------------------------------------------------------------------------------------------
7081 FORM filltreenodeprograms USING ilocprograms LIKE iprograms[]
7082 ilocfunctions LIKE ifunctions[]
7083 iloctreedisplay LIKE itreedisplay[]
7084 VALUE(runtime).
7085
7086 DATA: tablelines TYPE i.
7087 DATA: watreedisplay LIKE snodetext.
7088 FIELD-SYMBOLS: <waprogram> TYPE tprogram.
7089 FIELD-SYMBOLS: <wascreen> TYPE tscreenflow.
7090 FIELD-SYMBOLS: <wafunction> TYPE tfunction.
7091 FIELD-SYMBOLS: <wadictionary> TYPE tdicttable.
7092 FIELD-SYMBOLS: <wainclude> TYPE tinclude.
7093 FIELD-SYMBOLS: <wamessage> TYPE tmessage.
7094 DATA: tablelinesstring TYPE string.
7095 DATA: runtimechar(10).
7096
7097 tablelines = lines( ilocprograms ).
7098 tablelinesstring = tablelines.
7099
7100 IF tablelines = 1.
7101 CONCATENATE tablelinesstring ` program downloaded` INTO watreedisplay-text2.
7102 ELSE.
7103 CONCATENATE tablelinesstring ` programs downloaded` INTO watreedisplay-text2.
7104 ENDIF.
7105
7106 WRITE runtime TO runtimechar.
7107
7108 CONCATENATE watreedisplay-text2 ` - runtime ` runtimechar INTO watreedisplay-text2.
7109 * include header display record.
7110 watreedisplay-tlevel = '1'.
7111 watreedisplay-tlength2 = 60.
7112 watreedisplay-tcolor2 = 1.
7113 APPEND watreedisplay TO itreedisplay.
7114
7115 LOOP AT ilocprograms ASSIGNING <waprogram>.
7116 * Main programs.
7117 watreedisplay-tlevel = '2'.
7118 watreedisplay-text2 = <waprogram>-progname.
7119 watreedisplay-tcolor2 = 1.
7120 * Description
7121 watreedisplay-tlength3 = 80.
7122 watreedisplay-tcolor3 = 1.
7123 watreedisplay-tpos3 = 60.
7124 CONCATENATE `Program: ` <waprogram>-programtitle INTO watreedisplay-text3.
7125 APPEND watreedisplay TO itreedisplay.
7126 * Screens.
7127 LOOP AT <waprogram>-iscreenflow ASSIGNING <wascreen>.
7128 watreedisplay-tlevel = '3'.
7129 watreedisplay-text2 = <wascreen>-screen.
7130 watreedisplay-tcolor2 = 6.
7131 watreedisplay-tlength3 = 80.
7132 watreedisplay-tcolor3 = 6.
7133 watreedisplay-tpos3 = 60.
7134 watreedisplay-text3 = 'Screen'.
7135 APPEND watreedisplay TO itreedisplay.
7136 ENDLOOP.
7137 * fill in the tree with message information
7138 SORT <waprogram>-imessages[] ASCENDING BY arbgb.
7139 LOOP AT <waprogram>-imessages ASSIGNING <wamessage>.
7140 AT NEW arbgb.
7141 watreedisplay-tlevel = 3.
7142 watreedisplay-text2 = <wamessage>-arbgb.
7143 watreedisplay-tcolor2 = 5.
7144 watreedisplay-tlength3 = 80.
7145 watreedisplay-tcolor3 = 5.
7146 watreedisplay-tpos3 = 60.
7147
7148 * Select the message class text if we do not have it already
7149 IF <wamessage>-stext IS INITIAL.
7150 SELECT SINGLE stext FROM t100a
7151 INTO <wamessage>-stext
7152 WHERE arbgb = <wamessage>-arbgb.
7153 ENDIF.
7154
7155 watreedisplay-text3 = <wamessage>-stext.
7156 CONCATENATE `Message class: ` watreedisplay-text3 INTO watreedisplay-text3.
7157 APPEND watreedisplay TO iloctreedisplay.
7158 ENDAT.
7159 ENDLOOP.
7160 * Fill in the tree with include information
7161 LOOP AT <waprogram>-iincludes ASSIGNING <wainclude>.
7162 watreedisplay-tlevel = 3.
7163 watreedisplay-text2 = <wainclude>-includename.
7164 watreedisplay-tcolor2 = 4.
7165 watreedisplay-tlength3 = 80.
7166 watreedisplay-tcolor3 = 4.
7167 watreedisplay-tpos3 = 60.
7168 CONCATENATE `Include: ` <wainclude>-includetitle INTO watreedisplay-text3.
7169 APPEND watreedisplay TO iloctreedisplay.
7170 ENDLOOP.
7171 * fill in the tree with dictionary information
7172 LOOP AT <waprogram>-idictstruct ASSIGNING <wadictionary>.
7173 watreedisplay-tlevel = 3.
7174 watreedisplay-text2 = <wadictionary>-tablename.
7175 watreedisplay-tcolor2 = 3.
7176 watreedisplay-tlength3 = 80.
7177 watreedisplay-tcolor3 = 3.
7178 watreedisplay-tpos3 = 60.
7179 CONCATENATE `Dictionary: ` <wadictionary>-tabletitle INTO watreedisplay-text3.
7180 APPEND watreedisplay TO iloctreedisplay.
7181 ENDLOOP.
7182
7183 * Function Modules
7184 LOOP AT ilocfunctions ASSIGNING <wafunction> WHERE programlinkname = <waprogram>-progname.
7185 watreedisplay-tlevel = 3.
7186 watreedisplay-text2 = <wafunction>-functionname.
7187 watreedisplay-tcolor2 = 7.
7188 watreedisplay-tlength3 = 80.
7189 watreedisplay-tcolor3 = 7.
7190 watreedisplay-tpos3 = 60.
7191 CONCATENATE `Function: ` <wafunction>-functionname INTO watreedisplay-text3.
7192 APPEND watreedisplay TO iloctreedisplay.
7193
7194 * Fill in the tree with include information
7195 LOOP AT <wafunction>-iincludes ASSIGNING <wainclude>.
7196 watreedisplay-tlevel = 4.
7197 watreedisplay-text2 = <wainclude>-includename.
7198 watreedisplay-tcolor2 = 4.
7199 watreedisplay-tlength3 = 80.
7200 watreedisplay-tcolor3 = 4.
7201 watreedisplay-tpos3 = 60.
7202 CONCATENATE `Include: ` <wainclude>-includetitle INTO watreedisplay-text3.
7203 APPEND watreedisplay TO iloctreedisplay.
7204 ENDLOOP.
7205
7206 * fill in the tree with dictionary information
7207 LOOP AT <wafunction>-idictstruct ASSIGNING <wadictionary>.
7208 watreedisplay-tlevel = 4.
7209 watreedisplay-text2 = <wadictionary>-tablename.
7210 watreedisplay-tcolor2 = 3.
7211 watreedisplay-tlength3 = 80.
7212 watreedisplay-tcolor3 = 3.
7213 watreedisplay-tpos3 = 60.
7214 CONCATENATE `Dictionary: ` <wadictionary>-tabletitle INTO watreedisplay-text3.
7215 APPEND watreedisplay TO iloctreedisplay.
7216 ENDLOOP.
7217
7218 * fill in the tree with message information
7219 SORT <wafunction>-imessages[] ASCENDING BY arbgb.
7220 LOOP AT <wafunction>-imessages ASSIGNING <wamessage>.
7221 AT NEW arbgb.
7222 watreedisplay-tlevel = 4.
7223 watreedisplay-text2 = <wamessage>-arbgb.
7224 watreedisplay-tcolor2 = 5.
7225 watreedisplay-tlength3 = 80.
7226 watreedisplay-tcolor3 = 5.
7227 watreedisplay-tpos3 = 60.
7228
7229 * Select the message class text if we do not have it already
7230 IF <wamessage>-stext IS INITIAL.
7231 SELECT SINGLE stext FROM t100a
7232 INTO <wamessage>-stext
7233 WHERE arbgb = <wamessage>-arbgb.
7234 ENDIF.
7235
7236 watreedisplay-text3 = <wamessage>-stext.
7237 CONCATENATE `Message class: ` watreedisplay-text3 INTO watreedisplay-text3.
7238 APPEND watreedisplay TO iloctreedisplay.
7239 ENDAT.
7240 ENDLOOP.
7241 ENDLOOP.
7242 ENDLOOP.
7243 ENDFORM. "fillTreeNodePrograms
7244
7245 *----------------------------------------------------------------------------------------------------------------------
7246 * fillTreeNodeClasses
7247 *----------------------------------------------------------------------------------------------------------------------
7248 FORM filltreenodeclasses USING ilocclasses LIKE iclasses[]
7249 ilocfunctions LIKE ifunctions[]
7250 iloctreedisplay LIKE itreedisplay[]
7251 VALUE(runtime).
7252
7253 DATA: tablelines TYPE i.
7254 DATA: watreedisplay LIKE snodetext.
7255 FIELD-SYMBOLS: <waclass> TYPE tclass.
7256 FIELD-SYMBOLS: <wamethod> TYPE tmethod.
7257 FIELD-SYMBOLS: <wafunction> TYPE tfunction.
7258 FIELD-SYMBOLS: <wadictionary> TYPE tdicttable.
7259 FIELD-SYMBOLS: <wainclude> TYPE tinclude.
7260 FIELD-SYMBOLS: <wamessage> TYPE tmessage.
7261 DATA: tablelinesstring TYPE string.
7262 DATA: runtimechar(10).
7263
7264 tablelines = lines( ilocclasses ).
7265 tablelinesstring = tablelines.
7266
7267 IF tablelines = 1.
7268 CONCATENATE tablelinesstring ` class downloaded` INTO watreedisplay-text2.
7269 ELSE.
7270 CONCATENATE tablelinesstring ` classes downloaded` INTO watreedisplay-text2.
7271 ENDIF.
7272
7273 WRITE runtime TO runtimechar.
7274
7275 CONCATENATE watreedisplay-text2 ` - runtime ` runtimechar INTO watreedisplay-text2.
7276 * include header display record.
7277 watreedisplay-tlevel = '1'.
7278 watreedisplay-tlength2 = 60.
7279 watreedisplay-tcolor2 = 1.
7280 APPEND watreedisplay TO itreedisplay.
7281
7282 LOOP AT ilocclasses ASSIGNING <waclass>.
7283 * Main Class.
7284 watreedisplay-tlevel = '2'.
7285 watreedisplay-text2 = <waclass>-clsname.
7286 watreedisplay-tcolor2 = 1.
7287 * Description
7288 watreedisplay-tlength3 = 80.
7289 watreedisplay-tcolor3 = 1.
7290 watreedisplay-tpos3 = 60.
7291 CONCATENATE `Class: ` <waclass>-descript INTO watreedisplay-text3.
7292 APPEND watreedisplay TO itreedisplay.
7293
7294 * fill in the tree with method information
7295 LOOP AT <waclass>-imethods[] ASSIGNING <wamethod>.
7296 watreedisplay-tlevel = 3.
7297 watreedisplay-text2 = <wamethod>-cmpname.
7298 watreedisplay-tcolor2 = 2.
7299 watreedisplay-tlength3 = 80.
7300 watreedisplay-tcolor3 = 2.
7301 watreedisplay-tpos3 = 60.
7302 CONCATENATE `Method: ` <wamethod>-descript INTO watreedisplay-text3.
7303 APPEND watreedisplay TO iloctreedisplay.
7304 ENDLOOP.
7305
7306 * fill in the tree with message information
7307 SORT <waclass>-imessages[] ASCENDING BY arbgb.
7308 LOOP AT <waclass>-imessages ASSIGNING <wamessage>.
7309 AT NEW arbgb.
7310 watreedisplay-tlevel = 3.
7311 watreedisplay-text2 = <wamessage>-arbgb.
7312 watreedisplay-tcolor2 = 5.
7313 watreedisplay-tlength3 = 80.
7314 watreedisplay-tcolor3 = 5.
7315 watreedisplay-tpos3 = 60.
7316
7317 * Select the message class text if we do not have it already
7318 IF <wamessage>-stext IS INITIAL.
7319 SELECT SINGLE stext FROM t100a
7320 INTO <wamessage>-stext
7321 WHERE arbgb = <wamessage>-arbgb.
7322 ENDIF.
7323
7324 watreedisplay-text3 = <wamessage>-stext.
7325 CONCATENATE `Message class: ` watreedisplay-text3 INTO watreedisplay-text3.
7326 APPEND watreedisplay TO iloctreedisplay.
7327 ENDAT.
7328 ENDLOOP.
7329
7330 * fill in the tree with dictionary information
7331 LOOP AT <waclass>-idictstruct ASSIGNING <wadictionary>.
7332 watreedisplay-tlevel = 3.
7333 watreedisplay-text2 = <wadictionary>-tablename.
7334 watreedisplay-tcolor2 = 3.
7335 watreedisplay-tlength3 = 80.
7336 watreedisplay-tcolor3 = 3.
7337 watreedisplay-tpos3 = 60.
7338 CONCATENATE `Dictionary: ` <wadictionary>-tabletitle INTO watreedisplay-text3.
7339 APPEND watreedisplay TO iloctreedisplay.
7340 ENDLOOP.
7341
7342 * Function Modules
7343 LOOP AT ilocfunctions ASSIGNING <wafunction> WHERE programlinkname = <waclass>-clsname.
7344 watreedisplay-tlevel = 3.
7345 watreedisplay-text2 = <wafunction>-functionname.
7346 watreedisplay-tcolor2 = 7.
7347 watreedisplay-tlength3 = 80.
7348 watreedisplay-tcolor3 = 7.
7349 watreedisplay-tpos3 = 60.
7350 CONCATENATE `Function: ` <wafunction>-functionname INTO watreedisplay-text3.
7351 APPEND watreedisplay TO iloctreedisplay.
7352
7353 * Fill in the tree with include information
7354 LOOP AT <wafunction>-iincludes ASSIGNING <wainclude>.
7355 watreedisplay-tlevel = 4.
7356 watreedisplay-text2 = <wainclude>-includename.
7357 watreedisplay-tcolor2 = 4.
7358 watreedisplay-tlength3 = 80.
7359 watreedisplay-tcolor3 = 4.
7360 watreedisplay-tpos3 = 60.
7361 CONCATENATE `Include: ` <wainclude>-includetitle INTO watreedisplay-text3.
7362 APPEND watreedisplay TO iloctreedisplay.
7363 ENDLOOP.
7364
7365 * fill in the tree with dictionary information
7366 LOOP AT <wafunction>-idictstruct ASSIGNING <wadictionary>.
7367 watreedisplay-tlevel = 4.
7368 watreedisplay-text2 = <wadictionary>-tablename.
7369 watreedisplay-tcolor2 = 3.
7370 watreedisplay-tlength3 = 80.
7371 watreedisplay-tcolor3 = 3.
7372 watreedisplay-tpos3 = 60.
7373 CONCATENATE `Dictionary: ` <wadictionary>-tabletitle INTO watreedisplay-text3.
7374 APPEND watreedisplay TO iloctreedisplay.
7375 ENDLOOP.
7376
7377 * fill in the tree with message information
7378 SORT <wafunction>-imessages[] ASCENDING BY arbgb.
7379 LOOP AT <wafunction>-imessages ASSIGNING <wamessage>.
7380 AT NEW arbgb.
7381 watreedisplay-tlevel = 4.
7382 watreedisplay-text2 = <wamessage>-arbgb.
7383 watreedisplay-tcolor2 = 5.
7384 watreedisplay-tlength3 = 80.
7385 watreedisplay-tcolor3 = 5.
7386 watreedisplay-tpos3 = 60.
7387
7388 * Select the message class text if we do not have it already
7389 IF <wamessage>-stext IS INITIAL.
7390 SELECT SINGLE stext FROM t100a
7391 INTO <wamessage>-stext
7392 WHERE arbgb = <wamessage>-arbgb.
7393 ENDIF.
7394
7395 watreedisplay-text3 = <wamessage>-stext.
7396 CONCATENATE `Message class: ` watreedisplay-text3 INTO watreedisplay-text3.
7397 APPEND watreedisplay TO iloctreedisplay.
7398 ENDAT.
7399 ENDLOOP.
7400 ENDLOOP.
7401 ENDLOOP.
7402 ENDFORM. "fillTreeNodeClasses
7403
7404 *----------------------------------------------------------------------------------------------------------------------
7405 * displayTree...
7406 *----------------------------------------------------------------------------------------------------------------------
7407 FORM displaytree USING iloctreedisplay LIKE itreedisplay[].
7408
7409 DATA: watreedisplay TYPE snodetext.
7410
7411 * build up the tree from the internal table node
7412 CALL FUNCTION 'RS_TREE_CONSTRUCT'
7413 TABLES
7414 nodetab = itreedisplay
7415 EXCEPTIONS
7416 tree_failure = 1
7417 id_not_found = 2
7418 wrong_relationship = 3
7419 OTHERS = 4.
7420
7421 * get the first index and expand the whole tree
7422 READ TABLE iloctreedisplay INTO watreedisplay INDEX 1.
7423 CALL FUNCTION 'RS_TREE_EXPAND'
7424 EXPORTING
7425 node_id = watreedisplay-id
7426 all = 'X'
7427 EXCEPTIONS
7428 not_found = 1
7429 OTHERS = 2.
7430
7431 * now display the tree
7432 CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
7433 EXPORTING
7434 callback_program = sy-cprog
7435 callback_user_command = 'CB_USER_COMMAND'
7436 callback_text_display = 'CB_text_DISPLAY'
7437 callback_top_of_page = 'TOP_OF_PAGE'
7438 EXCEPTIONS
7439 OTHERS = 1.
7440 ENDFORM. "displayTree
7441
7442 *----------------------------------------------------------------------------------------------------------------------
7443 * topOfPage... for tree display routines.
7444 *----------------------------------------------------------------------------------------------------------------------
7445 FORM topofpage.
7446
7447 ENDFORM. "topOfPage
7448
7449
7450 *Messages
7451 *----------------------------------------------------------
7452 *
7453 * Message class: OO
7454 *000 & & & &
7455
7456
7457 *Messages
7458 *----------------------------------------------------------
7459 *
7460 * Message class: OO
7461 *000 & & & &
7462
7463 *----------------------------------------------------------------------------------
7464 *Extracted by Direct Download Enterprise version 1.3.1 - E.G.Mellodew. 1998-2005 UK. Sap Release 731