2010 Oct 04 8:59 PM
Hi everybody,
Someone knows some function module that let me get all possible values from a range?
I've a range and need to get all values of it for consistences.
E.G.:
RANGE
I - EQ - FROM 100 - TO 104
RETURN of wanted FM:
100
101
102
103
104
Thanks in advance.
Regards,
Charles
2010 Oct 04 9:10 PM
A simple Open SQL SELECT will do that nicely...Seriously, how could a function module return all the possible variations on the hundreds of thousands of possibilities in SAP?
Hi everybody,
Someone knows some function module that let me get all possible values from a range?
I've a range and need to get all values of it for consistences.
E.G.:
RANGE
I - EQ - FROM 100 - TO 104
RETURN of wanted FM:
100
101
102
103
104
Thanks in advance.
Regards,
Charles
2010 Oct 04 9:10 PM
A simple Open SQL SELECT will do that nicely...Seriously, how could a function module return all the possible variations on the hundreds of thousands of possibilities in SAP?
2010 Oct 05 12:21 AM
Hi "BreakPoint",
I think you didn't get my point. I do not want to use the range to get data from the database. Obviously it's simple to do that using the range in the WHERE clause from Open SQL.
It's not hard to do. I only was wanting to reuse a standard FM.
Thank you for your time anyway.
Best regards,
Charles
2010 Oct 05 12:15 AM
Hi Charles
To do so you need to perform an Open SQL statement. Like
SELECT key_field FROM my_table WHERE my_field IN my_range.
Kind regards
Carlos Machado
2010 Oct 05 12:29 AM
Hi Carlos,
Please refer to my reply to "BreakPoint" (above).
I'm not looking for consistence against database values. The values of the range will be passed on as parameter to a web service.
Thank you anyway.
Regards,
Charles
2010 Oct 05 7:57 AM
Hi Charles,
The two Experts suggest great solution.
But according to you, i think it would be very hard to get range base on your condition. YOu have to do it manually if you don't want to check consistency from database.
Thanks,
Thien
2010 Oct 05 12:32 PM
Thank you Thien, maybe I'll have to do it manually.
An ABAPER here at work says there's a METHOD to do this in a SAP solution. He guess it's in SAP GRE NFE but is not sure.
2010 Oct 05 12:42 PM
Hi,
You can write the following code .
data : v_i type i.
ranges : s_i for v_i.
data : begin of it_itab occurs 0,
val type i,
end of it_itab.
s_i-sign = 'I'.
s_i-option = 'BT'.
s_i-low = '100'.
s_i-high = '104'.
append s_i.
loop at s_i.
while s_i-low < s_i-high.
it_itab-val = s_i-low.
append it_itab.
s_i-low = s_i-low + 1.
endwhile.
it_itab-val = s_i-high.
append it_itab.
endloop.Regards,
Srini.
Edited by: Thomas Zloch on Oct 5, 2010 6:10 PM - please use code tags!
2010 Oct 05 5:07 PM
Hi Srini, thank you for try help.
Your code consider only the inc. intervals. I need to consider all values for sign and option. But don't worry! As I wrote, I do know how to code my own solution. I was only looking for a "standard way" of do it.
2010 Oct 05 5:14 PM
Sounds not so feasible to me. What is the possible overall value range? Do you have only integer value, or mixed in alphanumerics (code page, unicode problems...)? Where do they start and stop? What would be the expected result for I/LT/20 for example, or I/GT/150?
Thomas
2010 Oct 06 1:39 AM
Hi Thomas,
I've a big background in programming and although it's not so feasible it's very doable. Obviously it's hard work to cover all possibilities.
The solution that I developed is very specific to my client. There is only 2 types of values: numeric-character and date. For the NUMC value the client defined the interval from 1 to 999999 and I consider all type of ranges. For the DATE value only I/EQ and I/BT will be considered.
A generic solution is another thing... I don't need it anymore. But again, it's doable.
Kind regards,
Charles
2010 Oct 05 5:12 PM
I developed my own code. I'll not share it here because I didn't take the time to make a generic or reusable solution.
Thank you all.
Regards,
Charles
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |