We're going to use LiveCompare 3.1 to build a smart lifecycle app for SAP applications. It's called:
It produces output that looks like this:
The chart very clearly illustrates our investment in custom code. The data above comes from IntelliCorp's primary 4.6c development system. The tapering off reflects our shift to using newer versions of SAP to build our apps.
Here's my starting point, an empty LiveCompare project.
First I need a workspace:
After creating the workspace I create two workflows: App Driver and Chronograph. By convention I always create the App Driver workflow when I know I'm creating an app. It let's me put the guts of the analysis in a sub-workflow (Chronograph in this example) leaving the App Driver clear to accept user input and format the dashboard.
I'll start with the Chronograph workflow. When building a workflow the first question I ask myself is "What data will I need to help me answer the question?" In Chronograph I need two data elements:
LiveCompare includes 200+ templates and I'm sure one of them collects all or most of the data that I need. It's always a good idea to look at the standard templates when building a new one. The first template I looked at – U.01 – Impacted Used Custom Code – is not quite what I need. I want to look at custom code whether it's used or not.
A better workflow for my needs is: U.02 – Analyze Custom Code Complexity. I've highlighted the workflow building blocks that do what I need:
I copy+paste the blocks into my Chronograph workflow:
I'm only interested in programs so I change the Object Types to Analyze parameter:
Building a workflow is a very interactive experience. You can play the workflow at any point in its development to check that you are going in the right direction. Now would be a good time to play the workflow to be sure that it is collecting our custom programs. I set the System 1 parameter to our 4.6c development system and click the green play button.
I open the Filtered Custom Objects dataset to view the results:
That takes care of my first data need. Now for the created on data. I know that the TRDIR table contains the created on value for programs. I add a Read SAP Table action to the workflow and wire it up to the System 1 RFC Destination and give it a Result dataset:
I don't want to read all the TRDIR columns. Since I've set both the RFC Destination and Table Name action parameter I can use LiveCompare's lookup feature to select the columns I want:
I want to check that I'm getting the right data. Instead of running the entire workflow I can select the Read SAP Table action and choose Run this Only from the context menu. Or hit F8 – the accelerator key that's bound to the Run this Only action command. The results look good:
Now I need to associate the CDAT value from TRDIR with the rows in the Filtered Custom Objects dataset. I use the Execute SQL action to do this. The action's Statements take care of matching the data and creating the Result contents.
As before, I select the action and run it only (F8) to make sure that my SQL is correct and that I'm getting the results I need:
I've collected the raw data that will answer the question. Before I create the dashboard/final report I need to summarise the data a little bit.
I could also have used the Read SAP Table and Join action here. You could try that as an exercise.
First, I only need the YYYY element from the CDAT field. I like to use separate Execute SQL actions to go step-by-step through the filtering/data clean-up so that I can check my progress rather than fill a single action with lots of statements. See what works best for you.
Here's the SQL I need to tease out the YYYY portion of the CDAT field values:
Which produces the results I need:
Now I can work to summarise the results. I want something that looks like:
The SQL to do this looks like:
Which gives me the results:
Now I need to create a running total of the COUNT_YYYY column. I use another Execute SQL action. In addition to writing a SQL statement I use the Options parameter and an accelerator that copies records from one dataset to another:
The action's Statements look like:
This has the necessary effect of creating the rolling total that I need:
That's as much as I want to do in the sub-workflow. Now I can turn my attention to creating the dashboard report before finally registering the app.
One tip I'd like to share. Sometimes the sub-workflow you build will take a few minutes to run. You don't want to pay the price for running the sub-workflow over-and-over while you build the App Driver wf. What I do is write the results into a data store:
Now I can develop the App Driver workflow independently. Of course I must remember to delete the Write Data Store action before I register the app.
I start the App Driver workflow with a Read Data Store action. I run the workflow to make sure I have the data from the Chronograph sub-workflow:
Next I reduce the output to just (YYYY, SUM_YYYY). This reduced output is what will drive the line chart in the dashboard report. I use an Execute SQL action for this. I run the action (F8) to check the results:
This data is formatted just right for the new Create Dashboard Report action. I add it to the workflow and wire up its parameters:
The action turns datasets into charts by means of the Dashboard Spec. The spec is very flexible and supports many different types of chart with lots of formatting options. I rarely start a new dashboard spec from scratch. I copy+paste from an existing spec. A good source of example specs are the standard apps that ship with LiveCompare. First I need to rehydrate an app into a workspace so that I can examine its workflows.
I select the App Store objet in the hierarchy. I'm showing just one of the standard apps to avoid cluttering the display in this blog post.
I select the app:
And I use the Copy to Workspace command to rehydrate the app. Oh, I should have said that I first create a workspace to hold all the app's workflows. It looks like:
You can see that this app is structured just like the one we're building with an App Driver as the top-level workflow and several sub-workflows.
I copy+paste the dashboard spec into my app's App Driver workflow and wire it up to the Create Dashboard Report action:
The dashboard spec is formatted as XML. In LiveCompare 3.1 you must edit this by hand. We're looking at providing a dedicated designer in a later release. Using the copy+paste method with a few edits is, however, still very productive. The online help explains all the options fully.
Since I have just one dataset I delete most of the spec. I set the chart type to line (replace "Pie" with "Line"). I run the action and open the dashboard:
I have a couple of changes to make:
Notice that the chart title comes from the label of the input dataset. This makes it simple to change by editing the dataset in the workflow. The line width is one of the many settings that affect the look of the chart.
The dashboard is just the way I want it.
All that remains is for me to clean up the Chronograph sub-workflow (recall that I must delete the Write Data Store action) and replace the Read Data Store action in the App Driver workflow with a Run Workflow action which I bind to the Chronograph sub-workflow.
I use the Workflow Binding Wizard to associate the Run Workflow action with the Chronograph sub-workflow and set the input and output parameters.
The wizard lists all the other workflows in the workspace. I choose the Chronograph workflow and click Next.
The wizard automatically identifies the possible input and output parameters. I choose System 1 (RFC Destination) and YYYY, COUNT_YYYY, SUM_YYYY (Dataset) and click Next.
I click Finish to close the Wizard.
I wire up the Run Workflow action to complete the App Driver workflow:
I reset and run the workflow to confirm that it is working as expected.
Now I am ready to register the app. I choose Register as App from the App Driver context menu in the hierarchy. The Register Workflow as App Wizard starts. I use the right arrow to move the System 1 available parameter into the selected column and click Next.
The Wizard automatically selects the Report URL dataset as it's the only output dataset in the App Driver workflow. I click Next.
I set the name of the app and provide a short description. This is what consumers will see in their view of the App Store. I click Next.
I choose an icon for the app from one of the many stock icons that ship with LiveCompare. I could upload a custom icon. I click Next.
I confirm the app details and click Finish.
I check the App Store and see that the app is available:
As an editor I can switch to the consumer user experience by clicking the "Goto Apps" toolbar button – top-right, looks like a smartphone. The consumer apps interface opens in a second tab.
I click on the App Store to confirm that the app is available:
I click Install to add it to my home screen and click home to return to my home screen.
I click on the app to open it.
The app cockpit is split into two sections: my variants and my results. I can setup as many variants as I need. I click the play button next to a variant to run it.
I click Refresh to update the display and see that the app has run successfully producing a result.
I click the result link to open the dashboard.
All that remains is for me to advertise my app and get my app users contributing reviews and feedback and encouraging their colleagues to use it too.
The Chronograph is available to download now from iShare.
Watch me build Chronograph.