Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Limiting SELECT hits

Former Member
0 Likes
1,875

Hi!

How do I construct my SELECT statement so that I will only have 100 possible entries?

Even if there are 200 entries, I will only select the first 100.

Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,851

hi,

make a addition to select statement .

addition: up to 100 rows.

ex:

select *

up to 100 rows

from mara

into table itab.

regards,

Navneeth K.

hi,

make a addition to select statement .

addition: up to 100 rows.

ex:

select *

up to 100 rows

from mara

into table itab.

regards,

Navneeth K.

15 REPLIES 15
Read only

Former Member
0 Likes
1,851

hi,

Use

select* from table upto 100 rows

statment

Regards,

Santosh

Read only

0 Likes
1,851

Hi,

This is command for entry 100 rows.

select* from table upto 100 rows

Read only

Former Member
0 Likes
1,851

U can use 'up to 100' in select statement.

Read only

Former Member
0 Likes
1,851

SELECT * FROM table... UPTO 100 ROWS.. WHERE..

You should be able to get documentation on the addition by doing an F1 on the keyword SELECT.

You need to be aware though that specifying the number of rows will only fetch the first 100 rows out of 200 from the table.

Hope this helps.

Sudha

Read only

Former Member
0 Likes
1,852

hi,

make a addition to select statement .

addition: up to 100 rows.

ex:

select *

up to 100 rows

from mara

into table itab.

regards,

Navneeth K.

Read only

0 Likes
1,851

> hi,

>

> make a addition to select statement .

> addition: up to 100 rows.

>

> ex:

> select *

> up to 100 rows

> from mara

> into table itab.

>

> regards,

> Navneeth K.

Hi! I gave the points to this answer because it is the first correct answer.

It should be 'UP TO' and not 'UPTO' but thanks anyways to everyone who answered!

Read only

0 Likes
1,851

Nothing to do with points but I think Santosh Kumar P came up with the first correct answer:

select* from table upto 100 rows

His answer should have given you more than enough to go on, if you could not work it out from that then...

Read only

Former Member
0 Likes
1,851

Hello,

Eg.

SELECT * FROM EKPO

INTO TABLE itab up to 100 rows.

regards,

Neelambari

Read only

Former Member
0 Likes
1,851

Hi,

select *

<b> up to 100 rows</b>

.....

Regards,

Omkar.

Read only

Former Member
0 Likes
1,851

Hello,

USe the keyword <b>up to</b>

select* from mara table upto 100 rows

This up to statement will retrieve first 100 records which matches with the selection criteria.

Vasanth

Read only

Former Member
0 Likes
1,851

hi,

try using select * upto 100 .... query

Regards,

viji

Read only

Former Member
0 Likes
1,851

u people have gone mad for points everydby answering the same way cumn people this sdn helps people its not here 2 get points

Read only

0 Likes
1,851

> u people have gone mad for points everydby answering

> the same way cumn people this sdn helps people its

> not here 2 get points

Yep! I agree with this one. Haha. _

Read only

0 Likes
1,851

hi Ricardo,

I have answered thinking that you would get an idea to proceed not bothering about syntax as there is an F1 help to help you for sorting it out ... but i am embarrased to know that people need spoon feeding sort of answers.

Regards,

Santosh

Read only

Former Member
0 Likes
1,851

The select command is the most fundamental function of writing ABAP programs allowing the retrieval ofdata from SAP database tables. Below are a few examples of the various ways ofselecting data.

*Code to demonstrate select command

*Code to demonstrate select into internal table command


TYPES: BEGIN OF t_bkpf,
*  include structure bkpf.
  bukrs LIKE bkpf-bukrs,
  belnr LIKE bkpf-belnr,
  gjahr LIKE bkpf-gjahr,
  bldat LIKE bkpf-bldat,
  monat LIKE bkpf-monat,
  budat LIKE bkpf-budat,
  xblnr LIKE bkpf-xblnr,
  awtyp LIKE bkpf-awtyp,
  awkey LIKE bkpf-awkey,
 END OF t_bkpf.
DATA: it_bkpf TYPE STANDARD TABLE OF t_bkpf INITIAL SIZE 0,
      wa_bkpf TYPE t_bkpf.

TYPES: BEGIN OF t_bseg,
*include structure bseg.
  bukrs     LIKE bseg-bukrs,
  belnr     LIKE bseg-belnr,
  gjahr     LIKE bseg-gjahr,
  buzei     LIKE bseg-buzei,
  mwskz     LIKE bseg-mwskz,         "Tax code
  umsks     LIKE bseg-umsks,         "Special G/L transaction type
  prctr     LIKE bseg-prctr,         "Profit Centre
  hkont     LIKE bseg-hkont,         "G/L account
  xauto     LIKE bseg-xauto,
  koart     LIKE bseg-koart,
  dmbtr     LIKE bseg-dmbtr,
  mwart     LIKE bseg-mwart,
  hwbas     LIKE bseg-hwbas,
  aufnr     LIKE bseg-aufnr,
  projk     LIKE bseg-projk,
  shkzg     LIKE bseg-shkzg,
  kokrs     LIKE bseg-kokrs,
 END OF t_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
      wa_bseg TYPE t_bseg.


*Select directly into an internal table
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
       dmbtr mwart hwbas aufnr projk shkzg kokrs
  FROM bseg
  INTO TABLE it_bseg.


* Select directly into an internal table where fields are in a
* different order or not all fields are specified 
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
       dmbtr mwart hwbas aufnr projk shkzg kokrs
  FROM bseg
  INTO CORRESPONDING FIELDS OF TABLE it_bseg.


*Select... endselect command
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
       dmbtr mwart hwbas aufnr projk shkzg kokrs
  FROM bseg
  INTO wa_bseg.

  APPEND wa_bseg TO it_bseg.
ENDSELECT.

*Select FOR ALL ENTRIES command

<b>SELECT bukrs belnr gjahr bldat monat budat xblnr awtyp awkey

UP TO 100 ROWS

FROM bkpf

INTO TABLE it_bkpf.</b>


IF sy-subrc EQ 0.
* The FOR ALL ENTRIES comand only retrieves data which matches
* entries within a particular internal table.
  SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
         dmbtr mwart hwbas aufnr projk shkzg kokrs
    FROM bseg
    INTO TABLE it_bseg
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs EQ it_bkpf-bukrs AND
          belnr EQ it_bkpf-belnr AND
          gjahr EQ it_bkpf-gjahr.
ENDIF.



reward points if it is usefull .....

Girish