03-10-2009 12:42 PM
Hi experts
My sel SCr has
(all are select option)
Customer number - KUNNR
region - REGIO
date -BLDAT
company code -BUKRS
for (EG) if i have customer 00001 in Region AP .
According to my input even i give TN its fetching the output
leaving my customer name(kna1-name1) blank
can you pls help me out saying where i have gone wrong???
MY CODE
======
select bukrs gjahr belnr blart bldat budat xblnr bktxt xreversal from bkpf
into corresponding fields of table it_bkpf
where bukrs = pr_bukrs
and gjahr = wa_bkpf-gjahr
and belnr = wa_bkpf-belnr
and blart = 'DH' and
budat in so_budat
and xreversal = ' '.
If it_bkpf[] is not initial.
**Selection item details based on distributor
Select bukrs belnr gjahr buzei kunnr dmbtr zuonr from bseg
into corresponding fields of table it_bseg
for all entries in it_bkpf
where bukrs = it_bkpf-bukrs and
gjahr = it_bkpf-gjahr and
belnr = it_bkpf-belnr and
kunnr in so_kunnr.
Endif.
If it_bseg[] is not initial.
**Selection region for distributor
Select kunnr regio name1 from kna1
into corresponding fields of table it_kna1
for all entries in it_bseg
where kunnr = it_bseg-kunnr
and regio in so_regio.
Endif.
Loop at it_bseg into wa_bseg.
if wa_bseg-kunnr <> ' ' .
wa_final-belnr = wa_bseg-belnr.
wa_final-dmbtr = wa_bseg-dmbtr.
wa_final-zuonr = wa_bseg-zuonr.
wa_final-kunnr = wa_bseg-kunnr.
Endif.
read table it_bkpf into wa_bkpf with key belnr = wa_bseg-belnr.
wa_final-bldat = wa_bkpf-bldat.
wa_final-budat = wa_bkpf-budat.
wa_final-xblnr = wa_bkpf-xblnr.
wa_final-bktxt = wa_bkpf-bktxt.
ead table it_kna1 into wa_kna1 with key kunnr = wa_bseg-kunnr.
if sy-subrc = 0.
wa_final-name1 = wa_kna1-name1.
Endif.
append wa_final to it_final.
clear wa_final.
Endloop.
03-10-2009 12:47 PM
Hi:
It seems ok except one thing before end loop, you should clear the work areas too.
What problem you have ?
Regards
Shasi
03-10-2009 12:47 PM
Hi:
It seems ok except one thing before end loop, you should clear the work areas too.
What problem you have ?
Regards
Shasi
03-10-2009 12:52 PM
Hi
I hope your code is not the same the way you mentioned well still you can try to put a breakpoint and see what all values you are getting in it_kna1 table and then match those entries with the entries in the database if for the given kunnr their is no name1 maintained in kna1 then it will not appear in your report.
03-10-2009 12:53 PM
Hi:
It seems ok except one thing before end loop, you should clear the work areas too.
What problem you have ?
Regards
Shasi
03-10-2009 12:59 PM
Hi
I hope your code is not the same the way you mentioned well still you can try to put a breakpoint and see what all values you are getting in it_kna1 table and then match those entries with the entries in the database if for the given kunnr their is no name1 maintained in kna1 then it will not appear in your report.