Skip to content

Latest commit

 

History

History
69 lines (55 loc) · 4 KB

README.md

File metadata and controls

69 lines (55 loc) · 4 KB

02 — Smart Controls

← all packages

This is abap2UI5 at its most agnostic: the sap.ui.comp library builds its UI from OData V2 metadata — a SmartTable asks the service what the columns are, a SmartField asks what the field is. abap2UI5 simply points the default model at that service and lets the metadata do the rest, so the apps carry almost no data of their own. If you already run Gateway services, you get variant management, value help and smart filtering for free.

What you need

Release: Cloud + Standard ≥ 7.40 SP08. The metadata does the work, so the ABAP side of these nine samples asks for nothing beyond the release the package is written in — what they need is the service, not the platform.

Branch: 02-smart-controls — this package alone, without the other thirteen on your system.

  • SAPUI5, since sap.ui.comp is part of the SAPUI5 distribution.
  • An activated OData V2 service. Most samples point at the Gateway demo service GWSAMPLE_BASIC, which ships with every on-premise system and only has to be activated once in /IWFND/MAINT_SERVICE. Where a sample uses a different service, it says so at the switch_default_model_path — adjust it to your system.
  • UI_PRODUCTLIST for Z2UI5_CL_SMPS_APP_313 and Z2UI5_CL_SMPS_APP_319, a standard service that not every system carries. Look for it in /IWFND/MAINT_SERVICE and activate it like GWSAMPLE_BASIC; Z2UI5_CL_SMPS_APP_319 also reads its value-list annotation UI_PRODUCTLIST_VAN through the Gateway catalog service. Where it does not exist, those two have no metadata to build from; the other seven are unaffected.

The samples

Sample Shows Service
313 SmartFilterBar + SmartTable with variant management UI_PRODUCTLIST
314 switch the default model — device, HTTP and OData model side by side GWSAMPLE_BASIC
319 SmartMultiInput → an ABAP SELECT-OPTIONS range table UI_PRODUCTLIST + value list annotations
475 SmartField inside a SmartForm GWSAMPLE_BASIC
476 SmartForm, display/edit toggle GWSAMPLE_BASIC
477 SmartFilterBar driving a SmartTable GWSAMPLE_BASIC
478 page variant management GWSAMPLE_BASIC
479 SmartChart with NavigationPopover an analytical service — you supply it
493 classic FilterBar wired to variant management none — the data is ABAP

Start any of them with ?app_start=z2ui5_cl_smps_app_<no>, or from the overview app ?app_start=z2ui5_cl_smps_app_000, which lists every sample of this repository.

Two worth a closer look

319 is the interesting one if you write classic ABAP: the user gets a full SELECT-OPTIONS experience in the browser (value help, several conditions, contains / between / greater-than, include and exclude), and the app maps the returned conditions 1:1 onto an ABAP range table — SIGN/OPTION/LOW/HIGH — and filters with ... WHERE product_type IN r_product_type. Both the derived SELECT-OPTIONS and the matching rows are on screen, so the mapping is visible.

479 goes one step further: a SmartChart draws from an analytical OData V2 service — properties marked sap:aggregation-role dimension/measure plus the UI.Chart annotation the layout comes from. Since a standard system ships no such service, the path in the class is a placeholder — point it at an analytical service of your own and the chart comes to life.

Where to go next

  • 01 OData — the same services without smart controls.
  • 03 RAP — data straight from a business object, no service in between.