A Story of Reusability: Leveraging SAP Analytics Cloud Composites

Imagine you are building various reports, each with its own unique requirements, but still needing to maintain a cohesive look and feel. Most likely the header is standardized and keeps stable. Enter the hero of our story: SAP Analytics Cloud CompositesComposite header.

The Power of a Composite

Composites in SAP Analytics Cloud offer a reusable element that serves as a single point of maintenance, encapsulating design and functionality. This concept of reusability is akin to creating a template that can be adapted without altering the core design every time a new report is generated. Think of a composite as a LEGO brick, perfectly crafted to fit in various places, providing the same foundational support while allowing for customizations.

In our story, we focus on using composites for creating a consistent and flexible header across different stories and reports. This header includes a logo, some text, and a home button. The beauty of using a composite lies in its capability to use interfaces—properties, functions, and events—that enable modifications and interactions with different story pages.

Building the Composite Header

Our journey begins with the creation of a small composite header. This header includes:

1. Logo: A standardized company logo ensuring brand consistency.

2. Text Field: A field that displays the header text, which can be customized per story.

3. Home Button: A navigational button whose functionality can be altered depending on the context of the story.

Created a small composite for an header of story with logo , text and home button

This header is not just a static element; it interacts with its environment. By using interfaces:

– Properties allow setting header text dynamically from the story.

– Functions facilitate text changes programmatically.

– Events trigger actions like returning to the home page when the button is clicked.

We use all interfaces (properties, functions, events) to steer/customize the behavior. In that example the

  • Header text should be changed out of the story
  • Clicking the home button should be different per story

Our Property PT_TEST is linked to our header text named TXT_HEADER

Our Function FC_TXT is changing text – so doing the same as the property.

Our EV_HOME is triggered from BTN_HOME to be consumed in story.

Usage of composite

After building our composite, the next step is integrating it into our story. First we need to import the composite to the story to be able to use it as element.

We decide to use two headers in different parts of our story, showcasing different methods of interaction:

1. Header 1 is controlled via a script using a function (FC_TXT) from the composite to change its text.

2. Header 2 changes its text using a property directly, demonstrating another way of interaction.

To illustrate the versatility, clicking the home button triggers a message, showing how events can be harnessed to provide feedback or perform actions. These methods highlight the multiple ways one can interact with and control the behavior of composites, making them adaptable to various scenarios.

Events

We interact with composites in story by reacting on event EV_HOME by providing a short message.

Link properties

We mange property PT_TEST by right click and “Manage Linked Properties” and set the text for the Header at design time to “ “Header 2 Reporting”.

Script Interface

Setting Header 1 is done via script in the init script of the page by using the function of the composite FC_TXT.

Result of the small example

The result of the composite looks like the image above. Using different interfaces could lead to same results and shows multiple ways to interact with this element.

And when you hit the button the event is fired and the script within the page is executed.

Different behavior of interfaces

One challenge in maintaining a uniform design across multiple reports is managing latency and consistency. In our example, setting properties at design time versus runtime showed differences in latency, especially in how header text is updated. This is a vital consideration when aiming for real-time updates in dynamic reporting environments.

In our example we want to refresh the table in the first step.

Due to the, fact that properties are set at design time and script and runtime there is a latency when for setting the text of the headers.

Conclusion

SAP Analytics Cloud composites prove to be invaluable tools. By encapsulating both logic and layout, they streamline the process of maintaining consistency while enabling customization. The use of interfaces—properties, functions, and events—adds a layer of dynamic behavior that is crucial for creating responsive and interactive reports. Composites allow developers to focus on enhancing functionality rather than repeatedly redesigning common elements, thus boosting efficiency and productivity.

In essence, composites act as building blocks that simplify development, ensure consistency, and provide flexibility—transforming the way we build and maintain SAP Analytics Cloud reports. As you embark on your journey with SAP Analytics Cloud, consider composites as your allies in creating scalable and maintainable analytics solutions.