02-02-2007 3:12 AM
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.
02-02-2007 3:32 AM
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
02-02-2007 3:46 AM
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).
02-02-2007 3:50 AM
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
02-02-2007 4:04 AM
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.