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

Problem in excuting select statement

Former Member
0 Likes
901

Hi,

I have created simple report and in start-of-selection i have writen select statement with bukrs and lifnr as parameters. But i am unable to execute the query.

find the code

start-of-selection.

select bukrs

lifnr

name1

name2

name3

from zapv_names

into table it_zapv

where bukrs = p_bukrs

and lifnr = p_lifnr.

I am not under stand why it is not working. The code is correct. I have taken names as zname field and others are standered data elements.

Thanks,

RamuV

10 REPLIES 10
Read only

Former Member
0 Likes
865

Hi

Try to check if your query can be done succeffully by trx SE16

Max

Read only

Sm1tje
Active Contributor
0 Likes
865

What is not working?

1. Don't you get any data at all?

2. Do you get a short dump?

3. etc?

Read only

Former Member
0 Likes
865

Hi,

As a precaution instead of INTO TABLE IT... Use INTO CORRESPONDING FIELDS OF TABLE..

Please tell what the error is if it still does not help.

Also cross check if p_bukrs and p_lifnr are with valid values or not and that for the combination data exists..

Since you ae using parameters with '=' ensure you are passing some values in these two.

Edited by: Ankesh on Jan 12, 2009 10:22 PM

Read only

Former Member
0 Likes
865

Hi,

check wheter you passing the P_bukrs & p_lifnr values to the select statment & the dat should exist in the table with conbination of values passed.

Read only

Former Member
0 Likes
865

> start-of-selection.

>

> select bukrs

> lifnr

> name1

> name2

> name3

> from zapv_names

> into table it_zapv

> where bukrs = p_bukrs

> and lifnr = p_lifnr.

First of all does ur table have data in the client ur executing ur report?

secondly it_zapv contains onlly field tht u have mentioned in it_zapv or it contains more if it contains more then use "into corresponding fields of table"

put a break point above the select and then check what point the execution is stopping at the select and are the params already been populated at tht time.

Read only

0 Likes
865

hi,

check wether the fields ur using in the select statement is in the order u have defined in the internal table...

Read only

Former Member
0 Likes
865

I'm going to take a wild guess that since you show this to be the first statement

after the START-OF-SELECTION line, that is is coming from a report program

where the two field you are testing for are actually RANGEs on the selection screen.


select bukrs
lifnr
name1
name2
name3
from zapv_names
into table it_zapv
where bukrs = p_bukrs   " This is likely a RANGE
and lifnr = p_lifnr.           " This is likely a RANGE

Change them to this


select bukrs
lifnr
name1
name2
name3
from zapv_names
into table it_zapv
where bukrs IN p_bukrs   " This is likely a RANGE
and lifnr IN p_lifnr.           " This is likely a RANGE

Ranges would be tables and have value like 'IEQ0101' where with the = sign would never be equal.

Edited by: Paul Chapman on Jan 12, 2009 12:23 PM

Read only

Former Member
0 Likes
865

Hi,

1) first check whether the order you are fetching the fields in the same order you are declared fields in the internal table or else you can use into corresponding fileds of table instead of into table.

2) in the where condition you had used some like p_bukrs whether they are parameters or select-options

i don't know if they are select-options you should use in instead of ' =' after where in your select query like

ex :

select f1

f2

f3

from tab1

into table itab

where bukrs in p_bukrs.

Thanks & Regards,

Sateesh.

Read only

Former Member
0 Likes
865

Hi ,

Write your query like this :

tables : zapv_names . "declare by tables statement .

select bukrs

lifnr

name1

name2

name3

from zapv_names

into corresponding fields of table it_zapv

where bukrs = p_bukrs

and lifnr = p_lifnr.

if again not work than check the data is available in database for the given company code and vendor .

it wil work definately .

Regards ,

Nilesh Jain .

Read only

Former Member
0 Likes
865

Hi,

First check the table zapv_names whether the datas are there for the given input or not.

I think this will solve ur problem.

Thanks.