ā2014 Jun 24 6:54 AM
Hello gurus,
my requirment is i wanted to have the final value in DMBTR from BSEG table.
Here the condition i have implemented as
first of all when i entered value in AUGBL then the field BELNR value is being fetch if BUZEI = 1
and then when BELNR is passed to bseg with BSCHL =50 and QSSKZ =x2 then the final value DMBTR is fetch
So, heres the condition as,
select bukrs
belnr
gjahr
buzei
augbl
shkzg
wrbtr
qbshb
zuonr
hkont
kunnr
lifnr
kzbtr
skfbt
ebeln
xref1
umskz
mwskz
sgtxt
xauto
qsskz
qsshb
dmbtr
from bseg
INTO table gt_bseg
FOR ALL ENTRIES IN it_str
where augbl = it_str-augbl
and belnr = it_str-augbl
and bukrs EQ it_str-bukrs
and buzei = 1
and qsskz = 'x2'
and bschl = 50.
can u check it is correct or not?
where is my mistake?
what should i do?
pls help me
Regards,
Prathmesh Rane.
ā2014 Jun 24 7:24 AM
You query will only fetch documents if AUGBL and BELNR are same.
From what i understood you need all documents against AUGBL with BUZEI = 1 , QSSKZ = 'X2' , BSCHL = '50' (notice the ' ' around BUZEI & BSCHL value 50 )so,
remove condition and belnr = it_str-augbl from your select query then it will fetch all the required documents.
Finally your where conditions would be like this :
where augbl = it_str-augbl
and bukrs = it_str-bukrs
and buzei = '1'
and qsskz = 'X2'
and bschl = '50'.
+ As suggested above make x2 as X2.
ā2014 Jun 24 7:22 AM
Hi Rane,
Please check and qsskz = 'x2' " the X should be in Capital letter.
Regards,
Thangam.P
ā2014 Jun 24 7:24 AM
You query will only fetch documents if AUGBL and BELNR are same.
From what i understood you need all documents against AUGBL with BUZEI = 1 , QSSKZ = 'X2' , BSCHL = '50' (notice the ' ' around BUZEI & BSCHL value 50 )so,
remove condition and belnr = it_str-augbl from your select query then it will fetch all the required documents.
Finally your where conditions would be like this :
where augbl = it_str-augbl
and bukrs = it_str-bukrs
and buzei = '1'
and qsskz = 'X2'
and bschl = '50'.
+ As suggested above make x2 as X2.
ā2014 Jun 24 7:55 AM
HI ashish,
AUGBL AND BELNR both are not same
AUGBL is my clearing doc num
and belnr is reference num
So,
what shoul i do?
ā2014 Jun 24 8:21 AM
You will have to do this in 2 steps :
1. Get the list of relevant BELNRs.
You can do this using the same query and changing the where conditions as follows :
where augbl = it_str-augbl
and buzei = '1'
and bukrs = it_str-bukrs.
2 Once you have the list, use it to fetch the line items with BSCHL = '50' and QSSKZ = 'X2'.
deckare a second table same type as gt_bseg. I have named it gt_bseg2 here.
select fields same as in your query
into table gt_bseg2
from bseg
for all entries in gt_bseg
where belnr = gt_bseg-belnr
and bukrs = gt_bseg-bukrs
and gjahr = gt_bseg-gjahr
and bschl = '50'
and qsskz = 'X2'.
Now you will have all the documents you require in second table ( gt_bseg2 here ) from which you can read DMBTR.
ā2014 Jun 24 8:32 AM