Skip to Content
Former Member
Feb 02, 2007 at 03:12 AM

Query for selecting the field of VBRK


Hi All,

I have fetched the Ztable into it_bauch.

In the loop of It_bauch i have to fetch the records of vbrk in which the field of zuonr is wrongly stored in xblnr.

while fetching VBRK the zuonr0(8) should be comapred with it_zbauch-xblnr2(8).

select single * from vbrk where fkart = 'F2'

and fktyp = 'L'

and vbtyp = 'M'

and rfbsk = 'C'

and fksto = space.

  • <b> and ZUONR0(8) = it_wabuch-xblnr2(8).</b>

ZUONR0(8) = it_wabuch-xblnr2(8).</b>

the above line cannot be return so the below code is given whether it would work or not or any other solution kindly do respond

data : begin of it_vbrk occurs 0.

include structure vbrk.

data : end of it_vbrk.

data vbrk_flag type c.

data : begin of wa_vbrk,

zuonr(8) type c,

end of wa_vbrk.

loop at it_bauch.

select single * from vbrk into it_vbrk where fkart = 'F2'

and fktyp = 'L'

and vbtyp = 'M'

and rfbsk = 'C'

and fksto = space.

loop at it_vbrk.

wa_vbrk-zuonr = it_vbrk-ZUONR+0(8).

read table it_wabuch with key xblnr+2(8) = wa_vbrk-zuonr.

if sy-subrc = 0.

clear vbrk_flag.

vbrk_flag = 'X'.


clear wa_vbrk-zuonr.


if vbrl-zuonr = 'X'.

After lot of select querey are there based on above condition would trigger.