Skip to main content

4. Advanced modeling

This tutorial uses the more advanced modeling features. The blueprint you loaded in tutorial 3 is missing the Order object, so Order item has nothing to relate to. You rebuild Order and on the way use:

  1. An advanced join key.
  2. A combined source.
  3. An activity batch.
  4. A calculated attribute.
  5. A parameter.

Step 0: Prepare your second training workspace​

If you just completed In depth processes, keep working in the same workspace and go to Step 1. Otherwise, follow step 0 and step 1 of In depth processes first.

Step 1: Create the Order object​

Select Dashboard in the sidebar. Order item has no relations because Order is missing.

Order object missing

  1. Select Event store in the sidebar, then + Object.
  2. For Source, choose File uploads → vbak.
  3. Enter Order as the Object name.
  4. For Object identifier, select mandt, then use + to add bukrs and vbeln.
  5. Select Create draft object.

Create the Order object

Order needs relations to Order item and Quote. Start with Order item, which joins on the same three columns.

  1. In the Related objects panel, select + Related object.
  2. Under Object, choose Order item.
  3. Add mandt, bukrs and vbeln as join keys under Order, and the same three columns under Order item.
  4. Select Create relation.

Relate Order to Order item

Quote is harder: the order stores the quote id in bstnk with extra characters after it. An advanced join key uses only the first 18 characters.

  1. Select + Related object again and choose Quote under Object.
  2. Under Order, select Select column.
  3. Select ADVANCED JOIN KEY at the bottom of the list. Advanced join key
  4. Set Type to Left characters.
  5. Set Column to bstnk.
  6. Enter 18 for # characters.
  7. Select Save.
  8. Under Quote, choose id.
  9. Select Create relation.

Advanced join key filled in

tip

The preview table shows the selected object, here Quote. The table at the bottom shows Order. Hover over a column in either table to add it as a join key.

To check the relations, process the three objects:

  1. On Order, select Save & process.
  2. Open Order item from the Related objects panel and select Reprocess changes.
  3. Open Quote and select Reprocess changes.

Step 2: Create a combined source​

The activity batch in the next step needs the changed field fname and the change date udate in one table, but they live in cdpos and cdhdr. A combined source joins them.

  1. Select Sources in the sidebar, then + Source → Combined source.
  2. Enter changes as the Name. Combined source names must start with a lowercase letter.
  3. Choose cdpos as the first table.
  4. In Columns, select Select all.
  5. Select Save. Combined source with cdpos

Now add the change date from cdhdr:

  1. Select + Transformation and set Operation type to Left join.
  2. Choose cdhdr as the table.
  3. In Columns, choose udate.
  4. Add the join keys: mandant and changenr under Combined table, and mandt and changenr under cdhdr.
  5. Select Apply.
  6. Select Test transformations and check the preview.
  7. Select Create combined source.

Combined source with cdhdr

Only updates are needed, the rows where chngind is U. You add that filter in SQL.

  1. Select changes in the source list.
  2. Switch to Advanced (SQL editor).
  3. Add this line at the end of the query:
WHERE main.chngind = 'U'
  1. Select Test SQL and check that chngind only shows U.
  2. Select Save combined source.

Combined source advanced editor

Step 3: Create an activity batch​

An activity batch creates one activity per value of a column, here one activity per changed field.

  1. Open Order in the Event store and select + Activity in the Activities panel.
  2. Select the Activity batch icon next to Batch name.
  3. Enter Change order as the Batch name.
  4. For Source, choose Combined sources → changes.
  5. For Timestamp, choose udate.
  6. In Dynamic activity name, type Change, then type $ and choose fname. The example below the field shows a name such as Change SPART.
  7. Add the join keys: mandt, bukrs and vbeln under Order, and tabkey under Change order.
  8. Select Create activity batch.

Create an activity batch

The batch also picks up changes to other tables. Keep only changes to the order header, VBAK:

  1. Select Change order in the Activities panel of Order.
  2. In the Batch filter panel, select Filter.
  3. Choose tabname.
  4. Choose Equals.
  5. Enter VBAK.
  6. Select Save filters. Konekti asks to recompute the activities; select Yes.

Batch filter

The batch now has six activities. Two of them are not needed:

  1. In the Batch activities panel, select Activity settings. The Configure batch activities dialog opens.
  2. Select the bin icon next to Change ABGRU and confirm with Delete.
  3. Do the same for Change LIFSK.

Delete batch activities

The activities are named after fname. Give Change SPART a readable name:

  1. Select the chevron next to Change SPART.
  2. Change Activity name to Change division.
  3. Select Save.
  4. Select Save batch.
  5. Select Save & process.

Rename a batch activity

Step 4: Add a calculated attribute​

A calculated attribute is computed with SQL instead of read from a column. Here it marks orders with a net value of 10,000 or more.

  1. Open Order in the Event store.
  2. In the Attributes panel, open Select attributes and choose Calculated attribute at the bottom of the list.
  3. Type HighValueOrder in Name and select Add "HighValueOrder".
  4. Set Data type to Boolean.
  5. Copy this code into the editor:
CASE
WHEN CAST (netwr AS numeric) < 10000 THEN 'False'
ELSE 'True'
END
  1. Select Preview attribute and check the new column in the table.
  2. Select Save attribute.

Calculated attribute

Step 5: Add a filter​

Order should only include sales orders, where auart is OR.

  1. In the Filters panel of Order, select Filter.
  2. Choose auart.
  3. Choose Equals.
  4. Enter OR.
  5. Select Save filters.

Order filter

Step 6: Add a parameter and use it in the filter​

A parameter holds a value you can use in many filters and change in one place.

  1. Select Dashboard in the sidebar.
  2. In the Parameters panel, select + Parameter. The Set parameter dialog opens.
  3. Enter SalesDocumentType as the Name.
  4. Set Type to String List.
  5. In Value, type OR and add it.
  6. Select Save, then Close.

Set parameter

Now replace the fixed value in the Order filter with the parameter:

  1. Open Order in the Event store and select Filter.
  2. Change the operator to General comparators → Is any of.
  3. In the value field, type @ and choose SalesDocumentType.
  4. Select Save filters.
  5. Select Reprocess changes.

Order filter with a parameter

You have now used the advanced modeling features on a full example. For help with your own data, contact support.