Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

What does this statement mean?

0 Likes
859

Hi all,

can anyone tell me as to what is meant by this statement.

DATA : event TYPE REF TO CL_HTMLB_EVENT.

Statement 1:

event = cl_htmlb_manager=>get_event( runtime->

server- >request)

Data :button_event TYPE REF TO CL_HTMLB_EVENT_BUTTON.

Statement 2:

button_event ?= event.

Please explain to me statement 1 and ststement 2.

Regards,

Saurabh

5 REPLIES 5
Read only

RoySayak
Active Participant
0 Likes
816

the first statement is calling a method of a class & the value returned by it will be assigned to the field EVENT.

the 2nd statement is asigning the object event to button event.

Read only

0 Likes
816

Hi Sayak,

Thanks for your reply.

can you please elaborate as to how the first statement works.

What is runtime -> server -> request ?

What is this ?

Please elaborate.

Regards,

Suarabh

Read only

Former Member
0 Likes
816

the code runs at server side (or may be at your own system)

whenever any event occur say a button is pressed, its function ket is send to server as an event

you should know what is the the function key of the button

and the code you want to execute on selection of the button is executed when the check - if event = 'FUNCTION_KEY' returns true.

Read only

matt
Active Contributor
0 Likes
816

1) "runtime" is a reference to an object. It has an attribute "server" that is a reference to an object. "server" has an attribute "request".

The static method get_event on class cl_htmlb_manager is called using this "request" as an import parameter, and returns an event, type reference to CL_HTMLB_EVENT.

2) CL_HTMLB_EVENT_BUTTON is a subclass of CL_HTMLB_EVENT. The first statement returns a result that is a reference to a CL_HTMLB_EVENT. But in order to handle a button event properly, it must be converted to a reference to a CL_HTMLB_EVENT_BUTTON. And that's what the ?= does. It casts the superclass object to the subclass object.

matt