I am facing a peculiar problem while debugging a code which is written long back by someone.I will copy the code n then will explain whats the issue.
Code Starts -
select bukrs belnr gjahr bldat xblnr into table i_bkpf
from bkpf where
bukrs = w_bukrs and
gjahr = w_fyear and
budat in w_budat.
if sy-subrc ne 0.
message e034 with 'No records found'.
clear : i_bseg, i_bseg.
select bukrs belnr gjahr koart hkont shkzg sgtxt wrbtr lifnr
into table i_bseg from bseg for all entries in i_bkpf where
bukrs = i_bkpf-bukrs and
belnr = i_bkpf-belnr and
gjahr = i_bkpf-gjahr and
koart = 'S' and
hkont in w_hkont.
Code End -
Now the problem is
the belnr fetched from bkpf for the i/p give are
while selecting from bseg table(the second select stmnt) the BELNR coming in the program based on i_bkpf are
where as thru se16,BSEG table giving the following o/p for the same input fields
What i mean to say is , 5100000112 is appearing only once in the program o/p and actually 3 line items are ter in the table. i put same condition in table as of in the program to fetch the data.only difference i found is out of 3 line items of 5100000112 ,2 have same ETTAX value.But tat is not at all a criteria for selection in the select statemnet.
Hope u may have understood the problem.Can any body help me.