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

help in select

Former Member
0 Likes
1,507

HI,

i have to add to this select condition that

vbakvbtype = 'L' <b>JUST WHEN</b> vbakauart = 'YMC0'.

what is the best way to do that?

I REWARD

Regards


  SELECT    vbak~vbeln vbak~objnr vbak~audat
            vbak~netwr vbak~waerk vbak~kvgr3
            tvv3t~bezei
            FROM vbak LEFT OUTER JOIN
      tvv3t ON tvv3t~kvgr3 EQ vbak~kvgr3
      AND tvv3t~spras EQ sy-langu
  INTO CORRESPONDING FIELDS OF TABLE lt_vbak
  WHERE vbak~ps_psp_pnr EQ l_project.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,471

I wouldn't do the check as part of the select but instead do the check while looping the internal table.

12 REPLIES 12
Read only

Former Member
0 Likes
1,472

I wouldn't do the check as part of the select but instead do the check while looping the internal table.

Read only

0 Likes
1,471

hi fred

maybe u can give example?

regards

Read only

0 Likes
1,471

hi TAL,

I gave you the solution, not just a very helpful answer...

ec

Read only

0 Likes
1,471

hi eric

its not working well

i wont vbakvbtype = 'L' JUST WHEN vbakauart = 'YMC0'

meaning i <b>dont</b> wont to get vbtype = 'L' when vbak~auart <b>ne</b> 'YMC0'

Regards

Read only

0 Likes
1,471

TAL,

sorry it is still not clear for me...

if vbakauart = 'YMC0' than you need records where vbakvbtype = 'L'

right?

but, in the opposite? I mean when vbak~auart NOT EQUAL 'YMC0'?

What should be the result?

thanks

ec

Read only

0 Likes
1,471

hi eric

thankes for your time

i wont just vbtype = 'L'

only for vbak~auart = 'YMC0'

i dont wont any other vbtype = 'L' from table

Regards

Read only

0 Likes
1,471

than it's simple:

WHERE vbak~ps_psp_pnr EQ l_project AND

vbak~auart EQ 'YMC0' AND

vbak~vbtype EQ 'L'.

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,471

hi TAL,

WHERE vbak~ps_psp_pnr EQ l_project AND

( ( vbak~auart EQ 'YMC0' AND

vbak~vbtype EQ 'L' ) OR

( vbak~auart NE 'YMC0' ).

hope this helps

ec

Read only

0 Likes
1,471

hi eric

i wont vbakvbtype = 'L' JUST WHEN vbakauart = 'YMC0'

meaning i <b>dont</b> wont to get vbtype = 'L' when vbak~auart <b>ne</b> 'YMC0'

Regards

Read only

Former Member
0 Likes
1,471

SELECT vbakvbeln vbakobjnr vbak~audat

vbaknetwr vbakwaerk vbak~kvgr3

tvv3t~bezei

FROM vbak LEFT OUTER JOIN

tvv3t ON tvv3tkvgr3 EQ vbakkvgr3

AND tvv3t~spras EQ sy-langu

INTO CORRESPONDING FIELDS OF TABLE lt_vbak

WHERE vbak~ps_psp_pnr EQ l_project

and vbak~vbtype = 'L'

and vbak~auart = 'YMC0'.

or

<b> SELECT vbakvbeln vbakobjnr vbak~audat

vbaknetwr vbakwaerk vbak~kvgr3

tvv3t~bezei

FROM vbak LEFT OUTER JOIN

tvv3t ON tvv3tkvgr3 EQ vbakkvgr3

AND tvv3t~spras EQ sy-langu

INTO CORRESPONDING FIELDS OF TABLE lt_vbak

WHERE vbak~ps_psp_pnr EQ l_project.

if not it_vbak[] is initial.

sort it_vbak by auart.

read table it_vbak with key auart = 'YMCO' binary search.

if sy-subrc = 0.

if it_vbak-vbtype ne 'C'.

delete it_vbak index sy-tabix.

endif.

endif.

endif.</b>

Regards

vasu

Read only

0 Likes
1,471

hi vasu

i wont vbakvbtype = 'L' JUST WHEN vbakauart = 'YMC0'

meaning i <b>dont</b> wont to get vbtype = 'L' when vbak~auart <b>ne</b> 'YMC0'

Regards

Read only

Former Member
0 Likes
1,471

i have to add to this select condition that

vbakvbtype = 'L' JUST WHEN vbakauart = 'YMC0'.

what is the best way to do that?

I REWARD

Regards

loop at lt_vbak into lh_vbak.

if lh_vbak-vbtype <> 'L' or lh_vbak-auart = 'YMC0'.

perform process_data.

endif.

clear lh_vbak.

endloop.