sapdev logo background
sapdev logo sapdev logo

Displaying data with ABAP WebDynpro table

Below are the steps for displaying data within an ABAP WebDynpro table.

Step 1
Create new Web dnpro component (WDP_SEL_TABLE), double click on the ComponentController and select the 'Context' tab. Now add a new node to the contect node (right click the context and select Create->Node).

Step 2
Give the new node a name and enter which table structure you want to base it on (i.e. table you want to display). Also rememeber to set the cardinality to 0:n (or 1:n) to denote a table.

Step 3
Now click on the 'add attributes from structure' button, and select your desired table fields.

Step 4
Press the green tick on both the new popup screens to return to your context section, your new context node should now have been added.

Step 5
Now click on the 'Methods' tab

Step 6
Double click on the 'WDDOINIT' method so that you can modify the ABAP code. Add the following code:

Data: it_scarr type standard table of scarr,
      context_node type ref to if_wd_context_node.

select * from scarr into table it_scarr.
  if sy-subrc eq 0.
    context_node = wd_context->get_child_node( name = 'CARRIERS').
*                   Note: CARRIERS' is the name you gave you new node
    context_node->bind_table( it_scarr ).

Step 7
Now create a new view

Step 8
Goto the context tab of the newly created view, and drag the CARRIERS node from the right hand window (ComponentController) to the view context window.

Step 9
The ComponentController node should now be mapped onto view node

Step 10
Select the layout tab and add a new Element of type 'Table'. Right click on the new table and select the 'Create Binding' option.

Step 11
Press the context button and then select the CARRIERS node (or the node you created earlier).

Step 12
You should now see the the list of fields contained in your node.

Step 13
Press the green tick to insert the the fields into your table element!

Step 14
Goto the window section and embed the view into the window!

Step 14
Create a WDpro application and test it!

comments powered by Disqus