cancel
Showing results for 
Search instead for 
Did you mean: 

syntax error

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Nithya - I tried what you recommended and it works now. I actually created the Z class with SE24. Thanks for your help.

Former Member
0 Kudos

Yeah, it should be created as global class in se24 only.

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi will,

I did tried with code that you have posted as it is in the tutorial. But it is giving an error The type " zcl_wdabap_flight_model=>get_bookings" is unknown. Could elaborate on how to create a class using se24. Can you post the complete code for that class.

best regards,

k.c

Former Member
0 Kudos

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

Former Member
0 Kudos

Nithya - I followed the instruction from the tutorial located at:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7a89b067-0801-0010-8192-a98...

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?

Former Member
0 Kudos

Why have you put your class definition and implementation inside a method.. end method statement? That is the problem here.