cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a Table with Vertical Rows

Amey-Mogare
Contributor
0 Kudos

Hi,

I want to implement a scenario where I have Rows of table vertically spaces instead of horizontally!

I know its a bit weird but let me try to give you some idea what I intend to do :-

-


| Employee Properties | Emp-1 | Emp-2 | Emp-3 | Emp-4 | and so on -->

|_________________ |_______ |_____ |______|______ |___________________

Emp ID

|________________|__________|_____|__________________________________

Emp Name

|________________|__________|_____| __________________________________

Emp Age

|________________|__________|_____|__________________________________

Emp Dept

|________________|__________|_____|__________________________________

So, if you can see here, on the extreme left side, we have labels and series of input fields in front of them.

Any suggestions/ideas how to achieve this?

Thanks and regards,

Amey Mogare

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

As per your design,

Can I assume that the static rows are 4 at present, but the columns are dynamic based on employees right.

Emp ID

Emp Name

Emp Age

Emp Dept

Build a node with 0:N cardinality which has PROPERTIES(string) and EMPLOYEE(Sub node with 0:N cardinality that has EMP as attribute - string).

Noe you need to fill the internal table like this -

ls_data-text = 'Emp ID'.
append ls_data to lt_data.


ls_data-text = 'Emp Name'.
append ls_data to lt_data.


ls_data-text = 'Emp Age'.
append ls_data to lt_data.

After filling this, you need to populate the subnode based on these entries of above table and finally bind the table to node.

Because can be N in number.

Regards,

Lekha.

Amey-Mogare
Contributor
0 Kudos

Hi Lekha,

Yes,

Emp ID

Emp Name

Emp Age

Emp Dept

These four rows can be considered as static and Columns are dynamic based on no. of employees.

Thank you for your wonderful solution! But can you please elaborate more on this node structure and data binding? And how do I map this to TableUIElement? Do I need to create Columns dynamically?

I haven't yet understood your idea completely.

Thanks and regards,

Amey Mogare

Former Member
0 Kudos

Hi,

Yes, You need to build the columns dynamically and also the table columns.

Regards,

Lekha.

Amey-Mogare
Contributor
0 Kudos

Ok. Got it.

But haven't understood that binding part you mentioned?

Can you explain about node structure and its binding with datasource property of table?

I have created Context Nodes like this:-


Ctx_vn_Parent (0:N)
       --- Name(value attribute)
       --- ID(value attribute)
       --- Age(value attribute)
       --- Dept(value attribute)
       --- Address(value attribute)

       --- ctx_vn_Emp(value Child Node of Parent)(0:N)    
            // what should be attributes of this node?

I am not able to get how this will work exactly.

Thanks and regards,

Amey Mogare

Former Member
0 Kudos

Hi,

In SE11 create a structure with one field as PROPERTIES as string.

Now, create a dynamic field catalog with this static strcuture.

For the dynamic fields, I assume there are 20 employees.

For the 20times, create dynamic fields to the above field catalog.

Now my final Field catalog, has both statis and dynamic columns.

Now create a dynamic node from this field catalog.

You can refer to dynamic programming for internal table and node in SDN.

Now,

Fill the table sturcutre. "This is for static, replace with field symbols to build the data.

ls_data-properties = 'Emp ID'.  "caps         
append ls_data to lt_data.


ls_data-properties = 'Name'. "caps
append ls_data to lt_data.


For example:

Now the dynamic node as PROPERTIES, emp1 emp2,emp3 as dynamic columns.
 





loop at lt_data assiign <ls_data>.

assisgn 'PROPERTIES' of <ls_data> into <fs_temp>.

loop at lt_pernr into ls_pernr.

lv_tabix = sy-tabix.

concatenate 'EMP' lv_tabix into lv_str.

asisgn lv_str of structure <fs_data> into <fs_emp>.

if <fs_temp> eq 'EMP ID'

<fs_temp> = ls_pernr-perno.

elseif <fs_temp> eq 'NAME'.

<fs_temp> = ls_pernr-name.

endif.

endloop.

endloop.

enddo.

This is the you fill the table.

Now, bind this table to the dynamic node.

Get the refernece of TABLE UI element and BIND_DATA_SOURCE of cl_wd_table and give thhis node instance.

Regards,

Lekha.

Amey-Mogare
Contributor
0 Kudos

Thank you Lekha!

Answers (0)