cancel
Showing results for 
Search instead for 
Did you mean: 

Class within method

Former Member
0 Kudos

Hi,

I am studyng the SAP´s Web Dynpro Tutorial 4 and I saw the error about CL_WDABAP_FLIGHT_MODEL=>get_bookings is unknow or not found.

And the resolution:

• Simply create a ZCL_WDABAP_FLIGHT_MODEL class in your get_bookings

method.

Its purpose is only to select from the SBOOK table.

select * from sbook into table bookings where

carrid = carrid

connid= connid

fldate = fldate.

->>bookings is the return parameter of type TY_BOOKINGS

But, how can I do this?

ps.: I am begginer in ABAP too.

Thanxs a lot!

Accepted Solutions (1)

Accepted Solutions (1)

Sm1tje
Active Contributor
0 Kudos

I'm not too sure about your proposed solution:

Simply create a ZCL_WDABAP_FLIGHT_MODEL class in your get_bookings

method.

If the method CL_WDABAP_FLIGHT_MODEL=>get_bookings is non existent, than I assume that the class CL_WDABAP_FLIGHT_MODEL is also not available.

So the easiest thing to do would be to select the data yourself from where ever you want to call the above mentioned method.

So do this:

select * from sbook into table bookings where

carrid = carrid

connid= connid

fldate = fldate.

->>bookings is the return parameter of type TY_BOOKINGS

But for this to work ok, first define an internal table 'bookings' (if not done yet) like this:

data: bookings type table of bookings.

And about the type TY_BOOKINGS, don't think you will need it anymore, since you have already selected all the data.

Former Member
0 Kudos

Hi Micky Oestreich,

I defined the internal table 'bookings', but when I tried active...

It´s shows me the message error:

Statement "CARRID=CARRID" is not defined. Check your spelling . . . . .

What can I do to fix this?

Sm1tje
Active Contributor
0 Kudos

Well I copied the selection from your first posting.

CARRID = CARRID. Don't forget the spaces.

did you define the field CARRID (the one on the left) already?

Former Member
0 Kudos

Hi,

I tried with and without spaces.

But the errors remains the same.

Sm1tje
Active Contributor
0 Kudos

this is the select statement you gave me:

select * from sbook into table bookings where

carrid = carrid

connid= connid

fldate = fldate.

For this to work correctly you have to declare CARRID, CONNID and FLDATE as well. I image that they are defined on the selection screen of your WD application (correct me if I'm wrong).

Read the context of the view, and use these parameters for selecting the data.

Former Member
0 Kudos

On selection screen??

I do not do this.

I did this in COMPONENTCONTROLLER -> GET_BOOKINS

Itab_Bookings = ZCL_WDABAP_FLIGHT_MODEL=>GET_BOOKINGS(

CARRID = Stru_FlightList-airlineid

CONNID = Stru_FlightList-connectid

FLDATE = Stru_FlightList-flightdate

).

node->bind_table( Itab_bookings ).

Is it correct?

I am following the the Sap Tutorial, but do not work.

Sm1tje
Active Contributor
0 Kudos

That's ok. Use the Stru_FlightList components:

select * from bookings into table bookings

where carrid = Stru_FlightList-carrrid

and connid = Stru_FlightList-connid

and fldate = Stru_FlightList-fldate.

Answers (1)

Answers (1)

Former Member
0 Kudos

Plz try this...this will solve the problem i think...

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.

data : bookings TYPE ty_bookings.

parent_element->get_static_attributes( importing static_attributes =

Stru_FlightList ).

select * from sbook into table bookings where

carrid = Stru_FlightList-airlineid and

connid = Stru_FlightList-connectid and

fldate = Stru_FlightList-flightdate.

Itab_bookings = bookings.

node->bind_table( Itab_bookings ).

endmethod.