We can create a transaction code for public method of global class using OO transaction model or a class defined in the local program without checking OO transaction model.
Scenario: We have created a local class Z_CLASS_METHOD with public methods, Display in ZLOCAL_DEMO module pool program. Now we would like to have a transaction code for method Display. Display method will display a message like “Transaction code for OO method class”.
Code ZLOCAL_DEMO.
*&---------------------------------------------------------------------* *& Report ZLOCAL_DEMO *& *&---------------------------------------------------------------------* *& *& *&---------------------------------------------------------------------* PROGRAM zlocal_demo. *----------------------------------------------------------------------* * CLASS Z_CLASS_METHOD DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS z_class_method DEFINITION. PUBLIC SECTION. METHODS method_test_display. ENDCLASS. "Z_CLASS_METHOD DEFINITION *----------------------------------------------------------------------* * CLASS Z_CLASS_METHOD IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS z_class_method IMPLEMENTATION. METHOD method_test_display. MESSAGE 'Transaction code for OO method class' TYPE 'I'. ENDMETHOD. "METHOD_TEST_DISPLAY ENDCLASS. "Z_CLASS_METHOD IMPLEMENTATION
2.
- Go to the transaction code SE93 Enter the name of the transaction code Z_T_OO_Method and choose method of class (OO transaction) check box.
2. Uncheck OO transaction model. Enter the class name Z_CLASS_METHOD, method name METHOD_TEST_DISPLAY and the module pool program name.
Save and execute this transaction
No comments:
Post a Comment