2014 Sep 22 9:59 AM
Hi All,
Based on the earlier discussions I have tried the suggested solutions. But nothing works for my case. Kindly help.
I am declaring select options as follows.
SELECT-OPTIONS: s_no for vbak-vbeln.
LOOP AT s_no INTO wa_s_no.
...
...
...
ENDLOOP.
Suppose if I give the document number in the range like this 9200101150 to 9200101155.
I need to get all the documents in place. VBELN is of the type char. So I cannot increment also.
Please suggest any ways.
2014 Sep 22 10:03 AM
Get it from DB VBAK like below.
Select * into table lt_vbak
from vbak
where vbeln in s_no.
2014 Sep 22 10:09 AM
Hi,
This work for the rest of us:
DATA: r_vbeln TYPE RANGE OF vbak-vbeln."Same as SELECT-OPTIONS:
DATA: it_vbak TYPE TABLE OF vbak .
SELECT * INTO TABLE it_vbak
FROM vbak
WHERE
vbeln IN r_vbeln .
What is different in your case ?
Regards.
2014 Sep 22 1:06 PM
Hello guys,
Based on the requirement i cannot take this S_no directly from VBAK. I need to append these document numbers with VBFA records and then i have to get it from VBAK. SO I need to loop at s_no. VBAK-VBELN is of char type and so I cannot increment it.
2014 Sep 22 10:09 AM
What is the problem ?
Why you want/need to loop over your select-options ?
Like Niyaz said, you can use the select-options in your select without doing anything,so why are you looping ? What is it you want to achieve ?
2014 Sep 22 10:16 AM
2014 Sep 22 11:00 AM
Can you elaborate on actual requirement, some preliminary remarks :
Converting such a range to a list of value can generate some problems, e.g. dump if you generate a too wide range for a SQL statement, performance problem if you use a FOR ALL ENTRIES.
So why (and what) do you ask this ?
Regards,
Raymond
2014 Sep 22 1:11 PM
befor you can loop through the vbeln given in your select-option, you have to add an additional step and select them manually from Database.
Because as you already figured you can give ranges and will just have 2 numbers in your select-option.
So do a simply select - as by examples above already provided - and you will get a table suited with all the vbeln.
regards
Stefan Seeburger
2014 Sep 22 1:58 PM
Hi,
Hope it help full.
Select-options: s_no for vbak-vbeln.
if s_no-high is initial.
move s_no-low to s_no-high.
endif.
Select * from vbak
where vbeln between s_no-low and s_no-high.
Endselect.
Regards,
Venkat.
2014 Sep 22 2:00 PM
Dont loop the selection screen parameter.
First create internal table and work area.
TABLES : VBAK.
DATA: lt_tab type table of VBAK,
wa_tab type VBAK.
Then,select all entries from Database by the range given in S_NO .
for this follow this code.
SELECT * FROM vbak INTO TABLE lt_tab WHERE vbeln IN s_no.
then loop this internal table(lt_tab) into work area(wa_tab).
inside the loop just type all the fileds you need to display using WRITE statment.
LOOP AT LT_TAB INTO wa_tab.
.....
.....
.....
ENDLOOP.
Regards,
Ganesa Moorthy S.
2014 Sep 22 3:26 PM
Guys,
Thanks for your all suggestions.
My requirement is to initially query VBFA table. Now append S_no data to this selected VBFA.
After this we have filters and some other logic. At the end of this, based on this selected VBELN I have to query VBAK.
Suppose if I have 100s of documents in s_no, I am looping at it and selecting the data from VBAK. Why looping means we have some other requirements and logic. This is working fine and even performance wise it is agreed.
Now suppose if document range is given then it is taking only one loop and I am not able to get all the documents which are there in between.
Kindly help.
2014 Sep 22 3:53 PM
Hi,
as mentioned above, dont work with select-option directly. preselect your numbers to an internal table
regards
Stefan Seeburger
2014 Sep 22 4:12 PM
Do you have any select on vbak already use the output of the same if not, then as everyone has suggested only option is to fetch from vbak and use.
2014 Sep 24 4:24 AM
This was related to performance also. I wanted to avoid multiple selects for a single table. As loop at s_no is not possible, selecting from same table multiple times. Let me wait for the review result.
Thank you all.