cancel
Showing results for 
Search instead for 
Did you mean: 

About rowSelectable property of tables and dynamic binding

matteo_montalto
Contributor
0 Kudos

Hi all experts,

here's a typical requirement I deal with most frequently: inhibit selection of specific rows in a table on the basis of certain criteria, which should be evaluated at runtime.

In order to do so, there's a specific property for tables, which is rowSelectable, that we could bind to a WDY_BOOLEAN attribute that should belong to the row itself.

That's the scenario.

Applying to the real context, most of the times the table represents a Context node which has type of a standard DB structure.

Given that:

- the DB structure is standard and has no unused "free" fields that can be used for the binding;

- you cannot add a free custom attribute under a standard node which has a standard type;

- you cannot even update fields selection for that node via enhancement.

What's the best way, in your opinion, to obtain the desired behaviour? Basically, what's the most effective way to have an attribute which is in 1:1 relation with a row?

Thanks,

M.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Matteo Montalto,

     So if I am not so wrong thten your scenarion in general how to add a new attribute in a context node

which is having a dictionary structure defined.

Yes this is true that once you have defined the dictinary structure then you cannot add field there.

You can try with two option in context level.

1. If your database strucure will not change in future then , add fields from the structure in the node &    then remove it. You tabvle will contain the same fields ( i.e wkithout database structure)..

2. If above scenario will is not fulfilling your req.  then create your own custom structure from the fields from standard structure & then add fields there. in context give the referrence of you custom structure.

I suggest this method because here you will get the advantages of standard seach helps & their import export parameters functionality.

to have an attribute which is in 1:1 relation with a row it must contain inside the structure.

Regards,

Monishankar

matteo_montalto
Contributor
0 Kudos

Hello Monishankar,

I was trying to implement a solution without modifying any part of the standard.

In order to do so, I created a context node, ROW_SELECTION, which has the same cardinality (0...n) of the context node which represents the table.

This node contains a single attribute, ROW_SELECTABLE, which is a boolean.

Then, in WDDOINIT method (post-exit), I loop over standard table's row and for each one, I create an element under ROW_SELECTION, with attribute ROW_SELECTABLE set to abap_true or abap_false according to my own logic.

So... basically I have now, say, N entries in the table and exactly N entries in my custom node.

Now I'm stuck at the binding point.

I tried to do so:

* get reference of the table

bid_table ?= view->get_element( 'BID_COMP_TABLE' ).

* binding

CALL METHOD BID_TABLE->BIND_ROW_SELECTABLE

       EXPORTING

         PATH = 'ROW_SELECTION.ROW_SELECTABLE'.


But that's not working as I get a dump with the following message:

Context binding of property ROW_SELECTABLE cannot be resolved: Node V_BID_COMPARISON.1.ROW_SELECTION does not contain any elements

Answers (2)

Answers (2)

former_member210804
Active Participant
0 Kudos

Hi Matteo Montalto,

As Monishankar  told, We can add new attributes to the context node which is binded to standard DB table.

Follow the below steps.

1. Create the context node lets say  'PERSONAL_DATA'  in controller  and assign the

    standard DB structure   'P0002'.

2.  We can add the new attributes to the context node by removing the dictionary structure

     as follow.

    

Hope this will be helpful to you

Best regards,

Rao.

former_member210804
Active Participant
0 Kudos

Hi Matteo Montalto,

As Monishankar  told, We can add new attributes to the context node which is binded to standard DB table.

Follow the below steps.

1. Create the context node lets say  'PERSONAL_DATA'  in controller  and assign the

    standard DB structure   'P0002'.

2.  We can add the new attributes to the context node by removing the dictionary structure

     as follow.

    

Hope this will be helpful to you

Best regards,

Rao.