Application Development 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: 

ranges using subroutines

Former Member
0 Kudos

Hi All,

i have 20 parameters in Fm. if i pass any value in those parameters , the Fm should return the entries matching to that value. If i dont pass any value in params, the FM should return all the values . To achive this i have defined ranges for all 20 parameters and when those params have the value i am filling a range objects with values. If params not conatins any value am just not doing any thing.

Here my question is i want to fill this range objects using perform statement. I dont want to write 20 times. So i have created one subroutine passing range object as table and remaining values in USING statement. Here i am getting one error that range object is too big to hold the value.

MY perform statement is

perform range tables r_matnr

using 'I'

'EQ' 'lowvalue'.

form ranges tables p_r_matnr structure range_matnr

using p_i

p_eq

p_low.

endform.

can any one please tell me how to fill the range object dynamically, for example if the range object is werks then in the form statement structure i want to refer werks range.

Thanks,

CS Reddy.

6 REPLIES 6

naveen_inuganti2
Active Contributor
0 Kudos

Hi....

So here all the 20 parameters are same TYPE, is n't it?

If not how can you declared same RANGES table for all...?\

Plz get back here again.

Thanks,

Naveen.I

0 Kudos

Hi,

Thanks all for u r reply.

All 20 params are different. Thats what the problem. here i want to build dynamic reference type .

Any suggestions..

If i remove the reference structure thr program throws an error,.......

Thanks,

CS.

Former Member
0 Kudos

Hi,

just remove the 'struture ranges_matnr'. in the perform statement.

Regards,

venkat

Former Member
0 Kudos

hi,

i had spent quite some time for implementing the same suboutine once with no success.

we cannot use subroutine here according to me.

0 Kudos

Hi,

Pass the data using TYPE REF TO DATA.

DATA: lt_tab TYPE TABLE OF <some_type>.

DATA: data_ref TYPE REF TO DATA.

GET REFERENCE OF lt_tab INTO data_ref.

perform routine USING data_ref.

form routine p_data_ref TYPE REF TO DATA.

DATA: l_tab TYPE TABLE OF <some_type_same_as_above>.

l_tab = p_data_ref->*.

endform.

Best Regards,

Sesh

Former Member
0 Kudos

Hi CS Reddy,

Instead of the below statement

perform range tables r_matnr

using 'I'

'EQ' 'lowvalue'.

declare all the value like 'I','EQ' etc as constants.

Correct me if I am wrong.

Thanks & Regards,

M.Ramana Murthy