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 query

Former Member
0 Likes
1,512

Hi experts.

I need to select sales order line item based on the selection screen input.

In selection screen Rejection reason is used.

I need to exclude the line item which are having the Rejection reason giving in selection screen.

If the the selection screen input is blank then all the records should be selected even the line item has no rejection reason.

I used the following query. But it doesnt work.

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency

and (abgru notin s_abgru or abgru eq ' ').

pls help me to do.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,471

Hi,

if s_abgru is not initial.

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency and

abgru Ne s_abgru.

else.

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency.

endif.

this will solve your problem.

Regards,

Ruchika

reward if useful.

14 REPLIES 14
Read only

Former Member
0 Likes
1,471

Hi,

Try this..


select vbeln posnr abgru 
from vbap
into table t_vbap
for all entries in t_vbak
where waerk ne 'usd' / document currency
and ( NOT abgru IN s_abgru ).

Thanks,

Naren

Read only

Former Member
0 Likes
1,471

try this..

you have to mention one field in where condition for the table used in for all entries

<b>if not t_vbak[] is initial.</b>

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where <b>field = t_vbrk-field</b> and

waerk ne<b> 'USD'</b> and

(abgru not in s_abgru[] or abgru eq ' ').

<b>endif.</b>

Read only

Former Member
0 Likes
1,471

Hi,

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency

and not abgru IN s_abgru.

when the selct option is blank all the line items will be selected by default..

Regards,

Vidya.

Read only

Former Member
0 Likes
1,471

try this

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where vbeln = t_vbak-vbeln and

waerk ne 'USD'

and not ( abgru in s_abgru or abgru eq ' ' ).

or

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where vbeln = t_vbak-vbeln and

waerk ne 'USD'

and ( abgru not in s_abgru or abgru eq ' ' ).

reagrds

shiba dutta

Read only

former_member186741
Active Contributor
0 Likes
1,471

select vbeln posnr abgru

from vbap

into table t_vbap

where waerk ne 'USD' and

( abgru not in s_abgru or abgru eq ' ' ).

Read only

Former Member
0 Likes
1,471

hi,

try with this

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd'

and abgru IN s_abgru. [for this you have to declare s_abgru and give value for it].

if helpful reward some points.

with regards,

suresh babu aluri.

Read only

Former Member
0 Likes
1,471

Hi Muru,

Try this

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where vbeln = t_vbak-vbeln and

waerk ne 'USD'

and not ( abgru in s_abgru or abgru eq ' ' ).

Regards,

Line

Read only

Former Member
0 Likes
1,472

Hi,

if s_abgru is not initial.

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency and

abgru Ne s_abgru.

else.

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency.

endif.

this will solve your problem.

Regards,

Ruchika

reward if useful.

Read only

0 Likes
1,471

Hi,

if s_abgru is not initial.

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency and

not (abgru in s_abgru).

else.

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'usd' / document currency.

endif.

this will solve your problem.

Regards,

Ruchika

reward if useful.

Read only

0 Likes
1,471

HI ALL,

I GOT SOLUTION . Thanks to all.

hi Ruchika Saini i done it from your reply only ya. Thanks a lot.

Read only

Former Member
0 Likes
1,471

hi all i tried all things.

But still it is not working.

SELECT VBELN POSNR MATNR ARKTX ABGRU MEINS NETWR KWMENG VRKME ERDAT

ERNAM ERZET

NETPR STCUR

FROM VBAP

INTO TABLE T_VBAP

FOR ALL ENTRIES IN T_VBAK

WHERE VBELN EQ T_VBAK-VBELN

AND KWMENG NE 0

AND WAERK NE 'USD'

  • AND ( ABGRU NOT IN S_ABGRU OR ABGRU EQ ' ' ). " i i uncomment this line it will work but not correctlyl

AND NOT ( ABGRU IN S_ABGRU ). " // not picking nothing....no records.

Read only

0 Likes
1,471

what you do is

loop at s_abgru.

<b> s_abgru-sign = 'E'.</b> " Excluding

modify a_sbgru index sy-tabix.

endif.

<b>if not t_vbak[] is initial.</b>

SELECT VBELN POSNR MATNR ARKTX ABGRU MEINS NETWR KWMENG VRKME ERDAT

ERNAM ERZET

NETPR STCUR

FROM VBAP

INTO TABLE T_VBAP

FOR ALL ENTRIES IN T_VBAK

WHERE VBELN EQ T_VBAK-VBELN

AND KWMENG NE 0

AND WAERK NE 'USD'

<b>AND <b>ABGRU IN S_ABGRU .</b> " // not picking nothing....no records

endif.</b>

Read only

Former Member
0 Likes
1,471

check in se11 whether any data is present or not for the where condition you have defined . then check in debug mode what is the sy-subrc value it is returning after the select statement...and put a check

if not t_vbak[] is initial.

select...

endif.

reagrds

shiba dutta

Read only

S0025444845
Active Participant
0 Likes
1,471

Hi,

use this

select vbeln posnr abgru

from vbap

into table t_vbap

for all entries in t_vbak

where waerk ne 'USD'

and abgru not in s_abgru .

anything in ' ' should be capital

sudha