05-15-2009 10:19 AM
Hi All,
i want to fetch the KUNNR from BSEG table based on the BELNR. But if we see the BSEG table same same BELNR is having different KUNNR.
based on the KUNNR i want to dislpay the Customer name from KNA1.
so, how do proceed ?.
thanks in advance
manjusha.
05-15-2009 10:23 AM
You have to select data based on document ,year and item in order
to get unique record.
I.e use these fields - BUKRS,BELNR,GJAHR,BUZEI.
Now based on that kunnr get from KNA1.
05-15-2009 10:23 AM
You have to select data based on document ,year and item in order
to get unique record.
I.e use these fields - BUKRS,BELNR,GJAHR,BUZEI.
Now based on that kunnr get from KNA1.
05-15-2009 10:29 AM
bseg-bukrs, "Company Code
bseg-belnr, "Accounting Document Number
bseg-gjahr, "Fiscal Year
Use above fields to fetch the unique record
For Example.
SELECT belnr
augbl
wrbtr
shkzg
rebzg
rebzj
rebzz
FROM bseg
INTO TABLE t_partial_cleared
WHERE
bukrs = '1000' AND
belnr = bsad-augbl AND
gjahr = fiscal_year.
05-15-2009 10:35 AM
Hi All,
actually i am using the FEBEP table to fetch other reuired fields including BELNR.
so, i am checking the FEBEP-BELNR with BSEG-BELNR.
and for that BSEG-BELNR and BSEG-KUNNR i am fetching name1 rom KNA1 .
05-15-2009 10:45 AM
From FEBEP, read FEBKO with FEBEP-KUKEY, then read BSEG with FEBKO-BUKRS, FEBEP-GJAHR and FEBEP-BELNR
Regards
05-15-2009 10:50 AM
Lets say u get entries for BSEG in GT_BSEG with "FEBEP-BELNR with BSEG-BELNR." condition.
then 1 simple and effective way is.
sort gt_bseg by kunnr.
loop at gt_bseg into gs_bseg.
at new kunnr.
gs_kunnr-kunnr = gs_bseg-kunnr . "this gs_kunnr work areahas one field only as kunnr
append gs_kunnr to gt_kunnr. " gt_kunnr is table similar to gs_kunnr
clear: gs_kunnr.
endloop.
select kunnr
name1
from KNA1 into table gt_kna1
for all entries in gt_kunnr
where kunnr = gt_kunnr-kunnr.
or
loop at gt_bseg into gs_bseg.
gs_kunnr-kunnr = gs_bseg-kunnr . "this gs_kunnr work areahas one field only as kunnr
collect gs_kunnr to gt_kunnr. " gt_kunnr is table similar to gs_kunnr
clear: gs_kunnr.
endloop.
select kunnr
name1
from KNA1 into table gt_kna1
for all entries in gt_kunnr
where kunnr = gt_kunnr-kunnr.
05-15-2009 10:26 AM
Hi
select name1, name2 into table TB_NAME from KNA1
join BSEG on BSEGKUNNR = KNA1KUNNR
where BUKRS = WF_BUKRS and
BELNR = WF_BELNR and
GJAHR = WF_GJAHR and
BUZEI = WF_BUZEI.