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

[abap] regarding oops(simple program need help)

Former Member
0 Likes
330

Hi,

Hello<username>

<date> <time>

"welcome to sap"

I want this as my output in my program and please bring this output form oops program, need as early as possible please.

Thanks,

2 REPLIES 2
Read only

raja_thangamani
Active Contributor
0 Likes
311

Here is the code:

WRITE: / 'Hello ', SY-UNAME.
WRITE: / 'Date:', SY-DATUM, SY-UZEIT.
WRITE / 'welcome to sap'.

you can write the above code in report or class & method.

If you are writing in method, then call the class & method in your report.

<i>*Reward each useful answer</i>

Raja T

Message was edited by:

Raja Thangamani

Read only

0 Likes
311

Here it is:


CLASS greatings DEFINITION.

  PUBLIC SECTION.

   METHODS greatings.

  PRIVATE SECTION.

   METHODS: say_hello,
               tell_date,
               welcome.
ENDCLASS.

CLASS greatings IMPLEMENTATION.

 METHOD greatings.

   me->say_hello( ).
   me->tell_date( ).
   me->welcome( ).

 ENDMETHOD.

 METHOD say_hello.

  WRITE: / 'Hello ', SY-UNAME.

 ENDMETHOD.

 METHOD tell_date.

  WRITE: / 'Date:', SY-DATUM, SY-UZEIT.

 ENDMETHOD.

 METHOD welcome.

  WRITE / 'welcome to sap'.

 ENDMETHOD.

ENDCLASS

START-OF-SELECTION.

  DATA: classObject TYPE REF TO greatings.

  CREATE OBJECT classObject.

  classObject->greatings( ).

Hope this helps,

Roby.