cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert data in table UI elements

Former Member
0 Kudos

Hi Guys,

Here is my questions. How to insert data in table UI elements.

Here i try to insert data by using Add button

data:

Node_Item type ref to If_Wd_Context_Node.

Node_Item = wd_comp_controller->get_data_node( ).

data:

lr_table_line type ref to ITEM.

lr_table_line = Node_Item->create_element( ).

field-symbols:

<ls_table> type any.

assign lr_table_line->* to <ls_table>.

Node_Item->bind_element(

new_item = <ls_table>

set_initial_elements = abap_false

index = 1 ).

But i got syntax error the result type of the function method cannot not be converted in to the type of lr_table_line.

And i set cardinality and selection as 0.n.

Pls, let me know for the soulutions

Chandru

Message was edited by:

chandrasekar muthuvelraj

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

The line type that you are binding to the context must be of similar structure as that of the node. Pls check.

Regards,

Shruthi R

Former Member
0 Kudos

Chadru, another option is for you to bind the table UI field to an internal table and to populate the internal table. Then, automatically, your Table UI field will be populated with the data from the internal table. Here is the code that does that and works for me. Good luck!

method FILL_DATA .

DATA: node_level1 type ref to if_wd_context_node,

node_level2 type ref to if_wd_context_node,

node_items type ref to if_wd_context_node,

stru_ResItems type BAPI2093_RES_ITEM,

tab_ResItems TYPE TABLE OF BAPI2093_RES_ITEM,

n type i.

node_level1 = wd_context->get_child_node( name = 'BAPI_RESERVATION_CRE' ).

node_level2 = node_level1->get_child_node( name = 'CHANGING' ).

node_items = node_level2->get_child_node( name = 'RESERVATIONITEMS' ).

n = 2.

do n times.

insert stru_ResItems into table tab_ResItems.

enddo.

node_items->bind_table( tab_ResItems ).

endmethod.

Former Member
0 Kudos

Tiberiu,

Thanks for immediate reply. I saw your coding, i implemented ur coding. i got this error.

ote

The following error text was processed in the system E60 : Lower-Level Node with Name FRONTVIEW.IF_FRONTVIEW=>wdctx_ITEM Does Not Exist

The error occurred on the application server sapecc6ides_E60_01 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: GET_CHILD_NODE_INTERNAL of program CL_WDR_CONTEXT_ELEMENT========CP

Method: IF_WD_CONTEXT_ELEMENT~GET_CHILD_NODE of program CL_WDR_CONTEXT_ELEMENT========CP

Method: IF_WD_CONTEXT_NODE~GET_CHILD_NODE of program CL_WDR_CONTEXT_NODE_VAL=======CP

Method: ONACTIONINSERT of program /1BCWDY/1A3ZNC722VJQ9I6LPR39==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/1A3ZNC722VJQ9I6LPR39==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP

Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP

Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP

Former Member
0 Kudos

Chandru, my code will not work as-is for you... I sent it to you as a sample code. Did you create your context node structure? the error you get "FRONTVIEW.IF_FRONTVIEW=>wdctx_ITEM Does Not Exist" means that you do not have the right nodes in place.

by the way, the function FILL_DATA is a supply method for the context node you bind to your table. Let me know if you have question. please reward points if helpful.

Former Member
0 Kudos

Tiberiu,

I didn't use ur code. I got idea from ur code and implemented.

Former Member
0 Kudos

Hi ,

Did you use the code wizard to generate the code? Use the code wizard to prevent any such errors. This error is because you probably dont have a node named 'item'.

Regards

Nithya