on 07-17-2012 2:25 AM
Hi Guys,
I designed table to get input from user. But only the first row is open up as input field and other rows still stay as read only.
I can't enter data into them. The context bind to the table is 1 to N.
Visible Row Count property set to 5.
Any one come across this issue ?
Wondering what if user enter more than 5 rows, how inserting a new row in a table can be done ?
Thanks
Sam
Hi Sam,
You could create a supply function for your 1..n node in order to provide it blank rows ready for input.
METHOD supply_mynode .
DATA lt_table_records TYPE wd_this->elements_mynode.
* Populate the table with empty rows ready for input
DO 10 TIMES.
APPEND INITIAL LINE TO lt_table_records.
ENDDO.
node->bind_table(
new_items = lt_table_records
set_initial_elements = abap_true ).
ENDMETHOD.
You could then provide a button to append new rows to the table or you could programmatically detect that more rows are needed and automatically provide additional rows.
METHOD wddomodifyview .
DATA lv_total TYPE i.
DATA lv_diff TYPE i.
DATA lv_rows_populated TYPE i.
* [1] Get the node's static attribute table, lt_table_records
* [2] Determine how many rows of the table are populated
lv_total = LINES( lt_table_records ).
lv_diff = lv_total - lv_rows_populated.
CHECK lv_diff < 5. " or some other threshold for number of blank rows
lv_diff = 5 - lv_diff. " number of blank rows to append
DO lv_diff TIMES.
APPEND INITIAL LINE TO lt_new_rows.
ENDDO.
lo_nd_mynode->bind_table(
new_items = lt_new_rows
set_initial_elements = abap_false ). " append instead of replace
ENDMETHOD.
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this thread : http://scn.sap.com/thread/3158622
@SIVA thats me . you can find the same in the above thread.
hope this helps u.,
Thanks & Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sam,
Recently i faced the same issue, One of our SNC member provided below solution and its working .
If you want to show 5 empty records, append initial lines to the internal table 5 times and bind to Node of the Table UI element.
Sample:
1. Do 5 times.
Append wa to itab.
enddo.
2. Get the node
3. node->bind_table( itab ).
Thanks and regards
Siva Mandapudi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sam,
You have to take one Add row button in the table toolbar.In the onaction of the Add Row button write the below code,
DATA lo_nd_importing TYPE REF TO if_wd_context_node.
DATA lt_importing TYPE wd_this->elements_importing.
DATA LV_INDEX TYPE I.
DATA LT_SEL_REC TYPE WDR_CONTEXT_ELEMENT_SET.
* navigate from <CONTEXT> to <IMPORTING> via lead selection
lo_nd_importing = wd_context->path_get_node( path = `ZTEST.IMPORTING` ).
* @TODO handle non existant child
* IF lo_nd_importing IS INITIAL.
* ENDIF.
lo_nd_importing->get_static_attributes_table( IMPORTING table = lt_importing ).
*CALL METHOD lo_nd_importing->get_lead_selection_index
* receiving
* index = LV_INDEX.
APPEND INITIAL LINE TO lt_importing.
CALL METHOD lo_nd_importing->bind_table
EXPORTING
new_items = LT_IMPORTING
* set_initial_elements = ABAP_TRUE
* index = LV_INDEX .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sam,
Like Venkata Krishna said you can create one button 'Add row' . IN the action event method you have to just append one blank row to internal table which is already bound to table ui element . And again bind that internal table to node which is bound to Table ui element.
Means whenever you press button' Add row' the new blank row is created for input.
Like this you can create button for 'Save row'.
Thanks
Santosh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sam,
You have binded the table to a node with cardinality 1..n, so one element is created. You have to provide one add button which will add element to the node, which will indirectly add a row in table. as the cell editor used by you is a inputfiled, so everytime a new element is added to the node an editable row will be added.
Thanks & regards,
Chandani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sam,
When ever their is no data then it displays like that only ......Means if u want to add more number of input rows then u have to insert empty records to u r internal table which is binded to this table...
Here that first record comes means u r node card 1...n so it has to take atleast one record so first row is visible in table.....
Initially u just add 5 empty records to u r table.......After that create one button( ADD ROW) in this button action u add some more empty rows to inernal table and bind it..
Regards,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.