cancel
Showing results for 
Search instead for 
Did you mean: 

Capture user entries in a custom table

0 Kudos

Hi,

I am creating a webdynpro application where I have to store user entries in a custom table and display it later, if the user wants to make any changes to those. How can i achieve this. I understand I will have to create a custom table with all the fields available in the webdynpro application. how can i proceed further.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Isha,

Follow the steps suggested by Kiran and Rama.

Create a Z-table with the required fields and on the button action(say Save) on your WDP screen, read all the attributes data( for ex : in case of table, use method lo_node->get_static_attributes_table( ) ) and modify your Z-Table.

And regarding modification of entries, hope you might be having any condition( for ex: select option) to fetch the required data  from the Z-table. After modification of data which has been fetched based on your condition, read the modified data again and modfiy your Z-table.

DATA: Node_table type ref to if_wd_context_node,

           elem_table type ref to if_wd_context_element.

  node_table = wd_context->get_child_node( 'TABLE_DATA_SOURCE' ).

  CALL METHOD node_table->get_static_attributes_table( IMPORTING  table = it_table ).  " here it_table will be the internal table of the type as the structure that u created in the view.

now, get the data that u enter on the component into this internal table and modify the ztable from this internal table and the ztable gets updated

Hope this will resolve your issue.

Thanks

KH

ramakrishnappa
Active Contributor
0 Kudos

Hi Isha,

You can achieve your requirement by using either TABLE ui element or ALV in web dynpro.

Please follow the below steps: ( By using Table ui element )


  • Create a custom table for storing data ZTR_DATA
  • Create a context node MY_DATA by using ddic structure ZTR_DATA with cardinality 0....n
  • Create an ui element TABLE on layout of your view and bind it to the context node MY_DATA
  • Go to method WDDOINIT( ) of your view, write the logic to get the data from ZTR_DATA and bind it to the context node MY_DATA by using method LO_NODE->BIND_TABLE( new_items = lt_data )
  • On action of SAVE button, you can read the data of context node ( table data  ) by using method lo_node->get_static_attributes_table( ) and save  lt_data to  ZTR_DATA

Hope this helps you.

Regards,

Rama

former_member184578
Active Contributor
0 Kudos

Hi,

You have to create a table with Input field cell editor. You can check this blog for reference: Input field in Table UI  . Then in onAction of Save button, read the table entries using get_static_attributes_table( ) method of context node and then save to DB.

Regards,

Kiran