cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of class inside Method

Former Member
0 Kudos

Hi Forums,

I am new to WebDynpro-Abap and i am trying to practice WebDynpro-Abap with the help of standard Tutorial avl in the SDN.

In the Tutorial 4, i am getting the following error,

The type <b>CL_WDABAP_FLIGHT_MODEL=>get_bookings is unknown or not found</b>

but in that tutorial,they specify the encounter of the above error like

<u>Simply create a ZCL_WDABAP_FLIGHT_MODEL class in your get_bookings method.</u>

But i don't know,where to Create the class inside the get_bookings method

can any body tell me the steps to create ZCL_WDABAP_FLIGHT_MODEL class in the get_bookings method and the remaining steps to execute the particular application.

Thanks in Advance,

Ashok

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member184578
Active Contributor
0 Kudos

Hi.,

It is CL_ABAPWD_FLIGHT_MODEL not CL_WDABAP_FLIGHT_MODEL.

hope this helps u.,

Thanks & Regards,

Kiran

0 Kudos

Hi ashok,

You can do that exercise by bypassing of creating ZCL_WDABAP_FLIGHT_MODEL to finish the exercise. When I create that class I will send you the steps also if you left your email address.

types: ty_booking type sbook.

data: bookings type standard table of ty_booking.

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 ).

SELECT * FROM SBOOK INTO table BOOKINGS WHERE

CARRID = Stru_FlightList-airlineid AND

CONNID = Stru_FlightList-connectid AND

FLDATE = Stru_FlightList-flightdate.

node->bind_table( BOOKINGS ).

Former Member
0 Kudos

hi

wo have a same question ! Thank u for reply!

regards,

feng

Former Member
0 Kudos

Follow this link...

Former Member
0 Kudos

Hi Ashok,

Follow the steps for creation of Class and the method,

STEPS TO CREATE CLASS:

1) CREATE ZIT_FLIGHTTAB(AN INTERNAL TABLE) IN SE11 UNDER DATA TYPE->TABLE TYPE.

2) GIVE LINE TYPE AS SFLIGHT. SAVE,CHECK AND ACTIVATE THE INTERNAL TABLE.

3) CREATE GLOBAL CLASS ZNET_NET310_FLIGHTMODEL_## USING TRANSACTION CODE SE24.

4) IN THE ATTRIBUTES TAB, ENTER AS FOLLOWS,

ATTRIBUTE LEVEL VISIBILITY TYPING ASSOCIATED TYPE

TY_FLIGHTS STATIC ATTRIBUTE PUBLIC TYPE SFLIGHT

ZIT_OUTTAB STATIC ATTRIBUTE PUBLIC TYPE TY_FLIGHTS

5) IN THE METHODS TAB, ENTER AS FOLLOWS,

METHOD LEVEL VISIBILITY DESCRIPTION

READ_FLIGHTS STATIC METHOD PUBLIC READ FLIGHT DATA

6) CLICK ON PARAMETERS, ENTER AS FOLLOWS,

PARAMETER TYPE TYPING METHOD ASSOCIATED TYPE

I_CARRID IMPORTING TYPE SFLIGHT-CARRID

I_CONNID IMPORTING TYPE SFLIGHT-CONNID

E_FLIGHTS EXPORTING TYPE ZIT_FLIGHTTAB

7) DOUBLE CLICK ON METHOD:READ_FLIGHTS AND ENTER FOLLOWING SORCE CODE IN BETWEEN METHOD AND ENDMETHOD.

SELECT * FROM SFLIGHT INTO TABLE ZIT_OUTTAB WHERE CARRID = I_CARRID AND CONNID = I_CONNID.

E_FLIGHTS[] = ZIT_OUTTAB[].

😎 SAVE CHECK AND ACTIVATE CLASS.

NOTE :

PLEASE FOLLOW SAME STEPS FOR OTHER METHODS THAT COMES IN FOLLOWING EXCERCISE IN SAME CLASS i.e ZCL_NET310_FLIGHTMODEL_##.

In next few tutorials you will need to create more methods. Follow steps to add new methods as and when required.

Regards,

Achyut

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Hi, you do not create this in the METHOD, you would create this in the class builder or SE24. Go to SE24, and create the class ZCL_WDABAP_FLIGHT_MODEL.

Regards,

Rich HEilman

Former Member
0 Kudos

hi Rich,

Thank u for u'r rply and i have one more doubt,If i am going to create with the help of SE24 means,what are all the value i want to give in the "INTERFACE","ATTRIBUTES" and "METHODS".

Actually what is my purpose to create class 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

can u give the details reg. same.

Thanks in Advance,

Regards,

Ashok

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

I am very glad that you asked this. Yes you could simply put your SELECT statement directly into the coding inside the GET_BOOKINGS method, since this is just a tutorial, you may just want to do that. But, please understand that Web Dynpro is based on the MVC paradigm which forces clear separation of business logic from UI logic. This is why the tutorial is putting the SELECT statement within a class. This is one way of separating the business logic from the UI logic. Another way is to use an assistance class which is basically the same thing. The only difference is that the assistance class will inherit from another class and hence implement an interface, then you simply tell the WDA component that you are using this assistance class and it is automatically instaniated and you simply call the methods of the class using the WD_ASSIST object. But you can look into that later. If you don't want to go thru the creation of the class mentioned in this tutorial, simply embed your SELECT statement directly. You can do that.

Regards,

RIch Heilman

Former Member
0 Kudos

This question was not answered sufficiently. I realize this tutorial is NOT a lesson on how to create a class, but the answer given was making an assumption that the creation of the ZCL_WDABAP_FLIGHT_MODEL was understood. This was clearly not understood and this answer made the creation of the class seem difficult. A correct answer would have been to clearly go over the process to create this class using SE24. If not then the question should NOT have been answered at all..