Skip to Content
Author's profile photo David Halitsky

Is there a better way than the meta way? (Dynamic RoadMaps: Part 9)

In order to achieve the objectives 1a-b and 2 which were stated in Part 8 of this tutorial: If a house is well-built, its details can be readily rearranged (DynamicRoadMaps:Part 8) “Complex-looking” code is sometimes the “simplest” (Dynamic RoadMaps:Part 6) “Complex-looking” code is sometimes the “simplest” (Dynamic RoadMaps:Part 6) When in doubt, de-multiplex! (Part 5 of Dynamic RoadMap Tutorial) Class-Data May be Cheating, but Who Cares? (Part 4 of Dynamic Road Map Tutorial) SAP UI Element Metadata: Gold or Fool’s Gold? (Part 3 of Dynamic RoadMap Tutorial) But how does the thermos bottle know? (Part 2 of Dynamic Road Map Tutorial) Exposing Critical SAP Code Paths as WebDynpro(ABAP) RoadMaps: One Case Where Dynamic UI Element Generation Might Be the Right Way to Go we need to create some metadata to permit the display of navigation trees like this: Figure A: image and RoadMaps like this: Figure B: image So to permit the display of the navigation tree in Figure A, we create the metadata table ZPRGTR_TREES: Figure C: image with these rows in it: Figure D: image And to permit the display of the RoadMapM in Figure B, we create the metadata table ZPRGTR_RMAPS: Figure E: image with these rows in it: Figure F: image Once having created and loaded these two metadata tables, we need some global itabs to store their rows in. So we type/declare these global itabs in the public section of our local copy ZCL_WDR_ALL_IN_ONE_UIELEM: Figure G1: image Figure G2: image and then load these global itabs in the init_meta_data method of ZCL_WDR_ALL_IN_ONE_UIELEM: Figure H: image (By loading these “global” itabs in the class-method init_meta_data, we ensure that they will be available anywhere in the ZWDR_TEST_UI_ELEMENTS component that has addressability to some instance of ZCL_WDR_ALL_IN_ONE_UIELEM). Once we have the metadata available to us, we are now ready to begin the final round of code changes that will create the navigation tree shown in Figure A and the RoadMap shown in Figure B. In particular, consider the code in the original create method of CL_WDR_ALL_IN_ONE_UIELEM: Figure I: image and compare it the code we now have in the create method of our local copy ZCL_WDR_ALL_IN_ONE_UIELEM: Figure J: image (Note: in case anyone has forgotten, we “lifted” the “create context node” and “create data node” logic out of the original create_settings method and into our create_method because we need this code in our custom method create_lgcldb_tree as well as in the SAP-delivered method create_settings.) In Figure J, our custom method create_lgcldb_tree is used to create a “Logical Database” navigation tree like: Figure K: image when a link like “Vendor Database” is selected from the lefthand library “Logical Databases”: Figure L: image So inasmuch as create_lgcldb_tree is a method that already “works” satisfactorily, we know that we can easily clone this method as a new method create_prgtr_tree and modify this new method so that it creates a navigation tree from the metadata table zprgtr_trees (instead of the metadata table zldbn used to create the tree in Figure K.) And therefore, what we want to do next is: (I) add one line of code to our custom create method: image (II) remove any code that has to do with the creation of navigation trees from the custom method create_settings_roadmap that we created earlier in this tutorial; (III) code up the new custom method create_prgtr_tree by cloning and modifying the existing method create_lgcldb_tree. Since this post is already a bit lengthy, we’ll defer task (III) for Part 10 of this tutorial, and close out this post by identifying the “tree-creation” code that has to be removed from our custom method create_settings_roadmap: image Note: any reader who is (miraculously) still paying attention will notice that the above code only creates the root node of the navigation tree. And therefore, this reader is correct to ask why we don’t also have to remove the code that creates the lower-level nodes of the navigation tree. So, for any reader(s) wondering about this, the answer can be found earlier in this tutorial … we already removed this code from our custom method create_aggregatee_roadmap.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.