|
| 1 | +# Integration to Fiori Element Apps |
| 2 | + |
| 3 | +It is possible to extend the object page of an Fiori list report apps with an abap2UI5 app. A repository to showcase the use case can be found [here.](https://github.com/axelmohnen/ABAP2UI5_COMP_CONT) |
| 4 | + |
| 5 | +<img width="747" height="387" alt="image" src="https://github.com/user-attachments/assets/c14d5732-3b8c-4fa5-83ab-6d188a4d87db" /> |
| 6 | + |
| 7 | + |
| 8 | +### Guide |
| 9 | + |
| 10 | +Follow the following steps: |
| 11 | + |
| 12 | +1. Register the FLP integration in the component.js: |
| 13 | + |
| 14 | +```javascript |
| 15 | +// Register ABAP2UI5 FLP integration for component container |
| 16 | +jQuery.sap.registerModulePath("z2ui5", "/sap/bc/ui5_ui5/sap/z2ui5"); |
| 17 | +``` |
| 18 | + |
| 19 | +2. Adapt the object page extension controller.js: |
| 20 | + |
| 21 | +```javascript |
| 22 | +sap.ui.core.Component.create({ |
| 23 | + name: "z2ui5", |
| 24 | + settings: { |
| 25 | + componentData: { |
| 26 | + startupParameters: { |
| 27 | + app_start: ["ZCL_YOUR_2UI5_CLASS_APP"], |
| 28 | + key1: ["Param1"], |
| 29 | + key2: ["Param2"] |
| 30 | + } |
| 31 | + } |
| 32 | + } |
| 33 | + }).then(function (oComponent) { |
| 34 | + var oCompContainter = new sap.ui.core.ComponentContainer({ |
| 35 | + component: oComponent, |
| 36 | + async: true |
| 37 | + }); |
| 38 | + |
| 39 | + // Add component container to your VBox |
| 40 | + var oVBox = that.getView().byId("VBoxId") |
| 41 | + oVBox.destroyItems(); |
| 42 | + oVBox.addItem(oCompContainter); |
| 43 | + |
| 44 | + //Overwrite default height of object page section |
| 45 | + var oSection = that.getView().byId("[This is the ID of your object page section::Section]"); |
| 46 | + oSection.addStyleClass("customSectionHeight"); |
| 47 | + |
| 48 | + }); |
| 49 | +``` |
| 50 | + |
| 51 | +3. Implement facet fragment: |
| 52 | +```xml |
| 53 | +<core:FragmentDefinition xmlns:commons="sap.ui.commons" xmlns:core="sap.ui.core" xmlns:form="sap.ui.layout.form" xmlns:l="sap.ui.layout" |
| 54 | + xmlns:sfi="sap.ui.comp.smartfield" xmlns:sfo="sap.ui.comp.smartform" xmlns:table="sap.ui.table" |
| 55 | + xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1" xmlns:uxap="sap.uxap" xmlns="sap.m"> |
| 56 | + <VBox id="VBoxId" direction="Column" height="200px" ></VBox> |
| 57 | +</core:FragmentDefinition> |
| 58 | +``` |
| 59 | + |
| 60 | +4. Add CSS (style.css): |
| 61 | +```json |
| 62 | +.customSectionHeight { |
| 63 | + height: auto !important; |
| 64 | +} |
| 65 | +``` |
| 66 | + |
| 67 | +5. Create ABAP2U5 app class |
| 68 | +```abap |
| 69 | +METHOD z2ui5_if_app~main. |
| 70 | +
|
| 71 | + IF check_initialized = abap_false. |
| 72 | + check_initialized = abap_true. |
| 73 | +
|
| 74 | +* ---------- Get startup parameters --------------------------------------------------------------- |
| 75 | + DATA(lt_startup_params) = client->get( )-t_comp_params. |
| 76 | +
|
| 77 | + ENDIF. |
| 78 | +
|
| 79 | + DATA(lr_view) = z2ui5_cl_xml_view=>factory( ). |
| 80 | + DATA(lr_page) = lr_view->page( showheader = abap_false |
| 81 | + backgrounddesign = 'List' )->content( ). "Backgrounddesign "List" sets a white background color |
| 82 | +
|
| 83 | + lr_page->text( 'TEXT' ). |
| 84 | +
|
| 85 | + client->view_display( lr_view->stringify( ) ). |
| 86 | +
|
| 87 | + ENDMETHOD. |
| 88 | +``` |
0 commit comments