cancel
Showing results for 
Search instead for 
Did you mean: 

abap query

Former Member
0 Kudos

hi folks,

I need some help in this query below.

data: v_gsber(4) type n.

Select single gsber into v_gsber from pa0001

where pernr eq wa_tab-pernr and gsber ne 0.

It is throwing an error saying that the select statement should end with 'endselect'

I do not want to use endselect because it harms the performance.

The issue is: I am trying to retireve gsber from PA0001 for a 'pernr'and for every pernr there is more than one record in the table and the record of the pernr the gsber(business area) field is populated and I need to get that record only.

something like this...

PA0001 TABLE

pernr bukrs .... gsber

120005 4020 blank

120005 4020 blank

120005 4020 7317

I need the record whose gsber value is populated.

How can I change the query to avoid using 'endselect'.

Thanks

Vinu

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member188685
Active Contributor
0 Kudos

Hi,

your query is fine.


data: v_gsber(4) type n.

Select single gsber
        into v_gsber
          from pa0001
      where pernr eq wa_tab-pernr 
           and gsber ne 0.

i didn't get any error,

if you have more than one record , then your query should be


data: begin of itab occurs 0,
      v_gsber(4) type n,
      end of itab.

Select single gsber
        into table itab
          from pa0001
      where pernr eq wa_tab-pernr 
           and gsber ne 0.

regards

Vijay

Former Member
0 Kudos

Hi Vinu,

The select statements looks ok.Endselect is there when there is select upto 1 rows.

Just change your select...

put codes for the value gsber

and gsber ne <b>'0'</b>.

Select single gsber

into v_gsber

from pa0001

where pernr eq wa_tab-pernr

and gsber ne <b>'0'</b>.

Message was edited by: Phani Kiran Nudurupati

Former Member
0 Kudos

It is still asking for the 'endselect' statement.

Vinu

suresh_datti
Active Contributor
0 Kudos

You probably have another SELECT that is not closed..

Suresh Datti

Former Member
0 Kudos

Hi Vinu,

Can you give me the complete code.I guess you are missing a small comma or . ,some where before the select statement.

Former Member
0 Kudos

I got it and figured it out...

Thanks.

vinu