12-01-2007 11:57 AM
Hi All
I need to count the the no. entered in select options
for example
SELECT-OPTIONS S_FORM FOR ZMFORM-NFORM. "numeric type
so when user enter 1 to 1000
i need to store 1000 lines to my internal table
do i need to count or is there any simple or better procedure
Thanks
Taran
12-01-2007 12:20 PM
Tarun,
In your case the select-options parameter which is S_FORM is it self an internal table with fields sign, low, high, option.
Simply apply the following sample code for your case.
SELECT-OPTIONS S_FORM FOR kna1-kunnr. "numeric type
data: v_count type i.
describe table s_form lines v_count.
Write:/ 'The number of entries made in the select optiond is:', v_count.
Hope this will serve your purpose.
Do reward if found use full.
Cheers,
Rama
12-01-2007 12:20 PM
Tarun,
In your case the select-options parameter which is S_FORM is it self an internal table with fields sign, low, high, option.
Simply apply the following sample code for your case.
SELECT-OPTIONS S_FORM FOR kna1-kunnr. "numeric type
data: v_count type i.
describe table s_form lines v_count.
Write:/ 'The number of entries made in the select optiond is:', v_count.
Hope this will serve your purpose.
Do reward if found use full.
Cheers,
Rama
12-01-2007 12:23 PM
First of all this should be a parameter and not a select-options, or you should have a select-options with no extension and no-intervals, as at most you are going to get only one value (I think).
There are many ways of doing this.
when reading the table itself
select * into itab up to n_records ......
when building your internal table itself records.
loop at all_data.
move-corresponding all_data to itab.
if syst-tabix le n_records.
append itab.
endif.
endloop.
If you for the first n records, then you can do
loop at itab to n_records
endloop.
if you want to last n records, then you can do
data : l_startrow type i.
describe table itab lines l_startrow.
subtract n_records from l_startrow.
loop at itab from l_startrow.
endloop.
Albert
12-01-2007 12:38 PM
hi,
you can try this below logic
tables:lips.
select-options: POSNR for lips-POSNR.
data:begin of it occurs 0,
n1 type lips-posnr,
end of it.
data:v1 type i,
v2 type i,
v3 type i.
at selection-screen on posnr.
move posnr-low to v1.
move posnr-high to v2.
v3 = v2 - v1.
do v3 times.
v1 = v1 + 1.
move v1 to it-n1.
append it.
clear:it.
enddo.
start-of-selection.
move posnr-low to it-n1.
append it.
sort it by n1.
loop at it.
write:/ it-n1.
endloop.
thanks.
12-01-2007 1:06 PM
hey guys thanks for your support
i have build logic with the help previous sdn replies