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

ABAP Objects & Dynpros

Former Member
0 Likes
820

Hello,

is it possible to call a Dynpro in a Class?

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
793

No, it is NOT. Currently, classes do not support dynpros directly. However, you can call function modules, which can call dynpros. But you CAN NOT call dynpros directly in a class method.

Regards,

Rich Heilman

6 REPLIES 6
Read only

Former Member
0 Likes
793

Yes. It is very much possible.

Regards,

Ravi

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
794

No, it is NOT. Currently, classes do not support dynpros directly. However, you can call function modules, which can call dynpros. But you CAN NOT call dynpros directly in a class method.

Regards,

Rich Heilman

Read only

0 Likes
793

HI Rich,

From which version is this new change for i have developed a program of late, which does call a screen from a method of a class.

Regards,

Ravi

sample code:

report zexample.

*button to be clicked after which the event should get triggered

selection-screen: pushbutton /10(20) button user-command but1.

initialization.

button = 'LISTS'.

----


  • CLASS cl_names DEFINITION

----


*

----


class cl_names definition. " declare the events in this method

public section.

class-events: get_event exporting value(fcode) type sy-ucomm.

class-methods: user_action.

endclass. "cl_names DEFINITION

----


  • CLASS fcode_handler_class DEFINITION

----


*

----


class fcode_handler_class definition. " definition for handler events

public section.

methods: fcode_handler for event get_event

of cl_names importing fcode.

endclass. "fcode_handler_class DEFINITION

----


  • CLASS cl_names IMPLEMENTATION

----


*

----


class cl_names implementation. "Raise the event

method user_action.

raise event get_event exporting fcode = sy-ucomm.

endmethod. "USER_ACTION

endclass. "cl_names IMPLEMENTATION

----


  • CLASS fcode_handler_class IMPLEMENTATION

----


*

----


class fcode_handler_class implementation. "implement the handler event

method fcode_handler.

case fcode.

when 'BUT1'.

*WRITE: 'Hello Program !!'.

*message i001(zz) with 'Test'.

<b>call screen '0100'.</b>

endcase.

endmethod. "fcode_handler

endclass. "fcode_handler_class IMPLEMENTATION

data: h1 type ref to fcode_handler_class.

*start-of-selection.

at selection-screen.

create object h1.

set handler h1->fcode_handler." FOR ALL INSTANCES.

call method: cl_names=>user_action.

Call to the screen highlighted and is working fine.

Message was edited by:

Ravi Kanth Talagana

Read only

0 Likes
793

Hi Ravi,

in your example you are using local classes. I want to use Dynpros in global classes which are created with the Class Builder (SE24).

Thanks Rich for your response. Is there any documentation for your solution?

Read only

0 Likes
793

That is a local class implemented in a report progam, hence it is allowed, with global classes it is not.

Regards,

RIch Heilman

Read only

0 Likes
793

Thanks for the clarification Rich.

Regards,

Ravi