‎2006 Sep 11 6:54 AM
Hi,
I have the following requirement.
There are 2 ID's , say LOA_A and LOA_K. I have to find out all the possible ID's between these 2. (In this case the list will be LOA_B, LOA_C and so on till LOA_J).
I thought I would reuse the same functionality as used in Ranges/Select-options in abap. But I am not sure of which function module to use for this purpose.
Please help me.
Thanks and Regards
Moorthy
‎2006 Sep 11 8:02 AM
Sorry.
You cannot generate these IDs using Ranges/SELECT-options
‎2006 Sep 11 6:57 AM
check whether these are SET IDs ? IF yes check Tcode GS03.
Then u have to get the data which comes In bt the Ranges of IDs from relavent table.
<b>Hi ,
first let us know where / what are u doing with these IDs ?
If u have the range say 1-10 , if u want to get the Values in b/w the ranges ? two things u can do ?
1.Create range table my incrmenting the Count upto high
then u are table looks like
1
2
-
10.
2
second thing u can do it
select ID from table ID where ID = r_id.
So here u will get list of ID which comes given range.</b>
Regards
Prabhu
‎2006 Sep 11 6:59 AM
‎2006 Sep 11 7:00 AM
Hi,
I guess you can use the ranges/select-options in this case.
You can use the selection criteria as
I|BT|LOA_A|LOA_K|
in the select query which contains the Id details selecting the ID's.
Hope this helps.
Otherwise please elaborate some more what how you are trying to do
Regards
Nishant
‎2006 Sep 11 7:03 AM
u can write simple program for that
seletion-screen : begin of block b1.
select-options : s_id for ztable-field.
seletion-screen : end of block b1.
loop at s_id.
write : s_id-low.
endloop.
‎2006 Sep 11 7:07 AM
Hi
Actually i need to use the code in a class method. The method will have 2 parameters like FROM_ID and TO_ID. I have to generate a list of ID's in between these 2 parameters in the alphabetical order.
Thanks and Regards
Moorthy
Message was edited by: Moorthy V N
‎2006 Sep 11 7:11 AM
You can pass the from_id LOA_A and to_id LOA_K and prepare a range and use it SELECT/LOOP statements
rng-sign = 'I'.
rng-option = 'BT'.
rng-low = from_id.
rng-high = to_id.
append rng.
‎2006 Sep 11 7:13 AM
Thank you Ramani.But my problem is not yet solved.
The list wont be generated by ABAP or what? I am not sure.
I am attching the code snippet. Please tell me what needs to be added?
DATA: lv_loa_id TYPE ap_logistics_area_id,
r_loa_id TYPE RANGE OF ap_logistics_area_id,
r_loa_id_line LIKE LINE OF r_loa_id.
r_loa_id_line-sign = 'I'.
r_loa_id_line-option = 'BT'.
r_loa_id_line-low = 'LOA_A'.
r_loa_id_line-high = 'LOA_G'.
APPEND r_loa_id_line TO r_loa_id .
LOOP AT r_loa_id INTO r_loa_id_line.
<what variable will have the value of 'LOA_C'>
ENDLOOP.
Message was edited by: Moorthy V N
‎2006 Sep 11 7:35 AM
LOOP AT r_loa_id INTO r_loa_id_line.
<b>write : r_loa_id_line-low.</b>
ENDLOOP.
‎2006 Sep 11 7:41 AM
But this will give me only LOA_A. I want the entire list of ID's between LOW value and HIGH value generated automatically somehow.
‎2006 Sep 11 7:59 AM
Hi,
Use this
Select < field name which has ID values>
from <Data base table>
into table <some internal table>
where <field name being selected> in r_loa_id .
Now this internal table will have all the ID's.You can loop in this one and get the ID's
Don't forget that the internal table here is having only one field which corresponds to the ID field.
Hope this helps
Regards
Nishant
‎2006 Sep 11 7:49 AM
Hi,
The range built r_loa_id should be used in SELECT statement get the list of IDs
SELECT loa_id.....
from
into table t_id
<b>where loa_id IN r_loa_id</b>
OR if you had already selected ids then to filter them
LOOP at t_id into wa_id where load_id IN r_loa_id.
ENDLOOP.
‎2006 Sep 11 7:55 AM
Hi,
The list of ID's is not present anywhere in the system. These are some new ID's which I need to generate.
So, I thought, instead of using my own logic for the generation of the ID's (which is based on alphabetical order only), I might used the existing funtionality in Ranges/SelectOptions.
SO my question is: Can I retrieve these new ID's from the ranges table somehow?
Thanks and Regards
Moorthy
‎2006 Sep 11 8:02 AM
No you can generate these IDs through Ranges/SELECT options
Both Ranges/SELECT options can be used only in case of SELECT statements / LOOP statements to filter data.
‎2006 Sep 11 8:02 AM
Sorry.
You cannot generate these IDs using Ranges/SELECT-options
‎2006 Sep 11 8:05 AM
But both Ranges/SELECT options should be using some function module to get the list within the range, right? It would be helpful if I could know the name of the module.
Thanks and Regards
Moorthy
‎2006 Sep 11 8:40 AM