cancel
Showing results for 
Search instead for 
Did you mean: 

Number of displayed lines in a table

AFork
Advisor
Advisor
0 Kudos

Hello colleagues,

We are using a table with a master column (tree). Additional we are using an input field where a user can enter a number so that the displayed lines can be change at runtime.

Problem:

I would like to know the displayed number of lines as it is displayed in the button line of the table in the view (where a user can jump direct to a line) - but I do not know how I get it.

Question:

How do I get the content of the max number of available lines in the button of the displayed table?

Thanks+greetings,

Achim

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Achim,

The RowCount propery of the WDA Table is Bindable. So...

1. Bind it to a Node Element.

2. During the User Action(onClick) set this NodeElement value to the User Input Value (text field value).

3. So that it will be reflect in the Table.

Hope it helps.

Regards,

Maheswaran.B

AFork
Advisor
Advisor
0 Kudos

Hey Maheswaran.B,

thanks for the reply - the problem is not solved with the suggestion (because I do not get the maximum number of line displayed).

I did the following:

On the very first time if "modifyView" will be executed I do a loop over the table. If the maximum number is reached within the loop I set this number - if not I set the number of loops.

Here is a code example:



   DO 10 TIMES.
      ADD 1 TO l_counter.
      CLEAR elem_tabletree.
      elem_tabletree = node_tabletree->get_element( index = l_counter ).
      IF elem_tabletree IS  INITIAL.
        SUBTRACT 1 FROM l_counter.
        EXIT.
      ENDIF.
    ENDDO.

*--- set the value to the bound variable
    elem_owner_node->set_attribute(
      EXPORTING
        name =  `NUMBER_OF_LINES`
        value = item_number_of_lines ).

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Achim,

You have the Input field in which the User is Entering the no of Lines to be Displayed. Bind it to the Context attribute. Read this into a local variable. Get all the data from the node ( to which the table is binded ) into an internal table till the value of the local variable which you have read.

Some code Example:

lt_table = node->get_elements( )

sy-tabix = 0.

if sy-tabix <> l_variable.

loop at lt_table into ls_data.

append ls_data into lt_data.

endloop.

in the end you would have all the displayed data in lt_data.

Hope this helps to a certain extent. please excuse coz this code has not been checked syntactically.

Cheers.

Ashish

Former Member
0 Kudos

Hi Achim,

You can get the total no. of lines in the table using the following code...


data no_of_lines type i.
no_of_lines = node_tabletree->GET_ELEMENT_COUNT().

Hope it helps.

Forgot to say, Thanks for the points.

Regards,

Maheswaran.B

Message was edited by:

Maheswaran B

Message was edited by:

Maheswaran B

AFork
Advisor
Advisor
0 Kudos

Hi Maheswaran.B,

the problem still exits. The method get_element_count returns all the elements in the tree and not only the displayed one....

Any further hints are welcome.

Thanks + greetings

Achim