on 04-13-2010 11:43 AM
Hi,
I have an requirement, I have an table and a button, I need to select a row in a table based on button action.
For example : in a table i have 3 rows. I am submiting a value in a button, I want to see that row highlighted for the value I am sending through button.
Please let us know the code how to implement this.
Thanks
solved my self
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
First you have to go to table and set its property "SELECTION MODE" to single or multi lead depending on ur need.
Then in the ACTION of the button you can use the following code to get the values in the selected row.
DATA:
node to get table node for finding no. of rows
lo_nd_one TYPE REF TO if_wd_context_node,
Get selected row for finding no. of rows
it_table TYPE wdr_context_element_set,
workarea to get selected row
wa_table LIKE LINE OF it_table,
To get the Selected line item into an internal table
CALL METHOD lo_nd_one->get_selected_elements
RECEIVING
set = it_table. " data in internal format
IF it_table[] IS NOT INITIAL.
type conversion for work area
READ TABLE it_table INTO wa_table INDEX 1.
if a row is present
IF sy-subrc IS INITIAL.
Get the values of each attribute
CALL METHOD wa_table->get_static_attributes
IMPORTING
static_attributes = wa_final. "<Selected data in work area.> ---> this will have your data
ENDIF.
Here wa_final is the work area which is of your table fields type.
This wa_final will have the selected row.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use method SET_LEAD_SELECTION_INDEX of method if_wd_context_node, by passing the Index in the exporting parameter.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.