cancel
Showing results for 
Search instead for 
Did you mean: 

List record using Abap Webdynpro

Former Member
0 Kudos

Hi Experts,

I am new to ABAP Webdnypro.

For my case, I would like to display reocrds using the "table" element in Abap Webdynpro.

E.g.

Col1 Col2 Col3 Col4

1 AA A1 John

2 BB B1 Peter

3 CC C1 Paul

4 DD D1 Mary

I have create binding between the "table" element and the context, but still no record show on the screen.

What should I need to do?

Thanks,

Kelvin

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Points awarded. Thank you very much

uday_gubbala2
Active Contributor
0 Kudos

Hi Kelvin,

Welcome to Web Dynpro ABAP! This is a simple process. You can try go [through this|http://www.erpgenie.com/component/content/article/684] where you would get step-by-step snapshots along with explanation for exactly the same requirement. You would basically need to do the following tasks:

1) Create a context node at your component controller level or view level with the desired attributes.

Say suppose am creating a node by name NODE at component controller level with the attributes as CARRID, CONNID, FLDATE & PRICE.

2) Now go to to the layout tab of your view and embed the table UI element into it. Bind the dataSource property of the table to the context node. (Since I had created the node at component controller level I would have to first map the node from the component controllers context to the view controllers context. Only then would all the nodes & attributes get available for me in my view.)

3) Now within the WDDOINIT method write the logic for populating the context nodes so that the table would get displayed along with some data on running the application. Go through the sample coding as shown below:

METHOD wddoinit .
  DATA: lr_node TYPE REF TO if_wd_context_node,
        wa_sflight TYPE wd_this->element_node,
        lt_sflight TYPE wd_this->elements_node.

" Extract the data to be displayed in the table ui element 
  SELECT * FROM sflight INTO corresponding fields of TABLE lt_sflight up to 10 rows.

" Get the reference of the context node NODE which we had created earlier
  lr_node = wd_context->get_child_node( name = 'NODE'  ).

" Bind the internal table with data to this context node
  lr_node->bind_table( new_items = lt_sflight ).
ENDMETHOD.

4) Create an application for your component and test the application. You should see the table with data getting displayed.

Regards,

Uday

Former Member
0 Kudos

Hi ,

suppose ur dictionary structure is SFLIGHT and u need to create table columns from it

please follow the steps :

1) Create a node say , SFLIGHT_NODE in the View Controller by opening the context menu

2)Select SFLIGHT as Dictionary Structure and u201C0u2026nu201D for the Cardinality.

Select button Add Attribute from Structure and select all components of structure SFLIGHT. Please note that if you do not click on u2018Add Attribute from Structureu2019 button, the node will be created empty with no attributes under it.

3) Switch to tab Layout of view MAINVIEW

a) Embed a new UI element of type table and assign the properties in the given table

The name of the table is SFLIGHT_TABLE.

b) Create the binding of SFLIGHT_TABLE with context node SFLIGHT_NODE, select Text View as Standard Cell Editors and activate bindings for all cells.Select context node SFLIGHT_NODE and press Continue.

c)Make sure that the binding for all context attributes is enabled

Switch to tab u2018Methodsu2019 of view MAINVIEW and double-click method WDDOINIT. Enter the given coding.

  • data declaration

data:

Node_sflight type REF TO IF_WD_CONTEXT_NODE,

Itab_sflight type standard table of SFLIGHT.

  • get data from table SFLIGHT

select * from SFLIGHT into table Itab_sflight.

  • navigate from <CONTEXT> to <SFLIGHT> via lead selection

Node_sflight = wd_Context->get_Child_Node( Name = `SFLIGHT_NODE` ).

  • bind internal table to context node <SFLIGHT>

Node_sflight->Bind_Table( Itab_sflight ).

this would help u .

Former Member
0 Kudos

Hi,

Could you please provide me some detail instruction on it?

Am I need to put this code under "WDDOINIT"

node->bind_table( it(zTableName) ).

P.S. zTableName is created using SE11

Best Regards,

Kelvin

arjun_thakur
Active Contributor
0 Kudos

hi kelvin,

Whenever WD application is executed WDDOINIT is always executed first, so you can put your code in wddoinit method. Or you can put it in some other method and can call it from wddoinit.

for table to display data: create a node with some attributes, in your case, with 4 attribute and bind it with your table UI element. now you need to create an internal table with fields same as that of your node. get data in that internal table (by using select statement, call FM or bapi) and bind it to your ui table.

use this statement:

node->bind_table( internal_table ).

i hope it helps

regards

arjun

vivekananthan_sellavel
Active Participant
0 Kudos

hi

i think ur using bind_element method. use bind_table

node->bind_table( it(internal table) ).