cancel
Showing results for 
Search instead for 
Did you mean: 

Setting the maximum number of rows in a table.(Very urgently required)

pranav_nagpal2
Contributor
0 Kudos

Hi All,

I have to make a button "ADD ROW", which adds a row in a table. But problem is that i have to fix the maximum size of the table that is maximum rows that can be added are 10. Please tell me if i can declare global variables and if i can how?? Or suggest a better way

Thank you in advance.

Regards,

Pranav Nagpal

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

In your ADD button event handler code

data: lr_node type ref to if_wd_context_node.

data: count type i.

lr_node = wd_context->get_child_node( '<node name binded to the table>' ).

count = lr_node->GET_ELEMENT_COUNT( ).

if count > 10.

  • show a message

exit.

endif.

rest of your code adding

pranav_nagpal2
Contributor
0 Kudos

Hi,

I think its a local variable and every time the button is pressed it is initiated again to one. Can you suggest any method to declare a global variable.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

count it a local variable, but you are filling it with the current table size using the method GET_ELEMENT_COUNT. it will always return the number of rows in your table node.

if you want another way.

go to the Attribute tab of the View

add a Variable of type Integer

you can access this variable using WD_THIS-><variable_name> in any of the methods of your View

Abhi

pranav_nagpal2
Contributor
0 Kudos

Hi Abhimanyu,

Thanks for solving my problem it was a real help.

Regards,

Pranav

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

In the future, please do not use sayings like "Very urgently required" in your Subject or Message. Form the Forum Rules of Engagement:

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement

Do not use words in capital letters and any of the words: urgent1, quickly1, burning1, etc in your message. Especially not in the title! This just irritates and does not help you get to your goal. From our side, we definitely do not answer faster when we see these words.

pranav_nagpal2
Contributor
0 Kudos

Hi Thomas,

Thank you for forwarding me the rules to ask questions. I will keep the thing in mind for future.

Regards,

Pranav