当前位置:   article > 正文

abap 下载

下载abap程序

今天在程序库里面发现一个程序 可复制直接运行

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

 

转载于:https://www.cnblogs.com/charles-guo/p/3720487.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/459546
推荐阅读
  

闽ICP备14008679号