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 Objects

Former Member
0 Likes
489

Hi

Iam new to ABAP Objects,

Can anyone tell me what is this mean

me->amount = me->amount + amount.

what me-> resembles??

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
465

It reffers to a variable(attribute) 'amount' of current class, it can be used within method belonging to that class.

Message was edited by: Tomasz Kozerski

3 REPLIES 3
Read only

Former Member
0 Likes
466

It reffers to a variable(attribute) 'amount' of current class, it can be used within method belonging to that class.

Message was edited by: Tomasz Kozerski

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
465

HI,

Me is nothing but the current object at the run-time.

by me->amount you are saying that for the current object under execution take the amount that is passed to the method as an import parameter and add it to the objects attribute amount.

me->amount = me->amount(This is classes attribute) + amount(This is an import parameter).

Me(Current object for which processing is happening).

If you are aware of JAVA then it is nothing but the 'this' keyword of java.

Regards,

Sesh

Read only

thomasalexander_ritter
Product and Topic Expert
Product and Topic Expert
0 Likes
465

Hi,

the question could also be when should you use it?

Seshatalpasai Madala already included the answer. Imagine you have a class which has the <u>attribute</u> amount. The class also has a method which has a <u>parameter</u> called amount. Now, when you implemented the method you need a way to tell the compiler which amount variable you want to reference. The solution is the <b>me</b> keyword.

You often see this in setter methods. Example

method set_amount.

me->amount = amount.

endmethod

cheers

Thomas