cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Static method in webdyno reference (SAP Certification material )

Former Member
0 Kudos

Hi Experts,

Reference:SAP Webdynpro for ABAP SAP Material for Participant exercise 7.

In the exercise 7 - Binding Internal Tables to Context Nodes

I am using as per the exercise following code in METHOD 'flighttab_fill' of component controller

---

CALL METHOD cl_net310_flightmodel=>read_flights

EXPORTING

i_carrid = stru_flightinfo-carrid

i_connid = stru_flightinfo-connid

IMPORTING

e_flights = it_flighttab.

---

I have not created cl_net310_flightmodel in my exercise.It was not given in the exercise too.

While activation of the component i am getting error

The Type cl_net310_flightmodel=>read_flights is unknown.

Can you please advice if you know anything.

Thanks and Regards,

Viswanath

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Did not checked but it is useful answer

Former Member
0 Kudos

Hi,

Follow the steps for creation of Class and the method in the excercise,

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

Former Member
0 Kudos

Hi

Thanks for your detailed reoly.

I am getting one more problem while doing example of populating Booking info to the Bookings table by selecting one of the row in the flight table.I could not see bookings data even though empty bookings table is displayed in the Display view after selecting a row in the 1st table.

The code in the Supply Function Bookings_Read is

method BOOKINGS_READ .

  data:
    Stru_flight             type IF_COMPONENTCONTROLLER=>Element_Flight_info,
    Itab_Booking            type IF_COMPONENTCONTROLLER=>Elements_Bookingtab.

* Get Parent Element
CALL METHOD parent_element->get_static_attributes
  IMPORTING
    STATIC_ATTRIBUTES = Stru_flight.

* read bookings
select * from sbook
into corresponding fields of table Itab_Booking
where carrid = Stru_flight-carrid
and connid = Stru_flight-connid
and fldate = Stru_flight-fldate.

* bind all the elements
Node->Bind_Table(
New_Items =  Itab_Booking
Set_Initial_Elements = Abap_False ).
endmethod.

Waiting for your valuable suggestion.

Do you have any alternatives for this to display bookings table.

Many Thanks In Advance.

Viswanath

Former Member
0 Kudos

Hi,

The code is correct provided 'node ' holds the correct reference to bookings context node.

Try debugging. Set an external break point at select query and check if the bookings internal table populates the values.

Revert back if any doubt in the excercises.

Regards

Achyut

Former Member
0 Kudos

Hi,

In our systems we will not be having the class mentioned in SAP training.

Either you can create a class OR

short cut is just write select queries so as to populte the it_flighttab and skip the portion of class code in your program.

It will serve the purpose.

Regds,

Akshay

Edited by: Akshay Bhagwat on Feb 20, 2008 10:43 AM

Former Member
0 Kudos

Thanks for your reply.

I tried with

Select * from sbook into table .... where carrid = stru_flightinfo-carrid and connid = stru_flightinfo-connid and....

and also with

Select <column list> from sbook into table .... where carrid = stru_flightinfo-carrid and connid = stru_flightinfo-connid and....

but nothing is populated to 2nd table.

Regards,

Viswanath

Former Member
0 Kudos

Hi,

You need to check if the said class is available in your system. Else, create a z-class and use that instead. Implement your own method to read flights, which would be nothing but reading from SFLIGHT for the given carrid and connid.

Regards,

Nithya

Former Member
0 Kudos

Thanks for your reply.

I tried with

Select * from sbook into table .... where carrid = stru_flightinfo-carrid and connid = stru_flightinfo-connid and....

and also with

Select <column list> from sbook into table .... where carrid = stru_flightinfo-carrid and connid = stru_flightinfo-connid and....

but nothing is populated to 2nd table.

Regards,

Viswanath