on 06-27-2007 1:56 AM
I get a "statement ENDMETHOD is missing" error in the following code. Can someone help me find the error?
method GET_BOOKINGS.
----
CLASS zcl_wdabap_flight_model DEFINITION
----
*
----
CLASS zcl_wdabap_flight_model DEFINITION.
PUBLIC SECTION.
methods GET_BOOKINGS IMPORTING
carrid TYPE s_carrid
connid type s_connid
fldate type s_date
EXPORTING
bookings type TY_BOOKINGS.
ENDCLASS. "zcl_wdabap_flight_model DEFINITION
----
CLASS zcl_wdabap_flight_model IMPLEMENTATION
----
*
----
CLASS zcl_wdabap_flight_model IMPLEMENTATION.
METHOD get_bookings.
select * from sbook into table bookings where
carrid = carrid and
connid = connid and
fldate = fldate.
ENDMETHOD. "get_bookings
ENDCLASS. "zcl_wdabap_flight_model IMPLEMENTATION
data:
Itab_Bookings type IF_COMPONENTCONTROLLER=>Elements_Bookings,
Stru_Bookings like line of Itab_Bookings,
Stru_FlightList type IF_COMPONENTCONTROLLER=>Element_Flight_List,
cl type ref to zcl_wdabap_flight_model.
parent_element->get_static_attributes( importing static_attributes = Stru_FlightList ).
create object cl.
Itab_Bookings = call method cl->get_bookings (
exporting
carrid = Stru_FlightList-airlineid
connid = Stru_FlightList-connectid
fldate = Stru_FlightList-flightdate
importing
bookings = bookings ).
node->bind_table( Itab_Bookings ).
endmethod. "get_bookings
Hi Tiberiu.
Yo do not need this class here.
You could add your method which selects all bookings inside the assistance class of your component.
then your code would look like:
wd_assist->get_bookeings( ... ).
Cheers,
Sascha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
The wording in the tutorial does indeed give that meaning. What it intends to convey, however is different.
You can check if you have the class cl_wdabap_flight_model in your system. In which case, if you copy paste the code in your supply function, it would work. If the class does not exist, then you create a Z class zcl_wdabap_flight_model and indtroduce a static method get_bookings that would return a table of type SBOOK. You would just put the select query inside that method.
Try it, and it will work.
Regards,
Nithya
hi tiebriu sasu,
I have also similar kind of error. I am new to webdynpro for abap. Can you post the code for the method getbookings.
best regards,
k.c
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi k.c,
I'm also new to webdynpro, but have managed to fumble my way through this tutorial and to my relief it is all working!!!
I created the class zcl_wdabap_flight_model in se24 as mentioned in the above postings. The code for the method get_bookings in the COMPONENTCONTROLLER is as follows:
METHOD get_bookings .
DATA:
itab_bookings TYPE if_componentcontroller=>elements_bookings,
stru_bookings LIKE LINE OF itab_bookings,
stru_flightlist TYPE if_componentcontroller=>element_flight_list.
parent_element->get_static_attributes(
IMPORTING static_attributes = stru_flightlist ).
CALL METHOD zcl_wdabap_flight_model=>get_bookings
EXPORTING
carrid = stru_flightlist-airlineid
connid = stru_flightlist-connectid
fldate = stru_flightlist-flightdate
IMPORTING
bookings = itab_bookings.
node->bind_table( itab_bookings ).
ENDMETHOD. "get_bookings
Hope this helps!!
Will
also,
i can see your trying to call the same method that you are defining again...
Always logically separate your code as declaration definition and implementation and use pretty printer...this will help you identify these kinds of error much faster...
Normally this error comes when there is no matching endmethod statement for a "method" statement.
Hope this will help you.Please award points if your problem is solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nithya - I followed the instruction from the tutorial located at:
page 12 says I should create the class inside the get_bookings method.
Rahul - both methods have the same name, but they have a different visibility. One method is an instance method of the class I just defined, and it is called as such "call method <object instance>->get_bookings". The ABAP compiler should be able to figure out which method I intend to call, wouldn't it?
Or ABAP has more limitations that I am thinking of?
Why have you put your class definition and implementation inside a method.. end method statement? That is the problem here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
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.