‎2007 Jun 13 4:13 AM
Hi all,
I have one requirement , i want to select 4 fields from MARD table using select statment .
the main issue is , for example if i am having 1000 records in DB table ,
my select query should select 5 times , ie 200, 200,200,200,200 and append into my internal table .
can any one help how to write this query.
Tnks in advance.
regards
veera
‎2007 Jun 13 5:15 AM
hi veera
You can use DESCRIBE TABLE itab..
DESCRIBE TABLE itab. " internal table for ALV GRID.
WRITE: / SY-TFILL. " Number of rows..
Is this what you want..
Thanks,
ravish
<b>dont forget to reward points if helpful</b>
‎2007 Jun 13 4:15 AM
in SELECT statement, there's an option for UPTO n ROWS
DO 5 TIMES.
SELECT * UPTO 200 ROWS FROM..
ENDDO.
‎2007 Jun 13 4:25 AM
Darshil,
This logic will select same 200 records again & again....
I think he needs to select 0 to 200 , 201 to 400...so on.
It is possible only if we can mention UPTO <N> ROWS where <N> should be dyanmaic value
Regards,
sail
‎2007 Jun 13 5:10 AM
Hi ,
In database table how can i find out the value for 'N'.
how can i decide how many lines present in DB table for my where condtion.
Regards,
veera
‎2007 Jun 13 4:17 AM
Hi
If yo0u can specify all the Keys in the Where Condition in the Select statement do that. Otherwise if you need to restrict the Size of your internal table use
" PACKAGE-SIZE n". This way u can restrict the size of your internal table and you can select 200 each in every fetch...
Reward All Helpfull answers............
‎2007 Jun 13 5:24 AM
‎2007 Jun 13 4:32 AM
sample code for you ..
do 5 times .
SELECT bukrs belnr gjahr bldat monat budat xblnr awtyp awkey
UP TO 200 ROWS
FROM bkpf
INTO TABLE it_bkpf
enddo.
Girish
‎2007 Jun 13 4:38 AM
Hi ,
I guess you want to select one record and want it to be appended in the internal table 5 times.
for that you can use the following
select field1 field2 field3 field4 from mard into wa_mard
where matnr = (whatever).
do 5 times.
append wa_mard to itab.
enddo.
endselect.
this way u can select that record once from the DB & append it 5 times to you internal table.
Kindly reward points to all helpful answers.
Besr Regards,
Gaurav
‎2007 Jun 13 5:15 AM
hi veera
You can use DESCRIBE TABLE itab..
DESCRIBE TABLE itab. " internal table for ALV GRID.
WRITE: / SY-TFILL. " Number of rows..
Is this what you want..
Thanks,
ravish
<b>dont forget to reward points if helpful</b>