Skip to Content

               Era of Realtime data analysis….In my projects often I came across with requirements to dynamically change column names or add new columns to grid at runtime. As I am found of JavaScripting and much used to it, so generally ended up pulling data from hidden applet and create table using JavaScript. But now after some hands on with SAP MII I learnt this alternative way of creating Dynamic table using Business Logic Transaction.

Let’s start with a, b, c, d…

In order to build a dynamic document it’s necessary to understand XML structure generated by MII (refer to below figure) image

MII XML structure consists of following nodes

Rowsets, Rowset, Columns, Column, Row and Data

Now we know what it looks like and what we need…then what are we waiting for…let’s get started…

Rowsets/Rowset 

1) Open Logic Editor/workbench and create new transaction

2) Place an Illuminator Document and do not define any Columns in it

3) Add an Illuminator Rowset action after the Document

4) Right click on Rowset action, click Configure and map it to Illuminator Document

image

Columns/Column 

Add required Data Query action or any other data source or logic depending on your requirement which provides you the Column Names after Rowset action . Here for simplicity I am using a For-Repeater action which is generating Columns to my Document.

5) Add For-Repeater action and configure it with 3 because in this example I want to create 3 columned table

6) Under For-Repeater action add Illuminator Column action

7) Right click on Column Action, click configure and map it to Illuminator Document

image

8) Right click on Column Action, click on links and map Name property with value (column name) obtained from Repeator

Please note the column names cannot start with a numerals or special characters but can start with an underscore “_”

For Column SQLdatatype values refer to xMII help document there are host of unique numbers for each datatype

image

Rows

Time to add some rows, to add rows again for my example I am using a For-repeater action but as I said earlier in your case it could be any Datasource/Some logic generating number of rows based on your requirement.

9) Add For-Repeater separately at the end of ealier For-Repeator (refer to figure below) and configure it with 3 (I would like to add 3 rows for my example)

10) Add a Illuminator Row action after For-Repeater action

11) Right click Row action, click configure and map it to Illuminator Document

image

Data

Now comes the real thing of adding data…

To add data to the document, we can visualize an Illuminator DataItem action as a cell in Table having co-ordinates (row, column) In this example say I need build a table of 3×3 (3 rows and 3 columns) that is I really need to create 9 cells of data starting from Row 1 to Row 3. Hence the idea of generating data would be cell by cell something like 1,1…1,3….2,1……3,1……3,3

We need a data-source which will generate data for us and again as I said earlier, in your case data-source is something relevant to your requirement; but for my simple example I relying on my friend For-Repeater for simplicity

12) Add For-Repeator after Illuminator Row action and configure with 3 (since I am creating a table of 3 rows and 3 columns)

13) Add Illuminator DataItem action below For-Repeater, right click on DataItem action, click configure and map it to Illuminator Document Output

14) Provide some dummy Name and Values and in DataItem Configure

image

15) Open DataItem action links make sure that you give exactly the same Column Name which we created earlier while creating columns using Column Action. Say for example, if you have created a Column named “Shift_A” then the same column name must go in the links for Name parameter.

image

Closing Ceremony

Did we create our dynamic table? Yes offcourse we did…..just one more closing step, create a output transaction variable/property and assign the illuminator Document Output to it using Assignment action and lastly don’t forget to save your transaction… 🙂

Based on your business requirement you change the datasource and call this transaction in Xacute query and use the query where and when you need it.

Hope you had fun learning and building this transaction, simple yet important

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Michael Appleby
    Adarsh,
    Great job putting this together.  I will remember it in the future for other MII Forum questions.  Much easier than writing it all out and you have good illustrations.

    Regards,
    Mike

    (0) 

Leave a Reply