cancel
Showing results for 
Search instead for 
Did you mean: 

Performs in class

Former Member
0 Kudos

Hello,

Can we use PERFORM sub routiens in Class?

Or is it always a Local Class?

Rgds,

O

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If you are working with a global class, then I believe that you may be able to call a FORM from another program like this.

PERFORM routine in program some_program.

Regards,

Rich Heilman

Answers (2)

Answers (2)

former_member188685
Active Contributor
0 Kudos

Yeah you can use , but it all depends on your way of coding.are you facing any problem.

Regards

Vijay

Former Member
0 Kudos

Hi,

You can definitely use PERFORM statement in the local class.ie in the se38 program.

Just go through this example.

class shail_event definition.

public section.

methods:

handle_toolbar for event toolbar of cl_gui_alv_grid

importing e_object e_interactive,

handle_user_command for event user_command of cl_gui_alv_grid importing

e_ucomm,

handle_contextmenu_request for event context_menu_request of

cl_gui_alv_grid importing e_object.

endclass.

class shail_event implementation.

method handle_toolbar.

perform handler_toolbar using e_object e_interactive.

endmethod.

method handle_user_command.

perform handler_user_command using e_ucomm.

endmethod.

method handle_contextmenu_request.

perform handler_contextmenu_request using e_object.

endmethod.

endclass.

orm handler_toolbar using p_e_object type ref to

cl_alv_event_toolbar_set

p_e_interactive .

data: ls_toolbar type stb_button.

*clear ls_toolbar.

*move 3 to ls_toolbar-butn_type.

*append ls_toolbar to p_e_object->mt_toolbar.

clear ls_toolbar.

move 'PER' to ls_toolbar-function. "#EC NOTEXT

move icon_display_text to ls_toolbar-icon.

move 'Test Info'(201) to ls_toolbar-quickinfo.

move 'Test Info'(201) to ls_toolbar-text.

move ' ' to ls_toolbar-disabled. "#EC NOTEXT

append ls_toolbar to p_e_object->mt_toolbar.

endform.

form handler_user_command using p_e_ucomm.

case p_e_ucomm.

when 'PER'.

perform selected_columns.

endcase.

form handler_contextmenu_request using p_e_object type ref to

cl_ctmenu.

CALL METHOD p_e_object->clear

.

CALL METHOD p_e_object->add_function

EXPORTING

fcode = 'CREA'

text = 'Add Function'

  • ICON =

  • FTYPE =

  • DISABLED =

  • HIDDEN =

  • CHECKED =

  • ACCELERATOR =

.

*

endform. " handler_contextmenu_request

form selected_columns.

CALL METHOD go_grid->get_selected_cells_id

IMPORTING

ET_CELLS = my_column[]

.

loop at my_column.

    • this will specify the id of the selected cell

message i001(zmess) with my_column-row_id.

message i002(zmess) with my_column-col_id.

endloop.

endform.

This is just an example involving ALV..

Regards,

Sylendra.