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

Calling a method to a program

Former Member
0 Likes
463

hello,

I have a requirement that I am working on, I need to create a program that will have vendor number and vendor bank account number on the selection screen.

Now what I need to do is I need to call a method from a class that will do some kind of validation, method name is 'validation'

My problem here is that method validation has only vendor bank account number as a parameter. Vendor number is defined as an attribute in the class, let's say z_vendor, and in the method we are using Z_vendor as a vendor number.

Can you please tell me how can I set the value of the attribute to the one that the user will enter using a FM and then how to call the method validation in to my program.

I can not make any change the way class has been declared.

The attribute z_vendor is defined as follows:

1. Level - Instance Attribute

2. Visibility - Public

I am very new to OOPS.. so any help will be really appreciated.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
437

Hi Rahul,

You can do like this:

data:lr_object type ref to CLASS (NAME of your class)

create object lr.

1.lr_object->z_vendor = vendor no.

2. call method lr_object->method name (in Importing parameter pass the vendor bank account no.

And then in the method your vendor no and bank account will be passed.

Thanks

Bhanu

2 REPLIES 2
Read only

Former Member
0 Likes
438

Hi Rahul,

You can do like this:

data:lr_object type ref to CLASS (NAME of your class)

create object lr.

1.lr_object->z_vendor = vendor no.

2. call method lr_object->method name (in Importing parameter pass the vendor bank account no.

And then in the method your vendor no and bank account will be passed.

Thanks

Bhanu

Read only

0 Likes
437

Useless...