on 12-09-2008 3:32 PM
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
Points awarded. Thank you very much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
hi
i think ur using bind_element method. use bind_table
node->bind_table( it(internal table) ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.