11-23-2007 1:17 PM
I want to select particular number of rows , say for example I want to select top 500 rows from table without any conditions or filter...
Is it possible in SAP select query ??
In oracle we have the option of selecting TOP 'n' rows from a database table..
Do we have such option in SAP? can we select certain number of rows alone from a table???
any help wud greatly be appreicated !!!!
11-23-2007 1:18 PM
Hi,
Yes, it is ppossible.
You can use SELECT statement with UP TO 500 ROWS.
SELECT <field>
INTO TABLE <internal table>
FROM <table>
UP TO 500 ROWS.
Regards,
Ferry Lianto
11-23-2007 1:33 PM
Thanks for ur solution !!!!
I have one more query ... if possible kindly give me ur suggestions ...
i have a table with millions of records and each record has to be processed.. but.. Im not supposed to load them into internal table at one shot..
Is it possible to load the table by having a count such that 'n' numbr of rows will be loaded and processed and then we move on to next 'n' number of rows from database table and process them??
Is there any such possibility at all in SELECT query???
11-23-2007 1:36 PM
Hi Ramya,
Do in this way
SELECT matnr FROM marc INTO TABLE xmarc
PACKAGE SIZE 5000 UP TO p_count ROWS
WHERE matnr IN s_matnr.
PERFORM process_package.
ENDSELECT.
<b>Reward Points for helpful answers</b>
Regards,
Satish
11-23-2007 1:46 PM
Hi,
Yes, it is possible.
You can use SELECT statement with PACKAGE SIZE as Satish suggested earlier.
Regards,
Ferry Lianto
11-26-2007 6:41 AM