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

programming using oops concept

Former Member
0 Likes
593

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
577

Hi,

YOu can execute transaction ABAPDOCU & expand ABAP OBJECTS to go through various oops programs.

Best regards,

Prashant

4 REPLIES 4
Read only

Former Member
0 Likes
577

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.

Read only

Former Member
0 Likes
578

Hi,

YOu can execute transaction ABAPDOCU & expand ABAP OBJECTS to go through various oops programs.

Best regards,

Prashant

Read only

Former Member
0 Likes
577

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^

Read only

Former Member
0 Likes
577

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'.