| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Document Categories:
What's New?
Contribute?Sample SpecsWhat's Hot? |
Create Transaction for local class methodBy Joyjit Ghosh, IBM India In this demo I am going to show how to create transaction on
a local class method. REPORT z_demo_oop_jg . *---------------------------------------------------------------------* * CLASS create_report DEFINITION *---------------------------------------------------------------------* * *---------------------------------------------------------------------* CLASS create_report DEFINITION. PUBLIC SECTION. METHODS: main. PRIVATE SECTION.
DATA: i_data TYPE STANDARD TABLE OF sbook INITIAL SIZE 0.
METHODS: fetch_data,
display_data.
ENDCLASS. "create_report DEFINITION *---------------------------------------------------------------------* * CLASS create_report IMPLEMENTATION *---------------------------------------------------------------------* * *---------------------------------------------------------------------* CLASS create_report IMPLEMENTATION. METHOD fetch_data. * Select 100 records from SBOOK table
SELECT * FROM sbook
INTO TABLE i_data
UP TO 100 ROWS.
ENDMETHOD. "fetch_data METHOD display_data.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'SBOOK'
TABLES
t_outtab = i_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMETHOD. "display_data METHOD main.
fetch_data( ).
display_data( ).
ENDMETHOD. "main ENDCLASS. "create_report IMPLEMENTATION Step2. Now from transaction SE93 create a transaction for the
method MAIN as shown in the screen shots given below: Give a transaction name and press create button.
In the next screen give a description and choose the proper
radio button
In the next screen provide report name (where the local class
is defined), local class name and method name.
This technique can be used to call a method (local class)
from another program using statement: call transaction. EX: call transaction 'Z_OOP'. Note: In the same way you can create a transaction on method
of a global class. |
|
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||