‎2007 Oct 05 4:39 AM
hai gurus can any one tell me how to write a program using oops
if i want to write just a simple report displaying 'hello'
what code should i use
regards
afzal
‎2007 Oct 05 4:44 AM
Hi,
YOu can execute transaction ABAPDOCU & expand ABAP OBJECTS to go through various oops programs.
Best regards,
Prashant
‎2007 Oct 05 4:44 AM
HI,
like this u have to write.
CLASS cls DEFINITION.
PUBLIC SECTION.
METHODS:meth.
ENDCLASS.
CLASS cls IMPLEMENTATION.
METHOD meth.
write:/ 'Hello'.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA:obj TYPE REF TO cls.
CREATE OBJECT obj.
CALL METHOD obj->meth.
for more info see this link
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
rgds,
bharat.
‎2007 Oct 05 4:44 AM
Hi,
YOu can execute transaction ABAPDOCU & expand ABAP OBJECTS to go through various oops programs.
Best regards,
Prashant
‎2007 Oct 05 5:19 AM
hi
good
Anil
&----
*& Report ZBCONE_EMPLOYEE
*&
&----
*&
*&
&----
REPORT ZBCONE_EMPLOYEE no standard page heading line-size 250
line-count 50.
tables: ZBCONE_EMP.
data: wa like zbcone_emp,
itab type table of zbcone_emp.
parameters: empid type zbcone_emp-id,
empname type zbcone_emp-name.
CLASS bcone_employee definition.
public section.
methods:
enter_data,
show_data.
ENDCLASS.
class bcone_employee implementation.
method: enter_data.
wa-id = empid.
wa-name = empname.
insert into zbcone_emp values wa.
endmethod.
method: show_data.
select * from zbcone_emp into wa
where id = empid.
append wa to itab.
endselect.
write:/5 'Emp no', 15 'Employee Name'.
loop at itab into wa.
write: /5 wa-id, 15 wa-name.
endloop.
endmethod.
endclass.
data: obj type ref to bcone_employee.
start-of-selection.
create object obj.
call method obj->enter_data.
call method obj->show_data.
reward point if helpful.
thanks
mrutyun^
‎2007 Oct 05 5:25 AM
CLASS Mytest DEFINITION.
PUBLIC SECTION.
METHODS: SPrint IMPORTING value(xStr) TYPE String.
ENDCLASS.
CLASS Mytest IMPLEMENTATION.
METHOD SPrint.
write:/ xStr.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA MyObj TYPE REF TO Mytest.
CREATE OBJECT MyObj.
CALL METHOD MyObj->SPrint EXPORTING xStr = 'Hello'.