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

passing table values in method

Former Member
0 Likes
733

Hi Experts,

I have a Z class with 2 Instance Method. I want to create a global table and assign value in one method and retrieve the value in the 2nd method. I declared a data type of type standard table in the public section and I able to assign values in one method but the value is not available in the 2nd method.

Since both are Instance method I am unable to add any new parameter to the methods. Any suggestion on how to make the table value available in both the methods?

4 REPLIES 4
Read only

Former Member
0 Likes
700

CLASS-DATA declares a static attribute. thanks

Read only

0 Likes
700

you set the "attributes of an class attribute" - make it a Static Attribute and Private - as you want to access that attribute only from methods, it doesn't have to be public

Read only

Former Member
0 Likes
700

This message was moderated.

Read only

Former Member
0 Likes
700

Halo Srinivas,

I think you are missing something here. You have two options

1 Either you make this internal table as an attribute . So this attribute can be accessed by all the methods in the class . You fill up the attribute in first method and access the same in the second method

2 You fill up this internal table in the first method . This first method should have a returning parameter of that table type .This retruning table should be passes as the importing parameter of the second method.

lt_table = me->first_method( ).

me->second_method( it_table = lt_table ).

In the second case you have all the data available locally inside the methods

Regards

Arshad