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

select single with ranges

Former Member
0 Likes
749

hello pls look at thuis statement its thrwoing dump,

select single yygdatum yygdebitor yygvertrnr yygnachtnr yygpreisab yygpreisbi FROM

ygvabbv_30 INTO wa_ygvabbv_30_new

WHERE yygdebitor = wa_veda-yygdebitor AND

yygvertpos IN r1_vertpos.

since the value in ranges is 0,

can anybody suggest me wht 2 do?

thnkx

bhanu

8 REPLIES 8
Read only

Former Member
0 Likes
731

Try this..

as you are using IN ranges should not be a problem.

select single yygdatum yygdebitor yygvertrnr yygnachtnr yygpreisab yygpreisbi FROM

ygvabbv_30 INTO CORRESPONDING FIELDS OF wa_ygvabbv_30_new

WHERE yygdebitor = wa_veda-yygdebitor AND

yygvertpos IN r1_vertpos.

Read only

Former Member
0 Likes
731

Hi Bhanu,

Purpose of 'select single' is fetching single row and for that it is recomendable to provide values with '=' of primery keys.

Here, you are using range, so it has chance to fetch more than one rows at a time;

and which is not applicable in 'select single'.

So here you use:

Select <filed names> up to 1 rows......

endselect.

Hope it will solve ur problem.

Regards

Krishnendu

Read only

Former Member
0 Likes
731

My problem is i am not getting any value in ranges thats y its throwing dump!

can anybody suggest me for that?

Read only

former_member404244
Active Contributor
0 Likes
731

Hi,

we use range table like this..cehck how u have done

Ranges: bukrs for zstock-bukrs.

The difference is, because ranges doesn't show on the selection screen, you will have to fill it yourself, meaning you will have to fill bukrs-sign, bukrs-option, bukrs-low & bukrs-high all manually.

Some tips:

Sign is always I (for Include) or E (for Exclude)

Option can be a whole range, which includes:

EQ (Equal)

BT (Between))

CP (Contain Pattern)

So let's say you want to have the range check for all company codes not starting with AB, you will set your code as follow:

ranges: bukrs for zstock-bukrs.

bukrs-sign = 'E'. "Exclude

bukrs-option = 'CP'. "Pattern

bukrs-low = 'AB*'. "Low Value

bukrs-high = ''. "High Value

append bukrs.

Always remember to APPEND your range when you fill it, as the WHERE clause checks against the lines of the range table, not against the header line.

Declare the workarea wa_ygvabbv_30_new with the sequence in which u have selected from the fields from the table....Now u won't get any dump..

Regards,

nagaraj

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
731

Hi,

If you want the code not to be executed if the ranges doesn't have any value,

use the statements as below.

if not r1_vertpos[] is initial.

select single yygdatum yygdebitor yygvertrnr yygnachtnr yygpreisab yygpreisbi FROM

ygvabbv_30 INTO wa_ygvabbv_30_new

WHERE yygdebitor = wa_veda-yygdebitor AND

yygvertpos IN r1_vertpos.

endif.

But I don't think the dump is coming because there is no value in range.Check the statements you used for populating ranges are correct.

You should have used sign,option,high and low in that properly.

Example:

r1_vertpos-sign = 'I'.

r1_vertpos-option = 'EQ'.

....

append r1_vertpos.

Read only

Former Member
0 Likes
731

Hello Bhanu,

Can u please paste the DUMP Text and the Data Declaration of wa_ygvabbv_30_new ?

Reagrds

Saekt Sharma

Read only

Former Member
0 Likes
731

i have declared the ranges correctly

dump is coming for this select itself.

???

Read only

Former Member
0 Likes
731

DUMP TEXT--->CNT ACCEPT ' ' IN RANGES

THAT IS VALUE IN DUMP IS COMING NULL