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: 

Query for selecting the field of VBRK

Former Member
0 Kudos

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'.

endif.

clear wa_vbrk-zuonr.

endloop.

if vbrl-zuonr = 'X'.

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

endif.

endloop.

4 REPLIES 4

Former Member
0 Kudos

data : vxblnr(9).

vxblnr = it_wabuch-xblnr+2(8).

concatenate vxblnr '%' into vxblnr.

select single * from vbrk where fkart = 'F2'

and fktyp = 'L'

and vbtyp = 'M'

and rfbsk = 'C'

and fksto = space.

and ZUONR like vxblnr.

regards

shiba dutta

0 Kudos

The problemw with it_wabuch-xblnr+2(8) is picking correct record..

but while fetching vbrk the filed of ZUONR should be of zuounr+0(8)

only eight character of zuonr should be compared with it_wabuch-xblnr+2(8).

0 Kudos

ok here zuornr like vxblnr means it must match first 8 characters of vxblnr and after that some other things may be or may not be there in zuornr.

just check whether it is working or not if not let me know?

regards

shiba dutta

0 Kudos

just write ur query as below -

data d_date(8).

loop at it_wabuch.

d_data = it_wabuch-xblnr+2(8).

select single * from vbrk where fkart = 'F2'

and fktyp = 'L'

and vbtyp = 'M'

and rfbsk = 'C'

and fksto = space.

and ZUONR like d_date.

endloop.

it will work.