on 10-25-2010 9:32 AM
A list of all available airline carriers is displayed in a table view called Carrier. To do this, the UI element of the type Table is bound to a context node which is filled in the method WDDOINIT of the view controller using an appropriate method. The method WDDOINIT is called when the application is executed for the first time and the data for the table elements is visible for the user at the time of the first display on the screen.
A second table (Connections) displays all flights offered for a specific airline carrier according to the selected element in the first table. The user can select any line in the first table and find the corresponding detail information in the second table. The second table must be filled according to the selected airline carrier, but the view must not be wholly recreated for each selection.
The structure of the context view is as follows:
This graphic is explained in the accompanying text
The first table (Carrier) is bound to the context node CARRIER_NODE, the table Connections is bound to the context node CONNECTION_NODE. When calling the application for the first time, the WDDOINIT method fills the top node with all elements of the database table SCARR which is a list of all airline carriers, their IDs, and the URL of the corresponding homepage. The lead selection of the context node has been automatically created on the first element of the node, and the airline carrier at the top position of the table is the lead selection element.
This graphic is explained in the accompanying text
All flights available for the airline carrier on the lead selection position are listed in the table Connections. The context node CONNECTION_NODE to which the second table is bound is filled by the supply function GET_CONNECTIONS from the database table SPFLI. The lead selection element of the Carrier table is read and all connection information on the corresponding airline carrier are displayed:
This graphic is explained in the accompanying text
When you select another table element as the lead selection in the table Carrier,
This graphic is explained in the accompanying text
the content of the table Connections automatically changes:
data: CARR_ATTR type IF_MAINVIEW=>ELEMENT_CARRIER_NODE,
FLIGHTS type SPFLI_TAB.
get filled structure for parent node
PARENT_ELEMENT->GET_STATIC_ATTRIBUTES( importing
STATIC_ATTRIBUTES = CARR_ATTR ).
get connections from help class
FLIGHTS = CL_WD_GET_SPFLI=>GET_FLIGHTS_BY_CARRID(
CARRID = CARR_ATTR-CARRID ).
NODE->BIND_ELEMENTS( FLIGHTS ).
*I am getting error has the type is unknow data: CARR_ATTR type IF_MAINVIEW=>ELEMENT_CARRIER_NODE,*
answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi, ananth.anni.
You said:
**I am getting error has the type is unknow data: CARR_ATTR type IF_MAINVIEW=>ELEMENT_CARRIER_NODE,**
To check whether the view "MAINVIEW" contains the "element(s)_", you can double click the "wd_this"(that is if_main) to search "element" then, you will get all the context node structure declared in this view...
So, i guess you didn't declared your context node in "Mainview" view.Maybe you create it in component controller, but you forgot to map it to the "Mainview" view.
You can do a check.
In addition, about Supply function, it is simple, only what you need to do is :give the context node's supply function one method, then in the method automatically created in the method list you can realize your logic.
There is one EXAMPLE coding, hope it can help you a little.
"Parameters:
NODE importing IF_WD_CONTEXT_NODE
PARENT_ELEMENT importing IF_WD_CONTEXT_ELEMENT
method GET_BOOKING .
DATA:
lo_node TYPE REF TO if_wd_context_node,
ls_flight TYPE if_v_main=>element_FLIGHT,
ls_booking TYPE if_v_main=>element_BOOKING ,
lt_booking TYPE if_v_main=>elements_BOOKING.
* get the parent element data
PARENT_ELEMENT->GET_STATIC_ATTRIBUTES(
IMPORTING STATIC_ATTRIBUTES = ls_flight ).
* read bookings related to selected flight
SELECT * INTO CORRESPONDING FIELDS OF TABLE lt_booking FROM ZTABLE_BOOKING
WHERE CARRID = ls_flight-carrid
AND CONNID = ls_flight-connid
.
* bind
"lo_node = PARENT_ELEMENT->get_child_node( if_v_main=>wdctx_booking ).
"Also, we can use the "Node" parameter directly
lo_node = node.
lo_node->bind_table(
new_items = lt_booking
set_initial_elements = abap_true ).
endmethod.
Best wishes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
I just post one blog article for Supply function for you. It is simple, You can check it and hope it can help you a little in this topic.
Using Supply Function in Web Dynpro:
http://space.itpub.net/17144169/viewspace-676686
Best wishes.
hi, ananth.
I think maybe you need know the ALV functions well, then you will be very familiar with what you are confused now.
For example, you can search this forum by "ALV total" or other key words.
And you also should know the various ALV/table/column setting functions which can achieve what you want.
I am sorry not to give your the screen-shot directly, as i have any existing
Best wishes.
hi, ananth.
Very sorry for my mis-understanding.
Go back to this topic.
As far as i know, if we want to set the total in STANDARD TABLE, we will not treat it as in ALV. From my experience, in standard table, i have to add different Cell variant in the table. Ya, you know, at least 2 kinds of cell variant: one is for the real data(i.e. each record), and one is just for Total.
Take one example, the standard cell variant for each real data is named "NORM" , the cell variant for total named "SUM".
Ya, one important : i should add one context attribute named "cell_variant" to the context node which hold the real data, and bind this context attribute to the property "selected cell variant" of each column of table.
Then, for example, we can do Calculation statically
loop at.
"normal record
ls_record-cell_variant = 'NORM' .
append ls_record1 to lt_data.
move-coresponding...
" total
ls_total-field1 = ls_total-field1 +ls_record-field1 .
at end of <>.
ls_table-cell_variant = 'SUM' .
append ls_total-field1 to lt_data.
endat.
endloop.
"then bind the data
lo_node->bind_table( lt_data ).
I don't know whether this can fit your question or not.
Any way, very glad to discuss with you about this topic.
Best wishes.
hi,
I just posted one PDF for you.
As there is no much time to prepare it, it is simple and easy, hope it can help you a little.
http://www.rayfile.com/zh-cn/files/8c5fb766-e0e3-11df-8bd7-0015c55db73d/
Best wishes.
Edited by: Can Tang on Oct 26, 2010 11:32 AM
Hi ,
Where have you created the node CARRIER_NODE??
Is it in a view or in component controller?
Thanks
aditya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.