Application Development 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: 

Select statement.

Former Member
0 Kudos

Hello friends,

I need to extract data from VBFA table in to an Internal Table

based on where condition from IT_VBRK internal table comparing

VBFA-vbeln = it_vbrk-vbeln.

But when doing so i also have a check where i have to check

for it_vbrk-aubel.

However If it_aubel is blank i want to skip that record completely.

I am trying to do without looping it_vbrk.

I dont want to delete the records in it_vbrk where AUBEL is blank.

below is the code that i tried but dosent work,

SELECT vbelv

vbeln

INTO TABLE it_vbfa

FROM vbfa

FOR ALL ENTRIES IN it_vbrk

WHERE vbeln EQ it_vbrk-vbeln

AND vbtyp_v EQ 'C'

and it_vbrk-aubel NE ' '.

Any advice,

Shejal Shetty.

1 ACCEPTED SOLUTION

suresh_datti
Active Contributor
0 Kudos

You cannot use two itab fields in your SELECT.. you can do it this way..


delete it_vbrk where aubel eq space.
check not it_vbrk is initial.
SELECT vbelv
vbeln
INTO TABLE it_vbfa
FROM vbfa
FOR ALL ENTRIES IN it_vbrk
WHERE vbeln EQ it_vbrk-vbeln
AND vbtyp_v EQ 'C'.

~Suresh

6 REPLIES 6

suresh_datti
Active Contributor
0 Kudos

You cannot use two itab fields in your SELECT.. you can do it this way..


delete it_vbrk where aubel eq space.
check not it_vbrk is initial.
SELECT vbelv
vbeln
INTO TABLE it_vbfa
FROM vbfa
FOR ALL ENTRIES IN it_vbrk
WHERE vbeln EQ it_vbrk-vbeln
AND vbtyp_v EQ 'C'.

~Suresh

Former Member
0 Kudos

Hi,

Store the IT_VBRK in a temporary internal table and delete the records that don't have the value for AUBEL..

IT_VBRK_TMP = IT_VBEK.

DELETE IT_VBRK_TMP WHERE AUBEL = ' '.

SELECT vbelv

vbeln

INTO TABLE it_vbfa

FROM vbfa

FOR ALL ENTRIES IN it_vbrk_tmp

WHERE vbeln EQ it_vbrk_tmp-vbeln

AND vbtyp_v EQ 'C'.

Thanks,

Naren

0 Kudos

Thanks Everyone for the suggestions.

So it has to be done only after i delete the blanks AUBEL.

or

loop through it_VBRK and check for blank aubel.

Shejal.

Former Member
0 Kudos

I think you have to do something like copy it_vbrk to it_vbrk_cop then delete it_vbrk_cop where aubel is blank. You can use it_vbrk_cop in the select.

Rob

former_member189629
Active Contributor
0 Kudos

Hi Shejal,

try this

if not it_vbrk-aubel is initial.

SELECT vbelv vbeln

INTO TABLE it_vbfa

FROM vbfa

FOR ALL ENTRIES IN it_vbrk

WHERE vbeln EQ it_vbrk-vbeln

AND vbtyp_v EQ 'C'

and aubel EQ it_vbrk-aubel.

endif.

Hope it works. If it does pl reward accordingly

K

0 Kudos

Karthik,

Thanks for the suggestion,

But it wont work because it is always comparing with one value of it_VBRK-aubel( the value in the header line and is the last record in it_vbrk).

Thanks

Shejal.